svelte-tweakpane-ui 1.0.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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/dist/control/ButtonGrid.svelte +49 -0
  4. package/dist/control/ButtonGrid.svelte.d.ts +190 -0
  5. package/dist/control/Checkbox.svelte +6 -0
  6. package/dist/control/Checkbox.svelte.d.ts +113 -0
  7. package/dist/control/Color.svelte +79 -0
  8. package/dist/control/Color.svelte.d.ts +177 -0
  9. package/dist/control/CubicBezier.svelte +74 -0
  10. package/dist/control/CubicBezier.svelte.d.ts +204 -0
  11. package/dist/control/Image.svelte +23 -0
  12. package/dist/control/Image.svelte.d.ts +177 -0
  13. package/dist/control/IntervalSlider.svelte +37 -0
  14. package/dist/control/IntervalSlider.svelte.d.ts +196 -0
  15. package/dist/control/List.svelte +69 -0
  16. package/dist/control/List.svelte.d.ts +122 -0
  17. package/dist/control/Point.svelte +100 -0
  18. package/dist/control/Point.svelte.d.ts +374 -0
  19. package/dist/control/RadioGrid.svelte +42 -0
  20. package/dist/control/RadioGrid.svelte.d.ts +231 -0
  21. package/dist/control/Ring.svelte +19 -0
  22. package/dist/control/Ring.svelte.d.ts +220 -0
  23. package/dist/control/RotationEuler.svelte +67 -0
  24. package/dist/control/RotationEuler.svelte.d.ts +273 -0
  25. package/dist/control/RotationQuaternion.svelte +65 -0
  26. package/dist/control/RotationQuaternion.svelte.d.ts +276 -0
  27. package/dist/control/Slider.svelte +6 -0
  28. package/dist/control/Slider.svelte.d.ts +165 -0
  29. package/dist/control/Text.svelte +25 -0
  30. package/dist/control/Text.svelte.d.ts +129 -0
  31. package/dist/control/Textarea.svelte +47 -0
  32. package/dist/control/Textarea.svelte.d.ts +149 -0
  33. package/dist/control/Wheel.svelte +15 -0
  34. package/dist/control/Wheel.svelte.d.ts +186 -0
  35. package/dist/core/Binding.svelte +68 -0
  36. package/dist/core/Binding.svelte.d.ts +116 -0
  37. package/dist/core/Blade.svelte +61 -0
  38. package/dist/core/Blade.svelte.d.ts +90 -0
  39. package/dist/core/Button.svelte +59 -0
  40. package/dist/core/Button.svelte.d.ts +65 -0
  41. package/dist/core/Folder.svelte +69 -0
  42. package/dist/core/Folder.svelte.d.ts +78 -0
  43. package/dist/core/Pane.svelte +51 -0
  44. package/dist/core/Pane.svelte.d.ts +500 -0
  45. package/dist/core/Separator.svelte +14 -0
  46. package/dist/core/Separator.svelte.d.ts +85 -0
  47. package/dist/core/TabGroup.svelte +64 -0
  48. package/dist/core/TabGroup.svelte.d.ts +72 -0
  49. package/dist/core/TabPage.svelte +85 -0
  50. package/dist/core/TabPage.svelte.d.ts +82 -0
  51. package/dist/extra/AutoObject.svelte +46 -0
  52. package/dist/extra/AutoObject.svelte.d.ts +108 -0
  53. package/dist/extra/AutoValue.svelte +11 -0
  54. package/dist/extra/AutoValue.svelte.d.ts +123 -0
  55. package/dist/extra/Element.svelte +53 -0
  56. package/dist/extra/Element.svelte.d.ts +170 -0
  57. package/dist/index.d.ts +94 -0
  58. package/dist/index.js +39 -0
  59. package/dist/internal/ClsPad.svelte +34 -0
  60. package/dist/internal/ClsPad.svelte.d.ts +95 -0
  61. package/dist/internal/GenericBinding.svelte +22 -0
  62. package/dist/internal/GenericBinding.svelte.d.ts +116 -0
  63. package/dist/internal/GenericBladeFolding.svelte +38 -0
  64. package/dist/internal/GenericBladeFolding.svelte.d.ts +95 -0
  65. package/dist/internal/GenericInput.svelte +19 -0
  66. package/dist/internal/GenericInput.svelte.d.ts +116 -0
  67. package/dist/internal/GenericInputFolding.svelte +40 -0
  68. package/dist/internal/GenericInputFolding.svelte.d.ts +140 -0
  69. package/dist/internal/GenericMonitor.svelte +24 -0
  70. package/dist/internal/GenericMonitor.svelte.d.ts +139 -0
  71. package/dist/internal/GenericPane.svelte +100 -0
  72. package/dist/internal/GenericPane.svelte.d.ts +84 -0
  73. package/dist/internal/GenericSlider.svelte +27 -0
  74. package/dist/internal/GenericSlider.svelte.d.ts +146 -0
  75. package/dist/internal/InternalMonitorBoolean.svelte +17 -0
  76. package/dist/internal/InternalMonitorBoolean.svelte.d.ts +154 -0
  77. package/dist/internal/InternalMonitorNumber.svelte +31 -0
  78. package/dist/internal/InternalMonitorNumber.svelte.d.ts +178 -0
  79. package/dist/internal/InternalMonitorString.svelte +23 -0
  80. package/dist/internal/InternalMonitorString.svelte.d.ts +162 -0
  81. package/dist/internal/InternalPaneDraggable.svelte +368 -0
  82. package/dist/internal/InternalPaneDraggable.svelte.d.ts +178 -0
  83. package/dist/internal/InternalPaneFixed.svelte +28 -0
  84. package/dist/internal/InternalPaneFixed.svelte.d.ts +119 -0
  85. package/dist/internal/InternalPaneInline.svelte +29 -0
  86. package/dist/internal/InternalPaneInline.svelte.d.ts +106 -0
  87. package/dist/monitor/FpsGraph.svelte +86 -0
  88. package/dist/monitor/FpsGraph.svelte.d.ts +230 -0
  89. package/dist/monitor/Monitor.svelte +14 -0
  90. package/dist/monitor/Monitor.svelte.d.ts +526 -0
  91. package/dist/monitor/Profiler.svelte +72 -0
  92. package/dist/monitor/Profiler.svelte.d.ts +265 -0
  93. package/dist/monitor/WaveformMonitor.svelte +26 -0
  94. package/dist/monitor/WaveformMonitor.svelte.d.ts +176 -0
  95. package/dist/theme.d.ts +91 -0
  96. package/dist/theme.js +332 -0
  97. package/dist/utils.d.ts +157 -0
  98. package/dist/utils.js +238 -0
  99. package/package.json +280 -0
@@ -0,0 +1,374 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ import type { Simplify } from '../utils';
3
+ import type { Point2dInputParams, Point3dInputParams, Point4dInputParams } from 'tweakpane';
4
+ export type PointValue2dObject = {
5
+ x: number;
6
+ y: number;
7
+ };
8
+ export type PointValue2dTuple = [x: number, y: number];
9
+ export type PointValue2d = Simplify<PointValue2dObject | PointValue2dTuple>;
10
+ export type PointValue3dObject = {
11
+ x: number;
12
+ y: number;
13
+ z: number;
14
+ };
15
+ export type PointValue3dTuple = [x: number, y: number, z: number];
16
+ export type PointValue3d = Simplify<PointValue3dObject | PointValue3dTuple>;
17
+ export type PointValue4dObject = {
18
+ x: number;
19
+ y: number;
20
+ z: number;
21
+ w: number;
22
+ };
23
+ export type PointValue4dTuple = [x: number, y: number, z: number, w: number];
24
+ export type PointValue4d = Simplify<PointValue4dObject | PointValue4dTuple>;
25
+ /**
26
+ * TODO docs
27
+ */
28
+ export type PointOptions<
29
+ Dimensions extends '2' | '3' | '4',
30
+ Axis extends 'w' | 'x' | 'y' | 'z'
31
+ > = Dimensions extends '4'
32
+ ? Point4dInputParams[Axis]
33
+ : Dimensions extends '3'
34
+ ? Point3dInputParams[Axis]
35
+ : Dimensions extends '2'
36
+ ? Point2dInputParams[Axis]
37
+ : never;
38
+ declare class __sveltets_Render<T extends PointValue2d | PointValue3d | PointValue4d> {
39
+ props(): Omit<
40
+ Omit<
41
+ {
42
+ /**
43
+ * The binding's target object with values to manipulate.
44
+ * @bindable
45
+ */
46
+ object: import('@tweakpane/core').Bindable & {
47
+ [x: string]: T;
48
+ };
49
+ /** The key for the value in the target `object` that the control should manipulate. */
50
+ key: string | number;
51
+ /**
52
+ * Prevent interactivity and gray out the control.
53
+ * @default `false`
54
+ */
55
+ disabled?: boolean | undefined;
56
+ /**
57
+ * Text displayed next to control.
58
+ * @default `undefined`
59
+ */
60
+ label?: string | undefined;
61
+ /**
62
+ * Tweakpane's internal options object.
63
+ *
64
+ * See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
65
+ *
66
+ * Valid types are contingent on the type of the value `key` points to in `object`.
67
+ *
68
+ * This is intended internal use, when implementing convenience components wrapping Binding's
69
+ * functionality. Options of interest are instead exposed as top-level props in _Svelte
70
+ * Tweakpane UI_.
71
+ * @default `undefined`
72
+ */
73
+ options?:
74
+ | (T extends PointValue4d
75
+ ? Point4dInputParams
76
+ : T extends PointValue3d
77
+ ? Point3dInputParams
78
+ : T extends PointValue2d
79
+ ? Point2dInputParams
80
+ : unknown)
81
+ | undefined;
82
+ /**
83
+ * Custom color scheme.
84
+ *
85
+ * @default `undefined` \
86
+ * Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
87
+ * set with `setGlobalDefaultTheme()`.
88
+ */
89
+ theme?: import('..').Theme | undefined;
90
+ /**
91
+ * Reference to internal Tweakpane
92
+ * [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
93
+ * this control.
94
+ *
95
+ * This is primarily for internal use, when implementing convenience components wrapping
96
+ * Binding's functionality.
97
+ * @bindable
98
+ * @readonly
99
+ */
100
+ ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined;
101
+ /**
102
+ * Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
103
+ * the binding's containing `<Pane>`.
104
+ *
105
+ * This is primarily for internal use, when implementing convenience components wrapping
106
+ * Binding's functionality in combination with a Tweakpane plugin.
107
+ * @default `undefined`
108
+ */
109
+ plugin?: import('tweakpane').TpPluginBundle | undefined;
110
+ },
111
+ 'object' | 'key'
112
+ > & {
113
+ /**
114
+ * A 2D, 3D, or 4D point object to control.
115
+ *
116
+ * Takes a tuple with a `number` value for each dimension, or an object with at least `x`
117
+ * and `y` values, and optionally `z` and `w` values for additional dimensions.
118
+ *
119
+ * The type of this value will determine the availability of axis-specific option props.
120
+ * @bindable
121
+ */
122
+ value: T;
123
+ } & {
124
+ /**
125
+ * DOM class name of the button used to expand and collapse the input's picker.
126
+ * @default `undefined`
127
+ */
128
+ buttonClass?: string | undefined;
129
+ /**
130
+ * Expand or collapse the input's picker.
131
+ * @default `false`
132
+ * @bindable
133
+ */
134
+ expanded?: boolean | undefined;
135
+ /**
136
+ * The style of value "picker" to use in the input.
137
+ * @default `'popup'`
138
+ */
139
+ picker?: 'inline' | 'popup' | undefined;
140
+ /**
141
+ * Allow users to interactively expand / contract the picker.
142
+ * @default `true`
143
+ */
144
+ userExpandable?: boolean | undefined;
145
+ },
146
+ 'options' | 'ref' | 'plugin' | 'buttonClass'
147
+ > & {
148
+ /**
149
+ * A 2D, 3D, or 4D point object to control.
150
+ *
151
+ * Takes a tuple with a `number` value for each dimension, or an object with at least `x`
152
+ * and `y` values, and optionally `z` and `w` values for additional dimensions.
153
+ *
154
+ * The type of this value will determine the availability of axis-specific option props.
155
+ * @bindable
156
+ * */
157
+ value: T;
158
+ /**
159
+ * The minimum value for all dimensions.
160
+ * @default `undefined` \
161
+ * No minimum.
162
+ * */
163
+ min?: number | undefined;
164
+ /**
165
+ * The maximum value for all dimensions.
166
+ * @default `undefined` \
167
+ * No maximum.
168
+ * */
169
+ max?: number | undefined;
170
+ /**
171
+ * A function to customize the point value's formatting (e.g. rounding, etc.).
172
+ * @default `undefined` \
173
+ * Normal `.toString()` formatting.
174
+ * */
175
+ format?: ((value: number) => string) | undefined;
176
+ /**
177
+ * The unit scale for key-based input for all dimensions (e.g. the up and down arrow keys).
178
+ * @default `1` \
179
+ * Or `stepValue` if defined.
180
+ * */
181
+ keyScale?: number | undefined;
182
+ /**
183
+ * The unit scale for pointer-based input for all dimensions.
184
+ * @default `undefined` \
185
+ * [Dynamic based on magnitude of
186
+ * `value`](https://github.com/cocopon/tweakpane/blob/66dfbea04bfe9b7f031673c955ceda1f92356e75/packages/core/src/common/number/util.ts#L54).
187
+ * */
188
+ pointerScale?: number | undefined;
189
+ /**
190
+ * The minimum step interval for all dimensions.
191
+ * @default `undefined` \
192
+ * No step constraint.
193
+ * */
194
+ step?: number | undefined;
195
+ } & (T extends PointValue2d | PointValue3d | PointValue4d
196
+ ? {
197
+ /**
198
+ * Input parameters specific to the X dimension.
199
+ *
200
+ * Renamed from `x` in Tweakpane API to clarify that it is an object of options, not
201
+ * a value.
202
+ * @default `undefined`
203
+ * */
204
+ optionsX?:
205
+ | (T extends infer T_1
206
+ ? T_1 extends T
207
+ ? T_1 extends PointValue4d
208
+ ? Point4dInputParams
209
+ : T_1 extends PointValue3d
210
+ ? Point3dInputParams
211
+ : T_1 extends PointValue2d
212
+ ? Point2dInputParams
213
+ : unknown
214
+ : never
215
+ : never)['x']
216
+ | undefined;
217
+ /**
218
+ * Input parameters specific to the Y dimension.
219
+ *
220
+ * For 2D point values, the object also includes the `inverted` key, which inverts
221
+ * the Y axis.
222
+ *
223
+ * Renamed from `y` in Tweakpane API to clarify that it is an object of options, not
224
+ * a value.
225
+ * @default `undefined` \
226
+ * `inverted` is `false`
227
+ * */
228
+ optionsY?:
229
+ | (T extends infer T_2
230
+ ? T_2 extends T
231
+ ? T_2 extends PointValue4d
232
+ ? Point4dInputParams
233
+ : T_2 extends PointValue3d
234
+ ? Point3dInputParams
235
+ : T_2 extends PointValue2d
236
+ ? Point2dInputParams
237
+ : unknown
238
+ : never
239
+ : never)['y']
240
+ | undefined;
241
+ }
242
+ : unknown) &
243
+ (T extends PointValue3d | PointValue4d
244
+ ? {
245
+ /**
246
+ * Input parameters specific to the Z dimension.
247
+ *
248
+ * Renamed from `z` in Tweakpane API to clarify that it is an object of options,
249
+ * not a value.
250
+ * @default `undefined`
251
+ * */
252
+ optionsZ?:
253
+ | (T extends infer T_3
254
+ ? T_3 extends T
255
+ ? T_3 extends PointValue4d
256
+ ? Point4dInputParams
257
+ : T_3 extends PointValue3d
258
+ ? Point3dInputParams
259
+ : T_3 extends PointValue2d
260
+ ? Point2dInputParams
261
+ : unknown
262
+ : never
263
+ : never)['z']
264
+ | undefined;
265
+ }
266
+ : unknown) &
267
+ (T extends PointValue4d
268
+ ? {
269
+ /**
270
+ * Input parameters specific to the W dimension.
271
+ *
272
+ * Renamed from `w` in Tweakpane API to clarify that it is an object of options,
273
+ * not a value.
274
+ * @default `undefined`
275
+ * */
276
+ optionsW?:
277
+ | (T extends infer T_4
278
+ ? T_4 extends T
279
+ ? T_4 extends PointValue4d
280
+ ? Point4dInputParams
281
+ : T_4 extends PointValue3d
282
+ ? Point3dInputParams
283
+ : T_4 extends PointValue2d
284
+ ? Point2dInputParams
285
+ : unknown
286
+ : never
287
+ : never)['w']
288
+ | undefined;
289
+ }
290
+ : unknown);
291
+ events(): {} & {
292
+ [evt: string]: CustomEvent<any>;
293
+ };
294
+ slots(): {};
295
+ }
296
+ export type PointProps<T extends PointValue2d | PointValue3d | PointValue4d> = ReturnType<
297
+ __sveltets_Render<T>['props']
298
+ >;
299
+ export type PointEvents<T extends PointValue2d | PointValue3d | PointValue4d> = ReturnType<
300
+ __sveltets_Render<T>['events']
301
+ >;
302
+ export type PointSlots<T extends PointValue2d | PointValue3d | PointValue4d> = ReturnType<
303
+ __sveltets_Render<T>['slots']
304
+ >;
305
+ /**
306
+ * Wraps the Tweakpane [point bindings](https://tweakpane.github.io/docs/input-bindings/#point).
307
+ *
308
+ * Provides a nice cartesian picker for 2D points, and numeric input fields for 3D and 4D points. See
309
+ * the `<RotationEuler>` and `<RotationQuaternion>` components for higher-dimension graphical pickers.
310
+ *
311
+ * Extends the vanilla JS Tweakpane APIs to also support tuple values. (Useful when working with
312
+ * frameworks like [three.js](https://threejs.org) / [threlte](https://threlte.xyz).)
313
+ *
314
+ * `<Point>` is a dynamic component, and the availability of the `optionsZ` and `optionsW` props will
315
+ * change depending on the number of dimensions in the `value`.
316
+ *
317
+ * Usage outside of a `<Pane>` component will implicitly wrap the point picker in a `<Pane
318
+ * position='inline'>` component.
319
+ *
320
+ * @example
321
+ * ```svelte
322
+ * <script lang="ts">
323
+ * import {
324
+ * Point,
325
+ * type PointOptions,
326
+ * type PointValue2d,
327
+ * type PointValue3d,
328
+ * type PointValue4d
329
+ * } from 'svelte-tweakpane-ui';
330
+ *
331
+ * let point2d: PointValue2d = { x: 0, y: 0 };
332
+ *
333
+ * // tuples are also fine
334
+ * let point3d: PointValue3d = [0, 0, 0];
335
+ *
336
+ * // dimension-specific option type needs to know the type of the point value
337
+ * let point3dXOptions: PointOptions<'3', 'x'> = { min: -100, max: 100 };
338
+ *
339
+ * let point4d: PointValue4d = { x: 0, y: 0, z: 0, w: 0 };
340
+ * </script>
341
+ *
342
+ * <Point
343
+ * bind:value={point2d}
344
+ * expanded={true}
345
+ * label="2D Point Picker"
346
+ * picker="inline"
347
+ * userExpandable={false}
348
+ * />
349
+ * <Point
350
+ * bind:value={point3d}
351
+ * label="3D Point Picker"
352
+ * optionsX={point3dXOptions}
353
+ * />
354
+ * <Point bind:value={point4d} min={0} max={100} label="4D Point Picker" />
355
+ *
356
+ * <pre>
357
+ * 2D Value:
358
+ * {JSON.stringify(point2d, null, 2)}
359
+ *
360
+ * 3D Value:
361
+ * {JSON.stringify(point3d, null, 2)}
362
+ *
363
+ * 4D Value:
364
+ * {JSON.stringify(point4d, null, 2)}
365
+ * </pre>
366
+ * ```
367
+ *
368
+ * @sourceLink
369
+ * [Point.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/control/Point.svelte)
370
+ */
371
+ export default class Point<
372
+ T extends PointValue2d | PointValue3d | PointValue4d
373
+ > extends SvelteComponent<PointProps<T>, PointEvents<T>, PointSlots<T>> {}
374
+ export {};
@@ -0,0 +1,42 @@
1
+ <script generics="T extends number | string | boolean">
2
+ import * as pluginModule from '@tweakpane/plugin-essentials';
3
+ import ClsPad from '../internal/ClsPad.svelte';
4
+ import GenericInput from '../internal/GenericInput.svelte';
5
+ import { fillWith } from '../utils';
6
+ import { getGridDimensions } from '../utils.js';
7
+ import { BROWSER } from 'esm-env';
8
+ import { nanoid } from 'nanoid';
9
+ const defaultGroupName = nanoid();
10
+ export let groupName = void 0;
11
+ export let values;
12
+ export let value = values[0];
13
+ export let columns = void 0;
14
+ export let rows = void 0;
15
+ export let suffix = void 0;
16
+ export let prefix = void 0;
17
+ let gridDimensions;
18
+ let options;
19
+ function cells(x, y) {
20
+ const index = y * gridDimensions.columns + x;
21
+ if (index >= 0 && index < values.length) {
22
+ return {
23
+ value: values[index],
24
+ title: `${prefix ?? ''}${values[index]}${suffix ?? ''}`
25
+ };
26
+ }
27
+ return { value: values[0], title: '' };
28
+ }
29
+ $: gridDimensions = getGridDimensions(values.length, columns, rows);
30
+ $: options = {
31
+ cells,
32
+ groupName: groupName ?? defaultGroupName,
33
+ size: [gridDimensions.columns, gridDimensions.rows],
34
+ view: 'radiogrid'
35
+ };
36
+ </script>
37
+
38
+ <GenericInput bind:value {options} plugin={pluginModule} {...$$restProps} />
39
+ {#if !BROWSER}
40
+ <ClsPad keysAdd={fillWith('containerUnitSize', gridDimensions.rows - 1)} theme={$$props.theme} />
41
+ <div style:height={`${2 * (gridDimensions.rows - 1)}px`} />
42
+ {/if}
@@ -0,0 +1,231 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ declare class __sveltets_Render<T extends number | string | boolean> {
3
+ props(): Omit<
4
+ Omit<
5
+ {
6
+ /**
7
+ * The binding's target object with values to manipulate.
8
+ * @bindable
9
+ */
10
+ object: import('@tweakpane/core').Bindable & {
11
+ [x: string]: T;
12
+ };
13
+ /** The key for the value in the target `object` that the control should manipulate. */
14
+ key: string | number;
15
+ /**
16
+ * Prevent interactivity and gray out the control.
17
+ * @default `false`
18
+ */
19
+ disabled?: boolean | undefined;
20
+ /**
21
+ * Text displayed next to control.
22
+ * @default `undefined`
23
+ */
24
+ label?: string | undefined;
25
+ /**
26
+ * Tweakpane's internal options object.
27
+ *
28
+ * See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
29
+ *
30
+ * Valid types are contingent on the type of the value `key` points to in `object`.
31
+ *
32
+ * This is intended internal use, when implementing convenience components wrapping Binding's
33
+ * functionality. Options of interest are instead exposed as top-level props in _Svelte
34
+ * Tweakpane UI_.
35
+ * @default `undefined`
36
+ */
37
+ options?:
38
+ | (import('@tweakpane/core').BaseInputParams & {
39
+ cells: (
40
+ x: number,
41
+ y: number
42
+ ) => {
43
+ value: T;
44
+ title: string;
45
+ };
46
+ groupName: string;
47
+ size: [number, number];
48
+ view: 'radiogrid';
49
+ })
50
+ | undefined;
51
+ /**
52
+ * Custom color scheme.
53
+ *
54
+ * @default `undefined` \
55
+ * Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
56
+ * set with `setGlobalDefaultTheme()`.
57
+ */
58
+ theme?: import('..').Theme | undefined;
59
+ /**
60
+ * Reference to internal Tweakpane
61
+ * [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
62
+ * this control.
63
+ *
64
+ * This is primarily for internal use, when implementing convenience components wrapping
65
+ * Binding's functionality.
66
+ * @bindable
67
+ * @readonly
68
+ */
69
+ ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined;
70
+ /**
71
+ * Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
72
+ * the binding's containing `<Pane>`.
73
+ *
74
+ * This is primarily for internal use, when implementing convenience components wrapping
75
+ * Binding's functionality in combination with a Tweakpane plugin.
76
+ * @default `undefined`
77
+ */
78
+ plugin?: import('tweakpane').TpPluginBundle | undefined;
79
+ },
80
+ 'object' | 'key'
81
+ > & {
82
+ /**
83
+ * Value of selected radio button.
84
+ *
85
+ * Bind to this prop to receive updates when the user clicks a radio button.
86
+ * @bindable
87
+ * @default `undefined` If undefined, the first value in the `values` array is assigned.
88
+ */
89
+ value: T;
90
+ },
91
+ 'options' | 'ref' | 'plugin'
92
+ > & {
93
+ /**
94
+ * Value of selected radio button.
95
+ *
96
+ * Bind to this prop to receive updates when the user clicks a radio button.
97
+ * @bindable
98
+ * @default `undefined` If undefined, the first value in the `values` array is assigned.
99
+ * */
100
+ value?: T | undefined;
101
+ /**
102
+ * Number of columns to arrange the radio buttons into.
103
+ * @default `undefined`
104
+ * */
105
+ columns?: number | undefined;
106
+ /**
107
+ * Name allowing multiple radio groups to share mutually exclusive selection state.
108
+ *
109
+ * Allows spanning exclusive selection state across multiple independent `<RadioGrid>`
110
+ * components, but should remain `undefined` for most use cases to keep exclusivity scoped
111
+ * to a single `<RadioGrid>`.
112
+ * @default `undefined` \
113
+ * Uses a dynamically generated globally unique id internally.
114
+ */
115
+ groupName?: string | undefined;
116
+ /**
117
+ * Text to show in the radio button label before the value.
118
+ * @default `undefined`
119
+ * */
120
+ prefix?: string | undefined;
121
+ /**
122
+ * Number of rows to arrange the radio buttons into.
123
+ * @default `undefined`
124
+ * */
125
+ rows?: number | undefined;
126
+ /**
127
+ * Text to show in the radio button label after the value.
128
+ * @default `undefined`
129
+ * */
130
+ suffix?: string | undefined;
131
+ /**
132
+ * Array of `number`, `string` or `boolean` values, each of which will become a button in
133
+ * the radio grid.
134
+ * */
135
+ values: T[];
136
+ };
137
+ events(): {} & {
138
+ [evt: string]: CustomEvent<any>;
139
+ };
140
+ slots(): {};
141
+ }
142
+ export type RadioGridProps<T extends number | string | boolean> = ReturnType<
143
+ __sveltets_Render<T>['props']
144
+ >;
145
+ export type RadioGridEvents<T extends number | string | boolean> = ReturnType<
146
+ __sveltets_Render<T>['events']
147
+ >;
148
+ export type RadioGridSlots<T extends number | string | boolean> = ReturnType<
149
+ __sveltets_Render<T>['slots']
150
+ >;
151
+ /**
152
+ * A grid of radio buttons.
153
+ *
154
+ * Integrates the [Radio Grid](https://github.com/tweakpane/plugin-essentials#radio-grid) control from
155
+ * Tweakpane-creator [Hiroki Kokubun's](https://cocopon.me) [Essentials
156
+ * plugin](https://github.com/tweakpane/plugin-essentials).
157
+ *
158
+ * See `<ButtonGrid>` for a button-flavored variation.
159
+ *
160
+ * Unlike the vanilla Tweakpane API, _Svelte Tweakpane UI_ provides a unique `groupname` for each
161
+ * instance of RadioGrid by default for consistency with expectations around component isolation. You
162
+ * may still assign the `groupname` prop manually to create cross-component groups that share selection
163
+ * exclusivity.
164
+ *
165
+ * _Svelte Tweakpane UI_ also includes some additional logic to manage default grid dimensions:
166
+ *
167
+ * - If no `rows` or `columns` props are provided, it will create a grid with the squarest possible aspect ratio for the given quantity of `values`.
168
+ *
169
+ * - If a single `rows` or `columns` prop is provided, it lets the undefined axis grow / shrink as needed to accommodate the quantity of `values`.
170
+ *
171
+ * - If both `rows` _and_ `columns` props area provided, then buttons may be clipped if `rows * columns < values.length`.
172
+ *
173
+ *
174
+ * Usage outside of a `<Pane>` component will implicitly wrap the radio grid in `<Pane
175
+ * position='inline'>`.
176
+ *
177
+ * @example
178
+ * ```svelte
179
+ * <script lang="ts">
180
+ * import { RadioGrid } from 'svelte-tweakpane-ui';
181
+ *
182
+ * // Svelte transition works around CSS gradient
183
+ * // transition limitations
184
+ * import { fade } from 'svelte/transition';
185
+ *
186
+ * const radioValues = [
187
+ * ['magenta', 'orange'],
188
+ * ['yellow', 'red'],
189
+ * ['violet', 'gold'],
190
+ * ['red', 'rebeccapurple']
191
+ * ];
192
+ *
193
+ * let value = 1;
194
+ *
195
+ * $: [start, end] = radioValues[value - 1];
196
+ * </script>
197
+ *
198
+ * <RadioGrid bind:value prefix="Color Scheme " values={[1, 2, 3, 4]} />
199
+ *
200
+ * <div class="demo">
201
+ * {#key value}
202
+ * <div class="swatch" style:--e={end} style:--s={start} transition:fade></div>
203
+ * {/key}
204
+ * </div>
205
+ *
206
+ * <style>
207
+ * div.demo {
208
+ * position: relative;
209
+ * aspect-ratio: 1;
210
+ * width: 100%;
211
+ * background: white;
212
+ * }
213
+ *
214
+ * div.swatch {
215
+ * position: absolute;
216
+ * width: 100%;
217
+ * height: 100%;
218
+ * background: linear-gradient(45deg, var(--s), var(--e));
219
+ * }
220
+ * </style>
221
+ * ```
222
+ *
223
+ * @sourceLink
224
+ * [RadioGrid.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/control/RadioGrid.svelte)
225
+ */
226
+ export default class RadioGrid<T extends number | string | boolean> extends SvelteComponent<
227
+ RadioGridProps<T>,
228
+ RadioGridEvents<T>,
229
+ RadioGridSlots<T>
230
+ > {}
231
+ export {};
@@ -0,0 +1,19 @@
1
+ <script context="module"></script>
2
+
3
+ <script>
4
+ import * as pluginModule from '@tweakpane/plugin-camerakit';
5
+ import GenericSlider from '../internal/GenericSlider.svelte';
6
+ export let value;
7
+ export let series = void 0;
8
+ export let unit = void 0;
9
+ export let wide = void 0;
10
+ let options;
11
+ $: options = {
12
+ series,
13
+ unit,
14
+ view: 'cameraring',
15
+ wide
16
+ };
17
+ </script>
18
+
19
+ <GenericSlider bind:value {options} plugin={pluginModule} {...$$restProps} />