isometric-diagrams
GitHubnpmCloud editor ↗

Stacks: a building of floors from a plain model (0.36.0)

A stack is a building of floors, drawn from a plain model a host builds: a slab for each floor with its name lettered along the slab's front edge, the floor's members on plinths with their resources, an optional manager's desk (or an empty one), walls round each storey in the slab's own colours, a core beside the stack, and a marking painted flat on the roof. The engine has no words of its own here: everything drawn comes from the model, and the host maps its own state words to the engine's tones.

import { stack } from '@johnoscott/isometric-engine/systems';   // or '@johnoscott/isometric-engine/stack'
const svg = stack.renderStackSvg(model, { theme });             // the stack closed, as one SVG that needs nothing else
const open = stack.renderStackSvg(model, { theme, open: 'diagrams' });   // one floor drawn out toward the viewer
const all = stack.renderStackSvg(model, { theme, opening: 'all', open: true });   // every floor out, a staircase
const anim = stack.renderStackAnimatedSvg(model, { theme, opening: 'all' }).svg;  // (0.37.0) it plays by itself
const mark = stack.stackMarkSvg(model);                          // the sidebar mark: 24 px, one dot, no words
const s = stack.mountStack(el, model, { theme, initialOpen: stack.pickInitialOpen(model) });
s.update(next);      // animates only the difference
s.open('chat'); s.close(); s.setMode('all'); s.dispose();

The model: stack/1#

The JSON Schema is src/iso-systems/stack/stack-1.schema.json; stack.checkStack(model) gives every fault with its path, and the calls above throw StackModelError (its problems) for a model with faults.

Key
version, idrequired1; an id (letters, digits, -, _)
markingrequiredpainted flat on the roof, like a helipad marking
floorsrequiredbottom up; each { id, label, kind?, state?, manager?, members?, resources?, problems? }
roof{ members?, resources? }: who stands on the roof
core{ label, sub? }: the column beside the stack, named
statesrequiredthe host's state words → { tone, glyph? }
wordsrequired{ emptyDesk, emptyDeskSub? }: the words for an empty desk

A floor: label is lettered along its slab's front edge, as given. kind is base (the floor the stack stands on, with resources only), floor (the default) or remote (drawn dashed: it runs elsewhere). Its state word may make it off (drawn faint). manager is a member behind the members' row, in the column after the last member's; null draws the empty desk with words.emptyDesk. members stand in the front row, a slot each in order: a member added at the end moves no one. Nothing stands in the strip along a floor's back edge that the floor above overhangs when it is out (its headroom, 1.4). problems is a count, shown as a badge.

A member: { id, name, sub?, role: 'manager' | 'member', avatar?, state, mark?, plinth?, kept?, restarting?, resources? }. Its state word is drawn as a ring round its avatar in its tone, and a glyph beside it (the state never reads by colour alone). avatar (0.40.1) is what it wears: orb, the sphere with eyes, or session, the session box at the same size. None said is the session box, so the orb is only ever the host's choice: the host knows which program a member runs and gives the orb only to the one that wears it. AVATARS lists them; avatarAsset(avatar) gives the asset. In the still, the export that plays, stackDocument, mountStack, a block (its kiosk too) and <isometric-diagram>'s el.stack. mark names a mark the host registered (objects.registerMarks), worn on the member's badge.

A resource: { id, kind, label, sub?, state? }; kind is repo, worktrees, service, schedule, file or store.

Tones, most urgent first: critical, warning, working, idle, good, done, off. Glyphs: play, ask, stop, check, cross, pause, dot. Each tone's colour is the host's CSS custom property --stack-tone-<tone> where the SVG is in the page, else the engine's own (stack.TONE_COLOURS).

How it opens (0.37.0)#

Three openings, each a set of poses (where each floor is, and how open: its walls sunk into its slab, its slot shelled, its names showing). A still draws one pose, the live stack moves between them, and the export samples them over time: one definition for all three.

openingReduced motion shows
one (the default)a floor slides out toward the viewer just as far as clears the floor above (D − (storey − slab), 6.6 grid units by default), its walls sinking and its place closed by a dark shellthe stack closed (or the floor open)
drawersevery floor above the base slides back, a cascade, each further than the one under it, and up by a station's height (openGap, 1.75)the stack open
allevery floor below the roof slides out toward the viewer, a staircase, each clear of the one above and down by a station's height (openGap) from it; the roof stays on its corethe stack open

Drawing#

renderStackSvg(model, { theme, mode?, opening?, walls?, open?, storey? }): mode is the theme's (light or dark). Closed, each storey is walled in its slab's colours, seamless, and only the roof's names show. open is a floor's id (one) or true (drawers, all: the whole opening). walls: false leaves the storeys open. storey is floor to floor (2.6 by default: a 1.2 slab and 1.4 of headroom). Every floor's things are tagged by class (st-f<k> its move, st-drop<k> its walls, st-lab<k> its names and glyphs, st-slot<k> its slot shell), and the pose is CSS rules inside the SVG.

The paint order is bottom up, floor by floor (each floor's slot shell, plate, lettering, what stands on it, then its walls), which is right for the stack closed, slid back, and with floors out in front. (0.39.1) It is back to front in true isometric depth in every opening: opened every way at once, the floors spread apart by openGap, so what stands on a floor is lower than the slab above it, and nothing stands in the strip the floor above overhangs. The tests check it both ways: by the drawing's boxes in each opening, and in Chrome (no station under another floor's slab, every floor's name in sight). A floor's lettering is tagged data-lettering="<floor id>".

renderStackAnimatedSvg(model, { theme, opening, cycle?, hold?, loop? }): one SVG that plays by itself (CSS keyframes, no script): one, each floor of cycle (default: every floor with a manager or members) out in turn, held, back; drawers, the cascade back from the base up and in from the top; all, the staircase out from the top down and in from the bottom up. It returns { svg, duration }.

stackMarkSvg(model, { height?, title?, colours? }): the floors as bands of a small block and one dot in the stack's most urgent tone (stackTone), 24 px high by default, no words. Without a title it is aria-hidden (the host's row names it).

stackDocument(model) gives the engine's own drawing (an isodiag/1 document) and its geometry, for a host that compiles it itself. It is the drawing before the stack is painted: no floor names, badges or rings, and closed. To show a stack with a reader's zoom and pan, give the model to <isometric-diagram> (0.40.0): el.stack = model, with opening and open attributes (docs/MOTION.md). stackCssom(model, options) is what it uses: renderStackSvg's picture with no style element and no style attributes, and style(svgElement) to put them and the pose on as CSSOM, for a page whose CSP takes no inline style. (0.45.0) In the element a stack's words stay readable at any fit: the names at least 11 CSS px on screen and the words under them (a resource's port, an empty desk's) at least 10, each grown from its foot (a name stays over its agent), fitted again on every resize, zoom or camera move; grown words that meet are moved up clear of each other, the agents' names and an empty desk's words first. (The floors' lettering is not resized: at a very small fit it is small too.) (0.48.0) The floors' lettering is placed first and nothing moves it: any word that meets it, or a word placed before it, moves up clear (grown or not); an empty desk's words stay on their floor, moved in along it from its edges. (0.49.1) A word that meets one takes the nearest clear place, up, down or along its floor, never one over another floor; an empty desk's words never sit on a higher floor's slab, and where nothing fits at a readable size their second line is set aside. They are placed in the drawing's own units (the floors' poses and each shape's own box), so every browser places them alike. (0.45.0) The element's stack part is a second file in the package, isometric-stack.js, beside isometric-diagram.js: the element imports it the first time a stack is drawn, so serve the two side by side. Statuses set before it has loaded are applied once it has.

Live#

mountStack(el, model, { theme, opening?, initialOpen?, onOpen?, onSelect?, fade?, move?, … }) draws into an element.

  • initialOpen (one): a floor id, or ids in the host's order (the first that is a floor wins); pickInitialOpen(model) gives the most urgent floor by tone (critical before warning), or none.
  • update(model) draws the new model and animates only what differs: what changed crossfades from its old look, what came fades in, what went fades out; nothing that stayed is touched, and the pose is kept.
  • Clicks: a member (its avatar, plinth, badge, ring or glyph) calls onSelect(memberId). A floor opens (one: that floor; drawers, all: the whole opening); a click on a floor already open calls onOpen(floorId), for the host to open it. Nothing depends on hover.
  • Keys: the floors are buttons in the tab order, bottom up, named by their lettering; Enter or Space acts as a click, Escape closes.
  • open(id?), close(), setMode(opening) (drawers and all open at once, one starts closed), mode, opened, svg(), dispose(). Under prefers-reduced-motion every change is at once.

Objects and statuses (0.42.0)#

Every thing on a group's drawing is an object with a kind, an id and a status. The kinds: group (the building), workspace (a floor), manager, worker, service, schedule, room. Ids are the host's, from its workspace files' keys: engine, engine/kit, studio/gm. The stack model's own ids are the same with / written -- (modelIdOf).

const { model, objects } = stack.stackFromSpaces(group, spaces, { words: { emptyDesk: '…' }, agents: {}, wear: o => ({ shape: 'dome', colour: '#e2ab8e', mark: 'house' }) });
const live = stack.applyStatuses(model, objects, { 'engine/kit': { state: 'running', activity: 'waiting' } });
  • stackFromSpaces(group, spaces, o) builds a group's stack/1 model, and every object on it, from what its files say: a floor per member workspace (bottom up, lettered with its key), its manager (role: manager) and workers, its services; the group's own manager on the roof with its schedules. group is { group, title?, manager?: { key, name? }, members: [keys], schedules?: [{ key, name?, every? }] }; each of spaces is { key, title?, agents: [{ name, role? }], services?: [{ name, port? }], schedules?, rooms? }. The host reads its files and gives the facts. o.words is required (the engine has no words of its own); o.wear gives each member its agent (the host knows which program runs it); o.agents draws the members as agents. objectsFromSpace(space) gives one workspace's objects alone.
  • Statuses are a workspace state's items: { state, activity, drift } (and, for an agent, screen and link), partial. lookOf(status) gives the look: down, drift, needs-you, working, starting, idle, asleep, stopped, unknown (nothing known is never healthy). statusFor(look, kind) goes the other way. rollUp(looks) is the most urgent. The model stackFromSpaces gives has the looks as its state words (LOOK_STATES: a tone, a glyph and eyes for each).
  • A group's live state (group-state-1) is { version: 1, group, items: { [id]: status } }: every object's status by its id, flat. Chosen over nesting the members' workspace states: a show's step, el.set() and a recording all name objects by id, and a flat map merges a partial one by key. A host with workspace states makes one by prefixing each item's key with its workspace's (engine + kit → engine/kit).
  • applyStatuses(model, objects, items) puts a group state on the model: each member's, service's and schedule's state word becomes its look; an agent's screen and chat light; each floor's problems badge counts what needs a person, is down or has drifted. The model given is not changed.

Agents (0.42.0)#

With model.agents (any options, {} for the defaults), members are drawn as agents, not as avatars with rings: a body floating over its plinth with a soft contact shadow, eyes that say its state, a headset with its chat light, a screen behind it on the plinth, and a mark on the floor under it. No rings and no glyphs: the eyes are the state.

  • The body: member.agent.shape is sphere, cone, dome or geodesic (a faceted icosphere), in member.agent.colour (#rrggbb; default a neutral grey). Shapes and colours are the host's choice: the engine names no program.
  • The eyes, from the member's state word: states[word].eyes, else its tone's (TONE_EYES: critical down, warning needs-you, working working, good and idle idle, off stopped, done asleep). Needs-you is wide and amber, down a red ✕, both outlined so they read on any body.
  • Facing (agents.facing): away at its screen (the default), turned 30° toward it, or toward the viewer. An agent that needs a person or is down turns to the viewer by itself: with its eyes hidden, that is how those two are seen. Facing away, working shows on its screen. Only the eyes and the headset turn (and a geodesic body's facets); the body is round about its axis.
  • The screen: along the plinth's back edge, light in light mode and dark in dark. Blank unless the conversation needs a glyph (member.screen: new, asked, attached; asked by itself when it needs a person). Working, it scrolls lines (agents.working: 'eyes' leaves that to the eyes).
  • The headset (agents.headset): normal (band, cups, boom; agents.band 0.2–1 its size), boom (an earpiece and the boom), off. Its light is member.link: green connected, amber connecting, red disconnected (by itself when stopped or down).
  • The mark (agents.mark): floor (the default: drawn flat on the plinth under the agent, as if projected from above, kept to the plinth), screen (its bottom right), both, none. member.agent.mark names a mark the host registered: registerAgentMarks({ house: markup }), or { house: { light: markup, dark: markup } } where its inks need a dark-mode variant (dark mode draws dark, else light). Without one, the engine's plain mark (a ring and a dot). The markup is what goes inside a 24 × 24 box, as inside an icon's <svg viewBox="0 0 24 24">, not the <svg> itself: for example '<rect x="3" y="3" width="18" height="18" rx="4" fill="#3b6fe0"/>'. An icon drawn in another box goes in a <g transform="scale(…)"> to 24 × 24 (a 48 × 48 one: scale(.5)). (0.45.0) A whole <svg> (any viewBox), a script, an event handler or foreign content, a name that isn't one (letters, digits, -, _, starting with a letter) or empty markup is refused with an error that says which mark and why, and none of that call's marks is registered. Ids, gradients and masks in a mark are made unique for each use. A name registered again is replaced. <isometric-diagram>'s script exports it too (import { registerAgentMarks } from './isometric-diagram.js'): register there when the page loads only the element; marks registered before its stack part has loaded are kept and given to it, and a stack already drawn is drawn again with them.
  • Size and float: agents.size (default 1.25) and agents.float (grid units over the plinth, default 1.25); the shadow smaller and fainter the higher it floats. A member's name stands over its agent.
  • Colours are CSS custom properties a host may set: --stack-agent-headset, -headset-edge, -headset-cushion, -screen, -screen-frame, -screen-line, -shadow, -mark-ink.
  • Motion (AGENT_MOTION_CSS, which <isometric-diagram> adopts): working, the eyes drift a little; idle, a slow blink; needs-you, the eyes pulse; a working screen scrolls. None under reduced motion. A still has none.

Painting order, back to front. An agent is taller than its storey (it floats), so a floor drawn out in front of the floors above would have its agents covered by their slabs if a floor's things were all painted with it. Instead each agent is its own object, ordered by its station's ground (its foot on the plinth: a floating body sorts with its plinth, never by its head): it is painted after each floor above it while its foot stands in front of that floor's front face, counting both floors' slides (agentsAfter(geo, pose)), up to the first it is behind. A still is painted in its pose's order. Live (mountStack, the element), sortStackAgents(root, geo) orders them from the floors' current transforms each frame while they move (followAgents), and an agent only ever moves toward the place it has at the end of the move, never back (floors start at different moments: without this an agent could go behind a passing slab and come back, a pop). An export can't reorder while it plays: renderStackAnimatedSvg paints each agent that comes in front a second time, after the highest floor it reaches, and its keyframes show one copy or the other.

In <isometric-diagram> (0.42.0)#

  • el.stack = model as before; el.objects = objects (from stackFromSpaces) lets el.set({ 'engine/kit': status }) name objects by id and count each floor's problems. A status is partial (what it doesn't say stays), or a state word of the model's own. What changes is swapped in place, crossfading (at once under reduced motion); nothing else is drawn again.
  • A new open attribute moves the floors in place, animated, the agents kept in painting order as they move. A new opening, mode, theme or a model of another shape is drawn anew.
  • Pointed at (or focused: agents are in the tab order), an agent turns to the viewer, and back half a second after.

Shows (0.43.0)#

A show is a story told over a stack: named states (an opening and statuses), named views (what the camera frames), and a timeline of steps that play in order, each easing from the last. It is plain data (show/1, YAML or JSON).

show: 1
states:
  closed:   { opening: one, open: null }
  exploded: { opening: all, open: true }
views:
  engine: { fit: engine }              # a floor
  kit:    { fit: engine/kit }          # a member's station; margin (px) and zoom as wanted
stories:
  tour:
    title: The tour
    timeline:
      - { say: { title: The studio group }, state: closed, view: null, set: { engine/kit: working } }
      - { say: Every floor open, state: exploded }
      - { say: The engine, opening: one, open: engine, view: engine, then: [ { view: kit, set: { engine/kit: needs-you } } ] }
  • A step may name a state, set its own opening, open (null: closed) and set (statuses by object id: a status, or a look's name for short: needs-you), a view (null: the whole drawing, (0.49.2) as the step's opening poses it: opened all, the staircase is framed whole), what it says (a title, or { title, text }), how long it holds (default 3s), and then: changes that follow it, each a second (after) after the one before. What a step doesn't mention stays as it was. A show has a timeline, or stories by name, each with its own.
  • The camera: a view fits all, a floor (a workspace's id) or a member's station, with a margin and a zoom; it is framed from the stack's geometry at its pose (viewBoxOf), fitted to the element's shape, and eases from the last view (CAMERA_MS, as a function of the time: a show can be sought anywhere).
  • checkShow(doc, objects?) gives every fault with its path (an unknown id, state or view among them); showPlan(doc, story?, objects?) the steps' times and every change's moment; showAt(plan, ms) what the stack shows then.

In <isometric-diagram>: el.show = doc (the text or the object) over el.stack (and el.objects), the story attribute choosing a story. The steps are the transport's beats: controls (play, pause, back, next, the scrubber with the steps marked, the caption), autoplay, loop, and with links a URL's #step=N starts at that step. el.seek(3) (a step, from 1) or el.seek('6s'); a step event as each step begins (detail.step). Played forward, each change moves: statuses crossfade, floors slide, the camera eases; sought or stepped back, it cuts. A show that changes the building itself (another model) is not yet a show's: a host sets el.stack for that.

Select, and click to open or close (0.44.0): in the element, a click on an agent (or its plinth) raises select with detail: { id, kind, modelId } (the object's id and kind when el.objects is set). A click on a floor raises select for it (kind: workspace) and opens it (one; a second click closes it) or the whole opening (all, drawers), setting the open attribute, so the floors move in place. The floors are buttons in the tab order, bottom up, named by their lettering (aria-pressed when out): Enter or Space acts as a click, Escape closes. A drag is the reader's pan, not a click. Over a show, a click pauses it; a floor clicked moves in place without changing the show; Play brings the show's own state back.

A new opening in place (0.43.0): outside a show too, a new opening for the same model swaps the drawing's contents (its slot shells, its frame) and moves the floors there from where they were, the agents kept in painting order.

Buildings: a step that changes the building (0.47.0)#

A step (or a state) may move the show to another building: building: split. The host gives the buildings the show names, each a model and its objects, and as, what each of the element's own stack's objects became in it (object ids, old → new; one not named is the same, or gone if this building hasn't it):

el.objects = base.objects; el.stack = base.model;
el.buildings = { split: { model: split.model, objects: split.objects, as: { 'town/builder': 'team/builder', 'town/painter': 'team/painter' } } };
el.show = { show: 1, timeline: [{ say: 'The town', opening: 'all', open: true }, { say: 'A floor of its own', building: 'split' }] };
  • Played forward, the stack moves to it in place: the floors found in both slide from their old slots to their new ones (the floors above a new floor make room), a new floor rises into its slot, a member found in both moves from its old station to its new one (another floor's too), what is only in the old fades out where it was. Sought, stepped back or under reduced motion, it cuts. Steps before any building: show el.stack.
  • (0.48.0) Staged, about 2.8 s: the floors there make room first (0–40% of it), a new floor rises into its slot (20–65%), then the members walk from their old stations to their new ones (50–100%); what goes fades out early.
  • (0.48.0) Back and forward animate a step: a change one step from the one shown, landing at that step's start (the transport's back and forward, el.seek(n) to the next or the one before, playing through), moves there, back as the reverse (the team walks back, the new floor sinks, the floors close up); the camera eases to the step's view. A scrub, a seek to a far step, #step= links and the first paint cut.
  • What carries across, by as: the statuses set so far (builder still needs a person on its new floor), which links march (a link by each end, if the new building has that link), a view that names an object, and the selection.
  • checkShow(doc, objects, buildings) checks the names (the element passes its buildings' and every building's objects).

A block as a building: separate buildings become one stack (0.49.0)#

A building in el.buildings may be a block instead of a stack: { block, as? }, block a block/1 model (several buildings on one ground: docs below, "A block"), its members drawn as agents when it says agents. A step that moves to it shows the block; a step that moves from it to a stack shows the stack. Floors and members found in both (by id, or by as) move from where they stood to where they go: two workspaces, each a building of its own, become a group, their floors leaving their buildings to stack one on the other, the roof and its manager coming down onto the top; back, they part again. Staged (2.8 s): what goes fades out first, the floors travel, what comes arrives, the links last. Under reduced motion, a cut. While a block is shown, the camera frames it whole, and a stack's own features rest (no statuses, no turns).

el.stack = group;                                       // the two floors under the group's roof
el.buildings = { apart: { block: twoWorkspaces }, group: { model: group } };
el.show = { show: 1, timeline: [{ say: 'two workspaces', building: 'apart' }, { say: 'a group', building: 'group' }] };

The block is drawn by a third file, isometric-block.js, beside the element's two (docs/MOTION.md): the stack's part imports it the first time a show's building is a block, so a page of stacks never fetches it.

The selection (0.47.0)#

el.selected is what is selected: an object's id (the model's without objects), marked in the drawing (an agent's glow, a floor's plate outlined, a link drawn full; the host's --stack-selected colours it). A click sets it (and raises select); the host may set it. When a show moves to another building the selection goes with it, named as it is there, and select is raised again with carried: true (with id: undefined when the building hasn't it).

Role and rank (0.49.0)#

How a stack shows who leads (the owner's pick, from the rank study):

  • Places. A floor's manager stands in the middle of the floor's back side (the back-right side as drawn), facing its team; the members sit in rows of up to four in front of it, an aisle clear between, every member squarely at its own screen, so they all face the same way. Seats are fixed by index, filling a row from the middle outward, so a member added moves no one. (0.49.2) The manager stands as far in from the back as it is tall, so with its floor open nothing of it is under the slab above (a floor is as deep as that takes; an empty desk is in the same place). A floor is as deep as its rows need. The stack's own manager stands the same way on the roof.
  • Platforms. Every platform is 0.7 high (up from 0.35), so a role word fits its edge. A floor manager's is in its floor's colour (its accent), the stack's own manager's 1.5 times as high and a deeper shade. agents.leadRim: true adds a thin rim round a lead's platform, a darker shade of its colour (off by default).
  • Role words. words.roles: { member, manager, groupManager }, the host's words, lettered along each platform's right edge: a member's small and light, a lead's bold. Each shows only where it reaches its readable size on screen (10 px a member's, 11 a lead's) and is left off where it doesn't; the names' placing treats them as lettering. No words given, none drawn.
  • A lead's headset has its boom on the other side of its head from its members'.
  • A lead's screen (agents.leadScreen): curved-right (the default), a wide screen curved round its front-right from its own point of view; curved-front, the same round its front; front, flat, squarely in front of it. A screen standing between the lead and the viewer shows its back see-through, so the lead always shows. Every screen state shows on the faces the viewer sees: the working lines scrolling, the conversation's glyph, the mark if asked.
  • The hover turn turns a lead back to its team after.

Agents for a host's own UI (0.49.0)#

A host that puts its own UI over the agents (a card, a tooltip) needs to know where they are, and a hand on what selects:

  • agententer and agentleave: raised when the pointer or keyboard focus reaches or leaves an agent, with { id, modelId, rect, screen?: { corner, plane }, eyes, chat, via: 'pointer' | 'focus' }. rect is the agent's box in client px; screen.corner is the top corner of the agent's screen (its end further right, client px), and screen.plane the screen's plane across the page as a unit vector, so a host can draw something coming out of the screen, in its plane. eyes and chat are what the agent shows now (its state's eyes, its screen's conversation), so a host's card says what the drawing says.
  • el.agentBox(id): the same, now, for any agent drawn (an object's id or the model's); undefined if it isn't drawn.
  • el.turnAgent(id, toward): the hover turn: the agent turns to face the viewer (true) or back to its own facing (false), 0.7 s (a cut under reduced motion). A host that walks the agents (a card's next and previous) turns them with it.
  • The hand: a floor's plate always shows the pointer (a click opens it); agents and links show it while the host listens for select (a CSS state on the element, :state(pickable)). A drawing nobody listens to keeps the arrow.

A show inline (0.49.0)#

The element's script may hold a whole show instead of a drawing: a show bundle, { stack, objects?, buildings?, show } (YAML or JSON), taken as if the host had set el.stack, el.objects, el.buildings and el.show. A page that only inlines what it shows (a blog's diagram block) plays a show with no script of its own; controls, autoplay, loop and reduced-motion work as for a show set from script. Agent marks are still registered by the page's script (registerAgentMarks).

<isometric-diagram autoplay loop><script type="text/yaml">
stack: { ... }        # a stack/1 model
buildings: { ... }    # optional: the buildings its steps move to
show: { show: 1, timeline: [ ... ] }
</script></isometric-diagram>

Relationships between things on the stack, drawn by the engine as lines between them: links: [{ from, to, kind, ants? }], each end the id of a member, a resource or a floor. A link's id is from>to. The kinds are the host's words; linkKinds says how each looks ({ tone?, ink?: '#rrggbb', dash?: 'solid' | 'dashed' | 'dotted' }; a kind it doesn't name is a quiet grey line, and a host's CSS custom property --stack-link-<kind> wins over the ink).

  • Each end is where its thing is: a member's body, a resource's top. An end on a closed floor meets the floor's lettering; a link with both ends on closed floors isn't drawn. The links are part of the drawing, over the building and under the names, and move with their floors: live, each frame while the floors move, from the floors' slides as they are in that frame, so a link is never a frame behind its floor.
  • ants: true marches it (wider, solid ink, its dashes moving; still under reduced motion): what a step is about.
  • stackFromSpaces(group, spaces, { …, links: true }) derives them from the group's facts, with its own kinds and looks (LINK_LOOKS): seat (the group's manager to each floor's manager), manages (a floor's manager to its workers), directs (relations.directs), prompts (a schedule's prompts), owns (relations.owners: a service to its owner). Each link is an object too (kind link, id engine/lead>engine/kit).
  • A link's status is { ants }: el.set({ 'studio/gm>engine/lead': { ants: true } }), a show step's set, a group state's item. A click on a link raises select with kind: 'link'.
  • linkPaths, linkPathsIn(model, geo, pose) and linkLayerSvg are the paths and the layer, for a host that draws itself. The animated export (renderStackAnimatedSvg) leaves the links out: its floors move by CSS keyframes, which a link can't follow. For the links in an export, export a still (renderStackSvg in the opening you want): it draws them.

A block (0.38.0)#

block/1 puts several stacks on one block: the buildings stand in a row along the back of a plate, a door from each onto the street in front of them; across the street a kiosk with its members beside it, and notices; a road off the block's end to the outline of another block. A building is a whole stack ({ id, label, sub?, stack: { marking, floors, roof? } }; its label stands above its core) or away ({ id, label, sub?, state?, away: true }, a faint box). states and words are the block's, shared by its stacks, and ids are unique across the whole block. The JSON Schema is src/iso-systems/stack/block-1.schema.json; checkBlock(model) gives every fault with its path.

const svg = stack.renderBlockSvg(block, { theme, open: { building: 'ours', floor: 'diagrams' } });
const b = stack.mountBlock(el, block, { theme, onOpen: (building, floor) => …, onSelect: id => … });
b.update(next); b.open('other', 'lanes'); b.setMode('all'); b.close(); b.dispose();
  • Every building opens in the stack's own ways, with the same poses, scoped to it (.st-b<i> .st-f<k>); one building is open at a time. The street is as deep as a floor comes out (one), so a floor out stands over the street and short of the kiosk.
  • In all the staircase passes over what is across the street, so its names hide while a building is open (.st-under).
  • renderBlockAnimatedSvg(block, { theme, opening, buildings?, hold?, loop? }) (0.39.0): the block as one SVG that plays by itself, each stack building (buildings, default all, left to right) opening and closing in turn as renderStackAnimatedSvg opens a stack alone. Reduced motion shows the block closed (one) or its first building open.
  • Clicks and keys as for a stack: a floor of another building moves the opening there; a second click calls onOpen(buildingId, floorId); a member in a building or across the street calls onSelect(memberId). The floors are buttons building by building, bottom up, named <building>: <floor>.

The docs site's Stacks page shows a neutral model live, its three openings, a host's changes, and a block.