labellife-design-tool 1.3.4 → 1.3.7

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.
@@ -2861,21 +2861,36 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2861
2861
  console.log("Built-in panels:", Object.entries(builtInConfigs).map(([id, config2]) => ({
2862
2862
  id,
2863
2863
  componentType: typeof config2.component,
2864
- componentName: config2.component.name || "anonymous"
2864
+ componentName: config2.component.name || "anonymous",
2865
+ componentIsFunction: typeof config2.component === "function",
2866
+ componentDetails: config2.component
2865
2867
  })));
2868
+ console.log("ElementPanel details:", {
2869
+ ElementPanel: ElementPanel_default,
2870
+ elementType: typeof ElementPanel_default,
2871
+ elementIsFunction: typeof ElementPanel_default === "function",
2872
+ elementName: ElementPanel_default.name || "anonymous"
2873
+ });
2866
2874
  const mergedConfigs = { ...builtInConfigs };
2867
2875
  if (config?.panels) {
2868
2876
  config.panels.forEach((panelConfig) => {
2869
2877
  if (typeof panelConfig === "string") {} else {
2870
2878
  console.log("Processing custom panel:", panelConfig.id, panelConfig);
2871
- if (typeof panelConfig.component !== "function") {
2879
+ let component = panelConfig.component;
2880
+ if (component && typeof component === "object" && component !== null) {
2881
+ const reactMemoSymbol = Symbol.for("react.memo");
2882
+ if (component.$$typeof === reactMemoSymbol) {
2883
+ component = component.type;
2884
+ }
2885
+ }
2886
+ if (!component || typeof component !== "function") {
2872
2887
  console.error("Invalid panel component for", panelConfig.id, panelConfig.component);
2873
2888
  return;
2874
2889
  }
2875
2890
  const customPanelConfig = {
2876
2891
  id: panelConfig.id,
2877
2892
  title: panelConfig.title,
2878
- component: panelConfig.component,
2893
+ component,
2879
2894
  props: panelConfig.props || {},
2880
2895
  ...panelConfig.icon && typeof panelConfig.icon.type === "string" ? {
2881
2896
  icon: panelConfig.icon.type
@@ -2893,14 +2908,17 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2893
2908
  orderedConfigs.push(mergedConfigs[panelConfig]);
2894
2909
  }
2895
2910
  } else {
2896
- orderedConfigs.push(mergedConfigs[panelConfig.id]);
2911
+ const config2 = mergedConfigs[panelConfig.id];
2912
+ if (config2) {
2913
+ orderedConfigs.push(config2);
2914
+ }
2897
2915
  }
2898
2916
  });
2899
2917
  }
2900
- return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs);
2918
+ return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs).filter(Boolean);
2901
2919
  }, [addShape, addText, config, selectedElement, updateElement, store, currentPage, handleExportPNG, handleExportJPG, handleExportJSON, handleImportJSON]);
2902
2920
  const DynamicPanelRenderer = useMemo(() => {
2903
- const activePanelId = store.activePanelId;
2921
+ const activePanelId = store.activePanelId || "elements";
2904
2922
  console.log("DynamicPanelRenderer: activePanelId =", activePanelId);
2905
2923
  console.log("DynamicPanelRenderer: available panels =", panelConfigs.map((p) => ({ id: p.id, component: typeof p.component })));
2906
2924
  const activePanel = panelConfigs.find((panel) => panel.id === activePanelId);
@@ -2861,21 +2861,36 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2861
2861
  console.log("Built-in panels:", Object.entries(builtInConfigs).map(([id, config2]) => ({
2862
2862
  id,
2863
2863
  componentType: typeof config2.component,
2864
- componentName: config2.component.name || "anonymous"
2864
+ componentName: config2.component.name || "anonymous",
2865
+ componentIsFunction: typeof config2.component === "function",
2866
+ componentDetails: config2.component
2865
2867
  })));
2868
+ console.log("ElementPanel details:", {
2869
+ ElementPanel: ElementPanel_default,
2870
+ elementType: typeof ElementPanel_default,
2871
+ elementIsFunction: typeof ElementPanel_default === "function",
2872
+ elementName: ElementPanel_default.name || "anonymous"
2873
+ });
2866
2874
  const mergedConfigs = { ...builtInConfigs };
2867
2875
  if (config?.panels) {
2868
2876
  config.panels.forEach((panelConfig) => {
2869
2877
  if (typeof panelConfig === "string") {} else {
2870
2878
  console.log("Processing custom panel:", panelConfig.id, panelConfig);
2871
- if (typeof panelConfig.component !== "function") {
2879
+ let component = panelConfig.component;
2880
+ if (component && typeof component === "object" && component !== null) {
2881
+ const reactMemoSymbol = Symbol.for("react.memo");
2882
+ if (component.$$typeof === reactMemoSymbol) {
2883
+ component = component.type;
2884
+ }
2885
+ }
2886
+ if (!component || typeof component !== "function") {
2872
2887
  console.error("Invalid panel component for", panelConfig.id, panelConfig.component);
2873
2888
  return;
2874
2889
  }
2875
2890
  const customPanelConfig = {
2876
2891
  id: panelConfig.id,
2877
2892
  title: panelConfig.title,
2878
- component: panelConfig.component,
2893
+ component,
2879
2894
  props: panelConfig.props || {},
2880
2895
  ...panelConfig.icon && typeof panelConfig.icon.type === "string" ? {
2881
2896
  icon: panelConfig.icon.type
@@ -2893,14 +2908,17 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2893
2908
  orderedConfigs.push(mergedConfigs[panelConfig]);
2894
2909
  }
2895
2910
  } else {
2896
- orderedConfigs.push(mergedConfigs[panelConfig.id]);
2911
+ const config2 = mergedConfigs[panelConfig.id];
2912
+ if (config2) {
2913
+ orderedConfigs.push(config2);
2914
+ }
2897
2915
  }
2898
2916
  });
2899
2917
  }
2900
- return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs);
2918
+ return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs).filter(Boolean);
2901
2919
  }, [addShape, addText, config, selectedElement, updateElement, store, currentPage, handleExportPNG, handleExportJPG, handleExportJSON, handleImportJSON]);
2902
2920
  const DynamicPanelRenderer = useMemo(() => {
2903
- const activePanelId = store.activePanelId;
2921
+ const activePanelId = store.activePanelId || "elements";
2904
2922
  console.log("DynamicPanelRenderer: activePanelId =", activePanelId);
2905
2923
  console.log("DynamicPanelRenderer: available panels =", panelConfigs.map((p) => ({ id: p.id, component: typeof p.component })));
2906
2924
  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;yCA8iBxG,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.7",
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",