frameboard 0.20.0 → 0.22.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/dist/cli.js +6059 -4740
- package/dist/client/assets/index-CVpCu40m.css +2 -0
- package/dist/client/assets/index-nsiugJLd.js +111 -0
- package/dist/client/index.html +2 -2
- package/dist/hook.js +205 -46
- package/package.json +1 -1
- package/dist/client/assets/index-BKwPJ6Ti.css +0 -2
- package/dist/client/assets/index-DPN95MNk.js +0 -110
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-nsiugJLd.js"></script>
|
|
27
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CVpCu40m.css">
|
|
28
28
|
</head>
|
|
29
29
|
<body>
|
|
30
30
|
<div id="root"></div>
|
package/dist/hook.js
CHANGED
|
@@ -11826,7 +11826,12 @@ const SHORTHANDS = {
|
|
|
11826
11826
|
font: ["font-family"],
|
|
11827
11827
|
background: ["background-color"],
|
|
11828
11828
|
border: ["border-color", "border-width"],
|
|
11829
|
-
"flex-flow": ["flex-direction", "flex-wrap"]
|
|
11829
|
+
"flex-flow": ["flex-direction", "flex-wrap"],
|
|
11830
|
+
flex: [
|
|
11831
|
+
"flex-grow",
|
|
11832
|
+
"flex-shrink",
|
|
11833
|
+
"flex-basis"
|
|
11834
|
+
]
|
|
11830
11835
|
};
|
|
11831
11836
|
/** The properties an element takes from its parent when no rule sets them. */
|
|
11832
11837
|
const INHERITED = /* @__PURE__ */ new Set([
|
|
@@ -11897,20 +11902,38 @@ function buildCascade(source, tokens, { properties = READ } = {}) {
|
|
|
11897
11902
|
const matches = compileSelector(selector);
|
|
11898
11903
|
const specificity = specificityOf(selector);
|
|
11899
11904
|
if (!matches || !specificity) continue;
|
|
11900
|
-
|
|
11905
|
+
const compiled = {
|
|
11906
|
+
selector: selector.trim(),
|
|
11901
11907
|
matches,
|
|
11902
|
-
declarations:
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11908
|
+
declarations: []
|
|
11909
|
+
};
|
|
11910
|
+
compiled.declarations = declared.flatMap((node) => node.type === "decl" ? [{
|
|
11911
|
+
property: node.prop.startsWith("--") ? node.prop : node.prop.toLowerCase(),
|
|
11912
|
+
value: node.value,
|
|
11913
|
+
important: node.important,
|
|
11914
|
+
inline: false,
|
|
11915
|
+
specificity,
|
|
11916
|
+
order: order++,
|
|
11917
|
+
rule: compiled
|
|
11918
|
+
}] : []);
|
|
11919
|
+
rules.push(compiled);
|
|
11911
11920
|
}
|
|
11912
11921
|
});
|
|
11913
11922
|
}
|
|
11923
|
+
const counts = /* @__PURE__ */ new Map();
|
|
11924
|
+
const ruleOf = (declaration) => {
|
|
11925
|
+
const rule = declaration.rule;
|
|
11926
|
+
if (!rule) return null;
|
|
11927
|
+
let count = counts.get(rule);
|
|
11928
|
+
if (count === void 0) {
|
|
11929
|
+
count = source.elements.filter((element) => rule.matches(element)).length;
|
|
11930
|
+
counts.set(rule, count);
|
|
11931
|
+
}
|
|
11932
|
+
return {
|
|
11933
|
+
selector: rule.selector,
|
|
11934
|
+
count
|
|
11935
|
+
};
|
|
11936
|
+
};
|
|
11914
11937
|
const winners = /* @__PURE__ */ new Map();
|
|
11915
11938
|
const declaredOn = (element) => {
|
|
11916
11939
|
const cached = winners.get(element);
|
|
@@ -11939,7 +11962,8 @@ function buildCascade(source, tokens, { properties = READ } = {}) {
|
|
|
11939
11962
|
value: declaration.value,
|
|
11940
11963
|
element: current,
|
|
11941
11964
|
userAgent: false,
|
|
11942
|
-
shorthand: declaration.property !== property
|
|
11965
|
+
shorthand: declaration.property !== property,
|
|
11966
|
+
rule: ruleOf(declaration)
|
|
11943
11967
|
};
|
|
11944
11968
|
}
|
|
11945
11969
|
if (property === "font-family" && current.name in USER_AGENT_FAMILIES) {
|
|
@@ -11947,7 +11971,8 @@ function buildCascade(source, tokens, { properties = READ } = {}) {
|
|
|
11947
11971
|
return family === null || family === void 0 ? null : {
|
|
11948
11972
|
value: family,
|
|
11949
11973
|
element: current,
|
|
11950
|
-
userAgent: true
|
|
11974
|
+
userAgent: true,
|
|
11975
|
+
rule: null
|
|
11951
11976
|
};
|
|
11952
11977
|
}
|
|
11953
11978
|
}
|
|
@@ -12002,7 +12027,8 @@ function buildCascade(source, tokens, { properties = READ } = {}) {
|
|
|
12002
12027
|
value: declaration.value,
|
|
12003
12028
|
element,
|
|
12004
12029
|
userAgent: false,
|
|
12005
|
-
shorthand: declaration.property !== property
|
|
12030
|
+
shorthand: declaration.property !== property,
|
|
12031
|
+
rule: ruleOf(declaration)
|
|
12006
12032
|
};
|
|
12007
12033
|
},
|
|
12008
12034
|
resolve: (value, element, keep) => resolveVars(value, element, keep)
|
|
@@ -18626,10 +18652,16 @@ const adapter = {
|
|
|
18626
18652
|
};
|
|
18627
18653
|
// src/server/checks/frame-source.ts
|
|
18628
18654
|
function readFrame(target) {
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18655
|
+
return frameFrom(target, readFileSync(framePath(target), "utf8"));
|
|
18656
|
+
}
|
|
18657
|
+
/**
|
|
18658
|
+
* A frame read from `html` rather than its file, such as a version an agent's
|
|
18659
|
+
* write replaced. Linked sheets still read from disk as they stand now.
|
|
18660
|
+
*/
|
|
18661
|
+
function frameFrom(target, html) {
|
|
18662
|
+
const path = framePath(target);
|
|
18663
|
+
const pageDir = dirname(path);
|
|
18664
|
+
const projectDir = dirname(pageDir);
|
|
18633
18665
|
const parseErrors = [];
|
|
18634
18666
|
const document = parse(html.replace(/^/, " "), {
|
|
18635
18667
|
treeAdapter: adapter,
|
|
@@ -18689,6 +18721,9 @@ function readFrame(target) {
|
|
|
18689
18721
|
parseErrors
|
|
18690
18722
|
};
|
|
18691
18723
|
}
|
|
18724
|
+
function framePath(target) {
|
|
18725
|
+
return join(target.root, target.project, target.page, `${target.name}${FRAME_EXTENSION}`);
|
|
18726
|
+
}
|
|
18692
18727
|
/**
|
|
18693
18728
|
* A sheet behind the local sheets its `@import` rules load, each read once,
|
|
18694
18729
|
* since an imported sheet cascades ahead of the rules that import it.
|
|
@@ -18845,22 +18880,34 @@ function sheetBase(sheet) {
|
|
|
18845
18880
|
return dirname(sheet.path);
|
|
18846
18881
|
}
|
|
18847
18882
|
// src/server/checks/rule.ts
|
|
18848
|
-
/**
|
|
18849
|
-
|
|
18850
|
-
|
|
18851
|
-
|
|
18852
|
-
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18883
|
+
/**
|
|
18884
|
+
* Builds findings for the rules `docs` declares, each at the level its doc
|
|
18885
|
+
* sets, so a module reports only the rules it documents.
|
|
18886
|
+
*/
|
|
18887
|
+
function findingFor(docs) {
|
|
18888
|
+
return (rule, fields) => {
|
|
18889
|
+
const doc = docs.find((candidate) => candidate.id === rule);
|
|
18890
|
+
if (!doc) throw new Error(`No rule doc declares ${rule}`);
|
|
18891
|
+
return {
|
|
18892
|
+
rule,
|
|
18893
|
+
severity: doc.severity,
|
|
18894
|
+
frame: fields.frame,
|
|
18895
|
+
path: fields.path,
|
|
18896
|
+
message: fields.message,
|
|
18897
|
+
location: fields.location ?? null
|
|
18898
|
+
};
|
|
18857
18899
|
};
|
|
18858
18900
|
}
|
|
18859
18901
|
/** One finding as `path:line:column rule message`, as `check` and the hook print it. */
|
|
18860
18902
|
function formatFinding(finding) {
|
|
18861
18903
|
return `${finding.location ? `${finding.path}:${finding.location.line}:${finding.location.column}` : finding.path} ${finding.rule} ${finding.message}`;
|
|
18862
18904
|
}
|
|
18863
|
-
|
|
18905
|
+
const finding$5 = findingFor([{
|
|
18906
|
+
id: "unknown-token",
|
|
18907
|
+
tier: "exact",
|
|
18908
|
+
severity: "warning",
|
|
18909
|
+
description: "A var() with no fallback names a custom property no token sheet, frame sheet, or style attribute declares"
|
|
18910
|
+
}]);
|
|
18864
18911
|
/** A `var()` naming its property, with no fallback after a comma. */
|
|
18865
18912
|
const BARE_VAR = /var\(\s*(--[\w-]+)\s*\)/g;
|
|
18866
18913
|
/**
|
|
@@ -18868,6 +18915,9 @@ const BARE_VAR = /var\(\s*(--[\w-]+)\s*\)/g;
|
|
|
18868
18915
|
* and style attributes whose name nothing declares. A token sheet's own
|
|
18869
18916
|
* references are the board's to answer for, so only its declarations count.
|
|
18870
18917
|
* A property a script sets reads as unknown, which a fallback silences.
|
|
18918
|
+
* A linked sheet's rule matching no element in the frame stays quiet, since a
|
|
18919
|
+
* site sheet styles other pages. The frame's own `<style>` keeps reporting,
|
|
18920
|
+
* since its theme and state rules match elements no static tree marks.
|
|
18871
18921
|
*/
|
|
18872
18922
|
function checkUnknownTokens(source, tokens) {
|
|
18873
18923
|
const declared = /* @__PURE__ */ new Set();
|
|
@@ -18881,6 +18931,7 @@ function checkUnknownTokens(source, tokens) {
|
|
|
18881
18931
|
root.walkDecls((node) => {
|
|
18882
18932
|
if (node.prop.startsWith("--")) declared.add(node.prop);
|
|
18883
18933
|
if (sheet.origin === "token") return;
|
|
18934
|
+
if (sheet.origin === "linked" && matchesNothing(node, source.elements)) return;
|
|
18884
18935
|
for (const name of bareVars(node.value)) uses.push({
|
|
18885
18936
|
name,
|
|
18886
18937
|
path: boardPath(source.root, sheet.path),
|
|
@@ -18903,13 +18954,26 @@ function checkUnknownTokens(source, tokens) {
|
|
|
18903
18954
|
});
|
|
18904
18955
|
});
|
|
18905
18956
|
}
|
|
18906
|
-
return uses.filter((use) => !declared.has(use.name)).map((use) => finding("unknown-token", {
|
|
18957
|
+
return uses.filter((use) => !declared.has(use.name)).map((use) => finding$5("unknown-token", {
|
|
18907
18958
|
frame: source.ref,
|
|
18908
18959
|
path: use.path,
|
|
18909
18960
|
message: `var(${use.name}) names a custom property nothing declares, so the declaration resolves to nothing. Use a token the project's tokens.css declares, or give it a fallback, such as var(${use.name}, red).`,
|
|
18910
18961
|
location: use.location
|
|
18911
18962
|
}));
|
|
18912
18963
|
}
|
|
18964
|
+
/**
|
|
18965
|
+
* Whether `node` sits in a rule none of whose selectors matches an element.
|
|
18966
|
+
* A declaration outside a rule, or a selector the check cannot match
|
|
18967
|
+
* statically, counts as matching, so the use still reports.
|
|
18968
|
+
*/
|
|
18969
|
+
function matchesNothing(node, elements) {
|
|
18970
|
+
const rule = node.parent;
|
|
18971
|
+
if (rule?.type !== "rule" || !styles(rule)) return false;
|
|
18972
|
+
return rule.selectors.every((selector) => {
|
|
18973
|
+
const matches = compileSelector(selector);
|
|
18974
|
+
return matches !== null && !elements.some(matches);
|
|
18975
|
+
});
|
|
18976
|
+
}
|
|
18913
18977
|
function bareVars(value) {
|
|
18914
18978
|
return [...new Set([...value.matchAll(BARE_VAR)].map((match) => match[1] ?? ""))];
|
|
18915
18979
|
}
|
|
@@ -18920,7 +18984,27 @@ function parseOrNull(css) {
|
|
|
18920
18984
|
return null;
|
|
18921
18985
|
}
|
|
18922
18986
|
}
|
|
18923
|
-
|
|
18987
|
+
const finding$4 = findingFor([
|
|
18988
|
+
{
|
|
18989
|
+
id: "default-font",
|
|
18990
|
+
tier: "selector",
|
|
18991
|
+
severity: "warning",
|
|
18992
|
+
description: "Every text element reaches a font-family, so the browser's default font never renders"
|
|
18993
|
+
},
|
|
18994
|
+
{
|
|
18995
|
+
id: "generic-font",
|
|
18996
|
+
tier: "selector",
|
|
18997
|
+
severity: "warning",
|
|
18998
|
+
description: "No text element renders in a generic family such as sans-serif or monospace as its first choice"
|
|
18999
|
+
},
|
|
19000
|
+
{
|
|
19001
|
+
id: "allowed-fonts",
|
|
19002
|
+
tier: "selector",
|
|
19003
|
+
severity: "error",
|
|
19004
|
+
configKey: "allowedFonts",
|
|
19005
|
+
description: "Every text element's first family is one of the project's allowed fonts"
|
|
19006
|
+
}
|
|
19007
|
+
]);
|
|
18924
19008
|
const GENERIC_FAMILIES = /* @__PURE__ */ new Set([
|
|
18925
19009
|
"serif",
|
|
18926
19010
|
"sans-serif",
|
|
@@ -18963,7 +19047,7 @@ function checkFonts(source, cascade, config) {
|
|
|
18963
19047
|
else if (allowed && !allowed.includes(family.toLowerCase())) push(unlisted, family, element);
|
|
18964
19048
|
}
|
|
18965
19049
|
const path = boardPath(source.root, source.path);
|
|
18966
|
-
const at = (rule, elements, message) => finding(rule, {
|
|
19050
|
+
const at = (rule, elements, message) => finding$4(rule, {
|
|
18967
19051
|
frame: source.ref,
|
|
18968
19052
|
path,
|
|
18969
19053
|
message: `${message} ${described(elements)}`,
|
|
@@ -18992,7 +19076,26 @@ function push(map, key, element) {
|
|
|
18992
19076
|
if (list) list.push(element);
|
|
18993
19077
|
else map.set(key, [element]);
|
|
18994
19078
|
}
|
|
18995
|
-
|
|
19079
|
+
const finding$3 = findingFor([
|
|
19080
|
+
{
|
|
19081
|
+
id: "outside-link",
|
|
19082
|
+
tier: "exact",
|
|
19083
|
+
severity: "error",
|
|
19084
|
+
description: "A frame loads files from its own page folder and its project's assets/ folder alone, never from a sibling page or the server root"
|
|
19085
|
+
},
|
|
19086
|
+
{
|
|
19087
|
+
id: "network",
|
|
19088
|
+
tier: "exact",
|
|
19089
|
+
severity: "error",
|
|
19090
|
+
description: "A frame loads nothing over the network, while a navigation link passes"
|
|
19091
|
+
},
|
|
19092
|
+
{
|
|
19093
|
+
id: "missing-file",
|
|
19094
|
+
tier: "exact",
|
|
19095
|
+
severity: "error",
|
|
19096
|
+
description: "Every local file a frame loads exists"
|
|
19097
|
+
}
|
|
19098
|
+
]);
|
|
18996
19099
|
/**
|
|
18997
19100
|
* The attributes that load a resource, by element. An `a href` navigates
|
|
18998
19101
|
* rather than loads, so it is left out.
|
|
@@ -19014,6 +19117,14 @@ const RESOURCE_ATTRIBUTES = {
|
|
|
19014
19117
|
};
|
|
19015
19118
|
/** `outside-link`, `network`, and `missing-file` over every load a frame makes. */
|
|
19016
19119
|
function checkLinks(source) {
|
|
19120
|
+
return frameLoads(source).flatMap((load) => judge(source, load));
|
|
19121
|
+
}
|
|
19122
|
+
/**
|
|
19123
|
+
* Every resource a frame loads, from its elements' attributes and inline
|
|
19124
|
+
* styles and from each sheet it renders with, unjudged. The link check and the
|
|
19125
|
+
* asset usage count read this one list, so they never disagree on a load.
|
|
19126
|
+
*/
|
|
19127
|
+
function frameLoads(source) {
|
|
19017
19128
|
const framePath = boardPath(source.root, source.path);
|
|
19018
19129
|
const loads = [];
|
|
19019
19130
|
for (const element of source.elements) {
|
|
@@ -19039,7 +19150,7 @@ function checkLinks(source) {
|
|
|
19039
19150
|
});
|
|
19040
19151
|
}
|
|
19041
19152
|
for (const sheet of source.sheets) loads.push(...sheetLoads(source, sheet));
|
|
19042
|
-
return loads
|
|
19153
|
+
return loads;
|
|
19043
19154
|
}
|
|
19044
19155
|
function sheetLoads(source, sheet) {
|
|
19045
19156
|
const path = boardPath(source.root, sheet.path);
|
|
@@ -19060,16 +19171,16 @@ function judge(source, load) {
|
|
|
19060
19171
|
path: load.path,
|
|
19061
19172
|
location: load.location
|
|
19062
19173
|
};
|
|
19063
|
-
if (hasScheme(url)) return [finding("network", {
|
|
19174
|
+
if (hasScheme(url)) return [finding$3("network", {
|
|
19064
19175
|
...fields,
|
|
19065
19176
|
message: `${load.via} loads ${url} over the network. Save the file into the page folder or the project's assets/ and link it there.`
|
|
19066
19177
|
})];
|
|
19067
19178
|
const target = localTarget(url, load.base);
|
|
19068
|
-
if (target === null || !allowed(source, target)) return [finding("outside-link", {
|
|
19179
|
+
if (target === null || !allowed(source, target)) return [finding$3("outside-link", {
|
|
19069
19180
|
...fields,
|
|
19070
19181
|
message: `${load.via} loads ${url}, outside this page's folder and the project's assets/. Move the file into one of them.`
|
|
19071
19182
|
})];
|
|
19072
|
-
if (!existsSync(target)) return [finding("missing-file", {
|
|
19183
|
+
if (!existsSync(target)) return [finding$3("missing-file", {
|
|
19073
19184
|
...fields,
|
|
19074
19185
|
message: `${load.via} loads ${url}, which does not exist.`
|
|
19075
19186
|
})];
|
|
@@ -19134,7 +19245,44 @@ function isReservedPageName(name) {
|
|
|
19134
19245
|
function namesCollide(a, b) {
|
|
19135
19246
|
return a.toLowerCase() === b.toLowerCase();
|
|
19136
19247
|
}
|
|
19137
|
-
|
|
19248
|
+
const finding$2 = findingFor([
|
|
19249
|
+
{
|
|
19250
|
+
id: "naming",
|
|
19251
|
+
tier: "exact",
|
|
19252
|
+
severity: "error",
|
|
19253
|
+
description: "A page or frame name uses letters, digits, dots, dashes, and underscores, opening with a letter or digit, at most 64 characters"
|
|
19254
|
+
},
|
|
19255
|
+
{
|
|
19256
|
+
id: "dot-folder",
|
|
19257
|
+
tier: "exact",
|
|
19258
|
+
severity: "error",
|
|
19259
|
+
description: "No folder in a project opens with a dot, since the board never shows it"
|
|
19260
|
+
},
|
|
19261
|
+
{
|
|
19262
|
+
id: "head-body",
|
|
19263
|
+
tier: "exact",
|
|
19264
|
+
severity: "error",
|
|
19265
|
+
description: "A frame stating <head> states <body> too"
|
|
19266
|
+
},
|
|
19267
|
+
{
|
|
19268
|
+
id: "table-tbody",
|
|
19269
|
+
tier: "exact",
|
|
19270
|
+
severity: "error",
|
|
19271
|
+
description: "A table holding rows states its <tbody>, since the browser adds one the file does not hold"
|
|
19272
|
+
},
|
|
19273
|
+
{
|
|
19274
|
+
id: "malformed-tag",
|
|
19275
|
+
tier: "exact",
|
|
19276
|
+
severity: "error",
|
|
19277
|
+
description: "A tag or attribute the HTML tokenizer cannot read as written, such as a quote ending an attribute early, which the browser recovers from silently"
|
|
19278
|
+
},
|
|
19279
|
+
{
|
|
19280
|
+
id: "nesting",
|
|
19281
|
+
tier: "exact",
|
|
19282
|
+
severity: "error",
|
|
19283
|
+
description: "The browser rebuilds the tree the file writes, adding an element it never opens, closing one it never closed, or moving one out of a table"
|
|
19284
|
+
}
|
|
19285
|
+
]);
|
|
19138
19286
|
/**
|
|
19139
19287
|
* Elements a parser may imply with no start tag in a valid file. A `tbody`
|
|
19140
19288
|
* is `table-tbody`'s to report.
|
|
@@ -19197,12 +19345,12 @@ const MALFORMED = {
|
|
|
19197
19345
|
function checkNaming(target, path) {
|
|
19198
19346
|
const ref = `${target.project}/${target.page}/${target.name}`;
|
|
19199
19347
|
const findings = [];
|
|
19200
|
-
if (!isValidName(target.page) || isReservedPageName(target.page)) findings.push(finding("naming", {
|
|
19348
|
+
if (!isValidName(target.page) || isReservedPageName(target.page)) findings.push(finding$2("naming", {
|
|
19201
19349
|
frame: ref,
|
|
19202
19350
|
path,
|
|
19203
19351
|
message: `Page name ${target.page} is not valid. Use letters, digits, dots, dashes, and underscores, opening with a letter or digit.`
|
|
19204
19352
|
}));
|
|
19205
|
-
if (!isValidName(target.name)) findings.push(finding("naming", {
|
|
19353
|
+
if (!isValidName(target.name)) findings.push(finding$2("naming", {
|
|
19206
19354
|
frame: ref,
|
|
19207
19355
|
path,
|
|
19208
19356
|
message: `Frame name ${target.name} is not valid. Use letters, digits, dots, dashes, and underscores, opening with a letter or digit.`
|
|
@@ -19215,13 +19363,13 @@ function checkMarkup(source) {
|
|
|
19215
19363
|
const findings = [];
|
|
19216
19364
|
const head = source.elements.find((element) => element.name === "head");
|
|
19217
19365
|
const body = source.elements.find((element) => element.name === "body");
|
|
19218
|
-
if (head && startTagLocation(head) && !(body && startTagLocation(body))) findings.push(finding("head-body", {
|
|
19366
|
+
if (head && startTagLocation(head) && !(body && startTagLocation(body))) findings.push(finding$2("head-body", {
|
|
19219
19367
|
frame: source.ref,
|
|
19220
19368
|
path,
|
|
19221
19369
|
message: "The frame states <head> and no <body>. Wrap the visible content in <body>.",
|
|
19222
19370
|
location: startTagLocation(head)
|
|
19223
19371
|
}));
|
|
19224
|
-
for (const table of source.elements.filter(isTable)) if (table.children.some((child) => child.type === "tag" && child.name === "tbody" && !child.sourceCodeLocation?.startTag)) findings.push(finding("table-tbody", {
|
|
19372
|
+
for (const table of source.elements.filter(isTable)) if (table.children.some((child) => child.type === "tag" && child.name === "tbody" && !child.sourceCodeLocation?.startTag)) findings.push(finding$2("table-tbody", {
|
|
19225
19373
|
frame: source.ref,
|
|
19226
19374
|
path,
|
|
19227
19375
|
message: "This table holds rows with no <tbody>, so the browser adds one the file does not hold. State the <tbody>.",
|
|
@@ -19248,7 +19396,7 @@ function checkMalformedTags(source) {
|
|
|
19248
19396
|
if (reported.has(tag)) continue;
|
|
19249
19397
|
reported.add(tag);
|
|
19250
19398
|
}
|
|
19251
|
-
findings.push(finding("malformed-tag", {
|
|
19399
|
+
findings.push(finding$2("malformed-tag", {
|
|
19252
19400
|
frame: source.ref,
|
|
19253
19401
|
path,
|
|
19254
19402
|
message: `${tag ? `<${tag.name}> raises ${error.code}` : error.code}. ${message}`,
|
|
@@ -19266,7 +19414,7 @@ function checkMalformedTags(source) {
|
|
|
19266
19414
|
function checkNesting(source) {
|
|
19267
19415
|
const path = boardPath(source.root, source.path);
|
|
19268
19416
|
const findings = [];
|
|
19269
|
-
const report = (message, location) => findings.push(finding("nesting", {
|
|
19417
|
+
const report = (message, location) => findings.push(finding$2("nesting", {
|
|
19270
19418
|
frame: source.ref,
|
|
19271
19419
|
path,
|
|
19272
19420
|
message,
|
|
@@ -19321,7 +19469,12 @@ function strayEndTag(html, element) {
|
|
|
19321
19469
|
function isTable(element) {
|
|
19322
19470
|
return element.name === "table";
|
|
19323
19471
|
}
|
|
19324
|
-
|
|
19472
|
+
const finding$1 = findingFor([{
|
|
19473
|
+
id: "theme",
|
|
19474
|
+
tier: "selector",
|
|
19475
|
+
severity: "error",
|
|
19476
|
+
description: "A frame setting literal colors defines the other theme too, through a [data-theme] selector, a prefers-color-scheme query, or light-dark()"
|
|
19477
|
+
}]);
|
|
19325
19478
|
const COLOR_PROPERTIES = /^(color|background(-color|-image)?|border(-(top|right|bottom|left|block|inline)(-(start|end))?)?(-color)?|outline(-color)?|fill|stroke|box-shadow|text-shadow|caret-color|accent-color|text-decoration(-color)?|column-rule(-color)?)$/i;
|
|
19326
19479
|
const COLOR_FUNCTION = /\b(rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i;
|
|
19327
19480
|
const HEX_COLOR = /#[0-9a-f]{3,8}\b/i;
|
|
@@ -19331,7 +19484,7 @@ function checkTheme(source) {
|
|
|
19331
19484
|
const { firstColor, bothThemes } = readThemeColors(source);
|
|
19332
19485
|
if (!firstColor || bothThemes) return [];
|
|
19333
19486
|
const { path, location } = firstColor;
|
|
19334
|
-
return [finding("theme", {
|
|
19487
|
+
return [finding$1("theme", {
|
|
19335
19488
|
frame: source.ref,
|
|
19336
19489
|
path,
|
|
19337
19490
|
message: "The frame sets its own colors for one theme alone. Define the other through [data-theme] or prefers-color-scheme, or take the colors from token variables.",
|
|
@@ -19507,7 +19660,13 @@ function tokenSheets(root, project, tokens) {
|
|
|
19507
19660
|
offset: 0
|
|
19508
19661
|
}));
|
|
19509
19662
|
}
|
|
19510
|
-
|
|
19663
|
+
const finding = findingFor([{
|
|
19664
|
+
id: "uppercase",
|
|
19665
|
+
tier: "selector",
|
|
19666
|
+
severity: "warning",
|
|
19667
|
+
configKey: "noUppercase",
|
|
19668
|
+
description: "No text is set in capitals, through text-transform: uppercase or a word of more than three capital letters"
|
|
19669
|
+
}]);
|
|
19511
19670
|
const CAPITALS = /(?<![\p{L}\p{N}])\p{Lu}{4,}(?![\p{L}\p{N}])/u;
|
|
19512
19671
|
/** `uppercase`, which runs only when the project sets `noUppercase`. */
|
|
19513
19672
|
function checkUppercase(source, cascade) {
|