@tecof/theme-editor 0.0.15 → 0.0.17

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
@@ -17,7 +17,7 @@ import HardBreak from '@tiptap/extension-hard-break';
17
17
  import HorizontalRule from '@tiptap/extension-horizontal-rule';
18
18
  import TextAlign from '@tiptap/extension-text-align';
19
19
  import Link2 from '@tiptap/extension-link';
20
- import Code from '@tiptap/extension-code';
20
+ import Code2 from '@tiptap/extension-code';
21
21
  import CodeBlock from '@tiptap/extension-code-block';
22
22
  import * as ReactDOM from 'react-dom';
23
23
  import ReactDOM__default from 'react-dom';
@@ -639,23 +639,30 @@ var Check = createLucideIcon("check", __iconNode);
639
639
  var __iconNode2 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
640
640
  var ChevronRight = createLucideIcon("chevron-right", __iconNode2);
641
641
 
642
- // node_modules/lucide-react/dist/esm/icons/copy.js
642
+ // node_modules/lucide-react/dist/esm/icons/code.js
643
643
  var __iconNode3 = [
644
+ ["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
645
+ ["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
646
+ ];
647
+ var Code = createLucideIcon("code", __iconNode3);
648
+
649
+ // node_modules/lucide-react/dist/esm/icons/copy.js
650
+ var __iconNode4 = [
644
651
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
645
652
  ["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" }]
646
653
  ];
647
- var Copy = createLucideIcon("copy", __iconNode3);
654
+ var Copy = createLucideIcon("copy", __iconNode4);
648
655
 
649
656
  // node_modules/lucide-react/dist/esm/icons/external-link.js
650
- var __iconNode4 = [
657
+ var __iconNode5 = [
651
658
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
652
659
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
653
660
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
654
661
  ];
655
- var ExternalLink = createLucideIcon("external-link", __iconNode4);
662
+ var ExternalLink = createLucideIcon("external-link", __iconNode5);
656
663
 
657
664
  // node_modules/lucide-react/dist/esm/icons/file-text.js
658
- var __iconNode5 = [
665
+ var __iconNode6 = [
659
666
  [
660
667
  "path",
661
668
  {
@@ -668,10 +675,10 @@ var __iconNode5 = [
668
675
  ["path", { d: "M16 13H8", key: "t4e002" }],
669
676
  ["path", { d: "M16 17H8", key: "z1uh3a" }]
670
677
  ];
671
- var FileText = createLucideIcon("file-text", __iconNode5);
678
+ var FileText = createLucideIcon("file-text", __iconNode6);
672
679
 
673
680
  // node_modules/lucide-react/dist/esm/icons/file.js
674
- var __iconNode6 = [
681
+ var __iconNode7 = [
675
682
  [
676
683
  "path",
677
684
  {
@@ -681,10 +688,10 @@ var __iconNode6 = [
681
688
  ],
682
689
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
683
690
  ];
684
- var File2 = createLucideIcon("file", __iconNode6);
691
+ var File2 = createLucideIcon("file", __iconNode7);
685
692
 
686
693
  // node_modules/lucide-react/dist/esm/icons/folder-open.js
687
- var __iconNode7 = [
694
+ var __iconNode8 = [
688
695
  [
689
696
  "path",
690
697
  {
@@ -693,36 +700,36 @@ var __iconNode7 = [
693
700
  }
694
701
  ]
695
702
  ];
696
- var FolderOpen = createLucideIcon("folder-open", __iconNode7);
703
+ var FolderOpen = createLucideIcon("folder-open", __iconNode8);
697
704
 
698
705
  // node_modules/lucide-react/dist/esm/icons/globe.js
699
- var __iconNode8 = [
706
+ var __iconNode9 = [
700
707
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
701
708
  ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
702
709
  ["path", { d: "M2 12h20", key: "9i4pu4" }]
703
710
  ];
704
- var Globe = createLucideIcon("globe", __iconNode8);
711
+ var Globe = createLucideIcon("globe", __iconNode9);
705
712
 
706
713
  // node_modules/lucide-react/dist/esm/icons/image-plus.js
707
- var __iconNode9 = [
714
+ var __iconNode10 = [
708
715
  ["path", { d: "M16 5h6", key: "1vod17" }],
709
716
  ["path", { d: "M19 2v6", key: "4bpg5p" }],
710
717
  ["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" }],
711
718
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
712
719
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
713
720
  ];
714
- var ImagePlus = createLucideIcon("image-plus", __iconNode9);
721
+ var ImagePlus = createLucideIcon("image-plus", __iconNode10);
715
722
 
716
723
  // node_modules/lucide-react/dist/esm/icons/image.js
717
- var __iconNode10 = [
724
+ var __iconNode11 = [
718
725
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
719
726
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
720
727
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
721
728
  ];
722
- var Image2 = createLucideIcon("image", __iconNode10);
729
+ var Image2 = createLucideIcon("image", __iconNode11);
723
730
 
724
731
  // node_modules/lucide-react/dist/esm/icons/languages.js
725
- var __iconNode11 = [
732
+ var __iconNode12 = [
726
733
  ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
727
734
  ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
728
735
  ["path", { d: "M2 5h12", key: "or177f" }],
@@ -730,21 +737,21 @@ var __iconNode11 = [
730
737
  ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
731
738
  ["path", { d: "M14 18h6", key: "1m8k6r" }]
732
739
  ];
733
- var Languages = createLucideIcon("languages", __iconNode11);
740
+ var Languages = createLucideIcon("languages", __iconNode12);
734
741
 
735
742
  // node_modules/lucide-react/dist/esm/icons/link.js
736
- var __iconNode12 = [
743
+ var __iconNode13 = [
737
744
  ["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" }],
738
745
  ["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" }]
739
746
  ];
740
- var Link = createLucideIcon("link", __iconNode12);
747
+ var Link = createLucideIcon("link", __iconNode13);
741
748
 
742
749
  // node_modules/lucide-react/dist/esm/icons/loader-circle.js
743
- var __iconNode13 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
744
- var LoaderCircle = createLucideIcon("loader-circle", __iconNode13);
750
+ var __iconNode14 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
751
+ var LoaderCircle = createLucideIcon("loader-circle", __iconNode14);
745
752
 
746
753
  // node_modules/lucide-react/dist/esm/icons/pencil.js
747
- var __iconNode14 = [
754
+ var __iconNode15 = [
748
755
  [
749
756
  "path",
750
757
  {
@@ -754,55 +761,55 @@ var __iconNode14 = [
754
761
  ],
755
762
  ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
756
763
  ];
757
- var Pencil = createLucideIcon("pencil", __iconNode14);
764
+ var Pencil = createLucideIcon("pencil", __iconNode15);
758
765
 
759
766
  // node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
760
- var __iconNode15 = [
767
+ var __iconNode16 = [
761
768
  ["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
762
769
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
763
770
  ["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
764
771
  ["path", { d: "M16 16h5v5", key: "ccwih5" }]
765
772
  ];
766
- var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode15);
773
+ var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode16);
767
774
 
768
775
  // node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
769
- var __iconNode16 = [
776
+ var __iconNode17 = [
770
777
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
771
778
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
772
779
  ];
773
- var RotateCcw = createLucideIcon("rotate-ccw", __iconNode16);
780
+ var RotateCcw = createLucideIcon("rotate-ccw", __iconNode17);
774
781
 
775
782
  // node_modules/lucide-react/dist/esm/icons/search.js
776
- var __iconNode17 = [
783
+ var __iconNode18 = [
777
784
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
778
785
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
779
786
  ];
780
- var Search = createLucideIcon("search", __iconNode17);
787
+ var Search = createLucideIcon("search", __iconNode18);
781
788
 
782
789
  // node_modules/lucide-react/dist/esm/icons/trash-2.js
783
- var __iconNode18 = [
790
+ var __iconNode19 = [
784
791
  ["path", { d: "M10 11v6", key: "nco0om" }],
785
792
  ["path", { d: "M14 11v6", key: "outv1u" }],
786
793
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
787
794
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
788
795
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
789
796
  ];
790
- var Trash2 = createLucideIcon("trash-2", __iconNode18);
797
+ var Trash2 = createLucideIcon("trash-2", __iconNode19);
791
798
 
792
799
  // node_modules/lucide-react/dist/esm/icons/upload.js
793
- var __iconNode19 = [
800
+ var __iconNode20 = [
794
801
  ["path", { d: "M12 3v12", key: "1x0j5s" }],
795
802
  ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
796
803
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
797
804
  ];
798
- var Upload = createLucideIcon("upload", __iconNode19);
805
+ var Upload = createLucideIcon("upload", __iconNode20);
799
806
 
800
807
  // node_modules/lucide-react/dist/esm/icons/x.js
801
- var __iconNode20 = [
808
+ var __iconNode21 = [
802
809
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
803
810
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
804
811
  ];
805
- var X = createLucideIcon("x", __iconNode20);
812
+ var X = createLucideIcon("x", __iconNode21);
806
813
  var LanguageTabBar = ({
807
814
  languages,
808
815
  defaultLanguage,
@@ -1018,7 +1025,7 @@ var createExtensions = () => [
1018
1025
  Blockquote,
1019
1026
  HardBreak,
1020
1027
  HorizontalRule,
1021
- Code,
1028
+ Code2,
1022
1029
  CodeBlock,
1023
1030
  TextAlign.configure({ types: ["heading", "paragraph"] }),
1024
1031
  Link2.configure({ openOnClick: false, HTMLAttributes: { target: "_blank" } })
@@ -22285,7 +22292,7 @@ var FileItemRenderer = ({
22285
22292
  `${cdnUrl}/${file2.name}`;
22286
22293
  const ext = getFileExtension(file2.name);
22287
22294
  return /* @__PURE__ */ jsxs("div", { className: "tecof-upload-file-item", children: [
22288
- isImageType(file2.type) ? /* @__PURE__ */ jsx(
22295
+ file2.type === "image/reference" ? /* @__PURE__ */ jsx("div", { className: "tecof-upload-file-icon", style: { backgroundColor: "#eef2ff", color: "#4f46e5" }, children: /* @__PURE__ */ jsx(Code, { size: 20 }) }) : isImageType(file2.type) ? /* @__PURE__ */ jsx(
22289
22296
  TecofPicture,
22290
22297
  {
22291
22298
  data: file2,
@@ -22421,6 +22428,8 @@ var UploadField = ({
22421
22428
  const [filesForPond, setFilesForPond] = useState([]);
22422
22429
  const [showPond, setShowPond] = useState(false);
22423
22430
  const [drawerOpen, setDrawerOpen] = useState(false);
22431
+ const [showRefInput, setShowRefInput] = useState(false);
22432
+ const [refCode, setRefCode] = useState("{{ data. }}");
22424
22433
  const [galleryFiles, setGalleryFiles] = useState([]);
22425
22434
  const [loading, setLoading] = useState(false);
22426
22435
  const [refreshKey, setRefreshKey] = useState(0);
@@ -22467,6 +22476,20 @@ var UploadField = ({
22467
22476
  updated.splice(idx, 1);
22468
22477
  onChange(updated);
22469
22478
  }, [value, onChange]);
22479
+ const handleAddRef = useCallback(() => {
22480
+ if (!refCode.trim()) return;
22481
+ const refFile = {
22482
+ _id: `ref_${Date.now()}`,
22483
+ name: refCode.trim(),
22484
+ size: 0,
22485
+ type: "image/reference",
22486
+ meta: { originalName: refCode.trim(), isReference: true }
22487
+ };
22488
+ const updated = allowMultiple ? [...value, refFile] : [refFile];
22489
+ onChange(updated);
22490
+ setShowRefInput(false);
22491
+ setRefCode("{{ data. }}");
22492
+ }, [refCode, allowMultiple, value, onChange]);
22470
22493
  useEffect(() => {
22471
22494
  if (!drawerOpen) return;
22472
22495
  setLoading(true);
@@ -22581,7 +22604,11 @@ var UploadField = ({
22581
22604
  ]
22582
22605
  }
22583
22606
  ),
22584
- !readOnly && canAddMore && !showPond && value.length > 0 && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-main-actions", children: [
22607
+ !readOnly && canAddMore && !showPond && value.length > 0 && !showRefInput && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-main-actions", children: [
22608
+ /* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-secondary", onClick: () => setShowRefInput(true), children: [
22609
+ /* @__PURE__ */ jsx(Code, { size: 15 }),
22610
+ " Referans"
22611
+ ] }),
22585
22612
  /* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-secondary", onClick: () => setDrawerOpen(true), children: [
22586
22613
  /* @__PURE__ */ jsx(FolderOpen, { size: 15 }),
22587
22614
  " Medya Se\xE7"
@@ -22591,10 +22618,54 @@ var UploadField = ({
22591
22618
  " Yeni Y\xFCkle"
22592
22619
  ] })
22593
22620
  ] }),
22594
- value.length === 0 && !readOnly && canAddMore && !showPond && /* @__PURE__ */ jsx("div", { className: "tecof-upload-main-actions", children: /* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-primary", onClick: () => setShowPond(true), children: [
22595
- /* @__PURE__ */ jsx(Upload, { size: 15 }),
22596
- " Yeni Y\xFCkle"
22597
- ] }) }),
22621
+ value.length === 0 && !readOnly && canAddMore && !showPond && !showRefInput && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-main-actions", children: [
22622
+ /* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-secondary", onClick: () => setShowRefInput(true), children: [
22623
+ /* @__PURE__ */ jsx(Code, { size: 15 }),
22624
+ " Dinamik Referans Se\xE7"
22625
+ ] }),
22626
+ /* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-primary", onClick: () => setShowPond(true), children: [
22627
+ /* @__PURE__ */ jsx(Upload, { size: 15 }),
22628
+ " Yeni Y\xFCkle"
22629
+ ] })
22630
+ ] }),
22631
+ showRefInput && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-ref-section", style: { background: "#f8fafc", padding: "12px", borderRadius: "8px", border: "1px solid #e2e8f0", marginTop: "10px" }, children: [
22632
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "8px" }, children: [
22633
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: "12px", fontWeight: 500, color: "#475569" }, children: [
22634
+ "Dinamik CMS De\u011Fi\u015Fkeni (\xD6rn: ",
22635
+ `{{ data.image }}`,
22636
+ ")"
22637
+ ] }),
22638
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setShowRefInput(false), style: { background: "none", border: "none", cursor: "pointer", color: "#64748b" }, children: /* @__PURE__ */ jsx(X, { size: 14 }) })
22639
+ ] }),
22640
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px" }, children: [
22641
+ /* @__PURE__ */ jsx(
22642
+ "input",
22643
+ {
22644
+ type: "text",
22645
+ value: refCode,
22646
+ onChange: (e3) => setRefCode(e3.target.value),
22647
+ placeholder: "{{ data. }}",
22648
+ style: { flex: 1, padding: "8px 10px", fontSize: "13px", borderRadius: "6px", border: "1px solid #cbd5e1", outline: "none" },
22649
+ autoFocus: true,
22650
+ onKeyDown: (e3) => {
22651
+ if (e3.key === "Enter") {
22652
+ e3.preventDefault();
22653
+ handleAddRef();
22654
+ }
22655
+ }
22656
+ }
22657
+ ),
22658
+ /* @__PURE__ */ jsx(
22659
+ "button",
22660
+ {
22661
+ type: "button",
22662
+ onClick: handleAddRef,
22663
+ style: { padding: "0 12px", background: "#4f46e5", color: "#fff", fontSize: "12px", fontWeight: 500, borderRadius: "6px", border: "none", cursor: "pointer" },
22664
+ children: "Ekle"
22665
+ }
22666
+ )
22667
+ ] })
22668
+ ] }),
22598
22669
  !readOnly && showPond && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-pond-section", children: [
22599
22670
  /* @__PURE__ */ jsxs("div", { className: "tecof-upload-pond-header", children: [
22600
22671
  /* @__PURE__ */ jsxs("p", { className: "tecof-upload-pond-header-title", children: [
@@ -24119,6 +24190,7 @@ lucide-react/dist/esm/Icon.js:
24119
24190
  lucide-react/dist/esm/createLucideIcon.js:
24120
24191
  lucide-react/dist/esm/icons/check.js:
24121
24192
  lucide-react/dist/esm/icons/chevron-right.js:
24193
+ lucide-react/dist/esm/icons/code.js:
24122
24194
  lucide-react/dist/esm/icons/copy.js:
24123
24195
  lucide-react/dist/esm/icons/external-link.js:
24124
24196
  lucide-react/dist/esm/icons/file-text.js: