@celestia-island/hikari 0.55.528 → 0.55.530
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/dist/types/components/HkFaceShell.d.ts +15 -4
- package/dist/types/components/HkStatusBar.d.ts +75 -0
- package/dist/types/composables/useActionBar.d.ts +43 -7
- package/dist/types/composables/useAutoRefresh.d.ts +63 -0
- package/dist/types/composables/useDataFreshness.d.ts +83 -0
- package/dist/types/composables/usePageCreateAction.d.ts +27 -22
- package/dist/types/composables/usePageRefresh.d.ts +32 -30
- package/dist/types/composables/usePageSearch.d.ts +2 -1
- package/dist/types/index.d.ts +6 -2
- package/package.json +1 -1
- package/src/components/HkAdminShell.test.tsx +6 -3
- package/src/components/HkConnectionStatus.tsx +17 -0
- package/src/components/HkFaceShell.footerCentre.test.tsx +138 -0
- package/src/components/HkFaceShell.headerExtra.test.tsx +6 -3
- package/src/components/HkFaceShell.rail.test.tsx +6 -3
- package/src/components/HkFaceShell.test.tsx +9 -3
- package/src/components/HkFaceShell.tsx +39 -12
- package/src/components/HkInput.scss +15 -7
- package/src/components/HkStatusBar.staleData.test.tsx +204 -0
- package/src/components/HkStatusBar.tsx +113 -6
- package/src/composables/useActionBar.test.ts +13 -7
- package/src/composables/useActionBar.ts +70 -9
- package/src/composables/useAutoRefresh.test.ts +280 -0
- package/src/composables/useAutoRefresh.ts +205 -0
- package/src/composables/useDataFreshness.test.ts +145 -0
- package/src/composables/useDataFreshness.ts +219 -0
- package/src/composables/usePageActions.barrel.test.ts +11 -0
- package/src/composables/usePageCreateAction.test.ts +115 -127
- package/src/composables/usePageCreateAction.ts +45 -41
- package/src/composables/usePageRefresh.test.ts +49 -163
- package/src/composables/usePageRefresh.ts +36 -63
- package/src/composables/usePageSearch.test.ts +12 -8
- package/src/composables/usePageSearch.ts +2 -1
- package/src/errorLandingStandalone/error-landing.html +1 -1
- package/src/i18n/locales/ar/components.json +5 -1
- package/src/i18n/locales/de/components.json +5 -1
- package/src/i18n/locales/en/components.json +5 -1
- package/src/i18n/locales/es/components.json +5 -1
- package/src/i18n/locales/fr/components.json +5 -1
- package/src/i18n/locales/ja/components.json +5 -1
- package/src/i18n/locales/ko/components.json +5 -1
- package/src/i18n/locales/pt/components.json +5 -1
- package/src/i18n/locales/ru/components.json +5 -1
- package/src/i18n/locales/zh-Hans/components.json +5 -1
- package/src/i18n/locales/zh-Hant/components.json +5 -1
- package/src/index.ts +16 -2
- package/src/styles/admin-tokens.scss +8 -2
- package/src/styles/inputAutofillFreeze.contract.test.ts +176 -0
- package/src/theme/_field.scss +9 -6
|
@@ -174,10 +174,21 @@ export interface HkFaceShellUserPanelSlot {
|
|
|
174
174
|
/** Call after any in-panel navigation so the mobile drawer closes. */
|
|
175
175
|
onNavigate: () => void;
|
|
176
176
|
}
|
|
177
|
+
/** Scoped payload of the `footer` slot. */
|
|
178
|
+
export interface HkFaceShellFooterSlot {
|
|
179
|
+
/** The footer CENTRE band's renderer: the page-level subject switcher a
|
|
180
|
+
* mounted view registered through `useActionBar().setFooterCenter`
|
|
181
|
+
* (a dropdown over the page's own subjects — "which group am I editing",
|
|
182
|
+
* "which module am I in"). ABSENT when nothing registered one, so a face
|
|
183
|
+
* with no switcher does not mount an empty centre wrapper. */
|
|
184
|
+
centre?: () => VNode[];
|
|
185
|
+
}
|
|
177
186
|
/**
|
|
178
187
|
* The shell's whole slot surface, in `SlotsType` form so a host can type its
|
|
179
188
|
* own wrapper with `slots: Object as HkFaceShellSlots` and get per-slot
|
|
180
|
-
* param checking for free. `content` / `
|
|
189
|
+
* param checking for free. `content` / `overlays` take no params; `footer`
|
|
190
|
+
* receives the shell's footer-centre payload ({@link HkFaceShellFooterSlot}) —
|
|
191
|
+
* a zero-argument footer function is still assignable and ignores it.
|
|
181
192
|
*/
|
|
182
193
|
export type HkFaceShellSlots = SlotsType<{
|
|
183
194
|
header?: (params: HkFaceShellHeaderSlot) => VNode[];
|
|
@@ -200,7 +211,7 @@ export type HkFaceShellSlots = SlotsType<{
|
|
|
200
211
|
sidebar?: (params: HkFaceShellSidebarSlot) => VNode[];
|
|
201
212
|
userPanel?: (params: HkFaceShellUserPanelSlot) => VNode[];
|
|
202
213
|
content?: () => VNode[];
|
|
203
|
-
footer?: () => VNode[];
|
|
214
|
+
footer?: (params: HkFaceShellFooterSlot) => VNode[];
|
|
204
215
|
overlays?: () => VNode[];
|
|
205
216
|
}>;
|
|
206
217
|
export declare const HkFaceShell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -291,7 +302,7 @@ export declare const HkFaceShell: import("vue").DefineComponent<import("vue").Ex
|
|
|
291
302
|
/** Extra class for the mobile nav drawer's panel — a scoping hook for
|
|
292
303
|
* consumer chrome (theme/surface overrides). It is NOT a padding
|
|
293
304
|
* lever any more: the shell zeroes the drawer body's padding itself
|
|
294
|
-
* so the nav panel fills the drawer (see the
|
|
305
|
+
* so the nav panel fills the drawer (see the HkDrawer call below), so
|
|
295
306
|
* nav rows and the `userPanel` footer already share one left edge. */
|
|
296
307
|
drawerPanelClass: {
|
|
297
308
|
type: StringConstructor;
|
|
@@ -456,7 +467,7 @@ export declare const HkFaceShell: import("vue").DefineComponent<import("vue").Ex
|
|
|
456
467
|
/** Extra class for the mobile nav drawer's panel — a scoping hook for
|
|
457
468
|
* consumer chrome (theme/surface overrides). It is NOT a padding
|
|
458
469
|
* lever any more: the shell zeroes the drawer body's padding itself
|
|
459
|
-
* so the nav panel fills the drawer (see the
|
|
470
|
+
* so the nav panel fills the drawer (see the HkDrawer call below), so
|
|
460
471
|
* nav rows and the `userPanel` footer already share one left edge. */
|
|
461
472
|
drawerPanelClass: {
|
|
462
473
|
type: StringConstructor;
|
|
@@ -118,6 +118,40 @@ export declare const HkStatusBar: import("vue").DefineComponent<import("vue").Ex
|
|
|
118
118
|
}>>;
|
|
119
119
|
default: undefined;
|
|
120
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* The page's data-freshness verdict, from the freshness store
|
|
123
|
+
* (`useDataFreshness`) the page's polling lanes report to. `undefined`
|
|
124
|
+
* (the default) means "no page data verdict" and leaves the light
|
|
125
|
+
* exactly as the transport says — hosts that pass nothing keep today's
|
|
126
|
+
* DOM and behaviour.
|
|
127
|
+
*
|
|
128
|
+
* `stale` while the link is up paints the dot YELLOW: the 2026-12-03
|
|
129
|
+
* ruling retired the per-page refresh button, so this light is the one
|
|
130
|
+
* user-visible signal that a page stopped following its data. The
|
|
131
|
+
* transport verdict outranks it (a disconnected link is red, a
|
|
132
|
+
* connecting one yellow) — a stale verdict only ever shows on a
|
|
133
|
+
* connected light.
|
|
134
|
+
*/
|
|
135
|
+
dataStatus: {
|
|
136
|
+
type: PropType<"idle" | "fresh" | "stale">;
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
139
|
+
/** The stale lanes' names, for the popover's detail rows (at most three
|
|
140
|
+
* render; the rest fold into a "+N" line). */
|
|
141
|
+
dataLanes: {
|
|
142
|
+
type: PropType<Array<{
|
|
143
|
+
key: number;
|
|
144
|
+
label: string;
|
|
145
|
+
lastOkAt: number;
|
|
146
|
+
}>>;
|
|
147
|
+
default: undefined;
|
|
148
|
+
};
|
|
149
|
+
/** Clicking a YELLOW (stale-data) light re-runs the stale lanes. The
|
|
150
|
+
* light itself is the button: there is no second refresh affordance. */
|
|
151
|
+
onRefreshData: {
|
|
152
|
+
type: PropType<() => void>;
|
|
153
|
+
default: undefined;
|
|
154
|
+
};
|
|
121
155
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
122
156
|
version: {
|
|
123
157
|
type: StringConstructor;
|
|
@@ -206,6 +240,40 @@ export declare const HkStatusBar: import("vue").DefineComponent<import("vue").Ex
|
|
|
206
240
|
}>>;
|
|
207
241
|
default: undefined;
|
|
208
242
|
};
|
|
243
|
+
/**
|
|
244
|
+
* The page's data-freshness verdict, from the freshness store
|
|
245
|
+
* (`useDataFreshness`) the page's polling lanes report to. `undefined`
|
|
246
|
+
* (the default) means "no page data verdict" and leaves the light
|
|
247
|
+
* exactly as the transport says — hosts that pass nothing keep today's
|
|
248
|
+
* DOM and behaviour.
|
|
249
|
+
*
|
|
250
|
+
* `stale` while the link is up paints the dot YELLOW: the 2026-12-03
|
|
251
|
+
* ruling retired the per-page refresh button, so this light is the one
|
|
252
|
+
* user-visible signal that a page stopped following its data. The
|
|
253
|
+
* transport verdict outranks it (a disconnected link is red, a
|
|
254
|
+
* connecting one yellow) — a stale verdict only ever shows on a
|
|
255
|
+
* connected light.
|
|
256
|
+
*/
|
|
257
|
+
dataStatus: {
|
|
258
|
+
type: PropType<"idle" | "fresh" | "stale">;
|
|
259
|
+
default: undefined;
|
|
260
|
+
};
|
|
261
|
+
/** The stale lanes' names, for the popover's detail rows (at most three
|
|
262
|
+
* render; the rest fold into a "+N" line). */
|
|
263
|
+
dataLanes: {
|
|
264
|
+
type: PropType<Array<{
|
|
265
|
+
key: number;
|
|
266
|
+
label: string;
|
|
267
|
+
lastOkAt: number;
|
|
268
|
+
}>>;
|
|
269
|
+
default: undefined;
|
|
270
|
+
};
|
|
271
|
+
/** Clicking a YELLOW (stale-data) light re-runs the stale lanes. The
|
|
272
|
+
* light itself is the button: there is no second refresh affordance. */
|
|
273
|
+
onRefreshData: {
|
|
274
|
+
type: PropType<() => void>;
|
|
275
|
+
default: undefined;
|
|
276
|
+
};
|
|
209
277
|
}>> & Readonly<{}>, {
|
|
210
278
|
version: string;
|
|
211
279
|
compact: boolean;
|
|
@@ -227,4 +295,11 @@ export declare const HkStatusBar: import("vue").DefineComponent<import("vue").Ex
|
|
|
227
295
|
label: string;
|
|
228
296
|
value: string;
|
|
229
297
|
}[];
|
|
298
|
+
dataStatus: "idle" | "fresh" | "stale";
|
|
299
|
+
dataLanes: {
|
|
300
|
+
key: number;
|
|
301
|
+
label: string;
|
|
302
|
+
lastOkAt: number;
|
|
303
|
+
}[];
|
|
304
|
+
onRefreshData: () => void;
|
|
230
305
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -9,17 +9,20 @@ import { type Ref, type VNode } from "vue";
|
|
|
9
9
|
* `useActionBar().setActions(() => [...], slot)` in its setup — the header
|
|
10
10
|
* updates reactively. Registrations are ADDITIVE and render in SLOT order:
|
|
11
11
|
* a page that registers its filter trigger and then its refresh still gets
|
|
12
|
-
* [filter][
|
|
13
|
-
*
|
|
12
|
+
* [filter][search] left-to-right in the header (the user direction's
|
|
13
|
+
* filter-left rule; the refresh slot it also named was retired 2026-12-03).
|
|
14
14
|
*
|
|
15
15
|
* **Slot ordering (2026-10-11 standardization)**: registrations declare
|
|
16
16
|
* their PURPOSE slot; the cluster renders canonical slots by rank
|
|
17
|
-
* ([create][filter][search][
|
|
18
|
-
*
|
|
17
|
+
* ([create][filter][search][window]) and customs after them, stuffed
|
|
18
|
+
* right-to-left in join order — see PageActionSlot below. The
|
|
19
19
|
* registration CALL ORDER no longer influences the cluster. The grammar's
|
|
20
20
|
* normative home (slot order, ranks, exempt edges) is the design doc
|
|
21
21
|
* `design/page-chrome.md` (nine locales); the rank table below is its
|
|
22
|
-
* runtime mirror.
|
|
22
|
+
* runtime mirror. The REFRESH slot is retired (2026-12-03 ruling: pages
|
|
23
|
+
* poll through `useAutoRefresh`, and the bottom-left status light reports
|
|
24
|
+
* data that stopped following) — `PageActionSlot.Refresh` survives only as
|
|
25
|
+
* a deprecated enum member so a stale registration names something.
|
|
23
26
|
*
|
|
24
27
|
* **Why a render function, not VNodes?** VNodes are single-use: once Vue
|
|
25
28
|
* patches them into the DOM, re-using the same VNode object on the next
|
|
@@ -49,7 +52,7 @@ export type ActionBarRenderer = () => VNode[];
|
|
|
49
52
|
/**
|
|
50
53
|
* The canonical top-right cluster slots (2026-10-11 standardization, user
|
|
51
54
|
* direction): every button declares its PURPOSE, and the cluster renders
|
|
52
|
-
* by the slot's canonical rank — [create][filter][search][
|
|
55
|
+
* by the slot's canonical rank — [create][filter][search][window]
|
|
53
56
|
* — regardless of registration order. A button whose purpose is not in
|
|
54
57
|
* the enum is a CUSTOM slot: customs ride AFTER the canonical ranks,
|
|
55
58
|
* stuffed 由右往左 — the zone's right edge (adjacent to the global
|
|
@@ -70,7 +73,10 @@ export declare const PageActionSlot: {
|
|
|
70
73
|
* canonical since the scaffold landed — the old per-page
|
|
71
74
|
* "Search = refetch" buttons rode custom slots). */
|
|
72
75
|
readonly Search: "search";
|
|
73
|
-
/**
|
|
76
|
+
/** RETIRED (2026-12-03): the per-page refresh button is gone family-wide.
|
|
77
|
+
* Kept as a deprecated member so a stale registration still names its
|
|
78
|
+
* purpose; it has no rank, so it renders with the customs.
|
|
79
|
+
* @deprecated Use `useAutoRefresh` for a list page, or nothing at all. */
|
|
74
80
|
readonly Refresh: "refresh";
|
|
75
81
|
/** A page's secondary-window opener (2026-11-04 user direction): an
|
|
76
82
|
* icon button that opens a window/panel holding dynamic content the
|
|
@@ -109,6 +115,10 @@ interface ActionBarContext {
|
|
|
109
115
|
/** Ordered renderers (what the header renders) — derived. */
|
|
110
116
|
actions: Ref<ActionBarRenderer[]>;
|
|
111
117
|
center: Ref<ActionBarRenderer | null>;
|
|
118
|
+
/** The renderer for the shell FOOTER's centre slot (a page-level subject
|
|
119
|
+
* switcher: a dropdown over the page's own subjects). `null` when the
|
|
120
|
+
* page registers none, so the layout hands its footer no dead wrapper. */
|
|
121
|
+
footerCenter: Ref<ActionBarRenderer | null>;
|
|
112
122
|
}
|
|
113
123
|
export declare function provideActionBar(): ActionBarContext;
|
|
114
124
|
/**
|
|
@@ -127,6 +137,29 @@ export declare function provideActionBar(): ActionBarContext;
|
|
|
127
137
|
* Call in setup — it injects.
|
|
128
138
|
*/
|
|
129
139
|
export declare function useActionBarCenter(): ActionBarRenderer | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* The enclosing bar's FOOTER-CENTRE renderer — the footer twin of
|
|
142
|
+
* {@link useActionBarCenter}, for the same reason and with the same contract:
|
|
143
|
+
* a page-level SUBJECT switcher (a dropdown over the page's own subjects —
|
|
144
|
+
* "which group am I editing", "which module am I in") must not live in a list
|
|
145
|
+
* above the content that re-renders what is below it. The shell footer's
|
|
146
|
+
* centre band is where the family puts it (`HkFaceShell`'s footer payload
|
|
147
|
+
* carries this renderer as `centre`).
|
|
148
|
+
*
|
|
149
|
+
* `undefined` when nothing provides a bar: layouts keep the payload field
|
|
150
|
+
* ABSENT then, instead of handing every face an always-empty wrapper.
|
|
151
|
+
*
|
|
152
|
+
* Call in setup — it injects.
|
|
153
|
+
*/
|
|
154
|
+
export interface FooterCentreChannel {
|
|
155
|
+
/** True while a registration exists. Reading it inside a render collects
|
|
156
|
+
* the dependency, which is how the shell decides whether to hand its
|
|
157
|
+
* footer slot a `centre` at all (an absent field, not an empty wrapper). */
|
|
158
|
+
has: () => boolean;
|
|
159
|
+
/** The registered renderer (fresh VNodes per call — never cache them). */
|
|
160
|
+
render: () => VNode[];
|
|
161
|
+
}
|
|
162
|
+
export declare function useActionBarFooterCenter(): FooterCentreChannel | undefined;
|
|
130
163
|
export declare function useActionBar(): {
|
|
131
164
|
setActions: (_renderer: ActionBarRenderer, _slot: string) => void;
|
|
132
165
|
clearActions: () => void;
|
|
@@ -134,5 +167,8 @@ export declare function useActionBar(): {
|
|
|
134
167
|
setCenter: (_renderer: ActionBarRenderer) => void;
|
|
135
168
|
clearCenter: () => void;
|
|
136
169
|
center: Ref<ActionBarRenderer | null, ActionBarRenderer | null>;
|
|
170
|
+
setFooterCenter: (_renderer: ActionBarRenderer) => void;
|
|
171
|
+
clearFooterCenter: () => void;
|
|
172
|
+
footerCenter: Ref<ActionBarRenderer | null, ActionBarRenderer | null>;
|
|
137
173
|
};
|
|
138
174
|
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type Ref } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* The family's polling period for list and dashboard pages. One number so a
|
|
4
|
+
* page's cadence is a fact about the family, not a per-page guess.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PAGE_POLL_INTERVAL_MS = 30000;
|
|
7
|
+
/** What a page passes to `useAutoRefresh`. */
|
|
8
|
+
export interface UseAutoRefreshOptions {
|
|
9
|
+
/** Poll period, ms. WITHOUT it the call is a no-op (a form or a settings
|
|
10
|
+
* page keeps its data as loaded — a background poll would wipe the
|
|
11
|
+
* operator's edits). `PAGE_POLL_INTERVAL_MS` is the list-page default. */
|
|
12
|
+
intervalMs?: number;
|
|
13
|
+
/** The lane's name, shown in the status popover while it is stale. A
|
|
14
|
+
* function is resolved on every read (locale switches follow). Defaults
|
|
15
|
+
* to hikari's own "This page" string. */
|
|
16
|
+
label?: string | (() => string);
|
|
17
|
+
/** True while the page's own fetch is running — such a tick is SKIPPED
|
|
18
|
+
* (never stacked), and a skip is not a staleness verdict. */
|
|
19
|
+
loading?: Ref<boolean> | (() => boolean);
|
|
20
|
+
/** The page's own failure signal, read after every poll: most fetch
|
|
21
|
+
* composables swallow the error into a ref and resolve anyway, so the
|
|
22
|
+
* promise settling is not evidence that the data arrived. */
|
|
23
|
+
error?: Ref<unknown> | (() => unknown);
|
|
24
|
+
/** False pauses the lane (no ticks, excluded from the light). Pass a REF
|
|
25
|
+
* to make the resume immediate: a plain function is only re-read on the
|
|
26
|
+
* next tick / user action. */
|
|
27
|
+
visible?: Ref<boolean> | (() => boolean);
|
|
28
|
+
/** How long a poll may stay unsettled before the lane is called stale.
|
|
29
|
+
* Default 20 s. */
|
|
30
|
+
timeoutMs?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Keep a page's data current — the replacement for the retired per-page
|
|
34
|
+
* refresh button (2026-12-03 ruling: `usePageRefresh` registers nothing any
|
|
35
|
+
* more; a page either polls, or shows data it loaded once and labels it as
|
|
36
|
+
* such).
|
|
37
|
+
*
|
|
38
|
+
* `useAutoRefresh` schedules `refresh` on hikari's visibility-aware interval
|
|
39
|
+
* bus (parked while the tab is hidden, one catch-up tick on return — data
|
|
40
|
+
* polling is not animation, so reduced-motion does not park it) and reports
|
|
41
|
+
* that page's lane to the freshness store. A poll that rejects, reports the
|
|
42
|
+
* page's own `error` signal, or never settles within `timeoutMs` turns the
|
|
43
|
+
* lane stale, which is what paints the bottom-left status light yellow and
|
|
44
|
+
* puts the lane's name in that light's popover. Clicking the light re-runs
|
|
45
|
+
* the stale lanes — the user never has to reload the page to get fresh data.
|
|
46
|
+
* (One caveat the light itself cannot show: a click that lands while a poll
|
|
47
|
+
* is still in flight is absorbed by the stacking guard below, so the lane is
|
|
48
|
+
* re-run on the next beat, not twice at once.)
|
|
49
|
+
*
|
|
50
|
+
* Call once from a view's setup; everything dies with that scope. The lane's
|
|
51
|
+
* first tick is one period after the call: the page's own mount fetch is the
|
|
52
|
+
* initial load, so polling that fires immediately would double-fetch.
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* useAutoRefresh(() => loadRows(), {
|
|
56
|
+
* intervalMs: PAGE_POLL_INTERVAL_MS,
|
|
57
|
+
* loading,
|
|
58
|
+
* error,
|
|
59
|
+
* label: () => t("admin.invoices.listLane"),
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function useAutoRefresh(refresh: () => unknown, options?: UseAutoRefreshOptions): void;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type DeepReadonly, type Ref } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* Data freshness — WHICH page-owned data lanes are currently out of date,
|
|
4
|
+
* for the status bar's yellow light.
|
|
5
|
+
*
|
|
6
|
+
* The 2026-12-03 ruling retired the per-page refresh button: a list page
|
|
7
|
+
* keeps itself current (`useAutoRefresh`), and the ONLY user-visible signal
|
|
8
|
+
* when that fails is the bottom-left traffic light turning yellow while the
|
|
9
|
+
* transport itself is still green. This module is the state behind that
|
|
10
|
+
* light, and it is deliberately NOT provided through the component tree:
|
|
11
|
+
* the page body (deep inside a host's layout) and the footer (owned by the
|
|
12
|
+
* shell) have no provider/consumer relationship, and the earlier attempts at
|
|
13
|
+
* threading a page's data verdict up through slots produced one bespoke
|
|
14
|
+
* channel per host. A module-level store with per-scope registration is the
|
|
15
|
+
* same shape the runtime already uses for `pageLifecycle` and the interval
|
|
16
|
+
* bus.
|
|
17
|
+
*
|
|
18
|
+
* Lane states:
|
|
19
|
+
*
|
|
20
|
+
* - `fresh` — the last poll settled and the page's own error signal was
|
|
21
|
+
* clear (a lane is born fresh: its page just loaded).
|
|
22
|
+
* - `stale` — the last poll rejected, reported the page's error signal,
|
|
23
|
+
* or never settled within its timeout.
|
|
24
|
+
* - `paused` — the page asked for no polling right now (a stage the user is
|
|
25
|
+
* not looking at). Paused lanes never colour the light.
|
|
26
|
+
*
|
|
27
|
+
* The store keeps the poll closures: clicking the yellow light re-runs every
|
|
28
|
+
* stale lane instead of reloading the page.
|
|
29
|
+
*/
|
|
30
|
+
/** One lane's verdict. */
|
|
31
|
+
export type DataLaneState = "fresh" | "stale" | "paused";
|
|
32
|
+
/** Why a lane last went stale; `null` while it is fresh. */
|
|
33
|
+
export type DataLaneReason = "failed" | "error" | "timeout" | null;
|
|
34
|
+
/** What the light reads: `idle` = no lane registered (or all paused). */
|
|
35
|
+
export type DataFreshness = "idle" | "fresh" | "stale";
|
|
36
|
+
/** A lane as the popover renders it (no closures). */
|
|
37
|
+
export interface DataLane {
|
|
38
|
+
/** Stable identity of the registration (the popover keys on it). */
|
|
39
|
+
key: number;
|
|
40
|
+
/** The lane's name, resolved on every read (locale switches follow). */
|
|
41
|
+
label: string;
|
|
42
|
+
state: DataLaneState;
|
|
43
|
+
/** Epoch ms of the last successful settlement (0 = never). */
|
|
44
|
+
lastOkAt: number;
|
|
45
|
+
/** Epoch ms of the last failed settlement, null until one fails. */
|
|
46
|
+
lastFailedAt: number | null;
|
|
47
|
+
reason: DataLaneReason;
|
|
48
|
+
/** The failure's own words (`String(err)`), when it had any. */
|
|
49
|
+
message: string | null;
|
|
50
|
+
}
|
|
51
|
+
/** The read side a host (and the status bar) consumes. */
|
|
52
|
+
export interface DataFreshnessSource {
|
|
53
|
+
/** Active lanes, in registration order. Paused ones are excluded. The
|
|
54
|
+
* view is READ-ONLY: only `useAutoRefresh` may move a lane, so a host
|
|
55
|
+
* cannot clear the light out from under a page that is really behind. */
|
|
56
|
+
lanes: DeepReadonly<Ref<DataLane[]>>;
|
|
57
|
+
/** The active lanes currently out of date (read-only). */
|
|
58
|
+
staleLanes: DeepReadonly<Ref<DataLane[]>>;
|
|
59
|
+
/** `stale` when ANY active lane is stale, `fresh` when at least one is
|
|
60
|
+
* active and none is stale, `idle` when nothing is registered. */
|
|
61
|
+
state: DeepReadonly<Ref<DataFreshness>>;
|
|
62
|
+
/** Re-run every stale lane now (the light's click action). */
|
|
63
|
+
refreshStale: () => void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Register a polling lane. INTERNAL — `useAutoRefresh` is the public entry
|
|
67
|
+
* point; the exports below exist so it (and the tests) can drive the store
|
|
68
|
+
* without widening the package's public surface (the barrel exports only
|
|
69
|
+
* `useDataFreshness` and its types).
|
|
70
|
+
*
|
|
71
|
+
* `poll` is what {@link DataFreshnessSource.refreshStale} re-runs.
|
|
72
|
+
*/
|
|
73
|
+
export declare function registerDataLane(label: () => string, poll: () => void): number;
|
|
74
|
+
/** Patch one lane and republish. Unknown keys are ignored (a lane disposed
|
|
75
|
+
* while an async settlement was in flight must not resurrect). */
|
|
76
|
+
export declare function updateDataLane(key: number, patch: Partial<Pick<DataLane, "state" | "lastOkAt" | "lastFailedAt" | "reason" | "message">>): void;
|
|
77
|
+
/** Drop a lane (its scope ended). */
|
|
78
|
+
export declare function unregisterDataLane(key: number): void;
|
|
79
|
+
/** The read side: what a status bar (or a host's own chrome) consumes. */
|
|
80
|
+
export declare function useDataFreshness(): DataFreshnessSource;
|
|
81
|
+
/** Test seam: the store is module-level, so a suite must be able to start
|
|
82
|
+
* from zero (a leaked lane would colour the next test's light). */
|
|
83
|
+
export declare function __resetDataFreshnessForTests(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Ref } from "vue";
|
|
2
2
|
/** What a page passes to `usePageCreateAction`. */
|
|
3
3
|
export interface UsePageCreateActionOptions {
|
|
4
|
-
/**
|
|
4
|
+
/** The button's visible title — the words the page's own button printed.
|
|
5
5
|
* A FUNCTION is resolved on every header render, which is how a page
|
|
6
6
|
* whose create action changes with its sub-tab (or its locale) keeps the
|
|
7
7
|
* button labelled correctly without re-registering. */
|
|
@@ -12,31 +12,36 @@ export interface UsePageCreateActionOptions {
|
|
|
12
12
|
disabled?: Ref<boolean> | (() => boolean);
|
|
13
13
|
/** False hides the button entirely (evaluated on every header render). */
|
|
14
14
|
visible?: () => boolean;
|
|
15
|
-
/** Glyph override; defaults to the plus. The glyph stays 16px — the
|
|
16
|
-
* glyph size is part of the cluster's geometry, not a page's choice. */
|
|
17
|
-
icon?: Component;
|
|
18
15
|
}
|
|
19
16
|
/**
|
|
20
17
|
* The standard CREATE affordance of the page-chrome grammar
|
|
21
|
-
* (`design/page-chrome.md`, the create rule): a page's primary create
|
|
22
|
-
*
|
|
23
|
-
* never a
|
|
18
|
+
* (`design/page-chrome.md`, the create rule): a page's primary create action
|
|
19
|
+
* is a SOLID, LABELLED button at the LEFT edge of the shell header's
|
|
20
|
+
* top-right cluster — never a bare plus icon, never a standalone button
|
|
21
|
+
* inside the page body (user ruling 2026-12-03).
|
|
24
22
|
*
|
|
25
|
-
* The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* `
|
|
23
|
+
* The label is the button's VISIBLE title: the page's own words ("New
|
|
24
|
+
* client", 新建客户端) ride the button, so the action names itself instead of
|
|
25
|
+
* hiding behind a glyph. Below 640px the label collapses to the icon square
|
|
26
|
+
* (`HkButton`'s `collapseLabel`), and the accessible name — the same string —
|
|
27
|
+
* keeps the button named there.
|
|
29
28
|
*
|
|
30
|
-
* Geometry
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* [create][filter?][search][refresh][window].
|
|
29
|
+
* Geometry: `HkButton` primary/sm with the plus glyph, its min-height pinned
|
|
30
|
+
* to the current `useChromeActionSize` rung (28 narrow / 32 wide) so the
|
|
31
|
+
* labelled button stands flush with its icon siblings in the cluster. The
|
|
32
|
+
* glyph is always the plus: the shape IS the create affordance, and no page
|
|
33
|
+
* may swap it (the previous `icon` option was never used by any consumer).
|
|
36
34
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
35
|
+
* The page keeps owning its own dialog: this composable registers the button
|
|
36
|
+
* only, and `onCreate` is what opens that dialog.
|
|
37
|
+
*
|
|
38
|
+
* The registration declares the Create slot, whose canonical rank (the rank
|
|
39
|
+
* table in `useActionBar.ts`) seats the button leftmost no matter which
|
|
40
|
+
* composable the view calls first: [create][filter?][search][window].
|
|
41
|
+
*
|
|
42
|
+
* Call once from a view's (or card's) setup; the registration dies with that
|
|
43
|
+
* scope, so leaving the page — or switching the tab that mounted the card —
|
|
44
|
+
* clears the button. Outside any action-bar provider the call is a silent
|
|
45
|
+
* no-op (`useActionBar`'s contract).
|
|
41
46
|
*/
|
|
42
47
|
export declare function usePageCreateAction(options: UsePageCreateActionOptions): void;
|
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* RETIRED (2026-12-03 user ruling): the per-page refresh button no longer
|
|
4
|
+
* exists anywhere in the family. A page either keeps itself current
|
|
5
|
+
* (`useAutoRefresh`, which also turns the status light yellow when its data
|
|
6
|
+
* stops following), or it shows the data it loaded and says so. The user's
|
|
7
|
+
* words: "所有刷新按钮统统退役不要了,如果没能跟随更新时左下角指示灯直接就变黄
|
|
8
|
+
* 了(相当于无感知更新)" — the user never clicks refresh again.
|
|
9
|
+
*
|
|
10
|
+
* This module stays exported for exactly two reasons:
|
|
11
|
+
*
|
|
12
|
+
* 1. host call sites still import it, and a half-migrated host must keep
|
|
13
|
+
* compiling (a removed export would break every consumer at once);
|
|
14
|
+
* 2. `UsePageRefreshOptions` is still referenced by those call sites.
|
|
15
|
+
*
|
|
16
|
+
* The function itself registers NOTHING. Migrating a page:
|
|
17
|
+
*
|
|
18
|
+
* - list / dashboard / any page whose data can change under the operator →
|
|
19
|
+
* `useAutoRefresh(fetch, { intervalMs: PAGE_POLL_INTERVAL_MS, loading, error })`;
|
|
20
|
+
* - editor / settings / wizard → DELETE the call. Its data is what the
|
|
21
|
+
* operator is editing; a background poll would wipe it. Such a page
|
|
22
|
+
* re-reads on reconnect and after its own saves.
|
|
23
|
+
*
|
|
24
|
+
* @deprecated The Refresh slot is retired — see the module comment. Do not
|
|
25
|
+
* add new calls; replace existing ones with `useAutoRefresh` or nothing.
|
|
26
|
+
*/
|
|
3
27
|
export interface UsePageRefreshOptions {
|
|
4
|
-
/** True while the page's fetch is in flight
|
|
5
|
-
*
|
|
6
|
-
* clears. */
|
|
28
|
+
/** True while the page's fetch is in flight. Retained for source
|
|
29
|
+
* compatibility only — nothing reads it any more. */
|
|
7
30
|
loading?: Ref<boolean>;
|
|
8
|
-
/** Accessible label override
|
|
9
|
-
* (`hikari::pageActions.refresh`). */
|
|
31
|
+
/** Accessible label override. Retained for source compatibility. */
|
|
10
32
|
label?: string;
|
|
11
|
-
/**
|
|
12
|
-
* views whose refresh belongs to ONE stage/mode of a longer-lived
|
|
13
|
-
* component. Evaluated on every header render, so flipping the stage
|
|
14
|
-
* shows/hides the button reactively; the per-scope registration
|
|
15
|
-
* contract is unchanged. */
|
|
33
|
+
/** Visibility gate. Retained for source compatibility. */
|
|
16
34
|
visible?: () => boolean;
|
|
17
35
|
}
|
|
18
36
|
/**
|
|
19
|
-
*
|
|
20
|
-
* (`design/page-chrome.md`): THE refresh button of a page, registered in
|
|
21
|
-
* the Refresh slot of the shell header's top-right cluster — the same slot
|
|
22
|
-
* the theme toggle lives in, and the same button geometry (an `HkIconButton`
|
|
23
|
-
* on the `useChromeActionSize` ladder with a 16px glyph). A page either
|
|
24
|
-
* has a refresh, and it is HERE, or it has none: an in-body refresh button
|
|
25
|
-
* beside it is a second source for one verb.
|
|
26
|
-
*
|
|
27
|
-
* The slot's canonical rank (the rank table in `useActionBar.ts`) seats the
|
|
28
|
-
* button right of the search and left of the window opener regardless of
|
|
29
|
-
* the order the page registered its affordances in:
|
|
30
|
-
* [create][filter?][search][refresh][window].
|
|
31
|
-
*
|
|
32
|
-
* Call once from a view's setup; the registration dies with the view's
|
|
33
|
-
* scope (`useActionBar`'s per-scope contract), so switching pages clears
|
|
34
|
-
* the button automatically. Outside any action-bar provider the call is a
|
|
35
|
-
* silent no-op.
|
|
37
|
+
* @deprecated Registers nothing. See {@link UsePageRefreshOptions}.
|
|
36
38
|
*/
|
|
37
|
-
export declare function usePageRefresh(
|
|
39
|
+
export declare function usePageRefresh(_refresh: () => unknown, _options?: UsePageRefreshOptions): void;
|
|
@@ -38,7 +38,8 @@ export interface UsePageSearchReturn {
|
|
|
38
38
|
*
|
|
39
39
|
* The cluster orders itself by slot rank, so the order this composable is
|
|
40
40
|
* called in relative to `usePageCreateAction` / `usePageRefresh` does not
|
|
41
|
-
* matter — the header reads [create][filter?][search][
|
|
41
|
+
* matter — the header reads [create][filter?][search][window] (the refresh
|
|
42
|
+
* slot between them was retired on 2026-12-03).
|
|
42
43
|
*
|
|
43
44
|
* const { search } = usePageSearch();
|
|
44
45
|
* const rows = useTableFetch(fetcher, { params: () => ({ search: search.value }) });
|
package/dist/types/index.d.ts
CHANGED
|
@@ -246,13 +246,17 @@ export { HkAuthHandoff as HAuthHandoff } from "./components/HkAuthHandoff";
|
|
|
246
246
|
export { HkMfaVerifyCard as HMfaVerifyCard, hkIsMfaFactor as isMfaFactor, hkPreferredMfaFactor as preferredMfaFactor, hkMfaVerifyTitle as mfaVerifyTitle, hkMfaVerifySubtitle as mfaVerifySubtitle, type HkMfaFactor as MfaFactor, } from "./components/HkMfaVerifyCard";
|
|
247
247
|
export { usePageTitle, useRouteTitle } from "./composables/usePageTitle";
|
|
248
248
|
export { provideActionBar, useActionBar, PageActionSlot, orderActionRegistrations } from "./composables/useActionBar";
|
|
249
|
-
export { useActionBarCenter } from "./composables/useActionBar";
|
|
249
|
+
export { useActionBarCenter, useActionBarFooterCenter } from "./composables/useActionBar";
|
|
250
250
|
export type { ActionBarRenderer, PageActionSlotValue, ActionBarRegistration } from "./composables/useActionBar";
|
|
251
251
|
export { useChromeActionSize } from "./composables/useChromeActionSize";
|
|
252
252
|
export { usePageCreateAction } from "./composables/usePageCreateAction";
|
|
253
253
|
export type { UsePageCreateActionOptions } from "./composables/usePageCreateAction";
|
|
254
254
|
export { usePageRefresh } from "./composables/usePageRefresh";
|
|
255
255
|
export type { UsePageRefreshOptions } from "./composables/usePageRefresh";
|
|
256
|
+
export { useAutoRefresh, PAGE_POLL_INTERVAL_MS } from "./composables/useAutoRefresh";
|
|
257
|
+
export type { UseAutoRefreshOptions } from "./composables/useAutoRefresh";
|
|
258
|
+
export { useDataFreshness } from "./composables/useDataFreshness";
|
|
259
|
+
export type { DataFreshness, DataFreshnessSource, DataLane, DataLaneReason, DataLaneState, } from "./composables/useDataFreshness";
|
|
256
260
|
export { usePageSearch } from "./composables/usePageSearch";
|
|
257
261
|
export type { UsePageSearchOptions, UsePageSearchReturn } from "./composables/usePageSearch";
|
|
258
262
|
export { leadingZeroBits, sha256, solvePow, solvePowSync, verifyPow } from "./utils/pow";
|
|
@@ -482,7 +486,7 @@ export { HkErrorLanding as HkErrorLanding } from "./components/HkErrorLanding";
|
|
|
482
486
|
export { HkErrorReportingOverlay as HkErrorReportingOverlay } from "./errorReporting";
|
|
483
487
|
export { HkAdminShell as HkAdminShell } from "./components/HkAdminShell";
|
|
484
488
|
export { HkFaceShell as HkFaceShell } from "./components/HkFaceShell";
|
|
485
|
-
export type { HkFaceShellHeaderSlot, HkFaceShellSidebarSlot, HkFaceShellUserPanelSlot, HkFaceShellSlots } from "./components/HkFaceShell";
|
|
489
|
+
export type { HkFaceShellFooterSlot, HkFaceShellHeaderSlot, HkFaceShellSidebarSlot, HkFaceShellUserPanelSlot, HkFaceShellSlots } from "./components/HkFaceShell";
|
|
486
490
|
export { HkAdminHeader as HkAdminHeader } from "./components/HkAdminHeader";
|
|
487
491
|
export type { HkAdminHeaderAvatarModalSlot, HkAdminHeaderLocalePickerSlot, HkAdminHeaderSlots, HkAdminHeaderUserMenuExtraSlot, HkAdminHeaderUserMenuItemsSlot } from "./components/HkAdminHeader";
|
|
488
492
|
export { HkAvatarButton as HkAvatarButton } from "./components/HkAvatarButton";
|
package/package.json
CHANGED
|
@@ -3,8 +3,11 @@ import { createApp, h, nextTick } from "vue";
|
|
|
3
3
|
|
|
4
4
|
// HDrawer teleports and animates; replace it with an inline passthrough
|
|
5
5
|
// exposing the body/footer split so the drawer contract is testable.
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// The drawer is stubbed at its OWN module path: the shell imports ./HkDrawer
|
|
7
|
+
// directly (de-barreled 2026-12-03 — the barrel statically reaches the mermaid
|
|
8
|
+
// wasm graph, absent on a clean checkout), so a barrel-scope mock would
|
|
9
|
+
// silently stop applying.
|
|
10
|
+
vi.mock("./HkDrawer", async () => {
|
|
8
11
|
const { defineComponent, h } = await import("vue");
|
|
9
12
|
const HDrawerStub = defineComponent({
|
|
10
13
|
name: "HDrawer",
|
|
@@ -27,7 +30,7 @@ vi.mock("@celestia-island/hikari", async (importOriginal) => {
|
|
|
27
30
|
: null;
|
|
28
31
|
},
|
|
29
32
|
});
|
|
30
|
-
return {
|
|
33
|
+
return { default: HDrawerStub };
|
|
31
34
|
});
|
|
32
35
|
|
|
33
36
|
import { HkAdminShell } from "./HkAdminShell";
|
|
@@ -4,6 +4,7 @@ import { useI18n } from "../i18n/context";
|
|
|
4
4
|
import type { EngineHealth, EngineNetworkInfo, ProbeResult } from "../composables/engineHealthTypes";
|
|
5
5
|
|
|
6
6
|
import { HkStatusBar } from "./HkStatusBar";
|
|
7
|
+
import { useDataFreshness } from "../composables/useDataFreshness";
|
|
7
8
|
import {
|
|
8
9
|
useConnectionInfo,
|
|
9
10
|
type ConnectionStateInput,
|
|
@@ -123,6 +124,19 @@ export const HkConnectionStatus = defineComponent({
|
|
|
123
124
|
latencyMs,
|
|
124
125
|
);
|
|
125
126
|
|
|
127
|
+
// The page's data verdict (2026-12-03 ruling): the freshness store the
|
|
128
|
+
// mounted page's polling lanes report to. It is a module store, not a
|
|
129
|
+
// provider — the page body and this footer have no ancestor relation —
|
|
130
|
+
// so reading it here is the one wiring every host gets for free.
|
|
131
|
+
const freshness = useDataFreshness();
|
|
132
|
+
const staleLanes = computed(() =>
|
|
133
|
+
freshness.staleLanes.value.map((lane) => ({
|
|
134
|
+
key: lane.key,
|
|
135
|
+
label: lane.label,
|
|
136
|
+
lastOkAt: lane.lastOkAt,
|
|
137
|
+
})),
|
|
138
|
+
);
|
|
139
|
+
|
|
126
140
|
// Overlay the server-reported network context (region/asn) when available;
|
|
127
141
|
// "XX" is the backend's unknown-region sentinel, keep the local guess then.
|
|
128
142
|
const mergedInfo = computed<HkConnectionInfo>(() => {
|
|
@@ -166,6 +180,9 @@ export const HkConnectionStatus = defineComponent({
|
|
|
166
180
|
countdown={probe.value.countdown}
|
|
167
181
|
compact={props.compact}
|
|
168
182
|
inlineVersions={props.inlineVersions}
|
|
183
|
+
dataStatus={freshness.state.value}
|
|
184
|
+
dataLanes={staleLanes.value}
|
|
185
|
+
onRefreshData={freshness.refreshStale}
|
|
169
186
|
>
|
|
170
187
|
{/* Host-appended popover actions (e.g. a manual page
|
|
171
188
|
refresh) ride the status row's right edge — the only
|