@plasmicapp/react-web 0.2.145 → 0.2.147
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 +15 -2
- package/dist/react-web.cjs.development.js +142 -107
- 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 +141 -108
- package/dist/react-web.esm.js.map +1 -1
- package/dist/states/graph.d.ts +1 -4
- package/dist/states/helpers.d.ts +9 -1
- package/dist/states/index.d.ts +2 -2
- package/dist/states/types.d.ts +1 -0
- package/package.json +4 -4
- package/skinny/dist/index.js +127 -104
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/states/graph.d.ts +1 -4
- package/skinny/dist/states/helpers.d.ts +9 -1
- package/skinny/dist/states/index.d.ts +2 -2
- package/skinny/dist/states/types.d.ts +1 -0
package/dist/react-web.esm.js
CHANGED
|
@@ -2274,96 +2274,6 @@ function useTrigger(trigger, opts) {
|
|
|
2274
2274
|
var ARRAY_SYMBOL = /*#__PURE__*/Symbol("[]");
|
|
2275
2275
|
var PLASMIC_STATE_PROXY_SYMBOL = /*#__PURE__*/Symbol("plasmic.state.proxy");
|
|
2276
2276
|
|
|
2277
|
-
function generateStateOnChangeProp($state, path) {
|
|
2278
|
-
return function (val) {
|
|
2279
|
-
return set($state, path, val);
|
|
2280
|
-
};
|
|
2281
|
-
}
|
|
2282
|
-
function generateStateValueProp($state, path) {
|
|
2283
|
-
return _get($state, path);
|
|
2284
|
-
}
|
|
2285
|
-
var useIsomorphicLayoutEffect$1 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
2286
|
-
function isPlasmicStateProxy(obj) {
|
|
2287
|
-
return obj != null && typeof obj === "object" && obj[PLASMIC_STATE_PROXY_SYMBOL];
|
|
2288
|
-
}
|
|
2289
|
-
function shallowEqual(a1, a2) {
|
|
2290
|
-
if (a1.length !== a2.length) {
|
|
2291
|
-
return false;
|
|
2292
|
-
}
|
|
2293
|
-
for (var i = 0; i < a1.length; i++) {
|
|
2294
|
-
if (a1[i] !== a2[i]) {
|
|
2295
|
-
return false;
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
return true;
|
|
2299
|
-
}
|
|
2300
|
-
/**
|
|
2301
|
-
* Shallow comparison of arrays.
|
|
2302
|
-
*/
|
|
2303
|
-
function arrayEq(xs, ys) {
|
|
2304
|
-
return xs.length === ys.length && xs.every(function (_, index) {
|
|
2305
|
-
return xs[index] === ys[index];
|
|
2306
|
-
});
|
|
2307
|
-
}
|
|
2308
|
-
function isNum(value) {
|
|
2309
|
-
return typeof value === "symbol" ? false : !isNaN(+value);
|
|
2310
|
-
}
|
|
2311
|
-
function assert(cond, msg) {
|
|
2312
|
-
if (msg === void 0) {
|
|
2313
|
-
msg = "Assertion failed";
|
|
2314
|
-
}
|
|
2315
|
-
if (!cond) {
|
|
2316
|
-
// We always generate an non empty message so that it doesn't get swallowed
|
|
2317
|
-
// by the async library.
|
|
2318
|
-
msg = (typeof msg === "string" ? msg : msg()) || "Assertion failed";
|
|
2319
|
-
debugger;
|
|
2320
|
-
throw new Error(msg);
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
/**
|
|
2324
|
-
* Forked from https://github.com/lukeed/dset
|
|
2325
|
-
* Changes: fixed setting a deep value to a proxy object
|
|
2326
|
-
*/
|
|
2327
|
-
function set(obj, keys, val) {
|
|
2328
|
-
keys = keys.split ? keys.split(".") : keys;
|
|
2329
|
-
var i = 0,
|
|
2330
|
-
l = keys.length,
|
|
2331
|
-
t = obj,
|
|
2332
|
-
x,
|
|
2333
|
-
k;
|
|
2334
|
-
while (i < l) {
|
|
2335
|
-
k = keys[i++];
|
|
2336
|
-
if (k === "__proto__" || k === "constructor" || k === "prototype") break;
|
|
2337
|
-
var newValue = i === l ? val : typeof (x = t[k]) === typeof keys ? x : keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".") ? {} : [];
|
|
2338
|
-
assignValue(t, k, newValue);
|
|
2339
|
-
t = t[k];
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
/**
|
|
2343
|
-
* Forked from lodash
|
|
2344
|
-
*/
|
|
2345
|
-
function baseAssignValue(object, key, value) {
|
|
2346
|
-
if (key == "__proto__") {
|
|
2347
|
-
Object.defineProperty(object, key, {
|
|
2348
|
-
configurable: true,
|
|
2349
|
-
enumerable: true,
|
|
2350
|
-
value: value,
|
|
2351
|
-
writable: true
|
|
2352
|
-
});
|
|
2353
|
-
} else {
|
|
2354
|
-
object[key] = value;
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
function eq(value, other) {
|
|
2358
|
-
return value === other || value !== value && other !== other;
|
|
2359
|
-
}
|
|
2360
|
-
function assignValue(object, key, value) {
|
|
2361
|
-
var objValue = object[key];
|
|
2362
|
-
if (!(Object.prototype.hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
|
|
2363
|
-
baseAssignValue(object, key, value);
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
2277
|
var UNINITIALIZED = /*#__PURE__*/Symbol("plasmic.unitialized");
|
|
2368
2278
|
var StateSpecNode = /*#__PURE__*/function () {
|
|
2369
2279
|
function StateSpecNode(specs) {
|
|
@@ -2420,14 +2330,7 @@ var StateSpecNode = /*#__PURE__*/function () {
|
|
|
2420
2330
|
this._state = {};
|
|
2421
2331
|
};
|
|
2422
2332
|
_proto.states = function states() {
|
|
2423
|
-
return Object.
|
|
2424
|
-
var key = _ref[0],
|
|
2425
|
-
stateCell = _ref[1];
|
|
2426
|
-
return {
|
|
2427
|
-
path: JSON.parse(key),
|
|
2428
|
-
stateCell: stateCell
|
|
2429
|
-
};
|
|
2430
|
-
});
|
|
2333
|
+
return Object.values(this._state);
|
|
2431
2334
|
};
|
|
2432
2335
|
_proto.hasState = function hasState(path) {
|
|
2433
2336
|
var key = JSON.stringify(path);
|
|
@@ -2555,6 +2458,133 @@ function findStateCell(root, pathStr, repetitionIndex) {
|
|
|
2555
2458
|
};
|
|
2556
2459
|
}
|
|
2557
2460
|
|
|
2461
|
+
function generateStateOnChangeProp($state, path) {
|
|
2462
|
+
return function (val) {
|
|
2463
|
+
return set($state, path, val);
|
|
2464
|
+
};
|
|
2465
|
+
}
|
|
2466
|
+
function generateStateValueProp($state, path) {
|
|
2467
|
+
return _get($state, path);
|
|
2468
|
+
}
|
|
2469
|
+
var useIsomorphicLayoutEffect$1 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
2470
|
+
function isPlasmicStateProxy(obj) {
|
|
2471
|
+
return obj != null && typeof obj === "object" && !!obj[PLASMIC_STATE_PROXY_SYMBOL];
|
|
2472
|
+
}
|
|
2473
|
+
function getStateCellsInPlasmicProxy(obj) {
|
|
2474
|
+
if (!isPlasmicStateProxy(obj)) {
|
|
2475
|
+
return [];
|
|
2476
|
+
}
|
|
2477
|
+
var _obj$PLASMIC_STATE_PR = obj[PLASMIC_STATE_PROXY_SYMBOL],
|
|
2478
|
+
rootNode = _obj$PLASMIC_STATE_PR.node,
|
|
2479
|
+
rootPath = _obj$PLASMIC_STATE_PR.path,
|
|
2480
|
+
isOutside = _obj$PLASMIC_STATE_PR.isOutside;
|
|
2481
|
+
if (isOutside) {
|
|
2482
|
+
return [];
|
|
2483
|
+
}
|
|
2484
|
+
return getStateCells(rootNode).flatMap(function (node) {
|
|
2485
|
+
return node.states().map(function (stateCell) {
|
|
2486
|
+
return {
|
|
2487
|
+
path: node.getSpec().path,
|
|
2488
|
+
realPath: stateCell.path.slice(rootPath.length)
|
|
2489
|
+
};
|
|
2490
|
+
});
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
function getStateSpecInPlasmicProxy(obj, path) {
|
|
2494
|
+
obj = _get(obj, path.slice(0, path.length - 1));
|
|
2495
|
+
if (!isPlasmicStateProxy(obj)) {
|
|
2496
|
+
return undefined;
|
|
2497
|
+
}
|
|
2498
|
+
var _obj$PLASMIC_STATE_PR2 = obj[PLASMIC_STATE_PROXY_SYMBOL],
|
|
2499
|
+
node = _obj$PLASMIC_STATE_PR2.node,
|
|
2500
|
+
isOutside = _obj$PLASMIC_STATE_PR2.isOutside;
|
|
2501
|
+
var nextNode = node.makeTransition(path[path.length - 1]);
|
|
2502
|
+
if (isOutside || node.isLeaf() || !nextNode) {
|
|
2503
|
+
return undefined;
|
|
2504
|
+
}
|
|
2505
|
+
return {
|
|
2506
|
+
spec: nextNode.getSpec(),
|
|
2507
|
+
isImplicitStateArray: nextNode.hasArrayTransition()
|
|
2508
|
+
};
|
|
2509
|
+
}
|
|
2510
|
+
function shallowEqual(a1, a2) {
|
|
2511
|
+
if (a1.length !== a2.length) {
|
|
2512
|
+
return false;
|
|
2513
|
+
}
|
|
2514
|
+
for (var i = 0; i < a1.length; i++) {
|
|
2515
|
+
if (a1[i] !== a2[i]) {
|
|
2516
|
+
return false;
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
return true;
|
|
2520
|
+
}
|
|
2521
|
+
/**
|
|
2522
|
+
* Shallow comparison of arrays.
|
|
2523
|
+
*/
|
|
2524
|
+
function arrayEq(xs, ys) {
|
|
2525
|
+
return xs.length === ys.length && xs.every(function (_, index) {
|
|
2526
|
+
return xs[index] === ys[index];
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2529
|
+
function isNum(value) {
|
|
2530
|
+
return typeof value === "symbol" ? false : !isNaN(+value);
|
|
2531
|
+
}
|
|
2532
|
+
function assert(cond, msg) {
|
|
2533
|
+
if (msg === void 0) {
|
|
2534
|
+
msg = "Assertion failed";
|
|
2535
|
+
}
|
|
2536
|
+
if (!cond) {
|
|
2537
|
+
// We always generate an non empty message so that it doesn't get swallowed
|
|
2538
|
+
// by the async library.
|
|
2539
|
+
msg = (typeof msg === "string" ? msg : msg()) || "Assertion failed";
|
|
2540
|
+
debugger;
|
|
2541
|
+
throw new Error(msg);
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
/**
|
|
2545
|
+
* Forked from https://github.com/lukeed/dset
|
|
2546
|
+
* Changes: fixed setting a deep value to a proxy object
|
|
2547
|
+
*/
|
|
2548
|
+
function set(obj, keys, val) {
|
|
2549
|
+
keys = keys.split ? keys.split(".") : keys;
|
|
2550
|
+
var i = 0,
|
|
2551
|
+
l = keys.length,
|
|
2552
|
+
t = obj,
|
|
2553
|
+
x,
|
|
2554
|
+
k;
|
|
2555
|
+
while (i < l) {
|
|
2556
|
+
k = keys[i++];
|
|
2557
|
+
if (k === "__proto__" || k === "constructor" || k === "prototype") break;
|
|
2558
|
+
var newValue = i === l ? val : typeof (x = t[k]) === typeof keys ? x : keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".") ? {} : [];
|
|
2559
|
+
assignValue(t, k, newValue);
|
|
2560
|
+
t = t[k];
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
/**
|
|
2564
|
+
* Forked from lodash
|
|
2565
|
+
*/
|
|
2566
|
+
function baseAssignValue(object, key, value) {
|
|
2567
|
+
if (key == "__proto__") {
|
|
2568
|
+
Object.defineProperty(object, key, {
|
|
2569
|
+
configurable: true,
|
|
2570
|
+
enumerable: true,
|
|
2571
|
+
value: value,
|
|
2572
|
+
writable: true
|
|
2573
|
+
});
|
|
2574
|
+
} else {
|
|
2575
|
+
object[key] = value;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
function eq(value, other) {
|
|
2579
|
+
return value === other || value !== value && other !== other;
|
|
2580
|
+
}
|
|
2581
|
+
function assignValue(object, key, value) {
|
|
2582
|
+
var objValue = object[key];
|
|
2583
|
+
if (!(Object.prototype.hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
|
|
2584
|
+
baseAssignValue(object, key, value);
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2558
2588
|
function isNum$1(value) {
|
|
2559
2589
|
return typeof value === "symbol" ? false : !isNaN(+value);
|
|
2560
2590
|
}
|
|
@@ -2627,7 +2657,11 @@ function create$StateProxy($$state, leafHandlers) {
|
|
|
2627
2657
|
},
|
|
2628
2658
|
get: function get(target, property, receiver) {
|
|
2629
2659
|
if (property === PLASMIC_STATE_PROXY_SYMBOL) {
|
|
2630
|
-
return
|
|
2660
|
+
return {
|
|
2661
|
+
node: currNode,
|
|
2662
|
+
path: currPath,
|
|
2663
|
+
isOutside: isOutside
|
|
2664
|
+
};
|
|
2631
2665
|
}
|
|
2632
2666
|
var nextPath = getNextPath(property);
|
|
2633
2667
|
if (isOutside || currNode.isLeaf()) {
|
|
@@ -2797,16 +2831,15 @@ function useDollarState(specs, props, $ctx, opts) {
|
|
|
2797
2831
|
// the init value has changed. If so, reset its state.
|
|
2798
2832
|
var resetSpecs = [];
|
|
2799
2833
|
$$state.specTreeLeaves.flatMap(function (node) {
|
|
2800
|
-
return node.states().map(function (
|
|
2801
|
-
var stateCell = _ref3.stateCell;
|
|
2834
|
+
return node.states().map(function (stateCell) {
|
|
2802
2835
|
return {
|
|
2803
2836
|
stateCell: stateCell,
|
|
2804
2837
|
node: node
|
|
2805
2838
|
};
|
|
2806
2839
|
});
|
|
2807
|
-
}).forEach(function (
|
|
2808
|
-
var node =
|
|
2809
|
-
stateCell =
|
|
2840
|
+
}).forEach(function (_ref3) {
|
|
2841
|
+
var node = _ref3.node,
|
|
2842
|
+
stateCell = _ref3.stateCell;
|
|
2810
2843
|
var initFunc = node.getInitFunc(stateCell);
|
|
2811
2844
|
if (initFunc) {
|
|
2812
2845
|
var newInit = initFunc(props, $state, $ctx != null ? $ctx : {});
|
|
@@ -2827,9 +2860,9 @@ function useDollarState(specs, props, $ctx, opts) {
|
|
|
2827
2860
|
}
|
|
2828
2861
|
};
|
|
2829
2862
|
useIsomorphicLayoutEffect$1(function () {
|
|
2830
|
-
resetSpecs.forEach(function (
|
|
2831
|
-
var stateCell =
|
|
2832
|
-
node =
|
|
2863
|
+
resetSpecs.forEach(function (_ref4) {
|
|
2864
|
+
var stateCell = _ref4.stateCell,
|
|
2865
|
+
node = _ref4.node;
|
|
2833
2866
|
reInitializeState(node, stateCell);
|
|
2834
2867
|
});
|
|
2835
2868
|
}, [props, resetSpecs]);
|
|
@@ -4258,5 +4291,5 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
|
|
|
4258
4291
|
};
|
|
4259
4292
|
}
|
|
4260
4293
|
|
|
4261
|
-
export { DropdownMenu, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicPageGuard, PlasmicRootProvider, PlasmicSlot, SelectContext, Stack, Trans, TriggeredOverlayContext, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, getDataProps, hasVariant, isPlasmicStateProxy, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, set, setPlumeStrictMode, useButton, useCheckbox, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
|
4294
|
+
export { DropdownMenu, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicPageGuard, PlasmicRootProvider, PlasmicSlot, SelectContext, Stack, Trans, TriggeredOverlayContext, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, getDataProps, getStateCellsInPlasmicProxy, getStateSpecInPlasmicProxy, hasVariant, isPlasmicStateProxy, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, set, setPlumeStrictMode, useButton, useCheckbox, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
|
4262
4295
|
//# sourceMappingURL=react-web.esm.js.map
|