piral-core 0.14.8-beta.3509 → 0.14.8-beta.3515
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/Piral.js +2 -0
- package/esm/Piral.js.map +1 -1
- package/esm/RootListener.d.ts +2 -0
- package/esm/RootListener.js +23 -0
- package/esm/RootListener.js.map +1 -0
- package/esm/components/ExtensionSlot.js +2 -2
- package/esm/components/ExtensionSlot.js.map +1 -1
- package/esm/modules/api.d.ts +3 -4
- package/esm/modules/api.js +1 -134
- package/esm/modules/api.js.map +1 -1
- package/esm/modules/core.d.ts +3 -0
- package/esm/modules/core.js +48 -0
- package/esm/modules/core.js.map +1 -0
- package/esm/modules/element.d.ts +5 -0
- package/esm/modules/element.js +83 -0
- package/esm/modules/element.js.map +1 -0
- package/esm/modules/index.d.ts +1 -0
- package/esm/modules/index.js +1 -0
- package/esm/modules/index.js.map +1 -1
- package/esm/types/extension.d.ts +7 -3
- package/esm/utils/extension.d.ts +13 -0
- package/esm/utils/extension.js +32 -0
- package/esm/utils/extension.js.map +1 -1
- package/lib/Piral.js +2 -0
- package/lib/Piral.js.map +1 -1
- package/lib/RootListener.d.ts +2 -0
- package/lib/RootListener.js +27 -0
- package/lib/RootListener.js.map +1 -0
- package/lib/components/ExtensionSlot.js +2 -2
- package/lib/components/ExtensionSlot.js.map +1 -1
- package/lib/modules/api.d.ts +3 -4
- package/lib/modules/api.js +3 -137
- package/lib/modules/api.js.map +1 -1
- package/lib/modules/core.d.ts +3 -0
- package/lib/modules/core.js +52 -0
- package/lib/modules/core.js.map +1 -0
- package/lib/modules/element.d.ts +5 -0
- package/lib/modules/element.js +87 -0
- package/lib/modules/element.js.map +1 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +1 -0
- package/lib/modules/index.js.map +1 -1
- package/lib/types/extension.d.ts +7 -3
- package/lib/utils/extension.d.ts +13 -0
- package/lib/utils/extension.js +34 -1
- package/lib/utils/extension.js.map +1 -1
- package/package.json +4 -4
- package/src/Piral.tsx +2 -0
- package/src/RootListener.tsx +26 -0
- package/src/components/ExtensionSlot.tsx +2 -1
- package/src/modules/api.test.ts +15 -15
- package/src/modules/api.ts +3 -158
- package/src/modules/core.test.ts +148 -0
- package/src/modules/core.ts +50 -0
- package/src/modules/element.ts +103 -0
- package/src/modules/index.ts +1 -0
- package/src/types/extension.ts +7 -2
- package/src/utils/extension.tsx +41 -0
package/lib/modules/api.js
CHANGED
|
@@ -1,144 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultApiFactory = exports.createExtenders =
|
|
3
|
+
exports.defaultApiFactory = exports.createExtenders = void 0;
|
|
4
4
|
const piral_base_1 = require("piral-base");
|
|
5
|
-
const
|
|
6
|
-
const components_1 = require("../components");
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
if (typeof window !== 'undefined' && 'customElements' in window) {
|
|
9
|
-
class PiralExtension extends HTMLElement {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.dispose = utils_1.noop;
|
|
13
|
-
this.update = utils_1.noop;
|
|
14
|
-
this.props = {
|
|
15
|
-
name: this.getAttribute('name'),
|
|
16
|
-
params: (0, utils_1.tryParseJson)(this.getAttribute('params')),
|
|
17
|
-
empty: undefined,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
get params() {
|
|
21
|
-
return this.props.params;
|
|
22
|
-
}
|
|
23
|
-
set params(value) {
|
|
24
|
-
this.props.params = value;
|
|
25
|
-
this.update(this.props);
|
|
26
|
-
}
|
|
27
|
-
get name() {
|
|
28
|
-
return this.props.name;
|
|
29
|
-
}
|
|
30
|
-
set name(value) {
|
|
31
|
-
this.props.name = value;
|
|
32
|
-
this.update(this.props);
|
|
33
|
-
}
|
|
34
|
-
get empty() {
|
|
35
|
-
return this.props.empty;
|
|
36
|
-
}
|
|
37
|
-
set empty(value) {
|
|
38
|
-
this.props.empty = value;
|
|
39
|
-
this.update(this.props);
|
|
40
|
-
}
|
|
41
|
-
connectedCallback() {
|
|
42
|
-
if (this.isConnected) {
|
|
43
|
-
this.dispatchEvent(new CustomEvent('render-html', {
|
|
44
|
-
bubbles: true,
|
|
45
|
-
detail: {
|
|
46
|
-
target: this,
|
|
47
|
-
props: this.props,
|
|
48
|
-
},
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
disconnectedCallback() {
|
|
53
|
-
this.dispose();
|
|
54
|
-
this.dispose = utils_1.noop;
|
|
55
|
-
this.update = utils_1.noop;
|
|
56
|
-
}
|
|
57
|
-
attributeChangedCallback(name, _, newValue) {
|
|
58
|
-
switch (name) {
|
|
59
|
-
case 'name':
|
|
60
|
-
this.name = newValue;
|
|
61
|
-
break;
|
|
62
|
-
case 'params':
|
|
63
|
-
this.params = (0, utils_1.tryParseJson)(newValue);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
static get observedAttributes() {
|
|
68
|
-
return ['name', 'params'];
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
customElements.define('piral-extension', PiralExtension);
|
|
72
|
-
}
|
|
73
|
-
function render(context, element, props) {
|
|
74
|
-
let [id, portal] = (0, utils_1.renderInDom)(context, element, components_1.ExtensionSlot, props);
|
|
75
|
-
const evName = 'extension-props-changed';
|
|
76
|
-
const handler = (ev) => update(ev.detail);
|
|
77
|
-
const dispose = () => {
|
|
78
|
-
context.hidePortal(id, portal);
|
|
79
|
-
element.removeEventListener(evName, handler);
|
|
80
|
-
};
|
|
81
|
-
const update = (newProps) => {
|
|
82
|
-
[id, portal] = (0, utils_1.changeDomPortal)(id, portal, context, element, components_1.ExtensionSlot, newProps);
|
|
83
|
-
};
|
|
84
|
-
element.addEventListener(evName, handler);
|
|
85
|
-
return [dispose, update];
|
|
86
|
-
}
|
|
87
|
-
function createCoreApi(context) {
|
|
88
|
-
if (typeof document !== 'undefined') {
|
|
89
|
-
document.body.addEventListener('render-html', (ev) => {
|
|
90
|
-
ev.stopPropagation();
|
|
91
|
-
const container = ev.detail.target;
|
|
92
|
-
const [dispose, update] = render(context, container, ev.detail.props);
|
|
93
|
-
container.dispose = dispose;
|
|
94
|
-
container.update = update;
|
|
95
|
-
}, false);
|
|
96
|
-
}
|
|
97
|
-
return (api, target) => {
|
|
98
|
-
const pilet = target.name;
|
|
99
|
-
return {
|
|
100
|
-
getData(name) {
|
|
101
|
-
return context.readDataValue(name);
|
|
102
|
-
},
|
|
103
|
-
setData(name, value, options) {
|
|
104
|
-
const { target = 'memory', expires } = (0, utils_1.createDataOptions)(options);
|
|
105
|
-
const expiration = (0, utils_1.getDataExpiration)(expires);
|
|
106
|
-
return context.tryWriteDataItem(name, value, pilet, target, expiration);
|
|
107
|
-
},
|
|
108
|
-
registerPage(route, arg, meta) {
|
|
109
|
-
context.registerPage(route, {
|
|
110
|
-
pilet,
|
|
111
|
-
meta,
|
|
112
|
-
component: (0, state_1.withApi)(context, arg, api, 'page'),
|
|
113
|
-
});
|
|
114
|
-
return () => api.unregisterPage(route);
|
|
115
|
-
},
|
|
116
|
-
unregisterPage(route) {
|
|
117
|
-
context.unregisterPage(route);
|
|
118
|
-
},
|
|
119
|
-
registerExtension(name, arg, defaults) {
|
|
120
|
-
context.registerExtension(name, {
|
|
121
|
-
pilet,
|
|
122
|
-
component: (0, state_1.withApi)(context, arg, api, 'extension'),
|
|
123
|
-
reference: arg,
|
|
124
|
-
defaults,
|
|
125
|
-
});
|
|
126
|
-
return () => api.unregisterExtension(name, arg);
|
|
127
|
-
},
|
|
128
|
-
unregisterExtension(name, arg) {
|
|
129
|
-
context.unregisterExtension(name, arg);
|
|
130
|
-
},
|
|
131
|
-
renderHtmlExtension(element, props) {
|
|
132
|
-
const [dispose] = render(context, element, props);
|
|
133
|
-
return dispose;
|
|
134
|
-
},
|
|
135
|
-
Extension: components_1.ExtensionSlot,
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
exports.createCoreApi = createCoreApi;
|
|
5
|
+
const core_1 = require("./core");
|
|
140
6
|
function createExtenders(context, apis) {
|
|
141
|
-
const creators = [createCoreApi, ...apis.filter(piral_base_1.isfunc)];
|
|
7
|
+
const creators = [core_1.createCoreApi, ...apis.filter(piral_base_1.isfunc)];
|
|
142
8
|
return creators.map((c) => {
|
|
143
9
|
const ctx = c(context);
|
|
144
10
|
if ((0, piral_base_1.isfunc)(ctx)) {
|
package/lib/modules/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/modules/api.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/modules/api.ts"],"names":[],"mappings":";;;AAAA,2CAA+E;AAE/E,iCAAuC;AAGvC,SAAgB,eAAe,CAAC,OAA2B,EAAE,IAAwB;IACnF,MAAM,QAAQ,GAAuB,CAAC,oBAAa,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAM,CAAC,CAAC,CAAC;IAC7E,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACxB,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;QAEvB,IAAI,IAAA,mBAAM,EAAC,GAAG,CAAC,EAAE;YACf,OAAO,GAAG,CAAC;SACZ;aAAM;YACL,OAAO,GAAG,EAAE,CAAC,mBACR,GAAG,EACN,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAbD,0CAaC;AAED,SAAgB,iBAAiB,CAAC,OAA2B,EAAE,IAAwB;IACrF,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACjD,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,GAAG,GAAG,IAAA,0BAAa,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;QAChC,OAAO,IAAA,sBAAS,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC;AAPD,8CAOC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCoreApi = void 0;
|
|
4
|
+
const element_1 = require("./element");
|
|
5
|
+
const state_1 = require("../state");
|
|
6
|
+
const components_1 = require("../components");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
function createCoreApi(context) {
|
|
9
|
+
return (api, meta) => {
|
|
10
|
+
const pilet = meta.name;
|
|
11
|
+
return {
|
|
12
|
+
getData(name) {
|
|
13
|
+
return context.readDataValue(name);
|
|
14
|
+
},
|
|
15
|
+
setData(name, value, options) {
|
|
16
|
+
const { target = 'memory', expires } = (0, utils_1.createDataOptions)(options);
|
|
17
|
+
const expiration = (0, utils_1.getDataExpiration)(expires);
|
|
18
|
+
return context.tryWriteDataItem(name, value, pilet, target, expiration);
|
|
19
|
+
},
|
|
20
|
+
registerPage(route, arg, meta) {
|
|
21
|
+
context.registerPage(route, {
|
|
22
|
+
pilet,
|
|
23
|
+
meta,
|
|
24
|
+
component: (0, state_1.withApi)(context, arg, api, 'page'),
|
|
25
|
+
});
|
|
26
|
+
return () => api.unregisterPage(route);
|
|
27
|
+
},
|
|
28
|
+
unregisterPage(route) {
|
|
29
|
+
context.unregisterPage(route);
|
|
30
|
+
},
|
|
31
|
+
registerExtension(name, arg, defaults) {
|
|
32
|
+
context.registerExtension(name, {
|
|
33
|
+
pilet,
|
|
34
|
+
component: (0, state_1.withApi)(context, arg, api, 'extension'),
|
|
35
|
+
reference: arg,
|
|
36
|
+
defaults,
|
|
37
|
+
});
|
|
38
|
+
return () => api.unregisterExtension(name, arg);
|
|
39
|
+
},
|
|
40
|
+
unregisterExtension(name, arg) {
|
|
41
|
+
context.unregisterExtension(name, arg);
|
|
42
|
+
},
|
|
43
|
+
renderHtmlExtension(element, props) {
|
|
44
|
+
const [dispose] = (0, element_1.renderElement)(context, element, props);
|
|
45
|
+
return dispose;
|
|
46
|
+
},
|
|
47
|
+
Extension: components_1.ExtensionSlot,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.createCoreApi = createCoreApi;
|
|
52
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/modules/core.ts"],"names":[],"mappings":";;;AACA,uCAA0C;AAC1C,oCAAmC;AACnC,8CAA8C;AAC9C,oCAAgE;AAGhE,SAAgB,aAAa,CAAC,OAA2B;IACvD,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;QACxB,OAAO;YACL,OAAO,CAAC,IAAI;gBACV,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACrC,CAAC;YACD,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO;gBAC1B,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAA,yBAAiB,EAAC,OAAO,CAAC,CAAC;gBAClE,MAAM,UAAU,GAAG,IAAA,yBAAiB,EAAC,OAAO,CAAC,CAAC;gBAC9C,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;YAC1E,CAAC;YACD,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI;gBAC3B,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE;oBAC1B,KAAK;oBACL,IAAI;oBACJ,SAAS,EAAE,IAAA,eAAO,EAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC;iBAC9C,CAAC,CAAC;gBACH,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACzC,CAAC;YACD,cAAc,CAAC,KAAK;gBAClB,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;YACD,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ;gBACnC,OAAO,CAAC,iBAAiB,CAAC,IAAc,EAAE;oBACxC,KAAK;oBACL,SAAS,EAAE,IAAA,eAAO,EAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,CAAC;oBAClD,SAAS,EAAE,GAAG;oBACd,QAAQ;iBACT,CAAC,CAAC;gBACH,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAClD,CAAC;YACD,mBAAmB,CAAC,IAAI,EAAE,GAAG;gBAC3B,OAAO,CAAC,mBAAmB,CAAC,IAAc,EAAE,GAAG,CAAC,CAAC;YACnD,CAAC;YACD,mBAAmB,CAAC,OAAO,EAAE,KAAK;gBAChC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAA,uBAAa,EAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;gBACzD,OAAO,OAAO,CAAC;YACjB,CAAC;YACD,SAAS,EAAE,0BAAa;SACzB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AA1CD,sCA0CC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderElement = void 0;
|
|
4
|
+
const components_1 = require("../components");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
if (typeof window !== 'undefined' && 'customElements' in window) {
|
|
7
|
+
class PiralExtension extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.dispose = utils_1.noop;
|
|
11
|
+
this.update = utils_1.noop;
|
|
12
|
+
this.props = {
|
|
13
|
+
name: this.getAttribute('name'),
|
|
14
|
+
params: (0, utils_1.tryParseJson)(this.getAttribute('params')),
|
|
15
|
+
empty: undefined,
|
|
16
|
+
children: (0, utils_1.reactifyContent)(this.childNodes),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
get params() {
|
|
20
|
+
return this.props.params;
|
|
21
|
+
}
|
|
22
|
+
set params(value) {
|
|
23
|
+
this.props.params = value;
|
|
24
|
+
this.update(this.props);
|
|
25
|
+
}
|
|
26
|
+
get name() {
|
|
27
|
+
return this.props.name;
|
|
28
|
+
}
|
|
29
|
+
set name(value) {
|
|
30
|
+
this.props.name = value;
|
|
31
|
+
this.update(this.props);
|
|
32
|
+
}
|
|
33
|
+
get empty() {
|
|
34
|
+
return this.props.empty;
|
|
35
|
+
}
|
|
36
|
+
set empty(value) {
|
|
37
|
+
this.props.empty = value;
|
|
38
|
+
this.update(this.props);
|
|
39
|
+
}
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
if (this.isConnected) {
|
|
42
|
+
this.dispatchEvent(new CustomEvent('render-html', {
|
|
43
|
+
bubbles: true,
|
|
44
|
+
detail: {
|
|
45
|
+
target: this,
|
|
46
|
+
props: this.props,
|
|
47
|
+
},
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
disconnectedCallback() {
|
|
52
|
+
this.dispose();
|
|
53
|
+
this.dispose = utils_1.noop;
|
|
54
|
+
this.update = utils_1.noop;
|
|
55
|
+
}
|
|
56
|
+
attributeChangedCallback(name, _, newValue) {
|
|
57
|
+
switch (name) {
|
|
58
|
+
case 'name':
|
|
59
|
+
this.name = newValue;
|
|
60
|
+
break;
|
|
61
|
+
case 'params':
|
|
62
|
+
this.params = (0, utils_1.tryParseJson)(newValue);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
static get observedAttributes() {
|
|
67
|
+
return ['name', 'params'];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
customElements.define('piral-extension', PiralExtension);
|
|
71
|
+
}
|
|
72
|
+
function renderElement(context, element, props) {
|
|
73
|
+
let [id, portal] = (0, utils_1.renderInDom)(context, element, components_1.ExtensionSlot, props);
|
|
74
|
+
const evName = 'extension-props-changed';
|
|
75
|
+
const handler = (ev) => update(ev.detail);
|
|
76
|
+
const dispose = () => {
|
|
77
|
+
context.hidePortal(id, portal);
|
|
78
|
+
element.removeEventListener(evName, handler);
|
|
79
|
+
};
|
|
80
|
+
const update = (newProps) => {
|
|
81
|
+
[id, portal] = (0, utils_1.changeDomPortal)(id, portal, context, element, components_1.ExtensionSlot, newProps);
|
|
82
|
+
};
|
|
83
|
+
element.addEventListener(evName, handler);
|
|
84
|
+
return [dispose, update];
|
|
85
|
+
}
|
|
86
|
+
exports.renderElement = renderElement;
|
|
87
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/modules/element.ts"],"names":[],"mappings":";;;AAAA,8CAA8C;AAC9C,oCAA6F;AAO7F,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,gBAAgB,IAAI,MAAM,EAAE;IAC/D,MAAM,cAAe,SAAQ,WAAW;QAAxC;;YACE,YAAO,GAAe,YAAI,CAAC;YAC3B,WAAM,GAAc,YAAI,CAAC;YACzB,UAAK,GAAG;gBACN,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;gBAC/B,MAAM,EAAE,IAAA,oBAAY,EAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;gBACjD,KAAK,EAAE,SAAS;gBAChB,QAAQ,EAAE,IAAA,uBAAe,EAAC,IAAI,CAAC,UAAU,CAAC;aAC3C,CAAC;QA+DJ,CAAC;QA7DC,IAAI,MAAM;YACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAC3B,CAAC;QAED,IAAI,MAAM,CAAC,KAAK;YACd,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,IAAI;YACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACzB,CAAC;QAED,IAAI,IAAI,CAAC,KAAK;YACZ,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,KAAK;YACP,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC1B,CAAC;QAED,IAAI,KAAK,CAAC,KAAK;YACb,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QAED,iBAAiB;YACf,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,aAAa,EAAE;oBAC7B,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE;wBACN,MAAM,EAAE,IAAI;wBACZ,KAAK,EAAE,IAAI,CAAC,KAAK;qBAClB;iBACF,CAAC,CACH,CAAC;aACH;QACH,CAAC;QAED,oBAAoB;YAClB,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,GAAG,YAAI,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,YAAI,CAAC;QACrB,CAAC;QAED,wBAAwB,CAAC,IAAY,EAAE,CAAM,EAAE,QAAa;YAC1D,QAAQ,IAAI,EAAE;gBACZ,KAAK,MAAM;oBACT,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;oBACrB,MAAM;gBACR,KAAK,QAAQ;oBACX,IAAI,CAAC,MAAM,GAAG,IAAA,oBAAY,EAAC,QAAQ,CAAC,CAAC;oBACrC,MAAM;aACT;QACH,CAAC;QAED,MAAM,KAAK,kBAAkB;YAC3B,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC5B,CAAC;KACF;IAED,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;CAC1D;AAED,SAAgB,aAAa,CAC3B,OAA2B,EAC3B,OAAiC,EACjC,KAAU;IAEV,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,IAAA,mBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,0BAAa,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,yBAAyB,CAAC;IACzC,MAAM,OAAO,GAAG,CAAC,EAAe,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACvD,MAAM,OAAO,GAAe,GAAG,EAAE;QAC/B,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAC/B,OAAO,CAAC,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC;IACF,MAAM,MAAM,GAAc,CAAC,QAAQ,EAAE,EAAE;QACrC,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,IAAA,uBAAe,EAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,0BAAa,EAAE,QAAQ,CAAC,CAAC;IACxF,CAAC,CAAC;IACF,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAjBD,sCAiBC"}
|
package/lib/modules/index.d.ts
CHANGED
package/lib/modules/index.js
CHANGED
|
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
(0, tslib_1.__exportStar)(require("./api"), exports);
|
|
5
5
|
(0, tslib_1.__exportStar)(require("./dependencies"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./element"), exports);
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/lib/modules/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;AAAA,qDAAsB;AACtB,8DAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;AAAA,qDAAsB;AACtB,8DAA+B;AAC/B,yDAA0B"}
|
package/lib/types/extension.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import type { PiralCustomExtensionSlotMap } from './custom';
|
|
3
3
|
/**
|
|
4
4
|
* The mapping of the existing (known) extension slots.
|
|
@@ -9,16 +9,20 @@ export interface PiralExtensionSlotMap extends PiralCustomExtensionSlotMap {
|
|
|
9
9
|
* The basic props for defining an extension slot.
|
|
10
10
|
*/
|
|
11
11
|
export interface BaseExtensionSlotProps<TName, TParams> {
|
|
12
|
+
/**
|
|
13
|
+
* The children to transport, if any.
|
|
14
|
+
*/
|
|
15
|
+
children?: ReactNode;
|
|
12
16
|
/**
|
|
13
17
|
* Defines what should be rendered when no components are available
|
|
14
18
|
* for the specified extension.
|
|
15
19
|
*/
|
|
16
|
-
empty?():
|
|
20
|
+
empty?(): ReactNode;
|
|
17
21
|
/**
|
|
18
22
|
* Defines how the provided nodes should be rendered.
|
|
19
23
|
* @param nodes The rendered extension nodes.
|
|
20
24
|
*/
|
|
21
|
-
render?(nodes: Array<
|
|
25
|
+
render?(nodes: Array<ReactNode>): ReactElement<any, any> | null;
|
|
22
26
|
/**
|
|
23
27
|
* The custom parameters for the given extension.
|
|
24
28
|
*/
|
package/lib/utils/extension.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ExtensionComponentProps, WrappedComponent } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Transforms the given component to an extension component.
|
|
5
|
+
* @param Component The component to transform.
|
|
6
|
+
* @returns The extension component (receiving its props via params).
|
|
7
|
+
*/
|
|
3
8
|
export declare function toExtension<T>(Component: React.ComponentType<T>): WrappedComponent<ExtensionComponentProps<T>>;
|
|
9
|
+
/**
|
|
10
|
+
* Reactifies the list of child nodes to a React Node by removing the
|
|
11
|
+
* nodes from the DOM and carrying it in a React Node, where it would be
|
|
12
|
+
* attached at a slot.
|
|
13
|
+
* @param childNodes The child nodes to reactify.
|
|
14
|
+
* @returns The React Node.
|
|
15
|
+
*/
|
|
16
|
+
export declare function reactifyContent(childNodes: NodeListOf<ChildNode>): React.ReactNode;
|
package/lib/utils/extension.js
CHANGED
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toExtension = void 0;
|
|
3
|
+
exports.reactifyContent = exports.toExtension = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
|
+
function removeAll(nodes) {
|
|
6
|
+
nodes.forEach((node) => node.remove());
|
|
7
|
+
}
|
|
8
|
+
const SlotCarrier = ({ nodes }) => {
|
|
9
|
+
const host = React.useRef();
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
var _a;
|
|
12
|
+
(_a = host.current) === null || _a === void 0 ? void 0 : _a.append(...nodes);
|
|
13
|
+
return () => removeAll(nodes);
|
|
14
|
+
}, [nodes]);
|
|
15
|
+
if (nodes.length) {
|
|
16
|
+
return React.createElement("slot", { ref: host });
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Transforms the given component to an extension component.
|
|
22
|
+
* @param Component The component to transform.
|
|
23
|
+
* @returns The extension component (receiving its props via params).
|
|
24
|
+
*/
|
|
5
25
|
function toExtension(Component) {
|
|
6
26
|
return (props) => React.createElement(Component, Object.assign({}, props.params));
|
|
7
27
|
}
|
|
8
28
|
exports.toExtension = toExtension;
|
|
29
|
+
/**
|
|
30
|
+
* Reactifies the list of child nodes to a React Node by removing the
|
|
31
|
+
* nodes from the DOM and carrying it in a React Node, where it would be
|
|
32
|
+
* attached at a slot.
|
|
33
|
+
* @param childNodes The child nodes to reactify.
|
|
34
|
+
* @returns The React Node.
|
|
35
|
+
*/
|
|
36
|
+
function reactifyContent(childNodes) {
|
|
37
|
+
const nodes = Array.prototype.filter.call(childNodes, Boolean);
|
|
38
|
+
removeAll(nodes);
|
|
39
|
+
return React.createElement(SlotCarrier, { nodes: nodes });
|
|
40
|
+
}
|
|
41
|
+
exports.reactifyContent = reactifyContent;
|
|
9
42
|
//# sourceMappingURL=extension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/utils/extension.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAG/B,SAAgB,WAAW,CAAI,SAAiC;IAC9D,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,SAAS,oBAAK,KAAK,CAAC,MAAM,EAAI,CAAC;AACpD,CAAC;AAFD,kCAEC"}
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/utils/extension.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAG/B,SAAS,SAAS,CAAC,KAAuB;IACxC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AACzC,CAAC;AAMD,MAAM,WAAW,GAA+B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAmB,CAAC;IAE7C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;QACnB,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;QAC/B,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,IAAI,KAAK,CAAC,MAAM,EAAE;QAChB,OAAO,8BAAM,GAAG,EAAE,IAAI,GAAI,CAAC;KAC5B;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;;GAIG;AACH,SAAgB,WAAW,CAAI,SAAiC;IAC9D,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,SAAS,oBAAK,KAAK,CAAC,MAAM,EAAI,CAAC;AACpD,CAAC;AAFD,kCAEC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,UAAiC;IAC/D,MAAM,KAAK,GAAqB,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjF,SAAS,CAAC,KAAK,CAAC,CAAC;IACjB,OAAO,oBAAC,WAAW,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC;AACvC,CAAC;AAJD,0CAIC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-core",
|
|
3
|
-
"version": "0.14.8-beta.
|
|
3
|
+
"version": "0.14.8-beta.3515",
|
|
4
4
|
"description": "The core library for creating a Piral instance.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@dbeining/react-atom": "^4.0.0",
|
|
53
|
-
"piral-base": "0.14.8-beta.
|
|
54
|
-
"piral-debug-utils": "0.14.8-beta.
|
|
53
|
+
"piral-base": "0.14.8-beta.3515",
|
|
54
|
+
"piral-debug-utils": "0.14.8-beta.3515"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": ">=16.8.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"@libre/atom",
|
|
79
79
|
"@dbeining/react-atom"
|
|
80
80
|
],
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "67b8421ae8c8da2ecde19e2dbb2494e092efde6e"
|
|
82
82
|
}
|
package/src/Piral.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { StateContext } from './state';
|
|
3
3
|
import { createInstance } from './createInstance';
|
|
4
4
|
import { PiralView, Mediator, ResponsiveLayout, PortalRenderer } from './components';
|
|
5
|
+
import { RootListener } from './RootListener';
|
|
5
6
|
import type { PiralProps } from './types';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -23,6 +24,7 @@ export const Piral: React.FC<PiralProps> = ({ instance = createInstance(), break
|
|
|
23
24
|
<StateContext.Provider value={instance.context}>
|
|
24
25
|
<ResponsiveLayout breakpoints={breakpoints} />
|
|
25
26
|
<Mediator options={instance.options} key={instance.id} />
|
|
27
|
+
<RootListener />
|
|
26
28
|
<PiralView>
|
|
27
29
|
<PortalRenderer id="root" />
|
|
28
30
|
{children}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useGlobalStateContext } from '.';
|
|
3
|
+
import { renderElement } from './modules';
|
|
4
|
+
|
|
5
|
+
export const RootListener: React.FC = () => {
|
|
6
|
+
const context = useGlobalStateContext();
|
|
7
|
+
|
|
8
|
+
React.useLayoutEffect(() => {
|
|
9
|
+
if (typeof document !== 'undefined') {
|
|
10
|
+
const handler = (ev: CustomEvent) => {
|
|
11
|
+
ev.stopPropagation();
|
|
12
|
+
const { target, props } = ev.detail;
|
|
13
|
+
const [dispose, update] = renderElement(context, target, props);
|
|
14
|
+
target.dispose = dispose;
|
|
15
|
+
target.update = update;
|
|
16
|
+
};
|
|
17
|
+
document.body.addEventListener('render-html', handler, false);
|
|
18
|
+
|
|
19
|
+
return () => {
|
|
20
|
+
document.body.removeEventListener('render-html', handler, false);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}, [context]);
|
|
24
|
+
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
@@ -10,7 +10,7 @@ import { ExtensionSlotProps } from '../types';
|
|
|
10
10
|
* location.
|
|
11
11
|
*/
|
|
12
12
|
export function ExtensionSlot<T extends string>(props: ExtensionSlotProps<T>) {
|
|
13
|
-
const { name, render = defaultRender, empty, params } = props;
|
|
13
|
+
const { name, render = defaultRender, empty, params, children } = props;
|
|
14
14
|
const extensions = useGlobalState((s) => s.registry.extensions[name] || none);
|
|
15
15
|
return render(
|
|
16
16
|
extensions.length === 0 && isfunc(empty)
|
|
@@ -18,6 +18,7 @@ export function ExtensionSlot<T extends string>(props: ExtensionSlotProps<T>) {
|
|
|
18
18
|
: extensions.map(({ component: Component, reference, defaults = {} }, i) => (
|
|
19
19
|
<Component
|
|
20
20
|
key={`${reference?.displayName || '_'}${i}`}
|
|
21
|
+
children={children}
|
|
21
22
|
params={{
|
|
22
23
|
...defaults,
|
|
23
24
|
...(params || {}),
|
package/src/modules/api.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElement, FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { defaultApiFactory } from './api';
|
|
3
3
|
|
|
4
4
|
jest.mock('../hooks');
|
|
5
5
|
|
|
@@ -21,21 +21,21 @@ function createMockContainer() {
|
|
|
21
21
|
off: jest.fn(),
|
|
22
22
|
emit: jest.fn(),
|
|
23
23
|
converters: {},
|
|
24
|
+
apis: {},
|
|
24
25
|
readState() {
|
|
25
26
|
return undefined;
|
|
26
27
|
},
|
|
27
28
|
} as any,
|
|
28
|
-
api: {} as any,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function createApi(container) {
|
|
33
|
-
|
|
34
|
-
return
|
|
32
|
+
function createApi(container, apis = []) {
|
|
33
|
+
const api = defaultApiFactory(container.context, apis);
|
|
34
|
+
return api(moduleMetadata);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
describe('API Module', () => {
|
|
38
|
-
it('
|
|
38
|
+
it('defaultApiFactory can register and unregister a page', () => {
|
|
39
39
|
const container = createMockContainer();
|
|
40
40
|
container.context.registerPage = jest.fn();
|
|
41
41
|
container.context.unregisterPage = jest.fn();
|
|
@@ -48,7 +48,7 @@ describe('API Module', () => {
|
|
|
48
48
|
expect(container.context.unregisterPage.mock.calls[0][0]).toBe(container.context.registerPage.mock.calls[0][0]);
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
it('
|
|
51
|
+
it('defaultApiFactory can dispose a registered page', () => {
|
|
52
52
|
const container = createMockContainer();
|
|
53
53
|
container.context.registerPage = jest.fn();
|
|
54
54
|
container.context.unregisterPage = jest.fn();
|
|
@@ -61,7 +61,7 @@ describe('API Module', () => {
|
|
|
61
61
|
expect(container.context.unregisterPage.mock.calls[0][0]).toBe(container.context.registerPage.mock.calls[0][0]);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
it('
|
|
64
|
+
it('defaultApiFactory can register and unregister an extension', () => {
|
|
65
65
|
const container = createMockContainer();
|
|
66
66
|
container.context.registerExtension = jest.fn();
|
|
67
67
|
container.context.unregisterExtension = jest.fn();
|
|
@@ -76,7 +76,7 @@ describe('API Module', () => {
|
|
|
76
76
|
);
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
it('
|
|
79
|
+
it('defaultApiFactory can dispose an registered extension', () => {
|
|
80
80
|
const container = createMockContainer();
|
|
81
81
|
container.context.registerExtension = jest.fn();
|
|
82
82
|
container.context.unregisterExtension = jest.fn();
|
|
@@ -91,7 +91,7 @@ describe('API Module', () => {
|
|
|
91
91
|
);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
it('
|
|
94
|
+
it('defaultApiFactory read data by its name', () => {
|
|
95
95
|
const container = createMockContainer();
|
|
96
96
|
container.context.readDataValue = jest.fn((name) => name);
|
|
97
97
|
const api = createApi(container);
|
|
@@ -100,7 +100,7 @@ describe('API Module', () => {
|
|
|
100
100
|
expect(container.context.readDataValue).toHaveBeenCalled();
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
-
it('
|
|
103
|
+
it('defaultApiFactory write data without options shall pass, but memory should not emit events', () => {
|
|
104
104
|
const container = createMockContainer();
|
|
105
105
|
container.context.tryWriteDataItem = jest.fn(() => true);
|
|
106
106
|
const api = createApi(container);
|
|
@@ -109,7 +109,7 @@ describe('API Module', () => {
|
|
|
109
109
|
expect(container.context.emit).not.toHaveBeenCalled();
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
it('
|
|
112
|
+
it('defaultApiFactory write data with empty options shall pass, but memory should not emit events', () => {
|
|
113
113
|
const container = createMockContainer();
|
|
114
114
|
container.context.tryWriteDataItem = jest.fn(() => true);
|
|
115
115
|
const api = createApi(container);
|
|
@@ -118,7 +118,7 @@ describe('API Module', () => {
|
|
|
118
118
|
expect(container.context.emit).not.toHaveBeenCalled();
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
it('
|
|
121
|
+
it('defaultApiFactory write data by the simple option should not pass, never emitting events', () => {
|
|
122
122
|
const container = createMockContainer();
|
|
123
123
|
container.context.tryWriteDataItem = jest.fn(() => false);
|
|
124
124
|
const api = createApi(container);
|
|
@@ -127,7 +127,7 @@ describe('API Module', () => {
|
|
|
127
127
|
expect(container.context.emit).not.toHaveBeenCalled();
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
it('
|
|
130
|
+
it('defaultApiFactory write data by the simple option shall pass with remote', () => {
|
|
131
131
|
const container = createMockContainer();
|
|
132
132
|
container.context.tryWriteDataItem = jest.fn(() => true);
|
|
133
133
|
const api = createApi(container);
|
|
@@ -135,7 +135,7 @@ describe('API Module', () => {
|
|
|
135
135
|
expect(container.context.tryWriteDataItem).toHaveBeenCalled();
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
-
it('
|
|
138
|
+
it('defaultApiFactory write data by the object options shall pass with remote', () => {
|
|
139
139
|
const container = createMockContainer();
|
|
140
140
|
container.context.tryWriteDataItem = jest.fn(() => true);
|
|
141
141
|
const api = createApi(container);
|