@tobos/cli 0.4.10 → 0.4.11
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 +70 -17
- package/package.json +1 -1
package/dist/tobos.js
CHANGED
|
@@ -47,9 +47,9 @@ 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 * a frame decoded, and that frame handed to the screen again (`repaint`). Videos that won't load\n * don't hold it up.\n */\nexport declare function videoFramesReady(root: Element): Promise<void>;\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 /**\n * The most phones that had the deck's join link open at once during this show, and never fewer\n * than answered.\n */\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 * Whether the scene timeline that holds this animation is playing a step forward that may be\n * heard: one this window was moved to itself, not one it follows from another window.\n */\nexport declare function playingAloud(animation: gsap.core.Animation): boolean;\n/**\n * A sound that plays on through a range of a scene's beats, from the one that starts it up to,\n * not including, the one it stops at (playAudio's `until`).\n */\nexport interface Span {\n /** Play it from its start, heard. */\n start(): void;\n /** Stop it, fading it out or at once; resolves once it is silent. */\n stop(fade: boolean): Promise<void>;\n}\n/**\n * Add a span to the scene `tl` is the timeline of, while one of its beats' `enter` runs: from\n * that beat up to the one `until` names. False where `until` names no later beat of the scene.\n */\nexport declare function addSpan(tl: gsap.core.Timeline, until: string, span: Span): boolean;\n/**\n * One scene's beats as one paused GSAP timeline, with a label after each beat's animation.\n * Stepping forward tweens the playhead to the next label; everything else seeks.\n */\nexport declare class SceneTimeline {\n readonly timeline: gsap.core.Timeline;\n private labels;\n private tween;\n /** Whether the step playing may be heard. */\n aloud: boolean;\n private ids;\n /** The beat whose `enter` is running, while the timeline is built. */\n private building;\n private spans;\n /** The spans' stops still fading out. */\n private fades;\n constructor(root: Element, beats: readonly Beat[]);\n addSpan(until: string, span: Span): boolean;\n /**\n * Whether a span is still fading out: a scene leaving the stage is unmounted once it is\n * silent, since its sound goes with its elements.\n */\n get fading(): Promise<void> | null;\n get playing(): boolean;\n /** Finish the beat that is playing, at once. */\n finish(): void;\n /** Before the first beat: the scene waiting for its entrance. */\n hold(): void;\n /** The scene has left the stage: its spans fade out. */\n leave(): void;\n /**\n * After a move to `beat` (-1: none), each span plays on while the beat is in its range,\n * whichever way it moved there, and fades out outside it. Only a step forward onto its first\n * beat, heard, starts it.\n */\n private sound;\n /**\n * Show a beat: play the animation into it, or land on its end state. `aloud`: whether its\n * sound plays, or the step plays silent.\n */\n show(beat: number, animate: boolean, aloud?: boolean): void;\n /** Put the playhead part-way through the animation into a beat (0..1), for filmstrips. */\n sample(beat: number, progress: number): void;\n /** How long the animation into a beat takes, in seconds. */\n duration(beat: number): number;\n kill(): void;\n}\n", "playback.d.ts": "interface ClipOptions {\n /** Where the clip starts in the video or sound, in seconds. Default 0. */\n from?: number;\n /** Where the clip ends in the video or sound, in seconds. Default: its end. */\n to?: number;\n /** Speed: 1 is real time, 0.5 half speed. Default 1. */\n rate?: number;\n /**\n * When the clip starts within the beat: GSAP's position parameter (`'<'`, `'+=0.5'`, a\n * number). Default: after what the beat has animated so far, like any `tl.to`.\n */\n position?: gsap.Position;\n}\nexport interface PlayAudioOptions extends ClipOptions {\n /**\n * The beat the sound plays until. It plays on through the beats before it, whichever way the\n * presenter moves among them, and fades out when this beat or one outside the range is shown,\n * or the scene is left. The beat it starts in doesn't wait for it, and `to` and `position`\n * don't apply: it plays from `from` to its end, or until then.\n */\n until?: string;\n /** With `until`: how long it fades out, in seconds. Default 1; 0 stops it at once. */\n fade?: number;\n}\nexport interface PlayVideoOptions extends ClipOptions {\n /** Play the video's own sound with it. Default: muted. */\n sound?: boolean;\n}\n/**\n * Play a video (or the clip `from`\u2013`to` of it) as part of a beat. Stepping forward plays it in\n * real time; going back, jumping or reloading shows the frame for that position at once; a\n * click while it plays lands on its last frame. Before its beat it shows the clip's first frame.\n *\n * ```ts\n * { id: 'turn', enter: (tl, q) => playVideo(tl, q('video')) }\n * ```\n *\n * The video plays inline and preloads, and is muted unless `sound` is set. Several videos\n * (`q('video')` finding more than one) play side by side, each its own length.\n */\nexport declare function playVideo(tl: gsap.core.Timeline, target: Element | ArrayLike<Element> | null | undefined, options?: PlayVideoOptions): gsap.core.Timeline;\n/**\n * Play a sound (or the clip `from`\u2013`to` of it) as part of a beat. Stepping forward plays it in\n * real time; a click while it plays stops it and plays the next beat; going back, jumping or\n * reloading is silent. So is a scene mounted ahead, and a window that only follows another.\n *\n * ```ts\n * { id: 'listen', enter: (tl, q) => playAudio(tl, q('audio')) }\n * ```\n *\n * The sound preloads. Several (`q('audio')` finding more than one) play together, each its own\n * length.\n */\nexport declare function playAudio(tl: gsap.core.Timeline, target: Element | ArrayLike<Element> | null | undefined, options?: PlayAudioOptions): gsap.core.Timeline;\n/**\n * Call `listener` each time the browser refuses this window sound, until a click or key press\n * in it lets it play. Returns a function that stops listening.\n */\nexport declare function onSoundRefused(listener: () => void): () => void;\n/**\n * Wait until the videos and sounds inside `root` know their length, so `playVideo` and\n * `playAudio` can size their clips when the scene's timeline is built. Those that won't load (no\n * source, `preload=\"none\"`, an error) don't hold it up, nor does anything past `timeout`.\n */\nexport declare function mediaKnowTheirLength(root: Element, timeout?: number): Promise<void>;\n/**\n * Wait until every video inside `root` shows the frame it was last sought to: no seek pending,\n * a frame decoded, and that frame handed to the screen again (`repaint`). Videos that won't load\n * don't hold it up.\n */\nexport declare function videoFramesReady(root: Element): Promise<void>;\nexport {};\n", "deck/types.d.ts": "export type Severity = 'error' | 'warning';\n/** One thing wrong with a deck. Lines and columns are 1-based. */\nexport interface Problem {\n file: string;\n line?: number;\n column?: number;\n rule: string;\n message: string;\n severity: Severity;\n}\nexport interface DeckScene {\n id: string;\n title: string;\n}\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 /**\n * The most phones that had the deck's join link open at once during this show, and never fewer\n * than answered.\n */\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
|
-
export { playVideo, type PlayVideoOptions } from './
|
|
52
|
+
export { playAudio, playVideo, type PlayAudioOptions, type PlayVideoOptions } from './playback.ts';
|
|
53
53
|
export { useResponses, type Responses } from './responses.svelte.ts';
|
|
54
54
|
export type { Activity, ChoiceActivity, TextActivity, TextField } from '@tobos/deck/types';
|
|
55
55
|
/** Finds elements inside the current scene only. */
|
|
@@ -55844,6 +55844,7 @@ function readBeats(file2, source2, module) {
|
|
|
55844
55844
|
return { problems };
|
|
55845
55845
|
}
|
|
55846
55846
|
const beats = [];
|
|
55847
|
+
const read2 = [];
|
|
55847
55848
|
const seen2 = /* @__PURE__ */ new Set();
|
|
55848
55849
|
for (const element2 of list5.elements) {
|
|
55849
55850
|
const beat = unwrap(element2 ?? void 0);
|
|
@@ -55877,7 +55878,9 @@ function readBeats(file2, source2, module) {
|
|
|
55877
55878
|
}
|
|
55878
55879
|
seen2.add(id2);
|
|
55879
55880
|
beats.push({ id: id2, line: position2(source2, value.start).line });
|
|
55881
|
+
read2.push(beat);
|
|
55880
55882
|
}
|
|
55883
|
+
read2.forEach((beat, index) => readUntil(beat, index, beats, at2));
|
|
55881
55884
|
if (beats.length === 0 && problems.length === 0) at2(list5, "A scene needs at least one beat.");
|
|
55882
55885
|
if (beats.length > BEATS_MAX)
|
|
55883
55886
|
at2(
|
|
@@ -55886,6 +55889,40 @@ function readBeats(file2, source2, module) {
|
|
|
55886
55889
|
);
|
|
55887
55890
|
return { beats, problems };
|
|
55888
55891
|
}
|
|
55892
|
+
function readUntil(beat, index, beats, at2) {
|
|
55893
|
+
walk(beat, null, {
|
|
55894
|
+
CallExpression(node, { next: next2 }) {
|
|
55895
|
+
const callee = node.callee;
|
|
55896
|
+
const named = callee.type === "Identifier" && callee.name === "playAudio" || callee.type === "MemberExpression" && callee.property.type === "Identifier" && callee.property.name === "playAudio";
|
|
55897
|
+
const options = unwrap(node.arguments[2]);
|
|
55898
|
+
const until = named && options?.type === "ObjectExpression" ? options.properties.find(
|
|
55899
|
+
(p) => p.type === "Property" && !p.computed && (p.key.type === "Identifier" && p.key.name === "until" || p.key.type === "Literal" && p.key.value === "until")
|
|
55900
|
+
) : void 0;
|
|
55901
|
+
const value = unwrap(until?.value);
|
|
55902
|
+
if (until && value) {
|
|
55903
|
+
const id2 = value.type === "Literal" ? value.value : void 0;
|
|
55904
|
+
const names = beats.map((b) => b.id);
|
|
55905
|
+
const later = names.slice(index + 1);
|
|
55906
|
+
if (typeof id2 !== "string")
|
|
55907
|
+
at2(
|
|
55908
|
+
value,
|
|
55909
|
+
"`until` must be a string literal naming a later beat of this scene, so Tobos can check it."
|
|
55910
|
+
);
|
|
55911
|
+
else if (!names.includes(id2))
|
|
55912
|
+
at2(
|
|
55913
|
+
value,
|
|
55914
|
+
`\`until\` names "${id2}", which is not a beat of this scene (${names.join(", ")}).`
|
|
55915
|
+
);
|
|
55916
|
+
else if (!later.includes(id2))
|
|
55917
|
+
at2(
|
|
55918
|
+
value,
|
|
55919
|
+
`\`until\` names "${id2}", which doesn't come after "${names[index]}", where the sound starts: it would never play. Name a later beat${later.length ? ` (${later.join(", ")})` : ", or add one"}.`
|
|
55920
|
+
);
|
|
55921
|
+
}
|
|
55922
|
+
next2();
|
|
55923
|
+
}
|
|
55924
|
+
});
|
|
55925
|
+
}
|
|
55889
55926
|
function readLiteral(node) {
|
|
55890
55927
|
const value = unwrap(node);
|
|
55891
55928
|
if (value.type === "Literal" && ["string", "number", "boolean"].includes(typeof value.value))
|
|
@@ -58062,7 +58099,7 @@ function settings() {
|
|
|
58062
58099
|
|
|
58063
58100
|
// src/api.ts
|
|
58064
58101
|
init_out();
|
|
58065
|
-
var VERSION = true ? "0.4.
|
|
58102
|
+
var VERSION = true ? "0.4.11" : "dev";
|
|
58066
58103
|
function newer(a, b) {
|
|
58067
58104
|
const parse9 = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n2) => parseInt(n2)) : null;
|
|
58068
58105
|
const x = parse9(a);
|
|
@@ -58334,8 +58371,14 @@ var TYPES = {
|
|
|
58334
58371
|
".mov": "video/quicktime",
|
|
58335
58372
|
".mp3": "audio/mpeg",
|
|
58336
58373
|
".m4a": "audio/mp4",
|
|
58337
|
-
".
|
|
58374
|
+
".aac": "audio/aac",
|
|
58375
|
+
".opus": "audio/ogg",
|
|
58338
58376
|
".ogg": "audio/ogg",
|
|
58377
|
+
".weba": "audio/webm",
|
|
58378
|
+
".flac": "audio/flac",
|
|
58379
|
+
".wav": "audio/wav",
|
|
58380
|
+
".aif": "audio/aiff",
|
|
58381
|
+
".aiff": "audio/aiff",
|
|
58339
58382
|
".pdf": "application/pdf",
|
|
58340
58383
|
".glb": "model/gltf-binary",
|
|
58341
58384
|
".gltf": "model/gltf+json",
|
|
@@ -58345,6 +58388,19 @@ var TYPES = {
|
|
|
58345
58388
|
".vtt": "text/vtt",
|
|
58346
58389
|
".txt": "text/plain"
|
|
58347
58390
|
};
|
|
58391
|
+
var LOSSLESS = /\.(wav|aiff?|flac)$/i;
|
|
58392
|
+
var shellWord = (path) => /^[\w./-]+$/.test(path) ? path : `'${path.replaceAll("'", "'\\''")}'`;
|
|
58393
|
+
function sizeNote(name, size) {
|
|
58394
|
+
const mb = Math.round(size / 1e6);
|
|
58395
|
+
if (LOSSLESS.test(name) && size > 1e6) {
|
|
58396
|
+
const from = shellWord(`media/${name}`);
|
|
58397
|
+
const to = shellWord(`media/${name.replace(LOSSLESS, ".m4a")}`);
|
|
58398
|
+
return `note: media/${name} is lossless sound, ${mb} MB. As AAC it takes a fraction of that, and sounds the same in a room: ffmpeg -i ${from} -c:a aac -b:a 128k ${to}`;
|
|
58399
|
+
}
|
|
58400
|
+
if (size > 25e6)
|
|
58401
|
+
return `note: media/${name} is ${mb} MB. Every viewer downloads it; size it for the stage.`;
|
|
58402
|
+
return void 0;
|
|
58403
|
+
}
|
|
58348
58404
|
function hashFile(path) {
|
|
58349
58405
|
return new Promise((resolve4, reject) => {
|
|
58350
58406
|
const hash2 = createHash2("sha256");
|
|
@@ -58612,20 +58668,19 @@ async function login(out, args) {
|
|
|
58612
58668
|
save({ email: me.email });
|
|
58613
58669
|
out.result({ email: me.email, server }, () => `Logged in as ${me.email}.`);
|
|
58614
58670
|
}
|
|
58615
|
-
async function logout(out
|
|
58616
|
-
const everywhere = Boolean(args.values.everywhere);
|
|
58671
|
+
async function logout(out) {
|
|
58617
58672
|
let revoked = false;
|
|
58618
58673
|
if (settings().token)
|
|
58619
58674
|
try {
|
|
58620
|
-
await api("/api/logout", { method: "POST", body:
|
|
58675
|
+
await api("/api/logout", { method: "POST", body: {} });
|
|
58621
58676
|
revoked = true;
|
|
58622
58677
|
} catch (error) {
|
|
58623
58678
|
out.note(`(couldn't revoke the token on the server: ${error.message})`, true);
|
|
58624
58679
|
}
|
|
58625
58680
|
forget();
|
|
58626
58681
|
out.result(
|
|
58627
|
-
{ loggedOut: true, revoked
|
|
58628
|
-
() =>
|
|
58682
|
+
{ loggedOut: true, revoked },
|
|
58683
|
+
() => revoked ? "Logged out. The token no longer works anywhere." : "Logged out on this machine; the server still knows the token."
|
|
58629
58684
|
);
|
|
58630
58685
|
}
|
|
58631
58686
|
async function whoami(out) {
|
|
@@ -58810,12 +58865,10 @@ async function pushWorkingCopy(out, deck, message) {
|
|
|
58810
58865
|
const result = await runCheck(deck);
|
|
58811
58866
|
const { errors, warnings: warnings2 } = problemSummary(result.problems);
|
|
58812
58867
|
if (errors > 0) return { ok: false, errors, warnings: warnings2, problems: result.problems };
|
|
58813
|
-
for (const [name, entry] of Object.entries(media))
|
|
58814
|
-
|
|
58815
|
-
|
|
58816
|
-
|
|
58817
|
-
true
|
|
58818
|
-
);
|
|
58868
|
+
for (const [name, entry] of Object.entries(media)) {
|
|
58869
|
+
const note = sizeNote(name, entry.size);
|
|
58870
|
+
if (note) out.note(note, true);
|
|
58871
|
+
}
|
|
58819
58872
|
const uploaded = await uploadMedia(root, media, server, deck.id, (m) => out.note(m));
|
|
58820
58873
|
await gitOk(["add", "-A"], { cwd: root });
|
|
58821
58874
|
const committed = (await gitOk(["diff", "--cached", "--name-only"], { cwd: root })).split("\n").filter(Boolean);
|
|
@@ -59135,7 +59188,7 @@ var HELP = `tobos ${VERSION}: the command line of Tobos, the office suite your c
|
|
|
59135
59188
|
Account
|
|
59136
59189
|
tobos login <email> [--server URL] e-mail a login code to the person (signs them up if new)
|
|
59137
59190
|
tobos login --code <code> finish: the code they read from the mail
|
|
59138
|
-
tobos logout
|
|
59191
|
+
tobos logout forget this machine's token
|
|
59139
59192
|
tobos whoami who you are, on which server
|
|
59140
59193
|
tobos decks your decks and templates, by id, and those shared
|
|
59141
59194
|
with you; an archived one is read-only
|
|
@@ -59196,7 +59249,7 @@ var TABLE = {
|
|
|
59196
59249
|
run: login,
|
|
59197
59250
|
options: { server: { type: "string" }, code: { type: "string" } }
|
|
59198
59251
|
},
|
|
59199
|
-
logout: { run: logout
|
|
59252
|
+
logout: { run: logout },
|
|
59200
59253
|
whoami: { run: whoami },
|
|
59201
59254
|
decks: { run: decks },
|
|
59202
59255
|
new: {
|