@tecof/theme-editor 0.0.35 → 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
@@ -1,7 +1,6 @@
1
1
  import * as React__default from 'react';
2
2
  import React__default__default, { createContext, forwardRef, createElement, memo, useRef, useCallback, useContext, useState, useEffect, useMemo, Component, useLayoutEffect } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { blocksPlugin, outlinePlugin, fieldsPlugin, Puck, Render, usePuck, ActionBar } from '@puckeditor/core';
5
4
  import { create } from 'zustand';
6
5
  import { immer } from 'zustand/middleware/immer';
7
6
  import { nanoid } from 'nanoid';
@@ -298,872 +297,165 @@ function useTecof() {
298
297
  return ctx;
299
298
  }
300
299
 
301
- // node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
302
- var mergeClasses = (...classes) => classes.filter((className, index2, array) => {
303
- return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
304
- }).join(" ").trim();
305
-
306
- // node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.js
307
- var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
308
-
309
- // node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.js
310
- var toCamelCase = (string) => string.replace(
311
- /^([A-Z])|[\s-_]+(\w)/g,
312
- (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
313
- );
314
-
315
- // node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.js
316
- var toPascalCase = (string) => {
317
- const camelCase = toCamelCase(string);
318
- return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
300
+ // src/engine/document.ts
301
+ var EMPTY_DOCUMENT = {
302
+ root: { props: {} },
303
+ content: [],
304
+ zones: {}
319
305
  };
320
-
321
- // node_modules/lucide-react/dist/esm/defaultAttributes.js
322
- var defaultAttributes = {
323
- xmlns: "http://www.w3.org/2000/svg",
324
- width: 24,
325
- height: 24,
326
- viewBox: "0 0 24 24",
327
- fill: "none",
328
- stroke: "currentColor",
329
- strokeWidth: 2,
330
- strokeLinecap: "round",
331
- strokeLinejoin: "round"
306
+ var parseDocument = (rawData) => {
307
+ if (!rawData) return { ...EMPTY_DOCUMENT };
308
+ return {
309
+ root: rawData.root || { props: {} },
310
+ content: rawData.content || [],
311
+ zones: rawData.zones || {}
312
+ };
313
+ };
314
+ var serializeDocument = (doc) => {
315
+ return {
316
+ root: doc.root,
317
+ content: doc.content,
318
+ zones: doc.zones
319
+ };
332
320
  };
333
321
 
334
- // node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.js
335
- var hasA11yProp = (props) => {
336
- for (const prop in props) {
337
- if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
338
- return true;
322
+ // src/engine/zones.ts
323
+ var parseZoneKey = (zoneKey) => {
324
+ const parts = zoneKey.split(":");
325
+ return {
326
+ parentId: parts[0],
327
+ slotName: parts[1] || "default"
328
+ };
329
+ };
330
+ var findNodeById = (doc, id) => {
331
+ for (let i2 = 0; i2 < doc.content.length; i2++) {
332
+ if (doc.content[i2].props.id === id) {
333
+ return { node: doc.content[i2], path: { index: i2 } };
339
334
  }
340
335
  }
341
- return false;
336
+ for (const [zoneKey, items] of Object.entries(doc.zones)) {
337
+ for (let i2 = 0; i2 < items.length; i2++) {
338
+ if (items[i2].props.id === id) {
339
+ return { node: items[i2], path: { zoneKey, index: i2 } };
340
+ }
341
+ }
342
+ }
343
+ return null;
342
344
  };
343
- var LucideContext = createContext({});
344
- var useLucideContext = () => useContext(LucideContext);
345
-
346
- // node_modules/lucide-react/dist/esm/Icon.js
347
- var Icon = forwardRef(
348
- ({ color, size, strokeWidth, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref) => {
349
- const {
350
- size: contextSize = 24,
351
- strokeWidth: contextStrokeWidth = 2,
352
- absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
353
- color: contextColor = "currentColor",
354
- className: contextClass = ""
355
- } = useLucideContext() ?? {};
356
- const calculatedStrokeWidth = absoluteStrokeWidth ?? contextAbsoluteStrokeWidth ? Number(strokeWidth ?? contextStrokeWidth) * 24 / Number(size ?? contextSize) : strokeWidth ?? contextStrokeWidth;
357
- return createElement(
358
- "svg",
359
- {
360
- ref,
361
- ...defaultAttributes,
362
- width: size ?? contextSize ?? defaultAttributes.width,
363
- height: size ?? contextSize ?? defaultAttributes.height,
364
- stroke: color ?? contextColor,
365
- strokeWidth: calculatedStrokeWidth,
366
- className: mergeClasses("lucide", contextClass, className),
367
- ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
368
- ...rest
369
- },
370
- [
371
- ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
372
- ...Array.isArray(children) ? children : [children]
373
- ]
374
- );
345
+ var getDescendantZoneKeys = (zones, nodeId, acc = []) => {
346
+ const prefix = `${nodeId}:`;
347
+ for (const zoneKey of Object.keys(zones)) {
348
+ if (zoneKey.startsWith(prefix)) {
349
+ acc.push(zoneKey);
350
+ for (const child of zones[zoneKey]) {
351
+ getDescendantZoneKeys(zones, child.props.id, acc);
352
+ }
353
+ }
375
354
  }
376
- );
377
-
378
- // node_modules/lucide-react/dist/esm/createLucideIcon.js
379
- var createLucideIcon = (iconName, iconNode) => {
380
- const Component2 = forwardRef(
381
- ({ className, ...props }, ref) => createElement(Icon, {
382
- ref,
383
- iconNode,
384
- className: mergeClasses(
385
- `lucide-${toKebabCase(toPascalCase(iconName))}`,
386
- `lucide-${iconName}`,
387
- className
388
- ),
389
- ...props
390
- })
391
- );
392
- Component2.displayName = toPascalCase(iconName);
393
- return Component2;
355
+ return acc;
394
356
  };
395
-
396
- // node_modules/lucide-react/dist/esm/icons/arrow-down.js
397
- var __iconNode = [
398
- ["path", { d: "M12 5v14", key: "s699le" }],
399
- ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
400
- ];
401
- var ArrowDown = createLucideIcon("arrow-down", __iconNode);
402
-
403
- // node_modules/lucide-react/dist/esm/icons/arrow-up.js
404
- var __iconNode2 = [
405
- ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
406
- ["path", { d: "M12 19V5", key: "x0mq9r" }]
407
- ];
408
- var ArrowUp = createLucideIcon("arrow-up", __iconNode2);
409
-
410
- // node_modules/lucide-react/dist/esm/icons/check.js
411
- var __iconNode3 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
412
- var Check = createLucideIcon("check", __iconNode3);
413
-
414
- // node_modules/lucide-react/dist/esm/icons/chevron-down.js
415
- var __iconNode4 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
416
- var ChevronDown = createLucideIcon("chevron-down", __iconNode4);
417
-
418
- // node_modules/lucide-react/dist/esm/icons/chevron-right.js
419
- var __iconNode5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
420
- var ChevronRight = createLucideIcon("chevron-right", __iconNode5);
421
-
422
- // node_modules/lucide-react/dist/esm/icons/chevron-up.js
423
- var __iconNode6 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
424
- var ChevronUp = createLucideIcon("chevron-up", __iconNode6);
425
-
426
- // node_modules/lucide-react/dist/esm/icons/code.js
427
- var __iconNode7 = [
428
- ["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
429
- ["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
430
- ];
431
- var Code = createLucideIcon("code", __iconNode7);
432
-
433
- // node_modules/lucide-react/dist/esm/icons/copy.js
434
- var __iconNode8 = [
435
- ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
436
- ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
437
- ];
438
- var Copy = createLucideIcon("copy", __iconNode8);
439
-
440
- // node_modules/lucide-react/dist/esm/icons/database.js
441
- var __iconNode9 = [
442
- ["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
443
- ["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
444
- ["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
445
- ];
446
- var Database = createLucideIcon("database", __iconNode9);
447
-
448
- // node_modules/lucide-react/dist/esm/icons/external-link.js
449
- var __iconNode10 = [
450
- ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
451
- ["path", { d: "M10 14 21 3", key: "gplh6r" }],
452
- ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
453
- ];
454
- var ExternalLink = createLucideIcon("external-link", __iconNode10);
455
-
456
- // node_modules/lucide-react/dist/esm/icons/file-text.js
457
- var __iconNode11 = [
458
- [
459
- "path",
460
- {
461
- d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
462
- key: "1oefj6"
357
+ var getParentId = (doc, id) => {
358
+ const res2 = findNodeById(doc, id);
359
+ if (!res2 || !res2.path.zoneKey) return null;
360
+ return parseZoneKey(res2.path.zoneKey).parentId;
361
+ };
362
+ var getBreadcrumbs = (doc, id) => {
363
+ const crumbs = [];
364
+ let currentId = id;
365
+ while (currentId) {
366
+ const res2 = findNodeById(doc, currentId);
367
+ if (!res2) break;
368
+ crumbs.unshift({ id: currentId, type: res2.node.type });
369
+ currentId = res2.path.zoneKey ? parseZoneKey(res2.path.zoneKey).parentId : null;
370
+ }
371
+ return crumbs;
372
+ };
373
+ var generateId = () => nanoid(8);
374
+ var remapNodeIds = (node, sourceZones, idMap = /* @__PURE__ */ new Map()) => {
375
+ const oldId = node.props.id;
376
+ const newId = generateId();
377
+ idMap.set(oldId, newId);
378
+ const remappedNode = {
379
+ ...node,
380
+ props: {
381
+ ...node.props,
382
+ id: newId
463
383
  }
464
- ],
465
- ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
466
- ["path", { d: "M10 9H8", key: "b1mrlr" }],
467
- ["path", { d: "M16 13H8", key: "t4e002" }],
468
- ["path", { d: "M16 17H8", key: "z1uh3a" }]
469
- ];
470
- var FileText = createLucideIcon("file-text", __iconNode11);
384
+ };
385
+ const newZones = {};
386
+ const prefix = `${oldId}:`;
387
+ for (const [zoneKey, zoneItems] of Object.entries(sourceZones)) {
388
+ if (zoneKey.startsWith(prefix)) {
389
+ const slotName = zoneKey.split(":")[1];
390
+ const newZoneKey = `${newId}:${slotName}`;
391
+ const newZoneItems = [];
392
+ for (const item2 of zoneItems) {
393
+ const { remappedNode: childNode, newZones: childZones } = remapNodeIds(item2, sourceZones, idMap);
394
+ newZoneItems.push(childNode);
395
+ Object.assign(newZones, childZones);
396
+ }
397
+ newZones[newZoneKey] = newZoneItems;
398
+ }
399
+ }
400
+ return { remappedNode, newZones };
401
+ };
471
402
 
472
- // node_modules/lucide-react/dist/esm/icons/file.js
473
- var __iconNode12 = [
474
- [
475
- "path",
476
- {
477
- d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
478
- key: "1oefj6"
479
- }
480
- ],
481
- ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
482
- ];
483
- var File2 = createLucideIcon("file", __iconNode12);
484
-
485
- // node_modules/lucide-react/dist/esm/icons/folder-open.js
486
- var __iconNode13 = [
487
- [
488
- "path",
489
- {
490
- d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
491
- key: "usdka0"
492
- }
493
- ]
494
- ];
495
- var FolderOpen = createLucideIcon("folder-open", __iconNode13);
496
-
497
- // node_modules/lucide-react/dist/esm/icons/globe.js
498
- var __iconNode14 = [
499
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
500
- ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
501
- ["path", { d: "M2 12h20", key: "9i4pu4" }]
502
- ];
503
- var Globe = createLucideIcon("globe", __iconNode14);
504
-
505
- // node_modules/lucide-react/dist/esm/icons/grip-vertical.js
506
- var __iconNode15 = [
507
- ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
508
- ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
509
- ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
510
- ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
511
- ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
512
- ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
513
- ];
514
- var GripVertical = createLucideIcon("grip-vertical", __iconNode15);
515
-
516
- // node_modules/lucide-react/dist/esm/icons/image-plus.js
517
- var __iconNode16 = [
518
- ["path", { d: "M16 5h6", key: "1vod17" }],
519
- ["path", { d: "M19 2v6", key: "4bpg5p" }],
520
- ["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" }],
521
- ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
522
- ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
523
- ];
524
- var ImagePlus = createLucideIcon("image-plus", __iconNode16);
525
-
526
- // node_modules/lucide-react/dist/esm/icons/image.js
527
- var __iconNode17 = [
528
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
529
- ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
530
- ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
531
- ];
532
- var Image2 = createLucideIcon("image", __iconNode17);
533
-
534
- // node_modules/lucide-react/dist/esm/icons/languages.js
535
- var __iconNode18 = [
536
- ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
537
- ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
538
- ["path", { d: "M2 5h12", key: "or177f" }],
539
- ["path", { d: "M7 2h1", key: "1t2jsx" }],
540
- ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
541
- ["path", { d: "M14 18h6", key: "1m8k6r" }]
542
- ];
543
- var Languages = createLucideIcon("languages", __iconNode18);
544
-
545
- // node_modules/lucide-react/dist/esm/icons/link-2.js
546
- var __iconNode19 = [
547
- ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
548
- ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
549
- ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
550
- ];
551
- var Link2 = createLucideIcon("link-2", __iconNode19);
552
-
553
- // node_modules/lucide-react/dist/esm/icons/link.js
554
- var __iconNode20 = [
555
- ["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" }],
556
- ["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" }]
557
- ];
558
- var Link = createLucideIcon("link", __iconNode20);
559
-
560
- // node_modules/lucide-react/dist/esm/icons/loader-circle.js
561
- var __iconNode21 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
562
- var LoaderCircle = createLucideIcon("loader-circle", __iconNode21);
563
-
564
- // node_modules/lucide-react/dist/esm/icons/pencil.js
565
- var __iconNode22 = [
566
- [
567
- "path",
568
- {
569
- d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
570
- key: "1a8usu"
571
- }
572
- ],
573
- ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
574
- ];
575
- var Pencil = createLucideIcon("pencil", __iconNode22);
576
-
577
- // node_modules/lucide-react/dist/esm/icons/plus.js
578
- var __iconNode23 = [
579
- ["path", { d: "M5 12h14", key: "1ays0h" }],
580
- ["path", { d: "M12 5v14", key: "s699le" }]
581
- ];
582
- var Plus = createLucideIcon("plus", __iconNode23);
583
-
584
- // node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
585
- var __iconNode24 = [
586
- ["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
587
- ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
588
- ["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
589
- ["path", { d: "M16 16h5v5", key: "ccwih5" }]
590
- ];
591
- var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode24);
592
-
593
- // node_modules/lucide-react/dist/esm/icons/refresh-cw.js
594
- var __iconNode25 = [
595
- ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
596
- ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
597
- ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
598
- ["path", { d: "M8 16H3v5", key: "1cv678" }]
599
- ];
600
- var RefreshCw = createLucideIcon("refresh-cw", __iconNode25);
601
-
602
- // node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
603
- var __iconNode26 = [
604
- ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
605
- ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
606
- ];
607
- var RotateCcw = createLucideIcon("rotate-ccw", __iconNode26);
608
-
609
- // node_modules/lucide-react/dist/esm/icons/search.js
610
- var __iconNode27 = [
611
- ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
612
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
613
- ];
614
- var Search = createLucideIcon("search", __iconNode27);
615
-
616
- // node_modules/lucide-react/dist/esm/icons/trash-2.js
617
- var __iconNode28 = [
618
- ["path", { d: "M10 11v6", key: "nco0om" }],
619
- ["path", { d: "M14 11v6", key: "outv1u" }],
620
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
621
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
622
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
623
- ];
624
- var Trash2 = createLucideIcon("trash-2", __iconNode28);
625
-
626
- // node_modules/lucide-react/dist/esm/icons/upload.js
627
- var __iconNode29 = [
628
- ["path", { d: "M12 3v12", key: "1x0j5s" }],
629
- ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
630
- ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
631
- ];
632
- var Upload = createLucideIcon("upload", __iconNode29);
633
-
634
- // node_modules/lucide-react/dist/esm/icons/x.js
635
- var __iconNode30 = [
636
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
637
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
638
- ];
639
- var X = createLucideIcon("x", __iconNode30);
640
- var EMPTY_PAGE = { content: [], root: { props: {} }, zones: {} };
641
- var DrawerSearchContext = createContext(null);
642
- var ComponentDrawerItem = ({
643
- name: name3,
644
- apiClient,
645
- children
646
- }) => {
647
- const [imgSrc, setImgSrc] = useState(null);
648
- const [loading, setLoading] = useState(false);
649
- const [error2, setError] = useState(false);
650
- const fetchedRef = useRef(false);
651
- const handleMouseEnter = useCallback(async () => {
652
- if (fetchedRef.current) return;
653
- fetchedRef.current = true;
654
- setLoading(true);
655
- try {
656
- const domain = typeof window !== "undefined" ? window.location.hostname : "";
657
- const blobUrl = await apiClient.getComponentPreview(domain, name3);
658
- if (blobUrl) {
659
- setImgSrc(blobUrl);
660
- } else {
661
- setError(true);
662
- }
663
- } catch {
664
- setError(true);
665
- } finally {
666
- setLoading(false);
403
+ // src/engine/operations.ts
404
+ var insertNode = (draft, node, targetZoneKey, index2) => {
405
+ if (!node.props.id) {
406
+ node.props.id = generateId();
407
+ }
408
+ let list3 = targetZoneKey ? draft.zones[targetZoneKey] : draft.content;
409
+ if (!list3) {
410
+ list3 = [];
411
+ if (targetZoneKey) {
412
+ draft.zones[targetZoneKey] = list3;
667
413
  }
668
- }, [name3, apiClient]);
669
- return /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-item-group group", onMouseEnter: handleMouseEnter, children: [
670
- children,
671
- /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-popover", children: [
672
- /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-popover-header", children: [
673
- name3,
674
- " \xD6nizleme"
675
- ] }),
676
- /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-popover-body", children: [
677
- (loading || !imgSrc && !error2) && /* @__PURE__ */ jsx("div", { className: "tecof-drawer-skeleton" }),
678
- imgSrc && /* @__PURE__ */ jsx(
679
- "img",
680
- {
681
- src: imgSrc,
682
- alt: `${name3} preview`,
683
- className: "tecof-drawer-img"
684
- }
685
- ),
686
- error2 && /* @__PURE__ */ jsx("div", { className: "tecof-drawer-preview-error", children: "\xD6nizleme y\xFCklenemedi" })
687
- ] })
688
- ] })
689
- ] });
414
+ }
415
+ const insertIndex = typeof index2 === "number" ? index2 : list3.length;
416
+ list3.splice(insertIndex, 0, node);
690
417
  };
691
- var CustomDrawer = ({ children }) => {
692
- const context = useContext(DrawerSearchContext);
693
- if (!context) return /* @__PURE__ */ jsx("div", { className: "tecof-drawer-list-layout", children });
694
- const { searchQuery, setSearchQuery } = context;
695
- return /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-wrapper-layout", children: [
696
- /* @__PURE__ */ jsx("div", { className: "tecof-drawer-search-wrapper", children: /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-search-box", children: [
697
- /* @__PURE__ */ jsx(Search, { size: 14, color: "#71717a" }),
698
- /* @__PURE__ */ jsx(
699
- "input",
700
- {
701
- type: "text",
702
- placeholder: "Blok ara...",
703
- value: searchQuery,
704
- onChange: (e3) => setSearchQuery(e3.target.value),
705
- className: "tecof-drawer-search-input"
706
- }
707
- ),
708
- searchQuery && /* @__PURE__ */ jsx(
709
- "button",
710
- {
711
- type: "button",
712
- onClick: () => setSearchQuery(""),
713
- className: "tecof-drawer-clear-btn",
714
- title: "Temizle",
715
- children: /* @__PURE__ */ jsx(X, { size: 14 })
716
- }
717
- )
718
- ] }) }),
719
- /* @__PURE__ */ jsx("div", { className: "tecof-drawer-list-layout", children })
720
- ] });
418
+ var removeNode = (draft, id) => {
419
+ const result = findNodeById(draft, id);
420
+ if (!result) return;
421
+ const { path } = result;
422
+ const list3 = path.zoneKey ? draft.zones[path.zoneKey] : draft.content;
423
+ if (list3) {
424
+ list3.splice(path.index, 1);
425
+ }
426
+ const descendantZoneKeys = getDescendantZoneKeys(draft.zones, id);
427
+ for (const zoneKey of descendantZoneKeys) {
428
+ delete draft.zones[zoneKey];
429
+ }
721
430
  };
722
- var CustomDrawerItem = ({ children, name: name3 }) => {
723
- const context = useContext(DrawerSearchContext);
724
- const { apiClient } = useTecof();
725
- if (!context) {
726
- return /* @__PURE__ */ jsx(ComponentDrawerItem, { name: name3, apiClient, children });
431
+ var moveNode = (draft, id, targetZoneKey, targetIndex) => {
432
+ const result = findNodeById(draft, id);
433
+ if (!result) return;
434
+ const { node, path: sourcePath } = result;
435
+ const sourceList = sourcePath.zoneKey ? draft.zones[sourcePath.zoneKey] : draft.content;
436
+ let targetList = targetZoneKey ? draft.zones[targetZoneKey] : draft.content;
437
+ if (!targetList && targetZoneKey) {
438
+ targetList = [];
439
+ draft.zones[targetZoneKey] = targetList;
727
440
  }
728
- const { searchQuery, config: config3 } = context;
729
- const componentConfig = config3.components?.[name3];
730
- const label = componentConfig?.label || name3;
731
- if (searchQuery.trim()) {
732
- const query = searchQuery.toLowerCase();
733
- const matchesName = name3.toLowerCase().includes(query);
734
- const matchesLabel = label.toLowerCase().includes(query);
735
- if (!matchesName && !matchesLabel) {
736
- return /* @__PURE__ */ jsx(Fragment, {});
737
- }
441
+ if (!sourceList || !targetList) return;
442
+ sourceList.splice(sourcePath.index, 1);
443
+ let finalIndex = targetIndex ?? targetList.length;
444
+ if (sourcePath.zoneKey === targetZoneKey && sourcePath.index < finalIndex) {
445
+ finalIndex -= 1;
738
446
  }
739
- return /* @__PURE__ */ jsx(ComponentDrawerItem, { name: name3, apiClient, children });
447
+ targetList.splice(finalIndex, 0, node);
740
448
  };
741
- var AutoFieldsOnSelect = () => {
742
- const { selectedItem, dispatch } = usePuck();
743
- const prevSelectedRef = useRef(null);
744
- useEffect(() => {
745
- const currentId = selectedItem?.props?.id || null;
746
- if (currentId && currentId !== prevSelectedRef.current) {
747
- dispatch({
748
- type: "setUi",
749
- ui: { plugin: { current: "fields" } }
750
- });
751
- }
752
- prevSelectedRef.current = currentId;
753
- }, [selectedItem, dispatch]);
754
- return null;
755
- };
756
- var CustomActionBar = ({ children, label }) => {
757
- const { appState, dispatch, getSelectorForId, selectedItem } = usePuck();
758
- const canMoveUp = useMemo(() => {
759
- if (!selectedItem || !selectedItem.props?.id) return false;
760
- const selector = getSelectorForId(selectedItem.props.id);
761
- if (!selector) return false;
762
- return selector.index > 0;
763
- }, [selectedItem, getSelectorForId]);
764
- const canMoveDown = useMemo(() => {
765
- if (!selectedItem || !selectedItem.props?.id) return false;
766
- const selector = getSelectorForId(selectedItem.props.id);
767
- if (!selector) return false;
768
- const { index: index2, zone } = selector;
769
- const items = zone ? appState.data.zones?.[zone] || [] : appState.data.content || [];
770
- return index2 < items.length - 1;
771
- }, [selectedItem, getSelectorForId, appState.data]);
772
- const handleMove = useCallback((direction) => {
773
- if (!selectedItem || !selectedItem.props?.id) return;
774
- const selector = getSelectorForId(selectedItem.props.id);
775
- if (!selector) return;
776
- const { index: index2, zone } = selector;
777
- let items = zone ? [...appState.data.zones?.[zone] || []] : [...appState.data.content || []];
778
- const targetIndex = direction === "up" ? index2 - 1 : index2 + 1;
779
- if (targetIndex < 0 || targetIndex >= items.length) return;
780
- const temp = items[index2];
781
- items[index2] = items[targetIndex];
782
- items[targetIndex] = temp;
783
- if (zone) {
784
- dispatch({
785
- type: "setData",
786
- data: {
787
- ...appState.data,
788
- zones: {
789
- ...appState.data.zones,
790
- [zone]: items
791
- }
792
- }
793
- });
794
- dispatch({
795
- type: "setUi",
796
- ui: {
797
- itemSelector: {
798
- index: targetIndex,
799
- zone
800
- }
801
- }
802
- });
803
- } else {
804
- dispatch({
805
- type: "setData",
806
- data: {
807
- ...appState.data,
808
- content: items
809
- }
810
- });
811
- dispatch({
812
- type: "setUi",
813
- ui: {
814
- itemSelector: {
815
- index: targetIndex
816
- }
817
- }
818
- });
819
- }
820
- }, [selectedItem, getSelectorForId, appState.data, dispatch]);
821
- return /* @__PURE__ */ jsx(ActionBar, { label, children: /* @__PURE__ */ jsxs(ActionBar.Group, { children: [
822
- /* @__PURE__ */ jsx(ActionBar.Action, { onClick: () => handleMove("up"), disabled: !canMoveUp, label: "Yukar\u0131 Ta\u015F\u0131", children: /* @__PURE__ */ jsx(ArrowUp, { size: 14 }) }),
823
- /* @__PURE__ */ jsx(ActionBar.Action, { onClick: () => handleMove("down"), disabled: !canMoveDown, label: "A\u015Fa\u011F\u0131 Ta\u015F\u0131", children: /* @__PURE__ */ jsx(ArrowDown, { size: 14 }) }),
824
- /* @__PURE__ */ jsx(ActionBar.Separator, {}),
825
- children
826
- ] }) });
827
- };
828
- var TecofEditor = ({
829
- pageId,
830
- config: config3,
831
- accessToken,
832
- onSave,
833
- onChange,
834
- overrides,
835
- plugins: extraPlugins,
836
- className
837
- }) => {
838
- const { apiClient, secretKey } = useTecof();
839
- const [initialData, setInitialData] = useState(null);
840
- const [loading, setLoading] = useState(true);
841
- const [saving, setSaving] = useState(false);
842
- const [saveStatus, setSaveStatus] = useState("idle");
843
- const [searchQuery, setSearchQuery] = useState("");
844
- const draftDataRef = useRef(null);
845
- const isEmbedded = typeof window !== "undefined" && window.parent !== window;
846
- useEffect(() => {
847
- let cancelled = false;
848
- const load = async () => {
849
- setLoading(true);
850
- const res2 = await apiClient.getPage(pageId);
851
- if (cancelled) return;
852
- const data3 = res2.success && res2.data?.draftData ? res2.data.draftData : EMPTY_PAGE;
853
- setInitialData(data3);
854
- draftDataRef.current = data3;
855
- setLoading(false);
856
- };
857
- load();
858
- return () => {
859
- cancelled = true;
860
- };
861
- }, [pageId, apiClient]);
862
- const handleSaveDraft = useCallback(
863
- async (data3) => {
864
- const currentData = data3 || draftDataRef.current;
865
- if (!currentData) return;
866
- const draftData = currentData;
867
- setSaving(true);
868
- setSaveStatus("idle");
869
- const res2 = await apiClient.savePage(pageId, draftData, void 0, accessToken);
870
- if (res2.success) {
871
- setSaveStatus("success");
872
- setTimeout(() => setSaveStatus("idle"), 3e3);
873
- onSave?.(draftData);
874
- if (isEmbedded) window.parent.postMessage({ type: "puck:saved" }, "*");
875
- } else {
876
- setSaveStatus("error");
877
- if (isEmbedded) window.parent.postMessage({ type: "puck:saveError", message: res2.message }, "*");
878
- }
879
- setSaving(false);
880
- },
881
- [pageId, apiClient, isEmbedded, onSave, accessToken]
882
- );
883
- const handleChange = useCallback(
884
- (data3) => {
885
- draftDataRef.current = data3;
886
- const draftData = data3;
887
- onChange?.(draftData);
888
- if (isEmbedded) window.parent.postMessage({ type: "puck:changed" }, "*");
889
- },
890
- [onChange, isEmbedded]
891
- );
892
- const handlePuckPublish = useCallback(
893
- (data3) => {
894
- handleSaveDraft(data3);
895
- },
896
- [handleSaveDraft]
897
- );
898
- useEffect(() => {
899
- if (!isEmbedded) return;
900
- const onMessage = (e3) => {
901
- switch (e3.data?.type) {
902
- case "puck:save": {
903
- handleSaveDraft();
904
- break;
905
- }
906
- case "puck:undo":
907
- document.dispatchEvent(new KeyboardEvent("keydown", { key: "z", code: "KeyZ", ctrlKey: true, bubbles: true }));
908
- break;
909
- case "puck:redo":
910
- document.dispatchEvent(new KeyboardEvent("keydown", { key: "z", code: "KeyZ", ctrlKey: true, shiftKey: true, bubbles: true }));
911
- break;
912
- case "puck:viewport": {
913
- const frame = document.querySelector('[data-testid="puck-frame"]');
914
- if (frame) {
915
- const w = e3.data.width || "100%";
916
- frame.style.maxWidth = w;
917
- frame.style.margin = w === "100%" ? "0" : "0 auto";
918
- frame.style.transition = "max-width 0.3s ease";
919
- }
920
- break;
921
- }
922
- }
923
- };
924
- window.addEventListener("message", onMessage);
925
- return () => window.removeEventListener("message", onMessage);
926
- }, [isEmbedded, handleSaveDraft]);
927
- useEffect(() => {
928
- if (!isEmbedded) return;
929
- const handleClick = (e3) => {
930
- const target = e3.target;
931
- const puckComponent = target.closest("[data-puck-component]");
932
- if (puckComponent) {
933
- const componentType = puckComponent.getAttribute("data-puck-component");
934
- const draggableId = puckComponent.closest("[data-rfd-draggable-id]")?.getAttribute("data-rfd-draggable-id");
935
- window.parent.postMessage({
936
- type: "puck:itemSelected",
937
- item: {
938
- type: componentType,
939
- id: draggableId || null
940
- }
941
- }, "*");
942
- }
943
- };
944
- const handleDeselect = (e3) => {
945
- const target = e3.target;
946
- if (!target.closest("[data-puck-component]")) {
947
- window.parent.postMessage({ type: "puck:itemDeselected" }, "*");
948
- }
949
- };
950
- document.addEventListener("click", handleClick, true);
951
- document.addEventListener("click", handleDeselect, false);
952
- return () => {
953
- document.removeEventListener("click", handleClick, true);
954
- document.removeEventListener("click", handleDeselect, false);
955
- };
956
- }, [isEmbedded]);
957
- const searchContextValue = useMemo(() => ({
958
- searchQuery,
959
- setSearchQuery,
960
- config: config3
961
- }), [searchQuery, config3]);
962
- const plugins = useMemo(() => [
963
- { ...blocksPlugin(), label: "Bloklar" },
964
- { ...outlinePlugin(), label: "Anahat" },
965
- { ...fieldsPlugin({ desktopSideBar: "right" }), label: "Alanlar" },
966
- ...extraPlugins || []
967
- ], [extraPlugins]);
968
- const mergedOverrides = useMemo(() => {
969
- return {
970
- header: () => /* @__PURE__ */ jsx(Fragment, {}),
971
- drawer: CustomDrawer,
972
- drawerItem: CustomDrawerItem,
973
- actionBar: ({ children, label }) => {
974
- return /* @__PURE__ */ jsx(CustomActionBar, { label, children });
975
- },
976
- puck: ({ children }) => {
977
- return /* @__PURE__ */ jsxs(Fragment, { children: [
978
- /* @__PURE__ */ jsx(AutoFieldsOnSelect, {}),
979
- children
980
- ] });
981
- },
982
- ...overrides || {}
983
- };
984
- }, [overrides]);
985
- if (loading || !initialData) {
986
- return /* @__PURE__ */ jsx("div", { className: `tecof-editor-loading ${className || ""}`.trim(), children: /* @__PURE__ */ jsxs("div", { className: "tecof-editor-loading-inner", children: [
987
- /* @__PURE__ */ jsx("div", { className: "tecof-editor-spinner" }),
988
- /* @__PURE__ */ jsx("p", { className: "tecof-editor-loading-text", children: "Loading editor..." })
989
- ] }) });
990
- }
991
- return /* @__PURE__ */ jsx(DrawerSearchContext.Provider, { value: searchContextValue, children: /* @__PURE__ */ jsxs("div", { className: `tecof-editor-wrapper ${className || ""}`.trim(), children: [
992
- /* @__PURE__ */ jsx(
993
- Puck,
994
- {
995
- plugins,
996
- config: config3,
997
- data: initialData,
998
- onPublish: handlePuckPublish,
999
- onChange: handleChange,
1000
- overrides: mergedOverrides,
1001
- metadata: { editMode: true }
1002
- }
1003
- ),
1004
- saving && /* @__PURE__ */ jsx("div", { className: "tecof-editor-save-indicator", children: saveStatus === "error" ? "Save failed" : "Saving..." })
1005
- ] }) });
1006
- };
1007
-
1008
- // src/engine/document.ts
1009
- var EMPTY_DOCUMENT = {
1010
- root: { props: {} },
1011
- content: [],
1012
- zones: {}
1013
- };
1014
- var parseDocument = (rawData) => {
1015
- if (!rawData) return { ...EMPTY_DOCUMENT };
1016
- return {
1017
- root: rawData.root || { props: {} },
1018
- content: rawData.content || [],
1019
- zones: rawData.zones || {}
1020
- };
1021
- };
1022
- var serializeDocument = (doc) => {
1023
- return {
1024
- root: doc.root,
1025
- content: doc.content,
1026
- zones: doc.zones
1027
- };
1028
- };
1029
-
1030
- // src/engine/zones.ts
1031
- var parseZoneKey = (zoneKey) => {
1032
- const parts = zoneKey.split(":");
1033
- return {
1034
- parentId: parts[0],
1035
- slotName: parts[1] || "default"
1036
- };
1037
- };
1038
- var findNodeById = (doc, id) => {
1039
- for (let i2 = 0; i2 < doc.content.length; i2++) {
1040
- if (doc.content[i2].props.id === id) {
1041
- return { node: doc.content[i2], path: { index: i2 } };
1042
- }
1043
- }
1044
- for (const [zoneKey, items] of Object.entries(doc.zones)) {
1045
- for (let i2 = 0; i2 < items.length; i2++) {
1046
- if (items[i2].props.id === id) {
1047
- return { node: items[i2], path: { zoneKey, index: i2 } };
1048
- }
1049
- }
1050
- }
1051
- return null;
1052
- };
1053
- var getDescendantZoneKeys = (zones, nodeId, acc = []) => {
1054
- const prefix = `${nodeId}:`;
1055
- for (const zoneKey of Object.keys(zones)) {
1056
- if (zoneKey.startsWith(prefix)) {
1057
- acc.push(zoneKey);
1058
- for (const child of zones[zoneKey]) {
1059
- getDescendantZoneKeys(zones, child.props.id, acc);
1060
- }
1061
- }
1062
- }
1063
- return acc;
1064
- };
1065
- var getParentId = (doc, id) => {
1066
- const res2 = findNodeById(doc, id);
1067
- if (!res2 || !res2.path.zoneKey) return null;
1068
- return parseZoneKey(res2.path.zoneKey).parentId;
1069
- };
1070
- var getBreadcrumbs = (doc, id) => {
1071
- const crumbs = [];
1072
- let currentId = id;
1073
- while (currentId) {
1074
- const res2 = findNodeById(doc, currentId);
1075
- if (!res2) break;
1076
- crumbs.unshift({ id: currentId, type: res2.node.type });
1077
- currentId = res2.path.zoneKey ? parseZoneKey(res2.path.zoneKey).parentId : null;
1078
- }
1079
- return crumbs;
1080
- };
1081
- var generateId = () => nanoid(8);
1082
- var remapNodeIds = (node, sourceZones, idMap = /* @__PURE__ */ new Map()) => {
1083
- const oldId = node.props.id;
1084
- const newId = generateId();
1085
- idMap.set(oldId, newId);
1086
- const remappedNode = {
1087
- ...node,
1088
- props: {
1089
- ...node.props,
1090
- id: newId
1091
- }
1092
- };
1093
- const newZones = {};
1094
- const prefix = `${oldId}:`;
1095
- for (const [zoneKey, zoneItems] of Object.entries(sourceZones)) {
1096
- if (zoneKey.startsWith(prefix)) {
1097
- const slotName = zoneKey.split(":")[1];
1098
- const newZoneKey = `${newId}:${slotName}`;
1099
- const newZoneItems = [];
1100
- for (const item2 of zoneItems) {
1101
- const { remappedNode: childNode, newZones: childZones } = remapNodeIds(item2, sourceZones, idMap);
1102
- newZoneItems.push(childNode);
1103
- Object.assign(newZones, childZones);
1104
- }
1105
- newZones[newZoneKey] = newZoneItems;
1106
- }
1107
- }
1108
- return { remappedNode, newZones };
1109
- };
1110
-
1111
- // src/engine/operations.ts
1112
- var insertNode = (draft, node, targetZoneKey, index2) => {
1113
- if (!node.props.id) {
1114
- node.props.id = generateId();
1115
- }
1116
- let list3 = targetZoneKey ? draft.zones[targetZoneKey] : draft.content;
1117
- if (!list3) {
1118
- list3 = [];
1119
- if (targetZoneKey) {
1120
- draft.zones[targetZoneKey] = list3;
1121
- }
1122
- }
1123
- const insertIndex = typeof index2 === "number" ? index2 : list3.length;
1124
- list3.splice(insertIndex, 0, node);
1125
- };
1126
- var removeNode = (draft, id) => {
1127
- const result = findNodeById(draft, id);
1128
- if (!result) return;
1129
- const { path } = result;
1130
- const list3 = path.zoneKey ? draft.zones[path.zoneKey] : draft.content;
1131
- if (list3) {
1132
- list3.splice(path.index, 1);
1133
- }
1134
- const descendantZoneKeys = getDescendantZoneKeys(draft.zones, id);
1135
- for (const zoneKey of descendantZoneKeys) {
1136
- delete draft.zones[zoneKey];
1137
- }
1138
- };
1139
- var moveNode = (draft, id, targetZoneKey, targetIndex) => {
1140
- const result = findNodeById(draft, id);
1141
- if (!result) return;
1142
- const { node, path: sourcePath } = result;
1143
- const sourceList = sourcePath.zoneKey ? draft.zones[sourcePath.zoneKey] : draft.content;
1144
- let targetList = targetZoneKey ? draft.zones[targetZoneKey] : draft.content;
1145
- if (!targetList && targetZoneKey) {
1146
- targetList = [];
1147
- draft.zones[targetZoneKey] = targetList;
1148
- }
1149
- if (!sourceList || !targetList) return;
1150
- sourceList.splice(sourcePath.index, 1);
1151
- let finalIndex = targetIndex ?? targetList.length;
1152
- if (sourcePath.zoneKey === targetZoneKey && sourcePath.index < finalIndex) {
1153
- finalIndex -= 1;
1154
- }
1155
- targetList.splice(finalIndex, 0, node);
1156
- };
1157
- var duplicateNode = (draft, id) => {
1158
- const result = findNodeById(draft, id);
1159
- if (!result) return;
1160
- const { node, path } = result;
1161
- const { remappedNode, newZones } = remapNodeIds(node, draft.zones);
1162
- const targetList = path.zoneKey ? draft.zones[path.zoneKey] : draft.content;
1163
- if (targetList) {
1164
- targetList.splice(path.index + 1, 0, remappedNode);
1165
- }
1166
- Object.assign(draft.zones, newZones);
449
+ var duplicateNode = (draft, id) => {
450
+ const result = findNodeById(draft, id);
451
+ if (!result) return;
452
+ const { node, path } = result;
453
+ const { remappedNode, newZones } = remapNodeIds(node, draft.zones);
454
+ const targetList = path.zoneKey ? draft.zones[path.zoneKey] : draft.content;
455
+ if (targetList) {
456
+ targetList.splice(path.index + 1, 0, remappedNode);
457
+ }
458
+ Object.assign(draft.zones, newZones);
1167
459
  };
1168
460
  var updateProps = (draft, id, patch) => {
1169
461
  const result = findNodeById(draft, id);
@@ -1176,7 +468,7 @@ var setRootProps = (draft, patch) => {
1176
468
 
1177
469
  // src/engine/store.ts
1178
470
  var pushToHistory = (state3) => {
1179
- state3.history.past.push(JSON.parse(JSON.stringify(state3.document)));
471
+ state3.history.past.push(state3.document);
1180
472
  state3.history.future = [];
1181
473
  };
1182
474
  var useEditorStore = create()(
@@ -1237,13 +529,13 @@ var useEditorStore = create()(
1237
529
  undo: () => set2((state3) => {
1238
530
  if (state3.history.past.length === 0) return;
1239
531
  const previous = state3.history.past.pop();
1240
- state3.history.future.push(JSON.parse(JSON.stringify(state3.document)));
532
+ state3.history.future.push(state3.document);
1241
533
  state3.document = previous;
1242
534
  }),
1243
535
  redo: () => set2((state3) => {
1244
536
  if (state3.history.future.length === 0) return;
1245
537
  const next = state3.history.future.pop();
1246
- state3.history.past.push(JSON.parse(JSON.stringify(state3.document)));
538
+ state3.history.past.push(state3.document);
1247
539
  state3.document = next;
1248
540
  })
1249
541
  }))
@@ -1319,6 +611,44 @@ var NodeRenderer = ({ node, index: index2, zoneKey }) => {
1319
611
  },
1320
612
  [selectNode, node.props.id, node.type, readOnly]
1321
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
+ );
1322
652
  if (!componentConfig) {
1323
653
  return /* @__PURE__ */ jsxs("div", { style: { padding: "12px", background: "#fee2e2", color: "#991b1b", fontSize: "12px", borderRadius: "4px" }, children: [
1324
654
  "Bile\u015Fen bulunamad\u0131: ",
@@ -1348,6 +678,7 @@ var NodeRenderer = ({ node, index: index2, zoneKey }) => {
1348
678
  onMouseEnter: handleMouseEnter,
1349
679
  onMouseLeave: handleMouseLeave,
1350
680
  onClick: handleClick,
681
+ onDoubleClick: handleDoubleClick,
1351
682
  style: {
1352
683
  cursor: readOnly ? void 0 : "pointer"
1353
684
  },
@@ -1415,6 +746,10 @@ var Frame = ({ children, title = "Canvas Frame", ...props }) => {
1415
746
  doc.head.appendChild(style);
1416
747
  };
1417
748
  copyStyles();
749
+ const observer = new MutationObserver(() => {
750
+ copyStyles();
751
+ });
752
+ observer.observe(document.head, { childList: true, subtree: true });
1418
753
  if (doc.body) {
1419
754
  doc.body.className = "tecof-canvas-body";
1420
755
  const handleBodyClick = (e3) => {
@@ -1427,71 +762,520 @@ var Frame = ({ children, title = "Canvas Frame", ...props }) => {
1427
762
  }
1428
763
  }
1429
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
+ };
1430
777
  doc.body.addEventListener("click", handleBodyClick);
778
+ doc.addEventListener("keydown", handleIframeKeyDown);
1431
779
  return () => {
780
+ observer.disconnect();
1432
781
  doc.body.removeEventListener("click", handleBodyClick);
782
+ doc.removeEventListener("keydown", handleIframeKeyDown);
1433
783
  };
1434
784
  }
1435
- }, [contentRef]);
1436
- return /* @__PURE__ */ jsx(
1437
- "iframe",
785
+ }, [contentRef]);
786
+ return /* @__PURE__ */ jsx(
787
+ "iframe",
788
+ {
789
+ title,
790
+ ref: setContentRef,
791
+ style: {
792
+ width: "100%",
793
+ height: "100%",
794
+ border: "none",
795
+ background: "#ffffff",
796
+ ...props.style
797
+ },
798
+ ...props,
799
+ children: mountNode && createPortal(children, mountNode)
800
+ }
801
+ );
802
+ };
803
+ var Canvas = () => {
804
+ const content = useEditorStore((state3) => state3.document.content);
805
+ const viewport = useEditorStore((state3) => state3.viewport);
806
+ const getWidth2 = () => {
807
+ switch (viewport) {
808
+ case "tablet":
809
+ return "768px";
810
+ case "mobile":
811
+ return "375px";
812
+ case "desktop":
813
+ default:
814
+ return "100%";
815
+ }
816
+ };
817
+ return /* @__PURE__ */ jsx("div", { className: "tecof-canvas-container", style: {
818
+ flex: 1,
819
+ display: "flex",
820
+ alignItems: "center",
821
+ justifyContent: "center",
822
+ background: "#f4f4f5",
823
+ padding: "24px",
824
+ overflow: "auto",
825
+ height: "100%",
826
+ boxSizing: "border-box"
827
+ }, children: /* @__PURE__ */ jsx(
828
+ "div",
829
+ {
830
+ className: "tecof-canvas-viewport-wrapper",
831
+ style: {
832
+ width: getWidth2(),
833
+ height: "100%",
834
+ maxWidth: "100%",
835
+ transition: "width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
836
+ boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05)",
837
+ borderRadius: viewport === "desktop" ? "0" : "12px",
838
+ overflow: "hidden",
839
+ backgroundColor: "#ffffff"
840
+ },
841
+ children: /* @__PURE__ */ jsx(Frame, { children: /* @__PURE__ */ jsx("div", { className: "tecof-canvas-root", style: { minHeight: "100%" }, children: content.map((item2, index2) => /* @__PURE__ */ jsx(NodeRenderer, { node: item2, index: index2 }, item2.props.id)) }) })
842
+ }
843
+ ) });
844
+ };
845
+
846
+ // node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
847
+ var mergeClasses = (...classes) => classes.filter((className, index2, array) => {
848
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
849
+ }).join(" ").trim();
850
+
851
+ // node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.js
852
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
853
+
854
+ // node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.js
855
+ var toCamelCase = (string) => string.replace(
856
+ /^([A-Z])|[\s-_]+(\w)/g,
857
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
858
+ );
859
+
860
+ // node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.js
861
+ var toPascalCase = (string) => {
862
+ const camelCase = toCamelCase(string);
863
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
864
+ };
865
+
866
+ // node_modules/lucide-react/dist/esm/defaultAttributes.js
867
+ var defaultAttributes = {
868
+ xmlns: "http://www.w3.org/2000/svg",
869
+ width: 24,
870
+ height: 24,
871
+ viewBox: "0 0 24 24",
872
+ fill: "none",
873
+ stroke: "currentColor",
874
+ strokeWidth: 2,
875
+ strokeLinecap: "round",
876
+ strokeLinejoin: "round"
877
+ };
878
+
879
+ // node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.js
880
+ var hasA11yProp = (props) => {
881
+ for (const prop in props) {
882
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
883
+ return true;
884
+ }
885
+ }
886
+ return false;
887
+ };
888
+ var LucideContext = createContext({});
889
+ var useLucideContext = () => useContext(LucideContext);
890
+
891
+ // node_modules/lucide-react/dist/esm/Icon.js
892
+ var Icon = forwardRef(
893
+ ({ color, size, strokeWidth, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref) => {
894
+ const {
895
+ size: contextSize = 24,
896
+ strokeWidth: contextStrokeWidth = 2,
897
+ absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
898
+ color: contextColor = "currentColor",
899
+ className: contextClass = ""
900
+ } = useLucideContext() ?? {};
901
+ const calculatedStrokeWidth = absoluteStrokeWidth ?? contextAbsoluteStrokeWidth ? Number(strokeWidth ?? contextStrokeWidth) * 24 / Number(size ?? contextSize) : strokeWidth ?? contextStrokeWidth;
902
+ return createElement(
903
+ "svg",
904
+ {
905
+ ref,
906
+ ...defaultAttributes,
907
+ width: size ?? contextSize ?? defaultAttributes.width,
908
+ height: size ?? contextSize ?? defaultAttributes.height,
909
+ stroke: color ?? contextColor,
910
+ strokeWidth: calculatedStrokeWidth,
911
+ className: mergeClasses("lucide", contextClass, className),
912
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
913
+ ...rest
914
+ },
915
+ [
916
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
917
+ ...Array.isArray(children) ? children : [children]
918
+ ]
919
+ );
920
+ }
921
+ );
922
+
923
+ // node_modules/lucide-react/dist/esm/createLucideIcon.js
924
+ var createLucideIcon = (iconName, iconNode) => {
925
+ const Component2 = forwardRef(
926
+ ({ className, ...props }, ref) => createElement(Icon, {
927
+ ref,
928
+ iconNode,
929
+ className: mergeClasses(
930
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
931
+ `lucide-${iconName}`,
932
+ className
933
+ ),
934
+ ...props
935
+ })
936
+ );
937
+ Component2.displayName = toPascalCase(iconName);
938
+ return Component2;
939
+ };
940
+
941
+ // node_modules/lucide-react/dist/esm/icons/arrow-down.js
942
+ var __iconNode = [
943
+ ["path", { d: "M12 5v14", key: "s699le" }],
944
+ ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
945
+ ];
946
+ var ArrowDown = createLucideIcon("arrow-down", __iconNode);
947
+
948
+ // node_modules/lucide-react/dist/esm/icons/arrow-up.js
949
+ var __iconNode2 = [
950
+ ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
951
+ ["path", { d: "M12 19V5", key: "x0mq9r" }]
952
+ ];
953
+ var ArrowUp = createLucideIcon("arrow-up", __iconNode2);
954
+
955
+ // node_modules/lucide-react/dist/esm/icons/check.js
956
+ var __iconNode3 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
957
+ var Check = createLucideIcon("check", __iconNode3);
958
+
959
+ // node_modules/lucide-react/dist/esm/icons/chevron-down.js
960
+ var __iconNode4 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
961
+ var ChevronDown = createLucideIcon("chevron-down", __iconNode4);
962
+
963
+ // node_modules/lucide-react/dist/esm/icons/chevron-right.js
964
+ var __iconNode5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
965
+ var ChevronRight = createLucideIcon("chevron-right", __iconNode5);
966
+
967
+ // node_modules/lucide-react/dist/esm/icons/chevron-up.js
968
+ var __iconNode6 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
969
+ var ChevronUp = createLucideIcon("chevron-up", __iconNode6);
970
+
971
+ // node_modules/lucide-react/dist/esm/icons/code.js
972
+ var __iconNode7 = [
973
+ ["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
974
+ ["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
975
+ ];
976
+ var Code = createLucideIcon("code", __iconNode7);
977
+
978
+ // node_modules/lucide-react/dist/esm/icons/copy.js
979
+ var __iconNode8 = [
980
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
981
+ ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
982
+ ];
983
+ var Copy = createLucideIcon("copy", __iconNode8);
984
+
985
+ // node_modules/lucide-react/dist/esm/icons/database.js
986
+ var __iconNode9 = [
987
+ ["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
988
+ ["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
989
+ ["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
990
+ ];
991
+ var Database = createLucideIcon("database", __iconNode9);
992
+
993
+ // node_modules/lucide-react/dist/esm/icons/external-link.js
994
+ var __iconNode10 = [
995
+ ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
996
+ ["path", { d: "M10 14 21 3", key: "gplh6r" }],
997
+ ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
998
+ ];
999
+ var ExternalLink = createLucideIcon("external-link", __iconNode10);
1000
+
1001
+ // node_modules/lucide-react/dist/esm/icons/file-text.js
1002
+ var __iconNode11 = [
1003
+ [
1004
+ "path",
1005
+ {
1006
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
1007
+ key: "1oefj6"
1008
+ }
1009
+ ],
1010
+ ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
1011
+ ["path", { d: "M10 9H8", key: "b1mrlr" }],
1012
+ ["path", { d: "M16 13H8", key: "t4e002" }],
1013
+ ["path", { d: "M16 17H8", key: "z1uh3a" }]
1014
+ ];
1015
+ var FileText = createLucideIcon("file-text", __iconNode11);
1016
+
1017
+ // node_modules/lucide-react/dist/esm/icons/file.js
1018
+ var __iconNode12 = [
1019
+ [
1020
+ "path",
1021
+ {
1022
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
1023
+ key: "1oefj6"
1024
+ }
1025
+ ],
1026
+ ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
1027
+ ];
1028
+ var File2 = createLucideIcon("file", __iconNode12);
1029
+
1030
+ // node_modules/lucide-react/dist/esm/icons/folder-open.js
1031
+ var __iconNode13 = [
1032
+ [
1033
+ "path",
1034
+ {
1035
+ d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
1036
+ key: "usdka0"
1037
+ }
1038
+ ]
1039
+ ];
1040
+ var FolderOpen = createLucideIcon("folder-open", __iconNode13);
1041
+
1042
+ // node_modules/lucide-react/dist/esm/icons/globe.js
1043
+ var __iconNode14 = [
1044
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1045
+ ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
1046
+ ["path", { d: "M2 12h20", key: "9i4pu4" }]
1047
+ ];
1048
+ var Globe = createLucideIcon("globe", __iconNode14);
1049
+
1050
+ // node_modules/lucide-react/dist/esm/icons/grid-3x3.js
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 = [
1062
+ ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
1063
+ ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
1064
+ ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
1065
+ ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
1066
+ ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
1067
+ ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
1068
+ ];
1069
+ var GripVertical = createLucideIcon("grip-vertical", __iconNode16);
1070
+
1071
+ // node_modules/lucide-react/dist/esm/icons/image-plus.js
1072
+ var __iconNode17 = [
1073
+ ["path", { d: "M16 5h6", key: "1vod17" }],
1074
+ ["path", { d: "M19 2v6", key: "4bpg5p" }],
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" }],
1076
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
1077
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
1078
+ ];
1079
+ var ImagePlus = createLucideIcon("image-plus", __iconNode17);
1080
+
1081
+ // node_modules/lucide-react/dist/esm/icons/image.js
1082
+ var __iconNode18 = [
1083
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
1084
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
1085
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
1086
+ ];
1087
+ var Image2 = createLucideIcon("image", __iconNode18);
1088
+
1089
+ // node_modules/lucide-react/dist/esm/icons/languages.js
1090
+ var __iconNode19 = [
1091
+ ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
1092
+ ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
1093
+ ["path", { d: "M2 5h12", key: "or177f" }],
1094
+ ["path", { d: "M7 2h1", key: "1t2jsx" }],
1095
+ ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
1096
+ ["path", { d: "M14 18h6", key: "1m8k6r" }]
1097
+ ];
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",
1438
1111
  {
1439
- title,
1440
- ref: setContentRef,
1441
- style: {
1442
- width: "100%",
1443
- height: "100%",
1444
- border: "none",
1445
- background: "#ffffff",
1446
- ...props.style
1447
- },
1448
- ...props,
1449
- children: mountNode && createPortal(children, mountNode)
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"
1450
1114
  }
1451
- );
1452
- };
1453
- var Canvas = () => {
1454
- const content = useEditorStore((state3) => state3.document.content);
1455
- const viewport = useEditorStore((state3) => state3.viewport);
1456
- const getWidth2 = () => {
1457
- switch (viewport) {
1458
- case "tablet":
1459
- return "768px";
1460
- case "mobile":
1461
- return "375px";
1462
- case "desktop":
1463
- default:
1464
- return "100%";
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"
1465
1121
  }
1466
- };
1467
- return /* @__PURE__ */ jsx("div", { className: "tecof-canvas-container", style: {
1468
- flex: 1,
1469
- display: "flex",
1470
- alignItems: "center",
1471
- justifyContent: "center",
1472
- background: "#f4f4f5",
1473
- padding: "24px",
1474
- overflow: "auto",
1475
- height: "100%",
1476
- boxSizing: "border-box"
1477
- }, children: /* @__PURE__ */ jsx(
1478
- "div",
1122
+ ]
1123
+ ];
1124
+ var Layers = createLucideIcon("layers", __iconNode20);
1125
+
1126
+ // node_modules/lucide-react/dist/esm/icons/link-2.js
1127
+ var __iconNode21 = [
1128
+ ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
1129
+ ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
1130
+ ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
1131
+ ];
1132
+ var Link2 = createLucideIcon("link-2", __iconNode21);
1133
+
1134
+ // node_modules/lucide-react/dist/esm/icons/link.js
1135
+ var __iconNode22 = [
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" }],
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" }]
1138
+ ];
1139
+ var Link = createLucideIcon("link", __iconNode22);
1140
+
1141
+ // node_modules/lucide-react/dist/esm/icons/loader-circle.js
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);
1160
+
1161
+ // node_modules/lucide-react/dist/esm/icons/pencil.js
1162
+ var __iconNode26 = [
1163
+ [
1164
+ "path",
1479
1165
  {
1480
- className: "tecof-canvas-viewport-wrapper",
1481
- style: {
1482
- width: getWidth2(),
1483
- height: "100%",
1484
- maxWidth: "100%",
1485
- transition: "width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
1486
- boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05)",
1487
- borderRadius: viewport === "desktop" ? "0" : "12px",
1488
- overflow: "hidden",
1489
- backgroundColor: "#ffffff"
1490
- },
1491
- children: /* @__PURE__ */ jsx(Frame, { children: /* @__PURE__ */ jsx("div", { className: "tecof-canvas-root", style: { minHeight: "100%" }, children: content.map((item2, index2) => /* @__PURE__ */ jsx(NodeRenderer, { node: item2, index: index2 }, item2.props.id)) }) })
1166
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
1167
+ key: "1a8usu"
1492
1168
  }
1493
- ) });
1494
- };
1169
+ ],
1170
+ ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
1171
+ ];
1172
+ var Pencil = createLucideIcon("pencil", __iconNode26);
1173
+
1174
+ // node_modules/lucide-react/dist/esm/icons/plus.js
1175
+ var __iconNode27 = [
1176
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
1177
+ ["path", { d: "M12 5v14", key: "s699le" }]
1178
+ ];
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);
1187
+
1188
+ // node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
1189
+ var __iconNode29 = [
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" }],
1191
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
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" }],
1193
+ ["path", { d: "M16 16h5v5", key: "ccwih5" }]
1194
+ ];
1195
+ var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode29);
1196
+
1197
+ // node_modules/lucide-react/dist/esm/icons/refresh-cw.js
1198
+ var __iconNode30 = [
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" }],
1200
+ ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
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" }],
1202
+ ["path", { d: "M8 16H3v5", key: "1cv678" }]
1203
+ ];
1204
+ var RefreshCw = createLucideIcon("refresh-cw", __iconNode30);
1205
+
1206
+ // node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
1207
+ var __iconNode31 = [
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" }],
1209
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
1210
+ ];
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);
1226
+
1227
+ // node_modules/lucide-react/dist/esm/icons/search.js
1228
+ var __iconNode33 = [
1229
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
1230
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
1231
+ ];
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);
1247
+
1248
+ // node_modules/lucide-react/dist/esm/icons/trash-2.js
1249
+ var __iconNode36 = [
1250
+ ["path", { d: "M10 11v6", key: "nco0om" }],
1251
+ ["path", { d: "M14 11v6", key: "outv1u" }],
1252
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
1253
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
1254
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
1255
+ ];
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);
1264
+
1265
+ // node_modules/lucide-react/dist/esm/icons/upload.js
1266
+ var __iconNode38 = [
1267
+ ["path", { d: "M12 3v12", key: "1x0j5s" }],
1268
+ ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
1269
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
1270
+ ];
1271
+ var Upload = createLucideIcon("upload", __iconNode38);
1272
+
1273
+ // node_modules/lucide-react/dist/esm/icons/x.js
1274
+ var __iconNode39 = [
1275
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1276
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1277
+ ];
1278
+ var X = createLucideIcon("x", __iconNode39);
1495
1279
  var useOverlayCoords = (id, iframeEl, containerEl, documentState) => {
1496
1280
  const [coords, setCoords] = useState(null);
1497
1281
  useEffect(() => {
@@ -1868,6 +1652,7 @@ var FieldRenderer = ({
1868
1652
  onChange,
1869
1653
  readOnly = false
1870
1654
  }) => {
1655
+ const [expandedIndices, setExpandedIndices] = useState({});
1871
1656
  const label = definition.label || name3;
1872
1657
  const type = definition.type;
1873
1658
  if (definition.render) {
@@ -2031,6 +1816,215 @@ var FieldRenderer = ({
2031
1816
  },
2032
1817
  opt.value
2033
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
+ }
2034
2028
  default:
2035
2029
  return /* @__PURE__ */ jsxs("div", { style: { padding: "8px", fontSize: "11px", color: "#71717a", background: "#fafafa", borderRadius: "4px" }, children: [
2036
2030
  'Desteklenmeyen alan t\xFCr\xFC: "',
@@ -2230,6 +2224,528 @@ var Inspector = () => {
2230
2224
  }
2231
2225
  );
2232
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
+ };
2233
2749
  var TecofStudio = ({
2234
2750
  pageId,
2235
2751
  config: config3,
@@ -2343,6 +2859,67 @@ var TecofStudio = ({
2343
2859
  window.addEventListener("message", onMessage);
2344
2860
  return () => window.removeEventListener("message", onMessage);
2345
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]);
2346
2923
  const studioContextValue = useMemo(() => ({
2347
2924
  config: config3,
2348
2925
  readOnly: false,
@@ -2377,13 +2954,15 @@ var TecofStudio = ({
2377
2954
  position: "relative",
2378
2955
  background: "#f4f4f5"
2379
2956
  }, children: [
2957
+ /* @__PURE__ */ jsx(TopBar, { onSave: handleSaveDraft, saving, saveStatus }),
2380
2958
  /* @__PURE__ */ jsxs("div", { className: "tecof-studio-workspace-container", style: {
2381
2959
  display: "flex",
2382
2960
  flex: 1,
2383
- height: "100%",
2961
+ height: "calc(100% - 56px)",
2384
2962
  width: "100%",
2385
2963
  overflow: "hidden"
2386
2964
  }, children: [
2965
+ /* @__PURE__ */ jsx(LeftPanel, {}),
2387
2966
  /* @__PURE__ */ jsxs("div", { className: "tecof-studio-workspace", style: {
2388
2967
  display: "flex",
2389
2968
  flex: 1,
@@ -2411,16 +2990,46 @@ var TecofStudio = ({
2411
2990
  }, children: saveStatus === "error" ? "Kaydedilemedi" : "Kaydediliyor..." })
2412
2991
  ] }) });
2413
2992
  };
2993
+
2994
+ // src/components/TecofEditor.tsx
2995
+ var TecofEditor = TecofStudio;
2996
+ var RenderContext = createContext(null);
2997
+ var ParentNodeContext2 = createContext(null);
2998
+ var RenderDropZone = ({ zone, className, style }) => {
2999
+ const parentId = useContext(ParentNodeContext2);
3000
+ const zoneKey = parentId ? `${parentId}:${zone}` : zone;
3001
+ const context = useContext(RenderContext);
3002
+ if (!context) return null;
3003
+ const items = context.zones[zoneKey] || [];
3004
+ return /* @__PURE__ */ jsx("div", { className, style, children: items.map((item2, index2) => /* @__PURE__ */ jsx(RenderNode, { node: item2, index: index2 }, item2.props.id || index2)) });
3005
+ };
3006
+ var RenderNode = ({ node, index: index2 }) => {
3007
+ const context = useContext(RenderContext);
3008
+ if (!context) return null;
3009
+ const componentConfig = context.config.components[node.type];
3010
+ if (!componentConfig) return null;
3011
+ const componentProps = {
3012
+ ...node.props,
3013
+ puck: {
3014
+ renderDropZone: RenderDropZone,
3015
+ isEditing: false,
3016
+ metadata: {
3017
+ cmsData: context.cmsData || null,
3018
+ ...componentConfig.metadata || {}
3019
+ }
3020
+ },
3021
+ editMode: false
3022
+ };
3023
+ return /* @__PURE__ */ jsx(ParentNodeContext2.Provider, { value: node.props.id || null, children: componentConfig.render(componentProps) });
3024
+ };
2414
3025
  var TecofRender = ({ data: data3, config: config3, className, cmsData }) => {
2415
3026
  if (!data3) return null;
2416
- return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
2417
- Render,
2418
- {
2419
- config: config3,
2420
- data: data3,
2421
- metadata: { cmsData: cmsData || null }
2422
- }
2423
- ) });
3027
+ const contextValue = {
3028
+ zones: data3.zones || {},
3029
+ config: config3,
3030
+ cmsData: cmsData || null
3031
+ };
3032
+ return /* @__PURE__ */ jsx(RenderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { className, children: data3.content.map((item2, index2) => /* @__PURE__ */ jsx(RenderNode, { node: item2, index: index2 }, item2.props.id || index2)) }) });
2424
3033
  };
2425
3034
  var IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "svg", "avif", "bmp", "tiff", "heic"];
2426
3035
  var VIDEO_EXTENSIONS = ["mp4", "webm", "ogg", "avi", "mov", "quicktime"];
@@ -26948,20 +27557,29 @@ lucide-react/dist/esm/icons/file-text.js:
26948
27557
  lucide-react/dist/esm/icons/file.js:
26949
27558
  lucide-react/dist/esm/icons/folder-open.js:
26950
27559
  lucide-react/dist/esm/icons/globe.js:
27560
+ lucide-react/dist/esm/icons/grid-3x3.js:
26951
27561
  lucide-react/dist/esm/icons/grip-vertical.js:
26952
27562
  lucide-react/dist/esm/icons/image-plus.js:
26953
27563
  lucide-react/dist/esm/icons/image.js:
26954
27564
  lucide-react/dist/esm/icons/languages.js:
27565
+ lucide-react/dist/esm/icons/layers.js:
26955
27566
  lucide-react/dist/esm/icons/link-2.js:
26956
27567
  lucide-react/dist/esm/icons/link.js:
26957
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:
26958
27571
  lucide-react/dist/esm/icons/pencil.js:
26959
27572
  lucide-react/dist/esm/icons/plus.js:
27573
+ lucide-react/dist/esm/icons/redo-2.js:
26960
27574
  lucide-react/dist/esm/icons/refresh-ccw.js:
26961
27575
  lucide-react/dist/esm/icons/refresh-cw.js:
26962
27576
  lucide-react/dist/esm/icons/rotate-ccw.js:
27577
+ lucide-react/dist/esm/icons/save.js:
26963
27578
  lucide-react/dist/esm/icons/search.js:
27579
+ lucide-react/dist/esm/icons/smartphone.js:
27580
+ lucide-react/dist/esm/icons/tablet.js:
26964
27581
  lucide-react/dist/esm/icons/trash-2.js:
27582
+ lucide-react/dist/esm/icons/undo-2.js:
26965
27583
  lucide-react/dist/esm/icons/upload.js:
26966
27584
  lucide-react/dist/esm/icons/x.js:
26967
27585
  lucide-react/dist/esm/lucide-react.js: