svelte-tweakpane-ui 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/control/CubicBezier.svelte +1 -1
- package/dist/control/CubicBezier.svelte.d.ts +0 -3
- package/dist/control/Textarea.svelte +0 -2
- package/dist/control/Wheel.svelte.d.ts +1 -5
- package/dist/core/Blade.svelte +4 -5
- package/dist/core/TabGroup.svelte +4 -5
- package/dist/internal/GenericInput.svelte +4 -6
- package/dist/internal/GenericPane.svelte +22 -8
- package/dist/internal/GenericSlider.svelte +10 -12
- package/dist/internal/InternalPaneDraggable.svelte +1 -3
- package/dist/monitor/FpsGraph.svelte +11 -29
- package/dist/utils.js +0 -1
- package/package.json +13 -10
- package/readme.md +1 -1
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
<style>
|
|
62
62
|
/* Fix overflow bug from the plugin TODO PR */
|
|
63
|
-
:global(div.tp-cbzv:not(tp-cbzv-expanded) div.tp-cbzv_p) {
|
|
63
|
+
:global(div.svelte-tweakpane-ui div.tp-cbzv:not(tp-cbzv-expanded) div.tp-cbzv_p) {
|
|
64
64
|
overflow: hidden !important;
|
|
65
65
|
}
|
|
66
66
|
</style>
|
|
@@ -118,9 +118,6 @@ export type CubicBezierSlots = typeof __propDef.slots;
|
|
|
118
118
|
* Usage outside of a `<Pane>` component will implicitly wrap the cubic bezier control in `<Pane
|
|
119
119
|
* position='inline'>`.
|
|
120
120
|
*
|
|
121
|
-
* Complete functionality of the `scale` prop is [pending a pull
|
|
122
|
-
* request](https://github.com/tweakpane/plugin-essentials/pull/19).
|
|
123
|
-
*
|
|
124
121
|
* _Note: A memory leak has been observed in situations when the `value` prop is written frequently
|
|
125
122
|
* from outside the component. See [issue
|
|
126
123
|
* #18](https://github.com/tweakpane/plugin-essentials/issues/18) on the Plugin Essentials repo for
|
|
@@ -14,11 +14,9 @@
|
|
|
14
14
|
updateListeners(live ?? true, true);
|
|
15
15
|
});
|
|
16
16
|
function onBlur(event) {
|
|
17
|
-
console.log('onblur');
|
|
18
17
|
value = event.target.value;
|
|
19
18
|
}
|
|
20
19
|
function onInput(event) {
|
|
21
|
-
console.log('input');
|
|
22
20
|
value = event.target.value;
|
|
23
21
|
}
|
|
24
22
|
function updateListeners(live2, destroy = false) {
|
|
@@ -76,11 +76,7 @@ declare const __propDef: {
|
|
|
76
76
|
* Specifying both a `min` and a `max` prop turns the control into a slider.
|
|
77
77
|
* @default `undefined`
|
|
78
78
|
*/
|
|
79
|
-
min?: number | undefined
|
|
80
|
-
* When `true`, expand the width of the wheel control at the expense of the numerical input
|
|
81
|
-
* field.
|
|
82
|
-
* @default `false`
|
|
83
|
-
* */;
|
|
79
|
+
min?: number | undefined;
|
|
84
80
|
/**
|
|
85
81
|
* Maximum value.
|
|
86
82
|
*
|
package/dist/core/Blade.svelte
CHANGED
|
@@ -36,11 +36,10 @@
|
|
|
36
36
|
onDestroy(() => {
|
|
37
37
|
_ref?.dispose();
|
|
38
38
|
});
|
|
39
|
-
$: DEV &&
|
|
40
|
-
$: options
|
|
41
|
-
$:
|
|
42
|
-
$:
|
|
43
|
-
theme &&
|
|
39
|
+
$: DEV && enforceReadonly(_ref, ref, 'Blade', 'ref', true);
|
|
40
|
+
$: options && $parentStore && index !== void 0 && create();
|
|
41
|
+
$: _ref && (_ref.disabled = disabled);
|
|
42
|
+
$: theme &&
|
|
44
43
|
$parentStore &&
|
|
45
44
|
(userCreatedPane || !isRootPane($parentStore)) &&
|
|
46
45
|
console.warn(
|
|
@@ -30,11 +30,10 @@
|
|
|
30
30
|
const tabPageApi = $tabGroupStore?.pages.at(index);
|
|
31
31
|
if (tabPageApi && !tabPageApi.selected) tabPageApi.selected = true;
|
|
32
32
|
}
|
|
33
|
-
$:
|
|
34
|
-
$:
|
|
35
|
-
$:
|
|
36
|
-
$:
|
|
37
|
-
theme &&
|
|
33
|
+
$: setUpListeners($tabGroupStore);
|
|
34
|
+
$: setSelectedIndex(selectedIndex);
|
|
35
|
+
$: $tabGroupStore && ($tabGroupStore.disabled = disabled);
|
|
36
|
+
$: theme &&
|
|
38
37
|
$parentStore &&
|
|
39
38
|
(userCreatedPane || !isRootPane($parentStore)) &&
|
|
40
39
|
console.warn(
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
generics="T extends any, U extends GenericInputOptions = GenericInputOptions, V extends GenericInputRef = GenericInputRef"
|
|
5
5
|
>
|
|
6
6
|
import GenericBinding from './GenericBinding.svelte';
|
|
7
|
-
import { BROWSER } from 'esm-env';
|
|
8
7
|
export let options = void 0;
|
|
9
8
|
export let ref = void 0;
|
|
10
9
|
export let value;
|
|
11
10
|
let optionsInternal;
|
|
12
|
-
$:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
11
|
+
$: optionsInternal = {
|
|
12
|
+
...options,
|
|
13
|
+
readonly: false
|
|
14
|
+
};
|
|
17
15
|
</script>
|
|
18
16
|
|
|
19
17
|
<GenericBinding bind:value bind:ref options={optionsInternal} {...$$restProps} />
|
|
@@ -63,14 +63,13 @@
|
|
|
63
63
|
}
|
|
64
64
|
expanded = _expanded;
|
|
65
65
|
}
|
|
66
|
-
$:
|
|
67
|
-
$:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
$:
|
|
71
|
-
$:
|
|
72
|
-
$:
|
|
73
|
-
$: BROWSER && paneRef && (_expanded = expanded);
|
|
66
|
+
$: paneRef?.element && paneRef?.element.classList.add('svelte-tweakpane-ui');
|
|
67
|
+
$: paneRef && setScale(scale);
|
|
68
|
+
$: paneRef && updateCollapsibility(userExpandable, paneRef.element, 'tp-rotv_b', 'tp-rotv_m');
|
|
69
|
+
$: paneRef && title && (paneRef.title = title);
|
|
70
|
+
$: paneRef && applyTheme(paneRef.element, theme);
|
|
71
|
+
$: _expanded, paneRef && syncFolded();
|
|
72
|
+
$: paneRef && (_expanded = expanded);
|
|
74
73
|
</script>
|
|
75
74
|
|
|
76
75
|
{#if BROWSER}
|
|
@@ -95,3 +94,18 @@
|
|
|
95
94
|
{:else}
|
|
96
95
|
<ClsPad keysAdd={['containerVerticalPadding', 'containerUnitSize']} {theme} />
|
|
97
96
|
{/if}
|
|
97
|
+
|
|
98
|
+
<style>
|
|
99
|
+
/* Blade labels */
|
|
100
|
+
:global(div.svelte-tweakpane-ui div.tp-lblv_l) {
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
padding-right: var(--cnt-hp);
|
|
103
|
+
text-overflow: ellipsis;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Pane title label */
|
|
107
|
+
:global(div.svelte-tweakpane-ui div.tp-rotv_t) {
|
|
108
|
+
overflow: hidden;
|
|
109
|
+
text-overflow: ellipsis;
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script generics="T extends number | IntervalSliderValue">
|
|
2
2
|
import GenericInput from './GenericInput.svelte';
|
|
3
|
-
import { BROWSER } from 'esm-env';
|
|
4
3
|
export let value;
|
|
5
4
|
export let options = void 0;
|
|
6
5
|
export let min = void 0;
|
|
@@ -10,18 +9,17 @@
|
|
|
10
9
|
export let keyScale = void 0;
|
|
11
10
|
export let format = void 0;
|
|
12
11
|
let formatProxy = format;
|
|
13
|
-
$:
|
|
12
|
+
$: formatProxy !== format && (formatProxy = format);
|
|
14
13
|
let optionsInternal;
|
|
15
|
-
$:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
14
|
+
$: optionsInternal = {
|
|
15
|
+
min,
|
|
16
|
+
max,
|
|
17
|
+
format: formatProxy,
|
|
18
|
+
keyScale,
|
|
19
|
+
pointerScale,
|
|
20
|
+
step,
|
|
21
|
+
...options
|
|
22
|
+
};
|
|
25
23
|
</script>
|
|
26
24
|
|
|
27
25
|
<GenericInput bind:value options={optionsInternal} {...$$restProps} />
|
|
@@ -292,8 +292,7 @@
|
|
|
292
292
|
on:pointerdown|capture={() => {
|
|
293
293
|
zIndexLocal = ++zIndexGlobal;
|
|
294
294
|
}}
|
|
295
|
-
class="
|
|
296
|
-
draggable-container"
|
|
295
|
+
class="draggable-container"
|
|
297
296
|
class:not-collapsable={!userExpandable}
|
|
298
297
|
class:not-resizable={!resizable}
|
|
299
298
|
style:left="{x}px"
|
|
@@ -330,7 +329,6 @@ draggable-container"
|
|
|
330
329
|
/* Ensure draggable hit zone does not collapse if title is missing */
|
|
331
330
|
/* Fixes #1 */
|
|
332
331
|
height: 100%;
|
|
333
|
-
text-overflow: ellipsis;
|
|
334
332
|
}
|
|
335
333
|
|
|
336
334
|
div.draggable-container.not-collapsable :global(div.tp-rotv_t) {
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
let implicitMode = true;
|
|
16
16
|
export function begin() {
|
|
17
17
|
implicitMode = false;
|
|
18
|
-
|
|
18
|
+
ref?.begin();
|
|
19
19
|
}
|
|
20
20
|
export function end() {
|
|
21
21
|
implicitMode = false;
|
|
22
|
-
|
|
22
|
+
ref?.end();
|
|
23
23
|
}
|
|
24
|
-
let
|
|
24
|
+
let ref;
|
|
25
25
|
let requestId;
|
|
26
26
|
const dispatch = createEventDispatcher();
|
|
27
27
|
onMount(() => {
|
|
@@ -29,44 +29,25 @@
|
|
|
29
29
|
});
|
|
30
30
|
onDestroy(() => {
|
|
31
31
|
stopInternalLoop();
|
|
32
|
-
stopObservingMeasuredFpsValue();
|
|
33
32
|
});
|
|
34
33
|
function startInternalLoop() {
|
|
35
34
|
loop();
|
|
36
35
|
}
|
|
37
36
|
function loop() {
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
ref?.end();
|
|
38
|
+
ref?.begin();
|
|
40
39
|
requestId = requestAnimationFrame(loop);
|
|
41
40
|
}
|
|
42
41
|
function stopInternalLoop() {
|
|
43
42
|
requestId && cancelAnimationFrame(requestId);
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (!targetNode?.innerHTML) return;
|
|
50
|
-
observer = new MutationObserver((mutations) => {
|
|
51
|
-
for (const mutation of mutations) {
|
|
52
|
-
if (mutation.type === 'characterData' || mutation.type === 'childList') {
|
|
53
|
-
const fpsText = mutation.target.textContent;
|
|
54
|
-
if (fpsText !== null) {
|
|
55
|
-
const fps = Number.parseInt(fpsText, 10);
|
|
56
|
-
!Number.isNaN(fps) && dispatch('change', fps);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
44
|
+
function addListeners() {
|
|
45
|
+
ref.on('tick', () => {
|
|
46
|
+
if (ref.fps !== null) {
|
|
47
|
+
dispatch('change', ref.fps);
|
|
59
48
|
}
|
|
60
49
|
});
|
|
61
|
-
observer.observe(targetNode, { characterData: true, childList: true, subtree: true });
|
|
62
50
|
}
|
|
63
|
-
function stopObservingMeasuredFpsValue() {
|
|
64
|
-
if (observer) {
|
|
65
|
-
observer.disconnect();
|
|
66
|
-
observer = void 0;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
$: fpsBlade && startObservingMeasuredFpsValue();
|
|
70
51
|
let options;
|
|
71
52
|
$: options = {
|
|
72
53
|
min,
|
|
@@ -76,10 +57,11 @@
|
|
|
76
57
|
rows,
|
|
77
58
|
view: 'fpsgraph'
|
|
78
59
|
};
|
|
60
|
+
$: ref !== void 0 && addListeners();
|
|
79
61
|
$: !implicitMode && stopInternalLoop();
|
|
80
62
|
</script>
|
|
81
63
|
|
|
82
|
-
<Blade bind:ref
|
|
64
|
+
<Blade bind:ref {options} plugin={pluginModule} {...$$restProps} />
|
|
83
65
|
{#if !BROWSER}
|
|
84
66
|
{#if rows}
|
|
85
67
|
<ClsPad keysAdd={fillWith('containerUnitSize', rows)} theme={$$props.theme} />
|
package/dist/utils.js
CHANGED
|
@@ -102,7 +102,6 @@ export function removeKeys(object, ...keys) {
|
|
|
102
102
|
}
|
|
103
103
|
function clickBlocker(event) {
|
|
104
104
|
// Only block user clicks, not programmatic ones
|
|
105
|
-
console.log(event.detail);
|
|
106
105
|
if (event.isTrusted) event.stopPropagation();
|
|
107
106
|
}
|
|
108
107
|
// Used by folder and pane TODO rewrite to use getSwatchButton etc.
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-tweakpane-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"description": "Wraps UI elements from Tweakpane in a collection of idiomatic Svelte components, and augments Tweakpane with a few extra features for your convenience and enjoyment.",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "git+https://github.com/kitschpatrol/svelte-tweakpane-ui.git"
|
|
@@ -189,8 +190,7 @@
|
|
|
189
190
|
"@kitschpatrol/tweakpane-textarea-plugin": "^2.0.1",
|
|
190
191
|
"@tweakpane/core": "^2.0.2",
|
|
191
192
|
"@tweakpane/plugin-camerakit": "^0.3.0",
|
|
192
|
-
"@tweakpane/plugin-essentials": "^0.2.
|
|
193
|
-
"bumpp": "^9.2.1",
|
|
193
|
+
"@tweakpane/plugin-essentials": "^0.2.1",
|
|
194
194
|
"esm-env": "^1.0.0",
|
|
195
195
|
"nanoid": "^5.0.4",
|
|
196
196
|
"svelte-local-storage-store": "^0.6.4",
|
|
@@ -201,12 +201,14 @@
|
|
|
201
201
|
"@kitschpatrol/shared-config": "^4.0.0",
|
|
202
202
|
"@phenomnomnominal/tsquery": "^6.1.3",
|
|
203
203
|
"@stkb/rewrap": "^0.1.0",
|
|
204
|
-
"@sveltejs/adapter-static": "^
|
|
205
|
-
"@sveltejs/kit": "^
|
|
204
|
+
"@sveltejs/adapter-static": "^3.0.0",
|
|
205
|
+
"@sveltejs/kit": "^2.0.1",
|
|
206
206
|
"@sveltejs/package": "^2.2.3",
|
|
207
|
+
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
|
207
208
|
"@types/eslint": "^8.44.9",
|
|
208
209
|
"@types/fs-extra": "^11.0.4",
|
|
209
|
-
"@types/node": "^20.10.
|
|
210
|
+
"@types/node": "^20.10.5",
|
|
211
|
+
"bumpp": "^9.2.1",
|
|
210
212
|
"eslint": "^8.56.0",
|
|
211
213
|
"fs-extra": "^11.2.0",
|
|
212
214
|
"glob": "^10.3.10",
|
|
@@ -222,11 +224,9 @@
|
|
|
222
224
|
"tslib": "^2.6.2",
|
|
223
225
|
"tsx": "^4.6.2",
|
|
224
226
|
"typescript": "^5.3.3",
|
|
225
|
-
"vite": "^
|
|
227
|
+
"vite": "^5.0.10",
|
|
226
228
|
"yaml": "^2.3.4"
|
|
227
229
|
},
|
|
228
|
-
"_id": "svelte-tweakpane-ui@1.0.2",
|
|
229
|
-
"readme": "ERROR: No README data found!",
|
|
230
230
|
"scripts": {
|
|
231
231
|
"build": "run-s --print-label build:*",
|
|
232
232
|
"build:01-sync": "pnpm run check",
|
|
@@ -256,7 +256,10 @@
|
|
|
256
256
|
"kit-examples": "tsx ./scripts/generate-kit-examples.ts",
|
|
257
257
|
"kit-preview": "vite preview",
|
|
258
258
|
"lint": "shared-config --check",
|
|
259
|
-
"release": "
|
|
259
|
+
"release": "run-s --print-label release:*",
|
|
260
|
+
"release:1-build": "pnpm run build",
|
|
261
|
+
"release:2-version": "pnpm bumpp --commit 'Release: %s' --tag '%s'",
|
|
262
|
+
"release:3-publish": "pnpm publish --ignore-scripts --otp $(op read 'op://Personal/Npmjs/one-time password?attribute=otp')",
|
|
260
263
|
"rewrap": "rewrap -i --column 100 `find src \\( -name '*.svelte' -o -name '*.ts' -o -name '*.html' \\) -type f | grep -v src/examples`",
|
|
261
264
|
"type-check": "tsc --noEmit"
|
|
262
265
|
}
|
package/readme.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
The library makes it easy to quickly and declaratively add knobs and dials to your projects using components that feel like they were made for Svelte. It also augments Tweakpane with a few [extra features](https://kitschpatrol.com/svelte-tweakpane-ui/docs/features) for your convenience and enjoyment.
|
|
11
11
|
|
|
12
|
-
[The components](https://kitschpatrol.com/svelte-tweakpane-ui/docs#components) should be useful for integrating controls and value monitoring in parametrically driven artworks
|
|
12
|
+
[The components](https://kitschpatrol.com/svelte-tweakpane-ui/docs#components) should be useful for integrating controls and value monitoring in parametrically driven artworks, data visualizations, creative tools, simulations, etc.
|
|
13
13
|
|
|
14
14
|
## Demo
|
|
15
15
|
|