svelte-tweakpane-ui 1.2.4 → 1.2.6

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.
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@tweakpane/plugin-essentials';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-essentials';
5
5
  import Blade from '../core/Blade.svelte';
6
6
  import ClsPad from '../internal/ClsPad.svelte';
7
7
  import { fillWith } from '../utils';
@@ -7,8 +7,8 @@ export type ButtonGridClickEvent = CustomEvent<{
7
7
  index: number;
8
8
  label: string;
9
9
  }>;
10
- import type { ButtonGridApi as ButtonGridRef } from '@tweakpane/plugin-essentials';
11
- import type { ButtonGridBladeParams as ButtonGridOptions } from '@tweakpane/plugin-essentials/dist/types/button-grid/plugin.d.ts';
10
+ import type { ButtonGridApi as ButtonGridRef } from '@kitschpatrol/tweakpane-plugin-essentials';
11
+ import type { ButtonGridBladeParams as ButtonGridOptions } from '@kitschpatrol/tweakpane-plugin-essentials/dist/types/button-grid/plugin.d.ts';
12
12
  declare const __propDef: {
13
13
  props: {
14
14
  /**
@@ -121,6 +121,8 @@ export type ButtonGridSlots = typeof __propDef.slots;
121
121
  * Usage outside of a `<Pane>` component will implicitly wrap the button grid in `<Pane
122
122
  * position="inline">`.
123
123
  *
124
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-essentials) of the plugin with build optimizations. The fork also changes the package name from `@tweakpane/plugin-essentials` to `@kitschpatrol/tweakpane-plugin-essentials` for consistency with other plugins.
125
+ *
124
126
  * @emits {ButtonGridClickEvent} click - When a button in the grid is clicked.
125
127
  *
126
128
  * @example
@@ -1,8 +1,8 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@tweakpane/plugin-essentials';
5
- import { CubicBezier } from '@tweakpane/plugin-essentials';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-essentials';
5
+ import { CubicBezier } from '@kitschpatrol/tweakpane-plugin-essentials';
6
6
  import ClsPad from '../internal/ClsPad.svelte';
7
7
  import GenericBladeFolding from '../internal/GenericBladeFolding.svelte';
8
8
  import { fillWith } from '../utils';
@@ -10,8 +10,8 @@ export type CubicBezierValueObject = {
10
10
  export type CubicBezierValueTuple = [x1: number, y1: number, x2: number, y2: number];
11
11
  export type CubicBezierValue = Simplify<CubicBezierValueObject | CubicBezierValueTuple>;
12
12
  export type CubicBezierChangeEvent = ValueChangeEvent<CubicBezierValue>;
13
- import type { CubicBezierApi as CubicBezierRef } from '@tweakpane/plugin-essentials';
14
- import type { CubicBezierBladeParams as CubicBezierOptions } from '@tweakpane/plugin-essentials/dist/types/cubic-bezier/plugin.d.ts';
13
+ import type { CubicBezierApi as CubicBezierRef } from '@kitschpatrol/tweakpane-plugin-essentials';
14
+ import type { CubicBezierBladeParams as CubicBezierOptions } from '@kitschpatrol/tweakpane-plugin-essentials/dist/types/cubic-bezier/plugin.d.ts';
15
15
  declare const __propDef: {
16
16
  props: {
17
17
  /**
@@ -137,11 +137,7 @@ export type CubicBezierSlots = typeof __propDef.slots;
137
137
  * Usage outside of a `<Pane>` component will implicitly wrap the cubic bezier control in `<Pane
138
138
  * position="inline">`.
139
139
  *
140
- * _Note: An issue with unreleased resources has been observed in situations when the `value` prop is
141
- * set frequently. A [PR on the Plugin Essentials repo with a
142
- * fix](https://github.com/tweakpane/plugin-essentials/pull/21) is currently pending a review and
143
- * merge. Consider monitoring the performance of this component in the context of your use case until
144
- * this issue is resolved._
140
+ * Note that _Svelte Tweakpane UI_ embeds a [fork](https://github.com/kitschpatrol/tweakpane-plugin-essentials) of the plugin with build optimizations and [a fix for a performance issue](https://github.com/tweakpane/plugin-essentials/pull/21). The fork also changes the package name from `@tweakpane/plugin-essentials` to `@kitschpatrol/tweakpane-plugin-essentials` for consistency with other plugins.
145
141
  *
146
142
  * @emits {CubicBezierChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
147
143
  *
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@kitschpatrol/tweakpane-image-plugin';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-image';
5
5
  import ClsPad from '../internal/ClsPad.svelte';
6
6
  import GenericInput from '../internal/GenericInput.svelte';
7
7
  import { fillWith } from '../utils';
@@ -130,17 +130,13 @@ export type ImageSlots = typeof __propDef.slots;
130
130
  * Dias](https://www.linkedin.com/in/matheusdbs/), [Palash Bansal](https://github.com/repalash), and
131
131
  * others.
132
132
  *
133
- * Note that _Svelte Tweakpane UI_ embeds a
134
- * [fork](https://github.com/kitschpatrol/tweakpane-image-plugin) of the plugin with support for
135
- * Tweakpane 4. The dependency will be updated to point to the source repository if / when the open
136
- * [pull request](https://github.com/metehus/tweakpane-image-plugin/pull/1) with Tweakpane 4 support is
137
- * merged.
138
- *
139
133
  * There is currently a known bug where change events' `origin` values are sometimes incorrect. (This issue is limited to this component.)
140
134
  *
141
135
  * Usage outside of a `<Pane>` component will implicitly wrap the image control in `<Pane
142
136
  * position="inline">`.
143
137
  *
138
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-image) of the plugin with build optimizations. The fork also changes the package name to `@kitschpatrol/tweakpane-plugin-image` for consistency with other plugins.
139
+ *
144
140
  * @emits {ImageChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
145
141
  *
146
142
  * @example
@@ -149,14 +145,20 @@ export type ImageSlots = typeof __propDef.slots;
149
145
  * import { Button, Image } from 'svelte-tweakpane-ui';
150
146
  *
151
147
  * let source = 'placeholder';
152
- * let kittenIndex = 1;
148
+ *
149
+ * async function getRandomKittenUrl() {
150
+ * const { url } = await fetch(
151
+ * 'https://source.unsplash.com/800x800/?kitten',
152
+ * { method: 'HEAD', redirect: 'follow' }
153
+ * );
154
+ * return url;
155
+ * }
153
156
  * </script>
154
157
  *
155
158
  * <Image bind:value={source} fit="contain" label="Image" />
156
159
  * <Button
157
- * on:click={() => {
158
- * source = `https://placekitten.com/1024/1024?image=${kittenIndex}`;
159
- * kittenIndex = (kittenIndex % 16) + 1;
160
+ * on:click={async () => {
161
+ * source = await getRandomKittenUrl();
160
162
  * }}
161
163
  * label="Random Placeholder"
162
164
  * title="Load Kitten"
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@tweakpane/plugin-essentials';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-essentials';
5
5
  import GenericSlider from '../internal/GenericSlider.svelte';
6
6
  export let value;
7
7
  export let meanValue = void 0;
@@ -56,17 +56,7 @@ declare const __propDef: {
56
56
  * [Dynamic based on magnitude of
57
57
  * `value`](https://github.com/cocopon/tweakpane/blob/66dfbea04bfe9b7f031673c955ceda1f92356e75/packages/core/src/common/number/util.ts#L54).
58
58
  */
59
- pointerScale?: number | undefined /**
60
- * Fires when `value` changes.
61
- *
62
- * _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
63
- *
64
- * The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
65
- * and changes resulting from programmatic manipulation of the `value` (`external`).
66
- *
67
- * @extends ValueChangeEvent
68
- * @event
69
- * */;
59
+ pointerScale?: number | undefined;
70
60
  /**
71
61
  * The minimum step interval.
72
62
  * @default `undefined` \
@@ -185,6 +175,8 @@ export type IntervalSliderSlots = typeof __propDef.slots;
185
175
  * Usage outside of a `<Pane>` component will implicitly wrap the interval slider in `<Pane
186
176
  * position="inline">`.
187
177
  *
178
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-essentials) of the plugin with build optimizations. The fork also changes the package name from `@tweakpane/plugin-essentials` to `@kitschpatrol/tweakpane-plugin-essentials` for consistency with other plugins.
179
+ *
188
180
  * @emits {IntervalSliderChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
189
181
  *
190
182
  * @example
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script generics="T extends boolean | number | string">
4
- import * as pluginModule from '@tweakpane/plugin-essentials';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-essentials';
5
5
  import ClsPad from '../internal/ClsPad.svelte';
6
6
  import GenericInput from '../internal/GenericInput.svelte';
7
7
  import { fillWith } from '../utils';
@@ -190,6 +190,8 @@ export type RadioGridSlots<T extends boolean | number | string> = ReturnType<
190
190
  * Usage outside of a `<Pane>` component will implicitly wrap the radio grid in `<Pane
191
191
  * position="inline">`.
192
192
  *
193
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-essentials) of the plugin with build optimizations. The fork also changes the package name from `@tweakpane/plugin-essentials` to `@kitschpatrol/tweakpane-plugin-essentials` for consistency with other plugins.
194
+ *
193
195
  * @emits {RadioGridChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
194
196
  *
195
197
  * @example
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@tweakpane/plugin-camerakit';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-camerakit';
5
5
  import GenericSlider from '../internal/GenericSlider.svelte';
6
6
  export let value;
7
7
  export let series = void 0;
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from 'svelte';
2
- import type { RingSeries } from '@tweakpane/plugin-camerakit/dist/types/util.js';
2
+ import type { RingSeries } from '@kitschpatrol/tweakpane-plugin-camerakit/dist/types/util.js';
3
3
  import type { ValueChangeEvent } from '../utils.js';
4
4
  type RingUnit = {
5
5
  /**
@@ -198,6 +198,8 @@ export type RingSlots = typeof __propDef.slots;
198
198
  *
199
199
  * Usage outside of a `<Pane>` component will implicitly wrap the ring in `<Pane position="inline">`.
200
200
  *
201
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-camerakit) of the plugin with build optimizations. The fork also changes the package name from `@tweakpane/plugin-camerakit` to `@kitschpatrol/tweakpane-plugin-camerakit` for consistency with other plugins.
202
+ *
201
203
  * @emits {RingChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
202
204
  *
203
205
  * @example
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@0b5vr/tweakpane-plugin-rotation';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-rotation';
5
5
  import ClsPad from '../internal/ClsPad.svelte';
6
6
  import GenericInputFolding from '../internal/GenericInputFolding.svelte';
7
7
  import { BROWSER } from 'esm-env';
@@ -1,6 +1,6 @@
1
1
  import { SvelteComponent } from 'svelte';
2
- import type { EulerOrder } from '@0b5vr/tweakpane-plugin-rotation/dist/types/EulerOrder.js';
3
- import type { EulerUnit } from '@0b5vr/tweakpane-plugin-rotation/dist/types/EulerUnit.js';
2
+ import type { EulerOrder } from '@kitschpatrol/tweakpane-plugin-rotation/dist/types/EulerOrder.js';
3
+ import type { EulerUnit } from '@kitschpatrol/tweakpane-plugin-rotation/dist/types/EulerUnit.js';
4
4
  import type { PointDimensionParams } from '@tweakpane/core';
5
5
  import type { Simplify } from '../utils';
6
6
  import type { ValueChangeEvent } from '../utils.js';
@@ -15,7 +15,7 @@ export type RotationEulerValueObject = {
15
15
  export type RotationEulerValueTuple = [x: number, y: number, z: number];
16
16
  export type RotationEulerValue = Simplify<RotationEulerValueObject | RotationEulerValueTuple>;
17
17
  export type RotationEulerChangeEvent = ValueChangeEvent<RotationEulerValue>;
18
- import type { RotationInputPluginEulerParams as RotationEulerOptionsInternal } from '@0b5vr/tweakpane-plugin-rotation/dist/types/RotationInputPluginEulerParams';
18
+ import type { RotationInputPluginEulerParams as RotationEulerOptionsInternal } from '@kitschpatrol/tweakpane-plugin-rotation/dist/types/RotationInputPluginEulerParams';
19
19
  declare const __propDef: {
20
20
  props: {
21
21
  /**
@@ -220,8 +220,7 @@ export type RotationEulerSlots = typeof __propDef.slots;
220
220
  /**
221
221
  * Integrates the [euler
222
222
  * rotation](https://github.com/0b5vr/tweakpane-plugin-rotation/blob/dev/src/RotationInputPluginEuler.ts)
223
- * control from [0b5vr's](https://0b5vr.com)
224
- * [tweakpane-plugin-rotation](https://github.com/0b5vr/tweakpane-plugin-rotation).
223
+ * control from [0b5vr](https://0b5vr.com)'s [tweakpane-plugin-rotation](https://github.com/0b5vr/tweakpane-plugin-rotation).
225
224
  *
226
225
  * _Svelte Tweakpane UI_ extends the original API to support tuple values in addition to object values.
227
226
  * (Useful when working with frameworks like [three.js](https://threejs.org) /
@@ -230,11 +229,13 @@ export type RotationEulerSlots = typeof __propDef.slots;
230
229
  * A utility function `Utils.eulerToCssTransform()` is also provided to easily convert a quaternion
231
230
  * value object or tuple into a CSS transform string.
232
231
  *
233
- * See also <RotationQuaternion> if you're feeling gimbal locked.
232
+ * See also `<RotationQuaternion>` if you're feeling gimbal locked.
234
233
  *
235
234
  * Usage outside of a `<Pane>` component will implicitly wrap the profiler in `<Pane
236
235
  * position="inline">`.
237
236
  *
237
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-rotation) of the plugin with build optimizations.
238
+ *
238
239
  * @emits {RotationEulerChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
239
240
  *
240
241
  * @example
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@0b5vr/tweakpane-plugin-rotation';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-rotation';
5
5
  import ClsPad from '../internal/ClsPad.svelte';
6
6
  import GenericInputFolding from '../internal/GenericInputFolding.svelte';
7
7
  import { BROWSER } from 'esm-env';
@@ -14,7 +14,7 @@ export type RotationQuaternionValue = Simplify<
14
14
  RotationQuaternionValueObject | RotationQuaternionValueTuple
15
15
  >;
16
16
  export type RotationQuaternionChangeEvent = ValueChangeEvent<RotationQuaternionValue>;
17
- import type { RotationInputPluginQuaternionParams as RotationQuaternionOptionsInternal } from '@0b5vr/tweakpane-plugin-rotation/dist/types/RotationInputPluginQuaternionParams';
17
+ import type { RotationInputPluginQuaternionParams as RotationQuaternionOptionsInternal } from '@kitschpatrol/tweakpane-plugin-rotation/dist/types/RotationInputPluginQuaternionParams';
18
18
  declare const __propDef: {
19
19
  props: {
20
20
  /**
@@ -218,8 +218,7 @@ export type RotationQuaternionSlots = typeof __propDef.slots;
218
218
  /**
219
219
  * Integrates the [quaternion
220
220
  * rotation](https://github.com/0b5vr/tweakpane-plugin-rotation/blob/dev/src/RotationInputPluginQuaternion.ts)
221
- * control from [0b5vr's](https://0b5vr.com)
222
- * [tweakpane-plugin-rotation](https://github.com/0b5vr/tweakpane-plugin-rotation).
221
+ * control from [0b5vr](https://0b5vr.com)'s [tweakpane-plugin-rotation](https://github.com/0b5vr/tweakpane-plugin-rotation).
223
222
  *
224
223
  * _Svelte Tweakpane UI_ extends the original API to support tuple values in addition to object values.
225
224
  * (Useful when working with frameworks like [three.js](https://threejs.org) /
@@ -228,11 +227,13 @@ export type RotationQuaternionSlots = typeof __propDef.slots;
228
227
  * A utility function `Utils.quaternionToCssTransform()` is also provided to easily convert a euler
229
228
  * rotation value object or tuple into a CSS transform string.
230
229
  *
231
- * See also <RotationEuler> if you're not into the whole `w` thing.
230
+ * See also `<RotationEuler>` if you're not into the whole `w` thing.
232
231
  *
233
232
  * Usage outside of a `<Pane>` component will implicitly wrap the profiler in `<Pane
234
233
  * position="inline">`.
235
234
  *
235
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-rotation) of the plugin with build optimizations.
236
+ *
236
237
  * @emits {RotationQuaternionChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
237
238
  *
238
239
  * @example
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@pangenerator/tweakpane-textarea-plugin';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-textarea';
5
5
  import GenericInput from '../internal/GenericInput.svelte';
6
6
  import {} from '../utils.js';
7
7
  import { BROWSER } from 'esm-env';
@@ -1,7 +1,7 @@
1
1
  import { SvelteComponent } from 'svelte';
2
2
  import type { ValueChangeEvent } from '../utils.js';
3
3
  export type TextareaChangeEvent = ValueChangeEvent<string>;
4
- import type { TextareaPluginInputParams } from '@pangenerator/tweakpane-textarea-plugin/dist/types/plugin.js';
4
+ import type { TextareaPluginInputParams } from '@kitschpatrol/tweakpane-plugin-textarea/dist/types/plugin.js';
5
5
  import { type GenericInputRef } from '../internal/GenericInput.svelte';
6
6
  declare const __propDef: {
7
7
  props: {
@@ -139,6 +139,8 @@ export type TextareaSlots = typeof __propDef.slots;
139
139
  * Usage outside of a `<Pane>` component will implicitly wrap the text area in
140
140
  * `<Pane position="inline">`.
141
141
  *
142
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-textarea) of the plugin with build optimizations. The fork also changes the package name from `@pangenerator/tweakpane-textarea-plugin` to `@kitschpatrol/tweakpane-plugin-textarea` for consistency with other plugins.
143
+ *
142
144
  * @emits {TextareaChangeEvent} change - When `value` changes. (This event is
143
145
  * provided for advanced use cases. Prefer binding to `value`.)
144
146
  *
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@tweakpane/plugin-camerakit';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-camerakit';
5
5
  import GenericSlider from '../internal/GenericSlider.svelte';
6
6
  export let value;
7
7
  export let amount = void 0;
@@ -168,6 +168,8 @@ export type WheelSlots = typeof __propDef.slots;
168
168
  *
169
169
  * Usage outside of a `<Pane>` component will implicitly wrap the wheel in `<Pane position="inline">`.
170
170
  *
171
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-camerakit) of the plugin with build optimizations. The fork also changes the package name from `@tweakpane/plugin-camerakit` to `@kitschpatrol/tweakpane-plugin-camerakit` for consistency with other plugins.
172
+ *
171
173
  * @emits {WheelChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
172
174
  *
173
175
  * @example
@@ -31,7 +31,10 @@ declare const __propDef: {
31
31
  * set with `setGlobalDefaultTheme()`.
32
32
  * */ theme?: Theme | undefined;
33
33
  };
34
- events: {
34
+ /**
35
+ * Prevent interactivity and gray out the control.
36
+ * @default `false`
37
+ * */ events: {
35
38
  [evt: string]: CustomEvent<any>;
36
39
  };
37
40
  slots: {
@@ -12,6 +12,9 @@
12
12
  import { persisted } from 'svelte-local-storage-store';
13
13
  const titlebarWindowShadeSingleClick = true;
14
14
  const titlebarWindowShadeDoubleClick = false;
15
+ const pointerCancelOnWindowBlur = true;
16
+ const dragMovementDistanceThreshold = 3;
17
+ let initialDragEvent;
15
18
  export let storePositionLocally = true;
16
19
  export let localStoreId = localStoreDefaultId;
17
20
  export let tpPane = void 0;
@@ -109,27 +112,33 @@
109
112
  if (width !== void 0 && event.target === widthHandleElement) {
110
113
  width = width < maxAvailablePanelWidth ? maxAvailablePanelWidth : minWidth;
111
114
  } else if (
112
- // If (moveDistance < 3 && userExpandable)
115
+ // Consider pointer movement threshold check...
116
+ // e.g. if (moveDistance < dragMovementDistanceThreshold && userExpandable)...
113
117
  titlebarWindowShadeDoubleClick &&
114
- event.target === dragBarElement && //
118
+ event.target === dragBarElement &&
115
119
  tpPane
116
120
  ) {
117
121
  tpPane.expanded = !tpPane.expanded;
118
122
  }
119
123
  }
120
124
  };
121
- const downListener = (event) => {
125
+ const dragStartListener = (event) => {
122
126
  if (x !== void 0 && y !== void 0 && event.button === 0 && event.target instanceof HTMLElement) {
123
127
  moveDistance = 0;
128
+ initialDragEvent = event;
129
+ removeDragStartListeners();
130
+ addDragMoveAndEndListeners();
131
+ if (event.target === dragBarElement) {
132
+ dragBarElement.style.cursor = 'grabbing';
133
+ }
134
+ containerElement.style.transition = 'width 0s ease';
124
135
  event.target.setPointerCapture(event.pointerId);
125
- event.target.addEventListener('pointermove', moveListener);
126
- event.target.addEventListener('pointerup', upListener);
127
136
  startWidth = width ?? 0;
128
137
  startOffsetX = x - event.pageX;
129
138
  startOffsetY = y - event.pageY;
130
139
  }
131
140
  };
132
- const moveListener = (event) => {
141
+ const dragMoveListener = (event) => {
133
142
  if (
134
143
  event.target instanceof HTMLElement &&
135
144
  width !== void 0 &&
@@ -150,22 +159,72 @@
150
159
  }
151
160
  }
152
161
  };
153
- const upListener = (event) => {
162
+ const blurListener = () => {
163
+ if (pointerCancelOnWindowBlur && initialDragEvent?.target instanceof HTMLElement) {
164
+ const { target } = initialDragEvent;
165
+ const bounds = target.getBoundingClientRect();
166
+ const pointerCancelEvent = new PointerEvent('pointercancel', {
167
+ bubbles: true,
168
+ clientX: bounds.left + bounds.width / 2,
169
+ clientY: bounds.top + bounds.height / 2,
170
+ composed: true,
171
+ pointerId: initialDragEvent.pointerId,
172
+ pointerType: initialDragEvent.pointerType
173
+ });
174
+ target.dispatchEvent(pointerCancelEvent);
175
+ }
176
+ };
177
+ const dragEndListener = (event) => {
154
178
  event.stopImmediatePropagation();
155
179
  if (event.target instanceof HTMLElement) {
156
- event.target.releasePointerCapture(event.pointerId);
157
- event.target.removeEventListener('pointermove', moveListener);
158
- event.target.removeEventListener('pointerup', upListener);
180
+ if (event.target.hasPointerCapture(event.pointerId)) {
181
+ event.target.releasePointerCapture(event.pointerId);
182
+ }
183
+ if (event.target === dragBarElement) {
184
+ dragBarElement.style.removeProperty('cursor');
185
+ }
186
+ containerElement.style.removeProperty('transition');
159
187
  if (
188
+ event.type === 'pointerup' &&
160
189
  titlebarWindowShadeSingleClick &&
161
190
  event.target === dragBarElement &&
162
- moveDistance < 3 &&
191
+ moveDistance < dragMovementDistanceThreshold &&
163
192
  userExpandable &&
164
193
  tpPane
165
- )
194
+ ) {
166
195
  tpPane.expanded = !tpPane.expanded;
196
+ }
197
+ initialDragEvent = void 0;
198
+ removeDragMoveAndEndListeners();
199
+ addDragStartListeners();
167
200
  }
168
201
  };
202
+ const addDragStartListeners = () => {
203
+ dragBarElement.addEventListener('pointerdown', dragStartListener);
204
+ widthHandleElement?.addEventListener('pointerdown', dragStartListener);
205
+ };
206
+ const removeDragStartListeners = () => {
207
+ dragBarElement.removeEventListener('pointerdown', dragStartListener);
208
+ widthHandleElement?.removeEventListener('pointerdown', dragStartListener);
209
+ };
210
+ const addDragMoveAndEndListeners = () => {
211
+ window.addEventListener('blur', blurListener);
212
+ dragBarElement.addEventListener('pointermove', dragMoveListener);
213
+ dragBarElement.addEventListener('pointerup', dragEndListener);
214
+ dragBarElement.addEventListener('pointercancel', dragEndListener);
215
+ widthHandleElement?.addEventListener('pointermove', dragMoveListener);
216
+ widthHandleElement?.addEventListener('pointerup', dragEndListener);
217
+ widthHandleElement?.addEventListener('pointercancel', dragEndListener);
218
+ };
219
+ const removeDragMoveAndEndListeners = () => {
220
+ window.removeEventListener('blur', blurListener);
221
+ dragBarElement.removeEventListener('pointermove', dragMoveListener);
222
+ dragBarElement.removeEventListener('pointerup', dragEndListener);
223
+ dragBarElement.removeEventListener('pointercancel', dragEndListener);
224
+ widthHandleElement?.removeEventListener('pointermove', dragMoveListener);
225
+ widthHandleElement?.removeEventListener('pointerup', dragEndListener);
226
+ widthHandleElement?.removeEventListener('pointercancel', dragEndListener);
227
+ };
169
228
  const touchScrollBlocker = (event) => {
170
229
  event.preventDefault();
171
230
  };
@@ -182,35 +241,24 @@
182
241
  dragBarElement = dragBarElementCheck;
183
242
  dragBarElement.addEventListener('click', clickBlocker);
184
243
  dragBarElement.addEventListener('dblclick', doubleClickListener);
185
- dragBarElement.addEventListener('pointerdown', downListener);
186
244
  widthHandleElement = dragBarElement.parentElement?.appendChild(document.createElement('div'));
187
245
  if (widthHandleElement) {
188
246
  widthHandleElement.className = 'tp-custom-width-handle';
189
247
  widthHandleElement.textContent = '\u2194';
190
248
  widthHandleElement.addEventListener('click', clickBlocker);
191
249
  widthHandleElement.addEventListener('dblclick', doubleClickListener);
192
- widthHandleElement.addEventListener('pointerdown', downListener);
193
250
  }
251
+ addDragStartListeners();
194
252
  }
195
253
  });
196
254
  onDestroy(() => {
197
- if (dragBarElement) {
198
- dragBarElement.removeEventListener('click', clickBlocker);
199
- dragBarElement.removeEventListener('dblclick', doubleClickListener);
200
- dragBarElement.removeEventListener('pointerdown', downListener);
201
- dragBarElement.removeEventListener('pointermove', moveListener);
202
- dragBarElement.removeEventListener('pointerup', upListener);
203
- }
204
- if (widthHandleElement) {
205
- widthHandleElement.removeEventListener('click', clickBlocker);
206
- widthHandleElement.removeEventListener('dblclick', doubleClickListener);
207
- widthHandleElement.removeEventListener('pointerdown', downListener);
208
- widthHandleElement.removeEventListener('pointermove', moveListener);
209
- widthHandleElement.removeEventListener('pointerup', upListener);
210
- }
211
- if (containerElement) {
212
- containerElement.removeEventListener('touchmove', touchScrollBlocker);
213
- }
255
+ removeDragStartListeners();
256
+ removeDragMoveAndEndListeners();
257
+ dragBarElement.removeEventListener('click', clickBlocker);
258
+ dragBarElement.removeEventListener('dblclick', doubleClickListener);
259
+ widthHandleElement?.removeEventListener('click', clickBlocker);
260
+ widthHandleElement?.removeEventListener('dblclick', doubleClickListener);
261
+ containerElement?.removeEventListener('touchmove', touchScrollBlocker);
214
262
  if (localStoreId !== void 0) {
215
263
  localStoreIds.splice(localStoreIds.indexOf(localStoreId), 1);
216
264
  }
@@ -321,13 +369,6 @@
321
369
  transition: width 0.2s ease;
322
370
  }
323
371
 
324
- div.draggable-container:active {
325
- /* prevent animation during direct manipulation */
326
- transition: width 0s ease;
327
- /* alternate less specific approach */
328
- /* transition: none; */
329
- }
330
-
331
372
  /* stylelint-disable-next-line selector-class-pattern */
332
373
  div.draggable-container :global(div.tp-rotv_t) {
333
374
  cursor: grab;
@@ -355,10 +396,6 @@
355
396
  white-space: nowrap;
356
397
  }
357
398
 
358
- div.draggable-container :global(div.tp-rotv_t:active) {
359
- cursor: grabbing;
360
- }
361
-
362
399
  div.draggable-container :global(div.tp-rotv_m) {
363
400
  right: unset;
364
401
  left: 0;
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>
4
- import * as pluginModule from '@tweakpane/plugin-essentials';
4
+ import * as pluginModule from '@kitschpatrol/tweakpane-plugin-essentials';
5
5
  import Blade from '../core/Blade.svelte';
6
6
  import ClsPad from '../internal/ClsPad.svelte';
7
7
  import { fillWith } from '../utils';
@@ -1,7 +1,7 @@
1
1
  import { SvelteComponent } from 'svelte';
2
2
  export type FpsGraphChangeEvent = CustomEvent<number>;
3
- import type { FpsGraphBladeApi as FpsGraphRef } from '@tweakpane/plugin-essentials';
4
- import type { FpsGraphBladeParams as FpsGraphOptions } from '@tweakpane/plugin-essentials/dist/types/fps-graph/plugin.js';
3
+ import type { FpsGraphBladeApi as FpsGraphRef } from '@kitschpatrol/tweakpane-plugin-essentials';
4
+ import type { FpsGraphBladeParams as FpsGraphOptions } from '@kitschpatrol/tweakpane-plugin-essentials/dist/types/fps-graph/plugin.js';
5
5
  declare const __propDef: {
6
6
  props: {
7
7
  /**
@@ -145,6 +145,8 @@ export type FpsGraphSlots = typeof __propDef.slots;
145
145
  * Usage outside of a `<Pane>` component will implicitly wrap the FPS graph in `<Pane
146
146
  * position="inline">`.
147
147
  *
148
+ * Note that _Svelte Tweakpane UI_ embeds a functionally identical [fork](https://github.com/kitschpatrol/tweakpane-plugin-essentials) of the plugin with build optimizations. The fork also changes the package name from `@tweakpane/plugin-essentials` to `@kitschpatrol/tweakpane-plugin-essentials` for consistency with other plugins.
149
+ *
148
150
  * @emits {number} change - When the FPS value changes.
149
151
  *
150
152
  * @example