@lotics/cli 0.190.0 → 0.191.1
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/AGENTS.md +1 -1
- package/README.md +2 -0
- package/dist/probe_page.js +421 -0
- package/dist/src/cli.js +1700 -650
- package/docs/building_an_app.md +14 -5
- package/docs/cli_reference.md +9 -9
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -7,7 +7,7 @@ conventions are, and where the traps are.
|
|
|
7
7
|
|---|---|
|
|
8
8
|
| `lotics --help` | The verb inventory (§ COMMANDS) and global flags. The verb LIST is generated and never stale; the prose beside each verb is hand-written, so where it disagrees with `docs/cli_reference.md`, the reference wins. |
|
|
9
9
|
| `lotics tools` · `lotics tools <name>` | The agent tool registry and one tool's full JSON Schema. |
|
|
10
|
-
| `lotics docs` · `lotics docs <area
|
|
10
|
+
| `lotics docs` · `lotics docs <area>[/<section>]` | Every reference the packages installed beside the project actually ship — `@lotics/app-sdk`, `@lotics/ui` and the document engines each carry their own, and this index only covers THIS package. Discovered by looking, not by a list, so it reports the installed VERSION of each: a doc always describes the code that is really there. Capped at a page: a doc that does not fit hands back its opening and the addresses into it, so the next call is smaller than the last. |
|
|
11
11
|
| `lotics scaffold docs` | How to write a `model.json` — the file a workspace is built from. Two forms: `{"from": "<preset-slug>", "variants", "rename", "entities", "rows", "apply"}`, which names a preset by slug and carries only what this business differs by, and the full one, spelled out, for when no preset is the trade: every top-level key, every field type with the config it needs, the row format, the rules, and a worked example. Offline, and not part of `lotics docs`. It also covers the `apply` list — published packages copied in after the model's own tables, each with an optional `bind` onto them — and the `preset` block a published model carries. `lotics scaffold check` then proves the file — offline, except for the one read a `from` file's preset needs — including every branch of a preset merged onto its base; `lotics setup` applies it and refuses a table name the workspace already has, `lotics scaffold apply` adopts that table and adds what is missing. `lotics scaffold export` goes the other way — a workspace printed as one of these files, to edit into another business's model; a starting point, never a source of truth. |
|
|
12
12
|
| [docs/building_an_app.md](./docs/building_an_app.md) | The SEQUENCE — scaffold, model, types, queries, workflows, screens, ship — and the deploy-free inner loop. The other references describe contracts; this one is the order they go in and why. Read it once before starting an app. |
|
|
13
13
|
| [docs/cli_reference.md](./docs/cli_reference.md) | Per-command contracts, flags, exit codes, and gotchas — the detail `--help` compresses. Read it before hand-building a `set_app_*` payload: several tools REPLACE rather than patch, and a CLI verb already owns the safe assembly. |
|
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ Lotics is an AI-powered operations platform. Through this CLI you can:
|
|
|
15
15
|
**`lotics docs`** lists every reference the packages installed beside your project ship — each
|
|
16
16
|
`@lotics/*` package carries its own, so a doc always describes the version you actually have.
|
|
17
17
|
`lotics docs <area>` prints one (`lotics docs ai`); `lotics docs ui` prints a package's index.
|
|
18
|
+
Every answer is capped at a page, so a long doc hands back its section list and
|
|
19
|
+
`lotics docs <area>/<section>` — or, for a doc that is one table, `lotics docs ui/catalog/Button`.
|
|
18
20
|
Nothing is copied here — the packages, the areas, the titles and the versions are all read at run
|
|
19
21
|
time, so a doc or a whole package added upstream shows up without upgrading this CLI.
|
|
20
22
|
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __loticsProbe = (() => {
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/probe_page.ts
|
|
22
|
+
var probe_page_exports = {};
|
|
23
|
+
__export(probe_page_exports, {
|
|
24
|
+
pressTab: () => pressTab,
|
|
25
|
+
run: () => run,
|
|
26
|
+
tabs: () => tabs,
|
|
27
|
+
textLeafCount: () => textLeafCount
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// src/probe_collectors.ts
|
|
31
|
+
function moneyColumns() {
|
|
32
|
+
const money = /^[-+−]?\s?(?:(?:[$€]|USD|EUR|VND)\s?[\d.,]+\s?(?:[KMB]|tr|tỷ)?|[\d.,]+\s?(?:tr|tỷ)?\s?(?:₫|đ|VND|USD|EUR|[$€]))$/i;
|
|
33
|
+
const skipTag = /^(SCRIPT|STYLE|TITLE|META|LINK|NOSCRIPT|TEMPLATE)$/;
|
|
34
|
+
const bandGap = 48;
|
|
35
|
+
const leaves = [];
|
|
36
|
+
const walk = (node) => {
|
|
37
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
38
|
+
const text = (node.textContent || "").trim();
|
|
39
|
+
const parent = node.parentElement;
|
|
40
|
+
if (!text || !parent || skipTag.test(parent.tagName)) return;
|
|
41
|
+
if (typeof parent.checkVisibility === "function" && !parent.checkVisibility()) return;
|
|
42
|
+
if (!money.test(text)) return;
|
|
43
|
+
const range = document.createRange();
|
|
44
|
+
range.selectNodeContents(node);
|
|
45
|
+
let rect = range.getBoundingClientRect();
|
|
46
|
+
if (rect.width === 0 && rect.height === 0) rect = parent.getBoundingClientRect();
|
|
47
|
+
if (rect.width === 0 && rect.height === 0) return;
|
|
48
|
+
leaves.push({
|
|
49
|
+
text,
|
|
50
|
+
left: Math.round(rect.left),
|
|
51
|
+
right: Math.round(rect.right),
|
|
52
|
+
top: Math.round(rect.top),
|
|
53
|
+
bottom: Math.round(rect.bottom)
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
node.childNodes.forEach(walk);
|
|
58
|
+
};
|
|
59
|
+
walk(document.body);
|
|
60
|
+
const bands = [];
|
|
61
|
+
for (const leaf of [...leaves].sort((a, b) => a.top - b.top)) {
|
|
62
|
+
const band = bands[bands.length - 1];
|
|
63
|
+
if (band !== void 0 && leaf.top - band.bottom <= bandGap) {
|
|
64
|
+
band.items.push(leaf);
|
|
65
|
+
band.bottom = Math.max(band.bottom, leaf.bottom);
|
|
66
|
+
} else {
|
|
67
|
+
bands.push({ bottom: leaf.bottom, items: [leaf] });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const columns = [];
|
|
71
|
+
for (const band of bands) {
|
|
72
|
+
const clusters = [];
|
|
73
|
+
for (const leaf of [...band.items].sort((a, b) => a.left - b.left)) {
|
|
74
|
+
const cluster = clusters[clusters.length - 1];
|
|
75
|
+
if (cluster !== void 0 && leaf.left < cluster.right) {
|
|
76
|
+
cluster.items.push(leaf);
|
|
77
|
+
cluster.right = Math.max(cluster.right, leaf.right);
|
|
78
|
+
} else {
|
|
79
|
+
clusters.push({ left: leaf.left, right: leaf.right, items: [leaf] });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
for (const cluster of clusters) {
|
|
83
|
+
const firstByEdge = /* @__PURE__ */ new Map();
|
|
84
|
+
for (const item of cluster.items) if (!firstByEdge.has(item.right)) firstByEdge.set(item.right, item.text);
|
|
85
|
+
const edges = [...firstByEdge.entries()].sort((a, b) => a[0] - b[0]);
|
|
86
|
+
columns.push({
|
|
87
|
+
x: cluster.left,
|
|
88
|
+
size: cluster.items.length,
|
|
89
|
+
edges: edges.map(([edge]) => edge),
|
|
90
|
+
samples: edges.map(([, text]) => text)
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { total: leaves.length, columns };
|
|
95
|
+
}
|
|
96
|
+
function reportedValues() {
|
|
97
|
+
const numeric = /^[-+−]?\d[\d.,]*\s?(?:%|[A-Za-z₫đ$€]{1,4})?$/;
|
|
98
|
+
const dateLike = /\d[/:-]\d/;
|
|
99
|
+
const skipTag = /^(SCRIPT|STYLE|TITLE|META|LINK|NOSCRIPT|TEMPLATE)$/;
|
|
100
|
+
const notAValue = 'a, button, [role="tab"], [role="button"], input, th, [role="columnheader"], nav';
|
|
101
|
+
const pictureMin = 32;
|
|
102
|
+
const samples = [];
|
|
103
|
+
let bare = 0;
|
|
104
|
+
const walk = (node) => {
|
|
105
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
106
|
+
const text = (node.textContent || "").trim();
|
|
107
|
+
const parent = node.parentElement;
|
|
108
|
+
if (!text || !parent || skipTag.test(parent.tagName)) return;
|
|
109
|
+
if (typeof parent.checkVisibility === "function" && !parent.checkVisibility()) return;
|
|
110
|
+
if (!numeric.test(text) || dateLike.test(text)) return;
|
|
111
|
+
if (parent.closest(notAValue)) return;
|
|
112
|
+
bare += 1;
|
|
113
|
+
if (samples.length < 6) samples.push(text);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
node.childNodes.forEach(walk);
|
|
117
|
+
};
|
|
118
|
+
walk(document.body);
|
|
119
|
+
const drawn = Array.from(document.querySelectorAll('[role="meter"], [role="progressbar"], canvas')).filter((el) => {
|
|
120
|
+
const r = el.getBoundingClientRect();
|
|
121
|
+
return r.width > 0 && r.height > 0;
|
|
122
|
+
});
|
|
123
|
+
const pictures = Array.from(document.querySelectorAll('[role="img"], svg, img')).filter((el) => {
|
|
124
|
+
if (el.getAttribute("aria-hidden") === "true") return false;
|
|
125
|
+
const r = el.getBoundingClientRect();
|
|
126
|
+
return r.width >= pictureMin && r.height >= pictureMin;
|
|
127
|
+
});
|
|
128
|
+
const encoded = drawn.length + pictures.length;
|
|
129
|
+
return { total: bare + encoded, bare, encoded, samples };
|
|
130
|
+
}
|
|
131
|
+
function internalIds() {
|
|
132
|
+
const skipTag = /^(SCRIPT|STYLE|TITLE|META|LINK|NOSCRIPT|TEMPLATE)$/;
|
|
133
|
+
const id = /\b(?:opt|fld|tbl|rec|wfl|mbr|app|wsp)_[A-Za-z0-9]{6,}\b/g;
|
|
134
|
+
const ids = /* @__PURE__ */ new Set();
|
|
135
|
+
let total = 0;
|
|
136
|
+
const walk = (node) => {
|
|
137
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
138
|
+
const parent = node.parentElement;
|
|
139
|
+
if (!parent || skipTag.test(parent.tagName)) return;
|
|
140
|
+
const text = node.textContent || "";
|
|
141
|
+
if (!text.trim()) return;
|
|
142
|
+
total += 1;
|
|
143
|
+
for (const match of text.match(id) ?? []) ids.add(match);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
node.childNodes.forEach(walk);
|
|
147
|
+
};
|
|
148
|
+
walk(document.body);
|
|
149
|
+
return { total, ids: [...ids] };
|
|
150
|
+
}
|
|
151
|
+
function tabStrips() {
|
|
152
|
+
const strips = Array.from(document.querySelectorAll('[role="tablist"]')).filter((el) => {
|
|
153
|
+
const r = el.getBoundingClientRect();
|
|
154
|
+
return r.width > 0 && r.height > 0;
|
|
155
|
+
}).map((el) => Array.from(el.querySelectorAll('[role="tab"]')).map((tab) => (tab.textContent || "").trim()));
|
|
156
|
+
return { total: strips.length, strips };
|
|
157
|
+
}
|
|
158
|
+
function truncatedLeaves() {
|
|
159
|
+
const skipTag = /^(SCRIPT|STYLE|TITLE|META|LINK|NOSCRIPT|TEMPLATE)$/;
|
|
160
|
+
const cut = [];
|
|
161
|
+
let total = 0;
|
|
162
|
+
for (const el of Array.from(document.querySelectorAll("*"))) {
|
|
163
|
+
if (skipTag.test(el.tagName) || el.children.length > 0) continue;
|
|
164
|
+
const text = (el.textContent || "").trim();
|
|
165
|
+
if (!text) continue;
|
|
166
|
+
if (typeof el.checkVisibility === "function" && !el.checkVisibility()) continue;
|
|
167
|
+
total += 1;
|
|
168
|
+
if (getComputedStyle(el).overflow === "visible") continue;
|
|
169
|
+
if (el.scrollWidth > el.clientWidth + 1) {
|
|
170
|
+
cut.push({ text: text.slice(0, 40), axis: "width", has: el.clientWidth, needs: el.scrollWidth });
|
|
171
|
+
} else if (el.scrollHeight > el.clientHeight + 1) {
|
|
172
|
+
cut.push({ text: text.slice(0, 40), axis: "height", has: el.clientHeight, needs: el.scrollHeight });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return { total, cut };
|
|
176
|
+
}
|
|
177
|
+
function bannedGlyphs() {
|
|
178
|
+
const skipTag = /^(SCRIPT|STYLE|TITLE|META|LINK|NOSCRIPT|TEMPLATE)$/;
|
|
179
|
+
const found = [];
|
|
180
|
+
let total = 0;
|
|
181
|
+
const walk = (node) => {
|
|
182
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
183
|
+
const parent = node.parentElement;
|
|
184
|
+
if (!parent || skipTag.test(parent.tagName)) return;
|
|
185
|
+
const text = node.textContent || "";
|
|
186
|
+
if (!text.trim()) return;
|
|
187
|
+
total += 1;
|
|
188
|
+
if (text.includes(" \xB7 ")) found.push(text.trim().slice(0, 40));
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
node.childNodes.forEach(walk);
|
|
192
|
+
};
|
|
193
|
+
walk(document.body);
|
|
194
|
+
return { total, found };
|
|
195
|
+
}
|
|
196
|
+
function compactMoneyWords() {
|
|
197
|
+
const skipTag = /^(SCRIPT|STYLE|TITLE|META|LINK|NOSCRIPT|TEMPLATE)$/;
|
|
198
|
+
const any = /\d[\d.,]*\s?(?:[KMB](?![a-z])|tr(?![a-z])|tỷ)/i;
|
|
199
|
+
const dongInEnglishWords = /\d[\d.,]*\s?[KMB]\s?(?:₫|đ|VND)|(?:₫|VND)\s?\d[\d.,]*\s?[KMB](?![a-z])/i;
|
|
200
|
+
const dollarInVietnameseWords = /[$€]\s?\d[\d.,]*\s?(?:tr(?![a-z])|tỷ)|\d[\d.,]*\s?(?:tr|tỷ)\s?(?:[$€]|USD|EUR)(?![a-z])/i;
|
|
201
|
+
const foreign = [];
|
|
202
|
+
let total = 0;
|
|
203
|
+
const walk = (node) => {
|
|
204
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
205
|
+
const parent = node.parentElement;
|
|
206
|
+
if (!parent || skipTag.test(parent.tagName)) return;
|
|
207
|
+
const text = (node.textContent || "").trim();
|
|
208
|
+
if (!text) return;
|
|
209
|
+
if (any.test(text)) total += 1;
|
|
210
|
+
if (dongInEnglishWords.test(text) || dollarInVietnameseWords.test(text)) foreign.push(text.slice(0, 40));
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
node.childNodes.forEach(walk);
|
|
214
|
+
};
|
|
215
|
+
walk(document.body);
|
|
216
|
+
return { total, foreign };
|
|
217
|
+
}
|
|
218
|
+
function scanStackedPairs() {
|
|
219
|
+
const px = (el) => parseFloat(getComputedStyle(el).fontSize);
|
|
220
|
+
const weight = (el) => parseInt(getComputedStyle(el).fontWeight, 10) || 400;
|
|
221
|
+
const isLeaf = (el) => el.children.length === 0 && (el.textContent || "").trim().length > 0;
|
|
222
|
+
const leafOf = (el, depth = 3) => {
|
|
223
|
+
if (isLeaf(el)) return el;
|
|
224
|
+
if (depth === 0 || el.children.length === 0) return null;
|
|
225
|
+
return leafOf(el.children[0], depth - 1);
|
|
226
|
+
};
|
|
227
|
+
let total = 0;
|
|
228
|
+
const overDemoted = [];
|
|
229
|
+
for (const el of Array.from(document.querySelectorAll("div"))) {
|
|
230
|
+
const kids = Array.from(el.children);
|
|
231
|
+
if (kids.length !== 2) continue;
|
|
232
|
+
const [first, second] = kids;
|
|
233
|
+
const subject = leafOf(first);
|
|
234
|
+
const supporting = leafOf(second);
|
|
235
|
+
if (!subject || !supporting) continue;
|
|
236
|
+
if (first.closest('[role="banner"]')) continue;
|
|
237
|
+
const a = first.getBoundingClientRect();
|
|
238
|
+
const b = second.getBoundingClientRect();
|
|
239
|
+
if (b.top < a.bottom - 2) continue;
|
|
240
|
+
if (a.height === 0 || b.height === 0) continue;
|
|
241
|
+
total += 1;
|
|
242
|
+
if (px(supporting) < px(subject) && weight(subject) > weight(supporting)) {
|
|
243
|
+
overDemoted.push({
|
|
244
|
+
subject: (subject.textContent || "").trim().slice(0, 60),
|
|
245
|
+
supporting: (supporting.textContent || "").trim().slice(0, 60),
|
|
246
|
+
sizes: [px(subject), px(supporting)],
|
|
247
|
+
weights: [weight(subject), weight(supporting)]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return { total, overDemoted };
|
|
252
|
+
}
|
|
253
|
+
function scanRowMarks() {
|
|
254
|
+
const marks = [];
|
|
255
|
+
const seen = [];
|
|
256
|
+
const record = (el, text) => {
|
|
257
|
+
if (seen.some((other) => other.contains(el) || el.contains(other))) return;
|
|
258
|
+
seen.push(el);
|
|
259
|
+
const r = el.getBoundingClientRect();
|
|
260
|
+
marks.push({ text, w: Math.round(r.width), y: Math.round(r.y), x: Math.round(r.x) });
|
|
261
|
+
};
|
|
262
|
+
const inContent = (el) => el.closest('[role="banner"]') === null;
|
|
263
|
+
for (const el of Array.from(document.querySelectorAll('[data-mark="identity"]'))) {
|
|
264
|
+
const r = el.getBoundingClientRect();
|
|
265
|
+
if (r.height === 0 || !inContent(el)) continue;
|
|
266
|
+
record(el, (el.textContent || "").trim() || "\u25A3");
|
|
267
|
+
}
|
|
268
|
+
const initials = /^\p{L}{1,2}$/u;
|
|
269
|
+
const grounded = (el, depth = 2) => {
|
|
270
|
+
const cs = getComputedStyle(el);
|
|
271
|
+
if (cs.backgroundColor !== "rgba(0, 0, 0, 0)" || cs.backgroundImage !== "none") return true;
|
|
272
|
+
if (depth === 0) return false;
|
|
273
|
+
return Array.from(el.children).some((child) => grounded(child, depth - 1));
|
|
274
|
+
};
|
|
275
|
+
for (const el of Array.from(document.querySelectorAll("*"))) {
|
|
276
|
+
const r = el.getBoundingClientRect();
|
|
277
|
+
if (r.width < 12 || r.width > 56) continue;
|
|
278
|
+
if (Math.abs(r.width - r.height) > 1) continue;
|
|
279
|
+
const cs = getComputedStyle(el);
|
|
280
|
+
if ((parseFloat(cs.borderTopLeftRadius) || 0) < 3) continue;
|
|
281
|
+
const text = (el.textContent || "").trim();
|
|
282
|
+
if (!initials.test(text)) continue;
|
|
283
|
+
if (!inContent(el)) continue;
|
|
284
|
+
if (!grounded(el)) continue;
|
|
285
|
+
record(el, text);
|
|
286
|
+
}
|
|
287
|
+
const byRow = /* @__PURE__ */ new Map();
|
|
288
|
+
for (const m of marks) {
|
|
289
|
+
const band = Math.round(m.y / 20) * 20;
|
|
290
|
+
const list = byRow.get(band);
|
|
291
|
+
if (list) list.push(m);
|
|
292
|
+
else byRow.set(band, [m]);
|
|
293
|
+
}
|
|
294
|
+
const mismatches = [];
|
|
295
|
+
for (const [band, row] of byRow) {
|
|
296
|
+
const widths = new Set(row.map((m) => m.w));
|
|
297
|
+
if (widths.size <= 1) continue;
|
|
298
|
+
mismatches.push({ y: band, marks: row.sort((a, b) => a.x - b.x).map((m) => `${m.text}:${m.w}px`) });
|
|
299
|
+
}
|
|
300
|
+
return { total: marks.length, mismatches };
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// src/probe_page.ts
|
|
304
|
+
var MONEY_EDGES_ALLOWED = 2;
|
|
305
|
+
var MONEY_COLUMN_MIN = 3;
|
|
306
|
+
var BARE_VALUES_FLOOR = 8;
|
|
307
|
+
function run(options) {
|
|
308
|
+
const findings = [];
|
|
309
|
+
const money = moneyColumns();
|
|
310
|
+
const ragged = money.columns.filter((column) => column.size >= MONEY_COLUMN_MIN && column.edges.length > MONEY_EDGES_ALLOWED);
|
|
311
|
+
if (ragged.length > 0) {
|
|
312
|
+
findings.push({
|
|
313
|
+
probe: "money_edges",
|
|
314
|
+
total: money.total,
|
|
315
|
+
count: ragged.length,
|
|
316
|
+
detail: ragged.slice(0, 5).map((column) => `x=${column.x}: ${column.edges.length} right edges over ${column.size} figures \u2014 ${column.samples.join(" | ")}`)
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
const values = reportedValues();
|
|
320
|
+
if (values.bare >= BARE_VALUES_FLOOR && values.encoded === 0) {
|
|
321
|
+
findings.push({
|
|
322
|
+
probe: "reported_values",
|
|
323
|
+
total: values.total,
|
|
324
|
+
count: values.bare,
|
|
325
|
+
detail: [`${values.bare} values as bare text, 0 as a mark, meter, chart or picture \u2014 e.g. ${values.samples.join(", ")}`]
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
const ids = internalIds();
|
|
329
|
+
if (ids.ids.length > 0) {
|
|
330
|
+
findings.push({ probe: "internal_ids", total: ids.total, count: ids.ids.length, detail: ids.ids.slice(0, 5) });
|
|
331
|
+
}
|
|
332
|
+
const strips = tabStrips();
|
|
333
|
+
if (strips.total > 1) {
|
|
334
|
+
findings.push({
|
|
335
|
+
probe: "tab_strips",
|
|
336
|
+
total: strips.total,
|
|
337
|
+
count: strips.total,
|
|
338
|
+
detail: strips.strips.map((strip) => strip.join(" / "))
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
if (options.truncation) {
|
|
342
|
+
const cut = truncatedLeaves();
|
|
343
|
+
if (cut.cut.length > 0) {
|
|
344
|
+
findings.push({
|
|
345
|
+
probe: "truncation",
|
|
346
|
+
total: cut.total,
|
|
347
|
+
count: cut.cut.length,
|
|
348
|
+
detail: cut.cut.slice(0, 5).map((leaf) => `"${leaf.text}" needs ${leaf.needs}px of ${leaf.axis} in ${leaf.has}px`)
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const glyphs = bannedGlyphs();
|
|
353
|
+
if (glyphs.found.length > 0) {
|
|
354
|
+
findings.push({ probe: "banned_glyph", total: glyphs.total, count: glyphs.found.length, detail: glyphs.found.slice(0, 5) });
|
|
355
|
+
}
|
|
356
|
+
const compact = compactMoneyWords();
|
|
357
|
+
if (compact.foreign.length > 0) {
|
|
358
|
+
findings.push({
|
|
359
|
+
probe: "compact_money_words",
|
|
360
|
+
total: compact.total,
|
|
361
|
+
count: compact.foreign.length,
|
|
362
|
+
detail: compact.foreign.slice(0, 5).map((text) => `"${text}" abbreviates in the other currency's words`)
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
const pairs = scanStackedPairs();
|
|
366
|
+
if (pairs.overDemoted.length > 0) {
|
|
367
|
+
findings.push({
|
|
368
|
+
probe: "stacked_pairs",
|
|
369
|
+
total: pairs.total,
|
|
370
|
+
count: pairs.overDemoted.length,
|
|
371
|
+
detail: pairs.overDemoted.slice(0, 5).map((pair) => `"${pair.subject}" ${pair.sizes[0]}px/${pair.weights[0]} over "${pair.supporting}" ${pair.sizes[1]}px/${pair.weights[1]}`)
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
const marks = scanRowMarks();
|
|
375
|
+
if (marks.mismatches.length > 0) {
|
|
376
|
+
findings.push({
|
|
377
|
+
probe: "row_marks",
|
|
378
|
+
total: marks.total,
|
|
379
|
+
count: marks.mismatches.length,
|
|
380
|
+
detail: marks.mismatches.slice(0, 5).map((row) => `y=${row.y}: ${row.marks.join(", ")}`)
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
return {
|
|
384
|
+
findings,
|
|
385
|
+
census: {
|
|
386
|
+
leaves: textLeafCount(),
|
|
387
|
+
money: money.total,
|
|
388
|
+
bare: values.bare,
|
|
389
|
+
encoded: values.encoded,
|
|
390
|
+
strips: strips.total
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function textLeafCount() {
|
|
395
|
+
const skipTag = /^(SCRIPT|STYLE|TITLE|META|LINK|NOSCRIPT|TEMPLATE)$/;
|
|
396
|
+
let count = 0;
|
|
397
|
+
const walk = (node) => {
|
|
398
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
399
|
+
const parent = node.parentElement;
|
|
400
|
+
if (parent && !skipTag.test(parent.tagName) && (node.textContent || "").trim()) count += 1;
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
node.childNodes.forEach(walk);
|
|
404
|
+
};
|
|
405
|
+
walk(document.body);
|
|
406
|
+
return count;
|
|
407
|
+
}
|
|
408
|
+
function tabs() {
|
|
409
|
+
const strip = document.querySelector('[role="tablist"]');
|
|
410
|
+
if (strip === null) return [];
|
|
411
|
+
return Array.from(strip.querySelectorAll('[role="tab"]')).map((tab) => (tab.textContent || "").trim());
|
|
412
|
+
}
|
|
413
|
+
function pressTab(index) {
|
|
414
|
+
const strip = document.querySelector('[role="tablist"]');
|
|
415
|
+
const tab = strip?.querySelectorAll('[role="tab"]')[index];
|
|
416
|
+
if (!(tab instanceof HTMLElement)) return false;
|
|
417
|
+
tab.click();
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
return __toCommonJS(probe_page_exports);
|
|
421
|
+
})();
|