@supersoniks/concorde 3.1.57 → 3.1.59

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 (180) hide show
  1. package/build-infos.json +1 -1
  2. package/concorde-core.bundle.js +222 -187
  3. package/concorde-core.es.js +1555 -1445
  4. package/dist/concorde-core.bundle.js +222 -187
  5. package/dist/concorde-core.es.js +1555 -1445
  6. package/docs/assets/index-D9bBwsCn.js +4537 -0
  7. package/docs/assets/index-DCRPZO3x.css +1 -0
  8. package/docs/css/docs.css +0 -0
  9. package/docs/fonts/ClashGrotesk-Bold.eot +0 -0
  10. package/docs/fonts/ClashGrotesk-Bold.ttf +0 -0
  11. package/docs/fonts/ClashGrotesk-Bold.woff +0 -0
  12. package/docs/fonts/ClashGrotesk-Bold.woff2 +0 -0
  13. package/docs/fonts/ClashGrotesk-Extralight.eot +0 -0
  14. package/docs/fonts/ClashGrotesk-Extralight.ttf +0 -0
  15. package/docs/fonts/ClashGrotesk-Extralight.woff +0 -0
  16. package/docs/fonts/ClashGrotesk-Extralight.woff2 +0 -0
  17. package/docs/fonts/ClashGrotesk-Light.eot +0 -0
  18. package/docs/fonts/ClashGrotesk-Light.ttf +0 -0
  19. package/docs/fonts/ClashGrotesk-Light.woff +0 -0
  20. package/docs/fonts/ClashGrotesk-Light.woff2 +0 -0
  21. package/docs/fonts/ClashGrotesk-Medium.eot +0 -0
  22. package/docs/fonts/ClashGrotesk-Medium.ttf +0 -0
  23. package/docs/fonts/ClashGrotesk-Medium.woff +0 -0
  24. package/docs/fonts/ClashGrotesk-Medium.woff2 +0 -0
  25. package/docs/fonts/ClashGrotesk-Regular.eot +0 -0
  26. package/docs/fonts/ClashGrotesk-Regular.ttf +0 -0
  27. package/docs/fonts/ClashGrotesk-Regular.woff +0 -0
  28. package/docs/fonts/ClashGrotesk-Regular.woff2 +0 -0
  29. package/docs/fonts/ClashGrotesk-Semibold.eot +0 -0
  30. package/docs/fonts/ClashGrotesk-Semibold.ttf +0 -0
  31. package/docs/fonts/ClashGrotesk-Semibold.woff +0 -0
  32. package/docs/fonts/ClashGrotesk-Semibold.woff2 +0 -0
  33. package/docs/fonts/ClashGrotesk-Variable.eot +0 -0
  34. package/docs/fonts/ClashGrotesk-Variable.ttf +0 -0
  35. package/docs/fonts/ClashGrotesk-Variable.woff +0 -0
  36. package/docs/fonts/ClashGrotesk-Variable.woff2 +0 -0
  37. package/docs/img/concorde-icon.svg +5 -0
  38. package/docs/img/concorde-logo.svg +1 -0
  39. package/docs/img/concorde.png +0 -0
  40. package/docs/img/concorde_def.png +0 -0
  41. package/docs/img/concorde_seuil.png.webp +0 -0
  42. package/docs/img/concorde_seuil_invert.png +0 -0
  43. package/docs/img/paul_metrand.jpg +0 -0
  44. package/docs/img/paul_metrand_xs.jpg +0 -0
  45. package/docs/index.html +93 -0
  46. package/docs/src/core/components/functional/date/date.md +290 -0
  47. package/docs/src/core/components/functional/fetch/fetch.md +117 -0
  48. package/docs/src/core/components/functional/if/if.md +16 -0
  49. package/docs/src/core/components/functional/list/list.md +199 -0
  50. package/docs/src/core/components/functional/mix/mix.md +41 -0
  51. package/docs/src/core/components/functional/queue/queue.md +87 -0
  52. package/docs/src/core/components/functional/router/router.md +108 -0
  53. package/docs/src/core/components/functional/sdui/default-library.json +108 -0
  54. package/docs/src/core/components/functional/sdui/example.json +99 -0
  55. package/docs/src/core/components/functional/sdui/sdui.md +356 -0
  56. package/docs/src/core/components/functional/states/states.md +87 -0
  57. package/docs/src/core/components/functional/submit/submit.md +83 -0
  58. package/docs/src/core/components/functional/subscriber/subscriber.md +91 -0
  59. package/docs/src/core/components/functional/value/value.md +35 -0
  60. package/docs/src/core/components/ui/alert/alert.md +121 -0
  61. package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  62. package/docs/src/core/components/ui/badge/badge.md +127 -0
  63. package/docs/src/core/components/ui/button/button.md +182 -0
  64. package/docs/src/core/components/ui/captcha/captcha.md +12 -0
  65. package/docs/src/core/components/ui/card/card.md +97 -0
  66. package/docs/src/core/components/ui/divider/divider.md +35 -0
  67. package/docs/src/core/components/ui/form/checkbox/checkbox.md +94 -0
  68. package/docs/src/core/components/ui/form/fieldset/fieldset.md +129 -0
  69. package/docs/src/core/components/ui/form/form-actions/form-actions.md +77 -0
  70. package/docs/src/core/components/ui/form/form-layout/form-layout.md +44 -0
  71. package/docs/src/core/components/ui/form/input/input.md +167 -0
  72. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +130 -0
  73. package/docs/src/core/components/ui/form/radio/radio.md +84 -0
  74. package/docs/src/core/components/ui/form/select/select.md +97 -0
  75. package/docs/src/core/components/ui/form/switch/switch.md +84 -0
  76. package/docs/src/core/components/ui/form/textarea/textarea.md +65 -0
  77. package/docs/src/core/components/ui/group/group.md +75 -0
  78. package/docs/src/core/components/ui/icon/icon.md +125 -0
  79. package/docs/src/core/components/ui/icon/icons.json +1 -0
  80. package/docs/src/core/components/ui/image/image.md +107 -0
  81. package/docs/src/core/components/ui/link/link.md +43 -0
  82. package/docs/src/core/components/ui/loader/loader.md +67 -0
  83. package/docs/src/core/components/ui/menu/menu.md +288 -0
  84. package/docs/src/core/components/ui/modal/modal.md +123 -0
  85. package/docs/src/core/components/ui/pop/pop.md +79 -0
  86. package/docs/src/core/components/ui/progress/progress.md +63 -0
  87. package/docs/src/core/components/ui/table/table.md +455 -0
  88. package/docs/src/core/components/ui/tooltip/tooltip.md +82 -0
  89. package/docs/src/docs/_core-concept/overview.md +57 -0
  90. package/docs/src/docs/_core-concept/subscriber.md +76 -0
  91. package/docs/src/docs/_getting-started/concorde-outside.md +143 -0
  92. package/docs/src/docs/_getting-started/create-a-component.md +137 -0
  93. package/docs/src/docs/_getting-started/my-first-subscriber.md +174 -0
  94. package/docs/src/docs/_getting-started/pubsub.md +150 -0
  95. package/docs/src/docs/_getting-started/start.md +39 -0
  96. package/docs/src/docs/_getting-started/theming.md +91 -0
  97. package/docs/src/docs/search/docs-search.json +3902 -0
  98. package/docs/src/tag-list.json +1 -0
  99. package/docs/src/tsconfig-model.json +23 -0
  100. package/docs/src/tsconfig.json +835 -0
  101. package/docs/svg/regular/plane.svg +1 -0
  102. package/docs/svg/solid/plane.svg +1 -0
  103. package/index.html +1 -1
  104. package/package.json +6 -2
  105. package/php/get-challenge.php +34 -0
  106. package/php/some-service.php +42 -0
  107. package/scripts/create-search.js +0 -0
  108. package/src/core/_types/types.ts +0 -5
  109. package/src/core/components/functional/date/date.ts +0 -0
  110. package/src/core/components/functional/functional.ts +0 -0
  111. package/src/core/components/functional/list/list.ts +72 -2
  112. package/src/core/components/functional/queue/queue.ts +19 -11
  113. package/src/core/components/functional/submit/submit.ts +41 -34
  114. package/src/core/components/functional/translation/translation.ts +0 -0
  115. package/src/core/components/ui/_css/scroll.ts +0 -0
  116. package/src/core/components/ui/_css/shadow.ts +0 -0
  117. package/src/core/components/ui/_css/size.ts +0 -0
  118. package/src/core/components/ui/_css/type.ts +0 -0
  119. package/src/core/components/ui/alert/alert.ts +0 -0
  120. package/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  121. package/src/core/components/ui/badge/badge.ts +1 -1
  122. package/src/core/components/ui/button/button.ts +0 -0
  123. package/src/core/components/ui/captcha/captcha.md +13 -1
  124. package/src/core/components/ui/captcha/captcha.ts +96 -44
  125. package/src/core/components/ui/card/card-footer.ts +0 -0
  126. package/src/core/components/ui/card/card-header-descripton.ts +0 -0
  127. package/src/core/components/ui/card/card-header.ts +0 -0
  128. package/src/core/components/ui/card/card-main.ts +0 -0
  129. package/src/core/components/ui/card/card.md +0 -0
  130. package/src/core/components/ui/card/card.ts +0 -0
  131. package/src/core/components/ui/divider/divider.ts +0 -0
  132. package/src/core/components/ui/form/checkbox/checkbox.ts +0 -0
  133. package/src/core/components/ui/form/fieldset/legend-description.ts +0 -0
  134. package/src/core/components/ui/form/fieldset/legend.ts +0 -0
  135. package/src/core/components/ui/form/input/input.md +0 -0
  136. package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +0 -0
  137. package/src/core/components/ui/form/radio/radio.ts +0 -0
  138. package/src/core/components/ui/form/select/select.ts +0 -0
  139. package/src/core/components/ui/form/switch/switch.md +0 -0
  140. package/src/core/components/ui/form/textarea/textarea.ts +0 -0
  141. package/src/core/components/ui/icon/icons.ts +0 -0
  142. package/src/core/components/ui/loader/loader.md +0 -0
  143. package/src/core/components/ui/loader/loader.ts +0 -0
  144. package/src/core/components/ui/loader/styles/fixed.ts +0 -0
  145. package/src/core/components/ui/loader/styles/inline.ts +0 -0
  146. package/src/core/components/ui/modal/modal-actions.ts +0 -0
  147. package/src/core/components/ui/modal/modal-subtitle.ts +0 -0
  148. package/src/core/components/ui/modal/modal-title.ts +0 -0
  149. package/src/core/components/ui/modal/modal.md +0 -0
  150. package/src/core/components/ui/modal/modal.ts +0 -0
  151. package/src/core/components/ui/pop/pop.ts +0 -0
  152. package/src/core/components/ui/progress/progress.ts +0 -0
  153. package/src/core/components/ui/table/table-tbody.ts +0 -0
  154. package/src/core/components/ui/table/table-th.ts +0 -0
  155. package/src/core/components/ui/table/table.ts +0 -0
  156. package/src/core/components/ui/theme/theme-collection/core-variables.ts +0 -0
  157. package/src/core/components/ui/theme/theme-collection/light.ts +0 -0
  158. package/src/core/components/ui/theme/theme.ts +0 -0
  159. package/src/core/components/ui/toast/toast-item.ts +0 -0
  160. package/src/core/components/ui/tooltip/tooltip.ts +0 -0
  161. package/src/core/components/ui/ui.ts +0 -0
  162. package/src/core/directives/DataProvider.ts +0 -0
  163. package/src/core/directives/Wording.ts +0 -0
  164. package/src/core/mixins/Fetcher.ts +30 -24
  165. package/src/core/mixins/FormElement.ts +0 -0
  166. package/src/core/mixins/Subscriber.ts +0 -0
  167. package/src/core/utils/Utils.ts +0 -0
  168. package/src/core/utils/aesCrypto.ts +129 -0
  169. package/src/docs/header/header.ts +0 -0
  170. package/src/docs/layout.ts +0 -0
  171. package/src/docs/navigation/navigation.ts +0 -0
  172. package/src/docs/search/docs-search.json +0 -0
  173. package/src/docs/search/search.ts +0 -0
  174. package/src/docs/tailwind/css/tailwind.css +0 -0
  175. package/src/index.ts +0 -0
  176. package/src/tsconfig.json +3 -0
  177. package/src/tsconfig.tsbuildinfo +1 -1
  178. package/tailwind.config.js +0 -0
  179. package/vite.config.mts +2 -0
  180. package/vite.config.mts.timestamp-1728318208370-f1724bcfd87d3.mjs +0 -85
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M576 256C576 305 502.1 336 464.2 336H382.2L282.4 496C276.4 506 266.4 512 254.4 512H189.5C179.5 512 169.5 508 163.5 500C157.6 492 155.6 480.1 158.6 471L201.5 336H152.5L113.6 388C107.6 396 98.61 400 88.62 400H31.7C22.72 400 12.73 396 6.74 388C.7485 380-1.248 370 1.747 360L31.7 256L.7488 152C-1.248 143 .7488 133 6.74 125C12.73 117 22.72 112 31.7 112H88.62C98.61 112 107.6 117 113.6 125L152.5 176H201.5L158.6 41C155.6 32 157.6 21 163.5 13C169.5 5 179.5 0 189.5 0H254.4C265.4 0 277.4 7 281.4 16L381.2 176H463.2C502.1 176 576 208 576 256H576zM527.1 256C525.1 246 489.1 224 463.2 224H355.3L245.4 48H211.5L266.4 224H128.6L80.63 160H53.67L81.63 256L53.67 352H80.63L128.6 288H266.4L211.5 464H245.4L355.3 288H463.2C490.1 288 526.1 267 527.1 256V256z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M482.3 192c34.2 0 93.7 29 93.7 64c0 36-59.5 64-93.7 64l-116.6 0L265.2 495.9c-5.7 10-16.3 16.1-27.8 16.1l-56.2 0c-10.6 0-18.3-10.2-15.4-20.4l49-171.6L112 320 68.8 377.6c-3 4-7.8 6.4-12.8 6.4l-42 0c-7.8 0-14-6.3-14-14c0-1.3 .2-2.6 .5-3.9L32 256 .5 145.9c-.4-1.3-.5-2.6-.5-3.9c0-7.8 6.3-14 14-14l42 0c5 0 9.8 2.4 12.8 6.4L112 192l102.9 0-49-171.6C162.9 10.2 170.6 0 181.2 0l56.2 0c11.5 0 22.1 6.2 27.8 16.1L365.7 192l116.6 0z"/></svg>
package/index.html CHANGED
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
2
+ <html lang="fr">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <link rel="icon" type="image/svg+xml" href="./svg/favicon.svg" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "3.1.57",
3
+ "version": "3.1.59",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "",
@@ -270,6 +270,7 @@
270
270
  "./utils/Objects": "./src/core/utils/Objects.ts",
271
271
  "./utils/PublisherProxy": "./src/core/utils/PublisherProxy.ts",
272
272
  "./utils/Utils": "./src/core/utils/Utils.ts",
273
+ "./utils/aesCrypto": "./src/core/utils/aesCrypto.ts",
273
274
  "./utils/api": "./src/core/utils/api.ts",
274
275
  "./utils/route": "./src/core/utils/route.ts",
275
276
  "./utils/url-pattern": "./src/core/utils/url-pattern.ts",
@@ -293,6 +294,8 @@
293
294
  "@types/intl": "^1.2.2",
294
295
  "@types/jest": "^29.5.12",
295
296
  "@types/node": "^20.12.4",
297
+ "@vitejs/plugin-basic-ssl": "^1.2.0",
298
+ "altcha": "^1.0.7",
296
299
  "autoprefixer": "^10.4.19",
297
300
  "intl": "^1.2.5",
298
301
  "lit": "^3.1.3",
@@ -309,5 +312,6 @@
309
312
  "@lit-labs/motion": "^1.0.7",
310
313
  "@lit-labs/observers": "^2.0.2",
311
314
  "url-pattern": "^1.0.3"
312
- }
315
+ },
316
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
313
317
  }
@@ -0,0 +1,34 @@
1
+ <?php
2
+ /* *
3
+ * Call get-challenge on auto-hosted latcha service at https://altcha.supersoniks.org
4
+ * */
5
+
6
+ // Autoriser toutes les origines
7
+ header("Access-Control-Allow-Origin: *");
8
+
9
+ // Autoriser les méthodes HTTP spécifiques
10
+ header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
11
+
12
+ // Autoriser certains en-têtes spécifiques
13
+ header("Access-Control-Allow-Headers: Content-Type, Authorization");
14
+
15
+ // Si la méthode est OPTIONS, terminer la requête ici
16
+ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
17
+ http_response_code(200);
18
+ exit();
19
+ }
20
+
21
+ function getChallenge($key){
22
+ $maxNumber=20000;
23
+ $queryString = $params = [
24
+ 'key' => $key,
25
+ 'maxNumber' => $maxNumber
26
+ ];
27
+ // Générer la chaîne de requête
28
+ $queryString = http_build_query($params);
29
+ $url = "https://altcha.supersoniks.org/get-challenge?key=".$queryString;
30
+ $response = file_get_contents($url);
31
+ return $response;
32
+ }
33
+
34
+ echo getChallenge($_GET['key']);
@@ -0,0 +1,42 @@
1
+ <?php
2
+ /* *
3
+ * Call verify-solution on auto-hosted latcha service at https://altcha.supersoniks.org
4
+ * */
5
+
6
+
7
+ // Autoriser toutes les origines
8
+ header("Access-Control-Allow-Origin: *");
9
+
10
+ // Autoriser les méthodes HTTP spécifiques
11
+ header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
12
+
13
+ // Autoriser certains en-têtes spécifiques
14
+ header("Access-Control-Allow-Headers: Content-Type, Authorization, x-altcha-spam-filter");
15
+
16
+ // Si la méthode est OPTIONS, terminer la requête ici
17
+ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
18
+ http_response_code(200);
19
+ exit();
20
+ }
21
+
22
+ function verifySolution($key, $solution){
23
+ $queryString = $params = [
24
+ 'key' => $key,
25
+ 'altcha' => $solution
26
+ ];
27
+ // Générer la chaîne de requête
28
+ $queryString = http_build_query($params);
29
+ $url = "https://altcha.supersoniks.org/verify-solution?".$queryString;
30
+ $response = file_get_contents($url);
31
+ return $response;
32
+ }
33
+
34
+ /**
35
+ * Get json posted data
36
+ */
37
+
38
+ // Get the posted data
39
+
40
+ $data = json_decode(file_get_contents("php://input"));
41
+
42
+ echo verifySolution($data->captchakey, $data->captchatoken);
File without changes
@@ -14,11 +14,6 @@ export interface ConcordeWindow extends Window {
14
14
  id: string;
15
15
  password: string;
16
16
  }) => Credential;
17
- grecaptcha?: {
18
- ready: (handler: () => void) => void;
19
- reset: () => void;
20
- execute: (key: string, options: { action: string }) => Promise<string>;
21
- };
22
17
  SonicModal: any;
23
18
  SonicToast: any;
24
19
  [key: string]: any;
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- import { html, LitElement, nothing } from "lit";
1
+ import { html, LitElement, nothing, PropertyValues } from "lit";
2
2
  import { customElement, property } from "lit/decorators.js";
3
3
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
4
4
  import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
@@ -70,6 +70,7 @@ export class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))) {
70
70
  if (this.isFetchEnabled) this.isLoading = true;
71
71
  super.connectedCallback();
72
72
  }
73
+
73
74
  disconnectedCallback(): void {
74
75
  super.disconnectedCallback();
75
76
  }
@@ -91,7 +92,7 @@ export class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))) {
91
92
  renderLoadingState():
92
93
  | DirectiveResult<typeof TemplateContentDirective>
93
94
  | TemplateResult {
94
- return html`${this.renderSkeleton()} ${this.renderLoader()}`;
95
+ return html`${this.renderSkeleton()} ${this.renderLoader()} `;
95
96
  }
96
97
  renderNoResultState() {
97
98
  return html` <div
@@ -136,8 +137,77 @@ export class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))) {
136
137
  if (response) props._sonic_http_response_ = response;
137
138
  return props;
138
139
  }
140
+ protected updated(_changedProperties: PropertyValues): void {
141
+ window.requestAnimationFrame(() => {
142
+ if (!this.isLoading) {
143
+ this.style.setProperty("--list-loader-height-display", "none");
144
+ return;
145
+ }
146
+
147
+ this.style.setProperty("--list-loader-height-display", "block");
148
+ this.loadingSize = this.getDisplayContentsSize(this);
149
+ });
150
+
151
+ super.updated(_changedProperties);
152
+ }
153
+
154
+ getAllRenderableElements(root: any) {
155
+ let elements: any[] = [];
156
+
157
+ function collectElements(node: any) {
158
+ if (node.nodeType === Node.ELEMENT_NODE) {
159
+ // Vérifier si l'élément a une boîte de rendu
160
+ const rect = node.getBoundingClientRect();
161
+ if (rect.width > 0 || rect.height > 0) {
162
+ elements.push(node);
163
+ }
164
+
165
+ // Parcourir les enfants
166
+ node.childNodes.forEach(collectElements);
139
167
 
168
+ // Vérifier le Shadow DOM
169
+ if (node.shadowRoot) {
170
+ node.shadowRoot.childNodes.forEach(collectElements);
171
+ }
172
+ }
173
+ }
174
+
175
+ collectElements(root);
176
+ return elements;
177
+ }
178
+
179
+ getDisplayContentsSize(element: any) {
180
+ const elements = this.getAllRenderableElements(element);
181
+
182
+ if (elements.length === 0) return { width: 0, height: 0 };
183
+
184
+ const rects = elements.map((el) => el.getBoundingClientRect());
185
+
186
+ const minX = Math.min(...rects.map((r) => r.left));
187
+ const maxX = Math.max(...rects.map((r) => r.right));
188
+ const minY = Math.min(...rects.map((r) => r.top));
189
+ const maxY = Math.max(...rects.map((r) => r.bottom));
190
+
191
+ return { width: maxX - minX, height: maxY - minY };
192
+ }
193
+
194
+ /**
195
+ * loadingsize is computed after rendering a loading / doesnt require one but will be used on other renderings
196
+ */
197
+ loadingSize = { width: 0, height: 0 };
140
198
  render() {
199
+ return html`
200
+ ${this.renderContent()}
201
+ <div
202
+ style="grid-column: 1 / -1;min-height:${this.isLoading
203
+ ? 0
204
+ : this.loadingSize
205
+ .height}px; width:0;float:left;display: var(--list-loader-height-display);"
206
+ ></div>
207
+ `;
208
+ }
209
+
210
+ renderContent() {
141
211
  /**
142
212
  * Loading
143
213
  */
@@ -171,7 +171,6 @@ export default class Queue extends Subscriber(LitElement, {} as QueueProps) {
171
171
  clearTimeout(this.filterTimeoutId);
172
172
  this.filterTimeoutId = setTimeout(
173
173
  async () => {
174
- this.storeScrollPosition();
175
174
  const count = this.resultCount;
176
175
  this.props = null;
177
176
  //On garde le décompte au cas ou il n'y aurait pas rechargement
@@ -186,26 +185,35 @@ export default class Queue extends Subscriber(LitElement, {} as QueueProps) {
186
185
  };
187
186
 
188
187
  storeScrollPosition() {
188
+ if (!this.isSafari()) {
189
+ return;
190
+ }
189
191
  this.storedScrollX = window.scrollX;
190
192
  this.storedScrollY = window.scrollY;
191
193
  }
192
194
 
195
+ isSafari() {
196
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
197
+ }
198
+
193
199
  protected updated(_changedProperties: PropertyValues): void {
194
- if (
195
- Math.abs(this.storedScrollX - window.scrollX) > 10 ||
196
- Math.abs(this.storedScrollY - window.scrollY) > 10
197
- ) {
198
- window.scrollTo(this.storedScrollX, this.storedScrollY);
199
- }
200
- //Hack pour éviter que le scroll ne retourne en haut si safari
201
- window.requestAnimationFrame(() => {
200
+ if (this.isSafari()) {
202
201
  if (
203
202
  Math.abs(this.storedScrollX - window.scrollX) > 10 ||
204
203
  Math.abs(this.storedScrollY - window.scrollY) > 10
205
204
  ) {
206
205
  window.scrollTo(this.storedScrollX, this.storedScrollY);
207
206
  }
208
- });
207
+ //Hack pour éviter que le scroll ne retourne en haut si safari
208
+ window.requestAnimationFrame(() => {
209
+ if (
210
+ Math.abs(this.storedScrollX - window.scrollX) > 10 ||
211
+ Math.abs(this.storedScrollY - window.scrollY) > 10
212
+ ) {
213
+ window.scrollTo(this.storedScrollX, this.storedScrollY);
214
+ }
215
+ });
216
+ }
209
217
 
210
218
  super.updated(_changedProperties);
211
219
  }
@@ -318,10 +326,10 @@ export default class Queue extends Subscriber(LitElement, {} as QueueProps) {
318
326
  storedScrollX = 0;
319
327
 
320
328
  render() {
329
+ this.storeScrollPosition();
321
330
  if (!Array.isArray(this.props)) {
322
331
  return nothing;
323
332
  }
324
- this.storeScrollPosition();
325
333
 
326
334
  let lazyload = !this.noLazyload;
327
335
  if (this.props.length == 1) {
@@ -63,8 +63,9 @@ export class Submit extends Subscriber(LitElement) {
63
63
  const form: HTMLFormElement = HTML.getClosestForm(this) as HTMLFormElement;
64
64
  if (!form) return;
65
65
  const formDataProvider = this.getAncestorAttributeValue("formDataProvider");
66
- const formData = PublisherManager.get(formDataProvider).get();
67
- for (const name in formData) {
66
+ const dataToSend = { ...PublisherManager.get(formDataProvider).get() };
67
+ delete dataToSend.needsCaptchaValidation;
68
+ for (const name in dataToSend) {
68
69
  if (name == "isFormValid") continue;
69
70
  let control = form.querySelector(
70
71
  'input[name="' +
@@ -82,7 +83,7 @@ export class Submit extends Subscriber(LitElement) {
82
83
  control.name = name;
83
84
  form.appendChild(control);
84
85
  }
85
- let value = formData[name];
86
+ let value = dataToSend[name];
86
87
  if (Array.isArray(value)) value = value.join(",");
87
88
  if (control.type === "checkbox" || control.type === "radio") {
88
89
  if (value) (control as HTMLInputElement).checked = true;
@@ -100,12 +101,12 @@ export class Submit extends Subscriber(LitElement) {
100
101
  }
101
102
 
102
103
  clickTimeStamp = 0;
103
- submit = async (e?:Event)=> {
104
- if(this.disabled) return;
104
+ submit = async (e?: Event) => {
105
+ if (this.disabled) return;
105
106
 
106
- if(e instanceof KeyboardEvent && !(e.key === "Enter")) return;
107
- if(e instanceof MouseEvent) {
108
- e.stopPropagation();
107
+ if (e instanceof KeyboardEvent && !(e.key === "Enter")) return;
108
+ if (e instanceof MouseEvent) {
109
+ e.stopPropagation();
109
110
  }
110
111
  const formPublisher = PublisherManager.getInstance().get(
111
112
  this.getAncestorAttributeValue("formDataProvider")
@@ -116,6 +117,7 @@ export class Submit extends Subscriber(LitElement) {
116
117
  formPublisher.invalidateForm();
117
118
  if (!formPublisher.isFormValid.get()) return;
118
119
  this.disabled = true;
120
+ Loader.show();
119
121
  formPublisher.isFormValid;
120
122
  // support native html form
121
123
  const native = this.hasAttribute("native");
@@ -136,47 +138,49 @@ export class Submit extends Subscriber(LitElement) {
136
138
  const headerPublisher = headesDataProvider
137
139
  ? PublisherManager.getInstance().get(headesDataProvider)
138
140
  : null;
139
- let headerData = {};
141
+ let headerData: any = {};
140
142
  if (headerPublisher) headerData = headerPublisher.get();
141
143
  let result: SubmitResult = null;
142
144
  const dataProvider = this.getAncestorAttributeValue("dataProvider");
143
145
  const endPoint = this.endPoint || dataProvider;
144
- Loader.show();
145
146
 
146
147
  const sendData = async () => {
148
+ const dataToSend = { ...formData };
149
+ delete dataToSend.needsCaptchaValidation;
150
+ delete headerData.needsCaptchaValidation;
147
151
  //
148
152
  //envoi données
149
153
  if (sendAsFormData) {
150
154
  result = await this.api?.submitFormData(
151
155
  endPoint,
152
- formData,
156
+ dataToSend,
153
157
  method,
154
158
  headerData
155
159
  );
156
160
  } else {
157
161
  switch (method) {
158
162
  case "put":
159
- result = await this.api?.put(endPoint, formData, headerData);
163
+ result = await this.api?.put(endPoint, dataToSend, headerData);
160
164
  break;
161
165
  case "patch":
162
- result = await this.api?.patch(endPoint, formData, headerData);
166
+ result = await this.api?.patch(endPoint, dataToSend, headerData);
163
167
  break;
164
168
  case "delete":
165
- result = await this.api?.delete(endPoint, formData, headerData);
169
+ result = await this.api?.delete(endPoint, dataToSend, headerData);
166
170
  break;
167
171
  case "get":
168
- // add formData to endpoint
172
+ // add dataToSend to endpoint
169
173
  const params = new URLSearchParams();
170
- if (formData) {
171
- for (const key in formData) {
172
- params.append(key, formData[key]);
174
+ if (dataToSend) {
175
+ for (const key in dataToSend) {
176
+ params.append(key, dataToSend[key]);
173
177
  }
174
178
  }
175
179
  const paramString = "?" + params.toString();
176
180
  result = await this.api?.get(endPoint + paramString, headerData);
177
181
  break;
178
182
  default:
179
- result = await this.api?.post(endPoint, formData, headerData);
183
+ result = await this.api?.post(endPoint, dataToSend, headerData);
180
184
  break;
181
185
  }
182
186
  }
@@ -211,10 +215,13 @@ export class Submit extends Subscriber(LitElement) {
211
215
  : "password";
212
216
  if (
213
217
  this.api?.lastResult?.ok &&
214
- formData[username_key] &&
215
- formData[password_key]
218
+ dataToSend[username_key] &&
219
+ dataToSend[password_key]
216
220
  ) {
217
- this.saveCredentials(formData[username_key], formData[password_key]);
221
+ this.saveCredentials(
222
+ dataToSend[username_key],
223
+ dataToSend[password_key]
224
+ );
218
225
  }
219
226
 
220
227
  if (this.submitResultKey) {
@@ -241,31 +248,31 @@ export class Submit extends Subscriber(LitElement) {
241
248
  })
242
249
  );
243
250
  };
244
- const captchaPublisher = headerPublisher?.needsCaptchaValidation.get()
245
- ? headerPublisher
246
- : formPublisher.needsCaptchaValidation.get()
247
- ? formPublisher
248
- : null;
251
+ const captchaPublisher =
252
+ // TODO Comprendre pourquoi header publisher
253
+ headerPublisher?.needsCaptchaValidation.get()
254
+ ? headerPublisher
255
+ : formPublisher.needsCaptchaValidation.get()
256
+ ? formPublisher
257
+ : null;
249
258
  if (captchaPublisher) {
250
- captchaPublisher.captchaMethod = method;
251
- captchaPublisher.captchaAction =
252
- dataProvider?.split("?")[0] ??
253
- this.getAncestorAttributeValue("formDataProvider") ??
254
- "submit";
255
259
  captchaPublisher.captchaToken = "request_token";
256
260
  const captchaAssign = (token?: string) => {
257
- if (token && token != "request_token") {
261
+ if (token != "request_token") {
258
262
  sendData();
259
263
  // Après l'envoie des données, on supprime ce onAssign.
260
264
  // Sinon les handler se cumuleraient après plusieurs submit consécutifs.
261
265
  captchaPublisher.captchaToken.offAssign(captchaAssign);
266
+ } else {
267
+ Loader.hide();
268
+ this.disabled = false;
262
269
  }
263
270
  };
264
271
  captchaPublisher.captchaToken.onAssign(captchaAssign);
265
272
  } else {
266
273
  sendData();
267
274
  }
268
- }
275
+ };
269
276
 
270
277
  async saveCredentials(username: string, password: string) {
271
278
  // Check if the browser supports password credentials (and the Credential Management API)
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -60,7 +60,7 @@ export class Badge extends LitElement {
60
60
  :host([type="primary"]) {
61
61
  --sc-badge-color: var(--sc-primary-content, var(--sc-base, #fff));
62
62
  --sc-badge-bg: var(--sc-primary, var(--sc-base-content, #000));
63
- }
63
+ }
64
64
  :host([type="warning"]) {
65
65
  --sc-badge-color: var(--sc-warning-content, var(--sc-base, #fff));
66
66
  --sc-badge-bg: var(--sc-warning, var(--sc-base-content, #000));
File without changes
@@ -4,7 +4,19 @@
4
4
  <template>
5
5
  <sonic-captcha formDataProvider="captchaTestDataProvider" key="6Leq5V0iAAAAAB-41DlWN335jDlcIuXmhNtdd00t">
6
6
  <sonic-submit serviceURL="https://reqres.in" endPoint="api/unknown" onclick>
7
- <sonic-button>Submit with captcha</sonic-button>
7
+ <sonic-button class="mt-4">Submit with captcha</sonic-button>
8
+ </sonic-submit>
9
+ </sonic-captcha>
10
+ </template>
11
+ </sonic-code>
12
+
13
+
14
+
15
+ <sonic-code>
16
+ <template>
17
+ <sonic-captcha formDataProvider="captchaTestDataProvider">
18
+ <sonic-submit serviceURL="https://atelier.julien.supersoniks.pro" endPoint="php/some-service.php" onclick>
19
+ <sonic-button class="mt-4">Submit with captcha</sonic-button>
8
20
  </sonic-submit>
9
21
  </sonic-captcha>
10
22
  </template>