@tobos/cli 0.4.5 → 0.4.7
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.
- package/dist/tobos.js +466 -69
- package/package.json +1 -1
package/dist/tobos.js
CHANGED
|
@@ -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": "/** State the viewer sets up before any scene loads, and the scene API reads. */\nexport declare function setMedia(media: Record<string, {\n hash: string;\n}>): void;\nexport declare function mediaUrl(name: 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 * 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 constructor(root: Element, beats: readonly Beat[]);\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 /** Show a beat: play the animation into it, or land on its end state. */\n show(beat: number, animate: 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", "video.d.ts": "export interface PlayVideoOptions {\n /** Where the clip starts in the video, in seconds. Default 0. */\n from?: number;\n /** Where the clip ends in the video, in seconds. Default: the end of the video. */\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}\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 is muted, plays inline and preloads. Several videos (`q('video')` finding more\n * 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 * Wait until the videos inside `root` know their length, so `playVideo` can size their clips\n * when the scene's timeline is built. Videos that won't load (no source, `preload=\"none\"`, an\n * error) don't hold it up, nor does anything past `timeout`.\n */\nexport declare function videosKnowTheirLength(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 * and a frame decoded. Videos that won't load don't hold it up.\n */\nexport declare function videoFramesReady(root: Element): Promise<void>;\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}\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 poll: each phone picks one option. Its result shows on the projector 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/** A form: 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 * Something the room responds to on their phones, declared by a scene. It is open while the\n * 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 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/** What the viewer needs to show one revision of a deck. */\nexport interface Manifest {\n format: 1;\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/** 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 show 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 show, 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", "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 { Manifest } from '@tobos/deck/types';\nimport type { Results } from './activities.ts';\n/** One activity's responses in the current show. */\nexport interface Responses {\n /** People whose phones opened the deck's join link during this show. */\n readonly joined: number;\n /** People who have answered this activity during this show. */\n readonly answered: number;\n /** A poll's responses per option, in the order the scene declares them. A form's is 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: Manifest): void;\n/** The current show'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 show: 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 server's results stream (server-sent events) until the returned function is called. */\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": "/** State the viewer sets up before any scene loads, and the scene API reads. */\nexport declare function setMedia(media: Record<string, {\n hash: string;\n}>): void;\nexport declare function mediaUrl(name: 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 * 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 constructor(root: Element, beats: readonly Beat[]);\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 /** Show a beat: play the animation into it, or land on its end state. */\n show(beat: number, animate: 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", "video.d.ts": "export interface PlayVideoOptions {\n /** Where the clip starts in the video, in seconds. Default 0. */\n from?: number;\n /** Where the clip ends in the video, in seconds. Default: the end of the video. */\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}\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 is muted, plays inline and preloads. Several videos (`q('video')` finding more\n * 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 * Wait until the videos inside `root` know their length, so `playVideo` can size their clips\n * when the scene's timeline is built. Videos that won't load (no source, `preload=\"none\"`, an\n * error) don't hold it up, nor does anything past `timeout`.\n */\nexport declare function videosKnowTheirLength(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 * and a frame decoded. Videos that won't load don't hold it up.\n */\nexport declare function videoFramesReady(root: Element): Promise<void>;\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}\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 poll: each phone picks one option. Its result shows on the projector 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/** A form: 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 * Something the room responds to on their phones, declared by a scene. It is open while the\n * 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 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/** What the viewer needs to show one revision of a deck. */\nexport interface Manifest {\n format: 1;\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 * (share.ts). Not in a manifest pushed before the build recorded it, which sharedManifest()\n * shares as it did then.\n */\n uses?: Uses;\n}\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 its media() calls name; and their patterns (`frames/*.png`), which a share\n * matches against media.json, so a pattern is here once, not as every name it matches. Each is\n * 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 show 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 show, 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", "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 { Manifest } from '@tobos/deck/types';\nimport type { Results } from './activities.ts';\n/** One activity's responses in the current show. */\nexport interface Responses {\n /** People whose phones opened the deck's join link during this show. */\n readonly joined: number;\n /** People who have answered this activity during this show. */\n readonly answered: number;\n /** A poll's responses per option, in the order the scene declares them. A form's is 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: Manifest): void;\n/** The current show'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 show: 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 server's results stream (server-sent events) until the returned function is called. */\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 { playVideo, type PlayVideoOptions } from './video.ts';
|
|
53
53
|
export { useResponses, type Responses } from './responses.svelte.ts';
|
|
@@ -116,7 +116,7 @@ export declare const JoinCode: Component<JoinCodeProps>;
|
|
|
116
116
|
var define_TOBOS_SKILL_default;
|
|
117
117
|
var init_define_TOBOS_SKILL = __esm({
|
|
118
118
|
"<define:TOBOS_SKILL>"() {
|
|
119
|
-
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 that you write as code: one Svelte 5 file per scene, with beats (one click each) and GSAP animations. You build; Tobos checks every push, hosts the deck, and puts it on stage with a presenter view. There is no AI on Tobos's side and no MCP server: everything goes through the `tobos` command and git.\n\n## Set up (once per machine)\n\n```sh\nnpm i -g @tobos/cli # the `tobos` command; needs Node 22.18+ and git\ntobos login you@example.com # e-mails the person a 6-digit code (and signs them up if new)\ntobos login --code 123456 # the code they paste to you from the mail\n```\n\nAsk the person for their e-mail address first, then for the code in one line: it's in their e-mail, maybe in spam, and using it accepts https://tobos.ai/terms. Only they can read it; never guess or reuse one. It works for 10 minutes. In CI or a sandbox with no login, set `TOBOS_TOKEN` to the token `tobos login` stored (and `TOBOS_SERVER`, if not tobos.ai) instead.\n\n## Start or continue a deck\n\n```sh\ntobos decks # the decks you can work on, by id\ntobos new \"Title of the talk\" # create one and clone it into ./<id>\ntobos clone <id> # or clone an existing one\ntobos pull # in a clone: the latest pushes and format guide\n```\n\nThen **read the deck's `AGENTS.md`**. It, `.tobos/FORMAT.md` and `master/GUIDE.md` are the instructions for everything that follows: the loop (`check` \u2192 `render` \u2192 look \u2192 `push`), the format, the slide master's layouts and rules.\n\n## Follow the person\n\nThey decide what to make and how much you do: some build a deck one scene at a time, some want all of it at once. Do what they ask, at the size they ask. Don't ask what a talk is about, who it's for or how long it runs, and don't propose an outline they didn't ask for.\n\n## Polls and forms\n\nA scene can ask the room a poll or a short form, which people answer on their phones through the deck's join code: `<JoinCode/>` shows its QR code, and the poll's result shows on the projector at a beat you choose. See \"Activities\" in the deck's `.tobos/FORMAT.md`. The responses download from the deck's page as a CSV per show (one class or talk): a row per phone, a column per question.\n\n## The story\n\nA deck has one story: the talk as the speaker tells it, paragraph by paragraph, with scenes mentioned as Markdown links, `[Dartmouth College](scene:same-problem)`, or one of their beats, `[Dartmouth College](scene:same-problem/quote)` (the ids from deck.json; the label is the scene's title). What follows a mention, up to the next, is that scene's: the deck's page shows it under the stage, and the presenter sees it as speaker notes. The server holds it, not git, so there is no file to edit: the person types in it live on the deck's page, and you change it with `tobos story`, which reads and writes it on the server.\n\n- `tobos story` prints it with a \xB6 id per paragraph (`p4`). Read it again before each change: the person may be typing.\n- Your changes apply at once, as the person's do, and the deck's page marks what you wrote. Change what the person asked you to, and leave the rest of their words as they are.\n- An edit is anchored on the exact text it replaces, which has to occur once in the paragraph. If someone changed it meanwhile, the command exits with code 4 and the paragraph as it is now: anchor on that and try again.\n- Set `TOBOS_AGENT` to your name (`claude`, `codex`): the page shows who wrote what.\n\n## Commands\n\n| Command | Does |\n| -------------------------------------------------------- | -------------------------------------------------------------- |\n| `tobos check` \xB7 `--types` | compile and check the deck, offline; `--types`: TypeScript too |\n| `tobos push -m \"\u2026\"` | upload media, commit, push; the server checks it again |\n| `tobos render scene/beat` \xB7 `scene` \xB7 `--all` \xB7 `--film` | PNGs of beats; pushes what changed first |\n| `tobos open [scene/beat] [--presenter]` | the deck in a browser; pushes what changed first |\n| `tobos open` (outside a deck) | Tobos in the browser, logged in: decks and templates |\n| `tobos export pdf` | a PDF of every beat |\n| `tobos story` | the story, by \xB6 id |\n| `tobos story edit <\xB6> \"old\" \"new\"` | change it, anchored on the exact text |\n| `tobos story add [--after <\xB6>] \"\u2026\"` \xB7 `delete <\xB6>` | add a paragraph, or delete one |\n| `tobos new \"Title\" --from <id>` | a deck from that template (default: the person's own) |\n| `tobos new \"Our brand\" --template` | a new template: a copy of the default, or of `--from` |\n| `tobos whoami` \xB7 `tobos logout` | who is logged in, on which server; or log this machine out |\n| `tobos skill install` | this skill, where the person's harnesses read skills |\n| `tobos people` | who is on the deck, and what each may do |\n| `tobos invite <email> --can edit` \xB7 `present` \xB7 `view` | put someone on the deck; they get a mail |\n| `tobos uninvite <email>` | take them off; their access ends at once |\n\nInvite only whom the person names, at the level they say: the mail goes to someone else, from the person's name. Can edit builds the deck with their own agent; can present presents it with its notes and polls; can view sees the slides only.\n\nEvery command takes `--json`. Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in, 4 the story changed meanwhile.\n\nWhen a command says a newer `tobos` is out, run `npm i -g @tobos/cli`; the next command updates this skill
|
|
119
|
+
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 that you write as code: one Svelte 5 file per scene, with beats (one click each) and GSAP animations. You build; Tobos checks every push, hosts the deck, and puts it on stage with a presenter view. There is no AI on Tobos's side and no MCP server: everything goes through the `tobos` command and git.\n\n## Set up (once per machine)\n\n```sh\nnpm i -g @tobos/cli # the `tobos` command; needs Node 22.18+ and git\ntobos login you@example.com # e-mails the person a 6-digit code (and signs them up if new)\ntobos login --code 123456 # the code they paste to you from the mail\n```\n\nAsk the person for their e-mail address first, then for the code in one line: it's in their e-mail, maybe in spam, and using it accepts https://tobos.ai/terms. Only they can read it; never guess or reuse one. It works for 10 minutes. In CI or a sandbox with no login, set `TOBOS_TOKEN` to the token `tobos login` stored (and `TOBOS_SERVER`, if not tobos.ai) instead.\n\n## Start or continue a deck\n\n```sh\ntobos decks # the decks you can work on, by id\ntobos new \"Title of the talk\" # create one and clone it into ./<id>\ntobos clone <id> # or clone an existing one\ntobos pull # in a clone: the latest pushes and format guide\n```\n\nThen **read the deck's `AGENTS.md`**. It, `.tobos/FORMAT.md` and `master/GUIDE.md` are the instructions for everything that follows: the loop (`check` \u2192 `render` \u2192 look \u2192 `push`), the format, the slide master's layouts and rules.\n\n## Follow the person\n\nThey decide what to make and how much you do: some build a deck one scene at a time, some want all of it at once. Do what they ask, at the size they ask. Don't ask what a talk is about, who it's for or how long it runs, and don't propose an outline they didn't ask for.\n\n## Polls and forms\n\nA scene can ask the room a poll or a short form, which people answer on their phones through the deck's join code: `<JoinCode/>` shows its QR code, and the poll's result shows on the projector at a beat you choose. See \"Activities\" in the deck's `.tobos/FORMAT.md`. The responses download from the deck's page as a CSV per show (one class or talk): a row per phone, a column per question.\n\n## The story\n\nA deck has one story: the talk as the speaker tells it, paragraph by paragraph, with scenes mentioned as Markdown links, `[Dartmouth College](scene:same-problem)`, or one of their beats, `[Dartmouth College](scene:same-problem/quote)` (the ids from deck.json; the label is the scene's title). What follows a mention, up to the next, is that scene's: the deck's page shows it under the stage, and the presenter sees it as speaker notes. The server holds it, not git, so there is no file to edit: the person types in it live on the deck's page, and you change it with `tobos story`, which reads and writes it on the server.\n\n- `tobos story` prints it with a \xB6 id per paragraph (`p4`). Read it again before each change: the person may be typing.\n- Your changes apply at once, as the person's do, and the deck's page marks what you wrote. Change what the person asked you to, and leave the rest of their words as they are.\n- An edit is anchored on the exact text it replaces, which has to occur once in the paragraph. If someone changed it meanwhile, the command exits with code 4 and the paragraph as it is now: anchor on that and try again.\n- Set `TOBOS_AGENT` to your name (`claude`, `codex`): the page shows who wrote what.\n\n## Commands\n\n| Command | Does |\n| -------------------------------------------------------- | -------------------------------------------------------------- |\n| `tobos check` \xB7 `--types` | compile and check the deck, offline; `--types`: TypeScript too |\n| `tobos push -m \"\u2026\"` | upload media, commit, push; the server checks it again |\n| `tobos render scene/beat` \xB7 `scene` \xB7 `--all` \xB7 `--film` | PNGs of beats; pushes what changed first |\n| `tobos open [scene/beat] [--presenter]` | the deck in a browser; pushes what changed first |\n| `tobos open` (outside a deck) | Tobos in the browser, logged in: decks and templates |\n| `tobos export pdf` | a PDF of every beat |\n| `tobos story` | the story, by \xB6 id |\n| `tobos story edit <\xB6> \"old\" \"new\"` | change it, anchored on the exact text |\n| `tobos story add [--after <\xB6>] \"\u2026\"` \xB7 `delete <\xB6>` | add a paragraph, or delete one |\n| `tobos new \"Title\" --from <id>` | a deck from that template (default: the person's own) |\n| `tobos new \"Our brand\" --template` | a new template: a copy of the default, or of `--from` |\n| `tobos whoami` \xB7 `tobos logout` | who is logged in, on which server; or log this machine out |\n| `tobos skill install` | this skill, where the person's harnesses read skills |\n| `tobos people` | who is on the deck, and what each may do |\n| `tobos invite <email> --can edit` \xB7 `present` \xB7 `view` | put someone on the deck; they get a mail |\n| `tobos uninvite <email>` | take them off; their access ends at once |\n\nInvite only whom the person names, at the level they say: the mail goes to someone else, from the person's name. Can edit builds the deck with their own agent; can present presents it with its notes and polls; can view sees the slides only.\n\nEvery command takes `--json`. Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in, 4 the story changed meanwhile, 5 a plan's limit or an archived deck.\n\nWhen a command says a newer `tobos` is out, run `npm i -g @tobos/cli`; the next command updates this skill.\n\nExit code 5 means the person decides what happens next: a plan's limit (Free keeps 3 decks open at a time, and lets 1 person besides the owner edit them), or an archived deck. Show them the message, which says what they can do (archive a deck on its page to make room, open one again, or buy Pro; or, on someone else's deck, ask its owner), and wait for their answer. Don't work around it: no deck built outside Tobos to upload later, no media shrunk or hosted elsewhere, no one else's account. An archived deck can still be cloned, read and shared, but takes no pushes and can't be presented.\n" };
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
|
|
@@ -150,14 +150,15 @@ function createOutput(json) {
|
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
var EXIT, CliError, update;
|
|
153
|
+
var EXIT, ASK_THE_PERSON, CliError, update;
|
|
154
154
|
var init_out = __esm({
|
|
155
155
|
"src/out.ts"() {
|
|
156
156
|
"use strict";
|
|
157
157
|
init_define_TOBOS_PRESENT_TYPES();
|
|
158
158
|
init_define_TOBOS_SKILL();
|
|
159
159
|
init_define_TOBOS_TOOLCHAIN();
|
|
160
|
-
EXIT = { ok: 0, error: 1, problems: 2, auth: 3, conflict: 4 };
|
|
160
|
+
EXIT = { ok: 0, error: 1, problems: 2, auth: 3, conflict: 4, limit: 5 };
|
|
161
|
+
ASK_THE_PERSON = "This is for the person you work for to decide: show them the above, and wait for their answer. Don\u2019t work around it, for instance by building the deck outside Tobos.";
|
|
161
162
|
CliError = class extends Error {
|
|
162
163
|
exit;
|
|
163
164
|
extra;
|
|
@@ -46370,14 +46371,14 @@ function clean_nodes(parent, nodes, path, namespace = "html", state, preserve_wh
|
|
|
46370
46371
|
if (!state.analysis.runes) {
|
|
46371
46372
|
nodes = sort_const_tags(nodes, state);
|
|
46372
46373
|
}
|
|
46373
|
-
const
|
|
46374
|
+
const hoisted2 = [];
|
|
46374
46375
|
const regular = [];
|
|
46375
46376
|
for (const node of nodes) {
|
|
46376
46377
|
if (node.type === "Comment" && !preserve_comments) {
|
|
46377
46378
|
continue;
|
|
46378
46379
|
}
|
|
46379
46380
|
if (node.type === "ConstTag" || node.type === "DeclarationTag" || node.type === "DebugTag" || node.type === "SvelteBody" || node.type === "SvelteWindow" || node.type === "SvelteDocument" || node.type === "SvelteHead" || node.type === "TitleElement" || node.type === "SnippetBlock") {
|
|
46380
|
-
|
|
46381
|
+
hoisted2.push(node);
|
|
46381
46382
|
} else {
|
|
46382
46383
|
regular.push(node);
|
|
46383
46384
|
}
|
|
@@ -46446,7 +46447,7 @@ function clean_nodes(parent, nodes, path, namespace = "html", state, preserve_wh
|
|
|
46446
46447
|
});
|
|
46447
46448
|
}
|
|
46448
46449
|
return {
|
|
46449
|
-
hoisted,
|
|
46450
|
+
hoisted: hoisted2,
|
|
46450
46451
|
trimmed,
|
|
46451
46452
|
/**
|
|
46452
46453
|
* In a case like `{#if x}<Foo />{/if}`, we don't need to wrap the child in
|
|
@@ -47191,7 +47192,7 @@ var init_ExpressionStatement2 = __esm({
|
|
|
47191
47192
|
function Fragment2(node, context) {
|
|
47192
47193
|
const parent = context.path.at(-1) ?? node;
|
|
47193
47194
|
const namespace = infer_namespace(context.state.namespace, parent, node.nodes);
|
|
47194
|
-
const { hoisted, trimmed, is_standalone, is_text_first } = clean_nodes(
|
|
47195
|
+
const { hoisted: hoisted2, trimmed, is_standalone, is_text_first } = clean_nodes(
|
|
47195
47196
|
parent,
|
|
47196
47197
|
node.nodes,
|
|
47197
47198
|
context.path,
|
|
@@ -47208,7 +47209,7 @@ function Fragment2(node, context) {
|
|
|
47208
47209
|
is_standalone,
|
|
47209
47210
|
async_consts: void 0
|
|
47210
47211
|
};
|
|
47211
|
-
for (const node2 of
|
|
47212
|
+
for (const node2 of hoisted2) {
|
|
47212
47213
|
context.visit(node2, state);
|
|
47213
47214
|
}
|
|
47214
47215
|
if (is_text_first) {
|
|
@@ -47998,7 +47999,7 @@ function RegularElement2(node, context) {
|
|
|
47998
47999
|
);
|
|
47999
48000
|
return;
|
|
48000
48001
|
}
|
|
48001
|
-
const { hoisted, trimmed } = clean_nodes(
|
|
48002
|
+
const { hoisted: hoisted2, trimmed } = clean_nodes(
|
|
48002
48003
|
node,
|
|
48003
48004
|
node.fragment.nodes,
|
|
48004
48005
|
context.path,
|
|
@@ -48007,7 +48008,7 @@ function RegularElement2(node, context) {
|
|
|
48007
48008
|
state.preserve_whitespace,
|
|
48008
48009
|
state.options.preserveComments
|
|
48009
48010
|
);
|
|
48010
|
-
for (const node2 of
|
|
48011
|
+
for (const node2 of hoisted2) {
|
|
48011
48012
|
context.visit(node2, state);
|
|
48012
48013
|
}
|
|
48013
48014
|
if (dev) {
|
|
@@ -50795,7 +50796,7 @@ function RegularElement3(node, context) {
|
|
|
50795
50796
|
transform: get_transform(scope, context.state),
|
|
50796
50797
|
preserve_whitespace: context.state.preserve_whitespace || name === "pre" || name === "textarea"
|
|
50797
50798
|
};
|
|
50798
|
-
const { hoisted, trimmed } = clean_nodes(
|
|
50799
|
+
const { hoisted: hoisted2, trimmed } = clean_nodes(
|
|
50799
50800
|
node,
|
|
50800
50801
|
node.fragment.nodes,
|
|
50801
50802
|
context.path,
|
|
@@ -50815,7 +50816,7 @@ function RegularElement3(node, context) {
|
|
|
50815
50816
|
async_consts: has_declarations ? void 0 : state.async_consts,
|
|
50816
50817
|
memoizer: has_declarations ? new Memoizer() : state.memoizer
|
|
50817
50818
|
};
|
|
50818
|
-
for (const node2 of
|
|
50819
|
+
for (const node2 of hoisted2) {
|
|
50819
50820
|
context.visit(node2, child_state);
|
|
50820
50821
|
}
|
|
50821
50822
|
const use_text_content = trimmed.every((node2) => node2.type === "Text" || node2.type === "ExpressionTag") && trimmed.every(
|
|
@@ -52757,7 +52758,7 @@ var init_ForOfStatement = __esm({
|
|
|
52757
52758
|
function Fragment3(node, context) {
|
|
52758
52759
|
const parent = context.path.at(-1) ?? node;
|
|
52759
52760
|
const namespace = infer_namespace(context.state.metadata.namespace, parent, node.nodes);
|
|
52760
|
-
const { hoisted, trimmed, is_standalone, is_text_first } = clean_nodes(
|
|
52761
|
+
const { hoisted: hoisted2, trimmed, is_standalone, is_text_first } = clean_nodes(
|
|
52761
52762
|
parent,
|
|
52762
52763
|
node.nodes,
|
|
52763
52764
|
context.path,
|
|
@@ -52766,7 +52767,7 @@ function Fragment3(node, context) {
|
|
|
52766
52767
|
context.state.preserve_whitespace,
|
|
52767
52768
|
context.state.options.preserveComments
|
|
52768
52769
|
);
|
|
52769
|
-
if (
|
|
52770
|
+
if (hoisted2.length === 0 && trimmed.length === 0) {
|
|
52770
52771
|
return block([]);
|
|
52771
52772
|
}
|
|
52772
52773
|
const is_single_element = trimmed.length === 1 && trimmed[0].type === "RegularElement";
|
|
@@ -52792,7 +52793,7 @@ function Fragment3(node, context) {
|
|
|
52792
52793
|
},
|
|
52793
52794
|
async_consts: void 0
|
|
52794
52795
|
};
|
|
52795
|
-
for (const node2 of
|
|
52796
|
+
for (const node2 of hoisted2) {
|
|
52796
52797
|
context.visit(node2, state);
|
|
52797
52798
|
}
|
|
52798
52799
|
if (is_single_element) {
|
|
@@ -53920,7 +53921,7 @@ function SvelteBoundary3(node, context) {
|
|
|
53920
53921
|
}
|
|
53921
53922
|
const nodes = [];
|
|
53922
53923
|
const const_tags = [];
|
|
53923
|
-
const
|
|
53924
|
+
const hoisted2 = [];
|
|
53924
53925
|
let has_const = false;
|
|
53925
53926
|
let has_declaration = false;
|
|
53926
53927
|
for (const child of node.fragment.nodes) {
|
|
@@ -53967,7 +53968,7 @@ function SvelteBoundary3(node, context) {
|
|
|
53967
53968
|
if (["failed", "pending"].includes(child.expression.name)) {
|
|
53968
53969
|
props.properties.push(prop("init", child.expression, child.expression));
|
|
53969
53970
|
}
|
|
53970
|
-
|
|
53971
|
+
hoisted2.push(snippet);
|
|
53971
53972
|
}
|
|
53972
53973
|
continue;
|
|
53973
53974
|
}
|
|
@@ -53988,7 +53989,7 @@ function SvelteBoundary3(node, context) {
|
|
|
53988
53989
|
call("$.boundary", context.state.node, props, arrow([id("$$anchor")], block2))
|
|
53989
53990
|
);
|
|
53990
53991
|
context.state.template.push_comment();
|
|
53991
|
-
context.state.init.push(
|
|
53992
|
+
context.state.init.push(hoisted2.length > 0 ? block([...hoisted2, boundary]) : boundary);
|
|
53992
53993
|
}
|
|
53993
53994
|
var init_SvelteBoundary3 = __esm({
|
|
53994
53995
|
"../node_modules/.pnpm/svelte@5.57.2/node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteBoundary.js"() {
|
|
@@ -56102,50 +56103,329 @@ function readActivity(file2, source2, module, beats) {
|
|
|
56102
56103
|
if (problems.length || !activity) return { problems };
|
|
56103
56104
|
return { activity: { activity, line: position2(source2, idLiteral.node.start).line }, problems };
|
|
56104
56105
|
}
|
|
56106
|
+
function lexical(statements) {
|
|
56107
|
+
const names = [];
|
|
56108
|
+
for (const statement of statements) {
|
|
56109
|
+
if (statement.type === "VariableDeclaration" && statement.kind !== "var")
|
|
56110
|
+
for (const declarator2 of statement.declarations)
|
|
56111
|
+
bound(declarator2.id, names);
|
|
56112
|
+
else if (statement.type === "FunctionDeclaration" || statement.type === "ClassDeclaration")
|
|
56113
|
+
bound(statement.id, names);
|
|
56114
|
+
}
|
|
56115
|
+
return names;
|
|
56116
|
+
}
|
|
56117
|
+
function hoisted(body) {
|
|
56118
|
+
const names = [];
|
|
56119
|
+
const skip = () => {
|
|
56120
|
+
};
|
|
56121
|
+
walk(body, null, {
|
|
56122
|
+
VariableDeclaration(node, { next: next2 }) {
|
|
56123
|
+
if (node.kind === "var")
|
|
56124
|
+
for (const declarator2 of node.declarations) bound(declarator2.id, names);
|
|
56125
|
+
next2();
|
|
56126
|
+
},
|
|
56127
|
+
FunctionDeclaration: skip,
|
|
56128
|
+
FunctionExpression: skip,
|
|
56129
|
+
ArrowFunctionExpression: skip
|
|
56130
|
+
});
|
|
56131
|
+
return names;
|
|
56132
|
+
}
|
|
56133
|
+
function isReference(node, parent, grandparent) {
|
|
56134
|
+
switch (parent.type) {
|
|
56135
|
+
case "MemberExpression":
|
|
56136
|
+
return parent.object === node || Boolean(parent.computed);
|
|
56137
|
+
case "Property":
|
|
56138
|
+
case "MethodDefinition":
|
|
56139
|
+
case "PropertyDefinition":
|
|
56140
|
+
case "AccessorProperty":
|
|
56141
|
+
return parent.value === node || Boolean(parent.computed) && parent.key === node;
|
|
56142
|
+
// `export { media } from './x'` names x's.
|
|
56143
|
+
case "ExportSpecifier":
|
|
56144
|
+
return parent.local === node && !grandparent?.source;
|
|
56145
|
+
case "FunctionDeclaration":
|
|
56146
|
+
case "FunctionExpression":
|
|
56147
|
+
case "ClassDeclaration":
|
|
56148
|
+
case "ClassExpression":
|
|
56149
|
+
return parent.id !== node;
|
|
56150
|
+
case "VariableDeclarator":
|
|
56151
|
+
return parent.init === node;
|
|
56152
|
+
case "ImportSpecifier":
|
|
56153
|
+
case "ImportDefaultSpecifier":
|
|
56154
|
+
case "ImportNamespaceSpecifier":
|
|
56155
|
+
case "ExportAllDeclaration":
|
|
56156
|
+
case "LabeledStatement":
|
|
56157
|
+
case "BreakStatement":
|
|
56158
|
+
case "ContinueStatement":
|
|
56159
|
+
case "MetaProperty":
|
|
56160
|
+
case "CatchClause":
|
|
56161
|
+
return false;
|
|
56162
|
+
default:
|
|
56163
|
+
return true;
|
|
56164
|
+
}
|
|
56165
|
+
}
|
|
56105
56166
|
function readCalls(file2, source2, root, problems) {
|
|
56106
56167
|
const media = [];
|
|
56107
|
-
|
|
56108
|
-
|
|
56109
|
-
|
|
56110
|
-
|
|
56111
|
-
|
|
56112
|
-
|
|
56113
|
-
|
|
56114
|
-
|
|
56115
|
-
|
|
56116
|
-
|
|
56117
|
-
|
|
56168
|
+
const through = /* @__PURE__ */ new Map();
|
|
56169
|
+
const into = (from) => {
|
|
56170
|
+
if (from === void 0) return { media, problems };
|
|
56171
|
+
let found2 = through.get(from);
|
|
56172
|
+
if (!found2) through.set(from, found2 = { specifier: from, media: [], problems: [] });
|
|
56173
|
+
return found2;
|
|
56174
|
+
};
|
|
56175
|
+
const refuse = (from, node, message) => into(from).problems.push({
|
|
56176
|
+
file: file2,
|
|
56177
|
+
...position2(source2, node.start),
|
|
56178
|
+
rule: "media",
|
|
56179
|
+
message,
|
|
56180
|
+
severity: "error"
|
|
56181
|
+
});
|
|
56182
|
+
const passedOn = (from, node) => refuse(
|
|
56183
|
+
from,
|
|
56184
|
+
node,
|
|
56185
|
+
`Call media() where the file is needed, as \`media('cow.jpg')\`, rather than passing it on or giving it another name. ${MEDIA_BY_NAME}`
|
|
56186
|
+
);
|
|
56187
|
+
const exportedAs = (from, node, name) => refuse(
|
|
56188
|
+
from,
|
|
56189
|
+
node,
|
|
56190
|
+
`Export media() under its own name, or import it from '@tobos/present' where it is called, not as ${name}. ${MEDIA_BY_NAME}`
|
|
56191
|
+
);
|
|
56192
|
+
const readCall = (from, call2) => {
|
|
56193
|
+
const found2 = into(from);
|
|
56194
|
+
const arg = call2.arguments[0];
|
|
56195
|
+
if (arg?.type === "Literal" && typeof arg.value === "string") {
|
|
56196
|
+
found2.media.push({ name: arg.value, ...position2(source2, arg.start) });
|
|
56197
|
+
} else if (arg?.type === "TemplateLiteral") {
|
|
56198
|
+
const quasis = arg.quasis.map(
|
|
56199
|
+
(q) => q.value.cooked ?? ""
|
|
56200
|
+
);
|
|
56201
|
+
found2.media.push({ name: quasis.join("*"), pattern: true, ...position2(source2, arg.start) });
|
|
56202
|
+
} else
|
|
56203
|
+
found2.problems.push({
|
|
56204
|
+
file: file2,
|
|
56205
|
+
...position2(source2, call2.start),
|
|
56206
|
+
rule: "media",
|
|
56207
|
+
message: "media() takes the file name as a string literal, or a template literal like `cow/${part}.png`, so Tobos can check the files exist.",
|
|
56208
|
+
severity: "error"
|
|
56209
|
+
});
|
|
56210
|
+
};
|
|
56211
|
+
const origin = (node) => {
|
|
56212
|
+
const value = node?.value;
|
|
56213
|
+
if (value === ENGINE) return void 0;
|
|
56214
|
+
return typeof value === "string" && isRelative2(value) ? value : null;
|
|
56215
|
+
};
|
|
56216
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
56217
|
+
const svelte = root;
|
|
56218
|
+
const scripts = svelte.type === "Program" ? [root] : [svelte.instance?.content, svelte.module?.content].filter((s) => s !== void 0);
|
|
56219
|
+
const statements = scripts.flatMap((script) => script.body).filter((node) => node.importKind !== "type" && node.exportKind !== "type");
|
|
56220
|
+
for (const node of statements) {
|
|
56221
|
+
const from = origin(node.source);
|
|
56222
|
+
if (from === null) continue;
|
|
56223
|
+
if (node.type === "ImportDeclaration")
|
|
56224
|
+
for (const specifier of node.specifiers) {
|
|
56225
|
+
const local = specifier.local.name;
|
|
56226
|
+
if (specifier.type === "ImportNamespaceSpecifier")
|
|
56227
|
+
bindings.set(local, { namespace: true, from });
|
|
56228
|
+
else if (specifier.type !== "ImportSpecifier" || specifier.importKind === "type" || nameOf(specifier.imported) !== "media")
|
|
56229
|
+
continue;
|
|
56230
|
+
else if (local === "media") bindings.set(local, { namespace: false, from });
|
|
56231
|
+
else
|
|
56232
|
+
refuse(
|
|
56233
|
+
from,
|
|
56234
|
+
specifier,
|
|
56235
|
+
`Import media() under its own name, \`import { media } from '@tobos/present'\`, not as ${local}. ${MEDIA_BY_NAME}`
|
|
56118
56236
|
);
|
|
56119
|
-
|
|
56120
|
-
|
|
56121
|
-
|
|
56122
|
-
|
|
56123
|
-
|
|
56124
|
-
|
|
56125
|
-
|
|
56126
|
-
|
|
56127
|
-
|
|
56237
|
+
}
|
|
56238
|
+
else if (node.type === "ExportAllDeclaration" && node.exported)
|
|
56239
|
+
exportedAs(from, node, `${nameOf(node.exported)}.media`);
|
|
56240
|
+
else if (node.type === "ExportNamedDeclaration")
|
|
56241
|
+
for (const specifier of node.specifiers) {
|
|
56242
|
+
const name = nameOf(specifier.exported);
|
|
56243
|
+
if (specifier.exportKind !== "type" && nameOf(specifier.local) === "media" && name !== "media")
|
|
56244
|
+
exportedAs(from, specifier, name);
|
|
56245
|
+
}
|
|
56246
|
+
}
|
|
56247
|
+
const named = new Set(bindings.keys());
|
|
56248
|
+
const hide = (scope, names) => {
|
|
56249
|
+
const more = names.filter((name) => named.has(name) && !scope.hidden.has(name));
|
|
56250
|
+
return more.length ? { hidden: /* @__PURE__ */ new Set([...scope.hidden, ...more]) } : scope;
|
|
56251
|
+
};
|
|
56252
|
+
const declares = (pattern) => {
|
|
56253
|
+
const names = [];
|
|
56254
|
+
bound(pattern ?? null, names);
|
|
56255
|
+
return names;
|
|
56256
|
+
};
|
|
56257
|
+
const fn = (node, { state, next: next2 }) => {
|
|
56258
|
+
const names = named.size ? node.params.flatMap(declares) : [];
|
|
56259
|
+
if (named.size && node.type === "FunctionExpression") names.push(...declares(node.id));
|
|
56260
|
+
if (named.size && node.body.type === "BlockStatement")
|
|
56261
|
+
names.push(...hoisted(node.body));
|
|
56262
|
+
next2(hide(state, names));
|
|
56263
|
+
};
|
|
56264
|
+
const block2 = (node, { state, next: next2 }) => {
|
|
56265
|
+
next2(hide(state, lexical(node.body)));
|
|
56266
|
+
};
|
|
56267
|
+
const loop = (node, { state, next: next2 }) => {
|
|
56268
|
+
const head = node.init ?? node.left;
|
|
56269
|
+
next2(hide(state, head?.type === "VariableDeclaration" ? lexical([head]) : []));
|
|
56270
|
+
};
|
|
56271
|
+
const directive = (node, { state, next: next2 }) => {
|
|
56272
|
+
const [first, second] = node.name.split(".");
|
|
56273
|
+
const binding = bindings.get(first);
|
|
56274
|
+
if (binding && !state.hidden.has(first) && (!binding.namespace || second === void 0 || second === "media"))
|
|
56275
|
+
passedOn(binding.from, node);
|
|
56276
|
+
next2();
|
|
56277
|
+
};
|
|
56278
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
56279
|
+
walk(
|
|
56280
|
+
root,
|
|
56281
|
+
{ hidden: /* @__PURE__ */ new Set() },
|
|
56282
|
+
{
|
|
56283
|
+
// Svelte's `let:` directives declare their names for the element's content.
|
|
56284
|
+
_(node, { state, next: next2 }) {
|
|
56285
|
+
const lets = Array.isArray(node.attributes) ? node.attributes.filter((a) => a.type === "LetDirective") : [];
|
|
56286
|
+
next2(
|
|
56287
|
+
hide(
|
|
56288
|
+
state,
|
|
56289
|
+
lets.flatMap((d) => d.expression ? declares(d.expression) : [d.name])
|
|
56290
|
+
)
|
|
56291
|
+
);
|
|
56292
|
+
},
|
|
56293
|
+
FunctionDeclaration: fn,
|
|
56294
|
+
FunctionExpression: fn,
|
|
56295
|
+
ArrowFunctionExpression: fn,
|
|
56296
|
+
BlockStatement: block2,
|
|
56297
|
+
StaticBlock: block2,
|
|
56298
|
+
ForStatement: loop,
|
|
56299
|
+
ForInStatement: loop,
|
|
56300
|
+
ForOfStatement: loop,
|
|
56301
|
+
SwitchStatement(node, { state, visit }) {
|
|
56302
|
+
visit(node.discriminant, state);
|
|
56303
|
+
const cases = node.cases;
|
|
56304
|
+
const inner = hide(state, lexical(cases.flatMap((c) => c.consequent)));
|
|
56305
|
+
for (const c of cases) visit(c, inner);
|
|
56306
|
+
},
|
|
56307
|
+
CatchClause(node, { state, next: next2 }) {
|
|
56308
|
+
next2(hide(state, declares(node.param)));
|
|
56309
|
+
},
|
|
56310
|
+
ClassExpression(node, { state, next: next2 }) {
|
|
56311
|
+
next2(hide(state, declares(node.id)));
|
|
56312
|
+
},
|
|
56313
|
+
// Svelte's markup: what a fragment's tags declare, and what a block declares for its content.
|
|
56314
|
+
Fragment(node, { state, next: next2 }) {
|
|
56315
|
+
const names = [];
|
|
56316
|
+
for (const child of node.nodes)
|
|
56317
|
+
if (child.type === "ConstTag") names.push(...lexical([child.declaration]));
|
|
56318
|
+
else if (child.type === "SnippetBlock") names.push(...declares(child.expression));
|
|
56319
|
+
next2(hide(state, names));
|
|
56320
|
+
},
|
|
56321
|
+
EachBlock(node, { state, visit }) {
|
|
56322
|
+
visit(node.expression, state);
|
|
56323
|
+
const names = declares(node.context);
|
|
56324
|
+
if (typeof node.index === "string") names.push(node.index);
|
|
56325
|
+
const inner = hide(state, names);
|
|
56326
|
+
for (const part of [node.context, node.key, node.body])
|
|
56327
|
+
if (part) visit(part, inner);
|
|
56328
|
+
if (node.fallback) visit(node.fallback, state);
|
|
56329
|
+
},
|
|
56330
|
+
AwaitBlock(node, { state, visit }) {
|
|
56331
|
+
visit(node.expression, state);
|
|
56332
|
+
if (node.pending) visit(node.pending, state);
|
|
56333
|
+
for (const [pattern, content] of [
|
|
56334
|
+
[node.value, node.then],
|
|
56335
|
+
[node.error, node.catch]
|
|
56336
|
+
]) {
|
|
56337
|
+
const inner = hide(state, declares(pattern));
|
|
56338
|
+
for (const part of [pattern, content]) if (part) visit(part, inner);
|
|
56339
|
+
}
|
|
56340
|
+
},
|
|
56341
|
+
SnippetBlock(node, { state, visit }) {
|
|
56342
|
+
const parameters = node.parameters;
|
|
56343
|
+
const inner = hide(state, parameters.flatMap(declares));
|
|
56344
|
+
for (const part of [...parameters, node.body]) visit(part, inner);
|
|
56345
|
+
},
|
|
56346
|
+
UseDirective: directive,
|
|
56347
|
+
TransitionDirective: directive,
|
|
56348
|
+
AnimateDirective: directive,
|
|
56349
|
+
ImportExpression(node, { next: next2 }) {
|
|
56350
|
+
const specifier = node.source;
|
|
56351
|
+
const value = specifier.type === "Literal" ? specifier.value : specifier.type === "TemplateLiteral" && specifier.expressions.length === 0 ? specifier.quasis[0].value : void 0;
|
|
56352
|
+
const name = typeof value === "object" ? value?.cooked : value;
|
|
56353
|
+
if (name === ENGINE)
|
|
56354
|
+
refuse(
|
|
56355
|
+
void 0,
|
|
56356
|
+
node,
|
|
56357
|
+
`Import media() with an import statement, \`import { media } from '@tobos/present'\`, not with import(). ${MEDIA_BY_NAME}`
|
|
56358
|
+
);
|
|
56359
|
+
else if (typeof name === "string" && isRelative2(name))
|
|
56360
|
+
refuse(
|
|
56361
|
+
name,
|
|
56362
|
+
node,
|
|
56363
|
+
`${name} passes media() on, which import() would give as a value: import that file with an import statement. ${MEDIA_BY_NAME}`
|
|
56364
|
+
);
|
|
56365
|
+
next2();
|
|
56366
|
+
},
|
|
56367
|
+
Identifier(node, { path, state }) {
|
|
56368
|
+
const name = node.name;
|
|
56369
|
+
const binding = bindings.get(name);
|
|
56370
|
+
if (!binding || state.hidden.has(name) || seen2.has(node.start)) return;
|
|
56371
|
+
const parent = path.at(-1);
|
|
56372
|
+
if (!parent || path.some((n2) => n2.type.startsWith("TS") && !TS_VALUES.has(n2.type))) return;
|
|
56373
|
+
if (!isReference(node, parent, path.at(-2))) return;
|
|
56374
|
+
seen2.add(node.start);
|
|
56375
|
+
const holding = (value, at3) => {
|
|
56376
|
+
while (at3 > 0 && WRAPPERS.has(path[at3].type)) value = path[at3--];
|
|
56377
|
+
return { value, holder: path[at3], at: at3 };
|
|
56378
|
+
};
|
|
56379
|
+
const { value: held, holder, at: at2 } = holding(node, path.length - 1);
|
|
56380
|
+
if (!holder) return;
|
|
56381
|
+
if (!binding.namespace) {
|
|
56382
|
+
if (holder.type === "CallExpression" && holder.callee === held)
|
|
56383
|
+
readCall(binding.from, holder);
|
|
56384
|
+
else if (holder.type !== "ExportSpecifier") passedOn(binding.from, node);
|
|
56385
|
+
else if (nameOf(holder.exported) !== "media")
|
|
56386
|
+
exportedAs(binding.from, holder, nameOf(holder.exported));
|
|
56387
|
+
return;
|
|
56388
|
+
}
|
|
56389
|
+
if (holder.type !== "MemberExpression" || holder.object !== held) {
|
|
56390
|
+
passedOn(binding.from, node);
|
|
56391
|
+
return;
|
|
56128
56392
|
}
|
|
56393
|
+
const property = holder.property;
|
|
56394
|
+
const key2 = !holder.computed ? nameOf(property) : property.type === "Literal" ? String(property.value) : void 0;
|
|
56395
|
+
if (key2 !== void 0 && key2 !== "media") return;
|
|
56396
|
+
const { value: member2, holder: call2 } = holding(holder, at2 - 1);
|
|
56397
|
+
if (key2 === "media" && call2?.type === "CallExpression" && call2.callee === member2)
|
|
56398
|
+
readCall(binding.from, call2);
|
|
56399
|
+
else passedOn(binding.from, holder);
|
|
56129
56400
|
}
|
|
56130
|
-
next2();
|
|
56131
56401
|
}
|
|
56132
|
-
|
|
56133
|
-
return { media };
|
|
56402
|
+
);
|
|
56403
|
+
return { media, ...through.size ? { through: [...through.values()] } : {} };
|
|
56134
56404
|
}
|
|
56135
|
-
function
|
|
56405
|
+
function mediaMatcher(pattern) {
|
|
56136
56406
|
const parts = pattern.split("*");
|
|
56137
|
-
if (parts.length === 1) return name === pattern;
|
|
56407
|
+
if (parts.length === 1) return (name) => name === pattern;
|
|
56138
56408
|
const first = parts[0];
|
|
56139
56409
|
const last = parts.at(-1);
|
|
56140
|
-
const
|
|
56141
|
-
|
|
56142
|
-
|
|
56143
|
-
|
|
56144
|
-
at2 =
|
|
56145
|
-
|
|
56146
|
-
|
|
56147
|
-
|
|
56148
|
-
|
|
56410
|
+
const middle = parts.slice(1, -1);
|
|
56411
|
+
return (name) => {
|
|
56412
|
+
const end = name.length - last.length;
|
|
56413
|
+
if (end < first.length || !name.startsWith(first) || !name.endsWith(last)) return false;
|
|
56414
|
+
let at2 = first.length;
|
|
56415
|
+
for (const part of middle) {
|
|
56416
|
+
at2 = name.indexOf(part, at2);
|
|
56417
|
+
if (at2 < 0 || at2 + part.length > end) return false;
|
|
56418
|
+
at2 += part.length;
|
|
56419
|
+
}
|
|
56420
|
+
return true;
|
|
56421
|
+
};
|
|
56422
|
+
}
|
|
56423
|
+
function mediaMatching(names, patterns) {
|
|
56424
|
+
const distinct = [...new Set(patterns)];
|
|
56425
|
+
if (distinct.length === 0) return [];
|
|
56426
|
+
if (distinct.some((pattern) => /^\*+$/.test(pattern))) return names;
|
|
56427
|
+
const matchers = distinct.map(mediaMatcher);
|
|
56428
|
+
return names.filter((name) => matchers.some((matches) => matches(name)));
|
|
56149
56429
|
}
|
|
56150
56430
|
function* declarations(source2, start, end) {
|
|
56151
56431
|
const starts = [...source2.matchAll(start)];
|
|
@@ -56474,7 +56754,7 @@ function analyzeScript(file2, source2, rules = {}) {
|
|
|
56474
56754
|
readExports(program, exports);
|
|
56475
56755
|
return { ...calls, takes, exports, problems };
|
|
56476
56756
|
}
|
|
56477
|
-
var BEATS_MAX, ACTIVITY_ID, PROMPT_MAX, OPTION_MAX, LABEL_MAX, FIELD_MAX, list4, sizesOf, SIZES, TIMERS, NETWORK, NETWORK_CLASSES, GLOBALS, onGlobal, REMOTE, IGNORED_ROOT, nameOf;
|
|
56757
|
+
var BEATS_MAX, ACTIVITY_ID, PROMPT_MAX, OPTION_MAX, LABEL_MAX, FIELD_MAX, list4, MEDIA_BY_NAME, ENGINE, isRelative2, TS_VALUES, WRAPPERS, sizesOf, SIZES, TIMERS, NETWORK, NETWORK_CLASSES, GLOBALS, onGlobal, REMOTE, IGNORED_ROOT, nameOf;
|
|
56478
56758
|
var init_analyze2 = __esm({
|
|
56479
56759
|
"../deck/src/analyze.ts"() {
|
|
56480
56760
|
"use strict";
|
|
@@ -56493,6 +56773,16 @@ var init_analyze2 = __esm({
|
|
|
56493
56773
|
LABEL_MAX = 200;
|
|
56494
56774
|
FIELD_MAX = 2e3;
|
|
56495
56775
|
list4 = (names) => names.length < 2 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
|
|
56776
|
+
MEDIA_BY_NAME = "Tobos reads each media() call to know which files a scene shows, and a share link gets only those; it can't follow media() under another name.";
|
|
56777
|
+
ENGINE = "@tobos/present";
|
|
56778
|
+
isRelative2 = (specifier) => specifier.startsWith("./") || specifier.startsWith("../");
|
|
56779
|
+
TS_VALUES = /* @__PURE__ */ new Set([
|
|
56780
|
+
"TSAsExpression",
|
|
56781
|
+
"TSSatisfiesExpression",
|
|
56782
|
+
"TSNonNullExpression",
|
|
56783
|
+
"TSInstantiationExpression"
|
|
56784
|
+
]);
|
|
56785
|
+
WRAPPERS = /* @__PURE__ */ new Set([...TS_VALUES, "ParenthesizedExpression"]);
|
|
56496
56786
|
sizesOf = (pattern) => (source2) => [...source2.matchAll(pattern)].map((m) => ({ index: m.index, value: m[1], unit: m[2] }));
|
|
56497
56787
|
SIZES = [
|
|
56498
56788
|
sizesOf(/font-size\s*:\s*(\d+(?:\.\d+)?)(px|rem)\b/g),
|
|
@@ -56981,6 +57271,61 @@ function emitModules(compiled) {
|
|
|
56981
57271
|
imports: Object.fromEntries(Object.entries(imports2).sort(([a], [b]) => a.localeCompare(b)))
|
|
56982
57272
|
};
|
|
56983
57273
|
}
|
|
57274
|
+
function passingMedia(compiled) {
|
|
57275
|
+
const known = /* @__PURE__ */ new Map();
|
|
57276
|
+
const passes = (path, seen2) => {
|
|
57277
|
+
if (known.has(path)) return known.get(path);
|
|
57278
|
+
const exports = compiled.get(path)?.analysis.exports;
|
|
57279
|
+
if (!exports || seen2.has(path)) return false;
|
|
57280
|
+
seen2.add(path);
|
|
57281
|
+
const from = (spec) => spec === "@tobos/present" || (spec.startsWith("./") || spec.startsWith("../")) && passes(resolvePath(path, spec) ?? "", seen2);
|
|
57282
|
+
const named = exports.from.find(([name]) => name === "media");
|
|
57283
|
+
if (named) return named[2] === "media" && from(named[1]);
|
|
57284
|
+
return !exports.names.includes("media") && exports.all.some(from);
|
|
57285
|
+
};
|
|
57286
|
+
return (path) => {
|
|
57287
|
+
if (!known.has(path)) known.set(path, passes(path, /* @__PURE__ */ new Set()));
|
|
57288
|
+
return known.get(path);
|
|
57289
|
+
};
|
|
57290
|
+
}
|
|
57291
|
+
function modulesUses(compiled, mediaOf) {
|
|
57292
|
+
const modules = {};
|
|
57293
|
+
for (const [path, file2] of [...compiled].sort(([a], [b]) => a.localeCompare(b))) {
|
|
57294
|
+
const imports2 = /* @__PURE__ */ new Set();
|
|
57295
|
+
for (const { specifier } of file2.imports)
|
|
57296
|
+
if (specifier?.startsWith("./") || specifier?.startsWith("../"))
|
|
57297
|
+
imports2.add(DECK_PREFIX + resolvePath(path, specifier));
|
|
57298
|
+
const names = /* @__PURE__ */ new Set();
|
|
57299
|
+
const patterns = /* @__PURE__ */ new Set();
|
|
57300
|
+
for (const ref2 of mediaOf.get(path) ?? []) (ref2.pattern ? patterns : names).add(ref2.name);
|
|
57301
|
+
modules[DECK_PREFIX + path] = {
|
|
57302
|
+
...imports2.size ? { imports: [...imports2].sort() } : {},
|
|
57303
|
+
...names.size ? { media: [...names].sort() } : {},
|
|
57304
|
+
...patterns.size ? { patterns: [...patterns].sort() } : {}
|
|
57305
|
+
};
|
|
57306
|
+
}
|
|
57307
|
+
return modules;
|
|
57308
|
+
}
|
|
57309
|
+
function unusedMedia(media, uses) {
|
|
57310
|
+
const used = new Set(uses.styles);
|
|
57311
|
+
const patterns = /* @__PURE__ */ new Set();
|
|
57312
|
+
for (const { media: names, patterns: more } of Object.values(uses.modules)) {
|
|
57313
|
+
for (const name of names ?? []) used.add(name);
|
|
57314
|
+
for (const pattern of more ?? []) patterns.add(pattern);
|
|
57315
|
+
}
|
|
57316
|
+
const named = Object.keys(media).filter((name) => !used.has(name) && !name.startsWith("master/"));
|
|
57317
|
+
const matched = new Set(mediaMatching(named, patterns));
|
|
57318
|
+
const unused = named.filter((name) => !matched.has(name));
|
|
57319
|
+
if (unused.length === 0) return void 0;
|
|
57320
|
+
const bytes = unused.reduce((sum, name) => sum + media[name].size, 0);
|
|
57321
|
+
const shown = unused.length > 10 ? [...unused.slice(0, 10), `${unused.length - 10} more`] : unused;
|
|
57322
|
+
return {
|
|
57323
|
+
file: "media.json",
|
|
57324
|
+
rule: "media",
|
|
57325
|
+
message: `media.json lists ${unused.length === 1 ? "1 file" : `${unused.length} files`} no scene or master uses (${sizeText(bytes)}): ${and(shown)}. Remove ${unused.length === 1 ? "it" : "them"} from media/ and media.json to free their room.`,
|
|
57326
|
+
severity: "warning"
|
|
57327
|
+
};
|
|
57328
|
+
}
|
|
56984
57329
|
async function buildDeck(tree, options = {}) {
|
|
56985
57330
|
const problems = [];
|
|
56986
57331
|
const modules = /* @__PURE__ */ new Map();
|
|
@@ -57021,10 +57366,28 @@ async function buildDeck(tree, options = {}) {
|
|
|
57021
57366
|
message: `${path} is not listed in deck.json, so it is never shown.`,
|
|
57022
57367
|
severity: "warning"
|
|
57023
57368
|
});
|
|
57369
|
+
const passes = passingMedia(graph.compiled);
|
|
57370
|
+
const mediaOf = /* @__PURE__ */ new Map();
|
|
57371
|
+
for (const [path, file2] of graph.compiled) {
|
|
57372
|
+
const refs = [...file2.analysis.media];
|
|
57373
|
+
for (const found2 of file2.analysis.through ?? []) {
|
|
57374
|
+
const target = resolvePath(path, found2.specifier);
|
|
57375
|
+
if (target === void 0 || !passes(target)) continue;
|
|
57376
|
+
refs.push(...found2.media);
|
|
57377
|
+
problems.push(...found2.problems);
|
|
57378
|
+
}
|
|
57379
|
+
mediaOf.set(path, refs);
|
|
57380
|
+
}
|
|
57381
|
+
const names = Object.keys(media);
|
|
57382
|
+
const matching = /* @__PURE__ */ new Map();
|
|
57383
|
+
const matches = (pattern) => {
|
|
57384
|
+
if (!matching.has(pattern)) matching.set(pattern, names.some(mediaMatcher(pattern)));
|
|
57385
|
+
return matching.get(pattern);
|
|
57386
|
+
};
|
|
57024
57387
|
if (mediaProblems.length === 0) {
|
|
57025
|
-
for (const [path,
|
|
57026
|
-
for (const ref2 of
|
|
57027
|
-
if (ref2.pattern ? !
|
|
57388
|
+
for (const [path, refs] of mediaOf)
|
|
57389
|
+
for (const ref2 of refs)
|
|
57390
|
+
if (ref2.pattern ? !matches(ref2.name) : !(ref2.name in media))
|
|
57028
57391
|
problems.push({
|
|
57029
57392
|
file: path,
|
|
57030
57393
|
line: ref2.line,
|
|
@@ -57053,6 +57416,12 @@ async function buildDeck(tree, options = {}) {
|
|
|
57053
57416
|
if (problems.some((p) => p.severity === "error")) return { problems, modules, deck };
|
|
57054
57417
|
const emitted = emitModules(graph.compiled);
|
|
57055
57418
|
if (stylesheet) emitted.modules.set(stylesheet.name, stylesheet.code);
|
|
57419
|
+
const uses = {
|
|
57420
|
+
modules: modulesUses(graph.compiled, mediaOf),
|
|
57421
|
+
styles: stylesheet?.media ?? []
|
|
57422
|
+
};
|
|
57423
|
+
const unused = unusedMedia(media, uses);
|
|
57424
|
+
if (unused) problems.push(unused);
|
|
57056
57425
|
const chapters = deck.chapters.map((chapter) => ({
|
|
57057
57426
|
id: chapter.id,
|
|
57058
57427
|
title: chapter.title,
|
|
@@ -57081,7 +57450,8 @@ async function buildDeck(tree, options = {}) {
|
|
|
57081
57450
|
media,
|
|
57082
57451
|
dependencies,
|
|
57083
57452
|
packages: packageImports(graph.compiled, dependencies),
|
|
57084
|
-
...stylesheet ? { styles: [stylesheet.name] } : {}
|
|
57453
|
+
...stylesheet ? { styles: [stylesheet.name] } : {},
|
|
57454
|
+
uses
|
|
57085
57455
|
}
|
|
57086
57456
|
};
|
|
57087
57457
|
}
|
|
@@ -57089,6 +57459,7 @@ function masterStylesheet(tree, media, problems) {
|
|
|
57089
57459
|
const file2 = "master/tokens.css";
|
|
57090
57460
|
const source2 = readText(tree, file2);
|
|
57091
57461
|
if (source2 === void 0) return void 0;
|
|
57462
|
+
const linked = /* @__PURE__ */ new Set();
|
|
57092
57463
|
const code = source2.replace(
|
|
57093
57464
|
/url\(\s*(?:'([^'\n]*)'|"([^"\n]*)"|([^'"()\s]+))\s*\)/g,
|
|
57094
57465
|
(whole, single, double, bare, offset2) => {
|
|
@@ -57096,7 +57467,10 @@ function masterStylesheet(tree, media, problems) {
|
|
|
57096
57467
|
if (url.startsWith("data:") || url.startsWith("#")) return whole;
|
|
57097
57468
|
const target = /^[a-z][a-z0-9+.-]*:|^\//i.test(url) ? void 0 : resolvePath(file2, url);
|
|
57098
57469
|
const name = target?.startsWith("media/") ? target.slice("media/".length) : void 0;
|
|
57099
|
-
if (name !== void 0 && media[name])
|
|
57470
|
+
if (name !== void 0 && media[name]) {
|
|
57471
|
+
linked.add(name);
|
|
57472
|
+
return `url(../media/${media[name].hash})`;
|
|
57473
|
+
}
|
|
57100
57474
|
problems.push({
|
|
57101
57475
|
file: file2,
|
|
57102
57476
|
...position2(source2, offset2),
|
|
@@ -57107,9 +57481,9 @@ function masterStylesheet(tree, media, problems) {
|
|
|
57107
57481
|
return whole;
|
|
57108
57482
|
}
|
|
57109
57483
|
);
|
|
57110
|
-
return { name: `m/${sha256(code).slice(0, 20)}.css`, code };
|
|
57484
|
+
return { name: `m/${sha256(code).slice(0, 20)}.css`, code, media: [...linked].sort() };
|
|
57111
57485
|
}
|
|
57112
|
-
var DECK_PREFIX, SOURCE, RUNTIME_PACKAGES, isNotAName, sourcesIn, and;
|
|
57486
|
+
var DECK_PREFIX, SOURCE, RUNTIME_PACKAGES, isNotAName, sourcesIn, and, sizeText;
|
|
57113
57487
|
var init_build = __esm({
|
|
57114
57488
|
"../deck/src/build.ts"() {
|
|
57115
57489
|
"use strict";
|
|
@@ -57131,6 +57505,7 @@ var init_build = __esm({
|
|
|
57131
57505
|
(f) => folders.some((folder) => f.startsWith(folder)) && SOURCE.test(f) && !f.endsWith(".json")
|
|
57132
57506
|
);
|
|
57133
57507
|
and = (items) => items.length < 2 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`;
|
|
57508
|
+
sizeText = (bytes) => bytes < 1e6 ? `${Math.ceil(bytes / 1e3)} KB` : `${+(bytes / 1e6).toFixed(1)} MB`;
|
|
57134
57509
|
}
|
|
57135
57510
|
});
|
|
57136
57511
|
|
|
@@ -57154,6 +57529,7 @@ var init_share = __esm({
|
|
|
57154
57529
|
init_define_TOBOS_PRESENT_TYPES();
|
|
57155
57530
|
init_define_TOBOS_SKILL();
|
|
57156
57531
|
init_define_TOBOS_TOOLCHAIN();
|
|
57532
|
+
init_analyze2();
|
|
57157
57533
|
}
|
|
57158
57534
|
});
|
|
57159
57535
|
|
|
@@ -57686,7 +58062,7 @@ function settings() {
|
|
|
57686
58062
|
|
|
57687
58063
|
// src/api.ts
|
|
57688
58064
|
init_out();
|
|
57689
|
-
var VERSION = true ? "0.4.
|
|
58065
|
+
var VERSION = true ? "0.4.7" : "dev";
|
|
57690
58066
|
function newer(a, b) {
|
|
57691
58067
|
const parse9 = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n2) => parseInt(n2)) : null;
|
|
57692
58068
|
const x = parse9(a);
|
|
@@ -57709,9 +58085,12 @@ async function api(path, options = {}) {
|
|
|
57709
58085
|
}
|
|
57710
58086
|
function failure(response, data2, prefix = "") {
|
|
57711
58087
|
const { error, message, ...extra } = data2;
|
|
58088
|
+
const said = prefix + (error ?? message ?? `${response.status} ${response.statusText}`);
|
|
58089
|
+
const limit = response.status === 402 || response.status === 423;
|
|
57712
58090
|
return new CliError(
|
|
57713
|
-
|
|
57714
|
-
|
|
58091
|
+
limit ? `${said}
|
|
58092
|
+
${ASK_THE_PERSON}` : said,
|
|
58093
|
+
response.status === 401 ? EXIT.auth : limit ? EXIT.limit : EXIT.error,
|
|
57715
58094
|
{ ...extra, status: response.status }
|
|
57716
58095
|
);
|
|
57717
58096
|
}
|
|
@@ -58253,11 +58632,20 @@ async function whoami(out) {
|
|
|
58253
58632
|
const me = await api("/api/me");
|
|
58254
58633
|
out.result({ ...me, server: settings().server }, () => `${me.email} on ${settings().server}`);
|
|
58255
58634
|
}
|
|
58635
|
+
function aboutDeck(d) {
|
|
58636
|
+
const can = { editor: "you edit", presenter: "you present", viewer: "you view" };
|
|
58637
|
+
const notes = [
|
|
58638
|
+
d.kind === "template" && "template",
|
|
58639
|
+
d.role && d.role !== "owner" && `${d.owner ?? "someone else"}\u2019s, ${can[d.role]}`,
|
|
58640
|
+
d.archived && "archived: read-only"
|
|
58641
|
+
].filter(Boolean);
|
|
58642
|
+
return notes.length ? ` (${notes.join("; ")})` : "";
|
|
58643
|
+
}
|
|
58256
58644
|
async function decks(out) {
|
|
58257
58645
|
const { decks: decks2 } = await api("/api/decks");
|
|
58258
58646
|
out.result(
|
|
58259
58647
|
{ decks: decks2 },
|
|
58260
|
-
() => decks2.length === 0 ? 'No decks yet. `tobos new "Title"` starts one.' : decks2.map((d) => `${d.id} ${d.title}`).join("\n")
|
|
58648
|
+
() => decks2.length === 0 ? 'No decks yet. `tobos new "Title"` starts one.' : decks2.map((d) => `${d.id} ${d.title}${aboutDeck(d)}`).join("\n")
|
|
58261
58649
|
);
|
|
58262
58650
|
}
|
|
58263
58651
|
async function cloneInto(out, info, dir2) {
|
|
@@ -58342,7 +58730,14 @@ async function runCheck(dir2) {
|
|
|
58342
58730
|
}
|
|
58343
58731
|
var remoteLines = (stderr) => stderr.split("\n").filter((l) => l.startsWith("remote: ")).map((l) => l.slice(8));
|
|
58344
58732
|
var plural = (n2, word) => `${n2} ${word}${n2 === 1 ? "" : "s"}`;
|
|
58733
|
+
var MEDIA_LIMIT = /^tobos: (This deck belongs to .+, whose )?Tobos \w+ keeps .+ of media/;
|
|
58345
58734
|
function pushFailure(output, remote) {
|
|
58735
|
+
const forThePerson = `${remote.map((line) => line.replace(/^tobos: /, "")).join("\n")}
|
|
58736
|
+
${ASK_THE_PERSON}`;
|
|
58737
|
+
if (remote.some((line) => /^tobos: This (deck|template) is archived/.test(line)))
|
|
58738
|
+
return { message: forThePerson, exit: EXIT.limit, archived: true };
|
|
58739
|
+
if (remote.some((line) => MEDIA_LIMIT.test(line)))
|
|
58740
|
+
return { message: forThePerson, exit: EXIT.limit, limit: "media" };
|
|
58346
58741
|
if (/non-fast-forward|fetch first/.test(output))
|
|
58347
58742
|
return {
|
|
58348
58743
|
message: "The server has changes you don't have. Run `tobos pull` (or `git pull`), then push again.",
|
|
@@ -58437,8 +58832,8 @@ async function pushWorkingCopy(out, deck, message) {
|
|
|
58437
58832
|
);
|
|
58438
58833
|
const remote = remoteLines(pushed.stderr);
|
|
58439
58834
|
if (pushed.code !== 0) {
|
|
58440
|
-
const { message: message2, exit } = pushFailure(pushed.stdout + pushed.stderr, remote);
|
|
58441
|
-
throw new CliError(message2, exit, { remote });
|
|
58835
|
+
const { message: message2, exit, ...extra } = pushFailure(pushed.stdout + pushed.stderr, remote);
|
|
58836
|
+
throw new CliError(message2, exit, { remote, ...extra });
|
|
58442
58837
|
}
|
|
58443
58838
|
const rev = (await gitOk(["rev-parse", "HEAD"], { cwd: root })).trim();
|
|
58444
58839
|
return { ok: true, rev, committed, uploaded, warnings: warnings2, remote };
|
|
@@ -58741,7 +59136,8 @@ Account
|
|
|
58741
59136
|
tobos login --code <code> finish: the code they read from the mail
|
|
58742
59137
|
tobos logout [--everywhere] forget this machine's token; --everywhere: every login of the account
|
|
58743
59138
|
tobos whoami who you are, on which server
|
|
58744
|
-
tobos decks your decks and templates, by id
|
|
59139
|
+
tobos decks your decks and templates, by id, and those shared
|
|
59140
|
+
with you; an archived one is read-only
|
|
58745
59141
|
|
|
58746
59142
|
Working on a deck
|
|
58747
59143
|
tobos new "Title" create a deck and clone it here, into ./<id>
|
|
@@ -58786,7 +59182,8 @@ Templates (decks people start from: a new deck copies a template's master/)
|
|
|
58786
59182
|
|
|
58787
59183
|
Every command takes --json and then prints one JSON object.
|
|
58788
59184
|
Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in, 4 the story changed
|
|
58789
|
-
meanwhile (the reply has the paragraph as it is now: anchor on that and try again)
|
|
59185
|
+
meanwhile (the reply has the paragraph as it is now: anchor on that and try again), 5 a plan's
|
|
59186
|
+
limit or an archived deck: the person decides what to do, so show them the message and wait.
|
|
58790
59187
|
`;
|
|
58791
59188
|
var COMMON = {
|
|
58792
59189
|
json: { type: "boolean" },
|