@kitlangton/knobs 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +1414 -2
- package/dist/dev/chunk-4km87zfx.js +155 -0
- package/dist/dev/chunk-5cr85vv6.js +17726 -0
- package/dist/dev/chunk-693jd1gj.js +1435 -0
- package/dist/dev/chunk-gezhc24g.js +1132 -0
- package/dist/dev/index.js +1660 -0
- package/dist/index.js +2651 -0
- package/dist/panel.js +26404 -0
- package/dist/react.js +326 -0
- package/dist/solid.js +336 -0
- package/dist/themes.js +235 -0
- package/dist/types/core/adapter.d.ts +21 -0
- package/dist/types/core/code.d.ts +3 -0
- package/dist/types/core/color.d.ts +27 -0
- package/dist/types/core/easing.d.ts +21 -0
- package/dist/types/core/internal.d.ts +18 -0
- package/dist/types/core/keys.d.ts +21 -0
- package/dist/types/core/mutate.d.ts +21 -0
- package/dist/types/core/ramp.d.ts +150 -0
- package/dist/types/core/random.d.ts +62 -0
- package/dist/types/core/readout.d.ts +73 -0
- package/dist/types/core/remote.d.ts +260 -0
- package/dist/types/core/schema.d.ts +550 -0
- package/dist/types/core/spring.d.ts +38 -0
- package/dist/types/core/storage.d.ts +8 -0
- package/dist/types/core/store.d.ts +536 -0
- package/dist/types/core/theme.d.ts +27 -0
- package/dist/types/core/variants.d.ts +25 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/panel/attach.d.ts +5 -0
- package/dist/types/panel/choice.d.ts +56 -0
- package/dist/types/panel/die.d.ts +121 -0
- package/dist/types/panel/editors.d.ts +170 -0
- package/dist/types/panel/flash.d.ts +13 -0
- package/dist/types/panel/folds.d.ts +14 -0
- package/dist/types/panel/give.d.ts +73 -0
- package/dist/types/panel/gpu/atlas.d.ts +40 -0
- package/dist/types/panel/gpu/color.d.ts +128 -0
- package/dist/types/panel/gpu/die.wgsl.d.ts +1 -0
- package/dist/types/panel/gpu/renderer.d.ts +784 -0
- package/dist/types/panel/gpu/shader.wgsl.d.ts +2 -0
- package/dist/types/panel/haptics.d.ts +12 -0
- package/dist/types/panel/has.d.ts +13 -0
- package/dist/types/panel/hints.d.ts +45 -0
- package/dist/types/panel/icons.d.ts +30 -0
- package/dist/types/panel/index.d.ts +11 -0
- package/dist/types/panel/inspector.d.ts +50 -0
- package/dist/types/panel/measure.d.ts +6 -0
- package/dist/types/panel/menu.d.ts +38 -0
- package/dist/types/panel/morph.d.ts +38 -0
- package/dist/types/panel/motion.d.ts +77 -0
- package/dist/types/panel/optkeys.d.ts +7 -0
- package/dist/types/panel/page-hints.d.ts +82 -0
- package/dist/types/panel/page.d.ts +423 -0
- package/dist/types/panel/panel.d.ts +43 -0
- package/dist/types/panel/position.d.ts +5 -0
- package/dist/types/panel/prefs.d.ts +28 -0
- package/dist/types/panel/presets.d.ts +60 -0
- package/dist/types/panel/ramp-morph.d.ts +117 -0
- package/dist/types/panel/ramps.d.ts +14 -0
- package/dist/types/panel/readout-row.d.ts +21 -0
- package/dist/types/panel/reel.d.ts +43 -0
- package/dist/types/panel/reveal.d.ts +15 -0
- package/dist/types/panel/rolling-css.d.ts +2 -0
- package/dist/types/panel/scope.d.ts +19 -0
- package/dist/types/panel/search.d.ts +36 -0
- package/dist/types/panel/seg.d.ts +15 -0
- package/dist/types/panel/session.d.ts +21 -0
- package/dist/types/panel/slider.d.ts +92 -0
- package/dist/types/panel/smear.d.ts +7 -0
- package/dist/types/panel/sound.d.ts +137 -0
- package/dist/types/panel/spin.d.ts +13 -0
- package/dist/types/panel/styles.d.ts +11 -0
- package/dist/types/panel/swipe.d.ts +114 -0
- package/dist/types/panel/switcher.d.ts +20 -0
- package/dist/types/panel/tabs.d.ts +31 -0
- package/dist/types/panel/thumb.d.ts +36 -0
- package/dist/types/panel/toolbar-grid.d.ts +6 -0
- package/dist/types/react/Knobs.d.ts +15 -0
- package/dist/types/react/VariantSwitcher.d.ts +10 -0
- package/dist/types/react/index.d.ts +3 -0
- package/dist/types/react/useControls.d.ts +11 -0
- package/dist/types/solid/index.d.ts +50 -0
- package/dist/types/themes/index.d.ts +1 -0
- package/dist/types/ui/activity-css.d.ts +1 -0
- package/dist/types/ui/activity-model.d.ts +122 -0
- package/dist/types/ui/activity.d.ts +67 -0
- package/dist/types/ui/bento-css.d.ts +1 -0
- package/dist/types/ui/bento-model.d.ts +96 -0
- package/dist/types/ui/bento.d.ts +77 -0
- package/dist/types/ui/commands.d.ts +11 -0
- package/dist/types/ui/confirm.d.ts +13 -0
- package/dist/types/ui/follow.d.ts +17 -0
- package/dist/types/ui/index.d.ts +24 -0
- package/dist/types/ui/layer.d.ts +70 -0
- package/dist/types/ui/look.d.ts +62 -0
- package/dist/types/ui/menu.d.ts +63 -0
- package/dist/types/ui/overlay-css.d.ts +1 -0
- package/dist/types/ui/overlay-model.d.ts +87 -0
- package/dist/types/ui/palette.d.ts +38 -0
- package/dist/types/ui/picker-css.d.ts +1 -0
- package/dist/types/ui/picker-model.d.ts +53 -0
- package/dist/types/ui/picker.d.ts +67 -0
- package/dist/types/ui/popover.d.ts +35 -0
- package/dist/types/ui/react.d.ts +72 -0
- package/dist/types/ui/readout-css.d.ts +1 -0
- package/dist/types/ui/readout-model.d.ts +137 -0
- package/dist/types/ui/readouts.d.ts +85 -0
- package/dist/types/ui/rgba.d.ts +6 -0
- package/dist/types/ui/solid.d.ts +63 -0
- package/dist/types/ui/split-model.d.ts +135 -0
- package/dist/types/ui/split.d.ts +92 -0
- package/dist/types/ui/timeline-model.d.ts +83 -0
- package/dist/types/ui/timeline.d.ts +76 -0
- package/dist/types/ui/toast.d.ts +19 -0
- package/dist/types/ui/tooltip.d.ts +19 -0
- package/dist/types/ui/tree-model.d.ts +125 -0
- package/dist/types/ui/tree.d.ts +95 -0
- package/dist/ui-react.js +9230 -0
- package/dist/ui-solid.js +9162 -0
- package/dist/ui.js +11826 -0
- package/package.json +99 -4
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import { type CodeFormat } from "./code.js";
|
|
2
|
+
import type { TokenPreset } from "./theme.js";
|
|
3
|
+
import { type ReadoutInput, type ReadoutKeys, type Schema, type State, type Values } from "./schema.js";
|
|
4
|
+
import { type StoragePort } from "./storage.js";
|
|
5
|
+
import { type Variants } from "./variants.js";
|
|
6
|
+
export type ThemeMode = "dark" | "light" | "auto";
|
|
7
|
+
export type DensityMode = "compact" | "default" | "comfortable";
|
|
8
|
+
export type RendererMode = "gpu" | "dom" | "auto";
|
|
9
|
+
/** When a store's chip shows; see `ChipOptions.reveal`. */
|
|
10
|
+
export type RevealMode = "hover" | "shortcut" | "always";
|
|
11
|
+
/** The floating chip `attach` puts on an element, which grows into its panel. */
|
|
12
|
+
export interface ChipOptions {
|
|
13
|
+
/** Text beside the cog, e.g. `"knobs"`. Just the cog by default. */
|
|
14
|
+
readonly label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* When the chip shows. `"hover"`: while the element is hovered or focused. `"shortcut"`: hidden
|
|
17
|
+
* until `shortcut` turns on knobs mode (remembered for the tab), then on hover. `"always"`:
|
|
18
|
+
* whenever its panel is closed. `"hover"` in development, `"shortcut"` in production builds.
|
|
19
|
+
*/
|
|
20
|
+
readonly reveal?: RevealMode;
|
|
21
|
+
/** The key that toggles knobs mode for `"shortcut"` chips: `"Alt+Shift+D"` (⌥⇧D) by default. */
|
|
22
|
+
readonly shortcut?: string;
|
|
23
|
+
}
|
|
24
|
+
export type ChangeSource = "local" | "remote" | "reset" | "preset" | "variant" | "undo" | "redo" | "randomize" | "mutate" | "compare";
|
|
25
|
+
/**
|
|
26
|
+
* A key going into the hand and out of it: a drag or a press on its row, an inline edit, or a
|
|
27
|
+
* burst of arrow keys. Changes between a key's `start` and `end` are one gesture, so a host can
|
|
28
|
+
* open one undo entry at `start` and close it at `end`.
|
|
29
|
+
*/
|
|
30
|
+
export interface GestureEvent {
|
|
31
|
+
readonly key: string;
|
|
32
|
+
readonly phase: "start" | "end";
|
|
33
|
+
}
|
|
34
|
+
export interface ChangeMeta {
|
|
35
|
+
readonly source: ChangeSource;
|
|
36
|
+
readonly coalesce?: boolean;
|
|
37
|
+
readonly key?: string;
|
|
38
|
+
readonly group?: string;
|
|
39
|
+
/** A reset that went back to the active preset (see `Controls.activePreset`), not the defaults. */
|
|
40
|
+
readonly base?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The preset last applied from the strip: a schema preset (by id) or a saved variant. It's the
|
|
44
|
+
* base Reset returns to and Random explores around.
|
|
45
|
+
*/
|
|
46
|
+
export interface PresetRef {
|
|
47
|
+
readonly kind: "preset" | "variant";
|
|
48
|
+
readonly id: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ControlAction<V = State> {
|
|
51
|
+
readonly id?: string;
|
|
52
|
+
readonly label: string;
|
|
53
|
+
readonly group?: string;
|
|
54
|
+
readonly shortcut?: string;
|
|
55
|
+
run(values: V, controls: Controls<any>): void | string | Promise<void | string>;
|
|
56
|
+
}
|
|
57
|
+
/** One of a group's numbered presets; keys it leaves out sit at their defaults (see `groupPresets`). */
|
|
58
|
+
export interface GroupPreset<V = State> {
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly values: Partial<V>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* How a page card shows its group presets: `names` as segments ("Native · Tight · Airy"), `menu`
|
|
64
|
+
* as a compact drop-down showing the selected one's name, `numbers` as 1, 2, 3…; `auto` (the
|
|
65
|
+
* default) shows names while they fit beside the title, else the menu.
|
|
66
|
+
*/
|
|
67
|
+
export type GroupPresetDisplay = "auto" | "names" | "numbers" | "menu";
|
|
68
|
+
/** Display labels, kept apart from the ids that identify groups, sections and presets. */
|
|
69
|
+
export interface LabelOptions {
|
|
70
|
+
/** By group id: what its header shows (verbatim). Ids stay identity everywhere else. */
|
|
71
|
+
readonly groupLabels?: Readonly<Record<string, string>>;
|
|
72
|
+
/** By section id: what its heading shows. */
|
|
73
|
+
readonly sectionLabels?: Readonly<Record<string, string>>;
|
|
74
|
+
/** By preset id: what the preset strip shows, e.g. `{ default: "Native" }`. */
|
|
75
|
+
readonly presetLabels?: Readonly<Record<string, string>>;
|
|
76
|
+
/** Shorthand for `presetLabels.default`. */
|
|
77
|
+
readonly defaultLabel?: string;
|
|
78
|
+
/** How a page card shows its group presets (see `GroupPresetDisplay`). */
|
|
79
|
+
readonly groupPresetDisplay?: GroupPresetDisplay;
|
|
80
|
+
/** By group id: one muted line under its card's title on a page, over fields' `groupDescription`. */
|
|
81
|
+
readonly groupDescriptions?: Readonly<Record<string, string>>;
|
|
82
|
+
/** By section id: one muted line under its heading on a page, over fields' `sectionDescription`. */
|
|
83
|
+
readonly sectionDescriptions?: Readonly<Record<string, string>>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* How a page's sections start: `true` folds every section to its heading, or by section id. A
|
|
87
|
+
* section neither names keeps its fields' `sectionFolded`, else starts open.
|
|
88
|
+
*/
|
|
89
|
+
export type SectionFolded = boolean | Readonly<Record<string, boolean>>;
|
|
90
|
+
/** Panel commands with a key binding; see `MountPanelOptions.keys`. */
|
|
91
|
+
export type PanelCommand = "random" | "mutate" | "reset" | "resetAll" | "compare" | "hint" | "undo" | "redo" | "copy" | "save" | "lock" | "presets" | "group" | "first" | "help" | "menu" | "leave";
|
|
92
|
+
/**
|
|
93
|
+
* Remaps (a single character, or a key name such as `"F2"`) or turns off (`false`) a panel's key
|
|
94
|
+
* bindings. Unlisted commands keep their default key. `true` keeps the default.
|
|
95
|
+
*/
|
|
96
|
+
export type PanelKeys = {
|
|
97
|
+
readonly [C in PanelCommand]?: string | boolean;
|
|
98
|
+
} & {
|
|
99
|
+
/** `false` drops the j/k and h/l aliases: only the arrows move and adjust; the letters reach the page. */
|
|
100
|
+
readonly vim?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* `false` stops digits, `.`, `-` and Enter from opening a slider's inline number editor (they
|
|
103
|
+
* reach the page); clicking the readout still edits.
|
|
104
|
+
*/
|
|
105
|
+
readonly edit?: boolean;
|
|
106
|
+
/** What ⇧ multiplies an arrow's step by; 10 by default. */
|
|
107
|
+
readonly bigStep?: number;
|
|
108
|
+
/** `false` stops ↑/↓ at the first and last rows instead of wrapping around. */
|
|
109
|
+
readonly wrap?: boolean;
|
|
110
|
+
};
|
|
111
|
+
/** `glass` (the default): ticks with a faint ring. `mech`: drier, the rings all but gone. */
|
|
112
|
+
export type SoundTheme = "glass" | "mech";
|
|
113
|
+
/** A mount's `sound`, beyond `true`. */
|
|
114
|
+
export interface SoundOptions {
|
|
115
|
+
/** This panel's level, 0–1 (times `sound.volume`). */
|
|
116
|
+
readonly volume?: number;
|
|
117
|
+
readonly theme?: SoundTheme;
|
|
118
|
+
}
|
|
119
|
+
/** A header button (see `MountPanelOptions.header`). */
|
|
120
|
+
export type HeaderButton = "random" | "reset" | "copy" | "undo" | "redo" | "help" | "close";
|
|
121
|
+
export interface HeaderOptions {
|
|
122
|
+
/** `false` hides the title; the buttons stay at the right. */
|
|
123
|
+
readonly title?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Which buttons show (of those that are on). All but `help` by default: its `?` key opens the
|
|
126
|
+
* shortcuts either way, and the title's tooltip says so. List `"help"` to bring the button back.
|
|
127
|
+
*/
|
|
128
|
+
readonly buttons?: readonly HeaderButton[];
|
|
129
|
+
}
|
|
130
|
+
export interface MountPanelOptions extends LabelOptions {
|
|
131
|
+
readonly title?: string | false;
|
|
132
|
+
/**
|
|
133
|
+
* Key bindings. An inline panel only ever hears keys while focus is inside it; pass this to remap
|
|
134
|
+
* or turn off commands so they don't shadow the host's own keys, e.g.
|
|
135
|
+
* `{ random: false, mutate: false, compare: false, hint: false, undo: false }` or `{ hint: "f" }`.
|
|
136
|
+
* The `?` popover and hint badges list only what's enabled.
|
|
137
|
+
*/
|
|
138
|
+
readonly keys?: PanelKeys;
|
|
139
|
+
/**
|
|
140
|
+
* Hint mode's reach. `"page"` (the default): `s` labels every visible control in every panel
|
|
141
|
+
* and knobs/ui piece on the page (and the host's `data-hint` elements), so pressed here or
|
|
142
|
+
* anywhere outside a text field it jumps across all of them; with nothing else on the page it's
|
|
143
|
+
* this panel's alone, as always. `"panel"`: `s` here labels only this panel's controls, and they
|
|
144
|
+
* don't join the page's. `keys: { hint: false }` turns hint mode off here either way.
|
|
145
|
+
*/
|
|
146
|
+
readonly hints?: "page" | "panel";
|
|
147
|
+
/**
|
|
148
|
+
* `false` hides what says a value differs from its default: modified dots and readout marks,
|
|
149
|
+
* group reset icons and the header's Reset. For panels whose values belong to someone else
|
|
150
|
+
* (a prototype's settings), where "default" means nothing. The store's `marks` by default.
|
|
151
|
+
*/
|
|
152
|
+
readonly marks?: boolean;
|
|
153
|
+
/** Token values to style the panel with, e.g. `problemsPreset` (see `TokenPreset`). */
|
|
154
|
+
readonly preset?: TokenPreset;
|
|
155
|
+
/**
|
|
156
|
+
* `false` drops the header (title and buttons) for a host that draws its own. An object keeps
|
|
157
|
+
* it and chooses what shows: `{ title: false, buttons: ["random", "undo", "redo"] }`. A button
|
|
158
|
+
* left out keeps its key; a command that's off (`keys`) loses its button either way. Without a
|
|
159
|
+
* list, every button but `help` shows (see `HeaderOptions`).
|
|
160
|
+
*/
|
|
161
|
+
readonly header?: boolean | HeaderOptions;
|
|
162
|
+
/**
|
|
163
|
+
* `false`: no per-tab session, so a rebuilt panel doesn't take focus back to the row it last
|
|
164
|
+
* had or reopen editors and folded groups. On while the store has storage.
|
|
165
|
+
*/
|
|
166
|
+
readonly session?: boolean;
|
|
167
|
+
/** Groups folded (`true`) or open (`false`) at first, over their fields' `folded`. */
|
|
168
|
+
readonly groupFolded?: Readonly<Record<string, boolean>>;
|
|
169
|
+
/** Sub-headings (fields' `subsection`) that start folded (`true`), by name. */
|
|
170
|
+
readonly subsectionFolded?: Readonly<Record<string, boolean>>;
|
|
171
|
+
/**
|
|
172
|
+
* The tab strip's order and labels: tab ids, or `{ id, label }`. Tabs the fields name that
|
|
173
|
+
* aren't listed follow in the order they first appear.
|
|
174
|
+
*/
|
|
175
|
+
readonly tabs?: readonly (string | {
|
|
176
|
+
readonly id: string;
|
|
177
|
+
readonly label?: string;
|
|
178
|
+
})[];
|
|
179
|
+
/** The tab shown first; otherwise the one last shown for these controls, else the first. */
|
|
180
|
+
readonly tab?: string;
|
|
181
|
+
/** Called when the shown tab changes (by a click, a key or `panel.tab()`). */
|
|
182
|
+
readonly onTab?: (tab: string) => void;
|
|
183
|
+
/**
|
|
184
|
+
* A search field under the header that filters rows by label, key or group as you type, with
|
|
185
|
+
* filter chips (`"modified"`, with its count, by default). `/` focuses it.
|
|
186
|
+
*/
|
|
187
|
+
readonly search?: boolean | SearchOptions;
|
|
188
|
+
/**
|
|
189
|
+
* A group's Random (its die, `g`, ⌥ for Mutate) asks the host first: returning `true` means the
|
|
190
|
+
* host rolled the group itself (its own seeded "Randomize <group>"), and the panel only tumbles
|
|
191
|
+
* the die.
|
|
192
|
+
*/
|
|
193
|
+
readonly groupRandom?: (group: string, mode: "random" | "mutate") => boolean | void;
|
|
194
|
+
/**
|
|
195
|
+
* A node for a row's accessory slot, just after its label (a pin, a marker), or null. Called
|
|
196
|
+
* with the row's key when the row is built; `panel.updateAccessories()` asks again. The node
|
|
197
|
+
* stays the host's: style it, listen on it. With the WebGPU renderer it stays DOM (see README).
|
|
198
|
+
*/
|
|
199
|
+
readonly rowAccessory?: (key: string) => Node | null;
|
|
200
|
+
/**
|
|
201
|
+
* Light haptic ticks on phones (a stepped slider crossing a stop, the default's magnet, a
|
|
202
|
+
* choice changing mid-pan, a switch flipping); on by default, `false` turns them off.
|
|
203
|
+
* Reduced motion turns them off too.
|
|
204
|
+
*/
|
|
205
|
+
readonly haptics?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Sound effects: quiet, short ticks and clicks synthesized live for the panel's moments (a
|
|
208
|
+
* slider's detents, a switch, Random, Copy…). Off by default; `true` turns them on, or
|
|
209
|
+
* `{ volume, theme }`. The page's switch (`sound.enable(false)` from `knobs/panel`) mutes every
|
|
210
|
+
* panel, and the `?` popover offers it as Sounds, kept in the store's storage.
|
|
211
|
+
*/
|
|
212
|
+
readonly sound?: boolean | SoundOptions;
|
|
213
|
+
/** Called once the panel is mounted, with a handle to focus it (a host's "Tune" key). */
|
|
214
|
+
readonly onReady?: (panel: PanelHandle) => void;
|
|
215
|
+
/** What Copy (and ⇧C) puts on the clipboard; `controls.code()` by default. */
|
|
216
|
+
readonly copy?: () => string;
|
|
217
|
+
readonly theme?: ThemeMode;
|
|
218
|
+
readonly density?: DensityMode;
|
|
219
|
+
readonly renderer?: RendererMode;
|
|
220
|
+
readonly variants?: boolean;
|
|
221
|
+
readonly history?: boolean;
|
|
222
|
+
readonly footer?: boolean;
|
|
223
|
+
readonly actions?: readonly ControlAction<any>[];
|
|
224
|
+
readonly onClose?: () => void;
|
|
225
|
+
}
|
|
226
|
+
/** A search field's filter chip: it narrows the rows to those `test` accepts. */
|
|
227
|
+
export interface SearchChip {
|
|
228
|
+
readonly id: string;
|
|
229
|
+
readonly label: string;
|
|
230
|
+
/** Shows how many rows it would keep beside its label. */
|
|
231
|
+
readonly count?: boolean;
|
|
232
|
+
test(key: string, controls: Controls<any>): boolean;
|
|
233
|
+
}
|
|
234
|
+
export interface SearchOptions {
|
|
235
|
+
readonly placeholder?: string;
|
|
236
|
+
/** `"modified"` (rows off their defaults) or chips of your own; `["modified"]` by default. */
|
|
237
|
+
readonly chips?: readonly ("modified" | SearchChip)[];
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* An undo stack the host owns (an editor's ⌘Z that covers more than these values). The panel's
|
|
241
|
+
* undo and redo buttons and keys call it; compare (hold `\`) still previews knobs' own last entry.
|
|
242
|
+
*/
|
|
243
|
+
export interface HostHistory {
|
|
244
|
+
undo(): void;
|
|
245
|
+
redo(): void;
|
|
246
|
+
canUndo(): boolean;
|
|
247
|
+
canRedo(): boolean;
|
|
248
|
+
/** Called when `canUndo` or `canRedo` may have changed; returns an unsubscribe. */
|
|
249
|
+
subscribe?(cb: () => void): () => void;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* What `storage` keeps: `"all"` (values, locks and saved variants; the default), `"variants"`
|
|
253
|
+
* (only saved variants, for values the host owns) or `"none"`.
|
|
254
|
+
*/
|
|
255
|
+
export type PersistMode = "all" | "variants" | "none";
|
|
256
|
+
export interface SyncOptions {
|
|
257
|
+
/** Keys missing from `values` return to their defaults. */
|
|
258
|
+
readonly replace?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Keys whose values differ across what the host is showing (a multi-selection): they show an
|
|
261
|
+
* indeterminate "—" until edited. Replaces the store's mixed keys (see `Controls.setMixed`).
|
|
262
|
+
*/
|
|
263
|
+
readonly mixed?: readonly string[];
|
|
264
|
+
/**
|
|
265
|
+
* A different item arrived: panels place the values without springing or rolling, and undo
|
|
266
|
+
* history starts over (it belonged to the previous item).
|
|
267
|
+
*/
|
|
268
|
+
readonly land?: boolean;
|
|
269
|
+
}
|
|
270
|
+
/** A mounted panel: what `mount` hands `onReady`. */
|
|
271
|
+
export interface PanelHandle {
|
|
272
|
+
readonly element: HTMLElement;
|
|
273
|
+
focus(): void;
|
|
274
|
+
dispose(): void;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The panel module a shipped store mounts with: `() => import("knobs/panel")`. Structural, so the
|
|
278
|
+
* core never imports the panel itself.
|
|
279
|
+
*/
|
|
280
|
+
export interface PanelModule {
|
|
281
|
+
mountPanel(controls: Controls<any>, container: HTMLElement, options?: MountPanelOptions): PanelHandle;
|
|
282
|
+
attach(controls: Controls<any>, element: HTMLElement, chip?: ChipOptions): () => void;
|
|
283
|
+
}
|
|
284
|
+
export interface ControlsOptions<S extends Schema> extends LabelOptions {
|
|
285
|
+
enabled?: boolean | (() => boolean);
|
|
286
|
+
/**
|
|
287
|
+
* Ships this store as product UI: it stays live in production builds (where stores are
|
|
288
|
+
* otherwise locked to their defaults) and mounts panels from the module this loads, e.g.
|
|
289
|
+
* `ship: () => import("knobs/panel")`. `enabled` defaults to true. Stores without it stay
|
|
290
|
+
* dev-only and ship constants.
|
|
291
|
+
*/
|
|
292
|
+
ship?: () => Promise<PanelModule>;
|
|
293
|
+
/** The chip `attach` shows: its label, when it shows and the knobs-mode key (see `ChipOptions`). */
|
|
294
|
+
chip?: ChipOptions;
|
|
295
|
+
/**
|
|
296
|
+
* The longest (ms) a key changed here outranks incoming values for it (see `sync`), so an echo
|
|
297
|
+
* of an older value still in flight can't pull it back. The hold ends early once the remote
|
|
298
|
+
* reports the value that was sent (for numbers, within half a step). 0 by default; remote
|
|
299
|
+
* controls use 600. Raise it for peers that acknowledge slowly.
|
|
300
|
+
*/
|
|
301
|
+
echo?: number;
|
|
302
|
+
storage?: StoragePort | null;
|
|
303
|
+
/** What `storage` keeps: everything, only saved variants, or nothing (see `PersistMode`). */
|
|
304
|
+
persist?: PersistMode;
|
|
305
|
+
/**
|
|
306
|
+
* The source Random and Mutate draw from, `[0, 1)` like `Math.random` (the default). Pass a
|
|
307
|
+
* seeded generator to make a roll reproducible.
|
|
308
|
+
*/
|
|
309
|
+
random?: () => number;
|
|
310
|
+
/**
|
|
311
|
+
* Whether Random and Mutate may change a key, beside locks and each field's `random: false`
|
|
312
|
+
* (e.g. never seeds or structural pickers).
|
|
313
|
+
*/
|
|
314
|
+
tunable?: (key: keyof S & string, values: Values<S>) => boolean;
|
|
315
|
+
/** An undo stack the host owns; undo and redo call it (see `HostHistory`). */
|
|
316
|
+
history?: HostHistory;
|
|
317
|
+
presets?: Readonly<Record<string, Partial<Values<S>>>>;
|
|
318
|
+
/**
|
|
319
|
+
* Numbered presets per group, shown as 1, 2, 3… on the group's card in a page. A group's
|
|
320
|
+
* presets cover every key any of them names; keys a preset leaves out are at their defaults,
|
|
321
|
+
* so `{ name: "Today", values: {} }` is the shipped look.
|
|
322
|
+
*/
|
|
323
|
+
groupPresets?: Readonly<Record<string, readonly GroupPreset<Values<S>>[]>>;
|
|
324
|
+
actions?: readonly ControlAction<Values<S>>[];
|
|
325
|
+
theme?: ThemeMode;
|
|
326
|
+
density?: DensityMode;
|
|
327
|
+
renderer?: RendererMode;
|
|
328
|
+
/** Default key bindings for this store's panels (see `MountPanelOptions.keys`). */
|
|
329
|
+
keys?: PanelKeys;
|
|
330
|
+
/** `false`: its panels show no modified marks or resets (see `MountPanelOptions.marks`). */
|
|
331
|
+
marks?: boolean;
|
|
332
|
+
/** How its groups start, folded or open, under the mount's `groupFolded` (see there). */
|
|
333
|
+
groupFolded?: Readonly<Record<string, boolean>>;
|
|
334
|
+
/** How a page's sections start, under the mount's `sectionFolded` (see `SectionFolded`). */
|
|
335
|
+
sectionFolded?: SectionFolded;
|
|
336
|
+
onChange?: (patch: Partial<Values<S>>, values: Values<S>, meta: ChangeMeta) => void;
|
|
337
|
+
/** A key went into the hand or out of it (see `GestureEvent`). */
|
|
338
|
+
onGesture?: (event: GestureEvent) => void;
|
|
339
|
+
onReset?: (target: {
|
|
340
|
+
key?: keyof S & string;
|
|
341
|
+
group?: string;
|
|
342
|
+
}) => void;
|
|
343
|
+
/** An action row was pressed (after its own `run`), or a toolbar button (with its item's id). */
|
|
344
|
+
onAction?: (key: string) => void;
|
|
345
|
+
/** A group's numbered preset was applied (after its values are set). */
|
|
346
|
+
onPreset?: (target: {
|
|
347
|
+
group: string;
|
|
348
|
+
index: number;
|
|
349
|
+
name: string;
|
|
350
|
+
}) => void;
|
|
351
|
+
}
|
|
352
|
+
export interface Controls<S extends Schema = Schema> {
|
|
353
|
+
readonly id: string;
|
|
354
|
+
readonly schema: S;
|
|
355
|
+
readonly locked: Values<S>;
|
|
356
|
+
readonly enabled: boolean;
|
|
357
|
+
readonly storage: StoragePort | null;
|
|
358
|
+
/** What `storage` keeps (see `PersistMode`). */
|
|
359
|
+
readonly persist: PersistMode;
|
|
360
|
+
readonly presets: Readonly<Record<string, Values<S>>>;
|
|
361
|
+
readonly variants: Variants<Values<S>>;
|
|
362
|
+
readonly actions: readonly ControlAction<Values<S>>[];
|
|
363
|
+
readonly theme: ThemeMode;
|
|
364
|
+
readonly density: DensityMode;
|
|
365
|
+
readonly renderer: RendererMode;
|
|
366
|
+
readonly keys: PanelKeys | undefined;
|
|
367
|
+
readonly marks: boolean;
|
|
368
|
+
/** The chip's options, with `reveal` and `shortcut` resolved. */
|
|
369
|
+
readonly chip: ChipOptions & {
|
|
370
|
+
readonly reveal: RevealMode;
|
|
371
|
+
readonly shortcut: string;
|
|
372
|
+
};
|
|
373
|
+
/** How page cards show group presets (`groupPresetDisplay`, `auto` by default). */
|
|
374
|
+
readonly groupPresetDisplay: GroupPresetDisplay;
|
|
375
|
+
/** A group's display label (`groupLabels`, else its fields' `groupLabel`), if it has one. */
|
|
376
|
+
groupLabel(group: string): string | undefined;
|
|
377
|
+
/** A section's display label (`sectionLabels`, else its fields' `sectionLabel`), if it has one. */
|
|
378
|
+
sectionLabel(section: string): string | undefined;
|
|
379
|
+
/** A group's description (`groupDescriptions`, else its fields' `groupDescription`), if any. */
|
|
380
|
+
groupDescription(group: string): string | undefined;
|
|
381
|
+
/** A section's description (`sectionDescriptions`, else its fields' `sectionDescription`), if any. */
|
|
382
|
+
sectionDescription(section: string): string | undefined;
|
|
383
|
+
/** How groups start (`groupFolded`), as given; panels read it under their own `groupFolded`. */
|
|
384
|
+
readonly groupFolded: Readonly<Record<string, boolean>> | undefined;
|
|
385
|
+
/** How a page's sections start (`sectionFolded`), as given. */
|
|
386
|
+
readonly sectionFolded: SectionFolded | undefined;
|
|
387
|
+
/** A preset's display label (`presetLabels`, `defaultLabel`), else its id. */
|
|
388
|
+
presetLabel(id: string): string;
|
|
389
|
+
readonly error: string | null;
|
|
390
|
+
get(): Values<S>;
|
|
391
|
+
getServerSnapshot(): Values<S>;
|
|
392
|
+
/** Apply a change. `coalesce` folds it into the previous history entry (used while dragging). */
|
|
393
|
+
set(patch: Partial<Values<S>>, options?: {
|
|
394
|
+
coalesce?: boolean;
|
|
395
|
+
source?: ChangeSource;
|
|
396
|
+
key?: string;
|
|
397
|
+
group?: string;
|
|
398
|
+
}): void;
|
|
399
|
+
/**
|
|
400
|
+
* Apply external state (props, a server, a peer) without recording undo history or emitting a
|
|
401
|
+
* local change. A key that is held (in hand, or changed here within `echo` ms) keeps its value;
|
|
402
|
+
* the newest incoming value for it lands when the hold ends.
|
|
403
|
+
*/
|
|
404
|
+
sync(values: Partial<Values<S>>, options?: SyncOptions): void;
|
|
405
|
+
/**
|
|
406
|
+
* Marks a key as in hand (a drag, an inline edit) or lets it go. While held, `sync` doesn't
|
|
407
|
+
* touch it; letting go applies the newest value that arrived meanwhile. Panels call this.
|
|
408
|
+
*/
|
|
409
|
+
hold(key: string, held?: boolean): void;
|
|
410
|
+
/** Whether incoming values for `key` are held back right now (see `sync`). */
|
|
411
|
+
isHeld(key: string): boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Presses an action row: its `run`, then `onAction(key)`. For a toolbar, `item` names the
|
|
414
|
+
* button (its id, else its label) and `onAction` gets the item's id.
|
|
415
|
+
*/
|
|
416
|
+
action(key: keyof S & string, item?: string): void;
|
|
417
|
+
/**
|
|
418
|
+
* Shows a live value in a readout row (`watch`, `sparkline`, `graph`, `meter`, `table`, `log`):
|
|
419
|
+
* a number or text, a sample for a history, `{ [series]: number }` for a graph, rows for a
|
|
420
|
+
* table, an entry for a log. `null` clears it. Rows redraw at most once a frame and sleep
|
|
421
|
+
* when nothing arrives; nothing is recorded in the values, history or storage.
|
|
422
|
+
*/
|
|
423
|
+
watch<K extends ReadoutKeys<S>>(key: K, value: ReadoutInput<S[K]>): void;
|
|
424
|
+
/** The latest value pushed to a readout (`undefined` before any). */
|
|
425
|
+
watched(key: ReadoutKeys<S>): unknown;
|
|
426
|
+
/** True while the change being notified landed (`sync(…, { land: true })`): place, don't animate. */
|
|
427
|
+
readonly landing: boolean;
|
|
428
|
+
undo(): void;
|
|
429
|
+
redo(): void;
|
|
430
|
+
readonly canUndo: boolean;
|
|
431
|
+
readonly canRedo: boolean;
|
|
432
|
+
subscribe(cb: () => void): () => void;
|
|
433
|
+
/**
|
|
434
|
+
* Back to the active preset (see `activePreset`) while anything differs from it, else to the
|
|
435
|
+
* defaults: every field, or only `keys`. Reaching the defaults with every field also forgets
|
|
436
|
+
* the active preset. Locks don't apply; disabled and read-only fields keep their values.
|
|
437
|
+
*/
|
|
438
|
+
reset(keys?: readonly (keyof S & string)[]): void;
|
|
439
|
+
/** One key, as `reset` does: to the active preset's value, else (already there) its default. */
|
|
440
|
+
resetKey(key: keyof S & string): void;
|
|
441
|
+
/**
|
|
442
|
+
* A group, as `reset` does: to its active group preset (or the panel's active preset) while it
|
|
443
|
+
* differs from it, else to its defaults, which forgets the group's preset.
|
|
444
|
+
*/
|
|
445
|
+
resetGroup(group: string): void;
|
|
446
|
+
/** Whether the key (or anything) differs from the active preset; the defaults without one. */
|
|
447
|
+
isModified(key?: keyof S & string): boolean;
|
|
448
|
+
/** Whether `reset` (of every field, or `keys`) would change anything. */
|
|
449
|
+
canReset(keys?: readonly (keyof S & string)[]): boolean;
|
|
450
|
+
/** What differs from the defaults (the values `code()` and Swift export care about). */
|
|
451
|
+
modified(): Partial<Values<S>>;
|
|
452
|
+
/**
|
|
453
|
+
* Random values for every field that can roll (see `canRoll`), or those among `keys`, drawn
|
|
454
|
+
* from `random`. With an active preset, they land near its values (see `AROUND`) instead of
|
|
455
|
+
* anywhere in range. One undo step.
|
|
456
|
+
*/
|
|
457
|
+
randomize(keys?: readonly (keyof S & string)[]): void;
|
|
458
|
+
/** Small changes around the current values instead of a re-roll; skips what can't roll. */
|
|
459
|
+
mutate(keys?: readonly (keyof S & string)[]): void;
|
|
460
|
+
/** Keeps fields out of Random and Mutate (or lets them back in). Saved with the values. */
|
|
461
|
+
lock(keys: (keyof S & string) | readonly (keyof S & string)[], locked?: boolean): void;
|
|
462
|
+
isLocked(key: keyof S & string): boolean;
|
|
463
|
+
/**
|
|
464
|
+
* The combination that presses an action row now, or a toolbar's button (`item`, its id or
|
|
465
|
+
* label): the user's rebinding, else the declared `shortcut`; `""` when cleared, undefined
|
|
466
|
+
* when there's none.
|
|
467
|
+
*/
|
|
468
|
+
shortcut(key: keyof S & string, item?: string): string | undefined;
|
|
469
|
+
/**
|
|
470
|
+
* Rebinds an action row's shortcut (or a toolbar button's): a combination, `""` for none, or
|
|
471
|
+
* undefined to restore the declared one. Not undoable; saved with the values, as locks are.
|
|
472
|
+
*/
|
|
473
|
+
rebind(key: keyof S & string, combo: string | undefined, item?: string): void;
|
|
474
|
+
/**
|
|
475
|
+
* Whether Random and Mutate may change `key`: it holds a value and isn't locked, `random:
|
|
476
|
+
* false`, refused by `tunable`, disabled or read-only.
|
|
477
|
+
*/
|
|
478
|
+
canRoll(key: keyof S & string): boolean;
|
|
479
|
+
/** Whether the field is disabled now (`disabled`, static or from the values). */
|
|
480
|
+
isDisabled(key: keyof S & string): boolean;
|
|
481
|
+
/** Whether the field is read-only now (`readOnly`, static or from the values). */
|
|
482
|
+
isReadOnly(key: keyof S & string): boolean;
|
|
483
|
+
/**
|
|
484
|
+
* Asks panels to read again what they derive without new values: function `disabled` and
|
|
485
|
+
* `readOnly` flags (which may read state elsewhere, another store's say) and row accessories.
|
|
486
|
+
*/
|
|
487
|
+
refresh(): void;
|
|
488
|
+
/**
|
|
489
|
+
* Marks keys as mixed (a multi-selection whose items differ): panels show "—" until the key is
|
|
490
|
+
* edited, and the first edit reaches `onChange` even when it picks the value shown.
|
|
491
|
+
*/
|
|
492
|
+
setMixed(keys: (keyof S & string) | readonly (keyof S & string)[], mixed?: boolean): void;
|
|
493
|
+
isMixed(key: keyof S & string): boolean;
|
|
494
|
+
/**
|
|
495
|
+
* While held, `get()` shows the values from before the last change (the previous undo entry);
|
|
496
|
+
* releasing restores the current ones. Nothing is recorded or stored; `onChange` reports
|
|
497
|
+
* `source: "compare"` both ways.
|
|
498
|
+
*/
|
|
499
|
+
compare(hold: boolean): void;
|
|
500
|
+
readonly comparing: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Applies a preset and makes it the active one (`"default"` clears it); one undo step, or
|
|
503
|
+
* folded into the last with `coalesce` (a pan across the strip).
|
|
504
|
+
*/
|
|
505
|
+
preset(id: string, options?: {
|
|
506
|
+
coalesce?: boolean;
|
|
507
|
+
}): void;
|
|
508
|
+
matchingPreset(): string;
|
|
509
|
+
/**
|
|
510
|
+
* The preset (or saved variant) last applied, which Reset returns to and Random explores
|
|
511
|
+
* around, or null. Kept with the values; forgotten by a reset to the defaults.
|
|
512
|
+
*/
|
|
513
|
+
activePreset(): PresetRef | null;
|
|
514
|
+
/** The group preset last applied to `group` (0-based), or -1. */
|
|
515
|
+
activeGroupPreset(group: string): number;
|
|
516
|
+
/** The values Reset returns to first: the active presets over the defaults. */
|
|
517
|
+
baseValues(): Values<S>;
|
|
518
|
+
/** Each group's numbered presets, complete over the keys they cover. */
|
|
519
|
+
readonly groupPresets: Readonly<Record<string, readonly GroupPreset<Values<S>>[]>>;
|
|
520
|
+
/**
|
|
521
|
+
* Applies a group's preset (0-based) and makes it the group's active one, one undo step;
|
|
522
|
+
* `coalesce` folds it into the previous one (a pan across a card's presets).
|
|
523
|
+
*/
|
|
524
|
+
groupPreset(group: string, index: number, options?: {
|
|
525
|
+
coalesce?: boolean;
|
|
526
|
+
}): void;
|
|
527
|
+
/** The group preset the current values match, or -1. */
|
|
528
|
+
matchingGroupPreset(group: string): number;
|
|
529
|
+
code(format?: CodeFormat, values?: Values<S>): string;
|
|
530
|
+
/** Shows the floating chip on `element`; `chip` overrides the store's chip options. */
|
|
531
|
+
attach(element: HTMLElement, chip?: ChipOptions): () => void;
|
|
532
|
+
mount(container: HTMLElement, options?: MountPanelOptions): () => void;
|
|
533
|
+
}
|
|
534
|
+
/** Whether two fields draw and behave the same (a reshape keeps such a key's value). */
|
|
535
|
+
export declare function sameField(a: unknown, b: unknown): boolean;
|
|
536
|
+
export declare function defineControls<const S extends Schema>(id: string, input: S, options?: ControlsOptions<S>): Controls<S>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A named set of `--k-*` token values for dark and light, applied to panels mounted with
|
|
3
|
+
* `{ preset }` (or with `data-preset="<name>"` and `presetCss(preset)` in your own stylesheet).
|
|
4
|
+
* `css` adds rules for anything tokens don't cover; `&` stands for the panel.
|
|
5
|
+
*/
|
|
6
|
+
export interface TokenPreset {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly dark: Readonly<Record<string, string | number>>;
|
|
9
|
+
readonly light?: Readonly<Record<string, string | number>>;
|
|
10
|
+
readonly css?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The stylesheet for a preset: its dark tokens, its light ones wherever a panel is light. */
|
|
13
|
+
export declare function presetCss(preset: TokenPreset): string;
|
|
14
|
+
/**
|
|
15
|
+
* A dense, square editor (Arcade's Lab): radius 0, compact 26 px rows, the flat frame (groups as
|
|
16
|
+
* plain sections split by hairlines, no cards, and no panel card when inline), the Lab's greys
|
|
17
|
+
* and one blue accent, small type with monospaced readouts, and no glass, glow or lift. Mount it
|
|
18
|
+
* inside the host's own card or column.
|
|
19
|
+
*/
|
|
20
|
+
export declare const labPreset: TokenPreset;
|
|
21
|
+
/**
|
|
22
|
+
* The Problems viewer's parameter panel: separate 34 px bars 4 px apart, its blue fill and
|
|
23
|
+
* labels, a spring card that stacks its curve over two sliders, washes that arrive at once and
|
|
24
|
+
* leave over 100 ms, and Problems' own slider spring (ω 34, ζ 0.86). An inline panel sheds its
|
|
25
|
+
* chrome to sit in the host's column. Every difference from the defaults is a token.
|
|
26
|
+
*/
|
|
27
|
+
export declare const problemsPreset: TokenPreset;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Schema, type Values } from "./schema.js";
|
|
2
|
+
import type { StoragePort } from "./storage.js";
|
|
3
|
+
export interface Variant<V> {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly name?: string;
|
|
6
|
+
readonly values: V;
|
|
7
|
+
}
|
|
8
|
+
export interface Variants<V> {
|
|
9
|
+
readonly ready: boolean;
|
|
10
|
+
list(): readonly Variant<V>[];
|
|
11
|
+
save(name?: string): Variant<V>;
|
|
12
|
+
/**
|
|
13
|
+
* Applies a saved variant, making it the active preset (see `Controls.activePreset`); one undo
|
|
14
|
+
* step, or folded into the last with `coalesce` (a pan across the strip).
|
|
15
|
+
*/
|
|
16
|
+
load(id: string, options?: {
|
|
17
|
+
coalesce?: boolean;
|
|
18
|
+
}): void;
|
|
19
|
+
/** Renames a saved variant (an empty name clears it); kept in storage with the variants. */
|
|
20
|
+
rename(id: string, name: string): void;
|
|
21
|
+
remove(id: string): void;
|
|
22
|
+
export(): string;
|
|
23
|
+
import(json: string): void;
|
|
24
|
+
}
|
|
25
|
+
export declare function createVariants<S extends Schema>(schema: () => S, id: string, key: string, storage: () => StoragePort | null, get: () => Values<S>, set: (v: Values<S>, id: string, coalesce: boolean) => void, notify: () => void, enabled: () => boolean): Variants<Values<S>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { knob, choice, toggle, spring, color, point, easing, action, flatSpring, vec2, vec3, range, angle, seed, keybind, gradient, curve, toolbar, toolbarShortcut, actionShortcut, watch, sparkline, graph, meter, table, log, hasValue, isReadout, wrapAngle, SPRING, type FieldMeta, type ActionField, type SpringPart, type ValueField, type Knob, type Choice, type Toggle, type SpringField, type ColorField, type PointField, type EasingField, type VecField, type Vec3, type RangeField, type AngleField, type SeedField, type KeybindField, type GradientField, type CurveField, type ToolbarField, type ToolbarItem, type ToolbarShortcut, type WatchField, type SparklineField, type GraphField, type GraphSeries, type GraphThreshold, type MeterField, type TableField, type LogField, type ReadoutField, type ReadoutKeys, type ReadoutInput, type Point, type Field, type Schema, type Values, type Value, type State, } from "./core/schema.js";
|
|
2
|
+
export { springCss, springMotion, type SpringValue } from "./core/spring.js";
|
|
3
|
+
export { colorHex, parseColor, type Oklch } from "./core/color.js";
|
|
4
|
+
export { sampleGradient, sampleCurve, gradientCss, CURVE_SHAPES, type GradientStop, type GradientSpace, type CurvePoint, type CurveInterp, type SampleGradientOptions, type SampleCurveOptions, } from "./core/ramp.js";
|
|
5
|
+
export { bezierCss, bezierPoint, EASINGS, type Bezier, type EasingName } from "./core/easing.js";
|
|
6
|
+
export { AROUND } from "./core/random.js";
|
|
7
|
+
export { defineControls, type ChangeMeta, type GestureEvent, type ChangeSource, type ChipOptions, type ControlAction, type Controls, type ControlsOptions, type DensityMode, type GroupPreset, type GroupPresetDisplay, type PresetRef, type HeaderButton, type HeaderOptions, type HostHistory, type LabelOptions, type MountPanelOptions, type PanelCommand, type PanelHandle, type PanelModule, type PanelKeys, type PersistMode, type SearchChip, type SearchOptions, type SyncOptions, type RendererMode, type RevealMode, type SectionFolded, type SoundOptions, type SoundTheme, type ThemeMode, } from "./core/store.js";
|
|
8
|
+
export { createRemoteControls, descriptorToField, formatSwift, fromDescriptors, fromSettings, type SettingsGroup, type SettingsItem, type ActionDescriptor, type ChoiceOption, type ControlDescriptor, type SpringBindingDescriptor, type ToolbarDescriptor, type ReadoutDescriptor, type ValueDescriptor, type RemoteControls, type RemoteControlsOptions, } from "./core/remote.js";
|
|
9
|
+
export type { LogEntry, LogLevel, TableRows, WatchValue } from "./core/readout.js";
|
|
10
|
+
export { memoryStorage, urlFlag, type StoragePort } from "./core/storage.js";
|
|
11
|
+
export type { TokenPreset } from "./core/theme.js";
|
|
12
|
+
export { formatCode, type CodeFormat } from "./core/code.js";
|
|
13
|
+
export { comboFromEvent, letterOf, comboLabel, comboParts, matchesCombo, normalizeCombo, } from "./core/keys.js";
|
|
14
|
+
export type { Variant, Variants } from "./core/variants.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ChipOptions, Controls } from "../core/store.js";
|
|
2
|
+
import type { Schema } from "../core/schema.js";
|
|
3
|
+
export declare function attach<S extends Schema>(controls: Controls<S>, element: HTMLElement, options?: ChipOptions): () => void;
|
|
4
|
+
/** Parses `"Alt+Shift+D"` into a test for keydown events. Letters and digits match by key position. */
|
|
5
|
+
export declare function matchShortcut(shortcut: string): (event: KeyboardEvent) => boolean;
|