@supersoniks/concorde 4.5.2 → 4.7.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 (185) hide show
  1. package/.gitlab-ci.yml +23 -0
  2. package/README.md +106 -55
  3. package/ai/AGENTS.md +52 -0
  4. package/ai/README.md +30 -0
  5. package/ai/cursor/rules/concorde-menu.mdc +15 -0
  6. package/ai/cursor/rules/concorde-scope.mdc +14 -0
  7. package/ai/cursor/rules/concorde-theme.mdc +13 -0
  8. package/ai/cursor/rules/concorde.mdc +49 -0
  9. package/ai/jetbrains/rules/concorde.md +39 -0
  10. package/ai/skills/concorde/SKILL.md +220 -0
  11. package/ai/skills/concorde-get-set-dp/SKILL.md +194 -0
  12. package/ai/skills/concorde-imports/SKILL.md +78 -0
  13. package/ai/skills/concorde-menu/SKILL.md +74 -0
  14. package/ai/skills/concorde-scope/SKILL.md +70 -0
  15. package/ai/skills/concorde-theme/SKILL.md +46 -0
  16. package/build-infos.json +1 -1
  17. package/concorde-core.bundle.js +159 -159
  18. package/concorde-core.es.js +1915 -1809
  19. package/dist/altcha-widget.js +2662 -0
  20. package/dist/concorde-core.bundle.js +159 -159
  21. package/dist/concorde-core.es.js +1915 -1809
  22. package/dist/docs-mock-api-sw.js +589 -0
  23. package/dist/docs-mock-api-sw.js.map +7 -0
  24. package/docs/altcha-widget.js +2662 -0
  25. package/docs/assets/index-D9pxaQYK.js +7508 -0
  26. package/docs/assets/index-t0-i22oI.css +1 -0
  27. package/docs/docs-mock-api-sw.js +589 -0
  28. package/docs/docs-mock-api-sw.js.map +7 -0
  29. package/docs/index.html +2 -2
  30. package/docs/src/core/components/functional/fetch/fetch.md +13 -11
  31. package/docs/src/core/components/functional/if/if.md +4 -11
  32. package/docs/src/core/components/functional/list/list.md +60 -194
  33. package/docs/src/core/components/functional/queue/queue.md +70 -85
  34. package/docs/src/core/components/functional/router/router.md +62 -97
  35. package/docs/src/core/components/functional/states/states.md +2 -2
  36. package/docs/src/core/components/functional/submit/submit.md +86 -55
  37. package/docs/src/core/components/ui/captcha/captcha.md +2 -2
  38. package/docs/src/core/components/ui/card/card.md +1 -1
  39. package/docs/src/core/components/ui/form/checkbox/checkbox.md +5 -32
  40. package/docs/src/core/components/ui/form/input/input.md +5 -30
  41. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +6 -4
  42. package/docs/src/core/components/ui/form/radio/radio.md +5 -32
  43. package/docs/src/core/components/ui/form/select/select.md +5 -31
  44. package/docs/src/core/components/ui/form/switch/switch.md +5 -32
  45. package/docs/src/core/components/ui/loader/loader.md +1 -13
  46. package/docs/src/core/components/ui/table/table.md +3 -3
  47. package/docs/src/docs/_core-concept/dataFlow.md +73 -0
  48. package/docs/src/docs/_core-concept/subscriber.md +9 -10
  49. package/docs/src/docs/_decorators/ancestor-attribute.md +4 -3
  50. package/docs/src/docs/_decorators/auto-subscribe.md +19 -16
  51. package/docs/src/docs/_decorators/bind.md +20 -17
  52. package/docs/src/docs/_decorators/get.md +7 -4
  53. package/docs/src/docs/_decorators/handle.md +171 -0
  54. package/docs/src/docs/_decorators/on-assign.md +99 -73
  55. package/docs/src/docs/_decorators/publish.md +2 -1
  56. package/docs/src/docs/_decorators/subscribe.md +70 -9
  57. package/docs/src/docs/_decorators/wait-for-ancestors.md +13 -10
  58. package/docs/src/docs/_directives/sub.md +91 -0
  59. package/docs/src/docs/_getting-started/ai-agents.md +56 -0
  60. package/docs/src/docs/_getting-started/concorde-manual-install.md +133 -0
  61. package/docs/src/docs/_getting-started/concorde-outside.md +13 -123
  62. package/docs/src/docs/_getting-started/create-a-component.md +2 -0
  63. package/docs/src/docs/_getting-started/my-first-component.md +236 -0
  64. package/docs/src/docs/_getting-started/my-first-subscriber.md +29 -83
  65. package/docs/src/docs/_getting-started/pubsub.md +21 -134
  66. package/docs/src/docs/_getting-started/start.md +26 -18
  67. package/docs/src/docs/_misc/api-configuration.md +79 -0
  68. package/docs/src/docs/_misc/dataProviderKey.md +38 -5
  69. package/docs/src/docs/_misc/docs-mock-api.md +60 -0
  70. package/docs/src/docs/_misc/endpoint.md +2 -1
  71. package/docs/src/docs/_misc/html-integration.md +13 -0
  72. package/docs/src/docs/search/docs-search.json +4163 -873
  73. package/docs/src/tsconfig.json +380 -317
  74. package/gitlab/job_tests.sh +55 -0
  75. package/package.json +37 -3
  76. package/public/altcha-widget.js +2662 -0
  77. package/public/docs-mock-api-sw.js +589 -0
  78. package/public/docs-mock-api-sw.js.map +7 -0
  79. package/scripts/ai-init.mjs +167 -0
  80. package/scripts/docs-mock-api-vite-plugin.ts +116 -0
  81. package/scripts/docs-open-in-editor-plugin.ts +130 -0
  82. package/scripts/pre-publish.mjs +2 -1
  83. package/src/core/components/functional/example/example.ts +1 -1
  84. package/src/core/components/functional/fetch/fetch.md +13 -11
  85. package/src/core/components/functional/if/if.md +4 -11
  86. package/src/core/components/functional/list/list.demo.ts +4 -4
  87. package/src/core/components/functional/list/list.md +60 -194
  88. package/src/core/components/functional/list/list.ts +8 -7
  89. package/src/core/components/functional/queue/queue.demo.ts +1 -1
  90. package/src/core/components/functional/queue/queue.md +70 -85
  91. package/src/core/components/functional/queue/queue.ts +4 -4
  92. package/src/core/components/functional/router/router.md +62 -97
  93. package/src/core/components/functional/router/router.ts +1 -1
  94. package/src/core/components/functional/states/states.md +2 -2
  95. package/src/core/components/functional/submit/submit.md +86 -55
  96. package/src/core/components/functional/submit/submit.ts +10 -3
  97. package/src/core/components/ui/captcha/captcha.md +2 -2
  98. package/src/core/components/ui/card/card.md +1 -1
  99. package/src/core/components/ui/form/checkbox/checkbox.md +5 -32
  100. package/src/core/components/ui/form/input/input.md +5 -30
  101. package/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +6 -4
  102. package/src/core/components/ui/form/radio/radio.md +5 -32
  103. package/src/core/components/ui/form/select/select.md +5 -31
  104. package/src/core/components/ui/form/switch/switch.md +5 -32
  105. package/src/core/components/ui/loader/loader.md +1 -13
  106. package/src/core/components/ui/table/table.md +3 -3
  107. package/src/core/decorators/Subscriber.ts +2 -0
  108. package/src/core/decorators/subscriber/handle.disambig.spec.ts +20 -0
  109. package/src/core/decorators/subscriber/handle.skip.spec.ts +37 -0
  110. package/src/core/decorators/subscriber/handle.ts +128 -0
  111. package/src/core/decorators/subscriber/onAssign.ts +94 -4
  112. package/src/core/directives/DataProvider.sub.spec.ts +96 -0
  113. package/src/core/directives/DataProvider.ts +109 -40
  114. package/src/core/utils/PublisherProxy.ts +33 -18
  115. package/src/core/utils/dataProviderKey.ts +23 -0
  116. package/src/core/utils/publisherPathKey.spec.ts +58 -0
  117. package/src/decorators.ts +6 -0
  118. package/src/docs/_core-concept/dataFlow.md +73 -0
  119. package/src/docs/_core-concept/subscriber.md +9 -10
  120. package/src/docs/_decorators/ancestor-attribute.md +4 -3
  121. package/src/docs/_decorators/auto-subscribe.md +19 -16
  122. package/src/docs/_decorators/bind.md +20 -17
  123. package/src/docs/_decorators/get.md +7 -4
  124. package/src/docs/_decorators/handle.md +171 -0
  125. package/src/docs/_decorators/on-assign.md +99 -47
  126. package/src/docs/_decorators/publish.md +2 -1
  127. package/src/docs/_decorators/subscribe.md +70 -9
  128. package/src/docs/_decorators/wait-for-ancestors.md +13 -10
  129. package/src/docs/_directives/sub.md +91 -0
  130. package/src/docs/_getting-started/ai-agents.md +56 -0
  131. package/src/docs/_getting-started/concorde-manual-install.md +133 -0
  132. package/src/docs/_getting-started/concorde-outside.md +13 -123
  133. package/src/docs/_getting-started/create-a-component.md +2 -0
  134. package/src/docs/_getting-started/my-first-component.md +236 -0
  135. package/src/docs/_getting-started/my-first-subscriber.md +29 -83
  136. package/src/docs/_getting-started/pubsub.md +21 -134
  137. package/src/docs/_getting-started/start.md +26 -18
  138. package/src/docs/_misc/api-configuration.md +79 -0
  139. package/src/docs/_misc/dataProviderKey.md +38 -5
  140. package/src/docs/_misc/docs-mock-api.md +60 -0
  141. package/src/docs/_misc/endpoint.md +2 -1
  142. package/src/docs/_misc/html-integration.md +13 -0
  143. package/src/docs/code.ts +58 -12
  144. package/src/docs/components/docs-demo-sources.ts +397 -0
  145. package/src/docs/components/docs-lit-demo-raw.ts +28 -0
  146. package/src/docs/components/docs-lit-demo.ts +166 -0
  147. package/src/docs/components/docs-source-link.ts +72 -0
  148. package/src/docs/docs-location.ts +54 -0
  149. package/src/docs/docs.ts +12 -0
  150. package/src/docs/example/decorators-demo-bind-demos.ts +41 -46
  151. package/src/docs/example/decorators-demo-geo.ts +16 -11
  152. package/src/docs/example/decorators-demo-init.ts +2 -228
  153. package/src/docs/example/decorators-demo-subscribe-publish-get-demos.ts +142 -12
  154. package/src/docs/example/decorators-demo.ts +71 -70
  155. package/src/docs/example/docs-api-config-demos.ts +234 -0
  156. package/src/docs/example/docs-joke-demos.ts +297 -0
  157. package/src/docs/example/docs-list-demos.ts +179 -0
  158. package/src/docs/example/docs-provider-keys.ts +315 -0
  159. package/src/docs/example/docs-queue-demos.ts +114 -0
  160. package/src/docs/example/docs-router-demos.ts +89 -0
  161. package/src/docs/example/docs-submit-demos.ts +455 -0
  162. package/src/docs/example/docs-toggle-demos.ts +73 -0
  163. package/src/docs/example/docs-user-two-scopes.ts +37 -0
  164. package/src/docs/example/docs-users-list.ts +71 -0
  165. package/src/docs/example/users.ts +41 -24
  166. package/src/docs/mock-api/api-config-mock.ts +152 -0
  167. package/src/docs/mock-api/fixtures.ts +377 -0
  168. package/src/docs/mock-api/register.ts +25 -0
  169. package/src/docs/mock-api/router.ts +234 -0
  170. package/src/docs/mock-api/service-worker.ts +23 -0
  171. package/src/docs/mock-api/urls.ts +11 -0
  172. package/src/docs/navigation/navigation.ts +43 -7
  173. package/src/docs/search/docs-search.json +4193 -858
  174. package/src/docs/search/markdown-renderer.ts +7 -3
  175. package/src/docs/search/page.ts +11 -14
  176. package/src/docs/search/sonic-code-markdown.spec.ts +29 -0
  177. package/src/docs/search/sonic-code-markdown.ts +28 -0
  178. package/src/docs.ts +4 -0
  179. package/src/tsconfig.json +96 -0
  180. package/src/tsconfig.tsbuildinfo +1 -1
  181. package/vite.config.mts +8 -0
  182. package/docs/assets/index-CaysOMFz.js +0 -5046
  183. package/docs/assets/index-D8mGoXzF.css +0 -1
  184. package/docs/src/docs/_misc/templates-demo.md +0 -19
  185. package/src/docs/_misc/templates-demo.md +0 -19
@@ -0,0 +1,54 @@
1
+ /** Doc page hash for `router.md` (markdown anchor, before demo sub-routes). */
2
+ export const DOC_ROUTER_PAGE_HASH =
3
+ "#core/components/functional/router/router.md/router";
4
+
5
+ /**
6
+ * Doc site hash: `#<markdown-path>/<page-anchor>[#<in-page-demo-route>]`
7
+ * e.g. `#core/.../router.md/router#home` — second `#` is for sonic-router demos only.
8
+ */
9
+ export function parseDocsLocation(location: string): {
10
+ /** Path for markdown fetch (no leading `#`). */
11
+ url: string;
12
+ /** Page anchor (last segment before demo sub-hash). */
13
+ anchor: string;
14
+ /** In-page route segment after a second `#` (router demos). */
15
+ demoSubHash: string;
16
+ /** Full doc page hash including anchor, without demo sub-hash. */
17
+ pageHash: string;
18
+ } {
19
+ const sharpIdx = location.indexOf("#");
20
+ if (sharpIdx < 0) {
21
+ return { url: "", anchor: "", demoSubHash: "", pageHash: "" };
22
+ }
23
+
24
+ let hashBody = location.substring(sharpIdx + 1);
25
+ let demoSubHash = "";
26
+ const nested = hashBody.lastIndexOf("#");
27
+ if (nested > 0) {
28
+ demoSubHash = hashBody.substring(nested + 1);
29
+ hashBody = hashBody.substring(0, nested);
30
+ }
31
+
32
+ const parts = hashBody.split("/").filter(Boolean);
33
+ const anchor = decodeURIComponent(parts.pop() || "");
34
+ const url = parts.join("/");
35
+
36
+ return {
37
+ url,
38
+ anchor,
39
+ demoSubHash,
40
+ pageHash: hashBody ? `#${hashBody}` : "",
41
+ };
42
+ }
43
+
44
+ /** Navigate inside the current doc page without reloading markdown. */
45
+ export function setDocsDemoSubHash(subRoute: string, pageHash?: string): void {
46
+ const loc = document.location;
47
+ const base =
48
+ pageHash ||
49
+ parseDocsLocation(loc.pathname + loc.search + loc.hash).pageHash ||
50
+ loc.hash;
51
+ const sub = subRoute.replace(/^#/, "");
52
+ const nextHash = sub ? `${base}#${sub}` : base;
53
+ history.replaceState(history.state, "", `${loc.pathname}${loc.search}${nextHash}`);
54
+ }
package/src/docs/docs.ts CHANGED
@@ -1,8 +1,20 @@
1
+ import "./example/docs-provider-keys";
1
2
  import "./layout";
2
3
  import "./search/search";
3
4
  import "./search/page";
4
5
  import "./search/markdown-renderer";
5
6
  import "./code";
7
+ import "./components/docs-demo-sources";
8
+ import "./components/docs-lit-demo";
6
9
  import "./header/header";
7
10
  import "./navigation/navigation";
8
11
  import "./example/users";
12
+ import "./example/docs-users-list";
13
+ import "./example/docs-user-two-scopes";
14
+ import "./example/docs-joke-demos";
15
+ import "./example/docs-queue-demos";
16
+ import "./example/docs-toggle-demos";
17
+ import "./example/docs-list-demos";
18
+ import "./example/docs-router-demos";
19
+ import "./example/docs-submit-demos";
20
+ import "./example/docs-api-config-demos";
@@ -3,11 +3,13 @@ import { customElement, property, state } from "lit/decorators.js";
3
3
  import { bind } from "@supersoniks/concorde/decorators";
4
4
  import { DataProviderKey } from "@supersoniks/concorde/core/utils/dataProviderKey";
5
5
  import { sub } from "@supersoniks/concorde/directives";
6
+ import { get, set } from "@supersoniks/concorde/core/utils/PublisherProxy";
6
7
  import {
7
- PublisherManager,
8
- PublisherProxy,
9
- } from "@supersoniks/concorde/core/utils/PublisherProxy";
10
- import { Objects } from "@supersoniks/concorde/utils";
8
+ bindReflectDemoKey,
9
+ demoDataKey,
10
+ demoUsersAltKey,
11
+ demoUsersKey,
12
+ } from "./docs-provider-keys";
11
13
  import { tailwind } from "../tailwind";
12
14
  import "./decorators-demo-init";
13
15
 
@@ -41,14 +43,14 @@ export class DemoBind extends LitElement {
41
43
  }
42
44
 
43
45
  updateData() {
44
- const demoData = PublisherManager.get("demoData");
45
- const demoUsers = PublisherManager.get("demoUsers");
46
- const randomIndex = Math.floor(Math.random() * demoUsers.get().length);
47
- const randomUser = demoUsers.get()[randomIndex];
48
- demoData.set({
49
- firstName: randomUser.firstName,
50
- lastName: randomUser.lastName,
51
- count: (demoData.count.get() || 0) + 1,
46
+ const users = get(demoUsersKey);
47
+ const randomIndex = Math.floor(Math.random() * users.length);
48
+ const randomUser = users[randomIndex];
49
+ const data = get(demoDataKey);
50
+ set(demoDataKey, {
51
+ ...data,
52
+ count: data.count + 1,
53
+ user: { name: `${randomUser.firstName} ${randomUser.lastName}` },
52
54
  });
53
55
  }
54
56
  }
@@ -71,7 +73,7 @@ export class DemoBindReflect extends LitElement {
71
73
  }
72
74
 
73
75
  resetData() {
74
- PublisherManager.get("bindReflectDemo").set({ count: 0 });
76
+ set(bindReflectDemoKey, { count: 0 });
75
77
  }
76
78
  render() {
77
79
  return html`
@@ -91,11 +93,6 @@ export class DemoBindReflect extends LitElement {
91
93
  }
92
94
  }
93
95
 
94
- type BindReflectDemoData = { count: number };
95
- const bindReflectDemoKey = new DataProviderKey<BindReflectDemoData>(
96
- "bindReflectDemo",
97
- );
98
-
99
96
  @customElement("demo-bind-key")
100
97
  export class DemoBindKey extends LitElement {
101
98
  static styles = [tailwind];
@@ -106,7 +103,7 @@ export class DemoBindKey extends LitElement {
106
103
 
107
104
  connectedCallback() {
108
105
  super.connectedCallback();
109
- PublisherManager.get("bindReflectDemo").set({ count: 0 });
106
+ set(bindReflectDemoKey, { count: 0 });
110
107
  }
111
108
 
112
109
  render() {
@@ -126,7 +123,8 @@ export class DemoBindDynamic extends LitElement {
126
123
  static styles = [tailwind];
127
124
 
128
125
  @property({ type: String })
129
- dataProvider: "demoUsers" | "demoUsersAlt" = "demoUsers";
126
+ dataProvider: typeof demoUsersKey.path | typeof demoUsersAltKey.path =
127
+ demoUsersKey.path;
130
128
 
131
129
  @property({ type: Number })
132
130
  userIndex: number = 1;
@@ -141,36 +139,33 @@ export class DemoBindDynamic extends LitElement {
141
139
 
142
140
  updateDataProvider(e: Event) {
143
141
  this.dataProvider = (e.target as HTMLSelectElement).value as
144
- | "demoUsers"
145
- | "demoUsersAlt";
142
+ | typeof demoUsersKey.path
143
+ | typeof demoUsersAltKey.path;
146
144
  }
147
145
 
148
146
  updateCurrentUserData() {
149
- const usersPublisher = PublisherManager.get(this.dataProvider);
150
- const userPublisher = Objects.traverse(usersPublisher, [
151
- String(this.userIndex),
152
- ]) as PublisherProxy;
153
-
154
- if (userPublisher) {
155
- const randomNames = [
156
- { firstName: "Alice", lastName: "Wonder" },
157
- { firstName: "Bob", lastName: "Builder" },
158
- { firstName: "Charlie", lastName: "Chaplin" },
159
- { firstName: "Diana", lastName: "Prince" },
160
- { firstName: "Eve", lastName: "Adams" },
161
- ];
162
-
163
- const randomName =
164
- randomNames[Math.floor(Math.random() * randomNames.length)];
165
- const randomEmail = `${randomName.firstName.toLowerCase()}.${randomName.lastName.toLowerCase()}@example.com`;
166
-
167
- const currentUser = userPublisher.get() || {};
168
- userPublisher.set({
169
- ...currentUser,
147
+ const key =
148
+ this.dataProvider === demoUsersAltKey.path ? demoUsersAltKey : demoUsersKey;
149
+ const users = [...get(key)];
150
+ const randomNames = [
151
+ { firstName: "Alice", lastName: "Wonder" },
152
+ { firstName: "Bob", lastName: "Builder" },
153
+ { firstName: "Charlie", lastName: "Chaplin" },
154
+ { firstName: "Diana", lastName: "Prince" },
155
+ { firstName: "Eve", lastName: "Adams" },
156
+ ];
157
+ const randomName =
158
+ randomNames[Math.floor(Math.random() * randomNames.length)];
159
+ const randomEmail = `${randomName.firstName.toLowerCase()}.${randomName.lastName.toLowerCase()}@example.com`;
160
+ const idx = this.userIndex;
161
+ if (users[idx]) {
162
+ users[idx] = {
163
+ ...users[idx],
170
164
  firstName: randomName.firstName,
171
165
  lastName: randomName.lastName,
172
166
  email: randomEmail,
173
- });
167
+ };
168
+ set(key, users);
174
169
  }
175
170
  }
176
171
 
@@ -182,8 +177,8 @@ export class DemoBindDynamic extends LitElement {
182
177
  label="Users set"
183
178
  @change=${this.updateDataProvider}
184
179
  >
185
- <option value="demoUsers">First set of users</option>
186
- <option value="demoUsersAlt">Second set of users</option>
180
+ <option value=${demoUsersKey.path}>First set of users</option>
181
+ <option value=${demoUsersAltKey.path}>Second set of users</option>
187
182
  </sonic-select>
188
183
  <sonic-input
189
184
  type="number"
@@ -2,13 +2,14 @@ import type { APIConfiguration } from "@supersoniks/concorde/core/utils/api";
2
2
  import type { ApiGetResult } from "@supersoniks/concorde/core/utils/api";
3
3
  import { Endpoint } from "@supersoniks/concorde/core/utils/endpoint";
4
4
  import { DataProviderKey } from "@supersoniks/concorde/core/utils/dataProviderKey";
5
- import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
5
+ import { get, set } from "@supersoniks/concorde/core/utils/PublisherProxy";
6
6
  import "./decorators-demo-init";
7
+ import { DOCS_MOCK_GEO_SERVICE } from "../mock-api/urls";
7
8
 
8
9
  export type GeoCommuneRow = { nom: string; code: string };
9
10
 
10
11
  export const geoApiDemoConfiguration: APIConfiguration = {
11
- serviceURL: "https://geo.api.gouv.fr/",
12
+ serviceURL: DOCS_MOCK_GEO_SERVICE,
12
13
  token: null,
13
14
  userName: null,
14
15
  password: null,
@@ -16,13 +17,10 @@ export const geoApiDemoConfiguration: APIConfiguration = {
16
17
  tokenProvider: null,
17
18
  };
18
19
 
19
- const docsDemoGeoApiConfigurationId = "docsDemoGeoApiConfiguration";
20
- PublisherManager.get(docsDemoGeoApiConfigurationId).set(
21
- geoApiDemoConfiguration,
22
- );
23
-
24
20
  export const docsDemoGeoApiConfigurationKey =
25
- new DataProviderKey<APIConfiguration>(docsDemoGeoApiConfigurationId);
21
+ new DataProviderKey<APIConfiguration>("docsDemoGeoApiConfiguration");
22
+
23
+ set(docsDemoGeoApiConfigurationKey, geoApiDemoConfiguration);
26
24
 
27
25
  export const geoCommunesApiGetEndpoint = new Endpoint<GeoCommuneRow[]>(
28
26
  "communes?limit=5&fields=nom,code",
@@ -31,10 +29,17 @@ export const geoCommunesApiGetEndpoint = new Endpoint<GeoCommuneRow[]>(
31
29
  export const docsDemoDynApiConfKeyTemplate =
32
30
  new DataProviderKey<APIConfiguration>("docsDemoDynApiConf${configSlot}");
33
31
 
34
- PublisherManager.get("docsDemoDynApiConfA").set(geoApiDemoConfiguration);
35
- PublisherManager.get("docsDemoDynApiConfB").set({
32
+ export const docsDemoDynApiConfAKey = new DataProviderKey<APIConfiguration>(
33
+ "docsDemoDynApiConfA",
34
+ );
35
+ export const docsDemoDynApiConfBKey = new DataProviderKey<APIConfiguration>(
36
+ "docsDemoDynApiConfB",
37
+ );
38
+
39
+ set(docsDemoDynApiConfAKey, geoApiDemoConfiguration);
40
+ set(docsDemoDynApiConfBKey, {
36
41
  ...geoApiDemoConfiguration,
37
- serviceURL: "https://geo.api.gouv.fr/",
42
+ serviceURL: DOCS_MOCK_GEO_SERVICE,
38
43
  });
39
44
 
40
45
  export const geoCommunesApiGetEndpointDynamic = new Endpoint<GeoCommuneRow[]>(
@@ -1,228 +1,2 @@
1
- import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
2
-
3
- export const ensurePublisherValue = <T>(
4
- publisherId: string,
5
- defaultValue: T,
6
- ): void => {
7
- const publisher = PublisherManager.get(publisherId);
8
- const currentValue =
9
- typeof publisher.get === "function" ? publisher.get() : undefined;
10
-
11
- const isUnset =
12
- currentValue === undefined ||
13
- currentValue === null ||
14
- (typeof currentValue === "object" &&
15
- !Array.isArray(currentValue) &&
16
- Object.keys(currentValue).length === 0);
17
-
18
- if (isUnset) {
19
- publisher.set(defaultValue as T);
20
- }
21
- };
22
-
23
- export const initializeDecoratorsDemoData = () => {
24
- ensurePublisherValue("demoData", {
25
- title: "Initial Title",
26
- user: { name: "Initial User" },
27
- count: 0,
28
- });
29
-
30
- ensurePublisherValue("demoUser", {
31
- name: "Demo User",
32
- email: "demo@example.com",
33
- });
34
-
35
- ensurePublisherValue("demoSettings", {
36
- theme: "light",
37
- language: "en",
38
- });
39
-
40
- ensurePublisherValue("demoUserSettings", {
41
- theme: "light",
42
- language: "en",
43
- });
44
-
45
- ensurePublisherValue("autoValue1", 10);
46
- ensurePublisherValue("autoValue2", 20);
47
- ensurePublisherValue("waitAncestorDemo", {
48
- message: "Context from ancestor",
49
- });
50
-
51
- ensurePublisherValue("combinedData", { title: "Combined Title" });
52
- ensurePublisherValue("combinedUser", { name: "Combined User" });
53
- ensurePublisherValue("combinedSettings", { theme: "dark" });
54
-
55
- ensurePublisherValue("reflectData", {
56
- title: "Initial Reflected Title",
57
- count: 0,
58
- });
59
-
60
- ensurePublisherValue("publishDemo", {
61
- email: "",
62
- message: "",
63
- });
64
-
65
- ensurePublisherValue("dynamicProfiles", {
66
- alpha: { info: { title: "Profil Alpha" } },
67
- beta: { info: { title: "Profil Beta" } },
68
- });
69
-
70
- ensurePublisherValue("dynamicProfilesAlt", {
71
- alpha: { info: { title: "Profil Alpha (Alt)" } },
72
- beta: { info: { title: "Profil Beta (Alt)" } },
73
- });
74
-
75
- ensurePublisherValue("demoUsers", [
76
- {
77
- id: 1,
78
- firstName: "Alice",
79
- lastName: "Smith",
80
- email: "alice.smith@example.com",
81
- },
82
- {
83
- id: 2,
84
- firstName: "Bob",
85
- lastName: "Johnson",
86
- email: "bob.johnson@example.com",
87
- },
88
- {
89
- id: 3,
90
- firstName: "Carol",
91
- lastName: "Williams",
92
- email: "carol.williams@example.com",
93
- },
94
- {
95
- id: 4,
96
- firstName: "David",
97
- lastName: "Brown",
98
- email: "david.brown@example.com",
99
- },
100
- {
101
- id: 5,
102
- firstName: "Eve",
103
- lastName: "Jones",
104
- email: "eve.jones@example.com",
105
- },
106
- {
107
- id: 6,
108
- firstName: "Frank",
109
- lastName: "Garcia",
110
- email: "frank.garcia@example.com",
111
- },
112
- {
113
- id: 7,
114
- firstName: "Grace",
115
- lastName: "Miller",
116
- email: "grace.miller@example.com",
117
- },
118
- {
119
- id: 8,
120
- firstName: "Henry",
121
- lastName: "Davis",
122
- email: "henry.davis@example.com",
123
- },
124
- {
125
- id: 9,
126
- firstName: "Ivy",
127
- lastName: "Martinez",
128
- email: "ivy.martinez@example.com",
129
- },
130
- {
131
- id: 10,
132
- firstName: "Jack",
133
- lastName: "Taylor",
134
- email: "jack.taylor@example.com",
135
- },
136
- ]);
137
-
138
- ensurePublisherValue("demoUsersAlt", [
139
- {
140
- id: 11,
141
- firstName: "Sophie",
142
- lastName: "Lindquist",
143
- email: "sophie.lindquist@example.com",
144
- },
145
- {
146
- id: 12,
147
- firstName: "Mateo",
148
- lastName: "Ortega",
149
- email: "mateo.ortega@example.com",
150
- },
151
- {
152
- id: 13,
153
- firstName: "Jin",
154
- lastName: "Park",
155
- email: "jin.park@example.com",
156
- },
157
- {
158
- id: 14,
159
- firstName: "Fatima",
160
- lastName: "El-Sayed",
161
- email: "fatima.el-sayed@example.com",
162
- },
163
- {
164
- id: 15,
165
- firstName: "Lars",
166
- lastName: "Johansson",
167
- email: "lars.johansson@example.com",
168
- },
169
- {
170
- id: 16,
171
- firstName: "Amara",
172
- lastName: "Singh",
173
- email: "amara.singh@example.com",
174
- },
175
- {
176
- id: 17,
177
- firstName: "Zuri",
178
- lastName: "Okafor",
179
- email: "zuri.okafor@example.com",
180
- },
181
- {
182
- id: 18,
183
- firstName: "Luca",
184
- lastName: "Rossi",
185
- email: "luca.rossi@example.com",
186
- },
187
- {
188
- id: 19,
189
- firstName: "Ava",
190
- lastName: "Murphy",
191
- email: "ava.murphy@example.com",
192
- },
193
- {
194
- id: 20,
195
- firstName: "Noah",
196
- lastName: "Keller",
197
- email: "noah.keller@example.com",
198
- },
199
- ]);
200
-
201
- ensurePublisherValue("demoUsersSettings", [
202
- { theme: "light", language: "en" },
203
- { theme: "dark", language: "fr" },
204
- { theme: "auto", language: "es" },
205
- { theme: "light", language: "en" },
206
- { theme: "dark", language: "fr" },
207
- { theme: "auto", language: "es" },
208
- { theme: "light", language: "en" },
209
- { theme: "dark", language: "fr" },
210
- { theme: "auto", language: "es" },
211
- { theme: "light", language: "en" },
212
- ]);
213
-
214
- ensurePublisherValue("demoUsersAltSettings", [
215
- { theme: "dark", language: "de" },
216
- { theme: "light", language: "it" },
217
- { theme: "auto", language: "ja" },
218
- { theme: "dark", language: "pt" },
219
- { theme: "light", language: "ru" },
220
- { theme: "auto", language: "zh" },
221
- { theme: "dark", language: "ar" },
222
- { theme: "light", language: "sv" },
223
- { theme: "auto", language: "nl" },
224
- { theme: "dark", language: "pl" },
225
- ]);
226
- };
227
-
228
- initializeDecoratorsDemoData();
1
+ /** Default doc demo store values — keys in @docs-provider-keys.ts, writes via `set()`. */
2
+ import "./docs-provider-keys";