prop-for-that 0.7.8 → 0.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +25 -2
  3. package/dist/auto.cjs +1 -1
  4. package/dist/auto.js +1 -1
  5. package/dist/{chunk-HKCTBVQT.js → chunk-2NMXY7T4.js} +1 -1
  6. package/dist/{chunk-MDKLN42L.js → chunk-2SIGTGQE.js} +1 -1
  7. package/dist/{chunk-37L73RJL.cjs → chunk-4C255WE6.cjs} +1 -1
  8. package/dist/chunk-4R63TNNO.cjs +1 -0
  9. package/dist/chunk-5PU4B3GP.cjs +1 -0
  10. package/dist/chunk-6234NJTF.js +1 -0
  11. package/dist/{chunk-3W7CXUWN.cjs → chunk-675RBWFU.cjs} +1 -1
  12. package/dist/{chunk-KAK6WZS7.js → chunk-6M2UIJI5.js} +1 -1
  13. package/dist/chunk-7KEBMJ3O.js +1 -0
  14. package/dist/{chunk-HTKGZP36.cjs → chunk-7LN34C3P.cjs} +1 -1
  15. package/dist/chunk-BF7D5A5Z.cjs +1 -0
  16. package/dist/chunk-DFWBYWE3.cjs +1 -0
  17. package/dist/chunk-DRXR56P5.cjs +1 -0
  18. package/dist/chunk-HFE2X32G.js +1 -0
  19. package/dist/{chunk-SKEEFKDT.js → chunk-HTO57OQP.js} +1 -1
  20. package/dist/chunk-IFIWYBMP.js +1 -0
  21. package/dist/chunk-JI7NXES2.cjs +1 -0
  22. package/dist/{chunk-BS2XX4G3.js → chunk-KDIZYBPJ.js} +1 -1
  23. package/dist/{chunk-G2BOTBBH.cjs → chunk-KHBJUHJ6.cjs} +1 -1
  24. package/dist/chunk-N3F2LRDI.js +1 -0
  25. package/dist/{chunk-TRMZLMNW.js → chunk-N745RQIX.js} +1 -1
  26. package/dist/{chunk-SV76E7NI.js → chunk-PS7KTHW4.js} +1 -1
  27. package/dist/{chunk-LP3QQ33O.cjs → chunk-RVZWUZQ2.cjs} +1 -1
  28. package/dist/chunk-SRKAOAXW.cjs +1 -0
  29. package/dist/{chunk-2E2JQAHI.js → chunk-TL5BJFFL.js} +1 -1
  30. package/dist/{chunk-SYKMPPTY.cjs → chunk-XMJ6YRQB.cjs} +1 -1
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.d.cts +28 -4
  33. package/dist/index.d.ts +28 -4
  34. package/dist/index.global.js +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/motion-6SENJS5V.cjs +1 -0
  37. package/dist/motion-QDEZZYDF.js +1 -0
  38. package/dist/online-HHJAVPBU.cjs +1 -0
  39. package/dist/online-OWTXHDGG.js +1 -0
  40. package/dist/orientation-LBAL4AXW.js +1 -0
  41. package/dist/orientation-PE3B4RPH.cjs +1 -0
  42. package/dist/page-focused-UK3VPLIG.js +1 -0
  43. package/dist/page-focused-Y74VK25Y.cjs +1 -0
  44. package/dist/page-visible-3YREALOP.cjs +1 -0
  45. package/dist/page-visible-GSBWF44E.js +1 -0
  46. package/dist/plugins.cjs +1 -1
  47. package/dist/plugins.d.cts +34 -2
  48. package/dist/plugins.d.ts +34 -2
  49. package/dist/plugins.js +1 -1
  50. package/dist/pointer-P2B4YDKM.cjs +1 -0
  51. package/dist/pointer-RJIXVFBH.js +1 -0
  52. package/dist/pointer-local-L4EQM2UF.js +1 -0
  53. package/dist/pointer-local-QZJODLIH.cjs +1 -0
  54. package/dist/random-LUAMZ2M7.cjs +1 -0
  55. package/dist/random-O4GDPYJ3.js +1 -0
  56. package/dist/scroll-velocity-X3F22E47.cjs +1 -0
  57. package/dist/scroll-velocity-Y43V5NH2.js +1 -0
  58. package/dist/truncated-23UAUK2L.cjs +1 -0
  59. package/dist/truncated-R3OIXDTH.js +1 -0
  60. package/dist/{types-CudiAlDE.d.cts → types-CyGIcLOq.d.cts} +8 -0
  61. package/dist/{types-CudiAlDE.d.ts → types-CyGIcLOq.d.ts} +8 -0
  62. package/llms.txt +28 -5
  63. package/package.json +1 -1
  64. package/dist/chunk-3MK6Q7DX.cjs +0 -1
  65. package/dist/chunk-D24E2DBW.js +0 -1
  66. package/dist/chunk-EEMKKLRF.js +0 -1
  67. package/dist/chunk-OVCZMPYV.cjs +0 -1
  68. package/dist/chunk-OVF4XN2H.cjs +0 -1
  69. package/dist/chunk-PQVNJZUW.cjs +0 -1
  70. package/dist/chunk-QHHF5SEL.cjs +0 -1
  71. package/dist/chunk-SFO6H2DN.js +0 -1
  72. package/dist/chunk-V4OTPLOQ.js +0 -1
  73. package/dist/chunk-WIPJMLJJ.cjs +0 -1
  74. package/dist/motion-GHDWROM2.js +0 -1
  75. package/dist/motion-GMUGWJN3.cjs +0 -1
  76. package/dist/online-KTMCBCXT.cjs +0 -1
  77. package/dist/online-MGYZDLCQ.js +0 -1
  78. package/dist/orientation-27ULVQVJ.js +0 -1
  79. package/dist/orientation-JD23MYZR.cjs +0 -1
  80. package/dist/page-focused-3WLSZDV4.cjs +0 -1
  81. package/dist/page-focused-LBKD6QXG.js +0 -1
  82. package/dist/page-visible-27YKTHKU.js +0 -1
  83. package/dist/page-visible-6PMX575B.cjs +0 -1
  84. package/dist/pointer-3O7MGTQD.js +0 -1
  85. package/dist/pointer-DJSMZGSV.cjs +0 -1
  86. package/dist/pointer-local-6JKSOJZV.cjs +0 -1
  87. package/dist/pointer-local-X5TVNEEJ.js +0 -1
  88. package/dist/scroll-velocity-DGZNNO73.cjs +0 -1
  89. package/dist/scroll-velocity-ZRXPNZG7.js +0 -1
  90. package/dist/truncated-MDPFWGSI.js +0 -1
  91. package/dist/truncated-RUY3JNAX.cjs +0 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,72 @@ backwards-compatible change (semver's `1.0.0`+ rules kick in at v1).
8
8
  Only the published library (`dist/`) is versioned here; the demo and docs site
9
9
  are repo-only and not part of the npm package.
10
10
 
11
+ ## [0.7.11]
12
+
13
+ ### Added
14
+ - **Hoist an element's properties to an ancestor** — `propsFor(el, keys, { to })`
15
+ and the markup twin `data-props-to="<selector>"`. The binding still *observes*
16
+ the bound element; only its writes move. This is the general answer to the
17
+ library's oldest constraint: custom properties inherit **downward only** and
18
+ `@container style()` matches an **ancestor**, so an element could never share
19
+ its own values with a sibling, nor style-query them itself. An `<img>` can now
20
+ hoist `--live-loaded` onto its `<figure>`, where a skeleton overlay, the
21
+ `<figcaption>`, and the image itself can all react to it.
22
+
23
+ It's a binding-layer feature — sources need no changes, they just call
24
+ `ctx.write` — so it works for **every** element source, including the ones the
25
+ existing container-binding trick (`range`, `field`, `img`, `img-color`…) can't
26
+ help: `size`, `visibility`, `pointer-local`, `truncated`. `to` takes a selector
27
+ (resolved once at bind time via `el.closest()`) or an element. No match warns
28
+ and falls back to writing on the element itself; `to` on a `global` source
29
+ warns and is ignored. Two elements hoisting the same key onto one ancestor
30
+ overwrite each other, so that warns too — keep it to one binding per key per
31
+ target. Under `auto`, changing `data-props-to` rebinds every key on that
32
+ element against the new target.
33
+
34
+ ## [0.7.10]
35
+
36
+ ### Added
37
+ - **`random` plugin** (element, opt-in) — the per-element variation CSS can't
38
+ compute for itself yet: three independent rolls, `--const-random`,
39
+ `--const-random-2` and `--const-random-3`, each a float in `[0, 1)`, written
40
+ **once** on the `const` cadence. One rule then varies every element it's bound to
41
+ (size from the first, tint from the second, `animation-delay` phase from the
42
+ third) with no `:nth-child()` ladder; angles, ranges, buckets and coin flips are
43
+ all derivable from these in `calc()`, so they aren't shipped. It sets
44
+ `gate: false`: a gated element source's `start` re-runs on every viewport
45
+ re-entry, which for a generator would hand an element a fresh value each time it
46
+ scrolled back into view, mid-animation.
47
+ - **`configure({ randomSeed })`** — deterministic mode for `random`. Each element's
48
+ rolls derive from the seed plus the element's position in the DOM rather than from
49
+ a shared sequence, so the same markup renders the same "random" layout on every
50
+ load (SSR, screenshot diffing, print), a rebind hands an element the values it had
51
+ before, and bind order is irrelevant — reordering the tree is what reshuffles.
52
+ Unset (the default) keeps rolling from `Math.random()`. The seed is read when a
53
+ source starts, so it can differ between two `propsFor()` calls.
54
+ - **`data-props-seed` on the root `<html>`** — the markup mirror of
55
+ `configure({ randomSeed })` for the `auto` entry, read once on load before any
56
+ source attaches (`<html data-props-seed="42">`). `0` is a valid seed; a
57
+ non-numeric value is ignored with a warning rather than seeding `NaN`.
58
+
59
+ ## [0.7.9]
60
+
61
+ ### Performance
62
+ - **Redundant writes short-circuit at the source boundary.** `ctx.write` now
63
+ memoizes the last raw value (and the prefixed property name) per binding, so
64
+ a write whose value hasn't changed — the steady state for most sources, e.g.
65
+ `pointer-y` during horizontal movement or `scroll-direction` mid-scroll —
66
+ exits after one Map lookup instead of paying the prefix concat,
67
+ `String()` coercion, and Writer queue lookups every time (~5.6× faster on
68
+ that path). Property names are now built once per binding, which also means
69
+ prefix changes via `configure()` no longer affect already-attached bindings —
70
+ consistent with `configure`'s documented "call before attaching" contract.
71
+ - **Allocation-free event/observer dispatch.** The shared `window`/`document`
72
+ listeners and the page-wide Resize/IntersectionObserver callbacks no longer
73
+ copy their handler set on every dispatch (previously one array allocation
74
+ per event — including every `pointermove` — and per observer entry). Set
75
+ iteration already tolerates handlers unsubscribing mid-dispatch.
76
+
11
77
  ## [0.7.8]
12
78
 
13
79
  ### Added
package/README.md CHANGED
@@ -40,6 +40,29 @@ input {
40
40
 
41
41
  Bind any element with `data-props-for="key …"` and read its `--live-*` properties in CSS. That's the whole idea.
42
42
 
43
+ ### Hoisting & style queries
44
+
45
+ Custom properties inherit **downward only**, and `@container style()` matches against an **ancestor** — so an element can't style-query the values written on itself, and its siblings never see them. Add `data-props-to="<selector>"` (or `{ to }` imperatively) to observe the element but write its properties on the nearest matching ancestor:
46
+
47
+ ```html
48
+ <figure>
49
+ <img data-props-for="img" data-props-to="figure" src="art.jpg" />
50
+ <figcaption>…</figcaption>
51
+ </figure>
52
+ ```
53
+
54
+ ```css
55
+ /* the skeleton is a sibling of the <img> — it can only react because the
56
+ property lives on the <figure> */
57
+ @container style(--live-loaded: 0) {
58
+ .skeleton { opacity: 1; }
59
+ }
60
+ ```
61
+
62
+ ```js
63
+ propsFor(img, ['img', 'size'], { to: 'figure' }) // selector, or an element
64
+ ```
65
+
43
66
  ## Why
44
67
 
45
68
  - **CSS does the work.** No per-element event handlers or render loops — bind once, compose in stylesheets.
@@ -52,7 +75,7 @@ Bind any element with `data-props-for="key …"` and read its `--live-*` propert
52
75
 
53
76
  **Core** (built in): viewport, element size, visibility, and `<input type="range">` values.
54
77
 
55
- **Plugins** (opt-in): pointer position, battery, network, online status, page focus & visibility, navigation type, page meta tags, low-entropy user-agent (OS / browser / engine / version / mobile), FPS, clock, scroll velocity, device orientation / motion, geolocation, CPU pressure, soft-keyboard geometry, media playback, form & field state, select & color-picker values, text-truncation (ellipsis) detection, and dominant + accent colors extracted from images and video — 20+ in all.
78
+ **Plugins** (opt-in): pointer position, battery, network, online status, page focus & visibility, navigation type, page meta tags, low-entropy user-agent (OS / browser / engine / version / mobile), FPS, clock, scroll velocity, device orientation / motion, geolocation, CPU pressure, soft-keyboard geometry, media playback, form & field state, select & color-picker values, text-truncation (ellipsis) detection, dominant + accent colors extracted from images and video, and per-element random rolls (optionally seeded) — 20+ in all.
56
79
 
57
80
  → Every source, every property, and live demos are in the **[docs](https://prop-for-that.netlify.app/docsite/reference/plugins/)**.
58
81
 
@@ -60,7 +83,7 @@ Bind any element with `data-props-for="key …"` and read its `--live-*` propert
60
83
 
61
84
  | Import | What it does |
62
85
  | --- | --- |
63
- | `prop-for-that/auto` | Zero-config & declarative: binds every `data-props-for` element — globals included, via `<html data-props-for="…">` — loading plugin sources on demand, kept in sync with the DOM. Use as `<script type="module">`. |
86
+ | `prop-for-that/auto` | Zero-config & declarative: binds every `data-props-for` element — globals included, via `<html data-props-for="…">`, hoisting with `data-props-to` — loading plugin sources on demand, kept in sync with the DOM. Use as `<script type="module">`. |
64
87
  | `prop-for-that` | Imperative API — `propsFor()`, `register()`, `configure()` — for explicit control and teardown. |
65
88
  | `prop-for-that/head` | Synchronous, FOUC-safe constants (scrollbar width & overlay preference, DPR, core count, device memory, low-entropy user-agent) before first paint. |
66
89
  | `prop-for-that/plugins` | The opt-in plugin catalog. |
package/dist/auto.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkOVCZMPYV_cjs=require('./chunk-OVCZMPYV.cjs');require('./chunk-PQVNJZUW.cjs'),require('./chunk-HHINWX7L.cjs'),require('./chunk-EYDIF3NM.cjs'),require('./chunk-65MXZJBD.cjs'),require('./chunk-7L35N3N3.cjs'),require('./chunk-QHHF5SEL.cjs');var u={"scroll-velocity":()=>import('./scroll-velocity-DGZNNO73.cjs').then(t=>t.scrollVelocity),online:()=>import('./online-KTMCBCXT.cjs').then(t=>t.online),"page-focused":()=>import('./page-focused-3WLSZDV4.cjs').then(t=>t.pageFocused),"page-visible":()=>import('./page-visible-6PMX575B.cjs').then(t=>t.pageVisible),"nav-type":()=>import('./nav-type-MFJJDDPZ.cjs').then(t=>t.navType),meta:()=>import('./meta-U2EHV4AM.cjs').then(t=>t.meta),network:()=>import('./network-DPAAEK2S.cjs').then(t=>t.network),battery:()=>import('./battery-DQQ2NOGC.cjs').then(t=>t.battery),clock:()=>import('./clock-EVSBOOMJ.cjs').then(t=>t.clock),fps:()=>import('./fps-Q3ITXSJO.cjs').then(t=>t.fps),"visual-viewport":()=>import('./visual-viewport-MKUHWUQT.cjs').then(t=>t.visualViewport),keyboard:()=>import('./keyboard-6ZGB2LAD.cjs').then(t=>t.keyboard),pointer:()=>import('./pointer-DJSMZGSV.cjs').then(t=>t.pointer),"pointer-local":()=>import('./pointer-local-6JKSOJZV.cjs').then(t=>t.pointerLocal),media:()=>import('./media-XS6ADFFY.cjs').then(t=>t.media),field:()=>import('./field-4MBM2R7N.cjs').then(t=>t.field),"field-state":()=>import('./field-state-NXSK6ZZW.cjs').then(t=>t.fieldState),"form-state":()=>import('./form-state-FJZINKN7.cjs').then(t=>t.formState),select:()=>import('./select-LMRGCCLB.cjs').then(t=>t.select),"color-input":()=>import('./color-input-SYYBVLZM.cjs').then(t=>t.colorInput),orientation:()=>import('./orientation-JD23MYZR.cjs').then(t=>t.orientation),motion:()=>import('./motion-GMUGWJN3.cjs').then(t=>t.motion),geo:()=>import('./geo-CMG7QJ6S.cjs').then(t=>t.geo),"cpu-pressure":()=>import('./cpu-pressure-FXZDL5IE.cjs').then(t=>t.cpuPressure),img:()=>import('./img-6F5QAPW3.cjs').then(t=>t.img),"img-color":()=>import('./img-color-MBEU42DF.cjs').then(t=>t.imgColor),"video-color":()=>import('./video-color-B37Z5OBY.cjs').then(t=>t.videoColor),truncated:()=>import('./truncated-RUY3JNAX.cjs').then(t=>t.truncated),ua:()=>import('./ua-3MLUBLSV.cjs').then(t=>t.ua)};var n=new WeakMap,l=new Map;function v(t){return (t.dataset.propsFor??"").split(/\s+/).filter(Boolean)}function E(t){if(chunkOVCZMPYV_cjs.c(t))return null;let e=u[t];if(!e)return null;let o=l.get(t);return o||(o=e().then(r=>{chunkOVCZMPYV_cjs.a(r);}).catch(r=>{l.delete(t),console.error(`[prop-for-that] failed to load plugin "${t}"`,r);}),l.set(t,o)),o}function b(t,e){let o=E(e);if(!o){chunkOVCZMPYV_cjs.e(t,[e]);return}o.then(()=>{chunkOVCZMPYV_cjs.c(e)&&(n.get(t)??[]).includes(e)&&chunkOVCZMPYV_cjs.e(t,[e]);});}function p(t){let e=v(t),o=n.get(t)??[],r=o.filter(i=>!e.includes(i)),g=e.filter(i=>!o.includes(i));r.length&&chunkOVCZMPYV_cjs.f(t,r),e.length?n.set(t,e):n.delete(t);for(let i of g)b(t,i);}function f(t){let e=n.get(t);e&&(chunkOVCZMPYV_cjs.f(t,e),n.delete(t));}function y(t){t instanceof HTMLElement&&(t.hasAttribute("data-props-for")&&p(t),t.querySelectorAll("[data-props-for]").forEach(p));}function L(t){t instanceof HTMLElement&&(f(t),t.querySelectorAll("[data-props-for]").forEach(f));}function h(){document.documentElement.hasAttribute("data-props-typed")&&chunkOVCZMPYV_cjs.d({typed:true}),document.querySelectorAll("[data-props-for]").forEach(p),new MutationObserver(t=>{for(let e of t){if(e.type==="attributes"&&e.target instanceof HTMLElement){p(e.target);continue}e.removedNodes.forEach(L),e.addedNodes.forEach(y);}}).observe(document.documentElement,{subtree:true,childList:true,attributes:true,attributeFilter:["data-props-for"]});}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",h,{once:true}):h());
1
+ 'use strict';var chunk5PU4B3GP_cjs=require('./chunk-5PU4B3GP.cjs');require('./chunk-DFWBYWE3.cjs'),require('./chunk-HHINWX7L.cjs'),require('./chunk-EYDIF3NM.cjs'),require('./chunk-65MXZJBD.cjs'),require('./chunk-7L35N3N3.cjs'),require('./chunk-DRXR56P5.cjs');var g={"scroll-velocity":()=>import('./scroll-velocity-X3F22E47.cjs').then(e=>e.scrollVelocity),online:()=>import('./online-HHJAVPBU.cjs').then(e=>e.online),"page-focused":()=>import('./page-focused-Y74VK25Y.cjs').then(e=>e.pageFocused),"page-visible":()=>import('./page-visible-3YREALOP.cjs').then(e=>e.pageVisible),"nav-type":()=>import('./nav-type-MFJJDDPZ.cjs').then(e=>e.navType),meta:()=>import('./meta-U2EHV4AM.cjs').then(e=>e.meta),network:()=>import('./network-DPAAEK2S.cjs').then(e=>e.network),battery:()=>import('./battery-DQQ2NOGC.cjs').then(e=>e.battery),clock:()=>import('./clock-EVSBOOMJ.cjs').then(e=>e.clock),fps:()=>import('./fps-Q3ITXSJO.cjs').then(e=>e.fps),"visual-viewport":()=>import('./visual-viewport-MKUHWUQT.cjs').then(e=>e.visualViewport),keyboard:()=>import('./keyboard-6ZGB2LAD.cjs').then(e=>e.keyboard),pointer:()=>import('./pointer-P2B4YDKM.cjs').then(e=>e.pointer),"pointer-local":()=>import('./pointer-local-QZJODLIH.cjs').then(e=>e.pointerLocal),media:()=>import('./media-XS6ADFFY.cjs').then(e=>e.media),field:()=>import('./field-4MBM2R7N.cjs').then(e=>e.field),"field-state":()=>import('./field-state-NXSK6ZZW.cjs').then(e=>e.fieldState),"form-state":()=>import('./form-state-FJZINKN7.cjs').then(e=>e.formState),select:()=>import('./select-LMRGCCLB.cjs').then(e=>e.select),"color-input":()=>import('./color-input-SYYBVLZM.cjs').then(e=>e.colorInput),orientation:()=>import('./orientation-PE3B4RPH.cjs').then(e=>e.orientation),motion:()=>import('./motion-6SENJS5V.cjs').then(e=>e.motion),geo:()=>import('./geo-CMG7QJ6S.cjs').then(e=>e.geo),"cpu-pressure":()=>import('./cpu-pressure-FXZDL5IE.cjs').then(e=>e.cpuPressure),img:()=>import('./img-6F5QAPW3.cjs').then(e=>e.img),"img-color":()=>import('./img-color-MBEU42DF.cjs').then(e=>e.imgColor),"video-color":()=>import('./video-color-B37Z5OBY.cjs').then(e=>e.videoColor),truncated:()=>import('./truncated-23UAUK2L.cjs').then(e=>e.truncated),ua:()=>import('./ua-3MLUBLSV.cjs').then(e=>e.ua),random:()=>import('./random-LUAMZ2M7.cjs').then(e=>e.random)};var i=new WeakMap,l=new Map;function b(e){return (e.dataset.propsFor??"").split(/\s+/).filter(Boolean)}function L(e){if(chunk5PU4B3GP_cjs.c(e))return null;let t=g[e];if(!t)return null;let o=l.get(e);return o||(o=t().then(r=>{chunk5PU4B3GP_cjs.a(r);}).catch(r=>{l.delete(e),console.error(`[prop-for-that] failed to load plugin "${e}"`,r);}),l.set(e,o)),o}function M(e,t,o){let r=L(t);if(!r){chunk5PU4B3GP_cjs.e(e,[t],{to:o});return}r.then(()=>{let n=i.get(e);chunk5PU4B3GP_cjs.c(t)&&n&&n.to===o&&n.keys.includes(t)&&chunk5PU4B3GP_cjs.e(e,[t],{to:o});});}function p(e){let t=b(e),o=e.dataset.propsTo||void 0,r=i.get(e),n=r?.keys??[],u=r!==void 0&&r.to!==o,f=u?n:n.filter(s=>!t.includes(s)),E=u?t:t.filter(s=>!n.includes(s));f.length&&chunk5PU4B3GP_cjs.f(e,f),t.length?i.set(e,{keys:t,to:o}):i.delete(e);for(let s of E)M(e,s,o);}function v(e){let t=i.get(e);t&&(chunk5PU4B3GP_cjs.f(e,t.keys),i.delete(e));}function T(e){e instanceof HTMLElement&&(e.hasAttribute("data-props-for")&&p(e),e.querySelectorAll("[data-props-for]").forEach(p));}function H(e){e instanceof HTMLElement&&(v(e),e.querySelectorAll("[data-props-for]").forEach(v));}function y(){document.documentElement.hasAttribute("data-props-typed")&&chunk5PU4B3GP_cjs.d({typed:true});let e=document.documentElement.dataset.propsSeed;if(e){let t=Number(e);Number.isFinite(t)?chunk5PU4B3GP_cjs.d({randomSeed:t}):console.warn(`[prop-for-that] ignoring non-numeric data-props-seed="${e}"`);}document.querySelectorAll("[data-props-for]").forEach(p),new MutationObserver(t=>{for(let o of t){if(o.type==="attributes"&&o.target instanceof HTMLElement){p(o.target);continue}o.removedNodes.forEach(H),o.addedNodes.forEach(T);}}).observe(document.documentElement,{subtree:true,childList:true,attributes:true,attributeFilter:["data-props-for","data-props-to"]});}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",y,{once:true}):y());
package/dist/auto.js CHANGED
@@ -1 +1 @@
1
- import {d,f as f$1,e,c,a}from'./chunk-D24E2DBW.js';import'./chunk-V4OTPLOQ.js';import'./chunk-LTJ2VKVY.js';import'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import'./chunk-EEMKKLRF.js';var u={"scroll-velocity":()=>import('./scroll-velocity-ZRXPNZG7.js').then(t=>t.scrollVelocity),online:()=>import('./online-MGYZDLCQ.js').then(t=>t.online),"page-focused":()=>import('./page-focused-LBKD6QXG.js').then(t=>t.pageFocused),"page-visible":()=>import('./page-visible-27YKTHKU.js').then(t=>t.pageVisible),"nav-type":()=>import('./nav-type-S4MHMDHS.js').then(t=>t.navType),meta:()=>import('./meta-VSAZR4JL.js').then(t=>t.meta),network:()=>import('./network-BHUTXTX7.js').then(t=>t.network),battery:()=>import('./battery-CDMJLP4C.js').then(t=>t.battery),clock:()=>import('./clock-LYF2IHGE.js').then(t=>t.clock),fps:()=>import('./fps-IGSZPFLV.js').then(t=>t.fps),"visual-viewport":()=>import('./visual-viewport-GNJTAHPT.js').then(t=>t.visualViewport),keyboard:()=>import('./keyboard-YJ7S6XPJ.js').then(t=>t.keyboard),pointer:()=>import('./pointer-3O7MGTQD.js').then(t=>t.pointer),"pointer-local":()=>import('./pointer-local-X5TVNEEJ.js').then(t=>t.pointerLocal),media:()=>import('./media-RDQ3WR22.js').then(t=>t.media),field:()=>import('./field-6USMKGKM.js').then(t=>t.field),"field-state":()=>import('./field-state-YLUDK3XS.js').then(t=>t.fieldState),"form-state":()=>import('./form-state-Q4SCA6TH.js').then(t=>t.formState),select:()=>import('./select-H3CFIVK3.js').then(t=>t.select),"color-input":()=>import('./color-input-STV57DGE.js').then(t=>t.colorInput),orientation:()=>import('./orientation-27ULVQVJ.js').then(t=>t.orientation),motion:()=>import('./motion-GHDWROM2.js').then(t=>t.motion),geo:()=>import('./geo-MXO5OMVO.js').then(t=>t.geo),"cpu-pressure":()=>import('./cpu-pressure-WCDHVDRP.js').then(t=>t.cpuPressure),img:()=>import('./img-PYBNG6OU.js').then(t=>t.img),"img-color":()=>import('./img-color-VW3XMATY.js').then(t=>t.imgColor),"video-color":()=>import('./video-color-ZMRKDZFO.js').then(t=>t.videoColor),truncated:()=>import('./truncated-MDPFWGSI.js').then(t=>t.truncated),ua:()=>import('./ua-3RC4SBYB.js').then(t=>t.ua)};var n=new WeakMap,l=new Map;function v(t){return (t.dataset.propsFor??"").split(/\s+/).filter(Boolean)}function E(t){if(c(t))return null;let e=u[t];if(!e)return null;let o=l.get(t);return o||(o=e().then(r=>{a(r);}).catch(r=>{l.delete(t),console.error(`[prop-for-that] failed to load plugin "${t}"`,r);}),l.set(t,o)),o}function b(t,e$1){let o=E(e$1);if(!o){e(t,[e$1]);return}o.then(()=>{c(e$1)&&(n.get(t)??[]).includes(e$1)&&e(t,[e$1]);});}function p(t){let e=v(t),o=n.get(t)??[],r=o.filter(i=>!e.includes(i)),g=e.filter(i=>!o.includes(i));r.length&&f$1(t,r),e.length?n.set(t,e):n.delete(t);for(let i of g)b(t,i);}function f(t){let e=n.get(t);e&&(f$1(t,e),n.delete(t));}function y(t){t instanceof HTMLElement&&(t.hasAttribute("data-props-for")&&p(t),t.querySelectorAll("[data-props-for]").forEach(p));}function L(t){t instanceof HTMLElement&&(f(t),t.querySelectorAll("[data-props-for]").forEach(f));}function h(){document.documentElement.hasAttribute("data-props-typed")&&d({typed:true}),document.querySelectorAll("[data-props-for]").forEach(p),new MutationObserver(t=>{for(let e of t){if(e.type==="attributes"&&e.target instanceof HTMLElement){p(e.target);continue}e.removedNodes.forEach(L),e.addedNodes.forEach(y);}}).observe(document.documentElement,{subtree:true,childList:true,attributes:true,attributeFilter:["data-props-for"]});}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",h,{once:true}):h());
1
+ import {d,f,e,c,a}from'./chunk-N3F2LRDI.js';import'./chunk-6234NJTF.js';import'./chunk-LTJ2VKVY.js';import'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import'./chunk-7KEBMJ3O.js';var g={"scroll-velocity":()=>import('./scroll-velocity-Y43V5NH2.js').then(e=>e.scrollVelocity),online:()=>import('./online-OWTXHDGG.js').then(e=>e.online),"page-focused":()=>import('./page-focused-UK3VPLIG.js').then(e=>e.pageFocused),"page-visible":()=>import('./page-visible-GSBWF44E.js').then(e=>e.pageVisible),"nav-type":()=>import('./nav-type-S4MHMDHS.js').then(e=>e.navType),meta:()=>import('./meta-VSAZR4JL.js').then(e=>e.meta),network:()=>import('./network-BHUTXTX7.js').then(e=>e.network),battery:()=>import('./battery-CDMJLP4C.js').then(e=>e.battery),clock:()=>import('./clock-LYF2IHGE.js').then(e=>e.clock),fps:()=>import('./fps-IGSZPFLV.js').then(e=>e.fps),"visual-viewport":()=>import('./visual-viewport-GNJTAHPT.js').then(e=>e.visualViewport),keyboard:()=>import('./keyboard-YJ7S6XPJ.js').then(e=>e.keyboard),pointer:()=>import('./pointer-RJIXVFBH.js').then(e=>e.pointer),"pointer-local":()=>import('./pointer-local-L4EQM2UF.js').then(e=>e.pointerLocal),media:()=>import('./media-RDQ3WR22.js').then(e=>e.media),field:()=>import('./field-6USMKGKM.js').then(e=>e.field),"field-state":()=>import('./field-state-YLUDK3XS.js').then(e=>e.fieldState),"form-state":()=>import('./form-state-Q4SCA6TH.js').then(e=>e.formState),select:()=>import('./select-H3CFIVK3.js').then(e=>e.select),"color-input":()=>import('./color-input-STV57DGE.js').then(e=>e.colorInput),orientation:()=>import('./orientation-LBAL4AXW.js').then(e=>e.orientation),motion:()=>import('./motion-QDEZZYDF.js').then(e=>e.motion),geo:()=>import('./geo-MXO5OMVO.js').then(e=>e.geo),"cpu-pressure":()=>import('./cpu-pressure-WCDHVDRP.js').then(e=>e.cpuPressure),img:()=>import('./img-PYBNG6OU.js').then(e=>e.img),"img-color":()=>import('./img-color-VW3XMATY.js').then(e=>e.imgColor),"video-color":()=>import('./video-color-ZMRKDZFO.js').then(e=>e.videoColor),truncated:()=>import('./truncated-R3OIXDTH.js').then(e=>e.truncated),ua:()=>import('./ua-3RC4SBYB.js').then(e=>e.ua),random:()=>import('./random-O4GDPYJ3.js').then(e=>e.random)};var i=new WeakMap,l=new Map;function b(e){return (e.dataset.propsFor??"").split(/\s+/).filter(Boolean)}function L(e){if(c(e))return null;let t=g[e];if(!t)return null;let o=l.get(e);return o||(o=t().then(r=>{a(r);}).catch(r=>{l.delete(e),console.error(`[prop-for-that] failed to load plugin "${e}"`,r);}),l.set(e,o)),o}function M(e$1,t,o){let r=L(t);if(!r){e(e$1,[t],{to:o});return}r.then(()=>{let n=i.get(e$1);c(t)&&n&&n.to===o&&n.keys.includes(t)&&e(e$1,[t],{to:o});});}function p(e){let t=b(e),o=e.dataset.propsTo||void 0,r=i.get(e),n=r?.keys??[],u=r!==void 0&&r.to!==o,f$1=u?n:n.filter(s=>!t.includes(s)),E=u?t:t.filter(s=>!n.includes(s));f$1.length&&f(e,f$1),t.length?i.set(e,{keys:t,to:o}):i.delete(e);for(let s of E)M(e,s,o);}function v(e){let t=i.get(e);t&&(f(e,t.keys),i.delete(e));}function T(e){e instanceof HTMLElement&&(e.hasAttribute("data-props-for")&&p(e),e.querySelectorAll("[data-props-for]").forEach(p));}function H(e){e instanceof HTMLElement&&(v(e),e.querySelectorAll("[data-props-for]").forEach(v));}function y(){document.documentElement.hasAttribute("data-props-typed")&&d({typed:true});let e=document.documentElement.dataset.propsSeed;if(e){let t=Number(e);Number.isFinite(t)?d({randomSeed:t}):console.warn(`[prop-for-that] ignoring non-numeric data-props-seed="${e}"`);}document.querySelectorAll("[data-props-for]").forEach(p),new MutationObserver(t=>{for(let o of t){if(o.type==="attributes"&&o.target instanceof HTMLElement){p(o.target);continue}o.removedNodes.forEach(H),o.addedNodes.forEach(T);}}).observe(document.documentElement,{subtree:true,childList:true,attributes:true,attributeFilter:["data-props-for","data-props-to"]});}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",y,{once:true}):y());
@@ -1 +1 @@
1
- import {a}from'./chunk-EEMKKLRF.js';var u={key:"page-focused",scope:"global",start(c){let o=()=>c.write("page-focused",document.hasFocus()?1:0);o();let t=a("focus",o),r=a("blur",o);return ()=>{t(),r();}}};export{u as a};
1
+ import {a}from'./chunk-7KEBMJ3O.js';var u={key:"page-focused",scope:"global",start(c){let o=()=>c.write("page-focused",document.hasFocus()?1:0);o();let t=a("focus",o),r=a("blur",o);return ()=>{t(),r();}}};export{u as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-EEMKKLRF.js';var f={key:"online",scope:"global",start(e){let o=()=>e.write("online",navigator.onLine?1:0);o();let t=a("online",o),i=a("offline",o);return ()=>{t(),i();}}};export{f as a};
1
+ import {a}from'./chunk-7KEBMJ3O.js';var f={key:"online",scope:"global",start(e){let o=()=>e.write("online",navigator.onLine?1:0);o();let t=a("online",o),i=a("offline",o);return ()=>{t(),i();}}};export{f as a};
@@ -1 +1 @@
1
- 'use strict';var chunkPQVNJZUW_cjs=require('./chunk-PQVNJZUW.cjs');var i={key:"truncated",scope:"element",start(t){let e=t.target,r=()=>{let o=e.scrollWidth>e.clientWidth?1:0,c=e.scrollHeight>e.clientHeight?1:0;t.write("truncated",o||c?1:0),t.write("truncated-x",o),t.write("truncated-y",c);};return r(),chunkPQVNJZUW_cjs.a(e,r)}};exports.a=i;
1
+ 'use strict';var chunkDFWBYWE3_cjs=require('./chunk-DFWBYWE3.cjs');var i={key:"truncated",scope:"element",start(t){let e=t.target,r=()=>{let o=e.scrollWidth>e.clientWidth?1:0,c=e.scrollHeight>e.clientHeight?1:0;t.write("truncated",o||c?1:0),t.write("truncated-x",o),t.write("truncated-y",c);};return r(),chunkDFWBYWE3_cjs.a(e,r)}};exports.a=i;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkDRXR56P5_cjs=require('./chunk-DRXR56P5.cjs');var f={key:"online",scope:"global",start(e){let o=()=>e.write("online",navigator.onLine?1:0);o();let t=chunkDRXR56P5_cjs.a("online",o),i=chunkDRXR56P5_cjs.a("offline",o);return ()=>{t(),i();}}};exports.a=f;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkDFWBYWE3_cjs=require('./chunk-DFWBYWE3.cjs'),chunkHHINWX7L_cjs=require('./chunk-HHINWX7L.cjs'),chunkEYDIF3NM_cjs=require('./chunk-EYDIF3NM.cjs'),chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunk7L35N3N3_cjs=require('./chunk-7L35N3N3.cjs'),chunkDRXR56P5_cjs=require('./chunk-DRXR56P5.cjs');var a;function O(){if(a!==void 0||(a=null,typeof document>"u"||typeof CSSStyleSheet!="function"||!("adoptedStyleSheets"in document)))return a;try{let e=new CSSStyleSheet;e.replaceSync(":root{}"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],a=e.cssRules[0].style;}catch{a=null;}return a}function y(e){if(typeof document<"u"&&e===document.documentElement){let t=O();if(t)return t}return e.style}var v=class{pending=new Map;last=new WeakMap;set(t,r,n){let o=this.pending.get(t);if(o?.has(r)){o.set(r,n);return}this.last.get(t)?.get(r)!==n&&(o?o.set(r,n):this.pending.set(t,new Map([[r,n]])),chunkEYDIF3NM_cjs.a());}forget(t,r){this.last.get(t)?.delete(r);let n=this.pending.get(t);n&&(n.delete(r),n.size===0&&this.pending.delete(t));}flush=()=>{if(this.pending.size!==0){for(let[t,r]of this.pending){let n=this.last.get(t);n||this.last.set(t,n=new Map);let o=y(t);for(let[s,i]of r)n.get(s)!==i&&(o.setProperty(s,i),n.set(s,i));}this.pending.clear();}}},S=new v;chunkEYDIF3NM_cjs.b(S.flush);var C=new Set;function x(e,t,r){if(C.has(e)||typeof CSS>"u"||typeof CSS.registerProperty!="function")return;C.add(e);let n=t?r?.[t]:void 0,o=t?chunk7L35N3N3_cjs.a.defaults?.[t]:void 0;try{CSS.registerProperty({name:e,syntax:n?.syntax??"<number>",inherits:n?.inherits??!0,initialValue:o!=null?String(o):n?.initial??"0"});}catch{}}var P={key:"viewport",scope:"global",start(e){let t=()=>{e.write("vw",window.innerWidth),e.write("vh",window.innerHeight);};return t(),chunkDRXR56P5_cjs.a("resize",t)}};var D={key:"size",scope:"element",start(e){return chunkDFWBYWE3_cjs.a(e.target,t=>{let r=t.borderBoxSize?.[0],n=r?r.inlineSize:t.contentRect.width,o=r?r.blockSize:t.contentRect.height;e.write("w",chunk65MXZJBD_cjs.a(n)),e.write("h",chunk65MXZJBD_cjs.a(o)),e.write("aspect",o>0?chunk65MXZJBD_cjs.a(n/o):0);})}};var w=1;function K(e){let t=e.rootBounds;if(!t)return e.intersectionRatio>=1;let r=e.boundingClientRect;return r.top>=t.top-w&&r.right<=t.right+w&&r.bottom<=t.bottom+w&&r.left>=t.left-w}var z={key:"visibility",scope:"element",gate:false,start(e){let t=false;return e.write("visible",0),e.write("has-entered",0,"const"),chunkDFWBYWE3_cjs.b(e.target,r=>{let n=K(r);e.write("visible",n?1:0),n&&!t&&(t=true,e.write("has-entered",1,"const"));})}};var R={key:"range",scope:"element",gate:false,start(e){let t=chunkHHINWX7L_cjs.a(e.target,'input[type="range"], input[type="number"]');if(!t)return ()=>{};let r=()=>{let n=t.min===""?0:Number(t.min),o=t.max===""?100:Number(t.max),s=Number(t.value);e.write("value",s),e.write("value-pct",o>n?chunk65MXZJBD_cjs.a((s-n)/(o-n)):0);};return r(),t.addEventListener("input",r,{passive:true}),()=>t.removeEventListener("input",r)}};var F={viewport:P,size:D,visibility:z,range:R};var W=()=>{},u=new Map,E=new WeakMap,h={...F};function Me(e){h[e.key]=e;}function Le(e){delete h[e];}function Te(e){return e in h}function be(e){Object.assign(chunk7L35N3N3_cjs.a,e);}function $(e,t,r,n){let o={live:new Map,const:new Map};return {target:e,config:chunk7L35N3N3_cjs.a,write(s,i,c="live"){let p=o[c],l=p.get(s);if(l){if(l.raw===i)return;l.raw=i;}else {let m=(c==="const"?chunk7L35N3N3_cjs.a.constPrefix:chunk7L35N3N3_cjs.a.livePrefix)+s;p.set(s,l={raw:i,prop:m}),r.add(m);}chunk7L35N3N3_cjs.a.typed&&x(l.prop,s,n),S.set(t,l.prop,String(i));}}}function A(e,t,r){if(!(e.scope==="element"&&e.gate!==false&&r!==chunk7L35N3N3_cjs.a.root&&typeof IntersectionObserver<"u"))return e.start(t);let o=null,s=()=>{if(!o)try{o=e.start(t);}catch(p){console.error(`[prop-for-that] source "${e.key}" failed to start`,p);}},i=()=>{o?.(),o=null;},c=chunkDFWBYWE3_cjs.b(r,p=>{p.isIntersecting?s():i();});return ()=>{c(),i();}}function M(e,t,r){let n=r.get(t);if(!n)return;n.dispose();let{writeTarget:o}=n,s=y(o);for(let i of n.written)s.removeProperty(i),S.forget(o,i);o!==e&&E.get(o)?.delete(t),r.delete(t);}function B(e,t){if(typeof t!="string")return t;let r=e.closest(t);return r||(console.warn(`[prop-for-that] no ancestor matches "${t}" \u2014 writing on the element itself`),e)}function V(e,t){let r=E.get(e);r||E.set(e,r=new Set),r.has(t)&&console.warn(`[prop-for-that] "${t}" is already hoisted onto this element \u2014 the bindings will overwrite each other`,e),r.add(t);}function _(e,t,r){let n=u.get(e);n||u.set(e,n=new Map);let o=r?B(e,r):e,s=[];for(let i of t){if(n.has(i))continue;let c=h[i];if(!c){console.warn(`[prop-for-that] unknown source "${i}"`);continue}let p=o;p!==e&&c.scope==="global"&&(console.warn(`[prop-for-that] "to" ignored for global source "${i}"`),p=e);let l=new Set,m;try{m=A(c,$(e,p,l,c.props),e);}catch(I){console.error(`[prop-for-that] source "${i}" failed to start`,I);continue}p!==e&&V(p,i),n.set(i,{dispose:m,written:l,writeTarget:p}),s.push(i);}return ()=>{let i=u.get(e);if(i){for(let c of s)M(e,c,i);i.size===0&&u.delete(e);}}}function j(e){return e instanceof Element?[e]:typeof NodeList<"u"&&e instanceof NodeList||typeof HTMLCollection<"u"&&e instanceof HTMLCollection||Array.isArray(e)?Array.from(e).filter(t=>t instanceof Element):[]}function q(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="string")}function He(e,t,r){let n,o;if(t===void 0&&q(e)?(n=chunk7L35N3N3_cjs.a.root?[chunk7L35N3N3_cjs.a.root]:[],o=e):(n=j(e),o=t??[]),!n.length||!o.length)return W;let s=n.map(i=>_(i,o,r?.to));return ()=>{for(let i of s)i();}}function ke(e,t){let r=u.get(e);if(r){for(let n of t??[...r.keys()])M(e,n,r);r.size===0&&u.delete(e);}}function Ce(){for(let[e,t]of u)for(let r of [...t.keys()])M(e,r,t);u.clear();}exports.a=Me;exports.b=Le;exports.c=Te;exports.d=be;exports.e=He;exports.f=ke;exports.g=Ce;
@@ -0,0 +1 @@
1
+ var a,f=new WeakMap,v=new WeakMap;function y(e,n){a||(a=new ResizeObserver(t=>{for(let s of t){v.set(s.target,s);let i=f.get(s.target);if(i)for(let d of i)d(s);}}));let r=f.get(e);r||(f.set(e,r=new Set),a.observe(e)),r.add(n);let o=v.get(e);return o&&n(o),()=>{let t=f.get(e);t&&(t.delete(n),t.size===0&&(f.delete(e),a.unobserve(e)));}}var b,c=new WeakMap,p=new WeakMap,g=[0,.98,.99,.995,.999,1];function l(e,n){b||(b=new IntersectionObserver(t=>{for(let s of t){p.set(s.target,s);let i=c.get(s.target);if(i)for(let d of i)d(s);}},{threshold:g}));let r=c.get(e);r||(c.set(e,r=new Set),b.observe(e)),r.add(n);let o=p.get(e);return o&&n(o),()=>{let t=c.get(e);t&&(t.delete(n),t.size===0&&(c.delete(e),b.unobserve(e)));}}export{y as a,l as b};
@@ -1 +1 @@
1
- 'use strict';var chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkQHHF5SEL_cjs=require('./chunk-QHHF5SEL.cjs');var c={key:"pointer",scope:"global",start(o){return chunkQHHF5SEL_cjs.a("pointermove",n=>{let e=n;o.write("pointer-x",e.clientX),o.write("pointer-y",e.clientY),o.write("pointer-x-ratio",chunk65MXZJBD_cjs.a(e.clientX/window.innerWidth)),o.write("pointer-y-ratio",chunk65MXZJBD_cjs.a(e.clientY/window.innerHeight));})}};exports.a=c;
1
+ 'use strict';var chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkDRXR56P5_cjs=require('./chunk-DRXR56P5.cjs');var c={key:"pointer",scope:"global",start(o){return chunkDRXR56P5_cjs.a("pointermove",n=>{let e=n;o.write("pointer-x",e.clientX),o.write("pointer-y",e.clientY),o.write("pointer-x-ratio",chunk65MXZJBD_cjs.a(e.clientX/window.innerWidth)),o.write("pointer-y-ratio",chunk65MXZJBD_cjs.a(e.clientY/window.innerHeight));})}};exports.a=c;
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-EEMKKLRF.js';var c={key:"pointer",scope:"global",start(o){return a("pointermove",n=>{let e=n;o.write("pointer-x",e.clientX),o.write("pointer-y",e.clientY),o.write("pointer-x-ratio",a$1(e.clientX/window.innerWidth)),o.write("pointer-y-ratio",a$1(e.clientY/window.innerHeight));})}};export{c as a};
1
+ import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-7KEBMJ3O.js';var c={key:"pointer",scope:"global",start(o){return a("pointermove",n=>{let e=n;o.write("pointer-x",e.clientX),o.write("pointer-y",e.clientY),o.write("pointer-x-ratio",a$1(e.clientX/window.innerWidth)),o.write("pointer-y-ratio",a$1(e.clientY/window.innerHeight));})}};export{c as a};
@@ -0,0 +1 @@
1
+ var t=new Map;function a(n,s){let e=t.get(n);if(!e){let r=new Set,d=i=>{for(let o of r)o(i);};e={handlers:r,dispatch:d},t.set(n,e),window.addEventListener(n,d,{passive:true});}return e.handlers.add(s),()=>{e.handlers.delete(s),e.handlers.size===0&&(window.removeEventListener(n,e.dispatch),t.delete(n));}}export{a};
@@ -1 +1 @@
1
- 'use strict';var chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkQHHF5SEL_cjs=require('./chunk-QHHF5SEL.cjs');var p={key:"orientation",scope:"global",start(t){return typeof DeviceOrientationEvent>"u"?()=>{}:chunkQHHF5SEL_cjs.a("deviceorientation",r=>{let o=r;t.write("orient-alpha",chunk65MXZJBD_cjs.a(o.alpha??0)),t.write("orient-beta",chunk65MXZJBD_cjs.a(o.beta??0)),t.write("orient-gamma",chunk65MXZJBD_cjs.a(o.gamma??0));})}};exports.a=p;
1
+ 'use strict';var chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkDRXR56P5_cjs=require('./chunk-DRXR56P5.cjs');var p={key:"orientation",scope:"global",start(t){return typeof DeviceOrientationEvent>"u"?()=>{}:chunkDRXR56P5_cjs.a("deviceorientation",r=>{let o=r;t.write("orient-alpha",chunk65MXZJBD_cjs.a(o.alpha??0)),t.write("orient-beta",chunk65MXZJBD_cjs.a(o.beta??0)),t.write("orient-gamma",chunk65MXZJBD_cjs.a(o.gamma??0));})}};exports.a=p;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkDRXR56P5_cjs=require('./chunk-DRXR56P5.cjs');var u={key:"page-focused",scope:"global",start(c){let o=()=>c.write("page-focused",document.hasFocus()?1:0);o();let t=chunkDRXR56P5_cjs.a("focus",o),r=chunkDRXR56P5_cjs.a("blur",o);return ()=>{t(),r();}}};exports.a=u;
@@ -0,0 +1 @@
1
+ 'use strict';var a,f=new WeakMap,v=new WeakMap;function y(e,n){a||(a=new ResizeObserver(t=>{for(let s of t){v.set(s.target,s);let i=f.get(s.target);if(i)for(let d of i)d(s);}}));let r=f.get(e);r||(f.set(e,r=new Set),a.observe(e)),r.add(n);let o=v.get(e);return o&&n(o),()=>{let t=f.get(e);t&&(t.delete(n),t.size===0&&(f.delete(e),a.unobserve(e)));}}var b,c=new WeakMap,p=new WeakMap,g=[0,.98,.99,.995,.999,1];function l(e,n){b||(b=new IntersectionObserver(t=>{for(let s of t){p.set(s.target,s);let i=c.get(s.target);if(i)for(let d of i)d(s);}},{threshold:g}));let r=c.get(e);r||(c.set(e,r=new Set),b.observe(e)),r.add(n);let o=p.get(e);return o&&n(o),()=>{let t=c.get(e);t&&(t.delete(n),t.size===0&&(c.delete(e),b.unobserve(e)));}}exports.a=y;exports.b=l;
@@ -0,0 +1 @@
1
+ 'use strict';var t=new Map;function a(n,s){let e=t.get(n);if(!e){let r=new Set,d=i=>{for(let o of r)o(i);};e={handlers:r,dispatch:d},t.set(n,e),window.addEventListener(n,d,{passive:true});}return e.handlers.add(s),()=>{e.handlers.delete(s),e.handlers.size===0&&(window.removeEventListener(n,e.dispatch),t.delete(n));}}exports.a=a;
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-T4N6AEOZ.js';var s={key:"random",scope:"element",gate:false,props:{random:{syntax:"<number>",initial:"0"},"random-2":{syntax:"<number>",initial:"0"},"random-3":{syntax:"<number>",initial:"0"}},start(n){let{randomSeed:t}=n.config,e=t===void 0?()=>Math.random():l(u(n.target,t));return n.write("random",a(e()),"const"),n.write("random-2",a(e()),"const"),n.write("random-3",a(e()),"const"),()=>{}}};function l(n){let t=n|0;return ()=>{t=t+1831565813|0;let e=t^t>>>15;return e=Math.imul(e,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function u(n,t){let e=t>>>0^2166136261;for(let o=n;o;o=o.parentElement){let a=o.tagName;for(let r=0;r<a.length;r++)e=Math.imul(e^a.charCodeAt(r),16777619);let i=0;for(let r=o.previousElementSibling;r;r=r.previousElementSibling)i++;e=Math.imul(e^i,16777619);}return e>>>0}export{s as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-EEMKKLRF.js';var m={key:"motion",scope:"global",start(e){return typeof DeviceMotionEvent>"u"?()=>{}:a("devicemotion",i=>{let t=i.accelerationIncludingGravity;e.write("accel-x",a$1(t?.x??0)),e.write("accel-y",a$1(t?.y??0)),e.write("accel-z",a$1(t?.z??0));})}};export{m as a};
1
+ import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-7KEBMJ3O.js';var m={key:"motion",scope:"global",start(e){return typeof DeviceMotionEvent>"u"?()=>{}:a("devicemotion",i=>{let t=i.accelerationIncludingGravity;e.write("accel-x",a$1(t?.x??0)),e.write("accel-y",a$1(t?.y??0)),e.write("accel-z",a$1(t?.z??0));})}};export{m as a};
@@ -0,0 +1 @@
1
+ var s=new Map;function o(e,n){let t=s.get(e);if(!t){let r=new Set,i=a=>{for(let d of r)d(a);};t={handlers:r,dispatch:i},s.set(e,t),document.addEventListener(e,i,{passive:true});}return t.handlers.add(n),()=>{t.handlers.delete(n),t.handlers.size===0&&(document.removeEventListener(e,t.dispatch),s.delete(e));}}var l={key:"page-visible",scope:"global",start(e){let n=()=>e.write("page-visible",document.visibilityState==="visible"?1:0);return n(),o("visibilitychange",n)}};export{l as a};
@@ -0,0 +1 @@
1
+ 'use strict';var s=new Map;function o(e,n){let t=s.get(e);if(!t){let r=new Set,i=a=>{for(let d of r)d(a);};t={handlers:r,dispatch:i},s.set(e,t),document.addEventListener(e,i,{passive:true});}return t.handlers.add(n),()=>{t.handlers.delete(n),t.handlers.size===0&&(document.removeEventListener(e,t.dispatch),s.delete(e));}}var l={key:"page-visible",scope:"global",start(e){let n=()=>e.write("page-visible",document.visibilityState==="visible"?1:0);return n(),o("visibilitychange",n)}};exports.a=l;
@@ -1 +1 @@
1
- import {a}from'./chunk-V4OTPLOQ.js';var i={key:"truncated",scope:"element",start(t){let e=t.target,r=()=>{let o=e.scrollWidth>e.clientWidth?1:0,c=e.scrollHeight>e.clientHeight?1:0;t.write("truncated",o||c?1:0),t.write("truncated-x",o),t.write("truncated-y",c);};return r(),a(e,r)}};export{i as a};
1
+ import {a}from'./chunk-6234NJTF.js';var i={key:"truncated",scope:"element",start(t){let e=t.target,r=()=>{let o=e.scrollWidth>e.clientWidth?1:0,c=e.scrollHeight>e.clientHeight?1:0;t.write("truncated",o||c?1:0),t.write("truncated-x",o),t.write("truncated-y",c);};return r(),a(e,r)}};export{i as a};
@@ -1 +1 @@
1
- 'use strict';var chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkQHHF5SEL_cjs=require('./chunk-QHHF5SEL.cjs');var m={key:"motion",scope:"global",start(e){return typeof DeviceMotionEvent>"u"?()=>{}:chunkQHHF5SEL_cjs.a("devicemotion",i=>{let t=i.accelerationIncludingGravity;e.write("accel-x",chunk65MXZJBD_cjs.a(t?.x??0)),e.write("accel-y",chunk65MXZJBD_cjs.a(t?.y??0)),e.write("accel-z",chunk65MXZJBD_cjs.a(t?.z??0));})}};exports.a=m;
1
+ 'use strict';var chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkDRXR56P5_cjs=require('./chunk-DRXR56P5.cjs');var m={key:"motion",scope:"global",start(e){return typeof DeviceMotionEvent>"u"?()=>{}:chunkDRXR56P5_cjs.a("devicemotion",i=>{let t=i.accelerationIncludingGravity;e.write("accel-x",chunk65MXZJBD_cjs.a(t?.x??0)),e.write("accel-y",chunk65MXZJBD_cjs.a(t?.y??0)),e.write("accel-z",chunk65MXZJBD_cjs.a(t?.z??0));})}};exports.a=m;
@@ -0,0 +1 @@
1
+ import {b as b$1,a as a$4}from'./chunk-6234NJTF.js';import {a as a$3}from'./chunk-LTJ2VKVY.js';import {b,a as a$1}from'./chunk-KG3EF456.js';import {a as a$5}from'./chunk-T4N6AEOZ.js';import {a as a$2}from'./chunk-LWKH66VY.js';import {a as a$6}from'./chunk-7KEBMJ3O.js';var a;function O(){if(a!==void 0||(a=null,typeof document>"u"||typeof CSSStyleSheet!="function"||!("adoptedStyleSheets"in document)))return a;try{let e=new CSSStyleSheet;e.replaceSync(":root{}"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],a=e.cssRules[0].style;}catch{a=null;}return a}function y(e){if(typeof document<"u"&&e===document.documentElement){let t=O();if(t)return t}return e.style}var v=class{pending=new Map;last=new WeakMap;set(t,r,n){let o=this.pending.get(t);if(o?.has(r)){o.set(r,n);return}this.last.get(t)?.get(r)!==n&&(o?o.set(r,n):this.pending.set(t,new Map([[r,n]])),a$1());}forget(t,r){this.last.get(t)?.delete(r);let n=this.pending.get(t);n&&(n.delete(r),n.size===0&&this.pending.delete(t));}flush=()=>{if(this.pending.size!==0){for(let[t,r]of this.pending){let n=this.last.get(t);n||this.last.set(t,n=new Map);let o=y(t);for(let[s,i]of r)n.get(s)!==i&&(o.setProperty(s,i),n.set(s,i));}this.pending.clear();}}},S=new v;b(S.flush);var C=new Set;function x(e,t,r){if(C.has(e)||typeof CSS>"u"||typeof CSS.registerProperty!="function")return;C.add(e);let n=t?r?.[t]:void 0,o=t?a$2.defaults?.[t]:void 0;try{CSS.registerProperty({name:e,syntax:n?.syntax??"<number>",inherits:n?.inherits??!0,initialValue:o!=null?String(o):n?.initial??"0"});}catch{}}var P={key:"viewport",scope:"global",start(e){let t=()=>{e.write("vw",window.innerWidth),e.write("vh",window.innerHeight);};return t(),a$6("resize",t)}};var D={key:"size",scope:"element",start(e){return a$4(e.target,t=>{let r=t.borderBoxSize?.[0],n=r?r.inlineSize:t.contentRect.width,o=r?r.blockSize:t.contentRect.height;e.write("w",a$5(n)),e.write("h",a$5(o)),e.write("aspect",o>0?a$5(n/o):0);})}};var w=1;function K(e){let t=e.rootBounds;if(!t)return e.intersectionRatio>=1;let r=e.boundingClientRect;return r.top>=t.top-w&&r.right<=t.right+w&&r.bottom<=t.bottom+w&&r.left>=t.left-w}var z={key:"visibility",scope:"element",gate:false,start(e){let t=false;return e.write("visible",0),e.write("has-entered",0,"const"),b$1(e.target,r=>{let n=K(r);e.write("visible",n?1:0),n&&!t&&(t=true,e.write("has-entered",1,"const"));})}};var R={key:"range",scope:"element",gate:false,start(e){let t=a$3(e.target,'input[type="range"], input[type="number"]');if(!t)return ()=>{};let r=()=>{let n=t.min===""?0:Number(t.min),o=t.max===""?100:Number(t.max),s=Number(t.value);e.write("value",s),e.write("value-pct",o>n?a$5((s-n)/(o-n)):0);};return r(),t.addEventListener("input",r,{passive:true}),()=>t.removeEventListener("input",r)}};var F={viewport:P,size:D,visibility:z,range:R};var W=()=>{},u=new Map,E=new WeakMap,h={...F};function Me(e){h[e.key]=e;}function Le(e){delete h[e];}function Te(e){return e in h}function be(e){Object.assign(a$2,e);}function $(e,t,r,n){let o={live:new Map,const:new Map};return {target:e,config:a$2,write(s,i,c="live"){let p=o[c],l=p.get(s);if(l){if(l.raw===i)return;l.raw=i;}else {let m=(c==="const"?a$2.constPrefix:a$2.livePrefix)+s;p.set(s,l={raw:i,prop:m}),r.add(m);}a$2.typed&&x(l.prop,s,n),S.set(t,l.prop,String(i));}}}function A(e,t,r){if(!(e.scope==="element"&&e.gate!==false&&r!==a$2.root&&typeof IntersectionObserver<"u"))return e.start(t);let o=null,s=()=>{if(!o)try{o=e.start(t);}catch(p){console.error(`[prop-for-that] source "${e.key}" failed to start`,p);}},i=()=>{o?.(),o=null;},c=b$1(r,p=>{p.isIntersecting?s():i();});return ()=>{c(),i();}}function M(e,t,r){let n=r.get(t);if(!n)return;n.dispose();let{writeTarget:o}=n,s=y(o);for(let i of n.written)s.removeProperty(i),S.forget(o,i);o!==e&&E.get(o)?.delete(t),r.delete(t);}function B(e,t){if(typeof t!="string")return t;let r=e.closest(t);return r||(console.warn(`[prop-for-that] no ancestor matches "${t}" \u2014 writing on the element itself`),e)}function V(e,t){let r=E.get(e);r||E.set(e,r=new Set),r.has(t)&&console.warn(`[prop-for-that] "${t}" is already hoisted onto this element \u2014 the bindings will overwrite each other`,e),r.add(t);}function _(e,t,r){let n=u.get(e);n||u.set(e,n=new Map);let o=r?B(e,r):e,s=[];for(let i of t){if(n.has(i))continue;let c=h[i];if(!c){console.warn(`[prop-for-that] unknown source "${i}"`);continue}let p=o;p!==e&&c.scope==="global"&&(console.warn(`[prop-for-that] "to" ignored for global source "${i}"`),p=e);let l=new Set,m;try{m=A(c,$(e,p,l,c.props),e);}catch(I){console.error(`[prop-for-that] source "${i}" failed to start`,I);continue}p!==e&&V(p,i),n.set(i,{dispose:m,written:l,writeTarget:p}),s.push(i);}return ()=>{let i=u.get(e);if(i){for(let c of s)M(e,c,i);i.size===0&&u.delete(e);}}}function j(e){return e instanceof Element?[e]:typeof NodeList<"u"&&e instanceof NodeList||typeof HTMLCollection<"u"&&e instanceof HTMLCollection||Array.isArray(e)?Array.from(e).filter(t=>t instanceof Element):[]}function q(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="string")}function He(e,t,r){let n,o;if(t===void 0&&q(e)?(n=a$2.root?[a$2.root]:[],o=e):(n=j(e),o=t??[]),!n.length||!o.length)return W;let s=n.map(i=>_(i,o,r?.to));return ()=>{for(let i of s)i();}}function ke(e,t){let r=u.get(e);if(r){for(let n of t??[...r.keys()])M(e,n,r);r.size===0&&u.delete(e);}}function Ce(){for(let[e,t]of u)for(let r of [...t.keys()])M(e,r,t);u.clear();}export{Me as a,Le as b,Te as c,be as d,He as e,ke as f,Ce as g};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-EEMKKLRF.js';var p={key:"orientation",scope:"global",start(t){return typeof DeviceOrientationEvent>"u"?()=>{}:a("deviceorientation",r=>{let o=r;t.write("orient-alpha",a$1(o.alpha??0)),t.write("orient-beta",a$1(o.beta??0)),t.write("orient-gamma",a$1(o.gamma??0));})}};export{p as a};
1
+ import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-7KEBMJ3O.js';var p={key:"orientation",scope:"global",start(t){return typeof DeviceOrientationEvent>"u"?()=>{}:a("deviceorientation",r=>{let o=r;t.write("orient-alpha",a$1(o.alpha??0)),t.write("orient-beta",a$1(o.beta??0)),t.write("orient-gamma",a$1(o.gamma??0));})}};export{p as a};
@@ -1 +1 @@
1
- import {c}from'./chunk-KG3EF456.js';import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-EEMKKLRF.js';var u={key:"scroll-velocity",scope:"global",start(r){let e=window.scrollY,l=0,o=null,a$2=()=>{let c=window.scrollY,w=c-e;e=c,l=w||l*.8,Math.abs(l)<.01&&(l=0);let t=a$1(l);r.write("scroll-velocity",t),r.write("scroll-direction",Math.sign(t)),t===0&&o&&(o(),o=null);},m=()=>{o||(o=c(a$2));};r.write("scroll-velocity",0),r.write("scroll-direction",0);let p=a("scroll",m);return ()=>{p(),o?.();}}};export{u as a};
1
+ import {c}from'./chunk-KG3EF456.js';import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-7KEBMJ3O.js';var u={key:"scroll-velocity",scope:"global",start(r){let e=window.scrollY,l=0,o=null,a$2=()=>{let c=window.scrollY,w=c-e;e=c,l=w||l*.8,Math.abs(l)<.01&&(l=0);let t=a$1(l);r.write("scroll-velocity",t),r.write("scroll-direction",Math.sign(t)),t===0&&o&&(o(),o=null);},m=()=>{o||(o=c(a$2));};r.write("scroll-velocity",0),r.write("scroll-direction",0);let p=a("scroll",m);return ()=>{p(),o?.();}}};export{u as a};
@@ -1 +1 @@
1
- 'use strict';var chunkEYDIF3NM_cjs=require('./chunk-EYDIF3NM.cjs'),chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkQHHF5SEL_cjs=require('./chunk-QHHF5SEL.cjs');var u={key:"scroll-velocity",scope:"global",start(r){let e=window.scrollY,l=0,o=null,a=()=>{let c=window.scrollY,w=c-e;e=c,l=w||l*.8,Math.abs(l)<.01&&(l=0);let t=chunk65MXZJBD_cjs.a(l);r.write("scroll-velocity",t),r.write("scroll-direction",Math.sign(t)),t===0&&o&&(o(),o=null);},m=()=>{o||(o=chunkEYDIF3NM_cjs.c(a));};r.write("scroll-velocity",0),r.write("scroll-direction",0);let p=chunkQHHF5SEL_cjs.a("scroll",m);return ()=>{p(),o?.();}}};exports.a=u;
1
+ 'use strict';var chunkEYDIF3NM_cjs=require('./chunk-EYDIF3NM.cjs'),chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkDRXR56P5_cjs=require('./chunk-DRXR56P5.cjs');var u={key:"scroll-velocity",scope:"global",start(r){let e=window.scrollY,l=0,o=null,a=()=>{let c=window.scrollY,w=c-e;e=c,l=w||l*.8,Math.abs(l)<.01&&(l=0);let t=chunk65MXZJBD_cjs.a(l);r.write("scroll-velocity",t),r.write("scroll-direction",Math.sign(t)),t===0&&o&&(o(),o=null);},m=()=>{o||(o=chunkEYDIF3NM_cjs.c(a));};r.write("scroll-velocity",0),r.write("scroll-direction",0);let p=chunkDRXR56P5_cjs.a("scroll",m);return ()=>{p(),o?.();}}};exports.a=u;
@@ -0,0 +1 @@
1
+ 'use strict';var chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs');var s={key:"random",scope:"element",gate:false,props:{random:{syntax:"<number>",initial:"0"},"random-2":{syntax:"<number>",initial:"0"},"random-3":{syntax:"<number>",initial:"0"}},start(n){let{randomSeed:t}=n.config,e=t===void 0?()=>Math.random():l(u(n.target,t));return n.write("random",chunk65MXZJBD_cjs.a(e()),"const"),n.write("random-2",chunk65MXZJBD_cjs.a(e()),"const"),n.write("random-3",chunk65MXZJBD_cjs.a(e()),"const"),()=>{}}};function l(n){let t=n|0;return ()=>{t=t+1831565813|0;let e=t^t>>>15;return e=Math.imul(e,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function u(n,t){let e=t>>>0^2166136261;for(let o=n;o;o=o.parentElement){let a=o.tagName;for(let r=0;r<a.length;r++)e=Math.imul(e^a.charCodeAt(r),16777619);let i=0;for(let r=o.previousElementSibling;r;r=r.previousElementSibling)i++;e=Math.imul(e^i,16777619);}return e>>>0}exports.a=s;
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-EEMKKLRF.js';var h={key:"pointer-local",scope:"element",start(t){let p=t.target;return a("pointermove",l=>{let r=l,o=p.getBoundingClientRect(),e=o.width>0?(r.clientX-o.left)/o.width:0,n=o.height>0?(r.clientY-o.top)/o.height:0,s=e>=0&&e<=1&&n>=0&&n<=1;t.write("local-pointer-x-ratio",a$1(e)),t.write("local-pointer-y-ratio",a$1(n)),t.write("local-pointer-inside",s?1:0);})}};export{h as a};
1
+ import {a as a$1}from'./chunk-T4N6AEOZ.js';import {a}from'./chunk-7KEBMJ3O.js';var h={key:"pointer-local",scope:"element",start(t){let p=t.target;return a("pointermove",l=>{let r=l,o=p.getBoundingClientRect(),e=o.width>0?(r.clientX-o.left)/o.width:0,n=o.height>0?(r.clientY-o.top)/o.height:0,s=e>=0&&e<=1&&n>=0&&n<=1;t.write("local-pointer-x-ratio",a$1(e)),t.write("local-pointer-y-ratio",a$1(n)),t.write("local-pointer-inside",s?1:0);})}};export{h as a};
@@ -1 +1 @@
1
- 'use strict';var chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkQHHF5SEL_cjs=require('./chunk-QHHF5SEL.cjs');var h={key:"pointer-local",scope:"element",start(t){let p=t.target;return chunkQHHF5SEL_cjs.a("pointermove",l=>{let r=l,o=p.getBoundingClientRect(),e=o.width>0?(r.clientX-o.left)/o.width:0,n=o.height>0?(r.clientY-o.top)/o.height:0,s=e>=0&&e<=1&&n>=0&&n<=1;t.write("local-pointer-x-ratio",chunk65MXZJBD_cjs.a(e)),t.write("local-pointer-y-ratio",chunk65MXZJBD_cjs.a(n)),t.write("local-pointer-inside",s?1:0);})}};exports.a=h;
1
+ 'use strict';var chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunkDRXR56P5_cjs=require('./chunk-DRXR56P5.cjs');var h={key:"pointer-local",scope:"element",start(t){let p=t.target;return chunkDRXR56P5_cjs.a("pointermove",l=>{let r=l,o=p.getBoundingClientRect(),e=o.width>0?(r.clientX-o.left)/o.width:0,n=o.height>0?(r.clientY-o.top)/o.height:0,s=e>=0&&e<=1&&n>=0&&n<=1;t.write("local-pointer-x-ratio",chunk65MXZJBD_cjs.a(e)),t.write("local-pointer-y-ratio",chunk65MXZJBD_cjs.a(n)),t.write("local-pointer-inside",s?1:0);})}};exports.a=h;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkOVCZMPYV_cjs=require('./chunk-OVCZMPYV.cjs');require('./chunk-PQVNJZUW.cjs'),require('./chunk-HHINWX7L.cjs');var chunkEYDIF3NM_cjs=require('./chunk-EYDIF3NM.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-7L35N3N3.cjs'),require('./chunk-QHHF5SEL.cjs');Object.defineProperty(exports,"configure",{enumerable:true,get:function(){return chunkOVCZMPYV_cjs.d}});Object.defineProperty(exports,"isRegistered",{enumerable:true,get:function(){return chunkOVCZMPYV_cjs.c}});Object.defineProperty(exports,"propsFor",{enumerable:true,get:function(){return chunkOVCZMPYV_cjs.e}});Object.defineProperty(exports,"register",{enumerable:true,get:function(){return chunkOVCZMPYV_cjs.a}});Object.defineProperty(exports,"reset",{enumerable:true,get:function(){return chunkOVCZMPYV_cjs.g}});Object.defineProperty(exports,"unbind",{enumerable:true,get:function(){return chunkOVCZMPYV_cjs.f}});Object.defineProperty(exports,"unregister",{enumerable:true,get:function(){return chunkOVCZMPYV_cjs.b}});Object.defineProperty(exports,"pause",{enumerable:true,get:function(){return chunkEYDIF3NM_cjs.d}});Object.defineProperty(exports,"resume",{enumerable:true,get:function(){return chunkEYDIF3NM_cjs.e}});
1
+ 'use strict';var chunk5PU4B3GP_cjs=require('./chunk-5PU4B3GP.cjs');require('./chunk-DFWBYWE3.cjs'),require('./chunk-HHINWX7L.cjs');var chunkEYDIF3NM_cjs=require('./chunk-EYDIF3NM.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-7L35N3N3.cjs'),require('./chunk-DRXR56P5.cjs');Object.defineProperty(exports,"configure",{enumerable:true,get:function(){return chunk5PU4B3GP_cjs.d}});Object.defineProperty(exports,"isRegistered",{enumerable:true,get:function(){return chunk5PU4B3GP_cjs.c}});Object.defineProperty(exports,"propsFor",{enumerable:true,get:function(){return chunk5PU4B3GP_cjs.e}});Object.defineProperty(exports,"register",{enumerable:true,get:function(){return chunk5PU4B3GP_cjs.a}});Object.defineProperty(exports,"reset",{enumerable:true,get:function(){return chunk5PU4B3GP_cjs.g}});Object.defineProperty(exports,"unbind",{enumerable:true,get:function(){return chunk5PU4B3GP_cjs.f}});Object.defineProperty(exports,"unregister",{enumerable:true,get:function(){return chunk5PU4B3GP_cjs.b}});Object.defineProperty(exports,"pause",{enumerable:true,get:function(){return chunkEYDIF3NM_cjs.d}});Object.defineProperty(exports,"resume",{enumerable:true,get:function(){return chunkEYDIF3NM_cjs.e}});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as Config, D as Disposer, S as Source } from './types-CudiAlDE.cjs';
2
- export { C as Cadence, P as PropSpec, b as SourceContext } from './types-CudiAlDE.cjs';
1
+ import { a as Config, D as Disposer, S as Source } from './types-CyGIcLOq.cjs';
2
+ export { C as Cadence, P as PropSpec, b as SourceContext } from './types-CyGIcLOq.cjs';
3
3
 
4
4
  /** Freeze the loop: no sampling, no flushing, until `resume()`. Idempotent. */
5
5
  declare function pause(): void;
@@ -9,6 +9,25 @@ declare function resume(): void;
9
9
  type CoreKey = 'viewport' | 'size' | 'visibility' | 'range';
10
10
  /** Built-in keys autocomplete; any registered/plugin key (a string) is allowed. */
11
11
  type SourceKey = CoreKey | (string & {});
12
+ /** Options for the element-targeted `propsFor`. */
13
+ interface PropsForOptions {
14
+ /**
15
+ * Write this binding's properties on an **ancestor** instead of the bound
16
+ * element — a selector resolved with `el.closest()`, or an explicit element.
17
+ * The bound element is still the one observed.
18
+ *
19
+ * Custom properties inherit downward only, and `@container style()` matches
20
+ * against an *ancestor*, so an element can neither style-query nor share the
21
+ * values written on itself. Hoisting to a wrapper is what lets the element's
22
+ * siblings — and the element itself — react to them.
23
+ *
24
+ * No `closest()` match warns and falls back to the element itself; `to` on a
25
+ * `global` source warns and is ignored. Keep it to **one binding per key per
26
+ * target**: two elements hoisting the same key to one ancestor overwrite each
27
+ * other (dev-time warning).
28
+ */
29
+ to?: Element | string;
30
+ }
12
31
  /** Register a custom or plugin source so it can be used by key. */
13
32
  declare function register(source: Source): void;
14
33
  /** Remove a previously registered source key. */
@@ -25,15 +44,20 @@ declare function configure(opts: Partial<Config>): void;
25
44
  * propsFor(el, ['size']) // → el
26
45
  * propsFor(els, ['visibility']) // → each element in a NodeList / array
27
46
  *
47
+ * `opts.to` hoists the writes to an ancestor (selector or element) while still
48
+ * observing the bound element, so siblings can read the values:
49
+ *
50
+ * propsFor(img, ['img'], { to: 'figure' })
51
+ *
28
52
  * Returns a disposer that tears down exactly what this call started and removes
29
53
  * the custom properties it wrote.
30
54
  */
31
55
  declare function propsFor(keys: SourceKey[]): Disposer;
32
- declare function propsFor(target: Element | NodeList | HTMLCollection | Element[], keys: SourceKey[]): Disposer;
56
+ declare function propsFor(target: Element | NodeList | HTMLCollection | Element[], keys: SourceKey[], opts?: PropsForOptions): Disposer;
33
57
  /** Detach specific keys from an element, or all of them. Removes written props. */
34
58
  declare function unbind(target: HTMLElement, keys?: string[]): void;
35
59
  /** Tear down every active binding (and, via ref-counting, the shared observers
36
60
  * and listeners they used). Useful for SPA route changes, HMR, and tests. */
37
61
  declare function reset(): void;
38
62
 
39
- export { Config, Disposer, Source, type SourceKey, configure, isRegistered, pause, propsFor, register, reset, resume, unbind, unregister };
63
+ export { Config, Disposer, type PropsForOptions, Source, type SourceKey, configure, isRegistered, pause, propsFor, register, reset, resume, unbind, unregister };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as Config, D as Disposer, S as Source } from './types-CudiAlDE.js';
2
- export { C as Cadence, P as PropSpec, b as SourceContext } from './types-CudiAlDE.js';
1
+ import { a as Config, D as Disposer, S as Source } from './types-CyGIcLOq.js';
2
+ export { C as Cadence, P as PropSpec, b as SourceContext } from './types-CyGIcLOq.js';
3
3
 
4
4
  /** Freeze the loop: no sampling, no flushing, until `resume()`. Idempotent. */
5
5
  declare function pause(): void;
@@ -9,6 +9,25 @@ declare function resume(): void;
9
9
  type CoreKey = 'viewport' | 'size' | 'visibility' | 'range';
10
10
  /** Built-in keys autocomplete; any registered/plugin key (a string) is allowed. */
11
11
  type SourceKey = CoreKey | (string & {});
12
+ /** Options for the element-targeted `propsFor`. */
13
+ interface PropsForOptions {
14
+ /**
15
+ * Write this binding's properties on an **ancestor** instead of the bound
16
+ * element — a selector resolved with `el.closest()`, or an explicit element.
17
+ * The bound element is still the one observed.
18
+ *
19
+ * Custom properties inherit downward only, and `@container style()` matches
20
+ * against an *ancestor*, so an element can neither style-query nor share the
21
+ * values written on itself. Hoisting to a wrapper is what lets the element's
22
+ * siblings — and the element itself — react to them.
23
+ *
24
+ * No `closest()` match warns and falls back to the element itself; `to` on a
25
+ * `global` source warns and is ignored. Keep it to **one binding per key per
26
+ * target**: two elements hoisting the same key to one ancestor overwrite each
27
+ * other (dev-time warning).
28
+ */
29
+ to?: Element | string;
30
+ }
12
31
  /** Register a custom or plugin source so it can be used by key. */
13
32
  declare function register(source: Source): void;
14
33
  /** Remove a previously registered source key. */
@@ -25,15 +44,20 @@ declare function configure(opts: Partial<Config>): void;
25
44
  * propsFor(el, ['size']) // → el
26
45
  * propsFor(els, ['visibility']) // → each element in a NodeList / array
27
46
  *
47
+ * `opts.to` hoists the writes to an ancestor (selector or element) while still
48
+ * observing the bound element, so siblings can read the values:
49
+ *
50
+ * propsFor(img, ['img'], { to: 'figure' })
51
+ *
28
52
  * Returns a disposer that tears down exactly what this call started and removes
29
53
  * the custom properties it wrote.
30
54
  */
31
55
  declare function propsFor(keys: SourceKey[]): Disposer;
32
- declare function propsFor(target: Element | NodeList | HTMLCollection | Element[], keys: SourceKey[]): Disposer;
56
+ declare function propsFor(target: Element | NodeList | HTMLCollection | Element[], keys: SourceKey[], opts?: PropsForOptions): Disposer;
33
57
  /** Detach specific keys from an element, or all of them. Removes written props. */
34
58
  declare function unbind(target: HTMLElement, keys?: string[]): void;
35
59
  /** Tear down every active binding (and, via ref-counting, the shared observers
36
60
  * and listeners they used). Useful for SPA route changes, HMR, and tests. */
37
61
  declare function reset(): void;
38
62
 
39
- export { Config, Disposer, Source, type SourceKey, configure, isRegistered, pause, propsFor, register, reset, resume, unbind, unregister };
63
+ export { Config, Disposer, type PropsForOptions, Source, type SourceKey, configure, isRegistered, pause, propsFor, register, reset, resume, unbind, unregister };
@@ -1 +1 @@
1
- var PropForThat=(function(exports){'use strict';var c={livePrefix:"--live-",constPrefix:"--const-",root:typeof document<"u"?document.documentElement:void 0,typed:false};var S=new Set,I=null,u=0,C=false,d=false,R=0,M=false,k=()=>typeof requestAnimationFrame=="function";function T(e){if(u=0,d)return;let t=c.liveHz;if(k()&&t&&t>0&&e-R<1e3/t){(S.size||M)&&(u=requestAnimationFrame(T));return}if(R=e,C=true,S.size)for(let n of S)n(e);M=false,I?.(),C=false,S.size&&k()&&z();}function z(){u||C||d||(k()?u=requestAnimationFrame(T):T(0));}function P(){M=true,z();}function O(e){I=e;}function A(){d||(d=true,u&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(u),u=0);}function W(){d&&(d=false,z());}typeof document<"u"&&typeof document.addEventListener=="function"&&document.addEventListener("visibilitychange",()=>{document.hidden?A():W();});var l;function Q(){if(l!==void 0||(l=null,typeof document>"u"||typeof CSSStyleSheet!="function"||!("adoptedStyleSheets"in document)))return l;try{let e=new CSSStyleSheet;e.replaceSync(":root{}"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],l=e.cssRules[0].style;}catch{l=null;}return l}function v(e){if(typeof document<"u"&&e===document.documentElement){let t=Q();if(t)return t}return e.style}var H=class{pending=new Map;last=new WeakMap;set(t,n,r){let o=this.pending.get(t);if(o?.has(n)){o.set(n,r);return}this.last.get(t)?.get(n)!==r&&(o?o.set(n,r):this.pending.set(t,new Map([[n,r]])),P());}forget(t,n){this.last.get(t)?.delete(n);let r=this.pending.get(t);r&&(r.delete(n),r.size===0&&this.pending.delete(t));}flush=()=>{if(this.pending.size!==0){for(let[t,n]of this.pending){let r=this.last.get(t);r||this.last.set(t,r=new Map);let o=v(t);for(let[i,s]of n)r.get(i)!==s&&(o.setProperty(i,s),r.set(i,s));}this.pending.clear();}}},h=new H;O(h.flush);var w,y=new WeakMap,K=new WeakMap;function B(e,t){w||(w=new ResizeObserver(o=>{for(let i of o){K.set(i.target,i);let s=y.get(i.target);if(s)for(let f of [...s])f(i);}}));let n=y.get(e);n||(y.set(e,n=new Set),w.observe(e)),n.add(t);let r=K.get(e);return r&&t(r),()=>{let o=y.get(e);o&&(o.delete(t),o.size===0&&(y.delete(e),w.unobserve(e)));}}var b,g=new WeakMap,q=new WeakMap,X=[0,.98,.99,.995,.999,1];function E(e,t){b||(b=new IntersectionObserver(o=>{for(let i of o){q.set(i.target,i);let s=g.get(i.target);if(s)for(let f of [...s])f(i);}},{threshold:X}));let n=g.get(e);n||(g.set(e,n=new Set),b.observe(e)),n.add(t);let r=q.get(e);return r&&t(r),()=>{let o=g.get(e);o&&(o.delete(t),o.size===0&&(g.delete(e),b.unobserve(e)));}}var N=new Set;function V(e,t,n){if(N.has(e)||typeof CSS>"u"||typeof CSS.registerProperty!="function")return;N.add(e);let r=t?n?.[t]:void 0,o=t?c.defaults?.[t]:void 0;try{CSS.registerProperty({name:e,syntax:r?.syntax??"<number>",inherits:r?.inherits??!0,initialValue:o!=null?String(o):r?.initial??"0"});}catch{}}var F=new Map;function $(e,t){let n=F.get(e);if(!n){let r=new Set,o=i=>{for(let s of [...r])s(i);};n={handlers:r,dispatch:o},F.set(e,n),window.addEventListener(e,o,{passive:true});}return n.handlers.add(t),()=>{n.handlers.delete(t),n.handlers.size===0&&(window.removeEventListener(e,n.dispatch),F.delete(e));}}var _={key:"viewport",scope:"global",start(e){let t=()=>{e.write("vw",window.innerWidth),e.write("vh",window.innerHeight);};return t(),$("resize",t)}};function a(e){return Math.round(e*1e4)/1e4}var j={key:"size",scope:"element",start(e){return B(e.target,t=>{let n=t.borderBoxSize?.[0],r=n?n.inlineSize:t.contentRect.width,o=n?n.blockSize:t.contentRect.height;e.write("w",a(r)),e.write("h",a(o)),e.write("aspect",o>0?a(r/o):0);})}};var x=1;function Z(e){let t=e.rootBounds;if(!t)return e.intersectionRatio>=1;let n=e.boundingClientRect;return n.top>=t.top-x&&n.right<=t.right+x&&n.bottom<=t.bottom+x&&n.left>=t.left-x}var G={key:"visibility",scope:"element",gate:false,start(e){let t=false;return e.write("visible",0),e.write("has-entered",0,"const"),E(e.target,n=>{let r=Z(n);e.write("visible",r?1:0),r&&!t&&(t=true,e.write("has-entered",1,"const"));})}};function U(e,t){return e.matches(t)?e:e.querySelector(t)}var Y={key:"range",scope:"element",gate:false,start(e){let t=U(e.target,'input[type="range"], input[type="number"]');if(!t)return ()=>{};let n=()=>{let r=t.min===""?0:Number(t.min),o=t.max===""?100:Number(t.max),i=Number(t.value);e.write("value",i),e.write("value-pct",o>r?a((i-r)/(o-r)):0);};return n(),t.addEventListener("input",n,{passive:true}),()=>t.removeEventListener("input",n)}};var J={viewport:_,size:j,visibility:G,range:Y};var ee=()=>{},p=new Map,L={...J};function Be(e){L[e.key]=e;}function Ne(e){delete L[e];}function Ve(e){return e in L}function $e(e){Object.assign(c,e);}function te(e,t,n){return {target:e,config:c,write(r,o,i="live"){let s=(i==="const"?c.constPrefix:c.livePrefix)+r;t.add(s),c.typed&&V(s,r,n),h.set(e,s,String(o));}}}function ne(e,t,n){if(!(e.scope==="element"&&e.gate!==false&&n!==c.root&&typeof IntersectionObserver<"u"))return e.start(t);let o=null,i=()=>{if(!o)try{o=e.start(t);}catch(m){console.error(`[prop-for-that] source "${e.key}" failed to start`,m);}},s=()=>{o?.(),o=null;},f=E(n,m=>{m.isIntersecting?i():s();});return ()=>{f(),s();}}function D(e,t,n){let r=n.get(t);if(!r)return;r.dispose();let o=v(e);for(let i of r.written)o.removeProperty(i),h.forget(e,i);n.delete(t);}function re(e,t){let n=p.get(e);n||p.set(e,n=new Map);let r=[];for(let o of t){if(n.has(o))continue;let i=L[o];if(!i){console.warn(`[prop-for-that] unknown source "${o}"`);continue}let s=new Set,f;try{f=ne(i,te(e,s,i.props),e);}catch(m){console.error(`[prop-for-that] source "${o}" failed to start`,m);continue}n.set(o,{dispose:f,written:s}),r.push(o);}return ()=>{let o=p.get(e);if(o){for(let i of r)D(e,i,o);o.size===0&&p.delete(e);}}}function oe(e){return e instanceof Element?[e]:typeof NodeList<"u"&&e instanceof NodeList||typeof HTMLCollection<"u"&&e instanceof HTMLCollection||Array.isArray(e)?Array.from(e).filter(t=>t instanceof Element):[]}function ie(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="string")}function _e(e,t){let n,r;if(t===void 0&&ie(e)?(n=c.root?[c.root]:[],r=e):(n=oe(e),r=t??[]),!n.length||!r.length)return ee;let o=n.map(i=>re(i,r));return ()=>{for(let i of o)i();}}function je(e,t){let n=p.get(e);if(n){for(let r of t??[...n.keys()])D(e,r,n);n.size===0&&p.delete(e);}}function Ge(){for(let[e,t]of p)for(let n of [...t.keys()])D(e,n,t);p.clear();}exports.configure=$e;exports.isRegistered=Ve;exports.pause=A;exports.propsFor=_e;exports.register=Be;exports.reset=Ge;exports.resume=W;exports.unbind=je;exports.unregister=Ne;return exports;})({});
1
+ var PropForThat=(function(exports){'use strict';var p={livePrefix:"--live-",constPrefix:"--const-",root:typeof document<"u"?document.documentElement:void 0,typed:false};var v=new Set,W=null,a=0,C=false,m=false,O=0,k=false,H=()=>typeof requestAnimationFrame=="function";function F(e){if(a=0,m)return;let t=p.liveHz;if(H()&&t&&t>0&&e-O<1e3/t){(v.size||k)&&(a=requestAnimationFrame(F));return}if(O=e,C=true,v.size)for(let n of v)n(e);k=false,W?.(),C=false,v.size&&H()&&z();}function z(){a||C||m||(H()?a=requestAnimationFrame(F):F(0));}function A(){k=true,z();}function K(e){W=e;}function q(){m||(m=true,a&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a),a=0);}function $(){m&&(m=false,z());}typeof document<"u"&&typeof document.addEventListener=="function"&&document.addEventListener("visibilitychange",()=>{document.hidden?q():$();});var d;function te(){if(d!==void 0||(d=null,typeof document>"u"||typeof CSSStyleSheet!="function"||!("adoptedStyleSheets"in document)))return d;try{let e=new CSSStyleSheet;e.replaceSync(":root{}"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],d=e.cssRules[0].style;}catch{d=null;}return d}function w(e){if(typeof document<"u"&&e===document.documentElement){let t=te();if(t)return t}return e.style}var D=class{pending=new Map;last=new WeakMap;set(t,n,r){let o=this.pending.get(t);if(o?.has(n)){o.set(n,r);return}this.last.get(t)?.get(n)!==r&&(o?o.set(n,r):this.pending.set(t,new Map([[n,r]])),A());}forget(t,n){this.last.get(t)?.delete(n);let r=this.pending.get(t);r&&(r.delete(n),r.size===0&&this.pending.delete(t));}flush=()=>{if(this.pending.size!==0){for(let[t,n]of this.pending){let r=this.last.get(t);r||this.last.set(t,r=new Map);let o=w(t);for(let[s,i]of n)r.get(s)!==i&&(o.setProperty(s,i),r.set(s,i));}this.pending.clear();}}},E=new D;K(E.flush);var b,S=new WeakMap,B=new WeakMap;function _(e,t){b||(b=new ResizeObserver(o=>{for(let s of o){B.set(s.target,s);let i=S.get(s.target);if(i)for(let f of i)f(s);}}));let n=S.get(e);n||(S.set(e,n=new Set),b.observe(e)),n.add(t);let r=B.get(e);return r&&t(r),()=>{let o=S.get(e);o&&(o.delete(t),o.size===0&&(S.delete(e),b.unobserve(e)));}}var M,h=new WeakMap,V=new WeakMap,ne=[0,.98,.99,.995,.999,1];function L(e,t){M||(M=new IntersectionObserver(o=>{for(let s of o){V.set(s.target,s);let i=h.get(s.target);if(i)for(let f of i)f(s);}},{threshold:ne}));let n=h.get(e);n||(h.set(e,n=new Set),M.observe(e)),n.add(t);let r=V.get(e);return r&&t(r),()=>{let o=h.get(e);o&&(o.delete(t),o.size===0&&(h.delete(e),M.unobserve(e)));}}var j=new Set;function G(e,t,n){if(j.has(e)||typeof CSS>"u"||typeof CSS.registerProperty!="function")return;j.add(e);let r=t?n?.[t]:void 0,o=t?p.defaults?.[t]:void 0;try{CSS.registerProperty({name:e,syntax:r?.syntax??"<number>",inherits:r?.inherits??!0,initialValue:o!=null?String(o):r?.initial??"0"});}catch{}}var R=new Map;function N(e,t){let n=R.get(e);if(!n){let r=new Set,o=s=>{for(let i of r)i(s);};n={handlers:r,dispatch:o},R.set(e,n),window.addEventListener(e,o,{passive:true});}return n.handlers.add(t),()=>{n.handlers.delete(t),n.handlers.size===0&&(window.removeEventListener(e,n.dispatch),R.delete(e));}}var U={key:"viewport",scope:"global",start(e){let t=()=>{e.write("vw",window.innerWidth),e.write("vh",window.innerHeight);};return t(),N("resize",t)}};function g(e){return Math.round(e*1e4)/1e4}var Y={key:"size",scope:"element",start(e){return _(e.target,t=>{let n=t.borderBoxSize?.[0],r=n?n.inlineSize:t.contentRect.width,o=n?n.blockSize:t.contentRect.height;e.write("w",g(r)),e.write("h",g(o)),e.write("aspect",o>0?g(r/o):0);})}};var T=1;function re(e){let t=e.rootBounds;if(!t)return e.intersectionRatio>=1;let n=e.boundingClientRect;return n.top>=t.top-T&&n.right<=t.right+T&&n.bottom<=t.bottom+T&&n.left>=t.left-T}var J={key:"visibility",scope:"element",gate:false,start(e){let t=false;return e.write("visible",0),e.write("has-entered",0,"const"),L(e.target,n=>{let r=re(n);e.write("visible",r?1:0),r&&!t&&(t=true,e.write("has-entered",1,"const"));})}};function Q(e,t){return e.matches(t)?e:e.querySelector(t)}var X={key:"range",scope:"element",gate:false,start(e){let t=Q(e.target,'input[type="range"], input[type="number"]');if(!t)return ()=>{};let n=()=>{let r=t.min===""?0:Number(t.min),o=t.max===""?100:Number(t.max),s=Number(t.value);e.write("value",s),e.write("value-pct",o>r?g((s-r)/(o-r)):0);};return n(),t.addEventListener("input",n,{passive:true}),()=>t.removeEventListener("input",n)}};var Z={viewport:U,size:Y,visibility:J,range:X};var oe=()=>{},l=new Map,I=new WeakMap,x={...Z};function Ne(e){x[e.key]=e;}function Ue(e){delete x[e];}function Ye(e){return e in x}function Je(e){Object.assign(p,e);}function ie(e,t,n,r){let o={live:new Map,const:new Map};return {target:e,config:p,write(s,i,f="live"){let c=o[f],u=c.get(s);if(u){if(u.raw===i)return;u.raw=i;}else {let y=(f==="const"?p.constPrefix:p.livePrefix)+s;c.set(s,u={raw:i,prop:y}),n.add(y);}p.typed&&G(u.prop,s,r),E.set(t,u.prop,String(i));}}}function se(e,t,n){if(!(e.scope==="element"&&e.gate!==false&&n!==p.root&&typeof IntersectionObserver<"u"))return e.start(t);let o=null,s=()=>{if(!o)try{o=e.start(t);}catch(c){console.error(`[prop-for-that] source "${e.key}" failed to start`,c);}},i=()=>{o?.(),o=null;},f=L(n,c=>{c.isIntersecting?s():i();});return ()=>{f(),i();}}function P(e,t,n){let r=n.get(t);if(!r)return;r.dispose();let{writeTarget:o}=r,s=w(o);for(let i of r.written)s.removeProperty(i),E.forget(o,i);o!==e&&I.get(o)?.delete(t),n.delete(t);}function fe(e,t){if(typeof t!="string")return t;let n=e.closest(t);return n||(console.warn(`[prop-for-that] no ancestor matches "${t}" \u2014 writing on the element itself`),e)}function ce(e,t){let n=I.get(e);n||I.set(e,n=new Set),n.has(t)&&console.warn(`[prop-for-that] "${t}" is already hoisted onto this element \u2014 the bindings will overwrite each other`,e),n.add(t);}function pe(e,t,n){let r=l.get(e);r||l.set(e,r=new Map);let o=n?fe(e,n):e,s=[];for(let i of t){if(r.has(i))continue;let f=x[i];if(!f){console.warn(`[prop-for-that] unknown source "${i}"`);continue}let c=o;c!==e&&f.scope==="global"&&(console.warn(`[prop-for-that] "to" ignored for global source "${i}"`),c=e);let u=new Set,y;try{y=se(f,ie(e,c,u,f.props),e);}catch(ee){console.error(`[prop-for-that] source "${i}" failed to start`,ee);continue}c!==e&&ce(c,i),r.set(i,{dispose:y,written:u,writeTarget:c}),s.push(i);}return ()=>{let i=l.get(e);if(i){for(let f of s)P(e,f,i);i.size===0&&l.delete(e);}}}function ue(e){return e instanceof Element?[e]:typeof NodeList<"u"&&e instanceof NodeList||typeof HTMLCollection<"u"&&e instanceof HTMLCollection||Array.isArray(e)?Array.from(e).filter(t=>t instanceof Element):[]}function le(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="string")}function Qe(e,t,n){let r,o;if(t===void 0&&le(e)?(r=p.root?[p.root]:[],o=e):(r=ue(e),o=t??[]),!r.length||!o.length)return oe;let s=r.map(i=>pe(i,o,n?.to));return ()=>{for(let i of s)i();}}function Xe(e,t){let n=l.get(e);if(n){for(let r of t??[...n.keys()])P(e,r,n);n.size===0&&l.delete(e);}}function Ze(){for(let[e,t]of l)for(let n of [...t.keys()])P(e,n,t);l.clear();}exports.configure=Je;exports.isRegistered=Ye;exports.pause=q;exports.propsFor=Qe;exports.register=Ne;exports.reset=Ze;exports.resume=$;exports.unbind=Xe;exports.unregister=Ue;return exports;})({});
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{d as configure,c as isRegistered,e as propsFor,a as register,g as reset,f as unbind,b as unregister}from'./chunk-D24E2DBW.js';import'./chunk-V4OTPLOQ.js';import'./chunk-LTJ2VKVY.js';export{d as pause,e as resume}from'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import'./chunk-EEMKKLRF.js';
1
+ export{d as configure,c as isRegistered,e as propsFor,a as register,g as reset,f as unbind,b as unregister}from'./chunk-N3F2LRDI.js';import'./chunk-6234NJTF.js';import'./chunk-LTJ2VKVY.js';export{d as pause,e as resume}from'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import'./chunk-7KEBMJ3O.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkKHBJUHJ6_cjs=require('./chunk-KHBJUHJ6.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-DRXR56P5.cjs');Object.defineProperty(exports,"motion",{enumerable:true,get:function(){return chunkKHBJUHJ6_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as motion}from'./chunk-HTO57OQP.js';import'./chunk-T4N6AEOZ.js';import'./chunk-7KEBMJ3O.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunk4R63TNNO_cjs=require('./chunk-4R63TNNO.cjs');require('./chunk-DRXR56P5.cjs');Object.defineProperty(exports,"online",{enumerable:true,get:function(){return chunk4R63TNNO_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as online}from'./chunk-2SIGTGQE.js';import'./chunk-7KEBMJ3O.js';
@@ -0,0 +1 @@
1
+ export{a as orientation}from'./chunk-N745RQIX.js';import'./chunk-T4N6AEOZ.js';import'./chunk-7KEBMJ3O.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunk7LN34C3P_cjs=require('./chunk-7LN34C3P.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-DRXR56P5.cjs');Object.defineProperty(exports,"orientation",{enumerable:true,get:function(){return chunk7LN34C3P_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as pageFocused}from'./chunk-2NMXY7T4.js';import'./chunk-7KEBMJ3O.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkBF7D5A5Z_cjs=require('./chunk-BF7D5A5Z.cjs');require('./chunk-DRXR56P5.cjs');Object.defineProperty(exports,"pageFocused",{enumerable:true,get:function(){return chunkBF7D5A5Z_cjs.a}});
@@ -0,0 +1 @@
1
+ 'use strict';var chunkJI7NXES2_cjs=require('./chunk-JI7NXES2.cjs');Object.defineProperty(exports,"pageVisible",{enumerable:true,get:function(){return chunkJI7NXES2_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as pageVisible}from'./chunk-IFIWYBMP.js';
package/dist/plugins.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunk3QHCKCTX_cjs=require('./chunk-3QHCKCTX.cjs'),chunkHTKGZP36_cjs=require('./chunk-HTKGZP36.cjs'),chunkG2BOTBBH_cjs=require('./chunk-G2BOTBBH.cjs'),chunkUALPUR2L_cjs=require('./chunk-UALPUR2L.cjs'),chunk2H5YFW6O_cjs=require('./chunk-2H5YFW6O.cjs'),chunk2YHGSLQQ_cjs=require('./chunk-2YHGSLQQ.cjs'),chunkFKBHTKZH_cjs=require('./chunk-FKBHTKZH.cjs'),chunkHYVT6V4Z_cjs=require('./chunk-HYVT6V4Z.cjs'),chunk37L73RJL_cjs=require('./chunk-37L73RJL.cjs'),chunk3W7CXUWN_cjs=require('./chunk-3W7CXUWN.cjs'),chunkSYKMPPTY_cjs=require('./chunk-SYKMPPTY.cjs'),chunk63C3RCO2_cjs=require('./chunk-63C3RCO2.cjs'),chunkFZYB3P7L_cjs=require('./chunk-FZYB3P7L.cjs'),chunkIIQP3BYA_cjs=require('./chunk-IIQP3BYA.cjs'),chunkQFJ6SZ2H_cjs=require('./chunk-QFJ6SZ2H.cjs');require('./chunk-L4SCOKPV.cjs');var chunkODPCQAKC_cjs=require('./chunk-ODPCQAKC.cjs'),chunk3REDV2FZ_cjs=require('./chunk-3REDV2FZ.cjs');require('./chunk-A6JDSQWH.cjs');var chunkMGZTR3X6_cjs=require('./chunk-MGZTR3X6.cjs'),chunkK2YWGXLP_cjs=require('./chunk-K2YWGXLP.cjs'),chunkRT47EE2L_cjs=require('./chunk-RT47EE2L.cjs'),chunk7CDVAP3H_cjs=require('./chunk-7CDVAP3H.cjs'),chunk6LTQ7ISE_cjs=require('./chunk-6LTQ7ISE.cjs'),chunk2OYRAOTM_cjs=require('./chunk-2OYRAOTM.cjs'),chunkXQOUJEVE_cjs=require('./chunk-XQOUJEVE.cjs'),chunkIPYBSM34_cjs=require('./chunk-IPYBSM34.cjs'),chunkOVCZMPYV_cjs=require('./chunk-OVCZMPYV.cjs');require('./chunk-PQVNJZUW.cjs'),require('./chunk-HHINWX7L.cjs'),require('./chunk-KSKAQMWJ.cjs');var chunkLP3QQ33O_cjs=require('./chunk-LP3QQ33O.cjs');require('./chunk-EYDIF3NM.cjs'),require('./chunk-65MXZJBD.cjs'),require('./chunk-7L35N3N3.cjs');var chunkOVF4XN2H_cjs=require('./chunk-OVF4XN2H.cjs'),chunkWIPJMLJJ_cjs=require('./chunk-WIPJMLJJ.cjs');require('./chunk-QHHF5SEL.cjs');var chunk3MK6Q7DX_cjs=require('./chunk-3MK6Q7DX.cjs');var q=[chunkLP3QQ33O_cjs.a,chunkOVF4XN2H_cjs.a,chunkWIPJMLJJ_cjs.a,chunk3MK6Q7DX_cjs.a,chunkMGZTR3X6_cjs.a,chunkK2YWGXLP_cjs.a,chunkRT47EE2L_cjs.b,chunk7CDVAP3H_cjs.a,chunk6LTQ7ISE_cjs.a,chunk2OYRAOTM_cjs.a,chunkXQOUJEVE_cjs.a,chunkIPYBSM34_cjs.a,chunk3W7CXUWN_cjs.a,chunkSYKMPPTY_cjs.a,chunk63C3RCO2_cjs.a,chunkFZYB3P7L_cjs.a,chunkIIQP3BYA_cjs.a,chunkQFJ6SZ2H_cjs.a,chunkODPCQAKC_cjs.a,chunk3REDV2FZ_cjs.a,chunkHTKGZP36_cjs.a,chunkG2BOTBBH_cjs.a,chunkUALPUR2L_cjs.a,chunk2H5YFW6O_cjs.a,chunk2YHGSLQQ_cjs.a,chunkFKBHTKZH_cjs.a,chunkHYVT6V4Z_cjs.a,chunk37L73RJL_cjs.a,chunk3QHCKCTX_cjs.a];function no(...o){for(let j of o.length?o:q)chunkOVCZMPYV_cjs.a(j);}Object.defineProperty(exports,"ua",{enumerable:true,get:function(){return chunk3QHCKCTX_cjs.a}});Object.defineProperty(exports,"orientation",{enumerable:true,get:function(){return chunkHTKGZP36_cjs.a}});Object.defineProperty(exports,"motion",{enumerable:true,get:function(){return chunkG2BOTBBH_cjs.a}});Object.defineProperty(exports,"geo",{enumerable:true,get:function(){return chunkUALPUR2L_cjs.a}});Object.defineProperty(exports,"cpuPressure",{enumerable:true,get:function(){return chunk2H5YFW6O_cjs.a}});Object.defineProperty(exports,"img",{enumerable:true,get:function(){return chunk2YHGSLQQ_cjs.a}});Object.defineProperty(exports,"imgColor",{enumerable:true,get:function(){return chunkFKBHTKZH_cjs.a}});Object.defineProperty(exports,"videoColor",{enumerable:true,get:function(){return chunkHYVT6V4Z_cjs.a}});Object.defineProperty(exports,"truncated",{enumerable:true,get:function(){return chunk37L73RJL_cjs.a}});Object.defineProperty(exports,"pointer",{enumerable:true,get:function(){return chunk3W7CXUWN_cjs.a}});Object.defineProperty(exports,"pointerLocal",{enumerable:true,get:function(){return chunkSYKMPPTY_cjs.a}});Object.defineProperty(exports,"media",{enumerable:true,get:function(){return chunk63C3RCO2_cjs.a}});Object.defineProperty(exports,"field",{enumerable:true,get:function(){return chunkFZYB3P7L_cjs.a}});Object.defineProperty(exports,"fieldState",{enumerable:true,get:function(){return chunkIIQP3BYA_cjs.a}});Object.defineProperty(exports,"formState",{enumerable:true,get:function(){return chunkQFJ6SZ2H_cjs.a}});Object.defineProperty(exports,"select",{enumerable:true,get:function(){return chunkODPCQAKC_cjs.a}});Object.defineProperty(exports,"colorInput",{enumerable:true,get:function(){return chunk3REDV2FZ_cjs.a}});Object.defineProperty(exports,"navType",{enumerable:true,get:function(){return chunkMGZTR3X6_cjs.a}});Object.defineProperty(exports,"meta",{enumerable:true,get:function(){return chunkK2YWGXLP_cjs.a}});Object.defineProperty(exports,"network",{enumerable:true,get:function(){return chunkRT47EE2L_cjs.b}});Object.defineProperty(exports,"battery",{enumerable:true,get:function(){return chunk7CDVAP3H_cjs.a}});Object.defineProperty(exports,"clock",{enumerable:true,get:function(){return chunk6LTQ7ISE_cjs.a}});Object.defineProperty(exports,"fps",{enumerable:true,get:function(){return chunk2OYRAOTM_cjs.a}});Object.defineProperty(exports,"visualViewport",{enumerable:true,get:function(){return chunkXQOUJEVE_cjs.a}});Object.defineProperty(exports,"keyboard",{enumerable:true,get:function(){return chunkIPYBSM34_cjs.a}});Object.defineProperty(exports,"scrollVelocity",{enumerable:true,get:function(){return chunkLP3QQ33O_cjs.a}});Object.defineProperty(exports,"online",{enumerable:true,get:function(){return chunkOVF4XN2H_cjs.a}});Object.defineProperty(exports,"pageFocused",{enumerable:true,get:function(){return chunkWIPJMLJJ_cjs.a}});Object.defineProperty(exports,"pageVisible",{enumerable:true,get:function(){return chunk3MK6Q7DX_cjs.a}});exports.allPlugins=q;exports.registerPlugins=no;
1
+ 'use strict';var chunk3QHCKCTX_cjs=require('./chunk-3QHCKCTX.cjs'),chunkSRKAOAXW_cjs=require('./chunk-SRKAOAXW.cjs'),chunk7LN34C3P_cjs=require('./chunk-7LN34C3P.cjs'),chunkKHBJUHJ6_cjs=require('./chunk-KHBJUHJ6.cjs'),chunkUALPUR2L_cjs=require('./chunk-UALPUR2L.cjs'),chunk2H5YFW6O_cjs=require('./chunk-2H5YFW6O.cjs'),chunk2YHGSLQQ_cjs=require('./chunk-2YHGSLQQ.cjs'),chunkFKBHTKZH_cjs=require('./chunk-FKBHTKZH.cjs'),chunkHYVT6V4Z_cjs=require('./chunk-HYVT6V4Z.cjs'),chunk4C255WE6_cjs=require('./chunk-4C255WE6.cjs'),chunk675RBWFU_cjs=require('./chunk-675RBWFU.cjs'),chunkXMJ6YRQB_cjs=require('./chunk-XMJ6YRQB.cjs'),chunk63C3RCO2_cjs=require('./chunk-63C3RCO2.cjs'),chunkFZYB3P7L_cjs=require('./chunk-FZYB3P7L.cjs'),chunkIIQP3BYA_cjs=require('./chunk-IIQP3BYA.cjs'),chunkQFJ6SZ2H_cjs=require('./chunk-QFJ6SZ2H.cjs');require('./chunk-L4SCOKPV.cjs');var chunkODPCQAKC_cjs=require('./chunk-ODPCQAKC.cjs'),chunk3REDV2FZ_cjs=require('./chunk-3REDV2FZ.cjs');require('./chunk-A6JDSQWH.cjs');var chunkMGZTR3X6_cjs=require('./chunk-MGZTR3X6.cjs'),chunkK2YWGXLP_cjs=require('./chunk-K2YWGXLP.cjs'),chunkRT47EE2L_cjs=require('./chunk-RT47EE2L.cjs'),chunk7CDVAP3H_cjs=require('./chunk-7CDVAP3H.cjs'),chunk6LTQ7ISE_cjs=require('./chunk-6LTQ7ISE.cjs'),chunk2OYRAOTM_cjs=require('./chunk-2OYRAOTM.cjs'),chunkXQOUJEVE_cjs=require('./chunk-XQOUJEVE.cjs'),chunkIPYBSM34_cjs=require('./chunk-IPYBSM34.cjs'),chunk5PU4B3GP_cjs=require('./chunk-5PU4B3GP.cjs');require('./chunk-DFWBYWE3.cjs'),require('./chunk-HHINWX7L.cjs'),require('./chunk-KSKAQMWJ.cjs');var chunkRVZWUZQ2_cjs=require('./chunk-RVZWUZQ2.cjs');require('./chunk-EYDIF3NM.cjs'),require('./chunk-65MXZJBD.cjs'),require('./chunk-7L35N3N3.cjs');var chunk4R63TNNO_cjs=require('./chunk-4R63TNNO.cjs'),chunkBF7D5A5Z_cjs=require('./chunk-BF7D5A5Z.cjs');require('./chunk-DRXR56P5.cjs');var chunkJI7NXES2_cjs=require('./chunk-JI7NXES2.cjs');var z=[chunkRVZWUZQ2_cjs.a,chunk4R63TNNO_cjs.a,chunkBF7D5A5Z_cjs.a,chunkJI7NXES2_cjs.a,chunkMGZTR3X6_cjs.a,chunkK2YWGXLP_cjs.a,chunkRT47EE2L_cjs.b,chunk7CDVAP3H_cjs.a,chunk6LTQ7ISE_cjs.a,chunk2OYRAOTM_cjs.a,chunkXQOUJEVE_cjs.a,chunkIPYBSM34_cjs.a,chunk675RBWFU_cjs.a,chunkXMJ6YRQB_cjs.a,chunk63C3RCO2_cjs.a,chunkFZYB3P7L_cjs.a,chunkIIQP3BYA_cjs.a,chunkQFJ6SZ2H_cjs.a,chunkODPCQAKC_cjs.a,chunk3REDV2FZ_cjs.a,chunk7LN34C3P_cjs.a,chunkKHBJUHJ6_cjs.a,chunkUALPUR2L_cjs.a,chunk2H5YFW6O_cjs.a,chunk2YHGSLQQ_cjs.a,chunkFKBHTKZH_cjs.a,chunkHYVT6V4Z_cjs.a,chunk4C255WE6_cjs.a,chunk3QHCKCTX_cjs.a,chunkSRKAOAXW_cjs.a];function ao(...o){for(let q of o.length?o:z)chunk5PU4B3GP_cjs.a(q);}Object.defineProperty(exports,"ua",{enumerable:true,get:function(){return chunk3QHCKCTX_cjs.a}});Object.defineProperty(exports,"random",{enumerable:true,get:function(){return chunkSRKAOAXW_cjs.a}});Object.defineProperty(exports,"orientation",{enumerable:true,get:function(){return chunk7LN34C3P_cjs.a}});Object.defineProperty(exports,"motion",{enumerable:true,get:function(){return chunkKHBJUHJ6_cjs.a}});Object.defineProperty(exports,"geo",{enumerable:true,get:function(){return chunkUALPUR2L_cjs.a}});Object.defineProperty(exports,"cpuPressure",{enumerable:true,get:function(){return chunk2H5YFW6O_cjs.a}});Object.defineProperty(exports,"img",{enumerable:true,get:function(){return chunk2YHGSLQQ_cjs.a}});Object.defineProperty(exports,"imgColor",{enumerable:true,get:function(){return chunkFKBHTKZH_cjs.a}});Object.defineProperty(exports,"videoColor",{enumerable:true,get:function(){return chunkHYVT6V4Z_cjs.a}});Object.defineProperty(exports,"truncated",{enumerable:true,get:function(){return chunk4C255WE6_cjs.a}});Object.defineProperty(exports,"pointer",{enumerable:true,get:function(){return chunk675RBWFU_cjs.a}});Object.defineProperty(exports,"pointerLocal",{enumerable:true,get:function(){return chunkXMJ6YRQB_cjs.a}});Object.defineProperty(exports,"media",{enumerable:true,get:function(){return chunk63C3RCO2_cjs.a}});Object.defineProperty(exports,"field",{enumerable:true,get:function(){return chunkFZYB3P7L_cjs.a}});Object.defineProperty(exports,"fieldState",{enumerable:true,get:function(){return chunkIIQP3BYA_cjs.a}});Object.defineProperty(exports,"formState",{enumerable:true,get:function(){return chunkQFJ6SZ2H_cjs.a}});Object.defineProperty(exports,"select",{enumerable:true,get:function(){return chunkODPCQAKC_cjs.a}});Object.defineProperty(exports,"colorInput",{enumerable:true,get:function(){return chunk3REDV2FZ_cjs.a}});Object.defineProperty(exports,"navType",{enumerable:true,get:function(){return chunkMGZTR3X6_cjs.a}});Object.defineProperty(exports,"meta",{enumerable:true,get:function(){return chunkK2YWGXLP_cjs.a}});Object.defineProperty(exports,"network",{enumerable:true,get:function(){return chunkRT47EE2L_cjs.b}});Object.defineProperty(exports,"battery",{enumerable:true,get:function(){return chunk7CDVAP3H_cjs.a}});Object.defineProperty(exports,"clock",{enumerable:true,get:function(){return chunk6LTQ7ISE_cjs.a}});Object.defineProperty(exports,"fps",{enumerable:true,get:function(){return chunk2OYRAOTM_cjs.a}});Object.defineProperty(exports,"visualViewport",{enumerable:true,get:function(){return chunkXQOUJEVE_cjs.a}});Object.defineProperty(exports,"keyboard",{enumerable:true,get:function(){return chunkIPYBSM34_cjs.a}});Object.defineProperty(exports,"scrollVelocity",{enumerable:true,get:function(){return chunkRVZWUZQ2_cjs.a}});Object.defineProperty(exports,"online",{enumerable:true,get:function(){return chunk4R63TNNO_cjs.a}});Object.defineProperty(exports,"pageFocused",{enumerable:true,get:function(){return chunkBF7D5A5Z_cjs.a}});Object.defineProperty(exports,"pageVisible",{enumerable:true,get:function(){return chunkJI7NXES2_cjs.a}});exports.allPlugins=z;exports.registerPlugins=ao;
@@ -1,4 +1,4 @@
1
- import { S as Source } from './types-CudiAlDE.cjs';
1
+ import { S as Source } from './types-CyGIcLOq.cjs';
2
2
 
3
3
  /**
4
4
  * `--live-scroll-velocity` (signed px/frame, decays toward 0 when idle),
@@ -397,6 +397,38 @@ declare const truncated: Source;
397
397
  */
398
398
  declare const ua: Source;
399
399
 
400
+ /**
401
+ * Per-element randomness — the one value CSS genuinely can't produce for itself
402
+ * (until `random()` ships everywhere). Bind it to N elements and each gets its
403
+ * own rolls, written **once** on the `const` cadence:
404
+ *
405
+ * - `--const-random` — a float in `[0, 1)`
406
+ * - `--const-random-2`, `--const-random-3` — two more, independent of the first
407
+ *
408
+ * Three, because organic variation usually needs more than one axis (delay *and*
409
+ * rotation *and* scale) and CSS can't derive a second independent random from the
410
+ * first. Everything else *is* derivable, so it isn't shipped: an angle is
411
+ * `calc(var(--const-random) * 360deg)`, a coin flip
412
+ * `calc(sign(var(--const-random) - 0.5))`, a range
413
+ * `calc(A + (B - A) * var(--const-random))`, a bucket
414
+ * `round(down, calc(var(--const-random) * 5), 1)`.
415
+ *
416
+ * Stagger a grid without `:nth-child()` rules, jitter a scatter layout, vary a
417
+ * shimmer's duration per card — one binding, no per-element JS.
418
+ *
419
+ * **Never re-rolled.** It writes on the `const` cadence and sets `gate: false`,
420
+ * so — unlike a gated element source, whose `start` re-runs on every viewport
421
+ * re-entry — scrolling out of view and back can't hand an element a new value
422
+ * mid-animation.
423
+ *
424
+ * **Seeded (deterministic) mode:** `configure({ randomSeed: 42 })` derives every
425
+ * roll from the seed plus the element's position in the DOM, so the same markup
426
+ * renders the same "random" layout on every load, and a rebind hands an element
427
+ * the values it had before. Reordering the tree reshuffles it. Unseeded (the
428
+ * default) rolls come from `Math.random()`.
429
+ */
430
+ declare const random: Source;
431
+
400
432
  /** Every plugin source, for `registerPlugins()` / bulk registration. */
401
433
  declare const allPlugins: Source[];
402
434
  /**
@@ -409,4 +441,4 @@ declare const allPlugins: Source[];
409
441
  */
410
442
  declare function registerPlugins(...sources: Source[]): void;
411
443
 
412
- export { allPlugins, battery, clock, colorInput, cpuPressure, field, fieldState, formState, fps, geo, img, imgColor, keyboard, media, meta, motion, navType, network, online, orientation, pageFocused, pageVisible, pointer, pointerLocal, registerPlugins, scrollVelocity, select, truncated, ua, videoColor, visualViewport };
444
+ export { allPlugins, battery, clock, colorInput, cpuPressure, field, fieldState, formState, fps, geo, img, imgColor, keyboard, media, meta, motion, navType, network, online, orientation, pageFocused, pageVisible, pointer, pointerLocal, random, registerPlugins, scrollVelocity, select, truncated, ua, videoColor, visualViewport };
package/dist/plugins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as Source } from './types-CudiAlDE.js';
1
+ import { S as Source } from './types-CyGIcLOq.js';
2
2
 
3
3
  /**
4
4
  * `--live-scroll-velocity` (signed px/frame, decays toward 0 when idle),
@@ -397,6 +397,38 @@ declare const truncated: Source;
397
397
  */
398
398
  declare const ua: Source;
399
399
 
400
+ /**
401
+ * Per-element randomness — the one value CSS genuinely can't produce for itself
402
+ * (until `random()` ships everywhere). Bind it to N elements and each gets its
403
+ * own rolls, written **once** on the `const` cadence:
404
+ *
405
+ * - `--const-random` — a float in `[0, 1)`
406
+ * - `--const-random-2`, `--const-random-3` — two more, independent of the first
407
+ *
408
+ * Three, because organic variation usually needs more than one axis (delay *and*
409
+ * rotation *and* scale) and CSS can't derive a second independent random from the
410
+ * first. Everything else *is* derivable, so it isn't shipped: an angle is
411
+ * `calc(var(--const-random) * 360deg)`, a coin flip
412
+ * `calc(sign(var(--const-random) - 0.5))`, a range
413
+ * `calc(A + (B - A) * var(--const-random))`, a bucket
414
+ * `round(down, calc(var(--const-random) * 5), 1)`.
415
+ *
416
+ * Stagger a grid without `:nth-child()` rules, jitter a scatter layout, vary a
417
+ * shimmer's duration per card — one binding, no per-element JS.
418
+ *
419
+ * **Never re-rolled.** It writes on the `const` cadence and sets `gate: false`,
420
+ * so — unlike a gated element source, whose `start` re-runs on every viewport
421
+ * re-entry — scrolling out of view and back can't hand an element a new value
422
+ * mid-animation.
423
+ *
424
+ * **Seeded (deterministic) mode:** `configure({ randomSeed: 42 })` derives every
425
+ * roll from the seed plus the element's position in the DOM, so the same markup
426
+ * renders the same "random" layout on every load, and a rebind hands an element
427
+ * the values it had before. Reordering the tree reshuffles it. Unseeded (the
428
+ * default) rolls come from `Math.random()`.
429
+ */
430
+ declare const random: Source;
431
+
400
432
  /** Every plugin source, for `registerPlugins()` / bulk registration. */
401
433
  declare const allPlugins: Source[];
402
434
  /**
@@ -409,4 +441,4 @@ declare const allPlugins: Source[];
409
441
  */
410
442
  declare function registerPlugins(...sources: Source[]): void;
411
443
 
412
- export { allPlugins, battery, clock, colorInput, cpuPressure, field, fieldState, formState, fps, geo, img, imgColor, keyboard, media, meta, motion, navType, network, online, orientation, pageFocused, pageVisible, pointer, pointerLocal, registerPlugins, scrollVelocity, select, truncated, ua, videoColor, visualViewport };
444
+ export { allPlugins, battery, clock, colorInput, cpuPressure, field, fieldState, formState, fps, geo, img, imgColor, keyboard, media, meta, motion, navType, network, online, orientation, pageFocused, pageVisible, pointer, pointerLocal, random, registerPlugins, scrollVelocity, select, truncated, ua, videoColor, visualViewport };
package/dist/plugins.js CHANGED
@@ -1 +1 @@
1
- import {a as a$r}from'./chunk-5VXDAWUI.js';export{a as ua}from'./chunk-5VXDAWUI.js';import {a as a$j}from'./chunk-TRMZLMNW.js';export{a as orientation}from'./chunk-TRMZLMNW.js';import {a as a$k}from'./chunk-SKEEFKDT.js';export{a as motion}from'./chunk-SKEEFKDT.js';import {a as a$l}from'./chunk-FOHEZJHF.js';export{a as geo}from'./chunk-FOHEZJHF.js';import {a as a$m}from'./chunk-5JZBLUQK.js';export{a as cpuPressure}from'./chunk-5JZBLUQK.js';import {a as a$n}from'./chunk-YARRV66T.js';export{a as img}from'./chunk-YARRV66T.js';import {a as a$o}from'./chunk-A7GWTDM7.js';export{a as imgColor}from'./chunk-A7GWTDM7.js';import {a as a$p}from'./chunk-ZQTU5EW7.js';export{a as videoColor}from'./chunk-ZQTU5EW7.js';import {a as a$q}from'./chunk-BS2XX4G3.js';export{a as truncated}from'./chunk-BS2XX4G3.js';import {a as a$b}from'./chunk-KAK6WZS7.js';export{a as pointer}from'./chunk-KAK6WZS7.js';import {a as a$c}from'./chunk-2E2JQAHI.js';export{a as pointerLocal}from'./chunk-2E2JQAHI.js';import {a as a$d}from'./chunk-UHGW7AXC.js';export{a as media}from'./chunk-UHGW7AXC.js';import {a as a$e}from'./chunk-COGNT6R5.js';export{a as field}from'./chunk-COGNT6R5.js';import {a as a$f}from'./chunk-BTKSOVH3.js';export{a as fieldState}from'./chunk-BTKSOVH3.js';import {a as a$g}from'./chunk-LBK3257B.js';export{a as formState}from'./chunk-LBK3257B.js';import'./chunk-QIUPJ6MF.js';import {a as a$h}from'./chunk-M65LNJXV.js';export{a as select}from'./chunk-M65LNJXV.js';import {a as a$i}from'./chunk-QTM2FDUV.js';export{a as colorInput}from'./chunk-QTM2FDUV.js';import'./chunk-A2ETARW3.js';import {a as a$4}from'./chunk-H7X35UB4.js';export{a as navType}from'./chunk-H7X35UB4.js';import {a as a$5}from'./chunk-TEPMM5DH.js';export{a as meta}from'./chunk-TEPMM5DH.js';import {b}from'./chunk-JB72QLD6.js';export{b as network}from'./chunk-JB72QLD6.js';import {a as a$6}from'./chunk-DQJQEWPS.js';export{a as battery}from'./chunk-DQJQEWPS.js';import {a as a$7}from'./chunk-7U544OAJ.js';export{a as clock}from'./chunk-7U544OAJ.js';import {a as a$8}from'./chunk-M7FMWTDF.js';export{a as fps}from'./chunk-M7FMWTDF.js';import {a as a$9}from'./chunk-F5H2O3AR.js';export{a as visualViewport}from'./chunk-F5H2O3AR.js';import {a as a$a}from'./chunk-IVUTABRM.js';export{a as keyboard}from'./chunk-IVUTABRM.js';import {a as a$s}from'./chunk-D24E2DBW.js';import'./chunk-V4OTPLOQ.js';import'./chunk-LTJ2VKVY.js';import'./chunk-EXPE3C6O.js';import {a}from'./chunk-SV76E7NI.js';export{a as scrollVelocity}from'./chunk-SV76E7NI.js';import'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import {a as a$1}from'./chunk-MDKLN42L.js';export{a as online}from'./chunk-MDKLN42L.js';import {a as a$2}from'./chunk-HKCTBVQT.js';export{a as pageFocused}from'./chunk-HKCTBVQT.js';import'./chunk-EEMKKLRF.js';import {a as a$3}from'./chunk-SFO6H2DN.js';export{a as pageVisible}from'./chunk-SFO6H2DN.js';var q=[a,a$1,a$2,a$3,a$4,a$5,b,a$6,a$7,a$8,a$9,a$a,a$b,a$c,a$d,a$e,a$f,a$g,a$h,a$i,a$j,a$k,a$l,a$m,a$n,a$o,a$p,a$q,a$r];function no(...o){for(let j of o.length?o:q)a$s(j);}export{q as allPlugins,no as registerPlugins};
1
+ import {a as a$r}from'./chunk-5VXDAWUI.js';export{a as ua}from'./chunk-5VXDAWUI.js';import {a as a$s}from'./chunk-HFE2X32G.js';export{a as random}from'./chunk-HFE2X32G.js';import {a as a$j}from'./chunk-N745RQIX.js';export{a as orientation}from'./chunk-N745RQIX.js';import {a as a$k}from'./chunk-HTO57OQP.js';export{a as motion}from'./chunk-HTO57OQP.js';import {a as a$l}from'./chunk-FOHEZJHF.js';export{a as geo}from'./chunk-FOHEZJHF.js';import {a as a$m}from'./chunk-5JZBLUQK.js';export{a as cpuPressure}from'./chunk-5JZBLUQK.js';import {a as a$n}from'./chunk-YARRV66T.js';export{a as img}from'./chunk-YARRV66T.js';import {a as a$o}from'./chunk-A7GWTDM7.js';export{a as imgColor}from'./chunk-A7GWTDM7.js';import {a as a$p}from'./chunk-ZQTU5EW7.js';export{a as videoColor}from'./chunk-ZQTU5EW7.js';import {a as a$q}from'./chunk-KDIZYBPJ.js';export{a as truncated}from'./chunk-KDIZYBPJ.js';import {a as a$b}from'./chunk-6M2UIJI5.js';export{a as pointer}from'./chunk-6M2UIJI5.js';import {a as a$c}from'./chunk-TL5BJFFL.js';export{a as pointerLocal}from'./chunk-TL5BJFFL.js';import {a as a$d}from'./chunk-UHGW7AXC.js';export{a as media}from'./chunk-UHGW7AXC.js';import {a as a$e}from'./chunk-COGNT6R5.js';export{a as field}from'./chunk-COGNT6R5.js';import {a as a$f}from'./chunk-BTKSOVH3.js';export{a as fieldState}from'./chunk-BTKSOVH3.js';import {a as a$g}from'./chunk-LBK3257B.js';export{a as formState}from'./chunk-LBK3257B.js';import'./chunk-QIUPJ6MF.js';import {a as a$h}from'./chunk-M65LNJXV.js';export{a as select}from'./chunk-M65LNJXV.js';import {a as a$i}from'./chunk-QTM2FDUV.js';export{a as colorInput}from'./chunk-QTM2FDUV.js';import'./chunk-A2ETARW3.js';import {a as a$4}from'./chunk-H7X35UB4.js';export{a as navType}from'./chunk-H7X35UB4.js';import {a as a$5}from'./chunk-TEPMM5DH.js';export{a as meta}from'./chunk-TEPMM5DH.js';import {b}from'./chunk-JB72QLD6.js';export{b as network}from'./chunk-JB72QLD6.js';import {a as a$6}from'./chunk-DQJQEWPS.js';export{a as battery}from'./chunk-DQJQEWPS.js';import {a as a$7}from'./chunk-7U544OAJ.js';export{a as clock}from'./chunk-7U544OAJ.js';import {a as a$8}from'./chunk-M7FMWTDF.js';export{a as fps}from'./chunk-M7FMWTDF.js';import {a as a$9}from'./chunk-F5H2O3AR.js';export{a as visualViewport}from'./chunk-F5H2O3AR.js';import {a as a$a}from'./chunk-IVUTABRM.js';export{a as keyboard}from'./chunk-IVUTABRM.js';import {a as a$t}from'./chunk-N3F2LRDI.js';import'./chunk-6234NJTF.js';import'./chunk-LTJ2VKVY.js';import'./chunk-EXPE3C6O.js';import {a}from'./chunk-PS7KTHW4.js';export{a as scrollVelocity}from'./chunk-PS7KTHW4.js';import'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import {a as a$1}from'./chunk-2SIGTGQE.js';export{a as online}from'./chunk-2SIGTGQE.js';import {a as a$2}from'./chunk-2NMXY7T4.js';export{a as pageFocused}from'./chunk-2NMXY7T4.js';import'./chunk-7KEBMJ3O.js';import {a as a$3}from'./chunk-IFIWYBMP.js';export{a as pageVisible}from'./chunk-IFIWYBMP.js';var z=[a,a$1,a$2,a$3,a$4,a$5,b,a$6,a$7,a$8,a$9,a$a,a$b,a$c,a$d,a$e,a$f,a$g,a$h,a$i,a$j,a$k,a$l,a$m,a$n,a$o,a$p,a$q,a$r,a$s];function ao(...o){for(let q of o.length?o:z)a$t(q);}export{z as allPlugins,ao as registerPlugins};
@@ -0,0 +1 @@
1
+ 'use strict';var chunk675RBWFU_cjs=require('./chunk-675RBWFU.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-DRXR56P5.cjs');Object.defineProperty(exports,"pointer",{enumerable:true,get:function(){return chunk675RBWFU_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as pointer}from'./chunk-6M2UIJI5.js';import'./chunk-T4N6AEOZ.js';import'./chunk-7KEBMJ3O.js';
@@ -0,0 +1 @@
1
+ export{a as pointerLocal}from'./chunk-TL5BJFFL.js';import'./chunk-T4N6AEOZ.js';import'./chunk-7KEBMJ3O.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkXMJ6YRQB_cjs=require('./chunk-XMJ6YRQB.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-DRXR56P5.cjs');Object.defineProperty(exports,"pointerLocal",{enumerable:true,get:function(){return chunkXMJ6YRQB_cjs.a}});
@@ -0,0 +1 @@
1
+ 'use strict';var chunkSRKAOAXW_cjs=require('./chunk-SRKAOAXW.cjs');require('./chunk-65MXZJBD.cjs');Object.defineProperty(exports,"random",{enumerable:true,get:function(){return chunkSRKAOAXW_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as random}from'./chunk-HFE2X32G.js';import'./chunk-T4N6AEOZ.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkRVZWUZQ2_cjs=require('./chunk-RVZWUZQ2.cjs');require('./chunk-EYDIF3NM.cjs'),require('./chunk-65MXZJBD.cjs'),require('./chunk-7L35N3N3.cjs'),require('./chunk-DRXR56P5.cjs');Object.defineProperty(exports,"scrollVelocity",{enumerable:true,get:function(){return chunkRVZWUZQ2_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as scrollVelocity}from'./chunk-PS7KTHW4.js';import'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import'./chunk-7KEBMJ3O.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunk4C255WE6_cjs=require('./chunk-4C255WE6.cjs');require('./chunk-DFWBYWE3.cjs');Object.defineProperty(exports,"truncated",{enumerable:true,get:function(){return chunk4C255WE6_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as truncated}from'./chunk-KDIZYBPJ.js';import'./chunk-6234NJTF.js';
@@ -31,6 +31,14 @@ interface Config {
31
31
  * `fps`/`scroll-velocity` measure at this rate too.
32
32
  */
33
33
  liveHz?: number;
34
+ /**
35
+ * Seed for the `random` plugin. When set, each element's rolls are derived from
36
+ * this seed plus the element's position in the DOM instead of `Math.random()`,
37
+ * so the same markup renders the same "random" layout on every load — and a
38
+ * rebind hands an element the values it had before. Unset (the default) means
39
+ * genuinely random per load. Any integer works; `0` is a valid seed.
40
+ */
41
+ randomSeed?: number;
34
42
  }
35
43
  /** Optional `@property` typing for a source's local name, used when `typed` is on. */
36
44
  interface PropSpec {
@@ -31,6 +31,14 @@ interface Config {
31
31
  * `fps`/`scroll-velocity` measure at this rate too.
32
32
  */
33
33
  liveHz?: number;
34
+ /**
35
+ * Seed for the `random` plugin. When set, each element's rolls are derived from
36
+ * this seed plus the element's position in the DOM instead of `Math.random()`,
37
+ * so the same markup renders the same "random" layout on every load — and a
38
+ * rebind hands an element the values it had before. Unset (the default) means
39
+ * genuinely random per load. Any integer works; `0` is a valid seed.
40
+ */
41
+ randomSeed?: number;
34
42
  }
35
43
  /** Optional `@property` typing for a source's local name, used when `typed` is on. */
36
44
  interface PropSpec {
package/llms.txt CHANGED
@@ -13,7 +13,7 @@ when a value actually changed. Zero runtime dependencies, tree-shakeable, TypeSc
13
13
  ## Entry points
14
14
 
15
15
  - `prop-for-that`: the core API (`configure`, `register`, `unregister`, `propsFor`, `unbind`, `reset`).
16
- - `prop-for-that/auto`: side-effecting and fully declarative. Attaches **nothing** by default — it scans the DOM for `[data-props-for="key1 key2"]` and binds exactly those sources (globals included, declared on `<html data-props-for="viewport pointer">` → writes to `:root`), watching the DOM with a `MutationObserver`. Plugin sources are **loaded on demand**: the first time a key needs one, its chunk is dynamically imported and registered, then the binding attaches (no `registerPlugins()`, no separate plugins import). Because it lazy-loads via dynamic `import()`, use it as a module — `<script type="module" src=".../auto.js">` (a classic CDN drop-in `auto.global.js` no longer exists). If the root `<html>` has the boolean attribute `data-props-typed`, it calls `configure({ typed: true })` first (markup equivalent; read once on load; global, no per-key subset). Two limits: it only sees the **light DOM** (a `MutationObserver` doesn't cross shadow roots, so `data-props-for` inside a web component's shadow root is never auto-bound — bind those imperatively with `propsFor(el, [...])`); and on-demand plugin chunks resolve only on CDNs that serve the `dist` tree verbatim (unpkg / jsDelivr file paths), not rewriting/bundling CDNs (esm.sh, `?module`, jsDelivr `+esm`).
16
+ - `prop-for-that/auto`: side-effecting and fully declarative. Attaches **nothing** by default — it scans the DOM for `[data-props-for="key1 key2"]` and binds exactly those sources (globals included, declared on `<html data-props-for="viewport pointer">` → writes to `:root`), watching the DOM with a `MutationObserver`. An element can add `data-props-to="<selector>"` to write its properties on the nearest matching **ancestor** instead (the element is still what's observed) — editing that attribute rebinds every key on the element against the new target. Plugin sources are **loaded on demand**: the first time a key needs one, its chunk is dynamically imported and registered, then the binding attaches (no `registerPlugins()`, no separate plugins import). Because it lazy-loads via dynamic `import()`, use it as a module — `<script type="module" src=".../auto.js">` (a classic CDN drop-in `auto.global.js` no longer exists). If the root `<html>` has the boolean attribute `data-props-typed`, it calls `configure({ typed: true })` first (markup equivalent; read once on load; global, no per-key subset). Likewise `<html data-props-seed="42">` calls `configure({ randomSeed: 42 })` first (markup equivalent, seeds the `random` plugin; read once on load; a non-numeric value is ignored with a warning). Two limits: it only sees the **light DOM** (a `MutationObserver` doesn't cross shadow roots, so `data-props-for` inside a web component's shadow root is never auto-bound — bind those imperatively with `propsFor(el, [...])`); and on-demand plugin chunks resolve only on CDNs that serve the `dist` tree verbatim (unpkg / jsDelivr file paths), not rewriting/bundling CDNs (esm.sh, `?module`, jsDelivr `+esm`).
17
17
  - `prop-for-that/head`: side-effecting. Synchronously writes FOUC-safe constants before first paint. Inline it in `<head>`.
18
18
  - `prop-for-that/plugins`: opt-in plugin sources, plus `registerPlugins` and `allPlugins`.
19
19
 
@@ -43,7 +43,7 @@ register(source: Source): void // add a custom/plugin source by key
43
43
  unregister(key: SourceKey): void // remove a source from the registry
44
44
  isRegistered(key: SourceKey): boolean // whether a source key is currently registered
45
45
  propsFor(keys: string[]): Disposer // global: attach sources to config.root (:root)
46
- propsFor(target: Element | NodeList | Element[], keys: string[]): Disposer // per element(s)
46
+ propsFor(target: Element | NodeList | Element[], keys: string[], opts?: PropsForOptions): Disposer // per element(s)
47
47
  unbind(target: HTMLElement, keys?: string[]): void // detach some/all
48
48
  reset(): void // tear down every binding + shared observers/listeners
49
49
  pause(): void // freeze the loop (no sampling/flushing); idempotent
@@ -52,10 +52,19 @@ resume(): void // unfreeze; flushes anything queued wh
52
52
  // propsFor is global unless the first arg is a Node, NodeList, or array of elements.
53
53
  // Its disposer tears down only what that call started and removes the properties it wrote.
54
54
 
55
- interface Config { livePrefix: string; constPrefix: string; root: HTMLElement; typed: boolean; defaults?: Record<string, string|number>; liveHz?: number }
55
+ interface PropsForOptions { to?: Element | string }
56
+ // `to` hoists the WRITES to an ancestor (selector → el.closest(), or an explicit element)
57
+ // while still OBSERVING the bound element — the fix for "custom properties inherit
58
+ // downward only, and @container style() matches an ancestor". Markup form: data-props-to.
59
+ // No closest() match → warns, falls back to the element itself. `to` + a global source →
60
+ // warns, ignored. One binding per key per hoist target (duplicates warn and fight).
61
+
62
+ interface Config { livePrefix: string; constPrefix: string; root: HTMLElement; typed: boolean; defaults?: Record<string, string|number>; liveHz?: number; randomSeed?: number }
56
63
  // defaults: livePrefix '--live-', constPrefix '--const-', root document.documentElement, typed false, liveHz unset (every frame)
57
64
  // config.defaults are typed @property initial values, keyed by a source's local name
58
65
  // liveHz caps loop sampling+flushing rate (e.g. 30); fewer writes = less style recalc + calmer DevTools
66
+ // randomSeed makes the `random` plugin deterministic (rolls derive from seed + the element's DOM position); read when a source starts
67
+ // randomSeed markup equivalent under auto: <html data-props-seed="42">
59
68
 
60
69
  interface Source {
61
70
  key: SourceKey
@@ -147,6 +156,7 @@ Import name is camelCase; the key for `propsFor`/`data-props-for` is the dashed
147
156
  | `imgColor` | `img-color` | element | a palette from an `<img>`, all from one 16×16 bucketing pass (createImageBitmap+OffscreenCanvas). Each swatch is a single sRGB hex colour (no channel props — use relative colour syntax / color-mix to extract): `--live-img` (dominant), `--live-img-accent` (most vibrant), `--live-img-dark` (darkest non-black), `--live-img-light` (lightest non-white), `--live-img-avg` (mean). Plus `--live-img-temp` (−1 cool…+1 warm). Accent reuses the dominant for grayscale. Cross-origin needs `crossorigin` + CORS, else no-ops. Bind the `<img>` or a container. |
148
157
  | `videoColor` | `video-color` | element | live colours of a playing `<video>`, each a single sRGB hex colour: `--live-video` (dominant) + `--live-video-accent` (most vibrant; reuses the dominant for a grayscale frame). Both from one 16×16 read on `requestVideoFrameCallback` (stops when paused/offscreen/backgrounded), throttled to ~4 Hz; seeds a paused/poster frame; falls back to `timeupdate`. Cross-origin needs `crossorigin` + CORS, else no-ops. Bind the `<video>` or a container. |
149
158
  | `truncated` | `truncated` | element | whether the element's own text is clipped right now — the "is the ellipsis showing?" CSS can ask a scroll container but not overflowing text (all 1/0): `--live-truncated` (either axis), `--live-truncated-x` (inline clip, `scrollWidth > clientWidth` — the `text-overflow: ellipsis` case), `--live-truncated-y` (block clip, `scrollHeight > clientHeight` — `-webkit-line-clamp` / fixed-height box). Drives `@container style(--live-truncated: 1)` to reveal a "more"/tooltip/expand affordance only while text is cut off. Recomputed on resize (shared `ResizeObserver`), flips both ways as layout reflows. Bind the element whose overflow you care about. |
159
+ | `random` | `random` | element | three independent random rolls per bound element, each a float in [0,1), written once: `--const-random`, `--const-random-2`, `--const-random-3`. One CSS rule varies every element (size / tint / animation-delay phase) with no `:nth-child()` ladder. Angles, ranges, buckets, coin flips are derivable in calc() so they aren't shipped. Never re-rolled: `const` cadence + `gate: false` (gating would re-roll on every viewport re-entry). `configure({ randomSeed: 42 })` → deterministic, derived from the seed + the element's DOM position, so the same markup renders the same scatter every load (SSR/screenshot diffing); rebinding returns the same values; reordering the tree reshuffles. Native CSS `random()` is the eventual replacement. |
150
160
 
151
161
  ## Recipes
152
162
 
@@ -183,6 +193,19 @@ Container-bound range (so siblings can read the value):
183
193
  propsFor(document.querySelector('.meter'), ['range'])
184
194
  ```
185
195
 
196
+ Hoisting to an ancestor (the general form — works for every element source):
197
+
198
+ ```html
199
+ <figure>
200
+ <img data-props-for="img size" data-props-to="figure" src="art.jpg">
201
+ <figcaption>…</figcaption> <!-- reads --live-loaded, and can style-query it -->
202
+ </figure>
203
+ ```
204
+
205
+ ```js
206
+ propsFor(img, ['img', 'size'], { to: 'figure' }) // or { to: someElement }
207
+ ```
208
+
186
209
  Continuous reaction with `var()`:
187
210
 
188
211
  ```css
@@ -198,7 +221,7 @@ Discrete reaction with a style query:
198
221
 
199
222
  ## Gotchas (read before writing CSS)
200
223
 
201
- - **Custom properties inherit downward only.** An `element`-scoped source writes its vars on the bound element. To let *sibling* elements react, bind a common ancestor. `range` and `field` help here: bind them to a container and they find the inner `<input>`, writing the vars on the container.
224
+ - **Custom properties inherit downward only.** An `element`-scoped source writes its vars on the bound element, so only its *descendants* see them — and since `@container style()` matches an ancestor, the element can't style-query its own values either. Fix it by **hoisting**: `propsFor(el, keys, { to: 'figure' })` or `data-props-to="figure"` observes `el` but writes on the ancestor, so siblings (and `el` itself) can read and style-query it. The complementary trick: `range`, `field`, `select`, `media`, `img`, `img-color`, `video-color`, `color-input` also accept being bound to a *container* they find the inner element and write on the container. Keep hoists to one binding per key per target (two elements hoisting the same key to one ancestor overwrite each other; it warns).
202
225
  - **Pick the right consumer.** Continuous numbers go through `var()` + `calc()`. Discrete/boolean/integer values use `@container style()`, which matches on **equality only** (range comparisons like `style(--x < 5)` are not stable yet). Emit booleans/tiers when you need thresholds.
203
226
  - **`visibility` is binary + latched, not a ratio.** It writes `--live-visible` and `--const-has-entered`. There is no continuous visible-ratio and no scroll-position source: use native `animation-timeline: scroll()` / `view()` for continuous scroll-driven effects.
204
227
  - **Values are unitless.** Multiply by `1px`, `1deg`, `100%`, etc. in CSS.
@@ -206,7 +229,7 @@ Discrete reaction with a style query:
206
229
  - **Typed properties are opt-in.** `configure({ typed: true })` (before attaching) registers each written `--live-*` with `@property` so it interpolates (consumers add `transition`/`@keyframes`) and resolves to `0` before a value arrives. With the `auto` entry, `<html data-props-typed>` is the markup equivalent (boolean, read once on load; typing is global per `@property` name, so no per-key subset). It is a one-way door (no unregister), uses `inherits: true`, is feature-detected, and skips names already registered. Sources can declare per-property `props: { name: { syntax, initial, inherits } }` (default `<number>` / `0` / inherited); consumers can set initials with `configure({ typed: true, defaults: { 'pointer-x-ratio': 0.5 } })` (keyed by local name).
207
230
  - **Permission-gated plugins** (`orientation`, `motion`, `geo`) and unsupported APIs feature-detect and no-op; registering them is always safe. On iOS some need a user-gesture permission grant before values arrive. `cpuPressure` is Chromium-only and needs a secure context + the `compute-pressure` Permissions Policy; it seeds `--live-cpu-pressure: 0` where supported, writes nothing where not.
208
231
  - **Global writes land in an adopted stylesheet, not `<html>` inline style.** Root `--live-*` go into one constructable, adopted `:root {}` rule (element-scoped writes stay inline; the `head` entry still writes `--const-*` inline for first paint). Keeps the DevTools Styles panel usable under per-frame churn; `var()`/`calc()` consumption is identical (still inherits). Reading `documentElement.style` directly won't show them — read computed style. Falls back to inline where constructable stylesheets are unsupported.
209
- - **Continuously-sampling element sources pause off screen.** Under both the imperative API and `auto`, a *gated* `element`-scoped source runs only while its element intersects the viewport (via the shared `IntersectionObserver`); off screen its work (listeners/observers/timers) is torn down and its last-written values freeze in place, resuming + re-seeding on re-entry. This covers the sources that do continuous/heavy work: `size`, `truncated`, `pointer-local`, `media`, `img-color`, `video-color`. `global` sources and `:root` bindings are never gated. Opt out with `gate: false`: `visibility` does (it must keep observing to *report* visibility), and so do the **event-driven** sources `range`, `field`, `field-state`, `form-state`, `select`, `color-input`, `img` — they only write on user interaction or `load` (impossible off screen), so they seed once at bind and run ungated rather than paying for an `IntersectionObserver` subscription that saves nothing.
232
+ - **Continuously-sampling element sources pause off screen.** Under both the imperative API and `auto`, a *gated* `element`-scoped source runs only while its element intersects the viewport (via the shared `IntersectionObserver`); off screen its work (listeners/observers/timers) is torn down and its last-written values freeze in place, resuming + re-seeding on re-entry. This covers the sources that do continuous/heavy work: `size`, `truncated`, `pointer-local`, `media`, `img-color`, `video-color`. `global` sources and `:root` bindings are never gated. Opt out with `gate: false`: `visibility` does (it must keep observing to *report* visibility), and so do the **event-driven** sources `range`, `field`, `field-state`, `form-state`, `select`, `color-input`, `img` — they only write on user interaction or `load` (impossible off screen), so they seed once at bind and run ungated rather than paying for an `IntersectionObserver` subscription that saves nothing. `random` is ungated for a stronger reason: re-entry re-runs `start`, which would re-roll its write-once values.
210
233
  - **Freeze or throttle the loop.** The whole loop also freezes automatically while the tab is hidden (`document.hidden`). `pause()` / `resume()` stop and restart sampling+flushing (values hold steady; bindings stay attached). `configure({ liveHz: 30 })` caps the rate to reduce mutations/recalc, throttling samplers (`fps`, `scroll-velocity`) too.
211
234
 
212
235
  ## Links
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prop-for-that",
3
- "version": "0.7.8",
3
+ "version": "0.7.11",
4
4
  "description": "Expose what JavaScript knows but CSS can't see, as batched, diffed CSS custom properties.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- 'use strict';var s=new Map;function o(e,n){let t=s.get(e);if(!t){let r=new Set,i=a=>{for(let d of [...r])d(a);};t={handlers:r,dispatch:i},s.set(e,t),document.addEventListener(e,i,{passive:true});}return t.handlers.add(n),()=>{t.handlers.delete(n),t.handlers.size===0&&(document.removeEventListener(e,t.dispatch),s.delete(e));}}var l={key:"page-visible",scope:"global",start(e){let n=()=>e.write("page-visible",document.visibilityState==="visible"?1:0);return n(),o("visibilitychange",n)}};exports.a=l;
@@ -1 +0,0 @@
1
- import {b as b$1,a as a$3}from'./chunk-V4OTPLOQ.js';import {a as a$2}from'./chunk-LTJ2VKVY.js';import {b,a}from'./chunk-KG3EF456.js';import {a as a$4}from'./chunk-T4N6AEOZ.js';import {a as a$1}from'./chunk-LWKH66VY.js';import {a as a$5}from'./chunk-EEMKKLRF.js';var f;function P(){if(f!==void 0||(f=null,typeof document>"u"||typeof CSSStyleSheet!="function"||!("adoptedStyleSheets"in document)))return f;try{let e=new CSSStyleSheet;e.replaceSync(":root{}"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],f=e.cssRules[0].style;}catch{f=null;}return f}function m(e){if(typeof document<"u"&&e===document.documentElement){let t=P();if(t)return t}return e.style}var h=class{pending=new Map;last=new WeakMap;set(t,r,o){let n=this.pending.get(t);if(n?.has(r)){n.set(r,o);return}this.last.get(t)?.get(r)!==o&&(n?n.set(r,o):this.pending.set(t,new Map([[r,o]])),a());}forget(t,r){this.last.get(t)?.delete(r);let o=this.pending.get(t);o&&(o.delete(r),o.size===0&&this.pending.delete(t));}flush=()=>{if(this.pending.size!==0){for(let[t,r]of this.pending){let o=this.last.get(t);o||this.last.set(t,o=new Map);let n=m(t);for(let[i,s]of r)o.get(i)!==s&&(n.setProperty(i,s),o.set(i,s));}this.pending.clear();}}},y=new h;b(y.flush);var k=new Set;function C(e,t,r){if(k.has(e)||typeof CSS>"u"||typeof CSS.registerProperty!="function")return;k.add(e);let o=t?r?.[t]:void 0,n=t?a$1.defaults?.[t]:void 0;try{CSS.registerProperty({name:e,syntax:o?.syntax??"<number>",inherits:o?.inherits??!0,initialValue:n!=null?String(n):o?.initial??"0"});}catch{}}var T={key:"viewport",scope:"global",start(e){let t=()=>{e.write("vw",window.innerWidth),e.write("vh",window.innerHeight);};return t(),a$5("resize",t)}};var x={key:"size",scope:"element",start(e){return a$3(e.target,t=>{let r=t.borderBoxSize?.[0],o=r?r.inlineSize:t.contentRect.width,n=r?r.blockSize:t.contentRect.height;e.write("w",a$4(o)),e.write("h",a$4(n)),e.write("aspect",n>0?a$4(o/n):0);})}};var g=1;function R(e){let t=e.rootBounds;if(!t)return e.intersectionRatio>=1;let r=e.boundingClientRect;return r.top>=t.top-g&&r.right<=t.right+g&&r.bottom<=t.bottom+g&&r.left>=t.left-g}var H={key:"visibility",scope:"element",gate:false,start(e){let t=false;return e.write("visible",0),e.write("has-entered",0,"const"),b$1(e.target,r=>{let o=R(r);e.write("visible",o?1:0),o&&!t&&(t=true,e.write("has-entered",1,"const"));})}};var D={key:"range",scope:"element",gate:false,start(e){let t=a$2(e.target,'input[type="range"], input[type="number"]');if(!t)return ()=>{};let r=()=>{let o=t.min===""?0:Number(t.min),n=t.max===""?100:Number(t.max),i=Number(t.value);e.write("value",i),e.write("value-pct",n>o?a$4((i-o)/(n-o)):0);};return r(),t.addEventListener("input",r,{passive:true}),()=>t.removeEventListener("input",r)}};var z={viewport:T,size:x,visibility:H,range:D};var I=()=>{},p=new Map,S={...z};function ge(e){S[e.key]=e;}function Se(e){delete S[e];}function he(e){return e in S}function we(e){Object.assign(a$1,e);}function F(e,t,r){return {target:e,config:a$1,write(o,n,i="live"){let s=(i==="const"?a$1.constPrefix:a$1.livePrefix)+o;t.add(s),a$1.typed&&C(s,o,r),y.set(e,s,String(n));}}}function K(e,t,r){if(!(e.scope==="element"&&e.gate!==false&&r!==a$1.root&&typeof IntersectionObserver<"u"))return e.start(t);let n=null,i=()=>{if(!n)try{n=e.start(t);}catch(l){console.error(`[prop-for-that] source "${e.key}" failed to start`,l);}},s=()=>{n?.(),n=null;},d=b$1(r,l=>{l.isIntersecting?i():s();});return ()=>{d(),s();}}function w(e,t,r){let o=r.get(t);if(!o)return;o.dispose();let n=m(e);for(let i of o.written)n.removeProperty(i),y.forget(e,i);r.delete(t);}function A(e,t){let r=p.get(e);r||p.set(e,r=new Map);let o=[];for(let n of t){if(r.has(n))continue;let i=S[n];if(!i){console.warn(`[prop-for-that] unknown source "${n}"`);continue}let s=new Set,d;try{d=K(i,F(e,s,i.props),e);}catch(l){console.error(`[prop-for-that] source "${n}" failed to start`,l);continue}r.set(n,{dispose:d,written:s}),o.push(n);}return ()=>{let n=p.get(e);if(n){for(let i of o)w(e,i,n);n.size===0&&p.delete(e);}}}function O(e){return e instanceof Element?[e]:typeof NodeList<"u"&&e instanceof NodeList||typeof HTMLCollection<"u"&&e instanceof HTMLCollection||Array.isArray(e)?Array.from(e).filter(t=>t instanceof Element):[]}function W(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="string")}function ve(e,t){let r,o;if(t===void 0&&W(e)?(r=a$1.root?[a$1.root]:[],o=e):(r=O(e),o=t??[]),!r.length||!o.length)return I;let n=r.map(i=>A(i,o));return ()=>{for(let i of n)i();}}function Ee(e,t){let r=p.get(e);if(r){for(let o of t??[...r.keys()])w(e,o,r);r.size===0&&p.delete(e);}}function be(){for(let[e,t]of p)for(let r of [...t.keys()])w(e,r,t);p.clear();}export{ge as a,Se as b,he as c,we as d,ve as e,Ee as f,be as g};
@@ -1 +0,0 @@
1
- var t=new Map;function a(n,s){let e=t.get(n);if(!e){let r=new Set,d=i=>{for(let o of [...r])o(i);};e={handlers:r,dispatch:d},t.set(n,e),window.addEventListener(n,d,{passive:true});}return e.handlers.add(s),()=>{e.handlers.delete(s),e.handlers.size===0&&(window.removeEventListener(n,e.dispatch),t.delete(n));}}export{a};
@@ -1 +0,0 @@
1
- 'use strict';var chunkPQVNJZUW_cjs=require('./chunk-PQVNJZUW.cjs'),chunkHHINWX7L_cjs=require('./chunk-HHINWX7L.cjs'),chunkEYDIF3NM_cjs=require('./chunk-EYDIF3NM.cjs'),chunk65MXZJBD_cjs=require('./chunk-65MXZJBD.cjs'),chunk7L35N3N3_cjs=require('./chunk-7L35N3N3.cjs'),chunkQHHF5SEL_cjs=require('./chunk-QHHF5SEL.cjs');var f;function P(){if(f!==void 0||(f=null,typeof document>"u"||typeof CSSStyleSheet!="function"||!("adoptedStyleSheets"in document)))return f;try{let e=new CSSStyleSheet;e.replaceSync(":root{}"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],f=e.cssRules[0].style;}catch{f=null;}return f}function m(e){if(typeof document<"u"&&e===document.documentElement){let t=P();if(t)return t}return e.style}var h=class{pending=new Map;last=new WeakMap;set(t,r,o){let n=this.pending.get(t);if(n?.has(r)){n.set(r,o);return}this.last.get(t)?.get(r)!==o&&(n?n.set(r,o):this.pending.set(t,new Map([[r,o]])),chunkEYDIF3NM_cjs.a());}forget(t,r){this.last.get(t)?.delete(r);let o=this.pending.get(t);o&&(o.delete(r),o.size===0&&this.pending.delete(t));}flush=()=>{if(this.pending.size!==0){for(let[t,r]of this.pending){let o=this.last.get(t);o||this.last.set(t,o=new Map);let n=m(t);for(let[i,s]of r)o.get(i)!==s&&(n.setProperty(i,s),o.set(i,s));}this.pending.clear();}}},y=new h;chunkEYDIF3NM_cjs.b(y.flush);var k=new Set;function C(e,t,r){if(k.has(e)||typeof CSS>"u"||typeof CSS.registerProperty!="function")return;k.add(e);let o=t?r?.[t]:void 0,n=t?chunk7L35N3N3_cjs.a.defaults?.[t]:void 0;try{CSS.registerProperty({name:e,syntax:o?.syntax??"<number>",inherits:o?.inherits??!0,initialValue:n!=null?String(n):o?.initial??"0"});}catch{}}var T={key:"viewport",scope:"global",start(e){let t=()=>{e.write("vw",window.innerWidth),e.write("vh",window.innerHeight);};return t(),chunkQHHF5SEL_cjs.a("resize",t)}};var x={key:"size",scope:"element",start(e){return chunkPQVNJZUW_cjs.a(e.target,t=>{let r=t.borderBoxSize?.[0],o=r?r.inlineSize:t.contentRect.width,n=r?r.blockSize:t.contentRect.height;e.write("w",chunk65MXZJBD_cjs.a(o)),e.write("h",chunk65MXZJBD_cjs.a(n)),e.write("aspect",n>0?chunk65MXZJBD_cjs.a(o/n):0);})}};var g=1;function R(e){let t=e.rootBounds;if(!t)return e.intersectionRatio>=1;let r=e.boundingClientRect;return r.top>=t.top-g&&r.right<=t.right+g&&r.bottom<=t.bottom+g&&r.left>=t.left-g}var H={key:"visibility",scope:"element",gate:false,start(e){let t=false;return e.write("visible",0),e.write("has-entered",0,"const"),chunkPQVNJZUW_cjs.b(e.target,r=>{let o=R(r);e.write("visible",o?1:0),o&&!t&&(t=true,e.write("has-entered",1,"const"));})}};var D={key:"range",scope:"element",gate:false,start(e){let t=chunkHHINWX7L_cjs.a(e.target,'input[type="range"], input[type="number"]');if(!t)return ()=>{};let r=()=>{let o=t.min===""?0:Number(t.min),n=t.max===""?100:Number(t.max),i=Number(t.value);e.write("value",i),e.write("value-pct",n>o?chunk65MXZJBD_cjs.a((i-o)/(n-o)):0);};return r(),t.addEventListener("input",r,{passive:true}),()=>t.removeEventListener("input",r)}};var z={viewport:T,size:x,visibility:H,range:D};var I=()=>{},p=new Map,S={...z};function ge(e){S[e.key]=e;}function Se(e){delete S[e];}function he(e){return e in S}function we(e){Object.assign(chunk7L35N3N3_cjs.a,e);}function F(e,t,r){return {target:e,config:chunk7L35N3N3_cjs.a,write(o,n,i="live"){let s=(i==="const"?chunk7L35N3N3_cjs.a.constPrefix:chunk7L35N3N3_cjs.a.livePrefix)+o;t.add(s),chunk7L35N3N3_cjs.a.typed&&C(s,o,r),y.set(e,s,String(n));}}}function K(e,t,r){if(!(e.scope==="element"&&e.gate!==false&&r!==chunk7L35N3N3_cjs.a.root&&typeof IntersectionObserver<"u"))return e.start(t);let n=null,i=()=>{if(!n)try{n=e.start(t);}catch(l){console.error(`[prop-for-that] source "${e.key}" failed to start`,l);}},s=()=>{n?.(),n=null;},d=chunkPQVNJZUW_cjs.b(r,l=>{l.isIntersecting?i():s();});return ()=>{d(),s();}}function w(e,t,r){let o=r.get(t);if(!o)return;o.dispose();let n=m(e);for(let i of o.written)n.removeProperty(i),y.forget(e,i);r.delete(t);}function A(e,t){let r=p.get(e);r||p.set(e,r=new Map);let o=[];for(let n of t){if(r.has(n))continue;let i=S[n];if(!i){console.warn(`[prop-for-that] unknown source "${n}"`);continue}let s=new Set,d;try{d=K(i,F(e,s,i.props),e);}catch(l){console.error(`[prop-for-that] source "${n}" failed to start`,l);continue}r.set(n,{dispose:d,written:s}),o.push(n);}return ()=>{let n=p.get(e);if(n){for(let i of o)w(e,i,n);n.size===0&&p.delete(e);}}}function O(e){return e instanceof Element?[e]:typeof NodeList<"u"&&e instanceof NodeList||typeof HTMLCollection<"u"&&e instanceof HTMLCollection||Array.isArray(e)?Array.from(e).filter(t=>t instanceof Element):[]}function W(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="string")}function ve(e,t){let r,o;if(t===void 0&&W(e)?(r=chunk7L35N3N3_cjs.a.root?[chunk7L35N3N3_cjs.a.root]:[],o=e):(r=O(e),o=t??[]),!r.length||!o.length)return I;let n=r.map(i=>A(i,o));return ()=>{for(let i of n)i();}}function Ee(e,t){let r=p.get(e);if(r){for(let o of t??[...r.keys()])w(e,o,r);r.size===0&&p.delete(e);}}function be(){for(let[e,t]of p)for(let r of [...t.keys()])w(e,r,t);p.clear();}exports.a=ge;exports.b=Se;exports.c=he;exports.d=we;exports.e=ve;exports.f=Ee;exports.g=be;
@@ -1 +0,0 @@
1
- 'use strict';var chunkQHHF5SEL_cjs=require('./chunk-QHHF5SEL.cjs');var f={key:"online",scope:"global",start(e){let o=()=>e.write("online",navigator.onLine?1:0);o();let t=chunkQHHF5SEL_cjs.a("online",o),i=chunkQHHF5SEL_cjs.a("offline",o);return ()=>{t(),i();}}};exports.a=f;
@@ -1 +0,0 @@
1
- 'use strict';var a,f=new WeakMap,v=new WeakMap;function y(e,n){a||(a=new ResizeObserver(t=>{for(let s of t){v.set(s.target,s);let i=f.get(s.target);if(i)for(let d of [...i])d(s);}}));let r=f.get(e);r||(f.set(e,r=new Set),a.observe(e)),r.add(n);let o=v.get(e);return o&&n(o),()=>{let t=f.get(e);t&&(t.delete(n),t.size===0&&(f.delete(e),a.unobserve(e)));}}var b,c=new WeakMap,p=new WeakMap,g=[0,.98,.99,.995,.999,1];function l(e,n){b||(b=new IntersectionObserver(t=>{for(let s of t){p.set(s.target,s);let i=c.get(s.target);if(i)for(let d of [...i])d(s);}},{threshold:g}));let r=c.get(e);r||(c.set(e,r=new Set),b.observe(e)),r.add(n);let o=p.get(e);return o&&n(o),()=>{let t=c.get(e);t&&(t.delete(n),t.size===0&&(c.delete(e),b.unobserve(e)));}}exports.a=y;exports.b=l;
@@ -1 +0,0 @@
1
- 'use strict';var t=new Map;function a(n,s){let e=t.get(n);if(!e){let r=new Set,d=i=>{for(let o of [...r])o(i);};e={handlers:r,dispatch:d},t.set(n,e),window.addEventListener(n,d,{passive:true});}return e.handlers.add(s),()=>{e.handlers.delete(s),e.handlers.size===0&&(window.removeEventListener(n,e.dispatch),t.delete(n));}}exports.a=a;
@@ -1 +0,0 @@
1
- var s=new Map;function o(e,n){let t=s.get(e);if(!t){let r=new Set,i=a=>{for(let d of [...r])d(a);};t={handlers:r,dispatch:i},s.set(e,t),document.addEventListener(e,i,{passive:true});}return t.handlers.add(n),()=>{t.handlers.delete(n),t.handlers.size===0&&(document.removeEventListener(e,t.dispatch),s.delete(e));}}var l={key:"page-visible",scope:"global",start(e){let n=()=>e.write("page-visible",document.visibilityState==="visible"?1:0);return n(),o("visibilitychange",n)}};export{l as a};
@@ -1 +0,0 @@
1
- var a,f=new WeakMap,v=new WeakMap;function y(e,n){a||(a=new ResizeObserver(t=>{for(let s of t){v.set(s.target,s);let i=f.get(s.target);if(i)for(let d of [...i])d(s);}}));let r=f.get(e);r||(f.set(e,r=new Set),a.observe(e)),r.add(n);let o=v.get(e);return o&&n(o),()=>{let t=f.get(e);t&&(t.delete(n),t.size===0&&(f.delete(e),a.unobserve(e)));}}var b,c=new WeakMap,p=new WeakMap,g=[0,.98,.99,.995,.999,1];function l(e,n){b||(b=new IntersectionObserver(t=>{for(let s of t){p.set(s.target,s);let i=c.get(s.target);if(i)for(let d of [...i])d(s);}},{threshold:g}));let r=c.get(e);r||(c.set(e,r=new Set),b.observe(e)),r.add(n);let o=p.get(e);return o&&n(o),()=>{let t=c.get(e);t&&(t.delete(n),t.size===0&&(c.delete(e),b.unobserve(e)));}}export{y as a,l as b};
@@ -1 +0,0 @@
1
- 'use strict';var chunkQHHF5SEL_cjs=require('./chunk-QHHF5SEL.cjs');var u={key:"page-focused",scope:"global",start(c){let o=()=>c.write("page-focused",document.hasFocus()?1:0);o();let t=chunkQHHF5SEL_cjs.a("focus",o),r=chunkQHHF5SEL_cjs.a("blur",o);return ()=>{t(),r();}}};exports.a=u;
@@ -1 +0,0 @@
1
- export{a as motion}from'./chunk-SKEEFKDT.js';import'./chunk-T4N6AEOZ.js';import'./chunk-EEMKKLRF.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunkG2BOTBBH_cjs=require('./chunk-G2BOTBBH.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-QHHF5SEL.cjs');Object.defineProperty(exports,"motion",{enumerable:true,get:function(){return chunkG2BOTBBH_cjs.a}});
@@ -1 +0,0 @@
1
- 'use strict';var chunkOVF4XN2H_cjs=require('./chunk-OVF4XN2H.cjs');require('./chunk-QHHF5SEL.cjs');Object.defineProperty(exports,"online",{enumerable:true,get:function(){return chunkOVF4XN2H_cjs.a}});
@@ -1 +0,0 @@
1
- export{a as online}from'./chunk-MDKLN42L.js';import'./chunk-EEMKKLRF.js';
@@ -1 +0,0 @@
1
- export{a as orientation}from'./chunk-TRMZLMNW.js';import'./chunk-T4N6AEOZ.js';import'./chunk-EEMKKLRF.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunkHTKGZP36_cjs=require('./chunk-HTKGZP36.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-QHHF5SEL.cjs');Object.defineProperty(exports,"orientation",{enumerable:true,get:function(){return chunkHTKGZP36_cjs.a}});
@@ -1 +0,0 @@
1
- 'use strict';var chunkWIPJMLJJ_cjs=require('./chunk-WIPJMLJJ.cjs');require('./chunk-QHHF5SEL.cjs');Object.defineProperty(exports,"pageFocused",{enumerable:true,get:function(){return chunkWIPJMLJJ_cjs.a}});
@@ -1 +0,0 @@
1
- export{a as pageFocused}from'./chunk-HKCTBVQT.js';import'./chunk-EEMKKLRF.js';
@@ -1 +0,0 @@
1
- export{a as pageVisible}from'./chunk-SFO6H2DN.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunk3MK6Q7DX_cjs=require('./chunk-3MK6Q7DX.cjs');Object.defineProperty(exports,"pageVisible",{enumerable:true,get:function(){return chunk3MK6Q7DX_cjs.a}});
@@ -1 +0,0 @@
1
- export{a as pointer}from'./chunk-KAK6WZS7.js';import'./chunk-T4N6AEOZ.js';import'./chunk-EEMKKLRF.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunk3W7CXUWN_cjs=require('./chunk-3W7CXUWN.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-QHHF5SEL.cjs');Object.defineProperty(exports,"pointer",{enumerable:true,get:function(){return chunk3W7CXUWN_cjs.a}});
@@ -1 +0,0 @@
1
- 'use strict';var chunkSYKMPPTY_cjs=require('./chunk-SYKMPPTY.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-QHHF5SEL.cjs');Object.defineProperty(exports,"pointerLocal",{enumerable:true,get:function(){return chunkSYKMPPTY_cjs.a}});
@@ -1 +0,0 @@
1
- export{a as pointerLocal}from'./chunk-2E2JQAHI.js';import'./chunk-T4N6AEOZ.js';import'./chunk-EEMKKLRF.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunkLP3QQ33O_cjs=require('./chunk-LP3QQ33O.cjs');require('./chunk-EYDIF3NM.cjs'),require('./chunk-65MXZJBD.cjs'),require('./chunk-7L35N3N3.cjs'),require('./chunk-QHHF5SEL.cjs');Object.defineProperty(exports,"scrollVelocity",{enumerable:true,get:function(){return chunkLP3QQ33O_cjs.a}});
@@ -1 +0,0 @@
1
- export{a as scrollVelocity}from'./chunk-SV76E7NI.js';import'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import'./chunk-EEMKKLRF.js';
@@ -1 +0,0 @@
1
- export{a as truncated}from'./chunk-BS2XX4G3.js';import'./chunk-V4OTPLOQ.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunk37L73RJL_cjs=require('./chunk-37L73RJL.cjs');require('./chunk-PQVNJZUW.cjs');Object.defineProperty(exports,"truncated",{enumerable:true,get:function(){return chunk37L73RJL_cjs.a}});