@1urso/generic-editor 0.1.1 → 0.1.2

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.
@@ -7653,8 +7653,8 @@ var _excluded$Y = ["color"], ChevronRightIcon = /* @__PURE__ */ forwardRef(funct
7653
7653
  "Arial Black",
7654
7654
  "Impact"
7655
7655
  ];
7656
- const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] }) => {
7657
- let [k, F] = useState({
7656
+ const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [], theme: k = "light" }) => {
7657
+ let [F, L] = useState({
7658
7658
  elements: [],
7659
7659
  selectedElementId: null,
7660
7660
  isList: C,
@@ -7668,10 +7668,11 @@ const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] })
7668
7668
  "Open Sans",
7669
7669
  "Lato",
7670
7670
  "Montserrat"
7671
- ]
7671
+ ],
7672
+ theme: k
7672
7673
  });
7673
7674
  React.useEffect(() => {
7674
- k.availableFonts.forEach((s) => {
7675
+ F.availableFonts.forEach((s) => {
7675
7676
  if (SAFE_FONTS.includes(s)) return;
7676
7677
  let d = `font-${s.replace(/\s+/g, "-").toLowerCase()}`;
7677
7678
  if (!document.getElementById(d)) {
@@ -7679,15 +7680,20 @@ const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] })
7679
7680
  C.id = d, C.href = `https://fonts.googleapis.com/css2?family=${s.replace(/ /g, "+")}&display=swap`, C.rel = "stylesheet", document.head.appendChild(C);
7680
7681
  }
7681
7682
  });
7682
- }, [k.availableFonts]), React.useEffect(() => {
7683
- F((s) => ({
7683
+ }, [F.availableFonts]), React.useEffect(() => {
7684
+ L((s) => ({
7684
7685
  ...s,
7685
7686
  isList: C,
7686
- availableProps: w
7687
+ availableProps: w,
7688
+ theme: k
7687
7689
  }));
7688
- }, [C, w]);
7689
- let L = React.useCallback((s) => {
7690
- F((d) => ({
7690
+ }, [
7691
+ C,
7692
+ w,
7693
+ k
7694
+ ]);
7695
+ let V = React.useCallback((s) => {
7696
+ L((d) => ({
7691
7697
  ...d,
7692
7698
  ...s,
7693
7699
  isList: s.isList ?? d.isList,
@@ -7695,7 +7701,7 @@ const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] })
7695
7701
  availableFonts: s.availableFonts ?? d.availableFonts,
7696
7702
  selectedElementId: null
7697
7703
  }));
7698
- }, []), V = React.useCallback((s) => {
7704
+ }, []), U = React.useCallback((s) => {
7699
7705
  let d = {};
7700
7706
  s.type === "box" && (d.backgroundColor = "var(--gray-4)");
7701
7707
  let C = {
@@ -7710,74 +7716,74 @@ const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] })
7710
7716
  ...s.style || {}
7711
7717
  }
7712
7718
  };
7713
- F((s) => ({
7719
+ L((s) => ({
7714
7720
  ...s,
7715
7721
  elements: [...s.elements, C]
7716
7722
  }));
7717
- }, []), U = React.useCallback((s) => {
7718
- F((d) => ({
7723
+ }, []), K = React.useCallback((s) => {
7724
+ L((d) => ({
7719
7725
  ...d,
7720
7726
  elements: d.elements.filter((d) => d.id !== s),
7721
7727
  selectedElementId: d.selectedElementId === s ? null : d.selectedElementId
7722
7728
  }));
7723
- }, []), K = React.useCallback((s) => {
7724
- F((d) => ({
7729
+ }, []), q = React.useCallback((s) => {
7730
+ L((d) => ({
7725
7731
  ...d,
7726
7732
  selectedElementId: s
7727
7733
  }));
7728
- }, []), q = React.useCallback((s, d) => {
7729
- F((C) => {
7734
+ }, []), J = React.useCallback((s, d) => {
7735
+ L((C) => {
7730
7736
  let w = [...C.elements], k = w[s];
7731
7737
  return w.splice(s, 1), w.splice(d, 0, k), {
7732
7738
  ...C,
7733
7739
  elements: w
7734
7740
  };
7735
7741
  });
7736
- }, []), J = React.useCallback((s, d) => {
7737
- F((C) => ({
7742
+ }, []), X = React.useCallback((s, d) => {
7743
+ L((C) => ({
7738
7744
  ...C,
7739
7745
  elements: C.elements.map((C) => C.id === s ? {
7740
7746
  ...C,
7741
7747
  ...d
7742
7748
  } : C)
7743
7749
  }));
7744
- }, []), X = React.useCallback((s, d) => {
7745
- F((C) => ({
7750
+ }, []), $ = React.useCallback((s, d) => {
7751
+ L((C) => ({
7746
7752
  ...C,
7747
7753
  mockData: s,
7748
7754
  singleMockData: d
7749
7755
  }));
7750
- }, []), $ = React.useCallback((s) => {
7751
- F((d) => ({
7756
+ }, []), CO = React.useCallback((s) => {
7757
+ L((d) => ({
7752
7758
  ...d,
7753
7759
  listSettings: {
7754
7760
  ...d.listSettings,
7755
7761
  ...s
7756
7762
  }
7757
7763
  }));
7758
- }, []), CO = React.useMemo(() => ({
7759
- state: k,
7760
- addElement: V,
7761
- removeElement: U,
7762
- selectElement: K,
7763
- moveElement: q,
7764
- updateElement: J,
7765
- setMockData: X,
7766
- updateListSettings: $,
7767
- loadState: L
7764
+ }, []), wO = React.useMemo(() => ({
7765
+ state: F,
7766
+ addElement: U,
7767
+ removeElement: K,
7768
+ selectElement: q,
7769
+ moveElement: J,
7770
+ updateElement: X,
7771
+ setMockData: $,
7772
+ updateListSettings: CO,
7773
+ loadState: V
7768
7774
  }), [
7769
- k,
7770
- V,
7775
+ F,
7771
7776
  U,
7772
7777
  K,
7773
7778
  q,
7774
7779
  J,
7775
7780
  X,
7776
7781
  $,
7777
- L
7782
+ CO,
7783
+ V
7778
7784
  ]);
7779
7785
  return /* @__PURE__ */ jsx(EditorContext.Provider, {
7780
- value: CO,
7786
+ value: wO,
7781
7787
  children: s
7782
7788
  });
7783
7789
  }, useEditor = () => {
@@ -8421,373 +8427,437 @@ const ElementContextMenu = ({ children: s, element: C }) => {
8421
8427
  /* @__PURE__ */ jsxs(Root2$1, { children: [/* @__PURE__ */ jsx(Trigger$1, {
8422
8428
  asChild: !0,
8423
8429
  children: s
8424
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(Content2$1, {
8425
- className: "ContextMenuContent",
8426
- children: [
8427
- /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8428
- className: "ContextMenuSubTrigger",
8429
- children: [
8430
- "Vincular Dados ",
8431
- C.dataBinding && `(${C.dataBinding})`,
8432
- /* @__PURE__ */ jsx("div", {
8433
- className: "RightSlot",
8434
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8435
- })
8436
- ]
8437
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
8438
- className: "ContextMenuSubContent",
8439
- children: [
8440
- V.availableProps && V.availableProps.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [V.availableProps.map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8441
- className: "ContextMenuItem",
8442
- onSelect: () => {
8443
- let d = { dataBinding: s.dataName };
8444
- C.type === "text" && (d.content = `{{${s.dataName}}}`), w(C.id, d);
8445
- },
8446
- children: [s.name, /* @__PURE__ */ jsx("div", {
8447
- className: "RightSlot",
8448
- style: {
8449
- color: "var(--gray-10)",
8450
- fontSize: 10
8451
- },
8452
- children: s.dataName
8453
- })]
8454
- }, s.dataName)), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
8455
- /* @__PURE__ */ jsx(Item2$1, {
8456
- className: "ContextMenuItem",
8457
- onSelect: () => {
8458
- wO(C.dataBinding || ""), J(!0);
8459
- },
8460
- children: "Outro / Manual..."
8461
- }),
8462
- C.dataBinding && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }), /* @__PURE__ */ jsx(Item2$1, {
8463
- className: "ContextMenuItem",
8464
- style: { color: "var(--red-9)" },
8465
- onSelect: () => w(C.id, { dataBinding: void 0 }),
8466
- children: "Remover Vínculo"
8467
- })] })
8468
- ]
8469
- }) })] }),
8470
- /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
8471
- C.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Item2$1, {
8472
- className: "ContextMenuItem",
8473
- onSelect: () => {
8474
- $(C.content), K(!0);
8475
- },
8476
- children: "Editar Texto..."
8477
- }), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
8478
- /* @__PURE__ */ jsx(Item2$1, {
8479
- className: "ContextMenuItem",
8480
- onSelect: FO,
8481
- children: "Duplicar"
8482
- }),
8483
- /* @__PURE__ */ jsx(Item2$1, {
8484
- className: "ContextMenuItem",
8485
- onSelect: () => k(C.id),
8486
- children: "Excluir"
8487
- }),
8488
- /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
8489
- C.type === "image" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
8490
- /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8491
- className: "ContextMenuSubTrigger",
8492
- children: ["Alterar Imagem", /* @__PURE__ */ jsx("div", {
8493
- className: "RightSlot",
8494
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8495
- })]
8496
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
8497
- className: "ContextMenuSubContent",
8498
- children: [/* @__PURE__ */ jsx(Item2$1, {
8499
- className: "ContextMenuItem",
8500
- onSelect: () => LO.current?.click(),
8501
- children: "Carregar do Computador"
8502
- }), /* @__PURE__ */ jsx(Item2$1, {
8503
- className: "ContextMenuItem",
8504
- onSelect: () => {
8505
- let s = window.prompt("Insira a URL da imagem:", C.content);
8506
- s !== null && w(C.id, { content: s });
8507
- },
8508
- children: "Inserir URL"
8509
- })]
8510
- }) })] }),
8430
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8431
+ appearance: V.theme,
8432
+ style: { display: "contents" },
8433
+ children: /* @__PURE__ */ jsxs(Content2$1, {
8434
+ className: "ContextMenuContent",
8435
+ children: [
8511
8436
  /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8512
8437
  className: "ContextMenuSubTrigger",
8513
- children: ["Ajuste da Imagem", /* @__PURE__ */ jsx("div", {
8514
- className: "RightSlot",
8515
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8516
- })]
8517
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
8518
- className: "ContextMenuSubContent",
8519
8438
  children: [
8520
- /* @__PURE__ */ jsx(Item2$1, {
8521
- className: "ContextMenuItem",
8522
- onSelect: () => kO({ objectFit: "cover" }),
8523
- children: "Preencher (Cover)"
8524
- }),
8525
- /* @__PURE__ */ jsx(Item2$1, {
8526
- className: "ContextMenuItem",
8527
- onSelect: () => kO({ objectFit: "contain" }),
8528
- children: "Ajustar (Contain)"
8529
- }),
8530
- /* @__PURE__ */ jsx(Item2$1, {
8531
- className: "ContextMenuItem",
8532
- onSelect: () => kO({ objectFit: "fill" }),
8533
- children: "Esticar (Fill)"
8439
+ "Vincular Dados ",
8440
+ C.dataBinding && `(${C.dataBinding})`,
8441
+ /* @__PURE__ */ jsx("div", {
8442
+ className: "RightSlot",
8443
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8534
8444
  })
8535
8445
  ]
8446
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8447
+ appearance: V.theme,
8448
+ style: { display: "contents" },
8449
+ children: /* @__PURE__ */ jsxs(SubContent2$1, {
8450
+ className: "ContextMenuSubContent",
8451
+ children: [
8452
+ V.availableProps && V.availableProps.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [V.availableProps.map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8453
+ className: "ContextMenuItem",
8454
+ onSelect: () => {
8455
+ let d = { dataBinding: s.dataName };
8456
+ C.type === "text" && (d.content = `{{${s.dataName}}}`), w(C.id, d);
8457
+ },
8458
+ children: [s.name, /* @__PURE__ */ jsx("div", {
8459
+ className: "RightSlot",
8460
+ style: {
8461
+ color: "var(--gray-10)",
8462
+ fontSize: 10
8463
+ },
8464
+ children: s.dataName
8465
+ })]
8466
+ }, s.dataName)), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
8467
+ /* @__PURE__ */ jsx(Item2$1, {
8468
+ className: "ContextMenuItem",
8469
+ onSelect: () => {
8470
+ wO(C.dataBinding || ""), J(!0);
8471
+ },
8472
+ children: "Outro / Manual..."
8473
+ }),
8474
+ C.dataBinding && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }), /* @__PURE__ */ jsx(Item2$1, {
8475
+ className: "ContextMenuItem",
8476
+ style: { color: "var(--red-9)" },
8477
+ onSelect: () => w(C.id, { dataBinding: void 0 }),
8478
+ children: "Remover Vínculo"
8479
+ })] })
8480
+ ]
8481
+ })
8536
8482
  }) })] }),
8537
- /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })
8538
- ] }),
8539
- /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8540
- className: "ContextMenuSubTrigger",
8541
- children: ["Camadas", /* @__PURE__ */ jsx("div", {
8542
- className: "RightSlot",
8543
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8544
- })]
8545
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
8546
- className: "ContextMenuSubContent",
8547
- children: [/* @__PURE__ */ jsx(Item2$1, {
8483
+ /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
8484
+ C.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Item2$1, {
8548
8485
  className: "ContextMenuItem",
8549
- onSelect: AO,
8550
- children: "Trazer para frente"
8551
- }), /* @__PURE__ */ jsx(Item2$1, {
8486
+ onSelect: () => {
8487
+ $(C.content), K(!0);
8488
+ },
8489
+ children: "Editar Texto..."
8490
+ }), /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })] }),
8491
+ /* @__PURE__ */ jsx(Item2$1, {
8552
8492
  className: "ContextMenuItem",
8553
- onSelect: PO,
8554
- children: "Enviar para trás"
8555
- })]
8556
- }) })] }),
8557
- /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
8558
- C.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
8493
+ onSelect: FO,
8494
+ children: "Duplicar"
8495
+ }),
8496
+ /* @__PURE__ */ jsx(Item2$1, {
8497
+ className: "ContextMenuItem",
8498
+ onSelect: () => k(C.id),
8499
+ children: "Excluir"
8500
+ }),
8501
+ /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
8502
+ C.type === "image" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
8503
+ /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8504
+ className: "ContextMenuSubTrigger",
8505
+ children: ["Alterar Imagem", /* @__PURE__ */ jsx("div", {
8506
+ className: "RightSlot",
8507
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8508
+ })]
8509
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8510
+ appearance: V.theme,
8511
+ style: { display: "contents" },
8512
+ children: /* @__PURE__ */ jsxs(SubContent2$1, {
8513
+ className: "ContextMenuSubContent",
8514
+ children: [/* @__PURE__ */ jsx(Item2$1, {
8515
+ className: "ContextMenuItem",
8516
+ onSelect: () => LO.current?.click(),
8517
+ children: "Carregar do Computador"
8518
+ }), /* @__PURE__ */ jsx(Item2$1, {
8519
+ className: "ContextMenuItem",
8520
+ onSelect: () => {
8521
+ let s = window.prompt("Insira a URL da imagem:", C.content);
8522
+ s !== null && w(C.id, { content: s });
8523
+ },
8524
+ children: "Inserir URL"
8525
+ })]
8526
+ })
8527
+ }) })] }),
8528
+ /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8529
+ className: "ContextMenuSubTrigger",
8530
+ children: ["Ajuste da Imagem", /* @__PURE__ */ jsx("div", {
8531
+ className: "RightSlot",
8532
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8533
+ })]
8534
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8535
+ appearance: V.theme,
8536
+ style: { display: "contents" },
8537
+ children: /* @__PURE__ */ jsxs(SubContent2$1, {
8538
+ className: "ContextMenuSubContent",
8539
+ children: [
8540
+ /* @__PURE__ */ jsx(Item2$1, {
8541
+ className: "ContextMenuItem",
8542
+ onSelect: () => kO({ objectFit: "cover" }),
8543
+ children: "Preencher (Cover)"
8544
+ }),
8545
+ /* @__PURE__ */ jsx(Item2$1, {
8546
+ className: "ContextMenuItem",
8547
+ onSelect: () => kO({ objectFit: "contain" }),
8548
+ children: "Ajustar (Contain)"
8549
+ }),
8550
+ /* @__PURE__ */ jsx(Item2$1, {
8551
+ className: "ContextMenuItem",
8552
+ onSelect: () => kO({ objectFit: "fill" }),
8553
+ children: "Esticar (Fill)"
8554
+ })
8555
+ ]
8556
+ })
8557
+ }) })] }),
8558
+ /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" })
8559
+ ] }),
8559
8560
  /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8560
8561
  className: "ContextMenuSubTrigger",
8561
- children: ["Fonte", /* @__PURE__ */ jsx("div", {
8562
+ children: ["Camadas", /* @__PURE__ */ jsx("div", {
8562
8563
  className: "RightSlot",
8563
8564
  children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8564
8565
  })]
8565
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
8566
- className: "ContextMenuSubContent",
8567
- style: {
8568
- maxHeight: "300px",
8569
- overflowY: "auto"
8570
- },
8571
- children: V.availableFonts && V.availableFonts.map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8572
- className: "ContextMenuItem",
8573
- onSelect: () => kO({ fontFamily: s }),
8574
- style: { fontFamily: s },
8575
- children: [s, C.style?.fontFamily === s && /* @__PURE__ */ jsx("div", {
8576
- className: "RightSlot",
8577
- children: ""
8566
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8567
+ appearance: V.theme,
8568
+ style: { display: "contents" },
8569
+ children: /* @__PURE__ */ jsxs(SubContent2$1, {
8570
+ className: "ContextMenuSubContent",
8571
+ children: [/* @__PURE__ */ jsx(Item2$1, {
8572
+ className: "ContextMenuItem",
8573
+ onSelect: AO,
8574
+ children: "Trazer para frente"
8575
+ }), /* @__PURE__ */ jsx(Item2$1, {
8576
+ className: "ContextMenuItem",
8577
+ onSelect: PO,
8578
+ children: "Enviar para trás"
8578
8579
  })]
8579
- }, s))
8580
+ })
8580
8581
  }) })] }),
8582
+ /* @__PURE__ */ jsx(Separator2$1, { className: "ContextMenuSeparator" }),
8583
+ C.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
8584
+ /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8585
+ className: "ContextMenuSubTrigger",
8586
+ children: ["Fonte", /* @__PURE__ */ jsx("div", {
8587
+ className: "RightSlot",
8588
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8589
+ })]
8590
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8591
+ appearance: V.theme,
8592
+ style: { display: "contents" },
8593
+ children: /* @__PURE__ */ jsx(SubContent2$1, {
8594
+ className: "ContextMenuSubContent",
8595
+ style: {
8596
+ maxHeight: "300px",
8597
+ overflowY: "auto"
8598
+ },
8599
+ children: V.availableFonts && V.availableFonts.map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8600
+ className: "ContextMenuItem",
8601
+ onSelect: () => kO({ fontFamily: s }),
8602
+ style: { fontFamily: s },
8603
+ children: [s, C.style?.fontFamily === s && /* @__PURE__ */ jsx("div", {
8604
+ className: "RightSlot",
8605
+ children: "✓"
8606
+ })]
8607
+ }, s))
8608
+ })
8609
+ }) })] }),
8610
+ /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8611
+ className: "ContextMenuSubTrigger",
8612
+ children: ["Tamanho da Fonte", /* @__PURE__ */ jsx("div", {
8613
+ className: "RightSlot",
8614
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8615
+ })]
8616
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8617
+ appearance: V.theme,
8618
+ style: { display: "contents" },
8619
+ children: /* @__PURE__ */ jsx(SubContent2$1, {
8620
+ className: "ContextMenuSubContent",
8621
+ children: [
8622
+ 12,
8623
+ 14,
8624
+ 16,
8625
+ 20,
8626
+ 24,
8627
+ 32,
8628
+ 48,
8629
+ 64
8630
+ ].map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8631
+ className: "ContextMenuItem",
8632
+ onSelect: () => kO({ fontSize: `${s}px` }),
8633
+ children: [s, "px"]
8634
+ }, s))
8635
+ })
8636
+ }) })] }),
8637
+ /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8638
+ className: "ContextMenuSubTrigger",
8639
+ children: ["Cor do Texto", /* @__PURE__ */ jsx("div", {
8640
+ className: "RightSlot",
8641
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8642
+ })]
8643
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8644
+ appearance: V.theme,
8645
+ style: { display: "contents" },
8646
+ children: /* @__PURE__ */ jsx(SubContent2$1, {
8647
+ className: "ContextMenuSubContent",
8648
+ children: IO.filter((s) => s !== "transparent").map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8649
+ className: "ContextMenuItem",
8650
+ onSelect: () => kO({ color: s }),
8651
+ children: [/* @__PURE__ */ jsx("div", { style: {
8652
+ width: 12,
8653
+ height: 12,
8654
+ backgroundColor: s,
8655
+ marginRight: 8,
8656
+ border: "1px solid #ccc"
8657
+ } }), s]
8658
+ }, s))
8659
+ })
8660
+ }) })] }),
8661
+ /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8662
+ className: "ContextMenuSubTrigger",
8663
+ children: ["Peso da Fonte", /* @__PURE__ */ jsx("div", {
8664
+ className: "RightSlot",
8665
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8666
+ })]
8667
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8668
+ appearance: V.theme,
8669
+ style: { display: "contents" },
8670
+ children: /* @__PURE__ */ jsxs(SubContent2$1, {
8671
+ className: "ContextMenuSubContent",
8672
+ children: [/* @__PURE__ */ jsx(Item2$1, {
8673
+ className: "ContextMenuItem",
8674
+ onSelect: () => kO({ fontWeight: "normal" }),
8675
+ children: "Normal"
8676
+ }), /* @__PURE__ */ jsx(Item2$1, {
8677
+ className: "ContextMenuItem",
8678
+ onSelect: () => kO({ fontWeight: "bold" }),
8679
+ children: "Negrito"
8680
+ })]
8681
+ })
8682
+ }) })] }),
8683
+ /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8684
+ className: "ContextMenuSubTrigger",
8685
+ children: ["Alinhamento", /* @__PURE__ */ jsx("div", {
8686
+ className: "RightSlot",
8687
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8688
+ })]
8689
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8690
+ appearance: V.theme,
8691
+ style: { display: "contents" },
8692
+ children: /* @__PURE__ */ jsxs(SubContent2$1, {
8693
+ className: "ContextMenuSubContent",
8694
+ children: [
8695
+ /* @__PURE__ */ jsx(Item2$1, {
8696
+ className: "ContextMenuItem",
8697
+ onSelect: () => kO({ textAlign: "left" }),
8698
+ children: "Esquerda"
8699
+ }),
8700
+ /* @__PURE__ */ jsx(Item2$1, {
8701
+ className: "ContextMenuItem",
8702
+ onSelect: () => kO({ textAlign: "center" }),
8703
+ children: "Centro"
8704
+ }),
8705
+ /* @__PURE__ */ jsx(Item2$1, {
8706
+ className: "ContextMenuItem",
8707
+ onSelect: () => kO({ textAlign: "right" }),
8708
+ children: "Direita"
8709
+ })
8710
+ ]
8711
+ })
8712
+ }) })] })
8713
+ ] }),
8581
8714
  /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8582
8715
  className: "ContextMenuSubTrigger",
8583
- children: ["Tamanho da Fonte", /* @__PURE__ */ jsx("div", {
8716
+ children: ["Cor de Fundo", /* @__PURE__ */ jsx("div", {
8584
8717
  className: "RightSlot",
8585
8718
  children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8586
8719
  })]
8587
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
8588
- className: "ContextMenuSubContent",
8589
- children: [
8590
- 12,
8591
- 14,
8592
- 16,
8593
- 20,
8594
- 24,
8595
- 32,
8596
- 48,
8597
- 64
8598
- ].map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8599
- className: "ContextMenuItem",
8600
- onSelect: () => kO({ fontSize: `${s}px` }),
8601
- children: [s, "px"]
8602
- }, s))
8720
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8721
+ appearance: V.theme,
8722
+ style: { display: "contents" },
8723
+ children: /* @__PURE__ */ jsx(SubContent2$1, {
8724
+ className: "ContextMenuSubContent",
8725
+ children: IO.map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8726
+ className: "ContextMenuItem",
8727
+ onSelect: () => kO({ backgroundColor: s }),
8728
+ children: [/* @__PURE__ */ jsx("div", { style: {
8729
+ width: 12,
8730
+ height: 12,
8731
+ backgroundColor: s,
8732
+ marginRight: 8,
8733
+ border: "1px solid #ccc"
8734
+ } }), s === "transparent" ? "Transparente" : s]
8735
+ }, s))
8736
+ })
8603
8737
  }) })] }),
8604
8738
  /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8605
8739
  className: "ContextMenuSubTrigger",
8606
- children: ["Cor do Texto", /* @__PURE__ */ jsx("div", {
8740
+ children: ["Arredondamento", /* @__PURE__ */ jsx("div", {
8607
8741
  className: "RightSlot",
8608
8742
  children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8609
8743
  })]
8610
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
8611
- className: "ContextMenuSubContent",
8612
- children: IO.filter((s) => s !== "transparent").map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8613
- className: "ContextMenuItem",
8614
- onSelect: () => kO({ color: s }),
8615
- children: [/* @__PURE__ */ jsx("div", { style: {
8616
- width: 12,
8617
- height: 12,
8618
- backgroundColor: s,
8619
- marginRight: 8,
8620
- border: "1px solid #ccc"
8621
- } }), s]
8622
- }, s))
8744
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8745
+ appearance: V.theme,
8746
+ style: { display: "contents" },
8747
+ children: /* @__PURE__ */ jsx(SubContent2$1, {
8748
+ className: "ContextMenuSubContent",
8749
+ children: [
8750
+ 0,
8751
+ 4,
8752
+ 8,
8753
+ 12,
8754
+ 16,
8755
+ 24,
8756
+ "50%"
8757
+ ].map((s) => /* @__PURE__ */ jsx(Item2$1, {
8758
+ className: "ContextMenuItem",
8759
+ onSelect: () => kO({ borderRadius: typeof s == "number" ? `${s}px` : s }),
8760
+ children: s === "50%" ? "Círculo" : `${s}px`
8761
+ }, s))
8762
+ })
8623
8763
  }) })] }),
8624
8764
  /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8625
8765
  className: "ContextMenuSubTrigger",
8626
- children: ["Peso da Fonte", /* @__PURE__ */ jsx("div", {
8766
+ children: ["Espaçamento", /* @__PURE__ */ jsx("div", {
8627
8767
  className: "RightSlot",
8628
8768
  children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8629
8769
  })]
8630
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
8631
- className: "ContextMenuSubContent",
8632
- children: [/* @__PURE__ */ jsx(Item2$1, {
8633
- className: "ContextMenuItem",
8634
- onSelect: () => kO({ fontWeight: "normal" }),
8635
- children: "Normal"
8636
- }), /* @__PURE__ */ jsx(Item2$1, {
8637
- className: "ContextMenuItem",
8638
- onSelect: () => kO({ fontWeight: "bold" }),
8639
- children: "Negrito"
8640
- })]
8770
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8771
+ appearance: V.theme,
8772
+ style: { display: "contents" },
8773
+ children: /* @__PURE__ */ jsx(SubContent2$1, {
8774
+ className: "ContextMenuSubContent",
8775
+ children: [
8776
+ 0,
8777
+ 4,
8778
+ 8,
8779
+ 12,
8780
+ 16,
8781
+ 24,
8782
+ 32
8783
+ ].map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8784
+ className: "ContextMenuItem",
8785
+ onSelect: () => kO({ padding: `${s}px` }),
8786
+ children: [s, "px"]
8787
+ }, s))
8788
+ })
8641
8789
  }) })] }),
8642
8790
  /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8643
8791
  className: "ContextMenuSubTrigger",
8644
- children: ["Alinhamento", /* @__PURE__ */ jsx("div", {
8792
+ children: ["Borda", /* @__PURE__ */ jsx("div", {
8645
8793
  className: "RightSlot",
8646
8794
  children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8647
8795
  })]
8648
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
8649
- className: "ContextMenuSubContent",
8650
- children: [
8651
- /* @__PURE__ */ jsx(Item2$1, {
8652
- className: "ContextMenuItem",
8653
- onSelect: () => kO({ textAlign: "left" }),
8654
- children: "Esquerda"
8655
- }),
8656
- /* @__PURE__ */ jsx(Item2$1, {
8657
- className: "ContextMenuItem",
8658
- onSelect: () => kO({ textAlign: "center" }),
8659
- children: "Centro"
8660
- }),
8661
- /* @__PURE__ */ jsx(Item2$1, {
8662
- className: "ContextMenuItem",
8663
- onSelect: () => kO({ textAlign: "right" }),
8664
- children: "Direita"
8665
- })
8666
- ]
8796
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8797
+ appearance: V.theme,
8798
+ style: { display: "contents" },
8799
+ children: /* @__PURE__ */ jsxs(SubContent2$1, {
8800
+ className: "ContextMenuSubContent",
8801
+ children: [/* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8802
+ className: "ContextMenuSubTrigger",
8803
+ children: ["Cor da Borda", /* @__PURE__ */ jsx("div", {
8804
+ className: "RightSlot",
8805
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8806
+ })]
8807
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8808
+ appearance: V.theme,
8809
+ style: { display: "contents" },
8810
+ children: /* @__PURE__ */ jsxs(SubContent2$1, {
8811
+ className: "ContextMenuSubContent",
8812
+ children: [IO.filter((s) => s !== "transparent").map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8813
+ className: "ContextMenuItem",
8814
+ onSelect: () => kO({
8815
+ borderColor: s,
8816
+ borderStyle: "solid"
8817
+ }),
8818
+ children: [/* @__PURE__ */ jsx("div", { style: {
8819
+ width: 12,
8820
+ height: 12,
8821
+ backgroundColor: s,
8822
+ marginRight: 8,
8823
+ border: "1px solid #ccc"
8824
+ } }), s]
8825
+ }, s)), /* @__PURE__ */ jsx(Item2$1, {
8826
+ className: "ContextMenuItem",
8827
+ onSelect: () => kO({ borderStyle: "none" }),
8828
+ children: "Sem Borda"
8829
+ })]
8830
+ })
8831
+ }) })] }), /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8832
+ className: "ContextMenuSubTrigger",
8833
+ children: ["Espessura", /* @__PURE__ */ jsx("div", {
8834
+ className: "RightSlot",
8835
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8836
+ })]
8837
+ }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(R, {
8838
+ appearance: V.theme,
8839
+ style: { display: "contents" },
8840
+ children: /* @__PURE__ */ jsx(SubContent2$1, {
8841
+ className: "ContextMenuSubContent",
8842
+ children: [
8843
+ 1,
8844
+ 2,
8845
+ 4,
8846
+ 8
8847
+ ].map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8848
+ className: "ContextMenuItem",
8849
+ onSelect: () => kO({
8850
+ borderWidth: `${s}px`,
8851
+ borderStyle: "solid"
8852
+ }),
8853
+ children: [s, "px"]
8854
+ }, s))
8855
+ })
8856
+ }) })] })]
8857
+ })
8667
8858
  }) })] })
8668
- ] }),
8669
- /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8670
- className: "ContextMenuSubTrigger",
8671
- children: ["Cor de Fundo", /* @__PURE__ */ jsx("div", {
8672
- className: "RightSlot",
8673
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8674
- })]
8675
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
8676
- className: "ContextMenuSubContent",
8677
- children: IO.map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8678
- className: "ContextMenuItem",
8679
- onSelect: () => kO({ backgroundColor: s }),
8680
- children: [/* @__PURE__ */ jsx("div", { style: {
8681
- width: 12,
8682
- height: 12,
8683
- backgroundColor: s,
8684
- marginRight: 8,
8685
- border: "1px solid #ccc"
8686
- } }), s === "transparent" ? "Transparente" : s]
8687
- }, s))
8688
- }) })] }),
8689
- /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8690
- className: "ContextMenuSubTrigger",
8691
- children: ["Arredondamento", /* @__PURE__ */ jsx("div", {
8692
- className: "RightSlot",
8693
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8694
- })]
8695
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
8696
- className: "ContextMenuSubContent",
8697
- children: [
8698
- 0,
8699
- 4,
8700
- 8,
8701
- 12,
8702
- 16,
8703
- 24,
8704
- "50%"
8705
- ].map((s) => /* @__PURE__ */ jsx(Item2$1, {
8706
- className: "ContextMenuItem",
8707
- onSelect: () => kO({ borderRadius: typeof s == "number" ? `${s}px` : s }),
8708
- children: s === "50%" ? "Círculo" : `${s}px`
8709
- }, s))
8710
- }) })] }),
8711
- /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8712
- className: "ContextMenuSubTrigger",
8713
- children: ["Espaçamento", /* @__PURE__ */ jsx("div", {
8714
- className: "RightSlot",
8715
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8716
- })]
8717
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
8718
- className: "ContextMenuSubContent",
8719
- children: [
8720
- 0,
8721
- 4,
8722
- 8,
8723
- 12,
8724
- 16,
8725
- 24,
8726
- 32
8727
- ].map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8728
- className: "ContextMenuItem",
8729
- onSelect: () => kO({ padding: `${s}px` }),
8730
- children: [s, "px"]
8731
- }, s))
8732
- }) })] }),
8733
- /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8734
- className: "ContextMenuSubTrigger",
8735
- children: ["Borda", /* @__PURE__ */ jsx("div", {
8736
- className: "RightSlot",
8737
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8738
- })]
8739
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
8740
- className: "ContextMenuSubContent",
8741
- children: [/* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8742
- className: "ContextMenuSubTrigger",
8743
- children: ["Cor da Borda", /* @__PURE__ */ jsx("div", {
8744
- className: "RightSlot",
8745
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8746
- })]
8747
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
8748
- className: "ContextMenuSubContent",
8749
- children: [IO.filter((s) => s !== "transparent").map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8750
- className: "ContextMenuItem",
8751
- onSelect: () => kO({
8752
- borderColor: s,
8753
- borderStyle: "solid"
8754
- }),
8755
- children: [/* @__PURE__ */ jsx("div", { style: {
8756
- width: 12,
8757
- height: 12,
8758
- backgroundColor: s,
8759
- marginRight: 8,
8760
- border: "1px solid #ccc"
8761
- } }), s]
8762
- }, s)), /* @__PURE__ */ jsx(Item2$1, {
8763
- className: "ContextMenuItem",
8764
- onSelect: () => kO({ borderStyle: "none" }),
8765
- children: "Sem Borda"
8766
- })]
8767
- }) })] }), /* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
8768
- className: "ContextMenuSubTrigger",
8769
- children: ["Espessura", /* @__PURE__ */ jsx("div", {
8770
- className: "RightSlot",
8771
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
8772
- })]
8773
- }), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
8774
- className: "ContextMenuSubContent",
8775
- children: [
8776
- 1,
8777
- 2,
8778
- 4,
8779
- 8
8780
- ].map((s) => /* @__PURE__ */ jsxs(Item2$1, {
8781
- className: "ContextMenuItem",
8782
- onSelect: () => kO({
8783
- borderWidth: `${s}px`,
8784
- borderStyle: "solid"
8785
- }),
8786
- children: [s, "px"]
8787
- }, s))
8788
- }) })] })]
8789
- }) })] })
8790
- ]
8859
+ ]
8860
+ })
8791
8861
  }) })] })
8792
8862
  ] });
8793
8863
  };
@@ -13394,7 +13464,7 @@ const Preview = () => {
13394
13464
  height: "100%",
13395
13465
  position: "relative",
13396
13466
  overflow: "hidden",
13397
- backgroundColor: "white"
13467
+ backgroundColor: "var(--color-panel-solid)"
13398
13468
  },
13399
13469
  children: /* @__PURE__ */ jsx(c, {
13400
13470
  type: "auto",
@@ -13456,35 +13526,37 @@ const Preview = () => {
13456
13526
  })
13457
13527
  });
13458
13528
  };
13459
- var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
13460
- let [k, F] = useState(!0), [L, V] = useState(!0), { addElement: U, loadState: K, state: q } = useEditor();
13529
+ var EditorContent = ({ layout: s, initialState: C, onSave: w, theme: k = "light" }) => {
13530
+ let [F, L] = useState(!0), [V, U] = useState(!0), { addElement: K, loadState: q, state: J } = useEditor();
13461
13531
  React.useEffect(() => {
13462
13532
  if (C) try {
13463
13533
  let s = typeof C == "string" ? JSON.parse(C) : C;
13464
- Array.isArray(s) ? K({ elements: s }) : s.elements && K(s);
13534
+ Array.isArray(s) ? q({ elements: s }) : s.elements && q(s);
13465
13535
  } catch (s) {
13466
13536
  console.error("Failed to load initial state", s);
13467
13537
  }
13468
- }, [C, K]);
13469
- let J = (s) => {
13470
- console.log(`Adding element of type: ${s}`), U({
13538
+ }, [C, q]);
13539
+ let X = (s) => {
13540
+ console.log(`Adding element of type: ${s}`), K({
13471
13541
  type: s,
13472
13542
  content: `New ${s}`
13473
13543
  });
13474
13544
  };
13475
13545
  return /* @__PURE__ */ jsx(R, {
13476
- appearance: "light",
13546
+ appearance: k,
13477
13547
  accentColor: "blue",
13478
13548
  grayColor: "slate",
13479
13549
  radius: "medium",
13480
13550
  scaling: "100%",
13481
13551
  children: /* @__PURE__ */ jsxs(p, {
13552
+ direction: "row",
13482
13553
  style: {
13483
- height: "100%",
13554
+ height: "100vh",
13484
13555
  width: "100%",
13485
- overflow: "hidden"
13556
+ overflow: "hidden",
13557
+ backgroundColor: "var(--color-background)"
13486
13558
  },
13487
- children: [L && /* @__PURE__ */ jsxs(p, {
13559
+ children: [V && /* @__PURE__ */ jsxs(p, {
13488
13560
  direction: "column",
13489
13561
  width: "280px",
13490
13562
  style: {
@@ -13521,15 +13593,15 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
13521
13593
  style: { width: "240px" },
13522
13594
  children: [
13523
13595
  /* @__PURE__ */ jsx(v$1, {
13524
- onSelect: () => J("text"),
13596
+ onSelect: () => X("text"),
13525
13597
  children: "Texto"
13526
13598
  }),
13527
13599
  /* @__PURE__ */ jsx(v$1, {
13528
- onSelect: () => J("image"),
13600
+ onSelect: () => X("image"),
13529
13601
  children: "Imagem"
13530
13602
  }),
13531
13603
  /* @__PURE__ */ jsx(v$1, {
13532
- onSelect: () => J("box"),
13604
+ onSelect: () => X("box"),
13533
13605
  children: "Caixa (Container)"
13534
13606
  })
13535
13607
  ]
@@ -13606,13 +13678,16 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
13606
13678
  marginBottom: "12px"
13607
13679
  },
13608
13680
  onClick: () => {
13609
- w ? w(JSON.stringify({
13610
- elements: q.elements,
13611
- listSettings: q.listSettings,
13612
- mockData: q.mockData,
13613
- singleMockData: q.singleMockData,
13614
- isList: q.isList
13615
- }, null, 2)) : console.log("Salvar acionado, mas nenhum callback onSave foi fornecido.");
13681
+ if (w) {
13682
+ let s = {
13683
+ elements: J.elements,
13684
+ isList: J.isList,
13685
+ mockData: J.mockData,
13686
+ singleMockData: J.singleMockData,
13687
+ listSettings: J.listSettings
13688
+ };
13689
+ w(JSON.stringify(s, null, 2));
13690
+ }
13616
13691
  },
13617
13692
  children: [/* @__PURE__ */ jsx(Share1Icon, {}), " Salvar Alterações"]
13618
13693
  })
@@ -13637,9 +13712,9 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
13637
13712
  size: "2",
13638
13713
  variant: "soft",
13639
13714
  color: "gray",
13640
- onClick: () => V(!L),
13641
- title: L ? "Ocultar Barra Lateral" : "Mostrar Barra Lateral",
13642
- children: jsx(L ? DoubleArrowLeftIcon : DoubleArrowRightIcon, {})
13715
+ onClick: () => U(!V),
13716
+ title: V ? "Ocultar Barra Lateral" : "Mostrar Barra Lateral",
13717
+ children: jsx(V ? DoubleArrowLeftIcon : DoubleArrowRightIcon, {})
13643
13718
  })
13644
13719
  }),
13645
13720
  /* @__PURE__ */ jsx(p, {
@@ -13653,10 +13728,10 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
13653
13728
  children: /* @__PURE__ */ jsx(o$1, {
13654
13729
  size: "2",
13655
13730
  variant: "soft",
13656
- color: k ? "blue" : "gray",
13657
- onClick: () => F(!k),
13658
- title: k ? "Ocultar Preview" : "Mostrar Preview",
13659
- children: jsx(k ? EyeOpenIcon : EyeNoneIcon, {})
13731
+ color: F ? "blue" : "gray",
13732
+ onClick: () => L(!F),
13733
+ title: F ? "Ocultar Preview" : "Mostrar Preview",
13734
+ children: jsx(F ? EyeOpenIcon : EyeNoneIcon, {})
13660
13735
  })
13661
13736
  }),
13662
13737
  /* @__PURE__ */ jsxs(Rt, {
@@ -13678,13 +13753,13 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
13678
13753
  children: /* @__PURE__ */ jsx(Canvas, {})
13679
13754
  })
13680
13755
  }),
13681
- k && /* @__PURE__ */ jsx(Ot, { style: {
13756
+ F && /* @__PURE__ */ jsx(Ot, { style: {
13682
13757
  width: "4px",
13683
13758
  backgroundColor: "var(--gray-6)",
13684
13759
  cursor: "col-resize",
13685
13760
  transition: "background-color 0.2s"
13686
13761
  } }),
13687
- k && /* @__PURE__ */ jsx(kt, {
13762
+ F && /* @__PURE__ */ jsx(kt, {
13688
13763
  defaultSize: 50,
13689
13764
  minSize: 20,
13690
13765
  children: /* @__PURE__ */ jsx(p$1, {
@@ -13707,6 +13782,7 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
13707
13782
  const GenericEditor = (s) => /* @__PURE__ */ jsx(EditorProvider, {
13708
13783
  isList: s.layout.isList,
13709
13784
  availableProps: s.layout.props,
13785
+ theme: s.theme,
13710
13786
  children: /* @__PURE__ */ jsx(EditorContent, { ...s })
13711
13787
  }), generateHTML = (s, d, C = {}) => Function("elements", "data", "options", getRendererCode() + "\nreturn renderTemplate(elements, data, options);")(s, d, C), getRendererCode = () => "\n/**\n * Render Template\n * @param {Array} elements - The JSON configuration of elements\n * @param {Object|Array} data - The data object to inject (Object for single, Array for list)\n * @param {Object} options - { isList: boolean, listSettings: { sortProp: string, sortOrder: 'asc'|'desc' } }\n * @returns {string} - The generated HTML string\n */\nfunction renderTemplate(elements, data, options = {}) {\n const { isList, listSettings } = options;\n\n const camelToKebab = (string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n };\n\n const styleObjectToString = (style) => {\n if (!style) return '';\n const pxProps = ['width', 'height', 'top', 'left', 'right', 'bottom', 'fontSize', 'borderRadius', 'padding', 'margin', 'borderWidth'];\n \n return Object.entries(style)\n .map(([key, value]) => {\n if (value === undefined || value === null) return '';\n const cssKey = camelToKebab(key);\n const cssValue = (typeof value === 'number' && pxProps.includes(key)) ? value + 'px' : value;\n return `${cssKey}: ${cssValue}`;\n })\n .filter(Boolean)\n .join('; ');\n };\n\n const renderItem = (itemData, index = 0, offsetY = 0) => {\n return elements.map(element => {\n let content = element.content;\n let imgSrc = '';\n\n if (element.type === 'text') {\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n } else if (element.type === 'image') {\n if (element.dataBinding) {\n const val = itemData[element.dataBinding];\n if (val !== undefined && val !== null) {\n imgSrc = String(val);\n } else {\n imgSrc = content;\n }\n } else {\n imgSrc = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n }\n }\n\n const baseStyle = {\n position: 'absolute',\n left: element.x,\n top: element.y + offsetY,\n width: element.width,\n height: element.height,\n transform: element.rotation ? `rotate(${element.rotation}deg)` : undefined,\n overflow: 'hidden',\n ...element.style\n };\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text') {\n return `<div style=\"${styleString}\">${content}</div>`;\n } else if (element.type === 'image') {\n const imgStyle = styleObjectToString({\n width: '100%',\n height: '100%',\n objectFit: element.style?.objectFit || 'cover',\n display: 'block'\n });\n return `<div style=\"${styleString}\"><img src=\"${imgSrc}\" alt=\"Element\" style=\"${imgStyle}\" /></div>`;\n } else if (element.type === 'box') {\n return `<div style=\"${styleString}\"></div>`;\n }\n return '';\n }).join('\\n');\n };\n\n if (isList && Array.isArray(data)) {\n // Calculate item height\n const maxY = Math.max(...elements.map(el => el.y + el.height));\n const itemHeight = maxY; // Add some padding if needed, or rely on element positioning\n\n // Sort data\n let listData = [...data];\n if (listSettings && listSettings.sortProp) {\n const prop = listSettings.sortProp;\n const order = listSettings.sortOrder === 'asc' ? 1 : -1;\n listData.sort((a, b) => {\n const valA = a[prop];\n const valB = b[prop];\n if (valA < valB) return -1 * order;\n if (valA > valB) return 1 * order;\n return 0;\n });\n }\n\n // Generate HTML for all items\n const itemsHtml = listData.map((item, index) => {\n // We render each item inside a relative container to maintain local positioning\n // But for the scroll animation, we usually stack them.\n // Let's stack them vertically.\n \n const itemHtml = renderItem(item, index, 0); // Internal offset is 0, we move the container\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 20 // Spacing between items\n });\n \n return `<div class=\"list-item\" style=\"${itemContainerStyle}\">${itemHtml}</div>`;\n }).join('\\n');\n\n // Animation Styles\n // Bottom-anchored list (chat style)\n const animationCss = `\n @keyframes slideIn {\n from { opacity: 0; transform: translateY(50px); }\n to { opacity: 1; transform: translateY(0); }\n }\n .list-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n height: 100%;\n width: 100%;\n overflow: hidden;\n padding-bottom: 20px;\n box-sizing: border-box;\n }\n .list-item {\n flex-shrink: 0;\n animation: slideIn 0.5s ease-out;\n margin-top: 20px;\n width: 100%;\n position: relative;\n }\n `;\n\n return `\n <style>${animationCss}</style>\n <div class=\"list-wrapper\">\n ${itemsHtml}\n </div>\n `;\n }\n\n // Single Item\n const contentHtml = renderItem(data);\n return `<div style=\"position: relative; width: 100%; height: 100%; overflow: hidden;\">${contentHtml}</div>`;\n}\n";
13712
13788
  export { GenericEditor as EditorContent, generateHTML };