@gemx-dev/clarity-visualize 0.8.70 → 0.8.72
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.
|
@@ -66,7 +66,6 @@ function reset$8() {
|
|
|
66
66
|
}
|
|
67
67
|
function config$2(classNames) {
|
|
68
68
|
extraExcludeClassNames = classNames || [];
|
|
69
|
-
console.log("[Selector] config called \u2014 extraExcludeClassNames set to: [".concat(extraExcludeClassNames.join(', '), "]"));
|
|
70
69
|
}
|
|
71
70
|
function get$1(input, type) {
|
|
72
71
|
var a = input.attributes;
|
|
@@ -92,10 +91,10 @@ function get$1(input, type) {
|
|
|
92
91
|
var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
|
|
93
92
|
var rawClasses = "class" /* Constant.Class */ in a ? a["class" /* Constant.Class */].trim().split(/\s+/) : [];
|
|
94
93
|
var filteredClasses = rawClasses.filter(function (c) { return filter(c); });
|
|
95
|
-
|
|
96
|
-
if (removedClasses.length > 0) {
|
|
97
|
-
|
|
98
|
-
}
|
|
94
|
+
// const removedClasses = rawClasses.filter(c => !filter(c));
|
|
95
|
+
// if (removedClasses.length > 0) {
|
|
96
|
+
// console.log(`[Selector] tag="${input.tag}" id="${input.id}" — removed classes: [${removedClasses.join(', ')}] | kept: [${filteredClasses.join(', ')}] | extraExclude: [${extraExcludeClassNames.join(', ')}]`);
|
|
97
|
+
// }
|
|
99
98
|
var classes = input.tag !== "BODY" /* Constant.BodyTag */ && filteredClasses.length > 0 ? filteredClasses.join("." /* Constant.Period */) : null;
|
|
100
99
|
if (classes && classes.length > 0) {
|
|
101
100
|
if (type === 0 /* Selector.Alpha */) {
|
|
@@ -1668,6 +1667,35 @@ class LayoutHelper {
|
|
|
1668
1667
|
// Reset dialog render state for new render cycle
|
|
1669
1668
|
resetDialogRenderState();
|
|
1670
1669
|
};
|
|
1670
|
+
/** Rebuild internal node/hash maps from a pre-rendered document (used for HTML cache restore). */
|
|
1671
|
+
this.hydrate = (doc) => {
|
|
1672
|
+
this.nodes = {};
|
|
1673
|
+
this.hashMapAlpha = {};
|
|
1674
|
+
this.hashMapBeta = {};
|
|
1675
|
+
// querySelectorAll does not include documentElement itself
|
|
1676
|
+
const htmlEl = doc.documentElement;
|
|
1677
|
+
if (htmlEl === null || htmlEl === void 0 ? void 0 : htmlEl.hasAttribute("data-clarity-id" /* Constant.Id */)) {
|
|
1678
|
+
const id = parseInt(htmlEl.getAttribute("data-clarity-id" /* Constant.Id */), 10);
|
|
1679
|
+
if (!isNaN(id) && id > 0) {
|
|
1680
|
+
this.nodes[id] = htmlEl;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
const elements = doc.querySelectorAll(`[${"data-clarity-id" /* Constant.Id */}]`);
|
|
1684
|
+
for (const el of Array.from(elements)) {
|
|
1685
|
+
const id = parseInt(el.getAttribute("data-clarity-id" /* Constant.Id */), 10);
|
|
1686
|
+
if (!isNaN(id) && id > 0) {
|
|
1687
|
+
this.nodes[id] = el;
|
|
1688
|
+
const ha = el.getAttribute("data-clarity-hashalpha" /* Constant.HashAlpha */);
|
|
1689
|
+
const hb = el.getAttribute("data-clarity-hashbeta" /* Constant.HashBeta */);
|
|
1690
|
+
if (ha) {
|
|
1691
|
+
this.hashMapAlpha[ha] = el;
|
|
1692
|
+
}
|
|
1693
|
+
if (hb) {
|
|
1694
|
+
this.hashMapBeta[hb] = el;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
};
|
|
1671
1699
|
this.get = (hash) => {
|
|
1672
1700
|
if (hash in this.hashMapBeta && this.hashMapBeta[hash].isConnected) {
|
|
1673
1701
|
return this.hashMapBeta[hash];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gemx-dev/clarity-visualize",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.72",
|
|
4
4
|
"description": "Clarity visualize",
|
|
5
5
|
"author": "Microsoft Corp.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"unpkg": "build/clarity.visualize.min.js",
|
|
10
10
|
"types": "types/index.d.ts",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@gemx-dev/clarity-decode": "^0.8.
|
|
12
|
+
"@gemx-dev/clarity-decode": "^0.8.72"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@rollup/plugin-commonjs": "^24.0.0",
|
package/src/layout.ts
CHANGED
|
@@ -146,6 +146,30 @@ export class LayoutHelper {
|
|
|
146
146
|
dialogCustom.resetDialogRenderState();
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
/** Rebuild internal node/hash maps from a pre-rendered document (used for HTML cache restore). */
|
|
150
|
+
public hydrate = (doc: Document): void => {
|
|
151
|
+
this.nodes = {};
|
|
152
|
+
this.hashMapAlpha = {};
|
|
153
|
+
this.hashMapBeta = {};
|
|
154
|
+
// querySelectorAll does not include documentElement itself
|
|
155
|
+
const htmlEl = doc.documentElement;
|
|
156
|
+
if (htmlEl?.hasAttribute(Constant.Id)) {
|
|
157
|
+
const id = parseInt(htmlEl.getAttribute(Constant.Id), 10);
|
|
158
|
+
if (!isNaN(id) && id > 0) { this.nodes[id] = htmlEl; }
|
|
159
|
+
}
|
|
160
|
+
const elements = doc.querySelectorAll(`[${Constant.Id}]`);
|
|
161
|
+
for (const el of Array.from(elements)) {
|
|
162
|
+
const id = parseInt(el.getAttribute(Constant.Id), 10);
|
|
163
|
+
if (!isNaN(id) && id > 0) {
|
|
164
|
+
this.nodes[id] = el;
|
|
165
|
+
const ha = el.getAttribute(Constant.HashAlpha);
|
|
166
|
+
const hb = el.getAttribute(Constant.HashBeta);
|
|
167
|
+
if (ha) { this.hashMapAlpha[ha] = el as HTMLElement; }
|
|
168
|
+
if (hb) { this.hashMapBeta[hb] = el as HTMLElement; }
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
149
173
|
public get = (hash) => {
|
|
150
174
|
if (hash in this.hashMapBeta && this.hashMapBeta[hash].isConnected) {
|
|
151
175
|
return this.hashMapBeta[hash];
|
package/types/visualize.d.ts
CHANGED
|
@@ -31,6 +31,13 @@ export class Visualizer {
|
|
|
31
31
|
configure: (opts: { excludeClassNames?: string[] }) => void;
|
|
32
32
|
time: () => number;
|
|
33
33
|
get: (hash: string) => HTMLElement;
|
|
34
|
+
layout: {
|
|
35
|
+
styleChange: (entry: Layout.StyleSheetEvent) => void;
|
|
36
|
+
customElement: (entry: Layout.CustomElementEvent) => void;
|
|
37
|
+
markup: (event: Layout.DomEvent, useproxy?: LinkHandler) => void;
|
|
38
|
+
};
|
|
39
|
+
mergeForHtml: (decoded: Data.DecodedPayload[]) => MergedPayload;
|
|
40
|
+
shortCircuitRendering: (strategy: ShortCircuitStrategy, domEvent: Layout.DomEvent, hash: string | null) => boolean;
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
export type ResizeHandler = (width: number, height: number) => void;
|