@sveltia/ui 0.31.12 → 0.32.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.
@@ -8,6 +8,7 @@ import {
8
8
  registerCodeHighlighting,
9
9
  } from '@lexical/code';
10
10
  import { registerDragonSupport } from '@lexical/dragon';
11
+ import { HorizontalRuleNode } from '@lexical/extension';
11
12
  import { createEmptyHistoryState, registerHistory } from '@lexical/history';
12
13
  import {
13
14
  LinkNode,
@@ -58,6 +59,7 @@ import {
58
59
  increaseListIndentation,
59
60
  splitMultilineFormatting,
60
61
  } from './markdown.js';
62
+ import { HR } from './transformers/hr.js';
61
63
  import { TABLE } from './transformers/table.js';
62
64
 
63
65
  /**
@@ -70,7 +72,7 @@ import { TABLE } from './transformers/table.js';
70
72
  * } from '../../typedefs';
71
73
  */
72
74
 
73
- const allTransformers = [...TRANSFORMERS, TABLE];
75
+ const allTransformers = [...TRANSFORMERS, HR, TABLE];
74
76
  const prismBaseURL = `https://unpkg.com/prismjs@1.30.0`;
75
77
 
76
78
  /**
@@ -87,6 +89,7 @@ const editorConfig = {
87
89
  ListItemNode,
88
90
  CodeNode,
89
91
  CodeHighlightNode,
92
+ HorizontalRuleNode,
90
93
  TableNode,
91
94
  TableCellNode,
92
95
  TableRowNode,
@@ -204,6 +204,18 @@
204
204
  white-space: normal;
205
205
  word-break: normal;
206
206
  }
207
+ .lexical-root :global(hr) {
208
+ margin: var(--sui-paragraph-margin) 0;
209
+ border: none;
210
+ padding: 0;
211
+ }
212
+ .lexical-root :global(hr::after) {
213
+ display: block;
214
+ height: 2px;
215
+ background-color: var(--sui-control-border-color);
216
+ line-height: 2px;
217
+ content: "";
218
+ }
207
219
 
208
220
  :root[data-theme=light] .lexical-root :global(.token:is(.comment, .prolog, .doctype, .cdata)) {
209
221
  color: slategray;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @import { ElementTransformer } from '@lexical/markdown';
3
+ */
4
+ /**
5
+ * @type {ElementTransformer}
6
+ */
7
+ export const HR: ElementTransformer;
8
+ import type { ElementTransformer } from '@lexical/markdown';
@@ -0,0 +1,34 @@
1
+ // Adopted from https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/plugins/MarkdownTransformers/index.ts
2
+
3
+ /* eslint-disable jsdoc/require-jsdoc */
4
+
5
+ import {
6
+ $createHorizontalRuleNode,
7
+ $isHorizontalRuleNode,
8
+ HorizontalRuleNode,
9
+ } from '@lexical/extension';
10
+
11
+ /**
12
+ * @import { ElementTransformer } from '@lexical/markdown';
13
+ */
14
+
15
+ /**
16
+ * @type {ElementTransformer}
17
+ */
18
+ export const HR = {
19
+ dependencies: [HorizontalRuleNode],
20
+ export: (node) => ($isHorizontalRuleNode(node) ? '***' : null),
21
+ regExp: /^(---|\*\*\*|___)\s?$/,
22
+ replace: (parentNode, _1, _2, isImport) => {
23
+ const line = $createHorizontalRuleNode();
24
+
25
+ if (isImport || parentNode.getNextSibling() !== null) {
26
+ parentNode.replace(line);
27
+ } else {
28
+ parentNode.insertBefore(line);
29
+ }
30
+
31
+ line.selectNext();
32
+ },
33
+ type: 'element',
34
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.31.12",
3
+ "version": "0.32.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -8,18 +8,19 @@
8
8
  "url": "github:sveltia/sveltia-ui"
9
9
  },
10
10
  "dependencies": {
11
- "@lexical/code": "^0.39.0",
12
- "@lexical/dragon": "^0.39.0",
13
- "@lexical/history": "^0.39.0",
14
- "@lexical/link": "^0.39.0",
15
- "@lexical/list": "^0.39.0",
16
- "@lexical/markdown": "^0.39.0",
17
- "@lexical/rich-text": "^0.39.0",
18
- "@lexical/selection": "^0.39.0",
19
- "@lexical/table": "^0.39.0",
20
- "@lexical/utils": "^0.39.0",
11
+ "@lexical/code": "^0.40.0",
12
+ "@lexical/dragon": "^0.40.0",
13
+ "@lexical/extension": "^0.40.0",
14
+ "@lexical/history": "^0.40.0",
15
+ "@lexical/link": "^0.40.0",
16
+ "@lexical/list": "^0.40.0",
17
+ "@lexical/markdown": "^0.40.0",
18
+ "@lexical/rich-text": "^0.40.0",
19
+ "@lexical/selection": "^0.40.0",
20
+ "@lexical/table": "^0.40.0",
21
+ "@lexical/utils": "^0.40.0",
21
22
  "@sveltia/utils": "^0.8.6",
22
- "lexical": "^0.39.0",
23
+ "lexical": "^0.40.0",
23
24
  "prismjs": "^1.30.0",
24
25
  "svelte-i18n": "^4.0.1"
25
26
  },
@@ -28,31 +29,32 @@
28
29
  },
29
30
  "devDependencies": {
30
31
  "@sveltejs/adapter-auto": "^7.0.0",
31
- "@sveltejs/kit": "^2.50.0",
32
+ "@sveltejs/kit": "^2.50.2",
32
33
  "@sveltejs/package": "^2.5.7",
33
34
  "@sveltejs/vite-plugin-svelte": "^6.2.4",
34
- "cspell": "^9.6.0",
35
+ "@vitest/coverage-v8": "^4.0.18",
36
+ "cspell": "^9.6.4",
35
37
  "eslint": "^8.57.1",
36
38
  "eslint-config-airbnb-base": "^15.0.0",
37
39
  "eslint-config-prettier": "^10.1.8",
38
40
  "eslint-plugin-import": "^2.32.0",
39
- "eslint-plugin-jsdoc": "^62.2.0",
41
+ "eslint-plugin-jsdoc": "^62.5.1",
40
42
  "eslint-plugin-svelte": "^2.46.1",
41
- "oxlint": "^1.41.0",
43
+ "oxlint": "^1.43.0",
42
44
  "postcss": "^8.5.6",
43
45
  "postcss-html": "^1.8.1",
44
- "prettier": "^3.8.0",
46
+ "prettier": "^3.8.1",
45
47
  "prettier-plugin-svelte": "^3.4.1",
46
- "sass": "^1.97.2",
47
- "stylelint": "^17.0.0",
48
+ "sass": "^1.97.3",
49
+ "stylelint": "^17.1.1",
48
50
  "stylelint-config-recommended-scss": "^17.0.0",
49
51
  "stylelint-scss": "^7.0.0",
50
- "svelte": "^5.47.1",
51
- "svelte-check": "^4.3.5",
52
+ "svelte": "^5.49.2",
53
+ "svelte-check": "^4.3.6",
52
54
  "svelte-preprocess": "^6.0.3",
53
55
  "tslib": "^2.8.1",
54
56
  "vite": "^7.3.1",
55
- "vitest": "^4.0.17"
57
+ "vitest": "^4.0.18"
56
58
  },
57
59
  "exports": {
58
60
  ".": {