@plasmicapp/react-web 0.2.123 → 0.2.125
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 +7 -6
- package/dist/react-web.cjs.development.js +17 -11
- 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 +18 -13
- package/dist/react-web.esm.js.map +1 -1
- package/dist/states/helpers.d.ts +2 -0
- package/dist/states/valtio.d.ts +3 -3
- package/dist/stories/UseDollarState.stories.d.ts +7 -1
- package/lib/data-sources/index.cjs.js +17 -0
- package/lib/data-sources/index.cjs.js.map +1 -0
- package/lib/data-sources/package.json +4 -1
- package/lib/host/index.cjs.js +17 -0
- package/lib/host/index.cjs.js.map +1 -0
- package/lib/host/package.json +4 -1
- package/lib/query/index.cjs.js +17 -0
- package/lib/query/index.cjs.js.map +1 -0
- package/lib/query/package.json +4 -1
- package/package.json +4 -4
- package/skinny/dist/index.js +23 -16
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/states/helpers.d.ts +2 -0
- package/skinny/dist/states/valtio.d.ts +3 -3
- package/skinny/dist/stories/UseDollarState.stories.d.ts +7 -1
package/dist/states/helpers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import get from "dlv";
|
|
2
|
+
import { useLayoutEffect } from "react";
|
|
2
3
|
import { $State } from ".";
|
|
3
4
|
export declare function generateStateOnChangeProp($state: $State, stateName: string, dataReps: number[]): (val: any, path: (string | number)[]) => void;
|
|
4
5
|
/**
|
|
@@ -13,4 +14,5 @@ export declare function generateStateValueProp($state: $State, path: (string | n
|
|
|
13
14
|
* Changes: fixed setting a deep value to a proxy object
|
|
14
15
|
*/
|
|
15
16
|
export declare function set(obj: any, keys: any, val: any): void;
|
|
17
|
+
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
|
|
16
18
|
export { get };
|
package/dist/states/valtio.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare type InitFunc<T> = ($props: Record<string, any>, $state: $State, indexes: number[]) => T;
|
|
1
|
+
declare type InitFunc<T> = ($props: Record<string, any>, $state: $State, $ctx: Record<string, any>, indexes: number[]) => T;
|
|
2
2
|
export interface $State {
|
|
3
3
|
[key: string]: any;
|
|
4
4
|
registerInitFunc?: (path: string, f: InitFunc<any>) => any;
|
|
@@ -12,6 +12,6 @@ export interface $StateSpec<T> {
|
|
|
12
12
|
onChangeProp?: string;
|
|
13
13
|
isArray?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>): any;
|
|
15
|
+
export declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): any;
|
|
16
16
|
export default useDollarState;
|
|
17
|
-
export declare function useCanvasDollarState(specs: $StateSpec<any>[], props: Record<string, any>): any;
|
|
17
|
+
export declare function useCanvasDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): any;
|
|
@@ -31,7 +31,13 @@ export declare const RepeatedStates: import("@storybook/csf").AnnotatedStoryFn<i
|
|
|
31
31
|
}>;
|
|
32
32
|
export declare const NestedRepeatedCounter: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
|
|
33
33
|
export declare const MatrixRepeatedCounter: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>;
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const InitFuncFromInternalContextData: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
|
|
35
|
+
products: {
|
|
36
|
+
price: number;
|
|
37
|
+
name: string;
|
|
38
|
+
}[];
|
|
39
|
+
}>;
|
|
40
|
+
export declare const InitFuncFromRootContextData: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {
|
|
35
41
|
products: {
|
|
36
42
|
price: number;
|
|
37
43
|
name: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dataSources = require('@plasmicapp/data-sources');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.keys(dataSources).forEach(function (k) {
|
|
10
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return dataSources[k];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var host = require('@plasmicapp/host');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.keys(host).forEach(function (k) {
|
|
10
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return host[k];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
package/lib/host/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var query = require('@plasmicapp/query');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.keys(query).forEach(function (k) {
|
|
10
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return query[k];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
package/lib/query/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/react-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.125",
|
|
4
4
|
"description": "plasmic library for rendering in the presentational style",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
},
|
|
41
41
|
"prettier": {},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@plasmicapp/data-sources": "0.1.
|
|
43
|
+
"@plasmicapp/data-sources": "0.1.14",
|
|
44
44
|
"@plasmicapp/data-sources-context": "0.1.2",
|
|
45
|
-
"@plasmicapp/host": "1.0.
|
|
45
|
+
"@plasmicapp/host": "1.0.85",
|
|
46
46
|
"@plasmicapp/query": "0.1.55",
|
|
47
47
|
"@react-aria/checkbox": "^3.5.0",
|
|
48
48
|
"@react-aria/focus": "^3.7.0",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"react": ">=16.8.0",
|
|
109
109
|
"react-dom": ">=16.8.0"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "b53e96d1eae801c0774e7e51c5217c3416d5ba47"
|
|
112
112
|
}
|
package/skinny/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import classNames$1 from 'classnames';
|
|
|
2
2
|
import get from 'dlv';
|
|
3
3
|
export { default as get } from 'dlv';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import React__default from 'react';
|
|
6
|
-
import { c as createElementWithChildren, m as mergeProps, e as ensureNotArray, N as NONE, a as mergePropVals, i as isReactNode, b as isBrowser, u as useIsomorphicLayoutEffect } from './react-utils-7bc53870.js';
|
|
5
|
+
import React__default, { useLayoutEffect, useEffect } from 'react';
|
|
6
|
+
import { c as createElementWithChildren, m as mergeProps, e as ensureNotArray, N as NONE, a as mergePropVals, i as isReactNode, b as isBrowser, u as useIsomorphicLayoutEffect$1 } from './react-utils-7bc53870.js';
|
|
7
7
|
import { _ as __rest, a as __assign, b as __spreadArray, c as __read, o as omit, p as pick, d as __values, i as isSubset, e as chainSingleArgFuncs, n as notNil } from './common-9ebe374e.js';
|
|
8
8
|
export { o as omit, p as pick } from './common-9ebe374e.js';
|
|
9
9
|
export { PlasmicHead, plasmicHeadMeta } from './render/PlasmicHead/index.js';
|
|
@@ -537,7 +537,7 @@ function createUseScreenVariants(isMulti, screenQueries) {
|
|
|
537
537
|
// register our forceUpdate. This ensures that if there was
|
|
538
538
|
// a window resize event between render and effects, that the
|
|
539
539
|
// listener will be registered in time
|
|
540
|
-
useIsomorphicLayoutEffect(function () {
|
|
540
|
+
useIsomorphicLayoutEffect$1(function () {
|
|
541
541
|
var updateIfChanged = function () {
|
|
542
542
|
if (curScreenVariants &&
|
|
543
543
|
lastScreenVariantsRef.current.join("") !== curScreenVariants.join("")) {
|
|
@@ -679,9 +679,12 @@ function set(obj, keys, val) {
|
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
|
-
}
|
|
682
|
+
}
|
|
683
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
683
684
|
|
|
684
|
-
var mkUntrackedValue = function (o) {
|
|
685
|
+
var mkUntrackedValue = function (o) {
|
|
686
|
+
return o != null && typeof o === "object" ? ref(o) : o;
|
|
687
|
+
};
|
|
685
688
|
var transformPathStringToObj = function (str) {
|
|
686
689
|
var splitStatePathPart = function (state) {
|
|
687
690
|
return state.endsWith("[]")
|
|
@@ -878,11 +881,11 @@ function initializeStateValue($$state, initialStatePath, initialSpec) {
|
|
|
878
881
|
stateAccess.forEach(function (_a) {
|
|
879
882
|
var path = _a.path, spec = _a.spec;
|
|
880
883
|
var unsubscribe = subscribeKey(get($$state.stateValues, path.slice(-1)), path.slice(-1)[0], function () {
|
|
881
|
-
return set($$state.stateValues, initialStatePath, mkUntrackedValue(initialSpec.initFunc($$state.props, $state, getIndexes(path, spec))));
|
|
884
|
+
return set($$state.stateValues, initialStatePath, mkUntrackedValue(initialSpec.initFunc($$state.props, $state, $$state.ctx, getIndexes(path, spec))));
|
|
882
885
|
});
|
|
883
886
|
$$state.unsubscriptionsByState[initialStateKey].push(unsubscribe);
|
|
884
887
|
});
|
|
885
|
-
var initialValue = initialSpec.initFunc($$state.props, $state, getIndexes(initialStatePath, initialSpec));
|
|
888
|
+
var initialValue = initialSpec.initFunc($$state.props, $state, $$state.ctx, getIndexes(initialStatePath, initialSpec));
|
|
886
889
|
saveStateInitialValue($$state, initialStatePath, initialSpec, initialValue);
|
|
887
890
|
return initialValue;
|
|
888
891
|
}
|
|
@@ -904,7 +907,7 @@ function saveStateInitialValue($$state, path, spec, initialValue) {
|
|
|
904
907
|
set($$state.initStateValues, path, untrackedValue);
|
|
905
908
|
}
|
|
906
909
|
}
|
|
907
|
-
function useDollarState(specs, props) {
|
|
910
|
+
function useDollarState(specs, props, $ctx) {
|
|
908
911
|
var $$state = React__default.useRef(proxy({
|
|
909
912
|
stateValues: {},
|
|
910
913
|
initStateValues: {},
|
|
@@ -917,10 +920,12 @@ function useDollarState(specs, props) {
|
|
|
917
920
|
statesInstanceBySpec: new Map(),
|
|
918
921
|
existingStates: new Map(),
|
|
919
922
|
unsubscriptionsByState: {},
|
|
920
|
-
props:
|
|
923
|
+
props: {},
|
|
924
|
+
ctx: {},
|
|
921
925
|
registrationsQueue: []
|
|
922
926
|
})).current;
|
|
923
927
|
$$state.props = mkUntrackedValue(props);
|
|
928
|
+
$$state.ctx = mkUntrackedValue($ctx !== null && $ctx !== void 0 ? $ctx : {});
|
|
924
929
|
var $state = React__default.useRef(Object.assign(create$StateProxy($$state, function (path, spec) {
|
|
925
930
|
var _a;
|
|
926
931
|
var key = JSON.stringify(path);
|
|
@@ -958,7 +963,7 @@ function useDollarState(specs, props) {
|
|
|
958
963
|
if ((_a = $$state.statesInstanceBySpec
|
|
959
964
|
.get(pathStr)) === null || _a === void 0 ? void 0 : _a.some(function (_a) {
|
|
960
965
|
var path = _a.path, specKey = _a.specKey;
|
|
961
|
-
return !deepEqual(get($$state.initStateValues, path), f(props, $state, getIndexes(path, $$state.specsByKey[specKey])));
|
|
966
|
+
return !deepEqual(get($$state.initStateValues, path), f(props, $state, $ctx !== null && $ctx !== void 0 ? $ctx : {}, getIndexes(path, $$state.specsByKey[specKey])));
|
|
962
967
|
})) {
|
|
963
968
|
$$state.registrationsQueue.push({ pathStr: pathStr, f: f });
|
|
964
969
|
}
|
|
@@ -971,13 +976,13 @@ function useDollarState(specs, props) {
|
|
|
971
976
|
var path = _a.path, specKey = _a.specKey;
|
|
972
977
|
var spec = $$state.specsByKey[specKey];
|
|
973
978
|
if (spec.initFunc) {
|
|
974
|
-
var newInit = spec.initFunc(props, $state, getIndexes(path, spec));
|
|
979
|
+
var newInit = spec.initFunc(props, $state, $ctx !== null && $ctx !== void 0 ? $ctx : {}, getIndexes(path, spec));
|
|
975
980
|
if (!deepEqual(newInit, get($$state.initStateValues, path))) {
|
|
976
981
|
resetSpecs.push({ path: path, spec: spec });
|
|
977
982
|
}
|
|
978
983
|
}
|
|
979
984
|
});
|
|
980
|
-
|
|
985
|
+
useIsomorphicLayoutEffect(function () {
|
|
981
986
|
resetSpecs.forEach(function (_a) {
|
|
982
987
|
var _b, _c;
|
|
983
988
|
var path = _a.path, spec = _a.spec;
|
|
@@ -987,7 +992,7 @@ function useDollarState(specs, props) {
|
|
|
987
992
|
}
|
|
988
993
|
});
|
|
989
994
|
}, [props, resetSpecs]);
|
|
990
|
-
|
|
995
|
+
useIsomorphicLayoutEffect(function () {
|
|
991
996
|
$$state.registrationsQueue.forEach(function (_a) {
|
|
992
997
|
var f = _a.f, pathStr = _a.pathStr;
|
|
993
998
|
$$state.specsByKey[pathStr].initFunc = f;
|
|
@@ -1000,7 +1005,7 @@ function useDollarState(specs, props) {
|
|
|
1000
1005
|
return $state;
|
|
1001
1006
|
}
|
|
1002
1007
|
// Simple version of $state useDollarState for read-only
|
|
1003
|
-
function useCanvasDollarState(specs, props) {
|
|
1008
|
+
function useCanvasDollarState(specs, props, $ctx) {
|
|
1004
1009
|
var e_2, _a;
|
|
1005
1010
|
var $$state = proxy({
|
|
1006
1011
|
stateValues: {},
|
|
@@ -1012,10 +1017,12 @@ function useCanvasDollarState(specs, props) {
|
|
|
1012
1017
|
statesInstanceBySpec: new Map(),
|
|
1013
1018
|
existingStates: new Map(),
|
|
1014
1019
|
unsubscriptionsByState: {},
|
|
1015
|
-
props:
|
|
1020
|
+
props: {},
|
|
1021
|
+
ctx: {},
|
|
1016
1022
|
registrationsQueue: []
|
|
1017
1023
|
});
|
|
1018
1024
|
$$state.props = mkUntrackedValue(props);
|
|
1025
|
+
$$state.ctx = mkUntrackedValue($ctx);
|
|
1019
1026
|
var $state = create$StateProxy($$state, function (path, spec) {
|
|
1020
1027
|
return {
|
|
1021
1028
|
get: function () {
|
|
@@ -1058,5 +1065,5 @@ function useCanvasDollarState(specs, props) {
|
|
|
1058
1065
|
// Utilities used by generated code
|
|
1059
1066
|
var classNames = classNames$1;
|
|
1060
1067
|
|
|
1061
|
-
export { PlasmicIcon, PlasmicLink, PlasmicSlot, Stack, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, generateStateOnChangeProp, generateStateValueProp, hasVariant, makeFragment, mergeVariantsWithStates, renderPlasmicSlot, set, useCanvasDollarState, useDollarState, useTrigger, wrapWithClassName };
|
|
1068
|
+
export { PlasmicIcon, PlasmicLink, PlasmicSlot, Stack, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, generateStateOnChangeProp, generateStateValueProp, hasVariant, makeFragment, mergeVariantsWithStates, renderPlasmicSlot, set, useCanvasDollarState, useDollarState, useIsomorphicLayoutEffect, useTrigger, wrapWithClassName };
|
|
1062
1069
|
//# sourceMappingURL=index.js.map
|