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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/dist/control/ButtonGrid.svelte +49 -0
  4. package/dist/control/ButtonGrid.svelte.d.ts +190 -0
  5. package/dist/control/Checkbox.svelte +6 -0
  6. package/dist/control/Checkbox.svelte.d.ts +113 -0
  7. package/dist/control/Color.svelte +79 -0
  8. package/dist/control/Color.svelte.d.ts +177 -0
  9. package/dist/control/CubicBezier.svelte +74 -0
  10. package/dist/control/CubicBezier.svelte.d.ts +204 -0
  11. package/dist/control/Image.svelte +23 -0
  12. package/dist/control/Image.svelte.d.ts +177 -0
  13. package/dist/control/IntervalSlider.svelte +37 -0
  14. package/dist/control/IntervalSlider.svelte.d.ts +196 -0
  15. package/dist/control/List.svelte +69 -0
  16. package/dist/control/List.svelte.d.ts +122 -0
  17. package/dist/control/Point.svelte +100 -0
  18. package/dist/control/Point.svelte.d.ts +374 -0
  19. package/dist/control/RadioGrid.svelte +42 -0
  20. package/dist/control/RadioGrid.svelte.d.ts +231 -0
  21. package/dist/control/Ring.svelte +19 -0
  22. package/dist/control/Ring.svelte.d.ts +220 -0
  23. package/dist/control/RotationEuler.svelte +67 -0
  24. package/dist/control/RotationEuler.svelte.d.ts +273 -0
  25. package/dist/control/RotationQuaternion.svelte +65 -0
  26. package/dist/control/RotationQuaternion.svelte.d.ts +276 -0
  27. package/dist/control/Slider.svelte +6 -0
  28. package/dist/control/Slider.svelte.d.ts +165 -0
  29. package/dist/control/Text.svelte +25 -0
  30. package/dist/control/Text.svelte.d.ts +129 -0
  31. package/dist/control/Textarea.svelte +47 -0
  32. package/dist/control/Textarea.svelte.d.ts +149 -0
  33. package/dist/control/Wheel.svelte +15 -0
  34. package/dist/control/Wheel.svelte.d.ts +186 -0
  35. package/dist/core/Binding.svelte +68 -0
  36. package/dist/core/Binding.svelte.d.ts +116 -0
  37. package/dist/core/Blade.svelte +61 -0
  38. package/dist/core/Blade.svelte.d.ts +90 -0
  39. package/dist/core/Button.svelte +59 -0
  40. package/dist/core/Button.svelte.d.ts +65 -0
  41. package/dist/core/Folder.svelte +69 -0
  42. package/dist/core/Folder.svelte.d.ts +78 -0
  43. package/dist/core/Pane.svelte +51 -0
  44. package/dist/core/Pane.svelte.d.ts +500 -0
  45. package/dist/core/Separator.svelte +14 -0
  46. package/dist/core/Separator.svelte.d.ts +85 -0
  47. package/dist/core/TabGroup.svelte +64 -0
  48. package/dist/core/TabGroup.svelte.d.ts +72 -0
  49. package/dist/core/TabPage.svelte +85 -0
  50. package/dist/core/TabPage.svelte.d.ts +82 -0
  51. package/dist/extra/AutoObject.svelte +46 -0
  52. package/dist/extra/AutoObject.svelte.d.ts +108 -0
  53. package/dist/extra/AutoValue.svelte +11 -0
  54. package/dist/extra/AutoValue.svelte.d.ts +123 -0
  55. package/dist/extra/Element.svelte +53 -0
  56. package/dist/extra/Element.svelte.d.ts +170 -0
  57. package/dist/index.d.ts +94 -0
  58. package/dist/index.js +39 -0
  59. package/dist/internal/ClsPad.svelte +34 -0
  60. package/dist/internal/ClsPad.svelte.d.ts +95 -0
  61. package/dist/internal/GenericBinding.svelte +22 -0
  62. package/dist/internal/GenericBinding.svelte.d.ts +116 -0
  63. package/dist/internal/GenericBladeFolding.svelte +38 -0
  64. package/dist/internal/GenericBladeFolding.svelte.d.ts +95 -0
  65. package/dist/internal/GenericInput.svelte +19 -0
  66. package/dist/internal/GenericInput.svelte.d.ts +116 -0
  67. package/dist/internal/GenericInputFolding.svelte +40 -0
  68. package/dist/internal/GenericInputFolding.svelte.d.ts +140 -0
  69. package/dist/internal/GenericMonitor.svelte +24 -0
  70. package/dist/internal/GenericMonitor.svelte.d.ts +139 -0
  71. package/dist/internal/GenericPane.svelte +100 -0
  72. package/dist/internal/GenericPane.svelte.d.ts +84 -0
  73. package/dist/internal/GenericSlider.svelte +27 -0
  74. package/dist/internal/GenericSlider.svelte.d.ts +146 -0
  75. package/dist/internal/InternalMonitorBoolean.svelte +17 -0
  76. package/dist/internal/InternalMonitorBoolean.svelte.d.ts +154 -0
  77. package/dist/internal/InternalMonitorNumber.svelte +31 -0
  78. package/dist/internal/InternalMonitorNumber.svelte.d.ts +178 -0
  79. package/dist/internal/InternalMonitorString.svelte +23 -0
  80. package/dist/internal/InternalMonitorString.svelte.d.ts +162 -0
  81. package/dist/internal/InternalPaneDraggable.svelte +368 -0
  82. package/dist/internal/InternalPaneDraggable.svelte.d.ts +178 -0
  83. package/dist/internal/InternalPaneFixed.svelte +28 -0
  84. package/dist/internal/InternalPaneFixed.svelte.d.ts +119 -0
  85. package/dist/internal/InternalPaneInline.svelte +29 -0
  86. package/dist/internal/InternalPaneInline.svelte.d.ts +106 -0
  87. package/dist/monitor/FpsGraph.svelte +86 -0
  88. package/dist/monitor/FpsGraph.svelte.d.ts +230 -0
  89. package/dist/monitor/Monitor.svelte +14 -0
  90. package/dist/monitor/Monitor.svelte.d.ts +526 -0
  91. package/dist/monitor/Profiler.svelte +72 -0
  92. package/dist/monitor/Profiler.svelte.d.ts +265 -0
  93. package/dist/monitor/WaveformMonitor.svelte +26 -0
  94. package/dist/monitor/WaveformMonitor.svelte.d.ts +176 -0
  95. package/dist/theme.d.ts +91 -0
  96. package/dist/theme.js +332 -0
  97. package/dist/utils.d.ts +157 -0
  98. package/dist/utils.js +238 -0
  99. package/package.json +280 -0
@@ -0,0 +1,84 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ import { type Theme } from '../theme.js';
3
+ import { Pane as TpPane } from 'tweakpane';
4
+ declare const __propDef: {
5
+ props: {
6
+ /**
7
+ * Text in the pane's title bar.
8
+ * @default `Tweakpane` \
9
+ * Unless `position='inline'`, in which case the default is `undefined` and no title bar is
10
+ * shown.
11
+ * */ title?: string | undefined;
12
+ /**
13
+ * Allow users to interactively expand / contract the pane by clicking its title bar.
14
+ *
15
+ * Hides the collapse button from the title bar when `false`.
16
+ * @default `true`
17
+ * */ userExpandable?: boolean | undefined;
18
+ /**
19
+ * Expand or collapse the pane into its title bar.
20
+ * @default `true`
21
+ * @bindable
22
+ * */ expanded?: boolean | undefined;
23
+ /**
24
+ * Custom color scheme.
25
+ *
26
+ * Applies to all child components, but note that setting a different `theme` on a child
27
+ * component's prop will **not** override the parent pane's theme.
28
+ *
29
+ * Note that `<Pane position="inline' ...>` squares off rounded corners by default to better
30
+ * integrate with surrounding content.
31
+ *
32
+ * Simply pass a custom or default theme like `ThemeUtils.presets.standard` if you want rounded
33
+ * corners on an `inline` pane.
34
+ *
35
+ * See also the `setGlobalDefaultTheme()` for a way to set a custom default theme for all panes
36
+ * on the page.
37
+ * @default `undefined` \
38
+ * Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
39
+ * set with `setGlobalDefaultTheme()`.
40
+ * */ theme?: Theme | undefined;
41
+ /**
42
+ * Scales the pane's elements by a factor of `scale` to make it easier to see.
43
+ *
44
+ * Holds the width of the pane constant, so the pane will grow taller as it is scaled and will
45
+ * continue to respect position- and size-related props. If you need more breathing room, set
46
+ * the `width` property on the pane.
47
+ *
48
+ * Note that the scaling prop is only available on `<Pane>`, not on stand-alone (implicitly
49
+ * wrapped) inline elements.
50
+ *
51
+ * Negative values are ignored.
52
+ * @default `1`
53
+ */ scale?: number | undefined;
54
+ /** Internal use only. */ userCreatedPane?: boolean | undefined;
55
+ /**
56
+ * Internal use only.
57
+ * @readonly
58
+ * */ paneRef?: TpPane | undefined;
59
+ };
60
+ events: {
61
+ [evt: string]: CustomEvent<any>;
62
+ };
63
+ slots: {
64
+ /**
65
+ * Any Tweakpane component, except another `<Pane>`.
66
+ */
67
+ default: {};
68
+ };
69
+ };
70
+ export type GenericPaneProps = typeof __propDef.props;
71
+ export type GenericPaneEvents = typeof __propDef.events;
72
+ export type GenericPaneSlots = typeof __propDef.slots;
73
+ /**
74
+ * This component is for internal use only.
75
+ *
76
+ * @sourceLink
77
+ * [GenericPane.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/internal/GenericPane.svelte)
78
+ */
79
+ export default class GenericPane extends SvelteComponent<
80
+ GenericPaneProps,
81
+ GenericPaneEvents,
82
+ GenericPaneSlots
83
+ > {}
84
+ export {};
@@ -0,0 +1,27 @@
1
+ <script generics="T extends number | IntervalSliderValue">
2
+ import GenericInput from './GenericInput.svelte';
3
+ import { BROWSER } from 'esm-env';
4
+ export let value;
5
+ export let options = void 0;
6
+ export let min = void 0;
7
+ export let max = void 0;
8
+ export let step = void 0;
9
+ export let pointerScale = void 0;
10
+ export let keyScale = void 0;
11
+ export let format = void 0;
12
+ let formatProxy = format;
13
+ $: BROWSER && formatProxy !== format && (formatProxy = format);
14
+ let optionsInternal;
15
+ $: BROWSER &&
16
+ (optionsInternal = {
17
+ min,
18
+ max,
19
+ format: formatProxy,
20
+ keyScale,
21
+ pointerScale,
22
+ step,
23
+ ...options
24
+ });
25
+ </script>
26
+
27
+ <GenericInput bind:value options={optionsInternal} {...$$restProps} />
@@ -0,0 +1,146 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ import type { IntervalSliderValue } from '../control/IntervalSlider.svelte';
3
+ import type { NumberInputParams as GenericSliderOptions } from 'tweakpane';
4
+ import type { SliderInputBindingApi as GenericSliderRef } from 'tweakpane';
5
+ declare class __sveltets_Render<T extends number | IntervalSliderValue> {
6
+ props(): Omit<
7
+ {
8
+ /**
9
+ * The binding's target object with values to manipulate.
10
+ * @bindable
11
+ */
12
+ object: import('@tweakpane/core').Bindable & {
13
+ [x: string]: T;
14
+ };
15
+ /** The key for the value in the target `object` that the control should manipulate. */
16
+ key: string | number;
17
+ /**
18
+ * Prevent interactivity and gray out the control.
19
+ * @default `false`
20
+ */
21
+ disabled?: boolean | undefined;
22
+ /**
23
+ * Text displayed next to control.
24
+ * @default `undefined`
25
+ */
26
+ label?: string | undefined;
27
+ /**
28
+ * Tweakpane's internal options object.
29
+ *
30
+ * See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
31
+ *
32
+ * Valid types are contingent on the type of the value `key` points to in `object`.
33
+ *
34
+ * This is intended internal use, when implementing convenience components wrapping Binding's
35
+ * functionality. Options of interest are instead exposed as top-level props in _Svelte
36
+ * Tweakpane UI_.
37
+ * @default `undefined`
38
+ */
39
+ options?: GenericSliderOptions | undefined;
40
+ /**
41
+ * Custom color scheme.
42
+ *
43
+ * @default `undefined` \
44
+ * Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
45
+ * set with `setGlobalDefaultTheme()`.
46
+ */
47
+ theme?: import('..').Theme | undefined;
48
+ /**
49
+ * Reference to internal Tweakpane
50
+ * [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
51
+ * this control.
52
+ *
53
+ * This is primarily for internal use, when implementing convenience components wrapping
54
+ * Binding's functionality.
55
+ * @bindable
56
+ * @readonly
57
+ */
58
+ ref?: GenericSliderRef | undefined;
59
+ /**
60
+ * Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
61
+ * the binding's containing `<Pane>`.
62
+ *
63
+ * This is primarily for internal use, when implementing convenience components wrapping
64
+ * Binding's functionality in combination with a Tweakpane plugin.
65
+ * @default `undefined`
66
+ */
67
+ plugin?: import('tweakpane').TpPluginBundle | undefined;
68
+ },
69
+ 'object' | 'key'
70
+ > & {
71
+ /**
72
+ * The value to control.
73
+ * @bindable
74
+ */
75
+ value: T;
76
+ } & {
77
+ /**
78
+ * Minimum value.
79
+ *
80
+ * Specifying both a `min` and a `max` prop turns the control into a slider.
81
+ * @default `undefined`
82
+ * */
83
+ min?: number | undefined;
84
+ /**
85
+ * Maximum value.
86
+ *
87
+ * Specifying both a `min` and a `max` prop turns the control into a slider.
88
+ * @default `undefined`
89
+ * */
90
+ max?: number | undefined;
91
+ /**
92
+ * A function to customize the point value's formatting (e.g. rounding, etc.).
93
+ * @default `undefined` \
94
+ * Normal `.toString()` formatting.
95
+ * */
96
+ format?: ((value: number) => string) | undefined;
97
+ /**
98
+ * The unit scale for key-based input for all dimensions (e.g. the up and down arrow keys).
99
+ * @default `1` \
100
+ * Or `stepValue` if defined.
101
+ * */
102
+ keyScale?: number | undefined;
103
+ /**
104
+ * The unit scale for pointer-based input for all dimensions.
105
+ * @default `undefined` \
106
+ * [Dynamic based on magnitude of
107
+ * `value`](https://github.com/cocopon/tweakpane/blob/66dfbea04bfe9b7f031673c955ceda1f92356e75/packages/core/src/common/number/util.ts#L54).
108
+ * */
109
+ pointerScale?: number | undefined;
110
+ /**
111
+ * The minimum step interval.
112
+ * @default `undefined` \
113
+ * No step constraint.
114
+ * */
115
+ step?: number | undefined;
116
+ };
117
+ events(): {} & {
118
+ [evt: string]: CustomEvent<any>;
119
+ };
120
+ slots(): {};
121
+ }
122
+ export type GenericSliderProps<T extends number | IntervalSliderValue> = ReturnType<
123
+ __sveltets_Render<T>['props']
124
+ >;
125
+ export type GenericSliderEvents<T extends number | IntervalSliderValue> = ReturnType<
126
+ __sveltets_Render<T>['events']
127
+ >;
128
+ export type GenericSliderSlots<T extends number | IntervalSliderValue> = ReturnType<
129
+ __sveltets_Render<T>['slots']
130
+ >;
131
+ /**
132
+ * This component is for internal use only.
133
+ *
134
+ * Note that we go from a regular slider to a range / interval slider (via the essentials plugin) just
135
+ * by changing the input type For the sake of consistency and discoverability, `<IntervalSlider>` is
136
+ * implement as a separate component leveraging this generic implementation.
137
+ *
138
+ * @sourceLink
139
+ * [GenericSlider.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/internal/GenericSlider.svelte)
140
+ */
141
+ export default class GenericSlider<T extends number | IntervalSliderValue> extends SvelteComponent<
142
+ GenericSliderProps<T>,
143
+ GenericSliderEvents<T>,
144
+ GenericSliderSlots<T>
145
+ > {}
146
+ export {};
@@ -0,0 +1,17 @@
1
+ <script context="module"></script>
2
+
3
+ <script>
4
+ import ClsPad from './ClsPad.svelte';
5
+ import GenericMonitor from './GenericMonitor.svelte';
6
+ import { fillWith, rowsForMonitor } from '../utils';
7
+ import { BROWSER } from 'esm-env';
8
+ export let value;
9
+ </script>
10
+
11
+ <GenericMonitor {value} {...$$restProps} />
12
+ {#if !BROWSER}
13
+ {@const totalRows = rowsForMonitor($$props.bufferSize, $$props.rows) - 1}
14
+ {#if totalRows > 0}
15
+ <ClsPad keysAdd={fillWith('containerUnitSize', totalRows)} theme={$$props.theme} />
16
+ {/if}
17
+ {/if}
@@ -0,0 +1,154 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ import type { BooleanMonitorParams } from '@tweakpane/core';
3
+ export type InternalMonitorBooleanOptions = BooleanMonitorParams;
4
+ declare const __propDef: {
5
+ props: Omit<
6
+ Omit<
7
+ {
8
+ /**
9
+ * The binding's target object with values to manipulate.
10
+ * @bindable
11
+ */
12
+ object: import('@tweakpane/core').Bindable & {
13
+ [x: string]: boolean;
14
+ };
15
+ /** The key for the value in the target `object` that the control should manipulate. */
16
+ key: string | number;
17
+ /**
18
+ * Prevent interactivity and gray out the control.
19
+ * @default `false`
20
+ */
21
+ disabled?: boolean | undefined;
22
+ /**
23
+ * Text displayed next to control.
24
+ * @default `undefined`
25
+ */
26
+ label?: string | undefined;
27
+ /**
28
+ * Tweakpane's internal options object.
29
+ *
30
+ * See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
31
+ *
32
+ * Valid types are contingent on the type of the value `key` points to in `object`.
33
+ *
34
+ * This is intended internal use, when implementing convenience components wrapping Binding's
35
+ * functionality. Options of interest are instead exposed as top-level props in _Svelte
36
+ * Tweakpane UI_.
37
+ * @default `undefined`
38
+ */
39
+ options?: BooleanMonitorParams | undefined;
40
+ /**
41
+ * Custom color scheme.
42
+ *
43
+ * @default `undefined` \
44
+ * Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
45
+ * set with `setGlobalDefaultTheme()`.
46
+ */
47
+ theme?: import('..').Theme | undefined;
48
+ /**
49
+ * Reference to internal Tweakpane
50
+ * [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
51
+ * this control.
52
+ *
53
+ * This is primarily for internal use, when implementing convenience components wrapping
54
+ * Binding's functionality.
55
+ * @bindable
56
+ * @readonly
57
+ */
58
+ ref?: import('./GenericMonitor.svelte').GenericMonitorRef | undefined;
59
+ /**
60
+ * Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
61
+ * the binding's containing `<Pane>`.
62
+ *
63
+ * This is primarily for internal use, when implementing convenience components wrapping
64
+ * Binding's functionality in combination with a Tweakpane plugin.
65
+ * @default `undefined`
66
+ */
67
+ plugin?: import('@tweakpane/core').TpPluginBundle | undefined;
68
+ },
69
+ 'object' | 'key'
70
+ > & {
71
+ /**
72
+ * A `boolean` value to monitor.
73
+ */
74
+ value: boolean;
75
+ } & {
76
+ /**
77
+ * Number of past states to retain.
78
+ * @default `1` \
79
+ * Or `64` if value is `number` and `graph` is `true`.
80
+ */
81
+ bufferSize?: number | undefined;
82
+ /**
83
+ * Time between value samples in milliseconds.
84
+ *
85
+ * Useful when `graph` is true. Defaults to reactive value updates only (`interval={0}`).
86
+ * @default `0`
87
+ */
88
+ interval?: number | undefined;
89
+ /**
90
+ * Number of visible rows of state history.
91
+ *
92
+ * If `bufferSize` is larger, then the value window will scroll once state history exceeds
93
+ * row count.
94
+ * @default `1` \
95
+ * Or `3` if value is `string` and `multiline` is `true`.
96
+ */
97
+ rows?: number | undefined;
98
+ },
99
+ 'options' | 'ref' | 'plugin' | 'interval'
100
+ > & {
101
+ /**
102
+ * A `boolean` value to monitor.
103
+ * */
104
+ value: boolean;
105
+ };
106
+ events: {
107
+ [evt: string]: CustomEvent<any>;
108
+ };
109
+ slots: {};
110
+ };
111
+ export type InternalMonitorBooleanProps = typeof __propDef.props;
112
+ export type InternalMonitorBooleanEvents = typeof __propDef.events;
113
+ export type InternalMonitorBooleanSlots = typeof __propDef.slots;
114
+ /**
115
+ * This component is for internal use only.
116
+ *
117
+ * Documentation retained in case of a return to the non-dynamic component approach.
118
+ *
119
+ * Wraps the Tweakpane [monitor binding](https://tweakpane.github.io/docs/monitor-bindings/)
120
+ * functionality for boolean values.
121
+ *
122
+ * Technically, any unbound value on a normal _Svelte Tweakpane UI_ component effectively acts as a
123
+ * monitor, but additional monitor-specific components are provided to expose additional view options
124
+ * (e.g. `rows`).
125
+ *
126
+ * Note that `interval` is not exposed because updates are driven by reactive changes in the `value`.
127
+ *
128
+ * Usage outside of a `<Pane>` component will implicitly wrap the monitor in a `<Pane
129
+ * position='inline'>` component.
130
+ *
131
+ * @example
132
+ * ```svelte
133
+ * <script lang="ts">
134
+ * import { InternalMonitorBoolean } from 'svelte-tweakpane-ui';
135
+ *
136
+ * let booleanToMonitor = false;
137
+ *
138
+ * setInterval(() => {
139
+ * booleanToMonitor = Math.random() > 0.5;
140
+ * }, 100);
141
+ * </script>
142
+ *
143
+ * <InternalMonitorBoolean value={booleanToMonitor} bufferSize={5} rows={5} />
144
+ * ```
145
+ *
146
+ * @sourceLink
147
+ * [InternalMonitorBoolean.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/internal/InternalMonitorBoolean.svelte)
148
+ */
149
+ export default class InternalMonitorBoolean extends SvelteComponent<
150
+ InternalMonitorBooleanProps,
151
+ InternalMonitorBooleanEvents,
152
+ InternalMonitorBooleanSlots
153
+ > {}
154
+ export {};
@@ -0,0 +1,31 @@
1
+ <script context="module"></script>
2
+
3
+ <script>
4
+ import ClsPad from './ClsPad.svelte';
5
+ import GenericMonitor from './GenericMonitor.svelte';
6
+ import { fillWith, rowsForMonitor } from '../utils.js';
7
+ import { BROWSER } from 'esm-env';
8
+ export let value;
9
+ export let graph = void 0;
10
+ export let format = void 0;
11
+ export let max = void 0;
12
+ export let min = void 0;
13
+ let options;
14
+ let formatProxy = format;
15
+ $: formatProxy !== format && (formatProxy = format);
16
+ $: options = {
17
+ min,
18
+ max,
19
+ format: formatProxy,
20
+ readonly: true,
21
+ view: graph ? 'graph' : void 0
22
+ };
23
+ </script>
24
+
25
+ <GenericMonitor {value} {options} {...$$restProps} />
26
+ {#if !BROWSER}
27
+ {@const totalRows = rowsForMonitor($$props.bufferSize, $$props.rows, graph) - 1}
28
+ {#if totalRows > 0}
29
+ <ClsPad keysAdd={fillWith('containerUnitSize', totalRows)} theme={$$props.theme} />
30
+ {/if}
31
+ {/if}
@@ -0,0 +1,178 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ import type { NumberMonitorParams } from '@tweakpane/core';
3
+ export type InternalMonitorNumberOptions = NumberMonitorParams;
4
+ declare const __propDef: {
5
+ props: Omit<
6
+ Omit<
7
+ {
8
+ /**
9
+ * The binding's target object with values to manipulate.
10
+ * @bindable
11
+ */
12
+ object: import('@tweakpane/core').Bindable & {
13
+ [x: string]: number;
14
+ };
15
+ /** The key for the value in the target `object` that the control should manipulate. */
16
+ key: string | number;
17
+ /**
18
+ * Prevent interactivity and gray out the control.
19
+ * @default `false`
20
+ */
21
+ disabled?: boolean | undefined;
22
+ /**
23
+ * Text displayed next to control.
24
+ * @default `undefined`
25
+ */
26
+ label?: string | undefined;
27
+ /**
28
+ * Tweakpane's internal options object.
29
+ *
30
+ * See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
31
+ *
32
+ * Valid types are contingent on the type of the value `key` points to in `object`.
33
+ *
34
+ * This is intended internal use, when implementing convenience components wrapping Binding's
35
+ * functionality. Options of interest are instead exposed as top-level props in _Svelte
36
+ * Tweakpane UI_.
37
+ * @default `undefined`
38
+ */
39
+ options?: NumberMonitorParams | undefined;
40
+ /**
41
+ * Custom color scheme.
42
+ *
43
+ * @default `undefined` \
44
+ * Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
45
+ * set with `setGlobalDefaultTheme()`.
46
+ */
47
+ theme?: import('..').Theme | undefined;
48
+ /**
49
+ * Reference to internal Tweakpane
50
+ * [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
51
+ * this control.
52
+ *
53
+ * This is primarily for internal use, when implementing convenience components wrapping
54
+ * Binding's functionality.
55
+ * @bindable
56
+ * @readonly
57
+ */
58
+ ref?: import('./GenericMonitor.svelte').GenericMonitorRef | undefined;
59
+ /**
60
+ * Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
61
+ * the binding's containing `<Pane>`.
62
+ *
63
+ * This is primarily for internal use, when implementing convenience components wrapping
64
+ * Binding's functionality in combination with a Tweakpane plugin.
65
+ * @default `undefined`
66
+ */
67
+ plugin?: import('@tweakpane/core').TpPluginBundle | undefined;
68
+ },
69
+ 'object' | 'key'
70
+ > & {
71
+ /**
72
+ * A `number` value to monitor.
73
+ */
74
+ value: number;
75
+ } & {
76
+ /**
77
+ * Number of past states to retain.
78
+ * @default `1` \
79
+ * Or `64` if value is `number` and `graph` is `true`.
80
+ */
81
+ bufferSize?: number | undefined;
82
+ /**
83
+ * Time between value samples in milliseconds.
84
+ *
85
+ * Useful when `graph` is true. Defaults to reactive value updates only (`interval={0}`).
86
+ * @default `0`
87
+ */
88
+ interval?: number | undefined;
89
+ /**
90
+ * Number of visible rows of state history.
91
+ *
92
+ * If `bufferSize` is larger, then the value window will scroll once state history exceeds
93
+ * row count.
94
+ * @default `1` \
95
+ * Or `3` if value is `string` and `multiline` is `true`.
96
+ */
97
+ rows?: number | undefined;
98
+ },
99
+ 'options' | 'ref' | 'plugin'
100
+ > & {
101
+ /**
102
+ * A `number` value to monitor.
103
+ * */
104
+ value: number;
105
+ /**
106
+ * Minimum bound when `graph` is true.
107
+ * @default `0`
108
+ */
109
+ min?: number | undefined;
110
+ /**
111
+ * Maximum bound when `graph` is true.
112
+ * @default `100`
113
+ * */
114
+ max?: number | undefined;
115
+ /**
116
+ * A function to customize the number's formatting (e.g. rounding, etc.).
117
+ * @default `undefined` \
118
+ * Normal `.toString()` formatting.
119
+ * */
120
+ format?: ((value: number) => string) | undefined;
121
+ /**
122
+ * Display a graph of the value's changes over time.
123
+ * @default `false`
124
+ * */
125
+ graph?: boolean | undefined;
126
+ };
127
+ events: {
128
+ [evt: string]: CustomEvent<any>;
129
+ };
130
+ slots: {};
131
+ };
132
+ export type InternalMonitorNumberProps = typeof __propDef.props;
133
+ export type InternalMonitorNumberEvents = typeof __propDef.events;
134
+ export type InternalMonitorNumberSlots = typeof __propDef.slots;
135
+ /**
136
+ * This component is for internal use only.
137
+ *
138
+ * Documentation retained in case of a return to the non-dynamic component approach.
139
+ *
140
+ * Wraps the Tweakpane [monitor binding](https://tweakpane.github.io/docs/monitor-bindings/)
141
+ * functionality for number values.
142
+ *
143
+ * Technically, any unbound value on a normal _Svelte Tweakpane UI_ component effectively acts as a
144
+ * monitor, but additional monitor-specific components are provided to expose additional view options
145
+ * (e.g. `max` and `min`).
146
+ *
147
+ * Note that `interval` is exposed to allow separate control over the reactive value's update rate and
148
+ * the graph's update rate.
149
+ *
150
+ * Usage outside of a `<Pane>` component will implicitly wrap the monitor in a `<Pane
151
+ * position='inline'>` component.
152
+ *
153
+ * @example
154
+ * ```svelte
155
+ * <script lang="ts">
156
+ * import { InternalMonitorNumber } from 'svelte-tweakpane-ui';
157
+ *
158
+ * let numberToMonitor = 0;
159
+ * let t = 0;
160
+ *
161
+ * setInterval(() => {
162
+ * numberToMonitor = Math.sin(t);
163
+ * t += 0.3;
164
+ * }, 100);
165
+ * </script>
166
+ *
167
+ * <InternalMonitorNumber value={numberToMonitor} min={-1} max={1} graph={true} />
168
+ * ```
169
+ *
170
+ * @sourceLink
171
+ * [InternalMonitorNumber.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/internal/InternalMonitorNumber.svelte)
172
+ */
173
+ export default class InternalMonitorNumber extends SvelteComponent<
174
+ InternalMonitorNumberProps,
175
+ InternalMonitorNumberEvents,
176
+ InternalMonitorNumberSlots
177
+ > {}
178
+ export {};
@@ -0,0 +1,23 @@
1
+ <script context="module"></script>
2
+
3
+ <script>
4
+ import ClsPad from './ClsPad.svelte';
5
+ import GenericMonitor from './GenericMonitor.svelte';
6
+ import { fillWith, rowsForMonitor } from '../utils';
7
+ import { BROWSER } from 'esm-env';
8
+ export let value;
9
+ export let multiline = void 0;
10
+ let options;
11
+ $: options = {
12
+ multiline,
13
+ readonly: true
14
+ };
15
+ </script>
16
+
17
+ <GenericMonitor {value} {options} {...$$restProps} />
18
+ {#if !BROWSER}
19
+ {@const totalRows = rowsForMonitor($$props.bufferSize, $$props.rows, multiline) - 1}
20
+ {#if totalRows > 0}
21
+ <ClsPad keysAdd={fillWith('containerUnitSize', totalRows)} theme={$$props.theme} />
22
+ {/if}
23
+ {/if}