@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.
- package/dist/components/PreviewChromeControls.svelte +15 -21
- package/dist/components/WidgetPreview.svelte +136 -105
- package/dist/components/color-select/ColorSelect.svelte +203 -224
- package/dist/components/color-select/constants.d.ts +4 -2
- package/dist/components/color-select/constants.js +4 -2
- package/dist/components/color-select/render.js +10 -9
- package/dist/components/editors/CompositionEditorApp.svelte +55 -40
- package/dist/components/editors/EditLeaseNotice.svelte +44 -33
- package/dist/components/editors/EmbedEditor.svelte +133 -259
- package/dist/components/editors/PropsEditor.svelte +426 -1333
- package/dist/components/editors/props-editor.css +5 -68
- package/dist/components/ic/AngleInputController.svelte +202 -277
- package/dist/components/ic/BrowserInputController.svelte +813 -803
- package/dist/components/ic/CheckboxInputController.svelte +92 -169
- package/dist/components/ic/CheckboxInputController.svelte.d.ts +2 -8
- package/dist/components/ic/ColorPickerInputController.svelte +1589 -1587
- package/dist/components/ic/ColorPickerInputController.svelte.d.ts +3 -3
- package/dist/components/ic/DateFieldInputController.svelte +455 -465
- package/dist/components/ic/DatePickerInputController.svelte +355 -368
- package/dist/components/ic/DatePickerInputController.svelte.d.ts +1 -1
- package/dist/components/ic/DropdownInputController.svelte +130 -200
- package/dist/components/ic/FixedPositionInputController.svelte +255 -276
- package/dist/components/ic/FixedPositionInputController.svelte.d.ts +5 -1
- package/dist/components/ic/FontInputController.svelte +2110 -2231
- package/dist/components/ic/FontInputController.svelte.d.ts +11 -11
- package/dist/components/ic/InputControllerHeader.svelte +141 -147
- package/dist/components/ic/InputControllerRenderer.svelte +5 -1
- package/dist/components/ic/InputControllerRenderer.svelte.d.ts +2 -1
- package/dist/components/ic/InputControllerRow.svelte +74 -0
- package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte +401 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte.d.ts +11 -0
- package/dist/components/ic/KnowledgeTextForm.svelte +109 -0
- package/dist/components/ic/KnowledgeTextForm.svelte.d.ts +15 -0
- package/dist/components/ic/NumberControls.svelte +303 -269
- package/dist/components/ic/NumberControls.svelte.d.ts +4 -1
- package/dist/components/ic/NumberInputController.svelte +361 -301
- package/dist/components/ic/NumberInputController.svelte.d.ts +2 -0
- package/dist/components/ic/PositionInputController.svelte +253 -176
- package/dist/components/ic/PositionInputController.svelte.d.ts +2 -0
- package/dist/components/ic/RadioGroupInputController.svelte +71 -137
- package/dist/components/ic/RadioGroupInputController.svelte.d.ts +2 -8
- package/dist/components/ic/RangeCalendarInputController.svelte +233 -270
- package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +2 -2
- package/dist/components/ic/RoundedCornersInputController.svelte +412 -435
- package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +2 -0
- package/dist/components/ic/SliderInputController.svelte +263 -332
- package/dist/components/ic/SliderInputController.svelte.d.ts +1 -1
- package/dist/components/ic/SliderRangeInputController.svelte +140 -144
- package/dist/components/ic/SliderRangeInputController.svelte.d.ts +3 -3
- package/dist/components/ic/SwitchInputController.svelte +47 -109
- package/dist/components/ic/TagsInputController.svelte +95 -110
- package/dist/components/ic/TextAreaInputController.svelte +1794 -1935
- package/dist/components/ic/TextAreaPreviewInputController.svelte +436 -438
- package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +2 -2
- package/dist/components/ic/TextInputController.svelte +65 -75
- package/dist/components/ic/TextInputController.svelte.d.ts +2 -0
- package/dist/components/ic/TimeInputController.svelte +433 -431
- package/dist/components/ic/VectorInputController.svelte +1833 -1831
- package/dist/components/ic/VectorInputController.svelte.d.ts +10 -10
- package/dist/components/ic/index.d.ts +2 -0
- package/dist/components/ic/index.js +2 -0
- package/dist/components/ic/shared/CategoryTabs.svelte +28 -35
- package/dist/components/ic/shared/ItemGrid.svelte +145 -179
- package/dist/components/ic/shared/RecentItemsSection.svelte +208 -271
- package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +1 -1
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte +23 -38
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte.d.ts +1 -4
- package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte +45 -0
- package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte.d.ts +26 -0
- package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte +20 -12
- package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte +39 -0
- package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte.d.ts +10 -0
- package/dist/composition/compositionApi.d.ts +21 -1
- package/dist/composition/compositionApi.js +64 -5
- package/dist/composition/knowledgeDocuments.d.ts +90 -0
- package/dist/composition/knowledgeDocuments.js +94 -0
- package/dist/composition/knowledgeDocumentsPanel.d.ts +152 -0
- package/dist/composition/knowledgeDocumentsPanel.js +443 -0
- package/dist/i18n/language.d.ts +86 -36
- package/dist/i18n/messages.d.ts +97 -34
- package/dist/i18n/messages.js +104 -34
- package/dist/i18n/translate.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/knowledgeDocumentsContext.d.ts +10 -0
- package/dist/knowledgeDocumentsContext.js +31 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +26 -2
- package/package.json +4 -4
|
@@ -1,447 +1,445 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 TextAreaPreviewInputControllerProps {
|
|
7
|
+
label?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
onChange: (newValue: string) => void;
|
|
10
|
+
config?: InputControllerConfig;
|
|
11
|
+
description?: string;
|
|
12
|
+
portalTarget?: string | HTMLElement;
|
|
13
|
+
}
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<script lang="ts">
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
17
|
+
import { Portal } from '@widgetic/design-system/components';
|
|
18
|
+
import { IconArrowsDiagonal } from '@widgetic/design-system/icons';
|
|
19
|
+
import {
|
|
20
|
+
dirForUserText,
|
|
21
|
+
useTextDirection
|
|
22
|
+
} from '@widgetic/design-system/components/textDirection';
|
|
23
|
+
import { onMount, onDestroy } from 'svelte';
|
|
24
|
+
|
|
25
|
+
import { TextAreaInputController } from './index';
|
|
26
|
+
import { createPreviewHtml } from '../../utils/richTextPreview';
|
|
27
|
+
import { escapeHtml } from '../../utils/htmlSafety';
|
|
28
|
+
|
|
29
|
+
// The way the screen is read: the text in the preview is what a person wrote, so on a right to left screen it is read by its own first letter.
|
|
30
|
+
const textDirection = useTextDirection();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Component props
|
|
34
|
+
*/
|
|
35
|
+
export let label: TextAreaPreviewInputControllerProps['label'] = '';
|
|
36
|
+
export let value: TextAreaPreviewInputControllerProps['value'] = '';
|
|
37
|
+
export let onChange: TextAreaPreviewInputControllerProps['onChange'];
|
|
38
|
+
export let config: TextAreaPreviewInputControllerProps['config'] = {};
|
|
39
|
+
export let description: TextAreaPreviewInputControllerProps['description'] = undefined;
|
|
40
|
+
export let portalTarget: TextAreaPreviewInputControllerProps['portalTarget'] = '';
|
|
41
|
+
/**
|
|
42
|
+
* Local Variables
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
// Use config values with fallbacks
|
|
46
|
+
const placeholder: string = config.placeholder || '';
|
|
47
|
+
|
|
48
|
+
let isShowingTextArea = false;
|
|
49
|
+
|
|
50
|
+
// Add a computed property to determine if we're showing placeholder
|
|
51
|
+
$: isShowingPlaceholder = !value && placeholder;
|
|
52
|
+
|
|
53
|
+
// Create a preview version of the text that preserves formatting
|
|
54
|
+
$: previewText = value ? createPreviewText(value) : escapeHtml(placeholder);
|
|
55
|
+
|
|
56
|
+
// Add this to track the current color
|
|
57
|
+
let currentColor = '#1a1a1a'; // Default color
|
|
58
|
+
|
|
59
|
+
// Add this near the top with other state declarations
|
|
60
|
+
let isPortalHovered = false;
|
|
61
|
+
|
|
62
|
+
// Add this to store the background rect ref
|
|
63
|
+
let backgroundRectRef: HTMLDivElement;
|
|
64
|
+
|
|
65
|
+
// The box the text editor is shown in. The editor is found through it: a search of the whole `document` finds nothing
|
|
66
|
+
// inside a module's shadow root, and finds the customer's own text editor (and focuses it) when the page has one.
|
|
67
|
+
let portalContentRef: HTMLDivElement | undefined;
|
|
68
|
+
|
|
69
|
+
// Add these near the top with other state declarations
|
|
70
|
+
let isClosing = false;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Methods
|
|
74
|
+
*/
|
|
75
|
+
function createPreviewText(text: string) {
|
|
76
|
+
// The text is rich text somebody typed or pasted, and this editor can run inside a customer's page: the preview is
|
|
77
|
+
// not a copy of that HTML. It is built by a renderer that escapes every text and keeps only the tags and styles on
|
|
78
|
+
// its lists (see richTextPreview.ts). Block wrappers (p, div, br) are flattened there, so marks render inside the
|
|
79
|
+
// compact clamp box.
|
|
80
|
+
try {
|
|
81
|
+
return createPreviewHtml(text);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error('[TextAreaPreview] Could not build the preview of the text:', error);
|
|
84
|
+
return escapeHtml(text);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function handleFullEditorChange(html: string) {
|
|
89
|
+
value = html;
|
|
90
|
+
if (typeof onChange === 'function') onChange(html);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function handleClick() {
|
|
94
|
+
// console.log('Opening text area in portal');
|
|
95
|
+
isShowingTextArea = !isShowingTextArea;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
$: if (isShowingTextArea) {
|
|
99
|
+
setTimeout(() => {
|
|
100
|
+
const editor = portalContentRef?.querySelector('.ProseMirror');
|
|
101
|
+
if (editor instanceof HTMLElement) {
|
|
102
|
+
editor.focus();
|
|
103
|
+
}
|
|
104
|
+
}, 100); // Give a bit more time for the portal to mount
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Update value reactively to track color changes
|
|
108
|
+
$: {
|
|
109
|
+
if (value) {
|
|
110
|
+
const colorMatch = value.match(/color:\s*(#[0-9A-Fa-f]{6}|rgb\([^)]+\))/);
|
|
111
|
+
if (colorMatch) {
|
|
112
|
+
currentColor = colorMatch[1];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
$: if (value) {
|
|
118
|
+
// console.log('[TextAreaPreview] compact preview html', value.slice(0, 180));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function handlePortalMouseEnter() {
|
|
122
|
+
// console.log('Portal mouse entered');
|
|
123
|
+
isPortalHovered = true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function handlePortalMouseLeave(event: MouseEvent) {
|
|
127
|
+
// if (!backgroundRectRef) return;
|
|
128
|
+
// console.log('Portal mouse leave: ', event, backgroundRectRef.getBoundingClientRect());
|
|
129
|
+
|
|
130
|
+
// Get mouse position relative to the portal content
|
|
131
|
+
const { offsetX, offsetY } = event;
|
|
132
|
+
const offsetWidth = backgroundRectRef.getBoundingClientRect().width;
|
|
133
|
+
const offsetHeight = backgroundRectRef.getBoundingClientRect().height;
|
|
134
|
+
// console.log('Portal mouse leave mousePosition: ', offsetX, offsetY, offsetWidth, offsetHeight);
|
|
135
|
+
|
|
136
|
+
// Check if cursor is within the background rect boundaries
|
|
137
|
+
if (0 < offsetX && offsetX < offsetWidth && 0 < offsetY && offsetY < offsetHeight) {
|
|
138
|
+
// console.log('Portal mouse leave mousePosition: ', offsetX, offsetY, offsetWidth, offsetHeight);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// console.log('Portal mouse leave mousePosition: ', offsetX, offsetY, offsetWidth, offsetHeight);
|
|
143
|
+
isPortalHovered = false;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Add keyboard event handler for Escape key
|
|
147
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
148
|
+
if (event.key === 'Escape' && isShowingTextArea) {
|
|
149
|
+
handleClose();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
onMount(() => {
|
|
154
|
+
// Add keyboard event listener when component mounts
|
|
155
|
+
window.addEventListener('keydown', handleKeydown);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
onDestroy(() => {
|
|
159
|
+
// Remove keyboard event listener when component is destroyed
|
|
160
|
+
window.removeEventListener('keydown', handleKeydown);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// Update the close handler
|
|
164
|
+
function handleClose() {
|
|
165
|
+
if (isClosing) return; // Prevent multiple closes
|
|
166
|
+
isClosing = true;
|
|
167
|
+
|
|
168
|
+
// Add animation end handler
|
|
169
|
+
const content = portalContentRef;
|
|
170
|
+
const overlay = content?.previousElementSibling as HTMLDivElement;
|
|
171
|
+
|
|
172
|
+
const handleAnimationEnd = () => {
|
|
173
|
+
if (content) content.dataset.state = 'complete';
|
|
174
|
+
if (overlay) overlay.dataset.state = 'complete';
|
|
175
|
+
|
|
176
|
+
// Remove the elements after a short delay
|
|
177
|
+
setTimeout(() => {
|
|
178
|
+
isShowingTextArea = false;
|
|
179
|
+
isClosing = false;
|
|
180
|
+
if (content) content.dataset.state = '';
|
|
181
|
+
if (overlay) overlay.dataset.state = '';
|
|
182
|
+
}, 50);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// Listen for the end of the scale animation
|
|
186
|
+
content?.addEventListener('animationend', handleAnimationEnd, { once: true });
|
|
187
|
+
}
|
|
188
188
|
</script>
|
|
189
189
|
|
|
190
|
-
<div class="text-area-preview-input-controller w-full min-w-0 overflow-hidden
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
190
|
+
<div class="text-area-preview-input-controller w-full min-w-0 overflow-hidden">
|
|
191
|
+
<div class="text-area-preview-main-container w-full min-w-0 overflow-hidden">
|
|
192
|
+
<div
|
|
193
|
+
class="textarea-ic-preview-box group relative h-[92px] w-full min-w-0 cursor-pointer overflow-hidden rounded-lg bg-accent p-2 pb-3 pe-10 ps-3 transition-colors duration-fast hover:bg-accent-hover focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
194
|
+
on:click={handleClick}
|
|
195
|
+
on:keydown={(e) => e.key === 'Enter' && handleClick()}
|
|
196
|
+
role="button"
|
|
197
|
+
tabindex="0"
|
|
198
|
+
>
|
|
199
|
+
<div class="textarea-ic-preview-copy min-w-0 overflow-hidden">
|
|
200
|
+
<div
|
|
201
|
+
class="textarea-ic-preview-html text-body break-words text-foreground"
|
|
202
|
+
class:text-muted-foreground={isShowingPlaceholder}
|
|
203
|
+
dir={dirForUserText($textDirection)}
|
|
204
|
+
>
|
|
205
|
+
{@html previewText}
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
<div
|
|
209
|
+
class="textarea-ic-expand-icon absolute end-2 top-2 flex size-6 items-center justify-center rounded-lg"
|
|
210
|
+
aria-hidden="true"
|
|
211
|
+
>
|
|
212
|
+
<IconArrowsDiagonal
|
|
213
|
+
class="size-4 stroke-[1.333] text-muted-foreground transition-colors duration-fast group-hover:text-foreground"
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
<!-- Description -->
|
|
220
|
+
{#if description}
|
|
221
|
+
<p class="text-caption text-muted-foreground mt-2">{description}</p>
|
|
222
|
+
{/if}
|
|
223
|
+
|
|
224
|
+
<!-- Text Area Input Controller in Portal -->
|
|
225
|
+
{#if isShowingTextArea}
|
|
226
|
+
<Portal target={portalTarget} class="text-area-portal absolute top-0 start-0 w-full h-full">
|
|
227
|
+
<!-- Blocking overlay -->
|
|
228
|
+
<div
|
|
229
|
+
class="absolute inset-0 bg-background {isClosing
|
|
230
|
+
? 'fade-out-animation'
|
|
231
|
+
: 'fade-in-animation'}"
|
|
232
|
+
style="z-index: 50; transform: translateZ(0); backface-visibility: hidden;"
|
|
233
|
+
></div>
|
|
234
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
235
|
+
<div
|
|
236
|
+
bind:this={portalContentRef}
|
|
237
|
+
class="text-area-portal-content absolute mt-4 mx-6 mb-6 inset-0 {isClosing
|
|
238
|
+
? 'scale-out-animation'
|
|
239
|
+
: 'scale-in-animation'}"
|
|
240
|
+
style="z-index: 51; transform: translateZ(0); backface-visibility: hidden;"
|
|
241
|
+
on:mouseenter={handlePortalMouseEnter}
|
|
242
|
+
on:mouseleave={handlePortalMouseLeave}
|
|
243
|
+
>
|
|
244
|
+
<!-- Background rect that defines our hover boundaries -->
|
|
245
|
+
<!-- Add portal border radius -->
|
|
246
|
+
<div
|
|
247
|
+
bind:this={backgroundRectRef}
|
|
248
|
+
class="portal-background-rect absolute inset-0 bg-transparent pointer-events-none"
|
|
249
|
+
style="border-radius: var(--radius-lg);"
|
|
250
|
+
></div>
|
|
251
|
+
|
|
252
|
+
<TextAreaInputController
|
|
253
|
+
class="text-area w-full h-full transition-colors duration-fast {isPortalHovered
|
|
254
|
+
? 'ring-2 ring-ring ring-offset-2 ring-offset-background'
|
|
255
|
+
: ''}"
|
|
256
|
+
{label}
|
|
257
|
+
bind:value
|
|
258
|
+
onChange={handleFullEditorChange}
|
|
259
|
+
{config}
|
|
260
|
+
{description}
|
|
261
|
+
onClose={handleClose}
|
|
262
|
+
/>
|
|
263
|
+
</div>
|
|
264
|
+
</Portal>
|
|
265
|
+
{/if}
|
|
263
266
|
</div>
|
|
264
267
|
|
|
265
268
|
<style>
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
:global(.scale-out-animation[data-state="complete"]),
|
|
444
|
-
:global(.fade-out-animation[data-state="complete"]) {
|
|
445
|
-
visibility: hidden;
|
|
446
|
-
}
|
|
447
|
-
</style>
|
|
269
|
+
/* Keep only preview-specific styles */
|
|
270
|
+
:global(.text-area-preview-main-container .group) {
|
|
271
|
+
position: relative;
|
|
272
|
+
isolation: isolate;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* Heading styles matching tiptap editor */
|
|
276
|
+
:global(.textarea-ic-preview-html h1.tiptap-heading) {
|
|
277
|
+
font-size: 2em !important;
|
|
278
|
+
font-weight: 600 !important;
|
|
279
|
+
line-height: 1.2 !important;
|
|
280
|
+
margin-top: 0 !important;
|
|
281
|
+
margin-bottom: 0 !important;
|
|
282
|
+
color: inherit !important;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
:global(.textarea-ic-preview-html h2.tiptap-heading) {
|
|
286
|
+
font-size: 1.5em !important;
|
|
287
|
+
font-weight: 600 !important;
|
|
288
|
+
line-height: 1.3 !important;
|
|
289
|
+
margin-top: 0.4em !important;
|
|
290
|
+
margin-bottom: 0.2em !important;
|
|
291
|
+
color: inherit !important;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
:global(.textarea-ic-preview-html h3.tiptap-heading) {
|
|
295
|
+
font-size: 1.17em !important;
|
|
296
|
+
font-weight: 600 !important;
|
|
297
|
+
line-height: 1.3 !important;
|
|
298
|
+
margin-top: 0.3em !important;
|
|
299
|
+
margin-bottom: 0.2em !important;
|
|
300
|
+
color: inherit !important;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
:global(.textarea-ic-preview-html h4.tiptap-heading) {
|
|
304
|
+
font-size: 1em !important;
|
|
305
|
+
font-weight: 600 !important;
|
|
306
|
+
line-height: 1.4 !important;
|
|
307
|
+
margin-top: 0.2em !important;
|
|
308
|
+
margin-bottom: 0.1em !important;
|
|
309
|
+
color: inherit !important;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
:global(.textarea-ic-preview-html) {
|
|
313
|
+
display: -webkit-box;
|
|
314
|
+
-webkit-box-orient: vertical;
|
|
315
|
+
-webkit-line-clamp: 3;
|
|
316
|
+
line-clamp: 3;
|
|
317
|
+
overflow: hidden;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/* Color preservation */
|
|
321
|
+
:global(.textarea-ic-preview-html [style*='color']) {
|
|
322
|
+
color: var(--color) !important;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/* Text formatting — {@html} children need :global; include b/i as well as strong/em/u */
|
|
326
|
+
:global(.textarea-ic-preview-html :is(strong, b, [style*='font-weight'])) {
|
|
327
|
+
font-weight: 700 !important;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
:global(.textarea-ic-preview-html :is(em, i)) {
|
|
331
|
+
font-style: italic !important;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
:global(.textarea-ic-preview-html :is(u, [style*='text-decoration: underline'])) {
|
|
335
|
+
text-decoration: underline !important;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
:global(.textarea-ic-preview-html strong[style*='color']),
|
|
339
|
+
:global(.textarea-ic-preview-html em[style*='color']),
|
|
340
|
+
:global(.textarea-ic-preview-html u[style*='color']) {
|
|
341
|
+
color: var(--color) !important;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* Add specific color inheritance for data-text-style */
|
|
345
|
+
:global(.textarea-ic-preview-html [data-text-style*='color']) {
|
|
346
|
+
color: var(--color) !important;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/* Ensure all text elements can inherit colors */
|
|
350
|
+
:global(.textarea-ic-preview-html *) {
|
|
351
|
+
color: inherit;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/* Ensure paragraphs have no margins */
|
|
355
|
+
:global(.textarea-ic-preview-html p) {
|
|
356
|
+
margin-top: 0 !important;
|
|
357
|
+
margin-bottom: 0 !important;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/* Ensure line-clamp ellipsis inherits color */
|
|
361
|
+
:global(.line-clamp-3) {
|
|
362
|
+
-webkit-box-orient: vertical;
|
|
363
|
+
-webkit-line-clamp: 3;
|
|
364
|
+
line-clamp: 3;
|
|
365
|
+
display: -webkit-box;
|
|
366
|
+
overflow: hidden;
|
|
367
|
+
color: inherit;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/* Add scale animation */
|
|
371
|
+
@keyframes scaleIn {
|
|
372
|
+
from {
|
|
373
|
+
transform: scale(0.95) translateZ(0);
|
|
374
|
+
opacity: 0;
|
|
375
|
+
}
|
|
376
|
+
to {
|
|
377
|
+
transform: scale(1) translateZ(0);
|
|
378
|
+
opacity: 1;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
@keyframes fadeIn {
|
|
383
|
+
from {
|
|
384
|
+
opacity: 0;
|
|
385
|
+
}
|
|
386
|
+
to {
|
|
387
|
+
opacity: 1;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
:global(.scale-in-animation) {
|
|
392
|
+
animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
393
|
+
transform-origin: center center;
|
|
394
|
+
will-change: transform, opacity;
|
|
395
|
+
backface-visibility: hidden;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
:global(.fade-in-animation) {
|
|
399
|
+
animation: fadeIn 0.15s ease-out;
|
|
400
|
+
will-change: opacity;
|
|
401
|
+
backface-visibility: hidden;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/* Add scale out animation */
|
|
405
|
+
@keyframes scaleOut {
|
|
406
|
+
0% {
|
|
407
|
+
transform: scale(1) translateZ(0);
|
|
408
|
+
opacity: 1;
|
|
409
|
+
}
|
|
410
|
+
100% {
|
|
411
|
+
transform: scale(0.95) translateZ(0);
|
|
412
|
+
opacity: 0;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
@keyframes fadeOut {
|
|
417
|
+
0% {
|
|
418
|
+
opacity: 1;
|
|
419
|
+
}
|
|
420
|
+
100% {
|
|
421
|
+
opacity: 0;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
:global(.scale-out-animation) {
|
|
426
|
+
animation: scaleOut 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
427
|
+
transform-origin: center center;
|
|
428
|
+
will-change: transform, opacity;
|
|
429
|
+
backface-visibility: hidden;
|
|
430
|
+
pointer-events: none;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
:global(.fade-out-animation) {
|
|
434
|
+
animation: fadeOut 0.15s ease-out forwards;
|
|
435
|
+
will-change: opacity;
|
|
436
|
+
backface-visibility: hidden;
|
|
437
|
+
pointer-events: none;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/* Add a class to handle visibility at animation end */
|
|
441
|
+
:global(.scale-out-animation[data-state='complete']),
|
|
442
|
+
:global(.fade-out-animation[data-state='complete']) {
|
|
443
|
+
visibility: hidden;
|
|
444
|
+
}
|
|
445
|
+
</style>
|