@tecof/theme-editor 0.0.34 → 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.d.mts +8 -23
- package/dist/index.d.ts +8 -23
- package/dist/index.js +1461 -364
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1453 -357
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var React__default = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var
|
|
5
|
+
var zustand = require('zustand');
|
|
6
|
+
var immer = require('zustand/middleware/immer');
|
|
7
|
+
var nanoid = require('nanoid');
|
|
8
|
+
var ReactDOM = require('react-dom');
|
|
6
9
|
var react = require('@tiptap/react');
|
|
7
10
|
var Document = require('@tiptap/extension-document');
|
|
8
11
|
var Paragraph = require('@tiptap/extension-paragraph');
|
|
@@ -21,7 +24,6 @@ var Link3 = require('@tiptap/extension-link');
|
|
|
21
24
|
var Code2 = require('@tiptap/extension-code');
|
|
22
25
|
var CodeBlock = require('@tiptap/extension-code-block');
|
|
23
26
|
var Image3 = require('@tiptap/extension-image');
|
|
24
|
-
var ReactDOM = require('react-dom');
|
|
25
27
|
|
|
26
28
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
29
|
|
|
@@ -44,6 +46,7 @@ function _interopNamespace(e) {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
var React__default__namespace = /*#__PURE__*/_interopNamespace(React__default);
|
|
49
|
+
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
47
50
|
var Document__default = /*#__PURE__*/_interopDefault(Document);
|
|
48
51
|
var Paragraph__default = /*#__PURE__*/_interopDefault(Paragraph);
|
|
49
52
|
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
@@ -60,7 +63,6 @@ var Link3__default = /*#__PURE__*/_interopDefault(Link3);
|
|
|
60
63
|
var Code2__default = /*#__PURE__*/_interopDefault(Code2);
|
|
61
64
|
var CodeBlock__default = /*#__PURE__*/_interopDefault(CodeBlock);
|
|
62
65
|
var Image3__default = /*#__PURE__*/_interopDefault(Image3);
|
|
63
|
-
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
64
66
|
|
|
65
67
|
// src/components/TecofProvider.tsx
|
|
66
68
|
|
|
@@ -334,6 +336,494 @@ function useTecof() {
|
|
|
334
336
|
return ctx;
|
|
335
337
|
}
|
|
336
338
|
|
|
339
|
+
// src/engine/document.ts
|
|
340
|
+
var EMPTY_DOCUMENT = {
|
|
341
|
+
root: { props: {} },
|
|
342
|
+
content: [],
|
|
343
|
+
zones: {}
|
|
344
|
+
};
|
|
345
|
+
var parseDocument = (rawData) => {
|
|
346
|
+
if (!rawData) return { ...EMPTY_DOCUMENT };
|
|
347
|
+
return {
|
|
348
|
+
root: rawData.root || { props: {} },
|
|
349
|
+
content: rawData.content || [],
|
|
350
|
+
zones: rawData.zones || {}
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
var serializeDocument = (doc) => {
|
|
354
|
+
return {
|
|
355
|
+
root: doc.root,
|
|
356
|
+
content: doc.content,
|
|
357
|
+
zones: doc.zones
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
// src/engine/zones.ts
|
|
362
|
+
var parseZoneKey = (zoneKey) => {
|
|
363
|
+
const parts = zoneKey.split(":");
|
|
364
|
+
return {
|
|
365
|
+
parentId: parts[0],
|
|
366
|
+
slotName: parts[1] || "default"
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
var findNodeById = (doc, id) => {
|
|
370
|
+
for (let i2 = 0; i2 < doc.content.length; i2++) {
|
|
371
|
+
if (doc.content[i2].props.id === id) {
|
|
372
|
+
return { node: doc.content[i2], path: { index: i2 } };
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
for (const [zoneKey, items] of Object.entries(doc.zones)) {
|
|
376
|
+
for (let i2 = 0; i2 < items.length; i2++) {
|
|
377
|
+
if (items[i2].props.id === id) {
|
|
378
|
+
return { node: items[i2], path: { zoneKey, index: i2 } };
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return null;
|
|
383
|
+
};
|
|
384
|
+
var getDescendantZoneKeys = (zones, nodeId, acc = []) => {
|
|
385
|
+
const prefix = `${nodeId}:`;
|
|
386
|
+
for (const zoneKey of Object.keys(zones)) {
|
|
387
|
+
if (zoneKey.startsWith(prefix)) {
|
|
388
|
+
acc.push(zoneKey);
|
|
389
|
+
for (const child of zones[zoneKey]) {
|
|
390
|
+
getDescendantZoneKeys(zones, child.props.id, acc);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return acc;
|
|
395
|
+
};
|
|
396
|
+
var getParentId = (doc, id) => {
|
|
397
|
+
const res2 = findNodeById(doc, id);
|
|
398
|
+
if (!res2 || !res2.path.zoneKey) return null;
|
|
399
|
+
return parseZoneKey(res2.path.zoneKey).parentId;
|
|
400
|
+
};
|
|
401
|
+
var getBreadcrumbs = (doc, id) => {
|
|
402
|
+
const crumbs = [];
|
|
403
|
+
let currentId = id;
|
|
404
|
+
while (currentId) {
|
|
405
|
+
const res2 = findNodeById(doc, currentId);
|
|
406
|
+
if (!res2) break;
|
|
407
|
+
crumbs.unshift({ id: currentId, type: res2.node.type });
|
|
408
|
+
currentId = res2.path.zoneKey ? parseZoneKey(res2.path.zoneKey).parentId : null;
|
|
409
|
+
}
|
|
410
|
+
return crumbs;
|
|
411
|
+
};
|
|
412
|
+
var generateId = () => nanoid.nanoid(8);
|
|
413
|
+
var remapNodeIds = (node, sourceZones, idMap = /* @__PURE__ */ new Map()) => {
|
|
414
|
+
const oldId = node.props.id;
|
|
415
|
+
const newId = generateId();
|
|
416
|
+
idMap.set(oldId, newId);
|
|
417
|
+
const remappedNode = {
|
|
418
|
+
...node,
|
|
419
|
+
props: {
|
|
420
|
+
...node.props,
|
|
421
|
+
id: newId
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
const newZones = {};
|
|
425
|
+
const prefix = `${oldId}:`;
|
|
426
|
+
for (const [zoneKey, zoneItems] of Object.entries(sourceZones)) {
|
|
427
|
+
if (zoneKey.startsWith(prefix)) {
|
|
428
|
+
const slotName = zoneKey.split(":")[1];
|
|
429
|
+
const newZoneKey = `${newId}:${slotName}`;
|
|
430
|
+
const newZoneItems = [];
|
|
431
|
+
for (const item2 of zoneItems) {
|
|
432
|
+
const { remappedNode: childNode, newZones: childZones } = remapNodeIds(item2, sourceZones, idMap);
|
|
433
|
+
newZoneItems.push(childNode);
|
|
434
|
+
Object.assign(newZones, childZones);
|
|
435
|
+
}
|
|
436
|
+
newZones[newZoneKey] = newZoneItems;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return { remappedNode, newZones };
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
// src/engine/operations.ts
|
|
443
|
+
var insertNode = (draft, node, targetZoneKey, index2) => {
|
|
444
|
+
if (!node.props.id) {
|
|
445
|
+
node.props.id = generateId();
|
|
446
|
+
}
|
|
447
|
+
let list3 = targetZoneKey ? draft.zones[targetZoneKey] : draft.content;
|
|
448
|
+
if (!list3) {
|
|
449
|
+
list3 = [];
|
|
450
|
+
if (targetZoneKey) {
|
|
451
|
+
draft.zones[targetZoneKey] = list3;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
const insertIndex = typeof index2 === "number" ? index2 : list3.length;
|
|
455
|
+
list3.splice(insertIndex, 0, node);
|
|
456
|
+
};
|
|
457
|
+
var removeNode = (draft, id) => {
|
|
458
|
+
const result = findNodeById(draft, id);
|
|
459
|
+
if (!result) return;
|
|
460
|
+
const { path } = result;
|
|
461
|
+
const list3 = path.zoneKey ? draft.zones[path.zoneKey] : draft.content;
|
|
462
|
+
if (list3) {
|
|
463
|
+
list3.splice(path.index, 1);
|
|
464
|
+
}
|
|
465
|
+
const descendantZoneKeys = getDescendantZoneKeys(draft.zones, id);
|
|
466
|
+
for (const zoneKey of descendantZoneKeys) {
|
|
467
|
+
delete draft.zones[zoneKey];
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
var moveNode = (draft, id, targetZoneKey, targetIndex) => {
|
|
471
|
+
const result = findNodeById(draft, id);
|
|
472
|
+
if (!result) return;
|
|
473
|
+
const { node, path: sourcePath } = result;
|
|
474
|
+
const sourceList = sourcePath.zoneKey ? draft.zones[sourcePath.zoneKey] : draft.content;
|
|
475
|
+
let targetList = targetZoneKey ? draft.zones[targetZoneKey] : draft.content;
|
|
476
|
+
if (!targetList && targetZoneKey) {
|
|
477
|
+
targetList = [];
|
|
478
|
+
draft.zones[targetZoneKey] = targetList;
|
|
479
|
+
}
|
|
480
|
+
if (!sourceList || !targetList) return;
|
|
481
|
+
sourceList.splice(sourcePath.index, 1);
|
|
482
|
+
let finalIndex = targetIndex ?? targetList.length;
|
|
483
|
+
if (sourcePath.zoneKey === targetZoneKey && sourcePath.index < finalIndex) {
|
|
484
|
+
finalIndex -= 1;
|
|
485
|
+
}
|
|
486
|
+
targetList.splice(finalIndex, 0, node);
|
|
487
|
+
};
|
|
488
|
+
var duplicateNode = (draft, id) => {
|
|
489
|
+
const result = findNodeById(draft, id);
|
|
490
|
+
if (!result) return;
|
|
491
|
+
const { node, path } = result;
|
|
492
|
+
const { remappedNode, newZones } = remapNodeIds(node, draft.zones);
|
|
493
|
+
const targetList = path.zoneKey ? draft.zones[path.zoneKey] : draft.content;
|
|
494
|
+
if (targetList) {
|
|
495
|
+
targetList.splice(path.index + 1, 0, remappedNode);
|
|
496
|
+
}
|
|
497
|
+
Object.assign(draft.zones, newZones);
|
|
498
|
+
};
|
|
499
|
+
var updateProps = (draft, id, patch) => {
|
|
500
|
+
const result = findNodeById(draft, id);
|
|
501
|
+
if (!result) return;
|
|
502
|
+
Object.assign(result.node.props, patch);
|
|
503
|
+
};
|
|
504
|
+
var setRootProps = (draft, patch) => {
|
|
505
|
+
Object.assign(draft.root.props, patch);
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
// src/engine/store.ts
|
|
509
|
+
var pushToHistory = (state3) => {
|
|
510
|
+
state3.history.past.push(JSON.parse(JSON.stringify(state3.document)));
|
|
511
|
+
state3.history.future = [];
|
|
512
|
+
};
|
|
513
|
+
var useEditorStore = zustand.create()(
|
|
514
|
+
immer.immer((set2) => ({
|
|
515
|
+
// Initial State
|
|
516
|
+
document: { ...EMPTY_DOCUMENT },
|
|
517
|
+
history: {
|
|
518
|
+
past: [],
|
|
519
|
+
future: []
|
|
520
|
+
},
|
|
521
|
+
selection: {
|
|
522
|
+
selectedId: null,
|
|
523
|
+
hoveredId: null
|
|
524
|
+
},
|
|
525
|
+
viewport: "desktop",
|
|
526
|
+
// Actions
|
|
527
|
+
setDocument: (doc) => set2((state3) => {
|
|
528
|
+
state3.document = doc;
|
|
529
|
+
state3.history = { past: [], future: [] };
|
|
530
|
+
state3.selection = { selectedId: null, hoveredId: null };
|
|
531
|
+
}),
|
|
532
|
+
selectNode: (id) => set2((state3) => {
|
|
533
|
+
state3.selection.selectedId = id;
|
|
534
|
+
}),
|
|
535
|
+
hoverNode: (id) => set2((state3) => {
|
|
536
|
+
state3.selection.hoveredId = id;
|
|
537
|
+
}),
|
|
538
|
+
setViewport: (viewport) => set2((state3) => {
|
|
539
|
+
state3.viewport = viewport;
|
|
540
|
+
}),
|
|
541
|
+
insertNode: (node, targetZoneKey, index2) => set2((state3) => {
|
|
542
|
+
pushToHistory(state3);
|
|
543
|
+
insertNode(state3.document, node, targetZoneKey, index2);
|
|
544
|
+
}),
|
|
545
|
+
removeNode: (id) => set2((state3) => {
|
|
546
|
+
pushToHistory(state3);
|
|
547
|
+
removeNode(state3.document, id);
|
|
548
|
+
if (state3.selection.selectedId === id) {
|
|
549
|
+
state3.selection.selectedId = null;
|
|
550
|
+
}
|
|
551
|
+
}),
|
|
552
|
+
moveNode: (id, targetZoneKey, index2) => set2((state3) => {
|
|
553
|
+
pushToHistory(state3);
|
|
554
|
+
moveNode(state3.document, id, targetZoneKey, index2);
|
|
555
|
+
}),
|
|
556
|
+
duplicateNode: (id) => set2((state3) => {
|
|
557
|
+
pushToHistory(state3);
|
|
558
|
+
duplicateNode(state3.document, id);
|
|
559
|
+
}),
|
|
560
|
+
updateProps: (id, patch) => set2((state3) => {
|
|
561
|
+
pushToHistory(state3);
|
|
562
|
+
updateProps(state3.document, id, patch);
|
|
563
|
+
}),
|
|
564
|
+
setRootProps: (patch) => set2((state3) => {
|
|
565
|
+
pushToHistory(state3);
|
|
566
|
+
setRootProps(state3.document, patch);
|
|
567
|
+
}),
|
|
568
|
+
undo: () => set2((state3) => {
|
|
569
|
+
if (state3.history.past.length === 0) return;
|
|
570
|
+
const previous = state3.history.past.pop();
|
|
571
|
+
state3.history.future.push(JSON.parse(JSON.stringify(state3.document)));
|
|
572
|
+
state3.document = previous;
|
|
573
|
+
}),
|
|
574
|
+
redo: () => set2((state3) => {
|
|
575
|
+
if (state3.history.future.length === 0) return;
|
|
576
|
+
const next = state3.history.future.pop();
|
|
577
|
+
state3.history.past.push(JSON.parse(JSON.stringify(state3.document)));
|
|
578
|
+
state3.document = next;
|
|
579
|
+
})
|
|
580
|
+
}))
|
|
581
|
+
);
|
|
582
|
+
var StudioContext = React__default.createContext(null);
|
|
583
|
+
var useStudio = () => {
|
|
584
|
+
const ctx = React__default.useContext(StudioContext);
|
|
585
|
+
if (!ctx) {
|
|
586
|
+
throw new Error("useStudio must be used within a StudioProvider");
|
|
587
|
+
}
|
|
588
|
+
return ctx;
|
|
589
|
+
};
|
|
590
|
+
var ParentNodeContext = React__default.createContext(null);
|
|
591
|
+
var DropZone = ({ zone, className, style }) => {
|
|
592
|
+
const parentId = React__default.useContext(ParentNodeContext);
|
|
593
|
+
const zoneKey = parentId ? `${parentId}:${zone}` : zone;
|
|
594
|
+
const items = useEditorStore((state3) => state3.document.zones[zoneKey] || []);
|
|
595
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
596
|
+
"div",
|
|
597
|
+
{
|
|
598
|
+
className: `tecof-dropzone ${className || ""}`,
|
|
599
|
+
style: { minHeight: items.length === 0 ? "40px" : void 0, ...style },
|
|
600
|
+
"data-tecof-zone": zoneKey,
|
|
601
|
+
children: items.map((item2, index2) => /* @__PURE__ */ jsxRuntime.jsx(NodeRenderer, { node: item2, index: index2, zoneKey }, item2.props.id))
|
|
602
|
+
}
|
|
603
|
+
);
|
|
604
|
+
};
|
|
605
|
+
var renderDropZone = ({ zone, className, style }) => {
|
|
606
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropZone, { zone, className, style });
|
|
607
|
+
};
|
|
608
|
+
var NodeRenderer = ({ node, index: index2, zoneKey }) => {
|
|
609
|
+
const { config: config3, metadata, readOnly } = useStudio();
|
|
610
|
+
const componentConfig = config3.components[node.type];
|
|
611
|
+
const selectNode = useEditorStore((state3) => state3.selectNode);
|
|
612
|
+
const hoverNode = useEditorStore((state3) => state3.hoverNode);
|
|
613
|
+
const hoveredId = useEditorStore((state3) => state3.selection.hoveredId);
|
|
614
|
+
const handleMouseEnter = React__default.useCallback(
|
|
615
|
+
(e3) => {
|
|
616
|
+
if (readOnly) return;
|
|
617
|
+
e3.stopPropagation();
|
|
618
|
+
hoverNode(node.props.id);
|
|
619
|
+
},
|
|
620
|
+
[hoverNode, node.props.id, readOnly]
|
|
621
|
+
);
|
|
622
|
+
const handleMouseLeave = React__default.useCallback(
|
|
623
|
+
(e3) => {
|
|
624
|
+
if (readOnly) return;
|
|
625
|
+
e3.stopPropagation();
|
|
626
|
+
if (hoveredId === node.props.id) {
|
|
627
|
+
hoverNode(null);
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
[hoverNode, node.props.id, hoveredId, readOnly]
|
|
631
|
+
);
|
|
632
|
+
const handleClick = React__default.useCallback(
|
|
633
|
+
(e3) => {
|
|
634
|
+
if (readOnly) return;
|
|
635
|
+
e3.stopPropagation();
|
|
636
|
+
selectNode(node.props.id);
|
|
637
|
+
const isEmbedded = typeof window !== "undefined" && window.parent !== window;
|
|
638
|
+
if (isEmbedded) {
|
|
639
|
+
window.parent.postMessage(
|
|
640
|
+
{
|
|
641
|
+
type: "puck:itemSelected",
|
|
642
|
+
item: {
|
|
643
|
+
type: node.type,
|
|
644
|
+
id: node.props.id
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
"*"
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
[selectNode, node.props.id, node.type, readOnly]
|
|
652
|
+
);
|
|
653
|
+
if (!componentConfig) {
|
|
654
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "12px", background: "#fee2e2", color: "#991b1b", fontSize: "12px", borderRadius: "4px" }, children: [
|
|
655
|
+
"Bile\u015Fen bulunamad\u0131: ",
|
|
656
|
+
node.type
|
|
657
|
+
] });
|
|
658
|
+
}
|
|
659
|
+
const componentProps = {
|
|
660
|
+
...node.props,
|
|
661
|
+
puck: {
|
|
662
|
+
renderDropZone,
|
|
663
|
+
isEditing: !readOnly,
|
|
664
|
+
metadata: {
|
|
665
|
+
...metadata || {},
|
|
666
|
+
...componentConfig.metadata || {}
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
editMode: !readOnly
|
|
670
|
+
};
|
|
671
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ParentNodeContext.Provider, { value: node.props.id, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
672
|
+
"div",
|
|
673
|
+
{
|
|
674
|
+
className: "tecof-node-wrapper",
|
|
675
|
+
"data-tecof-id": node.props.id,
|
|
676
|
+
"data-tecof-type": node.type,
|
|
677
|
+
"data-tecof-index": index2,
|
|
678
|
+
"data-tecof-zone": zoneKey || "root",
|
|
679
|
+
onMouseEnter: handleMouseEnter,
|
|
680
|
+
onMouseLeave: handleMouseLeave,
|
|
681
|
+
onClick: handleClick,
|
|
682
|
+
style: {
|
|
683
|
+
cursor: readOnly ? void 0 : "pointer"
|
|
684
|
+
},
|
|
685
|
+
children: componentConfig.render(componentProps)
|
|
686
|
+
}
|
|
687
|
+
) });
|
|
688
|
+
};
|
|
689
|
+
var Frame = ({ children, title = "Canvas Frame", ...props }) => {
|
|
690
|
+
const [contentRef, setContentRef] = React__default.useState(null);
|
|
691
|
+
const mountNode = contentRef?.contentWindow?.document?.body;
|
|
692
|
+
React__default.useEffect(() => {
|
|
693
|
+
if (!contentRef) return;
|
|
694
|
+
const doc = contentRef.contentDocument;
|
|
695
|
+
if (!doc) return;
|
|
696
|
+
const copyStyles = () => {
|
|
697
|
+
doc.head.innerHTML = "";
|
|
698
|
+
Array.from(document.styleSheets).forEach((styleSheet) => {
|
|
699
|
+
try {
|
|
700
|
+
if (styleSheet.href) {
|
|
701
|
+
const link = doc.createElement("link");
|
|
702
|
+
link.rel = "stylesheet";
|
|
703
|
+
link.href = styleSheet.href;
|
|
704
|
+
doc.head.appendChild(link);
|
|
705
|
+
} else {
|
|
706
|
+
const cssRules = Array.from(styleSheet.cssRules).map((rule) => rule.cssText).join("\n");
|
|
707
|
+
const style2 = doc.createElement("style");
|
|
708
|
+
style2.textContent = cssRules;
|
|
709
|
+
doc.head.appendChild(style2);
|
|
710
|
+
}
|
|
711
|
+
} catch (e3) {
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
const style = doc.createElement("style");
|
|
715
|
+
style.textContent = `
|
|
716
|
+
html, body {
|
|
717
|
+
margin: 0;
|
|
718
|
+
padding: 0;
|
|
719
|
+
background-color: transparent;
|
|
720
|
+
min-height: 100vh;
|
|
721
|
+
}
|
|
722
|
+
body {
|
|
723
|
+
padding: 32px 16px;
|
|
724
|
+
box-sizing: border-box;
|
|
725
|
+
}
|
|
726
|
+
.tecof-node-wrapper {
|
|
727
|
+
position: relative;
|
|
728
|
+
transition: outline 0.15s ease-in-out;
|
|
729
|
+
}
|
|
730
|
+
/* Custom scrollbars for iframe */
|
|
731
|
+
::-webkit-scrollbar {
|
|
732
|
+
width: 8px;
|
|
733
|
+
height: 8px;
|
|
734
|
+
}
|
|
735
|
+
::-webkit-scrollbar-track {
|
|
736
|
+
background: transparent;
|
|
737
|
+
}
|
|
738
|
+
::-webkit-scrollbar-thumb {
|
|
739
|
+
background: rgba(0, 0, 0, 0.15);
|
|
740
|
+
border-radius: 4px;
|
|
741
|
+
}
|
|
742
|
+
::-webkit-scrollbar-thumb:hover {
|
|
743
|
+
background: rgba(0, 0, 0, 0.25);
|
|
744
|
+
}
|
|
745
|
+
`;
|
|
746
|
+
doc.head.appendChild(style);
|
|
747
|
+
};
|
|
748
|
+
copyStyles();
|
|
749
|
+
if (doc.body) {
|
|
750
|
+
doc.body.className = "tecof-canvas-body";
|
|
751
|
+
const handleBodyClick = (e3) => {
|
|
752
|
+
const target = e3.target;
|
|
753
|
+
if (!target.closest(".tecof-node-wrapper")) {
|
|
754
|
+
useEditorStore.getState().selectNode(null);
|
|
755
|
+
const isEmbedded = typeof window !== "undefined" && window.parent !== window;
|
|
756
|
+
if (isEmbedded) {
|
|
757
|
+
window.parent.postMessage({ type: "puck:itemDeselected" }, "*");
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
doc.body.addEventListener("click", handleBodyClick);
|
|
762
|
+
return () => {
|
|
763
|
+
doc.body.removeEventListener("click", handleBodyClick);
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
}, [contentRef]);
|
|
767
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
768
|
+
"iframe",
|
|
769
|
+
{
|
|
770
|
+
title,
|
|
771
|
+
ref: setContentRef,
|
|
772
|
+
style: {
|
|
773
|
+
width: "100%",
|
|
774
|
+
height: "100%",
|
|
775
|
+
border: "none",
|
|
776
|
+
background: "#ffffff",
|
|
777
|
+
...props.style
|
|
778
|
+
},
|
|
779
|
+
...props,
|
|
780
|
+
children: mountNode && ReactDOM.createPortal(children, mountNode)
|
|
781
|
+
}
|
|
782
|
+
);
|
|
783
|
+
};
|
|
784
|
+
var Canvas = () => {
|
|
785
|
+
const content = useEditorStore((state3) => state3.document.content);
|
|
786
|
+
const viewport = useEditorStore((state3) => state3.viewport);
|
|
787
|
+
const getWidth2 = () => {
|
|
788
|
+
switch (viewport) {
|
|
789
|
+
case "tablet":
|
|
790
|
+
return "768px";
|
|
791
|
+
case "mobile":
|
|
792
|
+
return "375px";
|
|
793
|
+
case "desktop":
|
|
794
|
+
default:
|
|
795
|
+
return "100%";
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-canvas-container", style: {
|
|
799
|
+
flex: 1,
|
|
800
|
+
display: "flex",
|
|
801
|
+
alignItems: "center",
|
|
802
|
+
justifyContent: "center",
|
|
803
|
+
background: "#f4f4f5",
|
|
804
|
+
padding: "24px",
|
|
805
|
+
overflow: "auto",
|
|
806
|
+
height: "100%",
|
|
807
|
+
boxSizing: "border-box"
|
|
808
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
809
|
+
"div",
|
|
810
|
+
{
|
|
811
|
+
className: "tecof-canvas-viewport-wrapper",
|
|
812
|
+
style: {
|
|
813
|
+
width: getWidth2(),
|
|
814
|
+
height: "100%",
|
|
815
|
+
maxWidth: "100%",
|
|
816
|
+
transition: "width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
817
|
+
boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05)",
|
|
818
|
+
borderRadius: viewport === "desktop" ? "0" : "12px",
|
|
819
|
+
overflow: "hidden",
|
|
820
|
+
backgroundColor: "#ffffff"
|
|
821
|
+
},
|
|
822
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Frame, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-canvas-root", style: { minHeight: "100%" }, children: content.map((item2, index2) => /* @__PURE__ */ jsxRuntime.jsx(NodeRenderer, { node: item2, index: index2 }, item2.props.id)) }) })
|
|
823
|
+
}
|
|
824
|
+
) });
|
|
825
|
+
};
|
|
826
|
+
|
|
337
827
|
// node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
|
338
828
|
var mergeClasses = (...classes) => classes.filter((className, index2, array) => {
|
|
339
829
|
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
|
|
@@ -455,38 +945,42 @@ var ChevronDown = createLucideIcon("chevron-down", __iconNode4);
|
|
|
455
945
|
var __iconNode5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
456
946
|
var ChevronRight = createLucideIcon("chevron-right", __iconNode5);
|
|
457
947
|
|
|
948
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-up.js
|
|
949
|
+
var __iconNode6 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
950
|
+
var ChevronUp = createLucideIcon("chevron-up", __iconNode6);
|
|
951
|
+
|
|
458
952
|
// node_modules/lucide-react/dist/esm/icons/code.js
|
|
459
|
-
var
|
|
953
|
+
var __iconNode7 = [
|
|
460
954
|
["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
|
|
461
955
|
["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
|
|
462
956
|
];
|
|
463
|
-
var Code = createLucideIcon("code",
|
|
957
|
+
var Code = createLucideIcon("code", __iconNode7);
|
|
464
958
|
|
|
465
959
|
// node_modules/lucide-react/dist/esm/icons/copy.js
|
|
466
|
-
var
|
|
960
|
+
var __iconNode8 = [
|
|
467
961
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
468
962
|
["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" }]
|
|
469
963
|
];
|
|
470
|
-
var Copy = createLucideIcon("copy",
|
|
964
|
+
var Copy = createLucideIcon("copy", __iconNode8);
|
|
471
965
|
|
|
472
966
|
// node_modules/lucide-react/dist/esm/icons/database.js
|
|
473
|
-
var
|
|
967
|
+
var __iconNode9 = [
|
|
474
968
|
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
|
|
475
969
|
["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
|
|
476
970
|
["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
|
|
477
971
|
];
|
|
478
|
-
var Database = createLucideIcon("database",
|
|
972
|
+
var Database = createLucideIcon("database", __iconNode9);
|
|
479
973
|
|
|
480
974
|
// node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
481
|
-
var
|
|
975
|
+
var __iconNode10 = [
|
|
482
976
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
483
977
|
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
484
978
|
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
485
979
|
];
|
|
486
|
-
var ExternalLink = createLucideIcon("external-link",
|
|
980
|
+
var ExternalLink = createLucideIcon("external-link", __iconNode10);
|
|
487
981
|
|
|
488
982
|
// node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
489
|
-
var
|
|
983
|
+
var __iconNode11 = [
|
|
490
984
|
[
|
|
491
985
|
"path",
|
|
492
986
|
{
|
|
@@ -499,10 +993,10 @@ var __iconNode10 = [
|
|
|
499
993
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
500
994
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
501
995
|
];
|
|
502
|
-
var FileText = createLucideIcon("file-text",
|
|
996
|
+
var FileText = createLucideIcon("file-text", __iconNode11);
|
|
503
997
|
|
|
504
998
|
// node_modules/lucide-react/dist/esm/icons/file.js
|
|
505
|
-
var
|
|
999
|
+
var __iconNode12 = [
|
|
506
1000
|
[
|
|
507
1001
|
"path",
|
|
508
1002
|
{
|
|
@@ -512,10 +1006,10 @@ var __iconNode11 = [
|
|
|
512
1006
|
],
|
|
513
1007
|
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
|
|
514
1008
|
];
|
|
515
|
-
var File2 = createLucideIcon("file",
|
|
1009
|
+
var File2 = createLucideIcon("file", __iconNode12);
|
|
516
1010
|
|
|
517
1011
|
// node_modules/lucide-react/dist/esm/icons/folder-open.js
|
|
518
|
-
var
|
|
1012
|
+
var __iconNode13 = [
|
|
519
1013
|
[
|
|
520
1014
|
"path",
|
|
521
1015
|
{
|
|
@@ -524,18 +1018,18 @@ var __iconNode12 = [
|
|
|
524
1018
|
}
|
|
525
1019
|
]
|
|
526
1020
|
];
|
|
527
|
-
var FolderOpen = createLucideIcon("folder-open",
|
|
1021
|
+
var FolderOpen = createLucideIcon("folder-open", __iconNode13);
|
|
528
1022
|
|
|
529
1023
|
// node_modules/lucide-react/dist/esm/icons/globe.js
|
|
530
|
-
var
|
|
1024
|
+
var __iconNode14 = [
|
|
531
1025
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
532
1026
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
533
1027
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
534
1028
|
];
|
|
535
|
-
var Globe = createLucideIcon("globe",
|
|
1029
|
+
var Globe = createLucideIcon("globe", __iconNode14);
|
|
536
1030
|
|
|
537
1031
|
// node_modules/lucide-react/dist/esm/icons/grip-vertical.js
|
|
538
|
-
var
|
|
1032
|
+
var __iconNode15 = [
|
|
539
1033
|
["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
|
|
540
1034
|
["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
|
|
541
1035
|
["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
|
|
@@ -543,28 +1037,28 @@ var __iconNode14 = [
|
|
|
543
1037
|
["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
|
|
544
1038
|
["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
|
|
545
1039
|
];
|
|
546
|
-
var GripVertical = createLucideIcon("grip-vertical",
|
|
1040
|
+
var GripVertical = createLucideIcon("grip-vertical", __iconNode15);
|
|
547
1041
|
|
|
548
1042
|
// node_modules/lucide-react/dist/esm/icons/image-plus.js
|
|
549
|
-
var
|
|
1043
|
+
var __iconNode16 = [
|
|
550
1044
|
["path", { d: "M16 5h6", key: "1vod17" }],
|
|
551
1045
|
["path", { d: "M19 2v6", key: "4bpg5p" }],
|
|
552
1046
|
["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" }],
|
|
553
1047
|
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
|
|
554
1048
|
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
|
|
555
1049
|
];
|
|
556
|
-
var ImagePlus = createLucideIcon("image-plus",
|
|
1050
|
+
var ImagePlus = createLucideIcon("image-plus", __iconNode16);
|
|
557
1051
|
|
|
558
1052
|
// node_modules/lucide-react/dist/esm/icons/image.js
|
|
559
|
-
var
|
|
1053
|
+
var __iconNode17 = [
|
|
560
1054
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
561
1055
|
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
562
1056
|
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
563
1057
|
];
|
|
564
|
-
var Image2 = createLucideIcon("image",
|
|
1058
|
+
var Image2 = createLucideIcon("image", __iconNode17);
|
|
565
1059
|
|
|
566
1060
|
// node_modules/lucide-react/dist/esm/icons/languages.js
|
|
567
|
-
var
|
|
1061
|
+
var __iconNode18 = [
|
|
568
1062
|
["path", { d: "m5 8 6 6", key: "1wu5hv" }],
|
|
569
1063
|
["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
|
|
570
1064
|
["path", { d: "M2 5h12", key: "or177f" }],
|
|
@@ -572,29 +1066,29 @@ var __iconNode17 = [
|
|
|
572
1066
|
["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
|
|
573
1067
|
["path", { d: "M14 18h6", key: "1m8k6r" }]
|
|
574
1068
|
];
|
|
575
|
-
var Languages = createLucideIcon("languages",
|
|
1069
|
+
var Languages = createLucideIcon("languages", __iconNode18);
|
|
576
1070
|
|
|
577
1071
|
// node_modules/lucide-react/dist/esm/icons/link-2.js
|
|
578
|
-
var
|
|
1072
|
+
var __iconNode19 = [
|
|
579
1073
|
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
580
1074
|
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
581
1075
|
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
582
1076
|
];
|
|
583
|
-
var Link2 = createLucideIcon("link-2",
|
|
1077
|
+
var Link2 = createLucideIcon("link-2", __iconNode19);
|
|
584
1078
|
|
|
585
1079
|
// node_modules/lucide-react/dist/esm/icons/link.js
|
|
586
|
-
var
|
|
1080
|
+
var __iconNode20 = [
|
|
587
1081
|
["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" }],
|
|
588
1082
|
["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" }]
|
|
589
1083
|
];
|
|
590
|
-
var Link = createLucideIcon("link",
|
|
1084
|
+
var Link = createLucideIcon("link", __iconNode20);
|
|
591
1085
|
|
|
592
1086
|
// node_modules/lucide-react/dist/esm/icons/loader-circle.js
|
|
593
|
-
var
|
|
594
|
-
var LoaderCircle = createLucideIcon("loader-circle",
|
|
1087
|
+
var __iconNode21 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
|
|
1088
|
+
var LoaderCircle = createLucideIcon("loader-circle", __iconNode21);
|
|
595
1089
|
|
|
596
1090
|
// node_modules/lucide-react/dist/esm/icons/pencil.js
|
|
597
|
-
var
|
|
1091
|
+
var __iconNode22 = [
|
|
598
1092
|
[
|
|
599
1093
|
"path",
|
|
600
1094
|
{
|
|
@@ -604,429 +1098,1030 @@ var __iconNode21 = [
|
|
|
604
1098
|
],
|
|
605
1099
|
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
606
1100
|
];
|
|
607
|
-
var Pencil = createLucideIcon("pencil",
|
|
1101
|
+
var Pencil = createLucideIcon("pencil", __iconNode22);
|
|
608
1102
|
|
|
609
1103
|
// node_modules/lucide-react/dist/esm/icons/plus.js
|
|
610
|
-
var
|
|
1104
|
+
var __iconNode23 = [
|
|
611
1105
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
612
1106
|
["path", { d: "M12 5v14", key: "s699le" }]
|
|
613
1107
|
];
|
|
614
|
-
var Plus = createLucideIcon("plus",
|
|
1108
|
+
var Plus = createLucideIcon("plus", __iconNode23);
|
|
615
1109
|
|
|
616
1110
|
// node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
|
|
617
|
-
var
|
|
1111
|
+
var __iconNode24 = [
|
|
618
1112
|
["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
|
|
619
1113
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }],
|
|
620
1114
|
["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
|
|
621
1115
|
["path", { d: "M16 16h5v5", key: "ccwih5" }]
|
|
622
1116
|
];
|
|
623
|
-
var RefreshCcw = createLucideIcon("refresh-ccw",
|
|
1117
|
+
var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode24);
|
|
624
1118
|
|
|
625
1119
|
// node_modules/lucide-react/dist/esm/icons/refresh-cw.js
|
|
626
|
-
var
|
|
1120
|
+
var __iconNode25 = [
|
|
627
1121
|
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
|
|
628
1122
|
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
|
|
629
1123
|
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
|
|
630
1124
|
["path", { d: "M8 16H3v5", key: "1cv678" }]
|
|
631
1125
|
];
|
|
632
|
-
var RefreshCw = createLucideIcon("refresh-cw",
|
|
1126
|
+
var RefreshCw = createLucideIcon("refresh-cw", __iconNode25);
|
|
633
1127
|
|
|
634
1128
|
// node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
|
|
635
|
-
var
|
|
1129
|
+
var __iconNode26 = [
|
|
636
1130
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
637
1131
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
638
1132
|
];
|
|
639
|
-
var RotateCcw = createLucideIcon("rotate-ccw",
|
|
1133
|
+
var RotateCcw = createLucideIcon("rotate-ccw", __iconNode26);
|
|
640
1134
|
|
|
641
1135
|
// node_modules/lucide-react/dist/esm/icons/search.js
|
|
642
|
-
var
|
|
1136
|
+
var __iconNode27 = [
|
|
643
1137
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
644
1138
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
645
1139
|
];
|
|
646
|
-
var Search = createLucideIcon("search",
|
|
1140
|
+
var Search = createLucideIcon("search", __iconNode27);
|
|
647
1141
|
|
|
648
1142
|
// node_modules/lucide-react/dist/esm/icons/trash-2.js
|
|
649
|
-
var
|
|
1143
|
+
var __iconNode28 = [
|
|
650
1144
|
["path", { d: "M10 11v6", key: "nco0om" }],
|
|
651
1145
|
["path", { d: "M14 11v6", key: "outv1u" }],
|
|
652
1146
|
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
653
1147
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
654
1148
|
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
655
1149
|
];
|
|
656
|
-
var Trash2 = createLucideIcon("trash-2",
|
|
1150
|
+
var Trash2 = createLucideIcon("trash-2", __iconNode28);
|
|
657
1151
|
|
|
658
1152
|
// node_modules/lucide-react/dist/esm/icons/upload.js
|
|
659
|
-
var
|
|
1153
|
+
var __iconNode29 = [
|
|
660
1154
|
["path", { d: "M12 3v12", key: "1x0j5s" }],
|
|
661
1155
|
["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
|
|
662
1156
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
|
|
663
1157
|
];
|
|
664
|
-
var Upload = createLucideIcon("upload",
|
|
1158
|
+
var Upload = createLucideIcon("upload", __iconNode29);
|
|
665
1159
|
|
|
666
1160
|
// node_modules/lucide-react/dist/esm/icons/x.js
|
|
667
|
-
var
|
|
1161
|
+
var __iconNode30 = [
|
|
668
1162
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
669
1163
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
670
1164
|
];
|
|
671
|
-
var X = createLucideIcon("x",
|
|
672
|
-
var
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
const [imgSrc, setImgSrc] = React__default.useState(null);
|
|
679
|
-
const [loading, setLoading] = React__default.useState(false);
|
|
680
|
-
const [error2, setError] = React__default.useState(false);
|
|
681
|
-
const fetchedRef = React__default.useRef(false);
|
|
682
|
-
const handleMouseEnter = React__default.useCallback(async () => {
|
|
683
|
-
if (fetchedRef.current) return;
|
|
684
|
-
fetchedRef.current = true;
|
|
685
|
-
setLoading(true);
|
|
686
|
-
try {
|
|
687
|
-
const domain = typeof window !== "undefined" ? window.location.hostname : "";
|
|
688
|
-
const blobUrl = await apiClient.getComponentPreview(domain, name3);
|
|
689
|
-
if (blobUrl) {
|
|
690
|
-
setImgSrc(blobUrl);
|
|
691
|
-
} else {
|
|
692
|
-
setError(true);
|
|
693
|
-
}
|
|
694
|
-
} catch {
|
|
695
|
-
setError(true);
|
|
696
|
-
} finally {
|
|
697
|
-
setLoading(false);
|
|
1165
|
+
var X = createLucideIcon("x", __iconNode30);
|
|
1166
|
+
var useOverlayCoords = (id, iframeEl, containerEl, documentState) => {
|
|
1167
|
+
const [coords, setCoords] = React__default.useState(null);
|
|
1168
|
+
React__default.useEffect(() => {
|
|
1169
|
+
if (!id || !iframeEl || !containerEl) {
|
|
1170
|
+
setCoords(null);
|
|
1171
|
+
return;
|
|
698
1172
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
1173
|
+
let resizeObserver = null;
|
|
1174
|
+
let targetResizeObserver = null;
|
|
1175
|
+
const updateCoords = () => {
|
|
1176
|
+
const doc = iframeEl.contentDocument;
|
|
1177
|
+
if (!doc) return;
|
|
1178
|
+
const element = doc.querySelector(`[data-tecof-id="${id}"]`);
|
|
1179
|
+
if (!element) {
|
|
1180
|
+
setCoords(null);
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
const rect = element.getBoundingClientRect();
|
|
1184
|
+
const iframeRect = iframeEl.getBoundingClientRect();
|
|
1185
|
+
const containerRect = containerEl.getBoundingClientRect();
|
|
1186
|
+
setCoords({
|
|
1187
|
+
top: rect.top + iframeRect.top - containerRect.top,
|
|
1188
|
+
left: rect.left + iframeRect.left - containerRect.left,
|
|
1189
|
+
width: rect.width,
|
|
1190
|
+
height: rect.height
|
|
1191
|
+
});
|
|
1192
|
+
if (!targetResizeObserver) {
|
|
1193
|
+
targetResizeObserver = new ResizeObserver(() => {
|
|
1194
|
+
updateCoords();
|
|
1195
|
+
});
|
|
1196
|
+
targetResizeObserver.observe(element);
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
updateCoords();
|
|
1200
|
+
const iframeWin = iframeEl.contentWindow;
|
|
1201
|
+
resizeObserver = new ResizeObserver(() => {
|
|
1202
|
+
updateCoords();
|
|
1203
|
+
});
|
|
1204
|
+
resizeObserver.observe(iframeEl);
|
|
1205
|
+
iframeWin?.addEventListener("scroll", updateCoords);
|
|
1206
|
+
window.addEventListener("resize", updateCoords);
|
|
1207
|
+
return () => {
|
|
1208
|
+
if (resizeObserver) resizeObserver.disconnect();
|
|
1209
|
+
if (targetResizeObserver) targetResizeObserver.disconnect();
|
|
1210
|
+
iframeWin?.removeEventListener("scroll", updateCoords);
|
|
1211
|
+
window.removeEventListener("resize", updateCoords);
|
|
1212
|
+
};
|
|
1213
|
+
}, [id, iframeEl, containerEl, documentState]);
|
|
1214
|
+
return coords;
|
|
1215
|
+
};
|
|
1216
|
+
var SelectionOverlay = () => {
|
|
1217
|
+
const documentState = useEditorStore((state3) => state3.document);
|
|
1218
|
+
const selectedId = useEditorStore((state3) => state3.selection.selectedId);
|
|
1219
|
+
const hoveredId = useEditorStore((state3) => state3.selection.hoveredId);
|
|
1220
|
+
const selectNode = useEditorStore((state3) => state3.selectNode);
|
|
1221
|
+
const removeNode2 = useEditorStore((state3) => state3.removeNode);
|
|
1222
|
+
const duplicateNode2 = useEditorStore((state3) => state3.duplicateNode);
|
|
1223
|
+
const moveNode2 = useEditorStore((state3) => state3.moveNode);
|
|
1224
|
+
const [iframeEl, setIframeEl] = React__default.useState(null);
|
|
1225
|
+
const containerRef = React__default.useRef(null);
|
|
1226
|
+
React__default.useEffect(() => {
|
|
1227
|
+
const iframe = document.querySelector(".tecof-canvas-viewport-wrapper iframe");
|
|
1228
|
+
setIframeEl(iframe);
|
|
1229
|
+
}, [documentState]);
|
|
1230
|
+
const selectedCoords = useOverlayCoords(selectedId, iframeEl, containerRef.current, documentState);
|
|
1231
|
+
const hoveredCoords = useOverlayCoords(
|
|
1232
|
+
hoveredId !== selectedId ? hoveredId : null,
|
|
1233
|
+
iframeEl,
|
|
1234
|
+
containerRef.current,
|
|
1235
|
+
documentState
|
|
1236
|
+
);
|
|
1237
|
+
const nodeDetails = selectedId ? findNodeById(documentState, selectedId) : null;
|
|
1238
|
+
const parentId = selectedId ? getParentId(documentState, selectedId) : null;
|
|
1239
|
+
const canMoveUp = nodeDetails ? nodeDetails.path.index > 0 : false;
|
|
1240
|
+
const canMoveDown = nodeDetails ? (() => {
|
|
1241
|
+
const { zoneKey, index: index2 } = nodeDetails.path;
|
|
1242
|
+
const items = zoneKey ? documentState.zones[zoneKey] || [] : documentState.content;
|
|
1243
|
+
return index2 < items.length - 1;
|
|
1244
|
+
})() : false;
|
|
1245
|
+
const handleMove = (direction) => {
|
|
1246
|
+
if (!selectedId || !nodeDetails) return;
|
|
1247
|
+
const { zoneKey, index: index2 } = nodeDetails.path;
|
|
1248
|
+
const newIndex = direction === "up" ? index2 - 1 : index2 + 1;
|
|
1249
|
+
moveNode2(selectedId, zoneKey, newIndex);
|
|
1250
|
+
};
|
|
1251
|
+
const breadcrumbs = selectedId ? getBreadcrumbs(documentState, selectedId) : [];
|
|
1252
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1253
|
+
"div",
|
|
1254
|
+
{
|
|
1255
|
+
ref: containerRef,
|
|
1256
|
+
className: "tecof-selection-overlay-container",
|
|
1257
|
+
style: {
|
|
1258
|
+
position: "absolute",
|
|
1259
|
+
top: 0,
|
|
1260
|
+
left: 0,
|
|
1261
|
+
right: 0,
|
|
1262
|
+
bottom: 0,
|
|
1263
|
+
pointerEvents: "none",
|
|
1264
|
+
zIndex: 1e3
|
|
1265
|
+
},
|
|
1266
|
+
children: [
|
|
1267
|
+
hoveredCoords && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1268
|
+
"div",
|
|
711
1269
|
{
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
1270
|
+
className: "tecof-hover-outline",
|
|
1271
|
+
style: {
|
|
1272
|
+
position: "absolute",
|
|
1273
|
+
top: hoveredCoords.top,
|
|
1274
|
+
left: hoveredCoords.left,
|
|
1275
|
+
width: hoveredCoords.width,
|
|
1276
|
+
height: hoveredCoords.height,
|
|
1277
|
+
border: "1.5px dashed #3b82f6",
|
|
1278
|
+
borderRadius: "4px",
|
|
1279
|
+
boxSizing: "border-box",
|
|
1280
|
+
pointerEvents: "none",
|
|
1281
|
+
transition: "all 0.1s ease-out"
|
|
1282
|
+
}
|
|
715
1283
|
}
|
|
716
1284
|
),
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
1285
|
+
selectedCoords && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1286
|
+
"div",
|
|
1287
|
+
{
|
|
1288
|
+
className: "tecof-selected-outline",
|
|
1289
|
+
style: {
|
|
1290
|
+
position: "absolute",
|
|
1291
|
+
top: selectedCoords.top,
|
|
1292
|
+
left: selectedCoords.left,
|
|
1293
|
+
width: selectedCoords.width,
|
|
1294
|
+
height: selectedCoords.height,
|
|
1295
|
+
border: "2px solid #3b82f6",
|
|
1296
|
+
borderRadius: "4px",
|
|
1297
|
+
boxSizing: "border-box",
|
|
1298
|
+
pointerEvents: "none",
|
|
1299
|
+
transition: "all 0.1s ease-out"
|
|
1300
|
+
},
|
|
1301
|
+
children: [
|
|
1302
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1303
|
+
"div",
|
|
1304
|
+
{
|
|
1305
|
+
className: "tecof-floating-toolbar",
|
|
1306
|
+
style: {
|
|
1307
|
+
position: "absolute",
|
|
1308
|
+
top: "-36px",
|
|
1309
|
+
right: "-2px",
|
|
1310
|
+
display: "flex",
|
|
1311
|
+
alignItems: "center",
|
|
1312
|
+
gap: "4px",
|
|
1313
|
+
background: "#3b82f6",
|
|
1314
|
+
borderRadius: "6px",
|
|
1315
|
+
padding: "4px",
|
|
1316
|
+
pointerEvents: "auto",
|
|
1317
|
+
boxShadow: "0 4px 6px -1px rgba(59, 130, 246, 0.2)"
|
|
1318
|
+
},
|
|
1319
|
+
children: [
|
|
1320
|
+
parentId && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1321
|
+
"button",
|
|
1322
|
+
{
|
|
1323
|
+
onClick: () => selectNode(parentId),
|
|
1324
|
+
title: "\xDCst \xD6\u011Feyi Se\xE7",
|
|
1325
|
+
style: {
|
|
1326
|
+
background: "transparent",
|
|
1327
|
+
border: "none",
|
|
1328
|
+
color: "#ffffff",
|
|
1329
|
+
cursor: "pointer",
|
|
1330
|
+
padding: "4px",
|
|
1331
|
+
borderRadius: "4px",
|
|
1332
|
+
display: "flex"
|
|
1333
|
+
},
|
|
1334
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronUp, { size: 14 })
|
|
1335
|
+
}
|
|
1336
|
+
),
|
|
1337
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1338
|
+
"button",
|
|
1339
|
+
{
|
|
1340
|
+
onClick: () => handleMove("up"),
|
|
1341
|
+
disabled: !canMoveUp,
|
|
1342
|
+
title: "Yukar\u0131 Ta\u015F\u0131",
|
|
1343
|
+
style: {
|
|
1344
|
+
background: "transparent",
|
|
1345
|
+
border: "none",
|
|
1346
|
+
color: "#ffffff",
|
|
1347
|
+
opacity: canMoveUp ? 1 : 0.5,
|
|
1348
|
+
cursor: canMoveUp ? "pointer" : "not-allowed",
|
|
1349
|
+
padding: "4px",
|
|
1350
|
+
borderRadius: "4px",
|
|
1351
|
+
display: "flex"
|
|
1352
|
+
},
|
|
1353
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowUp, { size: 14 })
|
|
1354
|
+
}
|
|
1355
|
+
),
|
|
1356
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1357
|
+
"button",
|
|
1358
|
+
{
|
|
1359
|
+
onClick: () => handleMove("down"),
|
|
1360
|
+
disabled: !canMoveDown,
|
|
1361
|
+
title: "A\u015Fa\u011F\u0131 Ta\u015F\u0131",
|
|
1362
|
+
style: {
|
|
1363
|
+
background: "transparent",
|
|
1364
|
+
border: "none",
|
|
1365
|
+
color: "#ffffff",
|
|
1366
|
+
opacity: canMoveDown ? 1 : 0.5,
|
|
1367
|
+
cursor: canMoveDown ? "pointer" : "not-allowed",
|
|
1368
|
+
padding: "4px",
|
|
1369
|
+
borderRadius: "4px",
|
|
1370
|
+
display: "flex"
|
|
1371
|
+
},
|
|
1372
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowDown, { size: 14 })
|
|
1373
|
+
}
|
|
1374
|
+
),
|
|
1375
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "1px", height: "14px", background: "rgba(255,255,255,0.3)", margin: "0 2px" } }),
|
|
1376
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1377
|
+
"button",
|
|
1378
|
+
{
|
|
1379
|
+
onClick: () => duplicateNode2(selectedId),
|
|
1380
|
+
title: "Kopyala",
|
|
1381
|
+
style: {
|
|
1382
|
+
background: "transparent",
|
|
1383
|
+
border: "none",
|
|
1384
|
+
color: "#ffffff",
|
|
1385
|
+
cursor: "pointer",
|
|
1386
|
+
padding: "4px",
|
|
1387
|
+
borderRadius: "4px",
|
|
1388
|
+
display: "flex"
|
|
1389
|
+
},
|
|
1390
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Copy, { size: 14 })
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
1393
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1394
|
+
"button",
|
|
1395
|
+
{
|
|
1396
|
+
onClick: () => removeNode2(selectedId),
|
|
1397
|
+
title: "Sil",
|
|
1398
|
+
style: {
|
|
1399
|
+
background: "transparent",
|
|
1400
|
+
border: "none",
|
|
1401
|
+
color: "#ffffff",
|
|
1402
|
+
cursor: "pointer",
|
|
1403
|
+
padding: "4px",
|
|
1404
|
+
borderRadius: "4px",
|
|
1405
|
+
display: "flex"
|
|
1406
|
+
},
|
|
1407
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Trash2, { size: 14 })
|
|
1408
|
+
}
|
|
1409
|
+
)
|
|
1410
|
+
]
|
|
1411
|
+
}
|
|
1412
|
+
),
|
|
1413
|
+
nodeDetails && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1414
|
+
"div",
|
|
1415
|
+
{
|
|
1416
|
+
className: "tecof-outline-label",
|
|
1417
|
+
style: {
|
|
1418
|
+
position: "absolute",
|
|
1419
|
+
top: "-26px",
|
|
1420
|
+
left: "-2px",
|
|
1421
|
+
background: "#3b82f6",
|
|
1422
|
+
color: "#ffffff",
|
|
1423
|
+
fontSize: "11px",
|
|
1424
|
+
fontWeight: 600,
|
|
1425
|
+
padding: "2px 8px",
|
|
1426
|
+
borderRadius: "4px 4px 0 0",
|
|
1427
|
+
userSelect: "none"
|
|
1428
|
+
},
|
|
1429
|
+
children: nodeDetails.node.type
|
|
1430
|
+
}
|
|
1431
|
+
),
|
|
1432
|
+
breadcrumbs.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1433
|
+
"div",
|
|
1434
|
+
{
|
|
1435
|
+
className: "tecof-selected-breadcrumbs",
|
|
1436
|
+
style: {
|
|
1437
|
+
position: "absolute",
|
|
1438
|
+
bottom: "-28px",
|
|
1439
|
+
left: "-2px",
|
|
1440
|
+
display: "flex",
|
|
1441
|
+
alignItems: "center",
|
|
1442
|
+
gap: "4px",
|
|
1443
|
+
background: "#18181b",
|
|
1444
|
+
color: "#a1a1aa",
|
|
1445
|
+
fontSize: "10px",
|
|
1446
|
+
padding: "4px 8px",
|
|
1447
|
+
borderRadius: "0 0 6px 6px",
|
|
1448
|
+
pointerEvents: "auto",
|
|
1449
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.05)"
|
|
1450
|
+
},
|
|
1451
|
+
children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxRuntime.jsxs(React__default__namespace.default.Fragment, { children: [
|
|
1452
|
+
idx > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#52525b" }, children: ">" }),
|
|
1453
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1454
|
+
"span",
|
|
1455
|
+
{
|
|
1456
|
+
onClick: () => selectNode(crumb.id),
|
|
1457
|
+
style: {
|
|
1458
|
+
cursor: "pointer",
|
|
1459
|
+
color: crumb.id === selectedId ? "#ffffff" : void 0,
|
|
1460
|
+
fontWeight: crumb.id === selectedId ? 600 : void 0
|
|
1461
|
+
},
|
|
1462
|
+
onMouseEnter: () => useEditorStore.getState().hoverNode(crumb.id),
|
|
1463
|
+
onMouseLeave: () => useEditorStore.getState().hoverNode(null),
|
|
1464
|
+
children: crumb.type
|
|
1465
|
+
}
|
|
1466
|
+
)
|
|
1467
|
+
] }, crumb.id))
|
|
1468
|
+
}
|
|
1469
|
+
)
|
|
1470
|
+
]
|
|
1471
|
+
}
|
|
1472
|
+
)
|
|
1473
|
+
]
|
|
732
1474
|
}
|
|
733
|
-
|
|
734
|
-
}, [selectedItem, dispatch]);
|
|
735
|
-
return null;
|
|
1475
|
+
);
|
|
736
1476
|
};
|
|
737
|
-
var
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
1477
|
+
var FieldLabel = ({
|
|
1478
|
+
label,
|
|
1479
|
+
icon,
|
|
1480
|
+
readOnly,
|
|
1481
|
+
children,
|
|
1482
|
+
el = "label"
|
|
1483
|
+
}) => {
|
|
1484
|
+
const Component2 = el;
|
|
1485
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1486
|
+
Component2,
|
|
1487
|
+
{
|
|
1488
|
+
className: "tecof-field-label-container",
|
|
1489
|
+
style: {
|
|
1490
|
+
display: "flex",
|
|
1491
|
+
flexDirection: "column",
|
|
1492
|
+
gap: "6px",
|
|
1493
|
+
marginBottom: "16px",
|
|
1494
|
+
width: "100%",
|
|
1495
|
+
boxSizing: "border-box",
|
|
1496
|
+
userSelect: "none"
|
|
1497
|
+
},
|
|
1498
|
+
children: [
|
|
1499
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1500
|
+
"div",
|
|
1501
|
+
{
|
|
1502
|
+
className: "tecof-field-label-header",
|
|
1503
|
+
style: {
|
|
1504
|
+
display: "flex",
|
|
1505
|
+
alignItems: "center",
|
|
1506
|
+
gap: "6px",
|
|
1507
|
+
fontSize: "12px",
|
|
1508
|
+
fontWeight: 600,
|
|
1509
|
+
color: "#27272a"
|
|
1510
|
+
// zinc-800
|
|
1511
|
+
},
|
|
1512
|
+
children: [
|
|
1513
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline-flex" }, children: icon }),
|
|
1514
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
1515
|
+
readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1516
|
+
"span",
|
|
1517
|
+
{
|
|
1518
|
+
style: {
|
|
1519
|
+
fontSize: "10px",
|
|
1520
|
+
color: "#a1a1aa",
|
|
1521
|
+
fontWeight: 400,
|
|
1522
|
+
marginLeft: "auto"
|
|
1523
|
+
},
|
|
1524
|
+
children: "Salt Okunur"
|
|
1525
|
+
}
|
|
1526
|
+
)
|
|
1527
|
+
]
|
|
781
1528
|
}
|
|
1529
|
+
),
|
|
1530
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-field-label-content", style: { width: "100%" }, children })
|
|
1531
|
+
]
|
|
1532
|
+
}
|
|
1533
|
+
);
|
|
1534
|
+
};
|
|
1535
|
+
var FieldRenderer = ({
|
|
1536
|
+
name: name3,
|
|
1537
|
+
definition,
|
|
1538
|
+
value,
|
|
1539
|
+
onChange,
|
|
1540
|
+
readOnly = false
|
|
1541
|
+
}) => {
|
|
1542
|
+
const label = definition.label || name3;
|
|
1543
|
+
const type = definition.type;
|
|
1544
|
+
if (definition.render) {
|
|
1545
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-custom-field-wrapper", style: { width: "100%" }, children: definition.render({
|
|
1546
|
+
field: definition,
|
|
1547
|
+
name: name3,
|
|
1548
|
+
id: `field-${name3}`,
|
|
1549
|
+
value,
|
|
1550
|
+
onChange,
|
|
1551
|
+
readOnly
|
|
1552
|
+
}) });
|
|
1553
|
+
}
|
|
1554
|
+
switch (type) {
|
|
1555
|
+
case "text":
|
|
1556
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1557
|
+
"input",
|
|
1558
|
+
{
|
|
1559
|
+
id: `field-${name3}`,
|
|
1560
|
+
type: "text",
|
|
1561
|
+
value: value || "",
|
|
1562
|
+
disabled: readOnly,
|
|
1563
|
+
onChange: (e3) => onChange(e3.target.value),
|
|
1564
|
+
style: {
|
|
1565
|
+
width: "100%",
|
|
1566
|
+
padding: "10px 12px",
|
|
1567
|
+
borderRadius: "8px",
|
|
1568
|
+
border: "1px solid #e4e4e7",
|
|
1569
|
+
fontSize: "13px",
|
|
1570
|
+
color: "#18181b",
|
|
1571
|
+
backgroundColor: readOnly ? "#f4f4f5" : "#ffffff",
|
|
1572
|
+
outline: "none",
|
|
1573
|
+
boxSizing: "border-box",
|
|
1574
|
+
transition: "border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out"
|
|
1575
|
+
},
|
|
1576
|
+
className: "tecof-input-text"
|
|
782
1577
|
}
|
|
783
|
-
});
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
1578
|
+
) });
|
|
1579
|
+
case "textarea":
|
|
1580
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1581
|
+
"textarea",
|
|
1582
|
+
{
|
|
1583
|
+
id: `field-${name3}`,
|
|
1584
|
+
rows: 4,
|
|
1585
|
+
value: value || "",
|
|
1586
|
+
disabled: readOnly,
|
|
1587
|
+
onChange: (e3) => onChange(e3.target.value),
|
|
1588
|
+
style: {
|
|
1589
|
+
width: "100%",
|
|
1590
|
+
padding: "10px 12px",
|
|
1591
|
+
borderRadius: "8px",
|
|
1592
|
+
border: "1px solid #e4e4e7",
|
|
1593
|
+
fontSize: "13px",
|
|
1594
|
+
color: "#18181b",
|
|
1595
|
+
backgroundColor: readOnly ? "#f4f4f5" : "#ffffff",
|
|
1596
|
+
outline: "none",
|
|
1597
|
+
resize: "vertical",
|
|
1598
|
+
boxSizing: "border-box",
|
|
1599
|
+
transition: "border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out"
|
|
1600
|
+
},
|
|
1601
|
+
className: "tecof-input-textarea"
|
|
790
1602
|
}
|
|
791
|
-
});
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
1603
|
+
) });
|
|
1604
|
+
case "select":
|
|
1605
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", width: "100%" }, children: [
|
|
1606
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1607
|
+
"select",
|
|
1608
|
+
{
|
|
1609
|
+
id: `field-${name3}`,
|
|
1610
|
+
value: value || "",
|
|
1611
|
+
disabled: readOnly,
|
|
1612
|
+
onChange: (e3) => onChange(e3.target.value),
|
|
1613
|
+
style: {
|
|
1614
|
+
width: "100%",
|
|
1615
|
+
padding: "10px 32px 10px 12px",
|
|
1616
|
+
borderRadius: "8px",
|
|
1617
|
+
border: "1px solid #e4e4e7",
|
|
1618
|
+
fontSize: "13px",
|
|
1619
|
+
color: "#18181b",
|
|
1620
|
+
backgroundColor: readOnly ? "#f4f4f5" : "#ffffff",
|
|
1621
|
+
outline: "none",
|
|
1622
|
+
appearance: "none",
|
|
1623
|
+
boxSizing: "border-box",
|
|
1624
|
+
cursor: readOnly ? "not-allowed" : "pointer"
|
|
1625
|
+
},
|
|
1626
|
+
className: "tecof-input-select",
|
|
1627
|
+
children: (definition.options || []).map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt.value, children: opt.label || opt.value }, opt.value))
|
|
1628
|
+
}
|
|
1629
|
+
),
|
|
1630
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1631
|
+
"div",
|
|
1632
|
+
{
|
|
1633
|
+
style: {
|
|
1634
|
+
position: "absolute",
|
|
1635
|
+
top: "50%",
|
|
1636
|
+
right: "12px",
|
|
1637
|
+
transform: "translateY(-50%)",
|
|
1638
|
+
pointerEvents: "none",
|
|
1639
|
+
display: "flex",
|
|
1640
|
+
alignItems: "center",
|
|
1641
|
+
color: "#71717a"
|
|
1642
|
+
},
|
|
1643
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.5 4.5L6 8L9.5 4.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
797
1644
|
}
|
|
1645
|
+
)
|
|
1646
|
+
] }) });
|
|
1647
|
+
case "number":
|
|
1648
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1649
|
+
"input",
|
|
1650
|
+
{
|
|
1651
|
+
id: `field-${name3}`,
|
|
1652
|
+
type: "number",
|
|
1653
|
+
value: value !== void 0 ? value : "",
|
|
1654
|
+
disabled: readOnly,
|
|
1655
|
+
onChange: (e3) => {
|
|
1656
|
+
const val = e3.target.value;
|
|
1657
|
+
onChange(val === "" ? void 0 : Number(val));
|
|
1658
|
+
},
|
|
1659
|
+
style: {
|
|
1660
|
+
width: "100%",
|
|
1661
|
+
padding: "10px 12px",
|
|
1662
|
+
borderRadius: "8px",
|
|
1663
|
+
border: "1px solid #e4e4e7",
|
|
1664
|
+
fontSize: "13px",
|
|
1665
|
+
color: "#18181b",
|
|
1666
|
+
backgroundColor: readOnly ? "#f4f4f5" : "#ffffff",
|
|
1667
|
+
outline: "none",
|
|
1668
|
+
boxSizing: "border-box"
|
|
1669
|
+
},
|
|
1670
|
+
className: "tecof-input-number"
|
|
798
1671
|
}
|
|
799
|
-
});
|
|
1672
|
+
) });
|
|
1673
|
+
case "radio":
|
|
1674
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: (definition.options || []).map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1675
|
+
"label",
|
|
1676
|
+
{
|
|
1677
|
+
style: {
|
|
1678
|
+
display: "flex",
|
|
1679
|
+
alignItems: "center",
|
|
1680
|
+
gap: "8px",
|
|
1681
|
+
fontSize: "13px",
|
|
1682
|
+
color: "#27272a",
|
|
1683
|
+
cursor: readOnly ? "not-allowed" : "pointer"
|
|
1684
|
+
},
|
|
1685
|
+
children: [
|
|
1686
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1687
|
+
"input",
|
|
1688
|
+
{
|
|
1689
|
+
type: "radio",
|
|
1690
|
+
name: name3,
|
|
1691
|
+
value: opt.value,
|
|
1692
|
+
checked: value === opt.value,
|
|
1693
|
+
disabled: readOnly,
|
|
1694
|
+
onChange: () => onChange(opt.value),
|
|
1695
|
+
style: {
|
|
1696
|
+
cursor: readOnly ? "not-allowed" : "pointer"
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
),
|
|
1700
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: opt.label || opt.value })
|
|
1701
|
+
]
|
|
1702
|
+
},
|
|
1703
|
+
opt.value
|
|
1704
|
+
)) }) });
|
|
1705
|
+
default:
|
|
1706
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "8px", fontSize: "11px", color: "#71717a", background: "#fafafa", borderRadius: "4px" }, children: [
|
|
1707
|
+
'Desteklenmeyen alan t\xFCr\xFC: "',
|
|
1708
|
+
type,
|
|
1709
|
+
'" (',
|
|
1710
|
+
name3,
|
|
1711
|
+
")"
|
|
1712
|
+
] });
|
|
1713
|
+
}
|
|
1714
|
+
};
|
|
1715
|
+
var Inspector = () => {
|
|
1716
|
+
const documentState = useEditorStore((state3) => state3.document);
|
|
1717
|
+
const selectedId = useEditorStore((state3) => state3.selection.selectedId);
|
|
1718
|
+
const updateProps2 = useEditorStore((state3) => state3.updateProps);
|
|
1719
|
+
const setRootProps2 = useEditorStore((state3) => state3.setRootProps);
|
|
1720
|
+
const selectNode = useEditorStore((state3) => state3.selectNode);
|
|
1721
|
+
const { config: config3, readOnly } = useStudio();
|
|
1722
|
+
if (selectedId) {
|
|
1723
|
+
const nodeDetails = findNodeById(documentState, selectedId);
|
|
1724
|
+
if (!nodeDetails) {
|
|
1725
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "24px", color: "#71717a", fontSize: "13px", textAlign: "center" }, children: "Bile\u015Fen y\xFCkleniyor veya bulunamad\u0131." });
|
|
1726
|
+
}
|
|
1727
|
+
const { node } = nodeDetails;
|
|
1728
|
+
const componentConfig = config3.components[node.type];
|
|
1729
|
+
const fields = componentConfig?.fields || {};
|
|
1730
|
+
const label = componentConfig?.label || node.type;
|
|
1731
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1732
|
+
"div",
|
|
1733
|
+
{
|
|
1734
|
+
className: "tecof-inspector",
|
|
1735
|
+
style: {
|
|
1736
|
+
width: "320px",
|
|
1737
|
+
height: "100%",
|
|
1738
|
+
borderLeft: "1px solid #e4e4e7",
|
|
1739
|
+
background: "#ffffff",
|
|
1740
|
+
display: "flex",
|
|
1741
|
+
flexDirection: "column",
|
|
1742
|
+
boxSizing: "border-box"
|
|
1743
|
+
},
|
|
1744
|
+
children: [
|
|
1745
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1746
|
+
"div",
|
|
1747
|
+
{
|
|
1748
|
+
style: {
|
|
1749
|
+
padding: "16px 20px",
|
|
1750
|
+
borderBottom: "1px solid #f4f4f5",
|
|
1751
|
+
display: "flex",
|
|
1752
|
+
alignItems: "center",
|
|
1753
|
+
justifyContent: "space-between"
|
|
1754
|
+
},
|
|
1755
|
+
children: [
|
|
1756
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1757
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: { margin: 0, fontSize: "14px", fontWeight: 700, color: "#18181b" }, children: label }),
|
|
1758
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: "#a1a1aa", fontFamily: "monospace" }, children: selectedId })
|
|
1759
|
+
] }),
|
|
1760
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1761
|
+
"button",
|
|
1762
|
+
{
|
|
1763
|
+
onClick: () => selectNode(null),
|
|
1764
|
+
style: {
|
|
1765
|
+
background: "transparent",
|
|
1766
|
+
border: "none",
|
|
1767
|
+
color: "#71717a",
|
|
1768
|
+
cursor: "pointer",
|
|
1769
|
+
fontSize: "11px",
|
|
1770
|
+
fontWeight: 500,
|
|
1771
|
+
padding: "4px 8px",
|
|
1772
|
+
borderRadius: "4px",
|
|
1773
|
+
hover: { background: "#f4f4f5" }
|
|
1774
|
+
},
|
|
1775
|
+
children: "Se\xE7imi Kald\u0131r"
|
|
1776
|
+
}
|
|
1777
|
+
)
|
|
1778
|
+
]
|
|
1779
|
+
}
|
|
1780
|
+
),
|
|
1781
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1782
|
+
"div",
|
|
1783
|
+
{
|
|
1784
|
+
className: "tecof-inspector-fields",
|
|
1785
|
+
style: {
|
|
1786
|
+
flex: 1,
|
|
1787
|
+
overflowY: "auto",
|
|
1788
|
+
padding: "20px",
|
|
1789
|
+
display: "flex",
|
|
1790
|
+
flexDirection: "column",
|
|
1791
|
+
gap: "4px"
|
|
1792
|
+
},
|
|
1793
|
+
children: Object.keys(fields).length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#a1a1aa", fontSize: "12px", textAlign: "center", marginTop: "16px" }, children: "Bu bile\u015Fenin d\xFCzenlenebilir alan\u0131 bulunmuyor." }) : Object.entries(fields).map(([fieldName, fieldDef]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1794
|
+
FieldRenderer,
|
|
1795
|
+
{
|
|
1796
|
+
name: fieldName,
|
|
1797
|
+
definition: fieldDef,
|
|
1798
|
+
value: node.props[fieldName],
|
|
1799
|
+
onChange: (newVal) => updateProps2(selectedId, { [fieldName]: newVal }),
|
|
1800
|
+
readOnly
|
|
1801
|
+
},
|
|
1802
|
+
fieldName
|
|
1803
|
+
))
|
|
1804
|
+
}
|
|
1805
|
+
)
|
|
1806
|
+
]
|
|
1807
|
+
}
|
|
1808
|
+
);
|
|
1809
|
+
}
|
|
1810
|
+
const rootFields = config3.root?.fields || {};
|
|
1811
|
+
const hasRootFields = Object.keys(rootFields).length > 0;
|
|
1812
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1813
|
+
"div",
|
|
1814
|
+
{
|
|
1815
|
+
className: "tecof-inspector",
|
|
1816
|
+
style: {
|
|
1817
|
+
width: "320px",
|
|
1818
|
+
height: "100%",
|
|
1819
|
+
borderLeft: "1px solid #e4e4e7",
|
|
1820
|
+
background: "#ffffff",
|
|
1821
|
+
display: "flex",
|
|
1822
|
+
flexDirection: "column",
|
|
1823
|
+
boxSizing: "border-box"
|
|
1824
|
+
},
|
|
1825
|
+
children: [
|
|
1826
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1827
|
+
"div",
|
|
1828
|
+
{
|
|
1829
|
+
style: {
|
|
1830
|
+
padding: "16px 20px",
|
|
1831
|
+
borderBottom: "1px solid #f4f4f5"
|
|
1832
|
+
},
|
|
1833
|
+
children: [
|
|
1834
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: { margin: 0, fontSize: "14px", fontWeight: 700, color: "#18181b" }, children: "Sayfa Ayarlar\u0131" }),
|
|
1835
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: "#a1a1aa" }, children: "Genel sayfa konfig\xFCrasyonu" })
|
|
1836
|
+
]
|
|
1837
|
+
}
|
|
1838
|
+
),
|
|
1839
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1840
|
+
"div",
|
|
1841
|
+
{
|
|
1842
|
+
className: "tecof-inspector-fields",
|
|
1843
|
+
style: {
|
|
1844
|
+
flex: 1,
|
|
1845
|
+
overflowY: "auto",
|
|
1846
|
+
padding: "20px",
|
|
1847
|
+
display: "flex",
|
|
1848
|
+
flexDirection: "column",
|
|
1849
|
+
gap: "4px"
|
|
1850
|
+
},
|
|
1851
|
+
children: hasRootFields ? Object.entries(rootFields).map(([fieldName, fieldDef]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1852
|
+
FieldRenderer,
|
|
1853
|
+
{
|
|
1854
|
+
name: fieldName,
|
|
1855
|
+
definition: fieldDef,
|
|
1856
|
+
value: documentState.root.props[fieldName],
|
|
1857
|
+
onChange: (newVal) => setRootProps2({ [fieldName]: newVal }),
|
|
1858
|
+
readOnly
|
|
1859
|
+
},
|
|
1860
|
+
fieldName
|
|
1861
|
+
)) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1862
|
+
"div",
|
|
1863
|
+
{
|
|
1864
|
+
style: {
|
|
1865
|
+
display: "flex",
|
|
1866
|
+
flexDirection: "column",
|
|
1867
|
+
alignItems: "center",
|
|
1868
|
+
justifyContent: "center",
|
|
1869
|
+
height: "100%",
|
|
1870
|
+
color: "#a1a1aa",
|
|
1871
|
+
fontSize: "12px",
|
|
1872
|
+
textAlign: "center",
|
|
1873
|
+
padding: "20px"
|
|
1874
|
+
},
|
|
1875
|
+
children: [
|
|
1876
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1877
|
+
"svg",
|
|
1878
|
+
{
|
|
1879
|
+
width: "24",
|
|
1880
|
+
height: "24",
|
|
1881
|
+
viewBox: "0 0 24 24",
|
|
1882
|
+
fill: "none",
|
|
1883
|
+
stroke: "currentColor",
|
|
1884
|
+
strokeWidth: "2",
|
|
1885
|
+
strokeLinecap: "round",
|
|
1886
|
+
strokeLinejoin: "round",
|
|
1887
|
+
style: { marginBottom: "8px", opacity: 0.6 },
|
|
1888
|
+
children: [
|
|
1889
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
|
|
1890
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 3v18" })
|
|
1891
|
+
]
|
|
1892
|
+
}
|
|
1893
|
+
),
|
|
1894
|
+
"Bile\u015Fen se\xE7ilmedi. D\xFCzenlemek istedi\u011Finiz bir bile\u015Fene t\u0131klay\u0131n."
|
|
1895
|
+
]
|
|
1896
|
+
}
|
|
1897
|
+
)
|
|
1898
|
+
}
|
|
1899
|
+
)
|
|
1900
|
+
]
|
|
800
1901
|
}
|
|
801
|
-
|
|
802
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core.ActionBar, { label, children: /* @__PURE__ */ jsxRuntime.jsxs(core.ActionBar.Group, { children: [
|
|
803
|
-
/* @__PURE__ */ jsxRuntime.jsx(core.ActionBar.Action, { onClick: () => handleMove("up"), disabled: !canMoveUp, label: "Yukar\u0131 Ta\u015F\u0131", children: /* @__PURE__ */ jsxRuntime.jsx(ArrowUp, { size: 14 }) }),
|
|
804
|
-
/* @__PURE__ */ jsxRuntime.jsx(core.ActionBar.Action, { onClick: () => handleMove("down"), disabled: !canMoveDown, label: "A\u015Fa\u011F\u0131 Ta\u015F\u0131", children: /* @__PURE__ */ jsxRuntime.jsx(ArrowDown, { size: 14 }) }),
|
|
805
|
-
/* @__PURE__ */ jsxRuntime.jsx(core.ActionBar.Separator, {}),
|
|
806
|
-
children
|
|
807
|
-
] }) });
|
|
1902
|
+
);
|
|
808
1903
|
};
|
|
809
|
-
var
|
|
1904
|
+
var TecofStudio = ({
|
|
810
1905
|
pageId,
|
|
811
1906
|
config: config3,
|
|
812
1907
|
accessToken,
|
|
813
1908
|
onSave,
|
|
814
1909
|
onChange,
|
|
815
|
-
overrides,
|
|
816
|
-
plugins: extraPlugins,
|
|
817
1910
|
className
|
|
818
1911
|
}) => {
|
|
819
|
-
const { apiClient
|
|
820
|
-
const [initialData, setInitialData] = React__default.useState(null);
|
|
1912
|
+
const { apiClient } = useTecof();
|
|
821
1913
|
const [loading, setLoading] = React__default.useState(true);
|
|
822
1914
|
const [saving, setSaving] = React__default.useState(false);
|
|
823
1915
|
const [saveStatus, setSaveStatus] = React__default.useState("idle");
|
|
824
|
-
const
|
|
825
|
-
const
|
|
1916
|
+
const setDocument = useEditorStore((state3) => state3.setDocument);
|
|
1917
|
+
const documentState = useEditorStore((state3) => state3.document);
|
|
1918
|
+
const undo = useEditorStore((state3) => state3.undo);
|
|
1919
|
+
const redo = useEditorStore((state3) => state3.redo);
|
|
1920
|
+
const setViewport = useEditorStore((state3) => state3.setViewport);
|
|
1921
|
+
const documentStateRef = React__default.useRef(documentState);
|
|
1922
|
+
documentStateRef.current = documentState;
|
|
826
1923
|
const isEmbedded = typeof window !== "undefined" && window.parent !== window;
|
|
827
1924
|
React__default.useEffect(() => {
|
|
828
1925
|
let cancelled = false;
|
|
829
1926
|
const load = async () => {
|
|
830
1927
|
setLoading(true);
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1928
|
+
try {
|
|
1929
|
+
const res2 = await apiClient.getPage(pageId);
|
|
1930
|
+
if (cancelled) return;
|
|
1931
|
+
const rawData = res2.success && res2.data?.draftData ? res2.data.draftData : null;
|
|
1932
|
+
const parsedDoc = parseDocument(rawData);
|
|
1933
|
+
setDocument(parsedDoc);
|
|
1934
|
+
} catch (err) {
|
|
1935
|
+
console.error("Failed to load page:", err);
|
|
1936
|
+
} finally {
|
|
1937
|
+
setLoading(false);
|
|
1938
|
+
}
|
|
837
1939
|
};
|
|
838
1940
|
load();
|
|
839
1941
|
return () => {
|
|
840
1942
|
cancelled = true;
|
|
841
1943
|
};
|
|
842
|
-
}, [pageId, apiClient]);
|
|
843
|
-
const
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1944
|
+
}, [pageId, apiClient, setDocument]);
|
|
1945
|
+
const isFirstRender = React__default.useRef(true);
|
|
1946
|
+
React__default.useEffect(() => {
|
|
1947
|
+
if (loading) return;
|
|
1948
|
+
if (isFirstRender.current) {
|
|
1949
|
+
isFirstRender.current = false;
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
const serialized = serializeDocument(documentState);
|
|
1953
|
+
onChange?.(serialized);
|
|
1954
|
+
if (isEmbedded) {
|
|
1955
|
+
window.parent.postMessage({ type: "puck:changed" }, "*");
|
|
1956
|
+
}
|
|
1957
|
+
}, [documentState, loading, onChange, isEmbedded]);
|
|
1958
|
+
const handleSaveDraft = React__default.useCallback(async () => {
|
|
1959
|
+
const currentDoc = documentStateRef.current;
|
|
1960
|
+
const serialized = serializeDocument(currentDoc);
|
|
1961
|
+
setSaving(true);
|
|
1962
|
+
setSaveStatus("idle");
|
|
1963
|
+
try {
|
|
1964
|
+
const res2 = await apiClient.savePage(pageId, serialized, void 0, accessToken);
|
|
851
1965
|
if (res2.success) {
|
|
852
1966
|
setSaveStatus("success");
|
|
853
1967
|
setTimeout(() => setSaveStatus("idle"), 3e3);
|
|
854
|
-
onSave?.(
|
|
855
|
-
if (isEmbedded)
|
|
1968
|
+
onSave?.(serialized);
|
|
1969
|
+
if (isEmbedded) {
|
|
1970
|
+
window.parent.postMessage({ type: "puck:saved" }, "*");
|
|
1971
|
+
}
|
|
856
1972
|
} else {
|
|
857
1973
|
setSaveStatus("error");
|
|
858
|
-
if (isEmbedded)
|
|
1974
|
+
if (isEmbedded) {
|
|
1975
|
+
window.parent.postMessage({ type: "puck:saveError", message: res2.message }, "*");
|
|
1976
|
+
}
|
|
859
1977
|
}
|
|
1978
|
+
} catch (err) {
|
|
1979
|
+
setSaveStatus("error");
|
|
1980
|
+
if (isEmbedded) {
|
|
1981
|
+
window.parent.postMessage({ type: "puck:saveError", message: err.message }, "*");
|
|
1982
|
+
}
|
|
1983
|
+
} finally {
|
|
860
1984
|
setSaving(false);
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
);
|
|
864
|
-
const handleChange = React__default.useCallback(
|
|
865
|
-
(data3) => {
|
|
866
|
-
draftDataRef.current = data3;
|
|
867
|
-
const draftData = data3;
|
|
868
|
-
onChange?.(draftData);
|
|
869
|
-
if (isEmbedded) window.parent.postMessage({ type: "puck:changed" }, "*");
|
|
870
|
-
},
|
|
871
|
-
[onChange, isEmbedded]
|
|
872
|
-
);
|
|
873
|
-
const handlePuckPublish = React__default.useCallback(
|
|
874
|
-
(data3) => {
|
|
875
|
-
handleSaveDraft(data3);
|
|
876
|
-
},
|
|
877
|
-
[handleSaveDraft]
|
|
878
|
-
);
|
|
1985
|
+
}
|
|
1986
|
+
}, [pageId, apiClient, accessToken, onSave, isEmbedded]);
|
|
879
1987
|
React__default.useEffect(() => {
|
|
880
1988
|
if (!isEmbedded) return;
|
|
881
1989
|
const onMessage = (e3) => {
|
|
882
1990
|
switch (e3.data?.type) {
|
|
883
|
-
case "puck:save":
|
|
1991
|
+
case "puck:save":
|
|
884
1992
|
handleSaveDraft();
|
|
885
1993
|
break;
|
|
886
|
-
}
|
|
887
1994
|
case "puck:undo":
|
|
888
|
-
|
|
1995
|
+
undo();
|
|
889
1996
|
break;
|
|
890
1997
|
case "puck:redo":
|
|
891
|
-
|
|
1998
|
+
redo();
|
|
892
1999
|
break;
|
|
893
|
-
case "puck:viewport":
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
2000
|
+
case "puck:viewport":
|
|
2001
|
+
if (e3.data.width) {
|
|
2002
|
+
const width = e3.data.width;
|
|
2003
|
+
if (width === "375px" || width === 375) {
|
|
2004
|
+
setViewport("mobile");
|
|
2005
|
+
} else if (width === "768px" || width === 768) {
|
|
2006
|
+
setViewport("tablet");
|
|
2007
|
+
} else {
|
|
2008
|
+
setViewport("desktop");
|
|
2009
|
+
}
|
|
900
2010
|
}
|
|
901
2011
|
break;
|
|
902
|
-
}
|
|
903
2012
|
}
|
|
904
2013
|
};
|
|
905
2014
|
window.addEventListener("message", onMessage);
|
|
906
2015
|
return () => window.removeEventListener("message", onMessage);
|
|
907
|
-
}, [isEmbedded, handleSaveDraft]);
|
|
908
|
-
React__default.
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
document.addEventListener("click", handleClick, true);
|
|
932
|
-
document.addEventListener("click", handleDeselect, false);
|
|
933
|
-
return () => {
|
|
934
|
-
document.removeEventListener("click", handleClick, true);
|
|
935
|
-
document.removeEventListener("click", handleDeselect, false);
|
|
936
|
-
};
|
|
937
|
-
}, [isEmbedded]);
|
|
938
|
-
if (loading || !initialData) {
|
|
939
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `tecof-editor-loading ${className || ""}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-editor-loading-inner", children: [
|
|
940
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-editor-spinner" }),
|
|
941
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "tecof-editor-loading-text", children: "Loading editor..." })
|
|
2016
|
+
}, [isEmbedded, handleSaveDraft, undo, redo, setViewport]);
|
|
2017
|
+
const studioContextValue = React__default.useMemo(() => ({
|
|
2018
|
+
config: config3,
|
|
2019
|
+
readOnly: false,
|
|
2020
|
+
apiClient
|
|
2021
|
+
}), [config3, apiClient]);
|
|
2022
|
+
if (loading) {
|
|
2023
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `tecof-editor-loading ${className || ""}`.trim(), style: {
|
|
2024
|
+
display: "flex",
|
|
2025
|
+
alignItems: "center",
|
|
2026
|
+
justifyContent: "center",
|
|
2027
|
+
height: "100vh",
|
|
2028
|
+
background: "#f4f4f5"
|
|
2029
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center" }, children: [
|
|
2030
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-editor-spinner", style: {
|
|
2031
|
+
width: "40px",
|
|
2032
|
+
height: "40px",
|
|
2033
|
+
border: "3px solid #e4e4e7",
|
|
2034
|
+
borderTopColor: "#3b82f6",
|
|
2035
|
+
borderRadius: "50%",
|
|
2036
|
+
animation: "spin 1s linear infinite",
|
|
2037
|
+
margin: "0 auto 16px"
|
|
2038
|
+
} }),
|
|
2039
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "#71717a", fontSize: "14px", margin: 0 }, children: "St\xFCdyo y\xFCkleniyor..." })
|
|
942
2040
|
] }) });
|
|
943
2041
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
2042
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StudioContext.Provider, { value: studioContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `tecof-studio-root ${className || ""}`.trim(), style: {
|
|
2043
|
+
display: "flex",
|
|
2044
|
+
flexDirection: "column",
|
|
2045
|
+
height: "100vh",
|
|
2046
|
+
width: "100vw",
|
|
2047
|
+
overflow: "hidden",
|
|
2048
|
+
position: "relative",
|
|
2049
|
+
background: "#f4f4f5"
|
|
2050
|
+
}, children: [
|
|
2051
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-studio-workspace-container", style: {
|
|
2052
|
+
display: "flex",
|
|
2053
|
+
flex: 1,
|
|
2054
|
+
height: "100%",
|
|
2055
|
+
width: "100%",
|
|
2056
|
+
overflow: "hidden"
|
|
2057
|
+
}, children: [
|
|
2058
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-studio-workspace", style: {
|
|
2059
|
+
display: "flex",
|
|
2060
|
+
flex: 1,
|
|
2061
|
+
height: "100%",
|
|
2062
|
+
position: "relative",
|
|
2063
|
+
overflow: "hidden"
|
|
2064
|
+
}, children: [
|
|
2065
|
+
/* @__PURE__ */ jsxRuntime.jsx(Canvas, {}),
|
|
2066
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectionOverlay, {})
|
|
2067
|
+
] }),
|
|
2068
|
+
/* @__PURE__ */ jsxRuntime.jsx(Inspector, {})
|
|
2069
|
+
] }),
|
|
2070
|
+
saving && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-editor-save-indicator", style: {
|
|
2071
|
+
position: "absolute",
|
|
2072
|
+
bottom: "24px",
|
|
2073
|
+
right: "24px",
|
|
2074
|
+
background: saveStatus === "error" ? "#ef4444" : "#18181b",
|
|
2075
|
+
color: "#ffffff",
|
|
2076
|
+
padding: "8px 16px",
|
|
2077
|
+
borderRadius: "24px",
|
|
2078
|
+
fontSize: "12px",
|
|
2079
|
+
fontWeight: 500,
|
|
2080
|
+
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1)",
|
|
2081
|
+
zIndex: 9999
|
|
2082
|
+
}, children: saveStatus === "error" ? "Kaydedilemedi" : "Kaydediliyor..." })
|
|
2083
|
+
] }) });
|
|
2084
|
+
};
|
|
2085
|
+
|
|
2086
|
+
// src/components/TecofEditor.tsx
|
|
2087
|
+
var TecofEditor = TecofStudio;
|
|
2088
|
+
var RenderContext = React__default.createContext(null);
|
|
2089
|
+
var ParentNodeContext2 = React__default.createContext(null);
|
|
2090
|
+
var RenderDropZone = ({ zone, className, style }) => {
|
|
2091
|
+
const parentId = React__default.useContext(ParentNodeContext2);
|
|
2092
|
+
const zoneKey = parentId ? `${parentId}:${zone}` : zone;
|
|
2093
|
+
const context = React__default.useContext(RenderContext);
|
|
2094
|
+
if (!context) return null;
|
|
2095
|
+
const items = context.zones[zoneKey] || [];
|
|
2096
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, style, children: items.map((item2, index2) => /* @__PURE__ */ jsxRuntime.jsx(RenderNode, { node: item2, index: index2 }, item2.props.id || index2)) });
|
|
2097
|
+
};
|
|
2098
|
+
var RenderNode = ({ node, index: index2 }) => {
|
|
2099
|
+
const context = React__default.useContext(RenderContext);
|
|
2100
|
+
if (!context) return null;
|
|
2101
|
+
const componentConfig = context.config.components[node.type];
|
|
2102
|
+
if (!componentConfig) return null;
|
|
2103
|
+
const componentProps = {
|
|
2104
|
+
...node.props,
|
|
2105
|
+
puck: {
|
|
2106
|
+
renderDropZone: RenderDropZone,
|
|
2107
|
+
isEditing: false,
|
|
2108
|
+
metadata: {
|
|
2109
|
+
cmsData: context.cmsData || null,
|
|
2110
|
+
...componentConfig.metadata || {}
|
|
990
2111
|
}
|
|
991
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ComponentDrawerItem, { name: name3, apiClient, children });
|
|
992
|
-
},
|
|
993
|
-
actionBar: ({ children, label }) => {
|
|
994
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CustomActionBar, { label, children });
|
|
995
2112
|
},
|
|
996
|
-
|
|
997
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
998
|
-
/* @__PURE__ */ jsxRuntime.jsx(AutoFieldsOnSelect, {}),
|
|
999
|
-
children
|
|
1000
|
-
] });
|
|
1001
|
-
},
|
|
1002
|
-
...overrides || {}
|
|
2113
|
+
editMode: false
|
|
1003
2114
|
};
|
|
1004
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1005
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1006
|
-
core.Puck,
|
|
1007
|
-
{
|
|
1008
|
-
plugins,
|
|
1009
|
-
config: config3,
|
|
1010
|
-
data: initialData,
|
|
1011
|
-
onPublish: handlePuckPublish,
|
|
1012
|
-
onChange: handleChange,
|
|
1013
|
-
overrides: mergedOverrides,
|
|
1014
|
-
metadata: { editMode: true }
|
|
1015
|
-
}
|
|
1016
|
-
),
|
|
1017
|
-
saving && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-editor-save-indicator", children: saveStatus === "error" ? "Save failed" : "Saving..." })
|
|
1018
|
-
] });
|
|
2115
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ParentNodeContext2.Provider, { value: node.props.id || null, children: componentConfig.render(componentProps) });
|
|
1019
2116
|
};
|
|
1020
2117
|
var TecofRender = ({ data: data3, config: config3, className, cmsData }) => {
|
|
1021
2118
|
if (!data3) return null;
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
}
|
|
1029
|
-
) });
|
|
2119
|
+
const contextValue = {
|
|
2120
|
+
zones: data3.zones || {},
|
|
2121
|
+
config: config3,
|
|
2122
|
+
cmsData: cmsData || null
|
|
2123
|
+
};
|
|
2124
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RenderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: data3.content.map((item2, index2) => /* @__PURE__ */ jsxRuntime.jsx(RenderNode, { node: item2, index: index2 }, item2.props.id || index2)) }) });
|
|
1030
2125
|
};
|
|
1031
2126
|
var IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "svg", "avif", "bmp", "tiff", "heic"];
|
|
1032
2127
|
var VIDEO_EXTENSIONS = ["mp4", "webm", "ogg", "avi", "mov", "quicktime"];
|
|
@@ -1729,7 +2824,7 @@ var createLanguageField = (options = {}) => {
|
|
|
1729
2824
|
label,
|
|
1730
2825
|
labelIcon,
|
|
1731
2826
|
visible,
|
|
1732
|
-
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2827
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1733
2828
|
LanguageField,
|
|
1734
2829
|
{
|
|
1735
2830
|
field,
|
|
@@ -5659,7 +6754,7 @@ var createEditorField = (options = {}) => {
|
|
|
5659
6754
|
label,
|
|
5660
6755
|
labelIcon,
|
|
5661
6756
|
visible,
|
|
5662
|
-
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6757
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5663
6758
|
EditorField,
|
|
5664
6759
|
{
|
|
5665
6760
|
field,
|
|
@@ -6248,7 +7343,7 @@ var createView = (
|
|
|
6248
7343
|
},
|
|
6249
7344
|
write: write2 = () => {
|
|
6250
7345
|
},
|
|
6251
|
-
create:
|
|
7346
|
+
create: create5 = () => {
|
|
6252
7347
|
},
|
|
6253
7348
|
destroy: destroy3 = () => {
|
|
6254
7349
|
},
|
|
@@ -6452,7 +7547,7 @@ var createView = (
|
|
|
6452
7547
|
}
|
|
6453
7548
|
});
|
|
6454
7549
|
const internalAPI = createObject(internalAPIDefinition);
|
|
6455
|
-
|
|
7550
|
+
create5({
|
|
6456
7551
|
root: internalAPI,
|
|
6457
7552
|
props
|
|
6458
7553
|
});
|
|
@@ -9182,7 +10277,7 @@ var percentageArc = (x, y, radius, from, to) => {
|
|
|
9182
10277
|
arcSweep
|
|
9183
10278
|
);
|
|
9184
10279
|
};
|
|
9185
|
-
var
|
|
10280
|
+
var create2 = ({ root: root3, props }) => {
|
|
9186
10281
|
props.spin = false;
|
|
9187
10282
|
props.progress = 0;
|
|
9188
10283
|
props.opacity = 0;
|
|
@@ -9222,7 +10317,7 @@ var progressIndicator = createView({
|
|
|
9222
10317
|
name: "progress-indicator",
|
|
9223
10318
|
ignoreRectUpdate: true,
|
|
9224
10319
|
ignoreRect: true,
|
|
9225
|
-
create,
|
|
10320
|
+
create: create2,
|
|
9226
10321
|
write,
|
|
9227
10322
|
mixins: {
|
|
9228
10323
|
apis: ["progress", "spin", "align"],
|
|
@@ -14062,7 +15157,7 @@ var createImageWrapperView = (_2) => {
|
|
|
14062
15157
|
root3.ref.overlayShadow.opacity = 0.25;
|
|
14063
15158
|
root3.ref.overlaySuccess.opacity = 1;
|
|
14064
15159
|
};
|
|
14065
|
-
const
|
|
15160
|
+
const create5 = ({ root: root3 }) => {
|
|
14066
15161
|
root3.ref.images = [];
|
|
14067
15162
|
root3.ref.imageData = null;
|
|
14068
15163
|
root3.ref.imageViewBin = [];
|
|
@@ -14087,7 +15182,7 @@ var createImageWrapperView = (_2) => {
|
|
|
14087
15182
|
};
|
|
14088
15183
|
return _2.utils.createView({
|
|
14089
15184
|
name: "image-preview-wrapper",
|
|
14090
|
-
create:
|
|
15185
|
+
create: create5,
|
|
14091
15186
|
styles: ["height"],
|
|
14092
15187
|
apis: ["height"],
|
|
14093
15188
|
destroy: ({ root: root3 }) => {
|
|
@@ -15897,7 +16992,7 @@ var plugin7 = ({ addFilter: addFilter2, utils }) => {
|
|
|
15897
16992
|
}).catch(reject);
|
|
15898
16993
|
});
|
|
15899
16994
|
const variantPromises = variants.map(
|
|
15900
|
-
(
|
|
16995
|
+
(create5) => create5(transform, file2, item2.getMetadata())
|
|
15901
16996
|
);
|
|
15902
16997
|
Promise.all(variantPromises).then((files) => {
|
|
15903
16998
|
resolve(
|
|
@@ -19237,7 +20332,7 @@ var createTexture = function(e3, t2, r2, n, i2) {
|
|
|
19237
20332
|
}
|
|
19238
20333
|
return o2;
|
|
19239
20334
|
};
|
|
19240
|
-
var
|
|
20335
|
+
var create3 = function() {
|
|
19241
20336
|
var e3 = new Float32Array(16);
|
|
19242
20337
|
return e3[0] = 1, e3[5] = 1, e3[10] = 1, e3[15] = 1, e3;
|
|
19243
20338
|
};
|
|
@@ -19265,7 +20360,7 @@ var rotateZ = function(e3, t2) {
|
|
|
19265
20360
|
var r2 = Math.sin(t2), n = Math.cos(t2), i2 = e3[0], o2 = e3[1], a2 = e3[2], c2 = e3[3], l3 = e3[4], u = e3[5], s2 = e3[6], d = e3[7];
|
|
19266
20361
|
e3[0] = i2 * n + l3 * r2, e3[1] = o2 * n + u * r2, e3[2] = a2 * n + s2 * r2, e3[3] = c2 * n + d * r2, e3[4] = l3 * n - i2 * r2, e3[5] = u * n - o2 * r2, e3[6] = s2 * n - a2 * r2, e3[7] = d * n - c2 * r2;
|
|
19267
20362
|
};
|
|
19268
|
-
var mat4 = { create:
|
|
20363
|
+
var mat4 = { create: create3, perspective, translate, scale, rotateX, rotateY, rotateZ };
|
|
19269
20364
|
var degToRad = function(e3) {
|
|
19270
20365
|
return e3 * Math.PI / 180;
|
|
19271
20366
|
};
|
|
@@ -23622,7 +24717,7 @@ var createUploadField = (options = {}) => {
|
|
|
23622
24717
|
label,
|
|
23623
24718
|
labelIcon,
|
|
23624
24719
|
visible,
|
|
23625
|
-
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24720
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23626
24721
|
UploadField,
|
|
23627
24722
|
{
|
|
23628
24723
|
field,
|
|
@@ -23860,7 +24955,7 @@ var validators = {
|
|
|
23860
24955
|
handler: validateHandler,
|
|
23861
24956
|
initial: validateInitial
|
|
23862
24957
|
};
|
|
23863
|
-
function
|
|
24958
|
+
function create4(initial) {
|
|
23864
24959
|
var handler = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
23865
24960
|
validators.initial(initial);
|
|
23866
24961
|
validators.handler(handler);
|
|
@@ -23898,7 +24993,7 @@ function didStateUpdate(state3, handler, changes) {
|
|
|
23898
24993
|
return changes;
|
|
23899
24994
|
}
|
|
23900
24995
|
var index = {
|
|
23901
|
-
create:
|
|
24996
|
+
create: create4
|
|
23902
24997
|
};
|
|
23903
24998
|
var state_local_default = index;
|
|
23904
24999
|
|
|
@@ -24317,7 +25412,7 @@ var createCodeEditorField = (options = {}) => {
|
|
|
24317
25412
|
label,
|
|
24318
25413
|
labelIcon,
|
|
24319
25414
|
visible,
|
|
24320
|
-
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25415
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24321
25416
|
CodeEditorField,
|
|
24322
25417
|
{
|
|
24323
25418
|
field,
|
|
@@ -24564,7 +25659,7 @@ var createLinkField = (options = {}) => {
|
|
|
24564
25659
|
label,
|
|
24565
25660
|
labelIcon,
|
|
24566
25661
|
visible,
|
|
24567
|
-
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25662
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24568
25663
|
LinkField,
|
|
24569
25664
|
{
|
|
24570
25665
|
field,
|
|
@@ -24765,7 +25860,7 @@ var createColorField = (options = {}) => {
|
|
|
24765
25860
|
label,
|
|
24766
25861
|
labelIcon,
|
|
24767
25862
|
visible,
|
|
24768
|
-
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25863
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24769
25864
|
ColorField,
|
|
24770
25865
|
{
|
|
24771
25866
|
field,
|
|
@@ -25067,7 +26162,7 @@ var createRepeaterField = (options) => {
|
|
|
25067
26162
|
label,
|
|
25068
26163
|
labelIcon,
|
|
25069
26164
|
visible,
|
|
25070
|
-
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
26165
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25071
26166
|
RepeaterField,
|
|
25072
26167
|
{
|
|
25073
26168
|
field,
|
|
@@ -25368,7 +26463,7 @@ var createCmsCollectionField = (options = {}) => {
|
|
|
25368
26463
|
label,
|
|
25369
26464
|
labelIcon,
|
|
25370
26465
|
visible,
|
|
25371
|
-
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
26466
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25372
26467
|
CmsCollectionField,
|
|
25373
26468
|
{
|
|
25374
26469
|
field,
|
|
@@ -25545,6 +26640,7 @@ lucide-react/dist/esm/icons/arrow-up.js:
|
|
|
25545
26640
|
lucide-react/dist/esm/icons/check.js:
|
|
25546
26641
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
25547
26642
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
26643
|
+
lucide-react/dist/esm/icons/chevron-up.js:
|
|
25548
26644
|
lucide-react/dist/esm/icons/code.js:
|
|
25549
26645
|
lucide-react/dist/esm/icons/copy.js:
|
|
25550
26646
|
lucide-react/dist/esm/icons/database.js:
|
|
@@ -25665,6 +26761,7 @@ exports.TecofEditor = TecofEditor;
|
|
|
25665
26761
|
exports.TecofPicture = TecofPicture;
|
|
25666
26762
|
exports.TecofProvider = TecofProvider;
|
|
25667
26763
|
exports.TecofRender = TecofRender;
|
|
26764
|
+
exports.TecofStudio = TecofStudio;
|
|
25668
26765
|
exports.UnderConstruction = UnderConstruction;
|
|
25669
26766
|
exports.UploadField = UploadField;
|
|
25670
26767
|
exports.createCmsCollectionField = createCmsCollectionField;
|