@widgetic/editor 4.1.14 → 4.1.16
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 +47 -40
- package/dist/components/editors/EditLeaseNotice.svelte +44 -33
- package/dist/components/editors/EmbedEditor.svelte +133 -259
- package/dist/components/editors/PropsEditor.svelte +418 -1338
- 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/InputControllerRow.svelte +74 -0
- package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte +84 -47
- package/dist/components/ic/KnowledgeTextForm.svelte +35 -33
- 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 +1 -0
- package/dist/components/ic/index.js +1 -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/i18n/language.d.ts +44 -281
- package/dist/i18n/messages.d.ts +41 -34
- package/dist/i18n/messages.js +47 -34
- package/dist/i18n/translate.d.ts +1 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +26 -2
- package/package.json +5 -5
|
@@ -31,10 +31,18 @@
|
|
|
31
31
|
|
|
32
32
|
<script lang="ts">
|
|
33
33
|
import { onDestroy, onMount } from 'svelte';
|
|
34
|
-
import { Button } from '@widgetic/design-system/components';
|
|
35
|
-
import {
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
import { Button, IconButton } from '@widgetic/design-system/components';
|
|
35
|
+
import {
|
|
36
|
+
IconAlertTriangle,
|
|
37
|
+
IconFileText,
|
|
38
|
+
IconLoader2,
|
|
39
|
+
IconPlus,
|
|
40
|
+
IconTrash
|
|
41
|
+
} from '@widgetic/design-system/icons';
|
|
42
|
+
import {
|
|
43
|
+
dirForUserText,
|
|
44
|
+
useTextDirection
|
|
45
|
+
} from '@widgetic/design-system/components/textDirection';
|
|
38
46
|
import KnowledgeTextForm from './KnowledgeTextForm.svelte';
|
|
39
47
|
import { useEditorLanguage } from '../../i18n/language';
|
|
40
48
|
import { useEditorKnowledgeDocuments } from '../../knowledgeDocumentsContext';
|
|
@@ -44,8 +52,10 @@
|
|
|
44
52
|
} from '../../composition/knowledgeDocumentsPanel';
|
|
45
53
|
import { KNOWLEDGE_FILE_ACCEPT } from '../../composition/knowledgeDocuments';
|
|
46
54
|
|
|
47
|
-
let {
|
|
48
|
-
|
|
55
|
+
let {
|
|
56
|
+
onFocus = () => {},
|
|
57
|
+
panel: suppliedPanel = undefined
|
|
58
|
+
}: KnowledgeDocumentsInputControllerProps = $props();
|
|
49
59
|
|
|
50
60
|
// The words of the editor in the language of the page, and the way the screen is read (a document's title is what a person
|
|
51
61
|
// typed, so on a right to left screen it is read by its own first letter).
|
|
@@ -102,7 +112,10 @@
|
|
|
102
112
|
return new Intl.NumberFormat($locale).format(value);
|
|
103
113
|
} catch (error) {
|
|
104
114
|
// A language tag the browser does not know: write the number plainly rather than show nothing.
|
|
105
|
-
console.warn(
|
|
115
|
+
console.warn(
|
|
116
|
+
'[KnowledgeDocuments] The number could not be written in the language of the page:',
|
|
117
|
+
error
|
|
118
|
+
);
|
|
106
119
|
return String(value);
|
|
107
120
|
}
|
|
108
121
|
}
|
|
@@ -179,8 +192,8 @@
|
|
|
179
192
|
-->
|
|
180
193
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
181
194
|
<div
|
|
182
|
-
class="
|
|
183
|
-
? 'outline-2 outline-dashed outline-
|
|
195
|
+
class="flex w-full flex-col gap-3 rounded-xl {draggingFilesDepth > 0
|
|
196
|
+
? 'outline-2 outline-dashed outline-brand outline-offset-4'
|
|
184
197
|
: ''}"
|
|
185
198
|
data-knowledge-documents
|
|
186
199
|
onfocusin={() => onFocus()}
|
|
@@ -190,17 +203,24 @@
|
|
|
190
203
|
ondrop={handleDrop}
|
|
191
204
|
>
|
|
192
205
|
{#if $panel.phase === 'unavailable'}
|
|
193
|
-
<p class="
|
|
206
|
+
<p class="text-body text-muted-foreground">{$t('editor.knowledge.unavailable')}</p>
|
|
194
207
|
{:else if $panel.phase === 'loading'}
|
|
195
|
-
<p class="
|
|
196
|
-
<
|
|
208
|
+
<p class="text-body flex items-center gap-2 text-muted-foreground" role="status">
|
|
209
|
+
<IconLoader2 class="size-4 shrink-0 animate-spin stroke-[1.333]" aria-hidden="true" />
|
|
197
210
|
<span>{$t('editor.knowledge.loading')}</span>
|
|
198
211
|
</p>
|
|
199
212
|
{:else if $panel.phase === 'failed'}
|
|
200
|
-
<div
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
213
|
+
<div
|
|
214
|
+
class="flex flex-col items-start gap-2 rounded-xl border border-destructive/30 bg-destructive/5 p-3"
|
|
215
|
+
role="alert"
|
|
216
|
+
>
|
|
217
|
+
<p class="text-body flex gap-2 text-destructive">
|
|
218
|
+
<IconAlertTriangle class="mt-0.5 size-4 shrink-0 stroke-[1.333]" aria-hidden="true" />
|
|
219
|
+
<span
|
|
220
|
+
>{$panel.loadFailure
|
|
221
|
+
? sentenceOf($panel.loadFailure)
|
|
222
|
+
: $t('editor.knowledgeError.generic')}</span
|
|
223
|
+
>
|
|
204
224
|
</p>
|
|
205
225
|
<Button variant="outline" size="sm" onclick={() => void panel.retry()}>
|
|
206
226
|
{$t('editor.knowledge.retry')}
|
|
@@ -208,19 +228,25 @@
|
|
|
208
228
|
</div>
|
|
209
229
|
{:else}
|
|
210
230
|
{#if $panel.documents.length === 0}
|
|
211
|
-
<p class="
|
|
231
|
+
<p class="text-body text-muted-foreground">{$t('editor.knowledge.empty')}</p>
|
|
212
232
|
{:else}
|
|
213
233
|
<ul class="flex flex-col gap-2" aria-label={$t('editor.knowledge.listLabel')}>
|
|
214
234
|
{#each $panel.documents as document (document.id)}
|
|
215
235
|
<li
|
|
216
|
-
class="flex min-h-
|
|
236
|
+
class="flex min-h-12 items-center gap-3 rounded-xl border border-border bg-accent py-2 ps-4 pe-2"
|
|
217
237
|
>
|
|
218
|
-
<
|
|
238
|
+
<IconFileText
|
|
239
|
+
class="size-4 shrink-0 stroke-[1.333] text-muted-foreground"
|
|
240
|
+
aria-hidden="true"
|
|
241
|
+
/>
|
|
219
242
|
<div class="min-w-0 flex-1">
|
|
220
|
-
<p
|
|
243
|
+
<p
|
|
244
|
+
class="text-body-medium truncate text-foreground"
|
|
245
|
+
dir={dirForUserText($textDirection)}
|
|
246
|
+
>
|
|
221
247
|
{document.title}
|
|
222
248
|
</p>
|
|
223
|
-
<p class="caption text-
|
|
249
|
+
<p class="text-caption text-muted-foreground">
|
|
224
250
|
{#if document.status === 'ready'}
|
|
225
251
|
{$t('editor.knowledge.characters', { count: document.charCount })}
|
|
226
252
|
{:else}
|
|
@@ -230,33 +256,35 @@
|
|
|
230
256
|
</div>
|
|
231
257
|
|
|
232
258
|
{#if $panel.removing.includes(document.id)}
|
|
233
|
-
<span class="caption px-2 text-
|
|
259
|
+
<span class="text-caption px-2 text-muted-foreground" role="status">
|
|
260
|
+
{$t('editor.knowledge.removing')}
|
|
261
|
+
</span>
|
|
234
262
|
{:else if $panel.confirmingRemoval === document.id}
|
|
235
263
|
<div class="flex shrink-0 items-center gap-1">
|
|
236
264
|
<Button
|
|
237
265
|
variant="ghost"
|
|
238
266
|
size="sm"
|
|
239
|
-
class="text-
|
|
267
|
+
class="text-destructive hover:text-destructive"
|
|
240
268
|
aria-label={$t('editor.knowledge.removeLabel', { title: document.title })}
|
|
241
269
|
onclick={() => void panel.confirmRemoval(document.id)}
|
|
242
270
|
>
|
|
243
271
|
{$t('editor.knowledge.removeConfirm')}
|
|
244
272
|
</Button>
|
|
245
|
-
<Button variant="ghost" size="sm"
|
|
273
|
+
<Button variant="ghost" size="sm" onclick={() => panel.cancelRemoval()}>
|
|
246
274
|
{$t('editor.knowledge.keep')}
|
|
247
275
|
</Button>
|
|
248
276
|
</div>
|
|
249
277
|
{:else}
|
|
250
|
-
<
|
|
278
|
+
<IconButton
|
|
251
279
|
variant="ghost"
|
|
252
|
-
size="
|
|
253
|
-
class="
|
|
254
|
-
|
|
280
|
+
size="sm"
|
|
281
|
+
class="shrink-0 text-muted-foreground hover:text-destructive"
|
|
282
|
+
label={$t('editor.knowledge.removeLabel', { title: document.title })}
|
|
255
283
|
disabled={isBusy}
|
|
256
284
|
onclick={() => panel.askToRemove(document.id)}
|
|
257
285
|
>
|
|
258
|
-
<
|
|
259
|
-
</
|
|
286
|
+
<IconTrash class="size-4 stroke-[1.333]" aria-hidden="true" />
|
|
287
|
+
</IconButton>
|
|
260
288
|
{/if}
|
|
261
289
|
</li>
|
|
262
290
|
{/each}
|
|
@@ -264,8 +292,8 @@
|
|
|
264
292
|
{/if}
|
|
265
293
|
|
|
266
294
|
{#if $panel.sending}
|
|
267
|
-
<p class="
|
|
268
|
-
<
|
|
295
|
+
<p class="text-body flex items-center gap-2 text-foreground" role="status">
|
|
296
|
+
<IconLoader2 class="size-4 shrink-0 animate-spin stroke-[1.333]" aria-hidden="true" />
|
|
269
297
|
<span class="truncate" dir={dirForUserText($textDirection)}>
|
|
270
298
|
{#if $panel.sending.count > 1}
|
|
271
299
|
{$t('editor.knowledge.sendingOf', {
|
|
@@ -284,48 +312,53 @@
|
|
|
284
312
|
{#if $panel.notices.length > 0}
|
|
285
313
|
<div
|
|
286
314
|
bind:this={noticesElement}
|
|
287
|
-
class="flex flex-col gap-
|
|
315
|
+
class="flex flex-col gap-2 rounded-xl border border-destructive/30 bg-destructive/5 px-3 py-2"
|
|
288
316
|
role="alert"
|
|
289
317
|
>
|
|
290
318
|
{#each $panel.notices as notice (notice.id)}
|
|
291
|
-
<p class="
|
|
292
|
-
<
|
|
319
|
+
<p class="text-body flex gap-2 text-destructive">
|
|
320
|
+
<IconAlertTriangle class="mt-0.5 size-4 shrink-0 stroke-[1.333]" aria-hidden="true" />
|
|
293
321
|
<span>{sentenceOf(notice.message)}</span>
|
|
294
322
|
</p>
|
|
295
323
|
{/each}
|
|
296
|
-
<Button variant="ghost" size="sm" class="self-end
|
|
324
|
+
<Button variant="ghost" size="sm" class="self-end" onclick={() => panel.dismissNotices()}>
|
|
297
325
|
{$t('editor.knowledge.dismiss')}
|
|
298
326
|
</Button>
|
|
299
327
|
</div>
|
|
300
328
|
{/if}
|
|
301
329
|
|
|
302
330
|
{#if isFull}
|
|
303
|
-
<p class="
|
|
331
|
+
<p class="text-body text-muted-foreground">{$t('editor.knowledgeError.limitDocuments')}</p>
|
|
304
332
|
{/if}
|
|
305
333
|
|
|
306
334
|
<div class="flex flex-col gap-2">
|
|
307
335
|
<div class="flex items-center gap-2">
|
|
308
336
|
<Button
|
|
309
|
-
variant="
|
|
310
|
-
class="group h-
|
|
337
|
+
variant="outline"
|
|
338
|
+
class="group h-9 min-w-0 flex-1 gap-2 press-feedback"
|
|
311
339
|
disabled={!canAdd}
|
|
312
340
|
onclick={openFileChooser}
|
|
313
341
|
>
|
|
314
|
-
<
|
|
315
|
-
|
|
342
|
+
<IconPlus
|
|
343
|
+
class="size-4 shrink-0 stroke-[1.333] text-muted-foreground"
|
|
344
|
+
aria-hidden="true"
|
|
345
|
+
/>
|
|
346
|
+
<span class="text-body-medium truncate text-foreground group-hover:underline">
|
|
347
|
+
{$t('editor.knowledge.addFiles')}
|
|
348
|
+
</span>
|
|
316
349
|
</Button>
|
|
317
350
|
<Button
|
|
318
351
|
bind:ref={pasteButton}
|
|
319
|
-
variant="
|
|
320
|
-
class="h-
|
|
352
|
+
variant="outline"
|
|
353
|
+
class="h-9 shrink-0 press-feedback"
|
|
321
354
|
disabled={!canAdd}
|
|
322
355
|
aria-expanded={pasteFormOpen}
|
|
323
356
|
onclick={openPasteForm}
|
|
324
357
|
>
|
|
325
|
-
<span class="body-medium text-
|
|
358
|
+
<span class="text-body-medium text-foreground">{$t('editor.knowledge.addText')}</span>
|
|
326
359
|
</Button>
|
|
327
360
|
</div>
|
|
328
|
-
<p class="caption text-
|
|
361
|
+
<p class="text-caption text-muted-foreground">{$t('editor.knowledge.dropHint')}</p>
|
|
329
362
|
</div>
|
|
330
363
|
|
|
331
364
|
<!-- Hidden: the "Add files" button opens it, and the keyboard reaches that button. -->
|
|
@@ -341,11 +374,15 @@
|
|
|
341
374
|
/>
|
|
342
375
|
|
|
343
376
|
{#if pasteFormOpen}
|
|
344
|
-
<KnowledgeTextForm
|
|
377
|
+
<KnowledgeTextForm
|
|
378
|
+
busy={isBusy}
|
|
379
|
+
onAdd={(input) => panel.addText(input)}
|
|
380
|
+
onClose={closePasteForm}
|
|
381
|
+
/>
|
|
345
382
|
{/if}
|
|
346
383
|
|
|
347
384
|
{#if $panel.totals && $panel.totals.maxDocuments !== null && $panel.totals.maxTotalChars !== null}
|
|
348
|
-
<p class="caption flex flex-wrap gap-x-4 text-
|
|
385
|
+
<p class="text-caption flex flex-wrap gap-x-4 text-muted-foreground">
|
|
349
386
|
<span>
|
|
350
387
|
{$t('editor.knowledge.documentsUsed', {
|
|
351
388
|
documents: formatNumber($panel.totals.documents),
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
<script lang="ts">
|
|
25
25
|
import { onMount } from 'svelte';
|
|
26
26
|
import { Button, Input, Textarea } from '@widgetic/design-system/components';
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
dirForUserText,
|
|
29
|
+
useTextDirection
|
|
30
|
+
} from '@widgetic/design-system/components/textDirection';
|
|
28
31
|
import { useEditorLanguage } from '../../i18n/language';
|
|
29
32
|
import { KNOWLEDGE_TITLE_MAX_LENGTH } from '../../composition/knowledgeDocuments';
|
|
30
33
|
|
|
@@ -65,39 +68,38 @@
|
|
|
65
68
|
}
|
|
66
69
|
</script>
|
|
67
70
|
|
|
68
|
-
<form
|
|
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
|
-
</div>
|
|
71
|
+
<form
|
|
72
|
+
class="flex flex-col gap-3 rounded-xl border border-border bg-accent p-3"
|
|
73
|
+
onsubmit={handleSubmit}
|
|
74
|
+
>
|
|
75
|
+
<label class="text-label-small text-muted-foreground" for={titleFieldId}>
|
|
76
|
+
{$t('editor.knowledge.titleLabel')}
|
|
77
|
+
</label>
|
|
78
|
+
<Input
|
|
79
|
+
id={titleFieldId}
|
|
80
|
+
bind:ref={titleField}
|
|
81
|
+
bind:value={title}
|
|
82
|
+
maxlength={KNOWLEDGE_TITLE_MAX_LENGTH}
|
|
83
|
+
autocomplete="off"
|
|
84
|
+
placeholder={$t('editor.knowledge.titlePlaceholder')}
|
|
85
|
+
dir={title ? dirForUserText($textDirection) : undefined}
|
|
86
|
+
disabled={busy}
|
|
87
|
+
class="h-9"
|
|
88
|
+
/>
|
|
89
|
+
<label class="text-label-small text-muted-foreground" for={textFieldId}>
|
|
90
|
+
{$t('editor.knowledge.textLabel')}
|
|
91
|
+
</label>
|
|
92
|
+
<Textarea
|
|
93
|
+
id={textFieldId}
|
|
94
|
+
bind:value={text}
|
|
95
|
+
rows={6}
|
|
96
|
+
placeholder={$t('editor.knowledge.textPlaceholder')}
|
|
97
|
+
dir={text ? dirForUserText($textDirection) : undefined}
|
|
98
|
+
disabled={busy}
|
|
99
|
+
class="min-h-[9rem] resize-y"
|
|
100
|
+
/>
|
|
99
101
|
<div class="flex justify-end gap-2">
|
|
100
|
-
<Button type="button" variant="ghost" size="sm"
|
|
102
|
+
<Button type="button" variant="ghost" size="sm" onclick={onClose}>
|
|
101
103
|
{$t('editor.knowledge.cancel')}
|
|
102
104
|
</Button>
|
|
103
105
|
<Button type="submit" size="sm" disabled={!canAdd}>
|