@tecof/theme-editor 0.0.25 → 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 +31 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -8
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +171 -57
- 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..." })
|
|
@@ -545,8 +548,9 @@ var TecofPicture = React__default.memo(({
|
|
|
545
548
|
const { apiClient } = useTecof();
|
|
546
549
|
const cdnUrl = apiClient.cdnUrl;
|
|
547
550
|
if (!data3) return null;
|
|
551
|
+
const buildPath = (fileName) => data3?.folder && data3.folder !== "/" ? `${data3.folder.replace(/^\//, "")}/${fileName}` : fileName;
|
|
548
552
|
const isExternal = data3?.type === "external" || data3?.provider === "external";
|
|
549
|
-
const fileURL = isExternal ? data3?.url || "" : `${cdnUrl}/${data3?.name}`;
|
|
553
|
+
const fileURL = isExternal ? data3?.url || "" : `${cdnUrl}/${buildPath(data3?.name)}`;
|
|
550
554
|
const isImageType2 = isExternal ? true : isImage(data3?.type);
|
|
551
555
|
const isVideoType = isExternal ? false : isVideo(data3?.type);
|
|
552
556
|
if (!fileURL) return null;
|
|
@@ -24019,6 +24023,25 @@ var normalizeHex = (hex) => {
|
|
|
24019
24023
|
}
|
|
24020
24024
|
return v2;
|
|
24021
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
|
+
};
|
|
24022
24045
|
var ColorField = ({
|
|
24023
24046
|
value,
|
|
24024
24047
|
onChange,
|
|
@@ -24028,14 +24051,15 @@ var ColorField = ({
|
|
|
24028
24051
|
placeholder = "#000000",
|
|
24029
24052
|
showReset = true
|
|
24030
24053
|
}) => {
|
|
24031
|
-
const [hexInput, setHexInput] = React__default.useState(value || "");
|
|
24054
|
+
const [hexInput, setHexInput] = React__default.useState(() => toHex(value || ""));
|
|
24032
24055
|
const [opacity, setOpacity2] = React__default.useState(100);
|
|
24033
24056
|
const [focused, setFocused] = React__default.useState(false);
|
|
24034
24057
|
const inputRef = React__default.useRef(null);
|
|
24035
24058
|
React__default.useEffect(() => {
|
|
24036
|
-
|
|
24037
|
-
|
|
24038
|
-
|
|
24059
|
+
const hex = toHex(value || "");
|
|
24060
|
+
setHexInput(hex);
|
|
24061
|
+
if (hex && hex.length === 9) {
|
|
24062
|
+
const alphaHex = hex.slice(7, 9);
|
|
24039
24063
|
const alphaPercent = Math.round(parseInt(alphaHex, 16) / 255 * 100);
|
|
24040
24064
|
setOpacity2(alphaPercent);
|
|
24041
24065
|
} else {
|