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.
Files changed (97) hide show
  1. package/PROMPT.md +10 -9
  2. package/README.md +167 -61
  3. package/ROADMAP.md +5 -4
  4. package/SCIENCE.md +1 -2
  5. package/assets/THIRD_PARTY_LICENSES.md +3 -3
  6. package/assets/fonts/SourceSerif4-24pt-SemiBold.ttf +0 -0
  7. package/assets/licenses/raster-codecs-MIT.txt +2 -2
  8. package/dist/{chunk-ZB3HK7RM.js → chunk-4MXGLMBG.js} +274 -24
  9. package/dist/chunk-GGFDBJ25.js +88 -0
  10. package/dist/{chunk-USDVNKO7.js → chunk-I745F4QK.js} +2323 -357
  11. package/dist/{chunk-DZHX76RS.js → chunk-JZPMGVBP.js} +32 -3
  12. package/dist/cli.js +443 -104
  13. package/dist/index.cjs +1055 -98
  14. package/dist/index.d.cts +216 -4
  15. package/dist/index.d.ts +216 -4
  16. package/dist/index.js +734 -63
  17. package/dist/scene-browser-chunks/chunk-RQNLYYJN.js +70 -0
  18. package/dist/scene-browser-chunks/{scene-browser-layout-M3XSXMV4.js → scene-browser-layout-RC3ECYRK.js} +1 -1
  19. package/dist/scene-browser.js +16 -16
  20. package/dist/scene-cli.js +1 -1
  21. package/dist/scene-runtime.cjs +24 -3
  22. package/dist/scene-runtime.js +1 -1
  23. package/dist/{server-2FYHZ4UO.js → server-Q4COUZHV.js} +3 -3
  24. package/dist/stage-browser/browser.d.ts +8240 -315
  25. package/dist/stage-browser/stage.js +22 -5
  26. package/dist/stage-export.cjs +3640 -298
  27. package/dist/stage-export.d.cts +56 -3
  28. package/dist/stage-export.d.ts +56 -3
  29. package/dist/stage-export.js +677 -149
  30. package/dist/stage.cjs +33026 -7554
  31. package/dist/stage.d.cts +7809 -286
  32. package/dist/stage.d.ts +7809 -286
  33. package/dist/stage.js +26066 -2599
  34. package/dist/{svg-import-C-RG1t7s.d.cts → svg-import-B5BGbC1t.d.cts} +455 -53
  35. package/dist/{svg-import-C-RG1t7s.d.ts → svg-import-B5BGbC1t.d.ts} +455 -53
  36. package/dist/{video-BSwNJZkn.d.ts → video-CiN1MDCS.d.cts} +27 -2
  37. package/dist/{video-BSwNJZkn.d.cts → video-CiN1MDCS.d.ts} +27 -2
  38. package/examples/README.md +1 -1
  39. package/examples/_teaching/layer-stack-connector.ts +36 -0
  40. package/examples/_teaching/layer-stack-recurrence.ts +29 -0
  41. package/examples/_teaching/layer-stack-tiny-gpt.ts +37 -0
  42. package/examples/_teaching/layer-stack-transformer.ts +44 -0
  43. package/examples/catalog-convolution-kernel.tsx +6 -7
  44. package/examples/{aurora-incident.tsx → checkout-incident.tsx} +1 -1
  45. package/examples/films/beam-search.ts +52 -0
  46. package/examples/films/cache-miss.ts +4 -3
  47. package/examples/films/catalog.json +30 -0
  48. package/examples/films/forecast.ts +354 -0
  49. package/examples/films/passage/chunking.ts +40 -0
  50. package/examples/films/passage/evidence.ts +44 -0
  51. package/examples/films/passage/prompt.ts +34 -0
  52. package/examples/films/paxos.ts +596 -0
  53. package/examples/films/taylor-series.ts +1 -1
  54. package/examples/narrated-cues/README.md +32 -0
  55. package/examples/narrated-cues/data/numbers.json +1 -0
  56. package/examples/narrated-cues/film.json +9 -0
  57. package/examples/narrated-cues/film.ts +78 -0
  58. package/examples/narrated-cues/package.json +1 -0
  59. package/examples/narrated-cues/script.json +57 -0
  60. package/examples/narrated-cues/timing.json +1 -0
  61. package/examples/narrated-cues/tsconfig.json +1 -0
  62. package/examples/proofs/decoding-bars.ts +67 -0
  63. package/examples/proofs/pipeline.ts +27 -0
  64. package/examples/proofs/table/evaluation.ts +41 -0
  65. package/examples/proofs/table/ledger.ts +47 -0
  66. package/examples/proofs/table/routing.ts +46 -0
  67. package/package.json +9 -4
  68. package/templates/narrated/README.md +61 -0
  69. package/templates/narrated/data/numbers.json +5 -0
  70. package/templates/narrated/film.json +12 -0
  71. package/templates/narrated/film.ts +14 -0
  72. package/templates/narrated/gitignore +8 -0
  73. package/templates/narrated/package.json +1 -0
  74. package/templates/narrated/scenes/answer.ts +25 -0
  75. package/templates/narrated/scenes/kit.ts +39 -0
  76. package/templates/narrated/scenes/question.ts +31 -0
  77. package/templates/narrated/script.json +26 -0
  78. package/templates/narrated/sources.md +22 -0
  79. package/templates/narrated/timing.json +1 -0
  80. package/templates/narrated/tsconfig.json +1 -0
  81. package/tools/narration/README.md +123 -0
  82. package/tools/narration/beats.py +43 -0
  83. package/tools/narration/checks.py +587 -0
  84. package/tools/narration/draft.py +73 -0
  85. package/tools/narration/film.py +341 -0
  86. package/tools/narration/lag.py +58 -0
  87. package/tools/narration/mix.py +265 -0
  88. package/tools/narration/probe.py +99 -0
  89. package/tools/narration/record.py +33 -0
  90. package/tools/narration/resound.py +170 -0
  91. package/tools/narration/soundbed.py +404 -0
  92. package/tools/narration/sync.py +93 -0
  93. package/tools/narration/transcribe.py +84 -0
  94. package/tools/narration/verify.py +59 -0
  95. package/tools/narration/voice.py +113 -0
  96. package/dist/chunk-6N6P2GJG.js +0 -88
  97. 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 resourceKeys = /^(?:background(?:image)?|fill|stroke|filter|clippath|mask(?:image)?|borderimage(?:source)?|liststyle(?:image)?|cursor|content)$/i;
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") return input;
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)) return input.map((item) => visit(item, depth + 1, key, inStyle));
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,