svelte-tweakpane-ui 1.5.11 → 1.6.0-preview.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.
@@ -0,0 +1,43 @@
1
+ <script context="module"></script>
2
+
3
+ <script>
4
+ import * as pluginModule from 'tweakpane-plugin-color-plus/lite'
5
+ import { ColorPlusModel } from 'tweakpane-plugin-color-plus/lite'
6
+ import ClsPad from '../internal/ClsPad.svelte'
7
+ import GenericInputFolding from '../internal/GenericInputFolding.svelte'
8
+ import { fillWith } from '../utils'
9
+ import { BROWSER } from 'esm-env'
10
+ export let value
11
+ export let expanded = void 0
12
+ export let type = void 0
13
+ let options
14
+ let ref
15
+ const buttonClass = 'tp-colswv_b'
16
+ $: options = {
17
+ color: {
18
+ type,
19
+ },
20
+ view: 'color-plus',
21
+ }
22
+ </script>
23
+
24
+ <GenericInputFolding
25
+ bind:value
26
+ bind:expanded
27
+ bind:ref
28
+ on:change
29
+ {buttonClass}
30
+ {options}
31
+ plugin={pluginModule}
32
+ {...$$restProps}
33
+ />
34
+ {#if !BROWSER && expanded && $$props.picker === 'inline'}
35
+ <!-- Main swatch -->
36
+ <ClsPad keysAdd={fillWith('containerUnitSize', 6)} theme={$$props.theme} />
37
+ <ClsPad keysAdd={fillWith('containerUnitSpacing', 3)} theme={$$props.theme} />
38
+ <!-- Detect alpha slider... -->
39
+ {#if ColorPlusModel.getFormat(value, false, type)?.alpha}
40
+ <ClsPad keysAdd={fillWith('containerUnitSize', 1)} theme={$$props.theme} />
41
+ <ClsPad extra={2} keysAdd={fillWith('containerVerticalPadding', 2)} theme={$$props.theme} />
42
+ {/if}
43
+ {/if}
@@ -0,0 +1,193 @@
1
+ import { SvelteComponent } from 'svelte'
2
+ import type { ValueChangeEvent } from '../utils.js'
3
+ import type { ColorPlusValue } from 'tweakpane-plugin-color-plus/lite'
4
+ export type { ColorPlusValue } from 'tweakpane-plugin-color-plus/lite'
5
+ export type ColorPlusChangeEvent = ValueChangeEvent<ColorPlusValue>
6
+ import * as pluginModule from 'tweakpane-plugin-color-plus/lite'
7
+ declare const __propDef: {
8
+ props: {
9
+ /**
10
+ * A color value to control.
11
+ *
12
+ * Use either a color-like string (e.g. #ff00ff), a number, an object with `r`, `b`, `g`, and
13
+ * optional `a` keys, or a tuple.
14
+ * @bindable
15
+ * */
16
+ value: ColorPlusValue
17
+ /**
18
+ * Whether to treat values as floats from 0.0 to 1.0, or integers from 0 to 255.
19
+ * @default `'int'`
20
+ * */
21
+ type?: 'float' | 'int'
22
+ } & Omit<
23
+ {
24
+ /**
25
+ * DOM class name of the button used to expand and collapse the input's picker.
26
+ * @default `undefined`
27
+ */
28
+ buttonClass?: string
29
+ /**
30
+ * Expand or collapse the input's picker.
31
+ * @default `false`
32
+ * @bindable
33
+ */
34
+ expanded?: boolean
35
+ /**
36
+ * The style of value "picker" to use in the input.
37
+ * @default `'popup'`
38
+ */
39
+ picker?: 'inline' | 'popup'
40
+ /**
41
+ * Allow users to interactively expand / contract the picker.
42
+ * @default `true`
43
+ */
44
+ userExpandable?: boolean
45
+ } & {
46
+ /**
47
+ * A color value to control.
48
+ *
49
+ * Use either a color-like string (e.g. #ff00ff), a number, an object with `r`, `b`, `g`, and
50
+ * optional `a` keys, or a tuple.
51
+ * @bindable
52
+ */
53
+ value: ColorPlusValue
54
+ } & Omit<
55
+ {
56
+ /**
57
+ * The binding's target object with values to manipulate.
58
+ * @bindable
59
+ */
60
+ object: import('@tweakpane/core').Bindable & Record<string, ColorPlusValue>
61
+ /** The key for the value in the target `object` that the control should manipulate. */
62
+ key: string
63
+ /**
64
+ * Prevent interactivity and gray out the control.
65
+ * @default `false`
66
+ */
67
+ disabled?: boolean
68
+ /**
69
+ * Text displayed next to control.
70
+ * @default `undefined`
71
+ */
72
+ label?: string | undefined
73
+ /**
74
+ * Tweakpane's internal options object.
75
+ *
76
+ * See [`BindingParams`](https://tweakpane.github.io/docs/api/types/BindingParams.html).
77
+ *
78
+ * Valid types are contingent on the type of the value `key` points to in `object`.
79
+ *
80
+ * This is intended internal use, when implementing convenience components wrapping Binding's
81
+ * functionality. Options of interest are instead exposed as top-level props in _Svelte
82
+ * Tweakpane UI_.
83
+ * @default `undefined`
84
+ */
85
+ options?: pluginModule.ColorPlusInputParams | undefined
86
+ /**
87
+ * Custom color scheme.
88
+ *
89
+ * @default `undefined` \
90
+ * Inherits default Tweakpane theme equivalent to `ThemeUtils.presets.standard`, or the theme
91
+ * set with `setGlobalDefaultTheme()`.
92
+ */
93
+ theme?: import('..').Theme | undefined
94
+ /**
95
+ * Reference to internal Tweakpane
96
+ * [`BindingApi`](https://tweakpane.github.io/docs/api/classes/_internal_.BindingApi.html) for
97
+ * this control.
98
+ *
99
+ * This property is exposed for advanced use cases only, such as when implementing convenience
100
+ * components wrapping `<Binding>`'s functionality.
101
+ *
102
+ * Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
103
+ *
104
+ * @bindable
105
+ * @readonly
106
+ */
107
+ ref?: import('../internal/GenericInput.svelte').GenericInputRef | undefined
108
+ /**
109
+ * Imported Tweakpane `TpPluginBundle` (aliased as `Plugin`) module to automatically register in
110
+ * the `<Binding>`'s containing `<Pane>`.
111
+ *
112
+ * This property is exposed for advanced use cases only, such as when implementing convenience
113
+ * components wrapping `<Binding>`'s functionality in combination with a Tweakpane plugin.
114
+ *
115
+ * Direct manipulation of Tweakpane's internals can break _Svelte Tweakpane UI_ abstractions.
116
+ *
117
+ * @default `undefined`
118
+ */
119
+ plugin?: import('../utils.js').Plugin | undefined
120
+ },
121
+ 'object' | 'key'
122
+ >,
123
+ 'ref' | 'options' | 'plugin' | 'buttonClass'
124
+ >
125
+ slots: {}
126
+ events: {
127
+ /**
128
+ * Fires when `value` changes.
129
+ *
130
+ * _This event is provided for advanced use cases. It's usually preferred to bind to the `value` prop instead._
131
+ *
132
+ * The `event.details` payload includes a copy of the value and an `origin` field to distinguish between user-interactive changes (`internal`)
133
+ * and changes resulting from programmatic manipulation of the `value` (`external`).
134
+ *
135
+ * @extends ValueChangeEvent
136
+ * @event
137
+ * */
138
+ change: ColorPlusChangeEvent
139
+ }
140
+ }
141
+ export type ColorPlusProps = typeof __propDef.props
142
+ export type ColorPlusEvents = typeof __propDef.events
143
+ export type ColorPlusSlots = typeof __propDef.slots
144
+ /**
145
+ * A color picker with support for additional color value formats.
146
+ *
147
+ * Integrates the color control from the [Color Plus
148
+ * plugin](https://github.com/kitschpatrol/tweakpane-plugin-color-plus).
149
+ *
150
+ * This component looks just like the Tweakpane-native `<Color>` control, but
151
+ * it adds support for all [CSS Color Module Level 4](https://www.w3.org/TR/css-color-4/) color string formats as well as a
152
+ * wider range of color object keys.
153
+ *
154
+ * The plugin on which `<ColorPlus>` is based is still under active development, but can generally be used as a drop-in replacement for the `Color` control. Please report any issues you might encountered.
155
+ *
156
+ * `<ColorPlus>` might replace the `<Color>` control entirely in the next major version of `svelte-tweakpane-ui`.
157
+ *
158
+ * Usage outside of a `<Pane>` component will implicitly wrap the color picker in `<Pane
159
+ * position="inline">`.
160
+ *
161
+ * @emits {ColorPlusChangeEvent} change - When `value` changes. (This event is provided for advanced use cases. Prefer binding to `value`.)
162
+ *
163
+ * @example
164
+ * ```svelte
165
+ * <script lang="ts">
166
+ * import { ColorPlus } from 'svelte-tweakpane-ui'
167
+ *
168
+ * let startColor = 'oklch(93.7% 0.199 105deg / 1)'
169
+ * let endColor = 'oklch(70.2% 0.322 328deg / 1)'
170
+ * </script>
171
+ *
172
+ * <ColorPlus bind:value={startColor} label="Start Color" />
173
+ * <ColorPlus bind:value={endColor} label="End Color" />
174
+ *
175
+ * <div class="demo" style:--a={startColor} style:--b={endColor}></div>
176
+ *
177
+ * <style>
178
+ * .demo {
179
+ * aspect-ratio: 1;
180
+ * width: 100%;
181
+ * background: linear-gradient(to top, var(--a), var(--b));
182
+ * }
183
+ * </style>
184
+ * ```
185
+ *
186
+ * @sourceLink
187
+ * [ColorPlus.svelte](https://github.com/kitschpatrol/svelte-tweakpane-ui/blob/main/src/lib/control/ColorPlus.svelte)
188
+ */
189
+ export default class ColorPlus extends SvelteComponent<
190
+ ColorPlusProps,
191
+ ColorPlusEvents,
192
+ ColorPlusSlots
193
+ > {}
@@ -5,16 +5,16 @@ import type { TextareaPluginInputParams } from '@kitschpatrol/tweakpane-plugin-t
5
5
  import { type GenericInputRef } from '../internal/GenericInput.svelte'
6
6
  declare const __propDef: {
7
7
  props: {
8
- /**
9
- * Whether to provide live updates to the bound `value` on every keystroke.
10
- * @default `true`
11
- */
12
- live?: boolean
13
8
  /**
14
9
  * A `string` value to control.
15
10
  * @bindable
16
- */
11
+ * */
17
12
  value: string
13
+ /**
14
+ * Whether to provide live updates to the bound `value` on every keystroke.
15
+ * @default `true`
16
+ * */
17
+ live?: boolean
18
18
  /**
19
19
  * Placeholder text to display when the `value` is empty.
20
20
  * @default `'Enter text here'`
package/dist/index.d.ts CHANGED
@@ -11,6 +11,11 @@ export {
11
11
  type ColorValueRgbTuple,
12
12
  type ColorValueString,
13
13
  } from './control/Color.svelte'
14
+ export {
15
+ default as ColorPlus,
16
+ type ColorPlusChangeEvent,
17
+ type ColorPlusValue,
18
+ } from './control/ColorPlus.svelte'
14
19
  export {
15
20
  default as CubicBezier,
16
21
  type CubicBezierChangeEvent,
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export { default as Button } from './control/Button.svelte'
2
2
  export { default as ButtonGrid } from './control/ButtonGrid.svelte'
3
3
  export { default as Checkbox } from './control/Checkbox.svelte'
4
4
  export { default as Color } from './control/Color.svelte'
5
+ export { default as ColorPlus } from './control/ColorPlus.svelte'
5
6
  export { default as CubicBezier } from './control/CubicBezier.svelte'
6
7
  export { default as File } from './control/File.svelte'
7
8
  export { default as Image } from './control/Image.svelte'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-tweakpane-ui",
3
- "version": "1.5.11",
3
+ "version": "1.6.0-preview.2",
4
4
  "description": "A Svelte component library wrapping UI elements from Tweakpane, plus some additional functionality for convenience and flexibility.",
5
5
  "keywords": [
6
6
  "components",
@@ -69,6 +69,10 @@
69
69
  "types": "./dist/control/Color.svelte.d.ts",
70
70
  "svelte": "./dist/control/Color.svelte"
71
71
  },
72
+ "./ColorPlus.svelte": {
73
+ "types": "./dist/control/ColorPlus.svelte.d.ts",
74
+ "svelte": "./dist/control/ColorPlus.svelte"
75
+ },
72
76
  "./CubicBezier.svelte": {
73
77
  "types": "./dist/control/CubicBezier.svelte.d.ts",
74
78
  "svelte": "./dist/control/CubicBezier.svelte"
@@ -195,41 +199,43 @@
195
199
  "@tweakpane/core": "2.0.5",
196
200
  "esm-env": "^1.2.2",
197
201
  "fast-copy": "^3.0.2",
198
- "fast-equals": "^5.3.2",
199
- "nanoid": "^5.1.6",
202
+ "fast-equals": "^5.2.2",
203
+ "nanoid": "^5.1.5",
200
204
  "svelte-persisted-store": "0.12.0",
201
- "tweakpane": "4.0.5"
205
+ "tweakpane": "4.0.5",
206
+ "tweakpane-plugin-color-plus": "0.1.7"
202
207
  },
203
208
  "devDependencies": {
204
209
  "@kitschpatrol/shared-config": "~5.4.4",
205
210
  "@phenomnomnominal/tsquery": "^6.1.3",
206
- "@playwright/test": "^1.56.1",
211
+ "@playwright/test": "^1.53.1",
207
212
  "@stkb/rewrap": "^0.1.0",
208
- "@sveltejs/adapter-static": "^3.0.10",
209
- "@sveltejs/kit": "^2.48.4",
210
- "@sveltejs/package": "^2.5.4",
213
+ "@sveltejs/adapter-static": "^3.0.8",
214
+ "@sveltejs/kit": "^2.22.2",
215
+ "@sveltejs/package": "^2.3.12",
211
216
  "@sveltejs/vite-plugin-svelte": "^3.1.2",
212
217
  "@types/eslint": "^8.56.12",
213
218
  "@types/fs-extra": "^11.0.4",
214
- "@types/node": "^18.19.130",
215
- "bumpp": "^10.3.1",
216
- "eslint": "^9.39.1",
217
- "fs-extra": "^11.3.2",
219
+ "@types/node": "^18.19.113",
220
+ "bumpp": "^10.2.0",
221
+ "eslint": "^9.30.0",
222
+ "fs-extra": "^11.3.0",
218
223
  "glob": "^11.0.3",
219
224
  "postcss-html": "^1.8.0",
220
225
  "prettier": "^3.6.2",
221
- "publint": "^0.3.15",
226
+ "publint": "^0.3.12",
222
227
  "read-package-up": "^11.0.0",
228
+ "remark-mdat": "^1.0.4",
223
229
  "svelte": "^4.2.20",
224
- "svelte-check": "^4.3.3",
230
+ "svelte-check": "^4.2.2",
225
231
  "svelte-language-server": "0.17.0",
226
- "svelte2tsx": "^0.7.45",
232
+ "svelte2tsx": "^0.7.40",
227
233
  "ts-morph": "^24.0.0",
228
234
  "tslib": "^2.8.1",
229
- "tsx": "^4.20.6",
235
+ "tsx": "^4.20.3",
230
236
  "typescript": "~5.8.3",
231
- "vite": "^5.4.21",
232
- "yaml": "^2.8.1"
237
+ "vite": "^5.4.20",
238
+ "yaml": "^2.8.0"
233
239
  },
234
240
  "peerDependencies": {
235
241
  "svelte": "^4.0.0 || ^5.0.0"
@@ -267,7 +273,7 @@
267
273
  "kit-examples": "tsx ./scripts/generate-kit-examples.ts",
268
274
  "kit-preview": "vite preview",
269
275
  "lint": "kpi lint && svelte-check --tsconfig ./tsconfig.build.json",
270
- "release": "pnpm run build && bumpp --commit 'Release: %s' && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token') && pnpm publish --ignore-scripts",
276
+ "release": "pnpm run build && bumpp --preid preview --commit 'Release: %s' && pnpm publish --tag preview --ignore-scripts --otp $(op read 'op://Personal/Npmjs/one-time password?attribute=otp')",
271
277
  "rewrap": "rewrap -i --column 100 `find src \\( -name '*.svelte' -o -name '*.ts' -o -name '*.html' \\) -type f | grep -v src/examples`",
272
278
  "test": "pnpm run --sequential /^test:/",
273
279
  "test:integration": "playwright test",
package/readme.md CHANGED
@@ -34,7 +34,7 @@
34
34
 
35
35
  ## Overview
36
36
 
37
- 🎛️ **_Svelte Tweakpane UI_** wraps user-interface elements from the excellent [Tweakpane](https://tweakpane.github.io/docs/) library in a collection of <!-- component-count -->33<!-- /component-count --> idiomatic, reactive, type-safe, carefully-crafted, and obsessively-documented [Svelte](https://svelte.dev) components.
37
+ 🎛️ **_Svelte Tweakpane UI_** wraps user-interface elements from the excellent [Tweakpane](https://tweakpane.github.io/docs/) library in a collection of <!-- component-count -->34<!-- /component-count --> idiomatic, reactive, type-safe, carefully-crafted, and obsessively-documented [Svelte](https://svelte.dev) components.
38
38
 
39
39
  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.
40
40
 
@@ -100,6 +100,8 @@ npm install svelte-tweakpane-ui
100
100
  A checkbox.
101
101
  - **[Color](https://kitschpatrol.com/svelte-tweakpane-ui/docs/components/color)**\
102
102
  A color picker.
103
+ - **[ColorPlus](https://kitschpatrol.com/svelte-tweakpane-ui/docs/components/colorplus)**\
104
+ A color picker with support for additional color value formats.
103
105
  - **[CubicBezier](https://kitschpatrol.com/svelte-tweakpane-ui/docs/components/cubicbezier)**\
104
106
  A control for editing a bezier curve. Ideal for tweaking animation easing values.
105
107
  - **[File](https://kitschpatrol.com/svelte-tweakpane-ui/docs/components/file)**\