piral-cycle 1.0.0-pre.2108 → 1.0.0
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/LICENSE +1 -1
- package/README.md +11 -11
- package/convert.d.ts +16 -7
- package/convert.js +16 -11
- package/esm/converter.d.ts +13 -3
- package/esm/converter.js +29 -27
- package/esm/converter.js.map +1 -1
- package/esm/create.d.ts +2 -6
- package/esm/create.js +4 -6
- package/esm/create.js.map +1 -1
- package/esm/extension.d.ts +2 -2
- package/esm/extension.js +8 -2
- package/esm/extension.js.map +1 -1
- package/esm/types.d.ts +4 -4
- package/lib/converter.d.ts +13 -3
- package/lib/converter.js +29 -27
- package/lib/converter.js.map +1 -1
- package/lib/create.d.ts +2 -6
- package/lib/create.js +4 -6
- package/lib/create.js.map +1 -1
- package/lib/extension.d.ts +2 -2
- package/lib/extension.js +9 -3
- package/lib/extension.js.map +1 -1
- package/lib/types.d.ts +4 -4
- package/package.json +25 -6
- package/src/converter.ts +47 -31
- package/src/create.ts +6 -15
- package/src/extension.ts +11 -3
- package/src/types.ts +4 -4
- package/convert.ts +0 -16
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[](https://piral.io)
|
|
2
2
|
|
|
3
|
-
# [Piral Cycle](https://piral.io) · [](https://github.com/smapiot/piral/blob/
|
|
3
|
+
# [Piral Cycle](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-cycle) [](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 `@cycle/dom` and related packages. What `piral-cycle` 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 Cycle.js converter for any component registration, as well as a `fromCycle` shortcut and a `CycleExtension` component.
|
|
8
8
|
|
|
@@ -37,7 +37,7 @@ export function setup(piral: PiletApi) {
|
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Piral provides two drivers to your Cycle.js component. Here, `TProps` are properties provided by Piral, e.g
|
|
40
|
+
Piral provides two drivers to your Cycle.js component. Here, `TProps` are properties provided by Piral, e.g., `TileComponentProps`.
|
|
41
41
|
|
|
42
42
|
```ts
|
|
43
43
|
export interface PiralDomDrivers<TProps> extends Drivers {
|
|
@@ -62,7 +62,7 @@ Alternatively, if `piral-cycle` has not been added to the Piral instance you can
|
|
|
62
62
|
|
|
63
63
|
```ts
|
|
64
64
|
import { PiletApi } from '<name-of-piral-instance>';
|
|
65
|
-
import { fromCycle } from 'piral-cycle';
|
|
65
|
+
import { fromCycle } from 'piral-cycle/convert';
|
|
66
66
|
import { CyclePage } from './CyclePage';
|
|
67
67
|
|
|
68
68
|
export function setup(piral: PiletApi) {
|
|
@@ -94,12 +94,12 @@ The `@cycle/run`, `@cycle/dom` and `xstream` packages should be shared with the
|
|
|
94
94
|
|
|
95
95
|
```json
|
|
96
96
|
{
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"@cycle/run",
|
|
100
|
-
"@cycle/dom",
|
|
101
|
-
"xstream"
|
|
102
|
-
|
|
97
|
+
"importmap": {
|
|
98
|
+
"imports": {
|
|
99
|
+
"@cycle/run": "",
|
|
100
|
+
"@cycle/dom": "",
|
|
101
|
+
"xstream": ""
|
|
102
|
+
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
```
|
package/convert.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
}
|
|
4
10
|
export interface CycleConverter {
|
|
5
|
-
(...params: Parameters<typeof
|
|
11
|
+
(...params: Parameters<ReturnType<typeof createConverter>>): HtmlComponent<any>;
|
|
6
12
|
}
|
|
7
|
-
export declare
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
export declare function createCycleConverter(...params: Parameters<typeof createConverter>): {
|
|
14
|
+
from: CycleConverter;
|
|
15
|
+
Extension: import("./esm/extension").CycleExtension;
|
|
16
|
+
};
|
|
17
|
+
declare const fromCycle: CycleConverter, CycleExtension: import("./esm/extension").CycleExtension;
|
|
18
|
+
export { fromCycle, CycleExtension };
|
package/convert.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { createConverter } from './esm/converter';
|
|
2
|
+
export function createCycleConverter() {
|
|
3
|
+
var params = [];
|
|
4
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5
|
+
params[_i] = arguments[_i];
|
|
6
|
+
}
|
|
7
|
+
var convert = createConverter.apply(void 0, params);
|
|
8
|
+
var Extension = convert.Extension;
|
|
9
|
+
var from = function (main) { return ({
|
|
10
|
+
type: 'html',
|
|
11
|
+
component: convert(main),
|
|
12
|
+
}); };
|
|
13
|
+
return { from: from, Extension: Extension };
|
|
14
|
+
}
|
|
15
|
+
var _a = createCycleConverter(), fromCycle = _a.from, CycleExtension = _a.Extension;
|
|
16
|
+
export { fromCycle, CycleExtension };
|
package/esm/converter.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { BaseComponentProps, ForeignComponent } from 'piral-core';
|
|
1
|
+
import type { BaseComponentProps, ForeignComponent } from 'piral-core';
|
|
2
2
|
import { MatchingMain } from '@cycle/run';
|
|
3
|
-
import { PiralDomDrivers } from './types';
|
|
4
|
-
export
|
|
3
|
+
import type { PiralDomDrivers } from './types';
|
|
4
|
+
export interface CycleConverterOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The tag name of the root element into which a CycleExtension is rendered.
|
|
7
|
+
* @default piral-slot
|
|
8
|
+
*/
|
|
9
|
+
rootName?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createConverter(config?: CycleConverterOptions): {
|
|
12
|
+
<TProps extends BaseComponentProps, M extends MatchingMain<PiralDomDrivers<TProps>, M>>(main: M): ForeignComponent<TProps>;
|
|
13
|
+
Extension: import("./extension").CycleExtension;
|
|
14
|
+
};
|
package/esm/converter.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { makeDOMDriver } from '@cycle/dom';
|
|
2
2
|
import run from '@cycle/run';
|
|
3
3
|
import xs from 'xstream';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
};
|
|
4
|
+
import { createExtension } from './extension';
|
|
5
|
+
export function createConverter(config = {}) {
|
|
6
|
+
const { rootName = 'piral-slot' } = config;
|
|
7
|
+
const Extension = createExtension(rootName);
|
|
8
|
+
const convert = (main) => ({
|
|
9
|
+
mount(el, props, ctx, locals) {
|
|
10
|
+
locals.props$ = xs.create();
|
|
11
|
+
// The Cycle DOM element is not directly rendered into parent, but into a nested container.
|
|
12
|
+
// This is done because Cycle "erases" information on the host element. If parent was used,
|
|
13
|
+
// Piral related properties like data-portal-id could be removed, leading to things not working.
|
|
14
|
+
const host = el.appendChild(document.createElement(rootName));
|
|
15
|
+
const drivers = {
|
|
16
|
+
DOM: makeDOMDriver(host),
|
|
17
|
+
props: () => locals.props$,
|
|
18
|
+
};
|
|
19
|
+
locals.dispose = run(main, drivers);
|
|
20
|
+
locals.props$.shamefullySendNext(props);
|
|
21
|
+
},
|
|
22
|
+
update(el, props, ctx, locals) {
|
|
23
|
+
locals.props$.shamefullySendNext(props);
|
|
24
|
+
},
|
|
25
|
+
unmount(el, locals) {
|
|
26
|
+
locals.props$.shamefullySendComplete();
|
|
27
|
+
locals.dispose();
|
|
28
|
+
locals.props$ = undefined;
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
convert.Extension = Extension;
|
|
32
|
+
return convert;
|
|
31
33
|
}
|
|
32
34
|
//# sourceMappingURL=converter.js.map
|
package/esm/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,GAA2B,MAAM,YAAY,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,GAA2B,MAAM,YAAY,CAAC;AACrD,OAAO,EAAc,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAgB9C,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,CACd,IAAO,EACmB,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAA0B;YAC9C,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,EAAU,CAAC;YAEpC,2FAA2F;YAC3F,2FAA2F;YAC3F,gGAAgG;YAChG,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;YAE9D,MAAM,OAAO,GAA4B;gBACvC,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC;gBACxB,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM;aAC3B,CAAC;YAEF,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,IAAY,EAAE,OAAO,CAAC,CAAC;YAC5C,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAA0B;YAC/C,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,CAAC,EAAE,EAAE,MAA0B;YACpC,MAAM,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;YACvC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC;QAC5B,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/esm/create.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import type { PiralPlugin } from 'piral-core';
|
|
2
|
+
import { CycleConverterOptions } from './converter';
|
|
2
3
|
import type { PiletCycleApi } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Available configuration options for the Cycle.js plugin.
|
|
5
6
|
*/
|
|
6
|
-
export interface CycleConfig {
|
|
7
|
-
/**
|
|
8
|
-
* The tag name of the root element into which a CycleExtension is rendered.
|
|
9
|
-
* @default slot
|
|
10
|
-
*/
|
|
11
|
-
rootName?: string;
|
|
7
|
+
export interface CycleConfig extends CycleConverterOptions {
|
|
12
8
|
}
|
|
13
9
|
/**
|
|
14
10
|
* Creates new Pilet API extensions for integration of Cycle.
|
package/esm/create.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { createExtension } from './extension';
|
|
2
1
|
import { createConverter } from './converter';
|
|
3
2
|
/**
|
|
4
3
|
* Creates new Pilet API extensions for integration of Cycle.
|
|
5
4
|
*/
|
|
6
5
|
export function createCycleApi(config = {}) {
|
|
7
|
-
const { rootName } = config;
|
|
8
6
|
return (context) => {
|
|
9
|
-
const convert = createConverter();
|
|
7
|
+
const convert = createConverter(config);
|
|
10
8
|
context.converters.cycle = ({ root }) => convert(root);
|
|
11
|
-
return
|
|
9
|
+
return {
|
|
12
10
|
fromCycle(root) {
|
|
13
11
|
return {
|
|
14
12
|
type: 'cycle',
|
|
15
13
|
root,
|
|
16
14
|
};
|
|
17
15
|
},
|
|
18
|
-
CycleExtension:
|
|
19
|
-
}
|
|
16
|
+
CycleExtension: convert.Extension,
|
|
17
|
+
};
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
//# sourceMappingURL=create.js.map
|
package/esm/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,
|
|
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VNode } from '@cycle/dom';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExtensionSlotProps } from 'piral-core';
|
|
3
3
|
export interface CycleExtension {
|
|
4
4
|
(props: ExtensionSlotProps<unknown>): VNode;
|
|
5
5
|
}
|
|
6
|
-
export declare function createExtension(
|
|
6
|
+
export declare function createExtension(rootName: string): CycleExtension;
|
package/esm/extension.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { h } from '@cycle/dom';
|
|
2
|
-
export function createExtension(
|
|
2
|
+
export function createExtension(rootName) {
|
|
3
3
|
return (props) => h(rootName, {
|
|
4
4
|
hook: {
|
|
5
5
|
insert: (vnode) => {
|
|
6
6
|
if (vnode.elm instanceof HTMLElement) {
|
|
7
|
-
|
|
7
|
+
vnode.elm.dispatchEvent(new CustomEvent('render-html', {
|
|
8
|
+
bubbles: true,
|
|
9
|
+
detail: {
|
|
10
|
+
target: vnode.elm,
|
|
11
|
+
props,
|
|
12
|
+
},
|
|
13
|
+
}));
|
|
8
14
|
}
|
|
9
15
|
},
|
|
10
16
|
},
|
package/esm/extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAS,MAAM,YAAY,CAAC;AAOtC,MAAM,UAAU,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAS,MAAM,YAAY,CAAC;AAOtC,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,CAAC,KAAK,EAAE,EAAE,CACf,CAAC,CAAC,QAAQ,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,IAAI,KAAK,CAAC,GAAG,YAAY,WAAW,EAAE;oBACpC,KAAK,CAAC,GAAG,CAAC,aAAa,CACrB,IAAI,WAAW,CAAC,aAAa,EAAE;wBAC7B,OAAO,EAAE,IAAI;wBACb,MAAM,EAAE;4BACN,MAAM,EAAE,KAAK,CAAC,GAAG;4BACjB,KAAK;yBACN;qBACF,CAAC,CACH,CAAC;iBACH;YACH,CAAC;SACF;KACF,CAAC,CAAC;AACP,CAAC"}
|
package/esm/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Stream } from 'xstream';
|
|
2
|
-
import { Driver, Drivers, MatchingMain, Main } from '@cycle/run';
|
|
3
|
-
import { MainDOMSource, VNode } from '@cycle/dom';
|
|
4
|
-
import { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
1
|
+
import type { Stream } from 'xstream';
|
|
2
|
+
import type { Driver, Drivers, MatchingMain, Main } from '@cycle/run';
|
|
3
|
+
import type { MainDOMSource, VNode } from '@cycle/dom';
|
|
4
|
+
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
5
5
|
declare module 'piral-core/lib/types/custom' {
|
|
6
6
|
interface PiletCustomApi extends PiletCycleApi {
|
|
7
7
|
}
|
package/lib/converter.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { BaseComponentProps, ForeignComponent } from 'piral-core';
|
|
1
|
+
import type { BaseComponentProps, ForeignComponent } from 'piral-core';
|
|
2
2
|
import { MatchingMain } from '@cycle/run';
|
|
3
|
-
import { PiralDomDrivers } from './types';
|
|
4
|
-
export
|
|
3
|
+
import type { PiralDomDrivers } from './types';
|
|
4
|
+
export interface CycleConverterOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The tag name of the root element into which a CycleExtension is rendered.
|
|
7
|
+
* @default piral-slot
|
|
8
|
+
*/
|
|
9
|
+
rootName?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createConverter(config?: CycleConverterOptions): {
|
|
12
|
+
<TProps extends BaseComponentProps, M extends MatchingMain<PiralDomDrivers<TProps>, M>>(main: M): ForeignComponent<TProps>;
|
|
13
|
+
Extension: import("./extension").CycleExtension;
|
|
14
|
+
};
|
package/lib/converter.js
CHANGED
|
@@ -4,33 +4,35 @@ exports.createConverter = void 0;
|
|
|
4
4
|
const dom_1 = require("@cycle/dom");
|
|
5
5
|
const run_1 = require("@cycle/run");
|
|
6
6
|
const xstream_1 = require("xstream");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
};
|
|
7
|
+
const extension_1 = require("./extension");
|
|
8
|
+
function createConverter(config = {}) {
|
|
9
|
+
const { rootName = 'piral-slot' } = config;
|
|
10
|
+
const Extension = (0, extension_1.createExtension)(rootName);
|
|
11
|
+
const convert = (main) => ({
|
|
12
|
+
mount(el, props, ctx, locals) {
|
|
13
|
+
locals.props$ = xstream_1.default.create();
|
|
14
|
+
// The Cycle DOM element is not directly rendered into parent, but into a nested container.
|
|
15
|
+
// This is done because Cycle "erases" information on the host element. If parent was used,
|
|
16
|
+
// Piral related properties like data-portal-id could be removed, leading to things not working.
|
|
17
|
+
const host = el.appendChild(document.createElement(rootName));
|
|
18
|
+
const drivers = {
|
|
19
|
+
DOM: (0, dom_1.makeDOMDriver)(host),
|
|
20
|
+
props: () => locals.props$,
|
|
21
|
+
};
|
|
22
|
+
locals.dispose = (0, run_1.default)(main, drivers);
|
|
23
|
+
locals.props$.shamefullySendNext(props);
|
|
24
|
+
},
|
|
25
|
+
update(el, props, ctx, locals) {
|
|
26
|
+
locals.props$.shamefullySendNext(props);
|
|
27
|
+
},
|
|
28
|
+
unmount(el, locals) {
|
|
29
|
+
locals.props$.shamefullySendComplete();
|
|
30
|
+
locals.dispose();
|
|
31
|
+
locals.props$ = undefined;
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
convert.Extension = Extension;
|
|
35
|
+
return convert;
|
|
34
36
|
}
|
|
35
37
|
exports.createConverter = createConverter;
|
|
36
38
|
//# 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":";;;AACA,oCAA2C;AAC3C,oCAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AACA,oCAA2C;AAC3C,oCAAqD;AACrD,qCAAqC;AACrC,2CAA8C;AAgB9C,SAAgB,eAAe,CAAC,SAAgC,EAAE;IAChE,MAAM,EAAE,QAAQ,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,CACd,IAAO,EACmB,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAA0B;YAC9C,MAAM,CAAC,MAAM,GAAG,iBAAE,CAAC,MAAM,EAAU,CAAC;YAEpC,2FAA2F;YAC3F,2FAA2F;YAC3F,gGAAgG;YAChG,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;YAE9D,MAAM,OAAO,GAA4B;gBACvC,GAAG,EAAE,IAAA,mBAAa,EAAC,IAAI,CAAC;gBACxB,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM;aAC3B,CAAC;YAEF,MAAM,CAAC,OAAO,GAAG,IAAA,aAAG,EAAC,IAAY,EAAE,OAAO,CAAC,CAAC;YAC5C,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAA0B;YAC/C,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,CAAC,EAAE,EAAE,MAA0B;YACpC,MAAM,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;YACvC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC;QAC5B,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAlCD,0CAkCC"}
|
package/lib/create.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import type { PiralPlugin } from 'piral-core';
|
|
2
|
+
import { CycleConverterOptions } from './converter';
|
|
2
3
|
import type { PiletCycleApi } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Available configuration options for the Cycle.js plugin.
|
|
5
6
|
*/
|
|
6
|
-
export interface CycleConfig {
|
|
7
|
-
/**
|
|
8
|
-
* The tag name of the root element into which a CycleExtension is rendered.
|
|
9
|
-
* @default slot
|
|
10
|
-
*/
|
|
11
|
-
rootName?: string;
|
|
7
|
+
export interface CycleConfig extends CycleConverterOptions {
|
|
12
8
|
}
|
|
13
9
|
/**
|
|
14
10
|
* Creates new Pilet API extensions for integration of Cycle.
|
package/lib/create.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCycleApi = void 0;
|
|
4
|
-
const extension_1 = require("./extension");
|
|
5
4
|
const converter_1 = require("./converter");
|
|
6
5
|
/**
|
|
7
6
|
* Creates new Pilet API extensions for integration of Cycle.
|
|
8
7
|
*/
|
|
9
8
|
function createCycleApi(config = {}) {
|
|
10
|
-
const { rootName } = config;
|
|
11
9
|
return (context) => {
|
|
12
|
-
const convert = converter_1.createConverter();
|
|
10
|
+
const convert = (0, converter_1.createConverter)(config);
|
|
13
11
|
context.converters.cycle = ({ root }) => convert(root);
|
|
14
|
-
return
|
|
12
|
+
return {
|
|
15
13
|
fromCycle(root) {
|
|
16
14
|
return {
|
|
17
15
|
type: 'cycle',
|
|
18
16
|
root,
|
|
19
17
|
};
|
|
20
18
|
},
|
|
21
|
-
CycleExtension:
|
|
22
|
-
}
|
|
19
|
+
CycleExtension: convert.Extension,
|
|
20
|
+
};
|
|
23
21
|
};
|
|
24
22
|
}
|
|
25
23
|
exports.createCycleApi = createCycleApi;
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AACA,2CAAqE;AAQrE;;GAEG;AACH,SAAgB,cAAc,CAAC,SAAsB,EAAE;IACrD,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,IAAA,2BAAe,EAAC,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;AAfD,wCAeC"}
|
package/lib/extension.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VNode } from '@cycle/dom';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExtensionSlotProps } from 'piral-core';
|
|
3
3
|
export interface CycleExtension {
|
|
4
4
|
(props: ExtensionSlotProps<unknown>): VNode;
|
|
5
5
|
}
|
|
6
|
-
export declare function createExtension(
|
|
6
|
+
export declare function createExtension(rootName: string): CycleExtension;
|
package/lib/extension.js
CHANGED
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createExtension = void 0;
|
|
4
4
|
const dom_1 = require("@cycle/dom");
|
|
5
|
-
function createExtension(
|
|
6
|
-
return (props) => dom_1.h(rootName, {
|
|
5
|
+
function createExtension(rootName) {
|
|
6
|
+
return (props) => (0, dom_1.h)(rootName, {
|
|
7
7
|
hook: {
|
|
8
8
|
insert: (vnode) => {
|
|
9
9
|
if (vnode.elm instanceof HTMLElement) {
|
|
10
|
-
|
|
10
|
+
vnode.elm.dispatchEvent(new CustomEvent('render-html', {
|
|
11
|
+
bubbles: true,
|
|
12
|
+
detail: {
|
|
13
|
+
target: vnode.elm,
|
|
14
|
+
props,
|
|
15
|
+
},
|
|
16
|
+
}));
|
|
11
17
|
}
|
|
12
18
|
},
|
|
13
19
|
},
|
package/lib/extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;;AAAA,oCAAsC;AAOtC,SAAgB,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;;AAAA,oCAAsC;AAOtC,SAAgB,eAAe,CAAC,QAAgB;IAC9C,OAAO,CAAC,KAAK,EAAE,EAAE,CACf,IAAA,OAAC,EAAC,QAAQ,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,IAAI,KAAK,CAAC,GAAG,YAAY,WAAW,EAAE;oBACpC,KAAK,CAAC,GAAG,CAAC,aAAa,CACrB,IAAI,WAAW,CAAC,aAAa,EAAE;wBAC7B,OAAO,EAAE,IAAI;wBACb,MAAM,EAAE;4BACN,MAAM,EAAE,KAAK,CAAC,GAAG;4BACjB,KAAK;yBACN;qBACF,CAAC,CACH,CAAC;iBACH;YACH,CAAC;SACF;KACF,CAAC,CAAC;AACP,CAAC;AAnBD,0CAmBC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Stream } from 'xstream';
|
|
2
|
-
import { Driver, Drivers, MatchingMain, Main } from '@cycle/run';
|
|
3
|
-
import { MainDOMSource, VNode } from '@cycle/dom';
|
|
4
|
-
import { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
1
|
+
import type { Stream } from 'xstream';
|
|
2
|
+
import type { Driver, Drivers, MatchingMain, Main } from '@cycle/run';
|
|
3
|
+
import type { MainDOMSource, VNode } from '@cycle/dom';
|
|
4
|
+
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
5
5
|
declare module 'piral-core/lib/types/custom' {
|
|
6
6
|
interface PiletCustomApi extends PiletCycleApi {
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cycle",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Plugin for integrating Cycle.js components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -19,13 +19,32 @@
|
|
|
19
19
|
"module": "esm/index.js",
|
|
20
20
|
"main": "lib/index.js",
|
|
21
21
|
"typings": "lib/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./esm/index.js",
|
|
25
|
+
"require": "./lib/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./convert": {
|
|
28
|
+
"import": "./convert.js"
|
|
29
|
+
},
|
|
30
|
+
"./esm/*": {
|
|
31
|
+
"import": "./esm/*"
|
|
32
|
+
},
|
|
33
|
+
"./lib/*": {
|
|
34
|
+
"require": "./lib/*"
|
|
35
|
+
},
|
|
36
|
+
"./_/*": {
|
|
37
|
+
"import": "./esm/*.js",
|
|
38
|
+
"require": "./lib/*.js"
|
|
39
|
+
},
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
22
42
|
"sideEffects": false,
|
|
23
43
|
"files": [
|
|
24
44
|
"esm",
|
|
25
45
|
"lib",
|
|
26
46
|
"src",
|
|
27
47
|
"convert.d.ts",
|
|
28
|
-
"convert.ts",
|
|
29
48
|
"convert.js"
|
|
30
49
|
],
|
|
31
50
|
"repository": {
|
|
@@ -36,8 +55,9 @@
|
|
|
36
55
|
"url": "https://github.com/smapiot/piral/issues"
|
|
37
56
|
},
|
|
38
57
|
"scripts": {
|
|
58
|
+
"cleanup": "rimraf esm lib convert.d.ts convert.js",
|
|
39
59
|
"build": "yarn build:commonjs && yarn build:esnext && yarn build:convert",
|
|
40
|
-
"build:convert": "tsc convert.ts --skipLibCheck --declaration",
|
|
60
|
+
"build:convert": "tsc convert.ts --skipLibCheck --declaration --module esnext",
|
|
41
61
|
"build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
|
|
42
62
|
"build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
|
|
43
63
|
"typedoc": "typedoc --json ../../../docs/types/piral-cycle.json src --exclude \"src/**/*.test.*\"",
|
|
@@ -46,14 +66,13 @@
|
|
|
46
66
|
"devDependencies": {
|
|
47
67
|
"@cycle/dom": "^22.7.0",
|
|
48
68
|
"@cycle/run": "^5.4.0",
|
|
49
|
-
"piral-core": "^1.0.0
|
|
69
|
+
"piral-core": "^1.0.0",
|
|
50
70
|
"xstream": "^11.12.0"
|
|
51
71
|
},
|
|
52
72
|
"peerDependencies": {
|
|
53
73
|
"@cycle/dom": "^22.0.0",
|
|
54
74
|
"@cycle/run": "^5.0.0",
|
|
55
|
-
"piral-core": "1.x",
|
|
56
75
|
"xstream": "^11.0.0"
|
|
57
76
|
},
|
|
58
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "67d9a2920bd5231baf10bc87ae8985666b18fa3a"
|
|
59
78
|
}
|
package/src/converter.ts
CHANGED
|
@@ -1,39 +1,55 @@
|
|
|
1
|
-
import { BaseComponentProps, ForeignComponent } from 'piral-core';
|
|
1
|
+
import type { BaseComponentProps, ForeignComponent } from 'piral-core';
|
|
2
2
|
import { makeDOMDriver } from '@cycle/dom';
|
|
3
3
|
import run, { MatchingMain, Main } from '@cycle/run';
|
|
4
|
-
import xs from 'xstream';
|
|
5
|
-
import {
|
|
4
|
+
import xs, { Stream } from 'xstream';
|
|
5
|
+
import { createExtension } from './extension';
|
|
6
|
+
import type { PiralDomDrivers } from './types';
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
|
|
8
|
+
export interface CycleConverterOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The tag name of the root element into which a CycleExtension is rendered.
|
|
11
|
+
* @default piral-slot
|
|
12
|
+
*/
|
|
13
|
+
rootName?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface CycleState<TProps> {
|
|
17
|
+
props$: Stream<TProps>;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function createConverter(config: CycleConverterOptions = {}) {
|
|
22
|
+
const { rootName = 'piral-slot' } = config;
|
|
23
|
+
const Extension = createExtension(rootName);
|
|
24
|
+
const convert = <TProps extends BaseComponentProps, M extends MatchingMain<PiralDomDrivers<TProps>, M>>(
|
|
9
25
|
main: M,
|
|
10
|
-
): ForeignComponent<TProps> => {
|
|
11
|
-
|
|
12
|
-
|
|
26
|
+
): ForeignComponent<TProps> => ({
|
|
27
|
+
mount(el, props, ctx, locals: CycleState<TProps>) {
|
|
28
|
+
locals.props$ = xs.create<TProps>();
|
|
29
|
+
|
|
30
|
+
// The Cycle DOM element is not directly rendered into parent, but into a nested container.
|
|
31
|
+
// This is done because Cycle "erases" information on the host element. If parent was used,
|
|
32
|
+
// Piral related properties like data-portal-id could be removed, leading to things not working.
|
|
33
|
+
const host = el.appendChild(document.createElement(rootName));
|
|
13
34
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Piral related properties like data-portal-id could be removed, leading to things not working.
|
|
19
|
-
const host = document.createElement('slot');
|
|
20
|
-
parent.appendChild(host);
|
|
35
|
+
const drivers: PiralDomDrivers<TProps> = {
|
|
36
|
+
DOM: makeDOMDriver(host),
|
|
37
|
+
props: () => locals.props$,
|
|
38
|
+
};
|
|
21
39
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
locals.dispose = run(main as Main, drivers);
|
|
41
|
+
locals.props$.shamefullySendNext(props);
|
|
42
|
+
},
|
|
43
|
+
update(el, props, ctx, locals: CycleState<TProps>) {
|
|
44
|
+
locals.props$.shamefullySendNext(props);
|
|
45
|
+
},
|
|
46
|
+
unmount(el, locals: CycleState<TProps>) {
|
|
47
|
+
locals.props$.shamefullySendComplete();
|
|
48
|
+
locals.dispose();
|
|
49
|
+
locals.props$ = undefined;
|
|
50
|
+
},
|
|
51
|
+
});
|
|
26
52
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
update(_, props) {
|
|
31
|
-
props$.shamefullySendNext(props);
|
|
32
|
-
},
|
|
33
|
-
unmount() {
|
|
34
|
-
props$.shamefullySendComplete();
|
|
35
|
-
dispose();
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
};
|
|
53
|
+
convert.Extension = Extension;
|
|
54
|
+
return convert;
|
|
39
55
|
}
|
package/src/create.ts
CHANGED
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
import type { PiralPlugin } from 'piral-core';
|
|
2
|
-
import {
|
|
3
|
-
import { createConverter } from './converter';
|
|
2
|
+
import { createConverter, CycleConverterOptions } from './converter';
|
|
4
3
|
import type { PiletCycleApi } from './types';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Available configuration options for the Cycle.js plugin.
|
|
8
7
|
*/
|
|
9
|
-
export interface CycleConfig {
|
|
10
|
-
/**
|
|
11
|
-
* The tag name of the root element into which a CycleExtension is rendered.
|
|
12
|
-
* @default slot
|
|
13
|
-
*/
|
|
14
|
-
rootName?: string;
|
|
15
|
-
}
|
|
8
|
+
export interface CycleConfig extends CycleConverterOptions {}
|
|
16
9
|
|
|
17
10
|
/**
|
|
18
11
|
* Creates new Pilet API extensions for integration of Cycle.
|
|
19
12
|
*/
|
|
20
13
|
export function createCycleApi(config: CycleConfig = {}): PiralPlugin<PiletCycleApi> {
|
|
21
|
-
const { rootName } = config;
|
|
22
|
-
|
|
23
14
|
return (context) => {
|
|
24
|
-
const convert = createConverter();
|
|
15
|
+
const convert = createConverter(config);
|
|
25
16
|
context.converters.cycle = ({ root }) => convert(root);
|
|
26
17
|
|
|
27
|
-
return
|
|
18
|
+
return {
|
|
28
19
|
fromCycle(root) {
|
|
29
20
|
return {
|
|
30
21
|
type: 'cycle',
|
|
31
22
|
root,
|
|
32
23
|
};
|
|
33
24
|
},
|
|
34
|
-
CycleExtension:
|
|
35
|
-
}
|
|
25
|
+
CycleExtension: convert.Extension,
|
|
26
|
+
};
|
|
36
27
|
};
|
|
37
28
|
}
|
package/src/extension.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { h, VNode } from '@cycle/dom';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExtensionSlotProps } from 'piral-core';
|
|
3
3
|
|
|
4
4
|
export interface CycleExtension {
|
|
5
5
|
(props: ExtensionSlotProps<unknown>): VNode;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export function createExtension(
|
|
8
|
+
export function createExtension(rootName: string): CycleExtension {
|
|
9
9
|
return (props) =>
|
|
10
10
|
h(rootName, {
|
|
11
11
|
hook: {
|
|
12
12
|
insert: (vnode) => {
|
|
13
13
|
if (vnode.elm instanceof HTMLElement) {
|
|
14
|
-
|
|
14
|
+
vnode.elm.dispatchEvent(
|
|
15
|
+
new CustomEvent('render-html', {
|
|
16
|
+
bubbles: true,
|
|
17
|
+
detail: {
|
|
18
|
+
target: vnode.elm,
|
|
19
|
+
props,
|
|
20
|
+
},
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
15
23
|
}
|
|
16
24
|
},
|
|
17
25
|
},
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Stream } from 'xstream';
|
|
2
|
-
import { Driver, Drivers, MatchingMain, Main } from '@cycle/run';
|
|
3
|
-
import { MainDOMSource, VNode } from '@cycle/dom';
|
|
4
|
-
import { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
1
|
+
import type { Stream } from 'xstream';
|
|
2
|
+
import type { Driver, Drivers, MatchingMain, Main } from '@cycle/run';
|
|
3
|
+
import type { MainDOMSource, VNode } from '@cycle/dom';
|
|
4
|
+
import type { ForeignComponent, ExtensionSlotProps } from 'piral-core';
|
|
5
5
|
|
|
6
6
|
declare module 'piral-core/lib/types/custom' {
|
|
7
7
|
interface PiletCustomApi extends PiletCycleApi {}
|
package/convert.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { HtmlComponent } from 'piral-core';
|
|
2
|
-
import { createConverter } from './lib/converter';
|
|
3
|
-
import { createExtension } from './lib/extension';
|
|
4
|
-
|
|
5
|
-
const convert = createConverter();
|
|
6
|
-
|
|
7
|
-
export interface CycleConverter {
|
|
8
|
-
(...params: Parameters<typeof convert>): HtmlComponent<any>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const fromCycle: CycleConverter = (main) => ({
|
|
12
|
-
type: 'html',
|
|
13
|
-
component: convert(main),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const createCycleExtension = createExtension;
|