@particle-academy/fancy-cms-ui 0.3.0 → 0.4.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/README.md +1 -1
- package/dist/{chunk-JN5MRSR2.js → chunk-6Q7DKNDZ.js} +28 -12
- package/dist/chunk-6Q7DKNDZ.js.map +1 -0
- package/dist/editor.cjs +39 -23
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.d.cts +1 -1
- package/dist/editor.d.ts +1 -1
- package/dist/editor.js +16 -16
- package/dist/editor.js.map +1 -1
- package/dist/index.cjs +25 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{useEditor-FV_extlw.d.cts → useEditor-BQtAHLHl.d.cts} +25 -3
- package/dist/{useEditor-CyPSB3OQ.d.ts → useEditor-CpX-LbfH.d.ts} +25 -3
- package/package.json +11 -8
- package/dist/chunk-JN5MRSR2.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -753,6 +753,8 @@ var input = {
|
|
|
753
753
|
fontSize: 13
|
|
754
754
|
};
|
|
755
755
|
function Inspector({ doc, selection, apply }) {
|
|
756
|
+
const uid = react.useId();
|
|
757
|
+
const fieldId = (key) => `${uid}-${key}`;
|
|
756
758
|
const node = selection ? doc.nodes[selection] : null;
|
|
757
759
|
if (!node) {
|
|
758
760
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 16, color: "var(--fcms-muted)", fontFamily: "system-ui, sans-serif", fontSize: 13 }, children: "Select an element to edit." });
|
|
@@ -764,10 +766,12 @@ function Inspector({ doc, selection, apply }) {
|
|
|
764
766
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, fontWeight: 600, color: "var(--fcms-fg)" }, children: node.type }),
|
|
765
767
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, color: "var(--fcms-muted)", marginBottom: 8 }, children: node.id }),
|
|
766
768
|
node.type === "text" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
767
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, children: "Content" }),
|
|
769
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, htmlFor: fieldId("content"), children: "Content" }),
|
|
768
770
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
769
771
|
"textarea",
|
|
770
772
|
{
|
|
773
|
+
id: fieldId("content"),
|
|
774
|
+
"data-cms-field": "content",
|
|
771
775
|
style: { ...input, minHeight: 64, resize: "vertical" },
|
|
772
776
|
value: typeof node.props.content === "string" ? node.props.content : "",
|
|
773
777
|
onChange: (e) => setProp("content", e.target.value)
|
|
@@ -775,60 +779,72 @@ function Inspector({ doc, selection, apply }) {
|
|
|
775
779
|
)
|
|
776
780
|
] }) : null,
|
|
777
781
|
node.type === "image" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
778
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, children: "Source" }),
|
|
782
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, htmlFor: fieldId("src"), children: "Source" }),
|
|
779
783
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
780
784
|
"input",
|
|
781
785
|
{
|
|
786
|
+
id: fieldId("src"),
|
|
787
|
+
"data-cms-field": "src",
|
|
782
788
|
style: input,
|
|
783
789
|
value: typeof node.props.src === "string" ? node.props.src : "",
|
|
784
790
|
onChange: (e) => setProp("src", e.target.value)
|
|
785
791
|
}
|
|
786
792
|
)
|
|
787
793
|
] }) : null,
|
|
788
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, children: "Background" }),
|
|
794
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, htmlFor: fieldId("background"), children: "Background" }),
|
|
789
795
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
790
796
|
"input",
|
|
791
797
|
{
|
|
798
|
+
id: fieldId("background"),
|
|
799
|
+
"data-cms-field": "background",
|
|
792
800
|
style: input,
|
|
793
801
|
placeholder: "#ffffff | gradient | url(\u2026)",
|
|
794
802
|
value: s.background ?? "",
|
|
795
803
|
onChange: (e) => setStyle({ background: e.target.value })
|
|
796
804
|
}
|
|
797
805
|
),
|
|
798
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, children: "Text color" }),
|
|
806
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, htmlFor: fieldId("color"), children: "Text color" }),
|
|
799
807
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
800
808
|
"input",
|
|
801
809
|
{
|
|
810
|
+
id: fieldId("color"),
|
|
811
|
+
"data-cms-field": "color",
|
|
802
812
|
style: input,
|
|
803
813
|
placeholder: "#0f172a",
|
|
804
814
|
value: s.color ?? "",
|
|
805
815
|
onChange: (e) => setStyle({ color: e.target.value })
|
|
806
816
|
}
|
|
807
817
|
),
|
|
808
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, children: "Font size (px)" }),
|
|
818
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, htmlFor: fieldId("fontSize"), children: "Font size (px)" }),
|
|
809
819
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
810
820
|
"input",
|
|
811
821
|
{
|
|
822
|
+
id: fieldId("fontSize"),
|
|
823
|
+
"data-cms-field": "fontSize",
|
|
812
824
|
type: "number",
|
|
813
825
|
style: input,
|
|
814
826
|
value: s.fontSize?.value ?? "",
|
|
815
827
|
onChange: (e) => setStyle({ fontSize: { value: Number(e.target.value) || 0, unit: "px" } })
|
|
816
828
|
}
|
|
817
829
|
),
|
|
818
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, children: "Padding (px)" }),
|
|
830
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, htmlFor: fieldId("padding"), children: "Padding (px)" }),
|
|
819
831
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
820
832
|
"input",
|
|
821
833
|
{
|
|
834
|
+
id: fieldId("padding"),
|
|
835
|
+
"data-cms-field": "padding",
|
|
822
836
|
type: "number",
|
|
823
837
|
style: input,
|
|
824
838
|
value: s.padding?.value ?? "",
|
|
825
839
|
onChange: (e) => setStyle({ padding: { value: Number(e.target.value) || 0, unit: "px" } })
|
|
826
840
|
}
|
|
827
841
|
),
|
|
828
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, children: "Opacity" }),
|
|
842
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { style: label, htmlFor: fieldId("opacity"), children: "Opacity" }),
|
|
829
843
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
830
844
|
"input",
|
|
831
845
|
{
|
|
846
|
+
id: fieldId("opacity"),
|
|
847
|
+
"data-cms-field": "opacity",
|
|
832
848
|
type: "number",
|
|
833
849
|
step: "0.1",
|
|
834
850
|
min: "0",
|
|
@@ -1057,8 +1073,8 @@ function AddElementMenu({ ed, btn }) {
|
|
|
1057
1073
|
)
|
|
1058
1074
|
] });
|
|
1059
1075
|
}
|
|
1060
|
-
var DARK_VARS = "color-scheme:dark;--fcms-bg:#0b0f19;--fcms-fg:#e5e7eb;--fcms-muted:#94a3b8;--fcms-border:#27272a;--fcms-canvas:#0f141f;--fcms-input-bg:#111827;--fcms-row-fg:#cbd5e1;--fcms-sel-bg:color-mix(in oklab, #8b5cf6 24%, transparent);--fcms-sel-fg:#ddd6fe;";
|
|
1061
|
-
var LIGHT_VARS = "color-scheme:light;--fcms-bg:#ffffff;--fcms-fg:#0f172a;--fcms-muted:#64748b;--fcms-border:#e2e8f0;--fcms-canvas:#f8fafc;--fcms-input-bg:#ffffff;--fcms-row-fg:#334155;--fcms-sel-bg:#ede9fe;--fcms-sel-fg:#5b21b6;";
|
|
1076
|
+
var DARK_VARS = "color-scheme:dark;--fcms-bg:#0b0f19;--fcms-fg:#e5e7eb;--fcms-muted:#94a3b8;--fcms-border:#27272a;--fcms-canvas:#0f141f;--fcms-input-bg:#111827;--fcms-row-fg:#cbd5e1;--fcms-sel-bg:color-mix(in oklab, #8b5cf6 24%, transparent);--fcms-sel-fg:#ddd6fe;--fcms-drop:#ec4899;--fcms-danger:#fca5a5;";
|
|
1077
|
+
var LIGHT_VARS = "color-scheme:light;--fcms-bg:#ffffff;--fcms-fg:#0f172a;--fcms-muted:#64748b;--fcms-border:#e2e8f0;--fcms-canvas:#f8fafc;--fcms-input-bg:#ffffff;--fcms-row-fg:#334155;--fcms-sel-bg:#ede9fe;--fcms-sel-fg:#5b21b6;--fcms-drop:#db2777;--fcms-danger:#dc2626;";
|
|
1062
1078
|
var CHROME_CSS = `.fancy-cms-editor{--fcms-accent:#8b5cf6;${LIGHT_VARS}}@media (prefers-color-scheme:dark){.fancy-cms-editor{${DARK_VARS}}}:where(.light,[data-theme="light"]) .fancy-cms-editor{${LIGHT_VARS}}:where(.dark,[data-theme="dark"]) .fancy-cms-editor{${DARK_VARS}}`;
|
|
1063
1079
|
|
|
1064
1080
|
exports.ADD_DEFAULTS = ADD_DEFAULTS;
|