frameboard 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/cli.js +7079 -5654
- package/dist/client/assets/index-D-VR2nQK.css +2 -0
- package/dist/client/assets/index-rlhpPZLV.js +111 -0
- package/dist/client/index.html +2 -2
- package/dist/hook.js +33 -10
- package/package.json +1 -1
- package/dist/client/assets/index-8TyiWhdN.js +0 -108
- package/dist/client/assets/index-CaVPbXim.css +0 -2
package/dist/client/index.html
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
matchMedia('(prefers-color-scheme: dark)').matches),
|
|
24
24
|
)
|
|
25
25
|
</script>
|
|
26
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
26
|
+
<script type="module" crossorigin src="/assets/index-rlhpPZLV.js"></script>
|
|
27
|
+
<link rel="stylesheet" crossorigin href="/assets/index-D-VR2nQK.css">
|
|
28
28
|
</head>
|
|
29
29
|
<body>
|
|
30
30
|
<div id="root"></div>
|
package/dist/hook.js
CHANGED
|
@@ -11880,6 +11880,18 @@ const READ = /* @__PURE__ */ new Set([
|
|
|
11880
11880
|
"font",
|
|
11881
11881
|
"text-transform"
|
|
11882
11882
|
]);
|
|
11883
|
+
/** The longhands a shorthand competes for, so `font` sets the family too. */
|
|
11884
|
+
const SHORTHANDS = {
|
|
11885
|
+
font: ["font-family"],
|
|
11886
|
+
background: ["background-color"],
|
|
11887
|
+
border: ["border-color", "border-width"]
|
|
11888
|
+
};
|
|
11889
|
+
/** The properties an element takes from its parent when no rule sets them. */
|
|
11890
|
+
const INHERITED = /* @__PURE__ */ new Set([
|
|
11891
|
+
"color",
|
|
11892
|
+
"font-family",
|
|
11893
|
+
"text-transform"
|
|
11894
|
+
]);
|
|
11883
11895
|
/** At-rules whose blocks never style an element. */
|
|
11884
11896
|
const NOT_STYLING = /* @__PURE__ */ new Set([
|
|
11885
11897
|
"keyframes",
|
|
@@ -11924,7 +11936,8 @@ const CSS_WIDE = /* @__PURE__ */ new Set([
|
|
|
11924
11936
|
* through `@bramus/specificity`, and takes every rule inside a media query
|
|
11925
11937
|
* as applying, since a frame renders at one viewport the check cannot see.
|
|
11926
11938
|
*/
|
|
11927
|
-
function buildCascade(source, tokens) {
|
|
11939
|
+
function buildCascade(source, tokens, { properties = READ } = {}) {
|
|
11940
|
+
const reads = (property) => property.startsWith("--") || properties.has(property.toLowerCase());
|
|
11928
11941
|
const rules = [];
|
|
11929
11942
|
let order = 0;
|
|
11930
11943
|
for (const sheet of [...tokens, ...source.sheets]) {
|
|
@@ -11962,12 +11975,13 @@ function buildCascade(source, tokens) {
|
|
|
11962
11975
|
if (cached) return cached;
|
|
11963
11976
|
const won = /* @__PURE__ */ new Map();
|
|
11964
11977
|
const consider = (declaration) => {
|
|
11965
|
-
const property
|
|
11966
|
-
|
|
11967
|
-
|
|
11978
|
+
for (const property of SHORTHANDS[declaration.property] ?? [declaration.property]) {
|
|
11979
|
+
const current = won.get(property);
|
|
11980
|
+
if (!current || beats(declaration, current)) won.set(property, declaration);
|
|
11981
|
+
}
|
|
11968
11982
|
};
|
|
11969
11983
|
for (const rule of rules) if (rule.matches(element)) rule.declarations.forEach(consider);
|
|
11970
|
-
inlineDeclarations(element).forEach(consider);
|
|
11984
|
+
inlineDeclarations(element, reads).forEach(consider);
|
|
11971
11985
|
winners.set(element, won);
|
|
11972
11986
|
return won;
|
|
11973
11987
|
};
|
|
@@ -11983,7 +11997,7 @@ function buildCascade(source, tokens) {
|
|
|
11983
11997
|
value: declaration.value,
|
|
11984
11998
|
element: current,
|
|
11985
11999
|
userAgent: false,
|
|
11986
|
-
shorthand: declaration.property
|
|
12000
|
+
shorthand: declaration.property !== property
|
|
11987
12001
|
};
|
|
11988
12002
|
}
|
|
11989
12003
|
if (property === "font-family" && current.name in USER_AGENT_FAMILIES) {
|
|
@@ -12032,12 +12046,21 @@ function buildCascade(source, tokens) {
|
|
|
12032
12046
|
const found = inherited(element, "text-transform");
|
|
12033
12047
|
if (!found) return "none";
|
|
12034
12048
|
return (resolveVars(found.value, found.element) ?? "none").trim().toLowerCase();
|
|
12049
|
+
},
|
|
12050
|
+
specified: (element, property) => {
|
|
12051
|
+
if (INHERITED.has(property)) return inherited(element, property);
|
|
12052
|
+
const declaration = declaredOn(element).get(property);
|
|
12053
|
+
if (!declaration) return null;
|
|
12054
|
+
if (CSS_WIDE.has(declaration.value.trim().toLowerCase())) return null;
|
|
12055
|
+
return {
|
|
12056
|
+
value: declaration.value,
|
|
12057
|
+
element,
|
|
12058
|
+
userAgent: false,
|
|
12059
|
+
shorthand: declaration.property !== property
|
|
12060
|
+
};
|
|
12035
12061
|
}
|
|
12036
12062
|
};
|
|
12037
12063
|
}
|
|
12038
|
-
function reads(property) {
|
|
12039
|
-
return property.startsWith("--") || READ.has(property.toLowerCase());
|
|
12040
|
-
}
|
|
12041
12064
|
/** A rule styles elements unless it sits in a non-styling at-rule or inside another rule. */
|
|
12042
12065
|
function styles(rule) {
|
|
12043
12066
|
for (let parent = rule.parent; parent; parent = parent.parent) {
|
|
@@ -12079,7 +12102,7 @@ function beats(a, b) {
|
|
|
12079
12102
|
}
|
|
12080
12103
|
return a.order > b.order;
|
|
12081
12104
|
}
|
|
12082
|
-
function inlineDeclarations(element) {
|
|
12105
|
+
function inlineDeclarations(element, reads) {
|
|
12083
12106
|
const style = element.attribs.style;
|
|
12084
12107
|
if (!style) return [];
|
|
12085
12108
|
let root;
|