piral-elm 0.15.0-alpha.3816 → 0.15.0-alpha.3975
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/README.md +1 -1
- package/convert.d.ts +9 -2
- package/convert.js +1 -1
- package/esm/converter.js +12 -14
- package/esm/converter.js.map +1 -1
- package/lib/converter.js +12 -14
- package/lib/converter.js.map +1 -1
- package/package.json +3 -6
- package/src/converter.ts +16 -18
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# [Piral Elm](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-elm) [](https://jestjs.io) [](https://gitter.im/piral-io/community)
|
|
4
4
|
|
|
5
|
-
This is a plugin that
|
|
5
|
+
This is a plugin that has no peer dependencies. What `piral-elm` brings to the table is a set of Pilet API extensions that can be used with `piral` or `piral-core`.
|
|
6
6
|
|
|
7
7
|
The set includes an Elm converter for any component registration, as well as a `fromElm` shortcut together with a `elm-extension` web component.
|
|
8
8
|
|
package/convert.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { createConverter } from './esm/converter';
|
|
2
|
+
export interface HtmlComponent<TProps> {
|
|
3
|
+
component: {
|
|
4
|
+
mount(element: HTMLElement, props: TProps, ctx: any, locals: any): void;
|
|
5
|
+
update?(element: HTMLElement, props: TProps, ctx: any, locals: any): void;
|
|
6
|
+
unmount?(element: HTMLElement, locals: any): void;
|
|
7
|
+
};
|
|
8
|
+
type: 'html';
|
|
9
|
+
}
|
|
3
10
|
export interface ElmConverter {
|
|
4
11
|
(...params: Parameters<ReturnType<typeof createConverter>>): HtmlComponent<any>;
|
|
5
12
|
}
|
package/convert.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
3
|
exports.ElmExtension = exports.fromElm = exports.createElmConverter = void 0;
|
|
4
|
-
var converter_1 = require("./
|
|
4
|
+
var converter_1 = require("./esm/converter");
|
|
5
5
|
function createElmConverter() {
|
|
6
6
|
var params = [];
|
|
7
7
|
for (var _i = 0; _i < arguments.length; _i++) {
|
package/esm/converter.js
CHANGED
|
@@ -2,20 +2,18 @@ import { createExtension } from './extension';
|
|
|
2
2
|
export function createConverter(config = {}) {
|
|
3
3
|
const { selector = 'elm-extension' } = config;
|
|
4
4
|
const Extension = createExtension(selector);
|
|
5
|
-
const convert = (main, captured) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
};
|
|
5
|
+
const convert = (main, captured) => ({
|
|
6
|
+
mount(el, props, ctx) {
|
|
7
|
+
const node = el.appendChild(document.createElement('div'));
|
|
8
|
+
main.init({
|
|
9
|
+
node,
|
|
10
|
+
flags: Object.assign(Object.assign(Object.assign({}, captured), ctx), props),
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
unmount(el) {
|
|
14
|
+
el.innerHTML = '';
|
|
15
|
+
},
|
|
16
|
+
});
|
|
19
17
|
convert.Extension = Extension;
|
|
20
18
|
return convert;
|
|
21
19
|
}
|
package/esm/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAW9C,MAAM,UAAU,eAAe,CAAC,SAA8B,EAAE;IAC9D,MAAM,EAAE,QAAQ,GAAG,eAAe,EAAE,GAAG,MAAM,CAAC;IAC9C,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,IAAuB,EACvB,QAA8B,EACJ,EAAE
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAW9C,MAAM,UAAU,eAAe,CAAC,SAA8B,EAAE;IAC9D,MAAM,EAAE,QAAQ,GAAG,eAAe,EAAE,GAAG,MAAM,CAAC;IAC9C,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,IAAuB,EACvB,QAA8B,EACJ,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YAClB,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;YAC3D,IAAI,CAAC,IAAI,CAAC;gBACR,IAAI;gBACJ,KAAK,gDACA,QAAQ,GACR,GAAG,GACH,KAAK,CACT;aACF,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,EAAE;YACR,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/lib/converter.js
CHANGED
|
@@ -5,20 +5,18 @@ const extension_1 = require("./extension");
|
|
|
5
5
|
function createConverter(config = {}) {
|
|
6
6
|
const { selector = 'elm-extension' } = config;
|
|
7
7
|
const Extension = (0, extension_1.createExtension)(selector);
|
|
8
|
-
const convert = (main, captured) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
};
|
|
8
|
+
const convert = (main, captured) => ({
|
|
9
|
+
mount(el, props, ctx) {
|
|
10
|
+
const node = el.appendChild(document.createElement('div'));
|
|
11
|
+
main.init({
|
|
12
|
+
node,
|
|
13
|
+
flags: Object.assign(Object.assign(Object.assign({}, captured), ctx), props),
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
unmount(el) {
|
|
17
|
+
el.innerHTML = '';
|
|
18
|
+
},
|
|
19
|
+
});
|
|
22
20
|
convert.Extension = Extension;
|
|
23
21
|
return convert;
|
|
24
22
|
}
|
package/lib/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAW9C,SAAgB,eAAe,CAAC,SAA8B,EAAE;IAC9D,MAAM,EAAE,QAAQ,GAAG,eAAe,EAAE,GAAG,MAAM,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,IAAuB,EACvB,QAA8B,EACJ,EAAE
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAW9C,SAAgB,eAAe,CAAC,SAA8B,EAAE;IAC9D,MAAM,EAAE,QAAQ,GAAG,eAAe,EAAE,GAAG,MAAM,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,IAAuB,EACvB,QAA8B,EACJ,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YAClB,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;YAC3D,IAAI,CAAC,IAAI,CAAC;gBACR,IAAI;gBACJ,KAAK,gDACA,QAAQ,GACR,GAAG,GACH,KAAK,CACT;aACF,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,EAAE;YACR,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAxBD,0CAwBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-elm",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.3975",
|
|
4
4
|
"description": "Plugin for integrating Elm components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -44,10 +44,7 @@
|
|
|
44
44
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"piral-core": "0.15.0-alpha.
|
|
47
|
+
"piral-core": "0.15.0-alpha.3975"
|
|
48
48
|
},
|
|
49
|
-
"
|
|
50
|
-
"piral-core": "0.14.x"
|
|
51
|
-
},
|
|
52
|
-
"gitHead": "cfd7ed44c6b73655be56587aeaf774692e0c94ad"
|
|
49
|
+
"gitHead": "461d63cd1957359472018b32a56778da716d3406"
|
|
53
50
|
}
|
package/src/converter.ts
CHANGED
|
@@ -16,24 +16,22 @@ export function createConverter(config: ElmConverterOptions = {}) {
|
|
|
16
16
|
const convert = <TProps extends BaseComponentProps>(
|
|
17
17
|
main: ElmModule<TProps>,
|
|
18
18
|
captured?: Record<string, any>,
|
|
19
|
-
): ForeignComponent<TProps> => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
};
|
|
19
|
+
): ForeignComponent<TProps> => ({
|
|
20
|
+
mount(el, props, ctx) {
|
|
21
|
+
const node = el.appendChild(document.createElement('div'));
|
|
22
|
+
main.init({
|
|
23
|
+
node,
|
|
24
|
+
flags: {
|
|
25
|
+
...captured,
|
|
26
|
+
...ctx,
|
|
27
|
+
...props,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
unmount(el) {
|
|
32
|
+
el.innerHTML = '';
|
|
33
|
+
},
|
|
34
|
+
});
|
|
37
35
|
convert.Extension = Extension;
|
|
38
36
|
return convert;
|
|
39
37
|
}
|