svelte-tweakpane-ui 1.1.3 → 1.2.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/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 +20 -6
- package/dist/control/Textarea.svelte.d.ts +28 -7
- 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/package.json +24 -19
- package/readme.md +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
2
|
import type { PointDimensionParams } from '@tweakpane/core';
|
|
3
3
|
import type { Simplify } from '../utils';
|
|
4
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
4
5
|
export type RotationQuaternionOptions = Simplify<PointDimensionParams>;
|
|
5
6
|
export type RotationQuaternionValueObject = {
|
|
6
7
|
x: number;
|
|
@@ -12,6 +13,7 @@ export type RotationQuaternionValueTuple = [x: number, y: number, z: number, w:
|
|
|
12
13
|
export type RotationQuaternionValue = Simplify<
|
|
13
14
|
RotationQuaternionValueObject | RotationQuaternionValueTuple
|
|
14
15
|
>;
|
|
16
|
+
export type RotationQuaternionChangeEvent = ValueChangeEvent<RotationQuaternionValue>;
|
|
15
17
|
import type { RotationInputPluginQuaternionParams as RotationQuaternionOptionsInternal } from '@0b5vr/tweakpane-plugin-rotation/dist/types/RotationInputPluginQuaternionParams';
|
|
16
18
|
declare const __propDef: {
|
|
17
19
|
props: Omit<
|
|
@@ -60,18 +62,24 @@ declare const __propDef: {
|
|
|
60
62
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
61
63
|
* this control.
|
|
62
64
|
*
|
|
63
|
-
* This is
|
|
64
|
-
* Binding's functionality.
|
|
65
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
66
|
+
* components wrapping `<Binding>`'s functionality.
|
|
67
|
+
*
|
|
68
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
69
|
+
*
|
|
65
70
|
* @bindable
|
|
66
71
|
* @readonly
|
|
67
72
|
*/
|
|
68
73
|
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined;
|
|
69
74
|
/**
|
|
70
75
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
71
|
-
* the
|
|
76
|
+
* the `<Binding>`'s containing `<Pane>`.
|
|
77
|
+
*
|
|
78
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
79
|
+
* components wrapping `<Binding>`'s functionality in combination with a Tweakpane plugin.
|
|
80
|
+
*
|
|
81
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
72
82
|
*
|
|
73
|
-
* This is primarily for internal use, when implementing convenience components wrapping
|
|
74
|
-
* Binding's functionality in combination with a Tweakpane plugin.
|
|
75
83
|
* @default `undefined`
|
|
76
84
|
*/
|
|
77
85
|
plugin?: import('@tweakpane/core').TpPluginBundle | undefined;
|
|
@@ -188,10 +196,21 @@ declare const __propDef: {
|
|
|
188
196
|
}
|
|
189
197
|
| undefined;
|
|
190
198
|
};
|
|
199
|
+
slots: {};
|
|
191
200
|
events: {
|
|
192
|
-
|
|
201
|
+
/**
|
|
202
|
+
* Fires when `value` changes.
|
|
203
|
+
*
|
|
204
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
205
|
+
*
|
|
206
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
207
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
208
|
+
*
|
|
209
|
+
* @extends ValueChangeEvent
|
|
210
|
+
* @event
|
|
211
|
+
* */
|
|
212
|
+
change: RotationQuaternionChangeEvent;
|
|
193
213
|
};
|
|
194
|
-
slots: {};
|
|
195
214
|
};
|
|
196
215
|
export type RotationQuaternionProps = typeof __propDef.props;
|
|
197
216
|
export type RotationQuaternionEvents = typeof __propDef.events;
|
|
@@ -211,14 +230,11 @@ export type RotationQuaternionSlots = typeof __propDef.slots;
|
|
|
211
230
|
*
|
|
212
231
|
* See also <RotationEuler> if you're not into the whole `w` thing.
|
|
213
232
|
*
|
|
233
|
+
* @emits {RotationQuaternionChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
234
|
+
*
|
|
214
235
|
* Usage outside of a `<Pane>` component will implicitly wrap the profiler in `<Pane
|
|
215
236
|
* position='inline'>`.
|
|
216
237
|
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
238
|
* @example
|
|
223
239
|
* ```svelte
|
|
224
240
|
* <script lang="ts">
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
3
|
+
export type SliderChangeEvent = ValueChangeEvent<number>;
|
|
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('tweakpane').SliderInputBindingApi | 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;
|
|
@@ -85,7 +93,7 @@ declare const __propDef: {
|
|
|
85
93
|
*/
|
|
86
94
|
max?: number | undefined;
|
|
87
95
|
/**
|
|
88
|
-
* A function to customize the point value's
|
|
96
|
+
* A function to customize the point value's string representation (e.g. rounding, etc.).
|
|
89
97
|
* @default `undefined` \
|
|
90
98
|
* Normal `.toString()` formatting.
|
|
91
99
|
*/
|
|
@@ -118,26 +126,39 @@ declare const __propDef: {
|
|
|
118
126
|
* */
|
|
119
127
|
value: number;
|
|
120
128
|
};
|
|
129
|
+
slots: {};
|
|
121
130
|
events: {
|
|
122
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Fires when `value` changes.
|
|
133
|
+
*
|
|
134
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
135
|
+
*
|
|
136
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
137
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
138
|
+
*
|
|
139
|
+
* @extends ValueChangeEvent
|
|
140
|
+
* @event
|
|
141
|
+
* */
|
|
142
|
+
change: SliderChangeEvent;
|
|
123
143
|
};
|
|
124
|
-
slots: {};
|
|
125
144
|
};
|
|
126
145
|
export type SliderProps = typeof __propDef.props;
|
|
127
146
|
export type SliderEvents = typeof __propDef.events;
|
|
128
147
|
export type SliderSlots = typeof __propDef.slots;
|
|
129
148
|
/**
|
|
130
|
-
* A slider component providing fine-grained control over
|
|
149
|
+
* A slider component providing fine-grained control over numeric values.
|
|
131
150
|
*
|
|
132
151
|
* Wraps Tweakpane's [number bindings](https://tweakpane.github.io/docs/input-bindings/#number).
|
|
133
152
|
*
|
|
134
153
|
* Note that if `min` and `max` props are not defined, no linear slider widget will be provided and a
|
|
135
154
|
* input field with a draggable handle will be used instead.
|
|
136
155
|
*
|
|
137
|
-
* Usage outside of a `<Pane>` component will implicitly wrap the slider in `<Pane position='inline'>`.
|
|
138
|
-
*
|
|
139
156
|
* See the `<Interval>` component for a multi-handle range-defining slider.
|
|
140
157
|
*
|
|
158
|
+
* @emits {SliderChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
159
|
+
*
|
|
160
|
+
* Usage outside of a `<Pane>` component will implicitly wrap the slider in `<Pane position='inline'>`.
|
|
161
|
+
*
|
|
141
162
|
* @example
|
|
142
163
|
* ```svelte
|
|
143
164
|
* <script lang="ts">
|
package/dist/control/Text.svelte
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
1
3
|
<script>
|
|
2
4
|
import GenericInput from '../internal/GenericInput.svelte';
|
|
3
5
|
import { onDestroy } from 'svelte';
|
|
@@ -8,18 +10,14 @@
|
|
|
8
10
|
updateListeners(live ?? true, true);
|
|
9
11
|
});
|
|
10
12
|
function onInput(event) {
|
|
11
|
-
|
|
12
|
-
value = event.target.value;
|
|
13
|
-
}
|
|
13
|
+
event.target?.dispatchEvent(new Event('change'));
|
|
14
14
|
}
|
|
15
15
|
function updateListeners(live2, destroy = false) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
!destroy && live2 && input.addEventListener('input', onInput);
|
|
20
|
-
}
|
|
16
|
+
const input = ref?.controller.valueController.view.element.querySelector('input');
|
|
17
|
+
input?.removeEventListener('input', onInput);
|
|
18
|
+
!destroy && live2 && input?.addEventListener('input', onInput);
|
|
21
19
|
}
|
|
22
20
|
$: ref && live !== void 0 && updateListeners(live);
|
|
23
21
|
</script>
|
|
24
22
|
|
|
25
|
-
<GenericInput bind:value bind:ref {...$$restProps} />
|
|
23
|
+
<GenericInput bind:value bind:ref on:change {...$$restProps} />
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
3
|
+
export type TextChangeEvent = ValueChangeEvent<string>;
|
|
2
4
|
import { type GenericInputRef } from '../internal/GenericInput.svelte';
|
|
3
5
|
declare const __propDef: {
|
|
4
6
|
props: 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?: 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;
|
|
@@ -87,10 +95,21 @@ declare const __propDef: {
|
|
|
87
95
|
* */
|
|
88
96
|
live?: boolean | undefined;
|
|
89
97
|
};
|
|
98
|
+
slots: {};
|
|
90
99
|
events: {
|
|
91
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Fires when `value` changes.
|
|
102
|
+
*
|
|
103
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
104
|
+
*
|
|
105
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
106
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
107
|
+
*
|
|
108
|
+
* @extends ValueChangeEvent
|
|
109
|
+
* @event
|
|
110
|
+
* */
|
|
111
|
+
change: TextChangeEvent;
|
|
92
112
|
};
|
|
93
|
-
slots: {};
|
|
94
113
|
};
|
|
95
114
|
export type TextProps = typeof __propDef.props;
|
|
96
115
|
export type TextEvents = typeof __propDef.events;
|
|
@@ -105,6 +124,8 @@ export type TextSlots = typeof __propDef.slots;
|
|
|
105
124
|
*
|
|
106
125
|
* See `<TextArea>` for a multi-line input variation.
|
|
107
126
|
*
|
|
127
|
+
* @emits {TextChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
128
|
+
*
|
|
108
129
|
* Usage outside of a `<Pane>` component will implicitly wrap the text field in `<Pane
|
|
109
130
|
* position='inline'>`.
|
|
110
131
|
*
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
1
3
|
<script>
|
|
2
4
|
import * as pluginModule from '@kitschpatrol/tweakpane-textarea-plugin';
|
|
3
5
|
import GenericInput from '../internal/GenericInput.svelte';
|
|
6
|
+
import {} from '../utils.js';
|
|
4
7
|
import { BROWSER } from 'esm-env';
|
|
5
|
-
import { onDestroy } from 'svelte';
|
|
8
|
+
import { createEventDispatcher, onDestroy } from 'svelte';
|
|
6
9
|
export let value;
|
|
7
10
|
export let live = true;
|
|
8
11
|
export let rows = void 0;
|
|
9
12
|
export let placeholder = void 0;
|
|
13
|
+
const dispatch = createEventDispatcher();
|
|
10
14
|
let _value = value;
|
|
11
15
|
let ref;
|
|
12
16
|
let options;
|
|
@@ -15,17 +19,26 @@
|
|
|
15
19
|
});
|
|
16
20
|
function onBlur(event) {
|
|
17
21
|
value = event.target.value;
|
|
22
|
+
lastText = value;
|
|
23
|
+
dispatch('change', { value, origin: 'internal' });
|
|
18
24
|
}
|
|
19
25
|
function onInput(event) {
|
|
20
26
|
value = event.target.value;
|
|
27
|
+
lastText = value;
|
|
28
|
+
dispatch('change', { value, origin: 'internal' });
|
|
21
29
|
}
|
|
22
30
|
function updateListeners(live2, destroy = false) {
|
|
23
31
|
const input = ref?.controller.valueController.view.element.querySelector('textarea');
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
input?.removeEventListener('blur', onBlur);
|
|
33
|
+
input?.removeEventListener('input', onInput);
|
|
34
|
+
!destroy && live2 && input?.addEventListener('input', onInput);
|
|
35
|
+
!destroy && !live2 && input?.addEventListener('blur', onBlur);
|
|
36
|
+
}
|
|
37
|
+
let lastText = value;
|
|
38
|
+
function onBoundValueChange(text) {
|
|
39
|
+
if (text !== lastText) {
|
|
40
|
+
dispatch('change', { value: text, origin: 'external' });
|
|
41
|
+
lastText = text;
|
|
29
42
|
}
|
|
30
43
|
}
|
|
31
44
|
$: _value = value;
|
|
@@ -35,6 +48,7 @@
|
|
|
35
48
|
rows,
|
|
36
49
|
view: 'textarea'
|
|
37
50
|
};
|
|
51
|
+
$: ref && onBoundValueChange(_value);
|
|
38
52
|
</script>
|
|
39
53
|
|
|
40
54
|
<GenericInput value={_value} bind:ref {options} plugin={pluginModule} {...$$restProps} />
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
3
|
+
export type TextareaChangeEvent = ValueChangeEvent<string>;
|
|
2
4
|
import type { TextareaPluginInputParams } from '@kitschpatrol/tweakpane-textarea-plugin/dist/types/plugin.js';
|
|
3
5
|
import { type GenericInputRef } from '../internal/GenericInput.svelte';
|
|
4
6
|
declare const __propDef: {
|
|
@@ -48,18 +50,24 @@ declare const __propDef: {
|
|
|
48
50
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
49
51
|
* this control.
|
|
50
52
|
*
|
|
51
|
-
* This is
|
|
52
|
-
* Binding's functionality.
|
|
53
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
54
|
+
* components wrapping `<Binding>`'s functionality.
|
|
55
|
+
*
|
|
56
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
57
|
+
*
|
|
53
58
|
* @bindable
|
|
54
59
|
* @readonly
|
|
55
60
|
*/
|
|
56
61
|
ref?: GenericInputRef | undefined;
|
|
57
62
|
/**
|
|
58
63
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
59
|
-
* the
|
|
64
|
+
* the `<Binding>`'s containing `<Pane>`.
|
|
65
|
+
*
|
|
66
|
+
* This property is exposed for advanced use cases only, such as when implementing convenience
|
|
67
|
+
* components wrapping `<Binding>`'s functionality in combination with a Tweakpane plugin.
|
|
68
|
+
*
|
|
69
|
+
* Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
|
|
60
70
|
*
|
|
61
|
-
* This is primarily for internal use, when implementing convenience components wrapping
|
|
62
|
-
* Binding's functionality in combination with a Tweakpane plugin.
|
|
63
71
|
* @default `undefined`
|
|
64
72
|
*/
|
|
65
73
|
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
@@ -97,10 +105,21 @@ declare const __propDef: {
|
|
|
97
105
|
*/
|
|
98
106
|
rows?: number | undefined;
|
|
99
107
|
};
|
|
108
|
+
slots: {};
|
|
100
109
|
events: {
|
|
101
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Fires when `value` changes.
|
|
112
|
+
*
|
|
113
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
114
|
+
*
|
|
115
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
116
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
117
|
+
*
|
|
118
|
+
* @extends ValueChangeEvent
|
|
119
|
+
* @event
|
|
120
|
+
* */
|
|
121
|
+
change: TextareaChangeEvent;
|
|
102
122
|
};
|
|
103
|
-
slots: {};
|
|
104
123
|
};
|
|
105
124
|
export type TextareaProps = typeof __propDef.props;
|
|
106
125
|
export type TextareaEvents = typeof __propDef.events;
|
|
@@ -121,6 +140,8 @@ export type TextareaSlots = typeof __propDef.slots;
|
|
|
121
140
|
* [pull request](https://github.com/panGenerator/tweakpane-textarea-plugin/pull/4) with Tweakpane 4
|
|
122
141
|
* support is merged.
|
|
123
142
|
*
|
|
143
|
+
* @emits {TextareaChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
144
|
+
*
|
|
124
145
|
* Usage outside of a `<Pane>` component will implicitly wrap the text area in `<Pane
|
|
125
146
|
* position='inline'>`.
|
|
126
147
|
*
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
1
3
|
<script>
|
|
2
4
|
import * as pluginModule from '@tweakpane/plugin-camerakit';
|
|
3
5
|
import GenericSlider from '../internal/GenericSlider.svelte';
|
|
@@ -12,4 +14,4 @@
|
|
|
12
14
|
};
|
|
13
15
|
</script>
|
|
14
16
|
|
|
15
|
-
<GenericSlider bind:value {options} plugin={pluginModule} {...$$restProps} />
|
|
17
|
+
<GenericSlider bind:value on:change {options} plugin={pluginModule} {...$$restProps} />
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
3
|
+
export type WheelChangeEvent = ValueChangeEvent<number>;
|
|
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('tweakpane').SliderInputBindingApi | 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;
|
|
@@ -85,7 +93,7 @@ declare const __propDef: {
|
|
|
85
93
|
*/
|
|
86
94
|
max?: number | undefined;
|
|
87
95
|
/**
|
|
88
|
-
* A function to customize the point value's
|
|
96
|
+
* A function to customize the point value's string representation (e.g. rounding, etc.).
|
|
89
97
|
* @default `undefined` \
|
|
90
98
|
* Normal `.toString()` formatting.
|
|
91
99
|
*/
|
|
@@ -124,16 +132,27 @@ declare const __propDef: {
|
|
|
124
132
|
*/
|
|
125
133
|
amount?: number | undefined;
|
|
126
134
|
/**
|
|
127
|
-
* When `true`, expand the width of the wheel control at the expense of the
|
|
135
|
+
* When `true`, expand the width of the wheel control at the expense of the numeric input
|
|
128
136
|
* field.
|
|
129
137
|
* @default `false`
|
|
130
138
|
* */
|
|
131
139
|
wide?: boolean | undefined;
|
|
132
140
|
};
|
|
141
|
+
slots: {};
|
|
133
142
|
events: {
|
|
134
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Fires when `value` changes.
|
|
145
|
+
*
|
|
146
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
|
|
147
|
+
*
|
|
148
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
149
|
+
* and changes resulting from programmatic manipulation of the `value` (`external`).
|
|
150
|
+
*
|
|
151
|
+
* @extends ValueChangeEvent
|
|
152
|
+
* @event
|
|
153
|
+
* */
|
|
154
|
+
change: WheelChangeEvent;
|
|
135
155
|
};
|
|
136
|
-
slots: {};
|
|
137
156
|
};
|
|
138
157
|
export type WheelProps = typeof __propDef.props;
|
|
139
158
|
export type WheelEvents = typeof __propDef.events;
|
|
@@ -147,6 +166,8 @@ export type WheelSlots = typeof __propDef.slots;
|
|
|
147
166
|
* control from Tweakpane-creator [Hiroki Kokubun's](https://cocopon.me) [Camerakit
|
|
148
167
|
* plugin](https://github.com/tweakpane/plugin-camerakit).
|
|
149
168
|
*
|
|
169
|
+
* @emits {WheelChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
|
|
170
|
+
*
|
|
150
171
|
* Usage outside of a `<Pane>` component will implicitly wrap the wheel in `<Pane position='inline'>`.
|
|
151
172
|
*
|
|
152
173
|
* @example
|
package/dist/core/Binding.svelte
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
import InternalPaneInline from '../internal/InternalPaneInline.svelte';
|
|
6
6
|
import { enforceReadonly, getElementIndex, isRootPane } from '../utils.js';
|
|
7
7
|
import { BROWSER, DEV } from 'esm-env';
|
|
8
|
-
import
|
|
8
|
+
import copy from 'fast-copy';
|
|
9
|
+
import { shallowEqual } from 'fast-equals';
|
|
10
|
+
import { createEventDispatcher, getContext, onDestroy, onMount } from 'svelte';
|
|
9
11
|
export let object;
|
|
10
12
|
export let key;
|
|
11
13
|
export let disabled = false;
|
|
@@ -30,11 +32,10 @@
|
|
|
30
32
|
label,
|
|
31
33
|
...options,
|
|
32
34
|
disabled
|
|
35
|
+
// Why last?
|
|
33
36
|
});
|
|
34
37
|
ref = _ref;
|
|
35
|
-
_ref.on('change',
|
|
36
|
-
object = object;
|
|
37
|
-
});
|
|
38
|
+
_ref.on('change', onTweakpaneChange);
|
|
38
39
|
}
|
|
39
40
|
onMount(() => {
|
|
40
41
|
index = indexElement ? getElementIndex(indexElement) : 0;
|
|
@@ -42,13 +43,35 @@
|
|
|
42
43
|
onDestroy(() => {
|
|
43
44
|
_ref?.dispose();
|
|
44
45
|
});
|
|
46
|
+
const dispatch = createEventDispatcher();
|
|
47
|
+
let lastValue = copy(object[key]);
|
|
48
|
+
let internalChange = false;
|
|
49
|
+
function onBoundValueChange(object2) {
|
|
50
|
+
if (!shallowEqual(object2[key], lastValue)) {
|
|
51
|
+
lastValue = copy(object2[key]);
|
|
52
|
+
dispatch('change', {
|
|
53
|
+
value: copy(object2[key]),
|
|
54
|
+
origin: internalChange ? 'internal' : 'external'
|
|
55
|
+
});
|
|
56
|
+
if (!internalChange && _ref) {
|
|
57
|
+
_ref.off('change', onTweakpaneChange);
|
|
58
|
+
_ref.refresh();
|
|
59
|
+
_ref.on('change', onTweakpaneChange);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
internalChange = false;
|
|
63
|
+
}
|
|
64
|
+
function onTweakpaneChange() {
|
|
65
|
+
internalChange = true;
|
|
66
|
+
object = object;
|
|
67
|
+
}
|
|
45
68
|
$: DEV && enforceReadonly(_ref, ref, 'Binding', 'ref', true);
|
|
46
69
|
$: options, $parentStore !== void 0 && index !== void 0 && create();
|
|
47
|
-
$: object, _ref !== void 0 && _ref.refresh();
|
|
48
70
|
$: _ref !== void 0 && (_ref.disabled = disabled);
|
|
49
71
|
$: _ref !== void 0 && (_ref.label = label);
|
|
72
|
+
$: $parentStore !== void 0 && onBoundValueChange(object);
|
|
50
73
|
$: theme &&
|
|
51
|
-
$parentStore &&
|
|
74
|
+
$parentStore !== void 0 &&
|
|
52
75
|
(userCreatedPane || !isRootPane($parentStore)) &&
|
|
53
76
|
console.warn(
|
|
54
77
|
'Set theme on the <Pane> component, not on its children! (Check nested <Binding> components for a theme prop.)'
|
|
@@ -63,6 +86,15 @@
|
|
|
63
86
|
{/if}
|
|
64
87
|
{:else}
|
|
65
88
|
<InternalPaneInline {theme} userCreatedPane={false}>
|
|
66
|
-
<svelte:self
|
|
89
|
+
<svelte:self
|
|
90
|
+
bind:disabled
|
|
91
|
+
bind:key
|
|
92
|
+
bind:label
|
|
93
|
+
bind:object
|
|
94
|
+
bind:options
|
|
95
|
+
bind:plugin
|
|
96
|
+
bind:ref
|
|
97
|
+
on:change
|
|
98
|
+
/>
|
|
67
99
|
</InternalPaneInline>
|
|
68
100
|
{/if}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { SvelteComponent } from 'svelte';
|
|
2
2
|
import type { BindingApi, BindingParams } from '@tweakpane/core';
|
|
3
3
|
import type { BindingObject } from '../utils';
|
|
4
|
+
import type { ValueChangeEvent } from '../utils.js';
|
|
4
5
|
export type BindingOptions = BindingParams;
|
|
5
6
|
export type BindingRef = BindingApi;
|
|
7
|
+
export type BindingChangeEvent = ValueChangeEvent<BindingObject>;
|
|
6
8
|
import type { Theme } from '../theme.js';
|
|
7
9
|
declare class __sveltets_Render<
|
|
8
10
|
T extends BindingObject,
|
|
@@ -47,22 +49,39 @@ declare class __sveltets_Render<
|
|
|
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
|
* */ ref?: V | 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
|
* */ plugin?: import('@tweakpane/core').TpPluginBundle | undefined;
|
|
63
71
|
};
|
|
64
|
-
events(): {
|
|
65
|
-
|
|
72
|
+
events(): {
|
|
73
|
+
/**
|
|
74
|
+
* Fires when the value of `object[key]` changes.
|
|
75
|
+
*
|
|
76
|
+
* _This event is provided for advanced use cases. It's usually preferred to bind to the `object` prop instead._
|
|
77
|
+
*
|
|
78
|
+
* The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
|
|
79
|
+
* and changes resulting from programmatic manipulation of the `object` (`external`).
|
|
80
|
+
*
|
|
81
|
+
* @extends ValueChangeEvent
|
|
82
|
+
* @event
|
|
83
|
+
* */
|
|
84
|
+
change: BindingChangeEvent;
|
|
66
85
|
};
|
|
67
86
|
slots(): {};
|
|
68
87
|
}
|
|
@@ -90,6 +109,8 @@ export type BindingSlots<
|
|
|
90
109
|
* Please consider convenience components like `<Slider>`, `<Color>`, etc. etc. before using this
|
|
91
110
|
* component directly.
|
|
92
111
|
*
|
|
112
|
+
* @emits {BindingChangeEvent} change - When the value of `object[key]` changes. (This event is provided for advanced use cases. Prefer binding to `object`.)
|
|
113
|
+
*
|
|
93
114
|
* Usage outside of a `<Pane>` component will implicitly wrap the component in `<Pane
|
|
94
115
|
* position='inline'>`.
|
|
95
116
|
*
|