@jbpark/live-editor 4.0.1 → 4.1.0

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/dnd/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as Panel, c as useChildrenEditor, d as useDndPanel, f as DraggableItem, i as Palette, l as useDndLayout, n as Canvas, o as Field, r as Layout, s as useItemsEditor, t as Dnd, u as useDndPalette } from "../dnd-_0jfnnVB.js";
1
+ import { a as Panel, c as useChildrenEditor, d as useDndPanel, f as DraggableItem, i as Palette, l as useDndLayout, n as Canvas, o as Field, r as Layout, s as useItemsEditor, t as Dnd, u as useDndPalette } from "../dnd-D_rG92-R.js";
2
2
  export { Canvas, DraggableItem, Field, Layout, Palette, Panel, Dnd as default, useChildrenEditor, useDndLayout, useDndPalette, useDndPanel, useItemsEditor };
@@ -2,7 +2,7 @@ import { D as fillSectionIds, E as createSectionPreviewCache, I as nanoid, K as
2
2
  import { c as generateSection, d as preloadScripts, i as cn, p as replaceSections, s as extractSections } from "./utils-BQ7WL7Jh.js";
3
3
  import { i as usePreview } from "./states-Ci1AvoQ9.js";
4
4
  import { _ as moveSelectedIndices, c as appendArrayItem, d as moveArrayItems, g as canStructurallyEditArray, h as updateArrayItemValue, i as replaceIds, l as duplicateArrayItems, m as updateArrayItemProperty, o as update, p as removeArrayItems, r as fillIds, s as getChildrenSignatures, t as validateBindingValue, u as moveArrayItem } from "./ast-CZwpVrJv.js";
5
- import { i as Frame, n as useCompiledModule, t as useDynamicTailwind } from "./use-dynamic-tailwind-BF8TQ3Yy.js";
5
+ import { i as Frame, n as useCompiledModule, t as useDynamicTailwind } from "./use-dynamic-tailwind-SOgrb2qc.js";
6
6
  import { t as Core } from "./core-Co8Nlq16.js";
7
7
  import { n as Error$1, t as ErrorBoundary } from "./boundary-C90q3YsT.js";
8
8
  import { Children, createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
@@ -1472,7 +1472,24 @@ const Renderer = ({ preview, sectionId = "", sectionName = "", sectionCode = pre
1472
1472
  })
1473
1473
  });
1474
1474
  };
1475
- var renderer_default = memo(Renderer);
1475
+ const sameValue = (a, b) => {
1476
+ if (Object.is(a, b)) return true;
1477
+ if (Array.isArray(a) && Array.isArray(b)) return a.length === b.length && a.every((item, i) => Object.is(item, b[i]));
1478
+ if (a && b && typeof a === "object" && typeof b === "object" && Object.getPrototypeOf(a) === Object.prototype && Object.getPrototypeOf(b) === Object.prototype) {
1479
+ const aKeys = Object.keys(a);
1480
+ return aKeys.length === Object.keys(b).length && aKeys.every((key) => Object.is(a[key], b[key]));
1481
+ }
1482
+ return false;
1483
+ };
1484
+ const sameFrame = (a, b) => {
1485
+ if (a === b) return true;
1486
+ if (!a || !b) return false;
1487
+ return [.../* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])].every((key) => sameValue(a[key], b[key]));
1488
+ };
1489
+ const arePropsEqual = (prev, next) => {
1490
+ return [.../* @__PURE__ */ new Set([...Object.keys(prev), ...Object.keys(next)])].every((key) => key === "frame" ? sameFrame(prev.frame, next.frame) : Object.is(prev[key], next[key]));
1491
+ };
1492
+ var renderer_default = memo(Renderer, arePropsEqual);
1476
1493
  //#endregion
1477
1494
  //#region src/components/dnd/sortable.tsx
1478
1495
  const Sortable = ({ id, children, selected, onClick, onDelete: _onDelete, onCopy: _onCopy }) => {
@@ -1669,7 +1686,8 @@ const conditionalModifiers = (args) => {
1669
1686
  if (active?.data.current?.type === "new-item") return args.transform;
1670
1687
  return restrictToVerticalAxis(args);
1671
1688
  };
1672
- const Dnd$1 = ({ value: _value, props, modules = {}, onChange: _onChange, className, items = [], frame, dynamicTailwind = false, provider, renderField, onEditError, renderSectionFallback, shouldForceSectionFallback, children, ...restProps }) => {
1689
+ const NO_MODULES = {};
1690
+ const Dnd$1 = ({ value: _value, props, modules = NO_MODULES, onChange: _onChange, className, items = [], frame, dynamicTailwind = false, provider, renderField, onEditError, renderSectionFallback, shouldForceSectionFallback, children, ...restProps }) => {
1673
1691
  const [mobilePaletteOpen, setMobilePaletteOpen] = useState(false);
1674
1692
  const { breakpoint } = useResponsiveSize();
1675
1693
  const isMobile = breakpoint.current === "xs" || breakpoint.current === "sm";
@@ -1872,4 +1890,4 @@ Dnd.Layout = Layout;
1872
1890
  //#endregion
1873
1891
  export { Panel as a, useChildrenEditor as c, useDndPanel as d, DraggableItem as f, Palette as i, useDndLayout as l, Canvas as n, Field as o, Layout as r, useItemsEditor as s, Dnd as t, useDndPalette as u };
1874
1892
 
1875
- //# sourceMappingURL=dnd-_0jfnnVB.js.map
1893
+ //# sourceMappingURL=dnd-D_rG92-R.js.map