smart-admin-web 10.10.0 → 10.10.1

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/README.md CHANGED
@@ -49,6 +49,7 @@ createSmartAdmin({
49
49
  | `locales` | 文案。`locales/ext/<locale>/<命名空间>.ts` 默认导出该命名空间的键,按命名空间深合并进内置文案 |
50
50
  | `routes` | 布局壳之外的顶级静态路由,比如整屏看板、打印页 |
51
51
  | `icons` | 本地 SVG:`import.meta.glob('./assets/svg/*.svg', { query: '?raw', import: 'default', eager: true })` |
52
+ | `iconSets` | 应用自己的 `ph` 图标子集,启动时同步注册。用包带的命令生成:`npx smart-admin-icons` 扫描 `src` 里的 `ph:*` 名字,写出 `src/assets/icons/ph-subset.json`;`--check` 给 CI 用 |
52
53
  | `menuTitles` | 菜单 path → i18n key,存量库的菜单标题是中文时用 |
53
54
  | `install(app)` | 需要 app 实例的注册:`registerHeaderTool`、`registerMenuBadge`、自己的 `app.use` |
54
55
  | `plugins` | 与上面同形的插件对象。覆盖顺序:内核 < 插件(按数组顺序)< 应用 |
@@ -0,0 +1,132 @@
1
+ // Phosphor 图标子集:扫描源码里的 ph:* 名字,从 @iconify-json/ph 整集裁出用到的那几个。
2
+ // 内核的 scripts/gen-icon-subset.mjs 与随包发布的 smart-admin-icons 命令共用这一份,本模块没有副作用。
3
+ //
4
+ // 为什么要子集:整套 ph 有 9000+ 个图标(4.5 MB / 946 KB gz),一个应用的静态代码只用到几十个。
5
+ // 启动时同步注册子集,首帧即可离线渲染;子集外的名字(菜单管理里配的图标)由 AppIcon 懒加载整集兜底。
6
+ //
7
+ // 裁剪不引 @iconify/utils:这里只用得到它的 getIcons,它却会给每个消费方多装三个传递依赖。
8
+ // buildSubset 与 getIcons(data, names, true) 的产物逐字节一致,由 src/lib/iconSubset.spec.ts 拿 getIcons 对照锁住。
9
+
10
+ import { readFile, readdir, writeFile, mkdir } from 'node:fs/promises'
11
+ import { createRequire } from 'node:module'
12
+ import path from 'node:path'
13
+
14
+ const require = createRequire(import.meta.url)
15
+
16
+ export const PREFIX = 'ph'
17
+
18
+ const SCAN_EXT = new Set(['.vue', '.ts', '.tsx', '.js', '.jsx', '.mjs'])
19
+ // 测试文件里的假图标名不进产物
20
+ const TEST_FILE = /\.(spec|test)\.[^.]+$/
21
+ const ICON_RE = /\bph:[a-z0-9]+(?:-[a-z0-9]+)*\b/g
22
+
23
+ // 整集级的尺寸与 provider 字段,裁出的子集原样带上(同 getIcons 的 propsToCopy)
24
+ const ROOT_PROPS = ['left', 'top', 'width', 'height', 'provider']
25
+
26
+ /** 递归扫描目录,收集全部 `ph:xxx` 引用并入 `extra`,去重后升序返回。跳过 node_modules 与 . 开头的目录。 */
27
+ export async function scanIconNames(srcDir, extra = []) {
28
+ const found = new Set(extra)
29
+ async function walk(dir) {
30
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
31
+ const full = path.join(dir, entry.name)
32
+ if (entry.isDirectory()) {
33
+ if (entry.name !== 'node_modules' && !entry.name.startsWith('.')) await walk(full)
34
+ continue
35
+ }
36
+ if (!SCAN_EXT.has(path.extname(entry.name)) || TEST_FILE.test(entry.name)) continue
37
+ const text = await readFile(full, 'utf8')
38
+ for (const m of text.matchAll(ICON_RE)) found.add(m[0])
39
+ }
40
+ }
41
+ await walk(srcDir)
42
+ return [...found].toSorted()
43
+ }
44
+
45
+ /** 读取完整的 @iconify-json/ph 图标集。它是本包的依赖,从本模块所在位置解析,消费方不必自己装。 */
46
+ export async function loadFullSet() {
47
+ return JSON.parse(await readFile(require.resolve('@iconify-json/ph/icons.json'), 'utf8'))
48
+ }
49
+
50
+ /**
51
+ * 按名字裁出子集;`missing` 是 ph 里查无此名的(基本都是拼错)。别名沿 parent 链追到真图标,
52
+ * 链上每一环都进子集。结果的键序、别名处理与 getIcons 相同:prefix、icons、lastModified、aliases,最后是整集级字段。
53
+ */
54
+ export function buildSubset(full, names) {
55
+ const bare = names.map(n => (n.startsWith(`${PREFIX}:`) ? n.slice(PREFIX.length + 1) : n))
56
+ const sourceIcons = full.icons
57
+ const sourceAliases = full.aliases || Object.create(null)
58
+
59
+ // 名字 → 追到真图标所经的 parent 链([] = 本身就是图标,null = 查无此名或链断了)
60
+ const resolved = Object.create(null)
61
+ const resolve = name => {
62
+ if (sourceIcons[name]) return (resolved[name] = [])
63
+ if (!(name in resolved)) {
64
+ resolved[name] = null
65
+ const parent = sourceAliases[name] && sourceAliases[name].parent
66
+ const chain = parent && resolve(parent)
67
+ if (chain) resolved[name] = [parent, ...chain]
68
+ }
69
+ return resolved[name]
70
+ }
71
+ bare.forEach(resolve)
72
+
73
+ const subset = { prefix: full.prefix, icons: Object.create(null) }
74
+ if (full.lastModified) subset.lastModified = full.lastModified
75
+ const missing = []
76
+ for (const name in resolved) {
77
+ if (!resolved[name]) {
78
+ if (bare.includes(name)) missing.push(`${PREFIX}:${name}`)
79
+ } else if (sourceIcons[name]) {
80
+ subset.icons[name] = { ...sourceIcons[name] }
81
+ } else {
82
+ subset.aliases ??= Object.create(null)
83
+ subset.aliases[name] = { ...sourceAliases[name] }
84
+ }
85
+ }
86
+ for (const key of ROOT_PROPS) if (key in full) subset[key] = full[key]
87
+ return { subset, missing }
88
+ }
89
+
90
+ /** 与写盘一致的序列化(--check 靠逐字节比对)。 */
91
+ export function serialize(subset) {
92
+ return `${JSON.stringify(subset, null, 2)}\n`
93
+ }
94
+
95
+ /**
96
+ * 扫描 `src`、裁出子集后写进 `out`;`check` 为真时只比对不写盘。`extra` 是源码里没有、也要进子集的名字,
97
+ * `staleHint` 接在「已过期」提示后面告诉人怎么重生成。返回进程退出码:0 成功,1 有拼错的名字或产物已过期。
98
+ */
99
+ export async function generate({ src, out, check = false, extra = [], staleHint }) {
100
+ let names
101
+ try {
102
+ names = await scanIconNames(src, extra)
103
+ } catch (e) {
104
+ if (e?.code !== 'ENOENT') throw e
105
+ console.error(`扫描目录不存在:${src}`)
106
+ return 1
107
+ }
108
+
109
+ const { subset, missing } = buildSubset(await loadFullSet(), names)
110
+ if (missing.length) {
111
+ console.error(`图标名在 Phosphor 里不存在(拼错?):\n ${missing.join('\n ')}`)
112
+ return 1
113
+ }
114
+
115
+ const text = serialize(subset)
116
+ const count = Object.keys(subset.icons).length
117
+ const shown = path.relative(process.cwd(), out) || out
118
+ if (check) {
119
+ const current = await readFile(out, 'utf8').catch(() => '')
120
+ if (current !== text) {
121
+ console.error(`${shown} 已过期,${staleHint}`)
122
+ return 1
123
+ }
124
+ console.log(`图标子集已是最新(${count} 个)`)
125
+ return 0
126
+ }
127
+
128
+ await mkdir(path.dirname(out), { recursive: true })
129
+ await writeFile(out, text, 'utf8')
130
+ console.log(`已写出 ${shown}(${count} 个图标)`)
131
+ return 0
132
+ }
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ // smart-admin-icons:给应用生成自己的 ph 离线图标子集,交给 createSmartAdmin({ iconSets }) 启动时同步注册。
3
+ // 扫描、裁剪、--check 的逻辑在 icon-subset.mjs,本文件只解析参数。退出码:0 成功;1 图标名拼错或 --check 下产物过期;2 参数错误。
4
+ //
5
+ // 不加「被 import 时不执行」的守卫:npm 在 POSIX 上把 node_modules/.bin 里的命令做成符号链接,
6
+ // process.argv[1] 是链接路径而不是本文件,拿它和 import.meta.url 比对,命令会静默什么都不做。
7
+
8
+ import path from 'node:path'
9
+ import { generate } from './icon-subset.mjs'
10
+
11
+ const USAGE = `用法:smart-admin-icons [--src <目录>] [--out <文件>] [--check]
12
+
13
+ 扫描 --src 下 .vue/.ts/.tsx/.js/.jsx/.mjs 里的 ph:* 图标名(跳过 *.spec.*、*.test.*、node_modules),
14
+ 从 Phosphor 整集裁出这些图标写进 --out,交给 createSmartAdmin({ iconSets }) 启动时同步注册。
15
+ 源码里没有、却要离线可用的名字(比如种子菜单的图标),写进 --src 下任意一个 .ts 就会被扫进来。
16
+
17
+ --src <目录> 扫描根,默认 src
18
+ --out <文件> 产物路径,默认 src/assets/icons/ph-subset.json
19
+ --check 只比对不写盘:产物过期或有拼错的名字时非 0 退出(CI 用)
20
+ --help 显示本说明`
21
+
22
+ function parseArgs(argv) {
23
+ const opts = { src: 'src', out: 'src/assets/icons/ph-subset.json', check: false, help: false }
24
+ for (let i = 0; i < argv.length; i++) {
25
+ const arg = argv[i]
26
+ if (arg === '--check') opts.check = true
27
+ else if (arg === '--help' || arg === '-h') opts.help = true
28
+ else {
29
+ // --src x 与 --src=x 两种写法都认
30
+ const m = /^--(src|out)(?:=(.*))?$/.exec(arg)
31
+ if (!m) throw new Error(`未知参数:${arg}`)
32
+ const value = m[2] ?? argv[++i]
33
+ if (!value || value.startsWith('--')) throw new Error(`--${m[1]} 缺少值`)
34
+ opts[m[1]] = value
35
+ }
36
+ }
37
+ return opts
38
+ }
39
+
40
+ let opts
41
+ try {
42
+ opts = parseArgs(process.argv.slice(2))
43
+ } catch (e) {
44
+ console.error(`${e.message}\n\n${USAGE}`)
45
+ process.exitCode = 2
46
+ }
47
+
48
+ if (opts?.help) {
49
+ console.log(USAGE)
50
+ } else if (opts) {
51
+ process.exitCode = await generate({
52
+ src: path.resolve(opts.src),
53
+ out: path.resolve(opts.out),
54
+ check: opts.check,
55
+ staleHint: '去掉 --check 再跑一次即可更新',
56
+ })
57
+ }
@@ -1,6 +1,7 @@
1
1
  import { App } from 'vue';
2
2
  import { Pinia } from 'pinia';
3
3
  import { RouteRecordRaw } from 'vue-router';
4
+ import { IconifyJSON } from 'smart-naive-icon';
4
5
  import { router } from './router';
5
6
  import { i18n, ExtModule } from './locales';
6
7
  import { ViewLoader } from './router/viewRegistry';
@@ -20,6 +21,8 @@ export interface SmartAdminPlugin {
20
21
  menuTitles?: Record<string, string>;
21
22
  /** 本地 SVG 图标:`import.meta.glob('./assets/svg/*.svg', { query: '?raw', import: 'default', eager: true })`。 */
22
23
  icons?: Record<string, string>;
24
+ /** 离线图标子集:`smart-admin-icons` 从自己的 src 生成的 JSON(模板里是 npm run gen:icons),启动时同步注册。 */
25
+ iconSets?: IconifyJSON[];
23
26
  /** 需要 app 实例的注册动作(registerHeaderTool / registerMenuBadge / 自己的 app.use 等),在 mount 前调用。 */
24
27
  install?: (app: App) => void;
25
28
  }
@@ -1,47 +1,47 @@
1
- import { createApp as g, computed as v } from "vue";
2
- import { createPinia as S } from "pinia";
3
- import h from "pinia-plugin-persistedstate";
4
- import { SMART_TABLE_DEFAULTS as x, createSmartTableDefaults as T } from "smart-naive-table";
5
- import w from "./App.vue.js";
6
- import { router as n } from "./router/index.js";
7
- import { registerLocales as y, i18n as i } from "./locales/index.js";
8
- import { registerMenuTitles as A } from "./locales/menuTitle.js";
9
- import { registerViews as L } from "./router/viewRegistry.js";
10
- import { vAuth as E } from "./directives/auth.js";
11
- import { setupIcons as R } from "./lib/icons.js";
12
- import { reloadOnChunkError as u, reloadOnce as _ } from "./lib/chunkReload.js";
1
+ import { createApp as v, computed as S } from "vue";
2
+ import { createPinia as h } from "pinia";
3
+ import x from "pinia-plugin-persistedstate";
4
+ import { SMART_TABLE_DEFAULTS as T, createSmartTableDefaults as w } from "smart-naive-table";
5
+ import y from "./App.vue.js";
6
+ import { router as a } from "./router/index.js";
7
+ import { registerLocales as A, i18n as i } from "./locales/index.js";
8
+ import { registerMenuTitles as L } from "./locales/menuTitle.js";
9
+ import { registerViews as E } from "./router/viewRegistry.js";
10
+ import { vAuth as R } from "./directives/auth.js";
11
+ import { setupIcons as _ } from "./lib/icons.js";
12
+ import { reloadOnChunkError as b, reloadOnce as D } from "./lib/chunkReload.js";
13
13
  import { runtime as o } from "./lib/runtime.js";
14
- import { useSite as D } from "./composables/useSite.js";
15
- import { trimTrailingSlashes as B } from "./utils/url.js";
16
- function J(t = {}) {
17
- var m, f, c, d;
18
- o.apiBase = B(t.apiBase ?? ""), t.version && (o.version = t.version), o.dev = !!t.dev, o.brand = t.brand ?? {}, (m = t.brand) != null && m.title && (D().site.title = t.brand.title);
19
- const s = [...t.plugins ?? [], t], l = {};
14
+ import { useSite as B } from "./composables/useSite.js";
15
+ import { trimTrailingSlashes as C } from "./utils/url.js";
16
+ function K(t = {}) {
17
+ var c, f, d, p;
18
+ o.apiBase = C(t.apiBase ?? ""), t.version && (o.version = t.version), o.dev = !!t.dev, o.brand = t.brand ?? {}, (c = t.brand) != null && c.title && (B().site.title = t.brand.title);
19
+ const s = [...t.plugins ?? [], t], l = {}, m = [];
20
20
  for (const e of s) {
21
- e.views && L(e.views), e.locales && y(e.locales), e.menuTitles && A(e.menuTitles), e.icons && Object.assign(l, e.icons);
22
- for (const p of e.routes ?? []) n.addRoute(p);
21
+ e.views && E(e.views), e.locales && A(e.locales), e.menuTitles && L(e.menuTitles), e.icons && Object.assign(l, e.icons), e.iconSets && m.push(...e.iconSets);
22
+ for (const u of e.routes ?? []) a.addRoute(u);
23
23
  }
24
- R(l), window.addEventListener("unhandledrejection", (e) => {
25
- u(e.reason) && e.preventDefault();
24
+ _(l, m), window.addEventListener("unhandledrejection", (e) => {
25
+ b(e.reason) && e.preventDefault();
26
26
  }), window.addEventListener("vite:preloadError", (e) => {
27
- _() && e.preventDefault();
27
+ D() && e.preventDefault();
28
28
  });
29
- const a = S();
30
- a.use(h);
31
- const r = g(w);
32
- r.use(a), r.use(n), r.use(i), r.directive("auth", E), r.config.errorHandler = (e, p, b) => {
33
- u(e) || console.error("[SmartAdmin] 未捕获异常", b, e);
29
+ const n = h();
30
+ n.use(x);
31
+ const r = v(y);
32
+ r.use(n), r.use(a), r.use(i), r.directive("auth", R), r.config.errorHandler = (e, u, g) => {
33
+ b(e) || console.error("[SmartAdmin] 未捕获异常", g, e);
34
34
  }, r.provide(
35
- x,
36
- T({
35
+ T,
36
+ w({
37
37
  // 表格工具栏密度默认使用紧凑档;已有 storage-key 的用户选择仍按本地缓存优先。
38
38
  density: ((f = t.table) == null ? void 0 : f.density) ?? "compact",
39
39
  // 内置兜底是 [10,20,50],后台列表动辄上千行,翻页翻不过来。
40
40
  // 上限 200:内核 Api:MaxPageSize 的默认值,选更大的后端会回 48001。
41
41
  // 注意 SmartTable 的**初始**每页条数走 default-page-size prop(不在这份可注入的 defaults 里),
42
42
  // 没传那个 prop 的页面初始仍是 10,条数选择器会显示一个不在列表里的值。
43
- pageSizes: ((c = t.table) == null ? void 0 : c.pageSizes) ?? [20, 50, 100, 200],
44
- labels: v(() => {
43
+ pageSizes: ((d = t.table) == null ? void 0 : d.pageSizes) ?? [20, 50, 100, 200],
44
+ labels: S(() => {
45
45
  i.global.locale.value;
46
46
  const e = i.global.t;
47
47
  return {
@@ -62,16 +62,16 @@ function J(t = {}) {
62
62
  })
63
63
  })
64
64
  );
65
- for (const e of s) (d = e.install) == null || d.call(e, r);
65
+ for (const e of s) (p = e.install) == null || p.call(e, r);
66
66
  return {
67
67
  app: r,
68
- router: n,
69
- pinia: a,
68
+ router: a,
69
+ pinia: n,
70
70
  i18n: i,
71
71
  mount: (e) => (r.mount(e), r)
72
72
  };
73
73
  }
74
74
  export {
75
- J as createSmartAdmin
75
+ K as createSmartAdmin
76
76
  };
77
77
  //# sourceMappingURL=createSmartAdmin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSmartAdmin.js","sources":["../src/createSmartAdmin.ts"],"sourcesContent":["import { computed, createApp, type App } from 'vue'\nimport { createPinia, type Pinia } from 'pinia'\nimport piniaPluginPersistedstate from 'pinia-plugin-persistedstate'\nimport type { RouteRecordRaw } from 'vue-router'\nimport { SMART_TABLE_DEFAULTS, createSmartTableDefaults } from 'smart-naive-table'\nimport AppRoot from '#/App.vue'\nimport { router } from '#/router'\nimport { i18n, registerLocales, type ExtModule } from '#/locales'\nimport { registerMenuTitles } from '#/locales/menuTitle'\nimport { registerViews, type ViewLoader } from '#/router/viewRegistry'\nimport { vAuth } from '#/directives/auth'\nimport { setupIcons } from '#/lib/icons'\nimport { reloadOnChunkError, reloadOnce } from '#/lib/chunkReload'\nimport { runtime, type BrandOptions } from '#/lib/runtime'\nimport { useSite } from '#/composables/useSite'\nimport { trimTrailingSlashes } from '#/utils/url'\n\n/**\n * 一个插件(或应用自身)能往内核里注册的东西。页面、语言包、图标这类文件集合由消费方在自己的代码里\n * 写 import.meta.glob、把结果交进来 —— 内核是预编译的包,自己扫不到消费方的文件。\n */\nexport interface SmartAdminPlugin {\n /** 页面表:`import.meta.glob('./views/**\\/*.vue')`。键取 `/views/` 之后去掉 .vue(如 system/user/index),同名覆盖先注册者。 */\n views?: Record<string, ViewLoader>\n /** 语言包:`import.meta.glob('./locales/ext/*\\/*.ts', { eager: true })`,键尾形如 `<locale>/<命名空间>.ts`,按命名空间深合并。 */\n locales?: Record<string, ExtModule>\n /** 布局壳之外的顶级静态路由(整屏看板、独立打印页等)。 */\n routes?: RouteRecordRaw[]\n /** 菜单 path → i18n key(存量库菜单标题是中文时用)。 */\n menuTitles?: Record<string, string>\n /** 本地 SVG 图标:`import.meta.glob('./assets/svg/*.svg', { query: '?raw', import: 'default', eager: true })`。 */\n icons?: Record<string, string>\n /** 需要 app 实例的注册动作(registerHeaderTool / registerMenuBadge / 自己的 app.use 等),在 mount 前调用。 */\n install?: (app: App) => void\n}\n\nexport interface SmartAdminOptions extends SmartAdminPlugin {\n /** 插件按顺序注册,后者覆盖前者;应用自身(本对象的 views/locales 等)最后注册,优先级最高。 */\n plugins?: SmartAdminPlugin[]\n /** API 根地址;默认空串 = 同源。跨源时后端还要配 SmartAdmin:Api:Cors:AllowedOrigins。 */\n apiBase?: string\n /** 登录页页脚展示的版本号;默认内核版本。 */\n version?: string\n /** 开发态(登录页预填超管账号、设置抽屉「复制配置」);消费方传 import.meta.env.DEV。 */\n dev?: boolean\n /** 品牌默认值:sys.site.* 配置有值时以配置为准,为空时用这里。 */\n brand?: BrandOptions\n /** SmartTable 全局默认。 */\n table?: { density?: 'comfortable' | 'compact'; pageSizes?: number[] }\n}\n\nexport interface SmartAdminApp {\n app: App\n router: typeof router\n pinia: Pinia\n i18n: typeof i18n\n /** 挂载到选择器或元素;返回 Vue app 实例。 */\n mount: (target: string | Element) => App\n}\n\n/**\n * 组装内核应用:写入运行期配置 → 并入插件与应用的页面/文案/路由/图标 → 建 pinia/router/i18n → 返回可挂载的 app。\n * 按 内核内置 < 插件(按数组顺序)< 应用自身 的顺序注册,同 key 后者覆盖前者。结果与后端相同(应用压过内核),\n * 机制相反:后端 TryAdd 是消费方先注册者胜。\n */\nexport function createSmartAdmin(options: SmartAdminOptions = {}): SmartAdminApp {\n // apiBase 写入即生效:各处客户端在下一次调用时按新地址重建(见 api/client.ts 的 followApiBase)\n runtime.apiBase = trimTrailingSlashes(options.apiBase ?? '')\n if (options.version) runtime.version = options.version\n runtime.dev = !!options.dev\n runtime.brand = options.brand ?? {}\n if (options.brand?.title) useSite().site.title = options.brand.title\n\n const layers: SmartAdminPlugin[] = [...(options.plugins ?? []), options]\n const icons: Record<string, string> = {}\n for (const layer of layers) {\n if (layer.views) registerViews(layer.views)\n if (layer.locales) registerLocales(layer.locales)\n if (layer.menuTitles) registerMenuTitles(layer.menuTitles)\n if (layer.icons) Object.assign(icons, layer.icons)\n for (const route of layer.routes ?? []) router.addRoute(route)\n }\n setupIcons(icons) // 注册离线图标集(ph 子集同步入库)+ 本地 SVG,不预热整集\n\n // 全局兜底:没有这两个监听的话,未捕获异常和发版后旧 chunk 404 都是白屏,控制台之外不留痕迹。\n // 渲染期异常由内容区的 ErrorBoundary 收口,这里管它够不着的两类:游离的 Promise 拒绝与预加载失败。\n window.addEventListener('unhandledrejection', e => {\n if (reloadOnChunkError(e.reason)) e.preventDefault()\n })\n // Vite 预加载新 chunk 失败时派发;能走到这个事件就一定是 chunk 问题,不必再判文案。\n window.addEventListener('vite:preloadError', e => {\n if (reloadOnce()) e.preventDefault()\n })\n\n const pinia = createPinia()\n pinia.use(piniaPluginPersistedstate)\n\n const app = createApp(AppRoot)\n app.use(pinia) // 必须在 router 之前:守卫用到 store\n // 深浅色默认 themeScheme:'auto' → 首访自动跟随系统,用户手选 light/dark 后固定(见 stores/app.ts)。\n app.use(router)\n app.use(i18n)\n app.directive('auth', vAuth)\n app.config.errorHandler = (err, _instance, info) => {\n if (reloadOnChunkError(err)) return\n console.error('[SmartAdmin] 未捕获异常', info, err)\n }\n\n // SmartTable 全局默认:labels 一次注入,各页面不用手传 :labels(切语言即时生效)。\n // 只能在这里注入一次:Vue 的 inject 取最近的 provide、不合并 —— 在 App.vue 或任何祖先组件里\n // 再 provide 一次 SMART_TABLE_DEFAULTS,会把这里的 labels/density 整份挡掉。要加默认值就往下面这个对象里加。\n app.provide(\n SMART_TABLE_DEFAULTS,\n createSmartTableDefaults({\n // 表格工具栏密度默认使用紧凑档;已有 storage-key 的用户选择仍按本地缓存优先。\n density: options.table?.density ?? 'compact',\n // 内置兜底是 [10,20,50],后台列表动辄上千行,翻页翻不过来。\n // 上限 200:内核 Api:MaxPageSize 的默认值,选更大的后端会回 48001。\n // 注意 SmartTable 的**初始**每页条数走 default-page-size prop(不在这份可注入的 defaults 里),\n // 没传那个 prop 的页面初始仍是 10,条数选择器会显示一个不在列表里的值。\n pageSizes: options.table?.pageSizes ?? [20, 50, 100, 200],\n labels: computed(() => {\n void i18n.global.locale.value // 触发 locale 依赖收集\n const t = i18n.global.t\n return {\n search: t('common.search'),\n reset: t('common.reset'),\n refresh: t('table.refresh'),\n density: t('app.density'),\n densityComfortable: t('app.comfortable'),\n densityCompact: t('app.compact'),\n columnSettings: t('table.columnSettings'),\n columnSettingsReset: t('table.columnSettingsReset'),\n fixedLeft: t('table.fixedLeft'),\n fixedRight: t('table.fixedRight'),\n fixedNone: t('table.fixedNone'),\n expand: t('table.expand'),\n collapse: t('table.collapse'),\n }\n }),\n }),\n )\n\n for (const layer of layers) layer.install?.(app)\n\n return {\n app,\n router,\n pinia,\n i18n,\n mount: target => {\n app.mount(target)\n return app\n },\n }\n}\n"],"names":["createSmartAdmin","options","runtime","trimTrailingSlashes","_a","useSite","layers","icons","layer","registerViews","registerLocales","registerMenuTitles","route","router","setupIcons","reloadOnChunkError","reloadOnce","pinia","createPinia","piniaPluginPersistedstate","app","createApp","AppRoot","i18n","vAuth","err","_instance","info","SMART_TABLE_DEFAULTS","createSmartTableDefaults","_b","_c","computed","t","_d","target"],"mappings":";;;;;;;;;;;;;;;AAiEO,SAASA,EAAiBC,IAA6B,IAAmB;;AAE/E,EAAAC,EAAQ,UAAUC,EAAoBF,EAAQ,WAAW,EAAE,GACvDA,EAAQ,YAASC,EAAQ,UAAUD,EAAQ,UAC/CC,EAAQ,MAAM,CAAC,CAACD,EAAQ,KACxBC,EAAQ,QAAQD,EAAQ,SAAS,CAAA,IAC7BG,IAAAH,EAAQ,UAAR,QAAAG,EAAe,UAAOC,EAAA,EAAU,KAAK,QAAQJ,EAAQ,MAAM;AAE/D,QAAMK,IAA6B,CAAC,GAAIL,EAAQ,WAAW,CAAA,GAAKA,CAAO,GACjEM,IAAgC,CAAA;AACtC,aAAWC,KAASF,GAAQ;AAC1B,IAAIE,EAAM,SAAOC,EAAcD,EAAM,KAAK,GACtCA,EAAM,WAASE,EAAgBF,EAAM,OAAO,GAC5CA,EAAM,cAAYG,EAAmBH,EAAM,UAAU,GACrDA,EAAM,SAAO,OAAO,OAAOD,GAAOC,EAAM,KAAK;AACjD,eAAWI,KAASJ,EAAM,UAAU,CAAA,EAAI,CAAAK,EAAO,SAASD,CAAK;AAAA,EAC/D;AACA,EAAAE,EAAWP,CAAK,GAIhB,OAAO,iBAAiB,sBAAsB,CAAA,MAAK;AACjD,IAAIQ,EAAmB,EAAE,MAAM,OAAK,eAAA;AAAA,EACtC,CAAC,GAED,OAAO,iBAAiB,qBAAqB,CAAA,MAAK;AAChD,IAAIC,EAAA,KAAc,EAAE,eAAA;AAAA,EACtB,CAAC;AAED,QAAMC,IAAQC,EAAA;AACd,EAAAD,EAAM,IAAIE,CAAyB;AAEnC,QAAMC,IAAMC,EAAUC,CAAO;AAC7B,EAAAF,EAAI,IAAIH,CAAK,GAEbG,EAAI,IAAIP,CAAM,GACdO,EAAI,IAAIG,CAAI,GACZH,EAAI,UAAU,QAAQI,CAAK,GAC3BJ,EAAI,OAAO,eAAe,CAACK,GAAKC,GAAWC,MAAS;AAClD,IAAIZ,EAAmBU,CAAG,KAC1B,QAAQ,MAAM,sBAAsBE,GAAMF,CAAG;AAAA,EAC/C,GAKAL,EAAI;AAAA,IACFQ;AAAA,IACAC,EAAyB;AAAA;AAAA,MAEvB,WAASC,IAAA7B,EAAQ,UAAR,gBAAA6B,EAAe,YAAW;AAAA;AAAA;AAAA;AAAA;AAAA,MAKnC,aAAWC,IAAA9B,EAAQ,UAAR,gBAAA8B,EAAe,cAAa,CAAC,IAAI,IAAI,KAAK,GAAG;AAAA,MACxD,QAAQC,EAAS,MAAM;AACrB,QAAKT,EAAK,OAAO,OAAO;AACxB,cAAMU,IAAIV,EAAK,OAAO;AACtB,eAAO;AAAA,UACL,QAAQU,EAAE,eAAe;AAAA,UACzB,OAAOA,EAAE,cAAc;AAAA,UACvB,SAASA,EAAE,eAAe;AAAA,UAC1B,SAASA,EAAE,aAAa;AAAA,UACxB,oBAAoBA,EAAE,iBAAiB;AAAA,UACvC,gBAAgBA,EAAE,aAAa;AAAA,UAC/B,gBAAgBA,EAAE,sBAAsB;AAAA,UACxC,qBAAqBA,EAAE,2BAA2B;AAAA,UAClD,WAAWA,EAAE,iBAAiB;AAAA,UAC9B,YAAYA,EAAE,kBAAkB;AAAA,UAChC,WAAWA,EAAE,iBAAiB;AAAA,UAC9B,QAAQA,EAAE,cAAc;AAAA,UACxB,UAAUA,EAAE,gBAAgB;AAAA,QAAA;AAAA,MAEhC,CAAC;AAAA,IAAA,CACF;AAAA,EAAA;AAGH,aAAWzB,KAASF,EAAQ,EAAA4B,IAAA1B,EAAM,YAAN,QAAA0B,EAAA,KAAA1B,GAAgBY;AAE5C,SAAO;AAAA,IACL,KAAAA;AAAA,IACA,QAAAP;AAAA,IACA,OAAAI;AAAA,IACA,MAAAM;AAAA,IACA,OAAO,CAAAY,OACLf,EAAI,MAAMe,CAAM,GACTf;AAAA,EACT;AAEJ;"}
1
+ {"version":3,"file":"createSmartAdmin.js","sources":["../src/createSmartAdmin.ts"],"sourcesContent":["import { computed, createApp, type App } from 'vue'\nimport { createPinia, type Pinia } from 'pinia'\nimport piniaPluginPersistedstate from 'pinia-plugin-persistedstate'\nimport type { RouteRecordRaw } from 'vue-router'\nimport { SMART_TABLE_DEFAULTS, createSmartTableDefaults } from 'smart-naive-table'\nimport type { IconifyJSON } from 'smart-naive-icon'\nimport AppRoot from '#/App.vue'\nimport { router } from '#/router'\nimport { i18n, registerLocales, type ExtModule } from '#/locales'\nimport { registerMenuTitles } from '#/locales/menuTitle'\nimport { registerViews, type ViewLoader } from '#/router/viewRegistry'\nimport { vAuth } from '#/directives/auth'\nimport { setupIcons } from '#/lib/icons'\nimport { reloadOnChunkError, reloadOnce } from '#/lib/chunkReload'\nimport { runtime, type BrandOptions } from '#/lib/runtime'\nimport { useSite } from '#/composables/useSite'\nimport { trimTrailingSlashes } from '#/utils/url'\n\n/**\n * 一个插件(或应用自身)能往内核里注册的东西。页面、语言包、图标这类文件集合由消费方在自己的代码里\n * 写 import.meta.glob、把结果交进来 —— 内核是预编译的包,自己扫不到消费方的文件。\n */\nexport interface SmartAdminPlugin {\n /** 页面表:`import.meta.glob('./views/**\\/*.vue')`。键取 `/views/` 之后去掉 .vue(如 system/user/index),同名覆盖先注册者。 */\n views?: Record<string, ViewLoader>\n /** 语言包:`import.meta.glob('./locales/ext/*\\/*.ts', { eager: true })`,键尾形如 `<locale>/<命名空间>.ts`,按命名空间深合并。 */\n locales?: Record<string, ExtModule>\n /** 布局壳之外的顶级静态路由(整屏看板、独立打印页等)。 */\n routes?: RouteRecordRaw[]\n /** 菜单 path → i18n key(存量库菜单标题是中文时用)。 */\n menuTitles?: Record<string, string>\n /** 本地 SVG 图标:`import.meta.glob('./assets/svg/*.svg', { query: '?raw', import: 'default', eager: true })`。 */\n icons?: Record<string, string>\n /** 离线图标子集:`smart-admin-icons` 从自己的 src 生成的 JSON(模板里是 npm run gen:icons),启动时同步注册。 */\n iconSets?: IconifyJSON[]\n /** 需要 app 实例的注册动作(registerHeaderTool / registerMenuBadge / 自己的 app.use 等),在 mount 前调用。 */\n install?: (app: App) => void\n}\n\nexport interface SmartAdminOptions extends SmartAdminPlugin {\n /** 插件按顺序注册,后者覆盖前者;应用自身(本对象的 views/locales 等)最后注册,优先级最高。 */\n plugins?: SmartAdminPlugin[]\n /** API 根地址;默认空串 = 同源。跨源时后端还要配 SmartAdmin:Api:Cors:AllowedOrigins。 */\n apiBase?: string\n /** 登录页页脚展示的版本号;默认内核版本。 */\n version?: string\n /** 开发态(登录页预填超管账号、设置抽屉「复制配置」);消费方传 import.meta.env.DEV。 */\n dev?: boolean\n /** 品牌默认值:sys.site.* 配置有值时以配置为准,为空时用这里。 */\n brand?: BrandOptions\n /** SmartTable 全局默认。 */\n table?: { density?: 'comfortable' | 'compact'; pageSizes?: number[] }\n}\n\nexport interface SmartAdminApp {\n app: App\n router: typeof router\n pinia: Pinia\n i18n: typeof i18n\n /** 挂载到选择器或元素;返回 Vue app 实例。 */\n mount: (target: string | Element) => App\n}\n\n/**\n * 组装内核应用:写入运行期配置 → 并入插件与应用的页面/文案/路由/图标 → 建 pinia/router/i18n → 返回可挂载的 app。\n * 按 内核内置 < 插件(按数组顺序)< 应用自身 的顺序注册,同 key 后者覆盖前者。结果与后端相同(应用压过内核),\n * 机制相反:后端 TryAdd 是消费方先注册者胜。\n */\nexport function createSmartAdmin(options: SmartAdminOptions = {}): SmartAdminApp {\n // apiBase 写入即生效:各处客户端在下一次调用时按新地址重建(见 api/client.ts 的 followApiBase)\n runtime.apiBase = trimTrailingSlashes(options.apiBase ?? '')\n if (options.version) runtime.version = options.version\n runtime.dev = !!options.dev\n runtime.brand = options.brand ?? {}\n if (options.brand?.title) useSite().site.title = options.brand.title\n\n const layers: SmartAdminPlugin[] = [...(options.plugins ?? []), options]\n const icons: Record<string, string> = {}\n const iconSets: IconifyJSON[] = []\n for (const layer of layers) {\n if (layer.views) registerViews(layer.views)\n if (layer.locales) registerLocales(layer.locales)\n if (layer.menuTitles) registerMenuTitles(layer.menuTitles)\n if (layer.icons) Object.assign(icons, layer.icons)\n if (layer.iconSets) iconSets.push(...layer.iconSets)\n for (const route of layer.routes ?? []) router.addRoute(route)\n }\n setupIcons(icons, iconSets) // 注册离线图标集(ph 子集同步入库)+ 本地 SVG,不预热整集\n\n // 全局兜底:没有这两个监听的话,未捕获异常和发版后旧 chunk 404 都是白屏,控制台之外不留痕迹。\n // 渲染期异常由内容区的 ErrorBoundary 收口,这里管它够不着的两类:游离的 Promise 拒绝与预加载失败。\n window.addEventListener('unhandledrejection', e => {\n if (reloadOnChunkError(e.reason)) e.preventDefault()\n })\n // Vite 预加载新 chunk 失败时派发;能走到这个事件就一定是 chunk 问题,不必再判文案。\n window.addEventListener('vite:preloadError', e => {\n if (reloadOnce()) e.preventDefault()\n })\n\n const pinia = createPinia()\n pinia.use(piniaPluginPersistedstate)\n\n const app = createApp(AppRoot)\n app.use(pinia) // 必须在 router 之前:守卫用到 store\n // 深浅色默认 themeScheme:'auto' → 首访自动跟随系统,用户手选 light/dark 后固定(见 stores/app.ts)。\n app.use(router)\n app.use(i18n)\n app.directive('auth', vAuth)\n app.config.errorHandler = (err, _instance, info) => {\n if (reloadOnChunkError(err)) return\n console.error('[SmartAdmin] 未捕获异常', info, err)\n }\n\n // SmartTable 全局默认:labels 一次注入,各页面不用手传 :labels(切语言即时生效)。\n // 只能在这里注入一次:Vue 的 inject 取最近的 provide、不合并 —— 在 App.vue 或任何祖先组件里\n // 再 provide 一次 SMART_TABLE_DEFAULTS,会把这里的 labels/density 整份挡掉。要加默认值就往下面这个对象里加。\n app.provide(\n SMART_TABLE_DEFAULTS,\n createSmartTableDefaults({\n // 表格工具栏密度默认使用紧凑档;已有 storage-key 的用户选择仍按本地缓存优先。\n density: options.table?.density ?? 'compact',\n // 内置兜底是 [10,20,50],后台列表动辄上千行,翻页翻不过来。\n // 上限 200:内核 Api:MaxPageSize 的默认值,选更大的后端会回 48001。\n // 注意 SmartTable 的**初始**每页条数走 default-page-size prop(不在这份可注入的 defaults 里),\n // 没传那个 prop 的页面初始仍是 10,条数选择器会显示一个不在列表里的值。\n pageSizes: options.table?.pageSizes ?? [20, 50, 100, 200],\n labels: computed(() => {\n void i18n.global.locale.value // 触发 locale 依赖收集\n const t = i18n.global.t\n return {\n search: t('common.search'),\n reset: t('common.reset'),\n refresh: t('table.refresh'),\n density: t('app.density'),\n densityComfortable: t('app.comfortable'),\n densityCompact: t('app.compact'),\n columnSettings: t('table.columnSettings'),\n columnSettingsReset: t('table.columnSettingsReset'),\n fixedLeft: t('table.fixedLeft'),\n fixedRight: t('table.fixedRight'),\n fixedNone: t('table.fixedNone'),\n expand: t('table.expand'),\n collapse: t('table.collapse'),\n }\n }),\n }),\n )\n\n for (const layer of layers) layer.install?.(app)\n\n return {\n app,\n router,\n pinia,\n i18n,\n mount: target => {\n app.mount(target)\n return app\n },\n }\n}\n"],"names":["createSmartAdmin","options","runtime","trimTrailingSlashes","_a","useSite","layers","icons","iconSets","layer","registerViews","registerLocales","registerMenuTitles","route","router","setupIcons","reloadOnChunkError","reloadOnce","pinia","createPinia","piniaPluginPersistedstate","app","createApp","AppRoot","i18n","vAuth","err","_instance","info","SMART_TABLE_DEFAULTS","createSmartTableDefaults","_b","_c","computed","t","_d","target"],"mappings":";;;;;;;;;;;;;;;AAoEO,SAASA,EAAiBC,IAA6B,IAAmB;;AAE/E,EAAAC,EAAQ,UAAUC,EAAoBF,EAAQ,WAAW,EAAE,GACvDA,EAAQ,YAASC,EAAQ,UAAUD,EAAQ,UAC/CC,EAAQ,MAAM,CAAC,CAACD,EAAQ,KACxBC,EAAQ,QAAQD,EAAQ,SAAS,CAAA,IAC7BG,IAAAH,EAAQ,UAAR,QAAAG,EAAe,UAAOC,EAAA,EAAU,KAAK,QAAQJ,EAAQ,MAAM;AAE/D,QAAMK,IAA6B,CAAC,GAAIL,EAAQ,WAAW,CAAA,GAAKA,CAAO,GACjEM,IAAgC,CAAA,GAChCC,IAA0B,CAAA;AAChC,aAAWC,KAASH,GAAQ;AAC1B,IAAIG,EAAM,SAAOC,EAAcD,EAAM,KAAK,GACtCA,EAAM,WAASE,EAAgBF,EAAM,OAAO,GAC5CA,EAAM,cAAYG,EAAmBH,EAAM,UAAU,GACrDA,EAAM,SAAO,OAAO,OAAOF,GAAOE,EAAM,KAAK,GAC7CA,EAAM,YAAUD,EAAS,KAAK,GAAGC,EAAM,QAAQ;AACnD,eAAWI,KAASJ,EAAM,UAAU,CAAA,EAAI,CAAAK,EAAO,SAASD,CAAK;AAAA,EAC/D;AACA,EAAAE,EAAWR,GAAOC,CAAQ,GAI1B,OAAO,iBAAiB,sBAAsB,CAAA,MAAK;AACjD,IAAIQ,EAAmB,EAAE,MAAM,OAAK,eAAA;AAAA,EACtC,CAAC,GAED,OAAO,iBAAiB,qBAAqB,CAAA,MAAK;AAChD,IAAIC,EAAA,KAAc,EAAE,eAAA;AAAA,EACtB,CAAC;AAED,QAAMC,IAAQC,EAAA;AACd,EAAAD,EAAM,IAAIE,CAAyB;AAEnC,QAAMC,IAAMC,EAAUC,CAAO;AAC7B,EAAAF,EAAI,IAAIH,CAAK,GAEbG,EAAI,IAAIP,CAAM,GACdO,EAAI,IAAIG,CAAI,GACZH,EAAI,UAAU,QAAQI,CAAK,GAC3BJ,EAAI,OAAO,eAAe,CAACK,GAAKC,GAAWC,MAAS;AAClD,IAAIZ,EAAmBU,CAAG,KAC1B,QAAQ,MAAM,sBAAsBE,GAAMF,CAAG;AAAA,EAC/C,GAKAL,EAAI;AAAA,IACFQ;AAAA,IACAC,EAAyB;AAAA;AAAA,MAEvB,WAASC,IAAA9B,EAAQ,UAAR,gBAAA8B,EAAe,YAAW;AAAA;AAAA;AAAA;AAAA;AAAA,MAKnC,aAAWC,IAAA/B,EAAQ,UAAR,gBAAA+B,EAAe,cAAa,CAAC,IAAI,IAAI,KAAK,GAAG;AAAA,MACxD,QAAQC,EAAS,MAAM;AACrB,QAAKT,EAAK,OAAO,OAAO;AACxB,cAAMU,IAAIV,EAAK,OAAO;AACtB,eAAO;AAAA,UACL,QAAQU,EAAE,eAAe;AAAA,UACzB,OAAOA,EAAE,cAAc;AAAA,UACvB,SAASA,EAAE,eAAe;AAAA,UAC1B,SAASA,EAAE,aAAa;AAAA,UACxB,oBAAoBA,EAAE,iBAAiB;AAAA,UACvC,gBAAgBA,EAAE,aAAa;AAAA,UAC/B,gBAAgBA,EAAE,sBAAsB;AAAA,UACxC,qBAAqBA,EAAE,2BAA2B;AAAA,UAClD,WAAWA,EAAE,iBAAiB;AAAA,UAC9B,YAAYA,EAAE,kBAAkB;AAAA,UAChC,WAAWA,EAAE,iBAAiB;AAAA,UAC9B,QAAQA,EAAE,cAAc;AAAA,UACxB,UAAUA,EAAE,gBAAgB;AAAA,QAAA;AAAA,MAEhC,CAAC;AAAA,IAAA,CACF;AAAA,EAAA;AAGH,aAAWzB,KAASH,EAAQ,EAAA6B,IAAA1B,EAAM,YAAN,QAAA0B,EAAA,KAAA1B,GAAgBY;AAE5C,SAAO;AAAA,IACL,KAAAA;AAAA,IACA,QAAAP;AAAA,IACA,OAAAI;AAAA,IACA,MAAAM;AAAA,IACA,OAAO,CAAAY,OACLf,EAAI,MAAMe,CAAM,GACTf;AAAA,EACT;AAEJ;"}
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export type { ExtModule } from './locales';
6
6
  export * from './api';
7
7
  export { client, createApiClient, DEFAULT_TIMEOUT_MS, LONG_TIMEOUT_MS, readCookie, refreshOnce, ensureAccessToken, } from './api/client';
8
8
  export type { paths as KernelPaths, components as KernelComponents } from './api/schema';
9
- export type * from './types/api';
9
+ export * from './types/api';
10
10
  export * from './types/menu';
11
11
  export { useAppStore } from './stores/app';
12
12
  export { useAuthStore } from './stores/auth';
package/dist/index.js CHANGED
@@ -3,272 +3,284 @@ import { createSmartAdmin as s } from "./createSmartAdmin.js";
3
3
  /* empty css */
4
4
  /* empty css */
5
5
  /* empty css */
6
- import { ApiError as f, authApi as l, cacheApi as u, callApi as n, configApi as d, dashboardApi as x, dayRange as c, dictAdminApi as A, dictApi as S, externalAuthApi as g, fileApi as T, highSensApi as C, jobApi as h, listQuery as P, logApi as E, menuApi as M, mfaApi as D, moduleApi as _, monitorApi as I, normalizeCommit as B, normalizePreview as R, noticeApi as b, orgApi as w, pageParams as L, personalApi as O, positionApi as y, recycleApi as N, roleApi as U, sessionApi as v, toPage as k, toWireRows as H, unwrap as F, unwrapDownload as V, userApi as W } from "./api/index.js";
7
- import { DEFAULT_TIMEOUT_MS as z, LONG_TIMEOUT_MS as G, client as j, createApiClient as K, ensureAccessToken as Z, readCookie as J, refreshOnce as Q } from "./api/client.js";
8
- import { MenuType as q, PERMISSION_SEPARATOR as $, joinPermission as ee, splitPermission as re, toMenuInput as oe } from "./types/menu.js";
9
- import { useAppStore as ae } from "./stores/app.js";
10
- import { useAuthStore as pe } from "./stores/auth.js";
11
- import { useDictOptions as me, useDictStore as fe } from "./stores/dict.js";
12
- import { useTabsStore as ue } from "./stores/tabs.js";
13
- import { useUserStore as de } from "./stores/user.js";
14
- import { registerDynamic as ce, resetRouter as Ae, router as Se } from "./router/index.js";
15
- import { namedPage as Te } from "./router/namedPage.js";
16
- import { i18n as he, registerLocales as Pe, t as Ee, withExt as Me } from "./locales/index.js";
17
- import { menuTitleKey as _e, registerMenuTitles as Ie, translateMenuTitle as Be } from "./locales/menuTitle.js";
18
- import { vAuth as be } from "./directives/auth.js";
19
- import { describeMenuRoute as Le } from "./composables/authMenuRoute.js";
20
- import { clearClientCache as ye } from "./composables/clearClientCache.js";
21
- import { buildRoutesForModule as Ue } from "./composables/useAuthMenu.js";
22
- import { useBatchDelete as ke } from "./composables/useBatchDelete.js";
23
- import { COMPACT_MAX_HEIGHT as Fe, COMPACT_MAX_WIDTH as Ve, isCompactSize as We, useCompactScreen as Xe } from "./composables/useCompactScreen.js";
24
- import { useConfirm as Ge } from "./composables/useConfirm.js";
25
- import { useFullscreenToggle as Ke } from "./composables/useFullscreenToggle.js";
26
- import { registerHeaderTool as Je, useHeaderTools as Qe } from "./composables/useHeaderTools.js";
27
- import { useLayoutMenu as qe } from "./composables/useLayoutMenu.js";
28
- import { menuBadge as er, registerMenuBadge as rr } from "./composables/useMenuBadge.js";
29
- import { useMenuFlat as tr } from "./composables/useMenuFlat.js";
30
- import { useModule as ir } from "./composables/useModule.js";
31
- import { noticeActionButtonType as sr, useNoticeAction as mr } from "./composables/useNoticeAction.js";
32
- import { usePageTitle as lr } from "./composables/usePageTitle.js";
33
- import { beginVoluntaryLogout as nr, noticeBus as dr, onRealtime as xr, useRealtime as cr } from "./composables/useRealtime.js";
34
- import { loadSite as Sr, useSite as gr } from "./composables/useSite.js";
35
- import { DRAG_HANDLE_CLASS as Cr, useTableRowSort as hr } from "./composables/useTableRowSort.js";
36
- import { useTableZoom as Er } from "./composables/useTableZoom.js";
37
- import { useTabTitle as Dr } from "./composables/useTabTitle.js";
38
- import { useTheme as Ir } from "./composables/useTheme.js";
39
- import { useVisualViewportHeight as Rr } from "./composables/useVisualViewportHeight.js";
40
- import { default as wr } from "./components/ApiSelect/index.vue.js";
41
- import { default as Or } from "./components/Chart/index.vue.js";
42
- import { default as Nr } from "./components/Chart/LineChart.vue.js";
43
- import { default as vr } from "./components/Chart/BarChart.vue.js";
44
- import { default as Hr } from "./components/Chart/PieChart.vue.js";
45
- import { default as Vr } from "./components/CodeBlock/index.vue.js";
46
- import { default as Xr } from "./components/CronEditor/index.vue.js";
47
- import { default as Gr } from "./components/DetailPage/index.vue.js";
48
- import { default as Kr } from "./components/DictCheckbox/index.vue.js";
49
- import { default as Jr } from "./components/DictRadio/index.vue.js";
50
- import { default as Yr } from "./components/DictSelect/index.vue.js";
51
- import { default as $r } from "./components/DictTag/index.vue.js";
52
- import { default as ro } from "./components/ErrorBoundary/index.vue.js";
53
- import { default as to } from "./components/ExportColumnsModal/index.vue.js";
54
- import { default as io } from "./components/FileUpload/index.vue.js";
55
- import { default as so } from "./components/FormContainer/index.vue.js";
6
+ import { ApiError as f, authApi as l, cacheApi as u, callApi as n, configApi as d, dashboardApi as x, dayRange as c, dictAdminApi as A, dictApi as S, externalAuthApi as g, fileApi as T, highSensApi as C, jobApi as h, listQuery as b, logApi as M, menuApi as P, mfaApi as E, moduleApi as D, monitorApi as R, normalizeCommit as _, normalizePreview as I, noticeApi as y, orgApi as B, pageParams as w, personalApi as L, positionApi as O, recycleApi as N, roleApi as v, sessionApi as U, toPage as k, toWireRows as H, unwrap as F, unwrapDownload as J, userApi as V } from "./api/index.js";
7
+ import { DEFAULT_TIMEOUT_MS as X, LONG_TIMEOUT_MS as z, client as G, createApiClient as K, ensureAccessToken as j, readCookie as Z, refreshOnce as Q } from "./api/client.js";
8
+ import { DataScopeType as q, DuplicateStrategy as $, JobConcurrencyMode as ee, JobFireMode as re, JobHandlerKind as oe, JobMisfireStrategy as te, JobRunStatus as ae, JobStatus as ie, JobTriggerKind as pe, NoticeType as se, ReceiverType as me } from "./types/api.js";
9
+ import { MenuType as le, PERMISSION_SEPARATOR as ue, joinPermission as ne, splitPermission as de, toMenuInput as xe } from "./types/menu.js";
10
+ import { useAppStore as Ae } from "./stores/app.js";
11
+ import { useAuthStore as ge } from "./stores/auth.js";
12
+ import { useDictOptions as Ce, useDictStore as he } from "./stores/dict.js";
13
+ import { useTabsStore as Me } from "./stores/tabs.js";
14
+ import { useUserStore as Ee } from "./stores/user.js";
15
+ import { registerDynamic as Re, resetRouter as _e, router as Ie } from "./router/index.js";
16
+ import { namedPage as Be } from "./router/namedPage.js";
17
+ import { i18n as Le, registerLocales as Oe, t as Ne, withExt as ve } from "./locales/index.js";
18
+ import { menuTitleKey as ke, registerMenuTitles as He, translateMenuTitle as Fe } from "./locales/menuTitle.js";
19
+ import { vAuth as Ve } from "./directives/auth.js";
20
+ import { describeMenuRoute as Xe } from "./composables/authMenuRoute.js";
21
+ import { clearClientCache as Ge } from "./composables/clearClientCache.js";
22
+ import { buildRoutesForModule as je } from "./composables/useAuthMenu.js";
23
+ import { useBatchDelete as Qe } from "./composables/useBatchDelete.js";
24
+ import { COMPACT_MAX_HEIGHT as qe, COMPACT_MAX_WIDTH as $e, isCompactSize as er, useCompactScreen as rr } from "./composables/useCompactScreen.js";
25
+ import { useConfirm as tr } from "./composables/useConfirm.js";
26
+ import { useFullscreenToggle as ir } from "./composables/useFullscreenToggle.js";
27
+ import { registerHeaderTool as sr, useHeaderTools as mr } from "./composables/useHeaderTools.js";
28
+ import { useLayoutMenu as lr } from "./composables/useLayoutMenu.js";
29
+ import { menuBadge as nr, registerMenuBadge as dr } from "./composables/useMenuBadge.js";
30
+ import { useMenuFlat as cr } from "./composables/useMenuFlat.js";
31
+ import { useModule as Sr } from "./composables/useModule.js";
32
+ import { noticeActionButtonType as Tr, useNoticeAction as Cr } from "./composables/useNoticeAction.js";
33
+ import { usePageTitle as br } from "./composables/usePageTitle.js";
34
+ import { beginVoluntaryLogout as Pr, noticeBus as Er, onRealtime as Dr, useRealtime as Rr } from "./composables/useRealtime.js";
35
+ import { loadSite as Ir, useSite as yr } from "./composables/useSite.js";
36
+ import { DRAG_HANDLE_CLASS as wr, useTableRowSort as Lr } from "./composables/useTableRowSort.js";
37
+ import { useTableZoom as Nr } from "./composables/useTableZoom.js";
38
+ import { useTabTitle as Ur } from "./composables/useTabTitle.js";
39
+ import { useTheme as Hr } from "./composables/useTheme.js";
40
+ import { useVisualViewportHeight as Jr } from "./composables/useVisualViewportHeight.js";
41
+ import { default as Wr } from "./components/ApiSelect/index.vue.js";
42
+ import { default as zr } from "./components/Chart/index.vue.js";
43
+ import { default as Kr } from "./components/Chart/LineChart.vue.js";
44
+ import { default as Zr } from "./components/Chart/BarChart.vue.js";
45
+ import { default as Yr } from "./components/Chart/PieChart.vue.js";
46
+ import { default as $r } from "./components/CodeBlock/index.vue.js";
47
+ import { default as ro } from "./components/CronEditor/index.vue.js";
48
+ import { default as to } from "./components/DetailPage/index.vue.js";
49
+ import { default as io } from "./components/DictCheckbox/index.vue.js";
50
+ import { default as so } from "./components/DictRadio/index.vue.js";
51
+ import { default as fo } from "./components/DictSelect/index.vue.js";
52
+ import { default as uo } from "./components/DictTag/index.vue.js";
53
+ import { default as xo } from "./components/ErrorBoundary/index.vue.js";
54
+ import { default as Ao } from "./components/ExportColumnsModal/index.vue.js";
55
+ import { default as go } from "./components/FileUpload/index.vue.js";
56
+ import { default as Co } from "./components/FormContainer/index.vue.js";
56
57
  /* empty css */
57
- import { default as fo } from "./components/IconPicker/index.vue.js";
58
- import { default as uo } from "./components/ImportWizard/index.vue.js";
59
- import { default as xo } from "./components/JsonEditor/index.vue.js";
60
- import { default as Ao } from "./components/MarkdownEditor/index.vue.js";
61
- import { default as go } from "./components/MarkdownEditor/MarkdownView.vue.js";
62
- import { default as Co } from "./components/OrgTreeSelect/index.vue.js";
63
- import { default as Po } from "./components/PasswordStrength/index.vue.js";
64
- import { default as Mo } from "./components/RoleSelect/index.vue.js";
65
- import { default as _o } from "./components/SelectTable/index.vue.js";
66
- import { default as Bo } from "./components/StatusSwitch/index.vue.js";
67
- import { default as bo } from "./components/TableZoomButton/index.vue.js";
68
- import { default as Lo } from "./components/UserPicker/index.vue.js";
69
- import { default as yo } from "./components/UserSelect/index.vue.js";
70
- import { default as Uo } from "./components/AppIcon.vue.js";
71
- import { default as ko } from "./components/MenuSearch.vue.js";
72
- import { default as Fo } from "./components/SmartLogo.vue.js";
73
- import { default as Wo } from "./components/oauth/BrandIcon.vue.js";
74
- import { uploadChunked as zo } from "./utils/chunkUpload.js";
75
- import { triggerBlobDownload as jo } from "./utils/download.js";
76
- import { translateError as Zo, translateErrorDetail as Jo } from "./utils/error.js";
77
- import { fmtBytes as Yo, fmtDateTime as qo, operatorText as $o } from "./utils/format.js";
78
- import { IMPORT_DUPLICATE_IN_DB as rt, hardErrorsOf as ot, isDuplicateOnly as tt, isHardError as at } from "./utils/importDup.js";
79
- import { BRAND_CODES as pt, LINK_BY_ACCOUNT_CODES as st, PREVIEW_ALL_SSO_BRANDS as mt, SSO_VISIBLE_MAX as ft, brandDisplayName as lt, buildConfigProviderRows as ut, claimWeComAutoLogin as nt, isBrandCode as dt, isIconifyName as xt, mergeBindingRows as ct, previewAllBrandProviders as At, resolveProviderIcon as St, splitLoginProviders as gt } from "./utils/oauthBrand.js";
80
- import { buildTree as Ct, collectSubtreeIds as ht, expandableIds as Pt, filterTree as Et } from "./utils/tree.js";
81
- import { parseUserAgent as Dt, uaSummary as _t } from "./utils/ua.js";
82
- import { FULLSCREEN_PATH_PREFIX as Bt, isFullscreenPath as Rt, isHttpUrl as bt, trimTrailingSlashes as wt } from "./utils/url.js";
83
- import { default as Ot } from "./assets/icons/ph-subset.json.js";
84
- import { ACCENTS as Nt } from "./theme/accents.js";
85
- import { btnGrad as vt, derivePrimary as kt, glowSh as Ht, mix as Ft, rgba as Vt } from "./theme/mix.js";
86
- import { buildThemeOverrides as Xt } from "./theme/naive-theme.js";
87
- import { setupMarkdown as Gt, withXssPlugin as jt } from "./lib/markdown.js";
88
- import { LoadingBarBridge as Zt, loadingBar as Jt } from "./lib/loadingBar.js";
89
- import { classifyNoticeAction as Yt, isSiteRelativeUrl as qt, noticeActionLabel as $t } from "./lib/noticeActions.js";
90
- import { registerViews as ra, viewComponentPaths as oa } from "./router/viewRegistry.js";
58
+ import { default as bo } from "./components/IconPicker/index.vue.js";
59
+ import { default as Po } from "./components/ImportWizard/index.vue.js";
60
+ import { default as Do } from "./components/JsonEditor/index.vue.js";
61
+ import { default as _o } from "./components/MarkdownEditor/index.vue.js";
62
+ import { default as yo } from "./components/MarkdownEditor/MarkdownView.vue.js";
63
+ import { default as wo } from "./components/OrgTreeSelect/index.vue.js";
64
+ import { default as Oo } from "./components/PasswordStrength/index.vue.js";
65
+ import { default as vo } from "./components/RoleSelect/index.vue.js";
66
+ import { default as ko } from "./components/SelectTable/index.vue.js";
67
+ import { default as Fo } from "./components/StatusSwitch/index.vue.js";
68
+ import { default as Vo } from "./components/TableZoomButton/index.vue.js";
69
+ import { default as Xo } from "./components/UserPicker/index.vue.js";
70
+ import { default as Go } from "./components/UserSelect/index.vue.js";
71
+ import { default as jo } from "./components/AppIcon.vue.js";
72
+ import { default as Qo } from "./components/MenuSearch.vue.js";
73
+ import { default as qo } from "./components/SmartLogo.vue.js";
74
+ import { default as et } from "./components/oauth/BrandIcon.vue.js";
75
+ import { uploadChunked as ot } from "./utils/chunkUpload.js";
76
+ import { triggerBlobDownload as at } from "./utils/download.js";
77
+ import { translateError as pt, translateErrorDetail as st } from "./utils/error.js";
78
+ import { fmtBytes as ft, fmtDateTime as lt, operatorText as ut } from "./utils/format.js";
79
+ import { IMPORT_DUPLICATE_IN_DB as dt, hardErrorsOf as xt, isDuplicateOnly as ct, isHardError as At } from "./utils/importDup.js";
80
+ import { BRAND_CODES as gt, LINK_BY_ACCOUNT_CODES as Tt, PREVIEW_ALL_SSO_BRANDS as Ct, SSO_VISIBLE_MAX as ht, brandDisplayName as bt, buildConfigProviderRows as Mt, claimWeComAutoLogin as Pt, isBrandCode as Et, isIconifyName as Dt, mergeBindingRows as Rt, previewAllBrandProviders as _t, resolveProviderIcon as It, splitLoginProviders as yt } from "./utils/oauthBrand.js";
81
+ import { buildTree as wt, collectSubtreeIds as Lt, expandableIds as Ot, filterTree as Nt } from "./utils/tree.js";
82
+ import { parseUserAgent as Ut, uaSummary as kt } from "./utils/ua.js";
83
+ import { FULLSCREEN_PATH_PREFIX as Ft, isFullscreenPath as Jt, isHttpUrl as Vt, trimTrailingSlashes as Wt } from "./utils/url.js";
84
+ import { default as zt } from "./assets/icons/ph-subset.json.js";
85
+ import { ACCENTS as Kt } from "./theme/accents.js";
86
+ import { btnGrad as Zt, derivePrimary as Qt, glowSh as Yt, mix as qt, rgba as $t } from "./theme/mix.js";
87
+ import { buildThemeOverrides as ra } from "./theme/naive-theme.js";
88
+ import { setupMarkdown as ta, withXssPlugin as aa } from "./lib/markdown.js";
89
+ import { LoadingBarBridge as pa, loadingBar as sa } from "./lib/loadingBar.js";
90
+ import { classifyNoticeAction as fa, isSiteRelativeUrl as la, noticeActionLabel as ua } from "./lib/noticeActions.js";
91
+ import { registerViews as da, viewComponentPaths as xa } from "./router/viewRegistry.js";
91
92
  export {
92
- Nt as ACCENTS,
93
+ Kt as ACCENTS,
93
94
  f as ApiError,
94
- wr as ApiSelect,
95
- Uo as AppIcon,
96
- pt as BRAND_CODES,
97
- vr as BarChart,
98
- Wo as BrandIcon,
99
- Fe as COMPACT_MAX_HEIGHT,
100
- Ve as COMPACT_MAX_WIDTH,
101
- Or as Chart,
102
- Vr as CodeBlock,
103
- Xr as CronEditor,
104
- z as DEFAULT_TIMEOUT_MS,
105
- Cr as DRAG_HANDLE_CLASS,
106
- Gr as DetailPage,
107
- Kr as DictCheckbox,
108
- Jr as DictRadio,
109
- Yr as DictSelect,
110
- $r as DictTag,
111
- ro as ErrorBoundary,
112
- to as ExportColumnsModal,
113
- Bt as FULLSCREEN_PATH_PREFIX,
114
- io as FileUpload,
115
- so as FormContainer,
116
- rt as IMPORT_DUPLICATE_IN_DB,
117
- fo as IconPicker,
118
- uo as ImportWizard,
119
- xo as JsonEditor,
120
- st as LINK_BY_ACCOUNT_CODES,
121
- G as LONG_TIMEOUT_MS,
122
- Nr as LineChart,
123
- Zt as LoadingBarBridge,
124
- Ao as MarkdownEditor,
125
- go as MarkdownView,
126
- ko as MenuSearch,
127
- q as MenuType,
128
- Co as OrgTreeSelect,
129
- $ as PERMISSION_SEPARATOR,
130
- mt as PREVIEW_ALL_SSO_BRANDS,
131
- Po as PasswordStrength,
132
- Hr as PieChart,
133
- Mo as RoleSelect,
134
- ft as SSO_VISIBLE_MAX,
135
- _o as SelectTable,
136
- Fo as SmartLogo,
137
- Bo as StatusSwitch,
138
- bo as TableZoomButton,
139
- Lo as UserPicker,
140
- yo as UserSelect,
95
+ Wr as ApiSelect,
96
+ jo as AppIcon,
97
+ gt as BRAND_CODES,
98
+ Zr as BarChart,
99
+ et as BrandIcon,
100
+ qe as COMPACT_MAX_HEIGHT,
101
+ $e as COMPACT_MAX_WIDTH,
102
+ zr as Chart,
103
+ $r as CodeBlock,
104
+ ro as CronEditor,
105
+ X as DEFAULT_TIMEOUT_MS,
106
+ wr as DRAG_HANDLE_CLASS,
107
+ q as DataScopeType,
108
+ to as DetailPage,
109
+ io as DictCheckbox,
110
+ so as DictRadio,
111
+ fo as DictSelect,
112
+ uo as DictTag,
113
+ $ as DuplicateStrategy,
114
+ xo as ErrorBoundary,
115
+ Ao as ExportColumnsModal,
116
+ Ft as FULLSCREEN_PATH_PREFIX,
117
+ go as FileUpload,
118
+ Co as FormContainer,
119
+ dt as IMPORT_DUPLICATE_IN_DB,
120
+ bo as IconPicker,
121
+ Po as ImportWizard,
122
+ ee as JobConcurrencyMode,
123
+ re as JobFireMode,
124
+ oe as JobHandlerKind,
125
+ te as JobMisfireStrategy,
126
+ ae as JobRunStatus,
127
+ ie as JobStatus,
128
+ pe as JobTriggerKind,
129
+ Do as JsonEditor,
130
+ Tt as LINK_BY_ACCOUNT_CODES,
131
+ z as LONG_TIMEOUT_MS,
132
+ Kr as LineChart,
133
+ pa as LoadingBarBridge,
134
+ _o as MarkdownEditor,
135
+ yo as MarkdownView,
136
+ Qo as MenuSearch,
137
+ le as MenuType,
138
+ se as NoticeType,
139
+ wo as OrgTreeSelect,
140
+ ue as PERMISSION_SEPARATOR,
141
+ Ct as PREVIEW_ALL_SSO_BRANDS,
142
+ Oo as PasswordStrength,
143
+ Yr as PieChart,
144
+ me as ReceiverType,
145
+ vo as RoleSelect,
146
+ ht as SSO_VISIBLE_MAX,
147
+ ko as SelectTable,
148
+ qo as SmartLogo,
149
+ Fo as StatusSwitch,
150
+ Vo as TableZoomButton,
151
+ Xo as UserPicker,
152
+ Go as UserSelect,
141
153
  l as authApi,
142
- nr as beginVoluntaryLogout,
143
- lt as brandDisplayName,
144
- vt as btnGrad,
145
- ut as buildConfigProviderRows,
146
- Ue as buildRoutesForModule,
147
- Xt as buildThemeOverrides,
148
- Ct as buildTree,
154
+ Pr as beginVoluntaryLogout,
155
+ bt as brandDisplayName,
156
+ Zt as btnGrad,
157
+ Mt as buildConfigProviderRows,
158
+ je as buildRoutesForModule,
159
+ ra as buildThemeOverrides,
160
+ wt as buildTree,
149
161
  u as cacheApi,
150
162
  n as callApi,
151
- nt as claimWeComAutoLogin,
152
- Yt as classifyNoticeAction,
153
- ye as clearClientCache,
154
- j as client,
155
- ht as collectSubtreeIds,
163
+ Pt as claimWeComAutoLogin,
164
+ fa as classifyNoticeAction,
165
+ Ge as clearClientCache,
166
+ G as client,
167
+ Lt as collectSubtreeIds,
156
168
  d as configApi,
157
169
  K as createApiClient,
158
170
  s as createSmartAdmin,
159
171
  x as dashboardApi,
160
172
  c as dayRange,
161
- kt as derivePrimary,
162
- Le as describeMenuRoute,
173
+ Qt as derivePrimary,
174
+ Xe as describeMenuRoute,
163
175
  A as dictAdminApi,
164
176
  S as dictApi,
165
- Z as ensureAccessToken,
166
- Pt as expandableIds,
177
+ j as ensureAccessToken,
178
+ Ot as expandableIds,
167
179
  g as externalAuthApi,
168
180
  T as fileApi,
169
- Et as filterTree,
170
- Yo as fmtBytes,
171
- qo as fmtDateTime,
172
- Ht as glowSh,
173
- ot as hardErrorsOf,
181
+ Nt as filterTree,
182
+ ft as fmtBytes,
183
+ lt as fmtDateTime,
184
+ Yt as glowSh,
185
+ xt as hardErrorsOf,
174
186
  C as highSensApi,
175
- he as i18n,
176
- dt as isBrandCode,
177
- We as isCompactSize,
178
- tt as isDuplicateOnly,
179
- Rt as isFullscreenPath,
180
- at as isHardError,
181
- bt as isHttpUrl,
182
- xt as isIconifyName,
183
- qt as isSiteRelativeUrl,
187
+ Le as i18n,
188
+ Et as isBrandCode,
189
+ er as isCompactSize,
190
+ ct as isDuplicateOnly,
191
+ Jt as isFullscreenPath,
192
+ At as isHardError,
193
+ Vt as isHttpUrl,
194
+ Dt as isIconifyName,
195
+ la as isSiteRelativeUrl,
184
196
  h as jobApi,
185
- ee as joinPermission,
186
- Ot as kernelIconSet,
187
- P as listQuery,
188
- Sr as loadSite,
189
- Jt as loadingBar,
190
- E as logApi,
191
- M as menuApi,
192
- er as menuBadge,
193
- _e as menuTitleKey,
194
- ct as mergeBindingRows,
195
- D as mfaApi,
196
- Ft as mix,
197
- _ as moduleApi,
198
- I as monitorApi,
199
- Te as namedPage,
200
- B as normalizeCommit,
201
- R as normalizePreview,
202
- sr as noticeActionButtonType,
203
- $t as noticeActionLabel,
204
- b as noticeApi,
205
- dr as noticeBus,
206
- xr as onRealtime,
207
- $o as operatorText,
208
- w as orgApi,
209
- L as pageParams,
210
- Dt as parseUserAgent,
211
- O as personalApi,
212
- y as positionApi,
213
- At as previewAllBrandProviders,
214
- J as readCookie,
197
+ ne as joinPermission,
198
+ zt as kernelIconSet,
199
+ b as listQuery,
200
+ Ir as loadSite,
201
+ sa as loadingBar,
202
+ M as logApi,
203
+ P as menuApi,
204
+ nr as menuBadge,
205
+ ke as menuTitleKey,
206
+ Rt as mergeBindingRows,
207
+ E as mfaApi,
208
+ qt as mix,
209
+ D as moduleApi,
210
+ R as monitorApi,
211
+ Be as namedPage,
212
+ _ as normalizeCommit,
213
+ I as normalizePreview,
214
+ Tr as noticeActionButtonType,
215
+ ua as noticeActionLabel,
216
+ y as noticeApi,
217
+ Er as noticeBus,
218
+ Dr as onRealtime,
219
+ ut as operatorText,
220
+ B as orgApi,
221
+ w as pageParams,
222
+ Ut as parseUserAgent,
223
+ L as personalApi,
224
+ O as positionApi,
225
+ _t as previewAllBrandProviders,
226
+ Z as readCookie,
215
227
  N as recycleApi,
216
228
  Q as refreshOnce,
217
- ce as registerDynamic,
218
- Je as registerHeaderTool,
219
- Pe as registerLocales,
220
- rr as registerMenuBadge,
221
- Ie as registerMenuTitles,
222
- ra as registerViews,
223
- Ae as resetRouter,
224
- St as resolveProviderIcon,
225
- Vt as rgba,
226
- U as roleApi,
227
- Se as router,
228
- v as sessionApi,
229
- Gt as setupMarkdown,
230
- gt as splitLoginProviders,
231
- re as splitPermission,
232
- Ee as t,
233
- oe as toMenuInput,
229
+ Re as registerDynamic,
230
+ sr as registerHeaderTool,
231
+ Oe as registerLocales,
232
+ dr as registerMenuBadge,
233
+ He as registerMenuTitles,
234
+ da as registerViews,
235
+ _e as resetRouter,
236
+ It as resolveProviderIcon,
237
+ $t as rgba,
238
+ v as roleApi,
239
+ Ie as router,
240
+ U as sessionApi,
241
+ ta as setupMarkdown,
242
+ yt as splitLoginProviders,
243
+ de as splitPermission,
244
+ Ne as t,
245
+ xe as toMenuInput,
234
246
  k as toPage,
235
247
  H as toWireRows,
236
- Zo as translateError,
237
- Jo as translateErrorDetail,
238
- Be as translateMenuTitle,
239
- jo as triggerBlobDownload,
240
- wt as trimTrailingSlashes,
241
- _t as uaSummary,
248
+ pt as translateError,
249
+ st as translateErrorDetail,
250
+ Fe as translateMenuTitle,
251
+ at as triggerBlobDownload,
252
+ Wt as trimTrailingSlashes,
253
+ kt as uaSummary,
242
254
  F as unwrap,
243
- V as unwrapDownload,
244
- zo as uploadChunked,
245
- ae as useAppStore,
246
- pe as useAuthStore,
247
- ke as useBatchDelete,
248
- Xe as useCompactScreen,
249
- Ge as useConfirm,
250
- me as useDictOptions,
251
- fe as useDictStore,
252
- Ke as useFullscreenToggle,
253
- Qe as useHeaderTools,
254
- qe as useLayoutMenu,
255
- tr as useMenuFlat,
256
- ir as useModule,
257
- mr as useNoticeAction,
258
- lr as usePageTitle,
259
- cr as useRealtime,
260
- gr as useSite,
261
- Dr as useTabTitle,
262
- hr as useTableRowSort,
263
- Er as useTableZoom,
264
- ue as useTabsStore,
265
- Ir as useTheme,
266
- de as useUserStore,
267
- Rr as useVisualViewportHeight,
268
- W as userApi,
269
- be as vAuth,
270
- oa as viewComponentPaths,
271
- Me as withExt,
272
- jt as withXssPlugin
255
+ J as unwrapDownload,
256
+ ot as uploadChunked,
257
+ Ae as useAppStore,
258
+ ge as useAuthStore,
259
+ Qe as useBatchDelete,
260
+ rr as useCompactScreen,
261
+ tr as useConfirm,
262
+ Ce as useDictOptions,
263
+ he as useDictStore,
264
+ ir as useFullscreenToggle,
265
+ mr as useHeaderTools,
266
+ lr as useLayoutMenu,
267
+ cr as useMenuFlat,
268
+ Sr as useModule,
269
+ Cr as useNoticeAction,
270
+ br as usePageTitle,
271
+ Rr as useRealtime,
272
+ yr as useSite,
273
+ Ur as useTabTitle,
274
+ Lr as useTableRowSort,
275
+ Nr as useTableZoom,
276
+ Me as useTabsStore,
277
+ Hr as useTheme,
278
+ Ee as useUserStore,
279
+ Jr as useVisualViewportHeight,
280
+ V as userApi,
281
+ Ve as vAuth,
282
+ xa as viewComponentPaths,
283
+ ve as withExt,
284
+ aa as withXssPlugin
273
285
  };
274
286
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,5 @@
1
- /** 首屏调用一次:同步装入 ph 子集,再注册离线集 + 本地 SVG(内核自带 + 消费方传入)。 */
2
- export declare function setupIcons(extraIcons?: Record<string, string>): void;
1
+ import { IconifyJSON } from 'smart-naive-icon';
2
+ /**
3
+ * 首屏调用一次:同步装入 ph 子集(内核的 + 消费方经 iconSets 传入的),再注册离线集 + 本地 SVG(内核自带 + 消费方传入)。
4
+ */
5
+ export declare function setupIcons(extraIcons?: Record<string, string>, extraSets?: IconifyJSON[]): void;
package/dist/lib/icons.js CHANGED
@@ -1,8 +1,8 @@
1
- import o from "../assets/svg/star.svg.js";
2
- import { addCollection as t } from "@iconify/vue";
3
- import { setupSmartIcon as n } from "smart-naive-icon";
4
- import r from "../assets/icons/ph-subset.json.js";
5
- const i = [
1
+ import r from "../assets/svg/star.svg.js";
2
+ import { addCollection as o } from "@iconify/vue";
3
+ import { setupSmartIcon as s } from "smart-naive-icon";
4
+ import i from "../assets/icons/ph-subset.json.js";
5
+ const a = [
6
6
  {
7
7
  prefix: "ph",
8
8
  name: "Phosphor",
@@ -23,17 +23,19 @@ const i = [
23
23
  name: "Ant Design",
24
24
  loader: () => import("@iconify-json/ant-design/icons.json").then((e) => e.default)
25
25
  }
26
- ], s = "__none__", a = /* @__PURE__ */ Object.assign({
27
- "../assets/svg/star.svg": o
26
+ ], l = "__none__", p = /* @__PURE__ */ Object.assign({
27
+ "../assets/svg/star.svg": r
28
28
  });
29
- function d(e = {}) {
30
- t(r), n({
31
- collections: i,
32
- localIcons: { ...a, ...e },
33
- preloadPrefix: s
29
+ function u(e = {}, t = []) {
30
+ o(i);
31
+ for (const n of t) o(n);
32
+ s({
33
+ collections: a,
34
+ localIcons: { ...p, ...e },
35
+ preloadPrefix: l
34
36
  });
35
37
  }
36
38
  export {
37
- d as setupIcons
39
+ u as setupIcons
38
40
  };
39
41
  //# sourceMappingURL=icons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sources":["../../src/lib/icons.ts"],"sourcesContent":["// SmartAdmin 侧图标 bootstrap:把 4 套离线集 + 本地 SVG 注册进 smart-naive-icon,并同步装入 ph 子集。\n// 选择器/渲染器逻辑在该独立 npm 包里(见 components/IconPicker、components/AppIcon.vue),这里只做「注册配置」。\n// SmartAdmin 只保留三个薄封装(本文件 + AppIcon.vue + IconPicker/index.vue)。组件本体的 bug 去组件包的仓库提 issue\n// 或本地 patch,不要把组件逻辑复制进 SmartAdmin 修——那样同一套逻辑就有了两份。\nimport { addCollection } from '@iconify/vue'\nimport { setupSmartIcon, type IconCollection, type IconifyJSON } from 'smart-naive-icon'\nimport phSubset from '#/assets/icons/ph-subset.json'\n\n// 增删默认离线集:装/卸 `@iconify-json/<prefix>`,并在此加/删一行同 prefix 的 loader。\n// 每套是独立懒加载 chunk;`ph` 是全站默认集,整集只在选择器打开、或渲染到子集外的图标时才拉。\nconst collections: IconCollection[] = [\n {\n prefix: 'ph',\n name: 'Phosphor',\n loader: () => import('@iconify-json/ph/icons.json').then(m => m.default as IconifyJSON),\n },\n {\n prefix: 'lucide',\n name: 'Lucide',\n loader: () => import('@iconify-json/lucide/icons.json').then(m => m.default as IconifyJSON),\n },\n {\n prefix: 'ep',\n name: 'Element Plus',\n loader: () => import('@iconify-json/ep/icons.json').then(m => m.default as IconifyJSON),\n },\n {\n prefix: 'ant-design',\n name: 'Ant Design',\n loader: () => import('@iconify-json/ant-design/icons.json').then(m => m.default as IconifyJSON),\n },\n]\n\n// 包没有「不预热」的开关:preloadIcons 拿不到 prefix 就退回第一套,故给一个必不存在的前缀把预热顶掉——\n// 只同步注册这份子集:预热整套 9000+ 图标(4.5 MB / 946 KB gz)会让首屏白拉掉 dist 四成的体积。\nconst NO_PRELOAD = '__none__'\n\n// 内核自带的本地 SVG(src/assets/svg/*.svg);消费方的经 createSmartAdmin({ icons }) 以同样的 glob 形状传入。\nconst kernelIcons = import.meta.glob('../assets/svg/*.svg', {\n query: '?raw',\n import: 'default',\n eager: true,\n}) as Record<string, string>\n\n/** 首屏调用一次:同步装入 ph 子集,再注册离线集 + 本地 SVG(内核自带 + 消费方传入)。 */\nexport function setupIcons(extraIcons: Record<string, string> = {}): void {\n // 子集同步入库,首帧即可离线渲染静态图标,不必等异步预热,也不会命中外部 CDN。\n // 子集由 `npm run gen:icons` 从 src 里实际用到的名字 + 内核种子菜单的图标生成(scripts/gen-icon-subset.mjs)。\n addCollection(phSubset as IconifyJSON)\n setupSmartIcon({\n collections,\n localIcons: { ...kernelIcons, ...extraIcons },\n preloadPrefix: NO_PRELOAD,\n })\n}\n"],"names":["collections","m","NO_PRELOAD","kernelIcons","__vite_glob_0_0","setupIcons","extraIcons","addCollection","phSubset","setupSmartIcon"],"mappings":";;;;AAUA,MAAMA,IAAgC;AAAA,EACpC;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,6BAA6B,EAAE,KAAK,CAAAC,MAAKA,EAAE,OAAsB;AAAA,EAAA;AAAA,EAExF;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,iCAAiC,EAAE,KAAK,CAAAA,MAAKA,EAAE,OAAsB;AAAA,EAAA;AAAA,EAE5F;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,6BAA6B,EAAE,KAAK,CAAAA,MAAKA,EAAE,OAAsB;AAAA,EAAA;AAAA,EAExF;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,qCAAqC,EAAE,KAAK,CAAAA,MAAKA,EAAE,OAAsB;AAAA,EAAA;AAElG,GAIMC,IAAa,YAGbC,IAAc,uBAAA,OAAA;AAAA,EAAA,0BAAAC;AAAA,CAAA;AAOb,SAASC,EAAWC,IAAqC,IAAU;AAGxE,EAAAC,EAAcC,CAAuB,GACrCC,EAAe;AAAA,IACb,aAAAT;AAAA,IACA,YAAY,EAAE,GAAGG,GAAa,GAAGG,EAAA;AAAA,IACjC,eAAeJ;AAAA,EAAA,CAChB;AACH;"}
1
+ {"version":3,"file":"icons.js","sources":["../../src/lib/icons.ts"],"sourcesContent":["// SmartAdmin 侧图标 bootstrap:把 4 套离线集 + 本地 SVG 注册进 smart-naive-icon,并同步装入 ph 子集。\n// 选择器/渲染器逻辑在该独立 npm 包里(见 components/IconPicker、components/AppIcon.vue),这里只做「注册配置」。\n// SmartAdmin 只保留三个薄封装(本文件 + AppIcon.vue + IconPicker/index.vue)。组件本体的 bug 去组件包的仓库提 issue\n// 或本地 patch,不要把组件逻辑复制进 SmartAdmin 修——那样同一套逻辑就有了两份。\nimport { addCollection } from '@iconify/vue'\nimport { setupSmartIcon, type IconCollection, type IconifyJSON } from 'smart-naive-icon'\nimport phSubset from '#/assets/icons/ph-subset.json'\n\n// 增删默认离线集:装/卸 `@iconify-json/<prefix>`,并在此加/删一行同 prefix 的 loader。\n// 每套是独立懒加载 chunk;`ph` 是全站默认集,整集只在选择器打开、或渲染到子集外的图标时才拉。\nconst collections: IconCollection[] = [\n {\n prefix: 'ph',\n name: 'Phosphor',\n loader: () => import('@iconify-json/ph/icons.json').then(m => m.default as IconifyJSON),\n },\n {\n prefix: 'lucide',\n name: 'Lucide',\n loader: () => import('@iconify-json/lucide/icons.json').then(m => m.default as IconifyJSON),\n },\n {\n prefix: 'ep',\n name: 'Element Plus',\n loader: () => import('@iconify-json/ep/icons.json').then(m => m.default as IconifyJSON),\n },\n {\n prefix: 'ant-design',\n name: 'Ant Design',\n loader: () => import('@iconify-json/ant-design/icons.json').then(m => m.default as IconifyJSON),\n },\n]\n\n// 包没有「不预热」的开关:preloadIcons 拿不到 prefix 就退回第一套,故给一个必不存在的前缀把预热顶掉——\n// 只同步注册这份子集:预热整套 9000+ 图标(4.5 MB / 946 KB gz)会让首屏白拉掉 dist 四成的体积。\nconst NO_PRELOAD = '__none__'\n\n// 内核自带的本地 SVG(src/assets/svg/*.svg);消费方的经 createSmartAdmin({ icons }) 以同样的 glob 形状传入。\nconst kernelIcons = import.meta.glob('../assets/svg/*.svg', {\n query: '?raw',\n import: 'default',\n eager: true,\n}) as Record<string, string>\n\n/**\n * 首屏调用一次:同步装入 ph 子集(内核的 + 消费方经 iconSets 传入的),再注册离线集 + 本地 SVG(内核自带 + 消费方传入)。\n */\nexport function setupIcons(\n extraIcons: Record<string, string> = {},\n extraSets: IconifyJSON[] = [],\n): void {\n // 子集同步入库,首帧即可离线渲染静态图标,不必等异步预热,也不会命中外部 CDN。\n // 内核子集由 `npm run gen:icons` 从包的 src 与种子菜单图标生成(scripts/gen-icon-subset.mjs);\n // 消费方的由 smart-admin-icons 从它自己的 src 生成。两份有重名也无妨,同名图标数据相同,后注册的覆盖前者。\n addCollection(phSubset as IconifyJSON)\n for (const set of extraSets) addCollection(set)\n setupSmartIcon({\n collections,\n localIcons: { ...kernelIcons, ...extraIcons },\n preloadPrefix: NO_PRELOAD,\n })\n}\n"],"names":["collections","m","NO_PRELOAD","kernelIcons","__vite_glob_0_0","setupIcons","extraIcons","extraSets","addCollection","phSubset","set","setupSmartIcon"],"mappings":";;;;AAUA,MAAMA,IAAgC;AAAA,EACpC;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,6BAA6B,EAAE,KAAK,CAAAC,MAAKA,EAAE,OAAsB;AAAA,EAAA;AAAA,EAExF;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,iCAAiC,EAAE,KAAK,CAAAA,MAAKA,EAAE,OAAsB;AAAA,EAAA;AAAA,EAE5F;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,6BAA6B,EAAE,KAAK,CAAAA,MAAKA,EAAE,OAAsB;AAAA,EAAA;AAAA,EAExF;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,qCAAqC,EAAE,KAAK,CAAAA,MAAKA,EAAE,OAAsB;AAAA,EAAA;AAElG,GAIMC,IAAa,YAGbC,IAAc,uBAAA,OAAA;AAAA,EAAA,0BAAAC;AAAA,CAAA;AASb,SAASC,EACdC,IAAqC,IACrCC,IAA2B,CAAA,GACrB;AAIN,EAAAC,EAAcC,CAAuB;AACrC,aAAWC,KAAOH,EAAW,CAAAC,EAAcE,CAAG;AAC9C,EAAAC,EAAe;AAAA,IACb,aAAAX;AAAA,IACA,YAAY,EAAE,GAAGG,GAAa,GAAGG,EAAA;AAAA,IACjC,eAAeJ;AAAA,EAAA,CAChB;AACH;"}
@@ -2,7 +2,7 @@ const e = {
2
2
  /** API 根地址;空串 = 同源(dev 由 Vite 代理,生产由反代或后端托管 dist) */
3
3
  apiBase: "",
4
4
  /** 登录页页脚展示的版本号;默认内核版本,消费方可覆盖为应用版本 */
5
- version: "10.10.0",
5
+ version: "10.10.1",
6
6
  /** 开发态:登录页预填超管账号、设置抽屉显示「复制配置」 */
7
7
  dev: !1,
8
8
  brand: {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-admin-web",
3
- "version": "10.10.0",
3
+ "version": "10.10.1",
4
4
  "description": "SmartAdmin 前端内核:布局、路由、鉴权、内置系统页与共享组件,配合 SmartAdmin NuGet 包使用",
5
5
  "keywords": [
6
6
  "smartadmin",
@@ -24,8 +24,12 @@
24
24
  "**/*.css"
25
25
  ],
26
26
  "files": [
27
- "dist"
27
+ "dist",
28
+ "cli"
28
29
  ],
30
+ "bin": {
31
+ "smart-admin-icons": "./cli/smart-admin-icons.mjs"
32
+ },
29
33
  "main": "./dist/index.js",
30
34
  "module": "./dist/index.js",
31
35
  "types": "./dist/index.d.ts",