@uniformdev/mesh-sdk-react 19.38.2 → 19.38.3-alpha.78
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 +515 -56
- package/dist/index.d.ts +515 -56
- package/dist/index.esm.js +2332 -2690
- package/dist/index.js +2278 -2620
- package/dist/index.mjs +2332 -2690
- package/package.json +14 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
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
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
6
7
|
import * as _uniformdev_mesh_sdk from '@uniformdev/mesh-sdk';
|
|
7
|
-
import { DynamicInput, MeshLocation, SetValueOptions, DynamicInputs, DataSourceLocationValue, DataTypeLocationValue } from '@uniformdev/mesh-sdk';
|
|
8
|
+
import { DynamicInput, MeshLocation, SetValueOptions, DynamicInputs, DataSourceLocationValue, DataTypeLocationValue, BindableTypes } from '@uniformdev/mesh-sdk';
|
|
8
9
|
export * from '@uniformdev/mesh-sdk';
|
|
9
10
|
import { DataVariableDefinition, DataResourceVariables, DataType } from '@uniformdev/canvas';
|
|
10
11
|
import { Emitter } from 'mitt';
|
|
11
12
|
import { BadgeThemeProps, InputSelectProps } from '@uniformdev/design-system';
|
|
12
13
|
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';
|
|
14
|
+
import * as lexical from 'lexical';
|
|
15
|
+
import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, LexicalNode, LexicalEditor, EditorState } from 'lexical';
|
|
16
|
+
import { MenuOption } from '@lexical/react/LexicalTypeaheadMenuPlugin';
|
|
13
17
|
|
|
14
18
|
declare const SvgCaution: (props: SVGProps<SVGSVGElement>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
15
19
|
|
|
@@ -55,6 +59,7 @@ declare namespace index {
|
|
|
55
59
|
};
|
|
56
60
|
}
|
|
57
61
|
|
|
62
|
+
/** @deprecated please use ObjectSearchListItem - https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-list-item */
|
|
58
63
|
interface EntrySearchSelectedItemProps<TResult extends EntrySearchResult = EntrySearchResult> {
|
|
59
64
|
selectedItem: TResult;
|
|
60
65
|
logoIcon: string | React__default.ComponentType<{
|
|
@@ -63,14 +68,17 @@ interface EntrySearchSelectedItemProps<TResult extends EntrySearchResult = Entry
|
|
|
63
68
|
onDeselect: (item: TResult) => void;
|
|
64
69
|
onEditClosed?: (item: TResult) => void;
|
|
65
70
|
}
|
|
71
|
+
/** @deprecated please use ObjectSearchListItem - https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-list-item */
|
|
66
72
|
declare const DefaultSelectedItem: React__default.FC<EntrySearchSelectedItemProps>;
|
|
67
73
|
|
|
74
|
+
/** @deprecated in favour of ObjectSearchContainer, see https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-container-with-inputs for implementation details */
|
|
68
75
|
type EntrySearchQueryOptions = {
|
|
69
76
|
count: number;
|
|
70
77
|
offset: number;
|
|
71
78
|
contentType?: string;
|
|
72
79
|
cursor?: string;
|
|
73
80
|
};
|
|
81
|
+
/** @deprecated in favour of ObjectSearchContainer, see https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-container-with-inputs for implementation details */
|
|
74
82
|
type EntrySearchProps<TResult extends EntrySearchResult = EntrySearchResult> = {
|
|
75
83
|
search: (text: string, options: EntrySearchQueryOptions) => void;
|
|
76
84
|
results: TResult[] | undefined;
|
|
@@ -104,6 +112,7 @@ type EntrySearchProps<TResult extends EntrySearchResult = EntrySearchResult> = {
|
|
|
104
112
|
*/
|
|
105
113
|
loadingIndicatorDelay?: number;
|
|
106
114
|
};
|
|
115
|
+
/** @deprecated in favour of ObjectSearchContainer, see https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-container-with-inputs for implementation details */
|
|
107
116
|
interface EntrySearchResult {
|
|
108
117
|
id: string;
|
|
109
118
|
title: string | JSX.Element;
|
|
@@ -112,21 +121,26 @@ interface EntrySearchResult {
|
|
|
112
121
|
metadata?: Record<string, string | JSX.Element>;
|
|
113
122
|
popoverData?: Record<string, string | JSX.Element>;
|
|
114
123
|
}
|
|
124
|
+
/** @deprecated in favour of ObjectSearchContainer, see https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-container-with-inputs for implementation details */
|
|
115
125
|
interface EntrySearchContentType {
|
|
116
126
|
id: string;
|
|
117
127
|
name: string;
|
|
118
128
|
}
|
|
129
|
+
/** @deprecated in favour of ObjectSearchContainer, see https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-container-with-inputs for implementation details */
|
|
119
130
|
interface NoResultsProps {
|
|
120
131
|
searchText: string | undefined;
|
|
121
132
|
selectedContentType: string | undefined;
|
|
122
133
|
}
|
|
134
|
+
/** @deprecated in favour of ObjectSearchContainer, see https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-container-with-inputs for implementation details */
|
|
123
135
|
declare const EntrySearch: <TResult extends EntrySearchResult>({ search, results, contentTypes, selectedItems, logoIcon, select, multiSelect, multiSelectId, rowComponent, selectedItemComponent, totalResults, cursor, resultsLoading, requireContentType, onAddNew, onEditClosed, onCancel, noResultsComponent, helpComponent, onSort, typeSelectorLabel, typeSelectorAllTypesOptionText, loadingIndicatorDelay, }: EntrySearchProps<TResult>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
124
136
|
|
|
137
|
+
/** @deprecated please use ObjectSearchResultItem - https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-result-item */
|
|
125
138
|
interface EntrySearchRowProps<TResult extends EntrySearchResult = EntrySearchResult> {
|
|
126
139
|
result: TResult;
|
|
127
140
|
isSelected: boolean;
|
|
128
141
|
triggerSelection: () => void;
|
|
129
142
|
}
|
|
143
|
+
/** @deprecated please use ObjectSearchResultItem - https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-result-item */
|
|
130
144
|
declare const DefaultSearchRow: React__default.FC<EntrySearchRowProps>;
|
|
131
145
|
|
|
132
146
|
declare const searchRowContainer: _emotion_react.SerializedStyles;
|
|
@@ -194,10 +208,12 @@ interface ProductCategory {
|
|
|
194
208
|
children?: ProductCategory[];
|
|
195
209
|
}
|
|
196
210
|
|
|
211
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
197
212
|
declare const ProductPreviewList: ({ products, }: {
|
|
198
213
|
products: ProductSearchResults['products'] | undefined;
|
|
199
214
|
}) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
200
215
|
|
|
216
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
201
217
|
interface ProductDynamicSelectorValue {
|
|
202
218
|
count: number;
|
|
203
219
|
categories?: string[];
|
|
@@ -206,6 +222,7 @@ interface ProductDynamicSelectorValue {
|
|
|
206
222
|
sort?: string;
|
|
207
223
|
sortOrder?: string;
|
|
208
224
|
}
|
|
225
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
209
226
|
interface ProductQueryProps<TValue extends ProductDynamicSelectorValue = ProductDynamicSelectorValue> {
|
|
210
227
|
value: TValue | undefined;
|
|
211
228
|
setValue: (value: TValue) => Promise<void>;
|
|
@@ -231,21 +248,27 @@ interface ProductQueryProps<TValue extends ProductDynamicSelectorValue = Product
|
|
|
231
248
|
disableBrands?: boolean;
|
|
232
249
|
restrictToSingleCategory?: boolean;
|
|
233
250
|
}
|
|
251
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
234
252
|
interface ProductQueryCategory {
|
|
235
253
|
id: string;
|
|
236
254
|
name: string;
|
|
237
255
|
children?: ProductQueryCategory[];
|
|
238
256
|
}
|
|
257
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
239
258
|
interface Brand {
|
|
240
259
|
id: string;
|
|
241
260
|
name: string;
|
|
242
261
|
}
|
|
262
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
243
263
|
declare const ProductQuery: ({ value, setValue, brands, categories, loading, categoriesLoading, brandsLoading, logoIcon, onGetProducts, sortOptions, sortOrderOptions, categoryLabel, brandLabel, disableBrands, restrictToSingleCategory, }: ProductQueryProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
264
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
244
265
|
interface ProductQueryContextValue {
|
|
245
266
|
categories: ProductQueryProps['categories'];
|
|
246
267
|
logoIcon: ProductQueryProps['logoIcon'];
|
|
247
268
|
}
|
|
269
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
248
270
|
declare const ProductQueryContext: React__default.Context<ProductQueryContextValue | undefined>;
|
|
271
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
249
272
|
declare const useProductQueryContext: () => ProductQueryContextValue;
|
|
250
273
|
|
|
251
274
|
type ProductSearchProps<TResult extends ProductSearchResult = ProductSearchResult> = Pick<EntrySearchProps<TResult>, 'multiSelect' | 'multiSelectId' | 'logoIcon' | 'rowComponent' | 'selectedItemComponent' | 'helpComponent' | 'noResultsComponent' | 'onSort' | 'typeSelectorAllTypesOptionText' | 'typeSelectorLabel'> & {
|
|
@@ -265,12 +288,14 @@ type ProductSearchProps<TResult extends ProductSearchResult = ProductSearchResul
|
|
|
265
288
|
searchError?: Error;
|
|
266
289
|
}>;
|
|
267
290
|
};
|
|
291
|
+
/** @deprecated */
|
|
268
292
|
interface GetProductOptions {
|
|
269
293
|
limit?: number;
|
|
270
294
|
offset?: number;
|
|
271
295
|
categoryId?: string;
|
|
272
296
|
cursor?: string;
|
|
273
297
|
}
|
|
298
|
+
/** @deprecated in favour of ObjectSearchContainer, see https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs for implementation details */
|
|
274
299
|
declare function ProductSearch({ selectedProducts, setSelectedProducts, onGetCategories, onSearchProducts, logoIcon, multiSelect, multiSelectId, selectedItemComponent, rowComponent, errorComponent, helpComponent, noResultsComponent, onSort, typeSelectorAllTypesOptionText, typeSelectorLabel, }: ProductSearchProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
275
300
|
interface ProductSearchContextValue {
|
|
276
301
|
logoIcon: ProductSearchProps['logoIcon'];
|
|
@@ -279,20 +304,25 @@ interface ProductSearchContextValue {
|
|
|
279
304
|
declare const ProductSearchContext: React__default.Context<ProductSearchContextValue | undefined>;
|
|
280
305
|
declare const useProductSearchContext: () => ProductSearchContextValue;
|
|
281
306
|
|
|
307
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
282
308
|
declare function ProductSearchRow({ result, isSelected, triggerSelection, }: EntrySearchRowProps<ProductSearchResult>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
283
309
|
|
|
310
|
+
/** @deprecated please use ObjectSearchResultItem - https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-result-item*/
|
|
284
311
|
declare function ProductSelectedItem({ selectedItem, onDeselect, }: EntrySearchSelectedItemProps<ProductSearchResult>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
285
312
|
|
|
313
|
+
/** @deprecated please use DataRefreshButtonProps - https://mesh-design-system.netlify.app/?path=/story/object-search--data-refresh-button */
|
|
286
314
|
declare const ResolvableLoadingValue: ({ value, text, loading, }: {
|
|
287
315
|
value: string;
|
|
288
316
|
text: string | undefined;
|
|
289
317
|
loading: boolean;
|
|
290
318
|
}) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
291
319
|
|
|
320
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
292
321
|
type SelectionFieldValue = {
|
|
293
322
|
id: string;
|
|
294
323
|
name: string;
|
|
295
324
|
};
|
|
325
|
+
/** @deprecated please use ObjectSearchContainer - https://mesh-design-system.netlify.app/?path=/story/object-search--query-filter-with-inputs*/
|
|
296
326
|
declare const SelectionField: ({ id, label, loading, selectedValues, values, onAdd, onRemove, }: {
|
|
297
327
|
id: string;
|
|
298
328
|
label: string;
|
|
@@ -331,6 +361,7 @@ interface DamItem {
|
|
|
331
361
|
type: 'image' | 'video' | 'file' | 'other';
|
|
332
362
|
}
|
|
333
363
|
|
|
364
|
+
/** @deprecated please use ObjectSearchResultItem - https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-result-item */
|
|
334
365
|
interface DamSelectedItemProps<TResult extends DamItem = DamItem> {
|
|
335
366
|
/** The item used for rendering this component. */
|
|
336
367
|
selectedItem: TResult;
|
|
@@ -350,6 +381,7 @@ interface DamSelectedItemProps<TResult extends DamItem = DamItem> {
|
|
|
350
381
|
item: TResult;
|
|
351
382
|
}>;
|
|
352
383
|
}
|
|
384
|
+
/** @deprecated please use ObjectSearchResultItem - https://mesh-design-system.netlify.app/?path=/story/object-search--object-search-result-item */
|
|
353
385
|
declare function DamSelectedItem({ selectedItem, onDeselect, onEditClosed, logoIcon, itemDetailsRendererComponent, }: DamSelectedItemProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
354
386
|
|
|
355
387
|
declare const damSelectedItemContainer: _emotion_react.SerializedStyles;
|
|
@@ -369,16 +401,18 @@ declare const damSelectItemImage: _emotion_react.SerializedStyles;
|
|
|
369
401
|
|
|
370
402
|
type MinimalDynamicInput = Omit<DynamicInput, 'source'>;
|
|
371
403
|
type MinimalDynamicInputs = Record<string, MinimalDynamicInput>;
|
|
372
|
-
type DataResourceDynamicInputProviderProps =
|
|
404
|
+
type DataResourceDynamicInputProviderProps = {
|
|
373
405
|
/** Explicitly provide dynamic input values. If not set, Mesh location will be used */
|
|
374
406
|
dynamicInputs?: MinimalDynamicInputs;
|
|
375
|
-
|
|
407
|
+
/** Child components of the provider. Variables-using components, such as InputVariables, can be used here. */
|
|
408
|
+
children: ReactNode;
|
|
409
|
+
};
|
|
376
410
|
/**
|
|
377
411
|
* Wrapper for data resource locations. Provides read-only access to dynamic inputs as if they were variables,
|
|
378
412
|
* using variables-aware components (i.e. InputVariables). This simplifies building dynamic-input-aware editors,
|
|
379
413
|
* where a data resource variable could be a static value or bound to a dynamic input from the route (project map).
|
|
380
414
|
*/
|
|
381
|
-
declare function DataResourceDynamicInputProvider(
|
|
415
|
+
declare function DataResourceDynamicInputProvider(props: DataResourceDynamicInputProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
382
416
|
|
|
383
417
|
/**
|
|
384
418
|
* Provides convenient access to the current Uniform Mesh location via React hook.
|
|
@@ -441,6 +475,230 @@ type DispatchResult<TSetValue> = {
|
|
|
441
475
|
newValue: TSetValue;
|
|
442
476
|
};
|
|
443
477
|
|
|
478
|
+
/**
|
|
479
|
+
* Updates the Lexical editor state automatically when a controlled value changes, effectively
|
|
480
|
+
* turning the Lexical editor into a controlled component.
|
|
481
|
+
*
|
|
482
|
+
* DO NOT USE THIS when actually editing with Lexical as it will cause performance problems.
|
|
483
|
+
* This is intended to be used:
|
|
484
|
+
* * To simplify a read-only "preview" editor, where the user can't edit the value
|
|
485
|
+
* * To sync an external state with the Lexical editor state under certain conditions (i.e. composer mounted, but editor hidden)
|
|
486
|
+
*/
|
|
487
|
+
declare function ControlledValuePlugin({ enabled, value, extraDependencies, }: {
|
|
488
|
+
/** Whether to enable the controlled value plugin. Defaults to false. The value is only controlled when set to true. */
|
|
489
|
+
enabled: boolean;
|
|
490
|
+
value: string | undefined | SerializedEditorState<SerializedLexicalNode>;
|
|
491
|
+
extraDependencies?: unknown[];
|
|
492
|
+
}): JSX.Element | null;
|
|
493
|
+
|
|
494
|
+
type SerializedVariableNode = Spread<{
|
|
495
|
+
reference: string;
|
|
496
|
+
type: 'variable';
|
|
497
|
+
version: 1;
|
|
498
|
+
}, SerializedLexicalNode>;
|
|
499
|
+
type VariableNodeState = {
|
|
500
|
+
/** Display name to show on the variable */
|
|
501
|
+
displayName: string;
|
|
502
|
+
/**
|
|
503
|
+
* Whether the variable reference is currently pointing to a known variable in the variables context
|
|
504
|
+
* Note that this is ignored if `isFresh` is true, which is set for the result of edits or insertions
|
|
505
|
+
* made after the editor has mounted (which we know are good and don't validate to prevent flicker or false errors)
|
|
506
|
+
*/
|
|
507
|
+
referenceIsValid: boolean | 'info';
|
|
508
|
+
/**
|
|
509
|
+
* Whether the variable node has been inserted or edited during this editing session
|
|
510
|
+
* Fresh nodes are always considered "valid" because they are the result of a user action
|
|
511
|
+
*/
|
|
512
|
+
isFresh: boolean;
|
|
513
|
+
/** Whether clicking the node has an effect (dispatching an edit event) */
|
|
514
|
+
hasClickEvent: boolean | undefined;
|
|
515
|
+
/** Tooltip of the node on hover */
|
|
516
|
+
tooltip: string | undefined;
|
|
517
|
+
/**
|
|
518
|
+
* Disables showing text in the variables node and replaces it with a loading indicator
|
|
519
|
+
*/
|
|
520
|
+
isLoading: boolean;
|
|
521
|
+
};
|
|
522
|
+
/** Renders a variable reference node within a Lexical editor */
|
|
523
|
+
declare class VariableNode extends DecoratorNode<JSX.Element> {
|
|
524
|
+
reference: Readonly<string>;
|
|
525
|
+
private __state;
|
|
526
|
+
static getType(): string;
|
|
527
|
+
static clone(node: VariableNode): VariableNode;
|
|
528
|
+
/** Imports the node from serialized JSON (i.e. the data provided to the editor's initial state) */
|
|
529
|
+
static importJSON(serializedNode: SerializedVariableNode): VariableNode;
|
|
530
|
+
constructor(reference: Readonly<string>, state: VariableNodeState, key?: NodeKey);
|
|
531
|
+
/** Gets the node's current state */
|
|
532
|
+
getState(): VariableNodeState;
|
|
533
|
+
/**
|
|
534
|
+
* Updates the node's variables state so it knows its current validity, display name, etc
|
|
535
|
+
* The plugin updates this whenever the variables prop changes.
|
|
536
|
+
*/
|
|
537
|
+
setState(state: VariableNodeState): void;
|
|
538
|
+
/**
|
|
539
|
+
* Serializes the node to JSON for editor initial state
|
|
540
|
+
*/
|
|
541
|
+
exportJSON(): {
|
|
542
|
+
reference: string;
|
|
543
|
+
type: string;
|
|
544
|
+
version: number;
|
|
545
|
+
};
|
|
546
|
+
/**
|
|
547
|
+
* Copy variable to clipboard in a format we will read back if pasted
|
|
548
|
+
* (albeit it won't get the fancy chip-node)
|
|
549
|
+
*/
|
|
550
|
+
getTextContent(): string;
|
|
551
|
+
/** Creates the DOM wrapper that hosts the node */
|
|
552
|
+
createDOM(): HTMLSpanElement;
|
|
553
|
+
updateDOM(): boolean;
|
|
554
|
+
/**
|
|
555
|
+
* Render the variable node using React.
|
|
556
|
+
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
557
|
+
* rely on Context, etc in this renderer.
|
|
558
|
+
*/
|
|
559
|
+
decorate(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
560
|
+
}
|
|
561
|
+
declare function $createVariableNode(variableReference: string, state: VariableNodeState): VariableNode;
|
|
562
|
+
declare function $isVariableNode(node: LexicalNode | null | undefined): node is VariableNode;
|
|
563
|
+
|
|
564
|
+
type MeshDataVariableDefinition = Omit<DataVariableDefinition, 'default'> & {
|
|
565
|
+
/** When used in code, variables may have non-string defaults */
|
|
566
|
+
default: unknown;
|
|
567
|
+
/**
|
|
568
|
+
* If true the variable will not be shown in variables listings and menus, but can still be resolved
|
|
569
|
+
* Useful for variables that are defined by their presence in a value, and disappear when deleted from the value,
|
|
570
|
+
* like bindings.
|
|
571
|
+
*/
|
|
572
|
+
ephemeral?: boolean;
|
|
573
|
+
/**
|
|
574
|
+
* Prevents editing the variable if set to true. If the variable context is set to read only,
|
|
575
|
+
* this is ignored and is always effectively true.
|
|
576
|
+
*/
|
|
577
|
+
readOnly?: boolean;
|
|
578
|
+
/**
|
|
579
|
+
* Tooltip for the variable when rendered in content UI.
|
|
580
|
+
* If not passed, defaults to helpText.
|
|
581
|
+
*/
|
|
582
|
+
tooltip?: string;
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* Provides information for an undefined variable that might be referenced in data,
|
|
586
|
+
* but is undefined in the variables context due to some sort of error or informational message.
|
|
587
|
+
*
|
|
588
|
+
* If an undefined variable matches one of these, the error or info message will be shown instead of the generic "undefined variable" message.
|
|
589
|
+
*/
|
|
590
|
+
type KnownUndefinedVariableInfo = {
|
|
591
|
+
error?: string;
|
|
592
|
+
info?: string;
|
|
593
|
+
};
|
|
594
|
+
type DataVariableDefinitionWithName = {
|
|
595
|
+
name: string;
|
|
596
|
+
} & MeshDataVariableDefinition;
|
|
597
|
+
/**
|
|
598
|
+
* Converts variable definitions stored in a map into a flat list,
|
|
599
|
+
* respecting their `order` property if set, and sorting by display name otherwise.
|
|
600
|
+
*/
|
|
601
|
+
declare function variablesToList(variables: Record<string, MeshDataVariableDefinition> | undefined): Array<DataVariableDefinitionWithName>;
|
|
602
|
+
|
|
603
|
+
type SelectVariableMenuProps<TEditorContext = undefined> = {
|
|
604
|
+
/** sets the onClick menu item event. Also called if the menu adds a variable with the newly added variable. */
|
|
605
|
+
onSelectVariable: (selectedVariable: DataVariableDefinitionWithName) => void;
|
|
606
|
+
/** Controls whether one can add variables from the menu */
|
|
607
|
+
showAddVariableMenuOption?: boolean | string;
|
|
608
|
+
/** Emotion styles to apply to the menu trigger icon button */
|
|
609
|
+
buttonCss?: Interpolation<Theme>;
|
|
610
|
+
/** Control HTML attributes of the menu button */
|
|
611
|
+
buttonProps?: Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'ref' | 'type'>;
|
|
612
|
+
/** Sets a 'tip' value that shows at the bottom of the menu */
|
|
613
|
+
tip?: string;
|
|
614
|
+
/** Enables a menu option to reset the variables */
|
|
615
|
+
onResetVariables?: () => void;
|
|
616
|
+
/** Computes the editor context when a variable is added or edited from this menu, and when filtering variables */
|
|
617
|
+
getEditorContext?: () => TEditorContext;
|
|
618
|
+
/** Sets the tooltip shown on hover over the insert-variable menu */
|
|
619
|
+
menuTooltip?: string;
|
|
620
|
+
/** Filters available variables in menus and auto-completes */
|
|
621
|
+
filterVariable?: (variableName: string, variableDefinition: MeshDataVariableDefinition, context: TEditorContext | undefined) => boolean;
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
type VariableSourceGroup = {
|
|
625
|
+
name: string | undefined;
|
|
626
|
+
variables: Array<DataVariableDefinitionWithName>;
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* Groups variable definitions by their `source` property, and sorts the groups using `variablesToList`.
|
|
630
|
+
* Returns a flat list of groups and variables. Groups are sorted alphabetically.
|
|
631
|
+
*/
|
|
632
|
+
declare function variablesToGroupedList<TEditorContext = void>(variables: Record<string, MeshDataVariableDefinition> | undefined, filterFn?: (variableName: string, variableDefinition: MeshDataVariableDefinition, context: TEditorContext | undefined) => boolean, context?: TEditorContext): Array<VariableSourceGroup>;
|
|
633
|
+
|
|
634
|
+
type EditVariableCommandArguments = {
|
|
635
|
+
/** Lexical node key that is being edited */
|
|
636
|
+
sourceKey: string | undefined;
|
|
637
|
+
/** The variable reference to edit */
|
|
638
|
+
reference: string;
|
|
639
|
+
};
|
|
640
|
+
type InsertVariableCommandArguments = {
|
|
641
|
+
reference: string;
|
|
642
|
+
/**
|
|
643
|
+
* Optionally pass in display name if you have it
|
|
644
|
+
* avoids a flash of the reference name
|
|
645
|
+
*/
|
|
646
|
+
initialDisplayName?: string;
|
|
647
|
+
/**
|
|
648
|
+
* If specified, the lexical node with this key is overwritten by the insert.
|
|
649
|
+
* If unspecified, the current selection is overwritten, or inserted to if a single location.
|
|
650
|
+
*/
|
|
651
|
+
targetKey: string | undefined;
|
|
652
|
+
/**
|
|
653
|
+
* If true, the existing value of the editor should be replaced with this variable
|
|
654
|
+
* Used when inserting a variable during an input state transition.
|
|
655
|
+
*/
|
|
656
|
+
overwriteExistingValue?: boolean;
|
|
657
|
+
};
|
|
658
|
+
/**
|
|
659
|
+
* Opens the variable editor and when a result is selected, inserts it at the current cursor location
|
|
660
|
+
* NOTE: differs from INSERT_VARIABLE_COMMAND because this opens a variable picker, and that command inserts a known variable reference with no picker.
|
|
661
|
+
*/
|
|
662
|
+
declare const OPEN_INSERT_VARIABLE_COMMAND: lexical.LexicalCommand<unknown>;
|
|
663
|
+
/** Opens the variable editor for an existing variable node */
|
|
664
|
+
declare const EDIT_VARIABLE_COMMAND: lexical.LexicalCommand<EditVariableCommandArguments>;
|
|
665
|
+
/** Inserts a new variable node at the current selection, or replacing a specific node key */
|
|
666
|
+
declare const INSERT_VARIABLE_COMMAND: lexical.LexicalCommand<InsertVariableCommandArguments>;
|
|
667
|
+
type VariablesPluginProps<TEditorContext = unknown> = {
|
|
668
|
+
/** Disables adding variable references via autocomplete. Any existing variables will be rendered as variables. */
|
|
669
|
+
disableVariables?: boolean;
|
|
670
|
+
/** Enables 'add variable' option in autocomplete */
|
|
671
|
+
showAddVariableMenuOption?: boolean | string;
|
|
672
|
+
/** Enables clicking a variable reference to edit the variable */
|
|
673
|
+
enableEditingVariables?: boolean;
|
|
674
|
+
/** Computes the editor context when a variable is added or edited from this composer, or when filtering variables */
|
|
675
|
+
getEditorContext?: SelectVariableMenuProps<TEditorContext>['getEditorContext'];
|
|
676
|
+
/** Filters available variables in menus and auto-completes */
|
|
677
|
+
filterVariable?: SelectVariableMenuProps<TEditorContext>['filterVariable'];
|
|
678
|
+
/** If true, the whole value of the editor is replaced when a variable is inserted */
|
|
679
|
+
replaceValueOnVariableInsert: boolean;
|
|
680
|
+
};
|
|
681
|
+
type UseVariablesMenuInput<TEditorContext> = Pick<VariablesPluginProps<TEditorContext>, 'showAddVariableMenuOption' | 'enableEditingVariables' | 'filterVariable' | 'getEditorContext'>;
|
|
682
|
+
type OnVariableSelectInput = {
|
|
683
|
+
value: string;
|
|
684
|
+
queryString?: string;
|
|
685
|
+
nodeToReplace?: LexicalNode;
|
|
686
|
+
editor: LexicalEditor;
|
|
687
|
+
overwriteExistingValue: boolean;
|
|
688
|
+
};
|
|
689
|
+
type UseVariablesMenu = {
|
|
690
|
+
groupedVariables: VariableSourceGroup[];
|
|
691
|
+
menuOptions: MenuOption[];
|
|
692
|
+
onSelect: (input: OnVariableSelectInput) => void;
|
|
693
|
+
};
|
|
694
|
+
/** Hook to use the lexical variables typeahead/dropdown menu */
|
|
695
|
+
declare function useVariablesMenu<TEditorContext>({ showAddVariableMenuOption, enableEditingVariables, filterVariable, getEditorContext, }: UseVariablesMenuInput<TEditorContext>): UseVariablesMenu;
|
|
696
|
+
/**
|
|
697
|
+
* Enables variables auto-complete and reference management to a Lexical editor.
|
|
698
|
+
* Must also activate the VariableNode node to make this work.
|
|
699
|
+
*/
|
|
700
|
+
declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, replaceValueOnVariableInsert, filterVariable, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
|
|
701
|
+
|
|
444
702
|
type PasteTransformerPluginProps = {
|
|
445
703
|
/**
|
|
446
704
|
* Transforms pasted contents before inserting them.
|
|
@@ -449,23 +707,52 @@ type PasteTransformerPluginProps = {
|
|
|
449
707
|
transformPaste?: (pastedText: string) => string | undefined;
|
|
450
708
|
};
|
|
451
709
|
|
|
452
|
-
type
|
|
453
|
-
|
|
454
|
-
|
|
710
|
+
type UseInputVariablesStateProps<TEditorContext = unknown> = {
|
|
711
|
+
/** Unique ID for the value being edited. */
|
|
712
|
+
id?: string;
|
|
713
|
+
/**
|
|
714
|
+
* Sets the value of the input
|
|
715
|
+
* NOTE: this is NOT reactive after mount
|
|
716
|
+
*/
|
|
717
|
+
value: string | undefined;
|
|
718
|
+
/** Callback to receive changes to the value of the variables input */
|
|
719
|
+
onChange: (newValue: string | undefined) => void;
|
|
720
|
+
/**
|
|
721
|
+
* The value to set the field to when it's "reset" from a variables-input to a custom component.
|
|
722
|
+
* Defaults to undefined.
|
|
723
|
+
*/
|
|
724
|
+
valueToResetTo?: string | undefined;
|
|
725
|
+
/** Disables using variables in the input */
|
|
726
|
+
disableVariables?: boolean;
|
|
727
|
+
/**
|
|
728
|
+
* Enables adding variables from the menu. If a string is passed,
|
|
729
|
+
* the option is enabled and the string is used as the menu label.
|
|
730
|
+
*/
|
|
731
|
+
showAddVariableMenuOption?: boolean | string;
|
|
732
|
+
/**
|
|
733
|
+
* When no variables are referenced in the value, and this prop is provided,
|
|
734
|
+
* the variables-injection input will be replaced with this component.
|
|
735
|
+
*
|
|
736
|
+
* NOTE: When this prop is provided, the and a variable is inserted, any existing value
|
|
737
|
+
* in the input will be replaced with the variable reference. Once in variables-mode, additional
|
|
738
|
+
* insertions are inserted at the current selection (or end) of the variables value.
|
|
739
|
+
*/
|
|
740
|
+
inputWhenNoVariables?: JSX.Element;
|
|
741
|
+
/** Computes the editor context when a variable is added or edited from this composer */
|
|
742
|
+
getEditorContext?: () => TEditorContext;
|
|
743
|
+
/** Filters available variables in menus and auto-completes */
|
|
744
|
+
filterVariable?: SelectVariableMenuProps<TEditorContext>['filterVariable'];
|
|
745
|
+
/** Sets the tooltip shown on hover over the insert-variable menu */
|
|
746
|
+
menuTooltip?: string;
|
|
455
747
|
};
|
|
456
|
-
|
|
748
|
+
|
|
749
|
+
type InputVariablesProps<TEditorContext = unknown> = {
|
|
457
750
|
/** Sets a HTML ID for the variables input and label */
|
|
458
751
|
id?: string;
|
|
459
752
|
/** Enables a label for the input */
|
|
460
753
|
label?: string;
|
|
461
754
|
/** sets the input aria-label value. */
|
|
462
755
|
'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
756
|
/**
|
|
470
757
|
* Turns off the 'Reset' menu option that is added when:
|
|
471
758
|
* - inputWhenNoVariables is passed in
|
|
@@ -473,20 +760,22 @@ type InputVariablesProps = {
|
|
|
473
760
|
*
|
|
474
761
|
* The reset button returns the editor to the inputWithNoVariables state
|
|
475
762
|
*
|
|
476
|
-
* @deprecated
|
|
763
|
+
* @deprecated this is ignored if passed, computation is now automatic
|
|
477
764
|
*/
|
|
478
765
|
disableReset?: boolean;
|
|
479
|
-
/** Enables
|
|
480
|
-
|
|
766
|
+
/** Enables mutliple lines in the input (\n in the value) */
|
|
767
|
+
multiLine?: boolean;
|
|
481
768
|
/** Disables the inline variable selection menu when rendering a variables input */
|
|
482
769
|
disableInlineMenu?: boolean;
|
|
483
|
-
/**
|
|
770
|
+
/**
|
|
771
|
+
* Enables clicking a variable reference to edit the variable
|
|
772
|
+
* Note: automatically disabled if `disabled` or `disableVariables` is set
|
|
773
|
+
*/
|
|
484
774
|
enableEditingVariables?: boolean;
|
|
485
775
|
/**
|
|
486
|
-
*
|
|
487
|
-
* the variables-injection input will be replaced with this component.
|
|
776
|
+
* Adds an additional option to omit the variable if it's empty from requests
|
|
488
777
|
*/
|
|
489
|
-
|
|
778
|
+
addOmitIfEmpty?: boolean;
|
|
490
779
|
/** (optional) sets and shows the the error message value */
|
|
491
780
|
errorMessage?: string;
|
|
492
781
|
/** (optional) sets and shows the the warning message value */
|
|
@@ -495,37 +784,103 @@ type InputVariablesProps = {
|
|
|
495
784
|
infoMessage?: string;
|
|
496
785
|
/** (optional) sets caption text value */
|
|
497
786
|
caption?: string;
|
|
787
|
+
/** Disables editing the value of the input, editing variables, and adding variables */
|
|
788
|
+
disabled?: boolean;
|
|
498
789
|
/** Sets the test ID of the input */
|
|
499
790
|
'data-testid'?: string;
|
|
500
|
-
|
|
501
|
-
|
|
791
|
+
/** If set the editor will auto-focus on mount */
|
|
792
|
+
autoFocus?: boolean;
|
|
793
|
+
/**
|
|
794
|
+
* Optional ref to get a handle to the variables editor.
|
|
795
|
+
* This can be useful for situations such as:
|
|
796
|
+
* * 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.
|
|
797
|
+
* * Performing other custom mutations to the variables editor, such as inserting text from a button click.
|
|
798
|
+
*/
|
|
799
|
+
editorRef?: MutableRefObject<LexicalEditor | null>;
|
|
800
|
+
} & PasteTransformerPluginProps & UseInputVariablesStateProps<TEditorContext>;
|
|
801
|
+
/**
|
|
802
|
+
* An input box that enables insertion of 'variables', provided by VariablesProvider,
|
|
803
|
+
* into its value.
|
|
804
|
+
*/
|
|
805
|
+
declare function InputVariables<TEditorContext = unknown>(props: InputVariablesProps<TEditorContext>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
502
806
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
807
|
+
type ParameterConnectionIndicatorProps = {
|
|
808
|
+
/** Disables the menu, hiding it from view entirely */
|
|
809
|
+
disabled?: boolean;
|
|
810
|
+
/** The value to check for variables */
|
|
811
|
+
value: unknown;
|
|
812
|
+
/** The React component to render next to the parameter connection indicator (the parameter's view) */
|
|
813
|
+
children: ReactNode;
|
|
814
|
+
/** Custom menu options for the connection indicator menu */
|
|
815
|
+
menuOptions: ReactNode;
|
|
816
|
+
/** Sets the tooltip shown on hover over the insert-variable menu */
|
|
817
|
+
menuTooltip?: string;
|
|
818
|
+
};
|
|
819
|
+
/**
|
|
820
|
+
* An input box that enables insertion of 'variables', provided by VariablesProvider,
|
|
821
|
+
* into its value. Designed specifically for use in the Canvas Parameter Editor.
|
|
822
|
+
*/
|
|
823
|
+
declare function ParameterConnectionIndicator({ children, value, menuOptions, disabled, menuTooltip, }: ParameterConnectionIndicatorProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
507
824
|
|
|
508
|
-
type
|
|
509
|
-
|
|
510
|
-
|
|
825
|
+
type ParameterOrSingleVariableProps<TEditorContext = unknown> = {
|
|
826
|
+
disabled?: boolean;
|
|
827
|
+
inputWhenNoVariables: JSX.Element;
|
|
828
|
+
enableEditingVariables?: boolean;
|
|
829
|
+
/**
|
|
830
|
+
* Optional ref to get a handle to the variables editor.
|
|
831
|
+
* This can be useful for situations such as performing custom mutations to the variables editor,
|
|
832
|
+
* such as imperatively inserting a new variable using OPEN_INSERT_VARIABLE_COMMAND.
|
|
833
|
+
*/
|
|
834
|
+
editorRef?: MutableRefObject<LexicalEditor | null>;
|
|
835
|
+
} & Omit<UseInputVariablesStateProps<TEditorContext>, 'inputWhenNoVariables'>;
|
|
511
836
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
837
|
+
* A parameter which can be one of a custom parameter editor (`inputWhenNoVariables`),
|
|
838
|
+
* or one single variable value (not multiple). Use for parameters which can only have one variable value,
|
|
839
|
+
* possibly because they bind to objects or arrays.
|
|
840
|
+
* Designed visually for use in the Canvas Parameter Editor.
|
|
841
|
+
*/
|
|
842
|
+
declare function ParameterOrSingleVariable<TEditorContext = unknown>(props: ParameterOrSingleVariableProps<TEditorContext>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
843
|
+
|
|
844
|
+
type ParameterVariablesProps<TEditorContext = unknown> = {
|
|
845
|
+
/** sets the input aria-label value. */
|
|
846
|
+
'aria-label'?: string;
|
|
847
|
+
/** Sets the test ID of the input */
|
|
848
|
+
'data-testid'?: string;
|
|
849
|
+
/**
|
|
850
|
+
* Enables mutliple lines in the input (\n in the value).
|
|
851
|
+
* If a number is passed, the height of the editor is set to that number of lines and overflow scrolls.
|
|
852
|
+
* If a boolean true is passed, the editor auto-sizes to the content.
|
|
853
|
+
*/
|
|
854
|
+
multiLine?: boolean | number;
|
|
855
|
+
/** Disables editing the value of the input, editing variables, and adding variables */
|
|
856
|
+
disabled?: boolean;
|
|
857
|
+
/**
|
|
858
|
+
* Optional ref to get a handle to the variables editor.
|
|
859
|
+
* This can be useful for situations such as:
|
|
860
|
+
* * 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.
|
|
861
|
+
* * Performing other custom mutations to the variables editor, such as inserting text from a button click.
|
|
862
|
+
*/
|
|
863
|
+
editorRef?: MutableRefObject<LexicalEditor | null>;
|
|
864
|
+
/** If set the editor will auto-focus on mount */
|
|
865
|
+
autoFocus?: boolean;
|
|
866
|
+
} & UseInputVariablesStateProps<TEditorContext>;
|
|
867
|
+
/**
|
|
868
|
+
* An input box that enables insertion of 'variables', provided by VariablesProvider,
|
|
869
|
+
* into its value. Designed visually for use in the Canvas Parameter Editor.
|
|
514
870
|
*/
|
|
515
|
-
declare function
|
|
871
|
+
declare function ParameterVariables<TEditorContext = unknown>(props: ParameterVariablesProps<TEditorContext>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
516
872
|
|
|
517
|
-
type VariableEditorProps = {
|
|
873
|
+
type VariableEditorProps<TEditorContext = unknown> = {
|
|
518
874
|
variable: string;
|
|
519
875
|
onSubmit: (values: DataVariableDefinitionWithName) => void | Promise<void>;
|
|
520
876
|
/** Disables the tip about Mesh integrations. Intended for use when this is placed on a custom Mesh integration to edit variables. */
|
|
521
877
|
disableMeshTip?: boolean;
|
|
522
878
|
onCancel: () => void;
|
|
879
|
+
context: TEditorContext | undefined;
|
|
523
880
|
};
|
|
524
|
-
declare function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }: VariableEditorProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
881
|
+
declare function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }: VariableEditorProps<any>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
525
882
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
type VariablesProviderProps = React$1.PropsWithChildren<{
|
|
883
|
+
type VariablesProviderProps<TEditVariableContext = unknown> = React.PropsWithChildren<{
|
|
529
884
|
/**
|
|
530
885
|
* Signals that components in this variables context are not intended to allow mutation
|
|
531
886
|
* of the variable values (i.e. editing, adding, or deleting variable definitions).
|
|
@@ -534,18 +889,33 @@ type VariablesProviderProps = React$1.PropsWithChildren<{
|
|
|
534
889
|
*/
|
|
535
890
|
readOnly?: boolean;
|
|
536
891
|
/** Variable values to load into the context */
|
|
537
|
-
value: Record<string,
|
|
892
|
+
value: Record<string, MeshDataVariableDefinition>;
|
|
893
|
+
/**
|
|
894
|
+
* Provides information for undefined variables that might be referenced in data,
|
|
895
|
+
* but is undefined in the variables context due to some sort of error or informational message.
|
|
896
|
+
*
|
|
897
|
+
* If an undefined variable matches one of these, the error or info message can be shown instead of the generic "undefined variable" message.
|
|
898
|
+
*/
|
|
899
|
+
knownUndefinedValues?: Record<string, KnownUndefinedVariableInfo>;
|
|
538
900
|
/** Function to handle mutations to the variable values (optional when readOnly is true) */
|
|
539
|
-
onChange?: (newValue: Record<string,
|
|
901
|
+
onChange?: (newValue: Record<string, MeshDataVariableDefinition>) => void;
|
|
540
902
|
/**
|
|
541
903
|
* Provide a component to handle editing a variable definition (e.g. a modal wrapper)
|
|
542
904
|
* If not passed, the editor will be rendered inline, with potentially strange results.
|
|
543
905
|
*/
|
|
544
|
-
editVariableComponent?: React
|
|
906
|
+
editVariableComponent?: React.ComponentType<VariableEditorProps<TEditVariableContext>>;
|
|
907
|
+
/**
|
|
908
|
+
* Signals to the provider that the variables value is in the process of being loaded.
|
|
909
|
+
* Variables editors may use this to avoid showing invalid variable states while loading,
|
|
910
|
+
* or to show a loading indicator.
|
|
911
|
+
*/
|
|
912
|
+
isLoading?: boolean;
|
|
545
913
|
}>;
|
|
546
|
-
type VariablesAction = {
|
|
914
|
+
type VariablesAction<TEditVariableContext> = {
|
|
547
915
|
type: 'edit';
|
|
548
916
|
variable: string;
|
|
917
|
+
/** Context that will be passed in a prop to the variables context editing component */
|
|
918
|
+
context?: TEditVariableContext;
|
|
549
919
|
} | {
|
|
550
920
|
type: 'remove';
|
|
551
921
|
variable: string;
|
|
@@ -553,14 +923,22 @@ type VariablesAction = {
|
|
|
553
923
|
type: 'set';
|
|
554
924
|
variable: DataVariableDefinitionWithName;
|
|
555
925
|
openEditor?: boolean;
|
|
926
|
+
/** Context that will be passed in a prop to the variables context editing component. Only has an effect when openEditor = true */
|
|
927
|
+
context?: TEditVariableContext;
|
|
556
928
|
} | {
|
|
557
929
|
type: 'reorder';
|
|
558
930
|
result: Record<string, DataVariableDefinitionWithName>;
|
|
931
|
+
} | {
|
|
932
|
+
type: 'cancelEdit';
|
|
933
|
+
};
|
|
934
|
+
type VariablesUpdateEvent = {
|
|
935
|
+
name: string;
|
|
936
|
+
latestValue: Record<string, MeshDataVariableDefinition>;
|
|
559
937
|
};
|
|
560
938
|
type VariablesEvents = {
|
|
561
|
-
update:
|
|
939
|
+
update: VariablesUpdateEvent;
|
|
562
940
|
};
|
|
563
|
-
type VariablesContext = {
|
|
941
|
+
type VariablesContext<TEditVariableContext> = {
|
|
564
942
|
/**
|
|
565
943
|
* Signals that components in this variables context are not intended to allow mutation
|
|
566
944
|
* of the variable values (i.e. editing, adding, or deleting variable definitions).
|
|
@@ -569,9 +947,14 @@ type VariablesContext = {
|
|
|
569
947
|
*/
|
|
570
948
|
readOnly?: boolean;
|
|
571
949
|
/** Dispatch update events to the variables */
|
|
572
|
-
dispatch: (event: VariablesAction) => void;
|
|
950
|
+
dispatch: (event: VariablesAction<TEditVariableContext>) => void;
|
|
573
951
|
/** The current variables value */
|
|
574
|
-
variables: Readonly<Record<string,
|
|
952
|
+
variables: Readonly<Record<string, MeshDataVariableDefinition>>;
|
|
953
|
+
/**
|
|
954
|
+
* Provides information for undefined variables that might be referenced in data,
|
|
955
|
+
* but is undefined in the variables context due to some sort of error or informational message.
|
|
956
|
+
*/
|
|
957
|
+
knownUndefinedValues: Readonly<Record<string, KnownUndefinedVariableInfo>>;
|
|
575
958
|
/** Whether the context is editing a variable value currently */
|
|
576
959
|
isEditing: boolean;
|
|
577
960
|
/** Add event handles (don't forget to unhook) */
|
|
@@ -582,10 +965,60 @@ type VariablesContext = {
|
|
|
582
965
|
* A flattened version of `variables` that is a plain key-value object.
|
|
583
966
|
* Used when binding the variables to a value.
|
|
584
967
|
*/
|
|
585
|
-
flatVariables: Readonly<Record<string,
|
|
968
|
+
flatVariables: Readonly<Record<string, unknown>>;
|
|
969
|
+
/**
|
|
970
|
+
* The variables context value is in the process of being loaded.
|
|
971
|
+
* Variables editors may use this to avoid showing invalid variable states while loading,
|
|
972
|
+
* or to show a loading indicator.
|
|
973
|
+
*/
|
|
974
|
+
isLoading: boolean;
|
|
586
975
|
};
|
|
587
|
-
declare function VariablesProvider({ value, onChange, editVariableComponent, readOnly, children, }: VariablesProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
588
|
-
declare function useVariables(returnEmptyWithoutProvider?: boolean): VariablesContext
|
|
976
|
+
declare function VariablesProvider<TEditComponentContext = never>({ value, onChange, editVariableComponent, readOnly, isLoading, children, knownUndefinedValues, }: VariablesProviderProps<TEditComponentContext>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
977
|
+
declare function useVariables<TEditComponentContext = unknown>(returnEmptyWithoutProvider?: boolean): VariablesContext<TEditComponentContext>;
|
|
978
|
+
|
|
979
|
+
declare function useOnVariableUpdated(fn: (event: VariablesUpdateEvent) => void, disabled?: boolean): void;
|
|
980
|
+
|
|
981
|
+
/** Converts a connected data map entry to a VariablesProvider-format variable */
|
|
982
|
+
declare function convertConnectedDataToVariable(bindExpression: string, value: unknown): MeshDataVariableDefinition;
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Returns true if the string expression has variable references in it
|
|
986
|
+
*/
|
|
987
|
+
declare function hasReferencedVariables(value: string): boolean;
|
|
988
|
+
|
|
989
|
+
declare function prettifyBindExpression(bindExpression: string): string;
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Serializes a Lexical variables-editor state (as a Lexical AST) to a Uniform-variable-reference formatted string
|
|
993
|
+
* Note: if no content is in the editor state, undefined will be returned.
|
|
994
|
+
*/
|
|
995
|
+
declare function serializeVariablesEditorState(editorState: EditorState): string | undefined;
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Programmatically sets the current value of a variables editor after it has already initialized
|
|
999
|
+
* and become an uncontrolled component. Passing the `editorRef` prop to the component will give
|
|
1000
|
+
* a reference to `editor`, or use `ControlledValuePlugin` to manage this automatically.
|
|
1001
|
+
*
|
|
1002
|
+
* If newValue is undefined, the editor will be set to an empty state.
|
|
1003
|
+
* If newValue is a string, it will be treated as a variable-reference-containing string, and parsed to a Lexical AST
|
|
1004
|
+
* If newValue is a serialized Lexical AST, it will be used as-is. If the AST is invalid, the editor will be set to an empty state.
|
|
1005
|
+
*/
|
|
1006
|
+
declare function setVariablesEditorValue(editor: LexicalEditor, newValue: string | undefined | SerializedEditorState<SerializedLexicalNode>): void;
|
|
1007
|
+
|
|
1008
|
+
declare function variableDefaultTextValue(defaultValue: unknown): string;
|
|
1009
|
+
|
|
1010
|
+
/**
|
|
1011
|
+
* Expected prefix for variable expressions
|
|
1012
|
+
* @deprecated
|
|
1013
|
+
*/
|
|
1014
|
+
declare const variablePrefix = "${";
|
|
1015
|
+
/**
|
|
1016
|
+
* Expected suffix for variable expressions
|
|
1017
|
+
* @deprecated
|
|
1018
|
+
*/
|
|
1019
|
+
declare const variableSuffix = "}";
|
|
1020
|
+
|
|
1021
|
+
declare function VariablesList(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
589
1022
|
|
|
590
1023
|
type DataResourceVariablesListProps = {
|
|
591
1024
|
/**
|
|
@@ -1025,22 +1458,42 @@ type QueryFilterProps<TSelectOptions extends QuertFilterSelectionOptionProps = Q
|
|
|
1025
1458
|
*/
|
|
1026
1459
|
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
1460
|
|
|
1461
|
+
type ParamTypeDynamicDataProviderProps = {
|
|
1462
|
+
/** Child components of the provider. Variables-using components, such as ParameterVariables, can be used here. */
|
|
1463
|
+
children: ReactNode;
|
|
1464
|
+
};
|
|
1465
|
+
/** Context to tell the binding UI what types are allowed for the current binding expression */
|
|
1466
|
+
type ParameterConnectOptions = {
|
|
1467
|
+
/**
|
|
1468
|
+
* Which JSON primitive types can be connected to this parameter.
|
|
1469
|
+
* Note that if the only value of the parameter is a complex dynamic token connection (object or array), then the connected data will be the literal value, not a string.
|
|
1470
|
+
*/
|
|
1471
|
+
connectsTo: BindableTypes[];
|
|
1472
|
+
};
|
|
1473
|
+
/**
|
|
1474
|
+
* Wrapper for data resource locations. Provides read-only access to dynamic inputs as if they were variables,
|
|
1475
|
+
* using variables-aware components (i.e. InputVariables). This simplifies building dynamic-input-aware editors,
|
|
1476
|
+
* where a data resource variable could be a static value or bound to a dynamic input from the route (project map).
|
|
1477
|
+
*/
|
|
1478
|
+
declare function ParamTypeDynamicDataProvider(props: ParamTypeDynamicDataProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1479
|
+
|
|
1028
1480
|
/** Editor component to let you write a request body for POST requests */
|
|
1029
1481
|
declare function RequestBody(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1030
1482
|
|
|
1031
1483
|
/** Editor component to manage HTTP headers on a request */
|
|
1032
|
-
declare function RequestHeaders({ disableVariables }: Pick<InputVariablesProps, 'disableVariables'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1484
|
+
declare function RequestHeaders({ disableVariables, addOmitIfEmpty, }: Pick<InputVariablesProps, 'disableVariables' | 'addOmitIfEmpty'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1033
1485
|
|
|
1034
1486
|
/** Dropdown to pick a HTTP method for a request */
|
|
1035
1487
|
declare function RequestMethodSelect(props: Omit<InputSelectProps, 'value' | 'onChange' | 'options'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1036
1488
|
|
|
1037
1489
|
type RequestParametersProps = Pick<InputVariablesProps, 'disableVariables'>;
|
|
1038
1490
|
/** Component to manage query parameters on a request */
|
|
1039
|
-
declare function RequestParameters({ disableVariables }: Pick<InputVariablesProps, 'disableVariables'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1491
|
+
declare function RequestParameters({ disableVariables, addOmitIfEmpty, }: Pick<InputVariablesProps, 'disableVariables' | 'addOmitIfEmpty'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1040
1492
|
|
|
1041
1493
|
type RequestParameter = {
|
|
1042
1494
|
key: string;
|
|
1043
1495
|
value: string;
|
|
1496
|
+
omitIfEmpty?: boolean;
|
|
1044
1497
|
};
|
|
1045
1498
|
type BaseRequestData = {
|
|
1046
1499
|
baseUrl: string;
|
|
@@ -1116,10 +1569,10 @@ declare function RequestUrl(): _emotion_react_types_jsx_namespace.EmotionJSX.Ele
|
|
|
1116
1569
|
* Editor to modify the current URL of the request
|
|
1117
1570
|
* Note: entering query string parameters automatically converts them and syncs the request state with them
|
|
1118
1571
|
*/
|
|
1119
|
-
declare function RequestUrlInput(props: Omit<InputVariablesProps, 'value' | 'onChange'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1572
|
+
declare function RequestUrlInput(props: Omit<InputVariablesProps, 'value' | 'onChange'> & Pick<InputVariablesProps, 'showAddVariableMenuOption' | 'enableEditingVariables'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
1120
1573
|
|
|
1121
|
-
declare function urlEncodeRequestUrl(url: string, varValues?: Record<string,
|
|
1122
|
-
declare function urlEncodeRequestParameter(parameter: RequestParameter, varValues?: Record<string,
|
|
1574
|
+
declare function urlEncodeRequestUrl(url: string, varValues?: Record<string, MeshDataVariableDefinition>): string;
|
|
1575
|
+
declare function urlEncodeRequestParameter(parameter: RequestParameter, varValues?: Record<string, MeshDataVariableDefinition>): RequestParameter;
|
|
1123
1576
|
|
|
1124
1577
|
/**
|
|
1125
1578
|
* Hook to make it simple to read and write a specific request header by name,
|
|
@@ -1145,6 +1598,12 @@ declare function useRequestParameter(paramName: string): {
|
|
|
1145
1598
|
update: (value: string) => void;
|
|
1146
1599
|
};
|
|
1147
1600
|
|
|
1601
|
+
/** Converts connected data map into VariablesProvider-format variables */
|
|
1602
|
+
declare function useConnectedDataAsVariables(connectedData: Record<string, unknown> | undefined): Record<string, MeshDataVariableDefinition>;
|
|
1603
|
+
|
|
1604
|
+
/** Converts dynamic inputs into VariablesProvider-format variables */
|
|
1605
|
+
declare function useDynamicInputsAsVariables(dynamicInputs: MinimalDynamicInputs): Record<string, MeshDataVariableDefinition>;
|
|
1606
|
+
|
|
1148
1607
|
/**
|
|
1149
1608
|
* Provides convenient access to the current Uniform Mesh SDK instance via React hook.
|
|
1150
1609
|
* Intended to be used within <MeshApp />.
|
|
@@ -1160,4 +1619,4 @@ declare function useUniformMeshSdk(): _uniformdev_mesh_sdk.UniformMeshSDK;
|
|
|
1160
1619
|
*/
|
|
1161
1620
|
declare function createLocationValidator<TSetValue>(setValue: SetLocationValueDispatch<TSetValue>, validate: (newValue: TSetValue, currentResult: SetValueOptions | undefined) => SetValueOptions): SetLocationValueDispatch<TSetValue>;
|
|
1162
1621
|
|
|
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,
|
|
1622
|
+
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, KnownUndefinedVariableInfo, LinkButton, MeshApp, MeshAppProps, MeshDataVariableDefinition, MinimalDynamicInput, MinimalDynamicInputs, NoResultsProps, OPEN_INSERT_VARIABLE_COMMAND, 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, draggableContainer, draggableIcon, draggableIconOffset, draggableIconWrapper, entrySearchBtn, entrySearchConfig, entrySearchConfigHidden, entrySearchLoadMoreBtn, entrySearchResultList, entrySearchSelectIcon, entrySearchSelectImg, entrySearchSelectInput, entrySearchSelectOption, entrySearchWrapper, hasReferencedVariables, 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, setVariablesEditorValue, urlEncodeRequestParameter, urlEncodeRequestUrl, useConnectedDataAsVariables, useDynamicInputsAsVariables, useMeshLocation, useObjectSearchContext, useOnVariableUpdated, useProductQueryContext, useProductSearchContext, useRequest, useRequestHeader, useRequestParameter, useUniformMeshSdk, useVariables, useVariablesMenu, variableDefaultTextValue, variablePrefix, variableSuffix, variablesToGroupedList, variablesToList };
|