@lumal/core 0.0.1-beta

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 (271) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -0
  3. package/dist/LumalThemeSettingsPanel-BFkZzwEW.js +685 -0
  4. package/dist/LumalThemeSettingsPanel-C6aPhgUX.cjs +1 -0
  5. package/dist/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
  6. package/dist/_plugin-vue_export-helper-BTmtiIyf.cjs +1 -0
  7. package/dist/auth.cjs +1 -0
  8. package/dist/auth.js +127 -0
  9. package/dist/components-DJiHYQQB.cjs +2 -0
  10. package/dist/components-DYmKh-eF.js +2206 -0
  11. package/dist/components.cjs +1 -0
  12. package/dist/components.js +3 -0
  13. package/dist/composables-C4twj5Ov.cjs +1 -0
  14. package/dist/composables-C9EuCUjj.js +130 -0
  15. package/dist/composables.cjs +1 -0
  16. package/dist/composables.js +148 -0
  17. package/dist/core.css +2 -0
  18. package/dist/dictionary-B7tsaVqB.js +19 -0
  19. package/dist/dictionary-ClEWtQCU.cjs +1 -0
  20. package/dist/dictionary.cjs +1 -0
  21. package/dist/dictionary.js +3 -0
  22. package/dist/directive-D-fB5qbY.js +16 -0
  23. package/dist/directive-DSVr7QvO.cjs +1 -0
  24. package/dist/directives.cjs +1 -0
  25. package/dist/directives.js +11 -0
  26. package/dist/index.cjs +1 -0
  27. package/dist/index.js +88 -0
  28. package/dist/layout-C8H9wuQa.js +2075 -0
  29. package/dist/layout-ZnyG9X3N.cjs +1 -0
  30. package/dist/layout.cjs +1 -0
  31. package/dist/layout.js +2 -0
  32. package/dist/permission-6sXtjGMS.cjs +1 -0
  33. package/dist/permission-CCkqvnWg.js +104 -0
  34. package/dist/permission.cjs +1 -0
  35. package/dist/permission.js +3 -0
  36. package/dist/request.cjs +1 -0
  37. package/dist/request.js +277 -0
  38. package/dist/router.cjs +1 -0
  39. package/dist/router.js +510 -0
  40. package/dist/src/app/createLumalAdmin.d.ts +4 -0
  41. package/dist/src/app/createLumalAdmin.d.ts.map +1 -0
  42. package/dist/src/app/default-components.d.ts +4 -0
  43. package/dist/src/app/default-components.d.ts.map +1 -0
  44. package/dist/src/app/index.d.ts +3 -0
  45. package/dist/src/app/index.d.ts.map +1 -0
  46. package/dist/src/app/types.d.ts +41 -0
  47. package/dist/src/app/types.d.ts.map +1 -0
  48. package/dist/src/auth/adapter.d.ts +3 -0
  49. package/dist/src/auth/adapter.d.ts.map +1 -0
  50. package/dist/src/auth/createAuthSession.d.ts +8 -0
  51. package/dist/src/auth/createAuthSession.d.ts.map +1 -0
  52. package/dist/src/auth/index.d.ts +8 -0
  53. package/dist/src/auth/index.d.ts.map +1 -0
  54. package/dist/src/auth/redirect.d.ts +8 -0
  55. package/dist/src/auth/redirect.d.ts.map +1 -0
  56. package/dist/src/auth/session-expired.d.ts +5 -0
  57. package/dist/src/auth/session-expired.d.ts.map +1 -0
  58. package/dist/src/auth/session.d.ts +10 -0
  59. package/dist/src/auth/session.d.ts.map +1 -0
  60. package/dist/src/auth/storage.d.ts +7 -0
  61. package/dist/src/auth/storage.d.ts.map +1 -0
  62. package/dist/src/auth/types.d.ts +68 -0
  63. package/dist/src/auth/types.d.ts.map +1 -0
  64. package/dist/src/components/crud-table/LumalCrudEditor.vue.d.ts +41 -0
  65. package/dist/src/components/crud-table/LumalCrudEditor.vue.d.ts.map +1 -0
  66. package/dist/src/components/crud-table/LumalCrudTable.vue.d.ts +151 -0
  67. package/dist/src/components/crud-table/LumalCrudTable.vue.d.ts.map +1 -0
  68. package/dist/src/components/crud-table/index.d.ts +4 -0
  69. package/dist/src/components/crud-table/index.d.ts.map +1 -0
  70. package/dist/src/components/crud-table/schema.d.ts +4 -0
  71. package/dist/src/components/crud-table/schema.d.ts.map +1 -0
  72. package/dist/src/components/crud-table/types.d.ts +165 -0
  73. package/dist/src/components/crud-table/types.d.ts.map +1 -0
  74. package/dist/src/components/crud-table/useCrudData.d.ts +20 -0
  75. package/dist/src/components/crud-table/useCrudData.d.ts.map +1 -0
  76. package/dist/src/components/crud-table/useCrudDialog.d.ts +19 -0
  77. package/dist/src/components/crud-table/useCrudDialog.d.ts.map +1 -0
  78. package/dist/src/components/crud-table/useCrudQuery.d.ts +18 -0
  79. package/dist/src/components/crud-table/useCrudQuery.d.ts.map +1 -0
  80. package/dist/src/components/crud-table/useCrudSelection.d.ts +9 -0
  81. package/dist/src/components/crud-table/useCrudSelection.d.ts.map +1 -0
  82. package/dist/src/components/info-table/LumalInfoTable.vue.d.ts +12 -0
  83. package/dist/src/components/info-table/LumalInfoTable.vue.d.ts.map +1 -0
  84. package/dist/src/components/info-table/index.d.ts +3 -0
  85. package/dist/src/components/info-table/index.d.ts.map +1 -0
  86. package/dist/src/components/info-table/types.d.ts +15 -0
  87. package/dist/src/components/info-table/types.d.ts.map +1 -0
  88. package/dist/src/components/page/LumalPage.vue.d.ts +36 -0
  89. package/dist/src/components/page/LumalPage.vue.d.ts.map +1 -0
  90. package/dist/src/components/page/index.d.ts +2 -0
  91. package/dist/src/components/page/index.d.ts.map +1 -0
  92. package/dist/src/components/page-layout/LumalPageLayout.vue.d.ts +38 -0
  93. package/dist/src/components/page-layout/LumalPageLayout.vue.d.ts.map +1 -0
  94. package/dist/src/components/page-layout/index.d.ts +3 -0
  95. package/dist/src/components/page-layout/index.d.ts.map +1 -0
  96. package/dist/src/components/page-layout/types.d.ts +9 -0
  97. package/dist/src/components/page-layout/types.d.ts.map +1 -0
  98. package/dist/src/components/pagination/LumalPagination.vue.d.ts +31 -0
  99. package/dist/src/components/pagination/LumalPagination.vue.d.ts.map +1 -0
  100. package/dist/src/components/pagination/index.d.ts +3 -0
  101. package/dist/src/components/pagination/index.d.ts.map +1 -0
  102. package/dist/src/components/pagination/types.d.ts +5 -0
  103. package/dist/src/components/pagination/types.d.ts.map +1 -0
  104. package/dist/src/components/schema-form/LumalSchemaForm.vue.d.ts +78 -0
  105. package/dist/src/components/schema-form/LumalSchemaForm.vue.d.ts.map +1 -0
  106. package/dist/src/components/schema-form/index.d.ts +4 -0
  107. package/dist/src/components/schema-form/index.d.ts.map +1 -0
  108. package/dist/src/components/schema-form/normalize.d.ts +11 -0
  109. package/dist/src/components/schema-form/normalize.d.ts.map +1 -0
  110. package/dist/src/components/schema-form/types.d.ts +103 -0
  111. package/dist/src/components/schema-form/types.d.ts.map +1 -0
  112. package/dist/src/components/schema-form/types.type-test.d.ts +2 -0
  113. package/dist/src/components/schema-form/types.type-test.d.ts.map +1 -0
  114. package/dist/src/components/schema-table/LumalSchemaTable.vue.d.ts +108 -0
  115. package/dist/src/components/schema-table/LumalSchemaTable.vue.d.ts.map +1 -0
  116. package/dist/src/components/schema-table/LumalSchemaTableCell.vue.d.ts +8 -0
  117. package/dist/src/components/schema-table/LumalSchemaTableCell.vue.d.ts.map +1 -0
  118. package/dist/src/components/schema-table/cell.d.ts +13 -0
  119. package/dist/src/components/schema-table/cell.d.ts.map +1 -0
  120. package/dist/src/components/schema-table/index.d.ts +6 -0
  121. package/dist/src/components/schema-table/index.d.ts.map +1 -0
  122. package/dist/src/components/schema-table/normalize.d.ts +8 -0
  123. package/dist/src/components/schema-table/normalize.d.ts.map +1 -0
  124. package/dist/src/components/schema-table/types.d.ts +66 -0
  125. package/dist/src/components/schema-table/types.d.ts.map +1 -0
  126. package/dist/src/components/schema-table/types.type-test.d.ts +2 -0
  127. package/dist/src/components/schema-table/types.type-test.d.ts.map +1 -0
  128. package/dist/src/composables/index.d.ts +11 -0
  129. package/dist/src/composables/index.d.ts.map +1 -0
  130. package/dist/src/composables/useConfirmAction.d.ts +21 -0
  131. package/dist/src/composables/useConfirmAction.d.ts.map +1 -0
  132. package/dist/src/composables/useFullscreen.d.ts +14 -0
  133. package/dist/src/composables/useFullscreen.d.ts.map +1 -0
  134. package/dist/src/composables/usePagination.d.ts +36 -0
  135. package/dist/src/composables/usePagination.d.ts.map +1 -0
  136. package/dist/src/composables/usePersistentState.d.ts +9 -0
  137. package/dist/src/composables/usePersistentState.d.ts.map +1 -0
  138. package/dist/src/composables/useSelection.d.ts +20 -0
  139. package/dist/src/composables/useSelection.d.ts.map +1 -0
  140. package/dist/src/dictionary/composables.d.ts +15 -0
  141. package/dist/src/dictionary/composables.d.ts.map +1 -0
  142. package/dist/src/dictionary/context.d.ts +10 -0
  143. package/dist/src/dictionary/context.d.ts.map +1 -0
  144. package/dist/src/dictionary/fetcher.d.ts +4 -0
  145. package/dist/src/dictionary/fetcher.d.ts.map +1 -0
  146. package/dist/src/dictionary/index.d.ts +8 -0
  147. package/dist/src/dictionary/index.d.ts.map +1 -0
  148. package/dist/src/dictionary/normalize.d.ts +5 -0
  149. package/dist/src/dictionary/normalize.d.ts.map +1 -0
  150. package/dist/src/dictionary/store.d.ts +4 -0
  151. package/dist/src/dictionary/store.d.ts.map +1 -0
  152. package/dist/src/dictionary/types.d.ts +53 -0
  153. package/dist/src/dictionary/types.d.ts.map +1 -0
  154. package/dist/src/directives/index.d.ts +16 -0
  155. package/dist/src/directives/index.d.ts.map +1 -0
  156. package/dist/src/exports/components.d.ts +16 -0
  157. package/dist/src/exports/components.d.ts.map +1 -0
  158. package/dist/src/index.d.ts +6 -0
  159. package/dist/src/index.d.ts.map +1 -0
  160. package/dist/src/layout/LumalBreadcrumb.vue.d.ts +28 -0
  161. package/dist/src/layout/LumalBreadcrumb.vue.d.ts.map +1 -0
  162. package/dist/src/layout/LumalContent.vue.d.ts +18 -0
  163. package/dist/src/layout/LumalContent.vue.d.ts.map +1 -0
  164. package/dist/src/layout/LumalGlobalSearch.vue.d.ts +25 -0
  165. package/dist/src/layout/LumalGlobalSearch.vue.d.ts.map +1 -0
  166. package/dist/src/layout/LumalHeader.vue.d.ts +43 -0
  167. package/dist/src/layout/LumalHeader.vue.d.ts.map +1 -0
  168. package/dist/src/layout/LumalLayout.vue.d.ts +98 -0
  169. package/dist/src/layout/LumalLayout.vue.d.ts.map +1 -0
  170. package/dist/src/layout/LumalMenuBadge.vue.d.ts +16 -0
  171. package/dist/src/layout/LumalMenuBadge.vue.d.ts.map +1 -0
  172. package/dist/src/layout/LumalRouterView.vue.d.ts +24 -0
  173. package/dist/src/layout/LumalRouterView.vue.d.ts.map +1 -0
  174. package/dist/src/layout/LumalSidebar.vue.d.ts +29 -0
  175. package/dist/src/layout/LumalSidebar.vue.d.ts.map +1 -0
  176. package/dist/src/layout/LumalSidebarMenuItem.vue.d.ts +16 -0
  177. package/dist/src/layout/LumalSidebarMenuItem.vue.d.ts.map +1 -0
  178. package/dist/src/layout/LumalTabs.vue.d.ts +76 -0
  179. package/dist/src/layout/LumalTabs.vue.d.ts.map +1 -0
  180. package/dist/src/layout/LumalTopNav.vue.d.ts +27 -0
  181. package/dist/src/layout/LumalTopNav.vue.d.ts.map +1 -0
  182. package/dist/src/layout/LumalTopNavMenuItem.vue.d.ts +15 -0
  183. package/dist/src/layout/LumalTopNavMenuItem.vue.d.ts.map +1 -0
  184. package/dist/src/layout/index.d.ts +18 -0
  185. package/dist/src/layout/index.d.ts.map +1 -0
  186. package/dist/src/layout/state/menu-layout.d.ts +35 -0
  187. package/dist/src/layout/state/menu-layout.d.ts.map +1 -0
  188. package/dist/src/layout/state/tab-storage.d.ts +51 -0
  189. package/dist/src/layout/state/tab-storage.d.ts.map +1 -0
  190. package/dist/src/layout/state/tab-strategy.d.ts +73 -0
  191. package/dist/src/layout/state/tab-strategy.d.ts.map +1 -0
  192. package/dist/src/layout/types.d.ts +29 -0
  193. package/dist/src/layout/types.d.ts.map +1 -0
  194. package/dist/src/permission/LumalAccessControl.vue.d.ts +26 -0
  195. package/dist/src/permission/LumalAccessControl.vue.d.ts.map +1 -0
  196. package/dist/src/permission/context.d.ts +6 -0
  197. package/dist/src/permission/context.d.ts.map +1 -0
  198. package/dist/src/permission/directive.d.ts +3 -0
  199. package/dist/src/permission/directive.d.ts.map +1 -0
  200. package/dist/src/permission/guard.d.ts +4 -0
  201. package/dist/src/permission/guard.d.ts.map +1 -0
  202. package/dist/src/permission/helpers.d.ts +4 -0
  203. package/dist/src/permission/helpers.d.ts.map +1 -0
  204. package/dist/src/permission/index.d.ts +8 -0
  205. package/dist/src/permission/index.d.ts.map +1 -0
  206. package/dist/src/permission/store.d.ts +4 -0
  207. package/dist/src/permission/store.d.ts.map +1 -0
  208. package/dist/src/permission/types.d.ts +67 -0
  209. package/dist/src/permission/types.d.ts.map +1 -0
  210. package/dist/src/request/cache.d.ts +8 -0
  211. package/dist/src/request/cache.d.ts.map +1 -0
  212. package/dist/src/request/client.d.ts +4 -0
  213. package/dist/src/request/client.d.ts.map +1 -0
  214. package/dist/src/request/error.d.ts +19 -0
  215. package/dist/src/request/error.d.ts.map +1 -0
  216. package/dist/src/request/index.d.ts +8 -0
  217. package/dist/src/request/index.d.ts.map +1 -0
  218. package/dist/src/request/standard.d.ts +61 -0
  219. package/dist/src/request/standard.d.ts.map +1 -0
  220. package/dist/src/request/types.d.ts +102 -0
  221. package/dist/src/request/types.d.ts.map +1 -0
  222. package/dist/src/router/index.d.ts +36 -0
  223. package/dist/src/router/index.d.ts.map +1 -0
  224. package/dist/src/router/types.d.ts +231 -0
  225. package/dist/src/router/types.d.ts.map +1 -0
  226. package/dist/src/theme/LumalThemeSettingsPanel.vue.d.ts +33 -0
  227. package/dist/src/theme/LumalThemeSettingsPanel.vue.d.ts.map +1 -0
  228. package/dist/src/theme/dom.d.ts +6 -0
  229. package/dist/src/theme/dom.d.ts.map +1 -0
  230. package/dist/src/theme/index.d.ts +11 -0
  231. package/dist/src/theme/index.d.ts.map +1 -0
  232. package/dist/src/theme/preferences-store.d.ts +4 -0
  233. package/dist/src/theme/preferences-store.d.ts.map +1 -0
  234. package/dist/src/theme/preferences.d.ts +18 -0
  235. package/dist/src/theme/preferences.d.ts.map +1 -0
  236. package/dist/src/theme/store.d.ts +3 -0
  237. package/dist/src/theme/store.d.ts.map +1 -0
  238. package/dist/src/theme/theme-color-presets.d.ts +13 -0
  239. package/dist/src/theme/theme-color-presets.d.ts.map +1 -0
  240. package/dist/src/theme/tokens.d.ts +5 -0
  241. package/dist/src/theme/tokens.d.ts.map +1 -0
  242. package/dist/src/theme/types.d.ts +103 -0
  243. package/dist/src/theme/types.d.ts.map +1 -0
  244. package/dist/src/utils/clone.d.ts +12 -0
  245. package/dist/src/utils/clone.d.ts.map +1 -0
  246. package/dist/src/utils/color.d.ts +6 -0
  247. package/dist/src/utils/color.d.ts.map +1 -0
  248. package/dist/src/utils/display.d.ts +10 -0
  249. package/dist/src/utils/display.d.ts.map +1 -0
  250. package/dist/src/utils/download.d.ts +10 -0
  251. package/dist/src/utils/download.d.ts.map +1 -0
  252. package/dist/src/utils/index.d.ts +12 -0
  253. package/dist/src/utils/index.d.ts.map +1 -0
  254. package/dist/src/utils/object.d.ts +6 -0
  255. package/dist/src/utils/object.d.ts.map +1 -0
  256. package/dist/src/utils/path.d.ts +6 -0
  257. package/dist/src/utils/path.d.ts.map +1 -0
  258. package/dist/src/utils/query.d.ts +9 -0
  259. package/dist/src/utils/query.d.ts.map +1 -0
  260. package/dist/src/utils/storage.d.ts +7 -0
  261. package/dist/src/utils/storage.d.ts.map +1 -0
  262. package/dist/src/utils/types.d.ts +13 -0
  263. package/dist/src/utils/types.d.ts.map +1 -0
  264. package/dist/src/utils/with-install.d.ts +11 -0
  265. package/dist/src/utils/with-install.d.ts.map +1 -0
  266. package/dist/theme.cjs +1 -0
  267. package/dist/theme.js +187 -0
  268. package/dist/utils.cjs +1 -0
  269. package/dist/utils.js +130 -0
  270. package/package.json +124 -0
  271. package/theme-chalk/index.scss +70 -0
package/dist/router.js ADDED
@@ -0,0 +1,510 @@
1
+ //#region src/router/index.ts
2
+ function e(e, n = {}) {
3
+ let { fieldNames: i } = n;
4
+ return o((i ? e.map((e) => t(e, i)) : e).map((e) => r(e)));
5
+ }
6
+ function t(e, r) {
7
+ let i = (t, n) => {
8
+ let i = r[t];
9
+ return i && i in e ? e[i] : n;
10
+ }, a = e.meta ?? {}, o = { ...a };
11
+ n(o, "activeMenu", i("activeMenu", a.activeMenu)), n(o, "badge", i("badge", a.badge)), n(o, "badgeType", i("badgeType", a.badgeType)), n(o, "badgeTone", i("badgeTone", a.badgeTone)), n(o, "title", i("title", a.title)), n(o, "icon", i("icon", a.icon)), n(o, "order", i("order", a.order)), n(o, "authority", i("authority", a.authority)), n(o, "roles", i("roles", a.roles)), n(o, "hideInMenu", i("hideInMenu", a.hideInMenu)), n(o, "hideInBreadcrumb", i("hideInBreadcrumb", a.hideInBreadcrumb)), n(o, "keepAlive", i("keepAlive", a.keepAlive));
12
+ let s = {
13
+ meta: o,
14
+ path: i("path", e.path) ?? ""
15
+ }, c = i("name", e.name);
16
+ c !== void 0 && (s.name = c);
17
+ let l = i("component", e.component);
18
+ l !== void 0 && (s.component = l);
19
+ let u = i("redirect", e.redirect);
20
+ u !== void 0 && (s.redirect = u);
21
+ let d = i("externalLink", e.externalLink);
22
+ d !== void 0 && (s.externalLink = d);
23
+ let f = i("children", e.children);
24
+ return Array.isArray(f) && (s.children = f.map((e) => t(e, r))), s;
25
+ }
26
+ function n(e, t, n) {
27
+ n !== void 0 && (e[t] = n);
28
+ }
29
+ function r(e) {
30
+ let t = e.meta ?? {}, n = i(e, t), o = e.name ?? x(e.path), s = typeof e.component == "string" && e.component.trim() === "" ? void 0 : e.component, c = e.externalLink ?? (typeof t.externalLink == "string" ? t.externalLink : void 0), l = t.badgeType === "dot" || t.badgeType === "text" ? t.badgeType : void 0, u = [
31
+ "primary",
32
+ "success",
33
+ "warning",
34
+ "danger",
35
+ "info"
36
+ ].includes(String(t.badgeTone)) ? t.badgeTone : void 0;
37
+ return {
38
+ activeMenu: typeof t.activeMenu == "string" ? t.activeMenu : void 0,
39
+ badge: typeof t.badge == "string" || typeof t.badge == "number" ? t.badge : void 0,
40
+ badgeTone: u,
41
+ badgeType: l,
42
+ children: e.children?.map((e) => r(e)),
43
+ component: s,
44
+ externalLink: c,
45
+ hideInBreadcrumb: t.hideInBreadcrumb === !0,
46
+ icon: typeof t.icon == "string" ? t.icon : void 0,
47
+ id: o || e.path,
48
+ keepAlive: t.keepAlive === !0,
49
+ meta: t,
50
+ name: o,
51
+ order: typeof t.order == "number" ? t.order : void 0,
52
+ path: e.path,
53
+ permissions: a(t.authority),
54
+ redirect: e.redirect,
55
+ roles: a(t.roles),
56
+ title: n,
57
+ visible: t.hideInMenu !== !0
58
+ };
59
+ }
60
+ function i(e, t) {
61
+ return typeof t.title == "string" && t.title ? t.title : e.name ?? e.path;
62
+ }
63
+ function a(e) {
64
+ return Array.isArray(e) ? e.filter(Boolean) : e ? [e] : [];
65
+ }
66
+ function o(e) {
67
+ let t = s(e), n = new Map(t.map((e) => [e.id, e])), r = [];
68
+ for (let e of t) {
69
+ let t = e.parentId ? n.get(e.parentId) : void 0;
70
+ if (t) {
71
+ t.children.push(e);
72
+ continue;
73
+ }
74
+ r.push(e);
75
+ }
76
+ return l(r).map((e) => c(e));
77
+ }
78
+ function s(e) {
79
+ let t = [], n = 0;
80
+ function r(e, i) {
81
+ for (let a of e) {
82
+ let e = {
83
+ ...a,
84
+ children: [],
85
+ parentId: a.parentId ?? i,
86
+ sourceIndex: n
87
+ };
88
+ n += 1, t.push(e), a.children?.length && r(a.children, a.id);
89
+ }
90
+ }
91
+ return r(e), t;
92
+ }
93
+ function c(e, t = "") {
94
+ let n = y(e.path, t), r = l(e.children).map((e) => c(e, n)), i = e.authority ?? e.permissions ?? [];
95
+ return {
96
+ activeMenu: e.activeMenu,
97
+ authority: i,
98
+ badge: e.badge,
99
+ badgeTone: e.badgeTone,
100
+ badgeType: e.badgeType,
101
+ children: r,
102
+ component: e.component,
103
+ externalLink: e.externalLink,
104
+ hideInBreadcrumb: e.hideInBreadcrumb === !0,
105
+ icon: e.icon,
106
+ id: e.id,
107
+ meta: e.meta ?? {},
108
+ name: e.name ?? x(e.id),
109
+ order: e.order,
110
+ path: n,
111
+ redirect: e.redirect,
112
+ permissions: e.permissions ?? [],
113
+ roles: e.roles ?? [],
114
+ keepAlive: e.keepAlive,
115
+ title: e.title,
116
+ visible: e.visible !== !1
117
+ };
118
+ }
119
+ function l(e) {
120
+ return [...e].sort((e, t) => {
121
+ let n = (e.order ?? 2 ** 53 - 1) - (t.order ?? 2 ** 53 - 1);
122
+ return n === 0 ? e.sourceIndex - t.sourceIndex : n;
123
+ });
124
+ }
125
+ function u(e, t = {}) {
126
+ return e.map((e) => d(e, t));
127
+ }
128
+ function d(e, t) {
129
+ let n = {
130
+ meta: {
131
+ ...e.meta,
132
+ permissions: e.permissions,
133
+ roles: e.roles,
134
+ title: e.title
135
+ },
136
+ name: e.name,
137
+ path: e.path
138
+ };
139
+ if ((e.authority?.length ?? 0) > 0 && (n.meta.authority = e.authority), e.activeMenu && (n.meta.activeMenu = e.activeMenu), e.badge !== void 0 && (n.meta.badge = e.badge), e.badgeType && (n.meta.badgeType = e.badgeType), e.badgeTone && (n.meta.badgeTone = e.badgeTone), e.hideInBreadcrumb && (n.meta.hideInBreadcrumb = !0), e.externalLink && (n.meta.externalLink = e.externalLink), e.redirect && (n.redirect = e.redirect), e.component) {
140
+ let r = typeof e.component == "string" ? t.componentResolver?.(e.component) : e.component;
141
+ r && (n.component = r);
142
+ }
143
+ return e.children.length && (n.children = u(e.children, t)), n;
144
+ }
145
+ function f(e, t = {}) {
146
+ return e.filter((e) => e.visible).flatMap((e) => {
147
+ let n = f(e.children, t);
148
+ return !h(e, t) || e.children.length > 0 && n.length === 0 ? [] : {
149
+ ...e.badge === void 0 ? {} : { badge: e.badge },
150
+ ...e.badgeTone ? { badgeTone: e.badgeTone } : {},
151
+ ...e.badgeType ? { badgeType: e.badgeType } : {},
152
+ children: n,
153
+ ...e.externalLink ? {
154
+ externalLink: e.externalLink,
155
+ externalTarget: e.meta.externalTarget === "_self" ? "_self" : "_blank"
156
+ } : {},
157
+ icon: e.icon,
158
+ path: e.path,
159
+ ...e.redirect ? { redirect: e.redirect } : {},
160
+ title: e.title
161
+ };
162
+ });
163
+ }
164
+ function p(e, t = {}) {
165
+ let n = f(e, t), r = new Set(e.filter((e) => e.meta?.topMenu === !0).map((e) => e.path)), i = n.filter((e) => r.has(e.path));
166
+ return i.length > 0 ? i : n;
167
+ }
168
+ function m(e, t = {}) {
169
+ for (let n of e) {
170
+ if (!n.visible || !h(n, t)) continue;
171
+ let e = m(n.children, t);
172
+ if (e) return e;
173
+ if (n.children.length === 0) return n;
174
+ }
175
+ }
176
+ function h(e, t) {
177
+ let n = e.permissions.length === 0 || t.hasPermission?.(e.permissions) !== !1, r = e.roles.length === 0 || t.hasRole?.(e.roles) !== !1;
178
+ return n && r;
179
+ }
180
+ function g(e) {
181
+ let t = [], n = [];
182
+ function r(e) {
183
+ return [e.name, ...e.children?.flatMap(r) ?? []];
184
+ }
185
+ function i(i) {
186
+ for (let a of i) {
187
+ if (a.name && e.hasRoute(a.name)) continue;
188
+ let i = e.addRoute(a), o = a.name;
189
+ n.push(typeof i == "function" ? i : () => {
190
+ o && e.hasRoute(o) && e.removeRoute(o);
191
+ });
192
+ for (let e of r(a)) t.includes(e) || t.push(e);
193
+ }
194
+ }
195
+ function a() {
196
+ for (; n.length;) n.pop()?.();
197
+ t.length = 0;
198
+ }
199
+ return {
200
+ register: i,
201
+ reset: a,
202
+ get names() {
203
+ return [...t];
204
+ }
205
+ };
206
+ }
207
+ function _(e) {
208
+ let { fallback: t, modules: n, viewsPrefix: r = "../views" } = e, i = /* @__PURE__ */ new Map(), a = r.replace(/\/+$/, "");
209
+ return (e) => {
210
+ let r = v(e), o = [`${a}/${r}.vue`, `${a}/${r}/index.vue`];
211
+ for (let e of o) {
212
+ let t = n[e];
213
+ if (t) return i.get(e) || (i.set(e, t), t);
214
+ }
215
+ return t;
216
+ };
217
+ }
218
+ function v(e) {
219
+ return e.replace(/\\/g, "/").replace(/^\.?\//, "").replace(/\/+/g, "/").replace(/\.vue$/i, "").replace(/^\/+|\/+$/g, "");
220
+ }
221
+ function y(e, t = "") {
222
+ return e.startsWith("/") ? b(e) : b(`${t === "/" ? "" : t}/${e}`);
223
+ }
224
+ function b(e) {
225
+ let t = e.replace(/\/+/g, "/");
226
+ return t.startsWith("/") ? t : `/${t}`;
227
+ }
228
+ function x(e) {
229
+ return e.split(/[^a-z0-9]+/i).filter(Boolean).map((e) => `${e.charAt(0).toUpperCase()}${e.slice(1)}`).join("");
230
+ }
231
+ var S = class extends Error {
232
+ firstSource;
233
+ kind;
234
+ secondSource;
235
+ value;
236
+ constructor(e, t, n, r) {
237
+ super(`菜单路由 ${e} 冲突:${t}(${n} / ${r})`), this.name = "MenuRouteConflictError", this.kind = e, this.value = t, this.firstSource = n, this.secondSource = r;
238
+ }
239
+ };
240
+ function C(e, t, n) {
241
+ try {
242
+ e.onError?.(t, n);
243
+ } catch {}
244
+ }
245
+ function w(e, t, n) {
246
+ return /* @__PURE__ */ Error(`${n}:${e.name} (${e.path}, ${t})`);
247
+ }
248
+ function T(e, t, n) {
249
+ return async () => {
250
+ try {
251
+ return await e();
252
+ } catch (r) {
253
+ return E(r, t, n, e !== t.fallbackComponent);
254
+ }
255
+ };
256
+ }
257
+ async function E(e, t, n, r) {
258
+ if (C(t, e, {
259
+ ...n,
260
+ phase: "load-component"
261
+ }), !t.fallbackComponent || !r) throw e;
262
+ try {
263
+ return await t.fallbackComponent();
264
+ } catch (e) {
265
+ throw C(t, e, {
266
+ ...n,
267
+ component: void 0,
268
+ phase: "load-component"
269
+ }), e;
270
+ }
271
+ }
272
+ function D(e) {
273
+ return typeof e == "object" && !!e && "then" in e;
274
+ }
275
+ function O(e, t, n) {
276
+ return !t.fallbackComponent && !t.onError ? e : Object.assign((...r) => {
277
+ try {
278
+ let i = e(...r);
279
+ return D(i) ? Promise.resolve(i).catch((e) => E(e, t, n, !0)) : i;
280
+ } catch (e) {
281
+ return E(e, t, n, !0);
282
+ }
283
+ }, e);
284
+ }
285
+ function k(e, t, n) {
286
+ let r = /* @__PURE__ */ new Map();
287
+ function i(e) {
288
+ let a = e.component, o = {
289
+ component: typeof a == "string" ? a : void 0,
290
+ phase: "resolve-component",
291
+ routeName: e.name,
292
+ routePath: e.path,
293
+ source: t
294
+ };
295
+ if (t === "remote" && a !== void 0 && typeof a != "string") {
296
+ let r = w(e, t, "远程菜单组件必须是字符串");
297
+ throw C(n, r, o), r;
298
+ }
299
+ if (a !== void 0 && typeof a != "string" && typeof a != "function" && typeof a != "object") {
300
+ let r = w(e, t, "静态菜单组件类型无效");
301
+ throw C(n, r, o), r;
302
+ }
303
+ if (typeof a == "string" && !r.has(a)) {
304
+ let i;
305
+ try {
306
+ i = n.componentResolver?.(a);
307
+ } catch (e) {
308
+ throw C(n, e, o), e;
309
+ }
310
+ if (i) r.set(a, typeof i == "function" ? T(i, n, o) : i);
311
+ else {
312
+ let i = w(e, t, `无法解析组件 "${a}"`);
313
+ if (C(n, i, o), !n.fallbackComponent) throw i;
314
+ r.set(a, T(n.fallbackComponent, n, o));
315
+ }
316
+ }
317
+ let s = !!(e.redirect || e.externalLink || e.children.length > 0);
318
+ if (a == null && !s) {
319
+ let r = w(e, t, "叶子菜单缺少路由组件");
320
+ throw C(n, r, o), r;
321
+ }
322
+ e.children.forEach(i);
323
+ }
324
+ return e.forEach(i), r;
325
+ }
326
+ function A(e, t, n) {
327
+ let r = k(e, t, n), i = u(e, { componentResolver: (e) => r.get(e) });
328
+ return t === "static" && j(e, i, n), {
329
+ menus: e,
330
+ routes: i
331
+ };
332
+ }
333
+ function j(e, t, n) {
334
+ e.forEach((e, r) => {
335
+ let i = t[r];
336
+ i && (typeof e.component == "function" && (i.component = O(e.component, n, {
337
+ phase: "load-component",
338
+ routeName: e.name,
339
+ routePath: e.path,
340
+ source: "static"
341
+ })), e.children.length && i.children?.length && j(e.children, i.children, n));
342
+ });
343
+ }
344
+ function M(e, t) {
345
+ return e.map((e, t) => ({
346
+ index: t,
347
+ item: e
348
+ })).sort((e, n) => {
349
+ let r = (typeof t(e.item) == "number" ? t(e.item) : 2 ** 53 - 1) - (typeof t(n.item) == "number" ? t(n.item) : 2 ** 53 - 1);
350
+ return r === 0 ? e.index - n.index : r;
351
+ }).map((e) => e.item);
352
+ }
353
+ function N(e, t) {
354
+ return {
355
+ menus: M([...e.menus, ...t.menus], (e) => e.order),
356
+ routes: M([...e.routes, ...t.routes], (e) => e.meta.order)
357
+ };
358
+ }
359
+ function P(e, t) {
360
+ return e.flatMap((e) => [{
361
+ node: e,
362
+ source: t
363
+ }, ...P(e.children, t)]);
364
+ }
365
+ function F(e, t, n, r) {
366
+ let i = [...P(e, "static"), ...P(t, "remote")], a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
367
+ function c(e, t, n, r) {
368
+ let i = r.get(t);
369
+ if (i) throw new S(e, t, i.source, n.source);
370
+ r.set(t, n);
371
+ }
372
+ for (let e of i) {
373
+ let { node: t } = e;
374
+ if (!t.id || typeof t.name != "string" || !t.name.trim() || !t.path) throw w(t, e.source, "菜单路由 id、name 和 path 不能为空");
375
+ c("name", t.name, e, o), c("path", t.path, e, s), c("id", t.id, e, a);
376
+ }
377
+ for (let [e, t] of o) if (n.hasRoute(e) && !r.has(e)) throw new S("name", e, "existing", t.source);
378
+ let l = n.getRoutes().filter((e) => typeof e.name != "string" || !r.has(e.name)), u = new Set(l.map((e) => e.path));
379
+ for (let [e, t] of s) if (u.has(e)) throw new S("path", e, "existing", t.source);
380
+ }
381
+ function I(e) {
382
+ return [...e];
383
+ }
384
+ function L(e, t, n) {
385
+ let r = t?.fieldNames?.path ?? "path", i = t?.fieldNames?.name ?? "name", a = t?.fieldNames?.children ?? "children";
386
+ for (let o of e) {
387
+ let e = o, s = r in e ? e[r] : e.path;
388
+ if (typeof s != "string" || !s.trim()) {
389
+ let t = i in e ? e[i] : e.name;
390
+ throw Error(`菜单路由 path 不能为空:${String(t ?? "unknown")} (${n})`);
391
+ }
392
+ let c = i in e ? e[i] : e.name;
393
+ if (c !== void 0 && (typeof c != "string" || !c.trim())) throw Error(`菜单路由 name 必须是非空字符串:${String(c)} (${n})`);
394
+ let l = a in e ? e[a] : e.children;
395
+ Array.isArray(l) && L(l, t, n);
396
+ }
397
+ }
398
+ function R(t) {
399
+ if (typeof t.router.getRoutes != "function") throw TypeError("菜单路由运行时要求 router.getRoutes() 用于检测既有 path 冲突");
400
+ let n = g(t.router), r = g(t.router), i = () => ({
401
+ menus: [],
402
+ routes: []
403
+ }), a = t.staticMenus ?? [];
404
+ L(a, void 0, "static");
405
+ let o = A(e(a), "static", t), s = i(), c = !1, l = !1, u = 0, d;
406
+ try {
407
+ F(o.menus, [], t.router, /* @__PURE__ */ new Set()), n.register(o.routes);
408
+ } catch (e) {
409
+ throw n.reset(), C(t, e, {
410
+ phase: "register-routes",
411
+ source: "static"
412
+ }), e;
413
+ }
414
+ function h() {
415
+ return N(o, s);
416
+ }
417
+ function _() {
418
+ return /* @__PURE__ */ new Set([...n.names, ...r.names]);
419
+ }
420
+ function v(e) {
421
+ let n = s;
422
+ r.reset();
423
+ try {
424
+ r.register(e.routes);
425
+ } catch (e) {
426
+ throw r.reset(), r.register(n.routes), C(t, e, {
427
+ phase: "register-routes",
428
+ source: "remote"
429
+ }), e;
430
+ }
431
+ s = e, c = !0;
432
+ }
433
+ function y(n) {
434
+ if (l) return Promise.reject(/* @__PURE__ */ Error("菜单路由运行时已释放"));
435
+ if (d) return d;
436
+ if (c && !n) return Promise.resolve(I(s.menus));
437
+ if (!t.loadRemoteMenus) return c = !0, Promise.resolve([]);
438
+ let r = u, i = (async () => {
439
+ let n;
440
+ try {
441
+ n = await t.loadRemoteMenus();
442
+ } catch (e) {
443
+ throw C(t, e, {
444
+ phase: "load-remote-menus",
445
+ source: "remote"
446
+ }), e;
447
+ }
448
+ if (l || r !== u) return I(s.menus);
449
+ L(n, t.remoteNormalizeOptions, "remote");
450
+ let i = A(e(n, t.remoteNormalizeOptions), "remote", t);
451
+ return F(o.menus, i.menus, t.router, _()), l || r !== u || v(i), I(s.menus);
452
+ })().finally(() => {
453
+ d === i && (d = void 0);
454
+ });
455
+ return d = i, i;
456
+ }
457
+ function b() {
458
+ u += 1, d = void 0, r.reset(), s = i(), c = !1;
459
+ }
460
+ function x() {
461
+ l || (l = !0, b(), n.reset(), o = i());
462
+ }
463
+ return {
464
+ get firstAccessibleMenu() {
465
+ return m(h().menus, {
466
+ hasPermission: t.hasPermission,
467
+ hasRole: t.hasRole
468
+ });
469
+ },
470
+ get firstAccessiblePath() {
471
+ return this.firstAccessibleMenu?.path ?? "";
472
+ },
473
+ get menus() {
474
+ return I(h().menus);
475
+ },
476
+ get remoteLoaded() {
477
+ return c;
478
+ },
479
+ get remoteMenus() {
480
+ return I(s.menus);
481
+ },
482
+ get routeNames() {
483
+ return [...n.names, ...r.names];
484
+ },
485
+ get routes() {
486
+ return I(h().routes);
487
+ },
488
+ get sidebarMenus() {
489
+ return f(h().menus, {
490
+ hasPermission: t.hasPermission,
491
+ hasRole: t.hasRole
492
+ });
493
+ },
494
+ get staticMenus() {
495
+ return I(o.menus);
496
+ },
497
+ get topMenus() {
498
+ return p(h().menus, {
499
+ hasPermission: t.hasPermission,
500
+ hasRole: t.hasRole
501
+ });
502
+ },
503
+ loadRemote: () => y(!1),
504
+ reload: () => y(!0),
505
+ resetRemote: b,
506
+ dispose: x
507
+ };
508
+ }
509
+ //#endregion
510
+ export { S as MenuRouteConflictError, _ as createGlobComponentResolver, R as createMenuRouteRuntime, u as createRouteRecords, g as createRouteRegistry, f as createSidebarMenus, p as createTopMenus, m as findFirstAccessibleMenu, o as normalizeMenuNodes, e as normalizeMenuRecords };
@@ -0,0 +1,4 @@
1
+ import type { CreateLumalAdminOptions, LumalAdminInstance } from './types';
2
+ /***********************应用创建*********************/
3
+ export declare function createLumalAdmin(options: CreateLumalAdminOptions): LumalAdminInstance;
4
+ //# sourceMappingURL=createLumalAdmin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLumalAdmin.d.ts","sourceRoot":"","sources":["../../../src/app/createLumalAdmin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAEnB,MAAM,SAAS,CAAA;AAgFhB,kDAAkD;AAClD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,kBAAkB,CA4CrF"}
@@ -0,0 +1,4 @@
1
+ import type { Component } from 'vue';
2
+ /***********************默认组件注册表*********************/
3
+ export declare const defaultLumalComponents: Record<string, Component>;
4
+ //# sourceMappingURL=default-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-components.d.ts","sourceRoot":"","sources":["../../../src/app/default-components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAuBpC,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAsB5D,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { createLumalAdmin } from './createLumalAdmin';
2
+ export type { CreateLumalAdminOptions, LumalAdminContext, LumalAdminInstance, LumalAdminPreset, LumalComponentSelection, LumalElementPlusInput, LumalElementPlusOptions, LumalRouterPlugin, } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,YAAY,EACV,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,SAAS,CAAA"}
@@ -0,0 +1,41 @@
1
+ import type { IconDefinition } from '@lumal/icons';
2
+ import type { App, Component, Plugin } from 'vue';
3
+ import type { DictionaryPluginOptions } from '../dictionary';
4
+ import type { PermissionStore } from '../permission';
5
+ export type LumalAdminPreset = 'admin-default' | 'minimal';
6
+ export type LumalRouterPlugin = Plugin & {
7
+ isReady?: () => Promise<void>;
8
+ };
9
+ export interface LumalElementPlusOptions {
10
+ options?: Record<string, unknown>;
11
+ plugin: Plugin;
12
+ }
13
+ export type LumalElementPlusInput = Plugin | LumalElementPlusOptions;
14
+ export type LumalComponentSelection = boolean | string[] | Record<string, Component>;
15
+ /***********************应用上下文类型*********************/
16
+ export interface LumalAdminContext {
17
+ app: App;
18
+ permissionStore?: PermissionStore;
19
+ pinia?: Plugin;
20
+ router?: LumalRouterPlugin;
21
+ }
22
+ export interface CreateLumalAdminOptions {
23
+ components?: LumalComponentSelection;
24
+ dictionary?: false | DictionaryPluginOptions;
25
+ elementPlus?: LumalElementPlusInput;
26
+ icons?: {
27
+ localSvg?: IconDefinition[];
28
+ };
29
+ permissionStore?: PermissionStore;
30
+ pinia?: Plugin;
31
+ preset?: LumalAdminPreset;
32
+ router?: LumalRouterPlugin;
33
+ rootComponent: Component;
34
+ rootProps?: Record<string, unknown>;
35
+ setup?: (context: LumalAdminContext) => void | Promise<void>;
36
+ }
37
+ export interface LumalAdminInstance extends LumalAdminContext {
38
+ mount: (container: Element | string) => Promise<ReturnType<App['mount']>>;
39
+ use: (plugin: Plugin, ...options: unknown[]) => LumalAdminInstance;
40
+ }
41
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/app/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,SAAS,CAAA;AAE1D,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IACvC,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9B,CAAA;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,uBAAuB,CAAA;AAEpE,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEpF,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,GAAG,CAAA;IACR,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,uBAAuB,CAAA;IACpC,UAAU,CAAC,EAAE,KAAK,GAAG,uBAAuB,CAAA;IAC5C,WAAW,CAAC,EAAE,qBAAqB,CAAA;IACnC,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAA;KAC5B,CAAA;IACD,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,aAAa,EAAE,SAAS,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7D;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,KAAK,EAAE,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACzE,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,kBAAkB,CAAA;CACnE"}
@@ -0,0 +1,3 @@
1
+ import type { AuthSessionData, ParseAuthSessionOptions } from './types';
2
+ export declare function parseAuthSession(response: unknown, options?: ParseAuthSessionOptions): AuthSessionData;
3
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/auth/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEvE,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,OAAO,EACjB,OAAO,GAAE,uBAA4B,GACpC,eAAe,CAwBjB"}
@@ -0,0 +1,8 @@
1
+ import type { AuthSession, AuthSessionOptions } from './types';
2
+ /***********************会话聚合*********************/
3
+ /**
4
+ * 聚合 token 存储、登录跳转与会话过期处理,返回稳定的会话 API。
5
+ * 不绑定任何具体登录接口或 token 字段名,仅负责会话状态管理。
6
+ */
7
+ export declare function createAuthSession(options?: AuthSessionOptions): AuthSession;
8
+ //# sourceMappingURL=createAuthSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAuthSession.d.ts","sourceRoot":"","sources":["../../../src/auth/createAuthSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAmB,kBAAkB,EAAgB,MAAM,SAAS,CAAA;AAwC7F,kDAAkD;AAClD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAuE/E"}
@@ -0,0 +1,8 @@
1
+ export { parseAuthSession } from './adapter';
2
+ export { createAuthSession } from './createAuthSession';
3
+ export { resolveLoginRedirect } from './redirect';
4
+ export { clearStoredToken, DEFAULT_TOKEN_STORAGE_KEY, getStoredToken, setStoredToken, } from './session';
5
+ export { clearSessionExpiredHandler, handleSessionExpired, registerSessionExpiredHandler, } from './session-expired';
6
+ export { createTokenStorage } from './storage';
7
+ export type { AuthSession, AuthSessionData, AuthSessionFieldNames, AuthSessionOptions, ParseAuthSessionOptions, RedirectOptions, SessionExpiredHandler, TokenStorage, } from './types';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,EACd,cAAc,GACf,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,YAAY,EACV,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,YAAY,GACb,MAAM,SAAS,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { RedirectOptions } from './types';
2
+ /***********************登录跳转解析*********************/
3
+ /**
4
+ * 解析登录跳转地址:把当前路径写入 redirect 查询参数,便于登录后回跳。
5
+ * 当前路径为空或已是登录页时,直接返回登录页路径。
6
+ */
7
+ export declare function resolveLoginRedirect(currentPath: string, options?: RedirectOptions): string;
8
+ //# sourceMappingURL=redirect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../../src/auth/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,oDAAoD;AACpD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,MAAM,CAY/F"}
@@ -0,0 +1,5 @@
1
+ import type { SessionExpiredHandler } from './types';
2
+ export declare function registerSessionExpiredHandler(handler: SessionExpiredHandler): void;
3
+ export declare function clearSessionExpiredHandler(): void;
4
+ export declare function handleSessionExpired(): Promise<void>;
5
+ //# sourceMappingURL=session-expired.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-expired.d.ts","sourceRoot":"","sources":["../../../src/auth/session-expired.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AASpD,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAElF;AAED,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1D"}
@@ -0,0 +1,10 @@
1
+ /***********************默认键名*********************/
2
+ export declare const DEFAULT_TOKEN_STORAGE_KEY = "lumal:token";
3
+ /***********************便捷读写*********************/
4
+ /**
5
+ * 直接读取存储中的 token,未配置 key 时使用默认键名。
6
+ */
7
+ export declare function getStoredToken(storage: Storage, key?: string): string;
8
+ export declare function setStoredToken(storage: Storage, token: string, key?: string): void;
9
+ export declare function clearStoredToken(storage: Storage, key?: string): void;
10
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/auth/session.ts"],"names":[],"mappings":"AAEA,kDAAkD;AAClD,eAAO,MAAM,yBAAyB,gBAAgB,CAAA;AAEtD,kDAAkD;AAClD;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,SAA4B,GAAG,MAAM,CAExF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SAA4B,GAAG,IAAI,CAErG;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,SAA4B,GAAG,IAAI,CAExF"}
@@ -0,0 +1,7 @@
1
+ import type { TokenStorage } from './types';
2
+ /***********************Token 存储*********************/
3
+ /**
4
+ * 基于 Web Storage 创建 token 存储实现。写入空 token 等价于移除。
5
+ */
6
+ export declare function createTokenStorage(storage: Storage, key: string): TokenStorage;
7
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/auth/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,sDAAsD;AACtD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,CAe9E"}