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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019 - 2021 smapiot
3
+ Copyright (c) 2019 - 2023 smapiot
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- [![Piral Logo](https://github.com/smapiot/piral/raw/master/docs/assets/logo.png)](https://piral.io)
1
+ [![Piral Logo](https://github.com/smapiot/piral/raw/main/docs/assets/logo.png)](https://piral.io)
2
2
 
3
- # [Piral Cycle](https://piral.io) · [![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smapiot/piral/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/piral-cycle.svg?style=flat)](https://www.npmjs.com/package/piral-cycle) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://jestjs.io) [![Gitter Chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/piral-io/community)
3
+ # [Piral Cycle](https://piral.io) · [![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smapiot/piral/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/piral-cycle.svg?style=flat)](https://www.npmjs.com/package/piral-cycle) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://jestjs.io) [![Gitter Chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/piral-io/community)
4
4
 
5
- This is a plugin that only has a peer dependency to `piral-core`. What `piral-cycle` brings to the table is a set of Pilet API extensions that can be used with `piral` or `piral-core`.
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. `TileComponentProps`.
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
- "pilets": {
98
- "externals": [
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 type { HtmlComponent } from 'piral-core';
2
- import { createExtension } from './lib/extension';
3
- declare const convert: <TProps extends import("piral-core").BaseComponentProps, M extends import("@cycle/run").MatchingMain<import("./lib/types").PiralDomDrivers<TProps>, M>>(main: M) => import("piral-core").ForeignComponent<TProps>;
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 convert>): HtmlComponent<any>;
11
+ (...params: Parameters<ReturnType<typeof createConverter>>): HtmlComponent<any>;
6
12
  }
7
- export declare const fromCycle: CycleConverter;
8
- export declare const createCycleExtension: typeof createExtension;
9
- export {};
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
- "use strict";
2
- exports.__esModule = true;
3
- exports.createCycleExtension = exports.fromCycle = void 0;
4
- var converter_1 = require("./lib/converter");
5
- var extension_1 = require("./lib/extension");
6
- var convert = converter_1.createConverter();
7
- exports.fromCycle = function (main) { return ({
8
- type: 'html',
9
- component: convert(main)
10
- }); };
11
- exports.createCycleExtension = extension_1.createExtension;
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 };
@@ -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 declare function createConverter(): <TProps extends BaseComponentProps, M extends MatchingMain<PiralDomDrivers<TProps>, M>>(main: M) => ForeignComponent<TProps>;
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
- export function createConverter() {
5
- return (main) => {
6
- const props$ = xs.create();
7
- let dispose = () => { };
8
- return {
9
- mount(parent, props) {
10
- // The Cycle DOM element is not directly rendered into parent, but into a nested container.
11
- // This is done because Cycle "erases" information on the host element. If parent was used,
12
- // Piral related properties like data-portal-id could be removed, leading to things not working.
13
- const host = document.createElement('slot');
14
- parent.appendChild(host);
15
- const drivers = {
16
- DOM: makeDOMDriver(host),
17
- props: () => props$,
18
- };
19
- dispose = run(main, drivers);
20
- props$.shamefullySendNext(props);
21
- },
22
- update(_, props) {
23
- props$.shamefullySendNext(props);
24
- },
25
- unmount() {
26
- props$.shamefullySendComplete();
27
- dispose();
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
@@ -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,EAAE,MAAM,SAAS,CAAC;AAGzB,MAAM,UAAU,eAAe;IAC7B,OAAO,CACL,IAAO,EACmB,EAAE;QAC5B,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,EAAU,CAAC;QACnC,IAAI,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;QAEvB,OAAO;YACL,KAAK,CAAC,MAAM,EAAE,KAAK;gBACjB,2FAA2F;gBAC3F,2FAA2F;gBAC3F,gGAAgG;gBAChG,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;gBAC5C,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAEzB,MAAM,OAAO,GAA4B;oBACvC,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC;oBACxB,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM;iBACpB,CAAC;gBAEF,OAAO,GAAG,GAAG,CAAC,IAAY,EAAE,OAAO,CAAC,CAAC;gBACrC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YACD,MAAM,CAAC,CAAC,EAAE,KAAK;gBACb,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YACD,OAAO;gBACL,MAAM,CAAC,sBAAsB,EAAE,CAAC;gBAChC,OAAO,EAAE,CAAC;YACZ,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
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 (api) => ({
9
+ return {
12
10
  fromCycle(root) {
13
11
  return {
14
12
  type: 'cycle',
15
13
  root,
16
14
  };
17
15
  },
18
- CycleExtension: createExtension(api, rootName),
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,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAc9C;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,SAAsB,EAAE;IACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE5B,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;QAClC,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEvD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACf,SAAS,CAAC,IAAI;gBACZ,OAAO;oBACL,IAAI,EAAE,OAAO;oBACb,IAAI;iBACL,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,eAAe,CAAC,GAAG,EAAE,QAAQ,CAAC;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
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"}
@@ -1,6 +1,6 @@
1
1
  import { VNode } from '@cycle/dom';
2
- import type { PiletApi, ExtensionSlotProps } from 'piral-core';
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(api: PiletApi, rootName?: string): CycleExtension;
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(api, rootName = 'slot') {
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
- api.renderHtmlExtension(vnode.elm, props);
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
  },
@@ -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,GAAa,EAAE,QAAQ,GAAG,MAAM;IAC9D,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,GAAG,CAAC,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;iBAC3C;YACH,CAAC;SACF;KACF,CAAC,CAAC;AACP,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
  }
@@ -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 declare function createConverter(): <TProps extends BaseComponentProps, M extends MatchingMain<PiralDomDrivers<TProps>, M>>(main: M) => ForeignComponent<TProps>;
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
- function createConverter() {
8
- return (main) => {
9
- const props$ = xstream_1.default.create();
10
- let dispose = () => { };
11
- return {
12
- mount(parent, props) {
13
- // The Cycle DOM element is not directly rendered into parent, but into a nested container.
14
- // This is done because Cycle "erases" information on the host element. If parent was used,
15
- // Piral related properties like data-portal-id could be removed, leading to things not working.
16
- const host = document.createElement('slot');
17
- parent.appendChild(host);
18
- const drivers = {
19
- DOM: dom_1.makeDOMDriver(host),
20
- props: () => props$,
21
- };
22
- dispose = run_1.default(main, drivers);
23
- props$.shamefullySendNext(props);
24
- },
25
- update(_, props) {
26
- props$.shamefullySendNext(props);
27
- },
28
- unmount() {
29
- props$.shamefullySendComplete();
30
- dispose();
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
@@ -1 +1 @@
1
- {"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;AACA,oCAA2C;AAC3C,oCAAqD;AACrD,qCAAyB;AAGzB,SAAgB,eAAe;IAC7B,OAAO,CACL,IAAO,EACmB,EAAE;QAC5B,MAAM,MAAM,GAAG,iBAAE,CAAC,MAAM,EAAU,CAAC;QACnC,IAAI,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;QAEvB,OAAO;YACL,KAAK,CAAC,MAAM,EAAE,KAAK;gBACjB,2FAA2F;gBAC3F,2FAA2F;gBAC3F,gGAAgG;gBAChG,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;gBAC5C,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAEzB,MAAM,OAAO,GAA4B;oBACvC,GAAG,EAAE,mBAAa,CAAC,IAAI,CAAC;oBACxB,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM;iBACpB,CAAC;gBAEF,OAAO,GAAG,aAAG,CAAC,IAAY,EAAE,OAAO,CAAC,CAAC;gBACrC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YACD,MAAM,CAAC,CAAC,EAAE,KAAK;gBACb,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YACD,OAAO;gBACL,MAAM,CAAC,sBAAsB,EAAE,CAAC;gBAChC,OAAO,EAAE,CAAC;YACZ,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAhCD,0CAgCC"}
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 (api) => ({
12
+ return {
15
13
  fromCycle(root) {
16
14
  return {
17
15
  type: 'cycle',
18
16
  root,
19
17
  };
20
18
  },
21
- CycleExtension: extension_1.createExtension(api, rootName),
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,2CAA8C;AAC9C,2CAA8C;AAc9C;;GAEG;AACH,SAAgB,cAAc,CAAC,SAAsB,EAAE;IACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE5B,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,2BAAe,EAAE,CAAC;QAClC,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEvD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACf,SAAS,CAAC,IAAI;gBACZ,OAAO;oBACL,IAAI,EAAE,OAAO;oBACb,IAAI;iBACL,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,2BAAe,CAAC,GAAG,EAAE,QAAQ,CAAC;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAjBD,wCAiBC"}
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"}
@@ -1,6 +1,6 @@
1
1
  import { VNode } from '@cycle/dom';
2
- import type { PiletApi, ExtensionSlotProps } from 'piral-core';
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(api: PiletApi, rootName?: string): CycleExtension;
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(api, rootName = 'slot') {
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
- api.renderHtmlExtension(vnode.elm, props);
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
  },
@@ -1 +1 @@
1
- {"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;;AAAA,oCAAsC;AAOtC,SAAgB,eAAe,CAAC,GAAa,EAAE,QAAQ,GAAG,MAAM;IAC9D,OAAO,CAAC,KAAK,EAAE,EAAE,CACf,OAAC,CAAC,QAAQ,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,IAAI,KAAK,CAAC,GAAG,YAAY,WAAW,EAAE;oBACpC,GAAG,CAAC,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;iBAC3C;YACH,CAAC;SACF;KACF,CAAC,CAAC;AACP,CAAC;AAXD,0CAWC"}
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-pre.2108",
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-pre.2108",
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": "ef3c6274568822db4b8ccc95297254d05b0c7c0c"
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 { PiralDomDrivers } from './types';
4
+ import xs, { Stream } from 'xstream';
5
+ import { createExtension } from './extension';
6
+ import type { PiralDomDrivers } from './types';
6
7
 
7
- export function createConverter() {
8
- return <TProps extends BaseComponentProps, M extends MatchingMain<PiralDomDrivers<TProps>, M>>(
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
- const props$ = xs.create<TProps>();
12
- let dispose = () => {};
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
- return {
15
- mount(parent, props) {
16
- // The Cycle DOM element is not directly rendered into parent, but into a nested container.
17
- // This is done because Cycle "erases" information on the host element. If parent was used,
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
- const drivers: PiralDomDrivers<TProps> = {
23
- DOM: makeDOMDriver(host),
24
- props: () => props$,
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
- dispose = run(main as Main, drivers);
28
- props$.shamefullySendNext(props);
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 { createExtension } from './extension';
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 (api) => ({
18
+ return {
28
19
  fromCycle(root) {
29
20
  return {
30
21
  type: 'cycle',
31
22
  root,
32
23
  };
33
24
  },
34
- CycleExtension: createExtension(api, rootName),
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 { PiletApi, ExtensionSlotProps } from 'piral-core';
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(api: PiletApi, rootName = 'slot'): CycleExtension {
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
- api.renderHtmlExtension(vnode.elm, props);
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;