@simplysf/simply-utam-core 0.2.0 → 0.3.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.
Files changed (76) hide show
  1. package/README.md +72 -16
  2. package/lib/forceignore/forceignore-manager.d.ts +30 -0
  3. package/lib/forceignore/forceignore-manager.js +28 -10
  4. package/lib/forceignore/forceignore-manager.js.map +1 -1
  5. package/lib/forceignore/index.d.ts +1 -1
  6. package/lib/forceignore/index.js +1 -1
  7. package/lib/forceignore/index.js.map +1 -1
  8. package/lib/gitignore/gitignore-manager.d.ts +64 -0
  9. package/lib/gitignore/gitignore-manager.js +96 -0
  10. package/lib/gitignore/gitignore-manager.js.map +1 -0
  11. package/lib/gitignore/index.d.ts +1 -0
  12. package/lib/gitignore/index.js +17 -0
  13. package/lib/gitignore/index.js.map +1 -0
  14. package/lib/index.d.ts +3 -1
  15. package/lib/index.js +3 -1
  16. package/lib/index.js.map +1 -1
  17. package/lib/namespaces/namespace-map.d.ts +18 -0
  18. package/lib/namespaces/namespace-map.js +75 -0
  19. package/lib/namespaces/namespace-map.js.map +1 -0
  20. package/lib/namespaces/namespace-rewriter.js +2 -47
  21. package/lib/namespaces/namespace-rewriter.js.map +1 -1
  22. package/lib/scaffold/project-scaffolder.d.ts +26 -1
  23. package/lib/scaffold/project-scaffolder.js +81 -11
  24. package/lib/scaffold/project-scaffolder.js.map +1 -1
  25. package/lib/snapshot/capture.d.ts +56 -0
  26. package/lib/snapshot/capture.js +115 -0
  27. package/lib/snapshot/capture.js.map +1 -0
  28. package/lib/snapshot/console.d.ts +25 -0
  29. package/lib/snapshot/console.js +74 -0
  30. package/lib/snapshot/console.js.map +1 -0
  31. package/lib/snapshot/describe.d.ts +27 -0
  32. package/lib/snapshot/describe.js +76 -0
  33. package/lib/snapshot/describe.js.map +1 -0
  34. package/lib/snapshot/files.d.ts +85 -0
  35. package/lib/snapshot/files.js +185 -0
  36. package/lib/snapshot/files.js.map +1 -0
  37. package/lib/snapshot/find.d.ts +36 -0
  38. package/lib/snapshot/find.js +186 -0
  39. package/lib/snapshot/find.js.map +1 -0
  40. package/lib/snapshot/format.d.ts +96 -0
  41. package/lib/snapshot/format.js +100 -0
  42. package/lib/snapshot/format.js.map +1 -0
  43. package/lib/snapshot/header.d.ts +38 -0
  44. package/lib/snapshot/header.js +120 -0
  45. package/lib/snapshot/header.js.map +1 -0
  46. package/lib/snapshot/index.d.ts +13 -0
  47. package/lib/snapshot/index.js +28 -0
  48. package/lib/snapshot/index.js.map +1 -0
  49. package/lib/snapshot/locate.d.ts +61 -0
  50. package/lib/snapshot/locate.js +110 -0
  51. package/lib/snapshot/locate.js.map +1 -0
  52. package/lib/snapshot/lookup.d.ts +53 -0
  53. package/lib/snapshot/lookup.js +188 -0
  54. package/lib/snapshot/lookup.js.map +1 -0
  55. package/lib/snapshot/page-object-index.d.ts +149 -0
  56. package/lib/snapshot/page-object-index.js +806 -0
  57. package/lib/snapshot/page-object-index.js.map +1 -0
  58. package/lib/snapshot/page-object-packages.d.ts +41 -0
  59. package/lib/snapshot/page-object-packages.js +115 -0
  60. package/lib/snapshot/page-object-packages.js.map +1 -0
  61. package/lib/snapshot/path.d.ts +102 -0
  62. package/lib/snapshot/path.js +381 -0
  63. package/lib/snapshot/path.js.map +1 -0
  64. package/lib/snapshot/query-result.d.ts +20 -0
  65. package/lib/snapshot/query-result.js +32 -0
  66. package/lib/snapshot/query-result.js.map +1 -0
  67. package/lib/snapshot/selector.d.ts +103 -0
  68. package/lib/snapshot/selector.js +280 -0
  69. package/lib/snapshot/selector.js.map +1 -0
  70. package/lib/snapshot/tree.d.ts +76 -0
  71. package/lib/snapshot/tree.js +201 -0
  72. package/lib/snapshot/tree.js.map +1 -0
  73. package/lib/snapshot/walker.js +532 -0
  74. package/package.json +11 -3
  75. package/templates/dom-snapshot.steps.mjs +34 -0
  76. package/templates/wdio.conf.mjs +81 -4
@@ -0,0 +1,381 @@
1
+ /*
2
+ * Copyright (c) 2026, SimplySF.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { clip, describeNode, shellQuote } from './describe.js';
17
+ import { findNodes } from './find.js';
18
+ import { getNode } from './locate.js';
19
+ import { formatGetter } from './lookup.js';
20
+ import { displayName, matchPageObjects, shortName, } from './page-object-index.js';
21
+ import { DEFAULT_OUTPUT_LIMIT, limitLines } from './query-result.js';
22
+ import { nodeMatchesSelector, prepareSelector, scopeMatches } from './selector.js';
23
+ /** The page objects an annotation stands for, with their implementations' elements. */
24
+ function withImplementations(index, entry) {
25
+ return [
26
+ entry,
27
+ ...(entry.implementations ?? []).map((name) => index.entries.get(name)).filter((e) => !!e),
28
+ ];
29
+ }
30
+ function routeTo(index, holder, selects) {
31
+ for (const candidate of withImplementations(index, holder)) {
32
+ const element = [...candidate.publicElements, ...candidate.privateElements].find(selects);
33
+ if (!element)
34
+ continue;
35
+ const isPublic = candidate.publicElements.includes(element);
36
+ return {
37
+ pageObject: displayName(index, holder.name),
38
+ ...(candidate !== holder ? { implementation: shortName(candidate) } : {}),
39
+ element: element.name,
40
+ selector: element.selector,
41
+ scope: element.scope,
42
+ public: isPublic,
43
+ container: element.type === 'container',
44
+ use: isPublic ? [formatGetter(element)] : (element.usedBy ?? []).map((name) => `${name}()`),
45
+ };
46
+ }
47
+ return undefined;
48
+ }
49
+ /** A root page object's selector (or its implementations'), when UTAM could load the wrong copy. */
50
+ function rootSelectorCheck(snapshot, index, entry) {
51
+ const selectors = new Set();
52
+ for (const candidate of withImplementations(index, entry))
53
+ if (candidate.selector)
54
+ selectors.add(candidate.selector);
55
+ for (const selector of selectors) {
56
+ const found = scopeMatches(snapshot, selector, { kind: 'document' });
57
+ if (found.length > 1 || found[0]?.hiddenTop)
58
+ return { selector, count: found.length, first: found[0].node.id, firstHidden: found[0].hiddenTop !== undefined };
59
+ }
60
+ return undefined;
61
+ }
62
+ /**
63
+ * Replays an element's declaration as UTAM searches it, from the page object's root node down to
64
+ * `target`: each element in its declared scope (`elements` or `shadow.elements`) of the one above.
65
+ * Returns the first element that only the other scope finds on the way to the target.
66
+ */
67
+ function checkScope(snapshot, holder, element, root, target) {
68
+ const onPath = new Set();
69
+ for (let up = target; up; up = up.parent)
70
+ onPath.add(up);
71
+ if (!onPath.has(root))
72
+ return undefined;
73
+ const byName = new Map([...holder.publicElements, ...holder.privateElements].map((e) => [e.name, e]));
74
+ const parts = element.name.split('.');
75
+ let current = root;
76
+ for (let i = 1; i <= parts.length; i++) {
77
+ const step = byName.get(parts.slice(0, i).join('.'));
78
+ if (!step)
79
+ return undefined;
80
+ const search = (scope) => scopeMatches(snapshot, step.selector, { kind: scope, within: current.node.id }).find((m) => onPath.has(m));
81
+ const next = search(step.scope);
82
+ if (next) {
83
+ current = next;
84
+ continue;
85
+ }
86
+ const other = search(step.scope === 'light' ? 'shadow' : 'light');
87
+ if (!other)
88
+ return undefined;
89
+ return {
90
+ element: step.name,
91
+ selector: step.selector,
92
+ declared: step.scope,
93
+ parent: current.node.id,
94
+ found: other.node.id,
95
+ ...(step !== element ? { via: element.name } : {}),
96
+ };
97
+ }
98
+ return undefined;
99
+ }
100
+ function selectsNode(selector, entry) {
101
+ try {
102
+ return nodeMatchesSelector(entry, prepareSelector(selector).selector);
103
+ }
104
+ catch {
105
+ return false;
106
+ }
107
+ }
108
+ /** Elements of the project's own page objects above the node that select it, declared in the wrong scope. */
109
+ function projectScopeMismatches(snapshot, index, above, entry) {
110
+ const out = [];
111
+ for (const { entries, node } of above) {
112
+ for (const holder of entries) {
113
+ if (holder.source !== 'project')
114
+ continue;
115
+ for (const element of [...holder.publicElements, ...holder.privateElements]) {
116
+ if (!selectsNode(element.selector, entry))
117
+ continue;
118
+ const mismatch = checkScope(snapshot, holder, element, node, entry);
119
+ if (mismatch)
120
+ out.push({ pageObject: displayName(index, holder.name), ...mismatch });
121
+ }
122
+ }
123
+ }
124
+ return out;
125
+ }
126
+ /**
127
+ * A page object above the node with an element that likely selects it: one whose selector names
128
+ * the node's tag (any page object above, nearest first), or, for the nearest page object above, one
129
+ * whose whole selector matches the node (containers and elements selected by attribute or class).
130
+ */
131
+ function reachable(index, above, entry) {
132
+ for (let i = above.length - 1; i >= 0; i--) {
133
+ for (const holder of above[i].entries) {
134
+ const byTag = routeTo(index, holder, (element) => element.tags.includes(entry.node.tag));
135
+ if (byTag)
136
+ return byTag;
137
+ if (i === above.length - 1) {
138
+ const bySelector = routeTo(index, holder, (element) => selectsNode(element.selector, entry));
139
+ if (bySelector)
140
+ return bySelector;
141
+ }
142
+ }
143
+ }
144
+ return undefined;
145
+ }
146
+ /**
147
+ * The project's own root page objects whose root selector's first match in the document is a node:
148
+ * how `path` shows a project page object that scopes a shipped one to a plain container.
149
+ */
150
+ function projectRoots(snapshot, index) {
151
+ const out = new Map();
152
+ for (const entry of index.entries.values()) {
153
+ if (entry.source !== 'project' || !entry.root || !entry.selector)
154
+ continue;
155
+ const first = scopeMatches(snapshot, entry.selector, { kind: 'document' })[0];
156
+ if (first)
157
+ out.set(first, [...(out.get(first) ?? []), entry]);
158
+ }
159
+ return out;
160
+ }
161
+ function annotationFor(index, found, byRootSelector) {
162
+ const [best, ...rest] = found;
163
+ const importPath = displayName(index, best.entry.name);
164
+ const others = [...new Set(rest.map((match) => displayName(index, match.entry.name)))].filter((name) => name !== importPath);
165
+ return {
166
+ kind: 'pageObject',
167
+ importPath,
168
+ root: best.entry.root,
169
+ interface: best.entry.interface,
170
+ source: best.entry.source,
171
+ via: byRootSelector ? 'project root selector' : best.via,
172
+ ...(best.entry.outputFile ? { outputFile: best.entry.outputFile } : {}),
173
+ ...(others.length > 0 ? { others } : {}),
174
+ };
175
+ }
176
+ /** Walks the chain from the document to the target and works out each step's annotations. */
177
+ class PathBuilder {
178
+ snapshot;
179
+ index;
180
+ steps = [];
181
+ above = [];
182
+ reported = new Set();
183
+ roots;
184
+ constructor(snapshot, index) {
185
+ this.snapshot = snapshot;
186
+ this.index = index;
187
+ this.roots = index ? projectRoots(snapshot, index) : new Map();
188
+ }
189
+ add(entry, isTarget, inShadow) {
190
+ const { node } = entry;
191
+ const isCustom = node.tag.includes('-');
192
+ const projectRoot = this.roots.get(entry);
193
+ if (!isCustom && !isTarget && !node.hidden && !projectRoot)
194
+ return false;
195
+ const step = {
196
+ id: node.id,
197
+ tag: node.tag,
198
+ node: describeNode(node),
199
+ hidden: node.hidden === true,
200
+ target: isTarget,
201
+ };
202
+ if (inShadow)
203
+ step.inShadow = inShadow;
204
+ if (node.shadow?.mode === 'unreadable')
205
+ step.unreadable = true;
206
+ if (this.index && (isCustom || isTarget || projectRoot))
207
+ this.annotate(step, entry, isCustom, projectRoot);
208
+ this.steps.push(step);
209
+ return true;
210
+ }
211
+ annotate(step, entry, isCustom, projectRoot) {
212
+ const index = this.index;
213
+ const byTag = isCustom ? matchPageObjects(index, entry.node.tag) : [];
214
+ // A project root whose selector names the tag is already among the tag's matches.
215
+ const extraRoots = (projectRoot ?? []).filter((po) => !byTag.some((match) => match.entry === po));
216
+ const found = [...extraRoots.map((po) => ({ entry: po, via: 'root selector' })), ...byTag];
217
+ if (found.length > 0)
218
+ step.annotation = annotationFor(index, found, projectRoot !== undefined && !isCustom);
219
+ else if (isCustom)
220
+ step.annotation = { kind: 'none' };
221
+ const mismatches = projectScopeMismatches(this.snapshot, index, this.above, entry);
222
+ const fresh = mismatches.filter((m) => !this.reported.has(`${m.pageObject}|${m.element}`));
223
+ for (const m of fresh)
224
+ this.reported.add(`${m.pageObject}|${m.element}`);
225
+ if (fresh.length > 0)
226
+ step.scopeMismatches = fresh;
227
+ const through = reachable(index, this.above, entry);
228
+ if (through) {
229
+ // A route through a misdeclared element, or one nested in it, isn't one UTAM can follow.
230
+ for (const key of this.reported) {
231
+ const [pageObject, element] = key.split('|');
232
+ if (pageObject === through.pageObject &&
233
+ (through.element === element || through.element.startsWith(`${element}.`)))
234
+ through.brokenBy = element;
235
+ }
236
+ step.reachableThrough = through;
237
+ }
238
+ if (found.length === 0)
239
+ return;
240
+ this.above.push({ entries: found.map((m) => m.entry), node: entry });
241
+ // A shipped root reached through a project page object above it isn't loaded with utam.load, so
242
+ // its root selector's other matches don't matter.
243
+ const scopedByProject = through !== undefined && !through.brokenBy && this.isProject(through.pageObject);
244
+ if (found[0].entry.root && !scopedByProject) {
245
+ const check = rootSelectorCheck(this.snapshot, index, found[0].entry);
246
+ if (check)
247
+ step.rootSelectorMatches = check;
248
+ }
249
+ }
250
+ isProject(pageObject) {
251
+ const name = this.index.aliases.get(pageObject) ?? pageObject;
252
+ return this.index.entries.get(name)?.source === 'project';
253
+ }
254
+ }
255
+ function annotationText(annotation) {
256
+ if (annotation?.kind === 'none')
257
+ return 'no page object found';
258
+ if (annotation?.kind !== 'pageObject')
259
+ return '';
260
+ const flags = [
261
+ annotation.root ? 'root' : '',
262
+ annotation.interface ? 'interface' : '',
263
+ annotation.source === 'project' ? `project; compiled to ${annotation.outputFile ?? '?'}` : '',
264
+ annotation.via === 'convention' ? 'by naming convention' : '',
265
+ annotation.via === 'project root selector' ? 'its root selector matches here' : '',
266
+ ].filter(Boolean);
267
+ let text = `${annotation.importPath}${flags.length > 0 ? ` (${flags.join(', ')})` : ''}`;
268
+ if (annotation.others)
269
+ text += ` [also: ${annotation.others.slice(0, 3).join(', ')}${annotation.others.length > 3 ? ', …' : ''}]`;
270
+ return text;
271
+ }
272
+ function stepLines(step, depth) {
273
+ const indent = ' '.repeat(depth);
274
+ const lines = [];
275
+ if (step.inShadow)
276
+ lines.push(`${indent}#shadow(${step.inShadow})`);
277
+ let label = `${indent}${clip(step.node, 70)}`;
278
+ if (step.hidden)
279
+ label += ' (hidden)';
280
+ if (step.target)
281
+ label += ` ← target [${step.id}]`;
282
+ const text = annotationText(step.annotation);
283
+ lines.push(text ? `${label.padEnd(44)} ${text}` : label);
284
+ if (step.unreadable)
285
+ lines.push(`${indent} ⚠ unreadable shadow root, most likely closed: UTAM selectors can't reach inside it.`);
286
+ if (step.rootSelectorMatches) {
287
+ const r = step.rootSelectorMatches;
288
+ lines.push(`${indent} ⚠ root selector "${clip(r.selector, 60)}" matches ${r.count} in the document; utam.load takes the first, ${r.first}${r.firstHidden ? ' (hidden)' : ''}. See find --css ${shellQuote(r.selector)}.`);
289
+ }
290
+ for (const m of step.scopeMismatches ?? []) {
291
+ const [declared, other] = m.declared === 'light' ? ['elements', 'shadow.elements'] : ['shadow.elements', 'elements'];
292
+ const where = m.declared === 'light' ? `${m.parent}'s shadow root` : `${m.parent}'s light DOM`;
293
+ const subject = m.via
294
+ ? `element "${m.via}" can't be found: the element it's nested in, "${m.element}" "${clip(m.selector, 60)}",`
295
+ : `element "${m.element}" "${clip(m.selector, 60)}"`;
296
+ lines.push(`${indent} ⚠ ${m.pageObject}: ${subject} is declared in ${declared}, but ${m.found} is in ${where}. Move it to ${other}.`);
297
+ }
298
+ if (step.reachableThrough) {
299
+ const r = step.reachableThrough;
300
+ const holder = r.implementation ? `${r.pageObject} (in its implementation ${r.implementation})` : r.pageObject;
301
+ const kind = `${r.public ? 'public' : 'private'}${r.container ? ' container' : ''}, ${r.scope}`;
302
+ const use = r.public ? r.use.join(', ') : `used by ${r.use.length > 0 ? r.use.join(', ') : 'no public method'}`;
303
+ const route = `${holder}, element "${r.element}" "${clip(r.selector, 60)}" (${kind}, ${use})`;
304
+ lines.push(r.brokenBy
305
+ ? `${indent} ↳ not reachable as declared: ${route}. It runs through "${r.brokenBy}", which is in the wrong scope (⚠ above).`
306
+ : `${indent} ↳ reachable through ${route}`);
307
+ }
308
+ return lines;
309
+ }
310
+ /**
311
+ * The custom elements from the document down to a node, with shadow crossings, hidden ancestors,
312
+ * and what the page-object index knows about each: its page object, a likely route through a page
313
+ * object above it, a root selector that matches more than one copy, and an element of your own page
314
+ * objects declared in the wrong scope.
315
+ *
316
+ * @param snapshot The snapshot.
317
+ * @param handle The target node's handle.
318
+ * @param options The page-object index, and the output limit.
319
+ */
320
+ export function componentPath(snapshot, handle, options = {}) {
321
+ const chain = [];
322
+ for (let entry = getNode(snapshot, handle); entry; entry = entry.parent)
323
+ chain.unshift(entry);
324
+ const builder = new PathBuilder(snapshot, options.index);
325
+ let pendingShadow;
326
+ for (const [i, entry] of chain.entries()) {
327
+ if (entry.viaShadow)
328
+ pendingShadow = entry.parent?.node.shadow?.mode;
329
+ if (builder.add(entry, i === chain.length - 1, pendingShadow))
330
+ pendingShadow = undefined;
331
+ }
332
+ const lines = builder.steps.flatMap((step, depth) => stepLines(step, depth));
333
+ return {
334
+ lines: limitLines(lines, options.limit ?? DEFAULT_OUTPUT_LIMIT, 'Use tree on a node lower down.'),
335
+ json: { target: handle, steps: builder.steps },
336
+ };
337
+ }
338
+ /**
339
+ * The path to the only visible node matching `text`. With no visible match, or more than one, it
340
+ * prints no path: it lists the candidates and returns exit code 1, so the caller picks one.
341
+ *
342
+ * @param snapshot The snapshot.
343
+ * @param text The text to find, as `find --text` matches it.
344
+ * @param options The page-object index, and the output limit.
345
+ */
346
+ export function componentPathByText(snapshot, text, options = {}) {
347
+ const limit = options.limit ?? DEFAULT_OUTPUT_LIMIT;
348
+ const found = findNodes(snapshot, { text, all: true, limit: Number.MAX_SAFE_INTEGER });
349
+ const { visible, hidden } = found.json;
350
+ if (visible.length === 1) {
351
+ // The limit applies to the whole output, the hidden-matches line included.
352
+ const result = componentPath(snapshot, visible[0].id, { ...options, limit: Number.MAX_SAFE_INTEGER });
353
+ if (hidden.length > 0)
354
+ result.lines.push(`${hidden.length} hidden matches for "${text}" also exist; see \`find --text "${text}" --all\`.`);
355
+ return { ...result, lines: limitLines(result.lines, limit, 'Use tree on a node lower down.'), exitCode: 0 };
356
+ }
357
+ const command = (id) => `npx simply-utam snapshot path --node ${id}`;
358
+ let lines;
359
+ if (visible.length === 0 && hidden.length === 0) {
360
+ lines = [`No path printed: nothing matches "${text}". Try find with a shorter label, --tag or --attr.`];
361
+ }
362
+ else if (visible.length === 0) {
363
+ lines = [
364
+ `No path printed: "${text}" matches only hidden nodes (${hidden.length}), and path --text needs a visible one.`,
365
+ `List them with \`npx simply-utam snapshot find --text "${text}" --all\`, then run, for example:`,
366
+ ` ${command(hidden[0].id)}`,
367
+ ];
368
+ }
369
+ else {
370
+ lines = [
371
+ `No path printed: "${text}" has ${visible.length} visible matches, and path --text needs exactly one.`,
372
+ 'Pick the one you want below and run path with its handle, for example:',
373
+ ` ${command(visible[0].id)}`,
374
+ 'Candidates (visible, in document order):',
375
+ ...found.lines.slice(1, 1 + visible.length).map((line) => ` ${line}`),
376
+ ...(hidden.length > 0 ? [`(${hidden.length} hidden matches too; find --all lists them.)`] : []),
377
+ ];
378
+ }
379
+ return { lines: limitLines(lines, limit, 'Narrow the text.'), json: { candidates: found.json }, exitCode: 1 };
380
+ }
381
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/snapshot/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAmB,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,SAAS,GAKV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAA6C,MAAM,mBAAmB,CAAC;AAChH,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE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AAK,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AAChH,CAAC"}
@@ -0,0 +1,20 @@
1
+ /** The default cap on a query's text output, in lines. */
2
+ export declare const DEFAULT_OUTPUT_LIMIT = 200;
3
+ /** A query's result: lines to print, and the same answer as data. */
4
+ export type QueryResult<T> = {
5
+ lines: string[];
6
+ json: T;
7
+ };
8
+ /** Options every query with text output takes. */
9
+ export type QueryOutputOptions = {
10
+ /** The text output limit in lines. Defaults to `DEFAULT_OUTPUT_LIMIT`. */
11
+ limit?: number;
12
+ };
13
+ /**
14
+ * Cut text output at `limit` lines, with a last line saying how much was left out and what to do.
15
+ *
16
+ * @param lines The full output.
17
+ * @param requested The output limit in lines; below 1 counts as 1.
18
+ * @param hint What to do to see the rest.
19
+ */
20
+ export declare function limitLines(lines: string[], requested: number, hint: string): string[];
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (c) 2026, SimplySF.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /** The default cap on a query's text output, in lines. */
17
+ export const DEFAULT_OUTPUT_LIMIT = 200;
18
+ /**
19
+ * Cut text output at `limit` lines, with a last line saying how much was left out and what to do.
20
+ *
21
+ * @param lines The full output.
22
+ * @param requested The output limit in lines; below 1 counts as 1.
23
+ * @param hint What to do to see the rest.
24
+ */
25
+ export function limitLines(lines, requested, hint) {
26
+ // At least one line, whatever was asked for.
27
+ const limit = Math.max(1, Math.floor(requested));
28
+ if (lines.length <= limit)
29
+ return lines;
30
+ return [...lines.slice(0, limit), `… ${lines.length - limit} more lines not shown (output limit ${limit}). ${hint}`];
31
+ }
32
+ //# sourceMappingURL=query-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-result.js","sourceRoot":"","sources":["../../src/snapshot/query-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAWxC;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAe,EAAE,SAAiB,EAAE,IAAY;IACzE,6CAA6C;IAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACjD,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,MAAM,GAAG,KAAK,uCAAuC,KAAK,MAAM,IAAI,EAAE,CAAC,CAAC;AACvH,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { type Options } from 'css-select';
2
+ import { type DomSnapshot } from './format.js';
3
+ import { type FoundNode, type Located } from './locate.js';
4
+ /** An own attribute's value, so a name like `constructor` isn't read off the object's prototype. */
5
+ export declare function attribute(attrs: Record<string, string> | undefined, name: string): string | undefined;
6
+ type Adapter = NonNullable<Options<Located, Located>['adapter']>;
7
+ /** The adapter, exported for its tests: `compile` uses only part of it, and `selectAll` the rest. */
8
+ export declare const adapter: Adapter;
9
+ /** A selector made ready to check against a snapshot, with what it can't check. */
10
+ export type PreparedSelector = {
11
+ selector: string;
12
+ notes: string[];
13
+ };
14
+ /**
15
+ * Rewrite a page object's selector for the snapshot: `%s`/`%d` placeholders in an attribute test or
16
+ * a child-position argument match any value, and live-state pseudo-classes are dropped. Says what it
17
+ * changed.
18
+ *
19
+ * @param selector The CSS selector, as a page object or a user writes it.
20
+ */
21
+ export declare function prepareSelector(selector: string): PreparedSelector;
22
+ /**
23
+ * The plain tags, classes and ids a selector names that no node in the snapshot has. Such a name may be
24
+ * on a plain wrapper the snapshot pruned, so the live page can match where the snapshot doesn't.
25
+ *
26
+ * @param snapshot The snapshot.
27
+ * @param selector The selector, already through {@link prepareSelector}.
28
+ */
29
+ export declare function unseenNames(snapshot: DomSnapshot, selector: string): string[];
30
+ /**
31
+ * Whether a node matches a selector, ancestors included, within the node's own tree scope.
32
+ *
33
+ * @param node The node.
34
+ * @param selector The selector, already through {@link prepareSelector}.
35
+ */
36
+ export declare function nodeMatchesSelector(node: Located, selector: string): boolean;
37
+ /** Where a selector is searched, as UTAM searches it. */
38
+ export type SelectorScope =
39
+ /** A root page object's selector: the document. */
40
+ {
41
+ kind: 'document';
42
+ }
43
+ /** An element under a page object's `shadow`: the host's shadow root. */
44
+ | {
45
+ kind: 'shadow';
46
+ within: string;
47
+ }
48
+ /** An element under a page object's `elements`: the host's light descendants. */
49
+ | {
50
+ kind: 'light';
51
+ within: string;
52
+ };
53
+ export type SelectorMatches = {
54
+ /** Matches in document order: the first is what `findElement` returns. */
55
+ matches: FoundNode[];
56
+ /** What the snapshot can't judge about the selector, such as placeholders and live state. */
57
+ notes: string[];
58
+ /** Attributes the selector tests whose value is masked on some node in scope. */
59
+ maskedAttributes: string[];
60
+ };
61
+ /** {@link SelectorMatches} with the located nodes, for the other queries. */
62
+ export type LocatedMatches = Omit<SelectorMatches, 'matches'> & {
63
+ matches: Located[];
64
+ };
65
+ /**
66
+ * The nodes a selector matches in a scope, as {@link matchSelector} finds them but without its notes,
67
+ * and none for a selector that can't be read or a scope that isn't in the snapshot: for checking
68
+ * page objects' selectors, where one that can't be checked is skipped.
69
+ *
70
+ * @param snapshot The snapshot.
71
+ * @param selector The CSS selector, as a page object writes it.
72
+ * @param scope Where to search.
73
+ */
74
+ export declare function scopeMatches(snapshot: DomSnapshot, selector: string, scope: SelectorScope): Located[];
75
+ /**
76
+ * Every node a selector matches in a scope, in document order, as `querySelectorAll` would find them:
77
+ * combinators don't cross shadow roots, and ancestors above the scope still count. The first match
78
+ * is the one UTAM's `findElement`, and `utam.load` for a root selector, takes.
79
+ *
80
+ * @param snapshot The snapshot.
81
+ * @param selector The CSS selector, as a page object or a person writes it.
82
+ * @param scope Where to search; the document when omitted.
83
+ */
84
+ export declare function querySnapshot(snapshot: DomSnapshot, selector: string, scope?: SelectorScope): SelectorMatches;
85
+ /** The attributes a selector tests the values of, such as `title` in `[title="Edit"]`. */
86
+ export declare function testedAttributes(selector: string): string[];
87
+ /**
88
+ * For a selector that tests accessible names this snapshot's mask hides, the line telling the reader
89
+ * to recapture with `aria`; undefined otherwise.
90
+ *
91
+ * @param snapshot The snapshot.
92
+ * @param attributes The attributes the selector tests.
93
+ */
94
+ export declare function recaptureForNames(snapshot: DomSnapshot, attributes: string[]): string | undefined;
95
+ /**
96
+ * {@link querySnapshot}, keeping the located nodes.
97
+ *
98
+ * @param snapshot The snapshot.
99
+ * @param selector The CSS selector.
100
+ * @param scope Where to search; the document when omitted.
101
+ */
102
+ export declare function matchSelector(snapshot: DomSnapshot, selector: string, scope?: SelectorScope): LocatedMatches;
103
+ export {};