clarity-js 0.8.11-beta → 0.8.11

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 (90) hide show
  1. package/.lintstagedrc.yml +3 -0
  2. package/biome.json +43 -0
  3. package/build/clarity.extended.js +1 -1
  4. package/build/clarity.insight.js +1 -1
  5. package/build/clarity.js +3182 -2963
  6. package/build/clarity.min.js +1 -1
  7. package/build/clarity.module.js +3182 -2963
  8. package/build/clarity.performance.js +1 -1
  9. package/package.json +76 -69
  10. package/rollup.config.ts +84 -88
  11. package/src/clarity.ts +34 -28
  12. package/src/core/config.ts +2 -2
  13. package/src/core/event.ts +36 -32
  14. package/src/core/hash.ts +5 -6
  15. package/src/core/history.ts +10 -11
  16. package/src/core/index.ts +21 -11
  17. package/src/core/measure.ts +9 -5
  18. package/src/core/report.ts +9 -5
  19. package/src/core/scrub.ts +29 -20
  20. package/src/core/task.ts +73 -45
  21. package/src/core/time.ts +3 -3
  22. package/src/core/timeout.ts +2 -2
  23. package/src/core/version.ts +1 -1
  24. package/src/data/baseline.ts +60 -55
  25. package/src/data/consent.ts +2 -2
  26. package/src/data/custom.ts +8 -13
  27. package/src/data/dimension.ts +11 -7
  28. package/src/data/encode.ts +36 -30
  29. package/src/data/envelope.ts +38 -38
  30. package/src/data/extract.ts +86 -77
  31. package/src/data/index.ts +10 -6
  32. package/src/data/limit.ts +1 -1
  33. package/src/data/metadata.ts +305 -266
  34. package/src/data/metric.ts +18 -8
  35. package/src/data/ping.ts +8 -4
  36. package/src/data/signal.ts +18 -18
  37. package/src/data/summary.ts +6 -4
  38. package/src/data/token.ts +10 -8
  39. package/src/data/upgrade.ts +7 -3
  40. package/src/data/upload.ts +100 -49
  41. package/src/data/variable.ts +27 -20
  42. package/src/diagnostic/encode.ts +2 -2
  43. package/src/diagnostic/fraud.ts +3 -4
  44. package/src/diagnostic/internal.ts +11 -5
  45. package/src/diagnostic/script.ts +12 -8
  46. package/src/global.ts +1 -1
  47. package/src/insight/blank.ts +4 -4
  48. package/src/insight/encode.ts +23 -17
  49. package/src/insight/snapshot.ts +57 -37
  50. package/src/interaction/change.ts +9 -6
  51. package/src/interaction/click.ts +34 -28
  52. package/src/interaction/clipboard.ts +2 -2
  53. package/src/interaction/encode.ts +35 -31
  54. package/src/interaction/input.ts +11 -9
  55. package/src/interaction/pointer.ts +42 -31
  56. package/src/interaction/resize.ts +5 -5
  57. package/src/interaction/scroll.ts +21 -18
  58. package/src/interaction/selection.ts +12 -8
  59. package/src/interaction/submit.ts +2 -2
  60. package/src/interaction/timeline.ts +13 -9
  61. package/src/interaction/unload.ts +1 -1
  62. package/src/interaction/visibility.ts +2 -2
  63. package/src/layout/animation.ts +47 -41
  64. package/src/layout/discover.ts +5 -5
  65. package/src/layout/document.ts +31 -19
  66. package/src/layout/dom.ts +141 -91
  67. package/src/layout/encode.ts +52 -37
  68. package/src/layout/mutation.ts +321 -318
  69. package/src/layout/node.ts +104 -81
  70. package/src/layout/offset.ts +7 -6
  71. package/src/layout/region.ts +67 -44
  72. package/src/layout/schema.ts +15 -8
  73. package/src/layout/selector.ts +47 -25
  74. package/src/layout/style.ts +44 -36
  75. package/src/layout/target.ts +14 -10
  76. package/src/layout/traverse.ts +17 -11
  77. package/src/performance/blank.ts +1 -1
  78. package/src/performance/encode.ts +4 -4
  79. package/src/performance/interaction.ts +58 -70
  80. package/src/performance/navigation.ts +2 -2
  81. package/src/performance/observer.ts +59 -26
  82. package/src/queue.ts +16 -9
  83. package/tsconfig.json +1 -1
  84. package/tslint.json +25 -32
  85. package/types/core.d.ts +13 -13
  86. package/types/data.d.ts +32 -29
  87. package/types/diagnostic.d.ts +1 -1
  88. package/types/interaction.d.ts +7 -5
  89. package/types/layout.d.ts +36 -21
  90. package/types/performance.d.ts +6 -5
package/types/layout.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Privacy } from "@clarity-types/core";
1
+ import type { Privacy } from "@clarity-types/core";
2
2
 
3
3
  /* Enum */
4
4
 
@@ -8,27 +8,27 @@ export const enum AnimationOperation {
8
8
  Pause = 2,
9
9
  Cancel = 3,
10
10
  Finish = 4,
11
- CommitStyles = 5
11
+ CommitStyles = 5,
12
12
  }
13
13
 
14
14
  export const enum Source {
15
- Discover,
16
- ChildListAdd,
17
- ChildListRemove,
18
- Attributes,
19
- CharacterData
15
+ Discover = 0,
16
+ ChildListAdd = 1,
17
+ ChildListRemove = 2,
18
+ Attributes = 3,
19
+ CharacterData = 4,
20
20
  }
21
21
 
22
22
  export const enum Selector {
23
23
  Alpha = 0,
24
24
  Beta = 1,
25
- Default = 1
25
+ Default = 1,
26
26
  }
27
27
 
28
28
  export const enum InteractionState {
29
29
  None = 16,
30
30
  Clicked = 20,
31
- Input = 30
31
+ Input = 30,
32
32
  }
33
33
 
34
34
  export interface AnimationState {
@@ -49,14 +49,14 @@ export interface AnimationData {
49
49
  export const enum RegionVisibility {
50
50
  Rendered = 0,
51
51
  Visible = 10,
52
- ScrolledToEnd = 13
52
+ ScrolledToEnd = 13,
53
53
  }
54
54
 
55
55
  export const enum Mask {
56
56
  Text = "address,password,contact",
57
57
  Disable = "radio,checkbox,range,button,reset,submit",
58
58
  Exclude = "password,secret,pass,social,ssn,code,hidden",
59
- Tags = "INPUT,SELECT,TEXTAREA"
59
+ Tags = "INPUT,SELECT,TEXTAREA",
60
60
  }
61
61
 
62
62
  export const enum Constant {
@@ -124,10 +124,10 @@ export const enum Constant {
124
124
  ogTitle = "og:title",
125
125
  SvgStyle = "svg:style",
126
126
  ExcludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat",
127
- StyleSheet = "stylesheet"
127
+ StyleSheet = "stylesheet",
128
128
  }
129
129
 
130
- export const enum JsonLD {
130
+ export const enum JsonLD {
131
131
  Type = "@type",
132
132
  Recipe = "recipe",
133
133
  Product = "product",
@@ -150,7 +150,7 @@ export const enum JsonLD {
150
150
  Article = "article",
151
151
  Posting = "posting",
152
152
  Headline = "headline",
153
- Creator = "creator"
153
+ Creator = "creator",
154
154
  }
155
155
 
156
156
  export const enum Setting {
@@ -165,10 +165,25 @@ export const enum StyleSheetOperation {
165
165
  Create = 0,
166
166
  Replace = 1,
167
167
  ReplaceSync = 2,
168
- SetAdoptedStyles = 3
168
+ SetAdoptedStyles = 3,
169
169
  }
170
170
 
171
171
  /* Helper Interfaces */
172
+ export interface IWindowWithOverrides {
173
+ clarityOverrides?: {
174
+ DeleteRule?: typeof CSSMediaRule.prototype.deleteRule;
175
+ MediaDeleteRule?: typeof CSSMediaRule.prototype.deleteRule;
176
+ AttachShadow?: typeof Element.prototype.attachShadow;
177
+ MediaInsertRule?: typeof CSSMediaRule.prototype.insertRule;
178
+ InsertRule?: typeof CSSStyleSheet.prototype.insertRule;
179
+ replace?: typeof CSSStyleSheet.prototype.replace;
180
+ replaceSync?: typeof CSSStyleSheet.prototype.replaceSync;
181
+ };
182
+ CSSStyleSheet?: typeof CSSStyleSheet;
183
+ CSSMediaRule?: typeof CSSMediaRule;
184
+ Element?: typeof Element;
185
+ }
186
+
172
187
  export interface Box {
173
188
  x: number; // Left
174
189
  y: number; // Top
@@ -223,7 +238,7 @@ export interface MutationQueue {
223
238
  export interface MutationRecordWithTime {
224
239
  timestamp: number;
225
240
  mutation: MutationRecord;
226
- }
241
+ }
227
242
 
228
243
  export interface MutationHistory {
229
244
  [key: string]: [/* Count */ number, /* Instance */ number, /* Remove Nodes Buffer */ NodeList?];
@@ -241,8 +256,8 @@ export interface RegionState {
241
256
 
242
257
  export interface StyleSheetState {
243
258
  time: number;
244
- event: number,
245
- data: StyleSheetData
259
+ event: number;
260
+ data: StyleSheetData;
246
261
  }
247
262
 
248
263
  /* Event Data */
@@ -256,7 +271,7 @@ export interface RegionData {
256
271
  id: number;
257
272
  visibility: RegionVisibility;
258
273
  interaction: InteractionState;
259
- name: string;
274
+ name: string;
260
275
  }
261
276
 
262
277
  export interface TargetMetadata {
@@ -269,5 +284,5 @@ export interface StyleSheetData {
269
284
  id: number | string;
270
285
  operation: StyleSheetOperation;
271
286
  cssRules?: string;
272
- newIds?: string[]
273
- }
287
+ newIds?: string[];
288
+ }
@@ -1,8 +1,5 @@
1
- import { BooleanFlag, Target } from "./data";
2
-
3
1
  /* Helper Interface */
4
2
 
5
-
6
3
  // Reference: https://wicg.github.io/netinfo/#networkinformation-interface
7
4
  export interface NavigatorConnection extends EventTarget {
8
5
  effectiveType: string;
@@ -59,7 +56,11 @@ export const enum FunctionNames {
59
56
  RegionCompute = 24,
60
57
  PerformanceStart = 25,
61
58
  ObserverObserve = 26,
62
- ObserverHandle = 27
59
+ ObserverHandle = 27,
63
60
  }
64
61
 
65
- declare global { interface Function { dn?: FunctionNames; } }
62
+ declare global {
63
+ interface Function {
64
+ dn?: FunctionNames;
65
+ }
66
+ }