@tecof/theme-editor 0.0.33 → 0.0.35
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2533 -1045
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2527 -1040
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +430 -230
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import * as React__default from 'react';
|
|
2
|
-
import React__default__default, { createContext,
|
|
2
|
+
import React__default__default, { createContext, forwardRef, createElement, memo, useRef, useCallback, useContext, useState, useEffect, useMemo, Component, useLayoutEffect } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { blocksPlugin, outlinePlugin, fieldsPlugin, Puck, Render,
|
|
4
|
+
import { blocksPlugin, outlinePlugin, fieldsPlugin, Puck, Render, usePuck, ActionBar } from '@puckeditor/core';
|
|
5
|
+
import { create } from 'zustand';
|
|
6
|
+
import { immer } from 'zustand/middleware/immer';
|
|
7
|
+
import { nanoid } from 'nanoid';
|
|
8
|
+
import * as ReactDOM from 'react-dom';
|
|
9
|
+
import ReactDOM__default, { createPortal } from 'react-dom';
|
|
5
10
|
import { useEditor, EditorContent } from '@tiptap/react';
|
|
6
11
|
import Document from '@tiptap/extension-document';
|
|
7
12
|
import Paragraph from '@tiptap/extension-paragraph';
|
|
@@ -20,8 +25,6 @@ import Link3 from '@tiptap/extension-link';
|
|
|
20
25
|
import Code2 from '@tiptap/extension-code';
|
|
21
26
|
import CodeBlock from '@tiptap/extension-code-block';
|
|
22
27
|
import Image3 from '@tiptap/extension-image';
|
|
23
|
-
import * as ReactDOM from 'react-dom';
|
|
24
|
-
import ReactDOM__default from 'react-dom';
|
|
25
28
|
|
|
26
29
|
// src/components/TecofProvider.tsx
|
|
27
30
|
|
|
@@ -294,952 +297,2531 @@ function useTecof() {
|
|
|
294
297
|
}
|
|
295
298
|
return ctx;
|
|
296
299
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
} else {
|
|
317
|
-
setError(true);
|
|
318
|
-
}
|
|
319
|
-
} catch {
|
|
320
|
-
setError(true);
|
|
321
|
-
} finally {
|
|
322
|
-
setLoading(false);
|
|
323
|
-
}
|
|
324
|
-
}, [name3, apiClient]);
|
|
325
|
-
return /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-item-group group", onMouseEnter: handleMouseEnter, children: [
|
|
326
|
-
children,
|
|
327
|
-
/* @__PURE__ */ jsxs("div", { className: "tecof-drawer-popover", children: [
|
|
328
|
-
/* @__PURE__ */ jsxs("div", { className: "tecof-drawer-popover-header", children: [
|
|
329
|
-
name3,
|
|
330
|
-
" \xD6nizleme"
|
|
331
|
-
] }),
|
|
332
|
-
/* @__PURE__ */ jsxs("div", { className: "tecof-drawer-popover-body", children: [
|
|
333
|
-
(loading || !imgSrc && !error2) && /* @__PURE__ */ jsx("div", { className: "tecof-drawer-skeleton" }),
|
|
334
|
-
imgSrc && /* @__PURE__ */ jsx(
|
|
335
|
-
"img",
|
|
336
|
-
{
|
|
337
|
-
src: imgSrc,
|
|
338
|
-
alt: `${name3} preview`,
|
|
339
|
-
className: "tecof-drawer-img"
|
|
340
|
-
}
|
|
341
|
-
),
|
|
342
|
-
error2 && /* @__PURE__ */ jsx("div", { className: "tecof-drawer-preview-error", children: "\xD6nizleme y\xFCklenemedi" })
|
|
343
|
-
] })
|
|
344
|
-
] })
|
|
345
|
-
] });
|
|
300
|
+
|
|
301
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
|
302
|
+
var mergeClasses = (...classes) => classes.filter((className, index2, array) => {
|
|
303
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
|
|
304
|
+
}).join(" ").trim();
|
|
305
|
+
|
|
306
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.js
|
|
307
|
+
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
308
|
+
|
|
309
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.js
|
|
310
|
+
var toCamelCase = (string) => string.replace(
|
|
311
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
312
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.js
|
|
316
|
+
var toPascalCase = (string) => {
|
|
317
|
+
const camelCase = toCamelCase(string);
|
|
318
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
346
319
|
};
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
const [loading, setLoading] = useState(true);
|
|
360
|
-
const [saving, setSaving] = useState(false);
|
|
361
|
-
const [saveStatus, setSaveStatus] = useState("idle");
|
|
362
|
-
const draftDataRef = useRef(null);
|
|
363
|
-
const isEmbedded = typeof window !== "undefined" && window.parent !== window;
|
|
364
|
-
useEffect(() => {
|
|
365
|
-
let cancelled = false;
|
|
366
|
-
const load = async () => {
|
|
367
|
-
setLoading(true);
|
|
368
|
-
const res2 = await apiClient.getPage(pageId);
|
|
369
|
-
if (cancelled) return;
|
|
370
|
-
const data3 = res2.success && res2.data?.draftData ? res2.data.draftData : EMPTY_PAGE;
|
|
371
|
-
setInitialData(data3);
|
|
372
|
-
draftDataRef.current = data3;
|
|
373
|
-
setLoading(false);
|
|
374
|
-
};
|
|
375
|
-
load();
|
|
376
|
-
return () => {
|
|
377
|
-
cancelled = true;
|
|
378
|
-
};
|
|
379
|
-
}, [pageId, apiClient]);
|
|
380
|
-
const handleSaveDraft = useCallback(
|
|
381
|
-
async (data3) => {
|
|
382
|
-
const currentData = data3 || draftDataRef.current;
|
|
383
|
-
if (!currentData) return;
|
|
384
|
-
const draftData = currentData;
|
|
385
|
-
setSaving(true);
|
|
386
|
-
setSaveStatus("idle");
|
|
387
|
-
const res2 = await apiClient.savePage(pageId, draftData, void 0, accessToken);
|
|
388
|
-
if (res2.success) {
|
|
389
|
-
setSaveStatus("success");
|
|
390
|
-
setTimeout(() => setSaveStatus("idle"), 3e3);
|
|
391
|
-
onSave?.(draftData);
|
|
392
|
-
if (isEmbedded) window.parent.postMessage({ type: "puck:saved" }, "*");
|
|
393
|
-
} else {
|
|
394
|
-
setSaveStatus("error");
|
|
395
|
-
if (isEmbedded) window.parent.postMessage({ type: "puck:saveError", message: res2.message }, "*");
|
|
396
|
-
}
|
|
397
|
-
setSaving(false);
|
|
398
|
-
},
|
|
399
|
-
[pageId, apiClient, isEmbedded, onSave, accessToken]
|
|
400
|
-
);
|
|
401
|
-
const handleChange = useCallback(
|
|
402
|
-
(data3) => {
|
|
403
|
-
draftDataRef.current = data3;
|
|
404
|
-
const draftData = data3;
|
|
405
|
-
onChange?.(draftData);
|
|
406
|
-
if (isEmbedded) window.parent.postMessage({ type: "puck:changed" }, "*");
|
|
407
|
-
},
|
|
408
|
-
[onChange, isEmbedded]
|
|
409
|
-
);
|
|
410
|
-
const handlePuckPublish = useCallback(
|
|
411
|
-
(data3) => {
|
|
412
|
-
handleSaveDraft(data3);
|
|
413
|
-
},
|
|
414
|
-
[handleSaveDraft]
|
|
415
|
-
);
|
|
416
|
-
useEffect(() => {
|
|
417
|
-
if (!isEmbedded) return;
|
|
418
|
-
const onMessage = (e3) => {
|
|
419
|
-
switch (e3.data?.type) {
|
|
420
|
-
case "puck:save": {
|
|
421
|
-
handleSaveDraft();
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
case "puck:undo":
|
|
425
|
-
document.dispatchEvent(new KeyboardEvent("keydown", { key: "z", code: "KeyZ", ctrlKey: true, bubbles: true }));
|
|
426
|
-
break;
|
|
427
|
-
case "puck:redo":
|
|
428
|
-
document.dispatchEvent(new KeyboardEvent("keydown", { key: "z", code: "KeyZ", ctrlKey: true, shiftKey: true, bubbles: true }));
|
|
429
|
-
break;
|
|
430
|
-
case "puck:viewport": {
|
|
431
|
-
const frame = document.querySelector('[data-testid="puck-frame"]');
|
|
432
|
-
if (frame) {
|
|
433
|
-
const w = e3.data.width || "100%";
|
|
434
|
-
frame.style.maxWidth = w;
|
|
435
|
-
frame.style.margin = w === "100%" ? "0" : "0 auto";
|
|
436
|
-
frame.style.transition = "max-width 0.3s ease";
|
|
437
|
-
}
|
|
438
|
-
break;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
window.addEventListener("message", onMessage);
|
|
443
|
-
return () => window.removeEventListener("message", onMessage);
|
|
444
|
-
}, [isEmbedded, handleSaveDraft]);
|
|
445
|
-
useEffect(() => {
|
|
446
|
-
if (!isEmbedded) return;
|
|
447
|
-
const handleClick = (e3) => {
|
|
448
|
-
const target = e3.target;
|
|
449
|
-
const puckComponent = target.closest("[data-puck-component]");
|
|
450
|
-
if (puckComponent) {
|
|
451
|
-
const componentType = puckComponent.getAttribute("data-puck-component");
|
|
452
|
-
const draggableId = puckComponent.closest("[data-rfd-draggable-id]")?.getAttribute("data-rfd-draggable-id");
|
|
453
|
-
window.parent.postMessage({
|
|
454
|
-
type: "puck:itemSelected",
|
|
455
|
-
item: {
|
|
456
|
-
type: componentType,
|
|
457
|
-
id: draggableId || null
|
|
458
|
-
}
|
|
459
|
-
}, "*");
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
const handleDeselect = (e3) => {
|
|
463
|
-
const target = e3.target;
|
|
464
|
-
if (!target.closest("[data-puck-component]")) {
|
|
465
|
-
window.parent.postMessage({ type: "puck:itemDeselected" }, "*");
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
document.addEventListener("click", handleClick, true);
|
|
469
|
-
document.addEventListener("click", handleDeselect, false);
|
|
470
|
-
return () => {
|
|
471
|
-
document.removeEventListener("click", handleClick, true);
|
|
472
|
-
document.removeEventListener("click", handleDeselect, false);
|
|
473
|
-
};
|
|
474
|
-
}, [isEmbedded]);
|
|
475
|
-
if (loading || !initialData) {
|
|
476
|
-
return /* @__PURE__ */ jsx("div", { className: `tecof-editor-loading ${className || ""}`.trim(), children: /* @__PURE__ */ jsxs("div", { className: "tecof-editor-loading-inner", children: [
|
|
477
|
-
/* @__PURE__ */ jsx("div", { className: "tecof-editor-spinner" }),
|
|
478
|
-
/* @__PURE__ */ jsx("p", { className: "tecof-editor-loading-text", children: "Loading editor..." })
|
|
479
|
-
] }) });
|
|
480
|
-
}
|
|
481
|
-
const plugins = [
|
|
482
|
-
{ ...blocksPlugin(), label: "Bloklar" },
|
|
483
|
-
{ ...outlinePlugin(), label: "Anahat" },
|
|
484
|
-
{ ...fieldsPlugin({ desktopSideBar: "right" }), label: "Alanlar" },
|
|
485
|
-
...extraPlugins || []
|
|
486
|
-
];
|
|
487
|
-
const mergedOverrides = {
|
|
488
|
-
header: () => /* @__PURE__ */ jsx(Fragment, {}),
|
|
489
|
-
drawerItem: ({ children, name: name3 }) => {
|
|
490
|
-
return /* @__PURE__ */ jsx(ComponentDrawerItem, { name: name3, apiClient, children });
|
|
491
|
-
},
|
|
492
|
-
...overrides || {}
|
|
493
|
-
};
|
|
494
|
-
return /* @__PURE__ */ jsxs("div", { className: `tecof-editor-wrapper ${className || ""}`.trim(), children: [
|
|
495
|
-
/* @__PURE__ */ jsx(
|
|
496
|
-
Puck,
|
|
497
|
-
{
|
|
498
|
-
plugins,
|
|
499
|
-
config: config3,
|
|
500
|
-
data: initialData,
|
|
501
|
-
onPublish: handlePuckPublish,
|
|
502
|
-
onChange: handleChange,
|
|
503
|
-
overrides: mergedOverrides,
|
|
504
|
-
metadata: { editMode: true }
|
|
505
|
-
}
|
|
506
|
-
),
|
|
507
|
-
saving && /* @__PURE__ */ jsx("div", { className: "tecof-editor-save-indicator", children: saveStatus === "error" ? "Save failed" : "Saving..." })
|
|
508
|
-
] });
|
|
320
|
+
|
|
321
|
+
// node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
322
|
+
var defaultAttributes = {
|
|
323
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
324
|
+
width: 24,
|
|
325
|
+
height: 24,
|
|
326
|
+
viewBox: "0 0 24 24",
|
|
327
|
+
fill: "none",
|
|
328
|
+
stroke: "currentColor",
|
|
329
|
+
strokeWidth: 2,
|
|
330
|
+
strokeLinecap: "round",
|
|
331
|
+
strokeLinejoin: "round"
|
|
509
332
|
};
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
{
|
|
515
|
-
|
|
516
|
-
data: data3,
|
|
517
|
-
metadata: { cmsData: cmsData || null }
|
|
333
|
+
|
|
334
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.js
|
|
335
|
+
var hasA11yProp = (props) => {
|
|
336
|
+
for (const prop in props) {
|
|
337
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
338
|
+
return true;
|
|
518
339
|
}
|
|
519
|
-
|
|
340
|
+
}
|
|
341
|
+
return false;
|
|
520
342
|
};
|
|
521
|
-
var
|
|
522
|
-
var
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
343
|
+
var LucideContext = createContext({});
|
|
344
|
+
var useLucideContext = () => useContext(LucideContext);
|
|
345
|
+
|
|
346
|
+
// node_modules/lucide-react/dist/esm/Icon.js
|
|
347
|
+
var Icon = forwardRef(
|
|
348
|
+
({ color, size, strokeWidth, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref) => {
|
|
349
|
+
const {
|
|
350
|
+
size: contextSize = 24,
|
|
351
|
+
strokeWidth: contextStrokeWidth = 2,
|
|
352
|
+
absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
|
|
353
|
+
color: contextColor = "currentColor",
|
|
354
|
+
className: contextClass = ""
|
|
355
|
+
} = useLucideContext() ?? {};
|
|
356
|
+
const calculatedStrokeWidth = absoluteStrokeWidth ?? contextAbsoluteStrokeWidth ? Number(strokeWidth ?? contextStrokeWidth) * 24 / Number(size ?? contextSize) : strokeWidth ?? contextStrokeWidth;
|
|
357
|
+
return createElement(
|
|
358
|
+
"svg",
|
|
359
|
+
{
|
|
360
|
+
ref,
|
|
361
|
+
...defaultAttributes,
|
|
362
|
+
width: size ?? contextSize ?? defaultAttributes.width,
|
|
363
|
+
height: size ?? contextSize ?? defaultAttributes.height,
|
|
364
|
+
stroke: color ?? contextColor,
|
|
365
|
+
strokeWidth: calculatedStrokeWidth,
|
|
366
|
+
className: mergeClasses("lucide", contextClass, className),
|
|
367
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
368
|
+
...rest
|
|
369
|
+
},
|
|
370
|
+
[
|
|
371
|
+
...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
|
|
372
|
+
...Array.isArray(children) ? children : [children]
|
|
373
|
+
]
|
|
374
|
+
);
|
|
543
375
|
}
|
|
376
|
+
);
|
|
377
|
+
|
|
378
|
+
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
379
|
+
var createLucideIcon = (iconName, iconNode) => {
|
|
380
|
+
const Component2 = forwardRef(
|
|
381
|
+
({ className, ...props }, ref) => createElement(Icon, {
|
|
382
|
+
ref,
|
|
383
|
+
iconNode,
|
|
384
|
+
className: mergeClasses(
|
|
385
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
386
|
+
`lucide-${iconName}`,
|
|
387
|
+
className
|
|
388
|
+
),
|
|
389
|
+
...props
|
|
390
|
+
})
|
|
391
|
+
);
|
|
392
|
+
Component2.displayName = toPascalCase(iconName);
|
|
393
|
+
return Component2;
|
|
544
394
|
};
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
395
|
+
|
|
396
|
+
// node_modules/lucide-react/dist/esm/icons/arrow-down.js
|
|
397
|
+
var __iconNode = [
|
|
398
|
+
["path", { d: "M12 5v14", key: "s699le" }],
|
|
399
|
+
["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
|
|
400
|
+
];
|
|
401
|
+
var ArrowDown = createLucideIcon("arrow-down", __iconNode);
|
|
402
|
+
|
|
403
|
+
// node_modules/lucide-react/dist/esm/icons/arrow-up.js
|
|
404
|
+
var __iconNode2 = [
|
|
405
|
+
["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
|
|
406
|
+
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
407
|
+
];
|
|
408
|
+
var ArrowUp = createLucideIcon("arrow-up", __iconNode2);
|
|
409
|
+
|
|
410
|
+
// node_modules/lucide-react/dist/esm/icons/check.js
|
|
411
|
+
var __iconNode3 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
412
|
+
var Check = createLucideIcon("check", __iconNode3);
|
|
413
|
+
|
|
414
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-down.js
|
|
415
|
+
var __iconNode4 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
416
|
+
var ChevronDown = createLucideIcon("chevron-down", __iconNode4);
|
|
417
|
+
|
|
418
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
419
|
+
var __iconNode5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
420
|
+
var ChevronRight = createLucideIcon("chevron-right", __iconNode5);
|
|
421
|
+
|
|
422
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-up.js
|
|
423
|
+
var __iconNode6 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
424
|
+
var ChevronUp = createLucideIcon("chevron-up", __iconNode6);
|
|
425
|
+
|
|
426
|
+
// node_modules/lucide-react/dist/esm/icons/code.js
|
|
427
|
+
var __iconNode7 = [
|
|
428
|
+
["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
|
|
429
|
+
["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
|
|
430
|
+
];
|
|
431
|
+
var Code = createLucideIcon("code", __iconNode7);
|
|
432
|
+
|
|
433
|
+
// node_modules/lucide-react/dist/esm/icons/copy.js
|
|
434
|
+
var __iconNode8 = [
|
|
435
|
+
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
436
|
+
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
437
|
+
];
|
|
438
|
+
var Copy = createLucideIcon("copy", __iconNode8);
|
|
439
|
+
|
|
440
|
+
// node_modules/lucide-react/dist/esm/icons/database.js
|
|
441
|
+
var __iconNode9 = [
|
|
442
|
+
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
|
|
443
|
+
["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
|
|
444
|
+
["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
|
|
445
|
+
];
|
|
446
|
+
var Database = createLucideIcon("database", __iconNode9);
|
|
447
|
+
|
|
448
|
+
// node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
449
|
+
var __iconNode10 = [
|
|
450
|
+
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
451
|
+
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
452
|
+
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
453
|
+
];
|
|
454
|
+
var ExternalLink = createLucideIcon("external-link", __iconNode10);
|
|
455
|
+
|
|
456
|
+
// node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
457
|
+
var __iconNode11 = [
|
|
458
|
+
[
|
|
459
|
+
"path",
|
|
579
460
|
{
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
loop: true,
|
|
583
|
-
muted: true,
|
|
584
|
-
playsInline: true,
|
|
585
|
-
className: `tecof-picture-video ${imgClassName || ""}`.trim(),
|
|
586
|
-
style: imgStyle
|
|
461
|
+
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
462
|
+
key: "1oefj6"
|
|
587
463
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
464
|
+
],
|
|
465
|
+
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
|
|
466
|
+
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
467
|
+
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
468
|
+
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
469
|
+
];
|
|
470
|
+
var FileText = createLucideIcon("file-text", __iconNode11);
|
|
471
|
+
|
|
472
|
+
// node_modules/lucide-react/dist/esm/icons/file.js
|
|
473
|
+
var __iconNode12 = [
|
|
474
|
+
[
|
|
475
|
+
"path",
|
|
476
|
+
{
|
|
477
|
+
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
478
|
+
key: "1oefj6"
|
|
479
|
+
}
|
|
480
|
+
],
|
|
481
|
+
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
|
|
482
|
+
];
|
|
483
|
+
var File2 = createLucideIcon("file", __iconNode12);
|
|
484
|
+
|
|
485
|
+
// node_modules/lucide-react/dist/esm/icons/folder-open.js
|
|
486
|
+
var __iconNode13 = [
|
|
487
|
+
[
|
|
488
|
+
"path",
|
|
489
|
+
{
|
|
490
|
+
d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
|
|
491
|
+
key: "usdka0"
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
];
|
|
495
|
+
var FolderOpen = createLucideIcon("folder-open", __iconNode13);
|
|
496
|
+
|
|
497
|
+
// node_modules/lucide-react/dist/esm/icons/globe.js
|
|
498
|
+
var __iconNode14 = [
|
|
499
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
500
|
+
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
501
|
+
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
502
|
+
];
|
|
503
|
+
var Globe = createLucideIcon("globe", __iconNode14);
|
|
504
|
+
|
|
505
|
+
// node_modules/lucide-react/dist/esm/icons/grip-vertical.js
|
|
506
|
+
var __iconNode15 = [
|
|
507
|
+
["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
|
|
508
|
+
["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
|
|
509
|
+
["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
|
|
510
|
+
["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
|
|
511
|
+
["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
|
|
512
|
+
["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
|
|
513
|
+
];
|
|
514
|
+
var GripVertical = createLucideIcon("grip-vertical", __iconNode15);
|
|
515
|
+
|
|
516
|
+
// node_modules/lucide-react/dist/esm/icons/image-plus.js
|
|
517
|
+
var __iconNode16 = [
|
|
518
|
+
["path", { d: "M16 5h6", key: "1vod17" }],
|
|
519
|
+
["path", { d: "M19 2v6", key: "4bpg5p" }],
|
|
520
|
+
["path", { d: "M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5", key: "1ue2ih" }],
|
|
521
|
+
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
|
|
522
|
+
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
|
|
523
|
+
];
|
|
524
|
+
var ImagePlus = createLucideIcon("image-plus", __iconNode16);
|
|
525
|
+
|
|
526
|
+
// node_modules/lucide-react/dist/esm/icons/image.js
|
|
527
|
+
var __iconNode17 = [
|
|
528
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
529
|
+
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
530
|
+
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
531
|
+
];
|
|
532
|
+
var Image2 = createLucideIcon("image", __iconNode17);
|
|
533
|
+
|
|
534
|
+
// node_modules/lucide-react/dist/esm/icons/languages.js
|
|
535
|
+
var __iconNode18 = [
|
|
536
|
+
["path", { d: "m5 8 6 6", key: "1wu5hv" }],
|
|
537
|
+
["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
|
|
538
|
+
["path", { d: "M2 5h12", key: "or177f" }],
|
|
539
|
+
["path", { d: "M7 2h1", key: "1t2jsx" }],
|
|
540
|
+
["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
|
|
541
|
+
["path", { d: "M14 18h6", key: "1m8k6r" }]
|
|
542
|
+
];
|
|
543
|
+
var Languages = createLucideIcon("languages", __iconNode18);
|
|
544
|
+
|
|
545
|
+
// node_modules/lucide-react/dist/esm/icons/link-2.js
|
|
546
|
+
var __iconNode19 = [
|
|
547
|
+
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
548
|
+
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
549
|
+
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
550
|
+
];
|
|
551
|
+
var Link2 = createLucideIcon("link-2", __iconNode19);
|
|
552
|
+
|
|
553
|
+
// node_modules/lucide-react/dist/esm/icons/link.js
|
|
554
|
+
var __iconNode20 = [
|
|
555
|
+
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
556
|
+
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
557
|
+
];
|
|
558
|
+
var Link = createLucideIcon("link", __iconNode20);
|
|
559
|
+
|
|
560
|
+
// node_modules/lucide-react/dist/esm/icons/loader-circle.js
|
|
561
|
+
var __iconNode21 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
|
|
562
|
+
var LoaderCircle = createLucideIcon("loader-circle", __iconNode21);
|
|
563
|
+
|
|
564
|
+
// node_modules/lucide-react/dist/esm/icons/pencil.js
|
|
565
|
+
var __iconNode22 = [
|
|
566
|
+
[
|
|
567
|
+
"path",
|
|
568
|
+
{
|
|
569
|
+
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
570
|
+
key: "1a8usu"
|
|
571
|
+
}
|
|
572
|
+
],
|
|
573
|
+
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
574
|
+
];
|
|
575
|
+
var Pencil = createLucideIcon("pencil", __iconNode22);
|
|
576
|
+
|
|
577
|
+
// node_modules/lucide-react/dist/esm/icons/plus.js
|
|
578
|
+
var __iconNode23 = [
|
|
579
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
580
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
581
|
+
];
|
|
582
|
+
var Plus = createLucideIcon("plus", __iconNode23);
|
|
583
|
+
|
|
584
|
+
// node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
|
|
585
|
+
var __iconNode24 = [
|
|
586
|
+
["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
|
|
587
|
+
["path", { d: "M3 3v5h5", key: "1xhq8a" }],
|
|
588
|
+
["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
|
|
589
|
+
["path", { d: "M16 16h5v5", key: "ccwih5" }]
|
|
590
|
+
];
|
|
591
|
+
var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode24);
|
|
592
|
+
|
|
593
|
+
// node_modules/lucide-react/dist/esm/icons/refresh-cw.js
|
|
594
|
+
var __iconNode25 = [
|
|
595
|
+
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
|
|
596
|
+
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
|
|
597
|
+
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
|
|
598
|
+
["path", { d: "M8 16H3v5", key: "1cv678" }]
|
|
599
|
+
];
|
|
600
|
+
var RefreshCw = createLucideIcon("refresh-cw", __iconNode25);
|
|
601
|
+
|
|
602
|
+
// node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
|
|
603
|
+
var __iconNode26 = [
|
|
604
|
+
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
605
|
+
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
606
|
+
];
|
|
607
|
+
var RotateCcw = createLucideIcon("rotate-ccw", __iconNode26);
|
|
608
|
+
|
|
609
|
+
// node_modules/lucide-react/dist/esm/icons/search.js
|
|
610
|
+
var __iconNode27 = [
|
|
611
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
612
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
613
|
+
];
|
|
614
|
+
var Search = createLucideIcon("search", __iconNode27);
|
|
615
|
+
|
|
616
|
+
// node_modules/lucide-react/dist/esm/icons/trash-2.js
|
|
617
|
+
var __iconNode28 = [
|
|
618
|
+
["path", { d: "M10 11v6", key: "nco0om" }],
|
|
619
|
+
["path", { d: "M14 11v6", key: "outv1u" }],
|
|
620
|
+
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
621
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
622
|
+
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
623
|
+
];
|
|
624
|
+
var Trash2 = createLucideIcon("trash-2", __iconNode28);
|
|
625
|
+
|
|
626
|
+
// node_modules/lucide-react/dist/esm/icons/upload.js
|
|
627
|
+
var __iconNode29 = [
|
|
628
|
+
["path", { d: "M12 3v12", key: "1x0j5s" }],
|
|
629
|
+
["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
|
|
630
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
|
|
631
|
+
];
|
|
632
|
+
var Upload = createLucideIcon("upload", __iconNode29);
|
|
633
|
+
|
|
634
|
+
// node_modules/lucide-react/dist/esm/icons/x.js
|
|
635
|
+
var __iconNode30 = [
|
|
636
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
637
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
638
|
+
];
|
|
639
|
+
var X = createLucideIcon("x", __iconNode30);
|
|
640
|
+
var EMPTY_PAGE = { content: [], root: { props: {} }, zones: {} };
|
|
641
|
+
var DrawerSearchContext = createContext(null);
|
|
642
|
+
var ComponentDrawerItem = ({
|
|
643
|
+
name: name3,
|
|
644
|
+
apiClient,
|
|
645
|
+
children
|
|
646
|
+
}) => {
|
|
647
|
+
const [imgSrc, setImgSrc] = useState(null);
|
|
648
|
+
const [loading, setLoading] = useState(false);
|
|
649
|
+
const [error2, setError] = useState(false);
|
|
650
|
+
const fetchedRef = useRef(false);
|
|
651
|
+
const handleMouseEnter = useCallback(async () => {
|
|
652
|
+
if (fetchedRef.current) return;
|
|
653
|
+
fetchedRef.current = true;
|
|
654
|
+
setLoading(true);
|
|
655
|
+
try {
|
|
656
|
+
const domain = typeof window !== "undefined" ? window.location.hostname : "";
|
|
657
|
+
const blobUrl = await apiClient.getComponentPreview(domain, name3);
|
|
658
|
+
if (blobUrl) {
|
|
659
|
+
setImgSrc(blobUrl);
|
|
660
|
+
} else {
|
|
661
|
+
setError(true);
|
|
662
|
+
}
|
|
663
|
+
} catch {
|
|
664
|
+
setError(true);
|
|
665
|
+
} finally {
|
|
666
|
+
setLoading(false);
|
|
667
|
+
}
|
|
668
|
+
}, [name3, apiClient]);
|
|
669
|
+
return /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-item-group group", onMouseEnter: handleMouseEnter, children: [
|
|
670
|
+
children,
|
|
671
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-drawer-popover", children: [
|
|
672
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-drawer-popover-header", children: [
|
|
673
|
+
name3,
|
|
674
|
+
" \xD6nizleme"
|
|
675
|
+
] }),
|
|
676
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-drawer-popover-body", children: [
|
|
677
|
+
(loading || !imgSrc && !error2) && /* @__PURE__ */ jsx("div", { className: "tecof-drawer-skeleton" }),
|
|
678
|
+
imgSrc && /* @__PURE__ */ jsx(
|
|
679
|
+
"img",
|
|
680
|
+
{
|
|
681
|
+
src: imgSrc,
|
|
682
|
+
alt: `${name3} preview`,
|
|
683
|
+
className: "tecof-drawer-img"
|
|
684
|
+
}
|
|
685
|
+
),
|
|
686
|
+
error2 && /* @__PURE__ */ jsx("div", { className: "tecof-drawer-preview-error", children: "\xD6nizleme y\xFCklenemedi" })
|
|
687
|
+
] })
|
|
688
|
+
] })
|
|
689
|
+
] });
|
|
690
|
+
};
|
|
691
|
+
var CustomDrawer = ({ children }) => {
|
|
692
|
+
const context = useContext(DrawerSearchContext);
|
|
693
|
+
if (!context) return /* @__PURE__ */ jsx("div", { className: "tecof-drawer-list-layout", children });
|
|
694
|
+
const { searchQuery, setSearchQuery } = context;
|
|
695
|
+
return /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-wrapper-layout", children: [
|
|
696
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-drawer-search-wrapper", children: /* @__PURE__ */ jsxs("div", { className: "tecof-drawer-search-box", children: [
|
|
697
|
+
/* @__PURE__ */ jsx(Search, { size: 14, color: "#71717a" }),
|
|
698
|
+
/* @__PURE__ */ jsx(
|
|
699
|
+
"input",
|
|
604
700
|
{
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
701
|
+
type: "text",
|
|
702
|
+
placeholder: "Blok ara...",
|
|
703
|
+
value: searchQuery,
|
|
704
|
+
onChange: (e3) => setSearchQuery(e3.target.value),
|
|
705
|
+
className: "tecof-drawer-search-input"
|
|
610
706
|
}
|
|
611
|
-
)
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
}
|
|
632
|
-
);
|
|
633
|
-
}
|
|
634
|
-
if (isVideoType) {
|
|
635
|
-
return /* @__PURE__ */ jsx("div", { style, className: containerClassName, children: renderVideo() });
|
|
707
|
+
),
|
|
708
|
+
searchQuery && /* @__PURE__ */ jsx(
|
|
709
|
+
"button",
|
|
710
|
+
{
|
|
711
|
+
type: "button",
|
|
712
|
+
onClick: () => setSearchQuery(""),
|
|
713
|
+
className: "tecof-drawer-clear-btn",
|
|
714
|
+
title: "Temizle",
|
|
715
|
+
children: /* @__PURE__ */ jsx(X, { size: 14 })
|
|
716
|
+
}
|
|
717
|
+
)
|
|
718
|
+
] }) }),
|
|
719
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-drawer-list-layout", children })
|
|
720
|
+
] });
|
|
721
|
+
};
|
|
722
|
+
var CustomDrawerItem = ({ children, name: name3 }) => {
|
|
723
|
+
const context = useContext(DrawerSearchContext);
|
|
724
|
+
const { apiClient } = useTecof();
|
|
725
|
+
if (!context) {
|
|
726
|
+
return /* @__PURE__ */ jsx(ComponentDrawerItem, { name: name3, apiClient, children });
|
|
636
727
|
}
|
|
637
|
-
|
|
638
|
-
|
|
728
|
+
const { searchQuery, config: config3 } = context;
|
|
729
|
+
const componentConfig = config3.components?.[name3];
|
|
730
|
+
const label = componentConfig?.label || name3;
|
|
731
|
+
if (searchQuery.trim()) {
|
|
732
|
+
const query = searchQuery.toLowerCase();
|
|
733
|
+
const matchesName = name3.toLowerCase().includes(query);
|
|
734
|
+
const matchesLabel = label.toLowerCase().includes(query);
|
|
735
|
+
if (!matchesName && !matchesLabel) {
|
|
736
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
737
|
+
}
|
|
639
738
|
}
|
|
739
|
+
return /* @__PURE__ */ jsx(ComponentDrawerItem, { name: name3, apiClient, children });
|
|
740
|
+
};
|
|
741
|
+
var AutoFieldsOnSelect = () => {
|
|
742
|
+
const { selectedItem, dispatch } = usePuck();
|
|
743
|
+
const prevSelectedRef = useRef(null);
|
|
744
|
+
useEffect(() => {
|
|
745
|
+
const currentId = selectedItem?.props?.id || null;
|
|
746
|
+
if (currentId && currentId !== prevSelectedRef.current) {
|
|
747
|
+
dispatch({
|
|
748
|
+
type: "setUi",
|
|
749
|
+
ui: { plugin: { current: "fields" } }
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
prevSelectedRef.current = currentId;
|
|
753
|
+
}, [selectedItem, dispatch]);
|
|
640
754
|
return null;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
filter: blur(150px);
|
|
679
|
-
opacity: 0.12;
|
|
680
|
-
pointer-events: none;
|
|
681
|
-
z-index: 1;
|
|
682
|
-
border-radius: 50%;
|
|
683
|
-
animation: tecof-uc-pulse 8s infinite alternate ease-in-out;
|
|
755
|
+
};
|
|
756
|
+
var CustomActionBar = ({ children, label }) => {
|
|
757
|
+
const { appState, dispatch, getSelectorForId, selectedItem } = usePuck();
|
|
758
|
+
const canMoveUp = useMemo(() => {
|
|
759
|
+
if (!selectedItem || !selectedItem.props?.id) return false;
|
|
760
|
+
const selector = getSelectorForId(selectedItem.props.id);
|
|
761
|
+
if (!selector) return false;
|
|
762
|
+
return selector.index > 0;
|
|
763
|
+
}, [selectedItem, getSelectorForId]);
|
|
764
|
+
const canMoveDown = useMemo(() => {
|
|
765
|
+
if (!selectedItem || !selectedItem.props?.id) return false;
|
|
766
|
+
const selector = getSelectorForId(selectedItem.props.id);
|
|
767
|
+
if (!selector) return false;
|
|
768
|
+
const { index: index2, zone } = selector;
|
|
769
|
+
const items = zone ? appState.data.zones?.[zone] || [] : appState.data.content || [];
|
|
770
|
+
return index2 < items.length - 1;
|
|
771
|
+
}, [selectedItem, getSelectorForId, appState.data]);
|
|
772
|
+
const handleMove = useCallback((direction) => {
|
|
773
|
+
if (!selectedItem || !selectedItem.props?.id) return;
|
|
774
|
+
const selector = getSelectorForId(selectedItem.props.id);
|
|
775
|
+
if (!selector) return;
|
|
776
|
+
const { index: index2, zone } = selector;
|
|
777
|
+
let items = zone ? [...appState.data.zones?.[zone] || []] : [...appState.data.content || []];
|
|
778
|
+
const targetIndex = direction === "up" ? index2 - 1 : index2 + 1;
|
|
779
|
+
if (targetIndex < 0 || targetIndex >= items.length) return;
|
|
780
|
+
const temp = items[index2];
|
|
781
|
+
items[index2] = items[targetIndex];
|
|
782
|
+
items[targetIndex] = temp;
|
|
783
|
+
if (zone) {
|
|
784
|
+
dispatch({
|
|
785
|
+
type: "setData",
|
|
786
|
+
data: {
|
|
787
|
+
...appState.data,
|
|
788
|
+
zones: {
|
|
789
|
+
...appState.data.zones,
|
|
790
|
+
[zone]: items
|
|
791
|
+
}
|
|
684
792
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
-webkit-backdrop-filter: blur(20px);
|
|
694
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
695
|
-
border-radius: 24px;
|
|
696
|
-
padding: 3.5rem 2.5rem;
|
|
697
|
-
text-align: center;
|
|
698
|
-
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4),
|
|
699
|
-
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
|
700
|
-
animation: tecof-uc-fade-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
793
|
+
});
|
|
794
|
+
dispatch({
|
|
795
|
+
type: "setUi",
|
|
796
|
+
ui: {
|
|
797
|
+
itemSelector: {
|
|
798
|
+
index: targetIndex,
|
|
799
|
+
zone
|
|
800
|
+
}
|
|
701
801
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
802
|
+
});
|
|
803
|
+
} else {
|
|
804
|
+
dispatch({
|
|
805
|
+
type: "setData",
|
|
806
|
+
data: {
|
|
807
|
+
...appState.data,
|
|
808
|
+
content: items
|
|
708
809
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
810
|
+
});
|
|
811
|
+
dispatch({
|
|
812
|
+
type: "setUi",
|
|
813
|
+
ui: {
|
|
814
|
+
itemSelector: {
|
|
815
|
+
index: targetIndex
|
|
816
|
+
}
|
|
715
817
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
}, [selectedItem, getSelectorForId, appState.data, dispatch]);
|
|
821
|
+
return /* @__PURE__ */ jsx(ActionBar, { label, children: /* @__PURE__ */ jsxs(ActionBar.Group, { children: [
|
|
822
|
+
/* @__PURE__ */ jsx(ActionBar.Action, { onClick: () => handleMove("up"), disabled: !canMoveUp, label: "Yukar\u0131 Ta\u015F\u0131", children: /* @__PURE__ */ jsx(ArrowUp, { size: 14 }) }),
|
|
823
|
+
/* @__PURE__ */ jsx(ActionBar.Action, { onClick: () => handleMove("down"), disabled: !canMoveDown, label: "A\u015Fa\u011F\u0131 Ta\u015F\u0131", children: /* @__PURE__ */ jsx(ArrowDown, { size: 14 }) }),
|
|
824
|
+
/* @__PURE__ */ jsx(ActionBar.Separator, {}),
|
|
825
|
+
children
|
|
826
|
+
] }) });
|
|
827
|
+
};
|
|
828
|
+
var TecofEditor = ({
|
|
829
|
+
pageId,
|
|
830
|
+
config: config3,
|
|
831
|
+
accessToken,
|
|
832
|
+
onSave,
|
|
833
|
+
onChange,
|
|
834
|
+
overrides,
|
|
835
|
+
plugins: extraPlugins,
|
|
836
|
+
className
|
|
837
|
+
}) => {
|
|
838
|
+
const { apiClient, secretKey } = useTecof();
|
|
839
|
+
const [initialData, setInitialData] = useState(null);
|
|
840
|
+
const [loading, setLoading] = useState(true);
|
|
841
|
+
const [saving, setSaving] = useState(false);
|
|
842
|
+
const [saveStatus, setSaveStatus] = useState("idle");
|
|
843
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
844
|
+
const draftDataRef = useRef(null);
|
|
845
|
+
const isEmbedded = typeof window !== "undefined" && window.parent !== window;
|
|
846
|
+
useEffect(() => {
|
|
847
|
+
let cancelled = false;
|
|
848
|
+
const load = async () => {
|
|
849
|
+
setLoading(true);
|
|
850
|
+
const res2 = await apiClient.getPage(pageId);
|
|
851
|
+
if (cancelled) return;
|
|
852
|
+
const data3 = res2.success && res2.data?.draftData ? res2.data.draftData : EMPTY_PAGE;
|
|
853
|
+
setInitialData(data3);
|
|
854
|
+
draftDataRef.current = data3;
|
|
855
|
+
setLoading(false);
|
|
856
|
+
};
|
|
857
|
+
load();
|
|
858
|
+
return () => {
|
|
859
|
+
cancelled = true;
|
|
860
|
+
};
|
|
861
|
+
}, [pageId, apiClient]);
|
|
862
|
+
const handleSaveDraft = useCallback(
|
|
863
|
+
async (data3) => {
|
|
864
|
+
const currentData = data3 || draftDataRef.current;
|
|
865
|
+
if (!currentData) return;
|
|
866
|
+
const draftData = currentData;
|
|
867
|
+
setSaving(true);
|
|
868
|
+
setSaveStatus("idle");
|
|
869
|
+
const res2 = await apiClient.savePage(pageId, draftData, void 0, accessToken);
|
|
870
|
+
if (res2.success) {
|
|
871
|
+
setSaveStatus("success");
|
|
872
|
+
setTimeout(() => setSaveStatus("idle"), 3e3);
|
|
873
|
+
onSave?.(draftData);
|
|
874
|
+
if (isEmbedded) window.parent.postMessage({ type: "puck:saved" }, "*");
|
|
875
|
+
} else {
|
|
876
|
+
setSaveStatus("error");
|
|
877
|
+
if (isEmbedded) window.parent.postMessage({ type: "puck:saveError", message: res2.message }, "*");
|
|
878
|
+
}
|
|
879
|
+
setSaving(false);
|
|
880
|
+
},
|
|
881
|
+
[pageId, apiClient, isEmbedded, onSave, accessToken]
|
|
882
|
+
);
|
|
883
|
+
const handleChange = useCallback(
|
|
884
|
+
(data3) => {
|
|
885
|
+
draftDataRef.current = data3;
|
|
886
|
+
const draftData = data3;
|
|
887
|
+
onChange?.(draftData);
|
|
888
|
+
if (isEmbedded) window.parent.postMessage({ type: "puck:changed" }, "*");
|
|
889
|
+
},
|
|
890
|
+
[onChange, isEmbedded]
|
|
891
|
+
);
|
|
892
|
+
const handlePuckPublish = useCallback(
|
|
893
|
+
(data3) => {
|
|
894
|
+
handleSaveDraft(data3);
|
|
895
|
+
},
|
|
896
|
+
[handleSaveDraft]
|
|
897
|
+
);
|
|
898
|
+
useEffect(() => {
|
|
899
|
+
if (!isEmbedded) return;
|
|
900
|
+
const onMessage = (e3) => {
|
|
901
|
+
switch (e3.data?.type) {
|
|
902
|
+
case "puck:save": {
|
|
903
|
+
handleSaveDraft();
|
|
904
|
+
break;
|
|
724
905
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
906
|
+
case "puck:undo":
|
|
907
|
+
document.dispatchEvent(new KeyboardEvent("keydown", { key: "z", code: "KeyZ", ctrlKey: true, bubbles: true }));
|
|
908
|
+
break;
|
|
909
|
+
case "puck:redo":
|
|
910
|
+
document.dispatchEvent(new KeyboardEvent("keydown", { key: "z", code: "KeyZ", ctrlKey: true, shiftKey: true, bubbles: true }));
|
|
911
|
+
break;
|
|
912
|
+
case "puck:viewport": {
|
|
913
|
+
const frame = document.querySelector('[data-testid="puck-frame"]');
|
|
914
|
+
if (frame) {
|
|
915
|
+
const w = e3.data.width || "100%";
|
|
916
|
+
frame.style.maxWidth = w;
|
|
917
|
+
frame.style.margin = w === "100%" ? "0" : "0 auto";
|
|
918
|
+
frame.style.transition = "max-width 0.3s ease";
|
|
919
|
+
}
|
|
920
|
+
break;
|
|
739
921
|
}
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
window.addEventListener("message", onMessage);
|
|
925
|
+
return () => window.removeEventListener("message", onMessage);
|
|
926
|
+
}, [isEmbedded, handleSaveDraft]);
|
|
927
|
+
useEffect(() => {
|
|
928
|
+
if (!isEmbedded) return;
|
|
929
|
+
const handleClick = (e3) => {
|
|
930
|
+
const target = e3.target;
|
|
931
|
+
const puckComponent = target.closest("[data-puck-component]");
|
|
932
|
+
if (puckComponent) {
|
|
933
|
+
const componentType = puckComponent.getAttribute("data-puck-component");
|
|
934
|
+
const draggableId = puckComponent.closest("[data-rfd-draggable-id]")?.getAttribute("data-rfd-draggable-id");
|
|
935
|
+
window.parent.postMessage({
|
|
936
|
+
type: "puck:itemSelected",
|
|
937
|
+
item: {
|
|
938
|
+
type: componentType,
|
|
939
|
+
id: draggableId || null
|
|
940
|
+
}
|
|
941
|
+
}, "*");
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
const handleDeselect = (e3) => {
|
|
945
|
+
const target = e3.target;
|
|
946
|
+
if (!target.closest("[data-puck-component]")) {
|
|
947
|
+
window.parent.postMessage({ type: "puck:itemDeselected" }, "*");
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
document.addEventListener("click", handleClick, true);
|
|
951
|
+
document.addEventListener("click", handleDeselect, false);
|
|
952
|
+
return () => {
|
|
953
|
+
document.removeEventListener("click", handleClick, true);
|
|
954
|
+
document.removeEventListener("click", handleDeselect, false);
|
|
955
|
+
};
|
|
956
|
+
}, [isEmbedded]);
|
|
957
|
+
const searchContextValue = useMemo(() => ({
|
|
958
|
+
searchQuery,
|
|
959
|
+
setSearchQuery,
|
|
960
|
+
config: config3
|
|
961
|
+
}), [searchQuery, config3]);
|
|
962
|
+
const plugins = useMemo(() => [
|
|
963
|
+
{ ...blocksPlugin(), label: "Bloklar" },
|
|
964
|
+
{ ...outlinePlugin(), label: "Anahat" },
|
|
965
|
+
{ ...fieldsPlugin({ desktopSideBar: "right" }), label: "Alanlar" },
|
|
966
|
+
...extraPlugins || []
|
|
967
|
+
], [extraPlugins]);
|
|
968
|
+
const mergedOverrides = useMemo(() => {
|
|
969
|
+
return {
|
|
970
|
+
header: () => /* @__PURE__ */ jsx(Fragment, {}),
|
|
971
|
+
drawer: CustomDrawer,
|
|
972
|
+
drawerItem: CustomDrawerItem,
|
|
973
|
+
actionBar: ({ children, label }) => {
|
|
974
|
+
return /* @__PURE__ */ jsx(CustomActionBar, { label, children });
|
|
975
|
+
},
|
|
976
|
+
puck: ({ children }) => {
|
|
977
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
978
|
+
/* @__PURE__ */ jsx(AutoFieldsOnSelect, {}),
|
|
979
|
+
children
|
|
980
|
+
] });
|
|
981
|
+
},
|
|
982
|
+
...overrides || {}
|
|
983
|
+
};
|
|
984
|
+
}, [overrides]);
|
|
985
|
+
if (loading || !initialData) {
|
|
986
|
+
return /* @__PURE__ */ jsx("div", { className: `tecof-editor-loading ${className || ""}`.trim(), children: /* @__PURE__ */ jsxs("div", { className: "tecof-editor-loading-inner", children: [
|
|
987
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-editor-spinner" }),
|
|
988
|
+
/* @__PURE__ */ jsx("p", { className: "tecof-editor-loading-text", children: "Loading editor..." })
|
|
989
|
+
] }) });
|
|
990
|
+
}
|
|
991
|
+
return /* @__PURE__ */ jsx(DrawerSearchContext.Provider, { value: searchContextValue, children: /* @__PURE__ */ jsxs("div", { className: `tecof-editor-wrapper ${className || ""}`.trim(), children: [
|
|
992
|
+
/* @__PURE__ */ jsx(
|
|
993
|
+
Puck,
|
|
994
|
+
{
|
|
995
|
+
plugins,
|
|
996
|
+
config: config3,
|
|
997
|
+
data: initialData,
|
|
998
|
+
onPublish: handlePuckPublish,
|
|
999
|
+
onChange: handleChange,
|
|
1000
|
+
overrides: mergedOverrides,
|
|
1001
|
+
metadata: { editMode: true }
|
|
1002
|
+
}
|
|
1003
|
+
),
|
|
1004
|
+
saving && /* @__PURE__ */ jsx("div", { className: "tecof-editor-save-indicator", children: saveStatus === "error" ? "Save failed" : "Saving..." })
|
|
1005
|
+
] }) });
|
|
1006
|
+
};
|
|
740
1007
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
1008
|
+
// src/engine/document.ts
|
|
1009
|
+
var EMPTY_DOCUMENT = {
|
|
1010
|
+
root: { props: {} },
|
|
1011
|
+
content: [],
|
|
1012
|
+
zones: {}
|
|
1013
|
+
};
|
|
1014
|
+
var parseDocument = (rawData) => {
|
|
1015
|
+
if (!rawData) return { ...EMPTY_DOCUMENT };
|
|
1016
|
+
return {
|
|
1017
|
+
root: rawData.root || { props: {} },
|
|
1018
|
+
content: rawData.content || [],
|
|
1019
|
+
zones: rawData.zones || {}
|
|
1020
|
+
};
|
|
1021
|
+
};
|
|
1022
|
+
var serializeDocument = (doc) => {
|
|
1023
|
+
return {
|
|
1024
|
+
root: doc.root,
|
|
1025
|
+
content: doc.content,
|
|
1026
|
+
zones: doc.zones
|
|
1027
|
+
};
|
|
1028
|
+
};
|
|
750
1029
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
1030
|
+
// src/engine/zones.ts
|
|
1031
|
+
var parseZoneKey = (zoneKey) => {
|
|
1032
|
+
const parts = zoneKey.split(":");
|
|
1033
|
+
return {
|
|
1034
|
+
parentId: parts[0],
|
|
1035
|
+
slotName: parts[1] || "default"
|
|
1036
|
+
};
|
|
1037
|
+
};
|
|
1038
|
+
var findNodeById = (doc, id) => {
|
|
1039
|
+
for (let i2 = 0; i2 < doc.content.length; i2++) {
|
|
1040
|
+
if (doc.content[i2].props.id === id) {
|
|
1041
|
+
return { node: doc.content[i2], path: { index: i2 } };
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
for (const [zoneKey, items] of Object.entries(doc.zones)) {
|
|
1045
|
+
for (let i2 = 0; i2 < items.length; i2++) {
|
|
1046
|
+
if (items[i2].props.id === id) {
|
|
1047
|
+
return { node: items[i2], path: { zoneKey, index: i2 } };
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
return null;
|
|
1052
|
+
};
|
|
1053
|
+
var getDescendantZoneKeys = (zones, nodeId, acc = []) => {
|
|
1054
|
+
const prefix = `${nodeId}:`;
|
|
1055
|
+
for (const zoneKey of Object.keys(zones)) {
|
|
1056
|
+
if (zoneKey.startsWith(prefix)) {
|
|
1057
|
+
acc.push(zoneKey);
|
|
1058
|
+
for (const child of zones[zoneKey]) {
|
|
1059
|
+
getDescendantZoneKeys(zones, child.props.id, acc);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
return acc;
|
|
1064
|
+
};
|
|
1065
|
+
var getParentId = (doc, id) => {
|
|
1066
|
+
const res2 = findNodeById(doc, id);
|
|
1067
|
+
if (!res2 || !res2.path.zoneKey) return null;
|
|
1068
|
+
return parseZoneKey(res2.path.zoneKey).parentId;
|
|
1069
|
+
};
|
|
1070
|
+
var getBreadcrumbs = (doc, id) => {
|
|
1071
|
+
const crumbs = [];
|
|
1072
|
+
let currentId = id;
|
|
1073
|
+
while (currentId) {
|
|
1074
|
+
const res2 = findNodeById(doc, currentId);
|
|
1075
|
+
if (!res2) break;
|
|
1076
|
+
crumbs.unshift({ id: currentId, type: res2.node.type });
|
|
1077
|
+
currentId = res2.path.zoneKey ? parseZoneKey(res2.path.zoneKey).parentId : null;
|
|
1078
|
+
}
|
|
1079
|
+
return crumbs;
|
|
1080
|
+
};
|
|
1081
|
+
var generateId = () => nanoid(8);
|
|
1082
|
+
var remapNodeIds = (node, sourceZones, idMap = /* @__PURE__ */ new Map()) => {
|
|
1083
|
+
const oldId = node.props.id;
|
|
1084
|
+
const newId = generateId();
|
|
1085
|
+
idMap.set(oldId, newId);
|
|
1086
|
+
const remappedNode = {
|
|
1087
|
+
...node,
|
|
1088
|
+
props: {
|
|
1089
|
+
...node.props,
|
|
1090
|
+
id: newId
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
const newZones = {};
|
|
1094
|
+
const prefix = `${oldId}:`;
|
|
1095
|
+
for (const [zoneKey, zoneItems] of Object.entries(sourceZones)) {
|
|
1096
|
+
if (zoneKey.startsWith(prefix)) {
|
|
1097
|
+
const slotName = zoneKey.split(":")[1];
|
|
1098
|
+
const newZoneKey = `${newId}:${slotName}`;
|
|
1099
|
+
const newZoneItems = [];
|
|
1100
|
+
for (const item2 of zoneItems) {
|
|
1101
|
+
const { remappedNode: childNode, newZones: childZones } = remapNodeIds(item2, sourceZones, idMap);
|
|
1102
|
+
newZoneItems.push(childNode);
|
|
1103
|
+
Object.assign(newZones, childZones);
|
|
1104
|
+
}
|
|
1105
|
+
newZones[newZoneKey] = newZoneItems;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
return { remappedNode, newZones };
|
|
1109
|
+
};
|
|
757
1110
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
1111
|
+
// src/engine/operations.ts
|
|
1112
|
+
var insertNode = (draft, node, targetZoneKey, index2) => {
|
|
1113
|
+
if (!node.props.id) {
|
|
1114
|
+
node.props.id = generateId();
|
|
1115
|
+
}
|
|
1116
|
+
let list3 = targetZoneKey ? draft.zones[targetZoneKey] : draft.content;
|
|
1117
|
+
if (!list3) {
|
|
1118
|
+
list3 = [];
|
|
1119
|
+
if (targetZoneKey) {
|
|
1120
|
+
draft.zones[targetZoneKey] = list3;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
const insertIndex = typeof index2 === "number" ? index2 : list3.length;
|
|
1124
|
+
list3.splice(insertIndex, 0, node);
|
|
1125
|
+
};
|
|
1126
|
+
var removeNode = (draft, id) => {
|
|
1127
|
+
const result = findNodeById(draft, id);
|
|
1128
|
+
if (!result) return;
|
|
1129
|
+
const { path } = result;
|
|
1130
|
+
const list3 = path.zoneKey ? draft.zones[path.zoneKey] : draft.content;
|
|
1131
|
+
if (list3) {
|
|
1132
|
+
list3.splice(path.index, 1);
|
|
1133
|
+
}
|
|
1134
|
+
const descendantZoneKeys = getDescendantZoneKeys(draft.zones, id);
|
|
1135
|
+
for (const zoneKey of descendantZoneKeys) {
|
|
1136
|
+
delete draft.zones[zoneKey];
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
var moveNode = (draft, id, targetZoneKey, targetIndex) => {
|
|
1140
|
+
const result = findNodeById(draft, id);
|
|
1141
|
+
if (!result) return;
|
|
1142
|
+
const { node, path: sourcePath } = result;
|
|
1143
|
+
const sourceList = sourcePath.zoneKey ? draft.zones[sourcePath.zoneKey] : draft.content;
|
|
1144
|
+
let targetList = targetZoneKey ? draft.zones[targetZoneKey] : draft.content;
|
|
1145
|
+
if (!targetList && targetZoneKey) {
|
|
1146
|
+
targetList = [];
|
|
1147
|
+
draft.zones[targetZoneKey] = targetList;
|
|
1148
|
+
}
|
|
1149
|
+
if (!sourceList || !targetList) return;
|
|
1150
|
+
sourceList.splice(sourcePath.index, 1);
|
|
1151
|
+
let finalIndex = targetIndex ?? targetList.length;
|
|
1152
|
+
if (sourcePath.zoneKey === targetZoneKey && sourcePath.index < finalIndex) {
|
|
1153
|
+
finalIndex -= 1;
|
|
1154
|
+
}
|
|
1155
|
+
targetList.splice(finalIndex, 0, node);
|
|
1156
|
+
};
|
|
1157
|
+
var duplicateNode = (draft, id) => {
|
|
1158
|
+
const result = findNodeById(draft, id);
|
|
1159
|
+
if (!result) return;
|
|
1160
|
+
const { node, path } = result;
|
|
1161
|
+
const { remappedNode, newZones } = remapNodeIds(node, draft.zones);
|
|
1162
|
+
const targetList = path.zoneKey ? draft.zones[path.zoneKey] : draft.content;
|
|
1163
|
+
if (targetList) {
|
|
1164
|
+
targetList.splice(path.index + 1, 0, remappedNode);
|
|
1165
|
+
}
|
|
1166
|
+
Object.assign(draft.zones, newZones);
|
|
1167
|
+
};
|
|
1168
|
+
var updateProps = (draft, id, patch) => {
|
|
1169
|
+
const result = findNodeById(draft, id);
|
|
1170
|
+
if (!result) return;
|
|
1171
|
+
Object.assign(result.node.props, patch);
|
|
1172
|
+
};
|
|
1173
|
+
var setRootProps = (draft, patch) => {
|
|
1174
|
+
Object.assign(draft.root.props, patch);
|
|
1175
|
+
};
|
|
766
1176
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
1177
|
+
// src/engine/store.ts
|
|
1178
|
+
var pushToHistory = (state3) => {
|
|
1179
|
+
state3.history.past.push(JSON.parse(JSON.stringify(state3.document)));
|
|
1180
|
+
state3.history.future = [];
|
|
1181
|
+
};
|
|
1182
|
+
var useEditorStore = create()(
|
|
1183
|
+
immer((set2) => ({
|
|
1184
|
+
// Initial State
|
|
1185
|
+
document: { ...EMPTY_DOCUMENT },
|
|
1186
|
+
history: {
|
|
1187
|
+
past: [],
|
|
1188
|
+
future: []
|
|
1189
|
+
},
|
|
1190
|
+
selection: {
|
|
1191
|
+
selectedId: null,
|
|
1192
|
+
hoveredId: null
|
|
1193
|
+
},
|
|
1194
|
+
viewport: "desktop",
|
|
1195
|
+
// Actions
|
|
1196
|
+
setDocument: (doc) => set2((state3) => {
|
|
1197
|
+
state3.document = doc;
|
|
1198
|
+
state3.history = { past: [], future: [] };
|
|
1199
|
+
state3.selection = { selectedId: null, hoveredId: null };
|
|
1200
|
+
}),
|
|
1201
|
+
selectNode: (id) => set2((state3) => {
|
|
1202
|
+
state3.selection.selectedId = id;
|
|
1203
|
+
}),
|
|
1204
|
+
hoverNode: (id) => set2((state3) => {
|
|
1205
|
+
state3.selection.hoveredId = id;
|
|
1206
|
+
}),
|
|
1207
|
+
setViewport: (viewport) => set2((state3) => {
|
|
1208
|
+
state3.viewport = viewport;
|
|
1209
|
+
}),
|
|
1210
|
+
insertNode: (node, targetZoneKey, index2) => set2((state3) => {
|
|
1211
|
+
pushToHistory(state3);
|
|
1212
|
+
insertNode(state3.document, node, targetZoneKey, index2);
|
|
1213
|
+
}),
|
|
1214
|
+
removeNode: (id) => set2((state3) => {
|
|
1215
|
+
pushToHistory(state3);
|
|
1216
|
+
removeNode(state3.document, id);
|
|
1217
|
+
if (state3.selection.selectedId === id) {
|
|
1218
|
+
state3.selection.selectedId = null;
|
|
1219
|
+
}
|
|
1220
|
+
}),
|
|
1221
|
+
moveNode: (id, targetZoneKey, index2) => set2((state3) => {
|
|
1222
|
+
pushToHistory(state3);
|
|
1223
|
+
moveNode(state3.document, id, targetZoneKey, index2);
|
|
1224
|
+
}),
|
|
1225
|
+
duplicateNode: (id) => set2((state3) => {
|
|
1226
|
+
pushToHistory(state3);
|
|
1227
|
+
duplicateNode(state3.document, id);
|
|
1228
|
+
}),
|
|
1229
|
+
updateProps: (id, patch) => set2((state3) => {
|
|
1230
|
+
pushToHistory(state3);
|
|
1231
|
+
updateProps(state3.document, id, patch);
|
|
1232
|
+
}),
|
|
1233
|
+
setRootProps: (patch) => set2((state3) => {
|
|
1234
|
+
pushToHistory(state3);
|
|
1235
|
+
setRootProps(state3.document, patch);
|
|
1236
|
+
}),
|
|
1237
|
+
undo: () => set2((state3) => {
|
|
1238
|
+
if (state3.history.past.length === 0) return;
|
|
1239
|
+
const previous = state3.history.past.pop();
|
|
1240
|
+
state3.history.future.push(JSON.parse(JSON.stringify(state3.document)));
|
|
1241
|
+
state3.document = previous;
|
|
1242
|
+
}),
|
|
1243
|
+
redo: () => set2((state3) => {
|
|
1244
|
+
if (state3.history.future.length === 0) return;
|
|
1245
|
+
const next = state3.history.future.pop();
|
|
1246
|
+
state3.history.past.push(JSON.parse(JSON.stringify(state3.document)));
|
|
1247
|
+
state3.document = next;
|
|
1248
|
+
})
|
|
1249
|
+
}))
|
|
1250
|
+
);
|
|
1251
|
+
var StudioContext = createContext(null);
|
|
1252
|
+
var useStudio = () => {
|
|
1253
|
+
const ctx = useContext(StudioContext);
|
|
1254
|
+
if (!ctx) {
|
|
1255
|
+
throw new Error("useStudio must be used within a StudioProvider");
|
|
1256
|
+
}
|
|
1257
|
+
return ctx;
|
|
1258
|
+
};
|
|
1259
|
+
var ParentNodeContext = createContext(null);
|
|
1260
|
+
var DropZone = ({ zone, className, style }) => {
|
|
1261
|
+
const parentId = useContext(ParentNodeContext);
|
|
1262
|
+
const zoneKey = parentId ? `${parentId}:${zone}` : zone;
|
|
1263
|
+
const items = useEditorStore((state3) => state3.document.zones[zoneKey] || []);
|
|
1264
|
+
return /* @__PURE__ */ jsx(
|
|
1265
|
+
"div",
|
|
1266
|
+
{
|
|
1267
|
+
className: `tecof-dropzone ${className || ""}`,
|
|
1268
|
+
style: { minHeight: items.length === 0 ? "40px" : void 0, ...style },
|
|
1269
|
+
"data-tecof-zone": zoneKey,
|
|
1270
|
+
children: items.map((item2, index2) => /* @__PURE__ */ jsx(NodeRenderer, { node: item2, index: index2, zoneKey }, item2.props.id))
|
|
1271
|
+
}
|
|
1272
|
+
);
|
|
1273
|
+
};
|
|
1274
|
+
var renderDropZone = ({ zone, className, style }) => {
|
|
1275
|
+
return /* @__PURE__ */ jsx(DropZone, { zone, className, style });
|
|
1276
|
+
};
|
|
1277
|
+
var NodeRenderer = ({ node, index: index2, zoneKey }) => {
|
|
1278
|
+
const { config: config3, metadata, readOnly } = useStudio();
|
|
1279
|
+
const componentConfig = config3.components[node.type];
|
|
1280
|
+
const selectNode = useEditorStore((state3) => state3.selectNode);
|
|
1281
|
+
const hoverNode = useEditorStore((state3) => state3.hoverNode);
|
|
1282
|
+
const hoveredId = useEditorStore((state3) => state3.selection.hoveredId);
|
|
1283
|
+
const handleMouseEnter = useCallback(
|
|
1284
|
+
(e3) => {
|
|
1285
|
+
if (readOnly) return;
|
|
1286
|
+
e3.stopPropagation();
|
|
1287
|
+
hoverNode(node.props.id);
|
|
1288
|
+
},
|
|
1289
|
+
[hoverNode, node.props.id, readOnly]
|
|
1290
|
+
);
|
|
1291
|
+
const handleMouseLeave = useCallback(
|
|
1292
|
+
(e3) => {
|
|
1293
|
+
if (readOnly) return;
|
|
1294
|
+
e3.stopPropagation();
|
|
1295
|
+
if (hoveredId === node.props.id) {
|
|
1296
|
+
hoverNode(null);
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
[hoverNode, node.props.id, hoveredId, readOnly]
|
|
1300
|
+
);
|
|
1301
|
+
const handleClick = useCallback(
|
|
1302
|
+
(e3) => {
|
|
1303
|
+
if (readOnly) return;
|
|
1304
|
+
e3.stopPropagation();
|
|
1305
|
+
selectNode(node.props.id);
|
|
1306
|
+
const isEmbedded = typeof window !== "undefined" && window.parent !== window;
|
|
1307
|
+
if (isEmbedded) {
|
|
1308
|
+
window.parent.postMessage(
|
|
1309
|
+
{
|
|
1310
|
+
type: "puck:itemSelected",
|
|
1311
|
+
item: {
|
|
1312
|
+
type: node.type,
|
|
1313
|
+
id: node.props.id
|
|
1314
|
+
}
|
|
1315
|
+
},
|
|
1316
|
+
"*"
|
|
1317
|
+
);
|
|
1318
|
+
}
|
|
1319
|
+
},
|
|
1320
|
+
[selectNode, node.props.id, node.type, readOnly]
|
|
1321
|
+
);
|
|
1322
|
+
if (!componentConfig) {
|
|
1323
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: "12px", background: "#fee2e2", color: "#991b1b", fontSize: "12px", borderRadius: "4px" }, children: [
|
|
1324
|
+
"Bile\u015Fen bulunamad\u0131: ",
|
|
1325
|
+
node.type
|
|
1326
|
+
] });
|
|
1327
|
+
}
|
|
1328
|
+
const componentProps = {
|
|
1329
|
+
...node.props,
|
|
1330
|
+
puck: {
|
|
1331
|
+
renderDropZone,
|
|
1332
|
+
isEditing: !readOnly,
|
|
1333
|
+
metadata: {
|
|
1334
|
+
...metadata || {},
|
|
1335
|
+
...componentConfig.metadata || {}
|
|
1336
|
+
}
|
|
1337
|
+
},
|
|
1338
|
+
editMode: !readOnly
|
|
1339
|
+
};
|
|
1340
|
+
return /* @__PURE__ */ jsx(ParentNodeContext.Provider, { value: node.props.id, children: /* @__PURE__ */ jsx(
|
|
1341
|
+
"div",
|
|
1342
|
+
{
|
|
1343
|
+
className: "tecof-node-wrapper",
|
|
1344
|
+
"data-tecof-id": node.props.id,
|
|
1345
|
+
"data-tecof-type": node.type,
|
|
1346
|
+
"data-tecof-index": index2,
|
|
1347
|
+
"data-tecof-zone": zoneKey || "root",
|
|
1348
|
+
onMouseEnter: handleMouseEnter,
|
|
1349
|
+
onMouseLeave: handleMouseLeave,
|
|
1350
|
+
onClick: handleClick,
|
|
1351
|
+
style: {
|
|
1352
|
+
cursor: readOnly ? void 0 : "pointer"
|
|
1353
|
+
},
|
|
1354
|
+
children: componentConfig.render(componentProps)
|
|
1355
|
+
}
|
|
1356
|
+
) });
|
|
1357
|
+
};
|
|
1358
|
+
var Frame = ({ children, title = "Canvas Frame", ...props }) => {
|
|
1359
|
+
const [contentRef, setContentRef] = useState(null);
|
|
1360
|
+
const mountNode = contentRef?.contentWindow?.document?.body;
|
|
1361
|
+
useEffect(() => {
|
|
1362
|
+
if (!contentRef) return;
|
|
1363
|
+
const doc = contentRef.contentDocument;
|
|
1364
|
+
if (!doc) return;
|
|
1365
|
+
const copyStyles = () => {
|
|
1366
|
+
doc.head.innerHTML = "";
|
|
1367
|
+
Array.from(document.styleSheets).forEach((styleSheet) => {
|
|
1368
|
+
try {
|
|
1369
|
+
if (styleSheet.href) {
|
|
1370
|
+
const link = doc.createElement("link");
|
|
1371
|
+
link.rel = "stylesheet";
|
|
1372
|
+
link.href = styleSheet.href;
|
|
1373
|
+
doc.head.appendChild(link);
|
|
1374
|
+
} else {
|
|
1375
|
+
const cssRules = Array.from(styleSheet.cssRules).map((rule) => rule.cssText).join("\n");
|
|
1376
|
+
const style2 = doc.createElement("style");
|
|
1377
|
+
style2.textContent = cssRules;
|
|
1378
|
+
doc.head.appendChild(style2);
|
|
1379
|
+
}
|
|
1380
|
+
} catch (e3) {
|
|
778
1381
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
1382
|
+
});
|
|
1383
|
+
const style = doc.createElement("style");
|
|
1384
|
+
style.textContent = `
|
|
1385
|
+
html, body {
|
|
1386
|
+
margin: 0;
|
|
1387
|
+
padding: 0;
|
|
1388
|
+
background-color: transparent;
|
|
1389
|
+
min-height: 100vh;
|
|
786
1390
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 100%);
|
|
791
|
-
margin-bottom: 2rem;
|
|
1391
|
+
body {
|
|
1392
|
+
padding: 32px 16px;
|
|
1393
|
+
box-sizing: border-box;
|
|
792
1394
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
align-items: center;
|
|
797
|
-
gap: 0.5rem;
|
|
798
|
-
background: rgba(255, 255, 255, 0.04);
|
|
799
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
800
|
-
border-radius: 99px;
|
|
801
|
-
padding: 0.5rem 1.25rem;
|
|
802
|
-
font-size: 0.825rem;
|
|
803
|
-
font-weight: 500;
|
|
804
|
-
color: #94a3b8;
|
|
805
|
-
text-decoration: none;
|
|
806
|
-
transition: all 0.2s ease-in-out;
|
|
1395
|
+
.tecof-node-wrapper {
|
|
1396
|
+
position: relative;
|
|
1397
|
+
transition: outline 0.15s ease-in-out;
|
|
807
1398
|
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
color: #f8fafc;
|
|
813
|
-
transform: translateY(-1px);
|
|
1399
|
+
/* Custom scrollbars for iframe */
|
|
1400
|
+
::-webkit-scrollbar {
|
|
1401
|
+
width: 8px;
|
|
1402
|
+
height: 8px;
|
|
814
1403
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
width: 6px;
|
|
818
|
-
height: 6px;
|
|
819
|
-
background-color: ${accentColor};
|
|
820
|
-
border-radius: 50%;
|
|
821
|
-
box-shadow: 0 0 10px ${accentColor};
|
|
822
|
-
animation: tecof-uc-blink 1.5s infinite alternate;
|
|
1404
|
+
::-webkit-scrollbar-track {
|
|
1405
|
+
background: transparent;
|
|
823
1406
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
0% { opacity: 0.08; transform: translate(-50%, -50%) scale(0.95); }
|
|
828
|
-
100% { opacity: 0.15; transform: translate(-50%, -50%) scale(1.05); }
|
|
1407
|
+
::-webkit-scrollbar-thumb {
|
|
1408
|
+
background: rgba(0, 0, 0, 0.15);
|
|
1409
|
+
border-radius: 4px;
|
|
829
1410
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
0% { opacity: 0; transform: translateY(20px); }
|
|
833
|
-
100% { opacity: 1; transform: translateY(0); }
|
|
1411
|
+
::-webkit-scrollbar-thumb:hover {
|
|
1412
|
+
background: rgba(0, 0, 0, 0.25);
|
|
834
1413
|
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
1414
|
+
`;
|
|
1415
|
+
doc.head.appendChild(style);
|
|
1416
|
+
};
|
|
1417
|
+
copyStyles();
|
|
1418
|
+
if (doc.body) {
|
|
1419
|
+
doc.body.className = "tecof-canvas-body";
|
|
1420
|
+
const handleBodyClick = (e3) => {
|
|
1421
|
+
const target = e3.target;
|
|
1422
|
+
if (!target.closest(".tecof-node-wrapper")) {
|
|
1423
|
+
useEditorStore.getState().selectNode(null);
|
|
1424
|
+
const isEmbedded = typeof window !== "undefined" && window.parent !== window;
|
|
1425
|
+
if (isEmbedded) {
|
|
1426
|
+
window.parent.postMessage({ type: "puck:itemDeselected" }, "*");
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1430
|
+
doc.body.addEventListener("click", handleBodyClick);
|
|
1431
|
+
return () => {
|
|
1432
|
+
doc.body.removeEventListener("click", handleBodyClick);
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
}, [contentRef]);
|
|
1436
|
+
return /* @__PURE__ */ jsx(
|
|
1437
|
+
"iframe",
|
|
1438
|
+
{
|
|
1439
|
+
title,
|
|
1440
|
+
ref: setContentRef,
|
|
1441
|
+
style: {
|
|
1442
|
+
width: "100%",
|
|
1443
|
+
height: "100%",
|
|
1444
|
+
border: "none",
|
|
1445
|
+
background: "#ffffff",
|
|
1446
|
+
...props.style
|
|
1447
|
+
},
|
|
1448
|
+
...props,
|
|
1449
|
+
children: mountNode && createPortal(children, mountNode)
|
|
1450
|
+
}
|
|
1451
|
+
);
|
|
1452
|
+
};
|
|
1453
|
+
var Canvas = () => {
|
|
1454
|
+
const content = useEditorStore((state3) => state3.document.content);
|
|
1455
|
+
const viewport = useEditorStore((state3) => state3.viewport);
|
|
1456
|
+
const getWidth2 = () => {
|
|
1457
|
+
switch (viewport) {
|
|
1458
|
+
case "tablet":
|
|
1459
|
+
return "768px";
|
|
1460
|
+
case "mobile":
|
|
1461
|
+
return "375px";
|
|
1462
|
+
case "desktop":
|
|
1463
|
+
default:
|
|
1464
|
+
return "100%";
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
return /* @__PURE__ */ jsx("div", { className: "tecof-canvas-container", style: {
|
|
1468
|
+
flex: 1,
|
|
1469
|
+
display: "flex",
|
|
1470
|
+
alignItems: "center",
|
|
1471
|
+
justifyContent: "center",
|
|
1472
|
+
background: "#f4f4f5",
|
|
1473
|
+
padding: "24px",
|
|
1474
|
+
overflow: "auto",
|
|
1475
|
+
height: "100%",
|
|
1476
|
+
boxSizing: "border-box"
|
|
1477
|
+
}, children: /* @__PURE__ */ jsx(
|
|
1478
|
+
"div",
|
|
1479
|
+
{
|
|
1480
|
+
className: "tecof-canvas-viewport-wrapper",
|
|
1481
|
+
style: {
|
|
1482
|
+
width: getWidth2(),
|
|
1483
|
+
height: "100%",
|
|
1484
|
+
maxWidth: "100%",
|
|
1485
|
+
transition: "width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
1486
|
+
boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05)",
|
|
1487
|
+
borderRadius: viewport === "desktop" ? "0" : "12px",
|
|
1488
|
+
overflow: "hidden",
|
|
1489
|
+
backgroundColor: "#ffffff"
|
|
1490
|
+
},
|
|
1491
|
+
children: /* @__PURE__ */ jsx(Frame, { children: /* @__PURE__ */ jsx("div", { className: "tecof-canvas-root", style: { minHeight: "100%" }, children: content.map((item2, index2) => /* @__PURE__ */ jsx(NodeRenderer, { node: item2, index: index2 }, item2.props.id)) }) })
|
|
1492
|
+
}
|
|
1493
|
+
) });
|
|
1494
|
+
};
|
|
1495
|
+
var useOverlayCoords = (id, iframeEl, containerEl, documentState) => {
|
|
1496
|
+
const [coords, setCoords] = useState(null);
|
|
1497
|
+
useEffect(() => {
|
|
1498
|
+
if (!id || !iframeEl || !containerEl) {
|
|
1499
|
+
setCoords(null);
|
|
1500
|
+
return;
|
|
1501
|
+
}
|
|
1502
|
+
let resizeObserver = null;
|
|
1503
|
+
let targetResizeObserver = null;
|
|
1504
|
+
const updateCoords = () => {
|
|
1505
|
+
const doc = iframeEl.contentDocument;
|
|
1506
|
+
if (!doc) return;
|
|
1507
|
+
const element = doc.querySelector(`[data-tecof-id="${id}"]`);
|
|
1508
|
+
if (!element) {
|
|
1509
|
+
setCoords(null);
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
const rect = element.getBoundingClientRect();
|
|
1513
|
+
const iframeRect = iframeEl.getBoundingClientRect();
|
|
1514
|
+
const containerRect = containerEl.getBoundingClientRect();
|
|
1515
|
+
setCoords({
|
|
1516
|
+
top: rect.top + iframeRect.top - containerRect.top,
|
|
1517
|
+
left: rect.left + iframeRect.left - containerRect.left,
|
|
1518
|
+
width: rect.width,
|
|
1519
|
+
height: rect.height
|
|
1520
|
+
});
|
|
1521
|
+
if (!targetResizeObserver) {
|
|
1522
|
+
targetResizeObserver = new ResizeObserver(() => {
|
|
1523
|
+
updateCoords();
|
|
1524
|
+
});
|
|
1525
|
+
targetResizeObserver.observe(element);
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
updateCoords();
|
|
1529
|
+
const iframeWin = iframeEl.contentWindow;
|
|
1530
|
+
resizeObserver = new ResizeObserver(() => {
|
|
1531
|
+
updateCoords();
|
|
1532
|
+
});
|
|
1533
|
+
resizeObserver.observe(iframeEl);
|
|
1534
|
+
iframeWin?.addEventListener("scroll", updateCoords);
|
|
1535
|
+
window.addEventListener("resize", updateCoords);
|
|
1536
|
+
return () => {
|
|
1537
|
+
if (resizeObserver) resizeObserver.disconnect();
|
|
1538
|
+
if (targetResizeObserver) targetResizeObserver.disconnect();
|
|
1539
|
+
iframeWin?.removeEventListener("scroll", updateCoords);
|
|
1540
|
+
window.removeEventListener("resize", updateCoords);
|
|
1541
|
+
};
|
|
1542
|
+
}, [id, iframeEl, containerEl, documentState]);
|
|
1543
|
+
return coords;
|
|
1544
|
+
};
|
|
1545
|
+
var SelectionOverlay = () => {
|
|
1546
|
+
const documentState = useEditorStore((state3) => state3.document);
|
|
1547
|
+
const selectedId = useEditorStore((state3) => state3.selection.selectedId);
|
|
1548
|
+
const hoveredId = useEditorStore((state3) => state3.selection.hoveredId);
|
|
1549
|
+
const selectNode = useEditorStore((state3) => state3.selectNode);
|
|
1550
|
+
const removeNode2 = useEditorStore((state3) => state3.removeNode);
|
|
1551
|
+
const duplicateNode2 = useEditorStore((state3) => state3.duplicateNode);
|
|
1552
|
+
const moveNode2 = useEditorStore((state3) => state3.moveNode);
|
|
1553
|
+
const [iframeEl, setIframeEl] = useState(null);
|
|
1554
|
+
const containerRef = useRef(null);
|
|
1555
|
+
useEffect(() => {
|
|
1556
|
+
const iframe = document.querySelector(".tecof-canvas-viewport-wrapper iframe");
|
|
1557
|
+
setIframeEl(iframe);
|
|
1558
|
+
}, [documentState]);
|
|
1559
|
+
const selectedCoords = useOverlayCoords(selectedId, iframeEl, containerRef.current, documentState);
|
|
1560
|
+
const hoveredCoords = useOverlayCoords(
|
|
1561
|
+
hoveredId !== selectedId ? hoveredId : null,
|
|
1562
|
+
iframeEl,
|
|
1563
|
+
containerRef.current,
|
|
1564
|
+
documentState
|
|
1565
|
+
);
|
|
1566
|
+
const nodeDetails = selectedId ? findNodeById(documentState, selectedId) : null;
|
|
1567
|
+
const parentId = selectedId ? getParentId(documentState, selectedId) : null;
|
|
1568
|
+
const canMoveUp = nodeDetails ? nodeDetails.path.index > 0 : false;
|
|
1569
|
+
const canMoveDown = nodeDetails ? (() => {
|
|
1570
|
+
const { zoneKey, index: index2 } = nodeDetails.path;
|
|
1571
|
+
const items = zoneKey ? documentState.zones[zoneKey] || [] : documentState.content;
|
|
1572
|
+
return index2 < items.length - 1;
|
|
1573
|
+
})() : false;
|
|
1574
|
+
const handleMove = (direction) => {
|
|
1575
|
+
if (!selectedId || !nodeDetails) return;
|
|
1576
|
+
const { zoneKey, index: index2 } = nodeDetails.path;
|
|
1577
|
+
const newIndex = direction === "up" ? index2 - 1 : index2 + 1;
|
|
1578
|
+
moveNode2(selectedId, zoneKey, newIndex);
|
|
1579
|
+
};
|
|
1580
|
+
const breadcrumbs = selectedId ? getBreadcrumbs(documentState, selectedId) : [];
|
|
1581
|
+
return /* @__PURE__ */ jsxs(
|
|
1582
|
+
"div",
|
|
1583
|
+
{
|
|
1584
|
+
ref: containerRef,
|
|
1585
|
+
className: "tecof-selection-overlay-container",
|
|
1586
|
+
style: {
|
|
1587
|
+
position: "absolute",
|
|
1588
|
+
top: 0,
|
|
1589
|
+
left: 0,
|
|
1590
|
+
right: 0,
|
|
1591
|
+
bottom: 0,
|
|
1592
|
+
pointerEvents: "none",
|
|
1593
|
+
zIndex: 1e3
|
|
1594
|
+
},
|
|
1595
|
+
children: [
|
|
1596
|
+
hoveredCoords && /* @__PURE__ */ jsx(
|
|
1597
|
+
"div",
|
|
1598
|
+
{
|
|
1599
|
+
className: "tecof-hover-outline",
|
|
1600
|
+
style: {
|
|
1601
|
+
position: "absolute",
|
|
1602
|
+
top: hoveredCoords.top,
|
|
1603
|
+
left: hoveredCoords.left,
|
|
1604
|
+
width: hoveredCoords.width,
|
|
1605
|
+
height: hoveredCoords.height,
|
|
1606
|
+
border: "1.5px dashed #3b82f6",
|
|
1607
|
+
borderRadius: "4px",
|
|
1608
|
+
boxSizing: "border-box",
|
|
1609
|
+
pointerEvents: "none",
|
|
1610
|
+
transition: "all 0.1s ease-out"
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
),
|
|
1614
|
+
selectedCoords && /* @__PURE__ */ jsxs(
|
|
1615
|
+
"div",
|
|
1616
|
+
{
|
|
1617
|
+
className: "tecof-selected-outline",
|
|
1618
|
+
style: {
|
|
1619
|
+
position: "absolute",
|
|
1620
|
+
top: selectedCoords.top,
|
|
1621
|
+
left: selectedCoords.left,
|
|
1622
|
+
width: selectedCoords.width,
|
|
1623
|
+
height: selectedCoords.height,
|
|
1624
|
+
border: "2px solid #3b82f6",
|
|
1625
|
+
borderRadius: "4px",
|
|
1626
|
+
boxSizing: "border-box",
|
|
1627
|
+
pointerEvents: "none",
|
|
1628
|
+
transition: "all 0.1s ease-out"
|
|
1629
|
+
},
|
|
1630
|
+
children: [
|
|
1631
|
+
/* @__PURE__ */ jsxs(
|
|
1632
|
+
"div",
|
|
1633
|
+
{
|
|
1634
|
+
className: "tecof-floating-toolbar",
|
|
1635
|
+
style: {
|
|
1636
|
+
position: "absolute",
|
|
1637
|
+
top: "-36px",
|
|
1638
|
+
right: "-2px",
|
|
1639
|
+
display: "flex",
|
|
1640
|
+
alignItems: "center",
|
|
1641
|
+
gap: "4px",
|
|
1642
|
+
background: "#3b82f6",
|
|
1643
|
+
borderRadius: "6px",
|
|
1644
|
+
padding: "4px",
|
|
1645
|
+
pointerEvents: "auto",
|
|
1646
|
+
boxShadow: "0 4px 6px -1px rgba(59, 130, 246, 0.2)"
|
|
1647
|
+
},
|
|
1648
|
+
children: [
|
|
1649
|
+
parentId && /* @__PURE__ */ jsx(
|
|
1650
|
+
"button",
|
|
1651
|
+
{
|
|
1652
|
+
onClick: () => selectNode(parentId),
|
|
1653
|
+
title: "\xDCst \xD6\u011Feyi Se\xE7",
|
|
1654
|
+
style: {
|
|
1655
|
+
background: "transparent",
|
|
1656
|
+
border: "none",
|
|
1657
|
+
color: "#ffffff",
|
|
1658
|
+
cursor: "pointer",
|
|
1659
|
+
padding: "4px",
|
|
1660
|
+
borderRadius: "4px",
|
|
1661
|
+
display: "flex"
|
|
1662
|
+
},
|
|
1663
|
+
children: /* @__PURE__ */ jsx(ChevronUp, { size: 14 })
|
|
1664
|
+
}
|
|
1665
|
+
),
|
|
1666
|
+
/* @__PURE__ */ jsx(
|
|
1667
|
+
"button",
|
|
1668
|
+
{
|
|
1669
|
+
onClick: () => handleMove("up"),
|
|
1670
|
+
disabled: !canMoveUp,
|
|
1671
|
+
title: "Yukar\u0131 Ta\u015F\u0131",
|
|
1672
|
+
style: {
|
|
1673
|
+
background: "transparent",
|
|
1674
|
+
border: "none",
|
|
1675
|
+
color: "#ffffff",
|
|
1676
|
+
opacity: canMoveUp ? 1 : 0.5,
|
|
1677
|
+
cursor: canMoveUp ? "pointer" : "not-allowed",
|
|
1678
|
+
padding: "4px",
|
|
1679
|
+
borderRadius: "4px",
|
|
1680
|
+
display: "flex"
|
|
1681
|
+
},
|
|
1682
|
+
children: /* @__PURE__ */ jsx(ArrowUp, { size: 14 })
|
|
1683
|
+
}
|
|
1684
|
+
),
|
|
1685
|
+
/* @__PURE__ */ jsx(
|
|
1686
|
+
"button",
|
|
1687
|
+
{
|
|
1688
|
+
onClick: () => handleMove("down"),
|
|
1689
|
+
disabled: !canMoveDown,
|
|
1690
|
+
title: "A\u015Fa\u011F\u0131 Ta\u015F\u0131",
|
|
1691
|
+
style: {
|
|
1692
|
+
background: "transparent",
|
|
1693
|
+
border: "none",
|
|
1694
|
+
color: "#ffffff",
|
|
1695
|
+
opacity: canMoveDown ? 1 : 0.5,
|
|
1696
|
+
cursor: canMoveDown ? "pointer" : "not-allowed",
|
|
1697
|
+
padding: "4px",
|
|
1698
|
+
borderRadius: "4px",
|
|
1699
|
+
display: "flex"
|
|
1700
|
+
},
|
|
1701
|
+
children: /* @__PURE__ */ jsx(ArrowDown, { size: 14 })
|
|
1702
|
+
}
|
|
1703
|
+
),
|
|
1704
|
+
/* @__PURE__ */ jsx("div", { style: { width: "1px", height: "14px", background: "rgba(255,255,255,0.3)", margin: "0 2px" } }),
|
|
1705
|
+
/* @__PURE__ */ jsx(
|
|
1706
|
+
"button",
|
|
1707
|
+
{
|
|
1708
|
+
onClick: () => duplicateNode2(selectedId),
|
|
1709
|
+
title: "Kopyala",
|
|
1710
|
+
style: {
|
|
1711
|
+
background: "transparent",
|
|
1712
|
+
border: "none",
|
|
1713
|
+
color: "#ffffff",
|
|
1714
|
+
cursor: "pointer",
|
|
1715
|
+
padding: "4px",
|
|
1716
|
+
borderRadius: "4px",
|
|
1717
|
+
display: "flex"
|
|
1718
|
+
},
|
|
1719
|
+
children: /* @__PURE__ */ jsx(Copy, { size: 14 })
|
|
1720
|
+
}
|
|
1721
|
+
),
|
|
1722
|
+
/* @__PURE__ */ jsx(
|
|
1723
|
+
"button",
|
|
1724
|
+
{
|
|
1725
|
+
onClick: () => removeNode2(selectedId),
|
|
1726
|
+
title: "Sil",
|
|
1727
|
+
style: {
|
|
1728
|
+
background: "transparent",
|
|
1729
|
+
border: "none",
|
|
1730
|
+
color: "#ffffff",
|
|
1731
|
+
cursor: "pointer",
|
|
1732
|
+
padding: "4px",
|
|
1733
|
+
borderRadius: "4px",
|
|
1734
|
+
display: "flex"
|
|
1735
|
+
},
|
|
1736
|
+
children: /* @__PURE__ */ jsx(Trash2, { size: 14 })
|
|
1737
|
+
}
|
|
1738
|
+
)
|
|
1739
|
+
]
|
|
1740
|
+
}
|
|
1741
|
+
),
|
|
1742
|
+
nodeDetails && /* @__PURE__ */ jsx(
|
|
1743
|
+
"div",
|
|
1744
|
+
{
|
|
1745
|
+
className: "tecof-outline-label",
|
|
1746
|
+
style: {
|
|
1747
|
+
position: "absolute",
|
|
1748
|
+
top: "-26px",
|
|
1749
|
+
left: "-2px",
|
|
1750
|
+
background: "#3b82f6",
|
|
1751
|
+
color: "#ffffff",
|
|
1752
|
+
fontSize: "11px",
|
|
1753
|
+
fontWeight: 600,
|
|
1754
|
+
padding: "2px 8px",
|
|
1755
|
+
borderRadius: "4px 4px 0 0",
|
|
1756
|
+
userSelect: "none"
|
|
1757
|
+
},
|
|
1758
|
+
children: nodeDetails.node.type
|
|
1759
|
+
}
|
|
1760
|
+
),
|
|
1761
|
+
breadcrumbs.length > 1 && /* @__PURE__ */ jsx(
|
|
1762
|
+
"div",
|
|
1763
|
+
{
|
|
1764
|
+
className: "tecof-selected-breadcrumbs",
|
|
1765
|
+
style: {
|
|
1766
|
+
position: "absolute",
|
|
1767
|
+
bottom: "-28px",
|
|
1768
|
+
left: "-2px",
|
|
1769
|
+
display: "flex",
|
|
1770
|
+
alignItems: "center",
|
|
1771
|
+
gap: "4px",
|
|
1772
|
+
background: "#18181b",
|
|
1773
|
+
color: "#a1a1aa",
|
|
1774
|
+
fontSize: "10px",
|
|
1775
|
+
padding: "4px 8px",
|
|
1776
|
+
borderRadius: "0 0 6px 6px",
|
|
1777
|
+
pointerEvents: "auto",
|
|
1778
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.05)"
|
|
1779
|
+
},
|
|
1780
|
+
children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React__default__default.Fragment, { children: [
|
|
1781
|
+
idx > 0 && /* @__PURE__ */ jsx("span", { style: { color: "#52525b" }, children: ">" }),
|
|
1782
|
+
/* @__PURE__ */ jsx(
|
|
1783
|
+
"span",
|
|
1784
|
+
{
|
|
1785
|
+
onClick: () => selectNode(crumb.id),
|
|
1786
|
+
style: {
|
|
1787
|
+
cursor: "pointer",
|
|
1788
|
+
color: crumb.id === selectedId ? "#ffffff" : void 0,
|
|
1789
|
+
fontWeight: crumb.id === selectedId ? 600 : void 0
|
|
1790
|
+
},
|
|
1791
|
+
onMouseEnter: () => useEditorStore.getState().hoverNode(crumb.id),
|
|
1792
|
+
onMouseLeave: () => useEditorStore.getState().hoverNode(null),
|
|
1793
|
+
children: crumb.type
|
|
1794
|
+
}
|
|
1795
|
+
)
|
|
1796
|
+
] }, crumb.id))
|
|
1797
|
+
}
|
|
1798
|
+
)
|
|
1799
|
+
]
|
|
1800
|
+
}
|
|
1801
|
+
)
|
|
1802
|
+
]
|
|
1803
|
+
}
|
|
1804
|
+
);
|
|
1805
|
+
};
|
|
1806
|
+
var FieldLabel = ({
|
|
1807
|
+
label,
|
|
1808
|
+
icon,
|
|
1809
|
+
readOnly,
|
|
1810
|
+
children,
|
|
1811
|
+
el = "label"
|
|
1812
|
+
}) => {
|
|
1813
|
+
const Component2 = el;
|
|
1814
|
+
return /* @__PURE__ */ jsxs(
|
|
1815
|
+
Component2,
|
|
1816
|
+
{
|
|
1817
|
+
className: "tecof-field-label-container",
|
|
1818
|
+
style: {
|
|
1819
|
+
display: "flex",
|
|
1820
|
+
flexDirection: "column",
|
|
1821
|
+
gap: "6px",
|
|
1822
|
+
marginBottom: "16px",
|
|
1823
|
+
width: "100%",
|
|
1824
|
+
boxSizing: "border-box",
|
|
1825
|
+
userSelect: "none"
|
|
1826
|
+
},
|
|
1827
|
+
children: [
|
|
1828
|
+
/* @__PURE__ */ jsxs(
|
|
1829
|
+
"div",
|
|
1830
|
+
{
|
|
1831
|
+
className: "tecof-field-label-header",
|
|
1832
|
+
style: {
|
|
1833
|
+
display: "flex",
|
|
1834
|
+
alignItems: "center",
|
|
1835
|
+
gap: "6px",
|
|
1836
|
+
fontSize: "12px",
|
|
1837
|
+
fontWeight: 600,
|
|
1838
|
+
color: "#27272a"
|
|
1839
|
+
// zinc-800
|
|
1840
|
+
},
|
|
1841
|
+
children: [
|
|
1842
|
+
icon && /* @__PURE__ */ jsx("span", { style: { display: "inline-flex" }, children: icon }),
|
|
1843
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
1844
|
+
readOnly && /* @__PURE__ */ jsx(
|
|
1845
|
+
"span",
|
|
1846
|
+
{
|
|
1847
|
+
style: {
|
|
1848
|
+
fontSize: "10px",
|
|
1849
|
+
color: "#a1a1aa",
|
|
1850
|
+
fontWeight: 400,
|
|
1851
|
+
marginLeft: "auto"
|
|
1852
|
+
},
|
|
1853
|
+
children: "Salt Okunur"
|
|
1854
|
+
}
|
|
1855
|
+
)
|
|
1856
|
+
]
|
|
1857
|
+
}
|
|
1858
|
+
),
|
|
1859
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-field-label-content", style: { width: "100%" }, children })
|
|
1860
|
+
]
|
|
1861
|
+
}
|
|
1862
|
+
);
|
|
1863
|
+
};
|
|
1864
|
+
var FieldRenderer = ({
|
|
1865
|
+
name: name3,
|
|
1866
|
+
definition,
|
|
1867
|
+
value,
|
|
1868
|
+
onChange,
|
|
1869
|
+
readOnly = false
|
|
1870
|
+
}) => {
|
|
1871
|
+
const label = definition.label || name3;
|
|
1872
|
+
const type = definition.type;
|
|
1873
|
+
if (definition.render) {
|
|
1874
|
+
return /* @__PURE__ */ jsx("div", { className: "tecof-custom-field-wrapper", style: { width: "100%" }, children: definition.render({
|
|
1875
|
+
field: definition,
|
|
1876
|
+
name: name3,
|
|
1877
|
+
id: `field-${name3}`,
|
|
1878
|
+
value,
|
|
1879
|
+
onChange,
|
|
1880
|
+
readOnly
|
|
1881
|
+
}) });
|
|
1882
|
+
}
|
|
1883
|
+
switch (type) {
|
|
1884
|
+
case "text":
|
|
1885
|
+
return /* @__PURE__ */ jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsx(
|
|
1886
|
+
"input",
|
|
1887
|
+
{
|
|
1888
|
+
id: `field-${name3}`,
|
|
1889
|
+
type: "text",
|
|
1890
|
+
value: value || "",
|
|
1891
|
+
disabled: readOnly,
|
|
1892
|
+
onChange: (e3) => onChange(e3.target.value),
|
|
1893
|
+
style: {
|
|
1894
|
+
width: "100%",
|
|
1895
|
+
padding: "10px 12px",
|
|
1896
|
+
borderRadius: "8px",
|
|
1897
|
+
border: "1px solid #e4e4e7",
|
|
1898
|
+
fontSize: "13px",
|
|
1899
|
+
color: "#18181b",
|
|
1900
|
+
backgroundColor: readOnly ? "#f4f4f5" : "#ffffff",
|
|
1901
|
+
outline: "none",
|
|
1902
|
+
boxSizing: "border-box",
|
|
1903
|
+
transition: "border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out"
|
|
1904
|
+
},
|
|
1905
|
+
className: "tecof-input-text"
|
|
840
1906
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
1907
|
+
) });
|
|
1908
|
+
case "textarea":
|
|
1909
|
+
return /* @__PURE__ */ jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsx(
|
|
1910
|
+
"textarea",
|
|
1911
|
+
{
|
|
1912
|
+
id: `field-${name3}`,
|
|
1913
|
+
rows: 4,
|
|
1914
|
+
value: value || "",
|
|
1915
|
+
disabled: readOnly,
|
|
1916
|
+
onChange: (e3) => onChange(e3.target.value),
|
|
1917
|
+
style: {
|
|
1918
|
+
width: "100%",
|
|
1919
|
+
padding: "10px 12px",
|
|
1920
|
+
borderRadius: "8px",
|
|
1921
|
+
border: "1px solid #e4e4e7",
|
|
1922
|
+
fontSize: "13px",
|
|
1923
|
+
color: "#18181b",
|
|
1924
|
+
backgroundColor: readOnly ? "#f4f4f5" : "#ffffff",
|
|
1925
|
+
outline: "none",
|
|
1926
|
+
resize: "vertical",
|
|
1927
|
+
boxSizing: "border-box",
|
|
1928
|
+
transition: "border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out"
|
|
1929
|
+
},
|
|
1930
|
+
className: "tecof-input-textarea"
|
|
845
1931
|
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
1932
|
+
) });
|
|
1933
|
+
case "select":
|
|
1934
|
+
return /* @__PURE__ */ jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: "100%" }, children: [
|
|
1935
|
+
/* @__PURE__ */ jsx(
|
|
1936
|
+
"select",
|
|
1937
|
+
{
|
|
1938
|
+
id: `field-${name3}`,
|
|
1939
|
+
value: value || "",
|
|
1940
|
+
disabled: readOnly,
|
|
1941
|
+
onChange: (e3) => onChange(e3.target.value),
|
|
1942
|
+
style: {
|
|
1943
|
+
width: "100%",
|
|
1944
|
+
padding: "10px 32px 10px 12px",
|
|
1945
|
+
borderRadius: "8px",
|
|
1946
|
+
border: "1px solid #e4e4e7",
|
|
1947
|
+
fontSize: "13px",
|
|
1948
|
+
color: "#18181b",
|
|
1949
|
+
backgroundColor: readOnly ? "#f4f4f5" : "#ffffff",
|
|
1950
|
+
outline: "none",
|
|
1951
|
+
appearance: "none",
|
|
1952
|
+
boxSizing: "border-box",
|
|
1953
|
+
cursor: readOnly ? "not-allowed" : "pointer"
|
|
1954
|
+
},
|
|
1955
|
+
className: "tecof-input-select",
|
|
1956
|
+
children: (definition.options || []).map((opt) => /* @__PURE__ */ jsx("option", { value: opt.value, children: opt.label || opt.value }, opt.value))
|
|
854
1957
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1958
|
+
),
|
|
1959
|
+
/* @__PURE__ */ jsx(
|
|
1960
|
+
"div",
|
|
1961
|
+
{
|
|
1962
|
+
style: {
|
|
1963
|
+
position: "absolute",
|
|
1964
|
+
top: "50%",
|
|
1965
|
+
right: "12px",
|
|
1966
|
+
transform: "translateY(-50%)",
|
|
1967
|
+
pointerEvents: "none",
|
|
1968
|
+
display: "flex",
|
|
1969
|
+
alignItems: "center",
|
|
1970
|
+
color: "#71717a"
|
|
1971
|
+
},
|
|
1972
|
+
children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M2.5 4.5L6 8L9.5 4.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
858
1973
|
}
|
|
1974
|
+
)
|
|
1975
|
+
] }) });
|
|
1976
|
+
case "number":
|
|
1977
|
+
return /* @__PURE__ */ jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsx(
|
|
1978
|
+
"input",
|
|
1979
|
+
{
|
|
1980
|
+
id: `field-${name3}`,
|
|
1981
|
+
type: "number",
|
|
1982
|
+
value: value !== void 0 ? value : "",
|
|
1983
|
+
disabled: readOnly,
|
|
1984
|
+
onChange: (e3) => {
|
|
1985
|
+
const val = e3.target.value;
|
|
1986
|
+
onChange(val === "" ? void 0 : Number(val));
|
|
1987
|
+
},
|
|
1988
|
+
style: {
|
|
1989
|
+
width: "100%",
|
|
1990
|
+
padding: "10px 12px",
|
|
1991
|
+
borderRadius: "8px",
|
|
1992
|
+
border: "1px solid #e4e4e7",
|
|
1993
|
+
fontSize: "13px",
|
|
1994
|
+
color: "#18181b",
|
|
1995
|
+
backgroundColor: readOnly ? "#f4f4f5" : "#ffffff",
|
|
1996
|
+
outline: "none",
|
|
1997
|
+
boxSizing: "border-box"
|
|
1998
|
+
},
|
|
1999
|
+
className: "tecof-input-number"
|
|
859
2000
|
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
2001
|
+
) });
|
|
2002
|
+
case "radio":
|
|
2003
|
+
return /* @__PURE__ */ jsx(FieldLabel, { label, readOnly, children: /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: (definition.options || []).map((opt) => /* @__PURE__ */ jsxs(
|
|
2004
|
+
"label",
|
|
2005
|
+
{
|
|
2006
|
+
style: {
|
|
2007
|
+
display: "flex",
|
|
2008
|
+
alignItems: "center",
|
|
2009
|
+
gap: "8px",
|
|
2010
|
+
fontSize: "13px",
|
|
2011
|
+
color: "#27272a",
|
|
2012
|
+
cursor: readOnly ? "not-allowed" : "pointer"
|
|
2013
|
+
},
|
|
2014
|
+
children: [
|
|
2015
|
+
/* @__PURE__ */ jsx(
|
|
2016
|
+
"input",
|
|
2017
|
+
{
|
|
2018
|
+
type: "radio",
|
|
2019
|
+
name: name3,
|
|
2020
|
+
value: opt.value,
|
|
2021
|
+
checked: value === opt.value,
|
|
2022
|
+
disabled: readOnly,
|
|
2023
|
+
onChange: () => onChange(opt.value),
|
|
2024
|
+
style: {
|
|
2025
|
+
cursor: readOnly ? "not-allowed" : "pointer"
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
),
|
|
2029
|
+
/* @__PURE__ */ jsx("span", { children: opt.label || opt.value })
|
|
2030
|
+
]
|
|
2031
|
+
},
|
|
2032
|
+
opt.value
|
|
2033
|
+
)) }) });
|
|
2034
|
+
default:
|
|
2035
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: "8px", fontSize: "11px", color: "#71717a", background: "#fafafa", borderRadius: "4px" }, children: [
|
|
2036
|
+
'Desteklenmeyen alan t\xFCr\xFC: "',
|
|
2037
|
+
type,
|
|
2038
|
+
'" (',
|
|
2039
|
+
name3,
|
|
2040
|
+
")"
|
|
2041
|
+
] });
|
|
2042
|
+
}
|
|
878
2043
|
};
|
|
879
|
-
var
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
const
|
|
883
|
-
const
|
|
2044
|
+
var Inspector = () => {
|
|
2045
|
+
const documentState = useEditorStore((state3) => state3.document);
|
|
2046
|
+
const selectedId = useEditorStore((state3) => state3.selection.selectedId);
|
|
2047
|
+
const updateProps2 = useEditorStore((state3) => state3.updateProps);
|
|
2048
|
+
const setRootProps2 = useEditorStore((state3) => state3.setRootProps);
|
|
2049
|
+
const selectNode = useEditorStore((state3) => state3.selectNode);
|
|
2050
|
+
const { config: config3, readOnly } = useStudio();
|
|
2051
|
+
if (selectedId) {
|
|
2052
|
+
const nodeDetails = findNodeById(documentState, selectedId);
|
|
2053
|
+
if (!nodeDetails) {
|
|
2054
|
+
return /* @__PURE__ */ jsx("div", { style: { padding: "24px", color: "#71717a", fontSize: "13px", textAlign: "center" }, children: "Bile\u015Fen y\xFCkleniyor veya bulunamad\u0131." });
|
|
2055
|
+
}
|
|
2056
|
+
const { node } = nodeDetails;
|
|
2057
|
+
const componentConfig = config3.components[node.type];
|
|
2058
|
+
const fields = componentConfig?.fields || {};
|
|
2059
|
+
const label = componentConfig?.label || node.type;
|
|
2060
|
+
return /* @__PURE__ */ jsxs(
|
|
2061
|
+
"div",
|
|
2062
|
+
{
|
|
2063
|
+
className: "tecof-inspector",
|
|
2064
|
+
style: {
|
|
2065
|
+
width: "320px",
|
|
2066
|
+
height: "100%",
|
|
2067
|
+
borderLeft: "1px solid #e4e4e7",
|
|
2068
|
+
background: "#ffffff",
|
|
2069
|
+
display: "flex",
|
|
2070
|
+
flexDirection: "column",
|
|
2071
|
+
boxSizing: "border-box"
|
|
2072
|
+
},
|
|
2073
|
+
children: [
|
|
2074
|
+
/* @__PURE__ */ jsxs(
|
|
2075
|
+
"div",
|
|
2076
|
+
{
|
|
2077
|
+
style: {
|
|
2078
|
+
padding: "16px 20px",
|
|
2079
|
+
borderBottom: "1px solid #f4f4f5",
|
|
2080
|
+
display: "flex",
|
|
2081
|
+
alignItems: "center",
|
|
2082
|
+
justifyContent: "space-between"
|
|
2083
|
+
},
|
|
2084
|
+
children: [
|
|
2085
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2086
|
+
/* @__PURE__ */ jsx("h3", { style: { margin: 0, fontSize: "14px", fontWeight: 700, color: "#18181b" }, children: label }),
|
|
2087
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#a1a1aa", fontFamily: "monospace" }, children: selectedId })
|
|
2088
|
+
] }),
|
|
2089
|
+
/* @__PURE__ */ jsx(
|
|
2090
|
+
"button",
|
|
2091
|
+
{
|
|
2092
|
+
onClick: () => selectNode(null),
|
|
2093
|
+
style: {
|
|
2094
|
+
background: "transparent",
|
|
2095
|
+
border: "none",
|
|
2096
|
+
color: "#71717a",
|
|
2097
|
+
cursor: "pointer",
|
|
2098
|
+
fontSize: "11px",
|
|
2099
|
+
fontWeight: 500,
|
|
2100
|
+
padding: "4px 8px",
|
|
2101
|
+
borderRadius: "4px",
|
|
2102
|
+
hover: { background: "#f4f4f5" }
|
|
2103
|
+
},
|
|
2104
|
+
children: "Se\xE7imi Kald\u0131r"
|
|
2105
|
+
}
|
|
2106
|
+
)
|
|
2107
|
+
]
|
|
2108
|
+
}
|
|
2109
|
+
),
|
|
2110
|
+
/* @__PURE__ */ jsx(
|
|
2111
|
+
"div",
|
|
2112
|
+
{
|
|
2113
|
+
className: "tecof-inspector-fields",
|
|
2114
|
+
style: {
|
|
2115
|
+
flex: 1,
|
|
2116
|
+
overflowY: "auto",
|
|
2117
|
+
padding: "20px",
|
|
2118
|
+
display: "flex",
|
|
2119
|
+
flexDirection: "column",
|
|
2120
|
+
gap: "4px"
|
|
2121
|
+
},
|
|
2122
|
+
children: Object.keys(fields).length === 0 ? /* @__PURE__ */ 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__ */ jsx(
|
|
2123
|
+
FieldRenderer,
|
|
2124
|
+
{
|
|
2125
|
+
name: fieldName,
|
|
2126
|
+
definition: fieldDef,
|
|
2127
|
+
value: node.props[fieldName],
|
|
2128
|
+
onChange: (newVal) => updateProps2(selectedId, { [fieldName]: newVal }),
|
|
2129
|
+
readOnly
|
|
2130
|
+
},
|
|
2131
|
+
fieldName
|
|
2132
|
+
))
|
|
2133
|
+
}
|
|
2134
|
+
)
|
|
2135
|
+
]
|
|
2136
|
+
}
|
|
2137
|
+
);
|
|
2138
|
+
}
|
|
2139
|
+
const rootFields = config3.root?.fields || {};
|
|
2140
|
+
const hasRootFields = Object.keys(rootFields).length > 0;
|
|
2141
|
+
return /* @__PURE__ */ jsxs(
|
|
2142
|
+
"div",
|
|
2143
|
+
{
|
|
2144
|
+
className: "tecof-inspector",
|
|
2145
|
+
style: {
|
|
2146
|
+
width: "320px",
|
|
2147
|
+
height: "100%",
|
|
2148
|
+
borderLeft: "1px solid #e4e4e7",
|
|
2149
|
+
background: "#ffffff",
|
|
2150
|
+
display: "flex",
|
|
2151
|
+
flexDirection: "column",
|
|
2152
|
+
boxSizing: "border-box"
|
|
2153
|
+
},
|
|
2154
|
+
children: [
|
|
2155
|
+
/* @__PURE__ */ jsxs(
|
|
2156
|
+
"div",
|
|
2157
|
+
{
|
|
2158
|
+
style: {
|
|
2159
|
+
padding: "16px 20px",
|
|
2160
|
+
borderBottom: "1px solid #f4f4f5"
|
|
2161
|
+
},
|
|
2162
|
+
children: [
|
|
2163
|
+
/* @__PURE__ */ jsx("h3", { style: { margin: 0, fontSize: "14px", fontWeight: 700, color: "#18181b" }, children: "Sayfa Ayarlar\u0131" }),
|
|
2164
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#a1a1aa" }, children: "Genel sayfa konfig\xFCrasyonu" })
|
|
2165
|
+
]
|
|
2166
|
+
}
|
|
2167
|
+
),
|
|
2168
|
+
/* @__PURE__ */ jsx(
|
|
2169
|
+
"div",
|
|
2170
|
+
{
|
|
2171
|
+
className: "tecof-inspector-fields",
|
|
2172
|
+
style: {
|
|
2173
|
+
flex: 1,
|
|
2174
|
+
overflowY: "auto",
|
|
2175
|
+
padding: "20px",
|
|
2176
|
+
display: "flex",
|
|
2177
|
+
flexDirection: "column",
|
|
2178
|
+
gap: "4px"
|
|
2179
|
+
},
|
|
2180
|
+
children: hasRootFields ? Object.entries(rootFields).map(([fieldName, fieldDef]) => /* @__PURE__ */ jsx(
|
|
2181
|
+
FieldRenderer,
|
|
2182
|
+
{
|
|
2183
|
+
name: fieldName,
|
|
2184
|
+
definition: fieldDef,
|
|
2185
|
+
value: documentState.root.props[fieldName],
|
|
2186
|
+
onChange: (newVal) => setRootProps2({ [fieldName]: newVal }),
|
|
2187
|
+
readOnly
|
|
2188
|
+
},
|
|
2189
|
+
fieldName
|
|
2190
|
+
)) : /* @__PURE__ */ jsxs(
|
|
2191
|
+
"div",
|
|
2192
|
+
{
|
|
2193
|
+
style: {
|
|
2194
|
+
display: "flex",
|
|
2195
|
+
flexDirection: "column",
|
|
2196
|
+
alignItems: "center",
|
|
2197
|
+
justifyContent: "center",
|
|
2198
|
+
height: "100%",
|
|
2199
|
+
color: "#a1a1aa",
|
|
2200
|
+
fontSize: "12px",
|
|
2201
|
+
textAlign: "center",
|
|
2202
|
+
padding: "20px"
|
|
2203
|
+
},
|
|
2204
|
+
children: [
|
|
2205
|
+
/* @__PURE__ */ jsxs(
|
|
2206
|
+
"svg",
|
|
2207
|
+
{
|
|
2208
|
+
width: "24",
|
|
2209
|
+
height: "24",
|
|
2210
|
+
viewBox: "0 0 24 24",
|
|
2211
|
+
fill: "none",
|
|
2212
|
+
stroke: "currentColor",
|
|
2213
|
+
strokeWidth: "2",
|
|
2214
|
+
strokeLinecap: "round",
|
|
2215
|
+
strokeLinejoin: "round",
|
|
2216
|
+
style: { marginBottom: "8px", opacity: 0.6 },
|
|
2217
|
+
children: [
|
|
2218
|
+
/* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
|
|
2219
|
+
/* @__PURE__ */ jsx("path", { d: "M9 3v18" })
|
|
2220
|
+
]
|
|
2221
|
+
}
|
|
2222
|
+
),
|
|
2223
|
+
"Bile\u015Fen se\xE7ilmedi. D\xFCzenlemek istedi\u011Finiz bir bile\u015Fene t\u0131klay\u0131n."
|
|
2224
|
+
]
|
|
2225
|
+
}
|
|
2226
|
+
)
|
|
2227
|
+
}
|
|
2228
|
+
)
|
|
2229
|
+
]
|
|
2230
|
+
}
|
|
2231
|
+
);
|
|
2232
|
+
};
|
|
2233
|
+
var TecofStudio = ({
|
|
2234
|
+
pageId,
|
|
2235
|
+
config: config3,
|
|
2236
|
+
accessToken,
|
|
2237
|
+
onSave,
|
|
2238
|
+
onChange,
|
|
2239
|
+
className
|
|
2240
|
+
}) => {
|
|
2241
|
+
const { apiClient } = useTecof();
|
|
884
2242
|
const [loading, setLoading] = useState(true);
|
|
885
|
-
const [
|
|
886
|
-
const [
|
|
887
|
-
const
|
|
2243
|
+
const [saving, setSaving] = useState(false);
|
|
2244
|
+
const [saveStatus, setSaveStatus] = useState("idle");
|
|
2245
|
+
const setDocument = useEditorStore((state3) => state3.setDocument);
|
|
2246
|
+
const documentState = useEditorStore((state3) => state3.document);
|
|
2247
|
+
const undo = useEditorStore((state3) => state3.undo);
|
|
2248
|
+
const redo = useEditorStore((state3) => state3.redo);
|
|
2249
|
+
const setViewport = useEditorStore((state3) => state3.setViewport);
|
|
2250
|
+
const documentStateRef = useRef(documentState);
|
|
2251
|
+
documentStateRef.current = documentState;
|
|
2252
|
+
const isEmbedded = typeof window !== "undefined" && window.parent !== window;
|
|
888
2253
|
useEffect(() => {
|
|
889
2254
|
let cancelled = false;
|
|
890
|
-
const
|
|
891
|
-
const cached = merchantInfoCache.get(cacheKey);
|
|
892
|
-
if (cached && Date.now() - cached.ts < CACHE_TTL) {
|
|
893
|
-
setMerchantInfo(cached.data);
|
|
894
|
-
if (!activeTab) setActiveTab(cached.data.defaultLanguage);
|
|
895
|
-
setLoading(false);
|
|
896
|
-
return;
|
|
897
|
-
}
|
|
2255
|
+
const load = async () => {
|
|
898
2256
|
setLoading(true);
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
setMerchantInfo(fallback);
|
|
910
|
-
if (!activeTab) setActiveTab("tr");
|
|
2257
|
+
try {
|
|
2258
|
+
const res2 = await apiClient.getPage(pageId);
|
|
2259
|
+
if (cancelled) return;
|
|
2260
|
+
const rawData = res2.success && res2.data?.draftData ? res2.data.draftData : null;
|
|
2261
|
+
const parsedDoc = parseDocument(rawData);
|
|
2262
|
+
setDocument(parsedDoc);
|
|
2263
|
+
} catch (err) {
|
|
2264
|
+
console.error("Failed to load page:", err);
|
|
2265
|
+
} finally {
|
|
2266
|
+
setLoading(false);
|
|
911
2267
|
}
|
|
912
|
-
setLoading(false);
|
|
913
2268
|
};
|
|
914
|
-
|
|
2269
|
+
load();
|
|
915
2270
|
return () => {
|
|
916
2271
|
cancelled = true;
|
|
917
2272
|
};
|
|
918
|
-
}, [apiClient,
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
}).join(" ").trim();
|
|
926
|
-
|
|
927
|
-
// node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.js
|
|
928
|
-
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
929
|
-
|
|
930
|
-
// node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.js
|
|
931
|
-
var toCamelCase = (string) => string.replace(
|
|
932
|
-
/^([A-Z])|[\s-_]+(\w)/g,
|
|
933
|
-
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
934
|
-
);
|
|
935
|
-
|
|
936
|
-
// node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.js
|
|
937
|
-
var toPascalCase = (string) => {
|
|
938
|
-
const camelCase = toCamelCase(string);
|
|
939
|
-
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
940
|
-
};
|
|
941
|
-
|
|
942
|
-
// node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
943
|
-
var defaultAttributes = {
|
|
944
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
945
|
-
width: 24,
|
|
946
|
-
height: 24,
|
|
947
|
-
viewBox: "0 0 24 24",
|
|
948
|
-
fill: "none",
|
|
949
|
-
stroke: "currentColor",
|
|
950
|
-
strokeWidth: 2,
|
|
951
|
-
strokeLinecap: "round",
|
|
952
|
-
strokeLinejoin: "round"
|
|
953
|
-
};
|
|
954
|
-
|
|
955
|
-
// node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.js
|
|
956
|
-
var hasA11yProp = (props) => {
|
|
957
|
-
for (const prop in props) {
|
|
958
|
-
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
959
|
-
return true;
|
|
2273
|
+
}, [pageId, apiClient, setDocument]);
|
|
2274
|
+
const isFirstRender = useRef(true);
|
|
2275
|
+
useEffect(() => {
|
|
2276
|
+
if (loading) return;
|
|
2277
|
+
if (isFirstRender.current) {
|
|
2278
|
+
isFirstRender.current = false;
|
|
2279
|
+
return;
|
|
960
2280
|
}
|
|
2281
|
+
const serialized = serializeDocument(documentState);
|
|
2282
|
+
onChange?.(serialized);
|
|
2283
|
+
if (isEmbedded) {
|
|
2284
|
+
window.parent.postMessage({ type: "puck:changed" }, "*");
|
|
2285
|
+
}
|
|
2286
|
+
}, [documentState, loading, onChange, isEmbedded]);
|
|
2287
|
+
const handleSaveDraft = useCallback(async () => {
|
|
2288
|
+
const currentDoc = documentStateRef.current;
|
|
2289
|
+
const serialized = serializeDocument(currentDoc);
|
|
2290
|
+
setSaving(true);
|
|
2291
|
+
setSaveStatus("idle");
|
|
2292
|
+
try {
|
|
2293
|
+
const res2 = await apiClient.savePage(pageId, serialized, void 0, accessToken);
|
|
2294
|
+
if (res2.success) {
|
|
2295
|
+
setSaveStatus("success");
|
|
2296
|
+
setTimeout(() => setSaveStatus("idle"), 3e3);
|
|
2297
|
+
onSave?.(serialized);
|
|
2298
|
+
if (isEmbedded) {
|
|
2299
|
+
window.parent.postMessage({ type: "puck:saved" }, "*");
|
|
2300
|
+
}
|
|
2301
|
+
} else {
|
|
2302
|
+
setSaveStatus("error");
|
|
2303
|
+
if (isEmbedded) {
|
|
2304
|
+
window.parent.postMessage({ type: "puck:saveError", message: res2.message }, "*");
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
} catch (err) {
|
|
2308
|
+
setSaveStatus("error");
|
|
2309
|
+
if (isEmbedded) {
|
|
2310
|
+
window.parent.postMessage({ type: "puck:saveError", message: err.message }, "*");
|
|
2311
|
+
}
|
|
2312
|
+
} finally {
|
|
2313
|
+
setSaving(false);
|
|
2314
|
+
}
|
|
2315
|
+
}, [pageId, apiClient, accessToken, onSave, isEmbedded]);
|
|
2316
|
+
useEffect(() => {
|
|
2317
|
+
if (!isEmbedded) return;
|
|
2318
|
+
const onMessage = (e3) => {
|
|
2319
|
+
switch (e3.data?.type) {
|
|
2320
|
+
case "puck:save":
|
|
2321
|
+
handleSaveDraft();
|
|
2322
|
+
break;
|
|
2323
|
+
case "puck:undo":
|
|
2324
|
+
undo();
|
|
2325
|
+
break;
|
|
2326
|
+
case "puck:redo":
|
|
2327
|
+
redo();
|
|
2328
|
+
break;
|
|
2329
|
+
case "puck:viewport":
|
|
2330
|
+
if (e3.data.width) {
|
|
2331
|
+
const width = e3.data.width;
|
|
2332
|
+
if (width === "375px" || width === 375) {
|
|
2333
|
+
setViewport("mobile");
|
|
2334
|
+
} else if (width === "768px" || width === 768) {
|
|
2335
|
+
setViewport("tablet");
|
|
2336
|
+
} else {
|
|
2337
|
+
setViewport("desktop");
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
break;
|
|
2341
|
+
}
|
|
2342
|
+
};
|
|
2343
|
+
window.addEventListener("message", onMessage);
|
|
2344
|
+
return () => window.removeEventListener("message", onMessage);
|
|
2345
|
+
}, [isEmbedded, handleSaveDraft, undo, redo, setViewport]);
|
|
2346
|
+
const studioContextValue = useMemo(() => ({
|
|
2347
|
+
config: config3,
|
|
2348
|
+
readOnly: false,
|
|
2349
|
+
apiClient
|
|
2350
|
+
}), [config3, apiClient]);
|
|
2351
|
+
if (loading) {
|
|
2352
|
+
return /* @__PURE__ */ jsx("div", { className: `tecof-editor-loading ${className || ""}`.trim(), style: {
|
|
2353
|
+
display: "flex",
|
|
2354
|
+
alignItems: "center",
|
|
2355
|
+
justifyContent: "center",
|
|
2356
|
+
height: "100vh",
|
|
2357
|
+
background: "#f4f4f5"
|
|
2358
|
+
}, children: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
2359
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-editor-spinner", style: {
|
|
2360
|
+
width: "40px",
|
|
2361
|
+
height: "40px",
|
|
2362
|
+
border: "3px solid #e4e4e7",
|
|
2363
|
+
borderTopColor: "#3b82f6",
|
|
2364
|
+
borderRadius: "50%",
|
|
2365
|
+
animation: "spin 1s linear infinite",
|
|
2366
|
+
margin: "0 auto 16px"
|
|
2367
|
+
} }),
|
|
2368
|
+
/* @__PURE__ */ jsx("p", { style: { color: "#71717a", fontSize: "14px", margin: 0 }, children: "St\xFCdyo y\xFCkleniyor..." })
|
|
2369
|
+
] }) });
|
|
961
2370
|
}
|
|
962
|
-
return
|
|
2371
|
+
return /* @__PURE__ */ jsx(StudioContext.Provider, { value: studioContextValue, children: /* @__PURE__ */ jsxs("div", { className: `tecof-studio-root ${className || ""}`.trim(), style: {
|
|
2372
|
+
display: "flex",
|
|
2373
|
+
flexDirection: "column",
|
|
2374
|
+
height: "100vh",
|
|
2375
|
+
width: "100vw",
|
|
2376
|
+
overflow: "hidden",
|
|
2377
|
+
position: "relative",
|
|
2378
|
+
background: "#f4f4f5"
|
|
2379
|
+
}, children: [
|
|
2380
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-studio-workspace-container", style: {
|
|
2381
|
+
display: "flex",
|
|
2382
|
+
flex: 1,
|
|
2383
|
+
height: "100%",
|
|
2384
|
+
width: "100%",
|
|
2385
|
+
overflow: "hidden"
|
|
2386
|
+
}, children: [
|
|
2387
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-studio-workspace", style: {
|
|
2388
|
+
display: "flex",
|
|
2389
|
+
flex: 1,
|
|
2390
|
+
height: "100%",
|
|
2391
|
+
position: "relative",
|
|
2392
|
+
overflow: "hidden"
|
|
2393
|
+
}, children: [
|
|
2394
|
+
/* @__PURE__ */ jsx(Canvas, {}),
|
|
2395
|
+
/* @__PURE__ */ jsx(SelectionOverlay, {})
|
|
2396
|
+
] }),
|
|
2397
|
+
/* @__PURE__ */ jsx(Inspector, {})
|
|
2398
|
+
] }),
|
|
2399
|
+
saving && /* @__PURE__ */ jsx("div", { className: "tecof-editor-save-indicator", style: {
|
|
2400
|
+
position: "absolute",
|
|
2401
|
+
bottom: "24px",
|
|
2402
|
+
right: "24px",
|
|
2403
|
+
background: saveStatus === "error" ? "#ef4444" : "#18181b",
|
|
2404
|
+
color: "#ffffff",
|
|
2405
|
+
padding: "8px 16px",
|
|
2406
|
+
borderRadius: "24px",
|
|
2407
|
+
fontSize: "12px",
|
|
2408
|
+
fontWeight: 500,
|
|
2409
|
+
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1)",
|
|
2410
|
+
zIndex: 9999
|
|
2411
|
+
}, children: saveStatus === "error" ? "Kaydedilemedi" : "Kaydediliyor..." })
|
|
2412
|
+
] }) });
|
|
963
2413
|
};
|
|
964
|
-
var
|
|
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
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
2414
|
+
var TecofRender = ({ data: data3, config: config3, className, cmsData }) => {
|
|
2415
|
+
if (!data3) return null;
|
|
2416
|
+
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
2417
|
+
Render,
|
|
2418
|
+
{
|
|
2419
|
+
config: config3,
|
|
2420
|
+
data: data3,
|
|
2421
|
+
metadata: { cmsData: cmsData || null }
|
|
2422
|
+
}
|
|
2423
|
+
) });
|
|
2424
|
+
};
|
|
2425
|
+
var IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "svg", "avif", "bmp", "tiff", "heic"];
|
|
2426
|
+
var VIDEO_EXTENSIONS = ["mp4", "webm", "ogg", "avi", "mov", "quicktime"];
|
|
2427
|
+
var isImage = (type) => {
|
|
2428
|
+
if (!type) return false;
|
|
2429
|
+
const t2 = type.toLowerCase();
|
|
2430
|
+
return IMAGE_EXTENSIONS.some((ext) => t2.includes(ext)) || t2.startsWith("image/");
|
|
2431
|
+
};
|
|
2432
|
+
var isVideo = (type) => {
|
|
2433
|
+
if (!type) return false;
|
|
2434
|
+
const t2 = type.toLowerCase();
|
|
2435
|
+
return VIDEO_EXTENSIONS.some((ext) => t2.includes(ext)) || t2.startsWith("video/");
|
|
2436
|
+
};
|
|
2437
|
+
var getSizes = (size) => {
|
|
2438
|
+
switch (size) {
|
|
2439
|
+
case "thumbnail":
|
|
2440
|
+
return "(max-width: 360px) 100vw, 360px";
|
|
2441
|
+
case "medium":
|
|
2442
|
+
return "(max-width: 540px) 100vw, 540px";
|
|
2443
|
+
case "large":
|
|
2444
|
+
return "(max-width: 720px) 100vw, 720px";
|
|
2445
|
+
default:
|
|
2446
|
+
return "100vw";
|
|
996
2447
|
}
|
|
997
|
-
);
|
|
998
|
-
|
|
999
|
-
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
1000
|
-
var createLucideIcon = (iconName, iconNode) => {
|
|
1001
|
-
const Component2 = forwardRef(
|
|
1002
|
-
({ className, ...props }, ref) => createElement(Icon, {
|
|
1003
|
-
ref,
|
|
1004
|
-
iconNode,
|
|
1005
|
-
className: mergeClasses(
|
|
1006
|
-
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
1007
|
-
`lucide-${iconName}`,
|
|
1008
|
-
className
|
|
1009
|
-
),
|
|
1010
|
-
...props
|
|
1011
|
-
})
|
|
1012
|
-
);
|
|
1013
|
-
Component2.displayName = toPascalCase(iconName);
|
|
1014
|
-
return Component2;
|
|
1015
2448
|
};
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
// node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
1052
|
-
var __iconNode7 = [
|
|
1053
|
-
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
1054
|
-
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
1055
|
-
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
1056
|
-
];
|
|
1057
|
-
var ExternalLink = createLucideIcon("external-link", __iconNode7);
|
|
1058
|
-
|
|
1059
|
-
// node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
1060
|
-
var __iconNode8 = [
|
|
1061
|
-
[
|
|
1062
|
-
"path",
|
|
2449
|
+
var DEFAULT_BLUR_DATA_URL = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiNmM2Y0ZjYiLz48L3N2Zz4=";
|
|
2450
|
+
var TecofPicture = memo(({
|
|
2451
|
+
data: data3,
|
|
2452
|
+
alt = null,
|
|
2453
|
+
size = "full",
|
|
2454
|
+
loading = "lazy",
|
|
2455
|
+
fill = false,
|
|
2456
|
+
style,
|
|
2457
|
+
imgStyle,
|
|
2458
|
+
className,
|
|
2459
|
+
imgClassName,
|
|
2460
|
+
width,
|
|
2461
|
+
height,
|
|
2462
|
+
usePlaceholder = true,
|
|
2463
|
+
blurDataURL = DEFAULT_BLUR_DATA_URL,
|
|
2464
|
+
fancybox = false,
|
|
2465
|
+
fancyboxName = "gallery",
|
|
2466
|
+
ImageComponent,
|
|
2467
|
+
imageProps = {}
|
|
2468
|
+
}) => {
|
|
2469
|
+
const { apiClient } = useTecof();
|
|
2470
|
+
const cdnUrl = apiClient.cdnUrl;
|
|
2471
|
+
if (!data3) return null;
|
|
2472
|
+
const buildPath = (fileName) => data3?.folder && data3.folder !== "/" ? `${data3.folder.replace(/^\//, "")}/${fileName}` : fileName;
|
|
2473
|
+
const isExternal = data3?.type === "external" || data3?.provider === "external";
|
|
2474
|
+
const fileURL = isExternal ? data3?.url || "" : `${cdnUrl}/${buildPath(data3?.name)}`;
|
|
2475
|
+
const isImageType3 = isExternal ? true : isImage(data3?.type);
|
|
2476
|
+
const isVideoType = isExternal ? false : isVideo(data3?.type);
|
|
2477
|
+
if (!fileURL) return null;
|
|
2478
|
+
const imgWidth = width || data3?.meta?.width || 500;
|
|
2479
|
+
const imgHeight = height || data3?.meta?.height || 500;
|
|
2480
|
+
const sizes = getSizes(size);
|
|
2481
|
+
const renderVideo = () => /* @__PURE__ */ jsx(
|
|
2482
|
+
"video",
|
|
1063
2483
|
{
|
|
1064
|
-
|
|
1065
|
-
|
|
2484
|
+
src: fileURL,
|
|
2485
|
+
autoPlay: true,
|
|
2486
|
+
loop: true,
|
|
2487
|
+
muted: true,
|
|
2488
|
+
playsInline: true,
|
|
2489
|
+
className: `tecof-picture-video ${imgClassName || ""}`.trim(),
|
|
2490
|
+
style: imgStyle
|
|
2491
|
+
}
|
|
2492
|
+
);
|
|
2493
|
+
const renderImg = () => {
|
|
2494
|
+
const baseImgClass = fill ? "tecof-picture-img-fill" : "tecof-picture-img";
|
|
2495
|
+
const computedImgClass = `${baseImgClass} ${imgClassName || ""}`.trim();
|
|
2496
|
+
const altText = alt || data3?.name || "Image";
|
|
2497
|
+
const commonProps = {
|
|
2498
|
+
src: fileURL,
|
|
2499
|
+
alt: altText,
|
|
2500
|
+
loading,
|
|
2501
|
+
sizes,
|
|
2502
|
+
className: computedImgClass,
|
|
2503
|
+
style: imgStyle
|
|
2504
|
+
};
|
|
2505
|
+
if (ImageComponent) {
|
|
2506
|
+
return /* @__PURE__ */ jsx(
|
|
2507
|
+
ImageComponent,
|
|
2508
|
+
{
|
|
2509
|
+
...commonProps,
|
|
2510
|
+
width: fill ? void 0 : imgWidth,
|
|
2511
|
+
height: fill ? void 0 : imgHeight,
|
|
2512
|
+
...fill ? { fill: true } : {},
|
|
2513
|
+
...imageProps
|
|
2514
|
+
}
|
|
2515
|
+
);
|
|
1066
2516
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
2517
|
+
return /* @__PURE__ */ jsx(
|
|
2518
|
+
"img",
|
|
2519
|
+
{
|
|
2520
|
+
...commonProps,
|
|
2521
|
+
width: fill ? void 0 : imgWidth,
|
|
2522
|
+
height: fill ? void 0 : imgHeight
|
|
2523
|
+
}
|
|
2524
|
+
);
|
|
2525
|
+
};
|
|
2526
|
+
const containerClassName = `tecof-picture-wrapper ${fill ? "fill" : ""} ${className || ""}`.trim();
|
|
2527
|
+
if (fancybox && (isImageType3 || isVideoType)) {
|
|
2528
|
+
return /* @__PURE__ */ jsx(
|
|
2529
|
+
"a",
|
|
2530
|
+
{
|
|
2531
|
+
"data-fancybox": fancyboxName,
|
|
2532
|
+
href: fileURL,
|
|
2533
|
+
style: { display: "block", textDecoration: "none" },
|
|
2534
|
+
children: /* @__PURE__ */ jsx("div", { style, className: containerClassName, children: isVideoType ? renderVideo() : renderImg() })
|
|
2535
|
+
}
|
|
2536
|
+
);
|
|
2537
|
+
}
|
|
2538
|
+
if (isVideoType) {
|
|
2539
|
+
return /* @__PURE__ */ jsx("div", { style, className: containerClassName, children: renderVideo() });
|
|
2540
|
+
}
|
|
2541
|
+
if (isImageType3) {
|
|
2542
|
+
return /* @__PURE__ */ jsx("div", { style, className: containerClassName, children: renderImg() });
|
|
2543
|
+
}
|
|
2544
|
+
return null;
|
|
2545
|
+
});
|
|
2546
|
+
TecofPicture.displayName = "TecofPicture";
|
|
2547
|
+
var UnderConstruction = ({
|
|
2548
|
+
title,
|
|
2549
|
+
description,
|
|
2550
|
+
subtitle,
|
|
2551
|
+
logoUrl,
|
|
2552
|
+
accentColor = "#2563eb"
|
|
2553
|
+
// Default elegant blue
|
|
2554
|
+
}) => {
|
|
2555
|
+
return /* @__PURE__ */ jsxs("div", { className: "tecof-uc-wrapper", children: [
|
|
2556
|
+
/* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: `
|
|
2557
|
+
.tecof-uc-wrapper {
|
|
2558
|
+
min-height: 100vh;
|
|
2559
|
+
display: flex;
|
|
2560
|
+
align-items: center;
|
|
2561
|
+
justify-content: center;
|
|
2562
|
+
background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.08) 0%, transparent 40%),
|
|
2563
|
+
radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
|
|
2564
|
+
#090d16;
|
|
2565
|
+
color: #f8fafc;
|
|
2566
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
2567
|
+
padding: 2rem 1rem;
|
|
2568
|
+
box-sizing: border-box;
|
|
2569
|
+
position: relative;
|
|
2570
|
+
overflow: hidden;
|
|
2571
|
+
}
|
|
1074
2572
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
2573
|
+
/* Ambient glowing circles */
|
|
2574
|
+
.tecof-uc-glow-1 {
|
|
2575
|
+
position: absolute;
|
|
2576
|
+
top: 20%;
|
|
2577
|
+
left: 50%;
|
|
2578
|
+
transform: translate(-50%, -50%);
|
|
2579
|
+
width: 500px;
|
|
2580
|
+
height: 500px;
|
|
2581
|
+
background: ${accentColor};
|
|
2582
|
+
filter: blur(150px);
|
|
2583
|
+
opacity: 0.12;
|
|
2584
|
+
pointer-events: none;
|
|
2585
|
+
z-index: 1;
|
|
2586
|
+
border-radius: 50%;
|
|
2587
|
+
animation: tecof-uc-pulse 8s infinite alternate ease-in-out;
|
|
2588
|
+
}
|
|
1087
2589
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
2590
|
+
.tecof-uc-container {
|
|
2591
|
+
position: relative;
|
|
2592
|
+
z-index: 2;
|
|
2593
|
+
max-width: 540px;
|
|
2594
|
+
width: 100%;
|
|
2595
|
+
background: rgba(17, 24, 39, 0.55);
|
|
2596
|
+
backdrop-filter: blur(20px);
|
|
2597
|
+
-webkit-backdrop-filter: blur(20px);
|
|
2598
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
2599
|
+
border-radius: 24px;
|
|
2600
|
+
padding: 3.5rem 2.5rem;
|
|
2601
|
+
text-align: center;
|
|
2602
|
+
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4),
|
|
2603
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
|
2604
|
+
animation: tecof-uc-fade-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
2605
|
+
}
|
|
1099
2606
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
var Globe = createLucideIcon("globe", __iconNode11);
|
|
2607
|
+
.tecof-uc-logo-area {
|
|
2608
|
+
margin-bottom: 2.5rem;
|
|
2609
|
+
display: flex;
|
|
2610
|
+
justify-content: center;
|
|
2611
|
+
align-items: center;
|
|
2612
|
+
}
|
|
1107
2613
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
|
|
1115
|
-
["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
|
|
1116
|
-
];
|
|
1117
|
-
var GripVertical = createLucideIcon("grip-vertical", __iconNode12);
|
|
2614
|
+
.tecof-uc-logo {
|
|
2615
|
+
max-height: 56px;
|
|
2616
|
+
max-width: 200px;
|
|
2617
|
+
object-fit: contain;
|
|
2618
|
+
filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
|
|
2619
|
+
}
|
|
1118
2620
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
var ImagePlus = createLucideIcon("image-plus", __iconNode13);
|
|
2621
|
+
.tecof-uc-logo-fallback {
|
|
2622
|
+
font-size: 1.5rem;
|
|
2623
|
+
font-weight: 700;
|
|
2624
|
+
letter-spacing: -0.025em;
|
|
2625
|
+
background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.7) 100%);
|
|
2626
|
+
-webkit-background-clip: text;
|
|
2627
|
+
-webkit-text-fill-color: transparent;
|
|
2628
|
+
}
|
|
1128
2629
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
2630
|
+
.tecof-uc-icon-wrapper {
|
|
2631
|
+
width: 80px;
|
|
2632
|
+
height: 80px;
|
|
2633
|
+
border-radius: 20px;
|
|
2634
|
+
background: rgba(255, 255, 255, 0.03);
|
|
2635
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
2636
|
+
display: flex;
|
|
2637
|
+
align-items: center;
|
|
2638
|
+
justify-content: center;
|
|
2639
|
+
margin: 0 auto 2.2rem auto;
|
|
2640
|
+
color: ${accentColor};
|
|
2641
|
+
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
|
|
2642
|
+
position: relative;
|
|
2643
|
+
}
|
|
1136
2644
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
var Languages = createLucideIcon("languages", __iconNode15);
|
|
2645
|
+
.tecof-uc-icon-glow {
|
|
2646
|
+
position: absolute;
|
|
2647
|
+
inset: -2px;
|
|
2648
|
+
border-radius: 22px;
|
|
2649
|
+
background: linear-gradient(135deg, ${accentColor}, transparent);
|
|
2650
|
+
opacity: 0.3;
|
|
2651
|
+
z-index: -1;
|
|
2652
|
+
filter: blur(4px);
|
|
2653
|
+
}
|
|
1147
2654
|
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
var Link2 = createLucideIcon("link-2", __iconNode16);
|
|
2655
|
+
.tecof-uc-icon-wrapper svg {
|
|
2656
|
+
width: 36px;
|
|
2657
|
+
height: 36px;
|
|
2658
|
+
stroke-width: 1.5;
|
|
2659
|
+
animation: tecof-uc-float 4s ease-in-out infinite;
|
|
2660
|
+
}
|
|
1155
2661
|
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
2662
|
+
.tecof-uc-subtitle {
|
|
2663
|
+
font-size: 0.875rem;
|
|
2664
|
+
font-weight: 600;
|
|
2665
|
+
text-transform: uppercase;
|
|
2666
|
+
letter-spacing: 0.15em;
|
|
2667
|
+
color: ${accentColor};
|
|
2668
|
+
margin-bottom: 0.75rem;
|
|
2669
|
+
}
|
|
1162
2670
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
2671
|
+
.tecof-uc-title {
|
|
2672
|
+
font-size: 2.25rem;
|
|
2673
|
+
font-weight: 800;
|
|
2674
|
+
line-height: 1.2;
|
|
2675
|
+
letter-spacing: -0.025em;
|
|
2676
|
+
color: #ffffff;
|
|
2677
|
+
margin-top: 0;
|
|
2678
|
+
margin-bottom: 1.25rem;
|
|
2679
|
+
background: linear-gradient(to bottom, #ffffff 0%, #cbd5e1 100%);
|
|
2680
|
+
-webkit-background-clip: text;
|
|
2681
|
+
-webkit-text-fill-color: transparent;
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
.tecof-uc-description {
|
|
2685
|
+
font-size: 1.05rem;
|
|
2686
|
+
line-height: 1.6;
|
|
2687
|
+
color: #94a3b8;
|
|
2688
|
+
margin: 0 auto 2.5rem auto;
|
|
2689
|
+
max-width: 420px;
|
|
2690
|
+
}
|
|
1166
2691
|
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
1173
|
-
key: "1a8usu"
|
|
1174
|
-
}
|
|
1175
|
-
],
|
|
1176
|
-
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
1177
|
-
];
|
|
1178
|
-
var Pencil = createLucideIcon("pencil", __iconNode19);
|
|
2692
|
+
.tecof-uc-divider {
|
|
2693
|
+
height: 1px;
|
|
2694
|
+
background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 100%);
|
|
2695
|
+
margin-bottom: 2rem;
|
|
2696
|
+
}
|
|
1179
2697
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
2698
|
+
.tecof-uc-badge {
|
|
2699
|
+
display: inline-flex;
|
|
2700
|
+
align-items: center;
|
|
2701
|
+
gap: 0.5rem;
|
|
2702
|
+
background: rgba(255, 255, 255, 0.04);
|
|
2703
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
2704
|
+
border-radius: 99px;
|
|
2705
|
+
padding: 0.5rem 1.25rem;
|
|
2706
|
+
font-size: 0.825rem;
|
|
2707
|
+
font-weight: 500;
|
|
2708
|
+
color: #94a3b8;
|
|
2709
|
+
text-decoration: none;
|
|
2710
|
+
transition: all 0.2s ease-in-out;
|
|
2711
|
+
}
|
|
1186
2712
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
];
|
|
1194
|
-
var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode21);
|
|
2713
|
+
.tecof-uc-badge:hover {
|
|
2714
|
+
background: rgba(255, 255, 255, 0.08);
|
|
2715
|
+
border-color: rgba(255, 255, 255, 0.15);
|
|
2716
|
+
color: #f8fafc;
|
|
2717
|
+
transform: translateY(-1px);
|
|
2718
|
+
}
|
|
1195
2719
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
2720
|
+
.tecof-uc-badge-dot {
|
|
2721
|
+
width: 6px;
|
|
2722
|
+
height: 6px;
|
|
2723
|
+
background-color: ${accentColor};
|
|
2724
|
+
border-radius: 50%;
|
|
2725
|
+
box-shadow: 0 0 10px ${accentColor};
|
|
2726
|
+
animation: tecof-uc-blink 1.5s infinite alternate;
|
|
2727
|
+
}
|
|
1204
2728
|
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
var RotateCcw = createLucideIcon("rotate-ccw", __iconNode23);
|
|
2729
|
+
/* Animations */
|
|
2730
|
+
@keyframes tecof-uc-pulse {
|
|
2731
|
+
0% { opacity: 0.08; transform: translate(-50%, -50%) scale(0.95); }
|
|
2732
|
+
100% { opacity: 0.15; transform: translate(-50%, -50%) scale(1.05); }
|
|
2733
|
+
}
|
|
1211
2734
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
];
|
|
1217
|
-
var Search = createLucideIcon("search", __iconNode24);
|
|
2735
|
+
@keyframes tecof-uc-fade-in {
|
|
2736
|
+
0% { opacity: 0; transform: translateY(20px); }
|
|
2737
|
+
100% { opacity: 1; transform: translateY(0); }
|
|
2738
|
+
}
|
|
1218
2739
|
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
1225
|
-
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
1226
|
-
];
|
|
1227
|
-
var Trash2 = createLucideIcon("trash-2", __iconNode25);
|
|
2740
|
+
@keyframes tecof-uc-float {
|
|
2741
|
+
0% { transform: translateY(0px) rotate(0deg); }
|
|
2742
|
+
50% { transform: translateY(-5px) rotate(3deg); }
|
|
2743
|
+
100% { transform: translateY(0px) rotate(0deg); }
|
|
2744
|
+
}
|
|
1228
2745
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
|
|
1234
|
-
];
|
|
1235
|
-
var Upload = createLucideIcon("upload", __iconNode26);
|
|
2746
|
+
@keyframes tecof-uc-blink {
|
|
2747
|
+
0% { opacity: 0.3; }
|
|
2748
|
+
100% { opacity: 1; }
|
|
2749
|
+
}
|
|
1236
2750
|
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
2751
|
+
@media (max-width: 640px) {
|
|
2752
|
+
.tecof-uc-container {
|
|
2753
|
+
padding: 2.5rem 1.5rem;
|
|
2754
|
+
border-radius: 20px;
|
|
2755
|
+
}
|
|
2756
|
+
.tecof-uc-title {
|
|
2757
|
+
font-size: 1.75rem;
|
|
2758
|
+
}
|
|
2759
|
+
.tecof-uc-description {
|
|
2760
|
+
font-size: 0.95rem;
|
|
2761
|
+
margin-bottom: 2rem;
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
` } }),
|
|
2765
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-uc-glow-1" }),
|
|
2766
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-uc-container", children: [
|
|
2767
|
+
logoUrl ? /* @__PURE__ */ jsx("div", { className: "tecof-uc-logo-area", children: /* @__PURE__ */ jsx("img", { src: logoUrl, alt: "Store Logo", className: "tecof-uc-logo" }) }) : /* @__PURE__ */ jsx("div", { className: "tecof-uc-logo-area", children: /* @__PURE__ */ jsx("div", { className: "tecof-uc-logo-fallback", children: "TECOF" }) }),
|
|
2768
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-uc-icon-wrapper", children: [
|
|
2769
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-uc-icon-glow" }),
|
|
2770
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
2771
|
+
] }),
|
|
2772
|
+
subtitle && /* @__PURE__ */ jsx("div", { className: "tecof-uc-subtitle", children: subtitle }),
|
|
2773
|
+
/* @__PURE__ */ jsx("h1", { className: "tecof-uc-title", children: title }),
|
|
2774
|
+
/* @__PURE__ */ jsx("p", { className: "tecof-uc-description", children: description }),
|
|
2775
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-uc-divider" }),
|
|
2776
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-uc-badge", children: [
|
|
2777
|
+
/* @__PURE__ */ jsx("span", { className: "tecof-uc-badge-dot" }),
|
|
2778
|
+
/* @__PURE__ */ jsx("span", { children: "Yap\u0131m A\u015Famas\u0131nda" })
|
|
2779
|
+
] })
|
|
2780
|
+
] })
|
|
2781
|
+
] });
|
|
2782
|
+
};
|
|
2783
|
+
var merchantInfoCache = /* @__PURE__ */ new Map();
|
|
2784
|
+
var CACHE_TTL = 5 * 60 * 1e3;
|
|
2785
|
+
function useLanguages() {
|
|
2786
|
+
const { apiClient, secretKey, apiUrl } = useTecof();
|
|
2787
|
+
const [merchantInfo, setMerchantInfo] = useState(null);
|
|
2788
|
+
const [loading, setLoading] = useState(true);
|
|
2789
|
+
const [error2, setError] = useState(null);
|
|
2790
|
+
const [activeTab, setActiveTab] = useState("");
|
|
2791
|
+
const cacheKey = useMemo(() => `${apiUrl}::${secretKey}`, [apiUrl, secretKey]);
|
|
2792
|
+
useEffect(() => {
|
|
2793
|
+
let cancelled = false;
|
|
2794
|
+
const fetchInfo = async () => {
|
|
2795
|
+
const cached = merchantInfoCache.get(cacheKey);
|
|
2796
|
+
if (cached && Date.now() - cached.ts < CACHE_TTL) {
|
|
2797
|
+
setMerchantInfo(cached.data);
|
|
2798
|
+
if (!activeTab) setActiveTab(cached.data.defaultLanguage);
|
|
2799
|
+
setLoading(false);
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
setLoading(true);
|
|
2803
|
+
setError(null);
|
|
2804
|
+
const res2 = await apiClient.getMerchantInfo();
|
|
2805
|
+
if (cancelled) return;
|
|
2806
|
+
if (res2.success && res2.data) {
|
|
2807
|
+
merchantInfoCache.set(cacheKey, { data: res2.data, ts: Date.now() });
|
|
2808
|
+
setMerchantInfo(res2.data);
|
|
2809
|
+
if (!activeTab) setActiveTab(res2.data.defaultLanguage);
|
|
2810
|
+
} else {
|
|
2811
|
+
setError(res2.message || "Failed to load languages");
|
|
2812
|
+
const fallback = { languages: ["tr"], defaultLanguage: "tr" };
|
|
2813
|
+
setMerchantInfo(fallback);
|
|
2814
|
+
if (!activeTab) setActiveTab("tr");
|
|
2815
|
+
}
|
|
2816
|
+
setLoading(false);
|
|
2817
|
+
};
|
|
2818
|
+
fetchInfo();
|
|
2819
|
+
return () => {
|
|
2820
|
+
cancelled = true;
|
|
2821
|
+
};
|
|
2822
|
+
}, [apiClient, cacheKey]);
|
|
2823
|
+
return { merchantInfo, loading, error: error2, activeTab, setActiveTab };
|
|
2824
|
+
}
|
|
1243
2825
|
var FieldErrorBoundary = class extends Component {
|
|
1244
2826
|
constructor(props) {
|
|
1245
2827
|
super(props);
|
|
@@ -5140,7 +6722,7 @@ var MediaDrawer = ({
|
|
|
5140
6722
|
alt: file2.name,
|
|
5141
6723
|
size: "thumbnail",
|
|
5142
6724
|
className: "tecof-upload-gallery-thumb",
|
|
5143
|
-
imgStyle: { width: "100%", height: "100%", objectFit: "cover", borderRadius: "
|
|
6725
|
+
imgStyle: { width: "100%", height: "100%", objectFit: "cover", borderRadius: "8px" }
|
|
5144
6726
|
}
|
|
5145
6727
|
) : /* @__PURE__ */ jsx("div", { className: "tecof-upload-gallery-thumb tecof-upload-gallery-file-icon-wrap", children: /* @__PURE__ */ jsx(File2, { size: 24, color: "#a1a1aa" }) }),
|
|
5146
6728
|
/* @__PURE__ */ jsx("p", { className: "tecof-upload-gallery-file-name", children: file2.meta?.originalName || file2.name })
|
|
@@ -6060,7 +7642,7 @@ var createView = (
|
|
|
6060
7642
|
},
|
|
6061
7643
|
write: write2 = () => {
|
|
6062
7644
|
},
|
|
6063
|
-
create:
|
|
7645
|
+
create: create5 = () => {
|
|
6064
7646
|
},
|
|
6065
7647
|
destroy: destroy3 = () => {
|
|
6066
7648
|
},
|
|
@@ -6264,7 +7846,7 @@ var createView = (
|
|
|
6264
7846
|
}
|
|
6265
7847
|
});
|
|
6266
7848
|
const internalAPI = createObject(internalAPIDefinition);
|
|
6267
|
-
|
|
7849
|
+
create5({
|
|
6268
7850
|
root: internalAPI,
|
|
6269
7851
|
props
|
|
6270
7852
|
});
|
|
@@ -8994,7 +10576,7 @@ var percentageArc = (x, y, radius, from, to) => {
|
|
|
8994
10576
|
arcSweep
|
|
8995
10577
|
);
|
|
8996
10578
|
};
|
|
8997
|
-
var
|
|
10579
|
+
var create2 = ({ root: root3, props }) => {
|
|
8998
10580
|
props.spin = false;
|
|
8999
10581
|
props.progress = 0;
|
|
9000
10582
|
props.opacity = 0;
|
|
@@ -9034,7 +10616,7 @@ var progressIndicator = createView({
|
|
|
9034
10616
|
name: "progress-indicator",
|
|
9035
10617
|
ignoreRectUpdate: true,
|
|
9036
10618
|
ignoreRect: true,
|
|
9037
|
-
create,
|
|
10619
|
+
create: create2,
|
|
9038
10620
|
write,
|
|
9039
10621
|
mixins: {
|
|
9040
10622
|
apis: ["progress", "spin", "align"],
|
|
@@ -13874,7 +15456,7 @@ var createImageWrapperView = (_2) => {
|
|
|
13874
15456
|
root3.ref.overlayShadow.opacity = 0.25;
|
|
13875
15457
|
root3.ref.overlaySuccess.opacity = 1;
|
|
13876
15458
|
};
|
|
13877
|
-
const
|
|
15459
|
+
const create5 = ({ root: root3 }) => {
|
|
13878
15460
|
root3.ref.images = [];
|
|
13879
15461
|
root3.ref.imageData = null;
|
|
13880
15462
|
root3.ref.imageViewBin = [];
|
|
@@ -13899,7 +15481,7 @@ var createImageWrapperView = (_2) => {
|
|
|
13899
15481
|
};
|
|
13900
15482
|
return _2.utils.createView({
|
|
13901
15483
|
name: "image-preview-wrapper",
|
|
13902
|
-
create:
|
|
15484
|
+
create: create5,
|
|
13903
15485
|
styles: ["height"],
|
|
13904
15486
|
apis: ["height"],
|
|
13905
15487
|
destroy: ({ root: root3 }) => {
|
|
@@ -15709,7 +17291,7 @@ var plugin7 = ({ addFilter: addFilter2, utils }) => {
|
|
|
15709
17291
|
}).catch(reject);
|
|
15710
17292
|
});
|
|
15711
17293
|
const variantPromises = variants.map(
|
|
15712
|
-
(
|
|
17294
|
+
(create5) => create5(transform, file2, item2.getMetadata())
|
|
15713
17295
|
);
|
|
15714
17296
|
Promise.all(variantPromises).then((files) => {
|
|
15715
17297
|
resolve(
|
|
@@ -19049,7 +20631,7 @@ var createTexture = function(e3, t2, r2, n, i2) {
|
|
|
19049
20631
|
}
|
|
19050
20632
|
return o2;
|
|
19051
20633
|
};
|
|
19052
|
-
var
|
|
20634
|
+
var create3 = function() {
|
|
19053
20635
|
var e3 = new Float32Array(16);
|
|
19054
20636
|
return e3[0] = 1, e3[5] = 1, e3[10] = 1, e3[15] = 1, e3;
|
|
19055
20637
|
};
|
|
@@ -19077,7 +20659,7 @@ var rotateZ = function(e3, t2) {
|
|
|
19077
20659
|
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];
|
|
19078
20660
|
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;
|
|
19079
20661
|
};
|
|
19080
|
-
var mat4 = { create:
|
|
20662
|
+
var mat4 = { create: create3, perspective, translate, scale, rotateX, rotateY, rotateZ };
|
|
19081
20663
|
var degToRad = function(e3) {
|
|
19082
20664
|
return e3 * Math.PI / 180;
|
|
19083
20665
|
};
|
|
@@ -23018,16 +24600,16 @@ var FileItemRenderer = ({
|
|
|
23018
24600
|
`${cdnUrl}/${file2.name}`;
|
|
23019
24601
|
const ext = getFileExtension(file2.name);
|
|
23020
24602
|
return /* @__PURE__ */ jsxs("div", { className: "tecof-upload-file-item", children: [
|
|
23021
|
-
file2.type === "image/reference" ? /* @__PURE__ */ jsx("div", { className: "tecof-upload-file-icon", style: { backgroundColor: "#
|
|
24603
|
+
file2.type === "image/reference" ? /* @__PURE__ */ jsx("div", { className: "tecof-upload-file-icon", style: { backgroundColor: "#f4f4f5", color: "#18181b" }, children: /* @__PURE__ */ jsx(Code, { size: 16 }) }) : isImageType2(file2.type) ? /* @__PURE__ */ jsx(
|
|
23022
24604
|
TecofPicture,
|
|
23023
24605
|
{
|
|
23024
24606
|
data: file2,
|
|
23025
24607
|
alt: file2.meta?.originalName || file2.name,
|
|
23026
24608
|
size: "thumbnail",
|
|
23027
24609
|
className: "tecof-upload-file-thumb",
|
|
23028
|
-
imgStyle: { width: "100%", height: "100%", objectFit: "cover", borderRadius: "
|
|
24610
|
+
imgStyle: { width: "100%", height: "100%", objectFit: "cover", borderRadius: "6px" }
|
|
23029
24611
|
}
|
|
23030
|
-
) : /* @__PURE__ */ jsx("div", { className: "tecof-upload-file-icon", children: /* @__PURE__ */ jsx(File2, { size:
|
|
24612
|
+
) : /* @__PURE__ */ jsx("div", { className: "tecof-upload-file-icon", children: /* @__PURE__ */ jsx(File2, { size: 16 }) }),
|
|
23031
24613
|
/* @__PURE__ */ jsxs("div", { className: "tecof-upload-file-info", children: [
|
|
23032
24614
|
/* @__PURE__ */ jsx("p", { className: "tecof-upload-file-name", title: file2.meta?.originalName || file2.name, children: file2.meta?.originalName || file2.name }),
|
|
23033
24615
|
/* @__PURE__ */ jsxs("div", { className: "tecof-upload-file-meta", children: [
|
|
@@ -23156,10 +24738,6 @@ var UploadField = ({
|
|
|
23156
24738
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
23157
24739
|
const [showRefInput, setShowRefInput] = useState(false);
|
|
23158
24740
|
const [refCode, setRefCode] = useState("{{ data. }}");
|
|
23159
|
-
const [galleryFiles, setGalleryFiles] = useState([]);
|
|
23160
|
-
const [loading, setLoading] = useState(false);
|
|
23161
|
-
const [refreshKey, setRefreshKey] = useState(0);
|
|
23162
|
-
const [gallerySearch, setGallerySearch] = useState("");
|
|
23163
24741
|
const sourceToIdRef = useRef(/* @__PURE__ */ new Map());
|
|
23164
24742
|
const compressFile = useCallback(async (file2) => {
|
|
23165
24743
|
if (!imageCompressionEnabled) return file2;
|
|
@@ -23216,16 +24794,6 @@ var UploadField = ({
|
|
|
23216
24794
|
setShowRefInput(false);
|
|
23217
24795
|
setRefCode("{{ data. }}");
|
|
23218
24796
|
}, [refCode, allowMultiple, value, onChange]);
|
|
23219
|
-
useEffect(() => {
|
|
23220
|
-
if (!drawerOpen) return;
|
|
23221
|
-
setLoading(true);
|
|
23222
|
-
apiClient.getUploads(1, 100).then((res2) => {
|
|
23223
|
-
if (res2.success && res2.data) {
|
|
23224
|
-
setGalleryFiles(res2.data);
|
|
23225
|
-
}
|
|
23226
|
-
setLoading(false);
|
|
23227
|
-
}).catch(() => setLoading(false));
|
|
23228
|
-
}, [drawerOpen, refreshKey, apiClient]);
|
|
23229
24797
|
const toggleGalleryFile = useCallback((file2) => {
|
|
23230
24798
|
if (allowMultiple) {
|
|
23231
24799
|
const exists = value.some((f2) => f2._id === file2._id);
|
|
@@ -23298,9 +24866,6 @@ var UploadField = ({
|
|
|
23298
24866
|
}
|
|
23299
24867
|
};
|
|
23300
24868
|
const canAddMore = allowMultiple ? value.length < maxFiles : value.length === 0;
|
|
23301
|
-
const filteredGallery = gallerySearch.trim() ? galleryFiles.filter(
|
|
23302
|
-
(f2) => f2.name?.toLowerCase().includes(gallerySearch.toLowerCase()) || f2.meta?.originalName?.toLowerCase().includes(gallerySearch.toLowerCase())
|
|
23303
|
-
) : galleryFiles;
|
|
23304
24869
|
return /* @__PURE__ */ jsxs("div", { className: "tecof-upload-container", children: [
|
|
23305
24870
|
value.length > 0 && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-file-list", children: [
|
|
23306
24871
|
showUploadedFiles && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-uploaded-header", children: [
|
|
@@ -23318,52 +24883,50 @@ var UploadField = ({
|
|
|
23318
24883
|
file2._id || idx
|
|
23319
24884
|
))
|
|
23320
24885
|
] }),
|
|
23321
|
-
value.length === 0 && !readOnly && canAddMore && !showPond && /* @__PURE__ */ jsxs(
|
|
23322
|
-
|
|
23323
|
-
|
|
23324
|
-
|
|
23325
|
-
|
|
23326
|
-
|
|
23327
|
-
|
|
23328
|
-
|
|
23329
|
-
|
|
23330
|
-
|
|
23331
|
-
|
|
23332
|
-
|
|
24886
|
+
value.length === 0 && !readOnly && canAddMore && !showPond && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
24887
|
+
/* @__PURE__ */ jsxs(
|
|
24888
|
+
"div",
|
|
24889
|
+
{
|
|
24890
|
+
className: "tecof-upload-empty-state",
|
|
24891
|
+
onClick: () => setDrawerOpen(true),
|
|
24892
|
+
children: [
|
|
24893
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-upload-empty-icon", children: /* @__PURE__ */ jsx(ImagePlus, { size: 16 }) }),
|
|
24894
|
+
/* @__PURE__ */ jsx("p", { className: "tecof-upload-empty-title", children: "Dosya ekleyin" }),
|
|
24895
|
+
/* @__PURE__ */ jsx("p", { className: "tecof-upload-empty-desc", children: "Medya k\xFCt\xFCphanesinden se\xE7in veya yeni y\xFCkleyin" })
|
|
24896
|
+
]
|
|
24897
|
+
}
|
|
24898
|
+
),
|
|
24899
|
+
!showRefInput && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-main-actions", children: [
|
|
24900
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-secondary", onClick: () => setShowRefInput(true), children: [
|
|
24901
|
+
/* @__PURE__ */ jsx(Code, { size: 13 }),
|
|
24902
|
+
" Referans Gir"
|
|
24903
|
+
] }),
|
|
24904
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-primary", onClick: () => setShowPond(true), children: [
|
|
24905
|
+
/* @__PURE__ */ jsx(Upload, { size: 13 }),
|
|
24906
|
+
" Yeni Y\xFCkle"
|
|
24907
|
+
] })
|
|
24908
|
+
] })
|
|
24909
|
+
] }),
|
|
23333
24910
|
!readOnly && canAddMore && !showPond && value.length > 0 && !showRefInput && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-main-actions", children: [
|
|
23334
24911
|
/* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-secondary", onClick: () => setShowRefInput(true), children: [
|
|
23335
|
-
/* @__PURE__ */ jsx(Code, { size:
|
|
24912
|
+
/* @__PURE__ */ jsx(Code, { size: 13 }),
|
|
23336
24913
|
" Referans"
|
|
23337
24914
|
] }),
|
|
23338
24915
|
/* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-secondary", onClick: () => setDrawerOpen(true), children: [
|
|
23339
|
-
/* @__PURE__ */ jsx(FolderOpen, { size:
|
|
23340
|
-
"
|
|
23341
|
-
] }),
|
|
23342
|
-
/* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-primary", onClick: () => setShowPond(true), children: [
|
|
23343
|
-
/* @__PURE__ */ jsx(Upload, { size: 15 }),
|
|
23344
|
-
" Yeni Y\xFCkle"
|
|
23345
|
-
] })
|
|
23346
|
-
] }),
|
|
23347
|
-
value.length === 0 && !readOnly && canAddMore && !showPond && !showRefInput && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-main-actions", children: [
|
|
23348
|
-
/* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-secondary", onClick: () => setShowRefInput(true), children: [
|
|
23349
|
-
/* @__PURE__ */ jsx(Code, { size: 15 }),
|
|
23350
|
-
" Dinamik Referans Se\xE7"
|
|
24916
|
+
/* @__PURE__ */ jsx(FolderOpen, { size: 13 }),
|
|
24917
|
+
" K\xFCt\xFCphane"
|
|
23351
24918
|
] }),
|
|
23352
24919
|
/* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-upload-btn-primary", onClick: () => setShowPond(true), children: [
|
|
23353
|
-
/* @__PURE__ */ jsx(Upload, { size:
|
|
23354
|
-
"
|
|
24920
|
+
/* @__PURE__ */ jsx(Upload, { size: 13 }),
|
|
24921
|
+
" Y\xFCkle"
|
|
23355
24922
|
] })
|
|
23356
24923
|
] }),
|
|
23357
|
-
showRefInput && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-ref-section", style: { background: "#
|
|
23358
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between"
|
|
23359
|
-
/* @__PURE__ */
|
|
23360
|
-
|
|
23361
|
-
`{{ data.image }}`,
|
|
23362
|
-
")"
|
|
23363
|
-
] }),
|
|
23364
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => setShowRefInput(false), style: { background: "none", border: "none", cursor: "pointer", color: "#64748b" }, children: /* @__PURE__ */ jsx(X, { size: 14 }) })
|
|
24924
|
+
showRefInput && /* @__PURE__ */ jsxs("div", { className: "tecof-upload-ref-section", style: { background: "#ffffff", padding: "10px", borderRadius: "8px", border: "1px solid #e4e4e7", display: "flex", flexDirection: "column", gap: "8px", marginTop: "4px" }, children: [
|
|
24925
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
24926
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: "11px", fontWeight: 500, color: "#71717a" }, children: "Dinamik CMS De\u011Fi\u015Fkeni" }),
|
|
24927
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => setShowRefInput(false), style: { background: "none", border: "none", cursor: "pointer", color: "#a1a1aa", padding: 0 }, children: /* @__PURE__ */ jsx(X, { size: 12 }) })
|
|
23365
24928
|
] }),
|
|
23366
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "
|
|
24929
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "6px" }, children: [
|
|
23367
24930
|
/* @__PURE__ */ jsx(
|
|
23368
24931
|
"input",
|
|
23369
24932
|
{
|
|
@@ -23371,7 +24934,7 @@ var UploadField = ({
|
|
|
23371
24934
|
value: refCode,
|
|
23372
24935
|
onChange: (e3) => setRefCode(e3.target.value),
|
|
23373
24936
|
placeholder: "{{ data. }}",
|
|
23374
|
-
style: { flex: 1, padding: "8px
|
|
24937
|
+
style: { flex: 1, padding: "6px 8px", fontSize: "12px", borderRadius: "6px", border: "1px solid #cbd5e1", outline: "none" },
|
|
23375
24938
|
autoFocus: true,
|
|
23376
24939
|
onKeyDown: (e3) => {
|
|
23377
24940
|
if (e3.key === "Enter") {
|
|
@@ -23386,7 +24949,7 @@ var UploadField = ({
|
|
|
23386
24949
|
{
|
|
23387
24950
|
type: "button",
|
|
23388
24951
|
onClick: handleAddRef,
|
|
23389
|
-
style: { padding: "0
|
|
24952
|
+
style: { padding: "0 10px", background: "#18181b", color: "#fff", fontSize: "11px", fontWeight: 500, borderRadius: "6px", border: "none", cursor: "pointer" },
|
|
23390
24953
|
children: "Ekle"
|
|
23391
24954
|
}
|
|
23392
24955
|
)
|
|
@@ -23430,97 +24993,18 @@ var UploadField = ({
|
|
|
23430
24993
|
}
|
|
23431
24994
|
) })
|
|
23432
24995
|
] }),
|
|
23433
|
-
/* @__PURE__ */ jsx(
|
|
23434
|
-
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
|
|
23438
|
-
|
|
23439
|
-
|
|
23440
|
-
|
|
23441
|
-
|
|
23442
|
-
|
|
23443
|
-
|
|
23444
|
-
|
|
23445
|
-
/* @__PURE__ */ jsxs("div", { className: "tecof-upload-drawer-header-actions", children: [
|
|
23446
|
-
/* @__PURE__ */ jsx(
|
|
23447
|
-
"button",
|
|
23448
|
-
{
|
|
23449
|
-
className: "tecof-upload-drawer-action-btn",
|
|
23450
|
-
onClick: () => setRefreshKey((k2) => k2 + 1),
|
|
23451
|
-
disabled: loading,
|
|
23452
|
-
title: "Yenile",
|
|
23453
|
-
children: /* @__PURE__ */ jsx(RefreshCcw, { size: 15, className: loading ? "tecof-upload-spin" : "" })
|
|
23454
|
-
}
|
|
23455
|
-
),
|
|
23456
|
-
/* @__PURE__ */ jsx(
|
|
23457
|
-
"button",
|
|
23458
|
-
{
|
|
23459
|
-
className: "tecof-upload-drawer-action-btn",
|
|
23460
|
-
onClick: () => setDrawerOpen(false),
|
|
23461
|
-
title: "Kapat",
|
|
23462
|
-
children: /* @__PURE__ */ jsx(X, { size: 15 })
|
|
23463
|
-
}
|
|
23464
|
-
)
|
|
23465
|
-
] })
|
|
23466
|
-
] }),
|
|
23467
|
-
/* @__PURE__ */ jsxs("div", { className: "tecof-upload-search-box", children: [
|
|
23468
|
-
/* @__PURE__ */ jsx(Search, { size: 15, color: "#a1a1aa" }),
|
|
23469
|
-
/* @__PURE__ */ jsx(
|
|
23470
|
-
"input",
|
|
23471
|
-
{
|
|
23472
|
-
type: "text",
|
|
23473
|
-
placeholder: "Dosya ara...",
|
|
23474
|
-
value: gallerySearch,
|
|
23475
|
-
onChange: (e3) => setGallerySearch(e3.target.value),
|
|
23476
|
-
className: "tecof-upload-search-input"
|
|
23477
|
-
}
|
|
23478
|
-
),
|
|
23479
|
-
gallerySearch && /* @__PURE__ */ jsx(
|
|
23480
|
-
"button",
|
|
23481
|
-
{
|
|
23482
|
-
type: "button",
|
|
23483
|
-
className: "tecof-upload-action-btn tecof-upload-clear-search-btn",
|
|
23484
|
-
onClick: () => setGallerySearch(""),
|
|
23485
|
-
children: /* @__PURE__ */ jsx(X, { size: 13 })
|
|
23486
|
-
}
|
|
23487
|
-
)
|
|
23488
|
-
] }),
|
|
23489
|
-
loading ? /* @__PURE__ */ jsxs("div", { className: "tecof-upload-gallery-empty", children: [
|
|
23490
|
-
/* @__PURE__ */ jsx("div", { className: "tecof-upload-gallery-empty-icon", children: /* @__PURE__ */ jsx(RefreshCcw, { size: 24, color: "#a1a1aa", className: "tecof-upload-spin" }) }),
|
|
23491
|
-
/* @__PURE__ */ jsx("p", { className: "tecof-upload-loading-text", children: "Y\xFCkleniyor..." })
|
|
23492
|
-
] }) : filteredGallery.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "tecof-upload-gallery-empty", children: [
|
|
23493
|
-
/* @__PURE__ */ jsx("div", { className: "tecof-upload-gallery-empty-icon", children: /* @__PURE__ */ jsx(Image2, { size: 24, color: "#a1a1aa" }) }),
|
|
23494
|
-
/* @__PURE__ */ jsx("p", { className: "tecof-upload-empty-heading", children: gallerySearch ? "Sonu\xE7 bulunamad\u0131" : "Hen\xFCz dosya yok" }),
|
|
23495
|
-
/* @__PURE__ */ jsx("p", { className: "tecof-upload-empty-subheading", children: gallerySearch ? "Farkl\u0131 bir arama terimi deneyin" : "Dosyalar\u0131n\u0131z burada g\xF6r\xFCnecek" })
|
|
23496
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "tecof-upload-gallery-grid", children: filteredGallery.map((file2) => {
|
|
23497
|
-
const selected = value.some((v2) => v2._id === file2._id);
|
|
23498
|
-
return /* @__PURE__ */ jsxs(
|
|
23499
|
-
"div",
|
|
23500
|
-
{
|
|
23501
|
-
className: `tecof-upload-gallery-item ${selected ? "selected" : ""}`,
|
|
23502
|
-
onClick: () => toggleGalleryFile(file2),
|
|
23503
|
-
children: [
|
|
23504
|
-
selected && /* @__PURE__ */ jsx("div", { className: "tecof-upload-gallery-check", children: /* @__PURE__ */ jsx(Check, { size: 12, strokeWidth: 3 }) }),
|
|
23505
|
-
isImageType2(file2.type) ? /* @__PURE__ */ jsx(
|
|
23506
|
-
TecofPicture,
|
|
23507
|
-
{
|
|
23508
|
-
data: file2,
|
|
23509
|
-
alt: file2.name,
|
|
23510
|
-
size: "thumbnail",
|
|
23511
|
-
className: "tecof-upload-gallery-thumb",
|
|
23512
|
-
imgStyle: { width: "100%", height: "100%", objectFit: "cover", borderRadius: "6px" }
|
|
23513
|
-
}
|
|
23514
|
-
) : /* @__PURE__ */ jsx("div", { className: "tecof-upload-gallery-thumb tecof-upload-gallery-file-icon-wrap", children: /* @__PURE__ */ jsx(File2, { size: 24, color: "#a1a1aa" }) }),
|
|
23515
|
-
/* @__PURE__ */ jsx("p", { className: "tecof-upload-gallery-file-name", children: file2.meta?.originalName || file2.name })
|
|
23516
|
-
]
|
|
23517
|
-
},
|
|
23518
|
-
file2._id
|
|
23519
|
-
);
|
|
23520
|
-
}) })
|
|
23521
|
-
] })
|
|
23522
|
-
] })
|
|
23523
|
-
] }) })
|
|
24996
|
+
/* @__PURE__ */ jsx(
|
|
24997
|
+
MediaDrawer,
|
|
24998
|
+
{
|
|
24999
|
+
open: drawerOpen,
|
|
25000
|
+
onOpenChange: setDrawerOpen,
|
|
25001
|
+
onSelect: toggleGalleryFile,
|
|
25002
|
+
selectedIds: value.map((v2) => v2._id ?? ""),
|
|
25003
|
+
allowMultiple,
|
|
25004
|
+
filterImages: acceptedTypes.length > 0 && acceptedTypes.every((t2) => t2.startsWith("image/")),
|
|
25005
|
+
title: "Medya K\xFCt\xFCphanesi"
|
|
25006
|
+
}
|
|
25007
|
+
)
|
|
23524
25008
|
] });
|
|
23525
25009
|
};
|
|
23526
25010
|
UploadField.displayName = "UploadField";
|
|
@@ -23770,7 +25254,7 @@ var validators = {
|
|
|
23770
25254
|
handler: validateHandler,
|
|
23771
25255
|
initial: validateInitial
|
|
23772
25256
|
};
|
|
23773
|
-
function
|
|
25257
|
+
function create4(initial) {
|
|
23774
25258
|
var handler = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
23775
25259
|
validators.initial(initial);
|
|
23776
25260
|
validators.handler(handler);
|
|
@@ -23808,7 +25292,7 @@ function didStateUpdate(state3, handler, changes) {
|
|
|
23808
25292
|
return changes;
|
|
23809
25293
|
}
|
|
23810
25294
|
var index = {
|
|
23811
|
-
create:
|
|
25295
|
+
create: create4
|
|
23812
25296
|
};
|
|
23813
25297
|
var state_local_default = index;
|
|
23814
25298
|
|
|
@@ -25450,9 +26934,12 @@ lucide-react/dist/esm/shared/src/utils/hasA11yProp.js:
|
|
|
25450
26934
|
lucide-react/dist/esm/context.js:
|
|
25451
26935
|
lucide-react/dist/esm/Icon.js:
|
|
25452
26936
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
26937
|
+
lucide-react/dist/esm/icons/arrow-down.js:
|
|
26938
|
+
lucide-react/dist/esm/icons/arrow-up.js:
|
|
25453
26939
|
lucide-react/dist/esm/icons/check.js:
|
|
25454
26940
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
25455
26941
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
26942
|
+
lucide-react/dist/esm/icons/chevron-up.js:
|
|
25456
26943
|
lucide-react/dist/esm/icons/code.js:
|
|
25457
26944
|
lucide-react/dist/esm/icons/copy.js:
|
|
25458
26945
|
lucide-react/dist/esm/icons/database.js:
|
|
@@ -25560,6 +27047,6 @@ filepond-plugin-image-edit/dist/filepond-plugin-image-edit.esm.js:
|
|
|
25560
27047
|
*)
|
|
25561
27048
|
*/
|
|
25562
27049
|
|
|
25563
|
-
export { CmsCollectionField, CodeEditorField, ColorField, EditorField, FieldErrorBoundary, LanguageField, LinkField, RepeaterField, TecofApiClient, TecofEditor, TecofPicture, TecofProvider, TecofRender, UnderConstruction, UploadField, createCmsCollectionField, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createRepeaterField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
|
|
27050
|
+
export { CmsCollectionField, CodeEditorField, ColorField, EditorField, FieldErrorBoundary, LanguageField, LinkField, RepeaterField, TecofApiClient, TecofEditor, TecofPicture, TecofProvider, TecofRender, TecofStudio, UnderConstruction, UploadField, createCmsCollectionField, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createRepeaterField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
|
|
25564
27051
|
//# sourceMappingURL=index.mjs.map
|
|
25565
27052
|
//# sourceMappingURL=index.mjs.map
|