@uniformdev/mesh-sdk-react 19.88.0 → 19.88.1-alpha.7

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
@@ -2654,13 +2654,14 @@ function useConnectedDataAsVariables(connectedData) {
2654
2654
  }
2655
2655
 
2656
2656
  // src/hooks/useDynamicInputsAsVariables.tsx
2657
+ import { LOCALE_DYNAMIC_INPUT_NAME } from "@uniformdev/canvas";
2657
2658
  import { useMemo as useMemo4 } from "react";
2658
2659
  import { Fragment as Fragment4, jsx as jsx26 } from "@emotion/react/jsx-runtime";
2659
2660
  function useDynamicInputsAsVariables(dynamicInputs) {
2660
2661
  return useMemo4(() => {
2661
2662
  const result = Object.entries(dynamicInputs).reduce(
2662
2663
  (acc, [name, input3]) => {
2663
- const source = `from ${input3.type === "path" ? "URL path" : "query string"}`;
2664
+ const source = `from ${name === LOCALE_DYNAMIC_INPUT_NAME ? "current locale" : input3.type === "path" ? "URL path" : "query string"}`;
2664
2665
  acc[name] = {
2665
2666
  readOnly: true,
2666
2667
  type: input3.type,
@@ -2944,6 +2945,7 @@ function VariableChip({
2944
2945
  tooltip,
2945
2946
  reference,
2946
2947
  onClick,
2948
+ clickToEdit,
2947
2949
  isFresh,
2948
2950
  selected,
2949
2951
  disabled
@@ -2951,7 +2953,7 @@ function VariableChip({
2951
2953
  const hasClickEvent = !!onClick;
2952
2954
  const referenceIsValidFr = isFresh ? true : referenceIsValid;
2953
2955
  const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? Fragment5 : UndefinedVariableReference;
2954
- const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent ? "Click to edit" : void 0;
2956
+ const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
2955
2957
  return /* @__PURE__ */ jsx29(
2956
2958
  MultilineChip,
2957
2959
  {
@@ -3968,6 +3970,7 @@ function VariableNodeComponent({
3968
3970
  displayName: state.isLoading ? /* @__PURE__ */ jsx33(LoadingIndicator2, { size: "sm" }) : state.displayName,
3969
3971
  selected: isSelected,
3970
3972
  disabled: readOnly,
3973
+ clickToEdit: state.hasClickEvent,
3971
3974
  onClick: state.hasClickEvent ? () => {
3972
3975
  setSelected(!isSelected);
3973
3976
  editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
@@ -4459,6 +4462,7 @@ function VariablesComposer(props) {
4459
4462
  /* @__PURE__ */ jsx37(
4460
4463
  OnChangePlugin,
4461
4464
  {
4465
+ ignoreSelectionChange: true,
4462
4466
  onChange: (state) => {
4463
4467
  editorState.current = state;
4464
4468
  if (updateTimeout.current) {
package/dist/index.js CHANGED
@@ -2856,13 +2856,14 @@ function useConnectedDataAsVariables(connectedData) {
2856
2856
  }
2857
2857
 
2858
2858
  // src/hooks/useDynamicInputsAsVariables.tsx
2859
+ var import_canvas = require("@uniformdev/canvas");
2859
2860
  var import_react26 = require("react");
2860
2861
  var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
2861
2862
  function useDynamicInputsAsVariables(dynamicInputs) {
2862
2863
  return (0, import_react26.useMemo)(() => {
2863
2864
  const result = Object.entries(dynamicInputs).reduce(
2864
2865
  (acc, [name, input3]) => {
2865
- const source = `from ${input3.type === "path" ? "URL path" : "query string"}`;
2866
+ const source = `from ${name === import_canvas.LOCALE_DYNAMIC_INPUT_NAME ? "current locale" : input3.type === "path" ? "URL path" : "query string"}`;
2866
2867
  acc[name] = {
2867
2868
  readOnly: true,
2868
2869
  type: input3.type,
@@ -2981,11 +2982,11 @@ var import_lite = require("dequal/lite");
2981
2982
  var import_react30 = require("react");
2982
2983
 
2983
2984
  // src/components/Variables/util/deserializeVariablesEditorState.ts
2984
- var import_canvas = require("@uniformdev/canvas");
2985
+ var import_canvas2 = require("@uniformdev/canvas");
2985
2986
  var import_lexical = require("lexical");
2986
2987
  function deserializeVariablesEditorState(serialized) {
2987
2988
  const result = [];
2988
- (0, import_canvas.parseVariableExpression)(serialized != null ? serialized : "", (token, type) => {
2989
+ (0, import_canvas2.parseVariableExpression)(serialized != null ? serialized : "", (token, type) => {
2989
2990
  if (type === "text") {
2990
2991
  const node = {
2991
2992
  type: import_lexical.TextNode.getType(),
@@ -3112,7 +3113,7 @@ var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerCont
3112
3113
  var import_useLexicalNodeSelection = require("@lexical/react/useLexicalNodeSelection");
3113
3114
  var import_selection = require("@lexical/selection");
3114
3115
  var import_utils2 = require("@lexical/utils");
3115
- var import_canvas3 = require("@uniformdev/canvas");
3116
+ var import_canvas4 = require("@uniformdev/canvas");
3116
3117
  var import_design_system18 = require("@uniformdev/design-system");
3117
3118
  var import_lexical4 = require("lexical");
3118
3119
  var import_react39 = require("react");
@@ -3132,6 +3133,7 @@ function VariableChip({
3132
3133
  tooltip,
3133
3134
  reference,
3134
3135
  onClick,
3136
+ clickToEdit,
3135
3137
  isFresh,
3136
3138
  selected,
3137
3139
  disabled
@@ -3139,7 +3141,7 @@ function VariableChip({
3139
3141
  const hasClickEvent = !!onClick;
3140
3142
  const referenceIsValidFr = isFresh ? true : referenceIsValid;
3141
3143
  const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react31.Fragment : UndefinedVariableReference;
3142
- const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent ? "Click to edit" : void 0;
3144
+ const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
3143
3145
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3144
3146
  import_design_system15.MultilineChip,
3145
3147
  {
@@ -3186,7 +3188,7 @@ var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerCont
3186
3188
  var import_LexicalTypeaheadMenuPlugin = require("@lexical/react/LexicalTypeaheadMenuPlugin");
3187
3189
  var import_utils = require("@lexical/utils");
3188
3190
  var import_AiFillPlusCircle = require("@react-icons/all-files/ai/AiFillPlusCircle");
3189
- var import_canvas2 = require("@uniformdev/canvas");
3191
+ var import_canvas3 = require("@uniformdev/canvas");
3190
3192
  var import_design_system17 = require("@uniformdev/design-system");
3191
3193
  var import_lite2 = require("dequal/lite");
3192
3194
  var import_lexical3 = require("lexical");
@@ -3660,7 +3662,7 @@ function useVariablesMenu({
3660
3662
  var _a;
3661
3663
  const targetVariable = variables[value];
3662
3664
  if (overwriteExistingValue) {
3663
- setVariablesEditorValue(editor, (0, import_canvas2.createVariableReference)(value));
3665
+ setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(value));
3664
3666
  return true;
3665
3667
  }
3666
3668
  const variableNode = $createVariableNode(value, {
@@ -3830,7 +3832,7 @@ function VariablesPlugin({
3830
3832
  if (!disableVariables) {
3831
3833
  const targetVariable = variablesRef.current.variables[reference];
3832
3834
  if (overwriteExistingValue) {
3833
- setVariablesEditorValue(editor, (0, import_canvas2.createVariableReference)(reference));
3835
+ setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(reference));
3834
3836
  return true;
3835
3837
  }
3836
3838
  const variableNode = $createVariableNode(reference, {
@@ -4030,7 +4032,7 @@ var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
4030
4032
  * (albeit it won't get the fancy chip-node)
4031
4033
  */
4032
4034
  getTextContent() {
4033
- return (0, import_canvas3.createVariableReference)(this.reference);
4035
+ return (0, import_canvas4.createVariableReference)(this.reference);
4034
4036
  }
4035
4037
  /** Creates the DOM wrapper that hosts the node */
4036
4038
  createDOM() {
@@ -4146,6 +4148,7 @@ function VariableNodeComponent({
4146
4148
  displayName: state.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system18.LoadingIndicator, { size: "sm" }) : state.displayName,
4147
4149
  selected: isSelected,
4148
4150
  disabled: readOnly,
4151
+ clickToEdit: state.hasClickEvent,
4149
4152
  onClick: state.hasClickEvent ? () => {
4150
4153
  setSelected(!isSelected);
4151
4154
  editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
@@ -4283,10 +4286,10 @@ var React10 = __toESM(require("react"));
4283
4286
  var import_react42 = require("react");
4284
4287
 
4285
4288
  // src/components/Variables/util/hasReferencedVariables.ts
4286
- var import_canvas4 = require("@uniformdev/canvas");
4289
+ var import_canvas5 = require("@uniformdev/canvas");
4287
4290
  function hasReferencedVariables(value) {
4288
4291
  let result = false;
4289
- (0, import_canvas4.parseVariableExpression)(value, (token, type) => {
4292
+ (0, import_canvas5.parseVariableExpression)(value, (token, type) => {
4290
4293
  if (type === "variable") {
4291
4294
  result = true;
4292
4295
  return false;
@@ -4572,7 +4575,7 @@ function SingleLineTextPlugin() {
4572
4575
  }
4573
4576
 
4574
4577
  // src/components/Variables/util/serializeVariablesEditorState.ts
4575
- var import_canvas5 = require("@uniformdev/canvas");
4578
+ var import_canvas6 = require("@uniformdev/canvas");
4576
4579
  var import_lexical8 = require("lexical");
4577
4580
 
4578
4581
  // src/components/Variables/util/variableExpression.ts
@@ -4591,7 +4594,7 @@ function serializeRecursive(node, buffer) {
4591
4594
  buffer.push(node.text.replace(variablePrefix, "\\${"));
4592
4595
  }
4593
4596
  if (node.type === VariableNode.getType()) {
4594
- buffer.push((0, import_canvas5.createVariableReference)(node.reference));
4597
+ buffer.push((0, import_canvas6.createVariableReference)(node.reference));
4595
4598
  }
4596
4599
  if (node.type === import_lexical8.LineBreakNode.getType()) {
4597
4600
  buffer.push("\n");
@@ -4637,6 +4640,7 @@ function VariablesComposer(props) {
4637
4640
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4638
4641
  import_LexicalOnChangePlugin.OnChangePlugin,
4639
4642
  {
4643
+ ignoreSelectionChange: true,
4640
4644
  onChange: (state) => {
4641
4645
  editorState.current = state;
4642
4646
  if (updateTimeout.current) {
@@ -4910,7 +4914,7 @@ function InputVariablesOverlayMenu({
4910
4914
 
4911
4915
  // src/components/Variables/ParameterConnectionIndicator.tsx
4912
4916
  var import_CgUsbC2 = require("@react-icons/all-files/cg/CgUsbC");
4913
- var import_canvas6 = require("@uniformdev/canvas");
4917
+ var import_canvas7 = require("@uniformdev/canvas");
4914
4918
  var import_design_system22 = require("@uniformdev/design-system");
4915
4919
  var import_react51 = require("react");
4916
4920
 
@@ -5015,7 +5019,7 @@ function ParameterConnectionIndicator({
5015
5019
  }) {
5016
5020
  const hasVariablesInValue = (0, import_react51.useMemo)(() => {
5017
5021
  let result = false;
5018
- (0, import_canvas6.bindVariablesToObject)({
5022
+ (0, import_canvas7.bindVariablesToObject)({
5019
5023
  value,
5020
5024
  variables: {},
5021
5025
  handleBinding: () => {
@@ -6279,11 +6283,11 @@ var DataRefreshButton = ({
6279
6283
 
6280
6284
  // src/components/ObjectSearch/ObjectSearchContainer.tsx
6281
6285
  var import_react66 = require("@emotion/react");
6282
- var import_canvas8 = require("@uniformdev/canvas");
6286
+ var import_canvas9 = require("@uniformdev/canvas");
6283
6287
  var import_design_system35 = require("@uniformdev/design-system");
6284
6288
 
6285
6289
  // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
6286
- var import_canvas7 = require("@uniformdev/canvas");
6290
+ var import_canvas8 = require("@uniformdev/canvas");
6287
6291
  var import_react64 = require("react");
6288
6292
  var import_jsx_runtime58 = require("@emotion/react/jsx-runtime");
6289
6293
  var ObjectSearchContext = (0, import_react64.createContext)({
@@ -6380,7 +6384,7 @@ function useObjectSearchContext() {
6380
6384
  return (0, import_react64.useContext)(ObjectSearchContext);
6381
6385
  }
6382
6386
  function bindQuery(query, inputs) {
6383
- const { result, errors } = (0, import_canvas7.bindVariablesToObject)({
6387
+ const { result, errors } = (0, import_canvas8.bindVariablesToObject)({
6384
6388
  value: query,
6385
6389
  variables: inputs,
6386
6390
  errorPrefix: "Dynamic input"
@@ -6567,7 +6571,7 @@ var ObjectSearchContainer = ({
6567
6571
  onSelectItem([]);
6568
6572
  return;
6569
6573
  }
6570
- const { result, errors } = (0, import_canvas8.bindVariables)({
6574
+ const { result, errors } = (0, import_canvas9.bindVariables)({
6571
6575
  value: selectedValue,
6572
6576
  variables: flatVariables,
6573
6577
  errorPrefix: "Dynamic input"
package/dist/index.mjs CHANGED
@@ -2654,13 +2654,14 @@ function useConnectedDataAsVariables(connectedData) {
2654
2654
  }
2655
2655
 
2656
2656
  // src/hooks/useDynamicInputsAsVariables.tsx
2657
+ import { LOCALE_DYNAMIC_INPUT_NAME } from "@uniformdev/canvas";
2657
2658
  import { useMemo as useMemo4 } from "react";
2658
2659
  import { Fragment as Fragment4, jsx as jsx26 } from "@emotion/react/jsx-runtime";
2659
2660
  function useDynamicInputsAsVariables(dynamicInputs) {
2660
2661
  return useMemo4(() => {
2661
2662
  const result = Object.entries(dynamicInputs).reduce(
2662
2663
  (acc, [name, input3]) => {
2663
- const source = `from ${input3.type === "path" ? "URL path" : "query string"}`;
2664
+ const source = `from ${name === LOCALE_DYNAMIC_INPUT_NAME ? "current locale" : input3.type === "path" ? "URL path" : "query string"}`;
2664
2665
  acc[name] = {
2665
2666
  readOnly: true,
2666
2667
  type: input3.type,
@@ -2944,6 +2945,7 @@ function VariableChip({
2944
2945
  tooltip,
2945
2946
  reference,
2946
2947
  onClick,
2948
+ clickToEdit,
2947
2949
  isFresh,
2948
2950
  selected,
2949
2951
  disabled
@@ -2951,7 +2953,7 @@ function VariableChip({
2951
2953
  const hasClickEvent = !!onClick;
2952
2954
  const referenceIsValidFr = isFresh ? true : referenceIsValid;
2953
2955
  const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? Fragment5 : UndefinedVariableReference;
2954
- const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent ? "Click to edit" : void 0;
2956
+ const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
2955
2957
  return /* @__PURE__ */ jsx29(
2956
2958
  MultilineChip,
2957
2959
  {
@@ -3968,6 +3970,7 @@ function VariableNodeComponent({
3968
3970
  displayName: state.isLoading ? /* @__PURE__ */ jsx33(LoadingIndicator2, { size: "sm" }) : state.displayName,
3969
3971
  selected: isSelected,
3970
3972
  disabled: readOnly,
3973
+ clickToEdit: state.hasClickEvent,
3971
3974
  onClick: state.hasClickEvent ? () => {
3972
3975
  setSelected(!isSelected);
3973
3976
  editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
@@ -4459,6 +4462,7 @@ function VariablesComposer(props) {
4459
4462
  /* @__PURE__ */ jsx37(
4460
4463
  OnChangePlugin,
4461
4464
  {
4465
+ ignoreSelectionChange: true,
4462
4466
  onChange: (state) => {
4463
4467
  editorState.current = state;
4464
4468
  if (updateTimeout.current) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk-react",
3
- "version": "19.88.0",
3
+ "version": "19.88.1-alpha.7+69b3ccba4",
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.88.0",
54
- "@uniformdev/design-system": "19.88.0",
55
- "@uniformdev/mesh-sdk": "19.88.0",
53
+ "@uniformdev/canvas": "19.88.1-alpha.7+69b3ccba4",
54
+ "@uniformdev/design-system": "19.88.1-alpha.7+69b3ccba4",
55
+ "@uniformdev/mesh-sdk": "19.88.1-alpha.7+69b3ccba4",
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": "0a02f919a6b0f0c41307f120adada2e5d45a947b"
89
+ "gitHead": "69b3ccba4050c4ff412c4f226f54a36d74cf9a39"
90
90
  }