@uniformdev/mesh-sdk-react 19.131.1-alpha.8 → 19.133.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
@@ -979,9 +979,10 @@ type VariableEditorCompleteEvent<TEditVariableCompletedContext, TEditVariableCan
979
979
  /**
980
980
  * Arbitrary object that was returned by the variables editor component's onCancel
981
981
  * Can be used to convey context data about the submit from custom editor components
982
- * to their consumers. Always `null` using the default variables editor.
982
+ * to their consumers. Always `null` using the default variables editor. Can always be undefined
983
+ * if the editor is dismissed by the variables provider instead of user action.
983
984
  */
984
- editorCancelledContext: TEditVariableCancelledContext;
985
+ editorCancelledContext?: TEditVariableCancelledContext;
985
986
  };
986
987
  type VariablesEvents<TEditVariableCompletedContext, TEditVariableCancelledContext> = {
987
988
  editCompleted: VariableEditorCompleteEvent<TEditVariableCompletedContext, TEditVariableCancelledContext>;
@@ -1007,6 +1008,12 @@ type VariablesContext<TEditVariableContext, TEditVariableCompletedContext, TEdit
1007
1008
  isEditing: boolean;
1008
1009
  /** Add event handles (don't forget to unhook) */
1009
1010
  events: Emitter<VariablesEvents<TEditVariableCompletedContext, TEditVariableCancelledContext>>;
1011
+ /**
1012
+ * Creates an exclusive, promise-based variable editing transaction that definitely returns a result.
1013
+ * Only one edit can occur at a time; if another edit is started, the previous one will be resolved as cancelled.
1014
+ * Note: this is an alternative to emitting editing events with dispatch directly that can be easier to consume when a result is required.
1015
+ */
1016
+ editVariableTxn: (variable: string, context?: TEditVariableContext) => Promise<VariableEditorCompleteEvent<TEditVariableCompletedContext, TEditVariableCancelledContext>>;
1010
1017
  /** Whether the context is backed by a provider, or is just a readonly fake */
1011
1018
  canDispatch: boolean;
1012
1019
  /**
package/dist/index.d.ts CHANGED
@@ -979,9 +979,10 @@ type VariableEditorCompleteEvent<TEditVariableCompletedContext, TEditVariableCan
979
979
  /**
980
980
  * Arbitrary object that was returned by the variables editor component's onCancel
981
981
  * Can be used to convey context data about the submit from custom editor components
982
- * to their consumers. Always `null` using the default variables editor.
982
+ * to their consumers. Always `null` using the default variables editor. Can always be undefined
983
+ * if the editor is dismissed by the variables provider instead of user action.
983
984
  */
984
- editorCancelledContext: TEditVariableCancelledContext;
985
+ editorCancelledContext?: TEditVariableCancelledContext;
985
986
  };
986
987
  type VariablesEvents<TEditVariableCompletedContext, TEditVariableCancelledContext> = {
987
988
  editCompleted: VariableEditorCompleteEvent<TEditVariableCompletedContext, TEditVariableCancelledContext>;
@@ -1007,6 +1008,12 @@ type VariablesContext<TEditVariableContext, TEditVariableCompletedContext, TEdit
1007
1008
  isEditing: boolean;
1008
1009
  /** Add event handles (don't forget to unhook) */
1009
1010
  events: Emitter<VariablesEvents<TEditVariableCompletedContext, TEditVariableCancelledContext>>;
1011
+ /**
1012
+ * Creates an exclusive, promise-based variable editing transaction that definitely returns a result.
1013
+ * Only one edit can occur at a time; if another edit is started, the previous one will be resolved as cancelled.
1014
+ * Note: this is an alternative to emitting editing events with dispatch directly that can be easier to consume when a result is required.
1015
+ */
1016
+ editVariableTxn: (variable: string, context?: TEditVariableContext) => Promise<VariableEditorCompleteEvent<TEditVariableCompletedContext, TEditVariableCancelledContext>>;
1010
1017
  /** Whether the context is backed by a provider, or is just a readonly fake */
1011
1018
  canDispatch: boolean;
1012
1019
  /**
package/dist/index.esm.js CHANGED
@@ -2933,9 +2933,9 @@ import { LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system
2933
2933
  import {
2934
2934
  $getNearestNodeFromDOMNode,
2935
2935
  $getNodeByKey as $getNodeByKey2,
2936
- $getSelection,
2936
+ $getSelection as $getSelection2,
2937
2937
  $isDecoratorNode,
2938
- $isNodeSelection,
2938
+ $isNodeSelection as $isNodeSelection2,
2939
2939
  $isRangeSelection,
2940
2940
  COMMAND_PRIORITY_EDITOR,
2941
2941
  COMMAND_PRIORITY_LOW,
@@ -2945,7 +2945,7 @@ import {
2945
2945
  KEY_BACKSPACE_COMMAND,
2946
2946
  KEY_DELETE_COMMAND
2947
2947
  } from "lexical";
2948
- import { useCallback as useCallback2, useEffect as useEffect8 } from "react";
2948
+ import { useCallback as useCallback3, useEffect as useEffect8 } from "react";
2949
2949
 
2950
2950
  // src/components/Variables/util/prettifyBindExpression.tsx
2951
2951
  function prettifyBindExpression(bindExpression) {
@@ -3026,12 +3026,15 @@ import { dequal as dequal2 } from "dequal/lite";
3026
3026
  import {
3027
3027
  $createTextNode,
3028
3028
  $getNodeByKey,
3029
+ $getSelection,
3029
3030
  $insertNodes,
3031
+ $isNodeSelection,
3030
3032
  $nodesOfType as $nodesOfType2,
3033
+ $setSelection,
3031
3034
  COMMAND_PRIORITY_NORMAL,
3032
3035
  createCommand
3033
3036
  } from "lexical";
3034
- import { useCallback, useEffect as useEffect7, useMemo as useMemo8, useRef as useRef10, useState as useState10 } from "react";
3037
+ import { useCallback as useCallback2, useEffect as useEffect7, useMemo as useMemo8, useRef as useRef10, useState as useState10 } from "react";
3035
3038
  import { createPortal } from "react-dom";
3036
3039
 
3037
3040
  // src/components/Variables/toolbox/SelectVariableMenu.styles.ts
@@ -3063,12 +3066,56 @@ var variablesTipText = css18`
3063
3066
  padding: 0 var(--spacing-sm);
3064
3067
  `;
3065
3068
 
3066
- // src/components/Variables/useVariableEditor.ts
3067
- import { useEffect as useEffect6, useState as useState9 } from "react";
3068
-
3069
3069
  // src/components/Variables/VariablesProvider.tsx
3070
3070
  import mitt from "mitt";
3071
- import { createContext as createContext3, useContext as useContext5, useMemo as useMemo7, useState as useState8 } from "react";
3071
+ import { createContext as createContext3, useContext as useContext5, useMemo as useMemo7, useState as useState9 } from "react";
3072
+
3073
+ // src/components/Variables/util/useVariableEditTransaction.ts
3074
+ import { useCallback, useEffect as useEffect6, useState as useState8 } from "react";
3075
+ function useVariableEditTransaction({
3076
+ events,
3077
+ dispatch,
3078
+ isEditing,
3079
+ variables
3080
+ }) {
3081
+ const [isEditingBinding, setIsEditingBinding] = useState8();
3082
+ useEffect6(() => {
3083
+ if (!isEditingBinding) {
3084
+ return;
3085
+ }
3086
+ const fn = (e) => {
3087
+ isEditingBinding.resolve(e);
3088
+ setIsEditingBinding(void 0);
3089
+ };
3090
+ events.on("editCompleted", fn);
3091
+ return () => events.off("editCompleted", fn);
3092
+ }, [events, isEditingBinding, variables]);
3093
+ useEffect6(() => {
3094
+ if (!isEditing) {
3095
+ if (isEditingBinding) {
3096
+ isEditingBinding.resolve({ canceled: true });
3097
+ }
3098
+ setIsEditingBinding(void 0);
3099
+ }
3100
+ }, [isEditing, isEditingBinding]);
3101
+ return useCallback(
3102
+ async function editVariableTxn(variable, context) {
3103
+ if (isEditingBinding) {
3104
+ dispatch({ type: "cancelEdit" });
3105
+ }
3106
+ return new Promise((resolve) => {
3107
+ setTimeout(() => {
3108
+ setIsEditingBinding({
3109
+ resolve,
3110
+ variable
3111
+ });
3112
+ dispatch({ type: "edit", variable, context });
3113
+ });
3114
+ });
3115
+ },
3116
+ [dispatch, isEditingBinding]
3117
+ );
3118
+ }
3072
3119
 
3073
3120
  // src/components/Variables/VariableEditor.tsx
3074
3121
  import { zodResolver } from "@hookform/resolvers/zod";
@@ -3220,8 +3267,8 @@ function VariablesProvider({
3220
3267
  children,
3221
3268
  knownUndefinedValues = {}
3222
3269
  }) {
3223
- const [editing, setEditing] = useState8();
3224
- const [editingContext, setEditingContext] = useState8();
3270
+ const [editing, setEditing] = useState9();
3271
+ const [editingContext, setEditingContext] = useState9();
3225
3272
  const events = useMemo7(
3226
3273
  () => mitt(),
3227
3274
  []
@@ -3268,16 +3315,23 @@ function VariablesProvider({
3268
3315
  }),
3269
3316
  [onChange, readOnly, value]
3270
3317
  );
3318
+ const editVariableTxn = useVariableEditTransaction({
3319
+ events,
3320
+ dispatch: valueBasedContextValue.dispatch,
3321
+ isEditing: typeof editing !== "undefined",
3322
+ variables: value
3323
+ });
3271
3324
  const contextValue = useMemo7(() => {
3272
3325
  return {
3273
3326
  ...valueBasedContextValue,
3327
+ editVariableTxn,
3274
3328
  isEditing: typeof editing !== "undefined",
3275
3329
  events,
3276
3330
  canDispatch: true,
3277
3331
  knownUndefinedValues,
3278
3332
  isLoading: !!isLoading
3279
3333
  };
3280
- }, [editing, events, knownUndefinedValues, valueBasedContextValue, isLoading]);
3334
+ }, [valueBasedContextValue, editVariableTxn, editing, events, knownUndefinedValues, isLoading]);
3281
3335
  return /* @__PURE__ */ jsxs17(VariablesContext.Provider, { value: contextValue, children: [
3282
3336
  children,
3283
3337
  typeof editing !== "undefined" ? /* @__PURE__ */ jsx32(
@@ -3316,6 +3370,9 @@ function useVariables(returnEmptyWithoutProvider = false) {
3316
3370
  dispatch: () => {
3317
3371
  throw new Error("No VariablesProvider present");
3318
3372
  },
3373
+ editVariableTxn: async () => {
3374
+ throw new Error("No VariablesProvider present");
3375
+ },
3319
3376
  events: mitt(),
3320
3377
  isEditing: false,
3321
3378
  variables: {},
@@ -3338,39 +3395,13 @@ function flattenVariables(variables) {
3338
3395
 
3339
3396
  // src/components/Variables/useVariableEditor.ts
3340
3397
  function useVariableEditor() {
3341
- const { variables, events, canDispatch, dispatch, isEditing } = useVariables(true);
3342
- const [isEditingBinding, setIsEditingBinding] = useState9();
3343
- useEffect6(() => {
3344
- if (!canDispatch || !isEditingBinding) {
3345
- return;
3346
- }
3347
- const fn = (e) => {
3348
- isEditingBinding.resolve(e);
3349
- setIsEditingBinding(void 0);
3350
- };
3351
- events.on("editCompleted", fn);
3352
- return () => events.off("editCompleted", fn);
3353
- }, [canDispatch, events, isEditingBinding, variables]);
3354
- useEffect6(() => {
3355
- if (!isEditing) {
3356
- setIsEditingBinding(void 0);
3357
- }
3358
- }, [isEditing]);
3398
+ const { editVariableTxn, canDispatch } = useVariables(true);
3359
3399
  return {
3360
3400
  async editVariable(variable, context) {
3361
3401
  if (!canDispatch) {
3362
3402
  throw new Error("Cannot edit variable. VariablesProvider is not mounted.");
3363
3403
  }
3364
- if (isEditingBinding) {
3365
- throw new Error("Cannot edit variable. Another variable is already being edited.");
3366
- }
3367
- return new Promise((resolve) => {
3368
- setIsEditingBinding({
3369
- resolve,
3370
- variable
3371
- });
3372
- dispatch({ type: "edit", variable, context });
3373
- });
3404
+ return editVariableTxn(variable, context);
3374
3405
  }
3375
3406
  };
3376
3407
  }
@@ -3467,7 +3498,7 @@ function useVariablesMenu({
3467
3498
  getEditorContext
3468
3499
  }) {
3469
3500
  const { variables, canDispatch, readOnly } = useVariables(true);
3470
- const canEditVariable = useCallback(
3501
+ const canEditVariable = useCallback2(
3471
3502
  (name, variable) => (
3472
3503
  // name === '' means new var. Add var perms computed by menu options.
3473
3504
  name === "" || canDispatch && enableEditingVariables && !readOnly && !(variable == null ? void 0 : variable.readOnly)
@@ -3497,7 +3528,7 @@ function useVariablesMenu({
3497
3528
  );
3498
3529
  return { menuOptions: menuOptions2, groupedVariables: groupedVariables2 };
3499
3530
  }, [variables, filterVariable, getEditorContext, canAddVariable, showAddVariableMenuOption]);
3500
- const onSelect = useCallback(
3531
+ const onSelect = useCallback2(
3501
3532
  ({ queryString, value, nodeToReplace, editor, overwriteExistingValue }) => {
3502
3533
  if (value === ADD_VARIABLE_OPTION) {
3503
3534
  editor.update(() => {
@@ -3547,7 +3578,7 @@ function VariablesPlugin({
3547
3578
  const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
3548
3579
  const variablesRef = useRef10({ variables, knownUndefinedValues, isLoading });
3549
3580
  variablesRef.current = { variables, knownUndefinedValues, isLoading };
3550
- const canEditVariable = useCallback(
3581
+ const canEditVariable = useCallback2(
3551
3582
  (name, variable) => (
3552
3583
  // name === '' means new var. Add var perms computed by menu options.
3553
3584
  name === "" || canDispatch && enableEditingVariables && !readOnly && !(variable == null ? void 0 : variable.readOnly)
@@ -3581,7 +3612,7 @@ function VariablesPlugin({
3581
3612
  )
3582
3613
  };
3583
3614
  }, [queryString, groupedVariables, menuOptions]);
3584
- const onSelectOption = useCallback(
3615
+ const onSelectOption = useCallback2(
3585
3616
  (selectedOption, nodeToReplace, closeMenu) => {
3586
3617
  onSelect({
3587
3618
  queryString: queryString != null ? queryString : void 0,
@@ -3608,6 +3639,15 @@ function VariablesPlugin({
3608
3639
  editor.dispatchCommand(DISCONNECT_VARIABLE_COMMAND, { sourceKey });
3609
3640
  return;
3610
3641
  }
3642
+ editor.update(() => {
3643
+ const selection = $getSelection();
3644
+ if ($isNodeSelection(selection)) {
3645
+ const selectedNodes = selection.getNodes();
3646
+ if (selectedNodes.every((node) => $isVariableNode(node))) {
3647
+ $setSelection(null);
3648
+ }
3649
+ }
3650
+ });
3611
3651
  return;
3612
3652
  }
3613
3653
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
@@ -3715,7 +3755,7 @@ function VariablesPlugin({
3715
3755
  editVariable,
3716
3756
  replaceValueOnVariableInsert
3717
3757
  ]);
3718
- const updateExistingNodeIfChanged = useCallback(
3758
+ const updateExistingNodeIfChanged = useCallback2(
3719
3759
  (variableNode) => {
3720
3760
  var _a, _b, _c;
3721
3761
  const targetVar = variablesRef.current.variables[variableNode.reference];
@@ -3914,9 +3954,9 @@ function VariableNodeComponent({
3914
3954
  const [editor] = useLexicalComposerContext3();
3915
3955
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
3916
3956
  const readOnly = !editor.isEditable();
3917
- const onDelete = useCallback2(
3957
+ const onDelete = useCallback3(
3918
3958
  (event) => {
3919
- if (isSelected && $isNodeSelection($getSelection())) {
3959
+ if (isSelected && $isNodeSelection2($getSelection2())) {
3920
3960
  event.preventDefault();
3921
3961
  const node = $getNodeByKey2(nodeKey);
3922
3962
  if ($isVariableNode(node)) {
@@ -3939,8 +3979,8 @@ function VariableNodeComponent({
3939
3979
  editor.registerCommand(
3940
3980
  KEY_ARROW_LEFT_COMMAND,
3941
3981
  (event) => {
3942
- const selection = $getSelection();
3943
- if ($isNodeSelection(selection)) {
3982
+ const selection = $getSelection2();
3983
+ if ($isNodeSelection2(selection)) {
3944
3984
  const nodes = selection.getNodes();
3945
3985
  if (nodes.length > 0) {
3946
3986
  event.preventDefault();
@@ -3966,8 +4006,8 @@ function VariableNodeComponent({
3966
4006
  editor.registerCommand(
3967
4007
  KEY_ARROW_RIGHT_COMMAND,
3968
4008
  (event) => {
3969
- const selection = $getSelection();
3970
- if ($isNodeSelection(selection) && !$isTargetWithinDecorator(event.target)) {
4009
+ const selection = $getSelection2();
4010
+ if ($isNodeSelection2(selection) && !$isTargetWithinDecorator(event.target)) {
3971
4011
  const nodes = selection.getNodes();
3972
4012
  if (nodes.length > 0) {
3973
4013
  event.preventDefault();
@@ -4036,7 +4076,7 @@ function EditorRefPlugin({
4036
4076
  // src/components/Variables/composer/PasteTransformerPlugin.tsx
4037
4077
  import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
4038
4078
  import { mergeRegister as mergeRegister3 } from "@lexical/utils";
4039
- import { $getSelection as $getSelection2, $isRangeSelection as $isRangeSelection2, COMMAND_PRIORITY_HIGH, PASTE_COMMAND } from "lexical";
4079
+ import { $getSelection as $getSelection3, $isRangeSelection as $isRangeSelection2, COMMAND_PRIORITY_HIGH, PASTE_COMMAND } from "lexical";
4040
4080
  import { useEffect as useEffect9 } from "react";
4041
4081
  function PasteTransformerPlugin({ transformPaste }) {
4042
4082
  const [editor] = useLexicalComposerContext5();
@@ -4046,7 +4086,7 @@ function PasteTransformerPlugin({ transformPaste }) {
4046
4086
  PASTE_COMMAND,
4047
4087
  (event) => {
4048
4088
  var _a;
4049
- const selection = $getSelection2();
4089
+ const selection = $getSelection3();
4050
4090
  const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
4051
4091
  if (pastedText && transformPaste && $isRangeSelection2(selection)) {
4052
4092
  const result = transformPaste(pastedText);
@@ -4540,8 +4580,8 @@ import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
4540
4580
  import { PlainTextPlugin } from "@lexical/react/LexicalPlainTextPlugin";
4541
4581
  import { mergeRegister as mergeRegister4, objectKlassEquals } from "@lexical/utils";
4542
4582
  import {
4543
- $getSelection as $getSelection3,
4544
- $isNodeSelection as $isNodeSelection2,
4583
+ $getSelection as $getSelection4,
4584
+ $isNodeSelection as $isNodeSelection3,
4545
4585
  $isRangeSelection as $isRangeSelection3,
4546
4586
  COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH2,
4547
4587
  COPY_COMMAND,
@@ -4591,10 +4631,10 @@ function RichishCopyAndPastePlugin() {
4591
4631
  objectKlassEquals(event, ClipboardEvent) ? event : null
4592
4632
  );
4593
4633
  editor.update(() => {
4594
- const selection = $getSelection3();
4634
+ const selection = $getSelection4();
4595
4635
  if ($isRangeSelection3(selection)) {
4596
4636
  selection.removeText();
4597
- } else if ($isNodeSelection2(selection)) {
4637
+ } else if ($isNodeSelection3(selection)) {
4598
4638
  selection.getNodes().forEach((node) => node.remove());
4599
4639
  }
4600
4640
  });
@@ -4605,12 +4645,12 @@ function RichishCopyAndPastePlugin() {
4605
4645
  editor.registerCommand(
4606
4646
  PASTE_COMMAND2,
4607
4647
  (event) => {
4608
- const selection = $getSelection3();
4648
+ const selection = $getSelection4();
4609
4649
  if ($isRangeSelection3(selection)) {
4610
4650
  event.preventDefault();
4611
4651
  editor.update(
4612
4652
  () => {
4613
- const selection2 = $getSelection3();
4653
+ const selection2 = $getSelection4();
4614
4654
  const clipboardData = event instanceof InputEvent || event instanceof KeyboardEvent ? null : event.clipboardData;
4615
4655
  if (clipboardData != null && $isRangeSelection3(selection2)) {
4616
4656
  const lexicalString = clipboardData.getData("application/x-lexical-editor");
@@ -4933,7 +4973,7 @@ function ParameterConnectionIndicator({
4933
4973
 
4934
4974
  // src/components/Variables/ParameterOrSingleVariable.tsx
4935
4975
  import { HorizontalRhythm as HorizontalRhythm5 } from "@uniformdev/design-system";
4936
- import { useCallback as useCallback3 } from "react";
4976
+ import { useCallback as useCallback4 } from "react";
4937
4977
 
4938
4978
  // src/components/Variables/composer/OnDisconnectPlugin.tsx
4939
4979
  import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
@@ -4992,7 +5032,7 @@ function ParameterOrSingleVariable(props) {
4992
5032
  hasVariablesInValue,
4993
5033
  setHadVariablesInValue
4994
5034
  } = useInputVariablesState(props);
4995
- const handleDisconnect = useCallback3(
5035
+ const handleDisconnect = useCallback4(
4996
5036
  (variable) => {
4997
5037
  setHadVariablesInValue(false);
4998
5038
  if (onDisconnect) {
@@ -6197,7 +6237,7 @@ import { Callout as Callout5, Container, IconsProvider, ScrollableList, Vertical
6197
6237
  import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
6198
6238
  import {
6199
6239
  createContext as createContext5,
6200
- useCallback as useCallback4,
6240
+ useCallback as useCallback5,
6201
6241
  useContext as useContext7,
6202
6242
  useDeferredValue,
6203
6243
  useMemo as useMemo14,
@@ -6234,7 +6274,7 @@ var ObjectSearchProvider = ({
6234
6274
  const querySearchDeferred = useDeferredValue(query);
6235
6275
  const [selectedItems, setSelectedItems] = useState16(currentlySelectedItems != null ? currentlySelectedItems : []);
6236
6276
  const [list, setList] = useState16({});
6237
- const onSetQuery = useCallback4(
6277
+ const onSetQuery = useCallback5(
6238
6278
  (value2) => {
6239
6279
  if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
6240
6280
  return setQuery({
@@ -6246,7 +6286,7 @@ var ObjectSearchProvider = ({
6246
6286
  },
6247
6287
  [setQuery]
6248
6288
  );
6249
- const onSelectItem = useCallback4(
6289
+ const onSelectItem = useCallback5(
6250
6290
  (selectedResult) => {
6251
6291
  if (Array.isArray(selectedResult)) {
6252
6292
  setSelectedItems(selectedResult);
@@ -6260,10 +6300,10 @@ var ObjectSearchProvider = ({
6260
6300
  },
6261
6301
  [setSelectedItems, selectedItems]
6262
6302
  );
6263
- const onRemoveAllSelectedItems = useCallback4(() => {
6303
+ const onRemoveAllSelectedItems = useCallback5(() => {
6264
6304
  setSelectedItems([]);
6265
6305
  }, [setSelectedItems]);
6266
- const onSetList = useCallback4(
6306
+ const onSetList = useCallback5(
6267
6307
  (value2) => {
6268
6308
  setList(value2);
6269
6309
  },
package/dist/index.js CHANGED
@@ -3242,23 +3242,67 @@ var variablesTipText = import_react33.css`
3242
3242
  padding: 0 var(--spacing-sm);
3243
3243
  `;
3244
3244
 
3245
- // src/components/Variables/useVariableEditor.ts
3246
- var import_react37 = require("react");
3247
-
3248
3245
  // src/components/Variables/VariablesProvider.tsx
3249
3246
  var import_mitt = __toESM(require("mitt"));
3250
- var import_react36 = require("react");
3247
+ var import_react37 = require("react");
3248
+
3249
+ // src/components/Variables/util/useVariableEditTransaction.ts
3250
+ var import_react34 = require("react");
3251
+ function useVariableEditTransaction({
3252
+ events,
3253
+ dispatch,
3254
+ isEditing,
3255
+ variables
3256
+ }) {
3257
+ const [isEditingBinding, setIsEditingBinding] = (0, import_react34.useState)();
3258
+ (0, import_react34.useEffect)(() => {
3259
+ if (!isEditingBinding) {
3260
+ return;
3261
+ }
3262
+ const fn = (e) => {
3263
+ isEditingBinding.resolve(e);
3264
+ setIsEditingBinding(void 0);
3265
+ };
3266
+ events.on("editCompleted", fn);
3267
+ return () => events.off("editCompleted", fn);
3268
+ }, [events, isEditingBinding, variables]);
3269
+ (0, import_react34.useEffect)(() => {
3270
+ if (!isEditing) {
3271
+ if (isEditingBinding) {
3272
+ isEditingBinding.resolve({ canceled: true });
3273
+ }
3274
+ setIsEditingBinding(void 0);
3275
+ }
3276
+ }, [isEditing, isEditingBinding]);
3277
+ return (0, import_react34.useCallback)(
3278
+ async function editVariableTxn(variable, context) {
3279
+ if (isEditingBinding) {
3280
+ dispatch({ type: "cancelEdit" });
3281
+ }
3282
+ return new Promise((resolve) => {
3283
+ setTimeout(() => {
3284
+ setIsEditingBinding({
3285
+ resolve,
3286
+ variable
3287
+ });
3288
+ dispatch({ type: "edit", variable, context });
3289
+ });
3290
+ });
3291
+ },
3292
+ [dispatch, isEditingBinding]
3293
+ );
3294
+ }
3251
3295
 
3252
3296
  // src/components/Variables/VariableEditor.tsx
3253
3297
  var import_zod = require("@hookform/resolvers/zod");
3254
3298
  var import_design_system16 = require("@uniformdev/design-system");
3255
- var import_react35 = require("react");
3299
+ var import_react36 = require("react");
3256
3300
  var import_react_hook_form = require("react-hook-form");
3257
3301
  var import_zod2 = require("zod");
3258
3302
 
3259
3303
  // src/components/Variables/styles/VariableEditor.styles.ts
3260
- var import_react34 = require("@emotion/react");
3261
- var variablesFormContainer = import_react34.css`
3304
+ var import_react35 = require("@emotion/react");
3305
+ var variablesFormContainer = import_react35.css`
3262
3306
  > * {
3263
3307
  margin: var(--spacing-base) 0 0;
3264
3308
  }
@@ -3311,9 +3355,9 @@ function VariableEditor({
3311
3355
  },
3312
3356
  activeWhenEditing: true
3313
3357
  });
3314
- const nameRef = (0, import_react35.useRef)(null);
3358
+ const nameRef = (0, import_react36.useRef)(null);
3315
3359
  const { ref, ...nameRegister } = register("name");
3316
- (0, import_react35.useLayoutEffect)(() => {
3360
+ (0, import_react36.useLayoutEffect)(() => {
3317
3361
  if (nameRef.current && !nameRef.current.value) {
3318
3362
  nameRef.current.focus();
3319
3363
  }
@@ -3389,7 +3433,7 @@ function VariableEditor({
3389
3433
 
3390
3434
  // src/components/Variables/VariablesProvider.tsx
3391
3435
  var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
3392
- var VariablesContext = (0, import_react36.createContext)(null);
3436
+ var VariablesContext = (0, import_react37.createContext)(null);
3393
3437
  function VariablesProvider({
3394
3438
  value,
3395
3439
  onChange,
@@ -3399,9 +3443,9 @@ function VariablesProvider({
3399
3443
  children,
3400
3444
  knownUndefinedValues = {}
3401
3445
  }) {
3402
- const [editing, setEditing] = (0, import_react36.useState)();
3403
- const [editingContext, setEditingContext] = (0, import_react36.useState)();
3404
- const events = (0, import_react36.useMemo)(
3446
+ const [editing, setEditing] = (0, import_react37.useState)();
3447
+ const [editingContext, setEditingContext] = (0, import_react37.useState)();
3448
+ const events = (0, import_react37.useMemo)(
3405
3449
  () => (0, import_mitt.default)(),
3406
3450
  []
3407
3451
  );
@@ -3409,7 +3453,7 @@ function VariablesProvider({
3409
3453
  throw new Error("onChange must be provided when readOnly is false");
3410
3454
  }
3411
3455
  const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
3412
- const valueBasedContextValue = (0, import_react36.useMemo)(
3456
+ const valueBasedContextValue = (0, import_react37.useMemo)(
3413
3457
  () => ({
3414
3458
  flatVariables: flattenVariables(value),
3415
3459
  dispatch: (event) => {
@@ -3447,16 +3491,23 @@ function VariablesProvider({
3447
3491
  }),
3448
3492
  [onChange, readOnly, value]
3449
3493
  );
3450
- const contextValue = (0, import_react36.useMemo)(() => {
3494
+ const editVariableTxn = useVariableEditTransaction({
3495
+ events,
3496
+ dispatch: valueBasedContextValue.dispatch,
3497
+ isEditing: typeof editing !== "undefined",
3498
+ variables: value
3499
+ });
3500
+ const contextValue = (0, import_react37.useMemo)(() => {
3451
3501
  return {
3452
3502
  ...valueBasedContextValue,
3503
+ editVariableTxn,
3453
3504
  isEditing: typeof editing !== "undefined",
3454
3505
  events,
3455
3506
  canDispatch: true,
3456
3507
  knownUndefinedValues,
3457
3508
  isLoading: !!isLoading
3458
3509
  };
3459
- }, [editing, events, knownUndefinedValues, valueBasedContextValue, isLoading]);
3510
+ }, [valueBasedContextValue, editVariableTxn, editing, events, knownUndefinedValues, isLoading]);
3460
3511
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(VariablesContext.Provider, { value: contextValue, children: [
3461
3512
  children,
3462
3513
  typeof editing !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -3487,7 +3538,7 @@ function VariablesProvider({
3487
3538
  ] });
3488
3539
  }
3489
3540
  function useVariables(returnEmptyWithoutProvider = false) {
3490
- const context = (0, import_react36.useContext)(VariablesContext);
3541
+ const context = (0, import_react37.useContext)(VariablesContext);
3491
3542
  if (!context) {
3492
3543
  if (returnEmptyWithoutProvider) {
3493
3544
  return {
@@ -3495,6 +3546,9 @@ function useVariables(returnEmptyWithoutProvider = false) {
3495
3546
  dispatch: () => {
3496
3547
  throw new Error("No VariablesProvider present");
3497
3548
  },
3549
+ editVariableTxn: async () => {
3550
+ throw new Error("No VariablesProvider present");
3551
+ },
3498
3552
  events: (0, import_mitt.default)(),
3499
3553
  isEditing: false,
3500
3554
  variables: {},
@@ -3517,39 +3571,13 @@ function flattenVariables(variables) {
3517
3571
 
3518
3572
  // src/components/Variables/useVariableEditor.ts
3519
3573
  function useVariableEditor() {
3520
- const { variables, events, canDispatch, dispatch, isEditing } = useVariables(true);
3521
- const [isEditingBinding, setIsEditingBinding] = (0, import_react37.useState)();
3522
- (0, import_react37.useEffect)(() => {
3523
- if (!canDispatch || !isEditingBinding) {
3524
- return;
3525
- }
3526
- const fn = (e) => {
3527
- isEditingBinding.resolve(e);
3528
- setIsEditingBinding(void 0);
3529
- };
3530
- events.on("editCompleted", fn);
3531
- return () => events.off("editCompleted", fn);
3532
- }, [canDispatch, events, isEditingBinding, variables]);
3533
- (0, import_react37.useEffect)(() => {
3534
- if (!isEditing) {
3535
- setIsEditingBinding(void 0);
3536
- }
3537
- }, [isEditing]);
3574
+ const { editVariableTxn, canDispatch } = useVariables(true);
3538
3575
  return {
3539
3576
  async editVariable(variable, context) {
3540
3577
  if (!canDispatch) {
3541
3578
  throw new Error("Cannot edit variable. VariablesProvider is not mounted.");
3542
3579
  }
3543
- if (isEditingBinding) {
3544
- throw new Error("Cannot edit variable. Another variable is already being edited.");
3545
- }
3546
- return new Promise((resolve) => {
3547
- setIsEditingBinding({
3548
- resolve,
3549
- variable
3550
- });
3551
- dispatch({ type: "edit", variable, context });
3552
- });
3580
+ return editVariableTxn(variable, context);
3553
3581
  }
3554
3582
  };
3555
3583
  }
@@ -3787,6 +3815,15 @@ function VariablesPlugin({
3787
3815
  editor.dispatchCommand(DISCONNECT_VARIABLE_COMMAND, { sourceKey });
3788
3816
  return;
3789
3817
  }
3818
+ editor.update(() => {
3819
+ const selection = (0, import_lexical3.$getSelection)();
3820
+ if ((0, import_lexical3.$isNodeSelection)(selection)) {
3821
+ const selectedNodes = selection.getNodes();
3822
+ if (selectedNodes.every((node) => $isVariableNode(node))) {
3823
+ (0, import_lexical3.$setSelection)(null);
3824
+ }
3825
+ }
3826
+ });
3790
3827
  return;
3791
3828
  }
3792
3829
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
package/dist/index.mjs CHANGED
@@ -2933,9 +2933,9 @@ import { LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system
2933
2933
  import {
2934
2934
  $getNearestNodeFromDOMNode,
2935
2935
  $getNodeByKey as $getNodeByKey2,
2936
- $getSelection,
2936
+ $getSelection as $getSelection2,
2937
2937
  $isDecoratorNode,
2938
- $isNodeSelection,
2938
+ $isNodeSelection as $isNodeSelection2,
2939
2939
  $isRangeSelection,
2940
2940
  COMMAND_PRIORITY_EDITOR,
2941
2941
  COMMAND_PRIORITY_LOW,
@@ -2945,7 +2945,7 @@ import {
2945
2945
  KEY_BACKSPACE_COMMAND,
2946
2946
  KEY_DELETE_COMMAND
2947
2947
  } from "lexical";
2948
- import { useCallback as useCallback2, useEffect as useEffect8 } from "react";
2948
+ import { useCallback as useCallback3, useEffect as useEffect8 } from "react";
2949
2949
 
2950
2950
  // src/components/Variables/util/prettifyBindExpression.tsx
2951
2951
  function prettifyBindExpression(bindExpression) {
@@ -3026,12 +3026,15 @@ import { dequal as dequal2 } from "dequal/lite";
3026
3026
  import {
3027
3027
  $createTextNode,
3028
3028
  $getNodeByKey,
3029
+ $getSelection,
3029
3030
  $insertNodes,
3031
+ $isNodeSelection,
3030
3032
  $nodesOfType as $nodesOfType2,
3033
+ $setSelection,
3031
3034
  COMMAND_PRIORITY_NORMAL,
3032
3035
  createCommand
3033
3036
  } from "lexical";
3034
- import { useCallback, useEffect as useEffect7, useMemo as useMemo8, useRef as useRef10, useState as useState10 } from "react";
3037
+ import { useCallback as useCallback2, useEffect as useEffect7, useMemo as useMemo8, useRef as useRef10, useState as useState10 } from "react";
3035
3038
  import { createPortal } from "react-dom";
3036
3039
 
3037
3040
  // src/components/Variables/toolbox/SelectVariableMenu.styles.ts
@@ -3063,12 +3066,56 @@ var variablesTipText = css18`
3063
3066
  padding: 0 var(--spacing-sm);
3064
3067
  `;
3065
3068
 
3066
- // src/components/Variables/useVariableEditor.ts
3067
- import { useEffect as useEffect6, useState as useState9 } from "react";
3068
-
3069
3069
  // src/components/Variables/VariablesProvider.tsx
3070
3070
  import mitt from "mitt";
3071
- import { createContext as createContext3, useContext as useContext5, useMemo as useMemo7, useState as useState8 } from "react";
3071
+ import { createContext as createContext3, useContext as useContext5, useMemo as useMemo7, useState as useState9 } from "react";
3072
+
3073
+ // src/components/Variables/util/useVariableEditTransaction.ts
3074
+ import { useCallback, useEffect as useEffect6, useState as useState8 } from "react";
3075
+ function useVariableEditTransaction({
3076
+ events,
3077
+ dispatch,
3078
+ isEditing,
3079
+ variables
3080
+ }) {
3081
+ const [isEditingBinding, setIsEditingBinding] = useState8();
3082
+ useEffect6(() => {
3083
+ if (!isEditingBinding) {
3084
+ return;
3085
+ }
3086
+ const fn = (e) => {
3087
+ isEditingBinding.resolve(e);
3088
+ setIsEditingBinding(void 0);
3089
+ };
3090
+ events.on("editCompleted", fn);
3091
+ return () => events.off("editCompleted", fn);
3092
+ }, [events, isEditingBinding, variables]);
3093
+ useEffect6(() => {
3094
+ if (!isEditing) {
3095
+ if (isEditingBinding) {
3096
+ isEditingBinding.resolve({ canceled: true });
3097
+ }
3098
+ setIsEditingBinding(void 0);
3099
+ }
3100
+ }, [isEditing, isEditingBinding]);
3101
+ return useCallback(
3102
+ async function editVariableTxn(variable, context) {
3103
+ if (isEditingBinding) {
3104
+ dispatch({ type: "cancelEdit" });
3105
+ }
3106
+ return new Promise((resolve) => {
3107
+ setTimeout(() => {
3108
+ setIsEditingBinding({
3109
+ resolve,
3110
+ variable
3111
+ });
3112
+ dispatch({ type: "edit", variable, context });
3113
+ });
3114
+ });
3115
+ },
3116
+ [dispatch, isEditingBinding]
3117
+ );
3118
+ }
3072
3119
 
3073
3120
  // src/components/Variables/VariableEditor.tsx
3074
3121
  import { zodResolver } from "@hookform/resolvers/zod";
@@ -3220,8 +3267,8 @@ function VariablesProvider({
3220
3267
  children,
3221
3268
  knownUndefinedValues = {}
3222
3269
  }) {
3223
- const [editing, setEditing] = useState8();
3224
- const [editingContext, setEditingContext] = useState8();
3270
+ const [editing, setEditing] = useState9();
3271
+ const [editingContext, setEditingContext] = useState9();
3225
3272
  const events = useMemo7(
3226
3273
  () => mitt(),
3227
3274
  []
@@ -3268,16 +3315,23 @@ function VariablesProvider({
3268
3315
  }),
3269
3316
  [onChange, readOnly, value]
3270
3317
  );
3318
+ const editVariableTxn = useVariableEditTransaction({
3319
+ events,
3320
+ dispatch: valueBasedContextValue.dispatch,
3321
+ isEditing: typeof editing !== "undefined",
3322
+ variables: value
3323
+ });
3271
3324
  const contextValue = useMemo7(() => {
3272
3325
  return {
3273
3326
  ...valueBasedContextValue,
3327
+ editVariableTxn,
3274
3328
  isEditing: typeof editing !== "undefined",
3275
3329
  events,
3276
3330
  canDispatch: true,
3277
3331
  knownUndefinedValues,
3278
3332
  isLoading: !!isLoading
3279
3333
  };
3280
- }, [editing, events, knownUndefinedValues, valueBasedContextValue, isLoading]);
3334
+ }, [valueBasedContextValue, editVariableTxn, editing, events, knownUndefinedValues, isLoading]);
3281
3335
  return /* @__PURE__ */ jsxs17(VariablesContext.Provider, { value: contextValue, children: [
3282
3336
  children,
3283
3337
  typeof editing !== "undefined" ? /* @__PURE__ */ jsx32(
@@ -3316,6 +3370,9 @@ function useVariables(returnEmptyWithoutProvider = false) {
3316
3370
  dispatch: () => {
3317
3371
  throw new Error("No VariablesProvider present");
3318
3372
  },
3373
+ editVariableTxn: async () => {
3374
+ throw new Error("No VariablesProvider present");
3375
+ },
3319
3376
  events: mitt(),
3320
3377
  isEditing: false,
3321
3378
  variables: {},
@@ -3338,39 +3395,13 @@ function flattenVariables(variables) {
3338
3395
 
3339
3396
  // src/components/Variables/useVariableEditor.ts
3340
3397
  function useVariableEditor() {
3341
- const { variables, events, canDispatch, dispatch, isEditing } = useVariables(true);
3342
- const [isEditingBinding, setIsEditingBinding] = useState9();
3343
- useEffect6(() => {
3344
- if (!canDispatch || !isEditingBinding) {
3345
- return;
3346
- }
3347
- const fn = (e) => {
3348
- isEditingBinding.resolve(e);
3349
- setIsEditingBinding(void 0);
3350
- };
3351
- events.on("editCompleted", fn);
3352
- return () => events.off("editCompleted", fn);
3353
- }, [canDispatch, events, isEditingBinding, variables]);
3354
- useEffect6(() => {
3355
- if (!isEditing) {
3356
- setIsEditingBinding(void 0);
3357
- }
3358
- }, [isEditing]);
3398
+ const { editVariableTxn, canDispatch } = useVariables(true);
3359
3399
  return {
3360
3400
  async editVariable(variable, context) {
3361
3401
  if (!canDispatch) {
3362
3402
  throw new Error("Cannot edit variable. VariablesProvider is not mounted.");
3363
3403
  }
3364
- if (isEditingBinding) {
3365
- throw new Error("Cannot edit variable. Another variable is already being edited.");
3366
- }
3367
- return new Promise((resolve) => {
3368
- setIsEditingBinding({
3369
- resolve,
3370
- variable
3371
- });
3372
- dispatch({ type: "edit", variable, context });
3373
- });
3404
+ return editVariableTxn(variable, context);
3374
3405
  }
3375
3406
  };
3376
3407
  }
@@ -3467,7 +3498,7 @@ function useVariablesMenu({
3467
3498
  getEditorContext
3468
3499
  }) {
3469
3500
  const { variables, canDispatch, readOnly } = useVariables(true);
3470
- const canEditVariable = useCallback(
3501
+ const canEditVariable = useCallback2(
3471
3502
  (name, variable) => (
3472
3503
  // name === '' means new var. Add var perms computed by menu options.
3473
3504
  name === "" || canDispatch && enableEditingVariables && !readOnly && !(variable == null ? void 0 : variable.readOnly)
@@ -3497,7 +3528,7 @@ function useVariablesMenu({
3497
3528
  );
3498
3529
  return { menuOptions: menuOptions2, groupedVariables: groupedVariables2 };
3499
3530
  }, [variables, filterVariable, getEditorContext, canAddVariable, showAddVariableMenuOption]);
3500
- const onSelect = useCallback(
3531
+ const onSelect = useCallback2(
3501
3532
  ({ queryString, value, nodeToReplace, editor, overwriteExistingValue }) => {
3502
3533
  if (value === ADD_VARIABLE_OPTION) {
3503
3534
  editor.update(() => {
@@ -3547,7 +3578,7 @@ function VariablesPlugin({
3547
3578
  const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
3548
3579
  const variablesRef = useRef10({ variables, knownUndefinedValues, isLoading });
3549
3580
  variablesRef.current = { variables, knownUndefinedValues, isLoading };
3550
- const canEditVariable = useCallback(
3581
+ const canEditVariable = useCallback2(
3551
3582
  (name, variable) => (
3552
3583
  // name === '' means new var. Add var perms computed by menu options.
3553
3584
  name === "" || canDispatch && enableEditingVariables && !readOnly && !(variable == null ? void 0 : variable.readOnly)
@@ -3581,7 +3612,7 @@ function VariablesPlugin({
3581
3612
  )
3582
3613
  };
3583
3614
  }, [queryString, groupedVariables, menuOptions]);
3584
- const onSelectOption = useCallback(
3615
+ const onSelectOption = useCallback2(
3585
3616
  (selectedOption, nodeToReplace, closeMenu) => {
3586
3617
  onSelect({
3587
3618
  queryString: queryString != null ? queryString : void 0,
@@ -3608,6 +3639,15 @@ function VariablesPlugin({
3608
3639
  editor.dispatchCommand(DISCONNECT_VARIABLE_COMMAND, { sourceKey });
3609
3640
  return;
3610
3641
  }
3642
+ editor.update(() => {
3643
+ const selection = $getSelection();
3644
+ if ($isNodeSelection(selection)) {
3645
+ const selectedNodes = selection.getNodes();
3646
+ if (selectedNodes.every((node) => $isVariableNode(node))) {
3647
+ $setSelection(null);
3648
+ }
3649
+ }
3650
+ });
3611
3651
  return;
3612
3652
  }
3613
3653
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
@@ -3715,7 +3755,7 @@ function VariablesPlugin({
3715
3755
  editVariable,
3716
3756
  replaceValueOnVariableInsert
3717
3757
  ]);
3718
- const updateExistingNodeIfChanged = useCallback(
3758
+ const updateExistingNodeIfChanged = useCallback2(
3719
3759
  (variableNode) => {
3720
3760
  var _a, _b, _c;
3721
3761
  const targetVar = variablesRef.current.variables[variableNode.reference];
@@ -3914,9 +3954,9 @@ function VariableNodeComponent({
3914
3954
  const [editor] = useLexicalComposerContext3();
3915
3955
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
3916
3956
  const readOnly = !editor.isEditable();
3917
- const onDelete = useCallback2(
3957
+ const onDelete = useCallback3(
3918
3958
  (event) => {
3919
- if (isSelected && $isNodeSelection($getSelection())) {
3959
+ if (isSelected && $isNodeSelection2($getSelection2())) {
3920
3960
  event.preventDefault();
3921
3961
  const node = $getNodeByKey2(nodeKey);
3922
3962
  if ($isVariableNode(node)) {
@@ -3939,8 +3979,8 @@ function VariableNodeComponent({
3939
3979
  editor.registerCommand(
3940
3980
  KEY_ARROW_LEFT_COMMAND,
3941
3981
  (event) => {
3942
- const selection = $getSelection();
3943
- if ($isNodeSelection(selection)) {
3982
+ const selection = $getSelection2();
3983
+ if ($isNodeSelection2(selection)) {
3944
3984
  const nodes = selection.getNodes();
3945
3985
  if (nodes.length > 0) {
3946
3986
  event.preventDefault();
@@ -3966,8 +4006,8 @@ function VariableNodeComponent({
3966
4006
  editor.registerCommand(
3967
4007
  KEY_ARROW_RIGHT_COMMAND,
3968
4008
  (event) => {
3969
- const selection = $getSelection();
3970
- if ($isNodeSelection(selection) && !$isTargetWithinDecorator(event.target)) {
4009
+ const selection = $getSelection2();
4010
+ if ($isNodeSelection2(selection) && !$isTargetWithinDecorator(event.target)) {
3971
4011
  const nodes = selection.getNodes();
3972
4012
  if (nodes.length > 0) {
3973
4013
  event.preventDefault();
@@ -4036,7 +4076,7 @@ function EditorRefPlugin({
4036
4076
  // src/components/Variables/composer/PasteTransformerPlugin.tsx
4037
4077
  import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
4038
4078
  import { mergeRegister as mergeRegister3 } from "@lexical/utils";
4039
- import { $getSelection as $getSelection2, $isRangeSelection as $isRangeSelection2, COMMAND_PRIORITY_HIGH, PASTE_COMMAND } from "lexical";
4079
+ import { $getSelection as $getSelection3, $isRangeSelection as $isRangeSelection2, COMMAND_PRIORITY_HIGH, PASTE_COMMAND } from "lexical";
4040
4080
  import { useEffect as useEffect9 } from "react";
4041
4081
  function PasteTransformerPlugin({ transformPaste }) {
4042
4082
  const [editor] = useLexicalComposerContext5();
@@ -4046,7 +4086,7 @@ function PasteTransformerPlugin({ transformPaste }) {
4046
4086
  PASTE_COMMAND,
4047
4087
  (event) => {
4048
4088
  var _a;
4049
- const selection = $getSelection2();
4089
+ const selection = $getSelection3();
4050
4090
  const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
4051
4091
  if (pastedText && transformPaste && $isRangeSelection2(selection)) {
4052
4092
  const result = transformPaste(pastedText);
@@ -4540,8 +4580,8 @@ import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
4540
4580
  import { PlainTextPlugin } from "@lexical/react/LexicalPlainTextPlugin";
4541
4581
  import { mergeRegister as mergeRegister4, objectKlassEquals } from "@lexical/utils";
4542
4582
  import {
4543
- $getSelection as $getSelection3,
4544
- $isNodeSelection as $isNodeSelection2,
4583
+ $getSelection as $getSelection4,
4584
+ $isNodeSelection as $isNodeSelection3,
4545
4585
  $isRangeSelection as $isRangeSelection3,
4546
4586
  COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH2,
4547
4587
  COPY_COMMAND,
@@ -4591,10 +4631,10 @@ function RichishCopyAndPastePlugin() {
4591
4631
  objectKlassEquals(event, ClipboardEvent) ? event : null
4592
4632
  );
4593
4633
  editor.update(() => {
4594
- const selection = $getSelection3();
4634
+ const selection = $getSelection4();
4595
4635
  if ($isRangeSelection3(selection)) {
4596
4636
  selection.removeText();
4597
- } else if ($isNodeSelection2(selection)) {
4637
+ } else if ($isNodeSelection3(selection)) {
4598
4638
  selection.getNodes().forEach((node) => node.remove());
4599
4639
  }
4600
4640
  });
@@ -4605,12 +4645,12 @@ function RichishCopyAndPastePlugin() {
4605
4645
  editor.registerCommand(
4606
4646
  PASTE_COMMAND2,
4607
4647
  (event) => {
4608
- const selection = $getSelection3();
4648
+ const selection = $getSelection4();
4609
4649
  if ($isRangeSelection3(selection)) {
4610
4650
  event.preventDefault();
4611
4651
  editor.update(
4612
4652
  () => {
4613
- const selection2 = $getSelection3();
4653
+ const selection2 = $getSelection4();
4614
4654
  const clipboardData = event instanceof InputEvent || event instanceof KeyboardEvent ? null : event.clipboardData;
4615
4655
  if (clipboardData != null && $isRangeSelection3(selection2)) {
4616
4656
  const lexicalString = clipboardData.getData("application/x-lexical-editor");
@@ -4933,7 +4973,7 @@ function ParameterConnectionIndicator({
4933
4973
 
4934
4974
  // src/components/Variables/ParameterOrSingleVariable.tsx
4935
4975
  import { HorizontalRhythm as HorizontalRhythm5 } from "@uniformdev/design-system";
4936
- import { useCallback as useCallback3 } from "react";
4976
+ import { useCallback as useCallback4 } from "react";
4937
4977
 
4938
4978
  // src/components/Variables/composer/OnDisconnectPlugin.tsx
4939
4979
  import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
@@ -4992,7 +5032,7 @@ function ParameterOrSingleVariable(props) {
4992
5032
  hasVariablesInValue,
4993
5033
  setHadVariablesInValue
4994
5034
  } = useInputVariablesState(props);
4995
- const handleDisconnect = useCallback3(
5035
+ const handleDisconnect = useCallback4(
4996
5036
  (variable) => {
4997
5037
  setHadVariablesInValue(false);
4998
5038
  if (onDisconnect) {
@@ -6197,7 +6237,7 @@ import { Callout as Callout5, Container, IconsProvider, ScrollableList, Vertical
6197
6237
  import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
6198
6238
  import {
6199
6239
  createContext as createContext5,
6200
- useCallback as useCallback4,
6240
+ useCallback as useCallback5,
6201
6241
  useContext as useContext7,
6202
6242
  useDeferredValue,
6203
6243
  useMemo as useMemo14,
@@ -6234,7 +6274,7 @@ var ObjectSearchProvider = ({
6234
6274
  const querySearchDeferred = useDeferredValue(query);
6235
6275
  const [selectedItems, setSelectedItems] = useState16(currentlySelectedItems != null ? currentlySelectedItems : []);
6236
6276
  const [list, setList] = useState16({});
6237
- const onSetQuery = useCallback4(
6277
+ const onSetQuery = useCallback5(
6238
6278
  (value2) => {
6239
6279
  if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
6240
6280
  return setQuery({
@@ -6246,7 +6286,7 @@ var ObjectSearchProvider = ({
6246
6286
  },
6247
6287
  [setQuery]
6248
6288
  );
6249
- const onSelectItem = useCallback4(
6289
+ const onSelectItem = useCallback5(
6250
6290
  (selectedResult) => {
6251
6291
  if (Array.isArray(selectedResult)) {
6252
6292
  setSelectedItems(selectedResult);
@@ -6260,10 +6300,10 @@ var ObjectSearchProvider = ({
6260
6300
  },
6261
6301
  [setSelectedItems, selectedItems]
6262
6302
  );
6263
- const onRemoveAllSelectedItems = useCallback4(() => {
6303
+ const onRemoveAllSelectedItems = useCallback5(() => {
6264
6304
  setSelectedItems([]);
6265
6305
  }, [setSelectedItems]);
6266
- const onSetList = useCallback4(
6306
+ const onSetList = useCallback5(
6267
6307
  (value2) => {
6268
6308
  setList(value2);
6269
6309
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk-react",
3
- "version": "19.131.1-alpha.8+d326c2787d",
3
+ "version": "19.133.0",
4
4
  "description": "Uniform Mesh Framework SDK for React",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -50,9 +50,9 @@
50
50
  "@lexical/selection": "^0.12.0",
51
51
  "@lexical/utils": "^0.12.0",
52
52
  "@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v4.10.1/react-icons-all-files-4.10.1.tgz",
53
- "@uniformdev/canvas": "19.131.1-alpha.8+d326c2787d",
54
- "@uniformdev/design-system": "19.131.1-alpha.8+d326c2787d",
55
- "@uniformdev/mesh-sdk": "19.131.1-alpha.8+d326c2787d",
53
+ "@uniformdev/canvas": "19.133.0",
54
+ "@uniformdev/design-system": "19.133.0",
55
+ "@uniformdev/mesh-sdk": "19.133.0",
56
56
  "dequal": "^2.0.3",
57
57
  "lexical": "^0.12.0",
58
58
  "mitt": "^3.0.0",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "d326c2787d0b159fcd7edb45b165a8eae54862e6"
89
+ "gitHead": "405a628b0f592ca13bf65006ef5c92261468c144"
90
90
  }