@lovince/my-lit-library 1.0.2 → 2.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/custom-elements.d.ts +13 -0
- package/dist/index.d.ts +7 -19
- package/dist/index.js +7 -103
- package/package.json +21 -11
- package/README.md +0 -111
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { MyButtonProps, MyInputProps } from '@lovince/ui-shared';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'my-button': HTMLAttributes<HTMLElement> & MyButtonProps;
|
|
8
|
+
'my-input': HTMLAttributes<HTMLElement> & MyInputProps;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export * from '@lovince/ui-core';
|
|
2
|
+
export { MyButton as Button, MyInput as Input } from '@lovince/ui-core';
|
|
3
|
+
export * from '@lovince/ui-shared';
|
|
4
|
+
export { MyButtonProps, MyInputProps } from '@lovince/ui-shared';
|
|
4
5
|
|
|
5
|
-
type ButtonVariant =
|
|
6
|
-
|
|
7
|
-
declare class Button extends LitElement {
|
|
8
|
-
static properties: {
|
|
9
|
-
variant: {
|
|
10
|
-
type: StringConstructor;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
variant: ButtonVariant;
|
|
14
|
-
constructor();
|
|
15
|
-
static styles: lit.CSSResult;
|
|
16
|
-
render(): lit_html.TemplateResult<1>;
|
|
17
|
-
}
|
|
6
|
+
type ButtonVariant = "primary" | "secondary" | "danger" | "success" | "outline";
|
|
7
|
+
type InputType = "text" | "email" | "password";
|
|
18
8
|
|
|
19
9
|
declare function defineButton(): void;
|
|
20
10
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export { Button, defineAllComponents, defineButton };
|
|
11
|
+
export { type ButtonVariant, type InputType, defineButton };
|
package/dist/index.js
CHANGED
|
@@ -1,108 +1,12 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
variant: { type: String }
|
|
6
|
-
};
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.variant = "primary";
|
|
10
|
-
}
|
|
11
|
-
static styles = css`
|
|
12
|
-
button {
|
|
13
|
-
padding: 0.6rem 1rem;
|
|
14
|
-
border-radius: 6px;
|
|
15
|
-
border: none;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
font-family: inherit;
|
|
18
|
-
font-size: inherit;
|
|
19
|
-
transition: all 0.2s ease;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
button:hover {
|
|
23
|
-
transform: translateY(-1px);
|
|
24
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
button:active {
|
|
28
|
-
transform: translateY(0);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/* Primary variant */
|
|
32
|
-
button.variant-primary {
|
|
33
|
-
background: #2563eb;
|
|
34
|
-
color: white;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
button.variant-primary:hover {
|
|
38
|
-
background: #1d4ed8;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/* Secondary variant */
|
|
42
|
-
button.variant-secondary {
|
|
43
|
-
background: #6b7280;
|
|
44
|
-
color: white;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
button.variant-secondary:hover {
|
|
48
|
-
background: #4b5563;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* Danger variant */
|
|
52
|
-
button.variant-danger {
|
|
53
|
-
background: #dc2626;
|
|
54
|
-
color: white;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
button.variant-danger:hover {
|
|
58
|
-
background: #b91c1c;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/* Success variant */
|
|
62
|
-
button.variant-success {
|
|
63
|
-
background: #16a34a;
|
|
64
|
-
color: white;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
button.variant-success:hover {
|
|
68
|
-
background: #15803d;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/* Outline variant */
|
|
72
|
-
button.variant-outline {
|
|
73
|
-
background: transparent;
|
|
74
|
-
color: #2563eb;
|
|
75
|
-
border: 2px solid #2563eb;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
button.variant-outline:hover {
|
|
79
|
-
background: #2563eb;
|
|
80
|
-
color: white;
|
|
81
|
-
}
|
|
82
|
-
`;
|
|
83
|
-
render() {
|
|
84
|
-
const variantClass = `variant-${this.variant}`;
|
|
85
|
-
return html`
|
|
86
|
-
<button class="${variantClass}">
|
|
87
|
-
<slot></slot>
|
|
88
|
-
</button>
|
|
89
|
-
`;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// src/define/button.ts
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { MyButton } from "@lovince/ui-core";
|
|
3
|
+
import { MyInput } from "@lovince/ui-core";
|
|
4
|
+
export * from "@lovince/ui-core";
|
|
94
5
|
function defineButton() {
|
|
95
|
-
|
|
96
|
-
customElements.define("my-button", Button);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// src/define/all.ts
|
|
101
|
-
function defineAllComponents() {
|
|
102
|
-
defineButton();
|
|
6
|
+
console.warn("defineButton() is deprecated - elements auto-register");
|
|
103
7
|
}
|
|
104
8
|
export {
|
|
105
|
-
Button,
|
|
106
|
-
|
|
9
|
+
MyButton as Button,
|
|
10
|
+
MyInput as Input,
|
|
107
11
|
defineButton
|
|
108
12
|
};
|
package/package.json
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovince/my-lit-library",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Legacy compatibility package for @lovince/ui-*",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
9
6
|
"main": "./dist/index.js",
|
|
10
|
-
"module": "./dist/index.js",
|
|
11
7
|
"types": "./dist/index.d.ts",
|
|
12
8
|
"exports": {
|
|
13
9
|
".": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./custom-elements": {
|
|
14
|
+
"types": "./dist/custom-elements.d.ts",
|
|
15
|
+
"import": "./dist/custom-elements.d.ts"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"custom-elements.d.ts"
|
|
21
|
+
],
|
|
18
22
|
"scripts": {
|
|
19
23
|
"build": "tsup"
|
|
20
24
|
},
|
|
21
25
|
"keywords": [
|
|
22
26
|
"web-components",
|
|
23
27
|
"lit",
|
|
24
|
-
"design-system"
|
|
28
|
+
"design-system",
|
|
29
|
+
"react",
|
|
30
|
+
"vue",
|
|
31
|
+
"svelte",
|
|
32
|
+
"angular"
|
|
25
33
|
],
|
|
26
34
|
"author": "Steve",
|
|
27
35
|
"license": "MIT",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@lovince/ui-core": "^1.0.0"
|
|
38
|
+
},
|
|
28
39
|
"peerDependencies": {
|
|
29
|
-
"
|
|
40
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
30
41
|
},
|
|
31
42
|
"devDependencies": {
|
|
32
|
-
"lit": "^3.3.2",
|
|
33
43
|
"tsup": "^8.5.1",
|
|
34
44
|
"typescript": "^5.9.3"
|
|
35
45
|
}
|
package/README.md
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# @lovince/my-lit-library
|
|
2
|
-
|
|
3
|
-
Reusable Web Components built with Lit
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @lovince/my-lit-library
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
### Button Component
|
|
14
|
-
|
|
15
|
-
The library includes a customizable button component with multiple variants.
|
|
16
|
-
|
|
17
|
-
#### Import and Register
|
|
18
|
-
|
|
19
|
-
```typescript
|
|
20
|
-
import { Button, defineButton } from '@lovince/my-lit-library';
|
|
21
|
-
|
|
22
|
-
// Register the component
|
|
23
|
-
defineButton();
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
#### HTML Usage
|
|
27
|
-
|
|
28
|
-
```html
|
|
29
|
-
<!-- Default button -->
|
|
30
|
-
<my-button>Click me</my-button>
|
|
31
|
-
|
|
32
|
-
<!-- With variants -->
|
|
33
|
-
<my-button variant="primary">Primary</my-button>
|
|
34
|
-
<my-button variant="secondary">Secondary</my-button>
|
|
35
|
-
<my-button variant="danger">Danger</my-button>
|
|
36
|
-
<my-button variant="success">Success</my-button>
|
|
37
|
-
<my-button variant="outline">Outline</my-button>
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
#### TypeScript Usage
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
import { Button, ButtonVariant } from '@lovince/my-lit-library';
|
|
44
|
-
|
|
45
|
-
// You can also use the type directly
|
|
46
|
-
const variant: ButtonVariant = 'primary';
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Button Variants
|
|
50
|
-
|
|
51
|
-
- **primary**: Blue background button (default)
|
|
52
|
-
- **secondary**: Gray background button
|
|
53
|
-
- **danger**: Red background button
|
|
54
|
-
- **success**: Green background button
|
|
55
|
-
- **outline**: Transparent with blue border
|
|
56
|
-
|
|
57
|
-
## API Reference
|
|
58
|
-
|
|
59
|
-
### Button Properties
|
|
60
|
-
|
|
61
|
-
| Property | Type | Default | Description |
|
|
62
|
-
|----------|------|---------|-------------|
|
|
63
|
-
| `variant` | `ButtonVariant` | `'primary'` | The visual style variant of the button |
|
|
64
|
-
|
|
65
|
-
### ButtonVariant Type
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'success' | 'outline';
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Development
|
|
72
|
-
|
|
73
|
-
### Building
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
npm run build
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Publishing
|
|
80
|
-
|
|
81
|
-
The library follows semantic versioning:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
# Bug fix
|
|
85
|
-
npm version patch
|
|
86
|
-
npm publish --access public
|
|
87
|
-
|
|
88
|
-
# New feature
|
|
89
|
-
npm version minor
|
|
90
|
-
npm publish --access public
|
|
91
|
-
|
|
92
|
-
# Breaking change
|
|
93
|
-
npm version major
|
|
94
|
-
npm publish --access public
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Browser Support
|
|
98
|
-
|
|
99
|
-
This library supports all modern browsers that support [Web Components](https://caniuse.com/web-components) and [ES2022](https://caniuse.com/es2022).
|
|
100
|
-
|
|
101
|
-
## Dependencies
|
|
102
|
-
|
|
103
|
-
- **Lit**: ^3.0.0 (peer dependency)
|
|
104
|
-
|
|
105
|
-
## License
|
|
106
|
-
|
|
107
|
-
MIT
|
|
108
|
-
|
|
109
|
-
## Versions
|
|
110
|
-
|
|
111
|
-
See [npm versions](https://www.npmjs.com/package/@lovince/my-lit-library?activeTab=versions) for the complete version history.
|