@uniformdev/mesh-sdk 19.35.3-alpha.82 → 19.36.1-alpha.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/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ApiClient, ClientOptions, ExceptProject } from '@uniformdev/context/api';
2
- import { DataSource, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataType, DataVariableDefinition, DataResourceVariables } from '@uniformdev/canvas';
2
+ import { DataSource, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataType as DataType$1, DataResourceVariables } from '@uniformdev/canvas';
3
3
  import { ProjectMapNode } from '@uniformdev/project-map';
4
+ import { DataType } from '@uniformdev/canvas/.';
4
5
  import { Emitter } from 'mitt';
5
6
 
6
7
  /**
@@ -645,28 +646,10 @@ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfig
645
646
  settings: TIntegrationConfiguration;
646
647
  /** The Uniform project ID */
647
648
  projectId: string;
648
- /**
649
- * Current dynamic inputs that are configured on the composition (if any).
650
- * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
651
- */
649
+ /** Current dynamic inputs that are configured on the composition (if any). */
652
650
  dynamicInputs: DynamicInputs;
653
- /**
654
- * The connected data for the current component. Connected data is provided as a map
655
- * of the binding expression text to the value of that binding expression. For example,
656
- * if the value is "Hello ${#jptr:/MyData/fields/name}" then this value would be:
657
- * { "#jptr:/MyData/fields/name": "value-of-connected-data" }
658
- *
659
- * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
660
- */
661
- connectedData: Record<string, unknown>;
662
- };
663
- type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'> & {
664
- /**
665
- * Opens a dialog on the Uniform platform to edit or select a data element to connect to.
666
- * Returns the result of the dialog. Useful to build data-enabled parameter types.
667
- */
668
- editConnectedData: Awaited<ReturnType<typeof connectToParent>>['parent']['editConnectedData'];
669
651
  };
652
+ type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'>;
670
653
 
671
654
  type SettingsLocationMetadata = {
672
655
  projectId: string;
@@ -704,7 +687,7 @@ interface DialogResponseData {
704
687
  dialogId: string;
705
688
  error?: string;
706
689
  }
707
- type DialogType = 'location' | 'confirm' | 'currentLocation';
690
+ type DialogType = 'location' | 'confirm';
708
691
  type OpenDialogResult = {
709
692
  /** Unique ID of this dialog which can be used to close it */
710
693
  dialogId: string;
@@ -771,25 +754,6 @@ type CloseDialogMessage = {
771
754
  dialogData?: unknown;
772
755
  };
773
756
  type GetDataResourceMessage = Pick<DataType, 'path' | 'headers' | 'parameters' | 'body' | 'method'>;
774
- /** Primitive data types that a parameter type accepts to be bound to composition data */
775
- type BindableTypes = 'string' | 'number' | 'boolean' | 'object' | 'array';
776
- /** Message to parent to create a data connection expression to insert in a param type */
777
- type EditConnectedDataMessage = {
778
- /** Bind expression for existing connected data */
779
- existingConnectedData?: string;
780
- allowedTypes: BindableTypes[];
781
- };
782
- /** Response from parent when creating a data connection expression */
783
- type EditConnectedDataResponse = {
784
- canceled: false;
785
- /** Bind expression for selected data connection */
786
- connectedData: DataVariableDefinition & {
787
- name: string;
788
- };
789
- } | {
790
- /** User cancelled selecting data element */
791
- canceled: true;
792
- };
793
757
 
794
758
  type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
795
759
  initialize: () => Promise<MeshContextData>;
@@ -811,7 +775,6 @@ declare function connectToParent({ dialogResponseHandlers, onMetadataUpdated, }:
811
775
  openDialog: (message: OpenDialogMessage) => Promise<Pick<DialogResponseData, "value" | "dialogId"> | undefined>;
812
776
  closeDialog: (message: CloseDialogMessage) => Promise<void>;
813
777
  getDataResource: <TExpectedResult>(message: GetDataResourceMessage) => Promise<TExpectedResult>;
814
- editConnectedData: (message: EditConnectedDataMessage) => Promise<EditConnectedDataResponse>;
815
778
  };
816
779
  }>;
817
780
 
@@ -860,7 +823,6 @@ type SetValueOptions = ValidationResult;
860
823
  type SetValueMessage = {
861
824
  uniformMeshLocationValue: unknown;
862
825
  options?: SetValueOptions;
863
- closeDialog?: boolean;
864
826
  };
865
827
  type GetDataResourceLocation = {
866
828
  getDataResource: Awaited<ReturnType<typeof connectToParent>>['parent']['getDataResource'];
@@ -881,7 +843,7 @@ type DynamicInput = {
881
843
  /** Record of dynamic inputs keyed by the input name */
882
844
  type DynamicInputs = Record<string, DynamicInput>;
883
845
 
884
- type DataTypeLocationValue = Pick<DataType, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
846
+ type DataTypeLocationValue = Pick<DataType$1, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
885
847
  type DataConnectorInfo = {
886
848
  type: string;
887
849
  displayName: string;
@@ -906,7 +868,7 @@ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
906
868
  /** Settings defined at the integration level (arbitrary type used on settings location) */
907
869
  settings: TIntegrationConfiguration;
908
870
  /** The current data resource's data type */
909
- dataType: DataType;
871
+ dataType: DataType$1;
910
872
  /** The data type's archetype value. */
911
873
  archetype: string;
912
874
  /**
@@ -1028,4 +990,4 @@ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
1028
990
  autoResizingDisabled?: boolean;
1029
991
  }): Promise<UniformMeshSDK | undefined>;
1030
992
 
1031
- export { BindableTypes, CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, EditConnectedDataMessage, EditConnectedDataResponse, GetDataResourceLocation, GetDataResourceMessage, IntegrationDefinitionClient, IntegrationDefinitionDeleteParameters, IntegrationDefinitionGetParameters, IntegrationDefinitionGetResponse, IntegrationDefinitionPutParameters, IntegrationDefinitionPutResponse, IntegrationInstallationClient, IntegrationInstallationDeleteParameters, IntegrationInstallationGetParameters, IntegrationInstallationGetResponse, IntegrationInstallationPutParameters, LocationDialogResponse, MeshContextData, MeshLocation, MeshLocationCore, MeshLocationTypes, MeshSDKEventInterface, OpenConfirmationDialogOptions, OpenConfirmationDialogResult, OpenDialogMessage, OpenDialogResult, OpenLocationDialogOptions, ParamTypeConfigLocation, ParamTypeConfigLocationMetadata, ParamTypeLocation, ParamTypeLocationMetadata, SdkWindow, SetLocationFunction, SetValueMessage, SetValueOptions, SettingsLocation, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
993
+ export { CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, GetDataResourceLocation, GetDataResourceMessage, IntegrationDefinitionClient, IntegrationDefinitionDeleteParameters, IntegrationDefinitionGetParameters, IntegrationDefinitionGetResponse, IntegrationDefinitionPutParameters, IntegrationDefinitionPutResponse, IntegrationInstallationClient, IntegrationInstallationDeleteParameters, IntegrationInstallationGetParameters, IntegrationInstallationGetResponse, IntegrationInstallationPutParameters, LocationDialogResponse, MeshContextData, MeshLocation, MeshLocationCore, MeshLocationTypes, MeshSDKEventInterface, OpenConfirmationDialogOptions, OpenConfirmationDialogResult, OpenDialogMessage, OpenDialogResult, OpenLocationDialogOptions, ParamTypeConfigLocation, ParamTypeConfigLocationMetadata, ParamTypeLocation, ParamTypeLocationMetadata, SdkWindow, SetLocationFunction, SetValueMessage, SetValueOptions, SettingsLocation, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ApiClient, ClientOptions, ExceptProject } from '@uniformdev/context/api';
2
- import { DataSource, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataType, DataVariableDefinition, DataResourceVariables } from '@uniformdev/canvas';
2
+ import { DataSource, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataType as DataType$1, DataResourceVariables } from '@uniformdev/canvas';
3
3
  import { ProjectMapNode } from '@uniformdev/project-map';
4
+ import { DataType } from '@uniformdev/canvas/.';
4
5
  import { Emitter } from 'mitt';
5
6
 
6
7
  /**
@@ -645,28 +646,10 @@ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfig
645
646
  settings: TIntegrationConfiguration;
646
647
  /** The Uniform project ID */
647
648
  projectId: string;
648
- /**
649
- * Current dynamic inputs that are configured on the composition (if any).
650
- * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
651
- */
649
+ /** Current dynamic inputs that are configured on the composition (if any). */
652
650
  dynamicInputs: DynamicInputs;
653
- /**
654
- * The connected data for the current component. Connected data is provided as a map
655
- * of the binding expression text to the value of that binding expression. For example,
656
- * if the value is "Hello ${#jptr:/MyData/fields/name}" then this value would be:
657
- * { "#jptr:/MyData/fields/name": "value-of-connected-data" }
658
- *
659
- * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
660
- */
661
- connectedData: Record<string, unknown>;
662
- };
663
- type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'> & {
664
- /**
665
- * Opens a dialog on the Uniform platform to edit or select a data element to connect to.
666
- * Returns the result of the dialog. Useful to build data-enabled parameter types.
667
- */
668
- editConnectedData: Awaited<ReturnType<typeof connectToParent>>['parent']['editConnectedData'];
669
651
  };
652
+ type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'>;
670
653
 
671
654
  type SettingsLocationMetadata = {
672
655
  projectId: string;
@@ -704,7 +687,7 @@ interface DialogResponseData {
704
687
  dialogId: string;
705
688
  error?: string;
706
689
  }
707
- type DialogType = 'location' | 'confirm' | 'currentLocation';
690
+ type DialogType = 'location' | 'confirm';
708
691
  type OpenDialogResult = {
709
692
  /** Unique ID of this dialog which can be used to close it */
710
693
  dialogId: string;
@@ -771,25 +754,6 @@ type CloseDialogMessage = {
771
754
  dialogData?: unknown;
772
755
  };
773
756
  type GetDataResourceMessage = Pick<DataType, 'path' | 'headers' | 'parameters' | 'body' | 'method'>;
774
- /** Primitive data types that a parameter type accepts to be bound to composition data */
775
- type BindableTypes = 'string' | 'number' | 'boolean' | 'object' | 'array';
776
- /** Message to parent to create a data connection expression to insert in a param type */
777
- type EditConnectedDataMessage = {
778
- /** Bind expression for existing connected data */
779
- existingConnectedData?: string;
780
- allowedTypes: BindableTypes[];
781
- };
782
- /** Response from parent when creating a data connection expression */
783
- type EditConnectedDataResponse = {
784
- canceled: false;
785
- /** Bind expression for selected data connection */
786
- connectedData: DataVariableDefinition & {
787
- name: string;
788
- };
789
- } | {
790
- /** User cancelled selecting data element */
791
- canceled: true;
792
- };
793
757
 
794
758
  type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
795
759
  initialize: () => Promise<MeshContextData>;
@@ -811,7 +775,6 @@ declare function connectToParent({ dialogResponseHandlers, onMetadataUpdated, }:
811
775
  openDialog: (message: OpenDialogMessage) => Promise<Pick<DialogResponseData, "value" | "dialogId"> | undefined>;
812
776
  closeDialog: (message: CloseDialogMessage) => Promise<void>;
813
777
  getDataResource: <TExpectedResult>(message: GetDataResourceMessage) => Promise<TExpectedResult>;
814
- editConnectedData: (message: EditConnectedDataMessage) => Promise<EditConnectedDataResponse>;
815
778
  };
816
779
  }>;
817
780
 
@@ -860,7 +823,6 @@ type SetValueOptions = ValidationResult;
860
823
  type SetValueMessage = {
861
824
  uniformMeshLocationValue: unknown;
862
825
  options?: SetValueOptions;
863
- closeDialog?: boolean;
864
826
  };
865
827
  type GetDataResourceLocation = {
866
828
  getDataResource: Awaited<ReturnType<typeof connectToParent>>['parent']['getDataResource'];
@@ -881,7 +843,7 @@ type DynamicInput = {
881
843
  /** Record of dynamic inputs keyed by the input name */
882
844
  type DynamicInputs = Record<string, DynamicInput>;
883
845
 
884
- type DataTypeLocationValue = Pick<DataType, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
846
+ type DataTypeLocationValue = Pick<DataType$1, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
885
847
  type DataConnectorInfo = {
886
848
  type: string;
887
849
  displayName: string;
@@ -906,7 +868,7 @@ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
906
868
  /** Settings defined at the integration level (arbitrary type used on settings location) */
907
869
  settings: TIntegrationConfiguration;
908
870
  /** The current data resource's data type */
909
- dataType: DataType;
871
+ dataType: DataType$1;
910
872
  /** The data type's archetype value. */
911
873
  archetype: string;
912
874
  /**
@@ -1028,4 +990,4 @@ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
1028
990
  autoResizingDisabled?: boolean;
1029
991
  }): Promise<UniformMeshSDK | undefined>;
1030
992
 
1031
- export { BindableTypes, CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, EditConnectedDataMessage, EditConnectedDataResponse, GetDataResourceLocation, GetDataResourceMessage, IntegrationDefinitionClient, IntegrationDefinitionDeleteParameters, IntegrationDefinitionGetParameters, IntegrationDefinitionGetResponse, IntegrationDefinitionPutParameters, IntegrationDefinitionPutResponse, IntegrationInstallationClient, IntegrationInstallationDeleteParameters, IntegrationInstallationGetParameters, IntegrationInstallationGetResponse, IntegrationInstallationPutParameters, LocationDialogResponse, MeshContextData, MeshLocation, MeshLocationCore, MeshLocationTypes, MeshSDKEventInterface, OpenConfirmationDialogOptions, OpenConfirmationDialogResult, OpenDialogMessage, OpenDialogResult, OpenLocationDialogOptions, ParamTypeConfigLocation, ParamTypeConfigLocationMetadata, ParamTypeLocation, ParamTypeLocationMetadata, SdkWindow, SetLocationFunction, SetValueMessage, SetValueOptions, SettingsLocation, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
993
+ export { CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, GetDataResourceLocation, GetDataResourceMessage, IntegrationDefinitionClient, IntegrationDefinitionDeleteParameters, IntegrationDefinitionGetParameters, IntegrationDefinitionGetResponse, IntegrationDefinitionPutParameters, IntegrationDefinitionPutResponse, IntegrationInstallationClient, IntegrationInstallationDeleteParameters, IntegrationInstallationGetParameters, IntegrationInstallationGetResponse, IntegrationInstallationPutParameters, LocationDialogResponse, MeshContextData, MeshLocation, MeshLocationCore, MeshLocationTypes, MeshSDKEventInterface, OpenConfirmationDialogOptions, OpenConfirmationDialogResult, OpenDialogMessage, OpenDialogResult, OpenLocationDialogOptions, ParamTypeConfigLocation, ParamTypeConfigLocationMetadata, ParamTypeLocation, ParamTypeLocationMetadata, SdkWindow, SetLocationFunction, SetValueMessage, SetValueOptions, SettingsLocation, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
package/dist/index.esm.js CHANGED
@@ -124,8 +124,8 @@ var DEFAULT_REQUEST_TIMEOUT = 5e3;
124
124
 
125
125
  // src/framepost/errors.ts
126
126
  var RequestTimeoutError = class _RequestTimeoutError extends Error {
127
- constructor(message) {
128
- super("Request timed out: " + message);
127
+ constructor() {
128
+ super("Request timed out");
129
129
  Object.setPrototypeOf(this, _RequestTimeoutError.prototype);
130
130
  this.name = "RequestTimeoutError";
131
131
  }
@@ -171,7 +171,7 @@ var serializeError = (error) => {
171
171
  var deserializeError = ({ name, message, stack }) => {
172
172
  switch (name) {
173
173
  case RequestTimeoutError.name: {
174
- return new RequestTimeoutError(message);
174
+ return new RequestTimeoutError();
175
175
  }
176
176
  default: {
177
177
  const e = new Error(message);
@@ -277,7 +277,7 @@ var SharedClient = class {
277
277
  timer = setTimeout(() => {
278
278
  unsubscribeResponseHandler();
279
279
  clearOnDestroy();
280
- reject(new RequestTimeoutError(requestKey));
280
+ reject(new RequestTimeoutError());
281
281
  }, options.timeout || this.requestTimeout);
282
282
  });
283
283
  }
@@ -503,18 +503,6 @@ async function connectToParent({
503
503
  return await client.request("getDataResource", message, {
504
504
  timeout: 3e4
505
505
  });
506
- },
507
- editConnectedData: async (message) => {
508
- return await client.request(
509
- "editConnectedData",
510
- message,
511
- {
512
- timeout: (
513
- // 24 hours in ms
514
- 864e5
515
- )
516
- }
517
- );
518
506
  }
519
507
  }
520
508
  };
@@ -533,6 +521,7 @@ function getByteSize(val) {
533
521
  }
534
522
 
535
523
  // src/sdkWindow.ts
524
+ import imagesLoaded from "imagesloaded";
536
525
  var oldHeight;
537
526
  var createSdkWindow = ({
538
527
  onHeightChange,
@@ -548,12 +537,9 @@ var createSdkWindow = ({
548
537
  onHeightChange == null ? void 0 : onHeightChange(height);
549
538
  return;
550
539
  }
551
- let maxBottom = windowInstance.document.documentElement.getBoundingClientRect().height;
552
- windowInstance.document.querySelectorAll("div, section, article, menu, nav, footer").forEach((div) => {
553
- const bottom = div.getBoundingClientRect().bottom;
554
- maxBottom = Math.max(maxBottom, bottom);
555
- });
556
- const windowHeight = `${Math.ceil(maxBottom)}px`;
540
+ const windowHeight = `${Math.ceil(
541
+ windowInstance.document.documentElement.getBoundingClientRect().height
542
+ )}px`;
557
543
  if (windowHeight !== oldHeight) {
558
544
  oldHeight = windowHeight;
559
545
  onHeightChange == null ? void 0 : onHeightChange(windowHeight);
@@ -563,6 +549,34 @@ var createSdkWindow = ({
563
549
  updateHeight();
564
550
  };
565
551
  const observer = autoResizingDisabled ? void 0 : new MutationObserver(heightCallback);
552
+ const observedImages = /* @__PURE__ */ new WeakSet();
553
+ const imagesLoadedInstance = autoResizingDisabled ? void 0 : imagesLoaded(document.body, () => {
554
+ heightCallback();
555
+ });
556
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.on("progress", () => {
557
+ heightCallback();
558
+ });
559
+ const newImagesObserver = autoResizingDisabled ? void 0 : new MutationObserver((mutations) => {
560
+ let newImagesAdded = false;
561
+ for (const mutation of mutations) {
562
+ for (const newNode of mutation.addedNodes) {
563
+ if (newNode && newNode.nodeName !== "IMG") {
564
+ continue;
565
+ }
566
+ if (observedImages.has(newNode)) {
567
+ continue;
568
+ }
569
+ observedImages.add(newNode);
570
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.addImage(newNode);
571
+ newImagesAdded = true;
572
+ }
573
+ }
574
+ if (newImagesAdded) {
575
+ window.requestAnimationFrame(() => {
576
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.check();
577
+ });
578
+ }
579
+ });
566
580
  const sdkWindow = {
567
581
  instance: windowInstance,
568
582
  height: windowInstance.document.documentElement.getBoundingClientRect().height,
@@ -575,10 +589,15 @@ var createSdkWindow = ({
575
589
  characterData: true
576
590
  });
577
591
  windowInstance.addEventListener("resize", heightCallback);
592
+ newImagesObserver == null ? void 0 : newImagesObserver.observe(document.body, {
593
+ childList: true,
594
+ subtree: true
595
+ });
578
596
  },
579
597
  disableAutoResizing: () => {
580
598
  observer == null ? void 0 : observer.disconnect();
581
599
  windowInstance.removeEventListener("resize", heightCallback);
600
+ newImagesObserver == null ? void 0 : newImagesObserver.disconnect();
582
601
  },
583
602
  updateHeight
584
603
  };
@@ -619,11 +638,15 @@ async function initializeUniformMeshSDK({
619
638
  getCurrentLocation: () => {
620
639
  const location = {
621
640
  getDataResource: parent.getDataResource,
622
- editConnectedData: parent.editConnectedData,
623
641
  type: contextData.locationType,
624
642
  isReadOnly: contextData.isReadOnly,
625
643
  value: contextData.locationValue,
626
644
  setValue: async (value, options) => {
645
+ if (contextData.dialogContext) {
646
+ console.warn(
647
+ "Using setValue() inside a dialog is deprecated. Use dialogContext.returnDialogValue() instead."
648
+ );
649
+ }
627
650
  contextData.locationValue = value;
628
651
  sdk.events.emit("onValueChanged", { newValue: value });
629
652
  await parent.setValue({ uniformMeshLocationValue: value, options });
@@ -635,7 +658,7 @@ async function initializeUniformMeshSDK({
635
658
  returnDialogValue: async (value) => {
636
659
  contextData.locationValue = value;
637
660
  sdk.events.emit("onValueChanged", { newValue: value });
638
- await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
661
+ await parent.setValue({ uniformMeshLocationValue: value });
639
662
  }
640
663
  } : void 0
641
664
  };
@@ -695,28 +718,26 @@ async function initializeUniformMeshSDK({
695
718
  },
696
719
  openCurrentLocationDialog: async (options) => {
697
720
  const result = await parent.openDialog({
698
- dialogType: "currentLocation",
721
+ dialogType: "location",
699
722
  dialogData: {},
700
723
  options: options == null ? void 0 : options.options
701
724
  });
702
725
  if (!result) {
703
726
  return;
704
727
  }
705
- contextData.locationValue = result.value;
706
- sdk.events.emit("onValueChanged", { newValue: result.value });
707
728
  return {
708
729
  dialogId: result.dialogId,
709
730
  value: result.value,
710
731
  closeDialog: async () => {
711
732
  await parent.closeDialog({
712
733
  dialogId: void 0,
713
- dialogType: "currentLocation"
734
+ dialogType: "location"
714
735
  });
715
736
  }
716
737
  };
717
738
  },
718
739
  closeCurrentLocationDialog: async () => {
719
- await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
740
+ await parent.closeDialog({ dialogId: void 0, dialogType: "location" });
720
741
  }
721
742
  };
722
743
  window.UniformMeshSDK = sdk;
package/dist/index.js CHANGED
@@ -161,8 +161,8 @@ var DEFAULT_REQUEST_TIMEOUT = 5e3;
161
161
 
162
162
  // src/framepost/errors.ts
163
163
  var RequestTimeoutError = class _RequestTimeoutError extends Error {
164
- constructor(message) {
165
- super("Request timed out: " + message);
164
+ constructor() {
165
+ super("Request timed out");
166
166
  Object.setPrototypeOf(this, _RequestTimeoutError.prototype);
167
167
  this.name = "RequestTimeoutError";
168
168
  }
@@ -208,7 +208,7 @@ var serializeError = (error) => {
208
208
  var deserializeError = ({ name, message, stack }) => {
209
209
  switch (name) {
210
210
  case RequestTimeoutError.name: {
211
- return new RequestTimeoutError(message);
211
+ return new RequestTimeoutError();
212
212
  }
213
213
  default: {
214
214
  const e = new Error(message);
@@ -314,7 +314,7 @@ var SharedClient = class {
314
314
  timer = setTimeout(() => {
315
315
  unsubscribeResponseHandler();
316
316
  clearOnDestroy();
317
- reject(new RequestTimeoutError(requestKey));
317
+ reject(new RequestTimeoutError());
318
318
  }, options.timeout || this.requestTimeout);
319
319
  });
320
320
  }
@@ -540,18 +540,6 @@ async function connectToParent({
540
540
  return await client.request("getDataResource", message, {
541
541
  timeout: 3e4
542
542
  });
543
- },
544
- editConnectedData: async (message) => {
545
- return await client.request(
546
- "editConnectedData",
547
- message,
548
- {
549
- timeout: (
550
- // 24 hours in ms
551
- 864e5
552
- )
553
- }
554
- );
555
543
  }
556
544
  }
557
545
  };
@@ -570,6 +558,7 @@ function getByteSize(val) {
570
558
  }
571
559
 
572
560
  // src/sdkWindow.ts
561
+ var import_imagesloaded = __toESM(require("imagesloaded"));
573
562
  var oldHeight;
574
563
  var createSdkWindow = ({
575
564
  onHeightChange,
@@ -585,12 +574,9 @@ var createSdkWindow = ({
585
574
  onHeightChange == null ? void 0 : onHeightChange(height);
586
575
  return;
587
576
  }
588
- let maxBottom = windowInstance.document.documentElement.getBoundingClientRect().height;
589
- windowInstance.document.querySelectorAll("div, section, article, menu, nav, footer").forEach((div) => {
590
- const bottom = div.getBoundingClientRect().bottom;
591
- maxBottom = Math.max(maxBottom, bottom);
592
- });
593
- const windowHeight = `${Math.ceil(maxBottom)}px`;
577
+ const windowHeight = `${Math.ceil(
578
+ windowInstance.document.documentElement.getBoundingClientRect().height
579
+ )}px`;
594
580
  if (windowHeight !== oldHeight) {
595
581
  oldHeight = windowHeight;
596
582
  onHeightChange == null ? void 0 : onHeightChange(windowHeight);
@@ -600,6 +586,34 @@ var createSdkWindow = ({
600
586
  updateHeight();
601
587
  };
602
588
  const observer = autoResizingDisabled ? void 0 : new MutationObserver(heightCallback);
589
+ const observedImages = /* @__PURE__ */ new WeakSet();
590
+ const imagesLoadedInstance = autoResizingDisabled ? void 0 : (0, import_imagesloaded.default)(document.body, () => {
591
+ heightCallback();
592
+ });
593
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.on("progress", () => {
594
+ heightCallback();
595
+ });
596
+ const newImagesObserver = autoResizingDisabled ? void 0 : new MutationObserver((mutations) => {
597
+ let newImagesAdded = false;
598
+ for (const mutation of mutations) {
599
+ for (const newNode of mutation.addedNodes) {
600
+ if (newNode && newNode.nodeName !== "IMG") {
601
+ continue;
602
+ }
603
+ if (observedImages.has(newNode)) {
604
+ continue;
605
+ }
606
+ observedImages.add(newNode);
607
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.addImage(newNode);
608
+ newImagesAdded = true;
609
+ }
610
+ }
611
+ if (newImagesAdded) {
612
+ window.requestAnimationFrame(() => {
613
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.check();
614
+ });
615
+ }
616
+ });
603
617
  const sdkWindow = {
604
618
  instance: windowInstance,
605
619
  height: windowInstance.document.documentElement.getBoundingClientRect().height,
@@ -612,10 +626,15 @@ var createSdkWindow = ({
612
626
  characterData: true
613
627
  });
614
628
  windowInstance.addEventListener("resize", heightCallback);
629
+ newImagesObserver == null ? void 0 : newImagesObserver.observe(document.body, {
630
+ childList: true,
631
+ subtree: true
632
+ });
615
633
  },
616
634
  disableAutoResizing: () => {
617
635
  observer == null ? void 0 : observer.disconnect();
618
636
  windowInstance.removeEventListener("resize", heightCallback);
637
+ newImagesObserver == null ? void 0 : newImagesObserver.disconnect();
619
638
  },
620
639
  updateHeight
621
640
  };
@@ -656,11 +675,15 @@ async function initializeUniformMeshSDK({
656
675
  getCurrentLocation: () => {
657
676
  const location = {
658
677
  getDataResource: parent.getDataResource,
659
- editConnectedData: parent.editConnectedData,
660
678
  type: contextData.locationType,
661
679
  isReadOnly: contextData.isReadOnly,
662
680
  value: contextData.locationValue,
663
681
  setValue: async (value, options) => {
682
+ if (contextData.dialogContext) {
683
+ console.warn(
684
+ "Using setValue() inside a dialog is deprecated. Use dialogContext.returnDialogValue() instead."
685
+ );
686
+ }
664
687
  contextData.locationValue = value;
665
688
  sdk.events.emit("onValueChanged", { newValue: value });
666
689
  await parent.setValue({ uniformMeshLocationValue: value, options });
@@ -672,7 +695,7 @@ async function initializeUniformMeshSDK({
672
695
  returnDialogValue: async (value) => {
673
696
  contextData.locationValue = value;
674
697
  sdk.events.emit("onValueChanged", { newValue: value });
675
- await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
698
+ await parent.setValue({ uniformMeshLocationValue: value });
676
699
  }
677
700
  } : void 0
678
701
  };
@@ -732,28 +755,26 @@ async function initializeUniformMeshSDK({
732
755
  },
733
756
  openCurrentLocationDialog: async (options) => {
734
757
  const result = await parent.openDialog({
735
- dialogType: "currentLocation",
758
+ dialogType: "location",
736
759
  dialogData: {},
737
760
  options: options == null ? void 0 : options.options
738
761
  });
739
762
  if (!result) {
740
763
  return;
741
764
  }
742
- contextData.locationValue = result.value;
743
- sdk.events.emit("onValueChanged", { newValue: result.value });
744
765
  return {
745
766
  dialogId: result.dialogId,
746
767
  value: result.value,
747
768
  closeDialog: async () => {
748
769
  await parent.closeDialog({
749
770
  dialogId: void 0,
750
- dialogType: "currentLocation"
771
+ dialogType: "location"
751
772
  });
752
773
  }
753
774
  };
754
775
  },
755
776
  closeCurrentLocationDialog: async () => {
756
- await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
777
+ await parent.closeDialog({ dialogId: void 0, dialogType: "location" });
757
778
  }
758
779
  };
759
780
  window.UniformMeshSDK = sdk;
package/dist/index.mjs CHANGED
@@ -124,8 +124,8 @@ var DEFAULT_REQUEST_TIMEOUT = 5e3;
124
124
 
125
125
  // src/framepost/errors.ts
126
126
  var RequestTimeoutError = class _RequestTimeoutError extends Error {
127
- constructor(message) {
128
- super("Request timed out: " + message);
127
+ constructor() {
128
+ super("Request timed out");
129
129
  Object.setPrototypeOf(this, _RequestTimeoutError.prototype);
130
130
  this.name = "RequestTimeoutError";
131
131
  }
@@ -171,7 +171,7 @@ var serializeError = (error) => {
171
171
  var deserializeError = ({ name, message, stack }) => {
172
172
  switch (name) {
173
173
  case RequestTimeoutError.name: {
174
- return new RequestTimeoutError(message);
174
+ return new RequestTimeoutError();
175
175
  }
176
176
  default: {
177
177
  const e = new Error(message);
@@ -277,7 +277,7 @@ var SharedClient = class {
277
277
  timer = setTimeout(() => {
278
278
  unsubscribeResponseHandler();
279
279
  clearOnDestroy();
280
- reject(new RequestTimeoutError(requestKey));
280
+ reject(new RequestTimeoutError());
281
281
  }, options.timeout || this.requestTimeout);
282
282
  });
283
283
  }
@@ -503,18 +503,6 @@ async function connectToParent({
503
503
  return await client.request("getDataResource", message, {
504
504
  timeout: 3e4
505
505
  });
506
- },
507
- editConnectedData: async (message) => {
508
- return await client.request(
509
- "editConnectedData",
510
- message,
511
- {
512
- timeout: (
513
- // 24 hours in ms
514
- 864e5
515
- )
516
- }
517
- );
518
506
  }
519
507
  }
520
508
  };
@@ -533,6 +521,7 @@ function getByteSize(val) {
533
521
  }
534
522
 
535
523
  // src/sdkWindow.ts
524
+ import imagesLoaded from "imagesloaded";
536
525
  var oldHeight;
537
526
  var createSdkWindow = ({
538
527
  onHeightChange,
@@ -548,12 +537,9 @@ var createSdkWindow = ({
548
537
  onHeightChange == null ? void 0 : onHeightChange(height);
549
538
  return;
550
539
  }
551
- let maxBottom = windowInstance.document.documentElement.getBoundingClientRect().height;
552
- windowInstance.document.querySelectorAll("div, section, article, menu, nav, footer").forEach((div) => {
553
- const bottom = div.getBoundingClientRect().bottom;
554
- maxBottom = Math.max(maxBottom, bottom);
555
- });
556
- const windowHeight = `${Math.ceil(maxBottom)}px`;
540
+ const windowHeight = `${Math.ceil(
541
+ windowInstance.document.documentElement.getBoundingClientRect().height
542
+ )}px`;
557
543
  if (windowHeight !== oldHeight) {
558
544
  oldHeight = windowHeight;
559
545
  onHeightChange == null ? void 0 : onHeightChange(windowHeight);
@@ -563,6 +549,34 @@ var createSdkWindow = ({
563
549
  updateHeight();
564
550
  };
565
551
  const observer = autoResizingDisabled ? void 0 : new MutationObserver(heightCallback);
552
+ const observedImages = /* @__PURE__ */ new WeakSet();
553
+ const imagesLoadedInstance = autoResizingDisabled ? void 0 : imagesLoaded(document.body, () => {
554
+ heightCallback();
555
+ });
556
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.on("progress", () => {
557
+ heightCallback();
558
+ });
559
+ const newImagesObserver = autoResizingDisabled ? void 0 : new MutationObserver((mutations) => {
560
+ let newImagesAdded = false;
561
+ for (const mutation of mutations) {
562
+ for (const newNode of mutation.addedNodes) {
563
+ if (newNode && newNode.nodeName !== "IMG") {
564
+ continue;
565
+ }
566
+ if (observedImages.has(newNode)) {
567
+ continue;
568
+ }
569
+ observedImages.add(newNode);
570
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.addImage(newNode);
571
+ newImagesAdded = true;
572
+ }
573
+ }
574
+ if (newImagesAdded) {
575
+ window.requestAnimationFrame(() => {
576
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.check();
577
+ });
578
+ }
579
+ });
566
580
  const sdkWindow = {
567
581
  instance: windowInstance,
568
582
  height: windowInstance.document.documentElement.getBoundingClientRect().height,
@@ -575,10 +589,15 @@ var createSdkWindow = ({
575
589
  characterData: true
576
590
  });
577
591
  windowInstance.addEventListener("resize", heightCallback);
592
+ newImagesObserver == null ? void 0 : newImagesObserver.observe(document.body, {
593
+ childList: true,
594
+ subtree: true
595
+ });
578
596
  },
579
597
  disableAutoResizing: () => {
580
598
  observer == null ? void 0 : observer.disconnect();
581
599
  windowInstance.removeEventListener("resize", heightCallback);
600
+ newImagesObserver == null ? void 0 : newImagesObserver.disconnect();
582
601
  },
583
602
  updateHeight
584
603
  };
@@ -619,11 +638,15 @@ async function initializeUniformMeshSDK({
619
638
  getCurrentLocation: () => {
620
639
  const location = {
621
640
  getDataResource: parent.getDataResource,
622
- editConnectedData: parent.editConnectedData,
623
641
  type: contextData.locationType,
624
642
  isReadOnly: contextData.isReadOnly,
625
643
  value: contextData.locationValue,
626
644
  setValue: async (value, options) => {
645
+ if (contextData.dialogContext) {
646
+ console.warn(
647
+ "Using setValue() inside a dialog is deprecated. Use dialogContext.returnDialogValue() instead."
648
+ );
649
+ }
627
650
  contextData.locationValue = value;
628
651
  sdk.events.emit("onValueChanged", { newValue: value });
629
652
  await parent.setValue({ uniformMeshLocationValue: value, options });
@@ -635,7 +658,7 @@ async function initializeUniformMeshSDK({
635
658
  returnDialogValue: async (value) => {
636
659
  contextData.locationValue = value;
637
660
  sdk.events.emit("onValueChanged", { newValue: value });
638
- await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
661
+ await parent.setValue({ uniformMeshLocationValue: value });
639
662
  }
640
663
  } : void 0
641
664
  };
@@ -695,28 +718,26 @@ async function initializeUniformMeshSDK({
695
718
  },
696
719
  openCurrentLocationDialog: async (options) => {
697
720
  const result = await parent.openDialog({
698
- dialogType: "currentLocation",
721
+ dialogType: "location",
699
722
  dialogData: {},
700
723
  options: options == null ? void 0 : options.options
701
724
  });
702
725
  if (!result) {
703
726
  return;
704
727
  }
705
- contextData.locationValue = result.value;
706
- sdk.events.emit("onValueChanged", { newValue: result.value });
707
728
  return {
708
729
  dialogId: result.dialogId,
709
730
  value: result.value,
710
731
  closeDialog: async () => {
711
732
  await parent.closeDialog({
712
733
  dialogId: void 0,
713
- dialogType: "currentLocation"
734
+ dialogType: "location"
714
735
  });
715
736
  }
716
737
  };
717
738
  },
718
739
  closeCurrentLocationDialog: async () => {
719
- await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
740
+ await parent.closeDialog({ dialogId: void 0, dialogType: "location" });
720
741
  }
721
742
  };
722
743
  window.UniformMeshSDK = sdk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk",
3
- "version": "19.35.3-alpha.82+4bc341093",
3
+ "version": "19.36.1-alpha.0+a6b7449c1",
4
4
  "description": "Uniform Mesh Framework SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -32,10 +32,14 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "19.35.3-alpha.82+4bc341093",
36
- "@uniformdev/context": "19.35.3-alpha.82+4bc341093",
37
- "@uniformdev/project-map": "19.35.3-alpha.82+4bc341093",
35
+ "@uniformdev/canvas": "19.36.1-alpha.0+a6b7449c1",
36
+ "@uniformdev/context": "19.36.1-alpha.0+a6b7449c1",
37
+ "@uniformdev/project-map": "19.36.1-alpha.0+a6b7449c1",
38
+ "imagesloaded": "^5.0.0",
38
39
  "mitt": "^3.0.0"
39
40
  },
40
- "gitHead": "4bc341093bc946900df2646fe53eca4bcddc693c"
41
+ "devDependencies": {
42
+ "@types/imagesloaded": "^4.1.2"
43
+ },
44
+ "gitHead": "a6b7449c13066f2bdef2d5209c230986507fb454"
41
45
  }