clarity-js 0.8.11 → 0.8.13-beta

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/build/clarity.extended.js +1 -1
  2. package/build/clarity.insight.js +1 -1
  3. package/build/clarity.js +2964 -3181
  4. package/build/clarity.min.js +1 -1
  5. package/build/clarity.module.js +2964 -3181
  6. package/build/clarity.performance.js +1 -1
  7. package/package.json +69 -76
  8. package/rollup.config.ts +88 -84
  9. package/src/clarity.ts +28 -34
  10. package/src/core/config.ts +2 -2
  11. package/src/core/event.ts +32 -36
  12. package/src/core/hash.ts +6 -5
  13. package/src/core/history.ts +11 -10
  14. package/src/core/index.ts +11 -21
  15. package/src/core/measure.ts +5 -9
  16. package/src/core/report.ts +3 -3
  17. package/src/core/scrub.ts +20 -29
  18. package/src/core/task.ts +45 -73
  19. package/src/core/time.ts +3 -3
  20. package/src/core/timeout.ts +2 -2
  21. package/src/core/version.ts +1 -1
  22. package/src/data/baseline.ts +55 -60
  23. package/src/data/consent.ts +2 -2
  24. package/src/data/custom.ts +13 -8
  25. package/src/data/dimension.ts +7 -11
  26. package/src/data/encode.ts +30 -36
  27. package/src/data/envelope.ts +38 -38
  28. package/src/data/extract.ts +77 -86
  29. package/src/data/index.ts +6 -10
  30. package/src/data/limit.ts +1 -1
  31. package/src/data/metadata.ts +266 -305
  32. package/src/data/metric.ts +8 -18
  33. package/src/data/ping.ts +4 -8
  34. package/src/data/signal.ts +18 -18
  35. package/src/data/summary.ts +4 -6
  36. package/src/data/token.ts +8 -10
  37. package/src/data/upgrade.ts +3 -7
  38. package/src/data/upload.ts +49 -100
  39. package/src/data/variable.ts +20 -27
  40. package/src/diagnostic/encode.ts +2 -2
  41. package/src/diagnostic/fraud.ts +4 -3
  42. package/src/diagnostic/internal.ts +5 -11
  43. package/src/diagnostic/script.ts +8 -12
  44. package/src/global.ts +1 -1
  45. package/src/insight/blank.ts +4 -4
  46. package/src/insight/encode.ts +17 -23
  47. package/src/insight/snapshot.ts +37 -57
  48. package/src/interaction/change.ts +6 -9
  49. package/src/interaction/click.ts +28 -34
  50. package/src/interaction/clipboard.ts +2 -2
  51. package/src/interaction/encode.ts +31 -35
  52. package/src/interaction/input.ts +9 -11
  53. package/src/interaction/pointer.ts +24 -35
  54. package/src/interaction/resize.ts +5 -5
  55. package/src/interaction/scroll.ts +11 -14
  56. package/src/interaction/selection.ts +8 -12
  57. package/src/interaction/submit.ts +2 -2
  58. package/src/interaction/timeline.ts +9 -13
  59. package/src/interaction/unload.ts +1 -1
  60. package/src/interaction/visibility.ts +2 -2
  61. package/src/layout/animation.ts +41 -47
  62. package/src/layout/discover.ts +5 -5
  63. package/src/layout/document.ts +19 -31
  64. package/src/layout/dom.ts +91 -141
  65. package/src/layout/encode.ts +37 -52
  66. package/src/layout/mutation.ts +318 -321
  67. package/src/layout/node.ts +81 -104
  68. package/src/layout/offset.ts +6 -7
  69. package/src/layout/region.ts +40 -60
  70. package/src/layout/schema.ts +8 -15
  71. package/src/layout/selector.ts +25 -47
  72. package/src/layout/style.ts +36 -44
  73. package/src/layout/target.ts +10 -14
  74. package/src/layout/traverse.ts +11 -17
  75. package/src/performance/blank.ts +1 -1
  76. package/src/performance/encode.ts +4 -4
  77. package/src/performance/interaction.ts +70 -58
  78. package/src/performance/navigation.ts +2 -2
  79. package/src/performance/observer.ts +26 -59
  80. package/src/queue.ts +9 -16
  81. package/tsconfig.json +1 -1
  82. package/tslint.json +32 -25
  83. package/types/core.d.ts +13 -13
  84. package/types/data.d.ts +29 -32
  85. package/types/diagnostic.d.ts +1 -1
  86. package/types/interaction.d.ts +4 -4
  87. package/types/layout.d.ts +21 -36
  88. package/types/performance.d.ts +5 -6
  89. package/.lintstagedrc.yml +0 -3
  90. package/biome.json +0 -43
package/types/layout.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Privacy } from "@clarity-types/core";
1
+ import { 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 = 0,
16
- ChildListAdd = 1,
17
- ChildListRemove = 2,
18
- Attributes = 3,
19
- CharacterData = 4,
15
+ Discover,
16
+ ChildListAdd,
17
+ ChildListRemove,
18
+ Attributes,
19
+ CharacterData
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,25 +165,10 @@ 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
-
187
172
  export interface Box {
188
173
  x: number; // Left
189
174
  y: number; // Top
@@ -238,7 +223,7 @@ export interface MutationQueue {
238
223
  export interface MutationRecordWithTime {
239
224
  timestamp: number;
240
225
  mutation: MutationRecord;
241
- }
226
+ }
242
227
 
243
228
  export interface MutationHistory {
244
229
  [key: string]: [/* Count */ number, /* Instance */ number, /* Remove Nodes Buffer */ NodeList?];
@@ -256,8 +241,8 @@ export interface RegionState {
256
241
 
257
242
  export interface StyleSheetState {
258
243
  time: number;
259
- event: number;
260
- data: StyleSheetData;
244
+ event: number,
245
+ data: StyleSheetData
261
246
  }
262
247
 
263
248
  /* Event Data */
@@ -271,7 +256,7 @@ export interface RegionData {
271
256
  id: number;
272
257
  visibility: RegionVisibility;
273
258
  interaction: InteractionState;
274
- name: string;
259
+ name: string;
275
260
  }
276
261
 
277
262
  export interface TargetMetadata {
@@ -284,5 +269,5 @@ export interface StyleSheetData {
284
269
  id: number | string;
285
270
  operation: StyleSheetOperation;
286
271
  cssRules?: string;
287
- newIds?: string[];
288
- }
272
+ newIds?: string[]
273
+ }
@@ -1,5 +1,8 @@
1
+ import { BooleanFlag, Target } from "./data";
2
+
1
3
  /* Helper Interface */
2
4
 
5
+
3
6
  // Reference: https://wicg.github.io/netinfo/#networkinformation-interface
4
7
  export interface NavigatorConnection extends EventTarget {
5
8
  effectiveType: string;
@@ -56,11 +59,7 @@ export const enum FunctionNames {
56
59
  RegionCompute = 24,
57
60
  PerformanceStart = 25,
58
61
  ObserverObserve = 26,
59
- ObserverHandle = 27,
62
+ ObserverHandle = 27
60
63
  }
61
64
 
62
- declare global {
63
- interface Function {
64
- dn?: FunctionNames;
65
- }
66
- }
65
+ declare global { interface Function { dn?: FunctionNames; } }
package/.lintstagedrc.yml DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": ["biome check --write"]
3
- }
package/biome.json DELETED
@@ -1,43 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3
- "organizeImports": {
4
- "enabled": true
5
- },
6
- "linter": {
7
- "enabled": true,
8
- "rules": {
9
- "recommended": true,
10
- "style": {
11
- "noUselessElse": "off",
12
- "useDefaultParameterLast": {
13
- "level": "error",
14
- "fix": "none"
15
- }
16
- },
17
- "a11y": {
18
- "noNoninteractiveTabindex": {
19
- "level": "error",
20
- "fix": "none"
21
- }
22
- },
23
- "suspicious": {
24
- "noConsoleLog": "error",
25
- "noConstEnum": "off"
26
- }
27
- }
28
- },
29
- "formatter": {
30
- "enabled": true,
31
- "indentStyle": "space",
32
- "lineWidth": 140,
33
- "indentWidth": 4,
34
- "lineEnding": "crlf",
35
- "ignore": ["yarn.lock"]
36
- },
37
- "vcs": {
38
- "enabled": true,
39
- "clientKind": "git",
40
- "defaultBranch": "origin/master",
41
- "useIgnoreFile": true
42
- }
43
- }