@jskit-ai/console-web 0.1.33 → 0.1.34

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,7 +1,7 @@
1
1
  export default Object.freeze({
2
2
  packageVersion: 1,
3
3
  packageId: "@jskit-ai/console-web",
4
- version: "0.1.33",
4
+ version: "0.1.34",
5
5
  kind: "runtime",
6
6
  description: "Authenticated console surface scaffold and surface policy wiring.",
7
7
  dependsOn: [
@@ -43,27 +43,56 @@ export default Object.freeze({
43
43
  outlets: [
44
44
  {
45
45
  target: "console-settings:primary-menu",
46
- defaultLinkComponentToken: "local.main.ui.surface-aware-menu-link-item",
47
46
  surfaces: ["console"],
48
47
  source: "templates/src/pages/console/settings.vue"
49
48
  }
50
49
  ],
50
+ topology: {
51
+ placements: [
52
+ {
53
+ id: "page.section-nav",
54
+ owner: "console-settings",
55
+ description: "Navigation between console settings child pages.",
56
+ surfaces: ["console"],
57
+ variants: {
58
+ compact: {
59
+ outlet: "console-settings:primary-menu",
60
+ renderers: {
61
+ link: "local.main.ui.surface-aware-menu-link-item"
62
+ }
63
+ },
64
+ medium: {
65
+ outlet: "console-settings:primary-menu",
66
+ renderers: {
67
+ link: "local.main.ui.surface-aware-menu-link-item"
68
+ }
69
+ },
70
+ expanded: {
71
+ outlet: "console-settings:primary-menu",
72
+ renderers: {
73
+ link: "local.main.ui.surface-aware-menu-link-item"
74
+ }
75
+ }
76
+ }
77
+ }
78
+ ]
79
+ },
51
80
  contributions: [
52
81
  {
53
82
  id: "console.web.profile.menu.console",
54
- target: "auth-profile-menu:primary-menu",
83
+ target: "auth.profile-menu",
84
+ kind: "link",
55
85
  surfaces: ["*"],
56
86
  order: 600,
57
- componentToken: "auth.web.profile.menu.link-item",
58
87
  when: "auth.authenticated === true && surfaceAccess.consoleowner === true && surface !== \"console\"",
59
88
  source: "mutations.text#console-web-profile-menu-console-placement"
60
89
  },
61
90
  {
62
91
  id: "console.web.menu.settings",
63
- target: "shell-layout:primary-menu",
92
+ target: "shell.primary-nav",
93
+ kind: "link",
64
94
  surfaces: ["console"],
65
95
  order: 100,
66
- componentToken: "local.main.ui.menu-link-item",
67
96
  when: "auth.authenticated === true",
68
97
  source: "mutations.text#console-web-console-settings-placement"
69
98
  }
@@ -74,9 +103,9 @@ export default Object.freeze({
74
103
  mutations: {
75
104
  dependencies: {
76
105
  runtime: {
77
- "@jskit-ai/auth-web": "0.1.66",
78
- "@jskit-ai/console-core": "0.1.28",
79
- "@jskit-ai/shell-web": "0.1.64",
106
+ "@jskit-ai/auth-web": "0.1.67",
107
+ "@jskit-ai/console-core": "0.1.29",
108
+ "@jskit-ai/shell-web": "0.1.65",
80
109
  },
81
110
  dev: {}
82
111
  },
@@ -154,7 +183,7 @@ export default Object.freeze({
154
183
  position: "bottom",
155
184
  skipIfContains: "id: \"console.web.profile.menu.console\"",
156
185
  value:
157
- "\naddPlacement({\n id: \"console.web.profile.menu.console\",\n target: \"auth-profile-menu:primary-menu\",\n surfaces: [\"*\"],\n order: 600,\n componentToken: \"auth.web.profile.menu.link-item\",\n props: {\n label: \"Go to console\",\n to: \"/console\",\n icon: \"mdi-console-network-outline\"\n },\n when: ({ auth, surfaceAccess, surface }) => {\n return auth?.authenticated === true && surfaceAccess?.consoleowner === true && surface !== \"console\";\n }\n});\n",
186
+ "\naddPlacement({\n id: \"console.web.profile.menu.console\",\n target: \"auth.profile-menu\",\n kind: \"link\",\n surfaces: [\"*\"],\n order: 600,\n props: {\n label: \"Go to console\",\n to: \"/console\",\n icon: \"mdi-console-network-outline\"\n },\n when: ({ auth, surfaceAccess, surface }) => {\n return auth?.authenticated === true && surfaceAccess?.consoleowner === true && surface !== \"console\";\n }\n});\n",
158
187
  reason: "Append owner-only console navigation entry into the authenticated profile menu outside the console surface.",
159
188
  category: "console-web",
160
189
  id: "console-web-profile-menu-console-placement"
@@ -165,10 +194,21 @@ export default Object.freeze({
165
194
  position: "bottom",
166
195
  skipIfContains: "id: \"console.web.menu.settings\"",
167
196
  value:
168
- "\naddPlacement({\n id: \"console.web.menu.settings\",\n target: \"shell-layout:primary-menu\",\n surfaces: [\"console\"],\n order: 100,\n componentToken: \"local.main.ui.menu-link-item\",\n props: {\n label: \"Settings\",\n to: \"/console/settings\",\n icon: \"mdi-cog-outline\"\n },\n when: ({ auth }) => auth?.authenticated === true\n});\n",
197
+ "\naddPlacement({\n id: \"console.web.menu.settings\",\n target: \"shell.primary-nav\",\n kind: \"link\",\n surfaces: [\"console\"],\n order: 100,\n props: {\n label: \"Settings\",\n to: \"/console/settings\",\n icon: \"mdi-cog-outline\"\n },\n when: ({ auth }) => auth?.authenticated === true\n});\n",
169
198
  reason: "Append console-web settings menu placement into app-owned placement registry.",
170
199
  category: "console-web",
171
200
  id: "console-web-console-settings-placement"
201
+ },
202
+ {
203
+ op: "append-text",
204
+ file: "src/placementTopology.js",
205
+ position: "bottom",
206
+ skipIfContains: "owner: \"console-settings\"",
207
+ value:
208
+ "\naddPlacementTopology({\n id: \"page.section-nav\",\n owner: \"console-settings\",\n description: \"Navigation between console settings child pages.\",\n surfaces: [\"console\"],\n variants: {\n compact: {\n outlet: \"console-settings:primary-menu\",\n renderers: {\n link: \"local.main.ui.surface-aware-menu-link-item\"\n }\n },\n medium: {\n outlet: \"console-settings:primary-menu\",\n renderers: {\n link: \"local.main.ui.surface-aware-menu-link-item\"\n }\n },\n expanded: {\n outlet: \"console-settings:primary-menu\",\n renderers: {\n link: \"local.main.ui.surface-aware-menu-link-item\"\n }\n }\n }\n});\n",
209
+ reason: "Append console settings semantic topology into app-owned placement topology.",
210
+ category: "console-web",
211
+ id: "console-web-settings-placement-topology"
172
212
  }
173
213
  ]
174
214
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@jskit-ai/console-web",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test"
7
7
  },
8
8
  "dependencies": {
9
- "@jskit-ai/auth-web": "0.1.66",
10
- "@jskit-ai/console-core": "0.1.28",
11
- "@jskit-ai/shell-web": "0.1.64"
9
+ "@jskit-ai/auth-web": "0.1.67",
10
+ "@jskit-ai/console-core": "0.1.29",
11
+ "@jskit-ai/shell-web": "0.1.65"
12
12
  }
13
13
  }
@@ -15,10 +15,7 @@ import { RouterView } from "vue-router";
15
15
  <v-row no-gutters>
16
16
  <v-col cols="12" md="3" lg="2" class="pr-md-4 mb-4 mb-md-0">
17
17
  <v-list nav density="comfortable" rounded="lg" border>
18
- <ShellOutlet
19
- target="console-settings:primary-menu"
20
- default-link-component-token="local.main.ui.surface-aware-menu-link-item"
21
- />
18
+ <ShellOutlet target="console-settings:primary-menu" />
22
19
  </v-list>
23
20
  </v-col>
24
21
 
@@ -22,6 +22,34 @@ function findTextMutation(id) {
22
22
  : null;
23
23
  }
24
24
 
25
+ function readOutlets(target = "") {
26
+ const outlets = descriptor?.metadata?.ui?.placements?.outlets;
27
+ const normalizedTarget = String(target || "").trim();
28
+ return Array.isArray(outlets)
29
+ ? outlets.filter((entry) => String(entry?.target || "").trim() === normalizedTarget)
30
+ : [];
31
+ }
32
+
33
+ function findTopology(id, owner = "") {
34
+ const placements = descriptor?.metadata?.ui?.placements?.topology?.placements;
35
+ const normalizedId = String(id || "").trim();
36
+ const normalizedOwner = String(owner || "").trim();
37
+ return Array.isArray(placements)
38
+ ? placements.find((entry) => {
39
+ const entryId = String(entry?.id || "").trim();
40
+ const entryOwner = String(entry?.owner || "").trim();
41
+ return entryId === normalizedId && entryOwner === normalizedOwner;
42
+ }) || null
43
+ : null;
44
+ }
45
+
46
+ function findContribution(id) {
47
+ const contributions = descriptor?.metadata?.ui?.placements?.contributions;
48
+ return Array.isArray(contributions)
49
+ ? contributions.find((entry) => String(entry?.id || "").trim() === id) || null
50
+ : null;
51
+ }
52
+
25
53
  test("console-web installs console surface scripts and files", () => {
26
54
  assert.deepEqual(descriptor?.mutations?.packageJson?.scripts, {
27
55
  "server:console": "SERVER_SURFACE=console node ./bin/server.js",
@@ -82,6 +110,49 @@ test("console-web wires console surface policy into app config", () => {
82
110
  /surfaceAccess\?\.consoleowner === true && surface !== "console"/
83
111
  );
84
112
  assert.equal(findTextMutation("console-web-console-settings-placement")?.file, "src/placement.js");
113
+ assert.equal(findTextMutation("console-web-settings-placement-topology")?.file, "src/placementTopology.js");
114
+ assert.deepEqual(readOutlets("console-settings:primary-menu"), [
115
+ {
116
+ target: "console-settings:primary-menu",
117
+ surfaces: ["console"],
118
+ source: "templates/src/pages/console/settings.vue"
119
+ }
120
+ ]);
121
+ assert.deepEqual(findTopology("page.section-nav", "console-settings"), {
122
+ id: "page.section-nav",
123
+ owner: "console-settings",
124
+ description: "Navigation between console settings child pages.",
125
+ surfaces: ["console"],
126
+ variants: {
127
+ compact: {
128
+ outlet: "console-settings:primary-menu",
129
+ renderers: {
130
+ link: "local.main.ui.surface-aware-menu-link-item"
131
+ }
132
+ },
133
+ medium: {
134
+ outlet: "console-settings:primary-menu",
135
+ renderers: {
136
+ link: "local.main.ui.surface-aware-menu-link-item"
137
+ }
138
+ },
139
+ expanded: {
140
+ outlet: "console-settings:primary-menu",
141
+ renderers: {
142
+ link: "local.main.ui.surface-aware-menu-link-item"
143
+ }
144
+ }
145
+ }
146
+ });
147
+ assert.deepEqual(findContribution("console.web.menu.settings"), {
148
+ id: "console.web.menu.settings",
149
+ target: "shell.primary-nav",
150
+ kind: "link",
151
+ surfaces: ["console"],
152
+ order: 100,
153
+ when: "auth.authenticated === true",
154
+ source: "mutations.text#console-web-console-settings-placement"
155
+ });
85
156
  });
86
157
 
87
158
  test("console-web console templates stay shell-driven", async () => {
@@ -94,7 +165,7 @@ test("console-web console templates stay shell-driven", async () => {
94
165
  assert.match(wrapperSource, /"surface": "console"/);
95
166
  assert.match(indexSource, /Operations Console/);
96
167
  assert.match(settingsSource, /target="console-settings:primary-menu"/);
97
- assert.match(settingsSource, /default-link-component-token="local\.main\.ui\.surface-aware-menu-link-item"/);
168
+ assert.doesNotMatch(settingsSource, /default-link-component-token/);
98
169
  assert.match(settingsSource, /<RouterView \/>/);
99
170
  assert.match(settingsIndexSource, /definePage/);
100
171
  assert.match(settingsIndexSource, /your_child_segment/);