@supersoniks/concorde 5.0.5 → 5.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 (168) hide show
  1. package/.github/workflows/ci.yml +21 -0
  2. package/.github-export-ignore +30 -0
  3. package/.tmp-cem/custom-elements.json +13705 -0
  4. package/CONTRIBUTING.md +59 -0
  5. package/DEV.md +54 -0
  6. package/LICENSE +21 -0
  7. package/OPEN_SOURCE_CHECKPOINT.md +133 -0
  8. package/build-infos.json +1 -1
  9. package/concorde-3d.bundle.js +3960 -0
  10. package/concorde-3d.es.js +33433 -0
  11. package/concorde-core.bundle.js +196 -196
  12. package/concorde-core.es.js +3685 -3405
  13. package/concorde-hugging-face-infer.bundle.js +32 -0
  14. package/concorde-hugging-face-infer.es.js +2952 -0
  15. package/concorde-interactive.bundle.js +1157 -0
  16. package/concorde-interactive.es.js +10734 -0
  17. package/concorde-shader.bundle.js +116 -0
  18. package/concorde-shader.es.js +8353 -0
  19. package/concorde-webgpu.bundle.js +307 -0
  20. package/concorde-webgpu.es.js +8627 -0
  21. package/custom-elements-manifest.config.mjs +14 -0
  22. package/dist/concorde-core.bundle.js +196 -196
  23. package/dist/concorde-core.es.js +3685 -3405
  24. package/docs/assets/{index-wVZpLVYW.js → index-D8MVWqY6.js} +1351 -1222
  25. package/docs/assets/index-DiD0qYvE.css +1 -0
  26. package/docs/crawl/core/components/ui/alert/alert.html +71 -172
  27. package/docs/crawl/core/components/ui/alert-messages/alert-messages.html +5 -113
  28. package/docs/crawl/core/components/ui/badge/badge.html +79 -157
  29. package/docs/crawl/core/components/ui/button/button.html +0 -1
  30. package/docs/crawl/core/components/ui/captcha/captcha.html +8 -90
  31. package/docs/crawl/core/components/ui/card/card.html +68 -222
  32. package/docs/crawl/core/components/ui/divider/divider.html +31 -117
  33. package/docs/crawl/core/components/ui/form/fieldset/fieldset.html +101 -232
  34. package/docs/crawl/core/components/ui/form/form-actions/form-actions.html +52 -95
  35. package/docs/crawl/core/components/ui/form/form-layout/form-layout.html +38 -97
  36. package/docs/crawl/core/components/ui/form/input/input.html +3 -3
  37. package/docs/crawl/core/components/ui/form/textarea/textarea.html +3 -3
  38. package/docs/crawl/core/components/ui/group/group.html +38 -60
  39. package/docs/crawl/core/components/ui/icon/icon.html +47 -136
  40. package/docs/crawl/core/components/ui/image/image.html +56 -244
  41. package/docs/crawl/core/components/ui/link/link.html +9 -67
  42. package/docs/crawl/core/components/ui/loader/loader.html +23 -97
  43. package/docs/crawl/core/components/ui/menu/menu.html +90 -162
  44. package/docs/crawl/core/components/ui/modal/modal.html +50 -275
  45. package/docs/crawl/core/components/ui/pop/pop.html +66 -260
  46. package/docs/crawl/core/components/ui/progress/progress.html +30 -103
  47. package/docs/crawl/core/components/ui/table/table.html +171 -303
  48. package/docs/crawl/core/components/ui/toast/toast.html +59 -170
  49. package/docs/crawl/core/components/ui/tooltip/tooltip.html +29 -90
  50. package/docs/crawl/docs/_decorators/ancestor-attribute.html +2 -3
  51. package/docs/crawl/docs/_getting-started/concorde-outside.html +3 -3
  52. package/docs/crawl/docs/_getting-started/start.html +1 -1
  53. package/docs/crawl/docs/_getting-started/theming.html +63 -311
  54. package/docs/crawl/hubs/form-components.html +53 -75
  55. package/docs/crawl/index.html +6 -7
  56. package/docs/docs-mock-api-sw.js +0 -2
  57. package/docs/docs-mock-api-sw.js.map +2 -2
  58. package/docs/index.html +7 -9
  59. package/docs/llms-full.txt +456 -1703
  60. package/docs/llms.txt +32 -25
  61. package/docs/sitemap.xml +0 -3
  62. package/docs/src/core/components/functional/fetch/fetch.md +0 -0
  63. package/docs/src/core/components/functional/if/if.md +0 -0
  64. package/docs/src/core/components/functional/list/list.md +0 -0
  65. package/docs/src/core/components/functional/router/router.md +0 -0
  66. package/docs/src/core/components/functional/sdui/sdui.md +0 -0
  67. package/docs/src/core/components/functional/states/states.md +0 -0
  68. package/docs/src/core/components/functional/submit/submit.md +0 -0
  69. package/docs/src/core/components/ui/alert/alert.md +72 -147
  70. package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -85
  71. package/docs/src/core/components/ui/badge/badge.md +80 -141
  72. package/docs/src/core/components/ui/button/button.md +0 -1
  73. package/docs/src/core/components/ui/captcha/captcha.md +6 -65
  74. package/docs/src/core/components/ui/card/card.md +65 -183
  75. package/docs/src/core/components/ui/divider/divider.md +13 -107
  76. package/docs/src/core/components/ui/form/fieldset/fieldset.md +99 -175
  77. package/docs/src/core/components/ui/form/form-actions/form-actions.md +52 -75
  78. package/docs/src/core/components/ui/form/form-layout/form-layout.md +34 -109
  79. package/docs/src/core/components/ui/form/input/input.md +1 -1
  80. package/docs/src/core/components/ui/form/radio/radio.md +0 -0
  81. package/docs/src/core/components/ui/form/select/select.md +0 -0
  82. package/docs/src/core/components/ui/form/switch/switch.md +0 -0
  83. package/docs/src/core/components/ui/form/textarea/textarea.md +1 -1
  84. package/docs/src/core/components/ui/group/group.md +36 -36
  85. package/docs/src/core/components/ui/icon/icon.md +43 -132
  86. package/docs/src/core/components/ui/image/image.md +53 -179
  87. package/docs/src/core/components/ui/link/link.md +7 -45
  88. package/docs/src/core/components/ui/loader/loader.md +22 -79
  89. package/docs/src/core/components/ui/menu/menu.md +92 -133
  90. package/docs/src/core/components/ui/modal/modal.md +47 -163
  91. package/docs/src/core/components/ui/pop/pop.md +64 -262
  92. package/docs/src/core/components/ui/progress/progress.md +30 -76
  93. package/docs/src/core/components/ui/table/table.md +171 -147
  94. package/docs/src/core/components/ui/toast/toast.md +58 -108
  95. package/docs/src/core/components/ui/tooltip/tooltip.md +26 -68
  96. package/docs/src/docs/_core-concept/subscriber.md +0 -0
  97. package/docs/src/docs/_decorators/ancestor-attribute.md +2 -3
  98. package/docs/src/docs/_getting-started/concorde-outside.md +3 -3
  99. package/docs/src/docs/_getting-started/my-first-subscriber.md +0 -0
  100. package/docs/src/docs/_getting-started/pubsub.md +0 -0
  101. package/docs/src/docs/_getting-started/start.md +1 -1
  102. package/docs/src/docs/_getting-started/theming.md +61 -223
  103. package/docs/src/docs/search/docs-search.json +348 -3083
  104. package/docs/src/tsconfig.declarations.json +22 -0
  105. package/docs/src/tsconfig.emit.json +23 -0
  106. package/docs/src/tsconfig.json +3 -63
  107. package/gitlab/job_github_mirror.sh +39 -0
  108. package/package.json +36 -2
  109. package/scripts/generate-sdui-catalog.mjs +250 -0
  110. package/scripts/generate-sdui-catalog.spec.ts +91 -0
  111. package/scripts/github-export.mjs +150 -0
  112. package/scripts/post-build-docs.js +0 -0
  113. package/scripts/post-build.mjs +0 -0
  114. package/scripts/pre-build.mjs +15 -0
  115. package/src/core/components/functional/fetch/fetch.md +0 -0
  116. package/src/core/components/functional/if/if.md +0 -0
  117. package/src/core/components/functional/if/if.ts +0 -0
  118. package/src/core/components/functional/list/list.demo.ts +0 -0
  119. package/src/core/components/functional/list/list.md +0 -0
  120. package/src/core/components/functional/router/router.md +0 -0
  121. package/src/core/components/functional/router/router.ts +0 -0
  122. package/src/core/components/functional/sdui/SDUIDescriptorTransformer.ts +5 -5
  123. package/src/core/components/functional/sdui/__fixtures__/descriptors.ts +251 -0
  124. package/src/core/components/functional/sdui/__snapshots__/sdui-action.spec.ts.snap +73 -0
  125. package/src/core/components/functional/sdui/__snapshots__/sdui-incremental.spec.ts.snap +50 -0
  126. package/src/core/components/functional/sdui/__snapshots__/sdui-partial.spec.ts.snap +50 -0
  127. package/src/core/components/functional/sdui/__snapshots__/sdui.regression.spec.ts.snap +461 -0
  128. package/src/core/components/functional/sdui/component-catalog.gaps.json +511 -0
  129. package/src/core/components/functional/sdui/component-catalog.json +3103 -0
  130. package/src/core/components/functional/sdui/component-catalog.spec.ts +23 -0
  131. package/src/core/components/functional/sdui/sdui-action.spec.ts +99 -0
  132. package/src/core/components/functional/sdui/sdui-dom-snapshot.ts +61 -0
  133. package/src/core/components/functional/sdui/sdui-extension-points.md +94 -0
  134. package/src/core/components/functional/sdui/sdui-incremental.spec.ts +137 -0
  135. package/src/core/components/functional/sdui/sdui-partial.spec.ts +83 -0
  136. package/src/core/components/functional/sdui/sdui-partial.ts +19 -0
  137. package/src/core/components/functional/sdui/sdui-safe.spec.ts +188 -0
  138. package/src/core/components/functional/sdui/sdui-safe.ts +100 -0
  139. package/src/core/components/functional/sdui/sdui.md +122 -0
  140. package/src/core/components/functional/sdui/sdui.regression.spec.ts +64 -0
  141. package/src/core/components/functional/sdui/sdui.ts +442 -34
  142. package/src/core/components/functional/sdui/types.ts +49 -0
  143. package/src/core/components/functional/states/states.md +0 -0
  144. package/src/core/components/functional/submit/submit.md +0 -0
  145. package/src/core/components/functional/subscriber/subscriber.ts +0 -0
  146. package/src/core/components/functional/value/value.ts +0 -0
  147. package/src/core/components/ui/_css/size.ts +0 -0
  148. package/src/core/components/ui/captcha/altchaStyles.ts +0 -0
  149. package/src/core/components/ui/form/radio/radio.md +0 -0
  150. package/src/core/components/ui/form/select/select.md +0 -0
  151. package/src/core/components/ui/form/switch/switch.md +0 -0
  152. package/src/core/mixins/Subscriber.ts +0 -0
  153. package/src/core/utils/DataBindObserver.ts +0 -0
  154. package/src/core/utils/Objects.ts +0 -0
  155. package/src/core/utils/route.ts +0 -0
  156. package/src/css.d.ts +19 -0
  157. package/src/docs/_core-concept/subscriber.md +0 -0
  158. package/src/docs/_getting-started/my-first-subscriber.md +0 -0
  159. package/src/docs/_getting-started/pubsub.md +0 -0
  160. package/src/docs/example/users.ts +0 -0
  161. package/src/docs/search/page.ts +0 -0
  162. package/src/tsconfig.declarations.json +22 -0
  163. package/src/tsconfig.emit.json +23 -0
  164. package/src/tsconfig.json +90 -0
  165. package/src/tsconfig.tsbuildinfo +1 -1
  166. package/docs/assets/index-CD4WyL6o.css +0 -1
  167. package/docs/crawl/core/components/ui/theme/theme.html +0 -131
  168. package/docs/src/core/components/ui/theme/theme.md +0 -122
@@ -0,0 +1,150 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Prépare une arborescence « lib publique » pour GitHub :
4
+ * - sans site doc (src/docs, index.html, …)
5
+ * - sans sonic-captcha (altcha.supersoniks.org)
6
+ * - sans scripts / jobs GitLab internes
7
+ *
8
+ * Usage :
9
+ * node scripts/github-export.mjs [répertoire_cible]
10
+ *
11
+ * Par défaut : ../concorde-github-export
12
+ */
13
+ import fs from "fs";
14
+ import path from "path";
15
+ import { fileURLToPath } from "url";
16
+
17
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
18
+ const ROOT = path.resolve(__dirname, "..");
19
+ const IGNORE_FILE = path.join(ROOT, ".github-export-ignore");
20
+ const DEFAULT_OUT = path.resolve(ROOT, "../concorde-github-export");
21
+
22
+ const EXPORT_FILTER_KEY =
23
+ /(?:^|\/)(?:docs|mock-api|undefined)(?:\/|$)|captcha|\.demo\.|\.stories\.|TestUtils|\/prism\/|\/search\/|\/tailwind\/|\/header\/|\/navigation\/|\/layout\.ts$|\/code\.ts$|^code$|^docs$|^layout$/;
24
+
25
+ function readIgnorePatterns() {
26
+ if (!fs.existsSync(IGNORE_FILE)) return [];
27
+ return fs
28
+ .readFileSync(IGNORE_FILE, "utf8")
29
+ .split("\n")
30
+ .map((l) => l.trim())
31
+ .filter((l) => l && !l.startsWith("#"));
32
+ }
33
+
34
+ function globToRegExp(pattern) {
35
+ const escaped = pattern
36
+ .replace(/[.+^${}()|[\]\\]/g, "\\$&")
37
+ .replace(/\*\*/g, "{{GLOBSTAR}}")
38
+ .replace(/\*/g, "[^/]*")
39
+ .replace(/\{\{GLOBSTAR\}\}/g, ".*");
40
+ return new RegExp(`^${escaped}$`);
41
+ }
42
+
43
+ function shouldExclude(relativePath, patterns) {
44
+ const normalized = relativePath.replace(/\\/g, "/");
45
+ for (const pattern of patterns) {
46
+ const re = globToRegExp(pattern);
47
+ if (re.test(normalized)) return true;
48
+ if (normalized.startsWith(pattern.endsWith("/") ? pattern : `${pattern}/`))
49
+ return true;
50
+ if (normalized === pattern) return true;
51
+ }
52
+ return false;
53
+ }
54
+
55
+ function listAllFiles(dir, base = dir) {
56
+ const out = [];
57
+ for (const name of fs.readdirSync(dir, { withFileTypes: true })) {
58
+ if (name.name === ".git" || name.name === "node_modules") continue;
59
+ const full = path.join(dir, name.name);
60
+ const rel = path.relative(base, full).replace(/\\/g, "/");
61
+ if (name.isDirectory()) {
62
+ if (shouldExclude(rel, ignorePatterns)) continue;
63
+ out.push(...listAllFiles(full, base));
64
+ } else {
65
+ if (!shouldExclude(rel, ignorePatterns)) out.push(rel);
66
+ }
67
+ }
68
+ return out;
69
+ }
70
+
71
+ function copyFile(rel, destRoot) {
72
+ const src = path.join(ROOT, rel);
73
+ const dest = path.join(destRoot, rel);
74
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
75
+ fs.copyFileSync(src, dest);
76
+ }
77
+
78
+ function patchUiTs(destRoot) {
79
+ const uiPath = path.join(
80
+ destRoot,
81
+ "src/core/components/ui/ui.ts",
82
+ );
83
+ if (!fs.existsSync(uiPath)) return;
84
+ const content = fs.readFileSync(uiPath, "utf8");
85
+ const patched = content.replace(
86
+ /import "\.\/captcha\/captcha";\n?/,
87
+ "",
88
+ );
89
+ fs.writeFileSync(uiPath, patched);
90
+ }
91
+
92
+ function exportHaystack(value) {
93
+ if (typeof value === "string") return value;
94
+ if (value && typeof value === "object") {
95
+ return `${value.types ?? ""}${value.default ?? ""}`;
96
+ }
97
+ return String(value);
98
+ }
99
+
100
+ function filterPackageJson(destRoot) {
101
+ const pkgPath = path.join(destRoot, "package.json");
102
+ if (!fs.existsSync(pkgPath)) return;
103
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
104
+ if (pkg.exports && typeof pkg.exports === "object") {
105
+ const next = {};
106
+ for (const [key, value] of Object.entries(pkg.exports)) {
107
+ const hay = `${key}:${exportHaystack(value)}`;
108
+ if (EXPORT_FILTER_KEY.test(hay)) continue;
109
+ if (exportHaystack(value).includes("/captcha/")) continue;
110
+ if (exportHaystack(value).includes("/docs/")) continue;
111
+ if (exportHaystack(value).includes(".demo.")) continue;
112
+ if (exportHaystack(value).includes(".stories.")) continue;
113
+ next[key] = value;
114
+ }
115
+ pkg.exports = next;
116
+ }
117
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
118
+ }
119
+
120
+ function patchReadme(destRoot) {
121
+ const readmePath = path.join(destRoot, "README.md");
122
+ if (!fs.existsSync(readmePath)) return;
123
+ let text = fs.readFileSync(readmePath, "utf8");
124
+ text = text.replace(
125
+ /Le dépôt GitHub est un \*\*miroir\*\* synchronisé depuis GitLab \(voir \[OPEN_SOURCE_CHECKPOINT\.md\]\(OPEN_SOURCE_CHECKPOINT\.md\)\)\./,
126
+ "Le dépôt GitHub est un **export filtré** depuis GitLab (librairie uniquement, sans site doc ni composant captcha — voir [OPEN_SOURCE_CHECKPOINT.md](OPEN_SOURCE_CHECKPOINT.md)).",
127
+ );
128
+ fs.writeFileSync(readmePath, text);
129
+ }
130
+
131
+ const ignorePatterns = readIgnorePatterns();
132
+ const outDir = path.resolve(process.argv[2] || DEFAULT_OUT);
133
+
134
+ if (fs.existsSync(outDir)) {
135
+ fs.rmSync(outDir, { recursive: true, force: true });
136
+ }
137
+ fs.mkdirSync(outDir, { recursive: true });
138
+
139
+ const files = listAllFiles(ROOT);
140
+ for (const rel of files) {
141
+ copyFile(rel, outDir);
142
+ }
143
+
144
+ patchUiTs(outDir);
145
+ filterPackageJson(outDir);
146
+ patchReadme(outDir);
147
+
148
+ console.log(`✅ Export GitHub : ${files.length} fichiers → ${outDir}`);
149
+ console.log(" Exclusions : .github-export-ignore");
150
+ console.log(" Patches : ui.ts (sans captcha), package.json exports");
File without changes
File without changes
@@ -1,5 +1,6 @@
1
1
  // console.log("hey");
2
2
 
3
+ import { execFileSync } from "child_process";
3
4
  import fs from "fs";
4
5
  import path from "path";
5
6
  import { fileURLToPath } from "url";
@@ -25,6 +26,16 @@ fs.writeFileSync(
25
26
  JSON.stringify(icons)
26
27
  );
27
28
 
29
+ console.log("🚀 Catalogue SDUI (CEM → component-catalog.json)");
30
+ execFileSync(
31
+ process.execPath,
32
+ [path.resolve(__dirname, "generate-sdui-catalog.mjs")],
33
+ {
34
+ cwd: path.resolve(__dirname, ".."),
35
+ stdio: "inherit",
36
+ }
37
+ );
38
+
28
39
  console.log("🚀 Maintenance des shortPath");
29
40
  function listFiles(dir) {
30
41
  let files = [];
@@ -116,6 +127,10 @@ const pExports = {
116
127
  "./src/core/components/ui/icon/icons.json",
117
128
  "./core/components/functional/sdui/default-library.json":
118
129
  "./src/core/components/functional/sdui/default-library.json",
130
+ "./core/components/functional/sdui/component-catalog.json":
131
+ "./src/core/components/functional/sdui/component-catalog.json",
132
+ "./sdui/component-catalog.json":
133
+ "./src/core/components/functional/sdui/component-catalog.json",
119
134
  "./dataProviderKey": "./src/core/utils/dataProviderKey.ts",
120
135
  "./*": "./src/*.ts",
121
136
  "./vite-config": "./vite/config.js",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -76,7 +76,7 @@ export default class SDUIDescriptorTransformer {
76
76
  nodeMatchesPattern(pattern: SDUINode, node: SDUINode) {
77
77
  const patternDynamic = pattern as Record<string, string>;
78
78
  const nodeDynamic = node as Record<string, string>;
79
- const keys = ["libraryKey", "innerHTML", "prefix", "suffix", "markup"];
79
+ const keys = ["libraryKey", "innerHTML", "prefix", "suffix", "markup", "textContent"];
80
80
  for (const key of keys) {
81
81
  if (!this.stringMatchesExpression(nodeDynamic[key], patternDynamic[key])) {
82
82
  return false;
@@ -123,7 +123,7 @@ export default class SDUIDescriptorTransformer {
123
123
  i++;
124
124
  }
125
125
  const idx = list[0]?.parent.nodes?.indexOf(list[0].child);
126
- if (idx) {
126
+ if (idx != null && idx >= 0) {
127
127
  list[0].parent.nodes?.splice(idx, 1);
128
128
  list[0].parent.nodes?.splice(idx, 0, wrapper);
129
129
  }
@@ -161,12 +161,12 @@ export default class SDUIDescriptorTransformer {
161
161
  const childAttributes = item.child.attributes;
162
162
  if (childAttributes) {
163
163
  for (const key in childAttributes) {
164
- if (!Object.prototype.hasOwnProperty.call(newUI.attributes, "key"))
164
+ if (!Object.prototype.hasOwnProperty.call(newUI.attributes, key))
165
165
  newUI.attributes[key] = childAttributes[key];
166
166
  }
167
167
  }
168
168
 
169
- const keys = ["libraryKey", "innerHTML", "prefix", "suffix", "markup"];
169
+ const keys = ["libraryKey", "innerHTML", "prefix", "suffix", "markup", "textContent"];
170
170
  const childDynamic = item.child as Record<string, object | string>;
171
171
  const newUIDynamic = newUI as Record<string, object | string>;
172
172
  for (const key of keys) {
@@ -183,7 +183,7 @@ export default class SDUIDescriptorTransformer {
183
183
  newUI.nodes.push(node);
184
184
  }
185
185
  }
186
- const idx = item.parent.nodes?.indexOf(item.child) || -1;
186
+ const idx = item.parent.nodes?.indexOf(item.child) ?? -1;
187
187
  if (idx != -1) {
188
188
  item.parent.nodes?.splice(idx, 1);
189
189
  item.parent.nodes?.splice(idx, 0, newUI);
@@ -0,0 +1,251 @@
1
+ import type {
2
+ SDUIDescriptor,
3
+ SDUITransformDescription,
4
+ } from "../types";
5
+
6
+ /** Layout imbriqué : tagName, attributes, nodes (avec innerHTML — non safe). */
7
+ export const layoutNested: SDUIDescriptor = {
8
+ nodes: [
9
+ {
10
+ tagName: "div",
11
+ attributes: { class: "sdui-layout", "data-role": "root" },
12
+ nodes: [
13
+ {
14
+ tagName: "section",
15
+ attributes: { class: "sdui-layout__main" },
16
+ nodes: [
17
+ { tagName: "h2", innerHTML: "Titre" },
18
+ {
19
+ tagName: "p",
20
+ attributes: { class: "lead" },
21
+ innerHTML: "Paragraphe",
22
+ },
23
+ ],
24
+ },
25
+ {
26
+ tagName: "aside",
27
+ attributes: { class: "sdui-layout__side" },
28
+ innerHTML: "Aside",
29
+ },
30
+ ],
31
+ },
32
+ ],
33
+ };
34
+
35
+ /**
36
+ * Layout structurel sans markup/innerHTML/prefix/suffix/js.
37
+ * Compatible profile="safe" (contenu texte via attributs de composants).
38
+ */
39
+ export const layoutSafe: SDUIDescriptor = {
40
+ nodes: [
41
+ {
42
+ tagName: "div",
43
+ attributes: { class: "sdui-layout", "data-role": "root" },
44
+ nodes: [
45
+ {
46
+ tagName: "h2",
47
+ attributes: { class: "sdui-layout__title" },
48
+ textContent: "Titre safe",
49
+ },
50
+ {
51
+ tagName: "sonic-input",
52
+ attributes: { name: "email", label: "Email", type: "text" },
53
+ },
54
+ {
55
+ tagName: "sonic-button",
56
+ attributes: { type: "success", name: "go", value: "1" },
57
+ textContent: "Go",
58
+ },
59
+ ],
60
+ },
61
+ ],
62
+ };
63
+
64
+ /** markup + innerHTML (canaux HTML libres). */
65
+ export const markupAndInnerHTML: SDUIDescriptor = {
66
+ nodes: [
67
+ {
68
+ markup:
69
+ 'keep shouting <span class="badge">foo</span> <span class="badge">bar</span> !',
70
+ },
71
+ {
72
+ tagName: "div",
73
+ attributes: { class: "html-block" },
74
+ innerHTML: 'texte <strong>gras</strong>',
75
+ },
76
+ ],
77
+ };
78
+
79
+ /** prefix / suffix (injection HTML autour du nœud). */
80
+ export const prefixSuffix: SDUIDescriptor = {
81
+ nodes: [
82
+ {
83
+ prefix: '<span class="prefix">avant</span>',
84
+ suffix: '<span class="suffix">après</span>',
85
+ tagName: "div",
86
+ attributes: { class: "core" },
87
+ innerHTML: "contenu",
88
+ },
89
+ ],
90
+ };
91
+
92
+ /** Library par défaut (submit) + contentElementSelector. */
93
+ export const librarySubmit: SDUIDescriptor = {
94
+ nodes: [
95
+ {
96
+ libraryKey: "submit",
97
+ innerHTML: "Injected content",
98
+ },
99
+ ],
100
+ };
101
+
102
+ /** Library custom dans le descripteur. */
103
+ export const customLibrary: SDUIDescriptor = {
104
+ library: {
105
+ card: {
106
+ tagName: "div",
107
+ attributes: { class: "card" },
108
+ contentElementSelector: ".card__body",
109
+ nodes: [
110
+ {
111
+ tagName: "div",
112
+ attributes: { class: "card__body" },
113
+ },
114
+ ],
115
+ },
116
+ },
117
+ nodes: [
118
+ {
119
+ libraryKey: "card",
120
+ nodes: [{ tagName: "span", innerHTML: "Hello card" }],
121
+ },
122
+ ],
123
+ };
124
+
125
+ /** parentElementSelector (injection ciblée dans le parent). */
126
+ export const parentElementSelector: SDUIDescriptor = {
127
+ nodes: [
128
+ {
129
+ nodes: [
130
+ {
131
+ prefix: "👇 Selected parent element",
132
+ suffix: "☝️ End of selected parent element",
133
+ tagName: "span",
134
+ },
135
+ {
136
+ parentElementSelector: "span",
137
+ innerHTML: "Content having a parentElementSelector attribute",
138
+ },
139
+ ],
140
+ },
141
+ ],
142
+ };
143
+
144
+ /** Formulaire via library keys (form, fields, actions). */
145
+ export const formFields: SDUIDescriptor = {
146
+ nodes: [
147
+ {
148
+ libraryKey: "form",
149
+ attributes: {
150
+ formDataProvider: "sdui-fixture-form",
151
+ endPoint: "/api/fixture-submit",
152
+ },
153
+ nodes: [
154
+ {
155
+ libraryKey: "formLayout",
156
+ nodes: [
157
+ {
158
+ libraryKey: "textfield",
159
+ attributes: { name: "email", label: "Email" },
160
+ },
161
+ {
162
+ libraryKey: "password",
163
+ attributes: { name: "password", label: "Password" },
164
+ },
165
+ ],
166
+ },
167
+ {
168
+ libraryKey: "formActions",
169
+ nodes: [
170
+ {
171
+ libraryKey: "submit",
172
+ innerHTML: "Envoyer",
173
+ },
174
+ ],
175
+ },
176
+ ],
177
+ },
178
+ ],
179
+ };
180
+
181
+ /** Nœud sonic-jsonata (structure DOM uniquement pour le snapshot). */
182
+ export const jsonataNode: SDUIDescriptor = {
183
+ nodes: [
184
+ {
185
+ tagName: "sonic-jsonata",
186
+ attributes: {
187
+ inputProvider: "sdui-fixture-input",
188
+ outputProvider: "sdui-fixture-output",
189
+ expression: "$input.name",
190
+ },
191
+ },
192
+ ],
193
+ };
194
+
195
+ /** libraryKey inconnu → fallback div (comportement actuel). */
196
+ export const missingLibraryKey: SDUIDescriptor = {
197
+ nodes: [
198
+ {
199
+ libraryKey: "does-not-exist",
200
+ attributes: { class: "fallback" },
201
+ innerHTML: "orphan",
202
+ },
203
+ ],
204
+ };
205
+
206
+ /**
207
+ * Descripteur d’entrée pour le transformer (remap).
208
+ * Matching via attributes (tagName n’est pas consulté par nodeMatchesPattern).
209
+ */
210
+ export const transformRemapInput: SDUIDescriptor = {
211
+ nodes: [
212
+ {
213
+ tagName: "legacy-button",
214
+ attributes: { label: "Go", class: "legacy" },
215
+ nodes: [{ tagName: "span", innerHTML: "icon" }],
216
+ },
217
+ {
218
+ tagName: "div",
219
+ attributes: { class: "keep" },
220
+ innerHTML: "untouched",
221
+ },
222
+ ],
223
+ };
224
+
225
+ /** Description de transformation associée. */
226
+ export const transformRemapDescription: SDUITransformDescription = {
227
+ transforms: [
228
+ {
229
+ action: "remap",
230
+ patterns: [{ attributes: { class: "legacy" } }],
231
+ ui: {
232
+ tagName: "sonic-button",
233
+ attributes: { type: "success" },
234
+ },
235
+ },
236
+ ],
237
+ };
238
+
239
+ /** Catalogue des fixtures de rendu (hors transform pur). */
240
+ export const renderFixtures: Record<string, SDUIDescriptor> = {
241
+ layoutNested,
242
+ layoutSafe,
243
+ markupAndInnerHTML,
244
+ prefixSuffix,
245
+ librarySubmit,
246
+ customLibrary,
247
+ parentElementSelector,
248
+ formFields,
249
+ jsonataNode,
250
+ missingLibraryKey,
251
+ };
@@ -0,0 +1,73 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`sonic-sdui sdui-action > ne change pas le rendu formulaire (snapshot structurelle) 1`] = `
4
+ [
5
+ {
6
+ "attrs": {
7
+ "endpoint": "/api/fixture-submit",
8
+ "formdataprovider": "sdui-fixture-form",
9
+ "onenterkey": "true",
10
+ },
11
+ "children": [
12
+ {
13
+ "children": [
14
+ {
15
+ "attrs": {
16
+ "label": "Email",
17
+ "name": "email",
18
+ "type": "text",
19
+ },
20
+ "tag": "sonic-input",
21
+ },
22
+ {
23
+ "attrs": {
24
+ "label": "Password",
25
+ "name": "password",
26
+ "type": "password",
27
+ },
28
+ "tag": "sonic-input",
29
+ },
30
+ ],
31
+ "tag": "sonic-form-layout",
32
+ },
33
+ {
34
+ "children": [
35
+ {
36
+ "attrs": {
37
+ "onclick": "true",
38
+ },
39
+ "children": [
40
+ {
41
+ "attrs": {
42
+ "alignitems": "center",
43
+ "shape": "default",
44
+ "type": "success",
45
+ "variant": "default",
46
+ },
47
+ "children": [
48
+ {
49
+ "attrs": {
50
+ "aria-hidden": "true",
51
+ "name": "check",
52
+ "slot": "prefix",
53
+ },
54
+ "tag": "sonic-icon",
55
+ },
56
+ "Envoyer",
57
+ ],
58
+ "tag": "sonic-button",
59
+ },
60
+ ],
61
+ "tag": "sonic-submit",
62
+ },
63
+ ],
64
+ "tag": "sonic-form-actions",
65
+ },
66
+ ],
67
+ "tag": "sonic-submit",
68
+ },
69
+ {
70
+ "tag": "sonic-toast-message-subscriber",
71
+ },
72
+ ]
73
+ `;
@@ -0,0 +1,50 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`sonic-sdui ops incrémentales > ne régresse pas le chemin descripteur entier 1`] = `
4
+ [
5
+ {
6
+ "attrs": {
7
+ "class": "sdui-layout",
8
+ "data-role": "root",
9
+ },
10
+ "children": [
11
+ {
12
+ "attrs": {
13
+ "class": "sdui-layout__main",
14
+ },
15
+ "children": [
16
+ {
17
+ "children": [
18
+ "Titre",
19
+ ],
20
+ "tag": "h2",
21
+ },
22
+ {
23
+ "attrs": {
24
+ "class": "lead",
25
+ },
26
+ "children": [
27
+ "Paragraphe",
28
+ ],
29
+ "tag": "p",
30
+ },
31
+ ],
32
+ "tag": "section",
33
+ },
34
+ {
35
+ "attrs": {
36
+ "class": "sdui-layout__side",
37
+ },
38
+ "children": [
39
+ "Aside",
40
+ ],
41
+ "tag": "aside",
42
+ },
43
+ ],
44
+ "tag": "div",
45
+ },
46
+ {
47
+ "tag": "sonic-toast-message-subscriber",
48
+ },
49
+ ]
50
+ `;
@@ -0,0 +1,50 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`sonic-sdui rendu partiel > ne régresse pas sur un descripteur classique (snapshot) 1`] = `
4
+ [
5
+ {
6
+ "attrs": {
7
+ "class": "sdui-layout",
8
+ "data-role": "root",
9
+ },
10
+ "children": [
11
+ {
12
+ "attrs": {
13
+ "class": "sdui-layout__main",
14
+ },
15
+ "children": [
16
+ {
17
+ "children": [
18
+ "Titre",
19
+ ],
20
+ "tag": "h2",
21
+ },
22
+ {
23
+ "attrs": {
24
+ "class": "lead",
25
+ },
26
+ "children": [
27
+ "Paragraphe",
28
+ ],
29
+ "tag": "p",
30
+ },
31
+ ],
32
+ "tag": "section",
33
+ },
34
+ {
35
+ "attrs": {
36
+ "class": "sdui-layout__side",
37
+ },
38
+ "children": [
39
+ "Aside",
40
+ ],
41
+ "tag": "aside",
42
+ },
43
+ ],
44
+ "tag": "div",
45
+ },
46
+ {
47
+ "tag": "sonic-toast-message-subscriber",
48
+ },
49
+ ]
50
+ `;