@tecof/theme-editor 0.0.35 → 0.0.37

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,713 +297,6 @@ 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);
319
- };
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"
332
- };
333
-
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;
339
- }
340
- }
341
- return false;
342
- };
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
- );
375
- }
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;
394
- };
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"
463
- }
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);
471
-
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);
667
- }
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
- ] });
690
- };
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
- ] });
721
- };
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 });
727
- }
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
- }
738
- }
739
- return /* @__PURE__ */ jsx(ComponentDrawerItem, { name: name3, apiClient, children });
740
- };
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
300
  // src/engine/document.ts
1009
301
  var EMPTY_DOCUMENT = {
1010
302
  root: { props: {} },
@@ -1432,66 +724,406 @@ var Frame = ({ children, title = "Canvas Frame", ...props }) => {
1432
724
  doc.body.removeEventListener("click", handleBodyClick);
1433
725
  };
1434
726
  }
1435
- }, [contentRef]);
1436
- return /* @__PURE__ */ jsx(
1437
- "iframe",
727
+ }, [contentRef]);
728
+ return /* @__PURE__ */ jsx(
729
+ "iframe",
730
+ {
731
+ title,
732
+ ref: setContentRef,
733
+ style: {
734
+ width: "100%",
735
+ height: "100%",
736
+ border: "none",
737
+ background: "#ffffff",
738
+ ...props.style
739
+ },
740
+ ...props,
741
+ children: mountNode && createPortal(children, mountNode)
742
+ }
743
+ );
744
+ };
745
+ var Canvas = () => {
746
+ const content = useEditorStore((state3) => state3.document.content);
747
+ const viewport = useEditorStore((state3) => state3.viewport);
748
+ const getWidth2 = () => {
749
+ switch (viewport) {
750
+ case "tablet":
751
+ return "768px";
752
+ case "mobile":
753
+ return "375px";
754
+ case "desktop":
755
+ default:
756
+ return "100%";
757
+ }
758
+ };
759
+ return /* @__PURE__ */ jsx("div", { className: "tecof-canvas-container", style: {
760
+ flex: 1,
761
+ display: "flex",
762
+ alignItems: "center",
763
+ justifyContent: "center",
764
+ background: "#f4f4f5",
765
+ padding: "24px",
766
+ overflow: "auto",
767
+ height: "100%",
768
+ boxSizing: "border-box"
769
+ }, children: /* @__PURE__ */ jsx(
770
+ "div",
771
+ {
772
+ className: "tecof-canvas-viewport-wrapper",
773
+ style: {
774
+ width: getWidth2(),
775
+ height: "100%",
776
+ maxWidth: "100%",
777
+ transition: "width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
778
+ boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05)",
779
+ borderRadius: viewport === "desktop" ? "0" : "12px",
780
+ overflow: "hidden",
781
+ backgroundColor: "#ffffff"
782
+ },
783
+ 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)) }) })
784
+ }
785
+ ) });
786
+ };
787
+
788
+ // node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
789
+ var mergeClasses = (...classes) => classes.filter((className, index2, array) => {
790
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
791
+ }).join(" ").trim();
792
+
793
+ // node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.js
794
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
795
+
796
+ // node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.js
797
+ var toCamelCase = (string) => string.replace(
798
+ /^([A-Z])|[\s-_]+(\w)/g,
799
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
800
+ );
801
+
802
+ // node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.js
803
+ var toPascalCase = (string) => {
804
+ const camelCase = toCamelCase(string);
805
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
806
+ };
807
+
808
+ // node_modules/lucide-react/dist/esm/defaultAttributes.js
809
+ var defaultAttributes = {
810
+ xmlns: "http://www.w3.org/2000/svg",
811
+ width: 24,
812
+ height: 24,
813
+ viewBox: "0 0 24 24",
814
+ fill: "none",
815
+ stroke: "currentColor",
816
+ strokeWidth: 2,
817
+ strokeLinecap: "round",
818
+ strokeLinejoin: "round"
819
+ };
820
+
821
+ // node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.js
822
+ var hasA11yProp = (props) => {
823
+ for (const prop in props) {
824
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
825
+ return true;
826
+ }
827
+ }
828
+ return false;
829
+ };
830
+ var LucideContext = createContext({});
831
+ var useLucideContext = () => useContext(LucideContext);
832
+
833
+ // node_modules/lucide-react/dist/esm/Icon.js
834
+ var Icon = forwardRef(
835
+ ({ color, size, strokeWidth, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref) => {
836
+ const {
837
+ size: contextSize = 24,
838
+ strokeWidth: contextStrokeWidth = 2,
839
+ absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
840
+ color: contextColor = "currentColor",
841
+ className: contextClass = ""
842
+ } = useLucideContext() ?? {};
843
+ const calculatedStrokeWidth = absoluteStrokeWidth ?? contextAbsoluteStrokeWidth ? Number(strokeWidth ?? contextStrokeWidth) * 24 / Number(size ?? contextSize) : strokeWidth ?? contextStrokeWidth;
844
+ return createElement(
845
+ "svg",
846
+ {
847
+ ref,
848
+ ...defaultAttributes,
849
+ width: size ?? contextSize ?? defaultAttributes.width,
850
+ height: size ?? contextSize ?? defaultAttributes.height,
851
+ stroke: color ?? contextColor,
852
+ strokeWidth: calculatedStrokeWidth,
853
+ className: mergeClasses("lucide", contextClass, className),
854
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
855
+ ...rest
856
+ },
857
+ [
858
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
859
+ ...Array.isArray(children) ? children : [children]
860
+ ]
861
+ );
862
+ }
863
+ );
864
+
865
+ // node_modules/lucide-react/dist/esm/createLucideIcon.js
866
+ var createLucideIcon = (iconName, iconNode) => {
867
+ const Component2 = forwardRef(
868
+ ({ className, ...props }, ref) => createElement(Icon, {
869
+ ref,
870
+ iconNode,
871
+ className: mergeClasses(
872
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
873
+ `lucide-${iconName}`,
874
+ className
875
+ ),
876
+ ...props
877
+ })
878
+ );
879
+ Component2.displayName = toPascalCase(iconName);
880
+ return Component2;
881
+ };
882
+
883
+ // node_modules/lucide-react/dist/esm/icons/arrow-down.js
884
+ var __iconNode = [
885
+ ["path", { d: "M12 5v14", key: "s699le" }],
886
+ ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
887
+ ];
888
+ var ArrowDown = createLucideIcon("arrow-down", __iconNode);
889
+
890
+ // node_modules/lucide-react/dist/esm/icons/arrow-up.js
891
+ var __iconNode2 = [
892
+ ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
893
+ ["path", { d: "M12 19V5", key: "x0mq9r" }]
894
+ ];
895
+ var ArrowUp = createLucideIcon("arrow-up", __iconNode2);
896
+
897
+ // node_modules/lucide-react/dist/esm/icons/check.js
898
+ var __iconNode3 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
899
+ var Check = createLucideIcon("check", __iconNode3);
900
+
901
+ // node_modules/lucide-react/dist/esm/icons/chevron-down.js
902
+ var __iconNode4 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
903
+ var ChevronDown = createLucideIcon("chevron-down", __iconNode4);
904
+
905
+ // node_modules/lucide-react/dist/esm/icons/chevron-right.js
906
+ var __iconNode5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
907
+ var ChevronRight = createLucideIcon("chevron-right", __iconNode5);
908
+
909
+ // node_modules/lucide-react/dist/esm/icons/chevron-up.js
910
+ var __iconNode6 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
911
+ var ChevronUp = createLucideIcon("chevron-up", __iconNode6);
912
+
913
+ // node_modules/lucide-react/dist/esm/icons/code.js
914
+ var __iconNode7 = [
915
+ ["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
916
+ ["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
917
+ ];
918
+ var Code = createLucideIcon("code", __iconNode7);
919
+
920
+ // node_modules/lucide-react/dist/esm/icons/copy.js
921
+ var __iconNode8 = [
922
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
923
+ ["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" }]
924
+ ];
925
+ var Copy = createLucideIcon("copy", __iconNode8);
926
+
927
+ // node_modules/lucide-react/dist/esm/icons/database.js
928
+ var __iconNode9 = [
929
+ ["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
930
+ ["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
931
+ ["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
932
+ ];
933
+ var Database = createLucideIcon("database", __iconNode9);
934
+
935
+ // node_modules/lucide-react/dist/esm/icons/external-link.js
936
+ var __iconNode10 = [
937
+ ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
938
+ ["path", { d: "M10 14 21 3", key: "gplh6r" }],
939
+ ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
940
+ ];
941
+ var ExternalLink = createLucideIcon("external-link", __iconNode10);
942
+
943
+ // node_modules/lucide-react/dist/esm/icons/file-text.js
944
+ var __iconNode11 = [
945
+ [
946
+ "path",
947
+ {
948
+ 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",
949
+ key: "1oefj6"
950
+ }
951
+ ],
952
+ ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
953
+ ["path", { d: "M10 9H8", key: "b1mrlr" }],
954
+ ["path", { d: "M16 13H8", key: "t4e002" }],
955
+ ["path", { d: "M16 17H8", key: "z1uh3a" }]
956
+ ];
957
+ var FileText = createLucideIcon("file-text", __iconNode11);
958
+
959
+ // node_modules/lucide-react/dist/esm/icons/file.js
960
+ var __iconNode12 = [
961
+ [
962
+ "path",
1438
963
  {
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)
964
+ 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",
965
+ key: "1oefj6"
1450
966
  }
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%";
967
+ ],
968
+ ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
969
+ ];
970
+ var File2 = createLucideIcon("file", __iconNode12);
971
+
972
+ // node_modules/lucide-react/dist/esm/icons/folder-open.js
973
+ var __iconNode13 = [
974
+ [
975
+ "path",
976
+ {
977
+ 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",
978
+ key: "usdka0"
1465
979
  }
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",
980
+ ]
981
+ ];
982
+ var FolderOpen = createLucideIcon("folder-open", __iconNode13);
983
+
984
+ // node_modules/lucide-react/dist/esm/icons/globe.js
985
+ var __iconNode14 = [
986
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
987
+ ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
988
+ ["path", { d: "M2 12h20", key: "9i4pu4" }]
989
+ ];
990
+ var Globe = createLucideIcon("globe", __iconNode14);
991
+
992
+ // node_modules/lucide-react/dist/esm/icons/grip-vertical.js
993
+ var __iconNode15 = [
994
+ ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
995
+ ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
996
+ ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
997
+ ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
998
+ ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
999
+ ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
1000
+ ];
1001
+ var GripVertical = createLucideIcon("grip-vertical", __iconNode15);
1002
+
1003
+ // node_modules/lucide-react/dist/esm/icons/image-plus.js
1004
+ var __iconNode16 = [
1005
+ ["path", { d: "M16 5h6", key: "1vod17" }],
1006
+ ["path", { d: "M19 2v6", key: "4bpg5p" }],
1007
+ ["path", { d: "M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5", key: "1ue2ih" }],
1008
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
1009
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
1010
+ ];
1011
+ var ImagePlus = createLucideIcon("image-plus", __iconNode16);
1012
+
1013
+ // node_modules/lucide-react/dist/esm/icons/image.js
1014
+ var __iconNode17 = [
1015
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
1016
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
1017
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
1018
+ ];
1019
+ var Image2 = createLucideIcon("image", __iconNode17);
1020
+
1021
+ // node_modules/lucide-react/dist/esm/icons/languages.js
1022
+ var __iconNode18 = [
1023
+ ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
1024
+ ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
1025
+ ["path", { d: "M2 5h12", key: "or177f" }],
1026
+ ["path", { d: "M7 2h1", key: "1t2jsx" }],
1027
+ ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
1028
+ ["path", { d: "M14 18h6", key: "1m8k6r" }]
1029
+ ];
1030
+ var Languages = createLucideIcon("languages", __iconNode18);
1031
+
1032
+ // node_modules/lucide-react/dist/esm/icons/link-2.js
1033
+ var __iconNode19 = [
1034
+ ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
1035
+ ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
1036
+ ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
1037
+ ];
1038
+ var Link2 = createLucideIcon("link-2", __iconNode19);
1039
+
1040
+ // node_modules/lucide-react/dist/esm/icons/link.js
1041
+ var __iconNode20 = [
1042
+ ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
1043
+ ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
1044
+ ];
1045
+ var Link = createLucideIcon("link", __iconNode20);
1046
+
1047
+ // node_modules/lucide-react/dist/esm/icons/loader-circle.js
1048
+ var __iconNode21 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
1049
+ var LoaderCircle = createLucideIcon("loader-circle", __iconNode21);
1050
+
1051
+ // node_modules/lucide-react/dist/esm/icons/pencil.js
1052
+ var __iconNode22 = [
1053
+ [
1054
+ "path",
1479
1055
  {
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)) }) })
1056
+ 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",
1057
+ key: "1a8usu"
1492
1058
  }
1493
- ) });
1494
- };
1059
+ ],
1060
+ ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
1061
+ ];
1062
+ var Pencil = createLucideIcon("pencil", __iconNode22);
1063
+
1064
+ // node_modules/lucide-react/dist/esm/icons/plus.js
1065
+ var __iconNode23 = [
1066
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
1067
+ ["path", { d: "M12 5v14", key: "s699le" }]
1068
+ ];
1069
+ var Plus = createLucideIcon("plus", __iconNode23);
1070
+
1071
+ // node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
1072
+ var __iconNode24 = [
1073
+ ["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
1074
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
1075
+ ["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
1076
+ ["path", { d: "M16 16h5v5", key: "ccwih5" }]
1077
+ ];
1078
+ var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode24);
1079
+
1080
+ // node_modules/lucide-react/dist/esm/icons/refresh-cw.js
1081
+ var __iconNode25 = [
1082
+ ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
1083
+ ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
1084
+ ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
1085
+ ["path", { d: "M8 16H3v5", key: "1cv678" }]
1086
+ ];
1087
+ var RefreshCw = createLucideIcon("refresh-cw", __iconNode25);
1088
+
1089
+ // node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
1090
+ var __iconNode26 = [
1091
+ ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
1092
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
1093
+ ];
1094
+ var RotateCcw = createLucideIcon("rotate-ccw", __iconNode26);
1095
+
1096
+ // node_modules/lucide-react/dist/esm/icons/search.js
1097
+ var __iconNode27 = [
1098
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
1099
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
1100
+ ];
1101
+ var Search = createLucideIcon("search", __iconNode27);
1102
+
1103
+ // node_modules/lucide-react/dist/esm/icons/trash-2.js
1104
+ var __iconNode28 = [
1105
+ ["path", { d: "M10 11v6", key: "nco0om" }],
1106
+ ["path", { d: "M14 11v6", key: "outv1u" }],
1107
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
1108
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
1109
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
1110
+ ];
1111
+ var Trash2 = createLucideIcon("trash-2", __iconNode28);
1112
+
1113
+ // node_modules/lucide-react/dist/esm/icons/upload.js
1114
+ var __iconNode29 = [
1115
+ ["path", { d: "M12 3v12", key: "1x0j5s" }],
1116
+ ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
1117
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
1118
+ ];
1119
+ var Upload = createLucideIcon("upload", __iconNode29);
1120
+
1121
+ // node_modules/lucide-react/dist/esm/icons/x.js
1122
+ var __iconNode30 = [
1123
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1124
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1125
+ ];
1126
+ var X = createLucideIcon("x", __iconNode30);
1495
1127
  var useOverlayCoords = (id, iframeEl, containerEl, documentState) => {
1496
1128
  const [coords, setCoords] = useState(null);
1497
1129
  useEffect(() => {
@@ -2411,16 +2043,46 @@ var TecofStudio = ({
2411
2043
  }, children: saveStatus === "error" ? "Kaydedilemedi" : "Kaydediliyor..." })
2412
2044
  ] }) });
2413
2045
  };
2046
+
2047
+ // src/components/TecofEditor.tsx
2048
+ var TecofEditor = TecofStudio;
2049
+ var RenderContext = createContext(null);
2050
+ var ParentNodeContext2 = createContext(null);
2051
+ var RenderDropZone = ({ zone, className, style }) => {
2052
+ const parentId = useContext(ParentNodeContext2);
2053
+ const zoneKey = parentId ? `${parentId}:${zone}` : zone;
2054
+ const context = useContext(RenderContext);
2055
+ if (!context) return null;
2056
+ const items = context.zones[zoneKey] || [];
2057
+ return /* @__PURE__ */ jsx("div", { className, style, children: items.map((item2, index2) => /* @__PURE__ */ jsx(RenderNode, { node: item2, index: index2 }, item2.props.id || index2)) });
2058
+ };
2059
+ var RenderNode = ({ node, index: index2 }) => {
2060
+ const context = useContext(RenderContext);
2061
+ if (!context) return null;
2062
+ const componentConfig = context.config.components[node.type];
2063
+ if (!componentConfig) return null;
2064
+ const componentProps = {
2065
+ ...node.props,
2066
+ puck: {
2067
+ renderDropZone: RenderDropZone,
2068
+ isEditing: false,
2069
+ metadata: {
2070
+ cmsData: context.cmsData || null,
2071
+ ...componentConfig.metadata || {}
2072
+ }
2073
+ },
2074
+ editMode: false
2075
+ };
2076
+ return /* @__PURE__ */ jsx(ParentNodeContext2.Provider, { value: node.props.id || null, children: componentConfig.render(componentProps) });
2077
+ };
2414
2078
  var TecofRender = ({ data: data3, config: config3, className, cmsData }) => {
2415
2079
  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
- ) });
2080
+ const contextValue = {
2081
+ zones: data3.zones || {},
2082
+ config: config3,
2083
+ cmsData: cmsData || null
2084
+ };
2085
+ 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
2086
  };
2425
2087
  var IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "svg", "avif", "bmp", "tiff", "heic"];
2426
2088
  var VIDEO_EXTENSIONS = ["mp4", "webm", "ogg", "avi", "mov", "quicktime"];