piral-containers 0.14.0-pre.2998 → 0.14.0-pre.3079
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/esm/actions.js +6 -7
- package/esm/actions.js.map +1 -1
- package/esm/create.js +13 -21
- package/esm/create.js.map +1 -1
- package/esm/withPiletState.js +4 -5
- package/esm/withPiletState.js.map +1 -1
- package/lib/actions.js +7 -8
- package/lib/actions.js.map +1 -1
- package/lib/create.js +16 -24
- package/lib/create.js.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/withPiletState.js +6 -7
- package/lib/withPiletState.js.map +1 -1
- package/package.json +4 -4
package/esm/actions.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { withKey, withoutKey } from 'piral-core';
|
|
3
2
|
export function createState(ctx, id, data) {
|
|
4
|
-
ctx.dispatch(
|
|
3
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { containers: withKey(state.containers, id, data) })));
|
|
5
4
|
}
|
|
6
5
|
export function destroyState(ctx, id) {
|
|
7
|
-
ctx.dispatch(
|
|
6
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { containers: withoutKey(state.containers, id) })));
|
|
8
7
|
}
|
|
9
8
|
export function replaceState(ctx, id, dispatch) {
|
|
10
|
-
ctx.dispatch(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return
|
|
9
|
+
ctx.dispatch((state) => {
|
|
10
|
+
const oldState = state.containers[id];
|
|
11
|
+
const newState = dispatch(oldState);
|
|
12
|
+
return Object.assign(Object.assign({}, state), { containers: withKey(state.containers, id, Object.assign(Object.assign({}, oldState), newState)) });
|
|
14
13
|
});
|
|
15
14
|
}
|
|
16
15
|
//# sourceMappingURL=actions.js.map
|
package/esm/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,OAAO,EAAE,UAAU,EAAsB,MAAM,YAAY,CAAC;AAEtF,MAAM,UAAU,WAAW,CAAS,GAAuB,EAAE,EAAU,EAAE,IAAY;IACnF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,EAAE,IAAI,CAAC,IAC/C,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,EAAU;IAC9D,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC,IAC5C,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,YAAY,CAAS,GAAuB,EAAE,EAAU,EAAE,QAAiC;IACzG,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpC,uCACK,KAAK,KACR,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,kCACnC,QAAQ,GACR,QAAQ,EACX,IACF;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/esm/create.js
CHANGED
|
@@ -1,37 +1,29 @@
|
|
|
1
|
-
import { __assign, __spreadArray } from "tslib";
|
|
2
1
|
import * as actions from './actions';
|
|
3
2
|
import { buildName } from 'piral-core';
|
|
4
3
|
import { withPiletState } from './withPiletState';
|
|
5
4
|
/**
|
|
6
5
|
* Creates new Pilet API extensions for supporting pilet global state containers.
|
|
7
6
|
*/
|
|
8
|
-
export function createContainersApi(config) {
|
|
9
|
-
|
|
10
|
-
return function (context) {
|
|
7
|
+
export function createContainersApi(config = {}) {
|
|
8
|
+
return (context) => {
|
|
11
9
|
context.defineActions(actions);
|
|
12
|
-
context.dispatch(
|
|
13
|
-
return
|
|
14
|
-
|
|
10
|
+
context.dispatch((state) => (Object.assign(Object.assign({}, state), { containers: {} })));
|
|
11
|
+
return (api, target) => {
|
|
12
|
+
let containers = 0;
|
|
15
13
|
return {
|
|
16
|
-
createState
|
|
14
|
+
createState(options) {
|
|
17
15
|
if (!options || typeof options.actions !== 'object' || typeof options.state !== 'object') {
|
|
18
16
|
throw new Error('Missing options. "state" and "actions" are required.');
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const actions = {};
|
|
19
|
+
const id = buildName(target.name, containers++);
|
|
20
|
+
const cb = (dispatch) => context.replaceState(id, dispatch);
|
|
23
21
|
context.createState(id, options.state);
|
|
24
|
-
Object.keys(options.actions).forEach(
|
|
25
|
-
|
|
26
|
-
actions[key] =
|
|
27
|
-
var args = [];
|
|
28
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
29
|
-
args[_i] = arguments[_i];
|
|
30
|
-
}
|
|
31
|
-
return action.call.apply(action, __spreadArray([api, cb], args));
|
|
32
|
-
};
|
|
22
|
+
Object.keys(options.actions).forEach((key) => {
|
|
23
|
+
const action = options.actions[key];
|
|
24
|
+
actions[key] = (...args) => action.call(api, cb, ...args);
|
|
33
25
|
});
|
|
34
|
-
return
|
|
26
|
+
return (component) => withPiletState(component, id, actions);
|
|
35
27
|
},
|
|
36
28
|
};
|
|
37
29
|
};
|
package/esm/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAgC,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQlD;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAA2B,EAAE;IAC/D,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE/B,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACvB,KAAK,KACR,UAAU,EAAE,EAAE,IACd,CAAC,CAAC;QAEJ,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACrB,IAAI,UAAU,GAAG,CAAC,CAAC;YAEnB,OAAO;gBACL,WAAW,CAAC,OAAO;oBACjB,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE;wBACxF,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;qBACzE;oBAED,MAAM,OAAO,GAAG,EAAE,CAAC;oBACnB,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;oBAChD,MAAM,EAAE,GAAG,CAAC,QAA8B,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;oBAClF,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;oBAEvC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;wBAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;wBACpC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;oBAC5D,CAAC,CAAC,CAAC;oBAEH,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAQ,CAAC;gBACtE,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/esm/withPiletState.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useGlobalState } from 'piral-core';
|
|
4
3
|
export function withPiletState(Component, id, actions) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return React.createElement(Component,
|
|
4
|
+
const StateView = (props) => {
|
|
5
|
+
const state = useGlobalState((s) => s.containers[id]);
|
|
6
|
+
return React.createElement(Component, Object.assign({ state: state, actions: actions }, props));
|
|
8
7
|
};
|
|
9
|
-
StateView.displayName =
|
|
8
|
+
StateView.displayName = `StateView_${id}`;
|
|
10
9
|
return StateView;
|
|
11
10
|
}
|
|
12
11
|
//# sourceMappingURL=withPiletState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPiletState.js","sourceRoot":"","sources":["../src/withPiletState.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withPiletState.js","sourceRoot":"","sources":["../src/withPiletState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,MAAM,UAAU,cAAc,CAC5B,SAA6E,EAC7E,EAAU,EACV,OAAgB;IAEhB,MAAM,SAAS,GAAqB,CAAC,KAAK,EAAE,EAAE;QAC5C,MAAM,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;QACtD,OAAO,oBAAC,SAAS,kBAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,IAAM,KAAK,EAAI,CAAC;IAClE,CAAC,CAAC;IACF,SAAS,CAAC,WAAW,GAAG,aAAa,EAAE,EAAE,CAAC;IAE1C,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/lib/actions.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceState = exports.destroyState = exports.createState = void 0;
|
|
4
|
-
|
|
5
|
-
var piral_core_1 = require("piral-core");
|
|
4
|
+
const piral_core_1 = require("piral-core");
|
|
6
5
|
function createState(ctx, id, data) {
|
|
7
|
-
ctx.dispatch(
|
|
6
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { containers: (0, piral_core_1.withKey)(state.containers, id, data) })));
|
|
8
7
|
}
|
|
9
8
|
exports.createState = createState;
|
|
10
9
|
function destroyState(ctx, id) {
|
|
11
|
-
ctx.dispatch(
|
|
10
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { containers: (0, piral_core_1.withoutKey)(state.containers, id) })));
|
|
12
11
|
}
|
|
13
12
|
exports.destroyState = destroyState;
|
|
14
13
|
function replaceState(ctx, id, dispatch) {
|
|
15
|
-
ctx.dispatch(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
14
|
+
ctx.dispatch((state) => {
|
|
15
|
+
const oldState = state.containers[id];
|
|
16
|
+
const newState = dispatch(oldState);
|
|
17
|
+
return Object.assign(Object.assign({}, state), { containers: (0, piral_core_1.withKey)(state.containers, id, Object.assign(Object.assign({}, oldState), newState)) });
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
20
|
exports.replaceState = replaceState;
|
package/lib/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;AAAA,2CAAsF;AAEtF,SAAgB,WAAW,CAAS,GAAuB,EAAE,EAAU,EAAE,IAAY;IACnF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,UAAU,EAAE,IAAA,oBAAO,EAAC,KAAK,CAAC,UAAU,EAAE,EAAE,EAAE,IAAI,CAAC,IAC/C,CAAC,CAAC;AACN,CAAC;AALD,kCAKC;AAED,SAAgB,YAAY,CAAC,GAAuB,EAAE,EAAU;IAC9D,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,UAAU,EAAE,IAAA,uBAAU,EAAC,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC,IAC5C,CAAC,CAAC;AACN,CAAC;AALD,oCAKC;AAED,SAAgB,YAAY,CAAS,GAAuB,EAAE,EAAU,EAAE,QAAiC;IACzG,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpC,uCACK,KAAK,KACR,UAAU,EAAE,IAAA,oBAAO,EAAC,KAAK,CAAC,UAAU,EAAE,EAAE,kCACnC,QAAQ,GACR,QAAQ,EACX,IACF;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAZD,oCAYC"}
|
package/lib/create.js
CHANGED
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createContainersApi = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var withPiletState_1 = require("./withPiletState");
|
|
4
|
+
const actions = require("./actions");
|
|
5
|
+
const piral_core_1 = require("piral-core");
|
|
6
|
+
const withPiletState_1 = require("./withPiletState");
|
|
8
7
|
/**
|
|
9
8
|
* Creates new Pilet API extensions for supporting pilet global state containers.
|
|
10
9
|
*/
|
|
11
|
-
function createContainersApi(config) {
|
|
12
|
-
|
|
13
|
-
return function (context) {
|
|
10
|
+
function createContainersApi(config = {}) {
|
|
11
|
+
return (context) => {
|
|
14
12
|
context.defineActions(actions);
|
|
15
|
-
context.dispatch(
|
|
16
|
-
return
|
|
17
|
-
|
|
13
|
+
context.dispatch((state) => (Object.assign(Object.assign({}, state), { containers: {} })));
|
|
14
|
+
return (api, target) => {
|
|
15
|
+
let containers = 0;
|
|
18
16
|
return {
|
|
19
|
-
createState
|
|
17
|
+
createState(options) {
|
|
20
18
|
if (!options || typeof options.actions !== 'object' || typeof options.state !== 'object') {
|
|
21
19
|
throw new Error('Missing options. "state" and "actions" are required.');
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const actions = {};
|
|
22
|
+
const id = (0, piral_core_1.buildName)(target.name, containers++);
|
|
23
|
+
const cb = (dispatch) => context.replaceState(id, dispatch);
|
|
26
24
|
context.createState(id, options.state);
|
|
27
|
-
Object.keys(options.actions).forEach(
|
|
28
|
-
|
|
29
|
-
actions[key] =
|
|
30
|
-
var args = [];
|
|
31
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
32
|
-
args[_i] = arguments[_i];
|
|
33
|
-
}
|
|
34
|
-
return action.call.apply(action, tslib_1.__spreadArray([api, cb], args));
|
|
35
|
-
};
|
|
25
|
+
Object.keys(options.actions).forEach((key) => {
|
|
26
|
+
const action = options.actions[key];
|
|
27
|
+
actions[key] = (...args) => action.call(api, cb, ...args);
|
|
36
28
|
});
|
|
37
|
-
return
|
|
29
|
+
return (component) => (0, withPiletState_1.withPiletState)(component, id, actions);
|
|
38
30
|
},
|
|
39
31
|
};
|
|
40
32
|
};
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,2CAAqE;AACrE,qDAAkD;AAQlD;;GAEG;AACH,SAAgB,mBAAmB,CAAC,SAA2B,EAAE;IAC/D,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE/B,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACvB,KAAK,KACR,UAAU,EAAE,EAAE,IACd,CAAC,CAAC;QAEJ,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACrB,IAAI,UAAU,GAAG,CAAC,CAAC;YAEnB,OAAO;gBACL,WAAW,CAAC,OAAO;oBACjB,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE;wBACxF,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;qBACzE;oBAED,MAAM,OAAO,GAAG,EAAE,CAAC;oBACnB,MAAM,EAAE,GAAG,IAAA,sBAAS,EAAC,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;oBAChD,MAAM,EAAE,GAAG,CAAC,QAA8B,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;oBAClF,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;oBAEvC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;wBAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;wBACpC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;oBAC5D,CAAC,CAAC,CAAC;oBAEH,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,IAAA,+BAAc,EAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAQ,CAAC;gBACtE,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAjCD,kDAiCC"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./create"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./create"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./types"), exports);
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAAyB;AACzB,uDAAwB"}
|
package/lib/withPiletState.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withPiletState = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var piral_core_1 = require("piral-core");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const piral_core_1 = require("piral-core");
|
|
7
6
|
function withPiletState(Component, id, actions) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return React.createElement(Component,
|
|
7
|
+
const StateView = (props) => {
|
|
8
|
+
const state = (0, piral_core_1.useGlobalState)((s) => s.containers[id]);
|
|
9
|
+
return React.createElement(Component, Object.assign({ state: state, actions: actions }, props));
|
|
11
10
|
};
|
|
12
|
-
StateView.displayName =
|
|
11
|
+
StateView.displayName = `StateView_${id}`;
|
|
13
12
|
return StateView;
|
|
14
13
|
}
|
|
15
14
|
exports.withPiletState = withPiletState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPiletState.js","sourceRoot":"","sources":["../src/withPiletState.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withPiletState.js","sourceRoot":"","sources":["../src/withPiletState.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,2CAA4C;AAG5C,SAAgB,cAAc,CAC5B,SAA6E,EAC7E,EAAU,EACV,OAAgB;IAEhB,MAAM,SAAS,GAAqB,CAAC,KAAK,EAAE,EAAE;QAC5C,MAAM,KAAK,GAAG,IAAA,2BAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;QACtD,OAAO,oBAAC,SAAS,kBAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,IAAM,KAAK,EAAI,CAAC;IAClE,CAAC,CAAC;IACF,SAAS,CAAC,WAAW,GAAG,aAAa,EAAE,EAAE,CAAC;IAE1C,OAAO,SAAS,CAAC;AACnB,CAAC;AAZD,wCAYC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-containers",
|
|
3
|
-
"version": "0.14.0-pre.
|
|
3
|
+
"version": "0.14.0-pre.3079",
|
|
4
4
|
"description": "Plugin for creating a pilet state container in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"piral-core": "^0.14.0-pre.
|
|
44
|
+
"piral-core": "^0.14.0-pre.3079"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"piral-core": "0.
|
|
47
|
+
"piral-core": "0.14.x"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "d9d31abfd290494a188209094b5fe54b86aedf5a"
|
|
50
50
|
}
|