@uniformdev/mesh-sdk-react 20.36.1 → 20.37.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
@@ -8,7 +8,7 @@ import { DataVariableDefinition, DataResourceVariables, DataType, DataSourceVari
8
8
  import { Emitter } from 'mitt';
9
9
  import { TDate } from 'timeago.js';
10
10
  import * as lexical from 'lexical';
11
- import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, LexicalNode, LexicalEditor, EditorState, SerializedRootNode } from 'lexical';
11
+ import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, DOMConversionMap, LexicalNode, LexicalEditor, EditorState, SerializedRootNode } from 'lexical';
12
12
  import { Interpolation, Theme, SerializedStyles } from '@emotion/react';
13
13
  import { InputSelectProps, IconType } from '@uniformdev/design-system';
14
14
  export { AddListButton, AddListButtonProps, Button, ButtonProps, Callout, CalloutProps, DrawerContent, Heading, HeadingProps, Input, InputComboBox, InputComboBoxProps, InputKeywordSearch, InputProps, InputSelect, InputToggle, InputToggleProps, Label, LabelProps, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ParameterGroup, ParameterGroupProps, ParameterImage, ParameterImageInner, ParameterImageProps, ParameterInput, ParameterInputInner, ParameterInputProps, ParameterLabel, ParameterLabelProps, ParameterMenuButton, ParameterMenuButtonProps, ParameterSelect, ParameterSelectInner, ParameterSelectProps, ParameterShell, ParameterShellContext, ParameterShellProps, ParameterTextarea, ParameterTextareaInner, ParameterTextareaProps, ParameterToggle, ParameterToggleInner, ParameterToggleProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Switch, SwitchProps, Textarea, TextareaProps, Theme, ThemeProps, useParameterShell, utilityColors } from '@uniformdev/design-system';
@@ -248,6 +248,7 @@ declare class VariableNode extends DecoratorNode<JSX.Element> {
248
248
  /** Creates the DOM wrapper that hosts the node */
249
249
  createDOM(): HTMLSpanElement;
250
250
  updateDOM(): boolean;
251
+ static importDOM(): DOMConversionMap | null;
251
252
  /**
252
253
  * Render the variable node using React.
253
254
  * NOTE: this is effectively an island of React, and you may not call hooks,
@@ -415,6 +416,11 @@ type VariablesPluginProps<TEditorContext = unknown> = {
415
416
  filterVariable?: SelectVariableMenuProps<TEditorContext>['filterVariable'];
416
417
  /** If true, the whole value of the editor is replaced when a variable is inserted */
417
418
  replaceValueOnVariableInsert: boolean;
419
+ /**
420
+ * Disables display names for variables; the variable's (prettified) name is used instead even if a DN exists
421
+ * Use this to render dynamic tokens as paths instead of bound values.
422
+ */
423
+ disableVariableDisplayNames?: boolean;
418
424
  };
419
425
  type UseVariablesMenuInput<TEditorContext> = Pick<VariablesPluginProps<TEditorContext>, 'showAddVariableMenuOption' | 'enableEditingVariables' | 'filterVariable' | 'getEditorContext'>;
420
426
  type OnVariableSelectInput = {
@@ -435,7 +441,7 @@ declare function useVariablesMenu<TEditorContext>({ showAddVariableMenuOption, e
435
441
  * Enables variables auto-complete and reference management to a Lexical editor.
436
442
  * Must also activate the VariableNode node to make this work.
437
443
  */
438
- declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, replaceValueOnVariableInsert, filterVariable, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
444
+ declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, replaceValueOnVariableInsert, filterVariable, disableVariableDisplayNames, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
439
445
 
440
446
  type PasteTransformerPluginProps = {
441
447
  /**
@@ -552,6 +558,11 @@ type InputVariablesProps<TEditorContext = unknown> = {
552
558
  * any existing value on insert a new dynamic token.
553
559
  */
554
560
  singleTokenMode?: boolean;
561
+ /**
562
+ * Disables display names for variables; the variable's (prettified) name is used instead even if a DN exists
563
+ * Use this to render dynamic tokens as paths instead of bound values.
564
+ */
565
+ disableVariableDisplayNames?: boolean;
555
566
  } & PasteTransformerPluginProps & UseInputVariablesStateProps<TEditorContext>;
556
567
  /**
557
568
  * An input box that enables insertion of 'variables', provided by VariablesProvider,
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { DataVariableDefinition, DataResourceVariables, DataType, DataSourceVari
8
8
  import { Emitter } from 'mitt';
9
9
  import { TDate } from 'timeago.js';
10
10
  import * as lexical from 'lexical';
11
- import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, LexicalNode, LexicalEditor, EditorState, SerializedRootNode } from 'lexical';
11
+ import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, DOMConversionMap, LexicalNode, LexicalEditor, EditorState, SerializedRootNode } from 'lexical';
12
12
  import { Interpolation, Theme, SerializedStyles } from '@emotion/react';
13
13
  import { InputSelectProps, IconType } from '@uniformdev/design-system';
14
14
  export { AddListButton, AddListButtonProps, Button, ButtonProps, Callout, CalloutProps, DrawerContent, Heading, HeadingProps, Input, InputComboBox, InputComboBoxProps, InputKeywordSearch, InputProps, InputSelect, InputToggle, InputToggleProps, Label, LabelProps, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ParameterGroup, ParameterGroupProps, ParameterImage, ParameterImageInner, ParameterImageProps, ParameterInput, ParameterInputInner, ParameterInputProps, ParameterLabel, ParameterLabelProps, ParameterMenuButton, ParameterMenuButtonProps, ParameterSelect, ParameterSelectInner, ParameterSelectProps, ParameterShell, ParameterShellContext, ParameterShellProps, ParameterTextarea, ParameterTextareaInner, ParameterTextareaProps, ParameterToggle, ParameterToggleInner, ParameterToggleProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Switch, SwitchProps, Textarea, TextareaProps, Theme, ThemeProps, useParameterShell, utilityColors } from '@uniformdev/design-system';
@@ -248,6 +248,7 @@ declare class VariableNode extends DecoratorNode<JSX.Element> {
248
248
  /** Creates the DOM wrapper that hosts the node */
249
249
  createDOM(): HTMLSpanElement;
250
250
  updateDOM(): boolean;
251
+ static importDOM(): DOMConversionMap | null;
251
252
  /**
252
253
  * Render the variable node using React.
253
254
  * NOTE: this is effectively an island of React, and you may not call hooks,
@@ -415,6 +416,11 @@ type VariablesPluginProps<TEditorContext = unknown> = {
415
416
  filterVariable?: SelectVariableMenuProps<TEditorContext>['filterVariable'];
416
417
  /** If true, the whole value of the editor is replaced when a variable is inserted */
417
418
  replaceValueOnVariableInsert: boolean;
419
+ /**
420
+ * Disables display names for variables; the variable's (prettified) name is used instead even if a DN exists
421
+ * Use this to render dynamic tokens as paths instead of bound values.
422
+ */
423
+ disableVariableDisplayNames?: boolean;
418
424
  };
419
425
  type UseVariablesMenuInput<TEditorContext> = Pick<VariablesPluginProps<TEditorContext>, 'showAddVariableMenuOption' | 'enableEditingVariables' | 'filterVariable' | 'getEditorContext'>;
420
426
  type OnVariableSelectInput = {
@@ -435,7 +441,7 @@ declare function useVariablesMenu<TEditorContext>({ showAddVariableMenuOption, e
435
441
  * Enables variables auto-complete and reference management to a Lexical editor.
436
442
  * Must also activate the VariableNode node to make this work.
437
443
  */
438
- declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, replaceValueOnVariableInsert, filterVariable, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
444
+ declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, replaceValueOnVariableInsert, filterVariable, disableVariableDisplayNames, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
439
445
 
440
446
  type PasteTransformerPluginProps = {
441
447
  /**
@@ -552,6 +558,11 @@ type InputVariablesProps<TEditorContext = unknown> = {
552
558
  * any existing value on insert a new dynamic token.
553
559
  */
554
560
  singleTokenMode?: boolean;
561
+ /**
562
+ * Disables display names for variables; the variable's (prettified) name is used instead even if a DN exists
563
+ * Use this to render dynamic tokens as paths instead of bound values.
564
+ */
565
+ disableVariableDisplayNames?: boolean;
555
566
  } & PasteTransformerPluginProps & UseInputVariablesStateProps<TEditorContext>;
556
567
  /**
557
568
  * An input box that enables insertion of 'variables', provided by VariablesProvider,
package/dist/index.esm.js CHANGED
@@ -1244,7 +1244,8 @@ function VariablesPlugin({
1244
1244
  enableEditingVariables,
1245
1245
  getEditorContext,
1246
1246
  replaceValueOnVariableInsert,
1247
- filterVariable
1247
+ filterVariable,
1248
+ disableVariableDisplayNames
1248
1249
  }) {
1249
1250
  const [editor] = useLexicalComposerContext2();
1250
1251
  const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
@@ -1322,9 +1323,10 @@ function VariablesPlugin({
1322
1323
  });
1323
1324
  return;
1324
1325
  }
1326
+ const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
1325
1327
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
1326
1328
  variable: result.selectedVariable.name,
1327
- initialDisplayName: result.selectedVariable.displayName,
1329
+ initialDisplayName,
1328
1330
  targetKey: sourceKey,
1329
1331
  overwriteExistingValue: replaceValueOnVariableInsert
1330
1332
  });
@@ -1372,9 +1374,10 @@ function VariablesPlugin({
1372
1374
  if (result.canceled) {
1373
1375
  return;
1374
1376
  }
1377
+ const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
1375
1378
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
1376
1379
  variable: result.selectedVariable.name,
1377
- initialDisplayName: result.selectedVariable.displayName,
1380
+ initialDisplayName,
1378
1381
  targetKey: void 0,
1379
1382
  overwriteExistingValue: replaceValueOnVariableInsert
1380
1383
  });
@@ -1393,8 +1396,9 @@ function VariablesPlugin({
1393
1396
  var _a, _b;
1394
1397
  if (!disableVariables) {
1395
1398
  const targetVariable = variablesRef.current.variables[reference];
1399
+ const displayName = disableVariableDisplayNames ? prettifyBindExpression(reference) : initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference);
1396
1400
  const variableNode = $createVariableNode(reference, {
1397
- displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
1401
+ displayName,
1398
1402
  hasClickEvent: canEditVariable(reference, targetVariable),
1399
1403
  referenceIsValid: true,
1400
1404
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
@@ -1431,7 +1435,8 @@ function VariablesPlugin({
1431
1435
  readOnly,
1432
1436
  getEditorContext,
1433
1437
  editVariable,
1434
- replaceValueOnVariableInsert
1438
+ replaceValueOnVariableInsert,
1439
+ disableVariableDisplayNames
1435
1440
  ]);
1436
1441
  const updateExistingNodeIfChanged = useCallback2(
1437
1442
  (variableNode) => {
@@ -1444,9 +1449,10 @@ function VariablesPlugin({
1444
1449
  return;
1445
1450
  }
1446
1451
  const tooltip = (_d = (_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.warning) != null ? _d : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
1452
+ const displayName = disableVariableDisplayNames ? prettifyBindExpression(variableNode.reference) : (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference);
1447
1453
  const newState = {
1448
1454
  ...currentState,
1449
- displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
1455
+ displayName,
1450
1456
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
1451
1457
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
1452
1458
  referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) ? false : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) ? "warning" : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
@@ -1457,7 +1463,7 @@ function VariablesPlugin({
1457
1463
  variableNode.setState(newState);
1458
1464
  }
1459
1465
  },
1460
- [canEditVariable]
1466
+ [canEditVariable, disableVariableDisplayNames]
1461
1467
  );
1462
1468
  useEffect4(() => {
1463
1469
  let selection;
@@ -1616,6 +1622,14 @@ var VariableNode = class _VariableNode extends DecoratorNode {
1616
1622
  updateDOM() {
1617
1623
  return false;
1618
1624
  }
1625
+ static importDOM() {
1626
+ return {
1627
+ binding: () => ({
1628
+ conversion: $convertBindingElement,
1629
+ priority: 0
1630
+ })
1631
+ };
1632
+ }
1619
1633
  /**
1620
1634
  * Render the variable node using React.
1621
1635
  * NOTE: this is effectively an island of React, and you may not call hooks,
@@ -1625,6 +1639,21 @@ var VariableNode = class _VariableNode extends DecoratorNode {
1625
1639
  return /* @__PURE__ */ jsx22(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
1626
1640
  }
1627
1641
  };
1642
+ function $convertBindingElement(domNode) {
1643
+ const element = domNode;
1644
+ const reference = element.textContent.replace(variablePrefix, "").replace(variableSuffix, "");
1645
+ const node = $createVariableNode(reference, {
1646
+ displayName: prettifyBindExpression(reference),
1647
+ hasClickEvent: true,
1648
+ referenceIsValid: true,
1649
+ tooltip: void 0,
1650
+ isFresh: true,
1651
+ isLoading: false
1652
+ });
1653
+ return {
1654
+ node
1655
+ };
1656
+ }
1628
1657
  function $createVariableNode(variableReference, state) {
1629
1658
  return new VariableNode(variableReference, state);
1630
1659
  }
@@ -2462,7 +2491,8 @@ function InputVariables(props) {
2462
2491
  styleVariant = "default",
2463
2492
  renderMenuInPortal,
2464
2493
  disableDismissEditorOnChange,
2465
- singleTokenMode
2494
+ singleTokenMode,
2495
+ disableVariableDisplayNames
2466
2496
  } = props;
2467
2497
  const [finalId] = useState7(id != null ? id : () => v4());
2468
2498
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -2571,6 +2601,7 @@ function InputVariables(props) {
2571
2601
  replaceValueOnVariableInsert: useInputWithNoVariables,
2572
2602
  autoFocus,
2573
2603
  filterVariable,
2604
+ disableVariableDisplayNames,
2574
2605
  children: [
2575
2606
  /* @__PURE__ */ jsx28(PasteTransformerPlugin, { transformPaste }),
2576
2607
  /* @__PURE__ */ jsx28(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
package/dist/index.js CHANGED
@@ -1390,7 +1390,8 @@ function VariablesPlugin({
1390
1390
  enableEditingVariables,
1391
1391
  getEditorContext,
1392
1392
  replaceValueOnVariableInsert,
1393
- filterVariable
1393
+ filterVariable,
1394
+ disableVariableDisplayNames
1394
1395
  }) {
1395
1396
  const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
1396
1397
  const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
@@ -1468,9 +1469,10 @@ function VariablesPlugin({
1468
1469
  });
1469
1470
  return;
1470
1471
  }
1472
+ const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
1471
1473
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
1472
1474
  variable: result.selectedVariable.name,
1473
- initialDisplayName: result.selectedVariable.displayName,
1475
+ initialDisplayName,
1474
1476
  targetKey: sourceKey,
1475
1477
  overwriteExistingValue: replaceValueOnVariableInsert
1476
1478
  });
@@ -1518,9 +1520,10 @@ function VariablesPlugin({
1518
1520
  if (result.canceled) {
1519
1521
  return;
1520
1522
  }
1523
+ const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
1521
1524
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
1522
1525
  variable: result.selectedVariable.name,
1523
- initialDisplayName: result.selectedVariable.displayName,
1526
+ initialDisplayName,
1524
1527
  targetKey: void 0,
1525
1528
  overwriteExistingValue: replaceValueOnVariableInsert
1526
1529
  });
@@ -1539,8 +1542,9 @@ function VariablesPlugin({
1539
1542
  var _a, _b;
1540
1543
  if (!disableVariables) {
1541
1544
  const targetVariable = variablesRef.current.variables[reference];
1545
+ const displayName = disableVariableDisplayNames ? prettifyBindExpression(reference) : initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference);
1542
1546
  const variableNode = $createVariableNode(reference, {
1543
- displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
1547
+ displayName,
1544
1548
  hasClickEvent: canEditVariable(reference, targetVariable),
1545
1549
  referenceIsValid: true,
1546
1550
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
@@ -1577,7 +1581,8 @@ function VariablesPlugin({
1577
1581
  readOnly,
1578
1582
  getEditorContext,
1579
1583
  editVariable,
1580
- replaceValueOnVariableInsert
1584
+ replaceValueOnVariableInsert,
1585
+ disableVariableDisplayNames
1581
1586
  ]);
1582
1587
  const updateExistingNodeIfChanged = (0, import_react15.useCallback)(
1583
1588
  (variableNode) => {
@@ -1590,9 +1595,10 @@ function VariablesPlugin({
1590
1595
  return;
1591
1596
  }
1592
1597
  const tooltip = (_d = (_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.warning) != null ? _d : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
1598
+ const displayName = disableVariableDisplayNames ? prettifyBindExpression(variableNode.reference) : (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference);
1593
1599
  const newState = {
1594
1600
  ...currentState,
1595
- displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
1601
+ displayName,
1596
1602
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
1597
1603
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
1598
1604
  referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) ? false : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) ? "warning" : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
@@ -1603,7 +1609,7 @@ function VariablesPlugin({
1603
1609
  variableNode.setState(newState);
1604
1610
  }
1605
1611
  },
1606
- [canEditVariable]
1612
+ [canEditVariable, disableVariableDisplayNames]
1607
1613
  );
1608
1614
  (0, import_react15.useEffect)(() => {
1609
1615
  let selection;
@@ -1762,6 +1768,14 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
1762
1768
  updateDOM() {
1763
1769
  return false;
1764
1770
  }
1771
+ static importDOM() {
1772
+ return {
1773
+ binding: () => ({
1774
+ conversion: $convertBindingElement,
1775
+ priority: 0
1776
+ })
1777
+ };
1778
+ }
1765
1779
  /**
1766
1780
  * Render the variable node using React.
1767
1781
  * NOTE: this is effectively an island of React, and you may not call hooks,
@@ -1771,6 +1785,21 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
1771
1785
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
1772
1786
  }
1773
1787
  };
1788
+ function $convertBindingElement(domNode) {
1789
+ const element = domNode;
1790
+ const reference = element.textContent.replace(variablePrefix, "").replace(variableSuffix, "");
1791
+ const node = $createVariableNode(reference, {
1792
+ displayName: prettifyBindExpression(reference),
1793
+ hasClickEvent: true,
1794
+ referenceIsValid: true,
1795
+ tooltip: void 0,
1796
+ isFresh: true,
1797
+ isLoading: false
1798
+ });
1799
+ return {
1800
+ node
1801
+ };
1802
+ }
1774
1803
  function $createVariableNode(variableReference, state) {
1775
1804
  return new VariableNode(variableReference, state);
1776
1805
  }
@@ -2590,7 +2619,8 @@ function InputVariables(props) {
2590
2619
  styleVariant = "default",
2591
2620
  renderMenuInPortal,
2592
2621
  disableDismissEditorOnChange,
2593
- singleTokenMode
2622
+ singleTokenMode,
2623
+ disableVariableDisplayNames
2594
2624
  } = props;
2595
2625
  const [finalId] = (0, import_react28.useState)(id != null ? id : () => (0, import_uuid.v4)());
2596
2626
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -2699,6 +2729,7 @@ function InputVariables(props) {
2699
2729
  replaceValueOnVariableInsert: useInputWithNoVariables,
2700
2730
  autoFocus,
2701
2731
  filterVariable,
2732
+ disableVariableDisplayNames,
2702
2733
  children: [
2703
2734
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PasteTransformerPlugin, { transformPaste }),
2704
2735
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
package/dist/index.mjs CHANGED
@@ -1244,7 +1244,8 @@ function VariablesPlugin({
1244
1244
  enableEditingVariables,
1245
1245
  getEditorContext,
1246
1246
  replaceValueOnVariableInsert,
1247
- filterVariable
1247
+ filterVariable,
1248
+ disableVariableDisplayNames
1248
1249
  }) {
1249
1250
  const [editor] = useLexicalComposerContext2();
1250
1251
  const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
@@ -1322,9 +1323,10 @@ function VariablesPlugin({
1322
1323
  });
1323
1324
  return;
1324
1325
  }
1326
+ const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
1325
1327
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
1326
1328
  variable: result.selectedVariable.name,
1327
- initialDisplayName: result.selectedVariable.displayName,
1329
+ initialDisplayName,
1328
1330
  targetKey: sourceKey,
1329
1331
  overwriteExistingValue: replaceValueOnVariableInsert
1330
1332
  });
@@ -1372,9 +1374,10 @@ function VariablesPlugin({
1372
1374
  if (result.canceled) {
1373
1375
  return;
1374
1376
  }
1377
+ const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
1375
1378
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
1376
1379
  variable: result.selectedVariable.name,
1377
- initialDisplayName: result.selectedVariable.displayName,
1380
+ initialDisplayName,
1378
1381
  targetKey: void 0,
1379
1382
  overwriteExistingValue: replaceValueOnVariableInsert
1380
1383
  });
@@ -1393,8 +1396,9 @@ function VariablesPlugin({
1393
1396
  var _a, _b;
1394
1397
  if (!disableVariables) {
1395
1398
  const targetVariable = variablesRef.current.variables[reference];
1399
+ const displayName = disableVariableDisplayNames ? prettifyBindExpression(reference) : initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference);
1396
1400
  const variableNode = $createVariableNode(reference, {
1397
- displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
1401
+ displayName,
1398
1402
  hasClickEvent: canEditVariable(reference, targetVariable),
1399
1403
  referenceIsValid: true,
1400
1404
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
@@ -1431,7 +1435,8 @@ function VariablesPlugin({
1431
1435
  readOnly,
1432
1436
  getEditorContext,
1433
1437
  editVariable,
1434
- replaceValueOnVariableInsert
1438
+ replaceValueOnVariableInsert,
1439
+ disableVariableDisplayNames
1435
1440
  ]);
1436
1441
  const updateExistingNodeIfChanged = useCallback2(
1437
1442
  (variableNode) => {
@@ -1444,9 +1449,10 @@ function VariablesPlugin({
1444
1449
  return;
1445
1450
  }
1446
1451
  const tooltip = (_d = (_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.warning) != null ? _d : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
1452
+ const displayName = disableVariableDisplayNames ? prettifyBindExpression(variableNode.reference) : (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference);
1447
1453
  const newState = {
1448
1454
  ...currentState,
1449
- displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
1455
+ displayName,
1450
1456
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
1451
1457
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
1452
1458
  referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) ? false : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) ? "warning" : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
@@ -1457,7 +1463,7 @@ function VariablesPlugin({
1457
1463
  variableNode.setState(newState);
1458
1464
  }
1459
1465
  },
1460
- [canEditVariable]
1466
+ [canEditVariable, disableVariableDisplayNames]
1461
1467
  );
1462
1468
  useEffect4(() => {
1463
1469
  let selection;
@@ -1616,6 +1622,14 @@ var VariableNode = class _VariableNode extends DecoratorNode {
1616
1622
  updateDOM() {
1617
1623
  return false;
1618
1624
  }
1625
+ static importDOM() {
1626
+ return {
1627
+ binding: () => ({
1628
+ conversion: $convertBindingElement,
1629
+ priority: 0
1630
+ })
1631
+ };
1632
+ }
1619
1633
  /**
1620
1634
  * Render the variable node using React.
1621
1635
  * NOTE: this is effectively an island of React, and you may not call hooks,
@@ -1625,6 +1639,21 @@ var VariableNode = class _VariableNode extends DecoratorNode {
1625
1639
  return /* @__PURE__ */ jsx22(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
1626
1640
  }
1627
1641
  };
1642
+ function $convertBindingElement(domNode) {
1643
+ const element = domNode;
1644
+ const reference = element.textContent.replace(variablePrefix, "").replace(variableSuffix, "");
1645
+ const node = $createVariableNode(reference, {
1646
+ displayName: prettifyBindExpression(reference),
1647
+ hasClickEvent: true,
1648
+ referenceIsValid: true,
1649
+ tooltip: void 0,
1650
+ isFresh: true,
1651
+ isLoading: false
1652
+ });
1653
+ return {
1654
+ node
1655
+ };
1656
+ }
1628
1657
  function $createVariableNode(variableReference, state) {
1629
1658
  return new VariableNode(variableReference, state);
1630
1659
  }
@@ -2462,7 +2491,8 @@ function InputVariables(props) {
2462
2491
  styleVariant = "default",
2463
2492
  renderMenuInPortal,
2464
2493
  disableDismissEditorOnChange,
2465
- singleTokenMode
2494
+ singleTokenMode,
2495
+ disableVariableDisplayNames
2466
2496
  } = props;
2467
2497
  const [finalId] = useState7(id != null ? id : () => v4());
2468
2498
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -2571,6 +2601,7 @@ function InputVariables(props) {
2571
2601
  replaceValueOnVariableInsert: useInputWithNoVariables,
2572
2602
  autoFocus,
2573
2603
  filterVariable,
2604
+ disableVariableDisplayNames,
2574
2605
  children: [
2575
2606
  /* @__PURE__ */ jsx28(PasteTransformerPlugin, { transformPaste }),
2576
2607
  /* @__PURE__ */ jsx28(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk-react",
3
- "version": "20.36.1",
3
+ "version": "20.37.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,10 +50,10 @@
50
50
  "@lexical/selection": "0.25.0",
51
51
  "@lexical/utils": "0.25.0",
52
52
  "@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v5.5.0/react-icons-all-files-5.5.0.tgz",
53
- "@uniformdev/canvas": "20.36.1",
54
- "@uniformdev/design-system": "20.36.1",
55
- "@uniformdev/mesh-sdk": "20.36.1",
56
- "@uniformdev/richtext": "20.36.1",
53
+ "@uniformdev/canvas": "20.37.0",
54
+ "@uniformdev/design-system": "20.37.0",
55
+ "@uniformdev/mesh-sdk": "20.37.0",
56
+ "@uniformdev/richtext": "20.37.0",
57
57
  "dequal": "^2.0.3",
58
58
  "lexical": "0.25.0",
59
59
  "mitt": "3.0.1",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "cced31b4edaff96f2eec23f2336ee0873663066a"
89
+ "gitHead": "4b42aec368d447a0b0ebc619451abdd5df413365"
90
90
  }