@supersoniks/concorde 3.2.0 → 3.2.2

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 (216) hide show
  1. package/build-infos.json +1 -1
  2. package/concorde-core.bundle.js +101 -101
  3. package/concorde-core.es.js +187 -182
  4. package/dist/concorde-core.bundle.js +101 -101
  5. package/dist/concorde-core.es.js +187 -182
  6. package/index.html +0 -0
  7. package/package.json +1 -1
  8. package/scripts/create-search.js +0 -0
  9. package/scripts/generate-routes.js +0 -0
  10. package/src/core/_types/types.ts +0 -0
  11. package/src/core/components/functional/date/date.ts +0 -0
  12. package/src/core/components/functional/functional.ts +0 -0
  13. package/src/core/components/functional/if/if.md +0 -0
  14. package/src/core/components/functional/if/if.test.ts +0 -0
  15. package/src/core/components/functional/list/list.spec.ts +0 -0
  16. package/src/core/components/functional/queue/queue.demo.ts +0 -0
  17. package/src/core/components/functional/router/router.demo.ts +0 -0
  18. package/src/core/components/functional/router/router.md +0 -0
  19. package/src/core/components/functional/router/router.spec.ts +0 -0
  20. package/src/core/components/functional/router/router.ts +0 -0
  21. package/src/core/components/functional/sonic-scope/sonic-scope.ts +0 -0
  22. package/src/core/components/functional/states/states.demo.ts +0 -0
  23. package/src/core/components/functional/states/states.md +0 -0
  24. package/src/core/components/functional/states/states.spec.ts +0 -0
  25. package/src/core/components/functional/states/states.ts +0 -0
  26. package/src/core/components/functional/submit/submit.ts +0 -0
  27. package/src/core/components/functional/translation/translation.ts +0 -0
  28. package/src/core/components/ui/_css/scroll.ts +0 -0
  29. package/src/core/components/ui/_css/shadow.ts +0 -0
  30. package/src/core/components/ui/_css/size.ts +0 -0
  31. package/src/core/components/ui/_css/type.ts +0 -0
  32. package/src/core/components/ui/alert/alert.md +0 -0
  33. package/src/core/components/ui/alert/alert.ts +0 -0
  34. package/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  35. package/src/core/components/ui/badge/badge.md +0 -0
  36. package/src/core/components/ui/badge/badge.ts +0 -0
  37. package/src/core/components/ui/button/button.md +0 -0
  38. package/src/core/components/ui/button/button.ts +0 -0
  39. package/src/core/components/ui/captcha/captcha.md +0 -0
  40. package/src/core/components/ui/captcha/captcha.ts +0 -0
  41. package/src/core/components/ui/card/card-footer.ts +0 -0
  42. package/src/core/components/ui/card/card-header-descripton.ts +0 -0
  43. package/src/core/components/ui/card/card-header.ts +0 -0
  44. package/src/core/components/ui/card/card-main.ts +0 -0
  45. package/src/core/components/ui/card/card.md +0 -0
  46. package/src/core/components/ui/card/card.ts +0 -0
  47. package/src/core/components/ui/divider/divider.ts +0 -0
  48. package/src/core/components/ui/form/checkbox/checkbox.md +0 -0
  49. package/src/core/components/ui/form/checkbox/checkbox.ts +0 -0
  50. package/src/core/components/ui/form/css/form-control.ts +0 -0
  51. package/src/core/components/ui/form/fieldset/fieldset.ts +0 -0
  52. package/src/core/components/ui/form/fieldset/legend-description.ts +0 -0
  53. package/src/core/components/ui/form/fieldset/legend.ts +0 -0
  54. package/src/core/components/ui/form/form-layout/form-layout.md +0 -0
  55. package/src/core/components/ui/form/input/input.md +0 -0
  56. package/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -0
  57. package/src/core/components/ui/form/radio/radio.md +0 -0
  58. package/src/core/components/ui/form/radio/radio.ts +0 -0
  59. package/src/core/components/ui/form/select/select.md +0 -0
  60. package/src/core/components/ui/form/switch/switch.md +0 -0
  61. package/src/core/components/ui/form/switch/switch.ts +0 -0
  62. package/src/core/components/ui/form/textarea/textarea.ts +0 -0
  63. package/src/core/components/ui/icon/icons.ts +14 -3
  64. package/src/core/components/ui/image/image.md +0 -0
  65. package/src/core/components/ui/image/image.ts +0 -0
  66. package/src/core/components/ui/loader/loader.md +0 -0
  67. package/src/core/components/ui/loader/loader.ts +0 -0
  68. package/src/core/components/ui/loader/styles/fixed.ts +0 -0
  69. package/src/core/components/ui/loader/styles/inline.ts +0 -0
  70. package/src/core/components/ui/menu/menu.ts +0 -0
  71. package/src/core/components/ui/modal/modal-actions.ts +0 -0
  72. package/src/core/components/ui/modal/modal-close.ts +0 -0
  73. package/src/core/components/ui/modal/modal-subtitle.ts +0 -0
  74. package/src/core/components/ui/modal/modal-title.ts +0 -0
  75. package/src/core/components/ui/modal/modal.md +0 -0
  76. package/src/core/components/ui/pop/pop.md +0 -0
  77. package/src/core/components/ui/progress/progress.ts +0 -0
  78. package/src/core/components/ui/table/table-tbody.ts +0 -0
  79. package/src/core/components/ui/table/table-th.ts +0 -0
  80. package/src/core/components/ui/table/table.ts +0 -0
  81. package/src/core/components/ui/theme/theme-collection/core-variables.ts +0 -0
  82. package/src/core/components/ui/theme/theme-collection/dark.ts +0 -0
  83. package/src/core/components/ui/theme/theme-collection/light.ts +0 -0
  84. package/src/core/components/ui/theme/theme.ts +0 -0
  85. package/src/core/components/ui/toast/toast-item.ts +0 -0
  86. package/src/core/components/ui/tooltip/tooltip.ts +0 -0
  87. package/src/core/components/ui/ui.ts +0 -0
  88. package/src/core/directives/DataProvider.ts +0 -0
  89. package/src/core/directives/Wording.ts +0 -0
  90. package/src/core/mixins/Fetcher.ts +0 -0
  91. package/src/core/mixins/FormCheckable.ts +0 -0
  92. package/src/core/mixins/TemplatesContainer.ts +0 -0
  93. package/src/core/utils/HTML.ts +0 -0
  94. package/src/core/utils/LocationHandler.ts +0 -0
  95. package/src/core/utils/Objects.ts +0 -0
  96. package/src/core/utils/Utils.ts +0 -0
  97. package/src/core/utils/api.ts +0 -0
  98. package/src/core/utils/route.spec.ts +0 -0
  99. package/src/core/utils/route.ts +0 -0
  100. package/src/docs/code.ts +0 -0
  101. package/src/docs/docs.ts +0 -0
  102. package/src/docs/header/header.ts +0 -0
  103. package/src/docs/layout.ts +0 -0
  104. package/src/docs/navigation/navigation.ts +0 -0
  105. package/src/docs/search/docs-search.json +0 -0
  106. package/src/docs/search/markdown-renderer.ts +0 -0
  107. package/src/docs/search/page.ts +0 -0
  108. package/src/docs/search/search.ts +0 -0
  109. package/src/docs/tailwind/css/tailwind.css +0 -0
  110. package/src/docs/tailwind/css.d.ts +0 -0
  111. package/src/index.ts +0 -0
  112. package/src/test-utils/TestUtils.ts +0 -0
  113. package/src/tsconfig-model.json +0 -0
  114. package/src/tsconfig.json +294 -294
  115. package/tailwind.config.js +0 -0
  116. package/templates-test.html +0 -0
  117. package/vite/config.js +0 -0
  118. package/docs/assets/index-C0K6xugr.css +0 -1
  119. package/docs/assets/index-Dgl1lJQo.js +0 -4861
  120. package/docs/css/docs.css +0 -0
  121. package/docs/fonts/ClashGrotesk-Bold.eot +0 -0
  122. package/docs/fonts/ClashGrotesk-Bold.ttf +0 -0
  123. package/docs/fonts/ClashGrotesk-Bold.woff +0 -0
  124. package/docs/fonts/ClashGrotesk-Bold.woff2 +0 -0
  125. package/docs/fonts/ClashGrotesk-Extralight.eot +0 -0
  126. package/docs/fonts/ClashGrotesk-Extralight.ttf +0 -0
  127. package/docs/fonts/ClashGrotesk-Extralight.woff +0 -0
  128. package/docs/fonts/ClashGrotesk-Extralight.woff2 +0 -0
  129. package/docs/fonts/ClashGrotesk-Light.eot +0 -0
  130. package/docs/fonts/ClashGrotesk-Light.ttf +0 -0
  131. package/docs/fonts/ClashGrotesk-Light.woff +0 -0
  132. package/docs/fonts/ClashGrotesk-Light.woff2 +0 -0
  133. package/docs/fonts/ClashGrotesk-Medium.eot +0 -0
  134. package/docs/fonts/ClashGrotesk-Medium.ttf +0 -0
  135. package/docs/fonts/ClashGrotesk-Medium.woff +0 -0
  136. package/docs/fonts/ClashGrotesk-Medium.woff2 +0 -0
  137. package/docs/fonts/ClashGrotesk-Regular.eot +0 -0
  138. package/docs/fonts/ClashGrotesk-Regular.ttf +0 -0
  139. package/docs/fonts/ClashGrotesk-Regular.woff +0 -0
  140. package/docs/fonts/ClashGrotesk-Regular.woff2 +0 -0
  141. package/docs/fonts/ClashGrotesk-Semibold.eot +0 -0
  142. package/docs/fonts/ClashGrotesk-Semibold.ttf +0 -0
  143. package/docs/fonts/ClashGrotesk-Semibold.woff +0 -0
  144. package/docs/fonts/ClashGrotesk-Semibold.woff2 +0 -0
  145. package/docs/fonts/ClashGrotesk-Variable.eot +0 -0
  146. package/docs/fonts/ClashGrotesk-Variable.ttf +0 -0
  147. package/docs/fonts/ClashGrotesk-Variable.woff +0 -0
  148. package/docs/fonts/ClashGrotesk-Variable.woff2 +0 -0
  149. package/docs/img/concorde-icon.svg +0 -5
  150. package/docs/img/concorde-logo.svg +0 -1
  151. package/docs/img/concorde.png +0 -0
  152. package/docs/img/concorde_def.png +0 -0
  153. package/docs/img/concorde_seuil.png.webp +0 -0
  154. package/docs/img/concorde_seuil_invert.png +0 -0
  155. package/docs/img/paul_metrand.jpg +0 -0
  156. package/docs/img/paul_metrand_xs.jpg +0 -0
  157. package/docs/index.html +0 -93
  158. package/docs/src/core/components/functional/date/date.md +0 -290
  159. package/docs/src/core/components/functional/fetch/fetch.md +0 -117
  160. package/docs/src/core/components/functional/if/if.md +0 -16
  161. package/docs/src/core/components/functional/list/list.md +0 -199
  162. package/docs/src/core/components/functional/mix/mix.md +0 -41
  163. package/docs/src/core/components/functional/queue/queue.md +0 -87
  164. package/docs/src/core/components/functional/router/router.md +0 -129
  165. package/docs/src/core/components/functional/sdui/default-library.json +0 -108
  166. package/docs/src/core/components/functional/sdui/example.json +0 -99
  167. package/docs/src/core/components/functional/sdui/sdui.md +0 -356
  168. package/docs/src/core/components/functional/states/states.md +0 -87
  169. package/docs/src/core/components/functional/submit/submit.md +0 -83
  170. package/docs/src/core/components/functional/subscriber/subscriber.md +0 -91
  171. package/docs/src/core/components/functional/value/value.md +0 -35
  172. package/docs/src/core/components/ui/alert/alert.md +0 -121
  173. package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  174. package/docs/src/core/components/ui/badge/badge.md +0 -127
  175. package/docs/src/core/components/ui/button/button.md +0 -182
  176. package/docs/src/core/components/ui/captcha/captcha.md +0 -24
  177. package/docs/src/core/components/ui/card/card.md +0 -97
  178. package/docs/src/core/components/ui/divider/divider.md +0 -35
  179. package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -104
  180. package/docs/src/core/components/ui/form/fieldset/fieldset.md +0 -129
  181. package/docs/src/core/components/ui/form/form-actions/form-actions.md +0 -77
  182. package/docs/src/core/components/ui/form/form-layout/form-layout.md +0 -44
  183. package/docs/src/core/components/ui/form/input/input.md +0 -167
  184. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -131
  185. package/docs/src/core/components/ui/form/radio/radio.md +0 -84
  186. package/docs/src/core/components/ui/form/select/select.md +0 -97
  187. package/docs/src/core/components/ui/form/switch/switch.md +0 -84
  188. package/docs/src/core/components/ui/form/textarea/textarea.md +0 -65
  189. package/docs/src/core/components/ui/group/group.md +0 -75
  190. package/docs/src/core/components/ui/icon/icon.md +0 -125
  191. package/docs/src/core/components/ui/icon/icons.json +0 -1
  192. package/docs/src/core/components/ui/image/image.md +0 -107
  193. package/docs/src/core/components/ui/link/link.md +0 -43
  194. package/docs/src/core/components/ui/loader/loader.md +0 -67
  195. package/docs/src/core/components/ui/menu/menu.md +0 -288
  196. package/docs/src/core/components/ui/modal/modal.md +0 -123
  197. package/docs/src/core/components/ui/pop/pop.md +0 -96
  198. package/docs/src/core/components/ui/progress/progress.md +0 -63
  199. package/docs/src/core/components/ui/table/table.md +0 -455
  200. package/docs/src/core/components/ui/tooltip/tooltip.md +0 -82
  201. package/docs/src/docs/_core-concept/overview.md +0 -57
  202. package/docs/src/docs/_core-concept/subscriber.md +0 -76
  203. package/docs/src/docs/_getting-started/concorde-outside.md +0 -143
  204. package/docs/src/docs/_getting-started/create-a-component.md +0 -137
  205. package/docs/src/docs/_getting-started/my-first-subscriber.md +0 -174
  206. package/docs/src/docs/_getting-started/pubsub.md +0 -150
  207. package/docs/src/docs/_getting-started/start.md +0 -39
  208. package/docs/src/docs/_getting-started/theming.md +0 -91
  209. package/docs/src/docs/search/docs-search.json +0 -3917
  210. package/docs/src/tag-list.json +0 -1
  211. package/docs/src/tsconfig-model.json +0 -23
  212. package/docs/src/tsconfig.json +0 -918
  213. package/docs/svg/regular/plane.svg +0 -1
  214. package/docs/svg/solid/plane.svg +0 -1
  215. package/php/get-challenge.php +0 -34
  216. package/php/some-service.php +0 -42
@@ -1,143 +0,0 @@
1
- # Installation
2
-
3
- ## Starter
4
-
5
- The easiest way to use Concorde is by using the Concorde starter.
6
- The following command creates a new Vite project in TypeScript mode with Tailwind and an example component to get started.
7
-
8
- <sonic-code language="shell">
9
- <template>
10
- npx @supersoniks/create-concorde-ts-starter "project_name"
11
- </template>
12
- </sonic-code>
13
-
14
- ## Brand New Vite Project
15
-
16
-
17
- For a more manual configuration, you can refer to the following sections. <br/>
18
- However, the Tailwind configuration is not mentioned at the moment.
19
-
20
-
21
- ### Creating the Project
22
-
23
- <sonic-code language="shell">
24
- <template>
25
- # Pure JavaScript project
26
- yarn create vite --template vanilla-js
27
- # TypeScript project
28
- # (it is recommended to use this approach, which installs Lit separately if needed, via "yarn add lit")
29
- yarn create vite --template vanilla-ts
30
- # TypeScript + Lit project
31
- # (creating new web components, for example, to extend the fetch or subscriber mixins)
32
- yarn create vite --template lit-ts
33
- </template>
34
- </sonic-code>
35
-
36
- Using Lit with TypeScript requires the following configuration in the "compilerOptions" section of the `tsconfig.json` file:
37
-
38
- <sonic-code language="json">
39
- <template>
40
- "experimentalDecorators": true,
41
- "useDefineForClassFields": false
42
- </template>
43
- </sonic-code>
44
-
45
- ### Installing Concorde
46
-
47
- Navigate to the project folder created and perform the installation:
48
-
49
- <sonic-code language="shell">
50
- <template>
51
- yarn add @supersoniks/concorde
52
- </template>
53
- </sonic-code>
54
-
55
- ### Development / Build
56
-
57
- <sonic-code language="shell">
58
- <template>
59
- # Development (you can add `--host` after the command chain in package.json's dev script instead of typing it each time as shown below)
60
- yarn dev --host
61
- # Build
62
- yarn build
63
- </template>
64
- </sonic-code>
65
-
66
- ## Shortcut Imports
67
-
68
- 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:
69
-
70
- <sonic-code language="shell">
71
- <template>
72
- npx concorde enable-short-paths
73
- </template>
74
- </sonic-code>
75
-
76
- Shortcut imports replace the actual paths with aliases as follows:
77
-
78
- * `@supersoniks/concorde/core/components/functional_or_ui/component/component` becomes `@supersoniks/concorde/functional_or_ui/component`
79
- * `@supersoniks/concorde/core/mixins_or_utils/class_name` becomes `@supersoniks/concorde/mixins_or_utils/class_name`
80
-
81
- The original paths remain accessible. Shortcut imports are used for the examples later in this documentation.
82
-
83
- ## Usage
84
-
85
- ### Simple Integration in HTML
86
-
87
- Import needed component in `main.ts` or wherever you want to use it:
88
-
89
- <sonic-code language="typescript">
90
- <template>
91
- import "@supersoniks/concorde/ui/button";
92
- </template>
93
- </sonic-code>
94
-
95
- 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:
96
-
97
- <sonic-code>
98
- <template>
99
- <sonic-button variant="outline">My button</sonic-button>
100
- </template>
101
- </sonic-code>
102
-
103
- ### Using a Mixin to Create a New Lit Component
104
-
105
- For example, create a file `my-element.ts` at the root:
106
-
107
- <sonic-code language="typescript">
108
- <template>
109
- import { html, LitElement } from "lit";
110
- import { customElement, property } from "lit/decorators.js";
111
- import Fetcher from "@supersoniks/concorde/mixins/Fetcher";
112
- import Subscriber from "@supersoniks/concorde/mixins/Subscriber";
113
-
114
- @customElement("my-element")
115
- export class SonicComponent extends Fetcher(Subscriber(LitElement)) {
116
- @property() email = "";
117
- @property() first_name = "";
118
- @property() last_name = "";
119
-
120
- render() {
121
- return html`<div>
122
- ${this.first_name} ${this.last_name} : ${this.email}
123
- </div>`;
124
- }
125
- }
126
- </template>
127
- </sonic-code>
128
-
129
- Import component `main.ts` or `main.js` or any other component that uses it to be compiled
130
-
131
- <sonic-code language="typescript">
132
- <template>
133
- import "./my-element";
134
- </template>
135
- </sonic-code>
136
-
137
- In the HTML of a JS or TS component or in the HTML of the web page containing the compiled JS:
138
-
139
- <sonic-code language="html">
140
- <template>
141
- <my-element serviceURL="https://reqres.in" dataProvider="api/users/2" key="data"></my-element>
142
- </template>
143
- </sonic-code>
@@ -1,137 +0,0 @@
1
- # Creating components
2
-
3
- ## Where to put it?
4
-
5
- In this document, we consider the src directory of the project as the root.<br>
6
- We describe how we organize our components as an example, however it depends on your project.
7
-
8
- In concorde each component is currently organized in the following directory structure (at least we try):
9
-
10
- - **/core/components/functional/component-name/component-name.ts**
11
- Generic/functional/generally unstyled component.
12
- The component usually doesn't use any other concrete components.
13
- - **/core/components/ui/component-name/component-name.ts**
14
- Generic but UI-oriented component.
15
- The component usually only uses generic components and other UI components.
16
- - **la-billetterie/components/atoms/component-name/component-name.ts**
17
- The component is intended to have a concrete usage within our ticketing system **"la-billetterie"**.
18
- It usually only uses generic components from `core` and possibly other atoms.
19
- - **la-billetterie/components/concrete-destination/component-name/component-name.ts**
20
- The component has a specific destination: (event / cart / gift card): `/components/destination/`
21
- The component uses various components, usually from the `/components/atoms` directory.
22
- It does not use components at the same level in the file hierarchy.
23
-
24
- ## Starting from a Simple Model
25
-
26
- You can copy `example.ts` from the source to the desired destination to start with.
27
- 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.
28
-
29
- <sonic-code language="javascript">
30
- <template>
31
- import { html, LitElement } from "lit";
32
- import { customElement, property } from "lit/decorators.js";
33
- import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
34
-
35
- @customElement("sonic-example")
36
- export class SonicComponent extends Subscriber(LitElement) {
37
- @property() text = "Example";
38
- render() {
39
- return html`${this.text}`;
40
- }
41
- }
42
- </template>
43
- </sonic-code>
44
-
45
- **You can remove the dependency on `Subscriber`** if automatic population of the component with external data is not required.
46
- For example, for a UI component:
47
-
48
-
49
- <sonic-code language="javascript">
50
- <template>
51
- import { html, LitElement } from "lit";
52
- import { customElement, property } from "lit/decorators.js";
53
-
54
- @customElement("sonic-example")
55
- export class SonicComponent extends LitElement {
56
- @property() text = "Example";
57
- render() {
58
- return html`${this.text}`;
59
- }
60
- }
61
- </template>
62
- </sonic-code>
63
-
64
- Regarding `Subscriber`, see:
65
-
66
- - [🔔 Subscriber](#docs/_core-concept/subscriber.md/subscriber)
67
- - [🥨 Sharing Data](#docs/_getting-started/pubsub.md/pubsub)
68
-
69
- ### Naming the Component
70
-
71
- 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:
72
-
73
-
74
- <sonic-code language="typescript">
75
- <template>
76
- @customElement("sonic-button")
77
- </template>
78
- </sonic-code>
79
-
80
- For less generic components with a specific destination, we advise to include the destination in the name.
81
- For example, for a "title" component in the "event" destination, the name would be simply:
82
-
83
-
84
- <sonic-code language="typescript">
85
- <template>
86
- @customElement("sonic-event-title")
87
- </template>
88
- </sonic-code>
89
-
90
-
91
- ## Modifying It
92
-
93
- #### Creating Reactive Properties and Modifying the Render Function
94
-
95
- To do this, study the functioning of https://lit.dev and also refer to [Subscriber](#docs/_core-concept/subscriber.md/subscriber).
96
-
97
- #### HTML Structure of a Component
98
-
99
- The HTML structure of a component should remain as simple as possible.
100
-
101
- Ideally, there should be only one additional level of elements in addition to slots.
102
-
103
- - **The main component is already a wrapper**.
104
- It receives classes to manage its layout, but it should not style internal elements.
105
- - **Slots handle the visual organization** of elements.
106
- - **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.
107
-
108
- 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.
109
-
110
- ## Referencing It
111
-
112
- 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.
113
-
114
- 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.
115
-
116
- Here's where we add imports based on the component's location inside concorde as an example
117
-
118
- - **/core/components/functional/component-name/component-name.ts**
119
- In `/core/components/functional/functional.ts`, which is referenced in core.ts and imported in `index.ts`.
120
- - **/core/components/ui/component-name/component-name.ts**
121
- In `/core/components/ui/ui.ts`, which is referenced in core.ts and imported in `index.ts`.
122
- - **la-billetterie/components/atoms/component-name/component-name.ts**
123
- Nowhere else but where it will be used, except for possible **temporary** tests, for example, in `index.ts`.
124
- - **la-billetterie/components/concrete-destination/component-name/component-name.ts**
125
- In `la-billetterie/components/concrete-destination/destination-concrete.ts`.
126
- If it's a new destination, you'll need to create the corresponding import .ts file and import it in `la-billetterie.ts`.
127
-
128
- ## Using It
129
-
130
- As a reminder, the component is simply integrated into the context by adding a tag with the component's name, for example:
131
-
132
-
133
- <sonic-code language="html">
134
- <template>
135
- <sonic-event-title></sonic-event-title>
136
- </template>
137
- </sonic-code>
@@ -1,174 +0,0 @@
1
- # My first subscriber component
2
-
3
- Learn how to build a subscriber component, styled with tailwind,
4
- which could be used as a regular component or could be filled from a dataprovider.
5
-
6
- ## Create a classic lit component
7
-
8
- <sonic-code language="javascript" >
9
- <template>
10
- import { html, LitElement, nothing } from "lit";
11
- import { customElement, property } from "lit/decorators.js";
12
- // name component
13
- @customElement("docs-user")
14
- export class user extends LitElement {
15
- // set a few props
16
- @property({ type: String }) first_name = "";
17
- @property({ type: String }) last_name = "";
18
- @property({ type: String }) avatar = "";
19
- @property({ type: String }) email = "";
20
- // output
21
- render() {
22
- return html`
23
- <img src="${this.avatar}" /> <br>
24
- ${this.first_name} ${this.last_name} <br>
25
- ${this.email}`;
26
- }
27
- }
28
- </template>
29
- </sonic-code>
30
-
31
-
32
- ### Style with tailwind and ui components
33
-
34
- First export tailwind, in a tailwind.ts file, stylesheet to add it in our component when needed.
35
-
36
- <sonic-code language="javascript">
37
- <template>
38
- import { css, unsafeCSS } from "lit";
39
- import tailwindImport from "./css/tailwind.css?inline";
40
- export const tailwind = css`${unsafeCSS(tailwindImport)}`;
41
- </template>
42
- </sonic-code>
43
-
44
- <sonic-code language="javascript">
45
- <template>
46
- import { html, LitElement, nothing } from "lit";
47
- import { customElement, property } from "lit/decorators.js";
48
- // add tailwind and needed components
49
- import { tailwind } from "../tailwind";
50
- import '@supersoniks/concode/ui/image'
51
- import '@supersoniks/concode/ui/button'
52
- import '@supersoniks/concode/ui/icon'
53
- //
54
- @customElement("docs-user")
55
- export class user extends LitElement {
56
- // add tailwind stylesheed
57
- static styles = [tailwind];
58
- @property({ type: String }) first_name = "";
59
- @property({ type: String }) last_name = "";
60
- @property({ type: String }) avatar = "";
61
- @property({ type: String }) email = "";
62
- // use utility class in your markup
63
- render() {
64
- return html`<div
65
- class="flex items-center gap-3 rounded-md hover:bg-neutral-50 -mx-2 p-2"
66
- >
67
- <sonic-image
68
- src=${this.avatar}
69
- rounded="md"
70
- ratio="1/1"
71
- class="w-16 block"
72
- ></sonic-image>
73
- <div>
74
- <div>
75
- ${this.first_name} <span class="font-bold">${this.last_name}</span>
76
- </div>
77
- <div class="text-sm text-neutral-400">${this.email}</div>
78
- </div>
79
- <div class="ml-auto relative">
80
- <sonic-button
81
- href="mailto:${this.email}"
82
- size="sm"
83
- variant="outline"
84
- shape="circle"
85
- class="relative"
86
- icon
87
- >
88
- <sonic-icon library="iconoir" name="chat-bubble"></sonic-icon>
89
- </sonic-button>
90
- </div>
91
- </div>`;
92
- }
93
- }
94
- </template>
95
- </sonic-code>
96
-
97
- ### Basic usage
98
-
99
- Reactive properties can be filled by its attributes as a simple lit component.
100
-
101
- <sonic-code>
102
- <template>
103
- <docs-user
104
- first_name="Paul"
105
- last_name="Metrand"
106
- avatar="/img/paul_metrand_xs.jpg"
107
- email="paulmetrand@concorde.fr"
108
- ></docs-user>
109
- </template>
110
- </sonic-code>
111
-
112
- ## Add Subscriber mixin
113
-
114
- Import Subscriber mixin, and add it around LitElement.
115
- <sonic-code language="javascript">
116
- <template>
117
- import { html, LitElement, nothing } from "lit";
118
- import { customElement, property } from "lit/decorators.js";
119
- import { tailwind } from "../tailwind";
120
- import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
121
- @customElement("docs-user")
122
- export class user extends Subscriber(LitElement) {
123
- //...
124
- }
125
- </template>
126
- </sonic-code>
127
-
128
- ## Autofill properties from a dataProvider
129
-
130
- Without a dataProvider attribute, a subscriber set its own dataprovider from first ancestor found, and then reactive properties automatically filled and update from it.
131
- A fetcher is a simple component which set its fetch result to props of its dataprovider.
132
- <sonic-code >
133
- <template>
134
- <sonic-fetch
135
- serviceURL="https://reqres.in"
136
- dataProvider="api/users/3"
137
- key="data">
138
- <docs-user></docs-user>
139
- </sonic-fetch>
140
- </template>
141
- </sonic-code>
142
-
143
- A subscriber can subscribe data from anywhere in the DOM, with its dataprovider set as a provider id.
144
- <sonic-code >
145
- <template>
146
- <sonic-fetch
147
- serviceURL="https://reqres.in"
148
- dataProvider="api/users/2"
149
- key="data"></sonic-fetch>
150
- <docs-user dataProvider="api/users/2" ></docs-user>
151
- <docs-user dataProvider="api/users/2" ></docs-user>
152
- <docs-user dataProvider="api/users/2" ></docs-user>
153
- </template>
154
- </sonic-code>
155
-
156
-
157
- <sonic-code >
158
- <template>
159
-
160
- <div class="grid grid-cols-1 gap-4">
161
- <form formDataProvider="userPreview" class="grid grid-cols-4 gap-3" >
162
- <sonic-input label="First name" type="text" name="first_name" placeholder="John" value="Paul"></sonic-input>
163
- <sonic-input label="Last name" type="text" name="last_name" placeholder="Doe" value="Metrand"></sonic-input>
164
- <sonic-input class="col-span-2" label="email" type="text" name="email" placeholder="johndoe@concorde.fr" value="paulmetrand@concorde.fr"></sonic-input>
165
- <sonic-input type="file" name="avatar" value="/img/paul_metrand_xs.jpg"></sonic-input>
166
- </form>
167
- <sonic-divider align="left">Preview before submit</sonic-divider>
168
- <docs-user dataProvider="userPreview" ></docs-user>
169
- <sonic-button onClick="alert(JSON.stringify(SonicPublisherManager.get('userPreview').get()))">
170
- Update data
171
- </sonic-button>
172
- </div>
173
- </template>
174
- </sonic-code>
@@ -1,150 +0,0 @@
1
- # Sharing data
2
-
3
- This section describes how we share data between graphical and non graphical components and classes.
4
-
5
- Especialy, graphical components should not reference each other in order to **remain decoupled**.
6
-
7
- Thats why we use **publish/subscribe** paradigm to addresse this issue.
8
-
9
-
10
- ## The Publisher
11
-
12
- ### Principle
13
-
14
- * The **publisher** is a [JavaScript proxy](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Proxy) that contains some data.<br>**
15
- Example of data : `{foo:{hello:["world"]}, bar:"baz"}`
16
-
17
- * if a property of the **publisher** (dot syntax / array access), it returns another **publisher**.
18
- Using the previous example `myPublisher.foo.hello` is also a publisher containing `["world"]`
19
-
20
- * If the property doesn't exist at the time of the request, a publisher is created. its internal data is set to `null`.<br>
21
- The value that can then be provided later.
22
-
23
- * **Subscribers** can subscribe to the publisher's modifications and be updated in different ways (see : onAssign, onInternalMutation, startTemplateFilling).
24
-
25
- * Data inside the publisher is updated by modifying the publisher itself, for example `myPublisher.foo.hello = ["Joey", "Smith"]`
26
-
27
- * The publisher publishes modifications to any of its **Subscribers**.
28
-
29
-
30
- ❇️ The order of data creation and subscription theoretically has no importance.
31
-
32
- ### Methods
33
-
34
- * **set (complete replacement):** Assign/modifies the internal value of the publisher.
35
- <sonic-code language="javascript">
36
- <template>
37
- publisher.set({foo:{hello:["world"]}, bar:"baz"});
38
- </template>
39
- </sonic-code>
40
- * **get:** Get the internal value of the publisher.
41
- <sonic-code language="javascript">
42
- <template>
43
- publisher.get() //{foo:{hello:["world"]}, bar:"baz"};
44
- </template>
45
- </sonic-code>
46
- * **onAssign/offAssign:** Subscribe/unsubscribe to value assignments (via `set`) of the publisher.
47
- <sonic-code language="javascript">
48
- <template>
49
- publisher.a.b.onAssign(console.log);
50
- //indirect
51
- publisher.a = {b:"dramatic change"}; //log: "dramatic change"
52
- //via set
53
- publisher.a.b.set(["Hello"]) //log: ["Hello"]
54
- </template>
55
- </sonic-code>
56
- * **onInternalMutation/offInternalMutation:** Listen to any internal mutation regardless of its depth level.
57
- <sonic-code language="javascript">
58
- <template>
59
- function save(){
60
- console.log("Something has changed, let's save");
61
- }
62
- publisher.onInternalMutation(save);
63
- publisher.a.b[0] = "e";
64
- </template>
65
- </sonic-code>
66
- * **startTemplateFilling/stopTemplateFilling:** Fill an object model, a principle used with the Subscriber mixin on which most Concorde components rely.
67
- <sonic-code language="javascript">
68
- <template>
69
- const fillableTemplate = { title: "A title to be replaced"};
70
- publisher.startTemplateFilling(fillableTemplate);
71
- state.title = "Good morning";
72
- publisher.stopTemplateFilling(fillableTemplate);
73
- state.title = "Oops";
74
- console.log(fillableTemplate);
75
- </template>
76
- </sonic-code>
77
- * **invalidate:** Flag the data as invalid. Used by sonic-fetch and sonic-list to trigger data reloading.
78
- <sonic-code language="javascript">
79
- <template>
80
- publisher.invalidate();
81
- </template>
82
- </sonic-code>
83
- * **onInvalidate/offInvalidate:** Subscribe/unsubscribe to data invalidation of the publisher. Used by sonic-fetch and sonic-list to trigger data reloading.
84
- <sonic-code language="javascript">
85
- <template>
86
- function reloadData(){
87
- console.log("Reload data to inject it again into the publisher");
88
- }
89
- publisher.onInvalidate(reloadData);
90
- </template>
91
- </sonic-code>
92
-
93
- ## DataProvider
94
-
95
- Denotes the identifier of a publisher as referenced in the PublisherManager (see below).
96
- Uses the dataProvider attribut in html tags to scop the content with some data.
97
- see [Subscribers](#docs/_core-concept/subscriber.md/subscriber).
98
-
99
-
100
- ## PublisherManager
101
-
102
- The **PublisherManager** is a utility class to get publishers
103
-
104
- It plays a central role in the components, especially through the "subscriber" mixin.<br>
105
- Automatic data communication between components in concorde uses this principle in conjunction with Lit's reactive properties. <br>
106
- Refer to the documentation for [Subscriber](#docs/_core-concept/subscriber.md/subscriber).
107
-
108
- <sonic-code language="javascript">
109
- <template>
110
- import { PublisherManager } from "publisherproxy";
111
- let dataProvider = "cart";
112
- let publisher = PublisherManager.get(dataProvider);
113
-
114
- </template>
115
- </sonic-code>
116
-
117
- It is declared on the `window` object to allow usage in a web page, so the equivalent one-liner would be:
118
-
119
- <sonic-code language="javascript">
120
- <template>
121
- let dataProvider = "cart";
122
- let publisher = SonicPublisherManager.get(dataProvider);
123
-
124
- </template>
125
- </sonic-code>
126
-
127
-
128
- ## Basic Example
129
-
130
- This example can be tested in a console when Concorde is loaded on the page (for example, in a ticketing system).
131
- In a component, you will need to perform an `import` as explained earlier.
132
-
133
- <sonic-code language="javascript">
134
- <template>
135
- // Anywhere, anytime
136
- SonicPublisherManager.get("mySubject").title.onAssign(console.log)
137
-
138
- </template>
139
- </sonic-code>
140
-
141
- <sonic-code language="javascript">
142
- <template>
143
- // Anywhere, anytime
144
- let publisher = SonicPublisherManager.get("mySubject");
145
- // ...
146
- publisher.set({title: "A title"});
147
- publisher.title.set("A second title");
148
-
149
- </template>
150
- </sonic-code>
@@ -1,39 +0,0 @@
1
- # Introduction
2
-
3
- ## What is Concorde ?
4
-
5
- Based on **[lit.dev](https://lit.dev)**, Concorde is a collection of webcomponents made to build shared apps or websites.
6
- Develop user interfaces without thinking about the implementation context, where everything is scoped, but preserving graphic consistency by setting the strict minimum of css variables.
7
-
8
- ## Why and use case
9
-
10
- In 2022, Supersoniks wanted to create a new version of his ticketing app, in production un nearly 100 websites. We needed shared components which could be implemented in mobile apps, modern websites, and also old ones made in php, without bundlers or whatever.
11
- Instead of building a new app for each type of project, which would become impossible to maintain, we've decided to create one app, composed by a few webcomponents wich could easily be recomposed on any website.
12
- Webcomponents appeared to be a the perfect solution to guarantee that compatibility with all past, present and futures environment, and lit seemed to be the best choice to build them.
13
-
14
- ### Stack
15
-
16
- * Lit
17
- * Typescript
18
- * Vite
19
- * Tailwind, not in the core, but in the starter kit
20
-
21
- ### Functionnal features and components
22
-
23
- * Data management with Publisher / Subscriber pattern
24
- * Form management
25
- * Fetching data, lists, queue with lazyload
26
- * Data binding
27
- * Simple router, state component, ...
28
- * And all ui component, with status variants to build an app with a consistent design
29
-
30
-
31
- ## Start a new project easily
32
-
33
- A new project with Vite, Typescript and Tailwind already configured and a simple example of a subscriber component :
34
-
35
- <sonic-code language="bash">
36
- <template>
37
- npx @supersoniks/create-concorde-ts-starter "project_name"
38
- </template>
39
- </sonic-code>