@byline/host-tanstack-start 4.16.0 → 4.18.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/dist/admin-shell/chrome/admin-menu-drawer.js +14 -14
- package/dist/admin-shell/chrome/dashboard.js +41 -5
- package/dist/admin-shell/chrome/dashboard.test.d.ts +8 -0
- package/dist/admin-shell/chrome/router-pager.d.ts +7 -0
- package/dist/admin-shell/chrome/router-pager.js +13 -0
- package/dist/admin-shell/chrome/scroll-to-top.d.ts +20 -0
- package/dist/admin-shell/chrome/scroll-to-top.js +9 -0
- package/dist/admin-shell/collections/api.d.ts +2 -2
- package/dist/admin-shell/collections/create.d.ts +2 -2
- package/dist/admin-shell/collections/create.js +1 -0
- package/dist/admin-shell/collections/edit.d.ts +2 -2
- package/dist/admin-shell/collections/edit.js +1 -0
- package/dist/admin-shell/collections/history.d.ts +4 -12
- package/dist/admin-shell/collections/history.js +112 -303
- package/dist/admin-shell/collections/reindex-button.d.ts +1 -1
- package/dist/admin-shell/collections/reindex-button.js +5 -1
- package/dist/admin-shell/collections/restore-version-modal.d.ts +4 -4
- package/dist/admin-shell/collections/restore-version-modal.js +8 -24
- package/dist/admin-shell/collections/version-history.d.ts +72 -0
- package/dist/admin-shell/collections/version-history.js +259 -0
- package/dist/admin-shell/singletons/history.d.ts +19 -0
- package/dist/admin-shell/singletons/history.js +170 -0
- package/dist/admin-shell/singletons/history.test.d.ts +8 -0
- package/dist/admin-shell/singletons/preview-link.d.ts +12 -0
- package/dist/admin-shell/singletons/preview-link.js +54 -0
- package/dist/admin-shell/singletons/view-menu.d.ts +13 -0
- package/dist/admin-shell/singletons/view-menu.js +116 -0
- package/dist/admin-shell/singletons/view.d.ts +18 -0
- package/dist/admin-shell/singletons/view.js +259 -0
- package/dist/admin-shell/singletons/view.test.d.ts +8 -0
- package/dist/integrations/api-utils.d.ts +18 -4
- package/dist/integrations/api-utils.js +10 -3
- package/dist/routes/create-admin-dashboard-route.js +2 -2
- package/dist/routes/create-collection-api-route.js +3 -3
- package/dist/routes/create-collection-create-route.js +4 -3
- package/dist/routes/create-collection-edit-route.js +4 -3
- package/dist/routes/create-collection-history-route.js +4 -3
- package/dist/routes/create-collection-list-route.js +4 -3
- package/dist/routes/create-singleton-history-route.d.ts +8 -0
- package/dist/routes/create-singleton-history-route.js +99 -0
- package/dist/routes/create-singleton-route.d.ts +35 -0
- package/dist/routes/create-singleton-route.js +130 -0
- package/dist/routes/get-multi-collection-definition.d.ts +10 -0
- package/dist/routes/get-multi-collection-definition.js +6 -0
- package/dist/routes/get-singleton-definition.d.ts +10 -0
- package/dist/routes/get-singleton-definition.js +6 -0
- package/dist/routes/index.d.ts +2 -0
- package/dist/routes/index.js +2 -0
- package/dist/server-fns/actors.d.ts +16 -0
- package/dist/server-fns/actors.js +25 -0
- package/dist/server-fns/admin-document-presentation.d.ts +30 -0
- package/dist/server-fns/admin-document-presentation.js +32 -0
- package/dist/server-fns/collections/actors.d.ts +1 -10
- package/dist/server-fns/collections/actors.js +1 -25
- package/dist/server-fns/collections/get.js +9 -26
- package/dist/server-fns/collections/reorder.js +1 -1
- package/dist/server-fns/collections/scheduled-publication.js +2 -2
- package/dist/server-fns/collections/upload.js +3 -3
- package/dist/server-fns/collections/utils.d.ts +1 -7
- package/dist/server-fns/collections/utils.js +1 -4
- package/dist/server-fns/serialise.d.ts +14 -0
- package/dist/server-fns/serialise.js +4 -0
- package/dist/server-fns/singleton-document-read.d.ts +20 -0
- package/dist/server-fns/singleton-document-read.js +10 -0
- package/dist/server-fns/singletons/cancel-scheduled-publish.d.ts +12 -0
- package/dist/server-fns/singletons/cancel-scheduled-publish.js +7 -0
- package/dist/server-fns/singletons/change-status.d.ts +14 -0
- package/dist/server-fns/singletons/change-status.js +7 -0
- package/dist/server-fns/singletons/confirm-scheduled-publish.d.ts +14 -0
- package/dist/server-fns/singletons/confirm-scheduled-publish.js +9 -0
- package/dist/server-fns/singletons/copy-to-locale.d.ts +18 -0
- package/dist/server-fns/singletons/copy-to-locale.js +11 -0
- package/dist/server-fns/singletons/find-by-version.d.ts +16 -0
- package/dist/server-fns/singletons/find-by-version.js +9 -0
- package/dist/server-fns/singletons/get-scheduled-publish.d.ts +12 -0
- package/dist/server-fns/singletons/get-scheduled-publish.js +7 -0
- package/dist/server-fns/singletons/get.d.ts +24 -0
- package/dist/server-fns/singletons/get.js +6 -0
- package/dist/server-fns/singletons/history.d.ts +31 -0
- package/dist/server-fns/singletons/history.js +22 -0
- package/dist/server-fns/singletons/index.d.ts +19 -0
- package/dist/server-fns/singletons/index.js +12 -0
- package/dist/server-fns/singletons/restore-version.d.ts +14 -0
- package/dist/server-fns/singletons/restore-version.js +7 -0
- package/dist/server-fns/singletons/schedule-publish.d.ts +16 -0
- package/dist/server-fns/singletons/schedule-publish.js +10 -0
- package/dist/server-fns/singletons/unpublish.d.ts +12 -0
- package/dist/server-fns/singletons/unpublish.js +7 -0
- package/dist/server-fns/singletons/update.d.ts +14 -0
- package/dist/server-fns/singletons/update.js +14 -0
- package/dist/vitest-jsdom.test.d.ts +8 -0
- package/package.json +24 -18
- package/src/admin-shell/chrome/admin-menu-drawer.tsx +13 -13
- package/src/admin-shell/chrome/dashboard.test.tsx +199 -0
- package/src/admin-shell/chrome/dashboard.tsx +43 -9
- package/src/admin-shell/chrome/router-pager.tsx +22 -0
- package/src/admin-shell/chrome/scroll-to-top.test.ts +56 -0
- package/src/admin-shell/chrome/scroll-to-top.ts +28 -0
- package/src/admin-shell/collections/api.tsx +2 -2
- package/src/admin-shell/collections/create.tsx +6 -2
- package/src/admin-shell/collections/edit.tsx +6 -2
- package/src/admin-shell/collections/history.module.css +1 -1
- package/src/admin-shell/collections/history.tsx +162 -442
- package/src/admin-shell/collections/reindex-button.tsx +4 -2
- package/src/admin-shell/collections/restore-version-modal.tsx +19 -25
- package/src/admin-shell/collections/version-history.tsx +349 -0
- package/src/admin-shell/singletons/history.test.tsx +407 -0
- package/src/admin-shell/singletons/history.tsx +185 -0
- package/src/admin-shell/singletons/preview-link.tsx +75 -0
- package/src/admin-shell/singletons/view-menu.tsx +136 -0
- package/src/admin-shell/singletons/view.test.tsx +400 -0
- package/src/admin-shell/singletons/view.tsx +351 -0
- package/src/integrations/api-utils.ts +34 -9
- package/src/routes/create-admin-dashboard-route.test.node.ts +70 -0
- package/src/routes/create-admin-dashboard-route.tsx +10 -2
- package/src/routes/create-collection-api-route.tsx +4 -4
- package/src/routes/create-collection-create-route.tsx +5 -8
- package/src/routes/create-collection-edit-route.tsx +5 -4
- package/src/routes/create-collection-history-route.tsx +5 -8
- package/src/routes/create-collection-list-route.tsx +5 -8
- package/src/routes/create-singleton-history-route.test.node.ts +148 -0
- package/src/routes/create-singleton-history-route.tsx +116 -0
- package/src/routes/create-singleton-route.test.node.ts +172 -0
- package/src/routes/create-singleton-route.tsx +176 -0
- package/src/routes/get-multi-collection-definition.ts +16 -0
- package/src/routes/get-singleton-definition.ts +16 -0
- package/src/routes/index.ts +2 -0
- package/src/server-fns/actors.ts +43 -0
- package/src/server-fns/admin-document-presentation.ts +78 -0
- package/src/server-fns/collections/actors.ts +1 -52
- package/src/server-fns/collections/get.ts +10 -49
- package/src/server-fns/collections/reorder.ts +1 -1
- package/src/server-fns/collections/scheduled-publication.ts +7 -1
- package/src/server-fns/collections/upload-singleton.test.node.ts +164 -0
- package/src/server-fns/collections/upload.ts +7 -3
- package/src/server-fns/collections/utils.ts +1 -9
- package/src/server-fns/serialise.ts +17 -0
- package/src/server-fns/singleton-document-read.ts +32 -0
- package/src/server-fns/singletons/cancel-scheduled-publish.ts +19 -0
- package/src/server-fns/singletons/change-status.ts +19 -0
- package/src/server-fns/singletons/confirm-scheduled-publish.ts +23 -0
- package/src/server-fns/singletons/copy-to-locale.ts +32 -0
- package/src/server-fns/singletons/find-by-version.ts +23 -0
- package/src/server-fns/singletons/get-scheduled-publish.ts +19 -0
- package/src/server-fns/singletons/get.ts +32 -0
- package/src/server-fns/singletons/history.ts +41 -0
- package/src/server-fns/singletons/index.ts +20 -0
- package/src/server-fns/singletons/restore-version.ts +19 -0
- package/src/server-fns/singletons/schedule-publish.ts +24 -0
- package/src/server-fns/singletons/singletons.test.node.ts +298 -0
- package/src/server-fns/singletons/unpublish.ts +19 -0
- package/src/server-fns/singletons/update.ts +31 -0
- package/src/vitest-jsdom.test.tsx +27 -0
|
@@ -5,9 +5,9 @@ import { ADMIN_PERMISSIONS_ABILITIES } from "@byline/admin/admin-permissions";
|
|
|
5
5
|
import { ADMIN_ROLES_ABILITIES } from "@byline/admin/admin-roles";
|
|
6
6
|
import { ADMIN_USERS_ABILITIES } from "@byline/admin/admin-users";
|
|
7
7
|
import { ANALYTICS_ABILITIES } from "@byline/admin/analytics";
|
|
8
|
-
import {
|
|
8
|
+
import { documentAbilityKey, getAdminConfig } from "@byline/core";
|
|
9
9
|
import { useTranslation } from "@byline/i18n/react";
|
|
10
|
-
import { ActivityIcon, AnalyticsIcon, CalendarIcon,
|
|
10
|
+
import { ActivityIcon, AnalyticsIcon, CalendarIcon, DashboardIcon, RolesIcon, SettingsSlidersIcon, Tooltip, UserIcon, UsersIcon } from "@byline/ui/react";
|
|
11
11
|
import clsx from "clsx";
|
|
12
12
|
import { useSwipeable } from "react-swipeable";
|
|
13
13
|
import { useAbilities } from "../../integrations/abilities.js";
|
|
@@ -59,7 +59,7 @@ function AdminMenuDrawer({ analyticsEnabled = false, scheduledPublicationEnabled
|
|
|
59
59
|
const canReadPermissions = has(ADMIN_PERMISSIONS_ABILITIES.read);
|
|
60
60
|
const canReadActivity = has(ADMIN_ACTIVITY_ABILITIES.read);
|
|
61
61
|
const canReadAnalytics = analyticsEnabled && has(ANALYTICS_ABILITIES.read);
|
|
62
|
-
const canSeeScheduledPublications = scheduledPublicationEnabled && getAdminConfig().collections.some((collection)=>has(
|
|
62
|
+
const canSeeScheduledPublications = scheduledPublicationEnabled && getAdminConfig().collections.some((collection)=>has(documentAbilityKey(collection, 'changeStatus')) && has(documentAbilityKey(collection, 'publish')));
|
|
63
63
|
const showAdminSection = canReadUsers || canReadRoles || canReadPermissions || canReadActivity;
|
|
64
64
|
const handlers = useSwipeable({
|
|
65
65
|
onSwipedLeft: ()=>{
|
|
@@ -91,23 +91,13 @@ function AdminMenuDrawer({ analyticsEnabled = false, scheduledPublicationEnabled
|
|
|
91
91
|
/*#__PURE__*/ jsx(MenuItem, {
|
|
92
92
|
to: getAdminRoutePath(),
|
|
93
93
|
label: t('chrome.menu.dashboard'),
|
|
94
|
-
icon: /*#__PURE__*/ jsx(
|
|
94
|
+
icon: /*#__PURE__*/ jsx(DashboardIcon, {
|
|
95
95
|
width: "20px",
|
|
96
96
|
height: "20px"
|
|
97
97
|
}),
|
|
98
98
|
pathname: pathname,
|
|
99
99
|
compact: compact
|
|
100
100
|
}),
|
|
101
|
-
canSeeScheduledPublications && /*#__PURE__*/ jsx(MenuItem, {
|
|
102
|
-
to: getAdminRoutePath('scheduled-publications'),
|
|
103
|
-
label: t('chrome.menu.scheduledPublications'),
|
|
104
|
-
icon: /*#__PURE__*/ jsx(CalendarIcon, {
|
|
105
|
-
width: "18px",
|
|
106
|
-
height: "18px"
|
|
107
|
-
}),
|
|
108
|
-
pathname: pathname,
|
|
109
|
-
compact: compact
|
|
110
|
-
}),
|
|
111
101
|
canReadAnalytics && /*#__PURE__*/ jsx(MenuItem, {
|
|
112
102
|
to: getAdminRoutePath('analytics'),
|
|
113
103
|
label: t('chrome.menu.analytics'),
|
|
@@ -118,6 +108,16 @@ function AdminMenuDrawer({ analyticsEnabled = false, scheduledPublicationEnabled
|
|
|
118
108
|
pathname: pathname,
|
|
119
109
|
compact: compact
|
|
120
110
|
}),
|
|
111
|
+
canSeeScheduledPublications && /*#__PURE__*/ jsx(MenuItem, {
|
|
112
|
+
to: getAdminRoutePath('scheduled-publications'),
|
|
113
|
+
label: t('chrome.menu.scheduledPublications'),
|
|
114
|
+
icon: /*#__PURE__*/ jsx(CalendarIcon, {
|
|
115
|
+
width: "18px",
|
|
116
|
+
height: "18px"
|
|
117
|
+
}),
|
|
118
|
+
pathname: pathname,
|
|
119
|
+
compact: compact
|
|
120
|
+
}),
|
|
121
121
|
showAdminSection && /*#__PURE__*/ jsxs(Fragment, {
|
|
122
122
|
children: [
|
|
123
123
|
/*#__PURE__*/ jsx("li", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { filterReadableCollections, getAdminConfig, getWorkflowStatuses, groupCollectionsForAdmin } from "@byline/core";
|
|
2
|
+
import { filterReadableCollections, getAdminConfig, getWorkflowStatuses, groupCollectionsForAdmin, isSingleton } from "@byline/core";
|
|
3
3
|
import { useTranslation } from "@byline/i18n/react";
|
|
4
4
|
import { Card, Container, Section } from "@byline/ui/react";
|
|
5
5
|
import clsx from "clsx";
|
|
@@ -119,6 +119,40 @@ function CollectionCard({ collection, stats }) {
|
|
|
119
119
|
]
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
+
function SingletonCard({ singleton }) {
|
|
123
|
+
const { t } = useTranslation('byline-admin');
|
|
124
|
+
const destination = getAdminRoutePath('singletons', '$singleton');
|
|
125
|
+
const params = {
|
|
126
|
+
singleton: singleton.path
|
|
127
|
+
};
|
|
128
|
+
return /*#__PURE__*/ jsx(Card, {
|
|
129
|
+
children: /*#__PURE__*/ jsx(Link, {
|
|
130
|
+
to: destination,
|
|
131
|
+
params: params,
|
|
132
|
+
className: clsx('byline-dashboard-card-link', dashboard_module.cardLink),
|
|
133
|
+
children: /*#__PURE__*/ jsx(Card.Header, {
|
|
134
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
135
|
+
className: clsx('byline-dashboard-card-header', dashboard_module.cardHeader),
|
|
136
|
+
children: [
|
|
137
|
+
/*#__PURE__*/ jsx(Card.Title, {
|
|
138
|
+
className: clsx('byline-dashboard-card-title', dashboard_module.cardTitle),
|
|
139
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
140
|
+
className: clsx('byline-dashboard-title-text', dashboard_module.titleText),
|
|
141
|
+
children: singleton.label
|
|
142
|
+
})
|
|
143
|
+
}),
|
|
144
|
+
/*#__PURE__*/ jsx(Card.Description, {
|
|
145
|
+
className: "muted",
|
|
146
|
+
children: t("dashboard.collectionDescription", {
|
|
147
|
+
label: singleton.label
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
});
|
|
155
|
+
}
|
|
122
156
|
function AdminDashboard({ statsMap }) {
|
|
123
157
|
const config = getAdminConfig();
|
|
124
158
|
const { t } = useTranslation('byline-admin');
|
|
@@ -147,10 +181,12 @@ function AdminDashboard({ statsMap }) {
|
|
|
147
181
|
}),
|
|
148
182
|
/*#__PURE__*/ jsx("div", {
|
|
149
183
|
className: clsx('byline-dashboard-grid', dashboard_module.grid),
|
|
150
|
-
children: bucket.collections.map((
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
184
|
+
children: bucket.collections.map((resource)=>isSingleton(resource) ? /*#__PURE__*/ jsx(SingletonCard, {
|
|
185
|
+
singleton: resource
|
|
186
|
+
}, resource.path) : /*#__PURE__*/ jsx(CollectionCard, {
|
|
187
|
+
collection: resource,
|
|
188
|
+
stats: statsMap[resource.path]
|
|
189
|
+
}, resource.path))
|
|
154
190
|
})
|
|
155
191
|
]
|
|
156
192
|
}, bucket.name ?? '__ungrouped__'))
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
@@ -13,6 +13,13 @@ interface RouterPageProps extends PaginationProps {
|
|
|
13
13
|
* A convenience pager wrapped around uikit's Pagination with `asChild`
|
|
14
14
|
* targets that delegate to TanStack Router's `<Link>`. `asChild` merges
|
|
15
15
|
* the existing button styles into the rendered Link.
|
|
16
|
+
*
|
|
17
|
+
* `smoothScrollToTop` is for a pager sitting *below* a long list: turning a
|
|
18
|
+
* page there should carry the reader back to the top rather than leaving them
|
|
19
|
+
* at the foot of a fresh page. It suppresses the router's own instant
|
|
20
|
+
* `resetScroll` and animates instead — so the component owes an actual
|
|
21
|
+
* scroll, which was the missing half: the flag disabled the reset and put
|
|
22
|
+
* nothing in its place, so a bottom pager did not scroll at all.
|
|
16
23
|
*/
|
|
17
24
|
export declare function RouterPager({ className, smoothScrollToTop, 'aria-label': ariaLabel, ...rest }: RouterPageProps): React.JSX.Element;
|
|
18
25
|
export {};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
2
3
|
import { useRouterState } from "@tanstack/react-router";
|
|
3
4
|
import { ChevronLeftDoubleIcon, ChevronLeftIcon, ChevronRightDoubleIcon, ChevronRightIcon, Pagination } from "@byline/ui/react";
|
|
4
5
|
import { Link } from "./loose-router.js";
|
|
6
|
+
import { scrollWindowToTop } from "./scroll-to-top.js";
|
|
5
7
|
function RouterPager({ className, smoothScrollToTop, 'aria-label': ariaLabel, ...rest }) {
|
|
6
8
|
const location = useRouterState({
|
|
7
9
|
select: (s)=>s.location
|
|
8
10
|
});
|
|
11
|
+
const handleScrollToTop = useCallback(()=>{
|
|
12
|
+
if (true !== smoothScrollToTop) return;
|
|
13
|
+
scrollWindowToTop();
|
|
14
|
+
}, [
|
|
15
|
+
smoothScrollToTop
|
|
16
|
+
]);
|
|
9
17
|
return /*#__PURE__*/ jsx(Pagination, {
|
|
10
18
|
variant: "dashboard",
|
|
11
19
|
...rest,
|
|
@@ -19,6 +27,7 @@ function RouterPager({ className, smoothScrollToTop, 'aria-label': ariaLabel, ..
|
|
|
19
27
|
return /*#__PURE__*/ jsx(Pagination.First, {
|
|
20
28
|
render: item.disabled ? /*#__PURE__*/ jsx("div", {}) : /*#__PURE__*/ jsx(Link, {
|
|
21
29
|
resetScroll: true !== smoothScrollToTop,
|
|
30
|
+
onClick: handleScrollToTop,
|
|
22
31
|
to: location.pathname,
|
|
23
32
|
search: params
|
|
24
33
|
}),
|
|
@@ -32,6 +41,7 @@ function RouterPager({ className, smoothScrollToTop, 'aria-label': ariaLabel, ..
|
|
|
32
41
|
return /*#__PURE__*/ jsx(Pagination.Previous, {
|
|
33
42
|
render: item.disabled ? /*#__PURE__*/ jsx("div", {}) : /*#__PURE__*/ jsx(Link, {
|
|
34
43
|
resetScroll: true !== smoothScrollToTop,
|
|
44
|
+
onClick: handleScrollToTop,
|
|
35
45
|
to: location.pathname,
|
|
36
46
|
search: params
|
|
37
47
|
}),
|
|
@@ -46,6 +56,7 @@ function RouterPager({ className, smoothScrollToTop, 'aria-label': ariaLabel, ..
|
|
|
46
56
|
return /*#__PURE__*/ jsx(Pagination.Number, {
|
|
47
57
|
render: item.disabled ? /*#__PURE__*/ jsx("div", {}) : /*#__PURE__*/ jsx(Link, {
|
|
48
58
|
resetScroll: true !== smoothScrollToTop,
|
|
59
|
+
onClick: handleScrollToTop,
|
|
49
60
|
to: location.pathname,
|
|
50
61
|
search: params
|
|
51
62
|
}),
|
|
@@ -61,6 +72,7 @@ function RouterPager({ className, smoothScrollToTop, 'aria-label': ariaLabel, ..
|
|
|
61
72
|
return /*#__PURE__*/ jsx(Pagination.Next, {
|
|
62
73
|
render: item.disabled ? /*#__PURE__*/ jsx("div", {}) : /*#__PURE__*/ jsx(Link, {
|
|
63
74
|
resetScroll: true !== smoothScrollToTop,
|
|
75
|
+
onClick: handleScrollToTop,
|
|
64
76
|
to: location.pathname,
|
|
65
77
|
search: params
|
|
66
78
|
}),
|
|
@@ -75,6 +87,7 @@ function RouterPager({ className, smoothScrollToTop, 'aria-label': ariaLabel, ..
|
|
|
75
87
|
return /*#__PURE__*/ jsx(Pagination.Last, {
|
|
76
88
|
render: item.disabled ? /*#__PURE__*/ jsx("div", {}) : /*#__PURE__*/ jsx(Link, {
|
|
77
89
|
resetScroll: true !== smoothScrollToTop,
|
|
90
|
+
onClick: handleScrollToTop,
|
|
78
91
|
to: location.pathname,
|
|
79
92
|
search: params
|
|
80
93
|
}),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Return the reader to the top of the page.
|
|
10
|
+
*
|
|
11
|
+
* Separate from `RouterPager` so the behaviour can be asserted without
|
|
12
|
+
* mounting a router. `smoothScrollToTop` suppresses TanStack's instant
|
|
13
|
+
* `resetScroll` in favour of an animated one, which makes a missing
|
|
14
|
+
* implementation silent — the page simply does not move. That is what
|
|
15
|
+
* happened to every pager carrying the flag.
|
|
16
|
+
*
|
|
17
|
+
* Honours `prefers-reduced-motion`: those readers still arrive at the top,
|
|
18
|
+
* without the travel.
|
|
19
|
+
*/
|
|
20
|
+
export declare function scrollWindowToTop(): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function scrollWindowToTop() {
|
|
2
|
+
if ("u" < typeof window) return;
|
|
3
|
+
const prefersReducedMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
|
|
4
|
+
window.scrollTo({
|
|
5
|
+
top: 0,
|
|
6
|
+
behavior: true === prefersReducedMotion ? 'auto' : 'smooth'
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export { scrollWindowToTop };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) Infonomic Company Limited
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { MultiCollectionDefinition } from '@byline/core';
|
|
9
9
|
import type { AnyCollectionSchemaTypes } from '@byline/core/zod-schemas';
|
|
10
10
|
import type { ContentLocaleOption } from './view-menu.js';
|
|
11
11
|
import 'react-json-view-lite/dist/index.css';
|
|
@@ -16,7 +16,7 @@ import 'react-json-view-lite/dist/index.css';
|
|
|
16
16
|
* `.byline-api-head`, `.byline-api-title`, `.byline-api-viewer`.
|
|
17
17
|
*/
|
|
18
18
|
export declare const ApiView: ({ collectionDefinition, initialData, locale, depth, contentLocales, defaultContentLocale, }: {
|
|
19
|
-
collectionDefinition:
|
|
19
|
+
collectionDefinition: MultiCollectionDefinition;
|
|
20
20
|
initialData: AnyCollectionSchemaTypes['UpdateType'];
|
|
21
21
|
/** Currently active locale from the route search param (undefined → all). */
|
|
22
22
|
locale?: string;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) Infonomic Company Limited
|
|
7
7
|
*/
|
|
8
|
-
import type { CollectionAdminConfig,
|
|
8
|
+
import type { CollectionAdminConfig, MultiCollectionDefinition } from '@byline/core';
|
|
9
9
|
export declare const CreateView: ({ collectionDefinition, adminConfig, initialData, from, }: {
|
|
10
|
-
collectionDefinition:
|
|
10
|
+
collectionDefinition: MultiCollectionDefinition;
|
|
11
11
|
adminConfig?: CollectionAdminConfig;
|
|
12
12
|
initialData?: Record<string, any>;
|
|
13
13
|
/** URL-encoded list search state to return to on cancel — see list-return-state.ts. */
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) Infonomic Company Limited
|
|
7
7
|
*/
|
|
8
|
-
import type { CollectionAdminConfig,
|
|
8
|
+
import type { CollectionAdminConfig, MultiCollectionDefinition } from '@byline/core';
|
|
9
9
|
import type { AnyCollectionSchemaTypes } from '@byline/core/zod-schemas';
|
|
10
10
|
import type { ContentLocaleOption } from './view-menu.js';
|
|
11
11
|
export declare const EditView: ({ collectionDefinition, adminConfig, initialData, locale, contentLocales, defaultContentLocale, returnSearch, }: {
|
|
12
|
-
collectionDefinition:
|
|
12
|
+
collectionDefinition: MultiCollectionDefinition;
|
|
13
13
|
adminConfig?: CollectionAdminConfig;
|
|
14
14
|
initialData: AnyCollectionSchemaTypes['UpdateType'];
|
|
15
15
|
locale?: string;
|
|
@@ -5,28 +5,20 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) Infonomic Company Limited
|
|
7
7
|
*/
|
|
8
|
-
import type { CollectionAdminConfig,
|
|
8
|
+
import type { CollectionAdminConfig, MultiCollectionDefinition, WorkflowStatus } from '@byline/core';
|
|
9
9
|
import type { AnyCollectionSchemaTypes } from '@byline/core/zod-schemas';
|
|
10
10
|
import { type DocumentHistoryData } from './document-history.js';
|
|
11
11
|
import type { ContentLocaleOption } from './view-menu.js';
|
|
12
12
|
export declare const HistoryView: ({ collectionDefinition, adminConfig, data, auditLog, workflowStatuses, currentDocument, contentLocales, defaultContentLocale, }: {
|
|
13
|
-
collectionDefinition:
|
|
13
|
+
collectionDefinition: MultiCollectionDefinition;
|
|
14
14
|
adminConfig?: CollectionAdminConfig;
|
|
15
15
|
data: AnyCollectionSchemaTypes['HistoryType'] & {
|
|
16
|
-
/**
|
|
17
|
-
* Audit display labels (the acting user per version), resolved admin-side from each
|
|
18
|
-
* version's `createdBy` id (see docs/07-auth-and-security/02-auditability.md — Workstream 1). Ids
|
|
19
|
-
* absent from the map belong to deleted users.
|
|
20
|
-
*/
|
|
16
|
+
/** Admin-resolved acting-user labels keyed by raw version actor id. */
|
|
21
17
|
actors?: Record<string, {
|
|
22
18
|
label: string;
|
|
23
19
|
}>;
|
|
24
20
|
};
|
|
25
|
-
/**
|
|
26
|
-
* Document-grain audit log for the "Document history" tab (docs/07-auth-and-security/02-auditability.md —
|
|
27
|
-
* Workstream 3): the non-versioned path / available-locales / status
|
|
28
|
-
* changes and the deletion event, with admin-resolved actor labels.
|
|
29
|
-
*/
|
|
21
|
+
/** Collection-only document-grain audit log. */
|
|
30
22
|
auditLog?: DocumentHistoryData;
|
|
31
23
|
workflowStatuses?: WorkflowStatus[];
|
|
32
24
|
currentDocument?: Record<string, unknown> | null;
|