labellife-design-tool 1.3.4 → 1.3.6

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.
@@ -2868,14 +2868,21 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2868
2868
  config.panels.forEach((panelConfig) => {
2869
2869
  if (typeof panelConfig === "string") {} else {
2870
2870
  console.log("Processing custom panel:", panelConfig.id, panelConfig);
2871
- if (typeof panelConfig.component !== "function") {
2871
+ let component = panelConfig.component;
2872
+ if (component && typeof component === "object" && component !== null) {
2873
+ const reactMemoSymbol = Symbol.for("react.memo");
2874
+ if (component.$$typeof === reactMemoSymbol) {
2875
+ component = component.type;
2876
+ }
2877
+ }
2878
+ if (!component || typeof component !== "function") {
2872
2879
  console.error("Invalid panel component for", panelConfig.id, panelConfig.component);
2873
2880
  return;
2874
2881
  }
2875
2882
  const customPanelConfig = {
2876
2883
  id: panelConfig.id,
2877
2884
  title: panelConfig.title,
2878
- component: panelConfig.component,
2885
+ component,
2879
2886
  props: panelConfig.props || {},
2880
2887
  ...panelConfig.icon && typeof panelConfig.icon.type === "string" ? {
2881
2888
  icon: panelConfig.icon.type
@@ -2893,14 +2900,17 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2893
2900
  orderedConfigs.push(mergedConfigs[panelConfig]);
2894
2901
  }
2895
2902
  } else {
2896
- orderedConfigs.push(mergedConfigs[panelConfig.id]);
2903
+ const config2 = mergedConfigs[panelConfig.id];
2904
+ if (config2) {
2905
+ orderedConfigs.push(config2);
2906
+ }
2897
2907
  }
2898
2908
  });
2899
2909
  }
2900
- return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs);
2910
+ return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs).filter(Boolean);
2901
2911
  }, [addShape, addText, config, selectedElement, updateElement, store, currentPage, handleExportPNG, handleExportJPG, handleExportJSON, handleImportJSON]);
2902
2912
  const DynamicPanelRenderer = useMemo(() => {
2903
- const activePanelId = store.activePanelId;
2913
+ const activePanelId = store.activePanelId || "elements";
2904
2914
  console.log("DynamicPanelRenderer: activePanelId =", activePanelId);
2905
2915
  console.log("DynamicPanelRenderer: available panels =", panelConfigs.map((p) => ({ id: p.id, component: typeof p.component })));
2906
2916
  const activePanel = panelConfigs.find((panel) => panel.id === activePanelId);
@@ -2868,14 +2868,21 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2868
2868
  config.panels.forEach((panelConfig) => {
2869
2869
  if (typeof panelConfig === "string") {} else {
2870
2870
  console.log("Processing custom panel:", panelConfig.id, panelConfig);
2871
- if (typeof panelConfig.component !== "function") {
2871
+ let component = panelConfig.component;
2872
+ if (component && typeof component === "object" && component !== null) {
2873
+ const reactMemoSymbol = Symbol.for("react.memo");
2874
+ if (component.$$typeof === reactMemoSymbol) {
2875
+ component = component.type;
2876
+ }
2877
+ }
2878
+ if (!component || typeof component !== "function") {
2872
2879
  console.error("Invalid panel component for", panelConfig.id, panelConfig.component);
2873
2880
  return;
2874
2881
  }
2875
2882
  const customPanelConfig = {
2876
2883
  id: panelConfig.id,
2877
2884
  title: panelConfig.title,
2878
- component: panelConfig.component,
2885
+ component,
2879
2886
  props: panelConfig.props || {},
2880
2887
  ...panelConfig.icon && typeof panelConfig.icon.type === "string" ? {
2881
2888
  icon: panelConfig.icon.type
@@ -2893,14 +2900,17 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2893
2900
  orderedConfigs.push(mergedConfigs[panelConfig]);
2894
2901
  }
2895
2902
  } else {
2896
- orderedConfigs.push(mergedConfigs[panelConfig.id]);
2903
+ const config2 = mergedConfigs[panelConfig.id];
2904
+ if (config2) {
2905
+ orderedConfigs.push(config2);
2906
+ }
2897
2907
  }
2898
2908
  });
2899
2909
  }
2900
- return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs);
2910
+ return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs).filter(Boolean);
2901
2911
  }, [addShape, addText, config, selectedElement, updateElement, store, currentPage, handleExportPNG, handleExportJPG, handleExportJSON, handleImportJSON]);
2902
2912
  const DynamicPanelRenderer = useMemo(() => {
2903
- const activePanelId = store.activePanelId;
2913
+ const activePanelId = store.activePanelId || "elements";
2904
2914
  console.log("DynamicPanelRenderer: activePanelId =", activePanelId);
2905
2915
  console.log("DynamicPanelRenderer: available panels =", panelConfigs.map((p) => ({ id: p.id, component: typeof p.component })));
2906
2916
  const activePanel = panelConfigs.find((panel) => panel.id === activePanelId);
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasEditor.d.ts","sourceRoot":"","sources":["../../src/CanvasEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmF,MAAM,OAAO,CAAC;AA4ExG,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAqB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,QAAA,MAAM,YAAY;UAAuC,MAAM;aAAW,MAAM;WAAS,iBAAiB;yCAwhBxG,CAAC;AAIH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"CanvasEditor.d.ts","sourceRoot":"","sources":["../../src/CanvasEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmF,MAAM,OAAO,CAAC;AA4ExG,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAqB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,QAAA,MAAM,YAAY;UAAuC,MAAM;aAAW,MAAM;WAAS,iBAAiB;yCAoiBxG,CAAC;AAIH,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labellife-design-tool",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Professional canvas editor built with React, TypeScript, and Konva",
5
5
  "main": "./dist/lib/lib/index.js",
6
6
  "module": "./dist/lib/lib/index.js",