@widgetic/editor 4.0.6 → 4.0.8

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 (64) hide show
  1. package/README.md +12 -1
  2. package/dist/components/WidgetPreview.svelte +42 -1
  3. package/dist/components/WidgetPreview.svelte.d.ts +8 -0
  4. package/dist/components/editors/EmbedEditor.svelte +101 -530
  5. package/dist/components/editors/EmbedEditor.svelte.d.ts +7 -17
  6. package/dist/components/editors/PropsEditor.svelte +328 -142
  7. package/dist/components/editors/PropsEditor.svelte.d.ts +13 -2
  8. package/dist/components/ic/AngleInputController.svelte +21 -7
  9. package/dist/components/ic/AngleInputController.svelte.d.ts +16 -6
  10. package/dist/components/ic/BrowserInputController.svelte +28 -15
  11. package/dist/components/ic/BrowserInputController.svelte.d.ts +25 -19
  12. package/dist/components/ic/CheckboxInputController.svelte +21 -7
  13. package/dist/components/ic/CheckboxInputController.svelte.d.ts +25 -15
  14. package/dist/components/ic/ColorPickerInputController.svelte +47 -21
  15. package/dist/components/ic/ColorPickerInputController.svelte.d.ts +42 -19
  16. package/dist/components/ic/DateFieldInputController.svelte +21 -7
  17. package/dist/components/ic/DateFieldInputController.svelte.d.ts +24 -14
  18. package/dist/components/ic/DatePickerInputController.svelte +25 -8
  19. package/dist/components/ic/DatePickerInputController.svelte.d.ts +21 -8
  20. package/dist/components/ic/DropdownInputController.svelte +69 -19
  21. package/dist/components/ic/DropdownInputController.svelte.d.ts +33 -17
  22. package/dist/components/ic/FixedPositionInputController.svelte +24 -10
  23. package/dist/components/ic/FixedPositionInputController.svelte.d.ts +16 -4
  24. package/dist/components/ic/FontInputController.svelte +53 -18
  25. package/dist/components/ic/FontInputController.svelte.d.ts +33 -18
  26. package/dist/components/ic/InputControllerRenderer.svelte +98 -0
  27. package/dist/components/ic/InputControllerRenderer.svelte.d.ts +40 -0
  28. package/dist/components/ic/NumberInputController.svelte +23 -9
  29. package/dist/components/ic/NumberInputController.svelte.d.ts +18 -7
  30. package/dist/components/ic/PositionInputController.svelte +17 -5
  31. package/dist/components/ic/PositionInputController.svelte.d.ts +20 -11
  32. package/dist/components/ic/RadioGroupInputController.svelte +21 -7
  33. package/dist/components/ic/RadioGroupInputController.svelte.d.ts +22 -12
  34. package/dist/components/ic/RangeCalendarInputController.svelte +34 -16
  35. package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +25 -11
  36. package/dist/components/ic/RoundedCornersInputController.svelte +26 -22
  37. package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +26 -18
  38. package/dist/components/ic/SliderInputController.svelte +41 -18
  39. package/dist/components/ic/SliderInputController.svelte.d.ts +35 -19
  40. package/dist/components/ic/SliderRangeInputController.svelte +27 -11
  41. package/dist/components/ic/SliderRangeInputController.svelte.d.ts +22 -9
  42. package/dist/components/ic/SwitchInputController.svelte +17 -5
  43. package/dist/components/ic/SwitchInputController.svelte.d.ts +14 -5
  44. package/dist/components/ic/TagsInputController.svelte +21 -7
  45. package/dist/components/ic/TagsInputController.svelte.d.ts +16 -6
  46. package/dist/components/ic/TextAreaInputController.svelte +44 -25
  47. package/dist/components/ic/TextAreaInputController.svelte.d.ts +6 -4
  48. package/dist/components/ic/TextAreaPreviewInputController.svelte +21 -7
  49. package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +16 -6
  50. package/dist/components/ic/TextInputController.svelte +23 -8
  51. package/dist/components/ic/TextInputController.svelte.d.ts +20 -8
  52. package/dist/components/ic/TimeInputController.svelte +17 -5
  53. package/dist/components/ic/TimeInputController.svelte.d.ts +14 -5
  54. package/dist/components/ic/VectorInputController.svelte +29 -10
  55. package/dist/components/ic/VectorInputController.svelte.d.ts +33 -18
  56. package/dist/components/icons/locked.svelte +5 -1
  57. package/dist/components/icons/locked.svelte.d.ts +11 -24
  58. package/dist/components/icons/unlocked.svelte +5 -1
  59. package/dist/components/icons/unlocked.svelte.d.ts +11 -24
  60. package/dist/index.d.ts +1 -0
  61. package/dist/schemaViews.d.ts +105 -0
  62. package/dist/schemaViews.js +11 -0
  63. package/dist/utils/FontManager.js +11 -4
  64. package/package.json +16 -12
@@ -0,0 +1,98 @@
1
+ <script module lang="ts">
2
+ import type { ComponentProps } from 'svelte';
3
+ import {
4
+ TextInputController, TextAreaPreviewInputController, NumberInputController,
5
+ SliderInputController, SliderRangeInputController, DropdownInputController,
6
+ DatePickerInputController, DateFieldInputController, RangeCalendarInputController,
7
+ SwitchInputController, ColorPickerInputController, CheckboxInputController,
8
+ RadioGroupInputController, FontInputController, PositionInputController,
9
+ BrowserInputController, FixedPositionInputController, VectorInputController,
10
+ AngleInputController, TimeInputController, RoundedCornersInputController, TagsInputController
11
+ } from './index';
12
+
13
+ type ControllerComponents = {
14
+ textinput: typeof TextInputController;
15
+ textarea: typeof TextAreaPreviewInputController;
16
+ number: typeof NumberInputController;
17
+ slider: typeof SliderInputController;
18
+ sliderrange: typeof SliderRangeInputController;
19
+ dropdown: typeof DropdownInputController;
20
+ datepicker: typeof DatePickerInputController;
21
+ datefield: typeof DateFieldInputController;
22
+ rangecalendar: typeof RangeCalendarInputController;
23
+ switch: typeof SwitchInputController;
24
+ colorpicker: typeof ColorPickerInputController;
25
+ checkbox: typeof CheckboxInputController;
26
+ radiogroup: typeof RadioGroupInputController;
27
+ font: typeof FontInputController;
28
+ position: typeof PositionInputController;
29
+ browser: typeof BrowserInputController;
30
+ fixedposition: typeof FixedPositionInputController;
31
+ vector: typeof VectorInputController;
32
+ angle: typeof AngleInputController;
33
+ time: typeof TimeInputController;
34
+ roundedcorners: typeof RoundedCornersInputController;
35
+ tags: typeof TagsInputController;
36
+ };
37
+
38
+ // Each branch preserves the relationship between a controller and its props.
39
+ export type ControllerDescriptor = {
40
+ [Kind in keyof ControllerComponents]: { kind: Kind; props: ComponentProps<ControllerComponents[Kind]> }
41
+ }[keyof ControllerComponents];
42
+ </script>
43
+
44
+ <script lang="ts">
45
+ let { controller, class: className = '', style = '' }: {
46
+ controller: ControllerDescriptor | null;
47
+ class?: string;
48
+ style?: string;
49
+ } = $props();
50
+ </script>
51
+
52
+ <div class="input-controller-renderer contents {className}" {style}>
53
+ {#if controller?.kind === 'textinput'}
54
+ <TextInputController {...controller.props} />
55
+ {:else if controller?.kind === 'textarea'}
56
+ <TextAreaPreviewInputController {...controller.props} />
57
+ {:else if controller?.kind === 'number'}
58
+ <NumberInputController {...controller.props} />
59
+ {:else if controller?.kind === 'slider'}
60
+ <SliderInputController {...controller.props} />
61
+ {:else if controller?.kind === 'sliderrange'}
62
+ <SliderRangeInputController {...controller.props} />
63
+ {:else if controller?.kind === 'dropdown'}
64
+ <DropdownInputController {...controller.props} />
65
+ {:else if controller?.kind === 'datepicker'}
66
+ <DatePickerInputController {...controller.props} />
67
+ {:else if controller?.kind === 'datefield'}
68
+ <DateFieldInputController {...controller.props} />
69
+ {:else if controller?.kind === 'rangecalendar'}
70
+ <RangeCalendarInputController {...controller.props} />
71
+ {:else if controller?.kind === 'switch'}
72
+ <SwitchInputController {...controller.props} />
73
+ {:else if controller?.kind === 'colorpicker'}
74
+ <ColorPickerInputController {...controller.props} />
75
+ {:else if controller?.kind === 'checkbox'}
76
+ <CheckboxInputController {...controller.props} />
77
+ {:else if controller?.kind === 'radiogroup'}
78
+ <RadioGroupInputController {...controller.props} />
79
+ {:else if controller?.kind === 'font'}
80
+ <FontInputController {...controller.props} />
81
+ {:else if controller?.kind === 'position'}
82
+ <PositionInputController {...controller.props} />
83
+ {:else if controller?.kind === 'browser'}
84
+ <BrowserInputController {...controller.props} />
85
+ {:else if controller?.kind === 'fixedposition'}
86
+ <FixedPositionInputController {...controller.props} />
87
+ {:else if controller?.kind === 'vector'}
88
+ <VectorInputController {...controller.props} />
89
+ {:else if controller?.kind === 'angle'}
90
+ <AngleInputController {...controller.props} />
91
+ {:else if controller?.kind === 'time'}
92
+ <TimeInputController {...controller.props} />
93
+ {:else if controller?.kind === 'roundedcorners'}
94
+ <RoundedCornersInputController {...controller.props} />
95
+ {:else if controller?.kind === 'tags'}
96
+ <TagsInputController {...controller.props} />
97
+ {/if}
98
+ </div>
@@ -0,0 +1,40 @@
1
+ import type { ComponentProps } from 'svelte';
2
+ import { TextInputController, TextAreaPreviewInputController, NumberInputController, SliderInputController, SliderRangeInputController, DropdownInputController, DatePickerInputController, DateFieldInputController, RangeCalendarInputController, SwitchInputController, ColorPickerInputController, CheckboxInputController, RadioGroupInputController, FontInputController, PositionInputController, BrowserInputController, FixedPositionInputController, VectorInputController, AngleInputController, TimeInputController, RoundedCornersInputController, TagsInputController } from './index';
3
+ type ControllerComponents = {
4
+ textinput: typeof TextInputController;
5
+ textarea: typeof TextAreaPreviewInputController;
6
+ number: typeof NumberInputController;
7
+ slider: typeof SliderInputController;
8
+ sliderrange: typeof SliderRangeInputController;
9
+ dropdown: typeof DropdownInputController;
10
+ datepicker: typeof DatePickerInputController;
11
+ datefield: typeof DateFieldInputController;
12
+ rangecalendar: typeof RangeCalendarInputController;
13
+ switch: typeof SwitchInputController;
14
+ colorpicker: typeof ColorPickerInputController;
15
+ checkbox: typeof CheckboxInputController;
16
+ radiogroup: typeof RadioGroupInputController;
17
+ font: typeof FontInputController;
18
+ position: typeof PositionInputController;
19
+ browser: typeof BrowserInputController;
20
+ fixedposition: typeof FixedPositionInputController;
21
+ vector: typeof VectorInputController;
22
+ angle: typeof AngleInputController;
23
+ time: typeof TimeInputController;
24
+ roundedcorners: typeof RoundedCornersInputController;
25
+ tags: typeof TagsInputController;
26
+ };
27
+ export type ControllerDescriptor = {
28
+ [Kind in keyof ControllerComponents]: {
29
+ kind: Kind;
30
+ props: ComponentProps<ControllerComponents[Kind]>;
31
+ };
32
+ }[keyof ControllerComponents];
33
+ type $$ComponentProps = {
34
+ controller: ControllerDescriptor | null;
35
+ class?: string;
36
+ style?: string;
37
+ };
38
+ declare const InputControllerRenderer: import("svelte").Component<$$ComponentProps, {}, "">;
39
+ type InputControllerRenderer = ReturnType<typeof InputControllerRenderer>;
40
+ export default InputControllerRenderer;
@@ -1,3 +1,19 @@
1
+ <script module lang="ts">
2
+ import type { InputControllerConfig } from './index';
3
+
4
+ /** Declared props contract — export lets below are annotated from it so the
5
+ * interface cannot drift from what the component actually reads. */
6
+ export interface NumberInputControllerProps {
7
+ label: string;
8
+ value?: number;
9
+ onChange: (newValue: number) => void;
10
+ config?: InputControllerConfig;
11
+ helpText?: string;
12
+ description?: string;
13
+ onFocus?: () => void;
14
+ }
15
+ </script>
16
+
1
17
  <script lang="ts">
2
18
  /**
3
19
  * NumberInputController Component
@@ -13,8 +29,6 @@
13
29
  import { onDestroy } from 'svelte';
14
30
 
15
31
 
16
- // Component config
17
- import type { InputControllerConfig } from './index';
18
32
  import InputControllerHeader from './InputControllerHeader.svelte';
19
33
  import NumberControls from './NumberControls.svelte';
20
34
 
@@ -22,13 +36,13 @@
22
36
  * Component Props
23
37
  * External properties that configure the number input's behavior
24
38
  */
25
- export let label: string; // Display label
26
- export let value: number = 0; // Current numeric value
27
- export let onChange: (newValue: number) => void; // Value change callback
28
- export let config: InputControllerConfig = {}; // Additional configuration
29
- export let helpText: string | undefined = undefined; // Help text for the input
30
- export let description: string | undefined = undefined;
31
- export let onFocus: () => void = () => {}; // Focus callback
39
+ export let label: NumberInputControllerProps['label'];
40
+ export let value: NumberInputControllerProps['value'] = 0;
41
+ export let onChange: NumberInputControllerProps['onChange'];
42
+ export let config: NumberInputControllerProps['config'] = {};
43
+ export let helpText: NumberInputControllerProps['helpText'] = undefined;
44
+ export let description: NumberInputControllerProps['description'] = undefined;
45
+ export let onFocus: NumberInputControllerProps['onFocus'] = () => {};
32
46
 
33
47
  /**
34
48
  * Configuration Options
@@ -1,4 +1,15 @@
1
1
  import type { InputControllerConfig } from './index';
2
+ /** Declared props contract — export lets below are annotated from it so the
3
+ * interface cannot drift from what the component actually reads. */
4
+ export interface NumberInputControllerProps {
5
+ label: string;
6
+ value?: number;
7
+ onChange: (newValue: number) => void;
8
+ config?: InputControllerConfig;
9
+ helpText?: string;
10
+ description?: string;
11
+ onFocus?: () => void;
12
+ }
2
13
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
14
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
15
  $$bindings?: Bindings;
@@ -16,13 +27,13 @@ declare const NumberInputController: $$__sveltets_2_IsomorphicComponent<{
16
27
  /**
17
28
  * Component Props
18
29
  * External properties that configure the number input's behavior
19
- */ label: string;
20
- value?: number;
21
- onChange: (newValue: number) => void;
22
- config?: InputControllerConfig;
23
- helpText?: string | undefined;
24
- description?: string | undefined;
25
- onFocus?: () => void;
30
+ */ label: NumberInputControllerProps["label"];
31
+ value?: NumberInputControllerProps["value"];
32
+ onChange: NumberInputControllerProps["onChange"];
33
+ config?: NumberInputControllerProps["config"];
34
+ helpText?: NumberInputControllerProps["helpText"];
35
+ description?: NumberInputControllerProps["description"];
36
+ onFocus?: NumberInputControllerProps["onFocus"];
26
37
  }, {
27
38
  [evt: string]: CustomEvent<any>;
28
39
  }, {}, {}, string>;
@@ -17,6 +17,18 @@
17
17
  * - Maintains consistent state across input methods
18
18
  -->
19
19
 
20
+ <script module lang="ts">
21
+ /** Declared props contract — export lets below are annotated from it so the
22
+ * interface cannot drift from what the component actually reads. */
23
+ export interface PositionInputControllerProps {
24
+ value?: { x: number; y: number };
25
+ onChange: (newValue: { x: number; y: number }) => void;
26
+ onFocus?: () => void;
27
+ maskThumb?: boolean;
28
+ onDragStateChange?: (isDragging: boolean) => void;
29
+ }
30
+ </script>
31
+
20
32
  <script lang="ts">
21
33
  // Svelte imports
22
34
  import { onMount, onDestroy } from 'svelte';
@@ -32,11 +44,11 @@
32
44
  * onFocus: Focus event handler
33
45
  * onDragStateChange: Callback for dragging state changes
34
46
  */
35
- export let value: { x: number; y: number } | undefined = undefined;
36
- export let onChange: (newValue: { x: number; y: number }) => void;
37
- export let onFocus: () => void = () => {};
38
- export let maskThumb: boolean = true;
39
- export let onDragStateChange: (isDragging: boolean) => void = () => {};
47
+ export let value: PositionInputControllerProps['value'] = undefined;
48
+ export let onChange: PositionInputControllerProps['onChange'];
49
+ export let onFocus: PositionInputControllerProps['onFocus'] = () => {};
50
+ export let maskThumb: PositionInputControllerProps['maskThumb'] = true;
51
+ export let onDragStateChange: PositionInputControllerProps['onDragStateChange'] = () => {};
40
52
 
41
53
  /**
42
54
  * DOM references and state
@@ -1,3 +1,18 @@
1
+ /** Declared props contract — export lets below are annotated from it so the
2
+ * interface cannot drift from what the component actually reads. */
3
+ export interface PositionInputControllerProps {
4
+ value?: {
5
+ x: number;
6
+ y: number;
7
+ };
8
+ onChange: (newValue: {
9
+ x: number;
10
+ y: number;
11
+ }) => void;
12
+ onFocus?: () => void;
13
+ maskThumb?: boolean;
14
+ onDragStateChange?: (isDragging: boolean) => void;
15
+ }
1
16
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
17
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
18
  $$bindings?: Bindings;
@@ -19,17 +34,11 @@ declare const PositionInputController: $$__sveltets_2_IsomorphicComponent<{
19
34
  * config: Additional configuration options
20
35
  * onFocus: Focus event handler
21
36
  * onDragStateChange: Callback for dragging state changes
22
- */ value?: {
23
- x: number;
24
- y: number;
25
- } | undefined;
26
- onChange: (newValue: {
27
- x: number;
28
- y: number;
29
- }) => void;
30
- onFocus?: () => void;
31
- maskThumb?: boolean;
32
- onDragStateChange?: (isDragging: boolean) => void;
37
+ */ value?: PositionInputControllerProps["value"];
38
+ onChange: PositionInputControllerProps["onChange"];
39
+ onFocus?: PositionInputControllerProps["onFocus"];
40
+ maskThumb?: PositionInputControllerProps["maskThumb"];
41
+ onDragStateChange?: PositionInputControllerProps["onDragStateChange"];
33
42
  }, {
34
43
  [evt: string]: CustomEvent<any>;
35
44
  }, {}, {}, string>;
@@ -1,3 +1,18 @@
1
+ <script module lang="ts">
2
+ import type { InputControllerConfig } from './index';
3
+
4
+ /** Declared props contract — export lets below are annotated from it so the
5
+ * interface cannot drift from what the component actually reads. */
6
+ export interface RadioGroupInputControllerProps {
7
+ value: string | { value: string; label: string };
8
+ onChange: (newValue: string) => void;
9
+ config?: InputControllerConfig;
10
+ description?: string;
11
+ onFocus?: () => void;
12
+ options?: { value: string; label: string }[];
13
+ }
14
+ </script>
15
+
1
16
  <script lang="ts">
2
17
  /**
3
18
  * RadioGroupInputController Component
@@ -10,7 +25,6 @@
10
25
  * Required for component setup and cleanup
11
26
  */
12
27
  import { onMount, onDestroy } from 'svelte';
13
- import type { InputControllerConfig } from './index';
14
28
 
15
29
  /**
16
30
  * UI Components Imports
@@ -22,17 +36,17 @@
22
36
  * Component Props
23
37
  * External properties that configure the radio group's behavior and appearance
24
38
  */
25
- export let value: string | { value: string; label: string }; // Currently selected value
26
- export let onChange: (newValue: string) => void; // Callback for value changes
27
- export let config: InputControllerConfig = {}; // Additional configuration options
28
- export let description: string | undefined = undefined; // Optional help description text
29
- export let onFocus: () => void = () => {}; // Focus event handler
39
+ export let value: RadioGroupInputControllerProps['value']; // Currently selected value
40
+ export let onChange: RadioGroupInputControllerProps['onChange']; // Callback for value changes
41
+ export let config: RadioGroupInputControllerProps['config'] = {}; // Additional configuration options
42
+ export let description: RadioGroupInputControllerProps['description'] = undefined; // Optional help description text
43
+ export let onFocus: RadioGroupInputControllerProps['onFocus'] = () => {}; // Focus event handler
30
44
 
31
45
  /**
32
46
  * Configuration Options
33
47
  * Derived from config prop with fallbacks
34
48
  */
35
- export let options: { value: string; label: string }[] = config.options || []; // Available options
49
+ export let options: RadioGroupInputControllerProps['options'] = config.options || []; // Available options
36
50
 
37
51
  /**
38
52
  * Local state
@@ -1,4 +1,20 @@
1
1
  import type { InputControllerConfig } from './index';
2
+ /** Declared props contract — export lets below are annotated from it so the
3
+ * interface cannot drift from what the component actually reads. */
4
+ export interface RadioGroupInputControllerProps {
5
+ value: string | {
6
+ value: string;
7
+ label: string;
8
+ };
9
+ onChange: (newValue: string) => void;
10
+ config?: InputControllerConfig;
11
+ description?: string;
12
+ onFocus?: () => void;
13
+ options?: {
14
+ value: string;
15
+ label: string;
16
+ }[];
17
+ }
2
18
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
19
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
20
  $$bindings?: Bindings;
@@ -16,21 +32,15 @@ declare const RadioGroupInputController: $$__sveltets_2_IsomorphicComponent<{
16
32
  /**
17
33
  * Component Props
18
34
  * External properties that configure the radio group's behavior and appearance
19
- */ value: string | {
20
- value: string;
21
- label: string;
22
- };
23
- onChange: (newValue: string) => void;
24
- config?: InputControllerConfig;
25
- description?: string | undefined;
26
- onFocus?: () => void;
35
+ */ value: RadioGroupInputControllerProps["value"];
36
+ onChange: RadioGroupInputControllerProps["onChange"];
37
+ config?: RadioGroupInputControllerProps["config"];
38
+ description?: RadioGroupInputControllerProps["description"];
39
+ onFocus?: RadioGroupInputControllerProps["onFocus"];
27
40
  /**
28
41
  * Configuration Options
29
42
  * Derived from config prop with fallbacks
30
- */ options?: {
31
- value: string;
32
- label: string;
33
- }[];
43
+ */ options?: RadioGroupInputControllerProps["options"];
34
44
  }, {
35
45
  [evt: string]: CustomEvent<any>;
36
46
  }, {}, {}, string>;
@@ -17,6 +17,32 @@
17
17
  * - Preserves timezone consistency
18
18
  -->
19
19
 
20
+ <script module lang="ts">
21
+ import type { DateValue } from "@internationalized/date";
22
+ import type { DateRange as BitsDateRange } from "bits-ui";
23
+
24
+ // Use a more flexible local type
25
+ type DateRange = {
26
+ start?: DateValue;
27
+ end?: DateValue;
28
+ }
29
+
30
+ import type { Writable } from 'svelte/store';
31
+
32
+ /** Declared props contract — export lets below are annotated from it so the
33
+ * interface cannot drift from what the component actually reads. */
34
+ export interface RangeCalendarInputControllerProps {
35
+ label: string;
36
+ value?: BitsDateRange;
37
+ onChange: (newValue: DateRange) => void;
38
+ helpText?: string;
39
+ controllerId: string;
40
+ openDropdowns: Writable<Set<string>>;
41
+ toggleDropdown: (id: string) => void;
42
+ onFocus?: () => void;
43
+ }
44
+ </script>
45
+
20
46
  <script lang="ts">
21
47
  // Svelte imports
22
48
  import { onMount, onDestroy } from 'svelte';
@@ -29,24 +55,16 @@
29
55
 
30
56
  // Shadcn aditional: Internationalized Date
31
57
  import { CalendarDate, getLocalTimeZone } from "@internationalized/date";
32
- import type { DateValue } from "@internationalized/date";
33
- import type { DateRange as BitsDateRange } from "bits-ui";
34
-
35
- // Use a more flexible local type
36
- type DateRange = {
37
- start?: DateValue;
38
- end?: DateValue;
39
- }
40
58
 
41
59
  // Component props
42
- export let label: string;
43
- export let value: BitsDateRange | undefined;
44
- export let onChange: (newValue: DateRange) => void;
45
- export let helpText: string | undefined = undefined;
46
- export let controllerId: string;
47
- export let openDropdowns: any;
48
- export let toggleDropdown: (id: string) => void;
49
- export let onFocus: () => void = () => {};
60
+ export let label: RangeCalendarInputControllerProps['label'];
61
+ export let value: RangeCalendarInputControllerProps['value'];
62
+ export let onChange: RangeCalendarInputControllerProps['onChange'];
63
+ export let helpText: RangeCalendarInputControllerProps['helpText'] = undefined;
64
+ export let controllerId: RangeCalendarInputControllerProps['controllerId'];
65
+ export let openDropdowns: RangeCalendarInputControllerProps['openDropdowns'];
66
+ export let toggleDropdown: RangeCalendarInputControllerProps['toggleDropdown'];
67
+ export let onFocus: RangeCalendarInputControllerProps['onFocus'] = () => {};
50
68
 
51
69
  let currentValue: DateRange | undefined;
52
70
 
@@ -1,5 +1,22 @@
1
1
  import type { DateValue } from "@internationalized/date";
2
2
  import type { DateRange as BitsDateRange } from "bits-ui";
3
+ type DateRange = {
4
+ start?: DateValue;
5
+ end?: DateValue;
6
+ };
7
+ import type { Writable } from 'svelte/store';
8
+ /** Declared props contract — export lets below are annotated from it so the
9
+ * interface cannot drift from what the component actually reads. */
10
+ export interface RangeCalendarInputControllerProps {
11
+ label: string;
12
+ value?: BitsDateRange;
13
+ onChange: (newValue: DateRange) => void;
14
+ helpText?: string;
15
+ controllerId: string;
16
+ openDropdowns: Writable<Set<string>>;
17
+ toggleDropdown: (id: string) => void;
18
+ onFocus?: () => void;
19
+ }
3
20
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
4
21
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
5
22
  $$bindings?: Bindings;
@@ -14,17 +31,14 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
14
31
  z_$$bindings?: Bindings;
15
32
  }
16
33
  declare const RangeCalendarInputController: $$__sveltets_2_IsomorphicComponent<{
17
- label: string;
18
- value: BitsDateRange | undefined;
19
- onChange: (newValue: {
20
- start?: DateValue;
21
- end?: DateValue;
22
- }) => void;
23
- helpText?: string | undefined;
24
- controllerId: string;
25
- openDropdowns: any;
26
- toggleDropdown: (id: string) => void;
27
- onFocus?: () => void;
34
+ label: RangeCalendarInputControllerProps["label"];
35
+ value: RangeCalendarInputControllerProps["value"];
36
+ onChange: RangeCalendarInputControllerProps["onChange"];
37
+ helpText?: RangeCalendarInputControllerProps["helpText"];
38
+ controllerId: RangeCalendarInputControllerProps["controllerId"];
39
+ openDropdowns: RangeCalendarInputControllerProps["openDropdowns"];
40
+ toggleDropdown: RangeCalendarInputControllerProps["toggleDropdown"];
41
+ onFocus?: RangeCalendarInputControllerProps["onFocus"];
28
42
  }, {
29
43
  [evt: string]: CustomEvent<any>;
30
44
  }, {}, {}, string>;
@@ -12,6 +12,17 @@
12
12
  * - Accepts only positive integer values
13
13
  -->
14
14
 
15
+ <script module lang="ts">
16
+ /** Declared props contract — export lets below are annotated from it so the
17
+ * interface cannot drift from what the component actually reads. */
18
+ export interface RoundedCornersInputControllerProps {
19
+ value: { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number };
20
+ onChange: (newValue: { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number }) => void;
21
+ helpText?: string;
22
+ onFocus?: () => void;
23
+ }
24
+ </script>
25
+
15
26
  <script lang="ts">
16
27
  import { onMount } from 'svelte';
17
28
  import Lock from '../icons/locked.svelte';
@@ -22,13 +33,15 @@
22
33
  const MIN_RADIUS = 0;
23
34
  const MAX_RADIUS = 120;
24
35
 
25
- // Required props
26
- export let label: string;
27
- export let value: { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number };
28
- export let onChange: (newValue: { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number }) => void;
29
- export let config: InputControllerConfig = {};
30
- export let helpText: string | undefined = undefined;
31
- export let onFocus: () => void = () => {};
36
+ // Required props. `label`, `config` and `helpText` arrive through the
37
+ // dynamic-component props object but are never read here — export const
38
+ // keeps the init-set contract without the unused-reactive warning. A live
39
+ // no-op default: nothing reads these, so it can never mask a real value.
40
+ export const label: string = '';
41
+ export let value: RoundedCornersInputControllerProps['value'];
42
+ export let onChange: RoundedCornersInputControllerProps['onChange'];
43
+ export let helpText: RoundedCornersInputControllerProps['helpText'] = undefined;
44
+ export let onFocus: RoundedCornersInputControllerProps['onFocus'] = () => {};
32
45
 
33
46
  // Optional: Class prop for external styling
34
47
  let className = '';
@@ -269,7 +282,7 @@
269
282
  </script>
270
283
 
271
284
  <!-- Main corner radius grid component -->
272
- <div class="corners-container {className}"
285
+ <div class="corners-container {className}" role="group" aria-label={label || 'Corner radius'} title={helpText}
273
286
  on:mouseenter={handleMouseEnter}
274
287
  on:mouseleave={handleMouseLeave}
275
288
  on:focusin={onFocus}>
@@ -360,10 +373,10 @@
360
373
  aria-pressed={isLocked}
361
374
  >
362
375
  <div class="flex items-center justify-center w-full h-full {isLocked ? 'text-sage-green' : 'text-grey7'}">
363
- <svelte:component
364
- this={isLocked ? Lock : Unlock}
365
- class="w-5 h-5"
366
- />
376
+ <!-- Lock/Unlock are bare SVG components (no props); the old
377
+ svelte:component + class here type-checked to never and the
378
+ class never rendered. -->
379
+ {#if isLocked}<Lock />{:else}<Unlock />{/if}
367
380
  </div>
368
381
  </button>
369
382
  </div>
@@ -372,19 +385,10 @@
372
385
  <div
373
386
  class="border-overlay {isHovering ? 'hovered' : ''}"
374
387
  aria-hidden="true"
375
- />
388
+ ></div>
376
389
  </div>
377
390
 
378
391
  <style>
379
- /* Hide number input spinners */
380
- /* svelte-ignore css_unused_selector */
381
- input[type="number"]::-webkit-inner-spin-button,
382
- /* svelte-ignore css_unused_selector */
383
- input[type="number"]::-webkit-outer-spin-button {
384
- -webkit-appearance: none;
385
- margin: 0;
386
- }
387
-
388
392
  input {
389
393
  -moz-appearance: textfield;
390
394
  appearance: textfield;
@@ -1,4 +1,21 @@
1
- import type { InputControllerConfig } from './index';
1
+ /** Declared props contract — export lets below are annotated from it so the
2
+ * interface cannot drift from what the component actually reads. */
3
+ export interface RoundedCornersInputControllerProps {
4
+ value: {
5
+ topLeft: number;
6
+ topRight: number;
7
+ bottomRight: number;
8
+ bottomLeft: number;
9
+ };
10
+ onChange: (newValue: {
11
+ topLeft: number;
12
+ topRight: number;
13
+ bottomRight: number;
14
+ bottomLeft: number;
15
+ }) => void;
16
+ helpText?: string;
17
+ onFocus?: () => void;
18
+ }
2
19
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
20
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
21
  $$bindings?: Bindings;
@@ -13,25 +30,16 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
13
30
  z_$$bindings?: Bindings;
14
31
  }
15
32
  declare const RoundedCornersInputController: $$__sveltets_2_IsomorphicComponent<{
16
- label: string;
17
- value: {
18
- topLeft: number;
19
- topRight: number;
20
- bottomRight: number;
21
- bottomLeft: number;
22
- };
23
- onChange: (newValue: {
24
- topLeft: number;
25
- topRight: number;
26
- bottomRight: number;
27
- bottomLeft: number;
28
- }) => void;
29
- config?: InputControllerConfig;
30
- helpText?: string | undefined;
31
- onFocus?: () => void;
33
+ label?: string;
34
+ value: RoundedCornersInputControllerProps["value"];
35
+ onChange: RoundedCornersInputControllerProps["onChange"];
36
+ helpText?: RoundedCornersInputControllerProps["helpText"];
37
+ onFocus?: RoundedCornersInputControllerProps["onFocus"];
32
38
  class?: string;
33
39
  }, {
34
40
  [evt: string]: CustomEvent<any>;
35
- }, {}, {}, string>;
41
+ }, {}, {
42
+ label: string;
43
+ }, string>;
36
44
  type RoundedCornersInputController = InstanceType<typeof RoundedCornersInputController>;
37
45
  export default RoundedCornersInputController;