@pitcher/canvas-ui 2025.12.4-164350-beta → 2025.12.4-170128

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/canvas-ui.js CHANGED
@@ -92229,18 +92229,19 @@ const navigateToHome = (skipSetPreviousLocation) => navigateToHome$1({
92229
92229
  const updateHomePageSettings = (homePage) => {
92230
92230
  canvasHomePage.value = homePage;
92231
92231
  };
92232
+ const mergeWithArrayReplacement = (...sources) => mergeWith({}, ...sources, (_objValue, srcValue) => {
92233
+ if (Array.isArray(srcValue)) {
92234
+ return srcValue;
92235
+ }
92236
+ return void 0;
92237
+ });
92232
92238
  const mergeIntoActiveContext = (contextUpdate) => {
92233
92239
  if (!activeCanvas.value) {
92234
92240
  console.warn("[mergeIntoActiveContext] No active canvas to update context");
92235
92241
  return;
92236
92242
  }
92237
92243
  const currentContext = activeCanvas.value.context ?? {};
92238
- const mergedContext = mergeWith({}, currentContext, contextUpdate, (_objValue, srcValue) => {
92239
- if (Array.isArray(srcValue)) {
92240
- return srcValue;
92241
- }
92242
- return void 0;
92243
- });
92244
+ const mergedContext = mergeWithArrayReplacement(currentContext, contextUpdate);
92244
92245
  activeCanvas.value = {
92245
92246
  ...activeCanvas.value,
92246
92247
  context: mergedContext
@@ -92409,7 +92410,8 @@ function useCanvas$1() {
92409
92410
  onWizardExit,
92410
92411
  contentAnnotation,
92411
92412
  getSafeContext,
92412
- watchCanvas
92413
+ watchCanvas,
92414
+ mergeWithArrayReplacement
92413
92415
  };
92414
92416
  }
92415
92417
 
@@ -167746,7 +167748,9 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
167746
167748
  setTemporaryContextKeys,
167747
167749
  getSafeContext,
167748
167750
  watchCanvas,
167749
- mergeIntoActiveContext
167751
+ mergeIntoActiveContext,
167752
+ saveCanvasContext,
167753
+ mergeWithArrayReplacement
167750
167754
  } = useCanvas$1();
167751
167755
  const { updateComponentsWithThemeAssets } = useCanvasNodes();
167752
167756
  const {
@@ -168153,6 +168157,17 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
168153
168157
  props.onEnter?.();
168154
168158
  broadcastCanvasOpenedEvent();
168155
168159
  window.retriggerWizard = retriggerWizard;
168160
+ window.getCanvasContext = () => {
168161
+ if (!activeCanvas.value) return null;
168162
+ return cloneDeep(activeCanvas.value?.context ?? {});
168163
+ };
168164
+ window.updateCanvasContext = async (context, options) => {
168165
+ if (!activeCanvas.value) {
168166
+ throw new Error("No active canvas");
168167
+ }
168168
+ const mergedContext = mergeWithArrayReplacement(activeCanvas.value?.context ?? {}, context);
168169
+ await saveCanvasContext(mergedContext, options);
168170
+ };
168156
168171
  });
168157
168172
  onBeforeUnmount(() => {
168158
168173
  const canvasId = activeCanvas.value?.id;
@@ -168182,6 +168197,8 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
168182
168197
  window.__scribblePendingRequests.clear();
168183
168198
  }
168184
168199
  window.retriggerWizard = void 0;
168200
+ window.getCanvasContext = void 0;
168201
+ window.updateCanvasContext = void 0;
168185
168202
  }
168186
168203
  __expose({
168187
168204
  deleteAsset,