@skriv/ads 0.0.0-stage → 0.2.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.
Files changed (36) hide show
  1. package/README.md +47 -2
  2. package/bin/ads.mjs +59 -0
  3. package/dist/manifest.json +53 -0
  4. package/dist/skills/ads-code-review/SKILL.md +12 -0
  5. package/dist/skills/ads-code-to-figma/SKILL.md +10 -0
  6. package/dist/skills/ads-figma-to-code/SKILL.md +10 -0
  7. package/dist/skills/ads-init/SKILL.md +16 -0
  8. package/dist/skills/ads-init/profile.md +11 -0
  9. package/dist/skills/ads-init/scripts/connect.py +75 -0
  10. package/dist/skills/ads-record/SKILL.md +12 -0
  11. package/dist/skills/heroui-react/LICENSE.txt +199 -0
  12. package/dist/skills/heroui-react/SKILL.md +234 -0
  13. package/dist/skills/heroui-react/scripts/get_component_docs.mjs +157 -0
  14. package/dist/skills/heroui-react/scripts/get_docs.mjs +148 -0
  15. package/dist/skills/heroui-react/scripts/get_source.mjs +160 -0
  16. package/dist/skills/heroui-react/scripts/get_styles.mjs +160 -0
  17. package/dist/skills/heroui-react/scripts/get_theme.mjs +177 -0
  18. package/dist/skills/heroui-react/scripts/list_components.mjs +134 -0
  19. package/dist/skills/heroui-theming/LICENSE.txt +199 -0
  20. package/dist/skills/heroui-theming/SKILL.md +268 -0
  21. package/dist/skills/heroui-theming/references/any-framework.md +219 -0
  22. package/dist/skills/heroui-theming/references/components.md +237 -0
  23. package/dist/skills/heroui-theming/references/theme-recipe.md +701 -0
  24. package/dist/skills/heroui-theming/references/tokens.md +258 -0
  25. package/dist/skills/heroui-theming/scripts/_styles_dir.mjs +112 -0
  26. package/dist/skills/heroui-theming/scripts/list_component_classes.mjs +319 -0
  27. package/dist/skills/heroui-theming/scripts/list_tokens.mjs +157 -0
  28. package/dist/templates/flow.md +12 -0
  29. package/dist/templates/project.md +13 -0
  30. package/dist/templates/review.md +14 -0
  31. package/dist/templates/routing.md +11 -0
  32. package/dist/templates/theming.md +26 -0
  33. package/package.json +32 -4
  34. package/src/doctor.mjs +38 -0
  35. package/src/install.mjs +140 -0
  36. package/src/video.mjs +18 -0
@@ -0,0 +1,237 @@
1
+ # HeroUI Component CSS: Finding What to Override
2
+
3
+ Every HeroUI component is styled by one plain CSS file of BEM classes. This file explains how to read those files and what the conventions are, so an override targets selectors that really exist.
4
+
5
+ ## Source of truth
6
+
7
+ Never guess a class name. Read it from the installed package:
8
+
9
+ ```bash
10
+ node scripts/list_component_classes.mjs # all component stylesheets
11
+ node scripts/list_component_classes.mjs button # blocks, elements, modifiers, states, custom properties, tokens
12
+ node scripts/list_component_classes.mjs modal --css # plus the raw CSS
13
+ ```
14
+
15
+ | What | Where |
16
+ | ------------------------------ | ---------------------------------------------------------------------------------------- |
17
+ | Component CSS (installed) | `node_modules/@heroui/styles/dist/components/<name>.css` |
18
+ | Import order of all components | `node_modules/@heroui/styles/dist/components/index.css` |
19
+ | Class ↔ prop mapping | `node_modules/@heroui/styles/dist/components/<name>/<name>.styles.js` (variant function) |
20
+ | Human docs | `https://heroui.com/docs/react/components/<name>.mdx` → "CSS Classes" section |
21
+ | Latest source | `https://github.com/heroui-inc/heroui/tree/v3/packages/styles/components` |
22
+
23
+ `<name>` is kebab-case: `button`, `date-picker`, `list-box-item`, `alert-dialog`.
24
+
25
+ ## Naming conventions
26
+
27
+ | Kind | Pattern | Example | Comes from |
28
+ | ---------------- | -------------------- | ---------------------------------------------- | ------------------------------------------------- |
29
+ | Block | `.name` | `.button`, `.card`, `.date-picker` | The component root |
30
+ | Element | `.name__part` | `.card__header`, `.switch__thumb` | A compound part (`<Card.Header>`) |
31
+ | Nested element | `.name__part__part` | `.tabs__list-container__scroll-next` | A part inside a part |
32
+ | Modifier | `.name--value` | `.button--primary`, `.button--lg` | A variant prop (`variant="primary"`, `size="lg"`) |
33
+ | Element modifier | `.name__part--value` | `.modal__dialog--lg`, `.modal__backdrop--blur` | A variant prop that styles one part |
34
+ | Boolean modifier | `.name--flag` | `.button--icon-only`, `.input--full-width` | A boolean prop (`isIconOnly`, `fullWidth`) |
35
+ | Compound | `.name--a.name--b` | `.chip--primary.chip--accent` | Two variant props combined (`variant` + `color`) |
36
+
37
+ Design rules the base CSS follows (keep them when you override):
38
+
39
+ - **Default size lives in the block.** `.button` already has the medium dimensions; `.button--md` is empty. Size modifiers only override.
40
+ - **Color variants only assign custom properties.** `.button--primary` sets `--button-bg`, `--button-bg-hover`, `--button-bg-pressed`, `--button-fg`; `.button` paints them. Prefer re-assigning those properties over re-declaring `background-color`.
41
+ - **Component custom properties are declared on the component class**, so setting `--button-bg` on `:root` does nothing. Set them on the block/modifier selector.
42
+ - **Colors come from theme tokens**, through utilities (`bg-surface`) or `var(--accent)`. Hardcoded colors are rare and usually deliberate (white switch thumb).
43
+
44
+ ## State selectors
45
+
46
+ HeroUI styles each state twice: the native pseudo-class **and** the `data-*`/ARIA attribute that `@heroui/react` (React Aria) sets. Override both, or your style will apply on one platform and not the other.
47
+
48
+ | State | Pseudo-class | Attribute | Notes |
49
+ | -------------- | ---------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
50
+ | Hover | `:hover` | `[data-hovered="true"]` | Wrapped in `@media (hover: hover)` |
51
+ | Pressed | `:active` | `[data-pressed="true"]` | |
52
+ | Keyboard focus | `:focus-visible` | `[data-focus-visible="true"]` | Base form: `&:focus-visible:not([data-focused]), &[data-focus-visible="true"]` |
53
+ | Field focus | `:focus` | `[data-focused="true"]` | Inputs show focus for pointer too |
54
+ | Focus within | `:focus-within` | `[data-focus-within="true"]` | Field groups |
55
+ | Disabled | `:disabled` | `[data-disabled="true"]`, `[aria-disabled="true"]` | |
56
+ | Selected / on | — | `[data-selected="true"]`, `[aria-checked="true"]`, `[aria-selected="true"]` | Switch, Checkbox, Radio, Tabs, ListBox |
57
+ | Invalid | — | `[data-invalid="true"]`, `[aria-invalid="true"]` | |
58
+ | Pending | — | `[data-pending="true"]` | Loading buttons |
59
+ | Open | — | `[data-open="true"]`, `[data-expanded="true"]` | Triggers, disclosures |
60
+ | Enter / exit | — | `[data-entering="true"]`, `[data-exiting="true"]` | Overlay animations |
61
+ | Placement | — | `[data-placement="top"]` (`bottom`, `left`, `right`) | Popover, Tooltip |
62
+ | Orientation | — | `[data-orientation="horizontal"]` / `"vertical"` | Tabs, Slider, RadioGroup, ListBox |
63
+
64
+ A parent's state often styles a child: `.switch[data-selected="true"] .switch__thumb`. The script prints the exact list per component.
65
+
66
+ The base file is the authority on the exact selector. Some rules add guards (`.tabs__tab:not([data-selected="true"]):not([data-disabled="true"]):hover`), and a few deliberately use one form only (the accordion trigger hover keys off `:hover` alone). Copy the base selector, then change the declarations.
67
+
68
+ ### State utilities
69
+
70
+ Shared state styles come from `@heroui/styles/utilities`, applied with `@apply`:
71
+
72
+ | Utility | Does | Tokens |
73
+ | ---------------------- | ----------------------------------------------------- | ------------------------------------------------ |
74
+ | `status-focused` | 2px focus ring with an offset | `--focus`, `--ring-offset-width`, `--background` |
75
+ | `status-focused-field` | 2px focus ring with no offset | `--focus` |
76
+ | `status-invalid-field` | 1px danger outline; 2px danger ring when focused | `--danger` |
77
+ | `status-disabled` | Opacity, `not-allowed` cursor, `pointer-events: none` | `--disabled-opacity`, `--cursor-disabled` |
78
+ | `status-pending` | `pointer-events: none` | |
79
+
80
+ To restyle focus or disabled globally, change the tokens. Do not remove these rules.
81
+
82
+ ### `data-slot` hooks
83
+
84
+ Parts that have no BEM class of their own are reached through `data-slot`: `[data-slot="overlay-arrow"]` inside `.tooltip`, `[data-slot="label"]` and `[data-slot="description"]` inside `.switch`, `[data-slot="spinner"]` inside `.button`.
85
+
86
+ ## Writing an override that wins
87
+
88
+ All HeroUI component CSS is in `@layer components`. Put overrides in the same layer so they come later in source order and so utilities on an element (`className="rounded-none"`) still beat them:
89
+
90
+ ```css
91
+ @layer components {
92
+ .card {
93
+ @apply rounded-lg;
94
+ }
95
+ }
96
+ ```
97
+
98
+ 1. **Match the base selector's specificity.** Same layer + same specificity → the later rule (yours) wins. `.switch__thumb { … }` does not beat `.switch[data-selected="true"] .switch__thumb { … }`; repeat the stronger selector.
99
+ 2. **Re-assert modifiers your block override clobbers.** A new `border` on `.card` also lands on `.card--transparent` (which the base sets to `border-none` earlier in the file). Add `.card--transparent { @apply border-none; }` after it.
100
+ 3. **Keep the paired selectors.** Copy the selector list from the base file (`&:hover, &[data-hovered="true"]`), then change the declarations.
101
+ 4. **Do not write raw `box-shadow` in a state rule of a focusable component.** The focus ring is a `box-shadow`. Use shadow utilities (`@apply shadow-[…]`), which set `--tw-shadow` and compose with the ring, or check that the ring still shows.
102
+ 5. **Keep reduced motion.** If you add or replace a `transition`, follow it with `@apply motion-reduce:transition-none;` (after, not before).
103
+ 6. **Do not put overrides outside a layer.** Unlayered CSS beats `utilities`, so per-instance `className` overrides would stop working.
104
+ 7. **Check for pseudo-elements before adding one.** Several parts already draw with `::before` or `::after` (the checkbox control's fill, the radio indicator's dot, the slider thumb's knob). Grep the component's file first; a second `::before` rule replaces the first.
105
+
106
+ ## Representative components
107
+
108
+ Listed from `@heroui/styles` 3.2.x. Re-run the script for your version.
109
+
110
+ ### Button — `button.css`
111
+
112
+ | Kind | Selectors |
113
+ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
114
+ | Block | `.button` |
115
+ | Variants | `.button--primary`, `.button--secondary`, `.button--tertiary`, `.button--outline`, `.button--ghost`, `.button--danger`, `.button--danger-soft` |
116
+ | Sizes | `.button--sm`, `.button--md` (empty), `.button--lg` |
117
+ | Flags | `.button--icon-only`, `.button--full-width`; compound `.button--icon-only.button--sm` / `.button--lg` |
118
+ | States | `:hover` / `[data-hovered="true"]`, `:active` / `[data-pressed="true"]`, `:focus-visible:not([data-focused])` / `[data-focus-visible="true"]`, `:disabled` / `[aria-disabled="true"]`, `[data-pending="true"]` |
119
+ | Slots | `svg` (icons), `[data-slot="spinner"]`, `[data-slot="link-icon"]` |
120
+
121
+ | Custom property | Default | Painted as |
122
+ | --------------------- | ------------------------ | ------------------ |
123
+ | `--button-bg` | `transparent` | `background-color` |
124
+ | `--button-bg-hover` | `var(--button-bg)` | hover background |
125
+ | `--button-bg-pressed` | `var(--button-bg-hover)` | pressed background |
126
+ | `--button-fg` | `currentColor` | `color` |
127
+
128
+ Pressed also applies `transform: scale(0.97)` (`0.98` for `--sm`, `0.96` for `--lg`). Shape: `rounded-3xl`, height `h-10 md:h-9`.
129
+
130
+ ### Card — `card.css`
131
+
132
+ | Kind | Selectors |
133
+ | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
134
+ | Block | `.card` (padding, gap, `shadow-surface`, radius `min(32px, var(--radius-3xl))`) |
135
+ | Elements | `.card__header`, `.card__title`, `.card__description`, `.card__content`, `.card__footer` |
136
+ | Variants | `.card--default` (`bg-surface`), `.card--secondary`, `.card--tertiary`, `.card--transparent` (no border, background, or shadow) |
137
+
138
+ No states and no custom properties: restyle through `--surface*`, `--surface-shadow`, `--radius`, or the block.
139
+
140
+ ### Chip — `chip.css`
141
+
142
+ | Kind | Selectors |
143
+ | -------- | --------------------------------------------------------------------------------------------- |
144
+ | Block | `.chip`; element `.chip__label` |
145
+ | Colors | `.chip--default`, `.chip--accent`, `.chip--success`, `.chip--warning`, `.chip--danger` |
146
+ | Variants | `.chip--primary`, `.chip--secondary`, `.chip--soft`, `.chip--tertiary` |
147
+ | Sizes | `.chip--sm`, `.chip--md` (empty), `.chip--lg` |
148
+ | Compound | `.chip--primary.chip--accent` (solid), `.chip--accent.chip--soft` (soft) — one pair per color |
149
+
150
+ Custom properties: `--chip-bg` (default `var(--default)`), `--chip-fg` (default `currentColor`).
151
+
152
+ ### Switch — `switch.css`
153
+
154
+ | Kind | Selectors |
155
+ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
156
+ | Block | `.switch` (the label wrapper; carries the state attributes) |
157
+ | Elements | `.switch__content`, `.switch__control` (track), `.switch__thumb` |
158
+ | Sizes | `.switch--sm`, `.switch--md` (empty), `.switch--lg` |
159
+ | States | On the block: `[data-selected="true"]` / `[aria-checked="true"]`, `[data-disabled="true"]`, `:hover` / `[data-hovered="true"]`, `:active` / `[data-pressed="true"]`, `:focus-visible` / `[data-focus-visible="true"]` — styled on the children, e.g. `.switch[data-selected="true"] .switch__control` |
160
+ | Slots | `[data-slot="switch-content"]`, `[data-slot="label"]`, `[data-slot="description"]`, `[data-slot="field-error"]` |
161
+
162
+ | Custom property (on `.switch`) | Default |
163
+ | ----------------------------------- | ---------------------------------------------------------------- |
164
+ | `--switch-control-bg` | `var(--default)` |
165
+ | `--switch-control-bg-hover` | `color-mix(in oklab, var(--switch-control-bg), transparent 20%)` |
166
+ | `--switch-control-bg-pressed` | `var(--switch-control-bg-hover)` |
167
+ | `--switch-control-bg-checked` | `var(--accent)` |
168
+ | `--switch-control-bg-checked-hover` | `var(--accent-hover)` |
169
+
170
+ The thumb is positioned with `--switch-thumb-offset`; the track has `overflow-hidden`, so borders on the track change the thumb's travel (draw outlines with shadows instead).
171
+
172
+ ### Input — `input.css`
173
+
174
+ | Kind | Selectors |
175
+ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
176
+ | Block | `.input` |
177
+ | Variants | `.input--primary` (empty, default), `.input--secondary` (filled with `--default`, no shadow) |
178
+ | Flags | `.input--full-width` |
179
+ | States | `:hover` / `[data-hovered="true"]` (only while not focused), `:focus` / `[data-focused="true"]`, `[data-invalid="true"]`, `:disabled` / `[data-disabled="true"]` / `[aria-disabled="true"]`, `:autofill` |
180
+
181
+ Custom properties: `--input-bg` (current fill, default `var(--color-field)`), `--input-bg-hover`, `--input-bg-focus`. Everything else is a field token (`--field-background`, `--field-border`, `--field-border-width`, `--field-radius`, `--field-shadow`, `--field-placeholder`), which also drive `.textarea`, `.input-group`, `.number-field__group`, `.search-field__group`, `.date-input-group`, `.select__trigger`, `.autocomplete__trigger`, `.input-otp__slot`. Prefer the tokens: one change covers every field.
182
+
183
+ ## Which class is the overlay surface
184
+
185
+ Overlays have wrappers for positioning and animation; the visible panel is one specific class.
186
+
187
+ | Component | Panel (background, radius, `--overlay-shadow`) | Other parts |
188
+ | -------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
189
+ | Popover | `.popover` | `.popover__dialog`, `.popover__heading` |
190
+ | Tooltip | `.tooltip` | arrow: `[data-slot="overlay-arrow"]` |
191
+ | Dropdown | `.dropdown__popover` | `.dropdown__menu`, items: `.menu-item` |
192
+ | Select / ComboBox / Autocomplete | `.select__popover`, `.combo-box__popover`, `.autocomplete__popover` | items: `.list-box-item` |
193
+ | DatePicker / DateRangePicker | `.date-picker__popover`, `.date-range-picker__popover` | `.calendar`, `.range-calendar` |
194
+ | ColorPicker | `.color-picker__popover` | |
195
+ | Modal | `.modal__dialog` | `.modal__backdrop`, `.modal__container`, `.modal__header`, `.modal__body`, `.modal__footer` |
196
+ | AlertDialog | `.alert-dialog__dialog` | `.alert-dialog__backdrop`, `.alert-dialog__container` |
197
+ | Drawer / Sheet | `.drawer__dialog`, `.sheet__dialog` | `.drawer__backdrop`, `.sheet__backdrop` |
198
+ | Toast | `.toast` | `.toast__title`, `.toast__description` |
199
+
200
+ To restyle all of them at once, change `--overlay`, `--overlay-shadow`, `--backdrop`, and `--radius`. Overlays render in a portal on `<body>`, so they only inherit a theme applied on `<html>`.
201
+
202
+ ## Components with color custom properties
203
+
204
+ Re-assign these on the block or modifier instead of re-declaring colors.
205
+
206
+ | Component | Custom properties |
207
+ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
208
+ | Button | `--button-bg`, `--button-bg-hover`, `--button-bg-pressed`, `--button-fg` |
209
+ | ToggleButton | `--toggle-button-bg` (+ `-hover`, `-pressed`), `--toggle-button-fg`, `--toggle-button-bg-selected` (+ `-hover`, `-pressed`), `--toggle-button-fg-selected` |
210
+ | Chip | `--chip-bg`, `--chip-fg` |
211
+ | Badge | `--badge-bg`, `--badge-fg`, `--badge-border` |
212
+ | Switch | `--switch-control-bg` (+ `-hover`, `-pressed`, `-checked`, `-checked-hover`) |
213
+ | Pagination | `--pagination-link-bg` (+ `-hover`, `-pressed`), `--pagination-link-fg` |
214
+ | Input, TextArea | `--input-bg`, `--textarea-bg` (+ `-hover`, `-focus`) |
215
+ | Field groups | `--input-group-bg`, `--number-field-group-bg`, `--search-field-group-bg`, `--date-input-group-bg`, `--color-input-group-bg`, `--select-trigger-bg`, `--autocomplete-trigger-bg`, `--input-otp-slot-bg` (+ `-hover`, `-focus`) |
216
+ | Meter, ProgressBar | `--meter-fill`, `--progress-bar-fill` |
217
+ | ProgressCircle | `--progress-circle-stroke`, `--progress-circle-track-stroke` |
218
+ | Avatar | `--avatar-size`, `--avatar-radius` |
219
+
220
+ Components not listed read theme tokens directly.
221
+
222
+ ## Adding a variant
223
+
224
+ A new modifier is just another class in `@layer components`. Reuse the component's custom properties so hover, pressed, focus, and disabled keep working. Assign all of them: the component's default variant modifier (`.button--primary`) is still on the element.
225
+
226
+ ```css
227
+ @layer components {
228
+ .button--brand {
229
+ --button-bg: var(--success);
230
+ --button-bg-hover: var(--success-hover);
231
+ --button-bg-pressed: var(--success-hover);
232
+ --button-fg: var(--success-foreground);
233
+ }
234
+ }
235
+ ```
236
+
237
+ Use it with `className` (the block class is added by the component): `<Button className="button--brand">` or, on plain HTML, `<button class="button button--brand">`. For a typed prop, extend the variant function: `tv({extend: buttonVariants, variants: {variant: {brand: "button--brand"}}})` (see the Styling guide: `https://heroui.com/docs/react/getting-started/styling.mdx`).