najm-kit 2.8.2 → 2.9.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/CHANGELOG.md CHANGED
@@ -1,15 +1,41 @@
1
- # Changelog
2
-
3
- ## 2.8.2 - 2026-08-08
4
-
5
- - Added the framework-neutral `najm-kit/person-images` subpath. It ships a
6
- built-in resolver for `child`, `adult`, `parent`, and `family` roles with
7
- the seven WebP illustrations embedded as base64 data URLs, plus
8
- `createPersonImageResolver` so an application can declare its own role
9
- names (`teacher`, `student`, `doctor`, `driver`, …) and TypeScript catches
10
- unknown role strings at the call site. The root `najm-kit` entry stays
11
- unchanged and does not pull in the person images.
12
-
1
+ # Changelog
2
+
3
+ ## 2.9.0 - 2026-08-09
4
+
5
+ - Added `najm-kit/server`, a pure UI bootstrap loader. `createUiBootstrapLoader()`
6
+ takes the application's own fetcher, endpoint paths, payload parsers, and
7
+ factory values, then runs the resources concurrently, unwraps the `{ data }`
8
+ envelope (or one the application selects), and falls back per resource so a
9
+ branding outage never discards a valid appearance. Failures are reported
10
+ through an optional structured `onDiagnostic` callback carrying resource,
11
+ reason, path, and status never a response body, header, cookie, or raw
12
+ thrown value. A `fallback()` that throws stays a visible error. The entry
13
+ imports no React, no Next.js, and no Node built-in, and re-exports
14
+ `parseNajmDesignConfig` so an appearance payload can be parsed without
15
+ reaching the root barrel.
16
+ - Added `najm-kit/server/react`, the React Server Component adapter.
17
+ `createReactServerUiBootstrap()` memoizes one bootstrap per request with
18
+ React's `cache()` and derives the per-resource accessors from it, so a root
19
+ layout, a nested layout, and a page share one resolution and one stable
20
+ snapshot for the whole render. Resolution is request-scoped only: separate
21
+ requests share no snapshot, failure, or diagnostic, and a transient outage is
22
+ retried on the next request. The `browser` export condition resolves to a
23
+ module that throws, so importing the adapter from a Client Component fails at
24
+ build time instead of shipping the application's fetcher and factory values
25
+ into a browser bundle.
26
+ - The root `najm-kit`, `najm-kit/next`, and `najm-kit/app` entries are unchanged
27
+ and do not reach either server entry.
28
+
29
+ ## 2.8.2 - 2026-08-08
30
+
31
+ - Added the framework-neutral `najm-kit/person-images` subpath. It ships a
32
+ built-in resolver for `child`, `adult`, `parent`, and `family` roles with
33
+ the seven WebP illustrations embedded as base64 data URLs, plus
34
+ `createPersonImageResolver` so an application can declare its own role
35
+ names (`teacher`, `student`, `doctor`, `driver`, …) and TypeScript catches
36
+ unknown role strings at the call site. The root `najm-kit` entry stays
37
+ unchanged and does not pull in the person images.
38
+
13
39
  ## 2.8.1 - 2026-08-08
14
40
 
15
41
  - Added schema-driven form development tools to `NajmAppProvider`. Passing
@@ -37,112 +63,112 @@
37
63
  - Added shared media-query/card-viewport helpers and avatar-source utilities.
38
64
 
39
65
  ## 2.6.2
40
-
41
- - Added `NSidebarProvider` and `useNSidebar`, so sidebar state can be read from a distance. `NSidebar` renders beside the page content rather than around it, which left applications hand-rolling a context to hand `setMobileOpen` down to a page header — a wrapper component plus an aliased import at every call site. Wrap the shell in `NSidebarProvider` and `NPageHeader` now resolves both `onSidebarOpen` and `mobileBreakpoint` from it, so a header nested anywhere below renders a working mobile trigger with no props threaded to it. Also exports the `NSidebarContextValue` type.
42
- - `NSidebar` resolves its open and collapsed state as explicit prop → surrounding provider → internal state. Passing `collapsed`, `mobileOpen`, `onCollapsedChange`, or `onMobileOpenChange` keeps behaving exactly as before, and a sidebar with no provider around it still owns its own state, so this is additive for every existing consumer.
43
- - `logo` accepts a render prop, `({ collapsed, isMobile }) => ReactNode`, alongside the existing node. It receives the state the sidebar actually resolved — including whatever `autoCollapseAt` decided — which consumers previously had to approximate with their own responsive classes, guessing at a breakpoint the sidebar had already computed. The mobile drawer always reports `collapsed: false`, matching how it renders. Exported as `SidebarLogoRender`.
44
-
45
- ## 2.6.1
46
-
47
- - Fixed the non-card `NPageHeader` bleed never taking effect. 2.6.0 cancelled the page padding with the Tailwind utilities `-mt-[var(--najm-section-gap,0px)]` and `-mx-[var(--najm-page-gutter,0px)]`, which only work if the consuming app's Tailwind build happens to emit those arbitrary classes — they exist nowhere but inside this package's bundle, so a consumer could load a stylesheet without them and the header stayed exactly where it was. The offsets are inline styles now and no longer depend on the consumer's CSS pipeline.
48
-
49
- ## 2.6.0
50
-
51
- - Added `NThemePresets`, and wired it into `NThemeCustomizer` through `presets`, `selectedPresetId`, `presetsStatus`, `savedDesign`, `onPresetSelect`, `onPresetSave`, `onPresetDelete`, and `presetLabels`. The picker renders only when a host supplies both `presets` and `onPresetSelect`. It is presentational: the host owns where presets live and what saving one means, and selecting a row hands the design back so it can be previewed before anything is stored. Each row draws a swatch strip from the design's own `sidebar`, `primary`, `secondary`, `accent`, and `background` tokens; the selected row's check sits left in the success colour and per-row delete sits right. Omit `onPresetSave` or `onPresetDelete` to hide those controls. Deleting is pointer-only — Radix owns roving focus inside the listbox.
52
- - **`NPageHeader` in non-card mode is now flush.** It rendered as a full-bleed bar (`border-b`, no radius) but still sat inside the padding `NPageLayout` applies, so it floated below and inside the page gutter and its bottom rule never met the sidebar header's. It now cancels that padding, and its base height goes `min-h-12` → `min-h-14` to match `NSidebarHeader`. **Non-card page headers move up and out to the page edges, and grow 8px below `sm`.** Card mode is unchanged.
53
- - `NPageLayout` publishes its resolved spacing as `--najm-page-gutter` and `--najm-section-gap`. Descendants could not previously cancel the page padding: a design config resolves the gutter to a literal, so the pre-existing `--page-gutter` / `--section-gap` variables only ever held the fallbacks. Full-bleed children should negate these, with `0px` fallbacks so they stay inert outside `NPageLayout`.
54
- - Fixed `SelectInput` discarding `SelectItemType.icon`. The prop was declared but `renderItems` rendered the label alone, so every per-item icon was silently dropped. Items with an icon now render it before a truncating label; items without one are unchanged.
55
-
56
- ## 2.5.0
57
-
58
- - Added `NTableDefaultsProvider`, so an application supplies `paginationLabels` once instead of at every table. Labels merge per key, most specific first: a table's own `paginationLabels` override the provider's for the keys it sets, the provider covers the rest, and anything neither supplies falls back to the packaged English. Also exports `useNTableDefaults` and the `NTableDefaults` type.
59
- - `value` is passed through the provider unmemoized; memoize it in the caller, or every table below re-renders with the shell.
60
-
61
- ## 2.4.0
62
-
63
- - `NTablePagination` renders numbered page buttons instead of `Page X of Y`. The window shows the first and last page, the current page, and one page either side, collapsing the rest into at most two gaps. The slot count is constant for any result longer than the window, so the bar does not change width as the reader pages through it, and a gap never stands in for a single page — that slot goes to the page instead.
64
- - Added `paginationVariant`, defaulting to `"numbered"`. Pass `"compact"` to keep the previous position text with first/previous/next/last controls. **This changes the default appearance of every paginated `NTable`.**
65
- - The numbered variant drops the first/last double chevrons, because page 1 and page N are now single-click targets of their own. Previous and next remain. The compact variant is unchanged.
66
- - Numbered pages fall back to compact on their own when the page count is not trustworthy — that is, under `manualPagination` with no `pageCount` supplied, where TanStack infers a count from the rows it happens to hold rather than from a result total. Numbering that would invite clicks on pages that may not exist is not rendered.
67
- - Below the `sm` breakpoint the numbers give way to the position text; seven page buttons plus the rows-per-page select do not fit a phone.
68
- - Added `paginationLabels` so the bar can be localized: `rowsPerPage`, `pagination`, `goToPage`, `currentPage`, `firstPage`, `previousPage`, `nextPage`, `lastPage`, `pageOf`, and `rowsSelected`. All optional, all falling back to the previous English strings.
69
- - Pagination chevrons now mirror under `dir="rtl"`. They previously pointed against the reading direction in right-to-left layouts.
70
- - The page controls are wrapped in a labelled `nav`, and the current page carries `aria-current="page"`.
71
- - Exported `buildPageItems` and `NTablePageItem` for consumers that need the same windowing outside the table.
72
-
73
- ## 2.2.1
74
-
75
- - Fixed a regression in 2.2.0: the dynamic page size reported under `manualPagination` could oscillate. Card row height is measured from rendered cards, so it grows as images decode; feeding that back into the page size refetched, re-rendered, re-measured, and refetched again. A list visibly settled from one page size to another with the loading skeleton flashing twice. The report is now allowed once per container geometry, which does not depend on the rows inside it, so it terminates. A resize still re-arms it, and the debounce still waits for the measurement to settle before reporting.
76
-
77
- ## 2.2.0
78
-
79
- - Added `cardPagination` mode `infinite`: card lists continue on scroll instead of behind a button. No control and no end-of-list element render while the list is healthy. The continuation button appears only after an append failure, as the retry target.
80
- - Infinite continuation is owned by `NTableCards`, so the sentinel lives inside the card list's own `NajmScroll` viewport and uses it as the observer root. An appending page renders shaped card placeholders at the grid tail rather than a spinner in a fixed strip, and the polite `aria-live` announcement of appended row counts is preserved.
81
- - `cardPagination: { mode: "all" }` is now honored in table mode as well as cards: every supplied row renders and no pagination controls are shown.
82
- - `dynamicHeight` now takes effect under `manualPagination`. The measured page size is reported through the ordinary `onPaginationChange` callback, debounced, so server-paginated tables fill their container while the consumer keeps ownership of fetching. `maxHeight` stays caller-owned under manual pagination, and no page size is reported before the first measurement.
83
- - Added `calculateCardPageSize`, floored to whole card rows, published as `calculatedCardPageSize`. A card grid page no longer ends in a ragged partial row. This deliberately differs from `calculateCardSkeletonCount`, which ceils because overfilling placeholders is harmless.
84
- - Removed the deprecated `baseUrl` compiler option from the package tsconfig; `paths` resolves relative to the config file.
85
-
86
- ## 2.1.56
87
-
88
- - Honor `showIcon` on NTable `select` and `combobox` filters. The leading filter icon is still shown by default; pass `showIcon: false` on a filter to hide it.
89
-
90
- ## 2.1.55
91
-
92
- - Added controlled remote-search and loading-state props to `ComboboxInput` and `FormInput type="combobox"` while preserving client filtering by default.
93
-
94
- ## 2.1.53 - 2026-08-05
95
-
96
- - Add typed `NBarChart`, `NLineChart`, `NPieChart`, and `NStatusBreakdown`
97
- components with caller-formatted generic data, accessible summaries, empty
98
- states, responsive RTL-safe layouts, and shape-matched loading skeletons.
99
- - Default chart colors to the live `--chart-1` through `--chart-5` theme
100
- variables, cycle deterministically after five items, and retain explicit
101
- per-series/item color overrides.
102
- - Add preset and numeric chart diameter contracts to `NPieChart` and
103
- `NDonutCard`, including narrow-container shrinking without clipped legends.
104
- - Make `NDonutCard` item colors optional and add accessible loading states to
105
- `NDonutCard` and `NStatCard`.
106
- - Add public API tests, component tests, README guidance, and playground
107
- examples for the chart and loading contracts.
108
-
109
- ## 2.1.49 - 2026-08-04
110
-
111
- ### ImageInput and AvatarInput
112
-
113
- - Add `previewAlt`, `fallbackImage`, `fallbackAlt`, `unavailableContent`,
114
- `imageClassName`, `onPreviewError`, `replaceAriaLabel`, and `clearAriaLabel`
115
- to `ImageInputProps`. `AvatarInput` forwards every new prop unchanged.
116
- - Preview sources resolve in this priority order: `value`, `fallbackImage`,
117
- `defaultImage`. Candidate URLs are deduplicated so a failing primary URL is
118
- never retried through multiple stages. When every candidate fails, the
119
- broken `<img>` is unmounted and `unavailableContent` (or a neutral default)
120
- is rendered in its place.
121
- - `imageVersion` is appended safely to relative, absolute, queried, and
122
- fragmented URLs. `data:`, `blob:`, `javascript:`, and `file:` URLs are
123
- left unchanged.
124
- - Expose `data-image-input-state="empty" | "preview" | "fallback" | "unavailable"`
125
- on the preview container for styling, testing, and consumer diagnostics.
126
- - File selection is race-safe: stale `FileReader` completions cannot replace
127
- a newer value. Object URLs created by the component are tracked so
128
- consumer-owned blob URLs are never revoked.
129
- - Replace and clear controls are real `<button>` elements, are reachable
130
- with the keyboard, and stay visible on touch and coarse-pointer devices.
131
- Only on `(hover: hover) and (pointer: fine)` desktops do the controls fall
132
- back to a hover/focus reveal. `focus-visible` always restores visibility.
133
- - Use logical positioning (`end-*`) so the clear button works correctly in
134
- RTL layouts.
135
- - Re-export `ImageInputPreviewSource` and `ImageInputPreviewError` from
136
- `najm-kit/components/inputs` and the package root.
137
-
138
- ## 2.1.48 - 2026-08-04
139
-
140
- - Keep responsive card row actions visible on phone, tablet, and touch input,
141
- while retaining hover and keyboard-focus reveal on fine-pointer desktops.
142
- - Size table and card loading skeletons from the measured body and active grid,
143
- and keep loading borders, radius, color, and shadow aligned with loaded
144
- surfaces.
145
- - Add the exported `NTableCardPagination` and `NTableLoadMorePagination`
146
- contracts for paged, complete supplied-data, and explicit server-backed Load
147
- more card presentation, including guarded append/retry behavior and accessible
148
- loading, result, error, and terminal feedback.
66
+
67
+ - Added `NSidebarProvider` and `useNSidebar`, so sidebar state can be read from a distance. `NSidebar` renders beside the page content rather than around it, which left applications hand-rolling a context to hand `setMobileOpen` down to a page header — a wrapper component plus an aliased import at every call site. Wrap the shell in `NSidebarProvider` and `NPageHeader` now resolves both `onSidebarOpen` and `mobileBreakpoint` from it, so a header nested anywhere below renders a working mobile trigger with no props threaded to it. Also exports the `NSidebarContextValue` type.
68
+ - `NSidebar` resolves its open and collapsed state as explicit prop → surrounding provider → internal state. Passing `collapsed`, `mobileOpen`, `onCollapsedChange`, or `onMobileOpenChange` keeps behaving exactly as before, and a sidebar with no provider around it still owns its own state, so this is additive for every existing consumer.
69
+ - `logo` accepts a render prop, `({ collapsed, isMobile }) => ReactNode`, alongside the existing node. It receives the state the sidebar actually resolved — including whatever `autoCollapseAt` decided — which consumers previously had to approximate with their own responsive classes, guessing at a breakpoint the sidebar had already computed. The mobile drawer always reports `collapsed: false`, matching how it renders. Exported as `SidebarLogoRender`.
70
+
71
+ ## 2.6.1
72
+
73
+ - Fixed the non-card `NPageHeader` bleed never taking effect. 2.6.0 cancelled the page padding with the Tailwind utilities `-mt-[var(--najm-section-gap,0px)]` and `-mx-[var(--najm-page-gutter,0px)]`, which only work if the consuming app's Tailwind build happens to emit those arbitrary classes — they exist nowhere but inside this package's bundle, so a consumer could load a stylesheet without them and the header stayed exactly where it was. The offsets are inline styles now and no longer depend on the consumer's CSS pipeline.
74
+
75
+ ## 2.6.0
76
+
77
+ - Added `NThemePresets`, and wired it into `NThemeCustomizer` through `presets`, `selectedPresetId`, `presetsStatus`, `savedDesign`, `onPresetSelect`, `onPresetSave`, `onPresetDelete`, and `presetLabels`. The picker renders only when a host supplies both `presets` and `onPresetSelect`. It is presentational: the host owns where presets live and what saving one means, and selecting a row hands the design back so it can be previewed before anything is stored. Each row draws a swatch strip from the design's own `sidebar`, `primary`, `secondary`, `accent`, and `background` tokens; the selected row's check sits left in the success colour and per-row delete sits right. Omit `onPresetSave` or `onPresetDelete` to hide those controls. Deleting is pointer-only — Radix owns roving focus inside the listbox.
78
+ - **`NPageHeader` in non-card mode is now flush.** It rendered as a full-bleed bar (`border-b`, no radius) but still sat inside the padding `NPageLayout` applies, so it floated below and inside the page gutter and its bottom rule never met the sidebar header's. It now cancels that padding, and its base height goes `min-h-12` → `min-h-14` to match `NSidebarHeader`. **Non-card page headers move up and out to the page edges, and grow 8px below `sm`.** Card mode is unchanged.
79
+ - `NPageLayout` publishes its resolved spacing as `--najm-page-gutter` and `--najm-section-gap`. Descendants could not previously cancel the page padding: a design config resolves the gutter to a literal, so the pre-existing `--page-gutter` / `--section-gap` variables only ever held the fallbacks. Full-bleed children should negate these, with `0px` fallbacks so they stay inert outside `NPageLayout`.
80
+ - Fixed `SelectInput` discarding `SelectItemType.icon`. The prop was declared but `renderItems` rendered the label alone, so every per-item icon was silently dropped. Items with an icon now render it before a truncating label; items without one are unchanged.
81
+
82
+ ## 2.5.0
83
+
84
+ - Added `NTableDefaultsProvider`, so an application supplies `paginationLabels` once instead of at every table. Labels merge per key, most specific first: a table's own `paginationLabels` override the provider's for the keys it sets, the provider covers the rest, and anything neither supplies falls back to the packaged English. Also exports `useNTableDefaults` and the `NTableDefaults` type.
85
+ - `value` is passed through the provider unmemoized; memoize it in the caller, or every table below re-renders with the shell.
86
+
87
+ ## 2.4.0
88
+
89
+ - `NTablePagination` renders numbered page buttons instead of `Page X of Y`. The window shows the first and last page, the current page, and one page either side, collapsing the rest into at most two gaps. The slot count is constant for any result longer than the window, so the bar does not change width as the reader pages through it, and a gap never stands in for a single page — that slot goes to the page instead.
90
+ - Added `paginationVariant`, defaulting to `"numbered"`. Pass `"compact"` to keep the previous position text with first/previous/next/last controls. **This changes the default appearance of every paginated `NTable`.**
91
+ - The numbered variant drops the first/last double chevrons, because page 1 and page N are now single-click targets of their own. Previous and next remain. The compact variant is unchanged.
92
+ - Numbered pages fall back to compact on their own when the page count is not trustworthy — that is, under `manualPagination` with no `pageCount` supplied, where TanStack infers a count from the rows it happens to hold rather than from a result total. Numbering that would invite clicks on pages that may not exist is not rendered.
93
+ - Below the `sm` breakpoint the numbers give way to the position text; seven page buttons plus the rows-per-page select do not fit a phone.
94
+ - Added `paginationLabels` so the bar can be localized: `rowsPerPage`, `pagination`, `goToPage`, `currentPage`, `firstPage`, `previousPage`, `nextPage`, `lastPage`, `pageOf`, and `rowsSelected`. All optional, all falling back to the previous English strings.
95
+ - Pagination chevrons now mirror under `dir="rtl"`. They previously pointed against the reading direction in right-to-left layouts.
96
+ - The page controls are wrapped in a labelled `nav`, and the current page carries `aria-current="page"`.
97
+ - Exported `buildPageItems` and `NTablePageItem` for consumers that need the same windowing outside the table.
98
+
99
+ ## 2.2.1
100
+
101
+ - Fixed a regression in 2.2.0: the dynamic page size reported under `manualPagination` could oscillate. Card row height is measured from rendered cards, so it grows as images decode; feeding that back into the page size refetched, re-rendered, re-measured, and refetched again. A list visibly settled from one page size to another with the loading skeleton flashing twice. The report is now allowed once per container geometry, which does not depend on the rows inside it, so it terminates. A resize still re-arms it, and the debounce still waits for the measurement to settle before reporting.
102
+
103
+ ## 2.2.0
104
+
105
+ - Added `cardPagination` mode `infinite`: card lists continue on scroll instead of behind a button. No control and no end-of-list element render while the list is healthy. The continuation button appears only after an append failure, as the retry target.
106
+ - Infinite continuation is owned by `NTableCards`, so the sentinel lives inside the card list's own `NajmScroll` viewport and uses it as the observer root. An appending page renders shaped card placeholders at the grid tail rather than a spinner in a fixed strip, and the polite `aria-live` announcement of appended row counts is preserved.
107
+ - `cardPagination: { mode: "all" }` is now honored in table mode as well as cards: every supplied row renders and no pagination controls are shown.
108
+ - `dynamicHeight` now takes effect under `manualPagination`. The measured page size is reported through the ordinary `onPaginationChange` callback, debounced, so server-paginated tables fill their container while the consumer keeps ownership of fetching. `maxHeight` stays caller-owned under manual pagination, and no page size is reported before the first measurement.
109
+ - Added `calculateCardPageSize`, floored to whole card rows, published as `calculatedCardPageSize`. A card grid page no longer ends in a ragged partial row. This deliberately differs from `calculateCardSkeletonCount`, which ceils because overfilling placeholders is harmless.
110
+ - Removed the deprecated `baseUrl` compiler option from the package tsconfig; `paths` resolves relative to the config file.
111
+
112
+ ## 2.1.56
113
+
114
+ - Honor `showIcon` on NTable `select` and `combobox` filters. The leading filter icon is still shown by default; pass `showIcon: false` on a filter to hide it.
115
+
116
+ ## 2.1.55
117
+
118
+ - Added controlled remote-search and loading-state props to `ComboboxInput` and `FormInput type="combobox"` while preserving client filtering by default.
119
+
120
+ ## 2.1.53 - 2026-08-05
121
+
122
+ - Add typed `NBarChart`, `NLineChart`, `NPieChart`, and `NStatusBreakdown`
123
+ components with caller-formatted generic data, accessible summaries, empty
124
+ states, responsive RTL-safe layouts, and shape-matched loading skeletons.
125
+ - Default chart colors to the live `--chart-1` through `--chart-5` theme
126
+ variables, cycle deterministically after five items, and retain explicit
127
+ per-series/item color overrides.
128
+ - Add preset and numeric chart diameter contracts to `NPieChart` and
129
+ `NDonutCard`, including narrow-container shrinking without clipped legends.
130
+ - Make `NDonutCard` item colors optional and add accessible loading states to
131
+ `NDonutCard` and `NStatCard`.
132
+ - Add public API tests, component tests, README guidance, and playground
133
+ examples for the chart and loading contracts.
134
+
135
+ ## 2.1.49 - 2026-08-04
136
+
137
+ ### ImageInput and AvatarInput
138
+
139
+ - Add `previewAlt`, `fallbackImage`, `fallbackAlt`, `unavailableContent`,
140
+ `imageClassName`, `onPreviewError`, `replaceAriaLabel`, and `clearAriaLabel`
141
+ to `ImageInputProps`. `AvatarInput` forwards every new prop unchanged.
142
+ - Preview sources resolve in this priority order: `value`, `fallbackImage`,
143
+ `defaultImage`. Candidate URLs are deduplicated so a failing primary URL is
144
+ never retried through multiple stages. When every candidate fails, the
145
+ broken `<img>` is unmounted and `unavailableContent` (or a neutral default)
146
+ is rendered in its place.
147
+ - `imageVersion` is appended safely to relative, absolute, queried, and
148
+ fragmented URLs. `data:`, `blob:`, `javascript:`, and `file:` URLs are
149
+ left unchanged.
150
+ - Expose `data-image-input-state="empty" | "preview" | "fallback" | "unavailable"`
151
+ on the preview container for styling, testing, and consumer diagnostics.
152
+ - File selection is race-safe: stale `FileReader` completions cannot replace
153
+ a newer value. Object URLs created by the component are tracked so
154
+ consumer-owned blob URLs are never revoked.
155
+ - Replace and clear controls are real `<button>` elements, are reachable
156
+ with the keyboard, and stay visible on touch and coarse-pointer devices.
157
+ Only on `(hover: hover) and (pointer: fine)` desktops do the controls fall
158
+ back to a hover/focus reveal. `focus-visible` always restores visibility.
159
+ - Use logical positioning (`end-*`) so the clear button works correctly in
160
+ RTL layouts.
161
+ - Re-export `ImageInputPreviewSource` and `ImageInputPreviewError` from
162
+ `najm-kit/components/inputs` and the package root.
163
+
164
+ ## 2.1.48 - 2026-08-04
165
+
166
+ - Keep responsive card row actions visible on phone, tablet, and touch input,
167
+ while retaining hover and keyboard-focus reveal on fine-pointer desktops.
168
+ - Size table and card loading skeletons from the measured body and active grid,
169
+ and keep loading borders, radius, color, and shadow aligned with loaded
170
+ surfaces.
171
+ - Add the exported `NTableCardPagination` and `NTableLoadMorePagination`
172
+ contracts for paged, complete supplied-data, and explicit server-backed Load
173
+ more card presentation, including guarded append/retry behavior and accessible
174
+ loading, result, error, and terminal feedback.
package/README.md CHANGED
@@ -601,3 +601,115 @@ only, after a real `image` and before the role's gender variant:
601
601
  getPersonImage({ image: child.image, role: "child", gender: child.gender, fallback: child.placeholder });
602
602
  ```
603
603
 
604
+
605
+ ## Server UI bootstrap (`najm-kit/server`, `najm-kit/server/react`)
606
+
607
+ An application that renders its own theme and its own logos on the server ends
608
+ up writing the same module every time: fetch the public endpoints, unwrap the
609
+ `data` envelope, validate the payload, fall back to the built-in assets when
610
+ any of that fails, and run the resources in parallel. These two entries own
611
+ that mechanism. What stays with the application is what is genuinely
612
+ application-specific — how a request reaches its own backend, which paths it
613
+ serves, what a valid payload looks like, what the factory values are, and where
614
+ a diagnostic goes.
615
+
616
+ Neither entry is re-exported from `najm-kit`, `najm-kit/next`, or
617
+ `najm-kit/app`. `najm-kit/server` imports no React at all, so a route handler
618
+ or a plain script can use it.
619
+
620
+ ### The application's one server module
621
+
622
+ ```ts
623
+ // src/lib/serverLoader.ts
624
+ import "server-only";
625
+
626
+ import { parseNajmDesignConfig } from "najm-kit/server";
627
+ import { createReactServerUiBootstrap } from "najm-kit/server/react";
628
+
629
+ export const serverUi = createReactServerUiBootstrap({
630
+ fetcher: async (path) => {
631
+ const { server } = await import("@app/server");
632
+ return server.fetch(new Request(`http://internal${path}`));
633
+ },
634
+ resources: {
635
+ appearance: {
636
+ path: "/api/appearance",
637
+ parse: parseAppearance, // returns undefined or throws to reject
638
+ fallback: getFactoryAppearance, // called per load
639
+ },
640
+ branding: {
641
+ path: "/api/branding",
642
+ parse: parseBranding,
643
+ fallback: getFactoryBranding,
644
+ },
645
+ },
646
+ onDiagnostic: (diagnostic) => {
647
+ console.warn(`[ui-bootstrap] ${diagnostic.resource} ${diagnostic.reason}`, diagnostic);
648
+ },
649
+ });
650
+
651
+ export const loadServerUiBootstrap = serverUi.load;
652
+ export const { appearance: loadServerAppearance, branding: loadServerBranding } =
653
+ serverUi.loaders;
654
+ ```
655
+
656
+ `load()` resolves every resource; `loaders.<name>()` and `loadResource(name)`
657
+ read one off the same resolution. Resource names, payload types, and the number
658
+ of resources are the application's — the snapshot type is inferred from the
659
+ `resources` object, so `snapshot.branding` is your branding type and not a
660
+ package interface.
661
+
662
+ ### Call the factory once, at module scope
663
+
664
+ `createReactServerUiBootstrap()` builds one `React.cache()` entry. Calling it
665
+ inside a layout, page, or component builds a fresh one per call and shares
666
+ nothing. Every server boundary in a render must import the same module.
667
+
668
+ The cache is React's, so it is request-scoped and nothing else: separate
669
+ requests never see each other's snapshot or each other's failure, and a
670
+ transient outage is retried on the next request rather than pinned into a
671
+ process-global. That also rules out a module `Map`, a module promise,
672
+ `unstable_cache`, `"use cache"`, or a durable cache here — every one of them
673
+ would leak one visitor's render into another's.
674
+
675
+ The snapshot is deliberately stable for the length of one render. A settings
676
+ surface that saves appearance or branding updates the client provider and then
677
+ refreshes or navigates into a new render to observe the persisted result.
678
+
679
+ Outside a render — route handlers, server actions, scripts — use
680
+ `createUiBootstrapLoader()` from `najm-kit/server` directly. There is no request
681
+ cache for `cache()` to write to there, so the adapter would silently re-fetch
682
+ per call.
683
+
684
+ ### Failure behaviour
685
+
686
+ Resources fall back independently: a branding outage never discards a valid
687
+ appearance. Each failure calls `onDiagnostic` once with a `reason` of
688
+ `fetch-failed`, `response-not-ok`, `invalid-json`, `invalid-envelope`, or
689
+ `invalid-payload`, plus the path and — for a non-success response — the status.
690
+ Diagnostics never carry response bodies, headers, cookies, or raw thrown
691
+ values; `error` is a normalized `"<name>: <message>"` for an `Error` and the
692
+ value's type for anything else.
693
+
694
+ A `fallback()` that throws is **not** caught. A missing factory theme is the
695
+ application's configuration error, and a second fallback would only hide it.
696
+
697
+ Falling back is right for *public* appearance and branding, where the worst case
698
+ is a visitor seeing the built-in logo. It is not a general rule: do not route
699
+ authenticated, financial, or privacy-sensitive reads through this, because a
700
+ silent fallback there hides an outage behind plausible-looking data.
701
+
702
+ ### Envelopes
703
+
704
+ `select` defaults to Najm's `{ data }` envelope. Applications behind a different
705
+ envelope pass their own at the loader level or per resource; returning the
706
+ payload unchanged is a valid selector, and throwing rejects the response as
707
+ `invalid-envelope`.
708
+
709
+ ### Client Components
710
+
711
+ `najm-kit/server/react` maps the `browser` export condition to a module that
712
+ throws, so importing it from a Client Component fails the build with an
713
+ explanation rather than shipping the application's fetcher and factory values
714
+ into a browser bundle. Seed the client from the server snapshot through
715
+ `NajmAppProvider` instead.
@@ -1,166 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as React$1 from 'react';
2
+ import * as React from 'react';
3
3
  import React__default from 'react';
4
+ import { e as NajmMode, a as NajmDesignConfig } from './design-types-Rkpt8Pg1.js';
4
5
  import { b as NTablePaginationLabels, N as NajmTranslate } from './paginationLabels-dZLSNxfo.js';
5
6
 
6
- type NajmMode = 'light' | 'dark';
7
- type NajmAccent = 'neutral' | 'emerald' | 'green' | 'slate' | 'blue' | 'violet';
8
- type NajmPreset = 'light' | 'dark' | 'dark-emerald' | 'dark-green' | 'dark-slate' | 'dark-blue' | 'dark-violet';
9
- interface NajmAppearance {
10
- /** Global border thickness, e.g. `'0'`, `'1px'`, `'2px'`. `'0'` hides borders. */
11
- borderWidth?: string;
12
- }
13
- interface NajmThemeTokens {
14
- background?: string;
15
- foreground?: string;
16
- card?: string;
17
- 'card-foreground'?: string;
18
- popover?: string;
19
- 'popover-foreground'?: string;
20
- primary?: string;
21
- 'primary-foreground'?: string;
22
- secondary?: string;
23
- 'secondary-foreground'?: string;
24
- tertiary?: string;
25
- 'tertiary-foreground'?: string;
26
- muted?: string;
27
- 'muted-foreground'?: string;
28
- accent?: string;
29
- 'accent-foreground'?: string;
30
- destructive?: string;
31
- 'destructive-foreground'?: string;
32
- border?: string;
33
- input?: string;
34
- ring?: string;
35
- sidebar?: string;
36
- 'sidebar-foreground'?: string;
37
- 'sidebar-primary'?: string;
38
- 'sidebar-primary-foreground'?: string;
39
- 'sidebar-accent'?: string;
40
- 'sidebar-accent-foreground'?: string;
41
- 'sidebar-border'?: string;
42
- 'sidebar-ring'?: string;
43
- 'chart-1'?: string;
44
- 'chart-2'?: string;
45
- 'chart-3'?: string;
46
- 'chart-4'?: string;
47
- 'chart-5'?: string;
48
- radius?: string;
49
- }
50
- /** Serializable theme settings suitable for JSON files, APIs, or local storage. */
51
- interface NajmThemeConfig {
52
- preset?: NajmPreset;
53
- mode?: NajmMode;
54
- accent?: NajmAccent;
55
- tokens?: NajmThemeTokens;
56
- /**
57
- * Per-mode token overrides authored on top of the composed preset. Keeps
58
- * light and dark customizations independent: editing a token in one mode
59
- * records it here so it survives switching to the other mode and back.
60
- * Providers resolve this field on top of the composed mode/accent preset.
61
- */
62
- overrides?: Partial<Record<NajmMode, NajmThemeTokens>>;
63
- accentOnly?: boolean;
64
- appearance?: NajmAppearance;
65
- radius?: string;
66
- }
67
- interface NajmThemeProviderProps {
68
- /** Serializable theme settings. Explicit provider props override this config. */
69
- config?: NajmThemeConfig;
70
- preset?: NajmPreset;
71
- mode?: NajmMode;
72
- accent?: NajmAccent;
73
- tokens?: NajmThemeTokens;
74
- /** When true, only inject accent tokens (primary, ring, accent and their foregrounds).
75
- * Everything else (bg, card, fg…) is inherited from the parent cascade. */
76
- accentOnly?: boolean;
77
- /** App-wide UI preferences (currently global border width). */
78
- appearance?: NajmAppearance;
79
- /** Global base radius, for example `0`, `0.5rem`, or `0.75rem`. */
80
- radius?: string;
81
- className?: string;
82
- asChild?: boolean;
83
- children: React.ReactNode;
84
- }
85
-
86
- type NajmDensity = "compact" | "default" | "comfortable";
87
- /** Tailwind's mobile-first viewport breakpoints, plus the default value. */
88
- type NajmResponsiveBreakpoint = "base" | "sm" | "md" | "lg" | "xl" | "2xl";
89
- /**
90
- * A scalar value for every viewport, or mobile-first breakpoint overrides.
91
- * For example: `{ base: 164, lg: 200, xl: 240 }`.
92
- */
93
- type NajmResponsiveValue<T> = T | Partial<Record<NajmResponsiveBreakpoint, T>>;
94
- type NajmComponentRadius = "inherit" | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | string;
95
- interface NajmSlotStyle {
96
- className?: string;
97
- radius?: NajmComponentRadius;
98
- borderWidth?: string;
99
- padding?: string;
100
- paddingTop?: string;
101
- }
102
- interface NajmVariantStyle {
103
- /** Reuse another variant's recipe. Example: primary badge uses secondary. */
104
- use?: string;
105
- className?: string;
106
- tokens?: Record<string, string>;
107
- }
108
- interface NajmComponentStyleConfig {
109
- /** Render components that support it as a card-like surface. */
110
- card?: boolean;
111
- /** Sidebar-only: render section titles above grouped nav items. */
112
- showSectionLabels?: boolean;
113
- /** Sidebar-only: render separator lines between nav item sections. */
114
- showSectionSeparators?: boolean;
115
- /** Sidebar-only: expanded width in px (default 240). Supports responsive overrides. */
116
- expandedWidth?: NajmResponsiveValue<number>;
117
- /** Sidebar-only: collapsed width in px (default 64). Supports responsive overrides. */
118
- collapsedWidth?: NajmResponsiveValue<number>;
119
- /** Sidebar-only: mobile drawer width in px. Defaults to the expanded width. */
120
- mobileWidth?: NajmResponsiveValue<number>;
121
- defaultVariant?: string;
122
- defaultSize?: string;
123
- density?: NajmDensity;
124
- /** NTable-only: CSS color used for the table header and add button. */
125
- headerColor?: string;
126
- /** NTable-only: CSS color used for table header text and add button text. */
127
- headerTextColor?: string;
128
- /** NTable-only: CSS color used for table container and row borders. */
129
- borderColor?: string;
130
- radius?: NajmComponentRadius;
131
- borderWidth?: string;
132
- slots?: Record<string, NajmSlotStyle>;
133
- variants?: Record<string, NajmVariantStyle>;
134
- }
135
- type NajmComponentName = "button" | "badge" | "card" | "table" | "tabs" | "dialog" | "alert" | "sidebar" | "pageHeader" | "input" | "select" | "dropdown" | "sheet" | "popover" | "tooltip" | "progress" | "avatar";
136
- type NajmComponentThemeConfig = Partial<Record<NajmComponentName, NajmComponentStyleConfig>>;
137
- interface NajmTypographyConfig {
138
- fontSans?: string;
139
- fontHeading?: string;
140
- fontMono?: string;
141
- baseSize?: string;
142
- scale?: "compact" | "default" | "comfortable";
143
- lineHeight?: string;
144
- letterSpacing?: string;
145
- }
146
- interface NajmLayoutConfig {
147
- /** Page inline padding, usually used by NPageLayout. */
148
- pageGutter?: string;
149
- /** Vertical page padding and stacked section gap, usually used by NPageLayout. */
150
- sectionGap?: string;
151
- }
152
- interface NajmDesignConfig {
153
- version: 1;
154
- theme: NajmThemeConfig;
155
- typography?: NajmTypographyConfig;
156
- components?: NajmComponentThemeConfig;
157
- layout?: NajmLayoutConfig;
158
- }
159
- declare const NAJM_COMPONENT_NAMES: readonly NajmComponentName[];
160
- /** Maps a NajmComponentRadius keyword to a CSS value (or var). */
161
- declare const RADIUS_VALUE_MAP: Record<string, string>;
162
- declare function resolveRadiusValue(radius: NajmComponentRadius | undefined): string | undefined;
163
-
164
7
  /**
165
8
  * Defaults every `NTable` beneath the provider inherits.
166
9
  *
@@ -205,7 +48,7 @@ interface NajmPreferencesContextValue {
205
48
  }
206
49
  declare const DEFAULT_TIME_ZONE = "UTC";
207
50
  interface NajmPreferencesProviderProps {
208
- children: React$1.ReactNode;
51
+ children: React.ReactNode;
209
52
  /** Seeds theme state; ignored after mount. Defaults to `"light"`. */
210
53
  initialTheme?: NajmMode;
211
54
  /** Seeds time zone state; ignored after mount. Defaults to `"UTC"`. */
@@ -247,7 +90,7 @@ declare function useNajmTheme(): Pick<NajmPreferencesContextValue, "theme" | "se
247
90
  declare function useNajmTimeZone(): Pick<NajmPreferencesContextValue, "timeZone" | "setTimeZone">;
248
91
 
249
92
  interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "children"> {
250
- children: React$1.ReactNode;
93
+ children: React.ReactNode;
251
94
  /**
252
95
  * The design config handed to `NajmDesignProvider`, owned by the application.
253
96
  *
@@ -315,4 +158,4 @@ interface NajmUIProviderProps extends Omit<NajmPreferencesProviderProps, "childr
315
158
  */
316
159
  declare function NajmUIProvider({ children, design, initialDesign, className, t, paginationKeyPrefix, tableDefaults, initialTheme, initialTimeZone, onThemeChange, onTimeZoneChange, normalizeTimeZone, }: NajmUIProviderProps): react_jsx_runtime.JSX.Element;
317
160
 
318
- export { resolveRadiusValue as A, useNTableDefaults as B, useNajmPreferencesContext as C, DEFAULT_TIME_ZONE as D, useNajmTheme as E, useNajmTimeZone as F, type NajmUIProviderProps as N, RADIUS_VALUE_MAP as R, type NajmDesignConfig as a, type NajmThemeProviderProps as b, type NajmAppearance as c, type NajmMode as d, type NajmThemeConfig as e, type NajmAccent as f, type NajmThemeTokens as g, type NajmPreset as h, type NajmComponentName as i, type NajmComponentStyleConfig as j, type NajmComponentThemeConfig as k, type NajmTypographyConfig as l, type NajmLayoutConfig as m, type NajmVariantStyle as n, type NajmResponsiveBreakpoint as o, type NajmResponsiveValue as p, NAJM_COMPONENT_NAMES as q, type NTableDefaults as r, NTableDefaultsProvider as s, type NajmComponentRadius as t, type NajmDensity as u, type NajmPreferencesContextValue as v, NajmPreferencesProvider as w, type NajmPreferencesProviderProps as x, type NajmSlotStyle as y, NajmUIProvider as z };
161
+ export { DEFAULT_TIME_ZONE as D, type NajmUIProviderProps as N, type NTableDefaults as a, NTableDefaultsProvider as b, type NajmPreferencesContextValue as c, NajmPreferencesProvider as d, type NajmPreferencesProviderProps as e, NajmUIProvider as f, useNajmPreferencesContext as g, useNajmTheme as h, useNajmTimeZone as i, useNTableDefaults as u };
@@ -4,7 +4,8 @@ import { F as FormDevToolsOptions, N as NBrandingInput } from '../formFill-BcH-m
4
4
  import { NajmNextUIProviderProps } from './next.js';
5
5
  import 'react';
6
6
  import 'zod';
7
- import '../NajmUIProvider-BSbXaqak.js';
7
+ import '../NajmUIProvider-CI_73GEp.js';
8
+ import '../design-types-Rkpt8Pg1.js';
8
9
  import '../paginationLabels-dZLSNxfo.js';
9
10
 
10
11
  /** Branding shown by the kit's chrome. Purely presentational values. */
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React__default from 'react';
3
- import { N as NajmUIProviderProps } from '../NajmUIProvider-BSbXaqak.js';
3
+ import { N as NajmUIProviderProps } from '../NajmUIProvider-CI_73GEp.js';
4
+ import '../design-types-Rkpt8Pg1.js';
4
5
  import '../paginationLabels-dZLSNxfo.js';
5
6
 
6
7
  interface NextLinkAdapterProps extends Record<string, any> {