@logosphere-ui/core 0.0.0-alpha.11
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/README.md +759 -0
- package/dist/atoms/Badge/badge.d.ts +21 -0
- package/dist/atoms/Badge/index.d.ts +2 -0
- package/dist/atoms/Button/button.d.ts +11 -0
- package/dist/atoms/Button/index.d.ts +1 -0
- package/dist/atoms/Checkbox/checkbox.d.ts +20 -0
- package/dist/atoms/Checkbox/index.d.ts +1 -0
- package/dist/atoms/FormField/formfield.d.ts +30 -0
- package/dist/atoms/FormField/index.d.ts +2 -0
- package/dist/atoms/Switch/index.d.ts +1 -0
- package/dist/atoms/Switch/switch.d.ts +10 -0
- package/dist/badge-CHWTCGQG.js +72 -0
- package/dist/badge-DVvdodRb.cjs +13 -0
- package/dist/badge.cjs +1 -0
- package/dist/badge.js +4 -0
- package/dist/breadcrumb-BB61Xt0s.js +41 -0
- package/dist/breadcrumb-Cop-B1J7.cjs +12 -0
- package/dist/breadcrumb.cjs +1 -0
- package/dist/breadcrumb.js +4 -0
- package/dist/button-BqOMevro.js +58 -0
- package/dist/button-CDRccsk9.cjs +10 -0
- package/dist/button.cjs +1 -0
- package/dist/button.js +4 -0
- package/dist/card-CNoTUaJC.js +98 -0
- package/dist/card-KiNHfEi2.cjs +43 -0
- package/dist/card.cjs +1 -0
- package/dist/card.js +4 -0
- package/dist/chatbot-BNGCxSf9.js +485 -0
- package/dist/chatbot-P32-Xv7e.cjs +160 -0
- package/dist/chatbot.cjs +1 -0
- package/dist/chatbot.js +4 -0
- package/dist/checkbox-CdDTRdKV.cjs +37 -0
- package/dist/checkbox-g6kl2jGR.js +119 -0
- package/dist/checkbox.cjs +1 -0
- package/dist/checkbox.js +4 -0
- package/dist/combobox-CeK7yW2F.cjs +99 -0
- package/dist/combobox-DTUSFw9V.js +270 -0
- package/dist/combobox.cjs +1 -0
- package/dist/combobox.js +4 -0
- package/dist/datepicker-BQOVo1Pr.cjs +115 -0
- package/dist/datepicker-ChdQsc_l.js +751 -0
- package/dist/datepicker.cjs +1 -0
- package/dist/datepicker.js +4 -0
- package/dist/download-manager-BSIMTGaK.cjs +97 -0
- package/dist/download-manager-a541AYhr.js +381 -0
- package/dist/download-manager.cjs +1 -0
- package/dist/download-manager.js +4 -0
- package/dist/formfield-BOgRugzm.js +118 -0
- package/dist/formfield-D_7NFFoe.cjs +27 -0
- package/dist/formfield.cjs +1 -0
- package/dist/formfield.js +4 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +34 -0
- package/dist/index.umd.js +840 -0
- package/dist/input-CoY1ZcPF.cjs +46 -0
- package/dist/input-CxBP0i-3.js +194 -0
- package/dist/input.cjs +1 -0
- package/dist/input.js +4 -0
- package/dist/modal-CnwRIdd8.js +110 -0
- package/dist/modal-DQ8VFL-P.cjs +39 -0
- package/dist/modal.cjs +1 -0
- package/dist/modal.js +4 -0
- package/dist/molecules/Breadcrumb/breadcrumb.d.ts +10 -0
- package/dist/molecules/Breadcrumb/index.d.ts +1 -0
- package/dist/molecules/Card/card.d.ts +16 -0
- package/dist/molecules/Card/index.d.ts +1 -0
- package/dist/molecules/Input/index.d.ts +2 -0
- package/dist/molecules/Input/input.d.ts +50 -0
- package/dist/molecules/Popover/index.d.ts +1 -0
- package/dist/molecules/Popover/popover.d.ts +33 -0
- package/dist/molecules/Textarea/index.d.ts +1 -0
- package/dist/molecules/Textarea/text-area.d.ts +49 -0
- package/dist/organisms/Chatbot/chatbot.d.ts +79 -0
- package/dist/organisms/Chatbot/index.d.ts +1 -0
- package/dist/organisms/Combobox/combobox.d.ts +49 -0
- package/dist/organisms/Combobox/index.d.ts +1 -0
- package/dist/organisms/DatePicker/datepicker.d.ts +79 -0
- package/dist/organisms/DatePicker/index.d.ts +1 -0
- package/dist/organisms/DownloadManager/download-manager.d.ts +52 -0
- package/dist/organisms/DownloadManager/index.d.ts +1 -0
- package/dist/organisms/Modal/index.d.ts +1 -0
- package/dist/organisms/Modal/modal.d.ts +21 -0
- package/dist/organisms/Tab/index.d.ts +1 -0
- package/dist/organisms/Tab/tab.d.ts +33 -0
- package/dist/popover-C2p5Pmts.cjs +30 -0
- package/dist/popover-CaVOXo_k.js +140 -0
- package/dist/popover.cjs +1 -0
- package/dist/popover.js +4 -0
- package/dist/shared/icons/icon-map.d.ts +1 -0
- package/dist/shared/icons/ui-icon.d.ts +15 -0
- package/dist/styles/main.css +247 -0
- package/dist/switch-CG4SSjTg.js +64 -0
- package/dist/switch-Rnnn10bn.cjs +17 -0
- package/dist/switch.cjs +1 -0
- package/dist/switch.js +4 -0
- package/dist/tab-BYU_XEhp.js +176 -0
- package/dist/tab-DcjAlXzU.cjs +40 -0
- package/dist/tab.cjs +1 -0
- package/dist/tab.js +4 -0
- package/dist/text-area-Dw4CUBcz.js +206 -0
- package/dist/text-area-eT-oCnqZ.cjs +44 -0
- package/dist/textarea.cjs +1 -0
- package/dist/textarea.js +4 -0
- package/dist/ui-icon-CVEyvL5D.cjs +22 -0
- package/dist/ui-icon-ltkJROhR.js +51 -0
- package/dist/vite.svg +1 -0
- package/package.json +184 -0
package/README.md
ADDED
|
@@ -0,0 +1,759 @@
|
|
|
1
|
+
# 🌍 Logosphere UI
|
|
2
|
+
|
|
3
|
+
A modern, framework-agnostic UI component library built with Lit and Web Components. Works seamlessly with React, Angular, Vue, and Vanilla JavaScript.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🔧 **Framework Agnostic**: Works with React, Angular, Vue, and Vanilla JS
|
|
8
|
+
- 🌳 **Tree-shakable**: Import only what you need
|
|
9
|
+
- 📦 **Monolith Package**: Single npm package with granular imports
|
|
10
|
+
- 🎨 **Modern CSS**: Enterprise-grade CSS architecture with custom design system
|
|
11
|
+
- 🚀 **Zero Dependencies**: No utility framework bloat - pure, optimized CSS
|
|
12
|
+
- 🔄 **TypeScript**: Full TypeScript support with type declarations
|
|
13
|
+
- 📱 **Responsive**: Mobile-first design
|
|
14
|
+
- ♿ **Accessible**: Built with accessibility in mind
|
|
15
|
+
|
|
16
|
+
## 📦 Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install logosphere-ui
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🎯 Usage
|
|
23
|
+
|
|
24
|
+
### 📦 CSS Import (Required)
|
|
25
|
+
|
|
26
|
+
Logosphere UI uses a modern, enterprise-grade CSS architecture. Simply import the main CSS file:
|
|
27
|
+
|
|
28
|
+
**In CSS files:**
|
|
29
|
+
```css
|
|
30
|
+
@import 'logosphere-ui/css';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**In JavaScript/TypeScript:**
|
|
34
|
+
```javascript
|
|
35
|
+
import 'logosphere-ui/css';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**In HTML:**
|
|
39
|
+
```html
|
|
40
|
+
<link rel="stylesheet" href="node_modules/logosphere-ui/dist/logosphere.css">
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Features of our CSS Architecture
|
|
44
|
+
|
|
45
|
+
- ✅ **Modern CSS Variables** - Theme-based design tokens
|
|
46
|
+
- ✅ **Scoped Reset** - Custom reset for web components (`.logoui-wrapper`)
|
|
47
|
+
- ✅ **No Framework Dependencies** - Pure, optimized CSS
|
|
48
|
+
- ✅ **Tree-shakable** - Import only what you use
|
|
49
|
+
- ✅ **Dark Mode Support** - Built-in dark theme via `[data-theme="dark"]`
|
|
50
|
+
- ✅ **Utility Classes** - Common utilities for rapid development
|
|
51
|
+
- ✅ **Icon Font Included** - Unicons icon set bundled
|
|
52
|
+
|
|
53
|
+
#### Quick Import Reference
|
|
54
|
+
|
|
55
|
+
| Framework | Import Method | Example |
|
|
56
|
+
|-----------|--------------|---------|
|
|
57
|
+
| **Vanilla JS** | HTML Link | `<link rel="stylesheet" href="node_modules/logosphere-ui/dist/logosphere.css">` |
|
|
58
|
+
| **React** | ES Import | `import 'logosphere-ui/css';` |
|
|
59
|
+
| **Angular** | styles.css | `@import 'logosphere-ui/css';` |
|
|
60
|
+
| **Vue 3** | main.ts | `import 'logosphere-ui/css';` |
|
|
61
|
+
| **Any CSS** | CSS Import | `@import 'logosphere-ui/css';` |
|
|
62
|
+
|
|
63
|
+
### Vanilla JavaScript / HTML
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<!DOCTYPE html>
|
|
67
|
+
<html>
|
|
68
|
+
<head>
|
|
69
|
+
<!-- Import CSS -->
|
|
70
|
+
<link rel="stylesheet" href="node_modules/logosphere-ui/dist/logosphere.css">
|
|
71
|
+
</head>
|
|
72
|
+
<body>
|
|
73
|
+
<logosphere-button variant="primary">Click me!</logosphere-button>
|
|
74
|
+
<logosphere-modal id="myModal">
|
|
75
|
+
<h2>Modal Content</h2>
|
|
76
|
+
<p>This is a modal</p>
|
|
77
|
+
</logosphere-modal>
|
|
78
|
+
|
|
79
|
+
<script type="module">
|
|
80
|
+
// Import all components
|
|
81
|
+
import 'logosphere-ui';
|
|
82
|
+
|
|
83
|
+
// Or import specific components for better tree-shaking
|
|
84
|
+
import 'logosphere-ui/button';
|
|
85
|
+
import 'logosphere-ui/modal';
|
|
86
|
+
</script>
|
|
87
|
+
</body>
|
|
88
|
+
</html>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### React
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import React from 'react';
|
|
95
|
+
// Import CSS: Choose scoped (recommended) or base
|
|
96
|
+
import 'logosphere-ui/css/scoped';
|
|
97
|
+
import { Button, Modal, Checkbox } from 'logosphere-ui/react';
|
|
98
|
+
|
|
99
|
+
function App() {
|
|
100
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<div>
|
|
104
|
+
<Button
|
|
105
|
+
variant="primary"
|
|
106
|
+
onClick={() => setIsOpen(true)}
|
|
107
|
+
>
|
|
108
|
+
Open Modal
|
|
109
|
+
</Button>
|
|
110
|
+
|
|
111
|
+
<Modal
|
|
112
|
+
open={isOpen}
|
|
113
|
+
onModalClose={() => setIsOpen(false)}
|
|
114
|
+
>
|
|
115
|
+
<h2>React Modal</h2>
|
|
116
|
+
<Checkbox
|
|
117
|
+
label="Agree to terms"
|
|
118
|
+
onChange={(e) => console.log(e.detail.checked)}
|
|
119
|
+
/>
|
|
120
|
+
</Modal>
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default App;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Angular
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
// app.module.ts
|
|
132
|
+
import { NgModule } from '@angular/core';
|
|
133
|
+
import { LogosphereButtonModule } from 'logosphere-ui/angular/button';
|
|
134
|
+
import { LogosphereModalModule } from 'logosphere-ui/angular/modal';
|
|
135
|
+
|
|
136
|
+
@NgModule({
|
|
137
|
+
imports: [
|
|
138
|
+
LogosphereButtonModule,
|
|
139
|
+
LogosphereModalModule,
|
|
140
|
+
// ... other imports
|
|
141
|
+
],
|
|
142
|
+
// ...
|
|
143
|
+
})
|
|
144
|
+
export class AppModule { }
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
// app.component.ts
|
|
149
|
+
import { Component } from '@angular/core';
|
|
150
|
+
|
|
151
|
+
@Component({
|
|
152
|
+
selector: 'app-root',
|
|
153
|
+
template: \`
|
|
154
|
+
<logosphere-button
|
|
155
|
+
variant="primary"
|
|
156
|
+
(click)="openModal()">
|
|
157
|
+
Open Modal
|
|
158
|
+
</logosphere-button>
|
|
159
|
+
|
|
160
|
+
<logosphere-modal
|
|
161
|
+
[attr.open]="isModalOpen"
|
|
162
|
+
(modal-close)="closeModal()">
|
|
163
|
+
<h2>Angular Modal</h2>
|
|
164
|
+
<p>Modal content here</p>
|
|
165
|
+
</logosphere-modal>
|
|
166
|
+
\`,
|
|
167
|
+
styleUrls: ['./app.component.css']
|
|
168
|
+
})
|
|
169
|
+
export class AppComponent {
|
|
170
|
+
isModalOpen = false;
|
|
171
|
+
|
|
172
|
+
openModal() {
|
|
173
|
+
this.isModalOpen = true;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
closeModal() {
|
|
177
|
+
this.isModalOpen = false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Import CSS in your global styles:**
|
|
183
|
+
|
|
184
|
+
```css
|
|
185
|
+
/* src/styles.css */
|
|
186
|
+
@import 'logosphere-ui/css/scoped'; /* Recommended */
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Or add to angular.json:**
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"projects": {
|
|
194
|
+
"your-app": {
|
|
195
|
+
"architect": {
|
|
196
|
+
"build": {
|
|
197
|
+
"options": {
|
|
198
|
+
"styles": [
|
|
199
|
+
"node_modules/logosphere-ui/dist/logosphere-scoped.css",
|
|
200
|
+
"src/styles.css"
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Vue 3
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
// main.ts
|
|
214
|
+
import { createApp } from 'vue';
|
|
215
|
+
import LogosphereUI from 'logosphere-ui/vue';
|
|
216
|
+
// Import CSS: Choose scoped (recommended) or base
|
|
217
|
+
import 'logosphere-ui/css/scoped';
|
|
218
|
+
import App from './App.vue';
|
|
219
|
+
|
|
220
|
+
const app = createApp(App);
|
|
221
|
+
app.use(LogosphereUI);
|
|
222
|
+
app.mount('#app');
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
```vue
|
|
226
|
+
<!-- App.vue -->
|
|
227
|
+
<template>
|
|
228
|
+
<div>
|
|
229
|
+
<logosphere-button
|
|
230
|
+
variant="primary"
|
|
231
|
+
@click="openModal">
|
|
232
|
+
Open Modal
|
|
233
|
+
</logosphere-button>
|
|
234
|
+
|
|
235
|
+
<logosphere-modal
|
|
236
|
+
:open="isModalOpen"
|
|
237
|
+
@modal-close="closeModal">
|
|
238
|
+
<h2>Vue Modal</h2>
|
|
239
|
+
<logosphere-checkbox
|
|
240
|
+
label="Vue Checkbox"
|
|
241
|
+
v-model="checked"
|
|
242
|
+
@change="handleChange" />
|
|
243
|
+
</logosphere-modal>
|
|
244
|
+
</div>
|
|
245
|
+
</template>
|
|
246
|
+
|
|
247
|
+
<script setup lang="ts">
|
|
248
|
+
import { ref } from 'vue';
|
|
249
|
+
|
|
250
|
+
const isModalOpen = ref(false);
|
|
251
|
+
const checked = ref(false);
|
|
252
|
+
|
|
253
|
+
function openModal() {
|
|
254
|
+
isModalOpen.value = true;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function closeModal() {
|
|
258
|
+
isModalOpen.value = false;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function handleChange(event: CustomEvent) {
|
|
262
|
+
console.log('Checkbox changed:', event.detail.checked);
|
|
263
|
+
}
|
|
264
|
+
</script>
|
|
265
|
+
```
|
|
266
|
+
## 🔧 Framework Integration Paths
|
|
267
|
+
|
|
268
|
+
### Individual Component Imports (Tree-shaking friendly)
|
|
269
|
+
|
|
270
|
+
```javascript
|
|
271
|
+
// Vanilla JS
|
|
272
|
+
import 'logosphere-ui/button';
|
|
273
|
+
import 'logosphere-ui/modal';
|
|
274
|
+
|
|
275
|
+
// React
|
|
276
|
+
import { Button, Modal } from 'logosphere-ui/react';
|
|
277
|
+
|
|
278
|
+
// Angular (granular modules)
|
|
279
|
+
import { LogosphereButtonModule } from 'logosphere-ui/angular/button';
|
|
280
|
+
import { LogosphereModalModule } from 'logosphere-ui/angular/modal';
|
|
281
|
+
|
|
282
|
+
// Vue
|
|
283
|
+
import LogosphereUI from 'logosphere-ui/vue';
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Complete Import
|
|
287
|
+
|
|
288
|
+
```javascript
|
|
289
|
+
// Import all components (larger bundle)
|
|
290
|
+
import 'logosphere-ui';
|
|
291
|
+
|
|
292
|
+
// React - all components
|
|
293
|
+
import * as LogosphereReact from 'logosphere-ui/react';
|
|
294
|
+
|
|
295
|
+
// Vue - plugin with all components
|
|
296
|
+
import LogosphereUI from 'logosphere-ui/vue';
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## 🎨 Styling & Theming
|
|
300
|
+
|
|
301
|
+
The library uses Tailwind CSS with a custom design system. The CSS bundle includes:
|
|
302
|
+
|
|
303
|
+
- Base component styles
|
|
304
|
+
- Tailwind utilities
|
|
305
|
+
- Design tokens (colors, spacing, typography)
|
|
306
|
+
- Icon font (Unicons)
|
|
307
|
+
|
|
308
|
+
### Custom Themes
|
|
309
|
+
|
|
310
|
+
You can override CSS custom properties to create custom themes:
|
|
311
|
+
|
|
312
|
+
```css
|
|
313
|
+
:root {
|
|
314
|
+
--color-primary: #your-primary-color;
|
|
315
|
+
--color-secondary: #your-secondary-color;
|
|
316
|
+
/* ... other design tokens */
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
## 🛠️ DX Guide
|
|
320
|
+
|
|
321
|
+
### Quick Start: Adding a New Component
|
|
322
|
+
|
|
323
|
+
Use the fully automated component generator:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
npm run create-new-component [ComponentName]
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
This will automatically create and configure:
|
|
330
|
+
- ✅ Component files with proper structure
|
|
331
|
+
- ✅ TypeScript definitions and tests
|
|
332
|
+
- ✅ Storybook stories
|
|
333
|
+
- ✅ React wrapper in `src/frameworks/react/index.ts`
|
|
334
|
+
- ✅ Angular module in `src/frameworks/angular/[ComponentName].ts`
|
|
335
|
+
- ✅ Vue support in `src/frameworks/vue/index.ts`
|
|
336
|
+
- ✅ Build configuration updates (`vite.build.config.ts`)
|
|
337
|
+
- ✅ Package.json exports for component and Angular module
|
|
338
|
+
- ✅ Main index.ts export additions
|
|
339
|
+
|
|
340
|
+
### Manual Steps: Adding a New Component (Advanced)
|
|
341
|
+
|
|
342
|
+
> **💡 Tip:** Use `npm run create-new-component ComponentName` for automatic setup!
|
|
343
|
+
|
|
344
|
+
If you prefer manual setup or need to understand the process, follow these **12 detailed steps**:
|
|
345
|
+
|
|
346
|
+
**Overview:**
|
|
347
|
+
1. Create component files and structure
|
|
348
|
+
2. Implement the LitElement component
|
|
349
|
+
3. Export component properly
|
|
350
|
+
4. Update main index.ts export
|
|
351
|
+
5. Configure build system (Vite)
|
|
352
|
+
6. Add package.json exports
|
|
353
|
+
7. Create React wrapper
|
|
354
|
+
8. Create Angular module
|
|
355
|
+
9. Add Vue support
|
|
356
|
+
10. Update Angular build config
|
|
357
|
+
11. Update README documentation
|
|
358
|
+
12. Verification & testing
|
|
359
|
+
|
|
360
|
+
**Detailed Implementation:**
|
|
361
|
+
|
|
362
|
+
#### 1. **Create Component Structure**
|
|
363
|
+
```bash
|
|
364
|
+
src/
|
|
365
|
+
YourComponent/
|
|
366
|
+
├── index.ts # Export file
|
|
367
|
+
├── your-component.ts # Main component
|
|
368
|
+
├── your-component.stories.ts # Storybook stories
|
|
369
|
+
└── your-component.test.ts # Tests
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
#### 2. **Component Implementation**
|
|
373
|
+
```typescript
|
|
374
|
+
// src/YourComponent/your-component.ts
|
|
375
|
+
import { html, LitElement, css } from 'lit';
|
|
376
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
377
|
+
|
|
378
|
+
@customElement('logosphere-your-component')
|
|
379
|
+
export class YourComponent extends LitElement {
|
|
380
|
+
@property({ type: String }) variant: 'primary' | 'secondary' = 'primary';
|
|
381
|
+
|
|
382
|
+
static styles = css`
|
|
383
|
+
/* Component styles */
|
|
384
|
+
`;
|
|
385
|
+
|
|
386
|
+
render() {
|
|
387
|
+
return html`
|
|
388
|
+
<div class="your-component your-component--${this.variant}">
|
|
389
|
+
<slot></slot>
|
|
390
|
+
</div>
|
|
391
|
+
`;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
#### 3. **Export Component**
|
|
397
|
+
```typescript
|
|
398
|
+
// src/YourComponent/index.ts
|
|
399
|
+
export * from './your-component.js';
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
#### 4. **Update Main Index File**
|
|
403
|
+
```typescript
|
|
404
|
+
// src/index.ts
|
|
405
|
+
export * from './YourComponent/index.js';
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
#### 5. **Update Build Configuration**
|
|
409
|
+
```typescript
|
|
410
|
+
// vite.build.config.ts
|
|
411
|
+
const componentEntries: Record<string, string> = {
|
|
412
|
+
// ... existing components
|
|
413
|
+
yourcomponent: resolve(__dirname, 'src/YourComponent/index.ts'),
|
|
414
|
+
};
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### 6. **Update Package.json Exports**
|
|
418
|
+
```json
|
|
419
|
+
{
|
|
420
|
+
"exports": {
|
|
421
|
+
"./yourcomponent": {
|
|
422
|
+
"types": "./dist/yourcomponent.d.ts",
|
|
423
|
+
"import": "./dist/yourcomponent.js",
|
|
424
|
+
"require": "./dist/yourcomponent.cjs"
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
#### 7. **Add React Wrapper**
|
|
431
|
+
```typescript
|
|
432
|
+
// src/frameworks/react/index.ts
|
|
433
|
+
import { YourComponent as YourComponentWC } from '../../YourComponent/index.js';
|
|
434
|
+
|
|
435
|
+
export const YourComponent = createComponent({
|
|
436
|
+
tagName: 'logosphere-your-component',
|
|
437
|
+
elementClass: YourComponentWC,
|
|
438
|
+
react: React,
|
|
439
|
+
events: {
|
|
440
|
+
onChange: 'change'
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
#### 8. **Add Angular Module**
|
|
446
|
+
```typescript
|
|
447
|
+
// src/frameworks/angular/your-component.ts
|
|
448
|
+
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
449
|
+
import { CommonModule } from '@angular/common';
|
|
450
|
+
import '../../YourComponent/index.js';
|
|
451
|
+
|
|
452
|
+
@NgModule({
|
|
453
|
+
imports: [CommonModule],
|
|
454
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
455
|
+
declarations: [],
|
|
456
|
+
exports: []
|
|
457
|
+
})
|
|
458
|
+
export class LogosphereYourComponentModule {}
|
|
459
|
+
|
|
460
|
+
export { YourComponent } from '../../YourComponent/index.js';
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
#### 9. **Add Vue Support**
|
|
464
|
+
```typescript
|
|
465
|
+
// src/frameworks/vue/index.ts
|
|
466
|
+
// Import the component
|
|
467
|
+
import '../../YourComponent/index.js';
|
|
468
|
+
|
|
469
|
+
// Add to tag name exports
|
|
470
|
+
export const LogosphereYourComponent = 'logosphere-your-component';
|
|
471
|
+
|
|
472
|
+
// Add to useLogosphereComponents
|
|
473
|
+
export const useLogosphereComponents = () => {
|
|
474
|
+
return {
|
|
475
|
+
// ... existing components
|
|
476
|
+
LogosphereYourComponent
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### 10. **Update Build Configuration for Angular Export**
|
|
482
|
+
```typescript
|
|
483
|
+
// vite.build.config.ts
|
|
484
|
+
const componentEntries: Record<string, string> = {
|
|
485
|
+
// ... existing entries
|
|
486
|
+
'angular/your-component': resolve(__dirname, 'src/frameworks/angular/your-component.ts'),
|
|
487
|
+
};
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
```json
|
|
491
|
+
// package.json exports
|
|
492
|
+
{
|
|
493
|
+
"./angular/your-component": {
|
|
494
|
+
"types": "./dist/angular/your-component.d.ts",
|
|
495
|
+
"import": "./dist/angular/your-component.js",
|
|
496
|
+
"require": "./dist/angular/your-component.cjs"
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
#### 11. **Update README Documentation**
|
|
502
|
+
Add your component to the components table:
|
|
503
|
+
|
|
504
|
+
```markdown
|
|
505
|
+
| YourComponent | `logosphere-ui/yourcomponent` | Description of your component |
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
#### 12. **Verification & Testing**
|
|
509
|
+
After completing all manual steps, verify everything works:
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
# 1. Build the project
|
|
513
|
+
npm run build
|
|
514
|
+
|
|
515
|
+
# 2. Check for linting errors
|
|
516
|
+
npm run lint
|
|
517
|
+
|
|
518
|
+
# 3. Run tests
|
|
519
|
+
npm run test
|
|
520
|
+
|
|
521
|
+
# 4. Test version bump (optional)
|
|
522
|
+
npm run version:alpha
|
|
523
|
+
|
|
524
|
+
# 5. Check package contents
|
|
525
|
+
npm pack
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
**Verify files are created:**
|
|
529
|
+
- ✅ `dist/yourcomponent.js` and `dist/yourcomponent.cjs`
|
|
530
|
+
- ✅ `dist/yourcomponent.d.ts`
|
|
531
|
+
- ✅ `dist/angular/your-component.js` and `.d.ts`
|
|
532
|
+
- ✅ React wrapper exports `YourComponent`
|
|
533
|
+
- ✅ Vue plugin includes component
|
|
534
|
+
|
|
535
|
+
**Test the component:**
|
|
536
|
+
```bash
|
|
537
|
+
# Test imports work
|
|
538
|
+
node -e "console.log(require('./dist/yourcomponent.cjs'))"
|
|
539
|
+
node -e "import('./dist/yourcomponent.js').then(console.log)"
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### ⚠️ **Critical Requirements**
|
|
543
|
+
|
|
544
|
+
#### **Naming Conventions:**
|
|
545
|
+
- ✅ **Component tag**: `logosphere-{component-name}` (kebab-case)
|
|
546
|
+
- ✅ **Class name**: `{ComponentName}` (PascalCase)
|
|
547
|
+
- ✅ **File names**: `{component-name}.ts` (kebab-case)
|
|
548
|
+
- ✅ **Export paths**: `./componentname` (lowercase, no hyphens)
|
|
549
|
+
|
|
550
|
+
#### **TypeScript:**
|
|
551
|
+
- ✅ Always export types and interfaces
|
|
552
|
+
- ✅ Use proper JSDoc comments
|
|
553
|
+
- ✅ Ensure `@customElement` decorator is used
|
|
554
|
+
- ✅ All properties must use `@property` decorator
|
|
555
|
+
|
|
556
|
+
#### **Styling:**
|
|
557
|
+
- ✅ Use Tailwind CSS classes
|
|
558
|
+
- ✅ Follow design token system
|
|
559
|
+
- ✅ Test responsiveness
|
|
560
|
+
- ✅ Ensure accessibility (ARIA attributes)
|
|
561
|
+
|
|
562
|
+
#### **Testing:**
|
|
563
|
+
- ✅ Write unit tests for all public methods
|
|
564
|
+
- ✅ Test property changes
|
|
565
|
+
- ✅ Test event emissions
|
|
566
|
+
- ✅ Test accessibility features
|
|
567
|
+
|
|
568
|
+
#### **Events:**
|
|
569
|
+
- ✅ Use CustomEvent for component events
|
|
570
|
+
- ✅ Follow naming convention: `component-action` (e.g., `modal-close`)
|
|
571
|
+
- ✅ Include proper event detail data
|
|
572
|
+
|
|
573
|
+
#### **Build Verification:**
|
|
574
|
+
```bash
|
|
575
|
+
# After adding component, always run:
|
|
576
|
+
npm run build # Verify build works
|
|
577
|
+
npm run lint # Check for lint errors
|
|
578
|
+
npm run test # Run tests
|
|
579
|
+
npm pack # Test package contents
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### 📋 **Checklist for New Components**
|
|
583
|
+
|
|
584
|
+
- [ ] Component file created with proper naming
|
|
585
|
+
- [ ] `@customElement` decorator with correct tag name
|
|
586
|
+
- [ ] Export added to main index.ts
|
|
587
|
+
- [ ] Build config updated (vite.build.config.ts)
|
|
588
|
+
- [ ] Package.json exports updated
|
|
589
|
+
- [ ] React wrapper added
|
|
590
|
+
- [ ] Angular module created
|
|
591
|
+
- [ ] Vue support added
|
|
592
|
+
- [ ] Tests written and passing
|
|
593
|
+
- [ ] Stories created for Storybook
|
|
594
|
+
- [ ] README documentation updated
|
|
595
|
+
- [ ] Build verification completed
|
|
596
|
+
|
|
597
|
+
### 🔄 **Version Management & Publishing**
|
|
598
|
+
|
|
599
|
+
The library uses semantic versioning with intelligent prerelease handling:
|
|
600
|
+
|
|
601
|
+
#### **Pre-release Versions (Development/Testing)**
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
# Alpha releases (early development)
|
|
605
|
+
npm run publish:alpha
|
|
606
|
+
# Examples: 1.0.0 → 1.0.1-alpha.0 → 1.0.1-alpha.1
|
|
607
|
+
|
|
608
|
+
# Beta releases (feature complete, testing)
|
|
609
|
+
npm run publish:beta
|
|
610
|
+
# Examples: 1.0.0 → 1.0.1-beta.0 → 1.0.1-beta.1
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
#### **Stable Releases (Production)**
|
|
614
|
+
|
|
615
|
+
```bash
|
|
616
|
+
# Patch releases (bug fixes)
|
|
617
|
+
npm run publish:patch
|
|
618
|
+
# Examples: 1.0.0 → 1.0.1 or 1.0.1-alpha.2 → 1.0.1
|
|
619
|
+
|
|
620
|
+
# Minor releases (new features)
|
|
621
|
+
npm run publish:minor
|
|
622
|
+
# Examples: 1.0.0 → 1.1.0 or 1.0.1-beta.1 → 1.1.0
|
|
623
|
+
|
|
624
|
+
# Major releases (breaking changes)
|
|
625
|
+
npm run publish:major
|
|
626
|
+
# Examples: 1.0.0 → 2.0.0 or 1.5.3-alpha.1 → 2.0.0
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
#### **Versioning Logic**
|
|
630
|
+
|
|
631
|
+
**Alpha/Beta Rules:**
|
|
632
|
+
- If current version is alpha → increments alpha number
|
|
633
|
+
- If current version is beta → increments beta number
|
|
634
|
+
- If current version is stable → bumps patch and adds alpha.0/beta.0
|
|
635
|
+
|
|
636
|
+
**Stable Release Rules:**
|
|
637
|
+
- **Patch**: Increments patch number, removes prerelease
|
|
638
|
+
- **Minor**: Increments minor, resets patch to 0, removes prerelease
|
|
639
|
+
- **Major**: Increments major, resets minor and patch to 0, removes prerelease
|
|
640
|
+
|
|
641
|
+
| Current Version | Command | New Version | Description |
|
|
642
|
+
|---|---|---|---|
|
|
643
|
+
| `1.0.0` | `publish:alpha` | `1.0.1-alpha.0` | First alpha of next patch |
|
|
644
|
+
| `1.0.1-alpha.0` | `publish:alpha` | `1.0.1-alpha.1` | Increment alpha |
|
|
645
|
+
| `1.0.1-alpha.2` | `publish:beta` | `1.0.1-beta.0` | Switch to beta |
|
|
646
|
+
| `1.0.1-beta.0` | `publish:beta` | `1.0.1-beta.1` | Increment beta |
|
|
647
|
+
| `1.0.1-alpha.3` | `publish:patch` | `1.0.1` | Remove prerelease |
|
|
648
|
+
| `1.0.1-beta.2` | `publish:minor` | `1.1.0` | Minor bump, remove prerelease |
|
|
649
|
+
| `1.5.3-alpha.1` | `publish:major` | `2.0.0` | Major bump, remove prerelease |
|
|
650
|
+
|
|
651
|
+
#### **Installation Examples**
|
|
652
|
+
|
|
653
|
+
```bash
|
|
654
|
+
# Latest stable
|
|
655
|
+
npm install logosphere-ui
|
|
656
|
+
|
|
657
|
+
# Alpha version (latest)
|
|
658
|
+
npm install logosphere-ui@alpha
|
|
659
|
+
|
|
660
|
+
# Beta version (latest)
|
|
661
|
+
npm install logosphere-ui@beta
|
|
662
|
+
|
|
663
|
+
# Specific version
|
|
664
|
+
npm install logosphere-ui@1.2.3-alpha.1
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
#### **Testing Version Changes (No Git/Publish)**
|
|
668
|
+
|
|
669
|
+
```bash
|
|
670
|
+
# Test version bumps without git tags or publishing
|
|
671
|
+
npm run version:alpha # Test alpha version bump
|
|
672
|
+
npm run version:beta # Test beta version bump
|
|
673
|
+
npm run version:patch # Test patch version bump
|
|
674
|
+
npm run version:minor # Test minor version bump
|
|
675
|
+
npm run version:major # Test major version bump
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
#### **Release Workflow Examples**
|
|
679
|
+
|
|
680
|
+
**Feature Development:**
|
|
681
|
+
```bash
|
|
682
|
+
# 1. Create new component
|
|
683
|
+
npm run create-new-component NewFeature
|
|
684
|
+
|
|
685
|
+
# 2. Alpha testing
|
|
686
|
+
npm run publish:alpha
|
|
687
|
+
# → 1.0.0 → 1.0.1-alpha.0
|
|
688
|
+
|
|
689
|
+
# 3. More alpha iterations
|
|
690
|
+
npm run publish:alpha
|
|
691
|
+
# → 1.0.1-alpha.0 → 1.0.1-alpha.1
|
|
692
|
+
|
|
693
|
+
# 4. Beta testing
|
|
694
|
+
npm run publish:beta
|
|
695
|
+
# → 1.0.1-alpha.1 → 1.0.1-beta.0
|
|
696
|
+
|
|
697
|
+
# 5. Stable release
|
|
698
|
+
npm run publish:minor
|
|
699
|
+
# → 1.0.1-beta.0 → 1.1.0
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
**Bug Fix:**
|
|
703
|
+
```bash
|
|
704
|
+
# 1. Fix implemented
|
|
705
|
+
# 2. Alpha test
|
|
706
|
+
npm run publish:alpha
|
|
707
|
+
# → 1.1.0 → 1.1.1-alpha.0
|
|
708
|
+
|
|
709
|
+
# 3. Stable patch
|
|
710
|
+
npm run publish:patch
|
|
711
|
+
# → 1.1.1-alpha.0 → 1.1.1
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
### 🚨 **Common Issues & Troubleshooting**
|
|
715
|
+
|
|
716
|
+
#### **Build Errors:**
|
|
717
|
+
```bash
|
|
718
|
+
# Clear dist and rebuild
|
|
719
|
+
rm -rf dist/
|
|
720
|
+
npm run build
|
|
721
|
+
|
|
722
|
+
# Clear node_modules if needed
|
|
723
|
+
rm -rf node_modules package-lock.json
|
|
724
|
+
npm install
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
#### **TypeScript Errors:**
|
|
728
|
+
- ✅ Ensure all components use `@customElement` decorator
|
|
729
|
+
- ✅ Check import paths end with `.js` (not `.ts`)
|
|
730
|
+
- ✅ Verify `tsconfig.json` includes the component directory
|
|
731
|
+
- ✅ Run `npm run build:types` to check declaration generation
|
|
732
|
+
|
|
733
|
+
#### **React Wrapper Issues:**
|
|
734
|
+
- ✅ Component must be imported before creating wrapper
|
|
735
|
+
- ✅ Events must be mapped correctly in `createComponent`
|
|
736
|
+
- ✅ React peer dependencies must be installed
|
|
737
|
+
|
|
738
|
+
#### **Angular Module Issues:**
|
|
739
|
+
- ✅ Add `CUSTOM_ELEMENTS_SCHEMA` to module
|
|
740
|
+
- ✅ Import component before module definition
|
|
741
|
+
- ✅ Export both module and component class
|
|
742
|
+
|
|
743
|
+
#### **CSS/Styling Issues:**
|
|
744
|
+
- ✅ Ensure Tailwind CSS is imported: `import 'logosphere-ui/dist/logosphere-ui.css'`
|
|
745
|
+
- ✅ Check CSS bundle is built: `npm run build:css-bundle`
|
|
746
|
+
- ✅ Verify component styles use Tailwind classes
|
|
747
|
+
|
|
748
|
+
#### **Package Publication:**
|
|
749
|
+
```bash
|
|
750
|
+
# Check what will be published
|
|
751
|
+
npm pack
|
|
752
|
+
|
|
753
|
+
# Verify package.json exports
|
|
754
|
+
npm pkg fix
|
|
755
|
+
|
|
756
|
+
# Check build output
|
|
757
|
+
npm run build
|
|
758
|
+
ls -la dist/
|
|
759
|
+
```
|