@plasmicapp/react-web 0.2.116 → 0.2.118
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/all.d.ts +192 -45
- package/dist/index-common.d.ts +2 -1
- package/dist/index.d.ts +0 -2
- package/dist/react-web.cjs.development.js +59 -15
- package/dist/react-web.cjs.development.js.map +1 -1
- package/dist/react-web.cjs.production.min.js +1 -1
- package/dist/react-web.cjs.production.min.js.map +1 -1
- package/dist/react-web.esm.js +29 -15
- package/dist/react-web.esm.js.map +1 -1
- package/dist/states/valtio.d.ts +1 -0
- package/dist/stories/UseDollarState.stories.d.ts +3 -0
- package/package.json +3 -2
- package/skinny/dist/index-common.d.ts +2 -1
- package/skinny/dist/index.d.ts +0 -2
- package/skinny/dist/index.js +25 -8
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/plume/checkbox/index.js +2 -2
- package/skinny/dist/plume/checkbox/index.js.map +1 -1
- package/skinny/dist/plume/switch/index.js +2 -2
- package/skinny/dist/plume/switch/index.js.map +1 -1
- package/skinny/dist/states/valtio.d.ts +1 -0
- package/skinny/dist/stories/UseDollarState.stories.d.ts +3 -0
package/dist/all.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties, Key, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent } from 'react';
|
|
2
|
+
import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties, Key as Key$1, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent } from 'react';
|
|
3
3
|
|
|
4
4
|
// LICENSE is MIT
|
|
5
5
|
//
|
|
@@ -17,6 +17,152 @@ type Argument = Value | Mapping | Argument[];
|
|
|
17
17
|
|
|
18
18
|
declare function classNames$1(...args: Argument[]): string;
|
|
19
19
|
|
|
20
|
+
declare type FetcherResponse<Data = unknown> = Data | Promise<Data>;
|
|
21
|
+
declare type BareFetcher<Data = unknown> = (...args: any[]) => FetcherResponse<Data>;
|
|
22
|
+
declare type Fetcher$1<Data = unknown, SWRKey extends Key = Key> = SWRKey extends () => readonly [...infer Args] | null | undefined | false ? (...args: [...Args]) => FetcherResponse<Data> : SWRKey extends readonly [...infer Args] ? (...args: [...Args]) => FetcherResponse<Data> : SWRKey extends () => infer Arg | null | undefined | false ? (...args: [Arg]) => FetcherResponse<Data> : SWRKey extends null | undefined | false ? never : SWRKey extends infer Arg ? (...args: [Arg]) => FetcherResponse<Data> : never;
|
|
23
|
+
interface InternalConfiguration {
|
|
24
|
+
cache: Cache;
|
|
25
|
+
mutate: ScopedMutator;
|
|
26
|
+
}
|
|
27
|
+
interface PublicConfiguration<Data = any, Error = any, Fn extends Fetcher$1 = BareFetcher> {
|
|
28
|
+
errorRetryInterval: number;
|
|
29
|
+
errorRetryCount?: number;
|
|
30
|
+
loadingTimeout: number;
|
|
31
|
+
focusThrottleInterval: number;
|
|
32
|
+
dedupingInterval: number;
|
|
33
|
+
refreshInterval?: number | ((latestData: Data | undefined) => number);
|
|
34
|
+
refreshWhenHidden?: boolean;
|
|
35
|
+
refreshWhenOffline?: boolean;
|
|
36
|
+
revalidateOnFocus: boolean;
|
|
37
|
+
revalidateOnReconnect: boolean;
|
|
38
|
+
revalidateOnMount?: boolean;
|
|
39
|
+
revalidateIfStale: boolean;
|
|
40
|
+
shouldRetryOnError: boolean | ((err: Error) => boolean);
|
|
41
|
+
suspense?: boolean;
|
|
42
|
+
fallbackData?: Data;
|
|
43
|
+
fetcher?: Fn;
|
|
44
|
+
use?: Middleware[];
|
|
45
|
+
fallback: {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
};
|
|
48
|
+
isPaused: () => boolean;
|
|
49
|
+
onLoadingSlow: (key: string, config: Readonly<PublicConfiguration<Data, Error, Fn>>) => void;
|
|
50
|
+
onSuccess: (data: Data, key: string, config: Readonly<PublicConfiguration<Data, Error, Fn>>) => void;
|
|
51
|
+
onError: (err: Error, key: string, config: Readonly<PublicConfiguration<Data, Error, Fn>>) => void;
|
|
52
|
+
onErrorRetry: (err: Error, key: string, config: Readonly<PublicConfiguration<Data, Error, Fn>>, revalidate: Revalidator, revalidateOpts: Required<RevalidatorOptions>) => void;
|
|
53
|
+
onDiscarded: (key: string) => void;
|
|
54
|
+
compare: (a: Data | undefined, b: Data | undefined) => boolean;
|
|
55
|
+
isOnline: () => boolean;
|
|
56
|
+
isVisible: () => boolean;
|
|
57
|
+
}
|
|
58
|
+
declare type FullConfiguration = InternalConfiguration & PublicConfiguration;
|
|
59
|
+
interface SWRHook {
|
|
60
|
+
<Data = any, Error = any, SWRKey extends Key = null>(key: SWRKey): SWRResponse<Data, Error>;
|
|
61
|
+
<Data = any, Error = any, SWRKey extends Key = null>(key: SWRKey, fetcher: Fetcher$1<Data, SWRKey> | null): SWRResponse<Data, Error>;
|
|
62
|
+
<Data = any, Error = any, SWRKey extends Key = null>(key: SWRKey, config: SWRConfiguration<Data, Error, Fetcher$1<Data, SWRKey>> | undefined): SWRResponse<Data, Error>;
|
|
63
|
+
<Data = any, Error = any, SWRKey extends Key = null>(key: SWRKey, fetcher: Fetcher$1<Data, SWRKey> | null, config: SWRConfiguration<Data, Error, Fetcher$1<Data, SWRKey>> | undefined): SWRResponse<Data, Error>;
|
|
64
|
+
<Data = any, Error = any>(key: Key): SWRResponse<Data, Error>;
|
|
65
|
+
<Data = any, Error = any>(key: Key, fetcher: BareFetcher<Data> | null): SWRResponse<Data, Error>;
|
|
66
|
+
<Data = any, Error = any>(key: Key, config: SWRConfiguration<Data, Error, BareFetcher<Data>> | undefined): SWRResponse<Data, Error>;
|
|
67
|
+
<Data = any, Error = any>(key: Key, fetcher: BareFetcher<Data> | null, config: SWRConfiguration<Data, Error, BareFetcher<Data>> | undefined): SWRResponse<Data, Error>;
|
|
68
|
+
}
|
|
69
|
+
declare type Middleware = (useSWRNext: SWRHook) => <Data = any, Error = any>(key: Key, fetcher: BareFetcher<Data> | null, config: SWRConfiguration<Data, Error, BareFetcher<Data>>) => SWRResponse<Data, Error>;
|
|
70
|
+
declare type ArgumentsTuple = [any, ...unknown[]] | readonly [any, ...unknown[]];
|
|
71
|
+
declare type Arguments = string | ArgumentsTuple | Record<any, any> | null | undefined | false;
|
|
72
|
+
declare type Key = Arguments | (() => Arguments);
|
|
73
|
+
declare type MutatorCallback<Data = any> = (currentData?: Data) => Promise<undefined | Data> | undefined | Data;
|
|
74
|
+
declare type MutatorOptions<Data = any> = {
|
|
75
|
+
revalidate?: boolean;
|
|
76
|
+
populateCache?: boolean | ((result: any, currentData: Data) => Data);
|
|
77
|
+
optimisticData?: Data | ((currentData?: Data) => Data);
|
|
78
|
+
rollbackOnError?: boolean;
|
|
79
|
+
};
|
|
80
|
+
interface ScopedMutator<Data = any> {
|
|
81
|
+
/** This is used for bound mutator */
|
|
82
|
+
(key: Key, data?: Data | Promise<Data> | MutatorCallback<Data>, opts?: boolean | MutatorOptions<Data>): Promise<Data | undefined>;
|
|
83
|
+
/** This is used for global mutator */
|
|
84
|
+
<T = any>(key: Key, data?: T | Promise<T> | MutatorCallback<T>, opts?: boolean | MutatorOptions<Data>): Promise<T | undefined>;
|
|
85
|
+
}
|
|
86
|
+
declare type KeyedMutator<Data> = (data?: Data | Promise<Data> | MutatorCallback<Data>, opts?: boolean | MutatorOptions<Data>) => Promise<Data | undefined>;
|
|
87
|
+
declare type SWRConfiguration<Data = any, Error = any, Fn extends BareFetcher<any> = BareFetcher<any>> = Partial<PublicConfiguration<Data, Error, Fn>>;
|
|
88
|
+
interface SWRResponse<Data = any, Error = any> {
|
|
89
|
+
data?: Data;
|
|
90
|
+
error?: Error;
|
|
91
|
+
mutate: KeyedMutator<Data>;
|
|
92
|
+
isValidating: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface RevalidatorOptions {
|
|
95
|
+
retryCount?: number;
|
|
96
|
+
dedupe?: boolean;
|
|
97
|
+
}
|
|
98
|
+
declare type Revalidator = (revalidateOpts?: RevalidatorOptions) => Promise<boolean> | void;
|
|
99
|
+
interface Cache<Data = any> {
|
|
100
|
+
get(key: Key): Data | null | undefined;
|
|
101
|
+
set(key: Key, value: Data): void;
|
|
102
|
+
delete(key: Key): void;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare function usePlasmicDataConfig(): FullConfiguration;
|
|
106
|
+
|
|
107
|
+
interface Pagination {
|
|
108
|
+
pageSize: number;
|
|
109
|
+
pageIndex: number;
|
|
110
|
+
}
|
|
111
|
+
interface DataSourceSchema {
|
|
112
|
+
tables: TableSchema[];
|
|
113
|
+
}
|
|
114
|
+
interface TableSchema {
|
|
115
|
+
id: string;
|
|
116
|
+
label?: string;
|
|
117
|
+
fields: TableFieldSchema[];
|
|
118
|
+
}
|
|
119
|
+
interface TableFieldSchema {
|
|
120
|
+
id: string;
|
|
121
|
+
label?: string;
|
|
122
|
+
type: TableFieldType;
|
|
123
|
+
}
|
|
124
|
+
declare type TableFieldType = 'text' | 'boolean' | 'number' | 'datetime' | 'unknown';
|
|
125
|
+
interface SingleRowResult<T = any> {
|
|
126
|
+
data: T;
|
|
127
|
+
schema?: TableSchema;
|
|
128
|
+
}
|
|
129
|
+
interface ManyRowsResult<T = any> {
|
|
130
|
+
data: T[];
|
|
131
|
+
total?: number;
|
|
132
|
+
schema?: TableSchema;
|
|
133
|
+
paginate?: Pagination;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface DataOp {
|
|
137
|
+
sourceId: string;
|
|
138
|
+
opId: string;
|
|
139
|
+
userArgs?: Record<string, any>;
|
|
140
|
+
cacheKey?: string;
|
|
141
|
+
invalidatedKeys?: string[];
|
|
142
|
+
}
|
|
143
|
+
declare function executePlasmicDataOp<T = any>(op: DataOp, opts?: {
|
|
144
|
+
userAuthToken?: string;
|
|
145
|
+
includeSchema?: boolean;
|
|
146
|
+
paginate?: Pagination;
|
|
147
|
+
}): Promise<T>;
|
|
148
|
+
|
|
149
|
+
declare function Fetcher(props: {
|
|
150
|
+
dataOp?: DataOp;
|
|
151
|
+
name?: string;
|
|
152
|
+
children?: React__default.ReactNode;
|
|
153
|
+
includeSchema?: boolean;
|
|
154
|
+
pageIndex?: number;
|
|
155
|
+
pageSize?: number;
|
|
156
|
+
}): JSX.Element;
|
|
157
|
+
|
|
158
|
+
declare function usePlasmicDataOp<T = any, E = any>(dataOp: DataOp | undefined, opts?: {
|
|
159
|
+
includeSchema?: boolean;
|
|
160
|
+
paginate?: Pagination;
|
|
161
|
+
}): SWRResponse<T, E>;
|
|
162
|
+
declare function usePlasmicDataMutationOp<T = any>(dataOp: DataOp | undefined, opts?: {
|
|
163
|
+
includeSchema?: boolean;
|
|
164
|
+
}): () => Promise<T | undefined>;
|
|
165
|
+
|
|
20
166
|
declare function pick<T extends {}>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
|
|
21
167
|
declare function omit<T extends {}>(obj: T, ...keys: (keyof T)[]): Partial<T>;
|
|
22
168
|
|
|
@@ -35,6 +181,7 @@ interface $StateSpec<T> {
|
|
|
35
181
|
type: "private" | "readonly" | "writable";
|
|
36
182
|
valueProp?: string;
|
|
37
183
|
onChangeProp?: string;
|
|
184
|
+
isArray?: boolean;
|
|
38
185
|
}
|
|
39
186
|
declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>): any;
|
|
40
187
|
|
|
@@ -465,7 +612,7 @@ interface InputBase {
|
|
|
465
612
|
|
|
466
613
|
type SelectionMode = 'none' | 'single' | 'multiple';
|
|
467
614
|
type SelectionBehavior = 'toggle' | 'replace';
|
|
468
|
-
type Selection = 'all' | Set<Key>;
|
|
615
|
+
type Selection = 'all' | Set<Key$1>;
|
|
469
616
|
|
|
470
617
|
type FocusStrategy = 'first' | 'last';
|
|
471
618
|
type DisabledBehavior = 'selection' | 'all';
|
|
@@ -492,32 +639,32 @@ interface Collection<T> extends Iterable<T> {
|
|
|
492
639
|
readonly size: number,
|
|
493
640
|
|
|
494
641
|
/** Iterate over all keys in the collection. */
|
|
495
|
-
getKeys(): Iterable<Key>,
|
|
642
|
+
getKeys(): Iterable<Key$1>,
|
|
496
643
|
|
|
497
644
|
/** Get an item by its key. */
|
|
498
|
-
getItem(key: Key): T,
|
|
645
|
+
getItem(key: Key$1): T,
|
|
499
646
|
|
|
500
647
|
/** Get an item by the index of its key. */
|
|
501
648
|
at(idx: number): T,
|
|
502
649
|
|
|
503
650
|
/** Get the key that comes before the given key in the collection. */
|
|
504
|
-
getKeyBefore(key: Key): Key | null,
|
|
651
|
+
getKeyBefore(key: Key$1): Key$1 | null,
|
|
505
652
|
|
|
506
653
|
/** Get the key that comes after the given key in the collection. */
|
|
507
|
-
getKeyAfter(key: Key): Key | null,
|
|
654
|
+
getKeyAfter(key: Key$1): Key$1 | null,
|
|
508
655
|
|
|
509
656
|
/** Get the first key in the collection. */
|
|
510
|
-
getFirstKey(): Key | null,
|
|
657
|
+
getFirstKey(): Key$1 | null,
|
|
511
658
|
|
|
512
659
|
/** Get the last key in the collection. */
|
|
513
|
-
getLastKey(): Key | null
|
|
660
|
+
getLastKey(): Key$1 | null
|
|
514
661
|
}
|
|
515
662
|
|
|
516
663
|
interface Node<T> {
|
|
517
664
|
/** The type of item this node represents. */
|
|
518
665
|
type: string,
|
|
519
666
|
/** A unique key for the node. */
|
|
520
|
-
key: Key,
|
|
667
|
+
key: Key$1,
|
|
521
668
|
/** The object value the node was created from. */
|
|
522
669
|
value: T,
|
|
523
670
|
/** The level of depth this node is at in the heirarchy. */
|
|
@@ -537,11 +684,11 @@ interface Node<T> {
|
|
|
537
684
|
/** A function that should be called to wrap the rendered node. */
|
|
538
685
|
wrapper?: (element: ReactElement) => ReactElement,
|
|
539
686
|
/** The key of the parent node. */
|
|
540
|
-
parentKey?: Key,
|
|
687
|
+
parentKey?: Key$1,
|
|
541
688
|
/** The key of the node before this node. */
|
|
542
|
-
prevKey?: Key,
|
|
689
|
+
prevKey?: Key$1,
|
|
543
690
|
/** The key of the node after this node. */
|
|
544
|
-
nextKey?: Key,
|
|
691
|
+
nextKey?: Key$1,
|
|
545
692
|
/** Additional properties specific to a particular node type. */
|
|
546
693
|
props?: any,
|
|
547
694
|
/** @private */
|
|
@@ -1284,11 +1431,11 @@ interface FocusState {
|
|
|
1284
1431
|
/** Sets whether the collection is focused. */
|
|
1285
1432
|
setFocused(isFocused: boolean): void;
|
|
1286
1433
|
/** The current focused key in the collection. */
|
|
1287
|
-
readonly focusedKey: Key;
|
|
1434
|
+
readonly focusedKey: Key$1;
|
|
1288
1435
|
/** Whether the first or last child of the focused key should receive focus. */
|
|
1289
1436
|
readonly childFocusStrategy: FocusStrategy;
|
|
1290
1437
|
/** Sets the focused key, and optionally, whether the first or last child of that key should receive focus. */
|
|
1291
|
-
setFocusedKey(key: Key, child?: FocusStrategy): void;
|
|
1438
|
+
setFocusedKey(key: Key$1, child?: FocusStrategy): void;
|
|
1292
1439
|
}
|
|
1293
1440
|
interface MultipleSelectionState extends FocusState {
|
|
1294
1441
|
/** The type of selection that is allowed in the collection. */
|
|
@@ -1304,7 +1451,7 @@ interface MultipleSelectionState extends FocusState {
|
|
|
1304
1451
|
/** Sets the selected keys in the collection. */
|
|
1305
1452
|
setSelectedKeys(keys: Selection): void;
|
|
1306
1453
|
/** The currently disabled keys in the collection. */
|
|
1307
|
-
readonly disabledKeys: Set<Key>;
|
|
1454
|
+
readonly disabledKeys: Set<Key$1>;
|
|
1308
1455
|
/** Whether `disabledKeys` applies to selection, actions, or both. */
|
|
1309
1456
|
readonly disabledBehavior: DisabledBehavior;
|
|
1310
1457
|
}
|
|
@@ -1316,31 +1463,31 @@ interface MultipleSelectionManager extends FocusState {
|
|
|
1316
1463
|
/** Whether the collection allows empty selection. */
|
|
1317
1464
|
readonly disallowEmptySelection?: boolean;
|
|
1318
1465
|
/** The currently selected keys in the collection. */
|
|
1319
|
-
readonly selectedKeys: Set<Key>;
|
|
1466
|
+
readonly selectedKeys: Set<Key$1>;
|
|
1320
1467
|
/** Whether the selection is empty. */
|
|
1321
1468
|
readonly isEmpty: boolean;
|
|
1322
1469
|
/** Whether all items in the collection are selected. */
|
|
1323
1470
|
readonly isSelectAll: boolean;
|
|
1324
1471
|
/** The first selected key in the collection. */
|
|
1325
|
-
readonly firstSelectedKey: Key | null;
|
|
1472
|
+
readonly firstSelectedKey: Key$1 | null;
|
|
1326
1473
|
/** The last selected key in the collection. */
|
|
1327
|
-
readonly lastSelectedKey: Key | null;
|
|
1474
|
+
readonly lastSelectedKey: Key$1 | null;
|
|
1328
1475
|
/** The currently disabled keys in the collection. */
|
|
1329
|
-
readonly disabledKeys: Set<Key>;
|
|
1476
|
+
readonly disabledKeys: Set<Key$1>;
|
|
1330
1477
|
/** Whether `disabledKeys` applies to selection, actions, or both. */
|
|
1331
1478
|
readonly disabledBehavior: DisabledBehavior;
|
|
1332
1479
|
/** Returns whether a key is selected. */
|
|
1333
|
-
isSelected(key: Key): boolean;
|
|
1480
|
+
isSelected(key: Key$1): boolean;
|
|
1334
1481
|
/** Returns whether the current selection is equal to the given selection. */
|
|
1335
|
-
isSelectionEqual(selection: Set<Key>): boolean;
|
|
1482
|
+
isSelectionEqual(selection: Set<Key$1>): boolean;
|
|
1336
1483
|
/** Extends the selection to the given key. */
|
|
1337
|
-
extendSelection(toKey: Key): void;
|
|
1484
|
+
extendSelection(toKey: Key$1): void;
|
|
1338
1485
|
/** Toggles whether the given key is selected. */
|
|
1339
|
-
toggleSelection(key: Key): void;
|
|
1486
|
+
toggleSelection(key: Key$1): void;
|
|
1340
1487
|
/** Replaces the selection with only the given key. */
|
|
1341
|
-
replaceSelection(key: Key): void;
|
|
1488
|
+
replaceSelection(key: Key$1): void;
|
|
1342
1489
|
/** Replaces the selection with the given keys. */
|
|
1343
|
-
setSelectedKeys(keys: Iterable<Key>): void;
|
|
1490
|
+
setSelectedKeys(keys: Iterable<Key$1>): void;
|
|
1344
1491
|
/** Selects all items in the collection. */
|
|
1345
1492
|
selectAll(): void;
|
|
1346
1493
|
/** Removes all keys from the selection. */
|
|
@@ -1351,11 +1498,11 @@ interface MultipleSelectionManager extends FocusState {
|
|
|
1351
1498
|
* Toggles, replaces, or extends selection to the given key depending
|
|
1352
1499
|
* on the pointer event and collection's selection mode.
|
|
1353
1500
|
*/
|
|
1354
|
-
select(key: Key, e?: PressEvent | LongPressEvent | PointerEvent): void;
|
|
1501
|
+
select(key: Key$1, e?: PressEvent | LongPressEvent | PointerEvent): void;
|
|
1355
1502
|
/** Returns whether the given key can be selected. */
|
|
1356
|
-
canSelectItem(key: Key): boolean;
|
|
1503
|
+
canSelectItem(key: Key$1): boolean;
|
|
1357
1504
|
/** Returns whether the given key is non-interactive, i.e. both selection and actions are disabled. */
|
|
1358
|
-
isDisabled(key: Key): boolean;
|
|
1505
|
+
isDisabled(key: Key$1): boolean;
|
|
1359
1506
|
/** Sets the selection behavior for the collection. */
|
|
1360
1507
|
setSelectionBehavior(selectionBehavior: SelectionBehavior): void;
|
|
1361
1508
|
}
|
|
@@ -1394,17 +1541,17 @@ declare class SelectionManager implements MultipleSelectionManager {
|
|
|
1394
1541
|
/**
|
|
1395
1542
|
* The current focused key in the collection.
|
|
1396
1543
|
*/
|
|
1397
|
-
get focusedKey(): Key;
|
|
1544
|
+
get focusedKey(): Key$1;
|
|
1398
1545
|
/** Whether the first or last child of the focused key should receive focus. */
|
|
1399
1546
|
get childFocusStrategy(): FocusStrategy;
|
|
1400
1547
|
/**
|
|
1401
1548
|
* Sets the focused key.
|
|
1402
1549
|
*/
|
|
1403
|
-
setFocusedKey(key: Key, childFocusStrategy?: FocusStrategy): void;
|
|
1550
|
+
setFocusedKey(key: Key$1, childFocusStrategy?: FocusStrategy): void;
|
|
1404
1551
|
/**
|
|
1405
1552
|
* The currently selected keys in the collection.
|
|
1406
1553
|
*/
|
|
1407
|
-
get selectedKeys(): Set<Key>;
|
|
1554
|
+
get selectedKeys(): Set<Key$1>;
|
|
1408
1555
|
/**
|
|
1409
1556
|
* The raw selection value for the collection.
|
|
1410
1557
|
* Either 'all' for select all, or a set of keys.
|
|
@@ -1413,7 +1560,7 @@ declare class SelectionManager implements MultipleSelectionManager {
|
|
|
1413
1560
|
/**
|
|
1414
1561
|
* Returns whether a key is selected.
|
|
1415
1562
|
*/
|
|
1416
|
-
isSelected(key: Key): boolean;
|
|
1563
|
+
isSelected(key: Key$1): boolean;
|
|
1417
1564
|
/**
|
|
1418
1565
|
* Whether the selection is empty.
|
|
1419
1566
|
*/
|
|
@@ -1422,26 +1569,26 @@ declare class SelectionManager implements MultipleSelectionManager {
|
|
|
1422
1569
|
* Whether all items in the collection are selected.
|
|
1423
1570
|
*/
|
|
1424
1571
|
get isSelectAll(): boolean;
|
|
1425
|
-
get firstSelectedKey(): Key | null;
|
|
1426
|
-
get lastSelectedKey(): Key | null;
|
|
1427
|
-
get disabledKeys(): Set<Key>;
|
|
1572
|
+
get firstSelectedKey(): Key$1 | null;
|
|
1573
|
+
get lastSelectedKey(): Key$1 | null;
|
|
1574
|
+
get disabledKeys(): Set<Key$1>;
|
|
1428
1575
|
get disabledBehavior(): DisabledBehavior;
|
|
1429
1576
|
/**
|
|
1430
1577
|
* Extends the selection to the given key.
|
|
1431
1578
|
*/
|
|
1432
|
-
extendSelection(toKey: Key): void;
|
|
1579
|
+
extendSelection(toKey: Key$1): void;
|
|
1433
1580
|
/**
|
|
1434
1581
|
* Toggles whether the given key is selected.
|
|
1435
1582
|
*/
|
|
1436
|
-
toggleSelection(key: Key): void;
|
|
1583
|
+
toggleSelection(key: Key$1): void;
|
|
1437
1584
|
/**
|
|
1438
1585
|
* Replaces the selection with only the given key.
|
|
1439
1586
|
*/
|
|
1440
|
-
replaceSelection(key: Key): void;
|
|
1587
|
+
replaceSelection(key: Key$1): void;
|
|
1441
1588
|
/**
|
|
1442
1589
|
* Replaces the selection with the given keys.
|
|
1443
1590
|
*/
|
|
1444
|
-
setSelectedKeys(keys: Iterable<Key>): void;
|
|
1591
|
+
setSelectedKeys(keys: Iterable<Key$1>): void;
|
|
1445
1592
|
/**
|
|
1446
1593
|
* Selects all items in the collection.
|
|
1447
1594
|
*/
|
|
@@ -1454,20 +1601,20 @@ declare class SelectionManager implements MultipleSelectionManager {
|
|
|
1454
1601
|
* Toggles between select all and an empty selection.
|
|
1455
1602
|
*/
|
|
1456
1603
|
toggleSelectAll(): void;
|
|
1457
|
-
select(key: Key, e?: PressEvent | LongPressEvent | PointerEvent): void;
|
|
1604
|
+
select(key: Key$1, e?: PressEvent | LongPressEvent | PointerEvent): void;
|
|
1458
1605
|
/**
|
|
1459
1606
|
* Returns whether the current selection is equal to the given selection.
|
|
1460
1607
|
*/
|
|
1461
|
-
isSelectionEqual(selection: Set<Key>): boolean;
|
|
1462
|
-
canSelectItem(key: Key): boolean;
|
|
1463
|
-
isDisabled(key: Key): boolean;
|
|
1608
|
+
isSelectionEqual(selection: Set<Key$1>): boolean;
|
|
1609
|
+
canSelectItem(key: Key$1): boolean;
|
|
1610
|
+
isDisabled(key: Key$1): boolean;
|
|
1464
1611
|
}
|
|
1465
1612
|
|
|
1466
1613
|
interface ListState<T> {
|
|
1467
1614
|
/** A collection of items in the list. */
|
|
1468
1615
|
collection: Collection<Node<T>>;
|
|
1469
1616
|
/** A set of items that are disabled. */
|
|
1470
|
-
disabledKeys: Set<Key>;
|
|
1617
|
+
disabledKeys: Set<Key$1>;
|
|
1471
1618
|
/** A selection manager to read and update multiple selection state. */
|
|
1472
1619
|
selectionManager: SelectionManager;
|
|
1473
1620
|
}
|
|
@@ -1636,4 +1783,4 @@ interface TriggeredOverlayContextValue {
|
|
|
1636
1783
|
}
|
|
1637
1784
|
declare const TriggeredOverlayContext: React.Context<TriggeredOverlayContextValue | undefined>;
|
|
1638
1785
|
|
|
1639
|
-
export { $State$1 as $State, BaseButtonProps, BaseMenuButtonProps, BaseMenuGroupProps, BaseMenuItemProps, BaseMenuProps, BaseSelectOptionGroupProps, BaseSelectOptionProps, BaseSelectProps, BaseTextInputProps, BaseTriggeredOverlayProps, ButtonRef, CheckboxProps, CheckboxRef, CheckboxRefValue, DropdownMenu, Flex, HTMLElementRefOf, HtmlAnchorOnlyProps, HtmlButtonOnlyProps, MenuButtonRef, MenuButtonRefValue, MenuRef, MenuRefValue, MultiChoiceArg, PlasmicDataSourceContextProvider, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, SelectContext, SelectOptionRef, SelectRef, SelectRefValue, SingleBooleanChoiceArg, SingleChoiceArg, Stack, StrictProps, SwitchProps, SwitchRef, SwitchRefValue, TextInputRef, TextInputRefValue, Trans, TriggeredOverlayConfig, TriggeredOverlayContext, TriggeredOverlayRef, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, dlv as get, getDataProps, hasVariant, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, set, setPlumeStrictMode, useButton, useCanvasDollarState, useCheckbox, useCurrentUser, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
|
1786
|
+
export { $State$1 as $State, BaseButtonProps, BaseMenuButtonProps, BaseMenuGroupProps, BaseMenuItemProps, BaseMenuProps, BaseSelectOptionGroupProps, BaseSelectOptionProps, BaseSelectProps, BaseTextInputProps, BaseTriggeredOverlayProps, ButtonRef, CheckboxProps, CheckboxRef, CheckboxRefValue, DataOp, DataSourceSchema, DropdownMenu, Fetcher, Flex, HTMLElementRefOf, HtmlAnchorOnlyProps, HtmlButtonOnlyProps, ManyRowsResult, MenuButtonRef, MenuButtonRefValue, MenuRef, MenuRefValue, MultiChoiceArg, Pagination, PlasmicDataSourceContextProvider, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, SelectContext, SelectOptionRef, SelectRef, SelectRefValue, SingleBooleanChoiceArg, SingleChoiceArg, SingleRowResult, Stack, StrictProps, SwitchProps, SwitchRef, SwitchRefValue, TableFieldSchema, TableFieldType, TableSchema, TextInputRef, TextInputRefValue, Trans, TriggeredOverlayConfig, TriggeredOverlayContext, TriggeredOverlayRef, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, executePlasmicDataOp, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, dlv as get, getDataProps, hasVariant, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, set, setPlumeStrictMode, useButton, useCanvasDollarState, useCheckbox, useCurrentUser, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, usePlasmicDataConfig, usePlasmicDataMutationOp, usePlasmicDataOp, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
package/dist/index-common.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _classNames from "classnames";
|
|
2
|
-
export
|
|
2
|
+
export { DataOp, DataSourceSchema, executePlasmicDataOp, Fetcher, ManyRowsResult, Pagination, SingleRowResult, TableFieldSchema, TableFieldType, TableSchema, usePlasmicDataConfig, usePlasmicDataMutationOp, usePlasmicDataOp, } from "@plasmicapp/data-sources";
|
|
3
3
|
export { omit, pick } from "./common";
|
|
4
4
|
export { HTMLElementRefOf, StrictProps } from "./react-utils";
|
|
5
5
|
export { createPlasmicElementProxy, deriveRenderOpts, Flex, hasVariant, makeFragment, mergeVariantsWithStates, MultiChoiceArg, SingleBooleanChoiceArg, SingleChoiceArg, wrapWithClassName, } from "./render/elements";
|
|
@@ -16,3 +16,4 @@ export { genTranslatableString, Trans } from "./render/translation";
|
|
|
16
16
|
export { useTrigger } from "./render/triggers";
|
|
17
17
|
export * from "./states/helpers";
|
|
18
18
|
export { $State, default as useDollarState, useCanvasDollarState, } from "./states/valtio";
|
|
19
|
+
export declare const classNames: typeof _classNames;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,5 +9,3 @@ export * from "./plume/select";
|
|
|
9
9
|
export * from "./plume/switch";
|
|
10
10
|
export * from "./plume/text-input";
|
|
11
11
|
export * from "./plume/triggered-overlay";
|
|
12
|
-
export * from "./states/helpers";
|
|
13
|
-
export { $State, default as useDollarState, useCanvasDollarState, } from "./states/valtio";
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
7
|
var classNames$1 = _interopDefault(require('classnames'));
|
|
8
|
+
var dataSources = require('@plasmicapp/data-sources');
|
|
8
9
|
var _get = _interopDefault(require('dlv'));
|
|
9
10
|
var React = require('react');
|
|
10
11
|
var React__default = _interopDefault(React);
|
|
@@ -1982,13 +1983,33 @@ function initializeStateValue($$state, initialStatePath, initialSpec) {
|
|
|
1982
1983
|
});
|
|
1983
1984
|
$$state.unsubscriptionsByState[initialStateKey].push(unsubscribe);
|
|
1984
1985
|
});
|
|
1985
|
-
var
|
|
1986
|
+
var initialValue = initialSpec.initFunc($$state.props, $state, getIndexes(initialStatePath, initialSpec));
|
|
1987
|
+
saveStateInitialValue($$state, initialStatePath, initialSpec, initialValue);
|
|
1988
|
+
return initialValue;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
function saveStateInitialValue($$state, path, spec, initialValue) {
|
|
1992
|
+
// array states are a special case.Wwe listen for changes in the array and in the array cells.
|
|
1993
|
+
// for example: $state.people.push(...), $state.people.splice(...), $state.people[0] = ...
|
|
1994
|
+
// that's why we need to track the array object
|
|
1995
|
+
if (spec.isArray && Array.isArray(initialValue)) {
|
|
1996
|
+
var array = initialValue.map(function (val) {
|
|
1997
|
+
return mkUntrackedValue(val);
|
|
1998
|
+
});
|
|
1999
|
+
|
|
2000
|
+
set($$state.stateValues, path, array); // we need to make the array untracked for initStateValues
|
|
2001
|
+
// so we can distinguish between stateValue and initStateValue.
|
|
2002
|
+
// otherwise they would reference the same array.
|
|
1986
2003
|
|
|
1987
|
-
set($$state.initStateValues, initialStatePath, untrackedInitialValue);
|
|
1988
2004
|
|
|
1989
|
-
|
|
2005
|
+
set($$state.initStateValues, path, mkUntrackedValue(array));
|
|
2006
|
+
} else {
|
|
2007
|
+
var untrackedValue = mkUntrackedValue(initialValue);
|
|
2008
|
+
|
|
2009
|
+
set($$state.stateValues, path, untrackedValue);
|
|
1990
2010
|
|
|
1991
|
-
|
|
2011
|
+
set($$state.initStateValues, path, untrackedValue);
|
|
2012
|
+
}
|
|
1992
2013
|
}
|
|
1993
2014
|
|
|
1994
2015
|
function useDollarState(specs, props) {
|
|
@@ -2017,11 +2038,8 @@ function useDollarState(specs, props) {
|
|
|
2017
2038
|
var _spec$initVal;
|
|
2018
2039
|
|
|
2019
2040
|
saveNewState($$state, path, spec);
|
|
2020
|
-
var
|
|
2021
|
-
|
|
2022
|
-
set($$state.stateValues, path, untrackedValue);
|
|
2023
|
-
|
|
2024
|
-
set($$state.initStateValues, path, untrackedValue);
|
|
2041
|
+
var initialValue = !spec.initFunc ? (_spec$initVal = spec.initVal) != null ? _spec$initVal : undefined : initializeStateValue($$state, path, spec);
|
|
2042
|
+
saveStateInitialValue($$state, path, spec, initialValue);
|
|
2025
2043
|
}
|
|
2026
2044
|
|
|
2027
2045
|
return {
|
|
@@ -2318,9 +2336,7 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2318
2336
|
ref: rootRef
|
|
2319
2337
|
}),
|
|
2320
2338
|
wrapChildren: function wrapChildren(children) {
|
|
2321
|
-
return React.createElement(React.Fragment, null, React.createElement(visuallyHidden.VisuallyHidden, {
|
|
2322
|
-
isFocusable: true
|
|
2323
|
-
}, React.createElement("input", Object.assign({}, inputProps, {
|
|
2339
|
+
return React.createElement(React.Fragment, null, React.createElement(visuallyHidden.VisuallyHidden, null, React.createElement("input", Object.assign({}, inputProps, {
|
|
2324
2340
|
ref: inputRef
|
|
2325
2341
|
}))), children);
|
|
2326
2342
|
}
|
|
@@ -3461,9 +3477,7 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3461
3477
|
ref: rootRef
|
|
3462
3478
|
}),
|
|
3463
3479
|
wrapChildren: function wrapChildren(children) {
|
|
3464
|
-
return React.createElement(React.Fragment, null, React.createElement(visuallyHidden.VisuallyHidden, {
|
|
3465
|
-
isFocusable: true
|
|
3466
|
-
}, React.createElement("input", Object.assign({}, inputProps, {
|
|
3480
|
+
return React.createElement(React.Fragment, null, React.createElement(visuallyHidden.VisuallyHidden, null, React.createElement("input", Object.assign({}, inputProps, {
|
|
3467
3481
|
ref: inputRef
|
|
3468
3482
|
}))), children);
|
|
3469
3483
|
}
|
|
@@ -3716,6 +3730,36 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
|
|
|
3716
3730
|
};
|
|
3717
3731
|
}
|
|
3718
3732
|
|
|
3733
|
+
Object.defineProperty(exports, 'Fetcher', {
|
|
3734
|
+
enumerable: true,
|
|
3735
|
+
get: function () {
|
|
3736
|
+
return dataSources.Fetcher;
|
|
3737
|
+
}
|
|
3738
|
+
});
|
|
3739
|
+
Object.defineProperty(exports, 'executePlasmicDataOp', {
|
|
3740
|
+
enumerable: true,
|
|
3741
|
+
get: function () {
|
|
3742
|
+
return dataSources.executePlasmicDataOp;
|
|
3743
|
+
}
|
|
3744
|
+
});
|
|
3745
|
+
Object.defineProperty(exports, 'usePlasmicDataConfig', {
|
|
3746
|
+
enumerable: true,
|
|
3747
|
+
get: function () {
|
|
3748
|
+
return dataSources.usePlasmicDataConfig;
|
|
3749
|
+
}
|
|
3750
|
+
});
|
|
3751
|
+
Object.defineProperty(exports, 'usePlasmicDataMutationOp', {
|
|
3752
|
+
enumerable: true,
|
|
3753
|
+
get: function () {
|
|
3754
|
+
return dataSources.usePlasmicDataMutationOp;
|
|
3755
|
+
}
|
|
3756
|
+
});
|
|
3757
|
+
Object.defineProperty(exports, 'usePlasmicDataOp', {
|
|
3758
|
+
enumerable: true,
|
|
3759
|
+
get: function () {
|
|
3760
|
+
return dataSources.usePlasmicDataOp;
|
|
3761
|
+
}
|
|
3762
|
+
});
|
|
3719
3763
|
exports.get = _get;
|
|
3720
3764
|
Object.defineProperty(exports, 'PlasmicDataSourceContextProvider', {
|
|
3721
3765
|
enumerable: true,
|