@sveltia/ui 0.77.3 → 0.78.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/dist/components/dialog/dialog.svelte +7 -4
- package/dist/components/text-editor/constants.d.ts +5 -0
- package/dist/components/text-editor/constants.js +6 -0
- package/dist/components/text-editor/core.d.ts +6 -2
- package/dist/components/text-editor/core.js +316 -46
- package/dist/components/text-editor/lexical-root.svelte +39 -3
- package/dist/components/text-editor/raw-markdown.d.ts +90 -0
- package/dist/components/text-editor/raw-markdown.js +471 -0
- package/dist/components/text-editor/shiki/facade.d.ts +4 -0
- package/dist/components/text-editor/shiki/facade.js +62 -0
- package/dist/components/text-editor/shiki/theme.d.ts +1 -0
- package/dist/components/text-editor/shiki/theme.js +31 -27
- package/dist/components/text-editor/shiki/version.d.ts +1 -1
- package/dist/components/text-editor/shiki/version.js +1 -1
- package/dist/components/text-editor/store.svelte.js +39 -1
- package/dist/components/text-editor/text-editor.svelte +137 -1
- package/dist/components/text-editor/text-editor.svelte.d.ts +19 -3
- package/dist/components/text-editor/toolbar/component-editor.svelte +96 -0
- package/dist/components/text-editor/toolbar/component-editor.svelte.d.ts +35 -0
- package/dist/components/text-editor/toolbar/format-text-button.svelte +69 -9
- package/dist/components/text-editor/toolbar/insert-component-dialog.svelte +92 -0
- package/dist/components/text-editor/toolbar/insert-component-dialog.svelte.d.ts +30 -0
- package/dist/components/text-editor/toolbar/insert-item-button.svelte +13 -2
- package/dist/components/text-editor/toolbar/insert-link-button.svelte +89 -10
- package/dist/components/text-editor/toolbar/insert-menu-button.svelte +21 -2
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte +4 -4
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte +13 -0
- package/dist/components/text-field/text-area.svelte +119 -4
- package/dist/components/text-field/text-area.svelte.d.ts +17 -0
- package/dist/components/util/font-links.svelte +1 -1
- package/dist/components/util/fonts.js +1 -1
- package/dist/self-hosted/fonts/material-symbols-outlined-latin-wght-normal.woff2 +0 -0
- package/dist/services/group.svelte.d.ts +1 -1
- package/dist/services/group.svelte.js +14 -6
- package/dist/services/tree.svelte.d.ts +6 -1
- package/dist/services/tree.svelte.js +23 -7
- package/dist/typedefs.d.ts +49 -1
- package/dist/typedefs.js +22 -1
- package/package.json +2 -2
package/dist/typedefs.d.ts
CHANGED
|
@@ -273,7 +273,8 @@ export type DialogProps = {
|
|
|
273
273
|
/**
|
|
274
274
|
* Whether to automatically focus the first input field or primary
|
|
275
275
|
* action button. Default: `true`. If `false`, or if the dialog has neither, the `<dialog>` element
|
|
276
|
-
* gets focused instead, so the focus is always moved into the modal.
|
|
276
|
+
* gets focused instead, so the focus is always moved into the modal. The focus is left alone if it
|
|
277
|
+
* has already moved into the dialog content by then, like when the user has clicked an input field.
|
|
277
278
|
*/
|
|
278
279
|
focusInput?: boolean | undefined;
|
|
279
280
|
/**
|
|
@@ -862,6 +863,32 @@ export type CodeHighlighterLoaders = {
|
|
|
862
863
|
*/
|
|
863
864
|
loadTheme: (id: string) => Promise<any>;
|
|
864
865
|
};
|
|
866
|
+
/**
|
|
867
|
+
* Syntax-highlighted fragment of text, as painted behind a `<textarea>`.
|
|
868
|
+
*/
|
|
869
|
+
export type HighlightedToken = {
|
|
870
|
+
/**
|
|
871
|
+
* Text content.
|
|
872
|
+
*/
|
|
873
|
+
content: string;
|
|
874
|
+
/**
|
|
875
|
+
* CSS colour. The text’s default colour is used when omitted.
|
|
876
|
+
*/
|
|
877
|
+
color?: string | undefined;
|
|
878
|
+
/**
|
|
879
|
+
* Whether to embolden the text. It’s rendered with a stroke, so the text
|
|
880
|
+
* width doesn’t change.
|
|
881
|
+
*/
|
|
882
|
+
bold?: boolean | undefined;
|
|
883
|
+
/**
|
|
884
|
+
* Whether to underline the text.
|
|
885
|
+
*/
|
|
886
|
+
underline?: boolean | undefined;
|
|
887
|
+
/**
|
|
888
|
+
* Whether to strike through the text.
|
|
889
|
+
*/
|
|
890
|
+
strikethrough?: boolean | undefined;
|
|
891
|
+
};
|
|
865
892
|
/**
|
|
866
893
|
* Web font used by the components, published on Fontsource.
|
|
867
894
|
*/
|
|
@@ -990,6 +1017,16 @@ export type TextEditorStore = {
|
|
|
990
1017
|
* plain text editor.
|
|
991
1018
|
*/
|
|
992
1019
|
useRichText: boolean;
|
|
1020
|
+
/**
|
|
1021
|
+
* The `<textarea>` element of the plain text
|
|
1022
|
+
* mode.
|
|
1023
|
+
*/
|
|
1024
|
+
textArea: HTMLTextAreaElement | undefined;
|
|
1025
|
+
/**
|
|
1026
|
+
* ID of the editable element currently shown: the Lexical root in the
|
|
1027
|
+
* rich text mode, or the `<textarea>` in the plain text mode.
|
|
1028
|
+
*/
|
|
1029
|
+
controlId: string;
|
|
993
1030
|
/**
|
|
994
1031
|
* Whether there was an error while converting Markdown to
|
|
995
1032
|
* Lexical nodes.
|
|
@@ -999,10 +1036,21 @@ export type TextEditorStore = {
|
|
|
999
1036
|
* Whether to show a converter error in the UI.
|
|
1000
1037
|
*/
|
|
1001
1038
|
showConverterError: boolean;
|
|
1039
|
+
/**
|
|
1040
|
+
* Whether the user has changed the rich text content, and the editor
|
|
1041
|
+
* has yet to convert it to Markdown and update {@link TextEditorStore.inputValue}.
|
|
1042
|
+
*/
|
|
1043
|
+
pending: boolean;
|
|
1002
1044
|
/**
|
|
1003
1045
|
* Function to trigger the Lexical converter.
|
|
1004
1046
|
*/
|
|
1005
1047
|
convertMarkdown: () => Promise<void>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Function to check if the given value,
|
|
1050
|
+
* exported by the editor, is only the {@link TextEditorStore.inputValue} last imported, written in
|
|
1051
|
+
* the editor’s own Markdown style, e.g. `_text_` for `*text*`, rather than a change.
|
|
1052
|
+
*/
|
|
1053
|
+
isRestyledImport: (value: string) => boolean;
|
|
1006
1054
|
};
|
|
1007
1055
|
export type SelectedItemDetail = {
|
|
1008
1056
|
/**
|
package/dist/typedefs.js
CHANGED
|
@@ -100,7 +100,8 @@
|
|
|
100
100
|
* @property {boolean} [cancelDisabled] Whether to disable the Cancel button.
|
|
101
101
|
* @property {boolean} [focusInput] Whether to automatically focus the first input field or primary
|
|
102
102
|
* action button. Default: `true`. If `false`, or if the dialog has neither, the `<dialog>` element
|
|
103
|
-
* gets focused instead, so the focus is always moved into the modal.
|
|
103
|
+
* gets focused instead, so the focus is always moved into the modal. The focus is left alone if it
|
|
104
|
+
* has already moved into the dialog content by then, like when the user has clicked an input field.
|
|
104
105
|
* @property {boolean} [lightDismiss] Whether to close the modal when the backdrop (outside of the
|
|
105
106
|
* modal) is clicked.
|
|
106
107
|
* @property {string} [value] Value entered on the textbox.
|
|
@@ -369,6 +370,17 @@
|
|
|
369
370
|
* @property {(id: string) => Promise<any>} loadTheme Load a theme by ID.
|
|
370
371
|
*/
|
|
371
372
|
|
|
373
|
+
/**
|
|
374
|
+
* Syntax-highlighted fragment of text, as painted behind a `<textarea>`.
|
|
375
|
+
* @typedef {object} HighlightedToken
|
|
376
|
+
* @property {string} content Text content.
|
|
377
|
+
* @property {string} [color] CSS colour. The text’s default colour is used when omitted.
|
|
378
|
+
* @property {boolean} [bold] Whether to embolden the text. It’s rendered with a stroke, so the text
|
|
379
|
+
* width doesn’t change.
|
|
380
|
+
* @property {boolean} [underline] Whether to underline the text.
|
|
381
|
+
* @property {boolean} [strikethrough] Whether to strike through the text.
|
|
382
|
+
*/
|
|
383
|
+
|
|
372
384
|
/**
|
|
373
385
|
* Web font used by the components, published on Fontsource.
|
|
374
386
|
* @typedef {object} FontDefinition
|
|
@@ -423,10 +435,19 @@
|
|
|
423
435
|
* @property {TextEditorSelectionState} selection Current selection state.
|
|
424
436
|
* @property {boolean} useRichText Whether to use rich text mode. If `false`, the editor shows the
|
|
425
437
|
* plain text editor.
|
|
438
|
+
* @property {HTMLTextAreaElement | undefined} textArea The `<textarea>` element of the plain text
|
|
439
|
+
* mode.
|
|
440
|
+
* @property {string} controlId ID of the editable element currently shown: the Lexical root in the
|
|
441
|
+
* rich text mode, or the `<textarea>` in the plain text mode.
|
|
426
442
|
* @property {boolean} hasConverterError Whether there was an error while converting Markdown to
|
|
427
443
|
* Lexical nodes.
|
|
428
444
|
* @property {boolean} showConverterError Whether to show a converter error in the UI.
|
|
445
|
+
* @property {boolean} pending Whether the user has changed the rich text content, and the editor
|
|
446
|
+
* has yet to convert it to Markdown and update {@link TextEditorStore.inputValue}.
|
|
429
447
|
* @property {() => Promise<void>} convertMarkdown Function to trigger the Lexical converter.
|
|
448
|
+
* @property {(value: string) => boolean} isRestyledImport Function to check if the given value,
|
|
449
|
+
* exported by the editor, is only the {@link TextEditorStore.inputValue} last imported, written in
|
|
450
|
+
* the editor’s own Markdown style, e.g. `_text_` for `*text*`, rather than a change.
|
|
430
451
|
*/
|
|
431
452
|
|
|
432
453
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.0",
|
|
4
4
|
"description": "A collection of Svelte components and utilities for building user interfaces.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"lexical": "^0.51.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@fontsource-variable/material-symbols-outlined": "5.3.
|
|
64
|
+
"@fontsource-variable/material-symbols-outlined": "5.3.8",
|
|
65
65
|
"@fontsource-variable/source-sans-3": "5.3.0",
|
|
66
66
|
"@fontsource/noto-mono": "5.3.0",
|
|
67
67
|
"@rollup/plugin-yaml": "^5.0.0",
|