@sveltia/ui 0.42.1 → 0.43.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.
@@ -28,6 +28,7 @@ import {
28
28
  ListNode,
29
29
  } from '@lexical/list';
30
30
  import {
31
+ CODE,
31
32
  $convertFromMarkdownString as convertFromMarkdownString,
32
33
  $convertToMarkdownString as convertToMarkdownString,
33
34
  registerMarkdownShortcuts,
@@ -210,11 +211,11 @@ export const initEditor = ({
210
211
  .filter(([button]) => enabledButtons.includes(/** @type {TextEditorNodeType} */ (button)))
211
212
  .flatMap(([, nodes]) => nodes),
212
213
  ),
213
- ...(isCodeEditor ? [CodeNode, CodeHighlightNode] : []),
214
- HorizontalRuleNode,
215
- TableNode,
216
- TableCellNode,
217
- TableRowNode,
214
+ ...(isCodeEditor
215
+ ? [CodeNode, CodeHighlightNode]
216
+ : // We haven’t implemented buttons for horizontal rules and tables yet, but we still want
217
+ // to support them in Markdown, so always include them in the node list
218
+ [HorizontalRuleNode, TableNode, TableCellNode, TableRowNode]),
218
219
  ],
219
220
  theme: EDITOR_THEME,
220
221
  };
@@ -227,8 +228,10 @@ export const initEditor = ({
227
228
  .filter(([button]) => enabledButtons.includes(/** @type {TextEditorNodeType} */ (button)))
228
229
  .flatMap(([, transformers]) => transformers),
229
230
  ),
230
- HR,
231
- TABLE,
231
+ ...(isCodeEditor
232
+ ? [CODE]
233
+ : // See the comment above for why we always include horizontal rules and tables
234
+ [HR, TABLE]),
232
235
  ];
233
236
 
234
237
  const editor = createEditor(editorConfig);
@@ -6,7 +6,6 @@
6
6
  -->
7
7
  <script>
8
8
  import { onMount } from 'svelte';
9
- import { initLocales } from '../../services/i18n';
10
9
 
11
10
  /**
12
11
  * @import { Snippet } from 'svelte';
@@ -39,10 +38,6 @@
39
38
 
40
39
  let fontLoaded = $state(false);
41
40
 
42
- $effect.pre(() => {
43
- initLocales();
44
- });
45
-
46
41
  onMount(() => {
47
42
  const mediaQuery = globalThis.matchMedia('(prefers-color-scheme: dark)');
48
43
  const { dataset } = document.documentElement;
@@ -15,8 +15,8 @@ export const resources = Object.fromEntries(
15
15
  );
16
16
 
17
17
  /**
18
- * Load strings and initialize the locales. Consumers can use this function to load the localized
19
- * strings for their application. If `<AppShell>` is used, this function is called automatically.
18
+ * Load strings and initialize the locales. Consumers can use this function or {@link resources} to
19
+ * load the localized strings for their application.
20
20
  * @param {object} [init] Initialize options.
21
21
  * @param {string} [init.fallbackLocale] Fallback locale.
22
22
  * @param {string} [init.initialLocale] Initial locale.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.42.1",
3
+ "version": "0.43.0",
4
4
  "description": "A collection of Svelte components and utilities for building user interfaces.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  "@lexical/selection": "^0.47.0",
46
46
  "@lexical/table": "^0.47.0",
47
47
  "@lexical/utils": "^0.47.0",
48
- "@sveltia/i18n": "^1.1.2",
48
+ "@sveltia/i18n": "^1.1.3",
49
49
  "@sveltia/utils": "^0.10.7",
50
50
  "lexical": "^0.47.0",
51
51
  "prismjs": "^1.30.0"