@whenessel/seql-js 1.5.0 → 1.6.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 +57 -5
- package/dist/seql-js.js +613 -525
- package/dist/seql-js.js.map +1 -1
- package/dist/seql-js.umd.cjs +3 -3
- package/dist/seql-js.umd.cjs.map +1 -1
- package/package.json +2 -2
package/dist/seql-js.d.ts
CHANGED
|
@@ -457,7 +457,7 @@ export declare const DEFAULT_GENERATOR_OPTIONS: Omit<Required<GeneratorOptions>,
|
|
|
457
457
|
/**
|
|
458
458
|
* Default resolver options
|
|
459
459
|
*/
|
|
460
|
-
export declare const DEFAULT_RESOLVER_OPTIONS: Omit<Required<ResolverOptions>, 'root'> & Pick<ResolverOptions, 'root'>;
|
|
460
|
+
export declare const DEFAULT_RESOLVER_OPTIONS: Omit<Required<ResolverOptions>, 'root' | 'documentUrl'> & Pick<ResolverOptions, 'root' | 'documentUrl'>;
|
|
461
461
|
|
|
462
462
|
/**
|
|
463
463
|
* EID specification version
|
|
@@ -993,6 +993,48 @@ export declare interface ResolverOptions {
|
|
|
993
993
|
* resolve(eid, iframe.contentDocument, { root: iframe.contentDocument });
|
|
994
994
|
*/
|
|
995
995
|
root?: Document | Element;
|
|
996
|
+
/**
|
|
997
|
+
* Document base URL for URL normalization.
|
|
998
|
+
* Used when comparing href/src attributes to provide correct origin context.
|
|
999
|
+
*
|
|
1000
|
+
* ⚠️ IMPORTANT: When working with iframes, this should match iframe.contentWindow.location.href
|
|
1001
|
+
* to ensure correct same-origin detection.
|
|
1002
|
+
*
|
|
1003
|
+
* If not provided, falls back to root.defaultView?.location?.href or window.location.href.
|
|
1004
|
+
*
|
|
1005
|
+
* @example
|
|
1006
|
+
* // Iframe context
|
|
1007
|
+
* const iframe = document.querySelector('iframe');
|
|
1008
|
+
* resolve(eid, iframe.contentDocument, {
|
|
1009
|
+
* root: iframe.contentDocument,
|
|
1010
|
+
* documentUrl: iframe.contentWindow.location.href
|
|
1011
|
+
* });
|
|
1012
|
+
*
|
|
1013
|
+
* @example
|
|
1014
|
+
* // Manual override for testing
|
|
1015
|
+
* resolve(eid, document, {
|
|
1016
|
+
* documentUrl: 'https://example.com'
|
|
1017
|
+
* });
|
|
1018
|
+
*/
|
|
1019
|
+
documentUrl?: string;
|
|
1020
|
+
/**
|
|
1021
|
+
* Match URLs by pathname only, ignoring origin differences.
|
|
1022
|
+
* Useful for cross-origin rrweb replay scenarios (e.g., localhost dev with production links).
|
|
1023
|
+
*
|
|
1024
|
+
* When enabled (default):
|
|
1025
|
+
* - /booking matches https://any-origin.com/booking
|
|
1026
|
+
* - Ignores protocol and domain differences
|
|
1027
|
+
* - Compares only pathname (+ search + hash if present)
|
|
1028
|
+
* - Recommended for rrweb replay and development environments
|
|
1029
|
+
*
|
|
1030
|
+
* When disabled:
|
|
1031
|
+
* - Full URL normalization with same-origin detection
|
|
1032
|
+
* - Cross-origin URLs preserved as absolute
|
|
1033
|
+
* - More strict origin validation
|
|
1034
|
+
*
|
|
1035
|
+
* @default true
|
|
1036
|
+
*/
|
|
1037
|
+
matchUrlsByPathOnly?: boolean;
|
|
996
1038
|
}
|
|
997
1039
|
|
|
998
1040
|
/**
|
|
@@ -1128,11 +1170,15 @@ export declare class SemanticsMatcher {
|
|
|
1128
1170
|
* Filters elements that match the semantics
|
|
1129
1171
|
* @param elements - Candidate elements
|
|
1130
1172
|
* @param semantics - Target semantics to match
|
|
1173
|
+
* @param documentUrl - Optional document base URL for URL normalization (iframe context)
|
|
1174
|
+
* @param matchUrlsByPathOnly - Optional flag to match URLs by pathname only (ignoring origin)
|
|
1131
1175
|
* @returns Filtered elements that match
|
|
1132
1176
|
*/
|
|
1133
|
-
match(elements: Element[], semantics: ElementSemantics): Element[];
|
|
1177
|
+
match(elements: Element[], semantics: ElementSemantics, documentUrl?: string, matchUrlsByPathOnly?: boolean): Element[];
|
|
1134
1178
|
/**
|
|
1135
1179
|
* Checks if a single element matches the semantics
|
|
1180
|
+
* @param documentUrl - Optional document base URL for URL normalization (iframe context)
|
|
1181
|
+
* @param matchUrlsByPathOnly - Optional flag to match URLs by pathname only (ignoring origin)
|
|
1136
1182
|
*/
|
|
1137
1183
|
private matchElement;
|
|
1138
1184
|
/**
|
|
@@ -1147,16 +1193,22 @@ export declare class SemanticsMatcher {
|
|
|
1147
1193
|
private matchTextLenient;
|
|
1148
1194
|
/**
|
|
1149
1195
|
* Checks if a single element matches the semantics with lenient text matching
|
|
1196
|
+
* @param documentUrl - Optional document base URL for URL normalization (iframe context)
|
|
1197
|
+
* @param matchUrlsByPathOnly - Optional flag to match URLs by pathname only (ignoring origin)
|
|
1150
1198
|
*/
|
|
1151
1199
|
private matchElementLenient;
|
|
1152
1200
|
/**
|
|
1153
1201
|
* Filters elements with lenient matching (exported for use in resolver)
|
|
1202
|
+
* @param documentUrl - Optional document base URL for URL normalization (iframe context)
|
|
1203
|
+
* @param matchUrlsByPathOnly - Optional flag to match URLs by pathname only (ignoring origin)
|
|
1154
1204
|
*/
|
|
1155
|
-
matchLenient(elements: Element[], semantics: ElementSemantics): Element[];
|
|
1205
|
+
matchLenient(elements: Element[], semantics: ElementSemantics, documentUrl?: string, matchUrlsByPathOnly?: boolean): Element[];
|
|
1156
1206
|
/**
|
|
1157
|
-
* Matches attributes
|
|
1207
|
+
* Matches attributes with URL normalization for href/src
|
|
1208
|
+
* @param documentUrl - Optional document base URL for URL normalization (iframe context)
|
|
1209
|
+
* @param matchUrlsByPathOnly - Optional flag to match URLs by pathname only (ignoring origin, default: true)
|
|
1158
1210
|
*/
|
|
1159
|
-
matchAttributes(element: Element, attrs: Record<string, string
|
|
1211
|
+
matchAttributes(element: Element, attrs: Record<string, string>, documentUrl?: string, matchUrlsByPathOnly?: boolean): boolean;
|
|
1160
1212
|
/**
|
|
1161
1213
|
* Matches SVG fingerprint
|
|
1162
1214
|
*/
|