@tobos/cli 0.4.44 → 0.4.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -47,7 +47,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
47
47
|
var define_TOBOS_PRESENT_TYPES_default;
|
|
48
48
|
var init_define_TOBOS_PRESENT_TYPES = __esm({
|
|
49
49
|
"<define:TOBOS_PRESENT_TYPES>"() {
|
|
50
|
-
define_TOBOS_PRESENT_TYPES_default = { "registry.d.ts": "export declare function setMedia(media: Record<string, {\n hash: string;\n}>): void;\n/** The URL of a file in media/, what `import cow from '$media/cow.jpg'` gives. */\nexport declare function mediaUrl(name: string): string;\n/**\n * What `import.meta.glob('$media/cow/*.png')` gives: each file of media/ a pattern matches, by its\n * specifier (`$media/cow/a.png`), in order, with its URL. On a share, only those it has.\n */\nexport declare function mediaGlob(patterns: string[]): Record<string, string>;\n/** The deck's join code, and the ways to show it. */\nexport interface JoinInfo {\n /** The six digits: `482913`. */\n code: string;\n /** The link as people type it, without the scheme: `tobosusercontent.com/482913`. */\n link: string;\n /** The full URL the QR code holds: `https://tobosusercontent.com/482913`. */\n url: string;\n /** The QR code, black on white, as an image's address: `<img src={join.qr} />`. */\n qr: string;\n}\nexport declare function setJoin(info: JoinInfo | undefined): void;\nexport declare function joinInfo(): JoinInfo | undefined;\n/** Whether this is a share link's page, for people outside the deck's account. */\nexport declare function setShared(value: boolean): void;\nexport declare function isShared(): boolean;\n", "timeline.d.ts": "import type { Beat } from './index.ts';\n/**\n * Whether the scene timeline that holds this animation is playing a step forward, in real\n * time, as opposed to being sought (a jump, a step back, a finish, a still view or a render).\n */\nexport declare function playingForward(animation: gsap.core.Animation): boolean;\n/**\n * Whether the scene timeline that holds this animation is playing a step forward that may be\n * heard: one this window was moved to itself, not one it follows from another window.\n */\nexport declare function playingAloud(animation: gsap.core.Animation): boolean;\n/**\n * A sound that plays on through a range of a scene's beats, from the one that starts it up to,\n * not including, the one it stops at (playAudio's `until`).\n */\nexport interface Span {\n /** Play it from its start, heard. */\n start(): void;\n /** Stop it, fading it out or at once; resolves once it is silent. */\n stop(fade: boolean): Promise<void>;\n}\n/**\n * Add a span to the scene `tl` is the timeline of, while one of its beats' `enter` runs: from\n * that beat up to the one `until` names. False where `until` names no later beat of the scene.\n */\nexport declare function addSpan(tl: gsap.core.Timeline, until: string, span: Span): boolean;\n/**\n * One scene's beats as one paused GSAP timeline, with a label after each beat's animation.\n * Stepping forward tweens the playhead to the next label; everything else seeks.\n */\nexport declare class SceneTimeline {\n readonly timeline: gsap.core.Timeline;\n private labels;\n private tween;\n /** Whether the step playing may be heard. */\n aloud: boolean;\n private ids;\n /** The beat whose `enter` is running, while the timeline is built. */\n private building;\n private spans;\n /** The spans' stops still fading out. */\n private fades;\n constructor(root: Element, beats: readonly Beat[]);\n addSpan(until: string, span: Span): boolean;\n /**\n * Whether a span is still fading out: a scene leaving the stage is unmounted once it is\n * silent, since its sound goes with its elements.\n */\n get fading(): Promise<void> | null;\n get playing(): boolean;\n /** Finish the beat that is playing, at once. */\n finish(): void;\n /** Before the first beat: the scene waiting for its entrance. */\n hold(): void;\n /** The scene has left the stage: its spans fade out. */\n leave(): void;\n /**\n * After a move to `beat` (-1: none), each span plays on while the beat is in its range,\n * whichever way it moved there, and fades out outside it. Only a step forward onto its first\n * beat, heard, starts it.\n */\n private sound;\n /**\n * Show a beat: play the animation into it, or land on its end state. `aloud`: whether its\n * sound plays, or the step plays silent.\n */\n show(beat: number, animate: boolean, aloud?: boolean): void;\n /** Put the playhead part-way through the animation into a beat (0..1), for filmstrips. */\n sample(beat: number, progress: number): void;\n /** How long the animation into a beat takes, in seconds. */\n duration(beat: number): number;\n kill(): void;\n}\n", "playback.d.ts": "interface ClipOptions {\n /** Where the clip starts in the video or sound, in seconds. Default 0. */\n from?: number;\n /** Where the clip ends in the video or sound, in seconds. Default: its end. */\n to?: number;\n /** Speed: 1 is real time, 0.5 half speed. Default 1. */\n rate?: number;\n /**\n * When the clip starts within the beat: GSAP's position parameter (`'<'`, `'+=0.5'`, a\n * number). Default: after what the beat has animated so far, like any `tl.to`.\n */\n position?: gsap.Position;\n}\nexport interface PlayAudioOptions extends ClipOptions {\n /**\n * The beat the sound plays until. It plays on through the beats before it, whichever way the\n * presenter moves among them, and fades out when this beat or one outside the range is shown,\n * or the scene is left. The beat it starts in doesn't wait for it, and `to` and `position`\n * don't apply: it plays from `from` to its end, or until then.\n */\n until?: string;\n /** With `until`: how long it fades out, in seconds. Default 1; 0 stops it at once. */\n fade?: number;\n}\nexport interface PlayVideoOptions extends ClipOptions {\n /** Play the video's own sound with it. Default: muted. */\n sound?: boolean;\n}\n/**\n * Play a video (or the clip `from`\u2013`to` of it) as part of a beat. Stepping forward plays it in\n * real time; going back, jumping or reloading shows the frame for that position at once; a\n * click while it plays lands on its last frame. Before its beat it shows the clip's first frame.\n *\n * ```ts\n * { id: 'turn', enter: (tl, q) => playVideo(tl, q('video')) }\n * ```\n *\n * The video plays inline and preloads, and is muted unless `sound` is set. Several videos\n * (`q('video')` finding more than one) play side by side, each its own length.\n */\nexport declare function playVideo(tl: gsap.core.Timeline, target: Element | ArrayLike<Element> | null | undefined, options?: PlayVideoOptions): gsap.core.Timeline;\n/**\n * Play a sound (or the clip `from`\u2013`to` of it) as part of a beat. Stepping forward plays it in\n * real time; a click while it plays stops it and plays the next beat; going back, jumping or\n * reloading is silent. So is a scene mounted ahead, and a window that only follows another.\n *\n * ```ts\n * { id: 'listen', enter: (tl, q) => playAudio(tl, q('audio')) }\n * ```\n *\n * The sound preloads. Several (`q('audio')` finding more than one) play together, each its own\n * length.\n */\nexport declare function playAudio(tl: gsap.core.Timeline, target: Element | ArrayLike<Element> | null | undefined, options?: PlayAudioOptions): gsap.core.Timeline;\n/**\n * Call `listener` each time the browser refuses this window sound, until a click or key press\n * in it lets it play. Returns a function that stops listening.\n */\nexport declare function onSoundRefused(listener: () => void): () => void;\n/**\n * Wait until the videos and sounds inside `root` know their length, so `playVideo` and\n * `playAudio` can size their clips when the scene's timeline is built. Those that won't load (no\n * source, `preload=\"none\"`, an error) don't hold it up, nor does anything past `timeout`.\n */\nexport declare function mediaKnowTheirLength(root: Element, timeout?: number): Promise<void>;\n/**\n * Wait until every video inside `root` shows the frame it was last sought to: no seek pending,\n * a frame decoded, and that frame handed to the screen again (`repaint`). Videos that won't load\n * don't hold it up.\n */\nexport declare function videoFramesReady(root: Element): Promise<void>;\nexport {};\n", "deck/types.d.ts": "export type Severity = 'error' | 'warning';\n/** One thing wrong with a deck. Lines and columns are 1-based. */\nexport interface Problem {\n file: string;\n line?: number;\n column?: number;\n rule: string;\n message: string;\n severity: Severity;\n}\nexport interface DeckScene {\n id: string;\n title: string;\n /** Left out of presenting, the share link and its PDF; still on the deck's page. */\n hidden?: true;\n}\nexport interface DeckChapter {\n id: string;\n title: string;\n scenes: DeckScene[];\n}\n/** deck.json */\nexport interface DeckJson {\n title: string;\n chapters: DeckChapter[];\n dependencies?: Record<string, string>;\n}\nexport interface MediaEntry {\n hash: string;\n size: number;\n type: string;\n}\n/** media.json: path inside media/ \u2192 the file's content hash. */\nexport type MediaJson = Record<string, MediaEntry>;\n/** A multiple-choice poll: each phone picks one option; its result shows from `reveals` on. */\nexport interface ChoiceActivity {\n id: string;\n kind: 'choice';\n prompt: string;\n options: string[];\n /** The beat of its scene that closes the poll and shows its result. */\n reveals?: string;\n}\nexport interface TextField {\n id: string;\n label: string;\n multiline?: boolean;\n /** The most characters it takes. 500 unless the scene says otherwise; in a manifest, always set. */\n max?: number;\n}\n/** An open-text poll: each phone fills in its fields. The answers are only stored. */\nexport interface TextActivity {\n id: string;\n kind: 'text';\n prompt?: string;\n fields: TextField[];\n}\n/**\n * A poll: what a scene asks the room, who answer on their phones (the format's `activity`). It\n * is open while the deck is presented on its scene, up to its `reveals` beat.\n */\nexport type Activity = ChoiceActivity | TextActivity;\nexport interface ManifestScene {\n id: string;\n title: string;\n /** Left out of presenting, the share link and its PDF (deck.json's `hidden`). */\n hidden?: true;\n beats: string[];\n /** The scene's specifier in the import map. */\n module: string;\n activity?: Activity;\n}\nexport interface ManifestChapter {\n id: string;\n title: string;\n scenes: ManifestScene[];\n}\n/**\n * What the viewer needs to show one revision of a deck. Format 1's modules call the engine's\n * media(); a later one's import media (`import cow from '$media/cow.jpg'`), compiled into lookups\n * of the same media map. A revision keeps the format it was pushed with.\n */\nexport interface Manifest {\n format: 1 | 2;\n title: string;\n chapters: ManifestChapter[];\n /**\n * Deck specifiers (`@deck/scenes/a.svelte`) \u2192 module paths relative to the viewer (`m/<hash>.js`).\n * The server adds the package specifiers once it has bundled them (`d3` \u2192 `p/<bundle>/d3.js`).\n */\n imports: Record<string, string>;\n media: MediaJson;\n /** deck.json's dependencies: package \u2192 exact version. */\n dependencies: Record<string, string>;\n /** The package specifiers the deck imports, by dependency: `{ three: ['three', 'three/addons/\u2026'] }`. */\n packages: Record<string, string[]>;\n /**\n * Stylesheets, relative to the viewer: the master's tokens.css (`m/<hash>.css`), then those of\n * the packages it imports (`p/<bundle>/katex/dist/katex.min.css`), which the server adds.\n */\n styles?: string[];\n /**\n * What the deck's code uses of the deck, so a share gets only what the scenes it shows reach,\n * and only what is on a slide must be on the server (share.ts). A manifest pushed before the build recorded it\n * had it written in afterwards, as its build then would have (TOB-397).\n */\n uses: Uses;\n}\n/** A manifest as a share link has it: what its modules use isn't part of it (share.ts). */\nexport type SharedManifest = Omit<Manifest, 'uses'>;\n/** What each of a deck's modules uses of the deck itself, and what its stylesheet does. */\nexport interface Uses {\n /**\n * By specifier (`@deck/scenes/a.svelte`): the deck's modules it imports, statically or not; the\n * media.json names it imports; and its `import.meta.glob` patterns (`frames/*.png`), or in format\n * 1 its media() calls' (share.ts), which a share matches against media.json, so a pattern is here\n * once, not as every name it matches. Each is left out when it has none.\n */\n modules: Record<string, {\n imports?: string[];\n media?: string[];\n patterns?: string[];\n }>;\n /** The media.json names tokens.css links, which every page that shows the deck loads. */\n styles: string[];\n}\n/** A deck's files, from a directory or from a git revision. Paths use `/` and have no leading slash. */\nexport interface DeckTree {\n files(): string[];\n read(path: string): Uint8Array | undefined;\n}\n", "activities.d.ts": "/** What the server tells about a deck's activities: phones what is open, the projector the results. */\n/** An activity as a phone needs it: no more. */\nexport type PhoneActivity = {\n id: string;\n kind: 'choice';\n prompt: string;\n options: string[];\n} | {\n id: string;\n kind: 'text';\n prompt?: string;\n fields: {\n id: string;\n label: string;\n multiline?: boolean;\n max: number;\n }[];\n};\n/** Nothing live, or the session and its open activity, if any. */\nexport type PhoneState = {\n live: false;\n} | {\n live: true;\n show: string;\n activity: PhoneActivity | null;\n};\n/** What the projector hears: the session, and every activity answered in it. */\nexport interface Results {\n show: string | null;\n joined: number;\n activities: Record<string, {\n answered: number;\n counts?: number[];\n }>;\n}\n", "viewer/stream.d.ts": "/**\n * A server-sent events stream that outlasts the server going away. EventSource reconnects by\n * itself only when a connection drops; when a reconnect is answered with an error, as the proxy\n * answers 502 while the app restarts for a release, it gives up for good. This one opens it\n * again, waiting longer each time, up to a minute.\n *\n * `onOpen` runs on every connection, `again` on all but the first: what was sent while the\n * stream was away is missed, so that is the moment to read the state afresh.\n */\nexport declare function stream(url: string, listeners: Record<string, (data: string) => void>, onOpen?: (again: boolean) => void): () => void;\n", "viewer/events.d.ts": 'type Listener = (data: string) => void;\ndeclare const TYPES: readonly ["push", "results", "notes"];\nexport type EventType = (typeof TYPES)[number];\n/** Listen for one type of event on `url`, the window\'s stream: until the returned function runs. */\nexport declare function listen(url: string, type: EventType, listener: Listener, onReopen?: () => void): () => void;\nexport {};\n', "responses.svelte.d.ts": "/**\n * What the room has answered, for the projector: the audience and presenter windows, and the\n * preview on the deck's page, follow it from the server. Print and render, and a link that isn't\n * a presenter's, have zeros. It is live data, which the position can't recreate.\n */\nimport type { SharedManifest } from '@tobos/deck/types';\nimport type { Results } from './activities.ts';\n/** One activity's responses in the current session. */\nexport interface Responses {\n /**\n * The most phones that had the deck's join link open at once during this session, and never fewer\n * than answered.\n */\n readonly joined: number;\n /** People who have answered this activity during this session. */\n readonly answered: number;\n /** Multiple choice's responses per option, in the order the scene declares them; else empty. */\n readonly counts: number[];\n}\n/** The deck's activities, so a poll nobody answered yet has a zero per option. */\nexport declare function setActivities(manifest: SharedManifest): void;\n/** The current session's responses: reactive, for a scene or the presenter's view. */\nexport declare function liveResults(): Readonly<Results>;\n/**\n * The room's responses to an activity of this deck in the current session: how many joined, how\n * many answered, and a poll's counts per option. Call during component setup.\n */\nexport declare function useResponses(id: string): Responses;\n/** Follow the room's results on the window's stream (events.ts) until the returned function runs. */\nexport declare function followResponses(url: string): () => void;\n", "index.d.ts": `import { type Component } from 'svelte';
|
|
50
|
+
define_TOBOS_PRESENT_TYPES_default = { "registry.d.ts": "export declare function setMedia(media: Record<string, {\n hash: string;\n}>): void;\n/** The URL of a file in media/, what `import cow from '$media/cow.jpg'` gives. */\nexport declare function mediaUrl(name: string): string;\n/**\n * What `import.meta.glob('$media/cow/*.png')` gives: each file of media/ a pattern matches, by its\n * specifier (`$media/cow/a.png`), in order, with its URL. On a share, only those it has.\n */\nexport declare function mediaGlob(patterns: string[]): Record<string, string>;\n/** The deck's join code, and the ways to show it. */\nexport interface JoinInfo {\n /** The six digits: `482913`. */\n code: string;\n /** The link as people type it, without the scheme: `tobosusercontent.com/482913`. */\n link: string;\n /** The full URL the QR code holds: `https://tobosusercontent.com/482913`. */\n url: string;\n /** The QR code, black on white, as an image's address: `<img src={join.qr} />`. */\n qr: string;\n}\nexport declare function setJoin(info: JoinInfo | undefined): void;\nexport declare function joinInfo(): JoinInfo | undefined;\n/** Whether this is a share link's page, for people outside the deck's account. */\nexport declare function setShared(value: boolean): void;\nexport declare function isShared(): boolean;\n", "timeline.d.ts": "import type { Beat } from './index.ts';\n/**\n * Whether the scene timeline that holds this animation is playing a step forward, in real\n * time, as opposed to being sought (a jump, a step back, a finish, a still view or a render).\n */\nexport declare function playingForward(animation: gsap.core.Animation): boolean;\n/**\n * Whether the scene timeline that holds this animation is playing a step forward that may be\n * heard: one this window was moved to itself, not one it follows from another window.\n */\nexport declare function playingAloud(animation: gsap.core.Animation): boolean;\n/**\n * A sound that plays on through a range of a scene's beats, from the one that starts it up to,\n * not including, the one it stops at (playAudio's `until`).\n */\nexport interface Span {\n /** Play it from its start, heard. */\n start(): void;\n /** Stop it, fading it out or at once; resolves once it is silent. */\n stop(fade: boolean): Promise<void>;\n}\n/**\n * Add a span to the scene `tl` is the timeline of, while one of its beats' `enter` runs: from\n * that beat up to the one `until` names. False where `until` names no later beat of the scene.\n */\nexport declare function addSpan(tl: gsap.core.Timeline, until: string, span: Span): boolean;\n/**\n * One scene's beats as one paused GSAP timeline, with a label after each beat's animation.\n * Stepping forward tweens the playhead to the next label; everything else seeks.\n */\nexport declare class SceneTimeline {\n readonly timeline: gsap.core.Timeline;\n private labels;\n private tween;\n /** Whether the step playing may be heard. */\n aloud: boolean;\n private ids;\n /** The beat whose `enter` is running, while the timeline is built. */\n private building;\n private spans;\n /** The spans' stops still fading out. */\n private fades;\n constructor(root: Element, beats: readonly Beat[]);\n addSpan(until: string, span: Span): boolean;\n /**\n * Whether a span is still fading out: a scene leaving the stage is unmounted once it is\n * silent, since its sound goes with its elements.\n */\n get fading(): Promise<void> | null;\n get playing(): boolean;\n /** Finish the beat that is playing, at once. */\n finish(): void;\n /** Before the first beat: the scene waiting for its entrance. */\n hold(): void;\n /** The scene has left the stage: its spans fade out. */\n leave(): void;\n /**\n * After a move to `beat` (-1: none), each span plays on while the beat is in its range,\n * whichever way it moved there, and fades out outside it. Only a step forward onto its first\n * beat, heard, starts it.\n */\n private sound;\n /**\n * Show a beat: play the animation into it, or land on its end state. `aloud`: whether its\n * sound plays, or the step plays silent.\n */\n show(beat: number, animate: boolean, aloud?: boolean): void;\n /** Put the playhead part-way through the animation into a beat (0..1), for filmstrips. */\n sample(beat: number, progress: number): void;\n /** How long the animation into a beat takes, in seconds. */\n duration(beat: number): number;\n kill(): void;\n}\n", "playback.d.ts": "interface ClipOptions {\n /** Where the clip starts in the video or sound, in seconds. Default 0. */\n from?: number;\n /** Where the clip ends in the video or sound, in seconds. Default: its end. */\n to?: number;\n /** Speed: 1 is real time, 0.5 half speed. Default 1. */\n rate?: number;\n /**\n * When the clip starts within the beat: GSAP's position parameter (`'<'`, `'+=0.5'`, a\n * number). Default: after what the beat has animated so far, like any `tl.to`.\n */\n position?: gsap.Position;\n}\nexport interface PlayAudioOptions extends ClipOptions {\n /**\n * The beat the sound plays until. It plays on through the beats before it, whichever way the\n * presenter moves among them, and fades out when this beat or one outside the range is shown,\n * or the scene is left. The beat it starts in doesn't wait for it, and `to` and `position`\n * don't apply: it plays from `from` to its end, or until then.\n */\n until?: string;\n /** With `until`: how long it fades out, in seconds. Default 1; 0 stops it at once. */\n fade?: number;\n}\nexport interface PlayVideoOptions extends ClipOptions {\n /** Play the video's own sound with it. Default: muted. */\n sound?: boolean;\n}\n/**\n * Play a video (or the clip `from`\u2013`to` of it) as part of a beat. Stepping forward plays it in\n * real time; going back, jumping or reloading shows the frame for that position at once; a\n * click while it plays lands on its last frame. Before its beat it shows the clip's first frame.\n *\n * ```ts\n * { id: 'turn', enter: (tl, q) => playVideo(tl, q('video')) }\n * ```\n *\n * The video plays inline and preloads, and is muted unless `sound` is set. Several videos\n * (`q('video')` finding more than one) play side by side, each its own length.\n */\nexport declare function playVideo(tl: gsap.core.Timeline, target: Element | ArrayLike<Element> | null | undefined, options?: PlayVideoOptions): gsap.core.Timeline;\n/**\n * Play a sound (or the clip `from`\u2013`to` of it) as part of a beat. Stepping forward plays it in\n * real time; a click while it plays stops it and plays the next beat; going back, jumping or\n * reloading is silent. So is a scene mounted ahead, and a window that only follows another.\n *\n * ```ts\n * { id: 'listen', enter: (tl, q) => playAudio(tl, q('audio')) }\n * ```\n *\n * The sound preloads. Several (`q('audio')` finding more than one) play together, each its own\n * length.\n */\nexport declare function playAudio(tl: gsap.core.Timeline, target: Element | ArrayLike<Element> | null | undefined, options?: PlayAudioOptions): gsap.core.Timeline;\n/**\n * Call `listener` each time the browser refuses this window sound, until a click or key press\n * in it lets it play. Returns a function that stops listening.\n */\nexport declare function onSoundRefused(listener: () => void): () => void;\n/**\n * Wait until the videos and sounds inside `root` know their length, so `playVideo` and\n * `playAudio` can size their clips when the scene's timeline is built. Those that won't load (no\n * source, `preload=\"none\"`, an error) don't hold it up, nor does anything past `timeout`.\n */\nexport declare function mediaKnowTheirLength(root: Element, timeout?: number): Promise<void>;\n/**\n * Wait until every video inside `root` shows the frame it was last sought to: no seek pending,\n * a frame decoded, and that frame handed to the screen again (`repaint`). Videos that won't load\n * don't hold it up.\n */\nexport declare function videoFramesReady(root: Element): Promise<void>;\nexport {};\n", "deck/types.d.ts": "export type Severity = 'error' | 'warning';\n/** One thing wrong with a deck. Lines and columns are 1-based. */\nexport interface Problem {\n file: string;\n line?: number;\n column?: number;\n rule: string;\n message: string;\n severity: Severity;\n}\n/** A scene's place in the outline: its id, which is its file's name, its title and whether it shows. */\nexport interface OutlineScene {\n id: string;\n title: string;\n /** Left out of presenting, the share link and its PDF; still on the deck's page. */\n hidden?: true;\n}\nexport interface OutlineChapter {\n id: string;\n title: string;\n scenes: OutlineScene[];\n}\n/**\n * A deck's outline: its title, and its chapters and their scenes in order (ADR 0006). Data, held\n * by Tobos, never a file of the deck; Tobos's own decks keep theirs in `outline.json` in the\n * codebase, in this shape.\n */\nexport interface Outline {\n title: string;\n chapters: OutlineChapter[];\n}\n/** deck.json: what the deck's code needs, its packages. The outline isn't in it (ADR 0006). */\nexport interface DeckJson {\n dependencies?: Record<string, string>;\n}\nexport interface MediaEntry {\n hash: string;\n size: number;\n type: string;\n}\n/** media.json: path inside media/ \u2192 the file's content hash. */\nexport type MediaJson = Record<string, MediaEntry>;\n/** A multiple-choice poll: each phone picks one option; its result shows from `reveals` on. */\nexport interface ChoiceActivity {\n id: string;\n kind: 'choice';\n prompt: string;\n options: string[];\n /** The beat of its scene that closes the poll and shows its result. */\n reveals?: string;\n}\nexport interface TextField {\n id: string;\n label: string;\n multiline?: boolean;\n /** The most characters it takes. 500 unless the scene says otherwise; in a manifest, always set. */\n max?: number;\n}\n/** An open-text poll: each phone fills in its fields. The answers are only stored. */\nexport interface TextActivity {\n id: string;\n kind: 'text';\n prompt?: string;\n fields: TextField[];\n}\n/**\n * A poll: what a scene asks the room, who answer on their phones (the format's `activity`). It\n * is open while the deck is presented on its scene, up to its `reveals` beat.\n */\nexport type Activity = ChoiceActivity | TextActivity;\n/** A scene as the build has it: what its file is, whether or not the outline places it. */\nexport interface BuildScene {\n beats: string[];\n /** The scene's specifier in the import map. */\n module: string;\n activity?: Activity;\n}\nexport interface ManifestScene extends BuildScene {\n id: string;\n title: string;\n /** Left out of presenting, the share link and its PDF (the outline's `hidden`). */\n hidden?: true;\n}\nexport interface ManifestChapter {\n id: string;\n title: string;\n scenes: ManifestScene[];\n}\n/**\n * What a build makes of one revision of a deck, which the server stores with it: every scene file\n * by its id, placed or not, and what the viewer loads. The outline isn't part of it: it is joined\n * in when a manifest is read (joinOutline). Format 1's modules call the engine's media(); a later\n * one's import media (`import cow from '$media/cow.jpg'`), compiled into lookups of the same media\n * map. A revision keeps the format it was pushed with.\n */\nexport interface Build {\n format: 1 | 2;\n /** Each top-level `scenes/<id>.svelte` that exports beats, by its id. */\n scenes: Record<string, BuildScene>;\n /**\n * Deck specifiers (`@deck/scenes/a.svelte`) \u2192 module paths relative to the viewer (`m/<hash>.js`).\n * The server adds the package specifiers once it has bundled them (`d3` \u2192 `p/<bundle>/d3.js`).\n */\n imports: Record<string, string>;\n media: MediaJson;\n /** deck.json's dependencies: package \u2192 exact version. */\n dependencies: Record<string, string>;\n /** The package specifiers the deck imports, by dependency: `{ three: ['three', 'three/addons/\u2026'] }`. */\n packages: Record<string, string[]>;\n /**\n * Stylesheets, relative to the viewer: the master's tokens.css (`m/<hash>.css`), then those of\n * the packages it imports (`p/<bundle>/katex/dist/katex.min.css`), which the server adds.\n */\n styles?: string[];\n /**\n * What the deck's code uses of the deck, so a share gets only what the scenes it shows reach,\n * and only what is on a slide must be on the server (share.ts). A manifest pushed before the build recorded it\n * had it written in afterwards, as its build then would have (TOB-397).\n */\n uses: Uses;\n}\n/**\n * A build stored before the outline left deck.json (ADR 0006): the scenes deck.json listed, in\n * its chapters, and its title, instead of `scenes`. Read as a build (buildScenes), its outline\n * being the deck's now.\n */\nexport type LegacyBuild = Omit<Build, 'scenes'> & {\n title: string;\n chapters: ManifestChapter[];\n};\n/** A build as the server may have stored it: from now on, or from before ADR 0006. */\nexport type StoredBuild = Build | LegacyBuild;\n/**\n * What the viewer needs to show one revision of a deck: its build, with the deck's outline as it\n * is now joined in (joinOutline). Only the scenes both have are in it.\n */\nexport type Manifest = Omit<Build, 'scenes'> & {\n title: string;\n chapters: ManifestChapter[];\n};\n/** A manifest as a share link has it: what its modules use isn't part of it (share.ts). */\nexport type SharedManifest = Omit<Manifest, 'uses'>;\n/** What each of a deck's modules uses of the deck itself, and what its stylesheet does. */\nexport interface Uses {\n /**\n * By specifier (`@deck/scenes/a.svelte`): the deck's modules it imports, statically or not; the\n * media.json names it imports; and its `import.meta.glob` patterns (`frames/*.png`), or in format\n * 1 its media() calls' (share.ts), which a share matches against media.json, so a pattern is here\n * once, not as every name it matches. Each is left out when it has none.\n */\n modules: Record<string, {\n imports?: string[];\n media?: string[];\n patterns?: string[];\n }>;\n /** The media.json names tokens.css links, which every page that shows the deck loads. */\n styles: string[];\n}\n/** A deck's files, from a directory or from a git revision. Paths use `/` and have no leading slash. */\nexport interface DeckTree {\n files(): string[];\n read(path: string): Uint8Array | undefined;\n}\n", "activities.d.ts": "/** What the server tells about a deck's activities: phones what is open, the projector the results. */\n/** An activity as a phone needs it: no more. */\nexport type PhoneActivity = {\n id: string;\n kind: 'choice';\n prompt: string;\n options: string[];\n} | {\n id: string;\n kind: 'text';\n prompt?: string;\n fields: {\n id: string;\n label: string;\n multiline?: boolean;\n max: number;\n }[];\n};\n/** Nothing live, or the session and its open activity, if any. */\nexport type PhoneState = {\n live: false;\n} | {\n live: true;\n show: string;\n activity: PhoneActivity | null;\n};\n/** What the projector hears: the session, and every activity answered in it. */\nexport interface Results {\n show: string | null;\n joined: number;\n activities: Record<string, {\n answered: number;\n counts?: number[];\n }>;\n}\n", "viewer/stream.d.ts": "/**\n * A server-sent events stream that outlasts the server going away. EventSource reconnects by\n * itself only when a connection drops; when a reconnect is answered with an error, as the proxy\n * answers 502 while the app restarts for a release, it gives up for good. This one opens it\n * again, waiting longer each time, up to a minute.\n *\n * `onOpen` runs on every connection, `again` on all but the first: what was sent while the\n * stream was away is missed, so that is the moment to read the state afresh.\n */\nexport declare function stream(url: string, listeners: Record<string, (data: string) => void>, onOpen?: (again: boolean) => void): () => void;\n", "viewer/events.d.ts": 'type Listener = (data: string) => void;\ndeclare const TYPES: readonly ["push", "results", "notes"];\nexport type EventType = (typeof TYPES)[number];\n/** Listen for one type of event on `url`, the window\'s stream: until the returned function runs. */\nexport declare function listen(url: string, type: EventType, listener: Listener, onReopen?: () => void): () => void;\nexport {};\n', "responses.svelte.d.ts": "/**\n * What the room has answered, for the projector: the audience and presenter windows, and the\n * preview on the deck's page, follow it from the server. Print and render, and a link that isn't\n * a presenter's, have zeros. It is live data, which the position can't recreate.\n */\nimport type { SharedManifest } from '@tobos/deck/types';\nimport type { Results } from './activities.ts';\n/** One activity's responses in the current session. */\nexport interface Responses {\n /**\n * The most phones that had the deck's join link open at once during this session, and never fewer\n * than answered.\n */\n readonly joined: number;\n /** People who have answered this activity during this session. */\n readonly answered: number;\n /** Multiple choice's responses per option, in the order the scene declares them; else empty. */\n readonly counts: number[];\n}\n/** The deck's activities, so a poll nobody answered yet has a zero per option. */\nexport declare function setActivities(manifest: SharedManifest): void;\n/** The current session's responses: reactive, for a scene or the presenter's view. */\nexport declare function liveResults(): Readonly<Results>;\n/**\n * The room's responses to an activity of this deck in the current session: how many joined, how\n * many answered, and a poll's counts per option. Call during component setup.\n */\nexport declare function useResponses(id: string): Responses;\n/** Follow the room's results on the window's stream (events.ts) until the returned function runs. */\nexport declare function followResponses(url: string): () => void;\n", "index.d.ts": `import { type Component } from 'svelte';
|
|
51
51
|
import { type JoinInfo } from './registry.ts';
|
|
52
52
|
export { playAudio, playVideo, type PlayAudioOptions, type PlayVideoOptions } from './playback.ts';
|
|
53
53
|
export { useResponses, type Responses } from './responses.svelte.ts';
|
|
@@ -114,7 +114,7 @@ export declare const JoinCode: Component<JoinCodeProps>;
|
|
|
114
114
|
var define_TOBOS_SKILL_default;
|
|
115
115
|
var init_define_TOBOS_SKILL = __esm({
|
|
116
116
|
"<define:TOBOS_SKILL>"() {
|
|
117
|
-
define_TOBOS_SKILL_default = { "SKILL.md": "---\nname: tobos-present\ndescription: Build presentations as code with Tobos Present. Use when the user wants a talk, lecture, pitch or slide deck made, changed, rendered, presented or exported as a PDF, or mentions Tobos or `tobos`.\n---\n\n<!-- Installed by the `tobos` CLI and overwritten when it updates, so changes made here don't last. -->\n\n# Tobos Present\n\nTobos hosts presentations written as code: a deck is a folder of files, one Svelte 5 file per scene, advancing one beat per click. You build it with the `tobos` command, which needs no git; Tobos checks every push, keeps every version, hosts the deck and puts it on stage. `tobos --help` lists every command, and each takes `--json`.\n\n## Get to the deck\n\n- `tobos ls` lists the decks the person can work on, by id. `tobos pull <id>` gets one; `tobos new \"Title\"` starts one and pulls it.\n- A new deck starts from Tobos standard's design. The person's own house styles are decks in `tobos ls`: start from one with `--from <id>`, which copies its master, and ask which when there are several.\n- Then read the deck's `AGENTS.md`: it points to the loop, the format and the deck's slide master.\n- The person's decks are in folders, which `tobos --help` lists the commands for.\n\nExit code 3 means this machine isn't connected to the person's account. Run `tobos login`: it prints an address, which the person opens on any device, logs in at (a first login signs them up, and accepts https://tobos.ai/terms) and approves this machine. Give it to them in one line, then, once they did, run `tobos login` again. In CI or a sandbox with no one to ask, `TOBOS_TOKEN` and `TOBOS_SERVER` stand in for the login.\n\n## Follow the person\n\nThey decide what to make and how much of it you build: one scene at a time, or the whole deck at once. Build what they ask, at the size they ask, from what they have told you about the talk. When they ask how Tobos works or where to start, give them the tour, https://tobos.ai/tour, and nothing of your own: no explanation, no deck to try.\n\n## Folders\n\n- Look at the person's folders before you make or move a deck, and file it under a folder name they have already, as they wrote it, rather than a new one that means the same.\n- File every deck you make: once it is made, move it into the folder it belongs in.\n- Before you move more than a handful of decks, show the person the tree you propose, and make it once they say yes.\n- A reorganisation is taken back by moving the decks back where they were: note where they were before you move them.\n- A folder goes when it empties, by a move or a deck's deletion: there is no removing one. A folder with only archived decks in it isn't empty.\n\n## What stays the person's\n\n- **Exit code 5** is a limit or an archived deck. Show the person the message as it is, which says what they can do, and wait for their answer. The deck stays in Tobos: a deck built elsewhere to upload later, media shrunk or hosted elsewhere to fit, or someone else's account would decide for them what is theirs to decide.\n- **Archiving, opening again and deleting** a deck, and deleting a session's answers, are done by the person on the deck's page, in their own browser.\n- **Who is on a deck, and its link,** are the person's, on the deck's page: they put people on it, change what each may do, take them off, and turn the link on or off there. You neither see nor change any of it: `tobos ls` tells you only what you may do on each deck and whose it is. Can edit builds it with their own agent, can present presents it with its notes and polls and starts decks from its design, and can view sees the slides.\n- **Each scene's notes,** what the speaker says, are the person's: they write them under the stage on the deck's page, and the presenter sees them. You neither read nor write them, and a scene needs none from you.\n- **The URL `tobos open` prints** is the deck's page, where the person watches it, presents it and shares it. Presenting starts there alone: no link you can get presents the deck.\n" };
|
|
117
|
+
define_TOBOS_SKILL_default = { "SKILL.md": "---\nname: tobos-present\ndescription: Build presentations as code with Tobos Present. Use when the user wants a talk, lecture, pitch or slide deck made, changed, rendered, presented or exported as a PDF, or mentions Tobos or `tobos`.\n---\n\n<!-- Installed by the `tobos` CLI and overwritten when it updates, so changes made here don't last. -->\n\n# Tobos Present\n\nTobos hosts presentations written as code: a deck is a folder of files, one Svelte 5 file per scene, advancing one beat per click. You build it with the `tobos` command, which needs no git; Tobos checks every push, keeps every version, hosts the deck and puts it on stage. `tobos --help` lists every command, and each takes `--json`.\n\n## Get to the deck\n\n- `tobos ls` lists the decks the person can work on, by id. `tobos pull <id>` gets one; `tobos new \"Title\"` starts one and pulls it.\n- A new deck starts from Tobos standard's design. The person's own house styles are decks in `tobos ls`: start from one with `--from <id>`, which copies its master, and ask which when there are several.\n- Then read the deck's `AGENTS.md`: it points to the loop, the format and the deck's slide master.\n- The deck's outline, its chapters and scenes in order, their titles and which are hidden, isn't a file: Tobos holds it, and `tobos outline` shows and changes it, live at once. A new scene's file shows nowhere until `tobos outline place <scene>` puts it in. deck.json lists only the npm packages.\n- The person's decks are in folders, which `tobos --help` lists the commands for.\n\nExit code 3 means this machine isn't connected to the person's account. Run `tobos login`: it prints an address, which the person opens on any device, logs in at (a first login signs them up, and accepts https://tobos.ai/terms) and approves this machine. Give it to them in one line, then, once they did, run `tobos login` again. In CI or a sandbox with no one to ask, `TOBOS_TOKEN` and `TOBOS_SERVER` stand in for the login.\n\n## Follow the person\n\nThey decide what to make and how much of it you build: one scene at a time, or the whole deck at once. Build what they ask, at the size they ask, from what they have told you about the talk. When they ask how Tobos works or where to start, give them the tour, https://tobos.ai/tour, and nothing of your own: no explanation, no deck to try.\n\n## Folders\n\n- Look at the person's folders before you make or move a deck, and file it under a folder name they have already, as they wrote it, rather than a new one that means the same.\n- File every deck you make: once it is made, move it into the folder it belongs in.\n- Before you move more than a handful of decks, show the person the tree you propose, and make it once they say yes.\n- A reorganisation is taken back by moving the decks back where they were: note where they were before you move them.\n- A folder goes when it empties, by a move or a deck's deletion: there is no removing one. A folder with only archived decks in it isn't empty.\n\n## What stays the person's\n\n- **Exit code 5** is a limit or an archived deck. Show the person the message as it is, which says what they can do, and wait for their answer. The deck stays in Tobos: a deck built elsewhere to upload later, media shrunk or hosted elsewhere to fit, or someone else's account would decide for them what is theirs to decide.\n- **Archiving, opening again and deleting** a deck, and deleting a session's answers, are done by the person on the deck's page, in their own browser.\n- **Who is on a deck, and its link,** are the person's, on the deck's page: they put people on it, change what each may do, take them off, and turn the link on or off there. You neither see nor change any of it: `tobos ls` tells you only what you may do on each deck and whose it is. Can edit builds it with their own agent, can present presents it with its notes and polls and starts decks from its design, and can view sees the slides.\n- **Each scene's notes,** what the speaker says, are the person's: they write them under the stage on the deck's page, and the presenter sees them. You neither read nor write them, and a scene needs none from you.\n- **The URL `tobos open` prints** is the deck's page, where the person watches it, presents it and shares it. Presenting starts there alone: no link you can get presents the deck.\n" };
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
|
|
@@ -5,19 +5,16 @@ import {
|
|
|
5
5
|
init_define_TOBOS_PRESENT_TYPES,
|
|
6
6
|
init_define_TOBOS_SKILL,
|
|
7
7
|
init_define_TOBOS_TOOLCHAIN
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-G2X34YQC.js";
|
|
9
9
|
|
|
10
10
|
// ../deck/src/deck-json.ts
|
|
11
11
|
init_define_TOBOS_PRESENT_TYPES();
|
|
12
12
|
init_define_TOBOS_SKILL();
|
|
13
13
|
init_define_TOBOS_TOOLCHAIN();
|
|
14
|
-
var ID = /^[a-z][a-z0-9-]*$/;
|
|
15
14
|
var FILE = "deck.json";
|
|
16
15
|
var PACKAGE = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
|
|
17
16
|
var EXACT_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
18
17
|
var PROVIDED = /* @__PURE__ */ new Set(["svelte", "gsap"]);
|
|
19
|
-
var SCENES_MAX = 500;
|
|
20
|
-
var TITLE_MAX = 200;
|
|
21
18
|
var own = (entries) => Object.assign(/* @__PURE__ */ Object.create(null), Object.fromEntries(entries));
|
|
22
19
|
function problem(message, rule = "deck-json") {
|
|
23
20
|
return { file: FILE, rule, message, severity: "error" };
|
|
@@ -35,58 +32,6 @@ function parseDeckJson(text) {
|
|
|
35
32
|
}
|
|
36
33
|
const problems = [];
|
|
37
34
|
if (!isObject(raw)) return { problems: [problem("deck.json must be an object.")] };
|
|
38
|
-
const titled = (title, where, empty = true) => {
|
|
39
|
-
if (typeof title !== "string" || !empty && title.trim() === "")
|
|
40
|
-
problems.push(problem(`${where} must be a${empty ? "" : " non-empty"} string.`));
|
|
41
|
-
else if (title.length > TITLE_MAX)
|
|
42
|
-
problems.push(problem(`${where} is ${title.length} characters; at most ${TITLE_MAX}.`));
|
|
43
|
-
};
|
|
44
|
-
titled(raw.title, '"title"', false);
|
|
45
|
-
const chapterIds = /* @__PURE__ */ new Set();
|
|
46
|
-
const sceneIds = /* @__PURE__ */ new Set();
|
|
47
|
-
let shown = 0;
|
|
48
|
-
if (!Array.isArray(raw.chapters) || raw.chapters.length === 0) {
|
|
49
|
-
problems.push(problem('"chapters" must be a list with at least one chapter.'));
|
|
50
|
-
} else {
|
|
51
|
-
raw.chapters.forEach((chapter, c) => {
|
|
52
|
-
const where = `chapters[${c}]`;
|
|
53
|
-
if (!isObject(chapter)) return problems.push(problem(`${where} must be an object.`));
|
|
54
|
-
if (typeof chapter.id !== "string" || !ID.test(chapter.id))
|
|
55
|
-
problems.push(problem(`${where}.id must be lowercase letters, digits and dashes.`));
|
|
56
|
-
else if (chapterIds.has(chapter.id))
|
|
57
|
-
problems.push(problem(`Chapter "${chapter.id}" is listed twice.`));
|
|
58
|
-
else chapterIds.add(chapter.id);
|
|
59
|
-
titled(chapter.title, `${where}.title`);
|
|
60
|
-
if (!Array.isArray(chapter.scenes) || chapter.scenes.length === 0)
|
|
61
|
-
return problems.push(problem(`${where}.scenes must be a list with at least one scene.`));
|
|
62
|
-
chapter.scenes.forEach((scene, s) => {
|
|
63
|
-
const at = `${where}.scenes[${s}]`;
|
|
64
|
-
if (!isObject(scene)) return problems.push(problem(`${at} must be an object.`));
|
|
65
|
-
if (typeof scene.id !== "string" || !ID.test(scene.id))
|
|
66
|
-
problems.push(problem(`${at}.id must be lowercase letters, digits and dashes.`));
|
|
67
|
-
else if (sceneIds.has(scene.id))
|
|
68
|
-
problems.push(problem(`Scene "${scene.id}" is listed twice.`));
|
|
69
|
-
else sceneIds.add(scene.id);
|
|
70
|
-
titled(scene.title, `${at}.title`);
|
|
71
|
-
if (scene.hidden !== void 0 && typeof scene.hidden !== "boolean")
|
|
72
|
-
problems.push(problem(`${at}.hidden is true or false.`));
|
|
73
|
-
if (scene.hidden !== true) shown++;
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
if (shown === 0 && sceneIds.size > 0)
|
|
77
|
-
problems.push(problem("Every scene is hidden: at least one has to show."));
|
|
78
|
-
const count = raw.chapters.reduce(
|
|
79
|
-
(sum, chapter) => sum + (isObject(chapter) && Array.isArray(chapter.scenes) ? chapter.scenes.length : 0),
|
|
80
|
-
0
|
|
81
|
-
);
|
|
82
|
-
if (count > SCENES_MAX)
|
|
83
|
-
problems.push(
|
|
84
|
-
problem(
|
|
85
|
-
`deck.json lists ${count} scenes; a deck may have ${SCENES_MAX}. Split it into several decks.`,
|
|
86
|
-
"scenes"
|
|
87
|
-
)
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
35
|
if (raw.dependencies !== void 0) {
|
|
91
36
|
if (!isObject(raw.dependencies)) problems.push(problem('"dependencies" must be an object.'));
|
|
92
37
|
else
|
|
@@ -102,24 +47,23 @@ function parseDeckJson(text) {
|
|
|
102
47
|
}
|
|
103
48
|
}
|
|
104
49
|
if (problems.length > 0) return { problems };
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
};
|
|
50
|
+
let listed;
|
|
51
|
+
if (raw.title !== void 0 || raw.chapters !== void 0) {
|
|
52
|
+
problems.push({ ...problem(OUTLINE_MOVED), severity: "warning" });
|
|
53
|
+
listed = new Set(
|
|
54
|
+
(Array.isArray(raw.chapters) ? raw.chapters : []).flatMap(
|
|
55
|
+
(chapter) => isObject(chapter) && Array.isArray(chapter.scenes) ? chapter.scenes.flatMap(
|
|
56
|
+
(scene) => isObject(scene) && typeof scene.id === "string" ? [scene.id] : []
|
|
57
|
+
) : []
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const deck = {};
|
|
119
62
|
if (raw.dependencies !== void 0)
|
|
120
63
|
deck.dependencies = own(Object.entries(raw.dependencies));
|
|
121
|
-
return { deck, problems };
|
|
64
|
+
return { deck, problems, ...listed ? { listed } : {} };
|
|
122
65
|
}
|
|
66
|
+
var OUTLINE_MOVED = 'deck.json\'s "title" and "chapters" are read by nothing now: the outline moved to Tobos. `tobos outline` shows and changes it, and .tobos/FORMAT.md explains it. Tobos takes them out of deck.json.';
|
|
123
67
|
function parseMediaJson(text) {
|
|
124
68
|
if (text === void 0) return { media: own([]), problems: [] };
|
|
125
69
|
const bad = (message) => ({
|
|
@@ -213,7 +157,7 @@ function mergeText(base, ours, theirs) {
|
|
|
213
157
|
...changes[0].map((h) => ({ ...h, side: 0 })),
|
|
214
158
|
...changes[1].map((h) => ({ ...h, side: 1 }))
|
|
215
159
|
].sort((x, y) => x.from - y.from || x.to - y.to);
|
|
216
|
-
const
|
|
160
|
+
const merged = [];
|
|
217
161
|
let at = 0;
|
|
218
162
|
for (let i = 0; i < hunks.length; ) {
|
|
219
163
|
const group = [hunks[i]];
|
|
@@ -242,11 +186,11 @@ function mergeText(base, ours, theirs) {
|
|
|
242
186
|
if (mine.join("") !== yours.join("")) return void 0;
|
|
243
187
|
lines = mine;
|
|
244
188
|
}
|
|
245
|
-
|
|
189
|
+
merged.push(...b.slice(at, from), ...lines);
|
|
246
190
|
at = to;
|
|
247
191
|
}
|
|
248
|
-
|
|
249
|
-
return
|
|
192
|
+
merged.push(...b.slice(at));
|
|
193
|
+
return merged.join("");
|
|
250
194
|
}
|
|
251
195
|
function overlaps(hunk, from, to) {
|
|
252
196
|
return hunk.from < to || hunk.from === from || hunk.from === to && (hunk.to === to || from === to);
|
|
@@ -306,160 +250,6 @@ function middleHunks(a, b) {
|
|
|
306
250
|
close();
|
|
307
251
|
return hunks;
|
|
308
252
|
}
|
|
309
|
-
function mergeFile(path, base, ours, theirs) {
|
|
310
|
-
return path === "deck.json" ? mergeDeckJson(base, ours, theirs) : mergeText(base, ours, theirs);
|
|
311
|
-
}
|
|
312
|
-
var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
313
|
-
var canonical = (value) => JSON.stringify(
|
|
314
|
-
value,
|
|
315
|
-
(_, v) => isObject2(v) ? Object.fromEntries(Object.entries(v).sort(([x], [y]) => x < y ? -1 : 1)) : v
|
|
316
|
-
);
|
|
317
|
-
var same = (a, b) => canonical(a) === canonical(b);
|
|
318
|
-
function deckOf(text) {
|
|
319
|
-
let value;
|
|
320
|
-
try {
|
|
321
|
-
value = JSON.parse(text);
|
|
322
|
-
} catch {
|
|
323
|
-
return void 0;
|
|
324
|
-
}
|
|
325
|
-
if (!isObject2(value) || !Array.isArray(value.chapters)) return void 0;
|
|
326
|
-
const chapters = value.chapters;
|
|
327
|
-
const ok = chapters.every(
|
|
328
|
-
(c) => isObject2(c) && typeof c.id === "string" && Array.isArray(c.scenes) && c.scenes.every((s) => isObject2(s) && typeof s.id === "string")
|
|
329
|
-
);
|
|
330
|
-
if (!ok) return void 0;
|
|
331
|
-
const deck = value;
|
|
332
|
-
const ids = [
|
|
333
|
-
deck.chapters.map((c) => c.id),
|
|
334
|
-
deck.chapters.flatMap((c) => c.scenes.map((s) => s.id))
|
|
335
|
-
];
|
|
336
|
-
return ids.every((list) => new Set(list).size === list.length) ? deck : void 0;
|
|
337
|
-
}
|
|
338
|
-
var Conflict = class extends Error {
|
|
339
|
-
};
|
|
340
|
-
function merged(base, ours, theirs) {
|
|
341
|
-
if (same(ours, base)) return theirs;
|
|
342
|
-
if (same(theirs, base) || same(ours, theirs)) return ours;
|
|
343
|
-
if (!isObject2(ours) || !isObject2(theirs)) throw new Conflict();
|
|
344
|
-
const out = {};
|
|
345
|
-
const old = isObject2(base) ? base : {};
|
|
346
|
-
for (const key of /* @__PURE__ */ new Set([...Object.keys(theirs), ...Object.keys(ours)])) {
|
|
347
|
-
const value = merged(old[key], ours[key], theirs[key]);
|
|
348
|
-
if (value !== void 0) out[key] = value;
|
|
349
|
-
}
|
|
350
|
-
return out;
|
|
351
|
-
}
|
|
352
|
-
function movedIn(base, side) {
|
|
353
|
-
const kept = side.filter((id) => base.includes(id));
|
|
354
|
-
const at = kept.map((id) => base.indexOf(id));
|
|
355
|
-
const tails = [];
|
|
356
|
-
const before = [];
|
|
357
|
-
at.forEach((value, i) => {
|
|
358
|
-
let lo = 0;
|
|
359
|
-
let hi = tails.length;
|
|
360
|
-
while (lo < hi) {
|
|
361
|
-
const mid = lo + hi >> 1;
|
|
362
|
-
if (at[tails[mid]] < value) lo = mid + 1;
|
|
363
|
-
else hi = mid;
|
|
364
|
-
}
|
|
365
|
-
before[i] = lo ? tails[lo - 1] : -1;
|
|
366
|
-
tails[lo] = i;
|
|
367
|
-
});
|
|
368
|
-
const run = /* @__PURE__ */ new Set();
|
|
369
|
-
for (let i = tails.at(-1) ?? -1; i >= 0; i = before[i]) run.add(kept[i]);
|
|
370
|
-
return new Set(kept.filter((id) => !run.has(id)));
|
|
371
|
-
}
|
|
372
|
-
function mergeDeckJson(base, ours, theirs) {
|
|
373
|
-
const lined = mergeText(base, ours, theirs);
|
|
374
|
-
const [b, o, t] = [deckOf(base), deckOf(ours), deckOf(theirs)];
|
|
375
|
-
if (!b || !o || !t) return lined;
|
|
376
|
-
try {
|
|
377
|
-
return byScene(b, o, t, lined, theirs);
|
|
378
|
-
} catch (error) {
|
|
379
|
-
if (error instanceof Conflict) return void 0;
|
|
380
|
-
throw error;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
function putAfter(list, before, item) {
|
|
384
|
-
const at = before.map((id) => list.findIndex((x) => x.id === id)).find((x) => x >= 0);
|
|
385
|
-
list.splice((at ?? -1) + 1, 0, item);
|
|
386
|
-
}
|
|
387
|
-
var fieldsOf = ({ scenes: _, ...fields }) => fields;
|
|
388
|
-
function byScene(b, o, t, lined, theirs) {
|
|
389
|
-
const place = (deck) => new Map(deck.chapters.flatMap((c) => c.scenes.map((s) => [s.id, c.id])));
|
|
390
|
-
const order = (deck) => deck.chapters.flatMap((c) => c.scenes.map((s) => s.id));
|
|
391
|
-
const [inBase, inOurs] = [place(b), place(o)];
|
|
392
|
-
const sceneIn = (deck, id) => deck.chapters.flatMap((c) => c.scenes).find((s) => s.id === id);
|
|
393
|
-
const chapters = t.chapters.map((c) => ({ ...c, scenes: [...c.scenes] }));
|
|
394
|
-
const take = (id) => {
|
|
395
|
-
for (const c of chapters) {
|
|
396
|
-
const at = c.scenes.findIndex((s) => s.id === id);
|
|
397
|
-
if (at >= 0) return c.scenes.splice(at, 1)[0];
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
const before = (list, i) => list.slice(0, i).map((x) => x.id).reverse();
|
|
401
|
-
for (const id of order(b)) if (!inOurs.has(id)) take(id);
|
|
402
|
-
const moved = movedIn(order(b), order(o));
|
|
403
|
-
for (const c of o.chapters) {
|
|
404
|
-
c.scenes.forEach((scene, i) => {
|
|
405
|
-
const id = scene.id;
|
|
406
|
-
const added = !inBase.has(id);
|
|
407
|
-
const elsewhere = inBase.get(id) !== c.id;
|
|
408
|
-
if (!added && !moved.has(id) && !elsewhere) return;
|
|
409
|
-
const was = take(id);
|
|
410
|
-
if (!was && !added) return;
|
|
411
|
-
let chapter = chapters.find((x) => x.id === c.id);
|
|
412
|
-
if (!chapter) {
|
|
413
|
-
chapter = { ...fieldsOf(c), id: c.id, scenes: [] };
|
|
414
|
-
putAfter(chapters, before(o.chapters, o.chapters.indexOf(c)), chapter);
|
|
415
|
-
}
|
|
416
|
-
putAfter(chapter.scenes, before(c.scenes, i), was ?? scene);
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
const movedChapters = movedIn(
|
|
420
|
-
b.chapters.map((c) => c.id),
|
|
421
|
-
o.chapters.map((c) => c.id)
|
|
422
|
-
);
|
|
423
|
-
o.chapters.forEach((c, i) => {
|
|
424
|
-
const at = chapters.findIndex((x) => x.id === c.id);
|
|
425
|
-
if (!movedChapters.has(c.id) || at < 0) return;
|
|
426
|
-
putAfter(chapters, before(o.chapters, i), chapters.splice(at, 1)[0]);
|
|
427
|
-
});
|
|
428
|
-
const result = merged(
|
|
429
|
-
{ ...b, chapters: null },
|
|
430
|
-
{ ...o, chapters: null },
|
|
431
|
-
{ ...t, chapters: null }
|
|
432
|
-
);
|
|
433
|
-
result.chapters = chapters.filter((c) => c.scenes.length > 0).map((c) => {
|
|
434
|
-
const keys = (deck) => {
|
|
435
|
-
const found = deck.chapters.find((x) => x.id === c.id);
|
|
436
|
-
return found && fieldsOf(found);
|
|
437
|
-
};
|
|
438
|
-
const fields = fieldsOf(c);
|
|
439
|
-
const head = merged(keys(b), keys(o), keys(t) ?? fields) ?? fields;
|
|
440
|
-
return {
|
|
441
|
-
...head,
|
|
442
|
-
scenes: c.scenes.map(
|
|
443
|
-
(s) => merged(
|
|
444
|
-
sceneIn(b, s.id),
|
|
445
|
-
sceneIn(o, s.id),
|
|
446
|
-
sceneIn(t, s.id) ?? s
|
|
447
|
-
) ?? s
|
|
448
|
-
)
|
|
449
|
-
};
|
|
450
|
-
});
|
|
451
|
-
const ordered = {};
|
|
452
|
-
for (const key of [...Object.keys(t), ...Object.keys(result)])
|
|
453
|
-
if (key in result && !(key in ordered)) ordered[key] = result[key];
|
|
454
|
-
if (lined !== void 0) {
|
|
455
|
-
const read = deckOf(lined);
|
|
456
|
-
if (read && same(read, ordered)) return lined;
|
|
457
|
-
}
|
|
458
|
-
const indent = /\n([ \t]+)"/.exec(theirs)?.[1] ?? "";
|
|
459
|
-
const text = indent ? JSON.stringify(ordered, null, indent) : JSON.stringify(ordered);
|
|
460
|
-
return theirs.endsWith("\n") ? `${text}
|
|
461
|
-
` : text;
|
|
462
|
-
}
|
|
463
253
|
|
|
464
254
|
// ../deck/src/tar.ts
|
|
465
255
|
init_define_TOBOS_PRESENT_TYPES();
|
|
@@ -511,6 +301,6 @@ export {
|
|
|
511
301
|
parseDeckJson,
|
|
512
302
|
parseMediaJson,
|
|
513
303
|
mediaTypeOf,
|
|
514
|
-
|
|
304
|
+
mergeText,
|
|
515
305
|
unpackTar
|
|
516
306
|
};
|
package/dist/cli.js
CHANGED
|
@@ -4,10 +4,10 @@ const require = __tobosRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
formatProblems,
|
|
6
6
|
mediaTypeOf,
|
|
7
|
-
|
|
7
|
+
mergeText,
|
|
8
8
|
parseMediaJson,
|
|
9
9
|
unpackTar
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-U44FVSIH.js";
|
|
11
11
|
import {
|
|
12
12
|
ASK_THE_PERSON,
|
|
13
13
|
CliError,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
init_define_TOBOS_TOOLCHAIN,
|
|
20
20
|
offerUpdate,
|
|
21
21
|
update
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-G2X34YQC.js";
|
|
23
23
|
|
|
24
24
|
// src/main.ts
|
|
25
25
|
init_define_TOBOS_PRESENT_TYPES();
|
|
@@ -36,6 +36,11 @@ var REV = { type: "string", description: "A version of the deck; its latest if l
|
|
|
36
36
|
var CHANGESET_SCHEMA = {
|
|
37
37
|
type: "object",
|
|
38
38
|
properties: {
|
|
39
|
+
outline: {
|
|
40
|
+
type: "array",
|
|
41
|
+
description: 'Changes to the deck\u2019s outline (its chapters and scenes in order, their titles, which are hidden), which Tobos holds, not a file, made with the files or alone (`files` empty): at once, no version. Each one of: `{"op": "place", "scene": id, "title"?, "hidden"?, "to"}`, a scene file into the outline, as a new one shows nowhere until placed; `{"op": "move", "scenes": [ids], "to"}`; `{"op": "hide", "scenes": [ids], "hidden": true|false}`; `{"op": "rename", "scene": id, "title"}`; `{"op": "remove", "scenes": [ids]}`, out of the outline, its file kept; `{"op": "title", "title"}`, the deck\u2019s; `{"op": "addChapter", "chapter": id, "title", "before"?}`, `renameChapter`, `moveChapter` (`"before"`: a chapter, or null for last), `removeChapter` (an empty one). `to` is `{"after": id}`, `{"before": id}` or `{"chapter": id, "at": "start"|"end"}`. One that names what is gone is refused as a conflict, with the outline as it is.',
|
|
42
|
+
items: { type: "object", properties: { op: { type: "string" } }, required: ["op"] }
|
|
43
|
+
},
|
|
39
44
|
base: {
|
|
40
45
|
type: ["string", "null"],
|
|
41
46
|
description: "The version the files were read at: the `rev` that a read, `new` or the last write gave. If the deck changed since, Tobos merges: only lines both changed differently are a conflict."
|
|
@@ -95,13 +100,13 @@ var VERBS = {
|
|
|
95
100
|
]
|
|
96
101
|
},
|
|
97
102
|
read: {
|
|
98
|
-
does: "A deck\u2019s files at a version, its latest unless another is named, with that version, `rev`, to write on.",
|
|
103
|
+
does: "A deck\u2019s files at a version, its latest unless another is named, with that version, `rev`, to write on; and its outline as it is now, its chapters and scenes in order, which Tobos holds, not a file, with the scene files it doesn\u2019t place.",
|
|
99
104
|
input: {
|
|
100
105
|
properties: {
|
|
101
106
|
paths: {
|
|
102
107
|
type: "array",
|
|
103
108
|
items: { type: "string" },
|
|
104
|
-
description: "The files to read, such as `
|
|
109
|
+
description: "The files to read, such as `scenes/intro.svelte`, or `master/`."
|
|
105
110
|
},
|
|
106
111
|
rev: REV,
|
|
107
112
|
since: {
|
|
@@ -116,12 +121,16 @@ var VERBS = {
|
|
|
116
121
|
{
|
|
117
122
|
usage: "tobos pull",
|
|
118
123
|
does: "the latest version into the copy, merged with your changes; a conflict is left between <<<<<<< and >>>>>>> to resolve"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
usage: "tobos outline",
|
|
127
|
+
does: "the deck\u2019s outline: its chapters and scenes in order, and the scene files it doesn\u2019t place"
|
|
119
128
|
}
|
|
120
129
|
],
|
|
121
130
|
chat: 'Without `paths`, lists its files with their sizes; with them, gives each file\u2019s text, many in one call (a path ending in `/` reads every file under it). Reading media/ (`paths: ["media/"]`) shows its pictures, video and sound instead: each file\u2019s name, type and size, when it was added and by whom, and contact sheets to see what they show, with the address of the deck\u2019s page where the person drops files. With `since`, only the files added since that version. Paths of files in media/ show just those, one alone as large as the sheet. A picture the person gave you in the chat reaches you, not Tobos: give them the address of the deck\u2019s page that reading media/ gives, where they drop it.'
|
|
122
131
|
},
|
|
123
132
|
write: {
|
|
124
|
-
does: "Changes a deck\u2019s files as one version, live at once, made on the version they were read at: Tobos merges what changed since, checks the deck as it would be, and saves nothing, saying why, if the check refuses it or someone changed the same lines. Dry, it only checks.",
|
|
133
|
+
does: "Changes a deck\u2019s files as one version, live at once, made on the version they were read at: Tobos merges what changed since, checks the deck as it would be, and saves nothing, saying why, if the check refuses it or someone changed the same lines. Dry, it only checks. With `outline`, it changes the deck\u2019s outline too, or alone.",
|
|
125
134
|
input: {
|
|
126
135
|
properties: { ...CHANGESET_SCHEMA.properties },
|
|
127
136
|
required: CHANGESET_SCHEMA.required
|
|
@@ -134,9 +143,13 @@ var VERBS = {
|
|
|
134
143
|
{
|
|
135
144
|
usage: "tobos check [--types]",
|
|
136
145
|
does: "the same, dry: the server\u2019s check, nothing saved; --types adds TypeScript\u2019s view, here"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
usage: "tobos outline <op> \u2026",
|
|
149
|
+
does: "the outline changed at once, no push: place, move, hide, show, rename, remove, title, chapter (tobos help says each)"
|
|
137
150
|
}
|
|
138
151
|
],
|
|
139
|
-
chat: "Each file\u2019s text in full, a patch of part of it, a file on the web for media/, or null to delete it. All or nothing, so put everything a step needs into one call."
|
|
152
|
+
chat: "Each file\u2019s text in full, a patch of part of it, a file on the web for media/, or null to delete it. All or nothing, so put everything a step needs into one call: a new scene\u2019s file and the `outline` change that places it."
|
|
140
153
|
},
|
|
141
154
|
new: {
|
|
142
155
|
does: "Makes a deck in the person\u2019s account, with its first version, `rev`: one title scene, and the design of the deck it starts from, its master, the master\u2019s media and the packages it imports. Tobos standard unless another deck is named, such as the person\u2019s own house style (ask which when they have several). To use another deck\u2019s scenes too, read them and write them like any file.",
|
|
@@ -256,7 +269,7 @@ function settings() {
|
|
|
256
269
|
}
|
|
257
270
|
|
|
258
271
|
// src/api.ts
|
|
259
|
-
var VERSION = true ? "0.4.
|
|
272
|
+
var VERSION = true ? "0.4.45" : "dev";
|
|
260
273
|
function newer(a, b) {
|
|
261
274
|
const parse = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n) => parseInt(n)) : null;
|
|
262
275
|
const x = parse(a);
|
|
@@ -492,7 +505,7 @@ async function pullInto(root, deck, server, base, { note, clone = false }) {
|
|
|
492
505
|
const theirs = s === void 0 ? void 0 : await bytesOf(path, s);
|
|
493
506
|
const older = b === void 0 ? new Uint8Array() : await fileAt(deck, server, base.rev, path);
|
|
494
507
|
const texts = [older, ours, theirs].every((bytes) => bytes && isUtf8(bytes));
|
|
495
|
-
const merged = texts ?
|
|
508
|
+
const merged = texts ? mergeText(textOf(older), textOf(ours), textOf(theirs)) : void 0;
|
|
496
509
|
if (merged !== void 0) write2(file2, Buffer.from(merged));
|
|
497
510
|
else if (texts) {
|
|
498
511
|
write2(file2, Buffer.from(marked(textOf(ours), textOf(theirs))));
|
|
@@ -514,7 +527,13 @@ async function pullInto(root, deck, server, base, { note, clone = false }) {
|
|
|
514
527
|
}
|
|
515
528
|
changed.push(path);
|
|
516
529
|
}
|
|
517
|
-
writeBase(root, {
|
|
530
|
+
writeBase(root, {
|
|
531
|
+
deck,
|
|
532
|
+
server,
|
|
533
|
+
rev: now.rev,
|
|
534
|
+
files: Object.fromEntries(next),
|
|
535
|
+
...base?.outline === void 0 ? {} : { outline: base.outline }
|
|
536
|
+
});
|
|
518
537
|
return { rev: now.rev, changed, conflicts };
|
|
519
538
|
}
|
|
520
539
|
function marked(ours, theirs) {
|
|
@@ -704,7 +723,9 @@ You work in a copy of the deck, from \`tobos pull <id>\` or \`tobos new\`, with
|
|
|
704
723
|
the versions. Every push is live: every open preview follows within a second, so the person
|
|
705
724
|
watches the deck take shape.
|
|
706
725
|
|
|
707
|
-
1. Change
|
|
726
|
+
1. Change the scenes and whatever else the step needs. A new scene shows nowhere until it is
|
|
727
|
+
placed in the outline, which Tobos holds, not a file: \`tobos outline place <scene>\` once it is
|
|
728
|
+
pushed.
|
|
708
729
|
2. \`tobos check\`: fix every error it reports.
|
|
709
730
|
3. \`tobos render <scene>/<beat>\` pushes what changed and writes a PNG of that beat; \`--film\`
|
|
710
731
|
writes frames through its animation. Look at each one.
|
|
@@ -713,6 +734,13 @@ watches the deck take shape.
|
|
|
713
734
|
|
|
714
735
|
A step is done when every beat it changed has been rendered and looked at.
|
|
715
736
|
|
|
737
|
+
The outline (below) changes with \`tobos outline\`, live at once, with no push: \`tobos outline\`
|
|
738
|
+
prints it and the scene files it doesn't place; \`place <scene> --after <scene>\` (or
|
|
739
|
+
\`--before <scene>\`, \`--chapter <id> [--start]\`, \`--title "\u2026"\`), \`move <scene>\u2026 --after
|
|
740
|
+
<scene>\`, \`hide\` and \`show <scene>\u2026\`, \`rename <scene> "Title"\`, \`remove <scene>\u2026\`, \`title
|
|
741
|
+
"\u2026"\`, and \`chapter add|rename|move|remove\`. \`tobos pull\` says what changed in it on the deck's
|
|
742
|
+
page since. Exit code 4 means it changed meanwhile: \`tobos outline\`, then again.
|
|
743
|
+
|
|
716
744
|
\`.tobos/\` holds this file and the version the copy is of: leave it be. A push leaves out what
|
|
717
745
|
is in \`.tobos/\`, \`.git/\`, \`sources/\` and \`node_modules/\` at the copy's top.
|
|
718
746
|
|
|
@@ -990,7 +1018,7 @@ Read AGENTS.md there first. Preview: ${info.url}`
|
|
|
990
1018
|
clone: !found.base
|
|
991
1019
|
});
|
|
992
1020
|
await writeFormatGuide(found.root, base.server);
|
|
993
|
-
const page =
|
|
1021
|
+
const page = await pageChanges(out, found.root, base, pulled.rev);
|
|
994
1022
|
out.result(
|
|
995
1023
|
{ id: base.deck, ...pulled, page },
|
|
996
1024
|
() => [
|
|
@@ -1002,12 +1030,24 @@ ${pulled.conflicts.join("\n")}` : ""
|
|
|
1002
1030
|
);
|
|
1003
1031
|
if (pulled.conflicts.length) process.exitCode = EXIT.conflict;
|
|
1004
1032
|
}
|
|
1005
|
-
async function pageChanges(out,
|
|
1033
|
+
async function pageChanges(out, root, base, until = null) {
|
|
1034
|
+
const { deck, server, rev: since } = base;
|
|
1006
1035
|
if (!since) return [];
|
|
1007
|
-
const range =
|
|
1036
|
+
const range = new URLSearchParams({
|
|
1037
|
+
since,
|
|
1038
|
+
...until ? { until } : {},
|
|
1039
|
+
...base.outline === void 0 ? {} : { outline: String(base.outline) }
|
|
1040
|
+
});
|
|
1008
1041
|
try {
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1042
|
+
const answer = await api(`/api/decks/${deck}?${range}`, { server });
|
|
1043
|
+
if (answer.outline) keepOutlineVersion(root, answer.outline.version);
|
|
1044
|
+
return [
|
|
1045
|
+
...answer.pushes.filter((p) => p.door === "browser" || p.door === "tobos").map((p) => ({ message: p.message ?? "Changed", author: p.author ?? p.door })),
|
|
1046
|
+
...(answer.outlineChanges ?? []).map((c) => ({
|
|
1047
|
+
message: c.message,
|
|
1048
|
+
author: c.author ?? c.door
|
|
1049
|
+
}))
|
|
1050
|
+
];
|
|
1011
1051
|
} catch (error) {
|
|
1012
1052
|
out.note(
|
|
1013
1053
|
`Couldn't ask what changed on the deck's page since ${since.slice(0, 7)}: its versions say. (${error.message})`,
|
|
@@ -1016,16 +1056,21 @@ async function pageChanges(out, deck, server, since, until = null) {
|
|
|
1016
1056
|
return [];
|
|
1017
1057
|
}
|
|
1018
1058
|
}
|
|
1059
|
+
function keepOutlineVersion(root, version) {
|
|
1060
|
+
const found = findCopy(root);
|
|
1061
|
+
if (found?.base && found.root === root) writeBase(root, { ...found.base, outline: version });
|
|
1062
|
+
}
|
|
1019
1063
|
var saidPage = (changes) => changes.length ? [
|
|
1020
|
-
"Changed on the deck
|
|
1064
|
+
"Changed meanwhile, on the deck\u2019s page or by Tobos (`tobos outline` shows the outline):",
|
|
1021
1065
|
...changes.map((c) => ` ${c.message}${c.author ? ` (${c.author})` : ""}`),
|
|
1022
|
-
// As the
|
|
1066
|
+
// As the history says it (arrangedMessage): “Renamed “…” to …”, or after a “; ”.
|
|
1023
1067
|
changes.some((c) => /(^|; )renamed “/i.test(c.message)) ? "A scene renamed there keeps its slide's own heading: change that to match." : ""
|
|
1024
1068
|
].filter(Boolean).join("\n") : "";
|
|
1025
1069
|
async function pullCopy(out, info, dir2) {
|
|
1026
1070
|
const { server } = settings();
|
|
1027
1071
|
out.note(`pulling ${info.title} into ${dir2}`);
|
|
1028
1072
|
await pullInto(dir2, info.id, server, void 0, { note: (m) => out.note(m) });
|
|
1073
|
+
if (info.outline) keepOutlineVersion(dir2, info.outline.version);
|
|
1029
1074
|
await writeFormatGuide(dir2, server);
|
|
1030
1075
|
}
|
|
1031
1076
|
async function create(out, args) {
|
|
@@ -1075,7 +1120,7 @@ async function check(out, args) {
|
|
|
1075
1120
|
);
|
|
1076
1121
|
const problems = [...written.problems];
|
|
1077
1122
|
if (args.values.types) {
|
|
1078
|
-
const { checkTypes } = await import("./types-
|
|
1123
|
+
const { checkTypes } = await import("./types-Z5RQYYIE.js");
|
|
1079
1124
|
problems.push(...await checkTypes(copy.root, (m) => out.note(m)));
|
|
1080
1125
|
}
|
|
1081
1126
|
const { errors, warnings } = problemSummary(problems);
|
|
@@ -1121,19 +1166,19 @@ async function pushCopy(out, copy, message) {
|
|
|
1121
1166
|
rev: written.rev,
|
|
1122
1167
|
uploaded: written.uploaded,
|
|
1123
1168
|
problems: written.problems,
|
|
1124
|
-
// What
|
|
1125
|
-
page: await pageChanges(out, copy.
|
|
1169
|
+
// What changed that the copy didn't make, on the page or by Tobos, since its version.
|
|
1170
|
+
page: await pageChanges(out, copy.root, copy.base, written.rev)
|
|
1126
1171
|
};
|
|
1127
1172
|
}
|
|
1128
1173
|
async function push(out, args) {
|
|
1129
1174
|
const copy = requireCopy();
|
|
1130
1175
|
const pushed = await pushCopy(out, copy, args.values.message);
|
|
1131
|
-
const result = pushed.pushed ? pushed : { ...pushed, page: await pageChanges(out, copy.
|
|
1176
|
+
const result = pushed.pushed ? pushed : { ...pushed, page: await pageChanges(out, copy.root, copy.base) };
|
|
1132
1177
|
const url = `${copy.base.server}/${copy.base.deck}`;
|
|
1133
1178
|
out.result(
|
|
1134
1179
|
{ ...result, url },
|
|
1135
1180
|
() => [
|
|
1136
|
-
result.pushed ? `\u2713 Pushed ${result.rev?.slice(0, 7)}${result.uploaded.length ? ` with ${plural(result.uploaded.length, "media file")}` : ""}. Live at ${url}` : result.page.length ? `Nothing to push, but the deck
|
|
1181
|
+
result.pushed ? `\u2713 Pushed ${result.rev?.slice(0, 7)}${result.uploaded.length ? ` with ${plural(result.uploaded.length, "media file")}` : ""}. Live at ${url}` : result.page.length ? `Nothing to push, but the deck changed since this copy's version: run \`tobos pull\`. Live at ${url}` : `Nothing to push: the copy has no changes of its own. Live at ${url}`,
|
|
1137
1182
|
saidPage(result.page)
|
|
1138
1183
|
].filter(Boolean).join("\n")
|
|
1139
1184
|
);
|
|
@@ -1144,6 +1189,119 @@ async function pushIfChanged(out, id, message) {
|
|
|
1144
1189
|
const { pushed, uploaded } = await pushCopy(out, found, message);
|
|
1145
1190
|
return { pushed, uploaded };
|
|
1146
1191
|
}
|
|
1192
|
+
function saidOutline(outline2) {
|
|
1193
|
+
let n = 0;
|
|
1194
|
+
const width = Math.max(0, ...outline2.chapters.flatMap((c) => c.scenes.map((s) => s.id.length)));
|
|
1195
|
+
return [
|
|
1196
|
+
`${outline2.title} (outline version ${outline2.version})`,
|
|
1197
|
+
...outline2.chapters.flatMap((c) => [
|
|
1198
|
+
` ${c.title} [${c.id}]`,
|
|
1199
|
+
...c.scenes.length ? [] : [" (no scenes)"],
|
|
1200
|
+
...c.scenes.map(
|
|
1201
|
+
(s) => ` ${String(++n).padStart(3)} ${s.id.padEnd(width)} ${s.title}${s.hidden ? " (hidden)" : ""}`
|
|
1202
|
+
)
|
|
1203
|
+
]),
|
|
1204
|
+
outline2.unplaced.length ? `Not placed, so not shown (\`tobos outline place <scene>\`): ${outline2.unplaced.join(", ")}` : ""
|
|
1205
|
+
].filter(Boolean).join("\n");
|
|
1206
|
+
}
|
|
1207
|
+
function placeFrom(args) {
|
|
1208
|
+
const { after, before, chapter, start } = args.values;
|
|
1209
|
+
const given = [after, before, chapter].filter((v) => typeof v === "string");
|
|
1210
|
+
if (given.length > 1)
|
|
1211
|
+
throw new CliError("Say where with one of --after <scene>, --before <scene>, --chapter <id>.");
|
|
1212
|
+
if (typeof after === "string") return { after };
|
|
1213
|
+
if (typeof before === "string") return { before };
|
|
1214
|
+
if (typeof chapter === "string") return { chapter, at: start ? "start" : "end" };
|
|
1215
|
+
return void 0;
|
|
1216
|
+
}
|
|
1217
|
+
function opsFrom(args) {
|
|
1218
|
+
const [what, ...rest] = args.positionals;
|
|
1219
|
+
const need = (count, usage) => {
|
|
1220
|
+
if (rest.length < count) throw new CliError(`\`tobos outline ${usage}\`.`);
|
|
1221
|
+
};
|
|
1222
|
+
const title = typeof args.values.title === "string" ? args.values.title : void 0;
|
|
1223
|
+
switch (what) {
|
|
1224
|
+
case "place":
|
|
1225
|
+
need(
|
|
1226
|
+
1,
|
|
1227
|
+
'place <scene> [--after s | --before s | --chapter c [--start]] [--title "T"] [--hidden]'
|
|
1228
|
+
);
|
|
1229
|
+
return rest.map((scene, i) => ({
|
|
1230
|
+
op: "place",
|
|
1231
|
+
scene,
|
|
1232
|
+
...title && rest.length === 1 ? { title } : {},
|
|
1233
|
+
...args.values.hidden ? { hidden: true } : {},
|
|
1234
|
+
to: i === 0 ? placeFrom(args) : { after: rest[i - 1] }
|
|
1235
|
+
}));
|
|
1236
|
+
case "move":
|
|
1237
|
+
need(1, "move <scene>\u2026 (--after s | --before s | --chapter c [--start])");
|
|
1238
|
+
return [{ op: "move", scenes: rest, to: placeFrom(args) }];
|
|
1239
|
+
case "hide":
|
|
1240
|
+
case "show":
|
|
1241
|
+
need(1, `${what} <scene>\u2026`);
|
|
1242
|
+
return [{ op: "hide", scenes: rest, hidden: what === "hide" }];
|
|
1243
|
+
case "rename":
|
|
1244
|
+
need(2, 'rename <scene> "Title"');
|
|
1245
|
+
return [{ op: "rename", scene: rest[0], title: rest.slice(1).join(" ") }];
|
|
1246
|
+
case "remove":
|
|
1247
|
+
need(1, "remove <scene>\u2026");
|
|
1248
|
+
return [{ op: "remove", scenes: rest }];
|
|
1249
|
+
case "title":
|
|
1250
|
+
need(1, `title "The deck's title"`);
|
|
1251
|
+
return [{ op: "title", title: rest.join(" ") }];
|
|
1252
|
+
case "chapter": {
|
|
1253
|
+
const [verb, id, ...words] = rest;
|
|
1254
|
+
const before = typeof args.values.before === "string" ? args.values.before : null;
|
|
1255
|
+
if (verb === "add" && id && words.length)
|
|
1256
|
+
return [{ op: "addChapter", chapter: id, title: words.join(" "), before }];
|
|
1257
|
+
if (verb === "rename" && id && words.length)
|
|
1258
|
+
return [{ op: "renameChapter", chapter: id, title: words.join(" ") }];
|
|
1259
|
+
if (verb === "move" && id) return [{ op: "moveChapter", chapter: id, before }];
|
|
1260
|
+
if (verb === "remove" && id) return [{ op: "removeChapter", chapter: id }];
|
|
1261
|
+
throw new CliError(
|
|
1262
|
+
'`tobos outline chapter add <id> "Title" [--before c]`, `chapter rename <id> "Title"`, `chapter move <id> [--before c]` (last without), or `chapter remove <id>` (an empty one).'
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
default:
|
|
1266
|
+
throw new CliError(
|
|
1267
|
+
`No \`tobos outline ${what}\`: place, move, hide, show, rename, remove, title or chapter. \`tobos help\` shows each.`
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
async function outline(out, args) {
|
|
1272
|
+
const id = await deckId(args);
|
|
1273
|
+
const server = findCopy()?.base?.server ?? settings().server;
|
|
1274
|
+
let read2;
|
|
1275
|
+
const now = async () => read2 ??= await api(`/api/decks/${id}/outline`, { server });
|
|
1276
|
+
if (args.positionals.length === 0) {
|
|
1277
|
+
const shown = await now();
|
|
1278
|
+
out.result({ ...shown }, () => saidOutline(shown));
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1281
|
+
const ops = opsFrom(args);
|
|
1282
|
+
for (const op of ops) {
|
|
1283
|
+
if (!("to" in op) || op.to !== void 0) continue;
|
|
1284
|
+
const last = (await now()).chapters.at(-1);
|
|
1285
|
+
if (!last)
|
|
1286
|
+
throw new CliError(
|
|
1287
|
+
'The outline has no chapter: `tobos outline chapter add <id> "Title"` makes one.'
|
|
1288
|
+
);
|
|
1289
|
+
op.to = { chapter: last.id, at: "end" };
|
|
1290
|
+
}
|
|
1291
|
+
const written = await api(`/api/decks/${id}/files`, {
|
|
1292
|
+
server,
|
|
1293
|
+
body: { outline: ops }
|
|
1294
|
+
}).catch((error) => {
|
|
1295
|
+
if (error instanceof CliError && error.extra.status === 409)
|
|
1296
|
+
throw new CliError(error.message, EXIT.conflict, error.extra);
|
|
1297
|
+
throw error;
|
|
1298
|
+
});
|
|
1299
|
+
const after = await api(`/api/decks/${id}/outline`, { server });
|
|
1300
|
+
const copy = findCopy();
|
|
1301
|
+
if (copy?.base?.deck === id && copy.base.outline === written.outline.version - 1)
|
|
1302
|
+
keepOutlineVersion(copy.root, written.outline.version);
|
|
1303
|
+
out.result({ ...after }, () => saidOutline(after));
|
|
1304
|
+
}
|
|
1147
1305
|
async function renderView(id) {
|
|
1148
1306
|
return api(`/api/decks/${id}/view`, { body: { view: "render" } });
|
|
1149
1307
|
}
|
|
@@ -1167,7 +1325,7 @@ async function openApp(out) {
|
|
|
1167
1325
|
out.result({ url, opened }, () => url);
|
|
1168
1326
|
}
|
|
1169
1327
|
async function render(out, args) {
|
|
1170
|
-
const { renderBeats } = await import("./render-
|
|
1328
|
+
const { renderBeats } = await import("./render-EGSI4MIU.js");
|
|
1171
1329
|
const copy = findCopy();
|
|
1172
1330
|
const deck = copy?.base ? { id: copy.base.deck, root: copy.root } : void 0;
|
|
1173
1331
|
const id = typeof args.values.deck === "string" ? parseId(args.values.deck) : deck?.id;
|
|
@@ -1184,7 +1342,10 @@ async function render(out, args) {
|
|
|
1184
1342
|
for (const ref of wanted) {
|
|
1185
1343
|
const [sceneId, beat] = ref.split("/");
|
|
1186
1344
|
const scene = scenes.find((s) => s.id === sceneId);
|
|
1187
|
-
if (!scene)
|
|
1345
|
+
if (!scene)
|
|
1346
|
+
throw new CliError(
|
|
1347
|
+
`No scene "${sceneId}" in the outline: \`tobos outline\` shows it, and places a scene.`
|
|
1348
|
+
);
|
|
1188
1349
|
if (beat) {
|
|
1189
1350
|
const id2 = /^\d+$/.test(beat) ? scene.beats[Number(beat)] : beat;
|
|
1190
1351
|
if (!id2 || !scene.beats.includes(id2))
|
|
@@ -1257,6 +1418,20 @@ The five verbs (a deck by its id, or its title to mv it; a folder by its path; i
|
|
|
1257
1418
|
with no git: the server keeps the versions)
|
|
1258
1419
|
${VERB_ROWS}
|
|
1259
1420
|
|
|
1421
|
+
The outline's operations (its chapters and scenes in order, their titles and whether they show:
|
|
1422
|
+
Tobos holds it, no file of the copy; each change is live at once, with no push; a scene by its
|
|
1423
|
+
file's name, scenes/<scene>.svelte, which shows nowhere until it is placed)
|
|
1424
|
+
tobos outline place <scene>\u2026 into the outline: --after <scene>, --before <scene>,
|
|
1425
|
+
[--title "T"] [--hidden] --chapter <id> [--start], or at the end
|
|
1426
|
+
tobos outline move <scene>\u2026 (where) where as for place
|
|
1427
|
+
tobos outline hide | show <scene>\u2026 left out of presenting, the link and the PDF, or not
|
|
1428
|
+
tobos outline rename <scene> "Title" the title the deck's page and Agenda show
|
|
1429
|
+
tobos outline remove <scene>\u2026 out of the outline; its file stays
|
|
1430
|
+
tobos outline title "Title" the deck's title
|
|
1431
|
+
tobos outline chapter add <id> "Title" a chapter, [--before <id>], or last
|
|
1432
|
+
tobos outline chapter rename|move|remove a chapter's title; its place [--before <id>]; an
|
|
1433
|
+
empty one, out
|
|
1434
|
+
|
|
1260
1435
|
Looking at it (from the working copy, render and open push what changed first; with --deck <id>,
|
|
1261
1436
|
from anywhere)
|
|
1262
1437
|
tobos render scene/beat | scene | --all PNGs of beats, for you to look at
|
|
@@ -1297,6 +1472,18 @@ var TABLE = {
|
|
|
1297
1472
|
},
|
|
1298
1473
|
mv: { run: mv },
|
|
1299
1474
|
pull: { run: pull },
|
|
1475
|
+
outline: {
|
|
1476
|
+
run: outline,
|
|
1477
|
+
options: {
|
|
1478
|
+
deck: { type: "string" },
|
|
1479
|
+
after: { type: "string" },
|
|
1480
|
+
before: { type: "string" },
|
|
1481
|
+
chapter: { type: "string" },
|
|
1482
|
+
start: { type: "boolean" },
|
|
1483
|
+
title: { type: "string" },
|
|
1484
|
+
hidden: { type: "boolean" }
|
|
1485
|
+
}
|
|
1486
|
+
},
|
|
1300
1487
|
check: { run: check, options: { types: { type: "boolean" } } },
|
|
1301
1488
|
push: { run: push, options: { message: { type: "string", short: "m" } } },
|
|
1302
1489
|
open: {
|
|
@@ -3,7 +3,7 @@ import { createRequire as __tobosRequire } from 'node:module';
|
|
|
3
3
|
const require = __tobosRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
parseDeckJson
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-U44FVSIH.js";
|
|
7
7
|
import {
|
|
8
8
|
CliError,
|
|
9
9
|
__commonJS,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
init_define_TOBOS_PRESENT_TYPES,
|
|
15
15
|
init_define_TOBOS_SKILL,
|
|
16
16
|
init_define_TOBOS_TOOLCHAIN
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-G2X34YQC.js";
|
|
18
18
|
|
|
19
19
|
// ../node_modules/.pnpm/aria-query@5.3.1/node_modules/aria-query/lib/util/iteratorProxy.js
|
|
20
20
|
var require_iteratorProxy = __commonJS({
|
|
@@ -27278,15 +27278,17 @@ init_define_TOBOS_TOOLCHAIN();
|
|
|
27278
27278
|
init_define_TOBOS_PRESENT_TYPES();
|
|
27279
27279
|
init_define_TOBOS_SKILL();
|
|
27280
27280
|
init_define_TOBOS_TOOLCHAIN();
|
|
27281
|
-
var DECK_PREFIX = "@deck/";
|
|
27282
|
-
var MASTER_PREFIX = `${DECK_PREFIX}master/`;
|
|
27283
27281
|
|
|
27284
|
-
// ../deck/src/
|
|
27282
|
+
// ../deck/src/outline.ts
|
|
27285
27283
|
init_define_TOBOS_PRESENT_TYPES();
|
|
27286
27284
|
init_define_TOBOS_SKILL();
|
|
27287
27285
|
init_define_TOBOS_TOOLCHAIN();
|
|
27288
27286
|
|
|
27289
|
-
// ../deck/src/
|
|
27287
|
+
// ../deck/src/share.ts
|
|
27288
|
+
var DECK_PREFIX = "@deck/";
|
|
27289
|
+
var MASTER_PREFIX = `${DECK_PREFIX}master/`;
|
|
27290
|
+
|
|
27291
|
+
// ../deck/src/strip-types.ts
|
|
27290
27292
|
init_define_TOBOS_PRESENT_TYPES();
|
|
27291
27293
|
init_define_TOBOS_SKILL();
|
|
27292
27294
|
init_define_TOBOS_TOOLCHAIN();
|