@tobos/cli 0.3.0 → 0.4.0
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 +424 -59
- package/package.json +1 -1
package/dist/tobos.js
CHANGED
|
@@ -47,7 +47,11 @@ 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", "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", "index.d.ts": `export { playVideo, type PlayVideoOptions } from './video.ts';
|
|
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 /** A line about the scene, for the people working on the deck (a template's gallery shows it). */\n note?: 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 note?: 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", "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
|
+
import { type JoinInfo } from './registry.ts';
|
|
52
|
+
export { playVideo, type PlayVideoOptions } from './video.ts';
|
|
53
|
+
export { useResponses, type Responses } from './responses.svelte.ts';
|
|
54
|
+
export type { Activity, ChoiceActivity, TextActivity, TextField } from '@tobos/deck/types';
|
|
51
55
|
/** Finds elements inside the current scene only. */
|
|
52
56
|
export type Query = (selector: string) => Element[];
|
|
53
57
|
/** One click's worth of a scene: an ID, and the animation into it. */
|
|
@@ -88,6 +92,22 @@ export declare const DECK_CONTEXT = "tobos:deck";
|
|
|
88
92
|
export declare function useDeck(): DeckContext;
|
|
89
93
|
/** The URL of a file in the deck's media/ folder. The name must be a string literal. */
|
|
90
94
|
export declare function media(name: string): string;
|
|
95
|
+
export type { JoinInfo } from './registry.ts';
|
|
96
|
+
/**
|
|
97
|
+
* The deck's join code, for a scene to show its own way: the digits, the link as people type
|
|
98
|
+
* it, the full URL, and the QR code as an image's address. Undefined while the deck has no
|
|
99
|
+
* activity.
|
|
100
|
+
*/
|
|
101
|
+
export declare function useJoin(): JoinInfo | undefined;
|
|
102
|
+
export interface JoinCodeProps {
|
|
103
|
+
/** The QR code's width and height, in stage pixels. */
|
|
104
|
+
size?: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The deck's join code: a QR code, and under it the link it holds, which phones open to answer
|
|
108
|
+
* the deck's activities. The scene sizes it; the link takes the scene's font.
|
|
109
|
+
*/
|
|
110
|
+
export declare const JoinCode: Component<JoinCodeProps>;
|
|
91
111
|
` };
|
|
92
112
|
}
|
|
93
113
|
});
|
|
@@ -96,7 +116,7 @@ export declare function media(name: string): string;
|
|
|
96
116
|
var define_TOBOS_SKILL_default;
|
|
97
117
|
var init_define_TOBOS_SKILL = __esm({
|
|
98
118
|
"<define:TOBOS_SKILL>"() {
|
|
99
|
-
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, set `TOBOS_TOKEN` 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\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## Commands\n\n| Command | Does |\n| -------------------------------------------------------- | ------------------------------------------------------ |\n| `tobos check` | compile and check the deck, offline |\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\nEvery command takes `--json`. Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in.\n\nWhen a command says a newer `tobos` is out, run `npm i -g @tobos/cli`; the next command updates this skill. When a plan's limit stops a command (Free hosts 3 decks), the error links to the billing page: give the person the link, since only they can buy Pro.\n" };
|
|
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, set `TOBOS_TOKEN` 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\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` | compile and check the deck, offline |\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\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. When a plan's limit stops a command (Free hosts 3 decks), the error links to the billing page: give the person the link, since only they can buy Pro.\n" };
|
|
100
120
|
}
|
|
101
121
|
});
|
|
102
122
|
|
|
@@ -128,7 +148,7 @@ var init_out = __esm({
|
|
|
128
148
|
"use strict";
|
|
129
149
|
init_define_TOBOS_PRESENT_TYPES();
|
|
130
150
|
init_define_TOBOS_SKILL();
|
|
131
|
-
EXIT = { ok: 0, error: 1, problems: 2, auth: 3 };
|
|
151
|
+
EXIT = { ok: 0, error: 1, problems: 2, auth: 3, conflict: 4 };
|
|
132
152
|
CliError = class extends Error {
|
|
133
153
|
exit;
|
|
134
154
|
extra;
|
|
@@ -3440,8 +3460,8 @@ var init_acorn = __esm({
|
|
|
3440
3460
|
node.body.push(stmt2);
|
|
3441
3461
|
}
|
|
3442
3462
|
if (this.inModule) {
|
|
3443
|
-
for (var i2 = 0,
|
|
3444
|
-
var name =
|
|
3463
|
+
for (var i2 = 0, list5 = Object.keys(this.undefinedExports); i2 < list5.length; i2 += 1) {
|
|
3464
|
+
var name = list5[i2];
|
|
3445
3465
|
this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
|
|
3446
3466
|
}
|
|
3447
3467
|
}
|
|
@@ -3926,8 +3946,8 @@ var init_acorn = __esm({
|
|
|
3926
3946
|
return this.finishNode(node, "EmptyStatement");
|
|
3927
3947
|
};
|
|
3928
3948
|
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
3929
|
-
for (var i$1 = 0,
|
|
3930
|
-
var label =
|
|
3949
|
+
for (var i$1 = 0, list5 = this.labels; i$1 < list5.length; i$1 += 1) {
|
|
3950
|
+
var label = list5[i$1];
|
|
3931
3951
|
if (label.name === maybeName) {
|
|
3932
3952
|
this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
3933
3953
|
}
|
|
@@ -4329,8 +4349,8 @@ var init_acorn = __esm({
|
|
|
4329
4349
|
node.attributes = this.parseWithClause();
|
|
4330
4350
|
}
|
|
4331
4351
|
} else {
|
|
4332
|
-
for (var i2 = 0,
|
|
4333
|
-
var spec =
|
|
4352
|
+
for (var i2 = 0, list5 = node.specifiers; i2 < list5.length; i2 += 1) {
|
|
4353
|
+
var spec = list5[i2];
|
|
4334
4354
|
this.checkUnreserved(spec.local);
|
|
4335
4355
|
this.checkLocalExport(spec.local);
|
|
4336
4356
|
if (spec.local.type === "Literal") {
|
|
@@ -4384,8 +4404,8 @@ var init_acorn = __esm({
|
|
|
4384
4404
|
if (type === "Identifier") {
|
|
4385
4405
|
this.checkExport(exports$1, pat, pat.start);
|
|
4386
4406
|
} else if (type === "ObjectPattern") {
|
|
4387
|
-
for (var i2 = 0,
|
|
4388
|
-
var prop2 =
|
|
4407
|
+
for (var i2 = 0, list5 = pat.properties; i2 < list5.length; i2 += 1) {
|
|
4408
|
+
var prop2 = list5[i2];
|
|
4389
4409
|
this.checkPatternExport(exports$1, prop2);
|
|
4390
4410
|
}
|
|
4391
4411
|
} else if (type === "ArrayPattern") {
|
|
@@ -4407,8 +4427,8 @@ var init_acorn = __esm({
|
|
|
4407
4427
|
if (!exports$1) {
|
|
4408
4428
|
return;
|
|
4409
4429
|
}
|
|
4410
|
-
for (var i2 = 0,
|
|
4411
|
-
var decl =
|
|
4430
|
+
for (var i2 = 0, list5 = decls; i2 < list5.length; i2 += 1) {
|
|
4431
|
+
var decl = list5[i2];
|
|
4412
4432
|
this.checkPatternExport(exports$1, decl.id);
|
|
4413
4433
|
}
|
|
4414
4434
|
};
|
|
@@ -4585,8 +4605,8 @@ var init_acorn = __esm({
|
|
|
4585
4605
|
if (refDestructuringErrors) {
|
|
4586
4606
|
this.checkPatternErrors(refDestructuringErrors, true);
|
|
4587
4607
|
}
|
|
4588
|
-
for (var i2 = 0,
|
|
4589
|
-
var prop2 =
|
|
4608
|
+
for (var i2 = 0, list5 = node.properties; i2 < list5.length; i2 += 1) {
|
|
4609
|
+
var prop2 = list5[i2];
|
|
4590
4610
|
this.toAssignable(prop2, isBinding);
|
|
4591
4611
|
if (prop2.type === "RestElement" && (prop2.argument.type === "ArrayPattern" || prop2.argument.type === "ObjectPattern")) {
|
|
4592
4612
|
this.raise(prop2.argument.start, "Unexpected token");
|
|
@@ -4773,8 +4793,8 @@ var init_acorn = __esm({
|
|
|
4773
4793
|
if (bindingType === void 0) bindingType = BIND_NONE;
|
|
4774
4794
|
switch (expr.type) {
|
|
4775
4795
|
case "ObjectPattern":
|
|
4776
|
-
for (var i2 = 0,
|
|
4777
|
-
var prop2 =
|
|
4796
|
+
for (var i2 = 0, list5 = expr.properties; i2 < list5.length; i2 += 1) {
|
|
4797
|
+
var prop2 = list5[i2];
|
|
4778
4798
|
this.checkLValInnerPattern(prop2, bindingType, checkClashes);
|
|
4779
4799
|
}
|
|
4780
4800
|
break;
|
|
@@ -5873,8 +5893,8 @@ var init_acorn = __esm({
|
|
|
5873
5893
|
this.exitScope();
|
|
5874
5894
|
};
|
|
5875
5895
|
pp$5.isSimpleParamList = function(params) {
|
|
5876
|
-
for (var i2 = 0,
|
|
5877
|
-
var param =
|
|
5896
|
+
for (var i2 = 0, list5 = params; i2 < list5.length; i2 += 1) {
|
|
5897
|
+
var param = list5[i2];
|
|
5878
5898
|
if (param.type !== "Identifier") {
|
|
5879
5899
|
return false;
|
|
5880
5900
|
}
|
|
@@ -5883,8 +5903,8 @@ var init_acorn = __esm({
|
|
|
5883
5903
|
};
|
|
5884
5904
|
pp$5.checkParams = function(node, allowDuplicates) {
|
|
5885
5905
|
var nameHash = /* @__PURE__ */ Object.create(null);
|
|
5886
|
-
for (var i2 = 0,
|
|
5887
|
-
var param =
|
|
5906
|
+
for (var i2 = 0, list5 = node.params; i2 < list5.length; i2 += 1) {
|
|
5907
|
+
var param = list5[i2];
|
|
5888
5908
|
this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
|
|
5889
5909
|
}
|
|
5890
5910
|
};
|
|
@@ -6297,8 +6317,8 @@ var init_acorn = __esm({
|
|
|
6297
6317
|
RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) {
|
|
6298
6318
|
if (forceU === void 0) forceU = false;
|
|
6299
6319
|
var pos = this.pos;
|
|
6300
|
-
for (var i2 = 0,
|
|
6301
|
-
var ch =
|
|
6320
|
+
for (var i2 = 0, list5 = chs; i2 < list5.length; i2 += 1) {
|
|
6321
|
+
var ch = list5[i2];
|
|
6302
6322
|
var current2 = this.at(pos, forceU);
|
|
6303
6323
|
if (current2 === -1 || current2 !== ch) {
|
|
6304
6324
|
return false;
|
|
@@ -6370,8 +6390,8 @@ var init_acorn = __esm({
|
|
|
6370
6390
|
if (state.maxBackReference > state.numCapturingParens) {
|
|
6371
6391
|
state.raise("Invalid escape");
|
|
6372
6392
|
}
|
|
6373
|
-
for (var i2 = 0,
|
|
6374
|
-
var name =
|
|
6393
|
+
for (var i2 = 0, list5 = state.backReferenceNames; i2 < list5.length; i2 += 1) {
|
|
6394
|
+
var name = list5[i2];
|
|
6375
6395
|
if (!state.groupNames[name]) {
|
|
6376
6396
|
state.raise("Invalid named capture referenced");
|
|
6377
6397
|
}
|
|
@@ -6695,8 +6715,8 @@ var init_acorn = __esm({
|
|
|
6695
6715
|
var known = state.groupNames[state.lastStringValue];
|
|
6696
6716
|
if (known) {
|
|
6697
6717
|
if (trackDisjunction) {
|
|
6698
|
-
for (var i2 = 0,
|
|
6699
|
-
var altID =
|
|
6718
|
+
for (var i2 = 0, list5 = known; i2 < list5.length; i2 += 1) {
|
|
6719
|
+
var altID = list5[i2];
|
|
6700
6720
|
if (!altID.separatedFrom(state.branchID)) {
|
|
6701
6721
|
state.raise("Duplicate capture group name");
|
|
6702
6722
|
}
|
|
@@ -14342,8 +14362,8 @@ function event_handler_invalid_component_modifier(node) {
|
|
|
14342
14362
|
e(node, "event_handler_invalid_component_modifier", `Event modifiers other than 'once' can only be used on DOM elements
|
|
14343
14363
|
https://svelte.dev/e/event_handler_invalid_component_modifier`);
|
|
14344
14364
|
}
|
|
14345
|
-
function event_handler_invalid_modifier(node,
|
|
14346
|
-
e(node, "event_handler_invalid_modifier", `Valid event modifiers are ${
|
|
14365
|
+
function event_handler_invalid_modifier(node, list5) {
|
|
14366
|
+
e(node, "event_handler_invalid_modifier", `Valid event modifiers are ${list5}
|
|
14347
14367
|
https://svelte.dev/e/event_handler_invalid_modifier`);
|
|
14348
14368
|
}
|
|
14349
14369
|
function event_handler_invalid_modifier_combination(node, modifier1, modifier2) {
|
|
@@ -14534,8 +14554,8 @@ function svelte_meta_invalid_placement(node, name) {
|
|
|
14534
14554
|
e(node, "svelte_meta_invalid_placement", `\`<${name}>\` tags cannot be inside elements or blocks
|
|
14535
14555
|
https://svelte.dev/e/svelte_meta_invalid_placement`);
|
|
14536
14556
|
}
|
|
14537
|
-
function svelte_meta_invalid_tag(node,
|
|
14538
|
-
e(node, "svelte_meta_invalid_tag", `Valid \`<svelte:...>\` tag names are ${
|
|
14557
|
+
function svelte_meta_invalid_tag(node, list5) {
|
|
14558
|
+
e(node, "svelte_meta_invalid_tag", `Valid \`<svelte:...>\` tag names are ${list5}
|
|
14539
14559
|
https://svelte.dev/e/svelte_meta_invalid_tag`);
|
|
14540
14560
|
}
|
|
14541
14561
|
function svelte_options_deprecated_tag(node) {
|
|
@@ -14546,8 +14566,8 @@ function svelte_options_invalid_attribute(node) {
|
|
|
14546
14566
|
e(node, "svelte_options_invalid_attribute", `\`<svelte:options>\` can only receive static attributes
|
|
14547
14567
|
https://svelte.dev/e/svelte_options_invalid_attribute`);
|
|
14548
14568
|
}
|
|
14549
|
-
function svelte_options_invalid_attribute_value(node,
|
|
14550
|
-
e(node, "svelte_options_invalid_attribute_value", `Value must be ${
|
|
14569
|
+
function svelte_options_invalid_attribute_value(node, list5) {
|
|
14570
|
+
e(node, "svelte_options_invalid_attribute_value", `Value must be ${list5}, if specified
|
|
14551
14571
|
https://svelte.dev/e/svelte_options_invalid_attribute_value`);
|
|
14552
14572
|
}
|
|
14553
14573
|
function svelte_options_invalid_customelement(node) {
|
|
@@ -38398,8 +38418,8 @@ function validate_element(node, context) {
|
|
|
38398
38418
|
let conflicting_passive_modifier = "";
|
|
38399
38419
|
for (const modifier of attribute.modifiers) {
|
|
38400
38420
|
if (!EVENT_MODIFIERS.includes(modifier)) {
|
|
38401
|
-
const
|
|
38402
|
-
event_handler_invalid_modifier(attribute,
|
|
38421
|
+
const list5 = `${EVENT_MODIFIERS.slice(0, -1).join(", ")} or ${EVENT_MODIFIERS.at(-1)}`;
|
|
38422
|
+
event_handler_invalid_modifier(attribute, list5);
|
|
38403
38423
|
}
|
|
38404
38424
|
if (modifier === "passive") {
|
|
38405
38425
|
has_passive_modifier = true;
|
|
@@ -55183,6 +55203,17 @@ var init_compiler = __esm({
|
|
|
55183
55203
|
}
|
|
55184
55204
|
});
|
|
55185
55205
|
|
|
55206
|
+
// ../deck/src/activity.ts
|
|
55207
|
+
var TEXT_MAX;
|
|
55208
|
+
var init_activity = __esm({
|
|
55209
|
+
"../deck/src/activity.ts"() {
|
|
55210
|
+
"use strict";
|
|
55211
|
+
init_define_TOBOS_PRESENT_TYPES();
|
|
55212
|
+
init_define_TOBOS_SKILL();
|
|
55213
|
+
TEXT_MAX = 500;
|
|
55214
|
+
}
|
|
55215
|
+
});
|
|
55216
|
+
|
|
55186
55217
|
// ../deck/src/tree.ts
|
|
55187
55218
|
function readText(tree, path) {
|
|
55188
55219
|
const bytes = tree.read(path);
|
|
@@ -55245,7 +55276,7 @@ function readBeats(file2, source2, module) {
|
|
|
55245
55276
|
]
|
|
55246
55277
|
});
|
|
55247
55278
|
if (!module) return missing();
|
|
55248
|
-
let
|
|
55279
|
+
let list5;
|
|
55249
55280
|
for (const statement of module.content.body) {
|
|
55250
55281
|
if (statement.type !== "ExportNamedDeclaration") continue;
|
|
55251
55282
|
const declaration2 = statement.declaration;
|
|
@@ -55254,23 +55285,23 @@ function readBeats(file2, source2, module) {
|
|
|
55254
55285
|
const id2 = declarator2.id;
|
|
55255
55286
|
if (id2.type === "Identifier" && id2.name === "beats") {
|
|
55256
55287
|
if (declaration2.kind !== "const") at2(declarator2, "`beats` must be declared with const.");
|
|
55257
|
-
|
|
55258
|
-
if (!
|
|
55288
|
+
list5 = unwrap(declarator2.init);
|
|
55289
|
+
if (!list5) at2(declarator2, "`beats` needs a value.");
|
|
55259
55290
|
}
|
|
55260
55291
|
}
|
|
55261
55292
|
}
|
|
55262
|
-
if (!
|
|
55263
|
-
if (
|
|
55264
|
-
at2(
|
|
55293
|
+
if (!list5) return problems.length ? { problems } : missing();
|
|
55294
|
+
if (list5.type !== "ArrayExpression") {
|
|
55295
|
+
at2(list5, "`beats` must be an array literal, so Tobos can read it without running the scene.");
|
|
55265
55296
|
return { problems };
|
|
55266
55297
|
}
|
|
55267
55298
|
const beats = [];
|
|
55268
55299
|
const seen2 = /* @__PURE__ */ new Set();
|
|
55269
|
-
for (const element2 of
|
|
55300
|
+
for (const element2 of list5.elements) {
|
|
55270
55301
|
const beat = unwrap(element2 ?? void 0);
|
|
55271
55302
|
if (!beat || beat.type !== "ObjectExpression") {
|
|
55272
55303
|
at2(
|
|
55273
|
-
element2 ??
|
|
55304
|
+
element2 ?? list5,
|
|
55274
55305
|
'Each beat must be an object literal: `{ id: "\u2026", enter: (tl, q) => \u2026 }`.'
|
|
55275
55306
|
);
|
|
55276
55307
|
continue;
|
|
@@ -55299,9 +55330,226 @@ function readBeats(file2, source2, module) {
|
|
|
55299
55330
|
seen2.add(id2);
|
|
55300
55331
|
beats.push({ id: id2, line: position2(source2, value.start).line });
|
|
55301
55332
|
}
|
|
55302
|
-
if (beats.length === 0 && problems.length === 0) at2(
|
|
55333
|
+
if (beats.length === 0 && problems.length === 0) at2(list5, "A scene needs at least one beat.");
|
|
55303
55334
|
return { beats, problems };
|
|
55304
55335
|
}
|
|
55336
|
+
function readLiteral(node) {
|
|
55337
|
+
const value = unwrap(node);
|
|
55338
|
+
if (value.type === "Literal" && ["string", "number", "boolean"].includes(typeof value.value))
|
|
55339
|
+
return { node: value, value: value.value };
|
|
55340
|
+
if (value.type === "TemplateLiteral" && value.expressions.length === 0)
|
|
55341
|
+
return {
|
|
55342
|
+
node: value,
|
|
55343
|
+
value: value.quasis[0].value.cooked ?? ""
|
|
55344
|
+
};
|
|
55345
|
+
if (value.type === "ArrayExpression") {
|
|
55346
|
+
const items = [];
|
|
55347
|
+
for (const element2 of value.elements) {
|
|
55348
|
+
if (!element2 || element2.type === "SpreadElement") return { bad: element2 ?? value };
|
|
55349
|
+
const item = readLiteral(element2);
|
|
55350
|
+
if ("bad" in item) return item;
|
|
55351
|
+
items.push(item);
|
|
55352
|
+
}
|
|
55353
|
+
return { node: value, value: items };
|
|
55354
|
+
}
|
|
55355
|
+
if (value.type === "ObjectExpression") {
|
|
55356
|
+
const props = /* @__PURE__ */ new Map();
|
|
55357
|
+
for (const prop2 of value.properties) {
|
|
55358
|
+
const key2 = prop2.key;
|
|
55359
|
+
const name = key2?.type === "Identifier" ? key2.name : key2?.type === "Literal" && typeof key2.value === "string" ? key2.value : void 0;
|
|
55360
|
+
if (prop2.type !== "Property" || prop2.computed || prop2.kind !== "init" || prop2.method)
|
|
55361
|
+
return { bad: prop2 };
|
|
55362
|
+
if (name === void 0) return { bad: prop2 };
|
|
55363
|
+
const item = readLiteral(prop2.value);
|
|
55364
|
+
if ("bad" in item) return item;
|
|
55365
|
+
props.set(name, item);
|
|
55366
|
+
}
|
|
55367
|
+
return { node: value, value: props };
|
|
55368
|
+
}
|
|
55369
|
+
return { bad: value };
|
|
55370
|
+
}
|
|
55371
|
+
function readActivity(file2, source2, module, beats) {
|
|
55372
|
+
const problems = [];
|
|
55373
|
+
const at2 = (node, message) => problems.push({
|
|
55374
|
+
file: file2,
|
|
55375
|
+
...position2(source2, node.start),
|
|
55376
|
+
rule: "activity",
|
|
55377
|
+
message,
|
|
55378
|
+
severity: "error"
|
|
55379
|
+
});
|
|
55380
|
+
let init3;
|
|
55381
|
+
for (const statement of module?.content?.body ?? []) {
|
|
55382
|
+
const declaration2 = statement.declaration;
|
|
55383
|
+
if (statement.type !== "ExportNamedDeclaration" || declaration2?.type !== "VariableDeclaration")
|
|
55384
|
+
continue;
|
|
55385
|
+
for (const declarator2 of declaration2.declarations) {
|
|
55386
|
+
const id3 = declarator2.id;
|
|
55387
|
+
if (id3.type !== "Identifier" || id3.name !== "activity") continue;
|
|
55388
|
+
if (declaration2.kind !== "const") at2(declarator2, "`activity` must be declared with const.");
|
|
55389
|
+
init3 = unwrap(declarator2.init);
|
|
55390
|
+
if (!init3) at2(declarator2, "`activity` needs a value.");
|
|
55391
|
+
}
|
|
55392
|
+
}
|
|
55393
|
+
if (!init3 || problems.length) return { problems };
|
|
55394
|
+
if (init3.type !== "ObjectExpression") {
|
|
55395
|
+
at2(
|
|
55396
|
+
init3,
|
|
55397
|
+
"`activity` must be an object literal, so Tobos can read it without running the scene."
|
|
55398
|
+
);
|
|
55399
|
+
return { problems };
|
|
55400
|
+
}
|
|
55401
|
+
const read2 = readLiteral(init3);
|
|
55402
|
+
if ("bad" in read2) {
|
|
55403
|
+
at2(
|
|
55404
|
+
read2.bad,
|
|
55405
|
+
"`activity` may hold only string, number and boolean literals, and arrays and objects of them, so Tobos can read it without running the scene."
|
|
55406
|
+
);
|
|
55407
|
+
return { problems };
|
|
55408
|
+
}
|
|
55409
|
+
const props = read2.value;
|
|
55410
|
+
const text3 = (literal3) => typeof literal3?.value === "string" ? literal3.value : void 0;
|
|
55411
|
+
const short = (literal3, name, max) => {
|
|
55412
|
+
const value = text3(literal3);
|
|
55413
|
+
if (value === void 0) at2(literal3.node, `The \`${name}\` is a string.`);
|
|
55414
|
+
else if (value.length > max)
|
|
55415
|
+
at2(literal3.node, `The \`${name}\` is ${value.length} characters; it may have ${max}.`);
|
|
55416
|
+
return value;
|
|
55417
|
+
};
|
|
55418
|
+
const only = (map, allowed, what) => {
|
|
55419
|
+
for (const [key2, literal3] of map)
|
|
55420
|
+
if (!allowed.includes(key2))
|
|
55421
|
+
at2(literal3.node, `${what} has no \`${key2}\`: it takes ${list4(allowed)}.`);
|
|
55422
|
+
};
|
|
55423
|
+
const idLiteral = props.get("id");
|
|
55424
|
+
const id2 = text3(idLiteral);
|
|
55425
|
+
if (id2 === void 0)
|
|
55426
|
+
at2(idLiteral?.node ?? init3, "An activity needs an `id`: lowercase letters, digits and dashes.");
|
|
55427
|
+
else if (!ACTIVITY_ID.test(id2))
|
|
55428
|
+
at2(idLiteral.node, `Activity ID "${id2}" must be lowercase letters, digits and dashes.`);
|
|
55429
|
+
const kind = text3(props.get("kind"));
|
|
55430
|
+
const prompt = props.get("prompt");
|
|
55431
|
+
let activity;
|
|
55432
|
+
if (kind === "choice") {
|
|
55433
|
+
only(props, ["id", "kind", "prompt", "options", "reveals"], "A poll");
|
|
55434
|
+
const question = prompt ? short(prompt, "prompt", PROMPT_MAX) : void 0;
|
|
55435
|
+
if (!prompt) at2(init3, "A poll needs a `prompt`.");
|
|
55436
|
+
else if (question !== void 0 && !question.trim())
|
|
55437
|
+
at2(prompt.node, "A poll needs a `prompt`.");
|
|
55438
|
+
const optionsLiteral = props.get("options");
|
|
55439
|
+
const options = [];
|
|
55440
|
+
if (!Array.isArray(optionsLiteral?.value))
|
|
55441
|
+
at2(optionsLiteral?.node ?? init3, "A poll needs 2 to 8 `options`, as an array of strings.");
|
|
55442
|
+
else {
|
|
55443
|
+
const items = optionsLiteral.value;
|
|
55444
|
+
if (items.length < 2 || items.length > 8)
|
|
55445
|
+
at2(optionsLiteral.node, `A poll needs 2 to 8 \`options\`; this one has ${items.length}.`);
|
|
55446
|
+
for (const item of items) {
|
|
55447
|
+
const option = text3(item);
|
|
55448
|
+
if (option === void 0) at2(item.node, "Each option is a string.");
|
|
55449
|
+
else if (!option.trim()) at2(item.node, "An option needs some text.");
|
|
55450
|
+
else if (option.length > OPTION_MAX)
|
|
55451
|
+
at2(item.node, `An option is ${option.length} characters; it may have ${OPTION_MAX}.`);
|
|
55452
|
+
else if (options.includes(option)) at2(item.node, `Option "${option}" is listed twice.`);
|
|
55453
|
+
else options.push(option);
|
|
55454
|
+
}
|
|
55455
|
+
}
|
|
55456
|
+
const revealsLiteral = props.get("reveals");
|
|
55457
|
+
const reveals = text3(revealsLiteral);
|
|
55458
|
+
if (revealsLiteral) {
|
|
55459
|
+
const names = (beats ?? []).map((b) => b.id);
|
|
55460
|
+
if (reveals === void 0) at2(revealsLiteral.node, "`reveals` names a beat of this scene.");
|
|
55461
|
+
else if (names[0] === reveals)
|
|
55462
|
+
at2(
|
|
55463
|
+
revealsLiteral.node,
|
|
55464
|
+
`\`reveals\` names "${reveals}", the scene's first beat: the poll would never be open. Name a later beat.`
|
|
55465
|
+
);
|
|
55466
|
+
else if (beats && !names.includes(reveals))
|
|
55467
|
+
at2(
|
|
55468
|
+
revealsLiteral.node,
|
|
55469
|
+
`\`reveals\` names "${reveals}", which is not a beat of this scene (${names.join(", ")}).`
|
|
55470
|
+
);
|
|
55471
|
+
}
|
|
55472
|
+
if (id2 !== void 0 && question !== void 0)
|
|
55473
|
+
activity = {
|
|
55474
|
+
id: id2,
|
|
55475
|
+
kind,
|
|
55476
|
+
prompt: question,
|
|
55477
|
+
options,
|
|
55478
|
+
...reveals !== void 0 ? { reveals } : {}
|
|
55479
|
+
};
|
|
55480
|
+
} else if (kind === "text") {
|
|
55481
|
+
if (props.has("reveals"))
|
|
55482
|
+
at2(props.get("reveals").node, "A form can't `reveal`: a form's answers are only stored.");
|
|
55483
|
+
only(
|
|
55484
|
+
new Map([...props].filter(([key2]) => key2 !== "reveals")),
|
|
55485
|
+
["id", "kind", "prompt", "fields"],
|
|
55486
|
+
"A form"
|
|
55487
|
+
);
|
|
55488
|
+
const question = prompt ? short(prompt, "prompt", PROMPT_MAX) : void 0;
|
|
55489
|
+
const fieldsLiteral = props.get("fields");
|
|
55490
|
+
const fields = [];
|
|
55491
|
+
if (!Array.isArray(fieldsLiteral?.value))
|
|
55492
|
+
at2(fieldsLiteral?.node ?? init3, "A form needs 1 to 5 `fields`, as an array of objects.");
|
|
55493
|
+
else {
|
|
55494
|
+
const items = fieldsLiteral.value;
|
|
55495
|
+
if (items.length < 1 || items.length > 5)
|
|
55496
|
+
at2(fieldsLiteral.node, `A form needs 1 to 5 \`fields\`; this one has ${items.length}.`);
|
|
55497
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
55498
|
+
for (const item of items) {
|
|
55499
|
+
if (!(item.value instanceof Map)) {
|
|
55500
|
+
at2(item.node, 'Each field is an object: `{ id: "\u2026", label: "\u2026" }`.');
|
|
55501
|
+
continue;
|
|
55502
|
+
}
|
|
55503
|
+
const field = item.value;
|
|
55504
|
+
only(field, ["id", "label", "multiline", "max"], "A field");
|
|
55505
|
+
const fieldIdLiteral = field.get("id");
|
|
55506
|
+
const fieldId = text3(fieldIdLiteral);
|
|
55507
|
+
if (fieldId === void 0)
|
|
55508
|
+
at2(
|
|
55509
|
+
fieldIdLiteral?.node ?? item.node,
|
|
55510
|
+
"A field needs an `id`: lowercase letters, digits and dashes."
|
|
55511
|
+
);
|
|
55512
|
+
else if (!ACTIVITY_ID.test(fieldId))
|
|
55513
|
+
at2(
|
|
55514
|
+
fieldIdLiteral.node,
|
|
55515
|
+
`Field ID "${fieldId}" must be lowercase letters, digits and dashes.`
|
|
55516
|
+
);
|
|
55517
|
+
else if (seen2.has(fieldId))
|
|
55518
|
+
at2(fieldIdLiteral.node, `Field "${fieldId}" is declared twice in this form.`);
|
|
55519
|
+
else seen2.add(fieldId);
|
|
55520
|
+
const labelLiteral = field.get("label");
|
|
55521
|
+
const label = labelLiteral ? short(labelLiteral, "label", LABEL_MAX) : void 0;
|
|
55522
|
+
if (!labelLiteral) at2(item.node, "A field needs a `label`.");
|
|
55523
|
+
const multiline = field.get("multiline");
|
|
55524
|
+
if (multiline && typeof multiline.value !== "boolean")
|
|
55525
|
+
at2(multiline.node, "`multiline` is true or false.");
|
|
55526
|
+
const max = field.get("max");
|
|
55527
|
+
if (max && (typeof max.value !== "number" || !Number.isInteger(max.value) || max.value < 1 || max.value > FIELD_MAX))
|
|
55528
|
+
at2(max.node, `\`max\` is a whole number of characters from 1 to ${FIELD_MAX}.`);
|
|
55529
|
+
if (fieldId !== void 0 && label !== void 0)
|
|
55530
|
+
fields.push({
|
|
55531
|
+
id: fieldId,
|
|
55532
|
+
label,
|
|
55533
|
+
...multiline?.value === true ? { multiline: true } : {},
|
|
55534
|
+
max: typeof max?.value === "number" ? max.value : TEXT_MAX
|
|
55535
|
+
});
|
|
55536
|
+
}
|
|
55537
|
+
}
|
|
55538
|
+
if (id2 !== void 0)
|
|
55539
|
+
activity = {
|
|
55540
|
+
id: id2,
|
|
55541
|
+
kind,
|
|
55542
|
+
...question !== void 0 ? { prompt: question } : {},
|
|
55543
|
+
fields
|
|
55544
|
+
};
|
|
55545
|
+
} else
|
|
55546
|
+
at2(
|
|
55547
|
+
props.get("kind")?.node ?? init3,
|
|
55548
|
+
'An activity\'s `kind` is "choice" (a poll) or "text" (a form).'
|
|
55549
|
+
);
|
|
55550
|
+
if (problems.length || !activity) return { problems };
|
|
55551
|
+
return { activity: { activity, line: position2(source2, idLiteral.node.start).line }, problems };
|
|
55552
|
+
}
|
|
55305
55553
|
function readCalls(file2, source2, root, problems) {
|
|
55306
55554
|
const media = [];
|
|
55307
55555
|
walk(root, null, {
|
|
@@ -55501,9 +55749,13 @@ function analyzeSvelte(file2, source2, options) {
|
|
|
55501
55749
|
const result = { media: [], problems };
|
|
55502
55750
|
const rules = options.rules ?? {};
|
|
55503
55751
|
if (options.scene) {
|
|
55504
|
-
const
|
|
55752
|
+
const module = ast.module;
|
|
55753
|
+
const beats = readBeats(file2, source2, module);
|
|
55505
55754
|
result.beats = beats.beats;
|
|
55506
55755
|
problems.push(...beats.problems);
|
|
55756
|
+
const activity = readActivity(file2, source2, module, beats.beats);
|
|
55757
|
+
result.activity = activity.activity;
|
|
55758
|
+
problems.push(...activity.problems);
|
|
55507
55759
|
if (rules.layoutRoot) readRoot(file2, source2, ast, problems);
|
|
55508
55760
|
}
|
|
55509
55761
|
Object.assign(result, readCalls(file2, source2, ast, problems));
|
|
@@ -55524,7 +55776,7 @@ function analyzeScript(file2, source2, rules = {}) {
|
|
|
55524
55776
|
readBehaviour(file2, source2, program, problems);
|
|
55525
55777
|
return { ...calls, problems };
|
|
55526
55778
|
}
|
|
55527
|
-
var SIZES, TIMERS, NETWORK, NETWORK_CLASSES, REMOTE, IGNORED_ROOT;
|
|
55779
|
+
var ACTIVITY_ID, PROMPT_MAX, OPTION_MAX, LABEL_MAX, FIELD_MAX, list4, SIZES, TIMERS, NETWORK, NETWORK_CLASSES, REMOTE, IGNORED_ROOT;
|
|
55528
55780
|
var init_analyze2 = __esm({
|
|
55529
55781
|
"../deck/src/analyze.ts"() {
|
|
55530
55782
|
"use strict";
|
|
@@ -55533,7 +55785,14 @@ var init_analyze2 = __esm({
|
|
|
55533
55785
|
init_acorn();
|
|
55534
55786
|
init_compiler();
|
|
55535
55787
|
init_walk();
|
|
55788
|
+
init_activity();
|
|
55536
55789
|
init_tree();
|
|
55790
|
+
ACTIVITY_ID = /^[a-z0-9][a-z0-9-]*$/;
|
|
55791
|
+
PROMPT_MAX = 200;
|
|
55792
|
+
OPTION_MAX = 80;
|
|
55793
|
+
LABEL_MAX = 200;
|
|
55794
|
+
FIELD_MAX = 2e3;
|
|
55795
|
+
list4 = (names) => names.length < 2 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
|
|
55537
55796
|
SIZES = [
|
|
55538
55797
|
/font-size\s*:\s*(\d+(?:\.\d+)?)(px|rem)\b/g,
|
|
55539
55798
|
/(?<![\w-])font\s*:\s*[^;{}"'`]*?\b(\d+(?:\.\d+)?)(px|rem)\b/g,
|
|
@@ -55924,13 +56183,12 @@ async function buildDeck(tree, options = {}) {
|
|
|
55924
56183
|
});
|
|
55925
56184
|
}
|
|
55926
56185
|
const dependencies = deck.dependencies ?? {};
|
|
55927
|
-
const graph = await compileGraph(
|
|
55928
|
-
|
|
55929
|
-
|
|
55930
|
-
|
|
55931
|
-
|
|
55932
|
-
|
|
55933
|
-
);
|
|
56186
|
+
const graph = await compileGraph(tree, sourcesIn(files, ["scenes/", "master/", "lib/"]), {
|
|
56187
|
+
rules,
|
|
56188
|
+
cache: options.cache,
|
|
56189
|
+
scenes: sceneFiles,
|
|
56190
|
+
dependencies
|
|
56191
|
+
});
|
|
55934
56192
|
problems.push(...graph.problems);
|
|
55935
56193
|
for (const path of graph.compiled.keys())
|
|
55936
56194
|
if (path.startsWith("scenes/") && !sceneFiles.has(path) && path.endsWith(".svelte") && !path.slice(7).includes("/"))
|
|
@@ -55953,6 +56211,21 @@ async function buildDeck(tree, options = {}) {
|
|
|
55953
56211
|
severity: "error"
|
|
55954
56212
|
});
|
|
55955
56213
|
}
|
|
56214
|
+
const activityFiles = /* @__PURE__ */ new Map();
|
|
56215
|
+
for (const file2 of sceneFiles) {
|
|
56216
|
+
const found2 = graph.compiled.get(file2)?.analysis.activity;
|
|
56217
|
+
if (!found2) continue;
|
|
56218
|
+
const other = activityFiles.get(found2.activity.id);
|
|
56219
|
+
if (other)
|
|
56220
|
+
problems.push({
|
|
56221
|
+
file: file2,
|
|
56222
|
+
line: found2.line,
|
|
56223
|
+
rule: "activity",
|
|
56224
|
+
message: `Activity "${found2.activity.id}" is declared in ${other} too: activity IDs are unique across the deck.`,
|
|
56225
|
+
severity: "error"
|
|
56226
|
+
});
|
|
56227
|
+
else activityFiles.set(found2.activity.id, file2);
|
|
56228
|
+
}
|
|
55956
56229
|
const stylesheet = masterStylesheet(tree, media, mediaProblems.length ? [] : problems);
|
|
55957
56230
|
if (problems.some((p) => p.severity === "error")) return { problems, modules, deck };
|
|
55958
56231
|
const emitted = emitModules(graph.compiled);
|
|
@@ -55962,12 +56235,14 @@ async function buildDeck(tree, options = {}) {
|
|
|
55962
56235
|
title: chapter.title,
|
|
55963
56236
|
scenes: chapter.scenes.map((scene) => {
|
|
55964
56237
|
const file2 = `scenes/${scene.id}.svelte`;
|
|
56238
|
+
const analysis = graph.compiled.get(file2)?.analysis;
|
|
55965
56239
|
return {
|
|
55966
56240
|
id: scene.id,
|
|
55967
56241
|
title: scene.title,
|
|
55968
56242
|
...scene.note ? { note: scene.note } : {},
|
|
55969
|
-
beats: (
|
|
55970
|
-
module: DECK_PREFIX + file2
|
|
56243
|
+
beats: (analysis?.beats ?? []).map((b) => b.id),
|
|
56244
|
+
module: DECK_PREFIX + file2,
|
|
56245
|
+
...analysis?.activity ? { activity: analysis.activity.activity } : {}
|
|
55971
56246
|
};
|
|
55972
56247
|
})
|
|
55973
56248
|
}));
|
|
@@ -56010,7 +56285,7 @@ function masterStylesheet(tree, media, problems) {
|
|
|
56010
56285
|
);
|
|
56011
56286
|
return { name: `m/${sha256(code).slice(0, 20)}.css`, code };
|
|
56012
56287
|
}
|
|
56013
|
-
var DECK_PREFIX, SOURCE, RUNTIME_PACKAGES, isNotAName;
|
|
56288
|
+
var DECK_PREFIX, SOURCE, RUNTIME_PACKAGES, isNotAName, sourcesIn;
|
|
56014
56289
|
var init_build = __esm({
|
|
56015
56290
|
"../deck/src/build.ts"() {
|
|
56016
56291
|
"use strict";
|
|
@@ -56027,6 +56302,9 @@ var init_build = __esm({
|
|
|
56027
56302
|
SOURCE = /\.(svelte|ts|js|mjs|json)$/;
|
|
56028
56303
|
RUNTIME_PACKAGES = /* @__PURE__ */ new Set(["svelte", "gsap", "@tobos/present"]);
|
|
56029
56304
|
isNotAName = (segment) => segment === "" || segment === "." || segment === "..";
|
|
56305
|
+
sourcesIn = (files, folders) => [...files].filter(
|
|
56306
|
+
(f) => folders.some((folder) => f.startsWith(folder)) && SOURCE.test(f) && !f.endsWith(".json")
|
|
56307
|
+
);
|
|
56030
56308
|
}
|
|
56031
56309
|
});
|
|
56032
56310
|
|
|
@@ -56036,11 +56314,21 @@ var init_master = __esm({
|
|
|
56036
56314
|
"use strict";
|
|
56037
56315
|
init_define_TOBOS_PRESENT_TYPES();
|
|
56038
56316
|
init_define_TOBOS_SKILL();
|
|
56317
|
+
init_build();
|
|
56039
56318
|
init_deck_json();
|
|
56040
56319
|
init_tree();
|
|
56041
56320
|
}
|
|
56042
56321
|
});
|
|
56043
56322
|
|
|
56323
|
+
// ../deck/src/share.ts
|
|
56324
|
+
var init_share = __esm({
|
|
56325
|
+
"../deck/src/share.ts"() {
|
|
56326
|
+
"use strict";
|
|
56327
|
+
init_define_TOBOS_PRESENT_TYPES();
|
|
56328
|
+
init_define_TOBOS_SKILL();
|
|
56329
|
+
}
|
|
56330
|
+
});
|
|
56331
|
+
|
|
56044
56332
|
// ../deck/src/format-problems.ts
|
|
56045
56333
|
function formatProblems(problems) {
|
|
56046
56334
|
return problems.map((p) => {
|
|
@@ -56067,6 +56355,8 @@ var init_src4 = __esm({
|
|
|
56067
56355
|
init_master();
|
|
56068
56356
|
init_tree();
|
|
56069
56357
|
init_hash();
|
|
56358
|
+
init_activity();
|
|
56359
|
+
init_share();
|
|
56070
56360
|
init_format_problems();
|
|
56071
56361
|
}
|
|
56072
56362
|
});
|
|
@@ -56175,7 +56465,8 @@ function writeConfig(root) {
|
|
|
56175
56465
|
}
|
|
56176
56466
|
const rel = (path) => relative2(dir2, path).split("\\").join("/");
|
|
56177
56467
|
const paths = {
|
|
56178
|
-
"@tobos/present": [rel(join7(dir2, "present", "index.d.ts"))]
|
|
56468
|
+
"@tobos/present": [rel(join7(dir2, "present", "index.d.ts"))],
|
|
56469
|
+
"@tobos/deck/types": [rel(join7(dir2, "present", "deck", "types.d.ts"))]
|
|
56179
56470
|
};
|
|
56180
56471
|
const config = join7(dir2, "tsconfig.json");
|
|
56181
56472
|
writeFileSync5(
|
|
@@ -56517,7 +56808,7 @@ function settings() {
|
|
|
56517
56808
|
|
|
56518
56809
|
// src/api.ts
|
|
56519
56810
|
init_out();
|
|
56520
|
-
var VERSION = true ? "0.
|
|
56811
|
+
var VERSION = true ? "0.4.0" : "dev";
|
|
56521
56812
|
function newer(a, b) {
|
|
56522
56813
|
const parse9 = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n2) => parseInt(n2)) : null;
|
|
56523
56814
|
const x = parse9(a);
|
|
@@ -57248,6 +57539,66 @@ async function openApp(out, args) {
|
|
|
57248
57539
|
This link logs a browser in once, within 10 minutes.`
|
|
57249
57540
|
);
|
|
57250
57541
|
}
|
|
57542
|
+
async function storyTx(id2, ops) {
|
|
57543
|
+
try {
|
|
57544
|
+
return await api(`/api/decks/${id2}/story/tx`, {
|
|
57545
|
+
body: { ops, agent: process.env.TOBOS_AGENT || void 0 }
|
|
57546
|
+
});
|
|
57547
|
+
} catch (error) {
|
|
57548
|
+
if (error instanceof CliError && error.extra.status === 409) {
|
|
57549
|
+
const now = error.extra.paragraph;
|
|
57550
|
+
throw new CliError(
|
|
57551
|
+
now ? `${error.message}
|
|
57552
|
+
It is now:
|
|
57553
|
+
\xB6 ${now.id} ${now.text}` : error.message,
|
|
57554
|
+
EXIT.conflict,
|
|
57555
|
+
error.extra
|
|
57556
|
+
);
|
|
57557
|
+
}
|
|
57558
|
+
throw error;
|
|
57559
|
+
}
|
|
57560
|
+
}
|
|
57561
|
+
async function story(out, args) {
|
|
57562
|
+
const [action, ...rest2] = args.positionals;
|
|
57563
|
+
const id2 = await deckId(args);
|
|
57564
|
+
if (!action) {
|
|
57565
|
+
const story2 = await api(`/api/decks/${id2}/story`);
|
|
57566
|
+
out.result(
|
|
57567
|
+
{ ...story2 },
|
|
57568
|
+
() => story2.paragraphs.length ? story2.paragraphs.map((p) => `\xB6 ${p.id.padEnd(4)} ${p.text}`).join("\n\n") : 'No story yet. `tobos story add "\u2026"` writes its first paragraph.'
|
|
57569
|
+
);
|
|
57570
|
+
return;
|
|
57571
|
+
}
|
|
57572
|
+
if (action === "edit") {
|
|
57573
|
+
const [paragraph, find, replace] = rest2;
|
|
57574
|
+
if (!paragraph || find === void 0 || replace === void 0)
|
|
57575
|
+
throw new CliError(
|
|
57576
|
+
'`tobos story edit <\xB6 id> "the exact text" "what replaces it"` (`tobos story` shows the ids).'
|
|
57577
|
+
);
|
|
57578
|
+
const result = await storyTx(id2, [{ op: "set", id: paragraph, find, replace }]);
|
|
57579
|
+
out.result({ ...result, paragraph }, () => `Changed ${paragraph}.`);
|
|
57580
|
+
return;
|
|
57581
|
+
}
|
|
57582
|
+
if (action === "add") {
|
|
57583
|
+
const text3 = rest2.join(" ").trim();
|
|
57584
|
+
if (!text3) throw new CliError('`tobos story add [--after <\xB6 id>] "the paragraph"`.');
|
|
57585
|
+
const after = args.values.after ?? "end";
|
|
57586
|
+
const result = await storyTx(id2, [
|
|
57587
|
+
{ op: "insert", after: after === "start" ? null : after, text: text3, key: "new:1" }
|
|
57588
|
+
]);
|
|
57589
|
+
const paragraph = result.ids["new:1"] ?? null;
|
|
57590
|
+
out.result({ ...result, paragraph }, () => `Added ${paragraph}.`);
|
|
57591
|
+
return;
|
|
57592
|
+
}
|
|
57593
|
+
if (action === "delete") {
|
|
57594
|
+
const paragraph = rest2[0];
|
|
57595
|
+
if (!paragraph) throw new CliError("`tobos story delete <\xB6 id>`.");
|
|
57596
|
+
const result = await storyTx(id2, [{ op: "delete", id: paragraph }]);
|
|
57597
|
+
out.result({ ...result, paragraph }, () => `Deleted ${paragraph}.`);
|
|
57598
|
+
return;
|
|
57599
|
+
}
|
|
57600
|
+
throw new CliError(`No \`tobos story ${action}\`: edit, add or delete.`);
|
|
57601
|
+
}
|
|
57251
57602
|
async function exportTarget(args, file2) {
|
|
57252
57603
|
if (args.values.out) return resolve3(args.values.out);
|
|
57253
57604
|
const deck = await findDeck().catch(() => void 0);
|
|
@@ -57377,6 +57728,15 @@ Looking at it (from the working copy, render and open push what changed first)
|
|
|
57377
57728
|
tobos open outside a deck: Tobos in the browser, logged in
|
|
57378
57729
|
tobos export pdf [--out file] a PDF of every beat
|
|
57379
57730
|
|
|
57731
|
+
The story (what the speaker says, held by the server; a scene mentioned: [Title](scene:<id>),
|
|
57732
|
+
a beat: [Title](scene:<id>/<beat>))
|
|
57733
|
+
tobos story the text, by \xB6 id
|
|
57734
|
+
tobos story edit <\xB6> "old" "new" change it, anchored on the exact text
|
|
57735
|
+
tobos story add [--after <\xB6>] "\u2026" a new paragraph (at the end, or after \xB6)
|
|
57736
|
+
tobos story delete <\xB6> a paragraph goes
|
|
57737
|
+
TOBOS_AGENT=<name> says which agent you are: the
|
|
57738
|
+
deck's page marks what you wrote
|
|
57739
|
+
|
|
57380
57740
|
The skill (what your harness reads to know Tobos without this help)
|
|
57381
57741
|
tobos skill install put it where Claude Code, Codex, OpenCode and others
|
|
57382
57742
|
read skills; later CLIs keep it up to date
|
|
@@ -57387,7 +57747,8 @@ Templates (decks people start from: a new deck copies a template's master/)
|
|
|
57387
57747
|
tobos new "Our brand" --template a new template: a copy of your default (or of --from)
|
|
57388
57748
|
|
|
57389
57749
|
Every command takes --json and then prints one JSON object.
|
|
57390
|
-
Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in
|
|
57750
|
+
Exit codes: 0 ok, 1 error, 2 the deck has problems, 3 not logged in, 4 the story changed
|
|
57751
|
+
meanwhile (the reply has the paragraph as it is now: anchor on that and try again).
|
|
57391
57752
|
`;
|
|
57392
57753
|
var COMMON = {
|
|
57393
57754
|
json: { type: "boolean" },
|
|
@@ -57431,6 +57792,10 @@ var TABLE = {
|
|
|
57431
57792
|
}
|
|
57432
57793
|
},
|
|
57433
57794
|
skill: { run: skill },
|
|
57795
|
+
story: {
|
|
57796
|
+
run: story,
|
|
57797
|
+
options: { deck: { type: "string" }, after: { type: "string" } }
|
|
57798
|
+
},
|
|
57434
57799
|
render: {
|
|
57435
57800
|
run: render,
|
|
57436
57801
|
options: {
|