@mattisvensson/strapi-plugin-webatlas 0.9.5 → 0.10.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.
Files changed (117) hide show
  1. package/README.md +24 -36
  2. package/dist/_chunks/FullLoader-Cmsf8xS6.js +0 -1
  3. package/dist/_chunks/FullLoader-CrPED_dY.mjs +0 -1
  4. package/dist/_chunks/{SettingTitle-CiMKrd_1.mjs → SettingTitle-CdR3SVn_.mjs} +1 -2
  5. package/dist/_chunks/{SettingTitle-CAoYbTar.js → SettingTitle-RU1azFIM.js} +1 -1
  6. package/dist/_chunks/{de-C-uxto84.mjs → de-B5pRvs13.mjs} +13 -8
  7. package/dist/_chunks/{de-CGXL_3o_.js → de-CqU1FU8C.js} +13 -8
  8. package/dist/_chunks/{en-B1CHnIH7.mjs → en-BE-zzIv8.mjs} +13 -8
  9. package/dist/_chunks/{en-DWEd5BXK.js → en-C7I90FwV.js} +13 -8
  10. package/dist/_chunks/{index-Bqsd7oPS.mjs → index-B07UVUOa.mjs} +387 -230
  11. package/dist/_chunks/{index-DJBnQbrp.mjs → index-BmyxSosC.mjs} +3 -3
  12. package/dist/_chunks/{index-BOZDZiAv.js → index-BucL4va6.js} +38 -82
  13. package/dist/_chunks/{index-DU58LJ2w.mjs → index-BvcX9hcc.mjs} +61 -25
  14. package/dist/_chunks/{index-ezabqLEP.js → index-BxpDM360.js} +386 -228
  15. package/dist/_chunks/{index-qrC_n9-7.mjs → index-CIM-JzLK.mjs} +38 -82
  16. package/dist/_chunks/{index-qrrfKpw1.mjs → index-CNKWb8pn.mjs} +615 -321
  17. package/dist/_chunks/{index-m2ivL3ht.js → index-D-vJE_K8.js} +3 -3
  18. package/dist/_chunks/{index-BkB1x9Sn.js → index-IRSCe8PX.js} +610 -316
  19. package/dist/_chunks/{index-CC073vGB.js → index-d09V61nm.js} +61 -24
  20. package/dist/admin/index.js +1 -2
  21. package/dist/admin/index.mjs +1 -2
  22. package/dist/admin/src/components/CMEditViewAside/NewPathInfo.d.ts +2 -0
  23. package/dist/admin/src/components/CMEditViewAside/OverrideCheckbox.d.ts +7 -0
  24. package/dist/admin/src/components/CMEditViewAside/Panel.d.ts +5 -0
  25. package/dist/admin/src/components/CMEditViewAside/PathInput.d.ts +11 -0
  26. package/dist/admin/src/components/CMEditViewAside/RouteStructure.d.ts +3 -0
  27. package/dist/admin/src/components/CMEditViewAside/UidPathDisplay.d.ts +4 -0
  28. package/dist/admin/src/components/PathInfo.d.ts +2 -3
  29. package/dist/admin/src/components/modals/externalItem/index.d.ts +1 -1
  30. package/dist/admin/src/components/modals/internalItem/ItemDetails.d.ts +13 -0
  31. package/dist/admin/src/components/modals/internalItem/internalItemCreate.d.ts +1 -1
  32. package/dist/admin/src/components/modals/internalItem/internalItemEdit.d.ts +1 -1
  33. package/dist/admin/src/components/modals/useModalSharedLogic.d.ts +1 -1
  34. package/dist/admin/src/components/modals/wrapperItem/index.d.ts +1 -1
  35. package/dist/admin/src/hooks/useApi.d.ts +4 -3
  36. package/dist/admin/src/pages/Navigation/RouteItem.d.ts +1 -15
  37. package/dist/admin/src/pages/Navigation/RouteItemBadge.d.ts +4 -0
  38. package/dist/admin/src/pages/Navigation/RouteItemIcon.d.ts +5 -0
  39. package/dist/admin/src/pages/Navigation/RouteItemMenu.d.ts +10 -0
  40. package/dist/admin/src/pages/Navigation/RouteItemStatus.d.ts +5 -0
  41. package/dist/admin/src/pages/Navigation/SortableRouteItem.d.ts +1 -1
  42. package/dist/admin/src/types/index.d.ts +3 -0
  43. package/dist/admin/src/types/modal.d.ts +56 -0
  44. package/dist/admin/src/types/navigation.d.ts +18 -0
  45. package/dist/admin/src/types/panel.d.ts +41 -0
  46. package/dist/admin/src/types/route.d.ts +1 -1
  47. package/dist/admin/src/utils/buildBreadcrumbString.d.ts +16 -0
  48. package/dist/admin/src/utils/createTempNavItemObject.d.ts +6 -8
  49. package/dist/admin/src/utils/duplicateCheck.d.ts +10 -4
  50. package/dist/admin/src/utils/findParentNavItem.d.ts +13 -0
  51. package/dist/admin/src/utils/index.d.ts +3 -2
  52. package/dist/server/index.js +636 -209
  53. package/dist/server/index.mjs +636 -209
  54. package/dist/server/src/content-types/index.d.ts +18 -0
  55. package/dist/server/src/content-types/route/index.d.ts +18 -0
  56. package/dist/server/src/content-types/route/schema.d.ts +18 -0
  57. package/dist/server/src/controllers/admin.d.ts +3 -2
  58. package/dist/server/src/controllers/index.d.ts +3 -2
  59. package/dist/server/src/index.d.ts +24 -4
  60. package/dist/server/src/migrations/001-canonical-path.d.ts +7 -0
  61. package/dist/server/src/migrations/index.d.ts +3 -0
  62. package/dist/server/src/services/admin.d.ts +3 -2
  63. package/dist/server/src/services/index.d.ts +3 -2
  64. package/dist/server/src/utils/buildCanonicalPath.d.ts +1 -0
  65. package/dist/server/src/utils/buildNavigationPath.d.ts +5 -0
  66. package/dist/server/src/utils/cascadeCanonicalPathUpdates.d.ts +1 -0
  67. package/dist/server/src/utils/getNonInternalRouteIds.d.ts +1 -0
  68. package/dist/server/src/utils/getRouteAncestors.d.ts +1 -0
  69. package/dist/server/src/utils/getRouteDescendants.d.ts +1 -0
  70. package/dist/server/src/utils/index.d.ts +10 -2
  71. package/dist/server/src/utils/navigationItemStructure.d.ts +27 -0
  72. package/dist/server/src/utils/routeHandler.d.ts +4 -2
  73. package/dist/server/src/utils/validateRouteDependencies.d.ts +4 -0
  74. package/dist/types/index.d.ts +0 -1
  75. package/dist/types/navigation.d.ts +13 -12
  76. package/dist/types/route.d.ts +7 -2
  77. package/dist/types/strapi.d.ts +1 -2
  78. package/dist/utils/index.d.ts +1 -2
  79. package/package.json +1 -1
  80. package/dist/_chunks/FullLoader-Cmsf8xS6.js.map +0 -1
  81. package/dist/_chunks/FullLoader-CrPED_dY.mjs.map +0 -1
  82. package/dist/_chunks/SettingTitle-ByAhjihc.js +0 -68
  83. package/dist/_chunks/SettingTitle-ByAhjihc.js.map +0 -1
  84. package/dist/_chunks/SettingTitle-CiMKrd_1.mjs.map +0 -1
  85. package/dist/_chunks/SettingTitle-ZM5Yf2b4.mjs +0 -68
  86. package/dist/_chunks/de-C-uxto84.mjs.map +0 -1
  87. package/dist/_chunks/de-CGXL_3o_.js.map +0 -1
  88. package/dist/_chunks/en-B1CHnIH7.mjs.map +0 -1
  89. package/dist/_chunks/en-DWEd5BXK.js.map +0 -1
  90. package/dist/_chunks/index-BqceJPRl.js +0 -235
  91. package/dist/_chunks/index-BqceJPRl.js.map +0 -1
  92. package/dist/_chunks/index-Bqsd7oPS.mjs.map +0 -1
  93. package/dist/_chunks/index-CK1wisw5.mjs +0 -129
  94. package/dist/_chunks/index-CK1wisw5.mjs.map +0 -1
  95. package/dist/_chunks/index-CQ2raqxe.js +0 -129
  96. package/dist/_chunks/index-CQ2raqxe.js.map +0 -1
  97. package/dist/_chunks/index-Ca9T36AU.mjs +0 -263
  98. package/dist/_chunks/index-Ca9T36AU.mjs.map +0 -1
  99. package/dist/_chunks/index-DDN4T6c7.mjs +0 -4188
  100. package/dist/_chunks/index-DH4Rd7aA.mjs +0 -8311
  101. package/dist/_chunks/index-DH4Rd7aA.mjs.map +0 -1
  102. package/dist/_chunks/index-DU58LJ2w.mjs.map +0 -1
  103. package/dist/_chunks/index-DnE_cDwy.js +0 -8311
  104. package/dist/_chunks/index-DnE_cDwy.js.map +0 -1
  105. package/dist/_chunks/index-DzpXVfQ_.js +0 -263
  106. package/dist/_chunks/index-DzpXVfQ_.js.map +0 -1
  107. package/dist/_chunks/index-R7qsEu2N.js +0 -4205
  108. package/dist/_chunks/index-R7qsEu2N.js.map +0 -1
  109. package/dist/_chunks/index-fbC3magu.mjs +0 -234
  110. package/dist/admin/index.js.map +0 -1
  111. package/dist/admin/index.mjs.map +0 -1
  112. package/dist/admin/src/components/CMEditViewAside/Path.d.ts +0 -5
  113. package/dist/admin/src/utils/countChildren.d.ts +0 -2
  114. package/dist/server/index.js.map +0 -1
  115. package/dist/server/index.mjs.map +0 -1
  116. package/dist/types/modal.d.ts +0 -36
  117. package/dist/utils/getPath.d.ts +0 -1
@@ -1,234 +0,0 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useState, useEffect, useMemo } from "react";
3
- import { g as getTranslation, u as useApi, d as debounce, p as pluginPermissions } from "./index-DDN4T6c7.mjs";
4
- import { Page, Layouts, useNotification } from "@strapi/strapi/admin";
5
- import { Grid, Box, Field, Thead, Tr, Th, Typography, VisuallyHidden, Td, Flex, LinkButton, Table, Tbody, EmptyStateLayout } from "@strapi/design-system";
6
- import "@strapi/icons/symbols";
7
- import { F as FullLoader } from "./FullLoader-CrPED_dY.mjs";
8
- import { useIntl } from "react-intl";
9
- import { useSearchParams } from "react-router-dom";
10
- import { Cross, ChevronDown, Pencil } from "@strapi/icons";
11
- function PageWrapper({ children }) {
12
- const { formatMessage } = useIntl();
13
- return /* @__PURE__ */ jsxs(Page.Main, { children: [
14
- /* @__PURE__ */ jsx(
15
- Layouts.Header,
16
- {
17
- title: formatMessage({
18
- id: getTranslation("paths.page.title"),
19
- defaultMessage: "Paths"
20
- }),
21
- subtitle: formatMessage({
22
- id: getTranslation("paths.page.subtitle"),
23
- defaultMessage: "Overview of all existing paths"
24
- })
25
- }
26
- ),
27
- /* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsx(Fragment, { children }) })
28
- ] });
29
- }
30
- function compareBy(field, direction) {
31
- if (!field) {
32
- return () => 0;
33
- }
34
- if (field === "type") {
35
- return (a, b) => {
36
- return direction === "asc" ? a.type.localeCompare(b.type) : b.type.localeCompare(a.type);
37
- };
38
- }
39
- return (a, b) => {
40
- const aValue = a[field];
41
- const bValue = b[field];
42
- if (typeof aValue === "string" && typeof bValue === "string") {
43
- return direction === "asc" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
44
- }
45
- return 0;
46
- };
47
- }
48
- function SearchInput({
49
- searchQuery,
50
- handleSearchChange
51
- }) {
52
- const { formatMessage } = useIntl();
53
- return /* @__PURE__ */ jsx(Grid.Root, { style: { marginBottom: "16px" }, children: /* @__PURE__ */ jsx(Grid.Item, { col: 4, s: 12, children: /* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(
54
- Field.Input,
55
- {
56
- name: "search",
57
- placeholder: formatMessage({
58
- id: getTranslation("paths.page.searchPlaceholder"),
59
- defaultMessage: "Search paths"
60
- }),
61
- value: searchQuery,
62
- onChange: handleSearchChange,
63
- endAction: searchQuery ? /* @__PURE__ */ jsx(
64
- "button",
65
- {
66
- type: "button",
67
- onClick: () => handleSearchChange({ target: { value: "" } }),
68
- style: { color: "inherit", background: "none", border: "none", cursor: "pointer" },
69
- "aria-label": "Clear search",
70
- children: /* @__PURE__ */ jsx(Cross, {})
71
- }
72
- ) : null
73
- }
74
- ) }) }) }) });
75
- }
76
- function TableHeader({
77
- sortKey,
78
- handleSort
79
- }) {
80
- const { formatMessage } = useIntl();
81
- return /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
82
- /* @__PURE__ */ jsxs(Th, { onClick: () => handleSort("title"), cursor: "pointer", children: [
83
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
84
- id: getTranslation("title"),
85
- defaultMessage: "Title"
86
- }) }),
87
- sortKey === "title" && /* @__PURE__ */ jsx(ChevronDown, {})
88
- ] }),
89
- /* @__PURE__ */ jsxs(Th, { onClick: () => handleSort("path"), cursor: "pointer", children: [
90
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
91
- id: getTranslation("path"),
92
- defaultMessage: "Path"
93
- }) }),
94
- sortKey === "path" && /* @__PURE__ */ jsx(ChevronDown, {})
95
- ] }),
96
- /* @__PURE__ */ jsxs(Th, { onClick: () => handleSort("type"), cursor: "pointer", children: [
97
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
98
- id: getTranslation("paths.page.column.type"),
99
- defaultMessage: "Type"
100
- }) }),
101
- sortKey === "type" && /* @__PURE__ */ jsx(ChevronDown, {})
102
- ] }),
103
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(VisuallyHidden, { children: formatMessage({
104
- id: getTranslation("actions"),
105
- defaultMessage: "Actions"
106
- }) }) })
107
- ] }) });
108
- }
109
- function TableRow({ route }) {
110
- const { formatMessage } = useIntl();
111
- return /* @__PURE__ */ jsxs(Tr, { children: [
112
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.title }) }),
113
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.path }) }),
114
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
115
- id: getTranslation(`path.type.${route.type}`),
116
- defaultMessage: "-"
117
- }) }) }),
118
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { gap: 2, justifyContent: "end", children: route.type === "internal" && /* @__PURE__ */ jsx(
119
- LinkButton,
120
- {
121
- variant: "secondary",
122
- startIcon: /* @__PURE__ */ jsx(Pencil, {}),
123
- href: `/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`,
124
- children: formatMessage({
125
- id: getTranslation("edit"),
126
- defaultMessage: "Edit"
127
- })
128
- }
129
- ) }) })
130
- ] });
131
- }
132
- function PathTable({
133
- routes,
134
- sortKey,
135
- handleSort
136
- }) {
137
- const { formatMessage } = useIntl();
138
- return /* @__PURE__ */ jsxs(Table, { colCount: 4, rowCount: routes.length, children: [
139
- /* @__PURE__ */ jsx(TableHeader, { sortKey, handleSort }),
140
- /* @__PURE__ */ jsx(Tbody, { children: routes.length > 0 ? routes.map((route) => /* @__PURE__ */ jsx(TableRow, { route }, route.id)) : /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 4, children: /* @__PURE__ */ jsx(
141
- EmptyStateLayout,
142
- {
143
- content: formatMessage({
144
- id: getTranslation("paths.page.emptyPaths"),
145
- defaultMessage: "No paths found"
146
- }),
147
- shadow: false
148
- }
149
- ) }) }) })
150
- ] });
151
- }
152
- const Paths = () => {
153
- const { getRoutes } = useApi();
154
- const { formatMessage } = useIntl();
155
- const { toggleNotification } = useNotification();
156
- const [allRoutes, setAllRoutes] = useState([]);
157
- const [routes, setRoutes] = useState([]);
158
- const [loading, setLoading] = useState(true);
159
- const [searchParams, setSearchParams] = useSearchParams();
160
- const initialQuery = searchParams.get("search") || "";
161
- const [searchQuery, setSearchQuery] = useState(initialQuery);
162
- const [sortKey, setSortKey] = useState("title");
163
- const [sortDirection, setSortDirection] = useState("asc");
164
- useEffect(() => {
165
- const query = searchQuery.toLowerCase();
166
- setRoutes(
167
- allRoutes.filter(
168
- (route) => JSON.stringify(route.id).toLowerCase().includes(query) || route.title.toLowerCase().includes(query) || route.path.toLowerCase().includes(query) || route.relatedDocumentId.toLowerCase().includes(query) || route.relatedContentType.toLowerCase().includes(query)
169
- )
170
- );
171
- }, [searchQuery, allRoutes]);
172
- const debouncedSetSearchParams = useMemo(
173
- () => debounce((value) => {
174
- value ? setSearchParams({ search: value }) : setSearchParams({});
175
- }, 300),
176
- [setSearchParams]
177
- );
178
- const handleSearchChange = (e) => {
179
- const value = e.target.value;
180
- setSearchQuery(value);
181
- debouncedSetSearchParams(value);
182
- };
183
- useEffect(() => {
184
- async function fetchRoutes() {
185
- try {
186
- const data = await getRoutes();
187
- setAllRoutes(data);
188
- setRoutes(data);
189
- } catch (err) {
190
- console.error("Failed to fetch paths:", err);
191
- toggleNotification({
192
- type: "danger",
193
- message: formatMessage({
194
- id: getTranslation("notification.paths.fetchFailed"),
195
- defaultMessage: "Failed to fetch paths"
196
- })
197
- });
198
- } finally {
199
- setLoading(false);
200
- }
201
- }
202
- fetchRoutes();
203
- }, []);
204
- const handleSort = (key) => {
205
- setSortDirection((prev) => prev === "asc" ? "desc" : "asc");
206
- setSortKey(key);
207
- };
208
- const sortedRoutes = useMemo(() => {
209
- return sortKey ? [...routes].sort(compareBy(sortKey, sortDirection)) : routes;
210
- }, [routes, sortKey, sortDirection]);
211
- if (loading) {
212
- return /* @__PURE__ */ jsx(PageWrapper, { children: /* @__PURE__ */ jsx(FullLoader, {}) });
213
- }
214
- return /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions["page.routes"], children: /* @__PURE__ */ jsxs(PageWrapper, { children: [
215
- /* @__PURE__ */ jsx(
216
- SearchInput,
217
- {
218
- handleSearchChange,
219
- searchQuery
220
- }
221
- ),
222
- /* @__PURE__ */ jsx(
223
- PathTable,
224
- {
225
- routes: sortedRoutes,
226
- sortKey,
227
- handleSort
228
- }
229
- )
230
- ] }) });
231
- };
232
- export {
233
- Paths as default
234
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,5 +0,0 @@
1
- import { ConfigContentType } from '../../../../types';
2
- declare const Path: ({ config }: {
3
- config: ConfigContentType;
4
- }) => import("react/jsx-runtime").JSX.Element;
5
- export default Path;
@@ -1,2 +0,0 @@
1
- import { NestedNavItem } from '../../../types';
2
- export default function countChildren(item: NestedNavItem): number;