nk_jtb 0.25.1 → 0.27.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 (55) hide show
  1. package/.ai/prompts/create-documentation.md +18 -5
  2. package/.ai/prompts/jtb-code-review.md +1 -1
  3. package/.ai/prompts/jtb-review-documentation.md +21 -48
  4. package/.ai/skills/jtb-best-practices/SKILL.md +61 -0
  5. package/.ai/skills/jtb-best-practices/rules/components.md +57 -0
  6. package/.ai/skills/jtb-best-practices/rules/conversion.md +43 -0
  7. package/.ai/skills/{jtb-layouts-and-structures/SKILL.md → jtb-best-practices/rules/layouts.md} +3 -37
  8. package/.ai/skills/jtb-best-practices/rules/responsive.md +34 -0
  9. package/.ai/skills/jtb-best-practices/rules/units-and-naming.md +68 -0
  10. package/.ai/skills/jtb-documentation/SKILL.md +78 -129
  11. package/AGENTS.md +36 -6
  12. package/CLAUDE.md +36 -6
  13. package/dev.html +57 -2
  14. package/docs/components/accordion.md +235 -197
  15. package/docs/components/box.md +14 -9
  16. package/docs/components/button.md +4 -0
  17. package/docs/examples/showcase-ui.md +106 -0
  18. package/docs/installation.md +2 -2
  19. package/docs/introduction.md +1 -1
  20. package/{framework-status.md → docs/jtb-status.md} +119 -113
  21. package/docs/themes.md +32 -1
  22. package/docs/variable-system.md +39 -8
  23. package/index.html +413 -0
  24. package/package.json +1 -1
  25. package/scripts/jtb-nav.json +62 -137
  26. package/skills-lock.json +17 -2
  27. package/src/base/_root.scss +14 -4
  28. package/src/build.scss +6 -1
  29. package/src/components/_accordion.scss +1 -1
  30. package/src/components/_button.scss +16 -0
  31. package/src/extras/_nk-docs.scss +18 -18
  32. package/src/maps_and_variables/_colors.scss +4 -0
  33. package/src/utilities/_backgrounds.scss +14 -0
  34. package/src/utilities/_border.scss +18 -0
  35. package/src/utilities/_themes.scss +19 -0
  36. package/src/utilities/_typography.scss +15 -0
  37. package/tasks.md +18 -16
  38. package/.ai/skills/jtb-conversion/SKILL.md +0 -81
  39. package/docs/components/pagination.md +0 -88
  40. package/docs/quick-reference.md +0 -89
  41. package/docs/showcase-ui.md +0 -38
  42. package/working-with-nathan.md +0 -117
  43. /package/docs/{showcase-typography.md → examples/showcase-typography.md} +0 -0
  44. /package/docs/{examples/responsive-design-patterns.md → responsive-design-patterns.md} +0 -0
  45. /package/docs/{animation.md → review/animation.md} +0 -0
  46. /package/docs/{aria.md → review/aria.md} +0 -0
  47. /package/docs/{core-architecture.md → review/core-architecture.md} +0 -0
  48. /package/docs/{design-decisions.md → review/design-decisions.md} +0 -0
  49. /package/docs/{developer-responsive-class-generation.md → review/developer-responsive-class-generation.md} +0 -0
  50. /package/docs/{display-and-visibility.md → review/display-and-visibility.md} +0 -0
  51. /package/docs/{layer-system.md → review/layer-system.md} +0 -0
  52. /package/docs/{margin-padding-spacing.md → review/margin-padding-spacing.md} +0 -0
  53. /package/docs/{resolvers.md → review/resolvers.md} +0 -0
  54. /package/docs/{responsive-testing.html → review/responsive-testing.html} +0 -0
  55. /package/docs/{responsive-testing.md → review/responsive-testing.md} +0 -0
@@ -1,7 +1,20 @@
1
- Create documentation for the `[component].scss` component, following the conventions and architecture rules defined in the JTB documentation.
1
+ Create documentation for `[component]`.
2
2
 
3
- Invoke the `jtb-documentation` skill before starting. Read these in full first
4
- — these define what is correct:
3
+ Invoke the `jtb-documentation` skill before starting.
5
4
 
6
- - `introduction.md`
7
- - `docs/conventions-and-architecture-rules.md`
5
+ ## Type
6
+
7
+ [Component / Utility]
8
+
9
+ ## What it does
10
+
11
+ [One or two sentences describing purpose — not implementation.]
12
+
13
+ ## Cover
14
+
15
+ [List specific sections or aspects to document, e.g. basic usage, modifiers,
16
+ SCSS variables, utility examples.]
17
+
18
+ ## Notes
19
+
20
+ [Optional: existing markup, decisions already made, related components.]
@@ -1,6 +1,6 @@
1
1
  Review the code changes for the NK JTB SCSS framework.
2
2
 
3
- Invoke the `jtb-documentation` skill before starting.
3
+ Invoke the `scss-engineer` and `jtb-documentation` skills before starting.
4
4
 
5
5
  ## Guidelines
6
6
 
@@ -1,23 +1,20 @@
1
1
  Review the documentation for the JTB framework.
2
2
 
3
- Invoke the `jtb-documentation` skill before starting. Read these in full first
4
- — these define what is correct:
3
+ Invoke the `jtb-documentation` skill before starting. Read these in full first — they define what is correct:
5
4
 
6
5
  - `introduction.md`
7
6
  - `docs/conventions-and-architecture-rules.md`
8
7
 
9
8
  ## Goals
10
9
 
11
- 1. Validate what exists — is documentation correct, consistent, and
12
- rule-compliant?
13
- 2. Identify what's missing — what is absent but expected?
10
+ 1. Validate what exists — correct, consistent, and rule-compliant?
11
+ 2. Identify what's missing — absent but expected?
14
12
 
15
13
  ## Process
16
14
 
17
- This review runs in three passes:
15
+ Three passes:
18
16
 
19
- 1. **Identify** — surface contradictions and gaps. Incomplete docs are expected;
20
- flag them without treating incompleteness as a failure.
17
+ 1. **Identify** — surface contradictions and gaps. Flag incompleteness without treating it as failure.
21
18
  2. **Triage** — decide what's worth pursuing before any work happens.
22
19
  3. **Sweep** — act only on approved items.
23
20
 
@@ -30,64 +27,40 @@ Review only:
30
27
 
31
28
  Do not review:
32
29
 
33
- - `src/mixins/` — build system internals
34
- - `src/functions/` — build system internals
35
- - `src/base/` — output layer
30
+ - `src/mixins/`, `src/functions/`, `src/base/` — build system internals and output layer
36
31
 
37
32
  ## Review Questions
38
33
 
39
34
  ### Validation
40
35
 
41
- 1. Do the variable files in `src/maps_and_variables/` match what the
42
- conventions doc describes?
36
+ 1. Do variable files in `src/maps_and_variables/` match what the conventions doc describes?
43
37
  2. Do all final maps follow the `-map` suffix rule?
44
- 3. Is the three-map pattern applied consistently across all variable files?
38
+ 3. Is the three-map pattern applied consistently?
45
39
  4. Is `smart-merge` order correct — variants first, values second?
46
- 5. Are `!default` flags present where the conventions require them?
47
- 6. Do the breakpoint values in `_base.scss` match what `responsive-design.md`
48
- describes?
40
+ 5. Are `!default` flags present where required?
41
+ 6. Do breakpoint values in `_base.scss` match `responsive-design.md`?
49
42
  7. Does `index.scss` forward all expected files?
50
43
 
51
- ### Gap Identification
44
+ ### Gaps
52
45
 
53
46
  1. Are there variable files with no corresponding documentation?
54
- 2. Are there conventions described in the docs with no implementation in
55
- `src/maps_and_variables/`?
47
+ 2. Are there conventions with no implementation in `src/maps_and_variables/`?
56
48
 
57
- ## Priority Definitions
49
+ ## Priorities
58
50
 
59
- - `critical` — contradicts a source of truth or produces incorrect guidance.
60
- Must fix.
61
- - `high` — likely causes confusion, inconsistency, or future breakage. Should
62
- fix.
63
- - `low` — style, preference, or minor improvement. Fix if you want.
51
+ - `critical` — contradicts a source of truth. Must fix.
52
+ - `high` — likely causes confusion or future breakage. Should fix.
53
+ - `low` — minor improvement. Fix if you want.
64
54
  - `missing` — expected content that isn't there.
65
55
 
66
- ## Output Requirements
56
+ ## Output
67
57
 
68
- - Be direct and critical.
69
- - Do not praise unnecessarily.
70
- - Separate findings by type clearly.
71
- - Suggest improvements with trade-offs.
72
- - If something is unclear or inconsistent, call it out explicitly.
58
+ Be direct. Do not praise. Call out anything unclear or inconsistent.
73
59
 
74
- Write results to `review-docs-run1.md` in the project root.
75
-
76
- Use these sections in order:
77
-
78
- - **Confirmed Issues** — rule violations, bugs, mismatches
79
- - **Gaps** — missing docs, tests, examples, or conventions
80
- - **Findings** — observations that don't rise to issues
81
- - **Pass** — if no confirmed issues: `No blocking issues found.`
82
-
83
- For every confirmed issue use this format:
60
+ Write results to `review-docs.md` in the project root using these sections:
84
61
 
62
+ **Confirmed Issues** — rule violations, bugs, mismatches
85
63
  **Issue title** · `critical/high/low`
86
64
  `file:line`
87
65
  Rule: brief quote
88
- Fix: one line
89
-
90
- For every gap use this format:
91
-
92
- **Gap title** · `missing`
93
- What's absent and where it's expected.
66
+ Fix: on
@@ -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`.
@@ -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
- - Prefer mobile-first base layouts with responsive enhancement.
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
+ ```