svelte-tweakpane-ui 1.0.0 → 1.0.2
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/ButtonGrid.svelte.d.ts +6 -4
- package/dist/control/Checkbox.svelte.d.ts +2 -4
- package/dist/control/Color.svelte.d.ts +2 -4
- package/dist/control/CubicBezier.svelte +13 -21
- package/dist/control/CubicBezier.svelte.d.ts +5 -2
- package/dist/control/Image.svelte.d.ts +7 -9
- package/dist/control/IntervalSlider.svelte.d.ts +2 -4
- package/dist/control/List.svelte +14 -20
- 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 +1 -1
- package/dist/control/Text.svelte.d.ts +2 -4
- package/dist/control/Textarea.svelte +1 -1
- package/dist/control/Textarea.svelte.d.ts +2 -4
- package/dist/control/Wheel.svelte.d.ts +2 -4
- package/dist/core/Blade.svelte +1 -1
- package/dist/core/TabGroup.svelte +3 -5
- package/dist/core/TabPage.svelte +2 -2
- package/dist/extra/AutoObject.svelte +7 -7
- package/dist/extra/AutoValue.svelte.d.ts +6 -4
- package/dist/extra/Element.svelte +2 -4
- package/dist/extra/Element.svelte.d.ts +30 -23
- package/dist/index.js +5 -5
- package/dist/internal/ClsPad.svelte +3 -7
- package/dist/internal/ClsPad.svelte.d.ts +10 -0
- package/dist/internal/GenericBinding.svelte.d.ts +2 -4
- package/dist/internal/GenericBladeFolding.svelte +5 -5
- package/dist/internal/GenericInput.svelte.d.ts +2 -4
- package/dist/internal/GenericInputFolding.svelte +5 -5
- 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 +4 -7
- 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 +72 -64
- package/dist/internal/InternalPaneFixed.svelte +1 -3
- package/dist/internal/InternalPaneInline.svelte +3 -3
- package/dist/monitor/FpsGraph.svelte +6 -3
- package/dist/monitor/FpsGraph.svelte.d.ts +2 -2
- package/dist/monitor/Monitor.svelte.d.ts +24 -32
- package/dist/monitor/Profiler.svelte +10 -7
- package/dist/monitor/Profiler.svelte.d.ts +8 -5
- package/dist/monitor/WaveformMonitor.svelte.d.ts +2 -4
- package/dist/theme.d.ts +1 -3
- package/dist/theme.js +30 -39
- package/dist/utils.d.ts +10 -7
- package/dist/utils.js +53 -46
- package/package.json +26 -43
- package/{README.md → readme.md} +10 -3
- /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: ev.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} />
|
|
@@ -128,7 +128,9 @@ export type ButtonGridSlots = typeof __propDef.slots;
|
|
|
128
128
|
* } from 'svelte-tweakpane-ui';
|
|
129
129
|
*
|
|
130
130
|
* const keyboard = [
|
|
131
|
-
* ...Array.from({ length: 26 }, (_,
|
|
131
|
+
* ...Array.from({ length: 26 }, (_, index) =>
|
|
132
|
+
* String.fromCodePoint(65 + index)
|
|
133
|
+
* ),
|
|
132
134
|
* ',',
|
|
133
135
|
* '.',
|
|
134
136
|
* '!',
|
|
@@ -137,11 +139,11 @@ export type ButtonGridSlots = typeof __propDef.slots;
|
|
|
137
139
|
*
|
|
138
140
|
* let textBuffer = '';
|
|
139
141
|
*
|
|
140
|
-
* function handleClick(
|
|
142
|
+
* function handleClick(event: ButtonGridClickEvent) {
|
|
141
143
|
* textBuffer =
|
|
142
|
-
*
|
|
144
|
+
* event.detail.label === '⌫'
|
|
143
145
|
* ? textBuffer.slice(0, -1)
|
|
144
|
-
* : textBuffer +
|
|
146
|
+
* : textBuffer + event.detail.label;
|
|
145
147
|
* }
|
|
146
148
|
* </script>
|
|
147
149
|
*
|
|
@@ -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`
|
|
@@ -14,31 +14,23 @@
|
|
|
14
14
|
let cubicBezierBlade;
|
|
15
15
|
const buttonClass = 'tp-cbzv_b';
|
|
16
16
|
function getValue() {
|
|
17
|
-
|
|
18
|
-
return value;
|
|
19
|
-
} else {
|
|
20
|
-
return [value.x1, value.y1, value.x2, value.y2];
|
|
21
|
-
}
|
|
17
|
+
return Array.isArray(value) ? value : [value.x1, value.y1, value.x2, value.y2];
|
|
22
18
|
}
|
|
23
19
|
function setValue() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
cubicBezierBlade.value = new CubicBezier(value.x1, value.y1, value.x2, value.y2);
|
|
28
|
-
}
|
|
20
|
+
cubicBezierBlade.value = Array.isArray(value)
|
|
21
|
+
? new CubicBezier(value[0], value[1], value[2], value[3])
|
|
22
|
+
: new CubicBezier(value.x1, value.y1, value.x2, value.y2);
|
|
29
23
|
}
|
|
30
24
|
function addEvent() {
|
|
31
|
-
cubicBezierBlade.on('change', (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
}
|
|
25
|
+
cubicBezierBlade.on('change', (event) => {
|
|
26
|
+
value = Array.isArray(value)
|
|
27
|
+
? [event.value.x1, event.value.y1, event.value.x2, event.value.y2]
|
|
28
|
+
: {
|
|
29
|
+
x1: event.value.x1,
|
|
30
|
+
y1: event.value.y1,
|
|
31
|
+
x2: event.value.x2,
|
|
32
|
+
y2: event.value.y2
|
|
33
|
+
};
|
|
42
34
|
});
|
|
43
35
|
}
|
|
44
36
|
$: options = {
|
|
@@ -118,6 +118,9 @@ export type CubicBezierSlots = typeof __propDef.slots;
|
|
|
118
118
|
* Usage outside of a `<Pane>` component will implicitly wrap the cubic bezier control in `<Pane
|
|
119
119
|
* position='inline'>`.
|
|
120
120
|
*
|
|
121
|
+
* Complete functionality of the `scale` prop is [pending a pull
|
|
122
|
+
* request](https://github.com/tweakpane/plugin-essentials/pull/19).
|
|
123
|
+
*
|
|
121
124
|
* _Note: A memory leak has been observed in situations when the `value` prop is written frequently
|
|
122
125
|
* from outside the component. See [issue
|
|
123
126
|
* #18](https://github.com/tweakpane/plugin-essentials/issues/18) on the Plugin Essentials repo for
|
|
@@ -136,7 +139,7 @@ export type CubicBezierSlots = typeof __propDef.slots;
|
|
|
136
139
|
* import { tweened } from 'svelte/motion';
|
|
137
140
|
*
|
|
138
141
|
* // could also be a tuple
|
|
139
|
-
* let value: CubicBezierValue = { x1: 0.25, y1: 0.1, x2: 0.25, y2: 1
|
|
142
|
+
* let value: CubicBezierValue = { x1: 0.25, y1: 0.1, x2: 0.25, y2: 1 };
|
|
140
143
|
* let duration = 1000;
|
|
141
144
|
* let moods = ['Set', 'Rise'];
|
|
142
145
|
* let mood: string = moods[0];
|
|
@@ -160,7 +163,7 @@ export type CubicBezierSlots = typeof __propDef.slots;
|
|
|
160
163
|
* <Slider
|
|
161
164
|
* bind:value={duration}
|
|
162
165
|
* min={0}
|
|
163
|
-
* max={
|
|
166
|
+
* max={10_000}
|
|
164
167
|
* format={(v) => `${(v / 1000).toFixed(1)}`}
|
|
165
168
|
* label="Duration (Seconds)"
|
|
166
169
|
* />
|
|
@@ -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`
|
|
@@ -125,14 +123,14 @@ export type ImageSlots = typeof __propDef.slots;
|
|
|
125
123
|
* <script lang="ts">
|
|
126
124
|
* import { Button, Image } from 'svelte-tweakpane-ui';
|
|
127
125
|
*
|
|
128
|
-
* let
|
|
126
|
+
* let source = 'placeholder';
|
|
129
127
|
* let kittenIndex = 1;
|
|
130
128
|
* </script>
|
|
131
129
|
*
|
|
132
|
-
* <Image bind:value={
|
|
130
|
+
* <Image bind:value={source} fit="contain" label="Image" />
|
|
133
131
|
* <Button
|
|
134
132
|
* on:click={() => {
|
|
135
|
-
*
|
|
133
|
+
* source = `https://placekitten.com/1024/1024?image=${kittenIndex}`;
|
|
136
134
|
* kittenIndex = (kittenIndex % 16) + 1;
|
|
137
135
|
* }}
|
|
138
136
|
* label="Random Placeholder"
|
|
@@ -140,10 +138,10 @@ export type ImageSlots = typeof __propDef.slots;
|
|
|
140
138
|
* />
|
|
141
139
|
*
|
|
142
140
|
* <div class="demo">
|
|
143
|
-
* {#if
|
|
141
|
+
* {#if source === 'placeholder'}
|
|
144
142
|
* <p>Tap “No Image” above to load an image from disk.</p>
|
|
145
143
|
* {:else}
|
|
146
|
-
* <img alt="" {
|
|
144
|
+
* <img alt="" src={source} />
|
|
147
145
|
* {/if}
|
|
148
146
|
* </div>
|
|
149
147
|
*
|
|
@@ -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
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
let listBlade;
|
|
11
11
|
let bladeOptions;
|
|
12
12
|
function addEvent() {
|
|
13
|
-
listBlade.on('change', (
|
|
14
|
-
value =
|
|
13
|
+
listBlade.on('change', (event) => {
|
|
14
|
+
value = event.value;
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
function getInitialValue() {
|
|
@@ -20,35 +20,29 @@
|
|
|
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
|
-
function isArrayStyleListOptions(
|
|
29
|
+
function isArrayStyleListOptions(object) {
|
|
32
30
|
return (
|
|
33
|
-
Array.isArray(
|
|
34
|
-
|
|
31
|
+
Array.isArray(object) &&
|
|
32
|
+
object.every(
|
|
35
33
|
(item) => typeof item === 'object' && item !== null && 'text' in item && 'value' in item
|
|
36
34
|
)
|
|
37
35
|
);
|
|
38
36
|
}
|
|
39
|
-
function isObjectStyleListOptions(
|
|
40
|
-
return typeof
|
|
37
|
+
function isObjectStyleListOptions(object) {
|
|
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`
|
package/dist/control/Text.svelte
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
function updateListeners(live2, destroy = false) {
|
|
16
|
-
let input = ref?.controller.valueController.view.element.
|
|
16
|
+
let input = ref?.controller.valueController.view.element.querySelector('input');
|
|
17
17
|
if (input) {
|
|
18
18
|
input.removeEventListener('input', onInput);
|
|
19
19
|
!destroy && live2 && input.addEventListener('input', onInput);
|
|
@@ -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`
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
value = event.target.value;
|
|
23
23
|
}
|
|
24
24
|
function updateListeners(live2, destroy = false) {
|
|
25
|
-
|
|
25
|
+
const input = ref?.controller.valueController.view.element.querySelector('textarea');
|
|
26
26
|
if (input) {
|
|
27
27
|
input.removeEventListener('blur', onBlur);
|
|
28
28
|
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`
|
package/dist/core/Blade.svelte
CHANGED
|
@@ -22,15 +22,13 @@
|
|
|
22
22
|
$tabGroupStore?.dispose();
|
|
23
23
|
});
|
|
24
24
|
function setUpListeners(t) {
|
|
25
|
-
t?.on('select', (
|
|
26
|
-
selectedIndex =
|
|
25
|
+
t?.on('select', (event) => {
|
|
26
|
+
selectedIndex = event.index;
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
function setSelectedIndex(index) {
|
|
30
30
|
const tabPageApi = $tabGroupStore?.pages.at(index);
|
|
31
|
-
if (tabPageApi)
|
|
32
|
-
if (!tabPageApi.selected) tabPageApi.selected = true;
|
|
33
|
-
}
|
|
31
|
+
if (tabPageApi && !tabPageApi.selected) tabPageApi.selected = true;
|
|
34
32
|
}
|
|
35
33
|
$: BROWSER && setUpListeners($tabGroupStore);
|
|
36
34
|
$: BROWSER && setSelectedIndex(selectedIndex);
|
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];
|