@uniformdev/mesh-sdk-react 19.35.2 → 19.35.3-alpha.82
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 +1480 -0
- package/dist/index.d.ts +372 -55
- package/dist/index.esm.js +1888 -2570
- package/dist/index.js +1932 -2586
- package/dist/index.mjs +1888 -2570
- package/package.json +7 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
|
-
import React__default, { SVGProps,
|
|
3
|
+
import React__default, { SVGProps, ReactNode, MutableRefObject, ComponentType, PropsWithChildren, HTMLAttributes, AnchorHTMLAttributes } from 'react';
|
|
4
4
|
import { TDate } from 'timeago.js';
|
|
5
5
|
import * as _emotion_react from '@emotion/react';
|
|
6
6
|
import * as _uniformdev_mesh_sdk from '@uniformdev/mesh-sdk';
|
|
7
|
-
import { DynamicInput, MeshLocation, SetValueOptions, DynamicInputs, DataSourceLocationValue, DataTypeLocationValue } from '@uniformdev/mesh-sdk';
|
|
7
|
+
import { DynamicInput, MeshLocation, SetValueOptions, DynamicInputs, DataSourceLocationValue, DataTypeLocationValue, BindableTypes } from '@uniformdev/mesh-sdk';
|
|
8
8
|
export * from '@uniformdev/mesh-sdk';
|
|
9
9
|
import { DataVariableDefinition, DataResourceVariables, DataType } from '@uniformdev/canvas';
|
|
10
10
|
import { Emitter } from 'mitt';
|
|
11
11
|
import { BadgeThemeProps, InputSelectProps } from '@uniformdev/design-system';
|
|
12
12
|
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 } from '@uniformdev/design-system';
|
|
13
|
+
import * as lexical from 'lexical';
|
|
14
|
+
import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, LexicalEditor, LexicalNode, EditorState } from 'lexical';
|
|
15
|
+
import { MenuOption } from '@lexical/react/LexicalTypeaheadMenuPlugin';
|
|
13
16
|
|
|
14
17
|
declare const SvgCaution: (props: SVGProps<SVGSVGElement>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
15
18
|
|
|
@@ -369,16 +372,18 @@ declare const damSelectItemImage: _emotion_react.SerializedStyles;
|
|
|
369
372
|
|
|
370
373
|
type MinimalDynamicInput = Omit<DynamicInput, 'source'>;
|
|
371
374
|
type MinimalDynamicInputs = Record<string, MinimalDynamicInput>;
|
|
372
|
-
type DataResourceDynamicInputProviderProps =
|
|
375
|
+
type DataResourceDynamicInputProviderProps = {
|
|
373
376
|
/** Explicitly provide dynamic input values. If not set, Mesh location will be used */
|
|
374
377
|
dynamicInputs?: MinimalDynamicInputs;
|
|
375
|
-
|
|
378
|
+
/** Child components of the provider. Variables-using components, such as InputVariables, can be used here. */
|
|
379
|
+
children: ReactNode;
|
|
380
|
+
};
|
|
376
381
|
/**
|
|
377
382
|
* Wrapper for data resource locations. Provides read-only access to dynamic inputs as if they were variables,
|
|
378
383
|
* using variables-aware components (i.e. InputVariables). This simplifies building dynamic-input-aware editors,
|
|
379
384
|
* where a data resource variable could be a static value or bound to a dynamic input from the route (project map).
|
|
380
385
|
*/
|
|
381
|
-
declare function DataResourceDynamicInputProvider(
|
|
386
|
+
declare function DataResourceDynamicInputProvider(props: DataResourceDynamicInputProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
382
387
|
|
|
383
388
|
/**
|
|
384
389
|
* Provides convenient access to the current Uniform Mesh location via React hook.
|
|
@@ -441,6 +446,182 @@ type DispatchResult<TSetValue> = {
|
|
|
441
446
|
newValue: TSetValue;
|
|
442
447
|
};
|
|
443
448
|
|
|
449
|
+
/**
|
|
450
|
+
* Updates the Lexical editor state automatically when a controlled value changes, effectively
|
|
451
|
+
* turning the Lexical editor into a controlled component.
|
|
452
|
+
*
|
|
453
|
+
* DO NOT USE THIS when actually editing with Lexical as it will cause performance problems.
|
|
454
|
+
* This is intended to be used:
|
|
455
|
+
* * To simplify a read-only "preview" editor, where the user can't edit the value
|
|
456
|
+
* * To sync an external state with the Lexical editor state under certain conditions (i.e. composer mounted, but editor hidden)
|
|
457
|
+
*/
|
|
458
|
+
declare function ControlledValuePlugin({ enabled, value, extraDependencies, }: {
|
|
459
|
+
/** Whether to enable the controlled value plugin. Defaults to false. The value is only controlled when set to true. */
|
|
460
|
+
enabled: boolean;
|
|
461
|
+
value: string | undefined | SerializedEditorState<SerializedLexicalNode>;
|
|
462
|
+
extraDependencies?: unknown[];
|
|
463
|
+
}): JSX.Element | null;
|
|
464
|
+
|
|
465
|
+
type SerializedVariableNode = Spread<{
|
|
466
|
+
reference: string;
|
|
467
|
+
type: 'variable';
|
|
468
|
+
version: 1;
|
|
469
|
+
}, SerializedLexicalNode>;
|
|
470
|
+
type VariableNodeState = {
|
|
471
|
+
/** Display name to show on the variable */
|
|
472
|
+
displayName: string;
|
|
473
|
+
/**
|
|
474
|
+
* Whether the variable reference is currently pointing to a known variable in the variables context
|
|
475
|
+
* Note that this is ignored if `isFresh` is true, which is set for the result of edits or insertions
|
|
476
|
+
* made after the editor has mounted (which we know are good and don't validate to prevent flicker or false errors)
|
|
477
|
+
*/
|
|
478
|
+
referenceIsValid: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Whether the variable node has been inserted or edited during this editing session
|
|
481
|
+
* Fresh nodes are always considered "valid" because they are the result of a user action
|
|
482
|
+
*/
|
|
483
|
+
isFresh: boolean;
|
|
484
|
+
/** Whether clicking the node has an effect (dispatching an edit event) */
|
|
485
|
+
hasClickEvent: boolean | undefined;
|
|
486
|
+
/** Tooltip of the node on hove */
|
|
487
|
+
tooltip: string | undefined;
|
|
488
|
+
};
|
|
489
|
+
/** Renders a variable reference node within a Lexical editor */
|
|
490
|
+
declare class VariableNode extends DecoratorNode<JSX.Element> {
|
|
491
|
+
reference: Readonly<string>;
|
|
492
|
+
private __state;
|
|
493
|
+
static getType(): string;
|
|
494
|
+
static clone(node: VariableNode): VariableNode;
|
|
495
|
+
/** Imports the node from serialized JSON (i.e. the data provided to the editor's initial state) */
|
|
496
|
+
static importJSON(serializedNode: SerializedVariableNode): VariableNode;
|
|
497
|
+
constructor(reference: Readonly<string>, state: VariableNodeState, key?: NodeKey);
|
|
498
|
+
/** Gets the node's current state */
|
|
499
|
+
getState(): VariableNodeState;
|
|
500
|
+
/**
|
|
501
|
+
* Updates the node's variables state so it knows its current validity, display name, etc
|
|
502
|
+
* The plugin updates this whenever the variables prop changes.
|
|
503
|
+
*/
|
|
504
|
+
setState(state: VariableNodeState): void;
|
|
505
|
+
/**
|
|
506
|
+
* Serializes the node to JSON for editor initial state
|
|
507
|
+
*/
|
|
508
|
+
exportJSON(): {
|
|
509
|
+
reference: string;
|
|
510
|
+
type: string;
|
|
511
|
+
version: number;
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Copy variable to clipboard in a format we will read back if pasted
|
|
515
|
+
* (albeit it won't get the fancy chip-node)
|
|
516
|
+
*/
|
|
517
|
+
getTextContent(): string;
|
|
518
|
+
/** Creates the DOM wrapper that hosts the node */
|
|
519
|
+
createDOM(): HTMLSpanElement;
|
|
520
|
+
updateDOM(): boolean;
|
|
521
|
+
/**
|
|
522
|
+
* Render the variable node using React.
|
|
523
|
+
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
524
|
+
* rely on Context, etc in this renderer.
|
|
525
|
+
*/
|
|
526
|
+
decorate(editor: LexicalEditor): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
527
|
+
/** Enables keyboard navigation to hop over the node to previous text */
|
|
528
|
+
isIsolated(): boolean;
|
|
529
|
+
}
|
|
530
|
+
declare function $createVariableNode(variableReference: string, state: VariableNodeState): VariableNode;
|
|
531
|
+
declare function $isVariableNode(node: LexicalNode | null | undefined): node is VariableNode;
|
|
532
|
+
|
|
533
|
+
type MeshDataVariableDefinition = Omit<DataVariableDefinition, 'default'> & {
|
|
534
|
+
/** When used in code, variables may have non-string defaults */
|
|
535
|
+
default: unknown;
|
|
536
|
+
/**
|
|
537
|
+
* If true the variable will not be shown in variables listings and menus, but can still be resolved
|
|
538
|
+
* Useful for variables that are defined by their presence in a value, and disappear when deleted from the value,
|
|
539
|
+
* like bindings.
|
|
540
|
+
*/
|
|
541
|
+
ephemeral?: boolean;
|
|
542
|
+
/**
|
|
543
|
+
* Prevents editing the variable if set to true. If the variable context is set to read only,
|
|
544
|
+
* this is ignored and is always effectively true.
|
|
545
|
+
*/
|
|
546
|
+
readOnly?: boolean;
|
|
547
|
+
/**
|
|
548
|
+
* Tooltip for the variable when rendered in content UI.
|
|
549
|
+
* If not passed, defaults to helpText.
|
|
550
|
+
*/
|
|
551
|
+
tooltip?: string;
|
|
552
|
+
};
|
|
553
|
+
type DataVariableDefinitionWithName = {
|
|
554
|
+
name: string;
|
|
555
|
+
} & MeshDataVariableDefinition;
|
|
556
|
+
/**
|
|
557
|
+
* Converts variable definitions stored in a map into a flat list,
|
|
558
|
+
* respecting their `order` property if set, and sorting by display name otherwise.
|
|
559
|
+
*/
|
|
560
|
+
declare function variablesToList(variables: Record<string, MeshDataVariableDefinition> | undefined): Array<DataVariableDefinitionWithName>;
|
|
561
|
+
|
|
562
|
+
type VariableSourceGroup = {
|
|
563
|
+
name: string | undefined;
|
|
564
|
+
variables: Array<DataVariableDefinitionWithName>;
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* Groups variable definitions by their `source` property, and sorts the groups using `variablesToList`.
|
|
568
|
+
* Returns a flat list of groups and variables. Groups are sorted alphabetically.
|
|
569
|
+
*/
|
|
570
|
+
declare function variablesToGroupedList(variables: Record<string, MeshDataVariableDefinition> | undefined): Array<VariableSourceGroup>;
|
|
571
|
+
|
|
572
|
+
type EditVariableCommandArguments = {
|
|
573
|
+
/** Lexical node key that is being edited */
|
|
574
|
+
sourceKey: string | undefined;
|
|
575
|
+
/** The variable reference to edit */
|
|
576
|
+
reference: string;
|
|
577
|
+
};
|
|
578
|
+
type InsertVariableCommandArguments = {
|
|
579
|
+
reference: string;
|
|
580
|
+
/**
|
|
581
|
+
* Optionally pass in display name if you have it
|
|
582
|
+
* avoids a flash of the reference name
|
|
583
|
+
*/
|
|
584
|
+
initialDisplayName?: string;
|
|
585
|
+
/**
|
|
586
|
+
* If specified, the lexical node with this key is overwritten by the insert.
|
|
587
|
+
* If unspecified, the current selection is overwritten, or inserted to if a single location.
|
|
588
|
+
*/
|
|
589
|
+
targetKey: string | undefined;
|
|
590
|
+
};
|
|
591
|
+
/** Opens the variable editor for an existing variable node */
|
|
592
|
+
declare const EDIT_VARIABLE_COMMAND: lexical.LexicalCommand<EditVariableCommandArguments>;
|
|
593
|
+
/** Inserts a new variable node at the current selection, or replacing a specific node key */
|
|
594
|
+
declare const INSERT_VARIABLE_COMMAND: lexical.LexicalCommand<InsertVariableCommandArguments>;
|
|
595
|
+
type VariablesPluginProps<TEditorContext = unknown> = {
|
|
596
|
+
/** Disables adding variable references via autocomplete. Any existing variables will be rendered as variables. */
|
|
597
|
+
disableVariables?: boolean;
|
|
598
|
+
/** Enables 'add variable' option in autocomplete */
|
|
599
|
+
showAddVariableMenuOption?: boolean | string;
|
|
600
|
+
/** Enables clicking a variable reference to edit the variable */
|
|
601
|
+
enableEditingVariables?: boolean;
|
|
602
|
+
/** Computes the editor context when a variable is added or edited from this composer */
|
|
603
|
+
getEditorContext?: () => TEditorContext;
|
|
604
|
+
};
|
|
605
|
+
type UseVariablesMenuInput = Pick<VariablesPluginProps, 'showAddVariableMenuOption' | 'enableEditingVariables'>;
|
|
606
|
+
type OnVariableSelectInput = {
|
|
607
|
+
value: string;
|
|
608
|
+
queryString?: string;
|
|
609
|
+
nodeToReplace?: LexicalNode;
|
|
610
|
+
editor: LexicalEditor;
|
|
611
|
+
};
|
|
612
|
+
type UseVariablesMenu = (input: UseVariablesMenuInput) => {
|
|
613
|
+
groupedVariables: VariableSourceGroup[];
|
|
614
|
+
menuOptions: MenuOption[];
|
|
615
|
+
onSelect: (input: OnVariableSelectInput) => void;
|
|
616
|
+
};
|
|
617
|
+
/** Hook to use the lexical variables typeahead/dropdown menu */
|
|
618
|
+
declare const useVariablesMenu: UseVariablesMenu;
|
|
619
|
+
/**
|
|
620
|
+
* Enables variables auto-complete and reference management to a Lexical editor.
|
|
621
|
+
* Must also activate the VariableNode node to make this work.
|
|
622
|
+
*/
|
|
623
|
+
declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
|
|
624
|
+
|
|
444
625
|
type PasteTransformerPluginProps = {
|
|
445
626
|
/**
|
|
446
627
|
* Transforms pasted contents before inserting them.
|
|
@@ -449,23 +630,46 @@ type PasteTransformerPluginProps = {
|
|
|
449
630
|
transformPaste?: (pastedText: string) => string | undefined;
|
|
450
631
|
};
|
|
451
632
|
|
|
452
|
-
type
|
|
453
|
-
|
|
454
|
-
|
|
633
|
+
type UseInputVariablesStateProps<TEditorContext = unknown> = {
|
|
634
|
+
/**
|
|
635
|
+
* Sets the value of the input
|
|
636
|
+
* NOTE: this is NOT reactive after mount
|
|
637
|
+
*/
|
|
638
|
+
value: string | undefined;
|
|
639
|
+
/** Callback to receive changes to the value of the variables input */
|
|
640
|
+
onChange: (newValue: string | undefined) => void;
|
|
641
|
+
/**
|
|
642
|
+
* The value to set the field to when it's "reset" from a variables-input to a custom component.
|
|
643
|
+
* Defaults to undefined.
|
|
644
|
+
*/
|
|
645
|
+
valueToResetTo?: string | undefined;
|
|
646
|
+
/** Disables using variables in the input */
|
|
647
|
+
disableVariables?: boolean;
|
|
648
|
+
/**
|
|
649
|
+
* Enables adding variables from the menu. If a string is passed,
|
|
650
|
+
* the option is enabled and the string is used as the menu label.
|
|
651
|
+
*/
|
|
652
|
+
showAddVariableMenuOption?: boolean | string;
|
|
653
|
+
/**
|
|
654
|
+
* When no variables are referenced in the value, and this prop is provided,
|
|
655
|
+
* the variables-injection input will be replaced with this component.
|
|
656
|
+
*
|
|
657
|
+
* NOTE: When this prop is provided, the and a variable is inserted, any existing value
|
|
658
|
+
* in the input will be replaced with the variable reference. Once in variables-mode, additional
|
|
659
|
+
* insertions are inserted at the current selection (or end) of the variables value.
|
|
660
|
+
*/
|
|
661
|
+
inputWhenNoVariables?: JSX.Element;
|
|
662
|
+
/** Computes the editor context when a variable is added or edited from this composer */
|
|
663
|
+
getEditorContext?: () => TEditorContext;
|
|
455
664
|
};
|
|
456
|
-
|
|
665
|
+
|
|
666
|
+
type InputVariablesProps<TEditorContext = unknown> = {
|
|
457
667
|
/** Sets a HTML ID for the variables input and label */
|
|
458
668
|
id?: string;
|
|
459
669
|
/** Enables a label for the input */
|
|
460
670
|
label?: string;
|
|
461
671
|
/** sets the input aria-label value. */
|
|
462
672
|
'aria-label'?: string;
|
|
463
|
-
/** sets the value of the input */
|
|
464
|
-
value: string;
|
|
465
|
-
/** sets the passed down function call */
|
|
466
|
-
onChange: (newValue: string) => void;
|
|
467
|
-
/** Disables using variables in the input */
|
|
468
|
-
disableVariables?: boolean;
|
|
469
673
|
/**
|
|
470
674
|
* Turns off the 'Reset' menu option that is added when:
|
|
471
675
|
* - inputWhenNoVariables is passed in
|
|
@@ -473,20 +677,18 @@ type InputVariablesProps = {
|
|
|
473
677
|
*
|
|
474
678
|
* The reset button returns the editor to the inputWithNoVariables state
|
|
475
679
|
*
|
|
476
|
-
* @deprecated
|
|
680
|
+
* @deprecated this is ignored if passed, computation is now automatic
|
|
477
681
|
*/
|
|
478
682
|
disableReset?: boolean;
|
|
479
|
-
/** Enables
|
|
480
|
-
|
|
683
|
+
/** Enables mutliple lines in the input (\n in the value) */
|
|
684
|
+
multiLine?: boolean;
|
|
481
685
|
/** Disables the inline variable selection menu when rendering a variables input */
|
|
482
686
|
disableInlineMenu?: boolean;
|
|
483
|
-
/** Enables clicking a variable reference to edit the variable */
|
|
484
|
-
enableEditingVariables?: boolean;
|
|
485
687
|
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
688
|
+
* Enables clicking a variable reference to edit the variable
|
|
689
|
+
* Note: automatically disabled if `disabled` or `disableVariables` is set
|
|
488
690
|
*/
|
|
489
|
-
|
|
691
|
+
enableEditingVariables?: boolean;
|
|
490
692
|
/** (optional) sets and shows the the error message value */
|
|
491
693
|
errorMessage?: string;
|
|
492
694
|
/** (optional) sets and shows the the warning message value */
|
|
@@ -495,37 +697,87 @@ type InputVariablesProps = {
|
|
|
495
697
|
infoMessage?: string;
|
|
496
698
|
/** (optional) sets caption text value */
|
|
497
699
|
caption?: string;
|
|
700
|
+
/** Disables editing the value of the input, editing variables, and adding variables */
|
|
701
|
+
disabled?: boolean;
|
|
498
702
|
/** Sets the test ID of the input */
|
|
499
703
|
'data-test-id'?: string;
|
|
500
|
-
|
|
501
|
-
|
|
704
|
+
/**
|
|
705
|
+
* Optional ref to get a handle to the variables editor.
|
|
706
|
+
* This can be useful for situations such as:
|
|
707
|
+
* * Once initially set, `value` prop is no longer reactive and the editor owns its state. The ref can be used to set the editor state after load.
|
|
708
|
+
* * Performing other custom mutations to the variables editor, such as inserting text from a button click.
|
|
709
|
+
*/
|
|
710
|
+
editorRef?: MutableRefObject<LexicalEditor | null>;
|
|
711
|
+
} & PasteTransformerPluginProps & UseInputVariablesStateProps<TEditorContext>;
|
|
712
|
+
/**
|
|
713
|
+
* An input box that enables insertion of 'variables', provided by VariablesProvider,
|
|
714
|
+
* into its value.
|
|
715
|
+
*/
|
|
716
|
+
declare function InputVariables<TEditorContext = unknown>(props: InputVariablesProps<TEditorContext>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
502
717
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
718
|
+
type ParameterConnectionIndicatorProps = {
|
|
719
|
+
disabled?: boolean;
|
|
720
|
+
value: unknown;
|
|
721
|
+
children: ReactNode;
|
|
722
|
+
menuOptions: ReactNode;
|
|
723
|
+
};
|
|
724
|
+
/**
|
|
725
|
+
* An input box that enables insertion of 'variables', provided by VariablesProvider,
|
|
726
|
+
* into its value. Designed specifically for use in the Canvas Parameter Editor.
|
|
727
|
+
*/
|
|
728
|
+
declare function ParameterConnectionIndicator({ children, value, menuOptions, disabled, }: ParameterConnectionIndicatorProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
507
729
|
|
|
508
|
-
type
|
|
509
|
-
|
|
510
|
-
|
|
730
|
+
type ParameterOrSingleVariableProps<TEditorContext = unknown> = {
|
|
731
|
+
disabled?: boolean;
|
|
732
|
+
inputWhenNoVariables: JSX.Element;
|
|
733
|
+
enableEditingVariables?: boolean;
|
|
734
|
+
} & Omit<UseInputVariablesStateProps<TEditorContext>, 'inputWhenNoVariables'>;
|
|
511
735
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
736
|
+
* A parameter which can be one of a custom parameter editor (`inputWhenNoVariables`),
|
|
737
|
+
* or one single variable value (not multiple). Use for parameters which can only have one variable value,
|
|
738
|
+
* possibly because they bind to objects or arrays.
|
|
739
|
+
* Designed visually for use in the Canvas Parameter Editor.
|
|
740
|
+
*/
|
|
741
|
+
declare function ParameterOrSingleVariable<TEditorContext = unknown>(props: ParameterOrSingleVariableProps<TEditorContext>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
742
|
+
|
|
743
|
+
type ParameterVariablesProps<TEditorContext = unknown> = {
|
|
744
|
+
/** sets the input aria-label value. */
|
|
745
|
+
'aria-label'?: string;
|
|
746
|
+
/** Sets the test ID of the input */
|
|
747
|
+
'data-test-id'?: string;
|
|
748
|
+
/**
|
|
749
|
+
* Enables mutliple lines in the input (\n in the value).
|
|
750
|
+
* If a number is passed, the height of the editor is set to that number of lines and overflow scrolls.
|
|
751
|
+
* If a boolean true is passed, the editor auto-sizes to the content.
|
|
752
|
+
*/
|
|
753
|
+
multiLine?: boolean | number;
|
|
754
|
+
/** Disables editing the value of the input, editing variables, and adding variables */
|
|
755
|
+
disabled?: boolean;
|
|
756
|
+
/**
|
|
757
|
+
* Optional ref to get a handle to the variables editor.
|
|
758
|
+
* This can be useful for situations such as:
|
|
759
|
+
* * Once initially set, `value` prop is no longer reactive and the editor owns its state. The ref can be used to set the editor state after load.
|
|
760
|
+
* * Performing other custom mutations to the variables editor, such as inserting text from a button click.
|
|
761
|
+
*/
|
|
762
|
+
editorRef?: MutableRefObject<LexicalEditor | null>;
|
|
763
|
+
} & UseInputVariablesStateProps<TEditorContext>;
|
|
764
|
+
/**
|
|
765
|
+
* An input box that enables insertion of 'variables', provided by VariablesProvider,
|
|
766
|
+
* into its value. Designed visually for use in the Canvas Parameter Editor.
|
|
514
767
|
*/
|
|
515
|
-
declare function
|
|
768
|
+
declare function ParameterVariables<TEditorContext = unknown>(props: ParameterVariablesProps<TEditorContext>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
516
769
|
|
|
517
|
-
type VariableEditorProps = {
|
|
770
|
+
type VariableEditorProps<TEditorContext = unknown> = {
|
|
518
771
|
variable: string;
|
|
519
772
|
onSubmit: (values: DataVariableDefinitionWithName) => void | Promise<void>;
|
|
520
773
|
/** Disables the tip about Mesh integrations. Intended for use when this is placed on a custom Mesh integration to edit variables. */
|
|
521
774
|
disableMeshTip?: boolean;
|
|
522
775
|
onCancel: () => void;
|
|
776
|
+
context: TEditorContext | undefined;
|
|
523
777
|
};
|
|
524
|
-
declare function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }: VariableEditorProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
778
|
+
declare function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }: VariableEditorProps<any>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
525
779
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
type VariablesProviderProps = React$1.PropsWithChildren<{
|
|
780
|
+
type VariablesProviderProps<TEditVariableContext = unknown> = React$1.PropsWithChildren<{
|
|
529
781
|
/**
|
|
530
782
|
* Signals that components in this variables context are not intended to allow mutation
|
|
531
783
|
* of the variable values (i.e. editing, adding, or deleting variable definitions).
|
|
@@ -534,18 +786,20 @@ type VariablesProviderProps = React$1.PropsWithChildren<{
|
|
|
534
786
|
*/
|
|
535
787
|
readOnly?: boolean;
|
|
536
788
|
/** Variable values to load into the context */
|
|
537
|
-
value: Record<string,
|
|
789
|
+
value: Record<string, MeshDataVariableDefinition>;
|
|
538
790
|
/** Function to handle mutations to the variable values (optional when readOnly is true) */
|
|
539
|
-
onChange?: (newValue: Record<string,
|
|
791
|
+
onChange?: (newValue: Record<string, MeshDataVariableDefinition>) => void;
|
|
540
792
|
/**
|
|
541
793
|
* Provide a component to handle editing a variable definition (e.g. a modal wrapper)
|
|
542
794
|
* If not passed, the editor will be rendered inline, with potentially strange results.
|
|
543
795
|
*/
|
|
544
|
-
editVariableComponent?: React$1.ComponentType<VariableEditorProps
|
|
796
|
+
editVariableComponent?: React$1.ComponentType<VariableEditorProps<TEditVariableContext>>;
|
|
545
797
|
}>;
|
|
546
|
-
type VariablesAction = {
|
|
798
|
+
type VariablesAction<TEditVariableContext> = {
|
|
547
799
|
type: 'edit';
|
|
548
800
|
variable: string;
|
|
801
|
+
/** Context that will be passed in a prop to the variables context editing component */
|
|
802
|
+
context?: TEditVariableContext;
|
|
549
803
|
} | {
|
|
550
804
|
type: 'remove';
|
|
551
805
|
variable: string;
|
|
@@ -553,14 +807,22 @@ type VariablesAction = {
|
|
|
553
807
|
type: 'set';
|
|
554
808
|
variable: DataVariableDefinitionWithName;
|
|
555
809
|
openEditor?: boolean;
|
|
810
|
+
/** Context that will be passed in a prop to the variables context editing component. Only has an effect when openEditor = true */
|
|
811
|
+
context?: TEditVariableContext;
|
|
556
812
|
} | {
|
|
557
813
|
type: 'reorder';
|
|
558
814
|
result: Record<string, DataVariableDefinitionWithName>;
|
|
815
|
+
} | {
|
|
816
|
+
type: 'cancelEdit';
|
|
817
|
+
};
|
|
818
|
+
type VariablesUpdateEvent = {
|
|
819
|
+
name: string;
|
|
820
|
+
latestValue: Record<string, MeshDataVariableDefinition>;
|
|
559
821
|
};
|
|
560
822
|
type VariablesEvents = {
|
|
561
|
-
update:
|
|
823
|
+
update: VariablesUpdateEvent;
|
|
562
824
|
};
|
|
563
|
-
type VariablesContext = {
|
|
825
|
+
type VariablesContext<TEditVariableContext> = {
|
|
564
826
|
/**
|
|
565
827
|
* Signals that components in this variables context are not intended to allow mutation
|
|
566
828
|
* of the variable values (i.e. editing, adding, or deleting variable definitions).
|
|
@@ -569,9 +831,9 @@ type VariablesContext = {
|
|
|
569
831
|
*/
|
|
570
832
|
readOnly?: boolean;
|
|
571
833
|
/** Dispatch update events to the variables */
|
|
572
|
-
dispatch: (event: VariablesAction) => void;
|
|
834
|
+
dispatch: (event: VariablesAction<TEditVariableContext>) => void;
|
|
573
835
|
/** The current variables value */
|
|
574
|
-
variables: Readonly<Record<string,
|
|
836
|
+
variables: Readonly<Record<string, MeshDataVariableDefinition>>;
|
|
575
837
|
/** Whether the context is editing a variable value currently */
|
|
576
838
|
isEditing: boolean;
|
|
577
839
|
/** Add event handles (don't forget to unhook) */
|
|
@@ -582,10 +844,40 @@ type VariablesContext = {
|
|
|
582
844
|
* A flattened version of `variables` that is a plain key-value object.
|
|
583
845
|
* Used when binding the variables to a value.
|
|
584
846
|
*/
|
|
585
|
-
flatVariables: Readonly<Record<string,
|
|
847
|
+
flatVariables: Readonly<Record<string, unknown>>;
|
|
586
848
|
};
|
|
587
|
-
declare function VariablesProvider({ value, onChange, editVariableComponent, readOnly, children, }: VariablesProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
588
|
-
declare function useVariables(returnEmptyWithoutProvider?: boolean): VariablesContext
|
|
849
|
+
declare function VariablesProvider<TEditComponentContext = never>({ value, onChange, editVariableComponent, readOnly, children, }: VariablesProviderProps<TEditComponentContext>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
850
|
+
declare function useVariables<TEditComponentContext = unknown>(returnEmptyWithoutProvider?: boolean): VariablesContext<TEditComponentContext>;
|
|
851
|
+
|
|
852
|
+
declare function useOnVariableUpdated(fn: (event: VariablesUpdateEvent) => void, disabled?: boolean): void;
|
|
853
|
+
|
|
854
|
+
/** Converts a connected data map entry to a VariablesProvider-format variable */
|
|
855
|
+
declare function convertConnectedDataToVariable(bindExpression: string, value: unknown): MeshDataVariableDefinition;
|
|
856
|
+
|
|
857
|
+
declare function deserializeVariablesEditorState(serialized: string | undefined): string;
|
|
858
|
+
|
|
859
|
+
declare function prettifyBindExpression(bindExpression: string): string;
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Serializes a Lexical variables-editor state (as a Lexical AST) to a Uniform-variable-reference formatted string
|
|
863
|
+
* Note: if no content is in the editor state, undefined will be returned.
|
|
864
|
+
*/
|
|
865
|
+
declare function serializeVariablesEditorState(editorState: EditorState): string | undefined;
|
|
866
|
+
|
|
867
|
+
declare function variableDefaultTextValue(defaultValue: unknown): string;
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Expected prefix for variable expressions
|
|
871
|
+
* @deprecated
|
|
872
|
+
*/
|
|
873
|
+
declare const variablePrefix = "${";
|
|
874
|
+
/**
|
|
875
|
+
* Expected suffix for variable expressions
|
|
876
|
+
* @deprecated
|
|
877
|
+
*/
|
|
878
|
+
declare const variableSuffix = "}";
|
|
879
|
+
|
|
880
|
+
declare function VariablesList(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
589
881
|
|
|
590
882
|
type DataResourceVariablesListProps = {
|
|
591
883
|
/**
|
|
@@ -1025,6 +1317,25 @@ type QueryFilterProps<TSelectOptions extends QuertFilterSelectionOptionProps = Q
|
|
|
1025
1317
|
*/
|
|
1026
1318
|
declare const QueryFilter: ({ requireContentType, queryFilterTitle, contentTypeLabel, typeSelectorAllTypesOptionText, contentTypeOptions, searchInputName, searchInputPlaceholderText, searchInputLabel, countLabel, countValue, sortLabel, sortOptions, sortOrderLabel, sortOrderOptions, children, }: QueryFilterProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1027
1319
|
|
|
1320
|
+
type ParamTypeDynamicDataProviderProps = {
|
|
1321
|
+
/** Child components of the provider. Variables-using components, such as ParameterVariables, can be used here. */
|
|
1322
|
+
children: ReactNode;
|
|
1323
|
+
};
|
|
1324
|
+
/** Context to tell the binding UI what types are allowed for the current binding expression */
|
|
1325
|
+
type ParameterConnectOptions = {
|
|
1326
|
+
/**
|
|
1327
|
+
* Which JSON primitive types can be connected to this parameter.
|
|
1328
|
+
* Note that if the only value of the parameter is a complex data element connection (object or array), then the connected data will be the literal value, not a string.
|
|
1329
|
+
*/
|
|
1330
|
+
connectsTo: BindableTypes[];
|
|
1331
|
+
};
|
|
1332
|
+
/**
|
|
1333
|
+
* Wrapper for data resource locations. Provides read-only access to dynamic inputs as if they were variables,
|
|
1334
|
+
* using variables-aware components (i.e. InputVariables). This simplifies building dynamic-input-aware editors,
|
|
1335
|
+
* where a data resource variable could be a static value or bound to a dynamic input from the route (project map).
|
|
1336
|
+
*/
|
|
1337
|
+
declare function ParamTypeDynamicDataProvider(props: ParamTypeDynamicDataProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1338
|
+
|
|
1028
1339
|
/** Editor component to let you write a request body for POST requests */
|
|
1029
1340
|
declare function RequestBody(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1030
1341
|
|
|
@@ -1116,10 +1427,10 @@ declare function RequestUrl(): _emotion_react_types_jsx_namespace.EmotionJSX.Ele
|
|
|
1116
1427
|
* Editor to modify the current URL of the request
|
|
1117
1428
|
* Note: entering query string parameters automatically converts them and syncs the request state with them
|
|
1118
1429
|
*/
|
|
1119
|
-
declare function RequestUrlInput(props: Omit<InputVariablesProps, 'value' | 'onChange'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1430
|
+
declare function RequestUrlInput(props: Omit<InputVariablesProps, 'value' | 'onChange'> & Pick<InputVariablesProps, 'showAddVariableMenuOption' | 'enableEditingVariables'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1120
1431
|
|
|
1121
|
-
declare function urlEncodeRequestUrl(url: string, varValues?: Record<string,
|
|
1122
|
-
declare function urlEncodeRequestParameter(parameter: RequestParameter, varValues?: Record<string,
|
|
1432
|
+
declare function urlEncodeRequestUrl(url: string, varValues?: Record<string, MeshDataVariableDefinition>): string;
|
|
1433
|
+
declare function urlEncodeRequestParameter(parameter: RequestParameter, varValues?: Record<string, MeshDataVariableDefinition>): RequestParameter;
|
|
1123
1434
|
|
|
1124
1435
|
/**
|
|
1125
1436
|
* Hook to make it simple to read and write a specific request header by name,
|
|
@@ -1145,6 +1456,12 @@ declare function useRequestParameter(paramName: string): {
|
|
|
1145
1456
|
update: (value: string) => void;
|
|
1146
1457
|
};
|
|
1147
1458
|
|
|
1459
|
+
/** Converts connected data map into VariablesProvider-format variables */
|
|
1460
|
+
declare function useConnectedDataAsVariables(connectedData: Record<string, unknown> | undefined): Record<string, MeshDataVariableDefinition>;
|
|
1461
|
+
|
|
1462
|
+
/** Converts dynamic inputs into VariablesProvider-format variables */
|
|
1463
|
+
declare function useDynamicInputsAsVariables(dynamicInputs: MinimalDynamicInputs): Record<string, MeshDataVariableDefinition>;
|
|
1464
|
+
|
|
1148
1465
|
/**
|
|
1149
1466
|
* Provides convenient access to the current Uniform Mesh SDK instance via React hook.
|
|
1150
1467
|
* Intended to be used within <MeshApp />.
|
|
@@ -1160,4 +1477,4 @@ declare function useUniformMeshSdk(): _uniformdev_mesh_sdk.UniformMeshSDK;
|
|
|
1160
1477
|
*/
|
|
1161
1478
|
declare function createLocationValidator<TSetValue>(setValue: SetLocationValueDispatch<TSetValue>, validate: (newValue: TSetValue, currentResult: SetValueOptions | undefined) => SetValueOptions): SetLocationValueDispatch<TSetValue>;
|
|
1162
1479
|
|
|
1163
|
-
export { BaseRequestData, Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DataRefreshButton, DataRefreshButtonProps, DataResourceDynamicInputProvider, DataResourceDynamicInputProviderProps, DataResourceVariableRendererProps, DataResourceVariablesList, DataResourceVariablesListExplicit, DataResourceVariablesListProps, DataSourceEditor, DataSourceEditorProps, DataTypeEditor, DataTypeEditorProps, DataVariableDefinitionWithName, DefaultSearchRow, DefaultSelectedItem, DispatchResult, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons,
|
|
1480
|
+
export { $createVariableNode, $isVariableNode, BaseRequestData, Brand, ControlledValuePlugin, DamItem, DamSelectedItem, DamSelectedItemProps, DataRefreshButton, DataRefreshButtonProps, DataResourceDynamicInputProvider, DataResourceDynamicInputProviderProps, DataResourceVariableRendererProps, DataResourceVariablesList, DataResourceVariablesListExplicit, DataResourceVariablesListProps, DataSourceEditor, DataSourceEditorProps, DataTypeEditor, DataTypeEditorProps, DataVariableDefinitionWithName, DefaultSearchRow, DefaultSelectedItem, DispatchResult, EDIT_VARIABLE_COMMAND, EditVariableCommandArguments, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, INSERT_VARIABLE_COMMAND, index as Icons, InputVariables, InputVariablesProps, InsertVariableCommandArguments, ItemListProps, LinkButton, MeshApp, MeshAppProps, MeshDataVariableDefinition, MinimalDynamicInput, MinimalDynamicInputs, NoResultsProps, ObjectSearchContainer, ObjectSearchContainerProps, ObjectSearchContextProps, ObjectSearchFilter, ObjectSearchFilterContainer, ObjectSearchFilterContainerProps, ObjectSearchFilterProps, ObjectSearchListItem, ObjectSearchListItemLoadingSkeleton, ObjectSearchListItemProps, ObjectSearchProvider, ObjectSearchProviderProps, ObjectSearchResultItem, ObjectSearchResultItemButton, ObjectSearchResultItemButtonProps, ObjectSearchResultItemProps, ObjectSearchResultList, ObjectSearchResultListProps, ParamTypeDynamicDataProvider, ParamTypeDynamicDataProviderProps, ParameterConnectOptions, ParameterConnectionIndicator, ParameterConnectionIndicatorProps, ParameterOrSingleVariable, ParameterOrSingleVariableProps, ParameterVariables, ParameterVariablesProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, QueryFilter, QueryFilterProps, QueryFilterSearchProps, RequestAction, RequestBody, RequestContext, RequestData, RequestHeaders, RequestMethodSelect, RequestParameter, RequestParameters, RequestParametersProps, RequestProvider, RequestProviderProps, RequestTypeContainer, RequestTypeContainerProps, RequestUrl, RequestUrlInput, ResolvableLoadingValue, SearchQueryProps, SelectedItemProps, SelectionField, SelectionFieldValue, SerializedVariableNode, SetLocationValueDispatch, SetLocationValueFunction, TextVariableRenderer, UseVariablesMenu, UseVariablesMenuInput, VariableEditor, VariableEditorProps, VariableNode, VariableNodeState, VariableSourceGroup, VariablesAction, VariablesContext, VariablesEvents, VariablesList, VariablesPlugin, VariablesPluginProps, VariablesProvider, VariablesProviderProps, VariablesUpdateEvent, badgeIcon, convertConnectedDataToVariable, createLocationValidator, damSelectItemImage, damSelectedItemContainer, damSelectedItemCopy, damSelectedItemDetails, damSelectedItemIcon, damSelectedItemInfoBtn, damSelectedItemInner, damSelectedItemLinkBtn, damSelectedItemLinkContainer, damSelectedItemMediaContainer, damSelectedItemPopover, damSelectedItemPopoverLabel, damSelectedItemSmallText, damSelectedItemTitle, deserializeVariablesEditorState, draggableContainer, draggableIcon, draggableIconOffset, draggableIconWrapper, entrySearchBtn, entrySearchConfig, entrySearchConfigHidden, entrySearchLoadMoreBtn, entrySearchResultList, entrySearchSelectIcon, entrySearchSelectImg, entrySearchSelectInput, entrySearchSelectOption, entrySearchWrapper, prettifyBindExpression, productSearchRowActiveIcon, productSearchRowCategory, productSearchRowContainer, productSearchRowContent, productSearchRowContentActive, productSearchRowDetails, productSearchRowTitle, productSelectedItemContainer, productSelectedItemContent, productSelectedItemDetails, productSelectedItemIcon, productSelectedItemImage, productSelectedItemLinkContainer, productedSelectedItemLinkBtn, productedSelectedItemSmallText, searchRowBtn, searchRowContainer, searchRowContainerActive, searchRowContainerWithPopover, searchRowPopover, searchRowText, searchRowTextSmall, selectItemLinkBtn, selectItemLinkContainer, selectItemPopover, selectItemPopoverLabel, selectItemSmallText, selectedItemContainer, selectedItemCopy, selectedItemDetails, selectedItemIcon, selectedItemInner, selectedItemTitle, serializeVariablesEditorState, urlEncodeRequestParameter, urlEncodeRequestUrl, useConnectedDataAsVariables, useDynamicInputsAsVariables, useMeshLocation, useObjectSearchContext, useOnVariableUpdated, useProductQueryContext, useProductSearchContext, useRequest, useRequestHeader, useRequestParameter, useUniformMeshSdk, useVariables, useVariablesMenu, variableDefaultTextValue, variablePrefix, variableSuffix, variablesToGroupedList, variablesToList };
|