@jbpark/live-editor 3.0.0 → 3.0.2
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/{ast-DRg6HV4H.js → ast-D6R-dsk0.js} +19 -4
- package/dist/{ast-DRg6HV4H.js.map → ast-D6R-dsk0.js.map} +1 -1
- package/dist/{core-CbuS_p_d.js → core-CTsQ9LiQ.js} +14 -60
- package/dist/core-CTsQ9LiQ.js.map +1 -0
- package/dist/dnd/index.js +1 -1
- package/dist/{dnd-Bl_oqayG.js → dnd-C4iBiSkv.js} +3 -3
- package/dist/{dnd-Bl_oqayG.js.map → dnd-C4iBiSkv.js.map} +1 -1
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +2 -2
- package/dist/{editor-Ct9wuhLm.js → editor-C0lphNg6.js} +2 -2
- package/dist/{editor-Ct9wuhLm.js.map → editor-C0lphNg6.js.map} +1 -1
- package/dist/{index-C4TBkJBG.d.ts → index-Ck3akHag.d.ts} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/style.css +105 -123
- package/dist/utils/ast/index.js +1 -1
- package/package.json +2 -2
- package/dist/core-CbuS_p_d.js.map +0 -1
package/dist/editor/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Props, i as Core, n as EditorRenderData, r as Props$1, t as Editor } from "../index-
|
|
1
|
+
import { a as Props, i as Core, n as EditorRenderData, r as Props$1, t as Editor } from "../index-Ck3akHag.js";
|
|
2
2
|
export { Core, type Props as CoreProps, type EditorRenderData, type Props$1 as Props, Editor as default };
|
package/dist/editor/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as Core } from "../core-
|
|
2
|
-
import { t as Editor } from "../editor-
|
|
1
|
+
import { t as Core } from "../core-CTsQ9LiQ.js";
|
|
2
|
+
import { t as Editor } from "../editor-C0lphNg6.js";
|
|
3
3
|
export { Core, Editor as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { y as DEFAULT_TEMPLATE } from "./document-C6bNHl7l.js";
|
|
2
2
|
import { i as usePreview, r as useError } from "./states-Ci1AvoQ9.js";
|
|
3
|
-
import { n as useFormatCode, t as Core } from "./core-
|
|
3
|
+
import { n as useFormatCode, t as Core } from "./core-CTsQ9LiQ.js";
|
|
4
4
|
import { useCallback, useEffect } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { useDebouncedValue } from "@jbpark/use-hooks";
|
|
@@ -48,4 +48,4 @@ Editor.Core = Core;
|
|
|
48
48
|
//#endregion
|
|
49
49
|
export { Editor as t };
|
|
50
50
|
|
|
51
|
-
//# sourceMappingURL=editor-
|
|
51
|
+
//# sourceMappingURL=editor-C0lphNg6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-
|
|
1
|
+
{"version":3,"file":"editor-C0lphNg6.js","names":["Editor","EditorImpl"],"sources":["../src/components/editor/editor.tsx","../src/components/editor/index.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react';\n\nimport { useDebouncedValue } from '@jbpark/use-hooks';\n\nimport { useError, usePreview } from '~/components/context/states';\nimport { DEFAULT_TEMPLATE } from '~/constants';\n\nimport Core, { type Props as CoreProps } from './core';\nimport { useFormatCode } from './use-format-code';\n\nexport interface EditorRenderData {\n value: string;\n onChange: (value: string) => void;\n // Same prettier-based formatting Core's own Cmd+S uses - reused rather\n // than reimplemented, so a custom editor can offer equivalent\n // format-on-save behavior without duplicating the prettier wiring.\n formatCode: (code: string) => Promise<string>;\n}\n\nexport interface Props extends Omit<CoreProps, 'onSave' | 'onError'> {\n defaultValue?: string;\n debounce?: number;\n // Full replacement for the built-in CodeMirror editor. Editor still owns\n // syncing `value` to the shared preview code (debounced), regardless of\n // which UI renders it - only the editing surface itself is customizable.\n renderEditor?: (data: EditorRenderData) => React.ReactNode;\n}\n\nconst Editor = ({\n defaultValue,\n value: _value,\n debounce = 1000,\n onChange: _onChange,\n renderEditor,\n fragment,\n prettierOptions,\n ...props\n}: Props) => {\n const { setCode } = usePreview();\n const { setError } = useError();\n\n const value =\n _value.trim() === '' ? defaultValue || DEFAULT_TEMPLATE : _value;\n\n const onChange = useCallback(\n (value: string) => {\n _onChange?.(value);\n },\n [_onChange],\n );\n\n const onSave = useCallback(\n (formattedCode: string) => {\n setCode(formattedCode);\n },\n [setCode],\n );\n\n const onError = useCallback(\n (error: string | null) => {\n setError(error);\n },\n [setError],\n );\n\n const formatCode = useFormatCode({ fragment, prettierOptions });\n\n const debouncedValue = useDebouncedValue(value, debounce);\n\n useEffect(() => {\n setCode(debouncedValue);\n }, [debouncedValue, setCode]);\n\n if (renderEditor) {\n return renderEditor({ value, onChange, formatCode });\n }\n\n return (\n <Core\n value={value}\n onChange={onChange}\n onSave={onSave}\n onError={onError}\n fragment={fragment}\n prettierOptions={prettierOptions}\n {...props}\n />\n );\n};\n\nexport default Editor;\n","import Core, { type Props as CoreProps } from './core';\nimport EditorImpl, { type EditorRenderData, type Props } from './editor';\n\ntype EditorComponent = typeof EditorImpl & { Core: typeof Core };\n\nconst Editor = EditorImpl as EditorComponent;\n\nEditor.Core = Core;\n\nexport { Core };\nexport type { Props, CoreProps, EditorRenderData };\nexport default Editor;\n"],"mappings":";;;;;;;AA4BA,MAAMA,YAAU,EACd,cACA,OAAO,QACP,WAAW,KACX,UAAU,WACV,cACA,UACA,iBACA,GAAG,YACQ;CACX,MAAM,EAAE,YAAY,WAAW;CAC/B,MAAM,EAAE,aAAa,SAAS;CAE9B,MAAM,QACJ,OAAO,KAAK,MAAM,KAAK,gBAAgB,mBAAmB;CAE5D,MAAM,WAAW,aACd,UAAkB;EACjB,YAAY,KAAK;CACnB,GACA,CAAC,SAAS,CACZ;CAEA,MAAM,SAAS,aACZ,kBAA0B;EACzB,QAAQ,aAAa;CACvB,GACA,CAAC,OAAO,CACV;CAEA,MAAM,UAAU,aACb,UAAyB;EACxB,SAAS,KAAK;CAChB,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,aAAa,cAAc;EAAE;EAAU;CAAgB,CAAC;CAE9D,MAAM,iBAAiB,kBAAkB,OAAO,QAAQ;CAExD,gBAAgB;EACd,QAAQ,cAAc;CACxB,GAAG,CAAC,gBAAgB,OAAO,CAAC;CAE5B,IAAI,cACF,OAAO,aAAa;EAAE;EAAO;EAAU;CAAW,CAAC;CAGrD,OACE,oBAAC,MAAD;EACS;EACG;EACF;EACC;EACC;EACO;EACjB,GAAI;CACL,CAAA;AAEL;;;ACnFA,MAAM,SAASC;AAEf,OAAO,OAAO"}
|
|
@@ -12,7 +12,7 @@ interface Props$1 {
|
|
|
12
12
|
onSave?: (value: string) => void;
|
|
13
13
|
onError?: (error: string | null) => void;
|
|
14
14
|
}
|
|
15
|
-
declare const Core: ({ value, theme, height, className, prettierOptions, fragment, raw, onChange, onSave
|
|
15
|
+
declare const Core: ({ value, theme, height, className, prettierOptions, fragment, raw, onChange, onSave, onError, ...props }: Props$1) => import("react").JSX.Element;
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/components/editor/editor.d.ts
|
|
18
18
|
interface EditorRenderData {
|
|
@@ -34,4 +34,4 @@ type EditorComponent = typeof Editor$1 & {
|
|
|
34
34
|
declare const Editor: EditorComponent;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { Props$1 as a, Core as i, EditorRenderData as n, Props as r, Editor as t };
|
|
37
|
-
//# sourceMappingURL=index-
|
|
37
|
+
//# sourceMappingURL=index-Ck3akHag.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v as Section } from "./document-J9Lo9p81.js";
|
|
2
2
|
import { t as FrameProps } from "./index-DpDU1IAw.js";
|
|
3
3
|
import { A as Props, D as DndPanel, E as DndPalette, O as PanelBinding, S as Panel, T as DraggableItemProps, _ as Canvas, b as Layout, f as FieldProps, i as ItemsEditorItem, k as PanelNodeChange, n as ItemsEditor, p as DndLayout, s as ItemsEditorOptions, t as Dnd, x as Palette } from "./index-Bqc5kUAG.js";
|
|
4
|
-
import { a as Props$2, n as EditorRenderData, r as Props$1, t as Editor } from "./index-
|
|
4
|
+
import { a as Props$2, n as EditorRenderData, r as Props$1, t as Editor } from "./index-Ck3akHag.js";
|
|
5
5
|
import { a as Props$5, n as Props$4, o as Props$3, s as ErrorBoundary, t as Error } from "./index-CCynrS6c.js";
|
|
6
6
|
import { n as Props$6, t as Preview } from "./index-lgHdCda5.js";
|
|
7
7
|
//#region src/index.d.ts
|
|
@@ -17,7 +17,7 @@ declare const App: {
|
|
|
17
17
|
Guard: ({ children, onError }: Props$5) => import("react").JSX.Element;
|
|
18
18
|
};
|
|
19
19
|
Editor: (({ defaultValue, value: _value, debounce, onChange: _onChange, renderEditor, fragment, prettierOptions, ...props }: Props$1) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined) & {
|
|
20
|
-
Core: ({ value, theme, height, className, prettierOptions, fragment, raw, onChange, onSave
|
|
20
|
+
Core: ({ value, theme, height, className, prettierOptions, fragment, raw, onChange, onSave, onError, ...props }: Props$2) => import("react").JSX.Element;
|
|
21
21
|
};
|
|
22
22
|
Dnd: (({ value: _value, props, modules, onChange: _onChange, className, items, frame, dynamicTailwind, provider, children, ...restProps }: Props) => import("react").JSX.Element) & {
|
|
23
23
|
DraggableItem: ({ item, children }: DraggableItemProps) => import("react").ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ContextProvider } from "./context-DH70wj9d.js";
|
|
2
|
-
import { t as Dnd } from "./dnd-
|
|
3
|
-
import { t as Editor } from "./editor-
|
|
2
|
+
import { t as Dnd } from "./dnd-C4iBiSkv.js";
|
|
3
|
+
import { t as Editor } from "./editor-C0lphNg6.js";
|
|
4
4
|
import { t as Error } from "./error-lsJey-it.js";
|
|
5
5
|
import { t as Preview } from "./preview-CNVXyDgY.js";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
package/dist/style.css
CHANGED
|
@@ -516,13 +516,28 @@
|
|
|
516
516
|
@layer ui-kit {
|
|
517
517
|
@layer theme {
|
|
518
518
|
:root, :host {
|
|
519
|
-
--font-sans: var(--font-geist-sans);
|
|
520
|
-
--font-mono: var(--font-geist-mono);
|
|
519
|
+
--font-sans: var(--ui-font-sans, var(--font-geist-sans));
|
|
520
|
+
--font-mono: var(--ui-font-mono, var(--font-geist-mono));
|
|
521
521
|
--color-red-400: oklch(70.4% .191 22.216);
|
|
522
|
+
--color-red-500: oklch(63.7% .237 25.331);
|
|
523
|
+
--color-orange-500: oklch(70.5% .213 47.604);
|
|
524
|
+
--color-orange-600: oklch(64.6% .222 41.116);
|
|
525
|
+
--color-amber-500: oklch(76.9% .188 70.08);
|
|
522
526
|
--color-yellow-400: oklch(85.2% .199 91.936);
|
|
527
|
+
--color-yellow-500: oklch(79.5% .184 86.047);
|
|
528
|
+
--color-yellow-600: oklch(68.1% .162 75.834);
|
|
529
|
+
--color-lime-500: oklch(76.8% .233 130.85);
|
|
523
530
|
--color-green-400: oklch(79.2% .209 151.711);
|
|
531
|
+
--color-green-500: oklch(72.3% .219 149.579);
|
|
532
|
+
--color-green-600: oklch(62.7% .194 149.214);
|
|
533
|
+
--color-cyan-500: oklch(71.5% .143 215.221);
|
|
524
534
|
--color-blue-400: oklch(70.7% .165 254.624);
|
|
535
|
+
--color-blue-500: oklch(62.3% .214 259.815);
|
|
525
536
|
--color-blue-600: oklch(54.6% .245 262.881);
|
|
537
|
+
--color-indigo-500: oklch(58.5% .233 277.117);
|
|
538
|
+
--color-purple-500: oklch(62.7% .265 303.9);
|
|
539
|
+
--color-fuchsia-500: oklch(66.7% .295 322.15);
|
|
540
|
+
--color-pink-500: oklch(65.6% .241 354.308);
|
|
526
541
|
--color-gray-100: oklch(96.7% .003 264.542);
|
|
527
542
|
--color-gray-200: oklch(92.8% .006 264.531);
|
|
528
543
|
--color-gray-300: oklch(87.2% .01 258.338);
|
|
@@ -607,93 +622,91 @@
|
|
|
607
622
|
}
|
|
608
623
|
|
|
609
624
|
@layer components {
|
|
610
|
-
[data-slot="button"][data-color] {
|
|
611
|
-
--
|
|
612
|
-
--btn-border: var(--btn-bg);
|
|
613
|
-
--btn-bg-hover: var(--btn-bg);
|
|
614
|
-
|
|
615
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
616
|
-
--btn-bg-hover: color-mix(in oklch, var(--btn-bg), black 12%);
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
--btn-bg-active: var(--btn-bg);
|
|
620
|
-
|
|
621
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
622
|
-
--btn-bg-active: color-mix(in oklch, var(--btn-bg), black 22%);
|
|
623
|
-
}
|
|
625
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="blue"] {
|
|
626
|
+
--preset-color: var(--color-blue-500);
|
|
624
627
|
}
|
|
625
628
|
|
|
626
|
-
[data-slot="button"]
|
|
627
|
-
--
|
|
629
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="purple"] {
|
|
630
|
+
--preset-color: var(--color-purple-500);
|
|
628
631
|
}
|
|
629
632
|
|
|
630
|
-
[data-slot="button"][data-color="
|
|
631
|
-
--
|
|
632
|
-
--btn-border: var(--muted-foreground);
|
|
633
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="cyan"] {
|
|
634
|
+
--preset-color: var(--color-cyan-500);
|
|
633
635
|
}
|
|
634
636
|
|
|
635
|
-
[data-slot="button"][data-color="
|
|
636
|
-
--
|
|
637
|
-
--btn-fg: var(--primary-foreground);
|
|
637
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="green"] {
|
|
638
|
+
--preset-color: var(--color-green-500);
|
|
638
639
|
}
|
|
639
640
|
|
|
640
|
-
[data-slot="button"][data-color="
|
|
641
|
-
--
|
|
641
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="fuchsia"] {
|
|
642
|
+
--preset-color: var(--color-fuchsia-500);
|
|
642
643
|
}
|
|
643
644
|
|
|
644
|
-
[data-slot="button"][data-color="
|
|
645
|
-
--
|
|
645
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="pink"] {
|
|
646
|
+
--preset-color: var(--color-pink-500);
|
|
646
647
|
}
|
|
647
648
|
|
|
648
|
-
[data-slot="button"][data-color="
|
|
649
|
-
--
|
|
649
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="red"] {
|
|
650
|
+
--preset-color: var(--color-red-500);
|
|
650
651
|
}
|
|
651
652
|
|
|
652
|
-
[data-slot="button"][data-color="
|
|
653
|
-
--
|
|
653
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="orange"] {
|
|
654
|
+
--preset-color: var(--color-orange-500);
|
|
654
655
|
}
|
|
655
656
|
|
|
656
|
-
[data-slot="button"][data-color="
|
|
657
|
-
--
|
|
657
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="yellow"] {
|
|
658
|
+
--preset-color: var(--color-yellow-500);
|
|
658
659
|
}
|
|
659
660
|
|
|
660
|
-
[data-slot="button"][data-color="
|
|
661
|
-
--
|
|
661
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="indigo"] {
|
|
662
|
+
--preset-color: var(--color-indigo-500);
|
|
662
663
|
}
|
|
663
664
|
|
|
664
|
-
[data-slot="button"][data-color="
|
|
665
|
-
--
|
|
665
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="lime"] {
|
|
666
|
+
--preset-color: var(--color-lime-500);
|
|
666
667
|
}
|
|
667
668
|
|
|
668
|
-
[data-slot="button"][data-color="
|
|
669
|
-
--
|
|
669
|
+
:is([data-slot="button"], [data-slot="tag"])[data-color="amber"] {
|
|
670
|
+
--preset-color: var(--color-amber-500);
|
|
670
671
|
}
|
|
671
672
|
|
|
672
|
-
[data-slot="button"][data-color
|
|
673
|
-
--btn-bg:
|
|
674
|
-
|
|
673
|
+
[data-slot="button"][data-color] {
|
|
674
|
+
--btn-bg: var(--preset-color);
|
|
675
|
+
--btn-fg: white;
|
|
676
|
+
--btn-border: var(--btn-bg);
|
|
677
|
+
--btn-bg-hover: var(--btn-bg);
|
|
678
|
+
|
|
679
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
680
|
+
--btn-bg-hover: color-mix(in oklch, var(--btn-bg), black 12%);
|
|
681
|
+
}
|
|
675
682
|
|
|
676
|
-
|
|
677
|
-
|
|
683
|
+
--btn-bg-active: var(--btn-bg);
|
|
684
|
+
|
|
685
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
686
|
+
--btn-bg-active: color-mix(in oklch, var(--btn-bg), black 22%);
|
|
687
|
+
}
|
|
678
688
|
}
|
|
679
689
|
|
|
680
|
-
[data-slot="button"][data-color="
|
|
681
|
-
--btn-
|
|
690
|
+
[data-slot="button"][data-color="yellow"], [data-slot="button"][data-color="lime"], [data-slot="button"][data-color="amber"] {
|
|
691
|
+
--btn-fg: black;
|
|
682
692
|
}
|
|
683
693
|
|
|
684
|
-
[data-slot="button"][data-color="
|
|
685
|
-
--btn-bg:
|
|
694
|
+
[data-slot="button"][data-color="default"] {
|
|
695
|
+
--btn-bg: var(--muted);
|
|
696
|
+
--btn-border: var(--muted-foreground);
|
|
686
697
|
}
|
|
687
698
|
|
|
688
|
-
[data-slot="button"][data-color="
|
|
689
|
-
--btn-bg:
|
|
699
|
+
[data-slot="button"][data-color="primary"] {
|
|
700
|
+
--btn-bg: var(--primary);
|
|
701
|
+
--btn-fg: var(--primary-foreground);
|
|
690
702
|
}
|
|
691
703
|
|
|
692
|
-
[data-slot="button"][data-color="
|
|
693
|
-
--btn-bg:
|
|
704
|
+
[data-slot="button"][data-color="danger"] {
|
|
705
|
+
--btn-bg: var(--destructive);
|
|
694
706
|
}
|
|
695
707
|
|
|
696
|
-
[data-slot="
|
|
708
|
+
[data-slot="tag"][data-color] {
|
|
709
|
+
--tag-bg: var(--preset-color);
|
|
697
710
|
--tag-fg: var(--tag-bg);
|
|
698
711
|
--tag-tint: var(--tag-bg);
|
|
699
712
|
|
|
@@ -702,92 +715,40 @@
|
|
|
702
715
|
}
|
|
703
716
|
}
|
|
704
717
|
|
|
705
|
-
[data-slot="
|
|
718
|
+
[data-slot="tag"][data-color="default"] {
|
|
706
719
|
--tag-bg: var(--border);
|
|
707
720
|
--tag-tint: var(--muted);
|
|
708
721
|
--tag-fg: var(--muted-foreground);
|
|
709
722
|
}
|
|
710
723
|
|
|
711
|
-
[data-slot="
|
|
724
|
+
[data-slot="tag"][data-color="default"][data-variant="outlined"] {
|
|
712
725
|
--tag-fg: var(--foreground);
|
|
713
726
|
}
|
|
714
727
|
|
|
715
|
-
[data-slot="
|
|
728
|
+
[data-slot="tag"][data-color="primary"] {
|
|
716
729
|
--tag-bg: var(--primary);
|
|
717
730
|
}
|
|
718
731
|
|
|
719
|
-
[data-slot="
|
|
732
|
+
[data-slot="tag"][data-color="danger"] {
|
|
720
733
|
--tag-bg: var(--destructive);
|
|
721
734
|
}
|
|
722
735
|
|
|
723
|
-
[data-slot="
|
|
724
|
-
--tag-bg:
|
|
725
|
-
--tag-fg:
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
[data-slot="badge"][data-color="warning"] {
|
|
729
|
-
--tag-bg: oklch(79.5% .184 86.047);
|
|
730
|
-
--tag-fg: oklch(68.1% .162 75.834);
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
:is(.dark, [data-theme="dark"]) [data-slot="badge"][data-color="success"] {
|
|
734
|
-
--tag-fg: oklch(79.2% .209 151.711);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
:is(.dark, [data-theme="dark"]) [data-slot="badge"][data-color="warning"] {
|
|
738
|
-
--tag-fg: oklch(85.2% .199 91.936);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
[data-slot="badge"][data-color="blue"] {
|
|
742
|
-
--tag-bg: #3b82f6;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
[data-slot="badge"][data-color="purple"] {
|
|
746
|
-
--tag-bg: #a855f7;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
[data-slot="badge"][data-color="cyan"] {
|
|
750
|
-
--tag-bg: #06b6d4;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
[data-slot="badge"][data-color="green"] {
|
|
754
|
-
--tag-bg: #22c55e;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
[data-slot="badge"][data-color="magenta"] {
|
|
758
|
-
--tag-bg: #d946ef;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
[data-slot="badge"][data-color="pink"] {
|
|
762
|
-
--tag-bg: #ec4899;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
[data-slot="badge"][data-color="red"] {
|
|
766
|
-
--tag-bg: #ef4444;
|
|
736
|
+
[data-slot="tag"][data-color="success"] {
|
|
737
|
+
--tag-bg: var(--color-green-500);
|
|
738
|
+
--tag-fg: var(--color-green-600);
|
|
767
739
|
}
|
|
768
740
|
|
|
769
|
-
[data-slot="
|
|
770
|
-
--tag-bg:
|
|
741
|
+
[data-slot="tag"][data-color="warning"] {
|
|
742
|
+
--tag-bg: var(--color-yellow-500);
|
|
743
|
+
--tag-fg: var(--color-yellow-600);
|
|
771
744
|
}
|
|
772
745
|
|
|
773
|
-
[data-slot="
|
|
774
|
-
--tag-
|
|
746
|
+
:is(.dark, [data-theme="dark"]) [data-slot="tag"][data-color="success"] {
|
|
747
|
+
--tag-fg: var(--color-green-400);
|
|
775
748
|
}
|
|
776
749
|
|
|
777
|
-
[data-slot="
|
|
778
|
-
--tag-
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
[data-slot="badge"][data-color="geekblue"] {
|
|
782
|
-
--tag-bg: #6366f1;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
[data-slot="badge"][data-color="lime"] {
|
|
786
|
-
--tag-bg: #84cc16;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
[data-slot="badge"][data-color="gold"] {
|
|
790
|
-
--tag-bg: #f59e0b;
|
|
750
|
+
:is(.dark, [data-theme="dark"]) [data-slot="tag"][data-color="warning"] {
|
|
751
|
+
--tag-fg: var(--color-yellow-400);
|
|
791
752
|
}
|
|
792
753
|
|
|
793
754
|
[data-slot="col"] {
|
|
@@ -982,6 +943,10 @@
|
|
|
982
943
|
z-index: 50;
|
|
983
944
|
}
|
|
984
945
|
|
|
946
|
+
.z-1000 {
|
|
947
|
+
z-index: 1000;
|
|
948
|
+
}
|
|
949
|
+
|
|
985
950
|
.z-10000 {
|
|
986
951
|
z-index: 10000;
|
|
987
952
|
}
|
|
@@ -2046,6 +2011,10 @@
|
|
|
2046
2011
|
background-color: var(--card);
|
|
2047
2012
|
}
|
|
2048
2013
|
|
|
2014
|
+
.bg-chart-1 {
|
|
2015
|
+
background-color: var(--chart-1);
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2049
2018
|
.bg-destructive {
|
|
2050
2019
|
background-color: var(--destructive);
|
|
2051
2020
|
}
|
|
@@ -2082,6 +2051,10 @@
|
|
|
2082
2051
|
background-color: var(--secondary);
|
|
2083
2052
|
}
|
|
2084
2053
|
|
|
2054
|
+
.bg-sidebar {
|
|
2055
|
+
background-color: var(--sidebar);
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2085
2058
|
.bg-transparent {
|
|
2086
2059
|
background-color: #0000;
|
|
2087
2060
|
}
|
|
@@ -2251,7 +2224,7 @@
|
|
|
2251
2224
|
}
|
|
2252
2225
|
|
|
2253
2226
|
.font-mono {
|
|
2254
|
-
font-family: var(--font-geist-mono);
|
|
2227
|
+
font-family: var(--ui-font-mono, var(--font-geist-mono));
|
|
2255
2228
|
}
|
|
2256
2229
|
|
|
2257
2230
|
.text-2xl {
|
|
@@ -2537,6 +2510,11 @@
|
|
|
2537
2510
|
filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
|
|
2538
2511
|
}
|
|
2539
2512
|
|
|
2513
|
+
.invert {
|
|
2514
|
+
--tw-invert: invert(100%);
|
|
2515
|
+
filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2540
2518
|
.filter {
|
|
2541
2519
|
filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
|
|
2542
2520
|
}
|
|
@@ -3996,7 +3974,7 @@
|
|
|
3996
3974
|
}
|
|
3997
3975
|
|
|
3998
3976
|
.\[\&_\.tiptap_code\]\:font-mono .tiptap code {
|
|
3999
|
-
font-family: var(--font-geist-mono);
|
|
3977
|
+
font-family: var(--ui-font-mono, var(--font-geist-mono));
|
|
4000
3978
|
}
|
|
4001
3979
|
|
|
4002
3980
|
.\[\&_\.tiptap_code\]\:text-\[0\.85em\] .tiptap code {
|
|
@@ -4141,7 +4119,7 @@
|
|
|
4141
4119
|
}
|
|
4142
4120
|
|
|
4143
4121
|
.\[\&_\.tiptap_pre\]\:font-mono .tiptap pre {
|
|
4144
|
-
font-family: var(--font-geist-mono);
|
|
4122
|
+
font-family: var(--ui-font-mono, var(--font-geist-mono));
|
|
4145
4123
|
}
|
|
4146
4124
|
|
|
4147
4125
|
.\[\&_\.tiptap_pre\]\:text-sm .tiptap pre {
|
|
@@ -4392,6 +4370,10 @@
|
|
|
4392
4370
|
a.\[a\&\]\:hover\:text-accent-foreground:hover {
|
|
4393
4371
|
color: var(--accent-foreground);
|
|
4394
4372
|
}
|
|
4373
|
+
|
|
4374
|
+
a.\[a\&\]\:hover\:underline:hover {
|
|
4375
|
+
text-decoration-line: underline;
|
|
4376
|
+
}
|
|
4395
4377
|
}
|
|
4396
4378
|
}
|
|
4397
4379
|
|
package/dist/utils/ast/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as generateSectionPreview, c as parseDocument, i as generateDocumentCode, l as replaceDocumentSections, n as createSectionPreviewCache, o as generateSectionPreviews, r as fillSectionIds, s as getSections, t as clearDocumentParseCache } from "../../document-C6bNHl7l.js";
|
|
2
|
-
import { A as parseValue, C as parseBindingExpression, D as extractObjectProperties, E as extractNodeValue, M as generateCode, O as flattenEditableValue, S as parseBinding, T as createNodeFromValue, a as extract, b as getCurrentValue, c as moveArrayItem, d as removeArrayItems, f as updateArrayItemProperty, g as replaceIds, h as fillIds, i as clearExtractCache, j as setEditableValue, k as parseArrayExpression, l as moveArrayItems, m as clone, n as bulkUpdate, o as appendArrayItem, p as updateArrayItemValue, r as update, s as duplicateArrayItems, t as validateBindingValue, u as parseItems, w as arrayExpressionToCode, x as getStructuredValue, y as findEditableChildren } from "../../ast-
|
|
2
|
+
import { A as parseValue, C as parseBindingExpression, D as extractObjectProperties, E as extractNodeValue, M as generateCode, O as flattenEditableValue, S as parseBinding, T as createNodeFromValue, a as extract, b as getCurrentValue, c as moveArrayItem, d as removeArrayItems, f as updateArrayItemProperty, g as replaceIds, h as fillIds, i as clearExtractCache, j as setEditableValue, k as parseArrayExpression, l as moveArrayItems, m as clone, n as bulkUpdate, o as appendArrayItem, p as updateArrayItemValue, r as update, s as duplicateArrayItems, t as validateBindingValue, u as parseItems, w as arrayExpressionToCode, x as getStructuredValue, y as findEditableChildren } from "../../ast-D6R-dsk0.js";
|
|
3
3
|
export { appendArrayItem, arrayExpressionToCode, bulkUpdate, clearDocumentParseCache, clearExtractCache, clone, createNodeFromValue, createSectionPreviewCache, duplicateArrayItems, extract, extractNodeValue, extractObjectProperties, fillIds, fillSectionIds, findEditableChildren, flattenEditableValue, generateCode, generateDocumentCode, generateSectionPreview, generateSectionPreviews, getCurrentValue, getSections, getStructuredValue, moveArrayItem, moveArrayItems, parseArrayExpression, parseBinding, parseBindingExpression, parseDocument, parseItems, parseValue, removeArrayItems, replaceDocumentSections, replaceIds, setEditableValue, update, updateArrayItemProperty, updateArrayItemValue, validateBindingValue };
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "3.0.
|
|
7
|
+
"version": "3.0.2",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"module": "./dist/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
108
108
|
"@dnd-kit/sortable": "^10.0.0",
|
|
109
109
|
"@dnd-kit/utilities": "^3.2.2",
|
|
110
|
-
"@jbpark/ui-kit": "^
|
|
110
|
+
"@jbpark/ui-kit": "^9.0.0",
|
|
111
111
|
"@jbpark/use-hooks": "^4.0.1",
|
|
112
112
|
"@uiw/codemirror-theme-vscode": "^4.25.11",
|
|
113
113
|
"@uiw/react-codemirror": "^4.25.11",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core-CbuS_p_d.js","names":[],"sources":["../src/components/editor/use-format-code.ts","../src/components/editor/core.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react';\n\nimport { detectTypeScript } from '~/utils';\n\n// prettier is an optional peer dependency (#282): the editor subpath is the\n// only thing that needs it, so consumers who don't use format-on-save\n// shouldn't have to install ~9.6 MB. It's loaded lazily below and its absence\n// degrades gracefully (the code is returned unformatted) instead of throwing.\nconst loadPrettier = async () => {\n const [prettier, babel, estree, typescript] = await Promise.all([\n import('prettier'),\n import('prettier/plugins/babel'),\n import('prettier/plugins/estree'),\n import('prettier/plugins/typescript'),\n ]);\n\n return {\n format: prettier.format,\n plugins: [babel.default, estree.default, typescript.default],\n };\n};\n\nconst DEFAULT_PRETTIER_OPTIONS: Record<string, unknown> = {\n tabWidth: 2,\n singleQuote: true,\n trailingComma: 'all',\n htmlWhitespaceSensitivity: 'ignore',\n arrowParens: 'avoid',\n printWidth: 60,\n};\n\nexport interface UseFormatCodeOptions {\n fragment?: boolean;\n prettierOptions?: Record<string, unknown>;\n}\n\n// Extracted out of Core so a custom renderEditor (see editor.tsx's\n// renderEditor prop) can reuse the exact same formatting behavior instead\n// of reimplementing prettier wiring from scratch.\nexport const useFormatCode = ({\n fragment,\n prettierOptions,\n}: UseFormatCodeOptions = {}) => {\n const prettierConfig = useMemo(\n () => ({\n ...DEFAULT_PRETTIER_OPTIONS,\n ...prettierOptions,\n }),\n [prettierOptions],\n );\n\n return useCallback(\n async (code: string) => {\n const isTypeScript = detectTypeScript(code);\n const source = fragment ? `<>${code}</>` : code;\n\n // Only a missing prettier is swallowed here; a genuine format error\n // (prettier present, but the code is unparseable) still propagates so\n // the editor's Cmd+S path can surface it via onError.\n let prettier: Awaited<ReturnType<typeof loadPrettier>>;\n try {\n prettier = await loadPrettier();\n } catch {\n return code;\n }\n\n const formatted = await prettier.format(source, {\n parser: isTypeScript ? 'typescript' : 'babel',\n plugins: prettier.plugins,\n ...prettierConfig,\n });\n\n if (fragment) {\n return formatted\n .replace(/^<>\\n?/, '')\n .replace(/\\n?<\\/>;?\\s*$/, '')\n .replace(/^ {2}/gm, '')\n .trim();\n }\n\n return formatted;\n },\n [prettierConfig, fragment],\n );\n};\n","import { useCallback, useRef } from 'react';\n\nimport { javascript } from '@codemirror/lang-javascript';\nimport { vscodeLight } from '@uiw/codemirror-theme-vscode';\nimport CodeMirror, {\n type Extension,\n type ReactCodeMirrorRef,\n} from '@uiw/react-codemirror';\nimport { EditorView } from 'codemirror';\n\nimport { cn } from '~/utils';\n\nimport { useFormatCode } from './use-format-code';\n\nexport interface Props {\n value: string;\n height?: string;\n theme?: Extension | 'light' | 'dark' | 'none';\n prettierOptions?: Record<string, unknown>;\n fragment?: boolean;\n raw?: boolean;\n className?: string;\n onChange?: (value: string) => void;\n onSave?: (value: string) => void;\n onError?: (error: string | null) => void;\n}\n\nconst Core = ({\n value,\n theme,\n height,\n className,\n prettierOptions,\n fragment,\n raw,\n onChange,\n onSave: _onSave,\n onError,\n ...props\n}: Props) => {\n const editorRef = useRef<ReactCodeMirrorRef>(null);\n\n const formatCode = useFormatCode({ fragment, prettierOptions });\n\n const onSave = useCallback(\n async (val: string) => {\n try {\n const currentView = editorRef.current?.view;\n if (!currentView) {\n return;\n }\n\n const currentLength = currentView.state.doc.length;\n const cursorPos = currentView.state.selection.main.head;\n const formattedCode = raw ? val : await formatCode(val);\n\n if (currentLength === currentView.state.doc.length) {\n const newCursorPos = Math.min(cursorPos, formattedCode.length);\n const transaction = currentView.state.update({\n changes: { from: 0, to: currentLength, insert: formattedCode },\n selection: { anchor: newCursorPos },\n });\n currentView.dispatch(transaction);\n\n onChange?.(formattedCode);\n _onSave?.(formattedCode);\n }\n\n onError?.(null);\n } catch (e) {\n onError?.(e instanceof Error ? e.message : String(e));\n }\n },\n [raw, formatCode, onChange, _onSave, onError],\n );\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if ((e.metaKey || e.ctrlKey) && e.key === 's') {\n e.preventDefault();\n const currentValue =\n editorRef.current?.view?.state.doc.toString() || value;\n onSave(currentValue);\n }\n },\n [onSave, value],\n );\n\n return (\n <div className={cn(className)} onKeyDown={onKeyDown}>\n <CodeMirror\n ref={editorRef}\n theme={theme || vscodeLight}\n height={height || '100%'}\n value={value}\n extensions={[\n javascript({ jsx: true, typescript: true }),\n EditorView.lineWrapping,\n ]}\n onChange={onChange}\n {...props}\n />\n </div>\n );\n};\n\nexport default Core;\n"],"mappings":";;;;;;;;AAQA,MAAM,eAAe,YAAY;CAC/B,MAAM,CAAC,UAAU,OAAO,QAAQ,cAAc,MAAM,QAAQ,IAAI;EAC9D,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;CACT,CAAC;CAED,OAAO;EACL,QAAQ,SAAS;EACjB,SAAS;GAAC,MAAM;GAAS,OAAO;GAAS,WAAW;EAAO;CAC7D;AACF;AAEA,MAAM,2BAAoD;CACxD,UAAU;CACV,aAAa;CACb,eAAe;CACf,2BAA2B;CAC3B,aAAa;CACb,YAAY;AACd;AAUA,MAAa,iBAAiB,EAC5B,UACA,oBACwB,CAAC,MAAM;CAC/B,MAAM,iBAAiB,eACd;EACL,GAAG;EACH,GAAG;CACL,IACA,CAAC,eAAe,CAClB;CAEA,OAAO,YACL,OAAO,SAAiB;EACtB,MAAM,eAAe,iBAAiB,IAAI;EAC1C,MAAM,SAAS,WAAW,KAAK,KAAK,OAAO;EAK3C,IAAI;EACJ,IAAI;GACF,WAAW,MAAM,aAAa;EAChC,QAAQ;GACN,OAAO;EACT;EAEA,MAAM,YAAY,MAAM,SAAS,OAAO,QAAQ;GAC9C,QAAQ,eAAe,eAAe;GACtC,SAAS,SAAS;GAClB,GAAG;EACL,CAAC;EAED,IAAI,UACF,OAAO,UACJ,QAAQ,UAAU,EAAE,CAAC,CACrB,QAAQ,iBAAiB,EAAE,CAAC,CAC5B,QAAQ,WAAW,EAAE,CAAC,CACtB,KAAK;EAGV,OAAO;CACT,GACA,CAAC,gBAAgB,QAAQ,CAC3B;AACF;;;ACzDA,MAAM,QAAQ,EACZ,OACA,OACA,QACA,WACA,iBACA,UACA,KACA,UACA,QAAQ,SACR,SACA,GAAG,YACQ;CACX,MAAM,YAAY,OAA2B,IAAI;CAEjD,MAAM,aAAa,cAAc;EAAE;EAAU;CAAgB,CAAC;CAE9D,MAAM,SAAS,YACb,OAAO,QAAgB;EACrB,IAAI;GACF,MAAM,cAAc,UAAU,SAAS;GACvC,IAAI,CAAC,aACH;GAGF,MAAM,gBAAgB,YAAY,MAAM,IAAI;GAC5C,MAAM,YAAY,YAAY,MAAM,UAAU,KAAK;GACnD,MAAM,gBAAgB,MAAM,MAAM,MAAM,WAAW,GAAG;GAEtD,IAAI,kBAAkB,YAAY,MAAM,IAAI,QAAQ;IAClD,MAAM,eAAe,KAAK,IAAI,WAAW,cAAc,MAAM;IAC7D,MAAM,cAAc,YAAY,MAAM,OAAO;KAC3C,SAAS;MAAE,MAAM;MAAG,IAAI;MAAe,QAAQ;KAAc;KAC7D,WAAW,EAAE,QAAQ,aAAa;IACpC,CAAC;IACD,YAAY,SAAS,WAAW;IAEhC,WAAW,aAAa;IACxB,UAAU,aAAa;GACzB;GAEA,UAAU,IAAI;EAChB,SAAS,GAAG;GACV,UAAU,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;EACtD;CACF,GACA;EAAC;EAAK;EAAY;EAAU;EAAS;CAAO,CAC9C;CAEA,MAAM,YAAY,aACf,MAA2C;EAC1C,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,KAAK;GAC7C,EAAE,eAAe;GACjB,MAAM,eACJ,UAAU,SAAS,MAAM,MAAM,IAAI,SAAS,KAAK;GACnD,OAAO,YAAY;EACrB;CACF,GACA,CAAC,QAAQ,KAAK,CAChB;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,SAAS;EAAc;EACxC,UAAA,oBAAC,YAAD;GACE,KAAK;GACL,OAAO,SAAS;GAChB,QAAQ,UAAU;GACX;GACP,YAAY,CACV,WAAW;IAAE,KAAK;IAAM,YAAY;GAAK,CAAC,GAC1C,WAAW,YACb;GACU;GACV,GAAI;EACL,CAAA;CACE,CAAA;AAET"}
|