nodsv0.1.0 Open a card from the credit
nods.to
  1. nods
  2. The package
  3. Open a card from the credit

Open a card from the credit

A click on the credit opens a card. The package handles focus and placement, and you choose what the card looks like.

Marigold

Project
Kiln
Role
Design
Issued
2026
Build
Pocket Monday

The code for what is on screen

import { ROLES } from '@nodsto/record';
import { attachPanel } from '@nodsto/credit/panel';
import '@nodsto/credit/panel.css';
import { panelDrafting } from './nods/panel-drafting/panel-drafting.js';
import './nods/panel-record/panel-record.css';
import './nods/panel-drafting/panel-drafting.css';
import { record } from './record.js';

const root = document.querySelector('.nods');
const panel = document.createElement('div');
panel.className = 'nods-panel';
panel.innerHTML = panelDrafting(record, { party: 'Marigold', page: 'https://nods.to/demo/marigold' }, { ROLES });

const card = attachPanel(root, { panel, label: 'Kiln credits', disclosure: 'Credits' });

Copy a card into your project.

A card is one of the templates: a function that returns markup, and a stylesheet. The makers’ cards are drawn over the plain card’s sheet, so copy panel-record with the card you choose.

Terminal

npm install @nodsto/templates
mkdir -p src/nods
cp -R node_modules/@nodsto/templates/panel-record src/nods/
cp -R node_modules/@nodsto/templates/panel-poster src/nods/

Attach the card to the credit.

attachPanel makes the button that opens the card, so a page whose script never runs has a credit and no dead control. It handles focus, Escape, a click outside and where the card is placed. The template draws the card and leaves all of that alone.

It returns a controller with open(), close(), toggle(), destroy() and state.

Pass a card what it is to say.

A maker’s card takes party, the name of the maker it is for on a site several people made, and page, the address of that maker’s page. panel-cast is for everybody at once: each maker has a card of their own, laid one on the next under a band that names the project. Its tints give a maker’s card its colour, its marks keep the line style a maker’s name has, and every card carries data-maker for a rule of yours to hold on to.

CardOptions
panel-recordNone
panel-posterparty, line, ticker, page, seal, id
panel-grooveparty, page, rim, side, id
panel-listingparty, page, file
panel-foilparty, page, line
panel-swatchesparty, page, swatches
panel-draftingparty, label, page
panel-loopparty, page
panel-casttints, marks, hosts, page

Pick the surface a click opens.

A configuration names one of six reveals. The first two attach no panel and need no script. The others are the reveal option of attachPanel. A click always opens the card, and hover: true lets a pointer open it too.

RevealA click opensScript
noneNothing. The names link out.None
pageThe record page. The control is a link.None
cardA card placed against the control, flipped and kept inside the window.The panel script
stripA band across one edge of the window, as tall as its content.The panel script
sheetA panel from one edge, up to a maximum height, scrolling inside.The panel script
dialogThe whole window, over a backdrop.The panel script

Stage the entrance and the exit in CSS.

The script writes the card’s state as attributes, and your stylesheet hangs an animation on them. Declare how long the exit takes in --nods-exit and the script keeps the card painted for that long. A visitor who asks for reduced motion sees the card leave at once.

site.css

.nods-panel[data-nods-open] .mine { animation: arrive 500ms both; }
.nods-panel[data-nods-closing] .mine { animation: leave 240ms both; }
.nods-panel:has(.mine) { --nods-exit: 240ms; }
AttributeOnWhen
data-nods-openThe panelWhile it is open. An entrance keyed to it plays once.
data-nods-closingThe panelWhile it leaves. An exit keyed to it plays for the length of --nods-exit.
data-nods-stateThe panelAlways, as closed, open or closing.
data-nods-flipThe panelOn a card, as above or below, for the side of the control it was placed on.
data-nods-activeThe creditWhile its card is open. The line styles answer it.

Listen for the card opening.

Five events are dispatched on the credit. They bubble, so a footer or document hears them. Each carries the panel, the button and a reason, which is one of click, hover, escape, outside, focus, api.

site.js

document.addEventListener('nods:open', (event) => {
  const { panel, trigger, reason } = event.detail;
});

document.addEventListener('nods:beforeopen', (event) => event.preventDefault());
EventWhenpreventDefault()
nods:beforeopenThe card is about to open.Stops it
nods:openThe card is open and its entrance starts.Has no effect
nods:beforecloseThe card is about to close.Stops it
nods:closeThe card is leaving and its exit starts.Has no effect
nods:closedThe exit is over and the card is out of the way.Has no effect

Colour a card with its own tokens.

Each card’s colours are tokens of its own, so recolouring a card leaves the line in the footer as it was.

CardWhat it isBackground, text, accent
panel-recordThe plain card, with the project, its credits and two actions.--nods-panel-bg #ffffff--nods-panel-fg #14171a
panel-posterThe name as wide as the sheet, a ticker along the foot and a seal on the edge.--po-bg #111315--po-ink #f4f1ea
panel-grooveA sleeve in the maker’s colour with the record half out, turning.--gv-sleeve #e8401c--gv-fg #190d09--gv-label-bg #efe8d9
panel-listingThe credit’s own markup on green-bar listing paper.--lp-paper #f9f9f2--lp-ink #111a12--lp-accent #17663a
panel-foilA tall dark card with foil across it, which tilts towards the pointer.--fo-bg #0e0e12--fo-ink #f5f3ee
panel-swatchesThe project’s palette as a fan of chips, with the maker’s cover in front.--sw-cover-bg #fbf9f3--sw-cover-ink #14171a
panel-draftingThe name constructed on ruled lines, under a dimension that says what the maker is.--df-bg #103a8c--df-ink #eaf2ff
panel-loopA capsule with the name in it and a wave going through the name.--lo-bg #3b1ee0--lo-ink #ffffff
panel-castEverybody on a site, each on a card of their own, held by one band.--ct-bg #0b0b0c--ct-ink #f6f4ee

These nine are the cards nods.to serves. The package holds 11 templates in all, and manifest.json lists the tokens of each. The home page shows the cards open.

Next, set a credit in layers.