@proximus/lavender-skeleton 2.0.0-alpha.2 → 2.0.0-alpha.200

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.
@@ -10,8 +10,8 @@ export declare class Skeleton extends PxElement<HTMLDivElement> {
10
10
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
11
11
  updateVariant(variant: string): void;
12
12
  get $container(): Container;
13
- get variant(): string;
14
- set variant(value: string);
13
+ get variant(): string | null;
14
+ set variant(value: string | null);
15
15
  get inverted(): boolean;
16
16
  set inverted(value: boolean);
17
17
  }
@@ -0,0 +1,131 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/Skeleton.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "skeletonsVariantValues",
12
+ "type": {
13
+ "text": "array"
14
+ },
15
+ "default": "[ 'heading-s', 'heading-m', 'heading-l', 'body', 'body-block', 'action-s', 'action-l', 'asset-s', 'asset-l', 'panel', ]"
16
+ },
17
+ {
18
+ "kind": "class",
19
+ "description": "",
20
+ "name": "Skeleton",
21
+ "members": [
22
+ {
23
+ "kind": "field",
24
+ "name": "nativeName",
25
+ "type": {
26
+ "text": "string"
27
+ },
28
+ "static": true,
29
+ "default": "'div'"
30
+ },
31
+ {
32
+ "kind": "field",
33
+ "name": "template",
34
+ "privacy": "private"
35
+ },
36
+ {
37
+ "kind": "method",
38
+ "name": "updateVariant",
39
+ "parameters": [
40
+ {
41
+ "name": "variant",
42
+ "type": {
43
+ "text": "string"
44
+ }
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ "kind": "field",
50
+ "name": "$container",
51
+ "readonly": true
52
+ },
53
+ {
54
+ "kind": "field",
55
+ "name": "variant"
56
+ },
57
+ {
58
+ "kind": "field",
59
+ "name": "inverted"
60
+ },
61
+ {
62
+ "kind": "field",
63
+ "name": "innerHTML"
64
+ }
65
+ ],
66
+ "attributes": [
67
+ {
68
+ "name": "variant"
69
+ },
70
+ {
71
+ "name": "inverted"
72
+ }
73
+ ],
74
+ "superclass": {
75
+ "name": "PxElement",
76
+ "package": "@proximus/lavender-common"
77
+ },
78
+ "tagName": "px-skeleton",
79
+ "customElement": true
80
+ }
81
+ ],
82
+ "exports": [
83
+ {
84
+ "kind": "js",
85
+ "name": "skeletonsVariantValues",
86
+ "declaration": {
87
+ "name": "skeletonsVariantValues",
88
+ "module": "src/Skeleton.ts"
89
+ }
90
+ },
91
+ {
92
+ "kind": "js",
93
+ "name": "Skeleton",
94
+ "declaration": {
95
+ "name": "Skeleton",
96
+ "module": "src/Skeleton.ts"
97
+ }
98
+ },
99
+ {
100
+ "kind": "custom-element-definition",
101
+ "name": "px-skeleton",
102
+ "declaration": {
103
+ "name": "Skeleton",
104
+ "module": "src/Skeleton.ts"
105
+ }
106
+ }
107
+ ]
108
+ },
109
+ {
110
+ "kind": "javascript-module",
111
+ "path": "src/index.ts",
112
+ "declarations": [],
113
+ "exports": [
114
+ {
115
+ "kind": "js",
116
+ "name": "*",
117
+ "declaration": {
118
+ "name": "*",
119
+ "module": "src/Skeleton"
120
+ }
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ "kind": "javascript-module",
126
+ "path": "src/skeleton.css",
127
+ "declarations": [],
128
+ "exports": []
129
+ }
130
+ ]
131
+ }
package/dist/index.es.js CHANGED
@@ -1,82 +1,70 @@
1
- import { PxElement as l } from "@proximus/lavender-common";
2
- const d = ":host,:host>*{display:block;box-sizing:border-box}.skeleton-wrapper{display:flex;min-width:40px;flex-direction:column;align-items:flex-start;gap:10px;min-height:16px}.skeleton{border-radius:var(--px-radius-main);background-color:var(--px-color-background-state-disabled-default);align-self:stretch;height:16px;background-image:linear-gradient(-80deg,#0000,#0000 25%,#ffffff3d,#ffffff3d 55%,#0000 75%,#0000);background-size:200% 100%;animation:skeletonLoading 1.5s ease-in-out infinite}[inverted] .skeleton{background-color:var(--px-color-background-state-disabled-inverted);background-image:linear-gradient(-80deg,#fff0,#fff0 25%,#0000001a,#0000001a 55%,#fff0 75%,#fff0)}.skeleton.heading-s,.skeleton.heading-m,.skeleton.heading-l{max-width:240px}.skeleton.heading-s{height:24px}.skeleton.heading-m{height:32px}.skeleton.heading-l{height:40px}.skeleton.body,.skeleton.body-block{width:300px}.skeleton.body,.skeleton.body-block{height:16px}.skeleton.body-block:nth-of-type(3){width:180px}.skeleton.action-s,.skeleton.action-l{height:40px;border-radius:var(--px-radius-pill)}.skeleton.action-s{width:40px}.skeleton.action-l{width:160px}.skeleton.asset-s{width:40px;height:40px}.skeleton.asset-l{width:80px;height:80px}.skeleton.panel{width:300px;height:200px}@keyframes skeletonLoading{0%{background-position-x:150%}40%{background-position-x:-50%}to{background-position-x:-50%}}", a = new CSSStyleSheet();
3
- a.replaceSync(d);
4
- const h = [
5
- "heading-s",
6
- "heading-m",
7
- "heading-l",
8
- "body",
9
- "body-block",
10
- "action-s",
11
- "action-l",
12
- "asset-s",
13
- "asset-l",
14
- "panel"
15
- ], o = class o extends l {
16
- constructor() {
17
- super(a), this.template = () => `<div class="skeleton-wrapper">
18
- <div class="skeleton" aria-hidden="true"></div>
19
- <slot name="skeleton-text"></slot>
20
- </div>`, this.shadowRoot.innerHTML = this.template();
21
- }
22
- static get observedAttributes() {
23
- return ["variant", "inverted"];
24
- }
25
- connectedCallback() {
26
- this.hasAttribute("variant") || this.setAttribute("variant", "body");
27
- const e = this.shadowRoot.querySelector(
28
- 'slot[name="skeleton-text"]'
29
- );
30
- e && e.assignedNodes().length === 0 && console.error(
31
- 'The "skeleton-text" slot cannot be empty for accessibility. This text will only be visible to screen readers by adding `shown--sr` property to the slot.'
32
- );
33
- }
34
- attributeChangedCallback(e, n, t) {
35
- if (n !== t)
36
- switch (e) {
37
- case "variant":
38
- if (this.updateVariant(t), this.$el.querySelector(".skeleton").classList.toggle(`${t}`), t === "body-block") {
39
- const r = this.shadowRoot.querySelector(".skeleton-wrapper");
40
- Array.from({ length: 2 }, () => {
41
- const s = document.createElement("div");
42
- return s.className = "skeleton body-block", s.setAttribute("aria-hidden", "true"), s;
43
- }).forEach((s) => r.appendChild(s));
44
- }
45
- break;
46
- case "inverted":
47
- this.$el.toggleAttribute("inverted", t !== null);
48
- break;
49
- default:
50
- super.attributeChangedCallback(e, n, t);
51
- break;
52
- }
53
- }
54
- updateVariant(e) {
55
- if (!this.checkName(h, e)) {
56
- console.error(`${e} is not a valid variant value`);
57
- return;
58
- }
59
- }
60
- get $container() {
61
- return this.shadowRoot.querySelector("px-container");
62
- }
63
- get variant() {
64
- return this.getAttribute("variant");
65
- }
66
- set variant(e) {
67
- this.setAttribute("variant", e);
68
- }
69
- get inverted() {
70
- return this.hasAttribute("inverted");
71
- }
72
- set inverted(e) {
73
- e ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
74
- }
75
- };
76
- o.nativeName = "div";
77
- let i = o;
78
- customElements.get("px-skeleton") || customElements.define("px-skeleton", i);
79
- export {
80
- i as Skeleton,
81
- h as skeletonsVariantValues
1
+ import { PxElement as e, log as t } from "@proximus/lavender-common";
2
+ //#region src/skeleton.css?inline
3
+ var n = ":host,:host>*{box-sizing:border-box;display:block}.skeleton-wrapper{flex-direction:column;align-items:flex-start;gap:10px;min-width:40px;min-height:16px;display:flex}.skeleton{border-radius:var(--px-radius-main);background-color:var(--px-color-background-state-disabled-default);background-image:linear-gradient(-80deg,#0000 0% 25%,#ffffff3d 40% 55%,#0000 75% 100%);background-size:200% 100%;align-self:stretch;height:16px;animation:1.5s ease-in-out infinite skeletonLoading}[inverted] .skeleton{background-color:var(--px-color-background-state-disabled-inverted);background-image:linear-gradient(-80deg,#fff0 0% 25%,#0000001a 40% 55%,#fff0 75% 100%)}.skeleton.heading-s,.skeleton.heading-m,.skeleton.heading-l{max-width:240px}.skeleton.heading-s{height:24px}.skeleton.heading-m{height:32px}.skeleton.heading-l{height:40px}.skeleton.body,.skeleton.body-block{width:300px}.skeleton.body{height:16px}.skeleton.body-block{height:16px}.skeleton.body-block:nth-of-type(3){width:180px}.skeleton.action-s,.skeleton.action-l{border-radius:var(--px-radius-pill);height:40px}.skeleton.action-s{width:40px}.skeleton.action-l{width:160px}.skeleton.asset-s{width:40px;height:40px}.skeleton.asset-l{width:80px;height:80px}.skeleton.panel{width:300px;height:200px}@keyframes skeletonLoading{0%{background-position-x:150%}40%{background-position-x:-50%}to{background-position-x:-50%}}", r = new CSSStyleSheet();
4
+ r.replaceSync(n);
5
+ var i = [
6
+ "heading-s",
7
+ "heading-m",
8
+ "heading-l",
9
+ "body",
10
+ "body-block",
11
+ "action-s",
12
+ "action-l",
13
+ "asset-s",
14
+ "asset-l",
15
+ "panel"
16
+ ], a = class extends e {
17
+ static {
18
+ this.nativeName = "div";
19
+ }
20
+ constructor() {
21
+ super(r), this.template = () => "<div class=\"skeleton-wrapper\">\n <div class=\"skeleton\" aria-hidden=\"true\"></div>\n <slot name=\"skeleton-text\"></slot>\n </div>", this.shadowRoot.innerHTML = this.template();
22
+ }
23
+ static get observedAttributes() {
24
+ return ["variant", "inverted"];
25
+ }
26
+ connectedCallback() {
27
+ this.hasAttribute("variant") || this.setAttribute("variant", "body");
28
+ }
29
+ attributeChangedCallback(e, t, n) {
30
+ if (t !== n) switch (e) {
31
+ case "variant":
32
+ if (this.updateVariant(n), this.$el?.querySelector(".skeleton")?.classList.toggle(`${n}`), n === "body-block") {
33
+ let e = this.shadowRoot.querySelector(".skeleton-wrapper");
34
+ Array.from({ length: 2 }, () => {
35
+ let e = document.createElement("div");
36
+ return e.className = "skeleton body-block", e.setAttribute("aria-hidden", "true"), e;
37
+ }).forEach((t) => e?.appendChild(t));
38
+ }
39
+ break;
40
+ case "inverted":
41
+ this.$el?.toggleAttribute("inverted", n !== null);
42
+ break;
43
+ default: super.attributeChangedCallback(e, t, n);
44
+ }
45
+ }
46
+ updateVariant(e) {
47
+ if (!this.checkName(i, e)) {
48
+ t(`"${e}" is not a valid variant value for ${this.tagName.toLowerCase()}. Allowed values are: "${i.join("\", \"")}".`);
49
+ return;
50
+ }
51
+ }
52
+ get $container() {
53
+ return this.shadowRoot.querySelector("px-container");
54
+ }
55
+ get variant() {
56
+ return this.getAttribute("variant");
57
+ }
58
+ set variant(e) {
59
+ this._updateAttribute("variant", e);
60
+ }
61
+ get inverted() {
62
+ return this.hasAttribute("inverted");
63
+ }
64
+ set inverted(e) {
65
+ this._updateBooleanAttribute("inverted", e);
66
+ }
82
67
  };
68
+ customElements.get("px-skeleton") || customElements.define("px-skeleton", a);
69
+ //#endregion
70
+ export { a as Skeleton, i as skeletonsVariantValues };
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "properties": [],
5
+ "pseudoElements": []
6
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "tags": [
5
+ {
6
+ "name": "px-skeleton",
7
+ "description": "\n---\n",
8
+ "attributes": [
9
+ { "name": "variant", "values": [] },
10
+ { "name": "inverted", "values": [] }
11
+ ],
12
+ "references": []
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
+ "name": "@proximus/lavender-skeleton",
4
+ "version": "2.0.0-alpha.200",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "px-skeleton",
11
+ "description": "\n---\n",
12
+ "doc-url": "",
13
+ "attributes": [
14
+ { "name": "variant", "value": { "type": "string" } },
15
+ { "name": "inverted", "value": { "type": "string" } }
16
+ ],
17
+ "events": [],
18
+ "js": {
19
+ "properties": [
20
+ { "name": "$container" },
21
+ { "name": "variant" },
22
+ { "name": "inverted" },
23
+ { "name": "innerHTML" }
24
+ ],
25
+ "events": []
26
+ }
27
+ }
28
+ ]
29
+ },
30
+ "css": {
31
+ "properties": [],
32
+ "pseudo-elements": []
33
+ }
34
+ }
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-skeleton",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.200",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "clean": "rm -rf dist",
14
14
  "build": "npm run clean && NODE_ENV=development vite build && tsc && npm run transform-package-json && npm run wc-manifest",
15
15
  "test": "vitest run --coverage",
16
- "wc-manifest": "cem analyze --globs \"src/*\" --config ../custom-elements-manifest.config.js --outdir dist"
16
+ "wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
17
17
  },
18
18
  "publishConfig": {
19
19
  "access": "public"