@scenar/cli 0.9.1 → 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 +9 -9
- package/package.json +4 -4
- package/src/__tests__/collect-pack-shots.test.ts +19 -1
- package/src/__tests__/find-authored-viewport.test.ts +58 -0
- package/src/__tests__/pack-generate-embed-entry.test.ts +5 -1
- package/src/__tests__/resolve-pack-viewport.test.ts +46 -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/collect-pack-shots.d.ts +12 -5
- package/src/pack/collect-pack-shots.d.ts.map +1 -1
- package/src/pack/collect-pack-shots.js +11 -4
- package/src/pack/collect-pack-shots.js.map +1 -1
- package/src/pack/collect-pack-shots.ts +21 -8
- package/src/pack/generate-embed-entry.d.ts.map +1 -1
- package/src/pack/generate-embed-entry.js +4 -1
- package/src/pack/generate-embed-entry.js.map +1 -1
- package/src/pack/generate-embed-entry.ts +4 -1
- package/src/pack/run-pack.d.ts +7 -2
- package/src/pack/run-pack.d.ts.map +1 -1
- package/src/pack/run-pack.js +20 -8
- package/src/pack/run-pack.js.map +1 -1
- package/src/pack/run-pack.ts +31 -10
- 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/util/load-ts.d.ts +23 -0
- package/src/util/load-ts.d.ts.map +1 -1
- package/src/util/load-ts.js +51 -0
- package/src/util/load-ts.js.map +1 -1
- package/src/util/load-ts.ts +62 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/example-bundle/assets/index-DlmG1Uh7.js +0 -388
- package/example-bundle/assets/style-BjquDnTE.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,20 +15,20 @@
|
|
|
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
|
},
|
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
|
},
|
|
@@ -42,6 +42,7 @@ describe("collectPackShots", () => {
|
|
|
42
42
|
expect(await collectPackShots(scenarioDir)).toEqual({
|
|
43
43
|
recorded: true,
|
|
44
44
|
shots: ["opening", "detail-open"],
|
|
45
|
+
authoredViewport: null,
|
|
45
46
|
});
|
|
46
47
|
});
|
|
47
48
|
|
|
@@ -53,12 +54,29 @@ describe("collectPackShots", () => {
|
|
|
53
54
|
expect(await collectPackShots(scenarioDir)).toEqual({
|
|
54
55
|
recorded: true,
|
|
55
56
|
shots: ["detail-open"],
|
|
57
|
+
authoredViewport: null,
|
|
56
58
|
});
|
|
57
59
|
});
|
|
58
60
|
|
|
59
61
|
it("records an authoritatively empty list for a shot-less scenario", async () => {
|
|
60
62
|
await writeSteps(`export const steps = [{ delayMs: 0 }, { delayMs: 900 }];`);
|
|
61
|
-
expect(await collectPackShots(scenarioDir)).toEqual({
|
|
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
|
+
});
|
|
62
80
|
});
|
|
63
81
|
|
|
64
82
|
it("degrades to recorded:false with the reason when the module cannot be imported", async () => {
|
|
@@ -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
|
});
|
|
@@ -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
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../../src/commands/pack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../../src/commands/pack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6D1D"}
|
package/src/commands/pack.js
CHANGED
|
@@ -22,8 +22,12 @@ export function registerPackCommand(program) {
|
|
|
22
22
|
"Output defaults to ./<scenario-id>-bundle. Use --out to override.")
|
|
23
23
|
.argument("<dir>", "path to a scenario directory (must contain steps.ts)")
|
|
24
24
|
.option("--out <path>", "output directory for the bundle")
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// No commander defaults on the viewport flags: an absent flag must stay
|
|
26
|
+
// absent so the scenario's own authored viewport can apply (resolution
|
|
27
|
+
// in runPack: flags > authored > default). A baked-in default here made
|
|
28
|
+
// `createScenario({ viewport })` silently unreachable.
|
|
29
|
+
.option("--width <number>", `canonical viewport width in px (default: the scenario's authored viewport, else ${DEFAULT_WIDTH})`)
|
|
30
|
+
.option("--shell-height <number>", `shell height in px (default: the scenario's authored viewport, else ${DEFAULT_SHELL_HEIGHT})`)
|
|
27
31
|
.option("--stage", "float the scenario on a backdrop with a window shadow (screen-recording framing); " +
|
|
28
32
|
"the embed paints its own background instead of staying transparent")
|
|
29
33
|
.option("--keep-temp", "keep the generated entry directory for debugging")
|
|
@@ -32,8 +36,8 @@ export function registerPackCommand(program) {
|
|
|
32
36
|
const result = await runPack({
|
|
33
37
|
scenarioDir: dir,
|
|
34
38
|
outDir: options.out,
|
|
35
|
-
width:
|
|
36
|
-
shellHeight:
|
|
39
|
+
width: parseViewportFlag("--width", options.width),
|
|
40
|
+
shellHeight: parseViewportFlag("--shell-height", options.shellHeight),
|
|
37
41
|
stage: options.stage ?? false,
|
|
38
42
|
keepTemp: options.keepTemp,
|
|
39
43
|
onLog: (message) => process.stderr.write(`${message}\n`),
|
|
@@ -49,6 +53,21 @@ export function registerPackCommand(program) {
|
|
|
49
53
|
}
|
|
50
54
|
});
|
|
51
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse a viewport flag into a positive number, or `undefined` when the flag
|
|
58
|
+
* was not given. A malformed value errors instead of silently falling back —
|
|
59
|
+
* the previous `Number(x) || DEFAULT` coercion turned `--width 128O` (typo)
|
|
60
|
+
* into a default-size bundle with no warning.
|
|
61
|
+
*/
|
|
62
|
+
function parseViewportFlag(flag, value) {
|
|
63
|
+
if (value === undefined)
|
|
64
|
+
return undefined;
|
|
65
|
+
const parsed = Number(value);
|
|
66
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
67
|
+
throw new Error(`${flag} must be a positive number, got "${value}".`);
|
|
68
|
+
}
|
|
69
|
+
return parsed;
|
|
70
|
+
}
|
|
52
71
|
function formatBytes(bytes) {
|
|
53
72
|
if (bytes < 1024)
|
|
54
73
|
return `${bytes} B`;
|
package/src/commands/pack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../../../src/commands/pack.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,yEAAyE;AACzE,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC;AAE7C,0CAA0C;AAC1C,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,MAAM,CAAC;AAUrD,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,4DAA4D;QAC1D,mDAAmD;QACnD,6DAA6D;QAC7D,qEAAqE;QACrE,8DAA8D;QAC9D,yCAAyC;QACzC,kEAAkE;QAClE,oEAAoE;QACpE,kEAAkE;QAClE,oEAAoE;QACpE,oEAAoE;QACpE,yDAAyD;QACzD,mEAAmE,CACtE;SACA,QAAQ,CAAC,OAAO,EAAE,sDAAsD,CAAC;SACzE,MAAM,CAAC,cAAc,EAAE,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../../../src/commands/pack.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,yEAAyE;AACzE,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC;AAE7C,0CAA0C;AAC1C,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,MAAM,CAAC;AAUrD,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,4DAA4D;QAC1D,mDAAmD;QACnD,6DAA6D;QAC7D,qEAAqE;QACrE,8DAA8D;QAC9D,yCAAyC;QACzC,kEAAkE;QAClE,oEAAoE;QACpE,kEAAkE;QAClE,oEAAoE;QACpE,oEAAoE;QACpE,yDAAyD;QACzD,mEAAmE,CACtE;SACA,QAAQ,CAAC,OAAO,EAAE,sDAAsD,CAAC;SACzE,MAAM,CAAC,cAAc,EAAE,iCAAiC,CAAC;QAC1D,wEAAwE;QACxE,uEAAuE;QACvE,wEAAwE;QACxE,uDAAuD;SACtD,MAAM,CACL,kBAAkB,EAClB,mFAAmF,aAAa,GAAG,CACpG;SACA,MAAM,CACL,yBAAyB,EACzB,uEAAuE,oBAAoB,GAAG,CAC/F;SACA,MAAM,CACL,SAAS,EACT,oFAAoF;QAClF,oEAAoE,CACvE;SACA,MAAM,CAAC,aAAa,EAAE,kDAAkD,CAAC;SACzE,MAAM,CAAC,KAAK,EAAE,GAAW,EAAE,OAAoB,EAAE,EAAE;QAClD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;gBAC3B,WAAW,EAAE,GAAG;gBAChB,MAAM,EAAE,OAAO,CAAC,GAAG;gBACnB,KAAK,EAAE,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC;gBAClD,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,EAAE,OAAO,CAAC,WAAW,CAAC;gBACrE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;gBAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC;aACzD,CAAC,CAAC;YAEH,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,6BAA6B,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,SAAS;gBAChE,IAAI,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,MAAM,CAAC,MAAM,IAAI,CAC9D,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;QAClE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;YACvD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,IAAY,EAAE,KAAyB;IAChE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,oCAAoC,KAAK,IAAI,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IACnE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;AACrD,CAAC"}
|
package/src/commands/pack.ts
CHANGED
|
@@ -36,11 +36,17 @@ export function registerPackCommand(program: Command): void {
|
|
|
36
36
|
)
|
|
37
37
|
.argument("<dir>", "path to a scenario directory (must contain steps.ts)")
|
|
38
38
|
.option("--out <path>", "output directory for the bundle")
|
|
39
|
-
|
|
39
|
+
// No commander defaults on the viewport flags: an absent flag must stay
|
|
40
|
+
// absent so the scenario's own authored viewport can apply (resolution
|
|
41
|
+
// in runPack: flags > authored > default). A baked-in default here made
|
|
42
|
+
// `createScenario({ viewport })` silently unreachable.
|
|
43
|
+
.option(
|
|
44
|
+
"--width <number>",
|
|
45
|
+
`canonical viewport width in px (default: the scenario's authored viewport, else ${DEFAULT_WIDTH})`,
|
|
46
|
+
)
|
|
40
47
|
.option(
|
|
41
48
|
"--shell-height <number>",
|
|
42
|
-
`shell height in px (default: ${DEFAULT_SHELL_HEIGHT})`,
|
|
43
|
-
String(DEFAULT_SHELL_HEIGHT),
|
|
49
|
+
`shell height in px (default: the scenario's authored viewport, else ${DEFAULT_SHELL_HEIGHT})`,
|
|
44
50
|
)
|
|
45
51
|
.option(
|
|
46
52
|
"--stage",
|
|
@@ -53,8 +59,8 @@ export function registerPackCommand(program: Command): void {
|
|
|
53
59
|
const result = await runPack({
|
|
54
60
|
scenarioDir: dir,
|
|
55
61
|
outDir: options.out,
|
|
56
|
-
width:
|
|
57
|
-
shellHeight:
|
|
62
|
+
width: parseViewportFlag("--width", options.width),
|
|
63
|
+
shellHeight: parseViewportFlag("--shell-height", options.shellHeight),
|
|
58
64
|
stage: options.stage ?? false,
|
|
59
65
|
keepTemp: options.keepTemp,
|
|
60
66
|
onLog: (message) => process.stderr.write(`${message}\n`),
|
|
@@ -73,6 +79,21 @@ export function registerPackCommand(program: Command): void {
|
|
|
73
79
|
});
|
|
74
80
|
}
|
|
75
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Parse a viewport flag into a positive number, or `undefined` when the flag
|
|
84
|
+
* was not given. A malformed value errors instead of silently falling back —
|
|
85
|
+
* the previous `Number(x) || DEFAULT` coercion turned `--width 128O` (typo)
|
|
86
|
+
* into a default-size bundle with no warning.
|
|
87
|
+
*/
|
|
88
|
+
function parseViewportFlag(flag: string, value: string | undefined): number | undefined {
|
|
89
|
+
if (value === undefined) return undefined;
|
|
90
|
+
const parsed = Number(value);
|
|
91
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
92
|
+
throw new Error(`${flag} must be a positive number, got "${value}".`);
|
|
93
|
+
}
|
|
94
|
+
return parsed;
|
|
95
|
+
}
|
|
96
|
+
|
|
76
97
|
function formatBytes(bytes: number): string {
|
|
77
98
|
if (bytes < 1024) return `${bytes} B`;
|
|
78
99
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KiB`;
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
import { type AuthoredViewport } from "../util/load-ts.js";
|
|
1
2
|
/**
|
|
2
3
|
* The outcome of pack-time shot discovery.
|
|
3
4
|
*
|
|
4
5
|
* `recorded: true` is authoritative — `shots` is exactly what the packed
|
|
5
6
|
* capture page will report (possibly empty, which lets `scenar shoot` skip
|
|
6
|
-
* the browser entirely)
|
|
7
|
-
*
|
|
8
|
-
* the
|
|
7
|
+
* the browser entirely), and `authoredViewport` is the canonical viewport
|
|
8
|
+
* the scenario authors for itself (null = it authors none). `recorded:
|
|
9
|
+
* false` means the steps module could not be loaded under Node, so the
|
|
10
|
+
* shots are unknown and scenario.json must omit the key: absent = "boot a
|
|
11
|
+
* browser to find out".
|
|
9
12
|
*/
|
|
10
13
|
export type CollectedPackShots = {
|
|
11
14
|
readonly recorded: true;
|
|
12
15
|
readonly shots: readonly string[];
|
|
16
|
+
readonly authoredViewport: AuthoredViewport | null;
|
|
13
17
|
} | {
|
|
14
18
|
readonly recorded: false;
|
|
15
19
|
readonly reason: string;
|
|
16
20
|
};
|
|
17
21
|
/**
|
|
18
|
-
* Discover a scenario's declared shot names
|
|
19
|
-
*
|
|
22
|
+
* Discover a scenario's declared shot names — and its authored canonical
|
|
23
|
+
* viewport, if it declares one — at pack time, so the names can be recorded
|
|
24
|
+
* in the bundle's scenario.json and the viewport can participate in the
|
|
25
|
+
* packer's resolution (CLI flags > authored > default). One SSR load serves
|
|
26
|
+
* both discoveries; the viewport costs nothing extra.
|
|
20
27
|
*
|
|
21
28
|
* The steps module is loaded through Vite's SSR pipeline using the exact
|
|
22
29
|
* specifier the generated browser entry imports ({@link stepsModuleSpecifier})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-pack-shots.d.ts","sourceRoot":"","sources":["../../../src/pack/collect-pack-shots.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collect-pack-shots.d.ts","sourceRoot":"","sources":["../../../src/pack/collect-pack-shots.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAwC,MAAM,oBAAoB,CAAC;AAIjG;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACpD,GACD;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAuCvF"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { collectShotNames } from "@scenar/core";
|
|
2
|
-
import { findStepsArray } from "../util/load-ts.js";
|
|
2
|
+
import { findAuthoredViewport, findStepsArray } from "../util/load-ts.js";
|
|
3
3
|
import { loadViteToolkit, sharedViteConfig } from "./build.js";
|
|
4
4
|
import { stepsModuleSpecifier } from "./generate-embed-entry.js";
|
|
5
5
|
/**
|
|
6
|
-
* Discover a scenario's declared shot names
|
|
7
|
-
*
|
|
6
|
+
* Discover a scenario's declared shot names — and its authored canonical
|
|
7
|
+
* viewport, if it declares one — at pack time, so the names can be recorded
|
|
8
|
+
* in the bundle's scenario.json and the viewport can participate in the
|
|
9
|
+
* packer's resolution (CLI flags > authored > default). One SSR load serves
|
|
10
|
+
* both discoveries; the viewport costs nothing extra.
|
|
8
11
|
*
|
|
9
12
|
* The steps module is loaded through Vite's SSR pipeline using the exact
|
|
10
13
|
* specifier the generated browser entry imports ({@link stepsModuleSpecifier})
|
|
@@ -54,6 +57,10 @@ export async function collectPackShots(scenarioDir) {
|
|
|
54
57
|
`first element has a delayMs property. The packed embed would throw this ` +
|
|
55
58
|
`same error in the browser the moment it loads, so pack refuses to ship it.`);
|
|
56
59
|
}
|
|
57
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
recorded: true,
|
|
62
|
+
shots: collectShotNames(steps),
|
|
63
|
+
authoredViewport: findAuthoredViewport(stepsModule),
|
|
64
|
+
};
|
|
58
65
|
}
|
|
59
66
|
//# sourceMappingURL=collect-pack-shots.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-pack-shots.js","sourceRoot":"","sources":["../../../src/pack/collect-pack-shots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"collect-pack-shots.js","sourceRoot":"","sources":["../../../src/pack/collect-pack-shots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAyB,oBAAoB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAqBjE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,WAAmB;IACxD,MAAM,SAAS,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAG,MAAM,eAAe,EAAE,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;QAC7C,GAAG,gBAAgB,CAAC,OAAO,CAAC;QAC5B,IAAI,EAAE,WAAW;QACjB,sEAAsE;QACtE,qEAAqE;QACrE,MAAM,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE;QAC5C,YAAY,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;KACpC,CAAC,CAAC;IAEH,IAAI,WAAoC,CAAC;IACzC,IAAI,CAAC;QACH,WAAW,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC/D,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED,MAAM,KAAK,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAC1C,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,2BAA2B,SAAS,sCAAsC;YACxE,0EAA0E;YAC1E,4EAA4E,CAC/E,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC;QAC9B,gBAAgB,EAAE,oBAAoB,CAAC,WAAW,CAAC;KACpD,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { collectShotNames } from "@scenar/core";
|
|
2
|
-
import { findStepsArray } from "../util/load-ts.js";
|
|
2
|
+
import { type AuthoredViewport, findAuthoredViewport, findStepsArray } from "../util/load-ts.js";
|
|
3
3
|
import { loadViteToolkit, sharedViteConfig } from "./build.js";
|
|
4
4
|
import { stepsModuleSpecifier } from "./generate-embed-entry.js";
|
|
5
5
|
|
|
@@ -8,17 +8,26 @@ import { stepsModuleSpecifier } from "./generate-embed-entry.js";
|
|
|
8
8
|
*
|
|
9
9
|
* `recorded: true` is authoritative — `shots` is exactly what the packed
|
|
10
10
|
* capture page will report (possibly empty, which lets `scenar shoot` skip
|
|
11
|
-
* the browser entirely)
|
|
12
|
-
*
|
|
13
|
-
* the
|
|
11
|
+
* the browser entirely), and `authoredViewport` is the canonical viewport
|
|
12
|
+
* the scenario authors for itself (null = it authors none). `recorded:
|
|
13
|
+
* false` means the steps module could not be loaded under Node, so the
|
|
14
|
+
* shots are unknown and scenario.json must omit the key: absent = "boot a
|
|
15
|
+
* browser to find out".
|
|
14
16
|
*/
|
|
15
17
|
export type CollectedPackShots =
|
|
16
|
-
| {
|
|
18
|
+
| {
|
|
19
|
+
readonly recorded: true;
|
|
20
|
+
readonly shots: readonly string[];
|
|
21
|
+
readonly authoredViewport: AuthoredViewport | null;
|
|
22
|
+
}
|
|
17
23
|
| { readonly recorded: false; readonly reason: string };
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
|
-
* Discover a scenario's declared shot names
|
|
21
|
-
*
|
|
26
|
+
* Discover a scenario's declared shot names — and its authored canonical
|
|
27
|
+
* viewport, if it declares one — at pack time, so the names can be recorded
|
|
28
|
+
* in the bundle's scenario.json and the viewport can participate in the
|
|
29
|
+
* packer's resolution (CLI flags > authored > default). One SSR load serves
|
|
30
|
+
* both discoveries; the viewport costs nothing extra.
|
|
22
31
|
*
|
|
23
32
|
* The steps module is loaded through Vite's SSR pipeline using the exact
|
|
24
33
|
* specifier the generated browser entry imports ({@link stepsModuleSpecifier})
|
|
@@ -72,5 +81,9 @@ export async function collectPackShots(scenarioDir: string): Promise<CollectedPa
|
|
|
72
81
|
);
|
|
73
82
|
}
|
|
74
83
|
|
|
75
|
-
return {
|
|
84
|
+
return {
|
|
85
|
+
recorded: true,
|
|
86
|
+
shots: collectShotNames(steps),
|
|
87
|
+
authoredViewport: findAuthoredViewport(stepsModule),
|
|
88
|
+
};
|
|
76
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-embed-entry.d.ts","sourceRoot":"","sources":["../../../src/pack/generate-embed-entry.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sEAAsE;IACtE,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"generate-embed-entry.d.ts","sourceRoot":"","sources":["../../../src/pack/generate-embed-entry.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sEAAsE;IACtE,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CA2PjE;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAMA,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAKhD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,KAAK,UAAQ,GACZ,MAAM,CAmCR"}
|