piral-react 1.6.0-beta.7240 → 1.6.0-beta.7243
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/convert.d.ts +1 -1
- package/convert.js +1 -1
- package/lib/converter.js +7 -11
- package/lib/converter.js.map +1 -1
- package/lib/create.js +3 -7
- package/lib/create.js.map +1 -1
- package/lib/extension.js +8 -12
- package/lib/extension.js.map +1 -1
- package/lib/index.js +2 -5
- package/lib/index.js.map +1 -1
- package/lib/mount.js +9 -15
- package/lib/mount.js.map +1 -1
- package/lib/types.js +1 -2
- package/package.json +9 -25
- package/esm/converter.d.ts +0 -13
- package/esm/converter.js +0 -20
- package/esm/converter.js.map +0 -1
- package/esm/create.d.ts +0 -12
- package/esm/create.js +0 -20
- package/esm/create.js.map +0 -1
- package/esm/extension.d.ts +0 -1
- package/esm/extension.js +0 -57
- package/esm/extension.js.map +0 -1
- package/esm/index.d.ts +0 -2
- package/esm/index.js +0 -3
- package/esm/index.js.map +0 -1
- package/esm/mount.d.ts +0 -5
- package/esm/mount.js +0 -28
- package/esm/mount.js.map +0 -1
- package/esm/types.d.ts +0 -34
- package/esm/types.js +0 -2
- package/esm/types.js.map +0 -1
package/convert.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { createConverter } from './
|
|
2
|
+
import { createConverter } from './lib/converter';
|
|
3
3
|
export interface HtmlComponent<TProps> {
|
|
4
4
|
component: {
|
|
5
5
|
mount(element: HTMLElement, props: TProps, ctx: any, locals: any): void;
|
package/convert.js
CHANGED
package/lib/converter.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const extension_1 = require("./extension");
|
|
5
|
-
const mount_1 = require("./mount");
|
|
6
|
-
function createConverter(config = {}) {
|
|
1
|
+
import { createExtension } from './extension';
|
|
2
|
+
import { mountReact, unmountReact } from './mount';
|
|
3
|
+
export function createConverter(config = {}) {
|
|
7
4
|
const { rootName = 'piral-slot' } = config;
|
|
8
|
-
const Extension =
|
|
5
|
+
const Extension = createExtension(rootName);
|
|
9
6
|
const convert = (root) => ({
|
|
10
7
|
mount(el, props, ctx) {
|
|
11
|
-
|
|
8
|
+
mountReact(el, root, props, ctx);
|
|
12
9
|
},
|
|
13
10
|
update(el, props, ctx) {
|
|
14
|
-
|
|
11
|
+
mountReact(el, root, props, ctx);
|
|
15
12
|
},
|
|
16
13
|
unmount(el) {
|
|
17
|
-
|
|
14
|
+
unmountReact(el);
|
|
18
15
|
},
|
|
19
16
|
});
|
|
20
17
|
convert.Extension = Extension;
|
|
21
18
|
return convert;
|
|
22
19
|
}
|
|
23
|
-
exports.createConverter = createConverter;
|
|
24
20
|
//# sourceMappingURL=converter.js.map
|
package/lib/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUnD,MAAM,UAAU,eAAe,CAAC,SAAgC,EAAE;IAChE,MAAM,EAAE,QAAQ,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC;IAC3C,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CAAoC,IAA2B,EAA4B,EAAE,CAAC,CAAC;QAC7G,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YAClB,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC;QACD,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YACnB,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,CAAC,EAAE;YACR,YAAY,CAAC,EAAE,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/lib/create.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createReactApi = void 0;
|
|
4
|
-
const converter_1 = require("./converter");
|
|
1
|
+
import { createConverter } from './converter';
|
|
5
2
|
/**
|
|
6
3
|
* Creates Pilet API extensions for integrating React 16+.
|
|
7
4
|
*/
|
|
8
|
-
function createReactApi(config = {}) {
|
|
5
|
+
export function createReactApi(config = {}) {
|
|
9
6
|
return (context) => {
|
|
10
|
-
const convert =
|
|
7
|
+
const convert = createConverter(config);
|
|
11
8
|
context.converters.react = ({ root }) => convert(root);
|
|
12
9
|
return {
|
|
13
10
|
fromReact(root) {
|
|
@@ -20,5 +17,4 @@ function createReactApi(config = {}) {
|
|
|
20
17
|
};
|
|
21
18
|
};
|
|
22
19
|
}
|
|
23
|
-
exports.createReactApi = createReactApi;
|
|
24
20
|
//# sourceMappingURL=create.js.map
|
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":"AACA,OAAO,EAAE,eAAe,EAAyB,MAAM,aAAa,CAAC;AAQrE;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,SAAsB,EAAE;IACrD,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEvD,OAAO;YACL,SAAS,CAAC,IAAI;gBACZ,OAAO;oBACL,IAAI,EAAE,OAAO;oBACb,IAAI;iBACL,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,OAAO,CAAC,SAAS;SAClC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/lib/extension.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const mount_1 = require("./mount");
|
|
1
|
+
import { __setFunctionName } from "tslib";
|
|
2
|
+
import { createElement, Component } from 'react';
|
|
3
|
+
import { anyPropType } from './mount';
|
|
7
4
|
function compareObjects(a, b) {
|
|
8
5
|
for (const i in a) {
|
|
9
6
|
if (!(i in b)) {
|
|
@@ -28,9 +25,9 @@ function compare(a, b) {
|
|
|
28
25
|
}
|
|
29
26
|
return true;
|
|
30
27
|
}
|
|
31
|
-
function createExtension(rootName) {
|
|
28
|
+
export function createExtension(rootName) {
|
|
32
29
|
var _a;
|
|
33
|
-
const ReactExtension = (_a = class extends
|
|
30
|
+
const ReactExtension = (_a = class extends Component {
|
|
34
31
|
constructor() {
|
|
35
32
|
super(...arguments);
|
|
36
33
|
this.onRefChange = (element) => {
|
|
@@ -45,17 +42,16 @@ function createExtension(rootName) {
|
|
|
45
42
|
return !compare(this.props, nextProps);
|
|
46
43
|
}
|
|
47
44
|
render() {
|
|
48
|
-
return
|
|
45
|
+
return createElement(rootName, {
|
|
49
46
|
ref: this.onRefChange,
|
|
50
47
|
});
|
|
51
48
|
}
|
|
52
49
|
},
|
|
53
|
-
|
|
50
|
+
__setFunctionName(_a, "ReactExtension"),
|
|
54
51
|
_a.contextTypes = {
|
|
55
|
-
piral:
|
|
52
|
+
piral: anyPropType,
|
|
56
53
|
},
|
|
57
54
|
_a);
|
|
58
55
|
return ReactExtension;
|
|
59
56
|
}
|
|
60
|
-
exports.createExtension = createExtension;
|
|
61
57
|
//# sourceMappingURL=extension.js.map
|
package/lib/extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,SAAS,cAAc,CAAC,CAAM,EAAE,CAAM;IACpC,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;YACb,OAAO,KAAK,CAAC;SACd;KACF;IAED,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACxB,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,OAAO,CAAI,CAAI,EAAE,CAAI;IAC5B,IAAI,CAAC,KAAK,CAAC,EAAE;QACX,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;QACpB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;QAEpB,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,EAAE;YAC1C,OAAO,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC7B;QAED,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB;;IAC9C,MAAM,cAAc,SAAQ,KAAM,SAAQ,SAA6B;YAA3C;;gBAKlB,gBAAW,GAAG,CAAC,OAAoB,EAAE,EAAE;oBAC7C,IAAI,OAAO,EAAE;wBACX,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,OAA8B,CAAC;wBACtD,OAAO,CAAC,SAAS,GAAG,EAAE,CAAC;wBACvB,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;qBAChD;gBACH,CAAC,CAAC;YAWJ,CAAC;YATC,qBAAqB,CAAC,SAA6B;gBACjD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACzC,CAAC;YAED,MAAM;gBACJ,OAAO,aAAa,CAAC,QAAQ,EAAE;oBAC7B,GAAG,EAAE,IAAI,CAAC,WAAW;iBACtB,CAAC,CAAC;YACL,CAAC;SACF;;QArBQ,eAAY,GAAG;YACpB,KAAK,EAAE,WAAW;SAClB;WAmBH,CAAC;IAEF,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./create"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
1
|
+
export * from './create';
|
|
2
|
+
export * from './types';
|
|
6
3
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
package/lib/mount.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.unmountReact = exports.mountReact = exports.anyPropType = void 0;
|
|
4
|
-
const react_dom_1 = require("react-dom");
|
|
5
|
-
const react_1 = require("react");
|
|
1
|
+
import { render } from 'react-dom';
|
|
2
|
+
import { createElement, Component } from 'react';
|
|
6
3
|
// tslint:disable-next-line:no-null-keyword
|
|
7
|
-
const anyPropType = () => null;
|
|
8
|
-
|
|
9
|
-
function mountReact(el, root, props, ctx = {}) {
|
|
4
|
+
export const anyPropType = () => null;
|
|
5
|
+
export function mountReact(el, root, props, ctx = {}) {
|
|
10
6
|
const contextTypes = {};
|
|
11
7
|
['piral', ...Object.keys(ctx)].forEach((key) => {
|
|
12
|
-
contextTypes[key] =
|
|
8
|
+
contextTypes[key] = anyPropType;
|
|
13
9
|
});
|
|
14
|
-
class Provider extends
|
|
10
|
+
class Provider extends Component {
|
|
15
11
|
getChildContext() {
|
|
16
12
|
return {
|
|
17
13
|
piral: props.piral,
|
|
@@ -23,12 +19,10 @@ function mountReact(el, root, props, ctx = {}) {
|
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
Provider.childContextTypes = contextTypes;
|
|
26
|
-
|
|
22
|
+
render(createElement(Provider, {}, createElement(root, props)), el);
|
|
27
23
|
}
|
|
28
|
-
|
|
29
|
-
function unmountReact(el) {
|
|
24
|
+
export function unmountReact(el) {
|
|
30
25
|
// tslint:disable-next-line:no-null-keyword
|
|
31
|
-
|
|
26
|
+
render(null, el);
|
|
32
27
|
}
|
|
33
|
-
exports.unmountReact = unmountReact;
|
|
34
28
|
//# sourceMappingURL=mount.js.map
|
package/lib/mount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhE,2CAA2C;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;AAEtC,MAAM,UAAU,UAAU,CACxB,EAAe,EACf,IAAsB,EACtB,KAAQ,EACR,MAAW,EAAE;IAEb,MAAM,YAAY,GAAG,EAAE,CAAC;IAExB,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC7C,YAAY,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,QAAS,SAAQ,SAA6B;QAGlD,eAAe;YACb,OAAO;gBACL,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,GAAG,GAAG;aACP,CAAC;QACJ,CAAC;QAED,MAAM;YACJ,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC7B,CAAC;;IAXM,0BAAiB,GAAG,YAAY,CAAC;IAc1C,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,EAAE,aAAa,CAAC,IAAW,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAAe;IAC1C,2CAA2C;IAC3C,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACnB,CAAC"}
|
package/lib/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-react",
|
|
3
|
-
"version": "1.6.0-beta.
|
|
3
|
+
"version": "1.6.0-beta.7243",
|
|
4
4
|
"description": "Plugin for integrating React 16+ components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -19,32 +19,17 @@
|
|
|
19
19
|
"author": "smapiot",
|
|
20
20
|
"homepage": "https://piral.io",
|
|
21
21
|
"license": "MIT",
|
|
22
|
-
"module": "
|
|
22
|
+
"module": "lib/index.js",
|
|
23
23
|
"main": "lib/index.js",
|
|
24
24
|
"typings": "lib/index.d.ts",
|
|
25
25
|
"exports": {
|
|
26
|
-
".":
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
"./convert": {
|
|
31
|
-
"import": "./convert.js"
|
|
32
|
-
},
|
|
33
|
-
"./esm/*": {
|
|
34
|
-
"import": "./esm/*"
|
|
35
|
-
},
|
|
36
|
-
"./lib/*": {
|
|
37
|
-
"require": "./lib/*"
|
|
38
|
-
},
|
|
39
|
-
"./_/*": {
|
|
40
|
-
"import": "./esm/*.js",
|
|
41
|
-
"require": "./lib/*.js"
|
|
42
|
-
},
|
|
26
|
+
".": "./lib/index.js",
|
|
27
|
+
"./convert": "./convert.js",
|
|
28
|
+
"./lib/*": "./lib/*",
|
|
43
29
|
"./package.json": "./package.json"
|
|
44
30
|
},
|
|
45
31
|
"sideEffects": false,
|
|
46
32
|
"files": [
|
|
47
|
-
"esm",
|
|
48
33
|
"lib",
|
|
49
34
|
"src",
|
|
50
35
|
"convert.d.ts",
|
|
@@ -59,15 +44,14 @@
|
|
|
59
44
|
},
|
|
60
45
|
"scripts": {
|
|
61
46
|
"cleanup": "rimraf esm lib convert.d.ts convert.js",
|
|
62
|
-
"build": "yarn build:
|
|
47
|
+
"build": "yarn build:esnext && yarn build:convert",
|
|
63
48
|
"build:convert": "tsc convert.ts --skipLibCheck --declaration --module esnext",
|
|
64
|
-
"build:
|
|
65
|
-
"build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
|
|
49
|
+
"build:esnext": "tsc --project tsconfig.json --outDir lib --module esnext",
|
|
66
50
|
"typedoc": "typedoc --json ../../../docs/types/piral-react.json src --exclude \"src/**/*.test.*\"",
|
|
67
51
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
68
52
|
},
|
|
69
53
|
"devDependencies": {
|
|
70
|
-
"piral-core": "1.6.0-beta.
|
|
54
|
+
"piral-core": "1.6.0-beta.7243"
|
|
71
55
|
},
|
|
72
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "bbb6e4f78c61b6ef753099a5b378ad2708565ce3"
|
|
73
57
|
}
|
package/esm/converter.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ForeignComponent, BaseComponentProps } from 'piral-core';
|
|
2
|
-
import type { ComponentType } from 'react';
|
|
3
|
-
export interface ReactConverterOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Defines the name of the root element.
|
|
6
|
-
* @default piral-slot
|
|
7
|
-
*/
|
|
8
|
-
rootName?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function createConverter(config?: ReactConverterOptions): {
|
|
11
|
-
<TProps extends BaseComponentProps>(root: ComponentType<TProps>): ForeignComponent<TProps>;
|
|
12
|
-
Extension: any;
|
|
13
|
-
};
|
package/esm/converter.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createExtension } from './extension';
|
|
2
|
-
import { mountReact, unmountReact } from './mount';
|
|
3
|
-
export function createConverter(config = {}) {
|
|
4
|
-
const { rootName = 'piral-slot' } = config;
|
|
5
|
-
const Extension = createExtension(rootName);
|
|
6
|
-
const convert = (root) => ({
|
|
7
|
-
mount(el, props, ctx) {
|
|
8
|
-
mountReact(el, root, props, ctx);
|
|
9
|
-
},
|
|
10
|
-
update(el, props, ctx) {
|
|
11
|
-
mountReact(el, root, props, ctx);
|
|
12
|
-
},
|
|
13
|
-
unmount(el) {
|
|
14
|
-
unmountReact(el);
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
convert.Extension = Extension;
|
|
18
|
-
return convert;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=converter.js.map
|
package/esm/converter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUnD,MAAM,UAAU,eAAe,CAAC,SAAgC,EAAE;IAChE,MAAM,EAAE,QAAQ,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC;IAC3C,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CAAoC,IAA2B,EAA4B,EAAE,CAAC,CAAC;QAC7G,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YAClB,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC;QACD,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YACnB,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,CAAC,EAAE;YACR,YAAY,CAAC,EAAE,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/esm/create.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PiralPlugin } from 'piral-core';
|
|
2
|
-
import { ReactConverterOptions } from './converter';
|
|
3
|
-
import type { PiletReactApi } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Available configuration options for the React 16+ plugin.
|
|
6
|
-
*/
|
|
7
|
-
export interface ReactConfig extends ReactConverterOptions {
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Creates Pilet API extensions for integrating React 16+.
|
|
11
|
-
*/
|
|
12
|
-
export declare function createReactApi(config?: ReactConfig): PiralPlugin<PiletReactApi>;
|
package/esm/create.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createConverter } from './converter';
|
|
2
|
-
/**
|
|
3
|
-
* Creates Pilet API extensions for integrating React 16+.
|
|
4
|
-
*/
|
|
5
|
-
export function createReactApi(config = {}) {
|
|
6
|
-
return (context) => {
|
|
7
|
-
const convert = createConverter(config);
|
|
8
|
-
context.converters.react = ({ root }) => convert(root);
|
|
9
|
-
return {
|
|
10
|
-
fromReact(root) {
|
|
11
|
-
return {
|
|
12
|
-
type: 'react',
|
|
13
|
-
root,
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
ReactExtension: convert.Extension,
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=create.js.map
|
package/esm/create.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAyB,MAAM,aAAa,CAAC;AAQrE;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,SAAsB,EAAE;IACrD,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEvD,OAAO;YACL,SAAS,CAAC,IAAI;gBACZ,OAAO;oBACL,IAAI,EAAE,OAAO;oBACb,IAAI;iBACL,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,OAAO,CAAC,SAAS;SAClC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/esm/extension.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createExtension(rootName: string): any;
|
package/esm/extension.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { __setFunctionName } from "tslib";
|
|
2
|
-
import { createElement, Component } from 'react';
|
|
3
|
-
import { anyPropType } from './mount';
|
|
4
|
-
function compareObjects(a, b) {
|
|
5
|
-
for (const i in a) {
|
|
6
|
-
if (!(i in b)) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
for (const i in b) {
|
|
11
|
-
if (!compare(a[i], b[i])) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
function compare(a, b) {
|
|
18
|
-
if (a !== b) {
|
|
19
|
-
const ta = typeof a;
|
|
20
|
-
const tb = typeof b;
|
|
21
|
-
if (ta === tb && ta === 'object' && a && b) {
|
|
22
|
-
return compareObjects(a, b);
|
|
23
|
-
}
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
export function createExtension(rootName) {
|
|
29
|
-
var _a;
|
|
30
|
-
const ReactExtension = (_a = class extends Component {
|
|
31
|
-
constructor() {
|
|
32
|
-
super(...arguments);
|
|
33
|
-
this.onRefChange = (element) => {
|
|
34
|
-
if (element) {
|
|
35
|
-
const { piral } = this.context;
|
|
36
|
-
element.innerHTML = '';
|
|
37
|
-
piral.renderHtmlExtension(element, this.props);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
shouldComponentUpdate(nextProps) {
|
|
42
|
-
return !compare(this.props, nextProps);
|
|
43
|
-
}
|
|
44
|
-
render() {
|
|
45
|
-
return createElement(rootName, {
|
|
46
|
-
ref: this.onRefChange,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
__setFunctionName(_a, "ReactExtension"),
|
|
51
|
-
_a.contextTypes = {
|
|
52
|
-
piral: anyPropType,
|
|
53
|
-
},
|
|
54
|
-
_a);
|
|
55
|
-
return ReactExtension;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=extension.js.map
|
package/esm/extension.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,SAAS,cAAc,CAAC,CAAM,EAAE,CAAM;IACpC,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;YACb,OAAO,KAAK,CAAC;SACd;KACF;IAED,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACxB,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,OAAO,CAAI,CAAI,EAAE,CAAI;IAC5B,IAAI,CAAC,KAAK,CAAC,EAAE;QACX,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;QACpB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;QAEpB,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,EAAE;YAC1C,OAAO,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC7B;QAED,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB;;IAC9C,MAAM,cAAc,SAAQ,KAAM,SAAQ,SAA6B;YAA3C;;gBAKlB,gBAAW,GAAG,CAAC,OAAoB,EAAE,EAAE;oBAC7C,IAAI,OAAO,EAAE;wBACX,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,OAA8B,CAAC;wBACtD,OAAO,CAAC,SAAS,GAAG,EAAE,CAAC;wBACvB,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;qBAChD;gBACH,CAAC,CAAC;YAWJ,CAAC;YATC,qBAAqB,CAAC,SAA6B;gBACjD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACzC,CAAC;YAED,MAAM;gBACJ,OAAO,aAAa,CAAC,QAAQ,EAAE;oBAC7B,GAAG,EAAE,IAAI,CAAC,WAAW;iBACtB,CAAC,CAAC;YACL,CAAC;SACF;;QArBQ,eAAY,GAAG;YACpB,KAAK,EAAE,WAAW;SAClB;WAmBH,CAAC;IAEF,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/esm/index.d.ts
DELETED
package/esm/index.js
DELETED
package/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
package/esm/mount.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { BaseComponentProps } from 'piral-core';
|
|
2
|
-
import { ComponentType } from 'react';
|
|
3
|
-
export declare const anyPropType: () => any;
|
|
4
|
-
export declare function mountReact<T extends BaseComponentProps>(el: HTMLElement, root: ComponentType<T>, props: T, ctx?: any): void;
|
|
5
|
-
export declare function unmountReact(el: HTMLElement): void;
|
package/esm/mount.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { render } from 'react-dom';
|
|
2
|
-
import { createElement, Component } from 'react';
|
|
3
|
-
// tslint:disable-next-line:no-null-keyword
|
|
4
|
-
export const anyPropType = () => null;
|
|
5
|
-
export function mountReact(el, root, props, ctx = {}) {
|
|
6
|
-
const contextTypes = {};
|
|
7
|
-
['piral', ...Object.keys(ctx)].forEach((key) => {
|
|
8
|
-
contextTypes[key] = anyPropType;
|
|
9
|
-
});
|
|
10
|
-
class Provider extends Component {
|
|
11
|
-
getChildContext() {
|
|
12
|
-
return {
|
|
13
|
-
piral: props.piral,
|
|
14
|
-
...ctx,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
render() {
|
|
18
|
-
return this.props.children;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
Provider.childContextTypes = contextTypes;
|
|
22
|
-
render(createElement(Provider, {}, createElement(root, props)), el);
|
|
23
|
-
}
|
|
24
|
-
export function unmountReact(el) {
|
|
25
|
-
// tslint:disable-next-line:no-null-keyword
|
|
26
|
-
render(null, el);
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=mount.js.map
|
package/esm/mount.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhE,2CAA2C;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;AAEtC,MAAM,UAAU,UAAU,CACxB,EAAe,EACf,IAAsB,EACtB,KAAQ,EACR,MAAW,EAAE;IAEb,MAAM,YAAY,GAAG,EAAE,CAAC;IAExB,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC7C,YAAY,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,QAAS,SAAQ,SAA6B;QAGlD,eAAe;YACb,OAAO;gBACL,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,GAAG,GAAG;aACP,CAAC;QACJ,CAAC;QAED,MAAM;YACJ,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC7B,CAAC;;IAXM,0BAAiB,GAAG,YAAY,CAAC;IAc1C,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,EAAE,aAAa,CAAC,IAAW,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAAe;IAC1C,2CAA2C;IAC3C,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACnB,CAAC"}
|
package/esm/types.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
2
|
-
import type { Component, ComponentType } from 'react';
|
|
3
|
-
declare module 'piral-core/lib/types/custom' {
|
|
4
|
-
interface PiletCustomApi extends PiletReactApi {
|
|
5
|
-
}
|
|
6
|
-
interface PiralCustomComponentConverters<TProps> {
|
|
7
|
-
react(component: ReactComponent<TProps>): ForeignComponent<TProps>;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export interface ReactComponent<TProps> {
|
|
11
|
-
/**
|
|
12
|
-
* The component root.
|
|
13
|
-
*/
|
|
14
|
-
root: ComponentType<TProps>;
|
|
15
|
-
/**
|
|
16
|
-
* The type of the React 16+ component.
|
|
17
|
-
*/
|
|
18
|
-
type: 'react';
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Defines the provided set of Pilet API extensions from the React 16+ plugin.
|
|
22
|
-
*/
|
|
23
|
-
export interface PiletReactApi {
|
|
24
|
-
/**
|
|
25
|
-
* Wraps an React 16+ component for use in Piral.
|
|
26
|
-
* @param component The component root.
|
|
27
|
-
* @returns The Piral React 16+ component.
|
|
28
|
-
*/
|
|
29
|
-
fromReact<TProps>(component: ComponentType<TProps>): ReactComponent<TProps>;
|
|
30
|
-
/**
|
|
31
|
-
* React 16+ component for displaying extensions of the given name.
|
|
32
|
-
*/
|
|
33
|
-
ReactExtension: Component<ExtensionSlotProps>;
|
|
34
|
-
}
|
package/esm/types.js
DELETED
package/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|