@rogieking/figui3 4.15.10 → 5.1.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.
@@ -70,9 +70,9 @@ export default defineConfig({
70
70
 
71
71
  ### React + color picker modes (`fig-input-color` / `fig-fill-picker`)
72
72
 
73
- - `fig-input-color` supports custom mode workflows only through `picker="figma"` (internally uses `fig-fill-picker`).
74
- - The `mode` attribute on `fig-input-color` is pass-through to inner `fig-fill-picker`; mode logic lives in `fig-fill-picker`.
75
- - `picker-*` attrs on `fig-input-color` are forwarded to `fig-fill-picker` (except `picker-anchor`, which is handled separately).
73
+ - `fig-fill-picker` is optional. Import `fig-editor.js` and `fig-editor.css` when full picker behavior is needed.
74
+ - Do not use `picker` or `picker-anchor` on `fig-input-color`; components auto-detect `fig-fill-picker` at interaction time.
75
+ - `picker-*` attrs on `fig-input-color` are forwarded to `fig-fill-picker` only when the optional picker is registered.
76
76
  - Example: `picker-dialog-position`, `picker-experimental`, etc.
77
77
  - For React custom modes, use `fig-fill-picker` + slot API:
78
78
  - Add a child with `slot="mode-<name>"` (and optional `label`).
@@ -87,9 +87,6 @@ export default defineConfig({
87
87
  - Preserve value shape expectations:
88
88
  - `fig-input-color` expects solid color data (`detail.color`, optional `detail.alpha`) from the picker.
89
89
  - `fig-fill-picker` custom modes use JSON with `type` set to mode name and remaining data in payload.
90
- - Keep `picker-anchor` behavior explicit in React:
91
- - `picker-anchor="self"` anchors to the color input element itself.
92
- - Selector values anchor to another DOM element (resolved via `document.querySelector`).
93
90
 
94
91
  ## Experimental Attribute Guidance
95
92
 
@@ -100,8 +97,8 @@ export default defineConfig({
100
97
  - `fig-input-color` and `fig-input-fill` forward experimental-related picker settings into internal `fig-fill-picker` usage.
101
98
  - Avoid adding hidden implicit defaults that enable experimental behavior globally.
102
99
  - Backward-compat rule:
103
- - Do not reintroduce `variant="neue"` for dropdown experimental behavior.
104
- - Keep `variant="neue"` handling only where it is still intentionally supported (for example slider visuals).
100
+ - Do not reintroduce the old `neue` variant name for dropdown experimental behavior.
101
+ - Use `variant="classic"` only when a slider needs the previous visual style.
105
102
  - Documentation rule: any new experimental token must be documented with activation syntax, intended scope, and fallback behavior in demos + README + changelog.
106
103
 
107
104
  ## Critical Rules
@@ -107,11 +107,11 @@ bootstrap();
107
107
  - Use `type="hue"` only for hue selection workflows.
108
108
  - Use `type="stepper"` for discrete snap points (include a `datalist` with valid stops).
109
109
  - Use `type="delta"` for offset/relative adjustments around a neutral point (typically include `default`, and often symmetric min/max).
110
- - Prefer `text="true"` for precision-critical properties; omit it for compact/simplified rows.
110
+ - Text input is shown by default; use `text="false"` only for compact/simplified rows.
111
111
  - Use `transform` when internal value scale differs from UI display (example: internal `0..1`, display `0..100%`).
112
112
  - Variants:
113
113
  - Default variant for most property panels.
114
- - `variant="neue"` for a compact, visually quieter style.
114
+ - `variant="classic"` only when the previous slider appearance is needed.
115
115
  - Always set explicit `min`, `max`, and `step` (and `units` where applicable) to keep behavior predictable.
116
116
 
117
117
  ### Control Selection Heuristics
@@ -175,7 +175,7 @@ Use a horizontal fig-field, with a fig-slider, min=0 max=100 text=true units=%.
175
175
  </fig-field>
176
176
  <fig-field direction="horizontal">
177
177
  <label>Hue</label>
178
- <fig-slider type="hue" value="180" text="true" variant="neue" full></fig-slider>
178
+ <fig-slider type="hue" value="180" text="true" full></fig-slider>
179
179
  </fig-field>
180
180
  <fig-field direction="horizontal">
181
181
  <label>Offset</label>
package/README.md CHANGED
@@ -32,6 +32,13 @@ import "@rogieking/figui3/fig.css";
32
32
  import "@rogieking/figui3/fig.js";
33
33
  ```
34
34
 
35
+ Opt into the full Figma-style fill picker when you need it:
36
+
37
+ ```js
38
+ import "@rogieking/figui3/fig-editor.css";
39
+ import "@rogieking/figui3/fig-editor.js";
40
+ ```
41
+
35
42
  Or use a CDN:
36
43
 
37
44
  ```html
@@ -44,7 +51,7 @@ Minimal example:
44
51
  ```html
45
52
  <fig-field direction="horizontal">
46
53
  <label>Color</label>
47
- <fig-input-color value="#FF5733" text="true" alpha="true"></fig-input-color>
54
+ <fig-input-color value="#FF5733" text="true"></fig-input-color>
48
55
  </fig-field>
49
56
  <fig-button variant="primary">Save</fig-button>
50
57
  ```
@@ -237,21 +244,21 @@ Minimal example:
237
244
  | `max` | number | `100` | Maximum |
238
245
  | `step` | number | `1` | Step increment |
239
246
  | `default` | number | — | Default/reset value (shown as marker) |
240
- | `text` | boolean | `false` | Show text input |
247
+ | `text` | boolean | `true` | Show text input; set `text="false"` to hide |
241
248
  | `placeholder` | string | `"##"` | Text input placeholder |
242
249
  | `units` | string | — | Unit label (e.g. `"%"`, `"px"`) |
243
250
  | `transform` | number | — | Display value multiplier |
244
251
  | `color` | string | — | Track color (opacity type) |
245
- | `variant` | string | — | Visual variant (e.g. `"neue"`) |
252
+ | `variant` | string | — | Use `"classic"` to opt into the previous slider appearance |
246
253
  | `precision` | number | — | Decimal places for output |
247
254
  | `disabled` | boolean | `false` | Disabled state |
248
255
 
249
256
  **Events:** `input` (continuous), `change` (on release).
250
257
 
251
258
  ```html
252
- <fig-slider min="0" max="100" value="50" text="true" units="%"></fig-slider>
253
- <fig-slider type="hue" value="180"></fig-slider>
254
- <fig-slider type="opacity" value="75" color="#FF5733" text="true" units="%"></fig-slider>
259
+ <fig-slider min="0" max="100" value="50" units="%"></fig-slider>
260
+ <fig-slider type="hue" value="180" text="false"></fig-slider>
261
+ <fig-slider type="opacity" value="75" color="#FF5733" units="%"></fig-slider>
255
262
  ```
256
263
 
257
264
  ---
@@ -271,7 +278,7 @@ Wraps a `<fig-field>` and `<fig-slider>` into a single labeled control. All slid
271
278
  **Events:** `input`, `change` — forwarded from the inner slider.
272
279
 
273
280
  ```html
274
- <fig-field-slider label="Opacity" min="0" max="100" value="75" text="true" units="%"></fig-field-slider>
281
+ <fig-field-slider label="Opacity" min="0" max="100" value="75" units="%"></fig-field-slider>
275
282
  ```
276
283
 
277
284
  ---
@@ -378,7 +385,7 @@ A color/gradient/image swatch element with checkerboard background for alpha.
378
385
 
379
386
  `<fig-color-tip>` — [demo](https://rog.ie/figui3/#color-tip)
380
387
 
381
- A compact solid-color swatch that wraps `<fig-fill-picker>`. Used inside gradient handles and other controls.
388
+ A compact solid-color swatch. Uses `<fig-fill-picker>` when the optional picker is registered, otherwise falls back to the native color input.
382
389
 
383
390
  | Attribute | Type | Default | Description |
384
391
  |---|---|---|---|
@@ -412,10 +419,10 @@ A compact solid-color swatch that wraps `<fig-fill-picker>`. Used inside gradien
412
419
  |---|---|---|---|
413
420
  | `value` | string | — | Hex color (e.g. `"#FF5733"` or `"#FF573380"`) |
414
421
  | `text` | boolean | `false` | Show hex text input |
415
- | `alpha` | boolean | `false` | Show alpha slider |
416
- | `picker` | string | `"native"` | `"native"`, `"figma"`, `"false"` |
422
+ | `alpha` | boolean | `true` | Show alpha slider; set `alpha="false"` to hide opacity controls |
417
423
  | `mode` | string | — | Color mode (`"hex"`, `"rgb"`, `"hsl"`) |
418
424
  | `experimental` | string | — | Feature flags |
425
+ | `picker-*` | string | — | Forwarded to `<fig-fill-picker>` when the optional picker is registered |
419
426
  | `disabled` | boolean | `false` | Disabled state |
420
427
 
421
428
  **Events:**
@@ -426,10 +433,11 @@ A compact solid-color swatch that wraps `<fig-fill-picker>`. Used inside gradien
426
433
  | `change` | `{ color, alpha, hsv: { h, s, v, a } }` |
427
434
 
428
435
  ```html
429
- <fig-input-color value="#FF5733" text="true" alpha="true"></fig-input-color>
430
- <fig-input-color value="#FF5733" text="true" alpha="true" picker="figma"></fig-input-color>
436
+ <fig-input-color value="#FF5733" text="true"></fig-input-color>
431
437
  ```
432
438
 
439
+ When `fig-editor.js` is imported, swatch activation opens `<fig-fill-picker>`. Without it, the native color input is used.
440
+
433
441
  ---
434
442
 
435
443
  #### Input Palette
@@ -465,15 +473,15 @@ An editable palette of solid colors, each rendered as a `<fig-input-color>` swat
465
473
 
466
474
  `<fig-input-gradient>`
467
475
 
468
- A gradient editor with draggable stops. Opens `<fig-fill-picker>` locked to gradient mode.
476
+ A gradient editor with draggable stops. With `edit="picker"` and the optional picker registered, it opens `<fig-fill-picker>` locked to gradient mode; otherwise it falls back to inline stop editing.
469
477
 
470
478
  | Attribute | Type | Default | Description |
471
479
  |---|---|---|---|
472
480
  | `value` | string | — | JSON gradient fill data |
481
+ | `edit` | boolean/string | `true` | `true`, `false`, or `"picker"` |
473
482
  | `disabled` | boolean | `false` | Disabled state |
474
483
  | `experimental` | string | — | Picker feature flags |
475
484
  | `picker-*` | string | — | Passthrough picker attributes |
476
- | `picker-anchor` | string | `"self"` | Anchor selector or `"self"` |
477
485
 
478
486
  Supported interpolation spaces: `srgb`, `srgb-linear`, `display-p3`, `oklab`, `oklch` (with `hueInterpolation`: `shorter`, `longer`, `increasing`, `decreasing`).
479
487
 
@@ -496,7 +504,7 @@ Supported interpolation spaces: `srgb`, `srgb-linear`, `display-p3`, `oklab`, `o
496
504
 
497
505
  `<fig-input-fill>` — [demo](https://rog.ie/figui3/#fill-input)
498
506
 
499
- A comprehensive fill input supporting solid, gradient, image, and video fills.
507
+ A comprehensive fill input supporting solid, gradient, image, and video fills. Without the optional picker, it renders a passive preview.
500
508
 
501
509
  | Attribute | Type | Default | Description |
502
510
  |---|---|---|---|
@@ -505,6 +513,7 @@ A comprehensive fill input supporting solid, gradient, image, and video fills.
505
513
  | `mode` | string | — | Lock to a fill mode |
506
514
  | `experimental` | string | — | Feature flags |
507
515
  | `alpha` | boolean | `true` | Show alpha controls |
516
+ | `picker-*` | string | — | Forwarded to `<fig-fill-picker>` when the optional picker is registered |
508
517
 
509
518
  **Events:**
510
519
 
@@ -523,7 +532,7 @@ A comprehensive fill input supporting solid, gradient, image, and video fills.
523
532
 
524
533
  `<fig-fill-picker>` — [demo](https://rog.ie/figui3/#fill-picker)
525
534
 
526
- Full fill picker dialog supporting solid, gradient, image, video, and webcam. Wraps a trigger element (e.g. `<fig-chit>`).
535
+ Optional full fill picker dialog supporting solid, gradient, image, video, and webcam. Import `fig-editor.js` and `fig-editor.css` to register and style it.
527
536
 
528
537
  | Attribute | Type | Default | Description |
529
538
  |---|---|---|---|
@@ -693,14 +702,14 @@ A transform-origin grid control with a draggable handle and optional X/Y percent
693
702
 
694
703
  `<fig-easing-curve>`
695
704
 
696
- An interactive bezier or spring easing curve editor with draggable control points and an optional preset dropdown.
705
+ An interactive bezier or spring easing curve editor with a preset dropdown and manual value input.
697
706
 
698
707
  | Attribute | Type | Default | Description |
699
708
  |---|---|---|---|
700
709
  | `value` | string | — | Bezier: `"0.42, 0, 0.58, 1"` or Spring: `"spring(200, 15, 1)"` |
701
710
  | `precision` | number | `2` | Decimal places |
702
711
  | `aspect-ratio` | string | — | Editor aspect ratio |
703
- | `dropdown` | boolean | `false` | Show preset dropdown |
712
+ | `edit` | boolean | `true` | Show the editor and custom bezier/spring options; set to `"false"` for preset-only |
704
713
 
705
714
  **Static:** `FigEasingCurve.PRESETS` — built-in preset array. `FigEasingCurve.curveIcon(value)` — SVG icon helper.
706
715
 
@@ -712,8 +721,8 @@ An interactive bezier or spring easing curve editor with draggable control point
712
721
  | `change` | `{ mode, value, cssValue, preset }` — on release |
713
722
 
714
723
  ```html
715
- <fig-easing-curve value="0.42, 0, 0.58, 1" dropdown="true"></fig-easing-curve>
716
- <fig-easing-curve value="spring(200, 15, 1)"></fig-easing-curve>
724
+ <fig-easing-curve value="0.42, 0, 0.58, 1"></fig-easing-curve>
725
+ <fig-easing-curve value="spring(200, 15, 1)" edit="false"></fig-easing-curve>
717
726
  ```
718
727
 
719
728
  ---
@@ -765,8 +774,8 @@ A draggable handle element. Positioned on a `drag-surface` container with axis c
765
774
  | `drag-surface` | string | — | CSS selector for drag container (defaults to parent) |
766
775
  | `drag-axes` | string | `"xy"` | Constrain axes: `"x"`, `"y"`, `"xy"` |
767
776
  | `drag-snapping` | string | — | Snapping behavior |
768
- | `type` | string | — | `"color"` for color handle with direct solid color picker |
769
- | `color-tip` | boolean | `false` | For `type="color"`, use the compact `fig-color-tip` interaction instead of opening the picker directly |
777
+ | `type` | string | — | `"color"` for a color handle with direct picker activation |
778
+ | `color-tip` | boolean | `false` | For `type="color"`, use the compact `fig-color-tip` interaction instead of direct activation |
770
779
  | `control` | string | — | `"add"` or `"remove"` delegated to color tip |
771
780
  | `hit-area` | string | — | Expanded interaction zone (unitless px). `"8"`, `"8 12"` (v h), or `"8 circle"` |
772
781
  | `hit-area-mode` | string | `"handle"` | `"handle"` proxies to handle drag/select; `"delegate"` emits `hitareadown` event |
@@ -856,7 +865,7 @@ A form field wrapper with flexible layout. Automatically links `<label>` to the
856
865
  ```html
857
866
  <fig-field direction="horizontal" columns="thirds">
858
867
  <label>Opacity</label>
859
- <fig-slider value="50" text="true" units="%"></fig-slider>
868
+ <fig-slider value="50" units="%"></fig-slider>
860
869
  </fig-field>
861
870
  ```
862
871
 
@@ -1007,6 +1016,7 @@ A thin styled layer for arbitrary visual content. Use it for generated previews,
1007
1016
 
1008
1017
  | Attribute | Type | Default | Description |
1009
1018
  |---|---|---|---|
1019
+ | `fit` | string | `contain` | Object fit for direct media children |
1010
1020
  | `full` | boolean | `false` | Stretch to the available width |
1011
1021
  | `checkerboard` | boolean | `false` | Show checkerboard behind transparent content |
1012
1022
 
@@ -1238,7 +1248,7 @@ function ColorPicker({ value, onChange }) {
1238
1248
  if (ref.current) ref.current.setAttribute('value', value);
1239
1249
  }, [value]);
1240
1250
 
1241
- return <fig-input-color ref={ref} text="true" alpha="true" picker="figma" />;
1251
+ return <fig-input-color ref={ref} text="true" alpha="true" />;
1242
1252
  }
1243
1253
  ```
1244
1254
 
@@ -1298,10 +1308,12 @@ npm run build:css # Build minified CSS only
1298
1308
 
1299
1309
  | Source | Minified | Tool |
1300
1310
  |---|---|---|
1301
- | `fig.js` (416 KB) | `dist/fig.js` (228 KB) | Bun `--minify` |
1302
- | `fig.css` (133 KB) | `dist/fig.css` (102 KB) | lightningcss `--minify --nesting --bundle` |
1303
- | `base.css` (1.9 KB) | `dist/base.css` (1.5 KB) | lightningcss |
1304
- | `components.css` (131 KB) | `dist/components.css` (100 KB) | lightningcss |
1311
+ | `fig.js` (413 KB) | `dist/fig.js` (223 KB) | Bun `--minify` |
1312
+ | `fig-editor.js` (67 KB) | `dist/fig-editor.js` (37 KB) | Bun `--minify` |
1313
+ | `fig.css` | `dist/fig.css` (102 KB) | lightningcss `--minify --nesting --bundle` |
1314
+ | `components.css` (130 KB) | `dist/components.css` (100 KB) | lightningcss |
1315
+ | `fig-editor.css` (6 KB) | `dist/fig-editor.css` (4 KB) | lightningcss |
1316
+ | `base.css` (2 KB) | `dist/base.css` (2 KB) | lightningcss |
1305
1317
 
1306
1318
  Default imports resolve to minified `dist/` files. Unminified source is available via `@rogieking/figui3/src/*`:
1307
1319