@supersoniks/concorde 1.0.5 → 1.0.8
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.
- package/README.md +16 -8
- package/cli.js +69 -0
- package/core/components/functional/date/date.d.ts +34 -0
- package/core/components/functional/date/date.js +187 -0
- package/core/components/functional/example/example.d.ts +7 -0
- package/core/components/functional/example/example.js +25 -0
- package/core/components/functional/fetch/fetch.d.ts +49 -0
- package/core/components/functional/fetch/fetch.js +38 -0
- package/core/components/functional/functional.d.ts +11 -0
- package/core/components/functional/functional.js +11 -0
- package/core/components/functional/if/if.d.ts +12 -0
- package/core/components/functional/if/if.js +43 -0
- package/core/components/functional/list/list.d.ts +67 -0
- package/core/components/functional/list/list.js +132 -0
- package/core/components/functional/queue/queue.d.ts +42 -0
- package/core/components/functional/queue/queue.js +184 -0
- package/core/components/functional/router/redirect.d.ts +18 -0
- package/core/components/functional/router/redirect.js +57 -0
- package/core/components/functional/router/router.d.ts +26 -0
- package/core/components/functional/router/router.js +104 -0
- package/core/components/functional/states/states.d.ts +28 -0
- package/core/components/functional/states/states.js +139 -0
- package/core/components/functional/submit/submit.d.ts +24 -0
- package/core/components/functional/submit/submit.js +108 -0
- package/{types/core/components → core/components/functional/subscriber}/subscriber.d.ts +5 -1
- package/core/components/functional/subscriber/subscriber.js +30 -0
- package/core/components/ui/alert/alert.d.ts +20 -0
- package/core/components/ui/alert/alert.js +150 -0
- package/core/components/ui/badge/badge.d.ts +24 -0
- package/core/components/ui/badge/badge.js +177 -0
- package/core/components/ui/button/button.d.ts +125 -0
- package/core/components/ui/button/button.js +558 -0
- package/core/components/ui/divider/divider.d.ts +11 -0
- package/core/components/ui/divider/divider.js +144 -0
- package/core/components/ui/form/checkbox/checkbox.d.ts +120 -0
- package/core/components/ui/form/checkbox/checkbox.js +203 -0
- package/core/components/ui/form/css/form-control.d.ts +1 -0
- package/core/components/ui/form/css/form-control.js +219 -0
- package/core/components/ui/form/fieldset/fieldset.d.ts +15 -0
- package/core/components/ui/form/fieldset/fieldset.js +70 -0
- package/core/components/ui/form/fieldset/legend.d.ts +11 -0
- package/core/components/ui/form/fieldset/legend.js +92 -0
- package/core/components/ui/form/form-layout/form-actions.d.ts +6 -0
- package/core/components/ui/form/form-layout/form-actions.js +23 -0
- package/core/components/ui/form/form-layout/form-layout.d.ts +9 -0
- package/core/components/ui/form/form-layout/form-layout.js +58 -0
- package/core/components/ui/form/input/input.d.ts +84 -0
- package/core/components/ui/form/input/input.js +180 -0
- package/core/components/ui/form/radio/radio.d.ts +12 -0
- package/core/components/ui/form/radio/radio.js +55 -0
- package/core/components/ui/form/select/select.d.ts +39 -0
- package/core/components/ui/form/select/select.js +220 -0
- package/core/components/ui/form/textarea/textarea.d.ts +69 -0
- package/core/components/ui/form/textarea/textarea.js +150 -0
- package/core/components/ui/group/group.d.ts +6 -0
- package/core/components/ui/group/group.js +57 -0
- package/core/components/ui/icon/icon.d.ts +17 -0
- package/core/components/ui/icon/icon.js +93 -0
- package/core/components/ui/icon/icons.d.ts +13 -0
- package/core/components/ui/icon/icons.js +25 -0
- package/core/components/ui/icon/icons.json +1 -0
- package/core/components/ui/image/image.d.ts +14 -0
- package/core/components/ui/image/image.js +152 -0
- package/core/components/ui/link/link.d.ts +16 -0
- package/core/components/ui/link/link.js +70 -0
- package/core/components/ui/loader/loader.d.ts +20 -0
- package/core/components/ui/loader/loader.js +94 -0
- package/{types → core}/components/ui/loader/styles/fixed.d.ts +0 -0
- package/core/components/ui/loader/styles/fixed.js +57 -0
- package/{types → core}/components/ui/loader/styles/inline.d.ts +0 -0
- package/core/components/ui/loader/styles/inline.js +71 -0
- package/core/components/ui/menu/menu-item.d.ts +5 -0
- package/core/components/ui/menu/menu-item.js +37 -0
- package/core/components/ui/menu/menu.d.ts +26 -0
- package/core/components/ui/menu/menu.js +125 -0
- package/core/components/ui/modal/modal-actions.d.ts +7 -0
- package/core/components/ui/modal/modal-actions.js +46 -0
- package/core/components/ui/modal/modal-close.d.ts +6 -0
- package/core/components/ui/modal/modal-close.js +38 -0
- package/core/components/ui/modal/modal-content.d.ts +5 -0
- package/core/components/ui/modal/modal-content.js +29 -0
- package/core/components/ui/modal/modal-subtitle.d.ts +5 -0
- package/core/components/ui/modal/modal-subtitle.js +33 -0
- package/core/components/ui/modal/modal-title.d.ts +5 -0
- package/core/components/ui/modal/modal-title.js +33 -0
- package/core/components/ui/modal/modal.d.ts +36 -0
- package/core/components/ui/modal/modal.js +325 -0
- package/core/components/ui/pop/pop.d.ts +28 -0
- package/core/components/ui/pop/pop.js +223 -0
- package/core/components/ui/tabs/tab.d.ts +6 -0
- package/core/components/ui/tabs/tab.js +46 -0
- package/core/components/ui/tabs/tabs.d.ts +14 -0
- package/core/components/ui/tabs/tabs.js +127 -0
- package/core/components/ui/taxonomy/taxonomy.d.ts +41 -0
- package/core/components/ui/taxonomy/taxonomy.js +113 -0
- package/core/components/ui/theme/css/tailwind.css +3 -0
- package/core/components/ui/theme/css/tailwind.d.ts +2 -0
- package/core/components/ui/theme/theme-collection/core-variables.d.ts +1 -0
- package/core/components/ui/theme/theme-collection/core-variables.js +50 -0
- package/{types/components → core/components/ui}/theme/theme-collection/dark.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/dark.js +41 -0
- package/{types/components → core/components/ui}/theme/theme-collection/light.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/light.js +35 -0
- package/core/components/ui/theme/theme.d.ts +11 -0
- package/core/components/ui/theme/theme.js +105 -0
- package/core/components/ui/toast/message-subscriber.d.ts +17 -0
- package/core/components/ui/toast/message-subscriber.js +85 -0
- package/{types → core}/components/ui/toast/toast.d.ts +10 -8
- package/core/components/ui/toast/toast.js +260 -0
- package/core/components/ui/tooltip/tooltip.d.ts +7 -0
- package/core/components/ui/tooltip/tooltip.js +68 -0
- package/core/components/ui/ui.d.ts +27 -0
- package/core/components/ui/ui.js +34 -0
- package/core/core.d.ts +3 -0
- package/core/core.js +7 -0
- package/core/mixins/Fetcher.d.ts +69 -0
- package/core/mixins/Fetcher.js +147 -0
- package/core/mixins/FormCheckable.d.ts +72 -0
- package/core/mixins/FormCheckable.js +144 -0
- package/core/mixins/FormElement.d.ts +21 -0
- package/core/mixins/FormElement.js +229 -0
- package/core/mixins/FormInput.d.ts +49 -0
- package/core/mixins/FormInput.js +33 -0
- package/core/mixins/Subscriber.d.ts +30 -0
- package/core/mixins/Subscriber.js +379 -0
- package/core/mixins/TemplatesContainer.d.ts +12 -0
- package/core/mixins/TemplatesContainer.js +60 -0
- package/core/mixins/mixins.d.ts +6 -0
- package/core/mixins/mixins.js +6 -0
- package/core/utils/Arrays.d.ts +97 -0
- package/core/utils/Arrays.js +136 -0
- package/core/utils/DataBindObserver.d.ts +74 -0
- package/core/utils/DataBindObserver.js +252 -0
- package/core/utils/Format.d.ts +11 -0
- package/core/utils/Format.js +22 -0
- package/core/utils/HTML.d.ts +13 -0
- package/core/utils/HTML.js +26 -0
- package/core/utils/LocationHandler.d.ts +44 -0
- package/core/utils/LocationHandler.js +96 -0
- package/core/utils/Objects.d.ts +23 -0
- package/core/utils/Objects.js +63 -0
- package/core/utils/PublisherProxy.d.mts +110 -0
- package/core/utils/PublisherProxy.mjs +365 -0
- package/core/utils/api.d.ts +66 -0
- package/core/utils/api.js +145 -0
- package/package.json +179 -21
- package/LICENSE +0 -43
- package/dist/concorde.bundle.js +0 -3620
- package/types/components/event/event-card/event-card.d.ts +0 -10
- package/types/components/event/event-title/event-title.d.ts +0 -7
- package/types/components/event/event.d.ts +0 -8
- package/types/components/giftcards/giftcard/giftcard.d.ts +0 -15
- package/types/components/illustration/illustration.d.ts +0 -16
- package/types/components/product/prices-form/price-button/price-button.d.ts +0 -25
- package/types/components/product/prices-form/prices-form.d.ts +0 -23
- package/types/components/theme/theme-collection/bootstrap5.d.ts +0 -1
- package/types/components/theme/theme-collection/dracula.d.ts +0 -1
- package/types/components/theme/theme.d.ts +0 -8
- package/types/components/ui/button/button.d.ts +0 -13
- package/types/components/ui/loader/loader.d.ts +0 -15
- package/types/components/ui/modal/modal.d.ts +0 -17
- package/types/components/ui/tooltip/tooltip.d.ts +0 -9
- package/types/core/components/fetch.d.ts +0 -6
- package/types/core/components/list.d.ts +0 -9
- package/types/core/components/queue.d.ts +0 -15
- package/types/core/components/taxonomy.d.ts +0 -13
- package/types/core/components/text-formatted.d.ts +0 -15
- package/types/core/components/text.d.ts +0 -9
- package/types/core/core.d.ts +0 -7
- package/types/core/mixins/Fetcher.d.ts +0 -9
- package/types/core/mixins/Subscriber.d.ts +0 -13
- package/types/core/utils/api.d.ts +0 -16
- package/types/index.d.ts +0 -12
- package/types/styles/button/button.d.ts +0 -1
- package/types/styles/prose/prose.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
# Concorde
|
|
2
|
-
|
|
1
|
+
# Concorde
|
|
2
|
+
Design system and functional components based on Lit Element + Vite + Tailwind CSS
|
|
3
3
|
|
|
4
4
|
## Getting Started
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
**Install Concorde**
|
|
7
7
|
|
|
8
|
-
`npm
|
|
8
|
+
`npm install @supersoniks/concorde`
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Import components**
|
|
11
11
|
|
|
12
|
-
`
|
|
12
|
+
`import @suspersoniks/concorde/core/components/ui/ui`
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
**Usage**
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
```html
|
|
17
|
+
<sonic-theme>
|
|
18
|
+
<sonic-button variant="outline">
|
|
19
|
+
Hello Concorde
|
|
20
|
+
</sonic-button>
|
|
21
|
+
</sonic-theme>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**More docs to come...**
|
package/cli.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
function enableShortPaths() {
|
|
5
|
+
let conf = path.resolve(__dirname + "../../../../tsconfig.json");
|
|
6
|
+
let current = path.resolve(__dirname);
|
|
7
|
+
function listFiles(dir) {
|
|
8
|
+
let files = [];
|
|
9
|
+
let list = fs.readdirSync(dir);
|
|
10
|
+
list.forEach((file) => {
|
|
11
|
+
const path = dir + "/" + file;
|
|
12
|
+
let stat = fs.statSync(path);
|
|
13
|
+
if (stat && stat.isDirectory()) {
|
|
14
|
+
files = files.concat(listFiles(path));
|
|
15
|
+
} else {
|
|
16
|
+
files.push(path.substring(2));
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return files;
|
|
20
|
+
}
|
|
21
|
+
if (fs.existsSync(conf)) {
|
|
22
|
+
const confJSON = require(conf);
|
|
23
|
+
let paths = confJSON.compilerOptions.paths || {};
|
|
24
|
+
let baseURL = confJSON.compilerOptions.baseUrl || ".";
|
|
25
|
+
if (baseURL.endsWith("/")) {
|
|
26
|
+
baseURL = baseURL.substring(0, baseURL.length - 1);
|
|
27
|
+
}
|
|
28
|
+
let baseURLSplit = baseURL.split("/");
|
|
29
|
+
let baseBackPath = "";
|
|
30
|
+
if (baseURLSplit[0] == ".") baseURLSplit.shift();
|
|
31
|
+
for (let i = 0; i < baseURLSplit.length; i++) {
|
|
32
|
+
baseBackPath += "../";
|
|
33
|
+
}
|
|
34
|
+
if (baseURLSplit.length == 0) baseBackPath = "./";
|
|
35
|
+
|
|
36
|
+
for (let z in paths) {
|
|
37
|
+
if (z.indexOf("@supersoniks/concorde") == 0) {
|
|
38
|
+
delete paths[z];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
let files = listFiles(current).filter((file) => {
|
|
42
|
+
return file.indexOf(".js") != -1 && file.indexOf(".stories.") == -1 && file.indexOf("core/") != -1;
|
|
43
|
+
});
|
|
44
|
+
for (let file of files) {
|
|
45
|
+
let src = file
|
|
46
|
+
.replace(/.*?core\/components/, "@supersoniks/concorde")
|
|
47
|
+
.replace(/.*?core\/mixins/, "@supersoniks/concorde/mixins")
|
|
48
|
+
.replace(/.*?core\/utils/, "@supersoniks/concorde/utils")
|
|
49
|
+
.replace(/\/(\w+)\/\1\.js/, "/$1")
|
|
50
|
+
.replace(".js", "");
|
|
51
|
+
let dest =
|
|
52
|
+
baseBackPath + "node_modules/" + file.substring(file.indexOf("@supersoniks/concorde")).replace(".js", "");
|
|
53
|
+
paths[src] = [dest];
|
|
54
|
+
}
|
|
55
|
+
confJSON.compilerOptions.paths = paths;
|
|
56
|
+
fs.writeFileSync(conf, JSON.stringify(confJSON, null, 2));
|
|
57
|
+
console.log("✔️ Go and look to tsconfig.json to see generated paths");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
switch (process.argv[2]) {
|
|
61
|
+
case "enable-short-paths":
|
|
62
|
+
enableShortPaths();
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
console.log("Usage: npx concorde <command>");
|
|
66
|
+
console.log("Commands:");
|
|
67
|
+
console.log(" enable-short-paths");
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LitElement, nothing } from "lit";
|
|
2
|
+
declare const SonicDate_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
|
|
3
|
+
export declare class SonicDate extends SonicDate_base {
|
|
4
|
+
pageLanguage: string;
|
|
5
|
+
private duAu;
|
|
6
|
+
private _wording_billet_periode_validite;
|
|
7
|
+
get wording_billet_periode_validite(): string;
|
|
8
|
+
set wording_billet_periode_validite(value: string);
|
|
9
|
+
designMode: boolean | null;
|
|
10
|
+
date: number | null;
|
|
11
|
+
date_string: string | null;
|
|
12
|
+
start_date_string: string | null;
|
|
13
|
+
end_date_string: string | null;
|
|
14
|
+
start_date: number;
|
|
15
|
+
end_date: number;
|
|
16
|
+
era: "narrow" | "short" | "long" | "";
|
|
17
|
+
year: "numeric" | "2-digit";
|
|
18
|
+
month: "numeric" | "2-digit" | "narrow" | "short" | "long";
|
|
19
|
+
day: "numeric" | "2-digit";
|
|
20
|
+
weekday: "narrow" | "short" | "long";
|
|
21
|
+
hour: "numeric" | "2-digit" | null;
|
|
22
|
+
minute: "numeric" | "2-digit" | null;
|
|
23
|
+
language: string;
|
|
24
|
+
renderIf: boolean;
|
|
25
|
+
private startDateObject;
|
|
26
|
+
private endDateObject;
|
|
27
|
+
connectedCallback(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Retourne un tableau des différentes parties de la date en fonction des options données, de la date de début et de fin.
|
|
30
|
+
*/
|
|
31
|
+
getDatesParts(start_date: number, end_date: number, options: Intl.DateTimeFormatOptions): any;
|
|
32
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement, nothing } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
|
+
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
11
|
+
import Format from "@supersoniks/concorde/core/utils/Format";
|
|
12
|
+
import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesContainer";
|
|
13
|
+
let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement)) {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.pageLanguage = "fr";
|
|
17
|
+
this.duAu = [];
|
|
18
|
+
this._wording_billet_periode_validite = "";
|
|
19
|
+
this.designMode = null;
|
|
20
|
+
this.date = null;
|
|
21
|
+
this.date_string = null;
|
|
22
|
+
this.start_date_string = null;
|
|
23
|
+
this.end_date_string = null;
|
|
24
|
+
this.start_date = new Date().getTime() / 1000;
|
|
25
|
+
this.end_date = 0;
|
|
26
|
+
this.era = "";
|
|
27
|
+
this.year = "numeric";
|
|
28
|
+
this.month = "short";
|
|
29
|
+
this.day = "2-digit";
|
|
30
|
+
this.weekday = "short";
|
|
31
|
+
this.hour = "2-digit";
|
|
32
|
+
this.minute = "2-digit";
|
|
33
|
+
this.language = "";
|
|
34
|
+
this.renderIf = true;
|
|
35
|
+
// @property({type:String}) second: 'numeric' | '2-digit'= "2-digit"
|
|
36
|
+
// @property({ type: String }) hour12: boolean = false;
|
|
37
|
+
this.startDateObject = new Date();
|
|
38
|
+
this.endDateObject = new Date();
|
|
39
|
+
}
|
|
40
|
+
get wording_billet_periode_validite() {
|
|
41
|
+
return this._wording_billet_periode_validite;
|
|
42
|
+
}
|
|
43
|
+
set wording_billet_periode_validite(value) {
|
|
44
|
+
this._wording_billet_periode_validite = value;
|
|
45
|
+
this.duAu = this.wording_billet_periode_validite.split("%s").map((str) => str.trim());
|
|
46
|
+
this.duAu.pop();
|
|
47
|
+
this.requestUpdate();
|
|
48
|
+
}
|
|
49
|
+
connectedCallback() {
|
|
50
|
+
this.wording_billet_periode_validite = "Du %s au %s";
|
|
51
|
+
this.pageLanguage = HTML.getLanguage();
|
|
52
|
+
super.connectedCallback();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Retourne un tableau des différentes parties de la date en fonction des options données, de la date de début et de fin.
|
|
56
|
+
*/
|
|
57
|
+
getDatesParts(start_date, end_date, options) {
|
|
58
|
+
const format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
|
|
59
|
+
let start = this.startDateObject;
|
|
60
|
+
start.setTime(start_date * 1000);
|
|
61
|
+
let parts = null;
|
|
62
|
+
if (end_date > 0) {
|
|
63
|
+
let end = this.endDateObject;
|
|
64
|
+
end.setTime(end_date * 1000);
|
|
65
|
+
parts = format.formatRangeToParts(start, end);
|
|
66
|
+
if (this.designMode) {
|
|
67
|
+
for (let part of parts) {
|
|
68
|
+
if (part.type == "literal" && this.designMode && part.value.trim() == ",") {
|
|
69
|
+
part.hidden = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (parts.some((part) => part.source == "endRange")) {
|
|
74
|
+
for (let part of parts) {
|
|
75
|
+
if (part.type == "literal" && part.source == "shared" && part.value.trim().length > 0) {
|
|
76
|
+
part.value = " " + this.duAu[1] + " ";
|
|
77
|
+
part.type = "to";
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (!this.designMode)
|
|
82
|
+
parts.unshift({ type: "from", value: this.duAu[0] + " ", source: "shared" });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else
|
|
86
|
+
parts = format.formatToParts(start);
|
|
87
|
+
parts[0].value = Format.ucFirst(parts[0].value);
|
|
88
|
+
parts = parts.filter((p) => p.hidden !== true);
|
|
89
|
+
return parts;
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
if (!this.renderIf)
|
|
93
|
+
return nothing;
|
|
94
|
+
if (this.date_string)
|
|
95
|
+
this.date = new Date(this.date_string).getTime() / 1000;
|
|
96
|
+
if (this.date)
|
|
97
|
+
this.start_date = this.date;
|
|
98
|
+
if (this.start_date_string)
|
|
99
|
+
this.start_date = new Date(this.start_date_string).getTime() / 1000;
|
|
100
|
+
if (this.end_date_string)
|
|
101
|
+
this.end_date = new Date(this.end_date_string).getTime() / 1000;
|
|
102
|
+
if (this.end_date > 0 && this.end_date < this.start_date) {
|
|
103
|
+
const copy = this.start_date;
|
|
104
|
+
this.start_date = this.end_date;
|
|
105
|
+
this.end_date = copy;
|
|
106
|
+
}
|
|
107
|
+
let options = {
|
|
108
|
+
weekday: this.weekday,
|
|
109
|
+
year: this.year,
|
|
110
|
+
month: this.month,
|
|
111
|
+
day: this.day,
|
|
112
|
+
};
|
|
113
|
+
if (this.hour)
|
|
114
|
+
options.hour = this.hour;
|
|
115
|
+
if (this.minute)
|
|
116
|
+
options.minute = this.minute;
|
|
117
|
+
if (this.era)
|
|
118
|
+
options.era = this.era;
|
|
119
|
+
let parts = this.getDatesParts(this.start_date, this.end_date, options);
|
|
120
|
+
return html `${parts.map((part) => {
|
|
121
|
+
let template = this.templateParts[part.type];
|
|
122
|
+
if (template) {
|
|
123
|
+
var clone = document.importNode(template.content, true);
|
|
124
|
+
let child = clone.children[0];
|
|
125
|
+
if (child.innerText.trim() == "")
|
|
126
|
+
child.innerText = part.value;
|
|
127
|
+
return clone;
|
|
128
|
+
}
|
|
129
|
+
return html `<span class="${part.type}">${part.value}</span>`;
|
|
130
|
+
})}`;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
__decorate([
|
|
134
|
+
property()
|
|
135
|
+
], SonicDate.prototype, "wording_billet_periode_validite", null);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: Boolean })
|
|
138
|
+
], SonicDate.prototype, "designMode", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
property({ type: Number })
|
|
141
|
+
], SonicDate.prototype, "date", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: String })
|
|
144
|
+
], SonicDate.prototype, "date_string", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
property({ type: String })
|
|
147
|
+
], SonicDate.prototype, "start_date_string", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: String })
|
|
150
|
+
], SonicDate.prototype, "end_date_string", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ type: Number })
|
|
153
|
+
], SonicDate.prototype, "start_date", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
property({ type: Number })
|
|
156
|
+
], SonicDate.prototype, "end_date", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
property({ type: String })
|
|
159
|
+
], SonicDate.prototype, "era", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: String })
|
|
162
|
+
], SonicDate.prototype, "year", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
property({ type: String })
|
|
165
|
+
], SonicDate.prototype, "month", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
property({ type: String })
|
|
168
|
+
], SonicDate.prototype, "day", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
property({ type: String })
|
|
171
|
+
], SonicDate.prototype, "weekday", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
property({ type: String })
|
|
174
|
+
], SonicDate.prototype, "hour", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
property({ type: String })
|
|
177
|
+
], SonicDate.prototype, "minute", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
property({ type: String })
|
|
180
|
+
], SonicDate.prototype, "language", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
property({ type: Boolean })
|
|
183
|
+
], SonicDate.prototype, "renderIf", void 0);
|
|
184
|
+
SonicDate = __decorate([
|
|
185
|
+
customElement("sonic-date")
|
|
186
|
+
], SonicDate);
|
|
187
|
+
export { SonicDate };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare const SonicComponent_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
3
|
+
export declare class SonicComponent extends SonicComponent_base {
|
|
4
|
+
text: string;
|
|
5
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
|
+
let SonicComponent = class SonicComponent extends Subscriber(LitElement) {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.text = "Example";
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return html `${this.text}`;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
__decorate([
|
|
20
|
+
property()
|
|
21
|
+
], SonicComponent.prototype, "text", void 0);
|
|
22
|
+
SonicComponent = __decorate([
|
|
23
|
+
customElement("sonic-example")
|
|
24
|
+
], SonicComponent);
|
|
25
|
+
export { SonicComponent };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare const Fetch_base: {
|
|
3
|
+
new (...args: any[]): {
|
|
4
|
+
api: import("../../../utils/api").default | null;
|
|
5
|
+
key: String;
|
|
6
|
+
isFirstLoad: boolean;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
iObserver: IntersectionObserver | null;
|
|
9
|
+
isDefaultLoaderEnabled: boolean;
|
|
10
|
+
isFetchEnabled: boolean;
|
|
11
|
+
_fetchEventData(): Promise<void>;
|
|
12
|
+
disconnectedCallback(): void;
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
firstUpdated(): void;
|
|
15
|
+
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
16
|
+
props: any;
|
|
17
|
+
getAncestorAttributeValue(attributeName: string): string;
|
|
18
|
+
hasAncestorAttribute(attributeName: string): boolean;
|
|
19
|
+
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
20
|
+
publisher: any;
|
|
21
|
+
dataProvider: String;
|
|
22
|
+
noShadowDom: string | null;
|
|
23
|
+
debug: HTMLElement | null;
|
|
24
|
+
defferedDebug: boolean | null;
|
|
25
|
+
makeShadow(props: Record<string, any>, value: any): any;
|
|
26
|
+
dispatchEvent(event: Event): void;
|
|
27
|
+
setAttribute(name: string, value: string): void;
|
|
28
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
29
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
30
|
+
removeAttribute(name: string): void;
|
|
31
|
+
initPublisher(): void;
|
|
32
|
+
getApiConfiguration(): import("../../../utils/api").APIConfiguration;
|
|
33
|
+
requestUpdate(): void;
|
|
34
|
+
getAttribute(name: string): string;
|
|
35
|
+
hasAttribute(attributeName: String): boolean;
|
|
36
|
+
};
|
|
37
|
+
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
38
|
+
/**
|
|
39
|
+
* ###Fetch charge un contenu via un appel d'api web.
|
|
40
|
+
* * On indique notamment la route de l'api avec l'attribut endpoint dans la balise du composant.
|
|
41
|
+
* * Si l'attribut endpoint n'est pas disponible le composant utilise la valeur de dataProvider "ancêtre" le plus proche.
|
|
42
|
+
* * Les propriétés réactives de tout composants étendant [subscriber](./?path=/docs/miscallenous-🔔-subscriber--page) avec le même dataProvider seront renseignées avec les propriétés de l'objet chargé via l'api.
|
|
43
|
+
* * L'affichage du loader peut être désactivé en ajoutant l'attribut *noLoader* à la balise du composant.
|
|
44
|
+
*/
|
|
45
|
+
export declare class Fetch extends Fetch_base {
|
|
46
|
+
static styles: import("lit").CSSResult[];
|
|
47
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, html, LitElement } from "lit";
|
|
8
|
+
import { customElement } from "lit/decorators.js";
|
|
9
|
+
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
|
+
import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
|
|
11
|
+
/**
|
|
12
|
+
* ###Fetch charge un contenu via un appel d'api web.
|
|
13
|
+
* * On indique notamment la route de l'api avec l'attribut endpoint dans la balise du composant.
|
|
14
|
+
* * Si l'attribut endpoint n'est pas disponible le composant utilise la valeur de dataProvider "ancêtre" le plus proche.
|
|
15
|
+
* * Les propriétés réactives de tout composants étendant [subscriber](./?path=/docs/miscallenous-🔔-subscriber--page) avec le même dataProvider seront renseignées avec les propriétés de l'objet chargé via l'api.
|
|
16
|
+
* * L'affichage du loader peut être désactivé en ajoutant l'attribut *noLoader* à la balise du composant.
|
|
17
|
+
*/
|
|
18
|
+
let Fetch = class Fetch extends Fetcher(Subscriber(LitElement)) {
|
|
19
|
+
render() {
|
|
20
|
+
return html `<slot></slot>`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
Fetch.styles = [
|
|
24
|
+
css `
|
|
25
|
+
:host {
|
|
26
|
+
display: contents;
|
|
27
|
+
}
|
|
28
|
+
`,
|
|
29
|
+
];
|
|
30
|
+
Fetch = __decorate([
|
|
31
|
+
customElement("sonic-fetch")
|
|
32
|
+
], Fetch);
|
|
33
|
+
export { Fetch };
|
|
34
|
+
//Ajout pour custom-elements-manifesy pour storybook notamment
|
|
35
|
+
try {
|
|
36
|
+
customElements.define("sonic-fetch", Fetch);
|
|
37
|
+
}
|
|
38
|
+
catch (e) { }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./date/date";
|
|
2
|
+
import "./fetch/fetch";
|
|
3
|
+
import "./if/if";
|
|
4
|
+
import "./list/list";
|
|
5
|
+
import "./queue/queue";
|
|
6
|
+
import "./subscriber/subscriber";
|
|
7
|
+
import "./submit/submit";
|
|
8
|
+
import "./router/router";
|
|
9
|
+
import "./router/redirect";
|
|
10
|
+
import "./states/states";
|
|
11
|
+
import "./example/example";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./date/date";
|
|
2
|
+
import "./fetch/fetch";
|
|
3
|
+
import "./if/if";
|
|
4
|
+
import "./list/list";
|
|
5
|
+
import "./queue/queue";
|
|
6
|
+
import "./subscriber/subscriber";
|
|
7
|
+
import "./submit/submit";
|
|
8
|
+
import "./router/router";
|
|
9
|
+
import "./router/redirect";
|
|
10
|
+
import "./states/states";
|
|
11
|
+
import "./example/example";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LitElement, nothing } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Le composant *sonic-if* affiche son contenu dans le slot principal si sa propriété .condition est évaluée à true
|
|
4
|
+
*/
|
|
5
|
+
export declare class SonicIF extends LitElement {
|
|
6
|
+
static styles: import("lit").CSSResult;
|
|
7
|
+
/**
|
|
8
|
+
* Le contenu s'affiche si la condition est évaluée à true.
|
|
9
|
+
*/
|
|
10
|
+
condition: boolean;
|
|
11
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
12
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, html, LitElement, nothing } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
/**
|
|
10
|
+
* Le composant *sonic-if* affiche son contenu dans le slot principal si sa propriété .condition est évaluée à true
|
|
11
|
+
*/
|
|
12
|
+
let SonicIF = class SonicIF extends LitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
/**
|
|
16
|
+
* Le contenu s'affiche si la condition est évaluée à true.
|
|
17
|
+
*/
|
|
18
|
+
this.condition = false;
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
if (!this.condition)
|
|
22
|
+
return nothing;
|
|
23
|
+
return html `
|
|
24
|
+
<slot></slot>
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
SonicIF.styles = css `:host{
|
|
29
|
+
display:contents;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
__decorate([
|
|
33
|
+
property({ type: Boolean })
|
|
34
|
+
], SonicIF.prototype, "condition", void 0);
|
|
35
|
+
SonicIF = __decorate([
|
|
36
|
+
customElement("sonic-if")
|
|
37
|
+
], SonicIF);
|
|
38
|
+
export { SonicIF };
|
|
39
|
+
//Ajout pour custom-elements-manifesy pour storybook notamment
|
|
40
|
+
try {
|
|
41
|
+
customElements.define("sonic-if", SonicIF);
|
|
42
|
+
}
|
|
43
|
+
catch (e) { }
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "@supersoniks/concorde/core/components/ui/loader/loader";
|
|
3
|
+
import "../subscriber/subscriber";
|
|
4
|
+
declare const List_base: {
|
|
5
|
+
new (...args: any[]): {
|
|
6
|
+
api: import("../../../utils/api").default | null;
|
|
7
|
+
key: String;
|
|
8
|
+
isFirstLoad: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
iObserver: IntersectionObserver | null;
|
|
11
|
+
isDefaultLoaderEnabled: boolean;
|
|
12
|
+
isFetchEnabled: boolean;
|
|
13
|
+
_fetchEventData(): Promise<void>;
|
|
14
|
+
disconnectedCallback(): void;
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
firstUpdated(): void;
|
|
17
|
+
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
18
|
+
props: any;
|
|
19
|
+
getAncestorAttributeValue(attributeName: string): string;
|
|
20
|
+
hasAncestorAttribute(attributeName: string): boolean;
|
|
21
|
+
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
22
|
+
publisher: any;
|
|
23
|
+
dataProvider: String;
|
|
24
|
+
noShadowDom: string | null;
|
|
25
|
+
debug: HTMLElement | null;
|
|
26
|
+
defferedDebug: boolean | null;
|
|
27
|
+
makeShadow(props: Record<string, any>, value: any): any;
|
|
28
|
+
dispatchEvent(event: Event): void;
|
|
29
|
+
setAttribute(name: string, value: string): void;
|
|
30
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
31
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
32
|
+
removeAttribute(name: string): void;
|
|
33
|
+
initPublisher(): void;
|
|
34
|
+
getApiConfiguration(): import("../../../utils/api").APIConfiguration;
|
|
35
|
+
requestUpdate(): void;
|
|
36
|
+
getAttribute(name: string): string;
|
|
37
|
+
hasAttribute(attributeName: String): boolean;
|
|
38
|
+
};
|
|
39
|
+
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
|
|
40
|
+
/**
|
|
41
|
+
* ### List boucle sur sa propriété "props" et crée des éléments a partir des données en bouclant également sur ses templates.
|
|
42
|
+
*
|
|
43
|
+
* * Si le composant possède un attribut *fetch* (quelque soit sa valeur), il charge un contenu via un appel d'api web comme le fait [fetch](./?path=/docs/core-components-functional-fetch--basic)
|
|
44
|
+
* Dans ce cas la proriété *key* (qui est issue du fetcher) peut être utilisé pour cibler une propriété particulière du retour de l'api.
|
|
45
|
+
*
|
|
46
|
+
* * Chaque élément créé est englobé dans un objet [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
47
|
+
* un dataProvider y est associé a l'adresse suivante *dataProvider-de-la-liste$/*index-e-la-ligne-courante*
|
|
48
|
+
* Les éléments contenus dans le template seront donc remplis par les données si ils sont eux même des subscriber et qu'il possèdent des propriétés réactives correspondantes
|
|
49
|
+
* * Lors du chargement un objet loader inline est affiché.
|
|
50
|
+
* * Si le résultat de la requête n'est pas une liste, mais est un objet, alors il est imbriqué dans un tableau pour garantir le fonctionnement.
|
|
51
|
+
* On paut aussi extraire directement toutes les valeurs dans un tableau pour le rendu en ajoutant l'attribut **extractValues**
|
|
52
|
+
*/
|
|
53
|
+
export declare class List extends List_base {
|
|
54
|
+
static styles: import("lit").CSSResult[];
|
|
55
|
+
/**
|
|
56
|
+
* La propriété templateKey contient le nom de la propriété qui sera utilisé pour identifier le template à utiliser dans la donnée de la ligne.
|
|
57
|
+
* Par exemple si templateIdentifier = "name" et que la donnée de la ligne est {name: "myTemplate" ... }, alors le template possédant l'attribut data-value="myTemplate" sera utilisé.
|
|
58
|
+
*/
|
|
59
|
+
templateKey: string;
|
|
60
|
+
/**
|
|
61
|
+
* La propriété idKey est utilisé repérer les lignes de manière unique si pour les item de la liste item[this.idKey] n'existe pas, alors l'index est utilisé
|
|
62
|
+
*/
|
|
63
|
+
idKey: string;
|
|
64
|
+
connectedCallback(): void;
|
|
65
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
66
|
+
}
|
|
67
|
+
export {};
|