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,500 @@
|
|
|
1
|
+
import { SvelteComponent } from 'svelte';
|
|
2
|
+
export type PanePosition = 'draggable' | 'fixed' | 'inline';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: (
|
|
5
|
+
| (Omit<
|
|
6
|
+
{
|
|
7
|
+
/**
|
|
8
|
+
* Text in the pane's title bar.
|
|
9
|
+
* @default `Tweakpane` \
|
|
10
|
+
* Unless `position='inline'`, in which case the default is `undefined` and no title bar is
|
|
11
|
+
* shown.
|
|
12
|
+
*/
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Allow users to interactively expand / contract the pane by clicking its title bar.
|
|
16
|
+
*
|
|
17
|
+
* Hides the collapse button from the title bar when `false`.
|
|
18
|
+
* @default `true`
|
|
19
|
+
*/
|
|
20
|
+
userExpandable?: boolean | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Expand or collapse the pane into its title bar.
|
|
23
|
+
* @default `true`
|
|
24
|
+
* @bindable
|
|
25
|
+
*/
|
|
26
|
+
expanded?: boolean | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Custom color scheme.
|
|
29
|
+
*
|
|
30
|
+
* Applies to all child components, but note that setting a different `theme` on a child
|
|
31
|
+
* component's prop will **not** override the parent pane's theme.
|
|
32
|
+
*
|
|
33
|
+
* Note that `<Pane position="inline' ...>` squares off rounded corners by default to better
|
|
34
|
+
* integrate with surrounding content.
|
|
35
|
+
*
|
|
36
|
+
* Simply pass a custom or default theme like `ThemeUtils.presets.standard` if you want rounded
|
|
37
|
+
* corners on an `inline` pane.
|
|
38
|
+
*
|
|
39
|
+
* See also the `setGlobalDefaultTheme()` for a way to set a custom default theme for all panes
|
|
40
|
+
* on the page.
|
|
41
|
+
* @default `undefined` \
|
|
42
|
+
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
43
|
+
* set with `setGlobalDefaultTheme()`.
|
|
44
|
+
*/
|
|
45
|
+
theme?: import('..').Theme | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Scales the pane's elements by a factor of `scale` to make it easier to see.
|
|
48
|
+
*
|
|
49
|
+
* Holds the width of the pane constant, so the pane will grow taller as it is scaled and will
|
|
50
|
+
* continue to respect position- and size-related props. If you need more breathing room, set
|
|
51
|
+
* the `width` property on the pane.
|
|
52
|
+
*
|
|
53
|
+
* Note that the scaling prop is only available on `<Pane>`, not on stand-alone (implicitly
|
|
54
|
+
* wrapped) inline elements.
|
|
55
|
+
*
|
|
56
|
+
* Negative values are ignored.
|
|
57
|
+
* @default `1`
|
|
58
|
+
*/
|
|
59
|
+
scale?: number | undefined;
|
|
60
|
+
/** Internal use only. */
|
|
61
|
+
userCreatedPane?: boolean | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Internal use only.
|
|
64
|
+
* @readonly
|
|
65
|
+
*/
|
|
66
|
+
paneRef?: import('tweakpane').Pane | undefined;
|
|
67
|
+
},
|
|
68
|
+
'userCreatedPane' | 'paneRef'
|
|
69
|
+
> & {
|
|
70
|
+
/**
|
|
71
|
+
* Horizontal position of the pane relative to the left edge of the window, in pixels.
|
|
72
|
+
*
|
|
73
|
+
* Not to be confused with the `position` prop which defines _how_, not _where_, the pane is
|
|
74
|
+
* positioned on the page. (So-named because of its similarity to CSS `position` property.)
|
|
75
|
+
* @default `undefined` \
|
|
76
|
+
* 8 pixels from the right edge of the window.
|
|
77
|
+
*/
|
|
78
|
+
x?: number | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Vertical position of the pane relative to the top of the window, in pixels.
|
|
81
|
+
*
|
|
82
|
+
* Not to be confused with the `position` prop which defines _how_, not _where_, the pane is
|
|
83
|
+
* positioned on the page. (So-named because of its similarity to CSS `position` property.)
|
|
84
|
+
* @default `undefined` \
|
|
85
|
+
* 8 pixels from the top edge of the window.
|
|
86
|
+
*/
|
|
87
|
+
y?: number | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Minimum pane width in pixels.
|
|
90
|
+
* @default `200`
|
|
91
|
+
*/
|
|
92
|
+
minWidth?: number | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Maximum pane width in pixels.
|
|
95
|
+
* @default `600`
|
|
96
|
+
*/
|
|
97
|
+
maxWidth?: number | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Automatically collapse open panels when the available window size is less than the height
|
|
100
|
+
* of the pane.
|
|
101
|
+
*
|
|
102
|
+
* @default `false`
|
|
103
|
+
*/
|
|
104
|
+
collapseChildrenToFit?: boolean | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Identifier to be used if multiple `<Pane position='draggable'>` components with
|
|
107
|
+
* `storePositionLocally` set to true are used on the same page.
|
|
108
|
+
* @default `'1'`
|
|
109
|
+
*/
|
|
110
|
+
localStoreId?: string | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* CSS [padding property string](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)
|
|
113
|
+
* to apply to the draggable pane container to prevent it from being dragged all the way to
|
|
114
|
+
* the edge of the window.
|
|
115
|
+
*
|
|
116
|
+
* Useful for keeping the pane away from of menu bars, etc.
|
|
117
|
+
* @default `'0'`
|
|
118
|
+
*/
|
|
119
|
+
padding?: string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Allow the user to resize the width of the pane by dragging the right corner of the title
|
|
122
|
+
* bar.
|
|
123
|
+
* @default `true`
|
|
124
|
+
*/
|
|
125
|
+
resizable?: boolean | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Store the pane's position and width when the user changes it interactively.
|
|
128
|
+
*
|
|
129
|
+
* Set the `localStoreId` prop if you have multiple draggable panes on the same page with
|
|
130
|
+
* `storePositionLocally` set to `true`.
|
|
131
|
+
* @default `true`
|
|
132
|
+
*/
|
|
133
|
+
storePositionLocally?: boolean | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Width of the pane, in pixels.
|
|
136
|
+
*
|
|
137
|
+
* If undefined, the pane will fill the width of its container. (This behavior is unique to
|
|
138
|
+
* `position="inline"`.)
|
|
139
|
+
*
|
|
140
|
+
* This value is particularly important in combination with `scale`, since a scaled inline
|
|
141
|
+
* pane will grow indefinitely wider if an intrinsic width is not specified and a containing
|
|
142
|
+
* element is not provided.
|
|
143
|
+
* @default `undefined`
|
|
144
|
+
*/
|
|
145
|
+
width?: number | undefined;
|
|
146
|
+
} & {
|
|
147
|
+
/**
|
|
148
|
+
* Pane mode, one of three options:
|
|
149
|
+
* - **'draggable'** *(default)* \
|
|
150
|
+
* The pane is draggable and resizable, and may be placed anywhere over the page.
|
|
151
|
+
* - **'inline'** \
|
|
152
|
+
* The pane appears inline with other content in the normal flow of the document. \
|
|
153
|
+
* This is the default mode for components created outside of an explicit `<Pane>`
|
|
154
|
+
* component.*
|
|
155
|
+
* - **'fixed'** \
|
|
156
|
+
* Standard Tweakpane behavior where the pane is shown in a fixed position over the page.
|
|
157
|
+
*
|
|
158
|
+
* Note that `<Pane>` is a dynamic component, and availability of additional props will
|
|
159
|
+
* vary depending on the defined `position` value.
|
|
160
|
+
* @default `'draggable'`
|
|
161
|
+
*/
|
|
162
|
+
position?: 'draggable' | undefined;
|
|
163
|
+
})
|
|
164
|
+
| (Omit<
|
|
165
|
+
{
|
|
166
|
+
/**
|
|
167
|
+
* Text in the pane's title bar.
|
|
168
|
+
* @default `Tweakpane` \
|
|
169
|
+
* Unless `position='inline'`, in which case the default is `undefined` and no title bar is
|
|
170
|
+
* shown.
|
|
171
|
+
*/
|
|
172
|
+
title?: string | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* Allow users to interactively expand / contract the pane by clicking its title bar.
|
|
175
|
+
*
|
|
176
|
+
* Hides the collapse button from the title bar when `false`.
|
|
177
|
+
* @default `true`
|
|
178
|
+
*/
|
|
179
|
+
userExpandable?: boolean | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Expand or collapse the pane into its title bar.
|
|
182
|
+
* @default `true`
|
|
183
|
+
* @bindable
|
|
184
|
+
*/
|
|
185
|
+
expanded?: boolean | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Custom color scheme.
|
|
188
|
+
*
|
|
189
|
+
* Applies to all child components, but note that setting a different `theme` on a child
|
|
190
|
+
* component's prop will **not** override the parent pane's theme.
|
|
191
|
+
*
|
|
192
|
+
* Note that `<Pane position="inline' ...>` squares off rounded corners by default to better
|
|
193
|
+
* integrate with surrounding content.
|
|
194
|
+
*
|
|
195
|
+
* Simply pass a custom or default theme like `ThemeUtils.presets.standard` if you want rounded
|
|
196
|
+
* corners on an `inline` pane.
|
|
197
|
+
*
|
|
198
|
+
* See also the `setGlobalDefaultTheme()` for a way to set a custom default theme for all panes
|
|
199
|
+
* on the page.
|
|
200
|
+
* @default `undefined` \
|
|
201
|
+
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
202
|
+
* set with `setGlobalDefaultTheme()`.
|
|
203
|
+
*/
|
|
204
|
+
theme?: import('..').Theme | undefined;
|
|
205
|
+
/**
|
|
206
|
+
* Scales the pane's elements by a factor of `scale` to make it easier to see.
|
|
207
|
+
*
|
|
208
|
+
* Holds the width of the pane constant, so the pane will grow taller as it is scaled and will
|
|
209
|
+
* continue to respect position- and size-related props. If you need more breathing room, set
|
|
210
|
+
* the `width` property on the pane.
|
|
211
|
+
*
|
|
212
|
+
* Note that the scaling prop is only available on `<Pane>`, not on stand-alone (implicitly
|
|
213
|
+
* wrapped) inline elements.
|
|
214
|
+
*
|
|
215
|
+
* Negative values are ignored.
|
|
216
|
+
* @default `1`
|
|
217
|
+
*/
|
|
218
|
+
scale?: number | undefined;
|
|
219
|
+
/** Internal use only. */
|
|
220
|
+
userCreatedPane?: boolean | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Internal use only.
|
|
223
|
+
* @readonly
|
|
224
|
+
*/
|
|
225
|
+
paneRef?: import('tweakpane').Pane | undefined;
|
|
226
|
+
},
|
|
227
|
+
'userCreatedPane' | 'paneRef'
|
|
228
|
+
> & {
|
|
229
|
+
/**
|
|
230
|
+
* Horizontal position of the pane relative to the left edge of the window, in pixels.
|
|
231
|
+
*
|
|
232
|
+
* Not to be confused with the `position` prop which defines _how_, not _where_, the pane is
|
|
233
|
+
* positioned on the page. (So-named because of its similarity to CSS `position` property.)
|
|
234
|
+
* @default `undefined` \
|
|
235
|
+
* 8 pixels from the right edge of the window.
|
|
236
|
+
*/
|
|
237
|
+
x?: number | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* Vertical position of the pane relative to the top of the window, in pixels.
|
|
240
|
+
*
|
|
241
|
+
* Not to be confused with the `position` prop which defines _how_, not _where_, the pane is
|
|
242
|
+
* positioned on the page. (So-named because of its similarity to CSS `position` property.)
|
|
243
|
+
* @default `undefined` \
|
|
244
|
+
* 8 pixels from the top edge of the window.
|
|
245
|
+
*/
|
|
246
|
+
y?: number | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* Width of the pane, in pixels.
|
|
249
|
+
*
|
|
250
|
+
* If undefined, the pane will fill the width of its container. (This behavior is unique to
|
|
251
|
+
* `position="inline"`.)
|
|
252
|
+
*
|
|
253
|
+
* This value is particularly important in combination with `scale`, since a scaled inline
|
|
254
|
+
* pane will grow indefinitely wider if an intrinsic width is not specified and a containing
|
|
255
|
+
* element is not provided.
|
|
256
|
+
* @default `undefined`
|
|
257
|
+
*/
|
|
258
|
+
width?: number | undefined;
|
|
259
|
+
} & {
|
|
260
|
+
/**
|
|
261
|
+
* Pane mode, one of three options:
|
|
262
|
+
* - **'draggable'** *(default)* \
|
|
263
|
+
* The pane is draggable and resizable, and may be placed anywhere over the page.
|
|
264
|
+
* - **'inline'** \
|
|
265
|
+
* The pane appears inline with other content in the normal flow of the document. \
|
|
266
|
+
* This is the default mode for components created outside of an explicit `<Pane>`
|
|
267
|
+
* component.*
|
|
268
|
+
* - **'fixed'** \
|
|
269
|
+
* Standard Tweakpane behavior where the pane is shown in a fixed position over the page.
|
|
270
|
+
*
|
|
271
|
+
* Note that `<Pane>` is a dynamic component, and availability of additional props will
|
|
272
|
+
* vary depending on the defined `position` value.
|
|
273
|
+
* @default `'draggable'`
|
|
274
|
+
*/
|
|
275
|
+
position: 'fixed';
|
|
276
|
+
})
|
|
277
|
+
| (Omit<
|
|
278
|
+
Omit<
|
|
279
|
+
{
|
|
280
|
+
/**
|
|
281
|
+
* Text in the pane's title bar.
|
|
282
|
+
* @default `Tweakpane` \
|
|
283
|
+
* Unless `position='inline'`, in which case the default is `undefined` and no title bar is
|
|
284
|
+
* shown.
|
|
285
|
+
*/
|
|
286
|
+
title?: string | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* Allow users to interactively expand / contract the pane by clicking its title bar.
|
|
289
|
+
*
|
|
290
|
+
* Hides the collapse button from the title bar when `false`.
|
|
291
|
+
* @default `true`
|
|
292
|
+
*/
|
|
293
|
+
userExpandable?: boolean | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* Expand or collapse the pane into its title bar.
|
|
296
|
+
* @default `true`
|
|
297
|
+
* @bindable
|
|
298
|
+
*/
|
|
299
|
+
expanded?: boolean | undefined;
|
|
300
|
+
/**
|
|
301
|
+
* Custom color scheme.
|
|
302
|
+
*
|
|
303
|
+
* Applies to all child components, but note that setting a different `theme` on a child
|
|
304
|
+
* component's prop will **not** override the parent pane's theme.
|
|
305
|
+
*
|
|
306
|
+
* Note that `<Pane position="inline' ...>` squares off rounded corners by default to better
|
|
307
|
+
* integrate with surrounding content.
|
|
308
|
+
*
|
|
309
|
+
* Simply pass a custom or default theme like `ThemeUtils.presets.standard` if you want rounded
|
|
310
|
+
* corners on an `inline` pane.
|
|
311
|
+
*
|
|
312
|
+
* See also the `setGlobalDefaultTheme()` for a way to set a custom default theme for all panes
|
|
313
|
+
* on the page.
|
|
314
|
+
* @default `undefined` \
|
|
315
|
+
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
316
|
+
* set with `setGlobalDefaultTheme()`.
|
|
317
|
+
*/
|
|
318
|
+
theme?: import('..').Theme | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Scales the pane's elements by a factor of `scale` to make it easier to see.
|
|
321
|
+
*
|
|
322
|
+
* Holds the width of the pane constant, so the pane will grow taller as it is scaled and will
|
|
323
|
+
* continue to respect position- and size-related props. If you need more breathing room, set
|
|
324
|
+
* the `width` property on the pane.
|
|
325
|
+
*
|
|
326
|
+
* Note that the scaling prop is only available on `<Pane>`, not on stand-alone (implicitly
|
|
327
|
+
* wrapped) inline elements.
|
|
328
|
+
*
|
|
329
|
+
* Negative values are ignored.
|
|
330
|
+
* @default `1`
|
|
331
|
+
*/
|
|
332
|
+
scale?: number | undefined;
|
|
333
|
+
/** Internal use only. */
|
|
334
|
+
userCreatedPane?: boolean | undefined;
|
|
335
|
+
/**
|
|
336
|
+
* Internal use only.
|
|
337
|
+
* @readonly
|
|
338
|
+
*/
|
|
339
|
+
paneRef?: import('tweakpane').Pane | undefined;
|
|
340
|
+
},
|
|
341
|
+
'paneRef'
|
|
342
|
+
> & {
|
|
343
|
+
/**
|
|
344
|
+
* Width of the pane, in pixels.
|
|
345
|
+
*
|
|
346
|
+
* If undefined, the pane will fill the width of its container. (This behavior is unique to
|
|
347
|
+
* `position="inline"`.)
|
|
348
|
+
*
|
|
349
|
+
* This value is particularly important in combination with `scale`, since a scaled inline
|
|
350
|
+
* pane will grow indefinitely wider if an intrinsic width is not specified and a containing
|
|
351
|
+
* element is not provided.
|
|
352
|
+
* @default `undefined`
|
|
353
|
+
*/
|
|
354
|
+
width?: number | undefined;
|
|
355
|
+
},
|
|
356
|
+
'userCreatedPane'
|
|
357
|
+
> & {
|
|
358
|
+
/**
|
|
359
|
+
* Pane mode, one of three options:
|
|
360
|
+
* - **'draggable'** *(default)* \
|
|
361
|
+
* The pane is draggable and resizable, and may be placed anywhere over the page.
|
|
362
|
+
* - **'inline'** \
|
|
363
|
+
* The pane appears inline with other content in the normal flow of the document. \
|
|
364
|
+
* This is the default mode for components created outside of an explicit `<Pane>`
|
|
365
|
+
* component.*
|
|
366
|
+
* - **'fixed'** \
|
|
367
|
+
* Standard Tweakpane behavior where the pane is shown in a fixed position over the page.
|
|
368
|
+
*
|
|
369
|
+
* Note that `<Pane>` is a dynamic component, and availability of additional props will
|
|
370
|
+
* vary depending on the defined `position` value.
|
|
371
|
+
* @default `'draggable'`
|
|
372
|
+
*/
|
|
373
|
+
position: 'inline';
|
|
374
|
+
})
|
|
375
|
+
) & {
|
|
376
|
+
/**
|
|
377
|
+
* Pane mode, one of three options:
|
|
378
|
+
* - **'draggable'** *(default)* \
|
|
379
|
+
* The pane is draggable and resizable, and may be placed anywhere over the page.
|
|
380
|
+
* - **'inline'** \
|
|
381
|
+
* The pane appears inline with other content in the normal flow of the document. \
|
|
382
|
+
* This is the default mode for components created outside of an explicit `<Pane>`
|
|
383
|
+
* component.*
|
|
384
|
+
* - **'fixed'** \
|
|
385
|
+
* Standard Tweakpane behavior where the pane is shown in a fixed position over the page.
|
|
386
|
+
*
|
|
387
|
+
* Note that `<Pane>` is a dynamic component, and availability of additional props will
|
|
388
|
+
* vary depending on the defined `position` value.
|
|
389
|
+
* @default `'draggable'`
|
|
390
|
+
* */
|
|
391
|
+
position?: PanePosition | undefined;
|
|
392
|
+
};
|
|
393
|
+
events: {
|
|
394
|
+
[evt: string]: CustomEvent<any>;
|
|
395
|
+
};
|
|
396
|
+
slots: {
|
|
397
|
+
/**
|
|
398
|
+
* Any Tweakpane component, except another `<Pane>`.
|
|
399
|
+
*/
|
|
400
|
+
default: {};
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
export type PaneProps = typeof __propDef.props;
|
|
404
|
+
export type PaneEvents = typeof __propDef.events;
|
|
405
|
+
export type PaneSlots = typeof __propDef.slots;
|
|
406
|
+
/**
|
|
407
|
+
* The root `<Pane>` component, used for organizing controls into a single group and controlling how
|
|
408
|
+
* and where the Tweakpane is displayed.
|
|
409
|
+
*
|
|
410
|
+
* This component is a wrapper around Tweakpane's
|
|
411
|
+
* [`Pane`](https://tweakpane.github.io/docs/api/classes/Pane.html) class.
|
|
412
|
+
*
|
|
413
|
+
* Important: Unlike the vanilla JS Tweakpane API, wrapping components in a `<Pane>` is not mandatory.
|
|
414
|
+
*
|
|
415
|
+
* Pane-less components will be automatically nested in a `<Pane position='inline'>` component and
|
|
416
|
+
* displayed in the regular block flow of the page. `<Pane>` is only necessary when you want to
|
|
417
|
+
* explicitly group a number of components, or when you want convenient means to control how and where
|
|
418
|
+
* the Tweakpane is shown on the page. (See an [important
|
|
419
|
+
* exception](https://kitschpatrol.com/svelte-tweakpane-ui/docs#island-framework-compatibility)
|
|
420
|
+
* regarding _Svelte Tweakpane UI_ in island frameworks like Astro.)
|
|
421
|
+
*
|
|
422
|
+
*
|
|
423
|
+
* Multiple `<Pane>` components of different modes may be added to a single page. If the panes are in
|
|
424
|
+
* `fixed` or `draggable` mode, you might want to set the `x` or `y` properties to prevent overlap.
|
|
425
|
+
*
|
|
426
|
+
* Note that `<Pane>` is a dynamic component, and availability of additional props will vary depending
|
|
427
|
+
* on the defined `position` value.
|
|
428
|
+
*
|
|
429
|
+
* Position mode overview:
|
|
430
|
+
*
|
|
431
|
+
* - **`<Pane position='draggable' ...>`** \
|
|
432
|
+
* This is an extension of Tweakpane's core functionality, which reasonably considers pane dragging
|
|
433
|
+
* outside of the library's scope. See discussion in Tweakpane issues
|
|
434
|
+
* [#88](https://github.com/cocopon/tweakpane/issues/88) and
|
|
435
|
+
* [#301](https://github.com/cocopon/tweakpane/issues/301).
|
|
436
|
+
* \
|
|
437
|
+
* By default, the pane's last position and width will be saved to the browser's local storage and
|
|
438
|
+
* re-applied across page reloads. (Set the `storePositionLocally` prop to false to prevent this.)
|
|
439
|
+
* \
|
|
440
|
+
* If multiple `<Pane position='draggable' ...>` components are used on the same page with
|
|
441
|
+
* `storePositionLocally` set to true, then each must have a unique `localStoreId` prop set to avoid
|
|
442
|
+
* collisions.
|
|
443
|
+
* \
|
|
444
|
+
* Double-clicking the width drag handle will expand or contract the pane between to its `minWidth`
|
|
445
|
+
* and `maxWidth` sizes.
|
|
446
|
+
*
|
|
447
|
+
* - **`<Pane position='inline' ...>`** \
|
|
448
|
+
* Provides an inline version of the pane component, allowing the Tweakpane window to appear in the
|
|
449
|
+
* normal flow of the document.
|
|
450
|
+
* \
|
|
451
|
+
* All other _Svelte Tweakpane UI_ components which are created without a containing `<Pane>` are
|
|
452
|
+
* nested implicitly inside a title-less `<Pane position='inline'>` component. As such, you do not
|
|
453
|
+
* necessarily need create `<Pane position='inline'>` components in most cases.
|
|
454
|
+
* \
|
|
455
|
+
* This mode's behavior is similar to creating a Pane in the vanilla JS Tweakpane with its
|
|
456
|
+
* [`container`](https://tweakpane.github.io/docs/misc/#containerElement) property set to a specific
|
|
457
|
+
* element where you want the Pane to appear.
|
|
458
|
+
*
|
|
459
|
+
* - **`<Pane position='fixed' ...>`** \
|
|
460
|
+
* This mode uses the standard vanilla JS Tweakpane behavior of displaying in a fixed position over
|
|
461
|
+
* the top-right of the page.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```svelte
|
|
465
|
+
* <script lang="ts">
|
|
466
|
+
* import { Pane, type PanePosition, RadioGrid } from 'svelte-tweakpane-ui';
|
|
467
|
+
*
|
|
468
|
+
* const options: PanePosition[] = ['inline', 'fixed', 'draggable'];
|
|
469
|
+
* let position: PanePosition = options[0];
|
|
470
|
+
* </script>
|
|
471
|
+
*
|
|
472
|
+
* <Pane {position} title="Pane" y={position === 'inline' ? undefined : 110}>
|
|
473
|
+
* <RadioGrid
|
|
474
|
+
* bind:value={position}
|
|
475
|
+
* columns={1}
|
|
476
|
+
* label="Pane Position Prop"
|
|
477
|
+
* values={options}
|
|
478
|
+
* />
|
|
479
|
+
* </Pane>
|
|
480
|
+
* {#if position === 'fixed'}
|
|
481
|
+
* <p>Pane is fixed at the top-right of the page.</p>
|
|
482
|
+
* {:else if position === 'draggable'}
|
|
483
|
+
* <p>Pane is draggable at the top-right of the page.</p>
|
|
484
|
+
* {/if}
|
|
485
|
+
*
|
|
486
|
+
* <style>
|
|
487
|
+
* p {
|
|
488
|
+
* display: grid;
|
|
489
|
+
* place-content: center;
|
|
490
|
+
* width: 100%;
|
|
491
|
+
* height: 96px;
|
|
492
|
+
* }
|
|
493
|
+
* </style>
|
|
494
|
+
* ```
|
|
495
|
+
*
|
|
496
|
+
* @sourceLink
|
|
497
|
+
* [Pane.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/core/Pane.svelte)
|
|
498
|
+
*/
|
|
499
|
+
export default class Pane extends SvelteComponent<PaneProps, PaneEvents, PaneSlots> {}
|
|
500
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Blade from './Blade.svelte';
|
|
3
|
+
import ClsPad from '../internal/ClsPad.svelte';
|
|
4
|
+
import { BROWSER } from 'esm-env';
|
|
5
|
+
const options = {
|
|
6
|
+
view: 'separator'
|
|
7
|
+
};
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
{#if BROWSER}
|
|
11
|
+
<Blade {options} {...$$restProps} />
|
|
12
|
+
{:else}
|
|
13
|
+
<ClsPad extra={2} keysAdd={['containerVerticalPadding']} theme={$$props.theme} />
|
|
14
|
+
{/if}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import type {
|
|
3
|
+
SeparatorBladeApi as SeparatorBladeRef,
|
|
4
|
+
SeparatorBladeParams as SeparatorOptions
|
|
5
|
+
} from 'tweakpane';
|
|
6
|
+
declare const __propDef: {
|
|
7
|
+
props: Omit<
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Blade configuration exposing Tweakpane's internal
|
|
11
|
+
* [`BladeParams`](https://tweakpane.github.io/docs/api/interfaces/BaseBladeParams.html).
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
options: SeparatorOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Prevent interactivity and gray out the control.
|
|
17
|
+
* @default `false`
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Custom color scheme.
|
|
22
|
+
* @default `undefined` \
|
|
23
|
+
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
24
|
+
* set with `setGlobalDefaultTheme()`.
|
|
25
|
+
*/
|
|
26
|
+
theme?: import('..').Theme | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Reference to internal Tweakpane
|
|
29
|
+
* [`BladeApi`](https://tweakpane.github.io/docs/api/classes/BladeApi.html) for this blade.
|
|
30
|
+
*
|
|
31
|
+
* This is primarily for internal use, when implementing convenience components wrapping Blade's
|
|
32
|
+
* functionality.
|
|
33
|
+
* @bindable
|
|
34
|
+
* @readonly
|
|
35
|
+
*/
|
|
36
|
+
ref?: SeparatorBladeRef | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Imported Tweakpane `TpPluginBundle` (Aliased as `Plugin`) module to register before creating
|
|
39
|
+
* the blade.
|
|
40
|
+
*
|
|
41
|
+
* This is primarily for internal use, when implementing convenience components wrapping Blade's
|
|
42
|
+
* functionality in combination with a Tweakpane plugin.
|
|
43
|
+
* @default `undefined`
|
|
44
|
+
*/
|
|
45
|
+
plugin?: import('tweakpane').TpPluginBundle | undefined;
|
|
46
|
+
},
|
|
47
|
+
'options' | 'ref' | 'plugin'
|
|
48
|
+
>;
|
|
49
|
+
events: {
|
|
50
|
+
[evt: string]: CustomEvent<any>;
|
|
51
|
+
};
|
|
52
|
+
slots: {};
|
|
53
|
+
};
|
|
54
|
+
export type SeparatorProps = typeof __propDef.props;
|
|
55
|
+
export type SeparatorEvents = typeof __propDef.events;
|
|
56
|
+
export type SeparatorSlots = typeof __propDef.slots;
|
|
57
|
+
/**
|
|
58
|
+
* A convenience component providing a subtle visual separator between controls, in the spirit of the
|
|
59
|
+
* HTML `<hr>` element.
|
|
60
|
+
*
|
|
61
|
+
* Wraps Tweakpane's [separator blade](https://tweakpane.github.io/docs/blades/#separator).
|
|
62
|
+
*
|
|
63
|
+
* Usage outside of a `<Pane>` component will implicitly wrap the separator in `<Pane
|
|
64
|
+
* position='inline'>`.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```svelte
|
|
68
|
+
* <script lang="ts">
|
|
69
|
+
* import { Button, Separator } from 'svelte-tweakpane-ui';
|
|
70
|
+
* </script>
|
|
71
|
+
*
|
|
72
|
+
* <Button title="Oil" />
|
|
73
|
+
* <Separator />
|
|
74
|
+
* <Button title="Water" />
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @sourceLink
|
|
78
|
+
* [Separator.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/core/Separator.svelte)
|
|
79
|
+
*/
|
|
80
|
+
export default class Separator extends SvelteComponent<
|
|
81
|
+
SeparatorProps,
|
|
82
|
+
SeparatorEvents,
|
|
83
|
+
SeparatorSlots
|
|
84
|
+
> {}
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import ClsPad from '../internal/ClsPad.svelte';
|
|
3
|
+
import InternalPaneInline from '../internal/InternalPaneInline.svelte';
|
|
4
|
+
import { getElementIndex, isRootPane } from '../utils.js';
|
|
5
|
+
import { BROWSER } from 'esm-env';
|
|
6
|
+
import { getContext, onDestroy, onMount, setContext } from 'svelte';
|
|
7
|
+
import { writable } from 'svelte/store';
|
|
8
|
+
export let disabled = false;
|
|
9
|
+
export let selectedIndex = 0;
|
|
10
|
+
export let theme = void 0;
|
|
11
|
+
const parentStore = getContext('parentStore');
|
|
12
|
+
const tabGroupStore = writable();
|
|
13
|
+
setContext('tabGroupStore', tabGroupStore);
|
|
14
|
+
const tabIndexStore = writable();
|
|
15
|
+
setContext('tabIndexStore', tabIndexStore);
|
|
16
|
+
const userCreatedPane = getContext('userCreatedPane');
|
|
17
|
+
let indexElement;
|
|
18
|
+
onMount(() => {
|
|
19
|
+
$tabIndexStore = userCreatedPane ? getElementIndex(indexElement) : 0;
|
|
20
|
+
});
|
|
21
|
+
onDestroy(() => {
|
|
22
|
+
$tabGroupStore?.dispose();
|
|
23
|
+
});
|
|
24
|
+
function setUpListeners(t) {
|
|
25
|
+
t?.on('select', (e) => {
|
|
26
|
+
selectedIndex = e.index;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function setSelectedIndex(index) {
|
|
30
|
+
const tabPageApi = $tabGroupStore?.pages.at(index);
|
|
31
|
+
if (tabPageApi) {
|
|
32
|
+
if (!tabPageApi.selected) tabPageApi.selected = true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
$: BROWSER && setUpListeners($tabGroupStore);
|
|
36
|
+
$: BROWSER && setSelectedIndex(selectedIndex);
|
|
37
|
+
$: BROWSER && $tabGroupStore && ($tabGroupStore.disabled = disabled);
|
|
38
|
+
$: BROWSER &&
|
|
39
|
+
theme &&
|
|
40
|
+
$parentStore &&
|
|
41
|
+
(userCreatedPane || !isRootPane($parentStore)) &&
|
|
42
|
+
console.warn(
|
|
43
|
+
'Set theme on the <Pane> component, not on its children! (Check nested <TabGroup> components for a theme prop.)'
|
|
44
|
+
);
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
{#if parentStore}
|
|
48
|
+
{#if BROWSER}
|
|
49
|
+
<div bind:this={indexElement} style="display: none;">
|
|
50
|
+
<slot />
|
|
51
|
+
</div>
|
|
52
|
+
{:else}
|
|
53
|
+
<ClsPad keysAdd={['containerVerticalPadding', 'containerVerticalPadding']} {theme} />
|
|
54
|
+
<div>
|
|
55
|
+
<slot />
|
|
56
|
+
</div>
|
|
57
|
+
{/if}
|
|
58
|
+
{:else}
|
|
59
|
+
<InternalPaneInline {theme} userCreatedPane={false}>
|
|
60
|
+
<svelte:self bind:selectedIndex {disabled}>
|
|
61
|
+
<slot />
|
|
62
|
+
</svelte:self>
|
|
63
|
+
</InternalPaneInline>
|
|
64
|
+
{/if}
|