@zhin.js/pagemanager 0.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +86 -0
  2. package/lib/client-build/index.d.ts +6 -0
  3. package/lib/client-build/index.d.ts.map +1 -0
  4. package/lib/client-build/index.js +6 -0
  5. package/lib/client-build/index.js.map +1 -0
  6. package/lib/client-build/manifest-loader.d.ts +9 -0
  7. package/lib/client-build/manifest-loader.d.ts.map +1 -0
  8. package/lib/client-build/manifest-loader.js +47 -0
  9. package/lib/client-build/manifest-loader.js.map +1 -0
  10. package/lib/client-build/module-runtime.d.ts +17 -0
  11. package/lib/client-build/module-runtime.d.ts.map +1 -0
  12. package/lib/client-build/module-runtime.js +28 -0
  13. package/lib/client-build/module-runtime.js.map +1 -0
  14. package/lib/client-build/static-metadata.d.ts +9 -0
  15. package/lib/client-build/static-metadata.d.ts.map +1 -0
  16. package/lib/client-build/static-metadata.js +126 -0
  17. package/lib/client-build/static-metadata.js.map +1 -0
  18. package/lib/client-build/types.d.ts +26 -0
  19. package/lib/client-build/types.d.ts.map +1 -0
  20. package/lib/client-build/types.js +2 -0
  21. package/lib/client-build/types.js.map +1 -0
  22. package/lib/client-build/typescript-builder.d.ts +9 -0
  23. package/lib/client-build/typescript-builder.d.ts.map +1 -0
  24. package/lib/client-build/typescript-builder.js +272 -0
  25. package/lib/client-build/typescript-builder.js.map +1 -0
  26. package/lib/node/esmForBrowser.d.ts.map +1 -1
  27. package/lib/node/esmForBrowser.js +4 -1
  28. package/lib/node/esmForBrowser.js.map +1 -1
  29. package/lib/node/index.d.ts +2 -0
  30. package/lib/node/index.d.ts.map +1 -1
  31. package/lib/node/index.js +2 -0
  32. package/lib/node/index.js.map +1 -1
  33. package/lib/node/pageManager.d.ts +1 -1
  34. package/lib/node/pageManager.d.ts.map +1 -1
  35. package/lib/node/pageManager.js +1 -1
  36. package/lib/node/pageManager.js.map +1 -1
  37. package/lib/plugin-runtime/access.d.ts +8 -0
  38. package/lib/plugin-runtime/access.d.ts.map +1 -0
  39. package/lib/plugin-runtime/access.js +11 -0
  40. package/lib/plugin-runtime/access.js.map +1 -0
  41. package/lib/plugin-runtime/console-catalog.d.ts +28 -0
  42. package/lib/plugin-runtime/console-catalog.d.ts.map +1 -0
  43. package/lib/plugin-runtime/console-catalog.js +102 -0
  44. package/lib/plugin-runtime/console-catalog.js.map +1 -0
  45. package/lib/plugin-runtime/console-runtime.d.ts +10 -0
  46. package/lib/plugin-runtime/console-runtime.d.ts.map +1 -0
  47. package/lib/plugin-runtime/console-runtime.js +26 -0
  48. package/lib/plugin-runtime/console-runtime.js.map +1 -0
  49. package/lib/plugin-runtime/index.d.ts +5 -0
  50. package/lib/plugin-runtime/index.d.ts.map +1 -0
  51. package/lib/plugin-runtime/index.js +5 -0
  52. package/lib/plugin-runtime/index.js.map +1 -0
  53. package/lib/plugin-runtime/navigation.d.ts +4 -0
  54. package/lib/plugin-runtime/navigation.d.ts.map +1 -0
  55. package/lib/plugin-runtime/navigation.js +57 -0
  56. package/lib/plugin-runtime/navigation.js.map +1 -0
  57. package/package.json +40 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-runtime.js","sourceRoot":"","sources":["../../src/plugin-runtime/console-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuB,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAiB,sBAAsB,CAAC,CAAC;AAEvF,MAAM,OAAO,cAAc;IACzB,UAAU,CAAkB;IAE5B,MAAM,CAAC,SAAyB;QAC9B,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAsB,EACtB,SAAkE;QAElE,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAClF,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QACxC,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC;YACH,OAAO,MAAM,SAAS,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAChF,CAAC;gBAAS,CAAC;YACT,MAAM,GAAG,KAAK,CAAC;YACf,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ export * from './access.js';
2
+ export * from './console-catalog.js';
3
+ export * from './console-runtime.js';
4
+ export * from './navigation.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin-runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './access.js';
2
+ export * from './console-catalog.js';
3
+ export * from './console-runtime.js';
4
+ export * from './navigation.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin-runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { NavNode, PageManifest } from '@zhin.js/console-contract';
2
+ import type { RuntimeSnapshot } from '@zhin.js/plugin-runtime';
3
+ export declare function buildNavigation(snapshot: RuntimeSnapshot, pages: readonly Readonly<PageManifest>[]): readonly Readonly<NavNode>[];
4
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/plugin-runtime/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAgC,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE7F,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,SAAS,QAAQ,CAAC,YAAY,CAAC,EAAE,GACvC,SAAS,QAAQ,CAAC,OAAO,CAAC,EAAE,CAiC9B"}
@@ -0,0 +1,57 @@
1
+ export function buildNavigation(snapshot, pages) {
2
+ const byOwner = new Map();
3
+ for (const page of pages) {
4
+ if (page.hideInNav)
5
+ continue;
6
+ const owned = byOwner.get(page.owner) ?? [];
7
+ owned.push(page);
8
+ byOwner.set(page.owner, owned);
9
+ }
10
+ const visit = (id) => {
11
+ const plugin = requiredPlugin(snapshot, id);
12
+ const leaves = (byOwner.get(id) ?? []).map(pageNode);
13
+ const groups = plugin.children
14
+ .map(visit)
15
+ .filter((node) => node !== undefined);
16
+ const children = Object.freeze([...leaves, ...groups].sort(compareNode));
17
+ if (children.length === 0)
18
+ return undefined;
19
+ return Object.freeze({
20
+ id: plugin.id,
21
+ type: 'plugin',
22
+ label: plugin.metadata?.displayName ?? plugin.instanceKey,
23
+ icon: plugin.metadata?.icon,
24
+ order: plugin.metadata?.order ?? 100,
25
+ children,
26
+ });
27
+ };
28
+ const root = requiredPlugin(snapshot, snapshot.root);
29
+ const rootPages = (byOwner.get(snapshot.root) ?? []).map(pageNode);
30
+ const groups = root.children
31
+ .map(visit)
32
+ .filter((node) => node !== undefined);
33
+ return Object.freeze([...rootPages, ...groups].sort(compareNode));
34
+ }
35
+ function pageNode(page) {
36
+ return Object.freeze({
37
+ id: page.id,
38
+ type: 'page',
39
+ label: page.title,
40
+ icon: page.icon,
41
+ path: page.route,
42
+ order: page.order,
43
+ children: Object.freeze([]),
44
+ });
45
+ }
46
+ function compareNode(left, right) {
47
+ return left.order - right.order
48
+ || left.type.localeCompare(right.type)
49
+ || left.id.localeCompare(right.id);
50
+ }
51
+ function requiredPlugin(snapshot, id) {
52
+ const node = snapshot.tree.get(id);
53
+ if (!node)
54
+ throw new Error(`Unknown Plugin in Console tree: ${id}`);
55
+ return node;
56
+ }
57
+ //# sourceMappingURL=navigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/plugin-runtime/navigation.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,eAAe,CAC7B,QAAyB,EACzB,KAAwC;IAExC,MAAM,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;IAClD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,SAAS;YAAE,SAAS;QAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAC5C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,KAAK,GAAG,CAAC,EAAY,EAAiC,EAAE;QAC5D,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ;aAC3B,GAAG,CAAC,KA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EAAE,MAAe;QACrB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,KAAK;QAChB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,IAAa,EAAE,KAAc;IAChD,OAAO,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK;WAC1B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;WACnC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,cAAc,CAAC,QAAyB,EAAE,EAAY;IAC7D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/pagemanager",
3
- "version": "0.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Zhin PageManager Host runtime: entries, esbuild pipeline (no UI; contract in @zhin.js/contract)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,24 +13,48 @@
13
13
  "types": "./lib/node/index.d.ts",
14
14
  "import": "./lib/node/index.js",
15
15
  "default": "./lib/node/index.js"
16
+ },
17
+ "./plugin-runtime": {
18
+ "types": "./lib/plugin-runtime/index.d.ts",
19
+ "development": "./src/plugin-runtime/index.ts",
20
+ "import": "./lib/plugin-runtime/index.js"
21
+ },
22
+ "./client-build": {
23
+ "types": "./lib/client-build/index.d.ts",
24
+ "development": "./src/client-build/index.ts",
25
+ "import": "./lib/client-build/index.js"
16
26
  }
17
27
  },
18
28
  "dependencies": {
19
- "@koa/router": "^15.6.0",
20
- "esbuild": "^0.28.0",
29
+ "@koa/router": "^15.7.0",
30
+ "esbuild": "^0.28.1",
21
31
  "koa": "^3.2.1",
22
32
  "koa-compose": "^4.1.0",
23
33
  "koa-static": "^5.0.0",
24
- "@zhin.js/contract": "1.0.0"
34
+ "@zhin.js/console-contract": "1.1.0",
35
+ "@zhin.js/contract": "1.1.0",
36
+ "@zhin.js/layout": "1.1.0",
37
+ "@zhin.js/page": "1.1.0",
38
+ "@zhin.js/plugin-runtime": "1.1.9"
25
39
  },
26
40
  "devDependencies": {
27
41
  "@types/koa": "^3.0.3",
28
42
  "@types/koa-compose": "^3.2.9",
29
43
  "@types/koa-static": "^4.0.4",
30
- "@types/koa__router": "^12.0.4",
31
- "@types/node": "^25.9.1",
32
- "rimraf": "^6.0.1",
33
- "typescript": "^6.0.2"
44
+ "@types/koa__router": "^12.0.5",
45
+ "@types/node": "^26.1.2",
46
+ "rimraf": "^6.1.3",
47
+ "typescript": "^6.0.3",
48
+ "@zhin.js/feature-kit": "1.1.0",
49
+ "@zhin.js/runtime": "1.1.0"
50
+ },
51
+ "peerDependencies": {
52
+ "typescript": ">=5.8.0 <7.0.0"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "typescript": {
56
+ "optional": true
57
+ }
34
58
  },
35
59
  "files": [
36
60
  "lib"
@@ -41,6 +65,14 @@
41
65
  "url": "git+https://github.com/zhinjs/zhin.git",
42
66
  "directory": "packages/console/pagemanager"
43
67
  },
68
+ "engines": {
69
+ "node": "^20.19.0 || >=22.12.0"
70
+ },
71
+ "author": {
72
+ "name": "lc-cn",
73
+ "email": "admin@liucl.cn",
74
+ "url": "https://github.com/lc-cn"
75
+ },
44
76
  "scripts": {
45
77
  "build": "tsc -p tsconfig.json",
46
78
  "build:node": "tsc -p tsconfig.json",