@alegendstale/holly-components 2.0.9 → 2.0.10
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/custom-elements.json +1926 -927
- package/dist/components/responsive-svg/responsive-svg.d.ts +4 -4
- package/dist/components/responsive-svg/responsive-svg.d.ts.map +1 -1
- package/dist/components/responsive-svg/responsive-svg.js +68 -67
- package/dist/controllers/ResponsiveController.d.ts.map +1 -0
- package/dist/controllers/StyleController.d.ts +12 -0
- package/dist/controllers/StyleController.d.ts.map +1 -0
- package/dist/controllers/StyleController.js +20 -0
- package/dist/decorators/ExposeParts.d.ts +6 -0
- package/dist/decorators/ExposeParts.d.ts.map +1 -0
- package/dist/decorators/ExposeParts.js +39 -0
- package/dist/node_modules/style-observer/src/element-style-observer.js +214 -0
- package/dist/node_modules/style-observer/src/rendered-observer.js +46 -0
- package/dist/node_modules/style-observer/src/style-observer.js +98 -0
- package/dist/node_modules/style-observer/src/util/Bug.js +36 -0
- package/dist/node_modules/style-observer/src/util/MultiWeakMap.js +20 -0
- package/dist/node_modules/style-observer/src/util/adopt-css.js +15 -0
- package/dist/node_modules/style-observer/src/util/bugs/adopted-style-sheet.js +28 -0
- package/dist/node_modules/style-observer/src/util/bugs/transitionrun-loop.js +15 -0
- package/dist/node_modules/style-observer/src/util/bugs/unregistered-transition.js +14 -0
- package/dist/node_modules/style-observer/src/util/gentle-register-property.js +41 -0
- package/dist/node_modules/style-observer/src/util/is-registered-property.js +15 -0
- package/dist/node_modules/style-observer/src/util.js +61 -0
- package/package.json +15 -5
- package/dist/utils/ResponsiveController.d.ts.map +0 -1
- /package/dist/{utils → controllers}/ResponsiveController.d.ts +0 -0
- /package/dist/{utils → controllers}/ResponsiveController.js +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class t {
|
|
2
|
+
constructor({ name: e, initialValue: i, detect: s }) {
|
|
3
|
+
this.name = e, this.initialValue = i ?? !0, this.detect = s, t.all[e] = this, Object.defineProperty(t, e, {
|
|
4
|
+
get() {
|
|
5
|
+
return this.all[e].value;
|
|
6
|
+
},
|
|
7
|
+
configurable: !0,
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
#t;
|
|
12
|
+
#e;
|
|
13
|
+
/**
|
|
14
|
+
* Get whether the bug is present or not, or a promise that will resolve to this value when detection is complete.
|
|
15
|
+
*/
|
|
16
|
+
get valuePending() {
|
|
17
|
+
return this.#t !== void 0 ? this.#t : this.#e !== void 0 ? this.#e : (this.#e = this.detect(), this.#e instanceof Promise ? this.#e.then((e) => this.#t = e) : this.#t = this.#e, this.#e);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Synchronously get either whether the bug is present (if already detected or detection is sync)
|
|
21
|
+
* or kick off detection and return the initial value if detection is async
|
|
22
|
+
*/
|
|
23
|
+
get value() {
|
|
24
|
+
if (this.#t !== void 0)
|
|
25
|
+
return this.#t;
|
|
26
|
+
let e = this.valuePending;
|
|
27
|
+
return e instanceof Promise ? this.initialValue : e;
|
|
28
|
+
}
|
|
29
|
+
static all = {};
|
|
30
|
+
static detectAll() {
|
|
31
|
+
return Promise.all(Object.values(t.all).map((e) => e.valuePending));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
t as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class r extends WeakMap {
|
|
2
|
+
has(e, s) {
|
|
3
|
+
return arguments.length === 1 ? super.has(e) : super.get(e)?.has(s) || !1;
|
|
4
|
+
}
|
|
5
|
+
add(e, s) {
|
|
6
|
+
let t = super.get(e) ?? /* @__PURE__ */ new Set();
|
|
7
|
+
t.add(s), super.set(e, t);
|
|
8
|
+
}
|
|
9
|
+
delete(e, ...s) {
|
|
10
|
+
let t = super.get(e);
|
|
11
|
+
if (t) {
|
|
12
|
+
for (let a of s)
|
|
13
|
+
t.delete(a);
|
|
14
|
+
t.size === 0 && super.delete(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
r as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
let d = /* @__PURE__ */ new WeakMap();
|
|
2
|
+
function n(l, e = globalThis.document) {
|
|
3
|
+
e = e.ownerDocument ?? e;
|
|
4
|
+
let a = e.defaultView;
|
|
5
|
+
if (e.adoptedStyleSheets) {
|
|
6
|
+
let t = new a.CSSStyleSheet();
|
|
7
|
+
return t.replaceSync(l), Object.isFrozen(e.adoptedStyleSheets) ? e.adoptedStyleSheets = [...e.adoptedStyleSheets, t] : e.adoptedStyleSheets.push(t), t;
|
|
8
|
+
} else {
|
|
9
|
+
let t = d.get(e);
|
|
10
|
+
return t || (t = e.head.appendChild(e.createElement("style")), d.set(e, t)), t.insertAdjacentText("beforeend", l), t.sheet;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
n as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import d from "../gentle-register-property.js";
|
|
2
|
+
import a from "../Bug.js";
|
|
3
|
+
new a({
|
|
4
|
+
name: "ADOPTED_STYLE_SHEET",
|
|
5
|
+
detect() {
|
|
6
|
+
let e = document.createElement("div");
|
|
7
|
+
if (document.body.append(e), e.attachShadow({ mode: "open" }), Object.isFrozen(e.shadowRoot.adoptedStyleSheets))
|
|
8
|
+
return e.remove(), !1;
|
|
9
|
+
d("--style-observer-adopted-style-sheet-bug", {
|
|
10
|
+
syntax: "<number>",
|
|
11
|
+
inherits: !0,
|
|
12
|
+
initialValue: 0
|
|
13
|
+
});
|
|
14
|
+
let t = new CSSStyleSheet();
|
|
15
|
+
t.insertRule(`
|
|
16
|
+
:host {
|
|
17
|
+
/* This declaration shouldn't be empty for the bug to trigger */
|
|
18
|
+
color: transparent;
|
|
19
|
+
}
|
|
20
|
+
`), e.shadowRoot.adoptedStyleSheets.push(t);
|
|
21
|
+
let r = t.cssRules[0].style;
|
|
22
|
+
r.setProperty("--style-observer-adopted-style-sheet-bug", "1");
|
|
23
|
+
let o = getComputedStyle(e), s = o.getPropertyValue("--style-observer-adopted-style-sheet-bug");
|
|
24
|
+
r.removeProperty("--style-observer-adopted-style-sheet-bug"), o = getComputedStyle(e);
|
|
25
|
+
let l = o.getPropertyValue("--style-observer-adopted-style-sheet-bug");
|
|
26
|
+
return e.remove(), s === l;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import s from "../Bug.js";
|
|
2
|
+
new s({
|
|
3
|
+
name: "TRANSITIONRUN_EVENT_LOOP",
|
|
4
|
+
detect() {
|
|
5
|
+
let e = document.createElement("div");
|
|
6
|
+
document.body.appendChild(e);
|
|
7
|
+
let t = "--bar-" + Date.now();
|
|
8
|
+
return e.style.cssText = `${t}: 1; transition: ${t} 1ms step-start allow-discrete`, new Promise((r) => {
|
|
9
|
+
let n = 0;
|
|
10
|
+
requestAnimationFrame(() => {
|
|
11
|
+
setTimeout((o) => r(n > 1), 50), e.addEventListener("transitionrun", (o) => n++), e.style.setProperty(t, "2");
|
|
12
|
+
});
|
|
13
|
+
}).finally(() => e.remove());
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import o from "../Bug.js";
|
|
2
|
+
new o({
|
|
3
|
+
name: "UNREGISTERED_TRANSITION",
|
|
4
|
+
detect() {
|
|
5
|
+
let e = document.createElement("div");
|
|
6
|
+
document.body.appendChild(e);
|
|
7
|
+
let t = "--foo-" + Date.now();
|
|
8
|
+
return e.style.cssText = `${t}: 1; transition: ${t} 1ms step-start allow-discrete`, new Promise((r) => {
|
|
9
|
+
requestAnimationFrame(() => {
|
|
10
|
+
setTimeout((n) => r(!0), 30), e.addEventListener("transitionstart", (n) => r(!1)), e.style.setProperty(t, "2");
|
|
11
|
+
});
|
|
12
|
+
}).finally(() => e.remove());
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import u from "./adopt-css.js";
|
|
2
|
+
import g from "./is-registered-property.js";
|
|
3
|
+
const s = {
|
|
4
|
+
"<angle>": "0deg",
|
|
5
|
+
"<color>": "transparent",
|
|
6
|
+
"<custom-ident>": "none",
|
|
7
|
+
"<image>": "linear-gradient(transparent 0% 100%)",
|
|
8
|
+
"<integer>": "0",
|
|
9
|
+
"<length>": "0px",
|
|
10
|
+
"<length-percentage>": "0px",
|
|
11
|
+
"<number>": "0",
|
|
12
|
+
"<percentage>": "0%",
|
|
13
|
+
"<resolution>": "1dppx",
|
|
14
|
+
"<string>": "''",
|
|
15
|
+
"<time>": "0s",
|
|
16
|
+
"<transform-function>": "scale(1)",
|
|
17
|
+
"<transform-list>": "scale(1)",
|
|
18
|
+
"<url>": "url('')"
|
|
19
|
+
};
|
|
20
|
+
let a = /* @__PURE__ */ new Map();
|
|
21
|
+
function f(t, n = {}, r = globalThis.document) {
|
|
22
|
+
let i = a.get(r);
|
|
23
|
+
if (!t.startsWith("--") || i && t in i || g(t, r))
|
|
24
|
+
return;
|
|
25
|
+
let e = {
|
|
26
|
+
syntax: n.syntax || "*",
|
|
27
|
+
inherits: n.inherits ?? !0
|
|
28
|
+
};
|
|
29
|
+
n.initialValue !== void 0 ? e.initialValue = n.initialValue : e.syntax !== "*" && e.syntax in s && (e.initialValue = s[e.syntax]);
|
|
30
|
+
let l = u(`@layer style-observer-registered-properties {
|
|
31
|
+
@property ${t} {
|
|
32
|
+
syntax: "${e.syntax}";
|
|
33
|
+
inherits: ${e.inherits};
|
|
34
|
+
${e.initialValue !== void 0 ? `initial-value: ${e.initialValue};` : ""}
|
|
35
|
+
}
|
|
36
|
+
}`, r);
|
|
37
|
+
i || (i = {}, a.set(r, i)), i[t] = l;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
f as default
|
|
41
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function n(t, l = globalThis.document) {
|
|
2
|
+
let e = l.createElement("div");
|
|
3
|
+
l.body.append(e);
|
|
4
|
+
let d = "foo(bar)";
|
|
5
|
+
e.style.setProperty(t, d);
|
|
6
|
+
let i = getComputedStyle(e).getPropertyValue(t), a = !0;
|
|
7
|
+
if (i === d) {
|
|
8
|
+
let r = e.appendChild(l.createElement("div"));
|
|
9
|
+
a = getComputedStyle(r).getPropertyValue(t) !== d;
|
|
10
|
+
}
|
|
11
|
+
return e.remove(), a;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
n as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function c(e) {
|
|
2
|
+
return e == null ? [] : Array.isArray(e) ? e : typeof e != "string" && typeof e[Symbol.iterator] == "function" ? Array.from(e) : [e];
|
|
3
|
+
}
|
|
4
|
+
function h(e) {
|
|
5
|
+
return e ? new Promise((t) => setTimeout(t, e)) : new Promise((t) => requestAnimationFrame(t));
|
|
6
|
+
}
|
|
7
|
+
let o;
|
|
8
|
+
function m(e) {
|
|
9
|
+
o ??= document.createElement("div");
|
|
10
|
+
let t = o.style;
|
|
11
|
+
t[e] = "inherit";
|
|
12
|
+
let n = [...t];
|
|
13
|
+
return n.length === 0 && (n = [e]), t.cssText = "", n;
|
|
14
|
+
}
|
|
15
|
+
function u(e) {
|
|
16
|
+
let t = e.matchAll(/(?:^|\s)([+-]?(?:\d+|\d*\.\d+))\s*(ms|s)?(?=\s|$)/g), n = [];
|
|
17
|
+
for (let r of t) {
|
|
18
|
+
let [, i, l] = r;
|
|
19
|
+
i = parseFloat(i), l === "s" && (i *= 1e3), n.push(i);
|
|
20
|
+
}
|
|
21
|
+
return n;
|
|
22
|
+
}
|
|
23
|
+
function d(e, t) {
|
|
24
|
+
t = a(t);
|
|
25
|
+
let n;
|
|
26
|
+
if (e === "all")
|
|
27
|
+
n = /\b\w+\b/g;
|
|
28
|
+
else {
|
|
29
|
+
let f = [.../* @__PURE__ */ new Set([...m(e), e, "all"])];
|
|
30
|
+
n = RegExp(`(?:^|\\s)(${f.join("|")})\\b`);
|
|
31
|
+
}
|
|
32
|
+
let r = t.findLast((f) => n.test(f)), i = r ? u(r) : [0, 0];
|
|
33
|
+
i.length === 0 ? i = [0, 0] : i.length === 1 && i.push(0);
|
|
34
|
+
let [l, s] = i;
|
|
35
|
+
return { duration: l, delay: s };
|
|
36
|
+
}
|
|
37
|
+
function a(e) {
|
|
38
|
+
let t = [], n = 0, r = [];
|
|
39
|
+
for (let i of e.matchAll(/[,()]/g)) {
|
|
40
|
+
let l = i[0];
|
|
41
|
+
if (l === ",") {
|
|
42
|
+
if (r.length === 0) {
|
|
43
|
+
let s = e.slice(n, i.index);
|
|
44
|
+
t.push(s.trim()), n = i.index + 1;
|
|
45
|
+
}
|
|
46
|
+
} else l === "(" ? r.push("(") : l === ")" && r.pop();
|
|
47
|
+
}
|
|
48
|
+
if (n < e.length) {
|
|
49
|
+
let i = e.slice(n);
|
|
50
|
+
t.push(i.trim());
|
|
51
|
+
}
|
|
52
|
+
return t;
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
m as getLonghands,
|
|
56
|
+
d as getTimesFor,
|
|
57
|
+
u as parseTimes,
|
|
58
|
+
a as splitCommas,
|
|
59
|
+
c as toArray,
|
|
60
|
+
h as wait
|
|
61
|
+
};
|
package/package.json
CHANGED
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@alegendstale/holly-components",
|
|
4
4
|
"description": "Reusable UI components created using lit",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.10",
|
|
6
6
|
"author": "ALegendsTale",
|
|
7
7
|
"license": "GPL-3.0",
|
|
8
8
|
"customElements": "custom-elements.json",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"exports": {
|
|
11
11
|
"./components": "./dist/components",
|
|
12
|
-
"./decorators": "./dist/decorators",
|
|
13
|
-
"./utils": "./dist/utils",
|
|
14
12
|
"./components/*.js": "./dist/components/*.js",
|
|
13
|
+
"./controllers": "./dist/controllers",
|
|
14
|
+
"./controllers/*.js": "./dist/controllers/*.js",
|
|
15
|
+
"./decorators": "./dist/decorators",
|
|
15
16
|
"./decorators/*.js": "./dist/decorators/*.js",
|
|
17
|
+
"./directives": "./dist/directives",
|
|
18
|
+
"./directives/*.js": "./dist/directives/*.js",
|
|
19
|
+
"./utils": "./dist/utils",
|
|
16
20
|
"./utils/*.js": "./dist/utils/*.js",
|
|
17
21
|
"./custom-elements.json": "./custom-elements.json",
|
|
18
22
|
"./package.json": "./package.json"
|
|
@@ -32,7 +36,11 @@
|
|
|
32
36
|
"build": "vite build && npm run build:types && npm run cem",
|
|
33
37
|
"build:types": "tsc -p tsconfig.prod.json",
|
|
34
38
|
"cem": "cem analyze --litelement",
|
|
35
|
-
"storybook": "storybook dev -p 6006"
|
|
39
|
+
"storybook": "storybook dev -p 6006",
|
|
40
|
+
"build:watch": "vite build --watch",
|
|
41
|
+
"types:watch": "tsc -p tsconfig.prod.json --watch",
|
|
42
|
+
"prewatch": "rimraf dist",
|
|
43
|
+
"watch": "concurrently \"npm run build:watch\" \"npm run types:watch\""
|
|
36
44
|
},
|
|
37
45
|
"sideEffects": [
|
|
38
46
|
"dist/components/**/*.js"
|
|
@@ -41,7 +49,8 @@
|
|
|
41
49
|
"colorsea": "^1.2.2",
|
|
42
50
|
"lit": "^3.3.1",
|
|
43
51
|
"lucide": "^0.556.0",
|
|
44
|
-
"quantize": "^1.0.2"
|
|
52
|
+
"quantize": "^1.0.2",
|
|
53
|
+
"style-observer": "^0.1.2"
|
|
45
54
|
},
|
|
46
55
|
"devDependencies": {
|
|
47
56
|
"@chromatic-com/storybook": "^4.1.3",
|
|
@@ -57,6 +66,7 @@
|
|
|
57
66
|
"@vitest/coverage-v8": "^4.0.15",
|
|
58
67
|
"@wc-toolkit/cem-validator": "^1.0.3",
|
|
59
68
|
"@wc-toolkit/storybook-helpers": "^10.0.0",
|
|
69
|
+
"concurrently": "^9.2.1",
|
|
60
70
|
"glob": "^13.0.0",
|
|
61
71
|
"playwright": "^1.57.0",
|
|
62
72
|
"rimraf": "^6.1.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveController.d.ts","sourceRoot":"","sources":["../../src/utils/ResponsiveController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAEjE,qBAAa,oBAAqB,YAAW,kBAAkB;IAC9D,QAAQ,EAAE,OAAO,CAAS;IAC1B,OAAO,CAAC,IAAI,CAAyB;IACrC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,sBAAsB,CAAuC;gBAEzD,IAAI,EAAE,sBAAsB,EAAE,gBAAgB,GAAE,MAAgB;IAS5E,aAAa,IAAI,IAAI;IAMrB,gBAAgB,IAAI,IAAI;CAGxB"}
|
|
File without changes
|
|
File without changes
|