@tecof/theme-editor 0.0.26 → 0.0.27
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/index.js +29 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -7
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -469,7 +469,9 @@ var TecofEditor = ({
|
|
|
469
469
|
] }) });
|
|
470
470
|
}
|
|
471
471
|
const plugins = [
|
|
472
|
-
...core.
|
|
472
|
+
{ ...core.blocksPlugin(), label: "Bloklar" },
|
|
473
|
+
{ ...core.outlinePlugin(), label: "Anahat" },
|
|
474
|
+
{ ...core.fieldsPlugin({ desktopSideBar: "right" }), label: "Alanlar" },
|
|
473
475
|
...extraPlugins || []
|
|
474
476
|
];
|
|
475
477
|
const mergedOverrides = {
|
|
@@ -488,7 +490,8 @@ var TecofEditor = ({
|
|
|
488
490
|
data: initialData,
|
|
489
491
|
onPublish: handlePuckPublish,
|
|
490
492
|
onChange: handleChange,
|
|
491
|
-
overrides: mergedOverrides
|
|
493
|
+
overrides: mergedOverrides,
|
|
494
|
+
metadata: { editMode: true }
|
|
492
495
|
}
|
|
493
496
|
),
|
|
494
497
|
saving && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-editor-save-indicator", children: saveStatus === "error" ? "Save failed" : "Saving..." })
|
|
@@ -24020,6 +24023,25 @@ var normalizeHex = (hex) => {
|
|
|
24020
24023
|
}
|
|
24021
24024
|
return v2;
|
|
24022
24025
|
};
|
|
24026
|
+
var toHex = (val) => {
|
|
24027
|
+
if (!val) return "";
|
|
24028
|
+
const trimmed = val.trim();
|
|
24029
|
+
if (trimmed.startsWith("#")) return trimmed;
|
|
24030
|
+
const rgbaMatch = trimmed.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)$/i);
|
|
24031
|
+
if (rgbaMatch) {
|
|
24032
|
+
const r2 = parseInt(rgbaMatch[1], 10);
|
|
24033
|
+
const g = parseInt(rgbaMatch[2], 10);
|
|
24034
|
+
const b = parseInt(rgbaMatch[3], 10);
|
|
24035
|
+
const a2 = rgbaMatch[4] !== void 0 ? parseFloat(rgbaMatch[4]) : 1;
|
|
24036
|
+
const hex = `#${[r2, g, b].map((c2) => c2.toString(16).padStart(2, "0")).join("")}`;
|
|
24037
|
+
if (a2 < 1) {
|
|
24038
|
+
const alphaHex = Math.round(a2 * 255).toString(16).padStart(2, "0");
|
|
24039
|
+
return hex + alphaHex;
|
|
24040
|
+
}
|
|
24041
|
+
return hex;
|
|
24042
|
+
}
|
|
24043
|
+
return trimmed;
|
|
24044
|
+
};
|
|
24023
24045
|
var ColorField = ({
|
|
24024
24046
|
value,
|
|
24025
24047
|
onChange,
|
|
@@ -24029,14 +24051,15 @@ var ColorField = ({
|
|
|
24029
24051
|
placeholder = "#000000",
|
|
24030
24052
|
showReset = true
|
|
24031
24053
|
}) => {
|
|
24032
|
-
const [hexInput, setHexInput] = React__default.useState(value || "");
|
|
24054
|
+
const [hexInput, setHexInput] = React__default.useState(() => toHex(value || ""));
|
|
24033
24055
|
const [opacity, setOpacity2] = React__default.useState(100);
|
|
24034
24056
|
const [focused, setFocused] = React__default.useState(false);
|
|
24035
24057
|
const inputRef = React__default.useRef(null);
|
|
24036
24058
|
React__default.useEffect(() => {
|
|
24037
|
-
|
|
24038
|
-
|
|
24039
|
-
|
|
24059
|
+
const hex = toHex(value || "");
|
|
24060
|
+
setHexInput(hex);
|
|
24061
|
+
if (hex && hex.length === 9) {
|
|
24062
|
+
const alphaHex = hex.slice(7, 9);
|
|
24040
24063
|
const alphaPercent = Math.round(parseInt(alphaHex, 16) / 255 * 100);
|
|
24041
24064
|
setOpacity2(alphaPercent);
|
|
24042
24065
|
} else {
|