@widgetic/editor 4.0.11 → 4.1.0
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/README.md +124 -0
- package/dist/components/WidgetPreview.svelte +58 -59
- package/dist/components/color-select/ColorSelect.svelte +4 -4
- package/dist/components/editors/CompositionEditorApp.svelte +69 -15
- package/dist/components/editors/CompositionEditorApp.svelte.d.ts +20 -0
- package/dist/components/editors/EmbedEditor.svelte +33 -22
- package/dist/components/editors/EmbedEditor.svelte.d.ts +1 -1
- package/dist/components/editors/PropsEditor.svelte +74 -58
- package/dist/components/editors/PropsEditor.svelte.d.ts +3 -3
- package/dist/components/ic/AngleInputController.svelte +1 -1
- package/dist/components/ic/BrowserInputController.svelte +37 -29
- package/dist/components/ic/ColorPickerInputController.svelte +31 -15
- package/dist/components/ic/DateFieldInputController.svelte +27 -11
- package/dist/components/ic/DatePickerInputController.svelte +27 -17
- package/dist/components/ic/DropdownInputController.svelte +10 -5
- package/dist/components/ic/DropdownInputController.svelte.d.ts +1 -1
- package/dist/components/ic/FixedPositionInputController.svelte +12 -6
- package/dist/components/ic/FontInputController.svelte +32 -27
- package/dist/components/ic/InputControllerHeader.svelte +5 -1
- package/dist/components/ic/NumberControls.svelte +4 -4
- package/dist/components/ic/NumberInputController.svelte +2 -2
- package/dist/components/ic/PositionInputController.svelte +9 -4
- package/dist/components/ic/RangeCalendarInputController.svelte +26 -16
- package/dist/components/ic/RoundedCornersInputController.svelte +22 -17
- package/dist/components/ic/SliderInputController.svelte +7 -2
- package/dist/components/ic/SwitchInputController.svelte +12 -3
- package/dist/components/ic/TagsInputController.svelte +19 -4
- package/dist/components/ic/TextAreaInputController.svelte +59 -44
- package/dist/components/ic/TextAreaPreviewInputController.svelte +8 -3
- package/dist/components/ic/TextInputController.svelte +17 -1
- package/dist/components/ic/TimeInputController.svelte +2 -1
- package/dist/components/ic/VectorInputController.svelte +21 -16
- package/dist/components/ic/shared/ItemGrid.svelte +7 -3
- package/dist/components/ic/shared/RecentItemsSection.svelte +16 -11
- package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +1 -1
- package/dist/composition/compositionEditorController.d.ts +11 -2
- package/dist/composition/compositionEditorController.js +33 -21
- package/dist/composition/compositionHelpers.d.ts +3 -1
- package/dist/composition/compositionHelpers.js +4 -2
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.js +4 -0
- package/dist/i18n/labels.d.ts +15 -0
- package/dist/i18n/labels.js +57 -0
- package/dist/i18n/language.d.ts +228 -0
- package/dist/i18n/language.js +34 -0
- package/dist/i18n/languageKit.d.ts +54 -0
- package/dist/i18n/languageKit.js +102 -0
- package/dist/i18n/messages.d.ts +241 -0
- package/dist/i18n/messages.js +253 -0
- package/dist/i18n/translate.d.ts +6 -0
- package/dist/i18n/translate.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/utils/dockPlacement.d.ts +12 -0
- package/dist/utils/dockPlacement.js +13 -0
- package/dist/utils/fieldDirection.d.ts +13 -0
- package/dist/utils/fieldDirection.js +25 -0
- package/package.json +2 -2
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every word the editor shows to the person using it, in English: the one place to read them, and the keys a page can
|
|
3
|
+
* replace with the `messages` of the editor.
|
|
4
|
+
*
|
|
5
|
+
* A message is plain text. `{name}` is a value the editor puts in; `{count, plural, one {# file} other {# files}}` picks
|
|
6
|
+
* the form that fits a number in the page's language. `\{`, `\}`, `\#` and `\\` write those characters themselves. See
|
|
7
|
+
* `@widgetic/design-system/i18n` for the whole format.
|
|
8
|
+
*
|
|
9
|
+
* Keys are grouped by where the words appear. A key that is left out of a page's `messages` keeps the English text below,
|
|
10
|
+
* so a language can be added a screen at a time.
|
|
11
|
+
*
|
|
12
|
+
* Words that are NOT here, on purpose:
|
|
13
|
+
* - what the widget says about itself: the names, descriptions and options of its settings are written by the person who
|
|
14
|
+
* made the widget, and are shown as they were written;
|
|
15
|
+
* - what the File Browser and the rich text editor inside this editor say: they have their own catalogs
|
|
16
|
+
* (`FILE_BROWSER_MESSAGES`, `SHAD_EDITOR_MESSAGES`), and the same `messages` object can carry all three;
|
|
17
|
+
* - text the editor writes into the composition: the title of a new item ("Item 03"), the name of a composition that has
|
|
18
|
+
* none ("Untitled Composition"). Those are saved with the composition, so they do not change with the language.
|
|
19
|
+
*/
|
|
20
|
+
export const EDITOR_MESSAGES = {
|
|
21
|
+
// ===== The editor as a whole: the card that says it is loading, and the buttons that try again =====
|
|
22
|
+
'editor.app.loading': 'Loading editor…',
|
|
23
|
+
'editor.app.tryAgain': 'Try again',
|
|
24
|
+
'editor.app.retry': 'Retry',
|
|
25
|
+
// ===== What went wrong, and what to do about it =====
|
|
26
|
+
'editor.failure.widgetNotPublished': 'Publish the widget before editing a composition.',
|
|
27
|
+
'editor.failure.sessionEndedWhileSaving': 'Your session has ended, so your changes could not be saved. Reload the page to continue.',
|
|
28
|
+
'editor.failure.sessionEnded': 'Your session has ended. Reload the page to continue.',
|
|
29
|
+
'editor.failure.compositionNotFound': 'This composition could not be found.',
|
|
30
|
+
'editor.failure.noAccess': 'You do not have access to this composition.',
|
|
31
|
+
'editor.failure.noWidget': 'This composition has no widget.',
|
|
32
|
+
'editor.failure.widgetNotFound': 'The widget this composition is made with could not be found.',
|
|
33
|
+
'editor.failure.saveNeedsConnection': 'Your changes could not be saved. Check the connection and try again.',
|
|
34
|
+
'editor.failure.loadNeedsConnection': 'The editor could not be loaded. Check the connection and try again.',
|
|
35
|
+
'editor.failure.saveFailed': 'Your changes could not be saved.',
|
|
36
|
+
'editor.failure.loadFailed': 'The editor could not be loaded.',
|
|
37
|
+
'editor.failure.settingsLoadFailed': 'The editor settings could not be loaded. Try again.',
|
|
38
|
+
'editor.failure.noSettings': 'No editable settings found. Generate and publish the widget first.',
|
|
39
|
+
/** A line under a message that has an error code: "Error code: CONFIG_NOT_FOUND". The code is not translated. */
|
|
40
|
+
'editor.failure.errorCode': 'Error code: {code}',
|
|
41
|
+
// ===== The settings editor =====
|
|
42
|
+
'editor.props.title': 'Edit Properties',
|
|
43
|
+
'editor.props.designTab': 'Design',
|
|
44
|
+
'editor.props.contentTab': 'Content',
|
|
45
|
+
/** The title of the card of settings that belong to no item, when the widget gave it none. */
|
|
46
|
+
'editor.props.contentCard': 'Content',
|
|
47
|
+
'editor.props.save': 'Save',
|
|
48
|
+
'editor.props.saving': 'Saving',
|
|
49
|
+
'editor.props.noConfiguration': 'No schema configuration available',
|
|
50
|
+
'editor.props.noDesignSchema': 'No design schema available',
|
|
51
|
+
'editor.props.noSchemaData': 'No schema data available',
|
|
52
|
+
'editor.props.noComponents': 'No components defined in schema',
|
|
53
|
+
'editor.props.noProperties': 'No properties available',
|
|
54
|
+
'editor.props.addItem': 'Add new',
|
|
55
|
+
'editor.props.deleteItem': 'Delete item',
|
|
56
|
+
// ===== The embed options =====
|
|
57
|
+
'editor.embed.title': 'Edit Options',
|
|
58
|
+
'editor.embed.loading': 'Loading...',
|
|
59
|
+
'editor.embed.noCode': 'No embed code available',
|
|
60
|
+
'editor.embed.codeHeader': 'Embed code',
|
|
61
|
+
'editor.embed.headerArea': 'Embed code header area',
|
|
62
|
+
'editor.embed.readMore': 'Read more about embedding',
|
|
63
|
+
'editor.embed.copy': 'Copy to clipboard',
|
|
64
|
+
/** The pop-ups after a copy: the title of the one that worked is the same for the editor's pop-up and the header's. */
|
|
65
|
+
'editor.embed.copied': 'Copied to clipboard',
|
|
66
|
+
'editor.embed.copiedHint': 'Paste it anywhere on your site.',
|
|
67
|
+
'editor.embed.copiedDone': 'Content copied successfully.',
|
|
68
|
+
'editor.embed.copyFailed': 'Copy failed',
|
|
69
|
+
'editor.embed.copyFailedHint': 'Please try manual selection',
|
|
70
|
+
// ===== The preview of the widget =====
|
|
71
|
+
'editor.preview.title': 'Preview',
|
|
72
|
+
'editor.preview.dragHandle': 'Drag preview',
|
|
73
|
+
'editor.preview.desktop': 'Desktop preview',
|
|
74
|
+
'editor.preview.mobile': 'Mobile preview',
|
|
75
|
+
/** The first letters of "width" and "height", beside the two boxes where the size of the preview is typed. */
|
|
76
|
+
'editor.preview.widthShort': 'W',
|
|
77
|
+
'editor.preview.heightShort': 'H',
|
|
78
|
+
'editor.preview.noUrl': 'no URL',
|
|
79
|
+
'editor.preview.copyUrl': 'Copy URL',
|
|
80
|
+
'editor.preview.refresh': 'Refresh preview',
|
|
81
|
+
'editor.preview.fitToPanel': 'Fit preview to panel',
|
|
82
|
+
'editor.preview.mobileViewport': 'Mobile viewport',
|
|
83
|
+
'editor.preview.desktopViewport': 'Desktop viewport (full window)',
|
|
84
|
+
'editor.preview.openInNewTab': 'Open in new tab',
|
|
85
|
+
'editor.preview.newTab': '↗ New tab',
|
|
86
|
+
'editor.preview.selectWidget': 'Select a widget to preview',
|
|
87
|
+
/** What the name of a widget is when it has none. */
|
|
88
|
+
'editor.preview.widgetName': 'Widget',
|
|
89
|
+
'editor.preview.notPublished': 'Not published yet',
|
|
90
|
+
'editor.preview.publishToPreview': 'Publish the widget in Widget Creator to preview it here.',
|
|
91
|
+
'editor.preview.frameTitle': 'Widget preview',
|
|
92
|
+
'editor.preview.frameTitleNamed': 'Widget preview – {name}',
|
|
93
|
+
'editor.preview.unavailable': 'Preview Unavailable',
|
|
94
|
+
'editor.preview.loadFailedPreview': 'Failed to load widget preview.',
|
|
95
|
+
'editor.preview.retry': 'Retry',
|
|
96
|
+
'editor.preview.retryBuild': 'Retry Build',
|
|
97
|
+
'editor.preview.retryPreview': 'Retry Preview',
|
|
98
|
+
'editor.preview.fixErrors': 'Fix Errors',
|
|
99
|
+
'editor.preview.viewErrors': 'View Errors',
|
|
100
|
+
'editor.preview.runtimeError': 'Widget runtime error',
|
|
101
|
+
'editor.preview.compilationErrors': 'Code Has Compilation Errors',
|
|
102
|
+
/** `{status}` is the HTTP status the preview page answered with. */
|
|
103
|
+
'editor.preview.compilationErrorsDetail': 'The generated code has syntax or compilation errors (HTTP {status}).',
|
|
104
|
+
'editor.preview.noCodeYet': 'No Code Generated Yet',
|
|
105
|
+
'editor.preview.noPreview': 'No Preview Available',
|
|
106
|
+
'editor.preview.building': 'Building Preview...',
|
|
107
|
+
'editor.preview.loadingWidget': 'Loading widget…',
|
|
108
|
+
'editor.preview.loadingPreview': 'Loading Preview…',
|
|
109
|
+
'editor.preview.checkingWidget': 'Checking widget on Worker…',
|
|
110
|
+
'editor.preview.applyingSettings': 'Applying composition settings…',
|
|
111
|
+
'editor.preview.connecting': 'Connecting to the widget preview…',
|
|
112
|
+
'editor.preview.generatingCode': 'Generating code…',
|
|
113
|
+
// ===== Lists of fonts and vectors: the words they share =====
|
|
114
|
+
'editor.list.recentlyUsed': 'Recently used',
|
|
115
|
+
'editor.list.more': 'More',
|
|
116
|
+
'editor.list.searchResults': 'Search results',
|
|
117
|
+
'editor.list.loadingMore': 'Loading more items...',
|
|
118
|
+
'editor.list.deleteItem': 'Delete',
|
|
119
|
+
/** The tabs above a list of fonts or vectors. */
|
|
120
|
+
'editor.category.all': 'All',
|
|
121
|
+
'editor.category.mine': 'Mine',
|
|
122
|
+
'editor.category.sansSerif': 'Sans Serif',
|
|
123
|
+
'editor.category.serif': 'Serif',
|
|
124
|
+
'editor.category.script': 'Script',
|
|
125
|
+
'editor.category.other': 'Other',
|
|
126
|
+
'editor.category.icons': 'Icons',
|
|
127
|
+
'editor.category.emojis': 'Emojis',
|
|
128
|
+
'editor.category.clipart': 'Clipart',
|
|
129
|
+
// ===== Fonts =====
|
|
130
|
+
'editor.font.select': 'Select font...',
|
|
131
|
+
'editor.font.title': 'Fonts',
|
|
132
|
+
'editor.font.search': 'Search fonts...',
|
|
133
|
+
'editor.font.list': 'Font list',
|
|
134
|
+
'editor.font.loading': 'Loading fonts',
|
|
135
|
+
'editor.font.noneFound': 'No fonts found',
|
|
136
|
+
'editor.font.noneAvailable': 'No fonts available',
|
|
137
|
+
'editor.font.remove': 'Remove font',
|
|
138
|
+
'editor.font.weight': 'Font Weight',
|
|
139
|
+
/** The name a screen reader gives the list of weights a font has, when its menu is open. */
|
|
140
|
+
'editor.font.weightList': 'Font weights',
|
|
141
|
+
/** The look of a weight that has a name of its own; `{weight}` is one of the names below ("Bold Italic"). */
|
|
142
|
+
'editor.fontWeight.withItalic': '{weight} Italic',
|
|
143
|
+
'editor.fontWeight.italic': 'Italic',
|
|
144
|
+
'editor.fontWeight.thin': 'Thin',
|
|
145
|
+
'editor.fontWeight.extraLight': 'ExtraLight',
|
|
146
|
+
'editor.fontWeight.light': 'Light',
|
|
147
|
+
'editor.fontWeight.regular': 'Regular',
|
|
148
|
+
'editor.fontWeight.medium': 'Medium',
|
|
149
|
+
'editor.fontWeight.semiBold': 'SemiBold',
|
|
150
|
+
'editor.fontWeight.bold': 'Bold',
|
|
151
|
+
'editor.fontWeight.extraBold': 'ExtraBold',
|
|
152
|
+
'editor.fontWeight.black': 'Black',
|
|
153
|
+
// ===== Vectors (icons, emojis and clipart) =====
|
|
154
|
+
'editor.vector.select': 'Select vector...',
|
|
155
|
+
'editor.vector.title': 'Vectors',
|
|
156
|
+
'editor.vector.search': 'Search vectors...',
|
|
157
|
+
'editor.vector.list': 'Vector list',
|
|
158
|
+
'editor.vector.noneFound': 'No vectors found',
|
|
159
|
+
'editor.vector.noneAvailable': 'No vectors available',
|
|
160
|
+
// ===== Files =====
|
|
161
|
+
'editor.file.useFile': 'Use file',
|
|
162
|
+
'editor.file.useImage': 'Use image',
|
|
163
|
+
'editor.file.useVideo': 'Use video',
|
|
164
|
+
'editor.file.useAudio': 'Use audio',
|
|
165
|
+
'editor.file.useDocument': 'Use document',
|
|
166
|
+
'editor.file.addFile': 'Add file...',
|
|
167
|
+
'editor.file.addImage': 'Add image...',
|
|
168
|
+
'editor.file.addVideo': 'Add video...',
|
|
169
|
+
'editor.file.addAudio': 'Add audio...',
|
|
170
|
+
'editor.file.addDocument': 'Add docs...',
|
|
171
|
+
'editor.file.play': 'Play',
|
|
172
|
+
'editor.file.pause': 'Pause',
|
|
173
|
+
'editor.file.notFound': 'File not found',
|
|
174
|
+
'editor.file.emptyFolder': 'Empty folder',
|
|
175
|
+
'editor.file.clear': 'Clear file',
|
|
176
|
+
'editor.file.dialogTitle': 'Select file',
|
|
177
|
+
'editor.file.closeDialog': 'Close file browser',
|
|
178
|
+
// ===== Colours =====
|
|
179
|
+
'editor.color.noRecent': 'No recent colors',
|
|
180
|
+
'editor.color.picker': 'Color picker',
|
|
181
|
+
// ===== Dates =====
|
|
182
|
+
'editor.date.pick': 'Pick a date',
|
|
183
|
+
'editor.date.pickRange': 'Pick a date range',
|
|
184
|
+
'editor.date.invalid': 'Invalid date',
|
|
185
|
+
'editor.date.selectMonth': 'Select month',
|
|
186
|
+
'editor.date.selectYear': 'Select year',
|
|
187
|
+
/**
|
|
188
|
+
* The name a screen reader gives the calendar of one date. The library writes the month and year after it ("Date
|
|
189
|
+
* October 2026"), so a short noun is best.
|
|
190
|
+
*/
|
|
191
|
+
'editor.date.calendarLabel': 'Date',
|
|
192
|
+
/** The same for the calendar of a range of dates ("Date range October - November 2026"). */
|
|
193
|
+
'editor.date.rangeCalendarLabel': 'Date range',
|
|
194
|
+
/** The name a screen reader gives the buttons of a calendar that show the month before and the month after. */
|
|
195
|
+
'editor.date.previousMonth': 'Previous month',
|
|
196
|
+
'editor.date.nextMonth': 'Next month',
|
|
197
|
+
/** What is typed in the three boxes of a date: the hint inside the box, and its name for a screen reader. */
|
|
198
|
+
'editor.dateField.dayHint': 'DD',
|
|
199
|
+
'editor.dateField.monthHint': 'MM',
|
|
200
|
+
'editor.dateField.yearHint': 'YYYY',
|
|
201
|
+
'editor.dateField.dayLabel': 'Day input',
|
|
202
|
+
'editor.dateField.monthLabel': 'Month input',
|
|
203
|
+
'editor.dateField.yearLabel': 'Year input',
|
|
204
|
+
// ===== Small controls =====
|
|
205
|
+
'editor.dropdown.select': 'Select an option',
|
|
206
|
+
'editor.switch.off': 'Off',
|
|
207
|
+
'editor.switch.on': 'On',
|
|
208
|
+
'editor.tags.add': 'Add tag...',
|
|
209
|
+
/** The two letters beside the position of a point in a picture: how far across, and how far down. */
|
|
210
|
+
'editor.position.x': 'X:',
|
|
211
|
+
'editor.position.y': 'Y:',
|
|
212
|
+
/** The buttons of the nine places on a screen; `{position}` is one of the names below. */
|
|
213
|
+
'editor.fixedPosition.set': 'Set position to {position}',
|
|
214
|
+
'editor.fixedPosition.topLeft': 'top-left',
|
|
215
|
+
'editor.fixedPosition.topCenter': 'top-center',
|
|
216
|
+
'editor.fixedPosition.topRight': 'top-right',
|
|
217
|
+
'editor.fixedPosition.centerLeft': 'center-left',
|
|
218
|
+
'editor.fixedPosition.centerCenter': 'center-center',
|
|
219
|
+
'editor.fixedPosition.centerRight': 'center-right',
|
|
220
|
+
'editor.fixedPosition.bottomLeft': 'bottom-left',
|
|
221
|
+
'editor.fixedPosition.bottomCenter': 'bottom-center',
|
|
222
|
+
'editor.fixedPosition.bottomRight': 'bottom-right',
|
|
223
|
+
/** The corners of a box: the name of the group, of each of the four boxes, and of the lock between them. */
|
|
224
|
+
'editor.corners.group': 'Corner radius',
|
|
225
|
+
'editor.corners.topLeft': 'Top left corner radius',
|
|
226
|
+
'editor.corners.topRight': 'Top right corner radius',
|
|
227
|
+
'editor.corners.bottomLeft': 'Bottom left corner radius',
|
|
228
|
+
'editor.corners.bottomRight': 'Bottom right corner radius',
|
|
229
|
+
'editor.corners.lock': 'Lock corner radius values',
|
|
230
|
+
'editor.corners.unlock': 'Unlock corner radius values',
|
|
231
|
+
// ===== The text box =====
|
|
232
|
+
'editor.textArea.toolbar': 'Text formatting toolbar',
|
|
233
|
+
'editor.textArea.toggleBold': 'Toggle bold',
|
|
234
|
+
'editor.textArea.toggleItalic': 'Toggle italic',
|
|
235
|
+
'editor.textArea.toggleUnderline': 'Toggle underline',
|
|
236
|
+
'editor.textArea.toggleLink': 'Toggle link',
|
|
237
|
+
'editor.textArea.text': 'Text',
|
|
238
|
+
'editor.textArea.paragraph': 'Paragraph',
|
|
239
|
+
'editor.textArea.heading1': 'H1',
|
|
240
|
+
'editor.textArea.heading2': 'H2',
|
|
241
|
+
'editor.textArea.heading3': 'H3',
|
|
242
|
+
'editor.textArea.bulletList': 'Bullet List',
|
|
243
|
+
'editor.textArea.numberedList': 'Numbered List',
|
|
244
|
+
'editor.textArea.checkList': 'Check List',
|
|
245
|
+
/** The name a screen reader gives the list of text styles (paragraph, headings) when its menu is open. */
|
|
246
|
+
'editor.textArea.textStyles': 'Text styles',
|
|
247
|
+
/** The name a screen reader gives the list of list styles (bullets, numbers, checks) when its menu is open. */
|
|
248
|
+
'editor.textArea.listStyles': 'List styles',
|
|
249
|
+
/** The question the browser asks when a link is added. */
|
|
250
|
+
'editor.textArea.enterUrl': 'Enter URL',
|
|
251
|
+
// ===== Words the editor adds to the widget's own schema =====
|
|
252
|
+
'editor.schema.subtitleFont': 'Subtitle Font'
|
|
253
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The English `t` of the editor, for code that has no component around it (the controller of the composition editor makes
|
|
3
|
+
* its sentences with it until the page gives another translator). The editor's screens get their words, in the page's
|
|
4
|
+
* language, from `useEditorLanguage` (see `language.ts`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const translateEnglish: any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createI18n } from '@widgetic/design-system/i18n';
|
|
2
|
+
import { EDITOR_MESSAGES } from './messages.js';
|
|
3
|
+
/**
|
|
4
|
+
* The English `t` of the editor, for code that has no component around it (the controller of the composition editor makes
|
|
5
|
+
* its sentences with it until the page gives another translator). The editor's screens get their words, in the page's
|
|
6
|
+
* language, from `useEditorLanguage` (see `language.ts`).
|
|
7
|
+
*/
|
|
8
|
+
export const { translateEnglish } = createI18n({ catalog: EDITOR_MESSAGES, label: 'Editor' });
|
package/dist/index.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export { default as EmbedEditor } from './components/editors/EmbedEditor.svelte'
|
|
|
8
8
|
export { default as CompositionEditorApp } from './components/editors/CompositionEditorApp.svelte';
|
|
9
9
|
export { CompositionApiError, createCompositionApi, type CompositionApi, type CompositionApiOptions, type CompositionPreviewInfo, type SaveCompositionBody, type TokenReason } from './composition/compositionApi.js';
|
|
10
10
|
export { failureMessage, type CompositionEditorEvent, type CompositionEditorState, type DeviceView, type EditorFailure } from './composition/compositionEditorController.js';
|
|
11
|
+
export { EDITOR_MESSAGES, ALL_EDITOR_MESSAGES, checkEditorMessages, provideEditorLanguage, useEditorLanguage, type EditorLanguage, type EditorLanguageHandle, type EditorMessageKey } from './i18n/index.js';
|
package/dist/index.js
CHANGED
|
@@ -12,3 +12,7 @@ export { default as EmbedEditor } from './components/editors/EmbedEditor.svelte'
|
|
|
12
12
|
export { default as CompositionEditorApp } from './components/editors/CompositionEditorApp.svelte';
|
|
13
13
|
export { CompositionApiError, createCompositionApi } from './composition/compositionApi.js';
|
|
14
14
|
export { failureMessage } from './composition/compositionEditorController.js';
|
|
15
|
+
// The words of the editor, in the language of the page: the catalog of English messages, a check for a page's own
|
|
16
|
+
// messages, and what a host that mounts PropsEditor, EmbedEditor or WidgetPreview on their own gives them (the composition
|
|
17
|
+
// editor does it for itself, from its `locale` and `messages`).
|
|
18
|
+
export { EDITOR_MESSAGES, ALL_EDITOR_MESSAGES, checkEditorMessages, provideEditorLanguage, useEditorLanguage } from './i18n/index.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TextDirection } from '@widgetic/design-system/components/textDirection';
|
|
2
|
+
/**
|
|
3
|
+
* The `left` (in pixels, from the left edge of the editor's area) of a box that starts `startLeft` from the left edge of a
|
|
4
|
+
* left to right screen and is `width` wide, on the screen as it is read.
|
|
5
|
+
*
|
|
6
|
+
* On a left to right screen it is `startLeft` itself. On a right to left screen it is the box in the mirror: the box starts
|
|
7
|
+
* the same distance from the right edge, so what sat left of the middle sits right of it, with the same gap.
|
|
8
|
+
*
|
|
9
|
+
* The settings editor and the preview float over the editor's area and are put in place in pixels, because they can be
|
|
10
|
+
* dragged and resized. The mirror is made here, once, when they are docked, so nothing else about them has to know the direction.
|
|
11
|
+
*/
|
|
12
|
+
export declare function leftOnThisScreen(direction: TextDirection, startLeft: number, width: number, areaWidth: number): number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `left` (in pixels, from the left edge of the editor's area) of a box that starts `startLeft` from the left edge of a
|
|
3
|
+
* left to right screen and is `width` wide, on the screen as it is read.
|
|
4
|
+
*
|
|
5
|
+
* On a left to right screen it is `startLeft` itself. On a right to left screen it is the box in the mirror: the box starts
|
|
6
|
+
* the same distance from the right edge, so what sat left of the middle sits right of it, with the same gap.
|
|
7
|
+
*
|
|
8
|
+
* The settings editor and the preview float over the editor's area and are put in place in pixels, because they can be
|
|
9
|
+
* dragged and resized. The mirror is made here, once, when they are docked, so nothing else about them has to know the direction.
|
|
10
|
+
*/
|
|
11
|
+
export function leftOnThisScreen(direction, startLeft, width, areaWidth) {
|
|
12
|
+
return direction === 'rtl' ? areaWidth - startLeft - width : startLeft;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TextDirection } from '@widgetic/design-system/components/textDirection';
|
|
2
|
+
/**
|
|
3
|
+
* The `dir` of the value of a single-line field on a screen that is read in `screenDirection`:
|
|
4
|
+
* - an address (an email, a link): left to right on a right to left screen, nothing on a left to right one;
|
|
5
|
+
* - text a person types: read by its own first letter on a right to left screen (`auto`), nothing on a left to right one.
|
|
6
|
+
* While the field is empty there is no first letter, and `auto` then reads left to right even on a right to left screen,
|
|
7
|
+
* which would put the hint of the field (and the caret) at its left edge: an empty field takes the direction of the screen.
|
|
8
|
+
*
|
|
9
|
+
* A left to right screen is written no attribute at all, as it always was.
|
|
10
|
+
*
|
|
11
|
+
* @param hasValue Whether anything is typed in the field yet (default: yes).
|
|
12
|
+
*/
|
|
13
|
+
export declare function directionOfFieldValue(fieldType: string | undefined, screenDirection: TextDirection, hasValue?: boolean): 'auto' | 'ltr' | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { dirForUserText } from '@widgetic/design-system/components/textDirection';
|
|
2
|
+
/**
|
|
3
|
+
* The kinds of field whose value is an address, which is read left to right on every screen.
|
|
4
|
+
*
|
|
5
|
+
* The `type` a field is given is the name of its kind in the schema (`textInput` for a plain text field, `email`, `url`), not
|
|
6
|
+
* an HTML type, so only these two are addresses and everything else is text a person types. (A first version took `text` for
|
|
7
|
+
* the only text and read every field of a schema as an address: what a visitor typed in Arabic was set from the left.)
|
|
8
|
+
*/
|
|
9
|
+
const ADDRESS_FIELD_TYPES = new Set(['email', 'url']);
|
|
10
|
+
/**
|
|
11
|
+
* The `dir` of the value of a single-line field on a screen that is read in `screenDirection`:
|
|
12
|
+
* - an address (an email, a link): left to right on a right to left screen, nothing on a left to right one;
|
|
13
|
+
* - text a person types: read by its own first letter on a right to left screen (`auto`), nothing on a left to right one.
|
|
14
|
+
* While the field is empty there is no first letter, and `auto` then reads left to right even on a right to left screen,
|
|
15
|
+
* which would put the hint of the field (and the caret) at its left edge: an empty field takes the direction of the screen.
|
|
16
|
+
*
|
|
17
|
+
* A left to right screen is written no attribute at all, as it always was.
|
|
18
|
+
*
|
|
19
|
+
* @param hasValue Whether anything is typed in the field yet (default: yes).
|
|
20
|
+
*/
|
|
21
|
+
export function directionOfFieldValue(fieldType, screenDirection, hasValue = true) {
|
|
22
|
+
if (fieldType && ADDRESS_FIELD_TYPES.has(fieldType.toLowerCase()))
|
|
23
|
+
return screenDirection === 'rtl' ? 'ltr' : undefined;
|
|
24
|
+
return hasValue ? dirForUserText(screenDirection) : undefined;
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widgetic/editor",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dev-sv": "NODE_ENV=development vite dev --port 5180",
|
|
37
37
|
"dev-open": "npm run dev -- --open",
|
|
38
38
|
"render-build": "bash render-build.sh",
|
|
39
|
-
"build": "npm run sync-embed-schema && NODE_ENV=production vite build",
|
|
39
|
+
"build": "npm run sync-embed-schema && NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 vite build",
|
|
40
40
|
"package": "svelte-package",
|
|
41
41
|
"package:watch": "svelte-package --watch",
|
|
42
42
|
"preview": "vite preview",
|