piral-preact 0.15.0-alpha.3816 → 0.15.0-alpha.3905
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 +11 -13
- package/esm/converter.js.map +1 -1
- package/esm/mount.d.ts +1 -1
- package/esm/types.d.ts +2 -2
- package/lib/converter.js +11 -13
- package/lib/converter.js.map +1 -1
- package/lib/mount.d.ts +1 -1
- package/lib/types.d.ts +2 -2
- package/package.json +3 -4
- package/src/converter.ts +11 -13
- package/src/mount.ts +1 -1
- package/src/types.ts +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# [Piral Preact](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-preact) [](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 `preact`. What `piral-preact` 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 Preact converter for any component registration, as well as a `fromPreact` shortcut and a `PreactExtension` component.
|
|
8
8
|
|
package/esm/converter.js
CHANGED
|
@@ -3,19 +3,17 @@ 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 = (root) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
};
|
|
6
|
+
const convert = (root) => ({
|
|
7
|
+
mount(el, props, ctx) {
|
|
8
|
+
mountPreact(el, root, props, ctx);
|
|
9
|
+
},
|
|
10
|
+
update(el, props, ctx) {
|
|
11
|
+
mountPreact(el, root, props, ctx);
|
|
12
|
+
},
|
|
13
|
+
unmount(el) {
|
|
14
|
+
unmountPreact(el);
|
|
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":"AAEA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAU9C,MAAM,UAAU,eAAe,CAAC,SAAiC,EAAE;IACjE,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CAAoC,IAA2B,EAA4B,EAAE
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAU9C,MAAM,UAAU,eAAe,CAAC,SAAiC,EAAE;IACjE,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,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,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YACnB,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,CAAC,EAAE;YACR,aAAa,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/esm/mount.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'preact';
|
|
2
|
-
import { BaseComponentProps } from 'piral-core';
|
|
2
|
+
import type { BaseComponentProps } from 'piral-core';
|
|
3
3
|
export declare const anyPropType: () => any;
|
|
4
4
|
export declare function mountPreact<T extends BaseComponentProps>(el: HTMLElement, root: ComponentType<T>, props: T, ctx?: any): void;
|
|
5
5
|
export declare function unmountPreact(el: HTMLElement): void;
|
package/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
2
|
-
import { ComponentType } from 'preact';
|
|
1
|
+
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
2
|
+
import type { ComponentType } from 'preact';
|
|
3
3
|
declare module 'piral-core/lib/types/custom' {
|
|
4
4
|
interface PiletCustomApi extends PiletPreactApi {
|
|
5
5
|
}
|
package/lib/converter.js
CHANGED
|
@@ -6,19 +6,17 @@ 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 = (root) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
};
|
|
9
|
+
const convert = (root) => ({
|
|
10
|
+
mount(el, props, ctx) {
|
|
11
|
+
(0, mount_1.mountPreact)(el, root, props, ctx);
|
|
12
|
+
},
|
|
13
|
+
update(el, props, ctx) {
|
|
14
|
+
(0, mount_1.mountPreact)(el, root, props, ctx);
|
|
15
|
+
},
|
|
16
|
+
unmount(el) {
|
|
17
|
+
(0, mount_1.unmountPreact)(el);
|
|
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":";;;AAEA,mCAAqD;AACrD,2CAA8C;AAU9C,SAAgB,eAAe,CAAC,SAAiC,EAAE;IACjE,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CAAoC,IAA2B,EAA4B,EAAE
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AAEA,mCAAqD;AACrD,2CAA8C;AAU9C,SAAgB,eAAe,CAAC,SAAiC,EAAE;IACjE,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CAAoC,IAA2B,EAA4B,EAAE,CAAC,CAAC;QAC7G,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YAClB,IAAA,mBAAW,EAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG;YACnB,IAAA,mBAAW,EAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,CAAC,EAAE;YACR,IAAA,qBAAa,EAAC,EAAE,CAAC,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAhBD,0CAgBC"}
|
package/lib/mount.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'preact';
|
|
2
|
-
import { BaseComponentProps } from 'piral-core';
|
|
2
|
+
import type { BaseComponentProps } from 'piral-core';
|
|
3
3
|
export declare const anyPropType: () => any;
|
|
4
4
|
export declare function mountPreact<T extends BaseComponentProps>(el: HTMLElement, root: ComponentType<T>, props: T, ctx?: any): void;
|
|
5
5
|
export declare function unmountPreact(el: HTMLElement): void;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
2
|
-
import { ComponentType } from 'preact';
|
|
1
|
+
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
2
|
+
import type { ComponentType } from 'preact';
|
|
3
3
|
declare module 'piral-core/lib/types/custom' {
|
|
4
4
|
interface PiletCustomApi extends PiletPreactApi {
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-preact",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.3905",
|
|
4
4
|
"description": "Plugin for integrating Preact components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -44,12 +44,11 @@
|
|
|
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.3905",
|
|
48
48
|
"preact": "^10.5.13"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"piral-core": "0.14.x",
|
|
52
51
|
"preact": "^10.0.0"
|
|
53
52
|
},
|
|
54
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "533d09963cfd8c901df797958ca386dbae0286e1"
|
|
55
54
|
}
|
package/src/converter.ts
CHANGED
|
@@ -14,19 +14,17 @@ export interface PreactConverterOptions {
|
|
|
14
14
|
export function createConverter(config: PreactConverterOptions = {}) {
|
|
15
15
|
const { rootName = 'slot' } = config;
|
|
16
16
|
const Extension = createExtension(rootName);
|
|
17
|
-
const convert = <TProps extends BaseComponentProps>(root: ComponentType<TProps>): ForeignComponent<TProps> => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
};
|
|
17
|
+
const convert = <TProps extends BaseComponentProps>(root: ComponentType<TProps>): ForeignComponent<TProps> => ({
|
|
18
|
+
mount(el, props, ctx) {
|
|
19
|
+
mountPreact(el, root, props, ctx);
|
|
20
|
+
},
|
|
21
|
+
update(el, props, ctx) {
|
|
22
|
+
mountPreact(el, root, props, ctx);
|
|
23
|
+
},
|
|
24
|
+
unmount(el) {
|
|
25
|
+
unmountPreact(el);
|
|
26
|
+
},
|
|
27
|
+
});
|
|
30
28
|
convert.Extension = Extension;
|
|
31
29
|
return convert;
|
|
32
30
|
}
|
package/src/mount.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
2
|
-
import { ComponentType } from 'preact';
|
|
1
|
+
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
2
|
+
import type { ComponentType } from 'preact';
|
|
3
3
|
|
|
4
4
|
declare module 'piral-core/lib/types/custom' {
|
|
5
5
|
interface PiletCustomApi extends PiletPreactApi {}
|