labull-framework 0.1.28 → 0.1.30

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.
@@ -1,5 +1,12 @@
1
1
  import { type Ref } from 'vue';
2
- export declare const API_BASE: string;
2
+ export declare let API_BASE: string;
3
+ /**
4
+ * 设置后端地址(**运行期**;跨源部署时由宿主调一次)。空串 = 相对本站(默认)。
5
+ *
6
+ * 结尾的 `/` 一律去掉(`'https://api.x/' + '/auth/me'` 会长出双斜杠,有的网关会 404)。
7
+ * ⚠️ 必须在**任何请求之前**调(`app.use(labull, { apiBase })` 会替你调,且排在挂别的插件之前)。
8
+ */
9
+ export declare function setApiBase(value: string | null | undefined): void;
3
10
  export declare const AUTH_DEADLINE_MS = 8000;
4
11
  export declare const CLEAR_SESSION_DEADLINE_MS = 1500;
5
12
  export interface AuthUser {
@@ -54,3 +54,39 @@ export declare function declaredUuidsOf(routes: DeclaredRoute[] | null | undefin
54
54
  * 见 `export._judge()` 里那条 `not-in-db` 条目)。
55
55
  */
56
56
  export declare function declaredMissing(routes: DeclaredRoute[] | null | undefined, page: unknown, dbIds: Iterable<string> | null | undefined): DeclaredEntry[];
57
+ /** 块页组件上的标记键名。**字符串只写这一处**:`index.ts` 照着它打标记,这一节照着它认标记。 */
58
+ export declare const BLOCK_PAGE_MARK = "__labullBlockPage";
59
+ /**
60
+ * 这个值是不是块页。
61
+ *
62
+ * 🔴 **认标记、不认引用**:使用者的 `node_modules` 里可能同时躺着两份 `@labull/magic-block`
63
+ * (两个依赖各锁了一个版本),那种情况下"引用相等"在两个副本之间**永远不成立** ——
64
+ * 而标记是打在同一个对象上的,跨副本照样认得出。
65
+ */
66
+ export declare function isBlockPage(value: unknown): boolean;
67
+ /** 块页站错位置的一种情形(`code` 是机器判据:用例按它断言 —— 报文改一个标点不该让用例红)。 */
68
+ export interface BlockPlacementProblem {
69
+ /** `wrapped` = 块页被别的组件渲染;`nested` = 块路由挂在了别的路由下面;
70
+ * `extra-views` = 除默认视图外还挂了具名视图;`no-uuid` = 挂了块页却没说这是哪个块。 */
71
+ code: 'wrapped' | 'nested' | 'extra-views' | 'no-uuid';
72
+ /** 出问题的那条路由(`chain` 里最后一条的路径;拿不到就是空串)。 */
73
+ path: string;
74
+ /** 给人看的一句话:错在哪儿 + 该往哪儿写。 */
75
+ message: string;
76
+ }
77
+ /**
78
+ * 块页站的位置对不对。`chain` 传 `route.matched`(最后一条是这条地址**真正渲染**的那条记录),
79
+ * `page` 传块页自己(`getCurrentInstance()?.type`;不传就只认标记)。回空数组 = 合规。
80
+ *
81
+ * 判这四件事:
82
+ * ① `wrapped` —— 链上最后一条记录挂的不是块页:块页被**别的组件**渲染出来了
83
+ * (AI 最常写的那种包装页,或在渲染函数里 `h(MagicBlockPage)`);
84
+ * ② `nested` —— 块路由挂在别的路由下面:父级 template 里除了 `<RouterView>` 还有别的东西;
85
+ * ③ `extra-views` —— 这条记录除了 `default` 还挂了具名视图,那正是"在块旁边摆第二块内容";
86
+ * ④ `no-uuid` —— 挂了块页却没写块的 uuid:这一页不知道该渲染哪个块。
87
+ *
88
+ * 🔴 ①命中就**当场返回**:位置都不对,后面三条判了也没有意义(只会把一份问题说成四份)。
89
+ * ⚠️ 拿不到链(空表 / null)时回**空清单**:不知道的事不许编成一条违规 ——
90
+ * 闸门误报一次,人就会把整个闸门绕过去(`tools/block-guard.mjs` 里是同一句话)。
91
+ */
92
+ export declare function blockPlacementProblems(chain: DeclaredRoute[] | null | undefined, page?: unknown): BlockPlacementProblem[];
@@ -1,8 +1,9 @@
1
- export { default as MagicBlockPage } from './magic-block-MagicBlockPage.vue';
1
+ import MagicBlockPage from './magic-block-MagicBlockPage.vue';
2
+ export { MagicBlockPage };
2
3
  export { default as MagicBlockConsole } from './magic-block-MagicBlockConsole.vue';
3
4
  export { loadBlockRender, onBlockRenderRefresh, refreshBlockRender, type BlockRender } from './magic-block-render';
4
5
  export { BLOCK_BACKEND_FILE, BLOCK_ENTRY, buildPreview } from './magic-block-preview';
5
6
  export { CLIENT_SOURCE, installBridge, type BridgeDeps } from './magic-block-bridge';
6
7
  export { BLOCK_MANIFEST, MANIFEST_KEYS, MANIFEST_REQUIRED, NAME_MAX, checkSelection, parseManifest, validFileName, validName, validateBlock, type BlockValidation, type Manifest, type ManifestKey, type SelectionCheck, } from './magic-block-manifest';
7
- export { API_BASE } from './auth-real';
8
- export { declaredMissing, declaredUuidOf, declaredUuidsOf, type DeclaredEntry, type DeclaredRoute, } from './magic-block-declared';
8
+ export { API_BASE, setApiBase } from './auth-real';
9
+ export { BLOCK_PAGE_MARK, blockPlacementProblems, declaredMissing, declaredUuidOf, declaredUuidsOf, isBlockPage, type BlockPlacementProblem, type DeclaredEntry, type DeclaredRoute, } from './magic-block-declared';
@@ -13,6 +13,16 @@ export type { LocationResolver, TabContext } from './ui-tab-context';
13
13
  export type { SideItem } from './ui-types';
14
14
  export interface LabullOptions {
15
15
  extra?: Plugin[];
16
+ /**
17
+ * 后端地址(跨源部署时给;不给 = **相对本站**)。
18
+ *
19
+ * 🔴 **由宿主传,库自己不读构建期 env**:这个包发布的是预编译 dist,而 `import.meta.env.*`
20
+ * 是构建时的静态替换 —— 库构建那一刻的值会被烧成字面量,使用方再也覆盖不了
21
+ * (真踩过:产物里烧死了 `http://localhost:3000`,登录后所有接口打到访问者自己的机器)。
22
+ * 所以这一句要写在**宿主**的入口里,由宿主自己的构建工具替换:
23
+ * `app.use(labull, { apiBase: import.meta.env.VITE_API_BASE })`
24
+ */
25
+ apiBase?: string;
16
26
  }
17
27
  export declare function installApp(app: App, options?: LabullOptions): void;
18
28
  export declare const labull: Plugin;
package/dist/ui.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as e, P as o, a as t, b as l, _ as T, U as b, i as r, l as i } from "./chunk-index-BN-lnG-w.js";
2
- import { T as n, a as p, c as u, f as d, i as P, b as f, o as x, p as A, s as v, u as C, d as S } from "./chunk-ProductShell.vue_vue_type_style_index_0_scoped_06035587_lang-BpRKKThg.js";
1
+ import { A as e, P as o, a as t, b as l, _ as T, U as b, i as r, l as i } from "./chunk-index-3dQJWK2S.js";
2
+ import { T as n, a as p, c as u, f as d, i as P, b as f, o as x, p as A, s as v, u as C, d as S } from "./chunk-ProductShell.vue_vue_type_style_index_0_scoped_06035587_lang-Fky1ghd2.js";
3
3
  export {
4
4
  e as AppSearch,
5
5
  o as ProductShell,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labull-framework",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Labull 前端 SDK:主题 CSS + 登录态 / 外壳组件 / magic block(四块合一,一个包)",