@ponchia/ui 0.3.4 → 0.3.6

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/docs/reference.md CHANGED
@@ -9,7 +9,7 @@ rendering of every class is the kitchen-sink demo:
9
9
  **<https://ponchia.github.io/bronto-ui/>**. Theming knobs and the token
10
10
  contract: [docs/theming.md](theming.md).
11
11
 
12
- - 230 classes across 101 component groups
12
+ - 262 classes across 109 component groups
13
13
  - Import the typed registry: `import { cls, ui, cx } from '@ponchia/ui/classes'`
14
14
  - Tokens as data: `import { cssVars, tokens, themeColor } from '@ponchia/ui/tokens'`
15
15
 
@@ -206,6 +206,20 @@ each one matches a real selector in the stylesheet.
206
206
  | --- | --- | --- |
207
207
  | `cls.caret` | `ui-caret` | base |
208
208
 
209
+ ### `.ui-carousel`
210
+
211
+ | Registry key | Class | Kind |
212
+ | --- | --- | --- |
213
+ | `cls.carousel` | `ui-carousel` | base |
214
+ | `cls.carouselNext` | `ui-carousel__next` | part |
215
+ | `cls.carouselPrev` | `ui-carousel__prev` | part |
216
+ | `cls.carouselSlide` | `ui-carousel__slide` | part |
217
+ | `cls.carouselStage` | `ui-carousel__stage` | part |
218
+ | `cls.carouselStatus` | `ui-carousel__status` | part |
219
+ | `cls.carouselThumb` | `ui-carousel__thumb` | part |
220
+ | `cls.carouselThumbs` | `ui-carousel__thumbs` | part |
221
+ | `cls.carouselViewport` | `ui-carousel__viewport` | part |
222
+
209
223
  ### `.ui-center`
210
224
 
211
225
  | Registry key | Class | Kind |
@@ -315,6 +329,8 @@ each one matches a real selector in the stylesheet.
315
329
  | `cls.dotmatrixCell` | `ui-dotmatrix__cell` | part |
316
330
  | `cls.dotmatrixCellAccent` | `ui-dotmatrix__cell--accent` | modifier |
317
331
  | `cls.dotmatrixCellHot` | `ui-dotmatrix__cell--hot` | modifier |
332
+ | `cls.dotmatrixPulse` | `ui-dotmatrix--pulse` | modifier |
333
+ | `cls.dotmatrixReveal` | `ui-dotmatrix--reveal` | modifier |
318
334
 
319
335
  ### `.ui-dotrule`
320
336
 
@@ -390,6 +406,20 @@ each one matches a real selector in the stylesheet.
390
406
  | `cls.inputGroup` | `ui-input-group` | base |
391
407
  | `cls.inputGroupAddon` | `ui-input-group__addon` | part |
392
408
 
409
+ ### `.ui-input-icon`
410
+
411
+ | Registry key | Class | Kind |
412
+ | --- | --- | --- |
413
+ | `cls.inputIcon` | `ui-input-icon` | base |
414
+ | `cls.inputIconSlot` | `ui-input-icon__icon` | part |
415
+ | `cls.inputIconEnd` | `ui-input-icon--end` | modifier |
416
+
417
+ ### `.ui-kbd`
418
+
419
+ | Registry key | Class | Kind |
420
+ | --- | --- | --- |
421
+ | `cls.kbd` | `ui-kbd` | base |
422
+
393
423
  ### `.ui-key-value`
394
424
 
395
425
  | Registry key | Class | Kind |
@@ -402,6 +432,13 @@ each one matches a real selector in the stylesheet.
402
432
  | --- | --- | --- |
403
433
  | `cls.label` | `ui-label` | base |
404
434
 
435
+ ### `.ui-lightbox`
436
+
437
+ | Registry key | Class | Kind |
438
+ | --- | --- | --- |
439
+ | `cls.lightbox` | `ui-lightbox` | base |
440
+ | `cls.lightboxClose` | `ui-lightbox__close` | part |
441
+
405
442
  ### `.ui-link`
406
443
 
407
444
  | Registry key | Class | Kind |
@@ -438,6 +475,17 @@ each one matches a real selector in the stylesheet.
438
475
  | `cls.meta` | `ui-meta` | base |
439
476
  | `cls.metaItem` | `ui-meta__item` | part |
440
477
 
478
+ ### `.ui-meter`
479
+
480
+ | Registry key | Class | Kind |
481
+ | --- | --- | --- |
482
+ | `cls.meter` | `ui-meter` | base |
483
+ | `cls.meterFill` | `ui-meter__fill` | part |
484
+ | `cls.meterAccent` | `ui-meter--accent` | modifier |
485
+ | `cls.meterDanger` | `ui-meter--danger` | modifier |
486
+ | `cls.meterSuccess` | `ui-meter--success` | modifier |
487
+ | `cls.meterWarning` | `ui-meter--warning` | modifier |
488
+
441
489
  ### `.ui-modal`
442
490
 
443
491
  | Registry key | Class | Kind |
@@ -471,6 +519,14 @@ each one matches a real selector in the stylesheet.
471
519
  | `cls.numNeg` | `ui-num--neg` | modifier |
472
520
  | `cls.numPos` | `ui-num--pos` | modifier |
473
521
 
522
+ ### `.ui-pagehead`
523
+
524
+ | Registry key | Class | Kind |
525
+ | --- | --- | --- |
526
+ | `cls.pagehead` | `ui-pagehead` | base |
527
+ | `cls.pageheadActions` | `ui-pagehead__actions` | part |
528
+ | `cls.pageheadTitle` | `ui-pagehead__title` | part |
529
+
474
530
  ### `.ui-pagination`
475
531
 
476
532
  | Registry key | Class | Kind |
@@ -637,6 +693,14 @@ each one matches a real selector in the stylesheet.
637
693
  | --- | --- | --- |
638
694
  | `cls.status` | `ui-status` | base |
639
695
 
696
+ ### `.ui-steps`
697
+
698
+ | Registry key | Class | Kind |
699
+ | --- | --- | --- |
700
+ | `cls.steps` | `ui-steps` | base |
701
+ | `cls.stepsItem` | `ui-steps__item` | part |
702
+ | `cls.stepsItemDone` | `ui-steps__item--done` | modifier |
703
+
640
704
  ### `.ui-surface`
641
705
 
642
706
  | Registry key | Class | Kind |
@@ -721,6 +785,14 @@ each one matches a real selector in the stylesheet.
721
785
  | `cls.themetoggleThumb` | `ui-themetoggle__thumb` | part |
722
786
  | `cls.themetoggleTrack` | `ui-themetoggle__track` | part |
723
787
 
788
+ ### `.ui-timeline`
789
+
790
+ | Registry key | Class | Kind |
791
+ | --- | --- | --- |
792
+ | `cls.timeline` | `ui-timeline` | base |
793
+ | `cls.timelineItem` | `ui-timeline__item` | part |
794
+ | `cls.timelineTime` | `ui-timeline__time` | part |
795
+
724
796
  ### `.ui-toast`
725
797
 
726
798
  | Registry key | Class | Kind |
package/docs/usage.md CHANGED
@@ -86,6 +86,39 @@ destructive action).
86
86
  | toast | transient, out-of-flow, system-initiated. Danger toasts route to an assertive live region; everything else polite. |
87
87
  | tooltip | supplemental, hover/focus, never essential info (it's not announced reliably; don't hide required content in it). |
88
88
 
89
+ ## Meter vs progress
90
+
91
+ Both are a thin horizontal bar; they mean different things.
92
+
93
+ - **`ui-progress`** — *task* progress: how far an operation has run. Can be
94
+ indeterminate (`ui-progress--indeterminate`). The fill is always accent.
95
+ - **`ui-meter`** — a *measured static value*: coverage, disk, capacity, a
96
+ KPI against a target. Never indeterminate. Tone the fill by threshold
97
+ (`ui.meter({ tone })` → accent/success/warning/danger); the unset
98
+ default is neutral. Drive the width with the shared `--value` knob
99
+ (`style="--value: 72"`, 0–100) and author `role="meter"` +
100
+ `aria-valuenow/min/max` for AT.
101
+
102
+ Rule of thumb: *something is happening* → progress; *something measures
103
+ this much* → meter.
104
+
105
+ ## Steps, timeline, kbd, input icons
106
+
107
+ - **`ui-steps`** — a stepper for a multi-step flow. Use an `<ol>`. State is
108
+ ARIA-driven (the framework rule): the active step is `aria-current="step"`
109
+ (no class); completed steps take `ui-steps__item--done`. Markers are
110
+ auto-numbered by CSS counter.
111
+ - **`ui-timeline`** — a vertical event list on a hairline spine (`<ol>` of
112
+ `ui-timeline__item`, optional `ui-timeline__time`). `aria-current` on an
113
+ item marks the live/most-recent event.
114
+ - **`ui-kbd`** — an inline keyboard-key glyph. Wrap a `<kbd>`; for a
115
+ shortcut, use one per key (`<kbd>⌘</kbd> <kbd>K</kbd>`).
116
+ - **`ui-input-icon`** — a leading (or `--end` trailing) icon *inside* one
117
+ control. This is distinct from `ui-input-group`, whose addon sits
118
+ *adjacent* to the control. Wrap the input; the icon is decorative
119
+ (`aria-hidden`) and the input keeps its full width. Don't hand-roll an
120
+ absolute overlay.
121
+
89
122
  ## Modal: native `<dialog>` vs `is-open`
90
123
 
91
124
  Prefer the **native `<dialog>`** path — you get top-layer, backdrop and
@@ -94,6 +127,83 @@ when a portal/React modal genuinely can't be a `<dialog>`; then the
94
127
  backdrop and focus-trap are **yours** to provide. A drawer is a modal
95
128
  that enters from an edge — same rule.
96
129
 
130
+ ## Carousel & lightbox: one primitive, two skins
131
+
132
+ `ui-carousel` is a scroll-snap track of `__slide`s wired by `initCarousel`
133
+ (prev/next, keyboard, a `__thumb` strip, the `__status` counter, ARIA).
134
+ Because the track is **native horizontal scroll**, touch and trackpad
135
+ swipe — with momentum — are the browser's; the behavior only keeps the JS
136
+ index in sync with the scroll both ways. Add `data-bronto-carousel-loop`
137
+ to wrap at the ends.
138
+
139
+ A **lightbox is the same carousel inside a native
140
+ `<dialog class="ui-lightbox">`**, opened with `data-bronto-open` (wired by
141
+ `initDialog`). Do **not** hand-roll an overlay: the `<dialog>` gives the
142
+ top layer, the backdrop, the focus-trap, Escape, and focus-return for
143
+ free — exactly the parts a from-scratch lightbox gets wrong. The inline
144
+ carousel crops (`cover`); the lightbox shows the whole image (`contain`).
145
+
146
+ This is deliberately *not* an auto-playing marketing slider (no timers, no
147
+ infinite-clone track). It's a gallery: the user drives it.
148
+
149
+ ## Display glyphs: when (and when not)
150
+
151
+ `@ponchia/ui/glyphs` is a 43-glyph dot-matrix icon set — navigation
152
+ (`arrow-*`, `chevron-*`), actions (`check`, `close`, `plus`, `minus`,
153
+ `search`, `menu`, `gear`), status (`info`, `warning`, `bell`, `lock`) and
154
+ common marks (`home`, `user`, `heart`, `star`, `spark`) — rendered on the
155
+ `.ui-dotmatrix` primitive, so they re-skin with the same `--field-dot*`
156
+ tokens as every other dot surface (no SVG, no icon font).
157
+
158
+ **Two rendering modes — pick by size.** The dots need physical room to
159
+ read, so the default _dot_ look is for **display** sizes (~40px up: hero
160
+ marks, empty states, status bursts, section headers, large buttons). For
161
+ small/inline use pass **`solid: true`** (or `data-bronto-glyph-solid`):
162
+ that fuses the cells into a square, gapless pixel glyph that stays crisp and
163
+ legible down to **~16px** — so the same set doubles as real inline UI icons,
164
+ not just decoration. (Below the dot fragments into dot-soup; solid does not.)
165
+
166
+ `renderGlyph(name, { label })` returns an SSR-safe string: decorative
167
+ (`aria-hidden`) by default, or `role="img"` + `aria-label` when you pass a
168
+ `label` — which is how it conveys meaning to assistive tech. Prefer the
169
+ `data-bronto-glyph` placeholder + `initDotGlyph()` when the markup is
170
+ easier dropped than inlined. Size with `--dotmatrix-dot` (and a tight
171
+ `--dotmatrix-gap`) for an intrinsic dot, or let it stretch to its container.
172
+ It is still a pixel-grid aesthetic, not a hairline vector set — but it now
173
+ spans both inline-icon and display use from one source.
174
+
175
+ **Animation** is opt-in via `anim` (`renderGlyph(name, { anim: 'reveal' })`)
176
+ or `data-bronto-glyph-anim`: `reveal` powers the cells on in a scan (a
177
+ dot-matrix booting up), `pulse` makes the glyph breathe for a live/attention
178
+ state. It's **decorative only** — disabled under `prefers-reduced-motion`,
179
+ and the meaning still lives in the static frame + `label`, never in the
180
+ motion. Don't animate to convey information a reduced-motion user would miss.
181
+ Tune the scan speed with `--dotmatrix-reveal-step` (delay per cell, default
182
+ `3ms`). Use `pulse` sparingly — one attention target per view: it loops
183
+ indefinitely, and animation that runs in parallel with other content is the
184
+ consumer's WCAG 2.2.2 (Pause/Stop/Hide) responsibility (reduced-motion is not
185
+ a substitute).
186
+
187
+ A few sharp edges to know:
188
+
189
+ - **Inline icon recipe.** `renderGlyph` returns a `<span>`, so it's valid
190
+ inline and inside a `<button>`. For an inline UI icon, render `solid` and
191
+ size the dot, e.g. inside a button:
192
+ `` `<button class="ui-button">${renderGlyph('search', { solid: true, dot: '1.2px', label: 'Search' })}<span>Search</span></button>` `` —
193
+ the button's `display: inline-flex; gap` aligns icon + text. For icon-in-prose,
194
+ set `--dotmatrix-dot` to ~`0.08em` and `vertical-align: -0.15em` on the span.
195
+ - **`solid` wins.** `solid: true` implies glyph-only and forces
196
+ `--dotmatrix-gap: 0` / square cells, so a `grid: true` or `gap` passed
197
+ alongside it is ignored.
198
+ - **Directional glyphs are physical, not logical.** `arrow-left/right`,
199
+ `chevron-left/right` are fixed bitmaps; in an RTL context flip them yourself
200
+ (e.g. swap the name, or `transform: scaleX(-1)`), the framework won't.
201
+ - **Cost.** Each glyph is a 16×16 grid = 256 cells (DOM nodes / spans),
202
+ regardless of mode; `anim: 'reveal'` adds a per-cell `--i` (≈doubles the
203
+ string size). Fine for display marks and the odd inline icon — but don't
204
+ render hundreds at once (e.g. one in every row of a long table) without
205
+ measuring.
206
+
97
207
  ## When to add a behavior
98
208
 
99
209
  The CSS is the framework; `@ponchia/ui/behaviors` is the *sanctioned*
package/fonts/OFL.txt ADDED
@@ -0,0 +1,93 @@
1
+ Copyright 2024 The Doto Project Authors (https://github.com/oliverlalan/Doto)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://openfontlicense.org
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,102 @@
1
+ /** @ponchia/ui — GENERATED from glyphs/glyphs.js by scripts/gen-glyphs.mjs.
2
+ * Do not edit by hand; run `npm run glyphs:build`. Drift-checked in CI. */
3
+
4
+ /** Every display-glyph name @ponchia/ui ships (literal union). Use this as a
5
+ * type annotation to reject typos (`const n: GlyphName = 'arow'` is an error). */
6
+ export type GlyphName =
7
+ | 'arrow-down'
8
+ | 'arrow-left'
9
+ | 'arrow-right'
10
+ | 'arrow-up'
11
+ | 'bell'
12
+ | 'check'
13
+ | 'chevron-down'
14
+ | 'chevron-left'
15
+ | 'chevron-right'
16
+ | 'chevron-up'
17
+ | 'clock'
18
+ | 'close'
19
+ | 'download'
20
+ | 'edit'
21
+ | 'eye'
22
+ | 'eye-off'
23
+ | 'file'
24
+ | 'folder'
25
+ | 'gear'
26
+ | 'grid'
27
+ | 'heart'
28
+ | 'home'
29
+ | 'info'
30
+ | 'link'
31
+ | 'lock'
32
+ | 'mail'
33
+ | 'menu'
34
+ | 'minus'
35
+ | 'moon'
36
+ | 'more-horizontal'
37
+ | 'more-vertical'
38
+ | 'pause'
39
+ | 'play'
40
+ | 'plus'
41
+ | 'refresh'
42
+ | 'search'
43
+ | 'spark'
44
+ | 'star'
45
+ | 'sun'
46
+ | 'trash'
47
+ | 'upload'
48
+ | 'user'
49
+ | 'warning';
50
+
51
+ /** A glyph name, or any string — for dynamic dispatch (a CMS/config value). The
52
+ * known names still autocomplete; an unknown name hits the runtime fallback
53
+ * (`glyph`→`undefined`, `glyphCells`→`[]`, `renderGlyph`→`''`). */
54
+ export type GlyphNameInput = GlyphName | (string & {});
55
+
56
+ /** A glyph is 16 rows of 16 chars: `.` off, `#` lit, `*` accent. */
57
+ export type Glyph = readonly string[];
58
+
59
+ /** One rendered dot. `on:false` is an unlit panel dot; tone picks the lit color. */
60
+ export interface GlyphCell {
61
+ on: boolean;
62
+ tone?: 'hot' | 'accent';
63
+ }
64
+
65
+ export interface RenderGlyphOptions {
66
+ /** Show the unlit panel dots (default true). `false` → glyph-only look. */
67
+ grid?: boolean;
68
+ /** Render lit cells as square, gapless pixels (a filled silhouette) instead
69
+ * of separated dots — the legible mode at small/inline sizes (~16–24px).
70
+ * Implies glyph-only. Default false (the dot-matrix display look). */
71
+ solid?: boolean;
72
+ /** Opt into a decorative animation (disabled under `prefers-reduced-motion`;
73
+ * meaning stays in the static frame + `label`). `'reveal'` powers the cells
74
+ * on in a scan; `'pulse'` makes the glyph breathe. */
75
+ anim?: 'reveal' | 'pulse';
76
+ /** Expose as `role="img"` with this label; omit for decorative (aria-hidden). */
77
+ label?: string;
78
+ /** CSS length for one dot (sets `--dotmatrix-dot`; sanitized — a value that
79
+ * is not a plain length/calc expression is dropped). */
80
+ dot?: string;
81
+ /** CSS length for the gap between dots (sets `--dotmatrix-gap`; sanitized
82
+ * the same way as `dot`). */
83
+ gap?: string;
84
+ }
85
+
86
+ /** The grid edge length (rows = cols = 16). */
87
+ export declare const GLYPH_SIZE: 16;
88
+
89
+ /** The frozen name→bitmap registry. */
90
+ export declare const GLYPHS: Readonly<Record<GlyphName, Glyph>>;
91
+
92
+ /** Every glyph name, frozen and sorted. */
93
+ export declare const GLYPH_NAMES: readonly GlyphName[];
94
+
95
+ /** The raw bitmap rows for a glyph, or `undefined` if the name is unknown. */
96
+ export declare function glyph(name: GlyphNameInput): Glyph | undefined;
97
+
98
+ /** 256 cell descriptors (row-major), or `[]` if unknown. */
99
+ export declare function glyphCells(name: GlyphNameInput): GlyphCell[];
100
+
101
+ /** A full `.ui-dotmatrix` HTML string for a glyph (`''` if unknown). */
102
+ export declare function renderGlyph(name: GlyphNameInput, options?: RenderGlyphOptions): string;