@kgalexander/mcreate 0.0.14 → 0.0.15

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.
@@ -1587,8 +1587,8 @@ function createSectionPropertyTripleElement(payload) {
1587
1587
 
1588
1588
  // templates/empty.json
1589
1589
  var empty_default = {
1590
- id: "-1",
1591
- name: "Empty Template",
1590
+ id: "1",
1591
+ name: "Playground Demo",
1592
1592
  version: "1.0.0",
1593
1593
  published: true,
1594
1594
  creator: "Kevin Guerrero",
@@ -1633,7 +1633,7 @@ var empty_default = {
1633
1633
  tagName: "mj-text",
1634
1634
  data: {
1635
1635
  value: {
1636
- content: '<p class="paragraph" style=" padding: 4px 0; font-family: Arial, sans-serif;">&nbsp;</p>'
1636
+ content: '<p class="paragraph" style=" padding: 4px 0; font-family: Arial, sans-serif;">Welcome to our Open House! Please join us for a tour of this beautiful home.</p>'
1637
1637
  }
1638
1638
  },
1639
1639
  attributes: {
@@ -1646,180 +1646,6 @@ var empty_default = {
1646
1646
  }
1647
1647
  ]
1648
1648
  },
1649
- {
1650
- type: "section-property-km",
1651
- tagName: "mj-section",
1652
- data: { value: { columnRows: 1, columnWidths: [] } },
1653
- attributes: { "background-color": "#FFFFFF", padding: "12px 12px 12px 12px" },
1654
- children: [
1655
- {
1656
- type: "column",
1657
- tagName: "mj-column",
1658
- data: { value: {} },
1659
- attributes: { "background-color": "#FFFFFF", width: "500px", padding: "0px", border: "1px solid #dddddd", "border-radius": "0px" },
1660
- children: [
1661
- {
1662
- type: "property-card",
1663
- tagName: "mj-colproperty",
1664
- data: { value: {} },
1665
- attributes: {
1666
- "image-src": "https://cornerstonepropertymgmt.com/wp-content/themes/cornerstone/assets/img/nofeaturedimage.jpg",
1667
- "image-alt": "Beautiful modern home with pool",
1668
- description: "Beautiful modern home with pool",
1669
- price: "1000000",
1670
- address: "123 Main Street",
1671
- city: "Austin, TX 78701",
1672
- beds: "",
1673
- baths: "2",
1674
- sqft: "1,850",
1675
- href: "https://www.zillow.com/homedetails/126-Cara-Mia-Ln-Galloway-NJ-08205/68297408_zpid/?rtoken=6acd62a8-1848-41ed-919b-0034083eafca~X1-ZUu7aphk9l2689_9ej1i&utm_campaign=emo-instantsearchdigest&utm_source=email&utm_term=urn%3Amsg%3A20251026011813e84b11d632bb8725&utm_medium=email&utm_content=forsaleimage&sse=X1-SSsyx4z97dhglz0000000000_1pt02&srp=H4sIAAAAAAAAAHWRwXKDIBCGn8ZjokKQeOh0YpOZ9Nihh94yRNfozAoOYFrz9FXR1h7KgVn%2B799lF8JKN2DDUpuLlQjhswVp8uqtA9MLJx08BTwLCGlkm%2BlOFXaIA3rw4idY588bvtuyNElSEpCXQQK5JpTtk4h6YnXnKo9ouiWcUco8UdqsSMIp2fOAHz00cKu1EoCQuyGYu2CZb8TT18LLSRwtt3nw3rfg0VSQzTXLGh2Yacr1VLU9IJ7HZ1mrd4ndbHNmiJbGQMkrgsgrrfG%2FhFKi%2Fc24wt9XbOp5HDZaFpeVdyjE9BknZTRiA8otEw77R7wRwvZfu0fKi%2BqGj%2BhnXeLWRWR08uM33zV%2BmeABAAA%3D",
1676
- status: "Empty",
1677
- "status-color": "#B8B8B8",
1678
- "is-new": "",
1679
- "is-open-house": "1",
1680
- "open-house-date": "2026-01-29",
1681
- "open-house-time": "01:00-13:07",
1682
- brokerage: "Keller Williams Atlantic Shore",
1683
- "mls-logo": "https://t4.ftcdn.net/jpg/06/71/92/37/360_F_671923740_x0zOL3OIuUAnSF6sr7PuznCI5bQFKhI0.jpg",
1684
- "border-radius": "0px",
1685
- border: "1px solid #dddddd",
1686
- "font-family": "Arial, sans-serif",
1687
- "text-color": "#000000",
1688
- "price-text-color": "",
1689
- "details-text-color": "",
1690
- "address-text-color": "",
1691
- "brokerage-text-color": "#535364",
1692
- "description-text-color": "",
1693
- "mls-logo-text-color": "",
1694
- "status-text-color": "",
1695
- "new-text-color": "",
1696
- "open-house-text-color": ""
1697
- }
1698
- }
1699
- ]
1700
- }
1701
- ]
1702
- },
1703
- {
1704
- type: "section-property-single-two",
1705
- tagName: "mj-section",
1706
- data: { value: { columnRows: 1, columnWidths: [] } },
1707
- attributes: { "background-color": "#FFFFFF", padding: "12px 12px 12px 12px" },
1708
- children: [
1709
- {
1710
- type: "column",
1711
- tagName: "mj-column",
1712
- data: { value: {} },
1713
- attributes: { "background-color": "#FFFFFF", width: "500px", padding: "0px", border: "1px solid #dddddd", "border-radius": "12px" },
1714
- children: [
1715
- {
1716
- type: "property-card-single-two",
1717
- tagName: "mj-propertysingletwo",
1718
- data: { value: {} },
1719
- attributes: {
1720
- "image-src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRXddI94MwjUVz5M4CyDxZhSkIIwWbyDF59_w&s",
1721
- "image-alt": "Beautiful modern home with pool",
1722
- description: "Beautiful modern home with pool",
1723
- price: "324203492034",
1724
- address: "123 Main Street",
1725
- city: "Austin, TX 78701",
1726
- beds: "",
1727
- baths: "",
1728
- sqft: "",
1729
- href: "https://www.zillow.com/homedetails/126-Cara-Mia-Ln-Galloway-NJ-08205/68297408_zpid/?rtoken=6acd62a8-1848-41ed-919b-0034083eafca~X1-ZUu7aphk9l2689_9ej1i&utm_campaign=emo-instantsearchdigest&utm_source=email&utm_term=urn%3Amsg%3A20251026011813e84b11d632bb8725&utm_medium=email&utm_content=forsaleimage&sse=X1-SSsyx4z97dhglz0000000000_1pt02&srp=H4sIAAAAAAAAAHWRwXKDIBCGn8ZjokKQeOh0YpOZ9Nihh94yRNfozAoOYFrz9FXR1h7KgVn%2B799lF8JKN2DDUpuLlQjhswVp8uqtA9MLJx08BTwLCGlkm%2BlOFXaIA3rw4idY588bvtuyNElSEpCXQQK5JpTtk4h6YnXnKo9ouiWcUco8UdqsSMIp2fOAHz00cKu1EoCQuyGYu2CZb8TT18LLSRwtt3nw3rfg0VSQzTXLGh2Yacr1VLU9IJ7HZ1mrd4ndbHNmiJbGQMkrgsgrrfG%2FhFKi%2Fc24wt9XbOp5HDZaFpeVdyjE9BknZTRiA8otEw77R7wRwvZfu0fKi%2BqGj%2BhnXeLWRWR08uM33zV%2BmeABAAA%3D",
1730
- status: "Just Listed",
1731
- "status-color": "#008000",
1732
- "is-new": "1",
1733
- "is-open-house": "",
1734
- "open-house-date": "03/25",
1735
- "open-house-time": "12pm-1pm",
1736
- brokerage: "Keller Williams Atlantic Shore",
1737
- "mls-logo": "https://t4.ftcdn.net/jpg/06/71/92/37/360_F_671923740_x0zOL3OIuUAnSF6sr7PuznCI5bQFKhI0.jpg",
1738
- "border-radius": "12px",
1739
- border: "1x solid #dddddd",
1740
- "font-family": "Arial, sans-serif",
1741
- "text-color": "#000000"
1742
- }
1743
- }
1744
- ]
1745
- }
1746
- ]
1747
- },
1748
- {
1749
- type: "section-property-triple",
1750
- tagName: "mj-section",
1751
- data: { value: { columnRows: 1, columnWidths: [] } },
1752
- attributes: { "background-color": "#FFFFFF", padding: "12px" },
1753
- children: [
1754
- {
1755
- type: "column",
1756
- tagName: "mj-column",
1757
- data: { value: {} },
1758
- attributes: { "background-color": "transparent", padding: "0px", "css-class": "property-triple-section-column", width: "500px" },
1759
- children: [
1760
- {
1761
- type: "property-card-triple",
1762
- tagName: "mj-propertytriple",
1763
- data: { value: {} },
1764
- attributes: {
1765
- width: "100%",
1766
- gap: "24px",
1767
- "border-radius": "8px",
1768
- border: "1px solid #d1d1d5",
1769
- "image-height": "102px",
1770
- "font-family": "Arial, sans-serif",
1771
- "text-color": "#000000",
1772
- "background-color": "#FFFFFF"
1773
- },
1774
- children: [
1775
- {
1776
- type: "property-card-triple-item",
1777
- tagName: "mj-propertytripleitem",
1778
- data: { value: {} },
1779
- attributes: {
1780
- "image-src": "https://photos.zillowstatic.com/fp/a8e605d336d0b5a94d91828aee3c0afb-p_i.jpg",
1781
- href: "",
1782
- price: "$320,000",
1783
- beds: "3",
1784
- baths: "2",
1785
- sqft: "1,385",
1786
- city: "Egg Harbor City"
1787
- }
1788
- },
1789
- {
1790
- type: "property-card-triple-item",
1791
- tagName: "mj-propertytripleitem",
1792
- data: { value: {} },
1793
- attributes: {
1794
- "image-src": "https://photos.zillowstatic.com/fp/4d72133271685e778a0126b3defd9854-p_i.jpg",
1795
- href: "",
1796
- price: "$282,000",
1797
- beds: "2",
1798
- baths: "2",
1799
- sqft: "1,224",
1800
- city: "Egg Harbor"
1801
- }
1802
- },
1803
- {
1804
- type: "property-card-triple-item",
1805
- tagName: "mj-propertytripleitem",
1806
- data: { value: {} },
1807
- attributes: {
1808
- "image-src": "https://photos.zillowstatic.com/fp/26e69f22548989c0e4d1ec372ce178e0-p_i.jpg",
1809
- href: "",
1810
- price: "$484,900",
1811
- beds: "3",
1812
- baths: "1",
1813
- sqft: "1,417",
1814
- city: "Egg Harbor"
1815
- }
1816
- }
1817
- ]
1818
- }
1819
- ]
1820
- }
1821
- ]
1822
- },
1823
1649
  {
1824
1650
  type: "section",
1825
1651
  tagName: "mj-section",
@@ -1906,6 +1732,8 @@ var useEditorStore = create()(
1906
1732
  // User data
1907
1733
  images: [],
1908
1734
  userData: null,
1735
+ // Render sync
1736
+ renderSyncNeeded: 0,
1909
1737
  // Initialize store with external template (for npm package usage)
1910
1738
  initializeWithTemplate: (templateId, template, onSave, onToast, data, onExit) => {
1911
1739
  set((state) => {
@@ -2182,6 +2010,7 @@ var useEditorStore = create()(
2182
2010
  return;
2183
2011
  }
2184
2012
  Object.assign(element, updates);
2013
+ state2.renderSyncNeeded += 1;
2185
2014
  });
2186
2015
  },
2187
2016
  // Update element content (for contenteditable)
@@ -3204,6 +3033,7 @@ function getEditorStyles(isDragButtonHovered, textEditingIdx) {
3204
3033
  if (cached) return cached;
3205
3034
  const hiddenSelectors = !isDragButtonHovered && HIDDEN_SELECTION_VISUAL_ELEMENTS.length > 0 ? HIDDEN_SELECTION_VISUAL_ELEMENTS.map((type) => `.node-type-${type}`).join(", ") : null;
3206
3035
  const css = `
3036
+
3207
3037
  /* Base reset for email content */
3208
3038
  * {
3209
3039
  box-sizing: border-box;
@@ -14474,6 +14304,8 @@ function Editor({ setEditorLoading }) {
14474
14304
  const dataTransfer = useEditorStore((state) => state.dataTransfer);
14475
14305
  const textEditing = useEditorStore((state) => state.textEditing);
14476
14306
  const isScaling = useEditorStore((state) => state.isScaling);
14307
+ const canvasBackgroundColor = useEditorStore((s) => s.template?.content?.[0]?.attributes?.["background-color"]) || "#f5f5f5";
14308
+ const renderSyncNeeded = useEditorStore((state) => state.renderSyncNeeded);
14477
14309
  const setFocusIdx = useEditorStore((state) => state.setFocusIdx);
14478
14310
  const setHoverIdx = useEditorStore((state) => state.setHoverIdx);
14479
14311
  const updateElementContent = useEditorStore((state) => state.updateElementContent);
@@ -14512,12 +14344,17 @@ function Editor({ setEditorLoading }) {
14512
14344
  const companyFooterCacheRef = useRef11(void 0);
14513
14345
  const lastSyncedTemplateRef = useRef11(null);
14514
14346
  const prevTextEditingIdxRef = useRef11(null);
14347
+ const lastRenderSyncNeededRef = useRef11(0);
14515
14348
  useEffect20(() => {
14516
14349
  const currentIdx = textEditing?.idx ?? null;
14517
14350
  const prevIdx = prevTextEditingIdxRef.current;
14518
14351
  const switchedTarget = currentIdx !== null && prevIdx !== null && currentIdx !== prevIdx;
14519
14352
  prevTextEditingIdxRef.current = currentIdx;
14520
- if (!isEditing && (!textEditing || switchedTarget)) {
14353
+ const forceSync = renderSyncNeeded > lastRenderSyncNeededRef.current;
14354
+ if (forceSync) {
14355
+ lastRenderSyncNeededRef.current = renderSyncNeeded;
14356
+ }
14357
+ if (forceSync || !isEditing && (!textEditing || switchedTarget)) {
14521
14358
  if (template === lastSyncedTemplateRef.current) {
14522
14359
  return;
14523
14360
  }
@@ -14526,7 +14363,7 @@ function Editor({ setEditorLoading }) {
14526
14363
  }
14527
14364
  lastSyncedTemplateRef.current = template;
14528
14365
  }
14529
- }, [template, renderData, isEditing, textEditing]);
14366
+ }, [template, renderData, isEditing, textEditing, renderSyncNeeded]);
14530
14367
  useEffect20(() => {
14531
14368
  if (renderData && setEditorLoading) {
14532
14369
  setEditorLoading(false);
@@ -15326,43 +15163,45 @@ function Editor({ setEditorLoading }) {
15326
15163
  justifyContent: "center"
15327
15164
  },
15328
15165
  children: [
15329
- /* @__PURE__ */ jsx50(
15166
+ /* @__PURE__ */ jsxs31(
15330
15167
  "div",
15331
15168
  {
15332
- className: `editor-container rounded-b-[12px] border-t-1 border-t-accent max-w-[626px]`,
15169
+ className: `editor-container rounded-b-[12px] max-w-[626px] w-[626px] [@media(max-width:950px)]:max-w-[100%] [@media(max-width:950px)]:w-[100%] `,
15333
15170
  style: {
15334
- width: "626px",
15335
15171
  height: "100%",
15336
- backgroundColor: "#f5f5f5",
15172
+ backgroundColor: canvasBackgroundColor,
15337
15173
  overflow: "auto"
15338
15174
  },
15339
- children: /* @__PURE__ */ jsx50(
15340
- ShadowDomRenderer,
15341
- {
15342
- html,
15343
- focusIdx,
15344
- hoverIdx,
15345
- dropIndicator,
15346
- dropTargetIdx,
15347
- isDragging,
15348
- isDragButtonHovered,
15349
- textEditingIdx: textEditing?.idx || null,
15350
- showCompanyFooter,
15351
- onElementClick: handleElementClick,
15352
- onElementHover: handleElementHover,
15353
- onContentInput: handleContentInput,
15354
- onEditingStart: handleEditingStart,
15355
- onEditingEnd: handleEditingEnd,
15356
- onDragOver: handleDragOver,
15357
- onDrop: handleDrop,
15358
- onDragLeave: handleDragLeave,
15359
- onSelectionRectChange: handleSelectionRectChange,
15360
- onShadowRootRef: handleShadowRootRef,
15361
- onSlashCommand: handleSlashCommand,
15362
- onSlashCommandClose: handleSlashCommandClose,
15363
- onTextEditStart: handleTextEditStart
15364
- }
15365
- )
15175
+ children: [
15176
+ /* @__PURE__ */ jsx50("div", { className: "w-full h-[4px] bg-black opacity-10" }),
15177
+ /* @__PURE__ */ jsx50(
15178
+ ShadowDomRenderer,
15179
+ {
15180
+ html,
15181
+ focusIdx,
15182
+ hoverIdx,
15183
+ dropIndicator,
15184
+ dropTargetIdx,
15185
+ isDragging,
15186
+ isDragButtonHovered,
15187
+ textEditingIdx: textEditing?.idx || null,
15188
+ showCompanyFooter,
15189
+ onElementClick: handleElementClick,
15190
+ onElementHover: handleElementHover,
15191
+ onContentInput: handleContentInput,
15192
+ onEditingStart: handleEditingStart,
15193
+ onEditingEnd: handleEditingEnd,
15194
+ onDragOver: handleDragOver,
15195
+ onDrop: handleDrop,
15196
+ onDragLeave: handleDragLeave,
15197
+ onSelectionRectChange: handleSelectionRectChange,
15198
+ onShadowRootRef: handleShadowRootRef,
15199
+ onSlashCommand: handleSlashCommand,
15200
+ onSlashCommandClose: handleSlashCommandClose,
15201
+ onTextEditStart: handleTextEditStart
15202
+ }
15203
+ )
15204
+ ]
15366
15205
  }
15367
15206
  ),
15368
15207
  /* @__PURE__ */ jsx50(ElementsSuggestions, {}),
@@ -5,7 +5,7 @@ import {
5
5
  MAILLOW_EMAIL_EDITOR_VERSION,
6
6
  Preview,
7
7
  useEditorStore
8
- } from "./chunk-QGWWLZOW.mjs";
8
+ } from "./chunk-XSQHR5MC.mjs";
9
9
  export {
10
10
  Editor,
11
11
  History,