@chat-leo/chatleo 0.0.0-stage → 2.0.2
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 +21 -0
- package/dist/chatleo/chatleo.esm.js +1 -0
- package/dist/chatleo/index.esm.js +1 -0
- package/dist/chatleo/p-43ada232.entry.js +1 -0
- package/dist/chatleo/p-4485e141.entry.js +1 -0
- package/dist/chatleo/p-BnCPdbII.js +1 -0
- package/dist/chatleo/p-C-l90Wre.js +1 -0
- package/dist/chatleo/p-DQuL1Twl.js +1 -0
- package/dist/chatleo/p-DmL518NK.js +3 -0
- package/dist/chatleo/p-aed60255.entry.js +1 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/chatleo-avatar_13.cjs.entry.js +2986 -0
- package/dist/cjs/chatleo-call-adapter-B2OfC0VZ.js +35 -0
- package/dist/cjs/chatleo-chat-input.cjs.entry.js +67 -0
- package/dist/cjs/chatleo.cjs.js +25 -0
- package/dist/cjs/index-DkSDLR0y.js +56 -0
- package/dist/cjs/index-Dxw4YCA_.js +1741 -0
- package/dist/cjs/index.cjs.js +7 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/my-component.cjs.entry.js +33 -0
- package/dist/collection/__mocks__/stencil-core.js +26 -0
- package/dist/collection/collection-manifest.json +27 -0
- package/dist/collection/components/chatleo-avatar/chatleo-avatar.css +40 -0
- package/dist/collection/components/chatleo-avatar/chatleo-avatar.js +116 -0
- package/dist/collection/components/chatleo-chat/chatleo-chat.css +108 -0
- package/dist/collection/components/chatleo-chat/chatleo-chat.js +459 -0
- package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.css +22 -0
- package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.js +105 -0
- package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.css +84 -0
- package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.js +141 -0
- package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.css +149 -0
- package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.js +259 -0
- package/dist/collection/components/chatleo-component/chatleo-component.css +271 -0
- package/dist/collection/components/chatleo-component/chatleo-component.js +1366 -0
- package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.css +96 -0
- package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.js +231 -0
- package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.css +352 -0
- package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.js +976 -0
- package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.css +169 -0
- package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.js +400 -0
- package/dist/collection/components/chatleo-room-list/chatleo-room-list.css +111 -0
- package/dist/collection/components/chatleo-room-list/chatleo-room-list.js +180 -0
- package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.css +110 -0
- package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.js +241 -0
- package/dist/collection/components/chatleo-room-view/chatleo-room-view.css +93 -0
- package/dist/collection/components/chatleo-room-view/chatleo-room-view.js +593 -0
- package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.css +284 -0
- package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.js +391 -0
- package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.css +56 -0
- package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.js +149 -0
- package/dist/collection/components/my-component/my-component.css +4 -0
- package/dist/collection/components/my-component/my-component.js +95 -0
- package/dist/collection/index.js +10 -0
- package/dist/collection/utils/call-entry.js +34 -0
- package/dist/collection/utils/delivery.js +7 -0
- package/dist/collection/utils/utils.js +51 -0
- package/dist/components/chatleo-avatar.d.ts +11 -0
- package/dist/components/chatleo-avatar.js +1 -0
- package/dist/components/chatleo-chat-header.d.ts +11 -0
- package/dist/components/chatleo-chat-header.js +1 -0
- package/dist/components/chatleo-chat-input.d.ts +11 -0
- package/dist/components/chatleo-chat-input.js +1 -0
- package/dist/components/chatleo-chat-message.d.ts +11 -0
- package/dist/components/chatleo-chat-message.js +1 -0
- package/dist/components/chatleo-chat.d.ts +11 -0
- package/dist/components/chatleo-chat.js +1 -0
- package/dist/components/chatleo-component.d.ts +11 -0
- package/dist/components/chatleo-component.js +1 -0
- package/dist/components/chatleo-new-message-selector.d.ts +11 -0
- package/dist/components/chatleo-new-message-selector.js +1 -0
- package/dist/components/chatleo-rich-input.d.ts +11 -0
- package/dist/components/chatleo-rich-input.js +1 -0
- package/dist/components/chatleo-rich-message-renderer.d.ts +11 -0
- package/dist/components/chatleo-rich-message-renderer.js +1 -0
- package/dist/components/chatleo-room-list.d.ts +11 -0
- package/dist/components/chatleo-room-list.js +1 -0
- package/dist/components/chatleo-room-tile-component.d.ts +11 -0
- package/dist/components/chatleo-room-tile-component.js +1 -0
- package/dist/components/chatleo-room-view.d.ts +11 -0
- package/dist/components/chatleo-room-view.js +1 -0
- package/dist/components/chatleo-tray-component.d.ts +11 -0
- package/dist/components/chatleo-tray-component.js +1 -0
- package/dist/components/chatleo-user-tile.d.ts +11 -0
- package/dist/components/chatleo-user-tile.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/my-component.d.ts +11 -0
- package/dist/components/my-component.js +1 -0
- package/dist/components/p-8kvQ-Uh-.js +1 -0
- package/dist/components/p-B7cdqAgv.js +1 -0
- package/dist/components/p-BdiOcOYZ.js +1 -0
- package/dist/components/p-BlbDSb7D.js +1 -0
- package/dist/components/p-BnCPdbII.js +1 -0
- package/dist/components/p-C-v19aUJ.js +1 -0
- package/dist/components/p-C1mF0s8g.js +1 -0
- package/dist/components/p-CRtBdzP3.js +1 -0
- package/dist/components/p-CfayCm9O.js +1 -0
- package/dist/components/p-DGjAxoQy.js +1 -0
- package/dist/components/p-Exj_2-yI.js +1 -0
- package/dist/components/p-XlwGxsqT.js +1 -0
- package/dist/components/p-fjMaTJam.js +1 -0
- package/dist/components/p-xt4kzz3B.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/chatleo-avatar_13.entry.js +2972 -0
- package/dist/esm/chatleo-call-adapter-BnCPdbII.js +33 -0
- package/dist/esm/chatleo-chat-input.entry.js +65 -0
- package/dist/esm/chatleo.js +21 -0
- package/dist/esm/index-C-l90Wre.js +53 -0
- package/dist/esm/index-DmL518NK.js +1733 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/my-component.entry.js +31 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/__mocks__/stencil-core.d.ts +24 -0
- package/dist/types/components/chatleo-avatar/chatleo-avatar.d.ts +27 -0
- package/dist/types/components/chatleo-chat/chatleo-chat.d.ts +75 -0
- package/dist/types/components/chatleo-chat-header/chatleo-chat-header.d.ts +27 -0
- package/dist/types/components/chatleo-chat-input/chatleo-chat-input.d.ts +31 -0
- package/dist/types/components/chatleo-chat-message/chatleo-chat-message.d.ts +22 -0
- package/dist/types/components/chatleo-component/chatleo-component.d.ts +278 -0
- package/dist/types/components/chatleo-new-message-selector/chatleo-new-message-selector.d.ts +68 -0
- package/dist/types/components/chatleo-rich-input/chatleo-rich-input.d.ts +216 -0
- package/dist/types/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.d.ts +77 -0
- package/dist/types/components/chatleo-room-list/chatleo-room-list.d.ts +52 -0
- package/dist/types/components/chatleo-room-tile-component/chatleo-room-tile-component.d.ts +59 -0
- package/dist/types/components/chatleo-room-view/chatleo-room-view.d.ts +91 -0
- package/dist/types/components/chatleo-tray-component/chatleo-tray-component.d.ts +112 -0
- package/dist/types/components/chatleo-user-tile/chatleo-user-tile.d.ts +36 -0
- package/dist/types/components/my-component/my-component.d.ts +16 -0
- package/dist/types/components.d.ts +1593 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/stencil-public-runtime.d.ts +1879 -0
- package/dist/types/utils/call-entry.d.ts +9 -0
- package/dist/types/utils/delivery.d.ts +7 -0
- package/dist/types/utils/utils.d.ts +24 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +70 -3
- package/readme.md +111 -0
- package/README.md +0 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text of a call history entry, or `null` when the message is not one.
|
|
3
|
+
*
|
|
4
|
+
* chatleo-server posts call entries as `application/json+blocks` with one `call` block:
|
|
5
|
+
* `{"version":"1","blocks":[{"type":"call","event":"started|ended|missed|declined|failed",
|
|
6
|
+
* "mode":…,"duration_ms":…}],"fallback_text":"Call ended · 1m 5s"}`. The message-level
|
|
7
|
+
* `fallback_text` is preferred; `state` and a block-level `fallback_text` are accepted too.
|
|
8
|
+
*/
|
|
9
|
+
export declare function callEntryText(contentBody: string): string | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ChatLeoMessage } from '@chat-leo/chatleolib';
|
|
2
|
+
/** What the message footer should show for a locally originated message. */
|
|
3
|
+
export declare function deliveryView(message: ChatLeoMessage, isOwnMessage: boolean): {
|
|
4
|
+
status: 'none' | 'pending' | 'failed';
|
|
5
|
+
error?: string;
|
|
6
|
+
canRetry: boolean;
|
|
7
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ChatLeoMessage } from "@chat-leo/chatleolib";
|
|
2
|
+
/**
|
|
3
|
+
* @function format
|
|
4
|
+
* @description This utility function concatenates the first, middle, and last names into a single string, with spaces in between. It gracefully handles cases where some or all of the name parts are not provided.
|
|
5
|
+
* @param {string} first - The first name.
|
|
6
|
+
* @param {string} middle - The middle name.
|
|
7
|
+
* @param {string} last - The last name.
|
|
8
|
+
* @returns {string} The full name as a single string.
|
|
9
|
+
*/
|
|
10
|
+
export declare function format(first?: string, middle?: string, last?: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* @function groupMessagesByDate
|
|
13
|
+
* @description This function takes an array of `ChatLeoMessage` objects and groups them into a record where the keys are formatted dates and the values are arrays of messages from that date.
|
|
14
|
+
* @param {ChatLeoMessage[]} messages - An array of `ChatLeoMessage` objects to be grouped.
|
|
15
|
+
* @returns {Record<string, ChatLeoMessage[]>} An object where keys are date strings and values are arrays of messages.
|
|
16
|
+
*/
|
|
17
|
+
export declare function groupMessagesByDate(messages: ChatLeoMessage[]): Record<string, ChatLeoMessage[]>;
|
|
18
|
+
/**
|
|
19
|
+
* @function formatDate
|
|
20
|
+
* @description This function takes a timestamp string, converts it to a Date object, and then formats it into a "Month Day, Year" format in uppercase.
|
|
21
|
+
* @param {string} timestamp - An ISO 8601 timestamp string.
|
|
22
|
+
* @returns {string} The formatted date string (e.g., "JAN 1, 2023").
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatDate(timestamp: string): string;
|
package/loader/cdn.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/cjs/loader.cjs.js');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/cjs/loader.cjs.js');
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from '../dist/types/components';
|
|
2
|
+
export interface CustomElementsDefineOptions {
|
|
3
|
+
exclude?: string[];
|
|
4
|
+
resourcesUrl?: string;
|
|
5
|
+
syncQueue?: boolean;
|
|
6
|
+
jmp?: (c: Function) => any;
|
|
7
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
8
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
9
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyPolyfills(): Promise<void>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Used to specify a nonce value that corresponds with an application's CSP.
|
|
19
|
+
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
20
|
+
* Alternatively, the nonce value can be set on a meta tag in the DOM head
|
|
21
|
+
* (<meta name="csp-nonce" content="{ nonce value here }" />) which
|
|
22
|
+
* will result in the same behavior.
|
|
23
|
+
*/
|
|
24
|
+
export declare function setNonce(nonce: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/esm/loader.js';
|
package/loader/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
|
|
2
|
+
export * from '../dist/esm/loader.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chat-leo/chatleo",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "ChatLeo chat web components — embeddable <chatleo-component> UI for a ChatLeo server",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"collection": "dist/collection/collection-manifest.json",
|
|
9
|
+
"collection:main": "dist/collection/index.js",
|
|
10
|
+
"unpkg": "dist/chatleo/chatleo.esm.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/types/index.d.ts",
|
|
14
|
+
"import": "./dist/chatleo/chatleo.esm.js",
|
|
15
|
+
"require": "./dist/chatleo/chatleo.cjs.js"
|
|
16
|
+
},
|
|
17
|
+
"./loader": {
|
|
18
|
+
"types": "./loader/index.d.ts",
|
|
19
|
+
"import": "./loader/index.js",
|
|
20
|
+
"require": "./loader/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/webmobix/chatleo-web.git",
|
|
26
|
+
"directory": "packages/chatleo"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://chat-leo.com",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/webmobix/chatleo-web/issues"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"chatleo",
|
|
34
|
+
"chat",
|
|
35
|
+
"web-components",
|
|
36
|
+
"stencil",
|
|
37
|
+
"messaging",
|
|
38
|
+
"calls"
|
|
39
|
+
],
|
|
40
|
+
"author": "Danny Thuering <danny@webmobix.com>",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"registry": "https://registry.npmjs.org"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist/",
|
|
47
|
+
"loader/"
|
|
48
|
+
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@chat-leo/chatleolib": "^2.0.2"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@chat-leo/call-components": "^2.0.2",
|
|
54
|
+
"@stencil/core": "^4.45.2",
|
|
55
|
+
"@types/jest": "^30.0.0",
|
|
56
|
+
"@types/node": "^26.6.6",
|
|
57
|
+
"jest": "^30.5.2",
|
|
58
|
+
"jest-cli": "^30.4.2",
|
|
59
|
+
"jest-environment-node": "^30.5.2",
|
|
60
|
+
"puppeteer": "^25.16.0",
|
|
61
|
+
"workbox-build": "7.4.1"
|
|
62
|
+
},
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "stencil build",
|
|
66
|
+
"clean": "rm -rf dist www loader .stencil",
|
|
67
|
+
"dev": "stencil build --dev --watch --serve",
|
|
68
|
+
"test": "jest --testPathPatterns=\"(chatleo-component|chatleo-chat-message|utils)\\.spec\"",
|
|
69
|
+
"test:stencil": "stencil test --spec",
|
|
70
|
+
"test.watch": "jest --watch --testPathPatterns=\"(chatleo-component|chatleo-chat-message|utils)\\.spec\"",
|
|
71
|
+
"generate": "stencil generate"
|
|
72
|
+
}
|
|
6
73
|
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
[](https://stenciljs.com)
|
|
2
|
+
|
|
3
|
+
# Stencil Component Starter
|
|
4
|
+
|
|
5
|
+
> This is a starter project for building a standalone Web Components using Stencil.
|
|
6
|
+
|
|
7
|
+
Stencil is a compiler for building fast web apps using Web Components.
|
|
8
|
+
|
|
9
|
+
Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than runtime tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements specification.
|
|
10
|
+
|
|
11
|
+
Stencil components are just Web Components, so they work in any major framework or with no framework at all.
|
|
12
|
+
|
|
13
|
+
## Getting Started
|
|
14
|
+
|
|
15
|
+
To start building a new web component using Stencil, clone this repo to a new directory:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/stenciljs/component-starter.git my-component
|
|
19
|
+
cd my-component
|
|
20
|
+
git remote rm origin
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
and run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install
|
|
27
|
+
npm start
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
To build the component for production, run:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm run build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
To run the unit tests for the components, run:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm test
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Need help? Check out our docs [here](https://stenciljs.com/docs/my-first-component).
|
|
43
|
+
|
|
44
|
+
## Naming Components
|
|
45
|
+
|
|
46
|
+
When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!
|
|
47
|
+
|
|
48
|
+
Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the [Ionic-generated](https://ionicframework.com/) web components use the prefix `ion`.
|
|
49
|
+
|
|
50
|
+
## Using this component
|
|
51
|
+
|
|
52
|
+
There are two strategies we recommend for using web components built with Stencil.
|
|
53
|
+
|
|
54
|
+
The first step for all two of these strategies is to [publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
|
55
|
+
|
|
56
|
+
You can read more about these different approaches in the [Stencil docs](https://stenciljs.com/docs/publishing).
|
|
57
|
+
|
|
58
|
+
### Lazy Loading
|
|
59
|
+
|
|
60
|
+
If your Stencil project is built with the [`dist`](https://stenciljs.com/docs/distribution) output target, you can import a small bootstrap script that registers all components and allows you to load individual component scripts lazily.
|
|
61
|
+
|
|
62
|
+
For example, given your Stencil project namespace is called `my-design-system`, to use `my-component` on any website, inject this into your HTML:
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<script type="module" src="https://unpkg.com/my-design-system"></script>
|
|
66
|
+
<!--
|
|
67
|
+
To avoid unpkg.com redirects to the actual file, you can also directly import:
|
|
68
|
+
https://unpkg.com/foobar-design-system@0.0.1/dist/foobar-design-system/foobar-design-system.esm.js
|
|
69
|
+
-->
|
|
70
|
+
<my-component first="Stencil" middle="'Don't call me a framework'" last="JS"></my-component>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This will only load the necessary scripts needed to render `<my-component />`. Once more components of this package are used, they will automatically be loaded lazily.
|
|
74
|
+
|
|
75
|
+
You can also import the script as part of your `node_modules` in your applications entry file:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import 'foobar-design-system/dist/foobar-design-system/foobar-design-system.esm.js';
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Check out this [Live Demo](https://stackblitz.com/edit/vitejs-vite-y6v26a?file=src%2Fmain.tsx).
|
|
82
|
+
|
|
83
|
+
### Standalone
|
|
84
|
+
|
|
85
|
+
If you are using a Stencil component library with `dist-custom-elements`, we recommend importing Stencil components individually in those files where they are needed.
|
|
86
|
+
|
|
87
|
+
To export Stencil components as standalone components make sure you have the [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements) output target defined in your `stencil.config.ts`.
|
|
88
|
+
|
|
89
|
+
For example, given you'd like to use `<my-component />` as part of a React component, you can import the component directly via:
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import 'foobar-design-system/my-component';
|
|
93
|
+
|
|
94
|
+
function App() {
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
<div>
|
|
98
|
+
<my-component
|
|
99
|
+
first="Stencil"
|
|
100
|
+
middle="'Don't call me a framework'"
|
|
101
|
+
last="JS"
|
|
102
|
+
></my-component>
|
|
103
|
+
</div>
|
|
104
|
+
</>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default App;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Check out this [Live Demo](https://stackblitz.com/edit/vitejs-vite-b6zuds?file=src%2FApp.tsx).
|
package/README.md
DELETED