@supersoniks/concorde 4.7.3 → 4.8.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 (152) hide show
  1. package/README.md +1 -1
  2. package/ai/AGENTS.md +4 -0
  3. package/ai/cursor/rules/concorde.mdc +11 -1
  4. package/ai/jetbrains/rules/concorde.md +8 -0
  5. package/ai/skills/concorde/SKILL.md +29 -2
  6. package/ai/skills/concorde-scope/SKILL.md +2 -2
  7. package/build-infos.json +1 -1
  8. package/concorde-core.bundle.js +289 -289
  9. package/concorde-core.es.js +4839 -4546
  10. package/dist/concorde-core.bundle.js +289 -289
  11. package/dist/concorde-core.es.js +4839 -4546
  12. package/dist/docs-mock-api-sw.js +19 -0
  13. package/dist/docs-mock-api-sw.js.map +2 -2
  14. package/dist/robots.txt +2 -0
  15. package/docs/assets/index-wyNMyWT9.js +11196 -0
  16. package/docs/docs-mock-api-sw.js +19 -0
  17. package/docs/docs-mock-api-sw.js.map +2 -2
  18. package/docs/index.html +1 -1
  19. package/docs/robots.txt +2 -0
  20. package/package.json +9 -1
  21. package/public/docs-mock-api-sw.js +19 -0
  22. package/public/docs-mock-api-sw.js.map +2 -2
  23. package/public/robots.txt +2 -0
  24. package/src/core/components/functional/example/example.ts +3 -3
  25. package/src/core/components/ui/captcha/captcha.md +0 -12
  26. package/src/core/components/ui/icon/icon.ts +17 -2
  27. package/src/core/components/ui/menu/menu.ts +12 -3
  28. package/src/core/decorators/api.post.spec.ts +293 -0
  29. package/src/core/decorators/api.spec.ts +7 -14
  30. package/src/core/decorators/api.ts +648 -15
  31. package/src/core/decorators/subscriber/bind.ts +13 -5
  32. package/src/core/decorators/subscriber/dynamicPath.spec.ts +53 -0
  33. package/src/core/decorators/subscriber/dynamicPath.ts +23 -1
  34. package/src/core/decorators/subscriber/handle.ts +3 -1
  35. package/src/core/decorators/subscriber/onAssign.ts +10 -2
  36. package/src/core/decorators/subscriber/publish.ts +12 -2
  37. package/src/core/utils/PublisherProxy.ts +95 -11
  38. package/src/core/utils/api.ts +72 -3
  39. package/src/core/utils/dpOptions.spec.ts +56 -0
  40. package/src/core/utils/endpoint.ts +3 -3
  41. package/src/decorators.ts +17 -1
  42. package/src/docs/_core-concept/dataFlow.md +9 -3
  43. package/src/docs/_decorators/bind.md +2 -2
  44. package/src/docs/_decorators/get.md +13 -4
  45. package/src/docs/_decorators/handle.md +5 -1
  46. package/src/docs/_decorators/on-assign.md +2 -0
  47. package/src/docs/_decorators/patch.md +45 -0
  48. package/src/docs/_decorators/post.md +93 -0
  49. package/src/docs/_decorators/publish.md +1 -1
  50. package/src/docs/_decorators/put.md +43 -0
  51. package/src/docs/_decorators/subscribe.md +4 -1
  52. package/src/docs/_directives/sub.md +1 -1
  53. package/src/docs/_getting-started/my-first-component.md +1 -1
  54. package/src/docs/_misc/api-configuration.md +3 -1
  55. package/src/docs/_misc/dataProviderKey.md +2 -2
  56. package/src/docs/_misc/dynamic-path.md +71 -0
  57. package/src/docs/_misc/endpoint.md +5 -3
  58. package/src/docs/components/docs-demo-sources.ts +102 -3
  59. package/src/docs/components/docs-lit-demo-raw.ts +2 -26
  60. package/src/docs/components/docs-lit-demo.ts +9 -42
  61. package/src/docs/components/docs-source-excerpt.ts +53 -0
  62. package/src/docs/components/docs-source-link.ts +24 -8
  63. package/src/docs/components/docs-source-raw.ts +34 -0
  64. package/src/docs/example/decorators-demo-geo.ts +2 -2
  65. package/src/docs/example/decorators-demo-post.ts +249 -0
  66. package/src/docs/example/decorators-demo-subscribe-publish-get-demos.ts +5 -5
  67. package/src/docs/example/decorators-demo.ts +1 -0
  68. package/src/docs/example/docs-api-config-demos.ts +5 -5
  69. package/src/docs/mock-api/router.ts +20 -0
  70. package/src/docs/navigation/navigation.ts +16 -0
  71. package/src/docs/search/docs-search.json +540 -15
  72. package/src/tsconfig.json +24 -0
  73. package/src/tsconfig.tsbuildinfo +1 -1
  74. package/vite.config.mts +1 -1
  75. package/docs/assets/index-D9pxaQYK.js +0 -7508
  76. package/docs/src/core/components/functional/date/date.md +0 -290
  77. package/docs/src/core/components/functional/fetch/fetch.md +0 -125
  78. package/docs/src/core/components/functional/if/if.md +0 -9
  79. package/docs/src/core/components/functional/list/list.md +0 -65
  80. package/docs/src/core/components/functional/mix/mix.md +0 -41
  81. package/docs/src/core/components/functional/queue/queue.md +0 -72
  82. package/docs/src/core/components/functional/router/router.md +0 -94
  83. package/docs/src/core/components/functional/sdui/default-library.json +0 -108
  84. package/docs/src/core/components/functional/sdui/example.json +0 -99
  85. package/docs/src/core/components/functional/sdui/sdui.md +0 -356
  86. package/docs/src/core/components/functional/states/states.md +0 -87
  87. package/docs/src/core/components/functional/submit/submit.md +0 -114
  88. package/docs/src/core/components/functional/subscriber/subscriber.md +0 -91
  89. package/docs/src/core/components/functional/value/value.md +0 -35
  90. package/docs/src/core/components/ui/alert/alert.md +0 -121
  91. package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  92. package/docs/src/core/components/ui/badge/badge.md +0 -127
  93. package/docs/src/core/components/ui/button/button.md +0 -182
  94. package/docs/src/core/components/ui/captcha/captcha.md +0 -24
  95. package/docs/src/core/components/ui/card/card.md +0 -97
  96. package/docs/src/core/components/ui/divider/divider.md +0 -35
  97. package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -77
  98. package/docs/src/core/components/ui/form/fieldset/fieldset.md +0 -129
  99. package/docs/src/core/components/ui/form/form-actions/form-actions.md +0 -77
  100. package/docs/src/core/components/ui/form/form-layout/form-layout.md +0 -44
  101. package/docs/src/core/components/ui/form/input/input.md +0 -142
  102. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -133
  103. package/docs/src/core/components/ui/form/radio/radio.md +0 -57
  104. package/docs/src/core/components/ui/form/select/select.md +0 -71
  105. package/docs/src/core/components/ui/form/switch/switch.md +0 -57
  106. package/docs/src/core/components/ui/form/textarea/textarea.md +0 -65
  107. package/docs/src/core/components/ui/group/group.md +0 -75
  108. package/docs/src/core/components/ui/icon/icon.md +0 -125
  109. package/docs/src/core/components/ui/icon/icons.json +0 -1
  110. package/docs/src/core/components/ui/image/image.md +0 -107
  111. package/docs/src/core/components/ui/link/link.md +0 -43
  112. package/docs/src/core/components/ui/loader/loader.md +0 -55
  113. package/docs/src/core/components/ui/menu/menu.md +0 -329
  114. package/docs/src/core/components/ui/modal/modal.md +0 -119
  115. package/docs/src/core/components/ui/pop/pop.md +0 -96
  116. package/docs/src/core/components/ui/progress/progress.md +0 -63
  117. package/docs/src/core/components/ui/table/table.md +0 -455
  118. package/docs/src/core/components/ui/toast/toast.md +0 -166
  119. package/docs/src/core/components/ui/tooltip/tooltip.md +0 -82
  120. package/docs/src/docs/_core-concept/dataFlow.md +0 -73
  121. package/docs/src/docs/_core-concept/overview.md +0 -57
  122. package/docs/src/docs/_core-concept/subscriber.md +0 -75
  123. package/docs/src/docs/_decorators/ancestor-attribute.md +0 -79
  124. package/docs/src/docs/_decorators/auto-subscribe.md +0 -202
  125. package/docs/src/docs/_decorators/bind.md +0 -167
  126. package/docs/src/docs/_decorators/get.md +0 -68
  127. package/docs/src/docs/_decorators/handle.md +0 -171
  128. package/docs/src/docs/_decorators/on-assign.md +0 -388
  129. package/docs/src/docs/_decorators/publish.md +0 -55
  130. package/docs/src/docs/_decorators/subscribe.md +0 -97
  131. package/docs/src/docs/_decorators/wait-for-ancestors.md +0 -163
  132. package/docs/src/docs/_directives/sub.md +0 -91
  133. package/docs/src/docs/_getting-started/ai-agents.md +0 -56
  134. package/docs/src/docs/_getting-started/concorde-manual-install.md +0 -133
  135. package/docs/src/docs/_getting-started/concorde-outside.md +0 -33
  136. package/docs/src/docs/_getting-started/create-a-component.md +0 -139
  137. package/docs/src/docs/_getting-started/my-first-component.md +0 -236
  138. package/docs/src/docs/_getting-started/my-first-subscriber.md +0 -120
  139. package/docs/src/docs/_getting-started/pubsub.md +0 -37
  140. package/docs/src/docs/_getting-started/start.md +0 -47
  141. package/docs/src/docs/_getting-started/theming.md +0 -91
  142. package/docs/src/docs/_misc/api-configuration.md +0 -79
  143. package/docs/src/docs/_misc/dataProviderKey.md +0 -168
  144. package/docs/src/docs/_misc/docs-mock-api.md +0 -60
  145. package/docs/src/docs/_misc/endpoint.md +0 -43
  146. package/docs/src/docs/_misc/html-integration.md +0 -13
  147. package/docs/src/docs/search/docs-search.json +0 -8532
  148. package/docs/src/tag-list.json +0 -1
  149. package/docs/src/tsconfig-model.json +0 -23
  150. package/docs/src/tsconfig.json +0 -1050
  151. package/php/get-challenge.php +0 -34
  152. package/php/some-service.php +0 -42
@@ -1,163 +0,0 @@
1
- # @awaitConnectedAncestors and @dispatchConnectedEvent
2
-
3
- The `@awaitConnectedAncestors` and `@dispatchConnectedEvent` decorators delay a web component's initialization until its matching ancestors have executed their `connectedCallback`. This is when contextual elements (publisher, dataProvider, etc.) are configured.
4
-
5
- ## Principle
6
-
7
- When a child component attaches to the DOM, its ancestors may not yet be initialized (especially if custom element definitions are loaded asynchronously). The `@awaitConnectedAncestors` decorator delays the component's `connectedCallback` until all ancestors matching the provided CSS selectors have executed their `connectedCallback`.
8
-
9
- The `@dispatchConnectedEvent` decorator allows ancestors to signal they are ready by dispatching the `sonic-connected` event at the end of their `connectedCallback`. The event bubbles, so it can be listened to from anywhere (e.g. `document.addEventListener(CONNECTED, handler)`).
10
-
11
- Ancestors that are not web components (no hyphen in tag name) are considered connected by default and do not need to emit the event.
12
-
13
- ## Usage
14
-
15
- ### Import
16
-
17
- <sonic-code language="typescript">
18
- <template>
19
- import { awaitConnectedAncestors, dispatchConnectedEvent, ancestorAttribute } from "@supersoniks/concorde/decorators";
20
- </template>
21
- </sonic-code>
22
-
23
- ### Basic example
24
-
25
- An ancestor container decorated with `@dispatchConnectedEvent()` signals when it is ready. A child component decorated with `@awaitConnectedAncestors("demo-wait-ancestor-container[dataProvider]")` waits for this container to be initialized before initializing itself. Parameters are CSS selectors (`element.matches()`).
26
-
27
- The parent is registered via `customElements.define()` (vanilla JS) rather than `@customElement`, so it can be defined later—e.g. when the user clicks a button. This demonstrates the child waiting until the parent exists.
28
-
29
- <sonic-code language="typescript">
30
- <template>
31
- import { html, LitElement } from "lit";
32
- import { customElement, state } from "lit/decorators.js";
33
-
34
- // Parent: registered later via customElements.define(), not @customElement
35
- @dispatchConnectedEvent()
36
- export class DemoWaitAncestorContainer extends LitElement {
37
- render() {
38
- return html`<slot></slot>`;
39
- }
40
- }
41
-
42
- // Child: waits for parent before initializing
43
- @customElement("demo-wait-ancestor-value")
44
- @awaitConnectedAncestors("demo-wait-ancestor-container[dataProvider]")
45
- export class DemoWaitAncestorValue extends LitElement {
46
- @ancestorAttribute("dataProvider")
47
- dataProvider: string | null = null;
48
-
49
- @state() initializedAt: string = "";
50
-
51
- connectedCallback() {
52
- super.connectedCallback();
53
- this.initializedAt = new Date().toISOString();
54
- }
55
-
56
- render() {
57
- return html`
58
- <p>DataProvider from ancestor: <strong>${this.dataProvider || "—"}</strong></p>
59
- <p>Initialized at: ${this.initializedAt || "(waiting for parent…)"}</p>
60
- `;
61
- }
62
- }
63
-
64
- // Demo section: register parent via customElements.define() when user clicks
65
- @customElement("demo-wait-ancestors-section")
66
- export class DemoWaitAncestorsSection extends LitElement {
67
- registerParent() {
68
- if (!customElements.get("demo-wait-ancestor-container")) {
69
- customElements.define("demo-wait-ancestor-container", DemoWaitAncestorContainer);
70
- }
71
- }
72
- render() {
73
- return html`
74
- <sonic-button @click=${this.registerParent}>Register parent component</sonic-button>
75
- <demo-wait-ancestor-container dataProvider="waitAncestorDemo">
76
- <demo-wait-ancestor-value></demo-wait-ancestor-value>
77
- </demo-wait-ancestor-container>
78
- `;
79
- }
80
- }
81
- </template>
82
- </sonic-code>
83
-
84
- <sonic-code>
85
- <template>
86
- <docs-demo-sources for="demo-wait-ancestors-section"></docs-demo-sources>
87
- <demo-wait-ancestors-section></demo-wait-ancestors-section>
88
- </template>
89
- </sonic-code>
90
-
91
- ### Multiple ancestors
92
-
93
- The child waits for all specified ancestors. Register outer first, then inner — the child initializes only when both are ready.
94
-
95
- <sonic-code>
96
- <template>
97
- <demo-wait-ancestors-multi-section></demo-wait-ancestors-multi-section>
98
- </template>
99
- </sonic-code>
100
-
101
- ### Ancestors already connected
102
-
103
- When the parent is defined at load and already in the DOM, the child initializes immediately (no delay).
104
-
105
- **Static (both in DOM from start):**
106
-
107
- <sonic-code>
108
- <template>
109
- <docs-demo-sources for="demo-wait-ancestors-static-section"></docs-demo-sources>
110
- <demo-wait-ancestors-static-section></demo-wait-ancestors-static-section>
111
- </template>
112
- </sonic-code>
113
-
114
- **Dynamic (child added on button click):**
115
-
116
- <sonic-code>
117
- <template>
118
- <docs-demo-sources for="demo-wait-ancestors-ready-section"></docs-demo-sources>
119
- <demo-wait-ancestors-ready-section></demo-wait-ancestors-ready-section>
120
- </template>
121
- </sonic-code>
122
-
123
- ## CSS selector support
124
-
125
- Parameters are CSS selectors matched via `element.matches()` — e.g. `"sonic-subscriber"`, `"sonic-subscriber[dataProvider]"`, `".my-container"`, or multiple: `"sonic-subscriber", "sonic-sdui"`.
126
-
127
- ## Behavior
128
-
129
- - Ancestor search uses CSS selectors (`element.matches(selector)`) — supports tag names, classes, attributes, combinators, etc.
130
- - Traversal includes shadow roots (parentNode / host)
131
- - Non-web components (no hyphen in tag name) are considered connected by default
132
- - For web component ancestors, it waits for `customElements.whenDefined(tagName)` and the `sonic-connected` event (or a timeout as fallback)
133
- - If no matching ancestor is found, the original `connectedCallback` is called immediately
134
- - Ancestors that do not emit `sonic-connected` trigger the fallback after the timeout (compatibility with existing components)
135
-
136
- ## Use cases
137
-
138
- These decorators are particularly useful for:
139
-
140
- - **sonic-value** inside a **sonic-subscriber**: the value waits for the subscriber to configure its publisher
141
- - **Components inside sonic-sdui**: wait for the SDUI to load and configure its context
142
- - **Any component** depending on context provided by an ancestor custom element
143
-
144
- ## Listening to the connected event
145
-
146
- The `sonic-connected` event bubbles, so you can listen to it from anywhere:
147
-
148
- <sonic-code language="typescript">
149
- <template>
150
- import { CONNECTED } from "@supersoniks/concorde/decorators";
151
-
152
- someConnectable.addEventListener(CONNECTED, (e) => {
153
- console.log("Component connected:", e.target);
154
- });
155
- </template>
156
- </sonic-code>
157
-
158
- ## Notes
159
-
160
- - These decorators apply only to web components (classes extending `HTMLElement`)
161
- - The fallback timeout ensures compatibility with components that do not yet use `@dispatchConnectedEvent`
162
- - Traversal includes shadow roots
163
- - For a guarantee without relying on the timeout, decorate ancestors (Subscriber, Fetcher, etc.) with `@dispatchConnectedEvent`
@@ -1,91 +0,0 @@
1
- # sub()
2
-
3
- Read-only Lit directive: displays the current **DataProvider** value and updates whenever it is assigned.
4
-
5
- ## Import
6
-
7
- <sonic-code language="typescript">
8
- <template>
9
- import { sub } from "@supersoniks/concorde/directives";
10
- </template>
11
- </sonic-code>
12
-
13
- ## String path
14
-
15
- <sonic-code language="typescript">
16
- <template>
17
- render() {
18
- return html`&lt;p&gt;Count: ${sub("myCounter.count")}&lt;/p&gt;`;
19
- }
20
- </template>
21
- </sonic-code>
22
-
23
- ## DataProviderKey (static)
24
-
25
- <sonic-code language="typescript">
26
- <template>
27
- import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
28
- import { sub } from "@supersoniks/concorde/directives";
29
-
30
- const counterKey = new DataProviderKey&lt;{ count: number }&gt;("myCounter");
31
-
32
- render() {
33
- return html`&lt;p&gt;${sub(counterKey.count)}&lt;/p&gt;`;
34
- }
35
- </template>
36
- </sonic-code>
37
-
38
- ## Dynamic DataProviderKey (`${prop}`)
39
-
40
- Like `@subscribe`: the path is resolved on the template **host component**; the directive re-subscribes when observed props change.
41
-
42
- <sonic-code language="typescript">
43
- <template>
44
- import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
45
- import { sub } from "@supersoniks/concorde/directives";
46
-
47
- type User = { firstName: string; lastName: string; email: string };
48
- const userKey = new DataProviderKey&lt;User, { userIndex: number }&gt;(
49
- "demoUsers.${userIndex}",
50
- );
51
-
52
- @customElement("demo-sub-dynamic")
53
- export class DemoSubDynamic extends LitElement {
54
- @property({ type: Number }) userIndex = 0;
55
-
56
- render() {
57
- return html`
58
- &lt;p&gt;${sub(userKey.email)}&lt;/p&gt;
59
- `;
60
- }
61
- }
62
- </template>
63
- </sonic-code>
64
-
65
- ## Demo
66
-
67
- <sonic-code toggleCode>
68
- <template>
69
- <docs-demo-sources for="demo-sub-template"></docs-demo-sources>
70
- <demo-sub-template></demo-sub-template>
71
- </template>
72
- </sonic-code>
73
-
74
- ## Concatenation (forms)
75
-
76
- <sonic-code language="typescript">
77
- <template>
78
- html`&lt;span&gt;${sub(this.formDataProvider + ".email")}&lt;/span&gt;`
79
- </template>
80
- </sonic-code>
81
-
82
- ## sub() vs get() / set() / dp()
83
-
84
- | API | Context | Dynamic `${…}` |
85
- |-----|----------|------------------|
86
- | `sub()` | Lit template, reactive | Yes |
87
- | `get` / `set` / `dp` | Imperative code | No |
88
-
89
- Do not replace `sub(path)` with `get(path)` in a template: `get` returns a one-time snapshot.
90
-
91
- See [DataProviderKey](#docs/_misc/dataProviderKey.md/dataProviderKey), [@subscribe](#docs/_decorators/subscribe.md/subscribe), and the `concorde-get-set-dp` migration skill.
@@ -1,56 +0,0 @@
1
- # AI agents (skills & AGENTS.md)
2
-
3
- Concorde ships **skills**, **rules**, and a root **`AGENTS.md`** so Cursor, JetBrains AI Assistant, and other coding agents follow framework patterns (DataProvider, decorators, short imports, scope, theme, migrations).
4
-
5
- On a [starter](#docs/_getting-started/concorde-outside.md/concorde-outside) project, run `yarn ai:sync` after install. On a [manual / brownfield](#docs/_getting-started/concorde-manual-install.md/concorde-manual-install) project, install Concorde first, then use `ai-init` below.
6
-
7
- ## Dedicated commands
8
-
9
- | Context | Command |
10
- |---------|---------|
11
- | [create-concorde-ts-starter](https://www.npmjs.com/package/@supersoniks/create-concorde-ts-starter) project | `yarn ai:sync` |
12
- | Any consumer app (after `yarn add @supersoniks/concorde`) | `node node_modules/@supersoniks/concorde/scripts/ai-init.mjs` |
13
- | Concorde repo (contributors) | `yarn ai-init` |
14
-
15
- <sonic-code language="shell">
16
- <template>
17
- # Starter (from project root)
18
- yarn ai:sync
19
-
20
- # Manual / existing project
21
- node node_modules/@supersoniks/concorde/scripts/ai-init.mjs
22
- </template>
23
- </sonic-code>
24
-
25
- ## Useful flags
26
-
27
- | Flag | Effect |
28
- |------|--------|
29
- | `--merge-agents` | Append to an existing `AGENTS.md` instead of replacing it |
30
- | `--overlay <dir>` | Copy extra rules/skills from another layer (e.g. starter kit) |
31
- | `--cursor-only` | Install only `.cursor/skills` and `.cursor/rules` |
32
- | `--jetbrains-only` | Install only `.aiassistant/rules/` |
33
-
34
- ## What gets installed
35
-
36
- | Path | Role |
37
- |------|------|
38
- | `AGENTS.md` | Project-level guide for agents (Concorde conventions) |
39
- | `.cursor/skills/concorde/` | Core Lit + DataProvider patterns |
40
- | `.cursor/skills/concorde-imports/` | Short `@supersoniks/concorde/…` import paths |
41
- | `.cursor/skills/concorde-scope/` | `serviceURL`, `formDataProvider`, API configuration |
42
- | `.cursor/skills/concorde-theme/` | `sonic-theme` and `--sc-*` tokens |
43
- | `.cursor/skills/concorde-menu/` | `sonic-menu` navigation |
44
- | `.cursor/skills/concorde-get-set-dp/` | `get` / `set` / `dp` and `DataProviderKey` migration |
45
- | `.cursor/rules/concorde.mdc` | Cursor rules (always-on patterns) |
46
- | `.aiassistant/rules/concorde.md` | JetBrains AI Assistant rules |
47
-
48
- ## Workflow
49
-
50
- 1. **Starter project:** [Installation](#docs/_getting-started/concorde-outside.md/concorde-outside) — `yarn ai:sync` is wired in the kit.
51
- 2. **Existing / manual Vite project:** [Manual installation](#docs/_getting-started/concorde-manual-install.md/concorde-manual-install), then **`ai-init`** after `yarn add @supersoniks/concorde`.
52
- 3. Commit `AGENTS.md`, `.cursor/`, and `.aiassistant/` if your team shares agent settings.
53
- 4. Re-run the same command when you bump `@supersoniks/concorde` to refresh skills from `node_modules/@supersoniks/concorde/ai/`.
54
- 5. In Cursor, skills under `.cursor/skills/` are picked up automatically; mention a skill in chat for focused tasks (e.g. migration → `concorde-get-set-dp`).
55
-
56
- Source files in the npm package: `node_modules/@supersoniks/concorde/ai/` (see also `ai/README.md` in the [Concorde repository](https://github.com/supersoniks/concorde)).
@@ -1,133 +0,0 @@
1
- # Manual installation (Vite)
2
-
3
- > **Legacy** — for brownfield apps or custom stacks. New projects should use the [starter](#docs/_getting-started/concorde-outside.md/concorde-outside).
4
-
5
- ## Brand New Vite Project
6
-
7
- Tailwind configuration is not covered here yet.
8
-
9
- ### Creating the Project
10
-
11
- <sonic-code language="shell">
12
- <template>
13
- # Pure JavaScript project
14
- yarn create vite --template vanilla-js
15
- # TypeScript project
16
- # (it is recommended to use this approach, which installs Lit separately if needed, via "yarn add lit")
17
- yarn create vite --template vanilla-ts
18
- # TypeScript + Lit project
19
- # (creating new web components, for example, to extend the fetch or subscriber mixins)
20
- yarn create vite --template lit-ts
21
- </template>
22
- </sonic-code>
23
-
24
- Using Lit with TypeScript requires the following configuration in the "compilerOptions" section of the `tsconfig.json` file:
25
-
26
- <sonic-code language="json">
27
- <template>
28
- "experimentalDecorators": true,
29
- "useDefineForClassFields": false
30
- </template>
31
- </sonic-code>
32
-
33
- ### Installing Concorde
34
-
35
- Navigate to the project folder created and perform the installation:
36
-
37
- <sonic-code language="shell">
38
- <template>
39
- yarn add @supersoniks/concorde
40
- </template>
41
- </sonic-code>
42
-
43
- Agent skills (`AGENTS.md`, Cursor / JetBrains): see [AI agents](#docs/_getting-started/ai-agents.md/ai-agents) — run `node node_modules/@supersoniks/concorde/scripts/ai-init.mjs` after install.
44
-
45
- ### Development / Build
46
-
47
- <sonic-code language="shell">
48
- <template>
49
- # Development (you can add `--host` after the command chain in package.json's dev script instead of typing it each time as shown below)
50
- yarn dev --host
51
- # Build
52
- yarn build
53
- </template>
54
- </sonic-code>
55
-
56
- ## Shortcut Imports
57
-
58
- Shortcut imports work by default in JavaScript, but in TypeScript, they are activated by choice as they inject data into *tsconfig.json*. Here is the command:
59
-
60
- <sonic-code language="shell">
61
- <template>
62
- npx concorde enable-short-paths
63
- </template>
64
- </sonic-code>
65
-
66
- Shortcut imports replace the actual paths with aliases as follows:
67
-
68
- * `@supersoniks/concorde/core/components/functional_or_ui/component/component` becomes `@supersoniks/concorde/functional_or_ui/component`
69
- * `@supersoniks/concorde/core/mixins_or_utils/class_name` becomes `@supersoniks/concorde/mixins_or_utils/class_name`
70
-
71
- The original paths remain accessible. Shortcut imports are used for the examples later in this documentation.
72
-
73
- ## Usage
74
-
75
- ### Simple Integration in HTML
76
-
77
- Import needed component in `main.ts` or wherever you want to use it:
78
-
79
- <sonic-code language="typescript">
80
- <template>
81
- import "@supersoniks/concorde/ui/button";
82
- </template>
83
- </sonic-code>
84
-
85
- Then in the render function ofyour component or in the HTML of the web page that includes the compiled JS, use the component as follows:
86
-
87
- <sonic-code>
88
- <template>
89
- <sonic-button variant="outline">My button</sonic-button>
90
- </template>
91
- </sonic-code>
92
-
93
- ### Using a Mixin to Create a New Lit Component
94
-
95
- For example, create a file `my-element.ts` at the root:
96
-
97
- <sonic-code language="typescript">
98
- <template>
99
- import { html, LitElement } from "lit";
100
- import { customElement, property } from "lit/decorators.js";
101
- import Fetcher from "@supersoniks/concorde/mixins/Fetcher";
102
- import Subscriber from "@supersoniks/concorde/mixins/Subscriber";
103
-
104
- @customElement("my-element")
105
- export class SonicComponent extends Fetcher(Subscriber(LitElement)) {
106
- @property() email = "";
107
- @property() first_name = "";
108
- @property() last_name = "";
109
-
110
- render() {
111
- return html`<div>
112
- ${this.first_name} ${this.last_name} : ${this.email}
113
- </div>`;
114
- }
115
- }
116
- </template>
117
- </sonic-code>
118
-
119
- Import component `main.ts` or `main.js` or any other component that uses it to be compiled
120
-
121
- <sonic-code language="typescript">
122
- <template>
123
- import "./my-element";
124
- </template>
125
- </sonic-code>
126
-
127
- In the HTML of a JS or TS component or in the HTML of the web page containing the compiled JS:
128
-
129
- <sonic-code language="html">
130
- <template>
131
- <my-element serviceURL="/docs-mock-api" dataProvider="api/users/2" key="data"></my-element>
132
- </template>
133
- </sonic-code>
@@ -1,33 +0,0 @@
1
- # Installation
2
-
3
- <sonic-alert status="success" label="Recommended — use the starter" size="xl" background>
4
- <p><strong>For almost all new projects, use <a href="https://www.npmjs.com/package/@supersoniks/create-concorde-ts-starter">create-concorde-ts-starter</a>.</strong></p>
5
- <p>You get Vite + TypeScript + Lit + Tailwind, an example component, <code>npx concorde enable-short-paths</code> ready to run, and <code>yarn ai:sync</code> for <a href="#docs/_getting-started/ai-agents.md/ai-agents">AI agent skills</a> (<code>AGENTS.md</code>, Cursor / JetBrains rules) without extra setup.</p>
6
- </sonic-alert>
7
-
8
- ## Starter
9
-
10
- The following command creates a new Vite project in TypeScript mode with Tailwind and an example component to get started.
11
-
12
- <sonic-code language="shell">
13
- <template>
14
- npx @supersoniks/create-concorde-ts-starter "project_name"
15
- </template>
16
- </sonic-code>
17
-
18
- Then, from the project folder:
19
-
20
- <sonic-code language="shell">
21
- <template>
22
- yarn install
23
- yarn dev --host
24
- </template>
25
- </sonic-code>
26
-
27
- ## Next steps
28
-
29
- | Step | Page |
30
- |------|------|
31
- | Learn patterns | [My first component](#docs/_getting-started/my-first-component.md/my-first-component) |
32
- | Agent skills | [AI agents (skills)](#docs/_getting-started/ai-agents.md/ai-agents) — `yarn ai:sync` on the starter |
33
- | Brownfield / manual Vite | [Legacy: Manual installation](#docs/_getting-started/concorde-manual-install.md/concorde-manual-install) |
@@ -1,139 +0,0 @@
1
- # Creating components
2
-
3
- > **New app components:** start with [My first component](#docs/_getting-started/my-first-component.md/my-first-component) and [Data flow](#docs/_core-concept/dataFlow.md/dataFlow). The `Subscriber` mixin below is [legacy](#docs/_core-concept/subscriber.md/subscriber).
4
-
5
- ## Where to put it?
6
-
7
- In this document, we consider the src directory of the project as the root.<br>
8
- We describe how we organize our components as an example, however it depends on your project.
9
-
10
- In concorde each component is currently organized in the following directory structure (at least we try):
11
-
12
- - **/core/components/functional/component-name/component-name.ts**
13
- Generic/functional/generally unstyled component.
14
- The component usually doesn't use any other concrete components.
15
- - **/core/components/ui/component-name/component-name.ts**
16
- Generic but UI-oriented component.
17
- The component usually only uses generic components and other UI components.
18
- - **la-billetterie/components/atoms/component-name/component-name.ts**
19
- The component is intended to have a concrete usage within our ticketing system **"la-billetterie"**.
20
- It usually only uses generic components from `core` and possibly other atoms.
21
- - **la-billetterie/components/concrete-destination/component-name/component-name.ts**
22
- The component has a specific destination: (event / cart / gift card): `/components/destination/`
23
- The component uses various components, usually from the `/components/atoms` directory.
24
- It does not use components at the same level in the file hierarchy.
25
-
26
- ## Starting from a Simple Model
27
-
28
- You can copy `example.ts` from the source to the desired destination to start with.
29
- This file contains a web component in the form of a class that extends the `Subscriber` mixin, with a reactive property and a render function.
30
-
31
- <sonic-code language="javascript">
32
- <template>
33
- import { html, LitElement } from "lit";
34
- import { customElement, property } from "lit/decorators.js";
35
- import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
36
-
37
- @customElement("sonic-example")
38
- export class SonicComponent extends Subscriber(LitElement) {
39
- @property() text = "Example";
40
- render() {
41
- return html`${this.text}`;
42
- }
43
- }
44
- </template>
45
- </sonic-code>
46
-
47
- **You can remove the dependency on `Subscriber`** if automatic population of the component with external data is not required.
48
- For example, for a UI component:
49
-
50
-
51
- <sonic-code language="javascript">
52
- <template>
53
- import { html, LitElement } from "lit";
54
- import { customElement, property } from "lit/decorators.js";
55
-
56
- @customElement("sonic-example")
57
- export class SonicComponent extends LitElement {
58
- @property() text = "Example";
59
- render() {
60
- return html`${this.text}`;
61
- }
62
- }
63
- </template>
64
- </sonic-code>
65
-
66
- Regarding `Subscriber`, see:
67
-
68
- - [🔔 Subscriber](#docs/_core-concept/subscriber.md/subscriber)
69
- - [🥨 Sharing Data](#docs/_getting-started/pubsub.md/pubsub)
70
-
71
- ### Naming the Component
72
-
73
- The class name is not necessarily important. However, it is important to **give it a component name prefixed with "sonic"** (or a prefix of your own) using the dedicated metadata already present in the copied document. For example, a button component would be named as follows:
74
-
75
-
76
- <sonic-code language="typescript">
77
- <template>
78
- @customElement("sonic-button")
79
- </template>
80
- </sonic-code>
81
-
82
- For less generic components with a specific destination, we advise to include the destination in the name.
83
- For example, for a "title" component in the "event" destination, the name would be simply:
84
-
85
-
86
- <sonic-code language="typescript">
87
- <template>
88
- @customElement("sonic-event-title")
89
- </template>
90
- </sonic-code>
91
-
92
-
93
- ## Modifying It
94
-
95
- #### Creating Reactive Properties and Modifying the Render Function
96
-
97
- To do this, study the functioning of https://lit.dev and also refer to [Subscriber](#docs/_core-concept/subscriber.md/subscriber).
98
-
99
- #### HTML Structure of a Component
100
-
101
- The HTML structure of a component should remain as simple as possible.
102
-
103
- Ideally, there should be only one additional level of elements in addition to slots.
104
-
105
- - **The main component is already a wrapper**.
106
- It receives classes to manage its layout, but it should not style internal elements.
107
- - **Slots handle the visual organization** of elements.
108
- - **The specificity of the component is expressed in this additional level** by adding a list, a functional native element (e.g., button), or another component.
109
-
110
- This leads to the creation of more components and thus raises questions about the hierarchical organization of files. However, this tends to atomize their roles.
111
-
112
- ## Referencing It
113
-
114
- To compile the component, it needs to be referenced somewhere through an import statement. In particular, it is important to reference it in any component that uses it.
115
-
116
- In the case where it can be directly used in a page, it should also be globally referenced, especially considering the creation of **specific bundles** in the future.
117
-
118
- Here's where we add imports based on the component's location inside concorde as an example
119
-
120
- - **/core/components/functional/component-name/component-name.ts**
121
- In `/core/components/functional/functional.ts`, which is referenced in core.ts and imported in `index.ts`.
122
- - **/core/components/ui/component-name/component-name.ts**
123
- In `/core/components/ui/ui.ts`, which is referenced in core.ts and imported in `index.ts`.
124
- - **la-billetterie/components/atoms/component-name/component-name.ts**
125
- Nowhere else but where it will be used, except for possible **temporary** tests, for example, in `index.ts`.
126
- - **la-billetterie/components/concrete-destination/component-name/component-name.ts**
127
- In `la-billetterie/components/concrete-destination/destination-concrete.ts`.
128
- If it's a new destination, you'll need to create the corresponding import .ts file and import it in `la-billetterie.ts`.
129
-
130
- ## Using It
131
-
132
- As a reminder, the component is simply integrated into the context by adding a tag with the component's name, for example:
133
-
134
-
135
- <sonic-code language="html">
136
- <template>
137
- <sonic-event-title></sonic-event-title>
138
- </template>
139
- </sonic-code>