@tecof/theme-editor 0.0.27 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +119 -2
- package/dist/index.d.ts +119 -2
- package/dist/index.js +745 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +741 -45
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +609 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var Blockquote = require('@tiptap/extension-blockquote');
|
|
|
17
17
|
var HardBreak = require('@tiptap/extension-hard-break');
|
|
18
18
|
var HorizontalRule = require('@tiptap/extension-horizontal-rule');
|
|
19
19
|
var TextAlign = require('@tiptap/extension-text-align');
|
|
20
|
-
var
|
|
20
|
+
var Link3 = require('@tiptap/extension-link');
|
|
21
21
|
var Code2 = require('@tiptap/extension-code');
|
|
22
22
|
var CodeBlock = require('@tiptap/extension-code-block');
|
|
23
23
|
var ReactDOM = require('react-dom');
|
|
@@ -55,7 +55,7 @@ var Blockquote__default = /*#__PURE__*/_interopDefault(Blockquote);
|
|
|
55
55
|
var HardBreak__default = /*#__PURE__*/_interopDefault(HardBreak);
|
|
56
56
|
var HorizontalRule__default = /*#__PURE__*/_interopDefault(HorizontalRule);
|
|
57
57
|
var TextAlign__default = /*#__PURE__*/_interopDefault(TextAlign);
|
|
58
|
-
var
|
|
58
|
+
var Link3__default = /*#__PURE__*/_interopDefault(Link3);
|
|
59
59
|
var Code2__default = /*#__PURE__*/_interopDefault(Code2);
|
|
60
60
|
var CodeBlock__default = /*#__PURE__*/_interopDefault(CodeBlock);
|
|
61
61
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
@@ -259,6 +259,49 @@ var TecofApiClient = class {
|
|
|
259
259
|
return null;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Fetch CMS collections list (for CmsCollectionField)
|
|
264
|
+
* Returns: [{ _id, name, slug, fields, ... }]
|
|
265
|
+
*/
|
|
266
|
+
async getCmsCollections() {
|
|
267
|
+
try {
|
|
268
|
+
const res2 = await fetch(`${this.apiUrl}/api/store/cms/collections`, {
|
|
269
|
+
method: "POST",
|
|
270
|
+
headers: this.headers,
|
|
271
|
+
body: JSON.stringify({})
|
|
272
|
+
});
|
|
273
|
+
return await res2.json();
|
|
274
|
+
} catch (error2) {
|
|
275
|
+
return {
|
|
276
|
+
success: false,
|
|
277
|
+
message: error2 instanceof Error ? error2.message : "Failed to fetch collections"
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Fetch items from a CMS collection by slug
|
|
283
|
+
* Returns: { items: [...], totalData: N }
|
|
284
|
+
*/
|
|
285
|
+
async getCmsCollectionItems(collectionSlug, options) {
|
|
286
|
+
try {
|
|
287
|
+
const res2 = await fetch(`${this.apiUrl}/api/store/cms/collections/${encodeURIComponent(collectionSlug)}/items`, {
|
|
288
|
+
method: "POST",
|
|
289
|
+
headers: this.headers,
|
|
290
|
+
body: JSON.stringify({
|
|
291
|
+
page: options?.page || 1,
|
|
292
|
+
limit: options?.limit || 50,
|
|
293
|
+
sort: options?.sort || "newest",
|
|
294
|
+
locale: options?.locale
|
|
295
|
+
})
|
|
296
|
+
});
|
|
297
|
+
return await res2.json();
|
|
298
|
+
} catch (error2) {
|
|
299
|
+
return {
|
|
300
|
+
success: false,
|
|
301
|
+
message: error2 instanceof Error ? error2.message : "Failed to fetch collection items"
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}
|
|
262
305
|
/** CDN base URL (defaults to apiUrl if not set) */
|
|
263
306
|
get cdnUrl() {
|
|
264
307
|
return this.customCdnUrl || this.apiUrl;
|
|
@@ -497,9 +540,16 @@ var TecofEditor = ({
|
|
|
497
540
|
saving && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-editor-save-indicator", children: saveStatus === "error" ? "Save failed" : "Saving..." })
|
|
498
541
|
] });
|
|
499
542
|
};
|
|
500
|
-
var TecofRender = ({ data: data3, config: config3, className }) => {
|
|
543
|
+
var TecofRender = ({ data: data3, config: config3, className, cmsData }) => {
|
|
501
544
|
if (!data3) return null;
|
|
502
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
545
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
546
|
+
core.Render,
|
|
547
|
+
{
|
|
548
|
+
config: config3,
|
|
549
|
+
data: data3,
|
|
550
|
+
metadata: { cmsData: cmsData || null }
|
|
551
|
+
}
|
|
552
|
+
) });
|
|
503
553
|
};
|
|
504
554
|
var IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "svg", "avif", "bmp", "tiff", "heic"];
|
|
505
555
|
var VIDEO_EXTENSIONS = ["mp4", "webm", "ogg", "avi", "mov", "quicktime"];
|
|
@@ -765,34 +815,46 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
|
765
815
|
var __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
766
816
|
var Check = createLucideIcon("check", __iconNode);
|
|
767
817
|
|
|
818
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-down.js
|
|
819
|
+
var __iconNode2 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
820
|
+
var ChevronDown = createLucideIcon("chevron-down", __iconNode2);
|
|
821
|
+
|
|
768
822
|
// node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
769
|
-
var
|
|
770
|
-
var ChevronRight = createLucideIcon("chevron-right",
|
|
823
|
+
var __iconNode3 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
824
|
+
var ChevronRight = createLucideIcon("chevron-right", __iconNode3);
|
|
771
825
|
|
|
772
826
|
// node_modules/lucide-react/dist/esm/icons/code.js
|
|
773
|
-
var
|
|
827
|
+
var __iconNode4 = [
|
|
774
828
|
["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
|
|
775
829
|
["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
|
|
776
830
|
];
|
|
777
|
-
var Code = createLucideIcon("code",
|
|
831
|
+
var Code = createLucideIcon("code", __iconNode4);
|
|
778
832
|
|
|
779
833
|
// node_modules/lucide-react/dist/esm/icons/copy.js
|
|
780
|
-
var
|
|
834
|
+
var __iconNode5 = [
|
|
781
835
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
782
836
|
["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" }]
|
|
783
837
|
];
|
|
784
|
-
var Copy = createLucideIcon("copy",
|
|
838
|
+
var Copy = createLucideIcon("copy", __iconNode5);
|
|
839
|
+
|
|
840
|
+
// node_modules/lucide-react/dist/esm/icons/database.js
|
|
841
|
+
var __iconNode6 = [
|
|
842
|
+
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
|
|
843
|
+
["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
|
|
844
|
+
["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
|
|
845
|
+
];
|
|
846
|
+
var Database = createLucideIcon("database", __iconNode6);
|
|
785
847
|
|
|
786
848
|
// node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
787
|
-
var
|
|
849
|
+
var __iconNode7 = [
|
|
788
850
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
789
851
|
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
790
852
|
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
791
853
|
];
|
|
792
|
-
var ExternalLink = createLucideIcon("external-link",
|
|
854
|
+
var ExternalLink = createLucideIcon("external-link", __iconNode7);
|
|
793
855
|
|
|
794
856
|
// node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
795
|
-
var
|
|
857
|
+
var __iconNode8 = [
|
|
796
858
|
[
|
|
797
859
|
"path",
|
|
798
860
|
{
|
|
@@ -805,10 +867,10 @@ var __iconNode6 = [
|
|
|
805
867
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
806
868
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
807
869
|
];
|
|
808
|
-
var FileText = createLucideIcon("file-text",
|
|
870
|
+
var FileText = createLucideIcon("file-text", __iconNode8);
|
|
809
871
|
|
|
810
872
|
// node_modules/lucide-react/dist/esm/icons/file.js
|
|
811
|
-
var
|
|
873
|
+
var __iconNode9 = [
|
|
812
874
|
[
|
|
813
875
|
"path",
|
|
814
876
|
{
|
|
@@ -818,10 +880,10 @@ var __iconNode7 = [
|
|
|
818
880
|
],
|
|
819
881
|
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
|
|
820
882
|
];
|
|
821
|
-
var File2 = createLucideIcon("file",
|
|
883
|
+
var File2 = createLucideIcon("file", __iconNode9);
|
|
822
884
|
|
|
823
885
|
// node_modules/lucide-react/dist/esm/icons/folder-open.js
|
|
824
|
-
var
|
|
886
|
+
var __iconNode10 = [
|
|
825
887
|
[
|
|
826
888
|
"path",
|
|
827
889
|
{
|
|
@@ -830,36 +892,47 @@ var __iconNode8 = [
|
|
|
830
892
|
}
|
|
831
893
|
]
|
|
832
894
|
];
|
|
833
|
-
var FolderOpen = createLucideIcon("folder-open",
|
|
895
|
+
var FolderOpen = createLucideIcon("folder-open", __iconNode10);
|
|
834
896
|
|
|
835
897
|
// node_modules/lucide-react/dist/esm/icons/globe.js
|
|
836
|
-
var
|
|
898
|
+
var __iconNode11 = [
|
|
837
899
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
838
900
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
839
901
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
840
902
|
];
|
|
841
|
-
var Globe = createLucideIcon("globe",
|
|
903
|
+
var Globe = createLucideIcon("globe", __iconNode11);
|
|
904
|
+
|
|
905
|
+
// node_modules/lucide-react/dist/esm/icons/grip-vertical.js
|
|
906
|
+
var __iconNode12 = [
|
|
907
|
+
["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
|
|
908
|
+
["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
|
|
909
|
+
["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
|
|
910
|
+
["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
|
|
911
|
+
["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
|
|
912
|
+
["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
|
|
913
|
+
];
|
|
914
|
+
var GripVertical = createLucideIcon("grip-vertical", __iconNode12);
|
|
842
915
|
|
|
843
916
|
// node_modules/lucide-react/dist/esm/icons/image-plus.js
|
|
844
|
-
var
|
|
917
|
+
var __iconNode13 = [
|
|
845
918
|
["path", { d: "M16 5h6", key: "1vod17" }],
|
|
846
919
|
["path", { d: "M19 2v6", key: "4bpg5p" }],
|
|
847
920
|
["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" }],
|
|
848
921
|
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
|
|
849
922
|
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
|
|
850
923
|
];
|
|
851
|
-
var ImagePlus = createLucideIcon("image-plus",
|
|
924
|
+
var ImagePlus = createLucideIcon("image-plus", __iconNode13);
|
|
852
925
|
|
|
853
926
|
// node_modules/lucide-react/dist/esm/icons/image.js
|
|
854
|
-
var
|
|
927
|
+
var __iconNode14 = [
|
|
855
928
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
856
929
|
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
857
930
|
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
858
931
|
];
|
|
859
|
-
var Image2 = createLucideIcon("image",
|
|
932
|
+
var Image2 = createLucideIcon("image", __iconNode14);
|
|
860
933
|
|
|
861
934
|
// node_modules/lucide-react/dist/esm/icons/languages.js
|
|
862
|
-
var
|
|
935
|
+
var __iconNode15 = [
|
|
863
936
|
["path", { d: "m5 8 6 6", key: "1wu5hv" }],
|
|
864
937
|
["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
|
|
865
938
|
["path", { d: "M2 5h12", key: "or177f" }],
|
|
@@ -867,21 +940,29 @@ var __iconNode12 = [
|
|
|
867
940
|
["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
|
|
868
941
|
["path", { d: "M14 18h6", key: "1m8k6r" }]
|
|
869
942
|
];
|
|
870
|
-
var Languages = createLucideIcon("languages",
|
|
943
|
+
var Languages = createLucideIcon("languages", __iconNode15);
|
|
944
|
+
|
|
945
|
+
// node_modules/lucide-react/dist/esm/icons/link-2.js
|
|
946
|
+
var __iconNode16 = [
|
|
947
|
+
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
948
|
+
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
949
|
+
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
950
|
+
];
|
|
951
|
+
var Link2 = createLucideIcon("link-2", __iconNode16);
|
|
871
952
|
|
|
872
953
|
// node_modules/lucide-react/dist/esm/icons/link.js
|
|
873
|
-
var
|
|
954
|
+
var __iconNode17 = [
|
|
874
955
|
["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" }],
|
|
875
956
|
["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" }]
|
|
876
957
|
];
|
|
877
|
-
var Link = createLucideIcon("link",
|
|
958
|
+
var Link = createLucideIcon("link", __iconNode17);
|
|
878
959
|
|
|
879
960
|
// node_modules/lucide-react/dist/esm/icons/loader-circle.js
|
|
880
|
-
var
|
|
881
|
-
var LoaderCircle = createLucideIcon("loader-circle",
|
|
961
|
+
var __iconNode18 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
|
|
962
|
+
var LoaderCircle = createLucideIcon("loader-circle", __iconNode18);
|
|
882
963
|
|
|
883
964
|
// node_modules/lucide-react/dist/esm/icons/pencil.js
|
|
884
|
-
var
|
|
965
|
+
var __iconNode19 = [
|
|
885
966
|
[
|
|
886
967
|
"path",
|
|
887
968
|
{
|
|
@@ -891,55 +972,71 @@ var __iconNode15 = [
|
|
|
891
972
|
],
|
|
892
973
|
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
893
974
|
];
|
|
894
|
-
var Pencil = createLucideIcon("pencil",
|
|
975
|
+
var Pencil = createLucideIcon("pencil", __iconNode19);
|
|
976
|
+
|
|
977
|
+
// node_modules/lucide-react/dist/esm/icons/plus.js
|
|
978
|
+
var __iconNode20 = [
|
|
979
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
980
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
981
|
+
];
|
|
982
|
+
var Plus = createLucideIcon("plus", __iconNode20);
|
|
895
983
|
|
|
896
984
|
// node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
|
|
897
|
-
var
|
|
985
|
+
var __iconNode21 = [
|
|
898
986
|
["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
|
|
899
987
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }],
|
|
900
988
|
["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
|
|
901
989
|
["path", { d: "M16 16h5v5", key: "ccwih5" }]
|
|
902
990
|
];
|
|
903
|
-
var RefreshCcw = createLucideIcon("refresh-ccw",
|
|
991
|
+
var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode21);
|
|
992
|
+
|
|
993
|
+
// node_modules/lucide-react/dist/esm/icons/refresh-cw.js
|
|
994
|
+
var __iconNode22 = [
|
|
995
|
+
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
|
|
996
|
+
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
|
|
997
|
+
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
|
|
998
|
+
["path", { d: "M8 16H3v5", key: "1cv678" }]
|
|
999
|
+
];
|
|
1000
|
+
var RefreshCw = createLucideIcon("refresh-cw", __iconNode22);
|
|
904
1001
|
|
|
905
1002
|
// node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
|
|
906
|
-
var
|
|
1003
|
+
var __iconNode23 = [
|
|
907
1004
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
908
1005
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
909
1006
|
];
|
|
910
|
-
var RotateCcw = createLucideIcon("rotate-ccw",
|
|
1007
|
+
var RotateCcw = createLucideIcon("rotate-ccw", __iconNode23);
|
|
911
1008
|
|
|
912
1009
|
// node_modules/lucide-react/dist/esm/icons/search.js
|
|
913
|
-
var
|
|
1010
|
+
var __iconNode24 = [
|
|
914
1011
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
915
1012
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
916
1013
|
];
|
|
917
|
-
var Search = createLucideIcon("search",
|
|
1014
|
+
var Search = createLucideIcon("search", __iconNode24);
|
|
918
1015
|
|
|
919
1016
|
// node_modules/lucide-react/dist/esm/icons/trash-2.js
|
|
920
|
-
var
|
|
1017
|
+
var __iconNode25 = [
|
|
921
1018
|
["path", { d: "M10 11v6", key: "nco0om" }],
|
|
922
1019
|
["path", { d: "M14 11v6", key: "outv1u" }],
|
|
923
1020
|
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
924
1021
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
925
1022
|
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
926
1023
|
];
|
|
927
|
-
var Trash2 = createLucideIcon("trash-2",
|
|
1024
|
+
var Trash2 = createLucideIcon("trash-2", __iconNode25);
|
|
928
1025
|
|
|
929
1026
|
// node_modules/lucide-react/dist/esm/icons/upload.js
|
|
930
|
-
var
|
|
1027
|
+
var __iconNode26 = [
|
|
931
1028
|
["path", { d: "M12 3v12", key: "1x0j5s" }],
|
|
932
1029
|
["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
|
|
933
1030
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
|
|
934
1031
|
];
|
|
935
|
-
var Upload = createLucideIcon("upload",
|
|
1032
|
+
var Upload = createLucideIcon("upload", __iconNode26);
|
|
936
1033
|
|
|
937
1034
|
// node_modules/lucide-react/dist/esm/icons/x.js
|
|
938
|
-
var
|
|
1035
|
+
var __iconNode27 = [
|
|
939
1036
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
940
1037
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
941
1038
|
];
|
|
942
|
-
var X = createLucideIcon("x",
|
|
1039
|
+
var X = createLucideIcon("x", __iconNode27);
|
|
943
1040
|
var FieldErrorBoundary = class extends React__default.Component {
|
|
944
1041
|
constructor(props) {
|
|
945
1042
|
super(props);
|
|
@@ -1274,7 +1371,7 @@ var createExtensions = () => [
|
|
|
1274
1371
|
Code2__default.default,
|
|
1275
1372
|
CodeBlock__default.default,
|
|
1276
1373
|
TextAlign__default.default.configure({ types: ["heading", "paragraph"] }),
|
|
1277
|
-
|
|
1374
|
+
Link3__default.default.configure({ openOnClick: false, HTMLAttributes: { target: "_blank" } })
|
|
1278
1375
|
];
|
|
1279
1376
|
var ToolbarBtn = ({
|
|
1280
1377
|
onClick,
|
|
@@ -24215,6 +24312,599 @@ var createColorField = (options = {}) => {
|
|
|
24215
24312
|
) }) })
|
|
24216
24313
|
};
|
|
24217
24314
|
};
|
|
24315
|
+
var RepeaterRow = ({
|
|
24316
|
+
row,
|
|
24317
|
+
rowIndex,
|
|
24318
|
+
subFields,
|
|
24319
|
+
isExpanded,
|
|
24320
|
+
onToggle,
|
|
24321
|
+
onRemove,
|
|
24322
|
+
onDuplicate,
|
|
24323
|
+
onMoveUp,
|
|
24324
|
+
onMoveDown,
|
|
24325
|
+
onChange,
|
|
24326
|
+
canRemove,
|
|
24327
|
+
canMoveUp,
|
|
24328
|
+
canMoveDown,
|
|
24329
|
+
readOnly
|
|
24330
|
+
}) => {
|
|
24331
|
+
const previewLabel = React__default.useMemo(() => {
|
|
24332
|
+
const keys = Object.keys(subFields);
|
|
24333
|
+
if (keys.length === 0) return `Sat\u0131r ${rowIndex + 1}`;
|
|
24334
|
+
const firstKey = keys[0];
|
|
24335
|
+
const val = row[firstKey];
|
|
24336
|
+
if (!val) return `Sat\u0131r ${rowIndex + 1}`;
|
|
24337
|
+
if (Array.isArray(val) && val.length > 0 && typeof val[0] === "object" && "value" in val[0]) {
|
|
24338
|
+
const text2 = val[0]?.value;
|
|
24339
|
+
if (typeof text2 === "string" && text2.trim()) {
|
|
24340
|
+
return text2.length > 40 ? text2.substring(0, 40) + "\u2026" : text2;
|
|
24341
|
+
}
|
|
24342
|
+
}
|
|
24343
|
+
if (typeof val === "string" && val.trim()) {
|
|
24344
|
+
return val.length > 40 ? val.substring(0, 40) + "\u2026" : val;
|
|
24345
|
+
}
|
|
24346
|
+
return `Sat\u0131r ${rowIndex + 1}`;
|
|
24347
|
+
}, [row, subFields, rowIndex]);
|
|
24348
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `tecof-repeater-row ${isExpanded ? "expanded" : ""}`, children: [
|
|
24349
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-row-header", onClick: onToggle, children: [
|
|
24350
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-row-left", children: [
|
|
24351
|
+
/* @__PURE__ */ jsxRuntime.jsx(GripVertical, { size: 14, className: "tecof-repeater-grip" }),
|
|
24352
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "tecof-repeater-row-index", children: rowIndex + 1 }),
|
|
24353
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "tecof-repeater-row-preview", children: previewLabel })
|
|
24354
|
+
] }),
|
|
24355
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-row-actions", children: [
|
|
24356
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24357
|
+
canMoveUp && /* @__PURE__ */ jsxRuntime.jsx(
|
|
24358
|
+
"button",
|
|
24359
|
+
{
|
|
24360
|
+
type: "button",
|
|
24361
|
+
className: "tecof-repeater-action-btn",
|
|
24362
|
+
onClick: (e3) => {
|
|
24363
|
+
e3.stopPropagation();
|
|
24364
|
+
onMoveUp();
|
|
24365
|
+
},
|
|
24366
|
+
title: "Yukar\u0131 Ta\u015F\u0131",
|
|
24367
|
+
children: "\u25B2"
|
|
24368
|
+
}
|
|
24369
|
+
),
|
|
24370
|
+
canMoveDown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
24371
|
+
"button",
|
|
24372
|
+
{
|
|
24373
|
+
type: "button",
|
|
24374
|
+
className: "tecof-repeater-action-btn",
|
|
24375
|
+
onClick: (e3) => {
|
|
24376
|
+
e3.stopPropagation();
|
|
24377
|
+
onMoveDown();
|
|
24378
|
+
},
|
|
24379
|
+
title: "A\u015Fa\u011F\u0131 Ta\u015F\u0131",
|
|
24380
|
+
children: "\u25BC"
|
|
24381
|
+
}
|
|
24382
|
+
),
|
|
24383
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24384
|
+
"button",
|
|
24385
|
+
{
|
|
24386
|
+
type: "button",
|
|
24387
|
+
className: "tecof-repeater-action-btn",
|
|
24388
|
+
onClick: (e3) => {
|
|
24389
|
+
e3.stopPropagation();
|
|
24390
|
+
onDuplicate();
|
|
24391
|
+
},
|
|
24392
|
+
title: "Kopyala",
|
|
24393
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Copy, { size: 13 })
|
|
24394
|
+
}
|
|
24395
|
+
),
|
|
24396
|
+
canRemove && /* @__PURE__ */ jsxRuntime.jsx(
|
|
24397
|
+
"button",
|
|
24398
|
+
{
|
|
24399
|
+
type: "button",
|
|
24400
|
+
className: "tecof-repeater-action-btn tecof-repeater-action-btn-danger",
|
|
24401
|
+
onClick: (e3) => {
|
|
24402
|
+
e3.stopPropagation();
|
|
24403
|
+
onRemove();
|
|
24404
|
+
},
|
|
24405
|
+
title: "Sil",
|
|
24406
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Trash2, { size: 13 })
|
|
24407
|
+
}
|
|
24408
|
+
)
|
|
24409
|
+
] }),
|
|
24410
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24411
|
+
ChevronDown,
|
|
24412
|
+
{
|
|
24413
|
+
size: 16,
|
|
24414
|
+
className: `tecof-repeater-chevron ${isExpanded ? "rotated" : ""}`
|
|
24415
|
+
}
|
|
24416
|
+
)
|
|
24417
|
+
] })
|
|
24418
|
+
] }),
|
|
24419
|
+
isExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-repeater-row-content", children: Object.entries(subFields).map(([key, fieldDef]) => {
|
|
24420
|
+
const fieldValue = row[key];
|
|
24421
|
+
const renderFn = fieldDef?.render;
|
|
24422
|
+
if (typeof renderFn !== "function") return null;
|
|
24423
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-repeater-subfield", children: renderFn({
|
|
24424
|
+
field: fieldDef,
|
|
24425
|
+
name: `${key}_${rowIndex}`,
|
|
24426
|
+
id: `repeater-${rowIndex}-${key}`,
|
|
24427
|
+
value: fieldValue,
|
|
24428
|
+
onChange: (val) => onChange(key, val),
|
|
24429
|
+
readOnly
|
|
24430
|
+
}) }, key);
|
|
24431
|
+
}) })
|
|
24432
|
+
] });
|
|
24433
|
+
};
|
|
24434
|
+
var RepeaterField = ({
|
|
24435
|
+
value: rawValue,
|
|
24436
|
+
onChange,
|
|
24437
|
+
readOnly,
|
|
24438
|
+
subFields = {},
|
|
24439
|
+
minItems = 0,
|
|
24440
|
+
maxItems,
|
|
24441
|
+
defaultRow
|
|
24442
|
+
}) => {
|
|
24443
|
+
const items = React__default.useMemo(() => Array.isArray(rawValue) ? rawValue : [], [rawValue]);
|
|
24444
|
+
const [expandedRows, setExpandedRows] = React__default.useState(() => new Set(items.length > 0 ? [0] : []));
|
|
24445
|
+
const onChangeRef = React__default.useRef(onChange);
|
|
24446
|
+
onChangeRef.current = onChange;
|
|
24447
|
+
const canAdd = maxItems == null || items.length < maxItems;
|
|
24448
|
+
const canRemove = items.length > minItems;
|
|
24449
|
+
const buildDefaultRow = React__default.useCallback(() => {
|
|
24450
|
+
if (defaultRow) return { ...defaultRow };
|
|
24451
|
+
const row = {};
|
|
24452
|
+
for (const [key, fieldDef] of Object.entries(subFields)) {
|
|
24453
|
+
const ft = fieldDef?._fieldType;
|
|
24454
|
+
if (ft === "language" || ft === "editor") {
|
|
24455
|
+
row[key] = [];
|
|
24456
|
+
} else if (ft === "upload") {
|
|
24457
|
+
row[key] = [];
|
|
24458
|
+
} else if (ft === "link") {
|
|
24459
|
+
row[key] = [];
|
|
24460
|
+
} else if (ft === "color") {
|
|
24461
|
+
row[key] = "#000000";
|
|
24462
|
+
} else {
|
|
24463
|
+
row[key] = "";
|
|
24464
|
+
}
|
|
24465
|
+
}
|
|
24466
|
+
return row;
|
|
24467
|
+
}, [subFields, defaultRow]);
|
|
24468
|
+
const handleAdd = React__default.useCallback(() => {
|
|
24469
|
+
if (!canAdd) return;
|
|
24470
|
+
const newRow = buildDefaultRow();
|
|
24471
|
+
const newItems = [...items, newRow];
|
|
24472
|
+
onChangeRef.current(newItems);
|
|
24473
|
+
setExpandedRows((prev) => {
|
|
24474
|
+
const next = new Set(prev);
|
|
24475
|
+
next.add(newItems.length - 1);
|
|
24476
|
+
return next;
|
|
24477
|
+
});
|
|
24478
|
+
}, [canAdd, buildDefaultRow, items]);
|
|
24479
|
+
const handleRemove = React__default.useCallback((index2) => {
|
|
24480
|
+
if (!canRemove) return;
|
|
24481
|
+
const newItems = items.filter((_2, i2) => i2 !== index2);
|
|
24482
|
+
onChangeRef.current(newItems);
|
|
24483
|
+
setExpandedRows((prev) => {
|
|
24484
|
+
const next = /* @__PURE__ */ new Set();
|
|
24485
|
+
prev.forEach((idx) => {
|
|
24486
|
+
if (idx < index2) next.add(idx);
|
|
24487
|
+
else if (idx > index2) next.add(idx - 1);
|
|
24488
|
+
});
|
|
24489
|
+
return next;
|
|
24490
|
+
});
|
|
24491
|
+
}, [canRemove, items]);
|
|
24492
|
+
const handleDuplicate = React__default.useCallback((index2) => {
|
|
24493
|
+
if (!canAdd) return;
|
|
24494
|
+
const newItems = [...items];
|
|
24495
|
+
const cloned = JSON.parse(JSON.stringify(items[index2]));
|
|
24496
|
+
newItems.splice(index2 + 1, 0, cloned);
|
|
24497
|
+
onChangeRef.current(newItems);
|
|
24498
|
+
setExpandedRows((prev) => {
|
|
24499
|
+
const next = /* @__PURE__ */ new Set();
|
|
24500
|
+
prev.forEach((idx) => {
|
|
24501
|
+
if (idx <= index2) next.add(idx);
|
|
24502
|
+
else next.add(idx + 1);
|
|
24503
|
+
});
|
|
24504
|
+
next.add(index2 + 1);
|
|
24505
|
+
return next;
|
|
24506
|
+
});
|
|
24507
|
+
}, [canAdd, items]);
|
|
24508
|
+
const handleMove = React__default.useCallback((index2, direction) => {
|
|
24509
|
+
const target = direction === "up" ? index2 - 1 : index2 + 1;
|
|
24510
|
+
if (target < 0 || target >= items.length) return;
|
|
24511
|
+
const newItems = [...items];
|
|
24512
|
+
[newItems[index2], newItems[target]] = [newItems[target], newItems[index2]];
|
|
24513
|
+
onChangeRef.current(newItems);
|
|
24514
|
+
setExpandedRows((prev) => {
|
|
24515
|
+
const next = /* @__PURE__ */ new Set();
|
|
24516
|
+
prev.forEach((idx) => {
|
|
24517
|
+
if (idx === index2) next.add(target);
|
|
24518
|
+
else if (idx === target) next.add(index2);
|
|
24519
|
+
else next.add(idx);
|
|
24520
|
+
});
|
|
24521
|
+
return next;
|
|
24522
|
+
});
|
|
24523
|
+
}, [items]);
|
|
24524
|
+
const handleSubFieldChange = React__default.useCallback((rowIndex, key, val) => {
|
|
24525
|
+
const newItems = items.map((row, i2) => {
|
|
24526
|
+
if (i2 !== rowIndex) return row;
|
|
24527
|
+
return { ...row, [key]: val };
|
|
24528
|
+
});
|
|
24529
|
+
onChangeRef.current(newItems);
|
|
24530
|
+
}, [items]);
|
|
24531
|
+
const toggleRow = React__default.useCallback((index2) => {
|
|
24532
|
+
setExpandedRows((prev) => {
|
|
24533
|
+
const next = new Set(prev);
|
|
24534
|
+
if (next.has(index2)) next.delete(index2);
|
|
24535
|
+
else next.add(index2);
|
|
24536
|
+
return next;
|
|
24537
|
+
});
|
|
24538
|
+
}, []);
|
|
24539
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-container", children: [
|
|
24540
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-repeater-header", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "tecof-repeater-count", children: [
|
|
24541
|
+
items.length,
|
|
24542
|
+
" sat\u0131r",
|
|
24543
|
+
maxItems != null && ` / ${maxItems}`
|
|
24544
|
+
] }) }),
|
|
24545
|
+
items.length === 0 && !readOnly && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-empty", children: [
|
|
24546
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "tecof-repeater-empty-text", children: "Hen\xFCz sat\u0131r eklenmemi\u015F" }),
|
|
24547
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
24548
|
+
"button",
|
|
24549
|
+
{
|
|
24550
|
+
type: "button",
|
|
24551
|
+
className: "tecof-repeater-add-btn",
|
|
24552
|
+
onClick: handleAdd,
|
|
24553
|
+
children: [
|
|
24554
|
+
/* @__PURE__ */ jsxRuntime.jsx(Plus, { size: 14 }),
|
|
24555
|
+
" \u0130lk Sat\u0131r\u0131 Ekle"
|
|
24556
|
+
]
|
|
24557
|
+
}
|
|
24558
|
+
)
|
|
24559
|
+
] }),
|
|
24560
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-repeater-rows", children: items.map((row, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24561
|
+
RepeaterRow,
|
|
24562
|
+
{
|
|
24563
|
+
row,
|
|
24564
|
+
rowIndex: idx,
|
|
24565
|
+
subFields,
|
|
24566
|
+
isExpanded: expandedRows.has(idx),
|
|
24567
|
+
onToggle: () => toggleRow(idx),
|
|
24568
|
+
onRemove: () => handleRemove(idx),
|
|
24569
|
+
onDuplicate: () => handleDuplicate(idx),
|
|
24570
|
+
onMoveUp: () => handleMove(idx, "up"),
|
|
24571
|
+
onMoveDown: () => handleMove(idx, "down"),
|
|
24572
|
+
onChange: (key, val) => handleSubFieldChange(idx, key, val),
|
|
24573
|
+
canRemove,
|
|
24574
|
+
canMoveUp: idx > 0,
|
|
24575
|
+
canMoveDown: idx < items.length - 1,
|
|
24576
|
+
readOnly
|
|
24577
|
+
},
|
|
24578
|
+
idx
|
|
24579
|
+
)) }),
|
|
24580
|
+
items.length > 0 && !readOnly && canAdd && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24581
|
+
"button",
|
|
24582
|
+
{
|
|
24583
|
+
type: "button",
|
|
24584
|
+
className: "tecof-repeater-add-btn-bottom",
|
|
24585
|
+
onClick: handleAdd,
|
|
24586
|
+
children: [
|
|
24587
|
+
/* @__PURE__ */ jsxRuntime.jsx(Plus, { size: 14 }),
|
|
24588
|
+
" Sat\u0131r Ekle"
|
|
24589
|
+
]
|
|
24590
|
+
}
|
|
24591
|
+
)
|
|
24592
|
+
] });
|
|
24593
|
+
};
|
|
24594
|
+
RepeaterField.displayName = "RepeaterField";
|
|
24595
|
+
var createRepeaterField = (options) => {
|
|
24596
|
+
const { label, labelIcon, visible, ...fieldOptions } = options;
|
|
24597
|
+
return {
|
|
24598
|
+
type: "custom",
|
|
24599
|
+
_fieldType: "repeater",
|
|
24600
|
+
label,
|
|
24601
|
+
labelIcon,
|
|
24602
|
+
visible,
|
|
24603
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(core.FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24604
|
+
RepeaterField,
|
|
24605
|
+
{
|
|
24606
|
+
field,
|
|
24607
|
+
name: name3,
|
|
24608
|
+
id,
|
|
24609
|
+
value: value || [],
|
|
24610
|
+
onChange,
|
|
24611
|
+
readOnly,
|
|
24612
|
+
...fieldOptions
|
|
24613
|
+
}
|
|
24614
|
+
) }) })
|
|
24615
|
+
};
|
|
24616
|
+
};
|
|
24617
|
+
var CmsCollectionField = ({
|
|
24618
|
+
value,
|
|
24619
|
+
onChange,
|
|
24620
|
+
readOnly,
|
|
24621
|
+
defaultLimit = 10,
|
|
24622
|
+
showLimit = true,
|
|
24623
|
+
showSort = true,
|
|
24624
|
+
slots
|
|
24625
|
+
}) => {
|
|
24626
|
+
const { apiClient } = useTecof();
|
|
24627
|
+
const [collections, setCollections] = React__default.useState([]);
|
|
24628
|
+
const [loading, setLoading] = React__default.useState(true);
|
|
24629
|
+
const [error2, setError] = React__default.useState(null);
|
|
24630
|
+
const [dropdownOpen, setDropdownOpen] = React__default.useState(false);
|
|
24631
|
+
const [searchQuery, setSearchQuery] = React__default.useState("");
|
|
24632
|
+
const dropdownRef = React__default.useRef(null);
|
|
24633
|
+
const onChangeRef = React__default.useRef(onChange);
|
|
24634
|
+
onChangeRef.current = onChange;
|
|
24635
|
+
const fetchCollections = React__default.useCallback(async () => {
|
|
24636
|
+
setLoading(true);
|
|
24637
|
+
setError(null);
|
|
24638
|
+
try {
|
|
24639
|
+
const res2 = await apiClient.getCmsCollections();
|
|
24640
|
+
if (res2.success && Array.isArray(res2.data)) {
|
|
24641
|
+
setCollections(res2.data);
|
|
24642
|
+
} else {
|
|
24643
|
+
setError(res2.message || "Koleksiyonlar y\xFCklenemedi");
|
|
24644
|
+
}
|
|
24645
|
+
} catch (err) {
|
|
24646
|
+
setError(err.message || "Ba\u011Flant\u0131 hatas\u0131");
|
|
24647
|
+
} finally {
|
|
24648
|
+
setLoading(false);
|
|
24649
|
+
}
|
|
24650
|
+
}, [apiClient]);
|
|
24651
|
+
React__default.useEffect(() => {
|
|
24652
|
+
fetchCollections();
|
|
24653
|
+
}, [fetchCollections]);
|
|
24654
|
+
React__default.useEffect(() => {
|
|
24655
|
+
if (!dropdownOpen) return;
|
|
24656
|
+
const handleClick = (e3) => {
|
|
24657
|
+
if (dropdownRef.current && !dropdownRef.current.contains(e3.target)) {
|
|
24658
|
+
setDropdownOpen(false);
|
|
24659
|
+
}
|
|
24660
|
+
};
|
|
24661
|
+
document.addEventListener("mousedown", handleClick);
|
|
24662
|
+
return () => document.removeEventListener("mousedown", handleClick);
|
|
24663
|
+
}, [dropdownOpen]);
|
|
24664
|
+
const selectedCollection = React__default.useMemo(() => {
|
|
24665
|
+
if (!value?.collectionSlug) return null;
|
|
24666
|
+
return collections.find((c2) => c2.slug === value.collectionSlug) || null;
|
|
24667
|
+
}, [value?.collectionSlug, collections]);
|
|
24668
|
+
const collectionFields = React__default.useMemo(() => {
|
|
24669
|
+
return selectedCollection?.fields || [];
|
|
24670
|
+
}, [selectedCollection]);
|
|
24671
|
+
const handleSelect = React__default.useCallback((col) => {
|
|
24672
|
+
onChangeRef.current({
|
|
24673
|
+
collectionSlug: col.slug,
|
|
24674
|
+
collectionName: col.name,
|
|
24675
|
+
limit: value?.limit || defaultLimit,
|
|
24676
|
+
sort: value?.sort || "newest",
|
|
24677
|
+
fieldMap: value?.fieldMap || {}
|
|
24678
|
+
});
|
|
24679
|
+
setDropdownOpen(false);
|
|
24680
|
+
setSearchQuery("");
|
|
24681
|
+
}, [value, defaultLimit]);
|
|
24682
|
+
const handleClear = React__default.useCallback(() => {
|
|
24683
|
+
onChangeRef.current(null);
|
|
24684
|
+
}, []);
|
|
24685
|
+
const handleLimitChange = React__default.useCallback((e3) => {
|
|
24686
|
+
const num = parseInt(e3.target.value, 10);
|
|
24687
|
+
if (!value) return;
|
|
24688
|
+
onChangeRef.current({
|
|
24689
|
+
...value,
|
|
24690
|
+
limit: isNaN(num) ? defaultLimit : Math.max(1, Math.min(100, num))
|
|
24691
|
+
});
|
|
24692
|
+
}, [value, defaultLimit]);
|
|
24693
|
+
const handleSortChange = React__default.useCallback((sort) => {
|
|
24694
|
+
if (!value) return;
|
|
24695
|
+
onChangeRef.current({ ...value, sort });
|
|
24696
|
+
}, [value]);
|
|
24697
|
+
const handleFieldMapChange = React__default.useCallback((slotKey, fieldShortcode) => {
|
|
24698
|
+
if (!value) return;
|
|
24699
|
+
onChangeRef.current({
|
|
24700
|
+
...value,
|
|
24701
|
+
fieldMap: {
|
|
24702
|
+
...value.fieldMap,
|
|
24703
|
+
[slotKey]: fieldShortcode
|
|
24704
|
+
}
|
|
24705
|
+
});
|
|
24706
|
+
}, [value]);
|
|
24707
|
+
const filteredCollections = React__default.useMemo(() => {
|
|
24708
|
+
if (!searchQuery.trim()) return collections;
|
|
24709
|
+
const q = searchQuery.toLowerCase();
|
|
24710
|
+
return collections.filter(
|
|
24711
|
+
(c2) => c2.name.toLowerCase().includes(q) || c2.slug.toLowerCase().includes(q)
|
|
24712
|
+
);
|
|
24713
|
+
}, [collections, searchQuery]);
|
|
24714
|
+
if (loading) {
|
|
24715
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-loading", children: [
|
|
24716
|
+
/* @__PURE__ */ jsxRuntime.jsx(LoaderCircle, { size: 16, className: "tecof-spin" }),
|
|
24717
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Koleksiyonlar y\xFCkleniyor\u2026" })
|
|
24718
|
+
] });
|
|
24719
|
+
}
|
|
24720
|
+
if (error2) {
|
|
24721
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-error", children: [
|
|
24722
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: error2 }),
|
|
24723
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "tecof-cms-col-retry", onClick: fetchCollections, children: [
|
|
24724
|
+
/* @__PURE__ */ jsxRuntime.jsx(RefreshCw, { size: 12 }),
|
|
24725
|
+
" Tekrar Dene"
|
|
24726
|
+
] })
|
|
24727
|
+
] });
|
|
24728
|
+
}
|
|
24729
|
+
const hasSlots = slots && Object.keys(slots).length > 0;
|
|
24730
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-container", children: [
|
|
24731
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-selector", ref: dropdownRef, children: [
|
|
24732
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
24733
|
+
"button",
|
|
24734
|
+
{
|
|
24735
|
+
type: "button",
|
|
24736
|
+
className: `tecof-cms-col-trigger ${dropdownOpen ? "open" : ""}`,
|
|
24737
|
+
onClick: () => !readOnly && setDropdownOpen(!dropdownOpen),
|
|
24738
|
+
disabled: readOnly,
|
|
24739
|
+
children: [
|
|
24740
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-trigger-left", children: [
|
|
24741
|
+
/* @__PURE__ */ jsxRuntime.jsx(Database, { size: 14 }),
|
|
24742
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: value?.collectionName || value?.collectionSlug || "Koleksiyon Se\xE7in" })
|
|
24743
|
+
] }),
|
|
24744
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-trigger-right", children: [
|
|
24745
|
+
value && !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
24746
|
+
"button",
|
|
24747
|
+
{
|
|
24748
|
+
type: "button",
|
|
24749
|
+
className: "tecof-cms-col-clear",
|
|
24750
|
+
onClick: (e3) => {
|
|
24751
|
+
e3.stopPropagation();
|
|
24752
|
+
handleClear();
|
|
24753
|
+
},
|
|
24754
|
+
title: "Temizle",
|
|
24755
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(X, { size: 12 })
|
|
24756
|
+
}
|
|
24757
|
+
),
|
|
24758
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24759
|
+
ChevronDown,
|
|
24760
|
+
{
|
|
24761
|
+
size: 14,
|
|
24762
|
+
className: `tecof-cms-col-chevron ${dropdownOpen ? "rotated" : ""}`
|
|
24763
|
+
}
|
|
24764
|
+
)
|
|
24765
|
+
] })
|
|
24766
|
+
]
|
|
24767
|
+
}
|
|
24768
|
+
),
|
|
24769
|
+
dropdownOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-dropdown", children: [
|
|
24770
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-search", children: [
|
|
24771
|
+
/* @__PURE__ */ jsxRuntime.jsx(Search, { size: 13 }),
|
|
24772
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24773
|
+
"input",
|
|
24774
|
+
{
|
|
24775
|
+
type: "text",
|
|
24776
|
+
value: searchQuery,
|
|
24777
|
+
onChange: (e3) => setSearchQuery(e3.target.value),
|
|
24778
|
+
placeholder: "Koleksiyon ara\u2026",
|
|
24779
|
+
className: "tecof-cms-col-search-input",
|
|
24780
|
+
autoFocus: true
|
|
24781
|
+
}
|
|
24782
|
+
)
|
|
24783
|
+
] }),
|
|
24784
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-cms-col-options", children: filteredCollections.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-cms-col-empty", children: "Koleksiyon bulunamad\u0131" }) : filteredCollections.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24785
|
+
"button",
|
|
24786
|
+
{
|
|
24787
|
+
type: "button",
|
|
24788
|
+
className: `tecof-cms-col-option ${value?.collectionSlug === col.slug ? "selected" : ""}`,
|
|
24789
|
+
onClick: () => handleSelect(col),
|
|
24790
|
+
children: [
|
|
24791
|
+
/* @__PURE__ */ jsxRuntime.jsx(Database, { size: 13 }),
|
|
24792
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-option-info", children: [
|
|
24793
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "tecof-cms-col-option-name", children: col.name }),
|
|
24794
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "tecof-cms-col-option-slug", children: col.slug })
|
|
24795
|
+
] })
|
|
24796
|
+
]
|
|
24797
|
+
},
|
|
24798
|
+
col._id
|
|
24799
|
+
)) })
|
|
24800
|
+
] })
|
|
24801
|
+
] }),
|
|
24802
|
+
value?.collectionSlug && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-settings", children: [
|
|
24803
|
+
showLimit && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-setting", children: [
|
|
24804
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "tecof-cms-col-setting-label", children: "Limit" }),
|
|
24805
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24806
|
+
"input",
|
|
24807
|
+
{
|
|
24808
|
+
type: "number",
|
|
24809
|
+
min: 1,
|
|
24810
|
+
max: 100,
|
|
24811
|
+
value: value.limit || defaultLimit,
|
|
24812
|
+
onChange: handleLimitChange,
|
|
24813
|
+
className: "tecof-cms-col-setting-input",
|
|
24814
|
+
disabled: readOnly
|
|
24815
|
+
}
|
|
24816
|
+
)
|
|
24817
|
+
] }),
|
|
24818
|
+
showSort && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-setting", children: [
|
|
24819
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "tecof-cms-col-setting-label", children: "S\u0131ralama" }),
|
|
24820
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-sort-btns", children: [
|
|
24821
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24822
|
+
"button",
|
|
24823
|
+
{
|
|
24824
|
+
type: "button",
|
|
24825
|
+
className: `tecof-cms-col-sort-btn ${(value.sort || "newest") === "newest" ? "active" : ""}`,
|
|
24826
|
+
onClick: () => handleSortChange("newest"),
|
|
24827
|
+
disabled: readOnly,
|
|
24828
|
+
children: "Yeni\u2192Eski"
|
|
24829
|
+
}
|
|
24830
|
+
),
|
|
24831
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24832
|
+
"button",
|
|
24833
|
+
{
|
|
24834
|
+
type: "button",
|
|
24835
|
+
className: `tecof-cms-col-sort-btn ${value.sort === "oldest" ? "active" : ""}`,
|
|
24836
|
+
onClick: () => handleSortChange("oldest"),
|
|
24837
|
+
disabled: readOnly,
|
|
24838
|
+
children: "Eski\u2192Yeni"
|
|
24839
|
+
}
|
|
24840
|
+
)
|
|
24841
|
+
] })
|
|
24842
|
+
] })
|
|
24843
|
+
] }),
|
|
24844
|
+
value?.collectionSlug && hasSlots && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-mapping", children: [
|
|
24845
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-mapping-header", children: [
|
|
24846
|
+
/* @__PURE__ */ jsxRuntime.jsx(Link2, { size: 12 }),
|
|
24847
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Alan E\u015Fle\u015Ftirme" })
|
|
24848
|
+
] }),
|
|
24849
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-cms-col-mapping-rows", children: Object.entries(slots).map(([slotKey, slotDef]) => {
|
|
24850
|
+
const currentMapping = value.fieldMap?.[slotKey] || "";
|
|
24851
|
+
const availableFields = slotDef.fieldTypes ? collectionFields.filter((f2) => slotDef.fieldTypes.includes(f2.type)) : collectionFields;
|
|
24852
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-mapping-row", children: [
|
|
24853
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "tecof-cms-col-mapping-label", children: slotDef.label }),
|
|
24854
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
24855
|
+
"select",
|
|
24856
|
+
{
|
|
24857
|
+
className: "tecof-cms-col-mapping-select",
|
|
24858
|
+
value: currentMapping,
|
|
24859
|
+
onChange: (e3) => handleFieldMapChange(slotKey, e3.target.value),
|
|
24860
|
+
disabled: readOnly,
|
|
24861
|
+
children: [
|
|
24862
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "\u2014 Se\xE7in \u2014" }),
|
|
24863
|
+
availableFields.map((f2) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: f2.shortcode, children: [
|
|
24864
|
+
f2.name,
|
|
24865
|
+
" (",
|
|
24866
|
+
f2.shortcode,
|
|
24867
|
+
")"
|
|
24868
|
+
] }, f2.shortcode))
|
|
24869
|
+
]
|
|
24870
|
+
}
|
|
24871
|
+
)
|
|
24872
|
+
] }, slotKey);
|
|
24873
|
+
}) })
|
|
24874
|
+
] }),
|
|
24875
|
+
selectedCollection && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-cms-col-badge", children: [
|
|
24876
|
+
/* @__PURE__ */ jsxRuntime.jsx(Database, { size: 11 }),
|
|
24877
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: selectedCollection.name }),
|
|
24878
|
+
selectedCollection.fields && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "tecof-cms-col-badge-count", children: [
|
|
24879
|
+
selectedCollection.fields.length,
|
|
24880
|
+
" alan"
|
|
24881
|
+
] })
|
|
24882
|
+
] })
|
|
24883
|
+
] });
|
|
24884
|
+
};
|
|
24885
|
+
CmsCollectionField.displayName = "CmsCollectionField";
|
|
24886
|
+
var createCmsCollectionField = (options = {}) => {
|
|
24887
|
+
const { label, labelIcon, visible, ...fieldOptions } = options;
|
|
24888
|
+
return {
|
|
24889
|
+
type: "custom",
|
|
24890
|
+
_fieldType: "cmsCollection",
|
|
24891
|
+
label,
|
|
24892
|
+
labelIcon,
|
|
24893
|
+
visible,
|
|
24894
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(core.FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24895
|
+
CmsCollectionField,
|
|
24896
|
+
{
|
|
24897
|
+
field,
|
|
24898
|
+
name: name3,
|
|
24899
|
+
id,
|
|
24900
|
+
value: value || null,
|
|
24901
|
+
onChange,
|
|
24902
|
+
readOnly,
|
|
24903
|
+
...fieldOptions
|
|
24904
|
+
}
|
|
24905
|
+
) }) })
|
|
24906
|
+
};
|
|
24907
|
+
};
|
|
24218
24908
|
|
|
24219
24909
|
// src/utils/index.ts
|
|
24220
24910
|
function hexToHsl(hex) {
|
|
@@ -24374,21 +25064,27 @@ lucide-react/dist/esm/context.js:
|
|
|
24374
25064
|
lucide-react/dist/esm/Icon.js:
|
|
24375
25065
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
24376
25066
|
lucide-react/dist/esm/icons/check.js:
|
|
25067
|
+
lucide-react/dist/esm/icons/chevron-down.js:
|
|
24377
25068
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
24378
25069
|
lucide-react/dist/esm/icons/code.js:
|
|
24379
25070
|
lucide-react/dist/esm/icons/copy.js:
|
|
25071
|
+
lucide-react/dist/esm/icons/database.js:
|
|
24380
25072
|
lucide-react/dist/esm/icons/external-link.js:
|
|
24381
25073
|
lucide-react/dist/esm/icons/file-text.js:
|
|
24382
25074
|
lucide-react/dist/esm/icons/file.js:
|
|
24383
25075
|
lucide-react/dist/esm/icons/folder-open.js:
|
|
24384
25076
|
lucide-react/dist/esm/icons/globe.js:
|
|
25077
|
+
lucide-react/dist/esm/icons/grip-vertical.js:
|
|
24385
25078
|
lucide-react/dist/esm/icons/image-plus.js:
|
|
24386
25079
|
lucide-react/dist/esm/icons/image.js:
|
|
24387
25080
|
lucide-react/dist/esm/icons/languages.js:
|
|
25081
|
+
lucide-react/dist/esm/icons/link-2.js:
|
|
24388
25082
|
lucide-react/dist/esm/icons/link.js:
|
|
24389
25083
|
lucide-react/dist/esm/icons/loader-circle.js:
|
|
24390
25084
|
lucide-react/dist/esm/icons/pencil.js:
|
|
25085
|
+
lucide-react/dist/esm/icons/plus.js:
|
|
24391
25086
|
lucide-react/dist/esm/icons/refresh-ccw.js:
|
|
25087
|
+
lucide-react/dist/esm/icons/refresh-cw.js:
|
|
24392
25088
|
lucide-react/dist/esm/icons/rotate-ccw.js:
|
|
24393
25089
|
lucide-react/dist/esm/icons/search.js:
|
|
24394
25090
|
lucide-react/dist/esm/icons/trash-2.js:
|
|
@@ -24477,23 +25173,27 @@ filepond-plugin-image-edit/dist/filepond-plugin-image-edit.esm.js:
|
|
|
24477
25173
|
*)
|
|
24478
25174
|
*/
|
|
24479
25175
|
|
|
25176
|
+
exports.CmsCollectionField = CmsCollectionField;
|
|
24480
25177
|
exports.CodeEditorField = CodeEditorField;
|
|
24481
25178
|
exports.ColorField = ColorField;
|
|
24482
25179
|
exports.EditorField = EditorField;
|
|
24483
25180
|
exports.FieldErrorBoundary = FieldErrorBoundary;
|
|
24484
25181
|
exports.LanguageField = LanguageField;
|
|
24485
25182
|
exports.LinkField = LinkField;
|
|
25183
|
+
exports.RepeaterField = RepeaterField;
|
|
24486
25184
|
exports.TecofApiClient = TecofApiClient;
|
|
24487
25185
|
exports.TecofEditor = TecofEditor;
|
|
24488
25186
|
exports.TecofPicture = TecofPicture;
|
|
24489
25187
|
exports.TecofProvider = TecofProvider;
|
|
24490
25188
|
exports.TecofRender = TecofRender;
|
|
24491
25189
|
exports.UploadField = UploadField;
|
|
25190
|
+
exports.createCmsCollectionField = createCmsCollectionField;
|
|
24492
25191
|
exports.createCodeEditorField = createCodeEditorField;
|
|
24493
25192
|
exports.createColorField = createColorField;
|
|
24494
25193
|
exports.createEditorField = createEditorField;
|
|
24495
25194
|
exports.createLanguageField = createLanguageField;
|
|
24496
25195
|
exports.createLinkField = createLinkField;
|
|
25196
|
+
exports.createRepeaterField = createRepeaterField;
|
|
24497
25197
|
exports.createUploadField = createUploadField;
|
|
24498
25198
|
exports.darken = darken;
|
|
24499
25199
|
exports.generateCSSVariables = generateCSSVariables;
|