svelte-tweakpane-ui 1.0.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/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/control/ButtonGrid.svelte +49 -0
- package/dist/control/ButtonGrid.svelte.d.ts +190 -0
- package/dist/control/Checkbox.svelte +6 -0
- package/dist/control/Checkbox.svelte.d.ts +113 -0
- package/dist/control/Color.svelte +79 -0
- package/dist/control/Color.svelte.d.ts +177 -0
- package/dist/control/CubicBezier.svelte +74 -0
- package/dist/control/CubicBezier.svelte.d.ts +204 -0
- package/dist/control/Image.svelte +23 -0
- package/dist/control/Image.svelte.d.ts +177 -0
- package/dist/control/IntervalSlider.svelte +37 -0
- package/dist/control/IntervalSlider.svelte.d.ts +196 -0
- package/dist/control/List.svelte +69 -0
- package/dist/control/List.svelte.d.ts +122 -0
- package/dist/control/Point.svelte +100 -0
- package/dist/control/Point.svelte.d.ts +374 -0
- package/dist/control/RadioGrid.svelte +42 -0
- package/dist/control/RadioGrid.svelte.d.ts +231 -0
- package/dist/control/Ring.svelte +19 -0
- package/dist/control/Ring.svelte.d.ts +220 -0
- package/dist/control/RotationEuler.svelte +67 -0
- package/dist/control/RotationEuler.svelte.d.ts +273 -0
- package/dist/control/RotationQuaternion.svelte +65 -0
- package/dist/control/RotationQuaternion.svelte.d.ts +276 -0
- package/dist/control/Slider.svelte +6 -0
- package/dist/control/Slider.svelte.d.ts +165 -0
- package/dist/control/Text.svelte +25 -0
- package/dist/control/Text.svelte.d.ts +129 -0
- package/dist/control/Textarea.svelte +47 -0
- package/dist/control/Textarea.svelte.d.ts +149 -0
- package/dist/control/Wheel.svelte +15 -0
- package/dist/control/Wheel.svelte.d.ts +186 -0
- package/dist/core/Binding.svelte +68 -0
- package/dist/core/Binding.svelte.d.ts +116 -0
- package/dist/core/Blade.svelte +61 -0
- package/dist/core/Blade.svelte.d.ts +90 -0
- package/dist/core/Button.svelte +59 -0
- package/dist/core/Button.svelte.d.ts +65 -0
- package/dist/core/Folder.svelte +69 -0
- package/dist/core/Folder.svelte.d.ts +78 -0
- package/dist/core/Pane.svelte +51 -0
- package/dist/core/Pane.svelte.d.ts +500 -0
- package/dist/core/Separator.svelte +14 -0
- package/dist/core/Separator.svelte.d.ts +85 -0
- package/dist/core/TabGroup.svelte +64 -0
- package/dist/core/TabGroup.svelte.d.ts +72 -0
- package/dist/core/TabPage.svelte +85 -0
- package/dist/core/TabPage.svelte.d.ts +82 -0
- package/dist/extra/AutoObject.svelte +46 -0
- package/dist/extra/AutoObject.svelte.d.ts +108 -0
- package/dist/extra/AutoValue.svelte +11 -0
- package/dist/extra/AutoValue.svelte.d.ts +123 -0
- package/dist/extra/Element.svelte +53 -0
- package/dist/extra/Element.svelte.d.ts +170 -0
- package/dist/index.d.ts +94 -0
- package/dist/index.js +39 -0
- package/dist/internal/ClsPad.svelte +34 -0
- package/dist/internal/ClsPad.svelte.d.ts +95 -0
- package/dist/internal/GenericBinding.svelte +22 -0
- package/dist/internal/GenericBinding.svelte.d.ts +116 -0
- package/dist/internal/GenericBladeFolding.svelte +38 -0
- package/dist/internal/GenericBladeFolding.svelte.d.ts +95 -0
- package/dist/internal/GenericInput.svelte +19 -0
- package/dist/internal/GenericInput.svelte.d.ts +116 -0
- package/dist/internal/GenericInputFolding.svelte +40 -0
- package/dist/internal/GenericInputFolding.svelte.d.ts +140 -0
- package/dist/internal/GenericMonitor.svelte +24 -0
- package/dist/internal/GenericMonitor.svelte.d.ts +139 -0
- package/dist/internal/GenericPane.svelte +100 -0
- package/dist/internal/GenericPane.svelte.d.ts +84 -0
- package/dist/internal/GenericSlider.svelte +27 -0
- package/dist/internal/GenericSlider.svelte.d.ts +146 -0
- package/dist/internal/InternalMonitorBoolean.svelte +17 -0
- package/dist/internal/InternalMonitorBoolean.svelte.d.ts +154 -0
- package/dist/internal/InternalMonitorNumber.svelte +31 -0
- package/dist/internal/InternalMonitorNumber.svelte.d.ts +178 -0
- package/dist/internal/InternalMonitorString.svelte +23 -0
- package/dist/internal/InternalMonitorString.svelte.d.ts +162 -0
- package/dist/internal/InternalPaneDraggable.svelte +368 -0
- package/dist/internal/InternalPaneDraggable.svelte.d.ts +178 -0
- package/dist/internal/InternalPaneFixed.svelte +28 -0
- package/dist/internal/InternalPaneFixed.svelte.d.ts +119 -0
- package/dist/internal/InternalPaneInline.svelte +29 -0
- package/dist/internal/InternalPaneInline.svelte.d.ts +106 -0
- package/dist/monitor/FpsGraph.svelte +86 -0
- package/dist/monitor/FpsGraph.svelte.d.ts +230 -0
- package/dist/monitor/Monitor.svelte +14 -0
- package/dist/monitor/Monitor.svelte.d.ts +526 -0
- package/dist/monitor/Profiler.svelte +72 -0
- package/dist/monitor/Profiler.svelte.d.ts +265 -0
- package/dist/monitor/WaveformMonitor.svelte +26 -0
- package/dist/monitor/WaveformMonitor.svelte.d.ts +176 -0
- package/dist/theme.d.ts +91 -0
- package/dist/theme.js +332 -0
- package/dist/utils.d.ts +157 -0
- package/dist/utils.js +238 -0
- package/package.json +280 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { BladeOptions, BladeRef } from '../core/Blade.svelte';
|
|
3
|
+
declare class __sveltets_Render<T extends BladeOptions, U extends BladeRef> {
|
|
4
|
+
props(): {
|
|
5
|
+
/**
|
|
6
|
+
* Blade configuration exposing Tweakpane's internal
|
|
7
|
+
* [`BladeParams`](https://tweakpane.github.io/docs/api/interfaces/BaseBladeParams.html).
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
options: T;
|
|
11
|
+
/**
|
|
12
|
+
* Prevent interactivity and gray out the control.
|
|
13
|
+
* @default `false`
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Custom color scheme.
|
|
18
|
+
* @default `undefined` \
|
|
19
|
+
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
20
|
+
* set with `setGlobalDefaultTheme()`.
|
|
21
|
+
*/
|
|
22
|
+
theme?: import('..').Theme | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Reference to internal Tweakpane
|
|
25
|
+
* [`BladeApi`](https://tweakpane.github.io/docs/api/classes/BladeApi.html) for this blade.
|
|
26
|
+
*
|
|
27
|
+
* This is primarily for internal use, when implementing convenience components wrapping Blade's
|
|
28
|
+
* functionality.
|
|
29
|
+
* @bindable
|
|
30
|
+
* @readonly
|
|
31
|
+
*/
|
|
32
|
+
ref?: U | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Imported Tweakpane `TpPluginBundle` (Aliased as `Plugin`) module to register before creating
|
|
35
|
+
* the blade.
|
|
36
|
+
*
|
|
37
|
+
* This is primarily for internal use, when implementing convenience components wrapping Blade's
|
|
38
|
+
* functionality in combination with a Tweakpane plugin.
|
|
39
|
+
* @default `undefined`
|
|
40
|
+
*/
|
|
41
|
+
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
42
|
+
} & {
|
|
43
|
+
/**
|
|
44
|
+
* DOM class name of the button used to expand and collapse the blade's picker.
|
|
45
|
+
* @default `undefined`
|
|
46
|
+
* */
|
|
47
|
+
buttonClass?: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Expand or collapse the blade's picker.
|
|
50
|
+
* @default `true`
|
|
51
|
+
* @bindable
|
|
52
|
+
* */
|
|
53
|
+
expanded?: boolean | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The style of value "picker" to use in the blade.
|
|
56
|
+
* @default `'popup'`
|
|
57
|
+
*/
|
|
58
|
+
picker?: 'inline' | 'popup' | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Allow users to interactively expand / contract the value picker by clicking its icon.
|
|
61
|
+
*
|
|
62
|
+
* Most useful when `picker` is `inline`.
|
|
63
|
+
* @default `true`
|
|
64
|
+
* */
|
|
65
|
+
userExpandable?: boolean | undefined;
|
|
66
|
+
};
|
|
67
|
+
events(): {} & {
|
|
68
|
+
[evt: string]: CustomEvent<any>;
|
|
69
|
+
};
|
|
70
|
+
slots(): {};
|
|
71
|
+
}
|
|
72
|
+
export type GenericBladeFoldingProps<T extends BladeOptions, U extends BladeRef> = ReturnType<
|
|
73
|
+
__sveltets_Render<T, U>['props']
|
|
74
|
+
>;
|
|
75
|
+
export type GenericBladeFoldingEvents<T extends BladeOptions, U extends BladeRef> = ReturnType<
|
|
76
|
+
__sveltets_Render<T, U>['events']
|
|
77
|
+
>;
|
|
78
|
+
export type GenericBladeFoldingSlots<T extends BladeOptions, U extends BladeRef> = ReturnType<
|
|
79
|
+
__sveltets_Render<T, U>['slots']
|
|
80
|
+
>;
|
|
81
|
+
/**
|
|
82
|
+
* This component is for internal use only.
|
|
83
|
+
*
|
|
84
|
+
* @sourceLink
|
|
85
|
+
* [GenericBladeFolding.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/internal/GenericBladeFolding.svelte)
|
|
86
|
+
*/
|
|
87
|
+
export default class GenericBladeFolding<
|
|
88
|
+
T extends BladeOptions,
|
|
89
|
+
U extends BladeRef
|
|
90
|
+
> extends SvelteComponent<
|
|
91
|
+
GenericBladeFoldingProps<T, U>,
|
|
92
|
+
GenericBladeFoldingEvents<T, U>,
|
|
93
|
+
GenericBladeFoldingSlots<T, U>
|
|
94
|
+
> {}
|
|
95
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
generics="T extends any, U extends GenericInputOptions = GenericInputOptions, V extends GenericInputRef = GenericInputRef"
|
|
5
|
+
>
|
|
6
|
+
import GenericBinding from './GenericBinding.svelte';
|
|
7
|
+
import { BROWSER } from 'esm-env';
|
|
8
|
+
export let options = void 0;
|
|
9
|
+
export let ref = void 0;
|
|
10
|
+
export let value;
|
|
11
|
+
let optionsInternal;
|
|
12
|
+
$: BROWSER &&
|
|
13
|
+
(optionsInternal = {
|
|
14
|
+
...options,
|
|
15
|
+
readonly: false
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<GenericBinding bind:value bind:ref options={optionsInternal} {...$$restProps} />
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { BaseInputParams, InputBindingApi } from '@tweakpane/core';
|
|
3
|
+
export type GenericInputOptions = BaseInputParams;
|
|
4
|
+
export type GenericInputRef = InputBindingApi;
|
|
5
|
+
declare class __sveltets_Render<
|
|
6
|
+
T extends any,
|
|
7
|
+
U extends GenericInputOptions = GenericInputOptions,
|
|
8
|
+
V extends GenericInputRef = GenericInputRef
|
|
9
|
+
> {
|
|
10
|
+
props(): Omit<
|
|
11
|
+
{
|
|
12
|
+
/**
|
|
13
|
+
* The binding's target object with values to manipulate.
|
|
14
|
+
* @bindable
|
|
15
|
+
*/
|
|
16
|
+
object: import('@tweakpane/core').Bindable & {
|
|
17
|
+
[x: string]: T;
|
|
18
|
+
};
|
|
19
|
+
/** The key for the value in the target `object` that the control should manipulate. */
|
|
20
|
+
key: string | number;
|
|
21
|
+
/**
|
|
22
|
+
* Prevent interactivity and gray out the control.
|
|
23
|
+
* @default `false`
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Text displayed next to control.
|
|
28
|
+
* @default `undefined`
|
|
29
|
+
*/
|
|
30
|
+
label?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Tweakpane's internal options object.
|
|
33
|
+
*
|
|
34
|
+
* See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
|
|
35
|
+
*
|
|
36
|
+
* Valid types are contingent on the type of the value `key` points to in `object`.
|
|
37
|
+
*
|
|
38
|
+
* This is intended internal use, when implementing convenience components wrapping Binding's
|
|
39
|
+
* functionality. Options of interest are instead exposed as top-level props in _Svelte
|
|
40
|
+
* Tweakpane UI_.
|
|
41
|
+
* @default `undefined`
|
|
42
|
+
*/
|
|
43
|
+
options?: U | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Custom color scheme.
|
|
46
|
+
*
|
|
47
|
+
* @default `undefined` \
|
|
48
|
+
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
49
|
+
* set with `setGlobalDefaultTheme()`.
|
|
50
|
+
*/
|
|
51
|
+
theme?: import('..').Theme | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Reference to internal Tweakpane
|
|
54
|
+
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
55
|
+
* this control.
|
|
56
|
+
*
|
|
57
|
+
* This is primarily for internal use, when implementing convenience components wrapping
|
|
58
|
+
* Binding's functionality.
|
|
59
|
+
* @bindable
|
|
60
|
+
* @readonly
|
|
61
|
+
*/
|
|
62
|
+
ref?: V | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
65
|
+
* the binding's containing `<Pane>`.
|
|
66
|
+
*
|
|
67
|
+
* This is primarily for internal use, when implementing convenience components wrapping
|
|
68
|
+
* Binding's functionality in combination with a Tweakpane plugin.
|
|
69
|
+
* @default `undefined`
|
|
70
|
+
*/
|
|
71
|
+
plugin?: import('@tweakpane/core').TpPluginBundle | undefined;
|
|
72
|
+
},
|
|
73
|
+
'object' | 'key'
|
|
74
|
+
> & {
|
|
75
|
+
/**
|
|
76
|
+
* The value to control.
|
|
77
|
+
* @bindable
|
|
78
|
+
*/
|
|
79
|
+
value: T;
|
|
80
|
+
};
|
|
81
|
+
events(): {} & {
|
|
82
|
+
[evt: string]: CustomEvent<any>;
|
|
83
|
+
};
|
|
84
|
+
slots(): {};
|
|
85
|
+
}
|
|
86
|
+
export type GenericInputProps<
|
|
87
|
+
T extends any,
|
|
88
|
+
U extends GenericInputOptions = GenericInputOptions,
|
|
89
|
+
V extends GenericInputRef = GenericInputRef
|
|
90
|
+
> = ReturnType<__sveltets_Render<T, U, V>['props']>;
|
|
91
|
+
export type GenericInputEvents<
|
|
92
|
+
T extends any,
|
|
93
|
+
U extends GenericInputOptions = GenericInputOptions,
|
|
94
|
+
V extends GenericInputRef = GenericInputRef
|
|
95
|
+
> = ReturnType<__sveltets_Render<T, U, V>['events']>;
|
|
96
|
+
export type GenericInputSlots<
|
|
97
|
+
T extends any,
|
|
98
|
+
U extends GenericInputOptions = GenericInputOptions,
|
|
99
|
+
V extends GenericInputRef = GenericInputRef
|
|
100
|
+
> = ReturnType<__sveltets_Render<T, U, V>['slots']>;
|
|
101
|
+
/**
|
|
102
|
+
* This component is for internal use only.
|
|
103
|
+
*
|
|
104
|
+
* @sourceLink
|
|
105
|
+
* [GenericInput.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/internal/GenericInput.svelte)
|
|
106
|
+
*/
|
|
107
|
+
export default class GenericInput<
|
|
108
|
+
T extends any,
|
|
109
|
+
U extends GenericInputOptions = GenericInputOptions,
|
|
110
|
+
V extends GenericInputRef = GenericInputRef
|
|
111
|
+
> extends SvelteComponent<
|
|
112
|
+
GenericInputProps<T, U, V>,
|
|
113
|
+
GenericInputEvents<T, U, V>,
|
|
114
|
+
GenericInputSlots<T, U, V>
|
|
115
|
+
> {}
|
|
116
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
generics="T extends any, U extends GenericInputFoldingOptions = GenericInputFoldingOptions, V extends GenericInputFoldingRef = GenericInputFoldingRef"
|
|
5
|
+
>
|
|
6
|
+
import GenericInput from './GenericInput.svelte';
|
|
7
|
+
import { updateCollapsibility } from '../utils.js';
|
|
8
|
+
export let value;
|
|
9
|
+
export let ref = void 0;
|
|
10
|
+
export let options = void 0;
|
|
11
|
+
export let userExpandable = true;
|
|
12
|
+
export let expanded = false;
|
|
13
|
+
export let buttonClass = '';
|
|
14
|
+
export let picker = void 0;
|
|
15
|
+
let optionsInternal;
|
|
16
|
+
let gotBinding = false;
|
|
17
|
+
const initialExpanded = expanded;
|
|
18
|
+
let internalExpanded = initialExpanded;
|
|
19
|
+
$: if (!gotBinding && ref) {
|
|
20
|
+
gotBinding = true;
|
|
21
|
+
ref.controller?.valueController?.foldable_?.value('expanded').emitter.on('change', (e) => {
|
|
22
|
+
internalExpanded = e.rawValue;
|
|
23
|
+
expanded = internalExpanded;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
$: optionsInternal = {
|
|
27
|
+
...options,
|
|
28
|
+
expanded: initialExpanded,
|
|
29
|
+
// only set once
|
|
30
|
+
picker
|
|
31
|
+
};
|
|
32
|
+
$: ref && buttonClass && updateCollapsibility(userExpandable ?? true, ref.element, buttonClass);
|
|
33
|
+
$: ref &&
|
|
34
|
+
buttonClass &&
|
|
35
|
+
expanded !== internalExpanded &&
|
|
36
|
+
ref.element.getElementsByClassName(buttonClass).length > 0 &&
|
|
37
|
+
ref.element.getElementsByClassName(buttonClass)[0].click();
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<GenericInput bind:value bind:ref options={optionsInternal} {...$$restProps} />
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { GenericInputOptions, GenericInputRef } from './GenericInput.svelte';
|
|
3
|
+
export type GenericInputFoldingOptions = GenericInputOptions & {
|
|
4
|
+
expanded?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type GenericInputFoldingRef = GenericInputRef;
|
|
7
|
+
declare class __sveltets_Render<
|
|
8
|
+
T extends any,
|
|
9
|
+
U extends GenericInputFoldingOptions = GenericInputFoldingOptions,
|
|
10
|
+
V extends GenericInputFoldingRef = GenericInputFoldingRef
|
|
11
|
+
> {
|
|
12
|
+
props(): Omit<
|
|
13
|
+
{
|
|
14
|
+
/**
|
|
15
|
+
* The binding's target object with values to manipulate.
|
|
16
|
+
* @bindable
|
|
17
|
+
*/
|
|
18
|
+
object: import('@tweakpane/core').Bindable & {
|
|
19
|
+
[x: string]: T;
|
|
20
|
+
};
|
|
21
|
+
/** The key for the value in the target `object` that the control should manipulate. */
|
|
22
|
+
key: string | number;
|
|
23
|
+
/**
|
|
24
|
+
* Prevent interactivity and gray out the control.
|
|
25
|
+
* @default `false`
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Text displayed next to control.
|
|
30
|
+
* @default `undefined`
|
|
31
|
+
*/
|
|
32
|
+
label?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Tweakpane's internal options object.
|
|
35
|
+
*
|
|
36
|
+
* See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
|
|
37
|
+
*
|
|
38
|
+
* Valid types are contingent on the type of the value `key` points to in `object`.
|
|
39
|
+
*
|
|
40
|
+
* This is intended internal use, when implementing convenience components wrapping Binding's
|
|
41
|
+
* functionality. Options of interest are instead exposed as top-level props in _Svelte
|
|
42
|
+
* Tweakpane UI_.
|
|
43
|
+
* @default `undefined`
|
|
44
|
+
*/
|
|
45
|
+
options?: U | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Custom color scheme.
|
|
48
|
+
*
|
|
49
|
+
* @default `undefined` \
|
|
50
|
+
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
51
|
+
* set with `setGlobalDefaultTheme()`.
|
|
52
|
+
*/
|
|
53
|
+
theme?: import('..').Theme | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Reference to internal Tweakpane
|
|
56
|
+
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
57
|
+
* this control.
|
|
58
|
+
*
|
|
59
|
+
* This is primarily for internal use, when implementing convenience components wrapping
|
|
60
|
+
* Binding's functionality.
|
|
61
|
+
* @bindable
|
|
62
|
+
* @readonly
|
|
63
|
+
*/
|
|
64
|
+
ref?: V | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
67
|
+
* the binding's containing `<Pane>`.
|
|
68
|
+
*
|
|
69
|
+
* This is primarily for internal use, when implementing convenience components wrapping
|
|
70
|
+
* Binding's functionality in combination with a Tweakpane plugin.
|
|
71
|
+
* @default `undefined`
|
|
72
|
+
*/
|
|
73
|
+
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
74
|
+
},
|
|
75
|
+
'object' | 'key'
|
|
76
|
+
> & {
|
|
77
|
+
/**
|
|
78
|
+
* The value to control.
|
|
79
|
+
* @bindable
|
|
80
|
+
*/
|
|
81
|
+
value: T;
|
|
82
|
+
} & {
|
|
83
|
+
/**
|
|
84
|
+
* DOM class name of the button used to expand and collapse the input's picker.
|
|
85
|
+
* @default `undefined`
|
|
86
|
+
* */
|
|
87
|
+
buttonClass?: string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Expand or collapse the input's picker.
|
|
90
|
+
* @default `false`
|
|
91
|
+
* @bindable
|
|
92
|
+
* */
|
|
93
|
+
expanded?: boolean | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* The style of value "picker" to use in the input.
|
|
96
|
+
* @default `'popup'`
|
|
97
|
+
*/
|
|
98
|
+
picker?: 'inline' | 'popup' | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Allow users to interactively expand / contract the picker.
|
|
101
|
+
* @default `true`
|
|
102
|
+
* */
|
|
103
|
+
userExpandable?: boolean | undefined;
|
|
104
|
+
};
|
|
105
|
+
events(): {} & {
|
|
106
|
+
[evt: string]: CustomEvent<any>;
|
|
107
|
+
};
|
|
108
|
+
slots(): {};
|
|
109
|
+
}
|
|
110
|
+
export type GenericInputFoldingProps<
|
|
111
|
+
T extends any,
|
|
112
|
+
U extends GenericInputFoldingOptions = GenericInputFoldingOptions,
|
|
113
|
+
V extends GenericInputFoldingRef = GenericInputFoldingRef
|
|
114
|
+
> = ReturnType<__sveltets_Render<T, U, V>['props']>;
|
|
115
|
+
export type GenericInputFoldingEvents<
|
|
116
|
+
T extends any,
|
|
117
|
+
U extends GenericInputFoldingOptions = GenericInputFoldingOptions,
|
|
118
|
+
V extends GenericInputFoldingRef = GenericInputFoldingRef
|
|
119
|
+
> = ReturnType<__sveltets_Render<T, U, V>['events']>;
|
|
120
|
+
export type GenericInputFoldingSlots<
|
|
121
|
+
T extends any,
|
|
122
|
+
U extends GenericInputFoldingOptions = GenericInputFoldingOptions,
|
|
123
|
+
V extends GenericInputFoldingRef = GenericInputFoldingRef
|
|
124
|
+
> = ReturnType<__sveltets_Render<T, U, V>['slots']>;
|
|
125
|
+
/**
|
|
126
|
+
* This component is for internal use only.
|
|
127
|
+
*
|
|
128
|
+
* @sourceLink
|
|
129
|
+
* [GenericInputFolding.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/internal/GenericInputFolding.svelte)
|
|
130
|
+
*/
|
|
131
|
+
export default class GenericInputFolding<
|
|
132
|
+
T extends any,
|
|
133
|
+
U extends GenericInputFoldingOptions = GenericInputFoldingOptions,
|
|
134
|
+
V extends GenericInputFoldingRef = GenericInputFoldingRef
|
|
135
|
+
> extends SvelteComponent<
|
|
136
|
+
GenericInputFoldingProps<T, U, V>,
|
|
137
|
+
GenericInputFoldingEvents<T, U, V>,
|
|
138
|
+
GenericInputFoldingSlots<T, U, V>
|
|
139
|
+
> {}
|
|
140
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
generics="T extends any, U extends GenericMonitorOptions, V extends GenericMonitorRef = GenericMonitorRef"
|
|
5
|
+
>
|
|
6
|
+
import GenericBinding from './GenericBinding.svelte';
|
|
7
|
+
export let value;
|
|
8
|
+
export let ref = void 0;
|
|
9
|
+
export let options = void 0;
|
|
10
|
+
export let rows = void 0;
|
|
11
|
+
export let bufferSize = void 0;
|
|
12
|
+
export let interval = void 0;
|
|
13
|
+
let optionsInternal;
|
|
14
|
+
$: optionsInternal = {
|
|
15
|
+
bufferSize,
|
|
16
|
+
interval: interval ?? 0,
|
|
17
|
+
// zero confirmed as never updating (not same interface as setInterval())
|
|
18
|
+
rows,
|
|
19
|
+
...options,
|
|
20
|
+
readonly: true
|
|
21
|
+
};
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<GenericBinding {value} bind:ref options={optionsInternal} {...$$restProps} />
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { BaseMonitorParams, MonitorBindingApi } from '@tweakpane/core';
|
|
3
|
+
export type GenericMonitorOptions = BaseMonitorParams;
|
|
4
|
+
export type GenericMonitorRef = MonitorBindingApi;
|
|
5
|
+
declare class __sveltets_Render<
|
|
6
|
+
T extends any,
|
|
7
|
+
U extends GenericMonitorOptions,
|
|
8
|
+
V extends GenericMonitorRef = GenericMonitorRef
|
|
9
|
+
> {
|
|
10
|
+
props(): Omit<
|
|
11
|
+
{
|
|
12
|
+
/**
|
|
13
|
+
* The binding's target object with values to manipulate.
|
|
14
|
+
* @bindable
|
|
15
|
+
*/
|
|
16
|
+
object: import('@tweakpane/core').Bindable & {
|
|
17
|
+
[x: string]: T;
|
|
18
|
+
};
|
|
19
|
+
/** The key for the value in the target `object` that the control should manipulate. */
|
|
20
|
+
key: string | number;
|
|
21
|
+
/**
|
|
22
|
+
* Prevent interactivity and gray out the control.
|
|
23
|
+
* @default `false`
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Text displayed next to control.
|
|
28
|
+
* @default `undefined`
|
|
29
|
+
*/
|
|
30
|
+
label?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Tweakpane's internal options object.
|
|
33
|
+
*
|
|
34
|
+
* See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
|
|
35
|
+
*
|
|
36
|
+
* Valid types are contingent on the type of the value `key` points to in `object`.
|
|
37
|
+
*
|
|
38
|
+
* This is intended internal use, when implementing convenience components wrapping Binding's
|
|
39
|
+
* functionality. Options of interest are instead exposed as top-level props in _Svelte
|
|
40
|
+
* Tweakpane UI_.
|
|
41
|
+
* @default `undefined`
|
|
42
|
+
*/
|
|
43
|
+
options?: U | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Custom color scheme.
|
|
46
|
+
*
|
|
47
|
+
* @default `undefined` \
|
|
48
|
+
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
49
|
+
* set with `setGlobalDefaultTheme()`.
|
|
50
|
+
*/
|
|
51
|
+
theme?: import('..').Theme | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Reference to internal Tweakpane
|
|
54
|
+
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
55
|
+
* this control.
|
|
56
|
+
*
|
|
57
|
+
* This is primarily for internal use, when implementing convenience components wrapping
|
|
58
|
+
* Binding's functionality.
|
|
59
|
+
* @bindable
|
|
60
|
+
* @readonly
|
|
61
|
+
*/
|
|
62
|
+
ref?: V | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
65
|
+
* the binding's containing `<Pane>`.
|
|
66
|
+
*
|
|
67
|
+
* This is primarily for internal use, when implementing convenience components wrapping
|
|
68
|
+
* Binding's functionality in combination with a Tweakpane plugin.
|
|
69
|
+
* @default `undefined`
|
|
70
|
+
*/
|
|
71
|
+
plugin?: import('@tweakpane/core').TpPluginBundle | undefined;
|
|
72
|
+
},
|
|
73
|
+
'object' | 'key'
|
|
74
|
+
> & {
|
|
75
|
+
/**
|
|
76
|
+
* The value to control.
|
|
77
|
+
* @bindable
|
|
78
|
+
*/
|
|
79
|
+
value: T;
|
|
80
|
+
} & {
|
|
81
|
+
/**
|
|
82
|
+
* Number of past states to retain.
|
|
83
|
+
* @default `1` \
|
|
84
|
+
* Or `64` if value is `number` and `graph` is `true`.
|
|
85
|
+
* */
|
|
86
|
+
bufferSize?: number | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Time between value samples in milliseconds.
|
|
89
|
+
*
|
|
90
|
+
* Useful when `graph` is true. Defaults to reactive value updates only (`interval={0}`).
|
|
91
|
+
* @default `0`
|
|
92
|
+
* */
|
|
93
|
+
interval?: number | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Number of visible rows of state history.
|
|
96
|
+
*
|
|
97
|
+
* If `bufferSize` is larger, then the value window will scroll once state history exceeds
|
|
98
|
+
* row count.
|
|
99
|
+
* @default `1` \
|
|
100
|
+
* Or `3` if value is `string` and `multiline` is `true`.
|
|
101
|
+
* */
|
|
102
|
+
rows?: number | undefined;
|
|
103
|
+
};
|
|
104
|
+
events(): {} & {
|
|
105
|
+
[evt: string]: CustomEvent<any>;
|
|
106
|
+
};
|
|
107
|
+
slots(): {};
|
|
108
|
+
}
|
|
109
|
+
export type GenericMonitorProps<
|
|
110
|
+
T extends any,
|
|
111
|
+
U extends GenericMonitorOptions,
|
|
112
|
+
V extends GenericMonitorRef = GenericMonitorRef
|
|
113
|
+
> = ReturnType<__sveltets_Render<T, U, V>['props']>;
|
|
114
|
+
export type GenericMonitorEvents<
|
|
115
|
+
T extends any,
|
|
116
|
+
U extends GenericMonitorOptions,
|
|
117
|
+
V extends GenericMonitorRef = GenericMonitorRef
|
|
118
|
+
> = ReturnType<__sveltets_Render<T, U, V>['events']>;
|
|
119
|
+
export type GenericMonitorSlots<
|
|
120
|
+
T extends any,
|
|
121
|
+
U extends GenericMonitorOptions,
|
|
122
|
+
V extends GenericMonitorRef = GenericMonitorRef
|
|
123
|
+
> = ReturnType<__sveltets_Render<T, U, V>['slots']>;
|
|
124
|
+
/**
|
|
125
|
+
* This component is for internal use only.
|
|
126
|
+
*
|
|
127
|
+
* @sourceLink
|
|
128
|
+
* [GenericMonitor.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/internal/GenericMonitor.svelte)
|
|
129
|
+
*/
|
|
130
|
+
export default class GenericMonitor<
|
|
131
|
+
T extends any,
|
|
132
|
+
U extends GenericMonitorOptions,
|
|
133
|
+
V extends GenericMonitorRef = GenericMonitorRef
|
|
134
|
+
> extends SvelteComponent<
|
|
135
|
+
GenericMonitorProps<T, U, V>,
|
|
136
|
+
GenericMonitorEvents<T, U, V>,
|
|
137
|
+
GenericMonitorSlots<T, U, V>
|
|
138
|
+
> {}
|
|
139
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import ClsPad from './ClsPad.svelte';
|
|
3
|
+
import { applyTheme } from '../theme.js';
|
|
4
|
+
import { updateCollapsibility } from '../utils.js';
|
|
5
|
+
import { BROWSER } from 'esm-env';
|
|
6
|
+
import { getContext, onDestroy, setContext } from 'svelte';
|
|
7
|
+
import { writable } from 'svelte/store';
|
|
8
|
+
import { Pane as TpPane } from 'tweakpane';
|
|
9
|
+
export let title = void 0;
|
|
10
|
+
export let userExpandable = true;
|
|
11
|
+
export let expanded = true;
|
|
12
|
+
export let theme = void 0;
|
|
13
|
+
export let scale = 1;
|
|
14
|
+
export let userCreatedPane = true;
|
|
15
|
+
export let paneRef = void 0;
|
|
16
|
+
const parentStore = writable();
|
|
17
|
+
const existingParentStore = getContext('parentStore');
|
|
18
|
+
let pluginsRegistered = [];
|
|
19
|
+
const registerPlugin = (plugin) => {
|
|
20
|
+
if (paneRef === void 0) {
|
|
21
|
+
console.warn('`paneRef is undefined, failed to register plugin "${plugin.id}"');
|
|
22
|
+
} else {
|
|
23
|
+
if (pluginsRegistered.includes(plugin.id)) {
|
|
24
|
+
} else {
|
|
25
|
+
paneRef?.registerPlugin(plugin);
|
|
26
|
+
pluginsRegistered.push(plugin.id);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
setContext('registerPlugin', registerPlugin);
|
|
31
|
+
setContext('userCreatedPane', userCreatedPane);
|
|
32
|
+
if ($existingParentStore !== void 0) {
|
|
33
|
+
console.warn('<Panes> must not be nested');
|
|
34
|
+
}
|
|
35
|
+
let _expanded = expanded;
|
|
36
|
+
if (BROWSER) {
|
|
37
|
+
$parentStore = new TpPane({ expanded, title });
|
|
38
|
+
$parentStore.on('fold', () => {
|
|
39
|
+
_expanded = $parentStore.expanded;
|
|
40
|
+
});
|
|
41
|
+
paneRef = $parentStore;
|
|
42
|
+
setContext('parentStore', parentStore);
|
|
43
|
+
onDestroy(() => {
|
|
44
|
+
$parentStore.dispose();
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
setContext('parentStore', writable(true));
|
|
48
|
+
}
|
|
49
|
+
function setScale(scale2) {
|
|
50
|
+
if (paneRef) {
|
|
51
|
+
if (scale2 === 1) {
|
|
52
|
+
paneRef.element.style.removeProperty('transform-origin');
|
|
53
|
+
paneRef.element.style.removeProperty('transform');
|
|
54
|
+
paneRef.element.style.removeProperty('width');
|
|
55
|
+
} else {
|
|
56
|
+
const clampedScale = Math.max(0, scale2);
|
|
57
|
+
paneRef.element.style.transformOrigin = '0 0';
|
|
58
|
+
paneRef.element.style.transform = `scale(${clampedScale})`;
|
|
59
|
+
paneRef.element.style.width = `${100 / clampedScale}%`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function syncFolded() {
|
|
64
|
+
if (paneRef) {
|
|
65
|
+
paneRef.expanded = _expanded;
|
|
66
|
+
}
|
|
67
|
+
expanded = _expanded;
|
|
68
|
+
}
|
|
69
|
+
$: BROWSER && paneRef && setScale(scale);
|
|
70
|
+
$: BROWSER &&
|
|
71
|
+
paneRef &&
|
|
72
|
+
updateCollapsibility(userExpandable, paneRef.element, 'tp-rotv_b', 'tp-rotv_m');
|
|
73
|
+
$: BROWSER && paneRef && title && (paneRef.title = title);
|
|
74
|
+
$: BROWSER && paneRef && applyTheme(paneRef.element, theme);
|
|
75
|
+
$: _expanded, BROWSER && paneRef && syncFolded();
|
|
76
|
+
$: BROWSER && paneRef && (_expanded = expanded);
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
{#if BROWSER}
|
|
80
|
+
<slot />
|
|
81
|
+
{:else if expanded}
|
|
82
|
+
{#if title === undefined}
|
|
83
|
+
<ClsPad keysAdd={['containerVerticalPadding']} {theme} />
|
|
84
|
+
{:else}
|
|
85
|
+
<ClsPad
|
|
86
|
+
keysAdd={[
|
|
87
|
+
'containerVerticalPadding',
|
|
88
|
+
'containerVerticalPadding',
|
|
89
|
+
'containerVerticalPadding',
|
|
90
|
+
'containerUnitSize'
|
|
91
|
+
]}
|
|
92
|
+
{theme}
|
|
93
|
+
/>
|
|
94
|
+
{/if}
|
|
95
|
+
<slot />
|
|
96
|
+
{:else if title === undefined}
|
|
97
|
+
<!-- Nothing renders -->
|
|
98
|
+
{:else}
|
|
99
|
+
<ClsPad keysAdd={['containerVerticalPadding', 'containerUnitSize']} {theme} />
|
|
100
|
+
{/if}
|