@plasmicapp/react-web 0.2.136 → 0.2.138
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 +49 -46
- package/dist/auth/PlasmicPageGuard.d.ts +7 -0
- package/dist/index-common.d.ts +2 -3
- package/dist/react-web.cjs.development.js +708 -1087
- 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 +710 -1086
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/translation.d.ts +2 -1
- package/dist/states/graph.d.ts +23 -2
- package/dist/states/helpers.d.ts +7 -6
- package/dist/states/index.d.ts +4 -24
- package/dist/states/types.d.ts +24 -0
- package/dist/states/valtio.d.ts +2 -3
- package/dist/stories/UseDollarState.stories.d.ts +1 -0
- package/package.json +5 -6
- package/skinny/dist/auth/PlasmicPageGuard.d.ts +7 -0
- package/skinny/dist/index-common.d.ts +2 -3
- package/skinny/dist/index.js +393 -319
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/plume/checkbox/index.js +1 -1
- package/skinny/dist/plume/menu/index.js +1 -1
- package/skinny/dist/plume/menu-button/index.js +1 -1
- package/skinny/dist/plume/select/index.js +1 -1
- package/skinny/dist/plume/switch/index.js +1 -1
- package/skinny/dist/render/translation.d.ts +2 -1
- package/skinny/dist/{ssr-b16a1854.js → ssr-f6caec06.js} +7 -6
- package/skinny/dist/ssr-f6caec06.js.map +1 -0
- package/skinny/dist/states/graph.d.ts +23 -2
- package/skinny/dist/states/helpers.d.ts +7 -6
- package/skinny/dist/states/index.d.ts +4 -24
- package/skinny/dist/states/types.d.ts +24 -0
- package/skinny/dist/states/valtio.d.ts +2 -3
- package/skinny/dist/stories/UseDollarState.stories.d.ts +1 -0
- package/skinny/dist/ssr-b16a1854.js.map +0 -1
|
@@ -5,9 +5,9 @@ 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 _get = _interopDefault(require('dlv'));
|
|
9
8
|
var React = require('react');
|
|
10
9
|
var React__default = _interopDefault(React);
|
|
10
|
+
var _get = _interopDefault(require('dlv'));
|
|
11
11
|
var ReactDOM = require('react-dom');
|
|
12
12
|
var ReactDOM__default = _interopDefault(ReactDOM);
|
|
13
13
|
var dataSourcesContext = require('@plasmicapp/data-sources-context');
|
|
@@ -16,7 +16,6 @@ var focus = require('@react-aria/focus');
|
|
|
16
16
|
var clone = _interopDefault(require('clone'));
|
|
17
17
|
var deepEqual = _interopDefault(require('fast-deep-equal'));
|
|
18
18
|
var valtio = require('valtio');
|
|
19
|
-
var utils = require('valtio/utils');
|
|
20
19
|
var checkbox = require('@react-aria/checkbox');
|
|
21
20
|
var visuallyHidden = require('@react-aria/visually-hidden');
|
|
22
21
|
var toggle = require('@react-stately/toggle');
|
|
@@ -32,39 +31,57 @@ var select$1 = require('@react-stately/select');
|
|
|
32
31
|
var _switch = require('@react-aria/switch');
|
|
33
32
|
var overlays = require('@react-aria/overlays');
|
|
34
33
|
|
|
34
|
+
function PlasmicPageGuard(props) {
|
|
35
|
+
var children = props.children,
|
|
36
|
+
dataSourceCtxValue = props.dataSourceCtxValue,
|
|
37
|
+
validRoles = props.validRoles;
|
|
38
|
+
if (!dataSourceCtxValue || dataSourceCtxValue.isUserLoading) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function canUserViewPage() {
|
|
42
|
+
if (!dataSourceCtxValue) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (!dataSourceCtxValue.user) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (!("roleId" in dataSourceCtxValue.user)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return validRoles.includes(dataSourceCtxValue.user.roleId);
|
|
52
|
+
}
|
|
53
|
+
if (!canUserViewPage()) {
|
|
54
|
+
return React__default.createElement("div", null, "You don't have access to this page");
|
|
55
|
+
}
|
|
56
|
+
return children;
|
|
57
|
+
}
|
|
58
|
+
|
|
35
59
|
function _extends() {
|
|
36
|
-
_extends = Object.assign
|
|
60
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
37
61
|
for (var i = 1; i < arguments.length; i++) {
|
|
38
62
|
var source = arguments[i];
|
|
39
|
-
|
|
40
63
|
for (var key in source) {
|
|
41
64
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
42
65
|
target[key] = source[key];
|
|
43
66
|
}
|
|
44
67
|
}
|
|
45
68
|
}
|
|
46
|
-
|
|
47
69
|
return target;
|
|
48
70
|
};
|
|
49
|
-
|
|
50
71
|
return _extends.apply(this, arguments);
|
|
51
72
|
}
|
|
52
|
-
|
|
53
73
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
54
74
|
if (source == null) return {};
|
|
55
75
|
var target = {};
|
|
56
76
|
var sourceKeys = Object.keys(source);
|
|
57
77
|
var key, i;
|
|
58
|
-
|
|
59
78
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
60
79
|
key = sourceKeys[i];
|
|
61
80
|
if (excluded.indexOf(key) >= 0) continue;
|
|
62
81
|
target[key] = source[key];
|
|
63
82
|
}
|
|
64
|
-
|
|
65
83
|
return target;
|
|
66
84
|
}
|
|
67
|
-
|
|
68
85
|
function _unsupportedIterableToArray(o, minLen) {
|
|
69
86
|
if (!o) return;
|
|
70
87
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -73,19 +90,14 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
73
90
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
74
91
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
75
92
|
}
|
|
76
|
-
|
|
77
93
|
function _arrayLikeToArray(arr, len) {
|
|
78
94
|
if (len == null || len > arr.length) len = arr.length;
|
|
79
|
-
|
|
80
95
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
81
|
-
|
|
82
96
|
return arr2;
|
|
83
97
|
}
|
|
84
|
-
|
|
85
98
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
86
99
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
87
100
|
if (it) return (it = it.call(o)).next.bind(it);
|
|
88
|
-
|
|
89
101
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
90
102
|
if (it) o = it;
|
|
91
103
|
var i = 0;
|
|
@@ -99,7 +111,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
99
111
|
};
|
|
100
112
|
};
|
|
101
113
|
}
|
|
102
|
-
|
|
103
114
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
104
115
|
}
|
|
105
116
|
|
|
@@ -110,57 +121,44 @@ function pick(obj) {
|
|
|
110
121
|
if (Object.keys(obj).length === 0) {
|
|
111
122
|
return obj;
|
|
112
123
|
}
|
|
113
|
-
|
|
114
124
|
var res = {};
|
|
115
|
-
|
|
116
125
|
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
117
126
|
keys[_key - 1] = arguments[_key];
|
|
118
127
|
}
|
|
119
|
-
|
|
120
128
|
for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
|
|
121
129
|
var key = _keys[_i];
|
|
122
|
-
|
|
123
130
|
if (key in obj) {
|
|
124
131
|
res[key] = obj[key];
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
|
-
|
|
128
134
|
return res;
|
|
129
135
|
}
|
|
130
136
|
function pickBy(obj, func) {
|
|
131
137
|
var res = {};
|
|
132
|
-
|
|
133
138
|
for (var _i2 = 0, _Object$entries = Object.entries(obj); _i2 < _Object$entries.length; _i2++) {
|
|
134
139
|
var _Object$entries$_i = _Object$entries[_i2],
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
140
|
+
key = _Object$entries$_i[0],
|
|
141
|
+
val = _Object$entries$_i[1];
|
|
138
142
|
if (func(key, val)) {
|
|
139
143
|
res[key] = obj[key];
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
|
-
|
|
143
146
|
return res;
|
|
144
147
|
}
|
|
145
148
|
function omit(obj) {
|
|
146
149
|
if (Object.keys(obj).length === 0) {
|
|
147
150
|
return obj;
|
|
148
151
|
}
|
|
149
|
-
|
|
150
152
|
var res = {};
|
|
151
|
-
|
|
152
153
|
for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
153
154
|
keys[_key2 - 1] = arguments[_key2];
|
|
154
155
|
}
|
|
155
|
-
|
|
156
156
|
for (var _i3 = 0, _Object$keys = Object.keys(obj); _i3 < _Object$keys.length; _i3++) {
|
|
157
157
|
var key = _Object$keys[_i3];
|
|
158
|
-
|
|
159
158
|
if (!keys.includes(key)) {
|
|
160
159
|
res[key] = obj[key];
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
|
-
|
|
164
162
|
return res;
|
|
165
163
|
}
|
|
166
164
|
function isSubset(a1, a2) {
|
|
@@ -172,19 +170,15 @@ function chainSingleArgFuncs() {
|
|
|
172
170
|
for (var _len3 = arguments.length, funcs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
173
171
|
funcs[_key3] = arguments[_key3];
|
|
174
172
|
}
|
|
175
|
-
|
|
176
173
|
if (funcs.length === 0) {
|
|
177
174
|
return undefined;
|
|
178
175
|
}
|
|
179
|
-
|
|
180
176
|
return function (arg) {
|
|
181
177
|
var res = arg;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
var func = _step.value;
|
|
178
|
+
for (var _i4 = 0, _funcs = funcs; _i4 < _funcs.length; _i4++) {
|
|
179
|
+
var func = _funcs[_i4];
|
|
185
180
|
res = func(res);
|
|
186
181
|
}
|
|
187
|
-
|
|
188
182
|
return res;
|
|
189
183
|
};
|
|
190
184
|
}
|
|
@@ -193,27 +187,22 @@ function isString(x) {
|
|
|
193
187
|
}
|
|
194
188
|
function groupBy(collection, keyFunc) {
|
|
195
189
|
var result = {};
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
var obj = _step2.value;
|
|
190
|
+
for (var _iterator = _createForOfIteratorHelperLoose(collection), _step; !(_step = _iterator()).done;) {
|
|
191
|
+
var obj = _step.value;
|
|
199
192
|
var key = keyFunc(obj);
|
|
200
|
-
|
|
201
193
|
if (key in result) {
|
|
202
194
|
result[key].push(obj);
|
|
203
195
|
} else {
|
|
204
196
|
result[key] = [obj];
|
|
205
197
|
}
|
|
206
198
|
}
|
|
207
|
-
|
|
208
199
|
return result;
|
|
209
200
|
}
|
|
210
201
|
function mapValues(obj, mapper) {
|
|
211
202
|
var result = {};
|
|
212
|
-
|
|
213
203
|
for (var key in obj) {
|
|
214
204
|
result[key] = mapper(obj[key]);
|
|
215
205
|
}
|
|
216
|
-
|
|
217
206
|
return result;
|
|
218
207
|
}
|
|
219
208
|
|
|
@@ -251,7 +240,6 @@ function ensureNotArray(children) {
|
|
|
251
240
|
* Flattens ReactNode into an array of ReactChild, but does NOT replace
|
|
252
241
|
* missing keys with array index, as React.Children.toArray() does.
|
|
253
242
|
*/
|
|
254
|
-
|
|
255
243
|
function toChildArray(children) {
|
|
256
244
|
if (isReactChild(children)) {
|
|
257
245
|
return [children];
|
|
@@ -274,32 +262,25 @@ function mergeProps(props) {
|
|
|
274
262
|
for (var _len = arguments.length, restProps = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
275
263
|
restProps[_key - 1] = arguments[_key];
|
|
276
264
|
}
|
|
277
|
-
|
|
278
265
|
if (restProps.every(function (rest) {
|
|
279
266
|
return Object.keys(rest).length === 0;
|
|
280
267
|
})) {
|
|
281
268
|
return props;
|
|
282
269
|
}
|
|
283
|
-
|
|
284
270
|
var result = _extends({}, props);
|
|
285
|
-
|
|
286
271
|
for (var _i = 0, _restProps = restProps; _i < _restProps.length; _i++) {
|
|
287
272
|
var rest = _restProps[_i];
|
|
288
|
-
|
|
289
273
|
for (var _i2 = 0, _Object$keys = Object.keys(rest); _i2 < _Object$keys.length; _i2++) {
|
|
290
274
|
var key = _Object$keys[_i2];
|
|
291
275
|
result[key] = mergePropVals(key, result[key], rest[key]);
|
|
292
276
|
}
|
|
293
277
|
}
|
|
294
|
-
|
|
295
278
|
return result;
|
|
296
279
|
}
|
|
297
|
-
|
|
298
280
|
function updateRef(ref, value) {
|
|
299
281
|
if (!ref) {
|
|
300
282
|
return;
|
|
301
283
|
}
|
|
302
|
-
|
|
303
284
|
if (typeof ref === "function") {
|
|
304
285
|
ref(value);
|
|
305
286
|
} else {
|
|
@@ -308,15 +289,13 @@ function updateRef(ref, value) {
|
|
|
308
289
|
}
|
|
309
290
|
}
|
|
310
291
|
}
|
|
311
|
-
|
|
312
292
|
function mergeRefs() {
|
|
313
293
|
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
314
294
|
refs[_key2] = arguments[_key2];
|
|
315
295
|
}
|
|
316
|
-
|
|
317
296
|
return function (value) {
|
|
318
|
-
for (var
|
|
319
|
-
var ref =
|
|
297
|
+
for (var _i3 = 0, _refs = refs; _i3 < _refs.length; _i3++) {
|
|
298
|
+
var ref = _refs[_i3];
|
|
320
299
|
updateRef(ref, value);
|
|
321
300
|
}
|
|
322
301
|
};
|
|
@@ -347,15 +326,12 @@ function mergePropVals(name, val1, val2) {
|
|
|
347
326
|
// Special case for event handlers -- always call both handlers
|
|
348
327
|
return function () {
|
|
349
328
|
var res;
|
|
350
|
-
|
|
351
329
|
if (typeof val1 === "function") {
|
|
352
330
|
res = val1.apply(void 0, arguments);
|
|
353
331
|
}
|
|
354
|
-
|
|
355
332
|
if (typeof val2 === "function") {
|
|
356
333
|
res = val2.apply(void 0, arguments);
|
|
357
334
|
}
|
|
358
|
-
|
|
359
335
|
return res;
|
|
360
336
|
};
|
|
361
337
|
} else {
|
|
@@ -368,45 +344,36 @@ function getElementTypeName(element) {
|
|
|
368
344
|
return element.type;
|
|
369
345
|
} else {
|
|
370
346
|
var _ref, _ref2, _comp$displayName, _comp$render;
|
|
371
|
-
|
|
372
347
|
var comp = element.type;
|
|
373
348
|
return (_ref = (_ref2 = (_comp$displayName = comp.displayName) != null ? _comp$displayName : comp.name) != null ? _ref2 : (_comp$render = comp.render) == null ? void 0 : _comp$render.name) != null ? _ref : "Component";
|
|
374
349
|
}
|
|
375
350
|
}
|
|
376
351
|
|
|
377
352
|
var _excluded = ["children"],
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
353
|
+
_excluded2 = ["as", "hasGap"],
|
|
354
|
+
_excluded3 = ["hasGap"];
|
|
381
355
|
function renderStack(as, props, hasGap, ref) {
|
|
382
356
|
var children = props.children,
|
|
383
|
-
|
|
384
|
-
|
|
357
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
385
358
|
var wrappedChildren = wrapFlexContainerChildren(children, hasGap != null ? hasGap : false);
|
|
386
359
|
return createElementWithChildren(as, _extends({
|
|
387
360
|
ref: ref
|
|
388
361
|
}, rest), wrappedChildren);
|
|
389
362
|
}
|
|
390
|
-
|
|
391
363
|
function FlexStack_(props, outerRef) {
|
|
392
364
|
var as = props.as,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
365
|
+
hasGap = props.hasGap,
|
|
366
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
396
367
|
return renderStack(as != null ? as : "div", rest, hasGap, outerRef);
|
|
397
368
|
}
|
|
398
|
-
|
|
399
369
|
var FlexStack = /*#__PURE__*/React.forwardRef(FlexStack_);
|
|
400
|
-
|
|
401
370
|
var makeStackImpl = function makeStackImpl(as) {
|
|
402
371
|
return React.forwardRef(function (props, ref) {
|
|
403
372
|
var hasGap = props.hasGap,
|
|
404
|
-
|
|
405
|
-
|
|
373
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
406
374
|
return renderStack(as, rest, hasGap, ref);
|
|
407
375
|
});
|
|
408
376
|
};
|
|
409
|
-
|
|
410
377
|
var Stack = /*#__PURE__*/Object.assign(FlexStack, {
|
|
411
378
|
div: /*#__PURE__*/makeStackImpl("div"),
|
|
412
379
|
a: /*#__PURE__*/makeStackImpl("a"),
|
|
@@ -429,9 +396,7 @@ function hasVariant(variants, groupName, variant) {
|
|
|
429
396
|
if (variants == null) {
|
|
430
397
|
return false;
|
|
431
398
|
}
|
|
432
|
-
|
|
433
399
|
var groupVariants = variants[groupName];
|
|
434
|
-
|
|
435
400
|
if (groupVariants == null) {
|
|
436
401
|
return false;
|
|
437
402
|
} else if (groupVariants === true) {
|
|
@@ -452,7 +417,6 @@ function wrapFlexContainerChildren(children, hasGap) {
|
|
|
452
417
|
// will blow away the children tree and all state if we switch from having
|
|
453
418
|
// a wrapper and not.
|
|
454
419
|
var className = hasGap ? "__wab_flex-container" : "__wab_passthrough";
|
|
455
|
-
|
|
456
420
|
if (!children) {
|
|
457
421
|
return null;
|
|
458
422
|
} else if (Array.isArray(children)) {
|
|
@@ -465,21 +429,16 @@ function wrapFlexContainerChildren(children, hasGap) {
|
|
|
465
429
|
}, children);
|
|
466
430
|
}
|
|
467
431
|
}
|
|
468
|
-
|
|
469
432
|
function createPlasmicElement(override, defaultRoot, defaultProps, wrapChildrenInFlex) {
|
|
470
433
|
if (!override || Object.keys(override).length === 0) {
|
|
471
434
|
return createElementWithChildren(defaultRoot, defaultProps, defaultProps.children);
|
|
472
435
|
}
|
|
473
|
-
|
|
474
436
|
var override2 = deriveOverride(override);
|
|
475
437
|
var props = mergeOverrideProps(defaultProps, override2.props);
|
|
476
|
-
|
|
477
438
|
if (override2.type === "render") {
|
|
478
439
|
return override2.render(props, defaultRoot);
|
|
479
440
|
}
|
|
480
|
-
|
|
481
441
|
var root = defaultRoot;
|
|
482
|
-
|
|
483
442
|
if (override2.type === "as" && override2.as) {
|
|
484
443
|
if (defaultRoot === Stack) {
|
|
485
444
|
// If there was an "as" override specified, but the default type is
|
|
@@ -491,30 +450,23 @@ function createPlasmicElement(override, defaultRoot, defaultProps, wrapChildrenI
|
|
|
491
450
|
root = override2.as;
|
|
492
451
|
}
|
|
493
452
|
}
|
|
494
|
-
|
|
495
453
|
var children = props.children;
|
|
496
|
-
|
|
497
454
|
if (override2.wrapChildren) {
|
|
498
455
|
children = override2.wrapChildren(ensureNotArray(children));
|
|
499
456
|
}
|
|
500
|
-
|
|
501
457
|
if (wrapChildrenInFlex) {
|
|
502
458
|
// For legacy, we still support data-plasmic-wrap-flex-children
|
|
503
459
|
children = wrapFlexContainerChildren(children, true);
|
|
504
460
|
}
|
|
505
|
-
|
|
506
461
|
var result = createElementWithChildren(root, props, children);
|
|
507
|
-
|
|
508
462
|
if (override2.wrap) {
|
|
509
463
|
result = override2.wrap(result);
|
|
510
464
|
}
|
|
511
|
-
|
|
512
465
|
return result;
|
|
513
|
-
}
|
|
466
|
+
}
|
|
467
|
+
// We use data-plasmic-XXX attributes for custom properties since Typescript doesn't
|
|
514
468
|
// support type check on jsx pragma. See https://github.com/microsoft/TypeScript/issues/21699
|
|
515
469
|
// for more info.
|
|
516
|
-
|
|
517
|
-
|
|
518
470
|
var seenElements = /*#__PURE__*/new Map();
|
|
519
471
|
function createPlasmicElementProxy(defaultElement, props) {
|
|
520
472
|
// We use seenElements to keep track of elements that has been rendered by
|
|
@@ -531,78 +483,61 @@ function createPlasmicElementProxy(defaultElement, props) {
|
|
|
531
483
|
if (props == null) {
|
|
532
484
|
props = {};
|
|
533
485
|
}
|
|
534
|
-
|
|
535
486
|
var name = props["data-plasmic-name"];
|
|
536
487
|
var isRoot = props["data-plasmic-root"];
|
|
537
488
|
var forNodeName = props["data-plasmic-for-node"];
|
|
538
489
|
delete props["data-plasmic-name"];
|
|
539
490
|
delete props["data-plasmic-root"];
|
|
540
491
|
delete props["data-plasmic-for-node"];
|
|
541
|
-
|
|
542
492
|
for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
543
493
|
children[_key - 2] = arguments[_key];
|
|
544
494
|
}
|
|
545
|
-
|
|
546
495
|
var element = createPlasmicElementFromJsx.apply(void 0, [defaultElement, props].concat(children));
|
|
547
|
-
|
|
548
496
|
if (name) {
|
|
549
497
|
seenElements.set(name, element);
|
|
550
498
|
}
|
|
551
|
-
|
|
552
499
|
if (isRoot) {
|
|
553
500
|
var _seenElements$get;
|
|
554
|
-
|
|
555
501
|
// If this is the root, and we requested a specific node by specifying data-plasmic-for-node,
|
|
556
502
|
// then return that node instead
|
|
557
|
-
var forNode = forNodeName ? (_seenElements$get = seenElements.get(forNodeName)) != null ? _seenElements$get : null : element;
|
|
558
|
-
|
|
503
|
+
var forNode = forNodeName ? (_seenElements$get = seenElements.get(forNodeName)) != null ? _seenElements$get : null : element;
|
|
504
|
+
// Clear out the seenElements map, as we're done rendering this Plasmic* component.
|
|
559
505
|
seenElements.clear();
|
|
560
506
|
return forNode;
|
|
561
507
|
}
|
|
562
|
-
|
|
563
508
|
return element;
|
|
564
509
|
}
|
|
565
|
-
|
|
566
510
|
function createPlasmicElementFromJsx(defaultElement, props) {
|
|
567
511
|
var _props$dataPlasmicT;
|
|
568
|
-
|
|
569
512
|
var override = props["data-plasmic-override"];
|
|
570
513
|
var wrapFlexChild = props["data-plasmic-wrap-flex-child"];
|
|
571
514
|
var triggerProps = (_props$dataPlasmicT = props["data-plasmic-trigger-props"]) != null ? _props$dataPlasmicT : [];
|
|
572
515
|
delete props["data-plasmic-override"];
|
|
573
516
|
delete props["data-plasmic-wrap-flex-child"];
|
|
574
517
|
delete props["data-plasmic-trigger-props"];
|
|
575
|
-
|
|
576
518
|
for (var _len2 = arguments.length, children = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
577
519
|
children[_key2 - 2] = arguments[_key2];
|
|
578
520
|
}
|
|
579
|
-
|
|
580
521
|
return createPlasmicElement(override, defaultElement, mergeProps.apply(void 0, [props, children.length === 0 ? {} : {
|
|
581
522
|
children: children.length === 1 ? children[0] : children
|
|
582
523
|
}].concat(triggerProps)), wrapFlexChild);
|
|
583
524
|
}
|
|
584
|
-
|
|
585
525
|
function makeFragment() {
|
|
586
526
|
for (var _len3 = arguments.length, children = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
587
527
|
children[_key3] = arguments[_key3];
|
|
588
528
|
}
|
|
589
|
-
|
|
590
529
|
return React.createElement.apply(React, [React.Fragment, {}].concat(children));
|
|
591
530
|
}
|
|
592
531
|
var UNSET = /*#__PURE__*/Symbol("UNSET");
|
|
593
|
-
|
|
594
532
|
function mergeOverrideProps(defaults, overrides) {
|
|
595
533
|
if (!overrides) {
|
|
596
534
|
return defaults;
|
|
597
535
|
}
|
|
598
|
-
|
|
599
536
|
var result = _extends({}, defaults);
|
|
600
|
-
|
|
601
537
|
for (var _i = 0, _Object$keys = Object.keys(overrides); _i < _Object$keys.length; _i++) {
|
|
602
538
|
var key = _Object$keys[_i];
|
|
603
539
|
var defaultVal = defaults[key];
|
|
604
540
|
var overrideVal = overrides[key];
|
|
605
|
-
|
|
606
541
|
if (overrideVal === UNSET) {
|
|
607
542
|
delete result[key];
|
|
608
543
|
} else {
|
|
@@ -613,14 +548,11 @@ function mergeOverrideProps(defaults, overrides) {
|
|
|
613
548
|
if (overrideVal == null && key !== "className" && key !== "style" && !(key.startsWith("on") && typeof defaultVal === "function")) {
|
|
614
549
|
overrideVal = NONE;
|
|
615
550
|
}
|
|
616
|
-
|
|
617
551
|
result[key] = mergePropVals(key, defaultVal, overrideVal);
|
|
618
552
|
}
|
|
619
553
|
}
|
|
620
|
-
|
|
621
554
|
return result;
|
|
622
555
|
}
|
|
623
|
-
|
|
624
556
|
function wrapWithClassName(element, className) {
|
|
625
557
|
var key = React.isValidElement(element) ? element.key || undefined : undefined;
|
|
626
558
|
return React.createElement("div", {
|
|
@@ -631,7 +563,6 @@ function wrapWithClassName(element, className) {
|
|
|
631
563
|
}
|
|
632
564
|
}, element);
|
|
633
565
|
}
|
|
634
|
-
|
|
635
566
|
function deriveOverride(x) {
|
|
636
567
|
if (!x) {
|
|
637
568
|
// undefined Binding is an empty Binding
|
|
@@ -671,9 +602,8 @@ function deriveOverride(x) {
|
|
|
671
602
|
props: {},
|
|
672
603
|
type: "default"
|
|
673
604
|
});
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
|
|
605
|
+
}
|
|
606
|
+
// Else, assume this is just a props object.
|
|
677
607
|
return {
|
|
678
608
|
type: "default",
|
|
679
609
|
props: x
|
|
@@ -684,68 +614,53 @@ function deriveOverride(x) {
|
|
|
684
614
|
render: x
|
|
685
615
|
};
|
|
686
616
|
}
|
|
687
|
-
|
|
688
617
|
throw new Error("Unexpected override: " + x);
|
|
689
618
|
}
|
|
690
|
-
|
|
691
619
|
function mergeVariants(v1, v2) {
|
|
692
620
|
if (!v1 || !v2) {
|
|
693
621
|
return v1 || v2 || {};
|
|
694
622
|
}
|
|
695
|
-
|
|
696
623
|
return _extends({}, v1, v2);
|
|
697
624
|
}
|
|
698
|
-
|
|
699
625
|
function mergeVariantsWithStates(variants, $state, linkedStates) {
|
|
700
626
|
return _extends({}, variants, Object.fromEntries(linkedStates.map(function (_ref) {
|
|
701
627
|
var variantGroup = _ref.variantGroup,
|
|
702
|
-
|
|
628
|
+
statePath = _ref.statePath;
|
|
703
629
|
return [variantGroup, _get($state, statePath)];
|
|
704
630
|
})));
|
|
705
631
|
}
|
|
706
|
-
|
|
707
632
|
function mergeArgs(a1, a2) {
|
|
708
633
|
if (!a1 || !a2) {
|
|
709
634
|
return a1 || a2 || {};
|
|
710
635
|
}
|
|
711
|
-
|
|
712
636
|
return _extends({}, a1, a2);
|
|
713
637
|
}
|
|
714
|
-
|
|
715
638
|
function mergeFlexOverrides(o1, o2) {
|
|
716
639
|
if (!o2) {
|
|
717
640
|
return o1;
|
|
718
641
|
}
|
|
719
|
-
|
|
720
642
|
var keys = Array.from(new Set([].concat(Object.keys(o1), Object.keys(o2))));
|
|
721
643
|
var merged = {};
|
|
722
|
-
|
|
723
644
|
for (var _i2 = 0, _keys = keys; _i2 < _keys.length; _i2++) {
|
|
724
645
|
var key = _keys[_i2];
|
|
725
646
|
merged[key] = mergeFlexOverride(o1[key], o2[key]);
|
|
726
647
|
}
|
|
727
|
-
|
|
728
648
|
return merged;
|
|
729
649
|
}
|
|
730
|
-
|
|
731
650
|
function mergeFlexOverride(fo1, fo2) {
|
|
732
651
|
var _o1$props, _ref2;
|
|
733
|
-
|
|
734
652
|
if (!fo1) {
|
|
735
653
|
return fo2;
|
|
736
654
|
}
|
|
737
|
-
|
|
738
655
|
if (!fo2) {
|
|
739
656
|
return fo1;
|
|
740
657
|
}
|
|
741
|
-
|
|
742
658
|
var o1 = deriveOverride(fo1);
|
|
743
659
|
var o2 = deriveOverride(fo2);
|
|
744
660
|
var wrap = chainSingleArgFuncs.apply(void 0, [o1.wrap, o2.wrap].filter(notNil));
|
|
745
|
-
var wrapChildren = chainSingleArgFuncs.apply(void 0, [o1.wrapChildren, o2.wrapChildren].filter(notNil));
|
|
746
|
-
|
|
661
|
+
var wrapChildren = chainSingleArgFuncs.apply(void 0, [o1.wrapChildren, o2.wrapChildren].filter(notNil));
|
|
662
|
+
// "render" type always takes precedence, but we still merge the props
|
|
747
663
|
var props = mergeOverrideProps((_o1$props = o1.props) != null ? _o1$props : {}, o2.props);
|
|
748
|
-
|
|
749
664
|
if (o2.type === "render") {
|
|
750
665
|
return {
|
|
751
666
|
render: o2.render,
|
|
@@ -754,7 +669,6 @@ function mergeFlexOverride(fo1, fo2) {
|
|
|
754
669
|
wrapChildren: wrapChildren
|
|
755
670
|
};
|
|
756
671
|
}
|
|
757
|
-
|
|
758
672
|
if (o1.type === "render") {
|
|
759
673
|
return {
|
|
760
674
|
render: o1.render,
|
|
@@ -762,9 +676,8 @@ function mergeFlexOverride(fo1, fo2) {
|
|
|
762
676
|
wrap: wrap,
|
|
763
677
|
wrapChildren: wrapChildren
|
|
764
678
|
};
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
|
|
679
|
+
}
|
|
680
|
+
// "as" will take precedence
|
|
768
681
|
var as = (_ref2 = o2.type === "as" ? o2.as : undefined) != null ? _ref2 : o1.type === "as" ? o1.as : undefined;
|
|
769
682
|
return _extends({
|
|
770
683
|
props: props,
|
|
@@ -774,26 +687,22 @@ function mergeFlexOverride(fo1, fo2) {
|
|
|
774
687
|
as: as
|
|
775
688
|
} : {});
|
|
776
689
|
}
|
|
777
|
-
|
|
778
690
|
function deriveRenderOpts(props, config) {
|
|
779
691
|
var name = config.name,
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
692
|
+
descendantNames = config.descendantNames,
|
|
693
|
+
internalVariantPropNames = config.internalVariantPropNames,
|
|
694
|
+
internalArgPropNames = config.internalArgPropNames;
|
|
783
695
|
var reservedPropNames = ["variants", "args", "overrides"];
|
|
784
696
|
var variants = mergeVariants(omit.apply(void 0, [pick.apply(void 0, [props].concat(internalVariantPropNames))].concat(reservedPropNames)), props.variants);
|
|
785
697
|
var args = mergeArgs(omit.apply(void 0, [pick.apply(void 0, [props].concat(internalArgPropNames))].concat(reservedPropNames)), props.args);
|
|
786
698
|
var overrides = mergeFlexOverrides(omit.apply(void 0, [pick.apply(void 0, [props].concat(descendantNames))].concat(internalArgPropNames, internalVariantPropNames, reservedPropNames)), props.overrides);
|
|
787
699
|
var leftoverProps = omit.apply(void 0, [props, "variants", "args", "overrides"].concat(descendantNames, internalVariantPropNames, internalArgPropNames));
|
|
788
|
-
|
|
789
700
|
if (Object.keys(leftoverProps).length > 0) {
|
|
790
701
|
var _mergeFlexOverrides;
|
|
791
|
-
|
|
792
702
|
overrides = mergeFlexOverrides(overrides, (_mergeFlexOverrides = {}, _mergeFlexOverrides[name] = {
|
|
793
703
|
props: leftoverProps
|
|
794
704
|
}, _mergeFlexOverrides));
|
|
795
705
|
}
|
|
796
|
-
|
|
797
706
|
return {
|
|
798
707
|
variants: variants,
|
|
799
708
|
args: args,
|
|
@@ -804,7 +713,6 @@ function deriveRenderOpts(props, config) {
|
|
|
804
713
|
var isDefaultValue = function isDefaultValue(val) {
|
|
805
714
|
return val === "PLEASE_RENDER_INSIDE_PROVIDER";
|
|
806
715
|
};
|
|
807
|
-
|
|
808
716
|
var seenDefaultVariants = {};
|
|
809
717
|
function ensureGlobalVariants(globalVariantValues) {
|
|
810
718
|
Object.entries(globalVariantValues).filter(function (_ref) {
|
|
@@ -813,7 +721,6 @@ function ensureGlobalVariants(globalVariantValues) {
|
|
|
813
721
|
}).forEach(function (_ref2) {
|
|
814
722
|
var key = _ref2[0];
|
|
815
723
|
globalVariantValues[key] = undefined;
|
|
816
|
-
|
|
817
724
|
if (!seenDefaultVariants[key] && "development" === "development") {
|
|
818
725
|
seenDefaultVariants[key] = true;
|
|
819
726
|
var providerName = "" + key[0].toUpperCase() + key.substring(1) + "Context.Provider";
|
|
@@ -826,15 +733,13 @@ function ensureGlobalVariants(globalVariantValues) {
|
|
|
826
733
|
var PlasmicHeadContext = /*#__PURE__*/React.createContext(undefined);
|
|
827
734
|
function PlasmicHead(props) {
|
|
828
735
|
var Head = React.useContext(PlasmicHeadContext);
|
|
829
|
-
|
|
830
736
|
if (!Head) {
|
|
831
|
-
console.warn("Plasmic: Head meta tags are being ignored. To make them work, pass a Head component into PlasmicRootProvider.");
|
|
832
|
-
|
|
737
|
+
console.warn("Plasmic: Head meta tags are being ignored. To make them work, pass a Head component into PlasmicRootProvider.");
|
|
738
|
+
// TODO: Link to doc about Head.
|
|
833
739
|
return null;
|
|
834
|
-
}
|
|
740
|
+
}
|
|
741
|
+
// Helmet does not support React.Fragments, so we need to use `[<meta />,
|
|
835
742
|
// <meta />]` instead of `<><meta /><meta /></>`.
|
|
836
|
-
|
|
837
|
-
|
|
838
743
|
return React.createElement(Head, null, props.image ? [React.createElement("meta", {
|
|
839
744
|
key: "twitter:card",
|
|
840
745
|
name: "twitter:card",
|
|
@@ -910,50 +815,46 @@ var plasmicHeadMeta = {
|
|
|
910
815
|
var _excluded$1 = ["PlasmicIconType"];
|
|
911
816
|
function PlasmicIcon(props) {
|
|
912
817
|
var PlasmicIconType = props.PlasmicIconType,
|
|
913
|
-
|
|
914
|
-
|
|
818
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
915
819
|
return React.createElement(PlasmicIconType, Object.assign({}, rest));
|
|
916
820
|
}
|
|
917
821
|
|
|
918
822
|
var _excluded$2 = ["src", "className", "displayWidth", "displayHeight", "displayMinWidth", "displayMinHeight", "displayMaxWidth", "displayMaxHeight", "quality", "loader", "imgRef", "style", "loading"];
|
|
823
|
+
// Default image sizes to snap to
|
|
919
824
|
// TODO: make this configurable?
|
|
920
|
-
|
|
921
825
|
var IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
922
826
|
var DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
923
827
|
var ALL_SIZES = /*#__PURE__*/[].concat(IMG_SIZES, DEVICE_SIZES);
|
|
924
828
|
var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(props, outerRef) {
|
|
925
829
|
var src = props.src,
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
830
|
+
className = props.className,
|
|
831
|
+
displayWidth = props.displayWidth,
|
|
832
|
+
displayHeight = props.displayHeight,
|
|
833
|
+
displayMinWidth = props.displayMinWidth,
|
|
834
|
+
displayMinHeight = props.displayMinHeight,
|
|
835
|
+
displayMaxWidth = props.displayMaxWidth,
|
|
836
|
+
displayMaxHeight = props.displayMaxHeight,
|
|
837
|
+
quality = props.quality,
|
|
838
|
+
loader = props.loader,
|
|
839
|
+
imgRef = props.imgRef,
|
|
840
|
+
style = props.style,
|
|
841
|
+
loading = props.loading,
|
|
842
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
940
843
|
var imgProps = Object.assign({}, rest, {
|
|
941
844
|
// Default loading to "lazy" if not specified (which is different from the
|
|
942
845
|
// html img, which defaults to eager!)
|
|
943
846
|
loading: loading != null ? loading : "lazy"
|
|
944
847
|
});
|
|
945
|
-
|
|
946
848
|
var _ref = typeof src === "string" || !src ? {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
849
|
+
fullWidth: undefined,
|
|
850
|
+
fullHeight: undefined,
|
|
851
|
+
aspectRatio: undefined
|
|
852
|
+
} : src,
|
|
853
|
+
fullWidth = _ref.fullWidth,
|
|
854
|
+
fullHeight = _ref.fullHeight,
|
|
855
|
+
aspectRatio = _ref.aspectRatio;
|
|
856
|
+
var srcStr = src ? typeof src === "string" ? src : typeof src.src === "string" ? src.src : src.src.src : "";
|
|
857
|
+
// Assume external image if either dimension is null and use usual <img>
|
|
957
858
|
if (fullHeight == null || fullWidth == null) {
|
|
958
859
|
return React__default.createElement("img", Object.assign({
|
|
959
860
|
src: srcStr,
|
|
@@ -964,13 +865,10 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
964
865
|
ref: mergeRefs(imgRef, outerRef)
|
|
965
866
|
}));
|
|
966
867
|
}
|
|
967
|
-
|
|
968
868
|
if (isSvg(srcStr) && (displayHeight == null || displayHeight === "auto") && (displayWidth == null || displayWidth === "auto")) {
|
|
969
869
|
displayWidth = "100%";
|
|
970
870
|
}
|
|
971
|
-
|
|
972
871
|
var computedDisplayWidth = displayWidth;
|
|
973
|
-
|
|
974
872
|
if (fullWidth && fullHeight && (!displayWidth || displayWidth === "auto") && !!getPixelLength(displayHeight)) {
|
|
975
873
|
// If there's a pixel length specified for displayHeight but not displayWidth,
|
|
976
874
|
// then we can derive the pixel length for displayWidth. Having an explicit
|
|
@@ -983,10 +881,8 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
983
881
|
computedDisplayWidth = getPixelLength(displayHeight) * fullWidth / fullHeight;
|
|
984
882
|
}
|
|
985
883
|
}
|
|
986
|
-
|
|
987
884
|
var spacerWidth = fullWidth;
|
|
988
885
|
var spacerHeight = fullHeight;
|
|
989
|
-
|
|
990
886
|
if (aspectRatio && isFinite(aspectRatio) && isSvg(srcStr)) {
|
|
991
887
|
// For SVGs, fullWidth and fullHeight can be rounded values, which would
|
|
992
888
|
// cause some discrepancy between the actual aspect ratio and the aspect
|
|
@@ -995,25 +891,21 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
995
891
|
spacerWidth = DEFAULT_SVG_WIDTH;
|
|
996
892
|
spacerHeight = Math.round(spacerWidth / aspectRatio);
|
|
997
893
|
}
|
|
998
|
-
|
|
999
894
|
var _getWidths = getWidths(computedDisplayWidth, fullWidth, {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
895
|
+
minWidth: displayMinWidth
|
|
896
|
+
}),
|
|
897
|
+
sizes = _getWidths.sizes,
|
|
898
|
+
widthDescs = _getWidths.widthDescs;
|
|
1005
899
|
var imageLoader = getImageLoader(loader);
|
|
1006
900
|
var spacerSvg = "<svg width=\"" + spacerWidth + "\" height=\"" + spacerHeight + "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>";
|
|
1007
901
|
var spacerSvgBase64 = typeof window === "undefined" ? Buffer.from(spacerSvg).toString("base64") : window.btoa(spacerSvg);
|
|
1008
|
-
|
|
1009
902
|
var wrapperStyle = _extends({}, style || {});
|
|
1010
|
-
|
|
1011
903
|
var spacerStyle = _extends({}, pick(style || {}, "objectFit", "objectPosition"));
|
|
1012
|
-
|
|
1013
904
|
if (displayWidth != null && displayWidth !== "auto") {
|
|
1014
905
|
// If width is set, set it on the wrapper along with min/max width
|
|
1015
906
|
// and just use `width: 100%` on the spacer
|
|
1016
|
-
spacerStyle.width = "100%";
|
|
907
|
+
spacerStyle.width = "100%";
|
|
908
|
+
// Rely on the styles set by `classname` on the wrapper:
|
|
1017
909
|
// wrapperStyle.width = displayWidth;
|
|
1018
910
|
// wrapperStyle.minWidth = displayMinWidth;
|
|
1019
911
|
// wrapperStyle.maxWidth = displayMaxWidth;
|
|
@@ -1027,32 +919,35 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
1027
919
|
// than it should.
|
|
1028
920
|
spacerStyle.width = displayWidth;
|
|
1029
921
|
wrapperStyle.width = "auto";
|
|
1030
|
-
|
|
1031
922
|
if (displayMinWidth) {
|
|
1032
|
-
spacerStyle.minWidth = "100%";
|
|
923
|
+
spacerStyle.minWidth = "100%";
|
|
924
|
+
// Rely on min-width set by `classname` on the wrapper:
|
|
1033
925
|
// wrapperStyle.minWidth = displayMinWidth;
|
|
1034
926
|
}
|
|
1035
927
|
|
|
1036
928
|
if (displayMaxWidth != null && displayMaxWidth !== "none") {
|
|
1037
|
-
spacerStyle.maxWidth = "100%";
|
|
929
|
+
spacerStyle.maxWidth = "100%";
|
|
930
|
+
// Rely on max-width set by `classname` on the wrapper:
|
|
1038
931
|
// wrapperStyle.maxWidth = displayMaxWidth;
|
|
1039
932
|
}
|
|
1040
933
|
}
|
|
1041
934
|
|
|
1042
935
|
if (displayHeight != null && displayHeight !== "auto") {
|
|
1043
|
-
spacerStyle.height = "100%";
|
|
936
|
+
spacerStyle.height = "100%";
|
|
937
|
+
// wrapperStyle.height = displayHeight;
|
|
1044
938
|
// wrapperStyle.minHeight = displayMinHeight;
|
|
1045
939
|
// wrapperStyle.maxHeight = displayMaxHeight;
|
|
1046
940
|
} else {
|
|
1047
941
|
spacerStyle.height = displayHeight;
|
|
1048
942
|
wrapperStyle.height = "auto";
|
|
1049
|
-
|
|
1050
943
|
if (displayMinHeight) {
|
|
1051
|
-
spacerStyle.minHeight = "100%";
|
|
944
|
+
spacerStyle.minHeight = "100%";
|
|
945
|
+
// wrapperStyle.minHeight = displayMinHeight;
|
|
1052
946
|
}
|
|
1053
947
|
|
|
1054
948
|
if (displayMaxHeight != null && displayMaxHeight !== "none") {
|
|
1055
|
-
spacerStyle.maxHeight = "100%";
|
|
949
|
+
spacerStyle.maxHeight = "100%";
|
|
950
|
+
// wrapperStyle.maxHeight = displayMaxHeight;
|
|
1056
951
|
}
|
|
1057
952
|
}
|
|
1058
953
|
|
|
@@ -1078,20 +973,19 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
1078
973
|
className: "__wab_img"
|
|
1079
974
|
}));
|
|
1080
975
|
});
|
|
1081
|
-
|
|
1082
976
|
function makePicture(opts) {
|
|
1083
977
|
// If imageLoader is undefined, then this renders to just a normal
|
|
1084
978
|
// <img />. Else it will render to a <picture> with a <source> for
|
|
1085
979
|
// webp, and srcSet/sizes set according to width requirements.
|
|
1086
980
|
var imageLoader = opts.imageLoader,
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
981
|
+
widthDescs = opts.widthDescs,
|
|
982
|
+
src = opts.src,
|
|
983
|
+
quality = opts.quality,
|
|
984
|
+
style = opts.style,
|
|
985
|
+
className = opts.className,
|
|
986
|
+
sizes = opts.sizes,
|
|
987
|
+
imgProps = opts.imgProps,
|
|
988
|
+
ref = opts.ref;
|
|
1095
989
|
return React__default.createElement("picture", {
|
|
1096
990
|
className: "__wab_picture"
|
|
1097
991
|
}, imageLoader && imageLoader.supportsUrl(src) && React__default.createElement("source", {
|
|
@@ -1127,21 +1021,16 @@ function makePicture(opts) {
|
|
|
1127
1021
|
})
|
|
1128
1022
|
})));
|
|
1129
1023
|
}
|
|
1130
|
-
|
|
1131
1024
|
var DEFAULT_SVG_WIDTH = 10000;
|
|
1132
|
-
|
|
1133
1025
|
function isSvg(src) {
|
|
1134
1026
|
return src.endsWith(".svg") || src.startsWith("data:image/svg");
|
|
1135
1027
|
}
|
|
1136
|
-
|
|
1137
1028
|
function getClosestPresetSize(width, fullWidth) {
|
|
1138
1029
|
var _ALL_SIZES$findIndex;
|
|
1139
|
-
|
|
1140
1030
|
var nextBiggerIndex = (_ALL_SIZES$findIndex = ALL_SIZES.findIndex(function (w) {
|
|
1141
1031
|
return w >= width;
|
|
1142
1032
|
})) != null ? _ALL_SIZES$findIndex : ALL_SIZES.length - 1;
|
|
1143
1033
|
var nextBigger = ALL_SIZES[nextBiggerIndex];
|
|
1144
|
-
|
|
1145
1034
|
if (nextBigger >= fullWidth) {
|
|
1146
1035
|
// If the requested width is larger than the fullWidth,
|
|
1147
1036
|
// we just use the original width instead. It's impossible
|
|
@@ -1154,19 +1043,15 @@ function getClosestPresetSize(width, fullWidth) {
|
|
|
1154
1043
|
// less than 48)
|
|
1155
1044
|
return undefined;
|
|
1156
1045
|
}
|
|
1157
|
-
|
|
1158
1046
|
return nextBigger;
|
|
1159
1047
|
}
|
|
1160
1048
|
/**
|
|
1161
1049
|
* Computes the appropriate srcSet and sizes to use
|
|
1162
1050
|
*/
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
1051
|
function getWidths(width, fullWidth, extra) {
|
|
1166
1052
|
var minWidth = extra == null ? void 0 : extra.minWidth;
|
|
1167
1053
|
var pixelWidth = getPixelLength(width);
|
|
1168
1054
|
var pixelMinWidth = getPixelLength(minWidth);
|
|
1169
|
-
|
|
1170
1055
|
if (pixelWidth != null && (!minWidth || pixelMinWidth != null)) {
|
|
1171
1056
|
// If there's an exact width, then we just need to display it at 1x and 2x density
|
|
1172
1057
|
return {
|
|
@@ -1179,14 +1064,12 @@ function getWidths(width, fullWidth, extra) {
|
|
|
1179
1064
|
}],
|
|
1180
1065
|
sizes: undefined
|
|
1181
1066
|
};
|
|
1182
|
-
}
|
|
1067
|
+
}
|
|
1068
|
+
// Otherwise we don't know what sizes we'll end up, so we just cap it at
|
|
1183
1069
|
// device width. TODO: do better!
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
1070
|
var usefulSizes = DEVICE_SIZES.filter(function (size) {
|
|
1187
1071
|
return !fullWidth || size < fullWidth;
|
|
1188
1072
|
});
|
|
1189
|
-
|
|
1190
1073
|
if (!!fullWidth && usefulSizes.length === 0) {
|
|
1191
1074
|
// image fullWidth is smaller than all device sizes. So all we can do
|
|
1192
1075
|
// is offer 1x
|
|
@@ -1198,7 +1081,6 @@ function getWidths(width, fullWidth, extra) {
|
|
|
1198
1081
|
sizes: undefined
|
|
1199
1082
|
};
|
|
1200
1083
|
}
|
|
1201
|
-
|
|
1202
1084
|
return {
|
|
1203
1085
|
widthDescs: usefulSizes.map(function (size) {
|
|
1204
1086
|
return {
|
|
@@ -1219,33 +1101,25 @@ function getWidths(width, fullWidth, extra) {
|
|
|
1219
1101
|
sizes: "100vw"
|
|
1220
1102
|
};
|
|
1221
1103
|
}
|
|
1222
|
-
|
|
1223
1104
|
function getPixelLength(length) {
|
|
1224
1105
|
if (length == null || length == "") {
|
|
1225
1106
|
return undefined;
|
|
1226
1107
|
}
|
|
1227
|
-
|
|
1228
1108
|
if (typeof length === "number") {
|
|
1229
1109
|
return length;
|
|
1230
1110
|
}
|
|
1231
|
-
|
|
1232
1111
|
var parsed = parseNumeric(length);
|
|
1233
|
-
|
|
1234
1112
|
if (parsed && (!parsed.units || parsed.units === "px")) {
|
|
1235
1113
|
return parsed.num;
|
|
1236
1114
|
}
|
|
1237
|
-
|
|
1238
1115
|
return undefined;
|
|
1239
1116
|
}
|
|
1240
|
-
|
|
1241
1117
|
function parseNumeric(val) {
|
|
1242
1118
|
// Parse strings like "30", "30px", "30%", "30px /* blah blah */"
|
|
1243
1119
|
var res = val.match(/^\s*(-?(?:\d+\.\d*|\d*\.\d+|\d+))\s*([a-z]*|%)\s*(?:\/\*.*)?$/i);
|
|
1244
|
-
|
|
1245
1120
|
if (res == null) {
|
|
1246
1121
|
return undefined;
|
|
1247
1122
|
}
|
|
1248
|
-
|
|
1249
1123
|
var num = res[1];
|
|
1250
1124
|
var units = res[2];
|
|
1251
1125
|
return {
|
|
@@ -1253,7 +1127,6 @@ function parseNumeric(val) {
|
|
|
1253
1127
|
units: units
|
|
1254
1128
|
};
|
|
1255
1129
|
}
|
|
1256
|
-
|
|
1257
1130
|
function getImageLoader(loader) {
|
|
1258
1131
|
if (loader == null) {
|
|
1259
1132
|
return undefined;
|
|
@@ -1263,14 +1136,12 @@ function getImageLoader(loader) {
|
|
|
1263
1136
|
return loader;
|
|
1264
1137
|
}
|
|
1265
1138
|
}
|
|
1266
|
-
|
|
1267
1139
|
var PLASMIC_IMAGE_LOADER = {
|
|
1268
1140
|
supportsUrl: function supportsUrl(src) {
|
|
1269
1141
|
return src.startsWith("https://img.plasmic.app") && !isSvg(src);
|
|
1270
1142
|
},
|
|
1271
1143
|
transformUrl: function transformUrl(opts) {
|
|
1272
1144
|
var _opts$quality;
|
|
1273
|
-
|
|
1274
1145
|
var params = [opts.width ? "w=" + opts.width : undefined, "q=" + ((_opts$quality = opts.quality) != null ? _opts$quality : 75), opts.format ? "f=" + opts.format : undefined].filter(function (x) {
|
|
1275
1146
|
return !!x;
|
|
1276
1147
|
});
|
|
@@ -1289,46 +1160,37 @@ var PlasmicLink = /*#__PURE__*/React__default.forwardRef(function PlasmicLink(pr
|
|
|
1289
1160
|
ref: ref
|
|
1290
1161
|
})));
|
|
1291
1162
|
}
|
|
1292
|
-
|
|
1293
1163
|
if (props.platform === "gatsby" && isInternalHref(props.href)) {
|
|
1294
1164
|
return React__default.createElement(props.component, _extends({}, omit(props, "component", "platform", "href"), {
|
|
1295
1165
|
to: props.href,
|
|
1296
1166
|
ref: ref
|
|
1297
1167
|
}));
|
|
1298
1168
|
}
|
|
1299
|
-
|
|
1300
1169
|
return React__default.createElement("a", Object.assign({}, omit(props, "component", "platform"), {
|
|
1301
1170
|
ref: ref
|
|
1302
1171
|
}));
|
|
1303
1172
|
});
|
|
1304
|
-
|
|
1305
1173
|
function isInternalHref(href) {
|
|
1306
1174
|
return /^\/(?!\/)/.test(href);
|
|
1307
1175
|
}
|
|
1308
1176
|
|
|
1309
1177
|
var PlasmicTranslatorContext = /*#__PURE__*/React__default.createContext(undefined);
|
|
1310
|
-
|
|
1311
1178
|
function isIterable(val) {
|
|
1312
1179
|
return val != null && typeof val[Symbol.iterator] === "function";
|
|
1313
1180
|
}
|
|
1314
|
-
|
|
1315
1181
|
function genTranslatableString(elt) {
|
|
1316
1182
|
var components = {};
|
|
1317
1183
|
var componentsCount = 0;
|
|
1318
|
-
|
|
1319
1184
|
var getText = function getText(node) {
|
|
1320
1185
|
if (!node) {
|
|
1321
1186
|
return "";
|
|
1322
1187
|
}
|
|
1323
|
-
|
|
1324
1188
|
if (typeof node === "number" || typeof node === "boolean" || typeof node === "string") {
|
|
1325
1189
|
return node.toString();
|
|
1326
1190
|
}
|
|
1327
|
-
|
|
1328
1191
|
if (typeof node !== "object") {
|
|
1329
1192
|
return "";
|
|
1330
1193
|
}
|
|
1331
|
-
|
|
1332
1194
|
if (Array.isArray(node) || isIterable(node)) {
|
|
1333
1195
|
return Array.from(node).map(function (child) {
|
|
1334
1196
|
return getText(child);
|
|
@@ -1336,18 +1198,15 @@ function genTranslatableString(elt) {
|
|
|
1336
1198
|
return !!child;
|
|
1337
1199
|
}).join("");
|
|
1338
1200
|
}
|
|
1339
|
-
|
|
1340
1201
|
var nodeChildren = hasKey(node, "props") && hasKey(node.props, "children") && node.props.children || hasKey(node, "children") && node.children || [];
|
|
1341
1202
|
var contents = "" + React__default.Children.toArray(nodeChildren).map(function (child) {
|
|
1342
1203
|
return getText(child);
|
|
1343
1204
|
}).filter(function (child) {
|
|
1344
1205
|
return !!child;
|
|
1345
1206
|
}).join("");
|
|
1346
|
-
|
|
1347
1207
|
if (React__default.isValidElement(node) && node.type === React__default.Fragment) {
|
|
1348
1208
|
return contents;
|
|
1349
1209
|
}
|
|
1350
|
-
|
|
1351
1210
|
var componentId = componentsCount + 1;
|
|
1352
1211
|
componentsCount++;
|
|
1353
1212
|
components[componentId] = React__default.isValidElement(node) ? React__default.cloneElement(node, {
|
|
@@ -1356,7 +1215,6 @@ function genTranslatableString(elt) {
|
|
|
1356
1215
|
}) : node;
|
|
1357
1216
|
return "<" + componentId + ">" + contents + "</" + componentId + ">";
|
|
1358
1217
|
};
|
|
1359
|
-
|
|
1360
1218
|
var str = getText(elt);
|
|
1361
1219
|
return {
|
|
1362
1220
|
str: str,
|
|
@@ -1365,33 +1223,28 @@ function genTranslatableString(elt) {
|
|
|
1365
1223
|
};
|
|
1366
1224
|
}
|
|
1367
1225
|
function Trans(_ref) {
|
|
1368
|
-
var
|
|
1369
|
-
|
|
1226
|
+
var transKey = _ref.transKey,
|
|
1227
|
+
children = _ref.children;
|
|
1370
1228
|
var _t = React__default.useContext(PlasmicTranslatorContext);
|
|
1371
|
-
|
|
1372
1229
|
if (!_t) {
|
|
1373
1230
|
warnNoTranslationFunctionAtMostOnce();
|
|
1374
1231
|
return children;
|
|
1375
1232
|
}
|
|
1376
|
-
|
|
1377
1233
|
var _genTranslatableStrin = genTranslatableString(children),
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
return _t(str, componentsCount > 0 ? {
|
|
1234
|
+
str = _genTranslatableStrin.str,
|
|
1235
|
+
components = _genTranslatableStrin.components,
|
|
1236
|
+
componentsCount = _genTranslatableStrin.componentsCount;
|
|
1237
|
+
return _t(transKey != null ? transKey : str, componentsCount > 0 ? {
|
|
1383
1238
|
components: components
|
|
1384
1239
|
} : undefined);
|
|
1385
1240
|
}
|
|
1386
1241
|
var hasWarned = false;
|
|
1387
|
-
|
|
1388
1242
|
function warnNoTranslationFunctionAtMostOnce() {
|
|
1389
1243
|
if (!hasWarned) {
|
|
1390
1244
|
console.warn("Using Plasmic Translation but no translation function has been provided");
|
|
1391
1245
|
hasWarned = true;
|
|
1392
1246
|
}
|
|
1393
1247
|
}
|
|
1394
|
-
|
|
1395
1248
|
function hasKey(v, key) {
|
|
1396
1249
|
return typeof v === "object" && v !== null && key in v;
|
|
1397
1250
|
}
|
|
@@ -1402,68 +1255,56 @@ function PlasmicSlot(props) {
|
|
|
1402
1255
|
}
|
|
1403
1256
|
function renderPlasmicSlot(opts) {
|
|
1404
1257
|
var as = opts.as,
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1258
|
+
defaultContents = opts.defaultContents,
|
|
1259
|
+
value = opts.value,
|
|
1260
|
+
rest = _objectWithoutPropertiesLoose(opts, _excluded$3);
|
|
1409
1261
|
var content = value === undefined ? defaultContents : value;
|
|
1410
|
-
|
|
1411
1262
|
if (!content || Array.isArray(content) && content.length === 0) {
|
|
1412
1263
|
return null;
|
|
1413
|
-
}
|
|
1264
|
+
}
|
|
1265
|
+
// If the content is a raw string, then we need to wrap the raw string
|
|
1414
1266
|
// into an element, in case the slot is inside a flex-gap
|
|
1415
1267
|
// container (you cannot apply margin to just a text node).
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
1268
|
var maybeString = maybeAsString(content);
|
|
1419
|
-
|
|
1420
1269
|
if (maybeString) {
|
|
1421
1270
|
content = React.createElement("span", {
|
|
1422
1271
|
className: "__wab_slot-string-wrapper"
|
|
1423
1272
|
}, maybeString);
|
|
1424
1273
|
}
|
|
1425
|
-
|
|
1426
1274
|
var nonEmptyProps = Object.keys(rest).filter(function (p) {
|
|
1427
1275
|
return !!rest[p];
|
|
1428
1276
|
});
|
|
1429
|
-
|
|
1430
1277
|
if (nonEmptyProps.length === 0) {
|
|
1431
1278
|
// No attrs to apply to the slot (which means the slot is unstyled), then
|
|
1432
1279
|
// just render the content directly; no need for style wrapper.
|
|
1433
1280
|
return React.createElement(React.Fragment, null, content);
|
|
1434
1281
|
}
|
|
1435
|
-
|
|
1436
1282
|
return React.createElement(as || "span", mergeProps({
|
|
1437
1283
|
className: "__wab_slot"
|
|
1438
1284
|
}, rest), content);
|
|
1439
1285
|
}
|
|
1440
|
-
|
|
1441
1286
|
function maybeAsString(node) {
|
|
1442
1287
|
// Unwrap fragments
|
|
1443
|
-
if (React.isValidElement(node) && (
|
|
1288
|
+
if (React.isValidElement(node) && (
|
|
1289
|
+
// Fragment and Trans don't render DOM elements
|
|
1444
1290
|
node.type === React.Fragment || node.type === Trans)) {
|
|
1445
1291
|
return maybeAsString(node.props.children);
|
|
1446
1292
|
}
|
|
1447
|
-
|
|
1448
1293
|
if (typeof node === "string") {
|
|
1449
1294
|
return node;
|
|
1450
1295
|
}
|
|
1451
|
-
|
|
1452
1296
|
if (Array.isArray(node) && node.length === 1 && typeof node[0] === "string") {
|
|
1453
1297
|
return node[0];
|
|
1454
1298
|
}
|
|
1455
|
-
|
|
1456
1299
|
return undefined;
|
|
1457
1300
|
}
|
|
1458
1301
|
|
|
1459
1302
|
var listeners = [];
|
|
1460
1303
|
var queries = {};
|
|
1461
|
-
|
|
1462
1304
|
function matchScreenVariants() {
|
|
1463
1305
|
if (!isBrowser) {
|
|
1464
1306
|
return [];
|
|
1465
1307
|
}
|
|
1466
|
-
|
|
1467
1308
|
return Object.entries(queries).filter(function (_ref) {
|
|
1468
1309
|
var query = _ref[1];
|
|
1469
1310
|
return window.matchMedia(query).matches;
|
|
@@ -1471,14 +1312,11 @@ function matchScreenVariants() {
|
|
|
1471
1312
|
var name = _ref2[0];
|
|
1472
1313
|
return name;
|
|
1473
1314
|
});
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
|
|
1315
|
+
}
|
|
1316
|
+
// undefined if screen variants have never been calculated
|
|
1477
1317
|
var curScreenVariants = undefined;
|
|
1478
|
-
|
|
1479
1318
|
function recalculateScreenVariants() {
|
|
1480
1319
|
var screenVariant = matchScreenVariants();
|
|
1481
|
-
|
|
1482
1320
|
if (!curScreenVariants || screenVariant.join("") !== curScreenVariants.join("")) {
|
|
1483
1321
|
curScreenVariants = screenVariant;
|
|
1484
1322
|
ReactDOM__default.unstable_batchedUpdates(function () {
|
|
@@ -1488,7 +1326,6 @@ function recalculateScreenVariants() {
|
|
|
1488
1326
|
});
|
|
1489
1327
|
}
|
|
1490
1328
|
}
|
|
1491
|
-
|
|
1492
1329
|
function ensureInitCurScreenVariants() {
|
|
1493
1330
|
// Initializes curScreenVariants if it hadn't been before. Note that this must
|
|
1494
1331
|
// be called from within an effect.
|
|
@@ -1496,11 +1333,9 @@ function ensureInitCurScreenVariants() {
|
|
|
1496
1333
|
curScreenVariants = matchScreenVariants();
|
|
1497
1334
|
}
|
|
1498
1335
|
}
|
|
1499
|
-
|
|
1500
1336
|
if (isBrowser) {
|
|
1501
1337
|
window.addEventListener("resize", recalculateScreenVariants);
|
|
1502
1338
|
}
|
|
1503
|
-
|
|
1504
1339
|
function createUseScreenVariants(isMulti, screenQueries) {
|
|
1505
1340
|
Object.assign(queries, screenQueries);
|
|
1506
1341
|
curScreenVariants = undefined;
|
|
@@ -1510,38 +1345,35 @@ function createUseScreenVariants(isMulti, screenQueries) {
|
|
|
1510
1345
|
// only happens on the client), we then actually ask for the real screen variant
|
|
1511
1346
|
// and, if different from [] or undefined, forces a re-render.
|
|
1512
1347
|
var _React$useState = React.useState(),
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1348
|
+
updateState = _React$useState[1];
|
|
1349
|
+
var lastScreenVariantsRef = React.useRef(curScreenVariants || []);
|
|
1350
|
+
// We do useLayoutEffect instead of useEffect to immediately
|
|
1516
1351
|
// register our forceUpdate. This ensures that if there was
|
|
1517
1352
|
// a window resize event between render and effects, that the
|
|
1518
1353
|
// listener will be registered in time
|
|
1519
|
-
|
|
1520
1354
|
useIsomorphicLayoutEffect(function () {
|
|
1521
1355
|
var updateIfChanged = function updateIfChanged() {
|
|
1522
1356
|
if (curScreenVariants && lastScreenVariantsRef.current.join("") !== curScreenVariants.join("")) {
|
|
1523
|
-
lastScreenVariantsRef.current = curScreenVariants;
|
|
1524
|
-
|
|
1357
|
+
lastScreenVariantsRef.current = curScreenVariants;
|
|
1358
|
+
// Force update
|
|
1525
1359
|
updateState({});
|
|
1526
1360
|
}
|
|
1527
|
-
};
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1361
|
+
};
|
|
1362
|
+
// Listeners are invoked whenever the window is resized
|
|
1363
|
+
listeners.push(updateIfChanged);
|
|
1364
|
+
// Initialize the curScreenVariants for the first time. We don't need
|
|
1531
1365
|
// to invoke the listeners here because all components will already
|
|
1532
1366
|
// have this effect running and will re-render if the real screen
|
|
1533
1367
|
// variant is non-empty.
|
|
1534
|
-
|
|
1535
|
-
|
|
1368
|
+
ensureInitCurScreenVariants();
|
|
1369
|
+
// Now, if the curScreenVariants differs from what we returned last,
|
|
1536
1370
|
// then force a re-render.
|
|
1537
|
-
|
|
1538
1371
|
updateIfChanged();
|
|
1539
1372
|
return function () {
|
|
1540
1373
|
// Remove our listener on unmount
|
|
1541
1374
|
listeners.splice(listeners.indexOf(updateIfChanged), 1);
|
|
1542
1375
|
};
|
|
1543
1376
|
}, []);
|
|
1544
|
-
|
|
1545
1377
|
if (isMulti) {
|
|
1546
1378
|
return curScreenVariants || [];
|
|
1547
1379
|
} else if (curScreenVariants) {
|
|
@@ -1555,9 +1387,10 @@ function createUseScreenVariants(isMulti, screenQueries) {
|
|
|
1555
1387
|
var PlasmicRootContext = /*#__PURE__*/React.createContext(undefined);
|
|
1556
1388
|
function PlasmicRootProvider(props) {
|
|
1557
1389
|
var platform = props.platform,
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1390
|
+
children = props.children,
|
|
1391
|
+
userAuthToken = props.userAuthToken,
|
|
1392
|
+
isUserLoading = props.isUserLoading,
|
|
1393
|
+
user = props.user;
|
|
1561
1394
|
var context = React.useMemo(function () {
|
|
1562
1395
|
return {
|
|
1563
1396
|
platform: platform
|
|
@@ -1566,9 +1399,10 @@ function PlasmicRootProvider(props) {
|
|
|
1566
1399
|
var dataSourceContextValue = React.useMemo(function () {
|
|
1567
1400
|
return {
|
|
1568
1401
|
userAuthToken: userAuthToken,
|
|
1569
|
-
user: user
|
|
1402
|
+
user: user,
|
|
1403
|
+
isUserLoading: isUserLoading
|
|
1570
1404
|
};
|
|
1571
|
-
}, [userAuthToken, user]);
|
|
1405
|
+
}, [userAuthToken, isUserLoading, user]);
|
|
1572
1406
|
return React.createElement(PlasmicRootContext.Provider, {
|
|
1573
1407
|
value: context
|
|
1574
1408
|
}, React.createElement(ssr.SSRProvider, null, React.createElement(dataSourcesContext.PlasmicDataSourceContextProvider, {
|
|
@@ -1587,67 +1421,55 @@ var hasWarnedSSR = false;
|
|
|
1587
1421
|
/**
|
|
1588
1422
|
* Warns the user if PlasmicRootProvider is not used
|
|
1589
1423
|
*/
|
|
1590
|
-
|
|
1591
1424
|
function useEnsureSSRProvider() {
|
|
1592
1425
|
var hasRoot = useHasPlasmicRoot();
|
|
1593
|
-
|
|
1594
1426
|
if (hasRoot || hasWarnedSSR || "development" !== "development") {
|
|
1595
1427
|
return;
|
|
1596
1428
|
}
|
|
1597
|
-
|
|
1598
1429
|
hasWarnedSSR = true;
|
|
1599
1430
|
console.warn("Plasmic: To ensure your components work correctly with server-side rendering, please use PlasmicRootProvider at the root of your application. See https://docs.plasmic.app/learn/ssr");
|
|
1600
1431
|
}
|
|
1601
1432
|
|
|
1602
1433
|
function useFocused(opts) {
|
|
1603
1434
|
var _useAriaFocusRing = focus.useFocusRing({
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1435
|
+
within: false,
|
|
1436
|
+
isTextInput: opts.isTextInput
|
|
1437
|
+
}),
|
|
1438
|
+
isFocused = _useAriaFocusRing.isFocused,
|
|
1439
|
+
focusProps = _useAriaFocusRing.focusProps;
|
|
1610
1440
|
return [isFocused, focusProps];
|
|
1611
1441
|
}
|
|
1612
|
-
|
|
1613
1442
|
function useFocusVisible(opts) {
|
|
1614
1443
|
var _useAriaFocusRing2 = focus.useFocusRing({
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1444
|
+
within: false,
|
|
1445
|
+
isTextInput: opts.isTextInput
|
|
1446
|
+
}),
|
|
1447
|
+
isFocusVisible = _useAriaFocusRing2.isFocusVisible,
|
|
1448
|
+
focusProps = _useAriaFocusRing2.focusProps;
|
|
1621
1449
|
return [isFocusVisible, focusProps];
|
|
1622
1450
|
}
|
|
1623
|
-
|
|
1624
1451
|
function useFocusedWithin(opts) {
|
|
1625
1452
|
var _useAriaFocusRing3 = focus.useFocusRing({
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1453
|
+
within: true,
|
|
1454
|
+
isTextInput: opts.isTextInput
|
|
1455
|
+
}),
|
|
1456
|
+
isFocused = _useAriaFocusRing3.isFocused,
|
|
1457
|
+
focusProps = _useAriaFocusRing3.focusProps;
|
|
1632
1458
|
return [isFocused, focusProps];
|
|
1633
1459
|
}
|
|
1634
|
-
|
|
1635
1460
|
function useFocusVisibleWithin(opts) {
|
|
1636
1461
|
var _useAriaFocusRing4 = focus.useFocusRing({
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1462
|
+
within: true,
|
|
1463
|
+
isTextInput: opts.isTextInput
|
|
1464
|
+
}),
|
|
1465
|
+
isFocusVisible = _useAriaFocusRing4.isFocusVisible,
|
|
1466
|
+
focusProps = _useAriaFocusRing4.focusProps;
|
|
1643
1467
|
return [isFocusVisible, focusProps];
|
|
1644
1468
|
}
|
|
1645
|
-
|
|
1646
1469
|
function useHover() {
|
|
1647
1470
|
var _React$useState = React.useState(false),
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1471
|
+
isHover = _React$useState[0],
|
|
1472
|
+
setHover = _React$useState[1];
|
|
1651
1473
|
return [isHover, {
|
|
1652
1474
|
onMouseEnter: function onMouseEnter() {
|
|
1653
1475
|
return setHover(true);
|
|
@@ -1657,12 +1479,10 @@ function useHover() {
|
|
|
1657
1479
|
}
|
|
1658
1480
|
}];
|
|
1659
1481
|
}
|
|
1660
|
-
|
|
1661
1482
|
function usePressed() {
|
|
1662
1483
|
var _React$useState2 = React.useState(false),
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1484
|
+
isPressed = _React$useState2[0],
|
|
1485
|
+
setPressed = _React$useState2[1];
|
|
1666
1486
|
return [isPressed, {
|
|
1667
1487
|
onMouseDown: function onMouseDown() {
|
|
1668
1488
|
return setPressed(true);
|
|
@@ -1672,7 +1492,6 @@ function usePressed() {
|
|
|
1672
1492
|
}
|
|
1673
1493
|
}];
|
|
1674
1494
|
}
|
|
1675
|
-
|
|
1676
1495
|
var TRIGGER_TO_HOOK = {
|
|
1677
1496
|
useHover: useHover,
|
|
1678
1497
|
useFocused: useFocused,
|
|
@@ -1685,7 +1504,6 @@ var TRIGGER_TO_HOOK = {
|
|
|
1685
1504
|
* Installs argment trigger. All the useTrigger calls must use hardcoded `trigger` arg,
|
|
1686
1505
|
* as it's not valid to install variable React hooks!
|
|
1687
1506
|
*/
|
|
1688
|
-
|
|
1689
1507
|
function useTrigger(trigger, opts) {
|
|
1690
1508
|
return TRIGGER_TO_HOOK[trigger](opts);
|
|
1691
1509
|
}
|
|
@@ -1701,111 +1519,159 @@ function generateStateOnChangeProp($state, stateName, dataReps) {
|
|
|
1701
1519
|
* - parent[][].counter[].count
|
|
1702
1520
|
* We need to pass `parent[index1][index2].counter to the child component
|
|
1703
1521
|
*/
|
|
1704
|
-
|
|
1705
1522
|
function generateStateValueProp($state, path // ["parent", 0, 1, "counter"]
|
|
1706
1523
|
) {
|
|
1707
1524
|
return _get($state, path);
|
|
1708
1525
|
}
|
|
1709
|
-
/**
|
|
1710
|
-
* Forked from https://github.com/lukeed/dset
|
|
1711
|
-
* Changes: fixed setting a deep value to a proxy object
|
|
1712
|
-
*/
|
|
1713
|
-
|
|
1714
|
-
function set(obj, keys, val) {
|
|
1715
|
-
keys = keys.split ? keys.split(".") : keys;
|
|
1716
|
-
var i = 0,
|
|
1717
|
-
l = keys.length,
|
|
1718
|
-
t = obj,
|
|
1719
|
-
x,
|
|
1720
|
-
k;
|
|
1721
|
-
|
|
1722
|
-
while (i < l) {
|
|
1723
|
-
k = keys[i++];
|
|
1724
|
-
if (k === "__proto__" || k === "constructor" || k === "prototype") break;
|
|
1725
|
-
|
|
1726
|
-
if (i === l) {
|
|
1727
|
-
t[k] = val;
|
|
1728
|
-
t = t[k];
|
|
1729
|
-
} else {
|
|
1730
|
-
if (typeof (x = t[k]) === typeof keys) {
|
|
1731
|
-
t = t[k] = x;
|
|
1732
|
-
} else if (keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".")) {
|
|
1733
|
-
t[k] = {};
|
|
1734
|
-
t = t[k];
|
|
1735
|
-
} else {
|
|
1736
|
-
t[k] = [];
|
|
1737
|
-
t = t[k];
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
1526
|
var useIsomorphicLayoutEffect$1 = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
1743
1527
|
function shallowEqual(a1, a2) {
|
|
1744
1528
|
if (a1.length !== a2.length) {
|
|
1745
1529
|
return false;
|
|
1746
1530
|
}
|
|
1747
|
-
|
|
1748
1531
|
for (var i = 0; i < a1.length; i++) {
|
|
1749
1532
|
if (a1[i] !== a2[i]) {
|
|
1750
1533
|
return false;
|
|
1751
1534
|
}
|
|
1752
1535
|
}
|
|
1753
|
-
|
|
1754
1536
|
return true;
|
|
1755
1537
|
}
|
|
1756
1538
|
function isNum(value) {
|
|
1757
1539
|
return typeof value === "symbol" ? false : !isNaN(+value);
|
|
1758
1540
|
}
|
|
1541
|
+
function assert(cond, msg) {
|
|
1542
|
+
if (msg === void 0) {
|
|
1543
|
+
msg = "Assertion failed";
|
|
1544
|
+
}
|
|
1545
|
+
if (!cond) {
|
|
1546
|
+
// We always generate an non empty message so that it doesn't get swallowed
|
|
1547
|
+
// by the async library.
|
|
1548
|
+
msg = (typeof msg === "string" ? msg : msg()) || "Assertion failed";
|
|
1549
|
+
debugger;
|
|
1550
|
+
throw new Error(msg);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Forked from https://github.com/lukeed/dset
|
|
1555
|
+
* Changes: fixed setting a deep value to a proxy object
|
|
1556
|
+
*/
|
|
1557
|
+
function set(obj, keys, val) {
|
|
1558
|
+
keys = keys.split ? keys.split(".") : keys;
|
|
1559
|
+
var i = 0,
|
|
1560
|
+
l = keys.length,
|
|
1561
|
+
t = obj,
|
|
1562
|
+
x,
|
|
1563
|
+
k;
|
|
1564
|
+
while (i < l) {
|
|
1565
|
+
k = keys[i++];
|
|
1566
|
+
if (k === "__proto__" || k === "constructor" || k === "prototype") break;
|
|
1567
|
+
var newValue = i === l ? val : typeof (x = t[k]) === typeof keys ? x : keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".") ? {} : [];
|
|
1568
|
+
assignValue(t, k, newValue);
|
|
1569
|
+
t = t[k];
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Forked from lodash
|
|
1574
|
+
*/
|
|
1575
|
+
function baseAssignValue(object, key, value) {
|
|
1576
|
+
if (key == "__proto__") {
|
|
1577
|
+
Object.defineProperty(object, key, {
|
|
1578
|
+
configurable: true,
|
|
1579
|
+
enumerable: true,
|
|
1580
|
+
value: value,
|
|
1581
|
+
writable: true
|
|
1582
|
+
});
|
|
1583
|
+
} else {
|
|
1584
|
+
object[key] = value;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
function eq(value, other) {
|
|
1588
|
+
return value === other || value !== value && other !== other;
|
|
1589
|
+
}
|
|
1590
|
+
function assignValue(object, key, value) {
|
|
1591
|
+
var objValue = object[key];
|
|
1592
|
+
if (!(Object.prototype.hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
|
|
1593
|
+
baseAssignValue(object, key, value);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1759
1596
|
|
|
1760
1597
|
var ARRAY_SYMBOL = /*#__PURE__*/Symbol("[]");
|
|
1761
1598
|
|
|
1599
|
+
var UNINITIALIZED = /*#__PURE__*/Symbol("plasmic.unitialized");
|
|
1762
1600
|
var StateSpecNode = /*#__PURE__*/function () {
|
|
1763
1601
|
function StateSpecNode(specs) {
|
|
1764
1602
|
this.specs = specs;
|
|
1765
1603
|
this.edges = new Map();
|
|
1604
|
+
this.state = {};
|
|
1766
1605
|
}
|
|
1767
|
-
|
|
1768
1606
|
var _proto = StateSpecNode.prototype;
|
|
1769
|
-
|
|
1770
1607
|
_proto.hasEdge = function hasEdge(key) {
|
|
1771
1608
|
return this.edges.has(key);
|
|
1772
1609
|
};
|
|
1773
|
-
|
|
1774
1610
|
_proto.addEdge = function addEdge(key, node) {
|
|
1775
1611
|
this.edges.set(key, node);
|
|
1776
1612
|
};
|
|
1777
|
-
|
|
1613
|
+
_proto.children = function children() {
|
|
1614
|
+
return this.edges.values();
|
|
1615
|
+
};
|
|
1778
1616
|
_proto.makeTransition = function makeTransition(key) {
|
|
1779
1617
|
key = isNum(key) ? ARRAY_SYMBOL : key;
|
|
1780
1618
|
return this.edges.get(key);
|
|
1781
1619
|
};
|
|
1782
|
-
|
|
1783
1620
|
_proto.isLeaf = function isLeaf() {
|
|
1784
1621
|
return this.edges.size === 0;
|
|
1785
1622
|
};
|
|
1786
|
-
|
|
1787
1623
|
_proto.hasArrayTransition = function hasArrayTransition() {
|
|
1788
1624
|
return this.edges.has(ARRAY_SYMBOL);
|
|
1789
1625
|
};
|
|
1790
|
-
|
|
1791
1626
|
_proto.getSpec = function getSpec() {
|
|
1792
1627
|
return this.specs[0];
|
|
1793
1628
|
};
|
|
1794
|
-
|
|
1795
1629
|
_proto.getAllSpecs = function getAllSpecs() {
|
|
1796
1630
|
return this.specs;
|
|
1797
1631
|
};
|
|
1798
|
-
|
|
1632
|
+
_proto.getState = function getState(path) {
|
|
1633
|
+
return this.state[JSON.stringify(path)];
|
|
1634
|
+
};
|
|
1635
|
+
_proto.clearStates = function clearStates() {
|
|
1636
|
+
this.state = {};
|
|
1637
|
+
};
|
|
1638
|
+
_proto.states = function states() {
|
|
1639
|
+
return Object.values(this.state);
|
|
1640
|
+
};
|
|
1641
|
+
_proto.hasState = function hasState(path) {
|
|
1642
|
+
var key = JSON.stringify(path);
|
|
1643
|
+
return key in this.state;
|
|
1644
|
+
};
|
|
1645
|
+
_proto.createStateCell = function createStateCell(path) {
|
|
1646
|
+
var key = JSON.stringify(path);
|
|
1647
|
+
this.state[key] = {
|
|
1648
|
+
listeners: [],
|
|
1649
|
+
initialValue: UNINITIALIZED,
|
|
1650
|
+
registeredInitFunc: this.getSpec().initFunc,
|
|
1651
|
+
path: path
|
|
1652
|
+
};
|
|
1653
|
+
};
|
|
1654
|
+
_proto.setInitialValue = function setInitialValue(path, value) {
|
|
1655
|
+
var key = JSON.stringify(path);
|
|
1656
|
+
this.state[key].initialValue = value;
|
|
1657
|
+
};
|
|
1658
|
+
_proto.getInitialValue = function getInitialValue(path) {
|
|
1659
|
+
var key = JSON.stringify(path);
|
|
1660
|
+
return this.state[key].initialValue;
|
|
1661
|
+
};
|
|
1662
|
+
_proto.addListener = function addListener(path, f) {
|
|
1663
|
+
var key = JSON.stringify(path);
|
|
1664
|
+
this.state[key].listeners.push(f);
|
|
1665
|
+
};
|
|
1799
1666
|
return StateSpecNode;
|
|
1800
1667
|
}();
|
|
1801
1668
|
var transformPathStringToObj = function transformPathStringToObj(str) {
|
|
1802
1669
|
var splitStatePathPart = function splitStatePathPart(state) {
|
|
1803
1670
|
return state.endsWith("[]") ? [].concat(splitStatePathPart(state.slice(0, -2)), [ARRAY_SYMBOL]) : [state];
|
|
1804
1671
|
};
|
|
1805
|
-
|
|
1806
1672
|
return str.split(".").flatMap(splitStatePathPart);
|
|
1807
1673
|
};
|
|
1808
|
-
function
|
|
1674
|
+
function buildTree(specs) {
|
|
1809
1675
|
var internalSpec = specs.map(function (spec) {
|
|
1810
1676
|
return _extends({}, spec, {
|
|
1811
1677
|
pathObj: transformPathStringToObj(spec.path),
|
|
@@ -1814,7 +1680,6 @@ function buildGraph(specs) {
|
|
|
1814
1680
|
})
|
|
1815
1681
|
});
|
|
1816
1682
|
});
|
|
1817
|
-
|
|
1818
1683
|
var rec = function rec(currentPath) {
|
|
1819
1684
|
var node = new StateSpecNode(internalSpec.filter(function (spec) {
|
|
1820
1685
|
return shallowEqual(currentPath, spec.pathObj.slice(0, currentPath.length));
|
|
@@ -1822,7 +1687,6 @@ function buildGraph(specs) {
|
|
|
1822
1687
|
node.getAllSpecs().forEach(function (spec) {
|
|
1823
1688
|
if (spec.pathObj.length > currentPath.length) {
|
|
1824
1689
|
var nextKey = spec.pathObj[currentPath.length];
|
|
1825
|
-
|
|
1826
1690
|
if (!node.hasEdge(nextKey)) {
|
|
1827
1691
|
node.addEdge(nextKey, rec([].concat(currentPath, [nextKey])));
|
|
1828
1692
|
}
|
|
@@ -1830,397 +1694,313 @@ function buildGraph(specs) {
|
|
|
1830
1694
|
});
|
|
1831
1695
|
return node;
|
|
1832
1696
|
};
|
|
1833
|
-
|
|
1834
1697
|
return rec([]);
|
|
1835
1698
|
}
|
|
1836
|
-
|
|
1837
|
-
var
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1699
|
+
function getLeaves(root) {
|
|
1700
|
+
var leaves = [];
|
|
1701
|
+
var rec = function rec(node) {
|
|
1702
|
+
for (var _iterator = _createForOfIteratorHelperLoose(node.children()), _step; !(_step = _iterator()).done;) {
|
|
1703
|
+
var child = _step.value;
|
|
1704
|
+
rec(child);
|
|
1705
|
+
}
|
|
1706
|
+
if (node.isLeaf()) {
|
|
1707
|
+
leaves.push(node);
|
|
1708
|
+
}
|
|
1709
|
+
};
|
|
1710
|
+
rec(root);
|
|
1711
|
+
return leaves;
|
|
1712
|
+
}
|
|
1713
|
+
function findStateCell(root, pathStr, repetitionIndex) {
|
|
1714
|
+
var realPath = [];
|
|
1715
|
+
var pathObj = transformPathStringToObj(pathStr);
|
|
1716
|
+
var currRepIndex = 0;
|
|
1717
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(pathObj), _step2; !(_step2 = _iterator2()).done;) {
|
|
1718
|
+
var part = _step2.value;
|
|
1719
|
+
if (typeof part === "symbol") {
|
|
1720
|
+
if (!root.hasArrayTransition() || !repetitionIndex || currRepIndex > repetitionIndex.length) {
|
|
1721
|
+
console.log(root);
|
|
1722
|
+
throw new Error("transition not found: pathStr " + pathStr + " part " + (typeof part === "symbol" ? "[]" : part));
|
|
1723
|
+
}
|
|
1724
|
+
realPath.push(repetitionIndex[currRepIndex++]);
|
|
1725
|
+
root = root.makeTransition(ARRAY_SYMBOL);
|
|
1726
|
+
} else {
|
|
1727
|
+
if (!root.hasEdge(part)) {
|
|
1728
|
+
throw new Error("transition not found: pathStr " + pathStr + " part " + (typeof part === "symbol" ? "[]" : part));
|
|
1729
|
+
}
|
|
1730
|
+
realPath.push(part);
|
|
1731
|
+
root = root.makeTransition(part);
|
|
1849
1732
|
}
|
|
1850
1733
|
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1734
|
+
return {
|
|
1735
|
+
node: root,
|
|
1736
|
+
realPath: realPath
|
|
1737
|
+
};
|
|
1853
1738
|
}
|
|
1854
1739
|
|
|
1855
1740
|
function isNum$1(value) {
|
|
1856
1741
|
return typeof value === "symbol" ? false : !isNaN(+value);
|
|
1857
1742
|
}
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1743
|
+
function canProxy(value) {
|
|
1744
|
+
return typeof value === "object" && value != null;
|
|
1745
|
+
}
|
|
1746
|
+
function initializeStateValue($$state, initialSpecNode, initialStatePath, proxyRoot) {
|
|
1747
|
+
var stateAccess = new Set();
|
|
1748
|
+
var $state = create$StateProxy($$state, function (node, path) {
|
|
1749
|
+
return {
|
|
1750
|
+
get: function get() {
|
|
1751
|
+
stateAccess.add({
|
|
1752
|
+
path: path,
|
|
1753
|
+
node: node
|
|
1754
|
+
});
|
|
1755
|
+
var spec = node.getSpec();
|
|
1756
|
+
if (spec.valueProp) {
|
|
1757
|
+
return $$state.props[spec.valueProp];
|
|
1758
|
+
} else if (!node.hasState(path) && spec.initFunc) {
|
|
1759
|
+
return initializeStateValue($$state, node, path, proxyRoot);
|
|
1760
|
+
}
|
|
1761
|
+
return _get(proxyRoot, path);
|
|
1762
|
+
},
|
|
1763
|
+
set: function set() {
|
|
1764
|
+
throw new Error("Cannot update state values during initialization");
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1864
1767
|
});
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
specKey: spec.path
|
|
1768
|
+
stateAccess.forEach(function (_ref) {
|
|
1769
|
+
var node = _ref.node,
|
|
1770
|
+
path = _ref.path;
|
|
1771
|
+
node.addListener(path, function () {
|
|
1772
|
+
var newValue = initialSpecNode.getSpec().initFunc($$state.props, $state, $$state.ctx);
|
|
1773
|
+
set(proxyRoot, initialStatePath, newValue);
|
|
1774
|
+
});
|
|
1873
1775
|
});
|
|
1776
|
+
var initialValue = initialSpecNode.getState(initialStatePath).registeredInitFunc($$state.props, $state, $$state.ctx);
|
|
1777
|
+
initialSpecNode.setInitialValue(initialStatePath, clone(initialValue));
|
|
1778
|
+
var initialSpec = initialSpecNode.getSpec();
|
|
1779
|
+
var value = initialSpec.isImmutable ? mkUntrackedValue(initialValue) : clone(initialValue);
|
|
1780
|
+
set(proxyRoot, initialStatePath, value);
|
|
1781
|
+
//immediately fire onChange
|
|
1782
|
+
if (initialSpec.onChangeProp) {
|
|
1783
|
+
var _$$state$props$initia, _$$state$props;
|
|
1784
|
+
(_$$state$props$initia = (_$$state$props = $$state.props)[initialSpec.onChangeProp]) == null ? void 0 : _$$state$props$initia.call(_$$state$props, initialValue);
|
|
1785
|
+
}
|
|
1786
|
+
return initialValue;
|
|
1874
1787
|
}
|
|
1875
|
-
|
|
1876
|
-
function
|
|
1877
|
-
var rec = function rec(currPath, currNode) {
|
|
1788
|
+
function create$StateProxy($$state, leafHandlers) {
|
|
1789
|
+
var rec = function rec(currPath, currNode, isOutside, proxyRoot, initialObject) {
|
|
1878
1790
|
var getNextPath = function getNextPath(property) {
|
|
1879
1791
|
return [].concat(currPath, [isNum$1(property) ? +property : property]);
|
|
1880
1792
|
};
|
|
1881
|
-
|
|
1882
|
-
|
|
1793
|
+
var spec = currNode.getSpec();
|
|
1794
|
+
var handlers = {
|
|
1883
1795
|
deleteProperty: function deleteProperty(target, property) {
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
}
|
|
1895
|
-
specKeysToUpdate.forEach(function (specKey) {
|
|
1896
|
-
var spec = $$state.specsByKey[specKey];
|
|
1897
|
-
|
|
1898
|
-
if (spec.onChangeProp) {
|
|
1899
|
-
var _$$state$props$spec$o, _$$state$props;
|
|
1900
|
-
|
|
1901
|
-
(_$$state$props$spec$o = (_$$state$props = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o.call(_$$state$props, _get($$state.stateValues, currPath), currPath);
|
|
1902
|
-
}
|
|
1903
|
-
});
|
|
1796
|
+
if (!isOutside && !currNode.isLeaf() && !currNode.hasArrayTransition() && !isNum$1(property)) {
|
|
1797
|
+
throw new Error("Can't delete a property in the middle of the state spec");
|
|
1798
|
+
}
|
|
1799
|
+
delete _get($$state.stateValues, currPath)[property];
|
|
1800
|
+
if (spec.onChangeProp) {
|
|
1801
|
+
var _$$state$props$spec$o, _$$state$props2;
|
|
1802
|
+
//we are always in a leaf, since we only have two cases:
|
|
1803
|
+
// 1 - delete properties outside the state tree
|
|
1804
|
+
// 2 - delete indices in repeated implicit states, but these can't be exposed, so they don't have onChangeProp
|
|
1805
|
+
(_$$state$props$spec$o = (_$$state$props2 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o.call(_$$state$props2, _get($$state.stateValues, currPath.slice(spec.pathObj.length)));
|
|
1806
|
+
}
|
|
1904
1807
|
return Reflect.deleteProperty(target, property);
|
|
1905
1808
|
},
|
|
1906
1809
|
get: function get(target, property, receiver) {
|
|
1810
|
+
proxyRoot = proxyRoot == null ? receiver : proxyRoot;
|
|
1907
1811
|
var nextPath = getNextPath(property);
|
|
1812
|
+
if (isOutside || currNode.isLeaf()) {
|
|
1813
|
+
return Reflect.get(target, property, receiver);
|
|
1814
|
+
}
|
|
1908
1815
|
var nextNode = currNode.makeTransition(property);
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
target[property] = (_handlers$get = (_handlers = handlers(nextPath, nextNode.getSpec())).get) == null ? void 0 : _handlers$get.call(_handlers, target, property, receiver);
|
|
1915
|
-
} else if (!(property in target)) {
|
|
1916
|
-
target[property] = rec(nextPath, nextNode);
|
|
1917
|
-
}
|
|
1816
|
+
if (nextNode != null && nextNode.isLeaf()) {
|
|
1817
|
+
var _leafHandlers$get, _leafHandlers;
|
|
1818
|
+
return (_leafHandlers$get = (_leafHandlers = leafHandlers(nextNode, nextPath, proxyRoot)).get) == null ? void 0 : _leafHandlers$get.call(_leafHandlers, target, property, receiver);
|
|
1819
|
+
} else if (nextNode && !(property in target)) {
|
|
1820
|
+
target[property] = rec(nextPath, nextNode, false, proxyRoot, undefined);
|
|
1918
1821
|
}
|
|
1919
|
-
|
|
1920
1822
|
return Reflect.get(target, property, receiver);
|
|
1921
1823
|
},
|
|
1922
1824
|
set: function set$1(target, property, value, receiver) {
|
|
1825
|
+
var _nextNode, _nextNode2;
|
|
1826
|
+
proxyRoot = proxyRoot == null ? receiver : proxyRoot;
|
|
1923
1827
|
var nextPath = getNextPath(property);
|
|
1924
1828
|
var nextNode = currNode.makeTransition(property);
|
|
1925
|
-
|
|
1926
|
-
if (nextNode && typeof property !== "symbol") {
|
|
1927
|
-
if (nextNode.isLeaf()) {
|
|
1928
|
-
var _handlers$set, _handlers2;
|
|
1929
|
-
|
|
1930
|
-
// reached the end of the spec
|
|
1931
|
-
target[property] = (_handlers$set = (_handlers2 = handlers(nextPath, nextNode.getSpec())).set) == null ? void 0 : _handlers$set.call(_handlers2, target, property, value, receiver);
|
|
1932
|
-
return Reflect.set(target, property, value, receiver);
|
|
1933
|
-
} else if (typeof value === "object") {
|
|
1934
|
-
target[property] = rec(nextPath, nextNode);
|
|
1935
|
-
|
|
1936
|
-
for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) {
|
|
1937
|
-
var key = _Object$keys[_i];
|
|
1938
|
-
target[property][key] = value[key];
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
return true;
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
1829
|
if (property === "registerInitFunc" && currPath.length === 0) {
|
|
1946
1830
|
return Reflect.set(target, property, value, receiver);
|
|
1947
1831
|
}
|
|
1948
|
-
|
|
1949
|
-
if (currNode.hasArrayTransition()) {
|
|
1950
|
-
var _currNode$makeTransit, _currNode$makeTransit2;
|
|
1951
|
-
|
|
1832
|
+
if (!nextNode && currNode.hasArrayTransition()) {
|
|
1952
1833
|
set($$state.stateValues, nextPath, value);
|
|
1953
|
-
|
|
1954
|
-
(_currNode$makeTransit = currNode.makeTransition(ARRAY_SYMBOL)) == null ? void 0 : (_currNode$makeTransit2 = _currNode$makeTransit.getAllSpecs()) == null ? void 0 : _currNode$makeTransit2.forEach(function (spec) {
|
|
1955
|
-
if (spec.onChangeProp) {
|
|
1956
|
-
var _$$state$props$spec$o2, _$$state$props2;
|
|
1957
|
-
|
|
1958
|
-
(_$$state$props$spec$o2 = (_$$state$props2 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o2.call(_$$state$props2, value, nextPath);
|
|
1959
|
-
}
|
|
1960
|
-
});
|
|
1834
|
+
//array can set his own properties such as length, map, ...
|
|
1961
1835
|
return Reflect.set(target, property, value, receiver);
|
|
1962
|
-
} // invalid setting a value that doesn't make part of the spec
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
return false;
|
|
1966
|
-
}
|
|
1967
|
-
});
|
|
1968
|
-
};
|
|
1969
|
-
|
|
1970
|
-
return rec([], $$state.rootStateSpec);
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
var deleteState = function deleteState($$state, path) {
|
|
1974
|
-
var _$$state$unsubscripti;
|
|
1975
|
-
|
|
1976
|
-
var key = JSON.stringify(path);
|
|
1977
|
-
(_$$state$unsubscripti = $$state.unsubscriptionsByState[key]) == null ? void 0 : _$$state$unsubscripti.forEach(function (f) {
|
|
1978
|
-
return f();
|
|
1979
|
-
});
|
|
1980
|
-
delete $$state.unsubscriptionsByState[key];
|
|
1981
|
-
$$state.existingStates["delete"](key); // delete get($$state.stateValues, path.slice(-1))[path.slice(-1)[0]];
|
|
1982
|
-
// delete get($$state.initStateValues, path.slice(-1))[path.slice(-1)[0]];
|
|
1983
|
-
};
|
|
1984
|
-
|
|
1985
|
-
var getIndexes = function getIndexes(path, spec) {
|
|
1986
|
-
var indexes = [];
|
|
1987
|
-
|
|
1988
|
-
if (path.length !== spec.pathObj.length) {
|
|
1989
|
-
throw new Error("Unexpected error: state path and spec path have different lengths");
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
for (var i = 0; i < spec.pathObj.length; i++) {
|
|
1993
|
-
if (spec.pathObj[i] === "[]") {
|
|
1994
|
-
indexes.push(path[i]);
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1997
|
-
|
|
1998
|
-
return indexes;
|
|
1999
|
-
};
|
|
2000
|
-
|
|
2001
|
-
function initializeStateValue($$state, initialStatePath, initialSpec) {
|
|
2002
|
-
var _$$state$unsubscripti2;
|
|
2003
|
-
|
|
2004
|
-
var initialStateKey = JSON.stringify(initialStatePath);
|
|
2005
|
-
var stateAccess = new Set();
|
|
2006
|
-
var $state = create$StateProxy($$state, function (path, spec) {
|
|
2007
|
-
return {
|
|
2008
|
-
get: function get() {
|
|
2009
|
-
var key = JSON.stringify(path);
|
|
2010
|
-
stateAccess.add({
|
|
2011
|
-
path: path,
|
|
2012
|
-
spec: spec
|
|
2013
|
-
});
|
|
2014
|
-
|
|
2015
|
-
if (spec.valueProp) {
|
|
2016
|
-
return !spec.isRepeated ? $$state.props[spec.valueProp] : _get($$state.props[spec.valueProp], path.slice(1));
|
|
2017
1836
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
return _get($$state.stateValues, path);
|
|
2022
|
-
} else if (spec.initFunc) {
|
|
2023
|
-
initializeStateValue($$state, path, spec);
|
|
1837
|
+
if ((_nextNode = nextNode) != null && _nextNode.isLeaf()) {
|
|
1838
|
+
var _leafHandlers$set, _leafHandlers2;
|
|
1839
|
+
(_leafHandlers$set = (_leafHandlers2 = leafHandlers(nextNode, nextPath, proxyRoot)).set) == null ? void 0 : _leafHandlers$set.call(_leafHandlers2, target, property, value, receiver);
|
|
2024
1840
|
}
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
1841
|
+
if (!isOutside && !currNode.isLeaf() && !nextNode) {
|
|
1842
|
+
// can't set an unknown field in $state
|
|
1843
|
+
return false;
|
|
1844
|
+
}
|
|
1845
|
+
// we keep pointing to the leaf
|
|
1846
|
+
if (!nextNode) {
|
|
1847
|
+
assert(isOutside || currNode.isLeaf, "unexpected update in nextNode");
|
|
1848
|
+
nextNode = currNode;
|
|
1849
|
+
}
|
|
1850
|
+
if (canProxy(value)) {
|
|
1851
|
+
target[property] = rec(nextPath, nextNode, isOutside || currNode.isLeaf(), proxyRoot, value);
|
|
1852
|
+
} else if (!isOutside && !currNode.isLeaf() && !((_nextNode2 = nextNode) != null && _nextNode2.isLeaf())) {
|
|
1853
|
+
throw new Error("inserting a primitive value into a non-leaf");
|
|
1854
|
+
} else {
|
|
1855
|
+
Reflect.set(target, property, value, receiver);
|
|
1856
|
+
}
|
|
1857
|
+
nextNode.getAllSpecs().forEach(function (spec) {
|
|
1858
|
+
if (spec.onChangeProp) {
|
|
1859
|
+
var _$$state$props$spec$o2, _$$state$props3;
|
|
1860
|
+
(_$$state$props$spec$o2 = (_$$state$props3 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o2.call(_$$state$props3, value);
|
|
1861
|
+
}
|
|
1862
|
+
});
|
|
1863
|
+
var newValue = (isOutside || currNode.isLeaf()) && currNode.getSpec().isImmutable ? mkUntrackedValue(value) : value;
|
|
1864
|
+
set($$state.stateValues, nextPath, newValue);
|
|
1865
|
+
return true;
|
|
2030
1866
|
}
|
|
2031
1867
|
};
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
return initialValue;
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
|
-
function saveValue($$state, path, spec, value) {
|
|
2051
|
-
if (spec.isImmutable) {
|
|
2052
|
-
set($$state.stateValues, path, mkUntrackedValue(value));
|
|
2053
|
-
} else {
|
|
2054
|
-
set($$state.stateValues, path, value);
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
function saveStateInitialValue($$state, path, spec, initialValue) {
|
|
2059
|
-
if (spec.isImmutable) {
|
|
2060
|
-
var untrackedValue = mkUntrackedValue(initialValue);
|
|
2061
|
-
|
|
2062
|
-
set($$state.stateValues, path, untrackedValue);
|
|
2063
|
-
|
|
2064
|
-
set($$state.initStateValues, path, clone(untrackedValue));
|
|
2065
|
-
} else {
|
|
2066
|
-
set($$state.stateValues, path, clone(initialValue));
|
|
2067
|
-
|
|
2068
|
-
set($$state.initStateValues, path, clone(initialValue));
|
|
2069
|
-
}
|
|
1868
|
+
var baseObject = !isOutside && !currNode.isLeaf() ? currNode.hasArrayTransition() ? [] : {} : Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
|
|
1869
|
+
var proxyObj = new Proxy(baseObject, handlers);
|
|
1870
|
+
if (initialObject) {
|
|
1871
|
+
Reflect.ownKeys(initialObject).forEach(function (key) {
|
|
1872
|
+
var desc = Object.getOwnPropertyDescriptor(initialObject, key);
|
|
1873
|
+
if (desc.get || desc.set) {
|
|
1874
|
+
Object.defineProperty(baseObject, key, desc);
|
|
1875
|
+
} else {
|
|
1876
|
+
proxyObj[key] = initialObject[key];
|
|
1877
|
+
}
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
return proxyObj;
|
|
1881
|
+
};
|
|
1882
|
+
return rec([], $$state.rootSpecTree, false, undefined, undefined);
|
|
2070
1883
|
}
|
|
2071
|
-
|
|
1884
|
+
var mkUntrackedValue = function mkUntrackedValue(o) {
|
|
1885
|
+
return o != null && typeof o === "object" ? valtio.ref(o) : o;
|
|
1886
|
+
};
|
|
2072
1887
|
function useDollarState(specs, props, $ctx) {
|
|
2073
|
-
var $$state = React__default.useRef(
|
|
2074
|
-
|
|
2075
|
-
initStateValues: {},
|
|
2076
|
-
specsByKey: Object.fromEntries(specs.map(function (spec) {
|
|
2077
|
-
return [spec.path, _extends({}, spec, {
|
|
2078
|
-
pathObj: transformPathStringToObj(spec.path),
|
|
2079
|
-
isRepeated: spec.path.split(".").some(function (part) {
|
|
2080
|
-
return part.endsWith("[]");
|
|
2081
|
-
})
|
|
2082
|
-
})];
|
|
2083
|
-
})),
|
|
2084
|
-
statesInstanceBySpec: new Map(),
|
|
2085
|
-
existingStates: new Map(),
|
|
2086
|
-
unsubscriptionsByState: {},
|
|
2087
|
-
props: {},
|
|
2088
|
-
ctx: {},
|
|
2089
|
-
registrationsQueue: [],
|
|
2090
|
-
rootStateSpec: buildGraph(specs)
|
|
2091
|
-
})).current;
|
|
2092
|
-
$$state.props = mkUntrackedValue(props);
|
|
2093
|
-
$$state.ctx = mkUntrackedValue($ctx != null ? $ctx : {});
|
|
2094
|
-
var $state = React__default.useRef(Object.assign(create$StateProxy($$state, function (path, spec) {
|
|
2095
|
-
var key = JSON.stringify(path);
|
|
2096
|
-
|
|
2097
|
-
if (!$$state.existingStates.has(key)) {
|
|
2098
|
-
var _spec$initVal;
|
|
2099
|
-
|
|
2100
|
-
saveNewState($$state, path, spec);
|
|
2101
|
-
var initialValue = !spec.initFunc ? (_spec$initVal = spec.initVal) != null ? _spec$initVal : undefined : initializeStateValue($$state, path, spec);
|
|
2102
|
-
saveStateInitialValue($$state, path, spec, initialValue);
|
|
2103
|
-
}
|
|
2104
|
-
|
|
1888
|
+
var $$state = React__default.useRef(function () {
|
|
1889
|
+
var rootSpecTree = buildTree(specs);
|
|
2105
1890
|
return {
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
1891
|
+
rootSpecTree: rootSpecTree,
|
|
1892
|
+
specTreeLeaves: getLeaves(rootSpecTree),
|
|
1893
|
+
stateValues: valtio.proxy({}),
|
|
1894
|
+
props: {},
|
|
1895
|
+
ctx: {},
|
|
1896
|
+
registrationsQueue: []
|
|
1897
|
+
};
|
|
1898
|
+
}()).current;
|
|
1899
|
+
$$state.props = props;
|
|
1900
|
+
$$state.ctx = $ctx != null ? $ctx : {};
|
|
1901
|
+
var $state = React__default.useRef(function () {
|
|
1902
|
+
var useRef$state = Object.assign(create$StateProxy($$state, function (node, path, proxyRoot) {
|
|
1903
|
+
if (!node.hasState(path)) {
|
|
1904
|
+
node.createStateCell(path);
|
|
1905
|
+
var spec = node.getSpec();
|
|
1906
|
+
if (spec.initFunc) {
|
|
1907
|
+
initializeStateValue($$state, node, path, proxyRoot);
|
|
1908
|
+
} else if (!spec.valueProp) {
|
|
1909
|
+
set(proxyRoot, path, spec.initVal);
|
|
2121
1910
|
}
|
|
2122
|
-
|
|
2123
|
-
return true;
|
|
2124
1911
|
}
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
1912
|
+
return {
|
|
1913
|
+
get: function get(target, property, receiver) {
|
|
1914
|
+
var spec = node.getSpec();
|
|
1915
|
+
if (spec.valueProp) {
|
|
1916
|
+
return $$state.props[spec.valueProp];
|
|
1917
|
+
} else {
|
|
1918
|
+
return Reflect.get(target, property, receiver);
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
};
|
|
1922
|
+
}), {
|
|
1923
|
+
registerInitFunc: function registerInitFunc(pathStr, f, repetitionIndex) {
|
|
1924
|
+
var _findStateCell = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex),
|
|
1925
|
+
node = _findStateCell.node,
|
|
1926
|
+
realPath = _findStateCell.realPath;
|
|
1927
|
+
if (!node.hasState(realPath)) {
|
|
1928
|
+
node.createStateCell(realPath);
|
|
1929
|
+
}
|
|
1930
|
+
if (!deepEqual(node.getState(realPath).initialValue, f($$state.props, useRef$state, $$state.ctx))) {
|
|
1931
|
+
$$state.registrationsQueue.push({
|
|
1932
|
+
node: node,
|
|
1933
|
+
path: realPath,
|
|
1934
|
+
f: f
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
2139
1937
|
}
|
|
2140
|
-
}
|
|
2141
|
-
|
|
1938
|
+
});
|
|
1939
|
+
return useRef$state;
|
|
1940
|
+
}()).current;
|
|
1941
|
+
// For each spec with an initFunc, evaluate it and see if
|
|
2142
1942
|
// the init value has changed. If so, reset its state.
|
|
2143
|
-
|
|
2144
1943
|
var resetSpecs = [];
|
|
2145
|
-
$$state.
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
1944
|
+
$$state.specTreeLeaves.flatMap(function (node) {
|
|
1945
|
+
return node.states().map(function (stateCell) {
|
|
1946
|
+
return {
|
|
1947
|
+
stateCell: stateCell,
|
|
1948
|
+
node: node
|
|
1949
|
+
};
|
|
1950
|
+
});
|
|
1951
|
+
}).forEach(function (_ref2) {
|
|
1952
|
+
var stateCell = _ref2.stateCell,
|
|
1953
|
+
node = _ref2.node;
|
|
1954
|
+
if (stateCell.registeredInitFunc) {
|
|
1955
|
+
var newInit = stateCell.registeredInitFunc(props, $state, $ctx != null ? $ctx : {});
|
|
1956
|
+
if (!deepEqual(newInit, stateCell.initialValue)) {
|
|
2154
1957
|
resetSpecs.push({
|
|
2155
|
-
|
|
2156
|
-
|
|
1958
|
+
stateCell: stateCell,
|
|
1959
|
+
node: node
|
|
2157
1960
|
});
|
|
2158
1961
|
}
|
|
2159
1962
|
}
|
|
2160
1963
|
});
|
|
1964
|
+
var reInitializeState = function reInitializeState(node, stateCell) {
|
|
1965
|
+
var newInit = initializeStateValue($$state, node, stateCell.path, $state);
|
|
1966
|
+
var spec = node.getSpec();
|
|
1967
|
+
if (spec.onChangeProp) {
|
|
1968
|
+
var _$$state$props$spec$o3, _$$state$props4;
|
|
1969
|
+
(_$$state$props$spec$o3 = (_$$state$props4 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o3.call(_$$state$props4, newInit);
|
|
1970
|
+
}
|
|
1971
|
+
};
|
|
2161
1972
|
useIsomorphicLayoutEffect$1(function () {
|
|
2162
|
-
resetSpecs.forEach(function (
|
|
2163
|
-
var
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
if (spec.onChangeProp) {
|
|
2168
|
-
var _$$state$props$spec$o4, _$$state$props4;
|
|
2169
|
-
|
|
2170
|
-
(_$$state$props$spec$o4 = (_$$state$props4 = $$state.props)[spec.onChangeProp]) == null ? void 0 : _$$state$props$spec$o4.call(_$$state$props4, newInit, path);
|
|
2171
|
-
}
|
|
1973
|
+
resetSpecs.forEach(function (_ref3) {
|
|
1974
|
+
var stateCell = _ref3.stateCell,
|
|
1975
|
+
node = _ref3.node;
|
|
1976
|
+
reInitializeState(node, stateCell);
|
|
2172
1977
|
});
|
|
2173
1978
|
}, [props, resetSpecs]);
|
|
2174
1979
|
useIsomorphicLayoutEffect$1(function () {
|
|
2175
|
-
$$state.registrationsQueue.forEach(function (
|
|
2176
|
-
var
|
|
2177
|
-
|
|
2178
|
-
|
|
1980
|
+
$$state.registrationsQueue.forEach(function (_ref4) {
|
|
1981
|
+
var node = _ref4.node,
|
|
1982
|
+
path = _ref4.path,
|
|
1983
|
+
f = _ref4.f;
|
|
1984
|
+
var stateCell = node.getState(path);
|
|
1985
|
+
stateCell.registeredInitFunc = f;
|
|
1986
|
+
reInitializeState(node, stateCell);
|
|
2179
1987
|
});
|
|
2180
1988
|
$$state.registrationsQueue = [];
|
|
2181
|
-
}, [$$state.registrationsQueue]);
|
|
2182
|
-
|
|
1989
|
+
}, [$$state.registrationsQueue]);
|
|
1990
|
+
// immediately initialize exposed non-private states
|
|
1991
|
+
useIsomorphicLayoutEffect$1(function () {
|
|
1992
|
+
$$state.specTreeLeaves.forEach(function (node) {
|
|
1993
|
+
var spec = node.getSpec();
|
|
1994
|
+
if (!spec.isRepeated && spec.type !== "private" && spec.initFunc) {
|
|
1995
|
+
node.createStateCell(spec.pathObj);
|
|
1996
|
+
initializeStateValue($$state, node, spec.pathObj, $state);
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
}, []);
|
|
2000
|
+
// Re-render if any value changed in one of these objects
|
|
2183
2001
|
valtio.useSnapshot($$state.stateValues, {
|
|
2184
2002
|
sync: true
|
|
2185
2003
|
});
|
|
2186
|
-
valtio.useSnapshot($$state.specsByKey, {
|
|
2187
|
-
sync: true
|
|
2188
|
-
});
|
|
2189
|
-
return $state;
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
function useCanvasDollarState(specs, props, $ctx) {
|
|
2193
|
-
var $$state = valtio.proxy({
|
|
2194
|
-
stateValues: {},
|
|
2195
|
-
initStateValues: {},
|
|
2196
|
-
specsByKey: Object.fromEntries(specs.map(function (spec) {
|
|
2197
|
-
return [spec.path, _extends({}, spec, {
|
|
2198
|
-
pathObj: transformPathStringToObj(spec.path),
|
|
2199
|
-
isRepeated: spec.path.split(".").some(function (part) {
|
|
2200
|
-
return part.endsWith("[]");
|
|
2201
|
-
})
|
|
2202
|
-
})];
|
|
2203
|
-
})),
|
|
2204
|
-
statesInstanceBySpec: new Map(),
|
|
2205
|
-
existingStates: new Map(),
|
|
2206
|
-
unsubscriptionsByState: {},
|
|
2207
|
-
props: {},
|
|
2208
|
-
ctx: {},
|
|
2209
|
-
registrationsQueue: [],
|
|
2210
|
-
rootStateSpec: buildGraph(specs)
|
|
2211
|
-
});
|
|
2212
|
-
$$state.props = mkUntrackedValue(props);
|
|
2213
|
-
$$state.ctx = mkUntrackedValue($ctx);
|
|
2214
|
-
var $state = {};
|
|
2215
|
-
|
|
2216
|
-
for (var _iterator = _createForOfIteratorHelperLoose(specs), _step; !(_step = _iterator()).done;) {
|
|
2217
|
-
var spec = _step.value;
|
|
2218
|
-
var path = transformPathStringToObj(spec.path);
|
|
2219
|
-
var init = spec.valueProp ? $$state.props[spec.valueProp] : spec.initVal ? spec.initVal : spec.initFunc ? initializeStateValue($$state, path, $$state.specsByKey[spec.path]) : undefined;
|
|
2220
|
-
|
|
2221
|
-
set($state, path, init);
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
2004
|
return $state;
|
|
2225
2005
|
}
|
|
2226
2006
|
|
|
@@ -2235,7 +2015,6 @@ function mergeVariantToggles() {
|
|
|
2235
2015
|
for (var _len = arguments.length, toggles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2236
2016
|
toggles[_key] = arguments[_key];
|
|
2237
2017
|
}
|
|
2238
|
-
|
|
2239
2018
|
var definedToggles = toggles.filter(function (x) {
|
|
2240
2019
|
return !!x.def;
|
|
2241
2020
|
});
|
|
@@ -2246,7 +2025,7 @@ function mergeVariantToggles() {
|
|
|
2246
2025
|
return mapValues(grouped, function (subToggles) {
|
|
2247
2026
|
return Object.fromEntries(subToggles.map(function (_ref2) {
|
|
2248
2027
|
var def = _ref2.def,
|
|
2249
|
-
|
|
2028
|
+
active = _ref2.active;
|
|
2250
2029
|
return [def.variant, !!active];
|
|
2251
2030
|
}));
|
|
2252
2031
|
});
|
|
@@ -2260,7 +2039,6 @@ function getPlumeType(child) {
|
|
|
2260
2039
|
if (!React.isValidElement(child)) {
|
|
2261
2040
|
return undefined;
|
|
2262
2041
|
}
|
|
2263
|
-
|
|
2264
2042
|
var childType = child.type;
|
|
2265
2043
|
return childType.__plumeType || (childType.getPlumeType == null ? void 0 : childType.getPlumeType(child.props));
|
|
2266
2044
|
}
|
|
@@ -2268,20 +2046,17 @@ function getPlumeType(child) {
|
|
|
2268
2046
|
var _excluded$4 = ["link", "isDisabled", "startIcon", "endIcon", "showStartIcon", "showEndIcon", "children"];
|
|
2269
2047
|
function useButton(plasmicClass, props, config, ref) {
|
|
2270
2048
|
var _ref, _ref2, _extends2, _overrides;
|
|
2271
|
-
|
|
2272
2049
|
if (ref === void 0) {
|
|
2273
2050
|
ref = null;
|
|
2274
2051
|
}
|
|
2275
|
-
|
|
2276
2052
|
var link = props.link,
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2053
|
+
isDisabled = props.isDisabled,
|
|
2054
|
+
startIcon = props.startIcon,
|
|
2055
|
+
endIcon = props.endIcon,
|
|
2056
|
+
showStartIcon = props.showStartIcon,
|
|
2057
|
+
showEndIcon = props.showEndIcon,
|
|
2058
|
+
children = props.children,
|
|
2059
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$4);
|
|
2285
2060
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
2286
2061
|
def: config.showStartIconVariant,
|
|
2287
2062
|
active: showStartIcon
|
|
@@ -2292,9 +2067,7 @@ function useButton(plasmicClass, props, config, ref) {
|
|
|
2292
2067
|
def: config.isDisabledVariant,
|
|
2293
2068
|
active: isDisabled
|
|
2294
2069
|
}));
|
|
2295
|
-
|
|
2296
2070
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.startIconSlot && (_ref = {}, _ref[config.startIconSlot] = startIcon, _ref), config.endIconSlot && (_ref2 = {}, _ref2[config.endIconSlot] = endIcon, _ref2), (_extends2 = {}, _extends2[config.contentSlot] = children, _extends2));
|
|
2297
|
-
|
|
2298
2071
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2299
2072
|
as: !!link ? "a" : "button",
|
|
2300
2073
|
props: _extends({}, omit.apply(void 0, [rest].concat(plasmicClass.internalArgProps, plasmicClass.internalVariantProps)), {
|
|
@@ -2337,31 +2110,25 @@ function asAriaCheckboxProps(props) {
|
|
|
2337
2110
|
isSelected: props.isChecked,
|
|
2338
2111
|
defaultSelected: props.defaultChecked
|
|
2339
2112
|
});
|
|
2340
|
-
|
|
2341
2113
|
delete ariaProps["isChecked"];
|
|
2342
2114
|
delete ariaProps["defaultChecked"];
|
|
2343
2115
|
return ariaProps;
|
|
2344
2116
|
}
|
|
2345
|
-
|
|
2346
2117
|
function useCheckbox(plasmicClass, props, config, ref) {
|
|
2347
2118
|
var _overrides, _ref;
|
|
2348
|
-
|
|
2349
2119
|
if (ref === void 0) {
|
|
2350
2120
|
ref = null;
|
|
2351
2121
|
}
|
|
2352
|
-
|
|
2353
2122
|
var children = props.children,
|
|
2354
|
-
|
|
2355
|
-
|
|
2123
|
+
isDisabled = props.isDisabled,
|
|
2124
|
+
isIndeterminate = props.isIndeterminate;
|
|
2356
2125
|
useEnsureSSRProvider();
|
|
2357
2126
|
var inputRef = React.useRef(null);
|
|
2358
2127
|
var rootRef = React.useRef(null);
|
|
2359
2128
|
var ariaProps = asAriaCheckboxProps(props);
|
|
2360
2129
|
var state = toggle.useToggleState(ariaProps);
|
|
2361
|
-
|
|
2362
2130
|
var _useAriaCheckbox = checkbox.useCheckbox(ariaProps, state, inputRef),
|
|
2363
|
-
|
|
2364
|
-
|
|
2131
|
+
inputProps = _useAriaCheckbox.inputProps;
|
|
2365
2132
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
2366
2133
|
def: config.isDisabledVariant,
|
|
2367
2134
|
active: isDisabled
|
|
@@ -2375,7 +2142,6 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2375
2142
|
def: config.noLabelVariant,
|
|
2376
2143
|
active: !children
|
|
2377
2144
|
}));
|
|
2378
|
-
|
|
2379
2145
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2380
2146
|
as: "label",
|
|
2381
2147
|
props: mergeProps(getStyleProps(props), {
|
|
@@ -2387,9 +2153,7 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2387
2153
|
}))), children);
|
|
2388
2154
|
}
|
|
2389
2155
|
}, _overrides);
|
|
2390
|
-
|
|
2391
2156
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.labelSlot ? (_ref = {}, _ref[config.labelSlot] = children, _ref) : {});
|
|
2392
|
-
|
|
2393
2157
|
var plumeState = React.useMemo(function () {
|
|
2394
2158
|
return {
|
|
2395
2159
|
setChecked: function setChecked(checked) {
|
|
@@ -2404,12 +2168,10 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2404
2168
|
},
|
|
2405
2169
|
focus: function focus() {
|
|
2406
2170
|
var _inputRef$current;
|
|
2407
|
-
|
|
2408
2171
|
return (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
2409
2172
|
},
|
|
2410
2173
|
blur: function blur() {
|
|
2411
2174
|
var _inputRef$current2;
|
|
2412
|
-
|
|
2413
2175
|
return (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.blur();
|
|
2414
2176
|
},
|
|
2415
2177
|
setChecked: function setChecked(checked) {
|
|
@@ -2435,7 +2197,6 @@ function useCheckbox(plasmicClass, props, config, ref) {
|
|
|
2435
2197
|
* Will also assign keys to items by their index in the collection,
|
|
2436
2198
|
* and collect the keys of disabled items.
|
|
2437
2199
|
*/
|
|
2438
|
-
|
|
2439
2200
|
function deriveItemsFromChildren(children, opts) {
|
|
2440
2201
|
if (!children) {
|
|
2441
2202
|
return {
|
|
@@ -2443,15 +2204,13 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2443
2204
|
disabledKeys: []
|
|
2444
2205
|
};
|
|
2445
2206
|
}
|
|
2446
|
-
|
|
2447
2207
|
var itemPlumeType = opts.itemPlumeType,
|
|
2448
|
-
|
|
2449
|
-
|
|
2208
|
+
sectionPlumeType = opts.sectionPlumeType,
|
|
2209
|
+
invalidChildError = opts.invalidChildError;
|
|
2210
|
+
// For Plume items without an explicit key, we assign a key as the index
|
|
2450
2211
|
// of the collection.
|
|
2451
|
-
|
|
2452
2212
|
var itemCount = 0;
|
|
2453
2213
|
var sectionCount = 0;
|
|
2454
|
-
|
|
2455
2214
|
var ensureValue = function ensureValue(element) {
|
|
2456
2215
|
if (!propInChild(element, "value")) {
|
|
2457
2216
|
if (opts.requireItemValue && PLUME_STRICT_MODE) {
|
|
@@ -2468,32 +2227,24 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2468
2227
|
return element;
|
|
2469
2228
|
}
|
|
2470
2229
|
};
|
|
2471
|
-
|
|
2472
2230
|
var disabledKeys = [];
|
|
2473
|
-
|
|
2474
2231
|
var flattenedChildren = function flattenedChildren(children) {
|
|
2475
2232
|
return toChildArray(children).flatMap(function (child) {
|
|
2476
2233
|
if (React__default.isValidElement(child)) {
|
|
2477
2234
|
if (child.type === React__default.Fragment) {
|
|
2478
2235
|
return flattenedChildren(child.props.children);
|
|
2479
2236
|
}
|
|
2480
|
-
|
|
2481
2237
|
var type = getPlumeType(child);
|
|
2482
|
-
|
|
2483
2238
|
if (type === itemPlumeType) {
|
|
2484
2239
|
child = ensureValue(child);
|
|
2485
2240
|
var childKey = getItemLikeKey(child);
|
|
2486
|
-
|
|
2487
2241
|
if (getChildProp(child, "isDisabled") && !!childKey) {
|
|
2488
2242
|
disabledKeys.push(childKey);
|
|
2489
2243
|
}
|
|
2490
|
-
|
|
2491
2244
|
return [child];
|
|
2492
2245
|
}
|
|
2493
|
-
|
|
2494
2246
|
if (type === sectionPlumeType) {
|
|
2495
2247
|
var _child$key;
|
|
2496
|
-
|
|
2497
2248
|
return [cloneChild(child, {
|
|
2498
2249
|
// key of section doesn't actually matter, just needs
|
|
2499
2250
|
// to be unique
|
|
@@ -2502,7 +2253,6 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2502
2253
|
})];
|
|
2503
2254
|
}
|
|
2504
2255
|
}
|
|
2505
|
-
|
|
2506
2256
|
if (PLUME_STRICT_MODE) {
|
|
2507
2257
|
throw new Error(invalidChildError != null ? invalidChildError : "Unexpected child");
|
|
2508
2258
|
} else {
|
|
@@ -2510,7 +2260,6 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2510
2260
|
}
|
|
2511
2261
|
});
|
|
2512
2262
|
};
|
|
2513
|
-
|
|
2514
2263
|
return {
|
|
2515
2264
|
items: flattenedChildren(children),
|
|
2516
2265
|
disabledKeys: disabledKeys
|
|
@@ -2518,9 +2267,9 @@ function deriveItemsFromChildren(children, opts) {
|
|
|
2518
2267
|
}
|
|
2519
2268
|
function useDerivedItemsFromChildren(children, opts) {
|
|
2520
2269
|
var itemPlumeType = opts.itemPlumeType,
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2270
|
+
sectionPlumeType = opts.sectionPlumeType,
|
|
2271
|
+
invalidChildError = opts.invalidChildError,
|
|
2272
|
+
requireItemValue = opts.requireItemValue;
|
|
2524
2273
|
return React__default.useMemo(function () {
|
|
2525
2274
|
return deriveItemsFromChildren(children, {
|
|
2526
2275
|
itemPlumeType: itemPlumeType,
|
|
@@ -2534,7 +2283,6 @@ function useDerivedItemsFromChildren(children, opts) {
|
|
|
2534
2283
|
* Given a Collection node, create the React element that we should use
|
|
2535
2284
|
* to render it.
|
|
2536
2285
|
*/
|
|
2537
|
-
|
|
2538
2286
|
function renderCollectionNode(node) {
|
|
2539
2287
|
// node.rendered should already have our item-like or section-like Plume
|
|
2540
2288
|
// component elements, so we just need to clone them with a secret
|
|
@@ -2548,19 +2296,17 @@ function renderCollectionNode(node) {
|
|
|
2548
2296
|
* Renders a item-like or section-like Plume component element into an
|
|
2549
2297
|
* Item or a Section element.
|
|
2550
2298
|
*/
|
|
2551
|
-
|
|
2552
2299
|
function renderAsCollectionChild(child, opts) {
|
|
2553
2300
|
var plumeType = getPlumeType(child);
|
|
2554
|
-
|
|
2555
2301
|
if (plumeType === opts.itemPlumeType) {
|
|
2556
2302
|
var _getChildProp;
|
|
2557
|
-
|
|
2558
|
-
|
|
2303
|
+
var option = child;
|
|
2304
|
+
// We look at the children passed to the item-like element, and derive key
|
|
2559
2305
|
// or textValue from it if it is a string
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2306
|
+
var content = getChildProp(option, "children");
|
|
2307
|
+
// The children render prop needs to return an <Item/>
|
|
2308
|
+
return React__default.createElement(collections.Item
|
|
2309
|
+
// We use ItemLike.value if the user explicitly specified a value,
|
|
2564
2310
|
// and we fallback to key. If the user specified neither, then
|
|
2565
2311
|
// the Collections API will generate a unique key for this item.
|
|
2566
2312
|
, {
|
|
@@ -2575,7 +2321,8 @@ function renderAsCollectionChild(child, opts) {
|
|
|
2575
2321
|
}, option);
|
|
2576
2322
|
} else {
|
|
2577
2323
|
var group = child;
|
|
2578
|
-
return React__default.createElement(collections.Section
|
|
2324
|
+
return React__default.createElement(collections.Section
|
|
2325
|
+
// Note that we are using the whole section-like element as the title
|
|
2579
2326
|
// here, and not group.props.title; we want the entire section-like
|
|
2580
2327
|
// Plume element to end up as Node.rendered.
|
|
2581
2328
|
, {
|
|
@@ -2593,23 +2340,19 @@ function renderAsCollectionChild(child, opts) {
|
|
|
2593
2340
|
});
|
|
2594
2341
|
}
|
|
2595
2342
|
}
|
|
2596
|
-
|
|
2597
2343
|
function getItemLikeKey(element) {
|
|
2598
2344
|
var _getChildProp2;
|
|
2599
|
-
|
|
2600
2345
|
return (_getChildProp2 = getChildProp(element, "value")) != null ? _getChildProp2 : element.key;
|
|
2601
|
-
}
|
|
2602
|
-
|
|
2603
|
-
|
|
2346
|
+
}
|
|
2347
|
+
// PlasmicLoader-aware function to get prop from child.
|
|
2604
2348
|
function getChildProp(child, prop) {
|
|
2605
2349
|
return "componentProps" in child.props ? child.props.componentProps[prop] : child.props[prop];
|
|
2606
|
-
}
|
|
2607
|
-
|
|
2350
|
+
}
|
|
2351
|
+
// PlasmicLoader-aware function to check `if (prop in element.props)`.
|
|
2608
2352
|
function propInChild(child, prop) {
|
|
2609
2353
|
return "componentProps" in child.props ? prop in child.props.componentProps : prop in child.props;
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2354
|
+
}
|
|
2355
|
+
// PlasmicLoader-aware function to clone React element.
|
|
2613
2356
|
function cloneChild(child, props) {
|
|
2614
2357
|
if (child.type.getPlumeType) {
|
|
2615
2358
|
// If React element has getPlumeType(), assume that it is PlasmicLoader,
|
|
@@ -2620,7 +2363,6 @@ function cloneChild(child, props) {
|
|
|
2620
2363
|
key: props.key
|
|
2621
2364
|
} : {}));
|
|
2622
2365
|
}
|
|
2623
|
-
|
|
2624
2366
|
return React__default.cloneElement(child, props);
|
|
2625
2367
|
}
|
|
2626
2368
|
|
|
@@ -2636,18 +2378,15 @@ var COLLECTION_OPTS = {
|
|
|
2636
2378
|
/**
|
|
2637
2379
|
* Converts props from BaseMenuProps to react-aria's useMenu() props.
|
|
2638
2380
|
*/
|
|
2639
|
-
|
|
2640
2381
|
function asAriaMenuProps(props) {
|
|
2641
2382
|
var children = props.children,
|
|
2642
|
-
|
|
2643
|
-
|
|
2383
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$5);
|
|
2644
2384
|
var _useDerivedItemsFromC = useDerivedItemsFromChildren(children, _extends({}, COLLECTION_OPTS, {
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2385
|
+
invalidChildError: "Can only use Menu.Item and Menu.Group as children to Menu",
|
|
2386
|
+
requireItemValue: false
|
|
2387
|
+
})),
|
|
2388
|
+
items = _useDerivedItemsFromC.items,
|
|
2389
|
+
disabledKeys = _useDerivedItemsFromC.disabledKeys;
|
|
2651
2390
|
var collectionChildRenderer = React.useCallback(function (child) {
|
|
2652
2391
|
return renderAsCollectionChild(child, COLLECTION_OPTS);
|
|
2653
2392
|
}, []);
|
|
@@ -2659,38 +2398,29 @@ function asAriaMenuProps(props) {
|
|
|
2659
2398
|
})
|
|
2660
2399
|
};
|
|
2661
2400
|
}
|
|
2662
|
-
|
|
2663
2401
|
function useMenu(plasmicClass, props, config, ref) {
|
|
2664
2402
|
var _overrides, _extends2;
|
|
2665
|
-
|
|
2666
2403
|
if (ref === void 0) {
|
|
2667
2404
|
ref = null;
|
|
2668
2405
|
}
|
|
2669
|
-
|
|
2670
2406
|
useEnsureSSRProvider();
|
|
2671
|
-
|
|
2672
2407
|
var _asAriaMenuProps = asAriaMenuProps(props),
|
|
2673
|
-
|
|
2674
|
-
|
|
2408
|
+
ariaProps = _asAriaMenuProps.ariaProps;
|
|
2675
2409
|
var triggerContext = React.useContext(TriggeredOverlayContext);
|
|
2676
2410
|
var rootRef = React.useRef(null);
|
|
2677
2411
|
var state = tree.useTreeState(ariaProps);
|
|
2678
2412
|
var menuListRef = React.useRef(null);
|
|
2679
|
-
|
|
2680
2413
|
var _useAriaMenu = menu.useMenu(_extends({}, ariaProps, {
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2414
|
+
autoFocus: triggerContext == null ? void 0 : triggerContext.autoFocus
|
|
2415
|
+
}), state, menuListRef),
|
|
2416
|
+
menuProps = _useAriaMenu.menuProps;
|
|
2685
2417
|
var contextValue = React.useMemo(function () {
|
|
2686
2418
|
return {
|
|
2687
2419
|
state: state,
|
|
2688
2420
|
menuProps: props
|
|
2689
2421
|
};
|
|
2690
2422
|
}, [state, props]);
|
|
2691
|
-
|
|
2692
2423
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)));
|
|
2693
|
-
|
|
2694
2424
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2695
2425
|
props: mergeProps(getStyleProps(props), {
|
|
2696
2426
|
ref: rootRef
|
|
@@ -2702,13 +2432,11 @@ function useMenu(plasmicClass, props, config, ref) {
|
|
|
2702
2432
|
style: _extends({}, noOutline())
|
|
2703
2433
|
})
|
|
2704
2434
|
}, _overrides);
|
|
2705
|
-
|
|
2706
2435
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.itemsSlot] = React.createElement(MenuContext.Provider, {
|
|
2707
2436
|
value: contextValue
|
|
2708
2437
|
}, Array.from(state.collection).map(function (node) {
|
|
2709
2438
|
return renderCollectionNode(node);
|
|
2710
2439
|
})), _extends2));
|
|
2711
|
-
|
|
2712
2440
|
var plumeState = React.useMemo(function () {
|
|
2713
2441
|
return {
|
|
2714
2442
|
getFocusedValue: function getFocusedValue() {
|
|
@@ -2744,30 +2472,24 @@ function useMenu(plasmicClass, props, config, ref) {
|
|
|
2744
2472
|
|
|
2745
2473
|
function useMenuGroup(plasmicClass, props, config) {
|
|
2746
2474
|
var _extends2, _overrides;
|
|
2747
|
-
|
|
2748
2475
|
var context = React.useContext(MenuContext);
|
|
2749
2476
|
var node = props._node;
|
|
2750
|
-
|
|
2751
2477
|
if (!context || !node) {
|
|
2752
2478
|
if (PLUME_STRICT_MODE) {
|
|
2753
2479
|
throw new Error("You can only use a Menu.Group within a Menu component.");
|
|
2754
2480
|
}
|
|
2755
|
-
|
|
2756
2481
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
2757
2482
|
}
|
|
2758
|
-
|
|
2759
2483
|
var _useMenuSection = menu.useMenuSection({
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2484
|
+
heading: props.title,
|
|
2485
|
+
"aria-label": props["aria-label"]
|
|
2486
|
+
}),
|
|
2487
|
+
headingProps = _useMenuSection.headingProps,
|
|
2488
|
+
groupProps = _useMenuSection.groupProps;
|
|
2766
2489
|
var _useSeparator = separator.useSeparator({
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2490
|
+
elementType: "li"
|
|
2491
|
+
}),
|
|
2492
|
+
separatorProps = _useSeparator.separatorProps;
|
|
2771
2493
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
2772
2494
|
def: config.noTitleVariant,
|
|
2773
2495
|
active: !props.title
|
|
@@ -2775,11 +2497,9 @@ function useMenuGroup(plasmicClass, props, config) {
|
|
|
2775
2497
|
def: config.isFirstVariant,
|
|
2776
2498
|
active: context.state.collection.getFirstKey() === node.key
|
|
2777
2499
|
}));
|
|
2778
|
-
|
|
2779
2500
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.titleSlot] = props.title, _extends2[config.itemsSlot] = Array.from(node.childNodes).map(function (childNode) {
|
|
2780
2501
|
return renderCollectionNode(childNode);
|
|
2781
2502
|
}), _extends2));
|
|
2782
|
-
|
|
2783
2503
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2784
2504
|
props: getStyleProps(props)
|
|
2785
2505
|
}, _overrides[config.separator] = {
|
|
@@ -2808,45 +2528,39 @@ function useMenuGroup(plasmicClass, props, config) {
|
|
|
2808
2528
|
|
|
2809
2529
|
function useMenuItem(plasmicClass, props, config) {
|
|
2810
2530
|
var _extends2, _overrides;
|
|
2811
|
-
|
|
2812
2531
|
var menuContext = React.useContext(MenuContext);
|
|
2813
2532
|
var triggerContext = React.useContext(TriggeredOverlayContext);
|
|
2814
|
-
|
|
2815
2533
|
if (!menuContext) {
|
|
2816
2534
|
if (PLUME_STRICT_MODE) {
|
|
2817
2535
|
throw new Error("You can only use a Menu.Item within a Menu component.");
|
|
2818
2536
|
}
|
|
2819
|
-
|
|
2820
2537
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
2821
2538
|
}
|
|
2822
|
-
|
|
2823
2539
|
var children = props.children,
|
|
2824
|
-
|
|
2540
|
+
onAction = props.onAction;
|
|
2825
2541
|
var state = menuContext.state,
|
|
2826
|
-
|
|
2827
|
-
|
|
2542
|
+
menuProps = menuContext.menuProps;
|
|
2543
|
+
// We pass in the Node secretly as an undocumented prop from <Select />
|
|
2828
2544
|
var node = props._node;
|
|
2829
2545
|
var isDisabled = state.disabledKeys.has(node.key);
|
|
2830
2546
|
var isHighlighted = state.selectionManager.isFocused && state.selectionManager.focusedKey === node.key;
|
|
2831
2547
|
var ref = React.useRef(null);
|
|
2832
|
-
|
|
2833
2548
|
var _useAriaMenuItem = menu.useMenuItem(mergeProps({
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2549
|
+
// We need to merge both the onAction on MenuItem and the onAction
|
|
2550
|
+
// on Menu
|
|
2551
|
+
onAction: onAction
|
|
2552
|
+
}, {
|
|
2553
|
+
onAction: menuProps.onAction,
|
|
2554
|
+
onClose: triggerContext == null ? void 0 : triggerContext.state.close
|
|
2555
|
+
}, {
|
|
2556
|
+
isDisabled: isDisabled,
|
|
2557
|
+
"aria-label": node && node["aria-label"],
|
|
2558
|
+
key: node.key,
|
|
2559
|
+
isVirtualized: false,
|
|
2560
|
+
closeOnSelect: true
|
|
2561
|
+
}), state, ref),
|
|
2562
|
+
menuItemProps = _useAriaMenuItem.menuItemProps,
|
|
2563
|
+
labelProps = _useAriaMenuItem.labelProps;
|
|
2850
2564
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
2851
2565
|
def: config.isDisabledVariant,
|
|
2852
2566
|
active: isDisabled
|
|
@@ -2854,9 +2568,7 @@ function useMenuItem(plasmicClass, props, config) {
|
|
|
2854
2568
|
def: config.isHighlightedVariant,
|
|
2855
2569
|
active: isHighlighted
|
|
2856
2570
|
}));
|
|
2857
|
-
|
|
2858
2571
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.labelSlot] = children, _extends2));
|
|
2859
|
-
|
|
2860
2572
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
2861
2573
|
as: "li",
|
|
2862
2574
|
props: mergeProps(menuItemProps, {
|
|
@@ -2879,48 +2591,38 @@ function useMenuItem(plasmicClass, props, config) {
|
|
|
2879
2591
|
* A menu trigger hook that combines react-aria's useMenuTrigger, useAriaMenuTrigger,
|
|
2880
2592
|
* useOverlayPosition, useOverlay, and usePress
|
|
2881
2593
|
*/
|
|
2882
|
-
|
|
2883
2594
|
function useMenuTrigger(opts, state) {
|
|
2884
2595
|
var triggerRef = opts.triggerRef,
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2596
|
+
isDisabled = opts.isDisabled,
|
|
2597
|
+
placement = opts.placement,
|
|
2598
|
+
menuMatchTriggerWidth = opts.menuMatchTriggerWidth,
|
|
2599
|
+
menuWidth = opts.menuWidth,
|
|
2600
|
+
menu$1 = opts.menu;
|
|
2891
2601
|
var _useAriaMenuTrigger = menu.useMenuTrigger({
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2602
|
+
type: "menu",
|
|
2603
|
+
isDisabled: isDisabled
|
|
2604
|
+
}, state, triggerRef),
|
|
2605
|
+
triggerPressProps = _useAriaMenuTrigger.menuTriggerProps,
|
|
2606
|
+
menuProps = _useAriaMenuTrigger.menuProps;
|
|
2898
2607
|
var _usePress = interactions.usePress(_extends({}, triggerPressProps, {
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2608
|
+
isDisabled: isDisabled
|
|
2609
|
+
})),
|
|
2610
|
+
triggerProps = _usePress.pressProps;
|
|
2903
2611
|
var makeMenu = function makeMenu() {
|
|
2904
2612
|
var realMenu = typeof menu$1 === "function" ? menu$1() : menu$1;
|
|
2905
|
-
|
|
2906
2613
|
if (!realMenu) {
|
|
2907
2614
|
return null;
|
|
2908
2615
|
}
|
|
2909
|
-
|
|
2910
2616
|
if (getPlumeType(realMenu) !== "menu") {
|
|
2911
2617
|
if (PLUME_STRICT_MODE) {
|
|
2912
2618
|
throw new Error("Must use an instance of the Menu component.");
|
|
2913
2619
|
}
|
|
2914
|
-
|
|
2915
2620
|
return null;
|
|
2916
2621
|
}
|
|
2917
|
-
|
|
2918
2622
|
return React.cloneElement(realMenu, mergeProps(realMenu.props, menuProps));
|
|
2919
2623
|
};
|
|
2920
|
-
|
|
2921
2624
|
var triggerContext = React.useMemo(function () {
|
|
2922
2625
|
var _state$focusStrategy;
|
|
2923
|
-
|
|
2924
2626
|
return {
|
|
2925
2627
|
triggerRef: triggerRef,
|
|
2926
2628
|
state: state,
|
|
@@ -2940,11 +2642,11 @@ function useMenuTrigger(opts, state) {
|
|
|
2940
2642
|
|
|
2941
2643
|
function DropdownMenu(props) {
|
|
2942
2644
|
var isOpen = props.isOpen,
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2645
|
+
defaultOpen = props.defaultOpen,
|
|
2646
|
+
onOpenChange = props.onOpenChange,
|
|
2647
|
+
children = props.children,
|
|
2648
|
+
placement = props.placement,
|
|
2649
|
+
menu = props.menu;
|
|
2948
2650
|
var triggerRef = React.useRef(null);
|
|
2949
2651
|
var state = menu$1.useMenuTriggerState({
|
|
2950
2652
|
isOpen: isOpen,
|
|
@@ -2952,16 +2654,14 @@ function DropdownMenu(props) {
|
|
|
2952
2654
|
onOpenChange: onOpenChange,
|
|
2953
2655
|
shouldFlip: true
|
|
2954
2656
|
});
|
|
2955
|
-
|
|
2956
2657
|
var _useMenuTrigger = useMenuTrigger({
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2658
|
+
triggerRef: triggerRef,
|
|
2659
|
+
placement: placement,
|
|
2660
|
+
menu: menu
|
|
2661
|
+
}, state),
|
|
2662
|
+
triggerProps = _useMenuTrigger.triggerProps,
|
|
2663
|
+
makeMenu = _useMenuTrigger.makeMenu,
|
|
2664
|
+
triggerContext = _useMenuTrigger.triggerContext;
|
|
2965
2665
|
return React.createElement(TriggeredOverlayContext.Provider, {
|
|
2966
2666
|
value: triggerContext
|
|
2967
2667
|
}, React.cloneElement(children, mergeProps(children.props, triggerProps, {
|
|
@@ -2971,20 +2671,18 @@ function DropdownMenu(props) {
|
|
|
2971
2671
|
|
|
2972
2672
|
function useMenuButton(plasmicClass, props, config, outerRef) {
|
|
2973
2673
|
var _extends2, _overrides;
|
|
2974
|
-
|
|
2975
2674
|
if (outerRef === void 0) {
|
|
2976
2675
|
outerRef = null;
|
|
2977
2676
|
}
|
|
2978
|
-
|
|
2979
2677
|
var placement = props.placement,
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2678
|
+
isOpen = props.isOpen,
|
|
2679
|
+
defaultOpen = props.defaultOpen,
|
|
2680
|
+
onOpenChange = props.onOpenChange,
|
|
2681
|
+
isDisabled = props.isDisabled,
|
|
2682
|
+
menu = props.menu,
|
|
2683
|
+
autoFocus = props.autoFocus,
|
|
2684
|
+
menuMatchTriggerWidth = props.menuMatchTriggerWidth,
|
|
2685
|
+
menuWidth = props.menuWidth;
|
|
2988
2686
|
useEnsureSSRProvider();
|
|
2989
2687
|
var rootRef = React.useRef(null);
|
|
2990
2688
|
var triggerRef = React.useRef(null);
|
|
@@ -2994,22 +2692,19 @@ function useMenuButton(plasmicClass, props, config, outerRef) {
|
|
|
2994
2692
|
onOpenChange: onOpenChange,
|
|
2995
2693
|
shouldFlip: true
|
|
2996
2694
|
});
|
|
2997
|
-
|
|
2998
2695
|
var _useMenuTrigger = useMenuTrigger({
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
2696
|
+
isDisabled: isDisabled,
|
|
2697
|
+
triggerRef: triggerRef,
|
|
2698
|
+
placement: placement,
|
|
2699
|
+
menuMatchTriggerWidth: menuMatchTriggerWidth,
|
|
2700
|
+
menuWidth: menuWidth,
|
|
2701
|
+
menu: menu
|
|
2702
|
+
}, state),
|
|
2703
|
+
triggerProps = _useMenuTrigger.triggerProps,
|
|
2704
|
+
makeMenu = _useMenuTrigger.makeMenu,
|
|
2705
|
+
triggerContext = _useMenuTrigger.triggerContext;
|
|
3010
2706
|
var _useFocusable = focus.useFocusable(props, triggerRef),
|
|
3011
|
-
|
|
3012
|
-
|
|
2707
|
+
triggerFocusProps = _useFocusable.focusableProps;
|
|
3013
2708
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3014
2709
|
def: config.isOpenVariant,
|
|
3015
2710
|
active: state.isOpen
|
|
@@ -3017,9 +2712,7 @@ function useMenuButton(plasmicClass, props, config, outerRef) {
|
|
|
3017
2712
|
def: config.isDisabledVariant,
|
|
3018
2713
|
active: isDisabled
|
|
3019
2714
|
}));
|
|
3020
|
-
|
|
3021
2715
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.menuSlot] = state.isOpen ? makeMenu() : undefined, _extends2));
|
|
3022
|
-
|
|
3023
2716
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3024
2717
|
wrapChildren: function wrapChildren(children) {
|
|
3025
2718
|
return React.createElement(TriggeredOverlayContext.Provider, {
|
|
@@ -3122,21 +2815,18 @@ var COLLECTION_OPTS$1 = {
|
|
|
3122
2815
|
* with the secret derived `_node` prop. That means Option and OptionGroup
|
|
3123
2816
|
* render functions can assume that _node is passed in.
|
|
3124
2817
|
*/
|
|
3125
|
-
|
|
3126
2818
|
function useAriaSelectProps(props) {
|
|
3127
2819
|
var value = props.value,
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
2820
|
+
defaultValue = props.defaultValue,
|
|
2821
|
+
children = props.children,
|
|
2822
|
+
onChange = props.onChange,
|
|
2823
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$6);
|
|
3133
2824
|
var _useDerivedItemsFromC = useDerivedItemsFromChildren(children, _extends({}, COLLECTION_OPTS$1, {
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
2825
|
+
invalidChildError: "Can only use Select.Option and Select.OptionGroup as children to Select",
|
|
2826
|
+
requireItemValue: true
|
|
2827
|
+
})),
|
|
2828
|
+
items = _useDerivedItemsFromC.items,
|
|
2829
|
+
disabledKeys = _useDerivedItemsFromC.disabledKeys;
|
|
3140
2830
|
var collectionChildRenderer = React.useCallback(function (child) {
|
|
3141
2831
|
return renderAsCollectionChild(child, COLLECTION_OPTS$1);
|
|
3142
2832
|
}, []);
|
|
@@ -3161,42 +2851,33 @@ function useAriaSelectProps(props) {
|
|
|
3161
2851
|
})
|
|
3162
2852
|
};
|
|
3163
2853
|
}
|
|
3164
|
-
|
|
3165
2854
|
function useSelect(plasmicClass, props, config, ref) {
|
|
3166
2855
|
var _overrides, _extends2;
|
|
3167
|
-
|
|
3168
2856
|
if (ref === void 0) {
|
|
3169
2857
|
ref = null;
|
|
3170
2858
|
}
|
|
3171
|
-
|
|
3172
2859
|
useEnsureSSRProvider();
|
|
3173
|
-
|
|
3174
2860
|
var _useAriaSelectProps = useAriaSelectProps(props),
|
|
3175
|
-
|
|
3176
|
-
|
|
2861
|
+
ariaProps = _useAriaSelectProps.ariaProps;
|
|
3177
2862
|
var placement = props.placement;
|
|
3178
2863
|
var state = select$1.useSelectState(ariaProps);
|
|
3179
2864
|
var triggerRef = React.useRef(null);
|
|
3180
2865
|
var rootRef = React.useRef(null);
|
|
3181
2866
|
var isDisabled = props.isDisabled,
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
2867
|
+
name = props.name,
|
|
2868
|
+
menuWidth = props.menuWidth,
|
|
2869
|
+
menuMatchTriggerWidth = props.menuMatchTriggerWidth,
|
|
2870
|
+
autoFocus = props.autoFocus,
|
|
2871
|
+
placeholder = props.placeholder,
|
|
2872
|
+
selectedContent = props.selectedContent;
|
|
3189
2873
|
var _useAriaSelect = select.useSelect(ariaProps, state, triggerRef),
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
2874
|
+
triggerPressProps = _useAriaSelect.triggerProps,
|
|
2875
|
+
menuProps = _useAriaSelect.menuProps;
|
|
3193
2876
|
var _usePress = interactions.usePress(_extends({}, triggerPressProps, {
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
2877
|
+
isDisabled: isDisabled
|
|
2878
|
+
})),
|
|
2879
|
+
triggerProps = _usePress.pressProps;
|
|
3198
2880
|
var triggerContent = state.selectedItem ? selectedContent != null ? selectedContent : getChildProp(state.selectedItem.value, "children") : null;
|
|
3199
|
-
|
|
3200
2881
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3201
2882
|
def: config.isOpenVariant,
|
|
3202
2883
|
active: state.isOpen
|
|
@@ -3207,7 +2888,6 @@ function useSelect(plasmicClass, props, config, ref) {
|
|
|
3207
2888
|
def: config.isDisabledVariant,
|
|
3208
2889
|
active: isDisabled
|
|
3209
2890
|
}));
|
|
3210
|
-
|
|
3211
2891
|
var triggerContext = React.useMemo(function () {
|
|
3212
2892
|
return {
|
|
3213
2893
|
triggerRef: triggerRef,
|
|
@@ -3252,13 +2932,11 @@ function useSelect(plasmicClass, props, config, ref) {
|
|
|
3252
2932
|
}, content);
|
|
3253
2933
|
}
|
|
3254
2934
|
}, _overrides);
|
|
3255
|
-
|
|
3256
2935
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.triggerContentSlot] = triggerContent, _extends2[config.placeholderSlot] = placeholder, _extends2[config.optionsSlot] = React.createElement(SelectContext.Provider, {
|
|
3257
2936
|
value: state
|
|
3258
2937
|
}, Array.from(state.collection).map(function (node) {
|
|
3259
2938
|
return renderCollectionNode(node);
|
|
3260
2939
|
})), _extends2));
|
|
3261
|
-
|
|
3262
2940
|
var plumeState = React.useMemo(function () {
|
|
3263
2941
|
return {
|
|
3264
2942
|
open: function open() {
|
|
@@ -3288,12 +2966,10 @@ function useSelect(plasmicClass, props, config, ref) {
|
|
|
3288
2966
|
},
|
|
3289
2967
|
focus: function focus() {
|
|
3290
2968
|
var _triggerRef$current;
|
|
3291
|
-
|
|
3292
2969
|
return (_triggerRef$current = triggerRef.current) == null ? void 0 : _triggerRef$current.focus();
|
|
3293
2970
|
},
|
|
3294
2971
|
blur: function blur() {
|
|
3295
2972
|
var _triggerRef$current2;
|
|
3296
|
-
|
|
3297
2973
|
return (_triggerRef$current2 = triggerRef.current) == null ? void 0 : _triggerRef$current2.blur();
|
|
3298
2974
|
},
|
|
3299
2975
|
open: function open() {
|
|
@@ -3322,20 +2998,17 @@ function useSelect(plasmicClass, props, config, ref) {
|
|
|
3322
2998
|
state: plumeState
|
|
3323
2999
|
};
|
|
3324
3000
|
}
|
|
3325
|
-
|
|
3326
3001
|
function ListBoxWrapper(props) {
|
|
3327
3002
|
var state = props.state,
|
|
3328
|
-
|
|
3329
|
-
|
|
3003
|
+
menuProps = props.menuProps,
|
|
3004
|
+
children = props.children;
|
|
3330
3005
|
var ref = React.useRef(null);
|
|
3331
|
-
|
|
3332
3006
|
var _useListBox = listbox.useListBox(_extends({}, menuProps, {
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3007
|
+
isVirtualized: false,
|
|
3008
|
+
autoFocus: state.focusStrategy || true,
|
|
3009
|
+
disallowEmptySelection: true
|
|
3010
|
+
}), state, ref),
|
|
3011
|
+
listBoxProps = _useListBox.listBoxProps;
|
|
3339
3012
|
return React.cloneElement(children, mergeProps(children.props, listBoxProps, {
|
|
3340
3013
|
style: noOutline(),
|
|
3341
3014
|
ref: ref
|
|
@@ -3344,13 +3017,10 @@ function ListBoxWrapper(props) {
|
|
|
3344
3017
|
|
|
3345
3018
|
function useSelectOption(plasmicClass, props, config, outerRef) {
|
|
3346
3019
|
var _extends2, _overrides;
|
|
3347
|
-
|
|
3348
3020
|
if (outerRef === void 0) {
|
|
3349
3021
|
outerRef = null;
|
|
3350
3022
|
}
|
|
3351
|
-
|
|
3352
3023
|
var state = React.useContext(SelectContext);
|
|
3353
|
-
|
|
3354
3024
|
if (!state) {
|
|
3355
3025
|
// If no context, then we are being incorrectly used. Complain or just don't
|
|
3356
3026
|
// bother installing any hooks. It's okay to violate rules of hooks here
|
|
@@ -3358,31 +3028,27 @@ function useSelectOption(plasmicClass, props, config, outerRef) {
|
|
|
3358
3028
|
if (PLUME_STRICT_MODE) {
|
|
3359
3029
|
throw new Error("You can only use a Select.Option within a Select component.");
|
|
3360
3030
|
}
|
|
3361
|
-
|
|
3362
3031
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
3363
3032
|
}
|
|
3364
|
-
|
|
3365
3033
|
var children = props.children;
|
|
3366
3034
|
var rootRef = React.useRef(null);
|
|
3367
|
-
var onRef = mergeRefs(rootRef, outerRef);
|
|
3368
|
-
|
|
3035
|
+
var onRef = mergeRefs(rootRef, outerRef);
|
|
3036
|
+
// We pass in the Node secretly as an undocumented prop from <Select />
|
|
3369
3037
|
var node = props._node;
|
|
3370
3038
|
var isSelected = state.selectionManager.isSelected(node.key);
|
|
3371
3039
|
var isDisabled = state.disabledKeys.has(node.key);
|
|
3372
3040
|
var isHighlighted = state.selectionManager.isFocused && state.selectionManager.focusedKey === node.key;
|
|
3373
|
-
|
|
3374
3041
|
var _useAriaOption = listbox.useOption({
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3042
|
+
isSelected: isSelected,
|
|
3043
|
+
isDisabled: isDisabled,
|
|
3044
|
+
"aria-label": node && node["aria-label"],
|
|
3045
|
+
key: node.key,
|
|
3046
|
+
shouldSelectOnPressUp: true,
|
|
3047
|
+
shouldFocusOnHover: true,
|
|
3048
|
+
isVirtualized: false
|
|
3049
|
+
}, state, rootRef),
|
|
3050
|
+
optionProps = _useAriaOption.optionProps,
|
|
3051
|
+
labelProps = _useAriaOption.labelProps;
|
|
3386
3052
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3387
3053
|
def: config.isSelectedVariant,
|
|
3388
3054
|
active: isSelected
|
|
@@ -3393,9 +3059,7 @@ function useSelectOption(plasmicClass, props, config, outerRef) {
|
|
|
3393
3059
|
def: config.isHighlightedVariant,
|
|
3394
3060
|
active: isHighlighted
|
|
3395
3061
|
}));
|
|
3396
|
-
|
|
3397
3062
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.labelSlot] = children, _extends2));
|
|
3398
|
-
|
|
3399
3063
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3400
3064
|
props: mergeProps(optionProps, getStyleProps(props), {
|
|
3401
3065
|
ref: onRef,
|
|
@@ -3415,32 +3079,26 @@ function useSelectOption(plasmicClass, props, config, outerRef) {
|
|
|
3415
3079
|
|
|
3416
3080
|
function useSelectOptionGroup(plasmicClass, props, config) {
|
|
3417
3081
|
var _extends2, _overrides;
|
|
3418
|
-
|
|
3419
|
-
|
|
3082
|
+
var state = React.useContext(SelectContext);
|
|
3083
|
+
// `node` should exist if the OptionGroup was instantiated properly
|
|
3420
3084
|
// within a Select
|
|
3421
|
-
|
|
3422
3085
|
var node = props._node;
|
|
3423
|
-
|
|
3424
3086
|
if (!state || !node) {
|
|
3425
3087
|
if (PLUME_STRICT_MODE) {
|
|
3426
3088
|
throw new Error("You can only use a Select.OptionGroup within a Select component.");
|
|
3427
3089
|
}
|
|
3428
|
-
|
|
3429
3090
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
3430
3091
|
}
|
|
3431
|
-
|
|
3432
3092
|
var _useListBoxSection = listbox.useListBoxSection({
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3093
|
+
heading: props.title,
|
|
3094
|
+
"aria-label": props["aria-label"]
|
|
3095
|
+
}),
|
|
3096
|
+
headingProps = _useListBoxSection.headingProps,
|
|
3097
|
+
groupProps = _useListBoxSection.groupProps;
|
|
3439
3098
|
var _useSeparator = separator.useSeparator({
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3099
|
+
elementType: "li"
|
|
3100
|
+
}),
|
|
3101
|
+
separatorProps = _useSeparator.separatorProps;
|
|
3444
3102
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3445
3103
|
def: config.noTitleVariant,
|
|
3446
3104
|
active: !props.title
|
|
@@ -3448,11 +3106,9 @@ function useSelectOptionGroup(plasmicClass, props, config) {
|
|
|
3448
3106
|
def: config.isFirstVariant,
|
|
3449
3107
|
active: state.collection.getFirstKey() === node.key
|
|
3450
3108
|
}));
|
|
3451
|
-
|
|
3452
3109
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.titleSlot] = props.title, _extends2[config.optionsSlot] = Array.from(node.childNodes).map(function (childNode) {
|
|
3453
3110
|
return renderCollectionNode(childNode);
|
|
3454
3111
|
}), _extends2));
|
|
3455
|
-
|
|
3456
3112
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3457
3113
|
props: getStyleProps(props)
|
|
3458
3114
|
}, _overrides[config.separator] = {
|
|
@@ -3482,30 +3138,24 @@ function asAriaSwitchProps(props) {
|
|
|
3482
3138
|
isSelected: props.isChecked,
|
|
3483
3139
|
defaultSelected: props.defaultChecked
|
|
3484
3140
|
});
|
|
3485
|
-
|
|
3486
3141
|
delete ariaProps["isChecked"];
|
|
3487
3142
|
delete ariaProps["defaultChecked"];
|
|
3488
3143
|
return ariaProps;
|
|
3489
3144
|
}
|
|
3490
|
-
|
|
3491
3145
|
function useSwitch(plasmicClass, props, config, ref) {
|
|
3492
3146
|
var _overrides, _ref;
|
|
3493
|
-
|
|
3494
3147
|
if (ref === void 0) {
|
|
3495
3148
|
ref = null;
|
|
3496
3149
|
}
|
|
3497
|
-
|
|
3498
3150
|
var children = props.children,
|
|
3499
|
-
|
|
3151
|
+
isDisabled = props.isDisabled;
|
|
3500
3152
|
useEnsureSSRProvider();
|
|
3501
3153
|
var inputRef = React.useRef(null);
|
|
3502
3154
|
var rootRef = React.useRef(null);
|
|
3503
3155
|
var ariaProps = asAriaSwitchProps(props);
|
|
3504
3156
|
var state = toggle.useToggleState(ariaProps);
|
|
3505
|
-
|
|
3506
3157
|
var _useAriaSwitch = _switch.useSwitch(ariaProps, state, inputRef),
|
|
3507
|
-
|
|
3508
|
-
|
|
3158
|
+
inputProps = _useAriaSwitch.inputProps;
|
|
3509
3159
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3510
3160
|
def: config.isDisabledVariant,
|
|
3511
3161
|
active: isDisabled
|
|
@@ -3516,7 +3166,6 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3516
3166
|
def: config.noLabelVariant,
|
|
3517
3167
|
active: !children
|
|
3518
3168
|
}));
|
|
3519
|
-
|
|
3520
3169
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3521
3170
|
as: "label",
|
|
3522
3171
|
props: mergeProps(getStyleProps(props), {
|
|
@@ -3528,9 +3177,7 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3528
3177
|
}))), children);
|
|
3529
3178
|
}
|
|
3530
3179
|
}, _overrides);
|
|
3531
|
-
|
|
3532
3180
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.labelSlot ? (_ref = {}, _ref[config.labelSlot] = children, _ref) : {});
|
|
3533
|
-
|
|
3534
3181
|
var plumeState = React.useMemo(function () {
|
|
3535
3182
|
return {
|
|
3536
3183
|
setChecked: function setChecked(checked) {
|
|
@@ -3545,12 +3192,10 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3545
3192
|
},
|
|
3546
3193
|
focus: function focus() {
|
|
3547
3194
|
var _inputRef$current;
|
|
3548
|
-
|
|
3549
3195
|
return (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3550
3196
|
},
|
|
3551
3197
|
blur: function blur() {
|
|
3552
3198
|
var _inputRef$current2;
|
|
3553
|
-
|
|
3554
3199
|
return (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.blur();
|
|
3555
3200
|
},
|
|
3556
3201
|
setChecked: function setChecked(checked) {
|
|
@@ -3571,34 +3216,29 @@ function useSwitch(plasmicClass, props, config, ref) {
|
|
|
3571
3216
|
var _excluded$7 = ["isDisabled", "startIcon", "endIcon", "showStartIcon", "showEndIcon", "className", "style", "inputClassName", "inputStyle"];
|
|
3572
3217
|
function useTextInput(plasmicClass, props, config, ref) {
|
|
3573
3218
|
var _ref, _ref2, _overrides;
|
|
3574
|
-
|
|
3575
3219
|
if (ref === void 0) {
|
|
3576
3220
|
ref = null;
|
|
3577
3221
|
}
|
|
3578
|
-
|
|
3579
3222
|
var isDisabled = props.isDisabled,
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3223
|
+
startIcon = props.startIcon,
|
|
3224
|
+
endIcon = props.endIcon,
|
|
3225
|
+
showStartIcon = props.showStartIcon,
|
|
3226
|
+
showEndIcon = props.showEndIcon,
|
|
3227
|
+
className = props.className,
|
|
3228
|
+
style = props.style,
|
|
3229
|
+
inputClassName = props.inputClassName,
|
|
3230
|
+
inputStyle = props.inputStyle,
|
|
3231
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$7);
|
|
3590
3232
|
var rootRef = React.useRef(null);
|
|
3591
3233
|
var inputRef = React.useRef(null);
|
|
3592
3234
|
React.useImperativeHandle(ref, function () {
|
|
3593
3235
|
return {
|
|
3594
3236
|
focus: function focus() {
|
|
3595
3237
|
var _inputRef$current;
|
|
3596
|
-
|
|
3597
3238
|
(_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3598
3239
|
},
|
|
3599
3240
|
blur: function blur() {
|
|
3600
3241
|
var _inputRef$current2;
|
|
3601
|
-
|
|
3602
3242
|
(_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.blur();
|
|
3603
3243
|
},
|
|
3604
3244
|
getRoot: function getRoot() {
|
|
@@ -3609,7 +3249,6 @@ function useTextInput(plasmicClass, props, config, ref) {
|
|
|
3609
3249
|
}
|
|
3610
3250
|
};
|
|
3611
3251
|
}, [rootRef, inputRef]);
|
|
3612
|
-
|
|
3613
3252
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3614
3253
|
def: config.showStartIconVariant,
|
|
3615
3254
|
active: showStartIcon
|
|
@@ -3620,9 +3259,7 @@ function useTextInput(plasmicClass, props, config, ref) {
|
|
|
3620
3259
|
def: config.isDisabledVariant,
|
|
3621
3260
|
active: isDisabled
|
|
3622
3261
|
}));
|
|
3623
|
-
|
|
3624
3262
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), config.startIconSlot && (_ref = {}, _ref[config.startIconSlot] = startIcon, _ref), config.endIconSlot && (_ref2 = {}, _ref2[config.endIconSlot] = endIcon, _ref2));
|
|
3625
|
-
|
|
3626
3263
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3627
3264
|
props: {
|
|
3628
3265
|
ref: rootRef,
|
|
@@ -3650,19 +3287,15 @@ function useTextInput(plasmicClass, props, config, ref) {
|
|
|
3650
3287
|
|
|
3651
3288
|
function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissable) {
|
|
3652
3289
|
var _extends2, _overrides;
|
|
3653
|
-
|
|
3654
3290
|
if (outerRef === void 0) {
|
|
3655
3291
|
outerRef = null;
|
|
3656
3292
|
}
|
|
3657
|
-
|
|
3658
3293
|
if (isDismissable === void 0) {
|
|
3659
3294
|
isDismissable = true;
|
|
3660
3295
|
}
|
|
3661
|
-
|
|
3662
3296
|
var overlayRef = React.useRef(null);
|
|
3663
3297
|
var onOverlayRef = mergeRefs(overlayRef, outerRef);
|
|
3664
3298
|
var context = React.useContext(TriggeredOverlayContext);
|
|
3665
|
-
|
|
3666
3299
|
if (!context) {
|
|
3667
3300
|
// If no context, then we are not being correctly used. Either complain, or
|
|
3668
3301
|
// exit early. It's okay to exit early and break the rules of React hooks
|
|
@@ -3670,50 +3303,44 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
|
|
|
3670
3303
|
if (PLUME_STRICT_MODE) {
|
|
3671
3304
|
throw new Error("You can only use a triggered overlay with a TriggeredOverlayContext");
|
|
3672
3305
|
}
|
|
3673
|
-
|
|
3674
3306
|
return getDefaultPlasmicProps(plasmicClass, props);
|
|
3675
3307
|
}
|
|
3676
|
-
|
|
3677
3308
|
var children = props.children;
|
|
3678
3309
|
var triggerRef = context.triggerRef,
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3310
|
+
placement = context.placement,
|
|
3311
|
+
overlayMatchTriggerWidth = context.overlayMatchTriggerWidth,
|
|
3312
|
+
overlayMinTriggerWidth = context.overlayMinTriggerWidth,
|
|
3313
|
+
overlayWidth = context.overlayWidth,
|
|
3314
|
+
state = context.state;
|
|
3315
|
+
// Measure the width of the trigger to inform the width of the menu (below).
|
|
3685
3316
|
var _React$useState = React.useState(false),
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3317
|
+
isRendered = _React$useState[0],
|
|
3318
|
+
setRendered = _React$useState[1];
|
|
3689
3319
|
var triggerWidth = triggerRef.current && (overlayMatchTriggerWidth || overlayMinTriggerWidth) ? triggerRef.current.offsetWidth : undefined;
|
|
3690
3320
|
useIsomorphicLayoutEffect(function () {
|
|
3691
3321
|
if (!isRendered && triggerRef.current && (overlayMatchTriggerWidth || overlayMinTriggerWidth)) {
|
|
3692
3322
|
setRendered(true);
|
|
3693
3323
|
}
|
|
3694
3324
|
}, [triggerRef, isRendered, overlayMatchTriggerWidth, overlayMinTriggerWidth]);
|
|
3695
|
-
|
|
3696
3325
|
var _useOverlay = overlays.useOverlay({
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3326
|
+
isOpen: state.isOpen,
|
|
3327
|
+
onClose: state.close,
|
|
3328
|
+
isDismissable: isDismissable,
|
|
3329
|
+
shouldCloseOnBlur: true
|
|
3330
|
+
}, overlayRef),
|
|
3331
|
+
overlayAriaProps = _useOverlay.overlayProps;
|
|
3704
3332
|
var _useOverlayPosition = overlays.useOverlayPosition({
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3333
|
+
targetRef: triggerRef,
|
|
3334
|
+
overlayRef: overlayRef,
|
|
3335
|
+
placement: placement != null ? placement : "bottom left",
|
|
3336
|
+
shouldFlip: true,
|
|
3337
|
+
isOpen: state.isOpen,
|
|
3338
|
+
onClose: state.close,
|
|
3339
|
+
containerPadding: 0
|
|
3340
|
+
}),
|
|
3341
|
+
overlayPositionProps = _useOverlayPosition.overlayProps,
|
|
3342
|
+
updatePosition = _useOverlayPosition.updatePosition,
|
|
3343
|
+
placementAxis = _useOverlayPosition.placement;
|
|
3717
3344
|
useIsomorphicLayoutEffect(function () {
|
|
3718
3345
|
if (state.isOpen) {
|
|
3719
3346
|
requestAnimationFrame(function () {
|
|
@@ -3732,7 +3359,6 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
|
|
|
3732
3359
|
minWidth: overlayMinTriggerWidth ? triggerWidth : "auto"
|
|
3733
3360
|
}
|
|
3734
3361
|
}, overlayAriaProps, overlayPositionProps);
|
|
3735
|
-
|
|
3736
3362
|
var variants = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalVariantProps)), mergeVariantToggles({
|
|
3737
3363
|
def: config.isPlacedTopVariant,
|
|
3738
3364
|
active: placementAxis === "top"
|
|
@@ -3746,13 +3372,11 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
|
|
|
3746
3372
|
def: config.isPlacedRightVariant,
|
|
3747
3373
|
active: placementAxis === "right"
|
|
3748
3374
|
}));
|
|
3749
|
-
|
|
3750
3375
|
var args = _extends({}, pick.apply(void 0, [props].concat(plasmicClass.internalArgProps)), (_extends2 = {}, _extends2[config.contentSlot] = React.createElement(focus.FocusScope, {
|
|
3751
3376
|
restoreFocus: true
|
|
3752
3377
|
}, React.createElement(overlays.DismissButton, {
|
|
3753
3378
|
onDismiss: state.close
|
|
3754
3379
|
}), children), _extends2));
|
|
3755
|
-
|
|
3756
3380
|
var overrides = (_overrides = {}, _overrides[config.root] = {
|
|
3757
3381
|
props: mergeProps(overlayProps, getStyleProps(props), {
|
|
3758
3382
|
ref: onOverlayRef
|
|
@@ -3794,6 +3418,7 @@ exports.PlasmicHead = PlasmicHead;
|
|
|
3794
3418
|
exports.PlasmicIcon = PlasmicIcon;
|
|
3795
3419
|
exports.PlasmicImg = PlasmicImg;
|
|
3796
3420
|
exports.PlasmicLink = PlasmicLink;
|
|
3421
|
+
exports.PlasmicPageGuard = PlasmicPageGuard;
|
|
3797
3422
|
exports.PlasmicRootProvider = PlasmicRootProvider;
|
|
3798
3423
|
exports.PlasmicSlot = PlasmicSlot;
|
|
3799
3424
|
exports.SelectContext = SelectContext;
|
|
@@ -3810,7 +3435,6 @@ exports.generateStateOnChangeProp = generateStateOnChangeProp;
|
|
|
3810
3435
|
exports.generateStateValueProp = generateStateValueProp;
|
|
3811
3436
|
exports.getDataProps = getDataProps;
|
|
3812
3437
|
exports.hasVariant = hasVariant;
|
|
3813
|
-
exports.isNum = isNum;
|
|
3814
3438
|
exports.makeFragment = makeFragment;
|
|
3815
3439
|
exports.mergeVariantsWithStates = mergeVariantsWithStates;
|
|
3816
3440
|
exports.omit = omit;
|
|
@@ -3819,13 +3443,10 @@ exports.plasmicHeadMeta = plasmicHeadMeta;
|
|
|
3819
3443
|
exports.renderPlasmicSlot = renderPlasmicSlot;
|
|
3820
3444
|
exports.set = set;
|
|
3821
3445
|
exports.setPlumeStrictMode = setPlumeStrictMode;
|
|
3822
|
-
exports.shallowEqual = shallowEqual;
|
|
3823
3446
|
exports.useButton = useButton;
|
|
3824
|
-
exports.useCanvasDollarState = useCanvasDollarState;
|
|
3825
3447
|
exports.useCheckbox = useCheckbox;
|
|
3826
3448
|
exports.useDollarState = useDollarState;
|
|
3827
3449
|
exports.useIsSSR = useIsSSR;
|
|
3828
|
-
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect$1;
|
|
3829
3450
|
exports.useMenu = useMenu;
|
|
3830
3451
|
exports.useMenuButton = useMenuButton;
|
|
3831
3452
|
exports.useMenuGroup = useMenuGroup;
|