@uniformdev/mesh-sdk-react 19.38.3-alpha.70 → 19.38.3-alpha.78

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.esm.js CHANGED
@@ -267,8 +267,8 @@ import { useAsyncFn, useDebounce } from "react-use";
267
267
 
268
268
  // src/components/commerce/SelectionField.tsx
269
269
  import { css as css2 } from "@emotion/react";
270
+ import { CgClose } from "@react-icons/all-files/cg/CgClose";
270
271
  import { Icon, InputSelect } from "@uniformdev/design-system";
271
- import { CgClose } from "react-icons/cg";
272
272
 
273
273
  // src/components/commerce/ResolvableLoadingValue.tsx
274
274
  import { Fragment, jsxs as jsxs4 } from "@emotion/react/jsx-runtime";
@@ -1077,9 +1077,10 @@ var DefaultSearchRow = ({ result, isSelected, triggerSelection }) => {
1077
1077
 
1078
1078
  // src/components/legacy/EntrySearch/DefaultSelectedItem.tsx
1079
1079
  import { css as css9 } from "@emotion/react";
1080
+ import { CgClose as CgClose2 } from "@react-icons/all-files/cg/CgClose";
1081
+ import { CgInfo } from "@react-icons/all-files/cg/CgInfo";
1080
1082
  import { Icon as Icon2, useOutsideClick as useOutsideClick2 } from "@uniformdev/design-system";
1081
1083
  import { useEffect, useRef as useRef2, useState as useState2 } from "react";
1082
- import { CgClose as CgClose2, CgInfo } from "react-icons/cg";
1083
1084
  import { format as timeAgo } from "timeago.js";
1084
1085
 
1085
1086
  // src/utils/openWindowWithCloseCallback.ts
@@ -2037,8 +2038,8 @@ function ProductSearchRow({
2037
2038
 
2038
2039
  // src/components/commerce/ProductSelectedItem.tsx
2039
2040
  import { css as css15 } from "@emotion/react";
2041
+ import { CgClose as CgClose3 } from "@react-icons/all-files/cg/CgClose";
2040
2042
  import { Icon as Icon3, mq as mq4 } from "@uniformdev/design-system";
2041
- import { CgClose as CgClose3 } from "react-icons/cg";
2042
2043
 
2043
2044
  // src/components/commerce/styles/ProductSelectedItem.styles.ts
2044
2045
  import { css as css14 } from "@emotion/react";
@@ -2349,9 +2350,10 @@ var useProductSearchContext = () => {
2349
2350
 
2350
2351
  // src/components/dam/DamSelectedItem.tsx
2351
2352
  import { css as css17 } from "@emotion/react";
2353
+ import { CgClose as CgClose4 } from "@react-icons/all-files/cg/CgClose";
2354
+ import { CgInfo as CgInfo2 } from "@react-icons/all-files/cg/CgInfo";
2352
2355
  import { Icon as Icon4 } from "@uniformdev/design-system";
2353
2356
  import { useEffect as useEffect4, useRef as useRef6, useState as useState5 } from "react";
2354
- import { CgClose as CgClose4, CgInfo as CgInfo2 } from "react-icons/cg";
2355
2357
  import { format as timeAgo2 } from "timeago.js";
2356
2358
 
2357
2359
  // src/components/dam/DamSelectedItem.styles.ts
@@ -2773,7 +2775,8 @@ import { ParameterShellContext, useParameterShell } from "@uniformdev/design-sys
2773
2775
 
2774
2776
  // src/components/Variables/composer/ControlledValuePlugin.tsx
2775
2777
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
2776
- import { useEffect as useEffect5 } from "react";
2778
+ import { dequal } from "dequal/lite";
2779
+ import { useEffect as useEffect5, useRef as useRef8 } from "react";
2777
2780
 
2778
2781
  // src/components/Variables/util/deserializeVariablesEditorState.ts
2779
2782
  import { parseVariableExpression } from "@uniformdev/canvas";
@@ -2884,12 +2887,17 @@ function ControlledValuePlugin({
2884
2887
  extraDependencies
2885
2888
  }) {
2886
2889
  const [editor] = useLexicalComposerContext();
2890
+ const lastValueRef = useRef8(value);
2887
2891
  useEffect5(() => {
2888
2892
  if (!enabled) {
2889
2893
  return;
2890
2894
  }
2895
+ if (dequal(lastValueRef.current, value)) {
2896
+ return;
2897
+ }
2891
2898
  setTimeout(() => {
2892
2899
  if (editor) {
2900
+ lastValueRef.current = value;
2893
2901
  setVariablesEditorValue(editor, value);
2894
2902
  }
2895
2903
  });
@@ -2903,6 +2911,7 @@ import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection"
2903
2911
  import { $moveCharacter, $shouldOverrideDefaultCharacterSelection } from "@lexical/selection";
2904
2912
  import { mergeRegister } from "@lexical/utils";
2905
2913
  import { createVariableReference as createVariableReference2 } from "@uniformdev/canvas";
2914
+ import { LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system";
2906
2915
  import {
2907
2916
  $getNearestNodeFromDOMNode,
2908
2917
  $getNodeByKey as $getNodeByKey2,
@@ -2936,7 +2945,8 @@ function VariableChip({
2936
2945
  reference,
2937
2946
  onClick,
2938
2947
  isFresh,
2939
- selected
2948
+ selected,
2949
+ disabled
2940
2950
  }) {
2941
2951
  const hasClickEvent = !!onClick;
2942
2952
  const referenceIsValidFr = isFresh ? true : referenceIsValid;
@@ -2950,6 +2960,7 @@ function VariableChip({
2950
2960
  ${extraTitle}` : ""}` : extraTitle,
2951
2961
  onClick,
2952
2962
  "aria-selected": selected ? true : void 0,
2963
+ "aria-disabled": disabled,
2953
2964
  children: /* @__PURE__ */ jsx29(Wrapper, { children: displayName || reference })
2954
2965
  }
2955
2966
  );
@@ -2988,9 +2999,10 @@ import {
2988
2999
  LexicalTypeaheadMenuPlugin,
2989
3000
  MenuOption
2990
3001
  } from "@lexical/react/LexicalTypeaheadMenuPlugin";
3002
+ import { AiFillPlusCircle } from "@react-icons/all-files/ai/AiFillPlusCircle";
2991
3003
  import { createVariableReference } from "@uniformdev/canvas";
2992
3004
  import { HorizontalRhythm, MenuGroup, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
2993
- import { dequal } from "dequal/lite";
3005
+ import { dequal as dequal2 } from "dequal/lite";
2994
3006
  import {
2995
3007
  $getNodeByKey,
2996
3008
  $insertNodes,
@@ -2998,9 +3010,8 @@ import {
2998
3010
  COMMAND_PRIORITY_NORMAL,
2999
3011
  createCommand
3000
3012
  } from "lexical";
3001
- import { useCallback, useEffect as useEffect7, useMemo as useMemo8, useRef as useRef8, useState as useState8 } from "react";
3013
+ import { useCallback, useEffect as useEffect7, useMemo as useMemo8, useRef as useRef9, useState as useState8 } from "react";
3002
3014
  import { createPortal } from "react-dom";
3003
- import { AiFillPlusCircle } from "react-icons/ai";
3004
3015
 
3005
3016
  // src/components/Variables/toolbox/SelectVariableMenu.styles.ts
3006
3017
  import { css as css18 } from "@emotion/react";
@@ -3036,7 +3047,7 @@ import { useEffect as useEffect6 } from "react";
3036
3047
 
3037
3048
  // src/components/Variables/VariablesProvider.tsx
3038
3049
  import mitt from "mitt";
3039
- import * as React10 from "react";
3050
+ import { createContext as createContext3, useContext as useContext5, useMemo as useMemo7, useState as useState7 } from "react";
3040
3051
 
3041
3052
  // src/components/Variables/VariableEditor.tsx
3042
3053
  import { zodResolver } from "@hookform/resolvers/zod";
@@ -3147,61 +3158,71 @@ function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }) {
3147
3158
 
3148
3159
  // src/components/Variables/VariablesProvider.tsx
3149
3160
  import { jsx as jsx31, jsxs as jsxs17 } from "@emotion/react/jsx-runtime";
3150
- var VariablesContext = React10.createContext(null);
3161
+ var VariablesContext = createContext3(null);
3151
3162
  function VariablesProvider({
3152
3163
  value,
3153
3164
  onChange,
3154
3165
  editVariableComponent,
3155
3166
  readOnly,
3167
+ isLoading,
3156
3168
  children,
3157
3169
  knownUndefinedValues = {}
3158
3170
  }) {
3159
- const [editing, setEditing] = React10.useState();
3160
- const [editingContext, setEditingContext] = React10.useState();
3161
- const events = React10.useMemo(() => mitt(), []);
3171
+ const [editing, setEditing] = useState7();
3172
+ const [editingContext, setEditingContext] = useState7();
3173
+ const events = useMemo7(() => mitt(), []);
3162
3174
  if (!readOnly && !onChange) {
3163
3175
  throw new Error("onChange must be provided when readOnly is false");
3164
3176
  }
3165
3177
  const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
3166
- const contextValue = {
3167
- flatVariables: flattenVariables(value),
3168
- dispatch: (event) => {
3169
- if (readOnly) {
3170
- console.warn(
3171
- `Received ignored mutation event in read-only variables context: ${JSON.stringify(event)}`
3172
- );
3173
- return;
3174
- }
3175
- if (event.type === "set") {
3176
- const { name, ...varValue } = event.variable;
3177
- onChange == null ? void 0 : onChange({ ...contextValue.variables, [event.variable.name]: varValue });
3178
- if (event.openEditor) {
3179
- setEditing(event.variable.name);
3178
+ const valueBasedContextValue = useMemo7(
3179
+ () => ({
3180
+ flatVariables: flattenVariables(value),
3181
+ dispatch: (event) => {
3182
+ if (readOnly) {
3183
+ console.warn(
3184
+ `Received ignored mutation event in read-only variables context: ${JSON.stringify(event)}`
3185
+ );
3186
+ return;
3187
+ }
3188
+ if (event.type === "set") {
3189
+ const { name, ...varValue } = event.variable;
3190
+ onChange == null ? void 0 : onChange({ ...value, [event.variable.name]: varValue });
3191
+ if (event.openEditor) {
3192
+ setEditing(event.variable.name);
3193
+ setEditingContext(event.context);
3194
+ }
3195
+ } else if (event.type === "edit") {
3196
+ setEditing(event.variable);
3180
3197
  setEditingContext(event.context);
3198
+ } else if (event.type === "remove") {
3199
+ const newValue = { ...value };
3200
+ delete newValue[event.variable];
3201
+ onChange == null ? void 0 : onChange(newValue);
3202
+ } else if (event.type === "reorder") {
3203
+ onChange == null ? void 0 : onChange(event.result);
3204
+ } else if (event.type === "cancelEdit") {
3205
+ setEditing(void 0);
3206
+ setEditingContext(void 0);
3207
+ } else {
3208
+ throw new Error(`Unknown event ${JSON.stringify(event)}`);
3181
3209
  }
3182
- } else if (event.type === "edit") {
3183
- setEditing(event.variable);
3184
- setEditingContext(event.context);
3185
- } else if (event.type === "remove") {
3186
- const newValue = { ...value };
3187
- delete newValue[event.variable];
3188
- onChange == null ? void 0 : onChange(newValue);
3189
- } else if (event.type === "reorder") {
3190
- onChange == null ? void 0 : onChange(event.result);
3191
- } else if (event.type === "cancelEdit") {
3192
- setEditing(void 0);
3193
- setEditingContext(void 0);
3194
- } else {
3195
- throw new Error(`Unknown event ${JSON.stringify(event)}`);
3196
- }
3197
- },
3198
- variables: value,
3199
- isEditing: typeof editing !== "undefined",
3200
- events,
3201
- canDispatch: true,
3202
- readOnly,
3203
- knownUndefinedValues
3204
- };
3210
+ },
3211
+ variables: value,
3212
+ readOnly
3213
+ }),
3214
+ [onChange, readOnly, value]
3215
+ );
3216
+ const contextValue = useMemo7(() => {
3217
+ return {
3218
+ ...valueBasedContextValue,
3219
+ isEditing: typeof editing !== "undefined",
3220
+ events,
3221
+ canDispatch: true,
3222
+ knownUndefinedValues,
3223
+ isLoading: !!isLoading
3224
+ };
3225
+ }, [editing, events, knownUndefinedValues, valueBasedContextValue, isLoading]);
3205
3226
  return /* @__PURE__ */ jsxs17(VariablesContext.Provider, { value: contextValue, children: [
3206
3227
  children,
3207
3228
  typeof editing !== "undefined" ? /* @__PURE__ */ jsx31(
@@ -3224,7 +3245,7 @@ function VariablesProvider({
3224
3245
  ] });
3225
3246
  }
3226
3247
  function useVariables(returnEmptyWithoutProvider = false) {
3227
- const context = React10.useContext(VariablesContext);
3248
+ const context = useContext5(VariablesContext);
3228
3249
  if (!context) {
3229
3250
  if (returnEmptyWithoutProvider) {
3230
3251
  return {
@@ -3236,7 +3257,8 @@ function useVariables(returnEmptyWithoutProvider = false) {
3236
3257
  isEditing: false,
3237
3258
  variables: {},
3238
3259
  knownUndefinedValues: {},
3239
- canDispatch: false
3260
+ canDispatch: false,
3261
+ isLoading: false
3240
3262
  };
3241
3263
  }
3242
3264
  throw new Error("No VariablesProvider present");
@@ -3391,7 +3413,8 @@ function useVariablesMenu({
3391
3413
  hasClickEvent: canEditVariable(value, targetVariable),
3392
3414
  referenceIsValid: true,
3393
3415
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
3394
- isFresh: true
3416
+ isFresh: true,
3417
+ isLoading: false
3395
3418
  });
3396
3419
  if (nodeToReplace) {
3397
3420
  nodeToReplace.replace(variableNode);
@@ -3414,9 +3437,9 @@ function VariablesPlugin({
3414
3437
  filterVariable
3415
3438
  }) {
3416
3439
  const [editor] = useLexicalComposerContext2();
3417
- const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues } = useVariables(true);
3418
- const variablesRef = useRef8({ variables, knownUndefinedValues });
3419
- variablesRef.current = { variables, knownUndefinedValues };
3440
+ const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
3441
+ const variablesRef = useRef9({ variables, knownUndefinedValues, isLoading });
3442
+ variablesRef.current = { variables, knownUndefinedValues, isLoading };
3420
3443
  const canEditVariable = useCallback(
3421
3444
  (name, variable) => (
3422
3445
  // name === '' means new var. Add var perms computed by menu options.
@@ -3525,7 +3548,8 @@ function VariablesPlugin({
3525
3548
  hasClickEvent: canEditVariable(reference, targetVariable),
3526
3549
  referenceIsValid: true,
3527
3550
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
3528
- isFresh: true
3551
+ isFresh: true,
3552
+ isLoading: false
3529
3553
  });
3530
3554
  if (targetKey) {
3531
3555
  (_b = $getNodeByKey(targetKey)) == null ? void 0 : _b.replace(variableNode);
@@ -3543,17 +3567,20 @@ function VariablesPlugin({
3543
3567
  var _a, _b, _c;
3544
3568
  const targetVar = variablesRef.current.variables[variableNode.reference];
3545
3569
  const targetUndefinedVar = variablesRef.current.knownUndefinedValues[variableNode.reference];
3570
+ const isLoadingVariables = variablesRef.current.isLoading;
3546
3571
  const tooltip = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
3547
3572
  const currentState = variableNode.getState();
3548
3573
  const newState = {
3549
3574
  ...currentState,
3550
- // if we lose a display name we 'latch' it to last known (prevents flashes during mesh var updates)
3551
- displayName: (targetVar == null ? void 0 : targetVar.displayName) || currentState.displayName || variableNode.reference,
3575
+ // if we lose a display name we 'latch' it to last known (prevents flashes during mesh var updates),
3576
+ // unless we're also loading the whole var state
3577
+ displayName: (targetVar == null ? void 0 : targetVar.displayName) || (isLoadingVariables ? void 0 : currentState.displayName) || variableNode.reference,
3578
+ isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
3552
3579
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
3553
- referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : Boolean(targetVar),
3580
+ referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
3554
3581
  tooltip
3555
3582
  };
3556
- if (!dequal(currentState, newState)) {
3583
+ if (!dequal2(currentState, newState)) {
3557
3584
  variableNode.setState(newState);
3558
3585
  }
3559
3586
  },
@@ -3669,7 +3696,8 @@ var VariableNode = class _VariableNode extends DecoratorNode {
3669
3696
  referenceIsValid: true,
3670
3697
  isFresh: false,
3671
3698
  hasClickEvent: void 0,
3672
- tooltip: void 0
3699
+ tooltip: void 0,
3700
+ isLoading: false
3673
3701
  });
3674
3702
  }
3675
3703
  /** Gets the node's current state */
@@ -3729,6 +3757,7 @@ function VariableNodeComponent({
3729
3757
  }) {
3730
3758
  const [editor] = useLexicalComposerContext3();
3731
3759
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
3760
+ const readOnly = !editor.isEditable();
3732
3761
  const onDelete = useCallback2(
3733
3762
  (event) => {
3734
3763
  if (isSelected && $isNodeSelection($getSelection())) {
@@ -3810,7 +3839,9 @@ function VariableNodeComponent({
3810
3839
  {
3811
3840
  ...state,
3812
3841
  reference,
3842
+ displayName: state.isLoading ? /* @__PURE__ */ jsx33(LoadingIndicator2, { size: "sm" }) : state.displayName,
3813
3843
  selected: isSelected,
3844
+ disabled: readOnly,
3814
3845
  onClick: state.hasClickEvent ? () => {
3815
3846
  setSelected(!isSelected);
3816
3847
  editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
@@ -3920,7 +3951,7 @@ var input = css21`
3920
3951
  `;
3921
3952
 
3922
3953
  // src/components/Variables/toolbox/InputVariablesProvider.tsx
3923
- import * as React11 from "react";
3954
+ import * as React10 from "react";
3924
3955
  import { useMemo as useMemo9 } from "react";
3925
3956
 
3926
3957
  // src/components/Variables/util/hasReferencedVariables.ts
@@ -3951,14 +3982,14 @@ function useInputVariablesState({
3951
3982
  }) {
3952
3983
  const { variables } = useVariables(true);
3953
3984
  const hasVariablesInValue = hasReferencedVariables(value != null ? value : "");
3954
- const [lastKnownId] = React11.useState(id);
3955
- const [hadVariablesInValue, setHadVariablesInValue] = React11.useState(hasVariablesInValue);
3956
- React11.useEffect(() => {
3985
+ const [lastKnownId] = React10.useState(id);
3986
+ const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(hasVariablesInValue);
3987
+ React10.useEffect(() => {
3957
3988
  if (hasVariablesInValue) {
3958
3989
  setHadVariablesInValue(true);
3959
3990
  }
3960
3991
  }, [hasVariablesInValue]);
3961
- React11.useEffect(() => {
3992
+ React10.useEffect(() => {
3962
3993
  if (id !== lastKnownId) {
3963
3994
  setHadVariablesInValue(hasVariablesInValue);
3964
3995
  }
@@ -4033,10 +4064,10 @@ import { useLexicalComposerContext as useLexicalComposerContext6 } from "@lexica
4033
4064
  import { CLEAR_EDITOR_COMMAND } from "lexical";
4034
4065
 
4035
4066
  // src/components/Variables/toolbox/SelectVariableMenu.tsx
4067
+ import { BsFillPlusCircleFill } from "@react-icons/all-files/bs/BsFillPlusCircleFill";
4068
+ import { CgUsbC } from "@react-icons/all-files/cg/CgUsbC";
4036
4069
  import { HorizontalRhythm as HorizontalRhythm2, Menu as Menu2, MenuGroup as MenuGroup2, MenuItem as MenuItem3, MenuItemSeparator as MenuItemSeparator2 } from "@uniformdev/design-system";
4037
- import { useEffect as useEffect11, useRef as useRef9, useState as useState10 } from "react";
4038
- import { BsFillPlusCircleFill } from "react-icons/bs";
4039
- import { CgUsbC } from "react-icons/cg";
4070
+ import { useEffect as useEffect11, useRef as useRef10, useState as useState10 } from "react";
4040
4071
  import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
4041
4072
  function SelectVariableMenu({
4042
4073
  onSelectVariable,
@@ -4050,7 +4081,7 @@ function SelectVariableMenu({
4050
4081
  filterVariable
4051
4082
  }) {
4052
4083
  const { variables, dispatch, isEditing, canDispatch, readOnly } = useVariables(true);
4053
- const btnRef = useRef9(null);
4084
+ const btnRef = useRef10(null);
4054
4085
  const [openedAdd, setOpenedAdd] = useState10(false);
4055
4086
  useOnVariableUpdated(({ name, latestValue }) => {
4056
4087
  onSelectVariable == null ? void 0 : onSelectVariable({ ...latestValue[name], name });
@@ -4070,11 +4101,12 @@ function SelectVariableMenu({
4070
4101
  Menu2,
4071
4102
  {
4072
4103
  placement: "bottom-start",
4104
+ withoutPortal: true,
4073
4105
  menuTrigger: /* @__PURE__ */ jsx34(
4074
4106
  "button",
4075
4107
  {
4076
- title: menuTooltip,
4077
4108
  ...buttonProps,
4109
+ title: menuTooltip,
4078
4110
  ref: btnRef,
4079
4111
  css: [menuBtn, buttonCss],
4080
4112
  type: "button",
@@ -4188,7 +4220,7 @@ import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
4188
4220
  import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
4189
4221
  import { LexicalComposer } from "@lexical/react/LexicalComposer";
4190
4222
  import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
4191
- import { useMemo as useMemo10, useRef as useRef10, useState as useState11 } from "react";
4223
+ import { useMemo as useMemo10, useRef as useRef11, useState as useState11 } from "react";
4192
4224
 
4193
4225
  // src/components/Variables/composer/DisablePlugin.tsx
4194
4226
  import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
@@ -4273,8 +4305,8 @@ function VariablesComposer(props) {
4273
4305
  // eslint-disable-next-line react-hooks/exhaustive-deps
4274
4306
  []
4275
4307
  );
4276
- const editorState = useRef10();
4277
- const updateTimeout = useRef10();
4308
+ const editorState = useRef11();
4309
+ const updateTimeout = useRef11();
4278
4310
  if (typeof document === "undefined")
4279
4311
  return null;
4280
4312
  return /* @__PURE__ */ jsxs21(LexicalComposer, { initialConfig: editorConfig, children: [
@@ -4318,6 +4350,7 @@ import { ContentEditable } from "@lexical/react/LexicalContentEditable";
4318
4350
  import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
4319
4351
  import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
4320
4352
  import { PlainTextPlugin } from "@lexical/react/LexicalPlainTextPlugin";
4353
+ import { objectKlassEquals } from "@lexical/utils";
4321
4354
  import {
4322
4355
  $getSelection as $getSelection3,
4323
4356
  $isNodeSelection as $isNodeSelection2,
@@ -4349,7 +4382,7 @@ function RichishCopyAndPastePlugin() {
4349
4382
  editor.registerCommand(
4350
4383
  COPY_COMMAND,
4351
4384
  (event) => {
4352
- copyToClipboard(editor, event);
4385
+ copyToClipboard(editor, objectKlassEquals(event, ClipboardEvent) ? event : null);
4353
4386
  return true;
4354
4387
  },
4355
4388
  COMMAND_PRIORITY_HIGH2
@@ -4357,7 +4390,7 @@ function RichishCopyAndPastePlugin() {
4357
4390
  editor.registerCommand(
4358
4391
  CUT_COMMAND,
4359
4392
  (event) => {
4360
- copyToClipboard(editor, event);
4393
+ copyToClipboard(editor, objectKlassEquals(event, ClipboardEvent) ? event : null);
4361
4394
  editor.update(() => {
4362
4395
  const selection = $getSelection3();
4363
4396
  if ($isRangeSelection3(selection)) {
@@ -4441,7 +4474,7 @@ function InputVariables(props) {
4441
4474
  const { dispatch, canDispatch, isEditing } = useVariables(true);
4442
4475
  const { disableVariablesForReals, hadVariablesInValue, sharedMenuProps } = useInputVariablesState(props);
4443
4476
  const disableInlineVariablesForReals = disableVariablesForReals || disableInlineMenu;
4444
- const replaceValueOnVariableInsert = Boolean(inputWhenNoVariables && !hadVariablesInValue);
4477
+ const useInputWithNoVariables = Boolean(inputWhenNoVariables && !hadVariablesInValue);
4445
4478
  const input3 = /* @__PURE__ */ jsxs23(
4446
4479
  "div",
4447
4480
  {
@@ -4451,12 +4484,13 @@ function InputVariables(props) {
4451
4484
  }
4452
4485
  },
4453
4486
  children: [
4454
- inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx39(
4487
+ useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ jsx39(
4455
4488
  InputVariablesOverlayMenu,
4456
4489
  {
4457
4490
  ...sharedMenuProps,
4458
4491
  disabled: disableInlineVariablesForReals,
4459
- replaceValueOnVariableInsert,
4492
+ replaceValueOnVariableInsert: useInputWithNoVariables,
4493
+ useInputWhenNoVariables: useInputWithNoVariables,
4460
4494
  children: /* @__PURE__ */ jsx39(
4461
4495
  VariablesComposerInput,
4462
4496
  {
@@ -4484,7 +4518,7 @@ function InputVariables(props) {
4484
4518
  label,
4485
4519
  selectVariableMenuOptions: {
4486
4520
  ...sharedMenuProps,
4487
- replaceValueOnVariableInsert
4521
+ replaceValueOnVariableInsert: useInputWithNoVariables
4488
4522
  },
4489
4523
  id: finalId,
4490
4524
  isActive: hadVariablesInValue,
@@ -4504,12 +4538,12 @@ function InputVariables(props) {
4504
4538
  enableEditingVariables: !disabled && !disableVariablesForReals && enableEditingVariables,
4505
4539
  getEditorContext,
4506
4540
  disabled,
4507
- replaceValueOnVariableInsert,
4541
+ replaceValueOnVariableInsert: useInputWithNoVariables,
4508
4542
  autoFocus,
4509
4543
  filterVariable,
4510
4544
  children: [
4511
4545
  /* @__PURE__ */ jsx39(PasteTransformerPlugin, { transformPaste }),
4512
- /* @__PURE__ */ jsx39(ControlledValuePlugin, { value, enabled: !!inputWhenNoVariables && !hadVariablesInValue }),
4546
+ /* @__PURE__ */ jsx39(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
4513
4547
  editorRef ? /* @__PURE__ */ jsx39(EditorRefPlugin, { editorRef }) : null,
4514
4548
  body
4515
4549
  ]
@@ -4519,6 +4553,7 @@ function InputVariables(props) {
4519
4553
  function InputVariablesOverlayMenu({
4520
4554
  children,
4521
4555
  disabled,
4556
+ useInputWhenNoVariables,
4522
4557
  ...props
4523
4558
  }) {
4524
4559
  if (disabled) {
@@ -4530,7 +4565,7 @@ function InputVariablesOverlayMenu({
4530
4565
  VariablesComposerVariableMenu,
4531
4566
  {
4532
4567
  ...props,
4533
- tip: "Tip: access this list by typing $$",
4568
+ tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
4534
4569
  buttonCss: menuBtn2
4535
4570
  }
4536
4571
  )
@@ -4538,10 +4573,10 @@ function InputVariablesOverlayMenu({
4538
4573
  }
4539
4574
 
4540
4575
  // src/components/Variables/ParameterConnectionIndicator.tsx
4576
+ import { CgUsbC as CgUsbC2 } from "@react-icons/all-files/cg/CgUsbC";
4541
4577
  import { bindVariablesToObject } from "@uniformdev/canvas";
4542
4578
  import { HorizontalRhythm as HorizontalRhythm3, Menu as Menu3 } from "@uniformdev/design-system";
4543
4579
  import { useMemo as useMemo11 } from "react";
4544
- import { CgUsbC as CgUsbC2 } from "react-icons/cg";
4545
4580
 
4546
4581
  // src/components/Variables/styles/ParameterVariables.styles.ts
4547
4582
  import { css as css23 } from "@emotion/react";
@@ -4567,6 +4602,12 @@ var variableBindButton2 = css23`
4567
4602
  background: none;
4568
4603
  color: currentColor;
4569
4604
  }
4605
+
4606
+ // fixes menu resizing issue within iframes
4607
+ // see https://linear.app/uniform/issue/UNI-3068/mesh-integration-resizing-with-menus
4608
+ + [role='menu'] {
4609
+ max-height: unset;
4610
+ }
4570
4611
  `;
4571
4612
  var input2 = css23`
4572
4613
  display: block;
@@ -4607,7 +4648,8 @@ var input2 = css23`
4607
4648
  color: var(--gray-400);
4608
4649
  }
4609
4650
 
4610
- &[readonly] {
4651
+ &[readonly],
4652
+ &[contenteditable='false'] {
4611
4653
  cursor: not-allowed;
4612
4654
  color: var(--gray-400);
4613
4655
  }
@@ -4649,6 +4691,7 @@ function ParameterConnectionIndicator({
4649
4691
  Menu3,
4650
4692
  {
4651
4693
  placement: "bottom-start",
4694
+ withoutPortal: true,
4652
4695
  menuTrigger: /* @__PURE__ */ jsx40(
4653
4696
  "button",
4654
4697
  {
@@ -4743,7 +4786,7 @@ function ParameterVariables(props) {
4743
4786
  } = props;
4744
4787
  const { dispatch, canDispatch, isEditing } = useVariables(true);
4745
4788
  const { disableVariablesForReals, hadVariablesInValue, sharedMenuProps, hasVariablesInValue } = useInputVariablesState(props);
4746
- const replaceValueOnVariableInsert = Boolean(inputWhenNoVariables && !hadVariablesInValue);
4789
+ const useInputWhenNoVariables = Boolean(inputWhenNoVariables && !hadVariablesInValue);
4747
4790
  return /* @__PURE__ */ jsxs26(
4748
4791
  VariablesComposer,
4749
4792
  {
@@ -4755,12 +4798,12 @@ function ParameterVariables(props) {
4755
4798
  enableEditingVariables: !disabled,
4756
4799
  getEditorContext,
4757
4800
  disabled,
4758
- replaceValueOnVariableInsert,
4801
+ replaceValueOnVariableInsert: useInputWhenNoVariables,
4759
4802
  autoFocus,
4760
4803
  filterVariable,
4761
4804
  children: [
4762
4805
  editorRef ? /* @__PURE__ */ jsx42(EditorRefPlugin, { editorRef }) : null,
4763
- /* @__PURE__ */ jsx42(ControlledValuePlugin, { value, enabled: !!inputWhenNoVariables && !hadVariablesInValue }),
4806
+ /* @__PURE__ */ jsx42(ControlledValuePlugin, { value, enabled: useInputWhenNoVariables }),
4764
4807
  /* @__PURE__ */ jsxs26(
4765
4808
  HorizontalRhythm5,
4766
4809
  {
@@ -4773,7 +4816,7 @@ function ParameterVariables(props) {
4773
4816
  }
4774
4817
  },
4775
4818
  children: [
4776
- /* @__PURE__ */ jsx42("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
4819
+ /* @__PURE__ */ jsx42("div", { css: { flex: 1 }, children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
4777
4820
  VariablesComposerInput,
4778
4821
  {
4779
4822
  "aria-label": ariaLabel,
@@ -4790,9 +4833,9 @@ function ParameterVariables(props) {
4790
4833
  {
4791
4834
  ...sharedMenuProps,
4792
4835
  buttonCss: [variableBindButton2],
4793
- tip: "Tip: access this list by typing $$",
4836
+ tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
4794
4837
  buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
4795
- replaceValueOnVariableInsert
4838
+ replaceValueOnVariableInsert: useInputWhenNoVariables
4796
4839
  }
4797
4840
  )
4798
4841
  ]
@@ -5093,11 +5136,11 @@ import { InputSelect as InputSelect4, JsonEditor } from "@uniformdev/design-syst
5093
5136
  import { useState as useState13 } from "react";
5094
5137
 
5095
5138
  // src/components/Request/RequestProvider.tsx
5096
- import * as React12 from "react";
5139
+ import * as React11 from "react";
5097
5140
  import { jsx as jsx46 } from "@emotion/react/jsx-runtime";
5098
- var RequestContext = React12.createContext(null);
5141
+ var RequestContext = React11.createContext(null);
5099
5142
  function RequestProvider({ value, onChange, children }) {
5100
- const contextValue = React12.useMemo(() => {
5143
+ const contextValue = React11.useMemo(() => {
5101
5144
  return {
5102
5145
  dispatch: (event) => {
5103
5146
  if (event.type === "setRelativeUrl") {
@@ -5166,7 +5209,7 @@ function RequestProvider({ value, onChange, children }) {
5166
5209
  return /* @__PURE__ */ jsx46(RequestContext.Provider, { value: contextValue, children });
5167
5210
  }
5168
5211
  function useRequest() {
5169
- const context = React12.useContext(RequestContext);
5212
+ const context = React11.useContext(RequestContext);
5170
5213
  if (!context) {
5171
5214
  throw new Error("No RequestProvider present");
5172
5215
  }
@@ -5283,7 +5326,10 @@ import {
5283
5326
  WarningMessage as WarningMessage2
5284
5327
  } from "@uniformdev/design-system";
5285
5328
  import { jsx as jsx49, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
5286
- function RequestHeaders({ disableVariables }) {
5329
+ function RequestHeaders({
5330
+ disableVariables,
5331
+ addOmitIfEmpty
5332
+ }) {
5287
5333
  var _a, _b;
5288
5334
  const { dispatch, request } = useRequest();
5289
5335
  const deezHeaders = [...request.headers, { key: "", value: "" }];
@@ -5301,7 +5347,8 @@ function RequestHeaders({ disableVariables }) {
5301
5347
  return /* @__PURE__ */ jsx49("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs29(Table2, { children: [
5302
5348
  /* @__PURE__ */ jsx49(TableHead2, { children: /* @__PURE__ */ jsxs29(TableRow2, { children: [
5303
5349
  /* @__PURE__ */ jsx49(TableCellHead2, { children: "Name" }),
5304
- /* @__PURE__ */ jsx49(TableCellHead2, { children: "Value" })
5350
+ /* @__PURE__ */ jsx49(TableCellHead2, { children: "Value" }),
5351
+ addOmitIfEmpty ? /* @__PURE__ */ jsx49(TableCellHead2, { children: "Omit If Empty" }) : null
5305
5352
  ] }) }),
5306
5353
  /* @__PURE__ */ jsxs29(TableBody2, { children: [
5307
5354
  (_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
@@ -5349,7 +5396,24 @@ function RequestHeaders({ disableVariables }) {
5349
5396
  enableEditingVariables: true,
5350
5397
  "data-testid": "header-value"
5351
5398
  }
5352
- ) : null })
5399
+ ) : null }),
5400
+ addOmitIfEmpty ? /* @__PURE__ */ jsx49(TableCellData2, { width: "50%", children: header.key ? /* @__PURE__ */ jsx49(
5401
+ Input3,
5402
+ {
5403
+ type: "checkbox",
5404
+ checked: header.omitIfEmpty,
5405
+ "data-testid": "header-omitifempty",
5406
+ onChange: (e) => dispatch({
5407
+ type: "updateHeader",
5408
+ header: {
5409
+ key: header.key,
5410
+ value: header.value,
5411
+ omitIfEmpty: e.currentTarget.checked
5412
+ },
5413
+ index
5414
+ })
5415
+ }
5416
+ ) : null }) : null
5353
5417
  ] }, index);
5354
5418
  })
5355
5419
  ] })
@@ -5389,25 +5453,30 @@ import {
5389
5453
  WarningMessage as WarningMessage3
5390
5454
  } from "@uniformdev/design-system";
5391
5455
  import { jsx as jsx51, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
5392
- function RequestParameters({ disableVariables }) {
5456
+ function RequestParameters({
5457
+ disableVariables,
5458
+ addOmitIfEmpty
5459
+ }) {
5393
5460
  var _a, _b;
5394
5461
  const { dispatch, request } = useRequest();
5395
5462
  const deezParameters = [...request.parameters, { key: "", value: "" }];
5396
5463
  const handleUpdateParamFromMenu = ({
5397
5464
  key,
5398
5465
  value,
5466
+ omitIfEmpty,
5399
5467
  index
5400
5468
  }) => {
5401
5469
  dispatch({
5402
5470
  type: "updateParameter",
5403
- parameter: { key, value },
5471
+ parameter: { key, value, omitIfEmpty },
5404
5472
  index
5405
5473
  });
5406
5474
  };
5407
5475
  return /* @__PURE__ */ jsx51("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs30(Table3, { children: [
5408
5476
  /* @__PURE__ */ jsx51(TableHead3, { children: /* @__PURE__ */ jsxs30(TableRow3, { children: [
5409
5477
  /* @__PURE__ */ jsx51(TableCellHead3, { children: "Name" }),
5410
- /* @__PURE__ */ jsx51(TableCellHead3, { children: "Value" })
5478
+ /* @__PURE__ */ jsx51(TableCellHead3, { children: "Value" }),
5479
+ addOmitIfEmpty ? /* @__PURE__ */ jsx51(TableCellHead3, { children: "Omit If Empty" }) : null
5411
5480
  ] }) }),
5412
5481
  /* @__PURE__ */ jsxs30(TableBody3, { children: [
5413
5482
  (_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
@@ -5435,7 +5504,11 @@ function RequestParameters({ disableVariables }) {
5435
5504
  if (e.currentTarget.value) {
5436
5505
  dispatch({
5437
5506
  type: "updateParameter",
5438
- parameter: { key: e.currentTarget.value, value: parameter.value },
5507
+ parameter: {
5508
+ key: e.currentTarget.value,
5509
+ value: parameter.value,
5510
+ omitIfEmpty: parameter.omitIfEmpty
5511
+ },
5439
5512
  index
5440
5513
  });
5441
5514
  } else {
@@ -5452,6 +5525,7 @@ function RequestParameters({ disableVariables }) {
5452
5525
  onChange: (selectedVariable) => handleUpdateParamFromMenu({
5453
5526
  key: parameter.key,
5454
5527
  value: selectedVariable != null ? selectedVariable : "",
5528
+ omitIfEmpty: parameter.omitIfEmpty,
5455
5529
  index
5456
5530
  }),
5457
5531
  disableVariables,
@@ -5459,7 +5533,26 @@ function RequestParameters({ disableVariables }) {
5459
5533
  showAddVariableMenuOption: "Add variable...",
5460
5534
  enableEditingVariables: true
5461
5535
  }
5462
- ) : null })
5536
+ ) : null }),
5537
+ addOmitIfEmpty ? /* @__PURE__ */ jsx51(TableCellData3, { width: "50%", children: parameter.key ? /* @__PURE__ */ jsx51(
5538
+ Input4,
5539
+ {
5540
+ type: "checkbox",
5541
+ checked: parameter.omitIfEmpty,
5542
+ "data-testid": "parameter-omitifempty",
5543
+ onChange: (e) => {
5544
+ dispatch({
5545
+ type: "updateParameter",
5546
+ parameter: {
5547
+ key: parameter.key,
5548
+ value: parameter.value,
5549
+ omitIfEmpty: e.currentTarget.checked
5550
+ },
5551
+ index
5552
+ });
5553
+ }
5554
+ }
5555
+ ) : null }) : null
5463
5556
  ] }, index);
5464
5557
  })
5465
5558
  ] })
@@ -5738,15 +5831,15 @@ function convertRequestDataToDataType(dataType, requestData) {
5738
5831
  }
5739
5832
 
5740
5833
  // src/components/MeshApp.tsx
5741
- import { LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniformdev/design-system";
5834
+ import { LoadingIndicator as LoadingIndicator3, Theme as Theme2 } from "@uniformdev/design-system";
5742
5835
 
5743
5836
  // src/hooks/useInitializeUniformMeshSdk.ts
5744
5837
  import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
5745
- import { useEffect as useEffect15, useRef as useRef11, useState as useState14 } from "react";
5838
+ import { useEffect as useEffect15, useRef as useRef12, useState as useState14 } from "react";
5746
5839
  var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
5747
5840
  const [error, setError] = useState14();
5748
5841
  const [sdk, setSdk] = useState14();
5749
- const initializationInProgress = useRef11(false);
5842
+ const initializationInProgress = useRef12(false);
5750
5843
  useEffect15(
5751
5844
  () => {
5752
5845
  if (typeof window === "undefined" || sdk) {
@@ -5789,7 +5882,7 @@ var MeshApp = ({
5789
5882
  const { initializing, error, sdk } = useInitializeUniformMeshSdk();
5790
5883
  if (initializing || !sdk) {
5791
5884
  const LoadingComponent = loadingComponent;
5792
- return LoadingComponent ? /* @__PURE__ */ jsx56(LoadingComponent, {}) : /* @__PURE__ */ jsx56(LoadingIndicator2, {});
5885
+ return LoadingComponent ? /* @__PURE__ */ jsx56(LoadingComponent, {}) : /* @__PURE__ */ jsx56(LoadingIndicator3, {});
5793
5886
  }
5794
5887
  if (error) {
5795
5888
  const ErrorComponent = errorComponent;
@@ -5806,7 +5899,7 @@ var MeshApp = ({
5806
5899
 
5807
5900
  // src/components/ObjectSearch/DataRefreshButton.tsx
5808
5901
  import { css as css30 } from "@emotion/react";
5809
- import { Button as Button3, LoadingIndicator as LoadingIndicator3 } from "@uniformdev/design-system";
5902
+ import { Button as Button3, LoadingIndicator as LoadingIndicator4 } from "@uniformdev/design-system";
5810
5903
  import { jsx as jsx57, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
5811
5904
  var DataRefreshButton = ({
5812
5905
  buttonText,
@@ -5816,7 +5909,7 @@ var DataRefreshButton = ({
5816
5909
  }) => {
5817
5910
  return /* @__PURE__ */ jsxs33(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
5818
5911
  !isLoading ? null : /* @__PURE__ */ jsx57(
5819
- LoadingIndicator3,
5912
+ LoadingIndicator4,
5820
5913
  {
5821
5914
  css: css30`
5822
5915
  ${isLoading ? "opacity: 0.2;" : void 0}
@@ -6711,7 +6804,7 @@ var QueryFilter = ({
6711
6804
  };
6712
6805
 
6713
6806
  // src/components/ParamTypeDynamicDataProvider.tsx
6714
- import { useEffect as useEffect17, useMemo as useMemo15, useRef as useRef12 } from "react";
6807
+ import { useEffect as useEffect17, useMemo as useMemo15, useRef as useRef13 } from "react";
6715
6808
  import { jsx as jsx67 } from "@emotion/react/jsx-runtime";
6716
6809
  function ParamTypeDynamicDataProvider(props) {
6717
6810
  const { children } = props;
@@ -6733,7 +6826,7 @@ var JsonMeshVariableEditor = ({
6733
6826
  variable,
6734
6827
  context
6735
6828
  }) => {
6736
- const sillyRef = useRef12(false);
6829
+ const sillyRef = useRef13(false);
6737
6830
  const { editConnectedData } = useMeshLocation("paramType");
6738
6831
  useEffect17(() => {
6739
6832
  if (sillyRef.current) {
@@ -6784,7 +6877,7 @@ import {
6784
6877
  InputSelect as InputSelect8,
6785
6878
  InputToggle,
6786
6879
  Label,
6787
- LoadingIndicator as LoadingIndicator4,
6880
+ LoadingIndicator as LoadingIndicator5,
6788
6881
  LoadingOverlay as LoadingOverlay2,
6789
6882
  Menu as Menu4,
6790
6883
  MenuItem as MenuItem4,
@@ -6839,7 +6932,7 @@ export {
6839
6932
  InputVariables,
6840
6933
  Label,
6841
6934
  LinkButton,
6842
- LoadingIndicator4 as LoadingIndicator,
6935
+ LoadingIndicator5 as LoadingIndicator,
6843
6936
  LoadingOverlay2 as LoadingOverlay,
6844
6937
  Menu4 as Menu,
6845
6938
  MenuItem4 as MenuItem,