svelte-tweakpane-ui 1.5.2 → 1.5.4
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 +105 -120
- package/readme.md +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SvelteComponent } from 'svelte'
|
|
2
|
-
import type { ValueChangeEvent } from '../utils.js'
|
|
3
|
-
export type FileValue = File | undefined
|
|
4
|
-
export type FileChangeEvent = ValueChangeEvent<FileValue
|
|
1
|
+
import { SvelteComponent } from 'svelte'
|
|
2
|
+
import type { ValueChangeEvent } from '../utils.js'
|
|
3
|
+
export type FileValue = File | undefined
|
|
4
|
+
export type FileChangeEvent = ValueChangeEvent<FileValue>
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: {
|
|
7
7
|
/**
|
|
@@ -9,22 +9,22 @@ declare const __propDef: {
|
|
|
9
9
|
* @default `undefined`
|
|
10
10
|
* @bindable
|
|
11
11
|
*/
|
|
12
|
-
value?: FileValue
|
|
12
|
+
value?: FileValue
|
|
13
13
|
/**
|
|
14
14
|
* Array of valid file extensions.
|
|
15
15
|
* @default Any file extension
|
|
16
16
|
*/
|
|
17
|
-
extensions?: string[] | undefined
|
|
17
|
+
extensions?: string[] | undefined
|
|
18
18
|
/**
|
|
19
19
|
* String shown when the user tries to upload an invalid filetype.
|
|
20
20
|
* @default `'Unaccepted file type.'`
|
|
21
21
|
*/
|
|
22
|
-
invalidExtensionMessage?: string | undefined
|
|
22
|
+
invalidExtensionMessage?: string | undefined
|
|
23
23
|
/**
|
|
24
24
|
* Height of the file input drop zone, in rows.
|
|
25
25
|
* @default `3`
|
|
26
26
|
*/
|
|
27
|
-
rows?: number | undefined
|
|
27
|
+
rows?: number | undefined
|
|
28
28
|
} & Omit<
|
|
29
29
|
{
|
|
30
30
|
/**
|
|
@@ -32,26 +32,26 @@ declare const __propDef: {
|
|
|
32
32
|
* @default `undefined`
|
|
33
33
|
* @bindable
|
|
34
34
|
*/
|
|
35
|
-
value: string | File | null
|
|
35
|
+
value: string | File | null
|
|
36
36
|
} & Omit<
|
|
37
37
|
{
|
|
38
38
|
/**
|
|
39
39
|
* The binding's target object with values to manipulate.
|
|
40
40
|
* @bindable
|
|
41
41
|
*/
|
|
42
|
-
object: import('@tweakpane/core').Bindable & Record<string, string | File | null
|
|
42
|
+
object: import('@tweakpane/core').Bindable & Record<string, string | File | null>
|
|
43
43
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
44
|
-
key: string
|
|
44
|
+
key: string
|
|
45
45
|
/**
|
|
46
46
|
* Prevent interactivity and gray out the control.
|
|
47
47
|
* @default `false`
|
|
48
48
|
*/
|
|
49
|
-
disabled?: boolean
|
|
49
|
+
disabled?: boolean
|
|
50
50
|
/**
|
|
51
51
|
* Text displayed next to control.
|
|
52
52
|
* @default `undefined`
|
|
53
53
|
*/
|
|
54
|
-
label?: string | undefined
|
|
54
|
+
label?: string | undefined
|
|
55
55
|
/**
|
|
56
56
|
* Tweakpane's internal options object.
|
|
57
57
|
*
|
|
@@ -64,7 +64,7 @@ declare const __propDef: {
|
|
|
64
64
|
* Tweakpane UI_.
|
|
65
65
|
* @default `undefined`
|
|
66
66
|
*/
|
|
67
|
-
options?: import('@tweakpane/core').BaseInputParams | undefined
|
|
67
|
+
options?: import('@tweakpane/core').BaseInputParams | undefined
|
|
68
68
|
/**
|
|
69
69
|
* Custom color scheme.
|
|
70
70
|
*
|
|
@@ -72,7 +72,7 @@ declare const __propDef: {
|
|
|
72
72
|
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
73
73
|
* set with `setGlobalDefaultTheme()`.
|
|
74
74
|
*/
|
|
75
|
-
theme?: import('..').Theme | undefined
|
|
75
|
+
theme?: import('..').Theme | undefined
|
|
76
76
|
/**
|
|
77
77
|
* Reference to internal Tweakpane
|
|
78
78
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
@@ -86,7 +86,7 @@ declare const __propDef: {
|
|
|
86
86
|
* @bindable
|
|
87
87
|
* @readonly
|
|
88
88
|
*/
|
|
89
|
-
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined
|
|
89
|
+
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined
|
|
90
90
|
/**
|
|
91
91
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
92
92
|
* the `<Binding>`'s containing `<Pane>`.
|
|
@@ -98,13 +98,13 @@ declare const __propDef: {
|
|
|
98
98
|
*
|
|
99
99
|
* @default `undefined`
|
|
100
100
|
*/
|
|
101
|
-
plugin?: import('../utils.js').Plugin | undefined
|
|
101
|
+
plugin?: import('../utils.js').Plugin | undefined
|
|
102
102
|
},
|
|
103
103
|
'object' | 'key'
|
|
104
104
|
>,
|
|
105
105
|
'ref' | 'plugin' | 'value'
|
|
106
|
-
|
|
107
|
-
slots: {}
|
|
106
|
+
>
|
|
107
|
+
slots: {}
|
|
108
108
|
events: {
|
|
109
109
|
/**
|
|
110
110
|
* Fires when `value` changes.
|
|
@@ -117,12 +117,12 @@ declare const __propDef: {
|
|
|
117
117
|
* @extends ValueChangeEvent
|
|
118
118
|
* @event
|
|
119
119
|
* */
|
|
120
|
-
change: FileChangeEvent
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
export type FileProps = typeof __propDef.props
|
|
124
|
-
export type FileEvents = typeof __propDef.events
|
|
125
|
-
export type FileSlots = typeof __propDef.slots
|
|
120
|
+
change: FileChangeEvent
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export type FileProps = typeof __propDef.props
|
|
124
|
+
export type FileEvents = typeof __propDef.events
|
|
125
|
+
export type FileSlots = typeof __propDef.slots
|
|
126
126
|
/**
|
|
127
127
|
* A file input control.
|
|
128
128
|
*
|
|
@@ -144,26 +144,26 @@ export type FileSlots = typeof __propDef.slots;
|
|
|
144
144
|
* @example
|
|
145
145
|
* ```svelte
|
|
146
146
|
* <script lang="ts">
|
|
147
|
-
* import { File, type FileValue } from '..'
|
|
147
|
+
* import { File, type FileValue } from '..'
|
|
148
148
|
*
|
|
149
|
-
* let file: FileValue
|
|
149
|
+
* let file: FileValue
|
|
150
150
|
*
|
|
151
151
|
* async function getFileBase64(file: FileValue): Promise<string> {
|
|
152
|
-
* if (file === undefined) return 'Your bytes here...'
|
|
152
|
+
* if (file === undefined) return 'Your bytes here...'
|
|
153
153
|
* return new Promise((resolve, reject) => {
|
|
154
|
-
* const reader = new FileReader()
|
|
154
|
+
* const reader = new FileReader()
|
|
155
155
|
* reader.addEventListener('load', () => {
|
|
156
|
-
* const { result } = reader
|
|
157
|
-
* if (result && typeof result === 'string') resolve(result)
|
|
158
|
-
* else reject(new Error('Empty result'))
|
|
159
|
-
* })
|
|
160
|
-
* reader.addEventListener('error', reject)
|
|
161
|
-
* reader.readAsDataURL(file)
|
|
162
|
-
* })
|
|
156
|
+
* const { result } = reader
|
|
157
|
+
* if (result && typeof result === 'string') resolve(result)
|
|
158
|
+
* else reject(new Error('Empty result'))
|
|
159
|
+
* })
|
|
160
|
+
* reader.addEventListener('error', reject)
|
|
161
|
+
* reader.readAsDataURL(file)
|
|
162
|
+
* })
|
|
163
163
|
* }
|
|
164
164
|
*
|
|
165
165
|
* function truncate(text: string, length: number) {
|
|
166
|
-
* return text.length > length ? text.slice(0, length - 1) + '...' : text
|
|
166
|
+
* return text.length > length ? text.slice(0, length - 1) + '...' : text
|
|
167
167
|
* }
|
|
168
168
|
* </script>
|
|
169
169
|
*
|
|
@@ -201,4 +201,4 @@ export type FileSlots = typeof __propDef.slots;
|
|
|
201
201
|
* [File.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/control/File.svelte)
|
|
202
202
|
*/
|
|
203
203
|
export default class File extends SvelteComponent<FileProps, FileEvents, FileSlots> {}
|
|
204
|
-
export {}
|
|
204
|
+
export {}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
|
-
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
-
import GenericInput from '../internal/GenericInput.svelte'
|
|
6
|
-
import { fillWith } from '../utils'
|
|
7
|
-
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-image'
|
|
8
|
-
import { BROWSER } from 'esm-env'
|
|
9
|
-
import { shallowEqual } from 'fast-equals'
|
|
10
|
-
export let value = void 0
|
|
11
|
-
export let fit = void 0
|
|
12
|
-
export let extensions = void 0
|
|
13
|
-
let internalValue = 'placeholder'
|
|
4
|
+
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
+
import GenericInput from '../internal/GenericInput.svelte'
|
|
6
|
+
import { fillWith } from '../utils'
|
|
7
|
+
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-image'
|
|
8
|
+
import { BROWSER } from 'esm-env'
|
|
9
|
+
import { shallowEqual } from 'fast-equals'
|
|
10
|
+
export let value = void 0
|
|
11
|
+
export let fit = void 0
|
|
12
|
+
export let extensions = void 0
|
|
13
|
+
let internalValue = 'placeholder'
|
|
14
14
|
function updateInternalValueFromValue() {
|
|
15
|
-
const newInternalValue = value ?? 'placeholder'
|
|
15
|
+
const newInternalValue = value ?? 'placeholder'
|
|
16
16
|
if (!shallowEqual(internalValue, newInternalValue)) {
|
|
17
|
-
internalValue = newInternalValue
|
|
17
|
+
internalValue = newInternalValue
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
function updateValueFromInternalValue() {
|
|
21
21
|
if (internalValue === 'placeholder') {
|
|
22
22
|
if (value !== void 0) {
|
|
23
|
-
value = void 0
|
|
23
|
+
value = void 0
|
|
24
24
|
}
|
|
25
25
|
} else if (internalValue instanceof HTMLImageElement) {
|
|
26
26
|
if (value !== internalValue.src) {
|
|
27
|
-
value = internalValue.src
|
|
27
|
+
value = internalValue.src
|
|
28
28
|
}
|
|
29
29
|
} else if (internalValue instanceof File) {
|
|
30
|
-
console.warn('Image control does not support File objects.')
|
|
30
|
+
console.warn('Image control does not support File objects.')
|
|
31
31
|
if (value !== void 0) {
|
|
32
|
-
value = void 0
|
|
32
|
+
value = void 0
|
|
33
33
|
}
|
|
34
34
|
} else if (value !== internalValue) {
|
|
35
|
-
value = internalValue
|
|
35
|
+
value = internalValue
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
let options
|
|
38
|
+
let options
|
|
39
39
|
$: options = {
|
|
40
40
|
extensions,
|
|
41
41
|
imageFit: fit,
|
|
42
|
-
view: 'input-image'
|
|
43
|
-
}
|
|
44
|
-
$: value, updateInternalValueFromValue()
|
|
45
|
-
$: internalValue, updateValueFromInternalValue()
|
|
42
|
+
view: 'input-image',
|
|
43
|
+
}
|
|
44
|
+
$: value, updateInternalValueFromValue()
|
|
45
|
+
$: internalValue, updateValueFromInternalValue()
|
|
46
46
|
</script>
|
|
47
47
|
|
|
48
48
|
<GenericInput
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SvelteComponent } from 'svelte'
|
|
2
|
-
import type { ValueChangeEvent } from '../utils.js'
|
|
3
|
-
export type ImageValue = string | undefined
|
|
4
|
-
export type ImageChangeEvent = ValueChangeEvent<ImageValue
|
|
1
|
+
import { SvelteComponent } from 'svelte'
|
|
2
|
+
import type { ValueChangeEvent } from '../utils.js'
|
|
3
|
+
export type ImageValue = string | undefined
|
|
4
|
+
export type ImageChangeEvent = ValueChangeEvent<ImageValue>
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: {
|
|
7
7
|
/**
|
|
@@ -9,19 +9,19 @@ declare const __propDef: {
|
|
|
9
9
|
* @default `'undefined'`
|
|
10
10
|
* @bindable
|
|
11
11
|
*/
|
|
12
|
-
value?: ImageValue
|
|
12
|
+
value?: ImageValue
|
|
13
13
|
/**
|
|
14
14
|
* Array of image extension types to accept.
|
|
15
15
|
* @default `['.jpg', '.png', '.gif']`
|
|
16
16
|
*/
|
|
17
|
-
extensions?: string[]
|
|
17
|
+
extensions?: string[]
|
|
18
18
|
/**
|
|
19
19
|
* How to display the image in the preview pane.
|
|
20
20
|
*
|
|
21
21
|
* Renamed from `imageFit` in `tweakpane-image-plugin` for concision.
|
|
22
22
|
* @default `'cover'`
|
|
23
23
|
*/
|
|
24
|
-
fit?: 'contain' | 'cover'
|
|
24
|
+
fit?: 'contain' | 'cover'
|
|
25
25
|
} & Omit<
|
|
26
26
|
{
|
|
27
27
|
/**
|
|
@@ -29,7 +29,7 @@ declare const __propDef: {
|
|
|
29
29
|
* @default `'undefined'`
|
|
30
30
|
* @bindable
|
|
31
31
|
*/
|
|
32
|
-
value: string | HTMLImageElement | File | undefined
|
|
32
|
+
value: string | HTMLImageElement | File | undefined
|
|
33
33
|
} & Omit<
|
|
34
34
|
{
|
|
35
35
|
/**
|
|
@@ -37,19 +37,19 @@ declare const __propDef: {
|
|
|
37
37
|
* @bindable
|
|
38
38
|
*/
|
|
39
39
|
object: import('@tweakpane/core').Bindable &
|
|
40
|
-
Record<string, string | HTMLImageElement | File | undefined
|
|
40
|
+
Record<string, string | HTMLImageElement | File | undefined>
|
|
41
41
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
42
|
-
key: string
|
|
42
|
+
key: string
|
|
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
|
* Text displayed next to control.
|
|
50
50
|
* @default `undefined`
|
|
51
51
|
*/
|
|
52
|
-
label?: string | undefined
|
|
52
|
+
label?: string | undefined
|
|
53
53
|
/**
|
|
54
54
|
* Tweakpane's internal options object.
|
|
55
55
|
*
|
|
@@ -62,7 +62,7 @@ declare const __propDef: {
|
|
|
62
62
|
* Tweakpane UI_.
|
|
63
63
|
* @default `undefined`
|
|
64
64
|
*/
|
|
65
|
-
options?: import('@tweakpane/core').BaseInputParams | undefined
|
|
65
|
+
options?: import('@tweakpane/core').BaseInputParams | undefined
|
|
66
66
|
/**
|
|
67
67
|
* Custom color scheme.
|
|
68
68
|
*
|
|
@@ -70,7 +70,7 @@ declare const __propDef: {
|
|
|
70
70
|
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
71
71
|
* set with `setGlobalDefaultTheme()`.
|
|
72
72
|
*/
|
|
73
|
-
theme?: import('..').Theme | undefined
|
|
73
|
+
theme?: import('..').Theme | undefined
|
|
74
74
|
/**
|
|
75
75
|
* Reference to internal Tweakpane
|
|
76
76
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
@@ -84,7 +84,7 @@ declare const __propDef: {
|
|
|
84
84
|
* @bindable
|
|
85
85
|
* @readonly
|
|
86
86
|
*/
|
|
87
|
-
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined
|
|
87
|
+
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined
|
|
88
88
|
/**
|
|
89
89
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
90
90
|
* the `<Binding>`'s containing `<Pane>`.
|
|
@@ -96,13 +96,13 @@ declare const __propDef: {
|
|
|
96
96
|
*
|
|
97
97
|
* @default `undefined`
|
|
98
98
|
*/
|
|
99
|
-
plugin?: import('../utils.js').Plugin | undefined
|
|
99
|
+
plugin?: import('../utils.js').Plugin | undefined
|
|
100
100
|
},
|
|
101
101
|
'object' | 'key'
|
|
102
102
|
>,
|
|
103
103
|
'ref' | 'plugin' | 'value'
|
|
104
|
-
|
|
105
|
-
slots: {}
|
|
104
|
+
>
|
|
105
|
+
slots: {}
|
|
106
106
|
events: {
|
|
107
107
|
/**
|
|
108
108
|
* Fires when `value` changes.
|
|
@@ -115,12 +115,12 @@ declare const __propDef: {
|
|
|
115
115
|
* @extends ValueChangeEvent
|
|
116
116
|
* @event
|
|
117
117
|
* */
|
|
118
|
-
change: ImageChangeEvent
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
export type ImageProps = typeof __propDef.props
|
|
122
|
-
export type ImageEvents = typeof __propDef.events
|
|
123
|
-
export type ImageSlots = typeof __propDef.slots
|
|
118
|
+
change: ImageChangeEvent
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export type ImageProps = typeof __propDef.props
|
|
122
|
+
export type ImageEvents = typeof __propDef.events
|
|
123
|
+
export type ImageSlots = typeof __propDef.slots
|
|
124
124
|
/**
|
|
125
125
|
* An image input control.
|
|
126
126
|
*
|
|
@@ -145,23 +145,23 @@ export type ImageSlots = typeof __propDef.slots;
|
|
|
145
145
|
* @example
|
|
146
146
|
* ```svelte
|
|
147
147
|
* <script lang="ts">
|
|
148
|
-
* import { Button, Image, type ImageValue } from '..'
|
|
148
|
+
* import { Button, Image, type ImageValue } from '..'
|
|
149
149
|
*
|
|
150
|
-
* let source: ImageValue
|
|
150
|
+
* let source: ImageValue
|
|
151
151
|
*
|
|
152
152
|
* async function getRandomKittenUrl() {
|
|
153
153
|
* const { url } = await fetch('https://loremflickr.com/800/800/kitten', {
|
|
154
154
|
* method: 'HEAD',
|
|
155
|
-
* redirect: 'follow'
|
|
156
|
-
* })
|
|
157
|
-
* return url
|
|
155
|
+
* redirect: 'follow',
|
|
156
|
+
* })
|
|
157
|
+
* return url
|
|
158
158
|
* }
|
|
159
159
|
* </script>
|
|
160
160
|
*
|
|
161
161
|
* <Image bind:value={source} fit="contain" label="Image" />
|
|
162
162
|
* <Button
|
|
163
163
|
* on:click={async () => {
|
|
164
|
-
* source = await getRandomKittenUrl()
|
|
164
|
+
* source = await getRandomKittenUrl()
|
|
165
165
|
* }}
|
|
166
166
|
* label="Random Placeholder"
|
|
167
167
|
* title="Load Kitten"
|
|
@@ -202,4 +202,4 @@ export type ImageSlots = typeof __propDef.slots;
|
|
|
202
202
|
* [Image.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/control/Image.svelte)
|
|
203
203
|
*/
|
|
204
204
|
export default class Image extends SvelteComponent<ImageProps, ImageEvents, ImageSlots> {}
|
|
205
|
-
export {}
|
|
205
|
+
export {}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
|
-
import GenericSlider from '../internal/GenericSlider.svelte'
|
|
5
|
-
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-essentials'
|
|
6
|
-
import { shallowEqual } from 'fast-equals'
|
|
7
|
-
export let value
|
|
8
|
-
export let meanValue = void 0
|
|
9
|
-
export let wide = void 0
|
|
10
|
-
let internalValue
|
|
4
|
+
import GenericSlider from '../internal/GenericSlider.svelte'
|
|
5
|
+
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-essentials'
|
|
6
|
+
import { shallowEqual } from 'fast-equals'
|
|
7
|
+
export let value
|
|
8
|
+
export let meanValue = void 0
|
|
9
|
+
export let wide = void 0
|
|
10
|
+
let internalValue
|
|
11
11
|
function updateInternalValueFromValue() {
|
|
12
|
-
const newInternalValue = Array.isArray(value) ? { min: value[0], max: value[1] } : value
|
|
12
|
+
const newInternalValue = Array.isArray(value) ? { min: value[0], max: value[1] } : value
|
|
13
13
|
if (!shallowEqual(internalValue, newInternalValue)) {
|
|
14
|
-
internalValue = { ...newInternalValue }
|
|
14
|
+
internalValue = { ...newInternalValue }
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
function updateValueFromInternalValue() {
|
|
18
18
|
if (Array.isArray(value)) {
|
|
19
|
-
const newValue = [internalValue.min, internalValue.max]
|
|
19
|
+
const newValue = [internalValue.min, internalValue.max]
|
|
20
20
|
if (!shallowEqual(value, newValue)) {
|
|
21
|
-
value = newValue
|
|
21
|
+
value = newValue
|
|
22
22
|
}
|
|
23
23
|
} else if (!shallowEqual(value, internalValue)) {
|
|
24
|
-
value = { ...internalValue }
|
|
24
|
+
value = { ...internalValue }
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
function updateValueFromMean() {
|
|
28
28
|
if (meanValue !== void 0) {
|
|
29
|
-
const r = internalValue.max - internalValue.min
|
|
30
|
-
const valueFromMean = { min: meanValue - r / 2, max: meanValue + r / 2 }
|
|
29
|
+
const r = internalValue.max - internalValue.min
|
|
30
|
+
const valueFromMean = { min: meanValue - r / 2, max: meanValue + r / 2 }
|
|
31
31
|
if (!shallowEqual(valueFromMean, internalValue)) {
|
|
32
|
-
internalValue = valueFromMean
|
|
32
|
+
internalValue = valueFromMean
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
let ref
|
|
36
|
+
let ref
|
|
37
37
|
function updateWide(wide2) {
|
|
38
|
-
const inputField = ref?.element.querySelector('div.tp-rsltxtv_t')
|
|
38
|
+
const inputField = ref?.element.querySelector('div.tp-rsltxtv_t')
|
|
39
39
|
if (wide2) {
|
|
40
|
-
inputField?.style.setProperty('display', 'none')
|
|
40
|
+
inputField?.style.setProperty('display', 'none')
|
|
41
41
|
} else {
|
|
42
|
-
inputField?.style.removeProperty('display')
|
|
42
|
+
inputField?.style.removeProperty('display')
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
$: ref && wide !== void 0 && updateWide(wide)
|
|
46
|
-
$: value, updateInternalValueFromValue()
|
|
47
|
-
$: internalValue, updateValueFromInternalValue()
|
|
48
|
-
$: meanValue = (internalValue.min + internalValue.max) / 2
|
|
49
|
-
$: meanValue, updateValueFromMean()
|
|
45
|
+
$: ref && wide !== void 0 && updateWide(wide)
|
|
46
|
+
$: value, updateInternalValueFromValue()
|
|
47
|
+
$: internalValue, updateValueFromInternalValue()
|
|
48
|
+
$: meanValue = (internalValue.min + internalValue.max) / 2
|
|
49
|
+
$: meanValue, updateValueFromMean()
|
|
50
50
|
</script>
|
|
51
51
|
|
|
52
52
|
<GenericSlider
|