@widgetic/editor 4.1.13 → 4.1.15

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 (89) hide show
  1. package/dist/components/PreviewChromeControls.svelte +15 -21
  2. package/dist/components/WidgetPreview.svelte +136 -105
  3. package/dist/components/color-select/ColorSelect.svelte +203 -224
  4. package/dist/components/color-select/constants.d.ts +4 -2
  5. package/dist/components/color-select/constants.js +4 -2
  6. package/dist/components/color-select/render.js +10 -9
  7. package/dist/components/editors/CompositionEditorApp.svelte +55 -40
  8. package/dist/components/editors/EditLeaseNotice.svelte +44 -33
  9. package/dist/components/editors/EmbedEditor.svelte +133 -259
  10. package/dist/components/editors/PropsEditor.svelte +426 -1333
  11. package/dist/components/editors/props-editor.css +5 -68
  12. package/dist/components/ic/AngleInputController.svelte +202 -277
  13. package/dist/components/ic/BrowserInputController.svelte +813 -803
  14. package/dist/components/ic/CheckboxInputController.svelte +92 -169
  15. package/dist/components/ic/CheckboxInputController.svelte.d.ts +2 -8
  16. package/dist/components/ic/ColorPickerInputController.svelte +1589 -1587
  17. package/dist/components/ic/ColorPickerInputController.svelte.d.ts +3 -3
  18. package/dist/components/ic/DateFieldInputController.svelte +455 -465
  19. package/dist/components/ic/DatePickerInputController.svelte +355 -368
  20. package/dist/components/ic/DatePickerInputController.svelte.d.ts +1 -1
  21. package/dist/components/ic/DropdownInputController.svelte +130 -200
  22. package/dist/components/ic/FixedPositionInputController.svelte +255 -276
  23. package/dist/components/ic/FixedPositionInputController.svelte.d.ts +5 -1
  24. package/dist/components/ic/FontInputController.svelte +2110 -2231
  25. package/dist/components/ic/FontInputController.svelte.d.ts +11 -11
  26. package/dist/components/ic/InputControllerHeader.svelte +141 -147
  27. package/dist/components/ic/InputControllerRenderer.svelte +5 -1
  28. package/dist/components/ic/InputControllerRenderer.svelte.d.ts +2 -1
  29. package/dist/components/ic/InputControllerRow.svelte +74 -0
  30. package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
  31. package/dist/components/ic/KnowledgeDocumentsInputController.svelte +401 -0
  32. package/dist/components/ic/KnowledgeDocumentsInputController.svelte.d.ts +11 -0
  33. package/dist/components/ic/KnowledgeTextForm.svelte +109 -0
  34. package/dist/components/ic/KnowledgeTextForm.svelte.d.ts +15 -0
  35. package/dist/components/ic/NumberControls.svelte +303 -269
  36. package/dist/components/ic/NumberControls.svelte.d.ts +4 -1
  37. package/dist/components/ic/NumberInputController.svelte +361 -301
  38. package/dist/components/ic/NumberInputController.svelte.d.ts +2 -0
  39. package/dist/components/ic/PositionInputController.svelte +253 -176
  40. package/dist/components/ic/PositionInputController.svelte.d.ts +2 -0
  41. package/dist/components/ic/RadioGroupInputController.svelte +71 -137
  42. package/dist/components/ic/RadioGroupInputController.svelte.d.ts +2 -8
  43. package/dist/components/ic/RangeCalendarInputController.svelte +233 -270
  44. package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +2 -2
  45. package/dist/components/ic/RoundedCornersInputController.svelte +412 -435
  46. package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +2 -0
  47. package/dist/components/ic/SliderInputController.svelte +263 -332
  48. package/dist/components/ic/SliderInputController.svelte.d.ts +1 -1
  49. package/dist/components/ic/SliderRangeInputController.svelte +140 -144
  50. package/dist/components/ic/SliderRangeInputController.svelte.d.ts +3 -3
  51. package/dist/components/ic/SwitchInputController.svelte +47 -109
  52. package/dist/components/ic/TagsInputController.svelte +95 -110
  53. package/dist/components/ic/TextAreaInputController.svelte +1794 -1935
  54. package/dist/components/ic/TextAreaPreviewInputController.svelte +436 -438
  55. package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +2 -2
  56. package/dist/components/ic/TextInputController.svelte +65 -75
  57. package/dist/components/ic/TextInputController.svelte.d.ts +2 -0
  58. package/dist/components/ic/TimeInputController.svelte +433 -431
  59. package/dist/components/ic/VectorInputController.svelte +1833 -1831
  60. package/dist/components/ic/VectorInputController.svelte.d.ts +10 -10
  61. package/dist/components/ic/index.d.ts +2 -0
  62. package/dist/components/ic/index.js +2 -0
  63. package/dist/components/ic/shared/CategoryTabs.svelte +28 -35
  64. package/dist/components/ic/shared/ItemGrid.svelte +145 -179
  65. package/dist/components/ic/shared/RecentItemsSection.svelte +208 -271
  66. package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +1 -1
  67. package/dist/components/ui/arrows/OpacitySliderArrows.svelte +23 -38
  68. package/dist/components/ui/arrows/OpacitySliderArrows.svelte.d.ts +1 -4
  69. package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte +45 -0
  70. package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte.d.ts +26 -0
  71. package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte +20 -12
  72. package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte +39 -0
  73. package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte.d.ts +10 -0
  74. package/dist/composition/compositionApi.d.ts +21 -1
  75. package/dist/composition/compositionApi.js +64 -5
  76. package/dist/composition/knowledgeDocuments.d.ts +90 -0
  77. package/dist/composition/knowledgeDocuments.js +94 -0
  78. package/dist/composition/knowledgeDocumentsPanel.d.ts +152 -0
  79. package/dist/composition/knowledgeDocumentsPanel.js +443 -0
  80. package/dist/i18n/language.d.ts +86 -36
  81. package/dist/i18n/messages.d.ts +97 -34
  82. package/dist/i18n/messages.js +104 -34
  83. package/dist/i18n/translate.d.ts +1 -1
  84. package/dist/index.d.ts +1 -0
  85. package/dist/knowledgeDocumentsContext.d.ts +10 -0
  86. package/dist/knowledgeDocumentsContext.js +31 -0
  87. package/dist/utils.d.ts +7 -0
  88. package/dist/utils.js +26 -2
  89. package/package.json +4 -4
@@ -24,8 +24,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
24
24
  }
25
25
  declare const TextAreaPreviewInputController: $$__sveltets_2_IsomorphicComponent<{
26
26
  /**
27
- * Component props
28
- */ label?: TextAreaPreviewInputControllerProps["label"];
27
+ * Component props
28
+ */ label?: TextAreaPreviewInputControllerProps["label"];
29
29
  value?: TextAreaPreviewInputControllerProps["value"];
30
30
  onChange: TextAreaPreviewInputControllerProps["onChange"];
31
31
  config?: TextAreaPreviewInputControllerProps["config"];
@@ -1,101 +1,91 @@
1
1
  <script module lang="ts">
2
+ /** Declared props contract — export lets below are annotated from it so the
3
+ * interface cannot drift from what the component actually reads. */
2
4
  /** Declared props contract — export lets below are annotated from it so the
3
5
  * interface cannot drift from what the component actually reads. */
4
- export interface TextInputControllerProps {
5
- label: string;
6
- value: string;
7
- onChange: (newValue: string) => void;
8
- config?: InputControllerConfig;
9
- type?: 'text' | 'email' | 'url';
10
- placeholder?: string;
11
- description?: string;
12
- onFocus?: () => void;
13
- }
6
+ export interface TextInputControllerProps {
7
+ label: string;
8
+ value: string;
9
+ onChange: (newValue: string) => void;
10
+ config?: InputControllerConfig;
11
+ type?: 'text' | 'email' | 'url';
12
+ placeholder?: string;
13
+ description?: string;
14
+ onFocus?: () => void;
15
+ }
14
16
  </script>
15
17
 
16
18
  <script lang="ts">
17
19
  // Import Shadcn UI components from Widgetic design-system package
18
- import { Input } from '@widgetic/design-system/components';
19
- import { useTextDirection } from '@widgetic/design-system/components/textDirection';
20
- import { directionOfFieldValue } from '../../utils/fieldDirection';
21
- import { InputControllerHeader } from './index';
20
+ import { Input } from '@widgetic/design-system/components';
21
+ import { useTextDirection } from '@widgetic/design-system/components/textDirection';
22
+ import { directionOfFieldValue } from '../../utils/fieldDirection';
23
+ import InputControllerRow from './InputControllerRow.svelte';
22
24
 
23
25
  // Component props
24
- import type { InputControllerConfig } from './index';
26
+ import type { InputControllerConfig } from './index';
25
27
 
26
28
  /**
27
29
  * Component props
28
30
  */
29
- export let label: TextInputControllerProps['label'];
30
- export let value: TextInputControllerProps['value'];
31
- export let onChange: TextInputControllerProps['onChange'];
32
- export let config: TextInputControllerProps['config'] = {};
33
-
31
+ export let label: TextInputControllerProps['label'];
32
+ export let value: TextInputControllerProps['value'];
33
+ export let onChange: TextInputControllerProps['onChange'];
34
+ export let config: TextInputControllerProps['config'] = {};
35
+
34
36
  // Use config values with fallbacks
35
- export let type: TextInputControllerProps['type'] = 'text';
36
- export let placeholder: TextInputControllerProps['placeholder'] = config.placeholder || '';
37
- export let description: TextInputControllerProps['description'] = undefined;
38
- export let onFocus: TextInputControllerProps['onFocus'] = () => {};
37
+ export let type: TextInputControllerProps['type'] = 'text';
38
+ export let placeholder: TextInputControllerProps['placeholder'] = config.placeholder || '';
39
+ export let description: TextInputControllerProps['description'] = undefined;
40
+ export let onFocus: TextInputControllerProps['onFocus'] = () => {};
39
41
 
40
42
  // The way the screen is read. What a visitor types reads by its own first letter on a right to left screen; an address
41
43
  // (an email, a link) is read left to right on every screen. A left to right screen is written no attribute, as it always was.
42
44
  // (The `type` is the name of the kind of field in the schema, `textInput` for a plain text field: see fieldDirection.ts.)
43
- const textDirection = useTextDirection();
45
+ const textDirection = useTextDirection();
44
46
  // What is in the field right now: the value the page gave it, then what is typed (only an empty field has no first letter).
45
- let typedText = '';
46
- $: typedText = value ?? '';
47
- $: hasTypedValue = typedText.length > 0;
48
- let valueDirection: 'auto' | 'ltr' | undefined;
47
+ let typedText = '';
48
+ $: typedText = value ?? '';
49
+ $: hasTypedValue = typedText.length > 0;
50
+ let valueDirection: 'auto' | 'ltr' | undefined;
49
51
  // (An empty field takes the direction of the screen, so that its hint and its caret start at the start of the line.)
50
- $: valueDirection = directionOfFieldValue(type, $textDirection, hasTypedValue);
52
+ $: valueDirection = directionOfFieldValue(type, $textDirection, hasTypedValue);
51
53
 
52
54
  /**
53
55
  * Methods
54
56
  */
55
- function validate(value: string): boolean {
56
- switch (type) {
57
- case 'email':
58
- return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
59
- case 'url':
60
- return /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/.test(value);
61
- default:
62
- return true;
63
- }
64
- }
57
+ function validate(value: string): boolean {
58
+ switch (type) {
59
+ case 'email':
60
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
61
+ case 'url':
62
+ return /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/.test(value);
63
+ default:
64
+ return true;
65
+ }
66
+ }
65
67
  </script>
66
68
 
67
- <div class="flex flex-col gap-2 widgetic-colors">
68
- <div class="flex items-center w-full relative">
69
- <div class="flex-1 min-w-0">
70
- <InputControllerHeader {label} />
71
- </div>
72
-
73
- <div class="absolute end-0">
74
- <div
75
- class="h-[48px] w-[185px] rounded-large border border-grey2 flex items-center bg-grey1 transition-colors duration-200 hover:border-forest-green"
76
- on:focusin={onFocus}
77
- >
78
- <Input
79
- id="text-input"
80
- {type}
81
- {value}
82
- {placeholder}
83
- dir={valueDirection}
84
- onfocus={onFocus}
85
- oninput={(e) => {
86
- const newValue = e.currentTarget.value;
87
- typedText = newValue;
88
- if (validate(newValue)) {
89
- onChange(newValue);
90
- }
91
- }}
92
- class="h-full w-full border-none bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 subtext text-grey7 placeholder:text-grey3 placeholder:subtext px-4"
93
- />
94
- </div>
95
- </div>
96
- </div>
97
-
98
- {#if description}
99
- <p class="subtext text-grey5">{description}</p>
100
- {/if}
101
- </div>
69
+ <InputControllerRow {label} {description}>
70
+ <div
71
+ class="flex h-9 w-full items-center rounded-lg bg-accent px-3 transition-colors duration-fast hover:bg-accent-hover focus-within:outline-hidden focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background"
72
+ onfocusin={onFocus}
73
+ >
74
+ <Input
75
+ id="text-input"
76
+ {type}
77
+ {value}
78
+ {placeholder}
79
+ dir={valueDirection}
80
+ onfocus={onFocus}
81
+ oninput={(e) => {
82
+ const newValue = e.currentTarget.value;
83
+ typedText = newValue;
84
+ if (validate(newValue)) {
85
+ onChange(newValue);
86
+ }
87
+ }}
88
+ class="h-full w-full border-0 bg-transparent px-0 text-body text-foreground shadow-none placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0"
89
+ />
90
+ </div>
91
+ </InputControllerRow>
@@ -1,3 +1,5 @@
1
+ /** Declared props contract — export lets below are annotated from it so the
2
+ * interface cannot drift from what the component actually reads. */
1
3
  /** Declared props contract — export lets below are annotated from it so the
2
4
  * interface cannot drift from what the component actually reads. */
3
5
  export interface TextInputControllerProps {