@pixerate/editor-svelte 0.26.1 → 0.27.0
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/README.md +1 -0
- package/dist/agentTools.svelte.d.ts +1 -1
- package/dist/canvas/createCanvasAnimation.svelte.d.ts.map +1 -1
- package/dist/canvas/createCanvasArrange.svelte.d.ts.map +1 -1
- package/dist/canvas/createCanvasAutoLayout.svelte.d.ts.map +1 -1
- package/dist/canvas/createCanvasComponents.svelte.d.ts.map +1 -1
- package/dist/parameters/KeyframeDiamond.svelte +41 -0
- package/dist/parameters/KeyframeDiamond.svelte.d.ts +13 -0
- package/dist/parameters/KeyframeDiamond.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterColor.svelte +109 -0
- package/dist/parameters/ParameterColor.svelte.d.ts +15 -0
- package/dist/parameters/ParameterColor.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterCommitInput.svelte +41 -0
- package/dist/parameters/ParameterCommitInput.svelte.d.ts +13 -0
- package/dist/parameters/ParameterCommitInput.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterFieldControl.svelte +41 -0
- package/dist/parameters/ParameterFieldControl.svelte.d.ts +15 -0
- package/dist/parameters/ParameterFieldControl.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterImage.svelte +77 -0
- package/dist/parameters/ParameterImage.svelte.d.ts +14 -0
- package/dist/parameters/ParameterImage.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterNumberInput.svelte +54 -0
- package/dist/parameters/ParameterNumberInput.svelte.d.ts +13 -0
- package/dist/parameters/ParameterNumberInput.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterSelect.svelte +54 -0
- package/dist/parameters/ParameterSelect.svelte.d.ts +12 -0
- package/dist/parameters/ParameterSelect.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterSlider.svelte +64 -0
- package/dist/parameters/ParameterSlider.svelte.d.ts +15 -0
- package/dist/parameters/ParameterSlider.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterText.svelte +26 -0
- package/dist/parameters/ParameterText.svelte.d.ts +12 -0
- package/dist/parameters/ParameterText.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterToggle.svelte +31 -0
- package/dist/parameters/ParameterToggle.svelte.d.ts +12 -0
- package/dist/parameters/ParameterToggle.svelte.d.ts.map +1 -0
- package/dist/parameters/ParameterVector.svelte +34 -0
- package/dist/parameters/ParameterVector.svelte.d.ts +12 -0
- package/dist/parameters/ParameterVector.svelte.d.ts.map +1 -0
- package/dist/parameters/ParametersPanel.svelte +239 -0
- package/dist/parameters/ParametersPanel.svelte.d.ts +28 -0
- package/dist/parameters/ParametersPanel.svelte.d.ts.map +1 -0
- package/dist/parameters/createParameters.svelte.d.ts +32 -0
- package/dist/parameters/createParameters.svelte.d.ts.map +1 -0
- package/dist/parameters/createParameters.svelte.js +41 -0
- package/dist/parameters/index.d.ts +18 -0
- package/dist/parameters/index.d.ts.map +1 -0
- package/dist/parameters/index.js +14 -0
- package/dist/parameters/styles.d.ts +4 -0
- package/dist/parameters/styles.d.ts.map +1 -0
- package/dist/parameters/styles.js +4 -0
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -83,6 +83,7 @@ Tables are on by default in `createRichTextPreset` (`table: false` turns them of
|
|
|
83
83
|
| `@pixerate/editor-svelte/commands` | `CommandPalette`, `createCommandPalette` (`hotkey: "Mod+K"`; call `destroy()` when done), `createCommandShortcuts`, `useRegisterCommands` over a `CommandRegistry` from `@pixerate/editor/commands` (also re-exported from the root entry) |
|
|
84
84
|
| `@pixerate/editor-svelte/persistence` | `createAutosave` (crash-recovery snapshots bound to a history / dirty flag, flushed on `pagehide`; call `destroy()` when done) and `<RecoveryPrompt>` (also re-exported from the root entry) |
|
|
85
85
|
| `@pixerate/editor-svelte/generation` | `GenerationSettings` (controls generated from a model's capabilities, reference slots by role, plan adjustments; `onchange` / `onaddreference`), `createGenerationPlan(() => request, () => caps)`, `JobProgress`, `createJobProgress` (call `destroy()` when done) over `@pixerate/editor/generation` (also re-exported from the root entry) |
|
|
86
|
+
| `@pixerate/editor-svelte/parameters` | `ParametersPanel` (a whole schema with groups, presets, undo / reset / randomize and keyframe diamonds), `createParameters` (call `destroy()` when done), `useParameterCommands`, and the field controls `ParameterFieldControl`, `ParameterSlider`, `ParameterToggle`, `ParameterSelect`, `ParameterColor`, `ParameterVector`, `ParameterImage`, `ParameterText`, `KeyframeDiamond` over `@pixerate/editor/parameters` (see [the parameters guide](../../docs/parameters.md)) |
|
|
86
87
|
| `@pixerate/editor-svelte/canvas` | Runes for `@xyflow/svelte`: `createCanvasGraph`, `createCanvasClipboard`, `createCanvasDocking`, `createCanvasShortcuts`, `createCanvasInteractions`, `createCanvasExplosion`, `createCanvasNodeSync`, `createCanvasMultiDrag`, `createStreamingCanvas`, `AgentPresenceLayer`, `FloatingHorizontalScrollbar`, plus layout helpers |
|
|
87
88
|
|
|
88
89
|
Spreadsheet persistence: `createReactiveSpreadsheet` exposes `document` (and passes it to `onDocumentChange`) with the defined names its formulas use in `document.names`, so saving that document and passing it back as `document` restores workbook, sheet-scoped and LAMBDA names. For several sheets, save `controller.getWorkbook()` instead.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentToolProvider, ToolRegistry } from "@pixerate/editor/
|
|
1
|
+
import type { AgentToolProvider, ToolRegistry } from "@pixerate/editor/tools";
|
|
2
2
|
type MaybeGetter<T> = T | (() => T);
|
|
3
3
|
/**
|
|
4
4
|
* Registers a tool provider with a `ToolRegistry` for the lifetime of the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCanvasAnimation.svelte.d.ts","sourceRoot":"","sources":["../../src/canvas/createCanvasAnimation.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,KAAK,EACV,MAAM,yBAAyB,CAA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asArrange.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,SAAS,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,KAAK,WAAW,GAAG,8BAA8B,CAAC,GAAG,CAAC,CAAC;AAEvD,MAAM,WAAW,0BAA0B,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,CAChF,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,gBAAgB,CAAC;IACrE,QAAQ,EAAE,MAAM,KAAK,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;CAC/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,EACxE,OAAO,EAAE,0BAA0B,CAAC,KAAK,CAAC;;IAkBzC;;;;;OAKG;wBACiB,MAAM;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"createCanvasArrange.svelte.d.ts","sourceRoot":"","sources":["../../src/canvas/createCanvasArrange.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,SAAS,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,KAAK,WAAW,GAAG,8BAA8B,CAAC,GAAG,CAAC,CAAC;AAEvD,MAAM,WAAW,0BAA0B,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,CAChF,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,gBAAgB,CAAC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,wBAAgB,sBAAsB,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,EAAE,OAAO,EAAE,6BAA6B,CAAC,KAAK,CAAC;IAazH,gCAAgC;;;;;4BASum5J,CAAC;;UAAmM,CAAC;YAAsB,CAAC;eAAyB,CAAC;;8BAA8E,CAAC;;;;;;;;;;6BAA4nC,CAAC;;;;;;;;eAA6yB,CAAC;;;;;;;oBAAi7B,CAAC;;;;;;;;;;;;;;gBAA07C,CAAC;;EAHruiK;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ParameterKeyState } from '@pixerate/editor/parameters';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
state: ParameterKeyState;
|
|
6
|
+
ontoggle: () => void;
|
|
7
|
+
/** The parameter's label (for the accessible name). */
|
|
8
|
+
label: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { state, ontoggle, label, disabled = false, class: className = '' }: Props = $props();
|
|
14
|
+
|
|
15
|
+
const keyed = $derived(state === 'keyed');
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<!-- A keyframe toggle: filled when a key sits at the playhead, tinted when the value is animated. -->
|
|
19
|
+
<button
|
|
20
|
+
type="button"
|
|
21
|
+
data-key-state={state}
|
|
22
|
+
aria-pressed={keyed}
|
|
23
|
+
aria-label="{keyed ? 'Remove' : 'Add'} keyframe for {label}"
|
|
24
|
+
title={keyed ? 'Remove keyframe here' : 'Add keyframe at the playhead'}
|
|
25
|
+
{disabled}
|
|
26
|
+
onclick={ontoggle}
|
|
27
|
+
class="inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-40 {state ===
|
|
28
|
+
'none'
|
|
29
|
+
? 'text-muted-foreground hover:text-foreground'
|
|
30
|
+
: 'text-amber-500'} {className}"
|
|
31
|
+
>
|
|
32
|
+
<svg viewBox="0 0 10 10" class="h-2.5 w-2.5" aria-hidden="true">
|
|
33
|
+
<path
|
|
34
|
+
d="M5 0.8 9.2 5 5 9.2 0.8 5Z"
|
|
35
|
+
fill={keyed ? 'currentColor' : 'none'}
|
|
36
|
+
stroke="currentColor"
|
|
37
|
+
stroke-width="1.3"
|
|
38
|
+
opacity={state === 'animated' ? 0.7 : 1}
|
|
39
|
+
/>
|
|
40
|
+
</svg>
|
|
41
|
+
</button>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ParameterKeyState } from '@pixerate/editor/parameters';
|
|
2
|
+
interface Props {
|
|
3
|
+
state: ParameterKeyState;
|
|
4
|
+
ontoggle: () => void;
|
|
5
|
+
/** The parameter's label (for the accessible name). */
|
|
6
|
+
label: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const KeyframeDiamond: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type KeyframeDiamond = ReturnType<typeof KeyframeDiamond>;
|
|
12
|
+
export default KeyframeDiamond;
|
|
13
|
+
//# sourceMappingURL=KeyframeDiamond.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyframeDiamond.svelte.d.ts","sourceRoot":"","sources":["../../src/parameters/KeyframeDiamond.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,UAAU,KAAK;IACb,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAsBH,QAAA,MAAM,eAAe,2CAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { normalizeHexColor, parameterLabel, type ColorParameterField } from '@pixerate/editor/parameters';
|
|
3
|
+
import ParameterCommitInput from './ParameterCommitInput.svelte';
|
|
4
|
+
import { parameterInputClass, parameterRangeClass } from './styles.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
field: ColorParameterField;
|
|
8
|
+
value: string;
|
|
9
|
+
onchange: (value: string) => void;
|
|
10
|
+
/** A pick or alpha drag started: merge changes into one undo step until `ongestureend`. */
|
|
11
|
+
ongesturestart?: () => void;
|
|
12
|
+
ongestureend?: () => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
id?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let { field, value, onchange, ongesturestart, ongestureend, disabled = false, id }: Props = $props();
|
|
18
|
+
|
|
19
|
+
const alpha = $derived(!!field.alpha);
|
|
20
|
+
const hex = $derived(normalizeHexColor(value, true) ?? '#000000ff');
|
|
21
|
+
const rgb = $derived(hex.slice(0, 7));
|
|
22
|
+
const a = $derived(hex.slice(7));
|
|
23
|
+
const shown = $derived(alpha ? hex : rgb);
|
|
24
|
+
const off = $derived(disabled || !!field.readOnly);
|
|
25
|
+
const name = $derived(parameterLabel(field));
|
|
26
|
+
|
|
27
|
+
let picking = false;
|
|
28
|
+
function start() {
|
|
29
|
+
if (picking) return;
|
|
30
|
+
picking = true;
|
|
31
|
+
ongesturestart?.();
|
|
32
|
+
}
|
|
33
|
+
function end() {
|
|
34
|
+
if (!picking) return;
|
|
35
|
+
picking = false;
|
|
36
|
+
ongestureend?.();
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<!-- A colour picker with a hex box, an alpha slider (with `alpha`) and swatches. -->
|
|
41
|
+
<div class="space-y-1.5">
|
|
42
|
+
<div class="flex items-center gap-2">
|
|
43
|
+
<span
|
|
44
|
+
class="relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px]"
|
|
45
|
+
>
|
|
46
|
+
<span class="absolute inset-0" style:background={shown}></span>
|
|
47
|
+
<input
|
|
48
|
+
type="color"
|
|
49
|
+
aria-label={name}
|
|
50
|
+
value={rgb}
|
|
51
|
+
disabled={off}
|
|
52
|
+
class="absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
53
|
+
oninput={(e) => {
|
|
54
|
+
start();
|
|
55
|
+
onchange(alpha ? `${e.currentTarget.value}${a}` : e.currentTarget.value);
|
|
56
|
+
}}
|
|
57
|
+
onblur={end}
|
|
58
|
+
/>
|
|
59
|
+
</span>
|
|
60
|
+
<ParameterCommitInput
|
|
61
|
+
{id}
|
|
62
|
+
aria-label="{name} hex"
|
|
63
|
+
value={shown}
|
|
64
|
+
disabled={off}
|
|
65
|
+
spellcheck={false}
|
|
66
|
+
class="{parameterInputClass} font-mono"
|
|
67
|
+
oncommit={(text) => {
|
|
68
|
+
const next = normalizeHexColor(text, alpha);
|
|
69
|
+
if (next) onchange(next);
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
{#if alpha}
|
|
74
|
+
<input
|
|
75
|
+
type="range"
|
|
76
|
+
aria-label="{name} opacity"
|
|
77
|
+
min="0"
|
|
78
|
+
max="255"
|
|
79
|
+
step="1"
|
|
80
|
+
value={parseInt(a, 16)}
|
|
81
|
+
disabled={off}
|
|
82
|
+
class={parameterRangeClass}
|
|
83
|
+
onpointerdown={start}
|
|
84
|
+
onpointerup={end}
|
|
85
|
+
onpointercancel={end}
|
|
86
|
+
onblur={end}
|
|
87
|
+
oninput={(e) => onchange(`${rgb}${Number(e.currentTarget.value).toString(16).padStart(2, '0')}`)}
|
|
88
|
+
/>
|
|
89
|
+
{/if}
|
|
90
|
+
{#if field.swatches && field.swatches.length > 0}
|
|
91
|
+
<div class="flex flex-wrap gap-1">
|
|
92
|
+
{#each field.swatches as s (s)}
|
|
93
|
+
{@const swatch = normalizeHexColor(s, alpha)}
|
|
94
|
+
{#if swatch}
|
|
95
|
+
<button
|
|
96
|
+
type="button"
|
|
97
|
+
title={swatch}
|
|
98
|
+
aria-label="{name} {swatch}"
|
|
99
|
+
aria-pressed={swatch === shown}
|
|
100
|
+
disabled={off}
|
|
101
|
+
onclick={() => onchange(swatch)}
|
|
102
|
+
class="h-5 w-5 rounded border border-input aria-pressed:ring-1 aria-pressed:ring-primary"
|
|
103
|
+
style:background={swatch}
|
|
104
|
+
></button>
|
|
105
|
+
{/if}
|
|
106
|
+
{/each}
|
|
107
|
+
</div>
|
|
108
|
+
{/if}
|
|
109
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ColorParameterField } from '@pixerate/editor/parameters';
|
|
2
|
+
interface Props {
|
|
3
|
+
field: ColorParameterField;
|
|
4
|
+
value: string;
|
|
5
|
+
onchange: (value: string) => void;
|
|
6
|
+
/** A pick or alpha drag started: merge changes into one undo step until `ongestureend`. */
|
|
7
|
+
ongesturestart?: () => void;
|
|
8
|
+
ongestureend?: () => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
id?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const ParameterColor: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type ParameterColor = ReturnType<typeof ParameterColor>;
|
|
14
|
+
export default ParameterColor;
|
|
15
|
+
//# sourceMappingURL=ParameterColor.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterColor.svelte.d.ts","sourceRoot":"","sources":["../../src/parameters/ParameterColor.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqC,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAKxG,UAAU,KAAK;IACb,KAAK,EAAE,mBAAmB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AA8DH,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
import { parameterInputClass } from './styles.js';
|
|
4
|
+
|
|
5
|
+
interface Props extends Omit<HTMLInputAttributes, 'value' | 'class'> {
|
|
6
|
+
value: string;
|
|
7
|
+
/** Called with the text and the element (e.g. to show the stored value again after a refused edit). */
|
|
8
|
+
oncommit: (value: string, input: HTMLInputElement | HTMLTextAreaElement) => void;
|
|
9
|
+
/** A textarea that commits on blur or Mod+Enter. */
|
|
10
|
+
multiline?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let { value, oncommit, multiline = false, class: className = parameterInputClass, onkeydown, ...rest }: Props = $props();
|
|
15
|
+
|
|
16
|
+
function commit(el: HTMLInputElement | HTMLTextAreaElement) {
|
|
17
|
+
if (el.value !== value) oncommit(el.value, el);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function keydown(e: KeyboardEvent & { currentTarget: HTMLInputElement | HTMLTextAreaElement }) {
|
|
21
|
+
(onkeydown as ((e: KeyboardEvent) => void) | undefined)?.(e);
|
|
22
|
+
if (e.defaultPrevented) return;
|
|
23
|
+
if (e.key === 'Enter' && (!multiline || e.metaKey || e.ctrlKey)) {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
commit(e.currentTarget);
|
|
26
|
+
}
|
|
27
|
+
if (e.key === 'Escape') e.currentTarget.value = value;
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
{#if multiline}
|
|
32
|
+
<textarea
|
|
33
|
+
{...rest as any}
|
|
34
|
+
class="{className} h-auto min-h-[3.5rem] py-1"
|
|
35
|
+
{value}
|
|
36
|
+
onblur={(e) => commit(e.currentTarget)}
|
|
37
|
+
onkeydown={keydown}
|
|
38
|
+
></textarea>
|
|
39
|
+
{:else}
|
|
40
|
+
<input type="text" {...rest} class={className} {value} onblur={(e) => commit(e.currentTarget)} onkeydown={keydown} />
|
|
41
|
+
{/if}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
interface Props extends Omit<HTMLInputAttributes, 'value' | 'class'> {
|
|
3
|
+
value: string;
|
|
4
|
+
/** Called with the text and the element (e.g. to show the stored value again after a refused edit). */
|
|
5
|
+
oncommit: (value: string, input: HTMLInputElement | HTMLTextAreaElement) => void;
|
|
6
|
+
/** A textarea that commits on blur or Mod+Enter. */
|
|
7
|
+
multiline?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const ParameterCommitInput: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type ParameterCommitInput = ReturnType<typeof ParameterCommitInput>;
|
|
12
|
+
export default ParameterCommitInput;
|
|
13
|
+
//# sourceMappingURL=ParameterCommitInput.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterCommitInput.svelte.d.ts","sourceRoot":"","sources":["../../src/parameters/ParameterCommitInput.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,UAAU,KAAM,SAAQ,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,OAAO,CAAC;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,uGAAuG;IACvG,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,mBAAmB,KAAK,IAAI,CAAC;IACjF,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA+BH,QAAA,MAAM,oBAAoB,2CAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ParameterField, ParameterValue } from '@pixerate/editor/parameters';
|
|
3
|
+
import ParameterColor from './ParameterColor.svelte';
|
|
4
|
+
import ParameterImage from './ParameterImage.svelte';
|
|
5
|
+
import ParameterSelect from './ParameterSelect.svelte';
|
|
6
|
+
import ParameterSlider from './ParameterSlider.svelte';
|
|
7
|
+
import ParameterText from './ParameterText.svelte';
|
|
8
|
+
import ParameterToggle from './ParameterToggle.svelte';
|
|
9
|
+
import ParameterVector from './ParameterVector.svelte';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
field: ParameterField;
|
|
13
|
+
value: ParameterValue;
|
|
14
|
+
onchange: (value: ParameterValue) => void;
|
|
15
|
+
ongesturestart?: () => void;
|
|
16
|
+
ongestureend?: () => void;
|
|
17
|
+
resolveFile?: (file: File) => string | Promise<string>;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
id?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let { field, value, onchange, ongesturestart, ongestureend, resolveFile, disabled = false, id }: Props = $props();
|
|
23
|
+
const set = $derived(onchange as (value: any) => void);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<!-- The control for any field type. -->
|
|
27
|
+
{#if field.type === 'number' || field.type === 'int'}
|
|
28
|
+
<ParameterSlider {field} value={value as number} onchange={set} {ongesturestart} {ongestureend} {disabled} {id} />
|
|
29
|
+
{:else if field.type === 'boolean'}
|
|
30
|
+
<ParameterToggle {field} value={value as boolean} onchange={set} {disabled} {id} />
|
|
31
|
+
{:else if field.type === 'choice'}
|
|
32
|
+
<ParameterSelect {field} value={value as string | number} onchange={set} {disabled} {id} />
|
|
33
|
+
{:else if field.type === 'color'}
|
|
34
|
+
<ParameterColor {field} value={value as string} onchange={set} {ongesturestart} {ongestureend} {disabled} {id} />
|
|
35
|
+
{:else if field.type === 'vector'}
|
|
36
|
+
<ParameterVector {field} value={value as number[]} onchange={set} {disabled} {id} />
|
|
37
|
+
{:else if field.type === 'image'}
|
|
38
|
+
<ParameterImage {field} value={value as string} onchange={set} {resolveFile} {disabled} {id} />
|
|
39
|
+
{:else if field.type === 'text'}
|
|
40
|
+
<ParameterText {field} value={value as string} onchange={set} {disabled} {id} />
|
|
41
|
+
{/if}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ParameterField, ParameterValue } from '@pixerate/editor/parameters';
|
|
2
|
+
interface Props {
|
|
3
|
+
field: ParameterField;
|
|
4
|
+
value: ParameterValue;
|
|
5
|
+
onchange: (value: ParameterValue) => void;
|
|
6
|
+
ongesturestart?: () => void;
|
|
7
|
+
ongestureend?: () => void;
|
|
8
|
+
resolveFile?: (file: File) => string | Promise<string>;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
id?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const ParameterFieldControl: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type ParameterFieldControl = ReturnType<typeof ParameterFieldControl>;
|
|
14
|
+
export default ParameterFieldControl;
|
|
15
|
+
//# sourceMappingURL=ParameterFieldControl.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterFieldControl.svelte.d.ts","sourceRoot":"","sources":["../../src/parameters/ParameterFieldControl.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAUhF,UAAU,KAAK;IACb,KAAK,EAAE,cAAc,CAAC;IACtB,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAmCH,QAAA,MAAM,qBAAqB,2CAAwC,CAAC;AACpE,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACtE,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { parameterLabel, type ImageParameterField } from '@pixerate/editor/parameters';
|
|
3
|
+
import ParameterCommitInput from './ParameterCommitInput.svelte';
|
|
4
|
+
import { parameterButtonClass } from './styles.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
field: ImageParameterField;
|
|
8
|
+
value: string;
|
|
9
|
+
onchange: (value: string) => void;
|
|
10
|
+
/** Turns a picked file into a URL (upload it, or `URL.createObjectURL`). Without it there is no file button. */
|
|
11
|
+
resolveFile?: (file: File) => string | Promise<string>;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let { field, value, onchange, resolveFile, disabled = false, id }: Props = $props();
|
|
17
|
+
|
|
18
|
+
const off = $derived(disabled || !!field.readOnly);
|
|
19
|
+
const name = $derived(parameterLabel(field));
|
|
20
|
+
|
|
21
|
+
async function pick(e: Event & { currentTarget: HTMLInputElement }) {
|
|
22
|
+
const file = e.currentTarget.files?.[0];
|
|
23
|
+
e.currentTarget.value = '';
|
|
24
|
+
if (file && resolveFile) onchange(await resolveFile(file));
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<!-- An image picker: suggested thumbnails, a URL box, an optional file button and a clear button. -->
|
|
29
|
+
<div class="space-y-1.5">
|
|
30
|
+
<div class="flex items-center gap-2">
|
|
31
|
+
<div class="flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted">
|
|
32
|
+
{#if value}
|
|
33
|
+
<img src={value} alt={name} class="h-full w-full object-cover" />
|
|
34
|
+
{:else}
|
|
35
|
+
<span class="text-[10px] text-muted-foreground">None</span>
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
38
|
+
<div class="flex min-w-0 flex-1 flex-col gap-1">
|
|
39
|
+
<ParameterCommitInput
|
|
40
|
+
{id}
|
|
41
|
+
aria-label="{name} URL"
|
|
42
|
+
placeholder="Image URL"
|
|
43
|
+
value={value.startsWith('data:') ? '' : value}
|
|
44
|
+
disabled={off}
|
|
45
|
+
oncommit={(text) => onchange(text.trim())}
|
|
46
|
+
/>
|
|
47
|
+
<div class="flex gap-1">
|
|
48
|
+
{#if resolveFile}
|
|
49
|
+
<label class="{parameterButtonClass} cursor-pointer {off ? 'pointer-events-none opacity-50' : ''}">
|
|
50
|
+
Choose file…
|
|
51
|
+
<input type="file" class="sr-only" accept={field.accept ?? 'image/*'} disabled={off} aria-label="{name} file" onchange={pick} />
|
|
52
|
+
</label>
|
|
53
|
+
{/if}
|
|
54
|
+
{#if value}
|
|
55
|
+
<button type="button" class={parameterButtonClass} disabled={off} onclick={() => onchange('')} aria-label="Clear {name}">Clear</button>
|
|
56
|
+
{/if}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
{#if field.options && field.options.length > 0}
|
|
61
|
+
<div class="flex flex-wrap gap-1">
|
|
62
|
+
{#each field.options as o (o.url)}
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
title={o.label ?? o.url}
|
|
66
|
+
aria-label={o.label ?? o.url}
|
|
67
|
+
aria-pressed={o.url === value}
|
|
68
|
+
disabled={off}
|
|
69
|
+
onclick={() => onchange(o.url)}
|
|
70
|
+
class="h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary"
|
|
71
|
+
>
|
|
72
|
+
<img src={o.url} alt="" class="h-full w-full object-cover" />
|
|
73
|
+
</button>
|
|
74
|
+
{/each}
|
|
75
|
+
</div>
|
|
76
|
+
{/if}
|
|
77
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ImageParameterField } from '@pixerate/editor/parameters';
|
|
2
|
+
interface Props {
|
|
3
|
+
field: ImageParameterField;
|
|
4
|
+
value: string;
|
|
5
|
+
onchange: (value: string) => void;
|
|
6
|
+
/** Turns a picked file into a URL (upload it, or `URL.createObjectURL`). Without it there is no file button. */
|
|
7
|
+
resolveFile?: (file: File) => string | Promise<string>;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
id?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const ParameterImage: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type ParameterImage = ReturnType<typeof ParameterImage>;
|
|
13
|
+
export default ParameterImage;
|
|
14
|
+
//# sourceMappingURL=ParameterImage.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterImage.svelte.d.ts","sourceRoot":"","sources":["../../src/parameters/ParameterImage.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAKrF,UAAU,KAAK;IACb,KAAK,EAAE,mBAAmB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,gHAAgH;IAChH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAyDH,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
clampParameterNumber,
|
|
4
|
+
formatParameterNumber,
|
|
5
|
+
parameterLabel,
|
|
6
|
+
parameterStep,
|
|
7
|
+
parseParameterNumberInput,
|
|
8
|
+
type NumberParameterField
|
|
9
|
+
} from '@pixerate/editor/parameters';
|
|
10
|
+
import ParameterCommitInput from './ParameterCommitInput.svelte';
|
|
11
|
+
import { parameterInputClass } from './styles.js';
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
field: NumberParameterField;
|
|
15
|
+
value: number;
|
|
16
|
+
onchange: (value: number) => void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
id?: string;
|
|
19
|
+
'aria-label'?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let { field, value, onchange, disabled = false, id, 'aria-label': ariaLabel }: Props = $props();
|
|
23
|
+
|
|
24
|
+
const text = $derived(formatParameterNumber({ ...field, unit: undefined }, value));
|
|
25
|
+
|
|
26
|
+
function keydown(e: KeyboardEvent) {
|
|
27
|
+
if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return;
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
const step = parameterStep(field) * (e.shiftKey ? 10 : 1);
|
|
30
|
+
onchange(clampParameterNumber(field, value + (e.key === 'ArrowUp' ? step : -step)));
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<!-- A number box: type a value (units allowed), or step with the arrow keys (Shift ×10). -->
|
|
35
|
+
<div class="relative min-w-0 flex-1">
|
|
36
|
+
<ParameterCommitInput
|
|
37
|
+
{id}
|
|
38
|
+
inputmode="decimal"
|
|
39
|
+
aria-label={ariaLabel ?? parameterLabel(field)}
|
|
40
|
+
value={text}
|
|
41
|
+
disabled={disabled || field.readOnly}
|
|
42
|
+
class="{parameterInputClass} {field.unit ? 'pr-6' : ''}"
|
|
43
|
+
onkeydown={keydown}
|
|
44
|
+
oncommit={(t, input) => {
|
|
45
|
+
const n = parseParameterNumberInput(field, t);
|
|
46
|
+
// Show the stored value again when the text was not a number or clamps to it.
|
|
47
|
+
if (n === null || n === value) input.value = text;
|
|
48
|
+
else onchange(n);
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
{#if field.unit}
|
|
52
|
+
<span class="pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground">{field.unit}</span>
|
|
53
|
+
{/if}
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type NumberParameterField } from '@pixerate/editor/parameters';
|
|
2
|
+
interface Props {
|
|
3
|
+
field: NumberParameterField;
|
|
4
|
+
value: number;
|
|
5
|
+
onchange: (value: number) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
id?: string;
|
|
8
|
+
'aria-label'?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const ParameterNumberInput: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type ParameterNumberInput = ReturnType<typeof ParameterNumberInput>;
|
|
12
|
+
export default ParameterNumberInput;
|
|
13
|
+
//# sourceMappingURL=ParameterNumberInput.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterNumberInput.svelte.d.ts","sourceRoot":"","sources":["../../src/parameters/ParameterNumberInput.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAMH,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AAKrC,UAAU,KAAK;IACb,KAAK,EAAE,oBAAoB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAkCH,QAAA,MAAM,oBAAoB,2CAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { choiceOptionLabel, getChoiceOptions, parameterLabel, type ChoiceParameterField } from '@pixerate/editor/parameters';
|
|
3
|
+
import { parameterInputClass } from './styles.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
field: ChoiceParameterField;
|
|
7
|
+
value: string | number;
|
|
8
|
+
onchange: (value: string | number) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
id?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { field, value, onchange, disabled = false, id }: Props = $props();
|
|
14
|
+
|
|
15
|
+
const options = $derived(getChoiceOptions(field));
|
|
16
|
+
const off = $derived(disabled || !!field.readOnly);
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<!-- A dropdown (or segmented buttons with `control: 'segmented'`) for `choice` fields. -->
|
|
20
|
+
{#if field.control === 'segmented'}
|
|
21
|
+
<div role="radiogroup" aria-label={parameterLabel(field)} class="inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5">
|
|
22
|
+
{#each options as o (o.value)}
|
|
23
|
+
<button
|
|
24
|
+
type="button"
|
|
25
|
+
role="radio"
|
|
26
|
+
aria-checked={o.value === value}
|
|
27
|
+
title={o.description}
|
|
28
|
+
disabled={off}
|
|
29
|
+
onclick={() => onchange(o.value)}
|
|
30
|
+
class="rounded px-2 py-0.5 text-xs disabled:opacity-50 {o.value === value
|
|
31
|
+
? 'bg-background text-foreground shadow-sm'
|
|
32
|
+
: 'text-muted-foreground hover:text-foreground'}"
|
|
33
|
+
>
|
|
34
|
+
{choiceOptionLabel(o)}
|
|
35
|
+
</button>
|
|
36
|
+
{/each}
|
|
37
|
+
</div>
|
|
38
|
+
{:else}
|
|
39
|
+
<select
|
|
40
|
+
{id}
|
|
41
|
+
aria-label={parameterLabel(field)}
|
|
42
|
+
value={String(options.findIndex((o) => o.value === value))}
|
|
43
|
+
disabled={off}
|
|
44
|
+
class={parameterInputClass}
|
|
45
|
+
onchange={(e) => {
|
|
46
|
+
const option = options[Number(e.currentTarget.value)];
|
|
47
|
+
if (option) onchange(option.value);
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
{#each options as o, i (o.value)}
|
|
51
|
+
<option value={String(i)} title={o.description}>{choiceOptionLabel(o)}</option>
|
|
52
|
+
{/each}
|
|
53
|
+
</select>
|
|
54
|
+
{/if}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ChoiceParameterField } from '@pixerate/editor/parameters';
|
|
2
|
+
interface Props {
|
|
3
|
+
field: ChoiceParameterField;
|
|
4
|
+
value: string | number;
|
|
5
|
+
onchange: (value: string | number) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const ParameterSelect: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type ParameterSelect = ReturnType<typeof ParameterSelect>;
|
|
11
|
+
export default ParameterSelect;
|
|
12
|
+
//# sourceMappingURL=ParameterSelect.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParameterSelect.svelte.d.ts","sourceRoot":"","sources":["../../src/parameters/ParameterSelect.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuD,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAI3H,UAAU,KAAK;IACb,KAAK,EAAE,oBAAoB,CAAC;IAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAoCH,QAAA,MAAM,eAAe,2CAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
|