@scenar/cli 0.9.0 → 0.10.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/example-bundle/assets/index-DpJUOVBT.js +388 -0
- package/example-bundle/assets/style-ix_q0zsc.css +1 -0
- package/example-bundle/embed.js +1 -1
- package/example-bundle/index.html +2 -2
- package/example-bundle/pack-manifest.json +11 -11
- package/example-bundle/scenario.json +6 -2
- package/package.json +4 -4
- package/src/__tests__/collect-pack-shots.test.ts +115 -0
- package/src/__tests__/find-authored-viewport.test.ts +58 -0
- package/src/__tests__/pack-generate-embed-entry.test.ts +5 -1
- package/src/__tests__/pack-manifest.test.ts +17 -0
- package/src/__tests__/read-shots.test.ts +57 -0
- package/src/__tests__/resolve-pack-viewport.test.ts +46 -0
- package/src/__tests__/run-shoot.test.ts +51 -2
- package/src/bundle/read-shots.d.ts +28 -0
- package/src/bundle/read-shots.d.ts.map +1 -0
- package/src/bundle/read-shots.js +28 -0
- package/src/bundle/read-shots.js.map +1 -0
- package/src/bundle/read-shots.ts +38 -0
- package/src/commands/pack.d.ts.map +1 -1
- package/src/commands/pack.js +23 -4
- package/src/commands/pack.js.map +1 -1
- package/src/commands/pack.ts +26 -5
- package/src/pack/build.d.ts +33 -1
- package/src/pack/build.d.ts.map +1 -1
- package/src/pack/build.js +35 -10
- package/src/pack/build.js.map +1 -1
- package/src/pack/build.ts +63 -17
- package/src/pack/collect-pack-shots.d.ts +47 -0
- package/src/pack/collect-pack-shots.d.ts.map +1 -0
- package/src/pack/collect-pack-shots.js +66 -0
- package/src/pack/collect-pack-shots.js.map +1 -0
- package/src/pack/collect-pack-shots.ts +89 -0
- package/src/pack/generate-embed-entry.d.ts +7 -0
- package/src/pack/generate-embed-entry.d.ts.map +1 -1
- package/src/pack/generate-embed-entry.js +14 -3
- package/src/pack/generate-embed-entry.js.map +1 -1
- package/src/pack/generate-embed-entry.ts +15 -3
- package/src/pack/pack-manifest.d.ts +12 -3
- package/src/pack/pack-manifest.d.ts.map +1 -1
- package/src/pack/pack-manifest.js +13 -3
- package/src/pack/pack-manifest.js.map +1 -1
- package/src/pack/pack-manifest.ts +13 -2
- package/src/pack/run-pack.d.ts +13 -2
- package/src/pack/run-pack.d.ts.map +1 -1
- package/src/pack/run-pack.js +56 -17
- package/src/pack/run-pack.js.map +1 -1
- package/src/pack/run-pack.ts +81 -19
- package/src/pack/viewport.d.ts +17 -0
- package/src/pack/viewport.d.ts.map +1 -1
- package/src/pack/viewport.js +19 -0
- package/src/pack/viewport.js.map +1 -1
- package/src/pack/viewport.ts +29 -0
- package/src/shoot/run-shoot.d.ts +6 -0
- package/src/shoot/run-shoot.d.ts.map +1 -1
- package/src/shoot/run-shoot.js +18 -0
- package/src/shoot/run-shoot.js.map +1 -1
- package/src/shoot/run-shoot.ts +19 -0
- package/src/util/load-ts.d.ts +35 -2
- package/src/util/load-ts.d.ts.map +1 -1
- package/src/util/load-ts.js +76 -10
- package/src/util/load-ts.js.map +1 -1
- package/src/util/load-ts.ts +87 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/example-bundle/assets/index-BoIR0_nN.js +0 -147
- package/example-bundle/assets/style-YRMeJPPX.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@source "./**/*.js";@layer scenar{.scenar{--scenar-surface: #ffffff;--scenar-border: #e5e7eb;--scenar-foreground: #0f172a;--scenar-muted-foreground: #64748b;--scenar-card: #ffffff;--scenar-accent: #f1f5f9;--scenar-primary: #0f172a;--scenar-ring: #0f172a;--scenar-chrome: #202124;--scenar-chrome-raised: #35363a;--scenar-chrome-foreground: #bdc1c6;--scenar-cursor-stroke: #ffffff;--scenar-backdrop-glow-1: #b7d4f2;--scenar-backdrop-glow-2: #e3d0ec;--scenar-backdrop-glow-3: #b4c4ea;--scenar-backdrop-base-1: #e4ecf7;--scenar-backdrop-base-2: #e6e1f0;--scenar-backdrop: radial-gradient(120% 100% at 12% 8%, var(--scenar-backdrop-glow-1) 0%, transparent 55%), radial-gradient(110% 95% at 88% 12%, var(--scenar-backdrop-glow-2) 0%, transparent 55%), radial-gradient(130% 110% at 70% 100%, var(--scenar-backdrop-glow-3) 0%, transparent 60%), linear-gradient(135deg, var(--scenar-backdrop-base-1) 0%, var(--scenar-backdrop-base-2) 100%);--scenar-shadow-window: 0 24px 64px -16px rgb(15 23 42 / .35), 0 4px 16px -4px rgb(15 23 42 / .2);--scenar-radius-window: 10px}.scenar.dark{--scenar-surface: #0f172a;--scenar-border: #1e293b;--scenar-foreground: #f8fafc;--scenar-muted-foreground: #94a3b8;--scenar-card: #1e293b;--scenar-accent: #1e293b;--scenar-primary: #f8fafc;--scenar-ring: #f8fafc;--scenar-chrome: #202124;--scenar-chrome-raised: #35363a;--scenar-chrome-foreground: #bdc1c6;--scenar-cursor-stroke: #ffffff;--scenar-backdrop-glow-1: #1c3a63;--scenar-backdrop-glow-2: #372a5e;--scenar-backdrop-glow-3: #142647;--scenar-backdrop-base-1: #101828;--scenar-backdrop-base-2: #14122a;--scenar-shadow-window: 0 24px 64px -16px rgb(0 0 0 / .65), 0 4px 16px -4px rgb(0 0 0 / .4);--scenar-radius-window: 10px}}/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--drop-shadow-sm:0 1px 2px #00000026;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-foreground:var(--scenar-foreground);--color-border:var(--scenar-border)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-1{top:calc(var(--spacing) * 1)}.top-1\/2{top:50%}.top-3{top:calc(var(--spacing) * 3)}.-right-px{right:-1px}.right-0{right:calc(var(--spacing) * 0)}.-bottom-px{bottom:-1px}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-1{bottom:calc(var(--spacing) * 1)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.left-1\/2{left:50%}.left-4{left:calc(var(--spacing) * 4)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[15\]{z-index:15}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-16{height:calc(var(--spacing) * 16)}.h-\[5px\]{height:5px}.h-\[7px\]{height:7px}.h-\[14px\]{height:14px}.h-\[15px\]{height:15px}.h-full{height:100%}.min-h-0{min-height:calc(var(--spacing) * 0)}.w-0\.5{width:calc(var(--spacing) * .5)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-1\/3{width:33.3333%}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-16{width:calc(var(--spacing) * 16)}.w-\[3px\]{width:3px}.w-\[7px\]{width:7px}.w-\[14px\]{width:14px}.w-\[15px\]{width:15px}.w-\[42px\]{width:42px}.w-\[160px\]{width:160px}.w-full{width:100%}.w-px{width:1px}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[80\%\]{max-width:80%}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[2\.5rem\]{min-width:2.5rem}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-2{--tw-translate-x:calc(var(--spacing) * -2);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-px{--tw-translate-x:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-2{--tw-translate-y:calc(var(--spacing) * -2);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-px{--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-\[5px\]{gap:5px}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-\[\#1a1a1a\]{border-color:#1a1a1a}.border-\[\#1e1e1e\]{border-color:#1e1e1e}.border-\[\#2a2a2e\]{border-color:#2a2a2e}.border-\[\#2d2d2d\]{border-color:#2d2d2d}.border-\[\#3a3a3a\]{border-color:#3a3a3a}.border-\[\#3a3f47\]{border-color:#3a3f47}.border-\[\#3c4043\]{border-color:#3c4043}.border-\[\#007acc\]{border-color:#007acc}.border-\[\#ff6c37\]{border-color:#ff6c37}.border-\[var\(--scenar-border\)\],.border-border{border-color:var(--scenar-border)}.border-transparent{border-color:#0000}.bg-\[\#0b93f6\]{background-color:#0b93f6}.bg-\[\#1a1a1a\]{background-color:#1a1a1a}.bg-\[\#1a73e8\]{background-color:#1a73e8}.bg-\[\#1c1c1c\]{background-color:#1c1c1c}.bg-\[\#1e1e1e\]{background-color:#1e1e1e}.bg-\[\#2a2a2e\]{background-color:#2a2a2e}.bg-\[\#2c2c2c\]{background-color:#2c2c2c}.bg-\[\#2d2d2d\]{background-color:#2d2d2d}.bg-\[\#3b82f6\]{background-color:#3b82f6}.bg-\[\#3b82f6\]\/10{background-color:#3b82f61a}.bg-\[\#3b82f6\]\/15{background-color:#3b82f626}.bg-\[\#5f6368\]{background-color:#5f6368}.bg-\[\#007acc\]{background-color:#007acc}.bg-\[\#007acc\]\/10{background-color:#007acc1a}.bg-\[\#22c55e\]{background-color:#22c55e}.bg-\[\#22c55e\]\/15{background-color:#22c55e26}.bg-\[\#28c840\]{background-color:#28c840}.bg-\[\#94a3b8\]\/15{background-color:#94a3b826}.bg-\[\#181b1f\]{background-color:#181b1f}.bg-\[\#999\]{background-color:#999}.bg-\[\#3274d9\]{background-color:#3274d9}.bg-\[\#04395e\]{background-color:#04395e}.bg-\[\#6366f1\]{background-color:#6366f1}.bg-\[\#111217\]{background-color:#111217}.bg-\[\#202124\]{background-color:#202124}.bg-\[\#252526\]{background-color:#252526}.bg-\[\#323232\]{background-color:#323232}.bg-\[\#323233\]{background-color:#323233}.bg-\[\#333333\]{background-color:#333}.bg-\[\#404040\]{background-color:#404040}.bg-\[\#eab308\]\/15{background-color:#eab30826}.bg-\[\#ef4444\]\/15{background-color:#ef444426}.bg-\[\#febc2e\]{background-color:#febc2e}.bg-\[\#ff5f57\]{background-color:#ff5f57}.bg-\[var\(--scenar-accent\)\]{background-color:var(--scenar-accent)}.bg-\[var\(--scenar-card\)\]{background-color:var(--scenar-card)}.bg-\[var\(--scenar-chrome\)\]{background-color:var(--scenar-chrome)}.bg-\[var\(--scenar-chrome-raised\)\]{background-color:var(--scenar-chrome-raised)}.bg-\[var\(--scenar-surface\)\]{background-color:var(--scenar-surface)}.bg-black{background-color:var(--color-black)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-card{background-color:var(--scenar-card)}.bg-primary\/25{background-color:var(--scenar-primary)}@supports (color:color-mix(in lab,red,red)){.bg-primary\/25{background-color:color-mix(in oklab,var(--scenar-primary) 25%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/30{background-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.bg-white\/30{background-color:color-mix(in oklab,var(--color-white) 30%,transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#6366f1\]{--tw-gradient-from:#6366f1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-\[\#ff6600\]{--tw-gradient-from:#f60;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-black\/70{--tw-gradient-from:#000000b3}@supports (color:color-mix(in lab,red,red)){.from-black\/70{--tw-gradient-from:color-mix(in oklab, var(--color-black) 70%, transparent)}}.from-black\/70{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-black\/30{--tw-gradient-via:#0000004d}@supports (color:color-mix(in lab,red,red)){.via-black\/30{--tw-gradient-via:color-mix(in oklab, var(--color-black) 30%, transparent)}}.via-black\/30{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#8b5cf6\]{--tw-gradient-to:#8b5cf6;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-\[\#f5a623\]{--tw-gradient-to:#f5a623;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-\[2px\]{padding-block:2px}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-12{padding-top:calc(var(--spacing) * 12)}.pt-\[10px\]{padding-top:10px}.pt-\[14px\]{padding-top:14px}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-2\.5{padding-bottom:calc(var(--spacing) * 2.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1{padding-left:calc(var(--spacing) * 1)}.pl-1\.5{padding-left:calc(var(--spacing) * 1.5)}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[16px\]{font-size:16px}.leading-\[1\.6\]{--tw-leading:1.6;line-height:1.6}.leading-\[18px\]{--tw-leading:18px;line-height:18px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#3b82f6\]{color:#3b82f6}.text-\[\#5f6368\]{color:#5f6368}.text-\[\#6e7681\]{color:#6e7681}.text-\[\#9aa0a6\]{color:#9aa0a6}.text-\[\#9d9d9d\]{color:#9d9d9d}.text-\[\#22c55e\]{color:#22c55e}.text-\[\#50fa7b\]{color:#50fa7b}.text-\[\#94a3b8\]{color:#94a3b8}.text-\[\#519aba\]{color:#519aba}.text-\[\#666\]{color:#666}.text-\[\#888\]{color:#888}.text-\[\#64748b\]{color:#64748b}.text-\[\#666666\]{color:#666}.text-\[\#858585\]{color:#858585}.text-\[\#a0a0a0\]{color:#a0a0a0}.text-\[\#bd93f9\]{color:#bd93f9}.text-\[\#bdc1c6\]{color:#bdc1c6}.text-\[\#c6c6c6\]{color:#c6c6c6}.text-\[\#cccccc\]{color:#ccc}.text-\[\#d4d4d4\]{color:#d4d4d4}.text-\[\#dcb67a\]{color:#dcb67a}.text-\[\#e8e8e8\]{color:#e8e8e8}.text-\[\#e8eaed\]{color:#e8eaed}.text-\[\#e6995b\]{color:#e6995b}.text-\[\#eab308\]{color:#eab308}.text-\[\#ef4444\]{color:#ef4444}.text-\[\#f8f8f2\]{color:#f8f8f2}.text-\[\#f8f8f2\]\/70{color:#f8f8f2b3}.text-\[\#ff5555\]{color:#f55}.text-\[\#ffffff\]{color:#fff}.text-\[var\(--scenar-chrome-foreground\)\]{color:var(--scenar-chrome-foreground)}.text-\[var\(--scenar-foreground\)\]{color:var(--scenar-foreground)}.text-\[var\(--scenar-muted-foreground\)\]{color:var(--scenar-muted-foreground)}.text-foreground{color:var(--scenar-foreground)}.text-muted-foreground{color:var(--scenar-muted-foreground)}.text-primary{color:var(--scenar-primary)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white) 70%,transparent)}}.text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.text-white\/90{color:color-mix(in oklab,var(--color-white) 90%,transparent)}}.text-white\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\/95{color:color-mix(in oklab,var(--color-white) 95%,transparent)}}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.drop-shadow-sm{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-sm));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[height\]{transition-property:height;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media (hover:hover){.hover\:h-2:hover{height:calc(var(--spacing) * 2)}.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:bg-accent:hover{background-color:var(--scenar-accent)}.hover\:text-white:hover{color:var(--color-white)}}}@layer scenar{.scenar{--scenar-surface:#fff;--scenar-border:#e5e7eb;--scenar-foreground:#0f172a;--scenar-muted-foreground:#64748b;--scenar-card:#fff;--scenar-accent:#f1f5f9;--scenar-primary:#0f172a;--scenar-ring:#0f172a;--scenar-chrome:#202124;--scenar-chrome-raised:#35363a;--scenar-chrome-foreground:#bdc1c6;--scenar-cursor-stroke:#fff;--scenar-backdrop-glow-1:#b7d4f2;--scenar-backdrop-glow-2:#e3d0ec;--scenar-backdrop-glow-3:#b4c4ea;--scenar-backdrop-base-1:#e4ecf7;--scenar-backdrop-base-2:#e6e1f0;--scenar-backdrop:radial-gradient(120% 100% at 12% 8%, var(--scenar-backdrop-glow-1) 0%, transparent 55%), radial-gradient(110% 95% at 88% 12%, var(--scenar-backdrop-glow-2) 0%, transparent 55%), radial-gradient(130% 110% at 70% 100%, var(--scenar-backdrop-glow-3) 0%, transparent 60%), linear-gradient(135deg, var(--scenar-backdrop-base-1) 0%, var(--scenar-backdrop-base-2) 100%);--scenar-shadow-window:0 24px 64px -16px #0f172a59, 0 4px 16px -4px #0f172a33;--scenar-radius-window:10px}.scenar.dark{--scenar-surface:#0f172a;--scenar-border:#1e293b;--scenar-foreground:#f8fafc;--scenar-muted-foreground:#94a3b8;--scenar-card:#1e293b;--scenar-accent:#1e293b;--scenar-primary:#f8fafc;--scenar-ring:#f8fafc;--scenar-chrome:#202124;--scenar-chrome-raised:#35363a;--scenar-chrome-foreground:#bdc1c6;--scenar-cursor-stroke:#fff;--scenar-backdrop-glow-1:#1c3a63;--scenar-backdrop-glow-2:#372a5e;--scenar-backdrop-glow-3:#142647;--scenar-backdrop-base-1:#101828;--scenar-backdrop-base-2:#14122a;--scenar-shadow-window:0 24px 64px -16px #000000a6, 0 4px 16px -4px #0006;--scenar-radius-window:10px}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
|
package/example-bundle/embed.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ScenarEmbed=function(
|
|
1
|
+
var ScenarEmbed=function(l){"use strict";var W=Object.defineProperty;var G=(l,c,m)=>c in l?W(l,c,{enumerable:!0,configurable:!0,writable:!0,value:m}):l[c]=m;var S=(l,c,m)=>G(l,typeof c!="symbol"?c+"":c,m);const c="scenar-embed";function M(t){return{source:c,v:1,...t}}function T(t){if(typeof t!="object"||t===null)return!1;const n=t;return n.source===c&&n.v===1}function u(t){return typeof t=="number"&&Number.isFinite(t)}function _(t){if(t===void 0)return{};if(typeof t!="object"||t===null)return null;const n=t;return u(n.widthPx)&&n.widthPx>0&&u(n.heightPx)&&n.heightPx>0?{viewport:{widthPx:n.widthPx,heightPx:n.heightPx}}:null}function O(t){if(!T(t))return null;const n=t.type;switch(n){case"started":case"paused":case"completed":case"audioBlocked":return{type:n};case"ready":{if(!u(t.totalSteps)||typeof t.hasNarration!="boolean")return null;const e=_(t.viewport);return e===null?null:{type:n,totalSteps:t.totalSteps,hasNarration:t.hasNarration,...e}}case"resize":return u(t.widthPx)&&u(t.heightPx)?{type:n,widthPx:t.widthPx,heightPx:t.heightPx}:null;case"stepchange":return u(t.stepIndex)&&u(t.totalSteps)?{type:n,stepIndex:t.stepIndex,totalSteps:t.totalSteps}:null;case"progress":return u(t.stepIndex)&&u(t.totalSteps)&&u(t.fraction)?{type:n,stepIndex:t.stepIndex,totalSteps:t.totalSteps,fraction:t.fraction}:null;case"error":return typeof t.message=="string"?{type:n,message:t.message}:null;default:return null}}function k(t,n={}){const{iframe:e,origin:s}=t,{onEvent:o}=n,d=typeof window<"u",a=r=>{var h;(h=e.contentWindow)==null||h.postMessage(M(r),s)},E=r=>{if(r.source!==e.contentWindow||r.origin!==s)return;const h=O(r.data);h&&(o==null||o(h))};return d&&window.addEventListener("message",E),{play:()=>a({type:"play"}),pause:()=>a({type:"pause"}),seek:r=>a({type:"seek",timeMs:r}),setMuted:r=>a({type:"setMuted",muted:r}),setVolume:r=>a({type:"setVolume",volume:r}),setHostScale:r=>a({type:"setHostScale",scale:r}),prefetch:()=>a({type:"prefetch"}),destroy:()=>{a({type:"destroy"}),d&&window.removeEventListener("message",E)}}}const L=896,I=480;function B(t,n){return t==="light"?"light":t==="dark"||n?"dark":"light"}function N(t,n){const e=new URL(t);return e.searchParams.set("theme",n),e.toString()}function V(t){return new URL(t).origin}function v(){return typeof document<"u"&&document.documentElement.classList.contains("dark")}function D(t,n){const{src:e,theme:s="auto",onAspectRatio:o,onEvent:d}=n,a=V(e);let E=null;const r=()=>{const i=B(s,v());i!==E&&(E=i,t.src=N(e,i))};let h=null,p,A=null;const R=()=>{const i=t.parentElement;if(!h||!i)return;const{widthPx:w,heightPx:C}=h,g=i.getBoundingClientRect();if(g.width<=0)return;const f=Math.min(g.width/w,1),U=(g.width-w*f)/2,j=(g.height-C*f)/2;t.style.width=`${w}px`,t.style.height=`${C}px`,t.style.transformOrigin="0 0",t.style.transform=`translate(${U}px, ${j}px) scale(${f})`,f!==A&&(A=f,b.setHostScale(f))},F=i=>{h=i,R(),!p&&typeof ResizeObserver<"u"&&t.parentElement&&(p=new ResizeObserver(R),p.observe(t.parentElement))},b=k({iframe:t,origin:a},{onEvent:i=>{i.type==="resize"&&(o==null||o({widthPx:i.widthPx,heightPx:i.heightPx})),i.type==="ready"&&i.viewport&&F(i.viewport),d==null||d(i)}});let y;return s==="auto"&&typeof MutationObserver<"u"&&typeof document<"u"&&(y=new MutationObserver(r),y.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})),r(),{controller:b,destroy(){y==null||y.disconnect(),p==null||p.disconnect(),b.destroy()}}}const H="scenar-embed",$="Interactive product tour",z=typeof HTMLElement<"u"?HTMLElement:class{};class x extends z{constructor(){super(...arguments);S(this,"iframe",null);S(this,"mount",null)}static get observedAttributes(){return["src","title","theme"]}connectedCallback(){this.iframe||this.render(),this.attach()}disconnectedCallback(){var e;(e=this.mount)==null||e.destroy(),this.mount=null}attributeChangedCallback(e,s,o){if(s!==o){if(e==="title"){this.iframe&&this.iframe.setAttribute("title",this.titleAttr());return}this.isConnected&&this.attach()}}play(){var e;(e=this.mount)==null||e.controller.play()}pause(){var e;(e=this.mount)==null||e.controller.pause()}seek(e){var s;(s=this.mount)==null||s.controller.seek(e)}setMuted(e){var s;(s=this.mount)==null||s.controller.setMuted(e)}setVolume(e){var s;(s=this.mount)==null||s.controller.setVolume(e)}titleAttr(){return this.getAttribute("title")??$}themeAttr(){const e=this.getAttribute("theme");return e==="light"||e==="dark"?e:"auto"}setAspectRatio(e,s){this.style.aspectRatio=`${e} / ${s}`}render(){this.style.display="block",this.style.position="relative",this.style.width="100%",this.setAspectRatio(L,I);const e=document.createElement("iframe");e.setAttribute("title",this.titleAttr()),e.setAttribute("loading","lazy"),e.setAttribute("allow","autoplay; fullscreen"),e.setAttribute("allowfullscreen",""),e.style.cssText="position:absolute;inset:0;width:100%;height:100%;border:0;border-radius:inherit",this.appendChild(e),this.iframe=e}attach(){var s;const e=this.getAttribute("src");!e||!this.iframe||((s=this.mount)==null||s.destroy(),this.mount=D(this.iframe,{src:e,theme:this.themeAttr(),onAspectRatio:({widthPx:o,heightPx:d})=>this.setAspectRatio(o,d),onEvent:o=>this.dispatchEvent(new CustomEvent(`scenar:${o.type}`,{detail:o}))}))}}function P(t=H){typeof customElements>"u"||customElements.get(t)||customElements.define(t,x)}return P(),l.ScenarEmbedElement=x,l.defineScenarEmbed=P,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),l}({});
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<style>
|
|
9
9
|
html, body { margin: 0; background: transparent; }
|
|
10
10
|
</style>
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="./assets/style-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-DpJUOVBT.js"></script>
|
|
12
|
+
<link rel="stylesheet" crossorigin href="./assets/style-ix_q0zsc.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div id="root"></div>
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"scenarioId": "welcome-tour",
|
|
4
4
|
"files": [
|
|
5
5
|
{
|
|
6
|
-
"path": "assets/index-
|
|
7
|
-
"sha256": "
|
|
8
|
-
"sizeBytes":
|
|
6
|
+
"path": "assets/index-DpJUOVBT.js",
|
|
7
|
+
"sha256": "a9eeb4681d062e7d8ae498ecd23449178f8ab903802d1140d37495f784a3d4a4",
|
|
8
|
+
"sizeBytes": 596882,
|
|
9
9
|
"contentType": "text/javascript"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
@@ -15,27 +15,27 @@
|
|
|
15
15
|
"contentType": "image/png"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "assets/style-
|
|
19
|
-
"sha256": "
|
|
20
|
-
"sizeBytes":
|
|
18
|
+
"path": "assets/style-ix_q0zsc.css",
|
|
19
|
+
"sha256": "cb85672c451595637da0251fd89cecc62693c4d80b8f1c2907340560f127a447",
|
|
20
|
+
"sizeBytes": 33979,
|
|
21
21
|
"contentType": "text/css"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
"path": "embed.js",
|
|
25
|
-
"sha256": "
|
|
26
|
-
"sizeBytes":
|
|
25
|
+
"sha256": "0cd7a1dbfad1eac7dd9c5ef9984d67b209696e48b16682e7dfe90c9f0f41cbae",
|
|
26
|
+
"sizeBytes": 5456,
|
|
27
27
|
"contentType": "text/javascript"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
"path": "index.html",
|
|
31
|
-
"sha256": "
|
|
31
|
+
"sha256": "0658a4a219f45f6cfa3535f403aa0039eeaa888cda3a417d30d2943935fc8212",
|
|
32
32
|
"sizeBytes": 533,
|
|
33
33
|
"contentType": "text/html"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"path": "scenario.json",
|
|
37
|
-
"sha256": "
|
|
38
|
-
"sizeBytes":
|
|
37
|
+
"sha256": "b9f3c79b8c3dcbba4a89eba5700fd8fc99e10902642150ea29419438ac2b74a3",
|
|
38
|
+
"sizeBytes": 208,
|
|
39
39
|
"contentType": "application/json"
|
|
40
40
|
}
|
|
41
41
|
]
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1",
|
|
3
3
|
"id": "welcome-tour",
|
|
4
|
-
"generator": "@scenar/cli pack 0.0.
|
|
4
|
+
"generator": "@scenar/cli pack 0.0.2",
|
|
5
5
|
"viewport": {
|
|
6
6
|
"width": 896,
|
|
7
7
|
"height": 480
|
|
8
|
-
}
|
|
8
|
+
},
|
|
9
|
+
"shots": [
|
|
10
|
+
"login-screen",
|
|
11
|
+
"settings-screen"
|
|
12
|
+
]
|
|
9
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scenar/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Scenar CLI — validate scenarios, generate narration, and render videos.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@scenar/core": "0.
|
|
43
|
-
"@scenar/embed": "0.
|
|
44
|
-
"@scenar/sdk": "0.
|
|
42
|
+
"@scenar/core": "0.10.0",
|
|
43
|
+
"@scenar/embed": "0.10.0",
|
|
44
|
+
"@scenar/sdk": "0.10.0",
|
|
45
45
|
"commander": "^13.0.0",
|
|
46
46
|
"yaml": "^2.7.0"
|
|
47
47
|
},
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// @vitest-environment node
|
|
2
|
+
//
|
|
3
|
+
// The workspace default is jsdom, but jsdom's TextEncoder returns a
|
|
4
|
+
// Uint8Array from its own realm, which trips esbuild's environment
|
|
5
|
+
// invariant when Vite loads. collectPackShots is a pure Node code path
|
|
6
|
+
// (it IS what `scenar pack` runs), so it is tested in a Node environment.
|
|
7
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
8
|
+
import { mkdtemp, writeFile, rm } from "node:fs/promises";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { collectPackShots } from "../pack/collect-pack-shots.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* These tests run the real Vite SSR pipeline against throwaway scenario
|
|
15
|
+
* directories — the same code path `scenar pack` uses — so they are slower
|
|
16
|
+
* than the pure-unit suites but prove the actual contract: what pack records
|
|
17
|
+
* is what the steps module really exports, not a source-text approximation.
|
|
18
|
+
*/
|
|
19
|
+
describe("collectPackShots", () => {
|
|
20
|
+
let scenarioDir: string;
|
|
21
|
+
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
scenarioDir = await mkdtemp(join(tmpdir(), "scenar-collect-shots-"));
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterEach(async () => {
|
|
27
|
+
await rm(scenarioDir, { recursive: true, force: true });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
async function writeSteps(source: string): Promise<void> {
|
|
31
|
+
await writeFile(join(scenarioDir, "steps.ts"), source, "utf-8");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
it("records declared shot names in step order", async () => {
|
|
35
|
+
await writeSteps(
|
|
36
|
+
`export const steps = [
|
|
37
|
+
{ delayMs: 0, shot: "opening" },
|
|
38
|
+
{ delayMs: 1200 },
|
|
39
|
+
{ delayMs: 800, shot: "detail-open" },
|
|
40
|
+
];`,
|
|
41
|
+
);
|
|
42
|
+
expect(await collectPackShots(scenarioDir)).toEqual({
|
|
43
|
+
recorded: true,
|
|
44
|
+
shots: ["opening", "detail-open"],
|
|
45
|
+
authoredViewport: null,
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("discovers a shot name built from a constant (runtime truth, not AST)", async () => {
|
|
50
|
+
await writeSteps(
|
|
51
|
+
`const SECTION = "detail";
|
|
52
|
+
export const steps = [{ delayMs: 0, shot: \`\${SECTION}-open\` }];`,
|
|
53
|
+
);
|
|
54
|
+
expect(await collectPackShots(scenarioDir)).toEqual({
|
|
55
|
+
recorded: true,
|
|
56
|
+
shots: ["detail-open"],
|
|
57
|
+
authoredViewport: null,
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("records an authoritatively empty list for a shot-less scenario", async () => {
|
|
62
|
+
await writeSteps(`export const steps = [{ delayMs: 0 }, { delayMs: 900 }];`);
|
|
63
|
+
expect(await collectPackShots(scenarioDir)).toEqual({
|
|
64
|
+
recorded: true,
|
|
65
|
+
shots: [],
|
|
66
|
+
authoredViewport: null,
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("discovers the authored viewport alongside the shots (one SSR load)", async () => {
|
|
71
|
+
await writeSteps(
|
|
72
|
+
`export const viewport = { width: 1440, height: 900 };
|
|
73
|
+
export const steps = [{ delayMs: 0, shot: "opening" }];`,
|
|
74
|
+
);
|
|
75
|
+
expect(await collectPackShots(scenarioDir)).toEqual({
|
|
76
|
+
recorded: true,
|
|
77
|
+
shots: ["opening"],
|
|
78
|
+
authoredViewport: { width: 1440, height: 900 },
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("degrades to recorded:false with the reason when the module cannot be imported", async () => {
|
|
83
|
+
await writeSteps(
|
|
84
|
+
`import { nope } from "./does-not-exist.js";
|
|
85
|
+
export const steps = [{ delayMs: 0, shot: String(nope) }];`,
|
|
86
|
+
);
|
|
87
|
+
const result = await collectPackShots(scenarioDir);
|
|
88
|
+
expect(result.recorded).toBe(false);
|
|
89
|
+
if (!result.recorded) {
|
|
90
|
+
expect(result.reason.length).toBeGreaterThan(0);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("fails the pack when the module has no delayMs-bearing steps array", async () => {
|
|
95
|
+
await writeSteps(`export const notSteps = { delayMs: 0 };\nexport const nums = [1, 2, 3];`);
|
|
96
|
+
await expect(collectPackShots(scenarioDir)).rejects.toThrow(/No steps array found/);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("fails the pack on a duplicate shot name, naming both steps", async () => {
|
|
100
|
+
await writeSteps(
|
|
101
|
+
`export const steps = [
|
|
102
|
+
{ delayMs: 0, shot: "opening" },
|
|
103
|
+
{ delayMs: 100, shot: "opening" },
|
|
104
|
+
];`,
|
|
105
|
+
);
|
|
106
|
+
await expect(collectPackShots(scenarioDir)).rejects.toThrow(
|
|
107
|
+
/steps 0 and 1 both declare shot "opening"/,
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("fails the pack on a non-kebab-case shot name", async () => {
|
|
112
|
+
await writeSteps(`export const steps = [{ delayMs: 0, shot: "Not_Kebab" }];`);
|
|
113
|
+
await expect(collectPackShots(scenarioDir)).rejects.toThrow(/not kebab-case/);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { findAuthoredViewport } from "../util/load-ts.js";
|
|
3
|
+
|
|
4
|
+
const STEPS = [{ delayMs: 0 }, { delayMs: 1500 }];
|
|
5
|
+
|
|
6
|
+
describe("findAuthoredViewport", () => {
|
|
7
|
+
it("finds the viewport riding a scenario-shaped export (createScenario)", () => {
|
|
8
|
+
const exports = {
|
|
9
|
+
default: {
|
|
10
|
+
viewport: { width: 1440, height: 900 },
|
|
11
|
+
views: {},
|
|
12
|
+
steps: STEPS,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
expect(findAuthoredViewport(exports)).toEqual({ width: 1440, height: 900 });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("finds a bare `viewport` named export (directory-form authoring)", () => {
|
|
19
|
+
const exports = {
|
|
20
|
+
steps: STEPS,
|
|
21
|
+
viewport: { width: 1280, height: 800 },
|
|
22
|
+
};
|
|
23
|
+
expect(findAuthoredViewport(exports)).toEqual({ width: 1280, height: 800 });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("prefers the scenario-shaped export over a bare named export", () => {
|
|
27
|
+
// The scenario's viewport is inseparable from the steps it sizes; a
|
|
28
|
+
// stray `viewport` constant must not override it.
|
|
29
|
+
const exports = {
|
|
30
|
+
default: { viewport: { width: 1440, height: 900 }, steps: STEPS },
|
|
31
|
+
viewport: { width: 640, height: 480 },
|
|
32
|
+
};
|
|
33
|
+
expect(findAuthoredViewport(exports)).toEqual({ width: 1440, height: 900 });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("returns null when the module authors no viewport", () => {
|
|
37
|
+
expect(findAuthoredViewport({ steps: STEPS })).toBeNull();
|
|
38
|
+
expect(findAuthoredViewport({})).toBeNull();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("ignores a viewport on an object that carries no steps", () => {
|
|
42
|
+
// Not a scenario export — e.g. some unrelated config object.
|
|
43
|
+
const exports = {
|
|
44
|
+
config: { viewport: { width: 1440, height: 900 } },
|
|
45
|
+
steps: STEPS,
|
|
46
|
+
};
|
|
47
|
+
expect(findAuthoredViewport(exports)).toBeNull();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("rejects malformed viewport shapes", () => {
|
|
51
|
+
expect(findAuthoredViewport({ viewport: { width: 1440 } })).toBeNull();
|
|
52
|
+
expect(findAuthoredViewport({ viewport: { width: "1440", height: 900 } })).toBeNull();
|
|
53
|
+
expect(findAuthoredViewport({ viewport: { width: 0, height: 900 } })).toBeNull();
|
|
54
|
+
expect(findAuthoredViewport({ viewport: { width: -10, height: 900 } })).toBeNull();
|
|
55
|
+
expect(findAuthoredViewport({ viewport: [1440, 900] })).toBeNull();
|
|
56
|
+
expect(findAuthoredViewport({ viewport: null })).toBeNull();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -21,7 +21,11 @@ describe("generateEmbedEntry", () => {
|
|
|
21
21
|
const src = generateEmbedEntry({ ...BASE, hasNarration: false, providersPath: null });
|
|
22
22
|
expect(src).toContain('import { createRoot } from "react-dom/client";');
|
|
23
23
|
expect(src).toContain('import { renderStep } from "/proj/scenarios/welcome-tour/index";');
|
|
24
|
-
|
|
24
|
+
// embedViewport mirrors the DemoViewport numbers so the ready handshake
|
|
25
|
+
// announces the exact canonical size the bundle lays out at.
|
|
26
|
+
expect(src).toContain(
|
|
27
|
+
"<ScenarioPlayer bundle={_bundle} embed embedViewport={{ widthPx: 896, heightPx: 480 }} onStepChange={_handleStepChange}>",
|
|
28
|
+
);
|
|
25
29
|
expect(src).toContain("renderStep(data, stepIndex)");
|
|
26
30
|
expect(src).toContain('getElementById("root")');
|
|
27
31
|
});
|
|
@@ -47,6 +47,23 @@ describe("writeScenarioJson", () => {
|
|
|
47
47
|
expect(parsed.generator).toContain("@scenar/cli pack");
|
|
48
48
|
// The baked canonical viewport flows downstream to the embed snippet (DD-004).
|
|
49
49
|
expect(parsed.viewport).toEqual({ width: 1024, height: 576 });
|
|
50
|
+
// Shots not provided (unknown) — the key must be absent, not null/empty:
|
|
51
|
+
// absent means "boot a browser to find out", empty means "nothing to shoot".
|
|
52
|
+
expect("shots" in parsed).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("records the declared shot names when provided — including an empty list", async () => {
|
|
56
|
+
await writeScenarioJson(dir, "welcome-tour", "0.0.1", DEFAULT_VIEWPORT, [
|
|
57
|
+
"opening",
|
|
58
|
+
"detail-open",
|
|
59
|
+
]);
|
|
60
|
+
let parsed = JSON.parse(await readFile(join(dir, "scenario.json"), "utf-8"));
|
|
61
|
+
expect(parsed.shots).toEqual(["opening", "detail-open"]);
|
|
62
|
+
|
|
63
|
+
// Empty is authoritative — it is what lets `scenar shoot` skip the browser.
|
|
64
|
+
await writeScenarioJson(dir, "welcome-tour", "0.0.1", DEFAULT_VIEWPORT, []);
|
|
65
|
+
parsed = JSON.parse(await readFile(join(dir, "scenario.json"), "utf-8"));
|
|
66
|
+
expect(parsed.shots).toEqual([]);
|
|
50
67
|
});
|
|
51
68
|
});
|
|
52
69
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { mkdtemp, writeFile, rm } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { readBundleShots } from "../bundle/read-shots.js";
|
|
6
|
+
|
|
7
|
+
describe("readBundleShots", () => {
|
|
8
|
+
let dir: string;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
dir = await mkdtemp(join(tmpdir(), "scenar-shots-"));
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
afterEach(async () => {
|
|
15
|
+
await rm(dir, { recursive: true, force: true });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
async function writeScenarioJson(content: unknown): Promise<void> {
|
|
19
|
+
await writeFile(
|
|
20
|
+
join(dir, "scenario.json"),
|
|
21
|
+
typeof content === "string" ? content : JSON.stringify(content),
|
|
22
|
+
"utf-8",
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
it("reads the recorded shot names from scenario.json", async () => {
|
|
27
|
+
await writeScenarioJson({ schemaVersion: "1", id: "x", shots: ["opening", "detail-open"] });
|
|
28
|
+
expect(await readBundleShots(dir)).toEqual({
|
|
29
|
+
recorded: true,
|
|
30
|
+
shots: ["opening", "detail-open"],
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("treats a recorded empty list as authoritative", async () => {
|
|
35
|
+
await writeScenarioJson({ schemaVersion: "1", id: "x", shots: [] });
|
|
36
|
+
expect(await readBundleShots(dir)).toEqual({ recorded: true, shots: [] });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("reports unknown when scenario.json is absent", async () => {
|
|
40
|
+
expect(await readBundleShots(dir)).toEqual({ recorded: false });
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("reports unknown when the key is missing or malformed", async () => {
|
|
44
|
+
// A pre-shots bundle (generator < 0.0.2) simply has no key.
|
|
45
|
+
await writeScenarioJson({ schemaVersion: "1", id: "x" });
|
|
46
|
+
expect(await readBundleShots(dir)).toEqual({ recorded: false });
|
|
47
|
+
|
|
48
|
+
await writeScenarioJson({ schemaVersion: "1", id: "x", shots: "opening" });
|
|
49
|
+
expect(await readBundleShots(dir)).toEqual({ recorded: false });
|
|
50
|
+
|
|
51
|
+
await writeScenarioJson({ schemaVersion: "1", id: "x", shots: [1, 2] });
|
|
52
|
+
expect(await readBundleShots(dir)).toEqual({ recorded: false });
|
|
53
|
+
|
|
54
|
+
await writeScenarioJson("{ not json");
|
|
55
|
+
expect(await readBundleShots(dir)).toEqual({ recorded: false });
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { DEFAULT_VIEWPORT, resolvePackViewport } from "../pack/viewport.js";
|
|
3
|
+
|
|
4
|
+
const AUTHORED = { width: 1440, height: 900 };
|
|
5
|
+
|
|
6
|
+
describe("resolvePackViewport", () => {
|
|
7
|
+
it("explicit options win over the authored viewport", () => {
|
|
8
|
+
expect(resolvePackViewport({ width: 1280, shellHeight: 800 }, AUTHORED)).toEqual({
|
|
9
|
+
width: 1280,
|
|
10
|
+
height: 800,
|
|
11
|
+
source: "explicit",
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("the authored viewport wins over the default", () => {
|
|
16
|
+
expect(resolvePackViewport({}, AUTHORED)).toEqual({
|
|
17
|
+
width: 1440,
|
|
18
|
+
height: 900,
|
|
19
|
+
source: "authored",
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("falls back to the packer default when nothing is specified", () => {
|
|
24
|
+
expect(resolvePackViewport({}, null)).toEqual({
|
|
25
|
+
width: DEFAULT_VIEWPORT.width,
|
|
26
|
+
height: DEFAULT_VIEWPORT.height,
|
|
27
|
+
source: "default",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("a partial explicit override fills the other axis from the authored viewport", () => {
|
|
32
|
+
expect(resolvePackViewport({ width: 1600 }, AUTHORED)).toEqual({
|
|
33
|
+
width: 1600,
|
|
34
|
+
height: 900,
|
|
35
|
+
source: "explicit",
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("a partial explicit override without an authored viewport fills from the default", () => {
|
|
40
|
+
expect(resolvePackViewport({ shellHeight: 1000 }, null)).toEqual({
|
|
41
|
+
width: DEFAULT_VIEWPORT.width,
|
|
42
|
+
height: 1000,
|
|
43
|
+
source: "explicit",
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -13,8 +13,13 @@ const SHOTS: ScenarioShot[] = [
|
|
|
13
13
|
{ name: "detail-open", timeMs: 6999, stepIndex: 2 },
|
|
14
14
|
];
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Write the minimal three files that make a directory a shootable bundle.
|
|
18
|
+
* By default scenario.json carries no `shots` key (a pre-0.0.2 bundle:
|
|
19
|
+
* shots unknown, so runShoot must boot the capture page); pass
|
|
20
|
+
* `recordedShots` to emulate a bundle whose pack recorded the list.
|
|
21
|
+
*/
|
|
22
|
+
async function makeBundle(recordedShots?: readonly string[]): Promise<string> {
|
|
18
23
|
const dir = await mkdtemp(join(tmpdir(), "scenar-shoot-"));
|
|
19
24
|
await writeFile(join(dir, "index.html"), "<!doctype html><div id='root'></div>", "utf-8");
|
|
20
25
|
await writeFile(
|
|
@@ -24,6 +29,7 @@ async function makeBundle(): Promise<string> {
|
|
|
24
29
|
id: "lab-tour",
|
|
25
30
|
generator: "@scenar/cli pack 0.0.1",
|
|
26
31
|
viewport: { width: 896, height: 480 },
|
|
32
|
+
...(recordedShots !== undefined ? { shots: recordedShots } : {}),
|
|
27
33
|
}),
|
|
28
34
|
"utf-8",
|
|
29
35
|
);
|
|
@@ -182,6 +188,49 @@ describe("runShoot", () => {
|
|
|
182
188
|
expect(manifest.files.some((f) => f.path.startsWith("stills/"))).toBe(false);
|
|
183
189
|
});
|
|
184
190
|
|
|
191
|
+
it("skips the browser entirely when scenario.json records an empty shot list", async () => {
|
|
192
|
+
const bundleDir = await makeBundle([]);
|
|
193
|
+
await mkdir(join(bundleDir, STILLS_DIR), { recursive: true });
|
|
194
|
+
await writeFile(join(bundleDir, STILLS_DIR, "removed-shot.light.png"), "stale");
|
|
195
|
+
let browserRequested = false;
|
|
196
|
+
|
|
197
|
+
const result = await runShoot({
|
|
198
|
+
bundleDir,
|
|
199
|
+
browserFactory: async () => {
|
|
200
|
+
browserRequested = true;
|
|
201
|
+
throw new Error("the short-circuit must return before the browser factory");
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// Pack's record is authoritative: no session, no browser, same outcome.
|
|
206
|
+
expect(browserRequested).toBe(false);
|
|
207
|
+
expect(result).toEqual({
|
|
208
|
+
scenarioId: "lab-tour",
|
|
209
|
+
bundleDir,
|
|
210
|
+
shots: [],
|
|
211
|
+
files: [],
|
|
212
|
+
themes: ["light", "dark"],
|
|
213
|
+
verified: false,
|
|
214
|
+
});
|
|
215
|
+
// Both invariants hold on the short-circuit path too: stale stills are
|
|
216
|
+
// cleared, and the manifest is rebuilt so it never lists deleted files.
|
|
217
|
+
expect(await stat(join(bundleDir, STILLS_DIR)).catch(() => null)).toBeNull();
|
|
218
|
+
const manifest = await readManifest(bundleDir);
|
|
219
|
+
expect(manifest.files.some((f) => f.path.startsWith("stills/"))).toBe(false);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it("still boots the capture page when scenario.json records a non-empty list", async () => {
|
|
223
|
+
// The record proves there is something to shoot; the running bundle
|
|
224
|
+
// remains the runtime truth for what actually gets captured.
|
|
225
|
+
const bundleDir = await makeBundle(SHOTS.map((s) => s.name));
|
|
226
|
+
const fake = makeFakeBrowser();
|
|
227
|
+
|
|
228
|
+
const result = await runShoot({ bundleDir, browserFactory: async () => fake.browser });
|
|
229
|
+
|
|
230
|
+
expect(fake.sessions.length).toBeGreaterThan(0);
|
|
231
|
+
expect(result.shots).toEqual(SHOTS);
|
|
232
|
+
});
|
|
233
|
+
|
|
185
234
|
it("captures a single theme when asked", async () => {
|
|
186
235
|
const bundleDir = await makeBundle();
|
|
187
236
|
const fake = makeFakeBrowser();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The outcome of reading a bundle's recorded shot names. */
|
|
2
|
+
export type BundleShots =
|
|
3
|
+
/** scenario.json carries an authoritative list (possibly empty). */
|
|
4
|
+
{
|
|
5
|
+
readonly recorded: true;
|
|
6
|
+
readonly shots: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* No usable `shots` record — the bundle predates the key, pack could not
|
|
10
|
+
* load the steps module, or the file is missing/malformed. The shots are
|
|
11
|
+
* unknown; only booting the capture page can answer.
|
|
12
|
+
*/
|
|
13
|
+
| {
|
|
14
|
+
readonly recorded: false;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Read the declared shot names recorded in a bundle's scenario.json.
|
|
18
|
+
*
|
|
19
|
+
* The sibling of {@link readBundleViewport}, with the same forgiving posture:
|
|
20
|
+
* any missing/unreadable/malformed state degrades to `recorded: false` rather
|
|
21
|
+
* than throwing, because an absent record only costs the caller a browser
|
|
22
|
+
* boot — it must never fail an operation that a pre-`shots` bundle could
|
|
23
|
+
* complete. Present-and-empty is meaningfully different: it is pack's
|
|
24
|
+
* authoritative statement that the scenario declares no shots, which is what
|
|
25
|
+
* lets `runShoot` skip the browser entirely.
|
|
26
|
+
*/
|
|
27
|
+
export declare function readBundleShots(bundleDir: string): Promise<BundleShots>;
|
|
28
|
+
//# sourceMappingURL=read-shots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-shots.d.ts","sourceRoot":"","sources":["../../../src/bundle/read-shots.ts"],"names":[],"mappings":"AAIA,6DAA6D;AAC7D,MAAM,MAAM,WAAW;AACrB,oEAAoE;AAClE;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE;AAChE;;;;GAIG;GACD;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAA;CAAE,CAAC;AAEjC;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAW7E"}
|