motionary 10.7.0 → 10.8.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/CHANGELOG.md +20 -0
- package/README.md +42 -3
- package/dist/chunks/{anim-image-CFGpUX7t.cjs → anim-image-BzTQa2k3.cjs} +2 -2
- package/dist/chunks/{anim-image-CFGpUX7t.cjs.map → anim-image-BzTQa2k3.cjs.map} +1 -1
- package/dist/chunks/{anim-image-CXDD19FH.js → anim-image-iD646Q7i.js} +2 -2
- package/dist/chunks/{anim-image-CXDD19FH.js.map → anim-image-iD646Q7i.js.map} +1 -1
- package/dist/chunks/{keyframes-DwR6GPej.js → keyframes-B4zefz0k.js} +2 -2
- package/dist/chunks/{keyframes-DwR6GPej.js.map → keyframes-B4zefz0k.js.map} +1 -1
- package/dist/chunks/{keyframes-DdwGY1gr.cjs → keyframes-BlOyB1PP.cjs} +2 -2
- package/dist/chunks/{keyframes-DdwGY1gr.cjs.map → keyframes-BlOyB1PP.cjs.map} +1 -1
- package/dist/chunks/{registry-DhKZCitb.cjs → registry-BZxDVL3h.cjs} +2 -2
- package/dist/chunks/{registry-DhKZCitb.cjs.map → registry-BZxDVL3h.cjs.map} +1 -1
- package/dist/chunks/{registry-D87dP_aR.js → registry-Bkt3-3ET.js} +3 -3
- package/dist/chunks/{registry-D87dP_aR.js.map → registry-Bkt3-3ET.js.map} +1 -1
- package/dist/chunks/runtime-link-CUiZ8lbE.cjs +38 -0
- package/dist/chunks/runtime-link-CUiZ8lbE.cjs.map +1 -0
- package/dist/chunks/runtime-link-c13gskBZ.js +36 -0
- package/dist/chunks/runtime-link-c13gskBZ.js.map +1 -0
- package/dist/chunks/{ticker-jD9_A9Rh.cjs → ticker-BfxAECfO.cjs} +2 -2
- package/dist/chunks/{ticker-jD9_A9Rh.cjs.map → ticker-BfxAECfO.cjs.map} +1 -1
- package/dist/chunks/{ticker-CJYI5Pxc.js → ticker-ZtweD3U4.js} +2 -2
- package/dist/chunks/{ticker-CJYI5Pxc.js.map → ticker-ZtweD3U4.js.map} +1 -1
- package/dist/chunks/{tween-Dk0QmNe9.cjs → tween--MD-39y0.cjs} +2 -2
- package/dist/chunks/{tween-Dk0QmNe9.cjs.map → tween--MD-39y0.cjs.map} +1 -1
- package/dist/chunks/{tween-_Lld1MsF.js → tween-DACdkLyO.js} +2 -2
- package/dist/chunks/{tween-_Lld1MsF.js.map → tween-DACdkLyO.js.map} +1 -1
- package/dist/components/snap-carousel.cjs +216 -0
- package/dist/components/snap-carousel.cjs.map +1 -0
- package/dist/components/snap-carousel.d.cts +80 -0
- package/dist/components/snap-carousel.d.ts +80 -0
- package/dist/components/snap-carousel.js +214 -0
- package/dist/components/snap-carousel.js.map +1 -0
- package/dist/components/widgets.cjs +32 -46
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +77 -4
- package/dist/components/widgets.d.ts +77 -4
- package/dist/components/widgets.js +22 -36
- package/dist/components/widgets.js.map +1 -1
- package/dist/llms-full.txt +94 -6
- package/dist/llms.txt +6 -3
- package/dist/manifest.json +260 -19
- package/dist/runtime/drag-snap.cjs +269 -0
- package/dist/runtime/drag-snap.cjs.map +1 -0
- package/dist/runtime/drag-snap.d.cts +109 -0
- package/dist/runtime/drag-snap.d.ts +109 -0
- package/dist/runtime/drag-snap.iife.js +2 -0
- package/dist/runtime/drag-snap.iife.js.map +1 -0
- package/dist/runtime/drag-snap.js +261 -0
- package/dist/runtime/drag-snap.js.map +1 -0
- package/dist/runtime/format-apng.cjs +4 -4
- package/dist/runtime/format-apng.js +4 -4
- package/dist/runtime/format-css.cjs +4 -4
- package/dist/runtime/format-css.js +4 -4
- package/dist/runtime/format-gif.cjs +4 -4
- package/dist/runtime/format-gif.js +4 -4
- package/dist/runtime/format-gltf.cjs +37 -18
- package/dist/runtime/format-gltf.cjs.map +1 -1
- package/dist/runtime/format-gltf.d.cts +18 -2
- package/dist/runtime/format-gltf.d.ts +18 -2
- package/dist/runtime/format-gltf.iife.js +1 -1
- package/dist/runtime/format-gltf.iife.js.map +1 -1
- package/dist/runtime/format-gltf.js +37 -18
- package/dist/runtime/format-gltf.js.map +1 -1
- package/dist/runtime/format-motion.cjs +4 -4
- package/dist/runtime/format-motion.js +4 -4
- package/dist/runtime/format-obj.cjs +1 -1
- package/dist/runtime/format-obj.d.cts +2 -0
- package/dist/runtime/format-obj.d.ts +2 -0
- package/dist/runtime/format-obj.iife.js.map +1 -1
- package/dist/runtime/format-obj.js +1 -1
- package/dist/runtime/format-scene.cjs +1 -1
- package/dist/runtime/format-scene.js +1 -1
- package/dist/runtime/format-sprite.cjs +3 -3
- package/dist/runtime/format-sprite.js +3 -3
- package/dist/runtime/format-svg.cjs +3 -3
- package/dist/runtime/format-svg.js +3 -3
- package/dist/runtime/format-webp.cjs +4 -4
- package/dist/runtime/format-webp.js +4 -4
- package/dist/runtime/gl.cjs +17 -4
- package/dist/runtime/gl.cjs.map +1 -1
- package/dist/runtime/gl.d.cts +2 -0
- package/dist/runtime/gl.d.ts +2 -0
- package/dist/runtime/gl.iife.js +1 -1
- package/dist/runtime/gl.iife.js.map +1 -1
- package/dist/runtime/gl.js +17 -4
- package/dist/runtime/gl.js.map +1 -1
- package/dist/runtime/gltf-anim.cjs +251 -0
- package/dist/runtime/gltf-anim.cjs.map +1 -0
- package/dist/runtime/gltf-anim.d.cts +216 -0
- package/dist/runtime/gltf-anim.d.ts +216 -0
- package/dist/runtime/gltf-anim.iife.js +2 -0
- package/dist/runtime/gltf-anim.iife.js.map +1 -0
- package/dist/runtime/gltf-anim.js +243 -0
- package/dist/runtime/gltf-anim.js.map +1 -0
- package/dist/runtime/physics.cjs +1 -1
- package/dist/runtime/physics.js +1 -1
- package/dist/runtime/scroll.cjs +2 -2
- package/dist/runtime/scroll.js +2 -2
- package/dist/runtime/smooth.cjs +1 -1
- package/dist/runtime/smooth.js +1 -1
- package/dist/runtime/text.cjs +1 -1
- package/dist/runtime/text.js +1 -1
- package/dist/runtime/vector.cjs +421 -11
- package/dist/runtime/vector.cjs.map +1 -1
- package/dist/runtime/vector.d.cts +20 -4
- package/dist/runtime/vector.d.ts +20 -4
- package/dist/runtime/vector.iife.js +1 -1
- package/dist/runtime/vector.iife.js.map +1 -1
- package/dist/runtime/vector.js +421 -12
- package/dist/runtime/vector.js.map +1 -1
- package/dist/runtime.cjs +3 -3
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.iife.js +1 -1
- package/dist/runtime.iife.js.map +1 -1
- package/dist/runtime.js +5 -5
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +1 -1
- package/docs/components/README.md +3 -2
- package/docs/components/usa-gl-scene.md +27 -6
- package/docs/components/usa-lottie-player.md +18 -0
- package/docs/components/usa-snap-carousel.md +68 -0
- package/docs/components.md +51 -3
- package/docs/runtime/drag-snap.md +60 -0
- package/docs/runtime/format-gltf.md +3 -2
- package/docs/runtime/gltf-anim.md +62 -0
- package/docs/runtime/vector.md +3 -2
- package/package.json +31 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snap-carousel.js","sources":["../../src/components/widgets/snap-carousel.ts"],"sourcesContent":["import { defineElement, type UsaElement } from '../base';\nimport { runtimeModule } from './runtime-link';\nimport type { DragSnapApi, DragSnap } from '../../runtime/drag-snap';\nimport css from './snap-carousel.css?raw';\n\n/**\n * `<usa-snap-carousel>` (10.8) — a drag / swipe carousel with inertia and\n * snap points on **`motionary/runtime/drag-snap`** (requires `use(dragSnap)`\n * before it mounts). Each child is a slide; slides keep their own width\n * (CSS `--usa-sc-size`, default 80 %), so several can be visible (\"peek\").\n *\n * Its own entry point — `motionary/components/snap-carousel` — and **not**\n * part of `motionary/components/widgets` or `motionary/components/lite`\n * (10.8+ components ship as individual entry points so the bundles stay put).\n *\n * Attributes: `align` (start · center, default center), `gap` (px, default\n * 16), `index` (start slide), `autoplay` (ms; pauses on hover, focus, press,\n * off screen and under reduced motion; wraps), `no-controls`, `no-dots`,\n * `label` (accessible name, default \"Carousel\"). Keyboard: ←/→, Home / End\n * on the focused viewport. Without the runtime module the slides stay a\n * native CSS scroll-snap strip (plus the clear notice).\n *\n * API: `index`, `length`, `controller` (the DragSnap), `next()`, `prev()`,\n * `goTo(i, animate = true)`; `usa:change` { index, from }.\n */\nexport interface UsaSnapCarouselElement extends UsaElement {\n index: number;\n readonly length: number;\n readonly controller: DragSnap | null;\n next(): void;\n prev(): void;\n goTo(i: number, animate?: boolean): void;\n}\n\nexport function defineSnapCarousel(tag = 'usa-snap-carousel'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) => {\n class UsaSnapCarousel extends Base {\n static get observedAttributes(): string[] {\n return ['align', 'gap', 'autoplay', 'no-controls', 'no-dots', 'label'];\n }\n private slides: HTMLElement[] = [];\n private ds: DragSnap | null = null;\n private cur = 0;\n private sync: (() => void) | null = null;\n get length(): number {\n return this.slides.length;\n }\n get index(): number {\n return this.cur;\n }\n set index(v: number) {\n this.goTo(v);\n }\n get controller(): DragSnap | null {\n return this.ds;\n }\n next(): void {\n this.goTo(this.cur + 1 >= this.length ? 0 : this.cur + 1);\n }\n prev(): void {\n this.goTo(this.cur - 1 < 0 ? this.length - 1 : this.cur - 1);\n }\n goTo(i: number, animate = true): void {\n const n = Math.max(0, Math.min(this.length - 1, Math.round(i)));\n if (this.ds) this.ds.snapTo(n, animate && !this.reduced);\n else {\n this.slides[n]?.scrollIntoView?.({ block: 'nearest', inline: 'center' });\n this.set(n);\n }\n }\n private set(n: number): void {\n if (n === this.cur && this.dataset.ready !== undefined) return this.sync?.();\n const from = this.cur;\n this.cur = n;\n this.sync?.();\n if (from !== n) this.emit('change', { index: n, from });\n }\n mount(): void {\n // structure first (works without the runtime as a CSS scroll-snap strip)\n let vp = this.querySelector<HTMLElement>(':scope > .usa-sc-viewport');\n let track = vp?.querySelector<HTMLElement>(':scope > .usa-sc-track') || null;\n if (!vp || !track) {\n vp = document.createElement('div');\n vp.className = 'usa-sc-viewport';\n track = document.createElement('div');\n track.className = 'usa-sc-track';\n for (const c of Array.from(this.children)) if (c instanceof HTMLElement && !c.matches('.usa-rt-missing, .usa-sc-ui')) track.append(c);\n vp.append(track);\n this.append(vp);\n }\n this.querySelectorAll(':scope > .usa-sc-ui').forEach((x) => x.remove());\n this.slides = Array.from(track.children) as HTMLElement[];\n const N = this.slides.length;\n this.setAttribute('role', 'region');\n this.setAttribute('aria-roledescription', 'carousel');\n this.setAttribute('aria-label', this.str('label', 'Carousel'));\n vp.tabIndex = 0;\n vp.setAttribute('aria-label', `${this.str('label', 'Carousel')} — use the arrow keys`);\n this.style.setProperty('--usa-sc-gap', `${this.num('gap', 16)}px`);\n this.slides.forEach((s, i) => {\n s.setAttribute('role', 'group');\n s.setAttribute('aria-roledescription', 'slide');\n s.setAttribute('aria-label', `${i + 1} of ${N}`);\n });\n const live = document.createElement('p');\n live.className = 'usa-sc-ui usa-sc-live';\n live.setAttribute('aria-live', 'polite');\n this.append(live);\n let prevB: HTMLButtonElement | null = null, nextB: HTMLButtonElement | null = null;\n if (!this.flag('no-controls') && N > 1) {\n const mk = (cls: string, label: string, glyph: string, fn: () => void) => {\n const b = document.createElement('button');\n b.type = 'button';\n b.className = `usa-sc-ui usa-sc-nav ${cls}`;\n b.setAttribute('aria-label', label);\n b.textContent = glyph;\n this.listen(b, 'click', fn);\n this.append(b);\n return b;\n };\n prevB = mk('usa-sc-prev', 'Previous slide', '‹', () => this.goTo(this.cur - 1));\n nextB = mk('usa-sc-next', 'Next slide', '›', () => this.goTo(this.cur + 1));\n }\n const dots: HTMLButtonElement[] = [];\n if (!this.flag('no-dots') && N > 1) {\n const nav = document.createElement('div');\n nav.className = 'usa-sc-ui usa-sc-dots';\n nav.setAttribute('role', 'group');\n nav.setAttribute('aria-label', 'Choose a slide');\n this.slides.forEach((_, i) => {\n const d = document.createElement('button');\n d.type = 'button';\n d.className = 'usa-sc-dot';\n d.setAttribute('aria-label', `Go to slide ${i + 1}`);\n this.listen(d, 'click', () => this.goTo(i));\n nav.append(d);\n dots.push(d);\n });\n this.append(nav);\n }\n let announce = false;\n this.sync = () => {\n dots.forEach((d, i) => d.setAttribute('aria-current', String(i === this.cur)));\n if (prevB) prevB.disabled = this.cur <= 0;\n if (nextB) nextB.disabled = this.cur >= N - 1;\n this.slides.forEach((s, i) => s.toggleAttribute('data-active', i === this.cur));\n if (announce) live.textContent = `Slide ${this.cur + 1} of ${N}`;\n };\n this.listen(vp, 'keydown', (e: KeyboardEvent) => {\n const k = e.key;\n const to = k === 'ArrowRight' ? this.cur + 1 : k === 'ArrowLeft' ? this.cur - 1 : k === 'Home' ? 0 : k === 'End' ? N - 1 : null;\n if (to === null) return;\n e.preventDefault();\n announce = true;\n this.goTo(to);\n });\n this.listen(this, 'click', (e: Event) => {\n if ((e.target as Element)?.closest?.('.usa-sc-nav, .usa-sc-dot')) announce = true;\n }, { capture: true });\n const DS = runtimeModule<DragSnapApi>(this, 'drag-snap');\n const start = Math.max(0, Math.min(N - 1, this.num('index', 0)));\n this.cur = start;\n if (!DS) {\n this.sync();\n return;\n }\n this.dataset.ready = '';\n const center = this.str('align', 'center') !== 'start';\n const measure = (): number[] => {\n const vw = vp!.clientWidth;\n const max = Math.max(0, track!.scrollWidth - vw);\n return this.slides.map((s) => {\n const p = -(s.offsetLeft - (center ? (vw - s.offsetWidth) / 2 : 0));\n return center ? p : Math.max(-max, Math.min(0, p));\n });\n };\n const apply = (p: number) => (track!.style.transform = `translate3d(${p.toFixed(2)}px,0,0)`);\n const ds = DS.createDragSnap(track, {\n axis: 'x',\n snap: measure(),\n reducedMotion: this.reduced,\n onUpdate: apply,\n onSnap: (i) => this.set(i),\n onDragStart: () => this.toggleAttribute('data-dragging', true),\n onDragEnd: () => this.toggleAttribute('data-dragging', false),\n });\n this.ds = ds;\n ds.snapTo(start, false);\n this.set(start);\n this.onCleanup(() => {\n ds.dispose();\n this.ds = null;\n track!.style.transform = '';\n });\n const remeasure = () => ds.setSnapPoints(measure());\n this.listen(window, 'resize', remeasure, { passive: true });\n if (typeof ResizeObserver === 'function') {\n const ro = new ResizeObserver(remeasure);\n ro.observe(vp);\n this.onCleanup(() => ro.disconnect());\n }\n // autoplay: paused on hover / focus / press / off screen; never under reduced motion\n const every = this.num('autoplay', 0);\n if (every > 0 && N > 1 && !this.reduced) {\n let hold = 0, seen = true;\n const h = (d: number) => () => (hold = Math.max(0, hold + d));\n this.listen(this, 'pointerenter', h(1));\n this.listen(this, 'pointerleave', h(-1));\n this.listen(this, 'focusin', h(1));\n this.listen(this, 'focusout', h(-1));\n this.inView((v) => (seen = v));\n const t = setInterval(() => {\n if (!hold && seen && !ds.dragging) this.goTo(this.cur + 1 >= N ? 0 : this.cur + 1);\n }, Math.max(1200, every));\n this.onCleanup(() => clearInterval(t));\n }\n }\n unmount(): void {\n this.removeAttribute('data-ready');\n this.removeAttribute('data-dragging');\n }\n }\n return UsaSnapCarousel as unknown as CustomElementConstructor;\n },\n { id: 'snap-carousel', text: css }\n );\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-snap-carousel': UsaSnapCarouselElement;\n }\n}\n"],"names":[],"mappings":";;;;;;AAkCM,SAAU,kBAAkB,CAAC,GAAG,GAAG,mBAAmB,EAAA;AAC1D,IAAA,OAAO,aAAa,CAClB,GAAG,EACH,CAAC,IAAI,KAAI;QACP,MAAM,eAAgB,SAAQ,IAAI,CAAA;AAAlC,YAAA,WAAA,GAAA;;gBAIU,IAAA,CAAA,MAAM,GAAkB,EAAE;gBAC1B,IAAA,CAAA,EAAE,GAAoB,IAAI;gBAC1B,IAAA,CAAA,GAAG,GAAG,CAAC;gBACP,IAAA,CAAA,IAAI,GAAwB,IAAI;YAkL1C;AAxLE,YAAA,WAAW,kBAAkB,GAAA;AAC3B,gBAAA,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,CAAC;YACxE;AAKA,YAAA,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}
|
|
@@ -22,7 +22,8 @@ var components_fxSafe = require('./fx-safe.cjs');
|
|
|
22
22
|
var components_fxPerf = require('./fx-perf.cjs');
|
|
23
23
|
var components_design = require('./design.cjs');
|
|
24
24
|
var components_native = require('./native.cjs');
|
|
25
|
-
var registry$1 = require('../chunks/registry-
|
|
25
|
+
var registry$1 = require('../chunks/registry-BZxDVL3h.cjs');
|
|
26
|
+
var runtimeLink = require('../chunks/runtime-link-CUiZ8lbE.cjs');
|
|
26
27
|
var components_tokens = require('./tokens.cjs');
|
|
27
28
|
var components_ai = require('./ai.cjs');
|
|
28
29
|
require('../chunks/core-MQlXZKUG.cjs');
|
|
@@ -10182,38 +10183,6 @@ function defineNativePreview(tag = 'usa-native-preview') {
|
|
|
10182
10183
|
}, { id: 'native-preview', text: css$h });
|
|
10183
10184
|
}
|
|
10184
10185
|
|
|
10185
|
-
/**
|
|
10186
|
-
* 10.1: how runtime-powered components reach `motionary/runtime` without
|
|
10187
|
-
* importing it — they read the page-wide module registry (only the tiny
|
|
10188
|
-
* registry file is bundled with the component) and, when a module is
|
|
10189
|
-
* missing, show the clear install / import / CDN message in place, log it
|
|
10190
|
-
* once and dispatch `usa:runtime-missing`.
|
|
10191
|
-
*/
|
|
10192
|
-
const logged = new Set();
|
|
10193
|
-
/** The module API, or null after rendering the "missing module" notice into `host`. */
|
|
10194
|
-
function runtimeModule(host, id) {
|
|
10195
|
-
const who = `<${host.localName}>`;
|
|
10196
|
-
try {
|
|
10197
|
-
return registry$1.requireModule(id, who);
|
|
10198
|
-
}
|
|
10199
|
-
catch {
|
|
10200
|
-
const msg = registry$1.missingMessage(id, who);
|
|
10201
|
-
if (!logged.has(id + who)) {
|
|
10202
|
-
logged.add(id + who);
|
|
10203
|
-
console.error(msg);
|
|
10204
|
-
}
|
|
10205
|
-
if (!host.querySelector(':scope > .usa-rt-missing')) {
|
|
10206
|
-
const p = document.createElement('p');
|
|
10207
|
-
p.className = 'usa-rt-missing';
|
|
10208
|
-
p.setAttribute('role', 'alert');
|
|
10209
|
-
p.textContent = msg;
|
|
10210
|
-
host.prepend(p);
|
|
10211
|
-
}
|
|
10212
|
-
host.dispatchEvent(new CustomEvent('usa:runtime-missing', { detail: { module: id, message: msg }, bubbles: true }));
|
|
10213
|
-
return null;
|
|
10214
|
-
}
|
|
10215
|
-
}
|
|
10216
|
-
|
|
10217
10186
|
var css$g = "usa-plugin-card{display:block;max-width:100%;box-sizing:border-box;padding:14px;border-radius:16px;background:#fff;border:1px solid #e2e8f0;box-shadow:0 10px 26px -18px rgba(15,23,42,.55);color:#0f172a;font:13px/1.45 system-ui,sans-serif}usa-plugin-card .usa-pc-head{display:flex;align-items:center;gap:10px;min-width:0}usa-plugin-card .usa-pc-logo{flex:none;display:grid;place-items:center;width:38px;height:38px;border-radius:11px;background:linear-gradient(135deg,#6366f1,#ec4899);color:#fff;font:800 17px/1 system-ui,sans-serif}usa-plugin-card .usa-pc-meta{display:flex;flex-direction:column;min-width:0;flex:1}usa-plugin-card .usa-pc-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}usa-plugin-card .usa-pc-sub{color:#64748b;font-size:11.5px}usa-plugin-card .usa-pc-dl{flex:none;color:#475569;font:600 12px/1 ui-monospace,monospace}usa-plugin-card .usa-pc-badges{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 8px}usa-plugin-card .usa-pc-badge{padding:3px 8px;border-radius:999px;background:#f1f5f9;color:#334155;font:600 11px/1.3 system-ui,sans-serif}usa-plugin-card .usa-pc-compat[data-ok=true],usa-plugin-card .usa-pc-sig[data-state=ok]{background:#dcfce7;color:#166534}usa-plugin-card .usa-pc-compat[data-ok=false],usa-plugin-card .usa-pc-sig[data-state=bad]{background:#fee2e2;color:#991b1b}usa-plugin-card .usa-pc-more{padding:5px 10px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;font:600 12px/1 system-ui,sans-serif;cursor:pointer}usa-plugin-card .usa-pc-details{margin-top:8px;color:#334155}usa-plugin-card .usa-rt-missing{margin:0 0 8px;padding:8px;border-radius:8px;background:#fef2f2;color:#991b1b;font:11px/1.4 ui-monospace,monospace;overflow-wrap:anywhere}";
|
|
10218
10187
|
|
|
10219
10188
|
const fmt = (n) => (n >= 1e6 ? (n / 1e6).toFixed(1) + 'M' : n >= 1e3 ? (n / 1e3).toFixed(1) + 'k' : String(Math.round(n)));
|
|
@@ -10231,7 +10200,7 @@ function definePluginCard(tag = 'usa-plugin-card') {
|
|
|
10231
10200
|
return components_marketplace.checkCompat({ name: this.str('title', this.str('name')), engines: { motionary: this.str('engine', '*') } }, registry$1.RUNTIME_VERSION);
|
|
10232
10201
|
}
|
|
10233
10202
|
mount() {
|
|
10234
|
-
this.rt = runtimeModule(this, 'core');
|
|
10203
|
+
this.rt = runtimeLink.runtimeModule(this, 'core');
|
|
10235
10204
|
if (!this.querySelector(':scope > .usa-pc-head')) {
|
|
10236
10205
|
const kids = Array.from(this.childNodes).filter((n) => !(n instanceof HTMLElement && n.classList.contains('usa-rt-missing')));
|
|
10237
10206
|
const name = this.str('title', this.str('name', 'plugin'));
|
|
@@ -10435,7 +10404,7 @@ function defineScrollScene(tag = 'usa-scroll-scene') {
|
|
|
10435
10404
|
this.scene?.refresh();
|
|
10436
10405
|
}
|
|
10437
10406
|
mount() {
|
|
10438
|
-
const sc = runtimeModule(this, 'scroll');
|
|
10407
|
+
const sc = runtimeLink.runtimeModule(this, 'scroll');
|
|
10439
10408
|
const core = sc && registry$1.requireModule('core'); // registered by use(scroll)
|
|
10440
10409
|
if (!sc || !core)
|
|
10441
10410
|
return;
|
|
@@ -10752,7 +10721,7 @@ function defineTextSplitter(tag = 'usa-text-splitter') {
|
|
|
10752
10721
|
return by === 'lines' && r.lines.length ? r.lines : by === 'words' ? r.words : r.chars;
|
|
10753
10722
|
}
|
|
10754
10723
|
mount() {
|
|
10755
|
-
const tx = runtimeModule(this, 'text');
|
|
10724
|
+
const tx = runtimeLink.runtimeModule(this, 'text');
|
|
10756
10725
|
if (!tx)
|
|
10757
10726
|
return;
|
|
10758
10727
|
const by = this.str('split', 'chars');
|
|
@@ -11085,7 +11054,7 @@ function defineSmoothScroll(tag = 'usa-smooth-scroll') {
|
|
|
11085
11054
|
return this.s;
|
|
11086
11055
|
}
|
|
11087
11056
|
mount() {
|
|
11088
|
-
const api = runtimeModule(this, 'smooth');
|
|
11057
|
+
const api = runtimeLink.runtimeModule(this, 'smooth');
|
|
11089
11058
|
if (!api)
|
|
11090
11059
|
return;
|
|
11091
11060
|
const wrapper = this.flag('wrapper');
|
|
@@ -11156,9 +11125,13 @@ function defineGlScene(tag = 'usa-gl-scene') {
|
|
|
11156
11125
|
this.cam = null;
|
|
11157
11126
|
this.node = null;
|
|
11158
11127
|
this.r = null;
|
|
11128
|
+
this.an = null;
|
|
11159
11129
|
}
|
|
11160
11130
|
static get observedAttributes() {
|
|
11161
|
-
return ['src', 'shape', 'color', 'metallic', 'roughness', 'background', 'exposure', 'controls', 'auto-rotate', 'video', 'video-scrub', 'label'];
|
|
11131
|
+
return ['src', 'shape', 'color', 'metallic', 'roughness', 'background', 'exposure', 'controls', 'auto-rotate', 'video', 'video-scrub', 'label', 'animation', 'animation-speed'];
|
|
11132
|
+
}
|
|
11133
|
+
get animator() {
|
|
11134
|
+
return this.an;
|
|
11162
11135
|
}
|
|
11163
11136
|
get scene() {
|
|
11164
11137
|
return this.s;
|
|
@@ -11174,7 +11147,7 @@ function defineGlScene(tag = 'usa-gl-scene') {
|
|
|
11174
11147
|
return Promise.resolve();
|
|
11175
11148
|
}
|
|
11176
11149
|
mount() {
|
|
11177
|
-
const G = runtimeModule(this, 'gl');
|
|
11150
|
+
const G = runtimeLink.runtimeModule(this, 'gl');
|
|
11178
11151
|
if (!G)
|
|
11179
11152
|
return;
|
|
11180
11153
|
const canvas = document.createElement('canvas');
|
|
@@ -11232,13 +11205,22 @@ function defineGlScene(tag = 'usa-gl-scene') {
|
|
|
11232
11205
|
G.frameNode(cam, n, 1.15);
|
|
11233
11206
|
let meshes = 0;
|
|
11234
11207
|
n.traverse((x) => (meshes += x.mesh ? (Array.isArray(x.mesh) ? x.mesh.length : 1) : 0));
|
|
11235
|
-
this.
|
|
11208
|
+
const clip = this.getAttribute('animation');
|
|
11209
|
+
if (clip !== null && clip !== 'none' && n.extras.gltf) {
|
|
11210
|
+
const A = runtimeLink.runtimeModule(this, 'gltf-anim');
|
|
11211
|
+
if (A) {
|
|
11212
|
+
const an = (this.an = A.gltfAnimator(n, { clip: clip === '' ? 0 : /^\d+$/.test(clip) ? +clip : clip, speed: this.num('animation-speed', 1) }));
|
|
11213
|
+
if (!an.clip && an.clips.length)
|
|
11214
|
+
this.emit('error', { error: `no animation "${clip}" (have: ${an.clips.map((c) => c.name).join(', ')})` });
|
|
11215
|
+
}
|
|
11216
|
+
}
|
|
11217
|
+
this.emit('load', { meshes, animations: this.an ? this.an.clips.map((c) => c.name) : [] });
|
|
11236
11218
|
this.dataset.loaded = '';
|
|
11237
11219
|
};
|
|
11238
11220
|
const src = this.str('src');
|
|
11239
11221
|
if (src) {
|
|
11240
11222
|
const isObj = /\.obj(\?|#|$)/i.test(src);
|
|
11241
|
-
const loader = isObj ? runtimeModule(this, 'format-obj') : runtimeModule(this, 'format-gltf');
|
|
11223
|
+
const loader = isObj ? runtimeLink.runtimeModule(this, 'format-obj') : runtimeLink.runtimeModule(this, 'format-gltf');
|
|
11242
11224
|
if (!loader)
|
|
11243
11225
|
return;
|
|
11244
11226
|
(isObj ? loader.loadObj(new URL(src, location.href).href) : loader.loadGltf(new URL(src, location.href).href))
|
|
@@ -11256,6 +11238,7 @@ function defineGlScene(tag = 'usa-gl-scene') {
|
|
|
11256
11238
|
ctl?.dispose();
|
|
11257
11239
|
r.dispose();
|
|
11258
11240
|
this.r = null;
|
|
11241
|
+
this.an = null;
|
|
11259
11242
|
});
|
|
11260
11243
|
let visible = false, raf = 0, last = 0, t = 0;
|
|
11261
11244
|
const frame = (now) => {
|
|
@@ -11271,8 +11254,11 @@ function defineGlScene(tag = 'usa-gl-scene') {
|
|
|
11271
11254
|
const rc = this.getBoundingClientRect();
|
|
11272
11255
|
G.scrubVideo(video, Math.min(1, Math.max(0, (innerHeight - rc.top) / (innerHeight + rc.height))));
|
|
11273
11256
|
}
|
|
11257
|
+
const play = !!this.an?.clip && !this.reduced;
|
|
11258
|
+
if (play)
|
|
11259
|
+
this.an.update(dt / 1000);
|
|
11274
11260
|
r.render(scene, cam, t);
|
|
11275
|
-
if (visible && (spin || ctl || video || !this.dataset.loaded))
|
|
11261
|
+
if (visible && (spin || ctl || video || play || !this.dataset.loaded))
|
|
11276
11262
|
raf = requestAnimationFrame(frame);
|
|
11277
11263
|
};
|
|
11278
11264
|
const kick = () => {
|
|
@@ -11709,7 +11695,7 @@ function defineLottiePlayer(tag = 'usa-lottie-player') {
|
|
|
11709
11695
|
this.p.seek((frame / this.data.fr) * 1000);
|
|
11710
11696
|
}
|
|
11711
11697
|
mount() {
|
|
11712
|
-
const V = runtimeModule(this, 'vector');
|
|
11698
|
+
const V = runtimeLink.runtimeModule(this, 'vector');
|
|
11713
11699
|
if (!V)
|
|
11714
11700
|
return;
|
|
11715
11701
|
const canvas = document.createElement('canvas');
|
|
@@ -12126,14 +12112,14 @@ function definePhysicsPlayground(tag = 'usa-physics-playground') {
|
|
|
12126
12112
|
this.setAttribute('paused', '');
|
|
12127
12113
|
}
|
|
12128
12114
|
toScene() {
|
|
12129
|
-
const F = runtimeModule(this, 'format-scene');
|
|
12115
|
+
const F = runtimeLink.runtimeModule(this, 'format-scene');
|
|
12130
12116
|
if (!F || !this.w || !this.sc)
|
|
12131
12117
|
return null;
|
|
12132
12118
|
return F.worldToScene(this.w, { width: this.sc.world.width, height: this.sc.world.height, walls: !!this.sc.world.walls });
|
|
12133
12119
|
}
|
|
12134
12120
|
mount() {
|
|
12135
|
-
const P = runtimeModule(this, 'physics');
|
|
12136
|
-
const F = P && runtimeModule(this, 'format-scene');
|
|
12121
|
+
const P = runtimeLink.runtimeModule(this, 'physics');
|
|
12122
|
+
const F = P && runtimeLink.runtimeModule(this, 'format-scene');
|
|
12137
12123
|
if (!P || !F)
|
|
12138
12124
|
return;
|
|
12139
12125
|
this.running = !this.flag('paused');
|