@atlaskit/react-ufo 1.1.0 → 2.0.1
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 +32 -0
- package/README.md +5 -0
- package/additional-payload/package.json +15 -0
- package/bundle-eval-timing/package.json +15 -0
- package/coinflip/package.json +15 -0
- package/common/package.json +5 -5
- package/config/package.json +15 -0
- package/create-payload/package.json +15 -0
- package/create-post-interaction-log-payload/package.json +15 -0
- package/custom-data/package.json +15 -0
- package/custom-mark/package.json +15 -0
- package/custom-spans/package.json +15 -0
- package/custom-timings/package.json +15 -0
- package/dist/cjs/additional-payload/index.js +25 -0
- package/dist/cjs/additional-payload/utils/cache-hit-ratio/index.js +69 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/cls/index.js +53 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/const.js +10 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/index.js +29 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/tbt/index.js +25 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +38 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +37 -0
- package/dist/cjs/bundle-eval-timing/index.js +48 -0
- package/dist/cjs/coinflip/index.js +22 -0
- package/dist/cjs/common/common/types.js +5 -0
- package/dist/cjs/common/constants.js +7 -0
- package/dist/cjs/common/index.js +1 -0
- package/dist/cjs/common/vc/types.js +11 -0
- package/dist/cjs/config/index.js +222 -0
- package/dist/cjs/create-payload/common/types.js +1 -0
- package/dist/cjs/create-payload/common/utils/index.js +15 -0
- package/dist/cjs/create-payload/index.js +784 -0
- package/dist/cjs/create-post-interaction-log-payload/index.js +207 -0
- package/dist/cjs/custom-data/index.js +31 -0
- package/dist/cjs/custom-data/types.js +5 -0
- package/dist/cjs/custom-mark/index.js +45 -0
- package/dist/cjs/custom-spans/index.js +14 -0
- package/dist/cjs/custom-timings/index.js +65 -0
- package/dist/cjs/experience-trace-id-context/index.js +40 -0
- package/dist/cjs/experience-trace-id-context/types.js +1 -0
- package/dist/cjs/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +12 -0
- package/dist/cjs/feature-flags-accessed/common/constants.js +7 -0
- package/dist/cjs/feature-flags-accessed/common/types.js +5 -0
- package/dist/cjs/feature-flags-accessed/common/utils/index.js +38 -0
- package/dist/cjs/feature-flags-accessed/index.js +32 -0
- package/dist/cjs/generate-id/index.js +12 -0
- package/dist/cjs/global-error-handler/index.js +74 -0
- package/dist/cjs/hidden-timing/index.js +94 -0
- package/dist/cjs/initial-page-load-extra-timing/index.js +49 -0
- package/dist/cjs/interaction-context/index.js +14 -0
- package/dist/cjs/interaction-id-context/index.js +27 -0
- package/dist/cjs/interaction-metrics/common/constants.js +8 -0
- package/dist/cjs/interaction-metrics/index.js +810 -1
- package/dist/cjs/interaction-metrics/post-interaction-log.js +190 -0
- package/dist/cjs/interaction-metrics-init/index.js +89 -0
- package/dist/cjs/label/UFOLabel.js +45 -0
- package/dist/cjs/label/index.js +9 -0
- package/dist/cjs/load-hold/UFOLoadHold.js +76 -0
- package/dist/cjs/load-hold/index.js +9 -0
- package/dist/cjs/placeholder/Placeholder.js +34 -0
- package/dist/cjs/placeholder/index.js +9 -0
- package/dist/cjs/placeholder/loosely-lazy/index.js +19 -0
- package/dist/cjs/placeholder/loosely-lazy/lazy-suspense.js +80 -0
- package/dist/cjs/placeholder/loosely-lazy/types.js +5 -0
- package/dist/cjs/placeholder/loosely-lazy/wait-context.js +15 -0
- package/dist/cjs/resource-timing/common/types.js +1 -0
- package/dist/cjs/resource-timing/common/utils/config.js +70 -0
- package/dist/cjs/resource-timing/common/utils/resource-timing-buffer.js +111 -0
- package/dist/cjs/resource-timing/index.js +26 -0
- package/dist/cjs/resource-timing/main.js +141 -0
- package/dist/cjs/resource-timing/utils.js +10 -0
- package/dist/cjs/round-number/index.js +11 -0
- package/dist/cjs/route-name/index.js +12 -0
- package/dist/cjs/route-name-context/index.js +11 -0
- package/dist/cjs/segment/index.js +9 -0
- package/dist/cjs/segment/segment-highlight.js +40 -0
- package/dist/cjs/segment/segment.js +247 -0
- package/dist/cjs/set-interaction-error/index.js +17 -0
- package/dist/cjs/short-id/index.js +15 -0
- package/dist/cjs/ssr/index.js +70 -0
- package/dist/cjs/trace-interaction/index.js +48 -0
- package/dist/cjs/trace-pageload/index.js +58 -0
- package/dist/cjs/trace-press/index.js +34 -0
- package/dist/cjs/trace-redirect/index.js +17 -0
- package/dist/cjs/trace-transition/index.js +60 -0
- package/dist/cjs/trace-transition/utils/generate-span-id/index.js +11 -0
- package/dist/cjs/trace-transition/utils/set-interaction-active-trace/index.js +11 -0
- package/dist/cjs/typing-performance-tracing/index.js +262 -0
- package/dist/cjs/use-press-tracing/index.js +19 -0
- package/dist/cjs/vc/index.js +15 -0
- package/dist/cjs/vc/vc-observer/attachAbortListeners.js +40 -0
- package/dist/cjs/vc/vc-observer/getViewport.js +27 -0
- package/dist/cjs/vc/vc-observer/index.js +562 -0
- package/dist/cjs/vc/vc-observer/media-wrapper/index.js +15 -0
- package/dist/cjs/vc/vc-observer/media-wrapper/vc-utils.js +16 -0
- package/dist/cjs/vc/vc-observer/observers/index.js +270 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +183 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.js +22 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.js +20 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.js +19 -0
- package/dist/cjs/vc/vc-observer/observers/types.js +5 -0
- package/dist/es2019/additional-payload/index.js +2 -0
- package/dist/es2019/additional-payload/utils/cache-hit-ratio/index.js +63 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/cls/index.js +33 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/const.js +4 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/index.js +23 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/tbt/index.js +15 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +23 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +31 -0
- package/dist/es2019/bundle-eval-timing/index.js +43 -0
- package/dist/es2019/coinflip/index.js +16 -0
- package/dist/es2019/common/common/types.js +1 -0
- package/dist/es2019/common/constants.js +1 -0
- package/dist/es2019/common/vc/types.js +5 -0
- package/dist/es2019/config/index.js +215 -0
- package/dist/es2019/create-payload/common/types.js +0 -0
- package/dist/es2019/create-payload/common/utils/index.js +8 -0
- package/dist/es2019/create-payload/index.js +792 -0
- package/dist/es2019/create-post-interaction-log-payload/index.js +188 -0
- package/dist/es2019/custom-data/index.js +24 -0
- package/dist/es2019/custom-data/types.js +1 -0
- package/dist/es2019/custom-mark/index.js +38 -0
- package/dist/es2019/custom-spans/index.js +6 -0
- package/dist/es2019/custom-timings/index.js +57 -0
- package/dist/es2019/experience-trace-id-context/index.js +31 -0
- package/dist/es2019/experience-trace-id-context/types.js +0 -0
- package/dist/es2019/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +4 -0
- package/dist/es2019/feature-flags-accessed/common/constants.js +1 -0
- package/dist/es2019/feature-flags-accessed/common/types.js +1 -0
- package/dist/es2019/feature-flags-accessed/common/utils/index.js +24 -0
- package/dist/es2019/feature-flags-accessed/index.js +21 -0
- package/dist/es2019/generate-id/index.js +6 -0
- package/dist/es2019/global-error-handler/index.js +64 -0
- package/dist/es2019/hidden-timing/index.js +87 -0
- package/dist/es2019/initial-page-load-extra-timing/index.js +43 -0
- package/dist/es2019/interaction-context/index.js +6 -0
- package/dist/es2019/interaction-id-context/index.js +18 -0
- package/dist/es2019/interaction-metrics/common/constants.js +2 -0
- package/dist/es2019/interaction-metrics/index.js +736 -0
- package/dist/es2019/interaction-metrics/post-interaction-log.js +158 -0
- package/dist/es2019/interaction-metrics-init/index.js +72 -0
- package/dist/es2019/label/UFOLabel.js +34 -0
- package/dist/es2019/label/index.js +2 -0
- package/dist/es2019/load-hold/UFOLoadHold.js +66 -0
- package/dist/es2019/load-hold/index.js +2 -0
- package/dist/es2019/placeholder/Placeholder.js +25 -0
- package/dist/es2019/placeholder/index.js +2 -0
- package/dist/es2019/placeholder/loosely-lazy/index.js +2 -0
- package/dist/es2019/placeholder/loosely-lazy/lazy-suspense.js +63 -0
- package/dist/es2019/placeholder/loosely-lazy/types.js +1 -0
- package/dist/es2019/placeholder/loosely-lazy/wait-context.js +5 -0
- package/dist/es2019/resource-timing/common/types.js +0 -0
- package/dist/es2019/resource-timing/common/utils/config.js +44 -0
- package/dist/es2019/resource-timing/common/utils/resource-timing-buffer.js +88 -0
- package/dist/es2019/resource-timing/index.js +3 -0
- package/dist/es2019/resource-timing/main.js +130 -0
- package/dist/es2019/resource-timing/utils.js +4 -0
- package/dist/es2019/round-number/index.js +4 -0
- package/dist/es2019/route-name/index.js +6 -0
- package/dist/es2019/route-name-context/index.js +5 -0
- package/dist/es2019/segment/index.js +2 -0
- package/dist/es2019/segment/segment-highlight.js +27 -0
- package/dist/es2019/segment/segment.js +218 -0
- package/dist/es2019/set-interaction-error/index.js +11 -0
- package/dist/es2019/short-id/index.js +8 -0
- package/dist/es2019/ssr/index.js +54 -0
- package/dist/es2019/trace-interaction/index.js +41 -0
- package/dist/es2019/trace-pageload/index.js +48 -0
- package/dist/es2019/trace-press/index.js +27 -0
- package/dist/es2019/trace-redirect/index.js +10 -0
- package/dist/es2019/trace-transition/index.js +48 -0
- package/dist/es2019/trace-transition/utils/generate-span-id/index.js +1 -0
- package/dist/es2019/trace-transition/utils/set-interaction-active-trace/index.js +5 -0
- package/dist/es2019/typing-performance-tracing/index.js +255 -0
- package/dist/es2019/use-press-tracing/index.js +12 -0
- package/dist/es2019/vc/index.js +8 -0
- package/dist/es2019/vc/vc-observer/attachAbortListeners.js +34 -0
- package/dist/es2019/vc/vc-observer/getViewport.js +18 -0
- package/dist/es2019/vc/vc-observer/index.js +522 -0
- package/dist/es2019/vc/vc-observer/media-wrapper/index.js +9 -0
- package/dist/es2019/vc/vc-observer/media-wrapper/vc-utils.js +10 -0
- package/dist/es2019/vc/vc-observer/observers/index.js +231 -0
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +146 -0
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.js +16 -0
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.js +14 -0
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.js +2 -0
- package/dist/es2019/vc/vc-observer/observers/types.js +1 -0
- package/dist/esm/additional-payload/index.js +2 -0
- package/dist/esm/additional-payload/utils/cache-hit-ratio/index.js +63 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/cls/index.js +47 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/cls/types.js +0 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/const.js +4 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/index.js +22 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/tbt/index.js +19 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +31 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +31 -0
- package/dist/esm/bundle-eval-timing/index.js +41 -0
- package/dist/esm/coinflip/index.js +16 -0
- package/dist/esm/common/common/types.js +1 -0
- package/dist/esm/common/constants.js +1 -0
- package/dist/esm/common/index.js +0 -0
- package/dist/esm/common/vc/types.js +5 -0
- package/dist/esm/config/index.js +206 -0
- package/dist/esm/create-payload/common/types.js +0 -0
- package/dist/esm/create-payload/common/utils/index.js +8 -0
- package/dist/esm/create-payload/index.js +774 -0
- package/dist/esm/create-post-interaction-log-payload/index.js +200 -0
- package/dist/esm/custom-data/index.js +23 -0
- package/dist/esm/custom-data/types.js +1 -0
- package/dist/esm/custom-mark/index.js +36 -0
- package/dist/esm/custom-spans/index.js +8 -0
- package/dist/esm/custom-timings/index.js +56 -0
- package/dist/esm/experience-trace-id-context/index.js +34 -0
- package/dist/esm/experience-trace-id-context/types.js +0 -0
- package/dist/esm/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +6 -0
- package/dist/esm/feature-flags-accessed/common/constants.js +1 -0
- package/dist/esm/feature-flags-accessed/common/types.js +1 -0
- package/dist/esm/feature-flags-accessed/common/utils/index.js +31 -0
- package/dist/esm/feature-flags-accessed/index.js +21 -0
- package/dist/esm/generate-id/index.js +6 -0
- package/dist/esm/global-error-handler/index.js +67 -0
- package/dist/esm/hidden-timing/index.js +87 -0
- package/dist/esm/initial-page-load-extra-timing/index.js +42 -0
- package/dist/esm/interaction-context/index.js +6 -0
- package/dist/esm/interaction-id-context/index.js +22 -0
- package/dist/esm/interaction-metrics/common/constants.js +2 -0
- package/dist/esm/interaction-metrics/index.js +773 -0
- package/dist/esm/interaction-metrics/post-interaction-log.js +184 -0
- package/dist/esm/interaction-metrics-init/index.js +77 -0
- package/dist/esm/label/UFOLabel.js +36 -0
- package/dist/esm/label/index.js +2 -0
- package/dist/esm/load-hold/UFOLoadHold.js +66 -0
- package/dist/esm/load-hold/index.js +2 -0
- package/dist/esm/placeholder/Placeholder.js +25 -0
- package/dist/esm/placeholder/index.js +2 -0
- package/dist/esm/placeholder/loosely-lazy/index.js +2 -0
- package/dist/esm/placeholder/loosely-lazy/lazy-suspense.js +70 -0
- package/dist/esm/placeholder/loosely-lazy/types.js +1 -0
- package/dist/esm/placeholder/loosely-lazy/wait-context.js +9 -0
- package/dist/esm/resource-timing/common/types.js +0 -0
- package/dist/esm/resource-timing/common/utils/config.js +62 -0
- package/dist/esm/resource-timing/common/utils/resource-timing-buffer.js +104 -0
- package/dist/esm/resource-timing/index.js +3 -0
- package/dist/esm/resource-timing/main.js +134 -0
- package/dist/esm/resource-timing/utils.js +4 -0
- package/dist/esm/round-number/index.js +5 -0
- package/dist/esm/route-name/index.js +6 -0
- package/dist/esm/route-name-context/index.js +5 -0
- package/dist/esm/segment/index.js +2 -0
- package/dist/esm/segment/segment-highlight.js +30 -0
- package/dist/esm/segment/segment.js +235 -0
- package/dist/esm/set-interaction-error/index.js +11 -0
- package/dist/esm/short-id/index.js +9 -0
- package/dist/esm/ssr/index.js +59 -0
- package/dist/esm/trace-interaction/index.js +41 -0
- package/dist/esm/trace-pageload/index.js +50 -0
- package/dist/esm/trace-press/index.js +27 -0
- package/dist/esm/trace-redirect/index.js +10 -0
- package/dist/esm/trace-transition/index.js +49 -0
- package/dist/esm/trace-transition/utils/generate-span-id/index.js +5 -0
- package/dist/esm/trace-transition/utils/set-interaction-active-trace/index.js +5 -0
- package/dist/esm/typing-performance-tracing/index.js +255 -0
- package/dist/esm/use-press-tracing/index.js +12 -0
- package/dist/esm/vc/index.js +9 -0
- package/dist/esm/vc/vc-observer/attachAbortListeners.js +34 -0
- package/dist/esm/vc/vc-observer/getViewport.js +20 -0
- package/dist/esm/vc/vc-observer/index.js +555 -0
- package/dist/esm/vc/vc-observer/media-wrapper/index.js +7 -0
- package/dist/esm/vc/vc-observer/media-wrapper/vc-utils.js +10 -0
- package/dist/esm/vc/vc-observer/observers/index.js +263 -0
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +176 -0
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.js +16 -0
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.js +14 -0
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.js +2 -0
- package/dist/esm/vc/vc-observer/observers/types.js +1 -0
- package/dist/types/additional-payload/index.d.ts +2 -0
- package/dist/types/additional-payload/utils/cache-hit-ratio/index.d.ts +8 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/cls/index.d.ts +2 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/cls/types.d.ts +3 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/const.d.ts +5 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/index.d.ts +7 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/tbt/index.d.ts +5 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/utils/buffer/index.d.ts +13 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/utils/observer/index.d.ts +2 -0
- package/dist/types/bundle-eval-timing/index.d.ts +16 -0
- package/dist/types/coinflip/index.d.ts +8 -0
- package/dist/types/common/common/types.d.ts +201 -0
- package/dist/types/common/constants.d.ts +1 -0
- package/dist/types/common/index.d.ts +5 -0
- package/dist/types/common/vc/types.d.ts +91 -0
- package/dist/types/config/index.d.ts +91 -0
- package/dist/types/create-payload/common/types.d.ts +4 -0
- package/dist/types/create-payload/common/utils/index.d.ts +3 -0
- package/dist/types/create-payload/index.d.ts +2969 -0
- package/dist/types/create-post-interaction-log-payload/index.d.ts +45 -0
- package/dist/types/custom-data/index.d.ts +5 -0
- package/dist/types/custom-data/types.d.ts +4 -0
- package/dist/types/custom-mark/index.d.ts +10 -0
- package/dist/types/custom-spans/index.d.ts +1 -0
- package/dist/types/custom-timings/index.d.ts +19 -0
- package/dist/types/experience-trace-id-context/index.d.ts +10 -0
- package/dist/types/experience-trace-id-context/types.d.ts +8 -0
- package/dist/types/experience-trace-id-context/utils/make-trace-http-request-headers/index.d.ts +4 -0
- package/dist/types/feature-flags-accessed/common/constants.d.ts +1 -0
- package/dist/types/feature-flags-accessed/common/types.d.ts +2 -0
- package/dist/types/feature-flags-accessed/common/utils/index.d.ts +3 -0
- package/dist/types/feature-flags-accessed/index.d.ts +14 -0
- package/dist/types/generate-id/index.d.ts +2 -0
- package/dist/types/global-error-handler/index.d.ts +3 -0
- package/dist/types/hidden-timing/index.d.ts +7 -0
- package/dist/types/initial-page-load-extra-timing/index.d.ts +9 -0
- package/dist/types/interaction-context/index.d.ts +33 -0
- package/dist/types/interaction-id-context/index.d.ts +9 -0
- package/dist/types/interaction-metrics/common/constants.d.ts +3 -0
- package/dist/types/interaction-metrics/index.d.ts +65 -1
- package/dist/types/interaction-metrics/post-interaction-log.d.ts +69 -0
- package/dist/types/interaction-metrics-init/index.d.ts +11 -0
- package/dist/types/label/UFOLabel.d.ts +13 -0
- package/dist/types/label/index.d.ts +2 -0
- package/dist/types/load-hold/UFOLoadHold.d.ts +53 -0
- package/dist/types/load-hold/index.d.ts +2 -0
- package/dist/types/placeholder/Placeholder.d.ts +13 -0
- package/dist/types/placeholder/index.d.ts +2 -0
- package/dist/types/placeholder/loosely-lazy/index.d.ts +3 -0
- package/dist/types/placeholder/loosely-lazy/lazy-suspense.d.ts +6 -0
- package/dist/types/placeholder/loosely-lazy/types.d.ts +20 -0
- package/dist/types/placeholder/loosely-lazy/wait-context.d.ts +3 -0
- package/dist/types/resource-timing/common/types.d.ts +41 -0
- package/dist/types/resource-timing/common/utils/config.d.ts +3 -0
- package/dist/types/resource-timing/common/utils/resource-timing-buffer.d.ts +11 -0
- package/dist/types/resource-timing/index.d.ts +4 -0
- package/dist/types/resource-timing/main.d.ts +2 -0
- package/dist/types/resource-timing/utils.d.ts +1 -0
- package/dist/types/round-number/index.d.ts +1 -0
- package/dist/types/route-name/index.d.ts +4 -0
- package/dist/types/route-name-context/index.d.ts +5 -0
- package/dist/types/segment/index.d.ts +2 -0
- package/dist/types/segment/segment-highlight.d.ts +6 -0
- package/dist/types/segment/segment.d.ts +8 -0
- package/dist/types/set-interaction-error/index.d.ts +4 -0
- package/dist/types/short-id/index.d.ts +1 -0
- package/dist/types/ssr/index.d.ts +21 -0
- package/dist/types/trace-interaction/index.d.ts +2 -0
- package/dist/types/trace-pageload/index.d.ts +2 -0
- package/dist/types/trace-press/index.d.ts +1 -0
- package/dist/types/trace-redirect/index.d.ts +1 -0
- package/dist/types/trace-transition/index.d.ts +2 -0
- package/dist/types/trace-transition/utils/generate-span-id/index.d.ts +1 -0
- package/dist/types/trace-transition/utils/set-interaction-active-trace/index.d.ts +1 -0
- package/dist/types/typing-performance-tracing/index.d.ts +2 -0
- package/dist/types/use-press-tracing/index.d.ts +1 -0
- package/dist/types/vc/index.d.ts +2 -0
- package/dist/types/vc/vc-observer/attachAbortListeners.d.ts +6 -0
- package/dist/types/vc/vc-observer/getViewport.d.ts +2 -0
- package/dist/types/vc/vc-observer/index.d.ts +98 -0
- package/dist/types/vc/vc-observer/media-wrapper/index.d.ts +7 -0
- package/dist/types/vc/vc-observer/media-wrapper/vc-utils.d.ts +1 -0
- package/dist/types/vc/vc-observer/observers/index.d.ts +39 -0
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/index.d.ts +23 -0
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.d.ts +1 -0
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.d.ts +1 -0
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.d.ts +2 -0
- package/dist/types/vc/vc-observer/observers/types.d.ts +11 -0
- package/dist/types-ts4.5/additional-payload/index.d.ts +2 -0
- package/dist/types-ts4.5/additional-payload/utils/cache-hit-ratio/index.d.ts +8 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/cls/index.d.ts +2 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/cls/types.d.ts +3 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/const.d.ts +5 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/index.d.ts +7 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/tbt/index.d.ts +5 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/utils/buffer/index.d.ts +13 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/utils/observer/index.d.ts +2 -0
- package/dist/types-ts4.5/bundle-eval-timing/index.d.ts +16 -0
- package/dist/types-ts4.5/coinflip/index.d.ts +8 -0
- package/dist/types-ts4.5/common/common/types.d.ts +201 -0
- package/dist/types-ts4.5/common/constants.d.ts +1 -0
- package/dist/types-ts4.5/common/index.d.ts +5 -0
- package/dist/types-ts4.5/common/vc/types.d.ts +91 -0
- package/dist/types-ts4.5/config/index.d.ts +95 -0
- package/dist/types-ts4.5/create-payload/common/types.d.ts +4 -0
- package/dist/types-ts4.5/create-payload/common/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/create-payload/index.d.ts +2969 -0
- package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +45 -0
- package/dist/types-ts4.5/custom-data/index.d.ts +5 -0
- package/dist/types-ts4.5/custom-data/types.d.ts +4 -0
- package/dist/types-ts4.5/custom-mark/index.d.ts +10 -0
- package/dist/types-ts4.5/custom-spans/index.d.ts +1 -0
- package/dist/types-ts4.5/custom-timings/index.d.ts +19 -0
- package/dist/types-ts4.5/experience-trace-id-context/index.d.ts +10 -0
- package/dist/types-ts4.5/experience-trace-id-context/types.d.ts +8 -0
- package/dist/types-ts4.5/experience-trace-id-context/utils/make-trace-http-request-headers/index.d.ts +4 -0
- package/dist/types-ts4.5/feature-flags-accessed/common/constants.d.ts +1 -0
- package/dist/types-ts4.5/feature-flags-accessed/common/types.d.ts +2 -0
- package/dist/types-ts4.5/feature-flags-accessed/common/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/feature-flags-accessed/index.d.ts +14 -0
- package/dist/types-ts4.5/generate-id/index.d.ts +2 -0
- package/dist/types-ts4.5/global-error-handler/index.d.ts +3 -0
- package/dist/types-ts4.5/hidden-timing/index.d.ts +7 -0
- package/dist/types-ts4.5/initial-page-load-extra-timing/index.d.ts +9 -0
- package/dist/types-ts4.5/interaction-context/index.d.ts +33 -0
- package/dist/types-ts4.5/interaction-id-context/index.d.ts +9 -0
- package/dist/types-ts4.5/interaction-metrics/common/constants.d.ts +3 -0
- package/dist/types-ts4.5/interaction-metrics/index.d.ts +65 -1
- package/dist/types-ts4.5/interaction-metrics/post-interaction-log.d.ts +69 -0
- package/dist/types-ts4.5/interaction-metrics-init/index.d.ts +11 -0
- package/dist/types-ts4.5/label/UFOLabel.d.ts +13 -0
- package/dist/types-ts4.5/label/index.d.ts +2 -0
- package/dist/types-ts4.5/load-hold/UFOLoadHold.d.ts +53 -0
- package/dist/types-ts4.5/load-hold/index.d.ts +2 -0
- package/dist/types-ts4.5/placeholder/Placeholder.d.ts +13 -0
- package/dist/types-ts4.5/placeholder/index.d.ts +2 -0
- package/dist/types-ts4.5/placeholder/loosely-lazy/index.d.ts +3 -0
- package/dist/types-ts4.5/placeholder/loosely-lazy/lazy-suspense.d.ts +6 -0
- package/dist/types-ts4.5/placeholder/loosely-lazy/types.d.ts +20 -0
- package/dist/types-ts4.5/placeholder/loosely-lazy/wait-context.d.ts +3 -0
- package/dist/types-ts4.5/resource-timing/common/types.d.ts +41 -0
- package/dist/types-ts4.5/resource-timing/common/utils/config.d.ts +3 -0
- package/dist/types-ts4.5/resource-timing/common/utils/resource-timing-buffer.d.ts +11 -0
- package/dist/types-ts4.5/resource-timing/index.d.ts +4 -0
- package/dist/types-ts4.5/resource-timing/main.d.ts +2 -0
- package/dist/types-ts4.5/resource-timing/utils.d.ts +1 -0
- package/dist/types-ts4.5/round-number/index.d.ts +1 -0
- package/dist/types-ts4.5/route-name/index.d.ts +4 -0
- package/dist/types-ts4.5/route-name-context/index.d.ts +5 -0
- package/dist/types-ts4.5/segment/index.d.ts +2 -0
- package/dist/types-ts4.5/segment/segment-highlight.d.ts +6 -0
- package/dist/types-ts4.5/segment/segment.d.ts +8 -0
- package/dist/types-ts4.5/set-interaction-error/index.d.ts +4 -0
- package/dist/types-ts4.5/short-id/index.d.ts +1 -0
- package/dist/types-ts4.5/ssr/index.d.ts +21 -0
- package/dist/types-ts4.5/trace-interaction/index.d.ts +2 -0
- package/dist/types-ts4.5/trace-pageload/index.d.ts +2 -0
- package/dist/types-ts4.5/trace-press/index.d.ts +1 -0
- package/dist/types-ts4.5/trace-redirect/index.d.ts +1 -0
- package/dist/types-ts4.5/trace-transition/index.d.ts +2 -0
- package/dist/types-ts4.5/trace-transition/utils/generate-span-id/index.d.ts +1 -0
- package/dist/types-ts4.5/trace-transition/utils/set-interaction-active-trace/index.d.ts +1 -0
- package/dist/types-ts4.5/typing-performance-tracing/index.d.ts +2 -0
- package/dist/types-ts4.5/use-press-tracing/index.d.ts +1 -0
- package/dist/types-ts4.5/vc/index.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer/attachAbortListeners.d.ts +6 -0
- package/dist/types-ts4.5/vc/vc-observer/getViewport.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +98 -0
- package/dist/types-ts4.5/vc/vc-observer/media-wrapper/index.d.ts +7 -0
- package/dist/types-ts4.5/vc/vc-observer/media-wrapper/vc-utils.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/index.d.ts +39 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/index.d.ts +23 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/types.d.ts +11 -0
- package/experience-trace-id-context/package.json +15 -0
- package/feature-flags-accessed/package.json +15 -0
- package/generate-id/package.json +15 -0
- package/global-error-handler/package.json +15 -0
- package/hidden-timing/package.json +15 -0
- package/initial-page-load-extra-timing/package.json +15 -0
- package/interaction-context/package.json +15 -0
- package/interaction-id-context/package.json +15 -0
- package/interaction-metrics-init/package.json +15 -0
- package/label/package.json +15 -0
- package/load-hold/package.json +15 -0
- package/package.json +55 -3
- package/placeholder/package.json +15 -0
- package/resource-timing/package.json +15 -0
- package/round-number/package.json +15 -0
- package/route-name/package.json +15 -0
- package/route-name-context/package.json +15 -0
- package/segment/package.json +15 -0
- package/set-interaction-error/package.json +15 -0
- package/short-id/package.json +15 -0
- package/ssr/package.json +15 -0
- package/ssr-scripts/package.json +15 -0
- package/trace-interaction/package.json +15 -0
- package/trace-pageload/package.json +15 -0
- package/trace-press/package.json +15 -0
- package/trace-redirect/package.json +15 -0
- package/trace-transition/package.json +15 -0
- package/typing-performance-tracing/package.json +15 -0
- package/use-press-tracing/package.json +15 -0
- package/vc/media/package.json +15 -0
- package/vc/package.json +15 -0
- package/dist/types/common/types.d.ts +0 -17
- package/dist/types-ts4.5/common/types.d.ts +0 -17
- /package/dist/cjs/{common → additional-payload/utils/lighthouse-metrics/cls}/types.js +0 -0
- /package/dist/es2019/{common → additional-payload/utils/lighthouse-metrics/cls}/types.js +0 -0
- /package/dist/{esm/common/types.js → es2019/common/index.js} +0 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { isContainedWithinMediaWrapper } from '../media-wrapper/vc-utils';
|
|
3
|
+
import { SSRPlaceholderHandlers } from './ssr-placeholders';
|
|
4
|
+
const state = {
|
|
5
|
+
normal: 1,
|
|
6
|
+
waitingForFirstRender: 2,
|
|
7
|
+
ignoring: 3
|
|
8
|
+
};
|
|
9
|
+
export class Observers {
|
|
10
|
+
constructor(opts) {
|
|
11
|
+
_defineProperty(this, "observedMutations", new WeakMap());
|
|
12
|
+
_defineProperty(this, "elementsInView", new Set());
|
|
13
|
+
_defineProperty(this, "callbacks", new Set());
|
|
14
|
+
_defineProperty(this, "totalTime", 0);
|
|
15
|
+
_defineProperty(this, "_startMeasureTimestamp", -1);
|
|
16
|
+
_defineProperty(this, "ssr", {
|
|
17
|
+
state: state.normal,
|
|
18
|
+
reactRootElement: null,
|
|
19
|
+
renderStart: -1,
|
|
20
|
+
renderStop: -1
|
|
21
|
+
});
|
|
22
|
+
_defineProperty(this, "selectorConfig", {
|
|
23
|
+
id: false,
|
|
24
|
+
testId: false,
|
|
25
|
+
role: false,
|
|
26
|
+
className: true,
|
|
27
|
+
dataVC: true
|
|
28
|
+
});
|
|
29
|
+
_defineProperty(this, "subscribeResults", cb => {
|
|
30
|
+
this.callbacks.add(cb);
|
|
31
|
+
});
|
|
32
|
+
_defineProperty(this, "observeElement", (node, mutation, _type, ignoreReason) => {
|
|
33
|
+
var _this$intersectionObs;
|
|
34
|
+
(_this$intersectionObs = this.intersectionObserver) === null || _this$intersectionObs === void 0 ? void 0 : _this$intersectionObs.observe(node);
|
|
35
|
+
this.observedMutations.set(node, {
|
|
36
|
+
mutation,
|
|
37
|
+
ignoreReason
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
this.selectorConfig = {
|
|
41
|
+
...this.selectorConfig,
|
|
42
|
+
...opts.selectorConfig
|
|
43
|
+
};
|
|
44
|
+
this.intersectionObserver = this.getIntersectionObserver();
|
|
45
|
+
this.mutationObserver = this.getMutationObserver();
|
|
46
|
+
this.ssrPlaceholderHandler = new SSRPlaceholderHandlers();
|
|
47
|
+
}
|
|
48
|
+
isBrowserSupported() {
|
|
49
|
+
return typeof window.IntersectionObserver === 'function' && typeof window.MutationObserver === 'function';
|
|
50
|
+
}
|
|
51
|
+
observe() {
|
|
52
|
+
var _this$mutationObserve;
|
|
53
|
+
this.totalTime = 0;
|
|
54
|
+
this.ssr = {
|
|
55
|
+
state: state.normal,
|
|
56
|
+
reactRootElement: null,
|
|
57
|
+
renderStart: -1,
|
|
58
|
+
renderStop: -1
|
|
59
|
+
};
|
|
60
|
+
(_this$mutationObserve = this.mutationObserver) === null || _this$mutationObserve === void 0 ? void 0 : _this$mutationObserve.observe(document.body, {
|
|
61
|
+
attributeFilter: ['hidden', 'style', 'src'],
|
|
62
|
+
attributeOldValue: true,
|
|
63
|
+
attributes: true,
|
|
64
|
+
childList: true,
|
|
65
|
+
subtree: true
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
disconnect() {
|
|
69
|
+
var _this$mutationObserve2, _this$intersectionObs2;
|
|
70
|
+
(_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 ? void 0 : _this$mutationObserve2.disconnect();
|
|
71
|
+
(_this$intersectionObs2 = this.intersectionObserver) === null || _this$intersectionObs2 === void 0 ? void 0 : _this$intersectionObs2.disconnect();
|
|
72
|
+
this.observedMutations = new WeakMap();
|
|
73
|
+
this.elementsInView = new Set();
|
|
74
|
+
this.callbacks = new Set();
|
|
75
|
+
this.ssr.reactRootElement = null;
|
|
76
|
+
this.ssrPlaceholderHandler.clear();
|
|
77
|
+
}
|
|
78
|
+
getTotalTime() {
|
|
79
|
+
return this.totalTime;
|
|
80
|
+
}
|
|
81
|
+
setReactRootElement(element) {
|
|
82
|
+
this.ssr.reactRootElement = element;
|
|
83
|
+
}
|
|
84
|
+
setReactRootRenderStart(startTime = performance.now()) {
|
|
85
|
+
this.ssr.renderStart = startTime;
|
|
86
|
+
this.ssr.state = state.waitingForFirstRender;
|
|
87
|
+
}
|
|
88
|
+
setReactRootRenderStop(stopTime = performance.now()) {
|
|
89
|
+
this.ssr.renderStop = stopTime;
|
|
90
|
+
}
|
|
91
|
+
getMutationObserver() {
|
|
92
|
+
return this.isBrowserSupported() ? new MutationObserver(mutations => {
|
|
93
|
+
this.measureStart();
|
|
94
|
+
mutations.forEach(mutation => {
|
|
95
|
+
// patching element if timestamp not automatically added
|
|
96
|
+
// eslint-disable-next-line no-param-reassign
|
|
97
|
+
mutation.timestamp = mutation.timestamp === undefined ? performance.now() : mutation.timestamp;
|
|
98
|
+
let ignoreReason = '';
|
|
99
|
+
if (this.ssr.state === state.waitingForFirstRender && mutation.timestamp > this.ssr.renderStart && mutation.target === this.ssr.reactRootElement) {
|
|
100
|
+
this.ssr.state = state.ignoring;
|
|
101
|
+
if (this.ssr.renderStop === -1) {
|
|
102
|
+
// arbitrary 500ms DOM update window
|
|
103
|
+
this.ssr.renderStop = mutation.timestamp + 500;
|
|
104
|
+
}
|
|
105
|
+
ignoreReason = 'ssr-hydration';
|
|
106
|
+
}
|
|
107
|
+
if (this.ssr.state === state.ignoring && mutation.timestamp > this.ssr.renderStart && mutation.target === this.ssr.reactRootElement) {
|
|
108
|
+
if (mutation.timestamp <= this.ssr.renderStop) {
|
|
109
|
+
ignoreReason = 'ssr-hydration';
|
|
110
|
+
} else {
|
|
111
|
+
this.ssr.state = state.normal;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (mutation.type === 'childList') {
|
|
115
|
+
mutation.addedNodes.forEach(node => {
|
|
116
|
+
if (isContainedWithinMediaWrapper(node)) {
|
|
117
|
+
ignoreReason = 'image';
|
|
118
|
+
}
|
|
119
|
+
if (node instanceof HTMLElement
|
|
120
|
+
/* && !node instanceof HTMLStyleElement && !node instanceof HTMLScriptElement && !node instanceof HTMLLinkElement */) {
|
|
121
|
+
if (this.ssrPlaceholderHandler.isPlaceholder(node) || this.ssrPlaceholderHandler.isPlaceholderIgnored(node)) {
|
|
122
|
+
this.ssrPlaceholderHandler.checkIfExistedAndSizeMatching(node).then(result => {
|
|
123
|
+
if (result === false) {
|
|
124
|
+
this.observeElement(node, mutation, 'html', ignoreReason);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (this.ssrPlaceholderHandler.isPlaceholderReplacement(node) || this.ssrPlaceholderHandler.isPlaceholderIgnored(node)) {
|
|
130
|
+
this.ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(node).then(result => {
|
|
131
|
+
if (result === false) {
|
|
132
|
+
this.observeElement(node, mutation, 'html', ignoreReason);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
this.observeElement(node, mutation, 'html', ignoreReason);
|
|
138
|
+
}
|
|
139
|
+
if (node instanceof Text && node.parentElement != null) {
|
|
140
|
+
this.observeElement(node.parentElement, mutation, 'text', ignoreReason);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
mutation.removedNodes.forEach(node => {
|
|
144
|
+
if (node instanceof Element) {
|
|
145
|
+
var _this$intersectionObs3;
|
|
146
|
+
this.elementsInView.delete(node);
|
|
147
|
+
(_this$intersectionObs3 = this.intersectionObserver) === null || _this$intersectionObs3 === void 0 ? void 0 : _this$intersectionObs3.unobserve(node);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
} else if (mutation.type === 'attributes') {
|
|
151
|
+
mutation.addedNodes.forEach(node => {
|
|
152
|
+
if (node instanceof HTMLElement) {
|
|
153
|
+
this.observeElement(node, mutation, 'attr', ignoreReason);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
this.measureStop();
|
|
159
|
+
}) : null;
|
|
160
|
+
}
|
|
161
|
+
getElementName(element) {
|
|
162
|
+
try {
|
|
163
|
+
const tagName = element.localName;
|
|
164
|
+
const dataVCAttr = element.getAttribute('data-vc');
|
|
165
|
+
const dataVC = this.selectorConfig.dataVC && dataVCAttr ? `[data-vc="${dataVCAttr}"]` : '';
|
|
166
|
+
const id = this.selectorConfig.id && element.id ? `#${element.id}` : '';
|
|
167
|
+
let testId = this.selectorConfig.testId ? element.getAttribute('data-testid') || element.getAttribute('data-test-id') : '';
|
|
168
|
+
testId = testId ? `[testid=${testId}]` : '';
|
|
169
|
+
let role = this.selectorConfig.role ? element.getAttribute('role') : '';
|
|
170
|
+
role = role ? `[role=${role}]` : '';
|
|
171
|
+
let classList = this.selectorConfig.className ? Array.from(element.classList).join('.') : '';
|
|
172
|
+
classList = classList === '' ? '' : `.${classList}`;
|
|
173
|
+
const attrs = dataVC ? dataVC : [id, testId, role].join('');
|
|
174
|
+
let idString = '';
|
|
175
|
+
if (attrs === '' && classList === '') {
|
|
176
|
+
const parent = element.parentElement ? this.getElementName(element.parentElement) : 'unknown';
|
|
177
|
+
idString = `${parent} > ${tagName}`;
|
|
178
|
+
} else {
|
|
179
|
+
idString = [tagName, attrs || classList].join('');
|
|
180
|
+
}
|
|
181
|
+
return idString;
|
|
182
|
+
} catch (e) {
|
|
183
|
+
return 'error';
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
getIntersectionObserver() {
|
|
187
|
+
return this.isBrowserSupported() ? new IntersectionObserver(entries => {
|
|
188
|
+
this.measureStart();
|
|
189
|
+
entries.forEach(({
|
|
190
|
+
isIntersecting,
|
|
191
|
+
intersectionRect: ir,
|
|
192
|
+
target
|
|
193
|
+
}) => {
|
|
194
|
+
const data = this.observedMutations.get(target);
|
|
195
|
+
this.observedMutations.delete(target);
|
|
196
|
+
if (isIntersecting && ir.width > 0 && ir.height > 0) {
|
|
197
|
+
if (!(target instanceof HTMLElement)) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (!(data !== null && data !== void 0 && data.mutation)) {
|
|
201
|
+
// ignore intersection report without recent mutation
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.callbacks.forEach(callback => {
|
|
205
|
+
let elementName;
|
|
206
|
+
try {
|
|
207
|
+
elementName = this.getElementName(target);
|
|
208
|
+
} catch (e) {
|
|
209
|
+
elementName = 'error';
|
|
210
|
+
}
|
|
211
|
+
callback(data.mutation.timestamp || performance.now(), ir, elementName, target, data.ignoreReason);
|
|
212
|
+
});
|
|
213
|
+
this.elementsInView.add(target);
|
|
214
|
+
} else {
|
|
215
|
+
this.elementsInView.delete(target);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
this.measureStop();
|
|
219
|
+
}) : null;
|
|
220
|
+
}
|
|
221
|
+
measureStart() {
|
|
222
|
+
this._startMeasureTimestamp = performance.now();
|
|
223
|
+
}
|
|
224
|
+
measureStop() {
|
|
225
|
+
if (this._startMeasureTimestamp === -1) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this.totalTime += performance.now() - this._startMeasureTimestamp;
|
|
229
|
+
this._startMeasureTimestamp = -1;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
const EQUALITY_THRESHOLD = 0.1;
|
|
4
|
+
const ANCESTOR_LOOKUP_LIMIT = 10;
|
|
5
|
+
export class SSRPlaceholderHandlers {
|
|
6
|
+
constructor() {
|
|
7
|
+
_defineProperty(this, "staticPlaceholders", new Map());
|
|
8
|
+
_defineProperty(this, "callbacks", new Map());
|
|
9
|
+
_defineProperty(this, "getSizeCallbacks", new Map());
|
|
10
|
+
_defineProperty(this, "reactValidateCallbacks", new Map());
|
|
11
|
+
_defineProperty(this, "intersectionObserverCallback", ({
|
|
12
|
+
target,
|
|
13
|
+
boundingClientRect
|
|
14
|
+
}) => {
|
|
15
|
+
this.intersectionObserver.unobserve(target);
|
|
16
|
+
if (!(target instanceof HTMLElement)) {
|
|
17
|
+
// impossible case - keep typescript healthy
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const staticKey = target.dataset.ssrPlaceholder || '';
|
|
21
|
+
if (staticKey) {
|
|
22
|
+
if (this.staticPlaceholders.has(staticKey) && this.callbacks.has(staticKey)) {
|
|
23
|
+
// validation
|
|
24
|
+
const resolve = this.callbacks.get(staticKey);
|
|
25
|
+
if (!resolve) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const rect = this.staticPlaceholders.get(staticKey);
|
|
29
|
+
const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
|
|
30
|
+
resolve(hasSameSizePosition);
|
|
31
|
+
this.callbacks.delete(staticKey);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
// react component check
|
|
35
|
+
const key = target.dataset.ssrPlaceholderReplace || '';
|
|
36
|
+
const resolve = this.reactValidateCallbacks.get(key);
|
|
37
|
+
if (!resolve) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const rect = this.staticPlaceholders.get(key);
|
|
41
|
+
const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
|
|
42
|
+
resolve(hasSameSizePosition);
|
|
43
|
+
this.staticPlaceholders.delete(staticKey);
|
|
44
|
+
this.reactValidateCallbacks.delete(staticKey);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
this.intersectionObserver = new IntersectionObserver(entries => fg('no_ssr_placeholder_check_when_not_intersecting') ? entries.filter(entry => entry.intersectionRatio > 0).forEach(this.intersectionObserverCallback) : entries.forEach(this.intersectionObserverCallback));
|
|
48
|
+
if (window.document) {
|
|
49
|
+
try {
|
|
50
|
+
const existingElements = document.querySelectorAll('[data-ssr-placeholder]');
|
|
51
|
+
existingElements.forEach(el => {
|
|
52
|
+
var _el$dataset;
|
|
53
|
+
if (el instanceof HTMLElement && el !== null && el !== void 0 && (_el$dataset = el.dataset) !== null && _el$dataset !== void 0 && _el$dataset.ssrPlaceholder) {
|
|
54
|
+
var _window$__SSR_PLACEHO;
|
|
55
|
+
let width = -1;
|
|
56
|
+
let height = -1;
|
|
57
|
+
let x = -1;
|
|
58
|
+
let y = -1;
|
|
59
|
+
const boundingClientRect = (_window$__SSR_PLACEHO = window.__SSR_PLACEHOLDERS_DIMENSIONS__) === null || _window$__SSR_PLACEHO === void 0 ? void 0 : _window$__SSR_PLACEHO[el.dataset.ssrPlaceholder];
|
|
60
|
+
if (boundingClientRect) {
|
|
61
|
+
width = boundingClientRect.width;
|
|
62
|
+
height = boundingClientRect.height;
|
|
63
|
+
x = boundingClientRect.x;
|
|
64
|
+
y = boundingClientRect.y;
|
|
65
|
+
}
|
|
66
|
+
this.staticPlaceholders.set(el.dataset.ssrPlaceholder, {
|
|
67
|
+
width,
|
|
68
|
+
height,
|
|
69
|
+
x,
|
|
70
|
+
y
|
|
71
|
+
});
|
|
72
|
+
this.intersectionObserver.observe(el);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
} catch (e) {} finally {
|
|
76
|
+
delete window.__SSR_PLACEHOLDERS_DIMENSIONS__;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
clear() {
|
|
81
|
+
this.staticPlaceholders = new Map();
|
|
82
|
+
this.callbacks = new Map();
|
|
83
|
+
this.getSizeCallbacks = new Map();
|
|
84
|
+
this.reactValidateCallbacks = new Map();
|
|
85
|
+
}
|
|
86
|
+
isPlaceholder(element) {
|
|
87
|
+
return Boolean(element.dataset.ssrPlaceholder);
|
|
88
|
+
}
|
|
89
|
+
isPlaceholderReplacement(element) {
|
|
90
|
+
return Boolean(element.dataset.ssrPlaceholderReplace);
|
|
91
|
+
}
|
|
92
|
+
isPlaceholderIgnored(element) {
|
|
93
|
+
// data-ssr-placeholder-ignored doesn't have a value.
|
|
94
|
+
return 'ssrPlaceholderIgnored' in element.dataset;
|
|
95
|
+
}
|
|
96
|
+
findNearestPlaceholderContainerIfIgnored(element) {
|
|
97
|
+
if (!this.isPlaceholderIgnored(element)) {
|
|
98
|
+
return element;
|
|
99
|
+
}
|
|
100
|
+
let ancestor = element.parentElement;
|
|
101
|
+
let i = 0;
|
|
102
|
+
while (ancestor && i < ANCESTOR_LOOKUP_LIMIT) {
|
|
103
|
+
if (this.isPlaceholder(ancestor) || this.isPlaceholderReplacement(ancestor)) {
|
|
104
|
+
return ancestor;
|
|
105
|
+
}
|
|
106
|
+
ancestor = ancestor.parentElement;
|
|
107
|
+
i++;
|
|
108
|
+
}
|
|
109
|
+
return element;
|
|
110
|
+
}
|
|
111
|
+
checkIfExistedAndSizeMatching(el) {
|
|
112
|
+
el = this.findNearestPlaceholderContainerIfIgnored(el);
|
|
113
|
+
const id = el.dataset.ssrPlaceholder || '';
|
|
114
|
+
return new Promise(resolve => {
|
|
115
|
+
if (!this.staticPlaceholders.has(id)) {
|
|
116
|
+
resolve(false);
|
|
117
|
+
return;
|
|
118
|
+
} else {
|
|
119
|
+
this.callbacks.set(id, resolve);
|
|
120
|
+
this.intersectionObserver.observe(el);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
getSize(el) {
|
|
125
|
+
return new Promise(resolve => {
|
|
126
|
+
this.getSizeCallbacks.set(el.dataset.ssrPlaceholder || '', resolve);
|
|
127
|
+
this.intersectionObserver.observe(el);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
validateReactComponentMatchToPlaceholder(el) {
|
|
131
|
+
el = this.findNearestPlaceholderContainerIfIgnored(el);
|
|
132
|
+
const id = el.dataset.ssrPlaceholderReplace || '';
|
|
133
|
+
return new Promise(resolve => {
|
|
134
|
+
if (!this.staticPlaceholders.has(id)) {
|
|
135
|
+
resolve(false);
|
|
136
|
+
return;
|
|
137
|
+
} else {
|
|
138
|
+
this.reactValidateCallbacks.set(id, resolve);
|
|
139
|
+
this.intersectionObserver.observe(el);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
hasSameSizePosition(rect, boundingClientRect) {
|
|
144
|
+
return rect && Math.abs(rect.x - boundingClientRect.x) < EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < EQUALITY_THRESHOLD || false;
|
|
145
|
+
}
|
|
146
|
+
}
|
package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { attachAbortListeners } from '../../../attachAbortListeners';
|
|
2
|
+
import { getViewportHeight, getViewportWidth } from '../../../getViewport';
|
|
3
|
+
export function bindAbortListeners(document, window) {
|
|
4
|
+
const viewport = {
|
|
5
|
+
w: getViewportWidth(document),
|
|
6
|
+
h: getViewportHeight(document)
|
|
7
|
+
};
|
|
8
|
+
const aborts = {};
|
|
9
|
+
const unbinds = attachAbortListeners(window, viewport, (key, time) => {
|
|
10
|
+
aborts[key] = time;
|
|
11
|
+
});
|
|
12
|
+
window.__SSR_ABORT_LISTENERS__ = {
|
|
13
|
+
unbinds,
|
|
14
|
+
aborts
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// lightweight script to scan the SSR response and collect all elements with data-ssr-placeholder attribute
|
|
2
|
+
// and save their size/positions in a map __SSR_PLACEHOLDERS_DIMENSIONS__ on the Window object. Each placeholderId is
|
|
3
|
+
// unique and maps to its corresponding elements bounding client rectangle dimensions.
|
|
4
|
+
export function collectSSRPlaceholderDimensions(document, window) {
|
|
5
|
+
const ssrPlaceholders = document === null || document === void 0 ? void 0 : document.querySelectorAll('[data-ssr-placeholder]');
|
|
6
|
+
ssrPlaceholders.forEach(elem => {
|
|
7
|
+
const placeholderId = elem.getAttribute('data-ssr-placeholder');
|
|
8
|
+
const boundingClient = elem.getBoundingClientRect();
|
|
9
|
+
if (placeholderId) {
|
|
10
|
+
window.__SSR_PLACEHOLDERS_DIMENSIONS__ = window.__SSR_PLACEHOLDERS_DIMENSIONS__ || {};
|
|
11
|
+
window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = boundingClient;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* Borrowed from https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/performance/browser-metrics/src/plugins/timings/resource.ts */
|
|
2
|
+
var cacheableTypes = ['script', 'link'];
|
|
3
|
+
var CACHE_NETWORK = 'network';
|
|
4
|
+
var CACHE_MEMORY = 'memory';
|
|
5
|
+
var CACHE_DISK = 'disk';
|
|
6
|
+
var calculateTransferType = function calculateTransferType(type, duration, size) {
|
|
7
|
+
if (!cacheableTypes.includes(type)) {
|
|
8
|
+
return CACHE_NETWORK;
|
|
9
|
+
}
|
|
10
|
+
if ((size === undefined || size === 0) && duration === 0) {
|
|
11
|
+
return CACHE_MEMORY;
|
|
12
|
+
}
|
|
13
|
+
if (size === 0 && duration > 0) {
|
|
14
|
+
return CACHE_DISK;
|
|
15
|
+
}
|
|
16
|
+
if (size === undefined) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return CACHE_NETWORK;
|
|
20
|
+
};
|
|
21
|
+
export var getCacheHitRatio = function getCacheHitRatio(_ref) {
|
|
22
|
+
var start = _ref.start;
|
|
23
|
+
var fromCache = 0;
|
|
24
|
+
var preloadFromCache = 0;
|
|
25
|
+
var total = 0;
|
|
26
|
+
var totalPreload = 0;
|
|
27
|
+
|
|
28
|
+
// initial load only
|
|
29
|
+
if (start !== 0) {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
for (var _i = 0, _arr = performance.getEntriesByType('resource'); _i < _arr.length; _i++) {
|
|
34
|
+
var entry = _arr[_i];
|
|
35
|
+
// The BM3 resource timing collector checks for whether the timing information is available,
|
|
36
|
+
// but we can make the assumption that it is for this Jira specific collector.
|
|
37
|
+
var transferType = calculateTransferType(entry.initiatorType, entry.duration, entry.transferSize);
|
|
38
|
+
var isPreload = entry.initiatorType === 'link';
|
|
39
|
+
if (transferType === 'disk' || transferType === 'memory') {
|
|
40
|
+
fromCache += 1;
|
|
41
|
+
if (isPreload) {
|
|
42
|
+
preloadFromCache += 1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (transferType !== null) {
|
|
46
|
+
total += 1;
|
|
47
|
+
if (isPreload) {
|
|
48
|
+
totalPreload += 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var result = {};
|
|
53
|
+
if (total > 0) {
|
|
54
|
+
result.cacheHitRatio = fromCache / total;
|
|
55
|
+
}
|
|
56
|
+
if (totalPreload > 0) {
|
|
57
|
+
result.preloadCacheHitRatio = preloadFromCache / totalPreload;
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
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
|
+
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
|
+
export var getCLS = function getCLS(start, stop, buffer) {
|
|
5
|
+
var layoutShifts = buffer.getAll().filter(function (entry) {
|
|
6
|
+
return entry.startTime >= start && entry.startTime <= stop;
|
|
7
|
+
});
|
|
8
|
+
var sessionWindows = [];
|
|
9
|
+
var currentWindow = null;
|
|
10
|
+
|
|
11
|
+
// Group layout shifts into session windows
|
|
12
|
+
var _iterator = _createForOfIteratorHelper(layoutShifts),
|
|
13
|
+
_step;
|
|
14
|
+
try {
|
|
15
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
16
|
+
var shift = _step.value;
|
|
17
|
+
var startTime = shift.startTime;
|
|
18
|
+
var endTime = shift.startTime + shift.duration;
|
|
19
|
+
var score = shift.value;
|
|
20
|
+
if (currentWindow === null || startTime - currentWindow.endTime > 1000 || endTime - currentWindow.startTime > 5000) {
|
|
21
|
+
// Start a new session window
|
|
22
|
+
currentWindow = {
|
|
23
|
+
startTime: startTime,
|
|
24
|
+
endTime: endTime,
|
|
25
|
+
score: score
|
|
26
|
+
};
|
|
27
|
+
sessionWindows.push(currentWindow);
|
|
28
|
+
} else {
|
|
29
|
+
// Add layout shift to current session window
|
|
30
|
+
currentWindow.endTime = endTime;
|
|
31
|
+
currentWindow.score += score;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Find session window with highest cumulative score
|
|
36
|
+
} catch (err) {
|
|
37
|
+
_iterator.e(err);
|
|
38
|
+
} finally {
|
|
39
|
+
_iterator.f();
|
|
40
|
+
}
|
|
41
|
+
var maxScore = sessionWindows.reduce(function (max, sessionWindow) {
|
|
42
|
+
return sessionWindow.score > max ? sessionWindow.score : max;
|
|
43
|
+
}, 0);
|
|
44
|
+
|
|
45
|
+
// Return score of largest burst as CLS metric
|
|
46
|
+
return Math.round(maxScore * 10000) / 10000;
|
|
47
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getCLS } from './cls';
|
|
2
|
+
import { PerformanceObserverEntryTypes } from './const';
|
|
3
|
+
import { getTBT } from './tbt';
|
|
4
|
+
import { EntriesBuffer } from './utils/buffer';
|
|
5
|
+
import { startLSObserver, startLTObserver } from './utils/observer';
|
|
6
|
+
export function startLighthouseObserver() {
|
|
7
|
+
startLSObserver();
|
|
8
|
+
startLTObserver();
|
|
9
|
+
}
|
|
10
|
+
export var getLighthouseMetrics = function getLighthouseMetrics(_ref) {
|
|
11
|
+
var start = _ref.start,
|
|
12
|
+
stop = _ref.stop;
|
|
13
|
+
var tbt = getTBT(start, stop, EntriesBuffer[PerformanceObserverEntryTypes.LongTask]);
|
|
14
|
+
|
|
15
|
+
// no round as CLS is usually 0-1
|
|
16
|
+
var cls = getCLS(start, stop, EntriesBuffer[PerformanceObserverEntryTypes.LayoutShift]);
|
|
17
|
+
return {
|
|
18
|
+
'metric:tbt': Math.round(tbt.total),
|
|
19
|
+
'metric:tbt:observed': Math.round(tbt.observed),
|
|
20
|
+
'metric:cls': cls
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var MAX_ACCEPTABLE_TASK_DURATION = 50;
|
|
2
|
+
export var getTBT = function getTBT(start, stop, buffer) {
|
|
3
|
+
return buffer.getAll().filter(function (entry) {
|
|
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);
|
|
5
|
+
}).reduce(function (tbt, entry) {
|
|
6
|
+
var longTaskStop = entry.startTime + entry.duration;
|
|
7
|
+
var intersectStart = Math.max(entry.startTime + MAX_ACCEPTABLE_TASK_DURATION, start);
|
|
8
|
+
var intersectStop = Math.min(longTaskStop, stop);
|
|
9
|
+
var longTaskIncluded = Math.max(intersectStop - intersectStart, 0);
|
|
10
|
+
// eslint-disable-next-line no-param-reassign
|
|
11
|
+
tbt.observed += entry.duration - MAX_ACCEPTABLE_TASK_DURATION;
|
|
12
|
+
// eslint-disable-next-line no-param-reassign
|
|
13
|
+
tbt.total += longTaskIncluded;
|
|
14
|
+
return tbt;
|
|
15
|
+
}, {
|
|
16
|
+
total: 0,
|
|
17
|
+
observed: 0
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _EntriesBuffer;
|
|
5
|
+
import { PerformanceObserverEntryTypes } from '../../const';
|
|
6
|
+
export var BufferWithMaxLength = /*#__PURE__*/function () {
|
|
7
|
+
function BufferWithMaxLength() {
|
|
8
|
+
var maxLength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;
|
|
9
|
+
_classCallCheck(this, BufferWithMaxLength);
|
|
10
|
+
_defineProperty(this, "buffer", []);
|
|
11
|
+
_defineProperty(this, "full", false);
|
|
12
|
+
this.maxLength = maxLength;
|
|
13
|
+
}
|
|
14
|
+
_createClass(BufferWithMaxLength, [{
|
|
15
|
+
key: "push",
|
|
16
|
+
value: function push(item) {
|
|
17
|
+
if (this.full || this.maxLength === this.buffer.length) {
|
|
18
|
+
this.full = true;
|
|
19
|
+
this.buffer.shift();
|
|
20
|
+
}
|
|
21
|
+
this.buffer.push(item);
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
24
|
+
key: "getAll",
|
|
25
|
+
value: function getAll() {
|
|
26
|
+
return this.buffer;
|
|
27
|
+
}
|
|
28
|
+
}]);
|
|
29
|
+
return BufferWithMaxLength;
|
|
30
|
+
}();
|
|
31
|
+
export var EntriesBuffer = (_EntriesBuffer = {}, _defineProperty(_EntriesBuffer, PerformanceObserverEntryTypes.LongTask, new BufferWithMaxLength()), _defineProperty(_EntriesBuffer, PerformanceObserverEntryTypes.LayoutShift, new BufferWithMaxLength()), _EntriesBuffer);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PerformanceObserverEntryTypes } from '../../const';
|
|
2
|
+
import { EntriesBuffer } from '../buffer';
|
|
3
|
+
var pe = null;
|
|
4
|
+
var getObserver = function getObserver() {
|
|
5
|
+
if (pe !== null) {
|
|
6
|
+
return pe;
|
|
7
|
+
}
|
|
8
|
+
pe = new PerformanceObserver(function (list) {
|
|
9
|
+
list.getEntries().forEach(function (entry) {
|
|
10
|
+
if (entry.entryType === PerformanceObserverEntryTypes.LayoutShift) {
|
|
11
|
+
EntriesBuffer[PerformanceObserverEntryTypes.LayoutShift].push(entry);
|
|
12
|
+
}
|
|
13
|
+
if (entry.entryType === PerformanceObserverEntryTypes.LongTask) {
|
|
14
|
+
EntriesBuffer[PerformanceObserverEntryTypes.LongTask].push(entry);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
return pe;
|
|
19
|
+
};
|
|
20
|
+
export var startLSObserver = function startLSObserver() {
|
|
21
|
+
getObserver().observe({
|
|
22
|
+
type: PerformanceObserverEntryTypes.LayoutShift,
|
|
23
|
+
buffered: true
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export var startLTObserver = function startLTObserver() {
|
|
27
|
+
getObserver().observe({
|
|
28
|
+
type: PerformanceObserverEntryTypes.LongTask,
|
|
29
|
+
buffered: true
|
|
30
|
+
});
|
|
31
|
+
};
|