labull-framework 0.1.20 → 0.1.22
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 +5 -3
- package/dist/magic-block.js +1759 -1470
- package/dist/style.css +1 -1
- package/dist/types/magic-block-MagicBlockPage.vue.d.ts +2 -1
- package/dist/types/magic-block-declared.d.ts +56 -0
- package/dist/types/magic-block-manifest.d.ts +2 -11
- package/dist/types/magic-block-real.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
-
uuid
|
|
2
|
+
uuid?: string;
|
|
3
3
|
name?: string;
|
|
4
4
|
module?: string;
|
|
5
5
|
theme?: boolean;
|
|
@@ -7,6 +7,7 @@ type __VLS_Props = {
|
|
|
7
7
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
8
8
|
name: string;
|
|
9
9
|
module: string;
|
|
10
|
+
uuid: string;
|
|
10
11
|
theme: boolean;
|
|
11
12
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
13
|
export default _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** 路由表的形状(只读用得着的那几个字段,判据与 `MagicBlockConsole.pagesOf()` 同一套)。
|
|
2
|
+
*
|
|
3
|
+
* ⚠️ 对象形式的 `props: { uuid }` 在**记录**里是挂在 `props.default` 上的:`props` 允许按
|
|
4
|
+
* **具名视图**分别给,默认视图那一份的键就是 `default`(`router.getRoutes()` 给的是记录里
|
|
5
|
+
* 那一份,所以读到的是 `props.default.uuid`)。
|
|
6
|
+
*/
|
|
7
|
+
export interface DeclaredRoute {
|
|
8
|
+
path?: string;
|
|
9
|
+
redirect?: unknown;
|
|
10
|
+
components?: Record<string, unknown> | null;
|
|
11
|
+
props?: Record<string, unknown> | string | boolean | null;
|
|
12
|
+
meta?: Record<string, unknown> | null;
|
|
13
|
+
}
|
|
14
|
+
/** 声明了块 uuid 的一条路由(同一个 uuid 只留**第一条**路由 —— 实例页 `/orders/42` 与列表页
|
|
15
|
+
* 是同一个块,列两条只会让人以为那是两个块)。 */
|
|
16
|
+
export interface DeclaredEntry {
|
|
17
|
+
/** 块的身份(= 块包清单里的 `id`,也是路由写死的那个 uuid)。 */
|
|
18
|
+
uuid: string;
|
|
19
|
+
/** 哪条路由声明的(点开那个路径就是这一块)。 */
|
|
20
|
+
path: string;
|
|
21
|
+
/** 路由的中文名(`meta.title`,没有就退到路径)。 */
|
|
22
|
+
title: string;
|
|
23
|
+
/** 路由声明的模块名(`meta.blockUuid` 那一套里的 `meta.module`;没有就是空串)。 */
|
|
24
|
+
module: string;
|
|
25
|
+
/** 路由声明的一句话说明(`meta.brief`;没有就是空串)。 */
|
|
26
|
+
brief: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 这条路由声明了哪个块的 uuid(没有 ⇒ 空串 ⇒ **它不是块路由**)。
|
|
30
|
+
*
|
|
31
|
+
* 🔴 先认 `meta.blockUuid`:uuid 是**身份**,把它写在 `meta` 上就与"传给组件的参数"这件事分开了
|
|
32
|
+
* (`props` 那里放的是渲染参数,可能被 `props: 'uuid'` / `props: true` 这类写法占掉)。
|
|
33
|
+
* 🔴 再退回 `props.default.uuid`:这是本仓库现在的写法(`props: { uuid }`),
|
|
34
|
+
* **不许**顺手取消掉 —— 老应用照旧要认得出来,认不出等于控制台把它们当成"没有块"。
|
|
35
|
+
* ⚠️ **不认 `props` 是字符串 / 布尔**那两种:它们分别是"从路由参数里取那个字段"与"把 query 当 props",
|
|
36
|
+
* 都不是一个写死的 uuid(去解它就得解析路由参数,等于凭空发明一条判据)。
|
|
37
|
+
*/
|
|
38
|
+
export declare function declaredUuidOf(route: DeclaredRoute | null | undefined): string;
|
|
39
|
+
/**
|
|
40
|
+
* 这个应用的路径里,哪些块是**前端声明了**的(顺序 = 路由表顺序,同一个 uuid 只留第一条)。
|
|
41
|
+
*
|
|
42
|
+
* 🔴 只认"挂的是**块页**"那些路由(`page` 由调用方传进来 = `MagicBlockPage`):
|
|
43
|
+
* 与 `pagesOf()` 生成 `pages.lock.ts` 用的是同一条判据(`components.default` 是不是块页),
|
|
44
|
+
* 两处若各写一套,"枚举里有这一页、控制台说它不是块"这种自相矛盾迟早出现。
|
|
45
|
+
* ⚠️ 带参数的路由(`/orders/:id`)与通配路由**照样算**:它声明的是**同一个块**
|
|
46
|
+
* (`props: { uuid }` 对它们一样成立),排掉反而会漏掉"这个块只在实例页上挂着"的应用。
|
|
47
|
+
*/
|
|
48
|
+
export declare function declaredUuidsOf(routes: DeclaredRoute[] | null | undefined, page: unknown): DeclaredEntry[];
|
|
49
|
+
/**
|
|
50
|
+
* 「**不在数据库**」那一条:前端声明了 uuid、`/magic-blocks/index` 里却没有这一行。
|
|
51
|
+
*
|
|
52
|
+
* 🔴 这就是需求 A 的全部判据:**声明集合 − 库里 id 集合**。
|
|
53
|
+
* 它一个字都不碰磁盘 —— 没有这一行不等于"你本机没有那个文件夹"(那个事实只有读回才知道,
|
|
54
|
+
* 见 `export._judge()` 里那条 `not-in-db` 条目)。
|
|
55
|
+
*/
|
|
56
|
+
export declare function declaredMissing(routes: DeclaredRoute[] | null | undefined, page: unknown, dbIds: Iterable<string> | null | undefined): DeclaredEntry[];
|
|
@@ -7,17 +7,8 @@ export declare const MANIFEST_KEYS: readonly ["id", "module", "name", "brief"];
|
|
|
7
7
|
export type ManifestKey = (typeof MANIFEST_KEYS)[number];
|
|
8
8
|
/** 可读名的字符上限(与后端 `NAME_MAX` 同一份)。 */
|
|
9
9
|
export declare const NAME_MAX = 40;
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
* `^(?!/)(?![A-Za-z]:)[A-Za-z0-9._\-/]+$`,而 `/etc/passwd` 是**字符合法但语义是绝对路径** ——
|
|
13
|
-
* 少一个前瞻就等于放行绝对路径(这一条是差分比对抓出来的,见 `tools/manifest-parity.mjs`)。 */
|
|
14
|
-
export declare const FILE_NAME_PATTERN: RegExp;
|
|
15
|
-
/** 清单里 `id` 的形状。 */
|
|
16
|
-
export declare const BLOCK_ID_PATTERN: RegExp;
|
|
17
|
-
/** 清单里 `module` 的形状。 */
|
|
18
|
-
export declare const MODULE_PATTERN: RegExp;
|
|
19
|
-
/** 清单里的键名形状。 */
|
|
20
|
-
export declare const MANIFEST_KEY_PATTERN: RegExp;
|
|
10
|
+
/** 这段**包内相对路径**算不算"你自己的东西"(每一段都看:`excluded/_test.py` ⇒ 算)。 */
|
|
11
|
+
export declare function isExcluded(name: string): boolean;
|
|
21
12
|
/** 清单里 `name` 的形状(🔴 这里**不能只判长度**:`' '` 长度合法但它是空的)。 */
|
|
22
13
|
export declare function validName(value: string): boolean;
|
|
23
14
|
/** 清单解析出来的字段(缺的 / 空的**不会**出现在这里)。 */
|
|
@@ -5,3 +5,4 @@ export { BLOCK_BACKEND_FILE, BLOCK_ENTRY, buildPreview } from './magic-block-pre
|
|
|
5
5
|
export { CLIENT_SOURCE, installBridge, type BridgeDeps } from './magic-block-bridge';
|
|
6
6
|
export { BLOCK_MANIFEST, MANIFEST_KEYS, NAME_MAX, checkSelection, parseManifest, validFileName, validName, validateBlock, type BlockValidation, type Manifest, type ManifestKey, type SelectionCheck, } from './magic-block-manifest';
|
|
7
7
|
export { API_BASE } from './auth-real';
|
|
8
|
+
export { declaredMissing, declaredUuidOf, declaredUuidsOf, type DeclaredEntry, type DeclaredRoute, } from './magic-block-declared';
|