@kitlangton/knobs 0.0.0-stage → 0.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.
- package/LICENSE +21 -0
- package/README.md +1270 -2
- package/dist/dev/chunk-e13znr7c.js +155 -0
- package/dist/dev/chunk-kdewv0mt.js +1334 -0
- package/dist/dev/chunk-ktsn42p7.js +15668 -0
- package/dist/dev/chunk-qtt698hp.js +1118 -0
- package/dist/dev/index.js +1389 -0
- package/dist/index.js +2367 -0
- package/dist/panel.js +23635 -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 +2 -0
- package/dist/types/core/readout.d.ts +73 -0
- package/dist/types/core/remote.d.ts +258 -0
- package/dist/types/core/schema.d.ts +526 -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 +474 -0
- package/dist/types/core/theme.d.ts +27 -0
- package/dist/types/core/variants.d.ts +17 -0
- package/dist/types/index.d.ts +13 -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 +159 -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 +712 -0
- package/dist/types/panel/gpu/shader.wgsl.d.ts +2 -0
- package/dist/types/panel/haptics.d.ts +8 -0
- package/dist/types/panel/has.d.ts +14 -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 +10 -0
- package/dist/types/panel/inspector.d.ts +20 -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/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 +48 -0
- package/dist/types/panel/ramps.d.ts +14 -0
- package/dist/types/panel/readout-row.d.ts +21 -0
- package/dist/types/panel/reveal.d.ts +15 -0
- package/dist/types/panel/rolling-css.d.ts +2 -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/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/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/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/index.d.ts +20 -0
- package/dist/types/ui/layer.d.ts +70 -0
- package/dist/types/ui/look.d.ts +53 -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/popover.d.ts +35 -0
- package/dist/types/ui/react.d.ts +45 -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 +40 -0
- package/dist/types/ui/split-model.d.ts +81 -0
- package/dist/types/ui/split.d.ts +75 -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 +6558 -0
- package/dist/ui-solid.js +6511 -0
- package/dist/ui.js +9238 -0
- package/package.json +99 -4
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
import type { RendererMode } from "../../core/store.js";
|
|
2
|
+
import { type HeaderDie } from "../die.js";
|
|
3
|
+
import { type IconName } from "../icons.js";
|
|
4
|
+
import { Edges } from "../motion.js";
|
|
5
|
+
import type { MorphFrame } from "../morph.js";
|
|
6
|
+
import type { PresetStrip } from "../presets.js";
|
|
7
|
+
import type { DigitPlace, Slider } from "../slider.js";
|
|
8
|
+
import type { TabStrip } from "../tabs.js";
|
|
9
|
+
import type { ReadoutView } from "../../ui/readouts.js";
|
|
10
|
+
/** When a row's motion starts (performance.now() ms), so a preset cascade reaches it in turn. */
|
|
11
|
+
export interface RowWave {
|
|
12
|
+
readonly at: number;
|
|
13
|
+
}
|
|
14
|
+
export interface GpuKnobRow {
|
|
15
|
+
readonly kind: "knob";
|
|
16
|
+
readonly key: string;
|
|
17
|
+
readonly display: string;
|
|
18
|
+
readonly row: HTMLElement;
|
|
19
|
+
readonly slider: Slider;
|
|
20
|
+
readonly wave: RowWave;
|
|
21
|
+
isModified(): boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface GpuChoiceRow {
|
|
24
|
+
readonly kind: "choice";
|
|
25
|
+
readonly key: string;
|
|
26
|
+
readonly display: string;
|
|
27
|
+
readonly row: HTMLElement;
|
|
28
|
+
readonly labelEl: HTMLElement;
|
|
29
|
+
readonly segEl: HTMLElement;
|
|
30
|
+
readonly buttons: readonly HTMLButtonElement[];
|
|
31
|
+
/** The selected pill's edges (px from the tray's left). */
|
|
32
|
+
readonly pill: Edges;
|
|
33
|
+
/** The drop-down button it becomes when the segments don't fit (`data-display="menu"`). */
|
|
34
|
+
readonly menu?: {
|
|
35
|
+
readonly button: HTMLButtonElement;
|
|
36
|
+
readonly valueEl: HTMLElement;
|
|
37
|
+
};
|
|
38
|
+
readonly wave: RowWave;
|
|
39
|
+
isModified(): boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface GpuToggleRow {
|
|
42
|
+
readonly kind: "toggle";
|
|
43
|
+
readonly key: string;
|
|
44
|
+
readonly display: string;
|
|
45
|
+
readonly row: HTMLElement;
|
|
46
|
+
readonly labelEl: HTMLElement;
|
|
47
|
+
readonly toggleEl: HTMLButtonElement;
|
|
48
|
+
/** The thumb's edges (px from the track's left). */
|
|
49
|
+
readonly thumb: Edges;
|
|
50
|
+
readonly wave: RowWave;
|
|
51
|
+
isModified(): boolean;
|
|
52
|
+
}
|
|
53
|
+
/** Geometry getters return element-relative px, the same numbers the DOM draws with. */
|
|
54
|
+
export interface GpuSpringRow {
|
|
55
|
+
readonly kind: "spring";
|
|
56
|
+
readonly key: string;
|
|
57
|
+
readonly display: string;
|
|
58
|
+
readonly row: HTMLElement;
|
|
59
|
+
readonly box: HTMLElement;
|
|
60
|
+
curve(): readonly number[];
|
|
61
|
+
guides(): readonly number[];
|
|
62
|
+
/** The running dot: start time, the x,y frames it visits evenly over `ms`. */
|
|
63
|
+
dot(): {
|
|
64
|
+
at: number;
|
|
65
|
+
frames: readonly number[];
|
|
66
|
+
ms: number;
|
|
67
|
+
} | null;
|
|
68
|
+
snap(): boolean;
|
|
69
|
+
readonly wave: RowWave;
|
|
70
|
+
isModified(): boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface GpuExpander {
|
|
73
|
+
readonly head: HTMLElement;
|
|
74
|
+
readonly label: HTMLElement;
|
|
75
|
+
readonly caret: SVGElement;
|
|
76
|
+
readonly body: HTMLElement;
|
|
77
|
+
isOpen(): boolean;
|
|
78
|
+
}
|
|
79
|
+
export interface GpuStrip {
|
|
80
|
+
readonly line: HTMLElement;
|
|
81
|
+
readonly label: HTMLElement;
|
|
82
|
+
readonly track: HTMLElement;
|
|
83
|
+
readonly read: HTMLElement;
|
|
84
|
+
/** 0 hue, 1 chroma, 2 lightness. */
|
|
85
|
+
mode: number;
|
|
86
|
+
thumbX(): number;
|
|
87
|
+
dragging(): boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface GpuColorRow {
|
|
90
|
+
readonly kind: "color";
|
|
91
|
+
readonly key: string;
|
|
92
|
+
readonly display: string;
|
|
93
|
+
readonly row: HTMLElement;
|
|
94
|
+
readonly x: GpuExpander;
|
|
95
|
+
readonly swatch: HTMLElement;
|
|
96
|
+
readonly read: HTMLElement;
|
|
97
|
+
readonly strips: readonly GpuStrip[];
|
|
98
|
+
color(): {
|
|
99
|
+
l: number;
|
|
100
|
+
c: number;
|
|
101
|
+
h: number;
|
|
102
|
+
};
|
|
103
|
+
readonly wave: RowWave;
|
|
104
|
+
isModified(): boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface GpuPointRow {
|
|
107
|
+
readonly kind: "point";
|
|
108
|
+
readonly key: string;
|
|
109
|
+
readonly display: string;
|
|
110
|
+
readonly row: HTMLElement;
|
|
111
|
+
readonly x: GpuExpander;
|
|
112
|
+
readonly read: HTMLElement;
|
|
113
|
+
readonly pad: HTMLElement;
|
|
114
|
+
puck(): readonly [number, number];
|
|
115
|
+
home(): readonly [number, number];
|
|
116
|
+
dragging(): boolean;
|
|
117
|
+
readonly wave: RowWave;
|
|
118
|
+
isModified(): boolean;
|
|
119
|
+
}
|
|
120
|
+
export interface GpuEasingRow {
|
|
121
|
+
readonly kind: "easing";
|
|
122
|
+
readonly key: string;
|
|
123
|
+
readonly display: string;
|
|
124
|
+
readonly row: HTMLElement;
|
|
125
|
+
readonly x: GpuExpander;
|
|
126
|
+
readonly read: HTMLElement;
|
|
127
|
+
readonly mini: SVGElement;
|
|
128
|
+
miniCurve(): readonly number[];
|
|
129
|
+
readonly box: HTMLElement;
|
|
130
|
+
curve(): readonly number[];
|
|
131
|
+
/** P0, P1, P3, P2: the two arms from the ends to their handles. */
|
|
132
|
+
arms(): readonly number[];
|
|
133
|
+
/** (0,0) and (1,1) in the box. */
|
|
134
|
+
guides(): readonly number[];
|
|
135
|
+
readonly handles: readonly HTMLElement[];
|
|
136
|
+
readonly chips: readonly HTMLButtonElement[];
|
|
137
|
+
snap(): boolean;
|
|
138
|
+
readonly wave: RowWave;
|
|
139
|
+
isModified(): boolean;
|
|
140
|
+
}
|
|
141
|
+
/** A handle on a gradient's strip or a curve's graph (element-relative px, like the DOM's). */
|
|
142
|
+
export interface GpuRampHandle {
|
|
143
|
+
readonly el: HTMLElement;
|
|
144
|
+
readonly x: number;
|
|
145
|
+
readonly y: number;
|
|
146
|
+
/** Gamma-encoded sRGB, for a gradient's stop. */
|
|
147
|
+
readonly rgb?: readonly [number, number, number];
|
|
148
|
+
readonly selected: boolean;
|
|
149
|
+
/** Dragged off the strip or graph: it goes when let go. */
|
|
150
|
+
readonly leaving: boolean;
|
|
151
|
+
}
|
|
152
|
+
export interface GpuGradientRow {
|
|
153
|
+
readonly kind: "gradient";
|
|
154
|
+
readonly key: string;
|
|
155
|
+
readonly display: string;
|
|
156
|
+
readonly row: HTMLElement;
|
|
157
|
+
readonly x: GpuExpander;
|
|
158
|
+
readonly read: HTMLElement;
|
|
159
|
+
/** The head's swatch strip, and its stop ticks (x in the strip). */
|
|
160
|
+
readonly mini: HTMLElement;
|
|
161
|
+
ticks(): readonly {
|
|
162
|
+
readonly el: HTMLElement;
|
|
163
|
+
readonly x: number;
|
|
164
|
+
}[];
|
|
165
|
+
/** Evenly spaced samples as gamma sRGB triples, flat (see `gradientSamples`). */
|
|
166
|
+
samples(): readonly number[];
|
|
167
|
+
/** The editor's strip and how far in from each end its ramp starts (the handles' radius). */
|
|
168
|
+
readonly strip: HTMLElement;
|
|
169
|
+
inset(): number;
|
|
170
|
+
handles(): readonly GpuRampHandle[];
|
|
171
|
+
/** The selected stop's colour strips. */
|
|
172
|
+
readonly strips: readonly GpuStrip[];
|
|
173
|
+
color(): {
|
|
174
|
+
l: number;
|
|
175
|
+
c: number;
|
|
176
|
+
h: number;
|
|
177
|
+
};
|
|
178
|
+
readonly chips: readonly HTMLButtonElement[];
|
|
179
|
+
snap(): boolean;
|
|
180
|
+
readonly wave: RowWave;
|
|
181
|
+
isModified(): boolean;
|
|
182
|
+
}
|
|
183
|
+
export interface GpuCurveRow {
|
|
184
|
+
readonly kind: "curve";
|
|
185
|
+
readonly key: string;
|
|
186
|
+
readonly display: string;
|
|
187
|
+
readonly row: HTMLElement;
|
|
188
|
+
readonly x: GpuExpander;
|
|
189
|
+
readonly read: HTMLElement;
|
|
190
|
+
readonly mini: SVGElement;
|
|
191
|
+
miniCurve(): readonly number[];
|
|
192
|
+
readonly graph: HTMLElement;
|
|
193
|
+
/** Grid lines as x0, y0, x1, y1 quadruples in the graph. */
|
|
194
|
+
grid(): readonly number[];
|
|
195
|
+
curve(): readonly number[];
|
|
196
|
+
handles(): readonly GpuRampHandle[];
|
|
197
|
+
/** The hover crosshair: its x, the curve's y there, and the readout's element. */
|
|
198
|
+
hover(): {
|
|
199
|
+
readonly x: number;
|
|
200
|
+
readonly y: number;
|
|
201
|
+
readonly read: HTMLElement;
|
|
202
|
+
} | null;
|
|
203
|
+
readonly chips: readonly HTMLButtonElement[];
|
|
204
|
+
snap(): boolean;
|
|
205
|
+
readonly wave: RowWave;
|
|
206
|
+
isModified(): boolean;
|
|
207
|
+
}
|
|
208
|
+
/** A button row (an action). */
|
|
209
|
+
export interface GpuActionRow {
|
|
210
|
+
readonly kind: "action";
|
|
211
|
+
readonly key: string;
|
|
212
|
+
readonly display: string;
|
|
213
|
+
readonly row: HTMLElement;
|
|
214
|
+
readonly button: HTMLButtonElement;
|
|
215
|
+
readonly wave: RowWave;
|
|
216
|
+
isModified(): boolean;
|
|
217
|
+
}
|
|
218
|
+
/** A vector's number cell: its axis letter and readout (DOM-placed text). */
|
|
219
|
+
export interface GpuCell {
|
|
220
|
+
readonly el: HTMLElement;
|
|
221
|
+
readonly axis: HTMLElement;
|
|
222
|
+
readonly read: HTMLElement;
|
|
223
|
+
/** The inline editor is open over it (the DOM draws that). */
|
|
224
|
+
editing(): boolean;
|
|
225
|
+
/** Being scrubbed. */
|
|
226
|
+
active(): boolean;
|
|
227
|
+
}
|
|
228
|
+
export interface GpuVecRow {
|
|
229
|
+
readonly kind: "vec";
|
|
230
|
+
readonly key: string;
|
|
231
|
+
readonly display: string;
|
|
232
|
+
readonly row: HTMLElement;
|
|
233
|
+
readonly labelEl: HTMLElement;
|
|
234
|
+
readonly cells: readonly GpuCell[];
|
|
235
|
+
readonly link?: HTMLButtonElement;
|
|
236
|
+
linked(): boolean;
|
|
237
|
+
readonly wave: RowWave;
|
|
238
|
+
isModified(): boolean;
|
|
239
|
+
}
|
|
240
|
+
export interface GpuRangeRow {
|
|
241
|
+
readonly kind: "range";
|
|
242
|
+
readonly key: string;
|
|
243
|
+
readonly display: string;
|
|
244
|
+
readonly row: HTMLElement;
|
|
245
|
+
readonly labelEl: HTMLElement;
|
|
246
|
+
readonly track: HTMLElement;
|
|
247
|
+
readonly read: HTMLElement;
|
|
248
|
+
readonly thumbs: readonly [HTMLElement, HTMLElement];
|
|
249
|
+
/** Where the low and high thumbs sit along the track [0..1]. */
|
|
250
|
+
ratios(): readonly [number, number];
|
|
251
|
+
/** In hand: a pointer drag or a pan (both ends move without easing). */
|
|
252
|
+
dragging(): boolean;
|
|
253
|
+
editing(): boolean;
|
|
254
|
+
readonly wave: RowWave;
|
|
255
|
+
isModified(): boolean;
|
|
256
|
+
}
|
|
257
|
+
export interface GpuAngleRow {
|
|
258
|
+
readonly kind: "angle";
|
|
259
|
+
readonly key: string;
|
|
260
|
+
readonly display: string;
|
|
261
|
+
readonly row: HTMLElement;
|
|
262
|
+
readonly labelEl: HTMLElement;
|
|
263
|
+
readonly control: HTMLElement;
|
|
264
|
+
readonly read: HTMLElement;
|
|
265
|
+
readonly dial: HTMLElement;
|
|
266
|
+
/** The hand's angle in degrees, unwrapped so it turns the short way (0 is up, clockwise). */
|
|
267
|
+
turn(): number;
|
|
268
|
+
dragging(): boolean;
|
|
269
|
+
editing(): boolean;
|
|
270
|
+
readonly wave: RowWave;
|
|
271
|
+
isModified(): boolean;
|
|
272
|
+
}
|
|
273
|
+
export interface GpuSeedRow {
|
|
274
|
+
readonly kind: "seed";
|
|
275
|
+
readonly key: string;
|
|
276
|
+
readonly display: string;
|
|
277
|
+
readonly row: HTMLElement;
|
|
278
|
+
readonly labelEl: HTMLElement;
|
|
279
|
+
readonly control: HTMLElement;
|
|
280
|
+
readonly read: HTMLElement;
|
|
281
|
+
/** The readout's reel, a place per digit, ones first. */
|
|
282
|
+
readonly places: readonly DigitPlace[];
|
|
283
|
+
mixed(): boolean;
|
|
284
|
+
readonly die: {
|
|
285
|
+
readonly button: HTMLButtonElement;
|
|
286
|
+
readonly die: HeaderDie;
|
|
287
|
+
};
|
|
288
|
+
editing(): boolean;
|
|
289
|
+
readonly wave: RowWave;
|
|
290
|
+
isModified(): boolean;
|
|
291
|
+
}
|
|
292
|
+
export interface GpuKeybindRow {
|
|
293
|
+
readonly kind: "keybind";
|
|
294
|
+
readonly key: string;
|
|
295
|
+
readonly display: string;
|
|
296
|
+
readonly row: HTMLElement;
|
|
297
|
+
readonly labelEl: HTMLElement;
|
|
298
|
+
readonly chip: HTMLButtonElement;
|
|
299
|
+
readonly text: HTMLElement;
|
|
300
|
+
capturing(): boolean;
|
|
301
|
+
readonly wave: RowWave;
|
|
302
|
+
isModified(): boolean;
|
|
303
|
+
}
|
|
304
|
+
export interface GpuToolbarRow {
|
|
305
|
+
readonly kind: "toolbar";
|
|
306
|
+
readonly key: string;
|
|
307
|
+
readonly display: string;
|
|
308
|
+
readonly row: HTMLElement;
|
|
309
|
+
readonly items: readonly {
|
|
310
|
+
readonly button: HTMLButtonElement;
|
|
311
|
+
readonly icon?: string;
|
|
312
|
+
readonly iconEl?: Element;
|
|
313
|
+
readonly label: HTMLElement;
|
|
314
|
+
readonly chip?: HTMLElement;
|
|
315
|
+
}[];
|
|
316
|
+
readonly wave: RowWave;
|
|
317
|
+
isModified(): boolean;
|
|
318
|
+
}
|
|
319
|
+
/** A readout (watch, sparkline, graph, meter, table, log): the view hands over what it draws. */
|
|
320
|
+
export interface GpuReadoutRow {
|
|
321
|
+
readonly kind: "readout";
|
|
322
|
+
readonly key: string;
|
|
323
|
+
display: string;
|
|
324
|
+
readonly row: HTMLElement;
|
|
325
|
+
readonly labelEl: HTMLElement;
|
|
326
|
+
readonly view: ReadoutView;
|
|
327
|
+
readonly wave: RowWave;
|
|
328
|
+
isModified(): boolean;
|
|
329
|
+
}
|
|
330
|
+
/** A sub-heading inside a group's card (a field's `subsection`). */
|
|
331
|
+
export interface GpuSubheadRow {
|
|
332
|
+
readonly kind: "subhead";
|
|
333
|
+
readonly key: string;
|
|
334
|
+
readonly display: string;
|
|
335
|
+
readonly row: HTMLElement;
|
|
336
|
+
readonly labelEl: HTMLElement;
|
|
337
|
+
readonly caret: SVGElement;
|
|
338
|
+
readonly wave: RowWave;
|
|
339
|
+
isModified(): boolean;
|
|
340
|
+
}
|
|
341
|
+
export type GpuRowBinding = GpuReadoutRow | GpuVecRow | GpuRangeRow | GpuAngleRow | GpuSeedRow | GpuKeybindRow | GpuToolbarRow | GpuSubheadRow | GpuActionRow | GpuKnobRow | GpuChoiceRow | GpuToggleRow | GpuSpringRow | GpuColorRow | GpuPointRow | GpuEasingRow | GpuGradientRow | GpuCurveRow;
|
|
342
|
+
export interface GpuGroupBinding {
|
|
343
|
+
readonly element: HTMLElement;
|
|
344
|
+
readonly labelEl: HTMLElement;
|
|
345
|
+
readonly buttons: readonly HTMLButtonElement[];
|
|
346
|
+
readonly reset: HTMLButtonElement;
|
|
347
|
+
/** The group's Random die. */
|
|
348
|
+
readonly die?: {
|
|
349
|
+
readonly button: HTMLButtonElement;
|
|
350
|
+
readonly die: HeaderDie;
|
|
351
|
+
};
|
|
352
|
+
/** On a page: the header reads as a card title rather than a small-caps label. */
|
|
353
|
+
readonly title?: boolean;
|
|
354
|
+
/** A foldable group's caret (`folded`): it turns as the header's aria-expanded changes. */
|
|
355
|
+
readonly fold?: SVGElement;
|
|
356
|
+
/** On a page: a preset's name, shown in place of the title while its chip is hovered. */
|
|
357
|
+
readonly peek?: HTMLElement;
|
|
358
|
+
/** On a page: the header's controls (presets, reset, die), hidden while the card is folded. */
|
|
359
|
+
readonly controls?: HTMLElement;
|
|
360
|
+
/** On a page: what a folded card's header says in place of its controls. */
|
|
361
|
+
readonly summary?: HTMLElement;
|
|
362
|
+
/** On a page: the muted line under the card's title. */
|
|
363
|
+
readonly desc?: HTMLElement;
|
|
364
|
+
/** On a page: the group's presets, as named or numbered segments, or a compact menu. */
|
|
365
|
+
readonly presets?: {
|
|
366
|
+
readonly seg: HTMLElement;
|
|
367
|
+
readonly buttons: readonly HTMLButtonElement[];
|
|
368
|
+
readonly pill: Edges;
|
|
369
|
+
readonly menu?: HTMLButtonElement;
|
|
370
|
+
readonly menuValue?: HTMLElement;
|
|
371
|
+
readonly isMenu?: () => boolean;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
export interface GpuPanelBinding {
|
|
375
|
+
readonly id: string;
|
|
376
|
+
readonly root: HTMLElement;
|
|
377
|
+
readonly body: HTMLElement;
|
|
378
|
+
readonly inline: boolean;
|
|
379
|
+
readonly header: HTMLElement;
|
|
380
|
+
readonly titleEl: HTMLElement;
|
|
381
|
+
readonly headerButtons: readonly {
|
|
382
|
+
button: HTMLButtonElement;
|
|
383
|
+
icon: IconName;
|
|
384
|
+
}[];
|
|
385
|
+
/** The Random button's die: drawn as its face's glyph at rest, ray-traced while it rolls. */
|
|
386
|
+
readonly headerDie?: {
|
|
387
|
+
readonly button: HTMLButtonElement;
|
|
388
|
+
readonly die: HeaderDie;
|
|
389
|
+
};
|
|
390
|
+
/** Each locked-capable row's lock icon, by its label element; `data-on` says it's locked. */
|
|
391
|
+
readonly locks?: ReadonlyMap<HTMLElement, HTMLElement>;
|
|
392
|
+
readonly presetStrip: PresetStrip;
|
|
393
|
+
/** The tab strip under the header (hidden while the panel has no tabs). */
|
|
394
|
+
readonly tabs?: TabStrip;
|
|
395
|
+
readonly groups: readonly GpuGroupBinding[];
|
|
396
|
+
readonly cards: readonly HTMLElement[];
|
|
397
|
+
readonly rows: readonly GpuRowBinding[];
|
|
398
|
+
readonly actionButtons: readonly HTMLButtonElement[];
|
|
399
|
+
isPopoverOpen(): boolean;
|
|
400
|
+
/** While the panel grows out of (or into) its chip: the shape at a frame time. */
|
|
401
|
+
readonly morph?: (now: number) => MorphFrame | undefined;
|
|
402
|
+
/** True while rows, cards or group heads arrive or leave (a descriptor swap). */
|
|
403
|
+
presence?(): boolean;
|
|
404
|
+
/** True while a different item lands: everything snaps instead of springing. */
|
|
405
|
+
landing?(): boolean;
|
|
406
|
+
/** A full page (see `mountPage`): no panel card; a sticky header the body scrolls under. */
|
|
407
|
+
readonly page?: {
|
|
408
|
+
/** Group cards the overlay draws (custom cards stay in the DOM). */
|
|
409
|
+
readonly tiles: readonly HTMLElement[];
|
|
410
|
+
readonly sections: () => readonly {
|
|
411
|
+
readonly element: HTMLElement;
|
|
412
|
+
readonly head: HTMLElement | null;
|
|
413
|
+
/** Its name, the summary a folded one shows, its description and its caret (one that folds). */
|
|
414
|
+
readonly name?: HTMLElement;
|
|
415
|
+
readonly summary?: HTMLElement;
|
|
416
|
+
readonly desc?: HTMLElement;
|
|
417
|
+
readonly caret?: SVGElement;
|
|
418
|
+
}[];
|
|
419
|
+
/** The jump strip in the header (`nav`), drawn like the tab strip without its hairline. */
|
|
420
|
+
readonly nav?: TabStrip;
|
|
421
|
+
/** Changes whenever cards move, so cached rects are dropped. */
|
|
422
|
+
readonly layoutKey: () => number;
|
|
423
|
+
/** While cards glide or ease their heights: rects are read fresh and the loop stays awake. */
|
|
424
|
+
readonly moving?: () => boolean;
|
|
425
|
+
/** Steps the page's motion at the start of the frame, before its rects are read. */
|
|
426
|
+
readonly frame?: (now: number) => void;
|
|
427
|
+
/** A card's or heading's highlight: how far it's dimmed, and its dot (see `Page.highlight`). */
|
|
428
|
+
readonly emphasis?: (node: HTMLElement) => {
|
|
429
|
+
readonly dim: number;
|
|
430
|
+
readonly mark: number;
|
|
431
|
+
readonly dot?: HTMLElement;
|
|
432
|
+
} | undefined;
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
export interface KnobsGpuDiagnostics {
|
|
436
|
+
readonly supported: boolean;
|
|
437
|
+
readonly active: boolean;
|
|
438
|
+
readonly backend: "webgpu" | "dom";
|
|
439
|
+
readonly panelCount: number;
|
|
440
|
+
readonly frameCount: number;
|
|
441
|
+
readonly skippedFrames: number;
|
|
442
|
+
readonly sleeping: boolean;
|
|
443
|
+
readonly lastInstanceCount: number;
|
|
444
|
+
/** The text the last drawn frame drew (labels, values, titles), for parity checks. */
|
|
445
|
+
readonly lastTexts: readonly string[];
|
|
446
|
+
forceDeviceLoss(): void;
|
|
447
|
+
wake(): void;
|
|
448
|
+
}
|
|
449
|
+
declare global {
|
|
450
|
+
interface Window {
|
|
451
|
+
__knobsGpu?: KnobsGpuDiagnostics;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
export declare function resolveRendererMode(mode: RendererMode, doc: Document): "gpu" | "dom";
|
|
455
|
+
/**
|
|
456
|
+
* The nearest ancestor that makes a stacking context of its own (a transform, filter, z-index,
|
|
457
|
+
* fixed or sticky position, opacity, isolation, containment…). Inside one, a panel's DOM overlays
|
|
458
|
+
* (search, inline editors) stack within it, under the page-level canvas, whatever their z-index.
|
|
459
|
+
*/
|
|
460
|
+
export declare function stackingAncestor(el: HTMLElement): HTMLElement | null;
|
|
461
|
+
declare class GpuOverlayManager {
|
|
462
|
+
private readonly doc;
|
|
463
|
+
private readonly panels;
|
|
464
|
+
private canvas;
|
|
465
|
+
private device;
|
|
466
|
+
private context;
|
|
467
|
+
private format;
|
|
468
|
+
private pipeline;
|
|
469
|
+
private primBuffer;
|
|
470
|
+
private viewBuffer;
|
|
471
|
+
private labelTexture;
|
|
472
|
+
private bindGroup;
|
|
473
|
+
private readonly atlas;
|
|
474
|
+
private readonly data;
|
|
475
|
+
private readonly prevData;
|
|
476
|
+
private primCount;
|
|
477
|
+
private prevPrimCount;
|
|
478
|
+
/** Polyline vertices (viewport px) that line primitives index into. */
|
|
479
|
+
private readonly points;
|
|
480
|
+
private readonly prevPoints;
|
|
481
|
+
private pointCount;
|
|
482
|
+
private prevPointCount;
|
|
483
|
+
private pointBuffer;
|
|
484
|
+
private maskBuffer;
|
|
485
|
+
private readonly masks;
|
|
486
|
+
private maskCount;
|
|
487
|
+
/** Index + 1 of the mask clipping the current panel's content; 0 for none. */
|
|
488
|
+
private curMask;
|
|
489
|
+
/** This frame's time, so the overlay and the DOM sample a morph at the same moment. */
|
|
490
|
+
private frameNow;
|
|
491
|
+
/** Point lists easing from where they were toward new targets, like the DOM's `d` and transform transitions. */
|
|
492
|
+
private readonly morphs;
|
|
493
|
+
private prevCanvasW;
|
|
494
|
+
private prevCanvasH;
|
|
495
|
+
private initializing;
|
|
496
|
+
private supported;
|
|
497
|
+
private failed;
|
|
498
|
+
private rafId;
|
|
499
|
+
private sleeping;
|
|
500
|
+
private dirty;
|
|
501
|
+
private settleFrames;
|
|
502
|
+
private lastTick;
|
|
503
|
+
private frameCount;
|
|
504
|
+
private skippedFrames;
|
|
505
|
+
private listenersAttached;
|
|
506
|
+
private styleVersion;
|
|
507
|
+
private layoutVersion;
|
|
508
|
+
/** Token transitions running on each panel, by property (`transitionrun` minus end/cancel). */
|
|
509
|
+
private readonly tokenRuns;
|
|
510
|
+
private tokenEventAt;
|
|
511
|
+
private readonly pillAnchors;
|
|
512
|
+
private readonly openUntil;
|
|
513
|
+
private readonly rectCache;
|
|
514
|
+
private curActiveEl;
|
|
515
|
+
private curFocusVisible;
|
|
516
|
+
private curPanelHovered;
|
|
517
|
+
private curSubHovered;
|
|
518
|
+
/** Whether the pointer has one of the panel's rows (and keys haven't taken over since). */
|
|
519
|
+
private curPointerRow;
|
|
520
|
+
private readonly hotRows;
|
|
521
|
+
private curPanelRect;
|
|
522
|
+
private curPanelScrollTop;
|
|
523
|
+
private curLayoutKey;
|
|
524
|
+
private curBypassRectCache;
|
|
525
|
+
private cachedCellFont;
|
|
526
|
+
private cachedCellPx;
|
|
527
|
+
private cachedCellWidth;
|
|
528
|
+
private curClip;
|
|
529
|
+
private curScale;
|
|
530
|
+
private curTokens;
|
|
531
|
+
/** Panel opacity (CSS open/close fades), applied to every primitive of the current panel. */
|
|
532
|
+
private curAlpha;
|
|
533
|
+
/** Text drawn this frame, and in the last one finished (see `KnobsGpuDiagnostics.lastTexts`). */
|
|
534
|
+
private frameTexts;
|
|
535
|
+
lastTexts: readonly string[];
|
|
536
|
+
private curDt;
|
|
537
|
+
/** Small eased scalars keyed by an object and a slot (e.g. a row's "hover" or "focus"). */
|
|
538
|
+
private readonly eased;
|
|
539
|
+
private easeMoving;
|
|
540
|
+
private readonly backdrops;
|
|
541
|
+
/** Last on-screen position of each readout character, measured from the right edge. */
|
|
542
|
+
private readonly placeOffsets;
|
|
543
|
+
constructor(doc: Document);
|
|
544
|
+
private get win();
|
|
545
|
+
private publishDiagnostics;
|
|
546
|
+
register(panel: GpuPanelBinding): () => void;
|
|
547
|
+
wake: () => void;
|
|
548
|
+
private attachGlobalListeners;
|
|
549
|
+
private onDocPointer;
|
|
550
|
+
private ensureInitialized;
|
|
551
|
+
private ensureCanvas;
|
|
552
|
+
private initWebGpu;
|
|
553
|
+
private setAllPanelsActive;
|
|
554
|
+
private pushPrim;
|
|
555
|
+
/** --k-rim-width in CSS px, on whole device pixels (at least one), so hairlines stay crisp. */
|
|
556
|
+
private hairline;
|
|
557
|
+
/**
|
|
558
|
+
* The canvas can't sample the page, so each panel gets a backdrop-filter element just under the
|
|
559
|
+
* canvas, kept on the panel's rect: the blur shows through the translucent card drawn above it.
|
|
560
|
+
*/
|
|
561
|
+
private placeBackdrop;
|
|
562
|
+
/** While set, drawn text isn't recorded in `lastTexts` (its whole string already was). */
|
|
563
|
+
private quietText;
|
|
564
|
+
/**
|
|
565
|
+
* While set, text fades around these x's (a range's thumbs), by these strengths: clear for a
|
|
566
|
+
* half-width either side (2.5px unless given), then back over a ramp (4px unless given).
|
|
567
|
+
*/
|
|
568
|
+
private textGaps;
|
|
569
|
+
private drawText;
|
|
570
|
+
/** Springs a per-object scalar toward `target`; keeps the frame loop awake until it settles. */
|
|
571
|
+
/** Omitting `target` keeps the current one. */
|
|
572
|
+
private ease;
|
|
573
|
+
/**
|
|
574
|
+
* Carries a pill along when layout moves its selected button (a token transition, a resize), so
|
|
575
|
+
* only a change of selection animates, as in the DOM, which snaps its pills on resize.
|
|
576
|
+
*/
|
|
577
|
+
private carry;
|
|
578
|
+
private rectOf;
|
|
579
|
+
private isHovered;
|
|
580
|
+
private isFocused;
|
|
581
|
+
private hasFocusVisible;
|
|
582
|
+
/** From `from` (label) to `to` (text) as `el` turns hot, eased like the DOM's 0.15 s colour transitions. */
|
|
583
|
+
private hot;
|
|
584
|
+
/** Hint mode dims what the typed code no longer matches, over the DOM's 0.1 s. */
|
|
585
|
+
private missed;
|
|
586
|
+
/** How far an arriving or leaving node has revealed (its opacity while the reveal runs). */
|
|
587
|
+
private presence;
|
|
588
|
+
/** A control's hover/press wash, faded in and out over the DOM's 0.15 s. */
|
|
589
|
+
private wash;
|
|
590
|
+
/** A spring as quick as the hover tokens: --k-hover-in on the way in, --k-hover-out out. */
|
|
591
|
+
private hoverOmega;
|
|
592
|
+
private drawRowLabel;
|
|
593
|
+
/**
|
|
594
|
+
* A locked row's lock, just left of its readout (or control): it fades and scales in on the
|
|
595
|
+
* reset icon's spring, like .knobs-lock, at the right edge of the room the DOM leaves for it.
|
|
596
|
+
*/
|
|
597
|
+
private drawLock;
|
|
598
|
+
private drawButton;
|
|
599
|
+
/**
|
|
600
|
+
* A button's box in the button tokens (--k-button-*): its fill and outline at rest, washing to
|
|
601
|
+
* their hover twins, at --k-button-radius.
|
|
602
|
+
*/
|
|
603
|
+
private drawButtonBox;
|
|
604
|
+
private isHot;
|
|
605
|
+
/** Square inside its card, except the card's own rounded corners on the first and last rows. */
|
|
606
|
+
private rowCorners;
|
|
607
|
+
/** A row's hover wash, drawn beneath its control like the DOM row background. */
|
|
608
|
+
private drawRowHover;
|
|
609
|
+
/** The hairline above every row but a card's first, and the focus wash. */
|
|
610
|
+
private drawRowOverlay;
|
|
611
|
+
/** Whether `el` shows its focus wash: one wash at a time, the pointer's row's while it has one. */
|
|
612
|
+
private focusWashed;
|
|
613
|
+
private drawSeparator;
|
|
614
|
+
/** The focus wash, matching the row's corners inside its card. */
|
|
615
|
+
private drawFocus;
|
|
616
|
+
private drawIcon;
|
|
617
|
+
/**
|
|
618
|
+
* Copy, and the check it turns into once copied, from the DOM's transitions while they run
|
|
619
|
+
* (--k-copy, --k-check, --k-check-a on the button). Returns whether they're running.
|
|
620
|
+
*/
|
|
621
|
+
private drawCopy;
|
|
622
|
+
/** The die is always traced, at rest too, exactly as the DOM canvas does: nothing swaps. */
|
|
623
|
+
private drawDie;
|
|
624
|
+
/** A circular icon button's hover/focus wash. */
|
|
625
|
+
private drawRoundWash;
|
|
626
|
+
/**
|
|
627
|
+
* A segmented tray (`.knobs-seg`), its sliding pill, and its option labels: used for both choice
|
|
628
|
+
* rows and a page group's numbered preset chips. Returns whether the pill is still moving.
|
|
629
|
+
*/
|
|
630
|
+
private drawSeg;
|
|
631
|
+
/** A card header's compact preset menu: its tray, the selected name (or a dim "Custom") and caret. */
|
|
632
|
+
private drawHeadMenu;
|
|
633
|
+
/**
|
|
634
|
+
* A tab strip (a panel's tabs or a page's jump strip): text, a count after it in the modified
|
|
635
|
+
* colour, and the chosen tab's underline on the lead and trail springs. Returns whether the
|
|
636
|
+
* underline is still moving.
|
|
637
|
+
*/
|
|
638
|
+
private drawTabStrip;
|
|
639
|
+
/** A highlight's dot by a title, where (and as large) as the DOM's `.knobs-mark` is. */
|
|
640
|
+
private drawMark;
|
|
641
|
+
/** Text that fits `maxW`, ellipsized like `text-overflow: ellipsis`. */
|
|
642
|
+
private fit;
|
|
643
|
+
private clipCache;
|
|
644
|
+
/** Whether the DOM lays `el`'s text out wider than its box (so text-overflow shows "…"). */
|
|
645
|
+
private domClipped;
|
|
646
|
+
private curReduced;
|
|
647
|
+
private curLocks;
|
|
648
|
+
/** The current row's selection wash (0…1), which its hover wash gives way to. */
|
|
649
|
+
private curSelected;
|
|
650
|
+
/** A stroke through `pts` (x,y pairs in viewport px), round-capped like SVG's. */
|
|
651
|
+
private pushLine;
|
|
652
|
+
/**
|
|
653
|
+
* Eases a list of numbers toward `target` on the fill spring, the way the DOM transitions the
|
|
654
|
+
* same geometry (`d`, `transform`, `left`); snaps on drags, resizes and reduced motion.
|
|
655
|
+
*/
|
|
656
|
+
private morph;
|
|
657
|
+
/** How fast each of a morph's points moves now (its units per second), 0 at rest. */
|
|
658
|
+
private morphVelocity;
|
|
659
|
+
/** A shape with an outer (ring > 0) or inner (ring < 0) ring, drop shadow and glow. */
|
|
660
|
+
private shape;
|
|
661
|
+
/** An outline like CSS `outline: 1.5px` at `offset`, following `radius`; drawn while focus-visible. */
|
|
662
|
+
private readout;
|
|
663
|
+
/** A disclosure head (hover, label and changed dot, caret, focus); returns the body's clip, if open. */
|
|
664
|
+
private drawHead;
|
|
665
|
+
/** A disclosure chevron, turning a quarter on the lead spring as it opens. */
|
|
666
|
+
private drawCaret;
|
|
667
|
+
/** Draws an open body at its reveal's opacity. */
|
|
668
|
+
private inBody;
|
|
669
|
+
private drawSpring;
|
|
670
|
+
private drawColor;
|
|
671
|
+
/** A colour's hue, chroma and lightness strips, their thumbs filled with `rgb`. */
|
|
672
|
+
private drawColorStrips;
|
|
673
|
+
private drawPoint;
|
|
674
|
+
private drawEasing;
|
|
675
|
+
/** A gradient strip from its samples (see shader kind 13), `inset` in from each end. */
|
|
676
|
+
private pushRamp;
|
|
677
|
+
/** How far a handle that arrived mid-life has grown in (`data-born`), like the DOM's keyframes. */
|
|
678
|
+
private appear;
|
|
679
|
+
private drawGradient;
|
|
680
|
+
private drawCurve;
|
|
681
|
+
private readonly lastHover;
|
|
682
|
+
/** An editor's named presets: a tray of chips, the chosen one on a pill. */
|
|
683
|
+
private drawChips;
|
|
684
|
+
/**
|
|
685
|
+
* A whole number's reel, right-aligned at `right`: each place a wheel seen through a feathered
|
|
686
|
+
* slot, as the slider's readout draws its digits. True while any place moves.
|
|
687
|
+
*/
|
|
688
|
+
private drawReel;
|
|
689
|
+
/** A readout in the value face (--k-value-font, --k-value-size), where the DOM sets its text. */
|
|
690
|
+
private valueText;
|
|
691
|
+
/** A number cell's tray: the field colour, lifting toward surface-hi on hover, focus and drag. */
|
|
692
|
+
private cellTray;
|
|
693
|
+
private drawVec;
|
|
694
|
+
private drawRange;
|
|
695
|
+
private drawAngle;
|
|
696
|
+
private drawKeybind;
|
|
697
|
+
/** A readout's clip: the card's, narrowed to `el` when given. */
|
|
698
|
+
private clipTo;
|
|
699
|
+
/** Paints a readout's ops (local px from `r`'s corner), clipped to it, as its canvas does. */
|
|
700
|
+
private drawPlotOps;
|
|
701
|
+
private readoutFont;
|
|
702
|
+
/** Text with tabular figures, as the DOM's `tnum` lays it out: each digit in the widest one's cell. */
|
|
703
|
+
private tabularWidth;
|
|
704
|
+
private drawReadout;
|
|
705
|
+
private drawToolbar;
|
|
706
|
+
private getDigitCellWidth;
|
|
707
|
+
private buildScene;
|
|
708
|
+
private isDataUnchanged;
|
|
709
|
+
private tick;
|
|
710
|
+
}
|
|
711
|
+
export declare function getGpuOverlayManager(doc: Document): GpuOverlayManager;
|
|
712
|
+
export {};
|