@tecof/theme-editor 0.0.17 → 0.0.18
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.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +14 -107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -107
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +0 -9
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -421,9 +421,11 @@ var TecofPicture = memo(({
|
|
|
421
421
|
const { apiClient } = useTecof();
|
|
422
422
|
const cdnUrl = apiClient.cdnUrl;
|
|
423
423
|
if (!data3) return null;
|
|
424
|
-
const
|
|
425
|
-
const
|
|
426
|
-
const
|
|
424
|
+
const isExternal = data3?.type === "external" || data3?.provider === "external";
|
|
425
|
+
const fileURL = isExternal ? data3?.url || "" : `${cdnUrl}/${data3?.name}`;
|
|
426
|
+
const isImageType2 = isExternal ? true : isImage(data3?.type);
|
|
427
|
+
const isVideoType = isExternal ? false : isVideo(data3?.type);
|
|
428
|
+
if (!fileURL) return null;
|
|
427
429
|
const imgWidth = width || data3?.meta?.width || 500;
|
|
428
430
|
const imgHeight = height || data3?.meta?.height || 500;
|
|
429
431
|
const sizes = getSizes(size);
|
|
@@ -13465,8 +13467,8 @@ var getImageTransformsFromRect = function(e3, t2, r2) {
|
|
|
13465
13467
|
}
|
|
13466
13468
|
d = createRect(p.left, p.top, p.right - p.left, p.bottom - p.top);
|
|
13467
13469
|
}
|
|
13468
|
-
var P = rectCorners(d), G = rectCenter(d), k2 = vectorRotate3(P.tl, o2, c2), D2 = vectorRotate3(P.br, o2, c2), U = k2.x + 0.5 * (D2.x - k2.x), B = k2.y + 0.5 * (D2.y - k2.y), V = rectTranslate(d, { x: U - G.x, y: B - G.y }), N = rectTranslate(l3, { x: U - G.x, y: B - G.y }), F = rectCenter(N), z = { x: V.x, y: V.y }, W2 = V.width, q = V.height, H2 = (F.x - z.x) / W2, Y2 = (F.y - z.y) / q, j = W2 / e3.width,
|
|
13469
|
-
return { origin:
|
|
13470
|
+
var P = rectCorners(d), G = rectCenter(d), k2 = vectorRotate3(P.tl, o2, c2), D2 = vectorRotate3(P.br, o2, c2), U = k2.x + 0.5 * (D2.x - k2.x), B = k2.y + 0.5 * (D2.y - k2.y), V = rectTranslate(d, { x: U - G.x, y: B - G.y }), N = rectTranslate(l3, { x: U - G.x, y: B - G.y }), F = rectCenter(N), z = { x: V.x, y: V.y }, W2 = V.width, q = V.height, H2 = (F.x - z.x) / W2, Y2 = (F.y - z.y) / q, j = W2 / e3.width, X2 = { x: H2 * e3.width, y: Y2 * e3.height }, Z2 = 1 - j, $2 = X2.x * Z2, K2 = X2.y * Z2, Q = { x: z.x + W2 * H2, y: z.y + q * Y2 }, J = vectorRotate3(z, o2, { x: z.x + 0.5 * W2, y: z.y + 0.5 * q }), ee2 = vectorRotate3(z, o2, Q), te2 = J.x - ee2.x, re2 = J.y - ee2.y;
|
|
13471
|
+
return { origin: X2, translation: { x: z.x - $2 + te2, y: z.y - K2 + re2 }, scale: j, rotation: r2.rotation };
|
|
13470
13472
|
};
|
|
13471
13473
|
var getEdgeTargetRect = function(e3, t2, r2, n, i2, o2, a2, c2, l3) {
|
|
13472
13474
|
var u = o2.left, s2 = o2.right, d = o2.top, p = o2.bottom, f2 = s2 - u, h2 = p - d, g = i2.left, m = i2.right, v2 = i2.top, y = i2.bottom;
|
|
@@ -14910,15 +14912,15 @@ var setup = function(e3, t2, r2) {
|
|
|
14910
14912
|
u.bindBuffer(u.ARRAY_BUFFER, S2), u.bufferData(u.ARRAY_BUFFER, C2, u.STATIC_DRAW), u.bindBuffer(u.ARRAY_BUFFER, null);
|
|
14911
14913
|
var O = createProgram(u, imageVertexShader, imageFragmentShader);
|
|
14912
14914
|
u.useProgram(O);
|
|
14913
|
-
var x = u.getUniformLocation(O, "uMatrix"), b = u.getUniformLocation(O, "uTexture"), M = u.getUniformLocation(O, "uTextureSize"), L = u.getUniformLocation(O, "uOverlayColor"), P = u.getUniformLocation(O, "uOverlayLeftTop"), G = u.getUniformLocation(O, "uOverlayRightBottom"), k2 = u.getUniformLocation(O, "uColorOpacity"), D2 = u.getUniformLocation(O, "uColorOffset"), U = u.getUniformLocation(O, "uColorMatrix"), B = u.getAttribLocation(O, "aPosition"), V = u.getAttribLocation(O, "aTexCoord"), N = createTexture(u, b, M, 0, t2), F = t2.width * r2, z = t2.height * r2, W2 = -0.5 * F, q = 0.5 * z, H2 = 0.5 * F, Y2 = -0.5 * z, j = new Float32Array([W2, q, W2, Y2, H2, q, H2, Y2]),
|
|
14915
|
+
var x = u.getUniformLocation(O, "uMatrix"), b = u.getUniformLocation(O, "uTexture"), M = u.getUniformLocation(O, "uTextureSize"), L = u.getUniformLocation(O, "uOverlayColor"), P = u.getUniformLocation(O, "uOverlayLeftTop"), G = u.getUniformLocation(O, "uOverlayRightBottom"), k2 = u.getUniformLocation(O, "uColorOpacity"), D2 = u.getUniformLocation(O, "uColorOffset"), U = u.getUniformLocation(O, "uColorMatrix"), B = u.getAttribLocation(O, "aPosition"), V = u.getAttribLocation(O, "aTexCoord"), N = createTexture(u, b, M, 0, t2), F = t2.width * r2, z = t2.height * r2, W2 = -0.5 * F, q = 0.5 * z, H2 = 0.5 * F, Y2 = -0.5 * z, j = new Float32Array([W2, q, W2, Y2, H2, q, H2, Y2]), X2 = new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]), Z2 = j.length / 2, $2 = u.createBuffer();
|
|
14914
14916
|
u.bindBuffer(u.ARRAY_BUFFER, $2), u.bufferData(u.ARRAY_BUFFER, j, u.STATIC_DRAW), u.bindBuffer(u.ARRAY_BUFFER, null);
|
|
14915
14917
|
var K2 = u.createBuffer();
|
|
14916
|
-
u.bindBuffer(u.ARRAY_BUFFER, K2), u.bufferData(u.ARRAY_BUFFER,
|
|
14918
|
+
u.bindBuffer(u.ARRAY_BUFFER, K2), u.bufferData(u.ARRAY_BUFFER, X2, u.STATIC_DRAW), u.bindBuffer(u.ARRAY_BUFFER, null);
|
|
14917
14919
|
var Q = 0, J = 0, ee2 = { release: function() {
|
|
14918
14920
|
e3.width = 1, e3.height = 1;
|
|
14919
14921
|
}, resize: function(t3, a3) {
|
|
14920
14922
|
e3.width = t3 * r2, e3.height = a3 * r2, e3.style.width = "".concat(t3, "px"), e3.style.height = "".concat(a3, "px"), n.width = t3 * r2, n.height = a3 * r2, i2.x = 0.5 * n.width, i2.y = 0.5 * n.height, o2 = n.width / n.height, u.viewport(0, 0, u.canvas.width, u.canvas.height);
|
|
14921
|
-
}, update: function(e4, l4, E2, C3, b2, M2, F2, z2, W3, q2, H3, Y3, j2,
|
|
14923
|
+
}, update: function(e4, l4, E2, C3, b2, M2, F2, z2, W3, q2, H3, Y3, j2, X3, te2, re2, ne2, ie2, oe2) {
|
|
14922
14924
|
var ae2 = H3 ? H3.height * r2 : n.height;
|
|
14923
14925
|
Q = t2.width * r2, J = t2.height * r2, e4 *= r2, l4 *= r2, E2 *= r2, C3 *= r2;
|
|
14924
14926
|
var ce = J / 2 / c2 * (n.height / ae2) * -1;
|
|
@@ -14926,7 +14928,7 @@ var setup = function(e3, t2, r2) {
|
|
|
14926
14928
|
var le2 = 0.5 * Q, ue2 = 0.5 * J;
|
|
14927
14929
|
e4 -= le2, l4 -= ue2;
|
|
14928
14930
|
var se2 = z2, de2 = -(i2.x - le2) + E2, pe = i2.y - ue2 - C3, fe2 = mat4.create();
|
|
14929
|
-
mat4.perspective(fe2, a2, o2, 1, 2 * -ce), mat4.translate(fe2, [de2, pe, ce]), mat4.translate(fe2, [e4, -l4, 0]), mat4.scale(fe2, [se2, se2, se2]), mat4.rotateZ(fe2, -F2), mat4.translate(fe2, [-e4, l4, 0]), mat4.rotateY(fe2, M2), mat4.rotateX(fe2, b2), u.clearColor(
|
|
14931
|
+
mat4.perspective(fe2, a2, o2, 1, 2 * -ce), mat4.translate(fe2, [de2, pe, ce]), mat4.translate(fe2, [e4, -l4, 0]), mat4.scale(fe2, [se2, se2, se2]), mat4.rotateZ(fe2, -F2), mat4.translate(fe2, [-e4, l4, 0]), mat4.rotateY(fe2, M2), mat4.rotateX(fe2, b2), u.clearColor(X3[0], X3[1], X3[2], 1), u.clear(u.COLOR_BUFFER_BIT);
|
|
14930
14932
|
var he2 = Y3.x * r2, ge2 = Y3.y * r2, me2 = Y3.width * r2, ve2 = Y3.height * r2, ye2 = he2, Ee2 = ye2 + me2, Te2 = n.height - ge2, _e2 = n.height - (ge2 + ve2);
|
|
14931
14933
|
u.useProgram(s2), u.uniform3fv(d, te2), u.uniform3fv(p, re2), u.uniform4fv(v2, oe2.map(function(e5, t3) {
|
|
14932
14934
|
return t3 < 3 ? e5 / 255 : e5;
|
|
@@ -23414,7 +23416,7 @@ function Ve({ defaultValue: e3, defaultLanguage: r2, defaultPath: n, value: t2,
|
|
|
23414
23416
|
}, [g], s2), l2(() => {
|
|
23415
23417
|
d.current?.editor.setTheme(E);
|
|
23416
23418
|
}, [E], s2);
|
|
23417
|
-
let
|
|
23419
|
+
let X2 = useCallback(() => {
|
|
23418
23420
|
if (!(!b.current || !d.current) && !Q.current) {
|
|
23419
23421
|
U.current(d.current);
|
|
23420
23422
|
let p = m || n, R = h(d.current, t2 || e3 || "", r2 || a2 || "", p || "");
|
|
@@ -23424,8 +23426,8 @@ function Ve({ defaultValue: e3, defaultLanguage: r2, defaultPath: n, value: t2,
|
|
|
23424
23426
|
useEffect(() => {
|
|
23425
23427
|
s2 && L.current(o2.current, d.current);
|
|
23426
23428
|
}, [s2]), useEffect(() => {
|
|
23427
|
-
!c2 && !s2 &&
|
|
23428
|
-
}, [c2, s2,
|
|
23429
|
+
!c2 && !s2 && X2();
|
|
23430
|
+
}, [c2, s2, X2]), i2.current = t2, useEffect(() => {
|
|
23429
23431
|
s2 && O && (I.current?.dispose(), I.current = o2.current?.onDidChangeModelContent((p) => {
|
|
23430
23432
|
B.current || O(o2.current.getValue(), p);
|
|
23431
23433
|
}));
|
|
@@ -23755,74 +23757,6 @@ var createLinkField = (options = {}) => {
|
|
|
23755
23757
|
) })
|
|
23756
23758
|
};
|
|
23757
23759
|
};
|
|
23758
|
-
var PRESET_COLORS = [
|
|
23759
|
-
// Grays
|
|
23760
|
-
"#ffffff",
|
|
23761
|
-
"#f4f4f5",
|
|
23762
|
-
"#d4d4d8",
|
|
23763
|
-
"#a1a1aa",
|
|
23764
|
-
"#71717a",
|
|
23765
|
-
"#3f3f46",
|
|
23766
|
-
"#27272a",
|
|
23767
|
-
"#18181b",
|
|
23768
|
-
"#000000",
|
|
23769
|
-
// Reds
|
|
23770
|
-
"#fef2f2",
|
|
23771
|
-
"#fca5a5",
|
|
23772
|
-
"#f87171",
|
|
23773
|
-
"#ef4444",
|
|
23774
|
-
"#dc2626",
|
|
23775
|
-
"#b91c1c",
|
|
23776
|
-
// Oranges
|
|
23777
|
-
"#fff7ed",
|
|
23778
|
-
"#fdba74",
|
|
23779
|
-
"#fb923c",
|
|
23780
|
-
"#f97316",
|
|
23781
|
-
"#ea580c",
|
|
23782
|
-
"#c2410c",
|
|
23783
|
-
// Yellows
|
|
23784
|
-
"#fefce8",
|
|
23785
|
-
"#fde047",
|
|
23786
|
-
"#facc15",
|
|
23787
|
-
"#eab308",
|
|
23788
|
-
"#ca8a04",
|
|
23789
|
-
"#a16207",
|
|
23790
|
-
// Greens
|
|
23791
|
-
"#f0fdf4",
|
|
23792
|
-
"#86efac",
|
|
23793
|
-
"#4ade80",
|
|
23794
|
-
"#22c55e",
|
|
23795
|
-
"#16a34a",
|
|
23796
|
-
"#15803d",
|
|
23797
|
-
// Blues
|
|
23798
|
-
"#eff6ff",
|
|
23799
|
-
"#93c5fd",
|
|
23800
|
-
"#60a5fa",
|
|
23801
|
-
"#3b82f6",
|
|
23802
|
-
"#2563eb",
|
|
23803
|
-
"#1d4ed8",
|
|
23804
|
-
// Indigos
|
|
23805
|
-
"#eef2ff",
|
|
23806
|
-
"#a5b4fc",
|
|
23807
|
-
"#818cf8",
|
|
23808
|
-
"#6366f1",
|
|
23809
|
-
"#4f46e5",
|
|
23810
|
-
"#4338ca",
|
|
23811
|
-
// Purples
|
|
23812
|
-
"#faf5ff",
|
|
23813
|
-
"#d8b4fe",
|
|
23814
|
-
"#c084fc",
|
|
23815
|
-
"#a855f7",
|
|
23816
|
-
"#9333ea",
|
|
23817
|
-
"#7e22ce",
|
|
23818
|
-
// Pinks
|
|
23819
|
-
"#fdf2f8",
|
|
23820
|
-
"#f9a8d4",
|
|
23821
|
-
"#f472b6",
|
|
23822
|
-
"#ec4899",
|
|
23823
|
-
"#db2777",
|
|
23824
|
-
"#be185d"
|
|
23825
|
-
];
|
|
23826
23760
|
var isValidHex = (hex) => /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(hex);
|
|
23827
23761
|
var normalizeHex = (hex) => {
|
|
23828
23762
|
if (!hex) return "";
|
|
@@ -23837,8 +23771,6 @@ var ColorField = ({
|
|
|
23837
23771
|
onChange,
|
|
23838
23772
|
readOnly,
|
|
23839
23773
|
showOpacity = false,
|
|
23840
|
-
showPresets = true,
|
|
23841
|
-
presetColors = PRESET_COLORS,
|
|
23842
23774
|
defaultColor = "",
|
|
23843
23775
|
placeholder = "#000000",
|
|
23844
23776
|
showReset = true
|
|
@@ -23900,13 +23832,6 @@ var ColorField = ({
|
|
|
23900
23832
|
},
|
|
23901
23833
|
[applyColor]
|
|
23902
23834
|
);
|
|
23903
|
-
const handlePresetClick = useCallback(
|
|
23904
|
-
(color) => {
|
|
23905
|
-
setHexInput(color);
|
|
23906
|
-
applyColor(color);
|
|
23907
|
-
},
|
|
23908
|
-
[applyColor]
|
|
23909
|
-
);
|
|
23910
23835
|
const handleOpacityChange = useCallback(
|
|
23911
23836
|
(e3) => {
|
|
23912
23837
|
const op = parseInt(e3.target.value, 10);
|
|
@@ -23987,24 +23912,6 @@ var ColorField = ({
|
|
|
23987
23912
|
opacity,
|
|
23988
23913
|
"%"
|
|
23989
23914
|
] })
|
|
23990
|
-
] }),
|
|
23991
|
-
showPresets && presetColors.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23992
|
-
/* @__PURE__ */ jsx("p", { className: "tecof-color-section-label", children: "Haz\u0131r Renkler" }),
|
|
23993
|
-
/* @__PURE__ */ jsx("div", { className: "tecof-color-preset-grid", children: presetColors.map((color, idx) => {
|
|
23994
|
-
const selected = currentColor?.toLowerCase() === color.toLowerCase();
|
|
23995
|
-
return /* @__PURE__ */ jsx(
|
|
23996
|
-
"button",
|
|
23997
|
-
{
|
|
23998
|
-
type: "button",
|
|
23999
|
-
className: `tecof-color-preset-swatch ${selected ? "selected" : ""} ${color.toLowerCase() === "#ffffff" ? "is-white" : ""}`,
|
|
24000
|
-
style: { background: color },
|
|
24001
|
-
onClick: () => !readOnly && handlePresetClick(color),
|
|
24002
|
-
title: color,
|
|
24003
|
-
disabled: readOnly
|
|
24004
|
-
},
|
|
24005
|
-
`${color}-${idx}`
|
|
24006
|
-
);
|
|
24007
|
-
}) })
|
|
24008
23915
|
] })
|
|
24009
23916
|
] });
|
|
24010
23917
|
};
|