labellife-design-tool 1.3.3 → 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.
@@ -2721,6 +2721,12 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2721
2721
  console.error("CanvasEditor: store prop is required but was not provided");
2722
2722
  return /* @__PURE__ */ React17.createElement("div", null, "Error: Store is required");
2723
2723
  }
2724
+ console.log("CanvasEditor store state:", {
2725
+ activePanelId: store.activePanelId,
2726
+ hasDesign: !!store.design,
2727
+ designPages: store.design?.pages?.length || 0,
2728
+ activePageId: store.activePageId
2729
+ });
2724
2730
  const stageRef = useRef4(null);
2725
2731
  const fileInputRef = useRef4(null);
2726
2732
  const jsonInputRef = useRef4(null);
@@ -2852,14 +2858,31 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2852
2858
  variables: { id: "variables", title: "Variables", component: VariablesPanel_default, props: { config: config || {}, design: store.design, setDesign: (design) => store.setDesign(design) } },
2853
2859
  export: { id: "export", title: "Export", component: ExportPanel_default, props: { onExportToPNG: handleExportPNG, onExportToJPG: handleExportJPG, onExportToJSON: handleExportJSON, onImportJSON: handleImportJSON } }
2854
2860
  };
2861
+ console.log("Built-in panels:", Object.entries(builtInConfigs).map(([id, config2]) => ({
2862
+ id,
2863
+ componentType: typeof config2.component,
2864
+ componentName: config2.component.name || "anonymous"
2865
+ })));
2855
2866
  const mergedConfigs = { ...builtInConfigs };
2856
2867
  if (config?.panels) {
2857
2868
  config.panels.forEach((panelConfig) => {
2858
2869
  if (typeof panelConfig === "string") {} else {
2870
+ console.log("Processing custom panel:", panelConfig.id, panelConfig);
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") {
2879
+ console.error("Invalid panel component for", panelConfig.id, panelConfig.component);
2880
+ return;
2881
+ }
2859
2882
  const customPanelConfig = {
2860
2883
  id: panelConfig.id,
2861
2884
  title: panelConfig.title,
2862
- component: panelConfig.component,
2885
+ component,
2863
2886
  props: panelConfig.props || {},
2864
2887
  ...panelConfig.icon && typeof panelConfig.icon.type === "string" ? {
2865
2888
  icon: panelConfig.icon.type
@@ -2877,23 +2900,41 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2877
2900
  orderedConfigs.push(mergedConfigs[panelConfig]);
2878
2901
  }
2879
2902
  } else {
2880
- orderedConfigs.push(mergedConfigs[panelConfig.id]);
2903
+ const config2 = mergedConfigs[panelConfig.id];
2904
+ if (config2) {
2905
+ orderedConfigs.push(config2);
2906
+ }
2881
2907
  }
2882
2908
  });
2883
2909
  }
2884
- return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs);
2910
+ return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs).filter(Boolean);
2885
2911
  }, [addShape, addText, config, selectedElement, updateElement, store, currentPage, handleExportPNG, handleExportJPG, handleExportJSON, handleImportJSON]);
2886
2912
  const DynamicPanelRenderer = useMemo(() => {
2887
- const activePanel = panelConfigs.find((panel) => panel.id === store.activePanelId);
2888
- if (!activePanel)
2913
+ const activePanelId = store.activePanelId || "elements";
2914
+ console.log("DynamicPanelRenderer: activePanelId =", activePanelId);
2915
+ console.log("DynamicPanelRenderer: available panels =", panelConfigs.map((p) => ({ id: p.id, component: typeof p.component })));
2916
+ const activePanel = panelConfigs.find((panel) => panel.id === activePanelId);
2917
+ if (!activePanel) {
2918
+ console.log("DynamicPanelRenderer: No active panel found, returning fallback");
2889
2919
  return /* @__PURE__ */ React17.createElement("div", {
2890
2920
  className: "text-gray-400 text-center p-4"
2891
2921
  }, "No panel selected");
2922
+ }
2923
+ console.log("DynamicPanelRenderer: Found active panel:", activePanel.id, typeof activePanel.component);
2892
2924
  const PanelComponent = activePanel.component;
2893
- if (!PanelComponent)
2925
+ if (!PanelComponent) {
2926
+ console.log("DynamicPanelRenderer: PanelComponent is null/undefined");
2894
2927
  return /* @__PURE__ */ React17.createElement("div", {
2895
2928
  className: "text-red-400 text-center p-4"
2896
2929
  }, "Panel component not found");
2930
+ }
2931
+ if (typeof PanelComponent !== "function") {
2932
+ console.error("DynamicPanelRenderer: PanelComponent is not a function:", PanelComponent);
2933
+ return /* @__PURE__ */ React17.createElement("div", {
2934
+ className: "text-red-400 text-center p-4"
2935
+ }, "Invalid panel component");
2936
+ }
2937
+ console.log("DynamicPanelRenderer: Rendering panel:", activePanel.id);
2897
2938
  return /* @__PURE__ */ React17.createElement(PanelComponent, {
2898
2939
  key: activePanel.id,
2899
2940
  ...activePanel.props
@@ -2721,6 +2721,12 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2721
2721
  console.error("CanvasEditor: store prop is required but was not provided");
2722
2722
  return /* @__PURE__ */ React17.createElement("div", null, "Error: Store is required");
2723
2723
  }
2724
+ console.log("CanvasEditor store state:", {
2725
+ activePanelId: store.activePanelId,
2726
+ hasDesign: !!store.design,
2727
+ designPages: store.design?.pages?.length || 0,
2728
+ activePageId: store.activePageId
2729
+ });
2724
2730
  const stageRef = useRef4(null);
2725
2731
  const fileInputRef = useRef4(null);
2726
2732
  const jsonInputRef = useRef4(null);
@@ -2852,14 +2858,31 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2852
2858
  variables: { id: "variables", title: "Variables", component: VariablesPanel_default, props: { config: config || {}, design: store.design, setDesign: (design) => store.setDesign(design) } },
2853
2859
  export: { id: "export", title: "Export", component: ExportPanel_default, props: { onExportToPNG: handleExportPNG, onExportToJPG: handleExportJPG, onExportToJSON: handleExportJSON, onImportJSON: handleImportJSON } }
2854
2860
  };
2861
+ console.log("Built-in panels:", Object.entries(builtInConfigs).map(([id, config2]) => ({
2862
+ id,
2863
+ componentType: typeof config2.component,
2864
+ componentName: config2.component.name || "anonymous"
2865
+ })));
2855
2866
  const mergedConfigs = { ...builtInConfigs };
2856
2867
  if (config?.panels) {
2857
2868
  config.panels.forEach((panelConfig) => {
2858
2869
  if (typeof panelConfig === "string") {} else {
2870
+ console.log("Processing custom panel:", panelConfig.id, panelConfig);
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") {
2879
+ console.error("Invalid panel component for", panelConfig.id, panelConfig.component);
2880
+ return;
2881
+ }
2859
2882
  const customPanelConfig = {
2860
2883
  id: panelConfig.id,
2861
2884
  title: panelConfig.title,
2862
- component: panelConfig.component,
2885
+ component,
2863
2886
  props: panelConfig.props || {},
2864
2887
  ...panelConfig.icon && typeof panelConfig.icon.type === "string" ? {
2865
2888
  icon: panelConfig.icon.type
@@ -2877,23 +2900,41 @@ var CanvasEditor = forwardRef(({ name, config, store }, ref) => {
2877
2900
  orderedConfigs.push(mergedConfigs[panelConfig]);
2878
2901
  }
2879
2902
  } else {
2880
- orderedConfigs.push(mergedConfigs[panelConfig.id]);
2903
+ const config2 = mergedConfigs[panelConfig.id];
2904
+ if (config2) {
2905
+ orderedConfigs.push(config2);
2906
+ }
2881
2907
  }
2882
2908
  });
2883
2909
  }
2884
- return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs);
2910
+ return orderedConfigs.length > 0 ? orderedConfigs : Object.values(builtInConfigs).filter(Boolean);
2885
2911
  }, [addShape, addText, config, selectedElement, updateElement, store, currentPage, handleExportPNG, handleExportJPG, handleExportJSON, handleImportJSON]);
2886
2912
  const DynamicPanelRenderer = useMemo(() => {
2887
- const activePanel = panelConfigs.find((panel) => panel.id === store.activePanelId);
2888
- if (!activePanel)
2913
+ const activePanelId = store.activePanelId || "elements";
2914
+ console.log("DynamicPanelRenderer: activePanelId =", activePanelId);
2915
+ console.log("DynamicPanelRenderer: available panels =", panelConfigs.map((p) => ({ id: p.id, component: typeof p.component })));
2916
+ const activePanel = panelConfigs.find((panel) => panel.id === activePanelId);
2917
+ if (!activePanel) {
2918
+ console.log("DynamicPanelRenderer: No active panel found, returning fallback");
2889
2919
  return /* @__PURE__ */ React17.createElement("div", {
2890
2920
  className: "text-gray-400 text-center p-4"
2891
2921
  }, "No panel selected");
2922
+ }
2923
+ console.log("DynamicPanelRenderer: Found active panel:", activePanel.id, typeof activePanel.component);
2892
2924
  const PanelComponent = activePanel.component;
2893
- if (!PanelComponent)
2925
+ if (!PanelComponent) {
2926
+ console.log("DynamicPanelRenderer: PanelComponent is null/undefined");
2894
2927
  return /* @__PURE__ */ React17.createElement("div", {
2895
2928
  className: "text-red-400 text-center p-4"
2896
2929
  }, "Panel component not found");
2930
+ }
2931
+ if (typeof PanelComponent !== "function") {
2932
+ console.error("DynamicPanelRenderer: PanelComponent is not a function:", PanelComponent);
2933
+ return /* @__PURE__ */ React17.createElement("div", {
2934
+ className: "text-red-400 text-center p-4"
2935
+ }, "Invalid panel component");
2936
+ }
2937
+ console.log("DynamicPanelRenderer: Rendering panel:", activePanel.id);
2897
2938
  return /* @__PURE__ */ React17.createElement(PanelComponent, {
2898
2939
  key: activePanel.id,
2899
2940
  ...activePanel.props
@@ -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;yCA+exG,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.3",
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",