@supersoniks/concorde 1.1.3 → 1.1.6
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/bin/cli.js +35 -0
- package/cli.js +6 -1
- package/core/components/functional/fetch/fetch.d.ts +7 -3
- package/core/components/functional/fetch/fetch.js +6 -2
- package/core/components/functional/list/list.d.ts +9 -8
- package/core/components/functional/list/list.js +12 -9
- package/core/components/functional/queue/queue.d.ts +2 -1
- package/core/components/functional/queue/queue.js +9 -5
- package/core/components/functional/router/redirect.js +1 -1
- package/core/components/functional/states/states.js +2 -0
- package/core/components/functional/submit/submit.d.ts +1 -1
- package/core/components/functional/submit/submit.js +6 -7
- package/core/components/ui/alert/alert.js +6 -0
- package/core/components/ui/button/button.js +4 -1
- package/core/components/ui/icon/icons.json +1 -1
- package/core/components/ui/theme/theme-collection/core-variables.js +1 -1
- package/core/components/ui/toast/toast-item.d.ts +16 -0
- package/core/components/ui/toast/toast-item.js +243 -0
- package/core/components/ui/toast/toast.d.ts +4 -15
- package/core/components/ui/toast/toast.js +24 -169
- package/core/components/ui/toast/types.d.ts +9 -0
- package/core/components/ui/toast/types.js +1 -0
- package/core/mixins/Fetcher.d.ts +8 -2
- package/core/mixins/Fetcher.js +9 -4
- package/core/mixins/Subscriber.js +4 -1
- package/core/utils/DataBindObserver.js +11 -7
- package/core/utils/PublisherProxy.d.mts +14 -0
- package/core/utils/PublisherProxy.mjs +33 -2
- package/package.json +6 -4
package/bin/cli.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
const runCommand = command => {
|
|
5
|
+
try {
|
|
6
|
+
execSync(command, { stdio: "inherit" });
|
|
7
|
+
} catch (e) {
|
|
8
|
+
console.error(`Failed to execute ${command}`, e);
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const repoName = process.argv[2];
|
|
14
|
+
const gitCheckoutCommand = `git clone --depth 1 https://github.com/ladigitale/concorde-ts-starter ${repoName}`;
|
|
15
|
+
const removeDotGitCommand = `rm -rf ${repoName}/.git`;
|
|
16
|
+
const installDepsCommand = `cd ${repoName} && yarn install`
|
|
17
|
+
const enableShortPathCmd = `cd ${repoName} && npx concorde enable-short-paths`;
|
|
18
|
+
console.log(`Cloning repository with name ${repoName}`);
|
|
19
|
+
const checkout = runCommand(gitCheckoutCommand)
|
|
20
|
+
if (!checkout) process.exit(-1);
|
|
21
|
+
|
|
22
|
+
const removeDotGit = runCommand(removeDotGitCommand);
|
|
23
|
+
if (!removeDotGit) process.exit(-1);
|
|
24
|
+
|
|
25
|
+
console.log(`installing dependencies for ${repoName}`);
|
|
26
|
+
const installDeps = runCommand(installDepsCommand);
|
|
27
|
+
if (!installDeps) process.exit(-1);
|
|
28
|
+
|
|
29
|
+
const enableShortPath = runCommand(enableShortPathCmd);
|
|
30
|
+
if (!enableShortPath) process.exit(-1);
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
console.log("Congratulations! You are ready. Follow the following commands to start");
|
|
34
|
+
console.log(`cd ${repoName} && yarn dev`);
|
|
35
|
+
|
package/cli.js
CHANGED
|
@@ -57,10 +57,15 @@ function enableShortPaths() {
|
|
|
57
57
|
console.log("✔️ Go and look to tsconfig.json to see generated paths");
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
|
|
60
61
|
switch (process.argv[2]) {
|
|
61
62
|
case "enable-short-paths":
|
|
62
63
|
enableShortPaths();
|
|
63
|
-
|
|
64
|
+
break;
|
|
65
|
+
case "create-concorde-ts-app":
|
|
66
|
+
createConcordeTsApp();
|
|
67
|
+
break;
|
|
68
|
+
|
|
64
69
|
default:
|
|
65
70
|
console.log("Usage: npx concorde <command>");
|
|
66
71
|
console.log("Commands:");
|
|
@@ -8,7 +8,7 @@ declare const Fetch_base: {
|
|
|
8
8
|
iObserver: IntersectionObserver | null;
|
|
9
9
|
isDefaultLoaderEnabled: boolean;
|
|
10
10
|
isFetchEnabled: boolean;
|
|
11
|
-
|
|
11
|
+
_fetchData(): Promise<void>;
|
|
12
12
|
disconnectedCallback(): void;
|
|
13
13
|
connectedCallback(): void;
|
|
14
14
|
firstUpdated(): void;
|
|
@@ -37,10 +37,14 @@ declare const Fetch_base: {
|
|
|
37
37
|
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
38
38
|
/**
|
|
39
39
|
* ###Fetch charge un contenu via un appel d'api web.
|
|
40
|
-
* *
|
|
41
|
-
* *
|
|
40
|
+
* * Fetch etendsles mixins Fetcher et Subscriber
|
|
41
|
+
* * On indique notamment la route de l'api avec l'attribut `endpoint` dans la balise du composant.
|
|
42
|
+
* * Si l'attribut `endpoint` n'est pas disponible le composant utilise la valeur de `dataProvider` "ancêtre" le plus proche.
|
|
43
|
+
* * L'attribut `key` peut être renseigné pour cibler une sous partie de la donnée chargée.
|
|
44
|
+
* Par exemple si la données est `{ma:{data:{a:1,b:2}}}` on peut ecrire `key="ma.data"`. Dans ce cas la données disponible dans le composant sera `{a:1, b:2}`
|
|
42
45
|
* * 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
46
|
* * L'affichage du loader peut être désactivé en ajoutant l'attribut *noLoader* à la balise du composant.
|
|
47
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
44
48
|
*/
|
|
45
49
|
export declare class Fetch extends Fetch_base {
|
|
46
50
|
static styles: import("lit").CSSResult[];
|
|
@@ -10,10 +10,14 @@ import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
|
10
10
|
import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
|
|
11
11
|
/**
|
|
12
12
|
* ###Fetch charge un contenu via un appel d'api web.
|
|
13
|
-
* *
|
|
14
|
-
* *
|
|
13
|
+
* * Fetch etendsles mixins Fetcher et Subscriber
|
|
14
|
+
* * On indique notamment la route de l'api avec l'attribut `endpoint` dans la balise du composant.
|
|
15
|
+
* * Si l'attribut `endpoint` n'est pas disponible le composant utilise la valeur de `dataProvider` "ancêtre" le plus proche.
|
|
16
|
+
* * L'attribut `key` peut être renseigné pour cibler une sous partie de la donnée chargée.
|
|
17
|
+
* Par exemple si la données est `{ma:{data:{a:1,b:2}}}` on peut ecrire `key="ma.data"`. Dans ce cas la données disponible dans le composant sera `{a:1, b:2}`
|
|
15
18
|
* * 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
19
|
* * L'affichage du loader peut être désactivé en ajoutant l'attribut *noLoader* à la balise du composant.
|
|
20
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
17
21
|
*/
|
|
18
22
|
let Fetch = class Fetch extends Fetcher(Subscriber(LitElement)) {
|
|
19
23
|
render() {
|
|
@@ -10,7 +10,7 @@ declare const List_base: {
|
|
|
10
10
|
iObserver: IntersectionObserver | null;
|
|
11
11
|
isDefaultLoaderEnabled: boolean;
|
|
12
12
|
isFetchEnabled: boolean;
|
|
13
|
-
|
|
13
|
+
_fetchData(): Promise<void>;
|
|
14
14
|
disconnectedCallback(): void;
|
|
15
15
|
connectedCallback(): void;
|
|
16
16
|
firstUpdated(): void;
|
|
@@ -40,15 +40,16 @@ declare const List_base: {
|
|
|
40
40
|
/**
|
|
41
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
42
|
*
|
|
43
|
-
* * Si le composant possède un attribut *fetch
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
* * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web comme le fait [fetch](./?path=/docs/core-components-functional-fetch--basic)
|
|
44
|
+
* * La proriété *key* (issue du fetcher) permet de cibler une propriété particulière du retour de l'api.
|
|
46
45
|
* * 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-
|
|
48
|
-
* Les
|
|
46
|
+
* un dataProvider y est associé a l'adresse suivante *dataProvider-de-la-liste$/*index-de-la-ligne-courante*
|
|
47
|
+
* Les données de la ligne sont donc disponible pour les élements internes (subscribers, data-binding)
|
|
49
48
|
* * Lors du chargement un objet loader inline est affiché.
|
|
50
|
-
* * Si le résultat de la requête
|
|
51
|
-
*
|
|
49
|
+
* * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.
|
|
50
|
+
* Cependant, si l'attribut `extractValues` est présent, les valeurs des propriétés de l'objet sont mises dans dans un tableau pour le rendu.
|
|
51
|
+
* * La propriété _key_ est ajoutés à la donnée de chaque item. Elle contient l'index dans le cas d'un liste simple ou la clés associée à la valeur si `extractValues` est définit.
|
|
52
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
52
53
|
*/
|
|
53
54
|
export declare class List extends List_base {
|
|
54
55
|
static styles: import("lit").CSSResult[];
|
|
@@ -18,15 +18,16 @@ import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesConta
|
|
|
18
18
|
/**
|
|
19
19
|
* ### List boucle sur sa propriété "props" et crée des éléments a partir des données en bouclant également sur ses templates.
|
|
20
20
|
*
|
|
21
|
-
* * Si le composant possède un attribut *fetch
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web comme le fait [fetch](./?path=/docs/core-components-functional-fetch--basic)
|
|
22
|
+
* * La proriété *key* (issue du fetcher) permet de cibler une propriété particulière du retour de l'api.
|
|
24
23
|
* * Chaque élément créé est englobé dans un objet [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
25
|
-
* un dataProvider y est associé a l'adresse suivante *dataProvider-de-la-liste$/*index-
|
|
26
|
-
* Les
|
|
24
|
+
* un dataProvider y est associé a l'adresse suivante *dataProvider-de-la-liste$/*index-de-la-ligne-courante*
|
|
25
|
+
* Les données de la ligne sont donc disponible pour les élements internes (subscribers, data-binding)
|
|
27
26
|
* * Lors du chargement un objet loader inline est affiché.
|
|
28
|
-
* * Si le résultat de la requête
|
|
29
|
-
*
|
|
27
|
+
* * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.
|
|
28
|
+
* Cependant, si l'attribut `extractValues` est présent, les valeurs des propriétés de l'objet sont mises dans dans un tableau pour le rendu.
|
|
29
|
+
* * La propriété _key_ est ajoutés à la donnée de chaque item. Elle contient l'index dans le cas d'un liste simple ou la clés associée à la valeur si `extractValues` est définit.
|
|
30
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
30
31
|
*/
|
|
31
32
|
let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))) {
|
|
32
33
|
constructor() {
|
|
@@ -84,7 +85,9 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
84
85
|
counter++;
|
|
85
86
|
if (hasCustomTemplate)
|
|
86
87
|
counter = -1;
|
|
87
|
-
let
|
|
88
|
+
let key = extractValues ? item.key : index;
|
|
89
|
+
let pub = this.publisher[key];
|
|
90
|
+
pub._key_ = key + "";
|
|
88
91
|
return (item &&
|
|
89
92
|
html `
|
|
90
93
|
<sonic-subscriber
|
|
@@ -92,7 +95,7 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
92
95
|
.bindPublisher=${function () {
|
|
93
96
|
return pub;
|
|
94
97
|
}}
|
|
95
|
-
|
|
98
|
+
.propertyMap=${ifDefined(this.itemPropertyMap)}
|
|
96
99
|
dataProvider="${this.dataProvider}/list-item/${index}"
|
|
97
100
|
>
|
|
98
101
|
${hasCustomTemplate
|
|
@@ -10,7 +10,7 @@ declare const Queue_base: (new (...args: any[]) => import("@supersoniks/concorde
|
|
|
10
10
|
* Les valeurs renseignées dans ce publisher sont ajoutées en get à chaque requête
|
|
11
11
|
* * la proriété *key* peut être utilisé pour cibler une propriété particulière du retour de l'api.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export default class Queue extends Queue_base {
|
|
14
14
|
templates: Array<HTMLTemplateElement> | null;
|
|
15
15
|
lastRequestTime: number;
|
|
16
16
|
key: String;
|
|
@@ -20,6 +20,7 @@ export declare class Queue extends Queue_base {
|
|
|
20
20
|
*/
|
|
21
21
|
targetRequestDuration: number;
|
|
22
22
|
limit: number;
|
|
23
|
+
offset: number;
|
|
23
24
|
static instanceCounter: number;
|
|
24
25
|
connectedCallback(): void;
|
|
25
26
|
filterPublisher: PublisherProxy | null;
|
|
@@ -36,6 +36,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
36
36
|
* Cette valeur est mise à jour ensuite par Queue pour chauq lot pour se rapprocher tanque possible de *targetRequestDuration*
|
|
37
37
|
*/
|
|
38
38
|
this.limit = 5;
|
|
39
|
+
this.offset = 0;
|
|
39
40
|
this.filterPublisher = null;
|
|
40
41
|
this.filterTimeoutId = undefined;
|
|
41
42
|
/**
|
|
@@ -90,7 +91,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
90
91
|
}
|
|
91
92
|
next(e) {
|
|
92
93
|
var _a, _b;
|
|
93
|
-
let offset =
|
|
94
|
+
let offset = this.offset;
|
|
94
95
|
const newTime = new Date().getTime();
|
|
95
96
|
const requestDuration = newTime - this.lastRequestTime;
|
|
96
97
|
if (e) {
|
|
@@ -102,7 +103,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
102
103
|
this.props = [];
|
|
103
104
|
}
|
|
104
105
|
else {
|
|
105
|
-
const props =
|
|
106
|
+
const props = this.props;
|
|
106
107
|
const item = props[props.length - 1];
|
|
107
108
|
offset = parseInt(item.offset.toString()) + parseInt(item.limit.toString());
|
|
108
109
|
}
|
|
@@ -124,7 +125,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
124
125
|
this.listDataProviders.push(dataProvider);
|
|
125
126
|
this.currentScrollPosition = (_b = document.scrollingElement) === null || _b === void 0 ? void 0 : _b.scrollTop;
|
|
126
127
|
this.props = [
|
|
127
|
-
...
|
|
128
|
+
...this.props,
|
|
128
129
|
{
|
|
129
130
|
id: searchParams.toString() + "/" + this.props.length,
|
|
130
131
|
dataProvider: dataProvider,
|
|
@@ -148,7 +149,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
148
149
|
${repeat(this.props, (item) => item.id, (item) => html `
|
|
149
150
|
<sonic-list
|
|
150
151
|
fetch
|
|
151
|
-
|
|
152
|
+
.itemPropertyMap=${this.itemPropertyMap}
|
|
152
153
|
debug=${ifDefined(this.defferedDebug)}
|
|
153
154
|
@load=${this.next}
|
|
154
155
|
key=${this.key}
|
|
@@ -172,6 +173,9 @@ __decorate([
|
|
|
172
173
|
__decorate([
|
|
173
174
|
property()
|
|
174
175
|
], Queue.prototype, "limit", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
property()
|
|
178
|
+
], Queue.prototype, "offset", void 0);
|
|
175
179
|
__decorate([
|
|
176
180
|
property({ type: String })
|
|
177
181
|
], Queue.prototype, "dataProviderExpression", void 0);
|
|
@@ -181,7 +185,7 @@ __decorate([
|
|
|
181
185
|
Queue = Queue_1 = __decorate([
|
|
182
186
|
customElement("sonic-queue")
|
|
183
187
|
], Queue);
|
|
184
|
-
export
|
|
188
|
+
export default Queue;
|
|
185
189
|
//Ajout pour custom-elements-manifesy pour storybook notamment
|
|
186
190
|
try {
|
|
187
191
|
customElements.define("sonic-queue", Queue);
|
|
@@ -41,7 +41,7 @@ let SonicRedirect = class SonicRedirect extends Subscriber(LitElement) {
|
|
|
41
41
|
return;
|
|
42
42
|
let onDataPath = this.getAttribute("onData").split(".");
|
|
43
43
|
let searchedData = Objects.traverse(this.props, onDataPath);
|
|
44
|
-
if (searchedData) {
|
|
44
|
+
if (searchedData && !(Objects.isObject(searchedData) && searchedData)) {
|
|
45
45
|
LocationHandler.changeFromComponent(this);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -37,6 +37,7 @@ let SonicStates = class SonicStates extends Subscriber(TemplatesContainer(LitEle
|
|
|
37
37
|
}
|
|
38
38
|
connectedCallback() {
|
|
39
39
|
super.connectedCallback();
|
|
40
|
+
console.log("BB");
|
|
40
41
|
if (this.hasAttribute("data-path")) {
|
|
41
42
|
this.statePath = this.getAttribute("data-path");
|
|
42
43
|
}
|
|
@@ -64,6 +65,7 @@ let SonicStates = class SonicStates extends Subscriber(TemplatesContainer(LitEle
|
|
|
64
65
|
if ((!Array.isArray(state) && Objects.isObject(state)) || state === undefined) {
|
|
65
66
|
state = "";
|
|
66
67
|
}
|
|
68
|
+
console.log(state);
|
|
67
69
|
for (let t of this.templatePartsList) {
|
|
68
70
|
let path = t.getAttribute(this.templateValueAttribute);
|
|
69
71
|
let stateToMatch = state;
|
|
@@ -15,7 +15,7 @@ declare const Submit_base: (new (...args: any[]) => import("@supersoniks/concord
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class Submit extends Submit_base {
|
|
17
17
|
static styles: import("lit").CSSResult;
|
|
18
|
-
disabled:
|
|
18
|
+
disabled: boolean;
|
|
19
19
|
api: API | null;
|
|
20
20
|
connectedCallback(): void;
|
|
21
21
|
submit(): Promise<void>;
|
|
@@ -34,7 +34,7 @@ import { css, html, LitElement } from "lit";
|
|
|
34
34
|
let Submit = class Submit extends Subscriber(LitElement) {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
this.disabled =
|
|
37
|
+
this.disabled = false;
|
|
38
38
|
this.api = null;
|
|
39
39
|
}
|
|
40
40
|
connectedCallback() {
|
|
@@ -51,7 +51,7 @@ let Submit = class Submit extends Subscriber(LitElement) {
|
|
|
51
51
|
submit() {
|
|
52
52
|
var _a, _b, _c, _d, _e;
|
|
53
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
this.publisher.disabled =
|
|
54
|
+
this.publisher.disabled = true;
|
|
55
55
|
let method = ((_a = this.getAttribute("method")) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) || "post";
|
|
56
56
|
let postData = PublisherManager.getInstance().get(this.getAncestorAttributeValue("formDataProvider")).get();
|
|
57
57
|
let result = null;
|
|
@@ -79,23 +79,22 @@ let Submit = class Submit extends Subscriber(LitElement) {
|
|
|
79
79
|
clearedDataProvider.split(" ").forEach(dataProvider => PublisherManager.getInstance().get(dataProvider).set({}));
|
|
80
80
|
}
|
|
81
81
|
PublisherManager.getInstance().get(this.getAncestorAttributeValue("submitResultDataProvider")).set(result);
|
|
82
|
-
this.publisher.disabled =
|
|
82
|
+
this.publisher.disabled = false;
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
render() {
|
|
86
|
-
|
|
87
|
-
return html `<div class="${disabled}"><slot></slot></div>`;
|
|
86
|
+
return html `<div ?data-disabled=${this.disabled}><slot></slot></div>`;
|
|
88
87
|
}
|
|
89
88
|
};
|
|
90
89
|
Submit.styles = css `
|
|
91
|
-
|
|
90
|
+
[data-disabled]{
|
|
92
91
|
opacity: 0.3;
|
|
93
92
|
pointer-events: none;
|
|
94
93
|
user-select: none;
|
|
95
94
|
}
|
|
96
95
|
`;
|
|
97
96
|
__decorate([
|
|
98
|
-
property({ type:
|
|
97
|
+
property({ type: Boolean })
|
|
99
98
|
], Submit.prototype, "disabled", void 0);
|
|
100
99
|
Submit = __decorate([
|
|
101
100
|
customElement("sonic-submit")
|
|
@@ -103,7 +103,13 @@ Alert.styles = [
|
|
|
103
103
|
bottom: 0;
|
|
104
104
|
opacity: 0.08;
|
|
105
105
|
border-radius: var(--sc-alert-rounded);
|
|
106
|
+
pointer-events:none;
|
|
106
107
|
}
|
|
108
|
+
:host([background]) > div {
|
|
109
|
+
z-index:2;
|
|
110
|
+
position:relative;
|
|
111
|
+
}
|
|
112
|
+
|
|
107
113
|
|
|
108
114
|
/*SIZE*/
|
|
109
115
|
:host([size="xs"]) {
|
|
@@ -151,7 +151,7 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
|
|
|
151
151
|
<slot @slotchange=${this.onSlotChange} part="prefix" name="prefix"></slot>
|
|
152
152
|
<slot part="main" class="main-slot"></slot>
|
|
153
153
|
<slot @slotchange=${this.onSlotChange} part="suffix" name="suffix"></slot>
|
|
154
|
-
${this.loading == true ? html `<sonic-icon prefix="
|
|
154
|
+
${this.loading == true ? html `<sonic-icon prefix="feather" name="loader" class="loader"></sonic-icon>` : ""}
|
|
155
155
|
</button>
|
|
156
156
|
`;
|
|
157
157
|
return this.href
|
|
@@ -282,6 +282,9 @@ Button.styles = [
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
/*SIZE*/
|
|
285
|
+
:host([size="2xs"]) {
|
|
286
|
+
--sc-btn-fs: 0.6rem;
|
|
287
|
+
}
|
|
285
288
|
:host([size="xs"]) {
|
|
286
289
|
--sc-btn-fs: 0.75rem;
|
|
287
290
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"iconoir":{"cancel":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6.75827 17.2426L12.0009 12M17.2435 6.75736L12.0009 12M12.0009 12L6.75827 6.75736M12.0009 12L17.2435 17.2426\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","check-circled-outline":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7 12.5L10 15.5L17 8.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","check":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5 13L9 17L19 7\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","emoji-think-left":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M10 15H7M2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M8.5 9C8.22386 9 8 8.77614 8 8.5C8 8.22386 8.22386 8 8.5 8C8.77614 8 9 8.22386 9 8.5C9 8.77614 8.77614 9 8.5 9Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M15.5 9C15.2239 9 15 8.77614 15 8.5C15 8.22386 15.2239 8 15.5 8C15.7761 8 16 8.22386 16 8.5C16 8.77614 15.7761 9 15.5 9Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","info-empty":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 11.5V16.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7.51L12.01 7.49889\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","more-vert":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 18.5C12.2761 18.5 12.5 18.2761 12.5 18C12.5 17.7239 12.2761 17.5 12 17.5C11.7239 17.5 11.5 17.7239 11.5 18C11.5 18.2761 11.7239 18.5 12 18.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 6.5C12.2761 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.2761 5.5 12 5.5C11.7239 5.5 11.5 5.72386 11.5 6C11.5 6.27614 11.7239 6.5 12 6.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","nav-arrow-down":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6 9L12 15L18 9\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","warning-circled-outline":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 7L12 13\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 17.01L12.01 16.9989\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n"}}
|
|
1
|
+
{"iconoir":{"cancel":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6.75827 17.2426L12.0009 12M17.2435 6.75736L12.0009 12M12.0009 12L6.75827 6.75736M12.0009 12L17.2435 17.2426\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","check-circled-outline":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7 12.5L10 15.5L17 8.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","check":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5 13L9 17L19 7\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","emoji-think-left":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M10 15H7M2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M8.5 9C8.22386 9 8 8.77614 8 8.5C8 8.22386 8.22386 8 8.5 8C8.77614 8 9 8.22386 9 8.5C9 8.77614 8.77614 9 8.5 9Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M15.5 9C15.2239 9 15 8.77614 15 8.5C15 8.22386 15.2239 8 15.5 8C15.7761 8 16 8.22386 16 8.5C16 8.77614 15.7761 9 15.5 9Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","info-empty":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 11.5V16.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7.51L12.01 7.49889\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","loader":"","more-vert":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 18.5C12.2761 18.5 12.5 18.2761 12.5 18C12.5 17.7239 12.2761 17.5 12 17.5C11.7239 17.5 11.5 17.7239 11.5 18C11.5 18.2761 11.7239 18.5 12 18.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 6.5C12.2761 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.2761 5.5 12 5.5C11.7239 5.5 11.5 5.72386 11.5 6C11.5 6.27614 11.7239 6.5 12 6.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","nav-arrow-down":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6 9L12 15L18 9\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","warning-circled-outline":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 7L12 13\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 17.01L12.01 16.9989\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n"}}
|
|
@@ -4,7 +4,7 @@ export const coreVariables = css `
|
|
|
4
4
|
/* --sc-rfs: 16px; */
|
|
5
5
|
|
|
6
6
|
/* polices*/
|
|
7
|
-
--sc-font-family-base:
|
|
7
|
+
--sc-font-family-base: "neue-haas-unica", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
8
8
|
"Helvetica Neue", Arial, sans-serif;
|
|
9
9
|
--sc-font-weight-base: 400;
|
|
10
10
|
--sc-font-style-base: inherit;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement, nothing } from "lit";
|
|
2
|
+
import "./types";
|
|
3
|
+
import { ToastStatus } from "./types";
|
|
4
|
+
export declare class SonicToastItem extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
title: string;
|
|
7
|
+
text: string;
|
|
8
|
+
status: ToastStatus;
|
|
9
|
+
ghost: boolean;
|
|
10
|
+
preserve: boolean;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
13
|
+
hide(): void;
|
|
14
|
+
show(): void;
|
|
15
|
+
autoHide(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
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, css, nothing } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
10
|
+
import "./types";
|
|
11
|
+
const icon = {
|
|
12
|
+
warning: "warning-circled-outline",
|
|
13
|
+
success: "check-circled-outline",
|
|
14
|
+
error: "warning-circled-outline",
|
|
15
|
+
info: "info-empty",
|
|
16
|
+
};
|
|
17
|
+
let SonicToastItem = class SonicToastItem extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.title = "";
|
|
21
|
+
this.text = "";
|
|
22
|
+
this.status = "";
|
|
23
|
+
this.ghost = false;
|
|
24
|
+
this.preserve = false;
|
|
25
|
+
this.visible = true;
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
if (!this.visible) {
|
|
29
|
+
return nothing;
|
|
30
|
+
}
|
|
31
|
+
return html `<div
|
|
32
|
+
class="sonic-toast ${this.status} ${this.ghost ? "ghost" : ""}"
|
|
33
|
+
|
|
34
|
+
>
|
|
35
|
+
${this.status &&
|
|
36
|
+
html `<sonic-icon prefix="iconoir" name=${icon[this.status]} class="sonic-toast-icon" size="2xl"></sonic-icon>`}
|
|
37
|
+
|
|
38
|
+
<button aria-label="Close" class="sonic-toast-close" @click=${() => this.hide()}>
|
|
39
|
+
<sonic-icon prefix="iconoir" name="cancel" size="lg"></sonic-icon>
|
|
40
|
+
</button>
|
|
41
|
+
|
|
42
|
+
<div class="sonic-toast-text">
|
|
43
|
+
${this.title ? html `<div class="sonic-toast-title">${this.title}</div>` : ""}
|
|
44
|
+
${this.text ? unsafeHTML(this.text) : ""}
|
|
45
|
+
<slot></slot>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
${!this.preserve ? this.autoHide() : ""}
|
|
49
|
+
</div>`;
|
|
50
|
+
}
|
|
51
|
+
hide() {
|
|
52
|
+
if (!this.closest('sonic-toast')) {
|
|
53
|
+
this.visible = false;
|
|
54
|
+
}
|
|
55
|
+
this.dispatchEvent(new CustomEvent("hide", { bubbles: true }));
|
|
56
|
+
}
|
|
57
|
+
show() {
|
|
58
|
+
this.visible = true;
|
|
59
|
+
}
|
|
60
|
+
autoHide() {
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
this.hide();
|
|
63
|
+
}, 4200);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
SonicToastItem.styles = [
|
|
67
|
+
css `
|
|
68
|
+
* {
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
}
|
|
71
|
+
:host {
|
|
72
|
+
display: block;
|
|
73
|
+
pointer-events: auto;
|
|
74
|
+
--sc-toast-status-color: transparent;
|
|
75
|
+
--sc-toast-color: var(--sc-base-content);
|
|
76
|
+
--sc-toast-bg: var(--sc-base);
|
|
77
|
+
--sc-toast-rounded: var(--sc-rounded-md);
|
|
78
|
+
--sc-toast-shadow: var(--sc-shadow-lg);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.sonic-toast-area {
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
width: calc(100% - 2.5rem);
|
|
84
|
+
max-width: 64ch;
|
|
85
|
+
gap: 1rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.fixed-area {
|
|
89
|
+
position: fixed;
|
|
90
|
+
bottom: 1.25rem;
|
|
91
|
+
right: 1.25rem;
|
|
92
|
+
z-index: 999;
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column-reverse;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.sonic-toast {
|
|
98
|
+
position: relative;
|
|
99
|
+
pointer-events: auto;
|
|
100
|
+
background: var(--sc-toast-bg);
|
|
101
|
+
color: var(--sc-toast-color);
|
|
102
|
+
box-shadow: var(--sc-toast-shadow);
|
|
103
|
+
border-radius: var(--sc-toast-rounded);
|
|
104
|
+
padding: 1em 2.5rem 1em 1em;
|
|
105
|
+
line-height: 1.25;
|
|
106
|
+
display: flex;
|
|
107
|
+
gap: 0.5rem;
|
|
108
|
+
max-height: 10rem;
|
|
109
|
+
overflow: auto;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.sonic-toast-text {
|
|
113
|
+
align-self: center;
|
|
114
|
+
margin-top: auto;
|
|
115
|
+
margin-bottom: auto;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
::slotted(a),
|
|
119
|
+
.sonic-toast-text a {
|
|
120
|
+
color: inherit;
|
|
121
|
+
text-decoration: underline;
|
|
122
|
+
text-underline-offset: 0.15rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/*BUTTON CLOSE*/
|
|
126
|
+
.sonic-toast-close {
|
|
127
|
+
all: unset;
|
|
128
|
+
position: absolute;
|
|
129
|
+
pointer-events: initial;
|
|
130
|
+
right: 0.5em;
|
|
131
|
+
top: 0.5em;
|
|
132
|
+
width: 1.5rem;
|
|
133
|
+
height: 1.5rem;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
display: inline-flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
border-radius: 50%;
|
|
139
|
+
text-align: center;
|
|
140
|
+
opacity: 0.5;
|
|
141
|
+
background: rgba(0, 0, 0, 0);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.sonic-toast-close:focus,
|
|
145
|
+
.sonic-toast-close:hover {
|
|
146
|
+
opacity: 1;
|
|
147
|
+
background: rgba(0, 0, 0, 0.075);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.sonic-toast-close svg {
|
|
151
|
+
width: 1rem;
|
|
152
|
+
height: 1rem;
|
|
153
|
+
object-fit: contain;
|
|
154
|
+
object-position: center center;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/*Title*/
|
|
158
|
+
.sonic-toast-title {
|
|
159
|
+
font-weight: bold;
|
|
160
|
+
font-size: 1.15rem;
|
|
161
|
+
margin: 0.15em 0 0.25em;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/*STATUS*/
|
|
165
|
+
.success {
|
|
166
|
+
--sc-toast-status-color: var(--sc-success);
|
|
167
|
+
--sc-toast-title-color: var(--sc-toast-status-color);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.error {
|
|
171
|
+
--sc-toast-status-color: var(--sc-danger);
|
|
172
|
+
--sc-toast-title-color: var(--sc-toast-status-color);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.warning {
|
|
176
|
+
--sc-toast-status-color: var(--sc-warning);
|
|
177
|
+
--sc-toast-title-color: var(--sc-toast-status-color);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.info {
|
|
181
|
+
--sc-toast-status-color: var(--sc-info);
|
|
182
|
+
--sc-toast-title-color: var(--sc-toast-status-color);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.success,
|
|
186
|
+
.error,
|
|
187
|
+
.info,
|
|
188
|
+
.warning {
|
|
189
|
+
border-top: 3px solid var(--sc-toast-status-color, curentColor);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.sonic-toast:before {
|
|
193
|
+
background-color: var(--sc-toast-status-color);
|
|
194
|
+
content: "";
|
|
195
|
+
display: block;
|
|
196
|
+
position: absolute;
|
|
197
|
+
left: 0;
|
|
198
|
+
top: 0;
|
|
199
|
+
right: 0;
|
|
200
|
+
bottom: 0;
|
|
201
|
+
opacity: 0.05;
|
|
202
|
+
pointer-events: none;
|
|
203
|
+
transition: 0.2s;
|
|
204
|
+
border-radius: var(--sc-toast-status-color);
|
|
205
|
+
}
|
|
206
|
+
.sonic-toast:hover:before {
|
|
207
|
+
opacity: 0.025;
|
|
208
|
+
}
|
|
209
|
+
.info .sonic-toast-icon,
|
|
210
|
+
.error .sonic-toast-icon,
|
|
211
|
+
.success .sonic-toast-icon,
|
|
212
|
+
.warning .sonic-toast-icon {
|
|
213
|
+
color: var(--sc-toast-status-color, curentColor);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.ghost {
|
|
217
|
+
opacity: 0.85;
|
|
218
|
+
pointer-events: none;
|
|
219
|
+
}
|
|
220
|
+
`,
|
|
221
|
+
];
|
|
222
|
+
__decorate([
|
|
223
|
+
property({ type: String })
|
|
224
|
+
], SonicToastItem.prototype, "title", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
property({ type: String })
|
|
227
|
+
], SonicToastItem.prototype, "text", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
property({ type: String })
|
|
230
|
+
], SonicToastItem.prototype, "status", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
property({ type: Boolean })
|
|
233
|
+
], SonicToastItem.prototype, "ghost", void 0);
|
|
234
|
+
__decorate([
|
|
235
|
+
property({ type: Boolean })
|
|
236
|
+
], SonicToastItem.prototype, "preserve", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
state()
|
|
239
|
+
], SonicToastItem.prototype, "visible", void 0);
|
|
240
|
+
SonicToastItem = __decorate([
|
|
241
|
+
customElement("sonic-toast-item")
|
|
242
|
+
], SonicToastItem);
|
|
243
|
+
export { SonicToastItem };
|
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
import { LitElement, nothing } from "lit";
|
|
2
2
|
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
id?: number;
|
|
6
|
-
text: string;
|
|
7
|
-
title?: string;
|
|
8
|
-
status?: ToastStatus;
|
|
9
|
-
preserve?: boolean;
|
|
10
|
-
ghost?: boolean;
|
|
11
|
-
marginTop?: string;
|
|
12
|
-
};
|
|
3
|
+
import "./toast-item";
|
|
4
|
+
import { Toast } from "./types";
|
|
13
5
|
export declare class SonicToast extends LitElement {
|
|
14
|
-
static styles: import("lit").CSSResult[];
|
|
15
6
|
toasts: Toast[];
|
|
7
|
+
createRenderRoot(): this;
|
|
16
8
|
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
17
9
|
static removeAll(): void;
|
|
18
10
|
static add(conf: Toast): {
|
|
19
11
|
id: number;
|
|
20
12
|
text: string;
|
|
21
13
|
title: string | undefined;
|
|
22
|
-
status: ToastStatus | undefined;
|
|
14
|
+
status: import("./types").ToastStatus | undefined;
|
|
23
15
|
preserve: boolean | undefined;
|
|
24
16
|
ghost: boolean | undefined;
|
|
25
|
-
marginTop: string | undefined;
|
|
26
17
|
} | null;
|
|
27
18
|
removeItem(item: Toast): void;
|
|
28
|
-
autoRemoveItem(item: Toast): void;
|
|
29
19
|
}
|
|
30
|
-
export {};
|
|
@@ -4,36 +4,41 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html, LitElement,
|
|
7
|
+
import { html, LitElement, nothing } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
|
-
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
10
9
|
import { repeat } from "lit/directives/repeat.js";
|
|
11
10
|
import { animate } from "@lit-labs/motion";
|
|
12
11
|
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
13
12
|
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
error: "warning-circled-outline",
|
|
18
|
-
info: "info-empty",
|
|
19
|
-
};
|
|
13
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
14
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
15
|
+
import "./toast-item";
|
|
20
16
|
let SonicToast = class SonicToast extends LitElement {
|
|
21
17
|
constructor() {
|
|
22
18
|
super(...arguments);
|
|
23
19
|
this.toasts = [];
|
|
24
20
|
}
|
|
21
|
+
createRenderRoot() {
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
25
24
|
render() {
|
|
26
|
-
|
|
25
|
+
let styles = {
|
|
26
|
+
pointerEvents: "none",
|
|
27
|
+
width: "calc(100% - 2.5rem)",
|
|
28
|
+
maxWidth: "64ch",
|
|
29
|
+
gap: "1rem",
|
|
30
|
+
display: "flex",
|
|
31
|
+
};
|
|
32
|
+
if (window.parent == window) {
|
|
33
|
+
styles = Object.assign(Object.assign({}, styles), { position: "fixed", bottom: "1.25rem", right: "1.25rem", zIndex: "999", flexDirection: "column-reverse" });
|
|
34
|
+
}
|
|
35
|
+
// ${window.parent == window ? "fixed-area" : ""}
|
|
27
36
|
if (!this.toasts)
|
|
28
37
|
return nothing;
|
|
29
|
-
|
|
30
|
-
return html `<div
|
|
31
|
-
style=${"margin-top:" + marginTop}
|
|
32
|
-
class="sonic-toast-area ${window.parent == window ? "fixed-area" : ""}"
|
|
33
|
-
>
|
|
38
|
+
return html `<div aria-live="polite" style=${styleMap(styles)}>
|
|
34
39
|
${repeat(this.toasts, (item) => item.id, (item) => html `
|
|
35
|
-
<
|
|
36
|
-
|
|
40
|
+
<sonic-toast-item status=${item.status} ?ghost=${item.ghost} ?preserve=${item.preserve} id=${item.id}
|
|
41
|
+
@hide=${() => this.removeItem(item)}
|
|
37
42
|
${animate({
|
|
38
43
|
keyframeOptions: {
|
|
39
44
|
duration: 250,
|
|
@@ -51,22 +56,8 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
51
56
|
stabilizeOut: true,
|
|
52
57
|
})}
|
|
53
58
|
>
|
|
54
|
-
${item.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<div class="sonic-toast-text">
|
|
58
|
-
${item.title ? html `<div class="sonic-toast-title">${item.title}</div>` : ""}
|
|
59
|
-
${item.text ? unsafeHTML(item.text) : ""}
|
|
60
|
-
<slot></slot>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
${true //!item.ghost
|
|
64
|
-
? html `<button class="sonic-toast-close" @click=${() => this.removeItem(item)}>
|
|
65
|
-
<sonic-icon prefix="iconoir" name="cancel"></sonic-icon>
|
|
66
|
-
</button>`
|
|
67
|
-
: ""}
|
|
68
|
-
${!item.preserve ? this.autoRemoveItem(item) : ""}
|
|
69
|
-
</div>
|
|
59
|
+
${item.text ? unsafeHTML(item.text) : ""}
|
|
60
|
+
</sonic-toast-item>
|
|
70
61
|
`)}
|
|
71
62
|
</div>`;
|
|
72
63
|
}
|
|
@@ -87,7 +78,7 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
87
78
|
// Ajoute le toast à la liste
|
|
88
79
|
let toastComponent = document.querySelector("sonic-toast");
|
|
89
80
|
const nextId = new Date().valueOf();
|
|
90
|
-
const interactiveRegExp = new RegExp(
|
|
81
|
+
const interactiveRegExp = new RegExp("</a>|</button>");
|
|
91
82
|
const hasInteractive = interactiveRegExp.test(conf.text);
|
|
92
83
|
const currentToast = {
|
|
93
84
|
id: nextId,
|
|
@@ -96,7 +87,6 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
96
87
|
status: conf.status,
|
|
97
88
|
preserve: hasInteractive ? true : conf.preserve,
|
|
98
89
|
ghost: conf.ghost,
|
|
99
|
-
marginTop: conf.marginTop,
|
|
100
90
|
};
|
|
101
91
|
if (toastComponent.toasts.length > 0) {
|
|
102
92
|
let toastA = Object.assign({}, currentToast);
|
|
@@ -113,142 +103,7 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
113
103
|
removeItem(item) {
|
|
114
104
|
this.toasts = this.toasts.filter((i) => i != item);
|
|
115
105
|
}
|
|
116
|
-
autoRemoveItem(item) {
|
|
117
|
-
setTimeout(() => {
|
|
118
|
-
this.removeItem(item);
|
|
119
|
-
}, 4200);
|
|
120
|
-
}
|
|
121
106
|
};
|
|
122
|
-
SonicToast.styles = [
|
|
123
|
-
css `
|
|
124
|
-
* {
|
|
125
|
-
box-sizing: border-box;
|
|
126
|
-
}
|
|
127
|
-
:host {
|
|
128
|
-
display: contents;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.sonic-toast-area {
|
|
132
|
-
pointer-events: none;
|
|
133
|
-
width: calc(100% - 2.5rem);
|
|
134
|
-
max-width: 40ch;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.fixed-area {
|
|
138
|
-
position: fixed;
|
|
139
|
-
top: 1.25rem;
|
|
140
|
-
right: 1.25rem;
|
|
141
|
-
z-index: 999;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.sonic-toast {
|
|
145
|
-
--sc-toast-status-color: transparent;
|
|
146
|
-
position: relative;
|
|
147
|
-
pointer-events: auto;
|
|
148
|
-
background: var(--sc-base-800);
|
|
149
|
-
color: var(--sc-base);
|
|
150
|
-
box-shadow: var(--sc-shadow);
|
|
151
|
-
border-radius: var(--sc-rounded);
|
|
152
|
-
padding: 1em 2rem 1em 1em;
|
|
153
|
-
font-size: 0.85em;
|
|
154
|
-
line-height: 1.25;
|
|
155
|
-
display: flex;
|
|
156
|
-
gap: 0.5rem;
|
|
157
|
-
max-height: 10rem;
|
|
158
|
-
overflow: auto;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.sonic-toast + .sonic-toast {
|
|
162
|
-
margin-top: 1rem;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.sonic-toast-text {
|
|
166
|
-
align-self: center;
|
|
167
|
-
margin-top: auto;
|
|
168
|
-
margin-bottom: auto;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
::slotted(a),
|
|
172
|
-
.sonic-toast-text a {
|
|
173
|
-
color: inherit;
|
|
174
|
-
text-decoration: underline;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/*BUTTON CLOSE*/
|
|
178
|
-
.sonic-toast-close {
|
|
179
|
-
all: unset;
|
|
180
|
-
position: absolute;
|
|
181
|
-
pointer-events:initial;
|
|
182
|
-
right: 0.5em;
|
|
183
|
-
top: 0.5em;
|
|
184
|
-
width: 1.5rem;
|
|
185
|
-
height: 1.5rem;
|
|
186
|
-
cursor: pointer;
|
|
187
|
-
display: inline-flex;
|
|
188
|
-
align-items: center;
|
|
189
|
-
justify-content: center;
|
|
190
|
-
border-radius: 50%;
|
|
191
|
-
text-align: center;
|
|
192
|
-
opacity: 0.5;
|
|
193
|
-
background: rgba(0, 0, 0, 0);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.sonic-toast-close:focus,
|
|
197
|
-
.sonic-toast-close:hover {
|
|
198
|
-
opacity: 1;
|
|
199
|
-
background: rgba(0, 0, 0, 0.075);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.sonic-toast-close svg {
|
|
203
|
-
width: 1rem;
|
|
204
|
-
height: 1rem;
|
|
205
|
-
object-fit: contain;
|
|
206
|
-
object-position: center center;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/*Title*/
|
|
210
|
-
.sonic-toast-title {
|
|
211
|
-
font-weight: bold;
|
|
212
|
-
margin-bottom: 0.25em;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/*STATUS*/
|
|
216
|
-
.success {
|
|
217
|
-
--sc-toast-status-color: var(--sc-success);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.error {
|
|
221
|
-
--sc-toast-status-color: var(--sc-danger);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.warning {
|
|
225
|
-
--sc-toast-status-color: var(--sc-warning);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.info {
|
|
229
|
-
--sc-toast-status-color: var(--sc-info);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.success,
|
|
233
|
-
.error,
|
|
234
|
-
.info,
|
|
235
|
-
.warning {
|
|
236
|
-
border-top: 2px solid var(--sc-toast-status-color, curentColor);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.info .sonic-toast-icon,
|
|
240
|
-
.error .sonic-toast-icon,
|
|
241
|
-
.success .sonic-toast-icon,
|
|
242
|
-
.warning .sonic-toast-icon {
|
|
243
|
-
color: var(--sc-toast-status-color, curentColor);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.ghost {
|
|
247
|
-
opacity: 0.85;
|
|
248
|
-
pointer-events: none;
|
|
249
|
-
}
|
|
250
|
-
`,
|
|
251
|
-
];
|
|
252
107
|
__decorate([
|
|
253
108
|
property({ type: Array })
|
|
254
109
|
], SonicToast.prototype, "toasts", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/core/mixins/Fetcher.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import API from "@supersoniks/concorde/core/utils/api";
|
|
2
|
+
import "../components/ui/button/button";
|
|
2
3
|
import { SubscriberInterface } from "./Subscriber";
|
|
3
4
|
declare type Constructor<T> = new (...args: any[]) => T;
|
|
4
5
|
declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass: T) => {
|
|
@@ -36,7 +37,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
|
|
|
36
37
|
* Elles sont ensuite injectées dans le publisher en accord avec la cible définie dans la propriété key
|
|
37
38
|
* Un Toast est affiché si le chargement échoue
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
_fetchData(): Promise<void>;
|
|
40
41
|
disconnectedCallback(): void;
|
|
41
42
|
connectedCallback(): void;
|
|
42
43
|
/**
|
|
@@ -48,13 +49,18 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
|
|
|
48
49
|
getAncestorAttributeValue(attributeName: string): string;
|
|
49
50
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
50
51
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
52
|
+
/**
|
|
53
|
+
* isFirstLoad vaut true jusqu'au premier chargement de données
|
|
54
|
+
*/
|
|
51
55
|
publisher: any;
|
|
52
56
|
dataProvider: String;
|
|
53
57
|
noShadowDom: string | null;
|
|
54
58
|
debug: HTMLElement | null;
|
|
55
59
|
defferedDebug: boolean | null;
|
|
56
60
|
makeShadow(props: Record<string, any>, value: any): any;
|
|
57
|
-
dispatchEvent(event: Event): void;
|
|
61
|
+
dispatchEvent(event: Event): void; /**
|
|
62
|
+
* IObserver est l'intersection observer qui permet de charger les données au scroll si l'attribut lazyload est renseigné
|
|
63
|
+
*/
|
|
58
64
|
setAttribute(name: string, value: string): void;
|
|
59
65
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
60
66
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
package/core/mixins/Fetcher.js
CHANGED
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { Loader } from "../components/ui/loader/loader";
|
|
11
11
|
import { SonicToast } from "../components/ui/toast/toast";
|
|
12
12
|
import API from "@supersoniks/concorde/core/utils/api";
|
|
13
|
+
import "../components/ui/button/button";
|
|
13
14
|
import Objects from "../utils/Objects";
|
|
14
15
|
const Fetcher = (superClass) => {
|
|
15
16
|
class FetcherElement extends superClass {
|
|
@@ -51,7 +52,7 @@ const Fetcher = (superClass) => {
|
|
|
51
52
|
* Elles sont ensuite injectées dans le publisher en accord avec la cible définie dans la propriété key
|
|
52
53
|
* Un Toast est affiché si le chargement échoue
|
|
53
54
|
*/
|
|
54
|
-
|
|
55
|
+
_fetchData() {
|
|
55
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
57
|
if (!this.isFetchEnabled)
|
|
57
58
|
return;
|
|
@@ -86,10 +87,13 @@ const Fetcher = (superClass) => {
|
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
disconnectedCallback() {
|
|
90
|
+
var _a;
|
|
89
91
|
super.disconnectedCallback();
|
|
92
|
+
(_a = this.publisher) === null || _a === void 0 ? void 0 : _a.offInvalidate(() => this._fetchData());
|
|
90
93
|
this.isFirstLoad = false;
|
|
91
94
|
}
|
|
92
95
|
connectedCallback() {
|
|
96
|
+
var _a;
|
|
93
97
|
this.noShadowDom = "";
|
|
94
98
|
if (!this.isFetchEnabled) {
|
|
95
99
|
super.connectedCallback();
|
|
@@ -101,9 +105,10 @@ const Fetcher = (superClass) => {
|
|
|
101
105
|
if (this.props) {
|
|
102
106
|
this.publisher.set(this.props);
|
|
103
107
|
}
|
|
108
|
+
(_a = this.publisher) === null || _a === void 0 ? void 0 : _a.onInvalidate(() => this._fetchData());
|
|
104
109
|
const lazyLoad = this.getAncestorAttributeValue("lazyload");
|
|
105
110
|
if (lazyLoad === null) {
|
|
106
|
-
this.
|
|
111
|
+
this._fetchData();
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
/**
|
|
@@ -131,13 +136,13 @@ const Fetcher = (superClass) => {
|
|
|
131
136
|
this.iObserver.observe(elt);
|
|
132
137
|
}
|
|
133
138
|
else if (this.isFirstLoad) {
|
|
134
|
-
this.
|
|
139
|
+
this._fetchData();
|
|
135
140
|
}
|
|
136
141
|
}
|
|
137
142
|
onIntersection(entries) {
|
|
138
143
|
for (const e of entries) {
|
|
139
144
|
if (e.isIntersecting && this.isFirstLoad) {
|
|
140
|
-
this.
|
|
145
|
+
this._fetchData();
|
|
141
146
|
}
|
|
142
147
|
}
|
|
143
148
|
}
|
|
@@ -52,6 +52,9 @@ const Subscriber = (superClass) => {
|
|
|
52
52
|
* Cela se fait à l'initialisation uniquement et n'est pas modifiable lors de la vie du composant.
|
|
53
53
|
*/
|
|
54
54
|
this.noShadowDom = null;
|
|
55
|
+
/**
|
|
56
|
+
* Permet de mapper un nom de propriété de donnée source vars une propriété du subscriber à la volée
|
|
57
|
+
*/
|
|
55
58
|
this.propertyMap = null;
|
|
56
59
|
this.title = "";
|
|
57
60
|
/**
|
|
@@ -82,7 +85,7 @@ const Subscriber = (superClass) => {
|
|
|
82
85
|
this.args = args;
|
|
83
86
|
}
|
|
84
87
|
/**
|
|
85
|
-
*
|
|
88
|
+
* retourne un objet contenant les propriétés de value + celle de props si elle ne sont pas déjà dans value.
|
|
86
89
|
*/
|
|
87
90
|
makeShadow(props, value) {
|
|
88
91
|
if (typeof value == "object" && value !== null) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
2
1
|
import Format from "@supersoniks/concorde/core/utils/Format";
|
|
3
2
|
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
4
3
|
import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy.mjs";
|
|
@@ -189,9 +188,12 @@ export default class DataBindObserver {
|
|
|
189
188
|
*/
|
|
190
189
|
if (values.length == 1 && bindedVariablesDescriptor.variables[0].join(".") == expression.substring(1)) {
|
|
191
190
|
let value = values[0];
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
if (value === null
|
|
192
|
+
// ||
|
|
193
|
+
// ( Objects.isObject(value) &&
|
|
194
|
+
// value.hasOwnProperty("__value") &&
|
|
195
|
+
// (Objects.isUndefindOrNull(value.__value) || value.__value === "") )
|
|
196
|
+
) {
|
|
195
197
|
value = "";
|
|
196
198
|
}
|
|
197
199
|
rec[propertyToUpdate] = value;
|
|
@@ -203,9 +205,11 @@ export default class DataBindObserver {
|
|
|
203
205
|
for (let i = 0; i < values.length; i++) {
|
|
204
206
|
let value = values[i];
|
|
205
207
|
let variable = bindedVariablesDescriptor.variables[i];
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
if (value === null
|
|
209
|
+
// Objects.isObject(value) &&
|
|
210
|
+
// value.hasOwnProperty("__value") &&
|
|
211
|
+
// Objects.isUndefindOrNull(value.__value)
|
|
212
|
+
) {
|
|
209
213
|
hasUndeterminatedValue = true;
|
|
210
214
|
value = undefined;
|
|
211
215
|
}
|
|
@@ -5,6 +5,7 @@ export class PublisherProxy {
|
|
|
5
5
|
constructor(target: any, parentProxPub?: null);
|
|
6
6
|
_proxies_: Map<any, any>;
|
|
7
7
|
_value_: any;
|
|
8
|
+
_invalidateListeners_: Set<any>;
|
|
8
9
|
_assignListeners_: Set<any>;
|
|
9
10
|
_mutationListeners_: Set<any>;
|
|
10
11
|
_fillListeners_: Set<any>;
|
|
@@ -23,6 +24,7 @@ export class PublisherProxy {
|
|
|
23
24
|
hasListener(): boolean;
|
|
24
25
|
_publishInternalMutation_(lockInternalMutationsTransmission?: boolean): void;
|
|
25
26
|
_publishAssignement_(lockInternalMutationsTransmission?: boolean): void;
|
|
27
|
+
_publishInvalidation_(): void;
|
|
26
28
|
_publishDynamicFilling_(key: any, value: any): void;
|
|
27
29
|
_publishTemplateFilling_(key: any, value: any): void;
|
|
28
30
|
/**
|
|
@@ -34,6 +36,18 @@ export class PublisherProxy {
|
|
|
34
36
|
* Stop les appels de la fonction "handler" (passée en paramettre) lorsque la valeur gérée par le proxy change par assignation
|
|
35
37
|
*/
|
|
36
38
|
offAssign(handler: any): void;
|
|
39
|
+
/**
|
|
40
|
+
* Appel la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
|
|
41
|
+
*/
|
|
42
|
+
onInvalidate(handler: any): void;
|
|
43
|
+
/**
|
|
44
|
+
* Stop les appels de la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
|
|
45
|
+
*/
|
|
46
|
+
offInvalidate(handler: any): void;
|
|
47
|
+
/**
|
|
48
|
+
* Flag les données comme étant invalides
|
|
49
|
+
*/
|
|
50
|
+
invalidate(handler: any): void;
|
|
37
51
|
/**
|
|
38
52
|
* Appel la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
|
|
39
53
|
*
|
|
@@ -13,6 +13,7 @@ export class PublisherProxy {
|
|
|
13
13
|
constructor(target, parentProxPub = null) {
|
|
14
14
|
this._proxies_ = new Map();
|
|
15
15
|
this._value_ = target;
|
|
16
|
+
this._invalidateListeners_ = new Set();
|
|
16
17
|
this._assignListeners_ = new Set();
|
|
17
18
|
this._mutationListeners_ = new Set();
|
|
18
19
|
this._fillListeners_ = new Set();
|
|
@@ -32,6 +33,7 @@ export class PublisherProxy {
|
|
|
32
33
|
for (let proxy of this._proxies_.values()) {
|
|
33
34
|
proxy.delete();
|
|
34
35
|
}
|
|
36
|
+
this._invalidateListeners_.clear();
|
|
35
37
|
this._assignListeners_.clear();
|
|
36
38
|
this._mutationListeners_.clear();
|
|
37
39
|
this._fillListeners_.clear();
|
|
@@ -44,6 +46,7 @@ export class PublisherProxy {
|
|
|
44
46
|
hasListener() {
|
|
45
47
|
return (this._templateFillListeners_.size > 0 ||
|
|
46
48
|
this._assignListeners_.size > 0 ||
|
|
49
|
+
this._invalidateListeners_.size > 0 ||
|
|
47
50
|
this._mutationListeners_.size > 0 ||
|
|
48
51
|
this._fillListeners_.size > 0);
|
|
49
52
|
}
|
|
@@ -59,6 +62,9 @@ export class PublisherProxy {
|
|
|
59
62
|
this._assignListeners_.forEach((handler) => handler(this._value_.__value ? this._value_.__value : this._value_));
|
|
60
63
|
this._publishInternalMutation_(lockInternalMutationsTransmission);
|
|
61
64
|
}
|
|
65
|
+
_publishInvalidation_() {
|
|
66
|
+
this._invalidateListeners_.forEach((handler) => handler());
|
|
67
|
+
}
|
|
62
68
|
_publishDynamicFilling_(key, value) {
|
|
63
69
|
this._fillListeners_.forEach((handler) => {
|
|
64
70
|
if (handler[key] !== value)
|
|
@@ -95,6 +101,26 @@ export class PublisherProxy {
|
|
|
95
101
|
offAssign(handler) {
|
|
96
102
|
this._assignListeners_.delete(handler);
|
|
97
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Appel la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
|
|
106
|
+
*/
|
|
107
|
+
onInvalidate(handler) {
|
|
108
|
+
if (typeof handler != "function")
|
|
109
|
+
return;
|
|
110
|
+
this._invalidateListeners_.add(handler);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Stop les appels de la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
|
|
114
|
+
*/
|
|
115
|
+
offInvalidate(handler) {
|
|
116
|
+
this._invalidateListeners_.delete(handler);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Flag les données comme étant invalides
|
|
120
|
+
*/
|
|
121
|
+
invalidate(handler) {
|
|
122
|
+
this._publishInvalidation_();
|
|
123
|
+
}
|
|
98
124
|
/**
|
|
99
125
|
* Appel la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
|
|
100
126
|
*
|
|
@@ -194,8 +220,8 @@ export class PublisherProxy {
|
|
|
194
220
|
* Extraire la valeur actuelle du proxy
|
|
195
221
|
*/
|
|
196
222
|
get() {
|
|
197
|
-
if (this._value_.__value)
|
|
198
|
-
return this._value_.__value;
|
|
223
|
+
if (this._value_.hasOwnProperty("__value"))
|
|
224
|
+
return this._value_.__value || null;
|
|
199
225
|
return this._value_;
|
|
200
226
|
}
|
|
201
227
|
}
|
|
@@ -274,6 +300,9 @@ export default class Publisher extends PublisherProxy {
|
|
|
274
300
|
*/
|
|
275
301
|
get: function (oTarget, sKey) {
|
|
276
302
|
if ([
|
|
303
|
+
"invalidate",
|
|
304
|
+
"onInvalidate",
|
|
305
|
+
"offInvalidate",
|
|
277
306
|
"onAssign",
|
|
278
307
|
"offAssign",
|
|
279
308
|
"startDynamicFilling",
|
|
@@ -287,11 +316,13 @@ export default class Publisher extends PublisherProxy {
|
|
|
287
316
|
"_templateFillListeners_",
|
|
288
317
|
"_fillListeners_",
|
|
289
318
|
"_assignListeners_",
|
|
319
|
+
"_invalidateListeners_",
|
|
290
320
|
"_publishInternalMutation_",
|
|
291
321
|
"hasListener",
|
|
292
322
|
"delete",
|
|
293
323
|
"_mutationListeners_",
|
|
294
324
|
"_publishDynamicFilling_",
|
|
325
|
+
"_publishInvalidation_",
|
|
295
326
|
"_publishTemplateFilling_",
|
|
296
327
|
"_publishAssignement_",
|
|
297
328
|
"_proxies_",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supersoniks/concorde",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"customElements": "custom-elements.json",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -125,8 +125,12 @@
|
|
|
125
125
|
"./ui/theme": "./core/components/ui/theme/theme",
|
|
126
126
|
"./core/components/ui/toast/message-subscriber": "./core/components/ui/toast/message-subscriber",
|
|
127
127
|
"./ui/toast/message-subscriber": "./core/components/ui/toast/message-subscriber",
|
|
128
|
+
"./core/components/ui/toast/toast-item": "./core/components/ui/toast/toast-item",
|
|
129
|
+
"./ui/toast/toast-item": "./core/components/ui/toast/toast-item",
|
|
128
130
|
"./core/components/ui/toast/toast": "./core/components/ui/toast/toast",
|
|
129
131
|
"./ui/toast": "./core/components/ui/toast/toast",
|
|
132
|
+
"./core/components/ui/toast/types": "./core/components/ui/toast/types",
|
|
133
|
+
"./ui/toast/types": "./core/components/ui/toast/types",
|
|
130
134
|
"./core/components/ui/tooltip/tooltip": "./core/components/ui/tooltip/tooltip",
|
|
131
135
|
"./ui/tooltip": "./core/components/ui/tooltip/tooltip",
|
|
132
136
|
"./core/components/ui/ui": "./core/components/ui/ui",
|
|
@@ -165,7 +169,5 @@
|
|
|
165
169
|
"./utils/api": "./core/utils/api",
|
|
166
170
|
"./index": "./index"
|
|
167
171
|
},
|
|
168
|
-
"bin":
|
|
169
|
-
"concorde": "./cli.js"
|
|
170
|
-
}
|
|
172
|
+
"bin": "./bin/cli.js"
|
|
171
173
|
}
|