@knkcs/anker 2.0.10 → 2.2.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/CLAUDE-ANKER.md +3 -2
- package/dist/{chunk-D5ICTOCW.js → chunk-IHX7KQRU.js} +27 -17
- package/dist/chunk-IHX7KQRU.js.map +1 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +24 -23
- package/dist/components/index.js.map +1 -1
- package/dist/{page-header-D-kxNn-f.d.ts → page-header-DQZjQA5u.d.ts} +5 -1
- package/dist/primitives/index.js +1 -2
- package/dist/primitives/index.js.map +1 -1
- package/dist/templates/index.d.ts +38 -54
- package/dist/templates/index.js +97 -130
- package/dist/templates/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-D5ICTOCW.js.map +0 -1
- package/dist/chunk-ZLQ3RBAF.js +0 -3
- package/dist/chunk-ZLQ3RBAF.js.map +0 -1
package/dist/templates/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuthCard, PageHeader } from '../chunk-D5ICTOCW.js';
|
|
1
|
+
import { AuthCard, PageHeader } from '../chunk-IHX7KQRU.js';
|
|
3
2
|
import { Spinner } from '../chunk-5YDCDC4B.js';
|
|
4
3
|
import { Grid, Box, Flex, Text, Heading } from '../chunk-G4QMIXLC.js';
|
|
5
4
|
import { createContext, useContext, useRef, useEffect, useMemo, useCallback, useSyncExternalStore } from 'react';
|
|
@@ -8,10 +7,12 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
8
7
|
function createSlotStore() {
|
|
9
8
|
const values = {
|
|
10
9
|
actions: null,
|
|
10
|
+
header: null,
|
|
11
11
|
rail: null
|
|
12
12
|
};
|
|
13
13
|
const listeners = {
|
|
14
14
|
actions: /* @__PURE__ */ new Set(),
|
|
15
|
+
header: /* @__PURE__ */ new Set(),
|
|
15
16
|
rail: /* @__PURE__ */ new Set()
|
|
16
17
|
};
|
|
17
18
|
function notify(slot) {
|
|
@@ -87,6 +88,22 @@ function usePageRail(content) {
|
|
|
87
88
|
store.set("rail", content);
|
|
88
89
|
}, [store, content]);
|
|
89
90
|
}
|
|
91
|
+
function usePageHeader(content) {
|
|
92
|
+
const store = useContext(SlotStoreContext);
|
|
93
|
+
const latest = useRef(content);
|
|
94
|
+
latest.current = content;
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (!store) return;
|
|
97
|
+
store.set("header", latest.current);
|
|
98
|
+
return () => {
|
|
99
|
+
store.clear("header");
|
|
100
|
+
};
|
|
101
|
+
}, [store]);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (!store) return;
|
|
104
|
+
store.set("header", content);
|
|
105
|
+
}, [store, content]);
|
|
106
|
+
}
|
|
90
107
|
function useRegisteredPageActions() {
|
|
91
108
|
return useSlotValue("actions");
|
|
92
109
|
}
|
|
@@ -97,14 +114,18 @@ function AppShell({ sidebar, rail, children }) {
|
|
|
97
114
|
AppShell.displayName = "AppShell";
|
|
98
115
|
function AppShellInner({ sidebar, rail, children }) {
|
|
99
116
|
const railNode = useSlotValue("rail");
|
|
117
|
+
const headerNode = useSlotValue("header");
|
|
100
118
|
const renderedRail = railNode ?? rail;
|
|
101
119
|
const showRailColumn = renderedRail !== void 0 && renderedRail !== null && renderedRail !== false;
|
|
120
|
+
const showHeaderRow = headerNode !== null && headerNode !== void 0;
|
|
102
121
|
return /* @__PURE__ */ jsxs(
|
|
103
122
|
Grid,
|
|
104
123
|
{
|
|
105
124
|
"data-testid": "app-shell",
|
|
106
125
|
"data-rail": showRailColumn ? "true" : "false",
|
|
126
|
+
"data-header": showHeaderRow ? "true" : "false",
|
|
107
127
|
templateColumns: showRailColumn ? "auto 1fr auto" : "auto 1fr",
|
|
128
|
+
templateRows: "auto 1fr",
|
|
108
129
|
minH: "100vh",
|
|
109
130
|
bg: "bg-canvas",
|
|
110
131
|
children: [
|
|
@@ -113,6 +134,7 @@ function AppShellInner({ sidebar, rail, children }) {
|
|
|
113
134
|
{
|
|
114
135
|
"data-testid": "app-shell-sidebar",
|
|
115
136
|
gridColumn: "1",
|
|
137
|
+
gridRow: "1 / 3",
|
|
116
138
|
minW: "0",
|
|
117
139
|
position: "sticky",
|
|
118
140
|
top: "0",
|
|
@@ -121,14 +143,24 @@ function AppShellInner({ sidebar, rail, children }) {
|
|
|
121
143
|
children: sidebar
|
|
122
144
|
}
|
|
123
145
|
),
|
|
146
|
+
showHeaderRow ? /* @__PURE__ */ jsx(
|
|
147
|
+
Box,
|
|
148
|
+
{
|
|
149
|
+
"data-testid": "app-shell-header",
|
|
150
|
+
gridColumn: showRailColumn ? "2 / 4" : "2 / 3",
|
|
151
|
+
gridRow: "1",
|
|
152
|
+
minW: "0",
|
|
153
|
+
children: headerNode
|
|
154
|
+
}
|
|
155
|
+
) : null,
|
|
124
156
|
/* @__PURE__ */ jsx(
|
|
125
157
|
Flex,
|
|
126
158
|
{
|
|
127
159
|
"data-testid": "app-shell-main",
|
|
128
160
|
gridColumn: "2",
|
|
161
|
+
gridRow: "2",
|
|
129
162
|
direction: "column",
|
|
130
163
|
minW: "0",
|
|
131
|
-
minH: "100vh",
|
|
132
164
|
bg: "bg-canvas",
|
|
133
165
|
borderLeftWidth: "1px",
|
|
134
166
|
borderColor: "border",
|
|
@@ -140,6 +172,7 @@ function AppShellInner({ sidebar, rail, children }) {
|
|
|
140
172
|
{
|
|
141
173
|
"data-testid": "app-shell-rail",
|
|
142
174
|
gridColumn: "3",
|
|
175
|
+
gridRow: "2",
|
|
143
176
|
minW: "0",
|
|
144
177
|
position: "sticky",
|
|
145
178
|
top: "0",
|
|
@@ -209,72 +242,38 @@ function DetailPageTemplate({
|
|
|
209
242
|
subtitle,
|
|
210
243
|
eyebrow,
|
|
211
244
|
actions,
|
|
245
|
+
avatar,
|
|
246
|
+
badges,
|
|
247
|
+
meta,
|
|
212
248
|
tabs,
|
|
213
|
-
bodyTabs,
|
|
214
|
-
subheader,
|
|
215
249
|
children
|
|
216
250
|
}) {
|
|
217
|
-
if (tabs && bodyTabs) {
|
|
218
|
-
throw new Error(
|
|
219
|
-
"DetailPageTemplate: `tabs` and `bodyTabs` are mutually exclusive \u2014 use `bodyTabs` for owned panels, `tabs` for nav/filter strips."
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
251
|
const registered = useRegisteredPageActions();
|
|
223
252
|
const resolvedActions = actions ?? registered;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
onValueChange: (d) => bodyTabs.onValueChange(d.value)
|
|
228
|
-
} : { defaultValue: bodyTabs.defaultValue };
|
|
229
|
-
return /* @__PURE__ */ jsxs(
|
|
230
|
-
Flex,
|
|
253
|
+
usePageHeader(
|
|
254
|
+
/* @__PURE__ */ jsx(
|
|
255
|
+
PageHeader,
|
|
231
256
|
{
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
title,
|
|
242
|
-
subtitle,
|
|
243
|
-
eyebrow,
|
|
244
|
-
actions: resolvedActions
|
|
245
|
-
}
|
|
246
|
-
),
|
|
247
|
-
subheader ? /* @__PURE__ */ jsx(Box, { children: subheader }) : null,
|
|
248
|
-
/* @__PURE__ */ jsxs(Tabs.Root, { lazyMount: true, unmountOnExit: true, ...tabsRootProps, children: [
|
|
249
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Tabs.List, { children: bodyTabs.items.map((item) => /* @__PURE__ */ jsx(Tabs.Trigger, { value: item.value, children: item.label }, item.value)) }) }),
|
|
250
|
-
/* @__PURE__ */ jsx(Box, { flex: "1", minH: "0", children: bodyTabs.items.map((item) => /* @__PURE__ */ jsx(Tabs.Content, { value: item.value, children: item.content }, item.value)) })
|
|
251
|
-
] })
|
|
252
|
-
]
|
|
257
|
+
breadcrumbs,
|
|
258
|
+
title,
|
|
259
|
+
subtitle,
|
|
260
|
+
eyebrow,
|
|
261
|
+
actions: resolvedActions,
|
|
262
|
+
avatar,
|
|
263
|
+
badges,
|
|
264
|
+
meta,
|
|
265
|
+
tabs
|
|
253
266
|
}
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
return /* @__PURE__ */
|
|
267
|
+
)
|
|
268
|
+
);
|
|
269
|
+
return /* @__PURE__ */ jsx(
|
|
257
270
|
Flex,
|
|
258
271
|
{
|
|
259
272
|
"data-testid": "detail-page-template",
|
|
260
273
|
direction: "column",
|
|
261
274
|
flex: "1",
|
|
262
275
|
minH: "0",
|
|
263
|
-
children:
|
|
264
|
-
/* @__PURE__ */ jsx(
|
|
265
|
-
PageHeader,
|
|
266
|
-
{
|
|
267
|
-
breadcrumbs,
|
|
268
|
-
title,
|
|
269
|
-
subtitle,
|
|
270
|
-
eyebrow,
|
|
271
|
-
actions: resolvedActions
|
|
272
|
-
}
|
|
273
|
-
),
|
|
274
|
-
subheader ? /* @__PURE__ */ jsx(Box, { children: subheader }) : null,
|
|
275
|
-
tabs ? /* @__PURE__ */ jsx(Box, { children: tabs }) : null,
|
|
276
|
-
/* @__PURE__ */ jsx(Box, { flex: "1", minH: "0", children })
|
|
277
|
-
]
|
|
276
|
+
children: /* @__PURE__ */ jsx(Box, { flex: "1", minH: "0", children })
|
|
278
277
|
}
|
|
279
278
|
);
|
|
280
279
|
}
|
|
@@ -354,6 +353,19 @@ function IndexPageTemplate({
|
|
|
354
353
|
}) {
|
|
355
354
|
const registered = useRegisteredPageActions();
|
|
356
355
|
const resolvedActions = actions ?? registered;
|
|
356
|
+
usePageHeader(
|
|
357
|
+
/* @__PURE__ */ jsx(
|
|
358
|
+
PageHeader,
|
|
359
|
+
{
|
|
360
|
+
breadcrumbs,
|
|
361
|
+
title,
|
|
362
|
+
subtitle,
|
|
363
|
+
eyebrow,
|
|
364
|
+
actions: resolvedActions,
|
|
365
|
+
tabs
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
);
|
|
357
369
|
return /* @__PURE__ */ jsxs(
|
|
358
370
|
Flex,
|
|
359
371
|
{
|
|
@@ -362,17 +374,6 @@ function IndexPageTemplate({
|
|
|
362
374
|
flex: "1",
|
|
363
375
|
minH: "0",
|
|
364
376
|
children: [
|
|
365
|
-
/* @__PURE__ */ jsx(
|
|
366
|
-
PageHeader,
|
|
367
|
-
{
|
|
368
|
-
breadcrumbs,
|
|
369
|
-
title,
|
|
370
|
-
subtitle,
|
|
371
|
-
eyebrow,
|
|
372
|
-
actions: resolvedActions
|
|
373
|
-
}
|
|
374
|
-
),
|
|
375
|
-
tabs ? /* @__PURE__ */ jsx(Box, { children: tabs }) : null,
|
|
376
377
|
toolbar ? /* @__PURE__ */ jsx(Box, { children: toolbar }) : null,
|
|
377
378
|
/* @__PURE__ */ jsx(Box, { flex: "1", minH: "0", children })
|
|
378
379
|
]
|
|
@@ -565,88 +566,54 @@ function SettingsPageTemplate({
|
|
|
565
566
|
subtitle,
|
|
566
567
|
eyebrow,
|
|
567
568
|
actions,
|
|
569
|
+
avatar,
|
|
570
|
+
badges,
|
|
571
|
+
meta,
|
|
568
572
|
tabs,
|
|
569
|
-
bodyTabs,
|
|
570
573
|
children,
|
|
571
574
|
maxBodyWidth = "3xl",
|
|
572
575
|
bodyPadding = "default"
|
|
573
576
|
}) {
|
|
574
|
-
if (tabs && bodyTabs) {
|
|
575
|
-
throw new Error(
|
|
576
|
-
"SettingsPageTemplate: `tabs` and `bodyTabs` are mutually exclusive \u2014 use `bodyTabs` for owned panels, `tabs` for consumer-owned tab strips."
|
|
577
|
-
);
|
|
578
|
-
}
|
|
579
577
|
const registered = useRegisteredPageActions();
|
|
580
578
|
const resolvedActions = actions ?? registered;
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
Box,
|
|
585
|
-
{
|
|
586
|
-
maxW: maxBodyWidth,
|
|
587
|
-
marginInline: maxBodyWidth === "full" ? "0" : "auto",
|
|
588
|
-
children: node
|
|
589
|
-
}
|
|
590
|
-
) });
|
|
591
|
-
if (bodyTabs) {
|
|
592
|
-
const tabsRootProps = bodyTabs.value !== void 0 ? {
|
|
593
|
-
value: bodyTabs.value,
|
|
594
|
-
onValueChange: (d) => bodyTabs.onValueChange?.(d.value)
|
|
595
|
-
} : { defaultValue: bodyTabs.defaultValue };
|
|
596
|
-
return /* @__PURE__ */ jsxs(
|
|
597
|
-
Flex,
|
|
579
|
+
usePageHeader(
|
|
580
|
+
/* @__PURE__ */ jsx(
|
|
581
|
+
PageHeader,
|
|
598
582
|
{
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
title,
|
|
609
|
-
subtitle,
|
|
610
|
-
eyebrow,
|
|
611
|
-
actions: resolvedActions
|
|
612
|
-
}
|
|
613
|
-
),
|
|
614
|
-
/* @__PURE__ */ jsxs(Tabs.Root, { lazyMount: true, unmountOnExit: true, ...tabsRootProps, children: [
|
|
615
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Tabs.List, { children: bodyTabs.items.map((item) => /* @__PURE__ */ jsx(Tabs.Trigger, { value: item.value, children: item.label }, item.value)) }) }),
|
|
616
|
-
renderBody(
|
|
617
|
-
bodyTabs.items.map((item) => /* @__PURE__ */ jsx(Tabs.Content, { value: item.value, children: item.content }, item.value))
|
|
618
|
-
)
|
|
619
|
-
] })
|
|
620
|
-
]
|
|
583
|
+
breadcrumbs,
|
|
584
|
+
title,
|
|
585
|
+
subtitle,
|
|
586
|
+
eyebrow,
|
|
587
|
+
actions: resolvedActions,
|
|
588
|
+
avatar,
|
|
589
|
+
badges,
|
|
590
|
+
meta,
|
|
591
|
+
tabs
|
|
621
592
|
}
|
|
622
|
-
)
|
|
623
|
-
|
|
624
|
-
|
|
593
|
+
)
|
|
594
|
+
);
|
|
595
|
+
const bodyPx = bodyPadding === "none" ? "0" : "8";
|
|
596
|
+
const bodyPt = bodyPadding === "none" ? "0" : "6";
|
|
597
|
+
return /* @__PURE__ */ jsx(
|
|
625
598
|
Flex,
|
|
626
599
|
{
|
|
627
600
|
"data-testid": "settings-page-template",
|
|
628
601
|
direction: "column",
|
|
629
602
|
flex: "1",
|
|
630
603
|
minH: "0",
|
|
631
|
-
children:
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
actions: resolvedActions
|
|
640
|
-
}
|
|
641
|
-
),
|
|
642
|
-
/* @__PURE__ */ jsx(Box, { children: tabs }),
|
|
643
|
-
renderBody(children)
|
|
644
|
-
]
|
|
604
|
+
children: /* @__PURE__ */ jsx(Box, { flex: "1", minH: "0", px: bodyPx, pt: bodyPt, children: /* @__PURE__ */ jsx(
|
|
605
|
+
Box,
|
|
606
|
+
{
|
|
607
|
+
maxW: maxBodyWidth,
|
|
608
|
+
marginInline: maxBodyWidth === "full" ? "0" : "auto",
|
|
609
|
+
children
|
|
610
|
+
}
|
|
611
|
+
) })
|
|
645
612
|
}
|
|
646
613
|
);
|
|
647
614
|
}
|
|
648
615
|
SettingsPageTemplate.displayName = "SettingsPageTemplate";
|
|
649
616
|
|
|
650
|
-
export { AppShell, AuthPageTemplate, DashboardPageTemplate, DetailPageTemplate, ErrorPage, IndexPageTemplate, LoadingPage, MaintenancePage, MarketingPageTemplate, SettingsPageTemplate, usePageActions, usePageRail };
|
|
617
|
+
export { AppShell, AuthPageTemplate, DashboardPageTemplate, DetailPageTemplate, ErrorPage, IndexPageTemplate, LoadingPage, MaintenancePage, MarketingPageTemplate, SettingsPageTemplate, usePageActions, usePageHeader, usePageRail };
|
|
651
618
|
//# sourceMappingURL=index.js.map
|
|
652
619
|
//# sourceMappingURL=index.js.map
|