@warp-ds/elements 2.1.1 → 2.2.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -1
- package/dist/index.js +144 -216
- package/dist/index.js.map +4 -4
- package/dist/packages/modal/index.js +31 -25
- package/dist/packages/modal/index.js.map +3 -3
- package/dist/packages/modal/modal-header.d.ts +1 -1
- package/dist/packages/modal/modal-main.d.ts +4 -4
- package/package.json +1 -4
- package/dist/packages/broadcast/component.d.ts +0 -36
- package/dist/packages/broadcast/index.d.ts +0 -2
- package/dist/packages/broadcast/index.js +0 -87
- package/dist/packages/broadcast/index.js.map +0 -7
|
@@ -23,9 +23,9 @@ export class ModalHeader extends ModalHeader_base {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
static styles: any[];
|
|
26
|
-
titleEl: import("lit/directives/ref").Ref<Element>;
|
|
27
26
|
_hasTopContent: boolean;
|
|
28
27
|
render(): import("lit").TemplateResult<1>;
|
|
28
|
+
get titleEl(): any;
|
|
29
29
|
willUpdate(changedProperties: any): Promise<void>;
|
|
30
30
|
get titleClasses(): string;
|
|
31
31
|
get backButton(): typeof nothing | import("lit").TemplateResult<1>;
|
|
@@ -18,9 +18,6 @@ export class ModalMain extends ModalMain_base {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
static styles: any[];
|
|
21
|
-
dialogEl: import("lit/directives/ref.js").Ref<Element>;
|
|
22
|
-
dialogInnerEl: import("lit/directives/ref.js").Ref<Element>;
|
|
23
|
-
contentEl: import("lit/directives/ref.js").Ref<Element>;
|
|
24
21
|
/** @param {KeyboardEvent} evt */
|
|
25
22
|
interceptEscape(evt: KeyboardEvent): void;
|
|
26
23
|
/** @param {MouseEvent} evt */
|
|
@@ -31,7 +28,10 @@ export class ModalMain extends ModalMain_base {
|
|
|
31
28
|
open(): Promise<void>;
|
|
32
29
|
close(): void;
|
|
33
30
|
render(): import("lit").TemplateResult<1>;
|
|
34
|
-
|
|
31
|
+
get dialogEl(): any;
|
|
32
|
+
get dialogInnerEl(): any;
|
|
33
|
+
get contentEl(): any;
|
|
34
|
+
updated(changedProperties: any): void;
|
|
35
35
|
handleListeners(verb?: string): void;
|
|
36
36
|
}
|
|
37
37
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-ds/elements",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0-next.2",
|
|
5
5
|
"description": "Custom elements for Warp",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.js",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"./components/badge": "./dist/packages/badge/index.js",
|
|
12
12
|
"./components/box": "./dist/packages/box/index.js",
|
|
13
13
|
"./components/breadcrumbs": "./dist/packages/breadcrumbs/index.js",
|
|
14
|
-
"./components/broadcast": "./dist/packages/broadcast/index.js",
|
|
15
14
|
"./components/button": "./dist/packages/button/index.js",
|
|
16
15
|
"./components/card": "./dist/packages/card/index.js",
|
|
17
16
|
"./components/expandable": "./dist/packages/expandable/index.js",
|
|
@@ -40,8 +39,6 @@
|
|
|
40
39
|
"messages:extract": "lingui extract",
|
|
41
40
|
"preview:docs": "vite preview",
|
|
42
41
|
"semantic-release": "semantic-release",
|
|
43
|
-
"test:mock-backend:ci": "node ./tests/utils/broadcast-backend.js &",
|
|
44
|
-
"test:mock-backend": "node ./tests/utils/broadcast-backend.js",
|
|
45
42
|
"test:snapshot": "TAP_SNAPSHOT=1 tap ./packages/**/test.js --no-check-coverage",
|
|
46
43
|
"test": "tap ./packages/**/test.js --no-check-coverage",
|
|
47
44
|
"watch:npm": "npx esbuild ./index.js --outdir=dist/ --target=es2017 --bundle --sourcemap --format=esm --minify --watch"
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export class WarpBroadcast {
|
|
2
|
-
static properties: {
|
|
3
|
-
_messages: {
|
|
4
|
-
state: boolean;
|
|
5
|
-
hasChanged(newVal: any, oldVal: any): boolean;
|
|
6
|
-
};
|
|
7
|
-
_hiddenMessageIds: {
|
|
8
|
-
state: boolean;
|
|
9
|
-
type: ArrayConstructor;
|
|
10
|
-
};
|
|
11
|
-
interval: {
|
|
12
|
-
type: NumberConstructor;
|
|
13
|
-
attribute: boolean;
|
|
14
|
-
reflect: boolean;
|
|
15
|
-
};
|
|
16
|
-
url: {
|
|
17
|
-
type: StringConstructor;
|
|
18
|
-
attribute: boolean;
|
|
19
|
-
reflect: boolean;
|
|
20
|
-
};
|
|
21
|
-
api: {
|
|
22
|
-
type: StringConstructor;
|
|
23
|
-
attribute: boolean;
|
|
24
|
-
reflect: boolean;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
static styles: any[];
|
|
28
|
-
_messages: any[];
|
|
29
|
-
interval: number;
|
|
30
|
-
_hiddenMessageIds: any[];
|
|
31
|
-
url: string;
|
|
32
|
-
connectedCallback(): Promise<void>;
|
|
33
|
-
_fetchMessage(): Promise<void>;
|
|
34
|
-
_del(id: any): Promise<void>;
|
|
35
|
-
render(): import("lit").TemplateResult<1>;
|
|
36
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
|
|
5
|
-
// packages/broadcast/component.js
|
|
6
|
-
import { html } from "lit";
|
|
7
|
-
import WarpElement from "@warp-ds/elements-core";
|
|
8
|
-
import { repeat } from "lit/directives/repeat.js";
|
|
9
|
-
|
|
10
|
-
// packages/utils/window-exists.js
|
|
11
|
-
var windowExists = typeof window !== "undefined";
|
|
12
|
-
|
|
13
|
-
// packages/broadcast/component.js
|
|
14
|
-
var WarpBroadcast = class extends WarpElement {
|
|
15
|
-
constructor() {
|
|
16
|
-
super();
|
|
17
|
-
this._messages = [];
|
|
18
|
-
this.interval = 3e4;
|
|
19
|
-
this._hiddenMessageIds = [];
|
|
20
|
-
this.url = windowExists ? window.location.href : "";
|
|
21
|
-
}
|
|
22
|
-
async connectedCallback() {
|
|
23
|
-
super.connectedCallback();
|
|
24
|
-
if (!this.api) {
|
|
25
|
-
console.error('Broadcast "api" attribute invalid or undefined');
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (windowExists) {
|
|
29
|
-
await this._fetchMessage();
|
|
30
|
-
setInterval(() => this._fetchMessage(), this.interval);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async _fetchMessage() {
|
|
34
|
-
const url = `${this.api}?path=${this.url}`;
|
|
35
|
-
try {
|
|
36
|
-
const res = await (await fetch(url)).json();
|
|
37
|
-
this._messages = res.length ? res : [];
|
|
38
|
-
} catch (err) {
|
|
39
|
-
console.error(`failed to fetch broadcasts from given url (${url})`, err);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async _del(id) {
|
|
43
|
-
const el = this.renderRoot.querySelector(`#broadcast-${id}`);
|
|
44
|
-
await el.collapse();
|
|
45
|
-
this._hiddenMessageIds = [.../* @__PURE__ */ new Set([...this._hiddenMessageIds, id])];
|
|
46
|
-
}
|
|
47
|
-
render() {
|
|
48
|
-
const messages = this._messages.filter((item) => !this._hiddenMessageIds.includes(item.id));
|
|
49
|
-
return html`
|
|
50
|
-
<aside class=${`${messages.length === 0 ? "hidden" : "mb-16"}`}>
|
|
51
|
-
${repeat(
|
|
52
|
-
messages,
|
|
53
|
-
({ id }) => `broadcast-${id}`,
|
|
54
|
-
({ id, message }) => html`<w-toast id="broadcast-${id}" type="warning" text="${message}" canclose @close=${() => this._del(id)}> </w-toast>`
|
|
55
|
-
)}
|
|
56
|
-
</aside>
|
|
57
|
-
`;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
__publicField(WarpBroadcast, "properties", {
|
|
61
|
-
_messages: {
|
|
62
|
-
state: true,
|
|
63
|
-
hasChanged(newVal, oldVal) {
|
|
64
|
-
if (!oldVal || oldVal.length === 0) return true;
|
|
65
|
-
const newIds = newVal.map(({ id }) => id).sort();
|
|
66
|
-
const oldIds = oldVal.map(({ id }) => id).sort();
|
|
67
|
-
return JSON.stringify(newIds) !== JSON.stringify(oldIds);
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
_hiddenMessageIds: {
|
|
71
|
-
state: true,
|
|
72
|
-
type: Array
|
|
73
|
-
},
|
|
74
|
-
interval: { type: Number, attribute: true, reflect: true },
|
|
75
|
-
url: { type: String, attribute: true, reflect: true },
|
|
76
|
-
api: { type: String, attribute: true, reflect: true }
|
|
77
|
-
});
|
|
78
|
-
__publicField(WarpBroadcast, "styles", [WarpElement.styles]);
|
|
79
|
-
|
|
80
|
-
// packages/broadcast/index.js
|
|
81
|
-
if (!customElements.get("w-broadcast")) {
|
|
82
|
-
customElements.define("w-broadcast", WarpBroadcast);
|
|
83
|
-
}
|
|
84
|
-
export {
|
|
85
|
-
WarpBroadcast
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/broadcast/component.js", "../../../packages/utils/window-exists.js", "../../../packages/broadcast/index.js"],
|
|
4
|
-
"sourcesContent": ["import { html } from 'lit';\n\nimport WarpElement from '@warp-ds/elements-core';\nimport { repeat } from 'lit/directives/repeat.js';\n\nimport { windowExists } from '../utils/window-exists';\n\nexport class WarpBroadcast extends WarpElement {\n static properties = {\n _messages: {\n state: true,\n hasChanged(newVal, oldVal) {\n if (!oldVal || oldVal.length === 0) return true;\n const newIds = newVal.map(({ id }) => id).sort();\n const oldIds = oldVal.map(({ id }) => id).sort();\n return JSON.stringify(newIds) !== JSON.stringify(oldIds);\n },\n },\n _hiddenMessageIds: {\n state: true,\n type: Array,\n },\n interval: { type: Number, attribute: true, reflect: true },\n url: { type: String, attribute: true, reflect: true },\n api: { type: String, attribute: true, reflect: true },\n };\n\n static styles = [WarpElement.styles];\n\n constructor() {\n super();\n this._messages = [];\n this.interval = 30000;\n this._hiddenMessageIds = [];\n this.url = windowExists ? window.location.href : '';\n }\n\n async connectedCallback() {\n super.connectedCallback();\n if (!this.api) {\n console.error('Broadcast \"api\" attribute invalid or undefined');\n return;\n }\n if (windowExists) {\n await this._fetchMessage();\n setInterval(() => this._fetchMessage(), this.interval);\n }\n }\n\n async _fetchMessage() {\n const url = `${this.api}?path=${this.url}`;\n try {\n const res = await (await fetch(url)).json();\n this._messages = res.length ? res : [];\n } catch (err) {\n console.error(`failed to fetch broadcasts from given url (${url})`, err);\n }\n }\n\n async _del(id) {\n const el = this.renderRoot.querySelector(`#broadcast-${id}`);\n await el.collapse();\n this._hiddenMessageIds = [...new Set([...this._hiddenMessageIds, id])];\n }\n\n render() {\n const messages = this._messages.filter((item) => !this._hiddenMessageIds.includes(item.id));\n\n return html`\n <aside class=${`${messages.length === 0 ? 'hidden' : 'mb-16'}`}>\n ${repeat(\n messages,\n ({ id }) => `broadcast-${id}`,\n ({ id, message }) =>\n html`<w-toast id=\"broadcast-${id}\" type=\"warning\" text=\"${message}\" canclose @close=${() => this._del(id)}> </w-toast>`,\n )}\n </aside>\n `;\n }\n}\n", "export const windowExists = typeof window !== 'undefined';\n", "import { WarpBroadcast } from './component';\n\nif (!customElements.get('w-broadcast')) {\n customElements.define('w-broadcast', WarpBroadcast);\n}\n\nexport { WarpBroadcast };\n"],
|
|
5
|
-
"mappings": ";;;;;AAAA,SAAS,YAAY;AAErB,OAAO,iBAAiB;AACxB,SAAS,cAAc;;;ACHhB,IAAM,eAAe,OAAO,WAAW;;;ADOvC,IAAM,gBAAN,cAA4B,YAAY;AAAA,EAsB7C,cAAc;AACZ,UAAM;AACN,SAAK,YAAY,CAAC;AAClB,SAAK,WAA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