@kubex/zinc 1.0.25 → 1.0.99
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/.claude/project.md +556 -0
- package/.github/workflows/js_build_and_deploy.yaml +9 -10
- package/dist/custom-elements.json +13575 -8856
- package/dist/vscode.html-custom-data.json +583 -48
- package/dist/web-types.json +1441 -181
- package/dist/zn.d.ts +1645 -660
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +1412 -893
- package/docs/_utilities/code-previews.cjs +10 -1
- package/docs/assets/scripts/docs.js +42 -18
- package/docs/data/data-table.json +229 -66
- package/docs/data/empty.json +6 -0
- package/docs/data/products-table.json +41 -193
- package/docs/pages/components/action-bar.md +121 -6
- package/docs/pages/components/alert.md +118 -15
- package/docs/pages/components/animated-button.md +299 -0
- package/docs/pages/components/audio-select.md +534 -0
- package/docs/pages/components/bulk-actions.md +79 -5
- package/docs/pages/components/button-group.md +235 -27
- package/docs/pages/components/button.md +139 -1
- package/docs/pages/components/chart.md +365 -9
- package/docs/pages/components/checkbox.md +387 -58
- package/docs/pages/components/chip.md +253 -33
- package/docs/pages/components/collapsible.md +393 -46
- package/docs/pages/components/cols.md +152 -30
- package/docs/pages/components/confirm.md +182 -16
- package/docs/pages/components/copy-button.md +169 -6
- package/docs/pages/components/data-select.md +194 -15
- package/docs/pages/components/data-table-filter.md +96 -5
- package/docs/pages/components/data-table-search.md +451 -0
- package/docs/pages/components/data-table-sort.md +66 -5
- package/docs/pages/components/data-table.md +727 -66
- package/docs/pages/components/datepicker.md +402 -7
- package/docs/pages/components/defined-label.md +120 -5
- package/docs/pages/components/dialog.md +339 -59
- package/docs/pages/components/dropdown.md +366 -11
- package/docs/pages/components/editor.md +604 -7
- package/docs/pages/components/empty-state.md +315 -16
- package/docs/pages/components/expanding-action.md +212 -28
- package/docs/pages/components/file.md +421 -12
- package/docs/pages/components/filter-container.md +158 -5
- package/docs/pages/components/filter-wrapper.md +167 -6
- package/docs/pages/components/form-group.md +383 -6
- package/docs/pages/components/hover-container.md +237 -6
- package/docs/pages/components/icon-picker.md +121 -0
- package/docs/pages/components/icon.md +454 -48
- package/docs/pages/components/inline-edit.md +787 -19
- package/docs/pages/components/input-group.md +207 -13
- package/docs/pages/components/input.md +194 -0
- package/docs/pages/components/item.md +18 -0
- package/docs/pages/components/key-container.md +115 -0
- package/docs/pages/components/key.md +101 -0
- package/docs/pages/components/menu.md +512 -6
- package/docs/pages/components/note.md +239 -36
- package/docs/pages/components/opt-group.md +107 -0
- package/docs/pages/components/pagination.md +332 -6
- package/docs/pages/components/pane.md +222 -6
- package/docs/pages/components/panel.md +213 -26
- package/docs/pages/components/popup.md +1354 -6
- package/docs/pages/components/priority-list.md +233 -0
- package/docs/pages/components/progress-bar.md +387 -6
- package/docs/pages/components/radio-group.md +242 -5
- package/docs/pages/components/radio.md +474 -6
- package/docs/pages/components/rating.md +331 -7
- package/docs/pages/components/reveal.md +524 -6
- package/docs/pages/components/scroll-container.md +552 -6
- package/docs/pages/components/select.md +762 -160
- package/docs/pages/components/skeleton.md +473 -30
- package/docs/pages/components/slideout.md +261 -5
- package/docs/pages/components/sp.md +99 -41
- package/docs/pages/components/split-button.md +347 -9
- package/docs/pages/components/split-pane.md +445 -6
- package/docs/pages/components/stat.md +549 -9
- package/docs/pages/components/status-indicator.md +230 -1
- package/docs/pages/components/stepper.md +563 -6
- package/docs/pages/components/tabs.md +439 -13
- package/docs/pages/components/textarea.md +415 -17
- package/docs/pages/components/tile.md +385 -26
- package/docs/pages/components/toggle.md +424 -6
- package/docs/pages/components/tooltip.md +367 -0
- package/docs/pages/components/translation-group.md +210 -0
- package/docs/pages/components/translations.md +319 -19
- package/docs/pages/components/vertical-stepper.md +401 -8
- package/docs/pages/components/well.md +300 -3
- package/docs/pages/getting-started/form-controls.md +162 -0
- package/docs/pages/index.md +116 -15
- package/package.json +5 -6
- package/scss/_global-spacing.scss +4 -0
- package/scss/_root.scss +2 -2
- package/scss/boot.scss +19 -0
- package/scss/shared/layout.scss +5 -0
- package/scss/themes/_light.scss +3 -3
- package/src/components/alert/alert.scss +1 -0
- package/src/components/animated-button/README.md +306 -0
- package/src/components/animated-button/animated-button.component.ts +229 -0
- package/src/components/animated-button/animated-button.scss +228 -0
- package/src/components/animated-button/animated-button.test.ts +143 -0
- package/src/components/animated-button/index.ts +12 -0
- package/src/components/button/button.component.ts +5 -0
- package/src/components/button-group/button-group.component.ts +25 -13
- package/src/components/button-group/button-group.scss +6 -0
- package/src/components/checkbox/checkbox.component.ts +4 -0
- package/src/components/checkbox/checkbox.scss +7 -4
- package/src/components/checkbox-group/checkbox-group.scss +7 -0
- package/src/components/chip/chip.component.ts +7 -2
- package/src/components/chip/chip.scss +16 -2
- package/src/components/collapsible/collapsible.component.ts +27 -20
- package/src/components/cols/cols.component.ts +14 -2
- package/src/components/cols/cols.scss +6 -12
- package/src/components/confirm/confirm.component.ts +7 -0
- package/src/components/copy-button/copy-button.component.ts +12 -11
- package/src/components/data-select/data-select.component.ts +215 -44
- package/src/components/data-select/data-select.scss +66 -6
- package/src/components/data-select/providers/currency-data-provider.ts +20 -6
- package/src/components/data-select/providers/provider.ts +1 -0
- package/src/components/data-select/providers/us-state-data-provider.ts +68 -0
- package/src/components/data-table/data-table.component.ts +81 -22
- package/src/components/data-table-search/data-table-search.component.ts +184 -0
- package/src/components/data-table-search/data-table-search.scss +17 -0
- package/src/components/data-table-search/data-table-search.test.ts +11 -0
- package/src/components/data-table-search/index.ts +12 -0
- package/src/components/datepicker/datepicker.component.ts +347 -13
- package/src/components/dialog/dialog.component.ts +1 -1
- package/src/components/empty-state/empty-state.scss +6 -1
- package/src/components/header/header.scss +3 -3
- package/src/components/icon/icon.component.ts +23 -1
- package/src/components/icon/icon.scss +23 -0
- package/src/components/icon-picker/brand-icons.ts +24 -0
- package/src/components/icon-picker/icon-picker.component.ts +407 -0
- package/src/components/icon-picker/icon-picker.scss +205 -0
- package/src/components/icon-picker/index.ts +12 -0
- package/src/components/icon-picker/line-icons.ts +612 -0
- package/src/components/icon-picker/material-icons.ts +14543 -0
- package/src/components/inline-edit/inline-edit.component.ts +190 -46
- package/src/components/inline-edit/inline-edit.scss +29 -0
- package/src/components/inline-edit/inline-edit.test.ts +314 -1
- package/src/components/input/input.component.ts +324 -5
- package/src/components/input/input.scss +87 -0
- package/src/components/input-group/input-group.component.ts +28 -7
- package/src/components/input-group/input-group.scss +48 -10
- package/src/components/item/item.component.ts +24 -3
- package/src/components/item/item.scss +18 -0
- package/src/components/key/index.ts +12 -0
- package/src/components/key/key.component.ts +47 -0
- package/src/components/key/key.scss +38 -0
- package/src/components/key-container/index.ts +12 -0
- package/src/components/key-container/key-container.component.ts +142 -0
- package/src/components/key-container/key-container.scss +33 -0
- package/src/components/menu-item/menu-item.component.ts +20 -0
- package/src/components/menu-item/menu-item.scss +69 -2
- package/src/components/navbar/navbar.component.ts +103 -11
- package/src/components/navbar/navbar.scss +6 -1
- package/src/components/opt-group/index.ts +12 -0
- package/src/components/opt-group/opt-group.component.ts +74 -0
- package/src/components/opt-group/opt-group.scss +37 -0
- package/src/components/opt-group/opt-group.test.ts +27 -0
- package/src/components/option/option.component.ts +1 -16
- package/src/components/option/option.scss +4 -0
- package/src/components/panel/panel.component.ts +10 -8
- package/src/components/panel/panel.scss +20 -0
- package/src/components/priority-list/index.ts +12 -0
- package/src/components/priority-list/priority-list.component.ts +611 -0
- package/src/components/priority-list/priority-list.scss +185 -0
- package/src/components/priority-list/priority-list.test.ts +139 -0
- package/src/components/progress-bar/progress-bar.component.ts +22 -16
- package/src/components/radio/radio.scss +10 -3
- package/src/components/select/select.component.ts +812 -72
- package/src/components/select/select.scss +108 -2
- package/src/components/select/select.test.ts +147 -2
- package/src/components/settings-container/settings-container.component.ts +44 -19
- package/src/components/settings-container/settings-container.scss +1 -1
- package/src/components/skeleton/skeleton.component.ts +6 -1
- package/src/components/slideout/slideout.scss +8 -3
- package/src/components/sp/sp.component.ts +3 -1
- package/src/components/sp/sp.scss +19 -0
- package/src/components/stepper/stepper.component.ts +16 -10
- package/src/components/textarea/textarea.scss +0 -4
- package/src/components/tile/tile.component.ts +12 -3
- package/src/components/tile/tile.scss +1 -1
- package/src/components/timer/timer.component.ts +15 -2
- package/src/components/toggle/toggle.component.ts +29 -26
- package/src/components/toggle/toggle.scss +13 -1
- package/src/components/translation-group/index.ts +12 -0
- package/src/components/translation-group/translation-group.component.ts +207 -0
- package/src/components/translation-group/translation-group.scss +8 -0
- package/src/components/translations/translations.component.ts +90 -44
- package/src/components/translations/translations.scss +4 -0
- package/src/components/vertical-stepper/vertical-stepper.component.ts +14 -9
- package/src/events/events.ts +12 -7
- package/src/events/zn-language-change.ts +7 -0
- package/src/events/zn-purchase.ts +11 -0
- package/src/events/zn-redirect.ts +7 -0
- package/src/events/zn-reorder.ts +7 -0
- package/src/events/zn-search-change.ts +11 -0
- package/src/events/zn-submit.ts +1 -1
- package/src/form-control.scss +4 -0
- package/src/internal/form-navigation.ts +510 -0
- package/src/internal/form.ts +6 -0
- package/src/zinc.ts +91 -83
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
# Zinc - Web Component UI Framework
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
Zinc is a comprehensive web component library built on Lit that provides 93+ pre-built, accessible, and themeable UI components for modern web applications. It's designed to accelerate development by providing production-ready components that follow web standards.
|
|
6
|
+
|
|
7
|
+
**Language:** TypeScript 5.3.3
|
|
8
|
+
**Framework:** Lit 2.7.6 (Web Components)
|
|
9
|
+
**Foundation:** Based on Shoelace components
|
|
10
|
+
**Current Version:** 1.0.45
|
|
11
|
+
**Documentation:** https://zinc.style
|
|
12
|
+
|
|
13
|
+
## Role in the Platform
|
|
14
|
+
|
|
15
|
+
Zinc is the **UI component library** of the Kubex platform:
|
|
16
|
+
|
|
17
|
+
- **Rubix Integration:** Rubix uses zinc-go (Go version) for backend rendering and the Zinc web components for frontend
|
|
18
|
+
- **Standalone Usage:** Can be used independently in any web application
|
|
19
|
+
- **Component Prefix:** All components use the `zn-` prefix (e.g., `<zn-button>`, `<zn-input>`)
|
|
20
|
+
- **Documentation Site:** https://zinc.style provides comprehensive component documentation
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Application HTML → Zinc Components → Web Components API → Browser
|
|
24
|
+
↓
|
|
25
|
+
zinc-go (Server-side rendering)
|
|
26
|
+
↓
|
|
27
|
+
Rubix Console (Integration)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Architecture
|
|
31
|
+
|
|
32
|
+
### Core Architecture Pattern
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
┌─────────────────────────────────────────┐
|
|
36
|
+
│ Application Layer │
|
|
37
|
+
│ (HTML with <zn-*> custom elements) │
|
|
38
|
+
└────────────────┬────────────────────────┘
|
|
39
|
+
│
|
|
40
|
+
┌────────────────▼────────────────────────┐
|
|
41
|
+
│ Zinc Autoloader (Discovery) │
|
|
42
|
+
│ - Watches DOM for undefined elements │
|
|
43
|
+
│ - Lazy-loads components on demand │
|
|
44
|
+
└────────────────┬────────────────────────┘
|
|
45
|
+
│
|
|
46
|
+
┌────────────────▼────────────────────────┐
|
|
47
|
+
│ Component Layer (93+) │
|
|
48
|
+
│ - Button, Input, DataTable, etc. │
|
|
49
|
+
│ - All extend ZincElement │
|
|
50
|
+
└────────────────┬────────────────────────┘
|
|
51
|
+
│
|
|
52
|
+
┌────────────────▼────────────────────────┐
|
|
53
|
+
│ ZincElement (Base Class) │
|
|
54
|
+
│ - Extends LitElement │
|
|
55
|
+
│ - Theme Controller │
|
|
56
|
+
│ - Custom event system │
|
|
57
|
+
│ - Form integration │
|
|
58
|
+
└────────────────┬────────────────────────┘
|
|
59
|
+
│
|
|
60
|
+
┌────────────────▼────────────────────────┐
|
|
61
|
+
│ Internal Services & Utilities │
|
|
62
|
+
│ - Form validation │
|
|
63
|
+
│ - Slot detection │
|
|
64
|
+
│ - Event system │
|
|
65
|
+
│ - Animation registry │
|
|
66
|
+
└─────────────────────────────────────────┘
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Key Directories
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
/zinc
|
|
73
|
+
├── src/
|
|
74
|
+
│ ├── zinc.ts # Main entry point (exports all 93+ components)
|
|
75
|
+
│ ├── zinc-autoloader.ts # Auto-discovery and lazy-loading system
|
|
76
|
+
│ ├── components/ # 93+ Web Components
|
|
77
|
+
│ │ ├── button/
|
|
78
|
+
│ │ │ ├── button.component.ts # Component logic
|
|
79
|
+
│ │ │ ├── button.scss # Component styles
|
|
80
|
+
│ │ │ ├── button.test.ts # Component tests
|
|
81
|
+
│ │ │ └── index.ts # Exports
|
|
82
|
+
│ │ ├── data-table/ # Complex table component
|
|
83
|
+
│ │ ├── input/ # Form input component
|
|
84
|
+
│ │ ├── select/ # Dropdown select
|
|
85
|
+
│ │ ├── dialog/ # Modal dialogs
|
|
86
|
+
│ │ ├── editor/ # Rich text editor (Quill)
|
|
87
|
+
│ │ ├── chart/ # Charts (ApexCharts)
|
|
88
|
+
│ │ └── ... (85+ more)
|
|
89
|
+
│ ├── internal/ # Core infrastructure
|
|
90
|
+
│ │ ├── zinc-element.ts # Base class for all components
|
|
91
|
+
│ │ ├── form.ts # Form control integration
|
|
92
|
+
│ │ ├── event.ts # Type-safe event system
|
|
93
|
+
│ │ ├── animate.ts # Animation utilities
|
|
94
|
+
│ │ ├── slot.ts # Slot detection controller
|
|
95
|
+
│ │ └── watch.ts # Property watchers
|
|
96
|
+
│ ├── events/ # Event definitions (38+ event types)
|
|
97
|
+
│ │ ├── events.ts # Barrel file
|
|
98
|
+
│ │ ├── zn-change.ts
|
|
99
|
+
│ │ ├── zn-input.ts
|
|
100
|
+
│ │ └── ... (one per event type)
|
|
101
|
+
│ ├── utilities/ # Helper functions
|
|
102
|
+
│ │ ├── on.ts # Event listeners
|
|
103
|
+
│ │ ├── query.ts # DOM querying
|
|
104
|
+
│ │ ├── base-path.ts # Asset resolution
|
|
105
|
+
│ │ └── localize.ts # i18n
|
|
106
|
+
│ └── translations/ # i18n data
|
|
107
|
+
├── scss/ # Global styles and themes
|
|
108
|
+
│ ├── themes/
|
|
109
|
+
│ │ ├── _light.scss # Light theme variables
|
|
110
|
+
│ │ └── _dark.scss # Dark theme variables
|
|
111
|
+
│ ├── shared/ # Global styles
|
|
112
|
+
│ │ ├── _base.scss
|
|
113
|
+
│ │ ├── _reset.scss
|
|
114
|
+
│ │ └── _form-elements.scss
|
|
115
|
+
│ ├── variables/ # Design tokens
|
|
116
|
+
│ ├── mixins/ # SCSS mixins
|
|
117
|
+
│ └── boot.scss # Bootstrap stylesheet
|
|
118
|
+
├── docs/ # 11ty-powered documentation site
|
|
119
|
+
│ ├── pages/
|
|
120
|
+
│ │ ├── index.md # Homepage
|
|
121
|
+
│ │ ├── getting-started/ # Installation guides
|
|
122
|
+
│ │ └── components/ # Component docs (85+ pages)
|
|
123
|
+
│ ├── _includes/ # Nunjucks templates
|
|
124
|
+
│ │ ├── component.njk # Component doc template
|
|
125
|
+
│ │ └── default.njk # Default layout
|
|
126
|
+
│ ├── _utilities/ # Build utilities
|
|
127
|
+
│ │ ├── markdown.cjs # Custom markdown renderer
|
|
128
|
+
│ │ └── code-previews.cjs # Live code preview system
|
|
129
|
+
│ ├── eleventy.config.cjs # 11ty configuration
|
|
130
|
+
│ └── assets/ # Static assets
|
|
131
|
+
├── dist/ # Built outputs
|
|
132
|
+
│ ├── zinc.js # Main ES module
|
|
133
|
+
│ ├── zinc.min.js # Minified version
|
|
134
|
+
│ ├── custom-elements.json # Component metadata
|
|
135
|
+
│ └── web-types.json # IDE support
|
|
136
|
+
├── scripts/
|
|
137
|
+
│ └── build.js # Custom esbuild pipeline
|
|
138
|
+
├── package.json # Project metadata (v1.0.45)
|
|
139
|
+
├── tsconfig.json # TypeScript config
|
|
140
|
+
└── custom-elements-manifest.config.js # Metadata generation
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Key Technologies
|
|
144
|
+
|
|
145
|
+
### Core Dependencies
|
|
146
|
+
- **lit** (2.7.6) - Reactive web components library
|
|
147
|
+
- **@lit-labs/observers** - Observe changes in templates
|
|
148
|
+
- **@lit/task** - Task management for async operations
|
|
149
|
+
- **@floating-ui/dom** - Positioning for dropdowns, tooltips
|
|
150
|
+
- **@shoelace-style/localize** - Internationalization
|
|
151
|
+
|
|
152
|
+
### Advanced Components
|
|
153
|
+
- **apexcharts** (4.5.0) - Charting library
|
|
154
|
+
- **chart.js** (4.4.8) - Alternative charting
|
|
155
|
+
- **quill** (2.0.3) - Rich text editor
|
|
156
|
+
- **emoji-mart** - Emoji picker
|
|
157
|
+
- **air-datepicker** (3.5.3) - Date picker
|
|
158
|
+
|
|
159
|
+
### Build Tools
|
|
160
|
+
- **esbuild** (0.25.0) - Fast JavaScript bundler
|
|
161
|
+
- **sass** (1.85.1) - CSS preprocessor
|
|
162
|
+
- **typescript** (5.3.3) - Type checking
|
|
163
|
+
- **@11ty/eleventy** - Documentation site generator
|
|
164
|
+
- **@web/test-runner** - Component testing
|
|
165
|
+
|
|
166
|
+
## Component Categories (93+ Total)
|
|
167
|
+
|
|
168
|
+
### Form Components (15+)
|
|
169
|
+
Input, Textarea, Select, Checkbox, Radio, Toggle, Datepicker, File, Rating, ColorPicker, Range, etc.
|
|
170
|
+
|
|
171
|
+
### Data Display (10+)
|
|
172
|
+
DataTable, Chart, SimpleChart, Stat, ProgressBar, ProgressTile, Skeleton, Timeline, etc.
|
|
173
|
+
|
|
174
|
+
### Navigation (8+)
|
|
175
|
+
Button, ButtonGroup, Navbar, Sidebar, Tabs, Pagination, Stepper, VerticalStepper
|
|
176
|
+
|
|
177
|
+
### Dialogs & Overlays (8+)
|
|
178
|
+
Dialog, Popup, Tooltip, Dropdown, Slideout, Confirm, Alert, Drawer
|
|
179
|
+
|
|
180
|
+
### Layout (8+)
|
|
181
|
+
Cols, Pane, SplitPane, ScrollContainer, AbsoluteContainer, HoverContainer, FlexContainer
|
|
182
|
+
|
|
183
|
+
### Content (8+)
|
|
184
|
+
Tile, TileProperty, Note, EmptyState, Header, ContentBlock, Card, Well
|
|
185
|
+
|
|
186
|
+
### Tables & Advanced (5+)
|
|
187
|
+
OrderTable, DataTableFilter, DataTableSort, BulkActions, QueryBuilder
|
|
188
|
+
|
|
189
|
+
### Utilities (15+)
|
|
190
|
+
Icon, Key, Chip, Badge, Avatar, Spinner, Divider, Menu, MenuItem, etc.
|
|
191
|
+
|
|
192
|
+
## Component Anatomy
|
|
193
|
+
|
|
194
|
+
### Standard Component Structure
|
|
195
|
+
```typescript
|
|
196
|
+
// Example: src/components/button/button.component.ts
|
|
197
|
+
import { html, unsafeCSS } from 'lit';
|
|
198
|
+
import { property, query } from 'lit/decorators.js';
|
|
199
|
+
import ZincElement from '../../internal/zinc-element';
|
|
200
|
+
import styles from './button.scss';
|
|
201
|
+
|
|
202
|
+
export default class ZnButton extends ZincElement {
|
|
203
|
+
static styles = unsafeCSS(styles);
|
|
204
|
+
static dependencies = { 'zn-icon': ZnIcon };
|
|
205
|
+
|
|
206
|
+
@property() color: 'default' | 'primary' | 'error' = 'default';
|
|
207
|
+
@property({type: Boolean}) disabled = false;
|
|
208
|
+
@query('.button') button: HTMLButtonElement;
|
|
209
|
+
|
|
210
|
+
protected render() {
|
|
211
|
+
return html`<button part="base" ...>...</button>`;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Custom event emission with type safety
|
|
215
|
+
handleClick() {
|
|
216
|
+
this.emit('zn-click', { detail: { ... } });
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Auto-register component
|
|
221
|
+
ZnButton.define('zn-button');
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Component Features
|
|
225
|
+
- **Shadow DOM:** Encapsulated styles
|
|
226
|
+
- **CSS Parts:** Exposed for external styling
|
|
227
|
+
- **Slots:** Flexible content projection
|
|
228
|
+
- **Events:** Type-safe custom events
|
|
229
|
+
- **Form Integration:** Native HTML form support
|
|
230
|
+
- **Accessibility:** ARIA attributes and keyboard navigation
|
|
231
|
+
- **Theming:** CSS custom properties
|
|
232
|
+
|
|
233
|
+
## Auto-Discovery System
|
|
234
|
+
|
|
235
|
+
### Lazy Loading
|
|
236
|
+
```typescript
|
|
237
|
+
// zinc-autoloader.ts provides dynamic component discovery
|
|
238
|
+
export async function discover(root: Element | ShadowRoot) {
|
|
239
|
+
// Find all undefined <zn-*> elements
|
|
240
|
+
const tags = [...root.querySelectorAll(':not(:defined)')]
|
|
241
|
+
.map(el => el.tagName.toLowerCase())
|
|
242
|
+
.filter(tag => tag.startsWith('zn-'));
|
|
243
|
+
|
|
244
|
+
// Auto-import and register them
|
|
245
|
+
await Promise.allSettled(tagsToRegister.map(tagName => register(tagName)));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Watches for new elements added to DOM
|
|
249
|
+
observer.observe(document.documentElement, {subtree: true, childList: true});
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Benefits:**
|
|
253
|
+
- Components lazy-loaded only when used
|
|
254
|
+
- Reduces initial bundle size
|
|
255
|
+
- Works with dynamic HTML injection
|
|
256
|
+
- No manual component imports needed
|
|
257
|
+
|
|
258
|
+
## Form Integration
|
|
259
|
+
|
|
260
|
+
### FormControlController
|
|
261
|
+
Provides standardized form integration:
|
|
262
|
+
- Native HTML `<form>` element integration
|
|
263
|
+
- Constraint validation API
|
|
264
|
+
- User interaction tracking for validation state
|
|
265
|
+
- Form attributes: `name`, `value`, `disabled`, `required`, etc.
|
|
266
|
+
|
|
267
|
+
### Example Form Component
|
|
268
|
+
```html
|
|
269
|
+
<form id="myForm">
|
|
270
|
+
<zn-input name="username" label="Username" required></zn-input>
|
|
271
|
+
<zn-input name="email" type="email" label="Email" required></zn-input>
|
|
272
|
+
<zn-button type="submit">Submit</zn-button>
|
|
273
|
+
</form>
|
|
274
|
+
|
|
275
|
+
<script>
|
|
276
|
+
document.getElementById('myForm').addEventListener('submit', (e) => {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
const formData = new FormData(e.target);
|
|
279
|
+
console.log(Object.fromEntries(formData));
|
|
280
|
+
});
|
|
281
|
+
</script>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Theming System
|
|
285
|
+
|
|
286
|
+
### CSS Custom Properties
|
|
287
|
+
Light and dark themes controlled via CSS variables:
|
|
288
|
+
|
|
289
|
+
```scss
|
|
290
|
+
// Light theme (_light.scss)
|
|
291
|
+
:root {
|
|
292
|
+
--color-primary: #0066cc;
|
|
293
|
+
--color-background: #ffffff;
|
|
294
|
+
--spacing-m: 1rem;
|
|
295
|
+
--border-radius: 4px;
|
|
296
|
+
// ... 100+ design tokens
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Dark theme (_dark.scss)
|
|
300
|
+
:root[data-theme="dark"] {
|
|
301
|
+
--color-primary: #4da6ff;
|
|
302
|
+
--color-background: #1a1a1a;
|
|
303
|
+
// ... dark variants
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Theme Variables
|
|
308
|
+
- **Colors:** Primary, secondary, success, warning, error, info
|
|
309
|
+
- **Spacing:** xs, s, m, l, xl
|
|
310
|
+
- **Typography:** Font families, sizes, weights
|
|
311
|
+
- **Borders:** Widths, radius
|
|
312
|
+
- **Shadows:** Elevation levels
|
|
313
|
+
|
|
314
|
+
## Documentation Site (https://zinc.style)
|
|
315
|
+
|
|
316
|
+
### Technology Stack
|
|
317
|
+
- **11ty (Eleventy)** - Static site generator
|
|
318
|
+
- **Nunjucks** - Templating language
|
|
319
|
+
- **Lunr** - Client-side search
|
|
320
|
+
- **PrismJS** - Syntax highlighting
|
|
321
|
+
- **Custom Markdown** - Extended markdown for live previews
|
|
322
|
+
|
|
323
|
+
### Key Features
|
|
324
|
+
1. **Live Component Previews** - Markdown syntax for interactive demos
|
|
325
|
+
2. **Component Documentation** - One page per component
|
|
326
|
+
3. **Auto-generated Metadata** - Props/slots/events from source
|
|
327
|
+
4. **Searchable** - Full-text search via Lunr
|
|
328
|
+
5. **Responsive Design** - Mobile-first
|
|
329
|
+
6. **Theme Switching** - Dark/light mode
|
|
330
|
+
|
|
331
|
+
### Documentation Build
|
|
332
|
+
```bash
|
|
333
|
+
cd docs
|
|
334
|
+
npm install
|
|
335
|
+
npm run build # Builds to _site/
|
|
336
|
+
npm run serve # Development server
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Development
|
|
340
|
+
|
|
341
|
+
### Running Locally
|
|
342
|
+
```bash
|
|
343
|
+
# Install dependencies
|
|
344
|
+
npm install
|
|
345
|
+
|
|
346
|
+
# Build components
|
|
347
|
+
npm run build
|
|
348
|
+
|
|
349
|
+
# Watch mode (rebuild on changes)
|
|
350
|
+
npm run watch
|
|
351
|
+
|
|
352
|
+
# Run tests
|
|
353
|
+
npm run test
|
|
354
|
+
|
|
355
|
+
# Lint code
|
|
356
|
+
npm run lint
|
|
357
|
+
|
|
358
|
+
# Build documentation
|
|
359
|
+
cd docs && npm run build
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Creating a New Component
|
|
363
|
+
|
|
364
|
+
1. **Create component directory:**
|
|
365
|
+
```bash
|
|
366
|
+
mkdir src/components/my-component
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
2. **Create component files:**
|
|
370
|
+
```
|
|
371
|
+
my-component/
|
|
372
|
+
├── my-component.component.ts # Component logic
|
|
373
|
+
├── my-component.scss # Component styles
|
|
374
|
+
├── my-component.test.ts # Tests
|
|
375
|
+
└── index.ts # Exports
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
3. **Implement component:**
|
|
379
|
+
```typescript
|
|
380
|
+
import { html, unsafeCSS } from 'lit';
|
|
381
|
+
import { property } from 'lit/decorators.js';
|
|
382
|
+
import ZincElement from '../../internal/zinc-element';
|
|
383
|
+
import styles from './my-component.scss';
|
|
384
|
+
|
|
385
|
+
export default class ZnMyComponent extends ZincElement {
|
|
386
|
+
static styles = unsafeCSS(styles);
|
|
387
|
+
|
|
388
|
+
@property() label = '';
|
|
389
|
+
|
|
390
|
+
render() {
|
|
391
|
+
return html`<div part="base">${this.label}</div>`;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
ZnMyComponent.define('zn-my-component');
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
4. **Export from zinc.ts:**
|
|
399
|
+
```typescript
|
|
400
|
+
export { default as ZnMyComponent } from './components/my-component';
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
5. **Create documentation:**
|
|
404
|
+
```markdown
|
|
405
|
+
<!-- docs/pages/components/my-component.md -->
|
|
406
|
+
---
|
|
407
|
+
title: My Component
|
|
408
|
+
description: Component description
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
# My Component
|
|
412
|
+
|
|
413
|
+
Usage examples...
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
## Build Process
|
|
417
|
+
|
|
418
|
+
### Custom Build Pipeline (`scripts/build.js`)
|
|
419
|
+
1. Clean previous builds
|
|
420
|
+
2. Compile SCSS to CSS (PostCSS/autoprefixer)
|
|
421
|
+
3. Bundle TypeScript (esbuild)
|
|
422
|
+
4. Generate custom-elements-manifest
|
|
423
|
+
5. Minify outputs
|
|
424
|
+
6. Build documentation (11ty)
|
|
425
|
+
|
|
426
|
+
### Distribution Outputs
|
|
427
|
+
- `dist/zinc.js` - ES module export
|
|
428
|
+
- `dist/zinc.min.js` - Minified version
|
|
429
|
+
- `dist/custom-elements.json` - Component metadata
|
|
430
|
+
- `dist/web-types.json` - IDE support
|
|
431
|
+
- `docs/_site/` - Static documentation site
|
|
432
|
+
|
|
433
|
+
## Usage in Applications
|
|
434
|
+
|
|
435
|
+
### Installation
|
|
436
|
+
```bash
|
|
437
|
+
npm install @kubex/zinc
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Import All Components
|
|
441
|
+
```javascript
|
|
442
|
+
import '@kubex/zinc/dist/zinc.js';
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Import Specific Components
|
|
446
|
+
```javascript
|
|
447
|
+
import '@kubex/zinc/dist/components/button/button.js';
|
|
448
|
+
import '@kubex/zinc/dist/components/input/input.js';
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Use Auto-loader
|
|
452
|
+
```javascript
|
|
453
|
+
import '@kubex/zinc/dist/zinc-autoloader.js';
|
|
454
|
+
// Components auto-load when used in HTML
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### HTML Usage
|
|
458
|
+
```html
|
|
459
|
+
<!DOCTYPE html>
|
|
460
|
+
<html>
|
|
461
|
+
<head>
|
|
462
|
+
<link rel="stylesheet" href="node_modules/@kubex/zinc/dist/themes/light.css">
|
|
463
|
+
<script type="module" src="node_modules/@kubex/zinc/dist/zinc-autoloader.js"></script>
|
|
464
|
+
</head>
|
|
465
|
+
<body>
|
|
466
|
+
<zn-button color="primary">Click Me</zn-button>
|
|
467
|
+
<zn-input label="Username" required></zn-input>
|
|
468
|
+
<zn-data-table id="myTable"></zn-data-table>
|
|
469
|
+
|
|
470
|
+
<script>
|
|
471
|
+
const table = document.getElementById('myTable');
|
|
472
|
+
table.data = [
|
|
473
|
+
{ name: 'John', age: 30 },
|
|
474
|
+
{ name: 'Jane', age: 25 }
|
|
475
|
+
];
|
|
476
|
+
</script>
|
|
477
|
+
</body>
|
|
478
|
+
</html>
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
## Integration Points
|
|
482
|
+
|
|
483
|
+
### With Rubix
|
|
484
|
+
- **zinc-go:** Go version of Zinc for backend rendering
|
|
485
|
+
- **Static Console:** Rubix console uses Zinc web components
|
|
486
|
+
- **Component Library:** Shared component library across platform
|
|
487
|
+
|
|
488
|
+
### Standalone Usage
|
|
489
|
+
- Can be used in any web application
|
|
490
|
+
- Framework-agnostic (works with React, Vue, Angular, vanilla JS)
|
|
491
|
+
- Progressive enhancement (works without JavaScript for basic functionality)
|
|
492
|
+
|
|
493
|
+
## Testing
|
|
494
|
+
|
|
495
|
+
### Component Tests
|
|
496
|
+
```bash
|
|
497
|
+
npm run test
|
|
498
|
+
npm run test:watch # Watch mode
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### Testing Framework
|
|
502
|
+
- **@web/test-runner** - Test runner
|
|
503
|
+
- **Playwright** - Browser automation
|
|
504
|
+
- **Chai** - Assertions
|
|
505
|
+
|
|
506
|
+
### Example Test
|
|
507
|
+
```typescript
|
|
508
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
509
|
+
import type ZnButton from './button.component';
|
|
510
|
+
|
|
511
|
+
describe('ZnButton', () => {
|
|
512
|
+
it('renders with default properties', async () => {
|
|
513
|
+
const el = await fixture<ZnButton>(html`<zn-button>Click</zn-button>`);
|
|
514
|
+
expect(el.color).to.equal('default');
|
|
515
|
+
expect(el.disabled).to.be.false;
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
it('emits click event', async () => {
|
|
519
|
+
const el = await fixture<ZnButton>(html`<zn-button>Click</zn-button>`);
|
|
520
|
+
let clicked = false;
|
|
521
|
+
el.addEventListener('zn-click', () => clicked = true);
|
|
522
|
+
el.click();
|
|
523
|
+
expect(clicked).to.be.true;
|
|
524
|
+
});
|
|
525
|
+
});
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
## Performance Considerations
|
|
529
|
+
|
|
530
|
+
- **Lazy Loading:** Components load on demand via autoloader
|
|
531
|
+
- **Tree Shaking:** Import only components you use
|
|
532
|
+
- **Shadow DOM:** Encapsulated styles prevent global pollution
|
|
533
|
+
- **Virtual Scrolling:** DataTable uses virtual scrolling for large datasets
|
|
534
|
+
- **Debouncing:** Input components debounce events
|
|
535
|
+
- **Memoization:** Expensive computations cached
|
|
536
|
+
|
|
537
|
+
## Accessibility
|
|
538
|
+
|
|
539
|
+
- **ARIA Labels:** All components have proper ARIA attributes
|
|
540
|
+
- **Keyboard Navigation:** Full keyboard support
|
|
541
|
+
- **Focus Management:** Proper focus indicators and trap
|
|
542
|
+
- **Screen Reader Support:** Semantic HTML and ARIA
|
|
543
|
+
- **ESLint Rules:** lit-a11y plugin enforces accessibility
|
|
544
|
+
|
|
545
|
+
## Related Repositories
|
|
546
|
+
|
|
547
|
+
- **rubix** - Uses Zinc for frontend console interface
|
|
548
|
+
- **zinc-go** - Go version of Zinc for backend rendering
|
|
549
|
+
- **zinc-php** - PHP version of Zinc for backend rendering
|
|
550
|
+
|
|
551
|
+
## Resources
|
|
552
|
+
|
|
553
|
+
- **Documentation:** https://zinc.style
|
|
554
|
+
- **Component API:** See custom-elements.json in dist/
|
|
555
|
+
- **Examples:** See docs/pages/components/ for live examples
|
|
556
|
+
- **Contributing:** Follow TypeScript strict mode and ESLint rules
|
|
@@ -11,12 +11,12 @@ jobs:
|
|
|
11
11
|
- uses: actions/checkout@v3 # Check out the repository
|
|
12
12
|
|
|
13
13
|
- name: Setup Node
|
|
14
|
-
uses: actions/setup-node@
|
|
14
|
+
uses: actions/setup-node@v6
|
|
15
15
|
with:
|
|
16
|
-
node-version: '
|
|
16
|
+
node-version: '24'
|
|
17
17
|
|
|
18
18
|
- name: Cache npm
|
|
19
|
-
uses: actions/cache@
|
|
19
|
+
uses: actions/cache@v5
|
|
20
20
|
with:
|
|
21
21
|
path: ~/.npm
|
|
22
22
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
|
@@ -26,7 +26,7 @@ jobs:
|
|
|
26
26
|
- run: npm run build # Build the site
|
|
27
27
|
|
|
28
28
|
# Store the dist folder
|
|
29
|
-
- uses: actions/upload-artifact@
|
|
29
|
+
- uses: actions/upload-artifact@v7
|
|
30
30
|
with:
|
|
31
31
|
name: app-build
|
|
32
32
|
path: dist
|
|
@@ -36,9 +36,10 @@ jobs:
|
|
|
36
36
|
runs-on: ubuntu-latest
|
|
37
37
|
permissions:
|
|
38
38
|
contents: write
|
|
39
|
+
id-token: write # Required for OIDC
|
|
39
40
|
steps:
|
|
40
41
|
- name: Checkout code
|
|
41
|
-
uses: actions/checkout@
|
|
42
|
+
uses: actions/checkout@v6
|
|
42
43
|
with:
|
|
43
44
|
fetch-depth: 0
|
|
44
45
|
|
|
@@ -47,9 +48,9 @@ jobs:
|
|
|
47
48
|
uses: justincy/github-action-npm-release@2.0.2
|
|
48
49
|
|
|
49
50
|
# Setup .npmrc file to publish to npm
|
|
50
|
-
- uses: actions/setup-node@
|
|
51
|
+
- uses: actions/setup-node@v6
|
|
51
52
|
with:
|
|
52
|
-
node-version: '
|
|
53
|
+
node-version: '24'
|
|
53
54
|
registry-url: 'https://registry.npmjs.org'
|
|
54
55
|
|
|
55
56
|
# Get the dist folder
|
|
@@ -59,7 +60,5 @@ jobs:
|
|
|
59
60
|
name: app-build
|
|
60
61
|
path: dist
|
|
61
62
|
|
|
62
|
-
- run: npm publish --access public
|
|
63
|
-
env:
|
|
64
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
63
|
+
- run: npm publish --access public --provenance
|
|
65
64
|
|