@c9up/nebula 0.2.1 → 0.2.3
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 +11 -9
- package/dist/atoms/AccessibleIcon.d.ts +24 -0
- package/dist/atoms/AccessibleIcon.js +27 -0
- package/dist/atoms/Checkbox.d.ts +1 -1
- package/dist/atoms/Checkbox.js +1 -1
- package/dist/atoms/Input.d.ts +5 -0
- package/dist/atoms/Input.js +1 -0
- package/dist/atoms/VisuallyHidden.d.ts +30 -0
- package/dist/atoms/VisuallyHidden.js +35 -0
- package/dist/atoms/index.d.ts +2 -0
- package/dist/atoms/index.js +2 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +7 -4
- package/dist/lib/children.d.ts +13 -8
- package/dist/lib/children.js +5 -0
- package/dist/molecules/Breadcrumb.d.ts +11 -2
- package/dist/molecules/Breadcrumb.js +2 -2
- package/dist/molecules/InputOTP.d.ts +2 -0
- package/dist/molecules/InputOTP.js +3 -1
- package/dist/molecules/Pagination.d.ts +34 -2
- package/dist/molecules/Pagination.js +15 -6
- package/dist/molecules/PieceMap.d.ts +72 -0
- package/dist/molecules/PieceMap.js +78 -0
- package/dist/molecules/Resizable.d.ts +2 -0
- package/dist/molecules/Resizable.js +1 -1
- package/dist/molecules/Toolbar.d.ts +50 -0
- package/dist/molecules/Toolbar.js +70 -0
- package/dist/molecules/index.d.ts +10 -7
- package/dist/molecules/index.js +8 -5
- package/dist/organisms/Calendar.d.ts +13 -0
- package/dist/organisms/Calendar.js +2 -2
- package/dist/organisms/Carousel.d.ts +8 -0
- package/dist/organisms/Carousel.js +8 -5
- package/dist/organisms/DataTable.d.ts +23 -1
- package/dist/organisms/DataTable.js +57 -27
- package/dist/organisms/DatePicker.d.ts +7 -0
- package/dist/organisms/DatePicker.js +2 -1
- package/dist/organisms/DateRangePicker.d.ts +2 -0
- package/dist/organisms/DateRangePicker.js +2 -1
- package/dist/organisms/Dialog.d.ts +13 -3
- package/dist/organisms/Dialog.js +12 -5
- package/dist/organisms/Questionnaire.d.ts +4 -0
- package/dist/organisms/Questionnaire.js +5 -2
- package/dist/organisms/Select.d.ts +23 -4
- package/dist/organisms/Select.js +115 -15
- package/dist/organisms/Sheet.d.ts +2 -0
- package/dist/organisms/Sheet.js +2 -1
- package/dist/organisms/Sidebar.d.ts +6 -0
- package/dist/organisms/Sidebar.js +9 -4
- package/dist/organisms/Toaster.d.ts +80 -10
- package/dist/organisms/Toaster.js +152 -24
- package/dist/organisms/index.d.ts +3 -3
- package/dist/organisms/index.js +1 -1
- package/dist/primitives/direction.d.ts +38 -0
- package/dist/primitives/direction.js +57 -0
- package/dist/primitives/floating.js +25 -13
- package/dist/primitives/focusable.d.ts +10 -0
- package/dist/primitives/focusable.js +10 -1
- package/dist/primitives/index.d.ts +2 -1
- package/dist/primitives/index.js +2 -1
- package/dist/primitives/rovingFocus.js +14 -7
- package/dist/templates/SettingsLayout.d.ts +2 -0
- package/dist/templates/SettingsLayout.js +1 -1
- package/nebula.css +1 -1
- package/package.json +3 -3
- package/registry.json +76 -0
- package/src/atoms/AccessibleIcon.ts +39 -0
- package/src/atoms/Checkbox.ts +1 -1
- package/src/atoms/Input.ts +6 -0
- package/src/atoms/VisuallyHidden.ts +45 -0
- package/src/atoms/index.ts +8 -0
- package/src/index.ts +7 -4
- package/src/lib/children.ts +15 -7
- package/src/molecules/Breadcrumb.ts +15 -4
- package/src/molecules/InputOTP.ts +7 -1
- package/src/molecules/Pagination.ts +50 -8
- package/src/molecules/PieceMap.ts +136 -0
- package/src/molecules/Resizable.ts +3 -1
- package/src/molecules/Toolbar.ts +100 -0
- package/src/molecules/index.ts +28 -5
- package/src/organisms/Calendar.ts +16 -2
- package/src/organisms/Carousel.ts +17 -5
- package/src/organisms/DataTable.ts +95 -30
- package/src/organisms/DatePicker.ts +10 -2
- package/src/organisms/DateRangePicker.ts +4 -2
- package/src/organisms/Dialog.ts +17 -5
- package/src/organisms/Questionnaire.ts +10 -2
- package/src/organisms/Select.ts +137 -16
- package/src/organisms/Sheet.ts +5 -1
- package/src/organisms/Sidebar.ts +15 -4
- package/src/organisms/Toaster.ts +215 -37
- package/src/organisms/index.ts +9 -1
- package/src/primitives/direction.ts +61 -0
- package/src/primitives/floating.ts +29 -13
- package/src/primitives/focusable.ts +10 -1
- package/src/primitives/index.ts +7 -0
- package/src/primitives/rovingFocus.ts +18 -5
- package/src/templates/SettingsLayout.ts +3 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Part of **[Ream](https://github.com/C9up/ream)** — a Rust-powered, AdonisJS-co
|
|
|
8
8
|
|
|
9
9
|
shadcn/ui is React. [Aurora](https://github.com/C9up/aurora) is a tagged-template DOM runtime with signals and no build step. nebula is the shadcn component set — the same markup, the same Tailwind classes, the same behaviour — written for Aurora.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Seventy-four components across four atomic layers, plus the headless behaviour layer Radix would otherwise provide. Every component in shadcn's registry has a counterpart; several are deliberately narrower, and the [parity section](#parity-with-shadcn) says exactly which.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -82,7 +82,7 @@ Several of those are narrower than what they replace — see [parity with shadcn
|
|
|
82
82
|
|
|
83
83
|
Checked against shadcn's published component list, not from memory. Every one of its components has a counterpart here — including the conversational set (`Bubble`, `Message`, `MessageScroller`, `Attachment`, `Marker`), `NativeSelect` and `Questionnaire` — and the ~40 simple ones are faithful down to the class strings, the variants and the ARIA attributes.
|
|
84
84
|
|
|
85
|
-
Two of shadcn's entries have no direct counterpart on purpose. `DirectionProvider` is React context
|
|
85
|
+
Two of shadcn's entries have no direct counterpart on purpose. `DirectionProvider` is React context. Aurora has context, and these components use it, but the direction belongs on `<html dir>` — what it was really buying is [RTL support](#right-to-left), which is handled in the placement engine instead. `Form` has been folded into `Field` upstream; nebula ships both, with `Form` binding Aurora's own form controller. The components shadcn builds by wrapping a third-party library are reimplementations, and they are narrower. Stated plainly, because "complete port" would not be true:
|
|
86
86
|
|
|
87
87
|
| Component | shadcn | nebula |
|
|
88
88
|
| --- | --- | --- |
|
|
@@ -90,7 +90,7 @@ Two of shadcn's entries have no direct counterpart on purpose. `DirectionProvide
|
|
|
90
90
|
| DataTable | TanStack Table (column grouping, virtualisation, pinning, faceted filters, server-side) | sort, filter, page, select — in memory |
|
|
91
91
|
| Sidebar | ~15 parts | the parts that are not re-skinned atoms — see below |
|
|
92
92
|
| Carousel | embla (loop, autoplay, N slides per view) | scroll-snap, one slide per view, no loop or autoplay |
|
|
93
|
-
| Toaster |
|
|
93
|
+
| Toaster | Base UI's manager (display priority, anchored toasts, typed payload) — or sonner, with six positions | five variants, promise toasts, update and dedup by id, action, `onClose`, pause on hover, four corners |
|
|
94
94
|
| Resizable | arbitrary nesting, persisted layouts, collapse-to-zero | two panes, one handle |
|
|
95
95
|
| Combobox | single, multi-select and creatable recipes | single-select |
|
|
96
96
|
| ScrollArea | scrollbars redrawn by Radix | native scrollbars, styled |
|
|
@@ -98,7 +98,7 @@ Two of shadcn's entries have no direct counterpart on purpose. `DirectionProvide
|
|
|
98
98
|
| Questionnaire | branching logic, validation schemas | linear steps; single, multiple, freeform, skippable |
|
|
99
99
|
| Bubble / Message | rich composition slots | the parts nebula's own layout needs |
|
|
100
100
|
|
|
101
|
-
Two API-wide differences, both consequences of the runtime rather than choices about scope: there is no `asChild` (a compiled template has no element to clone), and compound components take data rather than children (Aurora has
|
|
101
|
+
Two API-wide differences, both consequences of the runtime rather than choices about scope: there is no `asChild` (a compiled template has no element to clone), and compound components take data rather than children (Aurora's context lives on a stack during setup, so a part passed as a lazy slot is built after that frame has popped — see below).
|
|
102
102
|
|
|
103
103
|
**The Sidebar deserves its own note**, because porting it part-for-part would have fought the atomic taxonomy rather than following it. `SidebarInput`, `SidebarSeparator` and `SidebarMenuSkeleton` are the existing `Input`, `Separator` and `Skeleton` atoms with a prefix — redeclaring them would break the composition rule the whole library is organised on. `SidebarProvider` is React context, and nebula's sidebar owns its own shared signal instead. `SidebarInset` is the content column beside the rail, which is `AppShell`, a template. What was genuinely missing and has been added: `SidebarMenuSub`, `SidebarMenuSubItem`, `SidebarMenuAction`, a badge slot, and tooltips when the rail is collapsed.
|
|
104
104
|
|
|
@@ -194,11 +194,11 @@ resources/pages/
|
|
|
194
194
|
The rule is composition, not complexity. Slider is an atom though it is interactive, because it is one input. Card is a molecule though it is trivial, because it assembles parts.
|
|
195
195
|
|
|
196
196
|
<details>
|
|
197
|
-
<summary><strong>All
|
|
197
|
+
<summary><strong>All 75 components</strong></summary>
|
|
198
198
|
|
|
199
|
-
**atoms (
|
|
199
|
+
**atoms (22)** — AccessibleIcon, AspectRatio, Avatar, Badge, Button, Checkbox, Image, Input, Kbd, Label, Marker, NativeSelect, Progress, ScrollArea, Separator, Skeleton, Slider, Spinner, Switch, Textarea, Toggle, VisuallyHidden
|
|
200
200
|
|
|
201
|
-
**molecules (
|
|
201
|
+
**molecules (24)** — Accordion, Alert, Attachment, Breadcrumb, Bubble, ButtonGroup, Card, Collapsible, Empty, Field, InputGroup, InputOTP, Item, Message, Pagination, Picture, PieceMap, RadioGroup, Resizable, Table, Tabs, ToggleGroup, Toolbar, Typography
|
|
202
202
|
|
|
203
203
|
**organisms (26)** — AlertDialog, Calendar, Carousel, Chart, Combobox, Command, CommandDialog, ContextMenu, DataTable, DatePicker, DateRangePicker, Dialog, Drawer, DropdownMenu, Form, HoverCard, Menubar, MessageScroller, NavigationMenu, Popover, Questionnaire, Select, Sheet, Sidebar, Toaster, Tooltip
|
|
204
204
|
|
|
@@ -217,7 +217,9 @@ shadcn composes through React context:
|
|
|
217
217
|
</Tabs>
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
Aurora
|
|
220
|
+
Aurora **does** have context — `createContext` / `provide` / `inject` — and these components use it: `Tabs` provides a `TabsApi` that `TabsTrigger` and `TabsContent` inject. What they do not do is take their parts as children.
|
|
221
|
+
|
|
222
|
+
Context here lives on a stack during a component's **setup**, which is synchronous. A part handed in as a `Slot` thunk is built later, by the renderer, when that frame has already popped — so the shadcn shape, where a child reads the parent it was nested inside, cannot read anything. Taking data keeps every part built during setup, while the context is still there. So compound components take data:
|
|
221
223
|
|
|
222
224
|
```ts
|
|
223
225
|
Tabs({
|
|
@@ -273,7 +275,7 @@ The headless layer is most of this package, and it is where shadcn's behaviour a
|
|
|
273
275
|
## Development
|
|
274
276
|
|
|
275
277
|
```bash
|
|
276
|
-
pnpm test #
|
|
278
|
+
pnpm test # 593 unit tests
|
|
277
279
|
pnpm typecheck
|
|
278
280
|
pnpm lint
|
|
279
281
|
pnpm registry # regenerate registry.json from the source tree
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AccessibleIcon — an icon with a name only a screen reader hears.
|
|
3
|
+
*
|
|
4
|
+
* An icon on its own is a picture of a word. Sighted users read the picture;
|
|
5
|
+
* a screen reader reads nothing at all, because an `<svg>` with no label is
|
|
6
|
+
* announced as nothing — which is how a delete button becomes an unlabelled
|
|
7
|
+
* button in the middle of a row of unlabelled buttons.
|
|
8
|
+
*
|
|
9
|
+
* Two halves, and both matter. The icon is marked `aria-hidden` so its own
|
|
10
|
+
* internals — a `<title>`, a stray `<text>` — are not announced on top of the
|
|
11
|
+
* label; the label is visually hidden text beside it. `aria-label` on the
|
|
12
|
+
* parent would do for a plain string, but it does not survive translation
|
|
13
|
+
* tooling the way real text does, and it cannot carry markup.
|
|
14
|
+
*/
|
|
15
|
+
import { type Slot } from "../lib/children.js";
|
|
16
|
+
import { type Reactive } from "../lib/props.js";
|
|
17
|
+
export interface AccessibleIconProps {
|
|
18
|
+
/** The icon. Hidden from the accessibility tree. */
|
|
19
|
+
children?: Slot;
|
|
20
|
+
/** What the icon means, in words. */
|
|
21
|
+
label: Reactive<string>;
|
|
22
|
+
class?: Reactive<string>;
|
|
23
|
+
}
|
|
24
|
+
export declare const AccessibleIcon: (props?: AccessibleIconProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AccessibleIcon — an icon with a name only a screen reader hears.
|
|
3
|
+
*
|
|
4
|
+
* An icon on its own is a picture of a word. Sighted users read the picture;
|
|
5
|
+
* a screen reader reads nothing at all, because an `<svg>` with no label is
|
|
6
|
+
* announced as nothing — which is how a delete button becomes an unlabelled
|
|
7
|
+
* button in the middle of a row of unlabelled buttons.
|
|
8
|
+
*
|
|
9
|
+
* Two halves, and both matter. The icon is marked `aria-hidden` so its own
|
|
10
|
+
* internals — a `<title>`, a stray `<text>` — are not announced on top of the
|
|
11
|
+
* label; the label is visually hidden text beside it. `aria-label` on the
|
|
12
|
+
* parent would do for a plain string, but it does not survive translation
|
|
13
|
+
* tooling the way real text does, and it cannot carry markup.
|
|
14
|
+
*/
|
|
15
|
+
import { component, html } from "@c9up/aurora";
|
|
16
|
+
import { slot } from "../lib/children.js";
|
|
17
|
+
import { cn } from "../lib/cn.js";
|
|
18
|
+
import { read } from "../lib/props.js";
|
|
19
|
+
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
20
|
+
export const AccessibleIcon = component((props) => {
|
|
21
|
+
return html `<span
|
|
22
|
+
data-slot="accessible-icon"
|
|
23
|
+
class="${() => cn("contents", read(props.class))}"
|
|
24
|
+
><span aria-hidden="true" class="contents">${slot(props.children)}</span>${VisuallyHidden({
|
|
25
|
+
children: () => read(props.label),
|
|
26
|
+
})}</span>`;
|
|
27
|
+
});
|
package/dist/atoms/Checkbox.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* it exists only in the DOM.
|
|
17
17
|
*/
|
|
18
18
|
import { type Reactive } from "../lib/props.js";
|
|
19
|
-
export declare const checkboxClasses = "peer size-4 shrink-0 appearance-none rounded-[4px] border border-input bg-transparent shadow-xs outline-none transition-shadow dark:bg-input/30 checked:border-primary checked:bg-primary indeterminate:border-primary indeterminate:bg-primary focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20";
|
|
19
|
+
export declare const checkboxClasses = "peer size-4 shrink-0 appearance-none rounded-[4px] border border-input bg-transparent shadow-xs outline-none transition-shadow dark:bg-input/30 checked:border-primary checked:bg-primary indeterminate:border-primary indeterminate:bg-primary focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:checked:bg-primary dark:indeterminate:bg-primary";
|
|
20
20
|
export interface CheckboxProps {
|
|
21
21
|
id?: string;
|
|
22
22
|
name?: string;
|
package/dist/atoms/Checkbox.js
CHANGED
|
@@ -19,7 +19,7 @@ import { component, html } from "@c9up/aurora";
|
|
|
19
19
|
import { cn } from "../lib/cn.js";
|
|
20
20
|
import { CheckIcon, MinusIcon } from "../lib/icons.js";
|
|
21
21
|
import { accessor, read } from "../lib/props.js";
|
|
22
|
-
export const checkboxClasses = "peer size-4 shrink-0 appearance-none rounded-[4px] border border-input bg-transparent shadow-xs outline-none transition-shadow dark:bg-input/30 checked:border-primary checked:bg-primary indeterminate:border-primary indeterminate:bg-primary focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20";
|
|
22
|
+
export const checkboxClasses = "peer size-4 shrink-0 appearance-none rounded-[4px] border border-input bg-transparent shadow-xs outline-none transition-shadow dark:bg-input/30 checked:border-primary checked:bg-primary indeterminate:border-primary indeterminate:bg-primary focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:checked:bg-primary dark:indeterminate:bg-primary";
|
|
23
23
|
function inputChecked(event) {
|
|
24
24
|
const target = event.target;
|
|
25
25
|
return target instanceof HTMLInputElement ? target.checked : false;
|
package/dist/atoms/Input.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ export interface InputProps {
|
|
|
27
27
|
invalid?: Reactive<boolean>;
|
|
28
28
|
/** Names the element describing the error, for screen readers. */
|
|
29
29
|
describedBy?: Reactive<string | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* The field's accessible name (`aria-label`), for a field no `<label>`
|
|
32
|
+
* names. A placeholder is not one: it disappears as soon as the user types.
|
|
33
|
+
*/
|
|
34
|
+
label?: Reactive<string | undefined>;
|
|
30
35
|
class?: Reactive<string>;
|
|
31
36
|
onInput?: (value: string, event: Event) => void;
|
|
32
37
|
onChange?: (value: string, event: Event) => void;
|
package/dist/atoms/Input.js
CHANGED
|
@@ -37,6 +37,7 @@ export const Input = component((props) => {
|
|
|
37
37
|
autocomplete="${props.autocomplete}"
|
|
38
38
|
aria-invalid="${() => (read(props.invalid) === true ? "true" : undefined)}"
|
|
39
39
|
aria-describedby="${accessor(props.describedBy, undefined)}"
|
|
40
|
+
aria-label="${accessor(props.label, undefined)}"
|
|
40
41
|
?disabled="${accessor(props.disabled, false)}"
|
|
41
42
|
?readonly="${accessor(props.readonly, false)}"
|
|
42
43
|
?required="${accessor(props.required, false)}"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VisuallyHidden — text for a screen reader and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* Not `display: none`, which removes it from the accessibility tree as well,
|
|
5
|
+
* and not `opacity: 0`, which keeps it taking space. The clip rectangle is the
|
|
6
|
+
* one technique that leaves the node announced and unrendered, and it is
|
|
7
|
+
* fiddly enough that hand-writing it in each component is how one of them ends
|
|
8
|
+
* up subtly wrong.
|
|
9
|
+
*
|
|
10
|
+
* Its main job is the label a sighted user does not need: a dialog whose title
|
|
11
|
+
* is a logo, an icon button, a table caption. `aria-label` covers some of
|
|
12
|
+
* those, but not the ones where the content is real markup — a heading that a
|
|
13
|
+
* `aria-labelledby` has to point at, for instance.
|
|
14
|
+
*
|
|
15
|
+
* `focusable` keeps it hidden until it is tabbed to, which is what a skip link
|
|
16
|
+
* needs: invisible in the layout, and visible the moment it has focus.
|
|
17
|
+
*
|
|
18
|
+
* Always a `<span>`. Radix takes an `asChild` here so a hidden heading can be
|
|
19
|
+
* a real `<h2>`; aurora's template parser fixes the tag at compile time, so
|
|
20
|
+
* the equivalent is to put this inside the heading rather than to become one.
|
|
21
|
+
*/
|
|
22
|
+
import { type Slot } from "../lib/children.js";
|
|
23
|
+
import { type Reactive } from "../lib/props.js";
|
|
24
|
+
export interface VisuallyHiddenProps {
|
|
25
|
+
children?: Slot;
|
|
26
|
+
/** Reveal it once focused — for a skip link. Default `false`. */
|
|
27
|
+
focusable?: boolean;
|
|
28
|
+
class?: Reactive<string>;
|
|
29
|
+
}
|
|
30
|
+
export declare const VisuallyHidden: (props?: VisuallyHiddenProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VisuallyHidden — text for a screen reader and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* Not `display: none`, which removes it from the accessibility tree as well,
|
|
5
|
+
* and not `opacity: 0`, which keeps it taking space. The clip rectangle is the
|
|
6
|
+
* one technique that leaves the node announced and unrendered, and it is
|
|
7
|
+
* fiddly enough that hand-writing it in each component is how one of them ends
|
|
8
|
+
* up subtly wrong.
|
|
9
|
+
*
|
|
10
|
+
* Its main job is the label a sighted user does not need: a dialog whose title
|
|
11
|
+
* is a logo, an icon button, a table caption. `aria-label` covers some of
|
|
12
|
+
* those, but not the ones where the content is real markup — a heading that a
|
|
13
|
+
* `aria-labelledby` has to point at, for instance.
|
|
14
|
+
*
|
|
15
|
+
* `focusable` keeps it hidden until it is tabbed to, which is what a skip link
|
|
16
|
+
* needs: invisible in the layout, and visible the moment it has focus.
|
|
17
|
+
*
|
|
18
|
+
* Always a `<span>`. Radix takes an `asChild` here so a hidden heading can be
|
|
19
|
+
* a real `<h2>`; aurora's template parser fixes the tag at compile time, so
|
|
20
|
+
* the equivalent is to put this inside the heading rather than to become one.
|
|
21
|
+
*/
|
|
22
|
+
import { component, html } from "@c9up/aurora";
|
|
23
|
+
import { slot } from "../lib/children.js";
|
|
24
|
+
import { cn } from "../lib/cn.js";
|
|
25
|
+
import { read } from "../lib/props.js";
|
|
26
|
+
/** Tailwind's own `sr-only`, plus its counterpart for the focusable case. */
|
|
27
|
+
const HIDDEN = "sr-only";
|
|
28
|
+
const FOCUSABLE = "sr-only focus-within:not-sr-only focus:not-sr-only";
|
|
29
|
+
export const VisuallyHidden = component((props) => {
|
|
30
|
+
const base = props.focusable === true ? FOCUSABLE : HIDDEN;
|
|
31
|
+
return html `<span
|
|
32
|
+
data-slot="visually-hidden"
|
|
33
|
+
class="${() => cn(base, read(props.class))}"
|
|
34
|
+
>${slot(props.children)}</span>`;
|
|
35
|
+
});
|
package/dist/atoms/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* a molecule despite being simpler than Slider, because it assembles parts.
|
|
12
12
|
* Slider is an atom despite being interactive, because it is one input.
|
|
13
13
|
*/
|
|
14
|
+
export { AccessibleIcon, type AccessibleIconProps, } from "./AccessibleIcon.js";
|
|
14
15
|
export { AspectRatio, type AspectRatioProps } from "./AspectRatio.js";
|
|
15
16
|
export { Avatar, AvatarBadge, type AvatarBadgeProps, AvatarFallback, type AvatarFallbackProps, AvatarGroup, AvatarGroupCount, type AvatarGroupProps, AvatarImage, type AvatarImageProps, type AvatarProps, } from "./Avatar.js";
|
|
16
17
|
export { Badge, type BadgeProps, type BadgeVariants, badgeVariants, } from "./Badge.js";
|
|
@@ -31,3 +32,4 @@ export { Spinner, type SpinnerProps } from "./Spinner.js";
|
|
|
31
32
|
export { Switch, type SwitchProps, switchTrackClasses } from "./Switch.js";
|
|
32
33
|
export { Textarea, type TextareaProps, textareaClasses } from "./Textarea.js";
|
|
33
34
|
export { Toggle, type ToggleProps, type ToggleVariants, toggleVariants, } from "./Toggle.js";
|
|
35
|
+
export { VisuallyHidden, type VisuallyHiddenProps, } from "./VisuallyHidden.js";
|
package/dist/atoms/index.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* a molecule despite being simpler than Slider, because it assembles parts.
|
|
12
12
|
* Slider is an atom despite being interactive, because it is one input.
|
|
13
13
|
*/
|
|
14
|
+
export { AccessibleIcon, } from "./AccessibleIcon.js";
|
|
14
15
|
export { AspectRatio } from "./AspectRatio.js";
|
|
15
16
|
export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, } from "./Avatar.js";
|
|
16
17
|
export { Badge, badgeVariants, } from "./Badge.js";
|
|
@@ -31,3 +32,4 @@ export { Spinner } from "./Spinner.js";
|
|
|
31
32
|
export { Switch, switchTrackClasses } from "./Switch.js";
|
|
32
33
|
export { Textarea, textareaClasses } from "./Textarea.js";
|
|
33
34
|
export { Toggle, toggleVariants, } from "./Toggle.js";
|
|
35
|
+
export { VisuallyHidden, } from "./VisuallyHidden.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
* icons are inlined, and the date maths is `Date` and `Intl`.
|
|
14
14
|
*
|
|
15
15
|
* **Compound components take data, not children.** shadcn composes through
|
|
16
|
-
* React context — `<Tabs><TabsList><TabsTrigger>`. Aurora has
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* React context — `<Tabs><TabsList><TabsTrigger>`. Aurora has context too, and
|
|
17
|
+
* these components use it; what they do not do is take their parts as children.
|
|
18
|
+
* Context here lives on a stack during a component's SETUP, so a part handed in
|
|
19
|
+
* as a `Slot` thunk is built later, once that frame has popped, and reads
|
|
20
|
+
* nothing. An `items` array and named slots keep every part built while the
|
|
21
|
+
* context is still there. The rendered markup is unchanged, which means shadcn's
|
|
22
|
+
* CSS and its examples still read across.
|
|
20
23
|
*
|
|
21
24
|
* **The atomic layer is a property of the component.** An atom renders its own
|
|
22
25
|
* markup and composes nothing from nebula; a molecule assembles atoms or owns
|
package/dist/index.js
CHANGED
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
* icons are inlined, and the date maths is `Date` and `Intl`.
|
|
14
14
|
*
|
|
15
15
|
* **Compound components take data, not children.** shadcn composes through
|
|
16
|
-
* React context — `<Tabs><TabsList><TabsTrigger>`. Aurora has
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* React context — `<Tabs><TabsList><TabsTrigger>`. Aurora has context too, and
|
|
17
|
+
* these components use it; what they do not do is take their parts as children.
|
|
18
|
+
* Context here lives on a stack during a component's SETUP, so a part handed in
|
|
19
|
+
* as a `Slot` thunk is built later, once that frame has popped, and reads
|
|
20
|
+
* nothing. An `items` array and named slots keep every part built while the
|
|
21
|
+
* context is still there. The rendered markup is unchanged, which means shadcn's
|
|
22
|
+
* CSS and its examples still read across.
|
|
20
23
|
*
|
|
21
24
|
* **The atomic layer is a property of the component.** An atom renders its own
|
|
22
25
|
* markup and composes nothing from nebula; a molecule assembles atoms or owns
|
package/dist/lib/children.d.ts
CHANGED
|
@@ -12,9 +12,11 @@
|
|
|
12
12
|
* — Aurora never re-renders a component, so a plain value read at setup is
|
|
13
13
|
* frozen for the lifetime of the node.
|
|
14
14
|
*/
|
|
15
|
-
import type
|
|
15
|
+
import { type Each, type TemplateResult } from "@c9up/aurora";
|
|
16
16
|
import type { Reactive } from "./props.js";
|
|
17
|
-
export type Child = TemplateResult
|
|
17
|
+
export type Child = TemplateResult
|
|
18
|
+
/** A keyed list from aurora's `each`, which keeps its rows by key. */
|
|
19
|
+
| Each | Node | string | number | boolean | null | undefined | readonly Child[];
|
|
18
20
|
/** Content that may be constant or recomputed. */
|
|
19
21
|
export type Slot = Reactive<Child>;
|
|
20
22
|
/**
|
|
@@ -32,13 +34,16 @@ export type Slot = Reactive<Child>;
|
|
|
32
34
|
* `Parts` names it so the type makes the requirement, rather than a blank
|
|
33
35
|
* surface at runtime.
|
|
34
36
|
*
|
|
35
|
-
* Called ONCE, during setup
|
|
36
|
-
*
|
|
37
|
+
* Called ONCE, during setup. What changes goes in an accessor inside it, and
|
|
38
|
+
* parts built there still reach their provider — Aurora calls the accessor
|
|
39
|
+
* with the providers it was written under — so a list of options can follow a
|
|
40
|
+
* signal:
|
|
37
41
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* there is
|
|
42
|
+
* SelectContent({ children: () => html`${() => roles().map((r) => SelectItem(…))}` })
|
|
43
|
+
*
|
|
44
|
+
* A part that has to be KNOWN at setup is the exception. `DialogTitle` names
|
|
45
|
+
* the panel, and the panel reads whether there is a title before it renders
|
|
46
|
+
* its children, so a title built later in an accessor leaves it unnamed:
|
|
42
47
|
*
|
|
43
48
|
* DialogHeader({ children: html`${DialogTitle(…)}` }) // ✓ a value
|
|
44
49
|
* DialogHeader({ children: () => html`${DialogTitle(…)}` }) // ✗ too late
|
package/dist/lib/children.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* — Aurora never re-renders a component, so a plain value read at setup is
|
|
13
13
|
* frozen for the lifetime of the node.
|
|
14
14
|
*/
|
|
15
|
+
import { isEach } from "@c9up/aurora";
|
|
15
16
|
/**
|
|
16
17
|
* Bind content into a template so it stays live.
|
|
17
18
|
*
|
|
@@ -23,5 +24,9 @@
|
|
|
23
24
|
export function slot(content) {
|
|
24
25
|
if (content === undefined)
|
|
25
26
|
return () => null;
|
|
27
|
+
// A keyed list is a function too, but it is content, not an accessor for
|
|
28
|
+
// content: handed over as the value, it keeps its rows by key.
|
|
29
|
+
if (isEach(content))
|
|
30
|
+
return () => content;
|
|
26
31
|
return typeof content === "function" ? content : () => content;
|
|
27
32
|
}
|
|
@@ -26,7 +26,11 @@ export interface BreadcrumbProps {
|
|
|
26
26
|
children?: Slot;
|
|
27
27
|
class?: Reactive<string>;
|
|
28
28
|
}
|
|
29
|
-
export
|
|
29
|
+
export interface BreadcrumbNavProps extends BreadcrumbProps {
|
|
30
|
+
/** The `<nav>`'s accessible name. Default `"breadcrumb"`. */
|
|
31
|
+
"aria-label"?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const Breadcrumb: (props?: BreadcrumbNavProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
30
34
|
export declare const BreadcrumbList: (props?: BreadcrumbProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
31
35
|
export declare const BreadcrumbItem: (props?: BreadcrumbProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
32
36
|
export interface BreadcrumbLinkProps extends BreadcrumbProps {
|
|
@@ -43,5 +47,10 @@ export declare const BreadcrumbLink: (props?: BreadcrumbLinkProps | undefined) =
|
|
|
43
47
|
export declare const BreadcrumbPage: (props?: BreadcrumbProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
44
48
|
/** The chevron. Defaults to one; give children to replace it. */
|
|
45
49
|
export declare const BreadcrumbSeparator: (props?: BreadcrumbProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
50
|
+
export interface BreadcrumbEllipsisProps {
|
|
51
|
+
/** The hidden text. Default `"More"`. */
|
|
52
|
+
label?: string;
|
|
53
|
+
class?: Reactive<string>;
|
|
54
|
+
}
|
|
46
55
|
/** Stands in for ancestors that did not fit. */
|
|
47
|
-
export declare const BreadcrumbEllipsis: (props?:
|
|
56
|
+
export declare const BreadcrumbEllipsis: (props?: BreadcrumbEllipsisProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
@@ -27,7 +27,7 @@ import { ChevronRightIcon, MoreHorizontalIcon } from "../lib/icons.js";
|
|
|
27
27
|
import { read } from "../lib/props.js";
|
|
28
28
|
export const Breadcrumb = component((props) => html `<nav
|
|
29
29
|
data-slot="breadcrumb"
|
|
30
|
-
aria-label="breadcrumb"
|
|
30
|
+
aria-label="${props["aria-label"] ?? "breadcrumb"}"
|
|
31
31
|
class="${() => cn(read(props.class))}"
|
|
32
32
|
>${slot(props.children)}</nav>`);
|
|
33
33
|
export const BreadcrumbList = component((props) => html `<ol
|
|
@@ -70,4 +70,4 @@ export const BreadcrumbEllipsis = component((props) => html `<span
|
|
|
70
70
|
role="presentation"
|
|
71
71
|
aria-hidden="true"
|
|
72
72
|
class="${() => cn("flex size-9 items-center justify-center", read(props.class))}"
|
|
73
|
-
>${MoreHorizontalIcon({ class: "size-4" })}<span class="sr-only"
|
|
73
|
+
>${MoreHorizontalIcon({ class: "size-4" })}<span class="sr-only">${props.label ?? "More"}</span></span>`);
|
|
@@ -22,6 +22,8 @@ import { type Reactive } from "../lib/props.js";
|
|
|
22
22
|
export interface InputOTPProps {
|
|
23
23
|
/** Number of boxes. Default `6` — and it must match the slots built. */
|
|
24
24
|
length?: number;
|
|
25
|
+
/** Each box's accessible name from its position. Default `"Character 2 of 6"`. */
|
|
26
|
+
slotLabel?: (position: number, length: number) => string;
|
|
25
27
|
name?: string;
|
|
26
28
|
disabled?: Reactive<boolean>;
|
|
27
29
|
class?: Reactive<string>;
|
|
@@ -61,6 +61,8 @@ export const InputOTP = component((props) => {
|
|
|
61
61
|
provide(InputOTPContext, {
|
|
62
62
|
length,
|
|
63
63
|
disabled: () => readOr(props.disabled, false),
|
|
64
|
+
slotLabel: props.slotLabel ??
|
|
65
|
+
((position, total) => `Character ${position} of ${total}`),
|
|
64
66
|
claimSlot() {
|
|
65
67
|
const index = claimed;
|
|
66
68
|
claimed += 1;
|
|
@@ -156,7 +158,7 @@ export const InputOTPSlot = component((props) => {
|
|
|
156
158
|
inputmode="numeric"
|
|
157
159
|
autocomplete="${index === 0 ? "one-time-code" : "off"}"
|
|
158
160
|
maxlength="1"
|
|
159
|
-
aria-label="${
|
|
161
|
+
aria-label="${otp.slotLabel(index + 1, otp.length)}"
|
|
160
162
|
?disabled="${() => otp.disabled()}"
|
|
161
163
|
class="${() => cn(slotClasses, read(props.class))}"
|
|
162
164
|
@input="${(event) => otp.onInput(index, event)}"
|
|
@@ -32,7 +32,31 @@ export interface PaginationProps {
|
|
|
32
32
|
children?: Slot;
|
|
33
33
|
class?: Reactive<string>;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Every text the pagination writes, in one place.
|
|
37
|
+
*
|
|
38
|
+
* The defaults are upstream's English. An app in another language passes its
|
|
39
|
+
* own: most of these are read only by a screen reader, which would otherwise
|
|
40
|
+
* switch to English in the middle of the page.
|
|
41
|
+
*/
|
|
42
|
+
export interface PaginationLabels {
|
|
43
|
+
/** The `<nav>`'s accessible name. */
|
|
44
|
+
navigation: string;
|
|
45
|
+
/** The visible word beside the previous arrow. */
|
|
46
|
+
previous: string;
|
|
47
|
+
/** The previous link's accessible name. */
|
|
48
|
+
previousPage: string;
|
|
49
|
+
next: string;
|
|
50
|
+
nextPage: string;
|
|
51
|
+
/** The ellipsis's hidden text. */
|
|
52
|
+
morePages: string;
|
|
53
|
+
}
|
|
54
|
+
/** Frozen: the defaults, not a place to set an app's language from. */
|
|
55
|
+
export declare const paginationLabels: Readonly<PaginationLabels>;
|
|
56
|
+
export interface PaginationNavProps extends PaginationProps {
|
|
57
|
+
"aria-label"?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare const Pagination: (props?: PaginationNavProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
36
60
|
export declare const PaginationContent: (props?: PaginationProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
37
61
|
export declare const PaginationItem: (props?: PaginationProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
38
62
|
export interface PaginationLinkProps {
|
|
@@ -56,10 +80,18 @@ export interface PaginationLinkProps {
|
|
|
56
80
|
* work with JavaScript off.
|
|
57
81
|
*/
|
|
58
82
|
export declare const PaginationLink: (props?: PaginationLinkProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
59
|
-
|
|
83
|
+
/**
|
|
84
|
+
* `aria-label` replaces the accessible name, as upstream's prop spread lets it.
|
|
85
|
+
* `children` replaces the visible word and keeps the arrow — upstream writes
|
|
86
|
+
* that word in the file, which an app owning its copy can edit and a package
|
|
87
|
+
* cannot.
|
|
88
|
+
*/
|
|
89
|
+
export type PaginationStepProps = Omit<PaginationLinkProps, "size" | "isActive">;
|
|
60
90
|
export declare const PaginationPrevious: (props?: PaginationStepProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
61
91
|
export declare const PaginationNext: (props?: PaginationStepProps | undefined) => import("@c9up/aurora").TemplateResult;
|
|
62
92
|
export interface PaginationEllipsisProps {
|
|
93
|
+
/** The hidden text. Default `"More pages"`. */
|
|
94
|
+
label?: string;
|
|
63
95
|
class?: Reactive<string>;
|
|
64
96
|
}
|
|
65
97
|
/** Stands in for the pages that did not fit — see `pageWindow`. */
|
|
@@ -58,10 +58,19 @@ function range(from, to) {
|
|
|
58
58
|
out.push(value);
|
|
59
59
|
return out;
|
|
60
60
|
}
|
|
61
|
+
/** Frozen: the defaults, not a place to set an app's language from. */
|
|
62
|
+
export const paginationLabels = Object.freeze({
|
|
63
|
+
navigation: "pagination",
|
|
64
|
+
previous: "Previous",
|
|
65
|
+
previousPage: "Go to previous page",
|
|
66
|
+
next: "Next",
|
|
67
|
+
nextPage: "Go to next page",
|
|
68
|
+
morePages: "More pages",
|
|
69
|
+
});
|
|
61
70
|
export const Pagination = component((props) => html `<nav
|
|
62
71
|
data-slot="pagination"
|
|
63
72
|
role="navigation"
|
|
64
|
-
aria-label="
|
|
73
|
+
aria-label="${props["aria-label"] ?? paginationLabels.navigation}"
|
|
65
74
|
class="${() => cn("mx-auto flex w-full justify-center", read(props.class))}"
|
|
66
75
|
>${slot(props.children)}</nav>`);
|
|
67
76
|
export const PaginationContent = component((props) => html `<ul
|
|
@@ -109,20 +118,20 @@ export const PaginationLink = component((props) => {
|
|
|
109
118
|
export const PaginationPrevious = component((props) => PaginationLink({
|
|
110
119
|
...props,
|
|
111
120
|
size: "default",
|
|
112
|
-
"aria-label": "
|
|
121
|
+
"aria-label": props["aria-label"] ?? paginationLabels.previousPage,
|
|
113
122
|
class: () => cn("gap-1 px-2.5 sm:pl-2.5", read(props.class)),
|
|
114
|
-
children: html `${ChevronLeftIcon({})}<span class="hidden sm:block"
|
|
123
|
+
children: html `${ChevronLeftIcon({})}<span class="hidden sm:block">${slot(props.children ?? paginationLabels.previous)}</span>`,
|
|
115
124
|
}));
|
|
116
125
|
export const PaginationNext = component((props) => PaginationLink({
|
|
117
126
|
...props,
|
|
118
127
|
size: "default",
|
|
119
|
-
"aria-label": "
|
|
128
|
+
"aria-label": props["aria-label"] ?? paginationLabels.nextPage,
|
|
120
129
|
class: () => cn("gap-1 px-2.5 sm:pr-2.5", read(props.class)),
|
|
121
|
-
children: html `<span class="hidden sm:block"
|
|
130
|
+
children: html `<span class="hidden sm:block">${slot(props.children ?? paginationLabels.next)}</span>${ChevronRightIcon({})}`,
|
|
122
131
|
}));
|
|
123
132
|
/** Stands in for the pages that did not fit — see `pageWindow`. */
|
|
124
133
|
export const PaginationEllipsis = component((props) => html `<span
|
|
125
134
|
data-slot="pagination-ellipsis"
|
|
126
135
|
aria-hidden="true"
|
|
127
136
|
class="${() => cn("flex size-9 items-center justify-center", read(props.class))}"
|
|
128
|
-
>${MoreHorizontalIcon({ class: "size-4" })}<span class="sr-only"
|
|
137
|
+
>${MoreHorizontalIcon({ class: "size-4" })}<span class="sr-only">${props.label ?? paginationLabels.morePages}</span></span>`);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PieceMap — a transfer drawn as one small square per piece.
|
|
3
|
+
*
|
|
4
|
+
* What a torrent client shows under a download: each square is a piece of the
|
|
5
|
+
* whole, coloured by where it stands — here, missing, on its way, taken from a
|
|
6
|
+
* peer. A progress bar says how much; the map says *which*, and that is what
|
|
7
|
+
* a stalled run, a missing layer or a peer serving one half shows at a glance.
|
|
8
|
+
*
|
|
9
|
+
* The states are the caller's, not a fixed set. A download, a replication and
|
|
10
|
+
* a backup do not have the same ones, so the component takes a string type of
|
|
11
|
+
* its own and a class per state — `tones` — and paints nothing it was not
|
|
12
|
+
* told about. The legend reads the same `tones`, so a square and its key can
|
|
13
|
+
* never drift apart.
|
|
14
|
+
*
|
|
15
|
+
* Pieces come in groups: each group after the first is set off by a rule — a
|
|
16
|
+
* torrent's files, an image's layers. A flat map is one group.
|
|
17
|
+
*
|
|
18
|
+
* A generic function rather than `component<P>`, as DataTable: `State` has to
|
|
19
|
+
* stay open so `tones` is checked against the caller's own states.
|
|
20
|
+
*
|
|
21
|
+
* With a `label`, the map is one image to assistive technology and the label
|
|
22
|
+
* is what it says ("12 of 40 pieces"): a screen reader walking hundreds of
|
|
23
|
+
* squares one by one learns nothing the sentence does not. Each square keeps
|
|
24
|
+
* its `title` for the pointer.
|
|
25
|
+
*/
|
|
26
|
+
import { type TemplateResult } from "@c9up/aurora";
|
|
27
|
+
import type { Child } from "../lib/children.js";
|
|
28
|
+
import { type VariantProps } from "../lib/cva.js";
|
|
29
|
+
import { type Reactive } from "../lib/props.js";
|
|
30
|
+
export declare const pieceVariants: (props?: (import("../index.js").VariantSelection<{
|
|
31
|
+
size: {
|
|
32
|
+
sm: string;
|
|
33
|
+
default: string;
|
|
34
|
+
lg: string;
|
|
35
|
+
};
|
|
36
|
+
}> & import("../index.js").ClassOverrides) | undefined) => string;
|
|
37
|
+
export type PieceVariants = VariantProps<typeof pieceVariants>;
|
|
38
|
+
export interface Piece<State extends string> {
|
|
39
|
+
state: State;
|
|
40
|
+
/** The square's tooltip: which piece, how big, from where. */
|
|
41
|
+
title?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface PieceMapProps<State extends string> {
|
|
44
|
+
/**
|
|
45
|
+
* The pieces, group after group, or an accessor for pieces that change: the
|
|
46
|
+
* squares are drawn again whenever what it reads changes.
|
|
47
|
+
*/
|
|
48
|
+
groups: Reactive<readonly (readonly Piece<State>[])[]>;
|
|
49
|
+
/** The classes that paint each state: a background, a border, a pulse. */
|
|
50
|
+
tones: Readonly<Record<State, string>>;
|
|
51
|
+
size?: Reactive<PieceVariants["size"]>;
|
|
52
|
+
/** What the map says as a whole. Makes it one image; see above. */
|
|
53
|
+
label?: Reactive<string | undefined>;
|
|
54
|
+
class?: Reactive<string>;
|
|
55
|
+
}
|
|
56
|
+
export declare function PieceMap<State extends string>(props: PieceMapProps<State>): TemplateResult;
|
|
57
|
+
export interface PieceMapLegendItem<State extends string> {
|
|
58
|
+
state: State;
|
|
59
|
+
label: Child;
|
|
60
|
+
}
|
|
61
|
+
export interface PieceMapLegendProps<State extends string> {
|
|
62
|
+
/** The same `tones` as the map's. */
|
|
63
|
+
tones: Readonly<Record<State, string>>;
|
|
64
|
+
/** The states to explain, in the order they are read. */
|
|
65
|
+
items: readonly PieceMapLegendItem<State>[];
|
|
66
|
+
/** Said before the keys — the size of the whole, say. */
|
|
67
|
+
children?: Child;
|
|
68
|
+
size?: Reactive<PieceVariants["size"]>;
|
|
69
|
+
class?: Reactive<string>;
|
|
70
|
+
}
|
|
71
|
+
/** What the squares' colours mean. */
|
|
72
|
+
export declare function PieceMapLegend<State extends string>(props: PieceMapLegendProps<State>): TemplateResult;
|