@guildofgleks/ui 0.0.1 → 21.2.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/LICENSE +21 -0
- package/README.md +192 -64
- package/fesm2022/guildofgleks-ui.mjs +1019 -911
- package/fesm2022/guildofgleks-ui.mjs.map +1 -1
- package/package.json +19 -2
- package/src/styles/fonts.css +16 -17
- package/src/styles/index.css +17 -3
- package/src/styles/theme.css +943 -0
- package/src/styles/typography.css +15 -15
- package/src/styles/utilities.css +33 -27
- package/types/guildofgleks-ui.d.ts +421 -161
- package/src/styles/tokens.scss +0 -82
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Roman Malitskyi
|
|
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
CHANGED
|
@@ -1,64 +1,192 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Angular
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
A lightweight Angular 21 component library. No CDK, no Material — the only runtime
|
|
8
|
+
dependencies are `@angular/core`, `@angular/common` and `@angular/forms`.
|
|
9
|
+
|
|
10
|
+
**Tags:** angular, angular21, components, ui-library, design-system, signals, standalone, accessible
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- 16 standalone components — accordion, button, checkbox, chip, dialog, icon,
|
|
15
|
+
inputfield, multiselect, paginator, select, skeleton, slider, spinner, table, tag,
|
|
16
|
+
toast — plus `DialogService`, `ToastService` and `ThemeService`.
|
|
17
|
+
- Signal-based API throughout: `input()` / `output()` / `model()`, `OnPush` change
|
|
18
|
+
detection, no NgModules.
|
|
19
|
+
- No CDK, no Material — a small dependency footprint on top of `@angular/core`,
|
|
20
|
+
`@angular/common` and `@angular/forms`.
|
|
21
|
+
- Full theming through CSS custom properties: restyle any component, swap the whole
|
|
22
|
+
palette, or ship light/dark and custom themes at runtime via a `data-theme` attribute.
|
|
23
|
+
- `ControlValueAccessor` on every form control (checkbox, inputfield, select,
|
|
24
|
+
multiselect, slider) — works with `formControl`, `formControlName` and `ngModel`.
|
|
25
|
+
- Accessible by default: keyboard navigation, ARIA attributes, WCAG AA contrast.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
npm:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @guildofgleks/ui
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
yarn:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
yarn add @guildofgleks/ui
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Setup
|
|
42
|
+
|
|
43
|
+
Add the stylesheet once. It carries the baseline theme (every token the components
|
|
44
|
+
read) plus the utility classes the component templates use, so without it components
|
|
45
|
+
render unstyled.
|
|
46
|
+
|
|
47
|
+
```jsonc
|
|
48
|
+
// angular.json → projects.<app>.architect.build.options
|
|
49
|
+
"styles": [
|
|
50
|
+
"node_modules/@guildofgleks/ui/styles/index.css",
|
|
51
|
+
"src/styles.scss" // your own styles, after the baseline so they win
|
|
52
|
+
]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then import a component where you need it:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { Component } from '@angular/core';
|
|
59
|
+
import { ButtonComponent, SelectComponent } from '@guildofgleks/ui';
|
|
60
|
+
|
|
61
|
+
@Component({
|
|
62
|
+
selector: 'app-example',
|
|
63
|
+
imports: [ButtonComponent, SelectComponent],
|
|
64
|
+
template: `
|
|
65
|
+
<gog-select label="Region" [options]="regions" [(value)]="region" />
|
|
66
|
+
<gog-button (gogClick)="save()">Save</gog-button>
|
|
67
|
+
`,
|
|
68
|
+
})
|
|
69
|
+
export class ExampleComponent {
|
|
70
|
+
/* … */
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Outputs are prefixed with `gog` (`gogClick`, `gogToggle`) so they never collide with
|
|
75
|
+
native DOM events. Inputs keep their natural names.
|
|
76
|
+
|
|
77
|
+
## Theming
|
|
78
|
+
|
|
79
|
+
Everything is themed through CSS custom properties, and **every value the components
|
|
80
|
+
paint with lives in `styles/theme.css`** — no component stylesheet holds a colour, font,
|
|
81
|
+
border, radius, shadow, spacing or duration of its own. There are three layers:
|
|
82
|
+
|
|
83
|
+
**1. Foundation tokens** — the palette, type scale, spacing, motion and control metrics.
|
|
84
|
+
Override these to restyle everything at once; the component tokens all derive from them,
|
|
85
|
+
so a palette swap carries through without touching anything else.
|
|
86
|
+
|
|
87
|
+
| Group | Tokens |
|
|
88
|
+
| --- | --- |
|
|
89
|
+
| Palette | `--gog-background-color`, `--gog-surface-color`, `--gog-text-color`, `--gog-accent-text-color`, `--gog-muted-text-color`, `--gog-primary-color`, `--gog-secondary-color`, `--gog-accent-color`, `--gog-accent-bright`, `--gog-accent-dim`, `--gog-accent-pale`, `--gog-border-color`, `--gog-hover-color` |
|
|
90
|
+
| Status | `--gog-success-color`, `--gog-danger-color`, `--gog-warning-color`, `--gog-info-color` |
|
|
91
|
+
| Type | `--gog-font-heading`, `--gog-font-body`, `--gog-font-mono`, `--gog-text-xs` … `--gog-text-3xl` |
|
|
92
|
+
| Geometry | `--gog-radius`, `--gog-space-xs` … `--gog-space-2xl`, `--gog-panel-shadow`, `--gog-panel-radius`, `--gog-panel-border-width`, `--gog-panel-border-style` |
|
|
93
|
+
| Motion | `--gog-duration-fast`, `--gog-duration-base`, `--gog-duration-slow`, `--gog-easing` |
|
|
94
|
+
| Focus / state | `--gog-focus-ring-width`, `--gog-focus-ring-offset`, `--gog-disabled-opacity` |
|
|
95
|
+
| Controls | `--gog-control-padding-y`, `--gog-control-padding-x`, `--gog-control-icon-offset`, `--gog-control-border-width`, `--gog-control-border-style` |
|
|
96
|
+
| Fields | `--gog-field-{xsm,sm,md,lg,slg}-{padding-y,padding-x,font-size,icon-offset,icon-inset}` — shared by input, select and multiselect |
|
|
97
|
+
| Buttons | `--gog-btn-{xsm,sm,md,lg,slg}-padding`, `--gog-btn-{xsm,sm,md,lg,slg}-font-size` |
|
|
98
|
+
| Checkables | `--gog-control-checkbox-padding`, `--gog-control-checkbox-box-size-{xsm…slg}`, `--gog-control-checkbox-label-size-{xsm…slg}`, `--gog-control-checkbox-icon-size-{xsm…slg}` |
|
|
99
|
+
| Overlays | `--gog-dropdown-z`, `--gog-spinner-overlay-z` |
|
|
100
|
+
|
|
101
|
+
**2. Component tokens** — `--gog-<block>-*`, one block per component in `theme.css`, for
|
|
102
|
+
restyling a single component theme-wide. They cover every painted property, including
|
|
103
|
+
per-variant and per-size values (`--gog-btn-ghost-hover-bg`, `--gog-tag-lg-padding-block`,
|
|
104
|
+
`--gog-accordion-sm-chevron-size`, `--gog-skeleton-shine`, `--gog-paginator-gap`, …), plus
|
|
105
|
+
each component's font family, so a theme can decide that e.g. buttons use the body face:
|
|
106
|
+
|
|
107
|
+
```css
|
|
108
|
+
:root[data-theme='mine'] {
|
|
109
|
+
--gog-btn-font-family: var(--gog-font-body);
|
|
110
|
+
--gog-btn-font-weight: 600;
|
|
111
|
+
--gog-btn-ghost-hover-bg: color-mix(in srgb, var(--gog-accent-color) 20%, transparent);
|
|
112
|
+
--gog-table-hover-bg: var(--gog-hover-color);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**3. Instance tokens** — a small set left deliberately *undeclared* so that setting them
|
|
117
|
+
anywhere always wins over the variant/size classes. This is the per-instance escape
|
|
118
|
+
hatch:
|
|
119
|
+
|
|
120
|
+
```css
|
|
121
|
+
.my-form gog-button {
|
|
122
|
+
--gog-btn-bg: rebeccapurple; /* beats .gog-btn--primary, unlike a declared token */
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
They are `--gog-btn-{bg,color,border,shadow,hover-bg,hover-color,hover-shadow,padding,font-size,spinner-color}`,
|
|
127
|
+
`--gog-tag-{accent,bg,border,color,font-size,gap,padding-block,padding-inline,icon-size}`,
|
|
128
|
+
`--gog-chip-{font-size,gap,padding-block,padding-inline,avatar-size,icon-size,remove-size}`,
|
|
129
|
+
the per-size field hooks (`--gog-input-padding-y`, `--gog-select-control-font`,
|
|
130
|
+
`--gog-ms-font-size`, `--gog-table-td-padding-v`, `--gog-accordion-padding-y`, …) and
|
|
131
|
+
`--gog-spinner-color`.
|
|
132
|
+
|
|
133
|
+
### Light and dark
|
|
134
|
+
|
|
135
|
+
The theme is selected with a `data-theme` attribute on `:root`, and `ThemeService`
|
|
136
|
+
manages it:
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
private readonly theme = inject(ThemeService);
|
|
140
|
+
this.theme.toggleTheme(); // light ⇄ dark
|
|
141
|
+
this.theme.setTheme('cyberpunk'); // any custom theme name
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
To add a theme, copy a palette block from `styles/theme.css` and change the attribute
|
|
145
|
+
value. A theme only needs to declare what it actually changes — the component tokens are
|
|
146
|
+
re-derived from whatever palette is in scope, so a swapped `--gog-accent-color` reaches every
|
|
147
|
+
component without listing any of them:
|
|
148
|
+
|
|
149
|
+
```css
|
|
150
|
+
:root[data-theme='cyberpunk'],
|
|
151
|
+
[data-theme='cyberpunk'] {
|
|
152
|
+
color-scheme: dark;
|
|
153
|
+
--gog-background-color: #050816;
|
|
154
|
+
--gog-accent-color: #ff4edb;
|
|
155
|
+
--gog-radius: 22px;
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The second selector is what lets a theme apply to a *subtree* rather than the whole page
|
|
160
|
+
— put `data-theme="cyberpunk"` on any element and everything inside it re-derives from
|
|
161
|
+
that palette, so one page can show several themes side by side (see the showcase's Theme
|
|
162
|
+
lab). That works because `theme.css` re-declares its derived layer on `:root, [data-theme]`:
|
|
163
|
+
a custom property's `var()` references are substituted where the property is *declared*,
|
|
164
|
+
so a derived token declared only on `:root` would freeze to the root palette.
|
|
165
|
+
|
|
166
|
+
Corollary worth knowing when writing your own themes: **anything you declare that reads
|
|
167
|
+
another token must sit on the theme scope itself**, not on `:root`, or it will not follow
|
|
168
|
+
a nested theme.
|
|
169
|
+
|
|
170
|
+
### Optional font preset
|
|
171
|
+
|
|
172
|
+
`styles/index.css` intentionally leaves fonts alone — generic system stacks, no webfont
|
|
173
|
+
download. For the showcase's typography (Cinzel / Inter / JetBrains Mono, pulled from
|
|
174
|
+
Google Fonts) add `@guildofgleks/ui/styles/fonts.css` as well.
|
|
175
|
+
|
|
176
|
+
## Components
|
|
177
|
+
|
|
178
|
+
`gog-accordion`, `gog-button`, `gog-checkbox`, `gog-chip`, `gog-dialog`, `gog-icon`,
|
|
179
|
+
`gog-inputfield`, `gog-multiselect`, `gog-paginator`, `gog-select`, `gog-skeleton`,
|
|
180
|
+
`gog-slider`, `gog-spinner`, `gog-spinner-overlay`, `gog-table`, `gog-tag`, `gog-toast`.
|
|
181
|
+
|
|
182
|
+
Services: `DialogService`, `ToastService`, `ThemeService`.
|
|
183
|
+
|
|
184
|
+
`gog-checkbox`, `gog-inputfield`, `gog-select`, `gog-multiselect` and `gog-slider`
|
|
185
|
+
implement `ControlValueAccessor`, so they work with `[formControl]`, `formControlName`
|
|
186
|
+
and `ngModel`. With a form control attached, the error message appears once the control
|
|
187
|
+
is both touched and invalid; without one it shows for as long as `errorMessage` is
|
|
188
|
+
non-empty, and the consumer decides when to clear it.
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT © Roman Malitskyi
|