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,170 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ import type { BladeRef } from '../core/Blade.svelte';
3
+ declare const __propDef: {
4
+ props: Omit<
5
+ {
6
+ /**
7
+ * Blade configuration exposing Tweakpane's internal
8
+ * [`BladeParams`](https://tweakpane.github.io/docs/api/interfaces/BaseBladeParams.html).
9
+ *
10
+ */
11
+ options: import('tweakpane').BaseBladeParams;
12
+ /**
13
+ * Prevent interactivity and gray out the control.
14
+ * @default `false`
15
+ */
16
+ disabled?: boolean | undefined;
17
+ /**
18
+ * Custom color scheme.
19
+ * @default `undefined` \
20
+ * Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
21
+ * set with `setGlobalDefaultTheme()`.
22
+ */
23
+ theme?: import('..').Theme | undefined;
24
+ /**
25
+ * Reference to internal Tweakpane
26
+ * [`BladeApi`](https://tweakpane.github.io/docs/api/classes/BladeApi.html) for this blade.
27
+ *
28
+ * This is primarily for internal use, when implementing convenience components wrapping Blade's
29
+ * functionality.
30
+ * @bindable
31
+ * @readonly
32
+ */
33
+ ref?: BladeRef | undefined;
34
+ /**
35
+ * Imported Tweakpane `TpPluginBundle` (Aliased as `Plugin`) module to register before creating
36
+ * the blade.
37
+ *
38
+ * This is primarily for internal use, when implementing convenience components wrapping Blade's
39
+ * functionality in combination with a Tweakpane plugin.
40
+ * @default `undefined`
41
+ */
42
+ plugin?: import('tweakpane').TpPluginBundle | undefined;
43
+ },
44
+ 'options' | 'disabled' | 'ref' | 'plugin'
45
+ > & {
46
+ /**
47
+ * Maximum height of the element block, in pixels. By default, the element block will expand
48
+ * vertically to fit its contents, but clip any horizontal excess.
49
+ *
50
+ * If a max height is set, it is used as the component height during SSR. If the actual
51
+ * element content is less than the max, you will see CLS. If it is not set, the contents
52
+ * are rendered... but keep in mind that style and other contextual changes during the
53
+ * client render could result in CLS.
54
+ * @default `undefined` \
55
+ * No max height.
56
+ */
57
+ maxHeight?: number | undefined;
58
+ /**
59
+ * Whether to reset the CSS of the element block to its default values. Avoids inheritance
60
+ * of Tweakpane's CSS styles. Note that this uses a simple `all: initial;` rule.
61
+ * @default `true`
62
+ */
63
+ resetStyle?: boolean | undefined;
64
+ };
65
+ events: {
66
+ [evt: string]: CustomEvent<any>;
67
+ };
68
+ slots: {
69
+ /**
70
+ * Any HTML Element.
71
+ */
72
+ default: {};
73
+ };
74
+ };
75
+ export type ElementProps = typeof __propDef.props;
76
+ export type ElementEvents = typeof __propDef.events;
77
+ export type ElementSlots = typeof __propDef.slots;
78
+ /**
79
+ * A component for embedding arbitrary HTML elements into a pane.
80
+ *
81
+ * Any children wrapped in this component will be rendered into the pane. Any content larger than the
82
+ * pane in the horizontal axis will be clipped.
83
+ *
84
+ * Useful for quickly prototyping UIs, or adding content to a pane that's not easily represented by the
85
+ * built-in components.
86
+ *
87
+ * Think of this component as an escape hatch for getting something into the pane that you couldn't
88
+ * otherwise, but it's recommended to abstract new functionality for reuse by extending one of the
89
+ * internal component types in 'svelte-tweakpane-ui', or better yet by creating a new [Tweakpane
90
+ * Plugin](https://github.com/tweakpane/plugin-template).
91
+ *
92
+ * In many cases, this component should not be necessary because _Svelte Tweakpane UI_ already makes it
93
+ * easy to combine tweakpane components with other inline elements simply by not using a wrapping
94
+ * `<Pane>` component. It should generally be the most useful when you're using `<Pane
95
+ * position='draggable'>` or `<Pane position='fixed'>` and you want a custom element embedded in the
96
+ * pane.
97
+ *
98
+ * Usage outside of a `<Pane>` component doesn't make a ton of sense, but in such a case the
99
+ * `<Element>` will be implicitly wrapped in `<Pane position='inline'>`.
100
+ *
101
+ * @example
102
+ * ```svelte
103
+ * <script lang="ts">
104
+ * import { Button, Element, Pane, Wheel } from 'svelte-tweakpane-ui';
105
+ *
106
+ * let gradientAngle = 45;
107
+ * let textAngle = 0;
108
+ * </script>
109
+ *
110
+ * <Pane position="inline" title="Element Demo">
111
+ * <Wheel
112
+ * bind:value={gradientAngle}
113
+ * format={(v) => `${(Math.abs(v) % 360).toFixed(0)}°`}
114
+ * label="Gradient Angle"
115
+ * pointerScale={-5}
116
+ * />
117
+ * <Wheel
118
+ * bind:value={textAngle}
119
+ * format={(v) => `${(Math.abs(v) % 360).toFixed(0)}°`}
120
+ * label="Text Angle"
121
+ * pointerScale={-2}
122
+ * />
123
+ * <Element>
124
+ * <div class="demo" style:--a="{gradientAngle}deg">
125
+ * <p style:rotate="{textAngle}deg">
126
+ * <code>&lt;Pane&gt;</code><br />
127
+ * <code>&lt;Element&gt;</code><br />
128
+ * Whatever you want.<br />
129
+ * <code>&lt;/Element&gt;</code><br />
130
+ * <code>&lt;/Pane&gt;</code>
131
+ * </p>
132
+ * </div>
133
+ * </Element>
134
+ * <Button
135
+ * on:click={() => {
136
+ * gradientAngle = 45;
137
+ * textAngle = 0;
138
+ * }}
139
+ * disabled={gradientAngle == 45 && textAngle == 0}
140
+ * title="Reset"
141
+ * />
142
+ * </Pane>
143
+ *
144
+ * <style>
145
+ * .demo {
146
+ * display: grid;
147
+ * place-content: center;
148
+ * aspect-ratio: 1;
149
+ * width: 100%;
150
+ * background: linear-gradient(var(--a), orange, magenta);
151
+ * }
152
+ *
153
+ * .demo > p {
154
+ * font-family: sans-serif;
155
+ * font-size: 1rem;
156
+ * color: white;
157
+ * text-align: center;
158
+ * }
159
+ *
160
+ * .demo > p > code {
161
+ * color: white;
162
+ * }
163
+ * </style>
164
+ * ```
165
+ *
166
+ * @sourceLink
167
+ * [Element.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/extra/Element.svelte)
168
+ */
169
+ export default class Element extends SvelteComponent<ElementProps, ElementEvents, ElementSlots> {}
170
+ export {};
@@ -0,0 +1,94 @@
1
+ export { type ButtonGridClickEvent, default as ButtonGrid } from './control/ButtonGrid.svelte';
2
+ export { default as Checkbox } from './control/Checkbox.svelte';
3
+ export {
4
+ type ColorValue,
5
+ type ColorValueRgbObject,
6
+ type ColorValueRgbTuple,
7
+ type ColorValueRgbaObject,
8
+ type ColorValueRgbaTuple,
9
+ type ColorValueString,
10
+ default as Color
11
+ } from './control/Color.svelte';
12
+ export {
13
+ type CubicBezierValue,
14
+ type CubicBezierValueObject,
15
+ type CubicBezierValueTuple,
16
+ default as CubicBezier
17
+ } from './control/CubicBezier.svelte';
18
+ export { type ImageValue, default as Image } from './control/Image.svelte';
19
+ export {
20
+ type IntervalSliderValue,
21
+ type IntervalSliderValueObject,
22
+ type IntervalSliderValueTuple,
23
+ default as IntervalSlider
24
+ } from './control/IntervalSlider.svelte';
25
+ export {
26
+ type ListOptions,
27
+ type ListOptionsArray,
28
+ type ListOptionsObjectArray,
29
+ type ListOptionsRecord,
30
+ default as List
31
+ } from './control/List.svelte';
32
+ export {
33
+ type PointOptions,
34
+ type PointValue2d,
35
+ type PointValue2dObject,
36
+ type PointValue2dTuple,
37
+ type PointValue3d,
38
+ type PointValue3dObject,
39
+ type PointValue3dTuple,
40
+ type PointValue4d,
41
+ type PointValue4dObject,
42
+ type PointValue4dTuple,
43
+ default as Point
44
+ } from './control/Point.svelte';
45
+ export { default as RadioGrid } from './control/RadioGrid.svelte';
46
+ export { type RingSeries, type RingUnit, default as Ring } from './control/Ring.svelte';
47
+ export {
48
+ type RotationEulerOptions,
49
+ type RotationEulerOrder,
50
+ type RotationEulerUnit,
51
+ type RotationEulerValue,
52
+ type RotationEulerValueObject,
53
+ type RotationEulerValueTuple,
54
+ default as RotationEuler
55
+ } from './control/RotationEuler.svelte';
56
+ export {
57
+ type RotationQuaternionOptions,
58
+ type RotationQuaternionValue,
59
+ type RotationQuaternionValueObject,
60
+ type RotationQuaternionValueTuple,
61
+ default as RotationQuaternion
62
+ } from './control/RotationQuaternion.svelte';
63
+ export { default as Slider } from './control/Slider.svelte';
64
+ export { default as Text } from './control/Text.svelte';
65
+ export { default as Textarea } from './control/Textarea.svelte';
66
+ export { default as Wheel } from './control/Wheel.svelte';
67
+ export { type BindingOptions, type BindingRef, default as Binding } from './core/Binding.svelte';
68
+ export { type BladeOptions, type BladeRef, default as Blade } from './core/Blade.svelte';
69
+ export { type ButtonClickEvent, default as Button } from './core/Button.svelte';
70
+ export { default as Folder } from './core/Folder.svelte';
71
+ export { type PanePosition, default as Pane } from './core/Pane.svelte';
72
+ export { default as Separator } from './core/Separator.svelte';
73
+ export { default as TabGroup } from './core/TabGroup.svelte';
74
+ export { default as TabPage } from './core/TabPage.svelte';
75
+ export { default as AutoObject } from './extra/AutoObject.svelte';
76
+ export { default as AutoValue } from './extra/AutoValue.svelte';
77
+ export { default as Element } from './extra/Element.svelte';
78
+ export { type FpsGraphChangeEvent, default as FpsGraph } from './monitor/FpsGraph.svelte';
79
+ export { default as Monitor } from './monitor/Monitor.svelte';
80
+ export {
81
+ type ProfilerCalcMode,
82
+ type ProfilerMeasure,
83
+ type ProfilerMeasureAsync,
84
+ type ProfilerMeasureHandler,
85
+ default as Profiler
86
+ } from './monitor/Profiler.svelte';
87
+ export {
88
+ type WaveformMonitorValue,
89
+ default as WaveformMonitor
90
+ } from './monitor/WaveformMonitor.svelte';
91
+ export type { Theme, ThemeColorValue } from './theme.js';
92
+ export { default as ThemeUtils } from './theme.js';
93
+ export type { BindingObject, Plugin } from './utils.js';
94
+ export { default as Utils } from './utils.js';
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ // components
2
+ // essentials (1st party plugins)
3
+ export { default as ButtonGrid } from './control/ButtonGrid.svelte';
4
+ export { default as Checkbox } from './control/Checkbox.svelte';
5
+ export { default as Color } from './control/Color.svelte';
6
+ export { default as CubicBezier } from './control/CubicBezier.svelte';
7
+ // additional plugins (3rd party / community)
8
+ export { default as Image } from './control/Image.svelte';
9
+ export { default as IntervalSlider } from './control/IntervalSlider.svelte';
10
+ export { default as List } from './control/List.svelte';
11
+ export { default as Point } from './control/Point.svelte';
12
+ export { default as RadioGrid } from './control/RadioGrid.svelte';
13
+ // camerakit (1st party plugins)
14
+ export { default as Ring } from './control/Ring.svelte';
15
+ export { default as RotationEuler } from './control/RotationEuler.svelte';
16
+ export { default as RotationQuaternion } from './control/RotationQuaternion.svelte';
17
+ export { default as Slider } from './control/Slider.svelte';
18
+ export { default as Text } from './control/Text.svelte';
19
+ export { default as Textarea } from './control/Textarea.svelte';
20
+ export { default as Wheel } from './control/Wheel.svelte';
21
+ // core (tweakpane building blocks)
22
+ export { default as Binding } from './core/Binding.svelte';
23
+ export { default as Blade } from './core/Blade.svelte';
24
+ export { default as Button } from './core/Button.svelte';
25
+ export { default as Folder } from './core/Folder.svelte';
26
+ export { default as Pane } from './core/Pane.svelte';
27
+ export { default as Separator } from './core/Separator.svelte';
28
+ export { default as TabGroup } from './core/TabGroup.svelte';
29
+ export { default as TabPage } from './core/TabPage.svelte';
30
+ // extra (svelte convenience components)
31
+ export { default as AutoObject } from './extra/AutoObject.svelte';
32
+ export { default as AutoValue } from './extra/AutoValue.svelte';
33
+ export { default as Element } from './extra/Element.svelte';
34
+ export { default as FpsGraph } from './monitor/FpsGraph.svelte';
35
+ export { default as Monitor } from './monitor/Monitor.svelte';
36
+ export { default as Profiler } from './monitor/Profiler.svelte';
37
+ export { default as WaveformMonitor } from './monitor/WaveformMonitor.svelte';
38
+ export { default as ThemeUtils } from './theme.js';
39
+ export { default as Utils } from './utils.js';
@@ -0,0 +1,34 @@
1
+ <script>
2
+ import { getValueOrFallback } from '../theme.js';
3
+ import { DEV } from 'esm-env';
4
+ export let theme = void 0;
5
+ export let keysAdd = [];
6
+ export let keysSubtract = [];
7
+ export let extra = void 0;
8
+ const showDebugBlocks = false;
9
+ function getRandomCssColor() {
10
+ return '#' + Math.floor(Math.random() * 16777215).toString(16);
11
+ }
12
+ function getPixelValue(s) {
13
+ return parseFloat(s.replace('px', ''));
14
+ }
15
+ function getTotal(add, sub, extra2 = 0) {
16
+ return (
17
+ add.reduce((acc, key) => {
18
+ return (acc += getPixelValue(getValueOrFallback(theme, key)));
19
+ }, 0) -
20
+ sub.reduce((acc, key) => {
21
+ return (acc += getPixelValue(getValueOrFallback(theme, key)));
22
+ }, 0) +
23
+ extra2
24
+ );
25
+ }
26
+ $: total = getTotal(keysAdd, keysSubtract, extra);
27
+ </script>
28
+
29
+ {#if total > 0}
30
+ <div
31
+ style:background={DEV && showDebugBlocks ? getRandomCssColor() : null}
32
+ style:height="{total}px"
33
+ />
34
+ {/if}
@@ -0,0 +1,95 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ import { type Theme } from '../theme.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ /**
6
+ * The theme to use when estimating the height of the pane.
7
+ */ theme?: Theme | undefined;
8
+ /**
9
+ * Theme keys to add to the height estimate.
10
+ */ keysAdd?:
11
+ | (keyof {
12
+ baseBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
13
+ baseBorderRadius?: string | undefined;
14
+ baseFontFamily?: string | undefined;
15
+ baseShadowColor?: import('../theme.js').ThemeColorValue | undefined;
16
+ bladeBorderRadius?: string | undefined;
17
+ bladeHorizontalPadding?: string | undefined;
18
+ bladeValueWidth?: string | undefined;
19
+ buttonBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
20
+ buttonBackgroundColorActive?: import('../theme.js').ThemeColorValue | undefined;
21
+ buttonBackgroundColorFocus?: import('../theme.js').ThemeColorValue | undefined;
22
+ buttonBackgroundColorHover?: import('../theme.js').ThemeColorValue | undefined;
23
+ buttonForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
24
+ containerBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
25
+ containerBackgroundColorActive?: import('../theme.js').ThemeColorValue | undefined;
26
+ containerBackgroundColorFocus?: import('../theme.js').ThemeColorValue | undefined;
27
+ containerBackgroundColorHover?: import('../theme.js').ThemeColorValue | undefined;
28
+ containerForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
29
+ containerHorizontalPadding?: string | undefined;
30
+ containerUnitSize?: string | undefined;
31
+ containerUnitSpacing?: string | undefined;
32
+ containerVerticalPadding?: string | undefined;
33
+ grooveForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
34
+ inputBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
35
+ inputBackgroundColorActive?: import('../theme.js').ThemeColorValue | undefined;
36
+ inputBackgroundColorFocus?: import('../theme.js').ThemeColorValue | undefined;
37
+ inputBackgroundColorHover?: import('../theme.js').ThemeColorValue | undefined;
38
+ inputForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
39
+ labelForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
40
+ monitorBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
41
+ monitorForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
42
+ pluginImageDraggingColor?: import('../theme.js').ThemeColorValue | undefined;
43
+ })[]
44
+ | undefined;
45
+ /**
46
+ * Theme keys to subtract from the height estimate.
47
+ */ keysSubtract?:
48
+ | (keyof {
49
+ baseBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
50
+ baseBorderRadius?: string | undefined;
51
+ baseFontFamily?: string | undefined;
52
+ baseShadowColor?: import('../theme.js').ThemeColorValue | undefined;
53
+ bladeBorderRadius?: string | undefined;
54
+ bladeHorizontalPadding?: string | undefined;
55
+ bladeValueWidth?: string | undefined;
56
+ buttonBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
57
+ buttonBackgroundColorActive?: import('../theme.js').ThemeColorValue | undefined;
58
+ buttonBackgroundColorFocus?: import('../theme.js').ThemeColorValue | undefined;
59
+ buttonBackgroundColorHover?: import('../theme.js').ThemeColorValue | undefined;
60
+ buttonForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
61
+ containerBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
62
+ containerBackgroundColorActive?: import('../theme.js').ThemeColorValue | undefined;
63
+ containerBackgroundColorFocus?: import('../theme.js').ThemeColorValue | undefined;
64
+ containerBackgroundColorHover?: import('../theme.js').ThemeColorValue | undefined;
65
+ containerForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
66
+ containerHorizontalPadding?: string | undefined;
67
+ containerUnitSize?: string | undefined;
68
+ containerUnitSpacing?: string | undefined;
69
+ containerVerticalPadding?: string | undefined;
70
+ grooveForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
71
+ inputBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
72
+ inputBackgroundColorActive?: import('../theme.js').ThemeColorValue | undefined;
73
+ inputBackgroundColorFocus?: import('../theme.js').ThemeColorValue | undefined;
74
+ inputBackgroundColorHover?: import('../theme.js').ThemeColorValue | undefined;
75
+ inputForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
76
+ labelForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
77
+ monitorBackgroundColor?: import('../theme.js').ThemeColorValue | undefined;
78
+ monitorForegroundColor?: import('../theme.js').ThemeColorValue | undefined;
79
+ pluginImageDraggingColor?: import('../theme.js').ThemeColorValue | undefined;
80
+ })[]
81
+ | undefined;
82
+ /**
83
+ * Extra arbitrary space to add to the height estimate, in pixels.
84
+ */ extra?: number | undefined;
85
+ };
86
+ events: {
87
+ [evt: string]: CustomEvent<any>;
88
+ };
89
+ slots: {};
90
+ };
91
+ export type ClsPadProps = typeof __propDef.props;
92
+ export type ClsPadEvents = typeof __propDef.events;
93
+ export type ClsPadSlots = typeof __propDef.slots;
94
+ export default class ClsPad extends SvelteComponent<ClsPadProps, ClsPadEvents, ClsPadSlots> {}
95
+ export {};
@@ -0,0 +1,22 @@
1
+ <script context="module"></script>
2
+
3
+ <script
4
+ generics="T extends any, U extends BindingOptions = BindingOptions, V extends BindingRef = BindingRef"
5
+ >
6
+ import Binding from '../core/Binding.svelte';
7
+ export let value;
8
+ export let ref = void 0;
9
+ export let options = void 0;
10
+ const key = Symbol('key');
11
+ function getValue() {
12
+ return value;
13
+ }
14
+ function setValue() {
15
+ object[key] = value;
16
+ }
17
+ $: object = { [key]: getValue() };
18
+ $: value = object[key];
19
+ $: value, setValue();
20
+ </script>
21
+
22
+ <Binding bind:object bind:ref {key} {options} {...$$restProps} />
@@ -0,0 +1,116 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ import type { BindingOptions, BindingRef } from '../core/Binding.svelte';
3
+ declare class __sveltets_Render<
4
+ T extends any,
5
+ U extends BindingOptions = BindingOptions,
6
+ V extends BindingRef = BindingRef
7
+ > {
8
+ props(): Omit<
9
+ {
10
+ /**
11
+ * The binding's target object with values to manipulate.
12
+ * @bindable
13
+ */
14
+ object: import('@tweakpane/core').Bindable & {
15
+ [x: string]: T;
16
+ };
17
+ /** The key for the value in the target `object` that the control should manipulate. */
18
+ key: string | number;
19
+ /**
20
+ * Prevent interactivity and gray out the control.
21
+ * @default `false`
22
+ */
23
+ disabled?: boolean | undefined;
24
+ /**
25
+ * Text displayed next to control.
26
+ * @default `undefined`
27
+ */
28
+ label?: string | undefined;
29
+ /**
30
+ * Tweakpane's internal options object.
31
+ *
32
+ * See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
33
+ *
34
+ * Valid types are contingent on the type of the value `key` points to in `object`.
35
+ *
36
+ * This is intended internal use, when implementing convenience components wrapping Binding's
37
+ * functionality. Options of interest are instead exposed as top-level props in _Svelte
38
+ * Tweakpane UI_.
39
+ * @default `undefined`
40
+ */
41
+ options?: U | undefined;
42
+ /**
43
+ * Custom color scheme.
44
+ *
45
+ * @default `undefined` \
46
+ * Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
47
+ * set with `setGlobalDefaultTheme()`.
48
+ */
49
+ theme?: import('..').Theme | undefined;
50
+ /**
51
+ * Reference to internal Tweakpane
52
+ * [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
53
+ * this control.
54
+ *
55
+ * This is primarily for internal use, when implementing convenience components wrapping
56
+ * Binding's functionality.
57
+ * @bindable
58
+ * @readonly
59
+ */
60
+ ref?: V | undefined;
61
+ /**
62
+ * Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
63
+ * the binding's containing `<Pane>`.
64
+ *
65
+ * This is primarily for internal use, when implementing convenience components wrapping
66
+ * Binding's functionality in combination with a Tweakpane plugin.
67
+ * @default `undefined`
68
+ */
69
+ plugin?: import('tweakpane').TpPluginBundle | undefined;
70
+ },
71
+ 'object' | 'key'
72
+ > & {
73
+ /**
74
+ * The value to control.
75
+ * @bindable
76
+ * */
77
+ value: T;
78
+ };
79
+ events(): {} & {
80
+ [evt: string]: CustomEvent<any>;
81
+ };
82
+ slots(): {};
83
+ }
84
+ export type GenericBindingProps<
85
+ T extends any,
86
+ U extends BindingOptions = BindingOptions,
87
+ V extends BindingRef = BindingRef
88
+ > = ReturnType<__sveltets_Render<T, U, V>['props']>;
89
+ export type GenericBindingEvents<
90
+ T extends any,
91
+ U extends BindingOptions = BindingOptions,
92
+ V extends BindingRef = BindingRef
93
+ > = ReturnType<__sveltets_Render<T, U, V>['events']>;
94
+ export type GenericBindingSlots<
95
+ T extends any,
96
+ U extends BindingOptions = BindingOptions,
97
+ V extends BindingRef = BindingRef
98
+ > = ReturnType<__sveltets_Render<T, U, V>['slots']>;
99
+ /**
100
+ * This component is for internal use only.
101
+ *
102
+ * It abstracts the `param` object Tweakpane expects into an interface that looks like a bare value.
103
+ *
104
+ * @sourceLink
105
+ * [GenericBinding.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/internal/GenericBinding.svelte)
106
+ */
107
+ export default class GenericBinding<
108
+ T extends any,
109
+ U extends BindingOptions = BindingOptions,
110
+ V extends BindingRef = BindingRef
111
+ > extends SvelteComponent<
112
+ GenericBindingProps<T, U, V>,
113
+ GenericBindingEvents<T, U, V>,
114
+ GenericBindingSlots<T, U, V>
115
+ > {}
116
+ export {};
@@ -0,0 +1,38 @@
1
+ <script context="module"></script>
2
+
3
+ <script generics="T extends BladeOptions, U extends BladeRef">
4
+ import Blade from '../core/Blade.svelte';
5
+ import { updateCollapsibility } from '../utils';
6
+ export let options;
7
+ export let ref = void 0;
8
+ export let userExpandable = true;
9
+ export let expanded = void 0;
10
+ export let buttonClass = '';
11
+ export let picker = void 0;
12
+ let gotBlade = false;
13
+ const initialExpanded = expanded;
14
+ let internalExpanded = initialExpanded;
15
+ $: if (!gotBlade && ref) {
16
+ gotBlade = true;
17
+ ref.controller?.valueController?.foldable_?.value('expanded').emitter.on('change', (e) => {
18
+ internalExpanded = e.rawValue;
19
+ expanded = internalExpanded;
20
+ });
21
+ }
22
+ $: options = {
23
+ ...options,
24
+ expanded: initialExpanded,
25
+ // only set once
26
+ picker
27
+ };
28
+ $: ref &&
29
+ buttonClass !== void 0 &&
30
+ updateCollapsibility(userExpandable ?? true, ref.element, buttonClass);
31
+ $: ref &&
32
+ buttonClass !== void 0 &&
33
+ expanded !== internalExpanded &&
34
+ ref.element.getElementsByClassName(buttonClass).length > 0 &&
35
+ ref.element.getElementsByClassName(buttonClass)[0].click();
36
+ </script>
37
+
38
+ <Blade bind:ref {options} {...$$restProps} />