@websublime/line-components 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 +53 -0
- package/custom-elements.json +1009 -33
- package/dist/separator/index.d.ts +3 -0
- package/dist/separator/index.d.ts.map +1 -0
- package/dist/separator/index.js +62 -0
- package/dist/separator/index.js.map +1 -0
- package/dist/separator/separator.d.ts +32 -0
- package/dist/separator/separator.d.ts.map +1 -0
- package/dist/separator/separator.types.d.ts +3 -0
- package/dist/separator/separator.types.d.ts.map +1 -0
- package/dist/stack/index.d.ts +3 -0
- package/dist/stack/index.d.ts.map +1 -0
- package/dist/stack/index.js +155 -0
- package/dist/stack/index.js.map +1 -0
- package/dist/stack/stack.d.ts +37 -0
- package/dist/stack/stack.d.ts.map +1 -0
- package/dist/stack/stack.types.d.ts +9 -0
- package/dist/stack/stack.types.d.ts.map +1 -0
- package/package.json +9 -1
- package/src/separator/index.ts +3 -0
- package/src/separator/separator.ts +93 -0
- package/src/separator/separator.types.ts +2 -0
- package/src/stack/index.ts +3 -0
- package/src/stack/stack.ts +169 -0
- package/src/stack/stack.types.ts +11 -0
package/README.md
CHANGED
|
@@ -6,9 +6,62 @@ that registers one tag, and the root entry registers nothing.
|
|
|
6
6
|
| Subpath | Registers |
|
|
7
7
|
|---------|-----------|
|
|
8
8
|
| `@websublime/line-components/button` | `<line-button>` |
|
|
9
|
+
| `@websublime/line-components/separator` | `<line-separator>` |
|
|
10
|
+
| `@websublime/line-components/stack` | `<line-stack>` |
|
|
9
11
|
|
|
10
12
|
```js
|
|
11
13
|
import '@websublime/line-components/button';
|
|
12
14
|
```
|
|
13
15
|
|
|
14
16
|
The package ships `custom-elements.json`, the Custom Elements Manifest of every component.
|
|
17
|
+
|
|
18
|
+
## Stack
|
|
19
|
+
|
|
20
|
+
`<line-stack>` lays out its children in one row or one column with a gap between them. The host is the flex
|
|
21
|
+
container, it adds no role, and it exposes no `::part()`; style it directly with `line-stack { … }`.
|
|
22
|
+
|
|
23
|
+
| Attribute | Values | Default |
|
|
24
|
+
|-----------|--------|---------|
|
|
25
|
+
| `orientation` | `vertical`, `horizontal` | `vertical` |
|
|
26
|
+
| `justify` | `start`, `center`, `end`, `spaceBetween`, `spaceAround`, `spaceEvenly`, `stretch` (every item grows) | `start` |
|
|
27
|
+
| `align` | `start`, `center`, `end`, `stretch` | `stretch` |
|
|
28
|
+
| `gap` | `0`–`5` on the `--line-layout-gap-*` scale | step `2` |
|
|
29
|
+
| `wrap` | boolean | off |
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<line-stack orientation="horizontal" justify="spaceBetween" align="center" gap="3">
|
|
33
|
+
<span>Title</span>
|
|
34
|
+
<line-button>Edit</line-button>
|
|
35
|
+
</line-stack>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The gap reads `--line-stack-gap`, so load `@websublime/line-tokens/sizing` and `@websublime/line-tokens/layouts`
|
|
39
|
+
or set `--line-stack-gap` yourself; without them the gap is `0`. For a list, put `role="list"` on the host and
|
|
40
|
+
`role="listitem"` on each child.
|
|
41
|
+
|
|
42
|
+
## Separator
|
|
43
|
+
|
|
44
|
+
`<line-separator>` draws a thin line between sections of content. The host is the line, it renders nothing
|
|
45
|
+
inside, and it exposes no `::part()`; style it directly with `line-separator { … }`. It adds no margin, so the
|
|
46
|
+
surrounding layout, such as a `<line-stack>` `gap`, spaces it.
|
|
47
|
+
|
|
48
|
+
| Attribute | Values | Default |
|
|
49
|
+
|-----------|--------|---------|
|
|
50
|
+
| `orientation` | `horizontal`, `vertical` | `horizontal` |
|
|
51
|
+
| `decorative` | boolean | off |
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<line-separator></line-separator>
|
|
55
|
+
<line-stack orientation="horizontal" align="center">
|
|
56
|
+
<a href="/docs">Docs</a>
|
|
57
|
+
<line-separator orientation="vertical"></line-separator>
|
|
58
|
+
<a href="/blog">Blog</a>
|
|
59
|
+
</line-stack>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Assistive technology announces it as a separator, with the host `aria-label` as its name when one is set. The
|
|
63
|
+
role and orientation are `ElementInternals` defaults, so an author `role` or `aria-*` attribute wins. Set
|
|
64
|
+
`decorative` when the line only adds visual rhythm, so assistive technology skips it, and give a decorative
|
|
65
|
+
separator no `aria-label`. The line is a border side coloured by `--line-separator-color` (default
|
|
66
|
+
`var(--line-gray-6, currentColor)`) and as thick as `--line-separator-thickness` (default
|
|
67
|
+
`var(--line-border-1, 1px)`), so it stays visible without `line-themes`, `line-tokens` and in forced-colors mode.
|