@sveltia/ui 0.23.2 → 0.24.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.
Files changed (33) hide show
  1. package/dist/components/text-editor/code-editor.svelte +121 -0
  2. package/dist/components/text-editor/code-editor.svelte.d.ts +106 -0
  3. package/dist/components/text-editor/core.d.ts +3 -4
  4. package/dist/components/text-editor/core.js +78 -33
  5. package/dist/components/text-editor/lexical-root.svelte +42 -19
  6. package/dist/components/text-editor/lexical-root.svelte.d.ts +1 -9
  7. package/dist/components/text-editor/store.svelte.d.ts +1 -0
  8. package/dist/components/text-editor/store.svelte.js +120 -0
  9. package/dist/components/text-editor/text-editor.svelte +21 -86
  10. package/dist/components/text-editor/toolbar/code-editor-toolbar.svelte +28 -0
  11. package/dist/components/text-editor/toolbar/{editor-toolbar.svelte.d.ts → code-editor-toolbar.svelte.d.ts} +3 -3
  12. package/dist/components/text-editor/toolbar/code-language-switcher.svelte +96 -0
  13. package/dist/components/text-editor/toolbar/code-language-switcher.svelte.d.ts +17 -0
  14. package/dist/components/text-editor/toolbar/format-text-button.svelte +10 -10
  15. package/dist/components/text-editor/toolbar/insert-image-button.svelte +5 -8
  16. package/dist/components/text-editor/toolbar/insert-link-button.svelte +27 -25
  17. package/dist/components/text-editor/toolbar/insert-menu-button.svelte +4 -7
  18. package/dist/components/text-editor/toolbar/{editor-toolbar.svelte → text-editor-toolbar.svelte} +59 -87
  19. package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte.d.ts +37 -0
  20. package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte +14 -17
  21. package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +58 -0
  22. package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte.d.ts +37 -0
  23. package/dist/components/util/app-shell.svelte +2 -2
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +1 -0
  26. package/dist/locales/en.d.ts +3 -0
  27. package/dist/locales/en.js +3 -0
  28. package/dist/locales/ja.d.ts +3 -0
  29. package/dist/locales/ja.js +3 -0
  30. package/dist/styles/variables.scss +2 -2
  31. package/dist/typedefs.d.ts +59 -26
  32. package/dist/typedefs.js +26 -13
  33. package/package.json +5 -5
package/dist/typedefs.js CHANGED
@@ -239,23 +239,36 @@
239
239
  */
240
240
 
241
241
  /**
242
- * @typedef {object} TextEditorState
243
- * @property {import('svelte/store').Writable<import('lexical').LexicalEditor>} editor - Lexical
244
- * editor instance.
245
- * @property {import('svelte/store').Writable<string>} editorId - Random ID assigned to the editor.
246
- * @property {import('svelte/store').Writable<TextEditorBlockType>} selectionBlockType - Block level
247
- * type of the current selection.
248
- * @property {import('svelte/store').Writable<TextEditorInlineType[]>} selectionInlineTypes - Inline
249
- * level types of the current selection.
242
+ * @typedef {object} TextEditorConfig
250
243
  * @property {TextEditorMode[]} modes - Enabled modes.
251
- * @property {import('svelte/store').Writable<boolean>} useRichText - Whether to use rich text mode.
252
- * If `false`, the editor shows the plain text editor.
253
- * @property {import('svelte/store').Writable<boolean>} hasConverterError - `true` if there was an
254
- * error while converting Markdown to Lexical nodes.
255
244
  * @property {(TextEditorBlockType | TextEditorInlineType)[]} enabledButtons - Enabled buttons for
256
245
  * the editor.
257
246
  * @property {TextEditorComponent[]} components - Editor components.
258
- * @property {Function} convertMarkdown - Function to trigger the Lexical converter.
247
+ * @property {boolean} isCodeEditor - Whether the editor is used as a code editor.
248
+ * @property {string} [defaultLanguage] - Default language for the code editor.
249
+ */
250
+
251
+ /**
252
+ * @typedef {object} TextEditorSelectionState
253
+ * @property {?string} blockNodeKey - Block level node key.
254
+ * @property {TextEditorBlockType} blockType - Block level type of the current selection.
255
+ * @property {TextEditorInlineType[]} inlineTypes - Inline level types of the current selection.
256
+ */
257
+
258
+ /**
259
+ * @typedef {object} TextEditorStore
260
+ * @property {import('lexical').LexicalEditor | undefined} editor - Lexical editor instance.
261
+ * @property {boolean} initialized - Whether the Lexical editor is initialized.
262
+ * @property {string} editorId - Random ID assigned to the editor.
263
+ * @property {TextEditorConfig} config - Editor configuration.
264
+ * @property {string} inputValue - Value entered the Lexical editor.
265
+ * @property {TextEditorSelectionState} selection - Current selection state.
266
+ * @property {boolean} useRichText - Whether to use rich text mode. If `false`, the editor shows the
267
+ * plain text editor.
268
+ * @property {boolean} hasConverterError - Whether there was an error while converting Markdown to
269
+ * Lexical nodes.
270
+ * @property {boolean} showConverterError - Whether to show a converter error in the UI.
271
+ * @property {() => Promise<void>} convertMarkdown - Function to trigger the Lexical converter.
259
272
  */
260
273
 
261
274
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.23.2",
3
+ "version": "0.24.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -58,15 +58,15 @@
58
58
  "eslint-plugin-import": "^2.31.0",
59
59
  "eslint-plugin-jsdoc": "^50.6.3",
60
60
  "eslint-plugin-svelte": "^2.46.1",
61
- "postcss": "^8.5.1",
61
+ "postcss": "^8.5.2",
62
62
  "postcss-html": "^1.8.0",
63
- "prettier": "^3.5.0",
63
+ "prettier": "^3.5.1",
64
64
  "prettier-plugin-svelte": "^3.3.3",
65
- "sass": "^1.84.0",
65
+ "sass": "^1.85.0",
66
66
  "stylelint": "^16.14.1",
67
67
  "stylelint-config-recommended-scss": "^14.1.0",
68
68
  "stylelint-scss": "^6.11.0",
69
- "svelte": "5.19.9",
69
+ "svelte": "5.20.0",
70
70
  "svelte-check": "^4.1.4",
71
71
  "svelte-i18n": "^4.0.1",
72
72
  "svelte-preprocess": "^6.0.3",