svelte-tweakpane-ui 1.5.3 → 1.5.5
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/Button.svelte +30 -30
- package/dist/control/Button.svelte.d.ts +18 -18
- package/dist/control/ButtonGrid.svelte +25 -25
- package/dist/control/ButtonGrid.svelte.d.ts +35 -35
- package/dist/control/Checkbox.svelte +2 -2
- package/dist/control/Checkbox.svelte.d.ts +23 -23
- package/dist/control/Color.svelte +34 -34
- package/dist/control/Color.svelte.d.ts +40 -40
- package/dist/control/CubicBezier.svelte +30 -30
- package/dist/control/CubicBezier.svelte.d.ts +47 -47
- package/dist/control/File.svelte +20 -20
- package/dist/control/File.svelte.d.ts +38 -38
- package/dist/control/Image.svelte +22 -22
- package/dist/control/Image.svelte.d.ts +31 -31
- package/dist/control/IntervalSlider.svelte +24 -24
- package/dist/control/IntervalSlider.svelte.d.ts +39 -39
- package/dist/control/List.svelte +35 -35
- package/dist/control/List.svelte.d.ts +31 -31
- package/dist/control/Point.svelte +31 -31
- package/dist/control/Point.svelte.d.ts +81 -81
- package/dist/control/RadioGrid.svelte +24 -24
- package/dist/control/RadioGrid.svelte.d.ts +40 -40
- package/dist/control/Ring.svelte +9 -9
- package/dist/control/Ring.svelte.d.ts +40 -40
- package/dist/control/RotationEuler.svelte +25 -25
- package/dist/control/RotationEuler.svelte.d.ts +53 -53
- package/dist/control/RotationQuaternion.svelte +24 -24
- package/dist/control/RotationQuaternion.svelte.d.ts +47 -47
- package/dist/control/Slider.svelte +9 -9
- package/dist/control/Slider.svelte.d.ts +32 -32
- package/dist/control/Stepper.svelte +16 -16
- package/dist/control/Stepper.svelte.d.ts +32 -32
- package/dist/control/Text.svelte +13 -13
- package/dist/control/Text.svelte.d.ts +26 -26
- package/dist/control/Textarea.svelte +34 -34
- package/dist/control/Textarea.svelte.d.ts +29 -29
- package/dist/control/Wheel.svelte +8 -8
- package/dist/control/Wheel.svelte.d.ts +32 -32
- package/dist/core/Binding.svelte +60 -60
- package/dist/core/Binding.svelte.d.ts +33 -33
- package/dist/core/Blade.svelte +30 -30
- package/dist/core/Blade.svelte.d.ts +21 -21
- package/dist/core/Folder.svelte +34 -34
- package/dist/core/Folder.svelte.d.ts +22 -22
- package/dist/core/Pane.svelte +17 -17
- package/dist/core/Pane.svelte.d.ts +56 -56
- package/dist/core/Separator.svelte +5 -5
- package/dist/core/Separator.svelte.d.ts +20 -20
- package/dist/core/TabGroup.svelte +29 -29
- package/dist/core/TabGroup.svelte.d.ts +18 -18
- package/dist/core/TabPage.svelte +36 -36
- package/dist/core/TabPage.svelte.d.ts +21 -21
- package/dist/extra/AutoObject.svelte +20 -20
- package/dist/extra/AutoObject.svelte.d.ts +22 -22
- package/dist/extra/AutoValue.svelte +3 -3
- package/dist/extra/AutoValue.svelte.d.ts +26 -26
- package/dist/extra/Element.svelte +10 -10
- package/dist/extra/Element.svelte.d.ts +26 -26
- package/dist/index.d.ts +48 -48
- package/dist/index.js +35 -35
- package/dist/internal/ClsPad.svelte +11 -11
- package/dist/internal/ClsPad.svelte.d.ts +17 -17
- package/dist/internal/GenericBinding.svelte +11 -11
- package/dist/internal/GenericBinding.svelte.d.ts +25 -25
- package/dist/internal/GenericBladeFolding.svelte +19 -19
- package/dist/internal/GenericBladeFolding.svelte.d.ts +20 -20
- package/dist/internal/GenericInput.svelte +7 -7
- package/dist/internal/GenericInput.svelte.d.ts +27 -27
- package/dist/internal/GenericInputFolding.svelte +21 -21
- package/dist/internal/GenericInputFolding.svelte.d.ts +32 -32
- package/dist/internal/GenericMonitor.svelte +10 -10
- package/dist/internal/GenericMonitor.svelte.d.ts +29 -29
- package/dist/internal/GenericPane.svelte +48 -48
- package/dist/internal/GenericPane.svelte.d.ts +22 -22
- package/dist/internal/GenericSlider.svelte +15 -15
- package/dist/internal/GenericSlider.svelte.d.ts +29 -29
- package/dist/internal/InternalMonitorBoolean.svelte +5 -5
- package/dist/internal/InternalMonitorBoolean.svelte.d.ts +31 -31
- package/dist/internal/InternalMonitorNumber.svelte +14 -14
- package/dist/internal/InternalMonitorNumber.svelte.d.ts +37 -37
- package/dist/internal/InternalMonitorString.svelte +9 -9
- package/dist/internal/InternalMonitorString.svelte.d.ts +32 -32
- package/dist/internal/InternalPaneDraggable.svelte +169 -173
- package/dist/internal/InternalPaneDraggable.svelte.d.ts +30 -30
- package/dist/internal/InternalPaneFixed.svelte +13 -13
- package/dist/internal/InternalPaneFixed.svelte.d.ts +23 -23
- package/dist/internal/InternalPaneInline.svelte +14 -14
- package/dist/internal/InternalPaneInline.svelte.d.ts +21 -21
- package/dist/monitor/FpsGraph.svelte +35 -35
- package/dist/monitor/FpsGraph.svelte.d.ts +50 -42
- package/dist/monitor/Monitor.svelte +4 -4
- package/dist/monitor/Monitor.svelte.d.ts +87 -88
- package/dist/monitor/Profiler.svelte +37 -37
- package/dist/monitor/Profiler.svelte.d.ts +78 -76
- package/dist/monitor/WaveformMonitor.svelte +12 -12
- package/dist/monitor/WaveformMonitor.svelte.d.ts +39 -39
- package/dist/theme.d.ts +61 -61
- package/dist/theme.js +49 -53
- package/dist/utils.d.ts +62 -66
- package/dist/utils.js +78 -78
- package/license.txt +1 -1
- package/package.json +110 -125
- package/readme.md +1 -1
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
|
-
import Blade from '../core/Blade.svelte'
|
|
5
|
-
import ClsPad from '../internal/ClsPad.svelte'
|
|
6
|
-
import { fillWith } from '../utils'
|
|
7
|
-
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-profiler'
|
|
8
|
-
import { BROWSER } from 'esm-env'
|
|
9
|
-
import { createEventDispatcher, onDestroy } from 'svelte'
|
|
4
|
+
import Blade from '../core/Blade.svelte'
|
|
5
|
+
import ClsPad from '../internal/ClsPad.svelte'
|
|
6
|
+
import { fillWith } from '../utils'
|
|
7
|
+
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-profiler'
|
|
8
|
+
import { BROWSER } from 'esm-env'
|
|
9
|
+
import { createEventDispatcher, onDestroy } from 'svelte'
|
|
10
10
|
function _measure(name, functionToMeasure) {
|
|
11
|
-
profilerBlade?.measure(name, functionToMeasure)
|
|
11
|
+
profilerBlade?.measure(name, functionToMeasure)
|
|
12
12
|
}
|
|
13
13
|
async function _measureAsync(name, functionToMeasure) {
|
|
14
|
-
await profilerBlade?.measureAsync(name, functionToMeasure)
|
|
14
|
+
await profilerBlade?.measureAsync(name, functionToMeasure)
|
|
15
15
|
}
|
|
16
|
-
export let label = void 0
|
|
17
|
-
export let bufferSize = void 0
|
|
18
|
-
export let calcMode = void 0
|
|
19
|
-
export let deltaUnit = void 0
|
|
20
|
-
export let fractionDigits = void 0
|
|
21
|
-
export let measureHandler = void 0
|
|
22
|
-
export const measure = _measure
|
|
23
|
-
export const measureAsync = _measureAsync
|
|
24
|
-
export let interval = void 0
|
|
25
|
-
export let targetDelta = void 0
|
|
26
|
-
let profilerBlade
|
|
27
|
-
let options
|
|
28
|
-
let observer = void 0
|
|
29
|
-
const dispatch = createEventDispatcher()
|
|
16
|
+
export let label = void 0
|
|
17
|
+
export let bufferSize = void 0
|
|
18
|
+
export let calcMode = void 0
|
|
19
|
+
export let deltaUnit = void 0
|
|
20
|
+
export let fractionDigits = void 0
|
|
21
|
+
export let measureHandler = void 0
|
|
22
|
+
export const measure = _measure
|
|
23
|
+
export const measureAsync = _measureAsync
|
|
24
|
+
export let interval = void 0
|
|
25
|
+
export let targetDelta = void 0
|
|
26
|
+
let profilerBlade
|
|
27
|
+
let options
|
|
28
|
+
let observer = void 0
|
|
29
|
+
const dispatch = createEventDispatcher()
|
|
30
30
|
onDestroy(() => {
|
|
31
|
-
stopObservingMeasuredValue()
|
|
32
|
-
})
|
|
31
|
+
stopObservingMeasuredValue()
|
|
32
|
+
})
|
|
33
33
|
function startObservingMeasuredValue() {
|
|
34
|
-
stopObservingMeasuredValue()
|
|
35
|
-
const targetNode = profilerBlade.controller.view.valueElement
|
|
36
|
-
if (!targetNode?.innerHTML) return
|
|
34
|
+
stopObservingMeasuredValue()
|
|
35
|
+
const targetNode = profilerBlade.controller.view.valueElement
|
|
36
|
+
if (!targetNode?.innerHTML) return
|
|
37
37
|
observer = new MutationObserver((mutations) => {
|
|
38
38
|
for (const mutation of mutations) {
|
|
39
39
|
if (mutation.type === 'characterData' || mutation.type === 'childList') {
|
|
40
|
-
const fpsText = mutation.target.textContent
|
|
40
|
+
const fpsText = mutation.target.textContent
|
|
41
41
|
if (fpsText !== null) {
|
|
42
|
-
const delta = Number.parseFloat(fpsText)
|
|
43
|
-
!Number.isNaN(delta) && dispatch('change', delta)
|
|
42
|
+
const delta = Number.parseFloat(fpsText)
|
|
43
|
+
!Number.isNaN(delta) && dispatch('change', delta)
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
})
|
|
48
|
-
observer.observe(targetNode, { characterData: true, childList: true, subtree: true })
|
|
47
|
+
})
|
|
48
|
+
observer.observe(targetNode, { characterData: true, childList: true, subtree: true })
|
|
49
49
|
}
|
|
50
50
|
function stopObservingMeasuredValue() {
|
|
51
51
|
if (observer) {
|
|
52
|
-
observer.disconnect()
|
|
53
|
-
observer = void 0
|
|
52
|
+
observer.disconnect()
|
|
53
|
+
observer = void 0
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
$: profilerBlade && startObservingMeasuredValue()
|
|
56
|
+
$: profilerBlade && startObservingMeasuredValue()
|
|
57
57
|
$: options = {
|
|
58
58
|
bufferSize,
|
|
59
59
|
calcMode,
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
label,
|
|
64
64
|
measureHandler,
|
|
65
65
|
targetDelta,
|
|
66
|
-
view: 'profiler'
|
|
67
|
-
}
|
|
66
|
+
view: 'profiler',
|
|
67
|
+
}
|
|
68
68
|
</script>
|
|
69
69
|
|
|
70
70
|
<Blade bind:ref={profilerBlade} {options} plugin={pluginModule} {...$$restProps} />
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { SvelteComponent } from 'svelte'
|
|
2
|
-
import type { Simplify } from '../utils'
|
|
3
|
-
import type { ProfilerBladeMeasureHandler } from '@kitschpatrol/tweakpane-plugin-profiler'
|
|
4
|
-
export type ProfilerCalcMode = 'frame' | 'mean' | 'median'
|
|
5
|
-
export type ProfilerMeasure = (name: string, functionToMeasure: () => void) => void
|
|
1
|
+
import { SvelteComponent } from 'svelte'
|
|
2
|
+
import type { Simplify } from '../utils'
|
|
3
|
+
import type { ProfilerBladeMeasureHandler } from '@kitschpatrol/tweakpane-plugin-profiler'
|
|
4
|
+
export type ProfilerCalcMode = 'frame' | 'mean' | 'median'
|
|
5
|
+
export type ProfilerMeasure = (name: string, functionToMeasure: () => void) => void
|
|
6
6
|
export type ProfilerMeasureAsync = (
|
|
7
7
|
name: string,
|
|
8
|
-
functionToMeasure: () => Promise<void
|
|
9
|
-
) => Promise<void
|
|
10
|
-
export type ProfilerMeasureHandler = Simplify<ProfilerBladeMeasureHandler
|
|
11
|
-
export type ProfilerChangeEvent = CustomEvent<number
|
|
12
|
-
import type { ProfilerBladeApi as ProfilerRef } from '@kitschpatrol/tweakpane-plugin-profiler/dist/types/ProfilerBladeApi.js'
|
|
13
|
-
import type { ProfilerBladePluginParams as ProfilerOptions } from '@kitschpatrol/tweakpane-plugin-profiler/dist/types/ProfilerBladePluginParams.js'
|
|
8
|
+
functionToMeasure: () => Promise<void>,
|
|
9
|
+
) => Promise<void>
|
|
10
|
+
export type ProfilerMeasureHandler = Simplify<ProfilerBladeMeasureHandler>
|
|
11
|
+
export type ProfilerChangeEvent = CustomEvent<number>
|
|
12
|
+
import type { ProfilerBladeApi as ProfilerRef } from '@kitschpatrol/tweakpane-plugin-profiler/dist/types/ProfilerBladeApi.js'
|
|
13
|
+
import type { ProfilerBladePluginParams as ProfilerOptions } from '@kitschpatrol/tweakpane-plugin-profiler/dist/types/ProfilerBladePluginParams.js'
|
|
14
14
|
declare const __propDef: {
|
|
15
15
|
props: {
|
|
16
16
|
/**
|
|
@@ -24,7 +24,7 @@ declare const __propDef: {
|
|
|
24
24
|
* @readonly
|
|
25
25
|
* @default `undefined`
|
|
26
26
|
*/
|
|
27
|
-
measure?: ProfilerMeasure | undefined
|
|
27
|
+
measure?: ProfilerMeasure | undefined
|
|
28
28
|
/**
|
|
29
29
|
* Async variation of function handle that wraps another function to measure its execution
|
|
30
30
|
* duration.
|
|
@@ -35,14 +35,14 @@ declare const __propDef: {
|
|
|
35
35
|
* @readonly
|
|
36
36
|
* @default `undefined`
|
|
37
37
|
*/
|
|
38
|
-
measureAsync?: ProfilerMeasureAsync | undefined
|
|
38
|
+
measureAsync?: ProfilerMeasureAsync | undefined
|
|
39
39
|
} & ({
|
|
40
40
|
/**
|
|
41
41
|
* Number of duration samples from which to calculate the delta value when `calcMode` is
|
|
42
42
|
* `'mean'` or `'median'`.
|
|
43
43
|
* @default `30`
|
|
44
44
|
*/
|
|
45
|
-
bufferSize?: number
|
|
45
|
+
bufferSize?: number
|
|
46
46
|
/**
|
|
47
47
|
* How to calculate the delta value.
|
|
48
48
|
*
|
|
@@ -50,7 +50,7 @@ declare const __propDef: {
|
|
|
50
50
|
* calculated from the samples in the buffer.
|
|
51
51
|
* @default `'mean'`
|
|
52
52
|
*/
|
|
53
|
-
calcMode?: ProfilerCalcMode
|
|
53
|
+
calcMode?: ProfilerCalcMode
|
|
54
54
|
/**
|
|
55
55
|
* Label suffix for the delta values shown in the control.
|
|
56
56
|
*
|
|
@@ -58,12 +58,12 @@ declare const __propDef: {
|
|
|
58
58
|
* measuring something other than time.
|
|
59
59
|
* @default `'ms'`
|
|
60
60
|
* */
|
|
61
|
-
deltaUnit?: string
|
|
61
|
+
deltaUnit?: string
|
|
62
62
|
/**
|
|
63
63
|
* Precision of the delta values shown in the control.
|
|
64
64
|
* @default `2`
|
|
65
65
|
*/
|
|
66
|
-
fractionDigits?: number
|
|
66
|
+
fractionDigits?: number
|
|
67
67
|
/**
|
|
68
68
|
* Milliseconds between updates to the profiler visualization and delta label text.
|
|
69
69
|
*
|
|
@@ -71,12 +71,12 @@ declare const __propDef: {
|
|
|
71
71
|
* is determined by your calls to the bound `measure` function.
|
|
72
72
|
* @default `500`
|
|
73
73
|
*/
|
|
74
|
-
interval?: number
|
|
74
|
+
interval?: number
|
|
75
75
|
/**
|
|
76
76
|
* Text displayed next to the profiler visualization.
|
|
77
77
|
* @default `undefined`
|
|
78
78
|
* */
|
|
79
|
-
label?: string
|
|
79
|
+
label?: string
|
|
80
80
|
/**
|
|
81
81
|
* Function handle that wraps another function to measure its execution duration.
|
|
82
82
|
*
|
|
@@ -89,7 +89,7 @@ declare const __propDef: {
|
|
|
89
89
|
* @readonly
|
|
90
90
|
* @default `undefined`
|
|
91
91
|
*/
|
|
92
|
-
measure?: ProfilerMeasure
|
|
92
|
+
measure?: ProfilerMeasure
|
|
93
93
|
/**
|
|
94
94
|
* Async variation of function handle that wraps another function to measure its execution
|
|
95
95
|
* duration.
|
|
@@ -101,7 +101,7 @@ declare const __propDef: {
|
|
|
101
101
|
* @readonly
|
|
102
102
|
* @default `undefined`
|
|
103
103
|
*/
|
|
104
|
-
measureAsync?: ProfilerMeasureAsync
|
|
104
|
+
measureAsync?: ProfilerMeasureAsync
|
|
105
105
|
/**
|
|
106
106
|
* Function wrapping the `measure` function.
|
|
107
107
|
*
|
|
@@ -109,13 +109,13 @@ declare const __propDef: {
|
|
|
109
109
|
* @default [`new
|
|
110
110
|
* ProfilerBladeDefaultMeasureHandler()`](https://github.com/kitschpatrol/tweakpane-plugin-profiler/blob/dev/src/ProfilerBladeDefaultMeasureHandler.ts)
|
|
111
111
|
*/
|
|
112
|
-
measureHandler?: ProfilerMeasureHandler
|
|
112
|
+
measureHandler?: ProfilerMeasureHandler
|
|
113
113
|
/**
|
|
114
114
|
* Determines the horizontal scale and color mapping of the profiler visualization bars.
|
|
115
115
|
* @default `16.67` \
|
|
116
116
|
* 60fps.
|
|
117
117
|
*/
|
|
118
|
-
targetDelta?: number
|
|
118
|
+
targetDelta?: number
|
|
119
119
|
} & Omit<
|
|
120
120
|
{
|
|
121
121
|
/**
|
|
@@ -123,19 +123,19 @@ declare const __propDef: {
|
|
|
123
123
|
* [`BladeParams`](https://tweakpane.github.io/docs/api/interfaces/BaseBladeParams.html).
|
|
124
124
|
*
|
|
125
125
|
*/
|
|
126
|
-
options: ProfilerOptions
|
|
126
|
+
options: ProfilerOptions
|
|
127
127
|
/**
|
|
128
128
|
* Prevent interactivity and gray out the control.
|
|
129
129
|
* @default `false`
|
|
130
130
|
*/
|
|
131
|
-
disabled?: boolean
|
|
131
|
+
disabled?: boolean
|
|
132
132
|
/**
|
|
133
133
|
* Custom color scheme.
|
|
134
134
|
* @default `undefined` \
|
|
135
135
|
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
136
136
|
* set with `setGlobalDefaultTheme()`.
|
|
137
137
|
*/
|
|
138
|
-
theme?: import('..').Theme | undefined
|
|
138
|
+
theme?: import('..').Theme | undefined
|
|
139
139
|
/**
|
|
140
140
|
* Reference to internal Tweakpane
|
|
141
141
|
* [`BladeApi`](https://tweakpane.github.io/docs/api/classes/BladeApi.html) for this blade.
|
|
@@ -148,7 +148,7 @@ declare const __propDef: {
|
|
|
148
148
|
* @bindable
|
|
149
149
|
* @readonly
|
|
150
150
|
*/
|
|
151
|
-
ref?: ProfilerRef | undefined
|
|
151
|
+
ref?: ProfilerRef | undefined
|
|
152
152
|
/**
|
|
153
153
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
154
154
|
* the `<Blade>`'s containing `<Pane>`.
|
|
@@ -160,11 +160,11 @@ declare const __propDef: {
|
|
|
160
160
|
*
|
|
161
161
|
* @default `undefined`
|
|
162
162
|
*/
|
|
163
|
-
plugin?: import('../utils').Plugin | undefined
|
|
163
|
+
plugin?: import('../utils').Plugin | undefined
|
|
164
164
|
},
|
|
165
165
|
'ref' | 'options' | 'plugin'
|
|
166
|
-
>)
|
|
167
|
-
slots: {}
|
|
166
|
+
>)
|
|
167
|
+
slots: {}
|
|
168
168
|
events: {
|
|
169
169
|
/**
|
|
170
170
|
* Fires when the overall delta value changes, passing the latest measurement.
|
|
@@ -173,12 +173,12 @@ declare const __propDef: {
|
|
|
173
173
|
* `event.detail` parameter.
|
|
174
174
|
* @event
|
|
175
175
|
* */
|
|
176
|
-
change: ProfilerChangeEvent
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
export type ProfilerProps = typeof __propDef.props
|
|
180
|
-
export type ProfilerEvents = typeof __propDef.events
|
|
181
|
-
export type ProfilerSlots = typeof __propDef.slots
|
|
176
|
+
change: ProfilerChangeEvent
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
export type ProfilerProps = typeof __propDef.props
|
|
180
|
+
export type ProfilerEvents = typeof __propDef.events
|
|
181
|
+
export type ProfilerSlots = typeof __propDef.slots
|
|
182
182
|
/**
|
|
183
183
|
* Measure and visualize multiple quantities over time.
|
|
184
184
|
*
|
|
@@ -198,67 +198,69 @@ export type ProfilerSlots = typeof __propDef.slots;
|
|
|
198
198
|
* @example
|
|
199
199
|
* ```svelte
|
|
200
200
|
* <script lang="ts">
|
|
201
|
-
* import { onMount } from 'svelte'
|
|
201
|
+
* import { onMount } from 'svelte'
|
|
202
202
|
* import {
|
|
203
203
|
* Profiler,
|
|
204
204
|
* type ProfilerMeasure,
|
|
205
|
-
* Slider
|
|
206
|
-
* } from 'svelte-tweakpane-ui'
|
|
205
|
+
* Slider,
|
|
206
|
+
* } from 'svelte-tweakpane-ui'
|
|
207
207
|
*
|
|
208
|
-
* //
|
|
208
|
+
* // This is a readonly function handle assigned by Profiler component
|
|
209
209
|
* // first used in onMount since it is not bound until then
|
|
210
|
-
* let measure: ProfilerMeasure
|
|
210
|
+
* let measure: ProfilerMeasure
|
|
211
211
|
*
|
|
212
|
-
* let loopExponent = 1
|
|
212
|
+
* let loopExponent = 1
|
|
213
213
|
*
|
|
214
|
-
* //
|
|
214
|
+
* // Helper to test Math functions
|
|
215
215
|
* function hardWork(
|
|
216
216
|
* function_: (n: number) => number,
|
|
217
|
-
* exponent: number
|
|
217
|
+
* exponent: number,
|
|
218
218
|
* ): void {
|
|
219
219
|
* measure(function_.name, () => {
|
|
220
220
|
* for (let sum = 0; sum < Number('1e' + exponent); sum++) {
|
|
221
|
-
* function_(sum)
|
|
221
|
+
* function_(sum)
|
|
222
222
|
* }
|
|
223
|
-
* })
|
|
223
|
+
* })
|
|
224
224
|
* }
|
|
225
225
|
*
|
|
226
226
|
* onMount(() => {
|
|
227
|
-
* let animationFrameHandle: number
|
|
227
|
+
* let animationFrameHandle: number
|
|
228
228
|
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
229
|
+
* // Nesting measurements creates a hierarchy
|
|
230
|
+
* // in the Profile visualization
|
|
231
|
+
* function tick() {
|
|
232
232
|
* measure('Tick', () => {
|
|
233
233
|
* measure('Trigonometry', () => {
|
|
234
|
-
* hardWork(Math.sin, loopExponent)
|
|
235
|
-
* hardWork(Math.cos, loopExponent)
|
|
236
|
-
* hardWork(Math.tan, loopExponent)
|
|
237
|
-
* hardWork(Math.atan, loopExponent)
|
|
238
|
-
* hardWork(Math.acos, loopExponent)
|
|
239
|
-
* hardWork(Math.acosh, loopExponent)
|
|
240
|
-
* })
|
|
234
|
+
* hardWork(Math.sin, loopExponent)
|
|
235
|
+
* hardWork(Math.cos, loopExponent)
|
|
236
|
+
* hardWork(Math.tan, loopExponent)
|
|
237
|
+
* hardWork(Math.atan, loopExponent)
|
|
238
|
+
* hardWork(Math.acos, loopExponent)
|
|
239
|
+
* hardWork(Math.acosh, loopExponent)
|
|
240
|
+
* })
|
|
241
241
|
* measure('Logarithms', () => {
|
|
242
|
-
* hardWork(Math.log, loopExponent)
|
|
243
|
-
* hardWork(Math.log10, loopExponent)
|
|
244
|
-
* hardWork(Math.log1p, loopExponent)
|
|
245
|
-
* hardWork(Math.log2, loopExponent)
|
|
246
|
-
* })
|
|
242
|
+
* hardWork(Math.log, loopExponent)
|
|
243
|
+
* hardWork(Math.log10, loopExponent)
|
|
244
|
+
* hardWork(Math.log1p, loopExponent)
|
|
245
|
+
* hardWork(Math.log2, loopExponent)
|
|
246
|
+
* })
|
|
247
247
|
* measure('Rounding', () => {
|
|
248
|
-
* hardWork(Math.round, loopExponent)
|
|
249
|
-
* hardWork(Math.floor, loopExponent)
|
|
250
|
-
* hardWork(Math.ceil, loopExponent)
|
|
251
|
-
* hardWork(Math.fround, loopExponent)
|
|
252
|
-
* })
|
|
253
|
-
* })
|
|
248
|
+
* hardWork(Math.round, loopExponent)
|
|
249
|
+
* hardWork(Math.floor, loopExponent)
|
|
250
|
+
* hardWork(Math.ceil, loopExponent)
|
|
251
|
+
* hardWork(Math.fround, loopExponent)
|
|
252
|
+
* })
|
|
253
|
+
* })
|
|
254
|
+
*
|
|
255
|
+
* animationFrameHandle = requestAnimationFrame(tick)
|
|
256
|
+
* }
|
|
254
257
|
*
|
|
255
|
-
*
|
|
256
|
-
* })();
|
|
258
|
+
* tick()
|
|
257
259
|
*
|
|
258
260
|
* return () => {
|
|
259
|
-
* cancelAnimationFrame(animationFrameHandle)
|
|
260
|
-
* }
|
|
261
|
-
* })
|
|
261
|
+
* cancelAnimationFrame(animationFrameHandle)
|
|
262
|
+
* }
|
|
263
|
+
* })
|
|
262
264
|
* </script>
|
|
263
265
|
*
|
|
264
266
|
* <Profiler bind:measure label="Profiler" />
|
|
@@ -279,7 +281,7 @@ export default class Profiler extends SvelteComponent<
|
|
|
279
281
|
ProfilerEvents,
|
|
280
282
|
ProfilerSlots
|
|
281
283
|
> {
|
|
282
|
-
get measure(): ProfilerMeasure
|
|
283
|
-
get measureAsync(): ProfilerMeasureAsync
|
|
284
|
+
get measure(): ProfilerMeasure
|
|
285
|
+
get measureAsync(): ProfilerMeasureAsync
|
|
284
286
|
}
|
|
285
|
-
export {}
|
|
287
|
+
export {}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
|
-
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
-
import GenericMonitor from '../internal/GenericMonitor.svelte'
|
|
6
|
-
import { fillWith } from '../utils'
|
|
7
|
-
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-waveform'
|
|
8
|
-
import { BROWSER } from 'esm-env'
|
|
9
|
-
export let value
|
|
10
|
-
export let max = void 0
|
|
11
|
-
export let min = void 0
|
|
12
|
-
export let lineStyle = void 0
|
|
13
|
-
let options
|
|
4
|
+
import ClsPad from '../internal/ClsPad.svelte'
|
|
5
|
+
import GenericMonitor from '../internal/GenericMonitor.svelte'
|
|
6
|
+
import { fillWith } from '../utils'
|
|
7
|
+
import * as pluginModule from '@kitschpatrol/tweakpane-plugin-waveform'
|
|
8
|
+
import { BROWSER } from 'esm-env'
|
|
9
|
+
export let value
|
|
10
|
+
export let max = void 0
|
|
11
|
+
export let min = void 0
|
|
12
|
+
export let lineStyle = void 0
|
|
13
|
+
let options
|
|
14
14
|
$: options = {
|
|
15
15
|
min,
|
|
16
16
|
max,
|
|
17
17
|
lineStyle,
|
|
18
18
|
readonly: true,
|
|
19
|
-
view: 'waveform'
|
|
20
|
-
}
|
|
19
|
+
view: 'waveform',
|
|
20
|
+
}
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<GenericMonitor {value} {options} plugin={pluginModule} {...$$restProps} />
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { SvelteComponent } from 'svelte'
|
|
2
|
-
export type WaveformMonitorValue = number[] | Uint8Array | Uint16Array | Uint32Array
|
|
3
|
-
import type { WaveformStyles as WaveformMonitorLineStyle } from '@kitschpatrol/tweakpane-plugin-waveform/dist/types/view/waveform.js'
|
|
1
|
+
import { SvelteComponent } from 'svelte'
|
|
2
|
+
export type WaveformMonitorValue = number[] | Uint8Array | Uint16Array | Uint32Array
|
|
3
|
+
import type { WaveformStyles as WaveformMonitorLineStyle } from '@kitschpatrol/tweakpane-plugin-waveform/dist/types/view/waveform.js'
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
/**
|
|
7
7
|
* Waveform values.
|
|
8
8
|
* @bindable
|
|
9
9
|
* */
|
|
10
|
-
value: WaveformMonitorValue
|
|
10
|
+
value: WaveformMonitorValue
|
|
11
11
|
/**
|
|
12
12
|
* Minimum graph bound.
|
|
13
13
|
* @default `0`
|
|
14
14
|
* */
|
|
15
|
-
min?: number
|
|
15
|
+
min?: number
|
|
16
16
|
/**
|
|
17
17
|
* Maximum graph bound.
|
|
18
18
|
* @default `100`
|
|
19
19
|
* */
|
|
20
|
-
max?: number
|
|
20
|
+
max?: number
|
|
21
21
|
/**
|
|
22
22
|
* Line style.
|
|
23
23
|
* @default `'linear''`
|
|
24
24
|
* */
|
|
25
|
-
lineStyle?: 'bezier' | 'linear'
|
|
25
|
+
lineStyle?: 'bezier' | 'linear'
|
|
26
26
|
} & Omit<
|
|
27
27
|
{
|
|
28
28
|
/**
|
|
@@ -30,14 +30,14 @@ declare const __propDef: {
|
|
|
30
30
|
* @default `1` \
|
|
31
31
|
* Or `64` if value is `number` and `graph` is `true`.
|
|
32
32
|
*/
|
|
33
|
-
bufferSize?: number
|
|
33
|
+
bufferSize?: number
|
|
34
34
|
/**
|
|
35
35
|
* Time between value samples in milliseconds.
|
|
36
36
|
*
|
|
37
37
|
* Useful when `graph` is true. Defaults to reactive value updates only (`interval={0}`).
|
|
38
38
|
* @default `0`
|
|
39
39
|
*/
|
|
40
|
-
interval?: number
|
|
40
|
+
interval?: number
|
|
41
41
|
/**
|
|
42
42
|
* Number of visible rows of state history.
|
|
43
43
|
*
|
|
@@ -46,32 +46,32 @@ declare const __propDef: {
|
|
|
46
46
|
* @default `1` \
|
|
47
47
|
* Or `3` if value is `string` and `multiline` is `true`.
|
|
48
48
|
*/
|
|
49
|
-
rows?: number
|
|
49
|
+
rows?: number
|
|
50
50
|
} & {
|
|
51
51
|
/**
|
|
52
52
|
* Waveform values.
|
|
53
53
|
* @bindable
|
|
54
54
|
*/
|
|
55
|
-
value: WaveformMonitorValue
|
|
55
|
+
value: WaveformMonitorValue
|
|
56
56
|
} & Omit<
|
|
57
57
|
{
|
|
58
58
|
/**
|
|
59
59
|
* The binding's target object with values to manipulate.
|
|
60
60
|
* @bindable
|
|
61
61
|
*/
|
|
62
|
-
object: import('@tweakpane/core').Bindable & Record<string, WaveformMonitorValue
|
|
62
|
+
object: import('@tweakpane/core').Bindable & Record<string, WaveformMonitorValue>
|
|
63
63
|
/** The key for the value in the target `object` that the control should manipulate. */
|
|
64
|
-
key: string
|
|
64
|
+
key: string
|
|
65
65
|
/**
|
|
66
66
|
* Prevent interactivity and gray out the control.
|
|
67
67
|
* @default `false`
|
|
68
68
|
*/
|
|
69
|
-
disabled?: boolean
|
|
69
|
+
disabled?: boolean
|
|
70
70
|
/**
|
|
71
71
|
* Text displayed next to control.
|
|
72
72
|
* @default `undefined`
|
|
73
73
|
*/
|
|
74
|
-
label?: string | undefined
|
|
74
|
+
label?: string | undefined
|
|
75
75
|
/**
|
|
76
76
|
* Tweakpane's internal options object.
|
|
77
77
|
*
|
|
@@ -86,11 +86,11 @@ declare const __propDef: {
|
|
|
86
86
|
*/
|
|
87
87
|
options?:
|
|
88
88
|
| ({
|
|
89
|
-
min?: number
|
|
90
|
-
max?: number
|
|
91
|
-
lineStyle?: WaveformMonitorLineStyle
|
|
89
|
+
min?: number
|
|
90
|
+
max?: number
|
|
91
|
+
lineStyle?: WaveformMonitorLineStyle
|
|
92
92
|
} & import('@tweakpane/core').BaseMonitorParams)
|
|
93
|
-
| undefined
|
|
93
|
+
| undefined
|
|
94
94
|
/**
|
|
95
95
|
* Custom color scheme.
|
|
96
96
|
*
|
|
@@ -98,7 +98,7 @@ declare const __propDef: {
|
|
|
98
98
|
* Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
|
|
99
99
|
* set with `setGlobalDefaultTheme()`.
|
|
100
100
|
*/
|
|
101
|
-
theme?: import('..').Theme | undefined
|
|
101
|
+
theme?: import('..').Theme | undefined
|
|
102
102
|
/**
|
|
103
103
|
* Reference to internal Tweakpane
|
|
104
104
|
* [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
|
|
@@ -112,7 +112,7 @@ declare const __propDef: {
|
|
|
112
112
|
* @bindable
|
|
113
113
|
* @readonly
|
|
114
114
|
*/
|
|
115
|
-
ref?: import('../internal/GenericMonitor.svelte').GenericMonitorRef | undefined
|
|
115
|
+
ref?: import('../internal/GenericMonitor.svelte').GenericMonitorRef | undefined
|
|
116
116
|
/**
|
|
117
117
|
* Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
|
|
118
118
|
* the `<Binding>`'s containing `<Pane>`.
|
|
@@ -124,22 +124,22 @@ declare const __propDef: {
|
|
|
124
124
|
*
|
|
125
125
|
* @default `undefined`
|
|
126
126
|
*/
|
|
127
|
-
plugin?: import('../utils').Plugin | undefined
|
|
127
|
+
plugin?: import('../utils').Plugin | undefined
|
|
128
128
|
},
|
|
129
129
|
'object' | 'key'
|
|
130
130
|
>,
|
|
131
131
|
'ref' | 'options' | 'plugin'
|
|
132
|
-
|
|
132
|
+
>
|
|
133
133
|
events: {
|
|
134
|
-
[evt: string]: CustomEvent<any
|
|
135
|
-
}
|
|
136
|
-
slots: {}
|
|
137
|
-
exports?: {} | undefined
|
|
138
|
-
bindings?: string | undefined
|
|
139
|
-
}
|
|
140
|
-
export type WaveformMonitorProps = typeof __propDef.props
|
|
141
|
-
export type WaveformMonitorEvents = typeof __propDef.events
|
|
142
|
-
export type WaveformMonitorSlots = typeof __propDef.slots
|
|
134
|
+
[evt: string]: CustomEvent<any>
|
|
135
|
+
}
|
|
136
|
+
slots: {}
|
|
137
|
+
exports?: {} | undefined
|
|
138
|
+
bindings?: string | undefined
|
|
139
|
+
}
|
|
140
|
+
export type WaveformMonitorProps = typeof __propDef.props
|
|
141
|
+
export type WaveformMonitorEvents = typeof __propDef.events
|
|
142
|
+
export type WaveformMonitorSlots = typeof __propDef.slots
|
|
143
143
|
/**
|
|
144
144
|
* Visualize multiple numeric values as a waveform.
|
|
145
145
|
*
|
|
@@ -156,18 +156,18 @@ export type WaveformMonitorSlots = typeof __propDef.slots;
|
|
|
156
156
|
* @example
|
|
157
157
|
* ```svelte
|
|
158
158
|
* <script lang="ts">
|
|
159
|
-
* import { WaveformMonitor } from 'svelte-tweakpane-ui'
|
|
159
|
+
* import { WaveformMonitor } from 'svelte-tweakpane-ui'
|
|
160
160
|
*
|
|
161
|
-
* let waveData = [5, 6, 7, 8, 9, 3, 9, 8, 7, 6, 5]
|
|
161
|
+
* let waveData = [5, 6, 7, 8, 9, 3, 9, 8, 7, 6, 5]
|
|
162
162
|
*
|
|
163
163
|
* setInterval(() => {
|
|
164
164
|
* waveData = waveData.map((v) =>
|
|
165
|
-
* Math.max(0, Math.min(10, v + (Math.random() * 2 - 1) * 0.5))
|
|
166
|
-
* )
|
|
167
|
-
* }, 10)
|
|
165
|
+
* Math.max(0, Math.min(10, v + (Math.random() * 2 - 1) * 0.5)),
|
|
166
|
+
* )
|
|
167
|
+
* }, 10)
|
|
168
168
|
* </script>
|
|
169
169
|
*
|
|
170
|
-
* <WaveformMonitor value={waveData} min={-1} max={11} lineStyle=
|
|
170
|
+
* <WaveformMonitor value={waveData} min={-1} max={11} lineStyle="bezier" />
|
|
171
171
|
* ```
|
|
172
172
|
*
|
|
173
173
|
* @sourceLink
|
|
@@ -178,4 +178,4 @@ export default class WaveformMonitor extends SvelteComponent<
|
|
|
178
178
|
WaveformMonitorEvents,
|
|
179
179
|
WaveformMonitorSlots
|
|
180
180
|
> {}
|
|
181
|
-
export {}
|
|
181
|
+
export {}
|