@celestia-island/hikari 0.55.295 → 0.55.297

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.295",
3
+ "version": "0.55.297",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari UI library, Vue 3 runtime — one design system for Vue 3 and Rust/WASM applications",
@@ -1,16 +1,7 @@
1
- import {
2
- defineComponent,
3
- inject,
4
- onMounted,
5
- onUnmounted,
6
- ref,
7
- type Component,
8
- type PropType,
9
- } from "vue";
1
+ import { defineComponent, type Component, type PropType } from "vue";
10
2
  import { HAlert, HCard, HEmptyState, HSpinner, HTable, useI18n } from "@celestia-island/hikari";
11
3
  import HkCrossfade from "./HkCrossfade";
12
4
  import { HkPageHeader } from "./HkPageHeader";
13
- import { HK_SCROLL_PROGRESS_REGISTRAR, type HkScrollProgressHandle } from "./HkScrollProgress";
14
5
  import type { HkRowManageGate } from "./HkTable";
15
6
 
16
7
 
@@ -76,9 +67,9 @@ export const HkAdminTablePage = defineComponent({
76
67
  },
77
68
  /** Authoritative row total the scroll-progress pill uses as its
78
69
  * denominator (the server count behind a paged list — chest's
79
- * usePagedTableFetch total). Omitted: the pill falls back to
80
- * counting the delivered DOM rows. Registration into the
81
- * enclosing shell viewport is automatic (see setup). */
70
+ * usePagedTableFetch total). Forwarded to HTable, which
71
+ * self-registers with the enclosing shell viewport's registrar.
72
+ * Omitted: the pill falls back to counting the delivered DOM rows. */
82
73
  total: { type: Number, default: undefined },
83
74
  },
84
75
  emits: {
@@ -86,28 +77,6 @@ export const HkAdminTablePage = defineComponent({
86
77
  manage: (_row: Record<string, unknown>, _opener: HTMLElement) => true,
87
78
  },
88
79
  setup(props, { emit, slots }) {
89
- // Scroll-progress registration: the nearest enclosing HkScrollContainer
90
- // with `scrollProgress` on provides the registrar (provide/inject
91
- // scoping resolves the shell viewport for admin pages and keeps an
92
- // inner container's lists out of the shell). The handle exposes the
93
- // table card as the row root plus the `total` prop live — the pill's
94
- // denominator follows it as pages load.
95
- const registrar = inject(HK_SCROLL_PROGRESS_REGISTRAR, null);
96
- const tableCardRef = ref<HTMLElement | null>(null);
97
- let handle: HkScrollProgressHandle | null = null;
98
- onMounted(() => {
99
- if (!registrar) return;
100
- handle = {
101
- getRoot: () => tableCardRef.value,
102
- getTotal: () => props.total,
103
- };
104
- registrar.register(handle);
105
- });
106
- onUnmounted(() => {
107
- if (registrar && handle) registrar.unregister(handle);
108
- handle = null;
109
- });
110
-
111
80
  return () => {
112
81
  const { t } = useI18n();
113
82
  const emptyTitle = props.emptyTitle || t("hikari::tablePage.emptyTitle", "No data");
@@ -165,23 +134,22 @@ export const HkAdminTablePage = defineComponent({
165
134
  ) : slots.body ? (
166
135
  <div class="hk-admin-table-page-body">{slots.body()}</div>
167
136
  ) : (
168
- <div ref={tableCardRef} class="hk-admin-table-page-tablecard">
169
- <HCard padded={false}>
170
- <HTable
171
- columns={props.columns}
172
- rows={props.rows}
173
- rowKey={props.rowKey}
174
- draggable={props.draggable}
175
- manageable={props.manageable}
176
- onReorder={(from: number, to: number) => emit("reorder", from, to)}
177
- onManage={(row: Record<string, unknown>, opener: HTMLElement) =>
178
- emit("manage", row, opener)
179
- }
180
- >
181
- {slots}
182
- </HTable>
183
- </HCard>
184
- </div>
137
+ <HCard padded={false}>
138
+ <HTable
139
+ columns={props.columns}
140
+ rows={props.rows}
141
+ rowKey={props.rowKey}
142
+ total={props.total}
143
+ draggable={props.draggable}
144
+ manageable={props.manageable}
145
+ onReorder={(from: number, to: number) => emit("reorder", from, to)}
146
+ onManage={(row: Record<string, unknown>, opener: HTMLElement) =>
147
+ emit("manage", row, opener)
148
+ }
149
+ >
150
+ {slots}
151
+ </HTable>
152
+ </HCard>
185
153
  )}
186
154
  </HkCrossfade>
187
155
  {slots["create-modal"]?.()}
@@ -439,11 +439,11 @@ describe("HkAdminTablePage scroll-progress registration", () => {
439
439
  rects.push(vi.spyOn(viewport, "getBoundingClientRect").mockReturnValue({
440
440
  left: 0, top: 0, right: 300, bottom: 400, width: 300, height: 400, x: 0, y: 0,
441
441
  } as DOMRect));
442
- // The list root is AdminTablePage's table-card wrapper (the anchor
443
- // class the page ships for exactly this geometry contract).
442
+ // The list root is HkTable's own host element — the table
443
+ // self-registers (the page only forwards the total).
444
444
  const card = container.querySelector("table");
445
445
  expect(card).not.toBeNull();
446
- const cardHost = container.querySelector<HTMLElement>(".hk-admin-table-page-tablecard")!;
446
+ const cardHost = container.querySelector<HTMLElement>(".hk-table-host")!;
447
447
  expect(cardHost.contains(card!)).toBe(true);
448
448
  rects.push(vi.spyOn(cardHost, "getBoundingClientRect").mockReturnValue({
449
449
  left: 0, top: -200, right: 300, bottom: 3800, width: 300, height: 4000, x: 0, y: -200,
@@ -1,4 +1,4 @@
1
- import { computed, defineComponent, onBeforeUnmount, onMounted, ref, watch, type PropType } from "vue";
1
+ import { computed, defineComponent, inject, onBeforeUnmount, onMounted, ref, watch, type PropType } from "vue";
2
2
 
3
3
  import { useI18n } from "../i18n/context";
4
4
  import { usePointerReorder } from "../composables/usePointerReorder";
@@ -10,6 +10,7 @@ import { ancestorZoom } from "../runtime/cssZoom";
10
10
  import { useClipboardWithToast } from "../runtime/useClipboard";
11
11
  import { useToast } from "../runtime/useToast";
12
12
  import HkRowActions from "./HkRowActions";
13
+ import { HK_SCROLL_PROGRESS_REGISTRAR, type HkScrollProgressHandle } from "./HkScrollProgress";
13
14
  import "./HkTable.scss";
14
15
 
15
16
  interface Column {
@@ -91,6 +92,14 @@ export default defineComponent({
91
92
  default: false,
92
93
  },
93
94
  emptyText: { type: String, default: "" },
95
+ /** Authoritative row total the scroll-progress pill uses as its
96
+ * denominator (the server count behind a paged list). Omitted: the
97
+ * pill falls back to counting the delivered DOM rows. Every HkTable
98
+ * self-registers with the nearest enclosing HkScrollContainer that
99
+ * has `scrollProgress` on — no wrapper needed (2026-11-06: moved
100
+ * here from HkAdminTablePage so the 17 bare-HkTable views inherit
101
+ * the pill too). */
102
+ total: { type: Number, default: undefined },
94
103
  },
95
104
  emits: {
96
105
  "update:selectedRows": (_rows: Record<string, unknown>[]) => true,
@@ -195,6 +204,24 @@ export default defineComponent({
195
204
  wrapperScrollbar = null;
196
205
  });
197
206
 
207
+ // Scroll-progress registration: the nearest enclosing HkScrollContainer
208
+ // with `scrollProgress` on provides the registrar (provide/inject
209
+ // scoping resolves the shell viewport for admin pages and keeps an
210
+ // inner container's lists out of the shell). The handle exposes the
211
+ // table host as the row root plus the `total` prop live — the pill's
212
+ // denominator follows it as pages load.
213
+ const progressRegistrar = inject(HK_SCROLL_PROGRESS_REGISTRAR, null);
214
+ const progressHandle: HkScrollProgressHandle = {
215
+ getRoot: () => wrapperHostRef.value ?? null,
216
+ getTotal: () => props.total,
217
+ };
218
+ onMounted(() => {
219
+ progressRegistrar?.register(progressHandle);
220
+ });
221
+ onBeforeUnmount(() => {
222
+ progressRegistrar?.unregister(progressHandle);
223
+ });
224
+
198
225
  function getRowKey(row: Record<string, unknown>, index: number): string {
199
226
  if (props.rowKey && row[props.rowKey] != null) return String(row[props.rowKey]);
200
227
  return String(index);