@rogieking/figui3 9.3.0 → 9.4.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.
@@ -2,8 +2,8 @@
2
2
  name: fig-lab
3
3
  description: >-
4
4
  Guides FigUI3 experimental Lab components: fig-canvas-control,
5
- fig-input-wheel, fig-reorder, and AI composer components, including React JSX usage.
6
- APIs are unstable.
5
+ fig-input-audio, fig-input-wheel, fig-reorder, and AI composer components,
6
+ including React JSX usage. APIs are unstable.
7
7
  user-invocable: false
8
8
  ---
9
9
 
@@ -22,4 +22,4 @@ import "@rogieking/figui3/fig-lab.css";
22
22
  import "@rogieking/figui3/fig-lab.js";
23
23
  ```
24
24
 
25
- Use Lab for canvas handles, wheel inputs, reorder behavior, and AI composition surfaces. Keep Lab out of `fig.js`.
25
+ Use Lab for audio and wheel inputs, canvas handles, reorder behavior, and AI composition surfaces. Keep Lab out of `fig.js`.
@@ -5,6 +5,26 @@ Experimental. APIs may change. React contract: [../figui3/react.md](../figui3/re
5
5
 
6
6
  Handlers below assume `onInput` / `onChange` from the React contract.
7
7
 
8
+ ## Inputs
9
+
10
+ ### `fig-input-audio`
11
+
12
+ ```tsx
13
+ <fig-input-audio
14
+ accepts="audio/*"
15
+ label="Upload audio"
16
+ full
17
+ onInput={onInput}
18
+ onChange={onChange}
19
+ />
20
+ ```
21
+
22
+ - Single-file waveform preview; no playback or seeking.
23
+ - Attrs: `url`, `filename`, `label`, `accepts`, `variant`, `disabled`, `full`.
24
+ - Props: `files`, `value`. Method: `clear()`.
25
+ - `input` and `change` bubble with `{ files }`; clear adds `{ cleared: true }`.
26
+ - URL previews require CORS access.
27
+
8
28
  ## Spatial
9
29
 
10
30
  ### `fig-canvas-control`
@@ -62,8 +82,8 @@ useEffect(() => {
62
82
  }, [onReorder]);
63
83
  ```
64
84
 
65
- - `display: contents`. Reorders **direct children**. `axis` `vertical` | `horizontal`. Omit `handle` to drag whole rows; set it when rows contain sliders/handles.
66
- - Event `reorder`: `{ oldIndex, newIndex, item }`. Nested drag is ignored for sliders, handles, and canvas controls.
85
+ - `display: contents`. Reorders **direct children**. `axis` `vertical` | `horizontal`. `items` selector limits which children reorder (e.g. `items=".row"` to skip headers); `refresh()` re-syncs. Omit `handle` to drag whole rows; set it when rows contain sliders/handles.
86
+ - Event `reorder`: `{ oldIndex, newIndex, item }` (indices among matching items). Nested drag is ignored for sliders, handles, and canvas controls.
67
87
 
68
88
  ## AI composer
69
89
 
@@ -2,6 +2,24 @@
2
2
 
3
3
  React recipes: [components.md](components.md).
4
4
 
5
+ ## `fig-input-audio`
6
+
7
+ Single-audio upload with a responsive, preview-only waveform.
8
+
9
+ - Attrs: `url`, `filename`, `label` (default `Upload audio`), `accepts` (default `audio/*`), `variant`, `disabled`, `full`
10
+ - Props: `files`, `value`
11
+ - Method: `clear()`
12
+ - Events: `input` and `change`, bubbling and composed, with `{ files }` and optional `cleared`
13
+ - Clicking the waveform replaces the file; the minus action removes it
14
+ - URL decoding requires CORS; fetch and decode failures fall back quietly
15
+ - CSS: `--fig-input-audio-waveform-stroke-width` controls bar thickness (default `2px`)
16
+ - Not supported: multiple files, playback, or seeking
17
+
18
+ ```html
19
+ <fig-input-audio></fig-input-audio>
20
+ <fig-input-audio url="https://example.com/audio.wav" filename="audio.wav" full></fig-input-audio>
21
+ ```
22
+
5
23
  ## `fig-input-wheel`
6
24
 
7
25
  Standalone interactive SVG tick + handle scrubber in the lab bundle.
@@ -37,9 +55,11 @@ Types: `point`, `color`, `point-radius`, `point-radius-angle`, `point-point`.
37
55
 
38
56
  ## `fig-reorder`
39
57
 
40
- Observed: `axis`, `handle`, `disabled`.
58
+ Observed: `axis`, `handle`, `items`, `disabled`.
59
+
60
+ `items`: CSS selector for which direct children are reorderable (default: all). Non-matching children stay in place and get `role="none"` unless they have a role. Class/attribute changes on children re-sync automatically; call `refresh()` to force it.
41
61
 
42
- Event `reorder`: `{ oldIndex, newIndex, item }`.
62
+ Event `reorder`: `{ oldIndex, newIndex, item }`. Indices count matching items, not DOM positions.
43
63
 
44
64
  Nested drag is ignored for sliders, handles, and canvas controls so inner gestures still work. If a row is still stolen, set `handle` to a drag-affordance selector.
45
65
 
@@ -3,8 +3,8 @@ name: figui3
3
3
  description: >-
4
4
  Guides FigUI3 core (`fig.js` / `fig.css`) web components for Figma-style plugin UIs,
5
5
  including React JSX usage. Use when adding, using, or debugging fig-* elements from
6
- the core bundle—buttons, fields, overlays, menus, sliders, color/fill inputs, media,
7
- dialogs, popups, toasts. Not for fig-select or fig-fill-picker (fig-editor),
6
+ the core bundle—buttons, fields, overlays, menus, toolbelts, sliders, color/fill inputs,
7
+ media, dialogs, popups, toasts. Not for fig-select or fig-fill-picker (fig-editor),
8
8
  user-invocable: false
9
9
  ---
10
10
 
@@ -368,6 +368,33 @@ Handlers below assume `onInput` / `onChange` / `onClick` from [react.md](react.m
368
368
  <fig-content>Body</fig-content>
369
369
  ```
370
370
 
371
+ ### `fig-toolbelt` / `fig-toolbelt-group` / `fig-toolbelt-item`
372
+
373
+ ```tsx
374
+ <fig-toolbelt
375
+ layout="horizontal"
376
+ overflow="buttons"
377
+ value={tool}
378
+ aria-label="Design tools"
379
+ onChange={onChange}
380
+ >
381
+ <fig-toolbelt-group aria-label="Transform tools">
382
+ <fig-toolbelt-item value="move" selected={tool === "move" || undefined}>
383
+ Move
384
+ </fig-toolbelt-item>
385
+ <fig-toolbelt-item value="frame">Frame</fig-toolbelt-item>
386
+ </fig-toolbelt-group>
387
+ </fig-toolbelt>
388
+ ```
389
+
390
+ - Toolbelt attrs: `value`, `disabled`, `layout="horizontal|vertical"`, `overflow="buttons|scrollbar"`
391
+ - Group: wraps related items; adjacent groups receive direction-aware separators
392
+ - Item attrs: `value`, `selected`, `disabled`
393
+ - ArrowLeft/ArrowRight move focus horizontally; ArrowUp/ArrowDown move focus vertically; Enter/Space selects
394
+ - Items stay in light DOM; the internal `part="viewport"` owns scrolling and overflow fades
395
+ - Overflow buttons are generated outside the viewport for `overflow="buttons"`
396
+ - Events: `input` / `change` → `currentTarget.value`
397
+
371
398
  ### `fig-tabs` / `fig-tab` / `fig-tab-content`
372
399
 
373
400
  ```tsx
@@ -110,6 +110,9 @@ type FigTag =
110
110
  | "fig-tab"
111
111
  | "fig-tab-content"
112
112
  | "fig-tabs"
113
+ | "fig-toolbelt"
114
+ | "fig-toolbelt-group"
115
+ | "fig-toolbelt-item"
113
116
  | "fig-tooltip"
114
117
  | "fig-truncate"
115
118
  | "fig-video"
@@ -240,7 +243,7 @@ React owns child nodes. Components slot; they do not relocate children.
240
243
 
241
244
  - `fig-menu` items; trigger gets `slot="trigger"`
242
245
  - `fig-select-options slot="panel"`
243
- - `fig-tabs` / `fig-chooser` children
246
+ - `fig-tabs` / `fig-toolbelt` / `fig-chooser` children
244
247
  - media `slot="overlay"`
245
248
  - fill custom `slot="mode-*"`
246
249
 
@@ -70,6 +70,16 @@ Public API: `README.md`. React recipes: [components.md](components.md).
70
70
  - `direction="horizontal|vertical"`
71
71
  - `label` or a child `<label>`
72
72
 
73
+ ## `fig-toolbelt`
74
+
75
+ - Attrs: `value`, `disabled`, `layout="horizontal|vertical"`, `overflow="buttons|scrollbar"`; role `toolbar`
76
+ - Direct `fig-toolbelt-item` or `fig-toolbelt-group` children; groups wrap related items and use role `group`
77
+ - Items: `value`, `selected`, `disabled`; role `button`, `aria-pressed`
78
+ - ArrowLeft/ArrowRight navigate horizontal layouts; ArrowUp/ArrowDown navigate vertical layouts; Home/End move roving focus; Enter/Space select
79
+ - Events: bubbling `input` and `change` with the selected value
80
+ - `overflow="scrollbar"` is the default and uses buttonless scrolling with the scrollbar hidden; `overflow="buttons"` adds direction-aware paging controls
81
+ - Internal `part="viewport"` owns scrolling and fades; authored items remain direct light-DOM children
82
+
73
83
  ## `.fig-overflow-fade`
74
84
 
75
85
  - Apply the class to a vertical scroll container and constrain its height; add `fig-overflow-fade-horizontal` for horizontal scrolling.