vizmatic 0.8.0 → 0.8.3
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/PROMPT.md +10 -9
- package/README.md +167 -61
- package/ROADMAP.md +5 -4
- package/SCIENCE.md +1 -2
- package/assets/THIRD_PARTY_LICENSES.md +3 -3
- package/assets/fonts/SourceSerif4-24pt-SemiBold.ttf +0 -0
- package/assets/licenses/raster-codecs-MIT.txt +2 -2
- package/dist/{chunk-ZB3HK7RM.js → chunk-4MXGLMBG.js} +274 -24
- package/dist/chunk-GGFDBJ25.js +88 -0
- package/dist/{chunk-USDVNKO7.js → chunk-I745F4QK.js} +2323 -357
- package/dist/{chunk-DZHX76RS.js → chunk-JZPMGVBP.js} +32 -3
- package/dist/cli.js +443 -104
- package/dist/index.cjs +1055 -98
- package/dist/index.d.cts +216 -4
- package/dist/index.d.ts +216 -4
- package/dist/index.js +734 -63
- package/dist/scene-browser-chunks/chunk-RQNLYYJN.js +70 -0
- package/dist/scene-browser-chunks/{scene-browser-layout-M3XSXMV4.js → scene-browser-layout-RC3ECYRK.js} +1 -1
- package/dist/scene-browser.js +16 -16
- package/dist/scene-cli.js +1 -1
- package/dist/scene-runtime.cjs +24 -3
- package/dist/scene-runtime.js +1 -1
- package/dist/{server-2FYHZ4UO.js → server-Q4COUZHV.js} +3 -3
- package/dist/stage-browser/browser.d.ts +8240 -315
- package/dist/stage-browser/stage.js +22 -5
- package/dist/stage-export.cjs +3640 -298
- package/dist/stage-export.d.cts +56 -3
- package/dist/stage-export.d.ts +56 -3
- package/dist/stage-export.js +677 -149
- package/dist/stage.cjs +33026 -7554
- package/dist/stage.d.cts +7809 -286
- package/dist/stage.d.ts +7809 -286
- package/dist/stage.js +26066 -2599
- package/dist/{svg-import-C-RG1t7s.d.cts → svg-import-B5BGbC1t.d.cts} +455 -53
- package/dist/{svg-import-C-RG1t7s.d.ts → svg-import-B5BGbC1t.d.ts} +455 -53
- package/dist/{video-BSwNJZkn.d.ts → video-CiN1MDCS.d.cts} +27 -2
- package/dist/{video-BSwNJZkn.d.cts → video-CiN1MDCS.d.ts} +27 -2
- package/examples/README.md +1 -1
- package/examples/_teaching/layer-stack-connector.ts +36 -0
- package/examples/_teaching/layer-stack-recurrence.ts +29 -0
- package/examples/_teaching/layer-stack-tiny-gpt.ts +37 -0
- package/examples/_teaching/layer-stack-transformer.ts +44 -0
- package/examples/catalog-convolution-kernel.tsx +6 -7
- package/examples/{aurora-incident.tsx → checkout-incident.tsx} +1 -1
- package/examples/films/beam-search.ts +52 -0
- package/examples/films/cache-miss.ts +4 -3
- package/examples/films/catalog.json +30 -0
- package/examples/films/forecast.ts +354 -0
- package/examples/films/passage/chunking.ts +40 -0
- package/examples/films/passage/evidence.ts +44 -0
- package/examples/films/passage/prompt.ts +34 -0
- package/examples/films/paxos.ts +596 -0
- package/examples/films/taylor-series.ts +1 -1
- package/examples/narrated-cues/README.md +32 -0
- package/examples/narrated-cues/data/numbers.json +1 -0
- package/examples/narrated-cues/film.json +9 -0
- package/examples/narrated-cues/film.ts +78 -0
- package/examples/narrated-cues/package.json +1 -0
- package/examples/narrated-cues/script.json +57 -0
- package/examples/narrated-cues/timing.json +1 -0
- package/examples/narrated-cues/tsconfig.json +1 -0
- package/examples/proofs/decoding-bars.ts +67 -0
- package/examples/proofs/pipeline.ts +27 -0
- package/examples/proofs/table/evaluation.ts +41 -0
- package/examples/proofs/table/ledger.ts +47 -0
- package/examples/proofs/table/routing.ts +46 -0
- package/package.json +9 -4
- package/templates/narrated/README.md +61 -0
- package/templates/narrated/data/numbers.json +5 -0
- package/templates/narrated/film.json +12 -0
- package/templates/narrated/film.ts +14 -0
- package/templates/narrated/gitignore +8 -0
- package/templates/narrated/package.json +1 -0
- package/templates/narrated/scenes/answer.ts +25 -0
- package/templates/narrated/scenes/kit.ts +39 -0
- package/templates/narrated/scenes/question.ts +31 -0
- package/templates/narrated/script.json +26 -0
- package/templates/narrated/sources.md +22 -0
- package/templates/narrated/timing.json +1 -0
- package/templates/narrated/tsconfig.json +1 -0
- package/tools/narration/README.md +123 -0
- package/tools/narration/beats.py +43 -0
- package/tools/narration/checks.py +587 -0
- package/tools/narration/draft.py +73 -0
- package/tools/narration/film.py +341 -0
- package/tools/narration/lag.py +58 -0
- package/tools/narration/mix.py +265 -0
- package/tools/narration/probe.py +99 -0
- package/tools/narration/record.py +33 -0
- package/tools/narration/resound.py +170 -0
- package/tools/narration/soundbed.py +404 -0
- package/tools/narration/sync.py +93 -0
- package/tools/narration/transcribe.py +84 -0
- package/tools/narration/verify.py +59 -0
- package/tools/narration/voice.py +113 -0
- package/dist/chunk-6N6P2GJG.js +0 -88
- package/dist/scene-browser-chunks/chunk-5MVLYGXM.js +0 -70
|
@@ -480,11 +480,18 @@ var componentNames = new Set(SCENE_COMPONENT_NAMES);
|
|
|
480
480
|
var domTags = new Set(SCENE_DOM_TAGS);
|
|
481
481
|
var localReference = /^#[A-Za-z_][\w:.-]*$/;
|
|
482
482
|
var localPaint = /^url\(\s*#[A-Za-z_][\w:.-]*\s*\)$/;
|
|
483
|
-
var
|
|
483
|
+
var stylePropertyName = /^(?:--[A-Za-z0-9_-]+|-?[A-Za-z][A-Za-z0-9-]*)$/;
|
|
484
|
+
var resourceKeys = /^(?:background(?:-?image)?|fill|stroke|filter|clip-?path|mask(?:-?image)?|border-?image(?:-?source)?|list-?style(?:-?image)?|marker(?:-(?:start|mid|end)|start|mid|end)?|shape-?outside|offset-?path|cursor|content)$/i;
|
|
485
|
+
function isValidSceneStyleProperty(name) {
|
|
486
|
+
return stylePropertyName.test(name) && !isUnsafeSceneKey(name);
|
|
487
|
+
}
|
|
484
488
|
function validateResource(value, key, inStyle) {
|
|
485
489
|
if (/^(?:src|href|xlinkhref|xlink:href|srcset|poster|action|formaction)$/i.test(key) && !localReference.test(value)) {
|
|
486
490
|
throw new Error("Scene resource references must be local SVG fragment IDs. External assets are disabled.");
|
|
487
491
|
}
|
|
492
|
+
if (inStyle && /[;{}]/.test(value)) {
|
|
493
|
+
throw new Error("Scene CSS cannot contain declaration delimiters.");
|
|
494
|
+
}
|
|
488
495
|
if ((inStyle || resourceKeys.test(key) || /gradient$/i.test(key)) && (/\\|\/\*/.test(value) || /(?:https?|file|ftp|data|blob|javascript):|\/\//i.test(value) || /url\s*\(/i.test(value) && !localPaint.test(value))) {
|
|
489
496
|
throw new Error("Scene CSS cannot load external resources or escaped resource expressions.");
|
|
490
497
|
}
|
|
@@ -498,6 +505,7 @@ function validateResolvedSceneResources(props) {
|
|
|
498
505
|
return;
|
|
499
506
|
}
|
|
500
507
|
if (Array.isArray(input)) {
|
|
508
|
+
if (style) throw new Error("Scene style values must be strings or numbers.");
|
|
501
509
|
input.forEach((item) => visit(item, key, style, depth + 1));
|
|
502
510
|
return;
|
|
503
511
|
}
|
|
@@ -505,6 +513,12 @@ function validateResolvedSceneResources(props) {
|
|
|
505
513
|
for (const [property, value] of Object.entries(input)) {
|
|
506
514
|
if (property === "children") continue;
|
|
507
515
|
if (property === "dangerouslySetInnerHTML" || property === "__html") throw new Error("Resolved scene cannot contain raw HTML.");
|
|
516
|
+
if (style && !isValidSceneStyleProperty(property)) {
|
|
517
|
+
throw new Error(`Scene style property ${JSON.stringify(property)} is not allowed.`);
|
|
518
|
+
}
|
|
519
|
+
if (style && value !== void 0 && value !== null && typeof value !== "string" && typeof value !== "number") {
|
|
520
|
+
throw new Error(`Scene style property ${JSON.stringify(property)} must be a string or number.`);
|
|
521
|
+
}
|
|
508
522
|
visit(value, property, style || /style$/i.test(property), depth + 1);
|
|
509
523
|
}
|
|
510
524
|
}
|
|
@@ -516,7 +530,10 @@ function validateSceneGraph(value) {
|
|
|
516
530
|
const visit = (input, depth, key = "", inStyle = false) => {
|
|
517
531
|
if (depth > SCENE_LIMITS.depth) throw new Error(`Scene graph exceeds depth ${SCENE_LIMITS.depth}.`);
|
|
518
532
|
if (++nodes > SCENE_LIMITS.nodes * 32) throw new Error("Scene graph contains too many values.");
|
|
519
|
-
if (input === null || typeof input === "boolean")
|
|
533
|
+
if (input === null || typeof input === "boolean") {
|
|
534
|
+
if (inStyle && typeof input === "boolean") throw new Error(`Scene style property ${JSON.stringify(key)} must be a string or number.`);
|
|
535
|
+
return input;
|
|
536
|
+
}
|
|
520
537
|
if (typeof input === "number") {
|
|
521
538
|
if (!Number.isFinite(input) || Math.abs(input) > 1e9) throw new Error("Scene numbers must be finite and bounded.");
|
|
522
539
|
return input;
|
|
@@ -526,12 +543,23 @@ function validateSceneGraph(value) {
|
|
|
526
543
|
validateResource(input, key, inStyle);
|
|
527
544
|
return input;
|
|
528
545
|
}
|
|
529
|
-
if (Array.isArray(input))
|
|
546
|
+
if (Array.isArray(input)) {
|
|
547
|
+
if (inStyle) throw new Error("Scene style values must be strings or numbers.");
|
|
548
|
+
return input.map((item) => visit(item, depth + 1, key, inStyle));
|
|
549
|
+
}
|
|
530
550
|
if (!input || typeof input !== "object" || Object.getPrototypeOf(input) !== Object.prototype && Object.getPrototypeOf(input) !== null) throw new Error("Scene props must be plain JSON values.");
|
|
531
551
|
const record2 = input;
|
|
532
552
|
const output = /* @__PURE__ */ Object.create(null);
|
|
533
553
|
for (const [property, item] of Object.entries(record2)) {
|
|
534
554
|
if (isUnsafeSceneKey(property) || /^on/i.test(property) || /^(?:xml:base|xmlBase)$/i.test(property) || property === "dangerouslySetInnerHTML" || property === "ref" || property === "__html") throw new Error(`Scene property ${JSON.stringify(property)} is not allowed.`);
|
|
555
|
+
if (inStyle) {
|
|
556
|
+
if (!isValidSceneStyleProperty(property)) {
|
|
557
|
+
throw new Error(`Scene style property ${JSON.stringify(property)} is not allowed.`);
|
|
558
|
+
}
|
|
559
|
+
if (item !== null && typeof item !== "string" && typeof item !== "number") {
|
|
560
|
+
throw new Error(`Scene style property ${JSON.stringify(property)} must be a string or number.`);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
535
563
|
output[property] = visit(item, depth + 1, property, inStyle || /style$/i.test(property));
|
|
536
564
|
}
|
|
537
565
|
if (record2.kind === "vizmatic.element") {
|
|
@@ -754,6 +782,7 @@ export {
|
|
|
754
782
|
SCENE_LIMITS,
|
|
755
783
|
normalizeSceneTime,
|
|
756
784
|
sceneSha256,
|
|
785
|
+
isValidSceneStyleProperty,
|
|
757
786
|
validateResolvedSceneResources,
|
|
758
787
|
validateSceneGraph,
|
|
759
788
|
prepareSceneSource,
|