@haklex/rich-ext-code-snippet 0.0.4 → 0.0.6
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.map +1 -1
- package/dist/CodeSnippetEditRenderer.d.ts.map +1 -1
- package/dist/CodeSnippetRenderer.d.ts.map +1 -1
- package/dist/index.mjs +207 -220
- package/dist/rich-ext-code-snippet.css +1 -0
- package/dist/styles.css.d.ts.map +1 -1
- package/package.json +8 -10
- package/dist/FileIcon.d.ts +0 -6
- package/dist/FileIcon.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditorModal.d.ts","sourceRoot":"","sources":["../src/CodeEditorModal.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"CodeEditorModal.d.ts","sourceRoot":"","sources":["../src/CodeEditorModal.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAShE,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAA;AAO9C,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAA;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,WAAW,EAAE,WAAW,CAAA;CACzB;AAqGD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAgVpD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeSnippetEditRenderer.d.ts","sourceRoot":"","sources":["../src/CodeSnippetEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAKnD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"CodeSnippetEditRenderer.d.ts","sourceRoot":"","sources":["../src/CodeSnippetEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAKnD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAa/B,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAA;CAC5C;AAED,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CAwCpE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeSnippetRenderer.d.ts","sourceRoot":"","sources":["../src/CodeSnippetRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"CodeSnippetRenderer.d.ts","sourceRoot":"","sources":["../src/CodeSnippetRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AASnE,OAAO,KAAK,EAAE,aAAa,EAAM,MAAM,OAAO,CAAA;AA6B9C,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CAyIvE,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import {
|
|
4
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useColorScheme, createRendererDecoration } from "@haklex/rich-editor";
|
|
6
6
|
import { presentDialog } from "@haklex/rich-editor-ui";
|
|
7
7
|
import { usePortalTheme } from "@haklex/rich-style-token";
|
|
8
8
|
import { X, Plus, GripVertical, Trash2, Check, Copy, Pencil, FileCode } from "lucide-react";
|
|
9
|
-
import {
|
|
9
|
+
import { useState, useRef, useEffect, useCallback, useMemo, useContext, createContext, createElement } from "react";
|
|
10
10
|
import { useSensors, useSensor, PointerSensor, DndContext, closestCenter, DragOverlay } from "@dnd-kit/core";
|
|
11
11
|
import { arrayMove, SortableContext, verticalListSortingStrategy, useSortable } from "@dnd-kit/sortable";
|
|
12
12
|
import { CSS } from "@dnd-kit/utilities";
|
|
13
13
|
import { normalizeLanguage } from "@haklex/rich-renderer-codeblock/constants";
|
|
14
|
+
import { FileIcon } from "@haklex/rich-renderer-codeblock/icons";
|
|
14
15
|
import { getHighlighterWithLang, SHIKI_THEMES } from "@haklex/rich-renderer-codeblock/shiki";
|
|
15
16
|
import { createPortal } from "react-dom";
|
|
16
|
-
import { getIconData, iconToSVG, iconToHTML } from "@iconify/utils";
|
|
17
|
-
import { icons } from "@iconify-json/material-icon-theme";
|
|
18
17
|
import { DecoratorNode, $getNodeByKey, $insertNodes } from "lexical";
|
|
19
18
|
function toPrimitive(t, r2) {
|
|
20
19
|
if ("object" != typeof t || !t) return t;
|
|
@@ -157,82 +156,6 @@ var breadcrumbName = "hjkryc14";
|
|
|
157
156
|
var breadcrumbLang = "hjkryc15";
|
|
158
157
|
var editorContainer = "hjkryc16";
|
|
159
158
|
var dragOverlay = "hjkryc17";
|
|
160
|
-
const EXT_TO_ICON = {
|
|
161
|
-
ts: "typescript",
|
|
162
|
-
js: "javascript",
|
|
163
|
-
tsx: "react_ts",
|
|
164
|
-
jsx: "react",
|
|
165
|
-
py: "python",
|
|
166
|
-
rs: "rust",
|
|
167
|
-
go: "go",
|
|
168
|
-
java: "java",
|
|
169
|
-
html: "html",
|
|
170
|
-
css: "css",
|
|
171
|
-
scss: "sass",
|
|
172
|
-
json: "json",
|
|
173
|
-
md: "markdown",
|
|
174
|
-
sh: "console",
|
|
175
|
-
yml: "yaml",
|
|
176
|
-
yaml: "yaml",
|
|
177
|
-
sql: "database",
|
|
178
|
-
c: "c",
|
|
179
|
-
cpp: "cpp",
|
|
180
|
-
swift: "swift",
|
|
181
|
-
kt: "kotlin",
|
|
182
|
-
rb: "ruby",
|
|
183
|
-
php: "php",
|
|
184
|
-
vue: "vue",
|
|
185
|
-
svelte: "svelte",
|
|
186
|
-
toml: "toml",
|
|
187
|
-
xml: "xml",
|
|
188
|
-
graphql: "graphql",
|
|
189
|
-
dockerfile: "docker",
|
|
190
|
-
lua: "lua",
|
|
191
|
-
zig: "zig"
|
|
192
|
-
};
|
|
193
|
-
function getIconSvg(filename) {
|
|
194
|
-
const ext = filename.split(".").pop()?.toLowerCase() ?? "";
|
|
195
|
-
const iconName = EXT_TO_ICON[ext] ?? "file";
|
|
196
|
-
const data = getIconData(icons, iconName);
|
|
197
|
-
if (!data) return null;
|
|
198
|
-
const svg = iconToSVG(data);
|
|
199
|
-
return iconToHTML(svg.body, svg.attributes);
|
|
200
|
-
}
|
|
201
|
-
const FileIcon = ({
|
|
202
|
-
filename,
|
|
203
|
-
size = 16
|
|
204
|
-
}) => {
|
|
205
|
-
const html = useMemo(() => getIconSvg(filename), [filename]);
|
|
206
|
-
if (!html) {
|
|
207
|
-
return /* @__PURE__ */ jsx(
|
|
208
|
-
"span",
|
|
209
|
-
{
|
|
210
|
-
className: `${fileIcon} ${semanticClassNames.fileIcon}`,
|
|
211
|
-
style: {
|
|
212
|
-
width: size,
|
|
213
|
-
height: size,
|
|
214
|
-
display: "inline-flex",
|
|
215
|
-
alignItems: "center",
|
|
216
|
-
justifyContent: "center",
|
|
217
|
-
opacity: 0.5,
|
|
218
|
-
fontSize: size * 0.6
|
|
219
|
-
},
|
|
220
|
-
children: "F"
|
|
221
|
-
}
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
return /* @__PURE__ */ jsx(
|
|
225
|
-
"span",
|
|
226
|
-
{
|
|
227
|
-
className: `${fileIcon} ${semanticClassNames.fileIcon}`,
|
|
228
|
-
style: {
|
|
229
|
-
width: size,
|
|
230
|
-
height: size
|
|
231
|
-
},
|
|
232
|
-
dangerouslySetInnerHTML: { __html: html }
|
|
233
|
-
}
|
|
234
|
-
);
|
|
235
|
-
};
|
|
236
159
|
const EXT_TO_LANG = {
|
|
237
160
|
ts: "typescript",
|
|
238
161
|
tsx: "tsx",
|
|
@@ -315,7 +238,14 @@ const SortableFileItem = ({
|
|
|
315
238
|
children: /* @__PURE__ */ jsx(GripVertical, { size: 12 })
|
|
316
239
|
}
|
|
317
240
|
),
|
|
318
|
-
/* @__PURE__ */ jsx(
|
|
241
|
+
/* @__PURE__ */ jsx(
|
|
242
|
+
FileIcon,
|
|
243
|
+
{
|
|
244
|
+
filename: file.filename,
|
|
245
|
+
size: 14,
|
|
246
|
+
className: `${fileIcon} ${semanticClassNames.fileIcon}`
|
|
247
|
+
}
|
|
248
|
+
),
|
|
319
249
|
isEditing ? /* @__PURE__ */ jsx(
|
|
320
250
|
"input",
|
|
321
251
|
{
|
|
@@ -330,7 +260,13 @@ const SortableFileItem = ({
|
|
|
330
260
|
autoFocus: true,
|
|
331
261
|
onClick: (e) => e.stopPropagation()
|
|
332
262
|
}
|
|
333
|
-
) : /* @__PURE__ */ jsx(
|
|
263
|
+
) : /* @__PURE__ */ jsx(
|
|
264
|
+
"span",
|
|
265
|
+
{
|
|
266
|
+
className: `${fileName} ${semanticClassNames.fileName}`,
|
|
267
|
+
children: file.filename
|
|
268
|
+
}
|
|
269
|
+
),
|
|
334
270
|
canDelete && /* @__PURE__ */ jsx(
|
|
335
271
|
"button",
|
|
336
272
|
{
|
|
@@ -490,7 +426,13 @@ const CodeEditorModal = ({
|
|
|
490
426
|
{
|
|
491
427
|
className: `${modalTitlebar} ${semanticClassNames.modalTitlebar}`,
|
|
492
428
|
children: [
|
|
493
|
-
/* @__PURE__ */ jsx(
|
|
429
|
+
/* @__PURE__ */ jsx(
|
|
430
|
+
"span",
|
|
431
|
+
{
|
|
432
|
+
className: `${modalTitle} ${semanticClassNames.modalTitle}`,
|
|
433
|
+
children: "Code Snippet"
|
|
434
|
+
}
|
|
435
|
+
),
|
|
494
436
|
/* @__PURE__ */ jsx(
|
|
495
437
|
"button",
|
|
496
438
|
{
|
|
@@ -503,144 +445,170 @@ const CodeEditorModal = ({
|
|
|
503
445
|
]
|
|
504
446
|
}
|
|
505
447
|
),
|
|
506
|
-
/* @__PURE__ */ jsxs(
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
{
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
{
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
"aria-label": "Add file",
|
|
525
|
-
children: /* @__PURE__ */ jsx(Plus, { size: 14 })
|
|
526
|
-
}
|
|
527
|
-
)
|
|
528
|
-
]
|
|
529
|
-
}
|
|
530
|
-
),
|
|
531
|
-
/* @__PURE__ */ jsx("div", { className: `${fileList} ${semanticClassNames.fileList}`, children: /* @__PURE__ */ jsxs(
|
|
532
|
-
DndContext,
|
|
533
|
-
{
|
|
534
|
-
sensors,
|
|
535
|
-
collisionDetection: closestCenter,
|
|
536
|
-
onDragStart: (event) => setDragActiveId(event.active.id),
|
|
537
|
-
onDragEnd: handleDragEnd,
|
|
538
|
-
onDragCancel: () => setDragActiveId(null),
|
|
539
|
-
children: [
|
|
540
|
-
/* @__PURE__ */ jsx(
|
|
541
|
-
SortableContext,
|
|
542
|
-
{
|
|
543
|
-
items: fileIds,
|
|
544
|
-
strategy: verticalListSortingStrategy,
|
|
545
|
-
children: editFiles.map((file) => /* @__PURE__ */ jsx(
|
|
546
|
-
SortableFileItem,
|
|
448
|
+
/* @__PURE__ */ jsxs(
|
|
449
|
+
"div",
|
|
450
|
+
{
|
|
451
|
+
className: `${modalBody} ${semanticClassNames.modalBody}`,
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ jsxs(
|
|
454
|
+
"div",
|
|
455
|
+
{
|
|
456
|
+
className: `${modalSidebar} ${semanticClassNames.modalSidebar}`,
|
|
457
|
+
children: [
|
|
458
|
+
/* @__PURE__ */ jsxs(
|
|
459
|
+
"div",
|
|
460
|
+
{
|
|
461
|
+
className: `${sidebarHeader} ${semanticClassNames.sidebarHeader}`,
|
|
462
|
+
children: [
|
|
463
|
+
/* @__PURE__ */ jsx("span", { children: "Files" }),
|
|
464
|
+
/* @__PURE__ */ jsx(
|
|
465
|
+
"button",
|
|
547
466
|
{
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
))
|
|
565
|
-
}
|
|
566
|
-
),
|
|
567
|
-
typeof document !== "undefined" ? createPortal(
|
|
568
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: /* @__PURE__ */ jsx(
|
|
569
|
-
"div",
|
|
467
|
+
type: "button",
|
|
468
|
+
className: `${sidebarAddButton} ${semanticClassNames.sidebarAddButton}`,
|
|
469
|
+
onClick: handleAddFile,
|
|
470
|
+
"aria-label": "Add file",
|
|
471
|
+
children: /* @__PURE__ */ jsx(Plus, { size: 14 })
|
|
472
|
+
}
|
|
473
|
+
)
|
|
474
|
+
]
|
|
475
|
+
}
|
|
476
|
+
),
|
|
477
|
+
/* @__PURE__ */ jsx(
|
|
478
|
+
"div",
|
|
479
|
+
{
|
|
480
|
+
className: `${fileList} ${semanticClassNames.fileList}`,
|
|
481
|
+
children: /* @__PURE__ */ jsxs(
|
|
482
|
+
DndContext,
|
|
570
483
|
{
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
),
|
|
585
|
-
/* @__PURE__ */ jsx(
|
|
586
|
-
"span",
|
|
484
|
+
sensors,
|
|
485
|
+
collisionDetection: closestCenter,
|
|
486
|
+
onDragStart: (event) => setDragActiveId(event.active.id),
|
|
487
|
+
onDragEnd: handleDragEnd,
|
|
488
|
+
onDragCancel: () => setDragActiveId(null),
|
|
489
|
+
children: [
|
|
490
|
+
/* @__PURE__ */ jsx(
|
|
491
|
+
SortableContext,
|
|
492
|
+
{
|
|
493
|
+
items: fileIds,
|
|
494
|
+
strategy: verticalListSortingStrategy,
|
|
495
|
+
children: editFiles.map((file) => /* @__PURE__ */ jsx(
|
|
496
|
+
SortableFileItem,
|
|
587
497
|
{
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
498
|
+
file,
|
|
499
|
+
isActive: file.filename === activeFilename,
|
|
500
|
+
isEditing: editingFilename === file.filename,
|
|
501
|
+
editValue: newFilenameInput,
|
|
502
|
+
canDelete: editFiles.length > 1,
|
|
503
|
+
onSelect: () => setActiveFilename(file.filename),
|
|
504
|
+
onStartRename: () => {
|
|
505
|
+
setEditingFilename(file.filename);
|
|
506
|
+
setNewFilenameInput(file.filename);
|
|
507
|
+
},
|
|
508
|
+
onEditChange: setNewFilenameInput,
|
|
509
|
+
onCommitRename: () => handleRenameFile(file.filename, newFilenameInput),
|
|
510
|
+
onCancelRename: () => setEditingFilename(null),
|
|
511
|
+
onDelete: () => handleDeleteFile(file.filename)
|
|
512
|
+
},
|
|
513
|
+
file.filename
|
|
514
|
+
))
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
typeof document !== "undefined" ? createPortal(
|
|
518
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: /* @__PURE__ */ jsx(
|
|
519
|
+
"div",
|
|
520
|
+
{
|
|
521
|
+
className: portalThemeClassName,
|
|
522
|
+
style: { display: "contents" },
|
|
523
|
+
children: dragActiveFile ? /* @__PURE__ */ jsxs(
|
|
524
|
+
"div",
|
|
525
|
+
{
|
|
526
|
+
className: `${fileItem()} ${semanticClassNames.fileItem} ${dragOverlay} ${semanticClassNames.dragOverlay}`,
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ jsx(
|
|
529
|
+
FileIcon,
|
|
530
|
+
{
|
|
531
|
+
filename: dragActiveFile.filename,
|
|
532
|
+
size: 14,
|
|
533
|
+
className: `${fileIcon} ${semanticClassNames.fileIcon}`
|
|
534
|
+
}
|
|
535
|
+
),
|
|
536
|
+
/* @__PURE__ */ jsx(
|
|
537
|
+
"span",
|
|
538
|
+
{
|
|
539
|
+
className: `${fileName} ${semanticClassNames.fileName}`,
|
|
540
|
+
children: dragActiveFile.filename
|
|
541
|
+
}
|
|
542
|
+
)
|
|
543
|
+
]
|
|
544
|
+
}
|
|
545
|
+
) : null
|
|
546
|
+
}
|
|
547
|
+
) }),
|
|
548
|
+
document.body
|
|
549
|
+
) : null
|
|
550
|
+
]
|
|
595
551
|
}
|
|
596
|
-
)
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
552
|
+
)
|
|
553
|
+
}
|
|
554
|
+
)
|
|
555
|
+
]
|
|
556
|
+
}
|
|
557
|
+
),
|
|
558
|
+
/* @__PURE__ */ jsxs(
|
|
559
|
+
"div",
|
|
560
|
+
{
|
|
561
|
+
className: `${modalEditor} ${semanticClassNames.modalEditor}`,
|
|
562
|
+
children: [
|
|
563
|
+
/* @__PURE__ */ jsx(
|
|
564
|
+
"div",
|
|
565
|
+
{
|
|
566
|
+
className: `${breadcrumb} ${semanticClassNames.breadcrumb}`,
|
|
567
|
+
children: /* @__PURE__ */ jsx(
|
|
568
|
+
"div",
|
|
569
|
+
{
|
|
570
|
+
className: `${breadcrumbLeft} ${semanticClassNames.breadcrumbLeft}`,
|
|
571
|
+
children: activeFile && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
572
|
+
/* @__PURE__ */ jsx(
|
|
573
|
+
FileIcon,
|
|
574
|
+
{
|
|
575
|
+
filename: activeFile.filename,
|
|
576
|
+
size: 14,
|
|
577
|
+
className: `${fileIcon} ${semanticClassNames.fileIcon}`
|
|
578
|
+
}
|
|
579
|
+
),
|
|
580
|
+
/* @__PURE__ */ jsx(
|
|
581
|
+
"span",
|
|
582
|
+
{
|
|
583
|
+
className: `${breadcrumbName} ${semanticClassNames.breadcrumbName}`,
|
|
584
|
+
children: activeFile.filename
|
|
585
|
+
}
|
|
586
|
+
),
|
|
587
|
+
language && /* @__PURE__ */ jsx(
|
|
588
|
+
"span",
|
|
589
|
+
{
|
|
590
|
+
className: `${breadcrumbLang} ${semanticClassNames.breadcrumbLang}`,
|
|
591
|
+
children: language
|
|
592
|
+
}
|
|
593
|
+
)
|
|
594
|
+
] })
|
|
595
|
+
}
|
|
596
|
+
)
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
/* @__PURE__ */ jsx(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
ref: containerRef,
|
|
603
|
+
className: `${editorContainer} ${semanticClassNames.editorContainer}`
|
|
604
|
+
}
|
|
605
|
+
)
|
|
606
|
+
]
|
|
607
|
+
}
|
|
608
|
+
)
|
|
609
|
+
]
|
|
610
|
+
}
|
|
611
|
+
)
|
|
644
612
|
] });
|
|
645
613
|
};
|
|
646
614
|
const CopyButton = ({ text }) => {
|
|
@@ -718,7 +686,14 @@ const CodeSnippetRenderer = ({
|
|
|
718
686
|
onClick: () => setActiveIndex(index),
|
|
719
687
|
className: `${tab({ active: index === activeIndex })} ${semanticClassNames.tab} ${index === activeIndex ? semanticClassNames.tabActive : ""}`.trim(),
|
|
720
688
|
children: [
|
|
721
|
-
/* @__PURE__ */ jsx(
|
|
689
|
+
/* @__PURE__ */ jsx(
|
|
690
|
+
FileIcon,
|
|
691
|
+
{
|
|
692
|
+
filename: file.filename,
|
|
693
|
+
size: 14,
|
|
694
|
+
className: `${fileIcon} ${semanticClassNames.fileIcon}`
|
|
695
|
+
}
|
|
696
|
+
),
|
|
722
697
|
/* @__PURE__ */ jsx("span", { children: file.filename })
|
|
723
698
|
]
|
|
724
699
|
},
|
|
@@ -730,7 +705,14 @@ const CodeSnippetRenderer = ({
|
|
|
730
705
|
{
|
|
731
706
|
className: `${titleBar} ${semanticClassNames.titleBar}`,
|
|
732
707
|
children: [
|
|
733
|
-
/* @__PURE__ */ jsx(
|
|
708
|
+
/* @__PURE__ */ jsx(
|
|
709
|
+
FileIcon,
|
|
710
|
+
{
|
|
711
|
+
filename: activeFile.filename,
|
|
712
|
+
size: 14,
|
|
713
|
+
className: `${fileIcon} ${semanticClassNames.fileIcon}`
|
|
714
|
+
}
|
|
715
|
+
),
|
|
734
716
|
/* @__PURE__ */ jsx("span", { children: activeFile.filename })
|
|
735
717
|
]
|
|
736
718
|
}
|
|
@@ -743,7 +725,12 @@ const CodeSnippetRenderer = ({
|
|
|
743
725
|
}
|
|
744
726
|
)
|
|
745
727
|
] }),
|
|
746
|
-
/* @__PURE__ */ jsx(
|
|
728
|
+
/* @__PURE__ */ jsx(
|
|
729
|
+
"div",
|
|
730
|
+
{
|
|
731
|
+
className: `${separator} ${semanticClassNames.separator}`
|
|
732
|
+
}
|
|
733
|
+
),
|
|
747
734
|
files.map((file, index) => {
|
|
748
735
|
const html = htmlMap[file.filename];
|
|
749
736
|
return /* @__PURE__ */ jsx(
|
package/dist/styles.css.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../src/styles.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCrB,CAAA;AAEV,eAAO,MAAM,SAAS,QAOpB,CAAA;AAEF,eAAO,MAAM,MAAM,QAMjB,CAAA;AAEF,eAAO,MAAM,IAAI,QAWf,CAAA;AA0BF,eAAO,MAAM,GAAG;;;;;;;;EAcd,CAAA;AAEF,eAAO,MAAM,QAAQ,QASnB,CAAA;AAEF,eAAO,MAAM,aAAa,QAUxB,CAAA;AAEF,eAAO,MAAM,UAAU,QAkBrB,CAAA;AAEF,eAAO,MAAM,SAAS,QAIpB,CAAA;AAEF,eAAO,MAAM,UAAU,QAErB,CAAA;AAEF,eAAO,MAAM,QAAQ,QAMnB,CAAA;AAWF,eAAO,MAAM,QAAQ,QAGnB,CAAA;AAOF,eAAO,MAAM,aAAa,QAExB,CAAA;AAEF,eAAO,MAAM,WAAW,QAetB,CAAA;AAEF,eAAO,MAAM,SAAS,QAkBpB,CAAA;AAEF,QAAA,MAAM,uBAAuB,QAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../src/styles.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCrB,CAAA;AAEV,eAAO,MAAM,SAAS,QAOpB,CAAA;AAEF,eAAO,MAAM,MAAM,QAMjB,CAAA;AAEF,eAAO,MAAM,IAAI,QAWf,CAAA;AA0BF,eAAO,MAAM,GAAG;;;;;;;;EAcd,CAAA;AAEF,eAAO,MAAM,QAAQ,QASnB,CAAA;AAEF,eAAO,MAAM,aAAa,QAUxB,CAAA;AAEF,eAAO,MAAM,UAAU,QAkBrB,CAAA;AAEF,eAAO,MAAM,SAAS,QAIpB,CAAA;AAEF,eAAO,MAAM,UAAU,QAErB,CAAA;AAEF,eAAO,MAAM,QAAQ,QAMnB,CAAA;AAWF,eAAO,MAAM,QAAQ,QAGnB,CAAA;AAOF,eAAO,MAAM,aAAa,QAExB,CAAA;AAEF,eAAO,MAAM,WAAW,QAetB,CAAA;AAEF,eAAO,MAAM,SAAS,QAkBpB,CAAA;AAEF,QAAA,MAAM,uBAAuB,QAAY,CAAA;AAyBzC,OAAO,EAAE,uBAAuB,IAAI,sBAAsB,EAAE,CAAA;AAE5D,eAAO,MAAM,KAAK,QAMhB,CAAA;AAEF,eAAO,MAAM,aAAa,QAQxB,CAAA;AAEF,eAAO,MAAM,UAAU,QAIrB,CAAA;AAEF,eAAO,MAAM,eAAe,QAkB1B,CAAA;AAEF,eAAO,MAAM,SAAS,QAIpB,CAAA;AAEF,eAAO,MAAM,YAAY,QAOvB,CAAA;AAEF,eAAO,MAAM,aAAa,QAUxB,CAAA;AAEF,eAAO,MAAM,gBAAgB,QAkB3B,CAAA;AAEF,eAAO,MAAM,QAAQ,QAInB,CAAA;AAsBF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;EAqBnB,CAAA;AAEF,eAAO,MAAM,cAAc,QAYzB,CAAA;AAEF,eAAO,MAAM,QAAQ,QAKnB,CAAA;AAEF,eAAO,MAAM,UAAU,QAqBrB,CAAA;AAEF,eAAO,MAAM,WAAW,QAgBtB,CAAA;AAEF,eAAO,MAAM,WAAW,QAKtB,CAAA;AAEF,eAAO,MAAM,UAAU,QAQrB,CAAA;AAEF,eAAO,MAAM,cAAc,QAQzB,CAAA;AAEF,eAAO,MAAM,cAAc,QAKzB,CAAA;AAEF,eAAO,MAAM,cAAc,QAEzB,CAAA;AAEF,eAAO,MAAM,eAAe,QAM1B,CAAA;AAyDF,eAAO,MAAM,WAAW,QAItB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-ext-code-snippet",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Multi-file code snippet extension",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,23 +19,21 @@
|
|
|
19
19
|
"@dnd-kit/core": "^6.3.1",
|
|
20
20
|
"@dnd-kit/sortable": "^10.0.0",
|
|
21
21
|
"@dnd-kit/utilities": "^3.2.2",
|
|
22
|
-
"@iconify-json/material-icon-theme": "^1.2.22",
|
|
23
|
-
"@iconify/utils": "^2.3.0",
|
|
24
22
|
"lucide-react": "^0.574.0",
|
|
25
23
|
"shikicode": "*",
|
|
26
|
-
"@haklex/rich-editor": "0.0.
|
|
27
|
-
"@haklex/rich-editor-ui": "0.0.
|
|
28
|
-
"@haklex/rich-style-token": "0.0.
|
|
29
|
-
"@haklex/rich-renderer-codeblock": "0.0.
|
|
24
|
+
"@haklex/rich-editor": "0.0.6",
|
|
25
|
+
"@haklex/rich-editor-ui": "0.0.6",
|
|
26
|
+
"@haklex/rich-style-token": "0.0.6",
|
|
27
|
+
"@haklex/rich-renderer-codeblock": "0.0.6"
|
|
30
28
|
},
|
|
31
29
|
"devDependencies": {
|
|
32
|
-
"@lexical/react": "^0.
|
|
30
|
+
"@lexical/react": "^0.40.0",
|
|
33
31
|
"@types/react": "^19.0.0",
|
|
34
32
|
"@types/react-dom": "^19.0.0",
|
|
35
33
|
"@vanilla-extract/css": "^1.17.1",
|
|
36
34
|
"@vanilla-extract/recipes": "^0.5.7",
|
|
37
35
|
"@vanilla-extract/vite-plugin": "^4.0.20",
|
|
38
|
-
"lexical": "^0.
|
|
36
|
+
"lexical": "^0.40.0",
|
|
39
37
|
"react": "19.2.4",
|
|
40
38
|
"react-dom": "19.2.4",
|
|
41
39
|
"typescript": "^5.9.0",
|
|
@@ -43,7 +41,7 @@
|
|
|
43
41
|
"vite-plugin-dts": "^4.5.0"
|
|
44
42
|
},
|
|
45
43
|
"peerDependencies": {
|
|
46
|
-
"lexical": "^0.
|
|
44
|
+
"lexical": "^0.40.0",
|
|
47
45
|
"react": ">=19"
|
|
48
46
|
},
|
|
49
47
|
"publishConfig": {
|
package/dist/FileIcon.d.ts
DELETED
package/dist/FileIcon.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileIcon.d.ts","sourceRoot":"","sources":["../src/FileIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAgD/B,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAmC5D,CAAA"}
|