svelte-tweakpane-ui 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/control/ButtonGrid.svelte +6 -7
  2. package/dist/control/Checkbox.svelte.d.ts +2 -4
  3. package/dist/control/Color.svelte.d.ts +2 -4
  4. package/dist/control/CubicBezier.svelte +1 -1
  5. package/dist/control/CubicBezier.svelte.d.ts +3 -0
  6. package/dist/control/Image.svelte.d.ts +2 -4
  7. package/dist/control/IntervalSlider.svelte.d.ts +2 -4
  8. package/dist/control/List.svelte +7 -13
  9. package/dist/control/List.svelte.d.ts +3 -5
  10. package/dist/control/Point.svelte.d.ts +29 -31
  11. package/dist/control/RadioGrid.svelte.d.ts +2 -4
  12. package/dist/control/Ring.svelte.d.ts +2 -4
  13. package/dist/control/RotationEuler.svelte.d.ts +66 -4
  14. package/dist/control/RotationQuaternion.svelte.d.ts +2 -4
  15. package/dist/control/Slider.svelte.d.ts +2 -4
  16. package/dist/control/Text.svelte.d.ts +2 -4
  17. package/dist/control/Textarea.svelte +1 -1
  18. package/dist/control/Textarea.svelte.d.ts +2 -4
  19. package/dist/control/Wheel.svelte.d.ts +2 -4
  20. package/dist/core/Blade.svelte +1 -1
  21. package/dist/core/TabPage.svelte +2 -2
  22. package/dist/extra/AutoObject.svelte +3 -5
  23. package/dist/extra/AutoValue.svelte.d.ts +6 -4
  24. package/dist/extra/Element.svelte +1 -3
  25. package/dist/index.js +5 -5
  26. package/dist/internal/ClsPad.svelte +2 -6
  27. package/dist/internal/ClsPad.svelte.d.ts +10 -0
  28. package/dist/internal/GenericBinding.svelte.d.ts +2 -4
  29. package/dist/internal/GenericBladeFolding.svelte +1 -1
  30. package/dist/internal/GenericInput.svelte.d.ts +2 -4
  31. package/dist/internal/GenericInputFolding.svelte +2 -2
  32. package/dist/internal/GenericInputFolding.svelte.d.ts +2 -4
  33. package/dist/internal/GenericMonitor.svelte +1 -1
  34. package/dist/internal/GenericMonitor.svelte.d.ts +2 -4
  35. package/dist/internal/GenericPane.svelte +4 -7
  36. package/dist/internal/GenericSlider.svelte.d.ts +2 -4
  37. package/dist/internal/InternalMonitorBoolean.svelte.d.ts +2 -4
  38. package/dist/internal/InternalMonitorNumber.svelte.d.ts +2 -4
  39. package/dist/internal/InternalMonitorString.svelte.d.ts +2 -4
  40. package/dist/internal/InternalPaneDraggable.svelte +19 -16
  41. package/dist/internal/InternalPaneFixed.svelte +1 -3
  42. package/dist/internal/InternalPaneInline.svelte +1 -1
  43. package/dist/monitor/FpsGraph.svelte +2 -2
  44. package/dist/monitor/Monitor.svelte.d.ts +23 -31
  45. package/dist/monitor/Profiler.svelte +2 -2
  46. package/dist/monitor/WaveformMonitor.svelte.d.ts +2 -4
  47. package/dist/theme.d.ts +1 -3
  48. package/dist/theme.js +25 -32
  49. package/dist/utils.d.ts +5 -2
  50. package/dist/utils.js +34 -27
  51. package/package.json +13 -7
  52. /package/{LICENSE → license.txt} +0 -0
  53. /package/{README.md → readme.md} +0 -0
package/dist/utils.js CHANGED
@@ -1,23 +1,26 @@
1
- // type aliases and utility functions
2
- // utility functions
1
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-arguments */
2
+ // Utility functions
3
3
  /**
4
4
  * For CLS SSR calculation
5
5
  */
6
6
  export function rowsForMonitor(buffer, rows, graph) {
7
7
  if (graph) {
8
8
  return Math.max(rows ?? 3, 3);
9
- } else if (buffer === undefined && rows === undefined) {
9
+ }
10
+ if (buffer === undefined && rows === undefined) {
10
11
  return 1;
11
- } else if (buffer === undefined && rows !== undefined) {
12
+ }
13
+ if (buffer === undefined && rows !== undefined) {
12
14
  return 1;
13
- } else if (buffer !== undefined && rows === undefined) {
15
+ }
16
+ if (buffer !== undefined && rows === undefined) {
14
17
  return buffer > 1 ? 3 : 1;
15
- } else if (buffer === 1) {
18
+ }
19
+ if (buffer === 1) {
16
20
  return 1;
17
- } else {
18
- // both defined
19
- return rows ?? 1; // TODO
20
21
  }
22
+ // Both defined
23
+ return rows ?? 1; // TODO
21
24
  }
22
25
  /**
23
26
  * Fills an array of length `quantity` with a `value`
@@ -65,7 +68,9 @@ export function enforceReadonly(
65
68
  const componentString = componentName ? `<${componentName}> ` : '';
66
69
  const propertyString = propertyName ? `property "${propertyName}" ` : '';
67
70
  console.error(
68
- `Svelte component ${componentString}property ${propertyString}is intended for readonly use.\nAssigning\n"${external}"\nto\n"${internal}"\nis not allowed.`
71
+ `Svelte component "${componentString}" property "${propertyString}" is intended for readonly use.\nAssigning\n"${String(
72
+ external
73
+ )}"\nto\n"${String(internal)}"\nis not allowed.`
69
74
  );
70
75
  }
71
76
  }
@@ -73,43 +78,45 @@ export function isRootPane(container) {
73
78
  return container.constructor.name === 'Pane';
74
79
  }
75
80
  export function clamp(value, min, max) {
76
- // prioritize min over max
81
+ // Prioritize min over max
77
82
  return Math.min(Math.max(value, min), max);
78
83
  }
79
84
  export function getElementIndex(element) {
80
85
  let index = 0;
86
+ // eslint-disable-next-line @typescript-eslint/ban-types
81
87
  let sibling = element;
82
88
  while ((sibling = sibling.previousElementSibling) !== null) {
83
89
  index++;
84
90
  }
85
91
  return index;
86
92
  }
87
- // doesn't create a new object, only works with string keys
93
+ // Doesn't create a new object, only works with string keys
88
94
  export function removeKeys(object, ...keys) {
89
95
  for (const key of keys) {
90
96
  if (key in object) {
97
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
91
98
  delete object[key];
92
99
  }
93
100
  }
94
101
  return object;
95
102
  }
96
103
  function clickBlocker(event) {
97
- // only block user clicks, not programmatic ones
104
+ // Only block user clicks, not programmatic ones
98
105
  console.log(event.detail);
99
106
  if (event.isTrusted) event.stopPropagation();
100
107
  }
101
- // used by folder and pane TODO rewrite to use getSwatchButton etc.
108
+ // Used by folder and pane TODO rewrite to use getSwatchButton etc.
102
109
  export function updateCollapsibility(isUserExpandableEnabled, element, titleBarClass, iconClass) {
103
110
  if (element) {
104
111
  const titleBarElement = element.querySelector(`.${titleBarClass}`);
105
- if (titleBarElement !== undefined) {
112
+ if (titleBarElement) {
106
113
  const iconElement = iconClass ? element.querySelector(`.${iconClass}`) : undefined;
107
114
  if (isUserExpandableEnabled) {
108
115
  titleBarElement.removeEventListener('click', clickBlocker, { capture: true });
109
116
  titleBarElement.style.cursor = 'pointer';
110
117
  if (iconElement) iconElement.style.display = 'block';
111
118
  } else {
112
- //expanded = true;
119
+ // Expanded = true;
113
120
  titleBarElement.addEventListener('click', clickBlocker, { capture: true });
114
121
  titleBarElement.style.cursor = 'default';
115
122
  if (iconElement) iconElement.style.display = 'none';
@@ -130,7 +137,8 @@ export function updateCollapsibility(isUserExpandableEnabled, element, titleBarC
130
137
  * If both constraints are provided, values may be clipped.
131
138
  */
132
139
  export function getGridDimensions(itemCount, maxColumns, maxRows) {
133
- let rows, columns;
140
+ let rows;
141
+ let columns;
134
142
  if (maxColumns && maxRows) {
135
143
  // No flexing; items can exceed the available slots
136
144
  rows = Math.min(Math.ceil(itemCount / maxColumns), maxRows);
@@ -151,6 +159,7 @@ export function getGridDimensions(itemCount, maxColumns, maxRows) {
151
159
  return { columns, rows };
152
160
  }
153
161
  export function tupleToObject(tuple, keys) {
162
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
154
163
  const result = {};
155
164
  for (const [index, key] of keys.entries()) {
156
165
  // Assert that the assignment is safe
@@ -161,7 +170,7 @@ export function tupleToObject(tuple, keys) {
161
170
  export function objectToTuple(object, keys) {
162
171
  return keys.map((key) => object[key]);
163
172
  }
164
- // tweakpane helpers
173
+ // Tweakpane helpers
165
174
  export function pickerIsOpen(blade) {
166
175
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
167
176
  return blade.controller.valueController?.foldable_?.valMap_?.expanded?.value_;
@@ -174,7 +183,7 @@ export function getSwatchButton(blade) {
174
183
  blade.controller?.valueController?.view?.buttonElement;
175
184
  return swatch;
176
185
  }
177
- // utility functions
186
+ // Utility functions
178
187
  function quaternionToCssTransform(quaternion) {
179
188
  const [x, y, z, w] = Array.isArray(quaternion)
180
189
  ? quaternion
@@ -197,22 +206,20 @@ function quaternionToCssTransform(quaternion) {
197
206
  }
198
207
  function eulerToCssTransform(
199
208
  rotation,
200
- units = 'rad' // rad is component default
209
+ units = 'rad' // Rad is component default
201
210
  ) {
202
211
  const [x, y, z] = Array.isArray(rotation) ? rotation : [rotation.x, rotation.y, rotation.z];
203
- // note negative z
212
+ // Note negative z
204
213
  return `rotateX(${x}${units}) rotateY(${y}${units}) rotateZ(${-z}${units})`;
205
214
  }
206
215
  function cubicBezierToEaseFunction(cubicBezier) {
207
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
208
- const [x1, y1, x2, y2] = Array.isArray(cubicBezier)
216
+ const [_x1, y1, _x2, y2] = Array.isArray(cubicBezier)
209
217
  ? cubicBezier
210
218
  : [cubicBezier.x1, cubicBezier.y1, cubicBezier.x2, cubicBezier.y2];
211
- return (t) => {
212
- return (1 - t) ** 3 * 0 + (1 - t) ** 2 * t * 3 * y1 + (1 - t) * t ** 2 * 3 * y2 + t ** 3 * 1;
213
- };
219
+ return (t) =>
220
+ (1 - t) ** 3 * 0 + (1 - t) ** 2 * t * 3 * y1 + (1 - t) * t ** 2 * 3 * y2 + t ** 3 * 1;
214
221
  }
215
- // library exports
222
+ // Library exports
216
223
  export default {
217
224
  /**
218
225
  * Convenience function for creating easing functions ready for Svelte's tween and animation
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "svelte-tweakpane-ui",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/kitschpatrol/svelte-tweakpane-ui"
7
+ "url": "git+https://github.com/kitschpatrol/svelte-tweakpane-ui.git"
8
8
  },
9
9
  "homepage": "https:///kitschpatrol.com/svelte-tweakpane-ui",
10
10
  "bugs": {
@@ -187,30 +187,33 @@
187
187
  "@0b5vr/tweakpane-plugin-rotation": "^0.2.0",
188
188
  "@kitschpatrol/tweakpane-image-plugin": "^2.0.0",
189
189
  "@kitschpatrol/tweakpane-textarea-plugin": "^2.0.1",
190
- "@tweakpane/core": "^2.0.1",
190
+ "@tweakpane/core": "^2.0.2",
191
191
  "@tweakpane/plugin-camerakit": "^0.3.0",
192
192
  "@tweakpane/plugin-essentials": "^0.2.0",
193
+ "bumpp": "^9.2.1",
193
194
  "esm-env": "^1.0.0",
194
195
  "nanoid": "^5.0.4",
195
196
  "svelte-local-storage-store": "^0.6.4",
196
- "tweakpane": "^4.0.1",
197
+ "tweakpane": "^4.0.2",
197
198
  "tweakpane-plugin-waveform": "^1.0.0"
198
199
  },
199
200
  "devDependencies": {
200
- "@kitschpatrol/shared-config": "^2.0.1",
201
+ "@kitschpatrol/shared-config": "^4.0.0",
201
202
  "@phenomnomnominal/tsquery": "^6.1.3",
202
203
  "@stkb/rewrap": "^0.1.0",
203
204
  "@sveltejs/adapter-static": "^2.0.3",
204
- "@sveltejs/kit": "^1.27.7",
205
+ "@sveltejs/kit": "^1.30.3",
205
206
  "@sveltejs/package": "^2.2.3",
206
- "@types/eslint": "^8.44.8",
207
+ "@types/eslint": "^8.44.9",
207
208
  "@types/fs-extra": "^11.0.4",
208
209
  "@types/node": "^20.10.4",
210
+ "eslint": "^8.56.0",
209
211
  "fs-extra": "^11.2.0",
210
212
  "glob": "^10.3.10",
211
213
  "npm-run-all": "^4.1.5",
212
214
  "postcss-html": "^1.5.0",
213
215
  "publint": "^0.2.6",
216
+ "read-package-up": "^11.0.0",
214
217
  "svelte": "^4.2.8",
215
218
  "svelte-check": "^3.6.2",
216
219
  "svelte-language-server": "^0.16.1",
@@ -222,6 +225,8 @@
222
225
  "vite": "^4.5.1",
223
226
  "yaml": "^2.3.4"
224
227
  },
228
+ "_id": "svelte-tweakpane-ui@1.0.2",
229
+ "readme": "ERROR: No README data found!",
225
230
  "scripts": {
226
231
  "build": "run-s --print-label build:*",
227
232
  "build:01-sync": "pnpm run check",
@@ -251,6 +256,7 @@
251
256
  "kit-examples": "tsx ./scripts/generate-kit-examples.ts",
252
257
  "kit-preview": "vite preview",
253
258
  "lint": "shared-config --check",
259
+ "release": "pnpm bumpp --commit 'Release: %s' --tag '%s' && pnpm publish --otp $(op read 'op://Personal/Npmjs/one-time password?attribute=otp')",
254
260
  "rewrap": "rewrap -i --column 100 `find src \\( -name '*.svelte' -o -name '*.ts' -o -name '*.html' \\) -type f | grep -v src/examples`",
255
261
  "type-check": "tsc --noEmit"
256
262
  }
File without changes
File without changes