@widgetic/editor 4.1.18 → 4.1.20
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/WidgetPreview.svelte +77 -14
- package/dist/components/editors/CompositionEditorApp.svelte +71 -35
- package/dist/components/editors/CompositionEditorApp.svelte.d.ts +3 -1
- package/dist/components/editors/ContentTabBulkDrop.svelte +268 -0
- package/dist/components/editors/ContentTabBulkDrop.svelte.d.ts +37 -0
- package/dist/components/editors/EmbedAssistantPanel.svelte +303 -0
- package/dist/components/editors/EmbedAssistantPanel.svelte.d.ts +29 -0
- package/dist/components/editors/EmbedEditor.svelte +221 -15
- package/dist/components/editors/EmbedEditor.svelte.d.ts +31 -3
- package/dist/components/editors/PropsEditor.svelte +223 -30
- package/dist/components/editors/PropsEditor.svelte.d.ts +11 -0
- package/dist/components/editors/propsEditorContentStateFlatten.d.ts +12 -0
- package/dist/components/editors/propsEditorContentStateFlatten.js +40 -0
- package/dist/components/ic/BrowserInputController.svelte +184 -21
- package/dist/components/ic/BrowserInputController.svelte.d.ts +2 -0
- package/dist/components/ic/CheckboxInputController.svelte +11 -0
- package/dist/components/ic/ColorPickerInputController.svelte +2 -1
- package/dist/components/ic/DatePickerInputController.svelte +5 -3
- package/dist/components/ic/FontInputController.svelte +9 -4
- package/dist/components/ic/InputControllerHeader.svelte +4 -3
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte +13 -0
- package/dist/components/ic/NumberControls.svelte +140 -17
- package/dist/components/ic/RadioGroupInputController.svelte +11 -0
- package/dist/components/ic/RangeCalendarInputController.svelte +38 -13
- package/dist/components/ic/TextAreaInputController.svelte +593 -321
- package/dist/components/ic/TextAreaPreviewInputController.svelte +46 -58
- package/dist/components/ic/VectorInputController.svelte +0 -1
- package/dist/components/ic/numberControlsValueArea.d.ts +29 -0
- package/dist/components/ic/numberControlsValueArea.js +51 -0
- package/dist/components/ic/optionGroupCardPointerDown.d.ts +9 -0
- package/dist/components/ic/optionGroupCardPointerDown.js +20 -0
- package/dist/components/ic/shared/EditorFileBrowserOverlay.svelte +48 -6
- package/dist/components/ic/shared/EditorFileBrowserOverlay.svelte.d.ts +4 -1
- package/dist/components/ic/shared/EditorSelectedFilePreviewOverlay.svelte +34 -0
- package/dist/components/ic/shared/EditorSelectedFilePreviewOverlay.svelte.d.ts +24 -0
- package/dist/components/ic/shared/fileBrowserOverlayEscape.d.ts +29 -0
- package/dist/components/ic/shared/fileBrowserOverlayEscape.js +21 -0
- package/dist/composition/compositionApi.d.ts +16 -0
- package/dist/composition/compositionApi.js +16 -1
- package/dist/composition/compositionEditorController.d.ts +46 -0
- package/dist/composition/compositionEditorController.js +277 -5
- package/dist/composition/compositionEditorSchemaCache.d.ts +35 -0
- package/dist/composition/compositionEditorSchemaCache.js +82 -0
- package/dist/contentBulkDrop/applyContentPlan.d.ts +18 -0
- package/dist/contentBulkDrop/applyContentPlan.js +55 -0
- package/dist/contentBulkDrop/bulkDropSummary.d.ts +4 -0
- package/dist/contentBulkDrop/bulkDropSummary.js +12 -0
- package/dist/contentBulkDrop/dragIntent.d.ts +7 -0
- package/dist/contentBulkDrop/dragIntent.js +24 -0
- package/dist/contentBulkDrop/filterDropFiles.d.ts +2 -0
- package/dist/contentBulkDrop/filterDropFiles.js +21 -0
- package/dist/contentBulkDrop/formatFileSize.d.ts +2 -0
- package/dist/contentBulkDrop/formatFileSize.js +13 -0
- package/dist/contentBulkDrop/types.d.ts +34 -0
- package/dist/contentBulkDrop/types.js +1 -0
- package/dist/contentBulkDrop/uploadQueue.d.ts +41 -0
- package/dist/contentBulkDrop/uploadQueue.js +114 -0
- package/dist/drafts/compositionDraft.d.ts +65 -0
- package/dist/drafts/compositionDraft.js +136 -0
- package/dist/drafts/compositionEditorViewState.d.ts +9 -0
- package/dist/drafts/compositionEditorViewState.js +33 -0
- package/dist/drafts/draftJournal.d.ts +59 -0
- package/dist/drafts/draftJournal.js +261 -0
- package/dist/embed/__fixtures__/gatewayGeneratedEmbedCodes.json +25 -0
- package/dist/embed/__fixtures__/generatedEmbedCodes.json +320 -0
- package/dist/embed/embedSchema.json +409 -0
- package/dist/embed/parseCompositionEmbedCode.d.ts +21 -0
- package/dist/embed/parseCompositionEmbedCode.js +379 -0
- package/dist/embedAssistant/embedAssistantEvents.d.ts +22 -0
- package/dist/embedAssistant/embedAssistantEvents.js +39 -0
- package/dist/embedAssistant/embedAssistantStream.d.ts +30 -0
- package/dist/embedAssistant/embedAssistantStream.js +125 -0
- package/dist/embedAssistant/highlightTiming.d.ts +1 -0
- package/dist/embedAssistant/highlightTiming.js +6 -0
- package/dist/embedAssistant/types.d.ts +27 -0
- package/dist/embedAssistant/types.js +1 -0
- package/dist/i18n/labels.js +8 -4
- package/dist/i18n/language.d.ts +38 -2
- package/dist/i18n/messages.d.ts +38 -1
- package/dist/i18n/messages.js +40 -1
- package/dist/i18n/translate.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/utils/FontManager.d.ts +2 -0
- package/dist/utils/FontManager.js +16 -1
- package/dist/utils/isEditableEventTarget.d.ts +5 -0
- package/dist/utils/isEditableEventTarget.js +25 -0
- package/dist/utils/linkUrlValidation.d.ts +17 -0
- package/dist/utils/linkUrlValidation.js +120 -0
- package/dist/utils/mediaFileValue.d.ts +12 -0
- package/dist/utils/mediaFileValue.js +24 -0
- package/dist/utils/placeRichTextCaretAtDocumentEnd.d.ts +11 -0
- package/dist/utils/placeRichTextCaretAtDocumentEnd.js +26 -0
- package/package.json +7 -7
package/dist/i18n/language.d.ts
CHANGED
|
@@ -65,6 +65,15 @@ export declare const EDITOR_CATALOGS: {
|
|
|
65
65
|
readonly 'editor.props.noProperties': "No properties available";
|
|
66
66
|
readonly 'editor.props.addItem': "Add new";
|
|
67
67
|
readonly 'editor.props.deleteItem': "Delete item";
|
|
68
|
+
readonly 'editor.contentBulkDrop.idleHint': "You can also drop files here.";
|
|
69
|
+
readonly 'editor.contentBulkDrop.dragOver': "Drop files to add them";
|
|
70
|
+
readonly 'editor.contentBulkDrop.summaryAddedOnly': "{added} added";
|
|
71
|
+
readonly 'editor.contentBulkDrop.summaryWithLibraryOnly': "{added} added, {libraryOnly} only in your library";
|
|
72
|
+
readonly 'editor.contentBulkDrop.uploadFailures': "{n} could not be uploaded";
|
|
73
|
+
readonly 'editor.contentBulkDrop.dismiss': "Dismiss";
|
|
74
|
+
readonly 'editor.contentBulkDrop.uploadFailed': "Upload failed";
|
|
75
|
+
readonly 'editor.contentBulkDrop.tooLarge': "Too large";
|
|
76
|
+
readonly 'editor.contentBulkDrop.uploadingHeader': "Uploading {n} files";
|
|
68
77
|
readonly 'editor.embed.title': "Edit options";
|
|
69
78
|
readonly 'editor.embed.loading': "Loading…";
|
|
70
79
|
readonly 'editor.embed.noCode': "No embed code available";
|
|
@@ -75,6 +84,29 @@ export declare const EDITOR_CATALOGS: {
|
|
|
75
84
|
readonly 'editor.embed.copiedHint': "Paste it anywhere on your site.";
|
|
76
85
|
readonly 'editor.embed.copyFailed': "Copy failed";
|
|
77
86
|
readonly 'editor.embed.copyFailedHint': "Please try manual selection";
|
|
87
|
+
readonly 'editor.embed.pasteButton': "Paste embed code";
|
|
88
|
+
readonly 'editor.embed.pasteAreaAria': "Embed code paste area";
|
|
89
|
+
readonly 'editor.embed.pasteInvalid': "That is not a Widgetic embed code.";
|
|
90
|
+
readonly 'editor.embed.pasteApplied': "Settings applied. This composition keeps its own embed code.";
|
|
91
|
+
readonly 'editor.embed.pasteNotApplied': " Not applied: {labels}.";
|
|
92
|
+
readonly 'editor.embed.pasteClipboardBlocked': "Press Cmd+V while the box is selected.";
|
|
93
|
+
readonly 'editor.embed.widgetDefaultsBanner': "Started from your last settings for this widget";
|
|
94
|
+
readonly 'editor.embed.widgetDefaultsReset': "Reset";
|
|
95
|
+
readonly 'editor.embedAssistant.tabLabel': "Assistant";
|
|
96
|
+
readonly 'editor.embedAssistant.title': "Embed assistant";
|
|
97
|
+
readonly 'editor.embedAssistant.welcome': "Tell me how this widget should appear on your site.";
|
|
98
|
+
readonly 'editor.embedAssistant.chipOverlayExitIntent': "Overlay on exit intent";
|
|
99
|
+
readonly 'editor.embedAssistant.chipCenteredFiveTimes': "Centered, show 5 times";
|
|
100
|
+
readonly 'editor.embedAssistant.chipHideOnMobile': "Hide on mobile";
|
|
101
|
+
readonly 'editor.embedAssistant.composerPlaceholder': "Describe how it should appear";
|
|
102
|
+
readonly 'editor.embedAssistant.newChat': "New chat";
|
|
103
|
+
readonly 'editor.embedAssistant.collapse': "Collapse";
|
|
104
|
+
readonly 'editor.embedAssistant.working': "Working…";
|
|
105
|
+
readonly 'editor.embedAssistant.continue': "Continue";
|
|
106
|
+
readonly 'editor.embedAssistant.send': "Send";
|
|
107
|
+
readonly 'editor.embedAssistant.copyEmbedCode': "Copy embed code";
|
|
108
|
+
readonly 'editor.embedAssistant.errorGeneric': "The assistant could not respond. Try again.";
|
|
109
|
+
readonly 'editor.embedAssistant.errorRateLimit': "Too many messages. Try again shortly.";
|
|
78
110
|
readonly 'editor.preview.title': "Preview";
|
|
79
111
|
readonly 'editor.preview.dragHandle': "Drag preview";
|
|
80
112
|
readonly 'editor.preview.desktop': "Desktop preview";
|
|
@@ -269,7 +301,12 @@ export declare const EDITOR_CATALOGS: {
|
|
|
269
301
|
readonly 'editor.textArea.checkList': "Check list";
|
|
270
302
|
readonly 'editor.textArea.textStyles': "Text styles";
|
|
271
303
|
readonly 'editor.textArea.listStyles': "List styles";
|
|
272
|
-
readonly 'editor.textArea.
|
|
304
|
+
readonly 'editor.textArea.linkUrlLabel': "Link URL";
|
|
305
|
+
readonly 'editor.textArea.linkUrlPlaceholder': "https://example.com";
|
|
306
|
+
readonly 'editor.textArea.linkUrlApply': "Apply link";
|
|
307
|
+
readonly 'editor.textArea.linkUrlRemove': "Remove link";
|
|
308
|
+
readonly 'editor.textArea.linkUrlEmpty': "Enter a link URL";
|
|
309
|
+
readonly 'editor.textArea.linkUrlInvalid': "Enter a full web address, like example.com, with a domain name that includes a dot";
|
|
273
310
|
readonly 'editor.position.readout': "x: {x}%, y: {y}%";
|
|
274
311
|
readonly 'editor.stepper.decrease': "Decrease value";
|
|
275
312
|
readonly 'editor.stepper.increase': "Increase value";
|
|
@@ -484,7 +521,6 @@ export declare const EDITOR_CATALOGS: {
|
|
|
484
521
|
readonly 'selectedFiles.count': "{count, plural, one {# file selected} other {# files selected}}";
|
|
485
522
|
readonly 'selectedFiles.confirmMany': "{count, plural, one {Use # file} other {Use # files}}";
|
|
486
523
|
readonly 'selectedFiles.remove': "Remove from selection";
|
|
487
|
-
readonly 'searchModal.placeholder': "Search files and folders\u2026";
|
|
488
524
|
readonly 'searchModal.jumpToFolder': "Jump to folder";
|
|
489
525
|
readonly 'searchModal.empty': "No files found";
|
|
490
526
|
readonly 'searchModal.clearQuery': "Clear search";
|
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -106,6 +106,15 @@ export declare const EDITOR_MESSAGES: {
|
|
|
106
106
|
readonly 'editor.props.noProperties': "No properties available";
|
|
107
107
|
readonly 'editor.props.addItem': "Add new";
|
|
108
108
|
readonly 'editor.props.deleteItem': "Delete item";
|
|
109
|
+
readonly 'editor.contentBulkDrop.idleHint': "You can also drop files here.";
|
|
110
|
+
readonly 'editor.contentBulkDrop.dragOver': "Drop files to add them";
|
|
111
|
+
readonly 'editor.contentBulkDrop.summaryAddedOnly': "{added} added";
|
|
112
|
+
readonly 'editor.contentBulkDrop.summaryWithLibraryOnly': "{added} added, {libraryOnly} only in your library";
|
|
113
|
+
readonly 'editor.contentBulkDrop.uploadFailures': "{n} could not be uploaded";
|
|
114
|
+
readonly 'editor.contentBulkDrop.dismiss': "Dismiss";
|
|
115
|
+
readonly 'editor.contentBulkDrop.uploadFailed': "Upload failed";
|
|
116
|
+
readonly 'editor.contentBulkDrop.tooLarge': "Too large";
|
|
117
|
+
readonly 'editor.contentBulkDrop.uploadingHeader': "Uploading {n} files";
|
|
109
118
|
readonly 'editor.embed.title': "Edit options";
|
|
110
119
|
readonly 'editor.embed.loading': "Loading…";
|
|
111
120
|
readonly 'editor.embed.noCode': "No embed code available";
|
|
@@ -117,6 +126,29 @@ export declare const EDITOR_MESSAGES: {
|
|
|
117
126
|
readonly 'editor.embed.copiedHint': "Paste it anywhere on your site.";
|
|
118
127
|
readonly 'editor.embed.copyFailed': "Copy failed";
|
|
119
128
|
readonly 'editor.embed.copyFailedHint': "Please try manual selection";
|
|
129
|
+
readonly 'editor.embed.pasteButton': "Paste embed code";
|
|
130
|
+
readonly 'editor.embed.pasteAreaAria': "Embed code paste area";
|
|
131
|
+
readonly 'editor.embed.pasteInvalid': "That is not a Widgetic embed code.";
|
|
132
|
+
readonly 'editor.embed.pasteApplied': "Settings applied. This composition keeps its own embed code.";
|
|
133
|
+
readonly 'editor.embed.pasteNotApplied': " Not applied: {labels}.";
|
|
134
|
+
readonly 'editor.embed.pasteClipboardBlocked': "Press Cmd+V while the box is selected.";
|
|
135
|
+
readonly 'editor.embed.widgetDefaultsBanner': "Started from your last settings for this widget";
|
|
136
|
+
readonly 'editor.embed.widgetDefaultsReset': "Reset";
|
|
137
|
+
readonly 'editor.embedAssistant.tabLabel': "Assistant";
|
|
138
|
+
readonly 'editor.embedAssistant.title': "Embed assistant";
|
|
139
|
+
readonly 'editor.embedAssistant.welcome': "Tell me how this widget should appear on your site.";
|
|
140
|
+
readonly 'editor.embedAssistant.chipOverlayExitIntent': "Overlay on exit intent";
|
|
141
|
+
readonly 'editor.embedAssistant.chipCenteredFiveTimes': "Centered, show 5 times";
|
|
142
|
+
readonly 'editor.embedAssistant.chipHideOnMobile': "Hide on mobile";
|
|
143
|
+
readonly 'editor.embedAssistant.composerPlaceholder': "Describe how it should appear";
|
|
144
|
+
readonly 'editor.embedAssistant.newChat': "New chat";
|
|
145
|
+
readonly 'editor.embedAssistant.collapse': "Collapse";
|
|
146
|
+
readonly 'editor.embedAssistant.working': "Working…";
|
|
147
|
+
readonly 'editor.embedAssistant.continue': "Continue";
|
|
148
|
+
readonly 'editor.embedAssistant.send': "Send";
|
|
149
|
+
readonly 'editor.embedAssistant.copyEmbedCode': "Copy embed code";
|
|
150
|
+
readonly 'editor.embedAssistant.errorGeneric': "The assistant could not respond. Try again.";
|
|
151
|
+
readonly 'editor.embedAssistant.errorRateLimit': "Too many messages. Try again shortly.";
|
|
120
152
|
readonly 'editor.preview.title': "Preview";
|
|
121
153
|
readonly 'editor.preview.dragHandle': "Drag preview";
|
|
122
154
|
readonly 'editor.preview.desktop': "Desktop preview";
|
|
@@ -343,7 +375,12 @@ export declare const EDITOR_MESSAGES: {
|
|
|
343
375
|
/** The name a screen reader gives the list of list styles (bullets, numbers, checks) when its menu is open. */
|
|
344
376
|
readonly 'editor.textArea.listStyles': "List styles";
|
|
345
377
|
/** The question the browser asks when a link is added. */
|
|
346
|
-
readonly 'editor.textArea.
|
|
378
|
+
readonly 'editor.textArea.linkUrlLabel': "Link URL";
|
|
379
|
+
readonly 'editor.textArea.linkUrlPlaceholder': "https://example.com";
|
|
380
|
+
readonly 'editor.textArea.linkUrlApply': "Apply link";
|
|
381
|
+
readonly 'editor.textArea.linkUrlRemove': "Remove link";
|
|
382
|
+
readonly 'editor.textArea.linkUrlEmpty': "Enter a link URL";
|
|
383
|
+
readonly 'editor.textArea.linkUrlInvalid': "Enter a full web address, like example.com, with a domain name that includes a dot";
|
|
347
384
|
readonly 'editor.position.readout': "x: {x}%, y: {y}%";
|
|
348
385
|
readonly 'editor.stepper.decrease': "Decrease value";
|
|
349
386
|
readonly 'editor.stepper.increase': "Increase value";
|
package/dist/i18n/messages.js
CHANGED
|
@@ -111,6 +111,16 @@ export const EDITOR_MESSAGES = {
|
|
|
111
111
|
'editor.props.noProperties': 'No properties available',
|
|
112
112
|
'editor.props.addItem': 'Add new',
|
|
113
113
|
'editor.props.deleteItem': 'Delete item',
|
|
114
|
+
// ===== Bulk drop on the Content tab =====
|
|
115
|
+
'editor.contentBulkDrop.idleHint': 'You can also drop files here.',
|
|
116
|
+
'editor.contentBulkDrop.dragOver': 'Drop files to add them',
|
|
117
|
+
'editor.contentBulkDrop.summaryAddedOnly': '{added} added',
|
|
118
|
+
'editor.contentBulkDrop.summaryWithLibraryOnly': '{added} added, {libraryOnly} only in your library',
|
|
119
|
+
'editor.contentBulkDrop.uploadFailures': '{n} could not be uploaded',
|
|
120
|
+
'editor.contentBulkDrop.dismiss': 'Dismiss',
|
|
121
|
+
'editor.contentBulkDrop.uploadFailed': 'Upload failed',
|
|
122
|
+
'editor.contentBulkDrop.tooLarge': 'Too large',
|
|
123
|
+
'editor.contentBulkDrop.uploadingHeader': 'Uploading {n} files',
|
|
114
124
|
// ===== The embed options =====
|
|
115
125
|
'editor.embed.title': 'Edit options',
|
|
116
126
|
'editor.embed.loading': 'Loading…',
|
|
@@ -123,6 +133,30 @@ export const EDITOR_MESSAGES = {
|
|
|
123
133
|
'editor.embed.copiedHint': 'Paste it anywhere on your site.',
|
|
124
134
|
'editor.embed.copyFailed': 'Copy failed',
|
|
125
135
|
'editor.embed.copyFailedHint': 'Please try manual selection',
|
|
136
|
+
'editor.embed.pasteButton': 'Paste embed code',
|
|
137
|
+
'editor.embed.pasteAreaAria': 'Embed code paste area',
|
|
138
|
+
'editor.embed.pasteInvalid': 'That is not a Widgetic embed code.',
|
|
139
|
+
'editor.embed.pasteApplied': 'Settings applied. This composition keeps its own embed code.',
|
|
140
|
+
'editor.embed.pasteNotApplied': ' Not applied: {labels}.',
|
|
141
|
+
'editor.embed.pasteClipboardBlocked': 'Press Cmd+V while the box is selected.',
|
|
142
|
+
'editor.embed.widgetDefaultsBanner': 'Started from your last settings for this widget',
|
|
143
|
+
'editor.embed.widgetDefaultsReset': 'Reset',
|
|
144
|
+
// ===== Embed configuration assistant (side panel) =====
|
|
145
|
+
'editor.embedAssistant.tabLabel': 'Assistant',
|
|
146
|
+
'editor.embedAssistant.title': 'Embed assistant',
|
|
147
|
+
'editor.embedAssistant.welcome': 'Tell me how this widget should appear on your site.',
|
|
148
|
+
'editor.embedAssistant.chipOverlayExitIntent': 'Overlay on exit intent',
|
|
149
|
+
'editor.embedAssistant.chipCenteredFiveTimes': 'Centered, show 5 times',
|
|
150
|
+
'editor.embedAssistant.chipHideOnMobile': 'Hide on mobile',
|
|
151
|
+
'editor.embedAssistant.composerPlaceholder': 'Describe how it should appear',
|
|
152
|
+
'editor.embedAssistant.newChat': 'New chat',
|
|
153
|
+
'editor.embedAssistant.collapse': 'Collapse',
|
|
154
|
+
'editor.embedAssistant.working': 'Working…',
|
|
155
|
+
'editor.embedAssistant.continue': 'Continue',
|
|
156
|
+
'editor.embedAssistant.send': 'Send',
|
|
157
|
+
'editor.embedAssistant.copyEmbedCode': 'Copy embed code',
|
|
158
|
+
'editor.embedAssistant.errorGeneric': 'The assistant could not respond. Try again.',
|
|
159
|
+
'editor.embedAssistant.errorRateLimit': 'Too many messages. Try again shortly.',
|
|
126
160
|
// ===== The preview of the widget =====
|
|
127
161
|
'editor.preview.title': 'Preview',
|
|
128
162
|
'editor.preview.dragHandle': 'Drag preview',
|
|
@@ -360,7 +394,12 @@ export const EDITOR_MESSAGES = {
|
|
|
360
394
|
/** The name a screen reader gives the list of list styles (bullets, numbers, checks) when its menu is open. */
|
|
361
395
|
'editor.textArea.listStyles': 'List styles',
|
|
362
396
|
/** The question the browser asks when a link is added. */
|
|
363
|
-
'editor.textArea.
|
|
397
|
+
'editor.textArea.linkUrlLabel': 'Link URL',
|
|
398
|
+
'editor.textArea.linkUrlPlaceholder': 'https://example.com',
|
|
399
|
+
'editor.textArea.linkUrlApply': 'Apply link',
|
|
400
|
+
'editor.textArea.linkUrlRemove': 'Remove link',
|
|
401
|
+
'editor.textArea.linkUrlEmpty': 'Enter a link URL',
|
|
402
|
+
'editor.textArea.linkUrlInvalid': 'Enter a full web address, like example.com, with a domain name that includes a dot',
|
|
364
403
|
// ===== New words of the Figma redesign =====
|
|
365
404
|
// The position pad, the steppers and the tags
|
|
366
405
|
'editor.position.readout': 'x: {x}%, y: {y}%',
|
package/dist/i18n/translate.d.ts
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* its sentences with it until the page gives another translator). The editor's screens get their words, in the page's
|
|
4
4
|
* language, from `useEditorLanguage` (see `language.ts`).
|
|
5
5
|
*/
|
|
6
|
-
export declare const translateEnglish: import("@widgetic/design-system/i18n").Translate<"editor.app.loading" | "editor.app.tryAgain" | "editor.app.retry" | "editor.failure.widgetNotPublished" | "editor.failure.sessionEndedWhileSaving" | "editor.failure.sessionEnded" | "editor.failure.compositionNotFound" | "editor.failure.noAccess" | "editor.failure.noWidget" | "editor.failure.widgetNotFound" | "editor.failure.saveNeedsConnection" | "editor.failure.loadNeedsConnection" | "editor.failure.saveFailed" | "editor.failure.loadFailed" | "editor.failure.settingsLoadFailed" | "editor.failure.noSettings" | "editor.failure.errorCode" | "editor.conflict.title" | "editor.conflict.bodyNamed" | "editor.conflict.body" | "editor.conflict.keepMine" | "editor.conflict.keepMineHint" | "editor.conflict.loadLatest" | "editor.conflict.loadLatestHint" | "editor.conflict.working" | "editor.conflict.resolveFailed" | "editor.presence.blockedTitleNamed" | "editor.presence.blockedTitleYou" | "editor.presence.blockedTitle" | "editor.presence.blockedBody" | "editor.presence.lostTitleNamed" | "editor.presence.lostTitleYou" | "editor.presence.lostTitle" | "editor.presence.lostBody" | "editor.presence.takeOver" | "editor.presence.takeOverHint" | "editor.presence.lookOnly" | "editor.presence.lookOnlyHint" | "editor.presence.working" | "editor.presence.actionFailed" | "editor.presence.readOnlyNamed" | "editor.presence.readOnlyYou" | "editor.presence.readOnly" | "editor.presence.readOnlyFree" | "editor.presence.startEditing" | "editor.props.title" | "editor.props.designTab" | "editor.props.contentTab" | "editor.props.contentCard" | "editor.props.save" | "editor.props.saving" | "editor.props.noConfiguration" | "editor.props.noDesignSchema" | "editor.props.noSchemaData" | "editor.props.noComponents" | "editor.props.noProperties" | "editor.props.addItem" | "editor.props.deleteItem" | "editor.embed.title" | "editor.embed.loading" | "editor.embed.noCode" | "editor.embed.codeHeader" | "editor.embed.headerArea" | "editor.embed.copy" | "editor.embed.copied" | "editor.embed.copiedHint" | "editor.embed.copyFailed" | "editor.embed.copyFailedHint" | "editor.preview.title" | "editor.preview.dragHandle" | "editor.preview.desktop" | "editor.preview.mobile" | "editor.preview.widthShort" | "editor.preview.heightShort" | "editor.preview.noUrl" | "editor.preview.copyUrl" | "editor.preview.refresh" | "editor.preview.fitToPanel" | "editor.preview.mobileViewport" | "editor.preview.desktopViewport" | "editor.preview.openInNewTab" | "editor.preview.newTab" | "editor.preview.selectWidget" | "editor.preview.widgetName" | "editor.preview.notPublished" | "editor.preview.publishToPreview" | "editor.preview.frameTitle" | "editor.preview.frameTitleNamed" | "editor.preview.unavailable" | "editor.preview.loadFailedPreview" | "editor.preview.retry" | "editor.preview.retryBuild" | "editor.preview.retryPreview" | "editor.preview.fixErrors" | "editor.preview.viewErrors" | "editor.preview.runtimeError" | "editor.preview.compilationErrors" | "editor.preview.compilationErrorsDetail" | "editor.preview.noCodeYet" | "editor.preview.noPreview" | "editor.preview.building" | "editor.preview.loadingWidget" | "editor.preview.loadingPreview" | "editor.preview.checkingWidget" | "editor.preview.applyingSettings" | "editor.preview.connecting" | "editor.preview.generatingCode" | "editor.list.recentlyUsed" | "editor.list.more" | "editor.list.searchResults" | "editor.list.loadingMore" | "editor.list.deleteItem" | "editor.category.all" | "editor.category.mine" | "editor.category.sansSerif" | "editor.category.serif" | "editor.category.script" | "editor.category.other" | "editor.category.icons" | "editor.category.emojis" | "editor.category.clipart" | "editor.font.select" | "editor.font.title" | "editor.font.search" | "editor.font.list" | "editor.font.loading" | "editor.font.noneFound" | "editor.font.noneAvailable" | "editor.font.remove" | "editor.font.weight" | "editor.font.weightList" | "editor.fontWeight.withItalic" | "editor.fontWeight.italic" | "editor.fontWeight.thin" | "editor.fontWeight.extraLight" | "editor.fontWeight.light" | "editor.fontWeight.regular" | "editor.fontWeight.medium" | "editor.fontWeight.semiBold" | "editor.fontWeight.bold" | "editor.fontWeight.extraBold" | "editor.fontWeight.black" | "editor.vector.select" | "editor.vector.title" | "editor.vector.search" | "editor.vector.list" | "editor.vector.noneFound" | "editor.vector.noneAvailable" | "editor.file.useFile" | "editor.file.useImage" | "editor.file.useVideo" | "editor.file.useAudio" | "editor.file.useDocument" | "editor.file.addFile" | "editor.file.addImage" | "editor.file.addVideo" | "editor.file.addAudio" | "editor.file.addDocument" | "editor.file.play" | "editor.file.pause" | "editor.file.notFound" | "editor.file.emptyFolder" | "editor.file.clear" | "editor.file.pickFailed" | "editor.file.dialogTitle" | "editor.file.closeDialog" | "editor.color.noRecent" | "editor.color.picker" | "editor.date.pick" | "editor.date.pickRange" | "editor.date.invalid" | "editor.date.selectMonth" | "editor.date.selectYear" | "editor.date.calendarLabel" | "editor.date.rangeCalendarLabel" | "editor.date.previousMonth" | "editor.date.nextMonth" | "editor.dateField.dayHint" | "editor.dateField.monthHint" | "editor.dateField.yearHint" | "editor.dateField.dayLabel" | "editor.dateField.monthLabel" | "editor.dateField.yearLabel" | "editor.knowledge.loading" | "editor.knowledge.unavailable" | "editor.knowledge.retry" | "editor.knowledge.empty" | "editor.knowledge.listLabel" | "editor.knowledge.characters" | "editor.knowledge.processing" | "editor.knowledge.removeLabel" | "editor.knowledge.removeConfirm" | "editor.knowledge.keep" | "editor.knowledge.removing" | "editor.knowledge.sending" | "editor.knowledge.sendingOf" | "editor.knowledge.addFiles" | "editor.knowledge.dropHint" | "editor.knowledge.addText" | "editor.knowledge.documentsUsed" | "editor.knowledge.textUsed" | "editor.knowledge.titleLabel" | "editor.knowledge.titlePlaceholder" | "editor.knowledge.textLabel" | "editor.knowledge.textPlaceholder" | "editor.knowledge.addDocument" | "editor.knowledge.cancel" | "editor.knowledge.dismiss" | "editor.knowledgeError.titleRequired" | "editor.knowledgeError.titleTooLong" | "editor.knowledgeError.textRequired" | "editor.knowledgeError.textTooLong" | "editor.knowledgeError.fileRequired" | "editor.knowledgeError.fileTooLarge" | "editor.knowledgeError.fileTypeUnsupported" | "editor.knowledgeError.fileUnreadable" | "editor.knowledgeError.fileNoText" | "editor.knowledgeError.duplicate" | "editor.knowledgeError.limitDocuments" | "editor.knowledgeError.limitText" | "editor.knowledgeError.tryLater" | "editor.knowledgeError.tooManyAdds" | "editor.knowledgeError.connection" | "editor.knowledgeError.generic" | "editor.knowledgeError.moreProblems" | "editor.knowledgeError.notSent" | "editor.dropdown.select" | "editor.switch.off" | "editor.switch.on" | "editor.tags.add" | "editor.fixedPosition.set" | "editor.fixedPosition.topLeft" | "editor.fixedPosition.topCenter" | "editor.fixedPosition.topRight" | "editor.fixedPosition.centerLeft" | "editor.fixedPosition.centerCenter" | "editor.fixedPosition.centerRight" | "editor.fixedPosition.bottomLeft" | "editor.fixedPosition.bottomCenter" | "editor.fixedPosition.bottomRight" | "editor.corners.group" | "editor.corners.topLeft" | "editor.corners.topRight" | "editor.corners.bottomLeft" | "editor.corners.bottomRight" | "editor.corners.lock" | "editor.corners.unlock" | "editor.textArea.toolbar" | "editor.textArea.toggleBold" | "editor.textArea.toggleItalic" | "editor.textArea.toggleUnderline" | "editor.textArea.toggleLink" | "editor.textArea.text" | "editor.textArea.paragraph" | "editor.textArea.heading1" | "editor.textArea.heading2" | "editor.textArea.heading3" | "editor.textArea.bulletList" | "editor.textArea.numberedList" | "editor.textArea.checkList" | "editor.textArea.textStyles" | "editor.textArea.listStyles" | "editor.textArea.
|
|
6
|
+
export declare const translateEnglish: import("@widgetic/design-system/i18n").Translate<"editor.app.loading" | "editor.app.tryAgain" | "editor.app.retry" | "editor.failure.widgetNotPublished" | "editor.failure.sessionEndedWhileSaving" | "editor.failure.sessionEnded" | "editor.failure.compositionNotFound" | "editor.failure.noAccess" | "editor.failure.noWidget" | "editor.failure.widgetNotFound" | "editor.failure.saveNeedsConnection" | "editor.failure.loadNeedsConnection" | "editor.failure.saveFailed" | "editor.failure.loadFailed" | "editor.failure.settingsLoadFailed" | "editor.failure.noSettings" | "editor.failure.errorCode" | "editor.conflict.title" | "editor.conflict.bodyNamed" | "editor.conflict.body" | "editor.conflict.keepMine" | "editor.conflict.keepMineHint" | "editor.conflict.loadLatest" | "editor.conflict.loadLatestHint" | "editor.conflict.working" | "editor.conflict.resolveFailed" | "editor.presence.blockedTitleNamed" | "editor.presence.blockedTitleYou" | "editor.presence.blockedTitle" | "editor.presence.blockedBody" | "editor.presence.lostTitleNamed" | "editor.presence.lostTitleYou" | "editor.presence.lostTitle" | "editor.presence.lostBody" | "editor.presence.takeOver" | "editor.presence.takeOverHint" | "editor.presence.lookOnly" | "editor.presence.lookOnlyHint" | "editor.presence.working" | "editor.presence.actionFailed" | "editor.presence.readOnlyNamed" | "editor.presence.readOnlyYou" | "editor.presence.readOnly" | "editor.presence.readOnlyFree" | "editor.presence.startEditing" | "editor.props.title" | "editor.props.designTab" | "editor.props.contentTab" | "editor.props.contentCard" | "editor.props.save" | "editor.props.saving" | "editor.props.noConfiguration" | "editor.props.noDesignSchema" | "editor.props.noSchemaData" | "editor.props.noComponents" | "editor.props.noProperties" | "editor.props.addItem" | "editor.props.deleteItem" | "editor.contentBulkDrop.idleHint" | "editor.contentBulkDrop.dragOver" | "editor.contentBulkDrop.summaryAddedOnly" | "editor.contentBulkDrop.summaryWithLibraryOnly" | "editor.contentBulkDrop.uploadFailures" | "editor.contentBulkDrop.dismiss" | "editor.contentBulkDrop.uploadFailed" | "editor.contentBulkDrop.tooLarge" | "editor.contentBulkDrop.uploadingHeader" | "editor.embed.title" | "editor.embed.loading" | "editor.embed.noCode" | "editor.embed.codeHeader" | "editor.embed.headerArea" | "editor.embed.copy" | "editor.embed.copied" | "editor.embed.copiedHint" | "editor.embed.copyFailed" | "editor.embed.copyFailedHint" | "editor.embed.pasteButton" | "editor.embed.pasteAreaAria" | "editor.embed.pasteInvalid" | "editor.embed.pasteApplied" | "editor.embed.pasteNotApplied" | "editor.embed.pasteClipboardBlocked" | "editor.embed.widgetDefaultsBanner" | "editor.embed.widgetDefaultsReset" | "editor.embedAssistant.tabLabel" | "editor.embedAssistant.title" | "editor.embedAssistant.welcome" | "editor.embedAssistant.chipOverlayExitIntent" | "editor.embedAssistant.chipCenteredFiveTimes" | "editor.embedAssistant.chipHideOnMobile" | "editor.embedAssistant.composerPlaceholder" | "editor.embedAssistant.newChat" | "editor.embedAssistant.collapse" | "editor.embedAssistant.working" | "editor.embedAssistant.continue" | "editor.embedAssistant.send" | "editor.embedAssistant.copyEmbedCode" | "editor.embedAssistant.errorGeneric" | "editor.embedAssistant.errorRateLimit" | "editor.preview.title" | "editor.preview.dragHandle" | "editor.preview.desktop" | "editor.preview.mobile" | "editor.preview.widthShort" | "editor.preview.heightShort" | "editor.preview.noUrl" | "editor.preview.copyUrl" | "editor.preview.refresh" | "editor.preview.fitToPanel" | "editor.preview.mobileViewport" | "editor.preview.desktopViewport" | "editor.preview.openInNewTab" | "editor.preview.newTab" | "editor.preview.selectWidget" | "editor.preview.widgetName" | "editor.preview.notPublished" | "editor.preview.publishToPreview" | "editor.preview.frameTitle" | "editor.preview.frameTitleNamed" | "editor.preview.unavailable" | "editor.preview.loadFailedPreview" | "editor.preview.retry" | "editor.preview.retryBuild" | "editor.preview.retryPreview" | "editor.preview.fixErrors" | "editor.preview.viewErrors" | "editor.preview.runtimeError" | "editor.preview.compilationErrors" | "editor.preview.compilationErrorsDetail" | "editor.preview.noCodeYet" | "editor.preview.noPreview" | "editor.preview.building" | "editor.preview.loadingWidget" | "editor.preview.loadingPreview" | "editor.preview.checkingWidget" | "editor.preview.applyingSettings" | "editor.preview.connecting" | "editor.preview.generatingCode" | "editor.list.recentlyUsed" | "editor.list.more" | "editor.list.searchResults" | "editor.list.loadingMore" | "editor.list.deleteItem" | "editor.category.all" | "editor.category.mine" | "editor.category.sansSerif" | "editor.category.serif" | "editor.category.script" | "editor.category.other" | "editor.category.icons" | "editor.category.emojis" | "editor.category.clipart" | "editor.font.select" | "editor.font.title" | "editor.font.search" | "editor.font.list" | "editor.font.loading" | "editor.font.noneFound" | "editor.font.noneAvailable" | "editor.font.remove" | "editor.font.weight" | "editor.font.weightList" | "editor.fontWeight.withItalic" | "editor.fontWeight.italic" | "editor.fontWeight.thin" | "editor.fontWeight.extraLight" | "editor.fontWeight.light" | "editor.fontWeight.regular" | "editor.fontWeight.medium" | "editor.fontWeight.semiBold" | "editor.fontWeight.bold" | "editor.fontWeight.extraBold" | "editor.fontWeight.black" | "editor.vector.select" | "editor.vector.title" | "editor.vector.search" | "editor.vector.list" | "editor.vector.noneFound" | "editor.vector.noneAvailable" | "editor.file.useFile" | "editor.file.useImage" | "editor.file.useVideo" | "editor.file.useAudio" | "editor.file.useDocument" | "editor.file.addFile" | "editor.file.addImage" | "editor.file.addVideo" | "editor.file.addAudio" | "editor.file.addDocument" | "editor.file.play" | "editor.file.pause" | "editor.file.notFound" | "editor.file.emptyFolder" | "editor.file.clear" | "editor.file.pickFailed" | "editor.file.dialogTitle" | "editor.file.closeDialog" | "editor.color.noRecent" | "editor.color.picker" | "editor.date.pick" | "editor.date.pickRange" | "editor.date.invalid" | "editor.date.selectMonth" | "editor.date.selectYear" | "editor.date.calendarLabel" | "editor.date.rangeCalendarLabel" | "editor.date.previousMonth" | "editor.date.nextMonth" | "editor.dateField.dayHint" | "editor.dateField.monthHint" | "editor.dateField.yearHint" | "editor.dateField.dayLabel" | "editor.dateField.monthLabel" | "editor.dateField.yearLabel" | "editor.knowledge.loading" | "editor.knowledge.unavailable" | "editor.knowledge.retry" | "editor.knowledge.empty" | "editor.knowledge.listLabel" | "editor.knowledge.characters" | "editor.knowledge.processing" | "editor.knowledge.removeLabel" | "editor.knowledge.removeConfirm" | "editor.knowledge.keep" | "editor.knowledge.removing" | "editor.knowledge.sending" | "editor.knowledge.sendingOf" | "editor.knowledge.addFiles" | "editor.knowledge.dropHint" | "editor.knowledge.addText" | "editor.knowledge.documentsUsed" | "editor.knowledge.textUsed" | "editor.knowledge.titleLabel" | "editor.knowledge.titlePlaceholder" | "editor.knowledge.textLabel" | "editor.knowledge.textPlaceholder" | "editor.knowledge.addDocument" | "editor.knowledge.cancel" | "editor.knowledge.dismiss" | "editor.knowledgeError.titleRequired" | "editor.knowledgeError.titleTooLong" | "editor.knowledgeError.textRequired" | "editor.knowledgeError.textTooLong" | "editor.knowledgeError.fileRequired" | "editor.knowledgeError.fileTooLarge" | "editor.knowledgeError.fileTypeUnsupported" | "editor.knowledgeError.fileUnreadable" | "editor.knowledgeError.fileNoText" | "editor.knowledgeError.duplicate" | "editor.knowledgeError.limitDocuments" | "editor.knowledgeError.limitText" | "editor.knowledgeError.tryLater" | "editor.knowledgeError.tooManyAdds" | "editor.knowledgeError.connection" | "editor.knowledgeError.generic" | "editor.knowledgeError.moreProblems" | "editor.knowledgeError.notSent" | "editor.dropdown.select" | "editor.switch.off" | "editor.switch.on" | "editor.tags.add" | "editor.fixedPosition.set" | "editor.fixedPosition.topLeft" | "editor.fixedPosition.topCenter" | "editor.fixedPosition.topRight" | "editor.fixedPosition.centerLeft" | "editor.fixedPosition.centerCenter" | "editor.fixedPosition.centerRight" | "editor.fixedPosition.bottomLeft" | "editor.fixedPosition.bottomCenter" | "editor.fixedPosition.bottomRight" | "editor.corners.group" | "editor.corners.topLeft" | "editor.corners.topRight" | "editor.corners.bottomLeft" | "editor.corners.bottomRight" | "editor.corners.lock" | "editor.corners.unlock" | "editor.textArea.toolbar" | "editor.textArea.toggleBold" | "editor.textArea.toggleItalic" | "editor.textArea.toggleUnderline" | "editor.textArea.toggleLink" | "editor.textArea.text" | "editor.textArea.paragraph" | "editor.textArea.heading1" | "editor.textArea.heading2" | "editor.textArea.heading3" | "editor.textArea.bulletList" | "editor.textArea.numberedList" | "editor.textArea.checkList" | "editor.textArea.textStyles" | "editor.textArea.listStyles" | "editor.textArea.linkUrlLabel" | "editor.textArea.linkUrlPlaceholder" | "editor.textArea.linkUrlApply" | "editor.textArea.linkUrlRemove" | "editor.textArea.linkUrlEmpty" | "editor.textArea.linkUrlInvalid" | "editor.position.readout" | "editor.stepper.decrease" | "editor.stepper.increase" | "editor.tags.remove" | "editor.list.uploadedByYou" | "editor.vector.loadFailed" | "editor.textArea.closePanel" | "editor.textArea.closeColorMode" | "editor.embed.helpPrompt" | "editor.embed.learnMore" | "editor.embed.helpLinkAria" | "editor.schema.subtitleFont">;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ export { default as PreviewChromeControls } from './components/PreviewChromeCont
|
|
|
6
6
|
export { setFileBrowserUploadConfig } from '@widgetic/file-browser';
|
|
7
7
|
export { setGoogleFontsApiKey, getGoogleFontsKey } from './config';
|
|
8
8
|
export { default as EmbedEditor } from './components/editors/EmbedEditor.svelte';
|
|
9
|
+
export { parseCompositionEmbedCode, normalizeParsedEmbedSettings, type ParseCompositionEmbedCodeResult, type ParseCompositionEmbedCodeFailureReason, } from './embed/parseCompositionEmbedCode.js';
|
|
9
10
|
export { default as CompositionEditorApp } from './components/editors/CompositionEditorApp.svelte';
|
|
10
11
|
export { CompositionApiError, createCompositionApi, type CompositionApi, type CompositionApiOptions, type CompositionPreviewInfo, type SaveCompositionBody, type TokenReason } from './composition/compositionApi.js';
|
|
11
|
-
export { failureMessage, type CompositionEditorEvent, type CompositionEditorState, type ConflictResolution, type DeviceView, type EditorConflict, type EditorFailure } from './composition/compositionEditorController.js';
|
|
12
|
+
export { failureMessage, type CompositionEditorEvent, type CompositionEditorState, type ConflictResolution, type DeviceView, type DraftRestoredInfo, type EditorConflict, type EditorFailure } from './composition/compositionEditorController.js';
|
|
13
|
+
export { createDraftJournal, type DraftJournal } from './drafts/draftJournal.js';
|
|
12
14
|
export type { KnowledgeDocument, KnowledgeDocumentStatus, KnowledgeListing, KnowledgeTotals } from './composition/knowledgeDocuments.js';
|
|
13
15
|
export type { EditLeaseHolder } from './composition/compositionApi.js';
|
|
14
16
|
export type { PresencePhase, PresenceState } from './composition/editLeaseController.js';
|
package/dist/index.js
CHANGED
|
@@ -9,10 +9,12 @@ export { setFileBrowserUploadConfig } from '@widgetic/file-browser';
|
|
|
9
9
|
export { setGoogleFontsApiKey, getGoogleFontsKey } from './config';
|
|
10
10
|
// Embed Editor
|
|
11
11
|
export { default as EmbedEditor } from './components/editors/EmbedEditor.svelte';
|
|
12
|
+
export { parseCompositionEmbedCode, normalizeParsedEmbedSettings, } from './embed/parseCompositionEmbedCode.js';
|
|
12
13
|
// Composition Editor: one Widgetic composition, loaded, edited beside a live preview, and saved through the API.
|
|
13
14
|
export { default as CompositionEditorApp } from './components/editors/CompositionEditorApp.svelte';
|
|
14
15
|
export { CompositionApiError, createCompositionApi } from './composition/compositionApi.js';
|
|
15
16
|
export { failureMessage } from './composition/compositionEditorController.js';
|
|
17
|
+
export { createDraftJournal } from './drafts/draftJournal.js';
|
|
16
18
|
// The words of the editor, in the language of the page: the catalog of English messages, a check for a page's own
|
|
17
19
|
// messages, and what a host that mounts PropsEditor, EmbedEditor or WidgetPreview on their own gives them (the composition
|
|
18
20
|
// editor does it for itself, from its `locale` and `messages`).
|
|
@@ -25,6 +25,8 @@ export interface FontData {
|
|
|
25
25
|
/** Google Web Fonts API variant ids (e.g. "400", "700", "regular") */
|
|
26
26
|
variants?: string[];
|
|
27
27
|
}
|
|
28
|
+
/** Turns a stored numeric css weight (e.g. "600") into the editor's weight name; named weights pass through. */
|
|
29
|
+
export declare function normalizeFontWeightName(weight: string | undefined | null): string;
|
|
28
30
|
/** Maps Google Fonts API variant ids to display weight labels (includes italic faces). */
|
|
29
31
|
export declare function mapGoogleVariantIdsToWeightNames(variants: string[]): string[];
|
|
30
32
|
declare class FontManager {
|
|
@@ -23,9 +23,24 @@ const fontWeightOrder = {
|
|
|
23
23
|
'Thin Italic': 1.5,
|
|
24
24
|
'ExtraLight Italic': 2.5,
|
|
25
25
|
};
|
|
26
|
+
/** Turns a stored numeric css weight (e.g. "600") into the editor's weight name; named weights pass through. */
|
|
27
|
+
export function normalizeFontWeightName(weight) {
|
|
28
|
+
if (!weight)
|
|
29
|
+
return 'Regular';
|
|
30
|
+
const raw = String(weight).trim();
|
|
31
|
+
if (!raw)
|
|
32
|
+
return 'Regular';
|
|
33
|
+
if (Object.prototype.hasOwnProperty.call(fontWeightOrder, raw))
|
|
34
|
+
return raw;
|
|
35
|
+
if (/^\d{3}$/.test(raw))
|
|
36
|
+
return googleVariantIdToWeightName(raw);
|
|
37
|
+
if (/^\d{3}italic$/i.test(raw))
|
|
38
|
+
return googleVariantIdToWeightName(raw);
|
|
39
|
+
return raw;
|
|
40
|
+
}
|
|
26
41
|
function googleVariantIdToWeightName(variant) {
|
|
27
42
|
const italic = /italic/i.test(variant);
|
|
28
|
-
const base = variant.replace(/italic/ig, '').toLowerCase() || 'regular';
|
|
43
|
+
const base = variant.replace(/italic/ig, '').trim().toLowerCase() || 'regular';
|
|
29
44
|
let name;
|
|
30
45
|
switch (base) {
|
|
31
46
|
case '100':
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when a keyboard event originated from (or should be treated as) typing in an editable control,
|
|
3
|
+
* including fields inside shadow roots and portaled popovers (composedPath).
|
|
4
|
+
*/
|
|
5
|
+
export declare function isEditableEventTarget(event: Pick<KeyboardEvent, 'composedPath' | 'target'>): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const EDITABLE_SELECTOR = 'input, textarea, select, option, [contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="combobox"], [role="searchbox"]';
|
|
2
|
+
function elementIsEditable(element) {
|
|
3
|
+
if (!element || typeof element !== 'object')
|
|
4
|
+
return false;
|
|
5
|
+
const htmlElement = element;
|
|
6
|
+
if (htmlElement.isContentEditable)
|
|
7
|
+
return true;
|
|
8
|
+
const contentEditable = htmlElement.getAttribute?.('contenteditable');
|
|
9
|
+
if (contentEditable !== null && contentEditable !== undefined && contentEditable !== 'false')
|
|
10
|
+
return true;
|
|
11
|
+
return typeof htmlElement.matches === 'function' && htmlElement.matches(EDITABLE_SELECTOR);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* True when a keyboard event originated from (or should be treated as) typing in an editable control,
|
|
15
|
+
* including fields inside shadow roots and portaled popovers (composedPath).
|
|
16
|
+
*/
|
|
17
|
+
export function isEditableEventTarget(event) {
|
|
18
|
+
for (const node of event.composedPath()) {
|
|
19
|
+
if (elementIsEditable(node))
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (elementIsEditable(event.target))
|
|
23
|
+
return true;
|
|
24
|
+
return elementIsEditable(typeof document !== 'undefined' ? document.activeElement : null);
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The words of the editor that explain why a link URL was not accepted. */
|
|
2
|
+
export type LinkUrlMessageKey = 'editor.textArea.linkUrlEmpty' | 'editor.textArea.linkUrlInvalid';
|
|
3
|
+
/**
|
|
4
|
+
* Result of validating a URL typed into the rich-text link popover: `normalizedHref` is set when `ok`, `messageKey` when
|
|
5
|
+
* not. One object type, not a union of two: this project does not use strict null checks, and without them TypeScript
|
|
6
|
+
* does not narrow a union on a boolean `ok`.
|
|
7
|
+
*/
|
|
8
|
+
export interface LinkUrlValidationResult {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
normalizedHref?: string;
|
|
11
|
+
messageKey?: LinkUrlMessageKey;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Normalizes and validates a link URL for the rich text editor.
|
|
15
|
+
* Empty input is invalid unless the caller treats empty as "remove link" on apply.
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateLinkUrl(rawInput: string): LinkUrlValidationResult;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
const BLOCKED_SCHEME_PATTERN = /^\s*(javascript|data|vbscript):/i;
|
|
2
|
+
const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3
|
+
const IPV4_PATTERN = /^(?:\d{1,3}\.){3}\d{1,3}$/;
|
|
4
|
+
const LABEL_PATTERN = /^(?:[\p{L}\p{N}]|xn--)(?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?$/u;
|
|
5
|
+
function rejectInvalid() {
|
|
6
|
+
return { ok: false, messageKey: 'editor.textArea.linkUrlInvalid' };
|
|
7
|
+
}
|
|
8
|
+
function isValidIpv4(host) {
|
|
9
|
+
if (!IPV4_PATTERN.test(host))
|
|
10
|
+
return false;
|
|
11
|
+
return host.split('.').every((octet) => {
|
|
12
|
+
const value = Number(octet);
|
|
13
|
+
return value >= 0 && value <= 255 && String(value) === octet;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function isValidDottedHost(hostname) {
|
|
17
|
+
if (!hostname || hostname.includes('..') || hostname.startsWith('.') || hostname.endsWith('.')) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const labels = hostname.split('.');
|
|
21
|
+
if (labels.length < 2)
|
|
22
|
+
return false;
|
|
23
|
+
for (const label of labels) {
|
|
24
|
+
if (!label || label.startsWith('-') || label.endsWith('-'))
|
|
25
|
+
return false;
|
|
26
|
+
if (!LABEL_PATTERN.test(label))
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const topLevelLabel = labels[labels.length - 1];
|
|
30
|
+
if (topLevelLabel.startsWith('xn--'))
|
|
31
|
+
return true;
|
|
32
|
+
if (!/[\p{L}]/u.test(topLevelLabel) || topLevelLabel.length < 2)
|
|
33
|
+
return false;
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
function isValidWebHostname(hostname) {
|
|
37
|
+
const lower = hostname.toLowerCase();
|
|
38
|
+
if (lower === 'localhost')
|
|
39
|
+
return true;
|
|
40
|
+
if (hostname.startsWith('[') && hostname.endsWith(']'))
|
|
41
|
+
return hostname.length > 2;
|
|
42
|
+
if (isValidIpv4(hostname))
|
|
43
|
+
return true;
|
|
44
|
+
return isValidDottedHost(hostname);
|
|
45
|
+
}
|
|
46
|
+
function isPlausibleMailtoHref(href) {
|
|
47
|
+
const address = href
|
|
48
|
+
.replace(/^mailto:/i, '')
|
|
49
|
+
.split('?')[0]
|
|
50
|
+
.trim();
|
|
51
|
+
return EMAIL_PATTERN.test(address);
|
|
52
|
+
}
|
|
53
|
+
function isPlausibleTelHref(href) {
|
|
54
|
+
try {
|
|
55
|
+
const parsed = new URL(href);
|
|
56
|
+
const digits = parsed.pathname.replace(/[\s\-().]/g, '');
|
|
57
|
+
return digits.length >= 3 && /^\+?\d+$/.test(digits);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
const digits = href.replace(/^tel:/i, '').replace(/[\s\-().]/g, '');
|
|
61
|
+
return digits.length >= 3 && /^\+?\d+$/.test(digits);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function validateWebUrl(parsed) {
|
|
65
|
+
if (/\s/.test(parsed.pathname + parsed.search + parsed.hash))
|
|
66
|
+
return rejectInvalid();
|
|
67
|
+
if (!isValidWebHostname(parsed.hostname))
|
|
68
|
+
return rejectInvalid();
|
|
69
|
+
return { ok: true, normalizedHref: parsed.href };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Normalizes and validates a link URL for the rich text editor.
|
|
73
|
+
* Empty input is invalid unless the caller treats empty as "remove link" on apply.
|
|
74
|
+
*/
|
|
75
|
+
export function validateLinkUrl(rawInput) {
|
|
76
|
+
const trimmed = rawInput.trim();
|
|
77
|
+
if (!trimmed) {
|
|
78
|
+
return { ok: false, messageKey: 'editor.textArea.linkUrlEmpty' };
|
|
79
|
+
}
|
|
80
|
+
if (BLOCKED_SCHEME_PATTERN.test(trimmed)) {
|
|
81
|
+
return rejectInvalid();
|
|
82
|
+
}
|
|
83
|
+
const hasExplicitScheme = /^[a-z][a-z0-9+.-]*:/i.test(trimmed);
|
|
84
|
+
const isTelScheme = /^tel:/i.test(trimmed);
|
|
85
|
+
const isMailtoScheme = /^mailto:/i.test(trimmed);
|
|
86
|
+
if (!isTelScheme && /\s/.test(trimmed)) {
|
|
87
|
+
return rejectInvalid();
|
|
88
|
+
}
|
|
89
|
+
let candidate = trimmed;
|
|
90
|
+
if (isMailtoScheme || isTelScheme) {
|
|
91
|
+
candidate = trimmed;
|
|
92
|
+
}
|
|
93
|
+
else if (EMAIL_PATTERN.test(trimmed)) {
|
|
94
|
+
candidate = `mailto:${trimmed}`;
|
|
95
|
+
}
|
|
96
|
+
else if (!hasExplicitScheme) {
|
|
97
|
+
candidate = `https://${trimmed}`;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
const parsed = new URL(candidate);
|
|
101
|
+
const scheme = parsed.protocol.replace(/:$/, '').toLowerCase();
|
|
102
|
+
if (!['http', 'https', 'mailto', 'tel'].includes(scheme)) {
|
|
103
|
+
return rejectInvalid();
|
|
104
|
+
}
|
|
105
|
+
if (scheme === 'mailto') {
|
|
106
|
+
return isPlausibleMailtoHref(parsed.href)
|
|
107
|
+
? { ok: true, normalizedHref: parsed.href }
|
|
108
|
+
: rejectInvalid();
|
|
109
|
+
}
|
|
110
|
+
if (scheme === 'tel') {
|
|
111
|
+
return isPlausibleTelHref(parsed.href)
|
|
112
|
+
? { ok: true, normalizedHref: parsed.href }
|
|
113
|
+
: rejectInvalid();
|
|
114
|
+
}
|
|
115
|
+
return validateWebUrl(parsed);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return rejectInvalid();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Browser input value shape persisted in editor state. */
|
|
2
|
+
export type BrowserFileValue = {
|
|
3
|
+
id: string;
|
|
4
|
+
file: string;
|
|
5
|
+
url: string;
|
|
6
|
+
hash?: string;
|
|
7
|
+
thumbnail?: string;
|
|
8
|
+
mimeType?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function isBrowserFileValue(raw: unknown): raw is BrowserFileValue;
|
|
11
|
+
/** Keep the full file reference when the parent echoes a browser field back (not just `url`). */
|
|
12
|
+
export declare function hydrateBrowserFileValue(raw: unknown): string | BrowserFileValue | '';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function isBrowserFileValue(raw) {
|
|
2
|
+
if (!raw || typeof raw !== 'object')
|
|
3
|
+
return false;
|
|
4
|
+
const o = raw;
|
|
5
|
+
return typeof o.url === 'string' && o.url.length > 0;
|
|
6
|
+
}
|
|
7
|
+
/** Keep the full file reference when the parent echoes a browser field back (not just `url`). */
|
|
8
|
+
export function hydrateBrowserFileValue(raw) {
|
|
9
|
+
if (raw === undefined || raw === null || raw === '')
|
|
10
|
+
return '';
|
|
11
|
+
if (typeof raw === 'string')
|
|
12
|
+
return raw;
|
|
13
|
+
if (isBrowserFileValue(raw)) {
|
|
14
|
+
return {
|
|
15
|
+
id: String(raw.id ?? raw.url),
|
|
16
|
+
file: String(raw.file ?? raw.url.split('/').pop() ?? ''),
|
|
17
|
+
url: raw.url,
|
|
18
|
+
hash: raw.hash,
|
|
19
|
+
thumbnail: raw.thumbnail,
|
|
20
|
+
mimeType: raw.mimeType
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return raw;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* ProseMirror document position for a collapsed caret at the end of the document text.
|
|
4
|
+
* The document `content.size` is one past the last valid caret position.
|
|
5
|
+
*/
|
|
6
|
+
export declare function collapsedCaretPositionAtDocumentEnd(documentContentSize: number): number;
|
|
7
|
+
/**
|
|
8
|
+
* Focus the rich text editor and place the caret after the last character of the last block,
|
|
9
|
+
* scrolling the editor's own scroller so the caret stays visible.
|
|
10
|
+
*/
|
|
11
|
+
export declare function placeRichTextCaretAtDocumentEnd(editor: Editor | null | undefined): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProseMirror document position for a collapsed caret at the end of the document text.
|
|
3
|
+
* The document `content.size` is one past the last valid caret position.
|
|
4
|
+
*/
|
|
5
|
+
export function collapsedCaretPositionAtDocumentEnd(documentContentSize) {
|
|
6
|
+
if (!Number.isFinite(documentContentSize) || documentContentSize < 1) {
|
|
7
|
+
return 1;
|
|
8
|
+
}
|
|
9
|
+
return Math.max(1, documentContentSize - 1);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Focus the rich text editor and place the caret after the last character of the last block,
|
|
13
|
+
* scrolling the editor's own scroller so the caret stays visible.
|
|
14
|
+
*/
|
|
15
|
+
export function placeRichTextCaretAtDocumentEnd(editor) {
|
|
16
|
+
if (!editor || editor.isDestroyed) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return editor.chain().focus('end', { scrollIntoView: true }).run();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error('[TextAreaInputController] Could not place caret at document end:', error);
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widgetic/editor",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.20",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"llinks": "ls -la node_modules/@widgetic",
|
|
34
34
|
"stop-dev": "lsof -i :5180 | awk 'NR>1 {print $2}' | xargs kill",
|
|
35
35
|
"dev": "npm run sync-embed-schema && npm run stop-dev && npm run dev-sv",
|
|
36
|
-
"sync-embed-schema": "node ../scripts/sync-embed-schema.mjs",
|
|
36
|
+
"sync-embed-schema": "node ../scripts/sync-embed-schema.mjs && node scripts/copy-embed-schema-into-lib.mjs",
|
|
37
37
|
"dev-sv": "NODE_ENV=development vite dev --port 5180",
|
|
38
38
|
"dev-open": "npm run dev -- --open",
|
|
39
39
|
"render-build": "bash render-build.sh",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@widgetic/api-sdk": "*",
|
|
54
54
|
"@widgetic/cache-layer": "^0.1.1",
|
|
55
|
-
"@widgetic/design-system": ">=0.5.
|
|
56
|
-
"@widgetic/file-browser": "^0.5.
|
|
55
|
+
"@widgetic/design-system": ">=0.5.28",
|
|
56
|
+
"@widgetic/file-browser": "^0.5.41",
|
|
57
57
|
"svelte": "^5.27.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"@types/node": "26.6.2",
|
|
69
69
|
"@widgetic/api-sdk": "^2.0.1",
|
|
70
70
|
"@widgetic/cache-layer": "^0.1.1",
|
|
71
|
-
"@widgetic/design-system": "^0.5.
|
|
71
|
+
"@widgetic/design-system": "^0.5.28",
|
|
72
72
|
"@widgetic/dev-tools": "^0.2.0",
|
|
73
|
-
"@widgetic/file-browser": "^0.5.
|
|
73
|
+
"@widgetic/file-browser": "^0.5.41",
|
|
74
74
|
"eslint": "^9.0.0",
|
|
75
75
|
"eslint-config-prettier": "^9.1.0",
|
|
76
76
|
"eslint-plugin-svelte": "^2.36.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"@tiptap/extension-underline": "^2.9.1",
|
|
117
117
|
"@tiptap/pm": "^2.9.1",
|
|
118
118
|
"@tiptap/starter-kit": "^2.9.1",
|
|
119
|
-
"@widgetic/design-system": ">=0.5.
|
|
119
|
+
"@widgetic/design-system": ">=0.5.28",
|
|
120
120
|
"bits-ui": "^2.16.3",
|
|
121
121
|
"clsx": "^2.1.1",
|
|
122
122
|
"dotenv": "^16.4.5",
|