svelte-tweakpane-ui 1.5.3 → 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 +100 -115
- package/readme.md +1 -1
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
|
-
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
-
import InternalPaneInline from '../internal/InternalPaneInline.svelte'
|
|
6
|
-
import { getElementIndex, isRootPane } from '../utils.js'
|
|
7
|
-
import { BROWSER } from 'esm-env'
|
|
8
|
-
import { createEventDispatcher, getContext, onDestroy, onMount } from 'svelte'
|
|
9
|
-
export let title = 'Button'
|
|
10
|
-
export let label = void 0
|
|
11
|
-
export let disabled = false
|
|
12
|
-
export let theme = void 0
|
|
13
|
-
const parentStore = getContext('parentStore')
|
|
14
|
-
const userCreatedPane = getContext('userCreatedPane')
|
|
15
|
-
const dispatch = createEventDispatcher()
|
|
16
|
-
let indexElement
|
|
17
|
-
let button
|
|
18
|
-
let index
|
|
4
|
+
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
+
import InternalPaneInline from '../internal/InternalPaneInline.svelte'
|
|
6
|
+
import { getElementIndex, isRootPane } from '../utils.js'
|
|
7
|
+
import { BROWSER } from 'esm-env'
|
|
8
|
+
import { createEventDispatcher, getContext, onDestroy, onMount } from 'svelte'
|
|
9
|
+
export let title = 'Button'
|
|
10
|
+
export let label = void 0
|
|
11
|
+
export let disabled = false
|
|
12
|
+
export let theme = void 0
|
|
13
|
+
const parentStore = getContext('parentStore')
|
|
14
|
+
const userCreatedPane = getContext('userCreatedPane')
|
|
15
|
+
const dispatch = createEventDispatcher()
|
|
16
|
+
let indexElement
|
|
17
|
+
let button
|
|
18
|
+
let index
|
|
19
19
|
function create() {
|
|
20
|
-
if (button) button.dispose()
|
|
20
|
+
if (button) button.dispose()
|
|
21
21
|
button = $parentStore.addButton({
|
|
22
22
|
disabled,
|
|
23
23
|
index,
|
|
24
24
|
label,
|
|
25
|
-
title
|
|
26
|
-
})
|
|
25
|
+
title,
|
|
26
|
+
})
|
|
27
27
|
button.on('click', () => {
|
|
28
|
-
dispatch('click')
|
|
29
|
-
})
|
|
28
|
+
dispatch('click')
|
|
29
|
+
})
|
|
30
30
|
}
|
|
31
31
|
onMount(() => {
|
|
32
|
-
index = indexElement ? getElementIndex(indexElement) : 0
|
|
33
|
-
})
|
|
32
|
+
index = indexElement ? getElementIndex(indexElement) : 0
|
|
33
|
+
})
|
|
34
34
|
onDestroy(() => {
|
|
35
|
-
button?.dispose()
|
|
36
|
-
})
|
|
37
|
-
$: index !== void 0 && $parentStore && !button && create()
|
|
38
|
-
$: button && (button.title = title)
|
|
39
|
-
$: button && (button.label = label)
|
|
40
|
-
$: button && (button.disabled = disabled)
|
|
35
|
+
button?.dispose()
|
|
36
|
+
})
|
|
37
|
+
$: index !== void 0 && $parentStore && !button && create()
|
|
38
|
+
$: button && (button.title = title)
|
|
39
|
+
$: button && (button.label = label)
|
|
40
|
+
$: button && (button.disabled = disabled)
|
|
41
41
|
$: theme &&
|
|
42
42
|
$parentStore &&
|
|
43
43
|
(userCreatedPane || !isRootPane($parentStore)) &&
|
|
44
44
|
console.warn(
|
|
45
|
-
'Set theme on the <Pane> component, not on its children! (Check nested <Button> components for a theme prop.)'
|
|
46
|
-
)
|
|
45
|
+
'Set theme on the <Pane> component, not on its children! (Check nested <Button> components for a theme prop.)',
|
|
46
|
+
)
|
|
47
47
|
</script>
|
|
48
48
|
|
|
49
49
|
{#if parentStore}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { SvelteComponent } from 'svelte'
|
|
2
|
-
export type ButtonClickEvent = CustomEvent<null
|
|
3
|
-
import type { Theme } from '../theme.js'
|
|
1
|
+
import { SvelteComponent } from 'svelte'
|
|
2
|
+
export type ButtonClickEvent = CustomEvent<null>
|
|
3
|
+
import type { Theme } from '../theme.js'
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
/**
|
|
7
7
|
* Text inside of the button.
|
|
8
8
|
* @default `'Button'`
|
|
9
|
-
* */ title?: string
|
|
9
|
+
* */ title?: string
|
|
10
10
|
/**
|
|
11
11
|
* Text displayed next to the button.
|
|
12
12
|
* @default `undefined`
|
|
13
|
-
* */ label?: string | undefined
|
|
13
|
+
* */ label?: string | undefined
|
|
14
14
|
/**
|
|
15
15
|
* Prevent interactivity and gray out the control.
|
|
16
16
|
* @default `false`
|
|
17
|
-
* */ disabled?: boolean
|
|
17
|
+
* */ disabled?: boolean
|
|
18
18
|
/**
|
|
19
19
|
* Custom color scheme.
|
|
20
20
|
* @default `undefined` \
|
|
21
21
|
* Inherits default Tweakpane theme equivalent to
|
|
22
22
|
* `ThemeUtils.presets.standard`, or the theme set with
|
|
23
23
|
* `setGlobalDefaultTheme()`.)
|
|
24
|
-
* */ theme?: Theme | undefined
|
|
25
|
-
}
|
|
26
|
-
slots: {}
|
|
24
|
+
* */ theme?: Theme | undefined
|
|
25
|
+
}
|
|
26
|
+
slots: {}
|
|
27
27
|
events: {
|
|
28
28
|
/**
|
|
29
29
|
* Fires when the button is clicked.
|
|
30
30
|
* @event
|
|
31
31
|
* */
|
|
32
|
-
click: ButtonClickEvent
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export type ButtonProps = typeof __propDef.props
|
|
36
|
-
export type ButtonEvents = typeof __propDef.events
|
|
37
|
-
export type ButtonSlots = typeof __propDef.slots
|
|
32
|
+
click: ButtonClickEvent
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export type ButtonProps = typeof __propDef.props
|
|
36
|
+
export type ButtonEvents = typeof __propDef.events
|
|
37
|
+
export type ButtonSlots = typeof __propDef.slots
|
|
38
38
|
/**
|
|
39
39
|
* A humble but effective push button.
|
|
40
40
|
*
|
|
@@ -50,9 +50,9 @@ export type ButtonSlots = typeof __propDef.slots;
|
|
|
50
50
|
* @example
|
|
51
51
|
* ```svelte
|
|
52
52
|
* <script lang="ts">
|
|
53
|
-
* import { Button } from 'svelte-tweakpane-ui'
|
|
53
|
+
* import { Button } from 'svelte-tweakpane-ui'
|
|
54
54
|
*
|
|
55
|
-
* let count = 0
|
|
55
|
+
* let count = 0
|
|
56
56
|
* </script>
|
|
57
57
|
*
|
|
58
58
|
* <Button on:click={() => count++} label="Count" title="Increment" />
|
|
@@ -63,4 +63,4 @@ export type ButtonSlots = typeof __propDef.slots;
|
|
|
63
63
|
* [Button.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/control/Button.svelte)
|
|
64
64
|
*/
|
|
65
65
|
export default class Button extends SvelteComponent<ButtonProps, ButtonEvents, ButtonSlots> {}
|
|
66
|
-
export {}
|
|
66
|
+
export {}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
|
-
import Blade from '../core/Blade.svelte'
|
|
5
|
-
import ClsPad from '../internal/ClsPad.svelte'
|
|
6
|
-
import { fillWith } from '../utils'
|
|
7
|
-
import { getGridDimensions } from '../utils.js'
|
|
8
|
-
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-essentials'
|
|
9
|
-
import { BROWSER } from 'esm-env'
|
|
10
|
-
import { createEventDispatcher } from 'svelte'
|
|
11
|
-
export let columns = void 0
|
|
12
|
-
export let rows = void 0
|
|
13
|
-
export let buttons = []
|
|
14
|
-
export let label = void 0
|
|
15
|
-
const dispatch = createEventDispatcher()
|
|
16
|
-
let options
|
|
17
|
-
let gridBlade
|
|
18
|
-
let gridDimensions
|
|
4
|
+
import Blade from '../core/Blade.svelte'
|
|
5
|
+
import ClsPad from '../internal/ClsPad.svelte'
|
|
6
|
+
import { fillWith } from '../utils'
|
|
7
|
+
import { getGridDimensions } from '../utils.js'
|
|
8
|
+
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-essentials'
|
|
9
|
+
import { BROWSER } from 'esm-env'
|
|
10
|
+
import { createEventDispatcher } from 'svelte'
|
|
11
|
+
export let columns = void 0
|
|
12
|
+
export let rows = void 0
|
|
13
|
+
export let buttons = []
|
|
14
|
+
export let label = void 0
|
|
15
|
+
const dispatch = createEventDispatcher()
|
|
16
|
+
let options
|
|
17
|
+
let gridBlade
|
|
18
|
+
let gridDimensions
|
|
19
19
|
function cells(x, y) {
|
|
20
|
-
const index = y * gridDimensions.columns + x
|
|
20
|
+
const index = y * gridDimensions.columns + x
|
|
21
21
|
if (index >= 0 && index < buttons.length) {
|
|
22
22
|
return {
|
|
23
|
-
title: `${buttons[index]}
|
|
24
|
-
}
|
|
23
|
+
title: `${buttons[index]}`,
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
|
-
return { title: '' }
|
|
26
|
+
return { title: '' }
|
|
27
27
|
}
|
|
28
|
-
$: gridDimensions = getGridDimensions(buttons.length, columns, rows)
|
|
28
|
+
$: gridDimensions = getGridDimensions(buttons.length, columns, rows)
|
|
29
29
|
$: options = {
|
|
30
30
|
cells,
|
|
31
31
|
label,
|
|
32
32
|
size: [gridDimensions.columns, gridDimensions.rows],
|
|
33
|
-
view: 'buttongrid'
|
|
34
|
-
}
|
|
33
|
+
view: 'buttongrid',
|
|
34
|
+
}
|
|
35
35
|
$: gridBlade?.on('click', (event) => {
|
|
36
36
|
dispatch('click', {
|
|
37
37
|
cell: { x: event.index[0], y: event.index[1] },
|
|
38
38
|
index: event.index[1] * gridDimensions.columns + event.index[0],
|
|
39
|
-
label: event.cell.title
|
|
40
|
-
})
|
|
41
|
-
})
|
|
39
|
+
label: event.cell.title,
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
<Blade bind:ref={gridBlade} {options} plugin={pluginModule} {...$$restProps} />
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { SvelteComponent } from 'svelte'
|
|
1
|
+
import { SvelteComponent } from 'svelte'
|
|
2
2
|
export type ButtonGridClickEvent = CustomEvent<{
|
|
3
3
|
cell: {
|
|
4
|
-
x: number
|
|
5
|
-
y: number
|
|
6
|
-
}
|
|
7
|
-
index: number
|
|
8
|
-
label: string
|
|
9
|
-
}
|
|
10
|
-
import type { ButtonGridApi as ButtonGridRef } from '@kitschpatrol/tweakpane-plugin-essentials'
|
|
11
|
-
import type { ButtonGridBladeParams as ButtonGridOptions } from '@kitschpatrol/tweakpane-plugin-essentials/dist/types/button-grid/plugin.d.ts'
|
|
4
|
+
x: number
|
|
5
|
+
y: number
|
|
6
|
+
}
|
|
7
|
+
index: number
|
|
8
|
+
label: string
|
|
9
|
+
}>
|
|
10
|
+
import type { ButtonGridApi as ButtonGridRef } from '@kitschpatrol/tweakpane-plugin-essentials'
|
|
11
|
+
import type { ButtonGridBladeParams as ButtonGridOptions } from '@kitschpatrol/tweakpane-plugin-essentials/dist/types/button-grid/plugin.d.ts'
|
|
12
12
|
declare const __propDef: {
|
|
13
13
|
props: {
|
|
14
14
|
/**
|
|
15
15
|
* Array of names, each of which will become the title of a button in the grid.
|
|
16
16
|
* */
|
|
17
|
-
buttons: string[]
|
|
17
|
+
buttons: string[]
|
|
18
18
|
/**
|
|
19
19
|
* Number of columns to arrange the buttons into.
|
|
20
20
|
*
|
|
@@ -23,12 +23,12 @@ declare const __propDef: {
|
|
|
23
23
|
* @default `undefined` \
|
|
24
24
|
* Dynamic based on quantity of `buttons`.
|
|
25
25
|
* */
|
|
26
|
-
columns?: number
|
|
26
|
+
columns?: number
|
|
27
27
|
/**
|
|
28
28
|
* Text displayed next to the button grid.
|
|
29
29
|
* @default `undefined`
|
|
30
30
|
*/
|
|
31
|
-
label?: string
|
|
31
|
+
label?: string
|
|
32
32
|
/**
|
|
33
33
|
* Number of rows to arrange the buttons into.
|
|
34
34
|
*
|
|
@@ -37,7 +37,7 @@ declare const __propDef: {
|
|
|
37
37
|
* @default `undefined` \
|
|
38
38
|
* Dynamic based on quantity of `buttons`.
|
|
39
39
|
* */
|
|
40
|
-
rows?: number
|
|
40
|
+
rows?: number
|
|
41
41
|
} & Omit<
|
|
42
42
|
{
|
|
43
43
|
/**
|
|
@@ -45,19 +45,19 @@ declare const __propDef: {
|
|
|
45
45
|
* [`BladeParams`](https://tweakpane.github.io/docs/api/interfaces/BaseBladeParams.html).
|
|
46
46
|
*
|
|
47
47
|
*/
|
|
48
|
-
options: ButtonGridOptions
|
|
48
|
+
options: ButtonGridOptions
|
|
49
49
|
/**
|
|
50
50
|
* Prevent interactivity and gray out the control.
|
|
51
51
|
* @default `false`
|
|
52
52
|
*/
|
|
53
|
-
disabled?: boolean
|
|
53
|
+
disabled?: boolean
|
|
54
54
|
/**
|
|
55
55
|
* Custom color scheme.
|
|
56
56
|
* @default `undefined` \
|
|
57
57
|
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
58
58
|
* set with `setGlobalDefaultTheme()`.
|
|
59
59
|
*/
|
|
60
|
-
theme?: import('..').Theme | undefined
|
|
60
|
+
theme?: import('..').Theme | undefined
|
|
61
61
|
/**
|
|
62
62
|
* Reference to internal Tweakpane
|
|
63
63
|
* [`BladeApi`](https://tweakpane.github.io/docs/api/classes/BladeApi.html) for this blade.
|
|
@@ -70,7 +70,7 @@ declare const __propDef: {
|
|
|
70
70
|
* @bindable
|
|
71
71
|
* @readonly
|
|
72
72
|
*/
|
|
73
|
-
ref?: ButtonGridRef | undefined
|
|
73
|
+
ref?: ButtonGridRef | undefined
|
|
74
74
|
/**
|
|
75
75
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
76
76
|
* the `<Blade>`'s containing `<Pane>`.
|
|
@@ -82,11 +82,11 @@ declare const __propDef: {
|
|
|
82
82
|
*
|
|
83
83
|
* @default `undefined`
|
|
84
84
|
*/
|
|
85
|
-
plugin?: import('../utils').Plugin | undefined
|
|
85
|
+
plugin?: import('../utils').Plugin | undefined
|
|
86
86
|
},
|
|
87
87
|
'ref' | 'options' | 'plugin'
|
|
88
|
-
|
|
89
|
-
slots: {}
|
|
88
|
+
>
|
|
89
|
+
slots: {}
|
|
90
90
|
events: {
|
|
91
91
|
/**
|
|
92
92
|
* Fires when a button is clicked.
|
|
@@ -95,12 +95,12 @@ declare const __propDef: {
|
|
|
95
95
|
* `event.detail` parameter.
|
|
96
96
|
* @event
|
|
97
97
|
* */
|
|
98
|
-
click: ButtonGridClickEvent
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
export type ButtonGridProps = typeof __propDef.props
|
|
102
|
-
export type ButtonGridEvents = typeof __propDef.events
|
|
103
|
-
export type ButtonGridSlots = typeof __propDef.slots
|
|
98
|
+
click: ButtonGridClickEvent
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export type ButtonGridProps = typeof __propDef.props
|
|
102
|
+
export type ButtonGridEvents = typeof __propDef.events
|
|
103
|
+
export type ButtonGridSlots = typeof __propDef.slots
|
|
104
104
|
/**
|
|
105
105
|
* A grid of `<Button>` components.
|
|
106
106
|
*
|
|
@@ -132,29 +132,29 @@ export type ButtonGridSlots = typeof __propDef.slots;
|
|
|
132
132
|
* Button,
|
|
133
133
|
* ButtonGrid,
|
|
134
134
|
* type ButtonGridClickEvent,
|
|
135
|
-
* Pane
|
|
136
|
-
* } from 'svelte-tweakpane-ui'
|
|
135
|
+
* Pane,
|
|
136
|
+
* } from 'svelte-tweakpane-ui'
|
|
137
137
|
*
|
|
138
138
|
* const keyboard = [
|
|
139
139
|
* ...Array.from(
|
|
140
140
|
* {
|
|
141
|
-
* length: 26
|
|
141
|
+
* length: 26,
|
|
142
142
|
* },
|
|
143
|
-
* (_, index) => String.fromCodePoint(65 + index)
|
|
143
|
+
* (_, index) => String.fromCodePoint(65 + index),
|
|
144
144
|
* ),
|
|
145
145
|
* ',',
|
|
146
146
|
* '.',
|
|
147
147
|
* '!',
|
|
148
|
-
* '⌫'
|
|
149
|
-
* ]
|
|
148
|
+
* '⌫',
|
|
149
|
+
* ]
|
|
150
150
|
*
|
|
151
|
-
* let textBuffer = ''
|
|
151
|
+
* let textBuffer = ''
|
|
152
152
|
*
|
|
153
153
|
* function handleClick(event: ButtonGridClickEvent) {
|
|
154
154
|
* textBuffer =
|
|
155
155
|
* event.detail.label === '⌫'
|
|
156
156
|
* ? textBuffer.slice(0, -1)
|
|
157
|
-
* : textBuffer + event.detail.label
|
|
157
|
+
* : textBuffer + event.detail.label
|
|
158
158
|
* }
|
|
159
159
|
* </script>
|
|
160
160
|
*
|
|
@@ -202,4 +202,4 @@ export default class ButtonGrid extends SvelteComponent<
|
|
|
202
202
|
ButtonGridEvents,
|
|
203
203
|
ButtonGridSlots
|
|
204
204
|
> {}
|
|
205
|
-
export {}
|
|
205
|
+
export {}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
|
-
import GenericInput from '../internal/GenericInput.svelte'
|
|
5
|
-
export let value
|
|
4
|
+
import GenericInput from '../internal/GenericInput.svelte'
|
|
5
|
+
export let value
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<GenericInput bind:value on:change {...$$restProps} />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SvelteComponent } from 'svelte'
|
|
2
|
-
import type { ValueChangeEvent } from '../utils.js'
|
|
3
|
-
export type CheckboxChangeEvent = ValueChangeEvent<boolean
|
|
1
|
+
import { SvelteComponent } from 'svelte'
|
|
2
|
+
import type { ValueChangeEvent } from '../utils.js'
|
|
3
|
+
export type CheckboxChangeEvent = ValueChangeEvent<boolean>
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: Omit<
|
|
6
6
|
{
|
|
@@ -8,26 +8,26 @@ declare const __propDef: {
|
|
|
8
8
|
* The value to control.
|
|
9
9
|
* @bindable
|
|
10
10
|
*/
|
|
11
|
-
value: boolean
|
|
11
|
+
value: boolean
|
|
12
12
|
} & Omit<
|
|
13
13
|
{
|
|
14
14
|
/**
|
|
15
15
|
* The binding's target object with values to manipulate.
|
|
16
16
|
* @bindable
|
|
17
17
|
*/
|
|
18
|
-
object: import('@tweakpane/core').Bindable & Record<string, boolean
|
|
18
|
+
object: import('@tweakpane/core').Bindable & Record<string, boolean>
|
|
19
19
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
20
|
-
key: string
|
|
20
|
+
key: string
|
|
21
21
|
/**
|
|
22
22
|
* Prevent interactivity and gray out the control.
|
|
23
23
|
* @default `false`
|
|
24
24
|
*/
|
|
25
|
-
disabled?: boolean
|
|
25
|
+
disabled?: boolean
|
|
26
26
|
/**
|
|
27
27
|
* Text displayed next to control.
|
|
28
28
|
* @default `undefined`
|
|
29
29
|
*/
|
|
30
|
-
label?: string | undefined
|
|
30
|
+
label?: string | undefined
|
|
31
31
|
/**
|
|
32
32
|
* Tweakpane's internal options object.
|
|
33
33
|
*
|
|
@@ -40,7 +40,7 @@ declare const __propDef: {
|
|
|
40
40
|
* Tweakpane UI_.
|
|
41
41
|
* @default `undefined`
|
|
42
42
|
*/
|
|
43
|
-
options?: import('@tweakpane/core').BaseInputParams | undefined
|
|
43
|
+
options?: import('@tweakpane/core').BaseInputParams | undefined
|
|
44
44
|
/**
|
|
45
45
|
* Custom color scheme.
|
|
46
46
|
*
|
|
@@ -48,7 +48,7 @@ declare const __propDef: {
|
|
|
48
48
|
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
49
49
|
* set with `setGlobalDefaultTheme()`.
|
|
50
50
|
*/
|
|
51
|
-
theme?: import('..').Theme | undefined
|
|
51
|
+
theme?: import('..').Theme | undefined
|
|
52
52
|
/**
|
|
53
53
|
* Reference to internal Tweakpane
|
|
54
54
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
@@ -62,7 +62,7 @@ declare const __propDef: {
|
|
|
62
62
|
* @bindable
|
|
63
63
|
* @readonly
|
|
64
64
|
*/
|
|
65
|
-
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined
|
|
65
|
+
ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined
|
|
66
66
|
/**
|
|
67
67
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
68
68
|
* the `<Binding>`'s containing `<Pane>`.
|
|
@@ -74,13 +74,13 @@ declare const __propDef: {
|
|
|
74
74
|
*
|
|
75
75
|
* @default `undefined`
|
|
76
76
|
*/
|
|
77
|
-
plugin?: import('../utils.js').Plugin | undefined
|
|
77
|
+
plugin?: import('../utils.js').Plugin | undefined
|
|
78
78
|
},
|
|
79
79
|
'object' | 'key'
|
|
80
80
|
>,
|
|
81
81
|
'ref' | 'options' | 'plugin'
|
|
82
|
-
|
|
83
|
-
slots: {}
|
|
82
|
+
>
|
|
83
|
+
slots: {}
|
|
84
84
|
events: {
|
|
85
85
|
/**
|
|
86
86
|
* Fires when `value` changes.
|
|
@@ -93,12 +93,12 @@ declare const __propDef: {
|
|
|
93
93
|
* @extends ValueChangeEvent
|
|
94
94
|
* @event
|
|
95
95
|
* */
|
|
96
|
-
change: CheckboxChangeEvent
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
export type CheckboxProps = typeof __propDef.props
|
|
100
|
-
export type CheckboxEvents = typeof __propDef.events
|
|
101
|
-
export type CheckboxSlots = typeof __propDef.slots
|
|
96
|
+
change: CheckboxChangeEvent
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export type CheckboxProps = typeof __propDef.props
|
|
100
|
+
export type CheckboxEvents = typeof __propDef.events
|
|
101
|
+
export type CheckboxSlots = typeof __propDef.slots
|
|
102
102
|
/**
|
|
103
103
|
* A checkbox.
|
|
104
104
|
*
|
|
@@ -111,9 +111,9 @@ export type CheckboxSlots = typeof __propDef.slots;
|
|
|
111
111
|
* @example
|
|
112
112
|
* ```svelte
|
|
113
113
|
* <script lang="ts">
|
|
114
|
-
* import { Checkbox } from 'svelte-tweakpane-ui'
|
|
114
|
+
* import { Checkbox } from 'svelte-tweakpane-ui'
|
|
115
115
|
*
|
|
116
|
-
* let reticulationEnabled: boolean = false
|
|
116
|
+
* let reticulationEnabled: boolean = false
|
|
117
117
|
* </script>
|
|
118
118
|
*
|
|
119
119
|
* <Checkbox bind:value={reticulationEnabled} label="Reticulation" />
|
|
@@ -128,4 +128,4 @@ export default class Checkbox extends SvelteComponent<
|
|
|
128
128
|
CheckboxEvents,
|
|
129
129
|
CheckboxSlots
|
|
130
130
|
> {}
|
|
131
|
-
export {}
|
|
131
|
+
export {}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
|
-
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
-
import GenericInputFolding from '../internal/GenericInputFolding.svelte'
|
|
6
|
-
import { objectToTuple } from '../utils'
|
|
7
|
-
import { fillWith } from '../utils'
|
|
8
|
-
import { isColorObject, isRgbaColorObject, isRgbColorObject } from '@tweakpane/core'
|
|
9
|
-
import { BROWSER } from 'esm-env'
|
|
10
|
-
import { shallowEqual } from 'fast-equals'
|
|
11
|
-
export let value
|
|
12
|
-
export let expanded = void 0
|
|
13
|
-
export let type = void 0
|
|
14
|
-
let internalValue
|
|
15
|
-
let options
|
|
16
|
-
let ref
|
|
17
|
-
const buttonClass = 'tp-colswv_b'
|
|
4
|
+
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
+
import GenericInputFolding from '../internal/GenericInputFolding.svelte'
|
|
6
|
+
import { objectToTuple } from '../utils'
|
|
7
|
+
import { fillWith } from '../utils'
|
|
8
|
+
import { isColorObject, isRgbaColorObject, isRgbColorObject } from '@tweakpane/core'
|
|
9
|
+
import { BROWSER } from 'esm-env'
|
|
10
|
+
import { shallowEqual } from 'fast-equals'
|
|
11
|
+
export let value
|
|
12
|
+
export let expanded = void 0
|
|
13
|
+
export let type = void 0
|
|
14
|
+
let internalValue
|
|
15
|
+
let options
|
|
16
|
+
let ref
|
|
17
|
+
const buttonClass = 'tp-colswv_b'
|
|
18
18
|
function updateInternalValueFromValue() {
|
|
19
19
|
if (typeof value === 'string') {
|
|
20
20
|
if (internalValue !== value) {
|
|
21
|
-
internalValue = value
|
|
21
|
+
internalValue = value
|
|
22
22
|
}
|
|
23
23
|
} else if (isColorObject(value)) {
|
|
24
24
|
if (!shallowEqual(value, internalValue)) {
|
|
25
|
-
internalValue = { ...value }
|
|
25
|
+
internalValue = { ...value }
|
|
26
26
|
}
|
|
27
27
|
} else if (Array.isArray(value)) {
|
|
28
28
|
let newInternalValue =
|
|
@@ -30,54 +30,54 @@
|
|
|
30
30
|
? { r: value[0], g: value[1], b: value[2], a: value[3] }
|
|
31
31
|
: value.length === 3
|
|
32
32
|
? { r: value[0], g: value[1], b: value[2] }
|
|
33
|
-
: void 0
|
|
33
|
+
: void 0
|
|
34
34
|
if (newInternalValue === void 0) {
|
|
35
|
-
console.error('Unreachable')
|
|
35
|
+
console.error('Unreachable')
|
|
36
36
|
} else if (!shallowEqual(newInternalValue, internalValue)) {
|
|
37
|
-
internalValue = newInternalValue
|
|
37
|
+
internalValue = newInternalValue
|
|
38
38
|
}
|
|
39
39
|
} else {
|
|
40
|
-
console.error('Unreachable')
|
|
40
|
+
console.error('Unreachable')
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
function updateValueFromInternalValue() {
|
|
44
44
|
if (typeof value === 'string' && typeof internalValue === 'string') {
|
|
45
45
|
if (internalValue !== value) {
|
|
46
|
-
value = internalValue
|
|
46
|
+
value = internalValue
|
|
47
47
|
}
|
|
48
48
|
} else if (Array.isArray(value) && isColorObject(internalValue)) {
|
|
49
49
|
const newValue = isRgbaColorObject(internalValue)
|
|
50
50
|
? objectToTuple(internalValue, ['r', 'g', 'b', 'a'])
|
|
51
51
|
: isRgbColorObject(internalValue)
|
|
52
52
|
? objectToTuple(internalValue, ['r', 'g', 'b'])
|
|
53
|
-
: void 0
|
|
53
|
+
: void 0
|
|
54
54
|
if (newValue === void 0) {
|
|
55
|
-
console.error('Unreachable color type mismatch')
|
|
55
|
+
console.error('Unreachable color type mismatch')
|
|
56
56
|
} else if (!shallowEqual(newValue, value)) {
|
|
57
|
-
value = newValue
|
|
57
|
+
value = newValue
|
|
58
58
|
}
|
|
59
59
|
} else if (isColorObject(value) && isColorObject(internalValue)) {
|
|
60
60
|
if (!shallowEqual(internalValue, value)) {
|
|
61
|
-
value = { ...internalValue }
|
|
61
|
+
value = { ...internalValue }
|
|
62
62
|
}
|
|
63
63
|
} else {
|
|
64
|
-
console.error('Unreachable color type mismatch')
|
|
64
|
+
console.error('Unreachable color type mismatch')
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
function addListeners() {
|
|
68
68
|
ref.on('change', () => {
|
|
69
|
-
ref.refresh()
|
|
70
|
-
})
|
|
69
|
+
ref.refresh()
|
|
70
|
+
})
|
|
71
71
|
}
|
|
72
|
-
$: value, updateInternalValueFromValue()
|
|
73
|
-
$: internalValue, updateValueFromInternalValue()
|
|
74
|
-
$: ref !== void 0 && addListeners()
|
|
72
|
+
$: value, updateInternalValueFromValue()
|
|
73
|
+
$: internalValue, updateValueFromInternalValue()
|
|
74
|
+
$: ref !== void 0 && addListeners()
|
|
75
75
|
$: options = {
|
|
76
76
|
color: {
|
|
77
|
-
type
|
|
77
|
+
type,
|
|
78
78
|
},
|
|
79
|
-
view: 'color'
|
|
80
|
-
}
|
|
79
|
+
view: 'color',
|
|
80
|
+
}
|
|
81
81
|
</script>
|
|
82
82
|
|
|
83
83
|
<GenericInputFolding
|