piral-mithril 0.15.0-alpha.3809 → 0.15.0-alpha.3933
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/esm/converter.js +16 -18
- package/esm/converter.js.map +1 -1
- package/esm/types.d.ts +1 -1
- package/lib/converter.js +16 -18
- package/lib/converter.js.map +1 -1
- package/lib/types.d.ts +1 -1
- package/package.json +4 -5
- package/src/converter.ts +26 -28
- package/src/types.ts +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# [Piral Mithril](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-mithril) [](https://jestjs.io) [](https://gitter.im/piral-io/community)
|
|
4
4
|
|
|
5
|
-
This is a plugin that only has a peer dependency to `
|
|
5
|
+
This is a plugin that only has a peer dependency to `mithril`. What `piral-mithril` 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 a Mithril.js converter for any component registration, as well as a `fromMithril` shortcut and a `MithrilExtension` component.
|
|
8
8
|
|
package/esm/converter.js
CHANGED
|
@@ -3,24 +3,22 @@ import { createExtension } from './extension';
|
|
|
3
3
|
export function createConverter(config = {}) {
|
|
4
4
|
const { rootName = 'slot' } = config;
|
|
5
5
|
const Extension = createExtension(rootName);
|
|
6
|
-
const convert = (component, captured) => {
|
|
7
|
-
|
|
8
|
-
mount(el,
|
|
9
|
-
mithril.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
mithril.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
};
|
|
6
|
+
const convert = (component, captured) => ({
|
|
7
|
+
mount(el, props, ctx) {
|
|
8
|
+
mithril.mount(el, {
|
|
9
|
+
view: () => mithril.m(component, Object.assign(Object.assign(Object.assign({}, captured), ctx), props)),
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
update(el, props, ctx) {
|
|
13
|
+
mithril.mount(el, {
|
|
14
|
+
view: () => mithril.m(component, Object.assign(Object.assign(Object.assign({}, captured), ctx), props)),
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
unmount(el) {
|
|
18
|
+
// tslint:disable-next-line:no-null-keyword
|
|
19
|
+
mithril.mount(el, null);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
24
22
|
convert.Extension = Extension;
|
|
25
23
|
return convert;
|
|
26
24
|
}
|
package/esm/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAW9C,MAAM,UAAU,eAAe,CAAC,SAAkC,EAAE;IAClE,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,SAA4B,EAC5B,QAA8B,EACJ,EAAE
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAW9C,MAAM,UAAU,eAAe,CAAC,SAAkC,EAAE;IAClE,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,SAA4B,EAC5B,QAA8B,EACJ,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YAClB,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE;gBAChB,IAAI,EAAE,GAAG,EAAE,CACT,OAAO,CAAC,CAAC,CAAC,SAAS,gDACd,QAAQ,GACR,GAAG,GACH,KAAK,EACR;aACL,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YACnB,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE;gBAChB,IAAI,EAAE,GAAG,EAAE,CACT,OAAO,CAAC,CAAC,CAAC,SAAS,gDACd,QAAQ,GACR,GAAG,GACH,KAAK,EACR;aACL,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,EAAE;YACR,2CAA2C;YAC3C,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAC1B,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/esm/types.d.ts
CHANGED
package/lib/converter.js
CHANGED
|
@@ -6,24 +6,22 @@ const extension_1 = require("./extension");
|
|
|
6
6
|
function createConverter(config = {}) {
|
|
7
7
|
const { rootName = 'slot' } = config;
|
|
8
8
|
const Extension = (0, extension_1.createExtension)(rootName);
|
|
9
|
-
const convert = (component, captured) => {
|
|
10
|
-
|
|
11
|
-
mount(el,
|
|
12
|
-
mithril.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
mithril.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
};
|
|
9
|
+
const convert = (component, captured) => ({
|
|
10
|
+
mount(el, props, ctx) {
|
|
11
|
+
mithril.mount(el, {
|
|
12
|
+
view: () => mithril.m(component, Object.assign(Object.assign(Object.assign({}, captured), ctx), props)),
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
update(el, props, ctx) {
|
|
16
|
+
mithril.mount(el, {
|
|
17
|
+
view: () => mithril.m(component, Object.assign(Object.assign(Object.assign({}, captured), ctx), props)),
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
unmount(el) {
|
|
21
|
+
// tslint:disable-next-line:no-null-keyword
|
|
22
|
+
mithril.mount(el, null);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
27
25
|
convert.Extension = Extension;
|
|
28
26
|
return convert;
|
|
29
27
|
}
|
package/lib/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAEnC,2CAA8C;AAW9C,SAAgB,eAAe,CAAC,SAAkC,EAAE;IAClE,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,SAA4B,EAC5B,QAA8B,EACJ,EAAE
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAEnC,2CAA8C;AAW9C,SAAgB,eAAe,CAAC,SAAkC,EAAE;IAClE,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,SAA4B,EAC5B,QAA8B,EACJ,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YAClB,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE;gBAChB,IAAI,EAAE,GAAG,EAAE,CACT,OAAO,CAAC,CAAC,CAAC,SAAS,gDACd,QAAQ,GACR,GAAG,GACH,KAAK,EACR;aACL,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YACnB,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE;gBAChB,IAAI,EAAE,GAAG,EAAE,CACT,OAAO,CAAC,CAAC,CAAC,SAAS,gDACd,QAAQ,GACR,GAAG,GACH,KAAK,EACR;aACL,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,EAAE;YACR,2CAA2C;YAC3C,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAC1B,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAlCD,0CAkCC"}
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-mithril",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.3933",
|
|
4
4
|
"description": "Plugin for integrating Mithril.js components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -45,11 +45,10 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"mithril": "2.0.4",
|
|
48
|
-
"piral-core": "0.15.0-alpha.
|
|
48
|
+
"piral-core": "0.15.0-alpha.3933"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"mithril": "^2.0.0"
|
|
52
|
-
"piral-core": "0.14.x"
|
|
51
|
+
"mithril": "^2.0.0"
|
|
53
52
|
},
|
|
54
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "520a272d09f02543153f1d8b2ae23a3ae10acd6f"
|
|
55
54
|
}
|
package/src/converter.ts
CHANGED
|
@@ -17,34 +17,32 @@ export function createConverter(config: MithrilConverterOptions = {}) {
|
|
|
17
17
|
const convert = <TProps extends BaseComponentProps>(
|
|
18
18
|
component: Component<TProps>,
|
|
19
19
|
captured?: Record<string, any>,
|
|
20
|
-
): ForeignComponent<TProps> => {
|
|
21
|
-
|
|
22
|
-
mount(el,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
};
|
|
20
|
+
): ForeignComponent<TProps> => ({
|
|
21
|
+
mount(el, props, ctx) {
|
|
22
|
+
mithril.mount(el, {
|
|
23
|
+
view: () =>
|
|
24
|
+
mithril.m(component, {
|
|
25
|
+
...captured,
|
|
26
|
+
...ctx,
|
|
27
|
+
...props,
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
update(el, props, ctx) {
|
|
32
|
+
mithril.mount(el, {
|
|
33
|
+
view: () =>
|
|
34
|
+
mithril.m(component, {
|
|
35
|
+
...captured,
|
|
36
|
+
...ctx,
|
|
37
|
+
...props,
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
unmount(el) {
|
|
42
|
+
// tslint:disable-next-line:no-null-keyword
|
|
43
|
+
mithril.mount(el, null);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
48
46
|
convert.Extension = Extension;
|
|
49
47
|
return convert;
|
|
50
48
|
}
|
package/src/types.ts
CHANGED