@tobos/cli 0.4.7 → 0.4.9
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 +2 -2
- package/package.json +1 -1
package/dist/tobos.js
CHANGED
|
@@ -47,7 +47,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
47
47
|
var define_TOBOS_PRESENT_TYPES_default;
|
|
48
48
|
var init_define_TOBOS_PRESENT_TYPES = __esm({
|
|
49
49
|
"<define:TOBOS_PRESENT_TYPES>"() {
|
|
50
|
-
define_TOBOS_PRESENT_TYPES_default = { "registry.d.ts": "/** State the viewer sets up before any scene loads, and the scene API reads. */\nexport declare function setMedia(media: Record<string, {\n hash: string;\n}>): void;\nexport declare function mediaUrl(name: string): string;\n/** The deck's join code, and the ways to show it. */\nexport interface JoinInfo {\n /** The six digits: `482913`. */\n code: string;\n /** The link as people type it, without the scheme: `tobosusercontent.com/482913`. */\n link: string;\n /** The full URL the QR code holds: `https://tobosusercontent.com/482913`. */\n url: string;\n /** The QR code, black on white, as an image's address: `<img src={join.qr} />`. */\n qr: string;\n}\nexport declare function setJoin(info: JoinInfo | undefined): void;\nexport declare function joinInfo(): JoinInfo | undefined;\n/** Whether this is a share link's page, for people outside the deck's account. */\nexport declare function setShared(value: boolean): void;\nexport declare function isShared(): boolean;\n", "timeline.d.ts": "import type { Beat } from './index.ts';\n/**\n * Whether the scene timeline that holds this animation is playing a step forward, in real\n * time, as opposed to being sought (a jump, a step back, a finish, a still view or a render).\n */\nexport declare function playingForward(animation: gsap.core.Animation): boolean;\n/**\n * One scene's beats as one paused GSAP timeline, with a label after each beat's animation.\n * Stepping forward tweens the playhead to the next label; everything else seeks.\n */\nexport declare class SceneTimeline {\n readonly timeline: gsap.core.Timeline;\n private labels;\n private tween;\n constructor(root: Element, beats: readonly Beat[]);\n get playing(): boolean;\n /** Finish the beat that is playing, at once. */\n finish(): void;\n /** Before the first beat: the scene waiting for its entrance. */\n hold(): void;\n /** Show a beat: play the animation into it, or land on its end state. */\n show(beat: number, animate: boolean): void;\n /** Put the playhead part-way through the animation into a beat (0..1), for filmstrips. */\n sample(beat: number, progress: number): void;\n /** How long the animation into a beat takes, in seconds. */\n duration(beat: number): number;\n kill(): void;\n}\n", "video.d.ts": "export interface PlayVideoOptions {\n /** Where the clip starts in the video, in seconds. Default 0. */\n from?: number;\n /** Where the clip ends in the video, in seconds. Default: the end of the video. */\n to?: number;\n /** Speed: 1 is real time, 0.5 half speed. Default 1. */\n rate?: number;\n /**\n * When the clip starts within the beat: GSAP's position parameter (`'<'`, `'+=0.5'`, a\n * number). Default: after what the beat has animated so far, like any `tl.to`.\n */\n position?: gsap.Position;\n}\n/**\n * Play a video (or the clip `from`\u2013`to` of it) as part of a beat. Stepping forward plays it in\n * real time; going back, jumping or reloading shows the frame for that position at once; a\n * click while it plays lands on its last frame. Before its beat it shows the clip's first frame.\n *\n * ```ts\n * { id: 'turn', enter: (tl, q) => playVideo(tl, q('video')) }\n * ```\n *\n * The video is muted, plays inline and preloads. Several videos (`q('video')` finding more\n * than one) play side by side, each its own length.\n */\nexport declare function playVideo(tl: gsap.core.Timeline, target: Element | ArrayLike<Element> | null | undefined, options?: PlayVideoOptions): gsap.core.Timeline;\n/**\n * Wait until the videos inside `root` know their length, so `playVideo` can size their clips\n * when the scene's timeline is built. Videos that won't load (no source, `preload=\"none\"`, an\n * error) don't hold it up, nor does anything past `timeout`.\n */\nexport declare function videosKnowTheirLength(root: Element, timeout?: number): Promise<void>;\n/**\n * Wait until every video inside `root` shows the frame it was last sought to: no seek pending,\n * and a frame decoded. Videos that won't load don't hold it up.\n */\nexport declare function videoFramesReady(root: Element): Promise<void>;\n", "deck/types.d.ts": "export type Severity = 'error' | 'warning';\n/** One thing wrong with a deck. Lines and columns are 1-based. */\nexport interface Problem {\n file: string;\n line?: number;\n column?: number;\n rule: string;\n message: string;\n severity: Severity;\n}\nexport interface DeckScene {\n id: string;\n title: string;\n}\nexport interface DeckChapter {\n id: string;\n title: string;\n scenes: DeckScene[];\n}\n/** deck.json */\nexport interface DeckJson {\n title: string;\n chapters: DeckChapter[];\n dependencies?: Record<string, string>;\n}\nexport interface MediaEntry {\n hash: string;\n size: number;\n type: string;\n}\n/** media.json: path inside media/ \u2192 the file's content hash. */\nexport type MediaJson = Record<string, MediaEntry>;\n/** A poll: each phone picks one option. Its result shows on the projector from `reveals` on. */\nexport interface ChoiceActivity {\n id: string;\n kind: 'choice';\n prompt: string;\n options: string[];\n /** The beat of its scene that closes the poll and shows its result. */\n reveals?: string;\n}\nexport interface TextField {\n id: string;\n label: string;\n multiline?: boolean;\n /** The most characters it takes. 500 unless the scene says otherwise; in a manifest, always set. */\n max?: number;\n}\n/** A form: each phone fills in its fields. The answers are only stored. */\nexport interface TextActivity {\n id: string;\n kind: 'text';\n prompt?: string;\n fields: TextField[];\n}\n/**\n * Something the room responds to on their phones, declared by a scene. It is open while the\n * deck is presented on its scene, up to its `reveals` beat.\n */\nexport type Activity = ChoiceActivity | TextActivity;\nexport interface ManifestScene {\n id: string;\n title: string;\n beats: string[];\n /** The scene's specifier in the import map. */\n module: string;\n activity?: Activity;\n}\nexport interface ManifestChapter {\n id: string;\n title: string;\n scenes: ManifestScene[];\n}\n/** What the viewer needs to show one revision of a deck. */\nexport interface Manifest {\n format: 1;\n title: string;\n chapters: ManifestChapter[];\n /**\n * Deck specifiers (`@deck/scenes/a.svelte`) \u2192 module paths relative to the viewer (`m/<hash>.js`).\n * The server adds the package specifiers once it has bundled them (`d3` \u2192 `p/<bundle>/d3.js`).\n */\n imports: Record<string, string>;\n media: MediaJson;\n /** deck.json's dependencies: package \u2192 exact version. */\n dependencies: Record<string, string>;\n /** The package specifiers the deck imports, by dependency: `{ three: ['three', 'three/addons/\u2026'] }`. */\n packages: Record<string, string[]>;\n /**\n * Stylesheets, relative to the viewer: the master's tokens.css (`m/<hash>.css`), then those of\n * the packages it imports (`p/<bundle>/katex/dist/katex.min.css`), which the server adds.\n */\n styles?: string[];\n /**\n * What the deck's code uses of the deck, so a share gets only what the scenes it shows reach\n * (share.ts). Not in a manifest pushed before the build recorded it, which sharedManifest()\n * shares as it did then.\n */\n uses?: Uses;\n}\n/** What each of a deck's modules uses of the deck itself, and what its stylesheet does. */\nexport interface Uses {\n /**\n * By specifier (`@deck/scenes/a.svelte`): the deck's modules it imports, statically or not; the\n * media.json names its media() calls name; and their patterns (`frames/*.png`), which a share\n * matches against media.json, so a pattern is here once, not as every name it matches. Each is\n * left out when it has none.\n */\n modules: Record<string, {\n imports?: string[];\n media?: string[];\n patterns?: string[];\n }>;\n /** The media.json names tokens.css links, which every page that shows the deck loads. */\n styles: string[];\n}\n/** A deck's files, from a directory or from a git revision. Paths use `/` and have no leading slash. */\nexport interface DeckTree {\n files(): string[];\n read(path: string): Uint8Array | undefined;\n}\n", "activities.d.ts": "/** What the server tells about a deck's activities: phones what is open, the projector the results. */\n/** An activity as a phone needs it: no more. */\nexport type PhoneActivity = {\n id: string;\n kind: 'choice';\n prompt: string;\n options: string[];\n} | {\n id: string;\n kind: 'text';\n prompt?: string;\n fields: {\n id: string;\n label: string;\n multiline?: boolean;\n max: number;\n }[];\n};\n/** Nothing live, or the show and its open activity, if any. */\nexport type PhoneState = {\n live: false;\n} | {\n live: true;\n show: string;\n activity: PhoneActivity | null;\n};\n/** What the projector hears: the show, and every activity answered in it. */\nexport interface Results {\n show: string | null;\n joined: number;\n activities: Record<string, {\n answered: number;\n counts?: number[];\n }>;\n}\n", "viewer/stream.d.ts": "/**\n * A server-sent events stream that outlasts the server going away. EventSource reconnects by\n * itself only when a connection drops; when a reconnect is answered with an error, as the proxy\n * answers 502 while the app restarts for a release, it gives up for good. This one opens it\n * again, waiting longer each time, up to a minute.\n *\n * `onOpen` runs on every connection, `again` on all but the first: what was sent while the\n * stream was away is missed, so that is the moment to read the state afresh.\n */\nexport declare function stream(url: string, listeners: Record<string, (data: string) => void>, onOpen?: (again: boolean) => void): () => void;\n", "responses.svelte.d.ts": "/**\n * What the room has answered, for the projector: the audience and presenter windows, and the\n * preview on the deck's page, follow it from the server. Print and render, and a link that isn't\n * a presenter's, have zeros. It is live data, which the position can't recreate.\n */\nimport type { Manifest } from '@tobos/deck/types';\nimport type { Results } from './activities.ts';\n/** One activity's responses in the current show. */\nexport interface Responses {\n /** People whose phones opened the deck's join link during this show. */\n readonly joined: number;\n /** People who have answered this activity during this show. */\n readonly answered: number;\n /** A poll's responses per option, in the order the scene declares them. A form's is empty. */\n readonly counts: number[];\n}\n/** The deck's activities, so a poll nobody answered yet has a zero per option. */\nexport declare function setActivities(manifest: Manifest): void;\n/** The current show's responses: reactive, for a scene or the presenter's view. */\nexport declare function liveResults(): Readonly<Results>;\n/**\n * The room's responses to an activity of this deck in the current show: how many joined, how\n * many answered, and a poll's counts per option. Call during component setup.\n */\nexport declare function useResponses(id: string): Responses;\n/** Follow the server's results stream (server-sent events) until the returned function is called. */\nexport declare function followResponses(url: string): () => void;\n", "index.d.ts": `import { type Component } from 'svelte';
|
|
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';
|
|
51
51
|
import { type JoinInfo } from './registry.ts';
|
|
52
52
|
export { playVideo, type PlayVideoOptions } from './video.ts';
|
|
53
53
|
export { useResponses, type Responses } from './responses.svelte.ts';
|
|
@@ -58062,7 +58062,7 @@ function settings() {
|
|
|
58062
58062
|
|
|
58063
58063
|
// src/api.ts
|
|
58064
58064
|
init_out();
|
|
58065
|
-
var VERSION = true ? "0.4.
|
|
58065
|
+
var VERSION = true ? "0.4.9" : "dev";
|
|
58066
58066
|
function newer(a, b) {
|
|
58067
58067
|
const parse9 = (v) => /^\d+\.\d+\.\d+/.test(v) ? v.split(".").map((n2) => parseInt(n2)) : null;
|
|
58068
58068
|
const x = parse9(a);
|