@zakkster/lite-ui-fx 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/README.md +288 -212
- package/UIFX-RECIPE-GUIDE.md +32 -0
- package/UIFXController.d.ts +42 -2
- package/UIFXController.js +165 -26
- package/UIFXRecipes.js +51 -24
- package/llms.txt +36 -7
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @zakkster/lite-ui-fx
|
|
2
2
|
> Canvas-hijacked UI components with pluggable recipe system. 56 built-in recipes.
|
|
3
3
|
|
|
4
|
-
VERSION 1.
|
|
4
|
+
VERSION 1.8.0
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
npm i @zakkster/lite-ui-fx
|
|
@@ -54,10 +54,24 @@ text // visible canvas label; falls back to label, then the recipe default
|
|
|
54
54
|
font // canvas font string; falls back to the recipe's historical font
|
|
55
55
|
knobMode // KNOB only: 'rotate' | 'vertical' pointer mapping (default 'rotate'); wrong type throws
|
|
56
56
|
announce // PROGRESS only: opt-in aria-live announcements at 10% steps; wrong type throws
|
|
57
|
-
//
|
|
57
|
+
ticker // U5 host clock: a caller-supplied lite-ticker ({ add(fn)->removeFn }) drives this component
|
|
58
|
+
driven // U5 host clock: boolean; true = no ticker/RAF, the host calls instance.tick(dtMs)
|
|
59
|
+
// decorateUIFX accepts a SUBSET: padding, seed, colors, theme, text, font -- PLUS
|
|
60
|
+
// the host-clock keys ticker/driven (a decoration wants clock control too). The
|
|
58
61
|
// hijack-only keys (width/height/value/checked/disabled/knobMode/announce/label)
|
|
59
62
|
// throw in decorate mode -- geometry comes from the host, value is read from it.
|
|
60
63
|
|
|
64
|
+
## Host clock (U5) -- three mutually-exclusive modes, both mount modes
|
|
65
|
+
// default (neither option): the shared ref-counted ticker -- one RAF for all
|
|
66
|
+
// components, byte-identical to earlier versions.
|
|
67
|
+
// { ticker: t }: a caller-supplied lite-ticker drives this component. destroy()
|
|
68
|
+
// removes the component's frame but NEVER destroys the caller's ticker.
|
|
69
|
+
const inst = mountUIFX(container, UIType.SLIDER, SparkSlider, { ticker: myTicker });
|
|
70
|
+
// { driven: true }: no ticker/RAF at all; the host drives each frame by hand.
|
|
71
|
+
const d = mountUIFX(container, UIType.BUTTON, MagneticButton, { driven: true });
|
|
72
|
+
d.tick(16.7); // one frame; the SAME body the ticker would call. throws when NOT driven.
|
|
73
|
+
// Passing both, a non-boolean driven, or a ticker without .add() throws (fail closed).
|
|
74
|
+
|
|
61
75
|
## Element Types
|
|
62
76
|
UIType.TOGGLE -> <input type="checkbox" role="switch"> -> state.toggled, onToggle(checked)
|
|
63
77
|
UIType.BUTTON -> <button> -> state.active, onClick(x, y, state)
|
|
@@ -69,8 +83,13 @@ UIType.KNOB -> <input type="range"> -> state.val, arrows native + knobMode p
|
|
|
69
83
|
RECIPE_META.type 'decorate' routes mountRecipe to decorateUIFX. State: focused + text + valid.
|
|
70
84
|
|
|
71
85
|
## State Object (provided to tick every frame)
|
|
72
|
-
{ hover, active, focused, toggled, indeterminate, disabled, val, w, h, padding, dpr
|
|
73
|
-
|
|
86
|
+
{ hover, active, focused, toggled, indeterminate, disabled, val, w, h, padding, dpr,
|
|
87
|
+
reducedMotion, budget }
|
|
88
|
+
// reducedMotion (U5): boolean, true when the user prefers reduced motion; a
|
|
89
|
+
// calm-path recipe renders statically when set (RECIPE_META.motionSafe marks which).
|
|
90
|
+
// budget (U5): 0..1 frame budget, 1 at ~60fps, lower as frames lengthen; budget-aware
|
|
91
|
+
// recipes shed work (particles/glow) when it drops.
|
|
92
|
+
// decorate mode also adds: text (host value string), valid (host validity boolean).
|
|
74
93
|
|
|
75
94
|
## 56 Built-in Recipes
|
|
76
95
|
|
|
@@ -123,9 +142,19 @@ See UIFX-RECIPE-GUIDE.md (included in package).
|
|
|
123
142
|
Gated per recipe by the t3-frame-alloc torture tier (default AND themed mount).
|
|
124
143
|
- Themeable: all 56 recipes honour { colors, theme:{light,mid,dark}, text, font },
|
|
125
144
|
resolved once in init (zero per-frame alloc). RECIPE_META.themeable is true for
|
|
126
|
-
all 56
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
all 56. A bare mount is byte-identical to pre-theming. Shipped palettes + APCA
|
|
146
|
+
contrast are authored with @zakkster/lite-hueforge (a dev-only tool, never a
|
|
147
|
+
runtime dependency).
|
|
148
|
+
- U5 host clock: mount { ticker } to ride a caller-supplied lite-ticker (destroy
|
|
149
|
+
never destroys the caller's clock) or { driven:true } to drive instance.tick(dtMs)
|
|
150
|
+
by hand (no RAF); omit both for the shared ref-counted ticker. Default byte-identical.
|
|
151
|
+
- U5 reduced motion: state.reducedMotion (matchMedia, watched) makes calm-path
|
|
152
|
+
recipes render statically -- ErrorShake stops shaking, SwarmToggle/SuccessBloom/
|
|
153
|
+
FocusHalo drop their motion. RECIPE_META.motionSafe is true for EXACTLY the
|
|
154
|
+
recipes that ship a calm path (SwarmToggle + the 5 decorate recipes today; the
|
|
155
|
+
rest honestly false until each lands one). mountRecipe warns (not throws) mounting
|
|
156
|
+
a motionSafe:false recipe under active reduce. state.budget (0..1) lets budget-aware
|
|
157
|
+
recipes shed work before frames drop.
|
|
129
158
|
- U4a element types: CHECKBOX (indeterminate), PROGRESS (setValue-driven, aria-live
|
|
130
159
|
opt-in), KNOB (knobMode pointer map); setValue/setChecked sync native+state+hook once.
|
|
131
160
|
- U4b decorate mode (decorateUIFX): a canvas AROUND a live element -- no hijack, no
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakkster/lite-ui-fx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Canvas-hijacked UI components with a pluggable recipe system. 50 built-in recipes across toggles, buttons, sliders, knobs, loaders, checkboxes, counters, and ratings.",
|
|
5
5
|
"author": "Zahary Shinikchiev <shinikchiev@yahoo.com>",
|
|
6
6
|
"license": "MIT",
|