Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

spaces: a canvas — cards you place by hand (#395)

nyblnet50775767551e
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index 9696947d..43592045 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -5666,6 +5666,104 @@ raised from the bento/type branch during #384 and deliberately NOT decided
there, which was the right call — a single app's feature branch is the wrong
place to set a cross-app default.
+## 2026-08-28 — bento/spaces: the `canvas` block, and where a card's position lives
+
+**The type.** `canvas` is a bounded surface holding cards you place by hand —
+a storyboard, a roadmap, a mind map. The format shape below is permanent from
+the moment the type ships, because there is no server to migrate a file
+somebody already has (PLATFORM §3).
+
+### The shape
+
+```jsonc
+{ "id": "b1", "type": "canvas",
+ "html": "Launch storyboard", // the surface's NAME, and its fallback
+ "ratio": 1.6 // width ÷ height; ABSENT = 1.6
+}
+```
+
+**A card is a BLOCK, not an entry in an array on the canvas.** The canvas is
+`container: 'always'` in the registry, so it owns the blocks whose `parent` is
+its id — exactly as a callout and a toggle do. A card adds two flat fields and
+nothing else:
+
+```jsonc
+{ "id": "b2", "type": "p", "parent": "b1", "x": 29, "y": 8, "html": "Review with the team" }
+```
+
+`x` and `y` are PERCENTAGES of the surface, one decimal place, clamped to
+0–100 at read time. A card with no coordinates is not an error: it takes a
+deterministic slot from its index among its siblings, so two readers of one
+file lay it out identically and `{"type":"canvas"}` with three bare paragraphs
+under it is a hand-writable canvas.
+
+A card's TYPE is any block type. `p` is a text card; `pagelink` is a card that
+opens a page in the space, which is what lets a canvas be a map OF the space
+rather than only a sketchpad. Nothing new was needed for either.
+
+### Why cards are blocks and not an array
+
+Three reasons, in ascending order of how permanent the mistake would have been.
+
+1. **An array is a second place text lives.** Every word in a space is some
+ block's `html` — canonicalised by one sanitizer, found by ⌘F, back-linked by
+ `buildIndex` because it reads `html`, exported by one markdown pass. Text
+ inside `canvas.cards[]` is none of those things, and each one would have to
+ be taught about the array separately.
+2. **An array degrades badly.** `renderBlocks` resolves a child against the
+ OPEN CONTAINER STACK, and an unknown type opens no container — so on a build
+ that has never heard of `canvas`, every card falls out to the top level and
+ renders as the paragraph or page card it already is, under the canvas's own
+ name. Measured against the pre-change shell: the page reads "Launch
+ storyboard" followed by each card as an ordinary paragraph, and the `x`/`y`
+ it cannot use round-trip untouched. Cards in an array would show as the
+ canvas's `html` and nothing more — unless the html duplicated all of it,
+ which is the price `table` pays and did not need to be paid again.
+3. **An array loses edits under collaboration.** model.ts already states the
+ rule: properties are flat because each (node, key) pair is one LWW register.
+ `cards` as one array is ONE register, so two people dragging two different
+ cards keep one of the two moves, silently. As blocks, each card is its own
+ CRDT node and `x`/`y` are its own registers, and both drags land.
+ `table.rows` has exactly this limitation and documents it; there was no
+ reason to take it on again where the alternative is strictly simpler.
+
+Because the cards are separate blocks that an old build renders on its own, the
+canvas's `html` is its NAME and must never repeat them — the opposite of
+`tableFallbackHtml`, which has to hold the cells' text because a table's cells
+are not blocks. The markdown export follows: a canvas exports as `**name**`
+and its cards arrive as their own lines.
+
+### Why percentages, and why `ratio` is document data
+
+Percentages, not pixels: the same file is read at 320px and at 2560px and
+printed on A4, and a layout in px is a layout that is right at exactly one
+width. Not an abstract 1000-unit grid either — that is a percentage with a
+scale factor bolted on, and the renderer would have to know the factor forever.
+A percentage needs nothing: `left: calc(var(--sp-x) * 1%)`.
+
+`ratio` has to be in the document rather than a reader-side default, because
+the cards' `y` is relative to it: a canvas laid out on a 1.6 surface and read on
+a 1.0 one is a different picture. It is stored as an ABSENT key when it is the
+default (the `editView` discipline), so a canvas cycled Wide→Square→Tall→Wide
+is byte-identical to one nobody touched.
+
+Below 560px the surface renders as a stacked list of its cards, positions
+ignored. That is a RENDERING choice made in the stylesheet, not a change to the
+file — four cards on a 360px board are four unreadable stamps, and the same
+document lays out spatially again on the next screen up.
+
+### Names reserved, so a follow-up does not have to guess
+
+- Card SIZE is `cw`/`ch`, in the same percentage units. **Not `w`/`h`** — an
+ image block already carries its intrinsic pixels in those, and an image is a
+ perfectly good card.
+- CONNECTORS belong on the canvas block as `links: [{ from, to }]` of card ids.
+ A relation is not a property of either end.
+- NESTING needs nothing: a canvas inside a canvas is a card whose type is
+ `canvas`, and the container stack already supports it.
+
+None of the three is built. All three are additive.
+
---
## 2026-08-28 — a graph view is a DRAWING, and derived state is never stored
diff --git a/scripts/test-spaces-model.ts b/scripts/test-spaces-model.ts
index 0a7f064a..2604b5eb 100644
--- a/scripts/test-spaces-model.ts
+++ b/scripts/test-spaces-model.ts
@@ -54,6 +54,10 @@ import { escText, externalHref } from '../spaces/src/sanitize.ts'
import {
SPECS, SPEC, MENU_SPECS, MD_SPECS, TAG_OF, LIST_OF, CALLOUT_TONES, mdLayout, mediaPlayback,
} from '../spaces/src/blocks.ts'
+import {
+ canvasRatio, cardPos, cardsOf, freeSlot, slotFor, nextRatio, ratioName, clampPct, round1,
+ CANVAS_RATIO, RATIO_MIN, RATIO_MAX,
+} from '../spaces/src/canvas.ts'
import type { Block, Page } from '../spaces/src/model.ts'
import {
buildGraph, layoutGraph, stepLayout, nodeRadius, graphBounds,
@@ -3119,6 +3123,132 @@ function fsTable(f: string): string {
}
+// ————— THE CANVAS BLOCK ——————————————————————————————————————————————————
+//
+// A spatial surface is the one block type whose layout has NOWHERE ELSE to
+// live: a board's order is `doc.pages`, a list's order is the block array, and
+// a canvas's coordinates are only on the canvas. So they ship into files on
+// other people's disks the moment the type exists, and every property below is
+// one that cannot be corrected afterwards.
+{
+ const cv = (over: Record<string, unknown> = {}): Block =>
+ ({ id: 'cv', type: 'canvas', ...over }) as Block
+
+ // THE SHAPE IS READ, NEVER REPAIRED. Same rule as tableOf: two readers of one
+ // file agree without exchanging an op, and opening a space rewrites nothing.
+ ok(canvasRatio(cv()) === CANVAS_RATIO, 'a canvas with no ratio is the default shape')
+ ok(canvasRatio(cv({ ratio: 1 })) === 1, 'a stated ratio is honoured')
+ ok(canvasRatio(cv({ ratio: 0 })) === RATIO_MIN, 'a ratio of 0 is clamped, not a surface with no height')
+ ok(canvasRatio(cv({ ratio: -3 })) === RATIO_MIN, 'a negative ratio is clamped')
+ ok(canvasRatio(cv({ ratio: 900 })) === RATIO_MAX, 'an absurd ratio is clamped')
+ ok(canvasRatio(cv({ ratio: 'wide' })) === CANVAS_RATIO, 'a ratio that is not a number is the default')
+ ok(canvasRatio(cv({ ratio: NaN })) === CANVAS_RATIO, 'NaN is the default, not NaN')
+
+ // THE SHAPE BUTTON CYCLES AND COMES HOME. Three shapes, and the third click
+ // returns the exact default — which is what lets the editor store it as an
+ // ABSENT key, so a canvas somebody cycled and cycled back is byte-identical
+ // to one nobody touched.
+ ok(nextRatio(nextRatio(nextRatio(CANVAS_RATIO))) === CANVAS_RATIO,
+ 'three clicks of the shape button return the default ratio exactly')
+ ok(ratioName(1.6) === 'Wide' && ratioName(1) === 'Square' && ratioName(0.7) === 'Tall',
+ 'each of the three shapes knows its own name')
+ ok(ratioName(1.55) === 'Wide',
+ 'a hand-written ratio near a named shape says that name rather than nothing')
+
+ // AN UNPLACED CARD IS NOT AN ERROR, and two readers must place it the same.
+ // `{type:'canvas'}` with three bare paragraphs under it is a hand-writable
+ // canvas, and every card added with Enter arrives without coordinates.
+ const bare: Block = { id: 'c', type: 'p', parent: 'cv' }
+ ok(JSON.stringify(cardPos(bare, 0)) === JSON.stringify(cardPos(bare, 0)),
+ 'an unplaced card lands in the same slot on every read')
+ ok(cardPos(bare, 0).x !== cardPos(bare, 1).x || cardPos(bare, 0).y !== cardPos(bare, 1).y,
+ 'two unplaced cards do not land on top of each other')
+ ok([...Array(12)].every((_, i) => {
+ const p = slotFor(i)
+ return p.x >= 0 && p.x <= 100 - 22 && p.y >= 0 && p.y <= 100
+ }), 'every slot in the first lap leaves the whole card on the surface')
+ const seen = new Set([...Array(12)].map((_, i) => JSON.stringify(slotFor(i))))
+ ok(seen.size === 12, 'the twelve slots of one lap are twelve different places')
+
+ // A STATED POSITION WINS over the slot, which is the whole point of dragging.
+ ok(cardPos({ id: 'c', type: 'p', x: 40, y: 70 } as Block, 0).x === 40,
+ 'a card that has been placed sits where it says')
+ ok(cardPos({ id: 'c', type: 'p', x: 40, y: 70 } as Block, 5).y === 70,
+ '…whatever its index among its siblings')
+
+ // COORDINATES OUT OF A FILE. A generator, a hand edit or a build with a
+ // different surface can write anything; none of it may put a card where no
+ // reader can reach it, and none of it may take a page of prose down.
+ ok(cardPos({ id: 'c', type: 'p', x: -50, y: 400 } as Block, 0).x === 0,
+ 'a negative coordinate is brought back onto the surface')
+ ok(cardPos({ id: 'c', type: 'p', x: -50, y: 400 } as Block, 0).y === 100,
+ '…and one past the far edge is too')
+ ok(cardPos({ id: 'c', type: 'p', x: 'left', y: {} } as unknown as Block, 3).x === slotFor(3).x,
+ 'a coordinate that is not a number falls back to the slot')
+
+ // ONE DECIMAL PLACE. Positions are rewritten on every drag and read in every
+ // diff; float noise makes a card that slid 4% look like a rewritten block.
+ ok(round1(59.34567) === 59.3, 'a position is stored to one decimal place')
+ ok(String(clampPct((1 / 3) * 100)) === '33.3', '…and is short enough to read in a diff')
+
+ // A NEW CARD NEVER LANDS ON AN OLD ONE. Not "the next index": cards get
+ // deleted, so index 3 can be free while index 5 is taken.
+ const occupied: Block[] = [
+ { id: 'a', type: 'p', ...slotFor(0) } as Block,
+ { id: 'b', type: 'p', ...slotFor(1) } as Block,
+ ]
+ const next = freeSlot(occupied)
+ ok(occupied.every((c) => c.x !== next.x || c.y !== next.y),
+ 'a new card takes a slot no card is already sitting on')
+ const holed: Block[] = [{ id: 'a', type: 'p', ...slotFor(3) } as Block]
+ ok(JSON.stringify(freeSlot(holed)) === JSON.stringify(slotFor(0)),
+ '…and it fills the first hole rather than counting cards')
+
+ // THE CARDS OF A CANVAS ARE ITS CHILDREN, which is the whole format decision:
+ // no second list to keep in step with the block array.
+ const cvPage = {
+ id: 'p', title: 'T', blocks: [
+ { id: 'cv', type: 'canvas', html: 'Board' },
+ { id: 'c1', type: 'p', parent: 'cv', html: 'one' },
+ { id: 'other', type: 'p', html: 'not a card' },
+ { id: 'c2', type: 'pagelink', parent: 'cv', page: 'p2' },
+ ],
+ } as unknown as Page
+ ok(cardsOf(cvPage, 'cv').map((b) => b.id).join(',') === 'c1,c2',
+ 'a canvas holds the blocks that name it as parent, and nothing else')
+
+ // DEGRADATION, and it is the reason cards are blocks. renderBlocks resolves a
+ // child against the OPEN CONTAINER STACK and an unknown type opens no
+ // container — so on a build with no `canvas`, every card falls out to the top
+ // level and renders as the paragraph or page card it already is. Nothing is
+ // hidden, and the canvas's own html must therefore NOT repeat the cards.
+ const cvSpec = SPEC.get('canvas')
+ ok(cvSpec?.container === 'always', 'a canvas owns the blocks whose parent is its id')
+ ok(cvSpec?.text === true, "a canvas's own html is its name, so it degrades to a readable line")
+ ok(cvSpec?.custom === true, 'a canvas draws itself')
+ ok(TAG_OF.canvas === 'div', 'a canvas is a div, like every other surface block')
+ ok(!LIST_OF.canvas, 'a canvas is not a list item')
+
+ // ITS MARKDOWN IS ITS NAME. The cards follow as their own indented lines,
+ // because they are their own blocks — so `toMd` must NOT print them again.
+ const cvMd = cvSpec!.toMd!({ id: 'cv', type: 'canvas' } as Block, 'Launch plan', '', {} as never)
+ ok(cvMd.join('\n') === '**Launch plan**', 'a canvas exports as its name')
+ ok(cvSpec!.toMd!({ id: 'cv', type: 'canvas' } as Block, '', '', {} as never)[0] === '**Canvas**',
+ 'an unnamed canvas still says what it is rather than exporting a blank line')
+
+ // A CARD'S OWN WORDS TRAVEL, AS THEIR OWN LINE. mdLayout decides the two
+ // decorations a block cannot decide for itself, and the one that matters here
+ // is `quote`: a container marked `mdQuoteChildren` sweeps its whole subtree
+ // into a blockquote, and a canvas marked that way by accident would turn a
+ // storyboard into one grey box of run-on prose. (`indent` is set for any
+ // container's child; the exporter spends it on the types whose toMd takes it,
+ // which a plain text card's does not — so the assertion is on the quote.)
+ const cvLay = mdLayout(cvPage.blocks)
+ ok(cvLay[1].quote === '', 'a card is not swept into its canvas as a blockquote')
+ ok(cvLay[1].indent === ' ', "…and mdLayout reads it as its container's child")
+}
+
+
// ---- 8. the graph view -----------------------------------------------------
// The picture is drawn from `buildIndex().backlinks` and nothing else — there
// is no second link index (spaces/src/graph.ts). What is asserted here is the
diff --git a/spaces/src/blocks.ts b/spaces/src/blocks.ts
index 5f429212..28ec22be 100644
--- a/spaces/src/blocks.ts
+++ b/spaces/src/blocks.ts
@@ -330,6 +330,28 @@ export const SPECS: BlockSpec[] = [
return out
},
},
+ {
+ // A SPATIAL SURFACE — a storyboard, a roadmap, a mind map. Its cards are
+ // the blocks whose `parent` is its id, exactly like a callout's body, and
+ // each one carries where it sits as two flat numbers. The whole argument
+ // for that shape (rather than an array of cards on this block) is at the
+ // top of canvas.ts; the short version is that a card is a block, so it is
+ // already searchable, exportable, backlinked and individually mergeable.
+ //
+ // `text: true`: the canvas's own `html` is its NAME. That is also what a
+ // build with no `canvas` type renders — and because the cards fall out to
+ // the top level on such a build (renderBlocks opens no container for an
+ // unknown type), the name must NOT duplicate them. A table's fallback has
+ // to hold its cells' text and pays for it in bytes; a canvas's does not.
+ type: 'canvas', label: 'Canvas', hint: 'Cards you place by hand', icon: 'canvas',
+ tag: 'div', text: true, custom: true, container: 'always',
+ // THE NAME, then the cards — which arrive on their own, as the indented
+ // lines of the blocks they are. A canvas is a picture and Markdown has no
+ // pictures, so the honest export is the list of what is on it, in document
+ // order. Positions are what does not survive, and saying so in the export
+ // would be a comment in someone else's document.
+ toMd: (_b, text) => [`**${text || 'Canvas'}**`],
+ },
{
type: 'image', label: 'Image', hint: 'Embedded in the file', icon: 'image',
tag: 'div', custom: true,
diff --git a/spaces/src/canvas.ts b/spaces/src/canvas.ts
new file mode 100644
index 00000000..f4284aeb
--- /dev/null
+++ b/spaces/src/canvas.ts
@@ -0,0 +1,526 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// The `canvas` block: a bounded surface holding cards you place by hand —
+// storyboards, roadmaps, mind maps.
+//
+// ————— THE FORMAT, AND WHY IT IS THIS SHAPE ———————————————————————————————
+//
+// A CARD IS A BLOCK, not an entry in an array on the canvas. The canvas
+// `container: 'always'` owns the blocks whose `parent` is its id, exactly as a
+// callout and a toggle do, and the only thing a card adds is WHERE IT SITS:
+// two flat numbers, `x` and `y`.
+//
+// The obvious alternative — `canvas.cards: [{id, x, y, text}]` — was rejected
+// for three reasons, in ascending order of how permanent the mistake would be.
+//
+// 1. It would be a SECOND place text lives. Every other word in a space is a
+// block's `html`, canonicalised by one sanitizer, found by ⌘F, exported by
+// one markdown pass, backlinked by buildIndex because it reads `html`. A
+// card's words inside an array are none of those things, and each one
+// would have to be taught about the array separately.
+// 2. It would DEGRADE BADLY. renderBlocks resolves a child against the open
+// container stack, and an unknown type opens no container — so on a build
+// that has never heard of `canvas`, the cards fall out to the top level
+// and render as ordinary paragraphs and page cards under the canvas's own
+// title. Nothing is hidden and nothing is lost. Cards in an array on a
+// block whose type means nothing would render as the canvas's `html` and
+// no more, and the words would be on screen only if the html duplicated
+// them — which is what a table has to do, and pays for in bytes.
+// 3. It would LOSE EDITS UNDER COLLABORATION. model.ts states the rule:
+// properties are flat because each (node, key) pair is one last-writer-
+// wins register. `cards` as one array is ONE register — two people
+// dragging two different cards keep one of the two moves, silently. As
+// blocks, each card is its own CRDT node and `x` and `y` are its own
+// registers, so two simultaneous drags both land. `table.rows` has the
+// array problem and documents it as a limitation; there is no reason to
+// take it on again where the alternative is strictly simpler.
+//
+// COORDINATES ARE PERCENTAGES of the surface, `x` across and `y` down, one
+// decimal place. Not pixels: the same file is read at 320px and at 2560px and
+// printed on A4, and a layout in px is a layout that is right at one width.
+// Not a 1000-unit abstract grid either — that is a percentage with a scale
+// factor bolted on, and it needs the renderer to know the factor forever. A
+// percentage needs nothing: `left: calc(var(--sp-x) * 1%)`.
+//
+// `ratio` (width ÷ height) is the surface's shape and lives on the canvas
+// block. It has to be a document field: a roadmap is wide and a mind map is
+// square, the cards' y coordinates are relative to it, and a reader-side
+// default would move every card the moment the default changed.
+//
+// WHAT IS DELIBERATELY NOT HERE, so a follow-up does not have to guess:
+// · card SIZE. `w`/`h` are already taken — an image block carries its
+// intrinsic pixels in them, and an image is a perfectly good card. A
+// future size field is `cw`/`ch`, in the same percentage units.
+// · CONNECTORS. They belong on the canvas block as `links: [{from, to}]` of
+// card ids — a relation is not a property of either end.
+// · NESTING. A canvas inside a canvas is a card whose type is `canvas`; the
+// container stack already supports it and nothing here forbids it.
+// None of those is built. All three are additive.
+
+import type { Block, Page } from './model.ts'
+import { descendantsOf, newBlock } from './model.ts'
+import { sanitizeInline } from './sanitize.ts'
+import { t } from './i18n.ts'
+import { ICONS } from './icons.ts'
+
+/** The surface's shape, width ÷ height. Wide, because the first thing anyone
+ * draws here is a row of steps. */
+export const CANVAS_RATIO = 1.6
+
+/** What a `ratio` in a file may say. A file can be hand-edited or generated,
+ * and a ratio of 0 is a surface with no height — clamped at read time rather
+ * than repaired in the document, the `tableOf` rule. */
+export const RATIO_MIN = 0.4
+export const RATIO_MAX = 4
+
+/** A card's width, as a percentage of the surface. Fixed until `cw` exists. */
+export const CARD_W = 22
+
+/**
+ * The surface's shape for one canvas block.
+ *
+ * An unreadable `ratio` — absent, a string, NaN, negative — is the DEFAULT,
+ * never an error and never a rewrite of the document.
+ */
+export function canvasRatio(b: Block): number {
+ const r = (b as { ratio?: unknown }).ratio
+ if (typeof r !== 'number' || !Number.isFinite(r)) return CANVAS_RATIO
+ return Math.min(RATIO_MAX, Math.max(RATIO_MIN, r))
+}
+
+/** The three shapes the one shape-button cycles through, and their names. */
+export const RATIOS: Array<{ ratio: number; label: string }> = [
+ { ratio: 1.6, label: 'Wide' },
+ { ratio: 1, label: 'Square' },
+ { ratio: 0.7, label: 'Tall' },
+]
+
+/** The name for the shape a canvas is currently in — the nearest of the three,
+ * so a hand-written 1.55 still says "Wide" rather than nothing. */
+export function ratioName(r: number): string {
+ let best = RATIOS[0]
+ for (const c of RATIOS) if (Math.abs(c.ratio - r) < Math.abs(best.ratio - r)) best = c
+ return best.label
+}
+
+export function nextRatio(r: number): number {
+ const here = RATIOS.findIndex((c) => c.label === ratioName(r))
+ return RATIOS[(here + 1) % RATIOS.length].ratio
+}
+
+export interface CardPos { x: number; y: number }
+
+/**
+ * A DETERMINISTIC SLOT for a card that has never been placed.
+ *
+ * Absent coordinates are not an error: `{type:'canvas'}` with three bare
+ * paragraphs under it is a valid, hand-writable canvas, and every card an
+ * author adds by pressing Enter inside one arrives without a position. Piling
+ * them all at (0,0) would make a canvas that looks broken the first time it is
+ * used, so an unplaced card gets a slot from its INDEX — same file, same
+ * screen, same layout, on every reader's machine.
+ *
+ * Twelve slots in a 4x3 grid, then the grid repeats with a small diagonal
+ * offset, so a thirteenth card is visibly a card rather than a perfect overlap.
+ */
+export function slotFor(i: number): CardPos {
+ const lap = Math.floor(i / 12)
+ const n = i % 12
+ return {
+ x: round1(4 + (n % 4) * 24 + lap * 2),
+ y: round1(6 + Math.floor(n / 4) * 30 + lap * 3),
+ }
+}
+
+/** Where a card sits: what it says, or its slot. `i` is its position among the
+ * canvas's cards, which is what makes the fallback stable. */
+export function cardPos(b: Block, i: number): CardPos {
+ const x = (b as { x?: unknown }).x
+ const y = (b as { y?: unknown }).y
+ const slot = slotFor(i)
+ return {
+ x: typeof x === 'number' && Number.isFinite(x) ? clampPct(x) : slot.x,
+ y: typeof y === 'number' && Number.isFinite(y) ? clampPct(y) : slot.y,
+ }
+}
+
+/** A coordinate a file may contain, brought back into the surface. Negative
+ * and 4000 are both things a generator writes; neither should put a card
+ * where nobody can reach it. */
+export const clampPct = (n: number): number => Math.min(100, Math.max(0, round1(n)))
+
+/** One decimal place. Coordinates are written on every drag and read in every
+ * diff, and 0.1% of a surface is well under a pixel of intent — full float
+ * noise makes a one-card move look like a rewritten block. */
+export const round1 = (n: number): number => Math.round(n * 10) / 10
+
+/** The cards of one canvas, in document order. */
+export function cardsOf(page: Page, canvasId: string): Block[] {
+ return page.blocks.filter((b) => b.parent === canvasId)
+}
+
+/**
+ * Where a NEW card goes: the first slot no card is already sitting on.
+ *
+ * Not "the next index" — cards get deleted, so index 3 can be free while index
+ * 5 is taken, and dropping a new card exactly on top of an old one is the one
+ * outcome that reads as a bug.
+ */
+export function freeSlot(cards: Block[]): CardPos {
+ const taken = cards.map((c, i) => cardPos(c, i))
+ for (let i = 0; i < 48; i++) {
+ const s = slotFor(i)
+ if (!taken.some((p) => Math.abs(p.x - s.x) < 8 && Math.abs(p.y - s.y) < 8)) return s
+ }
+ return slotFor(cards.length)
+}
+
+/**
+ * GIVE A BRAND-NEW CARD SOMEWHERE TO SIT.
+ *
+ * An unplaced card falls back to the slot for its INDEX, which is right for a
+ * hand-written file and wrong the moment a canvas has been used: pressing Enter
+ * in the first card makes a new card at index 1, and index 1's slot is exactly
+ * where the card that used to be there is still sitting. Measured — the new
+ * card landed underneath the old one and looked like nothing had happened.
+ *
+ * So the two places the editor creates a block (insertAfter, splitBlock) ask
+ * here, and a card born inside a canvas is born with coordinates. Everything
+ * else is left alone: this is a no-op for a block whose parent is a callout, a
+ * toggle, a list item or nothing at all.
+ */
+export function placeNewCard(page: Page, fresh: Block): void {
+ if (!fresh.parent) return
+ const owner = page.blocks.find((b) => b.id === fresh.parent)
+ if (owner?.type !== 'canvas') return
+ const pos = freeSlot(cardsOf(page, owner.id))
+ fresh.x = pos.x
+ fresh.y = pos.y
+}
+
+// ————— RENDERING ————————————————————————————————————————————————————————
+
+/**
+ * The canvas block's own chrome: its name, and the buttons that change it.
+ *
+ * The BODY is not built here — renderBlocks opens it, because `container` in
+ * the registry is what says a type owns the blocks whose parent is its id, and
+ * a second body built here would be a second answer to that question.
+ *
+ * Controls are `opts.editable` only, the callout-chip and view-button rule: a
+ * reader, a printout and a locked space get the surface, not the buttons.
+ */
+export function renderCanvasHead(el: HTMLElement, b: Block, editable: boolean, cards: number): void {
+ el.classList.add('sp-canvas')
+ el.style.setProperty('--sp-ratio', String(canvasRatio(b)))
+
+ const head = document.createElement('div')
+ head.className = 'sp-canvas-head'
+
+ const title = document.createElement(editable ? 'div' : 'span')
+ title.className = 'sp-canvas-title'
+ title.dir = 'auto'
+ if (editable) {
+ title.contentEditable = 'true'
+ title.dataset.canvasTitle = b.id
+ title.dataset.ph = t('Name this canvas')
+ }
+ title.innerHTML = sanitizeInline(b.html ?? '')
+ head.appendChild(title)
+
+ if (editable) {
+ const btn = (attr: string, label: string, tip: string): HTMLButtonElement => {
+ const el2 = document.createElement('button')
+ el2.type = 'button'
+ el2.className = 'sp-btn sp-canvas-btn'
+ el2.dataset[attr] = b.id
+ el2.textContent = label
+ el2.title = tip
+ el2.setAttribute('aria-label', tip)
+ return el2
+ }
+ const shape = ratioName(canvasRatio(b))
+ // ONE cycling button, not a menu of three: the view block's layout control
+ // settled this argument already, and the reason is the same — the word on
+ // the button is the state, and the click is the change.
+ const SHAPE_WORD: Record<string, string> = {
+ Wide: t('Wide'), Square: t('Square'), Tall: t('Tall'),
+ }
+ head.append(
+ btn('canvasAdd', t('Add a card'), t('Add a card')),
+ btn('canvasAddPage', t('Add a page'), t('Add a card that opens a page')),
+ btn('canvasShape', SHAPE_WORD[shape] ?? shape, t('Change the shape of this canvas')),
+ )
+ }
+ el.appendChild(head)
+
+ if (!cards) {
+ const empty = document.createElement('p')
+ empty.className = 'sp-canvas-empty'
+ empty.textContent = t('Nothing on this canvas yet.')
+ el.appendChild(empty)
+ }
+}
+
+/**
+ * Put one card where the model says.
+ *
+ * CSS custom properties rather than `left`/`top` directly, so the stylesheet
+ * owns the layout: the phone breakpoint drops the whole canvas to a stacked
+ * list by ignoring these, which it could not do against inline `left`.
+ *
+ * `i` is the card's index among its siblings, and it is read from the DOM
+ * AFTER the append, so the caller does not have to keep a counter.
+ */
+export function placeCard(node: HTMLElement, b: Block): void {
+ const i = Math.max(0, (node.parentElement?.children.length ?? 1) - 1)
+ const p = cardPos(b, i)
+ node.classList.add('sp-cv-card')
+ node.style.setProperty('--sp-x', String(p.x))
+ node.style.setProperty('--sp-y', String(p.y))
+}
+
+// ————— EDITING ——————————————————————————————————————————————————————————
+
+/**
+ * What canvas.ts needs from the editor, and nothing more.
+ *
+ * A deliberately narrow surface rather than the Store itself: render.ts
+ * imports this file, so anything this file imports is in the renderer's
+ * dependency graph, and the renderer has no business knowing about undo.
+ */
+export interface CanvasHooks {
+ block(id: string): Block | undefined
+ page(): Page | undefined
+ commit(fn: () => void, opts?: { structure?: boolean }): void
+ repaint(): void
+ /** the existing page picker, so "a card for a page" is the same dialog as
+ * every other way to point at one */
+ pickPage(then: (pageId: string) => void): void
+}
+
+export function wireCanvas(root: HTMLElement, hooks: CanvasHooks): void {
+ for (const cv of root.querySelectorAll<HTMLElement>('.sp-canvas')) {
+ const id = cv.dataset.blockId
+ if (!id) continue
+
+ cv.querySelector<HTMLElement>('[data-canvas-add]')
+ ?.addEventListener('click', () => addCard(hooks, id, newBlock('p')))
+ cv.querySelector<HTMLElement>('[data-canvas-add-page]')
+ ?.addEventListener('click', () => {
+ hooks.pickPage((pageId) => addCard(hooks, id, newBlock('pagelink', { page: pageId })))
+ })
+ cv.querySelector<HTMLElement>('[data-canvas-shape]')
+ ?.addEventListener('click', () => {
+ const b = hooks.block(id)
+ if (!b) return
+ // THE DEFAULT IS STORED AS AN ABSENT KEY — the `editView` discipline:
+ // a canvas cycled back to Wide must be byte-identical to one that was
+ // never touched, and a file written before this control existed must
+ // stay that way.
+ const next = nextRatio(canvasRatio(b))
+ hooks.commit(() => {
+ if (next === CANVAS_RATIO) delete (b as { ratio?: number }).ratio
+ else (b as { ratio?: number }).ratio = next
+ })
+ hooks.repaint()
+ })
+
+ // THE TITLE COMMITS WHEN IT IS DONE WITH, not on every keystroke. It is a
+ // short name typed once; an undo entry per character would bury the edit
+ // before it under twenty of them.
+ const title = cv.querySelector<HTMLElement>('[data-canvas-title]')
+ // A NAME IS ONE LINE. Enter in a contentEditable inserts a break, and a
+ // two-line surface name pushes the whole canvas down and reads as a bug;
+ // it also stops the keystroke reaching the editor's own Enter handling,
+ // which would otherwise be asked to split a block that has no text host.
+ // Enter here means "done", which is what blur already means.
+ title?.addEventListener('keydown', (e) => {
+ if (e.key !== 'Enter') return
+ e.preventDefault()
+ title.blur()
+ })
+ title?.addEventListener('blur', () => {
+ const b = hooks.block(id)
+ const next = sanitizeInline(title.innerHTML)
+ if (!b || next === (b.html ?? '')) return
+ hooks.commit(() => { b.html = next }, { structure: false })
+ })
+
+ const body = cv.querySelector<HTMLElement>('.sp-canvas-body')
+ if (!body) continue
+ for (const card of body.querySelectorAll<HTMLElement>(':scope > .sp-cv-card')) {
+ wireCard(card, body, hooks)
+ }
+ }
+}
+
+function addCard(hooks: CanvasHooks, canvasId: string, fresh: Block): void {
+ const page = hooks.page()
+ if (!page) return
+ const at = lastOfCanvas(page, canvasId)
+ const pos = freeSlot(cardsOf(page, canvasId))
+ fresh.parent = canvasId
+ fresh.x = pos.x
+ fresh.y = pos.y
+ hooks.commit(() => { page.blocks.splice(at, 0, fresh) })
+ hooks.repaint()
+}
+
+/**
+ * The index just past a canvas's last descendant.
+ *
+ * `parent` is positional in this format — a child must appear strictly after
+ * its parent — so a card appended at the very end of the page would belong to
+ * whatever container happens to be open there, not to this canvas. The insert
+ * point is the end of THIS canvas's run.
+ */
+function lastOfCanvas(page: Page, canvasId: string): number {
+ const at = page.blocks.findIndex((b) => b.id === canvasId)
+ if (at < 0) return page.blocks.length
+ const mine = descendantsOf(page, canvasId)
+ let end = at + 1
+ while (end < page.blocks.length && mine.has(page.blocks[end].id)) end++
+ return end
+}
+
+
+/**
+ * A card's grip, and the drag that moves it.
+ *
+ * WHY A GRIP RATHER THAN THE WHOLE CARD. A card's text is a live
+ * contentEditable, and a mousedown on it is how you put the caret somewhere.
+ * A whole-card drag has to guess which of the two the reader meant, and every
+ * way of guessing (a movement threshold, a delay, suppressing selection until
+ * focused) is a guess that is wrong some of the time — in a way that either
+ * eats a click or drags the page while you are trying to select a word. A grip
+ * is unambiguous, it is a real button so the keyboard can reach it, and it is
+ * the same affordance the block gutter already uses.
+ *
+ * MOUSE EVENTS, not HTML5 drag-and-drop, and not PointerEvent. dnd reports a
+ * drop target, which is what a board needs and the opposite of what a free
+ * surface needs — here the answer is a continuous coordinate. Pointer events
+ * would be the modern spelling, but the board and the column-resize drag in
+ * this app are both mouse-driven and mixing the two in one document is how you
+ * get a gesture that works in one place and not the one beside it.
+ *
+ * ONE COMMIT PER GESTURE. The DOM moves live and the model is written once, on
+ * release — the `startColResize` rule, and for the same two reasons: sixty
+ * commits is sixty undo entries for one drag, and repainting under the cursor
+ * loses the pointer on the first frame. A drag that ENDS WHERE IT STARTED
+ * commits nothing at all: no undo entry, no dirty flag, no op on the wire.
+ */
+function wireCard(card: HTMLElement, body: HTMLElement, hooks: CanvasHooks): void {
+ const id = card.dataset.blockId
+ if (!id) return
+
+ // NO DELETE BUTTON HERE, deliberately. Every block in a space is deleted
+ // from the gutter menu, and a card is a block — a second ✕ that only exists
+ // inside a canvas is a second answer to a question already answered, and it
+ // was the reason an earlier draft hid the gutter, which is the ONLY way to
+ // reach Turn into, Duplicate and Delete on a phone.
+ const grip = document.createElement('button')
+ grip.type = 'button'
+ grip.className = 'sp-cv-grip'
+ grip.innerHTML = ICONS.grip
+ grip.title = t('Drag to move this card')
+ grip.setAttribute('aria-label', t('Drag to move this card'))
+ card.appendChild(grip)
+
+ grip.addEventListener('mousedown', (down) => startDrag(down, card, body, id, hooks))
+
+ // THE KEYBOARD MOVES IT TOO. A surface reachable only by mouse is a surface
+ // half this app's readers cannot use, and the same clamp and the same commit
+ // serve both — one keypress is one user action, so one commit is right here
+ // where sixty would be wrong in a drag.
+ grip.addEventListener('keydown', (e) => {
+ const step = e.shiftKey ? 5 : 1
+ const d: Record<string, [number, number]> = {
+ ArrowLeft: [-step, 0], ArrowRight: [step, 0], ArrowUp: [0, -step], ArrowDown: [0, step],
+ }
+ const move = d[e.key]
+ if (!move) return
+ e.preventDefault()
+ const b = hooks.block(id)
+ if (!b) return
+ const now = cardPos(b, indexOfCard(card))
+ const max = limits(card, body)
+ const next = {
+ x: Math.min(max.x, clampPct(now.x + move[0])),
+ y: Math.min(max.y, clampPct(now.y + move[1])),
+ }
+ if (next.x === now.x && next.y === now.y) return
+ card.style.setProperty('--sp-x', String(next.x))
+ card.style.setProperty('--sp-y', String(next.y))
+ commitPos(hooks, id, next)
+ })
+}
+
+const indexOfCard = (card: HTMLElement): number =>
+ Math.max(0, [...(card.parentElement?.children ?? [])].indexOf(card))
+
+/** How far right and down this card's TOP-LEFT may go and still leave the whole
+ * card on the surface. Measured, because a card's height is its text's. */
+function limits(card: HTMLElement, body: HTMLElement): CardPos {
+ const box = body.getBoundingClientRect()
+ const r = card.getBoundingClientRect()
+ if (!box.width || !box.height) return { x: 100, y: 100 }
+ return {
+ x: Math.max(0, round1(100 - (r.width / box.width) * 100)),
+ y: Math.max(0, round1(100 - (r.height / box.height) * 100)),
+ }
+}
+
+function startDrag(
+ down: MouseEvent, card: HTMLElement, body: HTMLElement, id: string, hooks: CanvasHooks,
+): void {
+ down.preventDefault()
+ const box = body.getBoundingClientRect()
+ if (!box.width || !box.height) return
+ const start = card.getBoundingClientRect()
+ // where inside the card the grip was taken hold of, so the card does not jump
+ const grabX = down.clientX - start.left
+ const grabY = down.clientY - start.top
+ const max = limits(card, body)
+ const from = { x: cssNum(card, '--sp-x'), y: cssNum(card, '--sp-y') }
+ let now = from
+ document.body.classList.add('sp-canvas-dragging')
+ card.classList.add('sp-cv-moving')
+
+ const move = (m: MouseEvent) => {
+ now = {
+ x: Math.min(max.x, clampPct(((m.clientX - grabX - box.left) / box.width) * 100)),
+ y: Math.min(max.y, clampPct(((m.clientY - grabY - box.top) / box.height) * 100)),
+ }
+ card.style.setProperty('--sp-x', String(now.x))
+ card.style.setProperty('--sp-y', String(now.y))
+ }
+ const up = () => {
+ window.removeEventListener('mousemove', move)
+ window.removeEventListener('mouseup', up)
+ document.body.classList.remove('sp-canvas-dragging')
+ card.classList.remove('sp-cv-moving')
+ // landed where it started: not a change, so not an undo step
+ if (now.x === from.x && now.y === from.y) return
+ commitPos(hooks, id, now)
+ }
+ window.addEventListener('mousemove', move)
+ window.addEventListener('mouseup', up)
+}
+
+const cssNum = (el: HTMLElement, prop: string): number =>
+ Number(el.style.getPropertyValue(prop)) || 0
+
+/**
+ * WRITE THE POSITION. `structure: false` because nothing moved in the block
+ * list — a canvas drag changes two numbers on one block, and telling the store
+ * otherwise makes it re-key the whole page for a card that slid 4%.
+ */
+function commitPos(hooks: CanvasHooks, id: string, p: CardPos): void {
+ hooks.commit(() => {
+ const b = hooks.block(id)
+ if (!b) return
+ b.x = p.x
+ b.y = p.y
+ }, { structure: false })
+}
diff --git a/spaces/src/editor.ts b/spaces/src/editor.ts
index 4907f4f1..a770ba6d 100644
--- a/spaces/src/editor.ts
+++ b/spaces/src/editor.ts
@@ -18,6 +18,7 @@ import * as collabUi from './collabui.ts'
import { syncNoticeText } from './syncnotice.ts'
import { Store } from './store'
import { renderPage, toneLabel, paintCode } from './render'
+import { wireCanvas, placeNewCard } from './canvas.ts'
import { CODE_LANGS, langLabel, normLang } from './highlight'
import { canonicalize, escText, sanitizeInline, textOf } from './sanitize'
import { FormatBar } from './formatbar'
@@ -1337,6 +1338,8 @@ export class Editor {
const fresh = newBlock('p')
const owner = s.block(blockId)
if (owner?.parent) fresh.parent = owner.parent
+ // a block born inside a canvas is born somewhere ON it
+ placeNewCard(page, fresh)
s.commit(() => {
page.blocks.splice(page.blocks.findIndex((b) => b.id === blockId) + 1, 0, fresh)
})
@@ -2345,6 +2348,15 @@ export class Editor {
}
this.wireBoard(view)
this.wireTables(view)
+ // The canvas keeps its own wiring in its own file: the drag, the cards
+ // and the shape button are one feature and touch nothing else here.
+ wireCanvas(view, {
+ block: (id) => this.store.block(id),
+ page: () => this.store.page,
+ commit: (fn, opts) => this.store.commit(fn, opts),
+ repaint: () => this.paintPage(),
+ pickPage: (then) => this.openPagePicker('', null, then),
+ })
}
// "Load this image" — the reader's consent to contact one remote host.
@@ -3206,6 +3218,7 @@ export class Editor {
SPEC.get(fresh.type)?.init?.(fresh)
if (into) fresh.parent = b.id
else if (b.parent) fresh.parent = b.parent
+ if (s.page) placeNewCard(s.page, fresh)
s.commit(() => {
b.html = before
const page = s.page!
diff --git a/spaces/src/i18n.ts b/spaces/src/i18n.ts
index 5398c359..e8809ce2 100644
--- a/spaces/src/i18n.ts
+++ b/spaces/src/i18n.ts
@@ -12,6 +12,11 @@
import { registerI18n, locale } from '../../kernel/src/i18n.ts'
import type { LocaleChoice } from '../../kernel/src/i18n.ts'
+// EXPLICIT `.ts`, like every other import in this app's newer files. It was
+// extensionless, which node's strip-only TypeScript loader will not follow — so
+// any module that reached t() (and canvas.ts does) could not be handed to a
+// node rig at all, and scripts/test-spaces.mjs had to bundle it first. One
+// character buys a whole subtree of the app back for direct testing.
import { PACKED, PACKED_LOCALES } from './i18n/packed.ts'
/** Offered in the About picker, each labelled in its own language. */
diff --git a/spaces/src/i18n/de.ts b/spaces/src/i18n/de.ts
index 7b2e5c4d..d4d2ede0 100644
--- a/spaces/src/i18n/de.ts
+++ b/spaces/src/i18n/de.ts
@@ -32,8 +32,11 @@ export const de: Catalog = {
"About this space": "Über diesen Space",
"Access reset — only copies saved from now on can join": "Zugriff zurückgesetzt — nur ab jetzt gespeicherte Kopien können beitreten",
"Add a block below": "Block darunter hinzufügen",
+ "Add a card": "Karte hinzufügen",
+ "Add a card that opens a page": "Karte hinzufügen, die eine Seite öffnet",
"Add a column after": "Spalte danach einfügen",
"Add a link": "Link hinzufügen",
+ "Add a page": "Seite hinzufügen",
"Add a picture": "Bild hinzufügen",
"Add a row below": "Zeile darunter einfügen",
"Add below": "Darunter einfügen",
@@ -72,11 +75,14 @@ export const de: Catalog = {
"Callout": "Hinweisblock",
"Callout icon": "Symbol des Hinweisfelds",
"Cancel": "Abbrechen",
+ "Canvas": "Leinwand",
+ "Cards you place by hand": "Karten, die du selbst platzierst",
"Careful": "Vorsicht",
"Caution": "Achtung",
"Change password…": "Passwort ändern…",
"Change the kind of callout": "Art des Hinweisfelds ändern",
"Change the name used for your new comments and replies": "Namen für neue Kommentare und Antworten ändern",
+ "Change the shape of this canvas": "Form dieser Leinwand ändern",
"Change this block’s type": "Den Typ dieses Blocks ändern",
"Change this page's icon": "Symbol dieser Seite ändern",
"Change {field}": "{field} ändern",
@@ -143,6 +149,7 @@ export const de: Catalog = {
"Downloaded ✓": "Heruntergeladen ✓",
"Downloaded. Open the new file — this one is unchanged.": "Heruntergeladen. Öffne die neue Datei — diese hier bleibt unverändert.",
"Downloads a backup of the current version, then rewrites this file on disk as the new version — document untouched.": "Lädt ein Backup der aktuellen Version herunter und schreibt diese Datei dann als neue Version — das Dokument bleibt unverändert.",
+ "Drag to move this card": "Zum Verschieben dieser Karte ziehen",
"Drag to move, click for block options": "Ziehen zum Verschieben, klicken für Block-Optionen",
"Drag to resize this column": "Ziehen, um die Spaltenbreite zu ändern",
"Drag to resize · double-click to reset": "Ziehen zum Anpassen · Doppelklick setzt zurück",
@@ -255,6 +262,7 @@ export const de: Catalog = {
"Move down": "Nach unten",
"Move up": "Nach oben",
"Muted": "Stumm",
+ "Name this canvas": "Diese Leinwand benennen",
"New issue": "Neues Issue",
"New page": "Neue Seite",
"New page (⌘⌥N)": "Neue Seite (⌘⌥N)",
@@ -276,6 +284,7 @@ export const de: Catalog = {
"Nothing found": "Nichts gefunden",
"Nothing is fetched. A card shows what you type here — opening this space never contacts the site.": "Es wird nichts abgerufen. Die Karte zeigt, was Sie hier eintragen — das Öffnen dieses Space kontaktiert die Website nie.",
"Nothing leaves this file until you start a session.": "Nichts verlässt diese Datei, bis du eine Sitzung startest.",
+ "Nothing on this canvas yet.": "Auf dieser Leinwand ist noch nichts.",
"Nothing to draw yet — link two pages with [[ and they will appear here.": "Noch nichts zu zeichnen — verknüpfe zwei Seiten mit [[ und sie erscheinen hier.",
"Now an issue": "Jetzt ein Issue",
"Numbered list": "Nummerierte Liste",
@@ -397,6 +406,7 @@ export const de: Catalog = {
"Sort": "Sortieren",
"Sort by {field}": "Nach {field} sortieren",
"Space name": "Space-Name",
+ "Square": "Quadratisch",
"Start live session": "Live-Sitzung starten",
"Start silent": "Ohne Ton starten",
"Stop sharing": "Freigabe beenden",
@@ -407,6 +417,7 @@ export const de: Catalog = {
"Table": "Tabelle",
"Take it elsewhere": "Woanders weitermachen",
"Taken from the address if blank": "Bleibt das Feld leer, wird er aus der Adresse übernommen",
+ "Tall": "Hoch",
"Text": "Text",
"Text and background color": "Text- und Hintergrundfarbe",
"Text formatting": "Textformatierung",
diff --git a/spaces/src/i18n/es.ts b/spaces/src/i18n/es.ts
index 03b59e8b..49d8e687 100644
--- a/spaces/src/i18n/es.ts
+++ b/spaces/src/i18n/es.ts
@@ -32,8 +32,11 @@ export const es: Catalog = {
"About this space": "Acerca de este espacio",
"Access reset — only copies saved from now on can join": "Acceso restablecido — solo las copias guardadas a partir de ahora podrán unirse",
"Add a block below": "Añadir un bloque debajo",
+ "Add a card": "Añadir una tarjeta",
+ "Add a card that opens a page": "Añadir una tarjeta que abre una página",
"Add a column after": "Añadir una columna después",
"Add a link": "Añadir un enlace",
+ "Add a page": "Añadir una página",
"Add a picture": "Añadir una imagen",
"Add a row below": "Añadir una fila debajo",
"Add below": "Añadir debajo",
@@ -72,11 +75,14 @@ export const es: Catalog = {
"Callout": "Aviso",
"Callout icon": "Icono del aviso",
"Cancel": "Cancelar",
+ "Canvas": "Lienzo",
+ "Cards you place by hand": "Tarjetas que colocas a mano",
"Careful": "Con cuidado",
"Caution": "Precaución",
"Change password…": "Cambiar contraseña…",
"Change the kind of callout": "Cambiar el tipo de aviso",
"Change the name used for your new comments and replies": "Cambiar el nombre para tus nuevos comentarios y respuestas",
+ "Change the shape of this canvas": "Cambiar la forma de este lienzo",
"Change this block’s type": "Cambiar el tipo de este bloque",
"Change this page's icon": "Cambiar el icono de esta página",
"Change {field}": "Cambiar {field}",
@@ -143,6 +149,7 @@ export const es: Catalog = {
"Downloaded ✓": "Descargado ✓",
"Downloaded. Open the new file — this one is unchanged.": "Descargado. Abre el archivo nuevo — este no ha cambiado.",
"Downloads a backup of the current version, then rewrites this file on disk as the new version — document untouched.": "Descarga una copia de seguridad de la versión actual y reescribe este archivo con la nueva versión — el documento no cambia.",
+ "Drag to move this card": "Arrastra para mover esta tarjeta",
"Drag to move, click for block options": "Arrastra para mover, haz clic para las opciones del bloque",
"Drag to resize this column": "Arrastra para cambiar el ancho de esta columna",
"Drag to resize · double-click to reset": "Arrastra para redimensionar · doble clic para restablecer",
@@ -255,6 +262,7 @@ export const es: Catalog = {
"Move down": "Bajar",
"Move up": "Subir",
"Muted": "Silenciado",
+ "Name this canvas": "Nombra este lienzo",
"New issue": "Nueva incidencia",
"New page": "Nueva página",
"New page (⌘⌥N)": "Nueva página (⌘⌥N)",
@@ -276,6 +284,7 @@ export const es: Catalog = {
"Nothing found": "Sin resultados",
"Nothing is fetched. A card shows what you type here — opening this space never contacts the site.": "No se descarga nada. La tarjeta muestra lo que escribas aquí: abrir este espacio nunca contacta con el sitio.",
"Nothing leaves this file until you start a session.": "Nada sale de este archivo hasta que inicies una sesión.",
+ "Nothing on this canvas yet.": "Aún no hay nada en este lienzo.",
"Nothing to draw yet — link two pages with [[ and they will appear here.": "Todavía no hay nada que dibujar — enlaza dos páginas con [[ y aparecerán aquí.",
"Now an issue": "Ahora es una incidencia",
"Numbered list": "Lista numerada",
@@ -397,6 +406,7 @@ export const es: Catalog = {
"Sort": "Ordenar",
"Sort by {field}": "Ordenar por {field}",
"Space name": "Nombre del espacio",
+ "Square": "Cuadrado",
"Start live session": "Iniciar sesión en vivo",
"Start silent": "Empezar en silencio",
"Stop sharing": "Dejar de compartir",
@@ -407,6 +417,7 @@ export const es: Catalog = {
"Table": "Tabla",
"Take it elsewhere": "Llévatelo a otra parte",
"Taken from the address if blank": "Si se deja vacío, se toma de la dirección",
+ "Tall": "Alto",
"Text": "Texto",
"Text and background color": "Color de texto y de fondo",
"Text formatting": "Formato de texto",
diff --git a/spaces/src/i18n/fr.ts b/spaces/src/i18n/fr.ts
index 51545c22..2a5d0243 100644
--- a/spaces/src/i18n/fr.ts
+++ b/spaces/src/i18n/fr.ts
@@ -32,8 +32,11 @@ export const fr: Catalog = {
"About this space": "À propos de cet espace",
"Access reset — only copies saved from now on can join": "Accès réinitialisé — seules les copies enregistrées désormais pourront rejoindre",
"Add a block below": "Ajouter un bloc en dessous",
+ "Add a card": "Ajouter une carte",
+ "Add a card that opens a page": "Ajouter une carte qui ouvre une page",
"Add a column after": "Ajouter une colonne après",
"Add a link": "Ajouter un lien",
+ "Add a page": "Ajouter une page",
"Add a picture": "Ajouter une image",
"Add a row below": "Ajouter une ligne en dessous",
"Add below": "Ajouter en dessous",
@@ -72,11 +75,14 @@ export const fr: Catalog = {
"Callout": "Encadré",
"Callout icon": "Icône de l'encadré",
"Cancel": "Annuler",
+ "Canvas": "Canevas",
+ "Cards you place by hand": "Des cartes que vous placez à la main",
"Careful": "Prudence",
"Caution": "Attention",
"Change password…": "Changer le mot de passe…",
"Change the kind of callout": "Changer le type d'encadré",
"Change the name used for your new comments and replies": "Changer le nom utilisé pour vos nouveaux commentaires et réponses",
+ "Change the shape of this canvas": "Changer la forme de ce canevas",
"Change this block’s type": "Changer le type de ce bloc",
"Change this page's icon": "Changer l’icône de cette page",
"Change {field}": "Modifier {field}",
@@ -143,6 +149,7 @@ export const fr: Catalog = {
"Downloaded ✓": "Téléchargé ✓",
"Downloaded. Open the new file — this one is unchanged.": "Téléchargé. Ouvrez le nouveau fichier — celui-ci est inchangé.",
"Downloads a backup of the current version, then rewrites this file on disk as the new version — document untouched.": "Télécharge une sauvegarde de la version actuelle, puis réécrit ce fichier avec la nouvelle version — document intact.",
+ "Drag to move this card": "Faites glisser pour déplacer cette carte",
"Drag to move, click for block options": "Glissez pour déplacer, cliquez pour les options du bloc",
"Drag to resize this column": "Faites glisser pour redimensionner cette colonne",
"Drag to resize · double-click to reset": "Glisser pour redimensionner · double-clic pour réinitialiser",
@@ -255,6 +262,7 @@ export const fr: Catalog = {
"Move down": "Descendre",
"Move up": "Monter",
"Muted": "Muet",
+ "Name this canvas": "Nommez ce canevas",
"New issue": "Nouveau ticket",
"New page": "Nouvelle page",
"New page (⌘⌥N)": "Nouvelle page (⌘⌥N)",
@@ -276,6 +284,7 @@ export const fr: Catalog = {
"Nothing found": "Aucun résultat",
"Nothing is fetched. A card shows what you type here — opening this space never contacts the site.": "Rien n’est récupéré. La carte affiche ce que vous saisissez ici — ouvrir cet espace ne contacte jamais le site.",
"Nothing leaves this file until you start a session.": "Rien ne quitte ce fichier tant que vous n’avez pas démarré de session.",
+ "Nothing on this canvas yet.": "Rien sur ce canevas pour l’instant.",
"Nothing to draw yet — link two pages with [[ and they will appear here.": "Rien à dessiner pour l’instant — reliez deux pages avec [[ et elles apparaîtront ici.",
"Now an issue": "C’est désormais un ticket",
"Numbered list": "Liste numérotée",
@@ -397,6 +406,7 @@ export const fr: Catalog = {
"Sort": "Trier",
"Sort by {field}": "Trier par {field}",
"Space name": "Nom de l’espace",
+ "Square": "Carré",
"Start live session": "Démarrer la session en direct",
"Start silent": "Démarrer sans le son",
"Stop sharing": "Arrêter le partage",
@@ -407,6 +417,7 @@ export const fr: Catalog = {
"Table": "Tableau",
"Take it elsewhere": "Emportez-le ailleurs",
"Taken from the address if blank": "Si vide, repris de l’adresse",
+ "Tall": "Haut",
"Text": "Texte",
"Text and background color": "Couleur du texte et du fond",
"Text formatting": "Mise en forme du texte",
diff --git a/spaces/src/i18n/it.ts b/spaces/src/i18n/it.ts
index 7061df41..b7c96f27 100644
--- a/spaces/src/i18n/it.ts
+++ b/spaces/src/i18n/it.ts
@@ -32,8 +32,11 @@ export const it: Catalog = {
"About this space": "Informazioni su questo spazio",
"Access reset — only copies saved from now on can join": "Accesso reimpostato — solo le copie salvate d’ora in poi potranno unirsi",
"Add a block below": "Aggiungi un blocco sotto",
+ "Add a card": "Aggiungi una scheda",
+ "Add a card that opens a page": "Aggiungi una scheda che apre una pagina",
"Add a column after": "Aggiungi una colonna dopo",
"Add a link": "Aggiungi un collegamento",
+ "Add a page": "Aggiungi una pagina",
"Add a picture": "Aggiungi un'immagine",
"Add a row below": "Aggiungi una riga sotto",
"Add below": "Aggiungi sotto",
@@ -72,11 +75,14 @@ export const it: Catalog = {
"Callout": "Riquadro",
"Callout icon": "Icona del riquadro",
"Cancel": "Annulla",
+ "Canvas": "Tela",
+ "Cards you place by hand": "Schede che disponi a mano",
"Careful": "Attenzione",
"Caution": "Attenzione",
"Change password…": "Cambia password…",
"Change the kind of callout": "Cambia il tipo di riquadro",
"Change the name used for your new comments and replies": "Cambia il nome usato per i tuoi nuovi commenti e risposte",
+ "Change the shape of this canvas": "Cambia la forma di questa tela",
"Change this block’s type": "Cambia il tipo di questo blocco",
"Change this page's icon": "Cambia l’icona di questa pagina",
"Change {field}": "Cambia {field}",
@@ -143,6 +149,7 @@ export const it: Catalog = {
"Downloaded ✓": "Scaricato ✓",
"Downloaded. Open the new file — this one is unchanged.": "Scaricato. Apri il nuovo file — questo resta invariato.",
"Downloads a backup of the current version, then rewrites this file on disk as the new version — document untouched.": "Scarica un backup della versione attuale, poi riscrive questo file come nuova versione — documento intatto.",
+ "Drag to move this card": "Trascina per spostare questa scheda",
"Drag to move, click for block options": "Trascina per spostare, clicca per le opzioni del blocco",
"Drag to resize this column": "Trascina per ridimensionare questa colonna",
"Drag to resize · double-click to reset": "Trascina per ridimensionare · doppio clic per reimpostare",
@@ -255,6 +262,7 @@ export const it: Catalog = {
"Move down": "Sposta giù",
"Move up": "Sposta su",
"Muted": "Muto",
+ "Name this canvas": "Dai un nome a questa tela",
"New issue": "Nuova issue",
"New page": "Nuova pagina",
"New page (⌘⌥N)": "Nuova pagina (⌘⌥N)",
@@ -276,6 +284,7 @@ export const it: Catalog = {
"Nothing found": "Nessun risultato",
"Nothing is fetched. A card shows what you type here — opening this space never contacts the site.": "Non viene scaricato nulla. La scheda mostra ciò che scrivi qui: aprire questo spazio non contatta mai il sito.",
"Nothing leaves this file until you start a session.": "Niente esce da questo file finché non avvii una sessione.",
+ "Nothing on this canvas yet.": "Non c’è ancora nulla su questa tela.",
"Nothing to draw yet — link two pages with [[ and they will appear here.": "Non c’è ancora nulla da disegnare — collega due pagine con [[ e appariranno qui.",
"Now an issue": "Ora è una issue",
"Numbered list": "Elenco numerato",
@@ -397,6 +406,7 @@ export const it: Catalog = {
"Sort": "Ordina",
"Sort by {field}": "Ordina per {field}",
"Space name": "Nome dello spazio",
+ "Square": "Quadrato",
"Start live session": "Avvia sessione dal vivo",
"Start silent": "Parti senza audio",
"Stop sharing": "Interrompi condivisione",
@@ -407,6 +417,7 @@ export const it: Catalog = {
"Table": "Tabella",
"Take it elsewhere": "Portalo altrove",
"Taken from the address if blank": "Se vuoto, viene preso dall'indirizzo",
+ "Tall": "Alto",
"Text": "Testo",
"Text and background color": "Colore del testo e dello sfondo",
"Text formatting": "Formattazione del testo",
diff --git a/spaces/src/i18n/ja.ts b/spaces/src/i18n/ja.ts
index 33be08c0..d65e47cf 100644
--- a/spaces/src/i18n/ja.ts
+++ b/spaces/src/i18n/ja.ts
@@ -32,8 +32,11 @@ export const ja: Catalog = {
"About this space": "このスペースについて",
"Access reset — only copies saved from now on can join": "アクセスをリセットしました — 今後保存したコピーだけが参加できます",
"Add a block below": "下にブロックを追加",
+ "Add a card": "カードを追加",
+ "Add a card that opens a page": "ページを開くカードを追加",
"Add a column after": "右に列を追加",
"Add a link": "リンクを追加",
+ "Add a page": "ページを追加",
"Add a picture": "画像を追加",
"Add a row below": "下に行を追加",
"Add below": "下に追加",
@@ -72,11 +75,14 @@ export const ja: Catalog = {
"Callout": "コールアウト",
"Callout icon": "囲みのアイコン",
"Cancel": "キャンセル",
+ "Canvas": "キャンバス",
+ "Cards you place by hand": "自由に配置できるカード",
"Careful": "取り扱い注意",
"Caution": "注意",
"Change password…": "パスワードを変更…",
"Change the kind of callout": "囲みの種類を変更",
"Change the name used for your new comments and replies": "新しいコメントと返信に使う名前を変更",
+ "Change the shape of this canvas": "このキャンバスの形を変更",
"Change this block’s type": "このブロックの種類を変更します",
"Change this page's icon": "このページのアイコンを変更",
"Change {field}": "{field}を変更",
@@ -143,6 +149,7 @@ export const ja: Catalog = {
"Downloaded ✓": "ダウンロード完了 ✓",
"Downloaded. Open the new file — this one is unchanged.": "ダウンロードしました。新しいファイルを開いてください — このファイルは変更されていません。",
"Downloads a backup of the current version, then rewrites this file on disk as the new version — document untouched.": "現在のバージョンのバックアップをダウンロードしてから、このファイルを新バージョンに書き換えます — ドキュメントはそのまま。",
+ "Drag to move this card": "ドラッグしてこのカードを移動",
"Drag to move, click for block options": "ドラッグで移動、クリックでブロックのオプション",
"Drag to resize this column": "ドラッグして列の幅を変更",
"Drag to resize · double-click to reset": "ドラッグで幅を変更 · ダブルクリックで既定に戻す",
@@ -255,6 +262,7 @@ export const ja: Catalog = {
"Move down": "下へ移動",
"Move up": "上へ移動",
"Muted": "ミュート",
+ "Name this canvas": "このキャンバスに名前を付ける",
"New issue": "新しいイシュー",
"New page": "新規ページ",
"New page (⌘⌥N)": "新規ページ (⌘⌥N)",
@@ -276,6 +284,7 @@ export const ja: Catalog = {
"Nothing found": "見つかりませんでした",
"Nothing is fetched. A card shows what you type here — opening this space never contacts the site.": "何も取得しません。カードにはここで入力した内容が表示され、このスペースを開いてもサイトに接続することはありません。",
"Nothing leaves this file until you start a session.": "セッションを開始するまで、このファイルから外に出るものはありません。",
+ "Nothing on this canvas yet.": "このキャンバスにはまだ何もありません。",
"Nothing to draw yet — link two pages with [[ and they will appear here.": "まだ描くものがありません — [[ で 2 つのページをつなぐと、ここに現れます。",
"Now an issue": "イシューになりました",
"Numbered list": "番号付きリスト",
@@ -397,6 +406,7 @@ export const ja: Catalog = {
"Sort": "並べ替え",
"Sort by {field}": "{field}で並べ替え",
"Space name": "スペース名",
+ "Square": "正方形",
"Start live session": "ライブセッションを開始",
"Start silent": "音を出さずに開始する",
"Stop sharing": "共有を停止",
@@ -407,6 +417,7 @@ export const ja: Catalog = {
"Table": "表",
"Take it elsewhere": "外に持ち出す",
"Taken from the address if blank": "空欄ならアドレスから取り込みます",
+ "Tall": "縦長",
"Text": "テキスト",
"Text and background color": "文字色と背景色",
"Text formatting": "文字の書式",
diff --git a/spaces/src/i18n/packed.ts b/spaces/src/i18n/packed.ts
index e5ea57bd..0f7b1edc 100644
--- a/spaces/src/i18n/packed.ts
+++ b/spaces/src/i18n/packed.ts
@@ -34,8 +34,11 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Access reset — only copies saved from now on can join": ["アクセスをリセットしました — 今後保存したコピーだけが参加できます","访问已重置 — 只有此后保存的副本才能加入","存取已重設 — 只有此後儲存的副本才能加入","Acceso restablecido — solo las copias guardadas a partir de ahora podrán unirse","Accès réinitialisé — seules les copies enregistrées désormais pourront rejoindre","Zugriff zurückgesetzt — nur ab jetzt gespeicherte Kopien können beitreten","Accesso reimpostato — solo le copie salvate d’ora in poi potranno unirsi","Acesso redefinido — apenas cópias salvas de agora em diante podem entrar"],
"Add": ["追加","添加","新增","Añadir","Ajouter","Hinzufügen","Aggiungi","Adicionar"],
"Add a block below": ["下にブロックを追加","在下方添加块","在下方新增區塊","Añadir un bloque debajo","Ajouter un bloc en dessous","Block darunter hinzufügen","Aggiungi un blocco sotto","Adicionar um bloco abaixo"],
+ "Add a card": ["カードを追加","添加卡片","新增卡片","Añadir una tarjeta","Ajouter une carte","Karte hinzufügen","Aggiungi una scheda","Adicionar um cartão"],
+ "Add a card that opens a page": ["ページを開くカードを追加","添加一张打开页面的卡片","新增可開啟頁面的卡片","Añadir una tarjeta que abre una página","Ajouter une carte qui ouvre une page","Karte hinzufügen, die eine Seite öffnet","Aggiungi una scheda che apre una pagina","Adicionar um cartão que abre uma página"],
"Add a column after": ["右に列を追加","在右侧添加一列","在右側新增一欄","Añadir una columna después","Ajouter une colonne après","Spalte danach einfügen","Aggiungi una colonna dopo","Adicionar uma coluna depois"],
"Add a link": ["リンクを追加","添加链接","新增連結","Añadir un enlace","Ajouter un lien","Link hinzufügen","Aggiungi un collegamento","Adicionar um link"],
+ "Add a page": ["ページを追加","添加页面","新增頁面","Añadir una página","Ajouter une page","Seite hinzufügen","Aggiungi una pagina","Adicionar uma página"],
"Add a picture": ["画像を追加","添加图片","新增圖片","Añadir una imagen","Ajouter une image","Bild hinzufügen","Aggiungi un'immagine","Adicionar uma imagem"],
"Add a property": ["プロパティを追加","添加属性","新增屬性","Añadir una propiedad","Ajouter une propriété","Eine Eigenschaft hinzufügen","Aggiungi una proprietà","Adicionar uma propriedade"],
"Add a row below": ["下に行を追加","在下方添加一行","在下方新增一列","Añadir una fila debajo","Ajouter une ligne en dessous","Zeile darunter einfügen","Aggiungi una riga sotto","Adicionar uma linha abaixo"],
@@ -76,11 +79,14 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Callout": ["コールアウト","标注","標註","Aviso","Encadré","Hinweisblock","Riquadro","Destaque"],
"Callout icon": ["囲みのアイコン","标注图标","標註圖示","Icono del aviso","Icône de l'encadré","Symbol des Hinweisfelds","Icona del riquadro","Ícone do destaque"],
"Cancel": ["キャンセル","取消","取消","Cancelar","Annuler","Abbrechen","Annulla","Cancelar"],
+ "Canvas": ["キャンバス","画布","畫布","Lienzo","Canevas","Leinwand","Tela","Tela"],
+ "Cards you place by hand": ["自由に配置できるカード","由你手动摆放的卡片","由你手動擺放的卡片","Tarjetas que colocas a mano","Des cartes que vous placez à la main","Karten, die du selbst platzierst","Schede che disponi a mano","Cartões que você posiciona à mão"],
"Careful": ["取り扱い注意","请谨慎","請謹慎","Con cuidado","Prudence","Vorsicht","Attenzione","Cuidado"],
"Caution": ["注意","当心","當心","Precaución","Attention","Achtung","Attenzione","Cuidado"],
"Change password…": ["パスワードを変更…","更改密码…","變更密碼…","Cambiar contraseña…","Changer le mot de passe…","Passwort ändern…","Cambia password…","Alterar senha…"],
"Change the kind of callout": ["囲みの種類を変更","更改标注类型","變更標註類型","Cambiar el tipo de aviso","Changer le type d'encadré","Art des Hinweisfelds ändern","Cambia il tipo di riquadro","Alterar o tipo de destaque"],
"Change the name used for your new comments and replies": ["新しいコメントと返信に使う名前を変更","更改新评论和回复所用的名字","變更新註解與回覆所用的名字","Cambiar el nombre para tus nuevos comentarios y respuestas","Changer le nom utilisé pour vos nouveaux commentaires et réponses","Namen für neue Kommentare und Antworten ändern","Cambia il nome usato per i tuoi nuovi commenti e risposte","Altere o nome usado nos seus novos comentários e respostas"],
+ "Change the shape of this canvas": ["このキャンバスの形を変更","更改此画布的形状","變更此畫布的形狀","Cambiar la forma de este lienzo","Changer la forme de ce canevas","Form dieser Leinwand ändern","Cambia la forma di questa tela","Alterar o formato desta tela"],
"Change this block’s type": ["このブロックの種類を変更します","更改此块的类型","變更此區塊的類型","Cambiar el tipo de este bloque","Changer le type de ce bloc","Den Typ dieses Blocks ändern","Cambia il tipo di questo blocco","Alterar o tipo deste bloco"],
"Change this page's icon": ["このページのアイコンを変更","更改此页面的图标","變更此頁面的圖示","Cambiar el icono de esta página","Changer l’icône de cette page","Symbol dieser Seite ändern","Cambia l’icona di questa pagina","Mudar o ícone desta página"],
"Change {field}": ["{field}を変更","更改{field}","變更{field}","Cambiar {field}","Modifier {field}","{field} ändern","Cambia {field}","Alterar {field}"],
@@ -145,6 +151,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Download updated copy": ["更新版をダウンロード","下载更新副本","下載更新副本","Descargar copia actualizada","Télécharger la copie à jour","Aktualisierte Kopie herunterladen","Scarica copia aggiornata","Baixar cópia atualizada"],
"Downloaded ✓": ["ダウンロード完了 ✓","已下载 ✓","已下載 ✓","Descargado ✓","Téléchargé ✓","Heruntergeladen ✓","Scaricato ✓","Baixado ✓"],
"Downloads a backup of the current version, then rewrites this file on disk as the new version — document untouched.": ["現在のバージョンのバックアップをダウンロードしてから、このファイルを新バージョンに書き換えます — ドキュメントはそのまま。","先下载当前版本的备份,然后将此文件改写为新版本 — 文档内容不变。","先下載目前版本的備份,再將此檔案改寫為新版本 — 文件內容不變。","Descarga una copia de seguridad de la versión actual y reescribe este archivo con la nueva versión — el documento no cambia.","Télécharge une sauvegarde de la version actuelle, puis réécrit ce fichier avec la nouvelle version — document intact.","Lädt ein Backup der aktuellen Version herunter und schreibt diese Datei dann als neue Version — das Dokument bleibt unverändert.","Scarica un backup della versione attuale, poi riscrive questo file come nuova versione — documento intatto.","Baixa um backup da versão atual e depois regrava este arquivo no disco como a nova versão — o documento não é alterado."],
+ "Drag to move this card": ["ドラッグしてこのカードを移動","拖动以移动此卡片","拖曳以移動此卡片","Arrastra para mover esta tarjeta","Faites glisser pour déplacer cette carte","Zum Verschieben dieser Karte ziehen","Trascina per spostare questa scheda","Arraste para mover este cartão"],
"Drag to move, click for block options": ["ドラッグで移動、クリックでブロックのオプション","拖动可移动,点击打开块选项","拖曳可移動,點按開啟區塊選項","Arrastra para mover, haz clic para las opciones del bloque","Glissez pour déplacer, cliquez pour les options du bloc","Ziehen zum Verschieben, klicken für Block-Optionen","Trascina per spostare, clicca per le opzioni del blocco","Arraste para mover, clique para as opções do bloco"],
"Drag to resize this column": ["ドラッグして列の幅を変更","拖动以调整此列宽度","拖曳以調整此欄寬度","Arrastra para cambiar el ancho de esta columna","Faites glisser pour redimensionner cette colonne","Ziehen, um die Spaltenbreite zu ändern","Trascina per ridimensionare questa colonna","Arraste para redimensionar esta coluna"],
"Drag to resize · double-click to reset": ["ドラッグで幅を変更 · ダブルクリックで既定に戻す","拖动可调整宽度 · 双击恢复默认","拖曳可調整寬度 · 雙擊還原預設","Arrastra para redimensionar · doble clic para restablecer","Glisser pour redimensionner · double-clic pour réinitialiser","Ziehen zum Anpassen · Doppelklick setzt zurück","Trascina per ridimensionare · doppio clic per reimpostare","Arrasta para redimensionar · duplo clique para repor"],
@@ -264,6 +271,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Move up": ["上へ移動","上移","上移","Subir","Monter","Nach oben","Sposta su","Mover para cima"],
"Muted": ["ミュート","静音","靜音","Silenciado","Muet","Stumm","Muto","Sem som"],
"Name": ["名前","名称","名稱","Nombre","Nom","Name","Nome","Nome"],
+ "Name this canvas": ["このキャンバスに名前を付ける","为此画布命名","為此畫布命名","Nombra este lienzo","Nommez ce canevas","Diese Leinwand benennen","Dai un nome a questa tela","Dê um nome a esta tela"],
"Nested under": ["この下のページ","嵌套于","巢狀於","Anidadas en","Imbriquées sous","Verschachtelt unter","Annidate sotto","Aninhadas em"],
"New issue": ["新しいイシュー","新建事项","新增項目","Nueva incidencia","Nouveau ticket","Neues Issue","Nuova issue","Nova tarefa"],
"New page": ["新規ページ","新建页面","新增頁面","Nueva página","Nouvelle page","Neue Seite","Nuova pagina","Nova página"],
@@ -287,6 +295,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Nothing found": ["見つかりませんでした","没有结果","找不到結果","Sin resultados","Aucun résultat","Nichts gefunden","Nessun risultato","Nada encontrado"],
"Nothing is fetched. A card shows what you type here — opening this space never contacts the site.": ["何も取得しません。カードにはここで入力した内容が表示され、このスペースを開いてもサイトに接続することはありません。","不会抓取任何内容。卡片显示的就是你在这里输入的内容——打开这个空间绝不会联系该网站。","不會抓取任何內容。卡片顯示的就是你在這裡輸入的內容——開啟這個空間絕不會連線到該網站。","No se descarga nada. La tarjeta muestra lo que escribas aquí: abrir este espacio nunca contacta con el sitio.","Rien n’est récupéré. La carte affiche ce que vous saisissez ici — ouvrir cet espace ne contacte jamais le site.","Es wird nichts abgerufen. Die Karte zeigt, was Sie hier eintragen — das Öffnen dieses Space kontaktiert die Website nie.","Non viene scaricato nulla. La scheda mostra ciò che scrivi qui: aprire questo spazio non contatta mai il sito.","Nada é obtido. O cartão mostra o que você escrever aqui — abrir este espaço nunca contacta o site."],
"Nothing leaves this file until you start a session.": ["セッションを開始するまで、このファイルから外に出るものはありません。","在你开始会话之前,没有任何内容离开这个文件。","在你開始工作階段之前,沒有任何內容離開這個檔案。","Nada sale de este archivo hasta que inicies una sesión.","Rien ne quitte ce fichier tant que vous n’avez pas démarré de session.","Nichts verlässt diese Datei, bis du eine Sitzung startest.","Niente esce da questo file finché non avvii una sessione.","Nada sai deste ficheiro até iniciares uma sessão."],
+ "Nothing on this canvas yet.": ["このキャンバスにはまだ何もありません。","此画布上还没有内容。","此畫布上還沒有內容。","Aún no hay nada en este lienzo.","Rien sur ce canevas pour l’instant.","Auf dieser Leinwand ist noch nichts.","Non c’è ancora nulla su questa tela.","Ainda não há nada nesta tela."],
"Nothing to draw yet — link two pages with [[ and they will appear here.": ["まだ描くものがありません — [[ で 2 つのページをつなぐと、ここに現れます。","还没有可绘制的内容 — 用 [[ 链接两个页面,它们就会出现在这里。","還沒有可繪製的內容 — 用 [[ 連結兩個頁面,它們就會出現在這裡。","Todavía no hay nada que dibujar — enlaza dos páginas con [[ y aparecerán aquí.","Rien à dessiner pour l’instant — reliez deux pages avec [[ et elles apparaîtront ici.","Noch nichts zu zeichnen — verknüpfe zwei Seiten mit [[ und sie erscheinen hier.","Non c’è ancora nulla da disegnare — collega due pagine con [[ e appariranno qui.","Ainda não há nada para desenhar — liga duas páginas com [[ e aparecerão aqui."],
"Now an issue": ["イシューになりました","现在是事项了","現在是項目了","Ahora es una incidencia","C’est désormais un ticket","Jetzt ein Issue","Ora è una issue","Agora é uma tarefa"],
"Numbered list": ["番号付きリスト","编号列表","編號清單","Lista numerada","Liste numérotée","Nummerierte Liste","Elenco numerato","Lista numerada"],
@@ -405,6 +414,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Sort": ["並べ替え","排序","排序","Ordenar","Trier","Sortieren","Ordina","Ordenar"],
"Sort by {field}": ["{field}で並べ替え","按{field}排序","依{field}排序","Ordenar por {field}","Trier par {field}","Nach {field} sortieren","Ordina per {field}","Ordenar por {field}"],
"Space name": ["スペース名","空间名称","空間名稱","Nombre del espacio","Nom de l’espace","Space-Name","Nome dello spazio","Nome do espaço"],
+ "Square": ["正方形","方形","方形","Cuadrado","Carré","Quadratisch","Quadrato","Quadrado"],
"Start live session": ["ライブセッションを開始","开始实时会话","開始即時工作階段","Iniciar sesión en vivo","Démarrer la session en direct","Live-Sitzung starten","Avvia sessione dal vivo","Iniciar sessão ao vivo"],
"Start silent": ["音を出さずに開始する","开始时静音","開始時靜音","Empezar en silencio","Démarrer sans le son","Ohne Ton starten","Parti senza audio","Começar sem som"],
"Stop sharing": ["共有を停止","停止共享","停止共用","Dejar de compartir","Arrêter le partage","Freigabe beenden","Interrompi condivisione","Parar de compartilhar"],
@@ -415,6 +425,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Table": ["表","表格","表格","Tabla","Tableau","Tabelle","Tabella","Tabela"],
"Take it elsewhere": ["外に持ち出す","把内容带走","把內容帶走","Llévatelo a otra parte","Emportez-le ailleurs","Woanders weitermachen","Portalo altrove","Levar para outro lado"],
"Taken from the address if blank": ["空欄ならアドレスから取り込みます","留空则取自网址","留空則取自網址","Si se deja vacío, se toma de la dirección","Si vide, repris de l’adresse","Bleibt das Feld leer, wird er aus der Adresse übernommen","Se vuoto, viene preso dall'indirizzo","Se ficar vazio, é retirado do endereço"],
+ "Tall": ["縦長","竖向","直式","Alto","Haut","Hoch","Alto","Alto"],
"Text": ["テキスト","文本","文字","Texto","Texte","Text","Testo","Texto"],
"Text and background color": ["文字色と背景色","文字与背景颜色","文字與背景顏色","Color de texto y de fondo","Couleur du texte et du fond","Text- und Hintergrundfarbe","Colore del testo e dello sfondo","Cor do texto e do plano de fundo"],
"Text formatting": ["文字の書式","文字格式","文字格式","Formato de texto","Mise en forme du texte","Textformatierung","Formattazione del testo","Formatação de texto"],
diff --git a/spaces/src/i18n/pt.ts b/spaces/src/i18n/pt.ts
index 97c473fd..2f39d430 100644
--- a/spaces/src/i18n/pt.ts
+++ b/spaces/src/i18n/pt.ts
@@ -32,8 +32,11 @@ export const pt: Catalog = {
"About this space": "Sobre este espaço",
"Access reset — only copies saved from now on can join": "Acesso redefinido — apenas cópias salvas de agora em diante podem entrar",
"Add a block below": "Adicionar um bloco abaixo",
+ "Add a card": "Adicionar um cartão",
+ "Add a card that opens a page": "Adicionar um cartão que abre uma página",
"Add a column after": "Adicionar uma coluna depois",
"Add a link": "Adicionar um link",
+ "Add a page": "Adicionar uma página",
"Add a picture": "Adicionar uma imagem",
"Add a row below": "Adicionar uma linha abaixo",
"Add below": "Adicionar abaixo",
@@ -72,11 +75,14 @@ export const pt: Catalog = {
"Callout": "Destaque",
"Callout icon": "Ícone do destaque",
"Cancel": "Cancelar",
+ "Canvas": "Tela",
+ "Cards you place by hand": "Cartões que você posiciona à mão",
"Careful": "Cuidado",
"Caution": "Cuidado",
"Change password…": "Alterar senha…",
"Change the kind of callout": "Alterar o tipo de destaque",
"Change the name used for your new comments and replies": "Altere o nome usado nos seus novos comentários e respostas",
+ "Change the shape of this canvas": "Alterar o formato desta tela",
"Change this block’s type": "Alterar o tipo deste bloco",
"Change this page's icon": "Mudar o ícone desta página",
"Change {field}": "Alterar {field}",
@@ -143,6 +149,7 @@ export const pt: Catalog = {
"Downloaded ✓": "Baixado ✓",
"Downloaded. Open the new file — this one is unchanged.": "Transferido. Abra o novo ficheiro — este fica inalterado.",
"Downloads a backup of the current version, then rewrites this file on disk as the new version — document untouched.": "Baixa um backup da versão atual e depois regrava este arquivo no disco como a nova versão — o documento não é alterado.",
+ "Drag to move this card": "Arraste para mover este cartão",
"Drag to move, click for block options": "Arraste para mover, clique para as opções do bloco",
"Drag to resize this column": "Arraste para redimensionar esta coluna",
"Drag to resize · double-click to reset": "Arrasta para redimensionar · duplo clique para repor",
@@ -255,6 +262,7 @@ export const pt: Catalog = {
"Move down": "Mover para baixo",
"Move up": "Mover para cima",
"Muted": "Sem som",
+ "Name this canvas": "Dê um nome a esta tela",
"New issue": "Nova tarefa",
"New page": "Nova página",
"New page (⌘⌥N)": "Nova página (⌘⌥N)",
@@ -276,6 +284,7 @@ export const pt: Catalog = {
"Nothing found": "Nada encontrado",
"Nothing is fetched. A card shows what you type here — opening this space never contacts the site.": "Nada é obtido. O cartão mostra o que você escrever aqui — abrir este espaço nunca contacta o site.",
"Nothing leaves this file until you start a session.": "Nada sai deste ficheiro até iniciares uma sessão.",
+ "Nothing on this canvas yet.": "Ainda não há nada nesta tela.",
"Nothing to draw yet — link two pages with [[ and they will appear here.": "Ainda não há nada para desenhar — liga duas páginas com [[ e aparecerão aqui.",
"Now an issue": "Agora é uma tarefa",
"Numbered list": "Lista numerada",
@@ -397,6 +406,7 @@ export const pt: Catalog = {
"Sort": "Ordenar",
"Sort by {field}": "Ordenar por {field}",
"Space name": "Nome do espaço",
+ "Square": "Quadrado",
"Start live session": "Iniciar sessão ao vivo",
"Start silent": "Começar sem som",
"Stop sharing": "Parar de compartilhar",
@@ -407,6 +417,7 @@ export const pt: Catalog = {
"Table": "Tabela",
"Take it elsewhere": "Levar para outro lado",
"Taken from the address if blank": "Se ficar vazio, é retirado do endereço",
+ "Tall": "Alto",
"Text": "Texto",
"Text and background color": "Cor do texto e do plano de fundo",
"Text formatting": "Formatação de texto",
diff --git a/spaces/src/i18n/zh-Hans.ts b/spaces/src/i18n/zh-Hans.ts
index 2a809194..e6d12819 100644
--- a/spaces/src/i18n/zh-Hans.ts
+++ b/spaces/src/i18n/zh-Hans.ts
@@ -32,8 +32,11 @@ export const zh_Hans: Catalog = {
"About this space": "关于此空间",
"Access reset — only copies saved from now on can join": "访问已重置 — 只有此后保存的副本才能加入",
"Add a block below": "在下方添加块",
+ "Add a card": "添加卡片",
+ "Add a card that opens a page": "添加一张打开页面的卡片",
"Add a column after": "在右侧添加一列",
"Add a link": "添加链接",
+ "Add a page": "添加页面",
"Add a picture": "添加图片",
"Add a row below": "在下方添加一行",
"Add below": "在下方添加",
@@ -72,11 +75,14 @@ export const zh_Hans: Catalog = {
"Callout": "标注",
"Callout icon": "标注图标",
"Cancel": "取消",
+ "Canvas": "画布",
+ "Cards you place by hand": "由你手动摆放的卡片",
"Careful": "请谨慎",
"Caution": "当心",
"Change password…": "更改密码…",
"Change the kind of callout": "更改标注类型",
"Change the name used for your new comments and replies": "更改新评论和回复所用的名字",
+ "Change the shape of this canvas": "更改此画布的形状",
"Change this block’s type": "更改此块的类型",
"Change this page's icon": "更改此页面的图标",
"Change {field}": "更改{field}",
@@ -143,6 +149,7 @@ export const zh_Hans: Catalog = {
"Downloaded ✓": "已下载 ✓",
"Downloaded. Open the new file — this one is unchanged.": "已下载。请打开新文件 — 当前文件未改动。",
"Downloads a backup of the current version, then rewrites this file on disk as the new version — document untouched.": "先下载当前版本的备份,然后将此文件改写为新版本 — 文档内容不变。",
+ "Drag to move this card": "拖动以移动此卡片",
"Drag to move, click for block options": "拖动可移动,点击打开块选项",
"Drag to resize this column": "拖动以调整此列宽度",
"Drag to resize · double-click to reset": "拖动可调整宽度 · 双击恢复默认",
@@ -255,6 +262,7 @@ export const zh_Hans: Catalog = {
"Move down": "下移",
"Move up": "上移",
"Muted": "静音",
+ "Name this canvas": "为此画布命名",
"New issue": "新建事项",
"New page": "新建页面",
"New page (⌘⌥N)": "新建页面 (⌘⌥N)",
@@ -276,6 +284,7 @@ export const zh_Hans: Catalog = {
"Nothing found": "没有结果",
"Nothing is fetched. A card shows what you type here — opening this space never contacts the site.": "不会抓取任何内容。卡片显示的就是你在这里输入的内容——打开这个空间绝不会联系该网站。",
"Nothing leaves this file until you start a session.": "在你开始会话之前,没有任何内容离开这个文件。",
+ "Nothing on this canvas yet.": "此画布上还没有内容。",
"Nothing to draw yet — link two pages with [[ and they will appear here.": "还没有可绘制的内容 — 用 [[ 链接两个页面,它们就会出现在这里。",
"Now an issue": "现在是事项了",
"Numbered list": "编号列表",
@@ -397,6 +406,7 @@ export const zh_Hans: Catalog = {
"Sort": "排序",
"Sort by {field}": "按{field}排序",
"Space name": "空间名称",
+ "Square": "方形",
"Start live session": "开始实时会话",
"Start silent": "开始时静音",
"Stop sharing": "停止共享",
@@ -407,6 +417,7 @@ export const zh_Hans: Catalog = {
"Table": "表格",
"Take it elsewhere": "把内容带走",
"Taken from the address if blank": "留空则取自网址",
+ "Tall": "竖向",
"Text": "文本",
"Text and background color": "文字与背景颜色",
"Text formatting": "文字格式",
diff --git a/spaces/src/i18n/zh-Hant.ts b/spaces/src/i18n/zh-Hant.ts
index a60a07f5..b2915573 100644
--- a/spaces/src/i18n/zh-Hant.ts
+++ b/spaces/src/i18n/zh-Hant.ts
@@ -32,8 +32,11 @@ export const zh_Hant: Catalog = {
"About this space": "關於此空間",
"Access reset — only copies saved from now on can join": "存取已重設 — 只有此後儲存的副本才能加入",
"Add a block below": "在下方新增區塊",
+ "Add a card": "新增卡片",
+ "Add a card that opens a page": "新增可開啟頁面的卡片",
"Add a column after": "在右側新增一欄",
"Add a link": "新增連結",
+ "Add a page": "新增頁面",
"Add a picture": "新增圖片",
"Add a row below": "在下方新增一列",
"Add below": "在下方新增",
@@ -72,11 +75,14 @@ export const zh_Hant: Catalog = {
"Callout": "標註",
"Callout icon": "標註圖示",
"Cancel": "取消",
+ "Canvas": "畫布",
+ "Cards you place by hand": "由你手動擺放的卡片",
"Careful": "請謹慎",
"Caution": "當心",
"Change password…": "變更密碼…",
"Change the kind of callout": "變更標註類型",
"Change the name used for your new comments and replies": "變更新註解與回覆所用的名字",
+ "Change the shape of this canvas": "變更此畫布的形狀",
"Change this block’s type": "變更此區塊的類型",
"Change this page's icon": "變更此頁面的圖示",
"Change {field}": "變更{field}",
@@ -143,6 +149,7 @@ export const zh_Hant: Catalog = {
"Downloaded ✓": "已下載 ✓",
"Downloaded. Open the new file — this one is unchanged.": "已下載。請開啟新檔案 — 目前這個檔案未被更動。",
"Downloads a backup of the current version, then rewrites this file on disk as the new version — document untouched.": "先下載目前版本的備份,再將此檔案改寫為新版本 — 文件內容不變。",
+ "Drag to move this card": "拖曳以移動此卡片",
"Drag to move, click for block options": "拖曳可移動,點按開啟區塊選項",
"Drag to resize this column": "拖曳以調整此欄寬度",
"Drag to resize · double-click to reset": "拖曳可調整寬度 · 雙擊還原預設",
@@ -255,6 +262,7 @@ export const zh_Hant: Catalog = {
"Move down": "下移",
"Move up": "上移",
"Muted": "靜音",
+ "Name this canvas": "為此畫布命名",
"New issue": "新增項目",
"New page": "新增頁面",
"New page (⌘⌥N)": "新增頁面 (⌘⌥N)",
@@ -276,6 +284,7 @@ export const zh_Hant: Catalog = {
"Nothing found": "找不到結果",
"Nothing is fetched. A card shows what you type here — opening this space never contacts the site.": "不會抓取任何內容。卡片顯示的就是你在這裡輸入的內容——開啟這個空間絕不會連線到該網站。",
"Nothing leaves this file until you start a session.": "在你開始工作階段之前,沒有任何內容離開這個檔案。",
+ "Nothing on this canvas yet.": "此畫布上還沒有內容。",
"Nothing to draw yet — link two pages with [[ and they will appear here.": "還沒有可繪製的內容 — 用 [[ 連結兩個頁面,它們就會出現在這裡。",
"Now an issue": "現在是項目了",
"Numbered list": "編號清單",
@@ -397,6 +406,7 @@ export const zh_Hant: Catalog = {
"Sort": "排序",
"Sort by {field}": "依{field}排序",
"Space name": "空間名稱",
+ "Square": "方形",
"Start live session": "開始即時工作階段",
"Start silent": "開始時靜音",
"Stop sharing": "停止共用",
@@ -407,6 +417,7 @@ export const zh_Hant: Catalog = {
"Table": "表格",
"Take it elsewhere": "把內容帶走",
"Taken from the address if blank": "留空則取自網址",
+ "Tall": "直式",
"Text": "文字",
"Text and background color": "文字與背景顏色",
"Text formatting": "文字格式",
diff --git a/spaces/src/icons.ts b/spaces/src/icons.ts
index 96f91f14..077e0846 100644
--- a/spaces/src/icons.ts
+++ b/spaces/src/icons.ts
@@ -45,6 +45,7 @@ export const ICONS = {
chevronDown: svg('<polyline points="6 9 12 15 18 9"/>'),
eye: svg('<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/>'),
edit: svg('<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4z"/>'),
+ canvas: svg('<rect x="2.5" y="4" width="19" height="16" rx="2"/><rect x="5.5" y="7" width="6" height="4.5" rx="1"/><rect x="14" y="12.5" width="5" height="4.5" rx="1"/>'),
board: svg('<rect x="3" y="4" width="5" height="16" rx="1.5"/><rect x="10" y="4" width="5" height="11" rx="1.5"/><rect x="17" y="4" width="4" height="7" rx="1.5"/>'),
up: svg('<path d="m18 15-6-6-6 6"/>'),
down: svg('<path d="m6 9 6 6 6-6"/>'),
diff --git a/spaces/src/render.ts b/spaces/src/render.ts
index 6bcd1b9c..717a33dd 100644
--- a/spaces/src/render.ts
+++ b/spaces/src/render.ts
@@ -21,6 +21,7 @@ import {
} from './fields'
import { answer, feed, freshContext, type CalcCtx } from './calc.ts'
import { ICONS, type IconName } from './icons'
+import { renderCanvasHead, placeCard } from './canvas.ts'
export interface RenderOpts {
/** editable per-block hosts (the editor); false for reader/print */
@@ -68,8 +69,14 @@ export function renderBlocks(page: Page, doc: SpacesDoc, opts: RenderOpts = {}):
// line and usable by the lines BELOW it — the same direction a person reads
// in, and the reason this needs no second pass and cannot cycle.
const calc: CalcCtx = freshContext()
- // stack of open containers, innermost last: [blockId, element]
- const stack: Array<[string, HTMLElement]> = []
+ // stack of open containers, innermost last: [blockId, element, type]
+ //
+ // The TYPE is on the stack because a canvas's children are POSITIONED and
+ // nothing else's are. A block cannot know that on its own — `x` and `y` mean
+ // "where on the surface" only inside a surface — so the placement decision
+ // belongs here, where the open container is known, rather than to a test on
+ // the child that would also fire on a stray `x` anywhere else in a document.
+ const stack: Array<[string, HTMLElement, string]> = []
let list: { el: HTMLElement; kind: 'ul' | 'ol'; under: string } | null = null
const hostFor = (parent: string | undefined): HTMLElement | DocumentFragment => {
@@ -123,7 +130,14 @@ export function renderBlocks(page: Page, doc: SpacesDoc, opts: RenderOpts = {}):
const node = renderBlock(b, doc, opts, calc)
takeIn()
- ;(kind && list ? list.el : host).appendChild(node)
+ const into = kind && list ? list.el : host
+ into.appendChild(node)
+ // A CARD IS PLACED AFTER IT IS APPENDED: its index among its siblings is
+ // the fallback position for a card that has never been dragged, and the
+ // index is a fact about the parent, not about the block.
+ if (stack.length && stack[stack.length - 1][0] === b.parent && stack[stack.length - 1][2] === 'canvas') {
+ placeCard(node, b)
+ }
// A CONTAINER owns the blocks whose parent is its id. Which types those are
// is registry data (blocks.ts `container`), not a name test here — the
@@ -135,7 +149,7 @@ export function renderBlocks(page: Page, doc: SpacesDoc, opts: RenderOpts = {}):
body.className = `sp-${b.type}-body`
if (container === 'fold' && !(opts.forceOpen || b.open)) body.hidden = true
node.appendChild(body)
- stack.push([b.id, body])
+ stack.push([b.id, body, b.type])
list = null
} else if (kind) {
// A LIST ITEM OWNS ITS INDENTED CHILDREN.
@@ -150,7 +164,7 @@ export function renderBlocks(page: Page, doc: SpacesDoc, opts: RenderOpts = {}):
// Not `container: true` in the registry: a list item does not take a body
// div, it takes children directly, and the gutter/inline-host rules that
// `container` implies are wrong for it.
- stack.push([b.id, node])
+ stack.push([b.id, node, b.type])
}
})
return frag
@@ -500,6 +514,19 @@ export function renderBlock(b: Block, doc: SpacesDoc, opts: RenderOpts = {}, cal
return el
}
+ case 'canvas': {
+ // The BODY is opened by renderBlocks (registry `container`), which is
+ // also what puts the cards in it — so this draws the chrome and nothing
+ // else. `cards` is only needed for the empty-state line, and counting
+ // here rather than after the fact keeps renderBlock a pure function of
+ // one block.
+ const cards = doc.pages
+ .find((p) => p.blocks.some((x) => x.id === b.id))?.blocks
+ .filter((x) => x.parent === b.id).length ?? 0
+ renderCanvasHead(el, b, opts.editable === true, cards)
+ return el
+ }
+
case 'view': {
el.classList.add('sp-view')
renderView(el, b, doc, opts)
diff --git a/spaces/src/styles.css b/spaces/src/styles.css
index 37d5bf1c..b95b38c3 100644
--- a/spaces/src/styles.css
+++ b/spaces/src/styles.css
@@ -2100,3 +2100,149 @@ button.sp-issue-set:hover { background: var(--chrome-2); border-color: var(--edg
.sp-cm-mark { inset-inline-end: 0; }
}
@media print { .sp-cm-mark, .sp-cm-row { display: none !important; } }
+
+/* ————— CANVAS ————————————————————————————————————————————————————————————
+ A bounded surface with cards placed on it (canvas.ts). The block is
+ `sp-b-canvas`; its parts are `sp-cv-*`, on the `sp-tb-*` precedent — `.sp-card`
+ is already the DIALOG card and `.sp-issue` the board's, and a third meaning
+ for one class name is how the 560px-wide board card happened.
+
+ THE SURFACE HOLDS ITS SHAPE. `aspect-ratio` from the block's own `ratio`,
+ so the same file lays out identically at 400px and at 2000px and on paper —
+ which is the whole reason the coordinates are percentages. `--sp-ratio` is
+ set inline by the renderer because it is document data; everything else here
+ is chrome. */
+.sp-b-canvas { margin: 18px 0; }
+.sp-canvas-head {
+ display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
+ margin-bottom: 7px;
+}
+.sp-canvas-title {
+ font-size: 13.5px; font-weight: 600; color: var(--ink-2);
+ min-width: 40px; outline: none; border-radius: 5px; padding: 1px 3px;
+}
+.sp-canvas-title:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
+.sp-canvas-title[data-ph]:empty::before {
+ content: attr(data-ph); color: var(--ph); pointer-events: none;
+}
+.sp-canvas-btn { font-size: 12px; padding: 3px 9px; }
+.sp-canvas-head .sp-canvas-btn:first-of-type { margin-inline-start: auto; }
+.sp-canvas-empty {
+ position: absolute; inset-inline: 0; top: 44%; margin: 0;
+ text-align: center; color: var(--muted); font-size: 13px; pointer-events: none;
+}
+/* the empty line is positioned against the BLOCK, so the block is the frame */
+.sp-b-canvas { position: relative; }
+
+.sp-canvas-body {
+ position: relative;
+ aspect-ratio: var(--sp-ratio, 1.6);
+ background: var(--chrome);
+ border: 1px solid var(--line);
+ border-radius: 10px;
+ /* The surface reads as a surface: a faint grid, not a texture.
+ MIXED FROM `--ink`, not from `--shade`. `--shade` is the shadow token and
+ it goes to pure black in dark — a black grid on a near-black ground is a
+ grid nobody can see, which is what the first draft shipped. `--ink` flips
+ with the ground, so the same declaration is a dark grid on white and a
+ light one on black. */
+ background-image:
+ linear-gradient(to right, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px),
+ linear-gradient(to bottom, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px);
+ background-size: 5% 8%;
+}
+
+/* A CARD. `--sp-x`/`--sp-y` are percentages of the surface, written by the
+ renderer from the model and by the drag while it is running — which is what
+ lets the drag move the card without a repaint, and lets the phone rule below
+ ignore the position entirely. An inline `left` could do neither. */
+.sp-canvas-body > .sp-cv-card {
+ position: absolute;
+ left: calc(var(--sp-x, 0) * 1%);
+ top: calc(var(--sp-y, 0) * 1%);
+ width: 22%; min-width: 96px;
+ margin: 0;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ padding: 8px 9px;
+ font-size: 13px; line-height: 1.4;
+ box-shadow: 0 1px 3px rgb(var(--shade) / .08);
+ overflow-wrap: anywhere;
+}
+.sp-canvas-body > .sp-cv-card:hover { border-color: var(--edge); }
+.sp-cv-moving { box-shadow: 0 6px 18px rgb(var(--shade) / .22) !important; z-index: 3; }
+/* while a card is being dragged the whole document stops trying to select text */
+body.sp-canvas-dragging { user-select: none; cursor: grabbing; }
+
+/* THE GRIP AND THE ✕ are the card's own chrome, so they sit ON it rather than
+ in the gutter — the block gutter is hidden inside a canvas (below) because
+ its drag reorders a LIST, which is not what this surface means. */
+.sp-cv-grip {
+ position: absolute; top: 2px; width: 20px; height: 20px;
+ display: flex; align-items: center; justify-content: center;
+ border: 0; background: none; color: var(--ph); padding: 0;
+ border-radius: 5px; opacity: 0; transition: opacity .12s;
+}
+.sp-cv-grip { inset-inline-start: 2px; cursor: grab; }
+.sp-cv-grip svg { width: 13px; height: 13px; }
+.sp-cv-card:hover .sp-cv-grip, .sp-cv-grip:focus-visible { opacity: 1; }
+.sp-cv-grip:hover { color: var(--ink-2); background: var(--chrome-2); }
+.sp-cv-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
+/* room for the controls, so a card's first line never runs under them */
+.sp-canvas-body > .sp-cv-card { padding-top: 20px; }
+/* THE BLOCK GUTTER STAYS. It is where every block in a space is turned into
+ another type, duplicated and deleted, and on a phone it is the ONLY way to
+ reach any of that — hiding it inside a canvas would have made a card the one
+ block you cannot delete without a mouse. It only moves: the gutter lives in
+ the reading column's left margin, which on a surface is another card. Inside
+ a canvas it tucks into the card's own top-left, beside the drag grip. */
+.sp-canvas-body > .sp-cv-card > .sp-gutter {
+ position: absolute; inset-inline-start: 24px; inset-inline-end: auto;
+ top: 1px; width: auto; margin: 0; padding: 0;
+ display: flex; gap: 0;
+}
+/* THE GRIP FOLLOWS THE GUTTER'S RULE, not its own. Below 820px the gutter
+ stops hiding until hover, because a touch screen has no hover to reveal it
+ with — and a drag handle that only appears on hover is exactly the same
+ problem. Measured at 719px: the gutter was drawn on every card and the grip
+ beside it was not, so the one control that moves a card was the one you
+ could not see. */
+@media (max-width: 820px) { .sp-cv-grip { opacity: 1; } }
+/* a page card inside a canvas fills its card rather than drawing a second one */
+.sp-canvas-body > .sp-cv-card .sp-pagecard {
+ border: 0; background: none; padding: 0; margin: 0; font-size: 13px;
+}
+
+/* A PHONE IS NOT A SURFACE. Four cards on a 360px-wide board are four
+ unreadable stamps, so below this width the canvas becomes what it is a
+ picture OF: the list of what is on it, in document order. The positions are
+ untouched in the file — this is a rendering choice, made where the layout
+ lives, and the same file laid out spatially again on the next screen up. */
+@media (max-width: 560px) {
+ .sp-canvas-body {
+ aspect-ratio: auto; display: flex; flex-direction: column; gap: 8px;
+ padding: 9px; background-image: none;
+ }
+ /* `relative`, not `static`: the card flows in the column but stays the
+ gutter's positioning parent, so the gutter is still OUT OF THE FLOW.
+ Putting it in the flow costs every card a 36px row it does not need —
+ the measured mistake the block gutter already made once. */
+ /* `relative`, and `left`/`top` EXPLICITLY CLEARED. A relative box still
+ honours its offsets — measured at 375px, every card kept its `left` and
+ `top` as a nudge and the surface came out as a diagonal staircase running
+ off the side of the screen. `position` alone does not undo a placement. */
+ .sp-canvas-body > .sp-cv-card {
+ position: relative; inset: auto; width: auto;
+ }
+ /* no hover on a phone, and nothing to drag to on a stacked list */
+ .sp-cv-grip { display: none; }
+}
+
+@media print {
+ /* the surface IS the content: it prints where it was placed, and it is not
+ broken across a page boundary */
+ .sp-b-canvas { break-inside: avoid; }
+ .sp-canvas-body { background: none; background-image: none; }
+ .sp-cv-grip, .sp-canvas-btn { display: none !important; }
+}