@parthi033/ui-foundation 0.0.1 → 0.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/package.json +4 -4
- package/readme.md +30 -99
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parthi033/ui-foundation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Stencil Component Starter",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"import": "./dist/ui-foundation/ui-foundation.esm.js",
|
|
14
14
|
"require": "./dist/ui-foundation/ui-foundation.cjs.js"
|
|
15
15
|
},
|
|
16
|
-
"./
|
|
17
|
-
"import": "./dist/components
|
|
18
|
-
"types": "./dist/components
|
|
16
|
+
"./components/*": {
|
|
17
|
+
"import": "./dist/components/*",
|
|
18
|
+
"types": "./dist/components/*"
|
|
19
19
|
},
|
|
20
20
|
"./loader": {
|
|
21
21
|
"import": "./loader/index.js",
|
package/readme.md
CHANGED
|
@@ -1,111 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
# @parthi033/ui-foundation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A lightweight, framework‑agnostic Web Components library built with Stencil.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
|
+
- Framework‑agnostic Web Components
|
|
7
|
+
- Stencil-powered
|
|
8
|
+
- Optional Shadow DOM
|
|
9
|
+
- Tree‑shakeable builds (ESM + CJS)
|
|
10
|
+
- Typed definitions included
|
|
11
|
+
- Easy integration with Storybook, React, Angular, Vue
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
## Installation
|
|
14
|
+
npm install @parthi033/ui-foundation
|
|
8
15
|
|
|
9
|
-
|
|
16
|
+
## Usage
|
|
17
|
+
Load a component:
|
|
18
|
+
import '@parthi033/ui-foundation/dist/components/pn-button';
|
|
10
19
|
|
|
11
|
-
|
|
20
|
+
Use in HTML:
|
|
21
|
+
<pn-button label="Click me"></pn-button>
|
|
12
22
|
|
|
13
|
-
##
|
|
23
|
+
## Components
|
|
24
|
+
### pn-button
|
|
25
|
+
Props:
|
|
26
|
+
- label (string): Text displayed on the button
|
|
14
27
|
|
|
15
|
-
|
|
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
|
|
28
|
+
## Development
|
|
26
29
|
npm install
|
|
27
|
-
npm start
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
To build the component for production, run:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
30
|
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';
|
|
31
|
+
npm start
|
|
93
32
|
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
}
|
|
33
|
+
## Storybook
|
|
34
|
+
npm install @parthi033/ui-foundation
|
|
35
|
+
import '@parthi033/ui-foundation/dist/components/pn-button';
|
|
107
36
|
|
|
108
|
-
|
|
109
|
-
|
|
37
|
+
## Publishing
|
|
38
|
+
npm version patch
|
|
39
|
+
npm publish --access public
|
|
110
40
|
|
|
111
|
-
|
|
41
|
+
## License
|
|
42
|
+
MIT License © 2026 ParthibanNagaraj
|