@atlaskit/react-ufo 3.6.6 → 3.6.7
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/CHANGELOG.md +8 -0
- package/dist/cjs/additional-payload/utils/cache-hit-ratio/index.js +5 -6
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/cls/index.js +3 -4
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/index.js +6 -6
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/tbt/index.js +3 -4
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +0 -3
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +10 -10
- package/dist/cjs/assets/index.js +14 -17
- package/dist/cjs/assets/utils.js +13 -10
- package/dist/cjs/bundle-eval-timing/index.js +8 -8
- package/dist/cjs/coinflip/index.js +2 -3
- package/dist/cjs/config/index.js +42 -30
- package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +41 -29
- package/dist/cjs/create-payload/common/utils/index.js +20 -16
- package/dist/cjs/create-payload/index.js +120 -128
- package/dist/cjs/create-payload/utils/get-interaction-status.js +2 -3
- package/dist/cjs/create-payload/utils/get-page-visibility-up-to-ttai.js +2 -3
- package/dist/cjs/create-payload/utils/get-react-ufo-payload-version.js +3 -4
- package/dist/cjs/create-payload/utils/get-ssr-done-time-value.js +2 -3
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +7 -8
- package/dist/cjs/create-post-interaction-log-payload/index.js +12 -13
- package/dist/cjs/custom-data/index.js +14 -6
- package/dist/cjs/custom-mark/index.js +3 -4
- package/dist/cjs/custom-spans/index.js +3 -4
- package/dist/cjs/custom-timings/index.js +6 -6
- package/dist/cjs/experience-trace-id-context/index.js +21 -16
- package/dist/cjs/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +3 -4
- package/dist/cjs/feature-flags-accessed/common/utils/index.js +12 -12
- package/dist/cjs/feature-flags-accessed/index.js +4 -4
- package/dist/cjs/generate-id/index.js +2 -3
- package/dist/cjs/global-error-handler/index.js +16 -15
- package/dist/cjs/initial-page-load-extra-timing/index.js +6 -6
- package/dist/cjs/interaction-metrics/index.js +146 -110
- package/dist/cjs/interaction-metrics/post-interaction-log.js +0 -10
- package/dist/cjs/interaction-metrics-init/index.js +15 -16
- package/dist/cjs/interaction-metrics-init/schedule-idle-callback.js +2 -3
- package/dist/cjs/resource-timing/common/utils/config.js +10 -10
- package/dist/cjs/resource-timing/common/utils/resource-timing-buffer.js +14 -14
- package/dist/cjs/resource-timing/main.js +19 -20
- package/dist/cjs/resource-timing/utils.js +3 -4
- package/dist/cjs/round-number/index.js +3 -4
- package/dist/cjs/route-name/index.js +2 -3
- package/dist/cjs/segment/schedule-on-paint.js +2 -4
- package/dist/cjs/segment/segment.js +4 -5
- package/dist/cjs/set-interaction-error/index.js +3 -4
- package/dist/cjs/short-id/index.js +2 -3
- package/dist/cjs/ssr/index.js +21 -18
- package/dist/cjs/trace-interaction/index.js +4 -5
- package/dist/cjs/trace-pageload/index.js +6 -6
- package/dist/cjs/trace-press/index.js +2 -3
- package/dist/cjs/trace-redirect/index.js +2 -3
- package/dist/cjs/trace-transition/index.js +2 -3
- package/dist/cjs/trace-transition/utils/generate-span-id/index.js +3 -4
- package/dist/cjs/trace-transition/utils/set-interaction-active-trace/index.js +3 -4
- package/dist/cjs/vc/index.js +6 -17
- package/dist/cjs/vc/vc-observer/attachAbortListeners.js +3 -4
- package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +22 -13
- package/dist/cjs/vc/vc-observer/getViewport.js +6 -6
- package/dist/cjs/vc/vc-observer/heatmap/heatmap.js +10 -20
- package/dist/cjs/vc/vc-observer/index.js +119 -145
- package/dist/cjs/vc/vc-observer/media-wrapper/vc-utils.js +3 -4
- package/dist/cjs/vc/vc-observer/observers/editor-lnv/index.js +0 -17
- package/dist/cjs/vc/vc-observer/observers/index.js +2 -29
- package/dist/cjs/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +2 -3
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +0 -16
- package/dist/cjs/vc/vc-observer/revisions/fy25_01.js +0 -2
- package/dist/cjs/vc/vc-observer/revisions/fy25_02.js +0 -2
- package/dist/cjs/vc/vc-observer/revisions/revisions.js +3 -4
- package/dist/cjs/vc/vc-observer-new/entries-timeline/index.js +0 -9
- package/dist/cjs/vc/vc-observer-new/get-element-name.js +2 -3
- package/dist/cjs/vc/vc-observer-new/get-unique-element-name.js +10 -11
- package/dist/cjs/vc/vc-observer-new/index.js +0 -9
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +0 -2
- package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -6
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +12 -20
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +26 -26
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.js +6 -18
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.js +13 -25
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +7 -8
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.js +39 -48
- package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js +7 -8
- package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.js +2 -3
- package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.js +2 -3
- package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.js +2 -3
- package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/task-yield.js +7 -8
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +7 -15
- package/dist/cjs/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +7 -8
- package/dist/cjs/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +14 -15
- package/dist/cjs/vc/vc-observer-new/viewport-observer/performance-observer/index.js +9 -9
- package/dist/cjs/vc/vc-observer-new/window-event-observer/index.js +1 -7
- package/dist/es2019/additional-payload/utils/cache-hit-ratio/index.js +4 -5
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/cls/index.js +2 -3
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/index.js +4 -5
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/tbt/index.js +2 -3
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +0 -3
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +8 -9
- package/dist/es2019/assets/index.js +14 -19
- package/dist/es2019/assets/utils.js +8 -10
- package/dist/es2019/bundle-eval-timing/index.js +6 -7
- package/dist/es2019/coinflip/index.js +2 -4
- package/dist/es2019/config/index.js +28 -29
- package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +15 -18
- package/dist/es2019/create-payload/common/utils/index.js +14 -15
- package/dist/es2019/create-payload/index.js +75 -84
- package/dist/es2019/create-payload/utils/get-interaction-status.js +2 -4
- package/dist/es2019/create-payload/utils/get-page-visibility-up-to-ttai.js +2 -3
- package/dist/es2019/create-payload/utils/get-react-ufo-payload-version.js +2 -3
- package/dist/es2019/create-payload/utils/get-ssr-done-time-value.js +2 -3
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +2 -3
- package/dist/es2019/create-post-interaction-log-payload/index.js +12 -13
- package/dist/es2019/custom-data/index.js +13 -5
- package/dist/es2019/custom-mark/index.js +2 -3
- package/dist/es2019/custom-spans/index.js +2 -3
- package/dist/es2019/custom-timings/index.js +4 -5
- package/dist/es2019/experience-trace-id-context/index.js +14 -15
- package/dist/es2019/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +2 -3
- package/dist/es2019/feature-flags-accessed/common/utils/index.js +10 -11
- package/dist/es2019/feature-flags-accessed/index.js +2 -3
- package/dist/es2019/generate-id/index.js +2 -3
- package/dist/es2019/global-error-handler/index.js +13 -14
- package/dist/es2019/initial-page-load-extra-timing/index.js +4 -5
- package/dist/es2019/interaction-metrics/index.js +108 -109
- package/dist/es2019/interaction-metrics/post-interaction-log.js +0 -10
- package/dist/es2019/interaction-metrics-init/index.js +14 -15
- package/dist/es2019/interaction-metrics-init/schedule-idle-callback.js +2 -3
- package/dist/es2019/resource-timing/common/utils/config.js +8 -9
- package/dist/es2019/resource-timing/common/utils/resource-timing-buffer.js +12 -13
- package/dist/es2019/resource-timing/main.js +18 -19
- package/dist/es2019/resource-timing/utils.js +2 -3
- package/dist/es2019/round-number/index.js +2 -3
- package/dist/es2019/route-name/index.js +2 -3
- package/dist/es2019/segment/schedule-on-paint.js +2 -4
- package/dist/es2019/segment/segment.js +4 -5
- package/dist/es2019/set-interaction-error/index.js +2 -3
- package/dist/es2019/short-id/index.js +2 -3
- package/dist/es2019/ssr/index.js +16 -17
- package/dist/es2019/trace-interaction/index.js +4 -5
- package/dist/es2019/trace-pageload/index.js +4 -5
- package/dist/es2019/trace-press/index.js +2 -3
- package/dist/es2019/trace-redirect/index.js +2 -3
- package/dist/es2019/trace-transition/index.js +2 -3
- package/dist/es2019/trace-transition/utils/generate-span-id/index.js +2 -3
- package/dist/es2019/trace-transition/utils/set-interaction-active-trace/index.js +2 -3
- package/dist/es2019/vc/index.js +4 -16
- package/dist/es2019/vc/vc-observer/attachAbortListeners.js +2 -3
- package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +4 -5
- package/dist/es2019/vc/vc-observer/getViewport.js +4 -5
- package/dist/es2019/vc/vc-observer/heatmap/heatmap.js +8 -20
- package/dist/es2019/vc/vc-observer/index.js +104 -134
- package/dist/es2019/vc/vc-observer/media-wrapper/vc-utils.js +2 -3
- package/dist/es2019/vc/vc-observer/observers/editor-lnv/index.js +0 -17
- package/dist/es2019/vc/vc-observer/observers/index.js +2 -29
- package/dist/es2019/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +2 -4
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +0 -16
- package/dist/es2019/vc/vc-observer/revisions/fy25_01.js +0 -2
- package/dist/es2019/vc/vc-observer/revisions/fy25_02.js +0 -2
- package/dist/es2019/vc/vc-observer/revisions/revisions.js +2 -3
- package/dist/es2019/vc/vc-observer-new/entries-timeline/index.js +0 -9
- package/dist/es2019/vc/vc-observer-new/get-element-name.js +2 -3
- package/dist/es2019/vc/vc-observer-new/get-unique-element-name.js +10 -11
- package/dist/es2019/vc/vc-observer-new/index.js +0 -9
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +0 -2
- package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +0 -3
- package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +4 -14
- package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +4 -5
- package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.js +6 -18
- package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.js +8 -20
- package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +2 -3
- package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.js +8 -9
- package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js +2 -3
- package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.js +2 -3
- package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.js +2 -3
- package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.js +2 -3
- package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/task-yield.js +2 -4
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +7 -15
- package/dist/es2019/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +8 -8
- package/dist/es2019/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +15 -15
- package/dist/es2019/vc/vc-observer-new/viewport-observer/performance-observer/index.js +8 -9
- package/dist/es2019/vc/vc-observer-new/window-event-observer/index.js +1 -7
- package/dist/esm/additional-payload/utils/cache-hit-ratio/index.js +4 -5
- package/dist/esm/additional-payload/utils/lighthouse-metrics/cls/index.js +2 -3
- package/dist/esm/additional-payload/utils/lighthouse-metrics/index.js +4 -5
- package/dist/esm/additional-payload/utils/lighthouse-metrics/tbt/index.js +2 -3
- package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +0 -3
- package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +8 -9
- package/dist/esm/assets/index.js +14 -17
- package/dist/esm/assets/utils.js +8 -10
- package/dist/esm/bundle-eval-timing/index.js +6 -7
- package/dist/esm/coinflip/index.js +2 -4
- package/dist/esm/config/index.js +28 -29
- package/dist/esm/create-experimental-interaction-metrics-payload/index.js +36 -28
- package/dist/esm/create-payload/common/utils/index.js +14 -15
- package/dist/esm/create-payload/index.js +119 -127
- package/dist/esm/create-payload/utils/get-interaction-status.js +2 -4
- package/dist/esm/create-payload/utils/get-page-visibility-up-to-ttai.js +2 -3
- package/dist/esm/create-payload/utils/get-react-ufo-payload-version.js +2 -3
- package/dist/esm/create-payload/utils/get-ssr-done-time-value.js +2 -3
- package/dist/esm/create-payload/utils/get-vc-metrics.js +7 -8
- package/dist/esm/create-post-interaction-log-payload/index.js +12 -13
- package/dist/esm/custom-data/index.js +13 -5
- package/dist/esm/custom-mark/index.js +2 -3
- package/dist/esm/custom-spans/index.js +2 -3
- package/dist/esm/custom-timings/index.js +4 -5
- package/dist/esm/experience-trace-id-context/index.js +14 -15
- package/dist/esm/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +2 -3
- package/dist/esm/feature-flags-accessed/common/utils/index.js +10 -11
- package/dist/esm/feature-flags-accessed/index.js +2 -3
- package/dist/esm/generate-id/index.js +2 -3
- package/dist/esm/global-error-handler/index.js +13 -14
- package/dist/esm/initial-page-load-extra-timing/index.js +4 -5
- package/dist/esm/interaction-metrics/index.js +108 -109
- package/dist/esm/interaction-metrics/post-interaction-log.js +0 -10
- package/dist/esm/interaction-metrics-init/index.js +14 -15
- package/dist/esm/interaction-metrics-init/schedule-idle-callback.js +2 -3
- package/dist/esm/resource-timing/common/utils/config.js +8 -9
- package/dist/esm/resource-timing/common/utils/resource-timing-buffer.js +12 -13
- package/dist/esm/resource-timing/main.js +18 -19
- package/dist/esm/resource-timing/utils.js +2 -3
- package/dist/esm/round-number/index.js +2 -3
- package/dist/esm/route-name/index.js +2 -3
- package/dist/esm/segment/schedule-on-paint.js +2 -4
- package/dist/esm/segment/segment.js +4 -5
- package/dist/esm/set-interaction-error/index.js +2 -3
- package/dist/esm/short-id/index.js +2 -3
- package/dist/esm/ssr/index.js +16 -17
- package/dist/esm/trace-interaction/index.js +4 -5
- package/dist/esm/trace-pageload/index.js +4 -5
- package/dist/esm/trace-press/index.js +2 -3
- package/dist/esm/trace-redirect/index.js +2 -3
- package/dist/esm/trace-transition/index.js +2 -3
- package/dist/esm/trace-transition/utils/generate-span-id/index.js +2 -3
- package/dist/esm/trace-transition/utils/set-interaction-active-trace/index.js +2 -3
- package/dist/esm/vc/index.js +4 -16
- package/dist/esm/vc/vc-observer/attachAbortListeners.js +2 -3
- package/dist/esm/vc/vc-observer/getVCRevisionsData.js +21 -12
- package/dist/esm/vc/vc-observer/getViewport.js +4 -5
- package/dist/esm/vc/vc-observer/heatmap/heatmap.js +10 -20
- package/dist/esm/vc/vc-observer/index.js +119 -145
- package/dist/esm/vc/vc-observer/media-wrapper/vc-utils.js +2 -3
- package/dist/esm/vc/vc-observer/observers/editor-lnv/index.js +0 -17
- package/dist/esm/vc/vc-observer/observers/index.js +2 -29
- package/dist/esm/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +2 -4
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +0 -16
- package/dist/esm/vc/vc-observer/revisions/fy25_01.js +0 -2
- package/dist/esm/vc/vc-observer/revisions/fy25_02.js +0 -2
- package/dist/esm/vc/vc-observer/revisions/revisions.js +2 -3
- package/dist/esm/vc/vc-observer-new/entries-timeline/index.js +0 -9
- package/dist/esm/vc/vc-observer-new/get-element-name.js +2 -3
- package/dist/esm/vc/vc-observer-new/get-unique-element-name.js +10 -11
- package/dist/esm/vc/vc-observer-new/index.js +0 -9
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +0 -2
- package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -6
- package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +9 -19
- package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +24 -25
- package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.js +6 -18
- package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.js +13 -25
- package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +7 -8
- package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.js +39 -48
- package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js +7 -8
- package/dist/esm/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.js +2 -3
- package/dist/esm/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.js +2 -3
- package/dist/esm/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.js +2 -3
- package/dist/esm/vc/vc-observer-new/metric-calculator/utils/task-yield.js +7 -9
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +7 -15
- package/dist/esm/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +7 -8
- package/dist/esm/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +14 -15
- package/dist/esm/vc/vc-observer-new/viewport-observer/performance-observer/index.js +7 -9
- package/dist/esm/vc/vc-observer-new/window-event-observer/index.js +1 -7
- package/dist/types/additional-payload/utils/cache-hit-ratio/index.d.ts +2 -2
- package/dist/types/additional-payload/utils/lighthouse-metrics/cls/index.d.ts +1 -1
- package/dist/types/additional-payload/utils/lighthouse-metrics/index.d.ts +3 -3
- package/dist/types/additional-payload/utils/lighthouse-metrics/tbt/index.d.ts +1 -1
- package/dist/types/additional-payload/utils/lighthouse-metrics/utils/observer/index.d.ts +2 -2
- package/dist/types/assets/index.d.ts +1 -3
- package/dist/types/assets/utils.d.ts +4 -4
- package/dist/types/bundle-eval-timing/index.d.ts +2 -2
- package/dist/types/coinflip/index.d.ts +1 -1
- package/dist/types/common/react-ufo-payload-schema.d.ts +1 -0
- package/dist/types/config/index.d.ts +16 -14
- package/dist/types/create-experimental-interaction-metrics-payload/index.d.ts +4 -5
- package/dist/types/create-payload/common/utils/index.d.ts +8 -7
- package/dist/types/create-payload/index.d.ts +1 -97
- package/dist/types/create-payload/utils/get-interaction-status.d.ts +1 -1
- package/dist/types/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +1 -1
- package/dist/types/create-payload/utils/get-react-ufo-payload-version.d.ts +1 -1
- package/dist/types/create-payload/utils/get-ssr-done-time-value.d.ts +1 -1
- package/dist/types/create-payload/utils/get-vc-metrics.d.ts +2 -2
- package/dist/types/create-post-interaction-log-payload/index.d.ts +1 -1
- package/dist/types/custom-data/index.d.ts +1 -1
- package/dist/types/custom-mark/index.d.ts +1 -1
- package/dist/types/custom-spans/index.d.ts +1 -1
- package/dist/types/custom-timings/index.d.ts +2 -2
- package/dist/types/experience-trace-id-context/index.d.ts +7 -7
- package/dist/types/experience-trace-id-context/utils/make-trace-http-request-headers/index.d.ts +1 -1
- package/dist/types/feature-flags-accessed/common/utils/index.d.ts +2 -2
- package/dist/types/feature-flags-accessed/index.d.ts +1 -1
- package/dist/types/generate-id/index.d.ts +1 -1
- package/dist/types/global-error-handler/index.d.ts +3 -3
- package/dist/types/initial-page-load-extra-timing/index.d.ts +2 -2
- package/dist/types/interaction-context/index.d.ts +1 -1
- package/dist/types/interaction-metrics/index.d.ts +44 -44
- package/dist/types/interaction-metrics/post-interaction-log.d.ts +0 -1
- package/dist/types/interaction-metrics-init/index.d.ts +1 -1
- package/dist/types/interaction-metrics-init/schedule-idle-callback.d.ts +1 -1
- package/dist/types/resource-timing/common/utils/config.d.ts +2 -2
- package/dist/types/resource-timing/common/utils/resource-timing-buffer.d.ts +5 -5
- package/dist/types/resource-timing/main.d.ts +1 -1
- package/dist/types/resource-timing/utils.d.ts +1 -1
- package/dist/types/round-number/index.d.ts +1 -1
- package/dist/types/route-name/index.d.ts +3 -3
- package/dist/types/segment/schedule-on-paint.d.ts +1 -1
- package/dist/types/set-interaction-error/index.d.ts +1 -1
- package/dist/types/short-id/index.d.ts +1 -1
- package/dist/types/ssr/index.d.ts +5 -5
- package/dist/types/trace-interaction/index.d.ts +1 -1
- package/dist/types/trace-pageload/index.d.ts +2 -2
- package/dist/types/trace-press/index.d.ts +1 -1
- package/dist/types/trace-redirect/index.d.ts +1 -1
- package/dist/types/trace-transition/index.d.ts +1 -1
- package/dist/types/trace-transition/utils/generate-span-id/index.d.ts +1 -1
- package/dist/types/trace-transition/utils/set-interaction-active-trace/index.d.ts +1 -1
- package/dist/types/vc/index.d.ts +2 -2
- package/dist/types/vc/vc-observer/attachAbortListeners.d.ts +2 -2
- package/dist/types/vc/vc-observer/getVCRevisionsData.d.ts +5 -5
- package/dist/types/vc/vc-observer/getViewport.d.ts +2 -2
- package/dist/types/vc/vc-observer/heatmap/heatmap.d.ts +1 -1
- package/dist/types/vc/vc-observer/index.d.ts +4 -4
- package/dist/types/vc/vc-observer/media-wrapper/vc-utils.d.ts +1 -1
- package/dist/types/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.d.ts +4 -4
- package/dist/types/vc/vc-observer/revisions/revisions.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/get-element-name.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/get-unique-element-name.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.d.ts +3 -2
- package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +2 -2
- package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +2 -2
- package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.d.ts +2 -2
- package/dist/types/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/metric-calculator/utils/task-yield.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/viewport-observer/index.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/viewport-observer/intersection-observer/index.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/viewport-observer/mutation-observer/index.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/viewport-observer/performance-observer/index.d.ts +2 -2
- package/dist/types-ts4.5/additional-payload/utils/cache-hit-ratio/index.d.ts +2 -2
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/cls/index.d.ts +1 -1
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/index.d.ts +3 -3
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/tbt/index.d.ts +1 -1
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/utils/observer/index.d.ts +2 -2
- package/dist/types-ts4.5/assets/index.d.ts +1 -3
- package/dist/types-ts4.5/assets/utils.d.ts +4 -4
- package/dist/types-ts4.5/bundle-eval-timing/index.d.ts +2 -2
- package/dist/types-ts4.5/coinflip/index.d.ts +1 -1
- package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +1 -0
- package/dist/types-ts4.5/config/index.d.ts +20 -14
- package/dist/types-ts4.5/create-experimental-interaction-metrics-payload/index.d.ts +4 -5
- package/dist/types-ts4.5/create-payload/common/utils/index.d.ts +8 -7
- package/dist/types-ts4.5/create-payload/index.d.ts +1 -97
- package/dist/types-ts4.5/create-payload/utils/get-interaction-status.d.ts +1 -1
- package/dist/types-ts4.5/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +1 -1
- package/dist/types-ts4.5/create-payload/utils/get-react-ufo-payload-version.d.ts +1 -1
- package/dist/types-ts4.5/create-payload/utils/get-ssr-done-time-value.d.ts +1 -1
- package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +2 -2
- package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +1 -1
- package/dist/types-ts4.5/custom-data/index.d.ts +1 -1
- package/dist/types-ts4.5/custom-mark/index.d.ts +1 -1
- package/dist/types-ts4.5/custom-spans/index.d.ts +1 -1
- package/dist/types-ts4.5/custom-timings/index.d.ts +2 -2
- package/dist/types-ts4.5/experience-trace-id-context/index.d.ts +7 -7
- package/dist/types-ts4.5/experience-trace-id-context/utils/make-trace-http-request-headers/index.d.ts +1 -1
- package/dist/types-ts4.5/feature-flags-accessed/common/utils/index.d.ts +2 -2
- package/dist/types-ts4.5/feature-flags-accessed/index.d.ts +1 -1
- package/dist/types-ts4.5/generate-id/index.d.ts +1 -1
- package/dist/types-ts4.5/global-error-handler/index.d.ts +3 -3
- package/dist/types-ts4.5/initial-page-load-extra-timing/index.d.ts +2 -2
- package/dist/types-ts4.5/interaction-context/index.d.ts +1 -1
- package/dist/types-ts4.5/interaction-metrics/index.d.ts +44 -44
- package/dist/types-ts4.5/interaction-metrics/post-interaction-log.d.ts +0 -1
- package/dist/types-ts4.5/interaction-metrics-init/index.d.ts +1 -1
- package/dist/types-ts4.5/interaction-metrics-init/schedule-idle-callback.d.ts +1 -1
- package/dist/types-ts4.5/resource-timing/common/utils/config.d.ts +2 -2
- package/dist/types-ts4.5/resource-timing/common/utils/resource-timing-buffer.d.ts +5 -5
- package/dist/types-ts4.5/resource-timing/main.d.ts +1 -1
- package/dist/types-ts4.5/resource-timing/utils.d.ts +1 -1
- package/dist/types-ts4.5/round-number/index.d.ts +1 -1
- package/dist/types-ts4.5/route-name/index.d.ts +3 -3
- package/dist/types-ts4.5/segment/schedule-on-paint.d.ts +1 -1
- package/dist/types-ts4.5/set-interaction-error/index.d.ts +1 -1
- package/dist/types-ts4.5/short-id/index.d.ts +1 -1
- package/dist/types-ts4.5/ssr/index.d.ts +5 -5
- package/dist/types-ts4.5/trace-interaction/index.d.ts +1 -1
- package/dist/types-ts4.5/trace-pageload/index.d.ts +2 -2
- package/dist/types-ts4.5/trace-press/index.d.ts +1 -1
- package/dist/types-ts4.5/trace-redirect/index.d.ts +1 -1
- package/dist/types-ts4.5/trace-transition/index.d.ts +1 -1
- package/dist/types-ts4.5/trace-transition/utils/generate-span-id/index.d.ts +1 -1
- package/dist/types-ts4.5/trace-transition/utils/set-interaction-active-trace/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/index.d.ts +2 -2
- package/dist/types-ts4.5/vc/vc-observer/attachAbortListeners.d.ts +2 -2
- package/dist/types-ts4.5/vc/vc-observer/getVCRevisionsData.d.ts +5 -5
- package/dist/types-ts4.5/vc/vc-observer/getViewport.d.ts +2 -2
- package/dist/types-ts4.5/vc/vc-observer/heatmap/heatmap.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +4 -4
- package/dist/types-ts4.5/vc/vc-observer/media-wrapper/vc-utils.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.d.ts +4 -4
- package/dist/types-ts4.5/vc/vc-observer/revisions/revisions.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/get-element-name.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/get-unique-element-name.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.d.ts +3 -2
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +2 -2
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +2 -2
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.d.ts +2 -2
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/task-yield.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/intersection-observer/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/mutation-observer/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/performance-observer/index.d.ts +2 -2
- package/package.json +4 -1
- package/dist/cjs/self-measurements/index.js +0 -261
- package/dist/es2019/self-measurements/index.js +0 -213
- package/dist/esm/self-measurements/index.js +0 -246
- package/dist/types/self-measurements/index.d.ts +0 -57
- package/dist/types-ts4.5/self-measurements/index.d.ts +0 -57
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../../../self-measurements';
|
|
2
1
|
import taskYield from '../../utils/task-yield';
|
|
3
2
|
|
|
4
3
|
// 24-bit color value
|
|
@@ -26,7 +25,6 @@ export class ViewportCanvas {
|
|
|
26
25
|
* @throws {Error} If canvas context cannot be obtained
|
|
27
26
|
*/
|
|
28
27
|
constructor(viewport, scaleFactor = 1) {
|
|
29
|
-
const operationTimer = markProfilingStart('ViewportCanvas constructor');
|
|
30
28
|
this.scaleFactor = scaleFactor;
|
|
31
29
|
this.colorCounter = 1;
|
|
32
30
|
this.colorTimeMap = new Map();
|
|
@@ -56,14 +54,6 @@ export class ViewportCanvas {
|
|
|
56
54
|
this.ctx = ctx;
|
|
57
55
|
this.ctx.globalCompositeOperation = 'source-over';
|
|
58
56
|
this.clear();
|
|
59
|
-
this.getScaledDimensions = withProfiling(this.getScaledDimensions.bind(this), ['vc']);
|
|
60
|
-
this.clear = withProfiling(this.clear.bind(this), ['vc']);
|
|
61
|
-
this.generateColor = withProfiling(this.generateColor.bind(this), ['vc']);
|
|
62
|
-
this.drawRect = withProfiling(this.drawRect.bind(this), ['vc']);
|
|
63
|
-
this.getPixelCounts = withProfiling(this.getPixelCounts.bind(this), ['vc']);
|
|
64
|
-
markProfilingEnd(operationTimer, {
|
|
65
|
-
tags: ['vc']
|
|
66
|
-
});
|
|
67
57
|
}
|
|
68
58
|
getScaledDimensions() {
|
|
69
59
|
return {
|
|
@@ -158,7 +148,7 @@ export class ViewportCanvas {
|
|
|
158
148
|
* @param number - The input number to be split into RGB components.
|
|
159
149
|
* @returns The RGB color string in the format "rgb(r, g, b)".
|
|
160
150
|
*/
|
|
161
|
-
export
|
|
151
|
+
export function getRGBComponents(n) {
|
|
162
152
|
// Ensure the input is within the valid range for a 24-bit color
|
|
163
153
|
if (n < 0 || n > 0xffffff) {
|
|
164
154
|
throw new Error('Input number must be between 0 and 16777215 (inclusive).');
|
|
@@ -173,7 +163,7 @@ export const getRGBComponents = withProfiling(function getRGBComponents(n) {
|
|
|
173
163
|
// Extract red component (bits 16-23)
|
|
174
164
|
const red = n >> 16 & 0xff;
|
|
175
165
|
return `rgb(${red}, ${green}, ${blue})`;
|
|
176
|
-
}
|
|
166
|
+
}
|
|
177
167
|
|
|
178
168
|
/**
|
|
179
169
|
* Calculates the number of pixels drawn for each color in the image data.
|
|
@@ -182,7 +172,7 @@ export const getRGBComponents = withProfiling(function getRGBComponents(n) {
|
|
|
182
172
|
* @param arraySize - The amount of timestamps that were drawn in the viewport
|
|
183
173
|
* @returns A Map containing color to pixel count mappings.
|
|
184
174
|
*/
|
|
185
|
-
export
|
|
175
|
+
export async function calculateDrawnPixelsRaw(imageData, scaleFactor, arraySize) {
|
|
186
176
|
const data = imageData.data;
|
|
187
177
|
const arr = new Uint32Array(arraySize);
|
|
188
178
|
for (let i = 0; i < data.length; i += 4) {
|
|
@@ -202,4 +192,4 @@ export const calculateDrawnPixelsRaw = withProfiling(async function calculateDra
|
|
|
202
192
|
}
|
|
203
193
|
}
|
|
204
194
|
return arr;
|
|
205
|
-
}
|
|
195
|
+
}
|
package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import { withProfiling } from '../../../../../self-measurements';
|
|
3
2
|
import { ViewportCanvas } from './canvas-pixel';
|
|
4
|
-
|
|
3
|
+
async function calculateTTVCPercentiles({
|
|
5
4
|
viewport,
|
|
6
5
|
orderedEntries,
|
|
7
6
|
percentiles,
|
|
@@ -27,9 +26,9 @@ const calculateTTVCPercentiles = withProfiling(async function calculateTTVCPerce
|
|
|
27
26
|
const canvasDimenstions = canvas.getScaledDimensions();
|
|
28
27
|
const totalPixels = canvasDimenstions.width * canvasDimenstions.height;
|
|
29
28
|
return calculatePercentiles(timePixelCounts, elementMap, percentiles, totalPixels, startTime);
|
|
30
|
-
}
|
|
29
|
+
}
|
|
31
30
|
export default calculateTTVCPercentiles;
|
|
32
|
-
export
|
|
31
|
+
export function calculatePercentiles(timePixelCounts, elementMap, unorderedPercentiles, totalPixels, startTime) {
|
|
33
32
|
const results = {};
|
|
34
33
|
let cumulativePixels = 0;
|
|
35
34
|
const percentiles = unorderedPercentiles.sort((a, b) => a - b);
|
|
@@ -71,4 +70,4 @@ export const calculatePercentiles = withProfiling(function calculatePercentiles(
|
|
|
71
70
|
previousResult = results[`${percentile}`];
|
|
72
71
|
}
|
|
73
72
|
return results;
|
|
74
|
-
}
|
|
73
|
+
}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../../../self-measurements';
|
|
2
1
|
import isViewportEntryData from '../../utils/is-viewport-entry-data';
|
|
3
2
|
import taskYield from '../../utils/task-yield';
|
|
4
3
|
const MAX_HEATMAP_SIZE = 1000;
|
|
5
|
-
|
|
4
|
+
function createEmptyHeatmapEntry() {
|
|
6
5
|
return {
|
|
7
6
|
head: null,
|
|
8
7
|
previousEntries: []
|
|
9
8
|
};
|
|
10
|
-
}
|
|
11
|
-
|
|
9
|
+
}
|
|
10
|
+
function createEmptyMap(heatmapWidth, heatmapHeight) {
|
|
12
11
|
return Array.from({
|
|
13
12
|
length: heatmapHeight
|
|
14
13
|
}).map(() => Array.from({
|
|
15
14
|
length: heatmapWidth
|
|
16
15
|
}).map(createEmptyHeatmapEntry));
|
|
17
|
-
}
|
|
18
|
-
|
|
16
|
+
}
|
|
17
|
+
function isRectInside(a, b) {
|
|
19
18
|
if (!a || !b) {
|
|
20
19
|
return false;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
// Check if all corners of rectangle a are within the bounds of rectangle b
|
|
24
23
|
return a.left >= b.left && a.right <= b.right && a.top >= b.top && a.bottom <= b.bottom;
|
|
25
|
-
}
|
|
24
|
+
}
|
|
26
25
|
export default class Heatmap {
|
|
27
26
|
/**
|
|
28
27
|
* Heatmap Width
|
|
@@ -40,8 +39,6 @@ export default class Heatmap {
|
|
|
40
39
|
viewport,
|
|
41
40
|
heatmapSize
|
|
42
41
|
}) {
|
|
43
|
-
const operationTimer = markProfilingStart('Heatmap constructor');
|
|
44
|
-
|
|
45
42
|
// TODO timeOrigin? do we need? for SSR??
|
|
46
43
|
this.viewport = viewport;
|
|
47
44
|
const safeSize = Math.min(heatmapSize, MAX_HEATMAP_SIZE);
|
|
@@ -68,15 +65,6 @@ export default class Heatmap {
|
|
|
68
65
|
this.scaleY = this.height / viewport.height;
|
|
69
66
|
this.heatmapAreaSize = this.width * this.height;
|
|
70
67
|
this.map = createEmptyMap(this.width, this.height);
|
|
71
|
-
this.getHeatmap = withProfiling(this.getHeatmap.bind(this), ['vc']);
|
|
72
|
-
this.getCell = withProfiling(this.getCell.bind(this), ['vc']);
|
|
73
|
-
this.mapDOMRectToHeatmap = withProfiling(this.mapDOMRectToHeatmap.bind(this), ['vc']);
|
|
74
|
-
this.getRatio = withProfiling(this.getRatio.bind(this), ['vc']);
|
|
75
|
-
this.applyEntriesToHeatmap = withProfiling(this.applyEntriesToHeatmap.bind(this), ['vc']);
|
|
76
|
-
this.getVCPercentMetrics = withProfiling(this.getVCPercentMetrics.bind(this), ['vc']);
|
|
77
|
-
markProfilingEnd(operationTimer, {
|
|
78
|
-
tags: ['vc']
|
|
79
|
-
});
|
|
80
68
|
}
|
|
81
69
|
getHeatmap() {
|
|
82
70
|
return this.map;
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../../../self-measurements';
|
|
2
1
|
import isViewportEntryData from '../../utils/is-viewport-entry-data';
|
|
3
2
|
import taskYield from '../../utils/task-yield';
|
|
4
3
|
const MAX_HEATMAP_SIZE = 1000;
|
|
5
|
-
|
|
4
|
+
function createEmptyHeatmapEntry() {
|
|
6
5
|
return {
|
|
7
6
|
head: null,
|
|
8
7
|
previousEntries: []
|
|
9
8
|
};
|
|
10
|
-
}
|
|
11
|
-
|
|
9
|
+
}
|
|
10
|
+
function createEmptyMap(heatmapWidth, heatmapHeight) {
|
|
12
11
|
return Array.from({
|
|
13
12
|
length: heatmapHeight
|
|
14
13
|
}).map(() => Array.from({
|
|
15
14
|
length: heatmapWidth
|
|
16
15
|
}).map(createEmptyHeatmapEntry));
|
|
17
|
-
}
|
|
18
|
-
|
|
16
|
+
}
|
|
17
|
+
function isRectInside(a, b) {
|
|
19
18
|
if (!a || !b) {
|
|
20
19
|
return false;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
// Check if all corners of rectangle a are within the bounds of rectangle b
|
|
24
23
|
return a.left >= b.left && a.right <= b.right && a.top >= b.top && a.bottom <= b.bottom;
|
|
25
|
-
}
|
|
24
|
+
}
|
|
26
25
|
class Heatmap {
|
|
27
26
|
/**
|
|
28
27
|
* Heatmap Width
|
|
@@ -40,8 +39,6 @@ class Heatmap {
|
|
|
40
39
|
viewport,
|
|
41
40
|
heatmapSize
|
|
42
41
|
}) {
|
|
43
|
-
const operationTimer = markProfilingStart('Heatmap constructor');
|
|
44
|
-
|
|
45
42
|
// TODO timeOrigin? do we need? for SSR??
|
|
46
43
|
this.viewport = viewport;
|
|
47
44
|
const safeSize = Math.min(heatmapSize, MAX_HEATMAP_SIZE);
|
|
@@ -68,15 +65,6 @@ class Heatmap {
|
|
|
68
65
|
this.scaleY = this.height / viewport.height;
|
|
69
66
|
this.heatmapAreaSize = this.width * this.height;
|
|
70
67
|
this.map = createEmptyMap(this.width, this.height);
|
|
71
|
-
this.getHeatmap = withProfiling(this.getHeatmap.bind(this), ['vc']);
|
|
72
|
-
this.getCell = withProfiling(this.getCell.bind(this), ['vc']);
|
|
73
|
-
this.mapDOMRectToHeatmap = withProfiling(this.mapDOMRectToHeatmap.bind(this), ['vc']);
|
|
74
|
-
this.getRatio = withProfiling(this.getRatio.bind(this), ['vc']);
|
|
75
|
-
this.applyEntriesToHeatmap = withProfiling(this.applyEntriesToHeatmap.bind(this), ['vc']);
|
|
76
|
-
this.getVCPercentMetrics = withProfiling(this.getVCPercentMetrics.bind(this), ['vc']);
|
|
77
|
-
markProfilingEnd(operationTimer, {
|
|
78
|
-
tags: ['vc']
|
|
79
|
-
});
|
|
80
68
|
}
|
|
81
69
|
getHeatmap() {
|
|
82
70
|
return this.map;
|
|
@@ -258,7 +246,7 @@ class Heatmap {
|
|
|
258
246
|
return result;
|
|
259
247
|
}
|
|
260
248
|
}
|
|
261
|
-
|
|
249
|
+
async function calculateTTVCPercentiles({
|
|
262
250
|
orderedEntries,
|
|
263
251
|
viewport,
|
|
264
252
|
percentiles,
|
|
@@ -271,5 +259,5 @@ const calculateTTVCPercentiles = withProfiling(async function calculateTTVCPerce
|
|
|
271
259
|
await heatmap.applyEntriesToHeatmap(orderedEntries);
|
|
272
260
|
const vcDetails = await heatmap.getVCPercentMetrics(percentiles, startTime);
|
|
273
261
|
return vcDetails;
|
|
274
|
-
}
|
|
262
|
+
}
|
|
275
263
|
export default calculateTTVCPercentiles;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { withProfiling } from '../../../../self-measurements';
|
|
2
1
|
import calcUsingCanvas from './canvas-heatmap';
|
|
3
2
|
import caclUsingOldHeatmap from './heatmap';
|
|
4
3
|
import calcUsingRectSweepingLine from './rect-sweeping-line';
|
|
5
|
-
|
|
4
|
+
async function calculateTTVCPercentiles(arg) {
|
|
6
5
|
const algo = 'canvas_heatmap';
|
|
7
6
|
if (algo === 'canvas_heatmap') {
|
|
8
7
|
const vcDetails = await calcUsingCanvas(arg);
|
|
@@ -17,5 +16,5 @@ const calculateTTVCPercentiles = withProfiling(async function calculateTTVCPerce
|
|
|
17
16
|
return vcDetails;
|
|
18
17
|
}
|
|
19
18
|
throw new Error('unexpected Error algo not chosen correctly');
|
|
20
|
-
}
|
|
19
|
+
}
|
|
21
20
|
export default calculateTTVCPercentiles;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { withProfiling } from '../../../../../self-measurements';
|
|
2
1
|
/**
|
|
3
2
|
* Calculate the union areas of all rectangles using Sweep Line Algorithm
|
|
4
3
|
*
|
|
@@ -9,7 +8,7 @@ import { withProfiling } from '../../../../../self-measurements';
|
|
|
9
8
|
* @param rectangles
|
|
10
9
|
* @returns
|
|
11
10
|
*/
|
|
12
|
-
|
|
11
|
+
function calculateUnionArea(rectangles) {
|
|
13
12
|
// Step 1: Create sweep line events
|
|
14
13
|
const events = createSweepLineEvents(rectangles);
|
|
15
14
|
|
|
@@ -28,9 +27,9 @@ const calculateUnionArea = withProfiling(function calculateUnionArea(rectangles)
|
|
|
28
27
|
updateActiveIntervals(activeIntervals, event);
|
|
29
28
|
}
|
|
30
29
|
return totalArea;
|
|
31
|
-
}
|
|
30
|
+
}
|
|
32
31
|
export default calculateUnionArea;
|
|
33
|
-
|
|
32
|
+
function createSweepLineEvents(rectangles) {
|
|
34
33
|
const events = [];
|
|
35
34
|
for (const rect of rectangles) {
|
|
36
35
|
// Create start and end events for each rectangle
|
|
@@ -49,8 +48,8 @@ const createSweepLineEvents = withProfiling(function createSweepLineEvents(recta
|
|
|
49
48
|
}
|
|
50
49
|
// Sort events by x-coordinate (and type as tiebreaker)
|
|
51
50
|
return events.sort((a, b) => a.x === b.x ? a.type === 'end' ? 1 : -1 : a.x - b.x);
|
|
52
|
-
}
|
|
53
|
-
|
|
51
|
+
}
|
|
52
|
+
function calculateActiveHeight(intervals) {
|
|
54
53
|
if (intervals.size === 0) {
|
|
55
54
|
return 0;
|
|
56
55
|
}
|
|
@@ -84,8 +83,8 @@ const calculateActiveHeight = withProfiling(function calculateActiveHeight(inter
|
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
return totalHeight;
|
|
87
|
-
}
|
|
88
|
-
|
|
86
|
+
}
|
|
87
|
+
function updateActiveIntervals(intervals, event) {
|
|
89
88
|
const key = `${event.top},${event.bottom}`;
|
|
90
89
|
if (event.type === 'start') {
|
|
91
90
|
intervals.set(key, (intervals.get(key) || 0) + 1);
|
|
@@ -97,4 +96,4 @@ const updateActiveIntervals = withProfiling(function updateActiveIntervals(inter
|
|
|
97
96
|
intervals.delete(key);
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
|
-
}
|
|
99
|
+
}
|
package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { withProfiling } from '../../../../../self-measurements';
|
|
2
1
|
import isViewportEntryData from '../../utils/is-viewport-entry-data';
|
|
3
2
|
import taskYield from '../../utils/task-yield';
|
|
4
3
|
import calculateUnionArea from './calc-union-area';
|
|
5
|
-
|
|
4
|
+
async function calculateTTVCPercentiles({
|
|
6
5
|
orderedEntries,
|
|
7
6
|
viewport,
|
|
8
7
|
percentiles,
|
|
@@ -57,5 +56,5 @@ const calculateTTVCPercentiles = withProfiling(async function calculateTTVCPerce
|
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
return checkpoints;
|
|
60
|
-
}
|
|
59
|
+
}
|
|
61
60
|
export default calculateTTVCPercentiles;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const getViewportHeight = withProfiling(function getViewportHeight(document = window.document) {
|
|
1
|
+
function getViewportHeight(document = window.document) {
|
|
3
2
|
let documentHeight;
|
|
4
3
|
try {
|
|
5
4
|
documentHeight = document.documentElement.clientHeight || 0;
|
|
@@ -7,5 +6,5 @@ const getViewportHeight = withProfiling(function getViewportHeight(document = wi
|
|
|
7
6
|
documentHeight = 0;
|
|
8
7
|
}
|
|
9
8
|
return Math.max(documentHeight, window.innerHeight || 0);
|
|
10
|
-
}
|
|
9
|
+
}
|
|
11
10
|
export default getViewportHeight;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const getViewportWidth = withProfiling(function getViewportWidth(document = window.document) {
|
|
1
|
+
function getViewportWidth(document = window.document) {
|
|
3
2
|
let documentWidth;
|
|
4
3
|
try {
|
|
5
4
|
documentWidth = document.documentElement.clientWidth || 0;
|
|
@@ -7,5 +6,5 @@ const getViewportWidth = withProfiling(function getViewportWidth(document = wind
|
|
|
7
6
|
documentWidth = 0;
|
|
8
7
|
}
|
|
9
8
|
return Math.max(documentWidth, window.innerWidth || 0);
|
|
10
|
-
}
|
|
9
|
+
}
|
|
11
10
|
export default getViewportWidth;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const isViewportEntryData = withProfiling(function isViewportEntryData(data) {
|
|
1
|
+
function isViewportEntryData(data) {
|
|
3
2
|
if (data) {
|
|
4
3
|
const hasElementName = typeof data.elementName === 'string';
|
|
5
4
|
const hasRect = typeof data.rect !== 'undefined';
|
|
@@ -8,5 +7,5 @@ const isViewportEntryData = withProfiling(function isViewportEntryData(data) {
|
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
return false;
|
|
11
|
-
}
|
|
10
|
+
}
|
|
12
11
|
export default isViewportEntryData;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { withProfiling } from '../../../../self-measurements';
|
|
2
|
-
|
|
3
1
|
// See https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API
|
|
4
|
-
|
|
2
|
+
async function taskYield() {
|
|
5
3
|
// This is using globalThis to allow the yield task to be used outside of a browser env
|
|
6
4
|
if ('scheduler' in globalThis &&
|
|
7
5
|
// @ts-ignore
|
|
@@ -16,5 +14,5 @@ const taskYield = withProfiling(async function taskYield() {
|
|
|
16
14
|
});
|
|
17
15
|
setTimeout(resolve, 0);
|
|
18
16
|
await p;
|
|
19
|
-
}
|
|
17
|
+
}
|
|
20
18
|
export default taskYield;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../self-measurements';
|
|
2
1
|
import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
|
|
3
2
|
import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
|
|
4
3
|
import { createIntersectionObserver } from './intersection-observer';
|
|
5
4
|
import createMutationObserver from './mutation-observer';
|
|
6
5
|
import createPerformanceObserver from './performance-observer';
|
|
7
|
-
|
|
6
|
+
function isElementVisible(element) {
|
|
8
7
|
if (!(element instanceof HTMLElement)) {
|
|
9
8
|
return true;
|
|
10
9
|
}
|
|
@@ -20,25 +19,23 @@ const isElementVisible = withProfiling(function isElementVisible(element) {
|
|
|
20
19
|
// there is no support for checkVisibility
|
|
21
20
|
return true;
|
|
22
21
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
22
|
+
}
|
|
23
|
+
function sameRectSize(a, b) {
|
|
25
24
|
if (!a || !b) {
|
|
26
25
|
return false;
|
|
27
26
|
}
|
|
28
27
|
return a.width === b.width && a.height === b.height;
|
|
29
|
-
}
|
|
30
|
-
|
|
28
|
+
}
|
|
29
|
+
function sameRectDimensions(a, b) {
|
|
31
30
|
if (!a || !b) {
|
|
32
31
|
return false;
|
|
33
32
|
}
|
|
34
33
|
return a.width === b.width && a.height === b.height && a.x === b.x && a.y === b.y;
|
|
35
|
-
}
|
|
34
|
+
}
|
|
36
35
|
export default class ViewportObserver {
|
|
37
36
|
constructor({
|
|
38
|
-
onChange:
|
|
37
|
+
onChange: onChange
|
|
39
38
|
}) {
|
|
40
|
-
const onChange = withProfiling(_onChange, ['vc']);
|
|
41
|
-
const operationTimer = markProfilingStart('ViewportObserver constructor');
|
|
42
39
|
this.mapVisibleNodeRects = new WeakMap();
|
|
43
40
|
this.intersectionObserver = createIntersectionObserver({
|
|
44
41
|
onEntry: ({
|
|
@@ -167,11 +164,6 @@ export default class ViewportObserver {
|
|
|
167
164
|
}
|
|
168
165
|
}
|
|
169
166
|
});
|
|
170
|
-
this.start = withProfiling(this.start.bind(this), ['vc']);
|
|
171
|
-
this.stop = withProfiling(this.stop.bind(this), ['vc']);
|
|
172
|
-
markProfilingEnd(operationTimer, {
|
|
173
|
-
tags: ['vc']
|
|
174
|
-
});
|
|
175
167
|
}
|
|
176
168
|
start() {
|
|
177
169
|
var _this$mutationObserve, _this$performanceObse;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
const isValidEntry = withProfiling(function isValidEntry(entry) {
|
|
1
|
+
function isValidEntry(entry) {
|
|
3
2
|
return entry.isIntersecting && entry.intersectionRect.width > 0 && entry.intersectionRect.height > 0;
|
|
4
|
-
}
|
|
5
|
-
export function createIntersectionObserver(
|
|
3
|
+
}
|
|
4
|
+
export function createIntersectionObserver({
|
|
5
|
+
onEntry,
|
|
6
|
+
onObserved
|
|
7
|
+
}) {
|
|
6
8
|
if (!window || typeof window.IntersectionObserver !== 'function') {
|
|
7
9
|
return null;
|
|
8
10
|
}
|
|
9
|
-
const onEntry = withProfiling(args.onEntry, ['vc']);
|
|
10
|
-
const onObserved = typeof args.onObserved === 'function' ? withProfiling(args.onObserved, ['vc']) : undefined;
|
|
11
11
|
const callbacksPerElement = new WeakMap();
|
|
12
|
-
const intersectionObserverCallback =
|
|
12
|
+
const intersectionObserverCallback = entries => {
|
|
13
13
|
const validEntries = [];
|
|
14
14
|
const startTime = performance.now();
|
|
15
15
|
entries.forEach(entry => {
|
|
@@ -51,7 +51,7 @@ export function createIntersectionObserver(args) {
|
|
|
51
51
|
time: startTime,
|
|
52
52
|
elements: validEntries
|
|
53
53
|
});
|
|
54
|
-
}
|
|
54
|
+
};
|
|
55
55
|
const observer = new IntersectionObserver(intersectionObserverCallback);
|
|
56
56
|
return {
|
|
57
57
|
disconnect: () => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
function createMutationObserver({
|
|
2
|
+
onAttributeMutation,
|
|
3
|
+
onChildListMutation,
|
|
4
|
+
onMutationFinished
|
|
5
|
+
}) {
|
|
3
6
|
if (!window || typeof window.IntersectionObserver !== 'function') {
|
|
4
7
|
return null;
|
|
5
8
|
}
|
|
6
|
-
const
|
|
7
|
-
const onChildListMutation = withProfiling(props.onChildListMutation, ['vc']);
|
|
8
|
-
const onMutationFinished = typeof props.onMutationFinished === 'function' ? withProfiling(props.onMutationFinished, ['vc']) : undefined;
|
|
9
|
-
const mutationObserverCallback = withProfiling(function mutationObserverCallback(mutations) {
|
|
9
|
+
const mutationObserverCallback = mutations => {
|
|
10
10
|
const addedNodes = [];
|
|
11
11
|
const removedNodes = [];
|
|
12
12
|
const targets = [];
|
|
@@ -17,13 +17,13 @@ const createMutationObserver = withProfiling(function createMutationObserver(pro
|
|
|
17
17
|
if (mut.type === 'attributes') {
|
|
18
18
|
var _mut$oldValue;
|
|
19
19
|
/*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
21
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
22
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
23
|
+
and whether or not they are the same doesn't really matter.
|
|
24
|
+
And Custom elements should work the same way as MutationObserver."
|
|
25
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
26
|
+
*/
|
|
27
27
|
const oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
|
|
28
28
|
const newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
|
|
29
29
|
if (oldValue !== newValue) {
|
|
@@ -56,8 +56,8 @@ const createMutationObserver = withProfiling(function createMutationObserver(pro
|
|
|
56
56
|
onMutationFinished === null || onMutationFinished === void 0 ? void 0 : onMutationFinished({
|
|
57
57
|
targets
|
|
58
58
|
});
|
|
59
|
-
}
|
|
59
|
+
};
|
|
60
60
|
const observer = new MutationObserver(mutationObserverCallback);
|
|
61
61
|
return observer;
|
|
62
|
-
}
|
|
62
|
+
}
|
|
63
63
|
export default createMutationObserver;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { withProfiling } from '../../../../self-measurements';
|
|
2
|
-
|
|
3
1
|
// The LayoutShiftAttribution API is returning the numbers on physical dimension
|
|
4
|
-
export
|
|
2
|
+
export function convertPhysicalToLogicalResolution(rect) {
|
|
5
3
|
if (typeof window.devicePixelRatio !== 'number') {
|
|
6
4
|
return rect;
|
|
7
5
|
}
|
|
@@ -11,13 +9,14 @@ export const convertPhysicalToLogicalResolution = withProfiling(function convert
|
|
|
11
9
|
|
|
12
10
|
// eslint-disable-next-line compat/compat
|
|
13
11
|
return new DOMRect(rect.x / window.devicePixelRatio, rect.y / window.devicePixelRatio, rect.width / window.devicePixelRatio, rect.height / window.devicePixelRatio);
|
|
14
|
-
}
|
|
15
|
-
|
|
12
|
+
}
|
|
13
|
+
function createPerformanceObserver({
|
|
14
|
+
onLayoutShift
|
|
15
|
+
}) {
|
|
16
16
|
if (!window || typeof window.PerformanceObserver !== 'function') {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
const performanceObserverCallback = withProfiling(function performanceObserverCallback(entries) {
|
|
19
|
+
const performanceObserverCallback = entries => {
|
|
21
20
|
for (const entry of entries.getEntries()) {
|
|
22
21
|
if (entry.entryType === 'layout-shift') {
|
|
23
22
|
// Ignored via go/ees005
|
|
@@ -36,8 +35,8 @@ const createPerformanceObserver = withProfiling(function createPerformanceObserv
|
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
}
|
|
38
|
+
};
|
|
40
39
|
const observer = new PerformanceObserver(performanceObserverCallback);
|
|
41
40
|
return observer;
|
|
42
|
-
}
|
|
41
|
+
}
|
|
43
42
|
export default createPerformanceObserver;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
|
-
import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../self-measurements';
|
|
4
3
|
export default class WindowEventObserver {
|
|
5
4
|
constructor(opts) {
|
|
6
5
|
_defineProperty(this, "unbindFns", []);
|
|
7
|
-
|
|
8
|
-
this.onEvent = withProfiling(opts.onEvent, ['vc']);
|
|
9
|
-
this.bindEvent = withProfiling(this.bindEvent.bind(this), ['vc']);
|
|
10
|
-
this.start = withProfiling(this.start.bind(this), ['vc']);
|
|
11
|
-
this.stop = withProfiling(this.stop.bind(this), ['vc']);
|
|
12
|
-
markProfilingEnd(operationTimer);
|
|
6
|
+
this.onEvent = opts.onEvent;
|
|
13
7
|
}
|
|
14
8
|
bindEvent(type) {
|
|
15
9
|
const unbindCallback = bind(window, {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { withProfiling } from '../../../self-measurements';
|
|
2
1
|
/* Borrowed from https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/performance/browser-metrics/src/plugins/timings/resource.ts */
|
|
3
2
|
var cacheableTypes = ['script', 'link'];
|
|
4
3
|
var CACHE_NETWORK = 'network';
|
|
5
4
|
var CACHE_MEMORY = 'memory';
|
|
6
5
|
var CACHE_DISK = 'disk';
|
|
7
|
-
|
|
6
|
+
function calculateTransferType(type, duration, size) {
|
|
8
7
|
if (!cacheableTypes.includes(type)) {
|
|
9
8
|
return CACHE_NETWORK;
|
|
10
9
|
}
|
|
@@ -18,8 +17,8 @@ var calculateTransferType = withProfiling(function calculateTransferType(type, d
|
|
|
18
17
|
return null;
|
|
19
18
|
}
|
|
20
19
|
return CACHE_NETWORK;
|
|
21
|
-
}
|
|
22
|
-
export
|
|
20
|
+
}
|
|
21
|
+
export function getCacheHitRatio(_ref) {
|
|
23
22
|
var start = _ref.start;
|
|
24
23
|
var fromCache = 0;
|
|
25
24
|
var preloadFromCache = 0;
|
|
@@ -61,4 +60,4 @@ export var getCacheHitRatio = withProfiling(function getCacheHitRatio(_ref) {
|
|
|
61
60
|
} catch (e) {
|
|
62
61
|
return {};
|
|
63
62
|
}
|
|
64
|
-
}
|
|
63
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
2
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
3
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
|
-
|
|
5
|
-
export var getCLS = withProfiling(function getCLS(start, stop, buffer) {
|
|
4
|
+
export function getCLS(start, stop, buffer) {
|
|
6
5
|
var layoutShifts = buffer.getAll().filter(function (entry) {
|
|
7
6
|
return entry.startTime >= start && entry.startTime <= stop;
|
|
8
7
|
});
|
|
@@ -45,4 +44,4 @@ export var getCLS = withProfiling(function getCLS(start, stop, buffer) {
|
|
|
45
44
|
|
|
46
45
|
// Return score of largest burst as CLS metric
|
|
47
46
|
return Math.round(maxScore * 10000) / 10000;
|
|
48
|
-
}
|
|
47
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { withProfiling } from '../../../self-measurements';
|
|
2
1
|
import { getCLS } from './cls';
|
|
3
2
|
import { PerformanceObserverEntryTypes } from './const';
|
|
4
3
|
import { getTBT } from './tbt';
|
|
5
4
|
import { EntriesBuffer } from './utils/buffer';
|
|
6
5
|
import { startLSObserver, startLTObserver } from './utils/observer';
|
|
7
|
-
export
|
|
6
|
+
export function startLighthouseObserver() {
|
|
8
7
|
startLSObserver();
|
|
9
8
|
startLTObserver();
|
|
10
|
-
}
|
|
11
|
-
export
|
|
9
|
+
}
|
|
10
|
+
export function getLighthouseMetrics(_ref) {
|
|
12
11
|
var start = _ref.start,
|
|
13
12
|
stop = _ref.stop;
|
|
14
13
|
var tbt = getTBT(start, stop, EntriesBuffer[PerformanceObserverEntryTypes.LongTask]);
|
|
@@ -20,4 +19,4 @@ export var getLighthouseMetrics = withProfiling(function getLighthouseMetrics(_r
|
|
|
20
19
|
'metric:tbt:observed': Math.round(tbt.observed),
|
|
21
20
|
'metric:cls': cls
|
|
22
21
|
};
|
|
23
|
-
}
|
|
22
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { withProfiling } from '../../../../self-measurements';
|
|
2
1
|
var MAX_ACCEPTABLE_TASK_DURATION = 50;
|
|
3
|
-
export
|
|
2
|
+
export function getTBT(start, stop, buffer) {
|
|
4
3
|
return buffer.getAll().filter(function (entry) {
|
|
5
4
|
return entry.startTime <= stop && entry.duration > MAX_ACCEPTABLE_TASK_DURATION && (entry.startTime >= start || entry.startTime + entry.duration >= start || entry.startTime <= start && entry.startTime + entry.duration >= stop);
|
|
6
5
|
}).reduce(function (tbt, entry) {
|
|
@@ -17,4 +16,4 @@ export var getTBT = withProfiling(function getTBT(start, stop, buffer) {
|
|
|
17
16
|
total: 0,
|
|
18
17
|
observed: 0
|
|
19
18
|
});
|
|
20
|
-
}
|
|
19
|
+
}
|