@tecof/theme-editor 0.0.37 → 0.0.39

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.mjs CHANGED
@@ -468,7 +468,7 @@ var setRootProps = (draft, patch) => {
468
468
 
469
469
  // src/engine/store.ts
470
470
  var pushToHistory = (state3) => {
471
- state3.history.past.push(JSON.parse(JSON.stringify(state3.document)));
471
+ state3.history.past.push(state3.document);
472
472
  state3.history.future = [];
473
473
  };
474
474
  var useEditorStore = create()(
@@ -529,13 +529,13 @@ var useEditorStore = create()(
529
529
  undo: () => set2((state3) => {
530
530
  if (state3.history.past.length === 0) return;
531
531
  const previous = state3.history.past.pop();
532
- state3.history.future.push(JSON.parse(JSON.stringify(state3.document)));
532
+ state3.history.future.push(state3.document);
533
533
  state3.document = previous;
534
534
  }),
535
535
  redo: () => set2((state3) => {
536
536
  if (state3.history.future.length === 0) return;
537
537
  const next = state3.history.future.pop();
538
- state3.history.past.push(JSON.parse(JSON.stringify(state3.document)));
538
+ state3.history.past.push(state3.document);
539
539
  state3.document = next;
540
540
  })
541
541
  }))
@@ -611,6 +611,44 @@ var NodeRenderer = ({ node, index: index2, zoneKey }) => {
611
611
  },
612
612
  [selectNode, node.props.id, node.type, readOnly]
613
613
  );
614
+ const handleDoubleClick = useCallback(
615
+ (e3) => {
616
+ if (readOnly) return;
617
+ const target = e3.target;
618
+ const validTags = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "span", "a", "div"];
619
+ const tag = target.tagName.toLowerCase();
620
+ if (!validTags.includes(tag)) return;
621
+ const text2 = target.textContent?.trim() || "";
622
+ if (!text2) return;
623
+ let matchingPropName = null;
624
+ for (const [key, value] of Object.entries(node.props)) {
625
+ if (typeof value === "string" && value.trim() === text2) {
626
+ matchingPropName = key;
627
+ break;
628
+ }
629
+ }
630
+ if (!matchingPropName) return;
631
+ e3.stopPropagation();
632
+ target.contentEditable = "true";
633
+ target.focus();
634
+ const range = document.createRange();
635
+ range.selectNodeContents(target);
636
+ const sel = window.getSelection();
637
+ sel?.removeAllRanges();
638
+ sel?.addRange(range);
639
+ const propName = matchingPropName;
640
+ const handleBlur = () => {
641
+ target.contentEditable = "false";
642
+ target.removeEventListener("blur", handleBlur);
643
+ const newText = target.textContent?.trim() || "";
644
+ useEditorStore.getState().updateProps(node.props.id, {
645
+ [propName]: newText
646
+ });
647
+ };
648
+ target.addEventListener("blur", handleBlur);
649
+ },
650
+ [node.props, node.props.id, readOnly]
651
+ );
614
652
  if (!componentConfig) {
615
653
  return /* @__PURE__ */ jsxs("div", { style: { padding: "12px", background: "#fee2e2", color: "#991b1b", fontSize: "12px", borderRadius: "4px" }, children: [
616
654
  "Bile\u015Fen bulunamad\u0131: ",
@@ -640,6 +678,7 @@ var NodeRenderer = ({ node, index: index2, zoneKey }) => {
640
678
  onMouseEnter: handleMouseEnter,
641
679
  onMouseLeave: handleMouseLeave,
642
680
  onClick: handleClick,
681
+ onDoubleClick: handleDoubleClick,
643
682
  style: {
644
683
  cursor: readOnly ? void 0 : "pointer"
645
684
  },
@@ -707,6 +746,10 @@ var Frame = ({ children, title = "Canvas Frame", ...props }) => {
707
746
  doc.head.appendChild(style);
708
747
  };
709
748
  copyStyles();
749
+ const observer = new MutationObserver(() => {
750
+ copyStyles();
751
+ });
752
+ observer.observe(document.head, { childList: true, subtree: true });
710
753
  if (doc.body) {
711
754
  doc.body.className = "tecof-canvas-body";
712
755
  const handleBodyClick = (e3) => {
@@ -719,9 +762,24 @@ var Frame = ({ children, title = "Canvas Frame", ...props }) => {
719
762
  }
720
763
  }
721
764
  };
765
+ const handleIframeKeyDown = (e3) => {
766
+ const event = new KeyboardEvent("keydown", {
767
+ key: e3.key,
768
+ code: e3.code,
769
+ ctrlKey: e3.ctrlKey,
770
+ metaKey: e3.metaKey,
771
+ shiftKey: e3.shiftKey,
772
+ altKey: e3.altKey,
773
+ bubbles: true
774
+ });
775
+ window.dispatchEvent(event);
776
+ };
722
777
  doc.body.addEventListener("click", handleBodyClick);
778
+ doc.addEventListener("keydown", handleIframeKeyDown);
723
779
  return () => {
780
+ observer.disconnect();
724
781
  doc.body.removeEventListener("click", handleBodyClick);
782
+ doc.removeEventListener("keydown", handleIframeKeyDown);
725
783
  };
726
784
  }
727
785
  }, [contentRef]);
@@ -989,8 +1047,18 @@ var __iconNode14 = [
989
1047
  ];
990
1048
  var Globe = createLucideIcon("globe", __iconNode14);
991
1049
 
992
- // node_modules/lucide-react/dist/esm/icons/grip-vertical.js
1050
+ // node_modules/lucide-react/dist/esm/icons/grid-3x3.js
993
1051
  var __iconNode15 = [
1052
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
1053
+ ["path", { d: "M3 9h18", key: "1pudct" }],
1054
+ ["path", { d: "M3 15h18", key: "5xshup" }],
1055
+ ["path", { d: "M9 3v18", key: "fh3hqa" }],
1056
+ ["path", { d: "M15 3v18", key: "14nvp0" }]
1057
+ ];
1058
+ var Grid3x3 = createLucideIcon("grid-3x3", __iconNode15);
1059
+
1060
+ // node_modules/lucide-react/dist/esm/icons/grip-vertical.js
1061
+ var __iconNode16 = [
994
1062
  ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
995
1063
  ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
996
1064
  ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
@@ -998,28 +1066,28 @@ var __iconNode15 = [
998
1066
  ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
999
1067
  ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
1000
1068
  ];
1001
- var GripVertical = createLucideIcon("grip-vertical", __iconNode15);
1069
+ var GripVertical = createLucideIcon("grip-vertical", __iconNode16);
1002
1070
 
1003
1071
  // node_modules/lucide-react/dist/esm/icons/image-plus.js
1004
- var __iconNode16 = [
1072
+ var __iconNode17 = [
1005
1073
  ["path", { d: "M16 5h6", key: "1vod17" }],
1006
1074
  ["path", { d: "M19 2v6", key: "4bpg5p" }],
1007
1075
  ["path", { d: "M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5", key: "1ue2ih" }],
1008
1076
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
1009
1077
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
1010
1078
  ];
1011
- var ImagePlus = createLucideIcon("image-plus", __iconNode16);
1079
+ var ImagePlus = createLucideIcon("image-plus", __iconNode17);
1012
1080
 
1013
1081
  // node_modules/lucide-react/dist/esm/icons/image.js
1014
- var __iconNode17 = [
1082
+ var __iconNode18 = [
1015
1083
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
1016
1084
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
1017
1085
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
1018
1086
  ];
1019
- var Image2 = createLucideIcon("image", __iconNode17);
1087
+ var Image2 = createLucideIcon("image", __iconNode18);
1020
1088
 
1021
1089
  // node_modules/lucide-react/dist/esm/icons/languages.js
1022
- var __iconNode18 = [
1090
+ var __iconNode19 = [
1023
1091
  ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
1024
1092
  ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
1025
1093
  ["path", { d: "M2 5h12", key: "or177f" }],
@@ -1027,29 +1095,71 @@ var __iconNode18 = [
1027
1095
  ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
1028
1096
  ["path", { d: "M14 18h6", key: "1m8k6r" }]
1029
1097
  ];
1030
- var Languages = createLucideIcon("languages", __iconNode18);
1098
+ var Languages = createLucideIcon("languages", __iconNode19);
1099
+
1100
+ // node_modules/lucide-react/dist/esm/icons/layers.js
1101
+ var __iconNode20 = [
1102
+ [
1103
+ "path",
1104
+ {
1105
+ d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
1106
+ key: "zw3jo"
1107
+ }
1108
+ ],
1109
+ [
1110
+ "path",
1111
+ {
1112
+ d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
1113
+ key: "1wduqc"
1114
+ }
1115
+ ],
1116
+ [
1117
+ "path",
1118
+ {
1119
+ d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
1120
+ key: "kqbvx6"
1121
+ }
1122
+ ]
1123
+ ];
1124
+ var Layers = createLucideIcon("layers", __iconNode20);
1031
1125
 
1032
1126
  // node_modules/lucide-react/dist/esm/icons/link-2.js
1033
- var __iconNode19 = [
1127
+ var __iconNode21 = [
1034
1128
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
1035
1129
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
1036
1130
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
1037
1131
  ];
1038
- var Link2 = createLucideIcon("link-2", __iconNode19);
1132
+ var Link2 = createLucideIcon("link-2", __iconNode21);
1039
1133
 
1040
1134
  // node_modules/lucide-react/dist/esm/icons/link.js
1041
- var __iconNode20 = [
1135
+ var __iconNode22 = [
1042
1136
  ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
1043
1137
  ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
1044
1138
  ];
1045
- var Link = createLucideIcon("link", __iconNode20);
1139
+ var Link = createLucideIcon("link", __iconNode22);
1046
1140
 
1047
1141
  // node_modules/lucide-react/dist/esm/icons/loader-circle.js
1048
- var __iconNode21 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
1049
- var LoaderCircle = createLucideIcon("loader-circle", __iconNode21);
1142
+ var __iconNode23 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
1143
+ var LoaderCircle = createLucideIcon("loader-circle", __iconNode23);
1144
+
1145
+ // node_modules/lucide-react/dist/esm/icons/monitor.js
1146
+ var __iconNode24 = [
1147
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
1148
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
1149
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
1150
+ ];
1151
+ var Monitor = createLucideIcon("monitor", __iconNode24);
1152
+
1153
+ // node_modules/lucide-react/dist/esm/icons/panels-top-left.js
1154
+ var __iconNode25 = [
1155
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
1156
+ ["path", { d: "M3 9h18", key: "1pudct" }],
1157
+ ["path", { d: "M9 21V9", key: "1oto5p" }]
1158
+ ];
1159
+ var PanelsTopLeft = createLucideIcon("panels-top-left", __iconNode25);
1050
1160
 
1051
1161
  // node_modules/lucide-react/dist/esm/icons/pencil.js
1052
- var __iconNode22 = [
1162
+ var __iconNode26 = [
1053
1163
  [
1054
1164
  "path",
1055
1165
  {
@@ -1059,71 +1169,113 @@ var __iconNode22 = [
1059
1169
  ],
1060
1170
  ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
1061
1171
  ];
1062
- var Pencil = createLucideIcon("pencil", __iconNode22);
1172
+ var Pencil = createLucideIcon("pencil", __iconNode26);
1063
1173
 
1064
1174
  // node_modules/lucide-react/dist/esm/icons/plus.js
1065
- var __iconNode23 = [
1175
+ var __iconNode27 = [
1066
1176
  ["path", { d: "M5 12h14", key: "1ays0h" }],
1067
1177
  ["path", { d: "M12 5v14", key: "s699le" }]
1068
1178
  ];
1069
- var Plus = createLucideIcon("plus", __iconNode23);
1179
+ var Plus = createLucideIcon("plus", __iconNode27);
1180
+
1181
+ // node_modules/lucide-react/dist/esm/icons/redo-2.js
1182
+ var __iconNode28 = [
1183
+ ["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
1184
+ ["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
1185
+ ];
1186
+ var Redo2 = createLucideIcon("redo-2", __iconNode28);
1070
1187
 
1071
1188
  // node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
1072
- var __iconNode24 = [
1189
+ var __iconNode29 = [
1073
1190
  ["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
1074
1191
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
1075
1192
  ["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
1076
1193
  ["path", { d: "M16 16h5v5", key: "ccwih5" }]
1077
1194
  ];
1078
- var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode24);
1195
+ var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode29);
1079
1196
 
1080
1197
  // node_modules/lucide-react/dist/esm/icons/refresh-cw.js
1081
- var __iconNode25 = [
1198
+ var __iconNode30 = [
1082
1199
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
1083
1200
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
1084
1201
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
1085
1202
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
1086
1203
  ];
1087
- var RefreshCw = createLucideIcon("refresh-cw", __iconNode25);
1204
+ var RefreshCw = createLucideIcon("refresh-cw", __iconNode30);
1088
1205
 
1089
1206
  // node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
1090
- var __iconNode26 = [
1207
+ var __iconNode31 = [
1091
1208
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
1092
1209
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
1093
1210
  ];
1094
- var RotateCcw = createLucideIcon("rotate-ccw", __iconNode26);
1211
+ var RotateCcw = createLucideIcon("rotate-ccw", __iconNode31);
1212
+
1213
+ // node_modules/lucide-react/dist/esm/icons/save.js
1214
+ var __iconNode32 = [
1215
+ [
1216
+ "path",
1217
+ {
1218
+ d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
1219
+ key: "1c8476"
1220
+ }
1221
+ ],
1222
+ ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
1223
+ ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
1224
+ ];
1225
+ var Save = createLucideIcon("save", __iconNode32);
1095
1226
 
1096
1227
  // node_modules/lucide-react/dist/esm/icons/search.js
1097
- var __iconNode27 = [
1228
+ var __iconNode33 = [
1098
1229
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
1099
1230
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
1100
1231
  ];
1101
- var Search = createLucideIcon("search", __iconNode27);
1232
+ var Search = createLucideIcon("search", __iconNode33);
1233
+
1234
+ // node_modules/lucide-react/dist/esm/icons/smartphone.js
1235
+ var __iconNode34 = [
1236
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
1237
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
1238
+ ];
1239
+ var Smartphone = createLucideIcon("smartphone", __iconNode34);
1240
+
1241
+ // node_modules/lucide-react/dist/esm/icons/tablet.js
1242
+ var __iconNode35 = [
1243
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
1244
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
1245
+ ];
1246
+ var Tablet = createLucideIcon("tablet", __iconNode35);
1102
1247
 
1103
1248
  // node_modules/lucide-react/dist/esm/icons/trash-2.js
1104
- var __iconNode28 = [
1249
+ var __iconNode36 = [
1105
1250
  ["path", { d: "M10 11v6", key: "nco0om" }],
1106
1251
  ["path", { d: "M14 11v6", key: "outv1u" }],
1107
1252
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
1108
1253
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
1109
1254
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
1110
1255
  ];
1111
- var Trash2 = createLucideIcon("trash-2", __iconNode28);
1256
+ var Trash2 = createLucideIcon("trash-2", __iconNode36);
1257
+
1258
+ // node_modules/lucide-react/dist/esm/icons/undo-2.js
1259
+ var __iconNode37 = [
1260
+ ["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
1261
+ ["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
1262
+ ];
1263
+ var Undo2 = createLucideIcon("undo-2", __iconNode37);
1112
1264
 
1113
1265
  // node_modules/lucide-react/dist/esm/icons/upload.js
1114
- var __iconNode29 = [
1266
+ var __iconNode38 = [
1115
1267
  ["path", { d: "M12 3v12", key: "1x0j5s" }],
1116
1268
  ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
1117
1269
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
1118
1270
  ];
1119
- var Upload = createLucideIcon("upload", __iconNode29);
1271
+ var Upload = createLucideIcon("upload", __iconNode38);
1120
1272
 
1121
1273
  // node_modules/lucide-react/dist/esm/icons/x.js
1122
- var __iconNode30 = [
1274
+ var __iconNode39 = [
1123
1275
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1124
1276
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1125
1277
  ];
1126
- var X = createLucideIcon("x", __iconNode30);
1278
+ var X = createLucideIcon("x", __iconNode39);
1127
1279
  var useOverlayCoords = (id, iframeEl, containerEl, documentState) => {
1128
1280
  const [coords, setCoords] = useState(null);
1129
1281
  useEffect(() => {
@@ -1500,6 +1652,7 @@ var FieldRenderer = ({
1500
1652
  onChange,
1501
1653
  readOnly = false
1502
1654
  }) => {
1655
+ const [expandedIndices, setExpandedIndices] = useState({});
1503
1656
  const label = definition.label || name3;
1504
1657
  const type = definition.type;
1505
1658
  if (definition.render) {
@@ -1663,6 +1816,215 @@ var FieldRenderer = ({
1663
1816
  },
1664
1817
  opt.value
1665
1818
  )) }) });
1819
+ case "array": {
1820
+ const items = Array.isArray(value) ? value : [];
1821
+ const arrayFields = definition.arrayFields || {};
1822
+ const getItemLabel = (item2, idx) => {
1823
+ if (!item2) return `\xD6\u011Fe ${idx + 1}`;
1824
+ for (const val of Object.values(item2)) {
1825
+ if (typeof val === "string" && val.trim().length > 0) {
1826
+ return val;
1827
+ }
1828
+ if (Array.isArray(val)) {
1829
+ const trVal = val.find((v2) => typeof v2 === "object" && v2 !== null && "value" in v2);
1830
+ if (trVal && typeof trVal.value === "string" && trVal.value.trim().length > 0) {
1831
+ return trVal.value;
1832
+ }
1833
+ }
1834
+ }
1835
+ return `\xD6\u011Fe ${idx + 1}`;
1836
+ };
1837
+ const toggleExpand = (idx) => {
1838
+ setExpandedIndices((prev) => ({ ...prev, [idx]: !prev[idx] }));
1839
+ };
1840
+ const handleAdd = () => {
1841
+ const newItem = {};
1842
+ Object.entries(arrayFields).forEach(([subName, subDef]) => {
1843
+ newItem[subName] = subDef.defaultValue !== void 0 ? subDef.defaultValue : null;
1844
+ });
1845
+ onChange([...items, newItem]);
1846
+ setExpandedIndices((prev) => ({ ...prev, [items.length]: true }));
1847
+ };
1848
+ const handleRemove = (idx) => {
1849
+ const copy = [...items];
1850
+ copy.splice(idx, 1);
1851
+ onChange(copy);
1852
+ const newExpanded = { ...expandedIndices };
1853
+ delete newExpanded[idx];
1854
+ setExpandedIndices(newExpanded);
1855
+ };
1856
+ const handleMove = (idx, direction) => {
1857
+ if (direction === "up" && idx === 0) return;
1858
+ if (direction === "down" && idx === items.length - 1) return;
1859
+ const copy = [...items];
1860
+ const targetIdx = direction === "up" ? idx - 1 : idx + 1;
1861
+ const temp = copy[idx];
1862
+ copy[idx] = copy[targetIdx];
1863
+ copy[targetIdx] = temp;
1864
+ onChange(copy);
1865
+ const newExpanded = { ...expandedIndices };
1866
+ const tempExpanded = newExpanded[idx];
1867
+ newExpanded[idx] = newExpanded[targetIdx];
1868
+ newExpanded[targetIdx] = tempExpanded;
1869
+ setExpandedIndices(newExpanded);
1870
+ };
1871
+ return /* @__PURE__ */ jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px", width: "100%" }, children: [
1872
+ items.map((item2, idx) => {
1873
+ const isExpanded = !!expandedIndices[idx];
1874
+ const itemLabel = getItemLabel(item2, idx);
1875
+ return /* @__PURE__ */ jsxs(
1876
+ "div",
1877
+ {
1878
+ style: {
1879
+ border: "1px solid #e4e4e7",
1880
+ borderRadius: "8px",
1881
+ overflow: "hidden",
1882
+ background: "#f8fafc",
1883
+ display: "flex",
1884
+ flexDirection: "column"
1885
+ },
1886
+ children: [
1887
+ /* @__PURE__ */ jsxs(
1888
+ "div",
1889
+ {
1890
+ onClick: () => toggleExpand(idx),
1891
+ style: {
1892
+ padding: "8px 12px",
1893
+ display: "flex",
1894
+ alignItems: "center",
1895
+ justifyContent: "space-between",
1896
+ cursor: "pointer",
1897
+ background: "#ffffff",
1898
+ userSelect: "none"
1899
+ },
1900
+ children: [
1901
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1902
+ isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 14, color: "#71717a" }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14, color: "#71717a" }),
1903
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "13px", fontWeight: 500, color: "#3f3f46" }, children: itemLabel })
1904
+ ] }),
1905
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, onClick: (e3) => e3.stopPropagation(), children: [
1906
+ /* @__PURE__ */ jsx(
1907
+ "button",
1908
+ {
1909
+ onClick: () => handleMove(idx, "up"),
1910
+ disabled: idx === 0,
1911
+ style: {
1912
+ background: "transparent",
1913
+ border: "none",
1914
+ cursor: idx === 0 ? "not-allowed" : "pointer",
1915
+ padding: "2px",
1916
+ color: idx === 0 ? "#e4e4e7" : "#71717a"
1917
+ },
1918
+ children: /* @__PURE__ */ jsx(ArrowUp, { size: 12 })
1919
+ }
1920
+ ),
1921
+ /* @__PURE__ */ jsx(
1922
+ "button",
1923
+ {
1924
+ onClick: () => handleMove(idx, "down"),
1925
+ disabled: idx === items.length - 1,
1926
+ style: {
1927
+ background: "transparent",
1928
+ border: "none",
1929
+ cursor: idx === items.length - 1 ? "not-allowed" : "pointer",
1930
+ padding: "2px",
1931
+ color: idx === items.length - 1 ? "#e4e4e7" : "#71717a"
1932
+ },
1933
+ children: /* @__PURE__ */ jsx(ArrowDown, { size: 12 })
1934
+ }
1935
+ ),
1936
+ !readOnly && /* @__PURE__ */ jsx(
1937
+ "button",
1938
+ {
1939
+ onClick: () => handleRemove(idx),
1940
+ style: {
1941
+ background: "transparent",
1942
+ border: "none",
1943
+ cursor: "pointer",
1944
+ padding: "2px",
1945
+ color: "#ef4444",
1946
+ marginLeft: "4px"
1947
+ },
1948
+ children: /* @__PURE__ */ jsx(Trash2, { size: 12 })
1949
+ }
1950
+ )
1951
+ ] })
1952
+ ]
1953
+ }
1954
+ ),
1955
+ isExpanded && /* @__PURE__ */ jsx(
1956
+ "div",
1957
+ {
1958
+ style: {
1959
+ padding: "12px",
1960
+ borderTop: "1px solid #e4e4e7",
1961
+ display: "flex",
1962
+ flexDirection: "column",
1963
+ gap: "12px",
1964
+ background: "#ffffff"
1965
+ },
1966
+ children: Object.entries(arrayFields).map(([subFieldName, subFieldDef]) => /* @__PURE__ */ jsx(
1967
+ FieldRenderer,
1968
+ {
1969
+ name: subFieldName,
1970
+ definition: subFieldDef,
1971
+ value: item2[subFieldName],
1972
+ onChange: (newSubVal) => {
1973
+ const updatedItems = [...items];
1974
+ updatedItems[idx] = {
1975
+ ...updatedItems[idx],
1976
+ [subFieldName]: newSubVal
1977
+ };
1978
+ onChange(updatedItems);
1979
+ },
1980
+ readOnly
1981
+ },
1982
+ subFieldName
1983
+ ))
1984
+ }
1985
+ )
1986
+ ]
1987
+ },
1988
+ idx
1989
+ );
1990
+ }),
1991
+ !readOnly && /* @__PURE__ */ jsxs(
1992
+ "button",
1993
+ {
1994
+ type: "button",
1995
+ onClick: handleAdd,
1996
+ style: {
1997
+ display: "flex",
1998
+ alignItems: "center",
1999
+ justifyContent: "center",
2000
+ gap: "6px",
2001
+ width: "100%",
2002
+ padding: "10px",
2003
+ borderRadius: "8px",
2004
+ border: "1px dashed #cbd5e1",
2005
+ background: "#ffffff",
2006
+ color: "#64748b",
2007
+ fontSize: "13px",
2008
+ fontWeight: 500,
2009
+ cursor: "pointer",
2010
+ transition: "all 0.2s"
2011
+ },
2012
+ className: "tecof-add-array-item-btn",
2013
+ children: [
2014
+ /* @__PURE__ */ jsx(Plus, { size: 14 }),
2015
+ "\xD6\u011Fe Ekle"
2016
+ ]
2017
+ }
2018
+ ),
2019
+ /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: `
2020
+ .tecof-add-array-item-btn:hover {
2021
+ border-color: #3b82f6 !important;
2022
+ color: #2563eb !important;
2023
+ background-color: #eff6ff !important;
2024
+ }
2025
+ ` } })
2026
+ ] }) });
2027
+ }
1666
2028
  default:
1667
2029
  return /* @__PURE__ */ jsxs("div", { style: { padding: "8px", fontSize: "11px", color: "#71717a", background: "#fafafa", borderRadius: "4px" }, children: [
1668
2030
  'Desteklenmeyen alan t\xFCr\xFC: "',
@@ -1862,6 +2224,528 @@ var Inspector = () => {
1862
2224
  }
1863
2225
  );
1864
2226
  };
2227
+ var TopBar = ({ onSave, saving, saveStatus }) => {
2228
+ const viewport = useEditorStore((state3) => state3.viewport);
2229
+ const setViewport = useEditorStore((state3) => state3.setViewport);
2230
+ const pastCount = useEditorStore((state3) => state3.history.past.length);
2231
+ const futureCount = useEditorStore((state3) => state3.history.future.length);
2232
+ const undo = useEditorStore((state3) => state3.undo);
2233
+ const redo = useEditorStore((state3) => state3.redo);
2234
+ return /* @__PURE__ */ jsxs("div", { className: "tecof-studio-topbar", style: {
2235
+ height: "56px",
2236
+ borderBottom: "1px solid #e4e4e7",
2237
+ background: "#ffffff",
2238
+ display: "flex",
2239
+ alignItems: "center",
2240
+ justifyContent: "space-between",
2241
+ padding: "0 20px",
2242
+ boxSizing: "border-box",
2243
+ zIndex: 100
2244
+ }, children: [
2245
+ /* @__PURE__ */ jsxs("div", { className: "tecof-studio-topbar-title", style: {
2246
+ fontSize: "14px",
2247
+ fontWeight: 600,
2248
+ color: "#18181b",
2249
+ display: "flex",
2250
+ alignItems: "center",
2251
+ gap: "8px"
2252
+ }, children: [
2253
+ /* @__PURE__ */ jsx("span", { children: "Sayfa D\xFCzenleyici" }),
2254
+ saveStatus === "success" && /* @__PURE__ */ jsxs("span", { style: {
2255
+ fontSize: "11px",
2256
+ color: "#10b981",
2257
+ display: "inline-flex",
2258
+ alignItems: "center",
2259
+ gap: "4px",
2260
+ fontWeight: 500
2261
+ }, children: [
2262
+ /* @__PURE__ */ jsx(Check, { size: 12 }),
2263
+ " Kaydedildi"
2264
+ ] })
2265
+ ] }),
2266
+ /* @__PURE__ */ jsxs("div", { className: "tecof-studio-topbar-viewports", style: {
2267
+ display: "flex",
2268
+ alignItems: "center",
2269
+ background: "#f4f4f5",
2270
+ padding: "3px",
2271
+ borderRadius: "8px",
2272
+ gap: "2px"
2273
+ }, children: [
2274
+ /* @__PURE__ */ jsx(
2275
+ "button",
2276
+ {
2277
+ onClick: () => setViewport("desktop"),
2278
+ style: {
2279
+ background: viewport === "desktop" ? "#ffffff" : "transparent",
2280
+ border: "none",
2281
+ outline: "none",
2282
+ cursor: "pointer",
2283
+ padding: "6px 12px",
2284
+ borderRadius: "6px",
2285
+ color: viewport === "desktop" ? "#18181b" : "#71717a",
2286
+ display: "flex",
2287
+ alignItems: "center",
2288
+ justifyContent: "center",
2289
+ boxShadow: viewport === "desktop" ? "0 1px 3px 0 rgba(0, 0, 0, 0.1)" : "none",
2290
+ transition: "all 0.2s"
2291
+ },
2292
+ title: "Masa\xFCst\xFC",
2293
+ children: /* @__PURE__ */ jsx(Monitor, { size: 16 })
2294
+ }
2295
+ ),
2296
+ /* @__PURE__ */ jsx(
2297
+ "button",
2298
+ {
2299
+ onClick: () => setViewport("tablet"),
2300
+ style: {
2301
+ background: viewport === "tablet" ? "#ffffff" : "transparent",
2302
+ border: "none",
2303
+ outline: "none",
2304
+ cursor: "pointer",
2305
+ padding: "6px 12px",
2306
+ borderRadius: "6px",
2307
+ color: viewport === "tablet" ? "#18181b" : "#71717a",
2308
+ display: "flex",
2309
+ alignItems: "center",
2310
+ justifyContent: "center",
2311
+ boxShadow: viewport === "tablet" ? "0 1px 3px 0 rgba(0, 0, 0, 0.1)" : "none",
2312
+ transition: "all 0.2s"
2313
+ },
2314
+ title: "Tablet",
2315
+ children: /* @__PURE__ */ jsx(Tablet, { size: 16 })
2316
+ }
2317
+ ),
2318
+ /* @__PURE__ */ jsx(
2319
+ "button",
2320
+ {
2321
+ onClick: () => setViewport("mobile"),
2322
+ style: {
2323
+ background: viewport === "mobile" ? "#ffffff" : "transparent",
2324
+ border: "none",
2325
+ outline: "none",
2326
+ cursor: "pointer",
2327
+ padding: "6px 12px",
2328
+ borderRadius: "6px",
2329
+ color: viewport === "mobile" ? "#18181b" : "#71717a",
2330
+ display: "flex",
2331
+ alignItems: "center",
2332
+ justifyContent: "center",
2333
+ boxShadow: viewport === "mobile" ? "0 1px 3px 0 rgba(0, 0, 0, 0.1)" : "none",
2334
+ transition: "all 0.2s"
2335
+ },
2336
+ title: "Mobil",
2337
+ children: /* @__PURE__ */ jsx(Smartphone, { size: 16 })
2338
+ }
2339
+ )
2340
+ ] }),
2341
+ /* @__PURE__ */ jsxs("div", { className: "tecof-studio-topbar-actions", style: {
2342
+ display: "flex",
2343
+ alignItems: "center",
2344
+ gap: "12px"
2345
+ }, children: [
2346
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "4px" }, children: [
2347
+ /* @__PURE__ */ jsx(
2348
+ "button",
2349
+ {
2350
+ onClick: undo,
2351
+ disabled: pastCount === 0,
2352
+ style: {
2353
+ background: "transparent",
2354
+ border: "none",
2355
+ cursor: pastCount === 0 ? "not-allowed" : "pointer",
2356
+ padding: "8px",
2357
+ borderRadius: "6px",
2358
+ color: pastCount === 0 ? "#d4d4d8" : "#71717a",
2359
+ display: "flex",
2360
+ alignItems: "center",
2361
+ justifyContent: "center",
2362
+ transition: "background 0.2s"
2363
+ },
2364
+ title: "Geri Al",
2365
+ children: /* @__PURE__ */ jsx(Undo2, { size: 16 })
2366
+ }
2367
+ ),
2368
+ /* @__PURE__ */ jsx(
2369
+ "button",
2370
+ {
2371
+ onClick: redo,
2372
+ disabled: futureCount === 0,
2373
+ style: {
2374
+ background: "transparent",
2375
+ border: "none",
2376
+ cursor: futureCount === 0 ? "not-allowed" : "pointer",
2377
+ padding: "8px",
2378
+ borderRadius: "6px",
2379
+ color: futureCount === 0 ? "#d4d4d8" : "#71717a",
2380
+ display: "flex",
2381
+ alignItems: "center",
2382
+ justifyContent: "center",
2383
+ transition: "background 0.2s"
2384
+ },
2385
+ title: "Yinele",
2386
+ children: /* @__PURE__ */ jsx(Redo2, { size: 16 })
2387
+ }
2388
+ )
2389
+ ] }),
2390
+ /* @__PURE__ */ jsx("div", { style: { width: "1px", height: "20px", background: "#e4e4e7" } }),
2391
+ /* @__PURE__ */ jsxs(
2392
+ "button",
2393
+ {
2394
+ onClick: onSave,
2395
+ disabled: saving,
2396
+ style: {
2397
+ background: "#2563eb",
2398
+ color: "#ffffff",
2399
+ border: "none",
2400
+ cursor: saving ? "wait" : "pointer",
2401
+ padding: "8px 16px",
2402
+ borderRadius: "8px",
2403
+ fontSize: "13px",
2404
+ fontWeight: 500,
2405
+ display: "flex",
2406
+ alignItems: "center",
2407
+ gap: "8px",
2408
+ transition: "background 0.2s",
2409
+ opacity: saving ? 0.7 : 1
2410
+ },
2411
+ children: [
2412
+ /* @__PURE__ */ jsx(Save, { size: 14 }),
2413
+ saving ? "Kaydediliyor..." : "Taslak Kaydet"
2414
+ ]
2415
+ }
2416
+ )
2417
+ ] })
2418
+ ] });
2419
+ };
2420
+ var TreeNode = ({ node, depth }) => {
2421
+ const { config: config3 } = useStudio();
2422
+ const documentState = useEditorStore((state3) => state3.document);
2423
+ const selectedId = useEditorStore((state3) => state3.selection.selectedId);
2424
+ const selectNode = useEditorStore((state3) => state3.selectNode);
2425
+ const hoverNode = useEditorStore((state3) => state3.hoverNode);
2426
+ const removeNode2 = useEditorStore((state3) => state3.removeNode);
2427
+ const [expanded, setExpanded] = useState(true);
2428
+ const isSelected = selectedId === node.props.id;
2429
+ const componentConfig = config3.components[node.type];
2430
+ const label = componentConfig?.label || node.type;
2431
+ const childZoneKeys = Object.keys(documentState.zones).filter(
2432
+ (key) => key.startsWith(`${node.props.id}:`)
2433
+ );
2434
+ const hasChildren = childZoneKeys.some(
2435
+ (key) => (documentState.zones[key] || []).length > 0
2436
+ );
2437
+ return /* @__PURE__ */ jsxs("div", { className: "tecof-layers-tree-node", style: { display: "flex", flexDirection: "column" }, children: [
2438
+ /* @__PURE__ */ jsxs(
2439
+ "div",
2440
+ {
2441
+ onMouseEnter: () => hoverNode(node.props.id),
2442
+ onMouseLeave: () => hoverNode(null),
2443
+ onClick: () => selectNode(node.props.id),
2444
+ style: {
2445
+ display: "flex",
2446
+ alignItems: "center",
2447
+ justifyContent: "space-between",
2448
+ padding: "6px 8px",
2449
+ paddingLeft: `${depth * 12 + 8}px`,
2450
+ background: isSelected ? "#eff6ff" : "transparent",
2451
+ color: isSelected ? "#1d4ed8" : "#3f3f46",
2452
+ cursor: "pointer",
2453
+ borderRadius: "6px",
2454
+ fontSize: "13px",
2455
+ fontWeight: isSelected ? 500 : 400,
2456
+ transition: "all 0.15s"
2457
+ },
2458
+ children: [
2459
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
2460
+ hasChildren ? /* @__PURE__ */ jsx(
2461
+ "button",
2462
+ {
2463
+ onClick: (e3) => {
2464
+ e3.stopPropagation();
2465
+ setExpanded(!expanded);
2466
+ },
2467
+ style: {
2468
+ background: "transparent",
2469
+ border: "none",
2470
+ cursor: "pointer",
2471
+ padding: 0,
2472
+ display: "flex",
2473
+ alignItems: "center",
2474
+ color: "#a1a1aa"
2475
+ },
2476
+ children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 14 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
2477
+ }
2478
+ ) : /* @__PURE__ */ jsx("div", { style: { width: "14px" } }),
2479
+ /* @__PURE__ */ jsx(PanelsTopLeft, { size: 14, style: { color: isSelected ? "#3b82f6" : "#71717a" } }),
2480
+ /* @__PURE__ */ jsx("span", { style: {
2481
+ whiteSpace: "nowrap",
2482
+ overflow: "hidden",
2483
+ textOverflow: "ellipsis",
2484
+ maxWidth: "120px"
2485
+ }, children: label })
2486
+ ] }),
2487
+ /* @__PURE__ */ jsx(
2488
+ "button",
2489
+ {
2490
+ onClick: (e3) => {
2491
+ e3.stopPropagation();
2492
+ removeNode2(node.props.id);
2493
+ },
2494
+ className: "tecof-layers-delete-btn",
2495
+ style: {
2496
+ background: "transparent",
2497
+ border: "none",
2498
+ cursor: "pointer",
2499
+ padding: "2px",
2500
+ color: "#a1a1aa",
2501
+ display: "flex",
2502
+ alignItems: "center",
2503
+ opacity: 0,
2504
+ transition: "opacity 0.2s"
2505
+ },
2506
+ children: /* @__PURE__ */ jsx(Trash2, { size: 12 })
2507
+ }
2508
+ )
2509
+ ]
2510
+ }
2511
+ ),
2512
+ /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: `
2513
+ .tecof-layers-tree-node:hover .tecof-layers-delete-btn {
2514
+ opacity: 1 !important;
2515
+ }
2516
+ .tecof-layers-delete-btn:hover {
2517
+ color: #ef4444 !important;
2518
+ }
2519
+ ` } }),
2520
+ expanded && childZoneKeys.map((zoneKey) => {
2521
+ const zoneItems = documentState.zones[zoneKey] || [];
2522
+ const zoneName = zoneKey.split(":").pop() || "";
2523
+ if (zoneItems.length === 0) return null;
2524
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
2525
+ /* @__PURE__ */ jsx("div", { style: {
2526
+ fontSize: "10px",
2527
+ textTransform: "uppercase",
2528
+ letterSpacing: "0.05em",
2529
+ color: "#a1a1aa",
2530
+ padding: "4px 8px",
2531
+ paddingLeft: `${(depth + 1) * 12 + 14}px`,
2532
+ fontWeight: 600
2533
+ }, children: zoneName }),
2534
+ zoneItems.map((childNode) => /* @__PURE__ */ jsx(TreeNode, { node: childNode, depth: depth + 1 }, childNode.props.id))
2535
+ ] }, zoneKey);
2536
+ })
2537
+ ] });
2538
+ };
2539
+ var LayersTree = () => {
2540
+ const documentState = useEditorStore((state3) => state3.document);
2541
+ return /* @__PURE__ */ jsx("div", { className: "tecof-studio-layers-tree", style: {
2542
+ display: "flex",
2543
+ flexDirection: "column",
2544
+ gap: "2px",
2545
+ overflowY: "auto",
2546
+ height: "100%"
2547
+ }, children: documentState.content.length === 0 ? /* @__PURE__ */ jsx("div", { style: {
2548
+ textAlign: "center",
2549
+ color: "#a1a1aa",
2550
+ fontSize: "13px",
2551
+ padding: "24px 12px"
2552
+ }, children: "S\xFCr\xFCklenmi\u015F katman yok" }) : documentState.content.map((node) => /* @__PURE__ */ jsx(TreeNode, { node, depth: 0 }, node.props.id)) });
2553
+ };
2554
+ var LeftPanel = () => {
2555
+ const { config: config3 } = useStudio();
2556
+ const insertNode2 = useEditorStore((state3) => state3.insertNode);
2557
+ useEditorStore((state3) => state3.selection.selectedId);
2558
+ useEditorStore((state3) => state3.document);
2559
+ const [activeTab, setActiveTab] = useState("blocks");
2560
+ const [searchQuery, setSearchQuery] = useState("");
2561
+ const categories = config3.categories || {};
2562
+ const components = config3.components || {};
2563
+ const groupedComponents = {};
2564
+ if (Object.keys(categories).length > 0) {
2565
+ Object.entries(categories).forEach(([key, value]) => {
2566
+ groupedComponents[value.title || key] = value.components;
2567
+ });
2568
+ } else {
2569
+ Object.entries(components).forEach(([name3, compConfig]) => {
2570
+ const cat = compConfig.category || "Genel";
2571
+ if (!groupedComponents[cat]) {
2572
+ groupedComponents[cat] = [];
2573
+ }
2574
+ groupedComponents[cat].push(name3);
2575
+ });
2576
+ }
2577
+ const handleAddBlock = (type) => {
2578
+ const compConfig = components[type] || {};
2579
+ const defaultProps = compConfig.defaultProps || {};
2580
+ const newNode = {
2581
+ type,
2582
+ props: {
2583
+ id: generateId(),
2584
+ ...JSON.parse(JSON.stringify(defaultProps))
2585
+ }
2586
+ };
2587
+ insertNode2(newNode);
2588
+ };
2589
+ return /* @__PURE__ */ jsxs("div", { className: "tecof-studio-left-panel", style: {
2590
+ width: "280px",
2591
+ borderRight: "1px solid #e4e4e7",
2592
+ background: "#ffffff",
2593
+ display: "flex",
2594
+ flexDirection: "column",
2595
+ height: "100%",
2596
+ boxSizing: "border-box"
2597
+ }, children: [
2598
+ /* @__PURE__ */ jsxs("div", { style: {
2599
+ display: "flex",
2600
+ borderBottom: "1px solid #e4e4e7",
2601
+ padding: "8px 12px",
2602
+ gap: "4px"
2603
+ }, children: [
2604
+ /* @__PURE__ */ jsxs(
2605
+ "button",
2606
+ {
2607
+ onClick: () => setActiveTab("blocks"),
2608
+ style: {
2609
+ flex: 1,
2610
+ display: "flex",
2611
+ alignItems: "center",
2612
+ justifyContent: "center",
2613
+ gap: "6px",
2614
+ border: "none",
2615
+ outline: "none",
2616
+ padding: "8px",
2617
+ borderRadius: "6px",
2618
+ fontSize: "12px",
2619
+ fontWeight: 600,
2620
+ cursor: "pointer",
2621
+ background: activeTab === "blocks" ? "#f4f4f5" : "transparent",
2622
+ color: activeTab === "blocks" ? "#18181b" : "#71717a",
2623
+ transition: "all 0.2s"
2624
+ },
2625
+ children: [
2626
+ /* @__PURE__ */ jsx(Grid3x3, { size: 14 }),
2627
+ "Blok Ekle"
2628
+ ]
2629
+ }
2630
+ ),
2631
+ /* @__PURE__ */ jsxs(
2632
+ "button",
2633
+ {
2634
+ onClick: () => setActiveTab("layers"),
2635
+ style: {
2636
+ flex: 1,
2637
+ display: "flex",
2638
+ alignItems: "center",
2639
+ justifyContent: "center",
2640
+ gap: "6px",
2641
+ border: "none",
2642
+ outline: "none",
2643
+ padding: "8px",
2644
+ borderRadius: "6px",
2645
+ fontSize: "12px",
2646
+ fontWeight: 600,
2647
+ cursor: "pointer",
2648
+ background: activeTab === "layers" ? "#f4f4f5" : "transparent",
2649
+ color: activeTab === "layers" ? "#18181b" : "#71717a",
2650
+ transition: "all 0.2s"
2651
+ },
2652
+ children: [
2653
+ /* @__PURE__ */ jsx(Layers, { size: 14 }),
2654
+ "Katmanlar"
2655
+ ]
2656
+ }
2657
+ )
2658
+ ] }),
2659
+ /* @__PURE__ */ jsx("div", { style: { flex: 1, overflowY: "auto", padding: "12px" }, children: activeTab === "blocks" ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
2660
+ /* @__PURE__ */ jsxs("div", { style: {
2661
+ display: "flex",
2662
+ alignItems: "center",
2663
+ background: "#f4f4f5",
2664
+ padding: "6px 10px",
2665
+ borderRadius: "8px",
2666
+ gap: "8px"
2667
+ }, children: [
2668
+ /* @__PURE__ */ jsx(Search, { size: 14, color: "#a1a1aa" }),
2669
+ /* @__PURE__ */ jsx(
2670
+ "input",
2671
+ {
2672
+ type: "text",
2673
+ placeholder: "Bile\u015Fen ara...",
2674
+ value: searchQuery,
2675
+ onChange: (e3) => setSearchQuery(e3.target.value),
2676
+ style: {
2677
+ border: "none",
2678
+ outline: "none",
2679
+ background: "transparent",
2680
+ fontSize: "12px",
2681
+ color: "#18181b",
2682
+ width: "100%"
2683
+ }
2684
+ }
2685
+ )
2686
+ ] }),
2687
+ Object.entries(groupedComponents).map(([catTitle, blockTypes]) => {
2688
+ const filteredTypes = blockTypes.filter((type) => {
2689
+ const label = components[type]?.label || type;
2690
+ return label.toLowerCase().includes(searchQuery.toLowerCase());
2691
+ });
2692
+ if (filteredTypes.length === 0) return null;
2693
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
2694
+ /* @__PURE__ */ jsx("div", { style: {
2695
+ fontSize: "11px",
2696
+ fontWeight: 700,
2697
+ color: "#71717a",
2698
+ textTransform: "uppercase",
2699
+ letterSpacing: "0.05em"
2700
+ }, children: catTitle }),
2701
+ /* @__PURE__ */ jsx("div", { style: {
2702
+ display: "grid",
2703
+ gridTemplateColumns: "1fr",
2704
+ gap: "6px"
2705
+ }, children: filteredTypes.map((type) => {
2706
+ const compConfig = components[type] || {};
2707
+ const label = compConfig.label || type;
2708
+ return /* @__PURE__ */ jsxs(
2709
+ "button",
2710
+ {
2711
+ onClick: () => handleAddBlock(type),
2712
+ style: {
2713
+ background: "#ffffff",
2714
+ border: "1px solid #e4e4e7",
2715
+ padding: "10px 12px",
2716
+ borderRadius: "8px",
2717
+ fontSize: "13px",
2718
+ fontWeight: 500,
2719
+ color: "#3f3f46",
2720
+ cursor: "pointer",
2721
+ display: "flex",
2722
+ alignItems: "center",
2723
+ justifyContent: "space-between",
2724
+ textAlign: "left",
2725
+ transition: "all 0.2s",
2726
+ boxShadow: "0 1px 2px 0 rgba(0, 0, 0, 0.02)"
2727
+ },
2728
+ className: "tecof-studio-block-btn",
2729
+ children: [
2730
+ /* @__PURE__ */ jsx("span", { children: label }),
2731
+ /* @__PURE__ */ jsx(Plus, { size: 14, style: { color: "#a1a1aa" } })
2732
+ ]
2733
+ },
2734
+ type
2735
+ );
2736
+ }) })
2737
+ ] }, catTitle);
2738
+ }),
2739
+ /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: `
2740
+ .tecof-studio-block-btn:hover {
2741
+ border-color: #3b82f6 !important;
2742
+ color: #2563eb !important;
2743
+ background-color: #eff6ff !important;
2744
+ }
2745
+ ` } })
2746
+ ] }) : /* @__PURE__ */ jsx(LayersTree, {}) })
2747
+ ] });
2748
+ };
1865
2749
  var TecofStudio = ({
1866
2750
  pageId,
1867
2751
  config: config3,
@@ -1975,6 +2859,67 @@ var TecofStudio = ({
1975
2859
  window.addEventListener("message", onMessage);
1976
2860
  return () => window.removeEventListener("message", onMessage);
1977
2861
  }, [isEmbedded, handleSaveDraft, undo, redo, setViewport]);
2862
+ useEffect(() => {
2863
+ const handleKeyDown = (e3) => {
2864
+ const isInput2 = () => {
2865
+ const activeEl = document.activeElement;
2866
+ if (activeEl) {
2867
+ const tag = activeEl.tagName.toLowerCase();
2868
+ if (tag === "input" || tag === "textarea" || activeEl.hasAttribute("contenteditable")) {
2869
+ return true;
2870
+ }
2871
+ }
2872
+ const iframe = document.querySelector(".tecof-canvas-viewport-wrapper iframe");
2873
+ const iframeDoc = iframe?.contentDocument;
2874
+ const iframeActiveEl = iframeDoc?.activeElement;
2875
+ if (iframeActiveEl) {
2876
+ const tag = iframeActiveEl.tagName.toLowerCase();
2877
+ if (tag === "input" || tag === "textarea" || iframeActiveEl.hasAttribute("contenteditable")) {
2878
+ return true;
2879
+ }
2880
+ }
2881
+ return false;
2882
+ };
2883
+ const selectedId = useEditorStore.getState().selection.selectedId;
2884
+ const isCmdOrCtrl = e3.metaKey || e3.ctrlKey;
2885
+ if (e3.key === "Escape") {
2886
+ useEditorStore.getState().selectNode(null);
2887
+ if (isEmbedded) {
2888
+ window.parent.postMessage({ type: "puck:itemDeselected" }, "*");
2889
+ }
2890
+ return;
2891
+ }
2892
+ if (isCmdOrCtrl && e3.key.toLowerCase() === "z") {
2893
+ e3.preventDefault();
2894
+ if (e3.shiftKey) {
2895
+ redo();
2896
+ } else {
2897
+ undo();
2898
+ }
2899
+ return;
2900
+ }
2901
+ if (isCmdOrCtrl && e3.key.toLowerCase() === "y") {
2902
+ e3.preventDefault();
2903
+ redo();
2904
+ return;
2905
+ }
2906
+ if (isInput2()) return;
2907
+ if ((e3.key === "Delete" || e3.key === "Backspace") && selectedId) {
2908
+ e3.preventDefault();
2909
+ useEditorStore.getState().removeNode(selectedId);
2910
+ return;
2911
+ }
2912
+ if (isCmdOrCtrl && e3.key.toLowerCase() === "d" && selectedId) {
2913
+ e3.preventDefault();
2914
+ useEditorStore.getState().duplicateNode(selectedId);
2915
+ return;
2916
+ }
2917
+ };
2918
+ window.addEventListener("keydown", handleKeyDown);
2919
+ return () => {
2920
+ window.removeEventListener("keydown", handleKeyDown);
2921
+ };
2922
+ }, [undo, redo, isEmbedded]);
1978
2923
  const studioContextValue = useMemo(() => ({
1979
2924
  config: config3,
1980
2925
  readOnly: false,
@@ -2009,13 +2954,15 @@ var TecofStudio = ({
2009
2954
  position: "relative",
2010
2955
  background: "#f4f4f5"
2011
2956
  }, children: [
2957
+ /* @__PURE__ */ jsx(TopBar, { onSave: handleSaveDraft, saving, saveStatus }),
2012
2958
  /* @__PURE__ */ jsxs("div", { className: "tecof-studio-workspace-container", style: {
2013
2959
  display: "flex",
2014
2960
  flex: 1,
2015
- height: "100%",
2961
+ height: "calc(100% - 56px)",
2016
2962
  width: "100%",
2017
2963
  overflow: "hidden"
2018
2964
  }, children: [
2965
+ /* @__PURE__ */ jsx(LeftPanel, {}),
2019
2966
  /* @__PURE__ */ jsxs("div", { className: "tecof-studio-workspace", style: {
2020
2967
  display: "flex",
2021
2968
  flex: 1,
@@ -26610,20 +27557,29 @@ lucide-react/dist/esm/icons/file-text.js:
26610
27557
  lucide-react/dist/esm/icons/file.js:
26611
27558
  lucide-react/dist/esm/icons/folder-open.js:
26612
27559
  lucide-react/dist/esm/icons/globe.js:
27560
+ lucide-react/dist/esm/icons/grid-3x3.js:
26613
27561
  lucide-react/dist/esm/icons/grip-vertical.js:
26614
27562
  lucide-react/dist/esm/icons/image-plus.js:
26615
27563
  lucide-react/dist/esm/icons/image.js:
26616
27564
  lucide-react/dist/esm/icons/languages.js:
27565
+ lucide-react/dist/esm/icons/layers.js:
26617
27566
  lucide-react/dist/esm/icons/link-2.js:
26618
27567
  lucide-react/dist/esm/icons/link.js:
26619
27568
  lucide-react/dist/esm/icons/loader-circle.js:
27569
+ lucide-react/dist/esm/icons/monitor.js:
27570
+ lucide-react/dist/esm/icons/panels-top-left.js:
26620
27571
  lucide-react/dist/esm/icons/pencil.js:
26621
27572
  lucide-react/dist/esm/icons/plus.js:
27573
+ lucide-react/dist/esm/icons/redo-2.js:
26622
27574
  lucide-react/dist/esm/icons/refresh-ccw.js:
26623
27575
  lucide-react/dist/esm/icons/refresh-cw.js:
26624
27576
  lucide-react/dist/esm/icons/rotate-ccw.js:
27577
+ lucide-react/dist/esm/icons/save.js:
26625
27578
  lucide-react/dist/esm/icons/search.js:
27579
+ lucide-react/dist/esm/icons/smartphone.js:
27580
+ lucide-react/dist/esm/icons/tablet.js:
26626
27581
  lucide-react/dist/esm/icons/trash-2.js:
27582
+ lucide-react/dist/esm/icons/undo-2.js:
26627
27583
  lucide-react/dist/esm/icons/upload.js:
26628
27584
  lucide-react/dist/esm/icons/x.js:
26629
27585
  lucide-react/dist/esm/lucide-react.js: