svelte-tweakpane-ui 1.5.3 → 1.5.5
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 +30 -30
- package/dist/control/Button.svelte.d.ts +18 -18
- package/dist/control/ButtonGrid.svelte +25 -25
- package/dist/control/ButtonGrid.svelte.d.ts +35 -35
- package/dist/control/Checkbox.svelte +2 -2
- package/dist/control/Checkbox.svelte.d.ts +23 -23
- package/dist/control/Color.svelte +34 -34
- package/dist/control/Color.svelte.d.ts +40 -40
- package/dist/control/CubicBezier.svelte +30 -30
- package/dist/control/CubicBezier.svelte.d.ts +47 -47
- package/dist/control/File.svelte +20 -20
- package/dist/control/File.svelte.d.ts +38 -38
- package/dist/control/Image.svelte +22 -22
- package/dist/control/Image.svelte.d.ts +31 -31
- package/dist/control/IntervalSlider.svelte +24 -24
- package/dist/control/IntervalSlider.svelte.d.ts +39 -39
- package/dist/control/List.svelte +35 -35
- package/dist/control/List.svelte.d.ts +31 -31
- package/dist/control/Point.svelte +31 -31
- package/dist/control/Point.svelte.d.ts +81 -81
- package/dist/control/RadioGrid.svelte +24 -24
- package/dist/control/RadioGrid.svelte.d.ts +40 -40
- package/dist/control/Ring.svelte +9 -9
- package/dist/control/Ring.svelte.d.ts +40 -40
- package/dist/control/RotationEuler.svelte +25 -25
- package/dist/control/RotationEuler.svelte.d.ts +53 -53
- package/dist/control/RotationQuaternion.svelte +24 -24
- package/dist/control/RotationQuaternion.svelte.d.ts +47 -47
- package/dist/control/Slider.svelte +9 -9
- package/dist/control/Slider.svelte.d.ts +32 -32
- package/dist/control/Stepper.svelte +16 -16
- package/dist/control/Stepper.svelte.d.ts +32 -32
- package/dist/control/Text.svelte +13 -13
- package/dist/control/Text.svelte.d.ts +26 -26
- package/dist/control/Textarea.svelte +34 -34
- package/dist/control/Textarea.svelte.d.ts +29 -29
- package/dist/control/Wheel.svelte +8 -8
- package/dist/control/Wheel.svelte.d.ts +32 -32
- package/dist/core/Binding.svelte +60 -60
- package/dist/core/Binding.svelte.d.ts +33 -33
- package/dist/core/Blade.svelte +30 -30
- package/dist/core/Blade.svelte.d.ts +21 -21
- package/dist/core/Folder.svelte +34 -34
- package/dist/core/Folder.svelte.d.ts +22 -22
- package/dist/core/Pane.svelte +17 -17
- package/dist/core/Pane.svelte.d.ts +56 -56
- package/dist/core/Separator.svelte +5 -5
- package/dist/core/Separator.svelte.d.ts +20 -20
- package/dist/core/TabGroup.svelte +29 -29
- package/dist/core/TabGroup.svelte.d.ts +18 -18
- package/dist/core/TabPage.svelte +36 -36
- package/dist/core/TabPage.svelte.d.ts +21 -21
- package/dist/extra/AutoObject.svelte +20 -20
- package/dist/extra/AutoObject.svelte.d.ts +22 -22
- package/dist/extra/AutoValue.svelte +3 -3
- package/dist/extra/AutoValue.svelte.d.ts +26 -26
- package/dist/extra/Element.svelte +10 -10
- package/dist/extra/Element.svelte.d.ts +26 -26
- package/dist/index.d.ts +48 -48
- package/dist/index.js +35 -35
- package/dist/internal/ClsPad.svelte +11 -11
- package/dist/internal/ClsPad.svelte.d.ts +17 -17
- package/dist/internal/GenericBinding.svelte +11 -11
- package/dist/internal/GenericBinding.svelte.d.ts +25 -25
- package/dist/internal/GenericBladeFolding.svelte +19 -19
- package/dist/internal/GenericBladeFolding.svelte.d.ts +20 -20
- package/dist/internal/GenericInput.svelte +7 -7
- package/dist/internal/GenericInput.svelte.d.ts +27 -27
- package/dist/internal/GenericInputFolding.svelte +21 -21
- package/dist/internal/GenericInputFolding.svelte.d.ts +32 -32
- package/dist/internal/GenericMonitor.svelte +10 -10
- package/dist/internal/GenericMonitor.svelte.d.ts +29 -29
- package/dist/internal/GenericPane.svelte +48 -48
- package/dist/internal/GenericPane.svelte.d.ts +22 -22
- package/dist/internal/GenericSlider.svelte +15 -15
- package/dist/internal/GenericSlider.svelte.d.ts +29 -29
- package/dist/internal/InternalMonitorBoolean.svelte +5 -5
- package/dist/internal/InternalMonitorBoolean.svelte.d.ts +31 -31
- package/dist/internal/InternalMonitorNumber.svelte +14 -14
- package/dist/internal/InternalMonitorNumber.svelte.d.ts +37 -37
- package/dist/internal/InternalMonitorString.svelte +9 -9
- package/dist/internal/InternalMonitorString.svelte.d.ts +32 -32
- package/dist/internal/InternalPaneDraggable.svelte +169 -173
- package/dist/internal/InternalPaneDraggable.svelte.d.ts +30 -30
- package/dist/internal/InternalPaneFixed.svelte +13 -13
- package/dist/internal/InternalPaneFixed.svelte.d.ts +23 -23
- package/dist/internal/InternalPaneInline.svelte +14 -14
- package/dist/internal/InternalPaneInline.svelte.d.ts +21 -21
- package/dist/monitor/FpsGraph.svelte +35 -35
- package/dist/monitor/FpsGraph.svelte.d.ts +50 -42
- package/dist/monitor/Monitor.svelte +4 -4
- package/dist/monitor/Monitor.svelte.d.ts +87 -88
- package/dist/monitor/Profiler.svelte +37 -37
- package/dist/monitor/Profiler.svelte.d.ts +78 -76
- package/dist/monitor/WaveformMonitor.svelte +12 -12
- package/dist/monitor/WaveformMonitor.svelte.d.ts +39 -39
- package/dist/theme.d.ts +61 -61
- package/dist/theme.js +49 -53
- package/dist/utils.d.ts +62 -66
- package/dist/utils.js +78 -78
- package/license.txt +1 -1
- package/package.json +110 -125
- package/readme.md +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { SvelteComponent } from 'svelte'
|
|
2
|
-
import type { Simplify } from '../utils'
|
|
3
|
-
import type { ValueChangeEvent } from '../utils.js'
|
|
4
|
-
import type { SliderInputBindingApi as GenericSliderRef } from 'tweakpane'
|
|
5
|
-
export type IntervalSliderValueTuple = [min: number, max: number]
|
|
1
|
+
import { SvelteComponent } from 'svelte'
|
|
2
|
+
import type { Simplify } from '../utils'
|
|
3
|
+
import type { ValueChangeEvent } from '../utils.js'
|
|
4
|
+
import type { SliderInputBindingApi as GenericSliderRef } from 'tweakpane'
|
|
5
|
+
export type IntervalSliderValueTuple = [min: number, max: number]
|
|
6
6
|
export type IntervalSliderValueObject = {
|
|
7
|
-
min: number
|
|
8
|
-
max: number
|
|
9
|
-
}
|
|
10
|
-
export type IntervalSliderValue = Simplify<IntervalSliderValueObject | IntervalSliderValueTuple
|
|
11
|
-
export type IntervalSliderChangeEvent = ValueChangeEvent<IntervalSliderValue
|
|
7
|
+
min: number
|
|
8
|
+
max: number
|
|
9
|
+
}
|
|
10
|
+
export type IntervalSliderValue = Simplify<IntervalSliderValueObject | IntervalSliderValueTuple>
|
|
11
|
+
export type IntervalSliderChangeEvent = ValueChangeEvent<IntervalSliderValue>
|
|
12
12
|
declare const __propDef: {
|
|
13
13
|
props: {
|
|
14
14
|
/**
|
|
@@ -17,12 +17,12 @@ declare const __propDef: {
|
|
|
17
17
|
* Tuples are a convenience addition to the vanilla JS Tweakpane API.
|
|
18
18
|
* @bindable
|
|
19
19
|
*/
|
|
20
|
-
value: IntervalSliderValue
|
|
20
|
+
value: IntervalSliderValue
|
|
21
21
|
/**
|
|
22
22
|
* Midpoint of the interval range value.
|
|
23
23
|
* @bindable
|
|
24
24
|
* */
|
|
25
|
-
meanValue?: number
|
|
25
|
+
meanValue?: number
|
|
26
26
|
} & Omit<
|
|
27
27
|
{
|
|
28
28
|
/**
|
|
@@ -31,45 +31,45 @@ declare const __propDef: {
|
|
|
31
31
|
* Specifying both a `min` and a `max` prop turns the control into a slider.
|
|
32
32
|
* @default `undefined`
|
|
33
33
|
*/
|
|
34
|
-
min?: number
|
|
34
|
+
min?: number
|
|
35
35
|
/**
|
|
36
36
|
* Maximum value.
|
|
37
37
|
*
|
|
38
38
|
* Specifying both a `min` and a `max` prop turns the control into a slider.
|
|
39
39
|
* @default `undefined`
|
|
40
40
|
*/
|
|
41
|
-
max?: number
|
|
41
|
+
max?: number
|
|
42
42
|
/**
|
|
43
43
|
* A function to customize the point value's string representation (e.g. rounding, etc.).
|
|
44
44
|
* @default `undefined` \
|
|
45
45
|
* Normal `.toString()` formatting.
|
|
46
46
|
*/
|
|
47
|
-
format?: ((value: number) => string) | undefined
|
|
47
|
+
format?: ((value: number) => string) | undefined
|
|
48
48
|
/**
|
|
49
49
|
* The unit scale for key-based input for all dimensions (e.g. the up and down arrow keys).
|
|
50
50
|
* @default `1` \
|
|
51
51
|
* Or `stepValue` if defined.
|
|
52
52
|
*/
|
|
53
|
-
keyScale?: number
|
|
53
|
+
keyScale?: number
|
|
54
54
|
/**
|
|
55
55
|
* The unit scale for pointer-based input for all dimensions.
|
|
56
56
|
* @default `undefined` \
|
|
57
57
|
* [Dynamic based on magnitude of
|
|
58
58
|
* `value`](https://github.com/cocopon/tweakpane/blob/66dfbea04bfe9b7f031673c955ceda1f92356e75/packages/core/src/common/number/util.ts#L54).
|
|
59
59
|
*/
|
|
60
|
-
pointerScale?: number
|
|
60
|
+
pointerScale?: number
|
|
61
61
|
/**
|
|
62
62
|
* The minimum step interval.
|
|
63
63
|
* @default `undefined` \
|
|
64
64
|
* No step constraint.
|
|
65
65
|
*/
|
|
66
|
-
step?: number
|
|
66
|
+
step?: number
|
|
67
67
|
/**
|
|
68
68
|
* When `true`, expand the width of the control at the expense of the numeric input
|
|
69
69
|
* field.
|
|
70
70
|
* @default `false`
|
|
71
71
|
*/
|
|
72
|
-
wide?: boolean
|
|
72
|
+
wide?: boolean
|
|
73
73
|
} & {
|
|
74
74
|
/**
|
|
75
75
|
* Interval value to control.
|
|
@@ -77,26 +77,26 @@ declare const __propDef: {
|
|
|
77
77
|
* Tuples are a convenience addition to the vanilla JS Tweakpane API.
|
|
78
78
|
* @bindable
|
|
79
79
|
*/
|
|
80
|
-
value: IntervalSliderValue
|
|
80
|
+
value: IntervalSliderValue
|
|
81
81
|
} & Omit<
|
|
82
82
|
{
|
|
83
83
|
/**
|
|
84
84
|
* The binding's target object with values to manipulate.
|
|
85
85
|
* @bindable
|
|
86
86
|
*/
|
|
87
|
-
object: import('@tweakpane/core').Bindable & Record<string, IntervalSliderValue
|
|
87
|
+
object: import('@tweakpane/core').Bindable & Record<string, IntervalSliderValue>
|
|
88
88
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
89
|
-
key: string
|
|
89
|
+
key: string
|
|
90
90
|
/**
|
|
91
91
|
* Prevent interactivity and gray out the control.
|
|
92
92
|
* @default `false`
|
|
93
93
|
*/
|
|
94
|
-
disabled?: boolean
|
|
94
|
+
disabled?: boolean
|
|
95
95
|
/**
|
|
96
96
|
* Text displayed next to control.
|
|
97
97
|
* @default `undefined`
|
|
98
98
|
*/
|
|
99
|
-
label?: string | undefined
|
|
99
|
+
label?: string | undefined
|
|
100
100
|
/**
|
|
101
101
|
* Tweakpane's internal options object.
|
|
102
102
|
*
|
|
@@ -109,7 +109,7 @@ declare const __propDef: {
|
|
|
109
109
|
* Tweakpane UI_.
|
|
110
110
|
* @default `undefined`
|
|
111
111
|
*/
|
|
112
|
-
options?: import('tweakpane').NumberInputParams | undefined
|
|
112
|
+
options?: import('tweakpane').NumberInputParams | undefined
|
|
113
113
|
/**
|
|
114
114
|
* Custom color scheme.
|
|
115
115
|
*
|
|
@@ -117,7 +117,7 @@ declare const __propDef: {
|
|
|
117
117
|
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
118
118
|
* set with `setGlobalDefaultTheme()`.
|
|
119
119
|
*/
|
|
120
|
-
theme?: import('..').Theme | undefined
|
|
120
|
+
theme?: import('..').Theme | undefined
|
|
121
121
|
/**
|
|
122
122
|
* Reference to internal Tweakpane
|
|
123
123
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
@@ -131,7 +131,7 @@ declare const __propDef: {
|
|
|
131
131
|
* @bindable
|
|
132
132
|
* @readonly
|
|
133
133
|
*/
|
|
134
|
-
ref?: GenericSliderRef | undefined
|
|
134
|
+
ref?: GenericSliderRef | undefined
|
|
135
135
|
/**
|
|
136
136
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
137
137
|
* the `<Binding>`'s containing `<Pane>`.
|
|
@@ -143,13 +143,13 @@ declare const __propDef: {
|
|
|
143
143
|
*
|
|
144
144
|
* @default `undefined`
|
|
145
145
|
*/
|
|
146
|
-
plugin?: import('../utils').Plugin | undefined
|
|
146
|
+
plugin?: import('../utils').Plugin | undefined
|
|
147
147
|
},
|
|
148
148
|
'object' | 'key'
|
|
149
149
|
>,
|
|
150
150
|
'ref' | 'options' | 'plugin'
|
|
151
|
-
|
|
152
|
-
slots: {}
|
|
151
|
+
>
|
|
152
|
+
slots: {}
|
|
153
153
|
events: {
|
|
154
154
|
/**
|
|
155
155
|
* Fires when `value` changes.
|
|
@@ -162,12 +162,12 @@ declare const __propDef: {
|
|
|
162
162
|
* @extends ValueChangeEvent
|
|
163
163
|
* @event
|
|
164
164
|
* */
|
|
165
|
-
change: IntervalSliderChangeEvent
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
export type IntervalSliderProps = typeof __propDef.props
|
|
169
|
-
export type IntervalSliderEvents = typeof __propDef.events
|
|
170
|
-
export type IntervalSliderSlots = typeof __propDef.slots
|
|
165
|
+
change: IntervalSliderChangeEvent
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
export type IntervalSliderProps = typeof __propDef.props
|
|
169
|
+
export type IntervalSliderEvents = typeof __propDef.events
|
|
170
|
+
export type IntervalSliderSlots = typeof __propDef.slots
|
|
171
171
|
/**
|
|
172
172
|
* A twin-handled slider control for specifying range values.
|
|
173
173
|
*
|
|
@@ -189,11 +189,11 @@ export type IntervalSliderSlots = typeof __propDef.slots;
|
|
|
189
189
|
* @example
|
|
190
190
|
* ```svelte
|
|
191
191
|
* <script lang="ts">
|
|
192
|
-
* import { IntervalSlider } from 'svelte-tweakpane-ui'
|
|
192
|
+
* import { IntervalSlider } from 'svelte-tweakpane-ui'
|
|
193
193
|
*
|
|
194
194
|
* // Could specify convenience type IntervalSliderValueTuple here, or
|
|
195
195
|
* // use the object {start: number, end: number} instead of a tuple
|
|
196
|
-
* let value: [number, number] = [25, 75]
|
|
196
|
+
* let value: [number, number] = [25, 75]
|
|
197
197
|
* </script>
|
|
198
198
|
*
|
|
199
199
|
* <IntervalSlider
|
|
@@ -221,4 +221,4 @@ export default class IntervalSlider extends SvelteComponent<
|
|
|
221
221
|
IntervalSliderEvents,
|
|
222
222
|
IntervalSliderSlots
|
|
223
223
|
> {}
|
|
224
|
-
export {}
|
|
224
|
+
export {}
|
package/dist/control/List.svelte
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script generics="T extends any">
|
|
4
|
-
import Blade from '../core/Blade.svelte'
|
|
5
|
-
import ClsPad from '../internal/ClsPad.svelte'
|
|
6
|
-
import {} from '../utils'
|
|
7
|
-
import { BROWSER } from 'esm-env'
|
|
8
|
-
import copy from 'fast-copy'
|
|
9
|
-
import { shallowEqual } from 'fast-equals'
|
|
10
|
-
import { createEventDispatcher } from 'svelte'
|
|
11
|
-
export let value
|
|
12
|
-
export let options
|
|
13
|
-
export let label = void 0
|
|
14
|
-
const dispatch = createEventDispatcher()
|
|
15
|
-
let listBlade
|
|
16
|
-
let bladeOptions
|
|
4
|
+
import Blade from '../core/Blade.svelte'
|
|
5
|
+
import ClsPad from '../internal/ClsPad.svelte'
|
|
6
|
+
import {} from '../utils'
|
|
7
|
+
import { BROWSER } from 'esm-env'
|
|
8
|
+
import copy from 'fast-copy'
|
|
9
|
+
import { shallowEqual } from 'fast-equals'
|
|
10
|
+
import { createEventDispatcher } from 'svelte'
|
|
11
|
+
export let value
|
|
12
|
+
export let options
|
|
13
|
+
export let label = void 0
|
|
14
|
+
const dispatch = createEventDispatcher()
|
|
15
|
+
let listBlade
|
|
16
|
+
let bladeOptions
|
|
17
17
|
function addEvent() {
|
|
18
18
|
listBlade.on('change', (event) => {
|
|
19
19
|
if (!shallowEqual(event.value, value)) {
|
|
20
|
-
value = event.value
|
|
20
|
+
value = event.value
|
|
21
21
|
dispatch('change', {
|
|
22
22
|
value: copy(value),
|
|
23
|
-
origin: 'internal'
|
|
24
|
-
})
|
|
23
|
+
origin: 'internal',
|
|
24
|
+
})
|
|
25
25
|
}
|
|
26
|
-
})
|
|
26
|
+
})
|
|
27
27
|
}
|
|
28
28
|
function getInitialValue() {
|
|
29
29
|
if (value === void 0) {
|
|
30
|
-
const internalOptions = getInternalOptions(options)
|
|
30
|
+
const internalOptions = getInternalOptions(options)
|
|
31
31
|
if (Array.isArray(internalOptions)) {
|
|
32
|
-
value = internalOptions[0].value
|
|
33
|
-
return value
|
|
32
|
+
value = internalOptions[0].value
|
|
33
|
+
return value
|
|
34
34
|
}
|
|
35
|
-
value = internalOptions[Object.keys(internalOptions)[0]]
|
|
36
|
-
return value
|
|
35
|
+
value = internalOptions[Object.keys(internalOptions)[0]]
|
|
36
|
+
return value
|
|
37
37
|
}
|
|
38
|
-
return value
|
|
38
|
+
return value
|
|
39
39
|
}
|
|
40
40
|
function isArrayStyleListOptions(object) {
|
|
41
41
|
return (
|
|
42
42
|
Array.isArray(object) &&
|
|
43
43
|
object.every(
|
|
44
|
-
(item) => typeof item === 'object' && item !== null && 'text' in item && 'value' in item
|
|
44
|
+
(item) => typeof item === 'object' && item !== null && 'text' in item && 'value' in item,
|
|
45
45
|
)
|
|
46
|
-
)
|
|
46
|
+
)
|
|
47
47
|
}
|
|
48
48
|
function isObjectStyleListOptions(object) {
|
|
49
|
-
return typeof object === 'object' && object !== null && !Array.isArray(object)
|
|
49
|
+
return typeof object === 'object' && object !== null && !Array.isArray(object)
|
|
50
50
|
}
|
|
51
51
|
function getInternalOptions(options2) {
|
|
52
52
|
return isArrayStyleListOptions(options2)
|
|
@@ -55,26 +55,26 @@
|
|
|
55
55
|
? options2
|
|
56
56
|
: options2.map((value2) => ({
|
|
57
57
|
value: value2,
|
|
58
|
-
text: typeof value2 === 'object' ? JSON.stringify(value2) : String(value2)
|
|
59
|
-
}))
|
|
58
|
+
text: typeof value2 === 'object' ? JSON.stringify(value2) : String(value2),
|
|
59
|
+
}))
|
|
60
60
|
}
|
|
61
61
|
function setValue() {
|
|
62
62
|
if (!shallowEqual(listBlade.value, value)) {
|
|
63
|
-
listBlade.value = value
|
|
63
|
+
listBlade.value = value
|
|
64
64
|
dispatch('change', {
|
|
65
65
|
value: copy(value),
|
|
66
|
-
origin: 'external'
|
|
67
|
-
})
|
|
66
|
+
origin: 'external',
|
|
67
|
+
})
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
$: bladeOptions = {
|
|
71
71
|
value: getInitialValue(),
|
|
72
72
|
label,
|
|
73
73
|
options: getInternalOptions(options),
|
|
74
|
-
view: 'list'
|
|
75
|
-
}
|
|
76
|
-
$: listBlade && addEvent()
|
|
77
|
-
$: value, listBlade && setValue()
|
|
74
|
+
view: 'list',
|
|
75
|
+
}
|
|
76
|
+
$: listBlade && addEvent()
|
|
77
|
+
$: value, listBlade && setValue()
|
|
78
78
|
</script>
|
|
79
79
|
|
|
80
80
|
<Blade bind:ref={listBlade} options={bladeOptions} {...$$restProps} />
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { SvelteComponent } from 'svelte'
|
|
2
|
-
import type { Simplify } from '../utils'
|
|
3
|
-
import type { ValueChangeEvent } from '../utils.js'
|
|
4
|
-
export type ListOptionsArray<T> = T[]
|
|
1
|
+
import { SvelteComponent } from 'svelte'
|
|
2
|
+
import type { Simplify } from '../utils'
|
|
3
|
+
import type { ValueChangeEvent } from '../utils.js'
|
|
4
|
+
export type ListOptionsArray<T> = T[]
|
|
5
5
|
export type ListOptionsObjectArray<T> = Array<{
|
|
6
|
-
value: T
|
|
7
|
-
text: string
|
|
8
|
-
}
|
|
9
|
-
export type ListOptionsRecord<T> = Record<string, T
|
|
6
|
+
value: T
|
|
7
|
+
text: string
|
|
8
|
+
}>
|
|
9
|
+
export type ListOptionsRecord<T> = Record<string, T>
|
|
10
10
|
export type ListOptions<T> = Simplify<
|
|
11
11
|
ListOptionsArray<T> | ListOptionsObjectArray<T> | ListOptionsRecord<T>
|
|
12
|
-
|
|
13
|
-
export type ListChangeEvent = ValueChangeEvent<unknown
|
|
14
|
-
import type { ListBladeApi, ListBladeParams } from 'tweakpane'
|
|
12
|
+
>
|
|
13
|
+
export type ListChangeEvent = ValueChangeEvent<unknown>
|
|
14
|
+
import type { ListBladeApi, ListBladeParams } from 'tweakpane'
|
|
15
15
|
declare class __sveltets_Render<T extends any> {
|
|
16
16
|
props(): {
|
|
17
17
|
/**
|
|
18
18
|
* Value of the selected `options` item.
|
|
19
19
|
* @bindable
|
|
20
20
|
* */
|
|
21
|
-
value: T
|
|
21
|
+
value: T
|
|
22
22
|
/**
|
|
23
23
|
* Text displayed next to list.
|
|
24
24
|
* @default `undefined`
|
|
25
25
|
* */
|
|
26
|
-
label?: string
|
|
26
|
+
label?: string
|
|
27
27
|
/**
|
|
28
28
|
* A collection of options to select from.
|
|
29
29
|
*
|
|
30
30
|
* The arbitrary array list type is a convenience addition to to the vanilla JS Tweakpane
|
|
31
31
|
* API.
|
|
32
32
|
* */
|
|
33
|
-
options: ListOptions<T
|
|
33
|
+
options: ListOptions<T>
|
|
34
34
|
} & Omit<
|
|
35
35
|
{
|
|
36
36
|
/**
|
|
@@ -39,19 +39,19 @@ declare class __sveltets_Render<T extends any> {
|
|
|
39
39
|
* The arbitrary array list type is a convenience addition to to the vanilla JS Tweakpane
|
|
40
40
|
* API.
|
|
41
41
|
*/
|
|
42
|
-
options: ListBladeParams<T
|
|
42
|
+
options: ListBladeParams<T>
|
|
43
43
|
/**
|
|
44
44
|
* Prevent interactivity and gray out the control.
|
|
45
45
|
* @default `false`
|
|
46
46
|
*/
|
|
47
|
-
disabled?: boolean
|
|
47
|
+
disabled?: boolean
|
|
48
48
|
/**
|
|
49
49
|
* Custom color scheme.
|
|
50
50
|
* @default `undefined` \
|
|
51
51
|
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
52
52
|
* set with `setGlobalDefaultTheme()`.
|
|
53
53
|
*/
|
|
54
|
-
theme?: import('..').Theme | undefined
|
|
54
|
+
theme?: import('..').Theme | undefined
|
|
55
55
|
/**
|
|
56
56
|
* Reference to internal Tweakpane
|
|
57
57
|
* [`BladeApi`](https://tweakpane.github.io/docs/api/classes/BladeApi.html) for this blade.
|
|
@@ -64,7 +64,7 @@ declare class __sveltets_Render<T extends any> {
|
|
|
64
64
|
* @bindable
|
|
65
65
|
* @readonly
|
|
66
66
|
*/
|
|
67
|
-
ref?: ListBladeApi<T> | undefined
|
|
67
|
+
ref?: ListBladeApi<T> | undefined
|
|
68
68
|
/**
|
|
69
69
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
70
70
|
* the `<Blade>`'s containing `<Pane>`.
|
|
@@ -76,10 +76,10 @@ declare class __sveltets_Render<T extends any> {
|
|
|
76
76
|
*
|
|
77
77
|
* @default `undefined`
|
|
78
78
|
*/
|
|
79
|
-
plugin?: import('../utils').Plugin | undefined
|
|
79
|
+
plugin?: import('../utils').Plugin | undefined
|
|
80
80
|
},
|
|
81
81
|
'ref' | 'options' | 'plugin'
|
|
82
|
-
|
|
82
|
+
>
|
|
83
83
|
events(): {
|
|
84
84
|
/**
|
|
85
85
|
* Fires when `value` changes.
|
|
@@ -92,13 +92,13 @@ declare class __sveltets_Render<T extends any> {
|
|
|
92
92
|
* @extends ValueChangeEvent
|
|
93
93
|
* @event
|
|
94
94
|
* */
|
|
95
|
-
change: ListChangeEvent
|
|
96
|
-
}
|
|
97
|
-
slots(): {}
|
|
95
|
+
change: ListChangeEvent
|
|
96
|
+
}
|
|
97
|
+
slots(): {}
|
|
98
98
|
}
|
|
99
|
-
export type ListProps<T extends any> = ReturnType<__sveltets_Render<T>['props']
|
|
100
|
-
export type ListEvents<T extends any> = ReturnType<__sveltets_Render<T>['events']
|
|
101
|
-
export type ListSlots<T extends any> = ReturnType<__sveltets_Render<T>['slots']
|
|
99
|
+
export type ListProps<T extends any> = ReturnType<__sveltets_Render<T>['props']>
|
|
100
|
+
export type ListEvents<T extends any> = ReturnType<__sveltets_Render<T>['events']>
|
|
101
|
+
export type ListSlots<T extends any> = ReturnType<__sveltets_Render<T>['slots']>
|
|
102
102
|
/**
|
|
103
103
|
* An option list picker, similar to an HTML `<select>` element.
|
|
104
104
|
*
|
|
@@ -120,14 +120,14 @@ export type ListSlots<T extends any> = ReturnType<__sveltets_Render<T>['slots']>
|
|
|
120
120
|
* @example
|
|
121
121
|
* ```svelte
|
|
122
122
|
* <script lang="ts">
|
|
123
|
-
* import { List, type ListOptions } from 'svelte-tweakpane-ui'
|
|
123
|
+
* import { List, type ListOptions } from 'svelte-tweakpane-ui'
|
|
124
124
|
*
|
|
125
125
|
* const options: ListOptions<number> = {
|
|
126
126
|
* b: 2,
|
|
127
127
|
* a: 1,
|
|
128
|
-
* c: 3
|
|
129
|
-
* }
|
|
130
|
-
* let selection: number = 1
|
|
128
|
+
* c: 3,
|
|
129
|
+
* }
|
|
130
|
+
* let selection: number = 1
|
|
131
131
|
* </script>
|
|
132
132
|
*
|
|
133
133
|
* <List bind:value={selection} label="Alphanumerics" {options} />
|
|
@@ -142,4 +142,4 @@ export default class List<T extends any> extends SvelteComponent<
|
|
|
142
142
|
ListEvents<T>,
|
|
143
143
|
ListSlots<T>
|
|
144
144
|
> {}
|
|
145
|
-
export {}
|
|
145
|
+
export {}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script generics="T extends PointValue2d | PointValue3d | PointValue4d">
|
|
4
|
-
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
-
import GenericInputFolding from '../internal/GenericInputFolding.svelte'
|
|
6
|
-
import { removeKeys } from '../utils'
|
|
7
|
-
import { BROWSER } from 'esm-env'
|
|
8
|
-
import { shallowEqual } from 'fast-equals'
|
|
9
|
-
export let value
|
|
10
|
-
export let expanded = $$props.expanded ?? void 0
|
|
11
|
-
let pointerScale = $$props['pointerScale'] ?? void 0
|
|
12
|
-
let keyScale = $$props['keyScale'] ?? void 0
|
|
13
|
-
let min = $$props['min'] ?? void 0
|
|
14
|
-
let max = $$props['max'] ?? void 0
|
|
15
|
-
let step = $$props['step'] ?? void 0
|
|
16
|
-
let optionsX = $$props['optionsX'] ?? void 0
|
|
17
|
-
let optionsY = $$props['optionsY'] ?? void 0
|
|
18
|
-
let optionsZ = $$props['optionsZ'] ?? void 0
|
|
19
|
-
let optionsW = $$props['optionsW'] ?? void 0
|
|
20
|
-
let format = $$props['format'] ?? void 0
|
|
21
|
-
let internalValue
|
|
22
|
-
let options
|
|
23
|
-
const buttonClass = 'tp-p2dv_b'
|
|
4
|
+
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
+
import GenericInputFolding from '../internal/GenericInputFolding.svelte'
|
|
6
|
+
import { removeKeys } from '../utils'
|
|
7
|
+
import { BROWSER } from 'esm-env'
|
|
8
|
+
import { shallowEqual } from 'fast-equals'
|
|
9
|
+
export let value
|
|
10
|
+
export let expanded = $$props.expanded ?? void 0
|
|
11
|
+
let pointerScale = $$props['pointerScale'] ?? void 0
|
|
12
|
+
let keyScale = $$props['keyScale'] ?? void 0
|
|
13
|
+
let min = $$props['min'] ?? void 0
|
|
14
|
+
let max = $$props['max'] ?? void 0
|
|
15
|
+
let step = $$props['step'] ?? void 0
|
|
16
|
+
let optionsX = $$props['optionsX'] ?? void 0
|
|
17
|
+
let optionsY = $$props['optionsY'] ?? void 0
|
|
18
|
+
let optionsZ = $$props['optionsZ'] ?? void 0
|
|
19
|
+
let optionsW = $$props['optionsW'] ?? void 0
|
|
20
|
+
let format = $$props['format'] ?? void 0
|
|
21
|
+
let internalValue
|
|
22
|
+
let options
|
|
23
|
+
const buttonClass = 'tp-p2dv_b'
|
|
24
24
|
function updateInternalValueFromValue() {
|
|
25
25
|
if (Array.isArray(value)) {
|
|
26
26
|
const newInternalValue =
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
? { x: value[0], y: value[1], z: value[2], w: value[3] }
|
|
29
29
|
: value.length === 3
|
|
30
30
|
? { x: value[0], y: value[1], z: value[2] }
|
|
31
|
-
: { x: value[0], y: value[1] }
|
|
31
|
+
: { x: value[0], y: value[1] }
|
|
32
32
|
if (!shallowEqual(internalValue, newInternalValue)) {
|
|
33
|
-
internalValue = newInternalValue
|
|
33
|
+
internalValue = newInternalValue
|
|
34
34
|
}
|
|
35
35
|
} else if (!shallowEqual(internalValue, value)) {
|
|
36
|
-
internalValue = { ...value }
|
|
36
|
+
internalValue = { ...value }
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
function updateValueFromInternalValue() {
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
? [internalValue.x, internalValue.y, internalValue.z, internalValue.w]
|
|
44
44
|
: 'z' in internalValue
|
|
45
45
|
? [internalValue.x, internalValue.y, internalValue.z]
|
|
46
|
-
: [internalValue.x, internalValue.y]
|
|
46
|
+
: [internalValue.x, internalValue.y]
|
|
47
47
|
if (!shallowEqual(value, newValue)) {
|
|
48
|
-
value = newValue
|
|
48
|
+
value = newValue
|
|
49
49
|
}
|
|
50
50
|
} else if (!shallowEqual(value, internalValue)) {
|
|
51
|
-
value = { ...internalValue }
|
|
51
|
+
value = { ...internalValue }
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
$: value, updateInternalValueFromValue()
|
|
55
|
-
$: internalValue, updateValueFromInternalValue()
|
|
54
|
+
$: value, updateInternalValueFromValue()
|
|
55
|
+
$: internalValue, updateValueFromInternalValue()
|
|
56
56
|
$: options = {
|
|
57
57
|
x: optionsX,
|
|
58
58
|
y: optionsY,
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
format,
|
|
64
64
|
keyScale,
|
|
65
65
|
pointerScale,
|
|
66
|
-
step
|
|
67
|
-
}
|
|
66
|
+
step,
|
|
67
|
+
}
|
|
68
68
|
</script>
|
|
69
69
|
|
|
70
70
|
<GenericInputFolding
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
'optionsX',
|
|
80
80
|
'optionsY',
|
|
81
81
|
'optionsZ',
|
|
82
|
-
'optionsW'
|
|
82
|
+
'optionsW',
|
|
83
83
|
)}
|
|
84
84
|
/>
|
|
85
85
|
{#if !BROWSER && !('z' in internalValue)}
|