diff --git a/package-lock.json b/package-lock.json index 0ca5df7..0a7c9ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -408,6 +408,12 @@ "typescript": "3.8.3" } }, + "@stencil/react-output-target": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@stencil/react-output-target/-/react-output-target-0.0.4.tgz", + "integrity": "sha512-Ty2nJ2igC1jVNVcEc04Ut19wb7ac+NMd8HVEHvdZbO3HZZ98yAIERN72Z5Up0jpFPZGLAJ+SMGTc2HP2hoUjnw==", + "dev": true + }, "@types/babel__core": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.3.tgz", diff --git a/package.json b/package.json index cada920..5043bfe 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "devDependencies": { "@manifoldco/eslint-plugin-stencil": "^0.4.1", "@stencil/core": "^1.8.4", + "@stencil/react-output-target": "0.0.4", "@types/jest": "24.0.25", "@types/node": "^13.7.0", "@types/puppeteer": "1.20.3", diff --git a/src/components.d.ts b/src/components.d.ts index d9ebee7..3a6b69a 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -4,71 +4,63 @@ * This is an autogenerated file created by the Stencil compiler. * It contains typing information for all components that exist in this project. */ - - -import { HTMLStencilElement, JSXBase } from '@stencil/core/internal'; -import { - Connection, -} from './components/manifold-init/manifold-init'; - +import { HTMLStencilElement, JSXBase } from "@stencil/core/internal"; +import { Connection, } from "./components/manifold-init/manifold-init"; export namespace Components { - interface ConnectedButton {} - interface ManifoldInit { - 'authToken'?: string; - 'authType'?: 'manual' | 'oauth'; - 'clientId'?: string; - 'env'?: 'local' | 'stage' | 'prod'; - 'initialize': (options: { element: HTMLElement; componentVersion: string; version: number; }) => Promise; - } + interface ConnectedButton { + } + interface ManifoldInit { + "authToken"?: string; + "authType"?: "manual" | "oauth"; + "clientId"?: string; + "env"?: "local" | "stage" | "prod"; + "initialize": (options: { + element: HTMLElement; + componentVersion: string; + version: number; + }) => Promise; + } } - declare global { - - - interface HTMLConnectedButtonElement extends Components.ConnectedButton, HTMLStencilElement {} - var HTMLConnectedButtonElement: { - prototype: HTMLConnectedButtonElement; - new (): HTMLConnectedButtonElement; - }; - - interface HTMLManifoldInitElement extends Components.ManifoldInit, HTMLStencilElement {} - var HTMLManifoldInitElement: { - prototype: HTMLManifoldInitElement; - new (): HTMLManifoldInitElement; - }; - interface HTMLElementTagNameMap { - 'connected-button': HTMLConnectedButtonElement; - 'manifold-init': HTMLManifoldInitElement; - } + interface HTMLConnectedButtonElement extends Components.ConnectedButton, HTMLStencilElement { + } + var HTMLConnectedButtonElement: { + prototype: HTMLConnectedButtonElement; + new (): HTMLConnectedButtonElement; + }; + interface HTMLManifoldInitElement extends Components.ManifoldInit, HTMLStencilElement { + } + var HTMLManifoldInitElement: { + prototype: HTMLManifoldInitElement; + new (): HTMLManifoldInitElement; + }; + interface HTMLElementTagNameMap { + "connected-button": HTMLConnectedButtonElement; + "manifold-init": HTMLManifoldInitElement; + } } - declare namespace LocalJSX { - interface ConnectedButton {} - interface ManifoldInit { - 'authToken'?: string; - 'authType'?: 'manual' | 'oauth'; - 'clientId'?: string; - 'env'?: 'local' | 'stage' | 'prod'; - 'onManifold-auth-token-clear'?: (event: CustomEvent) => void; - 'onManifold-auth-token-receive'?: (event: CustomEvent) => void; - } - - interface IntrinsicElements { - 'connected-button': ConnectedButton; - 'manifold-init': ManifoldInit; - } + interface ConnectedButton { + } + interface ManifoldInit { + "authToken"?: string; + "authType"?: "manual" | "oauth"; + "clientId"?: string; + "env"?: "local" | "stage" | "prod"; + "onManifold-auth-token-clear"?: (event: CustomEvent) => void; + "onManifold-auth-token-receive"?: (event: CustomEvent) => void; + } + interface IntrinsicElements { + "connected-button": ConnectedButton; + "manifold-init": ManifoldInit; + } } - export { LocalJSX as JSX }; - - declare module "@stencil/core" { - export namespace JSX { - interface IntrinsicElements { - 'connected-button': LocalJSX.ConnectedButton & JSXBase.HTMLAttributes; - 'manifold-init': LocalJSX.ManifoldInit & JSXBase.HTMLAttributes; + export namespace JSX { + interface IntrinsicElements { + "connected-button": LocalJSX.ConnectedButton & JSXBase.HTMLAttributes; + "manifold-init": LocalJSX.ManifoldInit & JSXBase.HTMLAttributes; + } } - } } - - diff --git a/src/components/manifold-init/readme.md b/src/components/manifold-init/readme.md index d26bd93..4d0bd9c 100644 --- a/src/components/manifold-init/readme.md +++ b/src/components/manifold-init/readme.md @@ -7,12 +7,20 @@ ## Properties -| Property | Attribute | Description | Type | Default | -| ----------- | ------------ | ----------- | --------------------- | ----------- | -| `authToken` | `auth-token` | | `string` | `undefined` | -| `authType` | `auth-type` | | `"manual" \| "oauth"` | `'oauth'` | -| `clientId` | `client-id` | | `string` | `undefined` | -| `env` | `env` | | `"prod" \| "stage"` | `'prod'` | +| Property | Attribute | Description | Type | Default | +| ----------- | ------------ | ----------- | ------------------------------ | ----------- | +| `authToken` | `auth-token` | | `string` | `undefined` | +| `authType` | `auth-type` | | `"manual" \| "oauth"` | `'oauth'` | +| `clientId` | `client-id` | | `string` | `undefined` | +| `env` | `env` | | `"local" \| "prod" \| "stage"` | `'prod'` | + + +## Events + +| Event | Description | Type | +| ----------------------------- | ----------- | --------------------- | +| `manifold-auth-token-clear` | | `CustomEvent` | +| `manifold-auth-token-receive` | | `CustomEvent` | ## Methods diff --git a/stencil.config.ts b/stencil.config.ts index 1296576..0bb8b7d 100644 --- a/stencil.config.ts +++ b/stencil.config.ts @@ -1,12 +1,20 @@ import fs from 'fs'; import replace from 'rollup-plugin-replace'; import { Config } from '@stencil/core'; +import { reactOutputTarget } from '@stencil/react-output-target'; const pkgManifest = JSON.parse(fs.readFileSync('package.json', 'utf8')); export const config: Config = { namespace: 'manifold-init', outputTargets: [ + reactOutputTarget({ + componentCorePackage: '@manifoldco/manifold-init', + proxiesFile: 'dist/react/components.ts', + }), + { + type: 'dist', + }, { type: 'dist', esmLoaderPath: '../loader',