@jungherz-de/glasskit-elements 0.8.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/LICENSE +21 -0
- package/README.md +263 -0
- package/dist/glasskit-elements.esm.js +1789 -0
- package/dist/glasskit-elements.js +1819 -0
- package/dist/glasskit-elements.min.js +1 -0
- package/package.json +43 -0
- package/src/base.js +181 -0
- package/src/components/buttons/glk-button.js +80 -0
- package/src/components/containers/glk-accordion-item.js +61 -0
- package/src/components/containers/glk-accordion.js +12 -0
- package/src/components/content/glk-avatar.js +58 -0
- package/src/components/content/glk-badge.js +37 -0
- package/src/components/content/glk-card.js +33 -0
- package/src/components/content/glk-divider.js +11 -0
- package/src/components/content/glk-status.js +35 -0
- package/src/components/content/glk-title.js +16 -0
- package/src/components/feedback/glk-modal.js +98 -0
- package/src/components/feedback/glk-progress.js +77 -0
- package/src/components/feedback/glk-toast.js +104 -0
- package/src/components/forms/glk-checkbox.js +103 -0
- package/src/components/forms/glk-input.js +138 -0
- package/src/components/forms/glk-radio.js +109 -0
- package/src/components/forms/glk-range.js +112 -0
- package/src/components/forms/glk-search.js +87 -0
- package/src/components/forms/glk-select.js +96 -0
- package/src/components/forms/glk-textarea.js +95 -0
- package/src/components/forms/glk-toggle.js +121 -0
- package/src/components/navigation/glk-nav.js +12 -0
- package/src/components/navigation/glk-pill.js +48 -0
- package/src/components/navigation/glk-tab-bar.js +31 -0
- package/src/components/navigation/glk-tab-item.js +74 -0
- package/src/index.js +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jungherz GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<h1 align="center">ð§ GlassKit Elements</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmjs.com/package/glasskit-elements"><img src="https://img.shields.io/badge/version-0.8.0-f5a623?style=flat-square" alt="Version"></a>
|
|
5
|
+
<a href="#"><img src="https://img.shields.io/badge/vanilla_JS-no_dependencies-44cc11?style=flat-square" alt="Vanilla JS"></a>
|
|
6
|
+
<a href="#"><img src="https://img.shields.io/badge/components-24-7ec8e3?style=flat-square" alt="24 Components"></a>
|
|
7
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT License"></a>
|
|
8
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/changelog-v0.8.0-lightgrey?style=flat-square" alt="Changelog"></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/glasskit-elements"><img src="https://img.shields.io/badge/npm-glasskit--elements-cb3837?style=flat-square&logo=npm" alt="npm"></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<strong>Drop-in Web Components for <a href="https://github.com/JUNGHERZ/GlassKit">GlassKit CSS</a></strong><br>
|
|
14
|
+
24 vanilla JavaScript custom elements wrapping GlassKit's glassmorphism components.<br>
|
|
15
|
+
Shadow DOM · Native form participation · Zero dependencies.
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://glasskit-elements.jungherz.com/">ð Live Demo</a> ·
|
|
20
|
+
<a href="https://glasskit-elements.jungherz.com/docs.html">ð Documentation</a> ·
|
|
21
|
+
<a href="https://github.com/JUNGHERZ/GlassKit">ð§ GlassKit CSS</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## âĻ What is GlassKit Elements?
|
|
27
|
+
|
|
28
|
+
GlassKit Elements is a companion library to [GlassKit CSS](https://github.com/JUNGHERZ/GlassKit). It provides **24 Web Components** that encapsulate the verbose HTML markup required by GlassKit into simple, declarative custom elements.
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<!-- Before: 5 elements, 6 classes -->
|
|
32
|
+
<label class="glass-toggle">
|
|
33
|
+
<input class="glass-toggle__input" type="checkbox">
|
|
34
|
+
<span class="glass-toggle__track">
|
|
35
|
+
<span class="glass-toggle__thumb"></span>
|
|
36
|
+
</span>
|
|
37
|
+
<span class="glass-toggle__label">Dark Mode</span>
|
|
38
|
+
</label>
|
|
39
|
+
|
|
40
|
+
<!-- After: 1 element, 0 classes -->
|
|
41
|
+
<glk-toggle label="Dark Mode" checked></glk-toggle>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## ðŊ Why GlassKit Elements?
|
|
47
|
+
|
|
48
|
+
| Feature | Details |
|
|
49
|
+
|---|---|
|
|
50
|
+
| ð **Shadow DOM** | Style encapsulation via `adoptedStyleSheets` â no CSS leaking |
|
|
51
|
+
| ð§Đ **24 Components** | Buttons, cards, toggles, modals, accordions, tab bars, and more |
|
|
52
|
+
| ðŠķ **Zero Dependencies** | Pure vanilla JavaScript, works with React, Vue, Svelte, or plain HTML |
|
|
53
|
+
| ðïļ **Form Participation** | Input, toggle, checkbox, radio, select â all work natively with `<form>` via `ElementInternals` |
|
|
54
|
+
| ð **Theme Sync** | Automatic dark/light mode sync via `data-theme` on `<html>` |
|
|
55
|
+
| ðą **Mobile-first** | Inherits GlassKit's mobile-optimized design with `safe-area-inset` support |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## ðĨ Installation
|
|
60
|
+
|
|
61
|
+
### CDN (quickest)
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<!-- 1. GlassKit CSS -->
|
|
65
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/glasskit@1.3/glasskit.min.css">
|
|
66
|
+
|
|
67
|
+
<!-- 2. GlassKit Elements -->
|
|
68
|
+
<script src="https://cdn.jsdelivr.net/npm/glasskit-elements/dist/glasskit-elements.min.js"></script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### npm
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install glasskit-elements @jungherz-de/glasskit
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
import '@jungherz-de/glasskit/glasskit.css';
|
|
79
|
+
import 'glasskit-elements';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Selective Import
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
// Only import what you need
|
|
86
|
+
import 'glasskit-elements/components/glk-button.js';
|
|
87
|
+
import 'glasskit-elements/components/glk-toggle.js';
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## ð Quick Start
|
|
93
|
+
|
|
94
|
+
```html
|
|
95
|
+
<!DOCTYPE html>
|
|
96
|
+
<html data-theme="dark">
|
|
97
|
+
<head>
|
|
98
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/glasskit@1.3/glasskit.min.css">
|
|
99
|
+
<script src="https://cdn.jsdelivr.net/npm/glasskit-elements/dist/glasskit-elements.min.js"></script>
|
|
100
|
+
</head>
|
|
101
|
+
<body>
|
|
102
|
+
<glk-button variant="primary">Click me</glk-button>
|
|
103
|
+
<glk-toggle label="Notifications" checked></glk-toggle>
|
|
104
|
+
<glk-card glow>Hello GlassKit!</glk-card>
|
|
105
|
+
</body>
|
|
106
|
+
</html>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## ð§Đ Components
|
|
112
|
+
|
|
113
|
+
### Navigation & Layout
|
|
114
|
+
|
|
115
|
+
| Component | Description | Key Attributes |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `<glk-nav>` | Horizontal navigation bar | â |
|
|
118
|
+
| `<glk-pill>` | Circular icon button (46Ã46px) | `label`, `disabled` |
|
|
119
|
+
| `<glk-tab-bar>` | Bottom tab bar navigation | â |
|
|
120
|
+
| `<glk-tab-item>` | Tab bar item | `label`, `active`, `badge` |
|
|
121
|
+
|
|
122
|
+
### Content
|
|
123
|
+
|
|
124
|
+
| Component | Description | Key Attributes |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| `<glk-card>` | Glass-effect content card | `glow` |
|
|
127
|
+
| `<glk-badge>` | Inline status badge | `variant` (primary, success, error) |
|
|
128
|
+
| `<glk-avatar>` | Circular avatar | `size` (sm, lg), `src` |
|
|
129
|
+
| `<glk-title>` | Styled heading | â |
|
|
130
|
+
| `<glk-divider>` | Horizontal divider | â |
|
|
131
|
+
| `<glk-status>` | Status notice | `message` |
|
|
132
|
+
|
|
133
|
+
### Buttons
|
|
134
|
+
|
|
135
|
+
| Component | Description | Key Attributes |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| `<glk-button>` | Glass-styled button | `variant` (primary, secondary, tertiary), `size` (sm, md, lg, auto), `disabled`, `type` |
|
|
138
|
+
|
|
139
|
+
### Form Elements
|
|
140
|
+
|
|
141
|
+
All form components support `name`, `value`, `disabled` and participate in native `<form>` submission via `ElementInternals`.
|
|
142
|
+
|
|
143
|
+
| Component | Description | Key Attributes |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| `<glk-input>` | Text input with label & hint | `label`, `type`, `placeholder`, `hint`, `error`, `required` |
|
|
146
|
+
| `<glk-textarea>` | Multi-line text input | `label`, `rows`, `placeholder` |
|
|
147
|
+
| `<glk-select>` | Dropdown select | `label` (children: `<option>`) |
|
|
148
|
+
| `<glk-search>` | Search input with icon | `placeholder` |
|
|
149
|
+
| `<glk-toggle>` | Switch toggle | `label`, `checked`, `disabled` |
|
|
150
|
+
| `<glk-checkbox>` | Checkbox | `label`, `checked`, `disabled` |
|
|
151
|
+
| `<glk-radio>` | Radio button | `label`, `name`, `value`, `checked` |
|
|
152
|
+
| `<glk-range>` | Range slider | `label`, `min`, `max`, `value`, `step` |
|
|
153
|
+
|
|
154
|
+
### Feedback & Notifications
|
|
155
|
+
|
|
156
|
+
| Component | Description | Key Attributes |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| `<glk-progress>` | Progress bar | `value`, `label`, `variant` (success, error), `size` (sm, lg) |
|
|
159
|
+
| `<glk-modal>` | Modal dialog | `open`, `title` |
|
|
160
|
+
| `<glk-toast>` | Auto-dismissing notification | `message`, `variant` (success, error, warning), `duration` |
|
|
161
|
+
|
|
162
|
+
### Containers
|
|
163
|
+
|
|
164
|
+
| Component | Description | Key Attributes |
|
|
165
|
+
|---|---|---|
|
|
166
|
+
| `<glk-accordion>` | Accordion container | â |
|
|
167
|
+
| `<glk-accordion-item>` | Collapsible section | `title`, `open` |
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## ð Theming
|
|
172
|
+
|
|
173
|
+
Set `data-theme` on the `<html>` element â all components sync automatically:
|
|
174
|
+
|
|
175
|
+
```html
|
|
176
|
+
<html data-theme="dark"> <!-- or "light" -->
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
// Toggle theme
|
|
181
|
+
const html = document.documentElement;
|
|
182
|
+
const current = html.getAttribute('data-theme');
|
|
183
|
+
html.setAttribute('data-theme', current === 'dark' ? 'light' : 'dark');
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## ð ïļ Architecture
|
|
189
|
+
|
|
190
|
+
- **Shadow DOM** with `adoptedStyleSheets` â GlassKit's `glassSheet` is shared across all component instances
|
|
191
|
+
- **Theme wrapper** with `display: contents` â layout-transparent `<div>` for `data-theme` CSS selectors
|
|
192
|
+
- **Global `MutationObserver`** â single observer watches `data-theme` changes and syncs all instances
|
|
193
|
+
- **`GlkElement`** base class â handles Shadow DOM setup, theme sync, attribute reflection
|
|
194
|
+
- **`GlkFormElement`** extends `GlkElement` â adds `ElementInternals` for native form participation
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## ð Project Structure
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
glasskit-elements/
|
|
202
|
+
src/
|
|
203
|
+
index.js # Registers all components
|
|
204
|
+
base.js # GlkElement + GlkFormElement
|
|
205
|
+
components/
|
|
206
|
+
navigation/ # glk-nav, glk-pill, glk-tab-bar, glk-tab-item
|
|
207
|
+
content/ # glk-card, glk-badge, glk-avatar, glk-title, ...
|
|
208
|
+
buttons/ # glk-button
|
|
209
|
+
forms/ # glk-input, glk-toggle, glk-checkbox, ...
|
|
210
|
+
feedback/ # glk-progress, glk-modal, glk-toast
|
|
211
|
+
containers/ # glk-accordion, glk-accordion-item
|
|
212
|
+
dist/
|
|
213
|
+
glasskit-elements.js # IIFE bundle
|
|
214
|
+
glasskit-elements.min.js # IIFE minified (~71 KB)
|
|
215
|
+
glasskit-elements.esm.js # ES module bundle
|
|
216
|
+
index.html # Landing page
|
|
217
|
+
docs.html # Documentation
|
|
218
|
+
showcase.html # Interactive showcase
|
|
219
|
+
de/ # German translations
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## ð Browser Compatibility
|
|
225
|
+
|
|
226
|
+
| Browser | Support |
|
|
227
|
+
|---|---|
|
|
228
|
+
| Chrome | 90+ |
|
|
229
|
+
| Edge | 90+ |
|
|
230
|
+
| Safari | 16.4+ |
|
|
231
|
+
| Firefox | 103+ |
|
|
232
|
+
|
|
233
|
+
Requires `adoptedStyleSheets`, `ElementInternals`, and `customElements` v1.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## ðĪ Contributing
|
|
238
|
+
|
|
239
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
240
|
+
|
|
241
|
+
1. Fork the repository
|
|
242
|
+
2. Create your feature branch (`git checkout -b feature/new-component`)
|
|
243
|
+
3. Commit your changes (`git commit -m 'Add new component'`)
|
|
244
|
+
4. Push to the branch (`git push origin feature/new-component`)
|
|
245
|
+
5. Open a Pull Request
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## ð License
|
|
250
|
+
|
|
251
|
+
[MIT](LICENSE) â Copyright (c) 2026 Jungherz GmbH
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## ð Changelog
|
|
256
|
+
|
|
257
|
+
See [CHANGELOG.md](CHANGELOG.md) for a detailed list of changes.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
<p align="center">
|
|
262
|
+
<sub>Built on <a href="https://github.com/JUNGHERZ/GlassKit">ð§ GlassKit CSS</a> by <a href="https://www.jungherz.com">Jungherz GmbH</a> with lots of âĪïļ for detail.</sub>
|
|
263
|
+
</p>
|