@k8ordo/ui 1.0.0 → 2.0.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/README.md +37 -12
- package/dist/components/ai/conversation/conversation.d.mts +8 -10
- package/dist/components/ai/conversation/conversation.mjs +1 -6
- package/dist/components/ai/conversation/index.d.mts +15 -1
- package/dist/components/ai/conversation/index.mjs +8 -1
- package/dist/components/ai/index.d.mts +5 -9
- package/dist/components/ai/index.mjs +4 -4
- package/dist/components/ai/message/index.d.mts +12 -1
- package/dist/components/ai/message/index.mjs +7 -1
- package/dist/components/ai/message/message.d.mts +3 -5
- package/dist/components/ai/message/message.mjs +1 -5
- package/dist/components/ai/prompt-input/index.d.mts +23 -1
- package/dist/components/ai/prompt-input/index.mjs +8 -1
- package/dist/components/ai/prompt-input/prompt-input.d.mts +4 -6
- package/dist/components/ai/prompt-input/prompt-input.mjs +1 -6
- package/dist/components/ai/suggestion/index.d.mts +13 -1
- package/dist/components/ai/suggestion/index.mjs +7 -1
- package/dist/components/ai/suggestion/suggestion.d.mts +3 -5
- package/dist/components/ai/suggestion/suggestion.mjs +1 -5
- package/dist/components/buttons/icon-button/icon-button.mjs +1 -1
- package/dist/components/form/checkbox/checkbox.d.mts +1 -0
- package/dist/components/form/checkbox/checkbox.mjs +3 -2
- package/dist/components/form/checkbox-group/index.d.mts +1 -0
- package/dist/components/form/file-field/file-field.d.mts +12 -15
- package/dist/components/form/file-field/file-field.mjs +1 -6
- package/dist/components/form/file-field/index.d.mts +17 -1
- package/dist/components/form/file-field/index.mjs +8 -1
- package/dist/components/form/radio/radio.d.mts +1 -0
- package/dist/components/form/radio/radio.mjs +3 -2
- package/dist/components/index.d.mts +15 -21
- package/dist/components/index.mjs +7 -7
- package/dist/components/navigation/anchor/anchor.mjs +1 -1
- package/dist/components/navigation/tabs/index.d.mts +19 -1
- package/dist/components/navigation/tabs/index.mjs +9 -1
- package/dist/components/navigation/tabs/tabs.d.mts +16 -18
- package/dist/components/navigation/tabs/tabs.mjs +1 -7
- package/dist/components/overlays/dialog/dialog.d.mts +12 -16
- package/dist/components/overlays/dialog/dialog.mjs +1 -6
- package/dist/components/overlays/dialog/index.d.mts +17 -1
- package/dist/components/overlays/dialog/index.mjs +8 -1
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +20 -24
- package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +2 -11
- package/dist/components/overlays/dropdown-menu/index.d.mts +31 -1
- package/dist/components/overlays/dropdown-menu/index.mjs +12 -1
- package/dist/components/overlays/dropdown-menu/sub-menu.mjs +1 -1
- package/dist/components/overlays/list-box/index.d.mts +27 -1
- package/dist/components/overlays/list-box/index.mjs +9 -1
- package/dist/components/overlays/list-box/list-box.d.mts +20 -22
- package/dist/components/overlays/list-box/list-box.mjs +2 -8
- package/dist/components/overlays/popover/index.d.mts +24 -1
- package/dist/components/overlays/popover/index.mjs +8 -1
- package/dist/components/overlays/popover/popover.d.mts +18 -20
- package/dist/components/overlays/popover/popover.mjs +2 -7
- package/dist/components/overlays/tooltip/index.d.mts +21 -1
- package/dist/components/overlays/tooltip/index.mjs +8 -1
- package/dist/components/overlays/tooltip/tooltip.d.mts +18 -22
- package/dist/components/overlays/tooltip/tooltip.mjs +2 -7
- package/dist/hooks/index.d.mts +1 -4
- package/dist/hooks/index.mjs +2 -5
- package/dist/index.d.mts +13 -15
- package/dist/index.mjs +9 -12
- package/dist/integrations/_shared/renderers.mjs +7 -7
- package/dist/integrations/_shared/schemas.d.mts +1 -1
- package/dist/{hooks/focus-trap/index.d.mts → internal/focus-trap.d.mts} +1 -1
- package/dist/{hooks/focus-trap/index.mjs → internal/focus-trap.mjs} +1 -1
- package/dist/styles/index.css +0 -8
- package/docs/GUIDE.md +148 -133
- package/docs/llms.txt +11 -7
- package/docs/props.generated.json +18 -0
- package/docs/references/ai-chat.md +67 -67
- package/docs/references/color.md +108 -107
- package/docs/references/components.md +318 -310
- package/docs/references/generative-ui.md +51 -30
- package/docs/references/helpers.md +155 -52
- package/docs/references/hooks.md +61 -74
- package/docs/references/interaction-design.md +47 -47
- package/docs/references/spatial-design.md +83 -81
- package/docs/references/typography.md +68 -67
- package/package.json +32 -33
- package/dist/hooks/hash/index.d.mts +0 -4
- package/dist/hooks/hash/index.mjs +0 -25
- package/dist/hooks/local-storage/index.d.mts +0 -4
- package/dist/hooks/local-storage/index.mjs +0 -46
- package/dist/hooks/session-storage/index.d.mts +0 -4
- package/dist/hooks/session-storage/index.mjs +0 -46
|
@@ -1,137 +1,139 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Spacing and layout
|
|
2
2
|
|
|
3
|
-
k8ordo
|
|
3
|
+
`@k8ordo/ui` is a design that lets the spacing speak. Do not pack things in;
|
|
4
|
+
leave room.
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## Spacing principles
|
|
6
7
|
|
|
7
|
-
4pt
|
|
8
|
+
A 4pt spacing system, using Tailwind's standard scale.
|
|
8
9
|
|
|
9
|
-
###
|
|
10
|
+
### Padding inside a component
|
|
10
11
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
12
|
+
| Use | Class | Value |
|
|
13
|
+
| ----------------- | ------ | ----- |
|
|
14
|
+
| Compact | `p-4` | 16px |
|
|
15
|
+
| Standard | `p-6` | 24px |
|
|
16
|
+
| Generous | `p-8` | 32px |
|
|
17
|
+
| Inside a big card | `p-10` | 40px |
|
|
17
18
|
|
|
18
|
-
###
|
|
19
|
+
### Spacing between blocks of text
|
|
19
20
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
21
|
+
| Relationship | Class | Use |
|
|
22
|
+
| ---------------------- | ------- | --------------------------------------- |
|
|
23
|
+
| Closely related | `mt-2` | Descriptions, help text |
|
|
24
|
+
| Standard | `mt-4` | Between paragraphs, between form fields |
|
|
25
|
+
| Between sections | `mt-8` | A section break |
|
|
26
|
+
| Between major sections | `mt-12` | A page-level break |
|
|
26
27
|
|
|
27
|
-
###
|
|
28
|
+
### Spacing between sections
|
|
28
29
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
30
|
+
| Relationship | Class | Use |
|
|
31
|
+
| ---------------- | ------------------ | ------------------------------ |
|
|
32
|
+
| Between cards | `gap-6` | Cards side by side (in a grid) |
|
|
33
|
+
| Between sections | `gap-8` – `gap-10` | Sections stacked vertically |
|
|
33
34
|
|
|
34
|
-
##
|
|
35
|
+
## Border radius
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
**"Soft where you touch, precise where you read."**
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
Vary the radius with the element's role.
|
|
39
40
|
|
|
40
|
-
###
|
|
41
|
+
### Things you touch (soft)
|
|
41
42
|
|
|
42
|
-
|
|
|
43
|
-
| ----------------------------- | -------------- |
|
|
44
|
-
| Button | `rounded-full` |
|
|
45
|
-
| Input, Textarea, Select | `rounded-xl` | 1rem
|
|
46
|
-
| Card, CheckboxCard, RadioCard | `rounded-xl` | 1rem
|
|
43
|
+
| Use | Class | Value |
|
|
44
|
+
| ----------------------------- | -------------- | ----- |
|
|
45
|
+
| Button | `rounded-full` | Pill |
|
|
46
|
+
| Input, Textarea, Select | `rounded-xl` | 1rem |
|
|
47
|
+
| Card, CheckboxCard, RadioCard | `rounded-xl` | 1rem |
|
|
47
48
|
|
|
48
|
-
###
|
|
49
|
+
### Things you read (precise)
|
|
49
50
|
|
|
50
|
-
|
|
|
51
|
-
| -------- | -------------- |
|
|
52
|
-
| Alert | `rounded-lg` | 0.75rem
|
|
53
|
-
| Badge | `rounded-full` |
|
|
54
|
-
| Tabs |
|
|
55
|
-
| Checkbox | `rounded-md` | 0.5rem
|
|
51
|
+
| Use | Class | Value |
|
|
52
|
+
| -------- | -------------- | ------------------------------ |
|
|
53
|
+
| Alert | `rounded-lg` | 0.75rem |
|
|
54
|
+
| Badge | `rounded-full` | Pill (fine, since it is small) |
|
|
55
|
+
| Tabs | As-is | |
|
|
56
|
+
| Checkbox | `rounded-md` | 0.5rem |
|
|
56
57
|
|
|
57
|
-
###
|
|
58
|
+
### Everything else
|
|
58
59
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
| Dialog, Modal
|
|
62
|
-
| Avatar, IconButton,
|
|
60
|
+
| Use | Class |
|
|
61
|
+
| -------------------------------- | -------------- |
|
|
62
|
+
| Dialog, Modal | `rounded-lg` |
|
|
63
|
+
| Avatar, IconButton, progress bar | `rounded-full` |
|
|
63
64
|
|
|
64
|
-
##
|
|
65
|
+
## Shadow
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
Express depth with a soft, gentle shadow.
|
|
67
68
|
|
|
68
|
-
|
|
|
69
|
-
| ------------------------ |
|
|
70
|
-
| Card
|
|
71
|
-
| Card
|
|
72
|
-
| Modal / Dialog / Tooltip | `shadow-md`
|
|
73
|
-
| Dropdown / ListBox | `shadow-md`
|
|
74
|
-
| Button |
|
|
69
|
+
| Use | Style |
|
|
70
|
+
| ------------------------ | ---------------------------------------------------------- |
|
|
71
|
+
| Card (default) | `shadow-sm` (with `appearance="shadow"`) |
|
|
72
|
+
| Card (bordered) | `border border-border-mute` (with `appearance="bordered"`) |
|
|
73
|
+
| Modal / Dialog / Tooltip | `shadow-md` |
|
|
74
|
+
| Dropdown / ListBox | `shadow-md` |
|
|
75
|
+
| Button | None |
|
|
75
76
|
|
|
76
|
-
`shadow-xl`
|
|
77
|
+
Never use `shadow-xl` or heavier.
|
|
77
78
|
|
|
78
|
-
##
|
|
79
|
+
## Page structure
|
|
79
80
|
|
|
80
|
-
### bg-subtle
|
|
81
|
+
### The bg-subtle plus white card pattern
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
Make the page background `bg-bg-subtle` (a light grey) and float the content on
|
|
84
|
+
white cards.
|
|
83
85
|
|
|
84
86
|
```tsx
|
|
85
|
-
// Good:
|
|
87
|
+
// Good: a white card floating on a grey ground
|
|
86
88
|
<div className="bg-bg-subtle min-h-screen">
|
|
87
89
|
<Card appearance="shadow">
|
|
88
|
-
<div className="p-8"
|
|
90
|
+
<div className="p-8">Content</div>
|
|
89
91
|
</Card>
|
|
90
92
|
</div>
|
|
91
93
|
```
|
|
92
94
|
|
|
93
|
-
###
|
|
95
|
+
### Build hierarchy out of spacing
|
|
94
96
|
|
|
95
97
|
```tsx
|
|
96
|
-
// Good:
|
|
98
|
+
// Good: the size of the gap shows how related things are
|
|
97
99
|
<section className="mt-12">
|
|
98
|
-
<Heading level="h2"
|
|
99
|
-
<p className="mt-2"
|
|
100
|
-
<div className="mt-8"
|
|
100
|
+
<Heading level="h2">Section</Heading>
|
|
101
|
+
<p className="mt-2">A description that belongs to it</p>
|
|
102
|
+
<div className="mt-8">Content that sits a little apart</div>
|
|
101
103
|
</section>
|
|
102
104
|
|
|
103
|
-
// Bad:
|
|
105
|
+
// Bad: the same gap everywhere
|
|
104
106
|
<section className="mt-4">
|
|
105
|
-
<Heading level="h2"
|
|
106
|
-
<p className="mt-4"
|
|
107
|
-
<div className="mt-4"
|
|
107
|
+
<Heading level="h2">Section</Heading>
|
|
108
|
+
<p className="mt-4">Description</p>
|
|
109
|
+
<div className="mt-4">Content</div>
|
|
108
110
|
</section>
|
|
109
111
|
```
|
|
110
112
|
|
|
111
|
-
###
|
|
113
|
+
### A card is not the answer to everything
|
|
112
114
|
|
|
113
|
-
|
|
115
|
+
Content does not have to go in a card. Spacing and a separator are often enough.
|
|
114
116
|
|
|
115
117
|
```tsx
|
|
116
118
|
import { Separator } from '@k8ordo/ui';
|
|
117
119
|
|
|
118
|
-
// Good:
|
|
120
|
+
// Good: divide with a separator
|
|
119
121
|
<div>
|
|
120
|
-
<section
|
|
122
|
+
<section>Content A</section>
|
|
121
123
|
<div className="py-8">
|
|
122
124
|
<Separator />
|
|
123
125
|
</div>
|
|
124
|
-
<section
|
|
126
|
+
<section>Content B</section>
|
|
125
127
|
</div>
|
|
126
128
|
|
|
127
|
-
//
|
|
128
|
-
<Card
|
|
129
|
-
<Card
|
|
129
|
+
// Excessive: everything in a card
|
|
130
|
+
<Card>Content A</Card>
|
|
131
|
+
<Card>Content B</Card>
|
|
130
132
|
```
|
|
131
133
|
|
|
132
|
-
##
|
|
134
|
+
## What not to do
|
|
133
135
|
|
|
134
|
-
- `gap-1`
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
136
|
+
- Extremely tight spacing such as `gap-1` or `p-1`
|
|
137
|
+
- Cramming content in (space wins over information density)
|
|
138
|
+
- Nested cards (Card in Card)
|
|
139
|
+
- A z-index above 12
|
|
@@ -1,110 +1,111 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Typography
|
|
2
2
|
|
|
3
|
-
k8ordo
|
|
3
|
+
Typography in `@k8ordo/ui` aims for readability and quiet at the same time.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Font family
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A font stack tuned for Japanese.
|
|
8
8
|
|
|
9
9
|
```css
|
|
10
10
|
font-family: 'Noto Sans JP', 'M PLUS 2', sans-serif;
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
- **Inter / Roboto / Open Sans
|
|
14
|
-
-
|
|
13
|
+
- **Do not use Inter / Roboto / Open Sans** — they read as AI-generated
|
|
14
|
+
- Japanese text dominates, so Japanese faces come first
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Font size scale
|
|
17
17
|
|
|
18
|
-
| Tailwind
|
|
19
|
-
| ---------------- | -------- |
|
|
20
|
-
| `text-xs` | 0.75rem |
|
|
21
|
-
| `text-sm` | 0.875rem |
|
|
22
|
-
| `text-md` | 1rem |
|
|
23
|
-
| `text-lg` | 1.125rem |
|
|
24
|
-
| `text-xl` | 1.25rem |
|
|
25
|
-
| `text-2xl` | 1.5rem |
|
|
26
|
-
| `text-3xl` | 1.875rem |
|
|
27
|
-
| `text-emphasize` | 3rem |
|
|
28
|
-
| `text-highlight` | 6rem |
|
|
18
|
+
| Tailwind class | Value | Use |
|
|
19
|
+
| ---------------- | -------- | ----------------------- |
|
|
20
|
+
| `text-xs` | 0.75rem | Annotations, captions |
|
|
21
|
+
| `text-sm` | 0.875rem | Supporting text, labels |
|
|
22
|
+
| `text-md` | 1rem | Body text (default) |
|
|
23
|
+
| `text-lg` | 1.125rem | Subheadings |
|
|
24
|
+
| `text-xl` | 1.25rem | Headings |
|
|
25
|
+
| `text-2xl` | 1.5rem | Large headings |
|
|
26
|
+
| `text-3xl` | 1.875rem | Page titles |
|
|
27
|
+
| `text-emphasize` | 3rem | Emphasis display |
|
|
28
|
+
| `text-highlight` | 6rem | Highlight display |
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Font weight
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Use weight sparingly. Heavy type undermines the quiet.
|
|
33
33
|
|
|
34
|
-
| Tailwind
|
|
35
|
-
|
|
|
36
|
-
| `font-normal`
|
|
37
|
-
| `font-medium`
|
|
38
|
-
| `font-bold`
|
|
34
|
+
| Tailwind class | Value | Use |
|
|
35
|
+
| -------------- | ----- | ------------------------------------- |
|
|
36
|
+
| `font-normal` | 400 | Body text |
|
|
37
|
+
| `font-medium` | 450 | Emphasized text (restrained emphasis) |
|
|
38
|
+
| `font-bold` | 700 | Headings, button labels |
|
|
39
39
|
|
|
40
|
-
- `font-semibold` (600)
|
|
41
|
-
- `font-medium`
|
|
40
|
+
- Do not use `font-semibold` (600) or `font-extrabold` (800)
|
|
41
|
+
- Note that `font-medium` is 450 here — lighter than the usual 500
|
|
42
42
|
|
|
43
|
-
##
|
|
43
|
+
## Line height
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Japanese text needs more leading than Latin text.
|
|
46
46
|
|
|
47
|
-
| Tailwind
|
|
48
|
-
| ----------------- | ----- |
|
|
49
|
-
| `leading-none` | 1 |
|
|
50
|
-
| `leading-tight` | 1.25 |
|
|
51
|
-
| `leading-snug` | 1.375 |
|
|
52
|
-
| `leading-normal` | 1.5 |
|
|
53
|
-
| `leading-relaxed` | 1.625 |
|
|
54
|
-
| `leading-loose` | 2 |
|
|
47
|
+
| Tailwind class | Value | Use |
|
|
48
|
+
| ----------------- | ----- | ------------------------------- |
|
|
49
|
+
| `leading-none` | 1 | Special cases (highlight, …) |
|
|
50
|
+
| `leading-tight` | 1.25 | Headings |
|
|
51
|
+
| `leading-snug` | 1.375 | Subheadings |
|
|
52
|
+
| `leading-normal` | 1.5 | Inside lists; the default |
|
|
53
|
+
| `leading-relaxed` | 1.625 | Body text (recommended) |
|
|
54
|
+
| `leading-loose` | 2 | When wide leading is called for |
|
|
55
55
|
|
|
56
|
-
##
|
|
56
|
+
## Letter spacing
|
|
57
57
|
|
|
58
|
-
| Tailwind
|
|
59
|
-
| ----------------- | ------- |
|
|
60
|
-
| `tracking-none` | 0em |
|
|
61
|
-
| `tracking-normal` | 0.025em |
|
|
58
|
+
| Tailwind class | Value | Use |
|
|
59
|
+
| ----------------- | ------- | --------------------------- |
|
|
60
|
+
| `tracking-none` | 0em | Default |
|
|
61
|
+
| `tracking-normal` | 0.025em | When a little air is wanted |
|
|
62
62
|
|
|
63
|
-
## Heading
|
|
63
|
+
## The Heading component
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Use the `Heading` component for headings.
|
|
66
66
|
|
|
67
67
|
```tsx
|
|
68
68
|
import { Heading } from '@k8ordo/ui';
|
|
69
69
|
|
|
70
|
-
<Heading level="h1"
|
|
71
|
-
<Heading level="h2"
|
|
72
|
-
<Heading level="h3"
|
|
70
|
+
<Heading level="h1">Page title</Heading>
|
|
71
|
+
<Heading level="h2">Section heading</Heading>
|
|
72
|
+
<Heading level="h3">Subsection</Heading>
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
##
|
|
75
|
+
## Vertical writing mode
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
Dedicated utilities and a variant are provided for vertical writing.
|
|
78
78
|
|
|
79
|
-
###
|
|
79
|
+
### Utilities
|
|
80
80
|
|
|
81
|
-
| Tailwind
|
|
82
|
-
|
|
|
83
|
-
| `writing-h`
|
|
84
|
-
| `writing-v`
|
|
81
|
+
| Tailwind class | Use |
|
|
82
|
+
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
83
|
+
| `writing-h` | Return to horizontal (`writing-mode: horizontal-tb`). Use it for figures, code blocks, and replaced elements inside a vertical tree. |
|
|
84
|
+
| `writing-v` | Apply vertical writing (`writing-mode: vertical-rl`) together with the recommended defaults such as `text-orientation: mixed`. |
|
|
85
85
|
|
|
86
|
-
### `vertical:` variant
|
|
86
|
+
### The `vertical:` variant
|
|
87
87
|
|
|
88
|
-
`.writing-v`
|
|
88
|
+
A Tailwind variant that activates inside a `.writing-v` subtree and is disabled
|
|
89
|
+
inside `.writing-h`. It lets you override a horizontal default declaratively.
|
|
89
90
|
|
|
90
91
|
```tsx
|
|
91
92
|
<div className="writing-v">
|
|
92
93
|
<p className="my-4 vertical:my-0">
|
|
93
|
-
{/*
|
|
94
|
+
{/* Vertical margin only in horizontal mode; dropped when vertical */}
|
|
94
95
|
</p>
|
|
95
96
|
</div>
|
|
96
97
|
```
|
|
97
98
|
|
|
98
|
-
###
|
|
99
|
+
### Caveats
|
|
99
100
|
|
|
100
|
-
-
|
|
101
|
-
- `-webkit-line-clamp` (`line-clamp-*`)
|
|
102
|
-
- KaTeX
|
|
101
|
+
- Replaced elements such as images and iframes may not size as expected under `vertical-rl`. Return the element itself to horizontal, as in `<img className="vertical:writing-h" />`.
|
|
102
|
+
- `-webkit-line-clamp` (`line-clamp-*`) conflicts with `writing-mode` in Safari. In vertical mode, replace it with a `block-size` cap plus `overflow: hidden`.
|
|
103
|
+
- Libraries that assume horizontal layout internally, such as KaTeX, need `writing-h` applied only where required.
|
|
103
104
|
|
|
104
|
-
##
|
|
105
|
+
## What not to do
|
|
105
106
|
|
|
106
|
-
-
|
|
107
|
-
- `text-3xl`
|
|
108
|
-
- `uppercase`
|
|
109
|
-
-
|
|
110
|
-
-
|
|
107
|
+
- Use three or more font weights on one screen
|
|
108
|
+
- Use anything larger than `text-3xl` for ordinary text (`text-emphasize` and `text-highlight` are for special cases)
|
|
109
|
+
- Apply `uppercase` or `tracking-widest` to Japanese text
|
|
110
|
+
- Apply a gradient to text
|
|
111
|
+
- Build hierarchy from font size alone — use spacing as well
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k8ordo/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "k8o's React UI library with built-in generative UI adapters (json-render & OpenUI) for LLM-driven, on-brand interfaces",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"url": "git+https://github.com/k35o/k8ordo.git"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
-
"CHANGELOG.md",
|
|
30
29
|
"dist/**",
|
|
31
30
|
"docs/**"
|
|
32
31
|
],
|
|
@@ -83,24 +82,6 @@
|
|
|
83
82
|
"access": "public",
|
|
84
83
|
"registry": "https://registry.npmjs.org"
|
|
85
84
|
},
|
|
86
|
-
"scripts": {
|
|
87
|
-
"build": "vp pack && pnpm build:css",
|
|
88
|
-
"build:css": "node scripts/build-css.ts",
|
|
89
|
-
"generate:tokens": "tailwind-token-extractor src/styles/index.css -o src/styles/tokens.generated.ts",
|
|
90
|
-
"check:tokens": "tailwind-token-extractor check src/styles/index.css -o src/styles/tokens.generated.ts",
|
|
91
|
-
"generate:props": "node scripts/extract-props.ts && node scripts/generate-components-md.ts",
|
|
92
|
-
"check:props": "node scripts/extract-props.ts --check && node scripts/generate-components-md.ts --check",
|
|
93
|
-
"check:package": "publint && attw --pack . --profile esm-only --exclude-entrypoints ./styles.css ./tailwind.css",
|
|
94
|
-
"storybook": "storybook dev -p 6006 --no-open",
|
|
95
|
-
"build-storybook": "storybook build",
|
|
96
|
-
"test:vrt": "VRT=1 vitest run --project=components",
|
|
97
|
-
"test": "vitest run",
|
|
98
|
-
"test:ui": "vitest --ui --coverage",
|
|
99
|
-
"test:coverage": "vitest run --coverage",
|
|
100
|
-
"typecheck": "tsc --noEmit",
|
|
101
|
-
"check": "vp check",
|
|
102
|
-
"check:write": "vp check --fix"
|
|
103
|
-
},
|
|
104
85
|
"dependencies": {
|
|
105
86
|
"clsx": "2.1.1",
|
|
106
87
|
"lucide-react": "1.31.0",
|
|
@@ -118,29 +99,29 @@
|
|
|
118
99
|
"@storybook/addon-mcp": "0.7.0",
|
|
119
100
|
"@storybook/addon-vitest": "10.5.8",
|
|
120
101
|
"@storybook/react-vite": "10.5.8",
|
|
121
|
-
"@tailwindcss/postcss": "
|
|
122
|
-
"@types/react": "
|
|
123
|
-
"@types/react-dom": "
|
|
124
|
-
"@vitejs/plugin-react": "
|
|
102
|
+
"@tailwindcss/postcss": "4.3.3",
|
|
103
|
+
"@types/react": "19.2.18",
|
|
104
|
+
"@types/react-dom": "19.2.4",
|
|
105
|
+
"@vitejs/plugin-react": "6.0.5",
|
|
125
106
|
"@vitest/browser-playwright": "4.1.10",
|
|
126
107
|
"@vitest/coverage-v8": "4.1.10",
|
|
127
108
|
"@vitest/ui": "4.1.10",
|
|
128
109
|
"ai": "7.0.65",
|
|
129
|
-
"postcss": "
|
|
110
|
+
"postcss": "8.5.26",
|
|
130
111
|
"publint": "0.3.23",
|
|
131
|
-
"react": "
|
|
132
|
-
"react-dom": "
|
|
112
|
+
"react": "19.2.8",
|
|
113
|
+
"react-dom": "19.2.8",
|
|
133
114
|
"storybook": "10.5.8",
|
|
134
115
|
"storybook-addon-determinism": "0.1.2",
|
|
135
116
|
"storybook-addon-mock-date": "3.1.1",
|
|
136
117
|
"storybook-addon-vrt": "0.4.0",
|
|
137
118
|
"streamdown": "2.5.0",
|
|
138
119
|
"tailwind-token-extractor": "0.2.1",
|
|
139
|
-
"tailwindcss": "
|
|
120
|
+
"tailwindcss": "4.3.3",
|
|
140
121
|
"typescript": "7.0.2",
|
|
141
|
-
"vite": "
|
|
142
|
-
"vite-plus": "
|
|
143
|
-
"vitest": "
|
|
122
|
+
"vite": "8.2.1",
|
|
123
|
+
"vite-plus": "0.2.9",
|
|
124
|
+
"vitest": "4.1.10",
|
|
144
125
|
"vitest-browser-react": "2.2.0",
|
|
145
126
|
"zod": "4.4.3"
|
|
146
127
|
},
|
|
@@ -157,7 +138,7 @@
|
|
|
157
138
|
"streamdown": ">=2.5.0",
|
|
158
139
|
"tailwindcss": ">=4.3.3",
|
|
159
140
|
"typescript": ">=7.0.2",
|
|
160
|
-
"zod": "
|
|
141
|
+
"zod": "^4.4.3"
|
|
161
142
|
},
|
|
162
143
|
"peerDependenciesMeta": {
|
|
163
144
|
"@json-render/core": {
|
|
@@ -193,5 +174,23 @@
|
|
|
193
174
|
"zod": {
|
|
194
175
|
"optional": true
|
|
195
176
|
}
|
|
177
|
+
},
|
|
178
|
+
"scripts": {
|
|
179
|
+
"build": "vp pack && pnpm build:css",
|
|
180
|
+
"build:css": "node scripts/build-css.ts",
|
|
181
|
+
"generate:tokens": "tailwind-token-extractor src/styles/index.css -o src/styles/tokens.generated.ts",
|
|
182
|
+
"check:tokens": "tailwind-token-extractor check src/styles/index.css -o src/styles/tokens.generated.ts",
|
|
183
|
+
"generate:props": "node scripts/extract-props.ts && node scripts/generate-components-md.ts && node scripts/check-helpers-md.ts",
|
|
184
|
+
"check:props": "node scripts/extract-props.ts --check && node scripts/generate-components-md.ts --check && node scripts/check-helpers-md.ts",
|
|
185
|
+
"check:package": "publint && attw --pack . --profile esm-only --exclude-entrypoints ./styles.css ./tailwind.css",
|
|
186
|
+
"storybook": "storybook dev -p 6006 --no-open",
|
|
187
|
+
"build-storybook": "storybook build",
|
|
188
|
+
"test:vrt": "VRT=1 vitest run --project=components",
|
|
189
|
+
"test": "vitest run",
|
|
190
|
+
"test:ui": "vitest --ui --coverage",
|
|
191
|
+
"test:coverage": "vitest run --coverage",
|
|
192
|
+
"typecheck": "tsc --noEmit",
|
|
193
|
+
"check": "vp check",
|
|
194
|
+
"check:write": "vp check --fix"
|
|
196
195
|
}
|
|
197
|
-
}
|
|
196
|
+
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useSyncExternalStore } from "react";
|
|
3
|
-
//#region src/hooks/hash/index.ts
|
|
4
|
-
const getHash = () => typeof window === "undefined" ? null : decodeURIComponent(window.location.hash.replace("#", ""));
|
|
5
|
-
const subscribe = (callback) => {
|
|
6
|
-
const originalPushState = window.history.pushState.bind(window.history);
|
|
7
|
-
const originalReplaceState = window.history.replaceState.bind(window.history);
|
|
8
|
-
window.history.pushState = (...args) => {
|
|
9
|
-
originalPushState(...args);
|
|
10
|
-
setTimeout(callback);
|
|
11
|
-
};
|
|
12
|
-
window.history.replaceState = (...args) => {
|
|
13
|
-
originalReplaceState(...args);
|
|
14
|
-
setTimeout(callback);
|
|
15
|
-
};
|
|
16
|
-
window.addEventListener("hashchange", callback);
|
|
17
|
-
return () => {
|
|
18
|
-
window.removeEventListener("hashchange", callback);
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
const useHash = () => {
|
|
22
|
-
return useSyncExternalStore(subscribe, () => getHash(), () => null);
|
|
23
|
-
};
|
|
24
|
-
//#endregion
|
|
25
|
-
export { useHash };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useCallback, useMemo, useRef, useSyncExternalStore } from "react";
|
|
3
|
-
//#region src/hooks/local-storage/index.ts
|
|
4
|
-
const dispatchStorageEvent = (key, newValue) => window.dispatchEvent(new StorageEvent("storage", {
|
|
5
|
-
key,
|
|
6
|
-
newValue
|
|
7
|
-
}));
|
|
8
|
-
const getLocalStorageItem = (key) => window.localStorage.getItem(key);
|
|
9
|
-
const localStorageSubscribe = (cb) => {
|
|
10
|
-
window.addEventListener("storage", cb);
|
|
11
|
-
return () => {
|
|
12
|
-
window.removeEventListener("storage", cb);
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
const useLocalStorage = (key, initialValue) => {
|
|
16
|
-
const initialValueRef = useRef(initialValue);
|
|
17
|
-
const getSnapshot = () => getLocalStorageItem(key);
|
|
18
|
-
const store = useSyncExternalStore(localStorageSubscribe, getSnapshot, () => null);
|
|
19
|
-
const current = useMemo(() => {
|
|
20
|
-
try {
|
|
21
|
-
if (store === null) return initialValueRef.current;
|
|
22
|
-
return JSON.parse(store);
|
|
23
|
-
} catch (e) {
|
|
24
|
-
console.error(e);
|
|
25
|
-
return initialValueRef.current;
|
|
26
|
-
}
|
|
27
|
-
}, [store]);
|
|
28
|
-
const handleRemove = useCallback(() => {
|
|
29
|
-
window.localStorage.removeItem(key);
|
|
30
|
-
dispatchStorageEvent(key, null);
|
|
31
|
-
}, [key]);
|
|
32
|
-
return [
|
|
33
|
-
current,
|
|
34
|
-
useCallback((value) => {
|
|
35
|
-
if (value === void 0 || value === null) handleRemove();
|
|
36
|
-
else {
|
|
37
|
-
const stringifiedValue = JSON.stringify(value);
|
|
38
|
-
window.localStorage.setItem(key, stringifiedValue);
|
|
39
|
-
dispatchStorageEvent(key, stringifiedValue);
|
|
40
|
-
}
|
|
41
|
-
}, [key, handleRemove]),
|
|
42
|
-
handleRemove
|
|
43
|
-
];
|
|
44
|
-
};
|
|
45
|
-
//#endregion
|
|
46
|
-
export { useLocalStorage };
|