@haklex/rich-ext-code-snippet 0.4.0 → 0.5.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/CodeEditorModal.d.ts +1 -1
- package/dist/CodeEditorModal.d.ts.map +1 -1
- package/dist/CodeSnippetEditDecorator.d.ts +1 -1
- package/dist/CodeSnippetEditDecorator.d.ts.map +1 -1
- package/dist/CodeSnippetEditRenderer.d.ts +1 -1
- package/dist/CodeSnippetEditRenderer.d.ts.map +1 -1
- package/dist/CodeSnippetNode-DD50J5NW.js +103 -0
- package/dist/{transformer-BK2M_fTu.js → CodeSnippetRenderer-BNGQYBtp.js} +7 -101
- package/dist/CodeSnippetRenderer.d.ts +1 -1
- package/dist/CodeSnippetRenderer.d.ts.map +1 -1
- package/dist/augment.d.ts +9 -0
- package/dist/augment.d.ts.map +1 -0
- package/dist/edit-BpfJ1A_-.js +416 -0
- package/dist/edit.d.ts +6 -0
- package/dist/edit.d.ts.map +1 -0
- package/dist/edit.mjs +2 -0
- package/dist/index.d.ts +3 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +6 -416
- package/dist/node-DEOtFSlD.js +6 -0
- package/dist/node.d.ts +8 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.mjs +3 -0
- package/dist/nodes/CodeSnippetEditNode.d.ts +1 -1
- package/dist/nodes/CodeSnippetEditNode.d.ts.map +1 -1
- package/dist/nodes/CodeSnippetNode.d.ts +1 -1
- package/dist/nodes/CodeSnippetNode.d.ts.map +1 -1
- package/dist/renderer.d.ts +5 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.mjs +5 -0
- package/dist/rich-ext-code-snippet.css +1 -1
- package/dist/slot.d.ts +8 -0
- package/dist/slot.d.ts.map +1 -0
- package/dist/static.d.ts +2 -6
- package/dist/static.d.ts.map +1 -1
- package/dist/static.mjs +5 -5
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +20 -8
- package/dist/nodes/index.d.ts +0 -7
- package/dist/nodes/index.d.ts.map +0 -1
|
@@ -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;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeSnippetEditDecorator.d.ts","sourceRoot":"","sources":["../src/CodeSnippetEditDecorator.tsx"],"names":[],"mappings":"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeSnippetEditRenderer.d.ts","sourceRoot":"","sources":["../src/CodeSnippetEditRenderer.tsx"],"names":[],"mappings":"
|
|
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
|
|
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
|
|
22
|
-
var i = toPrimitive
|
|
18
|
+
function toPropertyKey(t) {
|
|
19
|
+
var i = toPrimitive(t, "string");
|
|
23
20
|
return "symbol" == typeof i ? i : String(i);
|
|
24
21
|
}
|
|
25
|
-
function _defineProperty
|
|
26
|
-
key = toPropertyKey
|
|
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
|
|
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
|
-
|
|
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":"
|
|
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,CAAA;AAE1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAEvD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,cAAc;QACtB,WAAW,CAAC,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAA;KACtD;CACF;AAED,OAAO,EAAE,CAAA"}
|