nk_jtb 0.26.0 → 0.27.1
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/.ai/skills/jtb-best-practices/SKILL.md +61 -0
- package/.ai/skills/jtb-best-practices/rules/components.md +57 -0
- package/.ai/skills/jtb-best-practices/rules/conversion.md +43 -0
- package/.ai/skills/{jtb-layouts-and-structures/SKILL.md → jtb-best-practices/rules/layouts.md} +3 -37
- package/.ai/skills/jtb-best-practices/rules/responsive.md +34 -0
- package/.ai/skills/jtb-best-practices/rules/units-and-naming.md +68 -0
- package/.ai/skills/jtb-documentation/SKILL.md +66 -64
- package/AGENTS.md +4 -2
- package/CLAUDE.md +4 -2
- package/code-review-loaders-spinners-260514.md +104 -0
- package/docs/components/accordion.md +235 -197
- package/docs/components/box.md +14 -9
- package/docs/components/button.md +4 -0
- package/docs/components/loaders-and-spinners.md +85 -0
- package/docs/{showcase-ui.md → examples/showcase-ui.md} +11 -0
- package/docs/jtb-status.md +27 -20
- package/docs/themes.md +32 -1
- package/docs/utilities/animation.md +81 -130
- package/index.html +343 -0
- package/jtb-conversion-notes.md +28 -0
- package/loaders_and_spinners.html +280 -0
- package/package.json +1 -1
- package/scripts/jtb-nav.json +78 -58
- package/skills-lock.json +7 -2
- package/src/base/_root.scss +14 -4
- package/src/build.scss +7 -1
- package/src/components/_accordion.scss +1 -1
- package/src/components/_button.scss +16 -0
- package/src/extras/_nk-docs.scss +26 -26
- package/src/maps_and_variables/_colors.scss +4 -0
- package/src/utilities/_animation.scss +15 -73
- package/src/utilities/_backgrounds.scss +14 -0
- package/src/utilities/_border.scss +18 -0
- package/src/utilities/_themes.scss +19 -0
- package/src/utilities/_typography.scss +15 -0
- package/tasks.md +28 -16
- package/.ai/skills/jtb-conversion/SKILL.md +0 -81
- package/docs/animation.md +0 -130
- package/docs/quick-reference.md +0 -89
- /package/docs/{showcase-typography.md → examples/showcase-typography.md} +0 -0
- /package/docs/{examples/responsive-design-patterns.md → responsive-design-patterns.md} +0 -0
- /package/docs/{aria.md → review/aria.md} +0 -0
- /package/docs/{core-architecture.md → review/core-architecture.md} +0 -0
- /package/docs/{design-decisions.md → review/design-decisions.md} +0 -0
- /package/docs/{developer-responsive-class-generation.md → review/developer-responsive-class-generation.md} +0 -0
- /package/docs/{display-and-visibility.md → review/display-and-visibility.md} +0 -0
- /package/docs/{layer-system.md → review/layer-system.md} +0 -0
- /package/docs/{margin-padding-spacing.md → review/margin-padding-spacing.md} +0 -0
- /package/docs/{resolvers.md → review/resolvers.md} +0 -0
- /package/docs/{responsive-testing.html → review/responsive-testing.html} +0 -0
- /package/docs/{responsive-testing.md → review/responsive-testing.md} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: jtb-best-practices
|
|
3
|
+
description: >-
|
|
4
|
+
Use this skill whenever writing, reviewing, or auditing HTML and CSS that
|
|
5
|
+
uses the NK JTB framework — including component composition, utility
|
|
6
|
+
application, and layout work. Do not wait for an explicit request — if JTB
|
|
7
|
+
classes or components are being written or reviewed, this skill applies.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# NK JTB Best Practices
|
|
11
|
+
|
|
12
|
+
## Verify Before Using
|
|
13
|
+
|
|
14
|
+
Never use a class without confirming it exists in JTB source or documentation.
|
|
15
|
+
Pattern-matching from one scale to another is the most common source of invalid
|
|
16
|
+
classes in JTB — each scale is generated independently.
|
|
17
|
+
|
|
18
|
+
If a class cannot be confirmed in the SCSS source or docs, stop and check before using it.
|
|
19
|
+
|
|
20
|
+
## Quick Reference
|
|
21
|
+
|
|
22
|
+
Read the relevant rule file before writing markup. Summaries below are for
|
|
23
|
+
navigation only — the rule files take precedence.
|
|
24
|
+
|
|
25
|
+
### Units & Naming → `rules/units-and-naming.md`
|
|
26
|
+
|
|
27
|
+
- `m-1` = 1rem, `gap-05` = 0.5rem — sub-1 values drop the leading zero and decimal
|
|
28
|
+
- Values ≥ 1 with decimals use the literal decimal in HTML: `gap-1.5`, not `gap-15`
|
|
29
|
+
- All-sides shorthand is `pxy` / `mxy`, not `p` / `m`
|
|
30
|
+
- Context-aware modifiers on the component: `<button class="btn primary">`, not `.btn-primary`
|
|
31
|
+
- Logical properties by default — `margin-inline-start` not `margin-left`
|
|
32
|
+
|
|
33
|
+
### Responsive → `rules/responsive.md`
|
|
34
|
+
|
|
35
|
+
- Ask whether responsive behaviour is needed before writing any grid, flex, or visibility utility
|
|
36
|
+
- `{bp}:` for progressive layout, `to-{bp}:` for visibility windows, `on-{bp}:` for exact-range only
|
|
37
|
+
- `on-` and `to-` are only generated for `display` and `visibility`
|
|
38
|
+
- Build mobile-first — base styles first, breakpoint prefixes upward
|
|
39
|
+
|
|
40
|
+
### Components & Tokens → `rules/components.md`
|
|
41
|
+
|
|
42
|
+
- Use `bx` for bordered/padded containers — not `bg-white bdr rounded shadow`
|
|
43
|
+
- Use `btn` for all button-like controls
|
|
44
|
+
- Use `badge` for small label/tag UI before building from scratch
|
|
45
|
+
- Use `txt-muted`, `txt-primary` before reaching for palette utilities
|
|
46
|
+
- Use a local helper class when JTB cannot express a requirement — never inline styles
|
|
47
|
+
|
|
48
|
+
### Conversion → `rules/conversion.md`
|
|
49
|
+
|
|
50
|
+
- Only for converting existing non-JTB code to JTB — not for design-to-code work or building new components from scratch
|
|
51
|
+
- Treat source classes as intent references, not direct mappings
|
|
52
|
+
- Snap arbitrary values to the closest JTB token — do not preserve exact values
|
|
53
|
+
- Record actionable gaps in `jtb-conversion-notes.md` — missing utilities, token mismatches
|
|
54
|
+
- Do not create new classes just to make a single conversion easier
|
|
55
|
+
|
|
56
|
+
### Layouts & Structures → `rules/layouts.md`
|
|
57
|
+
|
|
58
|
+
- `grid` with `cols-*` for column-based structures, `flex` for single-axis arrangements
|
|
59
|
+
- Build mobile-first — add `{bp}:` utilities only when no higher-level pattern fits
|
|
60
|
+
- Fewest structural elements that cleanly express the layout
|
|
61
|
+
- Default section rhythm: `py-4-3-2` standard, `py-5-3-2` prominent
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Components & Tokens
|
|
2
|
+
|
|
3
|
+
## Framework Components First
|
|
4
|
+
|
|
5
|
+
Always check whether a framework component already expresses the structure
|
|
6
|
+
before rebuilding it with low-level utilities.
|
|
7
|
+
|
|
8
|
+
### `bx`
|
|
9
|
+
|
|
10
|
+
Use for any bordered, padded content container:
|
|
11
|
+
|
|
12
|
+
```html +code
|
|
13
|
+
<!-- correct -->
|
|
14
|
+
<div class="bx">...</div>
|
|
15
|
+
|
|
16
|
+
<!-- wrong — rebuilding what bx already does -->
|
|
17
|
+
<div class="bg-white bdr rounded shadow pxy-1">...</div>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Sub-elements: `bx-header`, `bx-content`, `bx-footer` bleed to the box edges.
|
|
21
|
+
Use them for image regions, section headers, and footers within the card.
|
|
22
|
+
|
|
23
|
+
### `btn`
|
|
24
|
+
|
|
25
|
+
Use for all button-like controls. Apply theme and size as context-aware modifiers:
|
|
26
|
+
|
|
27
|
+
```html +code
|
|
28
|
+
<button class="btn primary">Enrol Now</button>
|
|
29
|
+
<button class="btn sm">Cancel</button>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Do not rebuild pill or button shapes with low-level utilities.
|
|
33
|
+
|
|
34
|
+
### `badge`
|
|
35
|
+
|
|
36
|
+
Use for small label/tag UI before assembling the same shape from scratch.
|
|
37
|
+
Check existing badge variants before adding a new one.
|
|
38
|
+
|
|
39
|
+
## Semantic Tokens
|
|
40
|
+
|
|
41
|
+
Prefer semantic utility tokens over palette utilities when they match the intent:
|
|
42
|
+
|
|
43
|
+
| Token | Use for |
|
|
44
|
+
| ------------- | ------------------------------- |
|
|
45
|
+
| `txt-muted` | Secondary or de-emphasised text |
|
|
46
|
+
| `txt-primary` | Brand-coloured text |
|
|
47
|
+
| `bg-primary` | Brand-coloured background |
|
|
48
|
+
|
|
49
|
+
Reach for palette utilities (`txt-stone-600`, `bg-teal-100`) only when no
|
|
50
|
+
semantic token is a reasonable match.
|
|
51
|
+
|
|
52
|
+
## Local Helper Classes
|
|
53
|
+
|
|
54
|
+
When JTB cannot express a requirement, create a local helper class. Never use
|
|
55
|
+
inline styles — a class is visible, searchable, and signals a gap clearly.
|
|
56
|
+
|
|
57
|
+
Inline styles are only permitted if explicitly instructed by the developer.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Conversion
|
|
2
|
+
|
|
3
|
+
Only for converting existing non-JTB code to JTB. Do not use for
|
|
4
|
+
design-to-code work from screenshots/mockups or building new components from scratch.
|
|
5
|
+
|
|
6
|
+
If the output file is not specified, ask before proceeding.
|
|
7
|
+
|
|
8
|
+
## Conversion Order
|
|
9
|
+
|
|
10
|
+
1. Replace source classes with documented JTB utilities or components.
|
|
11
|
+
2. When the source uses arbitrary/custom values, snap to the closest existing
|
|
12
|
+
JTB token or utility instead of preserving the exact value.
|
|
13
|
+
3. Do not create new classes as a conversion shortcut.
|
|
14
|
+
4. If something appears to need a class, consider whether it should become a
|
|
15
|
+
real framework component, utility, or documented pattern.
|
|
16
|
+
5. Record only actionable gaps in `jtb-conversion-notes.md` — missing
|
|
17
|
+
utilities, unsupported patterns, or token mismatches that need a follow-up
|
|
18
|
+
decision. Do not record resolved matches, clean conversions, or decisions
|
|
19
|
+
made.
|
|
20
|
+
6. Only add local CSS when JTB cannot express the requirement.
|
|
21
|
+
|
|
22
|
+
## Rules
|
|
23
|
+
|
|
24
|
+
- Treat source classes as intent references, not direct mappings.
|
|
25
|
+
- For color, reach for the closest JTB palette utility first (`bg-stone-50`,
|
|
26
|
+
`txt-stone-900` etc.). If the brand color maps to a semantic role, override
|
|
27
|
+
the JTB token via `:root` (e.g. `--primary`). If no palette utility or
|
|
28
|
+
semantic token is a reasonable match, record it in `jtb-conversion-notes.md`
|
|
29
|
+
and leave the decision to the developer — do not create a custom color class.
|
|
30
|
+
- Remove no-op or default classes that do not materially change the layout or
|
|
31
|
+
styling.
|
|
32
|
+
- When Tailwind transition syntax depends on unsupported `duration-*`, easing,
|
|
33
|
+
or delay utilities, simplify to the closest supported JTB transition pattern
|
|
34
|
+
and record the missing utility coverage.
|
|
35
|
+
- Keep Alpine `x-data` scoped to the element that directly owns or uses the
|
|
36
|
+
state. Do not move it to a broader parent unless multiple descendants
|
|
37
|
+
genuinely share the same state.
|
|
38
|
+
|
|
39
|
+
## Review Checklist
|
|
40
|
+
|
|
41
|
+
- Remove source-only syntax such as arbitrary value classes where a JTB utility exists.
|
|
42
|
+
- Remove classes that only restate the default behavior.
|
|
43
|
+
- Document missing utilities or unsupported patterns in `jtb-conversion-notes.md`.
|
package/.ai/skills/{jtb-layouts-and-structures/SKILL.md → jtb-best-practices/rules/layouts.md}
RENAMED
|
@@ -1,36 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
name: jtb-layouts-and-structures
|
|
3
|
-
description: >-
|
|
4
|
-
Use this skill whenever making layout or structural decisions — choosing
|
|
5
|
-
between grid and flex, building page shells, or structuring internal
|
|
6
|
-
component layouts. Do not wait for an explicit request — if layout or
|
|
7
|
-
structural decisions are being made, this skill applies.
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
For layout or responsive work, read:
|
|
11
|
-
|
|
12
|
-
- `docs/responsive-design.md`
|
|
13
|
-
- `docs/layouts-and-structures.md`
|
|
14
|
-
- `docs/magic-classes.md`
|
|
15
|
-
|
|
16
|
-
## Scope
|
|
17
|
-
|
|
18
|
-
Use this skill for structural layout decisions:
|
|
19
|
-
|
|
20
|
-
- page shells
|
|
21
|
-
- layout patterns
|
|
22
|
-
- reusable internal structures
|
|
23
|
-
- split layouts
|
|
24
|
-
- grid vs flex choices
|
|
25
|
-
- container and width strategy
|
|
26
|
-
- responsive visibility strategy
|
|
27
|
-
|
|
28
|
-
Do not use this skill for general documentation or for framework-internals work.
|
|
1
|
+
# Layouts & Structures
|
|
29
2
|
|
|
30
3
|
## Decision Order
|
|
31
4
|
|
|
32
|
-
1. Classify the problem first — page-level layout or internal component
|
|
33
|
-
structure?
|
|
5
|
+
1. Classify the problem first — page-level layout or internal component structure?
|
|
34
6
|
2. Choose the right primitive:
|
|
35
7
|
- `grid` with `cols-*` for column-based structures
|
|
36
8
|
- `flex` for linear, single-axis arrangements
|
|
@@ -42,13 +14,9 @@ Do not use this skill for general documentation or for framework-internals work.
|
|
|
42
14
|
5. Only escalate to custom solutions when documented primitives cannot express
|
|
43
15
|
the need cleanly.
|
|
44
16
|
|
|
45
|
-
## Markup
|
|
46
|
-
|
|
47
|
-
- Do not add `data-*` attributes unless explicitly requested.
|
|
48
|
-
|
|
49
17
|
## Rules
|
|
50
18
|
|
|
51
|
-
-
|
|
19
|
+
- Do not add `data-*` attributes unless explicitly requested.
|
|
52
20
|
- Default to the fewest structural elements that cleanly express the layout.
|
|
53
21
|
- Combine width, rhythm, and internal layout on the same element when they do
|
|
54
22
|
not need isolation.
|
|
@@ -66,5 +34,3 @@ Do not use this skill for general documentation or for framework-internals work.
|
|
|
66
34
|
- Prefer approved magic/composite classes when they express an established
|
|
67
35
|
responsive pattern more clearly than explicit breakpoint chains. Common
|
|
68
36
|
examples include `py-*`, `gap-*`, and `cols-*` patterns.
|
|
69
|
-
- Use `{bp}:` for progressive layout changes.
|
|
70
|
-
- Use `to-` and `on-` primarily for visibility windows, not layout progression.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Responsive
|
|
2
|
+
|
|
3
|
+
## Ask First
|
|
4
|
+
|
|
5
|
+
Before writing any grid, flex layout, or visibility utility, ask:
|
|
6
|
+
|
|
7
|
+
> Does this need to be responsive?
|
|
8
|
+
|
|
9
|
+
If the task or design does not specify responsive behaviour, ask before assuming.
|
|
10
|
+
Do not add or omit responsive prefixes without knowing the answer.
|
|
11
|
+
|
|
12
|
+
## Prefix Types
|
|
13
|
+
|
|
14
|
+
Three distinct prefix types — do not substitute one for another:
|
|
15
|
+
|
|
16
|
+
| Prefix | Example | Applies when |
|
|
17
|
+
| ----------- | --------------- | ------------------------------------- |
|
|
18
|
+
| `{bp}:` | `md:flex` | From breakpoint upward (min-width) |
|
|
19
|
+
| `to-{bp}:` | `to-md:hidden` | Below breakpoint (max-width) |
|
|
20
|
+
| `on-{bp}:` | `on-md:hidden` | Exactly at that breakpoint range only |
|
|
21
|
+
|
|
22
|
+
`on-` and `to-` are only generated for `display` and `visibility` utilities.
|
|
23
|
+
Do not use them for layout, spacing, or other properties — use mixins for
|
|
24
|
+
custom responsive behaviour on other properties.
|
|
25
|
+
|
|
26
|
+
## Mobile-First
|
|
27
|
+
|
|
28
|
+
Build the base layout for the smallest viewport. Add `{bp}:` prefixes to
|
|
29
|
+
progressively enhance upward. Do not start from desktop and work down.
|
|
30
|
+
|
|
31
|
+
## Common Breakpoints
|
|
32
|
+
|
|
33
|
+
`sm`, `md`, `lg`, `xl`, `xxl` — always confirm against the JTB breakpoint map
|
|
34
|
+
before using a breakpoint that is not already present in the codebase.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Units & Naming
|
|
2
|
+
|
|
3
|
+
## Scale
|
|
4
|
+
|
|
5
|
+
All numeric class values are rem. `m-1` = 1rem, `p-2` = 2rem, `gap-05` = 0.5rem.
|
|
6
|
+
|
|
7
|
+
Before using any numeric utility, confirm the value exists in the relevant map
|
|
8
|
+
in `src/maps_and_variables/`. Each utility (spacing, gap, sizing, border-radius)
|
|
9
|
+
has its own independent scale — do not assume a value is valid because it exists
|
|
10
|
+
in a different scale.
|
|
11
|
+
|
|
12
|
+
## Decimal Class Names
|
|
13
|
+
|
|
14
|
+
The class name format depends on whether the value is below or above 1:
|
|
15
|
+
|
|
16
|
+
| Value | Class name | Example |
|
|
17
|
+
| ----- | ------------------- | ------------------ |
|
|
18
|
+
| `0.5` | Drop `0.` prefix | `gap-05`, `p-025` |
|
|
19
|
+
| `1.5` | Use literal decimal | `gap-1.5`, `p-1.5` |
|
|
20
|
+
|
|
21
|
+
Sub-1 values (starting with `0.`) strip the leading zero and decimal point.
|
|
22
|
+
Values ≥ 1 with decimals are escaped in CSS (`.gap-1\.5`) but written with the
|
|
23
|
+
literal decimal in HTML. Do not apply the sub-1 rule to values ≥ 1 — `gap-15`
|
|
24
|
+
is not a valid class for 1.5rem.
|
|
25
|
+
|
|
26
|
+
## Shorthand
|
|
27
|
+
|
|
28
|
+
- All-sides padding and margin use `pxy` and `mxy`, not `p` or `m`
|
|
29
|
+
- Directional variants: `px`, `py`, `pt`, `pb`, `pl`, `pr` (and `mx`, `my`, etc.)
|
|
30
|
+
|
|
31
|
+
## Property = Class Name
|
|
32
|
+
|
|
33
|
+
Use the CSS property value directly as the class name. Do not prefix with the property name:
|
|
34
|
+
|
|
35
|
+
- `flex` not `display-flex`
|
|
36
|
+
- `relative` not `position-relative`
|
|
37
|
+
- `hidden` not `display-none`
|
|
38
|
+
|
|
39
|
+
## Axis Modifiers & Logical Properties
|
|
40
|
+
|
|
41
|
+
Axis modifiers map to logical properties internally:
|
|
42
|
+
|
|
43
|
+
| Modifier | Logical property |
|
|
44
|
+
| -------- | ----------------------------- |
|
|
45
|
+
| `-t` | `block-start` |
|
|
46
|
+
| `-b` | `block-end` |
|
|
47
|
+
| `-l` | `inline-start` |
|
|
48
|
+
| `-r` | `inline-end` |
|
|
49
|
+
| `-x` | `inline-start` + `inline-end` |
|
|
50
|
+
| `-y` | `block-start` + `block-end` |
|
|
51
|
+
|
|
52
|
+
Use logical properties in SCSS (`margin-inline-start`, not `margin-left`).
|
|
53
|
+
Physical properties are only appropriate in explicitly positioned contexts.
|
|
54
|
+
|
|
55
|
+
## Context-Aware Modifiers
|
|
56
|
+
|
|
57
|
+
Theme and size modifiers are applied directly to the component, not as
|
|
58
|
+
hyphenated suffixes:
|
|
59
|
+
|
|
60
|
+
```html +code
|
|
61
|
+
<!-- correct -->
|
|
62
|
+
<button class="btn primary">Submit</button>
|
|
63
|
+
<button class="btn sm">Cancel</button>
|
|
64
|
+
|
|
65
|
+
<!-- wrong -->
|
|
66
|
+
<button class="btn-primary">Submit</button>
|
|
67
|
+
<button class="btn-sm">Cancel</button>
|
|
68
|
+
```
|
|
@@ -6,106 +6,108 @@ description: >-
|
|
|
6
6
|
updated, this skill applies.
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Apply both this skill and `nk-documentation-best-practices`. This skill takes
|
|
10
10
|
precedence where they conflict.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Documentation Types
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### Component Documentation
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- `docs/variable-system.md` → `docs.jtb.variable-system`
|
|
16
|
+
Use for named structural classes such as `navbar`, `menu`, `bx`, or form controls.
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
A class-based component has a named CSS class (e.g. `.spinner`, `.accordion`) that drives its core structure. A utility-based pattern achieves a similar result through composition of utility classes with no dedicated component class.
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
**Single-component page structure:**
|
|
22
21
|
|
|
23
|
-
-
|
|
24
|
-
|
|
22
|
+
1. One-line lead
|
|
23
|
+
2. `## Basic Usage` — minimum working markup
|
|
24
|
+
3. Additional `##` sections — simple to fuller usage
|
|
25
|
+
4. `## SCSS Variables` — if the component exposes overridable variables
|
|
26
|
+
5. `## Utility Examples` — utility-based alternatives, always last
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
**Multi-component page:** repeat the same structure for each component, shifted down one heading level. The page title (`#`) becomes the group, each component becomes `##`, and its sections become `###`. A page with many components just repeats this pattern as many times as needed.
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
**Rules:**
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
- The lead describes purpose, not implementation. Do not mention specific CSS properties.
|
|
33
|
+
- Open Basic Usage with `Apply the [component class] to...` — directive, not descriptive.
|
|
34
|
+
- Component class examples use `class="bx example-jtb"`.
|
|
35
|
+
- Utility examples use `class="bx example-utils"`.
|
|
36
|
+
- Place SCSS Variables directly before Utility Examples.
|
|
37
|
+
- Link to `/docs/jtb/variable-system` for override instructions rather than explaining inline.
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
- On section confirmation: if the section is in a component or utility doc (not
|
|
34
|
-
a skill, reference doc, or api doc), ask: "Do you want this added to a
|
|
35
|
-
showcase?"
|
|
36
|
-
- If yes, add it to the appropriate showcase file before moving on.
|
|
39
|
+
### Utility Documentation
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
Use for class-based APIs such as spacing, sizing, border, position, transforms,
|
|
42
|
+
and typography helpers.
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
**Structure:**
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
1. Major utility groups as `##` headings when the page covers more than one family
|
|
47
|
+
2. Example groups within those sections as `###` headings when needed
|
|
48
|
+
3. Optional compact table of available properties or value groups
|
|
49
|
+
4. Available values at the end, when useful
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
**Rules:**
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
- Keep utility heading levels parallel.
|
|
54
|
+
- Use a compact table near the top when it helps scan the utility API quickly.
|
|
55
|
+
- Only add notes when behaviour is non-obvious.
|
|
56
|
+
- Group examples by usage, not by SCSS implementation detail.
|
|
57
|
+
- Use `+demo-folded class="bx"` for interactive examples.
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
## Code Block Attributes
|
|
52
60
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
61
|
+
- `class="..."` → outer demo wrapper class
|
|
62
|
+
- `preview-class="..."` → class applied to the preview container only, keeps copied code clean
|
|
63
|
+
- `+demo` / `+demo-folded` → render preview and code together
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
For layout/responsive docs, use:
|
|
58
66
|
|
|
59
|
-
|
|
67
|
+
```md
|
|
68
|
+
+demo-folded class="resizable-container with-docs-only-overrides"
|
|
69
|
+
```
|
|
60
70
|
|
|
61
|
-
##
|
|
71
|
+
## Examples Files
|
|
62
72
|
|
|
63
|
-
|
|
73
|
+
Quick visual references — not comprehensive docs. Two files:
|
|
64
74
|
|
|
65
|
-
|
|
75
|
+
- `docs/examples/showcase-typography.md` — font sizes, weights, families, text utilities
|
|
76
|
+
- `docs/examples/showcase-ui.md` — components and UI elements: buttons, badges, checklist, box etc.
|
|
66
77
|
|
|
67
|
-
|
|
78
|
+
Two reasons something belongs in an examples file:
|
|
68
79
|
|
|
69
|
-
1.
|
|
70
|
-
2.
|
|
71
|
-
3. Optional compact table of available properties or value groups
|
|
72
|
-
4. Available values at the end, when useful
|
|
80
|
+
1. **Syntax reminder** — enough variations exist that you forget the class names
|
|
81
|
+
2. **Existence reminder** — a single component worth flagging so it doesn't get overlooked
|
|
73
82
|
|
|
74
|
-
|
|
83
|
+
Format depends on content type:
|
|
75
84
|
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
- Only add notes when behaviour is non-obvious.
|
|
79
|
-
- Group examples by usage, not by SCSS implementation detail.
|
|
80
|
-
- Use `+demo-folded class="bx"` for interactive examples.
|
|
81
|
-
- Use `preview-class="..."` for preview-only layout so copied code stays clean.
|
|
82
|
-
- Use `class="..."` for the outer demo wrapper when the preview needs a container such as `bx`.
|
|
85
|
+
- **UI components** (`showcase-ui.md`) — use `+demo-folded class="bx"` so markup is visible and copyable
|
|
86
|
+
- **Typography/syntax** (`showcase-typography.md`) — raw HTML pairing `<code>` class names with output
|
|
83
87
|
|
|
84
|
-
|
|
88
|
+
Group by component family under `##` headings. Variants sit under `###` within that group.
|
|
85
89
|
|
|
86
|
-
|
|
90
|
+
Do not create a new examples file for a single component. If it does not fit the two above, discuss with the user.
|
|
87
91
|
|
|
88
|
-
|
|
92
|
+
When a section of a component or utility doc is complete, ask:
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
2. Minimum working markup — shown early with `+code`
|
|
92
|
-
3. Examples — simple to fuller usage
|
|
93
|
-
4. Customisation — variables, modifiers, or overrides
|
|
94
|
+
> Do you want this added to an examples file?
|
|
94
95
|
|
|
95
|
-
|
|
96
|
+
Do not ask this for skill, reference, or API docs.
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
- Wrap all interactive examples in `class="bx"`.
|
|
99
|
-
- Include an SCSS Variables table when the component exposes overridable variables. Link to `/docs/jtb/variable-system` for override instructions rather than explaining inline.
|
|
100
|
-
- Include a `## Utility Examples` section when a utility-based approach is viable. Lives in the component doc — not a separate file.
|
|
98
|
+
## Nav & Completion
|
|
101
99
|
|
|
102
|
-
|
|
100
|
+
Nav lives in `scripts/jtb-nav.json`. Route names follow `docs.jtb.{path}`:
|
|
103
101
|
|
|
104
|
-
- `
|
|
105
|
-
- `
|
|
106
|
-
- `+demo` / `+demo-folded` → render preview and code together
|
|
102
|
+
- `docs/components/list.md` → `docs.jtb.components.list`
|
|
103
|
+
- `docs/variable-system.md` → `docs.jtb.variable-system`
|
|
107
104
|
|
|
108
|
-
|
|
105
|
+
All documentation lives in `docs/`. Create new documentation directly in `docs/`.
|
|
106
|
+
|
|
107
|
+
When a doc is confirmed complete:
|
|
108
|
+
|
|
109
|
+
- Add it to `scripts/jtb-nav.json`.
|
|
110
|
+
- Update the relevant row in `docs/jtb-status.md`.
|
|
109
111
|
|
|
110
112
|
## Links
|
|
111
113
|
|
package/AGENTS.md
CHANGED
|
@@ -200,8 +200,10 @@ follow the direction.
|
|
|
200
200
|
- Do not treat reading a `SKILL.md` file as a substitute for invoking the skill.
|
|
201
201
|
- When updating prompts, guidelines, or skills, first identify the project's
|
|
202
202
|
source-of-truth file before editing.
|
|
203
|
-
-
|
|
204
|
-
|
|
203
|
+
- Skills and guidelines are always edited via `.ai/` — never agent-managed
|
|
204
|
+
directories (`.claude/`, `.cursor/`, `.windsurf/`, etc.) directly.
|
|
205
|
+
- Check whether the `.ai/` entry is a local file or a symlink before editing.
|
|
206
|
+
If it is a symlink, follow it to the target and edit there.
|
|
205
207
|
- Do not update matching copies in parallel or alternate locations unless they
|
|
206
208
|
are the confirmed source of truth or the user explicitly asks.
|
|
207
209
|
- After changing project guidelines or adding/updating skills, run
|
package/CLAUDE.md
CHANGED
|
@@ -200,8 +200,10 @@ follow the direction.
|
|
|
200
200
|
- Do not treat reading a `SKILL.md` file as a substitute for invoking the skill.
|
|
201
201
|
- When updating prompts, guidelines, or skills, first identify the project's
|
|
202
202
|
source-of-truth file before editing.
|
|
203
|
-
-
|
|
204
|
-
|
|
203
|
+
- Skills and guidelines are always edited via `.ai/` — never agent-managed
|
|
204
|
+
directories (`.claude/`, `.cursor/`, `.windsurf/`, etc.) directly.
|
|
205
|
+
- Check whether the `.ai/` entry is a local file or a symlink before editing.
|
|
206
|
+
If it is a symlink, follow it to the target and edit there.
|
|
205
207
|
- Do not update matching copies in parallel or alternate locations unless they
|
|
206
208
|
are the confirmed source of truth or the user explicitly asks.
|
|
207
209
|
- After changing project guidelines or adding/updating skills, run
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Code Review — Loaders and Spinners
|
|
2
|
+
**Date:** 2026-05-14
|
|
3
|
+
**Scope:** Component review — loaders and spinners subsystem
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Scope Reviewed
|
|
8
|
+
|
|
9
|
+
- **Type:** Component/package review
|
|
10
|
+
- **Target:** `src/components/_loaders-and-spinners.scss`, `src/utilities/_animation.scss`, `docs/utilities/animation.md`, `docs/review/animation.md`
|
|
11
|
+
- **Coverage:** Full read of all four files; cross-referenced keyframe definitions against class usage
|
|
12
|
+
- **Exclusions:** No UI test harness or compiled output inspected
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Findings
|
|
17
|
+
|
|
18
|
+
### High — `@keyframes dots` is never defined; `.dots` animation is a no-op
|
|
19
|
+
|
|
20
|
+
- **Impact:** The animated dots in `.loader-container` (e.g. "Loading...") never animate — `animation: dots 1.5s steps(4, end) infinite` silently fails.
|
|
21
|
+
- **Evidence:** `_loaders-and-spinners.scss:54` references `animation: dots`. `_animation.scss` defines `spin`, `bounce`, `pulse-ring`, `pulse`, `checkmark`, `circle` — no `dots` keyframe exists anywhere in the codebase.
|
|
22
|
+
- **Fix:** Define `@keyframes dots` (typically stepping through `""`, `"."`, `".."`, `"..."` via `content`) in `_animation.scss` alongside the other keyframes.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### High — `@keyframes ping` is never defined; `.animate-ping` is broken
|
|
27
|
+
|
|
28
|
+
- **Impact:** `.animate-ping` always resolves to `animation: none` and the `--animate-ping` CSS custom property is dead.
|
|
29
|
+
- **Evidence:** `_animation.scss:66` defines `--animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite` and `_animation.scss:88–90` outputs the `.animate-ping` class, but no `@keyframes ping` exists in the file or anywhere else in `src/`.
|
|
30
|
+
- **Fix:** Add `@keyframes ping` (typically a scale-and-fade-out expanding ring) to `_animation.scss`, or remove `.animate-ping` and the `--animate-ping` custom property if ping is not planned.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### Medium — `.loader-container .spinner` abandons the variable system with hardcoded values
|
|
35
|
+
|
|
36
|
+
- **Impact:** The nested `.spinner` is unaffected by `--size` or `--thickness`, so size variants (`sm`, `lg`, `thick`) do nothing inside a loader container. The two `.spinner` implementations are behaviourally inconsistent.
|
|
37
|
+
- **Evidence:** `_loaders-and-spinners.scss:32–39` — hardcoded `border: 4px solid`, `height: 60px`, `width: 60px`, `margin: 0 auto 20px` instead of `--size`/`--thickness`. The outer `.spinner` (lines 1–23) uses the variable system correctly.
|
|
38
|
+
- **Fix:** Remove the nested `.spinner` override; let the outer `.spinner` definition handle sizing, and rely on the `dark` context modifier or a wrapper class for colour changes rather than overriding the element entirely.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Medium — `.loading-text` and `.dots` use hardcoded px values and hex colours
|
|
43
|
+
|
|
44
|
+
- **Impact:** These values sit outside the framework variable and scale system, making them impossible to theme or override via custom properties.
|
|
45
|
+
- **Evidence:** `_loaders-and-spinners.scss:43–46` — `font-size: 18px`, `color: #fff`, `letter-spacing: 0.5px`; line 51 — `width: 20px`.
|
|
46
|
+
- **Fix:** Replace with framework scale references (e.g. `var(--fs-base)`, a color token or `currentColor`) and rem units.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### Medium — `.spinner` uses physical `border-top` shorthand
|
|
51
|
+
|
|
52
|
+
- **Impact:** Breaks logical-property consistency; does not respect writing-mode.
|
|
53
|
+
- **Evidence:** `_loaders-and-spinners.scss:8` — `border-top: calc(var(--size) * var(--thickness)) solid #3498db`. CLAUDE.md requires logical properties (`border-block-start`) except in explicitly positioned contexts.
|
|
54
|
+
- **Fix:** Replace `border-top` with `border-block-start`.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### Medium — Docs examples use class names that are not confirmed JTB utilities
|
|
59
|
+
|
|
60
|
+
- **Impact:** Examples may not render correctly and set misleading precedent for how the framework is used.
|
|
61
|
+
- **Evidence:** `docs/utilities/animation.md` lines 8–78 use: `rounded-full`, `space-x-05`, `opacity-0`, `opacity-30`, `opacity-80`, `overflow-hidden`, `items-center`, `w-full`, `h-2`, `h-full`, `font-semibold` — none of which appear in JTB docs or confirmed source files.
|
|
62
|
+
- **Fix:** Audit each class against JTB source; replace non-JTB classes with confirmed equivalents or extract to inline styles where no JTB utility exists.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### Low — Large dead code block in `_animation.scss`
|
|
67
|
+
|
|
68
|
+
- **Impact:** Adds noise; the commented code differs from the live implementation, creating confusion about which version is canonical.
|
|
69
|
+
- **Evidence:** `_animation.scss:109–177` — three commented-out `.spinner` implementations spanning 68 lines.
|
|
70
|
+
- **Fix:** Delete the commented block. History is in git.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Low — `docs/utilities/animation.md` and `docs/review/animation.md` are identical
|
|
75
|
+
|
|
76
|
+
- **Impact:** Any update to one must be manually mirrored to the other; they will diverge.
|
|
77
|
+
- **Evidence:** Both files are byte-for-byte identical — same headings, same content, same `(review)` markers on every section heading.
|
|
78
|
+
- **Fix:** Delete `docs/review/animation.md` or make it a redirect/include. One source of truth.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Low — All section headings carry `(review)` markers; no content is marked final
|
|
83
|
+
|
|
84
|
+
- **Impact:** The docs page cannot be published or referenced as authoritative in its current state.
|
|
85
|
+
- **Evidence:** `docs/utilities/animation.md:1` — title is "Animation Utilities (review)"; every `##` heading appends `(review)`.
|
|
86
|
+
- **Fix:** Remove `(review)` markers as each section is confirmed; track incomplete sections explicitly.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Low — No dedicated loaders/spinners documentation page
|
|
91
|
+
|
|
92
|
+
- **Impact:** The `.spinner`, `.loader-container`, `.loading-text`, and `.dots` components are undiscoverable outside the animation utilities page. There is no entry in `docs/components/` for them, despite being defined as a named component file.
|
|
93
|
+
- **Evidence:** `docs/components/` has accordion, box, button, forms, list, menu, navbar, table — no loaders entry. The component is documented only as a subsection of `docs/utilities/animation.md`.
|
|
94
|
+
- **Fix:** Create `docs/components/loaders.md` covering the `.spinner` variants and `.loader-container` pattern, separate from the animation utility reference.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Maintainability Risk: **High**
|
|
99
|
+
|
|
100
|
+
Two broken animations (`dots`, `ping`), a nested component that silently overrides and breaks the variable system, and documentation that is unfinished and duplicated. The `.loader-container .spinner` inconsistency means any refactor of the variable approach requires tracking two divergent implementations.
|
|
101
|
+
|
|
102
|
+
## Cross-Boundary Coupling Risk: **Low**
|
|
103
|
+
|
|
104
|
+
The component is self-contained. The only cross-file dependency is `@keyframes spin` from `_animation.scss`, which is correctly defined.
|