svelte-tweakpane-ui 1.1.4 → 1.2.1
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/Button.svelte.d.ts +3 -2
- package/dist/control/ButtonGrid.svelte.d.ts +20 -9
- package/dist/control/Checkbox.svelte +3 -1
- package/dist/control/Checkbox.svelte.d.ts +28 -7
- package/dist/control/Color.svelte +1 -0
- package/dist/control/Color.svelte.d.ts +28 -7
- package/dist/control/CubicBezier.svelte +36 -11
- package/dist/control/CubicBezier.svelte.d.ts +40 -13
- package/dist/control/Image.svelte +1 -1
- package/dist/control/Image.svelte.d.ts +32 -7
- package/dist/control/IntervalSlider.svelte +1 -1
- package/dist/control/IntervalSlider.svelte.d.ts +29 -8
- package/dist/control/List.svelte +19 -2
- package/dist/control/List.svelte.d.ts +34 -9
- package/dist/control/Point.svelte +1 -0
- package/dist/control/Point.svelte.d.ts +39 -10
- package/dist/control/RadioGrid.svelte +4 -2
- package/dist/control/RadioGrid.svelte.d.ts +38 -13
- package/dist/control/Ring.svelte +1 -1
- package/dist/control/Ring.svelte.d.ts +36 -10
- package/dist/control/RotationEuler.svelte +1 -0
- package/dist/control/RotationEuler.svelte.d.ts +43 -74
- package/dist/control/RotationQuaternion.svelte +1 -0
- package/dist/control/RotationQuaternion.svelte.d.ts +28 -12
- package/dist/control/Slider.svelte +3 -1
- package/dist/control/Slider.svelte.d.ts +32 -11
- package/dist/control/Text.svelte +7 -9
- package/dist/control/Text.svelte.d.ts +28 -7
- package/dist/control/Textarea.svelte +21 -7
- package/dist/control/Textarea.svelte.d.ts +38 -20
- package/dist/control/Wheel.svelte +3 -1
- package/dist/control/Wheel.svelte.d.ts +30 -9
- package/dist/core/Binding.svelte +39 -7
- package/dist/core/Binding.svelte.d.ts +28 -7
- package/dist/core/Blade.svelte.d.ts +17 -7
- package/dist/core/Pane.svelte +9 -3
- package/dist/core/Pane.svelte.d.ts +98 -71
- package/dist/core/Separator.svelte.d.ts +12 -6
- package/dist/extra/AutoObject.svelte +28 -5
- package/dist/extra/AutoObject.svelte.d.ts +17 -3
- package/dist/extra/AutoValue.svelte +4 -2
- package/dist/extra/AutoValue.svelte.d.ts +29 -9
- package/dist/extra/Element.svelte.d.ts +13 -7
- package/dist/index.d.ts +29 -12
- package/dist/internal/GenericBinding.svelte +1 -1
- package/dist/internal/GenericBinding.svelte.d.ts +14 -6
- package/dist/internal/GenericBladeFolding.svelte.d.ts +12 -6
- package/dist/internal/GenericInput.svelte +1 -1
- package/dist/internal/GenericInput.svelte.d.ts +14 -6
- package/dist/internal/GenericInputFolding.svelte +1 -1
- package/dist/internal/GenericInputFolding.svelte.d.ts +14 -6
- package/dist/internal/GenericMonitor.svelte.d.ts +11 -5
- package/dist/internal/GenericPane.svelte +21 -21
- package/dist/internal/GenericPane.svelte.d.ts +12 -2
- package/dist/internal/GenericSlider.svelte +1 -1
- package/dist/internal/GenericSlider.svelte.d.ts +15 -7
- package/dist/internal/InternalMonitorBoolean.svelte.d.ts +11 -5
- package/dist/internal/InternalMonitorNumber.svelte.d.ts +18 -7
- package/dist/internal/InternalMonitorString.svelte.d.ts +11 -5
- package/dist/internal/InternalPaneDraggable.svelte +18 -12
- package/dist/internal/InternalPaneDraggable.svelte.d.ts +13 -4
- package/dist/internal/InternalPaneFixed.svelte +3 -3
- package/dist/internal/InternalPaneFixed.svelte.d.ts +13 -4
- package/dist/internal/InternalPaneInline.svelte +6 -6
- package/dist/internal/InternalPaneInline.svelte.d.ts +72 -66
- package/dist/monitor/FpsGraph.svelte.d.ts +12 -6
- package/dist/monitor/Monitor.svelte.d.ts +45 -21
- package/dist/monitor/Profiler.svelte.d.ts +22 -9
- package/dist/monitor/WaveformMonitor.svelte.d.ts +11 -5
- package/dist/utils.d.ts +15 -0
- package/license.txt +1 -1
- package/package.json +22 -17
- package/readme.md +31 -4
|
@@ -18,8 +18,9 @@ declare const __propDef: {
|
|
|
18
18
|
/**
|
|
19
19
|
* Custom color scheme.
|
|
20
20
|
* @default `undefined` \
|
|
21
|
-
* Inherits default Tweakpane theme equivalent to
|
|
22
|
-
* set with
|
|
21
|
+
* Inherits default Tweakpane theme equivalent to
|
|
22
|
+
* `ThemeUtils.presets.standard`, or the theme set with
|
|
23
|
+
* `setGlobalDefaultTheme()`.)
|
|
23
24
|
* */ theme?: Theme | undefined;
|
|
24
25
|
};
|
|
25
26
|
slots: {};
|
|
@@ -34,18 +34,24 @@ declare const __propDef: {
|
|
|
34
34
|
* Reference to internal Tweakpane
|
|
35
35
|
* [`BladeApi`](https://tweakpane.github.io/docs/api/classes/BladeApi.html) for this blade.
|
|
36
36
|
*
|
|
37
|
-
* This is
|
|
38
|
-
* functionality.
|
|
37
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
38
|
+
* components wrapping `<Blade>`'s functionality.
|
|
39
|
+
*
|
|
40
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
41
|
+
*
|
|
39
42
|
* @bindable
|
|
40
43
|
* @readonly
|
|
41
44
|
*/
|
|
42
45
|
ref?: ButtonGridRef | undefined;
|
|
43
46
|
/**
|
|
44
|
-
* Imported Tweakpane `TpPluginBundle` (
|
|
45
|
-
* the
|
|
47
|
+
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
48
|
+
* the `<Blade>`'s containing `<Pane>`.
|
|
49
|
+
*
|
|
50
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
51
|
+
* components wrapping `<Blade>`'s functionality in combination with a Tweakpane plugin.
|
|
52
|
+
*
|
|
53
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
46
54
|
*
|
|
47
|
-
* This is primarily for internal use, when implementing convenience components wrapping Blade's
|
|
48
|
-
* functionality in combination with a Tweakpane plugin.
|
|
49
55
|
* @default `undefined`
|
|
50
56
|
*/
|
|
51
57
|
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
@@ -128,8 +134,11 @@ export type ButtonGridSlots = typeof __propDef.slots;
|
|
|
128
134
|
* } from 'svelte-tweakpane-ui';
|
|
129
135
|
*
|
|
130
136
|
* const keyboard = [
|
|
131
|
-
* ...Array.from(
|
|
132
|
-
*
|
|
137
|
+
* ...Array.from(
|
|
138
|
+
* {
|
|
139
|
+
* length: 26
|
|
140
|
+
* },
|
|
141
|
+
* (_, index) => String.fromCodePoint(65 + index)
|
|
133
142
|
* ),
|
|
134
143
|
* ',',
|
|
135
144
|
* '.',
|
|
@@ -153,7 +162,9 @@ export type ButtonGridSlots = typeof __propDef.slots;
|
|
|
153
162
|
* </Pane>
|
|
154
163
|
*
|
|
155
164
|
* <div class="demo">
|
|
156
|
-
* <p>
|
|
165
|
+
* <p>
|
|
166
|
+
* {textBuffer}
|
|
167
|
+
* </p>
|
|
157
168
|
* </div>
|
|
158
169
|
*
|
|
159
170
|
* <style>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
3
|
+
export type CheckboxChangeEvent = ValueChangeEvent<boolean>;
|
|
2
4
|
declare const __propDef: {
|
|
3
5
|
props: Omit<
|
|
4
6
|
Omit<
|
|
@@ -46,18 +48,24 @@ declare const __propDef: {
|
|
|
46
48
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
47
49
|
* this control.
|
|
48
50
|
*
|
|
49
|
-
* This is
|
|
50
|
-
* Binding's functionality.
|
|
51
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
52
|
+
* components wrapping `<Binding>`'s functionality.
|
|
53
|
+
*
|
|
54
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
55
|
+
*
|
|
51
56
|
* @bindable
|
|
52
57
|
* @readonly
|
|
53
58
|
*/
|
|
54
59
|
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined;
|
|
55
60
|
/**
|
|
56
61
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
57
|
-
* the
|
|
62
|
+
* the `<Binding>`'s containing `<Pane>`.
|
|
63
|
+
*
|
|
64
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
65
|
+
* components wrapping `<Binding>`'s functionality in combination with a Tweakpane plugin.
|
|
66
|
+
*
|
|
67
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
58
68
|
*
|
|
59
|
-
* This is primarily for internal use, when implementing convenience components wrapping
|
|
60
|
-
* Binding's functionality in combination with a Tweakpane plugin.
|
|
61
69
|
* @default `undefined`
|
|
62
70
|
*/
|
|
63
71
|
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
@@ -72,10 +80,21 @@ declare const __propDef: {
|
|
|
72
80
|
},
|
|
73
81
|
'ref' | 'options' | 'plugin'
|
|
74
82
|
>;
|
|
83
|
+
slots: {};
|
|
75
84
|
events: {
|
|
76
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Fires when `value` changes.
|
|
87
|
+
*
|
|
88
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
89
|
+
*
|
|
90
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
91
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
92
|
+
*
|
|
93
|
+
* @extends ValueChangeEvent
|
|
94
|
+
* @event
|
|
95
|
+
* */
|
|
96
|
+
change: CheckboxChangeEvent;
|
|
77
97
|
};
|
|
78
|
-
slots: {};
|
|
79
98
|
};
|
|
80
99
|
export type CheckboxProps = typeof __propDef.props;
|
|
81
100
|
export type CheckboxEvents = typeof __propDef.events;
|
|
@@ -85,6 +104,8 @@ export type CheckboxSlots = typeof __propDef.slots;
|
|
|
85
104
|
*
|
|
86
105
|
* Wraps Tweakpane's [boolean input binding](https://tweakpane.github.io/docs/input-bindings/#boolean).
|
|
87
106
|
*
|
|
107
|
+
* @emits {CheckboxChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
108
|
+
*
|
|
88
109
|
* Usage outside of a `<Pane>` component will implicitly wrap the checkbox in `<Pane
|
|
89
110
|
* position='inline'>`.
|
|
90
111
|
*
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
RgbaColorObject
|
|
5
5
|
} from '@tweakpane/core/dist/input-binding/color/model/color.js';
|
|
6
6
|
import type { Simplify } from '../utils';
|
|
7
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
7
8
|
export type ColorValueRgbTuple = [r: number, g: number, b: number];
|
|
8
9
|
export type ColorValueRgbaTuple = [r: number, g: number, b: number, a: number];
|
|
9
10
|
export type ColorValueRgbObject = Simplify<RgbColorObject>;
|
|
@@ -16,6 +17,7 @@ export type ColorValue = Simplify<
|
|
|
16
17
|
| ColorValueRgbaTuple
|
|
17
18
|
| ColorValueString
|
|
18
19
|
>;
|
|
20
|
+
export type ColorChangeEvent = ValueChangeEvent<ColorValue>;
|
|
19
21
|
import type { ColorInputParams as ColorOptions } from 'tweakpane';
|
|
20
22
|
declare const __propDef: {
|
|
21
23
|
props: Omit<
|
|
@@ -64,18 +66,24 @@ declare const __propDef: {
|
|
|
64
66
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
65
67
|
* this control.
|
|
66
68
|
*
|
|
67
|
-
* This is
|
|
68
|
-
* Binding's functionality.
|
|
69
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
70
|
+
* components wrapping `<Binding>`'s functionality.
|
|
71
|
+
*
|
|
72
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
73
|
+
*
|
|
69
74
|
* @bindable
|
|
70
75
|
* @readonly
|
|
71
76
|
*/
|
|
72
77
|
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined;
|
|
73
78
|
/**
|
|
74
79
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
75
|
-
* the
|
|
80
|
+
* the `<Binding>`'s containing `<Pane>`.
|
|
81
|
+
*
|
|
82
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
83
|
+
* components wrapping `<Binding>`'s functionality in combination with a Tweakpane plugin.
|
|
84
|
+
*
|
|
85
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
76
86
|
*
|
|
77
|
-
* This is primarily for internal use, when implementing convenience components wrapping
|
|
78
|
-
* Binding's functionality in combination with a Tweakpane plugin.
|
|
79
87
|
* @default `undefined`
|
|
80
88
|
*/
|
|
81
89
|
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
@@ -129,10 +137,21 @@ declare const __propDef: {
|
|
|
129
137
|
* */
|
|
130
138
|
type?: 'float' | 'int' | undefined;
|
|
131
139
|
};
|
|
140
|
+
slots: {};
|
|
132
141
|
events: {
|
|
133
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Fires when `value` changes.
|
|
144
|
+
*
|
|
145
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
146
|
+
*
|
|
147
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
148
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
149
|
+
*
|
|
150
|
+
* @extends ValueChangeEvent
|
|
151
|
+
* @event
|
|
152
|
+
* */
|
|
153
|
+
change: ColorChangeEvent;
|
|
134
154
|
};
|
|
135
|
-
slots: {};
|
|
136
155
|
};
|
|
137
156
|
export type ColorProps = typeof __propDef.props;
|
|
138
157
|
export type ColorEvents = typeof __propDef.events;
|
|
@@ -142,6 +161,8 @@ export type ColorSlots = typeof __propDef.slots;
|
|
|
142
161
|
*
|
|
143
162
|
* Wraps Tweakpane's [color input binding](https://tweakpane.github.io/docs/input-bindings/#color).
|
|
144
163
|
*
|
|
164
|
+
* @emits {ColorChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
165
|
+
*
|
|
145
166
|
* Usage outside of a `<Pane>` component will implicitly wrap the color picker in `<Pane
|
|
146
167
|
* position='inline'>`.
|
|
147
168
|
*
|
|
@@ -7,9 +7,13 @@
|
|
|
7
7
|
import GenericBladeFolding from '../internal/GenericBladeFolding.svelte';
|
|
8
8
|
import { fillWith } from '../utils';
|
|
9
9
|
import { BROWSER } from 'esm-env';
|
|
10
|
+
import copy from 'fast-copy';
|
|
11
|
+
import { shallowEqual } from 'fast-equals';
|
|
12
|
+
import { createEventDispatcher } from 'svelte';
|
|
10
13
|
export let value;
|
|
11
14
|
export let label = void 0;
|
|
12
15
|
export let expanded = void 0;
|
|
16
|
+
const dispatch = createEventDispatcher();
|
|
13
17
|
let options;
|
|
14
18
|
let cubicBezierBlade;
|
|
15
19
|
const buttonClass = 'tp-cbzv_b';
|
|
@@ -17,20 +21,41 @@
|
|
|
17
21
|
return Array.isArray(value) ? value : [value.x1, value.y1, value.x2, value.y2];
|
|
18
22
|
}
|
|
19
23
|
function setValue() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
if (
|
|
25
|
+
!shallowEqual(getValue(), [
|
|
26
|
+
cubicBezierBlade.value.x1,
|
|
27
|
+
cubicBezierBlade.value.y1,
|
|
28
|
+
cubicBezierBlade.value.x2,
|
|
29
|
+
cubicBezierBlade.value.y2
|
|
30
|
+
])
|
|
31
|
+
) {
|
|
32
|
+
cubicBezierBlade.value = Array.isArray(value)
|
|
33
|
+
? new CubicBezier(value[0], value[1], value[2], value[3])
|
|
34
|
+
: new CubicBezier(value.x1, value.y1, value.x2, value.y2);
|
|
35
|
+
dispatch('change', {
|
|
36
|
+
value: copy(value),
|
|
37
|
+
origin: 'external'
|
|
38
|
+
});
|
|
39
|
+
}
|
|
23
40
|
}
|
|
24
41
|
function addEvent() {
|
|
25
42
|
cubicBezierBlade.on('change', (event) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
if (
|
|
44
|
+
!shallowEqual(getValue(), [event.value.x1, event.value.y1, event.value.x2, event.value.y2])
|
|
45
|
+
) {
|
|
46
|
+
value = Array.isArray(value)
|
|
47
|
+
? [event.value.x1, event.value.y1, event.value.x2, event.value.y2]
|
|
48
|
+
: {
|
|
49
|
+
x1: event.value.x1,
|
|
50
|
+
y1: event.value.y1,
|
|
51
|
+
x2: event.value.x2,
|
|
52
|
+
y2: event.value.y2
|
|
53
|
+
};
|
|
54
|
+
dispatch('change', {
|
|
55
|
+
value: copy(value),
|
|
56
|
+
origin: 'internal'
|
|
57
|
+
});
|
|
58
|
+
}
|
|
34
59
|
});
|
|
35
60
|
}
|
|
36
61
|
$: options = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
2
|
import type { Simplify } from '../utils';
|
|
3
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
3
4
|
export type CubicBezierValueObject = {
|
|
4
5
|
x1: number;
|
|
5
6
|
y1: number;
|
|
@@ -8,6 +9,7 @@ export type CubicBezierValueObject = {
|
|
|
8
9
|
};
|
|
9
10
|
export type CubicBezierValueTuple = [x1: number, y1: number, x2: number, y2: number];
|
|
10
11
|
export type CubicBezierValue = Simplify<CubicBezierValueObject | CubicBezierValueTuple>;
|
|
12
|
+
export type CubicBezierChangeEvent = ValueChangeEvent<CubicBezierValue>;
|
|
11
13
|
import type { CubicBezierApi as CubicBezierRef } from '@tweakpane/plugin-essentials';
|
|
12
14
|
import type { CubicBezierBladeParams as CubicBezierOptions } from '@tweakpane/plugin-essentials/dist/types/cubic-bezier/plugin.d.ts';
|
|
13
15
|
declare const __propDef: {
|
|
@@ -35,18 +37,24 @@ declare const __propDef: {
|
|
|
35
37
|
* Reference to internal Tweakpane
|
|
36
38
|
* [`BladeApi`](https://tweakpane.github.io/docs/api/classes/BladeApi.html) for this blade.
|
|
37
39
|
*
|
|
38
|
-
* This is
|
|
39
|
-
* functionality.
|
|
40
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
41
|
+
* components wrapping `<Blade>`'s functionality.
|
|
42
|
+
*
|
|
43
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
44
|
+
*
|
|
40
45
|
* @bindable
|
|
41
46
|
* @readonly
|
|
42
47
|
*/
|
|
43
48
|
ref?: CubicBezierRef | undefined;
|
|
44
49
|
/**
|
|
45
|
-
* Imported Tweakpane `TpPluginBundle` (
|
|
46
|
-
* the
|
|
50
|
+
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
51
|
+
* the `<Blade>`'s containing `<Pane>`.
|
|
52
|
+
*
|
|
53
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
54
|
+
* components wrapping `<Blade>`'s functionality in combination with a Tweakpane plugin.
|
|
55
|
+
*
|
|
56
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
47
57
|
*
|
|
48
|
-
* This is primarily for internal use, when implementing convenience components wrapping Blade's
|
|
49
|
-
* functionality in combination with a Tweakpane plugin.
|
|
50
58
|
* @default `undefined`
|
|
51
59
|
*/
|
|
52
60
|
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
@@ -91,10 +99,21 @@ declare const __propDef: {
|
|
|
91
99
|
* */
|
|
92
100
|
label?: string | undefined;
|
|
93
101
|
};
|
|
102
|
+
slots: {};
|
|
94
103
|
events: {
|
|
95
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Fires when `value` changes.
|
|
106
|
+
*
|
|
107
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
108
|
+
*
|
|
109
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
110
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
111
|
+
*
|
|
112
|
+
* @extends ValueChangeEvent
|
|
113
|
+
* @event
|
|
114
|
+
* */
|
|
115
|
+
change: CubicBezierChangeEvent;
|
|
96
116
|
};
|
|
97
|
-
slots: {};
|
|
98
117
|
};
|
|
99
118
|
export type CubicBezierProps = typeof __propDef.props;
|
|
100
119
|
export type CubicBezierEvents = typeof __propDef.events;
|
|
@@ -115,13 +134,16 @@ export type CubicBezierSlots = typeof __propDef.slots;
|
|
|
115
134
|
* [transition](https://svelte.dev/docs/svelte-transition), and
|
|
116
135
|
* [animate](https://svelte.dev/docs/svelte-animate) modules.
|
|
117
136
|
*
|
|
137
|
+
* @emits {CubicBezierChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
138
|
+
*
|
|
118
139
|
* Usage outside of a `<Pane>` component will implicitly wrap the cubic bezier control in `<Pane
|
|
119
140
|
* position='inline'>`.
|
|
120
141
|
*
|
|
121
|
-
* _Note:
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
142
|
+
* _Note: An issue with unreleased resources has been observed in situations when the `value` prop is
|
|
143
|
+
* set frequently. A [PR on the Plugin Essentials repo with a
|
|
144
|
+
* fix](https://github.com/tweakpane/plugin-essentials/pull/21) is currently pending a review and
|
|
145
|
+
* merge. Consider monitoring the performance of this component in the context of your use case until
|
|
146
|
+
* this issue is resolved._
|
|
125
147
|
*
|
|
126
148
|
* @example
|
|
127
149
|
* ```svelte
|
|
@@ -136,7 +158,12 @@ export type CubicBezierSlots = typeof __propDef.slots;
|
|
|
136
158
|
* import { tweened } from 'svelte/motion';
|
|
137
159
|
*
|
|
138
160
|
* // could also be a tuple
|
|
139
|
-
* let value: CubicBezierValue = {
|
|
161
|
+
* let value: CubicBezierValue = {
|
|
162
|
+
* x1: 0.25,
|
|
163
|
+
* y1: 0.1,
|
|
164
|
+
* x2: 0.25,
|
|
165
|
+
* y2: 1
|
|
166
|
+
* };
|
|
140
167
|
* let duration = 1000;
|
|
141
168
|
* let moods = ['Set', 'Rise'];
|
|
142
169
|
* let mood: string = moods[0];
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
};
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
|
-
<GenericInput bind:value {options} plugin={pluginModule} {...$$restProps} />
|
|
20
|
+
<GenericInput bind:value on:change {options} plugin={pluginModule} {...$$restProps} />
|
|
21
21
|
{#if !BROWSER}
|
|
22
22
|
<ClsPad keysAdd={fillWith('containerVerticalPadding', 2)} theme={$$props.theme} />
|
|
23
23
|
{/if}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
2
3
|
export type ImageValue = 'placeholder' | File | HTMLImageElement | string | undefined;
|
|
4
|
+
export type ImageChangeEvent = ValueChangeEvent<ImageValue>;
|
|
3
5
|
declare const __propDef: {
|
|
4
6
|
props: Omit<
|
|
5
7
|
Omit<
|
|
@@ -47,18 +49,24 @@ declare const __propDef: {
|
|
|
47
49
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
48
50
|
* this control.
|
|
49
51
|
*
|
|
50
|
-
* This is
|
|
51
|
-
* Binding's functionality.
|
|
52
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
53
|
+
* components wrapping `<Binding>`'s functionality.
|
|
54
|
+
*
|
|
55
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
56
|
+
*
|
|
52
57
|
* @bindable
|
|
53
58
|
* @readonly
|
|
54
59
|
*/
|
|
55
60
|
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined;
|
|
56
61
|
/**
|
|
57
62
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
58
|
-
* the
|
|
63
|
+
* the `<Binding>`'s containing `<Pane>`.
|
|
64
|
+
*
|
|
65
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
66
|
+
* components wrapping `<Binding>`'s functionality in combination with a Tweakpane plugin.
|
|
67
|
+
*
|
|
68
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
59
69
|
*
|
|
60
|
-
* This is primarily for internal use, when implementing convenience components wrapping
|
|
61
|
-
* Binding's functionality in combination with a Tweakpane plugin.
|
|
62
70
|
* @default `undefined`
|
|
63
71
|
*/
|
|
64
72
|
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
@@ -93,10 +101,21 @@ declare const __propDef: {
|
|
|
93
101
|
*/
|
|
94
102
|
fit?: 'contain' | 'cover' | undefined;
|
|
95
103
|
};
|
|
104
|
+
slots: {};
|
|
96
105
|
events: {
|
|
97
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Fires when `value` changes.
|
|
108
|
+
*
|
|
109
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
110
|
+
*
|
|
111
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
112
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
113
|
+
*
|
|
114
|
+
* @extends ValueChangeEvent
|
|
115
|
+
* @event
|
|
116
|
+
* */
|
|
117
|
+
change: ImageChangeEvent;
|
|
98
118
|
};
|
|
99
|
-
slots: {};
|
|
100
119
|
};
|
|
101
120
|
export type ImageProps = typeof __propDef.props;
|
|
102
121
|
export type ImageEvents = typeof __propDef.events;
|
|
@@ -104,6 +123,8 @@ export type ImageSlots = typeof __propDef.slots;
|
|
|
104
123
|
/**
|
|
105
124
|
* An image input control.
|
|
106
125
|
*
|
|
126
|
+
* _Important: This component has some rough edges, and should be considered experimental._
|
|
127
|
+
*
|
|
107
128
|
* Integrates the [tweakpane-image-plugin](https://github.com/metehus/tweakpane-image-plugin),
|
|
108
129
|
* incorporating work by [Florian Morel](http://ayamflow.fr), [Matheus
|
|
109
130
|
* Dias](https://www.linkedin.com/in/matheusdbs/), [Palash Bansal](https://github.com/repalash), and
|
|
@@ -115,6 +136,10 @@ export type ImageSlots = typeof __propDef.slots;
|
|
|
115
136
|
* [pull request](https://github.com/metehus/tweakpane-image-plugin/pull/1) with Tweakpane 4 support is
|
|
116
137
|
* merged.
|
|
117
138
|
*
|
|
139
|
+
* @emits {ImageChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
140
|
+
*
|
|
141
|
+
* There is currently a known bug where change events' `origin` values are sometimes incorrect. (This issue is limited to this component.)
|
|
142
|
+
*
|
|
118
143
|
* Usage outside of a `<Pane>` component will implicitly wrap the image control in `<Pane
|
|
119
144
|
* position='inline'>`.
|
|
120
145
|
*
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
2
|
import type { Simplify } from '../utils';
|
|
3
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
3
4
|
export type IntervalSliderValueTuple = [min: number, max: number];
|
|
4
5
|
export type IntervalSliderValueObject = {
|
|
5
6
|
min: number;
|
|
6
7
|
max: number;
|
|
7
8
|
};
|
|
8
9
|
export type IntervalSliderValue = Simplify<IntervalSliderValueObject | IntervalSliderValueTuple>;
|
|
10
|
+
export type IntervalSliderChangeEvent = ValueChangeEvent<IntervalSliderValue>;
|
|
9
11
|
declare const __propDef: {
|
|
10
12
|
props: Omit<
|
|
11
13
|
Omit<
|
|
@@ -53,18 +55,24 @@ declare const __propDef: {
|
|
|
53
55
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
54
56
|
* this control.
|
|
55
57
|
*
|
|
56
|
-
* This is
|
|
57
|
-
* Binding's functionality.
|
|
58
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
59
|
+
* components wrapping `<Binding>`'s functionality.
|
|
60
|
+
*
|
|
61
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
62
|
+
*
|
|
58
63
|
* @bindable
|
|
59
64
|
* @readonly
|
|
60
65
|
*/
|
|
61
66
|
ref?: import('tweakpane').SliderInputBindingApi | undefined;
|
|
62
67
|
/**
|
|
63
68
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
64
|
-
* the
|
|
69
|
+
* the `<Binding>`'s containing `<Pane>`.
|
|
70
|
+
*
|
|
71
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
72
|
+
* components wrapping `<Binding>`'s functionality in combination with a Tweakpane plugin.
|
|
73
|
+
*
|
|
74
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
65
75
|
*
|
|
66
|
-
* This is primarily for internal use, when implementing convenience components wrapping
|
|
67
|
-
* Binding's functionality in combination with a Tweakpane plugin.
|
|
68
76
|
* @default `undefined`
|
|
69
77
|
*/
|
|
70
78
|
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
@@ -94,7 +102,7 @@ declare const __propDef: {
|
|
|
94
102
|
*/
|
|
95
103
|
max?: number | undefined;
|
|
96
104
|
/**
|
|
97
|
-
* A function to customize the point value's
|
|
105
|
+
* A function to customize the point value's string representation (e.g. rounding, etc.).
|
|
98
106
|
* @default `undefined` \
|
|
99
107
|
* Normal `.toString()` formatting.
|
|
100
108
|
*/
|
|
@@ -134,10 +142,21 @@ declare const __propDef: {
|
|
|
134
142
|
* */
|
|
135
143
|
meanValue?: number | undefined;
|
|
136
144
|
};
|
|
145
|
+
slots: {};
|
|
137
146
|
events: {
|
|
138
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Fires when `value` changes.
|
|
149
|
+
*
|
|
150
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
151
|
+
*
|
|
152
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
153
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
154
|
+
*
|
|
155
|
+
* @extends ValueChangeEvent
|
|
156
|
+
* @event
|
|
157
|
+
* */
|
|
158
|
+
change: IntervalSliderChangeEvent;
|
|
139
159
|
};
|
|
140
|
-
slots: {};
|
|
141
160
|
};
|
|
142
161
|
export type IntervalSliderProps = typeof __propDef.props;
|
|
143
162
|
export type IntervalSliderEvents = typeof __propDef.events;
|
|
@@ -153,6 +172,8 @@ export type IntervalSliderSlots = typeof __propDef.slots;
|
|
|
153
172
|
* to object values. It also exposes a `meanValue` prop for reading or setting the midpoint of the
|
|
154
173
|
* interval range value.
|
|
155
174
|
*
|
|
175
|
+
* @emits {IntervalSliderChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
176
|
+
*
|
|
156
177
|
* Usage outside of a `<Pane>` component will implicitly wrap the interval slider in `<Pane
|
|
157
178
|
* position='inline'>`.
|
|
158
179
|
*
|
package/dist/control/List.svelte
CHANGED
|
@@ -3,15 +3,26 @@
|
|
|
3
3
|
<script generics="T extends any">
|
|
4
4
|
import Blade from '../core/Blade.svelte';
|
|
5
5
|
import ClsPad from '../internal/ClsPad.svelte';
|
|
6
|
+
import {} from '../utils';
|
|
6
7
|
import { BROWSER } from 'esm-env';
|
|
8
|
+
import copy from 'fast-copy';
|
|
9
|
+
import { shallowEqual } from 'fast-equals';
|
|
10
|
+
import { createEventDispatcher } from 'svelte';
|
|
7
11
|
export let value;
|
|
8
12
|
export let options;
|
|
9
13
|
export let label = void 0;
|
|
14
|
+
const dispatch = createEventDispatcher();
|
|
10
15
|
let listBlade;
|
|
11
16
|
let bladeOptions;
|
|
12
17
|
function addEvent() {
|
|
13
18
|
listBlade.on('change', (event) => {
|
|
14
|
-
|
|
19
|
+
if (!shallowEqual(event.value, value)) {
|
|
20
|
+
value = event.value;
|
|
21
|
+
dispatch('change', {
|
|
22
|
+
value: copy(value),
|
|
23
|
+
origin: 'internal'
|
|
24
|
+
});
|
|
25
|
+
}
|
|
15
26
|
});
|
|
16
27
|
}
|
|
17
28
|
function getInitialValue() {
|
|
@@ -45,7 +56,13 @@
|
|
|
45
56
|
: options2.map((value2) => ({ value: value2, text: JSON.stringify(value2) }));
|
|
46
57
|
}
|
|
47
58
|
function setValue() {
|
|
48
|
-
listBlade.value
|
|
59
|
+
if (!shallowEqual(listBlade.value, value)) {
|
|
60
|
+
listBlade.value = value;
|
|
61
|
+
dispatch('change', {
|
|
62
|
+
value: copy(value),
|
|
63
|
+
origin: 'external'
|
|
64
|
+
});
|
|
65
|
+
}
|
|
49
66
|
}
|
|
50
67
|
$: bladeOptions = {
|
|
51
68
|
value: getInitialValue(),
|