svelte-tweakpane-ui 1.0.1 → 1.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/dist/control/ButtonGrid.svelte +6 -7
- package/dist/control/Checkbox.svelte.d.ts +2 -4
- package/dist/control/Color.svelte.d.ts +2 -4
- package/dist/control/CubicBezier.svelte +2 -2
- package/dist/control/Image.svelte.d.ts +2 -4
- package/dist/control/IntervalSlider.svelte.d.ts +2 -4
- package/dist/control/List.svelte +7 -13
- package/dist/control/List.svelte.d.ts +3 -5
- package/dist/control/Point.svelte.d.ts +29 -31
- package/dist/control/RadioGrid.svelte.d.ts +2 -4
- package/dist/control/Ring.svelte.d.ts +2 -4
- package/dist/control/RotationEuler.svelte.d.ts +66 -4
- package/dist/control/RotationQuaternion.svelte.d.ts +2 -4
- package/dist/control/Slider.svelte.d.ts +2 -4
- package/dist/control/Text.svelte.d.ts +2 -4
- package/dist/control/Textarea.svelte +1 -3
- package/dist/control/Textarea.svelte.d.ts +2 -4
- package/dist/control/Wheel.svelte.d.ts +3 -9
- package/dist/core/Blade.svelte +5 -6
- package/dist/core/TabGroup.svelte +4 -5
- package/dist/core/TabPage.svelte +2 -2
- package/dist/extra/AutoObject.svelte +3 -5
- package/dist/extra/AutoValue.svelte.d.ts +6 -4
- package/dist/extra/Element.svelte +1 -3
- package/dist/index.js +5 -5
- package/dist/internal/ClsPad.svelte +2 -6
- package/dist/internal/ClsPad.svelte.d.ts +10 -0
- package/dist/internal/GenericBinding.svelte.d.ts +2 -4
- package/dist/internal/GenericBladeFolding.svelte +1 -1
- package/dist/internal/GenericInput.svelte +4 -6
- package/dist/internal/GenericInput.svelte.d.ts +2 -4
- package/dist/internal/GenericInputFolding.svelte +2 -2
- package/dist/internal/GenericInputFolding.svelte.d.ts +2 -4
- package/dist/internal/GenericMonitor.svelte +1 -1
- package/dist/internal/GenericMonitor.svelte.d.ts +2 -4
- package/dist/internal/GenericPane.svelte +26 -15
- package/dist/internal/GenericSlider.svelte +10 -12
- package/dist/internal/GenericSlider.svelte.d.ts +2 -4
- package/dist/internal/InternalMonitorBoolean.svelte.d.ts +2 -4
- package/dist/internal/InternalMonitorNumber.svelte.d.ts +2 -4
- package/dist/internal/InternalMonitorString.svelte.d.ts +2 -4
- package/dist/internal/InternalPaneDraggable.svelte +20 -19
- package/dist/internal/InternalPaneFixed.svelte +1 -3
- package/dist/internal/InternalPaneInline.svelte +1 -1
- package/dist/monitor/FpsGraph.svelte +2 -2
- package/dist/monitor/Monitor.svelte.d.ts +23 -31
- package/dist/monitor/Profiler.svelte +2 -2
- package/dist/monitor/WaveformMonitor.svelte.d.ts +2 -4
- package/dist/theme.d.ts +1 -3
- package/dist/theme.js +25 -32
- package/dist/utils.d.ts +5 -2
- package/dist/utils.js +34 -28
- package/package.json +17 -11
- package/{README.md → readme.md} +1 -1
- /package/{LICENSE → license.txt} +0 -0
|
@@ -32,14 +32,13 @@
|
|
|
32
32
|
size: [gridDimensions.columns, gridDimensions.rows],
|
|
33
33
|
view: 'buttongrid'
|
|
34
34
|
};
|
|
35
|
-
$: gridBlade
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
label: event.cell.title
|
|
41
|
-
});
|
|
35
|
+
$: gridBlade?.on('click', (event) => {
|
|
36
|
+
dispatch('click', {
|
|
37
|
+
cell: { x: event.index[0], y: event.index[1] },
|
|
38
|
+
index: event.index[1] * gridDimensions.columns + event.index[0],
|
|
39
|
+
label: event.cell.title
|
|
42
40
|
});
|
|
41
|
+
});
|
|
43
42
|
</script>
|
|
44
43
|
|
|
45
44
|
<Blade bind:ref={gridBlade} {options} plugin={pluginModule} {...$$restProps} />
|
|
@@ -7,11 +7,9 @@ declare const __propDef: {
|
|
|
7
7
|
* The binding's target object with values to manipulate.
|
|
8
8
|
* @bindable
|
|
9
9
|
*/
|
|
10
|
-
object: import('@tweakpane/core').Bindable &
|
|
11
|
-
[x: string]: boolean;
|
|
12
|
-
};
|
|
10
|
+
object: import('@tweakpane/core').Bindable & Record<string, boolean>;
|
|
13
11
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
14
|
-
key: string
|
|
12
|
+
key: string;
|
|
15
13
|
/**
|
|
16
14
|
* Prevent interactivity and gray out the control.
|
|
17
15
|
* @default `false`
|
|
@@ -25,11 +25,9 @@ declare const __propDef: {
|
|
|
25
25
|
* The binding's target object with values to manipulate.
|
|
26
26
|
* @bindable
|
|
27
27
|
*/
|
|
28
|
-
object: import('@tweakpane/core').Bindable &
|
|
29
|
-
[x: string]: ColorValue;
|
|
30
|
-
};
|
|
28
|
+
object: import('@tweakpane/core').Bindable & Record<string, ColorValue>;
|
|
31
29
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
32
|
-
key: string
|
|
30
|
+
key: string;
|
|
33
31
|
/**
|
|
34
32
|
* Prevent interactivity and gray out the control.
|
|
35
33
|
* @default `false`
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
y1: event.value.y1,
|
|
31
31
|
x2: event.value.x2,
|
|
32
32
|
y2: event.value.y2
|
|
33
|
-
|
|
33
|
+
};
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
$: options = {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
<style>
|
|
62
62
|
/* Fix overflow bug from the plugin TODO PR */
|
|
63
|
-
:global(div.tp-cbzv:not(tp-cbzv-expanded) div.tp-cbzv_p) {
|
|
63
|
+
:global(div.svelte-tweakpane-ui div.tp-cbzv:not(tp-cbzv-expanded) div.tp-cbzv_p) {
|
|
64
64
|
overflow: hidden !important;
|
|
65
65
|
}
|
|
66
66
|
</style>
|
|
@@ -8,11 +8,9 @@ declare const __propDef: {
|
|
|
8
8
|
* The binding's target object with values to manipulate.
|
|
9
9
|
* @bindable
|
|
10
10
|
*/
|
|
11
|
-
object: import('@tweakpane/core').Bindable &
|
|
12
|
-
[x: string]: ImageValue;
|
|
13
|
-
};
|
|
11
|
+
object: import('@tweakpane/core').Bindable & Record<string, ImageValue>;
|
|
14
12
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
15
|
-
key: string
|
|
13
|
+
key: string;
|
|
16
14
|
/**
|
|
17
15
|
* Prevent interactivity and gray out the control.
|
|
18
16
|
* @default `false`
|
|
@@ -14,11 +14,9 @@ declare const __propDef: {
|
|
|
14
14
|
* The binding's target object with values to manipulate.
|
|
15
15
|
* @bindable
|
|
16
16
|
*/
|
|
17
|
-
object: import('@tweakpane/core').Bindable &
|
|
18
|
-
[x: string]: IntervalSliderValue;
|
|
19
|
-
};
|
|
17
|
+
object: import('@tweakpane/core').Bindable & Record<string, IntervalSliderValue>;
|
|
20
18
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
21
|
-
key: string
|
|
19
|
+
key: string;
|
|
22
20
|
/**
|
|
23
21
|
* Prevent interactivity and gray out the control.
|
|
24
22
|
* @default `false`
|
package/dist/control/List.svelte
CHANGED
|
@@ -20,13 +20,11 @@
|
|
|
20
20
|
if (Array.isArray(internalOptions)) {
|
|
21
21
|
value = internalOptions[0].value;
|
|
22
22
|
return value;
|
|
23
|
-
} else {
|
|
24
|
-
value = internalOptions[Object.keys(internalOptions)[0]];
|
|
25
|
-
return value;
|
|
26
23
|
}
|
|
27
|
-
|
|
24
|
+
value = internalOptions[Object.keys(internalOptions)[0]];
|
|
28
25
|
return value;
|
|
29
26
|
}
|
|
27
|
+
return value;
|
|
30
28
|
}
|
|
31
29
|
function isArrayStyleListOptions(object) {
|
|
32
30
|
return (
|
|
@@ -40,15 +38,11 @@
|
|
|
40
38
|
return typeof object === 'object' && object !== null && !Array.isArray(object);
|
|
41
39
|
}
|
|
42
40
|
function getInternalOptions(options2) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return options2.map((value2) => {
|
|
49
|
-
return { value: value2, text: JSON.stringify(value2) };
|
|
50
|
-
});
|
|
51
|
-
}
|
|
41
|
+
return isArrayStyleListOptions(options2)
|
|
42
|
+
? options2
|
|
43
|
+
: isObjectStyleListOptions(options2)
|
|
44
|
+
? options2
|
|
45
|
+
: options2.map((value2) => ({ value: value2, text: JSON.stringify(value2) }));
|
|
52
46
|
}
|
|
53
47
|
function setValue() {
|
|
54
48
|
listBlade.value = value;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
2
|
import type { Simplify } from '../utils';
|
|
3
3
|
export type ListOptionsArray<T> = T[];
|
|
4
|
-
export type ListOptionsObjectArray<T> = {
|
|
4
|
+
export type ListOptionsObjectArray<T> = Array<{
|
|
5
5
|
value: T;
|
|
6
6
|
text: string;
|
|
7
|
-
}
|
|
8
|
-
export type ListOptionsRecord<T> =
|
|
9
|
-
[text: string]: T;
|
|
10
|
-
};
|
|
7
|
+
}>;
|
|
8
|
+
export type ListOptionsRecord<T> = Record<string, T>;
|
|
11
9
|
export type ListOptions<T> = Simplify<
|
|
12
10
|
ListOptionsArray<T> | ListOptionsObjectArray<T> | ListOptionsRecord<T>
|
|
13
11
|
>;
|
|
@@ -31,10 +31,10 @@ export type PointOptions<
|
|
|
31
31
|
> = Dimensions extends '4'
|
|
32
32
|
? Point4dInputParams[Axis]
|
|
33
33
|
: Dimensions extends '3'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
? Point3dInputParams[Axis]
|
|
35
|
+
: Dimensions extends '2'
|
|
36
|
+
? Point2dInputParams[Axis]
|
|
37
|
+
: never;
|
|
38
38
|
declare class __sveltets_Render<T extends PointValue2d | PointValue3d | PointValue4d> {
|
|
39
39
|
props(): Omit<
|
|
40
40
|
Omit<
|
|
@@ -43,11 +43,9 @@ declare class __sveltets_Render<T extends PointValue2d | PointValue3d | PointVal
|
|
|
43
43
|
* The binding's target object with values to manipulate.
|
|
44
44
|
* @bindable
|
|
45
45
|
*/
|
|
46
|
-
object: import('@tweakpane/core').Bindable &
|
|
47
|
-
[x: string]: T;
|
|
48
|
-
};
|
|
46
|
+
object: import('@tweakpane/core').Bindable & Record<string, T>;
|
|
49
47
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
50
|
-
key: string
|
|
48
|
+
key: string;
|
|
51
49
|
/**
|
|
52
50
|
* Prevent interactivity and gray out the control.
|
|
53
51
|
* @default `false`
|
|
@@ -74,10 +72,10 @@ declare class __sveltets_Render<T extends PointValue2d | PointValue3d | PointVal
|
|
|
74
72
|
| (T extends PointValue4d
|
|
75
73
|
? Point4dInputParams
|
|
76
74
|
: T extends PointValue3d
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
? Point3dInputParams
|
|
76
|
+
: T extends PointValue2d
|
|
77
|
+
? Point2dInputParams
|
|
78
|
+
: unknown)
|
|
81
79
|
| undefined;
|
|
82
80
|
/**
|
|
83
81
|
* Custom color scheme.
|
|
@@ -207,10 +205,10 @@ declare class __sveltets_Render<T extends PointValue2d | PointValue3d | PointVal
|
|
|
207
205
|
? T_1 extends PointValue4d
|
|
208
206
|
? Point4dInputParams
|
|
209
207
|
: T_1 extends PointValue3d
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
208
|
+
? Point3dInputParams
|
|
209
|
+
: T_1 extends PointValue2d
|
|
210
|
+
? Point2dInputParams
|
|
211
|
+
: unknown
|
|
214
212
|
: never
|
|
215
213
|
: never)['x']
|
|
216
214
|
| undefined;
|
|
@@ -231,14 +229,14 @@ declare class __sveltets_Render<T extends PointValue2d | PointValue3d | PointVal
|
|
|
231
229
|
? T_2 extends PointValue4d
|
|
232
230
|
? Point4dInputParams
|
|
233
231
|
: T_2 extends PointValue3d
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
? Point3dInputParams
|
|
233
|
+
: T_2 extends PointValue2d
|
|
234
|
+
? Point2dInputParams
|
|
235
|
+
: unknown
|
|
238
236
|
: never
|
|
239
237
|
: never)['y']
|
|
240
238
|
| undefined;
|
|
241
|
-
|
|
239
|
+
}
|
|
242
240
|
: unknown) &
|
|
243
241
|
(T extends PointValue3d | PointValue4d
|
|
244
242
|
? {
|
|
@@ -255,14 +253,14 @@ declare class __sveltets_Render<T extends PointValue2d | PointValue3d | PointVal
|
|
|
255
253
|
? T_3 extends PointValue4d
|
|
256
254
|
? Point4dInputParams
|
|
257
255
|
: T_3 extends PointValue3d
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
256
|
+
? Point3dInputParams
|
|
257
|
+
: T_3 extends PointValue2d
|
|
258
|
+
? Point2dInputParams
|
|
259
|
+
: unknown
|
|
262
260
|
: never
|
|
263
261
|
: never)['z']
|
|
264
262
|
| undefined;
|
|
265
|
-
|
|
263
|
+
}
|
|
266
264
|
: unknown) &
|
|
267
265
|
(T extends PointValue4d
|
|
268
266
|
? {
|
|
@@ -279,14 +277,14 @@ declare class __sveltets_Render<T extends PointValue2d | PointValue3d | PointVal
|
|
|
279
277
|
? T_4 extends PointValue4d
|
|
280
278
|
? Point4dInputParams
|
|
281
279
|
: T_4 extends PointValue3d
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
280
|
+
? Point3dInputParams
|
|
281
|
+
: T_4 extends PointValue2d
|
|
282
|
+
? Point2dInputParams
|
|
283
|
+
: unknown
|
|
286
284
|
: never
|
|
287
285
|
: never)['w']
|
|
288
286
|
| undefined;
|
|
289
|
-
|
|
287
|
+
}
|
|
290
288
|
: unknown);
|
|
291
289
|
events(): {} & {
|
|
292
290
|
[evt: string]: CustomEvent<any>;
|
|
@@ -7,11 +7,9 @@ declare class __sveltets_Render<T extends number | string | boolean> {
|
|
|
7
7
|
* The binding's target object with values to manipulate.
|
|
8
8
|
* @bindable
|
|
9
9
|
*/
|
|
10
|
-
object: import('@tweakpane/core').Bindable &
|
|
11
|
-
[x: string]: T;
|
|
12
|
-
};
|
|
10
|
+
object: import('@tweakpane/core').Bindable & Record<string, T>;
|
|
13
11
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
14
|
-
key: string
|
|
12
|
+
key: string;
|
|
15
13
|
/**
|
|
16
14
|
* Prevent interactivity and gray out the control.
|
|
17
15
|
* @default `false`
|
|
@@ -33,11 +33,9 @@ declare const __propDef: {
|
|
|
33
33
|
* The binding's target object with values to manipulate.
|
|
34
34
|
* @bindable
|
|
35
35
|
*/
|
|
36
|
-
object: import('@tweakpane/core').Bindable &
|
|
37
|
-
[x: string]: number;
|
|
38
|
-
};
|
|
36
|
+
object: import('@tweakpane/core').Bindable & Record<string, number>;
|
|
39
37
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
40
|
-
key: string
|
|
38
|
+
key: string;
|
|
41
39
|
/**
|
|
42
40
|
* Prevent interactivity and gray out the control.
|
|
43
41
|
* @default `false`
|
|
@@ -22,11 +22,73 @@ declare const __propDef: {
|
|
|
22
22
|
* The binding's target object with values to manipulate.
|
|
23
23
|
* @bindable
|
|
24
24
|
*/
|
|
25
|
-
object: import('@tweakpane/core').Bindable &
|
|
26
|
-
[x: string]: RotationEulerValue;
|
|
27
|
-
};
|
|
25
|
+
object: import('@tweakpane/core').Bindable & Record<string, RotationEulerValue>;
|
|
28
26
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
29
|
-
key: string
|
|
27
|
+
key: string /**
|
|
28
|
+
* Integrates the [euler
|
|
29
|
+
* rotation](https://github.com/0b5vr/tweakpane-plugin-rotation/blob/dev/src/RotationInputPluginEuler.ts)
|
|
30
|
+
* control from [0b5vr's](https://0b5vr.com)
|
|
31
|
+
* [tweakpane-plugin-rotation](https://github.com/0b5vr/tweakpane-plugin-rotation).
|
|
32
|
+
*
|
|
33
|
+
* _Svelte Tweakpane UI_ extends the original API to support tuple values in addition to object values.
|
|
34
|
+
* (Useful when working with frameworks like [three.js](https://threejs.org) /
|
|
35
|
+
* [threlte](https://threlte.xyz).)
|
|
36
|
+
*
|
|
37
|
+
* A utility function `Utils.eulerToCssTransform()` is also provided to easily convert a quaternion
|
|
38
|
+
* value object or tuple into a CSS transform string.
|
|
39
|
+
*
|
|
40
|
+
* See also <RotationQuaternion> if you're feeling gimbal locked.
|
|
41
|
+
*
|
|
42
|
+
* Usage outside of a `<Pane>` component will implicitly wrap the profiler in `<Pane
|
|
43
|
+
* position='inline'>`.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```svelte
|
|
47
|
+
* <script lang="ts">
|
|
48
|
+
* import {
|
|
49
|
+
* Button,
|
|
50
|
+
* RotationEuler,
|
|
51
|
+
* type RotationEulerValueObject,
|
|
52
|
+
* Utils
|
|
53
|
+
* } from 'svelte-tweakpane-ui';
|
|
54
|
+
*
|
|
55
|
+
* // Value could also be a tuple
|
|
56
|
+
* // e.g. [0, 0, 0]
|
|
57
|
+
* let value: RotationEulerValueObject = { x: 0, y: 0, z: 0 };
|
|
58
|
+
*
|
|
59
|
+
* $: transform = Utils.eulerToCssTransform(value);
|
|
60
|
+
* $: valueRows = Object.values(value)
|
|
61
|
+
* .map((v) => `${v >= 0 ? '+' : ''}${v.toFixed(6)}`)
|
|
62
|
+
* .join('\n');
|
|
63
|
+
* </script>
|
|
64
|
+
*
|
|
65
|
+
* <RotationEuler
|
|
66
|
+
* bind:value
|
|
67
|
+
* expanded={true}
|
|
68
|
+
* label="CSS Rotation"
|
|
69
|
+
* picker={'inline'}
|
|
70
|
+
* />
|
|
71
|
+
* <Button on:click={() => (value = { x: 0, y: 0, z: 0 })} title="Reset" />
|
|
72
|
+
*
|
|
73
|
+
* <div class="billboard" style:transform>
|
|
74
|
+
* <pre>{valueRows}</pre>
|
|
75
|
+
* </div>
|
|
76
|
+
*
|
|
77
|
+
* <style>
|
|
78
|
+
* div.billboard {
|
|
79
|
+
* display: flex;
|
|
80
|
+
* align-items: center;
|
|
81
|
+
* justify-content: center;
|
|
82
|
+
* aspect-ratio: 1;
|
|
83
|
+
* width: 100%;
|
|
84
|
+
* background: linear-gradient(45deg, magenta, orange);
|
|
85
|
+
* }
|
|
86
|
+
* </style>
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @sourceLink
|
|
90
|
+
* [RotationEuler.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/control/RotationEuler.svelte)
|
|
91
|
+
*/;
|
|
30
92
|
/**
|
|
31
93
|
* Prevent interactivity and gray out the control.
|
|
32
94
|
* @default `false`
|
|
@@ -21,11 +21,9 @@ declare const __propDef: {
|
|
|
21
21
|
* The binding's target object with values to manipulate.
|
|
22
22
|
* @bindable
|
|
23
23
|
*/
|
|
24
|
-
object: import('@tweakpane/core').Bindable &
|
|
25
|
-
[x: string]: RotationQuaternionValue;
|
|
26
|
-
};
|
|
24
|
+
object: import('@tweakpane/core').Bindable & Record<string, RotationQuaternionValue>;
|
|
27
25
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
28
|
-
key: string
|
|
26
|
+
key: string;
|
|
29
27
|
/**
|
|
30
28
|
* Prevent interactivity and gray out the control.
|
|
31
29
|
* @default `false`
|
|
@@ -7,11 +7,9 @@ declare const __propDef: {
|
|
|
7
7
|
* The binding's target object with values to manipulate.
|
|
8
8
|
* @bindable
|
|
9
9
|
*/
|
|
10
|
-
object: import('@tweakpane/core').Bindable &
|
|
11
|
-
[x: string]: number;
|
|
12
|
-
};
|
|
10
|
+
object: import('@tweakpane/core').Bindable & Record<string, number>;
|
|
13
11
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
14
|
-
key: string
|
|
12
|
+
key: string;
|
|
15
13
|
/**
|
|
16
14
|
* Prevent interactivity and gray out the control.
|
|
17
15
|
* @default `false`
|
|
@@ -8,11 +8,9 @@ declare const __propDef: {
|
|
|
8
8
|
* The binding's target object with values to manipulate.
|
|
9
9
|
* @bindable
|
|
10
10
|
*/
|
|
11
|
-
object: import('@tweakpane/core').Bindable &
|
|
12
|
-
[x: string]: string;
|
|
13
|
-
};
|
|
11
|
+
object: import('@tweakpane/core').Bindable & Record<string, string>;
|
|
14
12
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
15
|
-
key: string
|
|
13
|
+
key: string;
|
|
16
14
|
/**
|
|
17
15
|
* Prevent interactivity and gray out the control.
|
|
18
16
|
* @default `false`
|
|
@@ -14,15 +14,13 @@
|
|
|
14
14
|
updateListeners(live ?? true, true);
|
|
15
15
|
});
|
|
16
16
|
function onBlur(event) {
|
|
17
|
-
console.log('onblur');
|
|
18
17
|
value = event.target.value;
|
|
19
18
|
}
|
|
20
19
|
function onInput(event) {
|
|
21
|
-
console.log('input');
|
|
22
20
|
value = event.target.value;
|
|
23
21
|
}
|
|
24
22
|
function updateListeners(live2, destroy = false) {
|
|
25
|
-
|
|
23
|
+
const input = ref?.controller.valueController.view.element.querySelector('textarea');
|
|
26
24
|
if (input) {
|
|
27
25
|
input.removeEventListener('blur', onBlur);
|
|
28
26
|
input.removeEventListener('input', onInput);
|
|
@@ -9,11 +9,9 @@ declare const __propDef: {
|
|
|
9
9
|
* The binding's target object with values to manipulate.
|
|
10
10
|
* @bindable
|
|
11
11
|
*/
|
|
12
|
-
object: import('@tweakpane/core').Bindable &
|
|
13
|
-
[x: string]: string;
|
|
14
|
-
};
|
|
12
|
+
object: import('@tweakpane/core').Bindable & Record<string, string>;
|
|
15
13
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
16
|
-
key: string
|
|
14
|
+
key: string;
|
|
17
15
|
/**
|
|
18
16
|
* Prevent interactivity and gray out the control.
|
|
19
17
|
* @default `false`
|
|
@@ -7,11 +7,9 @@ declare const __propDef: {
|
|
|
7
7
|
* The binding's target object with values to manipulate.
|
|
8
8
|
* @bindable
|
|
9
9
|
*/
|
|
10
|
-
object: import('@tweakpane/core').Bindable &
|
|
11
|
-
[x: string]: number;
|
|
12
|
-
};
|
|
10
|
+
object: import('@tweakpane/core').Bindable & Record<string, number>;
|
|
13
11
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
14
|
-
key: string
|
|
12
|
+
key: string;
|
|
15
13
|
/**
|
|
16
14
|
* Prevent interactivity and gray out the control.
|
|
17
15
|
* @default `false`
|
|
@@ -78,11 +76,7 @@ declare const __propDef: {
|
|
|
78
76
|
* Specifying both a `min` and a `max` prop turns the control into a slider.
|
|
79
77
|
* @default `undefined`
|
|
80
78
|
*/
|
|
81
|
-
min?: number | undefined
|
|
82
|
-
* When `true`, expand the width of the wheel control at the expense of the numerical input
|
|
83
|
-
* field.
|
|
84
|
-
* @default `false`
|
|
85
|
-
* */;
|
|
79
|
+
min?: number | undefined;
|
|
86
80
|
/**
|
|
87
81
|
* Maximum value.
|
|
88
82
|
*
|
package/dist/core/Blade.svelte
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
index,
|
|
27
27
|
...options,
|
|
28
28
|
disabled
|
|
29
|
-
//
|
|
29
|
+
// Why last?
|
|
30
30
|
});
|
|
31
31
|
ref = _ref;
|
|
32
32
|
}
|
|
@@ -36,11 +36,10 @@
|
|
|
36
36
|
onDestroy(() => {
|
|
37
37
|
_ref?.dispose();
|
|
38
38
|
});
|
|
39
|
-
$: DEV &&
|
|
40
|
-
$: options
|
|
41
|
-
$:
|
|
42
|
-
$:
|
|
43
|
-
theme &&
|
|
39
|
+
$: DEV && enforceReadonly(_ref, ref, 'Blade', 'ref', true);
|
|
40
|
+
$: options && $parentStore && index !== void 0 && create();
|
|
41
|
+
$: _ref && (_ref.disabled = disabled);
|
|
42
|
+
$: theme &&
|
|
44
43
|
$parentStore &&
|
|
45
44
|
(userCreatedPane || !isRootPane($parentStore)) &&
|
|
46
45
|
console.warn(
|
|
@@ -30,11 +30,10 @@
|
|
|
30
30
|
const tabPageApi = $tabGroupStore?.pages.at(index);
|
|
31
31
|
if (tabPageApi && !tabPageApi.selected) tabPageApi.selected = true;
|
|
32
32
|
}
|
|
33
|
-
$:
|
|
34
|
-
$:
|
|
35
|
-
$:
|
|
36
|
-
$:
|
|
37
|
-
theme &&
|
|
33
|
+
$: setUpListeners($tabGroupStore);
|
|
34
|
+
$: setSelectedIndex(selectedIndex);
|
|
35
|
+
$: $tabGroupStore && ($tabGroupStore.disabled = disabled);
|
|
36
|
+
$: theme &&
|
|
38
37
|
$parentStore &&
|
|
39
38
|
(userCreatedPane || !isRootPane($parentStore)) &&
|
|
40
39
|
console.warn(
|
package/dist/core/TabPage.svelte
CHANGED
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
function create() {
|
|
25
25
|
if (!$tabGroupStore) {
|
|
26
26
|
$tabGroupStore = $parentStore.addTab({
|
|
27
|
-
//
|
|
27
|
+
// Tabs MUST be created with at least one page how to handle tabs with no children?
|
|
28
28
|
disabled: false,
|
|
29
29
|
index: $tabIndexStore,
|
|
30
|
-
//
|
|
30
|
+
// Could be cleaner to have children create the tab as needed?
|
|
31
31
|
pages: [{ title }]
|
|
32
32
|
});
|
|
33
33
|
$tabPageStore = $tabGroupStore.pages[0];
|
|
@@ -20,12 +20,10 @@
|
|
|
20
20
|
function prettify(value, active = true) {
|
|
21
21
|
if (!active) return value;
|
|
22
22
|
return value
|
|
23
|
-
.
|
|
24
|
-
.
|
|
23
|
+
.replaceAll(/([\da-z])([A-Z])/g, '$1 $2')
|
|
24
|
+
.replaceAll(/[_-]+/g, ' ')
|
|
25
25
|
.toLowerCase()
|
|
26
|
-
.
|
|
27
|
-
return letter.toUpperCase();
|
|
28
|
-
});
|
|
26
|
+
.replaceAll(/\b[a-z]/g, (letter) => letter.toUpperCase());
|
|
29
27
|
}
|
|
30
28
|
</script>
|
|
31
29
|
|
|
@@ -7,11 +7,10 @@ declare const __propDef: {
|
|
|
7
7
|
* The binding's target object with values to manipulate.
|
|
8
8
|
* @bindable
|
|
9
9
|
*/
|
|
10
|
-
object: import('@tweakpane/core').Bindable &
|
|
11
|
-
|
|
12
|
-
};
|
|
10
|
+
object: import('@tweakpane/core').Bindable &
|
|
11
|
+
Record<string, string | number | boolean | object>;
|
|
13
12
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
14
|
-
key: string
|
|
13
|
+
key: string;
|
|
15
14
|
/**
|
|
16
15
|
* Prevent interactivity and gray out the control.
|
|
17
16
|
* @default `false`
|
|
@@ -114,6 +113,9 @@ export type AutoValueSlots = typeof __propDef.slots;
|
|
|
114
113
|
* <AutoValue bind:value={point} label="Point" />
|
|
115
114
|
* <AutoValue bind:value={text} label="Text" />
|
|
116
115
|
* ```
|
|
116
|
+
*
|
|
117
|
+
* @sourceLink
|
|
118
|
+
* [AutoValue.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/extra/AutoValue.svelte)
|
|
117
119
|
*/
|
|
118
120
|
export default class AutoValue extends SvelteComponent<
|
|
119
121
|
AutoValueProps,
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Components
|
|
2
2
|
// essentials (1st party plugins)
|
|
3
3
|
export { default as ButtonGrid } from './control/ButtonGrid.svelte';
|
|
4
4
|
export { default as Checkbox } from './control/Checkbox.svelte';
|
|
5
5
|
export { default as Color } from './control/Color.svelte';
|
|
6
6
|
export { default as CubicBezier } from './control/CubicBezier.svelte';
|
|
7
|
-
//
|
|
7
|
+
// Additional plugins (3rd party / community)
|
|
8
8
|
export { default as Image } from './control/Image.svelte';
|
|
9
9
|
export { default as IntervalSlider } from './control/IntervalSlider.svelte';
|
|
10
10
|
export { default as List } from './control/List.svelte';
|
|
11
11
|
export { default as Point } from './control/Point.svelte';
|
|
12
12
|
export { default as RadioGrid } from './control/RadioGrid.svelte';
|
|
13
|
-
//
|
|
13
|
+
// Camerakit (1st party plugins)
|
|
14
14
|
export { default as Ring } from './control/Ring.svelte';
|
|
15
15
|
export { default as RotationEuler } from './control/RotationEuler.svelte';
|
|
16
16
|
export { default as RotationQuaternion } from './control/RotationQuaternion.svelte';
|
|
@@ -18,7 +18,7 @@ export { default as Slider } from './control/Slider.svelte';
|
|
|
18
18
|
export { default as Text } from './control/Text.svelte';
|
|
19
19
|
export { default as Textarea } from './control/Textarea.svelte';
|
|
20
20
|
export { default as Wheel } from './control/Wheel.svelte';
|
|
21
|
-
//
|
|
21
|
+
// Core (tweakpane building blocks)
|
|
22
22
|
export { default as Binding } from './core/Binding.svelte';
|
|
23
23
|
export { default as Blade } from './core/Blade.svelte';
|
|
24
24
|
export { default as Button } from './core/Button.svelte';
|
|
@@ -27,7 +27,7 @@ export { default as Pane } from './core/Pane.svelte';
|
|
|
27
27
|
export { default as Separator } from './core/Separator.svelte';
|
|
28
28
|
export { default as TabGroup } from './core/TabGroup.svelte';
|
|
29
29
|
export { default as TabPage } from './core/TabPage.svelte';
|
|
30
|
-
//
|
|
30
|
+
// Extra (svelte convenience components)
|
|
31
31
|
export { default as AutoObject } from './extra/AutoObject.svelte';
|
|
32
32
|
export { default as AutoValue } from './extra/AutoValue.svelte';
|
|
33
33
|
export { default as Element } from './extra/Element.svelte';
|
|
@@ -14,12 +14,8 @@
|
|
|
14
14
|
}
|
|
15
15
|
function getTotal(add, sub, extra2 = 0) {
|
|
16
16
|
return (
|
|
17
|
-
add.reduce((
|
|
18
|
-
|
|
19
|
-
}, 0) -
|
|
20
|
-
sub.reduce((accumulator, key) => {
|
|
21
|
-
return (accumulator += getPixelValue(getValueOrFallback(theme, key)));
|
|
22
|
-
}, 0) +
|
|
17
|
+
add.reduce((acc, key) => (acc += getPixelValue(getValueOrFallback(theme, key))), 0) -
|
|
18
|
+
sub.reduce((acc, key) => (acc += getPixelValue(getValueOrFallback(theme, key))), 0) +
|
|
23
19
|
extra2
|
|
24
20
|
);
|
|
25
21
|
}
|