Architecture#
Overview#
TimeLineEditor (TiLiE) is a browser editor and visualization tool for musical timelines represented by timetoalign. It works with three layers, each named by one word only:
a manifest is one TimeToShare manifest as the TimeToShare schema (version 0.2.0) describes it, of the one shape every manifest has,
{timetoshare, timelines, "@context"?, id?, name?, meta?, groups?, measure_maps?, resources?, flow_maps?, virtual_timelines?, statements?, provenance?, graphical?}, whatever it holds: no timeline, one root timeline, several, a group, or several groups beside ungrouped timelines. Every manifest is an alignment bundle. Its statements say what the manifest itself, every timeline and every region stand for:statements, property–value pairs about that thing (a work, a recording, an edition, a performer), andprovenance, the annotations of those pairs (who stated one, when, how, on what basis, and who believes it,true,unlikelyorfalse), under an inline JSON-LD@context, as TimeToShare’s description specification defines them; the drawing does not read them. A timeline has exact coordinates, children at exact offsets, conversion maps, regions and flow control, and alengththat may benull, not known; its flow control is a list of elements in five roles, each at a coordinate: a jump, whose destinations (targets) each gotoa jump target, a region, a child or the timeline itself, orbya distance, a jump target, a break, a section break and a barline; an element some actor believesfalsein itsprovenanceis rejected and drawn faded, and which elements a flow the editor asks for reads is decided by the editor’s user (core’sflowReading): by the user’s own belief where they recorded one (every belief butfalsereads it), else by the block’s belief filter, the MatchClaim filter’s belief states, as for a MatchClaim the user holds no belief in (the element is read when the filter keepsundecided); the manifest’sflow_mapsandvirtual_timelineshold the orders in which a root’s stretches are played and the timelines they make; the measure maps its conversion maps read belong to the manifest, not to a timeline;graphicalholds the style rules of the manifest’s own drawing, its groups’ display orders, its timelines’ band orders, its named timestamps (a named position of a timeline, drawn as itsdisplaylists: a wedge, stacked labels of its name, ID and coordinate, and a cross-section line, which a groupstamp’s runs across every member card of its group’s frame) and its named MatchStamps (alignment anchors, each joining two match timestamps on two timelines, with the IDs of the MatchClaims behind them) and its elisions (each a stretch of one timeline left out of the drawing, drawn as a narrow gap holding one ellipsis, with aname, awidthand adisplay; an elision on a timeline that lies in a group is that group’s and elides its frame, every other one elides the cards that draw its timeline’s root whole; Elisions);resourceslists the files that come with the manifest, such as its MatchClaim table, and the timelines each concerns. Every timeline, group, measure map, conversion map, region and flow-control element has anid, unique across the manifest, and so may the manifest; anameis what is displayed. A manifest with anidor anameis a named bundle, one with neither an anonymous bundle. A manifest knows nothing about where, or how often, it is shown;a block carries one manifest, entirely its own, together with its placement, the other inputs of its drawing: position, scale, graphical length, spacing (the gap between the items of its drawing), margin (the empty space above its first item and below its last), requested size, the stated places of its drawing’s containers and, where it has one, its arrangement, which places its items in an order instead of at their places (Arrangements). A block’s styling is its manifest’s
graphical; the block has no style layer of its own;a workspace is the canvas: its name, its blocks, their order and, where it has one, their arrangement, its default style rules, the workspace settings, and the command journal that produced them, with the sessions of its editors. Block ids are the workspace’s namespace, and an address names anything in it.
TiLiE is local-first: the browser communicates with a local Python server, which is meant to own loading through timetoalign, heavy computation and exports, while the browser keeps a small editing core. This keeps the library’s capabilities close to the operations that need them and interaction responsive without a request per keystroke.
What exists today and what is planned#
tilie-server starts a FastAPI server, on loopback for its user (tilie) or publicly for the hosts it is named for (tilie --public-host), serves the built editor, and answers, authenticated by the run’s token in a local run, GET /api/health, POST /api/measure-maps, which expands a manifest’s measure maps through timetoalign, POST /api/match-claims, which checks a package’s MatchClaim table against its manifest and answers its columns, POST /api/match-claims/provenance and POST /api/match-claims/belief, which read the provenance of given MatchClaims and record a belief in a new table, POST /api/match-claims/events, which answers the events on both sides of given MatchClaims, POST /api/flows, which plays a timeline’s flow control through timetoalign, POST /api/flows/flow-maps, which answers the manifest with that timeline’s flows written, /api/reconcile/musicbrainz, MusicBrainz as a Reconciliation Service API endpoint, and, in a local run only, GET /api/folders, GET /api/files and PUT /api/files, which list and read the workspace, manifest and table files below the server’s root folder and write workspace files there, never a path through a hidden folder or to a hidden file (The server). The editor is one component that the standalone page mounts and that any other page can mount through a framework-free entry (Embedding). It is a header and the canvas, with an inspector drawer on the right. It opens, saves, imports and exports files, through the server’s file routes in its own file dialog where a server offers them and through the browser’s pickers otherwise, autosaves in the browser, inspects and edits the selected block’s manifest and the statements of its bundle, timelines and regions, looking their values up in public services, and reads the MatchClaim table a block’s manifest names through the server to show its potential MatchStamps on the canvas and name, update and remove MatchStamps from them (The editor); a block, a group or a timeline opens in an editor of its own on the canvas, and a root’s flow control and FlowMaps in the flow-control editor, where its flow-control elements are edited and its FlowMaps composed and dragged out as virtual cards (Editors, The flow-control editor); a virtual timeline is drawn as a card of its own, and a root’s card may be switched onto one of its flows (Virtual and switched cards); everything it changes goes through the commands of core.
Loading sources through the server, raster exports, a generated API client, collaboration over a network and automation endpoints are not implemented. Nor is editing flow control in the editor: it shows a selected flow-control element read-only, a jump’s destinations as rows that select what they lead to, and records the user’s belief in it; its name and label are set as any element’s, and how flow control is drawn is toggled in the properties (below), in the root’s flow-control editor as outside it; an element is added, moved, retargeted or relabelled only through core’s commands and the Manifest tab. A root’s computed flows are shown and written only in its flow-control editor, which asks the server for a convention’s findings (the client’s flows) and writes the flows of its flow control with Recompute (withFlowMaps), each under the reading the Properties tab states (readingOf); nothing else of the editor computes flows. A virtual timeline carried through a group is evaluated by timetoalign alone: core gives it the axis and played length of the FlowMap’s own root, as timetoalign does, but carries no position through the group, so its card is drawn as its line alone, as an unresolved virtual timeline is, the coordinate flag reads no written position on it and no card is switched onto it; one carried through a conversion map keeps the length it states. Sections and sentences that say “planned” describe the intended architecture, so that additions have explicit boundaries; everything else describes behaviour that exists.
Packages and the dependency ladder#
The TypeScript workspace is a one-way ladder enforced by dependency-cruiser: lower packages never import higher ones, and only arranger and editor import Svelte.
Package |
Contents |
Workspace dependencies |
|---|---|---|
|
The three layers: exact numbers, the manifest value with its load, save, invariants and Delete, FlowMaps and virtual timelines resolved without a server, the container registry, the address resolver, the four commands with |
None |
|
|
core |
|
Element descriptors with their sources, page placement, and the SVG and TikZ writers. |
layout, core |
|
The canvas: the projection onto Svelte Flow nodes, the block node, the gesture engine, the levels and their rules, the editors (the flow-control editor among them), the overlays. The only package importing |
writers, layout, core |
|
|
core |
|
|
all workspace packages |
A package is added only for a present need (AGENTS.md).
The container hierarchy#
A manifest nests its content in four containers, and its drawing draws each of them as a container of its own (TimeToShare’s README, “Containers”): semantically, the bundle (the manifest) holds groups and timelines, a group has timelines as its members, and every timeline, root or child, has five facets, markers, conversion_maps, children, regions and flow_control; graphically, the block draws the bundle, a frame a group, a card a timeline drawn as a root, and a band a facet, at its timeline’s line. All four graphical containers are boxes, drawn as rectangles with rounded corners; “box” is the generic word and names none of them. A child timeline is content of its parent’s children facet, drawn as a line in its parent’s children band, never in a card of its own unless a group has it as a member. A band draws nothing; it is the unit that holds and orders what its timeline has of its facet. Manifest content and addresses take the semantic words, the drawing’s containers the graphical ones, and every package reads the hierarchy through one model:
Kind |
Level |
Held by |
Its entry in the block’s |
|---|---|---|---|
block |
bundle |
nothing |
none: the block’s own placement places it |
frame |
group |
the block |
|
card |
timeline |
the block, for a root or a virtual timeline in no group; for a member, a virtual one included, the frame of each group that has it as a member, one card in each |
held by the block: |
band |
facet |
the card of the member drawing that draws its timeline |
none: its place is its timeline’s band order |
Each kind is styled as the schema element type of its own name (block, frame, card, band), and a band also by its facet (the selector member facet). “Item” is the role of a frame or of a card the block holds, each placed freely in the block; “member” is a fact about a timeline, that a group names it; neither is a kind.
A root that contains a member, a child timeline some group names, is drawn as that member’s ancestor lines and may also be drawn whole as an ancestor card: a card held by the block behind the frame of the member’s group, at the proportions of the root’s own axis, its line continuing the member’s ancestor line of the root (the drawing specification’s element type ancestor_card, section 8.8). The defaults show it; a rule setting its display to none hides it. An ancestor card has no place (its key {item: G, member: R} names none, Holding "ancestor"), no bands of its own and no entry in places; only a displayed one is recorded, as a DrawnBox carrying ancestor {group, member, groups} (groups every group whose frame it lies behind: [group], or, for a root drawn once behind a row of groups side by side, every group hanging on it in the row’s order, group the first; Arrangements), its lines as DrawnAxis records carrying the same ancestor, after every item’s lines, and the block grows to hold it.
A virtual timeline, an entry of the manifest’s virtual_timelines (a FlowMap or a conversion map applied to a timeline), lies in no tree and is drawn as a card of its own, a virtual card (section 8.10; Virtual and switched cards): in the frame of each group listing it as a member, in display order, and, where it is in no group, held by the block as an item, after the ungrouped roots by ID, drawn only where the block’s places hold its ID; taking that entry away hides the card and keeps the virtual timeline. Its card holds only its markers and regions bands (VIRTUAL_FACETS), the regions band holding its chunks. Core’s registry lists a block-held card for every virtual timeline in no group, placed or not, since a manifest does not know the block’s places; layout draws and records only the placed ones.
core holds the registry (CONTAINERS in manifest/containers.ts): for each kind its level, its element type and the place members it may state by how it is held. containersOf(manifest) lists every container of a manifest with its holder, memoized per manifest, and placeMembersOf answers what a container may state. A block’s places maps the ID of a group or of an ungrouped root (a root that no group names and that holds no member) to its stated place, a group’s entry holding in its cards, under a member’s ID, the stated width, height, spacing and margin of the member’s card in that group’s frame; it is the drawing’s places (TimeToShare’s drawing specification, sections 1 and 8.6). After every command each touched block fits its places to the drawing, so a command never fails for a stale entry: an entry that placed a timeline’s card before the command and places nothing after it moves to that timeline’s one card (a root that became a member of G, from places[T] to places[G].cards[T]; a member that left its group, back) unless that card’s entry is stated already, and a timeline drawn in several cards after the command gets no moved entry; every other entry that places no container goes; each entry is then cut to what the registry lets its container state as it is held, so a root that becomes a member keeps only its card’s size, spacing and margin.
A timeline’s band order lists line, its own line, and its five facets, each standing for the band drawing it, top to bottom (section 6.4). Its own band order is its entry of the manifest’s graphical.order, which lists line and any of the facets; its inherited one is its parent’s effective order, else the default (children and conversion maps above the line, markers, regions and flow control below); its effective one, the one it is drawn with, is its own completed against the inherited one, else the inherited one: the stated entries keep their order, and every facet the entry leaves out keeps the side of line it has in the inherited order and lies beyond the stated entries on that side, in the inherited sequence (core’s bandOrderOf and inheritedBandOrder); a virtual timeline, which has no parent, completes its own entry against the default. A group’s display order is its entry of graphical.order, else its members (displayOrder).
Layout records every container of a drawing as one DrawnBox in Drawing.boxes (Layout and writers); the arranger and the editor read that list and derive nothing from elements or descriptor order. The arranger’s level table says what each level of the canvas may do with each kind (Levels and permissions).
IDs and addresses#
Every element of a manifest, timeline (root or descendant), group, measure map, conversion map at any depth, region, flow-control element, FlowMap and virtual timeline, has an ID, and so may the manifest itself; so does every named timestamp, named MatchStamp, alignment anchor and resource; every ID is unique across the manifest (TimeToShare’s README, “Identity”). A statement has neither an ID nor an address: statements and provenance are members of the element holding them, changed through that element (Commands); a statement’s value names an element of the manifest by an IRI reference to its ID (#cpt_1). An ID is any non-empty string without control characters, /, spaces, colons and URIs included, and no word is reserved; TiLiE keeps it verbatim and never parses it, so a timeline, group or manifest without a name is named by its whole ID. Where core creates an element itself, the segment that covers an empty segment line (Invariants), it mints its ID as timetoalign does, the type prefix, _ and 13 random base-36 characters (clt_3kq9x0m2ztb7a), as it mints the IDs of the default timestamps and of every named timestamp, elision, named MatchStamp with its anchors and match timestamps, and group, region, conversion map, flow-control element, FlowMap and virtual timeline without an ID that a command adds (Commands), each with its prefix: region, cmap, the flow-control element’s role (jump, jump_target, break, section_break, barline), flow for a FlowMap and, for a virtual timeline, that of its unit’s timeline class (clt, dpt, …); a command that adds any other element, a timeline, a child or a measure map, carries its ID. The minter is core’s createIdMinter (workspace/ids.ts): a seed, 64 random bits of the platform’s cryptographic source for each store unless a test gives one, and the algorithm of TimeToShare’s minted-ID test vectors (fixtures/ids/minted_ids.json), which its tests check, so that it computes the IDs timetoalign computes from the same seed. A minted ID is never renamed or reissued; one the manifest already holds is refused by the schema check (schema_violation). IDs repeat freely across blocks, each manifest being its own. A block ID is ten characters from 0-9a-z, drawn from the platform’s cryptographic random source (mintBlockId).
An address names anything a command can target. It is an object, never a string composed from IDs: {} the workspace (WORKSPACE), {block} a block, which draws its bundle, and {block, id?, facet?, part?} an element of the block’s manifest, whose members are those of the manifest’s own address, the drawing specification’s (section 2.2):
Element |
Address in its block |
|---|---|
a timeline, group, measure map, conversion map, region, flow-control element, FlowMap or virtual timeline with ID |
|
the band drawing the facet |
|
every card of timeline |
|
chunk |
|
a stored elision with ID |
|
the gaps a card derives on timeline |
|
a part of an element: a segment’s boundary, a name, a label, a named timestamp’s labels and its cross-section line, an alignment anchor’s label ( |
the element’s address with |
the manifest’s title ( |
|
facet stands only with id, and with part only where the part begins with a chunk index: an item of part is a PartItem, a part word or, at its head, a ChunkIndex, an integer from 0 (refused otherwise with “a facet stands with a part only where the part holds a chunk index”). The manifest’s title is {part: ["name"]} whether or not the manifest has an ID: the manifest’s own ID addresses nothing, so giving or changing it changes no address, and a command aimed at {block, id} with the manifest’s ID is refused with unknown_target; a title exists only for a named manifest, so on an unnamed one {part: ["name"]} names nothing (unknown_target). An element drawn more than once (a member in several frames with everything it draws, an ancestor line above several members) keeps one address, which every drawing of it carries; so the cards of one timeline share theirs, a style rule selecting an element styles every drawing of it, and selecting it marks every drawing of it.
resolveAddress(view, address) in core is the one place that decides what an address names. It returns a record of one kind: workspace, block, title, frame, timeline, card, band, entry (with its kind and index), measure_map, timestamp, elision (a stored one, with its timeline), matchstamp, anchor (with its MatchStamp), flow_map, virtual_timeline, virtual_card, virtual_band, chunk (with its index, its FlowMap and the line drawing it, ChunkFound) or part (with its owner and word), carrying the block, the located timeline and the containers where there are any (a group’s frame, every card of a timeline, every drawing of a band), or a CommandError: invalid_address for a malformed address, unknown_target for one that names nothing, each at [<address key>]. A part resolves only where it is drawn: an address of a part the element’s drawing does not draw names nothing (unknown_target); the address of a card’s derived gaps, which depend on the view and the cascade that core does not read, resolves, as a part of its timeline, wherever an ancestor card may derive one on that timeline (defaultElisionTimelines), drawn or not. resolveElement(manifest, element) does the same within one manifest. Addresses are compared as whole objects; addressKey(address) is an address’s one string form, the only key a map or a Svelte keyed block takes for it, and no package writes an address as any other string or reads anything out of its key. indexOf(manifest) is what every reader of a manifest needs once, memoized per manifest: its containers, the ancestry of its timelines, the timeline that owns every timeline and entry ID, and the elements of its drawing.
The core package#
@timetoalign/tilie-core is framework-free: no DOM, no Svelte, no network. Its main entry holds what a host and the packages above core use: manifest and workspace I/O, the commands and preview, the store, the resolver, the registry, the band and order helpers, the error types and the domain types. @timetoalign/tilie-core/drawing holds the drawing’s primitives for layout and the writers (the elements a manifest draws, among them each timeline’s named timestamps, namedTimestamps(manifest, timeline) in canonical order, memoised per manifest, the selector test, the member drawings); @timetoalign/tilie-core/numbers the exact arithmetic. The package needs Node 22.18 or later, as @timetoalign/timetoshare does.
Numbers#
Rational is an exact fraction over BigInt, always normalized, built from a [numerator, denominator] pair, a bigint, a safe integer or a decimal integer string, never from a JavaScript float. A Real is a value as Python’s numeric tower holds it, an exact Rational or a float, combined and compared as the tower does (a sum involving a float is a float, a comparison is exact). fromFloat returns the exact binary value of a float and serves arithmetic that must be exact on a float’s value, such as the writers’ page transform; it never re-expresses a coordinate. A Coordinate is {unit, numberType, value} whose value is what the axis’s number type declares: a bigint for int, a number for float, a Rational for fraction. A value on its timeline’s own axis is bare, read and written as timetoalign’s number_from_json and number_to_json do: an int axis reads a JSON integer, or an integral JSON number as that integer; a float axis reads a JSON number, or an integer as the float it equals exactly; a fraction axis reads only a pair; every integer is int64-bounded. Arithmetic and comparison work within one axis only and throw AxisMismatchError across units or number types.
Values on timelines#
A conversion map is evaluated as timetoalign evaluates it. compileMap(map, context) (maps/compile.ts) reads a map’s parameters once per map object and returns an evaluator, a closure over those parameters; every evaluation computes its result anew on Python’s numeric tower, exact where the position and the parameters are exact, a float as soon as a float takes part, and where timetoalign decides on doubles (a TableMap off its exact path, a PiecewiseMap’s interval, a measure view’s measure) so does the evaluator, by bisection over a Float64Array of the map’s own parameters. No value is cached. A measure view reads the expanded rows of its MeasureMap from context, as the server’s measure-maps route answers them, and without them gives nothing and says so. express (maps/express.ts) writes a result on the map’s target unit in that unit’s number type, as timetoalign’s express_as does, an int rounded half to even. A timestamp (maps/timestamp.ts) is the cross-section of a timeline, its anchor, at a position exact on the anchor’s own axis: everything a cross-section line drawn there crosses. A CrossSectionSpec names the anchor and its members, the timelines its timestamp holds, each a TimelineAxis (its unit, number type, length and drawn maps, in drawing order; timelineAxisOf; and, where a reader of the canvas gives them, its ordinate, the ordinate of the drawn line at which the reading crosses it, and its mapOrdinates, by map ID the ordinate of each of its maps’ drawings in that card) at its exact offset from the anchor’s zero: by the canvas’s convention first the anchor’s ancestors, parent first (ancestorMembers: an ancestor’s coordinate is its descendant’s plus the offsets up to it, and it carries no map; an ancestor’s span holds its descendant’s, so it is crossed wherever the anchor is), then the timelines its line may cross (the anchor’s segments and its displayed descendants drawn with a line of their own, with the segments of each, in traversal order); nothing marks a member as a segment, a segment is a member like any other. A member read by a group (the other members of a groupstamp’s group, Show coordinates) also has a scale, its drawn end over that of the member holding the anchor, since the members of a group start and end together: its coordinate at an anchor position p is (p − offset) × scale, and its span ends at offset + length / scale. timestampAt(spec, position, knots) gives the anchor’s part, then the part of each member whose closed span [offset, offset + length] holds the position (a boundary two contiguous members share is crossed by both), each with its coordinate in its number type and each drawn map’s value, which every reader shows without computing it again. A row (Row {timeline, map}) is one of those values: a member’s own coordinate (map null) or one of its maps’ values. rowAxis(spec, row, knots) reads a row both ways, forward from an anchor position to the row’s value and back from a value to the anchor position where the row takes it; it is the one path by which anything evaluates or inverts a map, so the values shown, the position a pointer picks on a row (snapOnRow) and the position an edited value gives (positionFor) never disagree. A pin (Pin) is a timestamp held for editing: its spec, the expanded MeasureMap rows it is read with (or why they are not at hand), the timestamp, and named, the named timestamp it shows, or null; pinAt(pin, position) reads it anew at another position. positionFor(pin, row, value) gives the anchor position at which a row takes a typed value: a coordinate’s at its member’s offset plus the value, a map’s value inverted over its member’s span and settled on the anchor’s axis (a float on a fraction axis to the nearest multiple of 1/denominator, any value on an int axis to the nearest integer); a row the timestamp does not show, a value no position gives, a position outside the timeline’s [0, length] and one outside the anchor’s (an ancestor’s value beyond the anchor’s span) are refused with invalid_value. timestampRows(pin) lists the rows as every reader shows them (the parts top to bottom by their timelines’ ordinate, a part without one last, the timestamp’s own parts keeping the anchor first; per part its rows top to bottom as drawn, its coordinate at its ordinate and each map at its entry of mapOrdinates, a row without one after those with one, so a part without ordinates lists its coordinate, then its maps; each row with its label, its value or the text shown instead, and whether an edit moves the timestamp: a coordinate always, a map while it is invertible over its timeline’s span), and timestampJson(pin) writes the timestamp as one JSON value: the named timestamp’s members as the manifest holds them, or {timeline, coordinate} for an unnamed one (the anchor’s coordinate as a bare value), followed by mapping, keyed by ID in part order, each crossed timeline but the anchor its coordinate dict and each map its value (null where it gives none). The inverse is maps/invert.ts’s: invertible(map, context) says whether a map is strictly monotone, decided exactly on its own parameters, over the span the context names (a LinearMap whose scalar is not 0, a linear TableMap and a PiecewiseMap rising or falling strictly over what the span reaches, a ChainMap whose every link is), and invert(map, value, context) gives the position, exact on exact operands and a float as soon as a float takes part, or null; a previous TableMap, a ConstantMap, a CombinationMap and the four measure views are never invertible.
A position is picked on the row the pointer hovers, by snapOnRow(spec, row, p, h, knots): p is the pointer’s distance in units from the anchor’s zero and h half a device pixel in units. On every row of a member of an int axis (samples, ticks, pixels), its coordinate’s and its maps’ alike, the picked value is the integer nearest to p minus its offset, a tie going up, so such a timeline steps by 1 whatever the granularity and no map’s value axis decides its step. On a coordinate row of any other member the picked value is the simplest of the member’s number type within h of p minus its offset; on a map’s row of any other member it is the simplest of the map’s target number type (the value’s own kind where the map names no target unit) within hv of the map’s value at p, hv being half the spread of its values at p − h and p + h, and that value is brought back to the anchor’s axis exactly through the map’s inverse; a map without an inverse there, or giving no number, falls back to its member’s own coordinate. The result is held to the member’s span within the anchor’s [0, length]. The simplest value is snapValue(value, reach, numberType, granularity) (number/grid.ts), never finer than the workspace’s granularity, which is a cap: on a fraction axis the nearest k/d for each divisor d of denominator, ascending; on a float axis the value rounded to 0, 1, … decimals places; on an int axis the nearest multiple of each power of ten from the largest not above 2·reach down to 1. The first within reach wins; where none is, the finest is taken (the nearest multiple of 1/denominator, decimals places, the nearest integer), a tie going up each time; clampValue holds a value to a span, below only where the length is not known. Every comparison is exact on the doubles’ exact values (fromFloat), so the position is exact and no float constructs it; zooming in reaches finer values by itself, since a device pixel then covers fewer units. number/display.ts gives a coordinate’s two texts and its coordinate dict. The raw text, rawText(value, numberType, unit), is the value as Copy writes it (copyValue: a fraction n/d, or n when the denominator is 1, a float its shortest round-trip repr, an int its plain digits), a space and the unit’s schema name (219/16 quarters, 0.1 seconds, 514041 samples). The pretty text, prettyText(value, numberType, unit, decimals?), is the number, a space and its unit’s pretty unit, prettyUnit(unit), a symbol, an abbreviation, else the unit’s name: ♩ for quarters, 𝅝 (U+1D15D) for whole notes, ms, min, smp, ticks, px, pt, m, cm, mm and in, any other unit its name; a fraction is mixed and its digits never grouped (13 11/16 ♩), an int is grouped by three with single spaces (514 041 smp), so only on an int axis, a float is its repr, and a value without a unit is its number alone. Seconds are a clock with no pretty unit after it (prettyUnit gives s, shown beside a field): hours h only when not 0, minutes ′ when not 0 or after hours, seconds ″ always, a part after a shown one padded to two digits, and decimals only where the seconds are not whole (42.5″, 1′15.5″, 1h02′05″, 0″, the fraction 121/2 as 1′00 1/2″, the float 1e-05 as 0.00001″); the split is exact, on the rational or on the decimal digits of the float’s repr, never in float arithmetic. Without decimals the pretty text is exact. With decimals it is rounded: a float to decimals places as Python’s round rounds it, then spelled; a fraction mixed while its denominator is at most 2520, else its exact decimal where that ends, else ≈, before the sign, and 12 decimal places; an int as it is; seconds split after rounding. The coordinate flag rounds with the granularity’s decimals, and a drawing’s coordinate label is the pretty text rounded so with decimals 3 (layout’s coordinateText, the drawing specification’s section 5.2). coordinateDict gives the coordinate dict {unit, number_type, value}. parseAxisValue(text, numberType) (number/parse.ts) reads typed text as the exact value it spells, never through a JavaScript float: on a fraction axis an integer, n/d, a mixed fraction a b/c or a decimal, on a float axis a decimal (0.1, .5, 1e-07), on an int axis digits, plain or grouped by three with single spaces, each with an optional sign; other text, a zero denominator and an exponent beyond ±1000 are refused with invalid_value, and whether a negative value is allowed is the caller’s to say.
The manifest value, load and save#
A manifest held by core is always in the complete form, every key with a default present. Its types are read-only views of the schema package’s generated complete forms: Manifest of the package’s CompleteManifest, holding root timelines (TimelineManifest, whose length is a value or null and whose children carry their offset), groups, measure maps and its own statements and provenance, its meta a JSON object; a timeline and a region hold their own statements and provenance likewise, kept as given (manifest/statements.ts). statementHolders(manifest) walks the elements that may hold statements once, in subject order, the manifest first, then root by root the timeline, its regions in their order and its children depth first, each with its path, and statementHolder(manifest, id) finds one; skeletonOf(manifest) is the manifest’s statements alone at the paths they have in it, with the full context, memoised per manifest: the schema package’s statement functions (withPair, withCandidate, withBelief, withoutPair, …) run on that skeleton, never on a held manifest, whose lossless numbers a structural copy would lose. The @context. A held manifest keeps of its @context only the prefixes it declares itself, those that are no format term and no prefix of TimeToShare’s catalogue with the same namespace, and only while its statements and provenance use them; with none left it has no @context (withStatementContext), so a workspace file does not repeat the format’s terms in every manifest. The full context, the format’s terms and every prefix the statements use, each namespace from the manifest’s own declaration else the catalogue’s (withFullContext), is added where a manifest leaves core: manifestFileValue(value) is that one boundary, the value with every ID written #id and the full context, which saveManifest writes, the schema check, the warnings and the unknown keys read, and the Manifest tab shows. A value on a timeline’s own axis (length, offset, region start and end, a flow-control element’s coordinate) is bare (AxisValue). Every number is a JsonNumber: a plain number, a bigint beyond 2^53, or a JsonFloat for an integral float, so that 600.0 is written back as 600.0. The graphical object is the one exception: its declarations hold canvas numbers, so it is read plain at the schema boundary, a declaration’s 2.0 stored as the double 2 and an integer beyond 2^53 refused with invalid_value unless a double holds it exactly; a style command’s set and the workspace’s graphical are read the same way. A key the schema does not declare is kept where it was found: values are spread, never rebuilt from known fields, so unknown keys survive every command and are written back. core reads, orders and writes no JSON of its own: the reader, the canonical order and the standard writer are the schema package’s.
normalizeManifest(value) is the one path from a value with bare IDs (a workspace’s manifest, a command’s change) to a manifest: validate it through schemaChecked (below), complete, put in canonical order, apply the segment locks, check the invariants root by root, complete the styles. It returns the manifest or a LoadError, and holds no type assertion: the validator’s assertion types the value. A command that has already checked a fragment continues from completion, so a fragment is validated once; a value canonical order cannot order is refused with the schema’s first problem. loadManifest(text) is the path from a manifest file: it reads the text in any of TimeToShare’s serializations with the schema package’s loads, validates the value as the file writes it, makes its IDs bare and normalizes it as above; its problems are invalid_json or invalid_yaml for a text that does not parse as the serialization it is read as (the reader’s message naming the place), the first schema_violation with the path the validator reports, or every invariant violation of a schema-valid manifest; unknown keys are never problems. A value declaring another version than 0.2.0 is refused at ["timetoshare"]; there is no migration. saveManifest(manifest, file) checks the manifest the same way, throwing InvalidManifestError with every problem, and writes its file value (manifestFileValue: IDs as #id, the full @context) with the schema package’s dumpsFile as the manifest file {minimal, styling, serialization} says: in the minimal or the complete form, with or without its graphical object, in canonical YAML (yaml), pretty JSON (json) or RFC 8785 JSON (jcs), each member not given as for a new bundle (minimal, with styling, YAML), byte-identical to what the Python writer produces. Import reads a file with readManifestFile, which is loadManifest and also tells how its text writes the manifest, so that it can be written back as it came: minimal when the value equals its own minimal form, with styling when it holds a graphical object, and in the serialization the text is in (jcs when it is byte for byte the RFC 8785 JSON of its value, json for any other JSON, yaml otherwise). An entry a command adds or replaces (a conversion map, region or flow-control element) is checked by the same schema where it will lie before it is stored: the manifest with the value in place is completed, ordered and checked whole, as a settled manifest is, so what the value names, a measure view’s measure map, an element a statement’s value names, is found wherever it lies in the manifest. A timeline it adds is checked first alone, as the one root of a manifest of its own beside the manifest’s measure maps, what its elements state set aside, and then with their statements and provenance in place in the whole manifest, so a value may name any element of it.
IDs in a file. A manifest file writes every ID and every reference to an ID as # followed by the ID (TimeToShare’s README, “Written in a file”); a manifest held by core, and everything built on it, holds them bare. loadManifest reads a file’s #id into the bare ID with the schema package’s withBareIds, and saveManifest writes the file form with its withFileIds. The schema states the file form, so every schema check of a manifest core holds goes through one function, schemaChecked, which validates its file value (manifestFileValue), returns the value as core holds it (bare IDs, the held @context) and maps the path of a problem back to the bare manifest (idFormPath: a key of graphical.order loses its #); a file is validated as written, before its IDs are made bare; the invariants and their messages work on bare IDs and quote them so. The workspace file holds IDs bare throughout, its manifests included, and so do the data-id attributes of a drawing’s SVG.
Commands#
Every edit is a command, a plain JSON object {type, ...} carrying its author and time once journalled, and there are four: add, set, remove and style. Each is aimed at addresses, and the kind of its target, resolved once, decides what it does. apply(view, command) is a pure reducer: it never modifies its input and returns either the new view or a CommandError {code, message, path}. It parses the command, dispatches it by type and target kind, applies it atomically (one refused change refuses it whole), and settles every block the command touched: in each touched manifest every groupstamp whose timeline is no group’s member any more (a group removed, a member gone from its group) is made an ordinary timestamp (withGroupstampsOnMembers), so a command ending a membership is never refused for the groupstamps it leaves; then the manifest is checked by the schema and the invariants once, and its block’s places fitted to its containers.
add {into, <kind>: value}adds ablockintoworkspace; a roottimeline(completed, the locks of its place applied, its ID not yet held in the manifest; a root may carry anoffset), agroup({id?, name?, meta?, members}, its members existing timelines or virtual timelines, each joining it asset groupsjoins a group), ameasure_map({id, name?, meta?, rows}) or avirtual_timelineinto a block; achild,region,flow_controlelement ormapinto a timeline; aflow_mapinto a root (FlowMaps and virtual timelines). The value carries its id, except a named timestamp, an elision and a named MatchStamp, whose IDs core mints (below), and a group, a region, a flow-control element, a map, a FlowMap and a virtual timeline, which may leave theiridout to have one minted (IDs and addresses). A namedtimestampis added into a timeline (any timeline, a segment included):{name, coordinate, display?, groupstamp?}, the name and the coordinate required (invalid_value) and nothing else (unknown_property), the name non-empty, the coordinate a bare value on the timeline’s own axis within[0, length](invalid_value, orinvalid_coordinatefor a value of another number type), anddisplaya list of display words fromwedge,name,id,coordinateandcross_section, each at most once (invalid_value: “‘w’ is no display word”, “‘w’ is given twice”), stored in that canonical order, the schema’s default["wedge", "name", "cross_section"]where it is left out, andgroupstampa boolean (readGroupstamp),trueonly on a group member, a timeline a group lists or a descendant of one (core’sgroupsHolding,manifest/tree.ts, overmemberAncestry, so a group’s virtual member is one), else refused withinvalid_value, andfalsewhere it is left out (the editor givesgroupstampByDefault: on a group member, unless the innermost open editor is a timeline editor); each refusal lies at[addressKey(into), "timestamp", <member>]; it is given a mintedtimestamp_…ID, which the journaled command carries, so a replay reads it and mints nothing, and written into the manifest’sgraphical.timestampsin canonical order (bytimeline, coordinate,id). Only the coordinate on its own timeline is stored, never a map’s value. Anelisionadded into a timeline (at any depth, a segment included) is{start, end, name?, width?, display?}, the start and the end required (invalid_value) and nothing else (unknown_property): bare values on the timeline’s own axis, the start at or after 0 and the end at or before a known length (elision_stretch, worded as TimeToShare’s validators word it), the end after the start (elision_stretchatend); the name non-empty;widthexactly one of{ratio}(above 0, at most 1),{span}(a bare value on the timeline’s axis above 0,non_positive_numberotherwise) and{canvas}(a finite number above 0), and the standard gap where it is left out;displaywords fromellipsis,name,id,coordinateandcontinuation, each at most once, stored in that order, the schema’s default["ellipsis", "name"]where it is left out. It is given a mintedelision_…ID and written intographical.elisions. Added into a block,elisionis a non-empty list of such values, each naming itstimeline(elision_timelinefor an ID naming no timeline), given their IDs in list order: one command storing several elisions at once, as the editor stores the gaps a card derived (The inspector). Every problem of an elision lies at[addressKey(into), "elision", …](a list’si-th at[…, "elision", i, …]), so no elision a command makes reaches the schema check. A root timeline added into a block is given, within the same command, two default timestamps (withDefaultTimestamps):originat the zero of its number type and, where its length is known,lengthat its length, each with thedisplay["wedge", "coordinate"], no groupstamp and a mintedtimestamp_…ID; a child is given none when it is added. A child that joins a group (set groups, or anaddof a group listing it) is given the same two as groupstamps, theirdisplay["wedge", "coordinate", "cross_section"], so that their lines cross the group’s frame and the ancestor lines in its card; a timestamp of it already namedoriginorlengthat that value is made a groupstamp instead,cross_sectionadded to itsdisplay. Only joining gives them: one deleted later stays deleted. Once made they are named timestamps like any other. The editor gives every root of a manifest it imports the same pair when the manifest has nographicalobject (importedManifest), which would state its own timestamps. A named MatchStamp,matchstamp, is added into a block:{name, anchors, match_claims}, each required (invalid_value) and nothing else (unknown_property), the name non-empty,anchorsa non-empty list of alignment anchors in screen order (top to bottom, then left to right), each a pair of coordinates{timeline, coordinate}naming a timeline of the manifest and a bare value on its own axis within it, no anchor given twice, andmatch_claimsthe IDs of the MatchClaims behind it, kept in the order given. It is given a mintedmatchstamp_…ID, each anchor a mintedanchor_…and thedisplay["line"], the middle anchor in screen order (the upper of two middles)["line", "name"]; every coordinate becomes the match timestamp lying there, a named timestamp withmatchstamp: true: the one the manifest holds at that exact value of that timeline, else a new one with a mintedtimestamp_…ID, no name, thedisplay["cross_section"]andgroupstamp: truewhere its timeline is a group member, elsefalse(a match timestamp taken over keeps its own), so at most one lies on a coordinate and an ordinary named timestamp is never taken for one. The rules of a MatchStamp (an anchor joining two timelines, its anchors one connected set, a claim ID listed once) are the schema’s, checked on the settled manifest (schema_violation).set {changes: [{target, values: {...properties}}]}sets properties of blocks and elements; the properties are nested undervalues, so none collides withtarget. One gesture is one command, so moving five blocks is onesetwith five changes.remove {targets}removes blocks and elements, mixed, every target resolved before anything is removed; a block goes with every block whoseparentchain reaches it. A removed timeline takes along its subtree; the named timestamps and the elisions lying on it or on its subtree; its id from every group’smembersand every display order; its own and its descendants’ band orders; every entry of a style rule’sselect.addressesaddressing a removed element, a rule left with none going too, and every rule whoseselect.withinnames it. A group left without members stays. A removed timeline or region, with every timeline and region removed along with it, is taken out of what every element of the manifest states (withoutReferencesTo): a value that is a node naming it ({id: "#X"}) goes, as does a provenance entry whose value names it,#Xleaves everybasisandstated_by, aservice#Xgoes, and a list, node, container orprovenanceleft empty loses its key; a reference into another manifest (other.yaml#X) stays. A removed named timestamp takes along everyselect.addressesentry naming it or one of its parts, its labels and its cross-section line, a rule left with none going too. A named MatchStamp goes with its anchors and every match timestamp no other MatchStamp names; a removed timeline or match timestamp takes along every MatchStamp an anchor of which names it, and leaves thetimelinesof every resource; an alignment anchor alone is refused withnot_removable. A removed group goes alone: its members stay, roots ungrouped and children in their parents. A removed measure map goes alone too. Removing the last root leaves the block empty. A segment, a child of a segment line, whose removal would leave a gap in its line is refused withsegment_not_removable(“Removing segment ‘S’ of line ‘L’ is not supported yet”); one that goes with its line, an ancestor or its block is removed with it.style {select, set, name?, blocks?}puts a style rule into the manifest of each listed block, or of every block with an element the selector matches; its addresses name bare IDs, as every command does, and a file writes them#-first. Withname, the declaration becomes a named style in that manifest’sstyles. A rule whose selector equals an existing one is merged into it; a property set tonullis removed, and a rule left empty is dropped.
What each target admits is one capability table in code (SETTABLE for set, beside the tables of add and remove):
Target |
Address |
|
|
|
|---|---|---|---|---|
workspace |
|
|
|
no |
block |
|
|
|
yes |
timeline (root or child) |
|
|
|
yes |
FlowMap |
|
|
none |
yes, unless a virtual timeline applies it |
virtual timeline |
|
|
|
yes, unless a virtual timeline comes from it or a FlowMap names it as a chunk |
group |
|
|
none |
yes |
region |
|
|
none |
yes |
flow-control element |
|
|
none |
no (only with its timeline) |
conversion map |
|
|
none |
yes |
measure map |
|
|
none |
yes |
named timestamp |
|
|
none |
yes |
elision |
|
|
none |
yes |
named MatchStamp |
|
|
none |
yes |
alignment anchor |
|
|
none |
no |
A name set on a block is its manifest’s, the title; on a timeline, group, measure map, conversion map, region or flow-control element the element’s own; null states none. A named timestamp and a named MatchStamp keep a name, so null is refused for them (invalid_value), except on a match timestamp, whose name is optional: null deletes it. The workspace’s name is a non-empty string (invalid_value otherwise). A timeline’s is_segment_line makes its children its segments, or plain children again; it and its subtree then take the locks their places decide (Invariants), and a line turned off loses the lock its place gave it for being one: a child or a group member is unlocked, a root that is no member keeps its own locked. A group’s order is its display order, every member once, or null to delete the entry (invalid_order otherwise). A timeline’s order is its band order, or null so that it inherits again; any other value is refused with invalid_order and the first problem in the terms of TimeToShare’s validators, such as 'regions' is missing from the band order of 'score'. place merges into the block’s places entry of an item or of a timeline’s one card: a member given a value is stated, one given null is no longer stated, and a place left empty is deleted. A member’s card is set through its group: a group’s cards, {[T]: {width?, height?, spacing?, margin?}}, merges each member’s value into places[G].cards[T] by the same rule, a card place left empty and then a group entry left with nothing being deleted; cards: {} and a member value of null are refused with invalid_value, and a timeline that is no member of the group with unknown_place ('T' is no member of group 'G'). A timeline’s place sets its card only where it has one card: a timeline drawn in no card of its own or in the frames of several groups is refused with not_an_item ('T' is drawn in the frames of several groups), and a member’s card given x, y, length or scale, through either target, with not_an_item too ('T' is a member: its card takes only width, height, spacing and margin). The card address {block, id: T, part: ["card"]} takes no set (unknown_target). A MatchStamp’s anchors rewrite its anchors, as an Update of it to the current potential MatchStamp gives them: an anchor joining the same two match timestamps as one it has keeps that anchor’s ID and display, any other is new; where the anchor showing the name is gone and no kept one shows it, the middle one does; the match timestamps the new anchors need are made, those no MatchStamp names any more go, and the same anchors in another order change nothing.
Arrangements. An arrangement is placement, never part of the manifest (Arrangements). A block’s arrangement is null, deleting the member, or {direction, order}: direction vertical or horizontal, order a list of IDs of its groups and ungrouped roots, kept as given, an ID naming no item or named again being valid (readItemArrangement). A horizontal one is stored as the row the rules give from the order given (core’s rowOf), so a later reading of the block finds the row it is drawn in; one the rules refuse is refused with arrangement_conflict, its message the rules’ reason ("Theme A" and "Theme B" overlap on "Score" (8–16 ♩)). An edit that later breaks the rules, an offset moved, keeps the stored arrangement, which is then drawn one item under another until the conflict is gone. The workspace’s arrangement, of its blocks, is null or {direction, columns?}: direction vertical, horizontal or matrix, columns a positive integer that only a matrix states (invalid_value: “only a matrix has columns”; readCanvasArrangement), a matrix without it taking the smallest number of columns whose square holds the blocks (columnsOf). Each is one set, one journal entry.
Statements. What an element states is changed only whole: one set of statements (an object of property–value pairs) or provenance (a list of annotations), or both in one change, on {block} (the manifest’s own, which, like name, are properties of the block’s manifest and so no member of an add of a block, refused there with unknown_property), on a timeline at any depth, a segment included, or on a region replaces that member; null removes it. The Metadata tab builds every change with the schema package’s statement functions and sends it as one such set, so undo takes it back in one step. Core reads the shape alone (invalid_value, “statements is an object of property–value pairs, or null”, “provenance is a list of annotations, or null”) and leaves every other rule to the schema check of the settled manifest, a refusal being schema_violation with the schema package’s message at the offending value’s path in the manifest: “’#nope’ names no element of this manifest” at [<block key>, "manifest", "timelines", 1, "children", 0, "statements", "dcterms:source", 0, "id"], “‘foaf:maker’: the prefix ‘foaf’ is not declared in @context”. A prefix a statement uses is taken from the manifest’s own @context, else from TimeToShare’s catalogue, and the held @context follows the statements (The manifest value, load and save). A group takes neither member (wrong_target_kind). The manifest’s own statements lie outside every element of the manifest, so a group or timeline editor refuses to change them (No side effects).
Where a timeline lies. Two properties change a manifest’s structure; the Properties tab sends groups (The inspector), and no gesture sends parent yet. parent is null, making the timeline a root, or {timeline, offset}, making it a child of that timeline at that bare offset, its subtree with it, by the rule that places every child (it may grow an unlocked parent, as below). Refused: unit_mismatch for a parent of another unit; segment_structure when the moved timeline is a segment or a segment line, or the new parent a segment line; cycle for the timeline itself or one of its descendants; a locked parent that would have to grow, as for any child. groups is the list of the groups the timeline is a member of, distinct group IDs in any order: the timeline joins each listed group it was no member of, as its last member, and leaves each it was a member of that the list leaves out, so a timeline may be a member of several groups and is drawn in one card in each of their frames. Refused: invalid_value for a value that is no list of group IDs or that lists one twice, unknown_target for an ID that names no group, nested_member when the timeline would hold or lie inside another member of a group it joins. Ids never change; a moved timeline keeps its band order and its card’s stated size, and settling reshapes its places entry for its new holder.
FlowMaps and virtual timelines (commands/flowmaps.ts; what they mean, FlowMaps and virtual timelines). A FlowMap is added into the root it orders, {id?, timeline?, chunks, name?, canonical?, convention?, provenance?}, its timeline that root (invalid_value for another). A virtual timeline is added into a block, {id?, map, timeline, name?, through?, length?}, map and timeline required (invalid_value) and its unit and number_type never given (unknown_property): they and its length are computed, through a FlowMap its root’s unit and number type and the FlowMap’s played length, also through a group, as timetoalign reads it; through a conversion map core evaluates, the map’s target unit, that unit’s default number type and the map’s value at the end of the timeline holding it; through anything else, the unit and number type of timeline and the length the value must state, core carrying no map through it. A given length other than the computed one is refused with invalid_value naming both (“the length of a virtual timeline is computed from its map: 3054 ♩, not 24 ♩”). Each value is read where it will lie, the whole manifest checked by the schema and TimeToShare’s validators, so the root itself or nothing of the root’s tree as a chunk, a second canonical FlowMap, a cycle and a FlowMap applied outside its root’s tree without through are refused as the validators refuse them, schema_violation with their message at [<address key of into>, <kind>, …] (at [<FlowMap's key>, "chunks", k] for a set). A FlowMap is computed when it states a convention and a provenance entry of method inferred (isComputedFlowMap): a set of its chunks or name is refused with computed_flow_map (“FlowMap ‘default’ is computed from the flow control of ‘allegro’ and is read only”), and it takes only a new computation’s result, computed: {chunks, provenance}, both required and the provenance holding an entry of method inferred (invalid_value otherwise, and on a FlowMap written by hand, whose chunks take chunks), its convention, name and canonical kept. Every change of a FlowMap’s chunks writes, in the same command, the played length of every virtual timeline playing it, without through or through a group, and of every virtual timeline playing one of those as a chunk, each recorded at [<virtual timeline's key>, "length"]. remove refuses, with not_removable naming what still names it, a FlowMap a virtual timeline left applies (“FlowMap ‘default’ is applied by the virtual timeline ‘allegro_default’”) and a virtual timeline that another comes from or that a FlowMap names as a chunk, unless they go in the same command; a removed virtual timeline leaves its groups, every display order, its place and every rule addressing it, and a rule whose flow names a removed FlowMap or virtual timeline loses its flow, so the card is drawn as written. A virtual card is hidden by set {place: {x: null, y: null}} on {block, id: V} (a place every stated member of which goes is deleted, and the card with it) and shown again by a place; remove of {block, id: V} deletes the virtual timeline and leaves its FlowMap. A named timestamp is added into a virtual timeline, on its own axis, as into a root, and a group or a band order takes a virtual timeline as it takes a timeline.
The flow switch is a style rule, no command of its own: style {select: {addresses: [{id: T, part: ["card"]}]}, set: {flow: F}, blocks: [B]} switches the cards of root T onto F, a FlowMap of T or a virtual timeline applying one of T’s FlowMaps to T without through, and flow: null switches them back. flow is read as an ID; the validators’ flow_rule refuses a named style setting it, a selector other than card addresses alone, a value naming no FlowMap or virtual timeline, and one of another timeline (schema_violation). Core’s cardFlow(manifest, T) is the one reader of the rule, for layout, core’s element listing and the canvas alike: the last rule of the manifest’s own layer that selects {id: T, part: ["card"]} by addresses alone and sets flow; no other layer gives a card a flow, and layout’s cascade has no flow style.
A command is atomic. Ids are never settable, nor a timeline’s unit or number_type, nor a root’s offset. A flow-control element is never changed in place: its role, its coordinate and what decides the flow stay as they were added, and it is removed only with its timeline (not_removable). A set gives it a name and a label, and changes its provenance only by a belief: the actor’s earlier belief, compared as the IRI it stands for under the manifest’s @context, is replaced in place, else the belief joins the first entry, else the element gains one entry holding it alone; every entry’s paradata and every other actor’s belief are kept, so no command erases provenance, and an element is believed again only by the actor who rejected it. provenance itself is no property a set gives (unknown_property). A set that changes nothing, a value written equal to the stored one or values that undo each other, is refused with invalid_value (“the command changes nothing”); the values written are compared path by path, and a block where a change reached past its path (a whole manifest, a move, an offset, a group) is compared whole. A position on an element’s own axis is a bare value, normalized as its axis’s number type selects: an integer on a float axis is stored as that float, an integer on a fraction axis or a coordinate dict is refused with invalid_coordinate, and a pair is reduced to lowest terms. Replaying a journal is deterministic because every ID is in it. The caller gives the id of what it adds: a block id with mintBlockId, an element id unique in its manifest (manifestIds lists the IDs a manifest holds, an elision’s among them). Every ID a command creates, the kinds above and the first segment of every segment line it leaves without one, dispatch mints with the store’s minter before the command is applied and journals in the command’s ids list, in the order CarriedIds (commands/types.ts) states for each kind; the reducer is pure and mints nothing, so a replay takes the IDs from that list, and a list too short, or too long where the command is checked, is refused with invalid_command at ["ids"]. preview mints with a copy of the store’s minter (store.minter()), so a preview shows the IDs its dispatch will journal. A given ID the manifest already holds is refused with duplicate_id, the value’s own ID at [addressKey(into), <kind>, "id"], and a given ID nested inside the value (such as a child’s own child) at its location in the manifest the command would leave ([<block key>, "manifest", "timelines", 0, "children", 0, "children", 0, "id"]).
preview(view, command) is the reducer without the schema check, the invariants and the no-op refusal: what a gesture shows before its release, so a preview can never differ from what the release stores (The gesture engine).
A refusal’s path follows one rule: it starts with the key (addressKey) of the address of the target at fault, followed by the property or kind at fault ([<address key>, "length"]), or by "manifest" and a location in the manifest the command would leave. The problems of an add’s value lie under the address it is added into, at [addressKey(into), <kind>, …]: a block added to the workspace at [addressKey({}), "block", …], its duplicate ID at [addressKey({}), "block", "id"]. No path starts with a bare block id; only a malformed command names the malformed member of the command itself. A message quotes an ID as 'x' and names an address by its words, addressWords(view, address): the workspace, a bundle by its manifest’s name or id (“bundle ‘Mixed’”, “the anonymous bundle”), an element by its kind and its name, else its ID, followed by its bundle unless the view holds that block alone (“timeline ‘Score’ in bundle ‘Mixed’”), a band, a card or a part by its owner (“the regions band of timeline ‘Score’”, “the line of timestamp ‘Downbeat’”), and an address naming nothing by its members (“‘gone’ in bundle ‘Mixed’”, “block ‘0000000009’”). The path keeps the key; the words are for the reader only. The codes are stable strings, exported as ErrorCode:
reading:
invalid_json,invalid_yaml,invalid_command,invalid_coordinate,invalid_value,schema_violation;the workspace file:
unsupported_format,unsupported_version,unknown_member,missing_member,unknown_session,unreferenced_session,session_referenced_twice,journal_mismatch;the workspace:
invalid_block_id,key_mismatch,unknown_parent,parent_cycle,invalid_index,duplicate_index,non_finite_number,non_positive_number,invalid_order,unknown_place;addressing:
invalid_address,unknown_target,unknown_property,wrong_target_kind,id_not_settable,not_removable(the workspace and an alignment anchor),duplicate_id,not_an_item;structure:
unit_mismatch,segment_structure,cycle,nested_member;editors:
no_editor,not_inside,side_effect;arrangements:
arrangement_conflict;FlowMaps:
computed_flow_map;elisions:
elision_timeline,elision_stretch;lengths and Delete:
child_exceeds_parent,locked,length_below_content,segment_end_fixed,timestamp_exceeds_length,elision_exceeds_length,segment_not_removable;locks:
segment_never_locked,unlocking_not_supported;manifest invariants:
region_end_before_start,negative_child_offset.
Invariants#
The manifest invariants are timetoalign’s, checked on every load and over the manifest every command would leave: every value on a timeline’s own axis reads as that axis’s number type; a region does not end before it starts. That a unit admits a timeline’s number type (TimeToShare’s one table of units, UNITS, refused as schema_violation at the timeline’s number_type), that IDs are unique across the manifest, that a jump destination’s to and a break’s ends.after name an element that is there and not rejected, that a measure view’s measure_map names one of the manifest’s measure maps, that a conversion map converts from its timeline’s unit and a map another map holds from its holder’s source unit, that a child has its parent’s unit and lies within its parent’s known length, and that a segment line’s segments are contiguous, are TimeToShare’s rules, checked by its validator; so a removal that would leave a destination’s to or a measure view’s measure_map naming nothing is refused. A negative child offset is valid in the schema but not supported yet: core refuses it with negative_child_offset at the child’s offset and the message A negative child offset is not supported yet: child '<id>' has offset <offset>.; a root’s offset may be negative. The catalogue in app/packages/core/tests/README.md lists every row.
Locking. locked states whether a timeline’s length is fixed; it defaults to false. A segment is never locked: its segment line’s lock governs it, so reading a manifest unlocks every segment, and a segment is written with false. A segment line that is a child, a segment or a group member is locked, and is written with an explicit true, in the minimal form too. A locked that contradicts its place is refused: true on a plain segment with segment_never_locked (“A segment is never locked: lock its segment line ‘false on such a segment line with unlocking_not_supported. A locked timeline’s length cannot be set (locked). An unlocked timeline’s length may be set, never below the farthest point a child reaches (length_below_content) and never past its parent’s known length (child_exceeds_parent); a segment line fixes its segments’ ends, and a length that would move one is refused with segment_end_fixed; a named timestamp lying exactly at the old end follows the end to the new length (replaceTimeline), so length stays at the end, while any other named timestamp keeps its place, and a length below one is refused with timestamp_exceeds_length, naming the first in canonical order; an elision ending at the old end follows the end while the new length lies after its start, and is refused with elision_exceeds_length otherwise; any other elision keeps its place, and a length that would leave one ending beyond it is refused with elision_exceeds_length; a length of null is always taken. A child added into, or moved within, an unlocked timeline past that timeline’s known end grows that timeline, and only that timeline, to the child’s end, provided the grown length passes the same checks; a locked timeline refuses the child with child_exceeds_parent. A parent never grows because a child grew, as in timetoalign.
Segment lines. A segment line of known length that an edit leaves without segments is given one: a segment from 0 covering the line’s whole length, of its unit and number type, unlocked as every segment is, its id minted with the prefix of its unit’s timeline class and carried in the command’s ids (core’s withSegmentLinesCovered). This happens before the schema checks every edited value: a manifest set whole (the Manifest tab’s Apply), a block or timeline added, and every command’s settling. In a manifest set whole, the tree of every root whose lines were covered then takes the locks its places decide, as is_segment_line gives them, so a member segment line that Apply gave its first segment is locked; the tree of a root the cover left alone is taken as the text states it. Reading a manifest never applies it, so a file holding such a line is refused as the schema’s validator refuses it. A segment line of unknown length is left as it is, since nothing fixes where its segment would end.
Unknown length. A length of null means that the length is not known, on any timeline. It is a fact the manifest states, never inferred and never a violation; every check that needs an end runs where the end is known and is skipped where it is not. A child of unknown length reaches its offset, so adding it past the end of an unlocked timeline of known length grows that timeline to the offset.
Two rules go beyond what the library enforces, because the editor addresses and stores values directly: a value on a timeline’s own axis must already carry the axis’s number type, and a parent grows only to a value its own number type holds exactly. A child shares its parent’s unit but may have another number type; its end, offset plus length, follows Python’s numeric tower.
MatchClaims and potential MatchStamps#
A package’s MatchClaim table lies beside its manifest, never in it, and core never holds it in a workspace; what it reads of one is the columns the server answers (The server), in core’s matches/ (decisions/0029): the table’s typed columns of exact values and their check (columns.ts), which builds, once per columns, the map from claim ID to row (claimRowOf) that the comparison and the editor read; the belief filter (beliefs.ts): its four states, true, undecided, unlikely and false (BELIEF_STATES, in the order the editor offers them), its default, every state but false (DEFAULT_BELIEFS), and its check (checkBeliefFilter), all TimeToShare’s and re-exported, as timetoalign reads the same ones; believedBy, the believer’s state for every claim, its belief, the most critical of several (false, unlikely, undecided, true: ANCHOR_BELIEFS), or undecided where it holds none; the row mask beliefMask keeps every row whose state is one of the kept states (null where all four are kept); and anchorBelief, the most critical state among the claims stating one anchor, by which a shown anchor is coloured; the believer and every actor compare as the IRIs they stand for under the manifest’s @context (actorIri: a compact IRI expanded by its prefix, TimeToShare’s expandIri, else as written), as timetoalign compares them, so a compact and an absolute IRI of one person are one actor wherever the editor compares actors; the anchor index built from the columns under that mask (anchorIndexOf, anchors.ts, sort.ts), with the unique coordinates, the AlignmentAnchors (two coordinates on two timelines that a claim states) and the claims stating each, the potential MatchStamps (each connected set of anchors, numbered by its first coordinate), the matched spans and the segments between two timelines (both not yet wired), and the hit tests (coordinateNear, coordinatesWithin); and the comparison of a named MatchStamp with the index (checkMatchStamp, compare.ts): which of its anchors the index still states, in the order of its alignment_anchors, with the rows of the claims stating each (statedBy), which of its MatchClaims are missing from the table, left out by the belief filter (claimsFilteredOut), stating other anchors or new, whether it is out of date (an anchor no longer stated, any such MatchClaim, or an anchor it lacks of the potential MatchStamps its coordinates now fall into), and the potential MatchStamp an Update rewrites it from: the one holding its stated anchor that shows the name, else the largest of those its coordinates fall into, none when no anchor of it is stated. The commands that name, update and remove a MatchStamp are core’s ordinary ones (Commands).
FlowMaps and virtual timelines#
A manifest’s flow_maps order the stretches of a root (TimeToShare’s README; drawing specification, section 8.10), each a list of chunks, each a Region of the root or of a descendant, a child timeline, a virtual timeline or a gap of a stated length on the root’s axis; its virtual_timelines apply a FlowMap, or a conversion map, to a timeline, giving it an axis of its own. Core resolves both without a server, as timetoalign does, in the root’s number type (manifest/flowmaps.ts, manifest/virtual.ts, both exported from the main entry):
resolveFlowMap(manifest, id)gives aResolvedFlowMap{flowMap, timeline, unit, numberType, chunks, stretches, runs, length}: each chunk{kind, index, source, written, played}of kindregion,timeline(a child),virtualorgap, its written stretch carried to the root’s axis level by level (a Region’s or child’s bounds expressed in the root’s number type,expressAs, plus the origins on the way up);stretches, the flat list of placed stretches, a virtual chunk giving one per stretch of the FlowMap it applies, each chunk placed after the one before (P(i+1) = Pi + ℓi, in timetoalign’s order of operations, so float axes agree bit for bit);runs, section 8.10’s runs, consecutive chunks naming one ID (gaps form none), the one run rule that the element listing and layout read; andlength, the played lengthΛ. The root itself is no chunk (flow_map_chunk), nor is anything outside its tree; a gap whose value is no exact value of the root’s axis (1/3 on a float axis) is refused. A stretch is half open:unfold(resolved, written)gives every played position of a written one, each anOccurrence {played, occurrence, of, chunk},fold(resolved, played)the written position of a played one (nullin a gap), refusing a position outside[0, Λ)(outside_virtual_axis). Errors are thrown asFlowMapError {code, path}, its path into the manifest.resolveVirtualTimeline(manifest, id)gives aFlowVirtualTimeline(kindflow_map, its resolved FlowMap) or aMappedVirtualTimeline(kindconversion_map, the map compiled, its span), both with{id, map, timeline, through, source, unit, numberType, length};unfoldVirtualandfoldVirtualread either. Withoutthroughthe timeline must be the FlowMap’s root;througha group (throughGroup) it takes the FlowMap root’s axis and played length, as timetoalign does, without carrying positions through the group;throughanything else is kept as written, its stated length unevaluated. A conversion map is one of the top-level maps of a timeline (one inside a chain or combination map is refused,map_not_evaluated), whose target unit must be the virtual timeline’s; its length is the map’s value at the holding timeline’s length.
The drawing’s side lies in @timetoalign/tilie-core/drawing. virtualDrawing(manifest, id) reads a virtual timeline as the root it is drawn as, holding nothing, and withVirtualMembers puts a group’s virtual members into its frame in display order, the one builder and the one frame order layout, the element listing and the canvas use (files.ts, with locateVirtual). manifest/switched.ts is the one source of switched cards (Virtual and switched cards): cardFlow (the card’s flow, Commands), switchOf (the Switch {flowMap, named, name} a card is switched to, or null: a FlowMap of its timeline that resolves, or a virtual timeline applying one without through), unfoldingOf (the stretch pieces Piece {a, b, P, closed} of an Unfolding, with the carry of another member m × λT / λM, exact or in binary64 with the product first), playedAt and playedSpan (where a written point or extent is drawn, piece by piece) and the counts piecesHolding and piecesReached. manifestElements lists a virtual card’s elements (its card, line, name, markers and regions bands, every chunk’s brace and label, each boundary [k, "start"] from the second drawn chunk on, a run once in a block-held card and each chunk in a frame, its named timestamps, and, on a placed card no group holds, its card elisions, those stored on it, elisionsUnder) and a switched card’s (its FlowMap’s chunks on T’s line, and every element of T’s tree once per piece reaching it: a conversion map once per piece reaching its timeline’s extent, a flow-control element, with its labels, symbol and fork, once per piece holding its position, and no elision; in a switched frame the other members carried, a member’s flow control outside it once per piece holding it, a child member’s ancestor lines once per piece), so a rule selects them as any other element. isAtomicSection(manifest, region), over regionClasses, is the one test of an atomic section (the class tts:AtomicSection in any spelling standing for its IRI).
The workspace view#
A workspace is held as a View, an immutable plain value: meta (format: "tilie-workspace", version: 7), name, settings, graphical, arrangement where the blocks are arranged (Arrangements on the canvas), and blocks, a map from block id to block. The name is never empty, untitled (UNTITLED_WORKSPACE) for a new workspace, and gives its file’s default name. graphical holds the workspace’s default style rules, the cascade’s layer between the built-in defaults and each manifest’s own; like the name, it is changed by commands. The settings say how the editor is used on the workspace, and no command changes them (The store and its journal): grid {size, snap} (8 units, snapping), blockDefaults (scale 1, length 400, spacing 8, margin 0, no requested size) and granularity {denominator, decimals} (DEFAULT_GRANULARITY, 2520 = lcm(1, …, 10), so every tuplet up to tens, and 3), the caps on a position picked on a timeline: denominator, a positive safe integer, for fraction axes, and decimals, an integer from 0 to 15, for float axes, which also sets the places a float is shown with; an int axis has no setting (Values on timelines); manifests, how each block’s manifest is written to a file (below); and matchClaimFilters, by block id, which MatchClaims of the block’s MatchClaim table are shown: {timelines, beliefs}, the claims between two of the listed timelines (null for every timeline, a list in code-point order) whose state for the user is one of beliefs, a list of belief states, each once, held in the order of BELIEF_STATES; {timelines: null, beliefs: ["true", "undecided", "unlikely"]} for a block without an entry (matchClaimFilterOf); the table itself is never held. A workspace file whose settings.granularity does not read as one is read with DEFAULT_GRANULARITY, and a settings.manifests or settings.matchClaimFilters that is missing or no object as none, each of its entries that does not read being left out (a filter written in an earlier shape gives its block the default), since settings lie outside the journal and nothing replayable is lost; every other member is read strictly. A block has an id; a parent, the canvas group holding it, null in this version; an index, its order key among the blocks of the same parent; and the inputs of its drawing besides the manifest’s own: x and y (the canvas position of its drawing’s place origin), scale, length, spacing, margin, width and height (each null for the content’s own size), places, arrangement where its items are arranged (Arrangements), and manifest. An arrangement that is not there is none: no view holds an arrangement of null, a set of null deletes the member and a file stating null is read without it (Commands). emptyWorkspace() is the empty one. A view’s problems, by block, are a block stored under another key, a malformed id, a missing parent or a cycle of parents, a malformed or shared order key, a canvas number that is not finite, a scale, length or size that is not positive or a spacing or margin that is negative, a malformed place or one that names no container (unknown_place), and every schema or invariant problem of a block’s manifest.
Manifest files. settings.manifests says how each block’s manifest is written to a file, by block id: {minimal, styling, serialization, location?} (ManifestFile), the minimal or the complete form, with or without the manifest’s graphical object, and yaml (canonical YAML), json (pretty JSON) or jcs (RFC 8785 JSON); and, where the editor knows it, location, where the manifest’s file lies: a non-empty POSIX path relative to the workspace file’s folder (a workspace without a file counts the server’s root as its folder), as a manifest’s resources locate its files relative to the manifest, refused with invalid_value (“expected a relative POSIX path”) when it starts with /, holds a backslash or names a scheme or a drive. Import stores the entry its file implies (The header and the File menu), and Include styling and Minimal, in the Manifest tab and in the Bundle tab, change it (The inspector), each through configure({manifests}), outside the journal; a manifest imported or located through the server’s files adds its location, and a Save into another folder rewrites every location relative to it (The header and the File menu). A block without an entry, one whose manifest came from no file or one of a workspace file that states none, is written minimal, with its styling, in canonical YAML. An entry outlives its block, which undo may bring back.
Sibling order is a fractional index, a string key that compares with ordinary string comparison, so that a block moves between two others by taking a key between theirs (indexBetween, indicesBetween, isIndex), compatible with Rocicorp’s fractional-indexing 4.0.0 and written in core (decisions/0016).
The store and its journal#
createStore(workspace, {author?, clock?}) holds a workspace, {view, journal, sessions}, and returns view, journal, sessions, editing, entries, listed, changes, openings (the count of every open), canUndo, canRedo, dispatch(command), configure(change), undo(), redo(), open(target, kind?), done(), cancel(), snapshot(), setAuthor(name) and subscribe(listener). dispatch stamps the command with its author (by default Gerhardt; the editor gives it the user’s name, The user) and its time (ISO 8601, UTC, from the injected clock), applies it, runs the side-effect guard while an editor is open, and appends {command, author, time}; it returns null, or the CommandError of a refused command, which leaves the store unchanged.
The journal is the authority. Replaying the journal from the empty workspace, named untitled, reproduces the workspace. createStore verifies this before it returns: it replays the journal to its end and compares the result’s name, graphical, arrangement and blocks with the workspace it was given (the settings are no command’s and are never compared), and throws JournalMismatchError {entry, path} naming the first differing path when they differ, an empty journal beside a non-empty view included, and a file stating a name that no command of its journal gave (["name"]). The editor shows that error as it shows a refused file. A journalled add of a block carries every member of its placement, the blockDefaults it was added with filled in, so replaying never reads the settings. readWorkspace does not replay; reading and verifying are two costs (Performance). The decision record is decisions/0019.
Settings outside the journal. configure(change) changes any members of the settings, each given in part, at once: it journals nothing, is never undone or redone, and is refused with the first problem of the settings it would leave, at ["settings", …]. It gives a new view, so the workspace is marked unsaved and autosaved, and every view the store shows afterwards, at any step of undo, carries the settings last configured.
Undo by steps. A change is one command at any depth, owned by the innermost session whose own entries hold it, the session of the editor it was made in, or by none for a command of the main journal. A change that the level in view owns itself is a step of its own; a closed session’s changes go by runs, a step being a maximal run of consecutive changes owned by one closed session. undo reverts the latest applied step, redo re-applies the earliest undone one, so redo mirrors undo step for step, and a new command discards the undone changes. So a closed session holding a1, then a closed session of b1 and b2, then a2 is undone in three steps, a2, then b1 and b2 together, then a1. Views are kept per change with structural sharing; an undo past the views the store holds applies the changes from the latest view it holds, or from the empty workspace at the start of a loaded journal.
Editor sessions. Every editor is a session: the commands made in it between its opening and Done or Cancel. The store keeps one level per open editor above the main journal; the open editors are editing, outermost first, each {session, target, kind, earlier}: its session id (ten characters from 0-9a-z), its target ({block}, or {block, id} of a group or a timeline) and its kind (EditorKind: bundle, group or timeline, the one its target opens, editorKindOf; any other address has no_editor; or flow, the flow-control editor of a root’s flow control and FlowMaps, asked for by name, open(target, "flow"), on a root timeline only, no_editor on any other address). entries, listed, dispatch, undo and redo act on the innermost level: undo inside a session stops at its start.
open(target, kind?)opens an editor; with one open, the target must lie inside the innermost target and not be it (not_inside), except that a root’s flow-control editor opens inside the root’s own timeline editor too, and nothing opens inside a flow-control editor (opensIn); so a root’s flow-control editor opens on the arranger, in its block’s bundle editor, in the editor of a group holding the root and in the root’s timeline editor. When the last entry holding an applied change on that level is the session of the same target and kind, that session is unfolded: taken off the level, keeping its id, its changes undoable and redoable again. Otherwise a fresh session opens, andearliernames the last session of the same target and kind, listed read-only in the Journal tab.done()closes the innermost editor; a session holding entries is stored under its id insessions, and{session, author, time}, stamped at Done, is appended to the level below. A session left without entries records nothing.cancel()closes the innermost editor and restores exactly the state at its opening.changescounts what Cancel would discard: withothe changes applied at opening, flattened at every depth,cthose now andpthe length of their common prefix,(o − p) + (c − p).snapshot()returns the workspace as Save writes it, every open editor folded innermost first as Done would fold it, writing only applied changes.edit(target, commands)makes several commands one step: as if the editortargetopens (editorKindOf) were opened, the commands dispatched in it in order and Done pressed, journalled as one closed session{target, entries}, so undo and redo take them as one run, after a save and a reload too. Inside an open editor that editor must open there (not_inside, asopen); where the innermost open editor is that editor itself, the commands are its own entries, a step each. It is atomic: a refused command,no_editorornot_insideleaves the store as it was and notifies nobody, and an empty list changes nothing. It adds no command and no kind of journal entry; a frame’s flow switch is made with it (Virtual cards on the canvas).
No side effects#
An editor changes only what it edits. While an editor is open, dispatch compares the view a command would leave with the view before it and refuses the command with side_effect (”<what> lies outside <target>: an editor changes only what it edits”, “lie” where <what> names several things) at the path of the first difference outside the innermost editor’s target, in this order: the workspace’s name, its graphical or its arrangement of the blocks; another block; for a group or timeline editor, its block’s scale, length, spacing, margin, index, parent or arrangement; a key of the block’s places that the target does not contain, except that a member’s editor may change its group’s length, scale, width and height and the width of every sibling’s card (they are shared, or kept in proportion by a stretch); and the manifest outside the target, compared with the target reduced to its id and with only the style rules that match an element outside it: first each element, then what each timeline and region states apart from it (“the statements of timeline ‘clt_1’ lie outside timeline ‘clt_3’”, at [<key of its address>, "statements"]), then the manifest’s own members, its statements and provenance among them (“the manifest’s statements in bundle ‘Mixed’ lie outside timeline ‘Score’”, at [<block key>, "manifest", "statements"]), then the members of its graphical, its named MatchStamps compared whole, so a group or timeline editor refuses to name, update or remove one; the @context is left out, since it follows from the statements compared. So a group or timeline editor changes nothing stated outside its target: it refuses a set of its block’s own statements, and a removal inside the target that would prune a reference to a removed element from what an element outside it states. The command’s change set, the blocks and settings it touched and the paths it wrote, narrows the comparison to them, with the same result as comparing everything: where every path lies inside the target and no change reached past its path, or the manifest is unchanged, the manifest is not compared at all. An entry of graphical.order lies inside when the target contains its group or timeline, and a style rule selecting bands lies inside when every band it matches belongs to a contained timeline. A block’s x, y, width and height are the container adapting, never a side effect; removing or renaming the edited element is refused at the target. The bundle editor contains its whole block.
The flow-control editor of a root is checked by what a command aims at, not by the view it leaves, since every command it admits changes members outside the root (flow_maps, virtual_timelines, places): editorSideEffect hands it to flowRefused, which admits exactly an add of a FlowMap into the root, of a Region or a flow-control element into a timeline of the root’s tree and of a virtual timeline applying a FlowMap of the root; a set of such a FlowMap’s chunks, name and computed, of such a virtual timeline’s name and place, and of what core’s setters take of a flow-control element of a timeline of the root’s tree (its name, label and belief); a remove of such a FlowMap, virtual timeline or flow-control element (core refuses the last, not_removable: a flow-control element is rejected by a belief, never removed); and a style whose blocks name the root’s block alone, that names no shared style (name), and whose selector lists addresses, each resolving (resolveAddress) to a flow-control element of a timeline of the root’s tree or to a part of one (its symbol, fork or label), so the display controls of a selected flow-control element act there, while a band’s controls, whose selectors name no addresses, do not; nothing in another block. Anything else is refused with side_effect (“the name of timeline ‘Score’ lies outside the flow-control editor of timeline ‘Score’: an editor changes only what it edits”), at [<address key>, <property>] or [<address key>], a style at the first selector address not admitted, else at the root’s. A FlowMap lies outside every timeline editor, its root’s included (it is compared whole, as a member of the manifest): only the flow-control and bundle editors change FlowMaps. A virtual timeline’s card lies inside the editor of a group having it as a member.
What a target contains is contains(manifest, container, element): a timeline contains itself, everything that belongs to it or to a descendant, its bands among them, and their parts, but no ancestor line; a group contains itself, its title and whatever its members contain.
The workspace file#
A workspace is saved as one pretty JSON file, whatever file form its manifests are exported in, by default <name>.tle.json after the workspace’s name: {meta, name, settings, graphical, blocks, journal, sessions}, every manifest embedded whole with bare IDs, never the canvas engine’s state, so a text diff of two files shows only real changes. writeWorkspace(workspace) writes {view, journal, sessions} with TimeToShare’s dumps in its json serialization; Save and the autosave write writeWorkspace(store.snapshot()). A journal entry is exactly {command, author, time} or {session, author, time}, and a session exactly {target, entries}, or {target, kind, entries} with kind "flow" for a flow-control editor’s, whose target alone would name the timeline editor (any other kind is refused with invalid_value, “a session states only the kind flow”; the version stays 8, every other session being written as before), so sessions nest; every session is reached exactly once from the journal (unknown_session, unreferenced_session, session_referenced_twice), and one without entries is refused with invalid_value. readWorkspace(text) reads the file with TimeToShare’s lossless parseJson and returns the Workspace or a LoadError listing every problem at its path in the file; a file of another format or of a newer version (such as “workspace version 9 is not supported; this editor reads version 8 only”) is refused for that alone, and so is a file of an older version, written before the journal carried the IDs its commands minted: “workspace version 7 was written before IDs were journaled and must be imported again: import its manifests into a new workspace”. name and arrangement are the members a file may leave out: a file without a name holds a workspace named untitled, and an empty or non-string name is refused with invalid_value; the workspace’s arrangement and every block’s, written after its places, are written only where there is one, so a file without arrangements keeps its bytes, and a stated null is read as none. There is no migration. writeWorkspace(readWorkspace(text)) returns the text it read, byte for byte, for a file that states its name. A block’s manifest is a TimeToShare manifest that timetoalign reads with AlignmentBundle.from_dict, or with Timeline.from_dict or TimelineGroup.from_dict when it holds one root or one group.
Autosave#
The editor keeps the last text of a workspace in the browser’s IndexedDB, in the slot its storage option names (decisions/0018). Every change is written one second after the last, and a pending write is made at once when the page is hidden or the editor is destroyed; the text is writeWorkspace’s, deferred to the write so the command path never serializes. Beside the text the slot holds the name of the workspace’s file and its path on the server or, where the browser can store it, the file’s handle, so a restored workspace is saved back into its file. One editor at a time writes a slot, holding the Web Lock tilie-autosave/<slot>; a second one shows “Autosave of this workspace is active elsewhere, so changes here are not autosaved.” When the editor opens and the slot holds anything but an empty new workspace, it asks “Restore the unsaved workspace from …?”, with the time of the workspace’s last journal entry; Restore opens it under its file’s name, with the file’s path or handle where one was kept, marked unsaved, and Discard empties the slot. A saved text whose journal is refused shows “The autosaved workspace cannot be restored.” with its problem. A failing autosave is reported once, in a message, as an AutosaveError whose code is indexeddb_unavailable or indexeddb_failed, and editing goes on.
Layout and writers#
The drawing of a manifest is specified in the schema repository, not here: TimeToShare’s drawing specification defines the graphical object, arithmetic, default styles, font, layout, element descriptors, page, and SVG and TikZ profiles completely enough that another implementation writes the same text byte for byte. The specification, together with the SVG and TikZ fixtures of a schema version, pins the drawing; there is no drawing schema, and a drawing’s JSON form is internal.
The drawing#
@timetoalign/tilie-layout exports draw(manifest, placement, layers, metrics), a pure deterministic function implementing sections 1 to 8 of the specification for every manifest. The placement supplies the graphical length of every item without one of its own, the block’s spacing (the gap between its items at their default y) and margin (the empty space above its first item and below its last), the requested block size and the stated places; the layers are the ordered Graphical objects of the cascade, from lowest to highest precedence: the specification’s defaults, the workspace’s graphical, and the manifest’s own; the metrics are the one advance-width table of the two bundled drawing fonts, DejaVu Sans and Noto Music. The returned Drawing holds:
width,heightandorigin, the block-local position of the place origin(Ox, Oy);elements, every drawn element in descriptor order;boxes, every container as aDrawnBox, the block first, then in drawing order: itskind, where its place lies inplaces, itsaddress, where its holder’s place lies (nullfor the block and what the block holds directly), its rectangle in the drawing’s coordinates,displayed(whether its own rectangle is drawn: always for the block, never for a band),ancestor {group, member, groups}for an ancestor card, andrange, the half-open range ofelementsit emitted (a frame or card its own rectangle when displayed, then everything drawn as part of it; a band none). An item carries its place with the defaults applied and as stated; a card its drawn size before the scale, its spacing (the gap between its rows and between its bands: a member’s card’s own, a block-held card’s its item’s, else 4), its margin (likewise, else 0), itscontentCount, how many contents it holds (its root’s row, its root’s present bands and its ancestor bands, one on each side holding an ancestor line) and its statedwidth,height,spacingandmargin; a band its timeline, facet, signed level (1, 2, … above its timeline’s line, −1, −2, … below), the number of displayed elements it holds directly, andline, the ordinate of its timeline’s line, which tells apart the records of a timeline drawn twice. Only a band that draws an element is recorded, on a timeline whose line is displayed;axes, oneDrawnAxisper line drawn, or, on a card whose axis has gaps, one per run of the line between them (the stretches drawn at full scale),run(the run’s number from 0) set from the second run on, the runs of a line sharing its address, andlineAxeskeying the later ones with#and the run’s number: the timeline’s address, the place key of thecardwhose member drawing draws it, itsline, the abscissasxStartandxEndof its semantic start and end (not of a circle, chevron or end mark; an ancestor line clipped to its member; the reach’s where the end is not known), itsunitandnumberType, the exact own-axis valuesstartandendthere (endnull where the length is not known), itssegmentswhen it is a segment line ({id, offset, length}on the segment line’s own axis, in canonical order, a length the end section 3.4 gives where the segment’s own is not known), itsmaps, the maps drawn at its line, its own and its segments’, in the order they are drawn ({id, owner, xs, xe, yc}: the map’s ID, the ID of the timeline it spans, the abscissas of its ends and the ordinate of its centre; none for an ancestor line), itsmark, on an ancestor line the wedge an editor shows at a position on it, at the abscissa 0 (AxisWedge: its tip ordinate, the corners of its base and its style), drawn as a named timestamp’s wedge on that line is, on the side of the line away from the member, in the style of a wedge held by the ancestor line that no named timestamp holds,nullon every other line,ancestor {group, member}on a line of an ancestor card, as itsDrawnBoxcarries it (the ancestor cards’ lines come after every item’s, so a timeline drawn in a card of an item has its first line there), and itsmarker(nullfor an ancestor line, which draws none): where a coordinate marker of the line lies at any abscissa: the wedge’s tip ordinate and the two corners of its base (WedgeCorner, defined inrotation.ts: an offset across from the tip and an ordinate) from where its markers band starts (or would start), the cross-section line’s extent and style (crossSection:span, the top and bottom ordinates of the card drawing the line, which every cross-section line of the line crosses,gap, the stretch of it that a line leaves where the wedge at the abscissa 0 and its label stack stand,nullwhere they leave none, and the style of one that no named timestamp holds), anddescendants, the IDs of the displayed descendants that line crosses; and the named timestamps the line holds (AxisTimestamp: its ID, the abscissa of its cross-section line, that line’s style,nullwhere itsdisplaydoes not list it, andsegment, the card’s top and bottom ordinates, the span its cross-section segment covers, gap included). The list holds primary coordinates only; secondary coordinates are drawn from core’scardStamps(below). The cross-section line of a named timestamp of a timelineTcrosses the whole card drawingT’s line, from its top border to its bottom border (ancestor lines and the other timelines of the card included), leaving a gap only where its own wedge and its label stack stand, so it is at most two pieces. One extent function serves both readers:crossSection(drawing, lineKey, x)gives those pieces ({x, y1, y2, style}[]) at the abscissax, none where the key names no line or an ancestor line, andcrossedLines(drawing, lineKey)the lines it crosses, as keys oflineAxes, the line’s own first, then its timeline’s displayed descendants with a line of their own in the same member drawing in traversal order (a segment without a line of its own lies on its segment line’s axis), so the line drawn and the timestamp read can never disagree.wedgeAt(drawing, lineKey, x)gives the wedge ({points, style}) a named timestamp of that line’s timeline would draw atx, turned by therotationa rule on the band’s wedges gives (never one naming addresses), and on an ancestor line itsmarkatx, so no rule naming an address changes it, andgroupCrossSections(drawing, lineKey, x)the pieces a groupstamp lying there would draw across the frame holding the line’s card, those ofgroupLinePieces(none for a card no frame holds); all three carry the style of one that no rule addresses, so the canvas marks an unnamed position with the drawing’s own geometry (wedgePointsingeometry.ts);lineAxes(drawing)(axes.ts) gives the axes to a hit test asLineAxisrecords (the place key of the card drawing it, start, length, segments, maps and, on a line of an ancestor card,ancestor), in the order ofaxes, keyed by the card’s place key text followed by the timeline’s address key, so a timeline drawn in two cards has two entries;elisions, oneElisionExposureper container that decides elisions, an ungrouped root’s card, a displayed ancestor card or a frame (Elisions): its kind, place key and address; its cascadedelision-modeand the mode it draws by (drawn,autoresolved); for an ancestor card the proportion its derived gaps take, whether it is computed (automatic), its member’s ancestors from the root (chain), the depths chosen of them and thedisplayof its derived gaps; its gaps from the left, each anExposedGap: the elision’s address, itsorigin(stored,defaultfor a derived gap,carriedfor a group elision’s gap in an ancestor card,arrangementfor a gap that a root drawn once behind a row cuts between two groups, which has a derived gap’s address; Arrangements), its timeline and elided coordinates, exact on that timeline’s own axis, its natural and drawn widths, its edges in block coordinates and, across a frame, its elided coordinates on every other timeline the member cards draw there (members, without a value where the group gives none); its runs (Run {u0, u1, L, D}, the stretches of proportions drawn at full scale, each with its own scaleLand shrinkD);x0, where its member drawings start, andplace, where its item lies, so that a proportionuof a run lies atx = place.x + place.scale × (x0 + L × u − D). An application reads every mode, proportion and gap there, never from a drawing tried with another rule;arrangement, only for an arranged block (DrawnArrangement, Arrangements): itsdirection, itsrow, the items in the order they are drawn in (forhorizontalthe row), itsroots, the roots drawn once from the top (none forvertical), andrefused, wherehorizontalis refused, the conflict (ArrangementConflict {groups, roots, reason}), the items then drawn one under another;unmapped, the code points neither bundled font maps, measured with the table’s fallback advance.
Every manifest is drawn the same way: a grey block that opens with the manifest’s title (its name, else its whole id; an anonymous bundle has none); each group a frame, a rounded rectangle holding the group’s title and its members’ cards one under the other in display order; each timeline drawn as a root in a card, an ungrouped root in one of its own and a member in one in the frame of each group that has it, a raised rounded rectangle with a shadow offset to the right and down. The block has one horizontal layout: every item starts its lines after one name column and ends them with one right margin, and the members of a group share their frame’s graphical length and scale. An item’s scale scales everything in it about its top left corner. Every container’s spacing is the gap between its own contents, finite and at least 0, and multiplies no other: the block’s between its items at their default y (8 by default), a frame’s between its cards (8), a card’s between its rows and between its bands (4). Beside it every container has a margin (0 by default, finite and at least 0, likewise its own): empty space inside its padding above its first content and below its last, the same above and below, which makes the container twice the margin higher and moves its contents down by the margin. The title lies at the block’s top left corner, above every item; an item placed higher grows the block upward. Within its card a timeline is drawn with its line and its five bands, stacked in its band order; each child is drawn whole in a row of its parent’s children band, and the children bands of the lines of one row are laid out together. They are aligned when every child they place has one band order: each child is then placed by its line extent alone (its line with the lines of its descendants), so it keeps its row whatever its labels, and the lines of that row lay out their bands together facet by facet, the bands of one facet at one level, from one start and as wide as the widest, the markers stacks, the regions with their label tiers and the segment labels each placed by one first fit over the whole row (children.ts, rows.ts); children bands that are not aligned place each child by its whole extent, its labels included, found from its subtree laid out alone, before its parent’s band is fitted. The defaults show the regions band of every timeline, a child’s included, but hide a region typed as an atomic section: a selector’s class also matches the classes a region’s type statement names (core’s regionClasses), and the default layer hides {element: region, class: "tts:AtomicSection"}. A region or a child keeps its row whatever its label’s width: a label that does not fit beside its neighbour moves to a further label tier of its row and is joined to the middle of its element by a thin grey leader line (fit.ts, tieredFit, one rule for region labels, segment labels and the labels of flow control). Flow control holds across a root’s whole tree, so only the root of a member drawing draws a flow control band, and it draws the flow-control elements of the root and of every descendant, each at its position on the root’s axis; each element stays, for the cascade, in the flow control band of the timeline that states it, so hiding a child’s line or flow control band hides that child’s elements, and hiding the root’s flow control band hides the flow control of its whole tree in that card, the band being then absent. A member that is a child timeline draws in its card’s band the elements of its top-level root’s tree lying on its stretch, [0, λ] of its own axis (core’s memberFlow), and an arc there only where its target lies on that stretch too. The flow control band (layout/flow.ts, sections 6.4 and 6.6) holds, from its start outwards: the flow label tiers, each element’s stack (the labels its cascaded label-display lists of its name, its ID and its own label, initially name label, so that naming an element shows its name) placed by first fit; the flow row, where the flow lines end; the symbol row, 2 beyond the flow row so that no glyph meets a line, each element’s symbol centred at its position (core’s flowSymbols: the Noto Music glyph of its manifestation, a jump’s destinations’ glyphs side by side, 𝄂 for a section break, the text “Fine” for a fine break); the fork row, one volta fork per jump with volta destinations, of one size whatever the scale: a stem into the jump’s position, then one arrow per such destination in the order of their places, the first straight on and the k-th of N bent away from the line by min(35°, 70°/(N − 1)) × (k − 1), each with its passes printed beside its tip (core’s passesText); and the jump rows of the arcs, one per destination whose distance is not 0 and that is no volta destination, labelled with that destination’s label alone. The defaults hide the arcs (jump display: none) and show the symbols, the forks and the flow lines: a break red and dotted, a section break dark blue-grey and dashed with its 𝄂, a barline dark grey, each a vertical line from the flow row across the card. Symbols, forks and leaders are element types of their own (symbol, fork, leader), addressed by the part words of the same names. draw takes the reading in force of flow control (FlowReading or null; the editor passes its user’s, readingOf): an element it does not read is drawn faded, everything it draws with it, and keeps its place in the rows; a section break it does not read starts no section, and a to naming a jump target it does not read is no place, so no arc or branch goes there. Without a reading, these are the elements some actor believes false, the rejected ones. No root draws a mark of its start or end. A named timestamp is drawn by its timeline, at any depth, as its display lists: a wedge in that timeline’s markers band; up to three labels stacked outward beside the wedge, its name, its ID and its coordinate with its unit, in that order (core’s TIMESTAMP_LABELS), each a label element; and a dashed light-blue cross-section line held by its timeline’s line across the whole card drawing it, from the card’s top border to its bottom border, cut only where its own wedge and label stack stand, so hiding the markers band keeps the line; a timeline drawn in several cards draws its timestamps in each. A timestamp named on a child or on an ancestor is drawn the same way: its timeline decides only where its primary coordinate’s wedge and labels stand. A secondary coordinate of a named timestamp (a coordinate on another timeline of the card it crosses: the timeline’s own, its ancestors’ and its descendants’ among them) is drawn as the primary one is, by the wedge and labels its display lists, in that timeline’s markers band or beside its ancestor line, its coordinate label written in that timeline’s number type; the default rules hide every element of one and turn its wedge −45, and a rule selecting coordinates: secondary shows them (core’s cardStamps lists them per card and timeline, CardStamps.secondaries; layout’s markers.ts and ancestors.ts read that one list, so a hidden one takes no room). A wedge turns about its tip by its style’s rotation (Style.rotation, section 6.6), a whole number of degrees from −180 to 180 that rules set and that is never inherited, mirrored with the side of the line its band lies on; where no rule sets it, every wedge turns 0, a groupstamp’s included; a turned wedge carries its stack of labels along its own axis, and the stack’s place and the gap it leaves in the cross-section line follow from the rotation (stacks.ts). MarkerElement carries the tip and the two corners of the base (corners), which rotation.ts computes from the sine and cosine of the rotation, each rounded to four decimal places from one table of the sines of 0 to 90 degrees (sineCosine, wedgeCorners), so every unturned wedge keeps its exact numbers; a turned wedge widens its timeline’s extent to its farthest corner (wedgeSpan). A groupstamp, a named timestamp with groupstamp: true on a group’s member, draws after every item, before the alignment anchors, one dashed line per frame holding a card that draws its timestamp, at its abscissa, from the upper border of the frame’s topmost member card to the lower border of its bottommost, less the card its own cross-section line crosses (groupstamps.ts: frameMemberLines, the one statement of a frame’s member lines; groupSpans; groupstampElements); each piece is a cross_section at the timestamp’s line address {id, part: ["line"]} in that line’s style, and takes no room. The other members’ coordinates derive from the group and are never stored; on each member card the line crosses they are the timestamp’s secondary coordinates, which a rule showing coordinates: secondary draws with their wedges and labels. A group reads a position across its members by the proportion of their drawn lengths, and only where both lengths are known: over the card of a member of unknown length the group gives no coordinate, so that piece of the line is drawn faded (groupLinePieces, the one rule of the frame’s line: the pieces of the frame spans cut at the borders of such cards, each in the line’s style or, over such a card, with the opacity 0.35 in place of the one cascaded; whole and faded where the timestamp’s own member is of unknown length), the secondary wedge there is faded and has no coordinate label, and a coordinate listed for it has no value. A match timestamp draws, by default, its cross-section line alone, and no name label without a name. Each alignment anchor of a named MatchStamp is drawn after every item and takes no room (anchors.ts, section 8.7): where its display lists line, the shortest line between the cross-section lines of its two match timestamps, never one drawn in an ancestor card (section 8.8; timestampSegments) (horizontal at the middle of their vertical overlap where they overlap, else between their nearer ends), the element alignment_anchor {id: A} held by the block; where it lists name, the MatchStamp’s name centred on that line’s midpoint, a label {id: A, part: ["name"]} held by the line. Core’s manifestElements lists them after every item, after one cross_section per groupstamp and frame holding it (held by the frame), so a style rule addresses each as any other element. A segment line draws its segments on its own line, separated by boundaries. A top-level timeline ends with an arrowhead (open for a segment line) or a filled circle when locked; a child ends with an open diamond. A root of unknown length is scaled to its reach, the farthest coordinate its content reaches, and a line whose end is open runs on into three chevrons. A member that is a child also draws its ancestors beside its line as ancestor lines, each on the side opposite to where the ancestor’s own band order puts its children band (below the member by default), in the outermost band of that side, its ancestor band, clipped to the member, running on into a double chevron where the ancestor reaches beyond it; a named timestamp of an ancestor whose position lies within the member’s span, its ends included, and a secondary coordinate on that ancestor’s line are drawn beside the ancestor line, the timestamp at full opacity and a secondary coordinate faded as the line is; an ancestor line draws no mark of the member’s start or end, which the member’s origin and length groupstamps show instead (Commands); unless a rule hides it, its root is drawn whole as an ancestor card behind the group’s frame, after the title and before the first frame (block/ancestors.ts, section 8.8; The container hierarchy). display: none removes an element from the drawing and its layout; section 2.4 states every way a hidden element hides others. A manifest without timelines or groups, such as one holding only the statements about a work, is imported like any other and draws its block with its title alone; links are never drawn.
Elisions#
Elisions are drawn as the specification’s sections 3.2, 6.6 and 8.9 state, by elisions.ts with block/ancestors.ts and block/places.ts:
Card and group elisions. Whether an elision is a group elision is read from its timeline and never stored. One whose timeline lies in a group (the timeline, a virtual timeline included, or one of its ancestors is a member: core’s
groupsHoldingovermemberAncestry, as for a groupstamp) belongs to that group’s frame, to each frame where the timeline lies in several groups; every other one is a card elision of its timeline’s root, drawn in the cards that draw that root whole, the root’s own card where it is ungrouped and its ancestor cards, never in a member’s card; an elision on a virtual timeline that no group holds is a card elision of its placed card, the root it is drawn as (Virtual and switched cards). Core lists them without drawing anything:elisionsOn(manifest, T)the stored elisions on a timeline,elisionsUnder(manifest, R)the card elisions of a root’s tree, or those on a virtual timeline that no group holds,groupElisions(manifest, G)a group’s, those on its virtual members included.Modes are style properties (decisions/0035). Four properties of the cascade, never inherited, decide what a container draws:
elision-mode(auto,full,proportionalorcustom), read by a card, an ancestor card and a frame, and, read by a card and an ancestor card,elision-proportion(auto, or a number above 0 and at most 1),elision-depths(auto, or the depths chosen) andelision-display(what every derived gap shows, initiallyellipsis name). Every card of a rootRcarries the address{id: R, part: ["card"]}, so one rule there sets the mode of all of them, beside thedisplaythat hides its ancestor cards; a frame’s rule is addressed{id: G}.fulldraws no card elision,customthe stored ones,proportionalthe gaps an ancestor card derives, andautothe stored ones where the root’s tree holds any and the derived ones otherwise. A group elision never counts and is never switched by a card’s mode; a frame draws its group elisions underautoandcustom, none underfullandproportional.Derived gaps. An ancestor card drawing
proportionalderives gaps where it lies outside its member’s span, its protected span: on the root and on each ancestor of the member down to its parent with its siblings, one depth each, on the depths chosen, deepest first, each stretch one piece whose middle is left out, its elided coordinates rounded outwards to whole units and its two ends kept at full scale. The pieces are drawn at the proportionrof their natural widths: the stated one, or, forauto, the largest at which they fit beside the member’s drawn line and the card fits in the view centred on the frame (ancestorProportion), the one value of a drawing that reads the placement’sview. A derived gap has no ID; its address is{id: T, part: ["elision"]}on its timelineT.The elided axis. A container that draws gaps has an axis linear run by run (
CardAxis, one builder for cards and frames): each piece of a stored elision is one gap, of its natural width or of the width itswidthgives (widthAswrites a drawn width in each stored form exactly), a piece clipped where an earlier elision or the protected span took the stretch, and a stored elision not drawn takes nothing. A group elision’s stretch lies over proportions of its member’s length, so its gap lies at one x in every member card, and the frame is drawn shorter by the sum of its gaps’ shrinks; each ancestor card behind the frame carries those gaps over its protected span with the frame’s widths (carriedGaps), exact on an exact axis of the root. An ancestor card’s axis also has two seams, where its member’s span meets the frame’s borders (frameRoom): jumps that leave nothing out and draw nothing, a row crossing one drawn whole, so that what lies outside the member’s span is drawn outside the frame; a root drawn once behind a row of groups side by side has more, between its groups (Arrangements). A member card’s ancestor rows lie at the heights of the same rows in its ancestor card (alignedRows).What a gap draws. Every row crossing a gap stops at its edge and resumes after it (
cutson lines, maps and region braces). The gap itself is anelisionelement, an invisible extent from the card’s top border to its bottom border, or across the frame’s member cards, which a rule may fill; it holds exactly oneellipsis, centred in the gap and on the card or the member cards together, its continuations where itsdisplaylistscontinuation, and its labels, name, ID and elided coordinates, centred below the ellipsis. The labels’ room is a first-fit stack in the markers band of the elision’s timeline, after the named timestamps’ stacks, so labels shown may move rows; where the labels of neighbouring gaps would touch or overlap, a stack takes the next tier of the band, as a named timestamp’s labels do, and a gap never widens and no proportion changes for a label. A carried gap draws its ellipsis and no label.
Arrangements#
An arrangement places a block’s items, its groups’ frames and its ungrouped roots’ cards, in an order instead of at their places, as the specification’s sections 1, 8.5, 8.6 and 8.8 (Drawn once) state. It is a member of the placement, Placement.arrangement, beside places: it says where the drawing puts things and is never part of the manifest, so the block stores it (Block.arrangement) and any program passing the same placement draws the same (decisions/0036). An arranged item takes no x and no y from places, which keeps them for when the block is free again; every other member of its place applies.
The item order is core’s
itemOrder(manifest, order): the items the stored order names, each at its first mention, an ID naming no item passed over, then every item it leaves out, in drawing order.verticallays the items out one under another in that order, each at its defaultxandy(placeItemsgiven the order), their ancestor cards behind them as in a free block, recorded and written in the same order.Side by side, core decides what stands where (
manifest/arrangement.ts, exported from/drawing). A group hangs on a root when one of its members lies inside that root, a child or deeper; its first such member in its display order is its anchor there, the member its ancestor card is aligned to, and the anchor’s stretch runs on the root’s axis from its start, the offsets down to it summed, to its end as drawn (section 3.4), exact (anchorsOf). Along every root the stretches of the groups hanging on it follow the row from left to right without overlapping, touching allowed, and in every group the anchors lie in the top-to-bottom order of their roots.rowOf(manifest, order)gives theRow {row, roots, anchors}, the row keeping the given order wherever the stretches leave it free and the roots following by ID where no group orders them, or theArrangementConflict {groups, roots, reason}: two stretches overlapping on a root, the row in a cycle, or the roots in a cycle, worded as the specification words them ("Theme A" and "Theme B" overlap on "Score" (8–16 ♩),"G" holds "R" above "S", "H" holds "S" above "R"). An ungrouped root, or a group no member of which lies inside a root, hangs on nothing and keeps its place in the order.anchorChange(manifest, group, order)says why a display order would give a group another anchor (Arrangements on the canvas).The row (
block/arrangement.ts,rowLayout): the items packed from the left in the row, the row gapmax(S, 48)apart (Sthe block’s spacing; the standard gap and 8 on either side of it), each as wide as it is drawn. Every root a group hangs on is drawn once, by its ancestor card behind the first group of the row hanging on it, the once card, whoseDrawnBox.ancestor.groupslists every group hanging on it; that root’s ancestor cards behind the other groups draw nothing and are not recorded. The roots lie one under another, their cards never overlapping, each line low enough that every group can lie on all of its roots: in a group anchoring on several roots, each later anchor’s card is moved down, the gap above it grown, until it lies on its root’s line, no card changing its size. The highest frame or once card lies where the first item would; an item hanging on nothing stands at the row’s top. A once card that a rule hides draws nothing and keeps its place, so hiding it moves nothing.Runs, gaps and seams. A once card’s line is drawn in runs, over each anchor’s stretch at the scale of that anchor’s frame, the run continuing to either side of the stretch. Between two anchors next to each other along the root, the scale changes in the room right of the left anchor’s frame: in a gap of origin
arrangementwhere whole units of the root’s axis fit there, at least the standard 32 wide, its elided coordinates rounded outwards to whole units, drawn as every gap is with the card’selision-displayand addressed as a derived gap{id: R, part: ["elision"]}; else at a seam (PlacedSeam), a jump of the axis that leaves out nothing, has no address, draws nothing and is listed in no exposure, across which a row crossing it is drawn whole. A timeline starting at a seam starts on the run right of it, one ending there ends on the run left of it. Left of the first stretch and right of the last, the card draws the elisions its mode gives, as the ancestor cards behind the first and the last group would, at the least proportion of the root’s ancestor cards behind every group hanging on it; between the first stretch and the last only the arrangement’s gaps are drawn, and stored card elisions lying there are kept and not drawn. On an exact axis of the root every position is exact.Refusal. Where
rowOfrefuses the row, the block is drawnverticalin the item order, and the drawing states the conflict (Drawing.arrangement.refused); nothing else refuses an arrangement.
Packing is one function, layout’s packed(sizes, {direction, gap, start, columns?}) (arrangement.ts): vertical left-aligned, each content gap below the one before; horizontal top-aligned, each gap right of the one before; matrix row by row in columns columns, each column as wide as its widest content and each row as high as its highest, each content at its cell’s top left. The row of a block is packed with it, and so are the blocks of an arranged canvas (Arrangements on the canvas).
Virtual and switched cards#
Section 8.10 of the drawing specification draws FlowMaps in two ways, both drawing and both exported (FlowMaps and virtual timelines).
A virtual card draws a virtual timeline (layout/virtual.ts). drawnRoots(manifest, places) adds to the roots drawn the virtual members of every frame, in its display order (core’s withVirtualMembers), and the placed virtual timelines, in no group and named by places, by ID after the ungrouped roots; each is drawn as the locked root core reads it as (virtualDrawing, its line opening with the start circle and, its end fixed by its map, ending in the end circle of a locked root), named with the suffix · unfolded from <timeline> ( · converted from <timeline> for a conversion map; cardName), with no children, conversion maps or flow control band and no ancestors. Its FlowMap’s chunks (flowOf, through core’s resolveFlowMap and its runs, carried on the scope as Scope.flow, a DrawnFlow of DrawnChunks) come first in its regions band: each chunk a brace {id: V, facet: "regions", part: [k]} over its played span with the region defaults, labelled by its source’s name, else its whole ID; a gap no brace, only its label, the pretty text of its stated length; a run of n consecutive chunks of one source drawn once, labelled × n, in a block-held card only (a frame draws each chunk). Its line carries a boundary [k, "start"] at the start of every drawn chunk but the first, and a gap line over each gap (LineElement.gapLines), stroked in the grey #9CA3AF (layout’s GAP_LINE_STROKE, the grey of an elision’s continuations and of leaders) with the line’s own stroke-width, stroke-dasharray and opacity, so solid on a continuous line and dotted on a discrete one, the line’s stroke never reaching it, which the writers write after the line’s pieces and before its marks. A run drawn once leaves a run gap [a, b] of drawn width 0 (withRuns, CardAxis.runGaps): a proportion u at or after b lies at x(a) + (L × u − L × ub), so x(b) = x(a) exactly, and the line ends D short of x0 + L; the run gap is no elision, draws nothing and cuts no row, and the axes leave it out as they leave out an elision’s gap (block/axes.ts), so a line drawn with a run once has one DrawnAxis per run. A placed virtual card that no group holds draws the elisions stored on its virtual timeline as card elisions on its played axis (Elisions): with run gaps its axis is runAxisOf’s, a proportion u at or after a run gap [a, b] lying at x(a) + (L × u − L × ub − D), D the shrinks of the elision gaps between the run gap’s end and u (0 without elisions), and an elision lying wholly in a run gap draws no gap (storedPieces takes the run gaps as already taken); an elision’s name label reads the virtual timeline’s own name, without the card’s suffix. An elision on a virtual member of a group is a group elision of each frame holding it, drawn across the frame on that member’s played axis and carried to every other member’s, as any group elision. A virtual timeline that does not resolve (a FlowMapError, a stated through, a timeline other than its FlowMap’s root) draws its line alone.
A switched card draws a root T on the played axis of the FlowMap its flow names (core’s switchOf; Commands), named T · <name of what flow names>, locked, from 0 to Λ. traversal.ts gives the root entry one piece entry per stretch piece (rootPieces, from core’s unfoldingOf), each holding T’s children clipped to the piece (Entry.written, piece, startCut, endCut), and the scope maps positions through Scope.unfolding, at, over and play, the identity on a card drawn as written. The line draws the chunks as a virtual card does, addressed with T’s ID; regions, children and named timestamps are drawn at each of their played positions (core’s playedAt, playedSpan), a coordinate label writing the written value; a segment cut at a piece’s start draws no boundary there and a child line cut at a piece’s end no mark; a row names a timeline once (names.ts lineNames). The card keeps the band configuration of the card drawn as written, every band displayed or hidden and ordered as there: a conversion map is drawn once per piece over its timeline’s extent, clipped (maps.ts); a flow-control element, with its flow line, symbol, fork and stack, at every played position of its coordinate (flow.ts gathered, through playedAt), an arc only in a piece holding both its from and its to, a jump elsewhere drawing its symbol, fork and stack without an arc; a segment boundary at every played position of its start, a piece’s closed end included (line.ts unfoldedBoundaries); and no elision on any timeline of T’s tree. In a frame where exactly one member’s card is switched, every other member is carried onto that axis through the group (t = m × λT / λM, exact, else binary64 with the product first) and drawn once per piece (line.ts drawnEntries; a virtual member’s chunks unfolded, chunkSpans), a child member’s ancestor lines too, each once per piece it reaches (ancestors.ts, AncestorPiece), its chevrons and end marks only at its real ends, its timestamps and the flow control of its root’s tree at every played position; the frame draws no group elision, and two switched members leave it drawn as written. block/axes.ts unfoldedAxes gives one DrawnAxis per drawn piece (run numbering the later ones), read from MemberDrawn.entries, MemberDrawn.ancestorAxes and LineMarker.entry, each named timestamp on the first piece reaching it; an unfolded axis carries no segments and no maps. Layout’s switched.ts holds only unfoldedRoot, the root the switched card draws; every rule of what is switched and where a position is played is core’s.
The pipeline#
draw (block.ts) orchestrates four stages over one item model, in which a frame with its cards and a block-held card (a frame-less item with one card) take one code path: the places of every item, stated or default, and the block’s place origin (block/places.ts); the block’s one horizontal layout over all its items (block/horizontal.ts); each item laid out in its own coordinates (block/items.ts); and the shift into the block with the Drawing’s records (block/emit.ts, with the axes from block/axes.ts). A member drawing (member.ts) takes one timeline as the root: traversal.ts walks its timelines once into an index of children by parent and sources by line, fixes the axis (the length, or the reach, memoized per drawing) and every timeline’s end; timeline.ts lays out every line with its bands, one module per kind of band filling them (markers.ts, maps.ts, children.ts, regions.ts, flow.ts); rotation.ts turns a wedge’s corners; stacks.ts places the label stacks carried by turned wedges and the gaps they leave in cross-section lines (markers band and ancestor lines share it); groupstamps.ts draws the groupstamps’ lines across their frames from the drawn lines and boxes, after every item, its groupLinePieces the one rule of a frame line’s pieces (shared with the hovered and pinned marks, groupCrossSections); slots.ts (rowSlots) gives, after the first fits and from the rows alone, the conversion maps bands of every row that are laid out together their shared slots, which mapSlots (maps.ts) finds by key and first fit; rows.ts lays out the rows of children bands at every depth, ancestors.ts the ancestor lines, and block/ancestors.ts the displayed ancestor cards behind their frames; elisions.ts decides the elisions of every card and frame and draws their gaps; block/arrangement.ts lays out a block arranged side by side, its once cards included, over layout’s one packing function (arrangement.ts). Line ends, chevrons, the brace and every element’s bounds are geometry.ts’s, which the writers share. The style cascade (Cascade, INITIAL_STYLE, DEFAULT_LAYER) decides each property per element by the specification’s layer order and rule rank, the rules bucketed by the selector members that discriminate them; text widths come from the advances of the fonts’ one metrics table, measured once per distinct text. Layout knows nothing about a page.
The writers#
@timetoalign/tilie-writers exports toDescriptors(drawing), writeSvg(placed) and writeTikz(placed, options). toDescriptors returns the ordered SVG-shaped descriptors that the canvas and both writers share; every descriptor carries its source: the index of the drawn element it renders, that element’s type and address, and its role (primary, or shadow for a card’s shadow). placed is a list of {drawing, x, y, scale}; the writers find the bounding box of all placed drawings, add a margin of 16 on every side, translate each drawing to the page and apply its scale. writeSvg returns one SVG page; writeTikz a complete LuaLaTeX document, or with standalone: false the tikzpicture alone, fontDirectory naming the directory of DejaVuSans.ttf and NotoMusic-Regular.ttf, the second a luaotfload fallback of the sans font for every code point DejaVu Sans does not map and Noto Music does; the SVG’s font-family is DejaVu Sans, Noto Music. Both round the exact value of every double to four decimal places, ties to even.
pnpm -C app/packages/writers review, from the repository root, draws every manifest fixture of the installed schema version (not the minimal twins nor the corpus ones), the resize and place cases and the manifests whose application layer shows a band the defaults hide, which are TimeToShare’s drawing fixtures, and writes SVG and PNG files plus index.html under app/packages/writers/review/, rasterized with rsvg-convert --zoom 2 under a fontconfig that exposes only the two bundled fonts (decisions/0017). emit-drawings writes those fixtures into a TimeToShare checkout and never rewrites the hand-derived figures. draw draws any manifest file to SVG and TikZ the same way (AGENTS.md). The application exposes no PNG, JPG, PDF or .drawio export.
The canvas#
@timetoalign/tilie-arranger builds the canvas on Svelte Flow (@xyflow/svelte), which supplies pan and zoom, node dragging, the selection rectangle, keyboard focus and culling (decisions/0020). It has two levels: at the workspace level, the arranger, blocks are placed freely; inside a block, its groups and timelines are arranged in editors, modes of the same canvas. The drawing comes from the manifest, never from an editable drawing surface: a person edits the manifest through commands, never by dragging an arrow endpoint, so a musical relation keeps its meaning whatever the display. Every rule is plain TypeScript tested without a browser; the Svelte components connect those rules to Svelte Flow.
One node per block#
project returns one Svelte Flow node per block, in index order. A node’s id is the block id; its position is the block’s x and y, the canvas position of the drawing’s place origin, less the drawing’s origin times the scale (nodePosition), so a drawing that grows left or up moves nothing else; while the workspace arranges its blocks, the place their packing gives it instead (blockPlaces, Arrangements on the canvas). Its width and height are the drawing’s width and height times the scale, given again as measured with handles: [], so Svelte Flow never measures a node; one it had to measure would be mounted even outside the view. selected follows the selection, zIndex is the block’s rank by index, and data carries the block, its drawing and descriptors, its selected elements, the elements a Delete would take with them, the open editor and the addresses inside the edited element. With an editor open, every other node is neither selectable nor draggable and carries tilie-outside. A node whose inputs are unchanged is returned as the same object, so a change to one block re-renders one node.
drawingOf(block, graphical, metrics, overrides?, pane?) draws a block, its arrangement included, with the layers DEFAULT_LAYER, the workspace’s graphical and the manifest’s own, for the pane of the canvas showing it, the placement’s view, which only the automatic proportion of an ancestor card’s elisions reads, so the pane is read only for a manifest that draws an ancestor card (Elisions). Each canvas has its own pane (Pane, pane.ts, the Canvas’s pane prop): its size left of the inspector drawer, the first size measured taken at once and every later one PANE_SETTLE (150 ms) after the last, so dragging the window or the drawer redraws once, when it stops; until the canvas is measured a drawing takes layout’s default view. Every drawing a canvas shows, and every drawing its gestures and keys read, is drawn at its pane. Drawings are memoized per block object and recomputed only when the workspace’s graphical, the metrics or that pane change identity, descriptors per drawing. A drawing is also kept by its manifest and the values of its placement, the 32 placements of a manifest drawn last, so a resize, which measures the block at many placements on every pointer move, and the preview’s block, which draws one of them again, draw each placement once. Neither is stored.
BlockNode renders the descriptors as Svelte elements inside one <svg> per node, whose viewBox is the drawing’s block; every attribute is the text the SVG writer writes, so the node’s element tree equals the exported SVG’s. Text is rendered as text, never parsed as markup. Every drawn element carries its address as the SVG writer writes it, data-id, data-facet and data-part (the part words joined by one space), each only where the address has that member; the writers’ ADDRESS_ATTRIBUTES is the one list of these attributes. The drawings use the DejaVu Sans and Noto Music files bundled by TimeToShare as two faces, “TiLiE DejaVu Sans” and “TiLiE Noto Music”, named in that order in the drawings’ font family, with no unicode-range, so that a code point DejaVu Sans does not map falls back to Noto Music; the canvas is mounted once both faces have loaded.
Marks. The node draws marks after the drawing, never part of it, its descriptors or an export, and never stored. Every mark is one overlay element in one vocabulary: .tilie-mark, its kind in data-mark (selection, hover or holding), the element address it marks, without its block, in data-marks as its addressKey ({} for the block), and the kind of box in data-box (block, frame, card or band; none for a boundary’s line). A box’s mark copies the outline of its own rectangle (a card’s, not its shadow’s). The last drawn card or frame under the pointer inside the edited element is hovered, the block itself never, a segment boundary under the pointer is hovered in the accent colour, and, in every view, the band under the pointer, marked data-box="band" (bandUnder: in a timeline editor the band hit, which is what a click selects; elsewhere the last band record holding the point among the bands of the card under the pointer, so a child’s band before its parent’s children band, marked only on that card of its timeline, Hover.bandHolder, and only where a press there lies inside the edited element), so that what a double-click opens is seen before it; a drawn element under the pointer is hit before any band and marks none; a selected box shows its selection mark and no hover mark. A hover change adds or removes one mark and touches no drawn element. Every other selected element carries data-selected. Every box shows a holding mark whenever the selection holds an element drawn as part of it other than itself, read from the boxes’ ranges, never from where a box lies: 3 px dashed on a card, 2 px dashed on a frame, 1 px dotted on the block, whose node also carries data-contains-selection, measured on screen. In a timeline editor the selected bands of the edited timeline are marked the same way (data-box="band"). Stroke widths are divided by the zoom.
The box reader. boxes.ts is the one reader of Drawing.boxes and of the descriptors’ sources. A press, a hover and Enter are classified from the drawing: a press reads the hit element’s source, a CanvasSource (a descriptor’s source, or an AffordanceSource {kind: "affordance", address} of a named timestamp the drawing draws nothing of, told apart by isAffordance), never the DOM target’s form, and Enter takes its target from the drawing by address. It decides what a press hits (a box, a band or another drawn element), what it selects (pressSelection), what is hover-marked, and which boxes hold part of the selection; while an editor is open, only what lies inside the edited element. Which editor a double-click opens is decided from the same hit.
Levels and permissions#
One table in code, LEVELS, holds every rule of each level: move, nudge (the arrow keys, on the arranger only), reorder, bands, marquee, itemsFree, frameWidthPinned, remove, order, open, lock and resize. rulesOf(editing, {locked, readonly, arranged}) is the one answer to whether something may run: a locked canvas turns off move, nudge, bands and resize and keeps the rest; a read-only canvas turns off everything that writes, opening an editor included, and still selects, pans and zooms. Where the level’s contents are arranged (arrangedOf(view, editing): on the arranger the workspace’s arrangement, a matrix with its columns; in a bundle editor the edited block’s, a horizontal one the rules refuse read as vertical, as it is drawn; none in a group or timeline editor), the rules carry it as arranged and turn move and nudge off, the arranged drag and keys taking their place; a locked or read-only canvas drops it, so the lock turns the arranged drag off as it turns moving off. How each kind of box resizes is a second table, RESIZING, keyed by kind with a variant for a card held by a frame, naming the levels where it resizes and what each mode writes (resizingOf(box)). From the two tables, fieldsOf(box, level) lists the place members a Properties field shows for a container at a level, in core’s place order, each with whose place it writes and whether the level edits it.
Level |
Moves |
Resizes |
Reorders |
Marquee selects |
|---|---|---|---|---|
Arranger |
blocks, unless arranged |
every block, frame and card |
blocks among their siblings (z-order, and the order an arrangement packs them in) |
blocks |
Bundle editor |
groups’ frames and ungrouped cards, freely, alone or with every other one in the selection, unless arranged |
the edited block and every frame and card in it |
its items, while arranged |
elements |
Group editor |
none |
the edited frame and its members’ cards; the frame keeps its width while its members fit in it and grows with them past it |
the member cards |
elements |
Timeline editor |
none |
the edited card, a root’s or a member’s; nothing for a child, which has no card |
the bands of the edited timeline |
elements |
Flow-control editor |
none (its pane composes FlowMaps, The flow-control editor) |
nothing |
nothing |
elements; nothing opens inside it |
In the arranger and the bundle editor items lie freely (itemsFree) unless they are arranged: an edit of one item’s place, by gesture or form, also states the drawn x and y of every other item that states none, the frame holding a resized member’s card excepted, so that nothing else moves. In the group and timeline editors an edit states only the places it changes, and an item below may follow it down, its container adapting.
The gesture engine#
Every drag inside a drawing (moving an item, reordering a frame’s cards, moving a band) and every resize handle is one engine, pointerGesture(strategy, options), an attachment driven by a strategy: item, arranged, held, band, resize or gap (gestures/). The strategy says whether it takes a press, what value the pointer stands for, how that value is previewed and which command stores it; the engine owns everything else once. A press the strategy takes marks its element nodrag nopan before Svelte Flow reads it, so neither a node drag nor a pan starts, on a mouse and a touch screen alike, and captures the pointer; a press it refuses is the canvas’s (a click, a pan, a marquee). A press released within 4 px (CLICK_DISTANCE, Svelte Flow’s paneClickDistance) is a click and selects; past it the gesture starts, selecting the dragged box unless it is an item in the selection in the bundle editor, and every move whose value differs is previewed; the release dispatches one command and withdraws the preview; the click a browser fires after a drag is swallowed. Escape and a cancelled pointer end a started gesture without a command. Every gesture’s preview is the command applied, the block drawn as drawingOf(preview(view, command)), and only that block’s node is replaced; the projection never runs again for a preview, and a gesture can never show what the release would not store. Blocks are dragged by Svelte Flow itself, snapped by the canvas (Numbers on the canvas).
The canvas reads the store through liveStore(store), the one reactive adapter, which the editor makes once per store and passes to the canvas, the inspector and its editing bar: each getter (view, editing, entries, listed, journal, sessions, changes, openings) reads the store again after every change it reports, so no component keeps a copy. Undo and redo are exact, because the canvas shows nothing between two commands that the next command does not store or discard. Each gesture is one command:
a drag of n blocks is one
setwith n changes{x, y}; a keyboard move (an arrow key one grid step, Shift and an arrow key eight) is oneset;a resize of a block, a frame or a card is one
set;a change of block order is one
setofindex; Delete is oneremove;in the bundle editor, a move of one item, or of every item in the selection by the same travel, is one
set;in the group editor, a drop of a member card is one
setof the group’sorder, or nothing when the order is unchanged;in the timeline editor, a move of a band, by drag or by key, is one
setof the timeline’sorder;a drag of a gap’s edge, or a step of it by key, is one
setof the elision (Elisions on the canvas);a choice of the Arrange menu is one
setof the workspace’s or the edited block’sarrangement; on an arranged canvas a drop or arrow key of a block is onesetof itsindex, and in the bundle editor of an arranged block a drop or arrow key of an item onesetof the block’sarrangement(Arrangements on the canvas).
Opening an editor, Done and Cancel are store operations, as undo and redo are, never commands. While a block, or a frame or card in it, is dragged or resized, the canvas reports the placement it previews (onlive), which the inspector’s fields follow.
Numbers on the canvas#
Canvas numbers are doubles, and the positions Svelte Flow reports carry binary noise. Before a number is stored it is quantized: a position to the grid when the workspace snaps to it, every other number (and every position without snapping) to 1/2048 unit, the units per em of the bundled fonts’ advance table, so that at an integral font size and scale every text-derived edge and plot origin is stored exactly. While blocks are dragged, Svelte Flow snaps them to the grid and the canvas aligns the dragged block horizontally: its left edge or plot origin moves onto the nearest left edge or plot origin of another block within 6 screen pixels, and a vertical guide is drawn there while the alignment holds; the other dragged blocks move by the same offset.
Resizing#
Every block, frame and card is resized the same way: a block, a frame, an ungrouped root’s card and a member’s card each offer three modes wherever their level resizes them.
Scale sets
scale: everything grows or shrinks with its proportions, text included. Only the four corner handles are offered; the new scale is the larger of the two axis ratios, never below 1/8.Box sets
widthandheight: the container changes and the content keeps its place at the top left. A request at or below the content’s own extent storesnull(a place’s member unstated), so the container follows the content when it grows.Stretch sets
lengthfrom the left and right handles,spacingfrom the top and bottom ones and both from a corner: along time lengths and distances stretch, vertically the gaps between the container’s contents grow or shrink, while markers, line widths and text keep their size. A container’s contents are a block’s items, a frame’s cards, and a card’s root row, its root’s present bands and its ancestor bands, one on each side holding an ancestor line. A container with exactly one content (a block of one item, a frame of one card, a card of its root’s row alone, without a present band or an ancestor band) has no gap, so its vertical Stretch sets itsmargininstead, the equal empty space above and below its contents, and leaves itsspacingas it is; with two or more contents, or none, it sets itsspacing. The arranger counts a container’s contents from the drawing’s records (verticalStretchOf), by one rule for the block and for every frame and card. The content grows in piecewise-linear steps, as the drawing specification derives them, so the values that put the dragged edge under the pointer are solved for numerically, each candidate value drawn once; the floors are 8 forlengthand 0 forspacingandmargin, and a value the search leaves where it was drawn is not stated. A container enlarged beyond its content keeps its proportion to the content while it stretches, and a request no larger than the content becomesnull.
In every mode the dragged edge ends under the pointer and the opposite edge stays put; a left or top handle also stores the new x or y. A block’s horizontal stretch scales every x, length and width its places state by the ratio of the lengths (blockStretchPlaces); its vertical stretch changes its spacing alone, or its margin alone when it holds one item, moving the items at their default y and keeping every stated y and height. A frame or card resizes by changing the block’s places (section 8.6). A frame or a block-held card: Scale sets its scale from a corner; Box its width and height from any of eight handles; Stretch its length and spacing (a frame’s the gap between its cards, a card’s between its rows and between its bands), or margin for a frame of one card or a card whose only content is its root’s row, every stated width or height of it and of the cards it holds following its content in proportion. A member’s card: Scale sets its group’s scale; a horizontal Stretch its group’s length, the stated widths of the frame and of every member’s card following; a vertical Stretch the card’s own spacing, or its own margin when it holds its root’s row alone, the stated heights of the card and its frame following; Box the card’s own width and height; as its frame decides where it lies, it scales from its bottom right corner and sizes from its right and bottom edges. In the group editor the frame keeps its width while its members fit in it: a horizontal Stretch of the members runs from the right only and states the frame’s width at its drawn width while the cards fit; past it the frame’s width is unstated and the frame grows with the cards. Sizes are in the item’s own coordinates, before its scale, quantized to 1/2048 unit.
When exactly one box that the level resizes is selected, a toolbar centred 10 px above it offers Scale, Box and Stretch, also the keys 1, 2 and 3; it is placed by the rule of Svelte Flow’s NodeToolbar (getNodeToolbarTransform) applied to the box, so it follows the box through every resize, pan and zoom. While boxes are moved, a block dragged by Svelte Flow or an item, a member card or a band dragged inside a drawing, the toolbar and its handles are not shown at all, and they come back at the bounds the move leaves, also when it stores nothing: the gesture strategies that move boxes say so (moves), and the canvas’s gesture slot reports it while such a gesture is under way. A resize through a handle and a move by keys hide nothing. The pressed button shows its mode’s handles. A card’s handles act on the card in the frame being worked in, the edited group’s or the frame of the card dragged; a selected card address that covers several cards (a member of several groups) with no such frame known offers none. The handles are the arranger’s own, since a box’s size during a resize is whatever its drawing measures at the previewed placement. The mode is the viewer’s own and stays when the selection changes.
Selection, marquee and deletion#
The selection is a set of addresses, {block} and {block, id?, facet?, part?}, compared as whole objects. It alone decides what the canvas shows as selected; Svelte Flow’s own flags are reset to it. A selected address is marked wherever it is drawn, so a timeline drawn both as an ancestor line and as a member is marked on both lines.
A click on a drawn element selects that element only. A press on a box selects that box: a card (or its shadow), a member’s or an ungrouped root’s, selects the timeline’s cards
{block, id: T, part: ["card"]}, marked in every frame that draws one (a root’s ancestor card selects the root’s cards the same way,isAncestorCard), a frame outside its cards the group, the block’s own area outside its frames and cards the block.In a timeline editor, a click on an offered band selects it,
{block, id: T, facet: F}; a selected band counts as its timeline’s line for the contains-selection marks, and a selection rectangle never selects a band.Shift and a click add the address to the selection, or remove it. A click on the empty canvas, and in an editor a click anywhere outside the edited element (on its group, on anything else faded, on another block), clears the selection, in the marquee mode too; Shift and a click there leave it.
Escape cancels a gesture in progress; with none it clears the selection, and with nothing selected it closes the innermost editor.
A focused block is selected with Enter or Space. A drag on a block, on one of its elements included, moves the block, first selecting it alone when neither it nor an element of it is selected.
A plain drag on the empty canvas pans; Shift and a drag draw a selection rectangle, which replaces the selection with the blocks wholly inside it (in an editor, the elements). The Marquee button (“Add to selection (marquee)”) switches to an additive mode, which is also how a touch screen selects several things: a drag on the empty canvas adds what lies wholly inside, and every click, Enter or Space toggles its address.
Picking. While a panel awaits an element of the manifest (the Metadata tab’s composer, “Pick on the canvas”), the canvas is given picking, a callback, and picks instead of selecting: a primary press on a block is taken before anything inside it sees it, and a press on a timeline’s line, card, band or a part of it, or on a region or its label, answers the callback with {block, id} of that timeline or region (picking.ts, pickable, reading the press as the inspector reads a selected address); any other press, on the block’s own area, a frame, a title, a named timestamp, a map or a flow-control element, picks nothing and is refused with “Pick a timeline or a region; Escape cancels.”; a press taken so starts no drag or pan, and its release and click reach nothing more. Escape, wherever the focus is, cancels the pick (the editor’s Picking, pick.svelte.ts, which holds one pick at a time).
Delete or Backspace removes exactly the selected addresses as one remove, blocks and elements mixed; a selected part stands for its element. While elements are selected, what a Delete would take with them is marked with data-affected. A band is never deleted: its address is left out, and a selection of bands alone is refused with “A band is not deleted; select its elements to delete them.” A selected virtual card held by its block ({block, id: V, part: ["card"]}) is hidden, not deleted: Delete sends one set of its place with every stated member null, which takes the card off the canvas and keeps the virtual timeline and its FlowMap; a virtual card in a frame is left out, as is a chunk, which is changed in its FlowMap, and a flow-control element or a part of one, which is rejected by a belief and never removed (each with a hint where the selection names nothing else: “A chunk is changed in its FlowMap; open the flow-control editor of its root to change it.”, “A flow-control element is not deleted: reject it with a belief in Properties.”), and a selection hiding virtual cards and deleting anything else is refused with a hint. The virtual timeline itself is deleted by “Delete virtual timeline” in the Properties tab (The inspector), one remove of {block, id: V}. The card address of a root drawn only in ancestor cards is left out too, since it stands for no element of its own. A selection holding a manifest’s title is refused whole, since a title goes only with its block. Inside an editor the edited element, or a part standing for it, is never deleted: it is left out, the rest of the selection is removed, and a selection naming nothing else is refused with “Close its editor to delete the edited element.”; selecting it marks nothing data-affected. A segment that would leave a gap, or a part of one, is dispatched like any target and refused whole by core (“Removing segment ‘S’ of line ‘L’ is not supported yet”). The canvas draws no text about a refusal: it reports every refusal, of a command, a key, a drop or a pick, through its onrefuse prop, and the editor posts it to the message bar as information (The component and the page).
The deletion dialog. A remove that also takes along virtual timelines it does not name (core’s removedBy: those made from a removed timeline or virtual timeline, or through a removed FlowMap, at any depth; none for a block removed whole) is asked about before it is stored, from Delete on the canvas and from “Delete virtual timeline” alike (deleteQuestion; the canvas’s confirmDelete prop, the editor’s askDeletion over its confirm dialog): “Deleting <targets> also deletes what is made from it: <virtual timelines>. Delete all, or hide its card instead?”, each thing by its kind and its name, else its ID (core’s addressWords). Delete all is one remove naming the targets and each virtual timeline taken along, in each block’s order of its virtual timelines, so one undo step. Hide instead is offered where every target is a virtual timeline its block places (hideCommand, the set unstating their places that Delete on a virtual card sends) and where the target is exactly one root (rootDisplayCommand: one style of display: none on the root’s card address, its own address and its five bands, so its card keeps its place undrawn, and its line, its ancestor cards behind frames and its ancestor lines in member cards are not drawn, while a member of a group inside the root stays in its frame); several roots, or roots mixed with virtual timelines, are offered no hiding. Cancel is focused, and Escape answers it. “Delete all” is previewed with core (preview), never checked by a copy of its rules: where core refuses it (a FlowMap left names one of the virtual timelines as a chunk), the question says “They cannot all be deleted.” and core’s reason, which names each timeline, FlowMap and virtual timeline by its name, else its ID (core’s namedProblem), and offers only Hide instead, where it is offered, and Cancel. A canvas without a host stores Delete all where core accepts it, and nothing where core refuses it. The bundle’s Timelines list in the Properties tab shows a hidden root or virtual card again (The inspector).
Editors#
An editor is a mode of the canvas on one element, never a second canvas. There are four kinds: the bundle editor of a block, the group editor of a group, the timeline editor of a timeline, a root’s or a child’s, and the flow-control editor of a root’s flow control and FlowMaps (The flow-control editor). While a timeline editor is open on a root, or on a descendant of it that no member card below the root draws (no timeline from the root’s child down to the edited one is a group member), the root’s displayed ancestor cards are raised over every frame where the root is in no group, or is itself a group member that draws an ancestor card (another member descends from it): such a root stands in its own group’s frame while its ancestor card lies covered behind the frame holding its descendant, so a double-click on that card opens the root’s timeline editor and raises it (raisedRoot, the one decision of the raise). The raise changes only the order the block node shows the drawing in, never the drawing: one stacking, the ancestor cards not raised in record order, then every other frame and card, then the raised ancestor cards (stackingOf; the block node draws its layers by it, raisedLayers). The raised cards unfold out of the member cards they are aligned to, each row of a card moving from its place in the member card to its place in the raised card while the card’s rectangle and the rows the member card does not draw fade in, and fold back into them when the editor closes, in 400 ms (Unfolding and animation/, decisions/0034), at once under reduced motion; a moving card takes no pointer, and the canvas reads the stacking at rest from the start. What the canvas reads follows the raised cards: the pointer reads their lines everywhere and no other line inside them, coordinates are placed on them (Show coordinates), and the marquee and the editor’s focus count what they draw, which they leave out while the cards lie behind the frames. A double-click, a double tap (two taps within 300 ms and 10 px), Enter on one selected address and the inspector’s Edit button open an editor by one rule in every view (editorTargetOf): what is hit opens its own editor, and what has none the editor of the card holding it. The block opens the bundle editor, a frame its group’s, a timeline’s line, wherever it is drawn, that timeline’s (a child’s line the child’s), and a flow-control element (its line, symbol, fork, arc or label, hit before any band) the flow-control editor of the root whose tree holds it; a band, the one under the pointer (bandUnder) or the band hit, opens its timeline’s editor, a root’s flow control band the root’s flow-control editor (editorOf), so a child’s flow control band opens the child’s timeline editor; a free spot of a card opens the card’s timeline (an ancestor card its root’s), and anything else drawn (a name, a label, a region, a stamp, a boundary) the editor of the last drawn card or frame holding it, the innermost where none overlap. Inside an editor, every target inside the edited element opens its own editor on top (openableIn), and nothing opens inside the flow-control editor; a double-click on the edited element, or on anything inside it that opens no editor, centres the view on the edited element again as opening does, and one outside it closes the innermost editor, as Done does. The open editors, outermost first, form the editing path, the store’s editing, one source for the canvas, the inspector and the test hook. On touch, a press held 500 ms (LONG_PRESS_MS) within the click distance lists the editors under it in a menu beside the canvas (EditorMenu.svelte over editorsUnder): what a double-click there opens, then the card under the point, then the group of the frame on top, each once and only where it opens, worded by core’s addressWords (“Flow control of timeline ‘Score’”, “Timeline ‘Score’”); Escape or a press outside closes the menu, and a move beyond the click distance, a cancel or a second finger stops the long press, whose release is no tap.
Opening an editor animates the view in about one second (FOCUS_DURATION; at once under reduced motion) so that the edited element is centred left of the inspector drawer with a 10 % margin, the zoom between 0.05 and 4; closing animates back to where that level was entered from; a change of the canvas’s size with an editor open centres the element again. The view follows the editing path through the store’s subscription (editorFocus.svelte.ts). Everything outside the edited element is faded to 0.3 and inert: nothing there is hovered, selected or moved, a click there clears the selection, and a drag there pans. Opening an editor selects its edited element (editedSelection): the block in the bundle editor, the group in the group editor, and in the timeline editor the timeline’s cards where it is drawn in one, else the timeline itself (a child, which has no card). After every other change of the store, an editor closing, an undo and a redo included, the editor’s session prunes the selection by one rule (existing): it keeps an address that still resolves and, in an editor, lies inside the edited element (the block itself in the bundle editor), the edited element and its card included, so a change made to the selected edited element keeps it selected; a selected band is kept while its timeline’s editor is the innermost open editor of its block. Inside, elements are selected by click and by marquee (elementsInRect); what an ancestor card draws, an affordance on its lines included, counts only while that card is raised, so an element drawn there and outside it is taken by its drawings outside, and one drawn only there is not taken (the stacking’s behind, which the focus reads too).
In the bundle editor an item is in the selection when the selection holds its frame or card, the cards of one of its group’s members, or another element its group or root contains by address; a drag on such an item moves every item in the selection by the same travel, the pressed item’s place quantized, and keeps the selection; a drag on another item selects and moves it alone. In the group editor a dragged member card (one that anchors its group on a root drawn once excepted, Arrangements on the canvas) previews the order a drop would give, before the first card whose middle lies below the pointer (memberOrderAt), the other cards sliding apart (slide) only while a member drag previews, and at once under reduced motion. The dragged card itself never slides: it lies hidden at the slot it would drop into while a copy of it follows the pointer. However the drag ends, stored, cancelled or released in place, the copy then moves from where it was dropped to where its card is drawn (releaseMotion, settle: √d × 120 ms for a screen distance d, easing out), then goes and the card shows; under reduced motion the copy goes at once.
An editor has no side effects (No side effects); a refused command leaves everything as it was, and its refusal (onrefuse) names what lay outside. Done keeps the editor’s changes as one entry of the level below; Cancel restores everything as it was when the editor opened. Both are the inspector’s.
A child’s flow control in its timeline editor. Only a root’s flow control band draws flow control, so a child drawn as a line in its root’s card shows none of it in its own row. While the timeline editor of a child is open, the block node draws below each drawing of the child’s line in a card (not the child’s own member card, which draws its root’s flow control itself, nor an ancestor card) a read-only band (flowOverlays, flowOverlay.ts): the elements that card’s flow control band draws on the child’s stretch, drawn as that band draws them and moved down, each flow line across the band, inside a dashed rectangle labelled “Flow control (from
The flow-control editor#
The flow-control editor edits the flow control and the FlowMaps of one root R (editor kind flow, target {block, id: R}; FlowMaps and virtual timelines): the flow-control elements of the timelines of R’s tree, selected on the card, whose name, label and belief the Properties tab sets and whose display controls style them (The inspector), and R’s FlowMaps, composed in its pane. It opens by the one rule of Editors, from R’s flow control band and from every flow-control element of R’s tree, wherever R lies inside the edited element: on the arranger, in the bundle editor, in the editor of a group holding R, and on top of R’s timeline editor. Outside R’s timeline editor no band is hit: a press on R’s card hits the card, and editorTargetOf(view, hit, editing, at) names the band from the drawing point (bandUnder); in R’s timeline editor the band hit names itself. editorOf turns the band’s address into {target: {block, id: R}, kind: "flow"}. A child’s flow control band opens the child’s timeline editor, while the elements it draws open R’s flow-control editor. Like every editor it blocks everything else, its level’s rules being the timeline editor’s without bands and without opening (LEVELS.flow), and Done and Cancel stand in the inspector’s editing bar, which names it “Flow control of <root>” (editorTitle); what it may store is the guard’s flowRefused (No side effects). Whoever opens it, the canvas then asks the server for its convention’s findings.
The card stays as it is, marked as edited; the FlowMaps fold out in a pane under it (FlowEditorPane.svelte, in Svelte Flow’s front ViewportPortal, scrolling sideways on its own: a plain or Shift wheel over it scrolls it, never the canvas, and Ctrl or Cmd with the wheel zooms the canvas there, gestures/wheel.ts ownWheel), as wide as the longest FlowMap needs, on the card’s scale, and the editor’s focus centres the card with its pane. The pane is an overlay like the marks: it carries no address and is no part of the drawing, its exports or the manifest. Its head holds Add + and Recompute; each row (flowRows in flowEditor.ts, drawn by flowEditorRows.ts) is one FlowMap of R, the computed ones first, each part ordered by its name (its name, else its convention, else its ID), compared by code point, then by its ID (while the editor is open the pane keeps the order it showed, keptOrder, so a FlowMap added or renamed meanwhile keeps its place and a new row comes last), with chips for its convention, canonical, provenance methods and findings, and is drawn as layout’s drawing of a virtual card applying it (its line, braces, labels, leaders and boundaries only) at the graphical length L × Λ / λ (L the card’s, λ R’s length, Λ the played one), its line aligned with the card’s, so that a played stretch is exactly as long as the written stretch it plays.
Composing (flowEditor.ts, pure: what each action stores; flowEditor.svelte.ts, the session; gestures/flowDrag.ts, the drags). Add + opens a new, empty row with a green Done and a red Cancel. Into the edited row the user drags, from the card, its Regions (atomic sections among them), its children and its line, which lands as the Region spanning the whole root (one held already, compared by value, else a new one over [0, length], 0 written in the axis’s number type), since the root itself is no chunk; from the other rows a chunk, which lands as its source, or a whole row lifted by its name, which lands as the virtual timeline it gives, written first, named by the row’s name (rowName), where none applies that FlowMap. A Shift-drag on the card’s line sweeps a stretch that is written as a new Region and lands as its chunk; a chunk is moved by dragging it, Alt copies it; “+ Gap” opens, in the edited row’s own head, a field for an exact length in the axis’s number type (core’s parseAxisValue, longer than 0), proposing the played length of the row’s last chunk (proposedGap), which Enter writes and Escape closes; a press on a gap entry, or Enter on one of the edited row, opens the same field with its length, and a changed length is one set of the FlowMap’s chunks (regap); without a pointer, Alt+← and Alt+→ move an entry, D copies it and Delete removes it, and Enter on another row’s entry and Insert on another row insert it. The first landing writes the FlowMap’s add into R, every further change one set of its chunks; a new ID is read through the result (addedId), never minted by the arranger. The row’s Done keeps it; its Cancel undoes every step since the row was opened, the Regions and virtual timelines written for it included. A row of a FlowMap written by hand becomes the edited row on a press or Enter, with its own Done and Cancel and every gesture of the new row; a computed row is read-only (its chunks may still be dragged into another row), and Recompute (only with a server; disabled otherwise, saying “Recomputing needs a server”) asks the server for the flows of R’s flow control (the client’s withFlowMaps, through the canvas’s flows prop, the editor’s flowServer.ts), adds each atomic section the answer has and the manifest lacks as a Region, and stores each changed computed FlowMap as one set of its computed value, the played lengths following, or its add where none is held. A convention’s findings are asked of the server (flows) when the editor opens and after Recompute, and the rows read them from a cache.
A row dragged out becomes a card. A row lifted by its name carries a transparent twin of its drawing; the nearer the pointer comes to the editor’s border (the union of the card’s and the pane’s rectangles), the more opaque the twin, 0.2 + 0.8 × max(0, 1 − d / 96) at the distance d inside it, opaque on and beyond it (twinOpacity, insideDistance). Released inside the border it flies back to the row and nothing is written (at once under reduced motion); released after the pointer crossed the border, the FlowMap’s virtual timeline is written, named by the row’s name, where none applies it, and its card is placed where the twin’s top left lies, rounded to the grid step, by one set of its place alone (“Place as card” does the same below the pane); the release on the new row inserts the row as a chunk instead: the drop target decides (dropAt, dropIndex).
Virtual cards on the canvas#
A virtual card is a card like any other: a press on it hits the card ({item: V}, {block, id: V, part: ["card"]}), a drag moves it by one set of its place, Scale, Box and Stretch resize it as an ungrouped root’s card, a press on a chunk’s brace selects {block, id: V, facet: "regions", part: [k]}, and Show coordinates reads its line as the root it is drawn as. Three overlays and one control are its own:
Ribbons (
ribbons.ts,Ribbons.svelte): a chunk hovered (its brace, label, leader or boundary) or selected draws a translucent blue ribbon from its brace on the virtual card’s line to its written stretch on every line of the source root in the block (its own card, member and ancestor cards; clipped to what each line draws; never into a switched card), read from the drawing alone, and outlines every other chunk of the same source on every virtual card (.tilie-litcopies of their braces); a run’s later entries draw no brace and so no ribbon. The ribbons lie in oneg.tilie-ribbonsthat lets the pointer through and carries no address, and fade in, at once under reduced motion.The flow flag (
coordinates.tsflowFlagParts,CoordinateFlag.svelte): on a virtual card’s line the coordinate flag adds the written position and its occurrence (“occurrence 2 of 2”; “in a gap”); on a root’s line it adds one row per virtual card of the block, in drawing order, listing every played position (“not played” where there is none).The flow switch (
flowSwitch.ts,FlowSwitch.svelte): above the resize toolbar’s mode menu of a selected root’s card or frame, a list “Flow” of “As written”, the root’s FlowMaps and the virtual timelines applying one of them withoutthrough(none for a child’s card, a virtual card or an ancestor card); choosing sends theflowstyle (Commands), “As written”flow: null, and in a frame a choice switches the frame, first removing any other member’sflow, the frame’s commands made as one undo step throughNodeActions.edit(core’sStore.editin the editor of the frame’s group, The store and its journal), though inside that group’s open editor they are its own entries, a step each; a locked canvas disables it. The list keeps one width (SWITCH_WIDTH, 11rem), cutting a long name with an ellipsis, the whole name its tooltip and each entry’s. The card or frame shown chosen is core’scardFlow. When a card becomes switched, its chunks move from their written stretch on its line to their played braces over the canvas’s motion duration (flowSwitchMotion.svelte.ts,switchMorphs; never for a preview, at once under reduced motion).
Bands#
In the timeline editor the bands of the edited timeline, a root’s or a child’s, are arranged (bands.ts). A band is offered only in the timeline editor of its own timeline while that editor is the innermost open one, and only while it is recorded; the arranger, the bundle editor and the group editor offer none, though the band under the pointer is hover-marked in every view and a double-click on it opens its timeline’s editor (Editors). The visible entries are the timeline’s recorded bands and line, top to bottom, a band’s position being the middle of its rectangle and line’s the timeline’s line. A band dropped at ordinate y moves, in the effective band order, to just after the last other visible entry above y, or before the first when none is (bandDrop), read against the drawing at the press; the line is an entry like a band, so a band dropped across it changes sides, and a release in place writes nothing. Either move is one set of the timeline’s order, its value the new band order, or null when that equals the inherited order; moving a timeline’s bands also moves those of every descendant without an entry of its own. A press on an offered band is hit where it lies in the band’s rectangle, edges included, after every drawn element.
On an offered band |
Effect |
|---|---|
Hover |
The band under the pointer is marked |
Click, tap |
Selects the band; Shift and a click add it or remove it |
Drag, mouse or one finger |
Previews the band’s new place, the other bands sliding apart; the release stores it in one |
Double-click, double tap |
On a root’s flow control band, opens the root’s flow-control editor on top; on any other band, centres the view on the edited timeline again, no editor opening and none closing |
Enter, with the band selected |
On a root’s flow control band, opens the root’s flow-control editor on top; on any other band, nothing |
Ctrl+↑, Ctrl+↓ (Cmd on macOS), with exactly one band selected |
Steps the band past the next visible entry, the line included, in one |
Escape, during a drag |
Withdraws the preview and stores nothing |
Delete, Backspace |
Never deletes a band; a selection of bands alone is refused |
Order, keys and the lock#
The order of blocks is their index, projected as zIndex; selecting a block does not raise it. Ctrl and ] (Cmd on macOS) move the selected blocks one place forward past the next unselected block, Ctrl and [ backward, with Shift to the front or back; only the moved blocks receive new indices. On an arranged canvas that order is also the order the blocks are packed in, so these keys move a block along the arrangement too.
The canvas reads its keys before Svelte Flow does, from one table (keys.ts) whose rows each ask rulesOf whether they may run; keys typed into a text field are left alone. The canvas is one tab stop (an ARIA application named “Arranger”); its keys apply only while the focus is inside it. The file shortcuts and undo and redo are the editor’s (The editor); they are listed here because they work on the canvas too.
Key |
Action |
|---|---|
Tab, Enter or Space |
Focus a block, select the focused block |
Enter, with one box or timeline selected |
Open its editor |
Double-click, double tap |
Open the editor of the timeline line or innermost box under the pointer; on the edited element, or inside it where no editor opens, centre the view on it again; outside it, close the innermost editor |
Wheel, Shift and the wheel |
Pan vertically, horizontally |
Ctrl and the wheel (Cmd on macOS), a pinch |
Zoom |
Arrow keys, Shift and an arrow key |
Move the selected blocks one grid step, eight (on the arranger); on an arranged level, move the one selected block (on the arranger) or item (in the bundle editor) one place along the arrangement: Up and Down along a column, Left and Right along a row, in a matrix Up and Down one row |
Ctrl+↑, Ctrl+↓ (Cmd on macOS) |
Move the one selected band (in its timeline editor) |
Delete, Backspace |
Remove the selected addresses, never the edited element |
|
Zoom in, zoom out, fit every block into view |
Ctrl+Z; Ctrl+Shift+Z or Ctrl+Y (Cmd+Z, Cmd+Shift+Z on macOS) |
Undo, redo |
Ctrl+ |
Forward, backward; front, back |
1, 2, 3 |
Resize mode Scale, Box, Stretch; with one elision selected, 1 and 2 press or release Coordinates and Width |
|
With one stored elision selected, choose the start or the end of its gap (the end at first), then move that edge one grid step under the pressed modes |
L |
Lock or unlock the canvas |
C |
Show coordinates on or off, on every canvas, a read-only one included |
M |
Show matches on or off, likewise; it and Show coordinates take turns |
Escape |
Cancel a gesture; otherwise clear the selection; otherwise close the innermost editor |
Svelte Flow pans on the wheel and zooms only with Ctrl or Cmd held; a touchpad pinch, reported as a wheel event with Ctrl, zooms too. Outside macOS, Chromium and Firefox already report a Shift wheel as horizontal travel, which Svelte Flow would discard, so the canvas pans it itself at Svelte Flow’s speed (gestures/wheel.ts).
The Lock button, or L, locks the canvas: a drag on a block pans instead of moving it, an arranged block or item is not dragged, the arrow keys move nothing, the Arrange menu is disabled (and with it the inspector’s level tab’s arrangement, The inspector), a drag on a band pans and the band keys move nothing, and the resize handles are hidden with the mode buttons disabled. Selecting, deleting, reordering, panning and zooming stay available. A read-only canvas offers no lock button.
Overlays, culling and per-viewer state#
The resize handles and the alignment guides lie in one overlay layer in front of the nodes and keep their screen size at every zoom. The canvas controls (zoom in, zoom out, fit, Lock, Arrange on the arranger and in a bundle editor, Marquee, Show coordinates, Show matches) are a vertical toolbar of icon buttons at the bottom left, each with an accessible name and a tooltip naming its key. Above 500 blocks only the blocks in view are mounted (Svelte Flow’s onlyRenderVisibleElements); below that count culling costs more than it saves (Performance).
The selection, the viewport, the lock, the resize mode, Show coordinates and Show matches belong to the viewer: the editor holds them, and they are never stored in the workspace or its file. An arrangement is not the viewer’s: it is placement, stored in the workspace, journalled and undone like any change. The open editors are the store’s: a file saved with an editor open holds its session folded, and a reopened file opens no editor. A newly opened workspace is fitted into view. Svelte Flow’s attribution link is hidden (proOptions.hideAttribution, which its MIT licence permits); the About dialog credits it.
Elisions on the canvas#
A gap, its ellipsis and its labels are one thing to the pointer (gaps.ts, over layout’s Drawing.elisions and the gaps’ elements): a press on any of them selects the elision, a stored one as {block, id: E}, a derived one as {block, id: T, part: ["elision"]}, and a gap carried into an ancestor card selects its group elision. Only a stored elision’s gaps take handles, a card elision’s in its card and a group elision’s in its frame. A derived one is selected and never edited on its own: Delete on it is refused (“Automatic elisions are not deleted one by one: choose Custom to edit them.”), and choosing Custom for its root stores the card’s derived gaps as stored elisions (The inspector).
A selected stored elision shows a handle on each edge its gaps reach, at the ordinate of its timeline’s line (GapHandles.svelte), and above them the gap mode menu (ModeMenu.svelte, the resize toolbar’s own menu) with two toggles, Coordinates and Width, one or both pressed and never neither, held per canvas, Coordinates alone at first. A drag of an edge by Δx (the gap strategy of the gesture engine, gapDrag): with Coordinates alone, the elided coordinate at that edge moves by Δx over the canvas units per unit of its timeline on the run beside that edge (edgeScale), snapped to the timeline’s start and known end, its children’s, and the ends of what the gap may not cross (an ancestor card’s protected span, a frame’s other gaps) where one lies within the snapping distance, else to the simplest value within the pointer’s reach, and the gap keeps its drawn width, so the timeline slides under the handle; with Width alone the drawn width changes by Δx and the coordinates stay; with both the drawn width follows the moved edge, so the gap swallows the line and what lies beyond the edge stays put. A width is written in the elision’s own form (widthAs; a standard gap as {canvas}), never wider than its natural width. A flag at the dragged edge shows its value, and the release is one set of the elision (gapCommand). [ and ] (by the character typed) choose the edge the arrow keys move, ← and → move it one grid step under the pressed modes (gapStep), and 1 and 2 toggle the modes; the lock hides the handles and disables the menu. With Show coordinates on, nothing is read inside a gap, and the gap under the pointer shows a flag saying what it leaves out (“Score, 0–16 ♩, elided”, gapHoverAt).
cardAxis.ts is the one map between abscissas and the coordinates of the timelines a card or a frame draws (cardAxisOf, cardAxisAt, exposureAt): over the exposure’s runs, each position the proportion of the axis it lies on, the card’s root (a placed virtual card’s virtual timeline, on its played axis) or, across a frame, the member holding its timeline, each run with its own scale, so a handle reads the run beside its edge.
The arranger and the editor split the gap commands. The arranger builds every command that reads the drawing’s gaps, for the canvas and the inspector alike: a handle’s or a key’s set (gapCommand), the one add storing the gaps a card derived as it draws them (defaultsStored: in drawing order, the elided coordinates exactly, {canvas: g} unless the gap is the standard one, the card’s elision-display, no name), and the one remove of a root’s card elisions (defaultsRemoval). It exports them with the readers the inspector needs, exposureAt, cardAxisAt, piecesOf and stretchText, the gap labels’ spelling of a stretch. The editor builds the rest from those readings (inspector/elisions.ts): the switches of a mode as style commands, the proportion, depths and display settings, Add elision, a group’s Remove all, and the set of each field of a selected elision.
Motion. When a block’s drawing changes its gaps (a mode switched, a gap added, removed or changed, a proportion moved), every card and frame concerned moves its elements sideways from where the drawing before drew their positions to where the drawing after draws them, rows moving only where labels are shown or hidden, and an ancestor card shown or hidden unfolds out of its member card or folds back into it (animation/elide.ts, cardMotions.svelte.ts; decisions/0034). Nothing moves during a gesture’s or a control’s preview, under reduced motion or for a block’s first drawing, and the pointer always reads the drawing at rest.
Region handles#
A selected region, selected alone, shows a square handle at each end of each of its braces, at the brace’s ordinate (RegionHandles.svelte over gestures/region.ts: regionSubjectsOf, one subject per brace, its card read from the drawing’s card box ranges and its axis that card’s, or that of the frame holding a member card, cardAxisOf). An end takes a handle only where that axis reads its abscissa back as the region’s value, so a brace drawn over another axis, as on a switched card, takes none, and an atomic section takes none. A drag of a handle (the gesture engine’s strategy regionGesture) reads the pointer through the card’s axis, so a drag across an elided stretch reads the value on the far run, and beyond the axis or inside a gap by the end’s run scale (regionDrag); it snaps to the timeline’s start and known end, its children’s starts and known ends and the other regions’ ends, else to core’s snapOnRow within half a pixel, and is held between 0, the other end (a region of length 0) and the known length. The preview goes through core’s preview; a flag above the brace shows the region’s name and its stretch with the dragged end (regionText, stretchText), and the release is one set of the changed end, exact in the axis’s number type (regionCommand). Like the gap handles, they follow the level’s resize rule, so a locked or read-only canvas hides them, and they are hidden while boxes move. The gap and region handles share the handle element (EdgeHandle.svelte), the snapping values (edgeValues.ts: exactOn, timelineTargets, snappedOn, axisValue) and the pointer’s travel (gestures/travel.ts: travelOf, pixelOf, HandlePress).
Arrangements on the canvas#
Two levels of the canvas arrange their contents (Arrangements), through the Arrange menu (ArrangeMenu.svelte, on the toolbar of the gap modes’ ModeMenu, ModeButtons.svelte, in a Svelte Flow panel beside the controls, opened by the toolbar’s Arrange toggle; it reads nothing of the canvas, and arrangeMenuOf in arrangeMenu.ts, its one model, says what is stated and what a choice stores, so the inspector’s level tab draws the same menu): on the arranger the blocks, Free, Vertical, Horizontal or Matrix with its Columns (− and +), the workspace’s arrangement; in a bundle editor the edited block’s items, Free, Vertical or Horizontal, the block’s arrangement, Horizontal disabled where rowOf refuses the items’ order, its reason below the choices and in its title; none in a group or timeline editor. A choice is one set (canvasArrangementCommand, itemArrangementCommand): Free states null; a block’s Vertical or Horizontal the items in the order they are shown arranged (shownItemOrder, the drawing order where nothing is stored), core storing Horizontal as its row; Matrix its columns, the smallest number whose square holds the blocks when first chosen (columnsOf).
Blocks. While the workspace arranges its blocks, every node lies where
packedputs it in the blocks’ order (index), 32 canvas units apart (ARRANGEMENT_GAP), from the top-left corner of all the blocks’ stated places, the leastxand the leastyamong them, so that reordering never moves the start (blockPlaces,arrangedPlaces); each block’s statedxandyare kept and not used, and no block’s drawing changes. Svelte Flow drags a node as ever, without snapping or guides; the others are shown at the places its drop would give them (arrangedDrop), and the release stores the moved block’sindexalone, between its new neighbours’ (blockIndexCommand,indexBetween), nothing where its place is unchanged. The nodes not dragged go to their new places by a CSS transition of 200 ms (data-arrangedon the canvas), at once under reduced motion.Items. In the bundle editor of an arranged block a press on an item, a frame or an ungrouped root’s card, reorders instead of moving (
gestures/item.tshands it to thearrangedstrategy,gestures/arranged.ts): a copy of the item follows the pointer, the others slide to the places the drop gives them (the preview being the command applied), and the release stores onesetof the block’sarrangementwith the new order, after which the copy settles where its item is drawn, as a member card’s does (endReorder). Side by side, a drop is refused where the moved group would leave its place among the stretches of a root it hangs on (rowRefusal, a clause per root:"G" stays right of "A", "B" and left of "C" on "R"): the stored order stays previewed, nothing is stored and the reason is reported throughonrefuse; an item hanging on nothing goes anywhere.Where a content drops is one rule,
orderAt(entries, dragged, point, direction)(reorder.ts), read against the places before the drop: before the first other content that does not precede the point, a content preceding it when its middle lies at or above it (vertical), at or left of it (horizontal), or, in a matrix read row by row, when its row lies above the point’s or it lies in the point’s row with its middle at or left of the point; the group editor’smemberOrderAtis its vertical call. An arrow key moves the one selected block or itemarrangedStepplaces along the arrangement (steppedOrder; nothing beyond either end), refused side by side as a drop is (Order, keys and the lock).Cards in a group’s editor. A frame’s cards keep their display order and are reordered as ever (Editors). While the block draws its items side by side, a card whose member anchors the group on a root is pinned (
isPinned): a press on it is not taken, so the roots’ order stays the groups’; a drop of another card that would give the group another anchor is refused (heldRefusal, core’sanchorChange:would anchor "coda" on "Score" instead of "Recapitulation").A root drawn once. The once card is an ancestor card like any other: never dragged, opening its root’s timeline editor and raised in it. It counts for every group of its
ancestor.groups: a group’s editor zooms out to the once card behind it whichever group it is keyed by (elidedReach), and the stretch a handle of its gaps may not cross spans every group’s anchor. A gap an arrangement cuts is a derived gap to the canvas: selected, never edited (subjectOfgives none) and never deleted, Custom storing only the gaps a card derives by itself;cardAxis.tsgives each edge of it the scale of the run beside that edge.Motion. When an item’s place changes (a choice, a drop, a step), its elements move from its old place to its new one (
itemMotions, first inblockMotion, by the same progress as the elisions’ motion), a member card of a moving frame with its frame; on a switch to or from Horizontal the once card moves sideways into its runs while the root’s other ancestor cards fade out or in, none unfolding.
Show coordinates#
The Show coordinates button (“Show coordinates (C)”), under the Marquee button, switches between reading positions and editing named timestamps. While it is on, a line is hovered anywhere from the line out to the outermost map drawn at it, within 8 device pixels (HIT_TOLERANCE) of the screen the window is on, the canvas following the device pixel ratio when the window moves to another (deviceRatio, a watched resolution query), and the flag shows the timestamp of the position there (Values on timelines): its cross-section, read from a spec the arranger builds from what a cross-section line in the hovered line’s card crosses (crossSectionSpec: the hovered line’s timeline as the anchor, then every other timeline the card draws, as a line, an ancestor line or a segment of a line, cardTimelines, each at its offset from the anchor’s zero with the maps drawn for it in the card, then the anchor’s ancestors the card does not draw, without maps), part by part, top to bottom where the reading crosses each timeline (each member’s ordinate: its own line, its ancestor line in the hovered line’s card, or the segment line holding it), each part headed by its timeline’s name, with that timeline’s coordinate and one row per map drawn for it, top to bottom as drawn (a map drawn above the line before the coordinate), the hovered row highlighted, each value its pretty text rounded with the granularity’s decimals (flagParts, rowValueText). What the pointer hovers, the line or one map, is the row the position is picked on (core’s snapOnRow): the line snaps on its timeline’s axis, a map on its value’s axis, brought back exactly through the map’s inverse. The flag follows the pointer, read again once per animation frame, and hangs from a pole standing at the position like a flag, opening right of the pole, its edge touching it (flagPlace); it never changes sides: near any border of the canvas it is shifted by exactly what keeps it on screen, the pole staying at the position (onScreen); the pole rises above the line, its maps and its cross-section line. Every value is core’s timestamp; the canvas evaluates no map and keeps no value. A measure view needs the expanded rows of its MeasureMap, which the canvas asks of the server through its measureMaps prop, once per manifest version (MeasureKnotsSource); without them its row says so. Above a timeline editor (on the arranger, in a bundle or a group editor; groupScoped), a hovered line drawn in a card of a group’s frame is read as a groupstamp lying there is: the spec also holds every other member of each group whose frame draws the line, each with its ancestors and the descendants its line crosses, read by the group (withGroupMembers: at the offset of the member holding the anchor, scaled by its drawn end over that member’s), so the flag lists them and the hovered position is marked across the frame too (readsGroup, layout’s groupCrossSections); a member whose length, or that of the member holding the anchor, is not known (layout’s readsAcrossGroup) is listed without a value (core’s VALUELESS_TEXT, “no value: a length in the group is not known”, not editable), its scale only placing it, and the mark across its card is faded; inside a timeline editor a reading stays on its timeline. The hovered position is marked as a named timestamp lying there would be drawn, a wedge in its line’s markers band and a cross-section line (layout’s wedgeAt and crossSection, drawn in the block’s drawing units so they scale with the zoom; CoordinateMarks.svelte); on an ancestor line, which draws no timestamp, by that line’s mark alone, faded as the ancestor line is (DrawnAxis.mark). An ancestor line is hovered and read as its ancestor’s line: the timestamp is anchored on the ancestor and read across the member’s line in its card, with the other timelines that card draws. The lines of an ancestor card are read where the card is seen: beyond the frames and cards drawn over it and the ancestor cards recorded after it, and everywhere while it is raised, when no other line is read inside a raised card (the stacking’s covered where the reading lands on the line, stackingOf under raisedRoot of the node’s editor). A zero-length line is not hovered; a line of unknown length is hovered over its drawn span, up to its reach, every line reading a position as its share of layout’s LineAxis.drawnLength (its length, or up to its reach where the length is not known) and placing one at layout’s abscissaOf, the one mapping from a position to an abscissa. A click on a hovered line (a press released within the click distance) pins that timestamp, an unnamed one, and hands it to the editor with the key of the line it was read on (oncoordinatepin(pin, line)); its wedge and line stay drawn while it is pinned (the pinned prop), on the line it was pinned on while that line is a place of its position, else at its first place, a segment line and a zero-length line included (pinnedPlace, through placeOf, the one reader of one place); a click anywhere else hands null (and no line), clearing the pin; a press on a toolbar button does neither. While it is on, named timestamps and named MatchStamps are drawn but take no pointer (pointer-events="none" on a timestamp’s wedge, labels, line and affordance and on an alignment anchor’s line and name label, passes in BlockNode.svelte), so the pointer reads the line beneath wherever they lie. While it is off there is no flag and no pin (turning it off hands null), and a named timestamp is selected like any element: a press on its wedge, a label or its line, a groupstamp’s line across a frame included, selects the timestamp {block, id} (selectionRules.ts), which the editor shows in the Timestamp tab for editing, read as a click at its coordinate would read it (namedPin). A pin, and the timestamp named from it, are read on the line the pin was read on while that line is a place of its position; a timestamp selected or reloaded (a selection names no line) is read at its first place (timelineSpec, which timelinePin shares, under the root the innermost editor raises), as the pointer reads that line: on a segment line with the segment as its anchor, its members its ancestors and those of its own subtree the cross-section line crosses (crossSectionSpec with an anchor); a value with no place, where no line of its timeline is seen, is read on its own axis with all its maps and its ancestors, so nothing unseen is read. A groupstamp’s pin also holds the other members of its groups’ frames, read by the group as a hovered line is above a timeline editor (withGroupMembers, the one reading of a group’s members), so the Timestamp tab shows the whole GroupStamp, in a timeline editor too. A press on a match timestamp’s line selects the named MatchStamp holding it instead (Owner.selects, holdingMatchStamp: the first in the manifest’s order whose anchor at that timestamp shows the name, else the first), which opens it in the Matchstamp tab. A coordinate is placed wherever it is seen, without exception: its places are one rule (placesAt over seenOn, coordinates.ts), under the root the node’s innermost editor raises (raisedRoot, else none): the lines its timeline is drawn on, each kept where the user sees it. A timeline is drawn on every line of its own, in any card, an ancestor card’s included, else on every line whose segment it is, and on every ancestor line of it in a member’s card (linesOf), the topmost in the stacking first. Each line is cut at the left and right borders of every displayed frame and card and kept where it is not covered (the stacking’s covered), whatever its length, a zero-length one included. So a timeline drawn in an ancestor card is placed on the card’s line beyond the frames over it and on its ancestor lines, and a member on its own card’s line and on its row in its root’s ancestor card where that card is seen beside the frames; while the card is raised, its lines come first and cover what lies beneath them. The pointer, screen order, the affordances, the pin’s mark, a named timestamp’s cross-section and Show matches read it; the marquee alone selects addresses, not places (Editors). One whose display is empty draws nothing in an export; on the canvas alone, unless it is a match timestamp, which its MatchStamp’s lines and connectors reach and which therefore leaves no placeholder, it is drawn as an affordance, a light grey wedge where its own would lie at each place of its coordinate (on an ancestor line that line’s mark), so it stays selectable. affordancesOf(manifest, drawing, raised) is the one place their geometry is computed, once per drawing and raised root: the block node draws them, the marquee takes their bounds (one on an ancestor card’s line only while the card is raised) and the projection counts their addresses as drawn. Each affordance is its own canvas source, selected by address (the box reader, One node per block): a press on it hits the timestamp as a press on a drawn element hits that element. The hit test reads layout’s lineAxes; the reading and the marks’ places are coordinates.ts, the flag CoordinateFlag.svelte, its body inside Flag.svelte, the one flag shell (pole, place, footer “click to pin”) it shares with the MatchStamp flag. The canvas zooms from 0.05 to 256 (Svelte Flow’s minZoom and maxZoom), so a position can be read down to a fine fraction of a unit.
Show matches#
The Show matches button (“Show matches (M)”), under Show coordinates, switches between reading a MatchClaim table’s potential MatchStamps and selecting named ones; turning either on turns the other off. Turning it on or off, by its key or its toolbar button, calls the onmatches prop with whether it is shown, so the host can load the tables it draws from (MatchClaim tables). The canvas draws from its matches prop, one MatchOverlayInput {block, index, named, beliefs?} per block whose MatchClaim table the editor holds: the block’s anchor index under its MatchClaim filter (MatchClaims and potential MatchStamps), its named MatchStamps compared with the table (named, each stated in the order of its alignment_anchors, with statedBy), and the user’s belief per row (core’s believedBy; without it every MatchClaim is undecided); each input is drawn over its own block alone. While Show matches is on without any input, the canvas draws nothing over the blocks and says nothing: why nothing is drawn, no table loaded or no server to read one, is the editor’s to say, in the message bar and the Matchstamp tab (MatchClaim tables). Every coordinate of the index is drawn where a named timestamp at it would draw its cross-section line, on every part of a line where its timeline is seen (seenOn, under the root the block’s innermost editor raises: its places, Show coordinates; on an ancestor line the cross-section line of the member’s line in its card), and every anchor as the line layout draws a named one’s between two cross-section lines (The drawing), so there is no second geometry; where a card draws neither a children nor a conversion maps band the cross-section line has no length and only the anchors show. What is drawn follows the view: of the coordinates in view, at most one per device pixel column of a card, each found by a binary search from the column before, so the cost follows the viewport and never the size of the table (overlayOf, matches.ts). One path per layer and block (MatchOverlay.svelte), width 1 and dashed 3 3: the potential MatchStamps light grey (#C8C8C8, 70 % opaque), the hovered one dark grey (#6E6E6E), the pinned one on top, each of these two drawn as naming it would draw it, so a coordinate that naming stores as a groupstamp (core’s namedAsGroupstamp, read per coordinate by namedGroupstamps) also draws the lines layout’s groupCrossSections gives across the frame holding its line’s card (stampOverlay); its cross-section lines blue (#1BA1E2) and each connector by the user’s belief in the MatchClaims stating its anchor (core’s anchorBelief): undecided blue, true green (#339933), unlikely dark orange (#E07000), false red (#E51400), a path per colour, the most critical drawn last (pinnedOverlays, BELIEF_STROKES). Each overlay’s path is written once (pathOf, kept per overlay object, with one more fadedPathsOf for each other opacity of a groupstamp’s pieces, which MatchOverlay.svelte draws at that opacity: over a member card of unknown length they are faded as the named groupstamp’s are), and the potential MatchStamps’ path is its own derived value, so a hover never writes it again; the hovered and pinned overlays and the flag’s groups depend only on which MatchStamp of which block is hovered, so a pointer moving within one MatchStamp computes nothing anew and only places the flag. A coordinate within 8 device pixels of its line, on a part of a line where it is drawn, or a drawn anchor as near, is hovered (matchHitAt, a line winning a tie), and a flag in the shell of the coordinate flag (Flag.svelte) shows the hovered potential MatchStamp: every coordinate of it and, above a timeline editor (on the arranger, in a bundle or a group editor; inside a timeline editor only its own coordinates), every coordinate its groupstamps read on the other members of their groups’ frames, scaled, as the Matchstamp tab’s Coordinates read them (the arranger’s timelinePin by the group), each value once per timeline, each its pretty text rounded with the granularity’s decimals. The rows lie in the order they are drawn, its own coordinates in screen order and a groupstamp’s at the ordinate its pin reads the member at, on its coordinate’s abscissa, and are grouped by runs: one group for each run of rows on one timeline, named as its manifest names it, so a timeline whose coordinates lie apart is named again (matchFlag, MatchFlag.svelte). Screen order is one rule, exported for the editor’s Matchstamp tab and its naming (screenPlace, screenOrder, inScreenOrder, over a block’s drawing): a coordinate’s place is the topmost, then the leftmost, of its places (Show coordinates: the parts of lines where its timeline is seen that hold its exact value, from 0, up to a segment’s length, within the line’s drawn span; the abscissa layout’s abscissaOf), under the root a block’s innermost editor raises where the canvas and the tabs show a MatchStamp and with none raised where naming and Update store one, and places sort top to bottom, then left to right, a coordinate the block draws on no line last, items of one place keeping their order. A click pins it (onmatchstamppin({block, matchStamp}), a MatchStampPin, the number being the potential MatchStamp’s in that block’s index, since every table numbers its own from 0) and the editor shows it in the Matchstamp tab; the pinned one is drawn from the pinnedMatchStamp prop; a click anywhere else, and turning Show matches off, hand null. While it is on, a named MatchStamp’s parts and every match timestamp’s take no pointer, so a click reads the overlay beneath. While it and Show coordinates are off, a press on an alignment anchor’s line or its name label, or on one of its match timestamps’ lines, selects its MatchStamp {block, id} (ownerOf, selectionRules.ts), the marquee taking it when every part lies inside; a selected MatchStamp shows its selection on every anchor, and Delete removes it as any element. Whether Show matches is on or off, the named MatchStamps of a block whose table is loaded are painted over their style (namedPaint, read by the block node through NodeActions.matchPaint): each anchor’s line by the user’s belief in the MatchClaims stating it, as the pinned one’s connectors are, and one out of date entirely red, its anchors’ lines, its match timestamps’ lines and its name label, which then begins with an exclamation mark drawn as a text of its own, so the label keeps the width layout measured. The hit test and the lines read layout’s lineAxes, each line’s card from its LineAxis.card.
The canvas’s modules#
Canvas.svelte composes the canvas from modules that hold one concern each: the nodes with the previewed block, a gesture’s preview, else the transient command’s (nodes.svelte.ts), the view following the editing path (editorFocus.svelte.ts), what a press, click, double-click and Enter do as pure functions of what was pressed (selectionRules.ts, driven by gestures/canvas.ts), the key table (keys.ts, which also exports isTextInput and within for the editor), the block drag with its snapping (blockDrag.ts), the arrangements (the drop rule and their commands in reorder.ts, the packed places of blocks in project.ts, an arranged block’s drop in blockDrag.ts’s arrangedDrop, the menu ArrangeMenu.svelte with its model arrangeMenu.ts), the Shift wheel (gestures/wheel.ts), the opening rule and the long-press menu (editors.ts, EditorMenu.svelte), the flow-control editor’s pane (flowEditor.ts, flowEditor.svelte.ts, flowEditorRows.ts, FlowEditorPane.svelte, gestures/flowDrag.ts), the gap and region handles (GapHandles.svelte, RegionHandles.svelte, EdgeHandle.svelte, edgeValues.ts, gestures/gap.ts, gestures/region.ts, gestures/travel.ts), the overlays and control of virtual and switched cards (ribbons.ts, Ribbons.svelte, flowSwitch.ts, FlowSwitch.svelte, flowSwitchMotion.svelte.ts) and the styles (canvas.css, scoped under .tilie-canvas). The open editor, which every module reads, lives in a leaf module, editing.ts. BlockNode.svelte gives each box its gesture once (gestureOf(box)) from the level’s rules and the box’s kind. The package exports Canvas, liveStore, addCommand, drawingOf, resolveSelection (the selection as subjects, each with its container kind, its DrawnBox and its resolved address), the selection’s helpers (selectionOf, which builds a selection from addresses, isSelected, NOTHING_SELECTED, blockOf, existing, editedSelection), isTextInput, within, levelOf (the level under the innermost open editor), placeChange (the change of a set stating a place under a place key) and its inverse changedPlace, the deletion dialog’s question and commands (deleteQuestion, DeleteQuestion, hideCommand, rootDisplayCommand, rootHidden), the opening rule the Edit button reads (openable, editorOf, EditorToOpen), the inspector’s readers (boxOf, blockBox, keyedBox, isItem, isHeld, fieldsOf, and shownValues, a box’s place stated, else drawn), Svelte Flow’s Viewport type, raisedRoot, the root whose ancestor cards a block’s innermost editor raises, under which the inspector reads places, the readers of named timestamps (namedPin with the KnotsOf type, timelinePin, the unnamed pin at a timeline’s position read with the same spec, and by the group as a groupstamp is read where asked (withGroupMembers), which the Matchstamp tab reads a potential MatchStamp’s coordinates with, both on the preferred line, the line the position was read on, while it is one of the position’s places, else at the first place; rereadPin, an unnamed pin read again at its anchor’s position under a given raised root and group reading, on the line it was read on; readsGroup, whether a pin reads a group’s members; drawingOf and styleLayers), blocksInOrder, the canvas’s one order of blocks (by parent, then index), the types of Show matches’ props (MatchOverlayInput, NamedComparison, MatchStampPin), the type of the transient prop (TransientCommand, a command shown applied to its block and never stored), the screen order (ScreenCoordinate, screenPlace, screenOrder, inScreenOrder, Show matches), the canvas’s pane (Pane, PANE_SETTLE), the card axis (cardAxisOf, cardAxisAt, exposureAt, zeroOf), the gaps’ readers and commands (Elisions on the canvas), and placeEdit(view, selection, property, value, level, metrics), the inspector’s one call: the set a Properties field writes, by the same rules a gesture applies, or null, or a typed refusal.
The editor#
@timetoalign/tilie-editor is the application around the canvas. Every change it makes to a workspace is a command dispatched to the store, so undo, redo, the journal and the autosave cover it as they cover a gesture.
The component and the page#
Editor.svelte is the whole editor for one workspace: header, canvas, inspector and dialogs. Its props are the embedding options (Embedding), testHook and examples, which shows the Examples menu (the standalone page sets it, an embedded editor never has it); it exports text, load, selection, select, focus and flush. It styles only its own root (.editor, container-type: inline-size, the drawer clamp(22rem, 32cqw, 40rem) wide and at most 60cqw), names every DOM id per instance with $props.id(), takes its shortcuts on its root unless shortcuts is "window", and reaches outside itself only through its options. Its parts are modules: the open workspace with its store, file name, handle or path on the server, unsaved state, open, save, import and export (workspaceSession.svelte.ts, where a journal that does not reproduce its workspace becomes a refusal coded journal_mismatch), with the MatchClaim tables of its blocks (matchClaims.svelte.ts, MatchClaim tables), the autosave with its lock and recovery (autosaving.ts), the drawer (InspectorDrawer.svelte), the one shell of its native modal dialogs (ModalDialog.svelte: the <dialog> element, its look and one question at a time, a question shown over an open one dismissing it), on which the question dialog (ConfirmDialog.svelte), the tables dialog (TablesDialog.svelte) and the file dialog (FileDialog.svelte) hold only their content and answer, the header’s workspace name (WorkspaceTitle.svelte), the Fixture menu of test builds (FixtureMenu.svelte), the Examples menu (examples.ts), one SHORTCUTS table driving both the keys and the menu’s labels, and the message bar (MessageBar.svelte) with its messages (messages.svelte.ts). Each example declares its kind and is loaded as a chunk of its own when chosen: a manifest example, one of four fixtures of the schema package, is imported as one more block as Import adds a file; a workspace example, editor/examples/timestamps.tle.json (“Timestamps”: a fraction score with children and maps to ticks, whole notes and seconds, a float segment line of two takes with a map to samples, and named timestamps with different display sets), opens as the workspace, under no file, after the question New and Open ask. The example workspace is written by the end-to-end fixture generator (pnpm e2e:fixtures) through the store’s commands and never edited by hand; .gitattributes keeps every *.tle.json LF in every checkout, as the generator writes it, so the byte-for-byte check (pnpm e2e:fixtures:check) holds on any platform. The menu is never disabled. The message bar is the one place the editor tells the user what happened (decisions/0037): it lies over the canvas, one card per message, newest last, one under another so that no card covers another, each naming its level in words (“Info”, “Warning”, “Error”) before its text, with its problems and a Dismiss button. Messages has one verb, post(level, text, problems?), at three levels (MessageLevel). Information (blue) reports what passes: a refusal of a change to what is open, wherever it is refused (the canvas’s through onrefuse, a panel’s, the store’s), a confirmation such as “Copied 13 11/16 ♩.”, a failure that can be repeated or worked around at once (a copy, a lookup), and why matches cannot be shown; it dismisses itself after infoDurationOf(text), 3 s (INFO_DURATION_MS) or, for a text of more than ten words, 300 ms a word (INFO_MS_PER_WORD), and replaces information of the same text still shown. A warning (amber) reports something asked for and left undone for a reason other than the change itself (a file not opened for what was picked with it, a table no manifest names, addresses that could not be selected, autosave active elsewhere), an error (red) an operation on a file or a server that failed (a refused file, a failed save, a failed autosave); both stay until dismissed. Screen readers hear every message through two visually hidden regions present from the bar’s first drawing, role="status" for information and role="alert" for warnings and errors, each holding one line per message shown, its level’s word and its text; the cards carry no live role, and no message takes the focus. A component below the editor posts through the component context, postOf(), which gives it the editor’s post; the workspace session and the autosave take post as an option. The same context carries what the editor holds once for every part: the user (The user), the type profiles (Type profiles), the lookup (Lookup) and the picking of an element on the canvas (Picking); transient.ts gives a control the way to show a value on the canvas before committing it (provideTransient, transientOf; the Wedge slider of the Timestamp tab). The drawer renders the inspector only while it is open; the unapplied text, the drafts and the chosen tab live in the drawer and survive closing. The header shows the title the page gives it, a snippet, else a plain name that is no heading, so an embedded editor adds no heading to its host. The health check is the client’s connect(server).health(), made once when a server is given; an answer that is not a name, a version and a timetoalign version, each a string, with a timetoshare version, where it has one, a string or null, and files, where it has one, a boolean (absent, it is read as true), fails as an answer outside 2xx does.
App.svelte is the standalone page tilie serves, and the one host that owns a document: it writes the title (• while unsaved, then the file name and “– TimeLineEditor”), styles html and body, takes the server’s token from the URL fragment (page.ts), gives the header the page’s one level-1 heading, and mounts the editor with server: {url: "api/", token}, the storage slot current and the keys tilie.inspector.open, tilie.user and tilie.profiles, window shortcuts, autofocus and the test hook. A browser keeps what a page stores by its origin, port included, which is why tilie serves on one port by default (The server).
MatchClaim tables#
A block’s MatchClaims are read from its package’s MatchClaim table, a Parquet file beside the manifest, which the manifest names as a resource of type MatchClaim (MatchClaims and potential MatchStamps). The editor holds at most one per block (MatchClaimTables, matchClaims.svelte.ts, owned by the workspace session): the server’s answer for the table, the file it was read from, its name and whether a belief has changed it. Tables are held for the session only, never written to the workspace file, and dropped when another workspace is opened. Every other resource a manifest names, a Projections table among them, is neither read nor dropped. Matches need a running server: a MatchClaim table is read through tilie-server, which checks it against the block’s manifest (POST /api/match-claims, The server), and only once the server has answered its health check. The session hands the tables two facts apart: whether the server computes (computes, it answered its health check), which is all that reading a table, recording a belief and answering provenance and events need, and whether it offers files (files, the editor’s fileHost, given where the health answer does not say "files": false), which only looking for a table beside a manifest’s file and locating a manifest need. A public server computes and offers no files. While none is given, or the one given has not answered, nothing is read and nothing asked: no table, no MatchClaim’s provenance or events (provenance and events give null), no belief recorded (believe answers unavailable’s text), and MatchClaimTables.unavailable says why, in plain text: “Matches need a running tilie-server. To start it, run uv run tilie –static-dir ../app/packages/editor/dist in the repository’s server folder (or tilie, once installed with pip install tilie-server), then open the editor at the address it prints.” (HOW_TO_START_A_SERVER); after a failed health check the failure comes first, as the header’s offline mark gives it (“The server did not answer the health check (<message>).”). That text is the hint and title of the Matchstamp tab’s Load MatchClaims… and belief buttons, which it disables, and what an expanded MatchClaim shows in place of its events and, under its Provenance button, of its provenance. Show matches posts HOW_TO_START_A_SERVER alone, as information, which stays for its reading time (infoDurationOf); a failure of the health check is shown by the header’s offline mark and those controls. While the server given has neither answered nor failed its health check (MatchClaimTables.waiting), nothing is posted; once it answers or fails with Show matches on, the editor follows the outcome as a press of M then would (checkHealth): answered, it loads the named tables; failed, the information is posted once.
Where a manifest came from. A block may know a place from which the files its manifest’s resources name, at locations relative to the manifest, can be read (ManifestSource): the folder of the manifest’s file on a server that offers files, where the workspace states the block’s location (The workspace view), read through GET /api/files (serverSource), which serves nothing in a hidden folder (a table there is warned of as “<location> could not be read from where the manifest came from: …”), or, in a test build, the Fixture menu’s table fixture served beside its table. A manifest picked in the browser, or one whose location the workspace does not state, has none, since a browser gives no access to the files beside a picked file.
Loading. A table is loaded in three ways.
Turning Show matches on (
onmatches, Show matches) loads, block after block in the canvas’s one order of blocks (the arranger’sblocksInOrder), the MatchClaim table every block’s manifest names that is not loaded (loadNamedTables,MatchClaimTables.loadNamed): a table the manifest names by an absolutehttporhttpsURL fetched from that URL by the browser, any other from where the manifest came from, where the table lies there; either without a question, else as the user chooses it in one question per block (after a URL that cannot be fetched, the fetch’s message shown, the question of Load MatchClaims…); while no server can read a table nothing is asked: where no block holds a table, or a block’s manifest names a table the block does not hold, the message bar gets one information,HOW_TO_START_A_SERVER, in place of every question, none while the health check has not answered yet, its outcome followed then (MatchClaim tables); where no block holds a table once the tables are loaded, the information “No MatchClaim table loaded.” (NO_MATCHES).Load MatchClaims… in the Matchstamp tab asks for the MatchClaim table of the block it shows (
choose) in the same dialog, a table without a location where the manifest names none.Import manifest… and Open… in the browser pick several files at once, manifests or a workspace with
.parquettables beside them (openFiles,withMatchClaimTable,readTables): each table is a MatchClaim table, taken by the block whose manifest names a MatchClaim table of its file name, else by the only block, else not loaded, with the warning “<file>was not loaded: no manifest picked with it names it.” Open… opens one workspace file at a time and warns about any other.
The user chooses in the tables dialog (TablesDialog.svelte, on the dialog shell), one question per block, which a URL field answers in every case (a relative URL is read relative to the page):
with the server’s files and no location of the manifest, “Where is
<manifest>?”: Locate… opens the file dialog on manifest files; the file chosen becomes the block’slocation, so the table is read from beside it now and whenever the workspace is opened again, and a folder not holding it is a warning (”<url>is not beside<file>.”);with a location whose folder does not hold the table, “
<url>is not beside<manifest>, at<path>”: Locate… opens the file dialog on MatchClaim tables, starting beside the manifest, for the session;for Load MatchClaims…, “Load the MatchClaim table of
<manifest>”: Locate… opens the file dialog on MatchClaim tables, starting beside the manifest where its location is known;without the server’s files, wherever a manifest names a table by no
httporhttpsURL and no served example holds it, and for Load MatchClaims…, “Load the MatchClaim table of<manifest>”: Locate… opens the browser’s picker for one.parquetfile (openFiles), whose bytes are the table, posted to the server as any other; nothing is kept of where it lies, so it is picked again after the workspace is reopened, and no manifest is located.
Locate… answers at once; Load takes an entered URL; Cancel and Escape take nothing. A URL or a path that cannot be read is an error. A table loaded through the dialog or from where the manifest came from is confirmed in the message bar (“Loaded the MatchClaims of <file>.”). A table the server refuses is not held; the error lists its problems by row, or says that the server did not answer or cannot read MatchClaim tables (501).
Reading on demand. The Matchstamp tab asks the server for what it shows of the MatchClaims of the MatchStamp it shows, and only of those: their provenance (POST /api/match-claims/provenance), once per table and list of claims, and, once one of them is expanded, their events (POST /api/match-claims/events), once per table and list of claims; each promise is kept while its tables are held, and a failed one is let go, so asking again asks the server again. A belief the user records goes to the server with the table (POST /api/match-claims/belief), which answers the new file; the editor reads that file through POST /api/match-claims again and holds it in place of the old one, marked changed. A changed table is kept only by Save MatchClaims…, which saves the file under the table’s name, through the same file access as a workspace; Save saves the workspace alone. New workspace, Open… and a workspace example, which drop every table, first ask about a table that a belief changed and that is not saved, in the one question that also names unsaved changes of the workspace (The header and the File menu); Load MatchClaims… over a changed table asks the same of that table in the tab. The editor holds one indexesOf for the canvas, the drawer and the Matchstamp tab (blockIndexes): a block’s anchor indexes under its MatchClaim filter, for the user as believer, under its manifest’s @context, with the user’s belief per MatchClaim, by which the canvas colours the anchors.
The inspector#
The inspector drawer opens from the « tab at the canvas’s right edge and closes with its » button; with a storage option the browser remembers whether it was open. It also opens when the first editor opens. It shows the block the whole selection lies in, with a WAI-ARIA tab list of nine tabs, always present, which wraps into rows where the drawer is too narrow for one (three rows at the drawer’s least width, two at its largest), the selected tab underlined: the level tab, named by the level in view (“Arranger”, “Bundle”, “Group”, “Timeline” or “Flow control”), then Properties, Regions, Metadata, Manifest, Journal, Timestamp, Matchstamp and Elisions (tabs.ts). The editing bar and the tab list never scroll; only the panels do, in a scroll container of their own, where a stamp tab keeps its name header at the top. A timestamp pinned on the canvas (Show coordinates), a named timestamp selected alone while Show coordinates is off, or a segment’s boundary selected alone, which pins the segment’s start unnamed (boundaryPinOf: the zero of its number type, read as a click there reads it), each of which also opens the drawer, selects the Timestamp tab, a pin on another timeline moves it, and a cleared pin returns to the tab shown before the first pin; the Timestamp tab itself stays. A potential MatchStamp pinned on the canvas (Show matches), or a named MatchStamp or one of its alignment anchors selected alone, selects the Matchstamp tab the same way; one tab shows a timestamp or a MatchStamp at a time, so showing either lets the other go. A shown MatchStamp is not shown, the tab kept, while it no longer holds: a named one removed, a potential one while its block’s anchor index is another than the one it was read from (the table, the filter or the user changed; after a belief the tab follows it, below); the drawer derives what it shows from the MatchStamp it holds, so one that holds again (an undone removal, a filter set back) is shown again, and any other selection lets it go. A selection changed to exactly one elision, stored ({block, id: E}) or automatic ({block, id: T, part: ["elision"]}, a gap the side-by-side arrangement cuts included; namesElision, elisionSelected), selects the Elisions tab as a choice of it would: it lets a pin and a shown MatchStamp go, so nothing switches back to the tab shown before, and the drawer stays open or closed as it was, a closed one showing the tab when it opens. Properties is chosen first, the level tab when an editor is already open as the editor mounts. While the inspector is shown, only a choice changes the tab: entering or leaving an editor keeps the chosen tab, the level tab renamed. An editor entered while the drawer is closed shows the level tab when the drawer opens again (the store’s openings differ from their count at closing); otherwise the chosen tab is kept. Only the shown tab’s panel renders its content. With no block selected and no unapplied text, Manifest shows the hint “Select a block to inspect its manifest.” The arrows, Home and End move between tabs; with Alt, Ctrl or Meta held these keys are left to the browser.
The editing bar. While an editor is open, a bar (a group named “Editing”) holds a green Done button, a red Cancel button and the editing path, a list named “Editing path” of the open editors’ names joined by “ > “: a bundle’s
name, else itsid, else “Anonymous bundle”, a group’s or timeline’sname, else its whole ID, and a flow-control editor “Flow control of<timeline>” (editorTitle). Cancel closes at once when the session holds no change to discard; otherwise the question dialog, anchored below the button, asks “Are you sure you want to discard 1 change?” (or “n changes?”), No focused. While the drawer is closed, Escape on the canvas still gives Done.The inspected thing. Beside the heading, the inspector names what is selected by kind and name, or id: “Bundle
<name>” or “Anonymous bundle”; “Group<name>”; “Timeline<name>”; “Card of timeline<name>”; a part by its element, as “Start of timeline<name>” or “Title of bundle<name>”; a measure map, conversion map or region by its kind, and a flow-control element by its role, as a jump, a jump target, a break, a section break or a barline; a band as “<Facet>band of timeline<name>” (Markers, Conversion maps, Children, Regions, Flow control); a named MatchStamp by its name, an alignment anchor by its ID. Several things are “N selected”. The words live in one module (words.ts), read from core’s resolver.The level tab. Its panel (
LevelPanel.svelte) opens with a title line, a console field (an inset line on a warm grey ground) set in IBM Plex Mono, bundled under the family name “TiLiE Plex Mono” (decisions/0026): the level’s word in spaced capitals, then the name of what the level shows, “Arranger” and the workspace’s name at the top level, “Bundle”, “Group”, “Timeline” or “Flow control” and the edited element’s name, as the editing path names it, in an editor (levelTitle). Below it the Arranger tab holds the Arrangement of the canvas’s blocks and the Bundle tab that of the edited block’s items: the canvas’s Arrange menu itself (the arranger’sArrangeMenuoverarrangeMenuOf, one model for both controls, so both show one stored state and send one command), disabled while the canvas is locked, a choice the store refuses posted as information. The Bundle tab also holds the Manifest file, Include styling and Minimal (ManifestFileSwitches.svelte, the Manifest tab’s own, disabled as there while that tab’s text holds an unapplied edit). The Group and Timeline tabs hold the title line alone.Properties. First a text field “Name”: with nothing selected it holds the workspace’s name at the top level and, in an editor, the edited element’s (
editedSelection), and is all the tab shows; with one thing selected it holds that thing’s name, the block’s manifest (its title), a group, a measure map, a timeline or its card, a conversion map, a region, a flow-control element, a FlowMap written by hand, a virtual timeline or its card, a named timestamp, a named MatchStamp or a stored elision, a part standing for its element; a band, a computed FlowMap, a chunk, an alignment anchor, a derived elision or several things, in one block or several, have none, and several blocks show the geometry hint below. Enter or blur commits it as onesetofname, Escape discards it, and an empty text states no name, a match timestamp’s included, except for the workspace, any other named timestamp and a named MatchStamp, whose empty name the store refuses. Below the name field, an Edit button (EditButton.svelte) opens the editor of the single selected address as Enter would (the arranger’sopenableandeditorOf), its tooltip “Open the editor of<name>” naming it as the editing path does; it is absent where the selection opens none and where the canvas opens no editor (opens, its rules’open). Below the name, a form for the geometry of what is selected, never the block’s when something inside it is, by the role of each selected subject, its fields the arranger’sfieldsOfin core’s place order: a block’sx,y,length,scale,spacing,margin,widthandheight, the last two labelled “container width” and “container height” in fields and refusals alike and standing side by side in one row; an item (a frame, or a block-held card, selected by the box, the timeline’s line or a part of it, or a frame’s title) the same members of its place; a card held by a frame its group’slengthandscale(“group length”, “group scale”) and its ownspacing,margin,widthandheight, of the card in the frame being worked in as a resize handle’s (Resizing): with no frame known and a card address covering several cards, there are no fields. A field shows the stated value, else the drawn one (the arranger’sshownValues, whichplaceEditreads too), rounded to at most two decimals. Several selected things of one role are edited together in oneset; a field whose values differ shows “mixed”. A selection of different roles, or of an element without a box, shows “Select a block, a frame or a card to edit its geometry.” Where every subject is a timeline, its card or a part of either, a disabled checkbox “Locked” (“Whether the timeline’s length is fixed”) shows their storedlocked, right of the container height, or after that hint for a timeline drawn without a card, indeterminate when they differ; it writes nothing. One selected band shows read-only rows: “Band”, “Level” (signed,−for negative) and “Elements”. Bands: where every subject is the card, the line or a band of one timeline, a root, a child or a virtual timeline, a table “Bands” (BandList.svelteoverdisplay.tsbandList) lists its bands in its band order (a child’s flow control band among them, which holds the child’s flow-control elements; a virtual timeline’s markers and regions bands, the bands it has), each with a checkbox “visible” read from the cascade the canvas draws with, the control of the band’s own display, declared as every display control is (below); a change is onestyleof the band’s own rule{element: band, addresses: [{id: T, facet: F}]}in the manifest’s own layer (controlCommand), writingdisplay: none, removing the property where the rest of the cascade then shows the band, or writinginlinewhere another rule hides it. Timelines: with the block alone selected, a table “Timelines” (TimelineList.svelteoverinspector/timelineList.ts) lists the cards the block holds in drawing order: each group’s frame, which reads “Always drawn” (a group’s members are reached by selecting its frame), each ungrouped root’s card, then each virtual timeline that no group names, by ID. A root’s and a virtual timeline’s row has a checkbox Visible: unchecked, a root is hidden by the rule Hide instead writes (rootDisplayCommand) and a virtual timeline’s card as Delete hides it (hideCommand); checked, the root’s rule is removed (rootHiddenreads it) and the virtual card’s place states its default scale alone,{scale: 1}, so the card lies at its default position. One selected virtual timeline, by its address{block, id: V}or its card, also offers Delete virtual timeline, oneremoveof{block, id: V}, which leaves its FlowMap and asks first, as Delete does, where it takes along virtual timelines made fromV(Delete on the canvas only hides its card; Selection, marquee and deletion). One selected flow-control element, itself or by its label (FlowControlDetails.svelteoverinspector/flow.ts), shows read-only rows, “Role”, “Coordinate”, “Manifestation” where it states one, “Ends the flow” for a break’sendsand “Status” under the user’s reading (readingOf, the user’s IRI and the block’s belief filter through core’sflowReading): “rejected by you: no flow reads it” where the user believes the elementfalse, “left out by the belief filter: no flow reads it” where they hold no belief and the filter leaves outundecided, “rejected by another actor: your flows read it” where it is read although someone else rejects it (the editor’s drawing follows the same reading and does not fade it; a drawing without a reading would); a jump lists its destinations under “Destinations” as buttons, each naming what its place names (core’sdestinationPlace: the jump target, region, timeline or child with its name, ID and the coordinate it reaches, the nearest section break of the root’s tree from the start of the timeline stating the jump up to the jump, else that start, or the placebyreaches), its conditions and its notation (manifestation and label): a press selects the jump with what the destination leads to, so the canvas marks both, and the jump stays inspected (flowOf; every arc of a jump carries the jump’s address, so the marks show all its arcs). Then its provenance as the other tabs show an entry, and under it the user’s belief, one button per belief word: a press is onesetof the element’sbeliefwith the user as the actor and today’s date, and a belieffalserejects the element, which stays in the manifest and is drawn faded. Nothing else of the element is edited there. One selected region, itself or by its label, shows its “Start”, “End” and “Length” read-only, exact in its timeline’s number type (regionRows). Display controls (DisplayGroups.svelteoverinspector/display.ts, the Timestamp tab’sDisplayToggles), each declared once (Declaration: the one rule it writes, the element types that rule names, and how its effect is judged;declaredreads every declaration the same way, the band list’s rows included): a flow control band’s properties offer Display (Arcs, Symbols, Forks) and Labels (Name, ID, Label, the words oflabel-display) for all its elements; a flow-control element’s offer the same for itself (a jump Arcs, Symbol, Fork; a break, a section break or a barline Line, Symbol; a jump target Symbol); a regions band’s and a flow control band’s offer “Atomic sections”. A control whose rule names no element of the manifest is not offered. An offered one is pressed as the cascade gives its elements, and is inert, disabled with its reason as its tooltip and as a line under its group, where a press would change nothing drawn: where every element it names lies under a hidden holder (its band, its timeline’s line, each ancestor’s children band and line, and, for a flow-control element of a child, its root’s flow control band, which lays it out: “The regions band of timeline ‘<name>’ is hidden.”), Arcs where no jump draws an arc (a destinationby0 or avoltaone draws none), a label where no element has its text, and a band’s Visible where the band holds no displayed element (“Timeline ‘<name>’ holds no regions; those of its descendants lie in their own regions bands.”). In a root’s flow-control editor an element’s controls act and a band’s are refused as outside it (No side effects). Each press is onestylein the manifest’s own layer, read against the cascade the canvas draws with: it removes the property from the toggle’s own rule where the rest of the cascade then gives the state asked for, else statesnoneorinline(a band’s toggle reads without addressed rules, so an element’s toggle overrides it); “Atomic sections” writes or removes{select: {element: region, class: "tts:AtomicSection"}, set: {display: inline}}. A field accepts decimal text only (0x10andInfinityare refused); typed text is applied as oneseton Enter or blur, and Escape discards it; an emptywidthorheightisnull. Every field writes the arranger’splaceEdit, so a field follows its level’s rules as a gesture does: alength,spacingormarginwrites what a Stretch to that value writes. Each container’s width and height is held to its own minimum, the smallest it takes, its content’s own extent: a value above it is written as given; at or below it a frame or a card states no size and is drawn at its minimum, as the Box gesture leaves it, while the block is given its minimum as a number; several containers edited together are onesetof each one’s own edit. When a typed value fell below a minimum, the message bar names the largest such minimum, as information: “To decrease the height below<m>px, decrease the size of the contained elements first.” (widthalike,<m>rounded to at most two decimals). A step (spin button, Up and Down, a wheel over the focused field) is onesetof its own: 1 forx,y,length,spacing,margin,widthandheightand 0.1 forscale, from the exact value or typed text, giving the exact decimal (0.2 + 0.1 gives 0.3). During a gesture on the selected block the fields follow its preview. A draft (typed and not committed) and a refusal belong to the containers they were typed for in the manifest they were typed against: they reappear while the form edits those containers, and go when the manifest is replaced. In a group or timeline editor the block’sscale,length,spacingandmarginare disabled; an item’sxandyare disabled everywhere but in the bundle editor.Group memberships. Below the geometry, on the arranger and in the bundle editor (a group or timeline editor changes only what it edits, and offers none), the Properties tab offers the memberships of what is selected (
groups.ts). For selected timelines in one block (a timeline, its card or a part of either; a virtual timeline or its card as well), a fieldset “Groups” holds a checkbox per group of the manifest, labelled by itsname, else its ID, checked when every selected timeline is a member and indeterminate when some are; a click puts every selected timeline that is no member into the group, or takes them all out of it when the box is checked, as onesetof each changed timeline’sgroups. For one selected group (its frame or its title), a fieldset “Members” holds a checkbox per timeline of the manifest, roots and children in the manifest’s order, a child indented by its depth; a click puts that timeline into the group or takes it out. For selected timelines, or the block alone, a button “New group” adds a group of the selected timelines in selection order, or an empty one, as oneadd, the command leaving the group’s ID out, so that core mints it (group_…). Each command is the one core takes: a checkbox or the button whose command core refuses (a timeline that would hold or lie inside another member) is disabled, core’s message its tooltip. A refusal of the store is shown in the tab’s status line until the next command or another selection.Regions. The regions of one timeline (
RegionsPanel.svelteoverinspector/regions.ts): a selection of one timeline, by its card, its line, one of its bands, or one of its regions or their parts, lists that timeline’s regions, then those of each descendant holding one under a heading (its name, else its ID), in pre-order and canonical order; while every subject is a region, or a part of one, of the timeline listed before or of one of its descendants, the tab keeps listing that timeline (regionsOf’slisted, kept while the panel is mounted), so a row pressed keeps the list it was pressed in; anything else shows the hint “Select a timeline, its card or one of its regions to list its regions.” A row’s head (its ID and type) selects the region, a selected region’s row marked; its Name, Start and End are fields, the values exact in the axis’s number type with its pretty unit beside, each committed as oneset, a refusal shown below the field as in Properties (the field drafts ofpropertyDrafts.svelte.ts, which the Elisions tab shares); × Remove is oneremove. An atomic section (core’sisAtomicSection) is a read-only row without Remove. Add region adds oneaddof a region over the whole selected timeline, from 0 to its length, or to its reach where the length is not known, its ID left to core, which mints it.Metadata. The statements of one element (
MetadataPanel.svelteover the modules ofinspector/metadata/), as TimeToShare’s description specification defines them; every pair and annotation is built and changed by the schema package’s statement functions on the manifest’s skeleton, its catalogue gives every verb, vocabulary and pattern offered, and TiLiE defines no part of a statement. The element (shownOf) is the one selected: a block’s bundle, through the block or its title; a timeline, selected directly, through its card, one of its bands or a part of it; or a region, or its label. With nothing selected it is, in an editor, the edited element, and at the top level the bundle of the one block when the workspace holds exactly one. Several selected things, or nothing selected among several blocks, show “Select a block, a timeline or a region to see its statements.”; any other element, a group, a conversion map, a measure map, a flow-control element or a named timestamp, says that it has none (“Group ‘Choir’ has no statements: a bundle, a timeline or a region has. Select its block, a timeline or a region.”). The panel opens with the user line, “You state as<name>.” (with “(ORCID iD<iD>)” where one is given) and Change…, which asks for the user (The user), then the list “Statements of<element>” in core’s words. A pair’s provenance entry holds how it was made (its paradata) and who believes it (beliefs, one per actor,"true","unlikely"or"false"); the tab derives no status from them and shows none. The user is the actor of every belief the tab records, by the IRI that names the user (statedBy).Tiles. One tile per verb about one thing (
rectanglesOf, TimeToShare’srectangles;Rectangle.svelte), “is a” always first, a group (role="group") labelled by its heading, collapsed to its sentence: the verb in words and the thing’s label, with the thumbnail of the first of its things whose answer has one. TimeToShare’srectanglesjoins the pairs that read one verb the same way where both are “is a”, where they name a common thing, or where their value nodes carry the samelabel, so two vocabularies naming one work by two identifiers give one tile. The first tile’s sentence says what the element is (typeSentence): its name, else its ID, and the catalogue types its “is a” states, as few as name every pair (typeLabels), a pair no type names as written (“C.Debussy - Clair de Lune, Maria João Pires live at Jardin Musical is a video.”); where nothing says what the element is, “Nothing states yet what<name>is.” with State what it is. The heading is a disclosure button with a chevron; expanded, the tile shows one bordered row per pair, property and value as the file writes them (rel:prf,schema:byArtist,wdt:P175), a value that is a web address a link opening in a new tab, each row with a Provenance button (named “Provenance of<property><value>”), then, while a vocabulary of the verb remains unused, “+ Add vocabulary”. Every IRI the tab shows reads as a slug,prefix:local, like any other ID, the full IRI its title (iris.ts,shownIrioveririNames): a thing of a catalogue system by the system’s prefix, else its slug word (mbidfor MusicBrainz), else the system’s ID (youtube:,doi:); any other IRI by a namespace of the catalogue or of the manifest’s@context; an IRI neither knows as written.Provenance. A pair’s Provenance button (
Provenance.svelte, collapsed at first, each row keeping its own open state, its region following the button across the row’s whole width) opensProvenanceDetails.svelte, the one provenance view, which the Matchstamp tab shows for a MatchClaim too, over one data shape of a pair’s entry and a MatchClaim’s (provenance.ts:lineOf,beliefOf,paradataRows,whoOf): its paradata (stated by, method, service, basis, match, note, date, in that order, those the entry states, the service as code, IRIs as slugs; a pair without an entry “No provenance entry: the manifest states it.”), its beliefs in a list named “Beliefs” (”<who>believes it<belief>(<date>):<note>”, date and note where stated; “No one has stated a belief.”), and the actions: the user’s belief, True, Unlikely and False, the one held pressed (aria-pressed), and, for a stated pair, Remove. Who is the viewer’s own name, an ORCID iD, a name decoded from TiLiE’stag:IRI, “TiLiE” for the editor’s own IRI, else the IRI as a slug (whoOf); every actor, and everystated_by, is read as the IRI it stands for under the manifest’s@context(core’sactorIri), so the user’s belief is found under a compact spelling too. A belief (withBelief) replaces the user’s earlier one and never unstates the pair: believing a stated pair false records the belief, and Remove is the action that takes a pair and its entry out (withoutPair); the focus then moves to the tile still holding the rectangle’s other pairs, else to the next tile, else to “+ Add statement”.Candidates. Two native disclosures below the tiles (
Candidates.svelte,candidatesOf, TimeToShare’scandidates): “Candidates (n)”, the pairs held only in provenance of the element and of its value nodes that the user does not believe false, and “Believed false by you (n)”, those the user does, which are not offered again; another actor’s belief false leaves a candidate offered to the user. Each row is its sentence with a Provenance button opening the same view, the actions True, Unlikely and False: True states the pair (withPairwith the user as actor), its entry kept as made with the user’s belief"true"; False sets it apart; Unlikely keeps or brings it back among the offered. While the element or an element below it states names without an identifier (value nodes with alabeland noid, under a verb a looked-up system can state), the first list offers “Propose matches for unreconciled names” with their count, “n names without an identifier here and below” (proposals.ts): each name is looked up once per system and kind, Wikidata’s candidate first, then the GND’s and MusicBrainz’s, and the best one is written as TiLiE’s candidate (withCandidate,stated_byTiLiE’s IRI, no belief)reconciledby its service,matchexactwhere the service reports a match and none where it says nothing, its note naming the name in words; a pair the element states already, or has any entry of, is passed over, so a match believed false is never proposed again. All candidates are oneset, and the message bar says how many went where (“Proposed 3 matches: 2 here, 1 on timeline ‘clt_6’; each is listed under Candidates of the element it is proposed for.”). Believing such a candidate true states the identified thing in place of the one name it can be for, found by structure (statedForName: the only name under a property of the same IRI on the candidate’s subject), the name’s node keeping its label; where several names could be the one, the candidate is stated beside them. The note is never read back.The composer. “+ Add statement” opens it below the rectangles: three fields, each a combobox (The combobox) narrowing the next. Verb: “is a”, then the verbs usual for what the element is said to be, then the rest of the catalogue, an inverse reading after its direct one, then “Other property…”. Vocabulary: the systems with a pattern of the verb, those whose lookup searches the verb’s kind of value where the catalogue’s fallback states it with a thing (“Other vocabularies”), and “An element of this manifest”; a Form select where the pattern has alternatives, and a field per named slot (an agent’s role). Value: searched in the chosen system as it is typed (
search.svelte.ts, one request after a pause, the previous one aborted), each candidate with its thumbnail, label, description and IRI; for “is a”, the catalogue’s types; for an element of the manifest, its timelines and regions as#idand name, or one picked with “Pick on the canvas”, which shows “Pick a timeline or a region on the canvas; Escape cancels.” while it waits (Picking; a pick in another block, or of the element shown, is refused with a message). Enter without an option takes the text as an address the catalogue recognises, an identifier of the system’s thing, an IRI for “Other vocabularies”, or a literal where the pattern takes one, else says “’<text>’ is no value of<system>.”; “No results; press Enter to take “<text>” as written.” says so. A URL pasted into any field that TimeToShare’s catalogue recognises (recognize) fills Vocabulary and Value, its label filled when the lookup resolves it, and clears a verb that system cannot state; an address it does not recognise is refused with “The address is no identifier the catalogue knows; choose “Other property…” to state it.” “Other property…” states one pair of any property, a compact or absolute IRI, whose value is a thing (an IRI), a text, a text in a language or a date. In “+ Add vocabulary” mode (“State it in another vocabulary”) the verb is the rectangle’s, the vocabularies are those it does not use yet, and the values first offered are the cross-references of the rectangle’s first thing, what the lookup resolving it says other systems name the same thing; a value there naming another thing is tied to the rectangle’s byschema:sameAs, and the tie is recorded in the value node’s own provenance:inferredby TiLiE today, with the rectangle’s thing asbasis, the note “written by “+ Add vocabulary” to keep the value with the thing it was chosen for” and no belief (tied). Add states the pairs in onesetwith one entry each:stated_bythe user (statedBy),datetoday in the viewer’s time zone andmethodmanual, orreconciledwith itsservicefor a searched candidate, withbasisthe rectangle’s thing and matchexactfor an offered cross-reference; and the user’s belief"true"of today. Add is disabled while its pairs are missing or already stated, and a line says why (“Choose a verb.”, “Choose a vocabulary.”, “Choose a value.”, “This is already stated.”). Cancel closes the composer and gives the focus back to the button that opened it.One command per action. Every action, an Add, a belief, a Remove, a candidate stated, a set of candidates, is the one
set(commandOf) of thestatementsandprovenanceof every element whose members it changed, so undo and redo take one step per action; a throw of the statement functions (“The statement could not be changed: …”) is posted to the message bar as an error, a refusal of the store as information. The composer belongs to the element it was opened on and is hidden when another is shown.
The manifest as text. The Manifest tab holds the format switch (
FormatSwitch.svelte, a segmented control shared with the Timestamp tab, as are the codecs offormats.svelte.ts), the Include styling and Minimal checkboxes (ManifestFileSwitches.svelte, which the Bundle tab shows too), the text, Apply and Revert, the problems and the warnings. The text is JSON, pretty as the schema package writes a manifest file in that serialization, YAML or TOML; YAML (decisions/0024) and TOML (decisions/0025) are loaded the first time they are chosen. Numbers stay exact in all three. The text shows the manifest as Export writes it, its file value (manifestFileValue: every ID written#id, the full@context) under the block’s Minimal and Include styling, so its JSON and YAML equal the exported file, and Apply reads it as a file reads:withHeldIdsmakes the IDs bare and the onesetcarries the bare manifest. Apply, or Ctrl+Enter (Cmd+Enter), dispatches onesetof the block’smanifest; a text that stands for the stored manifest dispatches nothing. A refused text stays as typed with its problems: a syntax error at its line and column (from the JSON reader’s position), any other problem at its JSON pointer into the text, the path of a refusal of the store led from the bare manifest into the file form (idFormPath). While the same block stays selected, an applied YAML or TOML text is patched in place, so comments are kept. Apply and Revert are enabled exactly while the text differs from the text shown; Revert shows the stored manifest. While the text holds an edit the format and options cannot change (“Apply or Revert to switch”); a change of the manifest from elsewhere does not replace it, Apply still applies it to the block it was written for, and a notice says the manifest changed. An unapplied text survives a visit to another tab. While the text shows the manifest as written (no unapplied edit), it marks the lines holding each selected element, a band drawn over those lines behind which the text scrolls, and a new selection scrolls the text to the first of them, one line above it left in view (textPlace.ts): core’sresolvedPathgives where an address lies in its manifest (an element, the list of a band’s facet, a part where its element lies, the title atname), led into the file form; each codec finds the lines of that place in its text, JSON and TOML by scanning the text, YAML through the parser’s ranges, a member from its key and an item from its dash to the end of its value. TOML writes a list of tables holding lists (a timeline’sflow_control) inline on its key’s line, so an element in it marks that line. A jump selected with what one of its destinations leads to, as choosing that destination in the Properties tab selects them, marks the destination in the jump’stargetsand the elements it leads to. A place the text does not show (the styling left out) marks nothing. Apply is the one place where a manifest is changed past the commands’ guarantees: the text is checked only by the format’s own load (schema, validators, segment-line covering), so a flow-control element can be added, deleted, moved, retargeted or relabelled there, and itsprovenance, beliefs included, rewritten or erased, which takes back its rejection; any statement and its provenance alike. The format still refuses a manifest it does not accept, such as atoof an element not rejected that names nothing, or anends.afterthat names no jump. An accepted Apply is one undoable step. Include styling and Minimal are the block’s manifest file, how Export writes it, and the text follows them; they are set on import as the file was written and are both checked for a block whose manifest came from no file, and each change is made through the store’sconfigure, saved with the workspace and never journalled or undone (The workspace view). The tab’s format chooses only the text shown, never the serialization Export writes. Unchecked, Include styling leavesgraphicalout of the text and refuses a typedgraphicalmember (“the styling is excluded; check Include styling to edit graphical”). Minimal shows the minimal form, read back in its complete form. The keys the schema does not declare are listed as warnings, “Unknown key<key>at<pointer>”, followed by the manifest’s own warnings (core’smanifestWarnings, TimeToShare’s warnings of its file value), such as “The manifest has statements but no ID; its subject is a blank node”, each at its place, both following the stored manifest. TOML has no null: a member that may be null and that the schema requires or defaults tonullis left out when null and read back as null, found by walking the schema along the value; a manifest holding any other null cannot be shown as TOML, and the inspector names that null’s path.Journal. One row per entry of the level shown, newest first, each with its time (
HH:MM:SS, UTC), its author and a text, every address in core’s words for it (addressWords: “timeline ‘Score’ in bundle ‘Mixed’”, read in the view shown): “Added<kind>‘<name or id>’ to<into>” (an added block by its bundle), “Set<properties>of<target>” (” and N more”; awidthorheightworded “container width” or “container height”, as in the Properties tab), “Removed<targets>”, “Styled<properties>of<addresses>” (or “of matching elements”), and for a closed session “Edited<kind><name>(n changes)” (“Edited timeline Score (2 changes)”, a flow-control editor’s “Edited flow control of Score (2 changes)”), or “Edited<address>(n changes)” once its target is gone. On the arranger it lists the main journal; in an editor its session’s entries, then the read-only rows of the earlier session of the same element, greyed below a heavier rule. A session’s row has a disclosure button listing its entries; a partly undone session reads “(n changes, k undone)”. Undone entries stay listed, grey and marked “undone” for screen readers, until redone or replaced; they are not saved.Timestamp. Its areas one below the other (
TimestampPanel.svelte, over the sections ofinspector/stamps/and the readers and commands oftimestamp.ts). While a timestamp is shown, first the name header (StampName.svelte, the Matchstamp tab’s too): the field “Name”, its label bold, which stays at the top of the pane while the pane scrolls. Naming an unnamed timestamp (Enter or blur on a non-empty name) is oneadd {into: {block, id: T}, timestamp: {name, coordinate}}on its anchor’s timeline, storing only its coordinate there with the defaultdisplay, andgroupstamp: truewhere naming gives a groupstamp (groupstampOf: on a group member, unless the innermost open editor is a timeline editor), after which the named timestamp is shown; renaming a named one is asetofname, and an empty name is refused in the panel (“A named timestamp keeps a name; Delete removes it.”), a match timestamp’s too, whose name the Properties tab deletes. While the timestamp is unnamed the field shows the placeholder “Type a name to keep it”, hidden while it has focus, and under it the hint “Naming the timestamp stores it; then its display can be set and it can be deleted.”, which describes every control that waits for the name. Coordinates (StampCoordinates.svelte, the Matchstamp tab’s too), a bordered panel: while no timestamp is shown the hint “Turn on Show coordinates (C) and click a timeline to pin a timestamp. With Show coordinates off, click a timestamp to edit it.”, else the format switchEditor | JSON | YAML | TOMLand the timestamp’s values. A pin from the canvas is held with the line it was read on; while it is unnamed, the drawer reads it again at its anchor’s position whenever the open editor raises another root’s ancestor cards, and whenever a fresh reading there reads the group otherwise than the pin was read (a member’s pin read by its group on the arranger, then the member’s own timeline editor opened, and back), as a fresh reading there reads it: under that root, by the group where naming it stores a groupstamp (never inside a timeline editor), so its rows are those of the flag at its mark and of the timestamp named from it (heldPinOf, through the arranger’srereadPin). Editor is a table with one section per timeline the timestamp holds, top to bottom where the reading crosses each timeline, headed by its name, and one row per value (its coordinate and its maps’ values, top to bottom as drawn, core’stimestampRows), then three columns of small copy buttons headedvalue,value + unitandpretty, copying the value (copyValue), its raw text (rawText) and its pretty text (prettyTextwithoutdecimals), all three exact, each with a hover hint; a row whose value is not a number offers at mostvalue, and a value without a unit novalue + unit. Every value is shown exact in its field, as Copy writes it, never rounded, with its pretty unit (prettyUnit) beside the field (sfor seconds). Every coordinate and the value of every map that is invertible over its timeline’s span are editable fields; a map that is not is shown disabled with the hint “This value cannot be solved for a position, so it cannot be edited.” Enter or blur commits a typed value (parseAxisValue, thenpositionFor), Escape reverts it, and every other value follows: an unnamed timestamp moves its pin (pinAt), a named one is onesetof itscoordinateon its own timeline, which is its pin’s anchor, a segment’s included; a value giving a position outside that timeline’s[0, length]is refused bypositionFor, and a refusal stays beside the field. JSON, YAML and TOML show core’stimestampJson,{id, timeline, coordinate, name, display, mapping}for a named timestamp and{timeline, coordinate, mapping}for an unnamed one, with one Copy. The text is a readout of the timestamp, no manifest file, so its IDs stay bare; in TOML, which has no null, every member whose value is null is left out, at any depth (a map without a value at the position, a measure’s missing number or length), where JSON and YAML write the null. A copy is confirmed by an info message in the message bar. The loading of a format’s codec (“Loading YAML…”) and the refusal of a text go to one status line under the format switch, always present and collapsed while empty, so that screen readers announce them; empty refusal and status regions of both stamp tabs stay in the accessibility tree, collapsed to a 1 px box (StampPane.svelte). Properties (TimestampProperties.svelte), a two-column key/value grid, greyed and disabled while the timestamp is unnamed. Display: toggle buttons (aria-pressed,DisplayToggles.svelte) Wedge, Name, ID, Coordinate and Line (the wordcross_section), each onesetofdisplaywith its word toggled, in canonical order (timestamp.tsdisplayCommand, overtoggledDisplayanddisplayCommandofstamps/commands.ts, the one display toggle, which the Matchstamp tab’s Lines use too for timestamps and anchors, and whosetoggledDisplaythe Elisions tab’s Show uses for a stored elision’sdisplayand a root’selision-display). Wedge: the rotation of its wedge (WedgeRotation.svelte), a slider from −180 to 180 by 1 with the stops −180, −135, −45, 0, 45, 135 and 180 (ROTATION_STOPS) as its ticks and as a row of buttons under the track, each pressed while the value is its stop, PageUp and PageDown moving to the next stop above or below. During a drag the value shows beside the slider and the canvas draws the wedge and its labels turned by it, storing nothing: the control hands each new step to the editor (transientOf,transient.ts), which gives it to the canvas’stransientprop as aTransientCommand {block, command}, the command the release stores, drawn applied by core’spreview(the block as stored where it is refused), only that block’s node drawn again. The drag commits once, onchangeor on the release of the pointer that dragged it, whichever comes first; Escape during the drag, a cancelled pointer and the control’s removal withdraw the preview and keep the stored rotation; each gesture is onestylecommand of a rule of the block’s manifest addressed to that wedge alone (rotationCommand), and Default, offered while that rule states a rotation, sets it tonull, which removes the property, and the rule with it when nothing else is left. The value shown is the rotation the drawing gives the wedge, so a rule of any selector shows (wedgeRotationOf); while the wedge is not displayed the control is disabled with the hint “Turn the Wedge on to rotate it.” and keeps its value; an unnamed timestamp shows what naming would draw, 0. Group, on a group member, a match timestamp’s included (offersGroupstamp): the GroupStamp toggle, onesetofgroupstamp, shown for an unnamed timestamp as naming would store it, with the hint “A GroupStamp’s line crosses every member of ‘<group>’.”, naming the groups holding the timeline (holdingGroupNames, through core’sgroupsHolding); a groupstamp’s Coordinates hold the other members of its groups’ frames, each with its ancestors and the descendants its line crosses (Show coordinates). For a match timestamp, MatchStamps: the named MatchStamps whose anchors name it, each its name and ID. Then Delete, aremove. Coordinate granularity (CoordinateGranularity.svelte), a heading over one line at the pane’s bottom with Denominator and Decimals, each with a hover hint, each change made through the store’sconfigure, so it is saved with the workspace and never journalled or undone; a value the store refuses stays typed with its refusal until the field is left. Every value, position and text is core’s; the panel lays them out, reads typed text and sends commands.Matchstamp. Its areas one below the other (
MatchstampPanel.svelte, over the sections ofinspector/stamps/and the readers ofinspector/matchstamps.ts,inspector/matchstampLines.tsandinspector/claimProvenance.ts), for the block of the MatchStamp shown, else the block the selection lies in; the tab reads what it shows once and hands it to its sections. It reads the block’s table (MatchClaim tables) as two anchor indexes (matchIndexes, reached through the editor’s oneindexesOf), each built once per table, filter, user and manifest@context(the actors compared as IRIs, MatchClaims and potential MatchStamps): shown, under the block’s belief and timelines filters, which the overlay draws and a potential MatchStamp is read from, and compared, under the belief filter alone, which every named MatchStamp is compared with (core’scheckMatchStamp), so leaving a timeline out of the filter makes no named MatchStamp out of date; beside them the user’s belief per MatchClaim (beliefs), which the canvas colours anchors by. Timestamps and anchors are listed in the canvas’s screen order (Show matches), the one the flag uses, read under the root the innermost editor raises (the arranger’sraisedRoot), an anchor with its upper coordinate first and anchors by their first, then their second coordinate. While a MatchStamp is shown, first the name header, the Timestamp tab’s: naming a potential MatchStamp (Enter or blur on a non-empty name) is oneadd {into: {block}, matchstamp: {name, anchors, match_claims}}, its anchors in screen order read with no ancestor card raised, so what is stored does not depend on the open editor, and the MatchClaims behind it, after which the named MatchStamp is shown. What is named is the whole MatchStamp the table states, the compared index’s one holding the shown one’s first coordinate (stampToName), so a MatchStamp named under a timelines filter is not out of date the moment it is named; while that stores anchors the filter hides, a hint under the field says so (“Naming also stores 2 anchors on timelines the MatchClaim filter hides.”,hiddenAnchorsNote), and the tab still shows the shown MatchStamp’s coordinates, lines and MatchClaims. Renaming a named one is asetofname, and an empty name is refused in the panel (“A named MatchStamp keeps a name; Remove deletes it.”). While it is potential the field shows the placeholder “Type a name to keep it” and the hint “Naming the MatchStamp stores it; then its lines’ display can be set.” There is no Properties heading. Coordinates, the Timestamp tab’s component (StampCoordinates.svelte): while no MatchStamp is shown the hint “Turn on Show matches (M) and click a match line to pin a potential MatchStamp. With Show matches off, click a named MatchStamp’s connector to select it.”, else the format switchEditor | JSON | YAML | TOML. Editor shows, for each of its timestamps in screen order, exactly the rows the Timestamp tab shows for that timestamp (stampGroups, under the workspace’s granularity and with the canvas’s MeasureMap rows): a named MatchStamp’s match timestamp read through its own pin (the arranger’snamedPin, which adds the members of its groups where it is a GroupStamp), a potential one’s coordinate throughtimelinePin, nothing stored, read as a GroupStamp exactly where naming stores one (core’snamedAsGroupstamp: a match timestamp lying there keeps its owngroupstamp, a new one is a GroupStamp where its timeline lies in a group), so the Coordinates show before naming what they show after it; one group per timeline, top to bottom, every field disabled and greyed, with the same three Copy columns. Each group is captioned by how its timeline takes part: “stated by MatchClaims” for the coordinate’s own timeline, whose coordinate row is set in bold and the group barred at its left, so the coordinates the MatchClaims state stand apart from those reached through them; “ancestor”; “crossed by its line”; or “through group ‘<G>’” (“through groups ‘A’, ‘B’”) for a member a GroupStamp reads. JSON, YAML and TOML show the MatchStamp as one value with one Copy: itsidandnamewhere it is named,timestamps(each{timeline, coordinate}, the coordinate a coordinate dict),alignment_anchorsas pairs of positions intimestamps, andmatch_claims. Lines (MatchstampLines.svelte,stampLines): every dashed line of the MatchStamp in screen order, each anchor’s connector just before the line of its lower coordinate, so a chain of timestamps and anchors alternates as drawn. A timestamp’s entry names its timeline, its coordinate in pretty text and, once named, its match timestamp, with the Timestamp tab’s display toggles (a potential one showing a match timestamp’s default, Line alone) and, on a timeline in a group, its GroupStamp toggle (disabled while the MatchStamp is potential and pressed as naming will store it,namedAsGroupstamp; onesetof the match timestamp’sgroupstamponce it is named), and says “Also a line of MatchStamp<name>: a change shows there too.” where another named MatchStamp’s anchors name that match timestamp; an anchor’s entry names its two timelines and its ID, with the toggles Line and Name, each onesetof the anchor’sdisplay, and an anchor the table no longer states is marked red, “not stated by the table”. Every toggle waits for the MatchStamp to be named. MatchClaims (MatchClaimList.svelte): each MatchClaim behind the MatchStamp, a disclosure button (DisclosureButton.svelte, as wide as its words) with a chevron and its ID, collapsed at first. Expanded, one the table does not hold says “no table loaded” or “not in the MatchClaim table”; any other shows the events on both sides, read through the server once a MatchClaim is expanded, one request for all the MatchClaims held (while no server reads tables neither these nor the provenance is read, and the expanded MatchClaim showsunavailable’s text instead): per side its timeline by name, its event’s ID and name, or, where the side names no event, the sentinel it is, CHUNK (a position on a timeline that holds no event for it) or NOMATCH (no counterpart on this timeline), its meaning the sentinel’s tooltip (SENTINEL_TITLES), a CHUNK side followed by its name where the table gives one; then its certainty; then every actor’s belief with its date and note and the user’s own, True, Unlikely or False, the one held pressed, a group named “Your belief in<claim>” (ProvenanceDetails.sveltewithout the paradata, over the entryclaimEntryLinegives: once the server has read the provenance of the MatchStamp’s MatchClaims, the MatchClaim’s own entry, before that, while no server reads tables or where it could not be read, the beliefs the table’s columns hold); then a Provenance button that alone opens how it was made (Provenance.sveltewithout the beliefs), “No provenance entry: the table states none for it.” where it has none. Actors read as slugs, as in the Metadata tab. One status line under the heading says, while a held MatchClaim is expanded, which read is pending (“Reading the events…”, “Reading the provenance…”) or why one failed; the entries render once from settled values (Settlements,settlements.svelte.ts, which holds the promise asked for last and its settlement only), so an open Provenance stays open when a read settles. The belief buttons need a server that answered its health check (disabled otherwise,unavailable’s text their title) and wait while a belief is being recorded; pressing the belief already held sends nothing, and any other is recorded through the server with the user’s IRI (statedBy) as the actor, today’s date in the viewer’s time zone and no note, the table then held changed and the message bar saying “Recorded your belief<belief>in<claim>; Save MatchClaims… keeps it.”; the tab follows the MatchStamp into the new table, a potential one by its first coordinate still in the shown index (followedMatch), else it shows the hint. For a named MatchStamp (MatchstampActions.svelte) the table no longer matches, Out of date lists what differs, each kind with its items: MatchClaims missing from the table, MatchClaims the belief filter leaves out, Anchors gone, Anchors new, MatchClaims stating other anchors, MatchClaims new; and Update is onesetof the MatchStamp’sanchorsandmatch_claimsto those of the potential MatchStamp core’s comparison names, its anchors in the screen order naming stores, disabled with the title “None of its anchors is stated by the current table, so there is nothing to update from.” when there is none. Remove is oneremoveof a named MatchStamp, taking its anchors and the match timestamps no other MatchStamp names. Every MatchStamp command first closes every group and timeline editor, and a bundle editor of another block, as Done closes them, since an editor changes nothing outside what it edits (No side effects); a refusal shows beside its control. MatchClaim filter (MatchClaimFilter.svelte), at the pane’s bottom, for the block shown (“Select a block to load its MatchClaims and set their filter.” without one): the table’s line, “No MatchClaim table loaded.” or “<file>: N MatchClaims”, with “, changed” and the button Save MatchClaims… while a belief has changed it, and Load MatchClaims…, which asks for the table in the tables dialog, is disabled while no server reads tables, described byunavailable’s text (MatchClaim tables); then Timelines, a checkbox per timeline of the manifest, roots and children, and Beliefs, four toggle buttons, True, Undecided, Unlikely and False, the Timestamp tab’s toggles, all but False pressed by default. Each change is made through the store’sconfigureas the block’s entry ofmatchClaimFilters, saved with the workspace and never journalled or undone (The workspace view); every timeline checked is stored asnull.Elisions. Shown when an elision is selected alone (above), the elisions of what is selected (Elisions;
ElisionsPanel.svelteoverinspector/elisions.ts), read in the drawing the canvas shows, a gesture’s preview included (shownOf), from the cascade’s own rules and from the drawing’s exposures (Drawing.elisions), never from a drawing tried with a command applied: what a mode resolves to, the proportion, the depths and every gap are the exposure’s, and every action is one command, so one journal entry. Up to three blocks, one below the other, each a bordered tile whose heading is a disclosure button (DisclosureButton.svelte, the Metadata tiles’ and the MatchClaims’ too) reading the block’s kind, Timeline, Group or Elision, its title and its essentials (blocksOf): a timeline’s mode, with the count of its stored elisions in Custom; a group’s mode and count; an elision’s stretch in its timeline’s unit,, automaticadded for a derived one. The kind is told by its badge’s word and shape (square, round, dotted) and by the tile’s border (a timeline’s solid with a solid bar at its left, a group’s dashed with a double bar), never by colour alone. Every block is collapsed at first but the one holding the selected elision (the group’s where the group lists it, else the timeline’s) and the selected elision’s own; which blocks are open is kept in the inspector’s drafts (PropertyDrafts.opened,open), per block, and for the block holding the selected elision per that elision, so a block stays as it was left while another tab is shown or the drawer is closed; an action taken in a block (a mode, option or toggle chosen, a button pressed, a row clicked; not a value typed into a field) opens it under its own key (ElisionBlock.keeps; for the form, the key of the block holding its elision), so it stays open once the selection leaves it, until the user closes it; a timeline’s or a group’s disclosure button writes that key too, so a close made while the block holds the selected elision holds once the selection leaves it. With no block to show, the tab says “Select one timeline, card or group frame to edit its elisions.” Its blocks: (1) the timeline’s block, the root’s, wherever every subject is a timeline, a card, a part of either or an elision, all under one rootRdrawn whole (an ancestor card ofR, orR’s card as an ungrouped root; a virtual timeline that no group holds, by its address, its card or one of its bands, counts as an ungrouped root, its block reading its placed card’s played axis): titledParent timeline "R"for a root with an ancestor card, elseElisions of "R", its mode a radio group, Hidden, Full, Proportional and Custom for an ancestor card, Full and Custom for an ungrouped root, the mode shown being the exposure’s (Hidden where no card is drawn). A root drawn once behind a row of groups side by side (Arrangements) has one block for its one card, found from a subject under any group of the row hanging on it (ancestor.groups), its protected span running from its first anchor’s start to its last anchor’s end and its proportion the card’s, the least of its groups’; under “Side by side” (data-testid="arranged-gaps") it lists, read-only, every gap the arrangement cuts in it,between "G1" and "G2"with the stretch left out, and these gaps have no form. Each option is onestyleof the root’s rule, the one rule addressed{id: R, part: ["card"]}: Hidden sets itsdisplaytonone; Full setselision-modetofull; Proportional statesproportionalwhere stored card elisions exist, else removes the stated mode; Custom removes the stated mode where stored card elisions exist, else, from Proportional, is oneaddinto the block of the gaps the card derived, exactly as drawn (the arranger’sdefaultsStored), with a secondstyleremoving a stated mode where there is one, and from Full or Hidden statescustom; Full, Proportional and a Custom that stores nothing also remove the rule’sdisplay. WhereRis a member of a group, its elisions are that group’s: Custom stays focusable witharia-disabled, its reason below it (its elisions belong to group "G"). In Proportional: Proportion, Automatic (elision-proportion: auto) or a number (unticking Automatic states the proportion shown, which the field writes with at most six decimals); Rows, Automatic or a checkbox per depth of the member’s ancestors, deepest first, named by the timelines at that depth (elision-depths); Show, the display toggles Ellipsis, Name, Coordinate and Lines of every derived gap (elision-display); each astyleof the root’s rule. In Custom: the count, the stored card elisions the card draws (and, on a root drawn once side by side, those lying between its first anchor and its last, which the card does not draw, noted “not drawn while arranged side by side”), each a button selecting it (its name or—, its timeline, its stretch as its coordinate label writes it) with×, oneremove; Add elision, oneaddinto the subject’s timeline lying in the card (elseR) of the middle third of its longest stretch outside the protected span, standard gap; and Remove all, oneremoveof every card elision ofR(core’selisionsUnder, the arranger’sdefaultsRemoval). (2) the group’s block,Elisions in group "G", wherever every subject lies in one group’s frame (the frame or its title, a member card, a virtual member’s included, a timeline drawn in it, a group elision) and in a group editor with nothing selected: Full or Custom, onestyleof the frame’s rule{id: G}, the count and list of the group’s elisions (core’sgroupElisions), Add elision into the subject’s timeline where it lies inG, else the member whose card holds the selection, else the first member in display order, and Remove all. (3) the elision’s block, the form of one selected elision, titledElision on "T": From and To in its timeline’s unit, typed exactly (parseAxisValue, never through a float); the gap’s width, Standard (32), Proportional (of its natural width), As wide as (a stretch of its timeline) or Fixed (canvas units), a change of form converting the drawn width by layout’swidthAsso the gap does not move; Show, the display toggles of every word (Ellipsis, Name, ID, Coordinate, Lines,stamps/commands.ts, the one display toggle of timestamps, alignment anchors and elisions); for a group elision, Also elides, its elided coordinates on the other timelines of the frame (—without a value); and Delete elision; each onesetorremove. A derived elision’s form is read-only, with the hint “Choose Custom to edit”. The elision’s name is the Properties tab’s Name field’s. Typed text is held as a draft of the inspector’s drafts (PropertyDrafts) until Enter or blur, and Escape discards it.
Problems are rendered by one list, shared by the inspector and the message bar.
The user#
The editor has one user, the person viewing it (core’s User {name, orcid}, workspace/user.ts): a name, which the store records as the author of every command (setAuthor), and an optional ORCID iD, which names the user in the provenance of what they state. DEFAULT_USER is “Gerhardt”, the store’s default author, without an iD. readOrcid(text) reads an iD or its address (https://orcid.org/…, http://orcid.org/…, orcid.org/…), white space trimmed and its check character verified (ISO 7064 MOD 11-2), as the bare iD, else null. statedBy(user) is the IRI stated_by names the user with: https://orcid.org/<iD>, else, since a name is no IRI, the tag IRI tag:timetoalign.github.io,2026:tilie:user: followed by the encoded name (USER_TAG); the editor’s own proposals are stated by TILIE_AGENT, https://github.com/TimeToAlign/TimeLineEditor.
The editor holds the user in UserState (user.svelte.ts), read once at mount from the browser’s localStorage under the storage option’s userKey (tilie.user on the standalone page) as JSON {name, orcid}; a stored text that is not that, no key, or storage that is unavailable gives the default user, and a change then holds until the editor goes. File, Your name… and the Metadata tab’s Change… open the “Your name” dialog (UserDialog.svelte, a native modal dialog): Name and “ORCID iD (optional)”; Save, or Enter in a field, takes the answer once a name is given and the iD, where given, reads as one, makes it the user, remembers it where storage allows and makes it the open store’s author; Cancel or Escape changes nothing. The user belongs to the viewer: no setting, command or workspace holds it, and a workspace shows it only as the author of its journal entries, as stated_by of the pairs the user stated and as the actor of the user’s beliefs.
Lookup#
The Metadata tab looks values up through one Lookup (src/lookup/, decisions/0028), which the editor makes once, createLookup({server, services}), and gives every part through the component context. It asks each system only where it can, and a system it cannot ask sends no request:
System |
Asked |
Searches |
Resolves |
|---|---|---|---|
|
from the browser (the Action API: search with statement filters, |
every kind |
yes |
|
from the browser, through lobid-gnd |
works and agents |
yes |
|
from the browser, through oEmbed |
nothing |
yes |
|
only through |
works, agents, recordings and releases |
yes |
|
from the browser, at its endpoint |
every kind |
no |
search(system, kind, text) gives the things of a kind of value (work, agent, recording, …) a system finds for a text, resolve(system, iri) the thing an IRI names, and reconcile(system, kind, texts) the best candidate for each text, one request for all of them where the service is a Reconciliation Service API endpoint; a candidate has an IRI, a label, a description, a thumbnail, its cross-references (the things other systems say it is the same as, the IRIs TimeToShare’s catalogue recognises among them) and service, the upstream endpoint it came from (https://www.wikidata.org/w/api.php, https://lobid.org/gnd/search, https://www.youtube.com/oembed, https://musicbrainz.org/ws/2/, a service’s own), never the local server. A failure is a LookupError naming the system, shown beside the Value field or in the message bar while the other systems go on; an aborted request rejects with the signal’s reason. The viewer’s services are Reconciliation Service API 0.2 endpoints (services.ts, over the generic ReconciliationClient that also reaches the server’s endpoint): a search asks the service’s entity suggestions where its manifest offers them, else one reconciliation query, and an entity’s IRI is the service’s identifier space followed by its ID.
What leaves the browser, and when: the text typed into the Value field, to the chosen system’s service, once typing pauses, the request it replaces aborted; a recognised pasted address, resolved to fill its label; on viewing the tab, every thing each tile names whose system is resolvable, each IRI resolved once, for the tile’s thumbnail (thumbnails.svelte.ts, kept for the panel’s life; an image is never written to a manifest); on “+ Add vocabulary”, the rectangle’s first thing, resolved for its cross-references; and on “Propose matches for unreconciled names”, the names stated without an identifier. So merely viewing the tab sends the IRIs of the manifest’s things to Wikidata, the GND, YouTube or the server, and each service sees the viewer’s address and the page’s origin, as with any link followed. An editor mounted with lookup: false is given NO_LOOKUP, which searches, resolves and reconciles nothing and sends nothing; its Metadata tab still takes identifiers, pasted addresses, elements of the manifest and “Other property…”.
Type profiles#
A type profile is a type of thing of the viewer’s own (profiles/profiles.ts): an id and a label, its “is a” alternatives per catalogue system, each a statements fragment without slots, the verbs usually stated of such a thing, in the order the composer offers them first, and the systems its values are preferably looked up in. Beside the profiles stand the viewer’s lookup services, {id, name, endpoint}, each the system service:<id>, offered wherever a verb’s fallback pattern takes a thing. The catalogue the Metadata tab offers is TimeToShare’s with the profiles (withProfiles): a profile of a catalogue type’s ID replaces that type, the others come before the catalogue’s types, so a profile’s verbs lead where its “is a” is stated. Profiles and services are application settings of the viewer, never part of a workspace or a manifest. They travel as a canonical YAML file, profiles.yaml, {profiles, services}, read by readProfiles, which names the path of the first problem. The editor holds them in ProfilesState (profiles.svelte.ts), read from localStorage under the storage option’s profilesKey (tilie.profiles on the standalone page) as that file’s text and written there on every change; a stored text that is no profile file gives none, and without the key storage is never touched and the profiles hold until the editor goes, so an embedded editor stores none unless its host names a key.
File, Type profiles… opens the “Type profiles” dialog (ProfilesDialog.svelte, a native modal dialog) over a draft: it lists the profiles, adds one, empty or from a catalogue type (“New profile from”), edits the selected one (ID, Label, “Is a” per system from the catalogue’s patterns, Verbs with Move up, Move down and Remove, “Look values up in”), deletes one, and lists, adds, edits and deletes services, a service’s new ID or its deletion followed in every profile’s lookup systems. Import YAML… replaces the draft with a profile file, Export YAML… writes the draft as one; Save checks the draft and makes it the editor’s profiles, Cancel and Escape drop it.
The combobox#
The composer’s fields are the editor’s own combobox (src/combobox/, decisions/0027), after the WAI-ARIA Authoring Practices example “Editable Combobox With List Autocomplete”: typing never selects an option; the focus stays in the text field, which names the active option through aria-activedescendant; the listbox holds the options alone, and a message for an empty result lies beside it; a visually hidden status region announces the count or a running search. Its keys are one pure table (keys.ts): the arrows open the list and move the active option, Enter picks it, Escape closes a shown list and, with none shown, clears the text; a key the table handles is consumed, so an Escape that closes the list never reaches the drawer. An option is picked on the primary button’s release, the press in the list cancelled so that the field keeps the focus. The options, the loading flag and the text belong to the field’s user: a search is driven through a function binding of the text, and an active option that a shrinking list no longer holds counts as none.
About#
The About dialog shows the editor’s version, the server’s name and version with its timetoalign version (“offline” with the reason, or “no server” when the editor has none), the TimeToShare package and schema version, the workspace packages, and the third-party software in the bundle with its licence and copyright lines. Both builds write THIRD_PARTY_NOTICES.txt beside their output with the full licence text of every bundled npm package, of the canvas control icons copied from Svelte Flow and of the three bundled fonts, DejaVu Sans and Noto Music for the drawings and IBM Plex Mono for the inspector’s title line; the dialog links to it, and the wheel ships it.
Embedding#
The editor runs in any page, not only in the one tilie serves. A host page loads the stylesheet, imports mount and hands it one empty element with a definite height:
<link rel="stylesheet" href="tilie/tilie.css">
<div id="timelines" style="height: 600px"></div>
<script type="module">
import { mount } from "./tilie/tilie.js";
const editor = mount(document.getElementById("timelines"), { shortcuts: "editor" });
</script>
mount(element, options) refuses an element that has children or already holds an editor, marks it data-tilie, and returns a TimeLineEditor handle: text() (the workspace as Save writes it), load(text, name?) (open without asking, returning the reader’s refusal or null), selection(), select(addresses) (address objects), focus() and destroy(), which writes the pending autosave, then removes the editor. Every option may be left out:
Option |
Default |
Meaning |
|---|---|---|
|
the empty workspace |
The workspace file text to open |
|
none: no request, About says “no server”, no MatchClaim table is read, and files are opened and saved through the browser alone |
|
|
none: no autosave, and neither the drawer, the user nor the type profiles remembered |
|
|
|
Whether the Metadata tab looks values up in Wikidata, the GND and YouTube and, with a server, in MusicBrainz (Lookup); with |
|
|
Where the file and undo shortcuts are taken: inside the editor, or anywhere in the window |
|
|
Whether the canvas takes the focus at mount |
|
beside |
The licence texts the About dialog links to |
|
Called with |
|
|
Called with the selected addresses whenever the selection changes |
An embedded editor never touches its host’s document: no title, no global style, no location or history, no window listener unless asked (but the keydown listener through which Escape cancels a pick on the canvas, held while a pick is awaited), no request to the server without server, no request to a lookup service with lookup: false, no storage without storage and nothing stored under a key it is not given, no test hook. Two editors on one page share no id and no selection. pnpm build:embed builds src/embed.ts into app/packages/editor/dist-embed/: tilie.js (its exports kept), tilie.css (every style), assets/ (the lazily loaded codecs and the fonts, by relative URL) and THIRD_PARTY_NOTICES.txt. Library mode is not used, since it would inline the fonts into the stylesheet. Inside a TypeScript workspace the same entry is @timetoalign/tilie-editor/embed.
Planned. tilie --allow-origin <origin>, repeatable and exact, so that a page on another origin may call a server its user runs locally (the public mode, The server, is another thing: a server serving its own editor to visitors): an allowed origin’s preflight answered without the token check, and responses carrying Access-Control-Allow-Origin and Vary: Origin, never credentials, the Host check unchanged. A Jupyter widget mounting the bundle with the kernel’s server and token. The bundle served by tilie-server to foreign pages. A read-only viewer of one block, built on the canvas’s readonly, which already writes nothing. How a WebSocket handshake carries the token, which a browser cannot send as a header, is decided with the command channel; the guard already closes a handshake from a foreign host or origin.
Not yet wired#
Two designs are kept as tested code that nothing but its tests uses.
Deleting a segment, a child of a segment line, leaves a gap in its line, and is refused. The design of closing that gap is kept as two modules:
core’s
manifest/segments.ts, the gap arithmetic: for a segment S of length l in the segment line Λ, left extends (the segment before S grows by l), right extends (the segment after S starts where S started and grows by l), left shifts (Λ’s offset grows by l and Λ shortens by l, so the later segments keep their place in the parent) and right shifts (every later segment moves back by l and Λ shortens by l); extending needs an unlocked neighbour on that side, shifting needs Λ unlocked, and shifting left needs Λ to be a child; a way is permitted only when the manifest it leaves passes the schema and the invariants; an unknown length stays unknown (segmentGapslists the permitted ways); core’s main entry exports only theGAPStable and theGaptypes, which the menu reads;the arranger’s
GapMenu.svelte, the menu that will offer those ways: a form named “Delete segment” with one fieldset, “Closes the gap”, of four radio buttons, each named after the neighbour that moves, a disabled one titled with why, the first permitted one chosen, then OK and Cancel.
The anchor index (MatchClaims and potential MatchStamps) holds two parts that Show matches does not draw yet, both exported from core’s main entry: the matched spans (AnchorIndex.spans, MatchedSpans: per interval MatchClaim passing the mask, in row order, its start anchor and its end anchor) and the segments of two timelines (segmentsOf(index, first, second), Segments: the anchors between them in the first timeline’s order and, per gap between neighbouring anchors, whether a matched span covers it, built on demand in one sweep; one timeline twice is refused). They are kept for tinting the areas between the start and the end of two matched intervals and the gaps between neighbouring anchors that no matched interval covers, and for the anchors a MatchStamp inferred between stated ones interpolates from.
The schema contract#
@timetoalign/timetoshare supplies the types generated from its one schema document, the validator of the current schema version, unknownKeys and manifestWarnings (which core reads through its file value), the description specification’s statement functions (withPair, withoutPair, withCandidate, withBelief, candidates, rectangles, samePair, expandIri, usedPrefixes, withContext) with FORMAT_CONTEXT and its catalogue of identifier systems, verbs and types (defaultCatalogue, recognize), the complete and minimal forms, the canonical order, the lossless reader and the writer of its serializations (canonical YAML, pretty JSON and RFC 8785 JSON), the manifest fixtures with their minimal twins, the rejection and warning cases, and the two drawing fonts with their one metrics table. It migrates nothing, and neither does TiLiE; the schema repository, not TiLiE, is the source of truth, and timetoalign proves conformance in its own tests.
Core is typed through the package’s typed forms: completeManifest(value: LosslessManifest): CompleteManifest, minimalManifest and canonicalManifest, where LosslessManifest is the schema’s type with every number a JsonNumber and CompleteManifest the same with every defaulted key present. parseJson throws JsonSyntaxError with the offset, line and column of the fault, which the inspector shows. The validators of both languages raise SchemaValidationError with a stable code naming the rule broken (not_a_manifest, schema, representation, finite_number, duplicate_id, dangling_target, conversion_map, child_unit, child_offset, child_end, segment_line, manifest_id, group_member, order_key, display_order, band_order, timestamp_timeline, timestamp_coordinate, match_timestamp, alignment_anchor, matchstamp, resource_timeline, resource_type, calendar_date, and for statements context, reserved_key, iri, element_value, provenance_duplicate, belief_actor), and refuse a number that is not finite at its path; core reports every such refusal as schema_violation with the validator’s path and message.
Until schema 0.2.0 is published on npm, every application package that uses the schema takes it through a link: to the js/ directory of the TimeToShare checkout beside this repository (link:../../../../TimeToShare/js), built there with pnpm build; the link: then gives way to @timetoalign/timetoshare ^0.2.0, and a later schema version not yet released is tried through the same link: (AGENTS.md). The editor’s tests let Vite transform the package (server.deps.inline), since the Fixture menu reads its fixtures as text.
The server#
tilie-server uses FastAPI and uvicorn (decisions/0008). It runs in one of two modes, which its settings carry as data and one guard, OriginGuard, enforces. A local run (tilie) binds only 127.0.0.1, generates a random token for each run, accepts only the Host 127.0.0.1:<port> or localhost:<port> and an Origin of http:// and one of them, and requires Authorization: Bearer <token> on every /api/ route. tilie hands the token to the browser in the URL fragment (http://127.0.0.1:<port>/#token=<token>), which a browser never sends to a server, so the token never reaches the access log; the page reads it, removes it from the address bar with history.replaceState, and keeps it in memory only, so a reload loses it. A public run (tilie --public-host <host>, repeatable, decisions/0038) binds 0.0.0.0, accepts only a Host equal to one of the given hosts as given and an Origin, where one is sent, of https:// or http:// and one of them, checks no token, and does not route the file routes (404); it refuses with 413 a request body over 16 MiB (body larger than 16 MiB, at once where Content-Length says so, else as soon as the bytes received pass it, before the route runs) and a posted MatchClaim table of more than 1,000,000 rows or over 128 MiB uncompressed (the sum of its row groups’ total_byte_size), read from its Parquet footer before any row; at most two computations on a posted body run at once, further ones waiting while health and the editor’s own files are never held behind them, and uvicorn holds at most 32 connections. It opens no browser and prints tilie: public mode on port <port>, answering as <hosts>; no token, no file access on standard error; --check, --root and --no-browser are refused with it. A foreign Host is refused with 403 forbidden host, a foreign Origin with 403 forbidden origin, in either mode, and every response carries Referrer-Policy: no-referrer. The server serves the built app from its wheel and implements GET /api/health, whose member files is true in a local run and false in a public one, POST /api/measure-maps, POST /api/match-claims, POST /api/match-claims/provenance, POST /api/match-claims/belief, POST /api/match-claims/events, POST /api/flows, POST /api/flows/flow-maps, /api/reconcile/musicbrainz and, in a local run, GET /api/folders, GET /api/files and PUT /api/files. POST /api/measure-maps reads the posted manifest with timetoshare’s loads (YAML or JSON, any serialization of the format; the editor posts the minimal canonical YAML of the manifest file, its IDs written #id) and converts it with with_bare_ids, answers each entry of its measure_maps, in order, with its rows as timetoalign’s MeasureMap.expand_rows expands them, the quarter-note values (qstamp, nominal_length, actual_length, offset_within_measure) as Fraction pairs, a measure’s volta as the map writes it (a pass from 1, or a non-empty list of distinct passes; the client keeps 1 and [1] apart), and every ID bare, and refuses with 422 and {detail: {path, message}} a body that is no UTF-8 text, no YAML or JSON, no object, writes an ID without # (at timetoshare’s path and message) or holds a measure map timetoalign refuses. POST /api/match-claims takes a package’s manifest file and its MatchClaim table in one body (decisions/0030): the manifest’s length in bytes as a little-endian 32-bit integer, the manifest’s text in any serialization, then the table’s Parquet bytes. It checks the table against the manifest with timetoshare’s match_claim_problems, reads it in the package form, each coordinate cell’s number written once, in the member its number type names, with timetoalign’s MatchClaimField.from_package_table, and answers in the same framing: a compact JSON header (format tilie-match-claims, version 1, the rows, the timelines with their number types, the actors, each the IRI timetoalign compares it as, the belief words and every array’s offset and length) followed by the columns of decisions/0029 and every row’s beliefs as little-endian arrays, each starting at a multiple of eight bytes from the answer’s start; it filters nothing. A body it cannot split or read, and a table the check refuses, are answered 422 with {detail: {path, message}}, a refused table with the check’s problems besides (each {code, row, column, message}); without timetoshare’s table checks or timetoalign’s MatchClaim table the route answers 501. Two routes read a MatchClaim’s provenance on demand and record a belief (decisions/0031); the server stays stateless, so each takes the whole body of POST /api/match-claims again, behind a little-endian 32-bit length and a JSON object of parameters (a parameter unknown or missing is refused with 422 at its name), and checks the table against the manifest as that route does. POST /api/match-claims/provenance takes {claims}, a list of MatchClaim IDs, and answers JSON {claims: [{id, provenance}]} in the order asked, each entry the MatchClaim’s provenance entry as TimeToShare defines it (its row’s own, else the one the file states for every row, read through timetoalign’s Provenance), its absent members left out, each belief’s actor the IRI timetoalign compares it as, or null; an ID the table lacks is refused at ["claims", i]. POST /api/match-claims/belief takes {claim, actor, belief, date} and answers the new table, application/vnd.apache.parquet: the manifest is read as timetoalign’s AlignmentBundle, the table’s MatchClaims are added to it, and the belief is recorded by its add_match_claim_belief (an actor’s earlier belief replaced in place, every other actor’s standing), the server building no provenance itself; the posted table takes the provenance column of the package table timetoalign writes (package_table), a provenance the file stated for every row now stated by each row, every other column and row kept, columns the table type does not declare and the file’s other metadata included; the new table passes timetoshare’s table checks against the manifest and its succession_problems against the posted table (422 with every problem otherwise) before it is answered, and nothing is stored on the server. Both answer 501 where the installed timetoalign cannot read provenance. POST /api/match-claims/events (decisions/0032) takes the provenance routes’ parameters, {claims}, then the body of POST /api/match-claims unchanged; it checks the table against the manifest as that route does and answers JSON {claims: [...]} in the order asked, each {id, timeline_a_id, event_a_id, event_a_name, timeline_b_id, event_b_id, event_b_name, certainty, is_synchronous} as timetoalign reads the MatchClaim table: an event ID is an event’s or, for a side without an event, one of the reserved strings NOMATCH_SENTINEL and CHUNK_SENTINEL, never null, and null is an event without a name. The client refuses an answer with a null event ID or synchrony as malformed. An ID the table lacks is refused at ["claims", i], and the route answers 501 where the installed timetoalign cannot read MatchClaim tables. The table route and the two provenance routes read the manifest as an AlignmentBundle, so a manifest timetoalign refuses is answered 422 with its message, and every actor is the IRI it stands for under the manifest’s @context, every prefix the context declares (timetoalign’s belief_context and actor_iri): a compact and an absolute spelling of one actor are one actor, as the editor compares them; a belief is stored with its actor as the request spells it, and a stated_by is answered as written. /api/reconcile/musicbrainz answers the Reconciliation Service API 0.2 of the W3C Entity Reconciliation Community Group for MusicBrainz (decisions/0028): GET gives the service manifest; queries=<JSON> (GET, or a POST form) reconciliation queries; extend=<JSON> data extension with the properties name and sameAs, the IRIs timetoshare’s catalogue recognises among an entity’s URL relationships; GET …/suggest/entity entity suggestions; GET …/properties the properties a type can be extended with. An identifier is <type>/<mbid>, so the identifier space http://musicbrainz.org/ followed by it is the entity’s IRI. One MusicBrainz client per application (tilie_server.musicbrainz) keeps MusicBrainz’s rules of use for every request the editor causes: one request a second, the next starting at least a second after the last, under a User-Agent naming the server, its version and its repository and no person, each answer kept for the run (the 1,024 least recently used), so a viewer’s repeated lookups reach MusicBrainz once; requests use the standard library’s urllib in a thread and form bodies are read with parse_qs. A malformed request is refused with 422 and {detail}, a failure of MusicBrainz is 502, and a request needing timetoshare’s catalogue answers 501 where the installed timetoshare has none. Three routes serve TimeLineEditor’s own files below the run’s root folder, the user’s home folder unless tilie --root <folder> names another (decisions/0033): GET /api/folders?path= lists a folder, its subfolders, then its files of the kinds the editor reads (workspace, manifest and table files: .tle.json, .yaml, .yml, .json, .parquet, in any case), each sorted by code point; GET /api/files?path= answers the bytes of a file of those kinds; PUT /api/files?path= writes the request’s body into a workspace file (.tle.json, in any case) and no other, through a new file beside it that then takes its place (os.replace), a replaced file keeping its mode. A path is POSIX and relative to the root, "" the root itself, and resolved with every symbolic link followed. No route lists, reads or writes a path with a hidden segment below the root (a name starting with .), as asked or as resolved, and a file’s kind holds for the name asked and for the file a link leads to. A listing leaves out hidden names and every symbolic link leading out of the root, into a hidden place, to nothing, in a loop or to a file of another kind; a link inside the root is listed as what it leads to. Refusals answer {detail: {path: ["path"], message}}: 400 “path outside the root” for an absolute path, a NUL character or a path resolving outside the root; 403 “hidden files are not served”; 400 “the links at the path form a loop”; 400 “a file’s path does not end in /” where a file route’s path ends in /; 403 “TimeLineEditor reads only workspace, manifest and table files” for a read, and 403 “TimeLineEditor writes only workspace files” for a write, whose name or resolved target is of another kind, checked before the file’s existence, so that no request learns whether a file of another kind exists (a folder asked of GET /api/files under a name of no such kind is refused so too); 404 “no such folder” or “no such file”; 409 “a folder lies at the path”; 403 “permission denied” for a file or folder the user may not read, list or write, a file the user may not write never replaced. tilie serves on port 8000 and opens the browser (--no-browser does not). A browser keeps what a page stores (the drawer’s state, the user, the type profiles) by origin, port included, so one port keeps it from run to run; while port 8000 is taken tilie serves on a free port and prints a notice saying so on standard error, and --port chooses the port, taken as given. --root names the root folder of the file routes, an existing folder. tilie --check verifies an installation (--static-dir checks a development build). The server takes timetoshare through timetoalign’s requirement and imports it inside the route, so it starts without it; an installed timetoalign without the measure-map expansion, or a timetoshare without the reader, answers that route with 501; no timetoalign release carries the expansion yet, so the server is installed against the timetoalign checkout beside this repository, and the timetoshare package that timetoalign checks statements with against the TimeToShare checkout beside it (AGENTS.md).
The flow routes (routers/flows.py). A manifest states where a timeline’s flow jumps and breaks; in which order its stretches are then played is computed by timetoalign alone, and the server stores nothing. Both routes take the body of the MatchClaim provenance routes without a table: a JSON object of parameters behind its length in bytes (a little-endian 32-bit integer), then the manifest file’s text, in any serialization timetoshare reads, to the end of the body; timetoalign reads the manifest whole, checking it as a manifest reader does, before the timeline is looked for. POST /api/flows takes {timeline, convention?, believer?, beliefs?}: timeline a bare ID at any depth, convention one of default, single and printed (all three without it), believer the actor whose beliefs decide which flow-control elements are read and beliefs the belief states read for that actor, only with believer (an element is read when the believer’s state in it, undecided where they hold none, is one of them; every state but false without beliefs; without a believer, the elements no actor rejects); the editor’s client sends its user and the states core’s flowReading derives from the block’s belief filter, and timetoalign’s play and atomic_sections apply them. It answers JSON {timeline, number_type, atomic_sections, conventions}: the atomic sections in the order of the axis, each {name, start, end}, and for each convention asked for its runs (pairs of coordinates on the timeline’s own axis, as its number type writes them) the sections they cover and its findings, each {kind, coordinate, end?, cause?, message}, kind one of flow_ends_at_break, never_played, endless_loop, ambiguous_targets and undetermined_target, end only for a stretch never played, cause where timetoalign names one (single_playback: a stretch the single flow leaves out that the default flow plays); printed finds nothing. A timeline without flow control is one section and one run. POST /api/flows/flow-maps takes {timeline, believer?, beliefs?, actor?, date?}, believer and beliefs as the computing route reads them, and answers, as application/json, the manifest file’s text with that timeline’s flows written (for a child timeline its atomic sections on the child and its FlowMaps on its root) by timetoalign’s create_flow_maps_from_flow_control, in the minimal form: its atomic sections as regions, typed as such in their statements, and its FlowMaps of the three conventions. A manifest holding flows written before is written again: a region whose stretch is still an atomic section keeps it, a new stretch gets a new region, the FlowMaps keep their IDs, and a region whose stretch is none any more stays, rejected by the belief false of actor (who asks) on date (YYYY-MM-DD, the server’s day without one); without an actor that case is refused. The IDs of the new regions and FlowMaps are minted at random from one seed taken from the request (the manifest as timetoalign writes it before the flows, the timeline’s ID and the reading, believer and beliefs), the regions along the axis, then the FlowMaps default, single and printed, so one request is answered alike in either form of its manifest and on every asking. A refusal answers 422 with {detail: {path, message}}, a parameter’s at its name and at ["timeline"] where the manifest lacks the timeline or timetoalign does not write its flows (a length not known, flow control that cannot be played, a section to reject and no actor); a timetoalign that cannot play flow control answers 501, and every other route still answers. The client’s flows(manifest, timeline, {convention?, believer?}) and withFlowMaps(manifest, timeline, {believer?, actor?, date?}) send these requests and check their answers.
create_app(settings) composes the application from one frozen ServerSettings (host, port, token, static_dir, root, resolved once, and the mode: public_hosts, files, body_limit, table_rows, table_bytes and computations, each None or empty in a local run; allowed_hosts() and allowed_origins() give the guard its hosts and origins, and a settings value without a token that serves files is refused), the security middlewares (OriginGuard, the Host, Origin and token guard, which checks a token only where the settings hold one; the referrer policy; and, where a limit is set, the body limit inside the guard), the health, measure-maps, match-claims, MatchClaim provenance, MatchClaim events, flows and MusicBrainz routers, the file router where files is set, the one MusicBrainz client of the run (create_app(settings, musicbrainz=…) takes another, as the tests do to replay recorded answers) and the static files. It serves no generated OpenAPI document: /api/openapi.json is 404, and a committed document is planned with the API it describes. SIGINT and SIGTERM stop the server gracefully with exit code 0, also when it was started with SIGINT ignored, as a background job of a non-interactive shell is.
Planned: loading any supported source through timetoalign loaders; conversion-map batches; unfolding and traversal diagnostics with fix suggestions; validation; exports; a committed OpenAPI document with a generated TypeScript client; a GitHub token proxy; and the command layer with an MCP server and a command channel for live sessions as the contract for automation.
Testing and quality#
Tests are README-first: every tests/README.md states what proves each behaviour, which values its package owns and derives, and where the oracle is; tests follow it, with exact expected values and no thresholds. Fixtures flow from Python to TypeScript, so both sides work from the same examples: core loads and saves every 0.2.0 manifest fixture of the schema package byte for byte, loads each minimal twin to its fixture, and refuses every shared rejection case at its pinned path; layout and the writers derive their expected drawings from the specification and equal its SVG and TikZ fixtures byte for byte, the hand-derived figures included; a component test renders the block node for every drawing fixture and compares its element tree with the fixture’s SVG. Property tests with fast-check run generated command sequences from every manifest fixture and check that accepted commands keep every manifest valid, refused ones leave the view unchanged, undo and redo restore every intermediate view and mirror each other step for step, Cancel restores its opening, the journal replays to the snapshot, and a workspace file writes back to its own bytes; on the canvas, that projections reuse node objects, that every gesture’s command is accepted, and that stretches are monotonic and reversible.
The timing budgets run alone by pnpm test:budget, core’s and the arranger’s in one Vitest run (app/vitest.budget.config.ts), one file at a time, so a budget that fails stops none of the others and every figure is reported. The workspace store’s bound reading a 300-block workspace with a 1,000-entry journal at 300 ms, writing it at 250 ms and one command at 1 ms; the same test prints “open and verify”, reading that workspace and creating its store, journal replay included, as a measured figure without a limit (decisions/0019). The anchor index’s bound checking the columns of 250,000 generated MatchClaims and building the index from them at 250 ms together, and a hover’s hit test at 1 ms (decisions/0029). The arranger’s bound Show matches over a table of 250,000 MatchClaims at two device pixels per CSS pixel: what the overlay draws of a view at 16 ms, the whole table in view and zoomed in fourfold, and a hover at 1 ms, the whole of it (the hit test, the hovered MatchStamp’s overlay with its groupstamp lines and its path, its flag, the view’s path looked up); writing a new view’s path is measured and printed without a limit (Show matches). They bound Show coordinates’ hover at 0.15 ms per pointer frame, a reading and its flag’s parts, swept along every line of bundle_shared_parent, the fixture with the most lines, groups and ancestor cards (Show coordinates). Layout’s redraw cost is pinned by counting, not timing: on a synthetic manifest of 1,000 elements, every element is resolved by the cascade once, every rule tested once per element, and the metrics table’s advances read once per distinct text. The tests that need a production build, the attributions and notices file among them, run alone by pnpm test:build.
The canvas and the editor are tested end to end with Playwright in Chromium, Firefox and WebKit and on an emulated touch screen (decisions/0021), in the pinned Playwright image through rootless podman; app/e2e/README.md states what each spec proves. Expected values come from the store through the test hook window.__tilie, never from pixels, except the zero-tolerance screenshots, made only inside that image. The hook (load, store, selection, select, viewport, setViewport, locked, mode, health, text, editing, open, done, cancel, boxes, a block’s container records, and bands, a block’s recorded bands in client pixels) and the header’s Fixture menu exist only where the page asks for them in a development build or a build made with VITE_TILIE_TEST_HOOK=1; a production build, and so the wheel, contains neither, nor any fixture file but what the Examples menu offers (four manifest fixtures and the workspaces of editor/examples/), and an embedded editor never installs them. The Fixture menu (fixtures.ts) offers every fixture of the installed schema package’s version: the manifests at the top of the version’s directory and below it (groups/, bundles/, the corpus fixtures and every .minimal twin), the manifest each warning case wraps, the MatchClaim table fixture’s manifest (tables/manifest), its MatchClaim table served beside it so that showing matches reads it without a question, and the end-to-end workspaces, each labelled by its path below the version’s directory without .json (bare, groups/corpus_tilia, warnings/<name>, e2e/small) and sorted by label. It behaves as the Examples menu does: a manifest fixture is imported as one more block into the open workspace, as Import manifest… adds a file, and an end-to-end workspace replaces the open workspace after the question New and Open ask about unsaved changes. The rejection cases and the drawings are left out. The menu is imported only under the literal build condition, so a production build has no trace of it. The workspaces the suite opens are written from the schema package’s manifest fixtures through the store’s commands by pnpm e2e:fixtures, never by hand, and kept LF by .gitattributes (The component and the page). An embed spec mounts two editors into a foreign host page built in embed mode. The lookup is proven on real answers without a network: the editor’s lookup tests and the end-to-end suite replay answers of Wikidata, lobid-gnd, YouTube and the server’s MusicBrainz endpoint recorded once (app/packages/editor/scripts/record-lookup.ts), the server’s tests answers of MusicBrainz recorded once (server/scripts/record_musicbrainz.py), and a replaying fetch refuses any request it holds no answer for, so the tests pin the exact requests as well as every candidate. axe-core checks the page for accessibility violations (decisions/0022). The gates are Biome, Vitest, fast-check, dependency-cruiser, svelte-check, Playwright, axe-core, LuaLaTeX, Ruff and pytest.
Known gaps: the editor’s component tests do not check CSS layout or mobile rendering (the end-to-end tests check the drawer’s positions and the phone header), nor a fragment carrying an empty token; the File System Access path is tested against stubbed pickers only, the end-to-end tests taking the file-input and download path; the server’s static-file tests do not exercise traversal.
Performance#
A drag costs script time on every pointer move in proportion to the number of nodes, culled or not, because Svelte Flow re-adopts its node list on each move: about 1.2 ms per move at 100 blocks, 2.4 ms at 300 and 5 ms at 900 in headless Chromium. Culling reduces what is mounted (42 of 300 nodes in a zoomed view) but adds its own cost to pan and zoom (3.1 ms per wheel event at 300 blocks against 0.4 ms without), so it starts above 500 blocks. One node per block, a complete projection, reused node objects, memoized drawings and a preview that replaces one node keep a gesture from doing any work of TiLiE’s own beyond the previewed block.
pnpm e2e:budget checks, for a workspace of 300 blocks in Chromium, from the DevTools Protocol’s script time: dragging a block at most 3 ms of script per pointer move; panning and wheel zoom at most 1 ms per move or event; one command at most 1 ms; one block’s redrawing within one frame (16.7 ms). Opening a workspace costs reading it and replaying its journal; the store’s decision record holds the figures. Heavy data is intended to stay out of the DOM, in WebGL panes and columnar tables, with parsing that could block interaction in workers.
Dependencies and deployment#
Each dependency requires an ADR under decisions/, in the MADR structure, weighing writing it ourselves, naming the audited version and a review date (decisions/0001); the dependency policy, ranges in manifests, exact development pins, lockfiles and the 14-day release window, is stated in AGENTS.md.
Install the current product with pip install tilie-server, then run tilie. The wheel contains the built browser app, so starting it needs neither Node.js nor a download. The container image (Dockerfile at the repository root) serves the editor and the server in public mode on a hosting platform (the README, decisions/0038). Planned deployment forms are a hosted browser app talking to a user-run local server, a desktop wrapper and collaborative hosting.