@whenessel/seql-js 1.1.1 → 1.2.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/seql-js.d.ts +64 -0
- package/dist/seql-js.js +666 -433
- package/dist/seql-js.js.map +1 -1
- package/dist/seql-js.umd.cjs +1 -1
- package/dist/seql-js.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/seql-js.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export declare class AnchorFinder {
|
|
|
11
11
|
* Finds the best anchor element for the target
|
|
12
12
|
* @param target - Target element to find anchor for
|
|
13
13
|
* @returns Anchor result or null if not found
|
|
14
|
+
* @remarks
|
|
15
|
+
* Special handling for root elements (html, head, body):
|
|
16
|
+
* - For html: returns html itself as anchor
|
|
17
|
+
* - For head or elements inside head: returns html as anchor
|
|
18
|
+
* - For body: returns html as anchor
|
|
14
19
|
*/
|
|
15
20
|
findAnchor(target: Element): AnchorResult | null;
|
|
16
21
|
/**
|
|
@@ -28,6 +33,25 @@ export declare class AnchorFinder {
|
|
|
28
33
|
* Determines the tier of an anchor element
|
|
29
34
|
*/
|
|
30
35
|
private getTier;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if element is inside <head> section.
|
|
38
|
+
* Stops at <body> to avoid false positives.
|
|
39
|
+
* @param element - Element to check
|
|
40
|
+
* @returns True if element is inside head, false otherwise
|
|
41
|
+
* @remarks
|
|
42
|
+
* Traverses up the DOM tree until finding head or body.
|
|
43
|
+
* Returns false if body is encountered first.
|
|
44
|
+
* @example
|
|
45
|
+
* const meta = document.querySelector('meta');
|
|
46
|
+
* if (isInsideHead(meta)) { ... }
|
|
47
|
+
*/
|
|
48
|
+
private isInsideHead;
|
|
49
|
+
/**
|
|
50
|
+
* Caches the anchor result for the target element
|
|
51
|
+
* @param target - Target element
|
|
52
|
+
* @param result - Anchor result to cache
|
|
53
|
+
*/
|
|
54
|
+
private cacheResult;
|
|
31
55
|
}
|
|
32
56
|
|
|
33
57
|
/**
|
|
@@ -400,6 +424,20 @@ export declare class CssGenerator {
|
|
|
400
424
|
* @returns True if element is an SVG child
|
|
401
425
|
*/
|
|
402
426
|
private isSvgChildElement;
|
|
427
|
+
/**
|
|
428
|
+
* Builds CSS selector for elements inside <head>.
|
|
429
|
+
* Uses child combinator (>) for strict structure: html > head > ... > target
|
|
430
|
+
* @param eid - Element Identity with anchor=html and path[0]=head
|
|
431
|
+
* @param options - Optional uniqueness control settings
|
|
432
|
+
* @returns CSS selector string or BuildSelectorResult
|
|
433
|
+
* @remarks
|
|
434
|
+
* This method handles the special case where elements are inside <head>.
|
|
435
|
+
* The selector always uses child combinators for strict parent-child relationships.
|
|
436
|
+
* @example
|
|
437
|
+
* For <html><head><meta name="description"></head></html>
|
|
438
|
+
* Returns: "html > head > meta[name='description']"
|
|
439
|
+
*/
|
|
440
|
+
private buildHeadSelector;
|
|
403
441
|
}
|
|
404
442
|
|
|
405
443
|
/**
|
|
@@ -774,6 +812,10 @@ export declare class PathBuilder {
|
|
|
774
812
|
* @param target - Target element (end)
|
|
775
813
|
* @param extractor - Semantic extractor instance
|
|
776
814
|
* @returns Path build result with nodes and degradation info
|
|
815
|
+
* @remarks
|
|
816
|
+
* Special handling for root elements:
|
|
817
|
+
* - If anchor is html and target is head/body: returns empty path
|
|
818
|
+
* - If anchor is html and target is inside head: builds path through head
|
|
777
819
|
*/
|
|
778
820
|
buildPath(anchor: Element, target: Element, extractor: SemanticExtractor): PathBuildResult;
|
|
779
821
|
/**
|
|
@@ -809,6 +851,28 @@ export declare class PathBuilder {
|
|
|
809
851
|
* Checks if element has meaningful semantic features
|
|
810
852
|
*/
|
|
811
853
|
private hasSemanticFeatures;
|
|
854
|
+
/**
|
|
855
|
+
* Checks if element is inside <head> section.
|
|
856
|
+
* Stops at <body> to avoid false positives.
|
|
857
|
+
* @param element - Element to check
|
|
858
|
+
* @returns True if element is inside head, false otherwise
|
|
859
|
+
* @remarks
|
|
860
|
+
* Traverses up the DOM tree until finding head or body.
|
|
861
|
+
* Returns false if body is encountered first.
|
|
862
|
+
*/
|
|
863
|
+
private isInsideHead;
|
|
864
|
+
/**
|
|
865
|
+
* Builds path from html to target through head element.
|
|
866
|
+
* Always includes head in the path for correct CSS selector generation.
|
|
867
|
+
* @param htmlElement - The html element (anchor)
|
|
868
|
+
* @param target - Target element inside head
|
|
869
|
+
* @param extractor - Semantic extractor instance
|
|
870
|
+
* @returns Path build result with head and intermediate nodes
|
|
871
|
+
* @example
|
|
872
|
+
* For <html><head><meta name="description"></head></html>
|
|
873
|
+
* Returns path: [head]
|
|
874
|
+
*/
|
|
875
|
+
private buildHeadPath;
|
|
812
876
|
}
|
|
813
877
|
|
|
814
878
|
/**
|