@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
@@ -1,3 +1,7 @@
1
+ <!--
2
+ * TagsInputController
3
+ *
4
+ * A component for adding and removing tags, similar to email tag inputs.
1
5
  <!--
2
6
  * TagsInputController
3
7
  *
@@ -12,143 +16,124 @@
12
16
  -->
13
17
 
14
18
  <script module lang="ts">
15
- import type { InputControllerConfig } from './index';
19
+ import type { InputControllerConfig } from './index';
16
20
 
17
21
  /** Declared props contract — export lets below are annotated from it so the
18
22
  * interface cannot drift from what the component actually reads. */
19
- export interface TagsInputControllerProps {
20
- label: string;
21
- value?: string[];
22
- onChange: (newValue: string[]) => void;
23
- config?: InputControllerConfig;
24
- helpText?: string;
25
- onFocus?: () => void;
26
- }
23
+ export interface TagsInputControllerProps {
24
+ label: string;
25
+ value?: string[];
26
+ onChange: (newValue: string[]) => void;
27
+ config?: InputControllerConfig;
28
+ helpText?: string;
29
+ onFocus?: () => void;
30
+ }
27
31
  </script>
28
32
 
29
33
  <script lang="ts">
30
- import { onMount, onDestroy } from 'svelte';
31
- import InputControllerHeader from './InputControllerHeader.svelte';
32
- import { IconX } from '@widgetic/design-system/icons';
33
- import { useEditorLanguage } from '../../i18n/language';
34
- import { dirForUserText, useTextDirection } from '@widgetic/design-system/components/textDirection';
34
+ import InputControllerRow from './InputControllerRow.svelte';
35
+ import { Tag } from '@widgetic/design-system/components';
36
+ import { useEditorLanguage } from '../../i18n/language';
37
+ import {
38
+ dirForUserText,
39
+ useTextDirection
40
+ } from '@widgetic/design-system/components/textDirection';
35
41
 
36
42
  // The words of the editor in the language of the page.
37
- const { t } = useEditorLanguage();
38
-
43
+ const { t } = useEditorLanguage();
39
44
  // The way the screen is read: a tag is what a person typed, so on a right to left screen it is read by its own first letter.
40
- const textDirection = useTextDirection();
45
+ const textDirection = useTextDirection();
41
46
 
42
47
  // Required props
43
- export let label: TagsInputControllerProps['label'];
44
- export let value: TagsInputControllerProps['value'] = [];
45
- export let onChange: TagsInputControllerProps['onChange'];
46
- export let config: TagsInputControllerProps['config'] = {};
47
- export let helpText: TagsInputControllerProps['helpText'] = undefined;
48
- export let onFocus: TagsInputControllerProps['onFocus'] = () => {};
49
-
48
+ export let label: TagsInputControllerProps['label'];
49
+ export let value: TagsInputControllerProps['value'] = [];
50
+ export let onChange: TagsInputControllerProps['onChange'];
51
+ export let config: TagsInputControllerProps['config'] = {};
52
+ export let helpText: TagsInputControllerProps['helpText'] = undefined;
53
+ export let onFocus: TagsInputControllerProps['onFocus'] = () => {};
54
+
50
55
  // Optional: Class prop for external styling
51
- let className = '';
52
- export { className as class };
56
+ let className = '';
57
+ export { className as class };
53
58
 
54
59
  // Use config values with fallbacks
55
60
  // The hint in the box: the one the widget gave, or the editor's own word in the language of the page.
56
- $: placeholder = config.placeholder || $t('editor.tags.add');
57
-
61
+ $: placeholder = config.placeholder || $t('editor.tags.add');
62
+
58
63
  // Component state
59
- let inputElement: HTMLInputElement;
60
- let tagInputContainer: HTMLDivElement;
64
+ let inputElement: HTMLInputElement;
65
+ let tagInputContainer: HTMLDivElement;
61
66
  // What is typed in the box right now. An empty box has no first letter to be read by, and reads left to right by itself
62
67
  // even on a right to left screen: so it takes the direction of the screen until something is typed (see fieldDirection.ts).
63
- let typedTag = '';
68
+ let typedTag = '';
69
+
70
+ function handleTagRemove(tagToRemove: string) {
71
+ onChange(value.filter((tag) => tag !== tagToRemove));
72
+ }
64
73
 
65
- function handleTagRemove(tagToRemove: string) {
66
- const newTags = value.filter(tag => tag !== tagToRemove);
67
- onChange(newTags);
68
- }
74
+ function handleInputKeydown(e: KeyboardEvent) {
75
+ if (e.key === ',' || e.key === 'Enter') {
76
+ e.preventDefault();
77
+ const input = e.target as HTMLInputElement;
78
+ const tagValue = input.value.trim();
69
79
 
70
- function handleInputKeydown(e: KeyboardEvent) {
71
- if (e.key === ',' || e.key === 'Enter') {
72
- e.preventDefault();
73
- const input = e.target as HTMLInputElement;
74
- const tagValue = input.value.trim();
75
-
76
- if (tagValue) {
77
- // Check if tag already exists to prevent duplicates
78
- if (!value.includes(tagValue)) {
79
- const newTags = [...value, tagValue];
80
- onChange(newTags);
81
- }
82
- input.value = '';
83
- typedTag = '';
84
- }
85
- }
86
- }
80
+ if (tagValue && !value.includes(tagValue)) {
81
+ onChange([...value, tagValue]);
82
+ }
83
+ input.value = '';
84
+ typedTag = '';
85
+ }
86
+ }
87
87
 
88
- function handleContainerClick(e: MouseEvent) {
88
+ function handleContainerClick(e: MouseEvent) {
89
89
  // If the click is not on the input itself, focus the input
90
- const target = e.target as HTMLElement;
91
- if (inputElement && target !== inputElement) {
92
- inputElement.focus();
93
- }
94
- }
90
+ const target = e.target as HTMLElement;
91
+ if (inputElement && target !== inputElement) {
92
+ inputElement.focus();
93
+ }
94
+ }
95
95
  </script>
96
96
 
97
- <div class="flex flex-col gap-2 widgetic-colors {className}">
98
- <div class="flex items-center w-full">
99
- <div class="flex-1 min-w-0">
100
- <InputControllerHeader {label} {helpText} />
101
- </div>
102
-
103
- <div class="w-[185px]">
97
+ <InputControllerRow {label} {helpText} class={className}>
98
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
99
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
100
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
104
101
  <!-- Tag container styled to match TextInputController -->
105
102
  <!-- svelte-ignore a11y_click_events_have_key_events -->
106
103
  <!-- svelte-ignore a11y_no_static_element_interactions -->
107
- <div
108
- bind:this={tagInputContainer}
109
- class="tags-container border border-grey2 rounded-large bg-grey1 focus-within:border-forest-green hover:border-forest-green flex flex-col min-h-[48px] transition-colors duration-200 cursor-text p-0"
110
- on:click={handleContainerClick}
111
- on:focusin={onFocus}
112
- >
113
- <!-- Input field with specific padding -->
114
- <div class="pt-[12px] ps-[16px] pe-[16px]">
115
- <input
116
- bind:this={inputElement}
117
- type="text"
118
- autocomplete="off"
119
- dir={typedTag ? dirForUserText($textDirection) : undefined}
120
- class="w-full outline-none border-none bg-transparent subtext text-grey7 placeholder:text-grey3 placeholder:subtext"
121
- placeholder={placeholder}
122
- on:input={(event) => (typedTag = event.currentTarget.value)}
123
- on:keydown={handleInputKeydown}
124
- />
125
- </div>
126
-
127
- <!-- Tags with specific padding -->
128
- {#if value && value.length > 0}
129
- <div class="flex flex-wrap gap-1 ps-[16px] pe-[16px] pb-[16px] pt-[8px]">
130
- {#each value as tag}
131
- <!-- svelte-ignore a11y_click_events_have_key_events -->
132
- <div
133
- class="tag-element bg-sage-green text-white border-none hover:bg-deep-forest-green cursor-pointer transition-colors flex items-center gap-1"
134
- on:click|stopPropagation={() => handleTagRemove(tag)}
135
- >
136
- <span class="tag uppercase truncate max-w-[115px]" dir={dirForUserText($textDirection)}>{tag}</span>
137
- <IconX class="w-4 h-4 text-white flex-shrink-0" />
138
- </div>
139
- {/each}
140
- </div>
141
- {/if}
142
- </div>
143
- </div>
144
- </div>
145
- </div>
104
+ <div
105
+ bind:this={tagInputContainer}
106
+ class="tags-container flex min-h-9 w-full flex-wrap items-center gap-1 rounded-lg bg-accent px-2 py-1.5 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"
107
+ on:click={handleContainerClick}
108
+ on:focusin={onFocus}
109
+ >
110
+ {#each value as tag}
111
+ <span dir={dirForUserText($textDirection)}>
112
+ <Tag
113
+ label={tag}
114
+ showRemove={true}
115
+ removeLabel={$t('editor.tags.remove')}
116
+ onRemove={() => handleTagRemove(tag)}
117
+ class="max-w-full"
118
+ />
119
+ </span>
120
+ {/each}
121
+ <input
122
+ bind:this={inputElement}
123
+ type="text"
124
+ autocomplete="off"
125
+ dir={typedTag ? dirForUserText($textDirection) : undefined}
126
+ class="min-w-[4rem] flex-1 border-none bg-transparent text-body text-foreground outline-none placeholder:text-muted-foreground"
127
+ {placeholder}
128
+ on:input={(event) => (typedTag = event.currentTarget.value)}
129
+ on:keydown={handleInputKeydown}
130
+ />
131
+ </div>
132
+ </InputControllerRow>
146
133
 
147
134
  <style>
148
135
  /* Allow container to expand vertically */
149
- .tags-container {
150
- width: 100%;
151
- min-height: 48px;
152
- box-sizing: border-box;
153
- }
154
- </style>
136
+ .tags-container {
137
+ box-sizing: border-box;
138
+ }
139
+ </style>