motionary 10.0.0 → 10.2.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/AGENTS.md +61 -0
- package/CHANGELOG.md +36 -0
- package/README.md +82 -0
- package/bin/create-motionary-plugin.mjs +124 -0
- package/dist/chunks/keyframes-W-474DMc.js +183 -0
- package/dist/chunks/keyframes-W-474DMc.js.map +1 -0
- package/dist/chunks/keyframes-ZheOkpt0.cjs +187 -0
- package/dist/chunks/keyframes-ZheOkpt0.cjs.map +1 -0
- package/dist/chunks/registry-BIEjKngP.js +69 -0
- package/dist/chunks/registry-BIEjKngP.js.map +1 -0
- package/dist/chunks/registry-eJgpFAzI.cjs +81 -0
- package/dist/chunks/registry-eJgpFAzI.cjs.map +1 -0
- package/dist/chunks/ticker-CM_56oVy.js +70 -0
- package/dist/chunks/ticker-CM_56oVy.js.map +1 -0
- package/dist/chunks/ticker-D4o6enH0.cjs +72 -0
- package/dist/chunks/ticker-D4o6enH0.cjs.map +1 -0
- package/dist/chunks/tween-CBuWYpI-.cjs +487 -0
- package/dist/chunks/tween-CBuWYpI-.cjs.map +1 -0
- package/dist/chunks/tween-CqX1JBuj.js +476 -0
- package/dist/chunks/tween-CqX1JBuj.js.map +1 -0
- package/dist/components/core.cjs +106 -0
- package/dist/components/core.cjs.map +1 -1
- package/dist/components/core.d.cts +44 -2
- package/dist/components/core.d.ts +44 -2
- package/dist/components/core.js +105 -1
- package/dist/components/core.js.map +1 -1
- package/dist/components/marketplace.cjs +104 -0
- package/dist/components/marketplace.cjs.map +1 -1
- package/dist/components/marketplace.d.cts +33 -2
- package/dist/components/marketplace.d.ts +33 -2
- package/dist/components/marketplace.js +101 -1
- package/dist/components/marketplace.js.map +1 -1
- package/dist/components/widgets.cjs +623 -199
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +186 -2
- package/dist/components/widgets.d.ts +186 -2
- package/dist/components/widgets.js +620 -201
- package/dist/components/widgets.js.map +1 -1
- package/dist/llms-full.txt +3115 -0
- package/dist/llms.txt +211 -0
- package/dist/manifest.json +7820 -0
- package/dist/manifest.schema.json +85 -0
- package/dist/runtime/format-css.cjs +185 -0
- package/dist/runtime/format-css.cjs.map +1 -0
- package/dist/runtime/format-css.d.cts +174 -0
- package/dist/runtime/format-css.d.ts +174 -0
- package/dist/runtime/format-css.iife.js +2 -0
- package/dist/runtime/format-css.iife.js.map +1 -0
- package/dist/runtime/format-css.js +177 -0
- package/dist/runtime/format-css.js.map +1 -0
- package/dist/runtime/format-motion.cjs +139 -0
- package/dist/runtime/format-motion.cjs.map +1 -0
- package/dist/runtime/format-motion.d.cts +208 -0
- package/dist/runtime/format-motion.d.ts +208 -0
- package/dist/runtime/format-motion.iife.js +2 -0
- package/dist/runtime/format-motion.iife.js.map +1 -0
- package/dist/runtime/format-motion.js +133 -0
- package/dist/runtime/format-motion.js.map +1 -0
- package/dist/runtime/format-svg.cjs +457 -0
- package/dist/runtime/format-svg.cjs.map +1 -0
- package/dist/runtime/format-svg.d.cts +214 -0
- package/dist/runtime/format-svg.d.ts +214 -0
- package/dist/runtime/format-svg.iife.js +2 -0
- package/dist/runtime/format-svg.iife.js.map +1 -0
- package/dist/runtime/format-svg.js +446 -0
- package/dist/runtime/format-svg.js.map +1 -0
- package/dist/runtime/scroll.cjs +301 -0
- package/dist/runtime/scroll.cjs.map +1 -0
- package/dist/runtime/scroll.d.cts +236 -0
- package/dist/runtime/scroll.d.ts +236 -0
- package/dist/runtime/scroll.iife.js +2 -0
- package/dist/runtime/scroll.iife.js.map +1 -0
- package/dist/runtime/scroll.js +292 -0
- package/dist/runtime/scroll.js.map +1 -0
- package/dist/runtime.cjs +79 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +236 -0
- package/dist/runtime.d.ts +236 -0
- package/dist/runtime.iife.js +2 -0
- package/dist/runtime.iife.js.map +1 -0
- package/dist/runtime.js +55 -0
- package/dist/runtime.js.map +1 -0
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +69 -38
- package/docs/ai-prompt-guide.md +54 -0
- package/docs/components/README.md +253 -0
- package/docs/components/usa-accordion.md +38 -0
- package/docs/components/usa-acrylic.md +38 -0
- package/docs/components/usa-add-to-cart.md +40 -0
- package/docs/components/usa-ambient.md +32 -0
- package/docs/components/usa-anim-icon.md +34 -0
- package/docs/components/usa-audio.md +38 -0
- package/docs/components/usa-aurora.md +36 -0
- package/docs/components/usa-auto-animate.md +44 -0
- package/docs/components/usa-auto-skeleton.md +38 -0
- package/docs/components/usa-avatar-stack.md +38 -0
- package/docs/components/usa-back-to-top.md +32 -0
- package/docs/components/usa-badge-wall.md +39 -0
- package/docs/components/usa-badge.md +36 -0
- package/docs/components/usa-bar-chart.md +33 -0
- package/docs/components/usa-bg-generator.md +32 -0
- package/docs/components/usa-blobs.md +32 -0
- package/docs/components/usa-bottom-sheet.md +32 -0
- package/docs/components/usa-button.md +78 -0
- package/docs/components/usa-card-stack.md +40 -0
- package/docs/components/usa-card.md +94 -0
- package/docs/components/usa-carousel-3d.md +40 -0
- package/docs/components/usa-carousel.md +40 -0
- package/docs/components/usa-cart-drawer.md +33 -0
- package/docs/components/usa-chapter-nav.md +40 -0
- package/docs/components/usa-chat-composer.md +33 -0
- package/docs/components/usa-check.md +32 -0
- package/docs/components/usa-checkbox.md +32 -0
- package/docs/components/usa-click.md +36 -0
- package/docs/components/usa-clock-control.md +37 -0
- package/docs/components/usa-code-export.md +36 -0
- package/docs/components/usa-color-picker.md +32 -0
- package/docs/components/usa-command-palette.md +39 -0
- package/docs/components/usa-compare.md +38 -0
- package/docs/components/usa-countdown.md +32 -0
- package/docs/components/usa-counter.md +32 -0
- package/docs/components/usa-cube-gallery.md +40 -0
- package/docs/components/usa-cube.md +36 -0
- package/docs/components/usa-cursor.md +32 -0
- package/docs/components/usa-date-picker.md +32 -0
- package/docs/components/usa-depth.md +44 -0
- package/docs/components/usa-dialog.md +40 -0
- package/docs/components/usa-disclosure.md +38 -0
- package/docs/components/usa-distort.md +36 -0
- package/docs/components/usa-dock.md +40 -0
- package/docs/components/usa-dot-network.md +32 -0
- package/docs/components/usa-double-tap.md +36 -0
- package/docs/components/usa-draggable.md +38 -0
- package/docs/components/usa-draw.md +36 -0
- package/docs/components/usa-drawer.md +34 -0
- package/docs/components/usa-equalizer.md +33 -0
- package/docs/components/usa-fab.md +40 -0
- package/docs/components/usa-festival-banner.md +32 -0
- package/docs/components/usa-field.md +34 -0
- package/docs/components/usa-file-drop.md +35 -0
- package/docs/components/usa-fullpage.md +38 -0
- package/docs/components/usa-fx.md +851 -0
- package/docs/components/usa-gauge.md +32 -0
- package/docs/components/usa-gen-art.md +32 -0
- package/docs/components/usa-gesture-fx.md +36 -0
- package/docs/components/usa-gesture-sticker.md +36 -0
- package/docs/components/usa-glitch.md +32 -0
- package/docs/components/usa-globe.md +33 -0
- package/docs/components/usa-gradient-text.md +32 -0
- package/docs/components/usa-grain.md +36 -0
- package/docs/components/usa-grid-glow.md +36 -0
- package/docs/components/usa-gyro-card.md +38 -0
- package/docs/components/usa-handwriting.md +32 -0
- package/docs/components/usa-hero-video.md +38 -0
- package/docs/components/usa-hold.md +32 -0
- package/docs/components/usa-hud-panel.md +38 -0
- package/docs/components/usa-hydrate.md +42 -0
- package/docs/components/usa-icon-morph.md +34 -0
- package/docs/components/usa-install-button.md +32 -0
- package/docs/components/usa-kanban.md +46 -0
- package/docs/components/usa-keyframe-editor.md +37 -0
- package/docs/components/usa-kpi.md +32 -0
- package/docs/components/usa-leaderboard.md +41 -0
- package/docs/components/usa-like.md +32 -0
- package/docs/components/usa-liquid-nav.md +36 -0
- package/docs/components/usa-liquid.md +36 -0
- package/docs/components/usa-loading-bar.md +35 -0
- package/docs/components/usa-location-card.md +34 -0
- package/docs/components/usa-lottie-icon.md +34 -0
- package/docs/components/usa-lottie.md +32 -0
- package/docs/components/usa-lyrics.md +38 -0
- package/docs/components/usa-magnetic.md +32 -0
- package/docs/components/usa-marquee.md +38 -0
- package/docs/components/usa-mask-reveal.md +36 -0
- package/docs/components/usa-masonry-flow.md +42 -0
- package/docs/components/usa-masonry.md +38 -0
- package/docs/components/usa-menu-toggle.md +34 -0
- package/docs/components/usa-menu.md +44 -0
- package/docs/components/usa-message-list.md +39 -0
- package/docs/components/usa-milestones.md +40 -0
- package/docs/components/usa-modal.md +42 -0
- package/docs/components/usa-morph.md +34 -0
- package/docs/components/usa-motion-inspector.md +32 -0
- package/docs/components/usa-motion-prefs.md +32 -0
- package/docs/components/usa-motion-spec.md +32 -0
- package/docs/components/usa-motion-switch.md +34 -0
- package/docs/components/usa-motion-theme.md +40 -0
- package/docs/components/usa-motion.md +42 -0
- package/docs/components/usa-music-player.md +36 -0
- package/docs/components/usa-native-preview.md +36 -0
- package/docs/components/usa-nav-morph.md +40 -0
- package/docs/components/usa-navbar.md +36 -0
- package/docs/components/usa-notification-bell.md +37 -0
- package/docs/components/usa-odometer.md +34 -0
- package/docs/components/usa-organic-card.md +36 -0
- package/docs/components/usa-otp.md +33 -0
- package/docs/components/usa-overscroll.md +36 -0
- package/docs/components/usa-pack.md +111 -0
- package/docs/components/usa-pagination.md +32 -0
- package/docs/components/usa-panorama.md +32 -0
- package/docs/components/usa-particles.md +32 -0
- package/docs/components/usa-pause-all.md +32 -0
- package/docs/components/usa-perf-monitor.md +32 -0
- package/docs/components/usa-pinch-zoom.md +36 -0
- package/docs/components/usa-player.md +38 -0
- package/docs/components/usa-plugin-card.md +61 -0
- package/docs/components/usa-plugin-store.md +36 -0
- package/docs/components/usa-popover.md +38 -0
- package/docs/components/usa-post-fx.md +36 -0
- package/docs/components/usa-presence.md +36 -0
- package/docs/components/usa-press.md +32 -0
- package/docs/components/usa-prize-wheel.md +32 -0
- package/docs/components/usa-product-gallery.md +40 -0
- package/docs/components/usa-progress-ring.md +38 -0
- package/docs/components/usa-progress.md +34 -0
- package/docs/components/usa-prop-panel.md +34 -0
- package/docs/components/usa-pull-cord.md +32 -0
- package/docs/components/usa-pull-refresh.md +37 -0
- package/docs/components/usa-radar.md +32 -0
- package/docs/components/usa-reactions.md +32 -0
- package/docs/components/usa-red-envelope.md +32 -0
- package/docs/components/usa-retro-button.md +34 -0
- package/docs/components/usa-reveal.md +36 -0
- package/docs/components/usa-ripple.md +32 -0
- package/docs/components/usa-scene.md +38 -0
- package/docs/components/usa-scramble.md +32 -0
- package/docs/components/usa-scroll-highlight.md +34 -0
- package/docs/components/usa-scroll-progress.md +36 -0
- package/docs/components/usa-scroll-scene.md +66 -0
- package/docs/components/usa-scrolly.md +40 -0
- package/docs/components/usa-segmented.md +40 -0
- package/docs/components/usa-shader.md +74 -0
- package/docs/components/usa-sheet.md +42 -0
- package/docs/components/usa-shimmer-text.md +32 -0
- package/docs/components/usa-shortcut.md +34 -0
- package/docs/components/usa-skeleton-reveal.md +42 -0
- package/docs/components/usa-skeleton.md +36 -0
- package/docs/components/usa-sketch-chart.md +32 -0
- package/docs/components/usa-slider.md +32 -0
- package/docs/components/usa-sparkline.md +32 -0
- package/docs/components/usa-spatial-card.md +40 -0
- package/docs/components/usa-spinner.md +34 -0
- package/docs/components/usa-splash.md +36 -0
- package/docs/components/usa-split-text.md +32 -0
- package/docs/components/usa-spotlight.md +40 -0
- package/docs/components/usa-spring.md +42 -0
- package/docs/components/usa-stagger.md +40 -0
- package/docs/components/usa-star-rating.md +34 -0
- package/docs/components/usa-stepper.md +42 -0
- package/docs/components/usa-sticky-stack.md +40 -0
- package/docs/components/usa-sticky-wall.md +40 -0
- package/docs/components/usa-stories.md +38 -0
- package/docs/components/usa-story.md +80 -0
- package/docs/components/usa-suggestion-chips.md +32 -0
- package/docs/components/usa-swipe-deck.md +40 -0
- package/docs/components/usa-swipeable.md +36 -0
- package/docs/components/usa-switch.md +32 -0
- package/docs/components/usa-tab-bar.md +46 -0
- package/docs/components/usa-tabs.md +40 -0
- package/docs/components/usa-terminal.md +38 -0
- package/docs/components/usa-text-rotate.md +32 -0
- package/docs/components/usa-theme-surface.md +36 -0
- package/docs/components/usa-theme-switcher.md +32 -0
- package/docs/components/usa-tilt.md +36 -0
- package/docs/components/usa-timeline.md +40 -0
- package/docs/components/usa-tip.md +44 -0
- package/docs/components/usa-toast-stack.md +36 -0
- package/docs/components/usa-toaster.md +36 -0
- package/docs/components/usa-typewriter.md +32 -0
- package/docs/components/usa-upload-progress.md +33 -0
- package/docs/components/usa-video-card.md +40 -0
- package/docs/components/usa-view-switch.md +38 -0
- package/docs/components/usa-voice-button.md +33 -0
- package/docs/components/usa-volume-knob.md +32 -0
- package/docs/components/usa-water-ripple.md +36 -0
- package/docs/components/usa-wave-text.md +32 -0
- package/docs/components/usa-weather-card.md +32 -0
- package/docs/components/usa-worker-canvas.md +32 -0
- package/docs/components/usa-xp-bar.md +33 -0
- package/docs/components.md +105 -0
- package/docs/runtime/core.md +55 -0
- package/docs/runtime/format-css.md +59 -0
- package/docs/runtime/format-motion.md +56 -0
- package/docs/runtime/format-svg.md +62 -0
- package/docs/runtime/scroll.md +61 -0
- package/package.json +71 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll.js","sources":["../../src/runtime/scroll.ts"],"sourcesContent":["/**\n * `motionary/runtime/scroll` (10.2) — scroll-linked scenes, an original\n * implementation: start / end rules, scrubbing (direct or smoothed), pinning,\n * debug markers, enter / leave callbacks and per-edge actions for a runtime\n * tween or timeline.\n *\n * ```ts\n * import { use, timeline } from 'motionary/runtime';\n * import { scroll, scrollScene } from 'motionary/runtime/scroll';\n * use(scroll);\n * const tl = timeline({ paused: true }).to('.card', { to: { x: 200, rotate: 8 } });\n * scrollScene({ trigger: '.section', start: 'top 80%', end: 'bottom 20%', scrub: 120, pin: true, markers: true, animation: tl });\n * ```\n *\n * Rules: `\"<trigger edge> <viewport edge>\"` where an edge is `top | center | bottom`,\n * a percentage or pixels, optionally `+=N` / `-=N` (e.g. `\"top top+=80\"`);\n * `end` may also be `\"+=600\"` (pixels after start). Horizontal scenes use\n * `left | center | right`. Nothing touches `window` until a scene is created.\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { getTicker } from './ticker';\nimport type { Playable } from './tween';\n\nexport type SceneAction = 'play' | 'pause' | 'resume' | 'reverse' | 'restart' | 'reset' | 'complete' | 'none';\n\nexport interface SceneOptions {\n /** Element (or selector) whose position defines the scene. */\n trigger: Element | string;\n /** Default 'top bottom' (trigger top meets viewport bottom). */\n start?: string;\n /** Default 'bottom top'. `'+=600'` = 600 px after start. */\n end?: string;\n /** Link the animation to the scroll position: `true` (direct) or a smoothing time in ms. */\n scrub?: boolean | number;\n /** Runtime tween / timeline (created `paused: true`). */\n animation?: Playable;\n /** Without scrub: actions on enter, leave, enter back, leave back. Default 'play none none reverse'. */\n actions?: string;\n /** Pin the trigger (or another element) while the scene is active. */\n pin?: boolean | Element | string;\n /** Show start / end markers (debugging). */\n markers?: boolean | { color?: string };\n /** Class toggled on the trigger while active. */\n toggleClass?: string;\n /** Kill after the first forward completion. */\n once?: boolean;\n horizontal?: boolean;\n /** Scroll container (default: the window). */\n scroller?: Element | string;\n onEnter?: (s: ScrollScene) => void;\n onLeave?: (s: ScrollScene) => void;\n onEnterBack?: (s: ScrollScene) => void;\n onLeaveBack?: (s: ScrollScene) => void;\n onUpdate?: (s: ScrollScene) => void;\n onToggle?: (s: ScrollScene) => void;\n}\n\nconst KEYWORDS: Record<string, number> = { top: 0, left: 0, center: 0.5, bottom: 1, right: 1 };\n\n/** One side of a rule ('top', '80%', '120px', 'center+=40') → pixels within `size`. */\nexport function parseEdge(spec: string, size: number): number {\n const m = /^([a-z]+|-?[\\d.]+%|-?[\\d.]+(?:px)?)?\\s*(?:([+-])=\\s*(-?[\\d.]+)(px|%)?)?$/.exec(spec.trim());\n if (!m) throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n let v = 0;\n const b = m[1] || '0';\n if (b in KEYWORDS) v = KEYWORDS[b] * size;\n else if (b.endsWith('%')) v = (parseFloat(b) / 100) * size;\n else if (/^-?[\\d.]/.test(b)) v = parseFloat(b);\n else throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n if (m[2]) {\n const n = m[4] === '%' ? (parseFloat(m[3]) / 100) * size : parseFloat(m[3]);\n v += m[2] === '+' ? n : -n;\n }\n return v;\n}\n\n/** Scroll offset at which `rule` is met: trigger edge (at `triggerStart`, size `triggerSize`) meets viewport edge. */\nexport function resolveRule(rule: string, triggerStart: number, triggerSize: number, viewport: number): number {\n const parts = rule.trim().split(/\\s+(?![+-]=)/);\n const t = parts[0] ?? 'top';\n const s = parts[1] ?? 'bottom';\n return triggerStart + parseEdge(t, triggerSize) - parseEdge(s, viewport);\n}\n\nconst scenes = new Set<ScrollScene>();\nconst q = (x: Element | string): Element => {\n const el = typeof x === 'string' ? document.querySelector(x) : x;\n if (!el) throw new Error(`[motionary] scroll: element \"${x}\" not found`);\n return el;\n};\n\n/** A scroll scene (see `scrollScene()`). */\nexport class ScrollScene {\n readonly trigger: Element;\n readonly options: SceneOptions;\n /** Scroll offsets (px) of the start and end. */\n start = 0;\n end = 0;\n /** 0 → 1 between start and end. */\n progress = 0;\n /** 1 scrolling forward, -1 back. */\n direction = 1;\n isActive = false;\n private shown = 0;\n private last = -1;\n private offs: (() => void)[] = [];\n private pinEl: HTMLElement | null = null;\n private spacer: HTMLElement | null = null;\n private marks: HTMLElement[] = [];\n private scroller: Element | Window;\n private killed = false;\n\n constructor(o: SceneOptions) {\n if (typeof window === 'undefined') throw new Error('[motionary] scroll scenes need a browser window');\n this.options = o;\n this.trigger = q(o.trigger);\n this.scroller = o.scroller ? q(o.scroller) : window;\n if (o.pin) this.setupPin(o.pin === true ? (this.trigger as HTMLElement) : (q(o.pin) as HTMLElement));\n const target: EventTarget = this.scroller;\n const onScroll = () => this.update();\n target.addEventListener('scroll', onScroll, { passive: true });\n window.addEventListener('resize', this.refreshBound);\n this.offs.push(() => target.removeEventListener('scroll', onScroll), () => window.removeEventListener('resize', this.refreshBound));\n if (o.scrub && typeof o.scrub === 'number') this.offs.push(getTicker().add((_, dt) => this.smooth(dt)));\n scenes.add(this);\n this.refresh();\n }\n private refreshBound = () => this.refresh();\n\n private pos(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.scrollX : window.scrollY;\n return this.options.horizontal ? s.scrollLeft : s.scrollTop;\n }\n private viewport(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.innerWidth : window.innerHeight;\n return this.options.horizontal ? s.clientWidth : s.clientHeight;\n }\n\n /** Re-measure start / end (after layout changes). */\n refresh(): void {\n if (this.killed) return;\n const h = !!this.options.horizontal;\n const ref = (this.spacer || this.trigger) as Element;\n const r = ref.getBoundingClientRect();\n const sr = this.scroller === window ? { top: 0, left: 0 } : (this.scroller as Element).getBoundingClientRect();\n const tStart = (h ? r.left - sr.left : r.top - sr.top) + this.pos();\n const tSize = (this.pinEl ? (h ? this.pinEl.offsetWidth : this.pinEl.offsetHeight) : h ? r.width : r.height) || 0;\n const vp = this.viewport();\n this.start = resolveRule(this.options.start || (h ? 'left right' : 'top bottom'), tStart, tSize, vp);\n const e = this.options.end || (h ? 'right left' : 'bottom top');\n this.end = /^\\+=/.test(e.trim()) ? this.start + parseFloat(e.trim().slice(2)) : resolveRule(e, tStart, tSize, vp);\n if (this.end <= this.start) this.end = this.start + 1;\n if (this.spacer && this.pinEl) this.spacer.style[h ? 'paddingRight' : 'paddingBottom'] = `${this.end - this.start}px`;\n this.drawMarkers(vp);\n this.last = -1;\n this.update();\n }\n\n /** Read the scroll position and fire callbacks / drive the animation. */\n update(): void {\n if (this.killed) return;\n const y = this.pos();\n const p = Math.min(1, Math.max(0, (y - this.start) / (this.end - this.start)));\n if (y !== this.last && this.last >= 0) this.direction = y > this.last ? 1 : -1;\n const prev = this.progress;\n const was = this.isActive;\n this.progress = p;\n this.isActive = y > this.start && y < this.end;\n this.last = y;\n const o = this.options;\n if (this.isActive !== was || (prev === 0 && p === 1) || (prev === 1 && p === 0)) {\n const toggles: [keyof SceneOptions, number][] = [];\n if (p > 0 && prev === 0) toggles.push(['onEnter', 0]);\n if (p === 1 && prev < 1) toggles.push(['onLeave', 1]);\n if (p < 1 && prev === 1) toggles.push(['onEnterBack', 2]);\n if (p === 0 && prev > 0) toggles.push(['onLeaveBack', 3]);\n for (const [cb, i] of toggles) {\n (o[cb] as ((s: ScrollScene) => void) | undefined)?.(this);\n if (!o.scrub) this.act(i);\n }\n if (o.toggleClass) this.trigger.classList.toggle(o.toggleClass, this.isActive);\n o.onToggle?.(this);\n if (o.once && p === 1) {\n this.applyPin(1);\n this.kill(true);\n return;\n }\n }\n this.applyPin(p);\n if (o.scrub === true && o.animation) o.animation.progress = p;\n o.onUpdate?.(this);\n }\n\n private smooth(dt: number): void {\n const a = this.options.animation;\n if (!a) return;\n const k = 1 - Math.exp(-dt / Math.max(1, this.options.scrub as number));\n this.shown += (this.progress - this.shown) * k;\n if (Math.abs(this.progress - this.shown) < 0.0005) this.shown = this.progress;\n a.progress = this.shown;\n }\n\n private act(i: number): void {\n const a = this.options.animation;\n if (!a) return;\n const act = ((this.options.actions || 'play none none reverse').split(/\\s+/)[i] || 'none') as SceneAction;\n if (act === 'play') a.play();\n else if (act === 'pause') a.pause();\n else if (act === 'resume') a.play();\n else if (act === 'reverse') a.reverse();\n else if (act === 'restart') a.restart();\n else if (act === 'reset') (a.pause(), a.seek(0));\n else if (act === 'complete') (a.pause(), (a.progress = 1));\n }\n\n private setupPin(el: HTMLElement): void {\n this.pinEl = el;\n const sp = document.createElement('div');\n sp.className = 'usa-pin-spacer';\n sp.style.boxSizing = 'content-box';\n el.parentNode?.insertBefore(sp, el);\n sp.appendChild(el);\n this.spacer = sp;\n this.offs.push(() => {\n el.style.position = el.style.top = el.style.left = el.style.width = el.style.transform = '';\n sp.parentNode?.insertBefore(el, sp);\n sp.remove();\n });\n }\n\n private applyPin(p: number): void {\n const el = this.pinEl, sp = this.spacer;\n if (!el || !sp) return;\n const h = !!this.options.horizontal;\n if (p > 0 && p < 1 && this.scroller === window) {\n const r = sp.getBoundingClientRect();\n const offset = this.start - (h ? r.left + window.scrollX : r.top + window.scrollY);\n el.style.position = 'fixed';\n el.style.width = `${r.width}px`;\n el.style.left = h ? `${-offset}px` : `${r.left}px`;\n el.style.top = h ? `${r.top}px` : `${-offset}px`;\n el.style.transform = '';\n } else {\n el.style.position = el.style.top = el.style.left = el.style.width = '';\n // inside a scroll container (or after the end) pinning is done with a transform\n const d = p >= 1 ? this.end - this.start : p > 0 ? this.pos() - this.start : 0;\n el.style.transform = d ? (h ? `translateX(${d}px)` : `translateY(${d}px)`) : '';\n }\n }\n\n private drawMarkers(vp: number): void {\n this.marks.forEach((m) => m.remove());\n this.marks = [];\n const mk = this.options.markers;\n if (!mk) return;\n const color = (typeof mk === 'object' && mk.color) || '#e11d48';\n const h = !!this.options.horizontal;\n const host = this.scroller === window ? document.body : (this.scroller as HTMLElement);\n const line = (label: string, at: number, fixed: boolean, c: string) => {\n const d = document.createElement('div');\n d.className = 'usa-scroll-marker';\n d.textContent = label;\n d.setAttribute('aria-hidden', 'true');\n Object.assign(d.style, { position: fixed ? 'fixed' : 'absolute', [h ? 'left' : 'top']: `${at}px`, [h ? 'top' : 'right']: '0', [h ? 'height' : 'width']: '80px', [h ? 'borderLeft' : 'borderTop']: `2px solid ${c}`, color: c, font: '600 11px/1.2 ui-monospace,monospace', padding: '2px 4px', zIndex: '2147483646', pointerEvents: 'none', background: 'rgba(255,255,255,.7)' });\n (fixed ? document.body : host).appendChild(d);\n this.marks.push(d);\n };\n const rule = (r: string | undefined, d: string) => (r || d).trim().split(/\\s+(?![+-]=)/)[1] ?? 'bottom';\n line(`start ${this.start | 0}`, this.start, false, color);\n line(`end ${this.end | 0}`, this.end, false, color);\n line('scroller-start', parseEdge(rule(this.options.start, 'top bottom'), vp), true, '#16a34a');\n if (!/^\\+=/.test((this.options.end || '').trim())) line('scroller-end', parseEdge(rule(this.options.end, 'bottom top'), vp), true, '#2563eb');\n }\n\n /** Remove listeners, pin spacer and markers (`keepState` keeps the animation where it is). */\n kill(keepState = false): void {\n if (this.killed) return;\n this.killed = true;\n if (!keepState) this.options.animation?.pause();\n this.offs.splice(0).forEach((f) => f());\n this.marks.forEach((m) => m.remove());\n scenes.delete(this);\n }\n}\n\n/** Create a scroll scene. */\nexport function scrollScene(o: SceneOptions): ScrollScene {\n return new ScrollScene(o);\n}\n/** Re-measure every scene (call after layout changes such as images loading). */\nexport function refreshScenes(): void {\n scenes.forEach((s) => s.refresh());\n}\n/** Kill every scene. */\nexport function killScenes(): void {\n Array.from(scenes).forEach((s) => s.kill());\n}\n/** The live scenes. */\nexport const allScenes = (): ScrollScene[] => Array.from(scenes);\n\nexport interface ScrollApi {\n scrollScene: typeof scrollScene;\n refreshScenes: typeof refreshScenes;\n killScenes: typeof killScenes;\n allScenes: typeof allScenes;\n parseEdge: typeof parseEdge;\n resolveRule: typeof resolveRule;\n ScrollScene: typeof ScrollScene;\n}\n\n/** The module object for `use(scroll)`. */\nexport const scroll: RuntimeModule<ScrollApi> = { id: 'scroll', version: RUNTIME_VERSION, requires: ['core'], api: { scrollScene, refreshScenes, killScenes, allScenes, parseEdge, resolveRule, ScrollScene } };\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAuCH,MAAM,QAAQ,GAA2B,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;AAE9F;AACM,SAAU,SAAS,CAAC,IAAY,EAAE,IAAY,EAAA;IAClD,MAAM,CAAC,GAAG,0EAA0E,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AACtG,IAAA,IAAI,CAAC,CAAC;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAA,CAAA,CAAG,CAAC;IACjE,IAAI,CAAC,GAAG,CAAC;IACT,MAAM,C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AC;IACrB;AACD;AAED;AACM,SAAU,WAAW,CAAC,CAAe,EAAA;AACzC,IAAA,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC;AAC3B;AACA;SACgB,aAAa,GAAA;AAC3B,IAAA,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;AACpC;AACA;SACgB,UAAU,GAAA;AACxB,IAAA,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAC7C;AACA;AACO,MAAM,SAAS,GAAG,MAAqB,KAAK,CAAC,IAAI,CAAC,MAAM;AAY/D;AACO,MAAM,MAAM,GAA6B,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE;;;;"}
|
package/dist/runtime.cjs
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var registry = require('./chunks/registry-eJgpFAzI.cjs');
|
|
4
|
+
var ticker = require('./chunks/ticker-D4o6enH0.cjs');
|
|
5
|
+
var tween$1 = require('./chunks/tween-CBuWYpI-.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `motionary/runtime` (10.1) — Motionary's own zero-dependency animation
|
|
9
|
+
* runtime, the one prerequisite for runtime-powered components:
|
|
10
|
+
*
|
|
11
|
+
* - shared **ticker** (`getTicker()`): one rAF loop for everything;
|
|
12
|
+
* - **tween + timeline** engine with easing (`tween()`, `timeline()`, `EASES`, `cubicBezier()`);
|
|
13
|
+
* - **module registry** (`use()`, `requireModule()`, `hasModule()`) with a
|
|
14
|
+
* clear `RuntimeModuleError` (install / import / CDN instructions) when a
|
|
15
|
+
* component needs a module that was not registered.
|
|
16
|
+
*
|
|
17
|
+
* Every other module lives at its own subpath (`motionary/runtime/format-css`,
|
|
18
|
+
* `motionary/runtime/format-motion`, …) so you only pay for what you import.
|
|
19
|
+
* SSR-safe (no `window` access at import) and usable in Web Workers.
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { use, tween } from 'motionary/runtime';
|
|
23
|
+
* use(); // registers the core (components can now find it)
|
|
24
|
+
* tween('.box', { to: { x: 120, opacity: 1 }, duration: 500, ease: 'back-out' });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
/** The core as a module object. */
|
|
28
|
+
const core = {
|
|
29
|
+
id: 'core',
|
|
30
|
+
version: registry.RUNTIME_VERSION,
|
|
31
|
+
api: { version: registry.RUNTIME_VERSION, getTicker: ticker.getTicker, tween, timeline: tween$1.timeline, Tween: tween$1.Tween, Timeline: tween$1.Timeline, EASES: tween$1.EASES, parseEase: tween$1.parseEase, cubicBezier: tween$1.cubicBezier, steps: tween$1.steps },
|
|
32
|
+
};
|
|
33
|
+
/** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */
|
|
34
|
+
function tween(target, o) {
|
|
35
|
+
return tween$1.tween(resolveTargets(target), o);
|
|
36
|
+
}
|
|
37
|
+
/** Selector strings become element lists (only where `document` exists). */
|
|
38
|
+
function resolveTargets(t) {
|
|
39
|
+
if (typeof t === 'string') {
|
|
40
|
+
if (typeof document === 'undefined')
|
|
41
|
+
throw new Error('[motionary] selector targets need a document — pass objects or elements instead');
|
|
42
|
+
return Array.from(document.querySelectorAll(t));
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Register the core plus any modules (`use(formatCss, formatMotion)`).
|
|
48
|
+
* Call once at start-up, before runtime-powered components mount.
|
|
49
|
+
*/
|
|
50
|
+
function use(...mods) {
|
|
51
|
+
return registry.register(core, ...mods);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
exports.RUNTIME_CDN = registry.RUNTIME_CDN;
|
|
55
|
+
exports.RUNTIME_VERSION = registry.RUNTIME_VERSION;
|
|
56
|
+
exports.RuntimeModuleError = registry.RuntimeModuleError;
|
|
57
|
+
exports.hasModule = registry.hasModule;
|
|
58
|
+
exports.missingMessage = registry.missingMessage;
|
|
59
|
+
exports.moduleCdn = registry.moduleCdn;
|
|
60
|
+
exports.modulePath = registry.modulePath;
|
|
61
|
+
exports.register = registry.register;
|
|
62
|
+
exports.registeredModules = registry.registeredModules;
|
|
63
|
+
exports.registry = registry.registry;
|
|
64
|
+
exports.requireModule = registry.requireModule;
|
|
65
|
+
exports.getTicker = ticker.getTicker;
|
|
66
|
+
exports.EASES = tween$1.EASES;
|
|
67
|
+
exports.Playable = tween$1.Playable;
|
|
68
|
+
exports.Timeline = tween$1.Timeline;
|
|
69
|
+
exports.Tween = tween$1.Tween;
|
|
70
|
+
exports.cubicBezier = tween$1.cubicBezier;
|
|
71
|
+
exports.parseEase = tween$1.parseEase;
|
|
72
|
+
exports.parseValue = tween$1.parseValue;
|
|
73
|
+
exports.steps = tween$1.steps;
|
|
74
|
+
exports.timeline = tween$1.timeline;
|
|
75
|
+
exports.core = core;
|
|
76
|
+
exports.resolveTargets = resolveTargets;
|
|
77
|
+
exports.tween = tween;
|
|
78
|
+
exports.use = use;
|
|
79
|
+
//# sourceMappingURL=runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.cjs","sources":["../src/runtime/index.ts"],"sourcesContent":["/**\n * `motionary/runtime` (10.1) — Motionary's own zero-dependency animation\n * runtime, the one prerequisite for runtime-powered components:\n *\n * - shared **ticker** (`getTicker()`): one rAF loop for everything;\n * - **tween + timeline** engine with easing (`tween()`, `timeline()`, `EASES`, `cubicBezier()`);\n * - **module registry** (`use()`, `requireModule()`, `hasModule()`) with a\n * clear `RuntimeModuleError` (install / import / CDN instructions) when a\n * component needs a module that was not registered.\n *\n * Every other module lives at its own subpath (`motionary/runtime/format-css`,\n * `motionary/runtime/format-motion`, …) so you only pay for what you import.\n * SSR-safe (no `window` access at import) and usable in Web Workers.\n *\n * ```ts\n * import { use, tween } from 'motionary/runtime';\n * use(); // registers the core (components can now find it)\n * tween('.box', { to: { x: 120, opacity: 1 }, duration: 500, ease: 'back-out' });\n * ```\n */\nimport { register, RUNTIME_VERSION, type RuntimeModule, type RuntimeRegistry } from './registry';\nimport { getTicker } from './ticker';\nimport { tween as rawTween, timeline, Tween, Timeline, type TweenOptions, type Playable } from './tween';\nimport { EASES, parseEase, cubicBezier, steps } from './ease';\n\nexport { registry, register, requireModule, hasModule, registeredModules, missingMessage, modulePath, moduleCdn, RuntimeModuleError, RUNTIME_VERSION, RUNTIME_CDN } from './registry';\nexport type { RuntimeModule, RuntimeRegistry } from './registry';\nexport { getTicker } from './ticker';\nexport type { Ticker, TickFn } from './ticker';\nexport { timeline, Tween, Timeline, Playable, parseValue } from './tween';\nexport type { TweenOptions, TimelineOptions, PlayOptions, Props, Target, Position } from './tween';\nexport { EASES, parseEase, cubicBezier, steps } from './ease';\nexport type { Ease } from './ease';\n\n/** The core module's API (what `requireModule('core')` returns). */\nexport interface CoreApi {\n version: string;\n getTicker: typeof getTicker;\n tween: (target: any, o: import('./tween').TweenOptions) => import('./tween').Playable;\n timeline: typeof timeline;\n Tween: typeof Tween;\n Timeline: typeof Timeline;\n EASES: typeof EASES;\n parseEase: typeof parseEase;\n cubicBezier: typeof cubicBezier;\n steps: typeof steps;\n}\n\n/** The core as a module object. */\nexport const core: RuntimeModule<CoreApi> = {\n id: 'core',\n version: RUNTIME_VERSION,\n api: { version: RUNTIME_VERSION, getTicker, tween, timeline, Tween, Timeline, EASES, parseEase, cubicBezier, steps },\n};\n\n/** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */\nexport function tween(target: any, o: TweenOptions): Playable {\n return rawTween(resolveTargets(target), o);\n}\n\n/** Selector strings become element lists (only where `document` exists). */\nexport function resolveTargets(t: any): any {\n if (typeof t === 'string') {\n if (typeof document === 'undefined') throw new Error('[motionary] selector targets need a document — pass objects or elements instead');\n return Array.from(document.querySelectorAll(t));\n }\n return t;\n}\n\n/**\n * Register the core plus any modules (`use(formatCss, formatMotion)`).\n * Call once at start-up, before runtime-powered components mount.\n */\nexport function use(...mods: RuntimeModule[]): RuntimeRegistry {\n return register(core as RuntimeModule, ...mods);\n}\n"],"names":["RUNTIME_VERSION","getTicker","timeline","Tween","Timeline","EASES","parseEase","cubicBezier","steps","rawTween","register"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AA6BH;AACO,MAAM,IAAI,GAA2B;AAC1C,IAAA,EAAE,EAAE,MAAM;AACV,IAAA,OAAO,EAAEA,wBAAe;IACxB,GAAG,EAAE,EAAE,OAAO,EAAEA,wBAAe,aAAEC,gBAAS,EAAE,KAAK,YAAEC,gBAAQ,SAAEC,aAAK,YAAEC,gBAAQ,SAAEC,aAAK,aAAEC,iBAAS,eAAEC,mBAAW,SAAEC,aAAK,EAAE;;AAGtH;AACM,SAAU,KAAK,CAAC,MAAW,EAAE,CAAe,EAAA;IAChD,OAAOC,aAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC5C;AAEA;AACM,SAAU,cAAc,CAAC,CAAM,EAAA;AACnC,IAAA,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;QACzB,IAAI,OAAO,QAAQ,KAAK,WAAW;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC;QACvI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACjD;AACA,IAAA,OAAO,CAAC;AACV;AAEA;;;AAGG;AACG,SAAU,GAAG,CAAC,GAAG,IAAqB,EAAA;AAC1C,IAAA,OAAOC,iBAAQ,CAAC,IAAqB,EAAE,GAAG,IAAI,CAAC;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/** Easing functions (t ∈ [0, 1] → progress). Original implementations of the standard Penner-style curves. */
|
|
2
|
+
type Ease = (t: number) => number;
|
|
3
|
+
/** cubic-bezier(x1, y1, x2, y2), solved with Newton steps + bisection fallback. */
|
|
4
|
+
declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): Ease;
|
|
5
|
+
/** steps(n, 'end' | 'start'). */
|
|
6
|
+
declare const steps: (n: number, pos?: "start" | "end") => Ease;
|
|
7
|
+
declare const EASES: Record<string, Ease>;
|
|
8
|
+
/** Resolve an ease: a function, a name ('cubic-out', 'ease-in-out', 'linear'), 'cubic-bezier(a,b,c,d)' or 'steps(n[, start|end])'. Unknown names throw. */
|
|
9
|
+
declare function parseEase(e?: string | Ease): Ease;
|
|
10
|
+
|
|
11
|
+
type Target = object | Element;
|
|
12
|
+
type Props = Record<string, number | string>;
|
|
13
|
+
interface PlayOptions {
|
|
14
|
+
/** Delay before the first iteration, ms. */
|
|
15
|
+
delay?: number;
|
|
16
|
+
/** Extra iterations (-1 = forever). */
|
|
17
|
+
repeat?: number;
|
|
18
|
+
/** Alternate direction on every other iteration. */
|
|
19
|
+
yoyo?: boolean;
|
|
20
|
+
/** Start paused (`play()` to start). */
|
|
21
|
+
paused?: boolean;
|
|
22
|
+
onUpdate?: (progress: number) => void;
|
|
23
|
+
onComplete?: () => void;
|
|
24
|
+
}
|
|
25
|
+
interface TweenOptions extends PlayOptions {
|
|
26
|
+
to?: Props;
|
|
27
|
+
from?: Props;
|
|
28
|
+
/** ms (default 600). */
|
|
29
|
+
duration?: number;
|
|
30
|
+
ease?: string | Ease;
|
|
31
|
+
/** Delay added per target index (ms) when several targets are given. */
|
|
32
|
+
stagger?: number;
|
|
33
|
+
}
|
|
34
|
+
interface Num {
|
|
35
|
+
kind: 'num';
|
|
36
|
+
v: number;
|
|
37
|
+
u: string;
|
|
38
|
+
}
|
|
39
|
+
interface Col {
|
|
40
|
+
kind: 'col';
|
|
41
|
+
c: number[];
|
|
42
|
+
}
|
|
43
|
+
type Val = Num | Col;
|
|
44
|
+
/** Parse '12px', '-3.5', '50%', '#0af', 'rgb(1 2 3 / .5)', 'rgba(…)'. */
|
|
45
|
+
declare function parseValue(v: number | string): Val;
|
|
46
|
+
/** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */
|
|
47
|
+
declare abstract class Playable {
|
|
48
|
+
delay: number;
|
|
49
|
+
repeat: number;
|
|
50
|
+
yoyo: boolean;
|
|
51
|
+
/** Playback rate multiplier. */
|
|
52
|
+
timeScale: number;
|
|
53
|
+
onUpdate?: (progress: number) => void;
|
|
54
|
+
onComplete?: () => void;
|
|
55
|
+
protected _t: number;
|
|
56
|
+
private _dir;
|
|
57
|
+
private _off;
|
|
58
|
+
private _done;
|
|
59
|
+
private _resolve;
|
|
60
|
+
/** Resolves on completion (forward end, or start when reversed). */
|
|
61
|
+
finished: Promise<void>;
|
|
62
|
+
/** Set when owned by a timeline (then the ticker never drives it). */
|
|
63
|
+
parent: Timeline | null;
|
|
64
|
+
constructor(o: PlayOptions);
|
|
65
|
+
/** One iteration, ms. */
|
|
66
|
+
abstract get duration(): number;
|
|
67
|
+
/** Render at `ms` into one iteration. */
|
|
68
|
+
protected abstract renderLocal(ms: number, iterationEnded: boolean): void;
|
|
69
|
+
get totalDuration(): number;
|
|
70
|
+
get time(): number;
|
|
71
|
+
get progress(): number;
|
|
72
|
+
set progress(p: number);
|
|
73
|
+
get isActive(): boolean;
|
|
74
|
+
get reversed(): boolean;
|
|
75
|
+
/** Jump to `ms` (total time, including the delay) and render. */
|
|
76
|
+
seek(ms: number): this;
|
|
77
|
+
play(): this;
|
|
78
|
+
pause(): this;
|
|
79
|
+
/** Play backwards from the current time. */
|
|
80
|
+
reverse(): this;
|
|
81
|
+
restart(): this;
|
|
82
|
+
/** Stop and detach for good. */
|
|
83
|
+
kill(): void;
|
|
84
|
+
/** Promise-like: `await tween(...)`. */
|
|
85
|
+
then<R>(ok?: (v: void) => R, err?: (e: unknown) => R): Promise<R>;
|
|
86
|
+
private attach;
|
|
87
|
+
private advance;
|
|
88
|
+
protected complete(): void;
|
|
89
|
+
}
|
|
90
|
+
/** A tween of one target. */
|
|
91
|
+
declare class Tween extends Playable {
|
|
92
|
+
readonly target: Target;
|
|
93
|
+
private _dur;
|
|
94
|
+
private ease;
|
|
95
|
+
private tracks;
|
|
96
|
+
private toProps;
|
|
97
|
+
private fromProps;
|
|
98
|
+
constructor(target: Target, o: TweenOptions);
|
|
99
|
+
get duration(): number;
|
|
100
|
+
/** Capture start values (first render). */
|
|
101
|
+
private init;
|
|
102
|
+
protected renderLocal(ms: number, ended: boolean): void;
|
|
103
|
+
}
|
|
104
|
+
/** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */
|
|
105
|
+
type Position = number | string;
|
|
106
|
+
interface TimelineOptions extends PlayOptions {
|
|
107
|
+
/** Defaults merged into every `.to()`. */
|
|
108
|
+
defaults?: Omit<TweenOptions, 'to' | 'from'>;
|
|
109
|
+
}
|
|
110
|
+
/** A sequence of tweens, nested timelines and callbacks. */
|
|
111
|
+
declare class Timeline extends Playable {
|
|
112
|
+
private children;
|
|
113
|
+
private labels;
|
|
114
|
+
private prevStart;
|
|
115
|
+
private prevEnd;
|
|
116
|
+
private defaults;
|
|
117
|
+
private lastLocal;
|
|
118
|
+
constructor(o?: TimelineOptions);
|
|
119
|
+
get duration(): number;
|
|
120
|
+
private resolve;
|
|
121
|
+
/** Add a tween, timeline or callback at a position. */
|
|
122
|
+
add(item: Playable | (() => void), position?: Position): this;
|
|
123
|
+
/** `tween(target, vars)` placed at `position` (stagger across several targets). */
|
|
124
|
+
to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this;
|
|
125
|
+
call(fn: () => void, position?: Position): this;
|
|
126
|
+
label(name: string, position?: Position): this;
|
|
127
|
+
/** Time of a label, ms. */
|
|
128
|
+
labelTime(name: string): number | undefined;
|
|
129
|
+
remove(item: Playable): void;
|
|
130
|
+
/** Children in start order (callbacks excluded). */
|
|
131
|
+
getChildren(): Playable[];
|
|
132
|
+
protected renderLocal(ms: number): void;
|
|
133
|
+
}
|
|
134
|
+
/** A new timeline (plays on the next frame unless `paused`). */
|
|
135
|
+
declare function timeline(o?: TimelineOptions): Timeline;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Module registry shared by every copy of `motionary/runtime` on the page
|
|
139
|
+
* (ESM, CJS and the CDN IIFE builds all read the same `globalThis` slot),
|
|
140
|
+
* so a component never needs to import the runtime itself — it asks for a
|
|
141
|
+
* module with `requireModule()` and gets a clear error when it is missing.
|
|
142
|
+
* Nothing here touches `window` / `document`: safe to import during SSR and
|
|
143
|
+
* inside Web Workers.
|
|
144
|
+
*/
|
|
145
|
+
/** Runtime version (kept in sync with the package version by the release script). */
|
|
146
|
+
declare const RUNTIME_VERSION = "10.2.0";
|
|
147
|
+
/** Where the CDN builds live (major-pinned). */
|
|
148
|
+
declare const RUNTIME_CDN = "https://cdn.jsdelivr.net/npm/motionary@10/dist/";
|
|
149
|
+
/** A runtime module: `{ id, version, api }`, registered with `use()`. */
|
|
150
|
+
interface RuntimeModule<A = unknown> {
|
|
151
|
+
/** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */
|
|
152
|
+
id: string;
|
|
153
|
+
version: string;
|
|
154
|
+
/** Other modules this one needs (registered first by `use()` callers). */
|
|
155
|
+
requires?: string[];
|
|
156
|
+
/** The module's public API (what `requireModule(id)` returns). */
|
|
157
|
+
api: A;
|
|
158
|
+
/** Optional one-time setup, called on first registration. */
|
|
159
|
+
setup?(registry: RuntimeRegistry): void;
|
|
160
|
+
}
|
|
161
|
+
interface RuntimeRegistry {
|
|
162
|
+
version: string;
|
|
163
|
+
modules: Map<string, RuntimeModule>;
|
|
164
|
+
/** Shared per-page state slots (the ticker lives here). */
|
|
165
|
+
slots: Record<string, unknown>;
|
|
166
|
+
}
|
|
167
|
+
/** The page-wide registry (created on first use). */
|
|
168
|
+
declare function registry(): RuntimeRegistry;
|
|
169
|
+
/** The import path of a module id. */
|
|
170
|
+
declare const modulePath: (id: string) => string;
|
|
171
|
+
/** The CDN IIFE file of a module id. */
|
|
172
|
+
declare const moduleCdn: (id: string) => string;
|
|
173
|
+
/** The text of the "module missing" error (shared with the components). */
|
|
174
|
+
declare function missingMessage(id: string, who?: string): string;
|
|
175
|
+
/** Thrown by `requireModule()` when a module is not registered. */
|
|
176
|
+
declare class RuntimeModuleError extends Error {
|
|
177
|
+
readonly module: string;
|
|
178
|
+
constructor(id: string, who?: string);
|
|
179
|
+
}
|
|
180
|
+
/** Register modules (each once; re-registering the same id keeps the first). Returns the registry. */
|
|
181
|
+
declare function register(...mods: RuntimeModule[]): RuntimeRegistry;
|
|
182
|
+
/** Is a module registered? */
|
|
183
|
+
declare const hasModule: (id: string) => boolean;
|
|
184
|
+
/** The API of a registered module, or a `RuntimeModuleError` with install / import / CDN instructions. */
|
|
185
|
+
declare function requireModule<A = unknown>(id: string, who?: string): A;
|
|
186
|
+
/** Ids of the registered modules. */
|
|
187
|
+
declare const registeredModules: () => string[];
|
|
188
|
+
|
|
189
|
+
type TickFn = (time: number, delta: number) => void;
|
|
190
|
+
interface Ticker {
|
|
191
|
+
/** Add a listener; returns a remover. */
|
|
192
|
+
add(fn: TickFn): () => void;
|
|
193
|
+
remove(fn: TickFn): void;
|
|
194
|
+
/** ms since the ticker started (frozen while sleeping). */
|
|
195
|
+
readonly time: number;
|
|
196
|
+
/** Smoothed frames per second. */
|
|
197
|
+
readonly fps: number;
|
|
198
|
+
/** Listener count (0 = asleep). */
|
|
199
|
+
readonly size: number;
|
|
200
|
+
/** Cap a single frame's delta (default 100 ms) so a background tab does not jump animations. */
|
|
201
|
+
lagSmoothing(maxDelta: number): void;
|
|
202
|
+
/** Global time scale (1 = normal, 0.5 = half speed, 0 = frozen). */
|
|
203
|
+
timeScale: number;
|
|
204
|
+
/** Advance by `ms` synchronously (tests, offline rendering, worker loops). */
|
|
205
|
+
step(ms: number): void;
|
|
206
|
+
}
|
|
207
|
+
/** The page-wide ticker (shared across every copy of the runtime). */
|
|
208
|
+
declare function getTicker(): Ticker;
|
|
209
|
+
|
|
210
|
+
/** The core module's API (what `requireModule('core')` returns). */
|
|
211
|
+
interface CoreApi {
|
|
212
|
+
version: string;
|
|
213
|
+
getTicker: typeof getTicker;
|
|
214
|
+
tween: (target: any, o: TweenOptions) => Playable;
|
|
215
|
+
timeline: typeof timeline;
|
|
216
|
+
Tween: typeof Tween;
|
|
217
|
+
Timeline: typeof Timeline;
|
|
218
|
+
EASES: typeof EASES;
|
|
219
|
+
parseEase: typeof parseEase;
|
|
220
|
+
cubicBezier: typeof cubicBezier;
|
|
221
|
+
steps: typeof steps;
|
|
222
|
+
}
|
|
223
|
+
/** The core as a module object. */
|
|
224
|
+
declare const core: RuntimeModule<CoreApi>;
|
|
225
|
+
/** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */
|
|
226
|
+
declare function tween(target: any, o: TweenOptions): Playable;
|
|
227
|
+
/** Selector strings become element lists (only where `document` exists). */
|
|
228
|
+
declare function resolveTargets(t: any): any;
|
|
229
|
+
/**
|
|
230
|
+
* Register the core plus any modules (`use(formatCss, formatMotion)`).
|
|
231
|
+
* Call once at start-up, before runtime-powered components mount.
|
|
232
|
+
*/
|
|
233
|
+
declare function use(...mods: RuntimeModule[]): RuntimeRegistry;
|
|
234
|
+
|
|
235
|
+
export { EASES, Playable, RUNTIME_CDN, RUNTIME_VERSION, RuntimeModuleError, Timeline, Tween, core, cubicBezier, getTicker, hasModule, missingMessage, moduleCdn, modulePath, parseEase, parseValue, register, registeredModules, registry, requireModule, resolveTargets, steps, timeline, tween, use };
|
|
236
|
+
export type { CoreApi, Ease, PlayOptions, Position, Props, RuntimeModule, RuntimeRegistry, Target, TickFn, Ticker, TimelineOptions, TweenOptions };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/** Easing functions (t ∈ [0, 1] → progress). Original implementations of the standard Penner-style curves. */
|
|
2
|
+
type Ease = (t: number) => number;
|
|
3
|
+
/** cubic-bezier(x1, y1, x2, y2), solved with Newton steps + bisection fallback. */
|
|
4
|
+
declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): Ease;
|
|
5
|
+
/** steps(n, 'end' | 'start'). */
|
|
6
|
+
declare const steps: (n: number, pos?: "start" | "end") => Ease;
|
|
7
|
+
declare const EASES: Record<string, Ease>;
|
|
8
|
+
/** Resolve an ease: a function, a name ('cubic-out', 'ease-in-out', 'linear'), 'cubic-bezier(a,b,c,d)' or 'steps(n[, start|end])'. Unknown names throw. */
|
|
9
|
+
declare function parseEase(e?: string | Ease): Ease;
|
|
10
|
+
|
|
11
|
+
type Target = object | Element;
|
|
12
|
+
type Props = Record<string, number | string>;
|
|
13
|
+
interface PlayOptions {
|
|
14
|
+
/** Delay before the first iteration, ms. */
|
|
15
|
+
delay?: number;
|
|
16
|
+
/** Extra iterations (-1 = forever). */
|
|
17
|
+
repeat?: number;
|
|
18
|
+
/** Alternate direction on every other iteration. */
|
|
19
|
+
yoyo?: boolean;
|
|
20
|
+
/** Start paused (`play()` to start). */
|
|
21
|
+
paused?: boolean;
|
|
22
|
+
onUpdate?: (progress: number) => void;
|
|
23
|
+
onComplete?: () => void;
|
|
24
|
+
}
|
|
25
|
+
interface TweenOptions extends PlayOptions {
|
|
26
|
+
to?: Props;
|
|
27
|
+
from?: Props;
|
|
28
|
+
/** ms (default 600). */
|
|
29
|
+
duration?: number;
|
|
30
|
+
ease?: string | Ease;
|
|
31
|
+
/** Delay added per target index (ms) when several targets are given. */
|
|
32
|
+
stagger?: number;
|
|
33
|
+
}
|
|
34
|
+
interface Num {
|
|
35
|
+
kind: 'num';
|
|
36
|
+
v: number;
|
|
37
|
+
u: string;
|
|
38
|
+
}
|
|
39
|
+
interface Col {
|
|
40
|
+
kind: 'col';
|
|
41
|
+
c: number[];
|
|
42
|
+
}
|
|
43
|
+
type Val = Num | Col;
|
|
44
|
+
/** Parse '12px', '-3.5', '50%', '#0af', 'rgb(1 2 3 / .5)', 'rgba(…)'. */
|
|
45
|
+
declare function parseValue(v: number | string): Val;
|
|
46
|
+
/** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */
|
|
47
|
+
declare abstract class Playable {
|
|
48
|
+
delay: number;
|
|
49
|
+
repeat: number;
|
|
50
|
+
yoyo: boolean;
|
|
51
|
+
/** Playback rate multiplier. */
|
|
52
|
+
timeScale: number;
|
|
53
|
+
onUpdate?: (progress: number) => void;
|
|
54
|
+
onComplete?: () => void;
|
|
55
|
+
protected _t: number;
|
|
56
|
+
private _dir;
|
|
57
|
+
private _off;
|
|
58
|
+
private _done;
|
|
59
|
+
private _resolve;
|
|
60
|
+
/** Resolves on completion (forward end, or start when reversed). */
|
|
61
|
+
finished: Promise<void>;
|
|
62
|
+
/** Set when owned by a timeline (then the ticker never drives it). */
|
|
63
|
+
parent: Timeline | null;
|
|
64
|
+
constructor(o: PlayOptions);
|
|
65
|
+
/** One iteration, ms. */
|
|
66
|
+
abstract get duration(): number;
|
|
67
|
+
/** Render at `ms` into one iteration. */
|
|
68
|
+
protected abstract renderLocal(ms: number, iterationEnded: boolean): void;
|
|
69
|
+
get totalDuration(): number;
|
|
70
|
+
get time(): number;
|
|
71
|
+
get progress(): number;
|
|
72
|
+
set progress(p: number);
|
|
73
|
+
get isActive(): boolean;
|
|
74
|
+
get reversed(): boolean;
|
|
75
|
+
/** Jump to `ms` (total time, including the delay) and render. */
|
|
76
|
+
seek(ms: number): this;
|
|
77
|
+
play(): this;
|
|
78
|
+
pause(): this;
|
|
79
|
+
/** Play backwards from the current time. */
|
|
80
|
+
reverse(): this;
|
|
81
|
+
restart(): this;
|
|
82
|
+
/** Stop and detach for good. */
|
|
83
|
+
kill(): void;
|
|
84
|
+
/** Promise-like: `await tween(...)`. */
|
|
85
|
+
then<R>(ok?: (v: void) => R, err?: (e: unknown) => R): Promise<R>;
|
|
86
|
+
private attach;
|
|
87
|
+
private advance;
|
|
88
|
+
protected complete(): void;
|
|
89
|
+
}
|
|
90
|
+
/** A tween of one target. */
|
|
91
|
+
declare class Tween extends Playable {
|
|
92
|
+
readonly target: Target;
|
|
93
|
+
private _dur;
|
|
94
|
+
private ease;
|
|
95
|
+
private tracks;
|
|
96
|
+
private toProps;
|
|
97
|
+
private fromProps;
|
|
98
|
+
constructor(target: Target, o: TweenOptions);
|
|
99
|
+
get duration(): number;
|
|
100
|
+
/** Capture start values (first render). */
|
|
101
|
+
private init;
|
|
102
|
+
protected renderLocal(ms: number, ended: boolean): void;
|
|
103
|
+
}
|
|
104
|
+
/** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */
|
|
105
|
+
type Position = number | string;
|
|
106
|
+
interface TimelineOptions extends PlayOptions {
|
|
107
|
+
/** Defaults merged into every `.to()`. */
|
|
108
|
+
defaults?: Omit<TweenOptions, 'to' | 'from'>;
|
|
109
|
+
}
|
|
110
|
+
/** A sequence of tweens, nested timelines and callbacks. */
|
|
111
|
+
declare class Timeline extends Playable {
|
|
112
|
+
private children;
|
|
113
|
+
private labels;
|
|
114
|
+
private prevStart;
|
|
115
|
+
private prevEnd;
|
|
116
|
+
private defaults;
|
|
117
|
+
private lastLocal;
|
|
118
|
+
constructor(o?: TimelineOptions);
|
|
119
|
+
get duration(): number;
|
|
120
|
+
private resolve;
|
|
121
|
+
/** Add a tween, timeline or callback at a position. */
|
|
122
|
+
add(item: Playable | (() => void), position?: Position): this;
|
|
123
|
+
/** `tween(target, vars)` placed at `position` (stagger across several targets). */
|
|
124
|
+
to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this;
|
|
125
|
+
call(fn: () => void, position?: Position): this;
|
|
126
|
+
label(name: string, position?: Position): this;
|
|
127
|
+
/** Time of a label, ms. */
|
|
128
|
+
labelTime(name: string): number | undefined;
|
|
129
|
+
remove(item: Playable): void;
|
|
130
|
+
/** Children in start order (callbacks excluded). */
|
|
131
|
+
getChildren(): Playable[];
|
|
132
|
+
protected renderLocal(ms: number): void;
|
|
133
|
+
}
|
|
134
|
+
/** A new timeline (plays on the next frame unless `paused`). */
|
|
135
|
+
declare function timeline(o?: TimelineOptions): Timeline;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Module registry shared by every copy of `motionary/runtime` on the page
|
|
139
|
+
* (ESM, CJS and the CDN IIFE builds all read the same `globalThis` slot),
|
|
140
|
+
* so a component never needs to import the runtime itself — it asks for a
|
|
141
|
+
* module with `requireModule()` and gets a clear error when it is missing.
|
|
142
|
+
* Nothing here touches `window` / `document`: safe to import during SSR and
|
|
143
|
+
* inside Web Workers.
|
|
144
|
+
*/
|
|
145
|
+
/** Runtime version (kept in sync with the package version by the release script). */
|
|
146
|
+
declare const RUNTIME_VERSION = "10.2.0";
|
|
147
|
+
/** Where the CDN builds live (major-pinned). */
|
|
148
|
+
declare const RUNTIME_CDN = "https://cdn.jsdelivr.net/npm/motionary@10/dist/";
|
|
149
|
+
/** A runtime module: `{ id, version, api }`, registered with `use()`. */
|
|
150
|
+
interface RuntimeModule<A = unknown> {
|
|
151
|
+
/** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */
|
|
152
|
+
id: string;
|
|
153
|
+
version: string;
|
|
154
|
+
/** Other modules this one needs (registered first by `use()` callers). */
|
|
155
|
+
requires?: string[];
|
|
156
|
+
/** The module's public API (what `requireModule(id)` returns). */
|
|
157
|
+
api: A;
|
|
158
|
+
/** Optional one-time setup, called on first registration. */
|
|
159
|
+
setup?(registry: RuntimeRegistry): void;
|
|
160
|
+
}
|
|
161
|
+
interface RuntimeRegistry {
|
|
162
|
+
version: string;
|
|
163
|
+
modules: Map<string, RuntimeModule>;
|
|
164
|
+
/** Shared per-page state slots (the ticker lives here). */
|
|
165
|
+
slots: Record<string, unknown>;
|
|
166
|
+
}
|
|
167
|
+
/** The page-wide registry (created on first use). */
|
|
168
|
+
declare function registry(): RuntimeRegistry;
|
|
169
|
+
/** The import path of a module id. */
|
|
170
|
+
declare const modulePath: (id: string) => string;
|
|
171
|
+
/** The CDN IIFE file of a module id. */
|
|
172
|
+
declare const moduleCdn: (id: string) => string;
|
|
173
|
+
/** The text of the "module missing" error (shared with the components). */
|
|
174
|
+
declare function missingMessage(id: string, who?: string): string;
|
|
175
|
+
/** Thrown by `requireModule()` when a module is not registered. */
|
|
176
|
+
declare class RuntimeModuleError extends Error {
|
|
177
|
+
readonly module: string;
|
|
178
|
+
constructor(id: string, who?: string);
|
|
179
|
+
}
|
|
180
|
+
/** Register modules (each once; re-registering the same id keeps the first). Returns the registry. */
|
|
181
|
+
declare function register(...mods: RuntimeModule[]): RuntimeRegistry;
|
|
182
|
+
/** Is a module registered? */
|
|
183
|
+
declare const hasModule: (id: string) => boolean;
|
|
184
|
+
/** The API of a registered module, or a `RuntimeModuleError` with install / import / CDN instructions. */
|
|
185
|
+
declare function requireModule<A = unknown>(id: string, who?: string): A;
|
|
186
|
+
/** Ids of the registered modules. */
|
|
187
|
+
declare const registeredModules: () => string[];
|
|
188
|
+
|
|
189
|
+
type TickFn = (time: number, delta: number) => void;
|
|
190
|
+
interface Ticker {
|
|
191
|
+
/** Add a listener; returns a remover. */
|
|
192
|
+
add(fn: TickFn): () => void;
|
|
193
|
+
remove(fn: TickFn): void;
|
|
194
|
+
/** ms since the ticker started (frozen while sleeping). */
|
|
195
|
+
readonly time: number;
|
|
196
|
+
/** Smoothed frames per second. */
|
|
197
|
+
readonly fps: number;
|
|
198
|
+
/** Listener count (0 = asleep). */
|
|
199
|
+
readonly size: number;
|
|
200
|
+
/** Cap a single frame's delta (default 100 ms) so a background tab does not jump animations. */
|
|
201
|
+
lagSmoothing(maxDelta: number): void;
|
|
202
|
+
/** Global time scale (1 = normal, 0.5 = half speed, 0 = frozen). */
|
|
203
|
+
timeScale: number;
|
|
204
|
+
/** Advance by `ms` synchronously (tests, offline rendering, worker loops). */
|
|
205
|
+
step(ms: number): void;
|
|
206
|
+
}
|
|
207
|
+
/** The page-wide ticker (shared across every copy of the runtime). */
|
|
208
|
+
declare function getTicker(): Ticker;
|
|
209
|
+
|
|
210
|
+
/** The core module's API (what `requireModule('core')` returns). */
|
|
211
|
+
interface CoreApi {
|
|
212
|
+
version: string;
|
|
213
|
+
getTicker: typeof getTicker;
|
|
214
|
+
tween: (target: any, o: TweenOptions) => Playable;
|
|
215
|
+
timeline: typeof timeline;
|
|
216
|
+
Tween: typeof Tween;
|
|
217
|
+
Timeline: typeof Timeline;
|
|
218
|
+
EASES: typeof EASES;
|
|
219
|
+
parseEase: typeof parseEase;
|
|
220
|
+
cubicBezier: typeof cubicBezier;
|
|
221
|
+
steps: typeof steps;
|
|
222
|
+
}
|
|
223
|
+
/** The core as a module object. */
|
|
224
|
+
declare const core: RuntimeModule<CoreApi>;
|
|
225
|
+
/** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */
|
|
226
|
+
declare function tween(target: any, o: TweenOptions): Playable;
|
|
227
|
+
/** Selector strings become element lists (only where `document` exists). */
|
|
228
|
+
declare function resolveTargets(t: any): any;
|
|
229
|
+
/**
|
|
230
|
+
* Register the core plus any modules (`use(formatCss, formatMotion)`).
|
|
231
|
+
* Call once at start-up, before runtime-powered components mount.
|
|
232
|
+
*/
|
|
233
|
+
declare function use(...mods: RuntimeModule[]): RuntimeRegistry;
|
|
234
|
+
|
|
235
|
+
export { EASES, Playable, RUNTIME_CDN, RUNTIME_VERSION, RuntimeModuleError, Timeline, Tween, core, cubicBezier, getTicker, hasModule, missingMessage, moduleCdn, modulePath, parseEase, parseValue, register, registeredModules, registry, requireModule, resolveTargets, steps, timeline, tween, use };
|
|
236
|
+
export type { CoreApi, Ease, PlayOptions, Position, Props, RuntimeModule, RuntimeRegistry, Target, TickFn, Ticker, TimelineOptions, TweenOptions };
|