prop-for-that 0.7.8 → 0.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -0
- package/README.md +25 -2
- package/dist/auto.cjs +1 -1
- package/dist/auto.js +1 -1
- package/dist/battery-6MFH4UXN.cjs +1 -0
- package/dist/battery-RGIVK2PZ.js +1 -0
- package/dist/chunk-23TUV6HD.js +1 -0
- package/dist/chunk-2OCWGQTC.cjs +1 -0
- package/dist/chunk-2RNFSOS6.js +1 -0
- package/dist/chunk-2TNXW2VV.js +1 -0
- package/dist/chunk-34XDO4K2.cjs +2 -0
- package/dist/chunk-3EI2VHWK.cjs +1 -0
- package/dist/chunk-4H6UVYDJ.js +1 -0
- package/dist/chunk-4IEDDWUY.js +1 -0
- package/dist/chunk-4K5AIWZQ.cjs +1 -0
- package/dist/chunk-4WSASU6P.js +1 -0
- package/dist/chunk-5JG4K6SH.cjs +1 -0
- package/dist/chunk-64VOCEUQ.cjs +1 -0
- package/dist/chunk-6FYUJK4F.cjs +1 -0
- package/dist/chunk-6LH6U5QE.cjs +1 -0
- package/dist/chunk-7AD7LRMF.cjs +1 -0
- package/dist/chunk-7GUGSNG2.cjs +1 -0
- package/dist/chunk-7HKSU2EV.js +1 -0
- package/dist/chunk-7KOHYADG.js +1 -0
- package/dist/chunk-7OBG2QQ6.js +1 -0
- package/dist/chunk-A3CLHLE4.js +1 -0
- package/dist/chunk-ADHR4VLZ.cjs +1 -0
- package/dist/{chunk-BS2XX4G3.js → chunk-AGUPRRD4.js} +1 -1
- package/dist/chunk-ALOGYFNP.cjs +1 -0
- package/dist/chunk-AQV7LL54.js +1 -0
- package/dist/chunk-BKB5HQTJ.js +1 -0
- package/dist/chunk-BYFXKRGA.cjs +1 -0
- package/dist/chunk-CBWMRF63.cjs +1 -0
- package/dist/chunk-CXXDGS7S.js +1 -0
- package/dist/chunk-D2T22ZDL.js +1 -0
- package/dist/chunk-DELDE4TM.cjs +1 -0
- package/dist/chunk-DGJ45NBZ.js +1 -0
- package/dist/chunk-DUKZ35AN.cjs +1 -0
- package/dist/chunk-FONP6RWO.js +1 -0
- package/dist/chunk-G3KQEE4R.cjs +1 -0
- package/dist/chunk-GTPEKE7O.cjs +1 -0
- package/dist/chunk-H5ZFJCDA.cjs +1 -0
- package/dist/chunk-HA25PYSI.js +1 -0
- package/dist/chunk-II5RRRIW.cjs +1 -0
- package/dist/chunk-ILMWSJ5M.js +1 -0
- package/dist/chunk-IMW37LVJ.cjs +1 -0
- package/dist/chunk-JMSQWVGJ.cjs +1 -0
- package/dist/chunk-KOELKEUS.js +1 -0
- package/dist/chunk-M3JZ2I3N.cjs +1 -0
- package/dist/chunk-NAJLRXKX.cjs +1 -0
- package/dist/chunk-NHEC6UK5.js +1 -0
- package/dist/chunk-NJ4Z3SAN.js +1 -0
- package/dist/chunk-NKC2KU7M.cjs +1 -0
- package/dist/chunk-O3KW7BD7.cjs +1 -0
- package/dist/chunk-PFCCKKAU.js +1 -0
- package/dist/chunk-PIEENX4H.js +1 -0
- package/dist/chunk-PMDPLPCX.cjs +1 -0
- package/dist/{chunk-37L73RJL.cjs → chunk-PSEAYJTX.cjs} +1 -1
- package/dist/{chunk-HKCTBVQT.js → chunk-PSGZ7K22.js} +1 -1
- package/dist/chunk-QEBTQYJZ.js +1 -0
- package/dist/chunk-QEFUAIXU.js +1 -0
- package/dist/chunk-QUY6BC6A.cjs +1 -0
- package/dist/chunk-R7KDUB7L.cjs +1 -0
- package/dist/chunk-SHR2C4QU.js +2 -0
- package/dist/{chunk-KAK6WZS7.js → chunk-SQIQ6W3B.js} +1 -1
- package/dist/{chunk-MDKLN42L.js → chunk-UDXHWQBB.js} +1 -1
- package/dist/chunk-VBXFZRD2.cjs +1 -0
- package/dist/chunk-VEIGSGIP.js +1 -0
- package/dist/chunk-VX2YFVNN.js +1 -0
- package/dist/chunk-WCZLSJ2Z.js +1 -0
- package/dist/chunk-XKZFDAK7.cjs +1 -0
- package/dist/{chunk-3W7CXUWN.cjs → chunk-YGON2MF3.cjs} +1 -1
- package/dist/chunk-ZHPDCMOZ.cjs +1 -0
- package/dist/chunk-ZWS2DFMD.js +1 -0
- package/dist/color-input-DYFD524G.cjs +1 -0
- package/dist/color-input-VGXE3XNJ.js +1 -0
- package/dist/cpu-pressure-44GNUF4Y.cjs +1 -0
- package/dist/cpu-pressure-IMBFJ3ZO.js +1 -0
- package/dist/field-HPNPSL25.js +1 -0
- package/dist/field-WYORT6PG.cjs +1 -0
- package/dist/field-state-4PSUJFKN.js +1 -0
- package/dist/field-state-II6PJ5HS.cjs +1 -0
- package/dist/form-state-5IHJDD33.cjs +1 -0
- package/dist/form-state-OVV2M5TF.js +1 -0
- package/dist/geo-P2VA6AUO.cjs +1 -0
- package/dist/geo-ZWUUVUGV.js +1 -0
- package/dist/head.cjs +1 -1
- package/dist/head.global.js +1 -1
- package/dist/head.js +1 -1
- package/dist/img-DF7WXT4N.cjs +1 -0
- package/dist/img-EKQEJX2E.js +1 -0
- package/dist/img-color-6EPAZT5J.cjs +1 -0
- package/dist/img-color-LZCA54BY.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +30 -5
- package/dist/index.d.ts +30 -5
- package/dist/index.global.js +1 -1
- package/dist/index.js +1 -1
- package/dist/keyboard-64GW3PBM.cjs +1 -0
- package/dist/keyboard-TDESCGLM.js +1 -0
- package/dist/media-OMEUDO7O.js +1 -0
- package/dist/media-QTJUS7XA.cjs +1 -0
- package/dist/meta-7F3Z4TDW.js +1 -0
- package/dist/meta-LT46XDXG.cjs +1 -0
- package/dist/motion-2SODB2EA.js +1 -0
- package/dist/motion-7IYUKVGZ.cjs +1 -0
- package/dist/nav-type-U6LPZQ2P.cjs +1 -0
- package/dist/nav-type-X6F3SEKK.js +1 -0
- package/dist/network-CK67HYFH.cjs +1 -0
- package/dist/network-UZSWIPZI.js +1 -0
- package/dist/online-26LBCTSO.js +1 -0
- package/dist/online-QAPYXQPE.cjs +1 -0
- package/dist/orientation-74KQIYGZ.cjs +1 -0
- package/dist/orientation-CY3Z2V7H.js +1 -0
- package/dist/page-focused-LRTVCN2G.js +1 -0
- package/dist/page-focused-NOTCVLRM.cjs +1 -0
- package/dist/page-visible-2BODDMS2.cjs +1 -0
- package/dist/page-visible-MBFCHBMI.js +1 -0
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.cts +70 -9
- package/dist/plugins.d.ts +70 -9
- package/dist/plugins.js +1 -1
- package/dist/pointer-6GORZRQ3.cjs +1 -0
- package/dist/pointer-XOW7F5WJ.js +1 -0
- package/dist/pointer-local-I2LOFXBK.js +1 -0
- package/dist/pointer-local-YKTILVZ2.cjs +1 -0
- package/dist/random-IUHNW2BC.cjs +1 -0
- package/dist/random-NZJGUATO.js +1 -0
- package/dist/scroll-velocity-EUEGXSPS.js +1 -0
- package/dist/scroll-velocity-GGM44R6C.cjs +1 -0
- package/dist/select-IGBNDOVX.js +1 -0
- package/dist/select-YIQGILHM.cjs +1 -0
- package/dist/truncated-52BHB5RJ.js +1 -0
- package/dist/truncated-HESCQTCR.cjs +1 -0
- package/dist/{types-CudiAlDE.d.cts → types-D8ZUfj4U.d.cts} +30 -4
- package/dist/{types-CudiAlDE.d.ts → types-D8ZUfj4U.d.ts} +30 -4
- package/dist/ua-6TXYUXIB.js +1 -0
- package/dist/ua-IS3BUTMX.cjs +1 -0
- package/dist/video-color-DY2FP4OR.js +1 -0
- package/dist/video-color-MASYKAPQ.cjs +1 -0
- package/dist/visual-viewport-KZ4IINJE.js +1 -0
- package/dist/visual-viewport-PLYUYG44.cjs +1 -0
- package/llms.txt +29 -6
- package/package.json +1 -1
- package/dist/battery-CDMJLP4C.js +0 -1
- package/dist/battery-DQQ2NOGC.cjs +0 -1
- package/dist/chunk-2E2JQAHI.js +0 -1
- package/dist/chunk-2H5YFW6O.cjs +0 -1
- package/dist/chunk-2YHGSLQQ.cjs +0 -1
- package/dist/chunk-3MK6Q7DX.cjs +0 -1
- package/dist/chunk-3QHCKCTX.cjs +0 -1
- package/dist/chunk-3REDV2FZ.cjs +0 -1
- package/dist/chunk-5JZBLUQK.js +0 -1
- package/dist/chunk-5VXDAWUI.js +0 -1
- package/dist/chunk-63C3RCO2.cjs +0 -1
- package/dist/chunk-7CDVAP3H.cjs +0 -1
- package/dist/chunk-A7GWTDM7.js +0 -1
- package/dist/chunk-BTKSOVH3.js +0 -1
- package/dist/chunk-COGNT6R5.js +0 -1
- package/dist/chunk-D24E2DBW.js +0 -1
- package/dist/chunk-DQJQEWPS.js +0 -1
- package/dist/chunk-EEMKKLRF.js +0 -1
- package/dist/chunk-EXPE3C6O.js +0 -2
- package/dist/chunk-F5H2O3AR.js +0 -1
- package/dist/chunk-FKBHTKZH.cjs +0 -1
- package/dist/chunk-FOHEZJHF.js +0 -1
- package/dist/chunk-FZYB3P7L.cjs +0 -1
- package/dist/chunk-G2BOTBBH.cjs +0 -1
- package/dist/chunk-H7X35UB4.js +0 -1
- package/dist/chunk-HTKGZP36.cjs +0 -1
- package/dist/chunk-HYVT6V4Z.cjs +0 -1
- package/dist/chunk-IIQP3BYA.cjs +0 -1
- package/dist/chunk-IPYBSM34.cjs +0 -1
- package/dist/chunk-IVUTABRM.js +0 -1
- package/dist/chunk-JB72QLD6.js +0 -1
- package/dist/chunk-K2YWGXLP.cjs +0 -1
- package/dist/chunk-KSKAQMWJ.cjs +0 -2
- package/dist/chunk-LBK3257B.js +0 -1
- package/dist/chunk-LP3QQ33O.cjs +0 -1
- package/dist/chunk-M65LNJXV.js +0 -1
- package/dist/chunk-MGZTR3X6.cjs +0 -1
- package/dist/chunk-ODPCQAKC.cjs +0 -1
- package/dist/chunk-OVCZMPYV.cjs +0 -1
- package/dist/chunk-OVF4XN2H.cjs +0 -1
- package/dist/chunk-PQVNJZUW.cjs +0 -1
- package/dist/chunk-QFJ6SZ2H.cjs +0 -1
- package/dist/chunk-QHHF5SEL.cjs +0 -1
- package/dist/chunk-QTM2FDUV.js +0 -1
- package/dist/chunk-RT47EE2L.cjs +0 -1
- package/dist/chunk-SFO6H2DN.js +0 -1
- package/dist/chunk-SKEEFKDT.js +0 -1
- package/dist/chunk-SV76E7NI.js +0 -1
- package/dist/chunk-SYKMPPTY.cjs +0 -1
- package/dist/chunk-TEPMM5DH.js +0 -1
- package/dist/chunk-TRMZLMNW.js +0 -1
- package/dist/chunk-UALPUR2L.cjs +0 -1
- package/dist/chunk-UHGW7AXC.js +0 -1
- package/dist/chunk-V4OTPLOQ.js +0 -1
- package/dist/chunk-WIPJMLJJ.cjs +0 -1
- package/dist/chunk-XQOUJEVE.cjs +0 -1
- package/dist/chunk-YARRV66T.js +0 -1
- package/dist/chunk-ZQTU5EW7.js +0 -1
- package/dist/color-input-STV57DGE.js +0 -1
- package/dist/color-input-SYYBVLZM.cjs +0 -1
- package/dist/cpu-pressure-FXZDL5IE.cjs +0 -1
- package/dist/cpu-pressure-WCDHVDRP.js +0 -1
- package/dist/field-4MBM2R7N.cjs +0 -1
- package/dist/field-6USMKGKM.js +0 -1
- package/dist/field-state-NXSK6ZZW.cjs +0 -1
- package/dist/field-state-YLUDK3XS.js +0 -1
- package/dist/form-state-FJZINKN7.cjs +0 -1
- package/dist/form-state-Q4SCA6TH.js +0 -1
- package/dist/geo-CMG7QJ6S.cjs +0 -1
- package/dist/geo-MXO5OMVO.js +0 -1
- package/dist/img-6F5QAPW3.cjs +0 -1
- package/dist/img-PYBNG6OU.js +0 -1
- package/dist/img-color-MBEU42DF.cjs +0 -1
- package/dist/img-color-VW3XMATY.js +0 -1
- package/dist/keyboard-6ZGB2LAD.cjs +0 -1
- package/dist/keyboard-YJ7S6XPJ.js +0 -1
- package/dist/media-RDQ3WR22.js +0 -1
- package/dist/media-XS6ADFFY.cjs +0 -1
- package/dist/meta-U2EHV4AM.cjs +0 -1
- package/dist/meta-VSAZR4JL.js +0 -1
- package/dist/motion-GHDWROM2.js +0 -1
- package/dist/motion-GMUGWJN3.cjs +0 -1
- package/dist/nav-type-MFJJDDPZ.cjs +0 -1
- package/dist/nav-type-S4MHMDHS.js +0 -1
- package/dist/network-BHUTXTX7.js +0 -1
- package/dist/network-DPAAEK2S.cjs +0 -1
- package/dist/online-KTMCBCXT.cjs +0 -1
- package/dist/online-MGYZDLCQ.js +0 -1
- package/dist/orientation-27ULVQVJ.js +0 -1
- package/dist/orientation-JD23MYZR.cjs +0 -1
- package/dist/page-focused-3WLSZDV4.cjs +0 -1
- package/dist/page-focused-LBKD6QXG.js +0 -1
- package/dist/page-visible-27YKTHKU.js +0 -1
- package/dist/page-visible-6PMX575B.cjs +0 -1
- package/dist/pointer-3O7MGTQD.js +0 -1
- package/dist/pointer-DJSMZGSV.cjs +0 -1
- package/dist/pointer-local-6JKSOJZV.cjs +0 -1
- package/dist/pointer-local-X5TVNEEJ.js +0 -1
- package/dist/scroll-velocity-DGZNNO73.cjs +0 -1
- package/dist/scroll-velocity-ZRXPNZG7.js +0 -1
- package/dist/select-H3CFIVK3.js +0 -1
- package/dist/select-LMRGCCLB.cjs +0 -1
- package/dist/truncated-MDPFWGSI.js +0 -1
- package/dist/truncated-RUY3JNAX.cjs +0 -1
- package/dist/ua-3MLUBLSV.cjs +0 -1
- package/dist/ua-3RC4SBYB.js +0 -1
- package/dist/video-color-B37Z5OBY.cjs +0 -1
- package/dist/video-color-ZMRKDZFO.js +0 -1
- package/dist/visual-viewport-GNJTAHPT.js +0 -1
- package/dist/visual-viewport-MKUHWUQT.cjs +0 -1
package/dist/plugins.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Source } from './types-
|
|
1
|
+
import { S as Source } from './types-D8ZUfj4U.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `--live-scroll-velocity` (signed px/frame, decays toward 0 when idle),
|
|
@@ -33,6 +33,11 @@ declare const pageFocused: Source;
|
|
|
33
33
|
* that should pause when truly hidden — video, polling, expensive effects — where
|
|
34
34
|
* focus gates the things that react to "is the user looking here right now."
|
|
35
35
|
* Driven by `visibilitychange`, seeded from `document.visibilityState`.
|
|
36
|
+
*
|
|
37
|
+
* The `0` is real but never *paints*: the shared frame loop freezes on the same
|
|
38
|
+
* `visibilitychange` (nothing can be shown to a hidden tab), so the queued `0` is
|
|
39
|
+
* coalesced away by the `1` on return. Read it in JS, or use it to hold state
|
|
40
|
+
* across a hide — don't expect CSS to render a hidden state.
|
|
36
41
|
*/
|
|
37
42
|
declare const pageVisible: Source;
|
|
38
43
|
|
|
@@ -79,6 +84,11 @@ declare const navType: Source;
|
|
|
79
84
|
* at bind on the `const` cadence (these don't change), so meta tags a framework
|
|
80
85
|
* swaps in *after* bind aren't tracked; for a value needed before first paint,
|
|
81
86
|
* read it in a `<head>` script instead. Global source — bind once.
|
|
87
|
+
*
|
|
88
|
+
* These names are discovered at runtime, so the source can't declare `props` for
|
|
89
|
+
* them and they stay **untyped** even under `configure({ typed: true })` — which
|
|
90
|
+
* is what keeps the values intact, since the `<number>` default would reject a
|
|
91
|
+
* colour or a URL and compute it to `0`.
|
|
82
92
|
*/
|
|
83
93
|
declare const meta: Source;
|
|
84
94
|
|
|
@@ -122,9 +132,16 @@ declare const pointer: Source;
|
|
|
122
132
|
* `--live-local-pointer-x-ratio`, `--live-local-pointer-y-ratio` (0–1 within the
|
|
123
133
|
* element's box), `--live-local-pointer-inside` (0/1).
|
|
124
134
|
*
|
|
125
|
-
* Shares the page's single `pointermove` listener
|
|
126
|
-
*
|
|
127
|
-
*
|
|
135
|
+
* Shares the page's single `pointermove` listener, but reads the element's rect
|
|
136
|
+
* on **every move** so it stays correct through layout shifts, which a cached
|
|
137
|
+
* rect would miss. That's one `getBoundingClientRect` per bound element per
|
|
138
|
+
* move — cheap when layout is clean, but bind it to the few elements that need
|
|
139
|
+
* it rather than to every card in a grid.
|
|
140
|
+
*
|
|
141
|
+
* Seeded to zeros so all three properties resolve on frame one. Until the first
|
|
142
|
+
* move the ratios are meaningless, so gate on `--live-local-pointer-inside`
|
|
143
|
+
* (`0` until the pointer is actually over the element) rather than assuming the
|
|
144
|
+
* pointer starts in the top-left corner.
|
|
128
145
|
*/
|
|
129
146
|
declare const pointerLocal: Source;
|
|
130
147
|
|
|
@@ -221,8 +238,10 @@ declare const formState: Source;
|
|
|
221
238
|
* list (`0` for a one-option list or nothing selected).
|
|
222
239
|
* - `--live-value-num` — `Number(value)` *when the chosen value is numeric*, so a
|
|
223
240
|
* choice's meaning drives layout directly:
|
|
224
|
-
* `grid-template-columns: repeat(var(--live-value-num), 1fr)`.
|
|
225
|
-
*
|
|
241
|
+
* `grid-template-columns: repeat(var(--live-value-num), 1fr)`. Removed again
|
|
242
|
+
* whenever the selected value isn't numeric — so keep a
|
|
243
|
+
* `var(--live-value-num, …)` fallback; it applies both before the first
|
|
244
|
+
* numeric pick and after a non-numeric one.
|
|
226
245
|
* - `--live-selected-count` — how many options are selected (the count CSS can't
|
|
227
246
|
* compute: `:checked` matches them, nothing tallies them). `1`/`0` for a single
|
|
228
247
|
* select; `0`…N for `<select multiple>`.
|
|
@@ -252,14 +271,16 @@ declare const colorInput: Source;
|
|
|
252
271
|
/**
|
|
253
272
|
* `--live-orient-alpha`, `--live-orient-beta`, `--live-orient-gamma` (degrees)
|
|
254
273
|
* from `deviceorientation`. Requires a user-gesture permission grant on some
|
|
255
|
-
* platforms (notably iOS).
|
|
274
|
+
* platforms (notably iOS). Seeded to zeros (flat) so the properties resolve on
|
|
275
|
+
* frame one, whether or not a grant ever arrives.
|
|
256
276
|
*/
|
|
257
277
|
declare const orientation: Source;
|
|
258
278
|
|
|
259
279
|
/**
|
|
260
280
|
* `--live-accel-x`, `--live-accel-y`, `--live-accel-z` (m/s², gravity included)
|
|
261
281
|
* from `devicemotion`. Requires a user-gesture permission grant on some
|
|
262
|
-
* platforms (notably iOS).
|
|
282
|
+
* platforms (notably iOS). Seeded to zeros (at rest) so the properties resolve
|
|
283
|
+
* on frame one, whether or not a grant ever arrives.
|
|
263
284
|
*/
|
|
264
285
|
declare const motion: Source;
|
|
265
286
|
|
|
@@ -364,6 +385,14 @@ declare const videoColor: Source;
|
|
|
364
385
|
* have it disappear the moment a wider box fits the text. Recomputed whenever the
|
|
365
386
|
* box resizes (the shared `ResizeObserver`), so responsive truncation flips both
|
|
366
387
|
* ways as the layout reflows.
|
|
388
|
+
*
|
|
389
|
+
* Two false negatives to know about, both from what it measures:
|
|
390
|
+
*
|
|
391
|
+
* - `scrollWidth` / `clientWidth` are **integer-rounded**, so a sub-pixel
|
|
392
|
+
* overflow can show an ellipsis while these still read equal.
|
|
393
|
+
* - It's driven by *resize*, so replacing the text inside a fixed-size box
|
|
394
|
+
* doesn't re-measure — a `ResizeObserver` sees no size change. Rebind (or
|
|
395
|
+
* nudge the box) after swapping content.
|
|
367
396
|
*/
|
|
368
397
|
declare const truncated: Source;
|
|
369
398
|
|
|
@@ -397,6 +426,38 @@ declare const truncated: Source;
|
|
|
397
426
|
*/
|
|
398
427
|
declare const ua: Source;
|
|
399
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Per-element randomness — the one value CSS genuinely can't produce for itself
|
|
431
|
+
* (until `random()` ships everywhere). Bind it to N elements and each gets its
|
|
432
|
+
* own rolls, written **once** on the `const` cadence:
|
|
433
|
+
*
|
|
434
|
+
* - `--const-random` — a float in `[0, 1)`
|
|
435
|
+
* - `--const-random-2`, `--const-random-3` — two more, independent of the first
|
|
436
|
+
*
|
|
437
|
+
* Three, because organic variation usually needs more than one axis (delay *and*
|
|
438
|
+
* rotation *and* scale) and CSS can't derive a second independent random from the
|
|
439
|
+
* first. Everything else *is* derivable, so it isn't shipped: an angle is
|
|
440
|
+
* `calc(var(--const-random) * 360deg)`, a coin flip
|
|
441
|
+
* `calc(sign(var(--const-random) - 0.5))`, a range
|
|
442
|
+
* `calc(A + (B - A) * var(--const-random))`, a bucket
|
|
443
|
+
* `round(down, calc(var(--const-random) * 5), 1)`.
|
|
444
|
+
*
|
|
445
|
+
* Stagger a grid without `:nth-child()` rules, jitter a scatter layout, vary a
|
|
446
|
+
* shimmer's duration per card — one binding, no per-element JS.
|
|
447
|
+
*
|
|
448
|
+
* **Never re-rolled.** It writes on the `const` cadence and sets `gate: false`,
|
|
449
|
+
* so — unlike a gated element source, whose `start` re-runs on every viewport
|
|
450
|
+
* re-entry — scrolling out of view and back can't hand an element a new value
|
|
451
|
+
* mid-animation.
|
|
452
|
+
*
|
|
453
|
+
* **Seeded (deterministic) mode:** `configure({ randomSeed: 42 })` derives every
|
|
454
|
+
* roll from the seed plus the element's position in the DOM, so the same markup
|
|
455
|
+
* renders the same "random" layout on every load, and a rebind hands an element
|
|
456
|
+
* the values it had before. Reordering the tree reshuffles it. Unseeded (the
|
|
457
|
+
* default) rolls come from `Math.random()`.
|
|
458
|
+
*/
|
|
459
|
+
declare const random: Source;
|
|
460
|
+
|
|
400
461
|
/** Every plugin source, for `registerPlugins()` / bulk registration. */
|
|
401
462
|
declare const allPlugins: Source[];
|
|
402
463
|
/**
|
|
@@ -409,4 +470,4 @@ declare const allPlugins: Source[];
|
|
|
409
470
|
*/
|
|
410
471
|
declare function registerPlugins(...sources: Source[]): void;
|
|
411
472
|
|
|
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 };
|
|
473
|
+
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-
|
|
1
|
+
import { S as Source } from './types-D8ZUfj4U.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `--live-scroll-velocity` (signed px/frame, decays toward 0 when idle),
|
|
@@ -33,6 +33,11 @@ declare const pageFocused: Source;
|
|
|
33
33
|
* that should pause when truly hidden — video, polling, expensive effects — where
|
|
34
34
|
* focus gates the things that react to "is the user looking here right now."
|
|
35
35
|
* Driven by `visibilitychange`, seeded from `document.visibilityState`.
|
|
36
|
+
*
|
|
37
|
+
* The `0` is real but never *paints*: the shared frame loop freezes on the same
|
|
38
|
+
* `visibilitychange` (nothing can be shown to a hidden tab), so the queued `0` is
|
|
39
|
+
* coalesced away by the `1` on return. Read it in JS, or use it to hold state
|
|
40
|
+
* across a hide — don't expect CSS to render a hidden state.
|
|
36
41
|
*/
|
|
37
42
|
declare const pageVisible: Source;
|
|
38
43
|
|
|
@@ -79,6 +84,11 @@ declare const navType: Source;
|
|
|
79
84
|
* at bind on the `const` cadence (these don't change), so meta tags a framework
|
|
80
85
|
* swaps in *after* bind aren't tracked; for a value needed before first paint,
|
|
81
86
|
* read it in a `<head>` script instead. Global source — bind once.
|
|
87
|
+
*
|
|
88
|
+
* These names are discovered at runtime, so the source can't declare `props` for
|
|
89
|
+
* them and they stay **untyped** even under `configure({ typed: true })` — which
|
|
90
|
+
* is what keeps the values intact, since the `<number>` default would reject a
|
|
91
|
+
* colour or a URL and compute it to `0`.
|
|
82
92
|
*/
|
|
83
93
|
declare const meta: Source;
|
|
84
94
|
|
|
@@ -122,9 +132,16 @@ declare const pointer: Source;
|
|
|
122
132
|
* `--live-local-pointer-x-ratio`, `--live-local-pointer-y-ratio` (0–1 within the
|
|
123
133
|
* element's box), `--live-local-pointer-inside` (0/1).
|
|
124
134
|
*
|
|
125
|
-
* Shares the page's single `pointermove` listener
|
|
126
|
-
*
|
|
127
|
-
*
|
|
135
|
+
* Shares the page's single `pointermove` listener, but reads the element's rect
|
|
136
|
+
* on **every move** so it stays correct through layout shifts, which a cached
|
|
137
|
+
* rect would miss. That's one `getBoundingClientRect` per bound element per
|
|
138
|
+
* move — cheap when layout is clean, but bind it to the few elements that need
|
|
139
|
+
* it rather than to every card in a grid.
|
|
140
|
+
*
|
|
141
|
+
* Seeded to zeros so all three properties resolve on frame one. Until the first
|
|
142
|
+
* move the ratios are meaningless, so gate on `--live-local-pointer-inside`
|
|
143
|
+
* (`0` until the pointer is actually over the element) rather than assuming the
|
|
144
|
+
* pointer starts in the top-left corner.
|
|
128
145
|
*/
|
|
129
146
|
declare const pointerLocal: Source;
|
|
130
147
|
|
|
@@ -221,8 +238,10 @@ declare const formState: Source;
|
|
|
221
238
|
* list (`0` for a one-option list or nothing selected).
|
|
222
239
|
* - `--live-value-num` — `Number(value)` *when the chosen value is numeric*, so a
|
|
223
240
|
* choice's meaning drives layout directly:
|
|
224
|
-
* `grid-template-columns: repeat(var(--live-value-num), 1fr)`.
|
|
225
|
-
*
|
|
241
|
+
* `grid-template-columns: repeat(var(--live-value-num), 1fr)`. Removed again
|
|
242
|
+
* whenever the selected value isn't numeric — so keep a
|
|
243
|
+
* `var(--live-value-num, …)` fallback; it applies both before the first
|
|
244
|
+
* numeric pick and after a non-numeric one.
|
|
226
245
|
* - `--live-selected-count` — how many options are selected (the count CSS can't
|
|
227
246
|
* compute: `:checked` matches them, nothing tallies them). `1`/`0` for a single
|
|
228
247
|
* select; `0`…N for `<select multiple>`.
|
|
@@ -252,14 +271,16 @@ declare const colorInput: Source;
|
|
|
252
271
|
/**
|
|
253
272
|
* `--live-orient-alpha`, `--live-orient-beta`, `--live-orient-gamma` (degrees)
|
|
254
273
|
* from `deviceorientation`. Requires a user-gesture permission grant on some
|
|
255
|
-
* platforms (notably iOS).
|
|
274
|
+
* platforms (notably iOS). Seeded to zeros (flat) so the properties resolve on
|
|
275
|
+
* frame one, whether or not a grant ever arrives.
|
|
256
276
|
*/
|
|
257
277
|
declare const orientation: Source;
|
|
258
278
|
|
|
259
279
|
/**
|
|
260
280
|
* `--live-accel-x`, `--live-accel-y`, `--live-accel-z` (m/s², gravity included)
|
|
261
281
|
* from `devicemotion`. Requires a user-gesture permission grant on some
|
|
262
|
-
* platforms (notably iOS).
|
|
282
|
+
* platforms (notably iOS). Seeded to zeros (at rest) so the properties resolve
|
|
283
|
+
* on frame one, whether or not a grant ever arrives.
|
|
263
284
|
*/
|
|
264
285
|
declare const motion: Source;
|
|
265
286
|
|
|
@@ -364,6 +385,14 @@ declare const videoColor: Source;
|
|
|
364
385
|
* have it disappear the moment a wider box fits the text. Recomputed whenever the
|
|
365
386
|
* box resizes (the shared `ResizeObserver`), so responsive truncation flips both
|
|
366
387
|
* ways as the layout reflows.
|
|
388
|
+
*
|
|
389
|
+
* Two false negatives to know about, both from what it measures:
|
|
390
|
+
*
|
|
391
|
+
* - `scrollWidth` / `clientWidth` are **integer-rounded**, so a sub-pixel
|
|
392
|
+
* overflow can show an ellipsis while these still read equal.
|
|
393
|
+
* - It's driven by *resize*, so replacing the text inside a fixed-size box
|
|
394
|
+
* doesn't re-measure — a `ResizeObserver` sees no size change. Rebind (or
|
|
395
|
+
* nudge the box) after swapping content.
|
|
367
396
|
*/
|
|
368
397
|
declare const truncated: Source;
|
|
369
398
|
|
|
@@ -397,6 +426,38 @@ declare const truncated: Source;
|
|
|
397
426
|
*/
|
|
398
427
|
declare const ua: Source;
|
|
399
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Per-element randomness — the one value CSS genuinely can't produce for itself
|
|
431
|
+
* (until `random()` ships everywhere). Bind it to N elements and each gets its
|
|
432
|
+
* own rolls, written **once** on the `const` cadence:
|
|
433
|
+
*
|
|
434
|
+
* - `--const-random` — a float in `[0, 1)`
|
|
435
|
+
* - `--const-random-2`, `--const-random-3` — two more, independent of the first
|
|
436
|
+
*
|
|
437
|
+
* Three, because organic variation usually needs more than one axis (delay *and*
|
|
438
|
+
* rotation *and* scale) and CSS can't derive a second independent random from the
|
|
439
|
+
* first. Everything else *is* derivable, so it isn't shipped: an angle is
|
|
440
|
+
* `calc(var(--const-random) * 360deg)`, a coin flip
|
|
441
|
+
* `calc(sign(var(--const-random) - 0.5))`, a range
|
|
442
|
+
* `calc(A + (B - A) * var(--const-random))`, a bucket
|
|
443
|
+
* `round(down, calc(var(--const-random) * 5), 1)`.
|
|
444
|
+
*
|
|
445
|
+
* Stagger a grid without `:nth-child()` rules, jitter a scatter layout, vary a
|
|
446
|
+
* shimmer's duration per card — one binding, no per-element JS.
|
|
447
|
+
*
|
|
448
|
+
* **Never re-rolled.** It writes on the `const` cadence and sets `gate: false`,
|
|
449
|
+
* so — unlike a gated element source, whose `start` re-runs on every viewport
|
|
450
|
+
* re-entry — scrolling out of view and back can't hand an element a new value
|
|
451
|
+
* mid-animation.
|
|
452
|
+
*
|
|
453
|
+
* **Seeded (deterministic) mode:** `configure({ randomSeed: 42 })` derives every
|
|
454
|
+
* roll from the seed plus the element's position in the DOM, so the same markup
|
|
455
|
+
* renders the same "random" layout on every load, and a rebind hands an element
|
|
456
|
+
* the values it had before. Reordering the tree reshuffles it. Unseeded (the
|
|
457
|
+
* default) rolls come from `Math.random()`.
|
|
458
|
+
*/
|
|
459
|
+
declare const random: Source;
|
|
460
|
+
|
|
400
461
|
/** Every plugin source, for `registerPlugins()` / bulk registration. */
|
|
401
462
|
declare const allPlugins: Source[];
|
|
402
463
|
/**
|
|
@@ -409,4 +470,4 @@ declare const allPlugins: Source[];
|
|
|
409
470
|
*/
|
|
410
471
|
declare function registerPlugins(...sources: Source[]): void;
|
|
411
472
|
|
|
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 };
|
|
473
|
+
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-
|
|
1
|
+
import {a as a$r}from'./chunk-2TNXW2VV.js';export{a as ua}from'./chunk-2TNXW2VV.js';import {a as a$s}from'./chunk-NHEC6UK5.js';export{a as random}from'./chunk-NHEC6UK5.js';import {a as a$j}from'./chunk-FONP6RWO.js';export{a as orientation}from'./chunk-FONP6RWO.js';import {a as a$k}from'./chunk-ILMWSJ5M.js';export{a as motion}from'./chunk-ILMWSJ5M.js';import {a as a$l}from'./chunk-7HKSU2EV.js';export{a as geo}from'./chunk-7HKSU2EV.js';import {a as a$m}from'./chunk-WCZLSJ2Z.js';export{a as cpuPressure}from'./chunk-WCZLSJ2Z.js';import {a as a$n}from'./chunk-KOELKEUS.js';export{a as img}from'./chunk-KOELKEUS.js';import {a as a$o}from'./chunk-7OBG2QQ6.js';export{a as imgColor}from'./chunk-7OBG2QQ6.js';import {a as a$p}from'./chunk-A3CLHLE4.js';export{a as videoColor}from'./chunk-A3CLHLE4.js';import {a as a$q}from'./chunk-AGUPRRD4.js';export{a as truncated}from'./chunk-AGUPRRD4.js';import {a as a$b}from'./chunk-SQIQ6W3B.js';export{a as pointer}from'./chunk-SQIQ6W3B.js';import {a as a$c}from'./chunk-HA25PYSI.js';export{a as pointerLocal}from'./chunk-HA25PYSI.js';import {a as a$d}from'./chunk-QEFUAIXU.js';export{a as media}from'./chunk-QEFUAIXU.js';import {a as a$e}from'./chunk-4IEDDWUY.js';export{a as field}from'./chunk-4IEDDWUY.js';import {a as a$f}from'./chunk-2RNFSOS6.js';export{a as fieldState}from'./chunk-2RNFSOS6.js';import {a as a$g}from'./chunk-BKB5HQTJ.js';export{a as formState}from'./chunk-BKB5HQTJ.js';import'./chunk-QIUPJ6MF.js';import {a as a$h}from'./chunk-VEIGSGIP.js';export{a as select}from'./chunk-VEIGSGIP.js';import {a as a$i}from'./chunk-4WSASU6P.js';export{a as colorInput}from'./chunk-4WSASU6P.js';import'./chunk-A2ETARW3.js';import {a as a$4}from'./chunk-QEBTQYJZ.js';export{a as navType}from'./chunk-QEBTQYJZ.js';import {a as a$5}from'./chunk-D2T22ZDL.js';export{a as meta}from'./chunk-D2T22ZDL.js';import {b}from'./chunk-PIEENX4H.js';export{b as network}from'./chunk-PIEENX4H.js';import {a as a$6}from'./chunk-DGJ45NBZ.js';export{a as battery}from'./chunk-DGJ45NBZ.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-23TUV6HD.js';export{a as visualViewport}from'./chunk-23TUV6HD.js';import {a as a$a}from'./chunk-4H6UVYDJ.js';export{a as keyboard}from'./chunk-4H6UVYDJ.js';import {a as a$t}from'./chunk-CXXDGS7S.js';import'./chunk-AQV7LL54.js';import'./chunk-LTJ2VKVY.js';import'./chunk-7KOHYADG.js';import'./chunk-SHR2C4QU.js';import'./chunk-PFCCKKAU.js';import {a}from'./chunk-NJ4Z3SAN.js';export{a as scrollVelocity}from'./chunk-NJ4Z3SAN.js';import'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import {a as a$1}from'./chunk-UDXHWQBB.js';export{a as online}from'./chunk-UDXHWQBB.js';import {a as a$2}from'./chunk-PSGZ7K22.js';export{a as pageFocused}from'./chunk-PSGZ7K22.js';import {a as a$3}from'./chunk-VX2YFVNN.js';export{a as pageVisible}from'./chunk-VX2YFVNN.js';import'./chunk-ZWS2DFMD.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 chunkYGON2MF3_cjs=require('./chunk-YGON2MF3.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-7AD7LRMF.cjs');Object.defineProperty(exports,"pointer",{enumerable:true,get:function(){return chunkYGON2MF3_cjs.a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as pointer}from'./chunk-SQIQ6W3B.js';import'./chunk-T4N6AEOZ.js';import'./chunk-ZWS2DFMD.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as pointerLocal}from'./chunk-HA25PYSI.js';import'./chunk-T4N6AEOZ.js';import'./chunk-ZWS2DFMD.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkPMDPLPCX_cjs=require('./chunk-PMDPLPCX.cjs');require('./chunk-65MXZJBD.cjs'),require('./chunk-7AD7LRMF.cjs');Object.defineProperty(exports,"pointerLocal",{enumerable:true,get:function(){return chunkPMDPLPCX_cjs.a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk6FYUJK4F_cjs=require('./chunk-6FYUJK4F.cjs');require('./chunk-ADHR4VLZ.cjs'),require('./chunk-65MXZJBD.cjs');Object.defineProperty(exports,"random",{enumerable:true,get:function(){return chunk6FYUJK4F_cjs.a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as random}from'./chunk-NHEC6UK5.js';import'./chunk-7KOHYADG.js';import'./chunk-T4N6AEOZ.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as scrollVelocity}from'./chunk-NJ4Z3SAN.js';import'./chunk-KG3EF456.js';import'./chunk-T4N6AEOZ.js';import'./chunk-LWKH66VY.js';import'./chunk-ZWS2DFMD.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkO3KW7BD7_cjs=require('./chunk-O3KW7BD7.cjs');require('./chunk-EYDIF3NM.cjs'),require('./chunk-65MXZJBD.cjs'),require('./chunk-7L35N3N3.cjs'),require('./chunk-7AD7LRMF.cjs');Object.defineProperty(exports,"scrollVelocity",{enumerable:true,get:function(){return chunkO3KW7BD7_cjs.a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as select}from'./chunk-VEIGSGIP.js';import'./chunk-LTJ2VKVY.js';import'./chunk-7KOHYADG.js';import'./chunk-T4N6AEOZ.js';import'./chunk-ZWS2DFMD.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk3EI2VHWK_cjs=require('./chunk-3EI2VHWK.cjs');require('./chunk-HHINWX7L.cjs'),require('./chunk-ADHR4VLZ.cjs'),require('./chunk-65MXZJBD.cjs'),require('./chunk-7AD7LRMF.cjs');Object.defineProperty(exports,"select",{enumerable:true,get:function(){return chunk3EI2VHWK_cjs.a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as truncated}from'./chunk-AGUPRRD4.js';import'./chunk-AQV7LL54.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkPSEAYJTX_cjs=require('./chunk-PSEAYJTX.cjs');require('./chunk-NAJLRXKX.cjs');Object.defineProperty(exports,"truncated",{enumerable:true,get:function(){return chunkPSEAYJTX_cjs.a}});
|
|
@@ -6,13 +6,25 @@ interface Config {
|
|
|
6
6
|
livePrefix: string;
|
|
7
7
|
/** Prefix for write-once constants. */
|
|
8
8
|
constPrefix: string;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Where global sources write. Typed non-nullable for consumers' sake, but it
|
|
11
|
+
* really is `undefined` without a document — the internals guard it, and so
|
|
12
|
+
* should a custom source that reads it (`ctx.config.root`) outside the browser.
|
|
13
|
+
*/
|
|
10
14
|
root: HTMLElement;
|
|
11
15
|
/**
|
|
12
|
-
* When true, written
|
|
16
|
+
* When true, written properties are registered with `@property`
|
|
13
17
|
* (via `CSS.registerProperty`) as typed, interpolatable custom properties with
|
|
14
|
-
* a guaranteed initial value.
|
|
15
|
-
*
|
|
18
|
+
* a guaranteed initial value. Applies to both cadences — `--const-*` values
|
|
19
|
+
* are registered too, which is what lets string constants like `--const-ua-*`
|
|
20
|
+
* survive typing. Opt in with `configure({ typed: true })` before attaching
|
|
21
|
+
* sources. Off by default.
|
|
22
|
+
*
|
|
23
|
+
* A source's **string** values are only registered when the source declares a
|
|
24
|
+
* `props` entry for them (`ua`, `nav-type`, `color-input`, the colour
|
|
25
|
+
* plugins). Undeclared strings are left untyped rather than registered as the
|
|
26
|
+
* `<number>` default, which would reject the value and compute to `0` — see
|
|
27
|
+
* `meta`, whose property names are discovered at runtime.
|
|
16
28
|
*/
|
|
17
29
|
typed: boolean;
|
|
18
30
|
/**
|
|
@@ -31,6 +43,14 @@ interface Config {
|
|
|
31
43
|
* `fps`/`scroll-velocity` measure at this rate too.
|
|
32
44
|
*/
|
|
33
45
|
liveHz?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Seed for the `random` plugin. When set, each element's rolls are derived from
|
|
48
|
+
* this seed plus the element's position in the DOM instead of `Math.random()`,
|
|
49
|
+
* so the same markup renders the same "random" layout on every load — and a
|
|
50
|
+
* rebind hands an element the values it had before. Unset (the default) means
|
|
51
|
+
* genuinely random per load. Any integer works; `0` is a valid seed.
|
|
52
|
+
*/
|
|
53
|
+
randomSeed?: number;
|
|
34
54
|
}
|
|
35
55
|
/** Optional `@property` typing for a source's local name, used when `typed` is on. */
|
|
36
56
|
interface PropSpec {
|
|
@@ -48,6 +68,12 @@ interface SourceContext {
|
|
|
48
68
|
/**
|
|
49
69
|
* Queue a value for the next batched flush. `localName` is prefixed by cadence
|
|
50
70
|
* (e.g. `write('pointer-x', 12)` → `--live-pointer-x: 12`).
|
|
71
|
+
*
|
|
72
|
+
* Writing the **empty string** removes the property, so a value that stops
|
|
73
|
+
* being meaningful (a `<select>` whose new option isn't numeric) falls back to
|
|
74
|
+
* the consumer's `var(--live-x, …)` again instead of going stale. Under
|
|
75
|
+
* `typed: true` a removed property computes to its registered initial value
|
|
76
|
+
* rather than the `var()` fallback.
|
|
51
77
|
*/
|
|
52
78
|
write(localName: string, value: number | string, cadence?: Cadence): void;
|
|
53
79
|
}
|
|
@@ -6,13 +6,25 @@ interface Config {
|
|
|
6
6
|
livePrefix: string;
|
|
7
7
|
/** Prefix for write-once constants. */
|
|
8
8
|
constPrefix: string;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Where global sources write. Typed non-nullable for consumers' sake, but it
|
|
11
|
+
* really is `undefined` without a document — the internals guard it, and so
|
|
12
|
+
* should a custom source that reads it (`ctx.config.root`) outside the browser.
|
|
13
|
+
*/
|
|
10
14
|
root: HTMLElement;
|
|
11
15
|
/**
|
|
12
|
-
* When true, written
|
|
16
|
+
* When true, written properties are registered with `@property`
|
|
13
17
|
* (via `CSS.registerProperty`) as typed, interpolatable custom properties with
|
|
14
|
-
* a guaranteed initial value.
|
|
15
|
-
*
|
|
18
|
+
* a guaranteed initial value. Applies to both cadences — `--const-*` values
|
|
19
|
+
* are registered too, which is what lets string constants like `--const-ua-*`
|
|
20
|
+
* survive typing. Opt in with `configure({ typed: true })` before attaching
|
|
21
|
+
* sources. Off by default.
|
|
22
|
+
*
|
|
23
|
+
* A source's **string** values are only registered when the source declares a
|
|
24
|
+
* `props` entry for them (`ua`, `nav-type`, `color-input`, the colour
|
|
25
|
+
* plugins). Undeclared strings are left untyped rather than registered as the
|
|
26
|
+
* `<number>` default, which would reject the value and compute to `0` — see
|
|
27
|
+
* `meta`, whose property names are discovered at runtime.
|
|
16
28
|
*/
|
|
17
29
|
typed: boolean;
|
|
18
30
|
/**
|
|
@@ -31,6 +43,14 @@ interface Config {
|
|
|
31
43
|
* `fps`/`scroll-velocity` measure at this rate too.
|
|
32
44
|
*/
|
|
33
45
|
liveHz?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Seed for the `random` plugin. When set, each element's rolls are derived from
|
|
48
|
+
* this seed plus the element's position in the DOM instead of `Math.random()`,
|
|
49
|
+
* so the same markup renders the same "random" layout on every load — and a
|
|
50
|
+
* rebind hands an element the values it had before. Unset (the default) means
|
|
51
|
+
* genuinely random per load. Any integer works; `0` is a valid seed.
|
|
52
|
+
*/
|
|
53
|
+
randomSeed?: number;
|
|
34
54
|
}
|
|
35
55
|
/** Optional `@property` typing for a source's local name, used when `typed` is on. */
|
|
36
56
|
interface PropSpec {
|
|
@@ -48,6 +68,12 @@ interface SourceContext {
|
|
|
48
68
|
/**
|
|
49
69
|
* Queue a value for the next batched flush. `localName` is prefixed by cadence
|
|
50
70
|
* (e.g. `write('pointer-x', 12)` → `--live-pointer-x: 12`).
|
|
71
|
+
*
|
|
72
|
+
* Writing the **empty string** removes the property, so a value that stops
|
|
73
|
+
* being meaningful (a `<select>` whose new option isn't numeric) falls back to
|
|
74
|
+
* the consumer's `var(--live-x, …)` again instead of going stale. Under
|
|
75
|
+
* `typed: true` a removed property computes to its registered initial value
|
|
76
|
+
* rather than the `var()` fallback.
|
|
51
77
|
*/
|
|
52
78
|
write(localName: string, value: number | string, cadence?: Cadence): void;
|
|
53
79
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as ua}from'./chunk-2TNXW2VV.js';import'./chunk-7KOHYADG.js';import'./chunk-SHR2C4QU.js';import'./chunk-PFCCKKAU.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkZHPDCMOZ_cjs=require('./chunk-ZHPDCMOZ.cjs');require('./chunk-ADHR4VLZ.cjs'),require('./chunk-34XDO4K2.cjs'),require('./chunk-CBWMRF63.cjs');Object.defineProperty(exports,"ua",{enumerable:true,get:function(){return chunkZHPDCMOZ_cjs.a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as videoColor}from'./chunk-A3CLHLE4.js';import'./chunk-A2ETARW3.js';import'./chunk-LTJ2VKVY.js';import'./chunk-7KOHYADG.js';import'./chunk-ZWS2DFMD.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk6LH6U5QE_cjs=require('./chunk-6LH6U5QE.cjs');require('./chunk-A6JDSQWH.cjs'),require('./chunk-HHINWX7L.cjs'),require('./chunk-ADHR4VLZ.cjs'),require('./chunk-7AD7LRMF.cjs');Object.defineProperty(exports,"videoColor",{enumerable:true,get:function(){return chunk6LH6U5QE_cjs.a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as visualViewport}from'./chunk-23TUV6HD.js';import'./chunk-7KOHYADG.js';import'./chunk-T4N6AEOZ.js';import'./chunk-ZWS2DFMD.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkII5RRRIW_cjs=require('./chunk-II5RRRIW.cjs');require('./chunk-ADHR4VLZ.cjs'),require('./chunk-65MXZJBD.cjs'),require('./chunk-7AD7LRMF.cjs');Object.defineProperty(exports,"visualViewport",{enumerable:true,get:function(){return chunkII5RRRIW_cjs.a}});
|
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
|
|
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
|
|
@@ -139,7 +148,7 @@ Import name is camelCase; the key for `propsFor`/`data-props-for` is the dashed
|
|
|
139
148
|
| `pointerLocal` | `pointer-local` | element | `--live-local-pointer-x-ratio`, `--live-local-pointer-y-ratio` (0–1 within the element), `--live-local-pointer-inside` (1/0) |
|
|
140
149
|
| `media` | `media` | element | `--live-current-time`, `--live-duration`, `--live-progress` (0–1), `--live-paused` (1/0), `--live-volume` (0–1) |
|
|
141
150
|
| `field` | `field` | element | `--live-length`, `--live-empty` (1/0), `--live-valid` (1/0); per-reason validity flags (each 1/0) `--live-value-missing`, `--live-type-mismatch`, `--live-pattern-mismatch`, `--live-too-long`, `--live-too-short`, `--live-range-underflow`, `--live-range-overflow`, `--live-step-mismatch`, `--live-bad-input`, `--live-custom-error`; and with `maxlength`: `--live-remaining`, `--live-fill-pct` (0–1) |
|
|
142
|
-
| `select` | `select` | element | `--live-index` (selectedIndex, -1 if none), `--live-option-count`, `--live-index-pct` (0–1), `--live-value-num` (numeric value only), `--live-selected-count`, `--live-selected-pct` (0–1, counts a `<select multiple>` CSS can't tally). Bind the `<select>` or a container. |
|
|
151
|
+
| `select` | `select` | element | `--live-index` (selectedIndex, -1 if none), `--live-option-count`, `--live-index-pct` (0–1), `--live-value-num` (numeric value only; removed again when the value is non-numeric), `--live-selected-count`, `--live-selected-pct` (0–1, counts a `<select multiple>` CSS can't tally). Bind the `<select>` or a container. |
|
|
143
152
|
| `colorInput` | `color-input` | element | `--live-color` (the `<input type="color">` value as sRGB hex; typed mode registers it `<color>`). Bind the input or a container. |
|
|
144
153
|
| `fieldState` | `field-state` | element | form interaction history (all 1/0): `--live-dirty`/`--live-pristine` (user has edited it; latches), `--live-touched`/`--live-untouched` (blurred at least once; latches), `--live-changed` (current value ≠ mount value; un-latches), `--live-submitted` (owning `<form>` submitted). Bind a single field for its state, or a `<form>`/wrapper for the aggregate over all its fields. |
|
|
145
154
|
| `formState` | `form-state` | element | form-level validity/completion CSS can't count: `--live-field-count`, `--live-valid-count`, `--live-invalid-count`, `--live-all-valid` (1/0 submit gate), `--live-completion` (0–1, valid required ÷ required). Bind a `<form>`/wrapper. |
|
|
@@ -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
|
|
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
package/dist/battery-CDMJLP4C.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as battery}from'./chunk-DQJQEWPS.js';import'./chunk-T4N6AEOZ.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunk7CDVAP3H_cjs=require('./chunk-7CDVAP3H.cjs');require('./chunk-65MXZJBD.cjs');Object.defineProperty(exports,"battery",{enumerable:true,get:function(){return chunk7CDVAP3H_cjs.a}});
|
package/dist/chunk-2E2JQAHI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/dist/chunk-2H5YFW6O.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var n={nominal:0,fair:1,serious:2,critical:3},o={key:"cpu-pressure",scope:"global",start(r){let s=globalThis.PressureObserver;if(!s)return ()=>{};r.write("cpu-pressure",0);let e;try{e=new s(t=>{let c=t[t.length-1];c&&r.write("cpu-pressure",n[c.state]??0);}),e.observe("cpu",{sampleInterval:1e3}).catch(()=>{});}catch{e=void 0;}return ()=>e?.disconnect()}};exports.a=o;
|