@uniformdev/mesh-sdk-react 20.35.0 → 20.35.1-alpha.58
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 +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.esm.js +74 -48
- package/dist/index.js +74 -48
- package/dist/index.mjs +74 -48
- package/package.json +6 -6
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
|
|
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
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -1879,27 +1908,40 @@ var placeholderCompact = css4`
|
|
|
1879
1908
|
import { css as css5 } from "@emotion/react";
|
|
1880
1909
|
import { scrollbarStyles } from "@uniformdev/design-system";
|
|
1881
1910
|
var variableBindButton = css5`
|
|
1882
|
-
|
|
1883
|
-
|
|
1911
|
+
--hover-color: var(--accent-dark-hover);
|
|
1912
|
+
--active-color: var(--accent-dark-active);
|
|
1913
|
+
border: 1px solid transparent;
|
|
1884
1914
|
border-radius: var(--rounded-base);
|
|
1885
1915
|
background: none;
|
|
1916
|
+
color: var(--gray-300);
|
|
1886
1917
|
display: flex;
|
|
1887
|
-
|
|
1888
|
-
|
|
1918
|
+
align-items: center;
|
|
1919
|
+
justify-content: center;
|
|
1920
|
+
max-width: fit-content;
|
|
1921
|
+
padding: 0.125rem;
|
|
1889
1922
|
transition:
|
|
1923
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
1890
1924
|
background var(--duration-fast) var(--timing-ease-out),
|
|
1891
|
-
color var(--duration-fast) var(--timing-ease-out)
|
|
1892
|
-
|
|
1925
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
1926
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
1893
1927
|
|
|
1894
|
-
&:hover,
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
color: var(--
|
|
1928
|
+
&:hover:not([aria-disabled='true']),
|
|
1929
|
+
&:focus:not([aria-disabled='true']),
|
|
1930
|
+
&:focus-within:not([aria-disabled='true']) {
|
|
1931
|
+
color: var(--gray-500);
|
|
1932
|
+
border-color: var(--hover-color);
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
&:active:not([aria-disabled='true']),
|
|
1936
|
+
&[aria-pressed='true']:not([aria-disabled='true']) {
|
|
1937
|
+
color: var(--active-color);
|
|
1898
1938
|
}
|
|
1899
1939
|
|
|
1900
1940
|
&[aria-disabled='true'] {
|
|
1901
1941
|
background: none;
|
|
1902
1942
|
color: currentColor;
|
|
1943
|
+
opacity: var(--opacity-50);
|
|
1944
|
+
cursor: default;
|
|
1903
1945
|
}
|
|
1904
1946
|
|
|
1905
1947
|
// fixes menu resizing issue within iframes
|
|
@@ -1945,6 +1987,7 @@ var input2 = css5`
|
|
|
1945
1987
|
&:disabled,
|
|
1946
1988
|
&:disabled::placeholder,
|
|
1947
1989
|
&:disabled:hover {
|
|
1990
|
+
border-color: var(--gray-200);
|
|
1948
1991
|
border-radius: var(--rounded-sm);
|
|
1949
1992
|
cursor: not-allowed;
|
|
1950
1993
|
color: var(--gray-400);
|
|
@@ -1954,6 +1997,7 @@ var input2 = css5`
|
|
|
1954
1997
|
&[contenteditable='false'] {
|
|
1955
1998
|
cursor: not-allowed;
|
|
1956
1999
|
color: var(--gray-400);
|
|
2000
|
+
border-color: var(--gray-200);
|
|
1957
2001
|
}
|
|
1958
2002
|
|
|
1959
2003
|
> p {
|
|
@@ -2045,30 +2089,6 @@ var labelText = css6`
|
|
|
2045
2089
|
font-weight: var(--fw-regular);
|
|
2046
2090
|
margin: 0 0 var(--spacing-xs);
|
|
2047
2091
|
`;
|
|
2048
|
-
var variableBindButton2 = css6`
|
|
2049
|
-
align-items: center;
|
|
2050
|
-
border: none;
|
|
2051
|
-
border-radius: var(--rounded-base);
|
|
2052
|
-
background: none;
|
|
2053
|
-
display: flex;
|
|
2054
|
-
height: 1.2rem;
|
|
2055
|
-
padding: var(--spacing-2xs);
|
|
2056
|
-
transition:
|
|
2057
|
-
background var(--duration-fast) var(--timing-ease-out),
|
|
2058
|
-
color var(--duration-fast) var(--timing-ease-out);
|
|
2059
|
-
width: 1.2rem;
|
|
2060
|
-
|
|
2061
|
-
&:hover,
|
|
2062
|
-
&[aria-pressed='true']:not(:disabled) {
|
|
2063
|
-
background: var(--brand-secondary-3);
|
|
2064
|
-
color: var(--white);
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
|
-
&[aria-disabled='true'] {
|
|
2068
|
-
background: none;
|
|
2069
|
-
color: currentColor;
|
|
2070
|
-
}
|
|
2071
|
-
`;
|
|
2072
2092
|
|
|
2073
2093
|
// src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
|
|
2074
2094
|
import { useLexicalComposerContext as useLexicalComposerContext6 } from "@lexical/react/LexicalComposerContext";
|
|
@@ -2115,7 +2135,7 @@ function SelectVariableMenu({
|
|
|
2115
2135
|
css: [menuBtn, buttonCss],
|
|
2116
2136
|
type: "button",
|
|
2117
2137
|
"data-testid": "insert-variable",
|
|
2118
|
-
children: /* @__PURE__ */ jsx23(CgUsbC, { size: "
|
|
2138
|
+
children: /* @__PURE__ */ jsx23(CgUsbC, { size: "1rem" })
|
|
2119
2139
|
}
|
|
2120
2140
|
),
|
|
2121
2141
|
children: [
|
|
@@ -2208,7 +2228,7 @@ function VariableField({
|
|
|
2208
2228
|
VariablesComposerVariableMenu,
|
|
2209
2229
|
{
|
|
2210
2230
|
...selectVariableMenuOptions,
|
|
2211
|
-
buttonCss: [
|
|
2231
|
+
buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
|
|
2212
2232
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
2213
2233
|
}
|
|
2214
2234
|
) }) : null;
|
|
@@ -2460,7 +2480,8 @@ function InputVariables(props) {
|
|
|
2460
2480
|
styleVariant = "default",
|
|
2461
2481
|
renderMenuInPortal,
|
|
2462
2482
|
disableDismissEditorOnChange,
|
|
2463
|
-
singleTokenMode
|
|
2483
|
+
singleTokenMode,
|
|
2484
|
+
disableVariableDisplayNames
|
|
2464
2485
|
} = props;
|
|
2465
2486
|
const [finalId] = useState7(id != null ? id : () => v4());
|
|
2466
2487
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -2496,6 +2517,7 @@ function InputVariables(props) {
|
|
|
2496
2517
|
portal: renderMenuInPortal,
|
|
2497
2518
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2498
2519
|
useInputWhenNoVariables: useInputWithNoVariables,
|
|
2520
|
+
isActive: hadVariablesInValue,
|
|
2499
2521
|
children: /* @__PURE__ */ jsx28(
|
|
2500
2522
|
VariablesComposerInput,
|
|
2501
2523
|
{
|
|
@@ -2569,6 +2591,7 @@ function InputVariables(props) {
|
|
|
2569
2591
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2570
2592
|
autoFocus,
|
|
2571
2593
|
filterVariable,
|
|
2594
|
+
disableVariableDisplayNames,
|
|
2572
2595
|
children: [
|
|
2573
2596
|
/* @__PURE__ */ jsx28(PasteTransformerPlugin, { transformPaste }),
|
|
2574
2597
|
/* @__PURE__ */ jsx28(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
@@ -2583,6 +2606,7 @@ function InputVariablesOverlayMenu({
|
|
|
2583
2606
|
disabled,
|
|
2584
2607
|
useInputWhenNoVariables,
|
|
2585
2608
|
portal,
|
|
2609
|
+
isActive,
|
|
2586
2610
|
...props
|
|
2587
2611
|
}) {
|
|
2588
2612
|
if (disabled) {
|
|
@@ -2596,7 +2620,8 @@ function InputVariablesOverlayMenu({
|
|
|
2596
2620
|
...props,
|
|
2597
2621
|
portal,
|
|
2598
2622
|
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
2599
|
-
buttonCss: menuBtn2
|
|
2623
|
+
buttonCss: [menuBtn2, variableBindButton],
|
|
2624
|
+
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
2600
2625
|
}
|
|
2601
2626
|
)
|
|
2602
2627
|
] });
|
|
@@ -2649,7 +2674,7 @@ function ParameterConnectionIndicator({
|
|
|
2649
2674
|
css: [menuBtn, variableBindButton],
|
|
2650
2675
|
type: "button",
|
|
2651
2676
|
"data-testid": "insert-variable",
|
|
2652
|
-
children: /* @__PURE__ */ jsx29(CgUsbC2, { size: "
|
|
2677
|
+
children: /* @__PURE__ */ jsx29(CgUsbC2, { size: "1rem" })
|
|
2653
2678
|
}
|
|
2654
2679
|
)
|
|
2655
2680
|
}
|
|
@@ -3140,7 +3165,8 @@ function TextVariableRenderer({ definition, value, setValue }) {
|
|
|
3140
3165
|
value: value != null ? value : "",
|
|
3141
3166
|
caption: (_a = definition.helpText) != null ? _a : definition.default !== "" ? `Default value: ${definition.default}` : void 0,
|
|
3142
3167
|
onChange: setValue,
|
|
3143
|
-
"data-testid": "variable-input"
|
|
3168
|
+
"data-testid": "variable-input",
|
|
3169
|
+
disableInlineMenu: "by-label"
|
|
3144
3170
|
}
|
|
3145
3171
|
) });
|
|
3146
3172
|
}
|
|
@@ -4204,7 +4230,7 @@ var ObjectSearchListItem = ({
|
|
|
4204
4230
|
),
|
|
4205
4231
|
/* @__PURE__ */ jsxs23("div", { css: ObjectListItemInfoContainer, children: [
|
|
4206
4232
|
selected ? /* @__PURE__ */ jsx49(Chip, { text: "selected", size: "xs" }) : null,
|
|
4207
|
-
!popoverData ? null : /* @__PURE__ */ jsx49(Popover, { ariaLabel: title, buttonText: `See ${title} details`,
|
|
4233
|
+
!popoverData ? null : /* @__PURE__ */ jsx49(Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4208
4234
|
] }),
|
|
4209
4235
|
!children ? null : /* @__PURE__ */ jsx49("div", { css: ObjectListItemUnControlledContent, children })
|
|
4210
4236
|
]
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -2019,27 +2048,40 @@ var placeholderCompact = import_react18.css`
|
|
|
2019
2048
|
var import_react19 = require("@emotion/react");
|
|
2020
2049
|
var import_design_system7 = require("@uniformdev/design-system");
|
|
2021
2050
|
var variableBindButton = import_react19.css`
|
|
2022
|
-
|
|
2023
|
-
|
|
2051
|
+
--hover-color: var(--accent-dark-hover);
|
|
2052
|
+
--active-color: var(--accent-dark-active);
|
|
2053
|
+
border: 1px solid transparent;
|
|
2024
2054
|
border-radius: var(--rounded-base);
|
|
2025
2055
|
background: none;
|
|
2056
|
+
color: var(--gray-300);
|
|
2026
2057
|
display: flex;
|
|
2027
|
-
|
|
2028
|
-
|
|
2058
|
+
align-items: center;
|
|
2059
|
+
justify-content: center;
|
|
2060
|
+
max-width: fit-content;
|
|
2061
|
+
padding: 0.125rem;
|
|
2029
2062
|
transition:
|
|
2063
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
2030
2064
|
background var(--duration-fast) var(--timing-ease-out),
|
|
2031
|
-
color var(--duration-fast) var(--timing-ease-out)
|
|
2032
|
-
|
|
2065
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
2066
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
2033
2067
|
|
|
2034
|
-
&:hover,
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
color: var(--
|
|
2068
|
+
&:hover:not([aria-disabled='true']),
|
|
2069
|
+
&:focus:not([aria-disabled='true']),
|
|
2070
|
+
&:focus-within:not([aria-disabled='true']) {
|
|
2071
|
+
color: var(--gray-500);
|
|
2072
|
+
border-color: var(--hover-color);
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
&:active:not([aria-disabled='true']),
|
|
2076
|
+
&[aria-pressed='true']:not([aria-disabled='true']) {
|
|
2077
|
+
color: var(--active-color);
|
|
2038
2078
|
}
|
|
2039
2079
|
|
|
2040
2080
|
&[aria-disabled='true'] {
|
|
2041
2081
|
background: none;
|
|
2042
2082
|
color: currentColor;
|
|
2083
|
+
opacity: var(--opacity-50);
|
|
2084
|
+
cursor: default;
|
|
2043
2085
|
}
|
|
2044
2086
|
|
|
2045
2087
|
// fixes menu resizing issue within iframes
|
|
@@ -2085,6 +2127,7 @@ var input2 = import_react19.css`
|
|
|
2085
2127
|
&:disabled,
|
|
2086
2128
|
&:disabled::placeholder,
|
|
2087
2129
|
&:disabled:hover {
|
|
2130
|
+
border-color: var(--gray-200);
|
|
2088
2131
|
border-radius: var(--rounded-sm);
|
|
2089
2132
|
cursor: not-allowed;
|
|
2090
2133
|
color: var(--gray-400);
|
|
@@ -2094,6 +2137,7 @@ var input2 = import_react19.css`
|
|
|
2094
2137
|
&[contenteditable='false'] {
|
|
2095
2138
|
cursor: not-allowed;
|
|
2096
2139
|
color: var(--gray-400);
|
|
2140
|
+
border-color: var(--gray-200);
|
|
2097
2141
|
}
|
|
2098
2142
|
|
|
2099
2143
|
> p {
|
|
@@ -2185,30 +2229,6 @@ var labelText = import_react21.css`
|
|
|
2185
2229
|
font-weight: var(--fw-regular);
|
|
2186
2230
|
margin: 0 0 var(--spacing-xs);
|
|
2187
2231
|
`;
|
|
2188
|
-
var variableBindButton2 = import_react21.css`
|
|
2189
|
-
align-items: center;
|
|
2190
|
-
border: none;
|
|
2191
|
-
border-radius: var(--rounded-base);
|
|
2192
|
-
background: none;
|
|
2193
|
-
display: flex;
|
|
2194
|
-
height: 1.2rem;
|
|
2195
|
-
padding: var(--spacing-2xs);
|
|
2196
|
-
transition:
|
|
2197
|
-
background var(--duration-fast) var(--timing-ease-out),
|
|
2198
|
-
color var(--duration-fast) var(--timing-ease-out);
|
|
2199
|
-
width: 1.2rem;
|
|
2200
|
-
|
|
2201
|
-
&:hover,
|
|
2202
|
-
&[aria-pressed='true']:not(:disabled) {
|
|
2203
|
-
background: var(--brand-secondary-3);
|
|
2204
|
-
color: var(--white);
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
&[aria-disabled='true'] {
|
|
2208
|
-
background: none;
|
|
2209
|
-
color: currentColor;
|
|
2210
|
-
}
|
|
2211
|
-
`;
|
|
2212
2232
|
|
|
2213
2233
|
// src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
|
|
2214
2234
|
var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
|
|
@@ -2255,7 +2275,7 @@ function SelectVariableMenu({
|
|
|
2255
2275
|
css: [menuBtn, buttonCss],
|
|
2256
2276
|
type: "button",
|
|
2257
2277
|
"data-testid": "insert-variable",
|
|
2258
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_CgUsbC.CgUsbC, { size: "
|
|
2278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_CgUsbC.CgUsbC, { size: "1rem" })
|
|
2259
2279
|
}
|
|
2260
2280
|
),
|
|
2261
2281
|
children: [
|
|
@@ -2348,7 +2368,7 @@ function VariableField({
|
|
|
2348
2368
|
VariablesComposerVariableMenu,
|
|
2349
2369
|
{
|
|
2350
2370
|
...selectVariableMenuOptions,
|
|
2351
|
-
buttonCss: [
|
|
2371
|
+
buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
|
|
2352
2372
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
2353
2373
|
}
|
|
2354
2374
|
) }) : null;
|
|
@@ -2588,7 +2608,8 @@ function InputVariables(props) {
|
|
|
2588
2608
|
styleVariant = "default",
|
|
2589
2609
|
renderMenuInPortal,
|
|
2590
2610
|
disableDismissEditorOnChange,
|
|
2591
|
-
singleTokenMode
|
|
2611
|
+
singleTokenMode,
|
|
2612
|
+
disableVariableDisplayNames
|
|
2592
2613
|
} = props;
|
|
2593
2614
|
const [finalId] = (0, import_react28.useState)(id != null ? id : () => (0, import_uuid.v4)());
|
|
2594
2615
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -2624,6 +2645,7 @@ function InputVariables(props) {
|
|
|
2624
2645
|
portal: renderMenuInPortal,
|
|
2625
2646
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2626
2647
|
useInputWhenNoVariables: useInputWithNoVariables,
|
|
2648
|
+
isActive: hadVariablesInValue,
|
|
2627
2649
|
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2628
2650
|
VariablesComposerInput,
|
|
2629
2651
|
{
|
|
@@ -2697,6 +2719,7 @@ function InputVariables(props) {
|
|
|
2697
2719
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2698
2720
|
autoFocus,
|
|
2699
2721
|
filterVariable,
|
|
2722
|
+
disableVariableDisplayNames,
|
|
2700
2723
|
children: [
|
|
2701
2724
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PasteTransformerPlugin, { transformPaste }),
|
|
2702
2725
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
@@ -2711,6 +2734,7 @@ function InputVariablesOverlayMenu({
|
|
|
2711
2734
|
disabled,
|
|
2712
2735
|
useInputWhenNoVariables,
|
|
2713
2736
|
portal,
|
|
2737
|
+
isActive,
|
|
2714
2738
|
...props
|
|
2715
2739
|
}) {
|
|
2716
2740
|
if (disabled) {
|
|
@@ -2724,7 +2748,8 @@ function InputVariablesOverlayMenu({
|
|
|
2724
2748
|
...props,
|
|
2725
2749
|
portal,
|
|
2726
2750
|
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
2727
|
-
buttonCss: menuBtn2
|
|
2751
|
+
buttonCss: [menuBtn2, variableBindButton],
|
|
2752
|
+
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
2728
2753
|
}
|
|
2729
2754
|
)
|
|
2730
2755
|
] });
|
|
@@ -2777,7 +2802,7 @@ function ParameterConnectionIndicator({
|
|
|
2777
2802
|
css: [menuBtn, variableBindButton],
|
|
2778
2803
|
type: "button",
|
|
2779
2804
|
"data-testid": "insert-variable",
|
|
2780
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_CgUsbC2.CgUsbC, { size: "
|
|
2805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_CgUsbC2.CgUsbC, { size: "1rem" })
|
|
2781
2806
|
}
|
|
2782
2807
|
)
|
|
2783
2808
|
}
|
|
@@ -3258,7 +3283,8 @@ function TextVariableRenderer({ definition, value, setValue }) {
|
|
|
3258
3283
|
value: value != null ? value : "",
|
|
3259
3284
|
caption: (_a = definition.helpText) != null ? _a : definition.default !== "" ? `Default value: ${definition.default}` : void 0,
|
|
3260
3285
|
onChange: setValue,
|
|
3261
|
-
"data-testid": "variable-input"
|
|
3286
|
+
"data-testid": "variable-input",
|
|
3287
|
+
disableInlineMenu: "by-label"
|
|
3262
3288
|
}
|
|
3263
3289
|
) });
|
|
3264
3290
|
}
|
|
@@ -4295,7 +4321,7 @@ var ObjectSearchListItem = ({
|
|
|
4295
4321
|
),
|
|
4296
4322
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
|
|
4297
4323
|
selected ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Chip, { text: "selected", size: "xs" }) : null,
|
|
4298
|
-
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Popover, { ariaLabel: title, buttonText: `See ${title} details`,
|
|
4324
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4299
4325
|
] }),
|
|
4300
4326
|
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
4301
4327
|
]
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -1879,27 +1908,40 @@ var placeholderCompact = css4`
|
|
|
1879
1908
|
import { css as css5 } from "@emotion/react";
|
|
1880
1909
|
import { scrollbarStyles } from "@uniformdev/design-system";
|
|
1881
1910
|
var variableBindButton = css5`
|
|
1882
|
-
|
|
1883
|
-
|
|
1911
|
+
--hover-color: var(--accent-dark-hover);
|
|
1912
|
+
--active-color: var(--accent-dark-active);
|
|
1913
|
+
border: 1px solid transparent;
|
|
1884
1914
|
border-radius: var(--rounded-base);
|
|
1885
1915
|
background: none;
|
|
1916
|
+
color: var(--gray-300);
|
|
1886
1917
|
display: flex;
|
|
1887
|
-
|
|
1888
|
-
|
|
1918
|
+
align-items: center;
|
|
1919
|
+
justify-content: center;
|
|
1920
|
+
max-width: fit-content;
|
|
1921
|
+
padding: 0.125rem;
|
|
1889
1922
|
transition:
|
|
1923
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
1890
1924
|
background var(--duration-fast) var(--timing-ease-out),
|
|
1891
|
-
color var(--duration-fast) var(--timing-ease-out)
|
|
1892
|
-
|
|
1925
|
+
color var(--duration-fast) var(--timing-ease-out),
|
|
1926
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
1893
1927
|
|
|
1894
|
-
&:hover,
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
color: var(--
|
|
1928
|
+
&:hover:not([aria-disabled='true']),
|
|
1929
|
+
&:focus:not([aria-disabled='true']),
|
|
1930
|
+
&:focus-within:not([aria-disabled='true']) {
|
|
1931
|
+
color: var(--gray-500);
|
|
1932
|
+
border-color: var(--hover-color);
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
&:active:not([aria-disabled='true']),
|
|
1936
|
+
&[aria-pressed='true']:not([aria-disabled='true']) {
|
|
1937
|
+
color: var(--active-color);
|
|
1898
1938
|
}
|
|
1899
1939
|
|
|
1900
1940
|
&[aria-disabled='true'] {
|
|
1901
1941
|
background: none;
|
|
1902
1942
|
color: currentColor;
|
|
1943
|
+
opacity: var(--opacity-50);
|
|
1944
|
+
cursor: default;
|
|
1903
1945
|
}
|
|
1904
1946
|
|
|
1905
1947
|
// fixes menu resizing issue within iframes
|
|
@@ -1945,6 +1987,7 @@ var input2 = css5`
|
|
|
1945
1987
|
&:disabled,
|
|
1946
1988
|
&:disabled::placeholder,
|
|
1947
1989
|
&:disabled:hover {
|
|
1990
|
+
border-color: var(--gray-200);
|
|
1948
1991
|
border-radius: var(--rounded-sm);
|
|
1949
1992
|
cursor: not-allowed;
|
|
1950
1993
|
color: var(--gray-400);
|
|
@@ -1954,6 +1997,7 @@ var input2 = css5`
|
|
|
1954
1997
|
&[contenteditable='false'] {
|
|
1955
1998
|
cursor: not-allowed;
|
|
1956
1999
|
color: var(--gray-400);
|
|
2000
|
+
border-color: var(--gray-200);
|
|
1957
2001
|
}
|
|
1958
2002
|
|
|
1959
2003
|
> p {
|
|
@@ -2045,30 +2089,6 @@ var labelText = css6`
|
|
|
2045
2089
|
font-weight: var(--fw-regular);
|
|
2046
2090
|
margin: 0 0 var(--spacing-xs);
|
|
2047
2091
|
`;
|
|
2048
|
-
var variableBindButton2 = css6`
|
|
2049
|
-
align-items: center;
|
|
2050
|
-
border: none;
|
|
2051
|
-
border-radius: var(--rounded-base);
|
|
2052
|
-
background: none;
|
|
2053
|
-
display: flex;
|
|
2054
|
-
height: 1.2rem;
|
|
2055
|
-
padding: var(--spacing-2xs);
|
|
2056
|
-
transition:
|
|
2057
|
-
background var(--duration-fast) var(--timing-ease-out),
|
|
2058
|
-
color var(--duration-fast) var(--timing-ease-out);
|
|
2059
|
-
width: 1.2rem;
|
|
2060
|
-
|
|
2061
|
-
&:hover,
|
|
2062
|
-
&[aria-pressed='true']:not(:disabled) {
|
|
2063
|
-
background: var(--brand-secondary-3);
|
|
2064
|
-
color: var(--white);
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
|
-
&[aria-disabled='true'] {
|
|
2068
|
-
background: none;
|
|
2069
|
-
color: currentColor;
|
|
2070
|
-
}
|
|
2071
|
-
`;
|
|
2072
2092
|
|
|
2073
2093
|
// src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
|
|
2074
2094
|
import { useLexicalComposerContext as useLexicalComposerContext6 } from "@lexical/react/LexicalComposerContext";
|
|
@@ -2115,7 +2135,7 @@ function SelectVariableMenu({
|
|
|
2115
2135
|
css: [menuBtn, buttonCss],
|
|
2116
2136
|
type: "button",
|
|
2117
2137
|
"data-testid": "insert-variable",
|
|
2118
|
-
children: /* @__PURE__ */ jsx23(CgUsbC, { size: "
|
|
2138
|
+
children: /* @__PURE__ */ jsx23(CgUsbC, { size: "1rem" })
|
|
2119
2139
|
}
|
|
2120
2140
|
),
|
|
2121
2141
|
children: [
|
|
@@ -2208,7 +2228,7 @@ function VariableField({
|
|
|
2208
2228
|
VariablesComposerVariableMenu,
|
|
2209
2229
|
{
|
|
2210
2230
|
...selectVariableMenuOptions,
|
|
2211
|
-
buttonCss: [
|
|
2231
|
+
buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
|
|
2212
2232
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
2213
2233
|
}
|
|
2214
2234
|
) }) : null;
|
|
@@ -2460,7 +2480,8 @@ function InputVariables(props) {
|
|
|
2460
2480
|
styleVariant = "default",
|
|
2461
2481
|
renderMenuInPortal,
|
|
2462
2482
|
disableDismissEditorOnChange,
|
|
2463
|
-
singleTokenMode
|
|
2483
|
+
singleTokenMode,
|
|
2484
|
+
disableVariableDisplayNames
|
|
2464
2485
|
} = props;
|
|
2465
2486
|
const [finalId] = useState7(id != null ? id : () => v4());
|
|
2466
2487
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -2496,6 +2517,7 @@ function InputVariables(props) {
|
|
|
2496
2517
|
portal: renderMenuInPortal,
|
|
2497
2518
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2498
2519
|
useInputWhenNoVariables: useInputWithNoVariables,
|
|
2520
|
+
isActive: hadVariablesInValue,
|
|
2499
2521
|
children: /* @__PURE__ */ jsx28(
|
|
2500
2522
|
VariablesComposerInput,
|
|
2501
2523
|
{
|
|
@@ -2569,6 +2591,7 @@ function InputVariables(props) {
|
|
|
2569
2591
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2570
2592
|
autoFocus,
|
|
2571
2593
|
filterVariable,
|
|
2594
|
+
disableVariableDisplayNames,
|
|
2572
2595
|
children: [
|
|
2573
2596
|
/* @__PURE__ */ jsx28(PasteTransformerPlugin, { transformPaste }),
|
|
2574
2597
|
/* @__PURE__ */ jsx28(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
@@ -2583,6 +2606,7 @@ function InputVariablesOverlayMenu({
|
|
|
2583
2606
|
disabled,
|
|
2584
2607
|
useInputWhenNoVariables,
|
|
2585
2608
|
portal,
|
|
2609
|
+
isActive,
|
|
2586
2610
|
...props
|
|
2587
2611
|
}) {
|
|
2588
2612
|
if (disabled) {
|
|
@@ -2596,7 +2620,8 @@ function InputVariablesOverlayMenu({
|
|
|
2596
2620
|
...props,
|
|
2597
2621
|
portal,
|
|
2598
2622
|
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
2599
|
-
buttonCss: menuBtn2
|
|
2623
|
+
buttonCss: [menuBtn2, variableBindButton],
|
|
2624
|
+
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
2600
2625
|
}
|
|
2601
2626
|
)
|
|
2602
2627
|
] });
|
|
@@ -2649,7 +2674,7 @@ function ParameterConnectionIndicator({
|
|
|
2649
2674
|
css: [menuBtn, variableBindButton],
|
|
2650
2675
|
type: "button",
|
|
2651
2676
|
"data-testid": "insert-variable",
|
|
2652
|
-
children: /* @__PURE__ */ jsx29(CgUsbC2, { size: "
|
|
2677
|
+
children: /* @__PURE__ */ jsx29(CgUsbC2, { size: "1rem" })
|
|
2653
2678
|
}
|
|
2654
2679
|
)
|
|
2655
2680
|
}
|
|
@@ -3140,7 +3165,8 @@ function TextVariableRenderer({ definition, value, setValue }) {
|
|
|
3140
3165
|
value: value != null ? value : "",
|
|
3141
3166
|
caption: (_a = definition.helpText) != null ? _a : definition.default !== "" ? `Default value: ${definition.default}` : void 0,
|
|
3142
3167
|
onChange: setValue,
|
|
3143
|
-
"data-testid": "variable-input"
|
|
3168
|
+
"data-testid": "variable-input",
|
|
3169
|
+
disableInlineMenu: "by-label"
|
|
3144
3170
|
}
|
|
3145
3171
|
) });
|
|
3146
3172
|
}
|
|
@@ -4204,7 +4230,7 @@ var ObjectSearchListItem = ({
|
|
|
4204
4230
|
),
|
|
4205
4231
|
/* @__PURE__ */ jsxs23("div", { css: ObjectListItemInfoContainer, children: [
|
|
4206
4232
|
selected ? /* @__PURE__ */ jsx49(Chip, { text: "selected", size: "xs" }) : null,
|
|
4207
|
-
!popoverData ? null : /* @__PURE__ */ jsx49(Popover, { ariaLabel: title, buttonText: `See ${title} details`,
|
|
4233
|
+
!popoverData ? null : /* @__PURE__ */ jsx49(Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4208
4234
|
] }),
|
|
4209
4235
|
!children ? null : /* @__PURE__ */ jsx49("div", { css: ObjectListItemUnControlledContent, children })
|
|
4210
4236
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk-react",
|
|
3
|
-
"version": "20.35.
|
|
3
|
+
"version": "20.35.1-alpha.58+f229d40de4",
|
|
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.35.
|
|
54
|
-
"@uniformdev/design-system": "20.35.
|
|
55
|
-
"@uniformdev/mesh-sdk": "20.35.
|
|
56
|
-
"@uniformdev/richtext": "20.35.
|
|
53
|
+
"@uniformdev/canvas": "20.35.1-alpha.58+f229d40de4",
|
|
54
|
+
"@uniformdev/design-system": "20.35.1-alpha.58+f229d40de4",
|
|
55
|
+
"@uniformdev/mesh-sdk": "20.35.1-alpha.58+f229d40de4",
|
|
56
|
+
"@uniformdev/richtext": "20.35.1-alpha.58+f229d40de4",
|
|
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": "
|
|
89
|
+
"gitHead": "f229d40de49a1a7e2bba9d2e0a36d4aae6251c81"
|
|
90
90
|
}
|