@haklex/rich-ext-code-snippet 0.4.1 → 0.6.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 (42) hide show
  1. package/README.md +45 -25
  2. package/dist/CodeEditorModal.d.ts +1 -1
  3. package/dist/CodeEditorModal.d.ts.map +1 -1
  4. package/dist/CodeSnippetEditDecorator.d.ts +1 -1
  5. package/dist/CodeSnippetEditDecorator.d.ts.map +1 -1
  6. package/dist/CodeSnippetEditRenderer.d.ts +1 -1
  7. package/dist/CodeSnippetEditRenderer.d.ts.map +1 -1
  8. package/dist/CodeSnippetNode-DD50J5NW.js +103 -0
  9. package/dist/{transformer-BK2M_fTu.js → CodeSnippetRenderer-BNGQYBtp.js} +7 -101
  10. package/dist/CodeSnippetRenderer.d.ts +1 -1
  11. package/dist/CodeSnippetRenderer.d.ts.map +1 -1
  12. package/dist/augment.d.ts +9 -0
  13. package/dist/augment.d.ts.map +1 -0
  14. package/dist/edit-BpfJ1A_-.js +416 -0
  15. package/dist/edit.d.ts +6 -0
  16. package/dist/edit.d.ts.map +1 -0
  17. package/dist/edit.mjs +2 -0
  18. package/dist/index.d.ts +3 -8
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.mjs +6 -416
  21. package/dist/node-DEOtFSlD.js +6 -0
  22. package/dist/node.d.ts +8 -0
  23. package/dist/node.d.ts.map +1 -0
  24. package/dist/node.mjs +3 -0
  25. package/dist/nodes/CodeSnippetEditNode.d.ts +1 -1
  26. package/dist/nodes/CodeSnippetEditNode.d.ts.map +1 -1
  27. package/dist/nodes/CodeSnippetNode.d.ts +1 -1
  28. package/dist/nodes/CodeSnippetNode.d.ts.map +1 -1
  29. package/dist/renderer.d.ts +5 -0
  30. package/dist/renderer.d.ts.map +1 -0
  31. package/dist/renderer.mjs +5 -0
  32. package/dist/rich-ext-code-snippet.css +1 -1
  33. package/dist/slot.d.ts +8 -0
  34. package/dist/slot.d.ts.map +1 -0
  35. package/dist/static.d.ts +2 -6
  36. package/dist/static.d.ts.map +1 -1
  37. package/dist/static.mjs +5 -5
  38. package/dist/types.d.ts +10 -0
  39. package/dist/types.d.ts.map +1 -0
  40. package/package.json +20 -8
  41. package/dist/nodes/index.d.ts +0 -7
  42. package/dist/nodes/index.d.ts.map +0 -1
package/README.md CHANGED
@@ -10,10 +10,10 @@ pnpm add @haklex/rich-ext-code-snippet
10
10
 
11
11
  ## Peer Dependencies
12
12
 
13
- | Package | Version |
14
- | --- | --- |
13
+ | Package | Version |
14
+ | --------- | --------- |
15
15
  | `lexical` | `^0.41.0` |
16
- | `react` | `>= 19` |
16
+ | `react` | `>= 19` |
17
17
 
18
18
  Key runtime dependencies include `@codemirror/*` (editor engine), `@dnd-kit/*` (drag-and-drop), and `shiki` (syntax highlighting).
19
19
 
@@ -21,45 +21,58 @@ Key runtime dependencies include `@codemirror/*` (editor engine), `@dnd-kit/*` (
21
21
 
22
22
  ### Register nodes in your editor config
23
23
 
24
+ Edit (read + write):
25
+
24
26
  ```ts
25
- import { codeSnippetEditNodes } from '@haklex/rich-ext-code-snippet'
27
+ import { codeSnippetEditNodes } from '@haklex/rich-ext-code-snippet/edit';
26
28
 
27
- // Add to your Lexical editor node list
28
- const editorConfig = {
29
- nodes: [...codeSnippetEditNodes],
30
- }
29
+ const editorConfig = { nodes: [...codeSnippetEditNodes] };
31
30
  ```
32
31
 
33
- For static/read-only rendering:
32
+ Static / read-only:
34
33
 
35
34
  ```ts
36
- import { codeSnippetNodes } from '@haklex/rich-ext-code-snippet/static'
35
+ import { codeSnippetNodes } from '@haklex/rich-ext-code-snippet/node';
37
36
 
38
- const staticConfig = {
39
- nodes: [...codeSnippetNodes],
40
- }
37
+ const staticConfig = { nodes: [...codeSnippetNodes] };
41
38
  ```
42
39
 
43
40
  ### Use renderers
44
41
 
45
42
  ```tsx
46
- import { CodeSnippetEditRenderer } from '@haklex/rich-ext-code-snippet'
47
- import { CodeSnippetRenderer } from '@haklex/rich-ext-code-snippet/static'
43
+ import { CodeSnippetEditRenderer } from '@haklex/rich-ext-code-snippet/edit';
44
+ import { CodeSnippetRenderer } from '@haklex/rich-ext-code-snippet/renderer';
48
45
  ```
49
46
 
50
47
  ### Markdown transformer
51
48
 
52
49
  ```ts
53
- import { CODE_SNIPPET_BLOCK_TRANSFORMER } from '@haklex/rich-ext-code-snippet'
50
+ import { CODE_SNIPPET_BLOCK_TRANSFORMER } from '@haklex/rich-ext-code-snippet/node';
54
51
 
55
- // Add to your Lexical markdown transformers array
56
- const transformers = [CODE_SNIPPET_BLOCK_TRANSFORMER]
52
+ const transformers = [CODE_SNIPPET_BLOCK_TRANSFORMER];
57
53
  ```
58
54
 
55
+ ### Tree-shake the default renderer
56
+
57
+ The default `CodeSnippetRenderer` is **not** statically imported by `CodeSnippetNode`. Register a custom renderer through `RendererConfig` to drop the heavy default chunk:
58
+
59
+ ```ts
60
+ import { CODE_SNIPPET_NODE_KEY, codeSnippetNodes } from '@haklex/rich-ext-code-snippet/node';
61
+ import type { RichRendererModule } from '@haklex/rich-compose';
62
+
63
+ const lightModule: RichRendererModule = {
64
+ name: 'code-snippet',
65
+ nodes: codeSnippetNodes,
66
+ renderers: { [CODE_SNIPPET_NODE_KEY]: MyLightCodeSnippet },
67
+ };
68
+ ```
69
+
70
+ `@haklex/rich-compose`'s `codeSnippetModule` lazy-loads the default renderer via `lazyRenderers`; the override pattern above bypasses it entirely.
71
+
59
72
  ### Import styles
60
73
 
61
74
  ```ts
62
- import '@haklex/rich-ext-code-snippet/style.css'
75
+ import '@haklex/rich-ext-code-snippet/style.css';
63
76
  ```
64
77
 
65
78
  ## Exports
@@ -77,17 +90,24 @@ import '@haklex/rich-ext-code-snippet/style.css'
77
90
  - `CodeSnippetRenderer` -- static renderer (no heavy UI deps)
78
91
  - `CodeSnippetEditRenderer` -- edit renderer with CodeMirror, drag-and-drop tabs
79
92
 
93
+ ### Slot Key
94
+
95
+ - `CODE_SNIPPET_NODE_KEY` -- `'CodeSnippet'` constant for `RendererConfig` slot lookup
96
+
80
97
  ### Transformers
81
98
 
82
99
  - `CODE_SNIPPET_BLOCK_TRANSFORMER` -- Markdown block transformer
83
100
 
84
- ### Sub-path Exports
101
+ ## Sub-path Exports
85
102
 
86
- | Path | Description |
87
- | --- | --- |
88
- | `@haklex/rich-ext-code-snippet` | Full exports (edit + static) |
89
- | `@haklex/rich-ext-code-snippet/static` | Static-only (no CodeMirror/dnd-kit deps) |
90
- | `@haklex/rich-ext-code-snippet/style.css` | Stylesheet |
103
+ | Path | Description |
104
+ | ----------------------------------------- | --------------------------------------------------------- |
105
+ | `@haklex/rich-ext-code-snippet` | Full exports (node + renderer + edit) |
106
+ | `@haklex/rich-ext-code-snippet/node` | Lightweight node + slot key + types — no default renderer |
107
+ | `@haklex/rich-ext-code-snippet/renderer` | Default `CodeSnippetRenderer` (heavy) |
108
+ | `@haklex/rich-ext-code-snippet/edit` | Edit-mode node + `CodeSnippetEditRenderer` |
109
+ | `@haklex/rich-ext-code-snippet/static` | Convenience: node + renderer (SSR bundle) |
110
+ | `@haklex/rich-ext-code-snippet/style.css` | Stylesheet |
91
111
 
92
112
  ## Part of Haklex
93
113
 
@@ -1,6 +1,6 @@
1
1
  import { ColorScheme } from '@haklex/rich-editor';
2
- import { CodeFile } from '@haklex/rich-editor/renderers';
3
2
  import { FC } from 'react';
3
+ import { CodeFile } from './types';
4
4
  export interface CodeEditorModalProps {
5
5
  colorScheme: ColorScheme;
6
6
  dismiss: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditorModal.d.ts","sourceRoot":"","sources":["../src/CodeEditorModal.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAK9D,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAC;AAO/C,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;CAC7C;AA8FD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAmSpD,CAAC"}
1
+ {"version":3,"file":"CodeEditorModal.d.ts","sourceRoot":"","sources":["../src/CodeEditorModal.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAC;AAK/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;CAC7C;AA8FD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAmSpD,CAAC"}
@@ -1,6 +1,6 @@
1
- import { CodeFile } from '@haklex/rich-editor/renderers';
2
1
  import { NodeKey } from 'lexical';
3
2
  import { FC } from 'react';
3
+ import { CodeFile } from './types';
4
4
  export interface CodeSnippetEditDecoratorProps {
5
5
  files: CodeFile[];
6
6
  nodeKey: NodeKey;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeSnippetEditDecorator.d.ts","sourceRoot":"","sources":["../src/CodeSnippetEditDecorator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CAgBtE,CAAC"}
1
+ {"version":3,"file":"CodeSnippetEditDecorator.d.ts","sourceRoot":"","sources":["../src/CodeSnippetEditDecorator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CAgBtE,CAAC"}
@@ -1,5 +1,5 @@
1
- import { CodeFile } from '@haklex/rich-editor/renderers';
2
1
  import { FC } from 'react';
2
+ import { CodeFile } from './types';
3
3
  export interface CodeSnippetEditRendererProps {
4
4
  files: CodeFile[];
5
5
  onFilesChange?: (files: CodeFile[]) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeSnippetEditRenderer.d.ts","sourceRoot":"","sources":["../src/CodeSnippetEditRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAI9D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAahC,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CAyCpE,CAAC"}
1
+ {"version":3,"file":"CodeSnippetEditRenderer.d.ts","sourceRoot":"","sources":["../src/CodeSnippetEditRenderer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAYhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CAyCpE,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { DecoratorNode } from "lexical";
2
+ import { createRendererDecoration } from "@haklex/rich-editor/renderers";
3
+ //#region src/slot.ts
4
+ /**
5
+ * RendererConfig slot key for `@haklex/rich-ext-code-snippet`.
6
+ *
7
+ * Override modules should reference this constant instead of the bare string
8
+ * literal so renames stay searchable across the workspace.
9
+ */
10
+ var CODE_SNIPPET_NODE_KEY = "CodeSnippet";
11
+ //#endregion
12
+ //#region \0@oxc-project+runtime@0.127.0/helpers/typeof.js
13
+ function _typeof(o) {
14
+ "@babel/helpers - typeof";
15
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
16
+ return typeof o;
17
+ } : function(o) {
18
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
19
+ }, _typeof(o);
20
+ }
21
+ //#endregion
22
+ //#region \0@oxc-project+runtime@0.127.0/helpers/toPrimitive.js
23
+ function toPrimitive(t, r) {
24
+ if ("object" != _typeof(t) || !t) return t;
25
+ var e = t[Symbol.toPrimitive];
26
+ if (void 0 !== e) {
27
+ var i = e.call(t, r || "default");
28
+ if ("object" != _typeof(i)) return i;
29
+ throw new TypeError("@@toPrimitive must return a primitive value.");
30
+ }
31
+ return ("string" === r ? String : Number)(t);
32
+ }
33
+ //#endregion
34
+ //#region \0@oxc-project+runtime@0.127.0/helpers/toPropertyKey.js
35
+ function toPropertyKey(t) {
36
+ var i = toPrimitive(t, "string");
37
+ return "symbol" == _typeof(i) ? i : i + "";
38
+ }
39
+ //#endregion
40
+ //#region \0@oxc-project+runtime@0.127.0/helpers/defineProperty.js
41
+ function _defineProperty(e, r, t) {
42
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
43
+ value: t,
44
+ enumerable: !0,
45
+ configurable: !0,
46
+ writable: !0
47
+ }) : e[r] = t, e;
48
+ }
49
+ //#endregion
50
+ //#region src/nodes/CodeSnippetNode.ts
51
+ var CodeSnippetNode = class CodeSnippetNode extends DecoratorNode {
52
+ static getType() {
53
+ return "code-snippet";
54
+ }
55
+ static clone(node) {
56
+ return new CodeSnippetNode(node.__files, node.__key);
57
+ }
58
+ constructor(files, key) {
59
+ super(key);
60
+ _defineProperty(this, "__files", void 0);
61
+ this.__files = files;
62
+ }
63
+ createDOM(_config) {
64
+ const div = document.createElement("div");
65
+ div.className = "rich-code-snippet";
66
+ return div;
67
+ }
68
+ updateDOM() {
69
+ return false;
70
+ }
71
+ isInline() {
72
+ return false;
73
+ }
74
+ static importJSON(serializedNode) {
75
+ return $createCodeSnippetNode(serializedNode.files);
76
+ }
77
+ exportJSON() {
78
+ return {
79
+ ...super.exportJSON(),
80
+ type: "code-snippet",
81
+ files: this.__files,
82
+ version: 1
83
+ };
84
+ }
85
+ getFiles() {
86
+ return this.getLatest().__files;
87
+ }
88
+ setFiles(files) {
89
+ const writable = this.getWritable();
90
+ writable.__files = files;
91
+ }
92
+ decorate(_editor, _config) {
93
+ return createRendererDecoration(CODE_SNIPPET_NODE_KEY, void 0, { files: this.__files });
94
+ }
95
+ };
96
+ function $createCodeSnippetNode(files) {
97
+ return new CodeSnippetNode(files);
98
+ }
99
+ function $isCodeSnippetNode(node) {
100
+ return node instanceof CodeSnippetNode;
101
+ }
102
+ //#endregion
103
+ export { CODE_SNIPPET_NODE_KEY as a, _defineProperty as i, $isCodeSnippetNode as n, CodeSnippetNode as r, $createCodeSnippetNode as t };
@@ -4,11 +4,8 @@ import { normalizeLanguage } from "@haklex/rich-renderer-codeblock/constants";
4
4
  import { FileIcon } from "@haklex/rich-renderer-codeblock/icons";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { SHIKI_DUAL_THEMES, getHighlighterWithLang } from "@haklex/rich-renderer-codeblock/shiki";
7
- import { DecoratorNode } from "lexical";
8
- import { createRendererDecoration } from "@haklex/rich-editor/renderers";
9
- import { CODE_SNIPPET_BLOCK_TRANSFORMER } from "@haklex/rich-headless/transformers";
10
7
  //#region ../../node_modules/.pnpm/@vanilla-extract+recipes@0.5.7_@vanilla-extract+css@1.20.1_babel-plugin-macros@3.1.0_/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js
11
- function toPrimitive$1(t, r) {
8
+ function toPrimitive(t, r) {
12
9
  if ("object" != typeof t || !t) return t;
13
10
  var e = t[Symbol.toPrimitive];
14
11
  if (void 0 !== e) {
@@ -18,12 +15,12 @@ function toPrimitive$1(t, r) {
18
15
  }
19
16
  return ("string" === r ? String : Number)(t);
20
17
  }
21
- function toPropertyKey$1(t) {
22
- var i = toPrimitive$1(t, "string");
18
+ function toPropertyKey(t) {
19
+ var i = toPrimitive(t, "string");
23
20
  return "symbol" == typeof i ? i : String(i);
24
21
  }
25
- function _defineProperty$1(obj, key, value) {
26
- key = toPropertyKey$1(key);
22
+ function _defineProperty(obj, key, value) {
23
+ key = toPropertyKey(key);
27
24
  if (key in obj) Object.defineProperty(obj, key, {
28
25
  value,
29
26
  enumerable: true,
@@ -47,7 +44,7 @@ function _objectSpread2(e) {
47
44
  for (var r = 1; r < arguments.length; r++) {
48
45
  var t = null != arguments[r] ? arguments[r] : {};
49
46
  r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
50
- _defineProperty$1(e, r, t[r]);
47
+ _defineProperty(e, r, t[r]);
51
48
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
52
49
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
53
50
  });
@@ -349,95 +346,4 @@ var CodeSnippetRenderer = ({ files }) => {
349
346
  });
350
347
  };
351
348
  //#endregion
352
- //#region \0@oxc-project+runtime@0.127.0/helpers/typeof.js
353
- function _typeof(o) {
354
- "@babel/helpers - typeof";
355
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
356
- return typeof o;
357
- } : function(o) {
358
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
359
- }, _typeof(o);
360
- }
361
- //#endregion
362
- //#region \0@oxc-project+runtime@0.127.0/helpers/toPrimitive.js
363
- function toPrimitive(t, r) {
364
- if ("object" != _typeof(t) || !t) return t;
365
- var e = t[Symbol.toPrimitive];
366
- if (void 0 !== e) {
367
- var i = e.call(t, r || "default");
368
- if ("object" != _typeof(i)) return i;
369
- throw new TypeError("@@toPrimitive must return a primitive value.");
370
- }
371
- return ("string" === r ? String : Number)(t);
372
- }
373
- //#endregion
374
- //#region \0@oxc-project+runtime@0.127.0/helpers/toPropertyKey.js
375
- function toPropertyKey(t) {
376
- var i = toPrimitive(t, "string");
377
- return "symbol" == _typeof(i) ? i : i + "";
378
- }
379
- //#endregion
380
- //#region \0@oxc-project+runtime@0.127.0/helpers/defineProperty.js
381
- function _defineProperty(e, r, t) {
382
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
383
- value: t,
384
- enumerable: !0,
385
- configurable: !0,
386
- writable: !0
387
- }) : e[r] = t, e;
388
- }
389
- //#endregion
390
- //#region src/nodes/CodeSnippetNode.ts
391
- var CodeSnippetNode = class CodeSnippetNode extends DecoratorNode {
392
- static getType() {
393
- return "code-snippet";
394
- }
395
- static clone(node) {
396
- return new CodeSnippetNode(node.__files, node.__key);
397
- }
398
- constructor(files, key) {
399
- super(key);
400
- _defineProperty(this, "__files", void 0);
401
- this.__files = files;
402
- }
403
- createDOM(_config) {
404
- const div = document.createElement("div");
405
- div.className = "rich-code-snippet";
406
- return div;
407
- }
408
- updateDOM() {
409
- return false;
410
- }
411
- isInline() {
412
- return false;
413
- }
414
- static importJSON(serializedNode) {
415
- return $createCodeSnippetNode(serializedNode.files);
416
- }
417
- exportJSON() {
418
- return {
419
- ...super.exportJSON(),
420
- type: "code-snippet",
421
- files: this.__files,
422
- version: 1
423
- };
424
- }
425
- getFiles() {
426
- return this.getLatest().__files;
427
- }
428
- setFiles(files) {
429
- const writable = this.getWritable();
430
- writable.__files = files;
431
- }
432
- decorate(_editor, _config) {
433
- return createRendererDecoration("CodeSnippet", CodeSnippetRenderer, { files: this.__files });
434
- }
435
- };
436
- function $createCodeSnippetNode(files) {
437
- return new CodeSnippetNode(files);
438
- }
439
- function $isCodeSnippetNode(node) {
440
- return node instanceof CodeSnippetNode;
441
- }
442
- //#endregion
443
- export { modalTitlebar as A, fileName as C, modalIconButton as D, modalEditor as E, semanticClassNames as M, sidebarAddButton as N, modalSidebar as O, sidebarHeader as P, fileList as S, modalBody as T, editorContainer as _, _defineProperty as a, fileIcon as b, breadcrumb as c, breadcrumbName as d, codeSnippetDialogPopup as f, editOverlay as g, editLabel as h, CodeSnippetNode as i, renameInput as j, modalTitle as k, breadcrumbLang as l, editContainer as m, $createCodeSnippetNode as n, CodeSnippetRenderer as o, dragOverlay as p, $isCodeSnippetNode as r, getLanguageFromFilename as s, CODE_SNIPPET_BLOCK_TRANSFORMER as t, breadcrumbLeft as u, fileDelete as v, modal as w, fileItem as x, fileDragHandle as y };
349
+ export { modalSidebar as C, semanticClassNames as D, renameInput as E, sidebarAddButton as O, modalIconButton as S, modalTitlebar as T, fileList as _, breadcrumbLeft as a, modalBody as b, dragOverlay as c, editOverlay as d, editorContainer as f, fileItem as g, fileIcon as h, breadcrumbLang as i, sidebarHeader as k, editContainer as l, fileDragHandle as m, getLanguageFromFilename as n, breadcrumbName as o, fileDelete as p, breadcrumb as r, codeSnippetDialogPopup as s, CodeSnippetRenderer as t, editLabel as u, fileName as v, modalTitle as w, modalEditor as x, modal as y };
@@ -1,4 +1,4 @@
1
- import { CodeSnippetRendererProps } from '@haklex/rich-editor/renderers';
2
1
  import { ComponentType } from 'react';
2
+ import { CodeSnippetRendererProps } from './types';
3
3
  export declare const CodeSnippetRenderer: ComponentType<CodeSnippetRendererProps>;
4
4
  //# sourceMappingURL=CodeSnippetRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeSnippetRenderer.d.ts","sourceRoot":"","sources":["../src/CodeSnippetRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAK9E,OAAO,KAAK,EAAE,aAAa,EAAM,MAAM,OAAO,CAAC;AA6B/C,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CA2HvE,CAAC"}
1
+ {"version":3,"file":"CodeSnippetRenderer.d.ts","sourceRoot":"","sources":["../src/CodeSnippetRenderer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAM,MAAM,OAAO,CAAC;AAI/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AA0BxD,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CA2HvE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ComponentType } from 'react';
2
+ import { CodeSnippetRendererProps } from './types';
3
+ declare module '@haklex/rich-editor' {
4
+ interface RendererConfig {
5
+ CodeSnippet?: ComponentType<CodeSnippetRendererProps>;
6
+ }
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=augment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"augment.d.ts","sourceRoot":"","sources":["../src/augment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,cAAc;QACtB,WAAW,CAAC,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC;KACvD;CACF;AAED,OAAO,EAAE,CAAC"}