@vinena/knobs 0.0.0-stage → 0.5.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 +228 -0
- package/LICENSE +21 -0
- package/README.md +110 -2
- package/THIRD_PARTY_NOTICES.md +429 -0
- package/dist/bezels/duo-fold/fold-000.webp +0 -0
- package/dist/bezels/duo-fold/fold-001.webp +0 -0
- package/dist/bezels/duo-fold/fold-002.webp +0 -0
- package/dist/bezels/duo-fold/fold-003.webp +0 -0
- package/dist/bezels/duo-fold/fold-004.webp +0 -0
- package/dist/bezels/duo-fold/fold-005.webp +0 -0
- package/dist/bezels/duo-fold/fold-006.webp +0 -0
- package/dist/bezels/duo-fold/fold-007.webp +0 -0
- package/dist/bezels/duo-fold/fold-008.webp +0 -0
- package/dist/bezels/duo-fold/fold-009.webp +0 -0
- package/dist/bezels/duo-fold/fold-010.webp +0 -0
- package/dist/bezels/duo-fold/fold-011.webp +0 -0
- package/dist/bezels/duo-fold/fold-012.webp +0 -0
- package/dist/bezels/duo-fold/fold-013.webp +0 -0
- package/dist/bezels/duo-fold/fold-014.webp +0 -0
- package/dist/bezels/duo-fold/fold-015.webp +0 -0
- package/dist/bezels/duo-fold/fold-016.webp +0 -0
- package/dist/bezels/duo-fold/fold-017.webp +0 -0
- package/dist/bezels/duo-fold/fold-018.webp +0 -0
- package/dist/bezels/duo-fold/fold-019.webp +0 -0
- package/dist/bezels/duo-fold/fold-020.webp +0 -0
- package/dist/bezels/duo-fold/fold-021.webp +0 -0
- package/dist/bezels/duo-fold/fold-022.webp +0 -0
- package/dist/bezels/duo-fold/fold-023.webp +0 -0
- package/dist/bezels/duo-fold/fold-024.webp +0 -0
- package/dist/bezels/duo-fold/fold-025.webp +0 -0
- package/dist/bezels/duo-fold/fold-026.webp +0 -0
- package/dist/bezels/duo-fold/fold-027.webp +0 -0
- package/dist/bezels/duo-fold/fold-028.webp +0 -0
- package/dist/bezels/duo-fold/fold-029.webp +0 -0
- package/dist/bezels/duo-fold/fold-030.webp +0 -0
- package/dist/bezels/duo-fold/fold-031.webp +0 -0
- package/dist/bezels/duo-fold/fold-032.webp +0 -0
- package/dist/bezels/duo-fold/fold-033.webp +0 -0
- package/dist/bezels/duo-fold/fold-034.webp +0 -0
- package/dist/bezels/duo-fold/fold-035.webp +0 -0
- package/dist/bezels/duo-fold/fold-036.webp +0 -0
- package/dist/bezels/duo-fold/fold-037.webp +0 -0
- package/dist/bezels/duo-fold/fold-038.webp +0 -0
- package/dist/bezels/duo-fold/fold-039.webp +0 -0
- package/dist/bezels/duo-fold/fold-040.webp +0 -0
- package/dist/bezels/duo-fold/fold-041.webp +0 -0
- package/dist/bezels/duo-fold/fold-042.webp +0 -0
- package/dist/bezels/duo-fold/fold-043.webp +0 -0
- package/dist/bezels/duo-fold/fold-044.webp +0 -0
- package/dist/bezels/duo-fold/fold-045.webp +0 -0
- package/dist/bezels/duo-fold/fold-046.webp +0 -0
- package/dist/bezels/duo-fold/fold-047.webp +0 -0
- package/dist/bezels/duo-fold/fold-048.webp +0 -0
- package/dist/bezels/duo-fold/fold-049.webp +0 -0
- package/dist/bezels/duo-fold/fold-050.webp +0 -0
- package/dist/bezels/duo-fold/fold-051.webp +0 -0
- package/dist/bezels/duo-fold/fold-052.webp +0 -0
- package/dist/bezels/duo-fold/fold-053.webp +0 -0
- package/dist/bezels/duo-fold/fold-054.webp +0 -0
- package/dist/bezels/duo-fold/fold-055.webp +0 -0
- package/dist/bezels/duo-fold/fold-056.webp +0 -0
- package/dist/bezels/duo-fold/fold-057.webp +0 -0
- package/dist/bezels/duo-fold/fold-058.webp +0 -0
- package/dist/bezels/duo-fold/fold-059.webp +0 -0
- package/dist/bezels/duo-fold/fold-060.webp +0 -0
- package/dist/bezels/duo-fold/fold-061.webp +0 -0
- package/dist/bezels/duo-fold/fold-062.webp +0 -0
- package/dist/bezels/duo-fold/fold-063.webp +0 -0
- package/dist/bezels/duo-fold/fold-064.webp +0 -0
- package/dist/bezels/duo-fold/fold-065.webp +0 -0
- package/dist/bezels/duo-fold/fold-066.webp +0 -0
- package/dist/bezels/duo-fold/fold-067.webp +0 -0
- package/dist/bezels/duo-fold/fold-068.webp +0 -0
- package/dist/bezels/duo-fold/fold-069.webp +0 -0
- package/dist/bezels/duo-fold/fold-070.webp +0 -0
- package/dist/bezels/duo-fold/fold-071.webp +0 -0
- package/dist/bezels/duo-fold/fold-072.webp +0 -0
- package/dist/bezels/duo-fold/fold-073.webp +0 -0
- package/dist/bezels/duo-fold/fold-074.webp +0 -0
- package/dist/bezels/duo-fold/fold-075.webp +0 -0
- package/dist/bezels/duo-fold/fold-076.webp +0 -0
- package/dist/bezels/duo-fold/fold-077.webp +0 -0
- package/dist/bezels/duo-fold/fold-078.webp +0 -0
- package/dist/bezels/duo-fold/fold-079.webp +0 -0
- package/dist/bezels/duo-fold/fold-080.webp +0 -0
- package/dist/bezels/duo-fold/fold-081.webp +0 -0
- package/dist/bezels/duo-fold/fold-082.webp +0 -0
- package/dist/bezels/duo-fold/fold-083.webp +0 -0
- package/dist/bezels/duo-fold/fold-084.webp +0 -0
- package/dist/bezels/duo-fold/fold-085.webp +0 -0
- package/dist/bezels/duo-fold/fold-086.webp +0 -0
- package/dist/bezels/duo-fold/fold-087.webp +0 -0
- package/dist/bezels/duo-fold/fold-088.webp +0 -0
- package/dist/bezels/duo-fold/fold-089.webp +0 -0
- package/dist/bezels/duo-fold/fold-090.webp +0 -0
- package/dist/bezels/duo-fold/fold-091.webp +0 -0
- package/dist/bezels/duo-fold/fold-092.webp +0 -0
- package/dist/bezels/duo-fold/fold-093.webp +0 -0
- package/dist/bezels/duo-fold/fold-094.webp +0 -0
- package/dist/bezels/duo-fold/fold-095.webp +0 -0
- package/dist/bezels/duo-fold/fold-096.webp +0 -0
- package/dist/bezels/duo-fold/fold-097.webp +0 -0
- package/dist/bezels/duo-fold/fold-098.webp +0 -0
- package/dist/bezels/duo-fold/fold-099.webp +0 -0
- package/dist/bezels/duo-fold/fold-100.webp +0 -0
- package/dist/bezels/duo-fold/fold-101.webp +0 -0
- package/dist/bezels/duo-fold/fold-102.webp +0 -0
- package/dist/bezels/duo-fold/fold-103.webp +0 -0
- package/dist/bezels/duo-fold/fold-104.webp +0 -0
- package/dist/bezels/duo-fold/fold-105.webp +0 -0
- package/dist/bezels/duo-fold/fold-106.webp +0 -0
- package/dist/bezels/duo-fold/fold-107.webp +0 -0
- package/dist/bezels/duo-fold/fold-108.webp +0 -0
- package/dist/bezels/duo-fold/fold-109.webp +0 -0
- package/dist/bezels/duo-fold/fold-110.webp +0 -0
- package/dist/bezels/duo-fold/fold-111.webp +0 -0
- package/dist/bezels/duo-fold/fold-112.webp +0 -0
- package/dist/bezels/duo-fold/fold-113.webp +0 -0
- package/dist/bezels/duo-fold/fold-114.webp +0 -0
- package/dist/bezels/duo-fold/fold-115.webp +0 -0
- package/dist/bezels/duo-fold/fold-116.webp +0 -0
- package/dist/bezels/duo-fold/fold-117.webp +0 -0
- package/dist/bezels/duo-fold/fold-118.webp +0 -0
- package/dist/bezels/duo-fold/fold-119.webp +0 -0
- package/dist/bezels/duo-fold/fold-120.webp +0 -0
- package/dist/bezels/duo-fold/fold-121.webp +0 -0
- package/dist/bezels/duo-fold/fold-122.webp +0 -0
- package/dist/bezels/duo-fold/fold-123.webp +0 -0
- package/dist/bezels/duo-fold/fold-124.webp +0 -0
- package/dist/bezels/duo-fold/fold-125.webp +0 -0
- package/dist/bezels/duo-fold/fold-126.webp +0 -0
- package/dist/bezels/duo-fold/fold-127.webp +0 -0
- package/dist/bezels/duo-fold/fold-128.webp +0 -0
- package/dist/bezels/duo-fold/fold-129.webp +0 -0
- package/dist/bezels/duo-fold/fold-130.webp +0 -0
- package/dist/bezels/duo-fold/fold-131.webp +0 -0
- package/dist/bezels/duo-fold/fold-132.webp +0 -0
- package/dist/bezels/duo-fold/fold-133.webp +0 -0
- package/dist/bezels/duo-fold/fold-134.webp +0 -0
- package/dist/bezels/duo-fold/fold-135.webp +0 -0
- package/dist/bezels/duo-fold/fold-136.webp +0 -0
- package/dist/bezels/duo-fold/fold-137.webp +0 -0
- package/dist/bezels/duo-fold/fold-138.webp +0 -0
- package/dist/bezels/duo-fold/fold-139.webp +0 -0
- package/dist/bezels/duo-fold/fold-140.webp +0 -0
- package/dist/bezels/duo-fold/fold-141.webp +0 -0
- package/dist/bezels/duo-fold/fold-142.webp +0 -0
- package/dist/bezels/duo-fold/fold-143.webp +0 -0
- package/dist/bezels/duo-fold/fold-144.webp +0 -0
- package/dist/bezels/duo-fold/fold-145.webp +0 -0
- package/dist/bezels/duo-fold/fold-146.webp +0 -0
- package/dist/bezels/duo-fold/fold-147.webp +0 -0
- package/dist/bezels/duo-fold/fold-148.webp +0 -0
- package/dist/bezels/duo-fold/fold-149.webp +0 -0
- package/dist/bezels/duo-fold/fold-150.webp +0 -0
- package/dist/bezels/duo-fold/fold-151.webp +0 -0
- package/dist/bezels/duo-fold/fold-152.webp +0 -0
- package/dist/bezels/duo-fold/fold-153.webp +0 -0
- package/dist/bezels/duo-fold/fold-154.webp +0 -0
- package/dist/bezels/duo-fold/fold-155.webp +0 -0
- package/dist/bezels/duo-fold/fold-156.webp +0 -0
- package/dist/bezels/duo-fold/fold-157.webp +0 -0
- package/dist/bezels/duo-fold/fold-158.webp +0 -0
- package/dist/bezels/duo-fold/fold-159.webp +0 -0
- package/dist/bezels/duo-fold/fold-160.webp +0 -0
- package/dist/bezels/duo-fold/fold-161.webp +0 -0
- package/dist/bezels/duo-fold/fold-162.webp +0 -0
- package/dist/bezels/duo-fold/fold-163.webp +0 -0
- package/dist/bezels/duo-fold/fold-164.webp +0 -0
- package/dist/bezels/duo-fold/fold-165.webp +0 -0
- package/dist/bezels/duo-fold/fold-166.webp +0 -0
- package/dist/bezels/duo-fold/fold-167.webp +0 -0
- package/dist/bezels/duo-fold/fold-168.webp +0 -0
- package/dist/bezels/duo-fold/fold-169.webp +0 -0
- package/dist/bezels/duo-fold/fold-170.webp +0 -0
- package/dist/bezels/duo-fold/fold-171.webp +0 -0
- package/dist/bezels/duo-fold/fold-172.webp +0 -0
- package/dist/bezels/duo-fold/fold-173.webp +0 -0
- package/dist/bezels/duo-fold/fold-174.webp +0 -0
- package/dist/bezels/duo-fold/fold-175.webp +0 -0
- package/dist/bezels/duo-fold/fold-176.webp +0 -0
- package/dist/bezels/duo-fold/fold-177.webp +0 -0
- package/dist/bezels/duo-fold/fold-178.webp +0 -0
- package/dist/bezels/duo-fold/fold-179.webp +0 -0
- package/dist/bezels/duo-fold/fold-180.webp +0 -0
- package/dist/bezels/duo-fold/still-000.webp +0 -0
- package/dist/bezels/duo-fold/still-161.webp +0 -0
- package/dist/bezels/duo-fold/still-162.webp +0 -0
- package/dist/bezels/duo-fold/still-163.webp +0 -0
- package/dist/bezels/duo-fold/still-164.webp +0 -0
- package/dist/bezels/duo-fold/still-165.webp +0 -0
- package/dist/bezels/duo-fold/still-166.webp +0 -0
- package/dist/bezels/duo-fold/still-167.webp +0 -0
- package/dist/bezels/duo-fold/still-168.webp +0 -0
- package/dist/bezels/duo-fold/still-169.webp +0 -0
- package/dist/bezels/duo-fold/still-170.webp +0 -0
- package/dist/bezels/duo-fold/still-171.webp +0 -0
- package/dist/bezels/duo-fold/still-172.webp +0 -0
- package/dist/bezels/duo-fold/still-173.webp +0 -0
- package/dist/bezels/duo-fold/still-174.webp +0 -0
- package/dist/bezels/duo-fold/still-175.webp +0 -0
- package/dist/bezels/duo-fold/still-176.webp +0 -0
- package/dist/bezels/duo-fold/still-177.webp +0 -0
- package/dist/bezels/duo-fold/still-178.webp +0 -0
- package/dist/bezels/duo-fold/still-179.webp +0 -0
- package/dist/bezels/duo-fold/still-180.webp +0 -0
- package/dist/bezels/iphone-16-plus.webp +0 -0
- package/dist/bezels/iphone-16-pro-max.webp +0 -0
- package/dist/bezels/iphone-16-pro.webp +0 -0
- package/dist/bezels/iphone-16.webp +0 -0
- package/dist/bezels/iphone-17-pro-max.webp +0 -0
- package/dist/bezels/iphone-17-pro.webp +0 -0
- package/dist/bezels/iphone-17.webp +0 -0
- package/dist/bezels/iphone-18-pro-max.webp +0 -0
- package/dist/bezels/iphone-18-pro.webp +0 -0
- package/dist/bezels/iphone-air.webp +0 -0
- package/dist/bezels/iphone-duo-inner-open-landscape.webp +0 -0
- package/dist/bezels/iphone-duo-inner-open-portrait.webp +0 -0
- package/dist/bezels/iphone-duo-outer-closed.webp +0 -0
- package/dist/bezels/iphone-se.webp +0 -0
- package/dist/bezels/pixel-10-pro-xl.webp +0 -0
- package/dist/bezels/pixel-10-pro.webp +0 -0
- package/dist/bezels/pixel-10.webp +0 -0
- package/dist/bezels/pixel-10a.webp +0 -0
- package/dist/bezels/pixel-9-pro-xl.webp +0 -0
- package/dist/bezels/pixel-9-pro.webp +0 -0
- package/dist/bezels/pixel-9.webp +0 -0
- package/dist/early.d.ts +1 -0
- package/dist/early.global.js +8 -0
- package/dist/elementsview-jnkbhzkj.js +2873 -0
- package/dist/elementsview-tf4qzmtw.js +2874 -0
- package/dist/engine/address.d.ts +31 -0
- package/dist/engine/animations.d.ts +13 -0
- package/dist/engine/barshot.d.ts +48 -0
- package/dist/engine/bezels.d.ts +140 -0
- package/dist/engine/bezelurls.d.ts +5 -0
- package/dist/engine/browserdraw.d.ts +57 -0
- package/dist/engine/browserkit.d.ts +59 -0
- package/dist/engine/browserui.d.ts +177 -0
- package/dist/engine/check.d.ts +8 -0
- package/dist/engine/chromedraw.d.ts +17 -0
- package/dist/engine/clock.d.ts +91 -0
- package/dist/engine/color.d.ts +37 -0
- package/dist/engine/describe.d.ts +49 -0
- package/dist/engine/devices.d.ts +96 -0
- package/dist/engine/dock.d.ts +53 -0
- package/dist/engine/endroom.d.ts +21 -0
- package/dist/engine/fit.d.ts +75 -0
- package/dist/engine/fold.d.ts +562 -0
- package/dist/engine/foldframes.d.ts +98 -0
- package/dist/engine/foldgl.d.ts +151 -0
- package/dist/engine/foldhand.d.ts +23 -0
- package/dist/engine/foldlook.d.ts +49 -0
- package/dist/engine/foldpage.d.ts +167 -0
- package/dist/engine/foldrun.d.ts +98 -0
- package/dist/engine/frame.d.ts +142 -0
- package/dist/engine/frameglide.d.ts +71 -0
- package/dist/engine/framekit.d.ts +7 -0
- package/dist/engine/frames.d.ts +42 -0
- package/dist/engine/fresh.d.ts +59 -0
- package/dist/engine/geo.d.ts +58 -0
- package/dist/engine/header.d.ts +16 -0
- package/dist/engine/identity.d.ts +27 -0
- package/dist/engine/index.d.ts +58 -0
- package/dist/engine/intl.d.ts +23 -0
- package/dist/engine/locale.d.ts +86 -0
- package/dist/engine/mat.d.ts +64 -0
- package/dist/engine/matchmedia.d.ts +25 -0
- package/dist/engine/matcolors.d.ts +45 -0
- package/dist/engine/matsplash.d.ts +81 -0
- package/dist/engine/media.d.ts +55 -0
- package/dist/engine/mock.d.ts +65 -0
- package/dist/engine/mockdata.d.ts +42 -0
- package/dist/engine/mockdraw.d.ts +21 -0
- package/dist/engine/morph.d.ts +214 -0
- package/dist/engine/morphrun.d.ts +49 -0
- package/dist/engine/native.d.ts +129 -0
- package/dist/engine/network.d.ts +8 -0
- package/dist/engine/notice.d.ts +15 -0
- package/dist/engine/objectfit.d.ts +35 -0
- package/dist/engine/outlines.d.ts +2 -0
- package/dist/engine/overflow.d.ts +11 -0
- package/dist/engine/owninline.d.ts +16 -0
- package/dist/engine/pagefonts.d.ts +21 -0
- package/dist/engine/pageshot.d.ts +127 -0
- package/dist/engine/placeholder.d.ts +89 -0
- package/dist/engine/pseudo.d.ts +15 -0
- package/dist/engine/ready.d.ts +9 -0
- package/dist/engine/reload.d.ts +35 -0
- package/dist/engine/remount.d.ts +30 -0
- package/dist/engine/replay.d.ts +7 -0
- package/dist/engine/safaridraw.d.ts +22 -0
- package/dist/engine/scrollbars.d.ts +17 -0
- package/dist/engine/scrollkeep.d.ts +124 -0
- package/dist/engine/spacing.d.ts +2 -0
- package/dist/engine/speed.d.ts +11 -0
- package/dist/engine/store.d.ts +68 -0
- package/dist/engine/stored.d.ts +17 -0
- package/dist/engine/style.d.ts +27 -0
- package/dist/engine/system.d.ts +15 -0
- package/dist/engine/text.d.ts +53 -0
- package/dist/engine/time.d.ts +32 -0
- package/dist/engine/touch.d.ts +20 -0
- package/dist/engine/touchdot.d.ts +71 -0
- package/dist/engine/touchmark.d.ts +27 -0
- package/dist/engine/touchpointer.d.ts +113 -0
- package/dist/engine/tree.d.ts +9 -0
- package/dist/engine/turnrun.d.ts +74 -0
- package/dist/engine/ua.d.ts +55 -0
- package/dist/engine/underneath.d.ts +7 -0
- package/dist/engine/viewportcss.d.ts +7 -0
- package/dist/engine/vision.d.ts +3 -0
- package/dist/engine/width.d.ts +56 -0
- package/dist/engine/zoom.d.ts +33 -0
- package/dist/framekit-3n7p79ht.js +8839 -0
- package/dist/framekit-g96t6nmq.js +8838 -0
- package/dist/global.d.ts +1 -0
- package/dist/grab/boxmodel.d.ts +109 -0
- package/dist/grab/boxtext.d.ts +17 -0
- package/dist/grab/card.d.ts +45 -0
- package/dist/grab/cardread.d.ts +22 -0
- package/dist/grab/cardview.d.ts +18 -0
- package/dist/grab/clipboard.d.ts +8 -0
- package/dist/grab/colors.d.ts +31 -0
- package/dist/grab/colorvalue.d.ts +40 -0
- package/dist/grab/context.d.ts +25 -0
- package/dist/grab/control.d.ts +37 -0
- package/dist/grab/copy.d.ts +7 -0
- package/dist/grab/dwell.d.ts +29 -0
- package/dist/grab/fiber.d.ts +17 -0
- package/dist/grab/fontused.d.ts +23 -0
- package/dist/grab/hit.d.ts +19 -0
- package/dist/grab/hook.d.ts +7 -0
- package/dist/grab/index.d.ts +9 -0
- package/dist/grab/inspect.d.ts +31 -0
- package/dist/grab/keys.d.ts +84 -0
- package/dist/grab/locate.d.ts +63 -0
- package/dist/grab/mode.d.ts +56 -0
- package/dist/grab/navigate.d.ts +21 -0
- package/dist/grab/outline.d.ts +16 -0
- package/dist/grab/overlay.d.ts +135 -0
- package/dist/grab/paint.d.ts +7 -0
- package/dist/grab/paths.d.ts +27 -0
- package/dist/grab/picks.d.ts +9 -0
- package/dist/grab/place.d.ts +25 -0
- package/dist/grab/preview.d.ts +12 -0
- package/dist/grab/selector.d.ts +15 -0
- package/dist/grab/source.d.ts +68 -0
- package/dist/grab/stack.d.ts +49 -0
- package/dist/grab/theme.d.ts +85 -0
- package/dist/grab/types.d.ts +52 -0
- package/dist/host.d.ts +7 -0
- package/dist/index-0casarhy.js +324 -0
- package/dist/index-2d6wvs8h.js +528 -0
- package/dist/index-33x9hxe3.js +4563 -0
- package/dist/index-5baxvd3v.js +4424 -0
- package/dist/index-78r0f8pw.js +27 -0
- package/dist/index-d0cjxjsm.js +21 -0
- package/dist/index-dvr4x91q.js +4800 -0
- package/dist/index-k015tb6c.js +357 -0
- package/dist/index-ke6v7919.js +4801 -0
- package/dist/index-peh33xjv.js +346 -0
- package/dist/index-ztnjefrh.js +23 -0
- package/dist/index-zvze25nf.js +686 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.global.js +2655 -0
- package/dist/index.js +9262 -0
- package/dist/instance.d.ts +29 -0
- package/dist/react-65tgdbs8.js +22 -0
- package/dist/react-71a9ypex.js +529 -0
- package/dist/react-adky72h9.js +29 -0
- package/dist/react-carf84xv.js +4420 -0
- package/dist/react-eygws6cx.js +358 -0
- package/dist/react-h9w04skh.js +25 -0
- package/dist/react-pdvseef0.js +325 -0
- package/dist/react-qv0nykcv.js +4564 -0
- package/dist/react-sq9pkw4k.js +687 -0
- package/dist/react-xxfpfddf.js +347 -0
- package/dist/react.d.ts +6 -0
- package/dist/react.js +9255 -0
- package/dist/requests/body.d.ts +44 -0
- package/dist/requests/eventsource.d.ts +14 -0
- package/dist/requests/fetch.d.ts +14 -0
- package/dist/requests/index.d.ts +35 -0
- package/dist/requests/patch.d.ts +17 -0
- package/dist/requests/quiet.d.ts +12 -0
- package/dist/requests/record.d.ts +40 -0
- package/dist/requests/resource.d.ts +28 -0
- package/dist/requests/shared.d.ts +34 -0
- package/dist/requests/stack.d.ts +7 -0
- package/dist/requests/store.d.ts +37 -0
- package/dist/requests/types.d.ts +140 -0
- package/dist/requests/xhr.d.ts +16 -0
- package/dist/storage/cache.d.ts +32 -0
- package/dist/storage/clear.d.ts +35 -0
- package/dist/storage/cookies.d.ts +71 -0
- package/dist/storage/format.d.ts +53 -0
- package/dist/storage/idb.d.ts +62 -0
- package/dist/storage/onload.d.ts +47 -0
- package/dist/storage/presets.d.ts +79 -0
- package/dist/storage/site.d.ts +51 -0
- package/dist/storage/web.d.ts +57 -0
- package/dist/storageview-sb23henh.js +2729 -0
- package/dist/storageview-vf8v8q8j.js +2728 -0
- package/dist/styles/cascade.d.ts +59 -0
- package/dist/styles/collect.d.ts +73 -0
- package/dist/styles/declarations.d.ts +30 -0
- package/dist/styles/index.d.ts +20 -0
- package/dist/styles/inherited.d.ts +5 -0
- package/dist/styles/match.d.ts +41 -0
- package/dist/styles/selector.d.ts +36 -0
- package/dist/styles/tree.d.ts +14 -0
- package/dist/styles/types.d.ts +117 -0
- package/dist/styles/varrefs.d.ts +35 -0
- package/dist/types.d.ts +221 -0
- package/dist/ui/actions.d.ts +26 -0
- package/dist/ui/bindings.d.ts +89 -0
- package/dist/ui/boxdiagram.d.ts +50 -0
- package/dist/ui/catalog.d.ts +195 -0
- package/dist/ui/colors.d.ts +51 -0
- package/dist/ui/column.d.ts +22 -0
- package/dist/ui/copytext.d.ts +6 -0
- package/dist/ui/deviceknobs.d.ts +20 -0
- package/dist/ui/dockslide.d.ts +100 -0
- package/dist/ui/dom.d.ts +68 -0
- package/dist/ui/domtree.d.ts +143 -0
- package/dist/ui/drag.d.ts +34 -0
- package/dist/ui/editors.d.ts +30 -0
- package/dist/ui/elementsview.d.ts +32 -0
- package/dist/ui/foldslider.d.ts +48 -0
- package/dist/ui/footer.d.ts +51 -0
- package/dist/ui/hold.d.ts +20 -0
- package/dist/ui/icons.d.ts +145 -0
- package/dist/ui/inspector.d.ts +59 -0
- package/dist/ui/keys.d.ts +180 -0
- package/dist/ui/kit.d.ts +336 -0
- package/dist/ui/knobs.d.ts +41 -0
- package/dist/ui/list.d.ts +68 -0
- package/dist/ui/palette.d.ts +59 -0
- package/dist/ui/pane.d.ts +151 -0
- package/dist/ui/panel.d.ts +56 -0
- package/dist/ui/pin.d.ts +28 -0
- package/dist/ui/place.d.ts +136 -0
- package/dist/ui/prefs.d.ts +53 -0
- package/dist/ui/radio.d.ts +37 -0
- package/dist/ui/requestdetail.d.ts +56 -0
- package/dist/ui/requestformat.d.ts +142 -0
- package/dist/ui/requestparts.d.ts +312 -0
- package/dist/ui/requests.d.ts +48 -0
- package/dist/ui/rows.d.ts +72 -0
- package/dist/ui/search.d.ts +29 -0
- package/dist/ui/settings.d.ts +69 -0
- package/dist/ui/size.d.ts +105 -0
- package/dist/ui/slide.d.ts +46 -0
- package/dist/ui/stage.d.ts +24 -0
- package/dist/ui/storageaction.d.ts +22 -0
- package/dist/ui/storagecookies.d.ts +5 -0
- package/dist/ui/storagedeep.d.ts +18 -0
- package/dist/ui/storageparts.d.ts +131 -0
- package/dist/ui/storagepresets.d.ts +19 -0
- package/dist/ui/storageview.d.ts +45 -0
- package/dist/ui/storageweb.d.ts +11 -0
- package/dist/ui/styles.d.ts +1 -0
- package/dist/ui/stylesapplied.d.ts +46 -0
- package/dist/ui/stylesformat.d.ts +78 -0
- package/dist/ui/stylesview.d.ts +118 -0
- package/dist/ui/swatches.d.ts +26 -0
- package/dist/ui/syntax.d.ts +34 -0
- package/dist/ui/tooltip.d.ts +64 -0
- package/package.json +60 -4
- package/skills/devknobs/SKILL.md +214 -0
|
@@ -0,0 +1,4564 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_STATE,
|
|
4
|
+
DOT_LOOK,
|
|
5
|
+
EXITED,
|
|
6
|
+
MARK_EVENT,
|
|
7
|
+
NOW_READERS,
|
|
8
|
+
NativeDate,
|
|
9
|
+
QUIET,
|
|
10
|
+
SHARED_VERSION,
|
|
11
|
+
__export,
|
|
12
|
+
__require,
|
|
13
|
+
addStyle,
|
|
14
|
+
apply,
|
|
15
|
+
apply1 as apply2,
|
|
16
|
+
apply2 as apply3,
|
|
17
|
+
apply3 as apply4,
|
|
18
|
+
apply4 as apply5,
|
|
19
|
+
apply5 as apply6,
|
|
20
|
+
clockOn,
|
|
21
|
+
destroy,
|
|
22
|
+
drive,
|
|
23
|
+
driveUa,
|
|
24
|
+
dropEarly,
|
|
25
|
+
enableNative,
|
|
26
|
+
ensureStyle,
|
|
27
|
+
evict,
|
|
28
|
+
framed,
|
|
29
|
+
framing,
|
|
30
|
+
hasTouch,
|
|
31
|
+
inPage,
|
|
32
|
+
isDevknobsFrame,
|
|
33
|
+
keepOwn,
|
|
34
|
+
keepPlace,
|
|
35
|
+
leaveFor,
|
|
36
|
+
load,
|
|
37
|
+
merge,
|
|
38
|
+
nativeEnabled,
|
|
39
|
+
nativeScheme,
|
|
40
|
+
nativeViewport,
|
|
41
|
+
needsFrame,
|
|
42
|
+
newer,
|
|
43
|
+
now,
|
|
44
|
+
ownReload,
|
|
45
|
+
post,
|
|
46
|
+
readMessage,
|
|
47
|
+
readNow,
|
|
48
|
+
realNow,
|
|
49
|
+
release,
|
|
50
|
+
removeStyle,
|
|
51
|
+
reset,
|
|
52
|
+
reset1 as reset2,
|
|
53
|
+
reset2 as reset3,
|
|
54
|
+
reset3 as reset4,
|
|
55
|
+
reset4 as reset5,
|
|
56
|
+
resetState,
|
|
57
|
+
resolveGeo,
|
|
58
|
+
resume,
|
|
59
|
+
save,
|
|
60
|
+
setClock,
|
|
61
|
+
share,
|
|
62
|
+
shared,
|
|
63
|
+
stamped,
|
|
64
|
+
styleNode,
|
|
65
|
+
takeOver,
|
|
66
|
+
temporalNow,
|
|
67
|
+
uaPreset,
|
|
68
|
+
webStorage,
|
|
69
|
+
wrapDate
|
|
70
|
+
} from "./react-carf84xv.js";
|
|
71
|
+
|
|
72
|
+
// src/ui/icons.ts
|
|
73
|
+
var SVG = "http://www.w3.org/2000/svg";
|
|
74
|
+
var p = (d) => ["path", { d }];
|
|
75
|
+
var c = (cx, cy, r) => ["circle", { cx, cy, r }];
|
|
76
|
+
var ICONS = {
|
|
77
|
+
"half-sun-moon": [
|
|
78
|
+
p("M12 7a5 5 0 0 0 0 10"),
|
|
79
|
+
p("M12 3a9 9 0 0 1 0 18 12 12 0 0 0 0-18z"),
|
|
80
|
+
p("M3 12h2"),
|
|
81
|
+
p("m5.64 5.64 1.41 1.41"),
|
|
82
|
+
p("m5.64 18.36 1.41-1.41")
|
|
83
|
+
],
|
|
84
|
+
contrast: [c("12", "12", "10"), p("M12 18a6 6 0 0 0 0-12v12z")],
|
|
85
|
+
blend: [c("15", "9", "7"), c("9", "15", "7")],
|
|
86
|
+
eye: [
|
|
87
|
+
p("M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"),
|
|
88
|
+
c("12", "12", "3")
|
|
89
|
+
],
|
|
90
|
+
type: [p("M12 4v16"), p("M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"), p("M9 20h6")],
|
|
91
|
+
wind: [
|
|
92
|
+
p("M12.8 19.6A2 2 0 1 0 14 16H2"),
|
|
93
|
+
p("M17.5 8a2.5 2.5 0 1 1 2 4H2"),
|
|
94
|
+
p("M9.8 4.4A2 2 0 1 1 11 8H2")
|
|
95
|
+
],
|
|
96
|
+
languages: [
|
|
97
|
+
p("m5 8 6 6"),
|
|
98
|
+
p("m4 14 6-6 2-3"),
|
|
99
|
+
p("M2 5h12"),
|
|
100
|
+
p("M7 2h1"),
|
|
101
|
+
p("m22 22-5-10-5 10"),
|
|
102
|
+
p("M14 18h6")
|
|
103
|
+
],
|
|
104
|
+
"map-pin": [
|
|
105
|
+
p("M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"),
|
|
106
|
+
c("12", "10", "3")
|
|
107
|
+
],
|
|
108
|
+
clock: [c("12", "12", "10"), p("M12 6v6l4 2")],
|
|
109
|
+
wifi: [
|
|
110
|
+
p("M12 20h.01"),
|
|
111
|
+
p("M2 8.82a15 15 0 0 1 20 0"),
|
|
112
|
+
p("M5 12.859a10 10 0 0 1 14 0"),
|
|
113
|
+
p("M8.5 16.429a5 5 0 0 1 7 0")
|
|
114
|
+
],
|
|
115
|
+
smartphone: [
|
|
116
|
+
["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2" }],
|
|
117
|
+
p("M12 18h.01")
|
|
118
|
+
],
|
|
119
|
+
ruler: [
|
|
120
|
+
p("M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"),
|
|
121
|
+
p("m14.5 12.5 2-2"),
|
|
122
|
+
p("m11.5 9.5 2-2"),
|
|
123
|
+
p("m8.5 6.5 2-2"),
|
|
124
|
+
p("m17.5 15.5 2-2")
|
|
125
|
+
],
|
|
126
|
+
bug: [
|
|
127
|
+
p("M12 20v-9"),
|
|
128
|
+
p("M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"),
|
|
129
|
+
p("M14.12 3.88 16 2"),
|
|
130
|
+
p("M21 21a4 4 0 0 0-3.81-4"),
|
|
131
|
+
p("M21 5a4 4 0 0 1-3.55 3.97"),
|
|
132
|
+
p("M22 13h-4"),
|
|
133
|
+
p("M3 21a4 4 0 0 1 3.81-4"),
|
|
134
|
+
p("M3 5a4 4 0 0 0 3.55 3.97"),
|
|
135
|
+
p("M6 13H2"),
|
|
136
|
+
p("m8 2 1.88 1.88"),
|
|
137
|
+
p("M9 7.13V6a3 3 0 1 1 6 0v1.13")
|
|
138
|
+
],
|
|
139
|
+
"square-dashed-mouse-pointer": [
|
|
140
|
+
p("M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"),
|
|
141
|
+
p("M5 3a2 2 0 0 0-2 2"),
|
|
142
|
+
p("M19 3a2 2 0 0 1 2 2"),
|
|
143
|
+
p("M5 21a2 2 0 0 1-2-2"),
|
|
144
|
+
p("M9 3h1"),
|
|
145
|
+
p("M9 21h2"),
|
|
146
|
+
p("M14 3h1"),
|
|
147
|
+
p("M3 9v1"),
|
|
148
|
+
p("M21 9v2"),
|
|
149
|
+
p("M3 14v1")
|
|
150
|
+
],
|
|
151
|
+
braces: [
|
|
152
|
+
p("M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"),
|
|
153
|
+
p("M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1")
|
|
154
|
+
],
|
|
155
|
+
settings: [
|
|
156
|
+
p("M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"),
|
|
157
|
+
c("12", "12", "3")
|
|
158
|
+
],
|
|
159
|
+
"panel-right": [
|
|
160
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }],
|
|
161
|
+
p("M15 3v18")
|
|
162
|
+
],
|
|
163
|
+
"panel-left": [
|
|
164
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }],
|
|
165
|
+
p("M9 3v18")
|
|
166
|
+
],
|
|
167
|
+
"panel-right-close": [
|
|
168
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }],
|
|
169
|
+
p("M15 3v18"),
|
|
170
|
+
p("m8 9 3 3-3 3")
|
|
171
|
+
],
|
|
172
|
+
"panel-right-open": [
|
|
173
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }],
|
|
174
|
+
p("M15 3v18"),
|
|
175
|
+
p("m10 15-3-3 3-3")
|
|
176
|
+
],
|
|
177
|
+
pin: [
|
|
178
|
+
p("M12 17v5"),
|
|
179
|
+
p("M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z")
|
|
180
|
+
],
|
|
181
|
+
"pin-off": [
|
|
182
|
+
p("M12 17v5"),
|
|
183
|
+
p("M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"),
|
|
184
|
+
p("m2 2 20 20"),
|
|
185
|
+
p("M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11")
|
|
186
|
+
],
|
|
187
|
+
eraser: [
|
|
188
|
+
p("M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21"),
|
|
189
|
+
p("m5.082 11.09 8.828 8.828")
|
|
190
|
+
],
|
|
191
|
+
"rotate-ccw": [p("M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"), p("M3 3v5h5")],
|
|
192
|
+
"arrow-up-down": [p("m21 16-4 4-4-4"), p("M17 20V4"), p("m3 8 4-4 4 4"), p("M7 4v16")],
|
|
193
|
+
ban: [c("12", "12", "10"), p("M4.929 4.929 19.07 19.071")],
|
|
194
|
+
copy: [
|
|
195
|
+
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }],
|
|
196
|
+
p("M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2")
|
|
197
|
+
],
|
|
198
|
+
"refresh-cw": [
|
|
199
|
+
p("M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"),
|
|
200
|
+
p("M21 3v5h-5"),
|
|
201
|
+
p("M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"),
|
|
202
|
+
p("M8 16H3v5")
|
|
203
|
+
],
|
|
204
|
+
database: [
|
|
205
|
+
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3" }],
|
|
206
|
+
p("M3 5V19A9 3 0 0 0 21 19V5"),
|
|
207
|
+
p("M3 12A9 3 0 0 0 21 12")
|
|
208
|
+
],
|
|
209
|
+
"trash-2": [
|
|
210
|
+
p("M10 11v6"),
|
|
211
|
+
p("M14 11v6"),
|
|
212
|
+
p("M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"),
|
|
213
|
+
p("M3 6h18"),
|
|
214
|
+
p("M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2")
|
|
215
|
+
],
|
|
216
|
+
check: [p("M20 6 9 17l-5-5")],
|
|
217
|
+
"chevron-left": [p("m15 18-6-6 6-6")],
|
|
218
|
+
"chevrons-left-right": [p("m9 7-5 5 5 5"), p("m15 7 5 5-5 5")],
|
|
219
|
+
plus: [p("M5 12h14"), p("M12 5v14")],
|
|
220
|
+
x: [p("M18 6 6 18"), p("m6 6 12 12")],
|
|
221
|
+
"grip-vertical": [
|
|
222
|
+
c("9", "12", "1"),
|
|
223
|
+
c("9", "5", "1"),
|
|
224
|
+
c("9", "19", "1"),
|
|
225
|
+
c("15", "12", "1"),
|
|
226
|
+
c("15", "5", "1"),
|
|
227
|
+
c("15", "19", "1")
|
|
228
|
+
],
|
|
229
|
+
image: [
|
|
230
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2" }],
|
|
231
|
+
c("9", "9", "2"),
|
|
232
|
+
p("m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21")
|
|
233
|
+
],
|
|
234
|
+
film: [
|
|
235
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }],
|
|
236
|
+
p("M7 3v18"),
|
|
237
|
+
p("M3 7.5h4"),
|
|
238
|
+
p("M3 12h18"),
|
|
239
|
+
p("M3 16.5h4"),
|
|
240
|
+
p("M17 3v18"),
|
|
241
|
+
p("M17 7.5h4"),
|
|
242
|
+
p("M17 16.5h4")
|
|
243
|
+
],
|
|
244
|
+
file: [
|
|
245
|
+
p("M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"),
|
|
246
|
+
p("M14 2v5a1 1 0 0 0 1 1h5")
|
|
247
|
+
],
|
|
248
|
+
"table-2": [
|
|
249
|
+
p("M3 9h18"),
|
|
250
|
+
p("M9 3v18"),
|
|
251
|
+
["rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }]
|
|
252
|
+
],
|
|
253
|
+
cookie: [
|
|
254
|
+
p("M11 17h.01"),
|
|
255
|
+
p("M11.496 2c.324-.016.558.292.529.615a4 4 0 004.235 4.368.713.713 0 01.758.757 4 4 0 004.366 4.237c.323-.03.63.204.614.527a10 10 0 01-2.915 6.566A1 1 0 114.93 4.918 10 10 0 0111.496 2"),
|
|
256
|
+
p("M12 12h.01"),
|
|
257
|
+
p("M16 16h.01"),
|
|
258
|
+
p("M16 3h.01"),
|
|
259
|
+
p("M21 4h.01"),
|
|
260
|
+
p("M21 8h.01"),
|
|
261
|
+
p("M7 14h.01"),
|
|
262
|
+
p("M9 8h.01")
|
|
263
|
+
],
|
|
264
|
+
"hard-drive": [
|
|
265
|
+
p("M10 16h.01"),
|
|
266
|
+
p("M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"),
|
|
267
|
+
p("M21.946 12.013H2.054"),
|
|
268
|
+
p("M6 16h.01")
|
|
269
|
+
],
|
|
270
|
+
bookmark: [
|
|
271
|
+
p("M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z")
|
|
272
|
+
]
|
|
273
|
+
};
|
|
274
|
+
var BRANDS = {
|
|
275
|
+
javascript: [
|
|
276
|
+
"#F7DF1E",
|
|
277
|
+
"M0 0h24v24H0V0zm22.034 18.276c-.175-1.095-.888-2.015-3.003-2.873-.736-.345-1.554-.585-1.797-1.14-.091-.33-.105-.51-.046-.705.15-.646.915-.84 1.515-.66.39.12.75.42.976.9 1.034-.676 1.034-.676 1.755-1.125-.27-.42-.404-.601-.586-.78-.63-.705-1.469-1.065-2.834-1.034l-.705.089c-.676.165-1.32.525-1.71 1.005-1.14 1.291-.811 3.541.569 4.471 1.365 1.02 3.361 1.244 3.616 2.205.24 1.17-.87 1.545-1.966 1.41-.811-.18-1.26-.586-1.755-1.336l-1.83 1.051c.21.48.45.689.81 1.109 1.74 1.756 6.09 1.666 6.871-1.004.029-.09.24-.705.074-1.65l.046.067zm-8.983-7.245h-2.248c0 1.938-.009 3.864-.009 5.805 0 1.232.063 2.363-.138 2.711-.33.689-1.18.601-1.566.48-.396-.196-.597-.466-.83-.855-.063-.105-.11-.196-.127-.196l-1.825 1.125c.305.63.75 1.172 1.324 1.517.855.51 2.004.675 3.207.405.783-.226 1.458-.691 1.811-1.411.51-.93.402-2.07.397-3.346.012-2.054 0-4.109 0-6.179l.004-.056z",
|
|
278
|
+
["#000", "M1 1h22v22H1z"]
|
|
279
|
+
],
|
|
280
|
+
css: [
|
|
281
|
+
"#663399",
|
|
282
|
+
"M0 0v20.16A3.84 3.84 0 0 0 3.84 24h16.32A3.84 3.84 0 0 0 24 20.16V3.84A3.84 3.84 0 0 0 20.16 0Zm14.256 13.08c1.56 0 2.28 1.08 2.304 2.64h-1.608c.024-.288-.048-.6-.144-.84-.096-.192-.288-.264-.552-.264-.456 0-.696.264-.696.84-.024.576.288.888.768 1.08.72.288 1.608.744 1.92 1.296q.432.648.432 1.656c0 1.608-.912 2.592-2.496 2.592-1.656 0-2.4-1.032-2.424-2.688h1.68c0 .792.264 1.176.792 1.176.264 0 .456-.072.552-.24.192-.312.24-1.176-.048-1.512-.312-.408-.912-.6-1.32-.816q-.828-.396-1.224-.936c-.24-.36-.36-.888-.36-1.536 0-1.44.936-2.472 2.424-2.448m5.4 0c1.584 0 2.304 1.08 2.328 2.64h-1.608c0-.288-.048-.6-.168-.84-.096-.192-.264-.264-.528-.264-.48 0-.72.264-.72.84s.288.888.792 1.08c.696.288 1.608.744 1.92 1.296.264.432.408.984.408 1.656.024 1.608-.888 2.592-2.472 2.592-1.68 0-2.424-1.056-2.448-2.688h1.68c0 .744.264 1.176.792 1.176.264 0 .456-.072.552-.24.216-.312.264-1.176-.048-1.512-.288-.408-.888-.6-1.32-.816-.552-.264-.96-.576-1.2-.936s-.36-.888-.36-1.536c-.024-1.44.912-2.472 2.4-2.448m-11.031.018c.711-.006 1.419.198 1.839.63.432.432.672 1.128.648 1.992H9.336c.024-.456-.096-.792-.432-.96-.312-.144-.768-.048-.888.24-.12.264-.192.576-.168.864v3.504c0 .744.264 1.128.768 1.128a.65.65 0 0 0 .552-.264c.168-.24.192-.552.168-.84h1.776c.096 1.632-.984 2.712-2.568 2.688-1.536 0-2.496-.864-2.472-2.472v-4.032c0-.816.24-1.44.696-1.848.432-.408 1.146-.624 1.857-.63",
|
|
283
|
+
["#fff", "M4 12h18v11.3H4z"]
|
|
284
|
+
],
|
|
285
|
+
html5: [
|
|
286
|
+
"#E34F26",
|
|
287
|
+
"M1.5 0h21l-1.91 21.563L11.977 24l-8.564-2.438L1.5 0zm7.031 9.75l-.232-2.718 10.059.003.23-2.622L5.412 4.41l.698 8.01h9.126l-.326 3.426-2.91.804-2.955-.81-.188-2.11H6.248l.33 4.171L12 19.351l5.379-1.443.744-8.157H8.531z",
|
|
288
|
+
["#fff", "M5 4h14v16H5z"]
|
|
289
|
+
],
|
|
290
|
+
webassembly: [
|
|
291
|
+
"#654FF0",
|
|
292
|
+
"M14.745,0c0,0.042,0,0.085,0,0.129c0,1.52-1.232,2.752-2.752,2.752c-1.52,0-2.752-1.232-2.752-2.752 c0-0.045,0-0.087,0-0.129H0v24h24V0H14.745z M11.454,21.431l-1.169-5.783h-0.02l-1.264,5.783H7.39l-1.824-8.497h1.59l1.088,5.783 h0.02l1.311-5.783h1.487l1.177,5.854h0.02l1.242-5.854h1.561l-2.027,8.497H11.454z M20.209,21.431l-0.542-1.891h-2.861l-0.417,1.891 h-1.59l2.056-8.497h2.509l2.5,8.497H20.209z M17.812,15.028l-0.694,3.118h2.159l-0.796-3.118H17.812z",
|
|
293
|
+
["#fff", "M4 12h19v10H4z"]
|
|
294
|
+
],
|
|
295
|
+
json: [
|
|
296
|
+
"currentColor",
|
|
297
|
+
"M12.043 23.968c.479-.004.953-.029 1.426-.094a11.805 11.805 0 003.146-.863 12.404 12.404 0 003.793-2.542 11.977 11.977 0 002.44-3.427 11.794 11.794 0 001.02-3.476c.149-1.16.135-2.346-.045-3.499a11.96 11.96 0 00-.793-2.788 11.197 11.197 0 00-.854-1.617c-1.168-1.837-2.861-3.314-4.81-4.3a12.835 12.835 0 00-2.172-.87h-.005c.119.063.24.132.345.201.12.074.239.146.351.225a8.93 8.93 0 011.559 1.33c1.063 1.145 1.797 2.548 2.218 4.041.284.982.434 1.998.495 3.017.044.743.044 1.491-.047 2.229-.149 1.27-.554 2.51-1.228 3.596a7.475 7.475 0 01-1.903 2.084c-1.244.928-2.877 1.482-4.436 1.114a3.916 3.916 0 01-.748-.258 4.692 4.692 0 01-.779-.45 6.08 6.08 0 01-1.244-1.105 6.507 6.507 0 01-1.049-1.747 7.366 7.366 0 01-.494-2.54c-.03-1.273.225-2.553.854-3.67a6.43 6.43 0 011.663-1.918c.225-.178.464-.333.704-.479l.016-.007a5.121 5.121 0 00-1.441-.12 4.963 4.963 0 00-1.228.24c-.359.12-.704.27-1.019.45a6.146 6.146 0 00-.733.494c-.211.18-.42.36-.615.555-1.123 1.153-1.768 2.682-2.022 4.256-.15.973-.15 1.96-.091 2.95.105 1.395.391 2.787.945 4.062a8.518 8.518 0 001.348 2.173 8.14 8.14 0 003.132 2.23 7.934 7.934 0 002.113.54c.074.015.149.015.209.015zm-2.934-.398a4.102 4.102 0 01-.45-.228 8.5 8.5 0 01-2.038-1.534c-1.094-1.137-1.827-2.566-2.247-4.08a15.184 15.184 0 01-.495-3.172 12.14 12.14 0 01.046-2.082c.135-1.257.495-2.501 1.124-3.58a6.889 6.889 0 011.783-2.053 6.23 6.23 0 011.633-.9 5.363 5.363 0 013.522-.045c.029 0 .029 0 .045.03.015.015.045.015.06.03.045.016.104.045.165.074.239.12.479.271.704.42a6.294 6.294 0 012.097 2.502c.42.914.615 1.934.631 2.938.014 1.079-.18 2.157-.645 3.146a6.42 6.42 0 01-2.638 2.832c.09.03.18.045.271.075.225.044.449.074.688.074 1.468.045 2.892-.66 3.94-1.647.195-.18.375-.375.54-.585.225-.27.435-.54.614-.823.239-.375.435-.75.614-1.154a8.112 8.112 0 00.509-1.664c.196-1.004.211-2.022.149-3.026-.135-2.022-.673-4.045-1.842-5.724a9.054 9.054 0 00-.555-.719 9.868 9.868 0 00-1.063-1.034 8.477 8.477 0 00-1.363-.915 9.927 9.927 0 00-1.692-.598l-.3-.06c-.209-.03-.42-.044-.634-.06a8.453 8.453 0 00-1.015.016c-.704.045-1.412.16-2.112.337C5.799 1.227 2.863 3.566 1.3 6.67A11.834 11.834 0 00.238 9.801a11.81 11.81 0 00-.104 3.775c.12 1.02.374 2.023.778 2.977.227.57.511 1.124.825 1.648 1.094 1.783 2.683 3.236 4.51 4.24.688.39 1.408.69 2.157.944.226.074.45.15.689.21z"
|
|
298
|
+
]
|
|
299
|
+
};
|
|
300
|
+
var ROW_ICONS = {
|
|
301
|
+
scheme: "half-sun-moon",
|
|
302
|
+
contrast: "contrast",
|
|
303
|
+
transparency: "blend",
|
|
304
|
+
vision: "eye",
|
|
305
|
+
text: "type",
|
|
306
|
+
motion: "wind",
|
|
307
|
+
locale: "languages",
|
|
308
|
+
location: "map-pin",
|
|
309
|
+
clock: "clock",
|
|
310
|
+
network: "wifi",
|
|
311
|
+
device: "smartphone",
|
|
312
|
+
viewport: "ruler",
|
|
313
|
+
debug: "bug"
|
|
314
|
+
};
|
|
315
|
+
function rowIcon(row) {
|
|
316
|
+
return row.action ? row.action.icon : ROW_ICONS[row.id];
|
|
317
|
+
}
|
|
318
|
+
var BINDING_ICONS = {
|
|
319
|
+
panel: "panel-right-open",
|
|
320
|
+
grab: "square-dashed-mouse-pointer",
|
|
321
|
+
inspect: "braces",
|
|
322
|
+
replay: "rotate-ccw",
|
|
323
|
+
requests: "arrow-up-down",
|
|
324
|
+
storage: "database",
|
|
325
|
+
reset: "eraser"
|
|
326
|
+
};
|
|
327
|
+
function frame(size) {
|
|
328
|
+
const svg = document.createElementNS(SVG, "svg");
|
|
329
|
+
svg.setAttribute("class", "glyph");
|
|
330
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
331
|
+
svg.setAttribute("width", String(size));
|
|
332
|
+
svg.setAttribute("height", String(size));
|
|
333
|
+
svg.setAttribute("aria-hidden", "true");
|
|
334
|
+
return svg;
|
|
335
|
+
}
|
|
336
|
+
function icon(name, size = 14) {
|
|
337
|
+
const svg = frame(size);
|
|
338
|
+
svg.setAttribute("fill", "none");
|
|
339
|
+
svg.setAttribute("stroke", "currentColor");
|
|
340
|
+
svg.setAttribute("stroke-width", "1.5");
|
|
341
|
+
svg.setAttribute("stroke-linecap", "round");
|
|
342
|
+
svg.setAttribute("stroke-linejoin", "round");
|
|
343
|
+
for (const [tag, attributes] of ICONS[name]) {
|
|
344
|
+
const shape = document.createElementNS(SVG, tag);
|
|
345
|
+
for (const [key, value] of Object.entries(attributes))
|
|
346
|
+
shape.setAttribute(key, value);
|
|
347
|
+
svg.append(shape);
|
|
348
|
+
}
|
|
349
|
+
return svg;
|
|
350
|
+
}
|
|
351
|
+
function brand(name, size = 14) {
|
|
352
|
+
const svg = frame(size);
|
|
353
|
+
const [fill, d, behind] = BRANDS[name];
|
|
354
|
+
for (const [color, path] of behind ? [behind, [fill, d]] : [[fill, d]]) {
|
|
355
|
+
const shape = document.createElementNS(SVG, "path");
|
|
356
|
+
shape.setAttribute("fill", color);
|
|
357
|
+
shape.setAttribute("d", path);
|
|
358
|
+
svg.append(shape);
|
|
359
|
+
}
|
|
360
|
+
return svg;
|
|
361
|
+
}
|
|
362
|
+
function isBrand(name) {
|
|
363
|
+
return name in BRANDS;
|
|
364
|
+
}
|
|
365
|
+
function glyph(name, size = 14) {
|
|
366
|
+
return isBrand(name) ? brand(name, size) : icon(name, size);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// src/engine/intl.ts
|
|
370
|
+
var SERVICES = [
|
|
371
|
+
"Collator",
|
|
372
|
+
"DateTimeFormat",
|
|
373
|
+
"DisplayNames",
|
|
374
|
+
"DurationFormat",
|
|
375
|
+
"ListFormat",
|
|
376
|
+
"NumberFormat",
|
|
377
|
+
"PluralRules",
|
|
378
|
+
"RelativeTimeFormat",
|
|
379
|
+
"Segmenter"
|
|
380
|
+
];
|
|
381
|
+
var tag = null;
|
|
382
|
+
var slots = [];
|
|
383
|
+
var proxies = new WeakMap;
|
|
384
|
+
var targets = new WeakMap;
|
|
385
|
+
function members() {
|
|
386
|
+
const list = SERVICES.map((key) => ({ owner: Intl, key, index: 0 }));
|
|
387
|
+
const methods = [
|
|
388
|
+
[Number.prototype, "toLocaleString"],
|
|
389
|
+
[typeof BigInt === "function" ? BigInt.prototype : undefined, "toLocaleString"],
|
|
390
|
+
[Array.prototype, "toLocaleString"],
|
|
391
|
+
[Date.prototype, "toLocaleString"],
|
|
392
|
+
[Date.prototype, "toLocaleDateString"],
|
|
393
|
+
[Date.prototype, "toLocaleTimeString"]
|
|
394
|
+
];
|
|
395
|
+
for (const [owner, key] of methods)
|
|
396
|
+
if (owner)
|
|
397
|
+
list.push({ owner, key, index: 0 });
|
|
398
|
+
list.push({ owner: String.prototype, key: "localeCompare", index: 1 });
|
|
399
|
+
return list;
|
|
400
|
+
}
|
|
401
|
+
function canonicalTag(lang) {
|
|
402
|
+
try {
|
|
403
|
+
return Intl.getCanonicalLocales(lang)[0] ?? null;
|
|
404
|
+
} catch {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function withLocale(args, index, locale) {
|
|
409
|
+
if (locale === null)
|
|
410
|
+
return args;
|
|
411
|
+
const given = args[index];
|
|
412
|
+
if (given !== undefined && !(Array.isArray(given) && given.length === 0))
|
|
413
|
+
return args;
|
|
414
|
+
const next = args.slice();
|
|
415
|
+
next[index] = locale;
|
|
416
|
+
return next;
|
|
417
|
+
}
|
|
418
|
+
function underLocale(value) {
|
|
419
|
+
return typeof value === "function" && targets.get(value) || value;
|
|
420
|
+
}
|
|
421
|
+
function proxyFor(inner, index) {
|
|
422
|
+
const known = proxies.get(inner);
|
|
423
|
+
if (known)
|
|
424
|
+
return known;
|
|
425
|
+
const proxy = new Proxy(inner, {
|
|
426
|
+
apply: (target, thisArg, args) => Reflect.apply(target, thisArg, withLocale(args, index, tag)),
|
|
427
|
+
construct: (target, args, newTarget) => Reflect.construct(target, withLocale(args, index, tag), newTarget)
|
|
428
|
+
});
|
|
429
|
+
proxies.set(inner, proxy);
|
|
430
|
+
targets.set(proxy, inner);
|
|
431
|
+
return proxy;
|
|
432
|
+
}
|
|
433
|
+
function install(member) {
|
|
434
|
+
const descriptor = Object.getOwnPropertyDescriptor(member.owner, member.key);
|
|
435
|
+
if (!descriptor || !("value" in descriptor) || !descriptor.configurable)
|
|
436
|
+
return;
|
|
437
|
+
const slot = {
|
|
438
|
+
...member,
|
|
439
|
+
descriptor,
|
|
440
|
+
inner: descriptor.value,
|
|
441
|
+
get() {
|
|
442
|
+
const inner = slot.inner;
|
|
443
|
+
return typeof inner === "function" ? proxyFor(inner, member.index) : inner;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
function set(value) {
|
|
447
|
+
if (this !== member.owner && typeof this === "object" && this !== null) {
|
|
448
|
+
Object.defineProperty(this, member.key, {
|
|
449
|
+
configurable: true,
|
|
450
|
+
enumerable: true,
|
|
451
|
+
writable: true,
|
|
452
|
+
value
|
|
453
|
+
});
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
slot.inner = underLocale(value);
|
|
457
|
+
}
|
|
458
|
+
Object.defineProperty(member.owner, member.key, {
|
|
459
|
+
configurable: true,
|
|
460
|
+
enumerable: descriptor.enumerable,
|
|
461
|
+
get: slot.get,
|
|
462
|
+
set
|
|
463
|
+
});
|
|
464
|
+
slots.push(slot);
|
|
465
|
+
}
|
|
466
|
+
function uninstall(slot) {
|
|
467
|
+
const current = Object.getOwnPropertyDescriptor(slot.owner, slot.key);
|
|
468
|
+
if (current?.get !== slot.get)
|
|
469
|
+
return;
|
|
470
|
+
Object.defineProperty(slot.owner, slot.key, { ...slot.descriptor, value: slot.inner });
|
|
471
|
+
}
|
|
472
|
+
function setDefaultLocale(lang) {
|
|
473
|
+
tag = lang === null ? null : canonicalTag(lang);
|
|
474
|
+
if (tag === null) {
|
|
475
|
+
for (const slot of slots)
|
|
476
|
+
uninstall(slot);
|
|
477
|
+
slots.length = 0;
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
if (slots.length === 0)
|
|
481
|
+
for (const member of members())
|
|
482
|
+
install(member);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// src/engine/locale.ts
|
|
486
|
+
var LOCALE_PRESETS = [
|
|
487
|
+
"en",
|
|
488
|
+
"en-US",
|
|
489
|
+
"tr",
|
|
490
|
+
"de",
|
|
491
|
+
"fr",
|
|
492
|
+
"es",
|
|
493
|
+
"ar",
|
|
494
|
+
"he",
|
|
495
|
+
"ja",
|
|
496
|
+
"zh-CN"
|
|
497
|
+
];
|
|
498
|
+
var PARAGLIDE_COOKIE = "PARAGLIDE_LOCALE";
|
|
499
|
+
var OWNER_KEY = "devknobs:locale-stores";
|
|
500
|
+
var OWNER_VERSION = 1;
|
|
501
|
+
var RELOAD_KEY = "devknobs:locale-reload";
|
|
502
|
+
var RELOAD_VERSION = 1;
|
|
503
|
+
var RELOAD_THROTTLE = 5000;
|
|
504
|
+
var HOLD_BUDGET = 20;
|
|
505
|
+
var RTL_LANGUAGES = new Set(["ar", "he", "fa", "ur"]);
|
|
506
|
+
function intlDirection(lang) {
|
|
507
|
+
try {
|
|
508
|
+
const locale = new Intl.Locale(lang);
|
|
509
|
+
const info = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo;
|
|
510
|
+
const direction = info?.direction;
|
|
511
|
+
return direction === "ltr" || direction === "rtl" ? direction : null;
|
|
512
|
+
} catch {
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
function isRtl(lang) {
|
|
517
|
+
const direction = intlDirection(lang);
|
|
518
|
+
if (direction !== null)
|
|
519
|
+
return direction === "rtl";
|
|
520
|
+
const base = lang.toLowerCase().split("-")[0] ?? "";
|
|
521
|
+
return RTL_LANGUAGES.has(base);
|
|
522
|
+
}
|
|
523
|
+
function dirFor(value) {
|
|
524
|
+
if (value.dir !== "system")
|
|
525
|
+
return value.dir;
|
|
526
|
+
return isRtl(value.lang) ? "rtl" : "ltr";
|
|
527
|
+
}
|
|
528
|
+
function languagesFor(lang) {
|
|
529
|
+
const base = lang.split("-")[0];
|
|
530
|
+
return base && base !== lang ? [lang, base] : [lang];
|
|
531
|
+
}
|
|
532
|
+
function readCookie(jar, name) {
|
|
533
|
+
for (const entry of jar.split(";")) {
|
|
534
|
+
const separator = entry.indexOf("=");
|
|
535
|
+
if (separator === -1)
|
|
536
|
+
continue;
|
|
537
|
+
if (entry.slice(0, separator).trim() !== name)
|
|
538
|
+
continue;
|
|
539
|
+
return entry.slice(separator + 1).trim();
|
|
540
|
+
}
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
function isNext() {
|
|
544
|
+
if (typeof window === "undefined")
|
|
545
|
+
return false;
|
|
546
|
+
if ("__next_f" in window || "next" in window)
|
|
547
|
+
return true;
|
|
548
|
+
return document.querySelector?.('script[src*="/_next/"]') != null;
|
|
549
|
+
}
|
|
550
|
+
var present = (has) => has;
|
|
551
|
+
var ADAPTERS = [
|
|
552
|
+
{ library: "paraglide", kind: "cookie", key: PARAGLIDE_COOKIE, used: () => true },
|
|
553
|
+
{ library: "paraglide", kind: "local", key: "PARAGLIDE_LOCALE", used: present },
|
|
554
|
+
{ library: "i18next", kind: "local", key: "i18nextLng", used: present },
|
|
555
|
+
{ library: "i18next", kind: "session", key: "i18nextLng", used: present },
|
|
556
|
+
{ library: "i18next", kind: "cookie", key: "i18next", used: present },
|
|
557
|
+
{ library: "next-intl", kind: "cookie", key: "NEXT_LOCALE", used: (has) => has || isNext() }
|
|
558
|
+
];
|
|
559
|
+
var KINDS = ["cookie", "local", "session"];
|
|
560
|
+
function readStore(store) {
|
|
561
|
+
if (store.kind === "cookie")
|
|
562
|
+
return readCookie(document.cookie, store.key);
|
|
563
|
+
try {
|
|
564
|
+
return webStorage(store.kind)?.getItem(store.key) ?? null;
|
|
565
|
+
} catch {
|
|
566
|
+
return null;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
function unreachable(store) {
|
|
570
|
+
return store.kind !== "cookie" && webStorage(store.kind) === null;
|
|
571
|
+
}
|
|
572
|
+
function writeStore(store, value) {
|
|
573
|
+
if (store.kind === "cookie") {
|
|
574
|
+
document.cookie = value === null ? `${store.key}=; max-age=0; path=/` : `${store.key}=${value}; path=/; SameSite=Lax`;
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
try {
|
|
578
|
+
const storage = webStorage(store.kind);
|
|
579
|
+
if (value === null)
|
|
580
|
+
storage?.removeItem(store.key);
|
|
581
|
+
else
|
|
582
|
+
storage?.setItem(store.key, value);
|
|
583
|
+
} catch {}
|
|
584
|
+
}
|
|
585
|
+
function parseOwned(json) {
|
|
586
|
+
if (!json)
|
|
587
|
+
return null;
|
|
588
|
+
let raw;
|
|
589
|
+
try {
|
|
590
|
+
raw = JSON.parse(json);
|
|
591
|
+
} catch {
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
if (newer(raw, OWNER_VERSION))
|
|
595
|
+
return null;
|
|
596
|
+
const record = raw;
|
|
597
|
+
if (typeof record?.lang !== "string" || !Array.isArray(record.writes))
|
|
598
|
+
return null;
|
|
599
|
+
const writes = record.writes.filter((entry) => KINDS.includes(entry.kind) && typeof entry.key === "string" && typeof entry.value === "string" && (entry.prior === null || typeof entry.prior === "string"));
|
|
600
|
+
return { lang: record.lang, writes };
|
|
601
|
+
}
|
|
602
|
+
function readOwned() {
|
|
603
|
+
try {
|
|
604
|
+
return parseOwned(webStorage("session")?.getItem(OWNER_KEY) ?? null);
|
|
605
|
+
} catch {
|
|
606
|
+
return null;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
function writeOwned(owned) {
|
|
610
|
+
try {
|
|
611
|
+
const session = webStorage("session");
|
|
612
|
+
session?.setItem(OWNER_KEY, JSON.stringify(stamped(owned, OWNER_VERSION)));
|
|
613
|
+
return session !== null;
|
|
614
|
+
} catch {
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function clearOwned() {
|
|
619
|
+
try {
|
|
620
|
+
webStorage("session")?.removeItem(OWNER_KEY);
|
|
621
|
+
} catch {}
|
|
622
|
+
}
|
|
623
|
+
function parseReload(text) {
|
|
624
|
+
if (!text)
|
|
625
|
+
return 0;
|
|
626
|
+
let raw;
|
|
627
|
+
try {
|
|
628
|
+
raw = JSON.parse(text);
|
|
629
|
+
} catch {
|
|
630
|
+
return 0;
|
|
631
|
+
}
|
|
632
|
+
if (typeof raw === "number")
|
|
633
|
+
return raw;
|
|
634
|
+
if (typeof raw !== "object" || raw === null || newer(raw, RELOAD_VERSION))
|
|
635
|
+
return 0;
|
|
636
|
+
const at = Reflect.get(raw, "at");
|
|
637
|
+
return typeof at === "number" ? at : 0;
|
|
638
|
+
}
|
|
639
|
+
function reloadWait() {
|
|
640
|
+
try {
|
|
641
|
+
const session = webStorage("session");
|
|
642
|
+
if (!session)
|
|
643
|
+
return Infinity;
|
|
644
|
+
const previous = parseReload(session.getItem(RELOAD_KEY));
|
|
645
|
+
if (!(previous > 0))
|
|
646
|
+
return 0;
|
|
647
|
+
return Math.min(RELOAD_THROTTLE, Math.max(0, previous + RELOAD_THROTTLE - realNow()));
|
|
648
|
+
} catch {
|
|
649
|
+
return Infinity;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function reloadBlocked() {
|
|
653
|
+
return reloadWait() > 0;
|
|
654
|
+
}
|
|
655
|
+
var leaving = false;
|
|
656
|
+
function reloading() {
|
|
657
|
+
return leaving;
|
|
658
|
+
}
|
|
659
|
+
function reloadOnce() {
|
|
660
|
+
try {
|
|
661
|
+
const record = stamped({ at: realNow() }, RELOAD_VERSION);
|
|
662
|
+
const session = webStorage("session");
|
|
663
|
+
if (!session)
|
|
664
|
+
return false;
|
|
665
|
+
session.setItem(RELOAD_KEY, JSON.stringify(record));
|
|
666
|
+
} catch {
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
669
|
+
ownReload();
|
|
670
|
+
keepOwn();
|
|
671
|
+
leaving = true;
|
|
672
|
+
window.location.reload();
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
function restoreStores(owned) {
|
|
676
|
+
let restored = false;
|
|
677
|
+
const kept = [];
|
|
678
|
+
for (const entry of owned.writes) {
|
|
679
|
+
if (unreachable(entry)) {
|
|
680
|
+
kept.push(entry);
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
if (readStore(entry) !== entry.value)
|
|
684
|
+
continue;
|
|
685
|
+
writeStore(entry, entry.prior);
|
|
686
|
+
if (readStore(entry) === entry.prior)
|
|
687
|
+
restored = true;
|
|
688
|
+
else
|
|
689
|
+
kept.push(entry);
|
|
690
|
+
}
|
|
691
|
+
if (kept.length === 0)
|
|
692
|
+
clearOwned();
|
|
693
|
+
else if (!writeOwned({ lang: owned.lang, writes: kept }))
|
|
694
|
+
return false;
|
|
695
|
+
return restored;
|
|
696
|
+
}
|
|
697
|
+
function syncStores(lang) {
|
|
698
|
+
if (typeof document === "undefined")
|
|
699
|
+
return false;
|
|
700
|
+
if (reloadBlocked())
|
|
701
|
+
return false;
|
|
702
|
+
const owned = readOwned();
|
|
703
|
+
if (lang === null)
|
|
704
|
+
return owned !== null && restoreStores(owned) && reloadOnce();
|
|
705
|
+
if (owned?.lang === lang)
|
|
706
|
+
return false;
|
|
707
|
+
const writes = [];
|
|
708
|
+
let changed = false;
|
|
709
|
+
for (const adapter of ADAPTERS) {
|
|
710
|
+
const previous = owned?.writes.find((entry) => entry.kind === adapter.kind && entry.key === adapter.key);
|
|
711
|
+
if (previous !== undefined && unreachable(adapter)) {
|
|
712
|
+
writes.push(previous);
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
const current = readStore(adapter);
|
|
716
|
+
const ours = previous !== undefined && current === previous.value;
|
|
717
|
+
if (!ours && !adapter.used(current !== null))
|
|
718
|
+
continue;
|
|
719
|
+
if (current === lang) {
|
|
720
|
+
if (ours)
|
|
721
|
+
writes.push(previous);
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
writeStore(adapter, lang);
|
|
725
|
+
const prior = ours ? previous.prior : current;
|
|
726
|
+
if (readStore(adapter) === lang) {
|
|
727
|
+
writes.push({ kind: adapter.kind, key: adapter.key, prior, value: lang });
|
|
728
|
+
changed = true;
|
|
729
|
+
} else if (ours)
|
|
730
|
+
writes.push(previous);
|
|
731
|
+
}
|
|
732
|
+
if (!changed) {
|
|
733
|
+
if (owned && writes.length > 0)
|
|
734
|
+
writeOwned({ lang: owned.lang, writes });
|
|
735
|
+
else
|
|
736
|
+
clearOwned();
|
|
737
|
+
return false;
|
|
738
|
+
}
|
|
739
|
+
if (!writeOwned({ lang, writes }))
|
|
740
|
+
return false;
|
|
741
|
+
return reloadOnce();
|
|
742
|
+
}
|
|
743
|
+
var retry = 0;
|
|
744
|
+
function retrying() {
|
|
745
|
+
return retry !== 0;
|
|
746
|
+
}
|
|
747
|
+
function cancelRetry() {
|
|
748
|
+
if (!retry)
|
|
749
|
+
return;
|
|
750
|
+
window.clearTimeout(retry);
|
|
751
|
+
retry = 0;
|
|
752
|
+
}
|
|
753
|
+
function settle() {
|
|
754
|
+
cancelRetry();
|
|
755
|
+
if (readOwned() === null)
|
|
756
|
+
return;
|
|
757
|
+
const wait = reloadWait();
|
|
758
|
+
if (wait === 0)
|
|
759
|
+
syncStores(null);
|
|
760
|
+
else if (Number.isFinite(wait))
|
|
761
|
+
retry = window.setTimeout(settle, wait);
|
|
762
|
+
}
|
|
763
|
+
var captured = false;
|
|
764
|
+
var appliedLang = null;
|
|
765
|
+
var originalLang = null;
|
|
766
|
+
var originalDir = null;
|
|
767
|
+
var languageDescriptor;
|
|
768
|
+
var languagesDescriptor;
|
|
769
|
+
var navigatorPatched = false;
|
|
770
|
+
var held = { lang: null, dir: null };
|
|
771
|
+
var holder = null;
|
|
772
|
+
var holdWindow = 0;
|
|
773
|
+
var holdCount = 0;
|
|
774
|
+
function setAttribute(name, value) {
|
|
775
|
+
const root = document.documentElement;
|
|
776
|
+
if (root.getAttribute(name) === value)
|
|
777
|
+
return;
|
|
778
|
+
if (value === null)
|
|
779
|
+
root.removeAttribute(name);
|
|
780
|
+
else
|
|
781
|
+
root.setAttribute(name, value);
|
|
782
|
+
}
|
|
783
|
+
function restoreHeld() {
|
|
784
|
+
const now2 = realNow();
|
|
785
|
+
if (now2 - holdWindow >= 1000) {
|
|
786
|
+
holdWindow = now2;
|
|
787
|
+
holdCount = 0;
|
|
788
|
+
}
|
|
789
|
+
for (const name of ["lang", "dir"]) {
|
|
790
|
+
const value = held[name];
|
|
791
|
+
if (value === null || document.documentElement.getAttribute(name) === value)
|
|
792
|
+
continue;
|
|
793
|
+
if (++holdCount > HOLD_BUDGET) {
|
|
794
|
+
holder?.disconnect();
|
|
795
|
+
holder = null;
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
setAttribute(name, value);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
function hold(lang, dir) {
|
|
802
|
+
held.lang = lang;
|
|
803
|
+
held.dir = dir;
|
|
804
|
+
if (lang === null && dir === null) {
|
|
805
|
+
holder?.disconnect();
|
|
806
|
+
holder = null;
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
if (holder || typeof MutationObserver === "undefined")
|
|
810
|
+
return;
|
|
811
|
+
holder = new MutationObserver(restoreHeld);
|
|
812
|
+
holder.observe(document.documentElement, {
|
|
813
|
+
attributes: true,
|
|
814
|
+
attributeFilter: ["lang", "dir"]
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
function patchNavigator(lang) {
|
|
818
|
+
if (!navigatorPatched) {
|
|
819
|
+
languageDescriptor = Object.getOwnPropertyDescriptor(Navigator.prototype, "language");
|
|
820
|
+
languagesDescriptor = Object.getOwnPropertyDescriptor(Navigator.prototype, "languages");
|
|
821
|
+
navigatorPatched = true;
|
|
822
|
+
}
|
|
823
|
+
const languages = Object.freeze(languagesFor(lang));
|
|
824
|
+
Object.defineProperty(Navigator.prototype, "language", {
|
|
825
|
+
configurable: true,
|
|
826
|
+
get: () => lang
|
|
827
|
+
});
|
|
828
|
+
Object.defineProperty(Navigator.prototype, "languages", {
|
|
829
|
+
configurable: true,
|
|
830
|
+
get: () => languages
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
function restoreNavigator() {
|
|
834
|
+
if (!navigatorPatched)
|
|
835
|
+
return;
|
|
836
|
+
if (languageDescriptor)
|
|
837
|
+
Object.defineProperty(Navigator.prototype, "language", languageDescriptor);
|
|
838
|
+
else
|
|
839
|
+
Reflect.deleteProperty(Navigator.prototype, "language");
|
|
840
|
+
if (languagesDescriptor) {
|
|
841
|
+
Object.defineProperty(Navigator.prototype, "languages", languagesDescriptor);
|
|
842
|
+
} else
|
|
843
|
+
Reflect.deleteProperty(Navigator.prototype, "languages");
|
|
844
|
+
navigatorPatched = false;
|
|
845
|
+
}
|
|
846
|
+
function apply7(value) {
|
|
847
|
+
if (!captured) {
|
|
848
|
+
originalLang = document.documentElement.getAttribute("lang");
|
|
849
|
+
originalDir = document.documentElement.getAttribute("dir");
|
|
850
|
+
captured = true;
|
|
851
|
+
}
|
|
852
|
+
if (!value.lang || value.lang === "system") {
|
|
853
|
+
reset6();
|
|
854
|
+
if (value.dir !== "system") {
|
|
855
|
+
captured = true;
|
|
856
|
+
setAttribute("dir", value.dir);
|
|
857
|
+
hold(null, value.dir);
|
|
858
|
+
}
|
|
859
|
+
settle();
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
cancelRetry();
|
|
863
|
+
setAttribute("lang", value.lang);
|
|
864
|
+
setAttribute("dir", dirFor(value));
|
|
865
|
+
hold(value.lang, dirFor(value));
|
|
866
|
+
patchNavigator(value.lang);
|
|
867
|
+
setDefaultLocale(value.lang);
|
|
868
|
+
window.dispatchEvent(new Event("languagechange"));
|
|
869
|
+
if (value.lang !== appliedLang && readOwned()?.lang !== value.lang) {
|
|
870
|
+
if (reloadBlocked())
|
|
871
|
+
return;
|
|
872
|
+
syncStores(value.lang);
|
|
873
|
+
}
|
|
874
|
+
appliedLang = value.lang;
|
|
875
|
+
}
|
|
876
|
+
function reset6() {
|
|
877
|
+
cancelRetry();
|
|
878
|
+
appliedLang = null;
|
|
879
|
+
hold(null, null);
|
|
880
|
+
setDefaultLocale(null);
|
|
881
|
+
if (captured) {
|
|
882
|
+
setAttribute("lang", originalLang);
|
|
883
|
+
setAttribute("dir", originalDir);
|
|
884
|
+
captured = false;
|
|
885
|
+
}
|
|
886
|
+
if (navigatorPatched) {
|
|
887
|
+
restoreNavigator();
|
|
888
|
+
window.dispatchEvent(new Event("languagechange"));
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// src/engine/time.ts
|
|
893
|
+
var TIME_ZONE_PRESETS = [
|
|
894
|
+
"UTC",
|
|
895
|
+
"America/Los_Angeles",
|
|
896
|
+
"America/New_York",
|
|
897
|
+
"Europe/London",
|
|
898
|
+
"Europe/Istanbul",
|
|
899
|
+
"Asia/Kolkata",
|
|
900
|
+
"Asia/Kathmandu",
|
|
901
|
+
"Asia/Tokyo",
|
|
902
|
+
"Australia/Lord_Howe"
|
|
903
|
+
];
|
|
904
|
+
var NativeDateTimeFormat = Intl.DateTimeFormat;
|
|
905
|
+
var dateMethods = NativeDate.prototype;
|
|
906
|
+
var nativeGetTime = NativeDate.prototype.getTime;
|
|
907
|
+
var nativeSetTime = NativeDate.prototype.setTime;
|
|
908
|
+
var nativeHostOffset = NativeDate.prototype.getTimezoneOffset;
|
|
909
|
+
var nativeParse = NativeDate.parse;
|
|
910
|
+
var nativeUTC = NativeDate.UTC;
|
|
911
|
+
var MINUTE = 60000;
|
|
912
|
+
var DAY = 86400000;
|
|
913
|
+
var canonicalZones = new Map;
|
|
914
|
+
function canonicalZone(zone) {
|
|
915
|
+
let canonical = canonicalZones.get(zone);
|
|
916
|
+
if (canonical === undefined) {
|
|
917
|
+
try {
|
|
918
|
+
canonical = new NativeDateTimeFormat("en-US", { timeZone: zone }).resolvedOptions().timeZone;
|
|
919
|
+
} catch {
|
|
920
|
+
canonical = null;
|
|
921
|
+
}
|
|
922
|
+
canonicalZones.set(zone, canonical);
|
|
923
|
+
}
|
|
924
|
+
return canonical;
|
|
925
|
+
}
|
|
926
|
+
function resolveTimeZone(value, geo) {
|
|
927
|
+
if (value === "system")
|
|
928
|
+
return null;
|
|
929
|
+
const zone = value === "geo" ? resolveGeo(geo)?.timeZone : value;
|
|
930
|
+
return zone ? canonicalZone(zone) : null;
|
|
931
|
+
}
|
|
932
|
+
var offsetFormats = new Map;
|
|
933
|
+
function offsetFormat(zone) {
|
|
934
|
+
let format = offsetFormats.get(zone);
|
|
935
|
+
if (format === undefined) {
|
|
936
|
+
try {
|
|
937
|
+
format = new NativeDateTimeFormat("en-US", { timeZone: zone, timeZoneName: "longOffset" });
|
|
938
|
+
} catch {
|
|
939
|
+
format = null;
|
|
940
|
+
}
|
|
941
|
+
offsetFormats.set(zone, format);
|
|
942
|
+
}
|
|
943
|
+
return format;
|
|
944
|
+
}
|
|
945
|
+
function zoneNamePart(format, time) {
|
|
946
|
+
const clamped = Math.min(Math.max(time, -8640000000000000), 8640000000000000);
|
|
947
|
+
return format.formatToParts(clamped).find((part) => part.type === "timeZoneName")?.value ?? "";
|
|
948
|
+
}
|
|
949
|
+
function zoneOffset(time, zone) {
|
|
950
|
+
const format = offsetFormat(zone);
|
|
951
|
+
if (!format || !Number.isFinite(time))
|
|
952
|
+
return 0;
|
|
953
|
+
const match = /GMT([+-])(\d{1,2})(?::?(\d{2}))?(?::?(\d{2}))?/.exec(zoneNamePart(format, time));
|
|
954
|
+
if (!match)
|
|
955
|
+
return 0;
|
|
956
|
+
const sign = match[1] === "+" ? 1 : -1;
|
|
957
|
+
const seconds = Number(match[2]) * 3600 + Number(match[3] ?? 0) * 60 + Number(match[4] ?? 0);
|
|
958
|
+
return sign * seconds * 1000;
|
|
959
|
+
}
|
|
960
|
+
function offsetMinutes(offset) {
|
|
961
|
+
const minutes = Math.trunc(-offset / MINUTE);
|
|
962
|
+
return minutes === 0 ? 0 : minutes;
|
|
963
|
+
}
|
|
964
|
+
function fromWall(wall, zone) {
|
|
965
|
+
if (!Number.isFinite(wall))
|
|
966
|
+
return NaN;
|
|
967
|
+
const before = zoneOffset(wall - DAY, zone);
|
|
968
|
+
const after = zoneOffset(wall + DAY, zone);
|
|
969
|
+
let earliest = NaN;
|
|
970
|
+
for (const offset of before === after ? [before] : [before, after]) {
|
|
971
|
+
const time = wall - offset;
|
|
972
|
+
if (zoneOffset(time, zone) !== offset)
|
|
973
|
+
continue;
|
|
974
|
+
if (Number.isNaN(earliest) || time < earliest)
|
|
975
|
+
earliest = time;
|
|
976
|
+
}
|
|
977
|
+
return Number.isNaN(earliest) ? wall - before : earliest;
|
|
978
|
+
}
|
|
979
|
+
var FIELDS = [
|
|
980
|
+
"FullYear",
|
|
981
|
+
"Month",
|
|
982
|
+
"Date",
|
|
983
|
+
"Day",
|
|
984
|
+
"Hours",
|
|
985
|
+
"Minutes",
|
|
986
|
+
"Seconds",
|
|
987
|
+
"Milliseconds"
|
|
988
|
+
];
|
|
989
|
+
var utcGet = {};
|
|
990
|
+
var utcSet = {};
|
|
991
|
+
for (const field of FIELDS) {
|
|
992
|
+
utcGet[field] = dateMethods[`getUTC${field}`];
|
|
993
|
+
if (field !== "Day")
|
|
994
|
+
utcSet[field] = dateMethods[`setUTC${field}`];
|
|
995
|
+
}
|
|
996
|
+
var scratch = new NativeDate(0);
|
|
997
|
+
function clock(wall) {
|
|
998
|
+
nativeSetTime.call(scratch, wall);
|
|
999
|
+
return (field) => utcGet[field].call(scratch);
|
|
1000
|
+
}
|
|
1001
|
+
var offsetCache = new Map;
|
|
1002
|
+
var OFFSET_CACHE_SIZE = 1000;
|
|
1003
|
+
function localOffset(time, zone) {
|
|
1004
|
+
let offset = offsetCache.get(time);
|
|
1005
|
+
if (offset === undefined) {
|
|
1006
|
+
if (offsetCache.size >= OFFSET_CACHE_SIZE)
|
|
1007
|
+
offsetCache.clear();
|
|
1008
|
+
offset = zoneOffset(time, zone);
|
|
1009
|
+
offsetCache.set(time, offset);
|
|
1010
|
+
}
|
|
1011
|
+
return offset;
|
|
1012
|
+
}
|
|
1013
|
+
function wallOf(date, zone) {
|
|
1014
|
+
const time = nativeGetTime.call(date);
|
|
1015
|
+
return time + localOffset(time, zone);
|
|
1016
|
+
}
|
|
1017
|
+
function rewrite(date, zone, fromZero, write) {
|
|
1018
|
+
const time = nativeGetTime.call(date);
|
|
1019
|
+
nativeSetTime.call(scratch, Number.isNaN(time) && fromZero ? 0 : time + localOffset(time, zone));
|
|
1020
|
+
write();
|
|
1021
|
+
return nativeSetTime.call(date, fromWall(nativeGetTime.call(scratch), zone));
|
|
1022
|
+
}
|
|
1023
|
+
var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
1024
|
+
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
1025
|
+
function pad(value, length = 2) {
|
|
1026
|
+
return String(value).padStart(length, "0");
|
|
1027
|
+
}
|
|
1028
|
+
function dateString(wall) {
|
|
1029
|
+
const read = clock(wall);
|
|
1030
|
+
const year = read("FullYear");
|
|
1031
|
+
const day = `${WEEKDAYS[read("Day")]} ${MONTHS[read("Month")]} ${pad(read("Date"))}`;
|
|
1032
|
+
return `${day} ${year < 0 ? "-" : ""}${pad(Math.abs(year), 4)}`;
|
|
1033
|
+
}
|
|
1034
|
+
var nameFormats = new Map;
|
|
1035
|
+
function seasons(time) {
|
|
1036
|
+
const year = new NativeDate(time).getUTCFullYear();
|
|
1037
|
+
return [nativeUTC(year, 0, 1), nativeUTC(year, 6, 1)];
|
|
1038
|
+
}
|
|
1039
|
+
function zoneName(time, zone) {
|
|
1040
|
+
let format = nameFormats.get(zone);
|
|
1041
|
+
if (!format) {
|
|
1042
|
+
format = new NativeDateTimeFormat(undefined, { timeZone: zone, timeZoneName: "long" });
|
|
1043
|
+
nameFormats.set(zone, format);
|
|
1044
|
+
}
|
|
1045
|
+
const [january, july] = seasons(time);
|
|
1046
|
+
const offset = zoneOffset(time, zone);
|
|
1047
|
+
const daylight = offset > Math.min(zoneOffset(january, zone), zoneOffset(july, zone));
|
|
1048
|
+
let [standard, summer] = seasons(NativeDate.now());
|
|
1049
|
+
if (zoneOffset(standard, zone) > zoneOffset(summer, zone)) {
|
|
1050
|
+
[standard, summer] = [summer, standard];
|
|
1051
|
+
}
|
|
1052
|
+
if (!daylight)
|
|
1053
|
+
return zoneNamePart(format, standard);
|
|
1054
|
+
const daylightLeft = zoneOffset(summer, zone) !== zoneOffset(standard, zone);
|
|
1055
|
+
return zoneNamePart(format, daylightLeft ? summer : time);
|
|
1056
|
+
}
|
|
1057
|
+
function timeString(time, wall, zone) {
|
|
1058
|
+
const read = clock(wall);
|
|
1059
|
+
const minutes = Math.floor(Math.abs(wall - time) / MINUTE);
|
|
1060
|
+
const offset = `${wall < time ? "-" : "+"}${pad(Math.floor(minutes / 60))}${pad(minutes % 60)}`;
|
|
1061
|
+
const name = zoneName(time, zone);
|
|
1062
|
+
const hms = `${pad(read("Hours"))}:${pad(read("Minutes"))}:${pad(read("Seconds"))}`;
|
|
1063
|
+
return `${hms} GMT${offset}${name ? ` (${name})` : ""}`;
|
|
1064
|
+
}
|
|
1065
|
+
var STRINGS = [
|
|
1066
|
+
["toString", (time, wall, zone) => `${dateString(wall)} ${timeString(time, wall, zone)}`],
|
|
1067
|
+
["toDateString", (_time, wall) => dateString(wall)],
|
|
1068
|
+
["toTimeString", timeString]
|
|
1069
|
+
];
|
|
1070
|
+
var ISO_DATE = /^[+-]?\d{4,6}(?:-\d{2}(?:-\d{2})?)?$/;
|
|
1071
|
+
var ISO_DATE_TIME = /^[+-]?\d{4,6}(?:-\d{2}(?:-\d{2})?)?T\d{2}:\d{2}/i;
|
|
1072
|
+
var NAMED_ZONE = /\dZ\s*$|\b(?:UTC?|GMT|[ECMP][SD]T)\b|\d:\d{2}(?::\d{2}(?:[.,]\d+)?)?\s*(?:[AP]\.?M\.?\s*)?[+-]\d{1,2}(?::?\d{2})?\b/i;
|
|
1073
|
+
function wallOfString(text, hostTime) {
|
|
1074
|
+
for (const suffix of ISO_DATE_TIME.test(text) ? ["Z", " UTC"] : [" UTC", "Z"]) {
|
|
1075
|
+
const wall = nativeParse(text + suffix);
|
|
1076
|
+
if (!Number.isNaN(wall))
|
|
1077
|
+
return wall;
|
|
1078
|
+
}
|
|
1079
|
+
return hostTime - nativeHostOffset.call(new NativeDate(hostTime)) * MINUTE;
|
|
1080
|
+
}
|
|
1081
|
+
var zone = null;
|
|
1082
|
+
var timePatched = false;
|
|
1083
|
+
function parse(value) {
|
|
1084
|
+
const text = String(value);
|
|
1085
|
+
const time = nativeParse(text);
|
|
1086
|
+
if (!zone || Number.isNaN(time) || ISO_DATE.test(text.trim()) || NAMED_ZONE.test(text)) {
|
|
1087
|
+
return time;
|
|
1088
|
+
}
|
|
1089
|
+
return fromWall(wallOfString(text, time), zone);
|
|
1090
|
+
}
|
|
1091
|
+
function localArgs(args, zone2) {
|
|
1092
|
+
if (args.length === 0)
|
|
1093
|
+
return args;
|
|
1094
|
+
if (args.length === 1)
|
|
1095
|
+
return typeof args[0] === "string" ? [parse(args[0])] : args;
|
|
1096
|
+
return [fromWall(Reflect.apply(nativeUTC, NativeDate, args), zone2)];
|
|
1097
|
+
}
|
|
1098
|
+
var ZONE = {
|
|
1099
|
+
on: () => zone !== null,
|
|
1100
|
+
args: (args) => zone ? localArgs(args, zone) : args,
|
|
1101
|
+
parse
|
|
1102
|
+
};
|
|
1103
|
+
function withTimeZone(options) {
|
|
1104
|
+
if (!zone)
|
|
1105
|
+
return options;
|
|
1106
|
+
if (options?.timeZone)
|
|
1107
|
+
return options;
|
|
1108
|
+
return { ...options ?? {}, timeZone: zone };
|
|
1109
|
+
}
|
|
1110
|
+
var installed = [];
|
|
1111
|
+
function install2(target, key, make) {
|
|
1112
|
+
if (!Object.getOwnPropertyDescriptor(target, key))
|
|
1113
|
+
return;
|
|
1114
|
+
const original = underLocale(Reflect.get(target, key));
|
|
1115
|
+
if (typeof original !== "function")
|
|
1116
|
+
return;
|
|
1117
|
+
const value = make(original);
|
|
1118
|
+
if (Reflect.set(target, key, value))
|
|
1119
|
+
installed.push({ target, key, original, value });
|
|
1120
|
+
}
|
|
1121
|
+
function patchTime() {
|
|
1122
|
+
if (timePatched)
|
|
1123
|
+
return;
|
|
1124
|
+
timePatched = true;
|
|
1125
|
+
for (const field of FIELDS) {
|
|
1126
|
+
install2(dateMethods, `get${field}`, (original) => function() {
|
|
1127
|
+
if (!zone)
|
|
1128
|
+
return original.call(this);
|
|
1129
|
+
return clock(wallOf(this, zone))(field);
|
|
1130
|
+
});
|
|
1131
|
+
if (field === "Day")
|
|
1132
|
+
continue;
|
|
1133
|
+
install2(dateMethods, `set${field}`, (original) => function(...args) {
|
|
1134
|
+
if (!zone)
|
|
1135
|
+
return original.apply(this, args);
|
|
1136
|
+
return rewrite(this, zone, field === "FullYear", () => utcSet[field].apply(scratch, args));
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
install2(dateMethods, "getTimezoneOffset", (original) => function() {
|
|
1140
|
+
if (!zone)
|
|
1141
|
+
return original.call(this);
|
|
1142
|
+
const time = nativeGetTime.call(this);
|
|
1143
|
+
if (Number.isNaN(time))
|
|
1144
|
+
return NaN;
|
|
1145
|
+
return offsetMinutes(localOffset(time, zone));
|
|
1146
|
+
});
|
|
1147
|
+
install2(dateMethods, "getYear", (original) => function() {
|
|
1148
|
+
if (!zone)
|
|
1149
|
+
return original.call(this);
|
|
1150
|
+
return clock(wallOf(this, zone))("FullYear") - 1900;
|
|
1151
|
+
});
|
|
1152
|
+
install2(dateMethods, "setYear", (original) => function(year) {
|
|
1153
|
+
if (!zone)
|
|
1154
|
+
return original.call(this, year);
|
|
1155
|
+
return rewrite(this, zone, true, () => {
|
|
1156
|
+
const value = Number(year);
|
|
1157
|
+
const whole = Math.trunc(value);
|
|
1158
|
+
utcSet.FullYear.call(scratch, whole >= 0 && whole <= 99 ? 1900 + whole : value);
|
|
1159
|
+
});
|
|
1160
|
+
});
|
|
1161
|
+
for (const [key, format] of STRINGS) {
|
|
1162
|
+
install2(dateMethods, key, (original) => function() {
|
|
1163
|
+
if (!zone)
|
|
1164
|
+
return original.call(this);
|
|
1165
|
+
const time = nativeGetTime.call(this);
|
|
1166
|
+
if (Number.isNaN(time))
|
|
1167
|
+
return "Invalid Date";
|
|
1168
|
+
return format(time, time + localOffset(time, zone), zone);
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
for (const key of ["toLocaleString", "toLocaleDateString", "toLocaleTimeString"]) {
|
|
1172
|
+
install2(dateMethods, key, (original) => function(locales, options) {
|
|
1173
|
+
return original.call(this, locales, withTimeZone(options));
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
install2(globalThis, "Date", (original) => wrapDate(original, ZONE));
|
|
1177
|
+
install2(dateMethods, "constructor", () => globalThis.Date);
|
|
1178
|
+
install2(Intl, "DateTimeFormat", (original) => new Proxy(original, {
|
|
1179
|
+
construct(target, args, newTarget) {
|
|
1180
|
+
const [locales, options] = args;
|
|
1181
|
+
return Reflect.construct(target, [locales, withTimeZone(options)], newTarget);
|
|
1182
|
+
},
|
|
1183
|
+
apply(target, thisArg, args) {
|
|
1184
|
+
const [locales, options] = args;
|
|
1185
|
+
return Reflect.apply(target, thisArg, [
|
|
1186
|
+
locales,
|
|
1187
|
+
withTimeZone(options)
|
|
1188
|
+
]);
|
|
1189
|
+
}
|
|
1190
|
+
}));
|
|
1191
|
+
const now2 = temporalNow();
|
|
1192
|
+
if (!now2)
|
|
1193
|
+
return;
|
|
1194
|
+
install2(now2, "timeZoneId", (original) => function() {
|
|
1195
|
+
return zone ?? original.call(this);
|
|
1196
|
+
});
|
|
1197
|
+
for (const key of NOW_READERS) {
|
|
1198
|
+
install2(now2, key, (original) => readNow(key, original, (timeZone) => timeZone === undefined && zone ? zone : timeZone));
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function restoreTime() {
|
|
1202
|
+
if (!timePatched)
|
|
1203
|
+
return;
|
|
1204
|
+
for (const { target, key, original, value } of installed.reverse()) {
|
|
1205
|
+
if (underLocale(Reflect.get(target, key)) !== value)
|
|
1206
|
+
continue;
|
|
1207
|
+
Reflect.set(target, key, original);
|
|
1208
|
+
}
|
|
1209
|
+
installed = [];
|
|
1210
|
+
timePatched = false;
|
|
1211
|
+
}
|
|
1212
|
+
function apply8(value, clock2) {
|
|
1213
|
+
takeOver();
|
|
1214
|
+
const next = value ? canonicalZone(value) : null;
|
|
1215
|
+
if (next !== zone)
|
|
1216
|
+
offsetCache.clear();
|
|
1217
|
+
zone = next;
|
|
1218
|
+
setClock(clock2 ?? null);
|
|
1219
|
+
if (!zone && !clockOn()) {
|
|
1220
|
+
restoreTime();
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
patchTime();
|
|
1224
|
+
}
|
|
1225
|
+
function reset7() {
|
|
1226
|
+
zone = null;
|
|
1227
|
+
setClock(null);
|
|
1228
|
+
offsetCache.clear();
|
|
1229
|
+
restoreTime();
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
// src/grab/hit.ts
|
|
1233
|
+
var MAX_DEPTH = 32;
|
|
1234
|
+
var MAX_LAYERS = 8;
|
|
1235
|
+
var REPLACED = new Set([
|
|
1236
|
+
"audio",
|
|
1237
|
+
"br",
|
|
1238
|
+
"canvas",
|
|
1239
|
+
"embed",
|
|
1240
|
+
"hr",
|
|
1241
|
+
"iframe",
|
|
1242
|
+
"img",
|
|
1243
|
+
"input",
|
|
1244
|
+
"meter",
|
|
1245
|
+
"object",
|
|
1246
|
+
"progress",
|
|
1247
|
+
"select",
|
|
1248
|
+
"svg",
|
|
1249
|
+
"textarea",
|
|
1250
|
+
"video"
|
|
1251
|
+
]);
|
|
1252
|
+
var CLEAR_COLOR = /^transparent$|[,/]\s*0\)$/;
|
|
1253
|
+
function composedParent(element) {
|
|
1254
|
+
if (element.parentElement)
|
|
1255
|
+
return element.parentElement;
|
|
1256
|
+
const root = element.getRootNode?.();
|
|
1257
|
+
return root && "host" in root ? root.host : null;
|
|
1258
|
+
}
|
|
1259
|
+
function isDevknobs(element) {
|
|
1260
|
+
for (let current = element;current; current = composedParent(current)) {
|
|
1261
|
+
if (current.hasAttribute("data-devknobs"))
|
|
1262
|
+
return true;
|
|
1263
|
+
}
|
|
1264
|
+
return false;
|
|
1265
|
+
}
|
|
1266
|
+
function isRoot(element) {
|
|
1267
|
+
const tag2 = element.tagName.toLowerCase();
|
|
1268
|
+
return tag2 === "html" || tag2 === "body";
|
|
1269
|
+
}
|
|
1270
|
+
function isGrabbable(element) {
|
|
1271
|
+
return element !== null && !isRoot(element) && !isDevknobs(element);
|
|
1272
|
+
}
|
|
1273
|
+
function styleOf(element) {
|
|
1274
|
+
return element.ownerDocument.defaultView?.getComputedStyle(element) ?? null;
|
|
1275
|
+
}
|
|
1276
|
+
function inside(rect, x, y) {
|
|
1277
|
+
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
|
1278
|
+
}
|
|
1279
|
+
function holds(element, x, y) {
|
|
1280
|
+
if (!inside(element.getBoundingClientRect(), x, y))
|
|
1281
|
+
return false;
|
|
1282
|
+
const rects = element.getClientRects();
|
|
1283
|
+
for (let index = 0;index < rects.length; index++) {
|
|
1284
|
+
const rect = rects[index];
|
|
1285
|
+
if (rect && rect.width > 0 && rect.height > 0 && inside(rect, x, y))
|
|
1286
|
+
return true;
|
|
1287
|
+
}
|
|
1288
|
+
return false;
|
|
1289
|
+
}
|
|
1290
|
+
function area(element) {
|
|
1291
|
+
const rect = element.getBoundingClientRect();
|
|
1292
|
+
return rect.width * rect.height;
|
|
1293
|
+
}
|
|
1294
|
+
function isHidden(element) {
|
|
1295
|
+
const visibility = styleOf(element)?.visibility;
|
|
1296
|
+
return visibility !== undefined && visibility !== "visible";
|
|
1297
|
+
}
|
|
1298
|
+
function isClearLayer(element) {
|
|
1299
|
+
if (element.children.length > 0 || element.shadowRoot)
|
|
1300
|
+
return false;
|
|
1301
|
+
if (REPLACED.has(element.tagName.toLowerCase()) || element.textContent?.trim())
|
|
1302
|
+
return false;
|
|
1303
|
+
const style = styleOf(element);
|
|
1304
|
+
if (!style)
|
|
1305
|
+
return false;
|
|
1306
|
+
return style.backgroundImage === "none" && CLEAR_COLOR.test(style.backgroundColor);
|
|
1307
|
+
}
|
|
1308
|
+
function under(root, top, x, y) {
|
|
1309
|
+
if (!root.elementsFromPoint || holds(top, x, y) && !isClearLayer(top))
|
|
1310
|
+
return top;
|
|
1311
|
+
for (const element of root.elementsFromPoint(x, y).slice(0, MAX_LAYERS)) {
|
|
1312
|
+
if (element === top || !isGrabbable(element))
|
|
1313
|
+
continue;
|
|
1314
|
+
if (holds(element, x, y) && !isClearLayer(element))
|
|
1315
|
+
return element;
|
|
1316
|
+
}
|
|
1317
|
+
return top;
|
|
1318
|
+
}
|
|
1319
|
+
function descend(start, x, y) {
|
|
1320
|
+
let current = start;
|
|
1321
|
+
for (let depth = 0;depth < MAX_DEPTH; depth += 1) {
|
|
1322
|
+
let best = null;
|
|
1323
|
+
let smallest = Number.POSITIVE_INFINITY;
|
|
1324
|
+
for (const children of [current.children, current.shadowRoot?.children]) {
|
|
1325
|
+
if (!children)
|
|
1326
|
+
continue;
|
|
1327
|
+
for (let index = 0;index < children.length; index++) {
|
|
1328
|
+
const child = children[index];
|
|
1329
|
+
if (!child || child.hasAttribute("data-devknobs") || !holds(child, x, y))
|
|
1330
|
+
continue;
|
|
1331
|
+
if (isHidden(child) || isClearLayer(child))
|
|
1332
|
+
continue;
|
|
1333
|
+
const size = area(child);
|
|
1334
|
+
if (size > smallest)
|
|
1335
|
+
continue;
|
|
1336
|
+
best = child;
|
|
1337
|
+
smallest = size;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
if (!best)
|
|
1341
|
+
break;
|
|
1342
|
+
current = best;
|
|
1343
|
+
}
|
|
1344
|
+
return current;
|
|
1345
|
+
}
|
|
1346
|
+
function deepElementAt(root, x, y) {
|
|
1347
|
+
let element = root.elementFromPoint(x, y);
|
|
1348
|
+
while (element?.shadowRoot) {
|
|
1349
|
+
const inner = element.shadowRoot.elementFromPoint(x, y);
|
|
1350
|
+
if (!inner || inner === element)
|
|
1351
|
+
break;
|
|
1352
|
+
element = inner;
|
|
1353
|
+
}
|
|
1354
|
+
if (!isGrabbable(element))
|
|
1355
|
+
return element;
|
|
1356
|
+
return descend(under(root, element, x, y), x, y);
|
|
1357
|
+
}
|
|
1358
|
+
function grabTargetAt(root, x, y) {
|
|
1359
|
+
const element = deepElementAt(root, x, y);
|
|
1360
|
+
return isGrabbable(element) ? element : null;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
// src/engine/touchpointer.ts
|
|
1364
|
+
var SLOP = 10;
|
|
1365
|
+
var VELOCITY_WINDOW = 100;
|
|
1366
|
+
var DECAY = 325;
|
|
1367
|
+
var MIN_FLING = 0.1;
|
|
1368
|
+
var STOP_FLING = 0.02;
|
|
1369
|
+
var CONTACT = 11.5;
|
|
1370
|
+
var HOVER = new Set([
|
|
1371
|
+
"pointermove",
|
|
1372
|
+
"pointerover",
|
|
1373
|
+
"pointerout",
|
|
1374
|
+
"pointerenter",
|
|
1375
|
+
"pointerleave",
|
|
1376
|
+
"mousemove",
|
|
1377
|
+
"mouseover",
|
|
1378
|
+
"mouseout",
|
|
1379
|
+
"mouseenter",
|
|
1380
|
+
"mouseleave"
|
|
1381
|
+
]);
|
|
1382
|
+
var CROSSING = new Set([
|
|
1383
|
+
"pointerover",
|
|
1384
|
+
"pointerout",
|
|
1385
|
+
"pointerenter",
|
|
1386
|
+
"pointerleave",
|
|
1387
|
+
"mouseover",
|
|
1388
|
+
"mouseout",
|
|
1389
|
+
"mouseenter",
|
|
1390
|
+
"mouseleave"
|
|
1391
|
+
]);
|
|
1392
|
+
var COMPAT = new Set(["mousemove", "mousedown", "mouseup"]);
|
|
1393
|
+
var EVENTS = [
|
|
1394
|
+
...HOVER,
|
|
1395
|
+
"pointerdown",
|
|
1396
|
+
"pointerup",
|
|
1397
|
+
"pointercancel",
|
|
1398
|
+
"mousedown",
|
|
1399
|
+
"mouseup",
|
|
1400
|
+
"click",
|
|
1401
|
+
"dragstart",
|
|
1402
|
+
"selectstart"
|
|
1403
|
+
];
|
|
1404
|
+
var CURSOR_CSS = '*:not([data-devknobs]){cursor:none!important}:where([data-devknobs]){cursor:auto}[data-devknobs="touch-pointer"]::backdrop{display:none!important}';
|
|
1405
|
+
var DRAG_CSS = "*{-webkit-user-select:none!important;user-select:none!important}";
|
|
1406
|
+
var DOT_CSS = `
|
|
1407
|
+
:host {
|
|
1408
|
+
all: initial !important;
|
|
1409
|
+
display: block !important;
|
|
1410
|
+
position: fixed !important;
|
|
1411
|
+
left: 0 !important;
|
|
1412
|
+
top: 0 !important;
|
|
1413
|
+
width: 0 !important;
|
|
1414
|
+
height: 0 !important;
|
|
1415
|
+
pointer-events: none !important;
|
|
1416
|
+
z-index: 2147483647 !important;
|
|
1417
|
+
}
|
|
1418
|
+
.dot {
|
|
1419
|
+
position: fixed;
|
|
1420
|
+
z-index: 2147483647;
|
|
1421
|
+
}
|
|
1422
|
+
${DOT_LOOK}`;
|
|
1423
|
+
function panOf(touchAction) {
|
|
1424
|
+
const words = touchAction.trim().toLowerCase().split(/\s+/);
|
|
1425
|
+
if (words.includes("none"))
|
|
1426
|
+
return { x: false, y: false };
|
|
1427
|
+
if (words[0] === "" || words.includes("auto") || words.includes("manipulation")) {
|
|
1428
|
+
return { x: true, y: true };
|
|
1429
|
+
}
|
|
1430
|
+
return {
|
|
1431
|
+
x: words.some((word) => word === "pan-x" || word === "pan-left" || word === "pan-right"),
|
|
1432
|
+
y: words.some((word) => word === "pan-y" || word === "pan-up" || word === "pan-down")
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
function pickScroller(chain, move) {
|
|
1436
|
+
const most = Math.max(Math.abs(move.x), Math.abs(move.y));
|
|
1437
|
+
if (most === 0)
|
|
1438
|
+
return null;
|
|
1439
|
+
const alongX = Math.abs(move.x) * 2 >= most;
|
|
1440
|
+
const alongY = Math.abs(move.y) * 2 >= most;
|
|
1441
|
+
let pan = { x: true, y: true };
|
|
1442
|
+
for (const [index, node] of chain.entries()) {
|
|
1443
|
+
const own = panOf(node.touchAction);
|
|
1444
|
+
pan = { x: pan.x && own.x, y: pan.y && own.y };
|
|
1445
|
+
if (!pan.x && !pan.y)
|
|
1446
|
+
return null;
|
|
1447
|
+
const x = pan.x && (node.left || node.right);
|
|
1448
|
+
const y = pan.y && (node.up || node.down);
|
|
1449
|
+
const goesX = x && alongX && (move.x < 0 ? node.left : node.right);
|
|
1450
|
+
const goesY = y && alongY && (move.y < 0 ? node.up : node.down);
|
|
1451
|
+
if (goesX || goesY)
|
|
1452
|
+
return { index, x, y };
|
|
1453
|
+
}
|
|
1454
|
+
return null;
|
|
1455
|
+
}
|
|
1456
|
+
function passedSlop(dx, dy, slop = SLOP) {
|
|
1457
|
+
return Math.hypot(dx, dy) > slop;
|
|
1458
|
+
}
|
|
1459
|
+
function velocityOf(samples, now2) {
|
|
1460
|
+
const last = samples[samples.length - 1];
|
|
1461
|
+
if (!last || now2 - last.t > VELOCITY_WINDOW)
|
|
1462
|
+
return { x: 0, y: 0 };
|
|
1463
|
+
const first = samples.find((sample) => sample.t >= last.t - VELOCITY_WINDOW) ?? last;
|
|
1464
|
+
const dt = last.t - first.t;
|
|
1465
|
+
if (dt <= 0)
|
|
1466
|
+
return { x: 0, y: 0 };
|
|
1467
|
+
return { x: (last.x - first.x) / dt, y: (last.y - first.y) / dt };
|
|
1468
|
+
}
|
|
1469
|
+
function flings(velocity) {
|
|
1470
|
+
return Math.hypot(velocity.x, velocity.y) >= MIN_FLING;
|
|
1471
|
+
}
|
|
1472
|
+
function inertiaStep(velocity, dt) {
|
|
1473
|
+
const factor = Math.exp(-dt / DECAY);
|
|
1474
|
+
const span = DECAY * (1 - factor);
|
|
1475
|
+
const next = { x: velocity.x * factor, y: velocity.y * factor };
|
|
1476
|
+
return {
|
|
1477
|
+
move: { x: velocity.x * span, y: velocity.y * span },
|
|
1478
|
+
velocity: next,
|
|
1479
|
+
done: Math.hypot(next.x, next.y) < STOP_FLING
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
function raises(change) {
|
|
1483
|
+
return !change.own && change.newState === "open" && change.tag.toLowerCase() !== "details";
|
|
1484
|
+
}
|
|
1485
|
+
function dialogOpened(change) {
|
|
1486
|
+
return change.tag.toLowerCase() === "dialog" && change.was === null && change.open;
|
|
1487
|
+
}
|
|
1488
|
+
function topLayerOf(path, inTopLayer) {
|
|
1489
|
+
return path.find(inTopLayer) ?? null;
|
|
1490
|
+
}
|
|
1491
|
+
var active = false;
|
|
1492
|
+
var paused = false;
|
|
1493
|
+
var native = false;
|
|
1494
|
+
var nativeTimer = 0;
|
|
1495
|
+
var mark = { at: null, pressed: false, held: false };
|
|
1496
|
+
var host = null;
|
|
1497
|
+
var dot = null;
|
|
1498
|
+
var dialogs = null;
|
|
1499
|
+
var over = null;
|
|
1500
|
+
var gesture = null;
|
|
1501
|
+
var nextId = 1;
|
|
1502
|
+
var finishTimer = 0;
|
|
1503
|
+
var fling = null;
|
|
1504
|
+
var flingFrame = 0;
|
|
1505
|
+
function touchable() {
|
|
1506
|
+
return typeof Touch === "function" && typeof TouchEvent === "function";
|
|
1507
|
+
}
|
|
1508
|
+
function rawPointer(event) {
|
|
1509
|
+
return event.isTrusted && typeof PointerEvent === "function" && event instanceof PointerEvent && event.pointerType === "mouse";
|
|
1510
|
+
}
|
|
1511
|
+
function fromDevknobs(event) {
|
|
1512
|
+
const target = event.composedPath()[0];
|
|
1513
|
+
return target instanceof Element && isDevknobs(target);
|
|
1514
|
+
}
|
|
1515
|
+
function isNative(element) {
|
|
1516
|
+
if (element instanceof HTMLElement && element.isContentEditable)
|
|
1517
|
+
return true;
|
|
1518
|
+
return element instanceof HTMLInputElement && element.type === "range";
|
|
1519
|
+
}
|
|
1520
|
+
function onScrollbar(element, event) {
|
|
1521
|
+
if (element.clientWidth === 0 && element.clientHeight === 0)
|
|
1522
|
+
return false;
|
|
1523
|
+
return event.offsetX > element.clientWidth || event.offsetY > element.clientHeight;
|
|
1524
|
+
}
|
|
1525
|
+
function handUp(next) {
|
|
1526
|
+
try {
|
|
1527
|
+
const owner = window.frameElement;
|
|
1528
|
+
if (!owner || typeof CustomEvent !== "function")
|
|
1529
|
+
return false;
|
|
1530
|
+
return !owner.dispatchEvent(new CustomEvent(MARK_EVENT, { detail: next, cancelable: true }));
|
|
1531
|
+
} catch {
|
|
1532
|
+
return false;
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
function render() {
|
|
1536
|
+
if (!active || paused)
|
|
1537
|
+
return;
|
|
1538
|
+
if (handUp(mark)) {
|
|
1539
|
+
if (host)
|
|
1540
|
+
unmountDot();
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
mountDot();
|
|
1544
|
+
if (!dot)
|
|
1545
|
+
return;
|
|
1546
|
+
dot.hidden = mark.at === null;
|
|
1547
|
+
if (mark.at)
|
|
1548
|
+
dot.style.transform = `translate(${mark.at.x}px, ${mark.at.y}px)`;
|
|
1549
|
+
dot.classList.toggle("pressed", mark.pressed);
|
|
1550
|
+
}
|
|
1551
|
+
function showDot(event) {
|
|
1552
|
+
mark = { ...mark, at: { x: event.clientX, y: event.clientY } };
|
|
1553
|
+
render();
|
|
1554
|
+
}
|
|
1555
|
+
function hideDot() {
|
|
1556
|
+
mark = { ...mark, at: null };
|
|
1557
|
+
render();
|
|
1558
|
+
}
|
|
1559
|
+
function pressDot(pressed) {
|
|
1560
|
+
mark = { ...mark, pressed };
|
|
1561
|
+
render();
|
|
1562
|
+
}
|
|
1563
|
+
function layered() {
|
|
1564
|
+
return typeof HTMLElement.prototype.showPopover === "function";
|
|
1565
|
+
}
|
|
1566
|
+
function raise() {
|
|
1567
|
+
if (!host)
|
|
1568
|
+
return;
|
|
1569
|
+
try {
|
|
1570
|
+
if (host.matches(":popover-open"))
|
|
1571
|
+
host.hidePopover();
|
|
1572
|
+
host.showPopover();
|
|
1573
|
+
} catch {}
|
|
1574
|
+
}
|
|
1575
|
+
var TOP_LAYER = [":popover-open", ":modal", ":fullscreen"];
|
|
1576
|
+
function inTopLayer(node) {
|
|
1577
|
+
if (!(node instanceof Element))
|
|
1578
|
+
return false;
|
|
1579
|
+
for (let index = 0;index < TOP_LAYER.length; index++) {
|
|
1580
|
+
try {
|
|
1581
|
+
if (node.matches(TOP_LAYER[index] ?? ""))
|
|
1582
|
+
return true;
|
|
1583
|
+
} catch {}
|
|
1584
|
+
}
|
|
1585
|
+
return false;
|
|
1586
|
+
}
|
|
1587
|
+
function raiseOver(event) {
|
|
1588
|
+
if (!host || !layered())
|
|
1589
|
+
return;
|
|
1590
|
+
const found = topLayerOf(event.composedPath(), inTopLayer);
|
|
1591
|
+
if (found === over)
|
|
1592
|
+
return;
|
|
1593
|
+
over = found;
|
|
1594
|
+
if (found)
|
|
1595
|
+
raise();
|
|
1596
|
+
}
|
|
1597
|
+
function onToggle(event) {
|
|
1598
|
+
const target = event.composedPath()[0];
|
|
1599
|
+
const own = target === host;
|
|
1600
|
+
if (own)
|
|
1601
|
+
event.stopImmediatePropagation();
|
|
1602
|
+
if (!(target instanceof Element))
|
|
1603
|
+
return;
|
|
1604
|
+
const newState = "newState" in event ? event.newState : undefined;
|
|
1605
|
+
if (!raises({ newState, tag: target.tagName, own }))
|
|
1606
|
+
return;
|
|
1607
|
+
if (event.type === "beforetoggle")
|
|
1608
|
+
queueMicrotask(raise);
|
|
1609
|
+
else
|
|
1610
|
+
raise();
|
|
1611
|
+
}
|
|
1612
|
+
function onFullscreen() {
|
|
1613
|
+
if (document.fullscreenElement)
|
|
1614
|
+
raise();
|
|
1615
|
+
}
|
|
1616
|
+
function onDialogs(records) {
|
|
1617
|
+
const opened = records.some((record) => record.target instanceof Element && dialogOpened({
|
|
1618
|
+
tag: record.target.tagName,
|
|
1619
|
+
was: record.oldValue,
|
|
1620
|
+
open: record.target.hasAttribute("open")
|
|
1621
|
+
}));
|
|
1622
|
+
if (opened)
|
|
1623
|
+
raise();
|
|
1624
|
+
}
|
|
1625
|
+
function watchTopLayer() {
|
|
1626
|
+
window.addEventListener("beforetoggle", onToggle, true);
|
|
1627
|
+
window.addEventListener("toggle", onToggle, true);
|
|
1628
|
+
window.addEventListener("fullscreenchange", onFullscreen, true);
|
|
1629
|
+
if (typeof MutationObserver !== "function")
|
|
1630
|
+
return;
|
|
1631
|
+
dialogs = new MutationObserver(onDialogs);
|
|
1632
|
+
dialogs.observe(document.documentElement, {
|
|
1633
|
+
subtree: true,
|
|
1634
|
+
attributes: true,
|
|
1635
|
+
attributeFilter: ["open"],
|
|
1636
|
+
attributeOldValue: true
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
function unwatchTopLayer() {
|
|
1640
|
+
window.removeEventListener("beforetoggle", onToggle, true);
|
|
1641
|
+
window.removeEventListener("toggle", onToggle, true);
|
|
1642
|
+
window.removeEventListener("fullscreenchange", onFullscreen, true);
|
|
1643
|
+
dialogs?.disconnect();
|
|
1644
|
+
dialogs = null;
|
|
1645
|
+
}
|
|
1646
|
+
function mountDot() {
|
|
1647
|
+
if (host)
|
|
1648
|
+
return;
|
|
1649
|
+
host = document.createElement("div");
|
|
1650
|
+
host.setAttribute("data-devknobs", "touch-pointer");
|
|
1651
|
+
const root = host.attachShadow({ mode: "open" });
|
|
1652
|
+
addStyle(root, DOT_CSS);
|
|
1653
|
+
dot = document.createElement("div");
|
|
1654
|
+
dot.className = "dot";
|
|
1655
|
+
dot.hidden = true;
|
|
1656
|
+
root.append(dot);
|
|
1657
|
+
document.documentElement.append(host);
|
|
1658
|
+
if (!layered())
|
|
1659
|
+
return;
|
|
1660
|
+
host.setAttribute("popover", "manual");
|
|
1661
|
+
watchTopLayer();
|
|
1662
|
+
raise();
|
|
1663
|
+
}
|
|
1664
|
+
function unmountDot() {
|
|
1665
|
+
unwatchTopLayer();
|
|
1666
|
+
host?.remove();
|
|
1667
|
+
host = null;
|
|
1668
|
+
dot = null;
|
|
1669
|
+
over = null;
|
|
1670
|
+
}
|
|
1671
|
+
function sendTouch(type, current, event, cancelable) {
|
|
1672
|
+
if (!touchable())
|
|
1673
|
+
return false;
|
|
1674
|
+
let touchEvent;
|
|
1675
|
+
try {
|
|
1676
|
+
const touch = new Touch({
|
|
1677
|
+
identifier: current.id,
|
|
1678
|
+
target: current.target,
|
|
1679
|
+
clientX: event.clientX,
|
|
1680
|
+
clientY: event.clientY,
|
|
1681
|
+
screenX: event.screenX,
|
|
1682
|
+
screenY: event.screenY,
|
|
1683
|
+
pageX: event.pageX,
|
|
1684
|
+
pageY: event.pageY,
|
|
1685
|
+
radiusX: CONTACT,
|
|
1686
|
+
radiusY: CONTACT,
|
|
1687
|
+
force: 1
|
|
1688
|
+
});
|
|
1689
|
+
const lifted = type === "touchend" || type === "touchcancel";
|
|
1690
|
+
const touches = lifted ? [] : [touch];
|
|
1691
|
+
touchEvent = new TouchEvent(type, {
|
|
1692
|
+
touches,
|
|
1693
|
+
targetTouches: touches,
|
|
1694
|
+
changedTouches: [touch],
|
|
1695
|
+
bubbles: true,
|
|
1696
|
+
cancelable,
|
|
1697
|
+
composed: true,
|
|
1698
|
+
view: window,
|
|
1699
|
+
altKey: event.altKey,
|
|
1700
|
+
ctrlKey: event.ctrlKey,
|
|
1701
|
+
metaKey: event.metaKey,
|
|
1702
|
+
shiftKey: event.shiftKey
|
|
1703
|
+
});
|
|
1704
|
+
} catch {
|
|
1705
|
+
return false;
|
|
1706
|
+
}
|
|
1707
|
+
current.target.dispatchEvent(touchEvent);
|
|
1708
|
+
return touchEvent.defaultPrevented;
|
|
1709
|
+
}
|
|
1710
|
+
function sendCompatMouse(current, event) {
|
|
1711
|
+
for (const type of COMPAT) {
|
|
1712
|
+
current.target.dispatchEvent(new MouseEvent(type, {
|
|
1713
|
+
bubbles: true,
|
|
1714
|
+
cancelable: true,
|
|
1715
|
+
composed: true,
|
|
1716
|
+
view: window,
|
|
1717
|
+
detail: type === "mousemove" ? 0 : 1,
|
|
1718
|
+
button: 0,
|
|
1719
|
+
buttons: type === "mousedown" ? 1 : 0,
|
|
1720
|
+
clientX: event.clientX,
|
|
1721
|
+
clientY: event.clientY,
|
|
1722
|
+
screenX: event.screenX,
|
|
1723
|
+
screenY: event.screenY,
|
|
1724
|
+
altKey: event.altKey,
|
|
1725
|
+
ctrlKey: event.ctrlKey,
|
|
1726
|
+
metaKey: event.metaKey,
|
|
1727
|
+
shiftKey: event.shiftKey
|
|
1728
|
+
}));
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
function sendPointerCancel(current, event) {
|
|
1732
|
+
current.target.dispatchEvent(new PointerEvent("pointercancel", {
|
|
1733
|
+
pointerId: current.pointerId,
|
|
1734
|
+
pointerType: "touch",
|
|
1735
|
+
isPrimary: true,
|
|
1736
|
+
bubbles: true,
|
|
1737
|
+
composed: true,
|
|
1738
|
+
clientX: event.clientX,
|
|
1739
|
+
clientY: event.clientY,
|
|
1740
|
+
screenX: event.screenX,
|
|
1741
|
+
screenY: event.screenY
|
|
1742
|
+
}));
|
|
1743
|
+
}
|
|
1744
|
+
function scrolls(overflow) {
|
|
1745
|
+
return overflow === "auto" || overflow === "scroll" || overflow === "overlay";
|
|
1746
|
+
}
|
|
1747
|
+
function shut(overflow) {
|
|
1748
|
+
return overflow === "hidden" || overflow === "clip";
|
|
1749
|
+
}
|
|
1750
|
+
function viewportOverflow(style) {
|
|
1751
|
+
const body = document.body;
|
|
1752
|
+
if (style.overflowX !== "visible" || style.overflowY !== "visible" || !body) {
|
|
1753
|
+
return { x: style.overflowX, y: style.overflowY };
|
|
1754
|
+
}
|
|
1755
|
+
const own = getComputedStyle(body);
|
|
1756
|
+
return { x: own.overflowX, y: own.overflowY };
|
|
1757
|
+
}
|
|
1758
|
+
function nodeOf(element) {
|
|
1759
|
+
const style = getComputedStyle(element);
|
|
1760
|
+
let canX = scrolls(style.overflowX);
|
|
1761
|
+
let canY = scrolls(style.overflowY);
|
|
1762
|
+
if (element === document.scrollingElement) {
|
|
1763
|
+
const overflow = viewportOverflow(getComputedStyle(document.documentElement));
|
|
1764
|
+
canX = !shut(overflow.x);
|
|
1765
|
+
canY = !shut(overflow.y);
|
|
1766
|
+
}
|
|
1767
|
+
const maxX = element.scrollWidth - element.clientWidth;
|
|
1768
|
+
const maxY = element.scrollHeight - element.clientHeight;
|
|
1769
|
+
const rtl = style.direction === "rtl";
|
|
1770
|
+
const leftEnd = rtl ? -maxX : 0;
|
|
1771
|
+
const rightEnd = rtl ? 0 : maxX;
|
|
1772
|
+
const x = canX && maxX > 0;
|
|
1773
|
+
const y = canY && maxY > 0;
|
|
1774
|
+
return {
|
|
1775
|
+
touchAction: style.touchAction,
|
|
1776
|
+
left: x && element.scrollLeft > leftEnd + 0.5,
|
|
1777
|
+
right: x && element.scrollLeft < rightEnd - 0.5,
|
|
1778
|
+
up: y && element.scrollTop > 0.5,
|
|
1779
|
+
down: y && element.scrollTop < maxY - 0.5
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
function chainOf(target) {
|
|
1783
|
+
const chain = [];
|
|
1784
|
+
for (let current = target;current; current = composedParent(current)) {
|
|
1785
|
+
chain.push(current);
|
|
1786
|
+
}
|
|
1787
|
+
const root = document.scrollingElement;
|
|
1788
|
+
if (root && !chain.includes(root))
|
|
1789
|
+
chain.push(root);
|
|
1790
|
+
return chain;
|
|
1791
|
+
}
|
|
1792
|
+
function holdSnap(element, x, y) {
|
|
1793
|
+
const style = element instanceof HTMLElement || element instanceof SVGElement ? element.style : null;
|
|
1794
|
+
const scroller = {
|
|
1795
|
+
element,
|
|
1796
|
+
x,
|
|
1797
|
+
y,
|
|
1798
|
+
snap: style?.getPropertyValue("scroll-snap-type") ?? "",
|
|
1799
|
+
snapPriority: style?.getPropertyPriority("scroll-snap-type") ?? ""
|
|
1800
|
+
};
|
|
1801
|
+
style?.setProperty("scroll-snap-type", "none", "important");
|
|
1802
|
+
return scroller;
|
|
1803
|
+
}
|
|
1804
|
+
function releaseSnap(scroller) {
|
|
1805
|
+
const element = scroller.element;
|
|
1806
|
+
if (!(element instanceof HTMLElement || element instanceof SVGElement))
|
|
1807
|
+
return;
|
|
1808
|
+
const style = element.style;
|
|
1809
|
+
if (scroller.snap)
|
|
1810
|
+
style.setProperty("scroll-snap-type", scroller.snap, scroller.snapPriority);
|
|
1811
|
+
else
|
|
1812
|
+
style.removeProperty("scroll-snap-type");
|
|
1813
|
+
}
|
|
1814
|
+
function scrollBy(scroller, fingerX, fingerY) {
|
|
1815
|
+
scroller.element.scrollBy({
|
|
1816
|
+
left: scroller.x ? -fingerX : 0,
|
|
1817
|
+
top: scroller.y ? -fingerY : 0,
|
|
1818
|
+
behavior: "instant"
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
function stopFling() {
|
|
1822
|
+
cancelAnimationFrame(flingFrame);
|
|
1823
|
+
flingFrame = 0;
|
|
1824
|
+
if (fling)
|
|
1825
|
+
releaseSnap(fling.scroller);
|
|
1826
|
+
fling = null;
|
|
1827
|
+
}
|
|
1828
|
+
function flingStep(time) {
|
|
1829
|
+
if (!fling)
|
|
1830
|
+
return;
|
|
1831
|
+
const { scroller } = fling;
|
|
1832
|
+
const step = inertiaStep(fling.velocity, Math.max(0, time - fling.at));
|
|
1833
|
+
const before = [scroller.element.scrollLeft, scroller.element.scrollTop];
|
|
1834
|
+
scrollBy(scroller, step.move.x, step.move.y);
|
|
1835
|
+
const moved = scroller.element.scrollLeft !== before[0] || scroller.element.scrollTop !== before[1];
|
|
1836
|
+
fling.velocity = step.velocity;
|
|
1837
|
+
fling.at = time;
|
|
1838
|
+
if (step.done || !moved && (step.move.x !== 0 || step.move.y !== 0)) {
|
|
1839
|
+
stopFling();
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
flingFrame = requestAnimationFrame(flingStep);
|
|
1843
|
+
}
|
|
1844
|
+
function startFling(scroller, velocity) {
|
|
1845
|
+
stopFling();
|
|
1846
|
+
if (!flings(velocity)) {
|
|
1847
|
+
releaseSnap(scroller);
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
fling = { scroller, velocity, at: performance.now() };
|
|
1851
|
+
flingFrame = requestAnimationFrame(flingStep);
|
|
1852
|
+
}
|
|
1853
|
+
function finish() {
|
|
1854
|
+
clearTimeout(finishTimer);
|
|
1855
|
+
finishTimer = 0;
|
|
1856
|
+
if (gesture?.dragged)
|
|
1857
|
+
removeStyle("touch-drag");
|
|
1858
|
+
if (gesture && !gesture.ended && gesture.scroller)
|
|
1859
|
+
releaseSnap(gesture.scroller);
|
|
1860
|
+
gesture = null;
|
|
1861
|
+
}
|
|
1862
|
+
function cancel(event) {
|
|
1863
|
+
if (gesture && !gesture.ended)
|
|
1864
|
+
sendTouch("touchcancel", gesture, event, false);
|
|
1865
|
+
finish();
|
|
1866
|
+
}
|
|
1867
|
+
function block(event) {
|
|
1868
|
+
event.stopPropagation();
|
|
1869
|
+
}
|
|
1870
|
+
function patchPointer(event) {
|
|
1871
|
+
Object.defineProperty(event, "pointerType", { configurable: true, get: () => "touch" });
|
|
1872
|
+
Object.defineProperty(event, "isPrimary", { configurable: true, get: () => true });
|
|
1873
|
+
}
|
|
1874
|
+
function onPointerDown(event) {
|
|
1875
|
+
stopFling();
|
|
1876
|
+
finish();
|
|
1877
|
+
clearTimeout(nativeTimer);
|
|
1878
|
+
const target = event.composedPath()[0];
|
|
1879
|
+
native = event.button !== 0 || !(target instanceof Element) || isNative(target) || onScrollbar(target, event);
|
|
1880
|
+
if (native || !(target instanceof Element))
|
|
1881
|
+
return;
|
|
1882
|
+
const current = {
|
|
1883
|
+
id: nextId++,
|
|
1884
|
+
pointerId: event.pointerId,
|
|
1885
|
+
target,
|
|
1886
|
+
startX: event.clientX,
|
|
1887
|
+
startY: event.clientY,
|
|
1888
|
+
lastX: event.clientX,
|
|
1889
|
+
lastY: event.clientY,
|
|
1890
|
+
samples: [{ t: performance.now(), x: event.clientX, y: event.clientY }],
|
|
1891
|
+
dragged: false,
|
|
1892
|
+
claimed: false,
|
|
1893
|
+
quiet: false,
|
|
1894
|
+
scroller: undefined,
|
|
1895
|
+
ended: false
|
|
1896
|
+
};
|
|
1897
|
+
gesture = current;
|
|
1898
|
+
if (sendTouch("touchstart", current, event, true)) {
|
|
1899
|
+
current.claimed = true;
|
|
1900
|
+
current.quiet = true;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
function onPointerMove(event) {
|
|
1904
|
+
const current = gesture;
|
|
1905
|
+
if (!current || current.ended || event.pointerId !== current.pointerId)
|
|
1906
|
+
return;
|
|
1907
|
+
const now2 = performance.now();
|
|
1908
|
+
const stepX = event.clientX - current.lastX;
|
|
1909
|
+
const stepY = event.clientY - current.lastY;
|
|
1910
|
+
current.lastX = event.clientX;
|
|
1911
|
+
current.lastY = event.clientY;
|
|
1912
|
+
current.samples.push({ t: now2, x: event.clientX, y: event.clientY });
|
|
1913
|
+
while ((current.samples[0]?.t ?? now2) < now2 - VELOCITY_WINDOW * 2)
|
|
1914
|
+
current.samples.shift();
|
|
1915
|
+
const dx = event.clientX - current.startX;
|
|
1916
|
+
const dy = event.clientY - current.startY;
|
|
1917
|
+
if (!current.dragged && passedSlop(dx, dy)) {
|
|
1918
|
+
current.dragged = true;
|
|
1919
|
+
ensureStyle("touch-drag").textContent = DRAG_CSS;
|
|
1920
|
+
const focused = document.activeElement;
|
|
1921
|
+
const editing = focused instanceof HTMLInputElement || focused instanceof HTMLTextAreaElement || focused instanceof HTMLElement && focused.isContentEditable;
|
|
1922
|
+
if (!editing)
|
|
1923
|
+
window.getSelection()?.removeAllRanges();
|
|
1924
|
+
}
|
|
1925
|
+
if (sendTouch("touchmove", current, event, !current.scroller) && current.scroller === undefined) {
|
|
1926
|
+
current.claimed = true;
|
|
1927
|
+
}
|
|
1928
|
+
if (current.dragged && current.scroller === undefined) {
|
|
1929
|
+
const chain = chainOf(current.target);
|
|
1930
|
+
const pick = current.claimed ? null : pickScroller(chain.map(nodeOf), { x: -dx, y: -dy });
|
|
1931
|
+
const element = pick ? chain[pick.index] : undefined;
|
|
1932
|
+
current.scroller = pick && element ? holdSnap(element, pick.x, pick.y) : null;
|
|
1933
|
+
if (current.scroller)
|
|
1934
|
+
sendPointerCancel(current, event);
|
|
1935
|
+
}
|
|
1936
|
+
if (current.scroller) {
|
|
1937
|
+
scrollBy(current.scroller, stepX, stepY);
|
|
1938
|
+
block(event);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
function onPointerUp(event) {
|
|
1942
|
+
const current = gesture;
|
|
1943
|
+
if (!current || current.ended || event.pointerId !== current.pointerId)
|
|
1944
|
+
return;
|
|
1945
|
+
current.ended = true;
|
|
1946
|
+
if (sendTouch("touchend", current, event, !current.scroller))
|
|
1947
|
+
current.quiet = true;
|
|
1948
|
+
if (current.scroller) {
|
|
1949
|
+
block(event);
|
|
1950
|
+
startFling(current.scroller, velocityOf(current.samples, performance.now()));
|
|
1951
|
+
}
|
|
1952
|
+
finishTimer = window.setTimeout(finish, 0);
|
|
1953
|
+
}
|
|
1954
|
+
function onEvent(event) {
|
|
1955
|
+
if (paused)
|
|
1956
|
+
return;
|
|
1957
|
+
const type = event.type;
|
|
1958
|
+
const devknobs = fromDevknobs(event);
|
|
1959
|
+
if (rawPointer(event)) {
|
|
1960
|
+
if (devknobs) {
|
|
1961
|
+
hideDot();
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
if (type === "pointerout" && event.relatedTarget === null)
|
|
1965
|
+
hideDot();
|
|
1966
|
+
else if (type !== "pointerleave" && type !== "pointerout")
|
|
1967
|
+
showDot(event);
|
|
1968
|
+
if (type === "pointerover" || type === "pointermove" || type === "pointerdown")
|
|
1969
|
+
raiseOver(event);
|
|
1970
|
+
if (type === "pointerdown")
|
|
1971
|
+
pressDot(true);
|
|
1972
|
+
else if (type === "pointerup" || type === "pointercancel")
|
|
1973
|
+
pressDot(false);
|
|
1974
|
+
if (type === "pointerdown")
|
|
1975
|
+
onPointerDown(event);
|
|
1976
|
+
else if (type === "pointermove" && event.buttons === 0)
|
|
1977
|
+
native = false;
|
|
1978
|
+
if (native) {
|
|
1979
|
+
if (type === "pointerup" || type === "pointercancel") {
|
|
1980
|
+
nativeTimer = window.setTimeout(() => {
|
|
1981
|
+
native = false;
|
|
1982
|
+
}, 0);
|
|
1983
|
+
}
|
|
1984
|
+
return;
|
|
1985
|
+
}
|
|
1986
|
+
patchPointer(event);
|
|
1987
|
+
if (type === "pointermove")
|
|
1988
|
+
onPointerMove(event);
|
|
1989
|
+
else if (type === "pointerup")
|
|
1990
|
+
onPointerUp(event);
|
|
1991
|
+
else if (type === "pointercancel")
|
|
1992
|
+
cancel(event);
|
|
1993
|
+
}
|
|
1994
|
+
if (devknobs || !event.isTrusted || native)
|
|
1995
|
+
return;
|
|
1996
|
+
const current = gesture;
|
|
1997
|
+
if (type === "click") {
|
|
1998
|
+
if (current?.ended && (current.dragged || current.quiet)) {
|
|
1999
|
+
event.preventDefault();
|
|
2000
|
+
event.stopImmediatePropagation();
|
|
2001
|
+
finish();
|
|
2002
|
+
}
|
|
2003
|
+
return;
|
|
2004
|
+
}
|
|
2005
|
+
if (type === "dragstart") {
|
|
2006
|
+
if (current && !current.ended)
|
|
2007
|
+
event.preventDefault();
|
|
2008
|
+
return;
|
|
2009
|
+
}
|
|
2010
|
+
if (type === "selectstart") {
|
|
2011
|
+
if (current?.dragged && !current.ended)
|
|
2012
|
+
event.preventDefault();
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
if (CROSSING.has(type) || HOVER.has(type) && (!current || current.ended)) {
|
|
2016
|
+
block(event);
|
|
2017
|
+
return;
|
|
2018
|
+
}
|
|
2019
|
+
if (!COMPAT.has(type) || !current)
|
|
2020
|
+
return;
|
|
2021
|
+
block(event);
|
|
2022
|
+
const tap = current.ended && !current.dragged && !current.quiet;
|
|
2023
|
+
if (type === "mouseup" && tap && event instanceof MouseEvent)
|
|
2024
|
+
sendCompatMouse(current, event);
|
|
2025
|
+
}
|
|
2026
|
+
function onBlur() {
|
|
2027
|
+
clearTimeout(nativeTimer);
|
|
2028
|
+
native = false;
|
|
2029
|
+
finish();
|
|
2030
|
+
hideDot();
|
|
2031
|
+
pressDot(false);
|
|
2032
|
+
}
|
|
2033
|
+
function install3() {
|
|
2034
|
+
for (const type of EVENTS)
|
|
2035
|
+
window.addEventListener(type, onEvent, true);
|
|
2036
|
+
window.addEventListener("blur", onBlur);
|
|
2037
|
+
window.addEventListener("pagehide", hideDot);
|
|
2038
|
+
}
|
|
2039
|
+
function uninstall2() {
|
|
2040
|
+
for (const type of EVENTS)
|
|
2041
|
+
window.removeEventListener(type, onEvent, true);
|
|
2042
|
+
window.removeEventListener("blur", onBlur);
|
|
2043
|
+
window.removeEventListener("pagehide", hideDot);
|
|
2044
|
+
}
|
|
2045
|
+
function showCursor() {
|
|
2046
|
+
ensureStyle("touch-pointer").textContent = CURSOR_CSS;
|
|
2047
|
+
mark = { at: null, pressed: false, held: false };
|
|
2048
|
+
render();
|
|
2049
|
+
}
|
|
2050
|
+
function hideCursor() {
|
|
2051
|
+
removeStyle("touch-pointer");
|
|
2052
|
+
mark = { at: null, pressed: false, held: true };
|
|
2053
|
+
handUp(mark);
|
|
2054
|
+
unmountDot();
|
|
2055
|
+
}
|
|
2056
|
+
function apply9(on) {
|
|
2057
|
+
if (on === active)
|
|
2058
|
+
return;
|
|
2059
|
+
active = on;
|
|
2060
|
+
if (on) {
|
|
2061
|
+
install3();
|
|
2062
|
+
if (paused)
|
|
2063
|
+
handUp({ at: null, pressed: false, held: true });
|
|
2064
|
+
else
|
|
2065
|
+
showCursor();
|
|
2066
|
+
return;
|
|
2067
|
+
}
|
|
2068
|
+
uninstall2();
|
|
2069
|
+
onBlur();
|
|
2070
|
+
stopFling();
|
|
2071
|
+
hideCursor();
|
|
2072
|
+
}
|
|
2073
|
+
function reset8() {
|
|
2074
|
+
apply9(false);
|
|
2075
|
+
}
|
|
2076
|
+
function pause(on) {
|
|
2077
|
+
if (on === paused)
|
|
2078
|
+
return;
|
|
2079
|
+
paused = on;
|
|
2080
|
+
if (!active)
|
|
2081
|
+
return;
|
|
2082
|
+
if (on) {
|
|
2083
|
+
onBlur();
|
|
2084
|
+
stopFling();
|
|
2085
|
+
hideCursor();
|
|
2086
|
+
} else
|
|
2087
|
+
showCursor();
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
// src/engine/frames.ts
|
|
2091
|
+
var kit = null;
|
|
2092
|
+
var load2 = () => import("./framekit-3n7p79ht.js");
|
|
2093
|
+
var loading = null;
|
|
2094
|
+
var down = false;
|
|
2095
|
+
var waiting = [];
|
|
2096
|
+
var before = null;
|
|
2097
|
+
var latest = null;
|
|
2098
|
+
var exit = null;
|
|
2099
|
+
var zoomTo = null;
|
|
2100
|
+
var askWhy = null;
|
|
2101
|
+
var framed2 = null;
|
|
2102
|
+
function arrived(loaded) {
|
|
2103
|
+
kit = loaded;
|
|
2104
|
+
loaded.width.onExit(exit);
|
|
2105
|
+
loaded.width.onZoom(zoomTo);
|
|
2106
|
+
loaded.width.onRefused(askWhy);
|
|
2107
|
+
loaded.width.onFramed(framed2);
|
|
2108
|
+
for (const run of waiting.splice(0))
|
|
2109
|
+
run(loaded);
|
|
2110
|
+
for (const state of [before, latest]) {
|
|
2111
|
+
if (!state)
|
|
2112
|
+
continue;
|
|
2113
|
+
loaded.width.apply(state);
|
|
2114
|
+
loaded.width.sync(state);
|
|
2115
|
+
}
|
|
2116
|
+
before = null;
|
|
2117
|
+
latest = null;
|
|
2118
|
+
}
|
|
2119
|
+
function loadFrames() {
|
|
2120
|
+
loading ??= load2().then(arrived);
|
|
2121
|
+
return loading;
|
|
2122
|
+
}
|
|
2123
|
+
function failed(error) {
|
|
2124
|
+
console.error("devknobs: the device frame could not load", error);
|
|
2125
|
+
down = true;
|
|
2126
|
+
before = null;
|
|
2127
|
+
latest = null;
|
|
2128
|
+
dropEarly();
|
|
2129
|
+
exit?.();
|
|
2130
|
+
}
|
|
2131
|
+
function whenIn(watch) {
|
|
2132
|
+
if (kit)
|
|
2133
|
+
return watch(kit);
|
|
2134
|
+
let stop = null;
|
|
2135
|
+
const run = (loaded) => {
|
|
2136
|
+
stop = watch(loaded);
|
|
2137
|
+
};
|
|
2138
|
+
waiting.push(run);
|
|
2139
|
+
return () => {
|
|
2140
|
+
const at = waiting.indexOf(run);
|
|
2141
|
+
if (at >= 0)
|
|
2142
|
+
waiting.splice(at, 1);
|
|
2143
|
+
stop?.();
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
function apply10(state) {
|
|
2147
|
+
if (kit) {
|
|
2148
|
+
kit.width.apply(state);
|
|
2149
|
+
return;
|
|
2150
|
+
}
|
|
2151
|
+
if (latest === null && !needsFrame(state)) {
|
|
2152
|
+
before = state;
|
|
2153
|
+
dropEarly();
|
|
2154
|
+
return;
|
|
2155
|
+
}
|
|
2156
|
+
if (down) {
|
|
2157
|
+
exit?.();
|
|
2158
|
+
return;
|
|
2159
|
+
}
|
|
2160
|
+
latest = state;
|
|
2161
|
+
if (!loading)
|
|
2162
|
+
loadFrames().catch(failed);
|
|
2163
|
+
}
|
|
2164
|
+
function sync(state) {
|
|
2165
|
+
kit?.width.sync(state);
|
|
2166
|
+
}
|
|
2167
|
+
function reset9() {
|
|
2168
|
+
kit?.width.reset();
|
|
2169
|
+
before = null;
|
|
2170
|
+
latest = null;
|
|
2171
|
+
}
|
|
2172
|
+
function onExit(handler) {
|
|
2173
|
+
exit = handler;
|
|
2174
|
+
kit?.width.onExit(handler);
|
|
2175
|
+
}
|
|
2176
|
+
function onZoom(handler) {
|
|
2177
|
+
zoomTo = handler;
|
|
2178
|
+
kit?.width.onZoom(handler);
|
|
2179
|
+
}
|
|
2180
|
+
function onRefused(handler) {
|
|
2181
|
+
askWhy = handler;
|
|
2182
|
+
kit?.width.onRefused(handler);
|
|
2183
|
+
}
|
|
2184
|
+
function onFramed(handler) {
|
|
2185
|
+
framed2 = handler;
|
|
2186
|
+
kit?.width.onFramed(handler);
|
|
2187
|
+
}
|
|
2188
|
+
function frameWindow() {
|
|
2189
|
+
return kit?.width.frameWindow() ?? null;
|
|
2190
|
+
}
|
|
2191
|
+
function idle() {
|
|
2192
|
+
if (kit)
|
|
2193
|
+
return kit.width.idle();
|
|
2194
|
+
return latest === null;
|
|
2195
|
+
}
|
|
2196
|
+
function panelSized(glide) {
|
|
2197
|
+
kit?.width.panelSized(glide);
|
|
2198
|
+
}
|
|
2199
|
+
function zoomKey(action) {
|
|
2200
|
+
return kit?.width.zoomKey(action) ?? false;
|
|
2201
|
+
}
|
|
2202
|
+
function landSplash() {
|
|
2203
|
+
kit?.landSplash();
|
|
2204
|
+
}
|
|
2205
|
+
function takeHinge(state) {
|
|
2206
|
+
return kit?.takeHinge(state) ?? false;
|
|
2207
|
+
}
|
|
2208
|
+
function moveHinge(target) {
|
|
2209
|
+
return kit?.moveHinge(target) ?? false;
|
|
2210
|
+
}
|
|
2211
|
+
function letGo(stop) {
|
|
2212
|
+
return kit?.letGo(stop) ?? false;
|
|
2213
|
+
}
|
|
2214
|
+
function holdingHinge() {
|
|
2215
|
+
return kit?.holdingHinge() ?? false;
|
|
2216
|
+
}
|
|
2217
|
+
function foldRest() {
|
|
2218
|
+
return kit?.foldRest() ?? null;
|
|
2219
|
+
}
|
|
2220
|
+
function watchFold(watcher) {
|
|
2221
|
+
return whenIn((loaded) => loaded.watchFold(watcher));
|
|
2222
|
+
}
|
|
2223
|
+
function watchHinge(watcher) {
|
|
2224
|
+
return whenIn((loaded) => loaded.watchHinge(watcher));
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
// src/engine/index.ts
|
|
2228
|
+
var exports_engine = {};
|
|
2229
|
+
__export(exports_engine, {
|
|
2230
|
+
watchPanel: () => watchPanel,
|
|
2231
|
+
subscribe: () => subscribe,
|
|
2232
|
+
stop: () => stop2,
|
|
2233
|
+
start: () => start4,
|
|
2234
|
+
setState: () => setState,
|
|
2235
|
+
setNative: () => setNative,
|
|
2236
|
+
reset: () => reset17,
|
|
2237
|
+
replay: () => replay2,
|
|
2238
|
+
ready: () => ready,
|
|
2239
|
+
nativeSwitch: () => nativeSwitch,
|
|
2240
|
+
keepPlace: () => keepPlace2,
|
|
2241
|
+
getState: () => getState,
|
|
2242
|
+
applyState: () => applyState
|
|
2243
|
+
});
|
|
2244
|
+
|
|
2245
|
+
// src/requests/patch.ts
|
|
2246
|
+
function disguise(wrapper, native2) {
|
|
2247
|
+
for (const key of ["name", "length", ...Object.keys(native2)]) {
|
|
2248
|
+
const own = Object.getOwnPropertyDescriptor(native2, key);
|
|
2249
|
+
if (own)
|
|
2250
|
+
Object.defineProperty(wrapper, key, own);
|
|
2251
|
+
}
|
|
2252
|
+
Object.defineProperty(wrapper, "toString", {
|
|
2253
|
+
configurable: true,
|
|
2254
|
+
writable: true,
|
|
2255
|
+
value: () => Function.prototype.toString.call(native2)
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
function install4(patches, target, key, make) {
|
|
2259
|
+
const original = Reflect.get(target, key);
|
|
2260
|
+
if (typeof original !== "function")
|
|
2261
|
+
return;
|
|
2262
|
+
const own = Object.hasOwn(target, key);
|
|
2263
|
+
const value = make(original);
|
|
2264
|
+
disguise(value, original);
|
|
2265
|
+
if (Reflect.set(target, key, value))
|
|
2266
|
+
patches.push({ target, key, original, value, own });
|
|
2267
|
+
}
|
|
2268
|
+
function restore(patches) {
|
|
2269
|
+
for (const { target, key, original, value, own } of patches.reverse()) {
|
|
2270
|
+
if (Reflect.get(target, key) !== value)
|
|
2271
|
+
continue;
|
|
2272
|
+
if (own)
|
|
2273
|
+
Reflect.set(target, key, original);
|
|
2274
|
+
else
|
|
2275
|
+
Reflect.deleteProperty(target, key);
|
|
2276
|
+
}
|
|
2277
|
+
patches.length = 0;
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
// src/requests/types.ts
|
|
2281
|
+
var RING_SIZE = 300;
|
|
2282
|
+
var BODY_CAP = 64 * 1024;
|
|
2283
|
+
var MESSAGES_KEPT = 200;
|
|
2284
|
+
var MESSAGE_CAP = 4 * 1024;
|
|
2285
|
+
|
|
2286
|
+
// src/requests/body.ts
|
|
2287
|
+
var TEXT = /^text\/|[/+](json|xml|javascript|ecmascript|x-www-form-urlencoded|graphql|yaml)\b|\/svg/i;
|
|
2288
|
+
function isText(type) {
|
|
2289
|
+
return TEXT.test(type);
|
|
2290
|
+
}
|
|
2291
|
+
var BROKEN = /�+$/;
|
|
2292
|
+
function clipText(text, type, cap = BODY_CAP) {
|
|
2293
|
+
if (text.length <= cap) {
|
|
2294
|
+
const bytes2 = new TextEncoder().encode(text);
|
|
2295
|
+
if (bytes2.length <= cap)
|
|
2296
|
+
return { kind: "text", text, size: bytes2.length, truncated: false, type };
|
|
2297
|
+
const cut2 = new TextDecoder().decode(bytes2.subarray(0, cap)).replace(BROKEN, "");
|
|
2298
|
+
return { kind: "text", text: cut2, size: bytes2.length, truncated: true, type };
|
|
2299
|
+
}
|
|
2300
|
+
const bytes = new TextEncoder().encode(text.slice(0, cap));
|
|
2301
|
+
const cut = new TextDecoder().decode(bytes.subarray(0, cap));
|
|
2302
|
+
return { kind: "text", text: bytes.length > cap ? cut.replace(BROKEN, "") : cut, size: null, truncated: true, type };
|
|
2303
|
+
}
|
|
2304
|
+
function sized(kind, size, type) {
|
|
2305
|
+
return { kind, text: "", size, truncated: false, type };
|
|
2306
|
+
}
|
|
2307
|
+
function formText(form, cap) {
|
|
2308
|
+
const lines = [];
|
|
2309
|
+
let length = 0;
|
|
2310
|
+
for (const [name, value] of form) {
|
|
2311
|
+
const line = typeof value === "string" ? `${name}=${value}` : `${name}=(file ${value.name}, ${value.type || "no type"}, ${value.size} bytes)`;
|
|
2312
|
+
lines.push(line);
|
|
2313
|
+
length += line.length + 1;
|
|
2314
|
+
if (length > cap)
|
|
2315
|
+
break;
|
|
2316
|
+
}
|
|
2317
|
+
return lines.join(`
|
|
2318
|
+
`);
|
|
2319
|
+
}
|
|
2320
|
+
function is(kind, value) {
|
|
2321
|
+
return typeof kind === "function" && value instanceof kind;
|
|
2322
|
+
}
|
|
2323
|
+
function describeBody(body, type, cap = BODY_CAP) {
|
|
2324
|
+
if (body === undefined || body === null)
|
|
2325
|
+
return null;
|
|
2326
|
+
if (typeof body === "string")
|
|
2327
|
+
return clipText(body, type || "text/plain;charset=UTF-8", cap);
|
|
2328
|
+
if (is(globalThis.URLSearchParams, body)) {
|
|
2329
|
+
return clipText(String(body), type || "application/x-www-form-urlencoded;charset=UTF-8", cap);
|
|
2330
|
+
}
|
|
2331
|
+
if (is(globalThis.FormData, body)) {
|
|
2332
|
+
const text = clipText(formText(body, cap), type || "multipart/form-data", cap);
|
|
2333
|
+
return { ...text, kind: "form", size: null };
|
|
2334
|
+
}
|
|
2335
|
+
if (is(globalThis.Blob, body))
|
|
2336
|
+
return sized("binary", body.size, type || body.type || "Blob");
|
|
2337
|
+
if (is(globalThis.ArrayBuffer, body))
|
|
2338
|
+
return sized("binary", body.byteLength, type || "ArrayBuffer");
|
|
2339
|
+
if (ArrayBuffer.isView(body))
|
|
2340
|
+
return sized("binary", body.byteLength, type || "ArrayBufferView");
|
|
2341
|
+
if (is(globalThis.ReadableStream, body))
|
|
2342
|
+
return sized("stream", null, type);
|
|
2343
|
+
return null;
|
|
2344
|
+
}
|
|
2345
|
+
function unread(kind, size, type) {
|
|
2346
|
+
return sized(kind, size, type);
|
|
2347
|
+
}
|
|
2348
|
+
var READ_MS = 2000;
|
|
2349
|
+
async function readText(copy, type, cap = BODY_CAP, wait = READ_MS) {
|
|
2350
|
+
if (!copy.body) {
|
|
2351
|
+
const blob = await copy.blob();
|
|
2352
|
+
const text2 = await blob.slice(0, cap).text();
|
|
2353
|
+
const truncated = blob.size > cap;
|
|
2354
|
+
const record = {
|
|
2355
|
+
kind: "text",
|
|
2356
|
+
text: truncated ? text2.replace(BROKEN, "") : text2,
|
|
2357
|
+
size: blob.size,
|
|
2358
|
+
truncated,
|
|
2359
|
+
type
|
|
2360
|
+
};
|
|
2361
|
+
return { record, complete: true };
|
|
2362
|
+
}
|
|
2363
|
+
const reader = copy.body.getReader();
|
|
2364
|
+
const decoder = new TextDecoder;
|
|
2365
|
+
let text = "";
|
|
2366
|
+
let size = 0;
|
|
2367
|
+
let late = false;
|
|
2368
|
+
const timer = setTimeout(() => {
|
|
2369
|
+
late = true;
|
|
2370
|
+
reader.cancel().catch(() => {});
|
|
2371
|
+
}, wait);
|
|
2372
|
+
try {
|
|
2373
|
+
for (;; ) {
|
|
2374
|
+
const { done, value } = await reader.read();
|
|
2375
|
+
if (done)
|
|
2376
|
+
break;
|
|
2377
|
+
const room = cap - size;
|
|
2378
|
+
if (value.byteLength > room) {
|
|
2379
|
+
text += decoder.decode(value.subarray(0, room));
|
|
2380
|
+
reader.cancel().catch(() => {});
|
|
2381
|
+
const record = { kind: "text", text: text.replace(BROKEN, ""), size: null, truncated: true, type };
|
|
2382
|
+
return { record, complete: false };
|
|
2383
|
+
}
|
|
2384
|
+
text += decoder.decode(value, { stream: true });
|
|
2385
|
+
size += value.byteLength;
|
|
2386
|
+
}
|
|
2387
|
+
} finally {
|
|
2388
|
+
clearTimeout(timer);
|
|
2389
|
+
}
|
|
2390
|
+
text += decoder.decode();
|
|
2391
|
+
if (late) {
|
|
2392
|
+
const record = {
|
|
2393
|
+
kind: "text",
|
|
2394
|
+
text: text.replace(BROKEN, ""),
|
|
2395
|
+
size: null,
|
|
2396
|
+
truncated: true,
|
|
2397
|
+
timedOut: true,
|
|
2398
|
+
type
|
|
2399
|
+
};
|
|
2400
|
+
return { record, complete: false };
|
|
2401
|
+
}
|
|
2402
|
+
return { record: { kind: "text", text, size, truncated: false, type }, complete: true };
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
// src/requests/record.ts
|
|
2406
|
+
function absolute(url) {
|
|
2407
|
+
try {
|
|
2408
|
+
return new URL(url, typeof document === "undefined" ? undefined : document.baseURI).href;
|
|
2409
|
+
} catch {
|
|
2410
|
+
return url;
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
function headerOf(list, name) {
|
|
2414
|
+
return list.find(([key]) => key.toLowerCase() === name)?.[1] ?? "";
|
|
2415
|
+
}
|
|
2416
|
+
function blank(id, kind, source, clock2, at) {
|
|
2417
|
+
return {
|
|
2418
|
+
id,
|
|
2419
|
+
kind,
|
|
2420
|
+
detail: kind === "resource" || kind === "navigation" ? "light" : "full",
|
|
2421
|
+
source,
|
|
2422
|
+
method: "",
|
|
2423
|
+
url: "",
|
|
2424
|
+
finalUrl: null,
|
|
2425
|
+
redirected: false,
|
|
2426
|
+
state: "pending",
|
|
2427
|
+
status: null,
|
|
2428
|
+
statusText: "",
|
|
2429
|
+
error: null,
|
|
2430
|
+
requestHeaders: [],
|
|
2431
|
+
responseHeaders: [],
|
|
2432
|
+
requestBody: null,
|
|
2433
|
+
responseBody: null,
|
|
2434
|
+
contentType: "",
|
|
2435
|
+
sizes: null,
|
|
2436
|
+
timing: { start: clock2.origin + at, at, response: null, end: null, duration: null },
|
|
2437
|
+
phases: null,
|
|
2438
|
+
messages: [],
|
|
2439
|
+
initiator: "",
|
|
2440
|
+
initiatorType: "",
|
|
2441
|
+
protocol: "",
|
|
2442
|
+
referrerPolicy: ""
|
|
2443
|
+
};
|
|
2444
|
+
}
|
|
2445
|
+
function createLog(store, clock2, source, active2) {
|
|
2446
|
+
return {
|
|
2447
|
+
active: active2,
|
|
2448
|
+
start(kind, request) {
|
|
2449
|
+
const id = store.nextId();
|
|
2450
|
+
store.put({
|
|
2451
|
+
...blank(id, kind, source, clock2, clock2.now()),
|
|
2452
|
+
method: request.method,
|
|
2453
|
+
url: request.url,
|
|
2454
|
+
requestHeaders: request.headers,
|
|
2455
|
+
requestBody: request.body,
|
|
2456
|
+
initiator: request.initiator,
|
|
2457
|
+
referrerPolicy: request.referrerPolicy ?? ""
|
|
2458
|
+
});
|
|
2459
|
+
return id;
|
|
2460
|
+
},
|
|
2461
|
+
set: (id, patch) => store.update(id, patch),
|
|
2462
|
+
responded(id, patch) {
|
|
2463
|
+
const timing = store.get(id)?.timing;
|
|
2464
|
+
if (!timing)
|
|
2465
|
+
return;
|
|
2466
|
+
const response = timing.response ?? clock2.now() - timing.at;
|
|
2467
|
+
store.update(id, { ...patch, timing: { ...timing, response } });
|
|
2468
|
+
},
|
|
2469
|
+
ended(id, patch) {
|
|
2470
|
+
const timing = store.get(id)?.timing;
|
|
2471
|
+
if (!timing)
|
|
2472
|
+
return;
|
|
2473
|
+
const duration = timing.duration ?? clock2.now() - timing.at;
|
|
2474
|
+
store.update(id, { ...patch, timing: { ...timing, end: timing.start + duration, duration } });
|
|
2475
|
+
},
|
|
2476
|
+
message(id, message) {
|
|
2477
|
+
const messages = store.get(id)?.messages;
|
|
2478
|
+
if (!messages)
|
|
2479
|
+
return;
|
|
2480
|
+
const { text, truncated } = clipText(message.data, "", MESSAGE_CAP);
|
|
2481
|
+
const kept = { ...message, data: text, truncated, time: clock2.origin + clock2.now() };
|
|
2482
|
+
store.update(id, { messages: [...messages.slice(1 - MESSAGES_KEPT), kept] });
|
|
2483
|
+
}
|
|
2484
|
+
};
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
// src/requests/stack.ts
|
|
2488
|
+
var STACK_FRAMES = 12;
|
|
2489
|
+
var FRAME = /^at |@/;
|
|
2490
|
+
function trimStack(stack, skip) {
|
|
2491
|
+
if (typeof stack !== "string")
|
|
2492
|
+
return "";
|
|
2493
|
+
const lines = stack.split(`
|
|
2494
|
+
`).map((line) => line.trim()).filter((line) => line !== "");
|
|
2495
|
+
if (lines[0] !== undefined && !FRAME.test(lines[0]))
|
|
2496
|
+
lines.shift();
|
|
2497
|
+
return lines.slice(skip, skip + STACK_FRAMES).join(`
|
|
2498
|
+
`);
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
// src/requests/eventsource.ts
|
|
2502
|
+
var OWN = new Set(["open", "error"]);
|
|
2503
|
+
function patchEventSource(patches, log) {
|
|
2504
|
+
const Native = Reflect.get(globalThis, "EventSource");
|
|
2505
|
+
if (typeof Native !== "function")
|
|
2506
|
+
return;
|
|
2507
|
+
const followed = new WeakMap;
|
|
2508
|
+
const listen = EventTarget.prototype.addEventListener;
|
|
2509
|
+
function follow(source, initiator) {
|
|
2510
|
+
const url = absolute(source.url);
|
|
2511
|
+
const start = () => log.start("eventsource", { method: "GET", url, headers: [], body: null, initiator });
|
|
2512
|
+
const on = (type, run) => {
|
|
2513
|
+
listen.call(source, type, (event) => {
|
|
2514
|
+
try {
|
|
2515
|
+
run(event);
|
|
2516
|
+
} catch {}
|
|
2517
|
+
});
|
|
2518
|
+
};
|
|
2519
|
+
const row = {
|
|
2520
|
+
id: start(),
|
|
2521
|
+
open: false,
|
|
2522
|
+
types: new Set,
|
|
2523
|
+
listen(type) {
|
|
2524
|
+
if (row.types.has(type) || OWN.has(type))
|
|
2525
|
+
return;
|
|
2526
|
+
row.types.add(type);
|
|
2527
|
+
on(type, (event) => {
|
|
2528
|
+
if (row.id === null)
|
|
2529
|
+
return;
|
|
2530
|
+
const data = Reflect.get(event, "data");
|
|
2531
|
+
const id = Reflect.get(event, "lastEventId");
|
|
2532
|
+
log.message(row.id, { type: event.type, data: String(data ?? ""), id: typeof id === "string" ? id : "" });
|
|
2533
|
+
});
|
|
2534
|
+
}
|
|
2535
|
+
};
|
|
2536
|
+
followed.set(source, row);
|
|
2537
|
+
row.listen("message");
|
|
2538
|
+
on("open", () => {
|
|
2539
|
+
if (row.id === null) {
|
|
2540
|
+
if (!log.active())
|
|
2541
|
+
return;
|
|
2542
|
+
row.id = start();
|
|
2543
|
+
}
|
|
2544
|
+
row.open = true;
|
|
2545
|
+
log.responded(row.id, { status: 200, state: "ok", contentType: "text/event-stream" });
|
|
2546
|
+
});
|
|
2547
|
+
on("error", () => {
|
|
2548
|
+
if (row.id === null)
|
|
2549
|
+
return;
|
|
2550
|
+
log.ended(row.id, row.open ? {} : { state: "failed", error: "EventSource failed to connect" });
|
|
2551
|
+
row.id = null;
|
|
2552
|
+
row.open = false;
|
|
2553
|
+
});
|
|
2554
|
+
}
|
|
2555
|
+
install4(patches, globalThis, "EventSource", (original) => {
|
|
2556
|
+
function EventSource(...args) {
|
|
2557
|
+
if (!new.target)
|
|
2558
|
+
return Reflect.apply(original, this, args);
|
|
2559
|
+
const source = Reflect.construct(original, args, new.target);
|
|
2560
|
+
try {
|
|
2561
|
+
if (log.active())
|
|
2562
|
+
follow(source, trimStack(new Error().stack, 1));
|
|
2563
|
+
} catch {}
|
|
2564
|
+
return source;
|
|
2565
|
+
}
|
|
2566
|
+
EventSource.prototype = original.prototype;
|
|
2567
|
+
return EventSource;
|
|
2568
|
+
});
|
|
2569
|
+
const proto = Reflect.get(Native, "prototype");
|
|
2570
|
+
if (typeof proto !== "object" || proto === null)
|
|
2571
|
+
return;
|
|
2572
|
+
install4(patches, proto, "addEventListener", () => function(...args) {
|
|
2573
|
+
try {
|
|
2574
|
+
if (typeof args[0] === "string")
|
|
2575
|
+
followed.get(this)?.listen(args[0]);
|
|
2576
|
+
} catch {}
|
|
2577
|
+
return Reflect.apply(Reflect.get(Object.getPrototypeOf(proto), "addEventListener"), this, args);
|
|
2578
|
+
});
|
|
2579
|
+
install4(patches, proto, "close", (original) => function(...args) {
|
|
2580
|
+
try {
|
|
2581
|
+
const row = followed.get(this);
|
|
2582
|
+
if (row && row.id !== null) {
|
|
2583
|
+
log.ended(row.id, row.open ? {} : { state: "aborted" });
|
|
2584
|
+
row.id = null;
|
|
2585
|
+
}
|
|
2586
|
+
} catch {}
|
|
2587
|
+
return original.apply(this, args);
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
// src/requests/fetch.ts
|
|
2592
|
+
function isRequest(input) {
|
|
2593
|
+
return typeof input === "object" && input !== null && "url" in input && "method" in input && "headers" in input && "clone" in input;
|
|
2594
|
+
}
|
|
2595
|
+
function field(init, key) {
|
|
2596
|
+
return typeof init === "object" && init !== null ? Reflect.get(init, key) : undefined;
|
|
2597
|
+
}
|
|
2598
|
+
function isQuiet(init) {
|
|
2599
|
+
try {
|
|
2600
|
+
return typeof init === "object" && init !== null && Reflect.get(init, QUIET) === true;
|
|
2601
|
+
} catch {
|
|
2602
|
+
return false;
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
function listHeaders(given) {
|
|
2606
|
+
const list = [];
|
|
2607
|
+
if (typeof given !== "object" || given === null)
|
|
2608
|
+
return list;
|
|
2609
|
+
if (is(globalThis.Headers, given))
|
|
2610
|
+
given.forEach((value, name) => list.push([name, value]));
|
|
2611
|
+
else if (Array.isArray(given)) {
|
|
2612
|
+
for (const pair of given) {
|
|
2613
|
+
if (Array.isArray(pair) && pair.length > 1)
|
|
2614
|
+
list.push([String(pair[0]), String(pair[1])]);
|
|
2615
|
+
}
|
|
2616
|
+
} else
|
|
2617
|
+
for (const [name, value] of Object.entries(given))
|
|
2618
|
+
list.push([name, String(value)]);
|
|
2619
|
+
return list;
|
|
2620
|
+
}
|
|
2621
|
+
function describe(error) {
|
|
2622
|
+
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
2623
|
+
}
|
|
2624
|
+
function aborted(signal) {
|
|
2625
|
+
return typeof signal === "object" && signal !== null && Reflect.get(signal, "aborted") === true;
|
|
2626
|
+
}
|
|
2627
|
+
function carried(from, method, type) {
|
|
2628
|
+
if (method === "GET" || method === "HEAD")
|
|
2629
|
+
return null;
|
|
2630
|
+
if (from.body === null || from.bodyUsed)
|
|
2631
|
+
return null;
|
|
2632
|
+
return unread(isText(type) ? "stream" : "binary", null, type);
|
|
2633
|
+
}
|
|
2634
|
+
function see(input, init) {
|
|
2635
|
+
const from = isRequest(input) ? input : null;
|
|
2636
|
+
const method = String(field(init, "method") ?? from?.method ?? "GET").toUpperCase();
|
|
2637
|
+
const given = field(init, "headers");
|
|
2638
|
+
const headers = listHeaders(given === undefined ? from?.headers : given);
|
|
2639
|
+
const type = headerOf(headers, "content-type");
|
|
2640
|
+
const sent = field(init, "body");
|
|
2641
|
+
const own = from && (sent === undefined || sent === null) ? carried(from, method, type) : null;
|
|
2642
|
+
const body = describeBody(sent, type) ?? own;
|
|
2643
|
+
const referrerPolicy = String(field(init, "referrerPolicy") ?? from?.referrerPolicy ?? "");
|
|
2644
|
+
return {
|
|
2645
|
+
request: { method, url: absolute(from ? from.url : String(input)), headers, body, referrerPolicy },
|
|
2646
|
+
signal: field(init, "signal") ?? from?.signal
|
|
2647
|
+
};
|
|
2648
|
+
}
|
|
2649
|
+
function lengthOf(headers) {
|
|
2650
|
+
const length = Number.parseInt(headerOf(headers, "content-length"), 10);
|
|
2651
|
+
return Number.isFinite(length) ? length : null;
|
|
2652
|
+
}
|
|
2653
|
+
function isEventStream(type) {
|
|
2654
|
+
return /^text\/event-stream\b/i.test(type.trim());
|
|
2655
|
+
}
|
|
2656
|
+
function answered(log, id, response, signal, wait) {
|
|
2657
|
+
const responseHeaders = listHeaders(response.headers);
|
|
2658
|
+
const contentType = headerOf(responseHeaders, "content-type");
|
|
2659
|
+
const opaque = response.type === "opaque" || response.type === "opaqueredirect";
|
|
2660
|
+
log.responded(id, {
|
|
2661
|
+
status: response.status,
|
|
2662
|
+
statusText: response.statusText,
|
|
2663
|
+
state: response.ok || opaque ? "ok" : "failed",
|
|
2664
|
+
responseHeaders,
|
|
2665
|
+
contentType,
|
|
2666
|
+
redirected: response.redirected,
|
|
2667
|
+
finalUrl: response.url || null
|
|
2668
|
+
});
|
|
2669
|
+
if (opaque)
|
|
2670
|
+
log.set(id, { responseBody: unread("opaque", null, "") });
|
|
2671
|
+
else if (response.body === null)
|
|
2672
|
+
log.ended(id, {});
|
|
2673
|
+
else if (isEventStream(contentType))
|
|
2674
|
+
log.set(id, { responseBody: unread("stream", null, contentType) });
|
|
2675
|
+
else if (!isText(contentType)) {
|
|
2676
|
+
log.set(id, { responseBody: unread("binary", lengthOf(responseHeaders), contentType) });
|
|
2677
|
+
} else {
|
|
2678
|
+
readText(response.clone(), contentType, undefined, wait).then(({ record, complete }) => {
|
|
2679
|
+
const responseBody = record.size === 0 ? null : record;
|
|
2680
|
+
if (complete)
|
|
2681
|
+
log.ended(id, { responseBody });
|
|
2682
|
+
else
|
|
2683
|
+
log.set(id, { responseBody });
|
|
2684
|
+
}, (error) => {
|
|
2685
|
+
log.ended(id, { state: aborted(signal) ? "aborted" : "failed", error: describe(error) });
|
|
2686
|
+
});
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
function wrapFetch(native2, log, wait = READ_MS) {
|
|
2690
|
+
return function fetch() {
|
|
2691
|
+
const args = arguments;
|
|
2692
|
+
if (!log.active() || isQuiet(args[1]))
|
|
2693
|
+
return Reflect.apply(native2, this, args);
|
|
2694
|
+
let id = null;
|
|
2695
|
+
let signal;
|
|
2696
|
+
try {
|
|
2697
|
+
const seen = see(args[0], args[1]);
|
|
2698
|
+
signal = seen.signal;
|
|
2699
|
+
id = log.start("fetch", { ...seen.request, initiator: trimStack(new Error().stack, 1) });
|
|
2700
|
+
} catch {}
|
|
2701
|
+
const result = Reflect.apply(native2, this, args);
|
|
2702
|
+
if (id === null)
|
|
2703
|
+
return result;
|
|
2704
|
+
const row = id;
|
|
2705
|
+
return result.then((response) => {
|
|
2706
|
+
try {
|
|
2707
|
+
answered(log, row, response, signal, wait);
|
|
2708
|
+
} catch {}
|
|
2709
|
+
return response;
|
|
2710
|
+
}, (error) => {
|
|
2711
|
+
try {
|
|
2712
|
+
log.ended(row, { state: aborted(signal) ? "aborted" : "failed", error: describe(error) });
|
|
2713
|
+
} catch {}
|
|
2714
|
+
throw error;
|
|
2715
|
+
});
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
// src/requests/resource.ts
|
|
2720
|
+
var MATCH_BEFORE = 250;
|
|
2721
|
+
var MATCH_AFTER = 5;
|
|
2722
|
+
function number(entry, key) {
|
|
2723
|
+
const value = Reflect.get(entry, key);
|
|
2724
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
2725
|
+
}
|
|
2726
|
+
function text(entry, key) {
|
|
2727
|
+
const value = Reflect.get(entry, key);
|
|
2728
|
+
return typeof value === "string" ? value : "";
|
|
2729
|
+
}
|
|
2730
|
+
function bare(url) {
|
|
2731
|
+
return url.split("#", 1)[0] ?? url;
|
|
2732
|
+
}
|
|
2733
|
+
function originOf(url) {
|
|
2734
|
+
try {
|
|
2735
|
+
return new URL(url).origin;
|
|
2736
|
+
} catch {
|
|
2737
|
+
return "";
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
function sizesOf(entry, origin) {
|
|
2741
|
+
const transfer = number(entry, "transferSize");
|
|
2742
|
+
const encoded = number(entry, "encodedBodySize");
|
|
2743
|
+
const decoded = number(entry, "decodedBodySize");
|
|
2744
|
+
const hidden = transfer + encoded + decoded === 0 && originOf(entry.name) !== origin;
|
|
2745
|
+
return { transfer, encoded, decoded, hidden };
|
|
2746
|
+
}
|
|
2747
|
+
function phasesOf(entry) {
|
|
2748
|
+
return {
|
|
2749
|
+
startTime: entry.startTime,
|
|
2750
|
+
workerStart: number(entry, "workerStart"),
|
|
2751
|
+
redirectStart: number(entry, "redirectStart"),
|
|
2752
|
+
redirectEnd: number(entry, "redirectEnd"),
|
|
2753
|
+
fetchStart: number(entry, "fetchStart"),
|
|
2754
|
+
domainLookupStart: number(entry, "domainLookupStart"),
|
|
2755
|
+
domainLookupEnd: number(entry, "domainLookupEnd"),
|
|
2756
|
+
connectStart: number(entry, "connectStart"),
|
|
2757
|
+
secureConnectionStart: number(entry, "secureConnectionStart"),
|
|
2758
|
+
connectEnd: number(entry, "connectEnd"),
|
|
2759
|
+
requestStart: number(entry, "requestStart"),
|
|
2760
|
+
responseStart: number(entry, "responseStart"),
|
|
2761
|
+
responseEnd: number(entry, "responseEnd") || entry.startTime + entry.duration
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2764
|
+
function statusOf(entry) {
|
|
2765
|
+
return number(entry, "responseStatus") || null;
|
|
2766
|
+
}
|
|
2767
|
+
function lightEntry(entry, id, source, clock2, origin) {
|
|
2768
|
+
const row = blank(id, entry.entryType === "navigation" ? "navigation" : "resource", source, clock2, entry.startTime);
|
|
2769
|
+
const status = statusOf(entry);
|
|
2770
|
+
const end = number(entry, "responseEnd") || entry.startTime + entry.duration;
|
|
2771
|
+
const responseStart = number(entry, "responseStart");
|
|
2772
|
+
const duration = Math.max(0, end - entry.startTime);
|
|
2773
|
+
return {
|
|
2774
|
+
...row,
|
|
2775
|
+
url: entry.name,
|
|
2776
|
+
state: status !== null && status >= 400 ? "failed" : "ok",
|
|
2777
|
+
status,
|
|
2778
|
+
contentType: text(entry, "contentType"),
|
|
2779
|
+
sizes: sizesOf(entry, origin),
|
|
2780
|
+
timing: {
|
|
2781
|
+
...row.timing,
|
|
2782
|
+
response: responseStart > 0 ? Math.max(0, responseStart - entry.startTime) : null,
|
|
2783
|
+
end: row.timing.start + duration,
|
|
2784
|
+
duration
|
|
2785
|
+
},
|
|
2786
|
+
phases: phasesOf(entry),
|
|
2787
|
+
initiatorType: text(entry, "initiatorType") || entry.entryType,
|
|
2788
|
+
protocol: text(entry, "nextHopProtocol")
|
|
2789
|
+
};
|
|
2790
|
+
}
|
|
2791
|
+
var KINDS2 = { fetch: "fetch", xmlhttprequest: "xhr", other: "eventsource" };
|
|
2792
|
+
function matchFull(rows, entry, source) {
|
|
2793
|
+
const kind = KINDS2[text(entry, "initiatorType")];
|
|
2794
|
+
if (!kind)
|
|
2795
|
+
return null;
|
|
2796
|
+
const url = bare(entry.name);
|
|
2797
|
+
const end = number(entry, "responseEnd") || entry.startTime + entry.duration;
|
|
2798
|
+
let best = null;
|
|
2799
|
+
for (const row of rows) {
|
|
2800
|
+
if (row.kind !== kind || row.source !== source || row.sizes !== null)
|
|
2801
|
+
continue;
|
|
2802
|
+
const gap = entry.startTime - row.timing.at;
|
|
2803
|
+
const reopened = kind === "eventsource" && gap <= MATCH_AFTER && row.timing.at <= end + MATCH_AFTER;
|
|
2804
|
+
if (!reopened && (gap < -MATCH_AFTER || gap > MATCH_BEFORE) || bare(row.url) !== url)
|
|
2805
|
+
continue;
|
|
2806
|
+
if (!best || Math.abs(gap) < Math.abs(entry.startTime - best.timing.at))
|
|
2807
|
+
best = row;
|
|
2808
|
+
}
|
|
2809
|
+
return best;
|
|
2810
|
+
}
|
|
2811
|
+
function mergeTiming(row, entry, origin) {
|
|
2812
|
+
const end = number(entry, "responseEnd") || entry.startTime + entry.duration;
|
|
2813
|
+
const duration = Math.max(0, end - row.timing.at);
|
|
2814
|
+
return {
|
|
2815
|
+
sizes: sizesOf(entry, origin),
|
|
2816
|
+
phases: phasesOf(entry),
|
|
2817
|
+
protocol: text(entry, "nextHopProtocol"),
|
|
2818
|
+
initiatorType: text(entry, "initiatorType"),
|
|
2819
|
+
status: row.status || statusOf(entry),
|
|
2820
|
+
contentType: row.contentType || text(entry, "contentType"),
|
|
2821
|
+
timing: { ...row.timing, end: row.timing.start + duration, duration }
|
|
2822
|
+
};
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
// src/requests/store.ts
|
|
2826
|
+
var BATCH_MS = 50;
|
|
2827
|
+
function later(flush) {
|
|
2828
|
+
const timer = setTimeout(flush, BATCH_MS);
|
|
2829
|
+
return () => clearTimeout(timer);
|
|
2830
|
+
}
|
|
2831
|
+
function createStore(options) {
|
|
2832
|
+
const schedule = options.schedule ?? later;
|
|
2833
|
+
let rows = [];
|
|
2834
|
+
const byId = new Map;
|
|
2835
|
+
const listeners = new Set;
|
|
2836
|
+
const dirty = new Set;
|
|
2837
|
+
let cancel2 = null;
|
|
2838
|
+
let cleared = false;
|
|
2839
|
+
let clearedAt = Number.NEGATIVE_INFINITY;
|
|
2840
|
+
let count = 0;
|
|
2841
|
+
function flush() {
|
|
2842
|
+
cancel2?.();
|
|
2843
|
+
cancel2 = null;
|
|
2844
|
+
if (dirty.size === 0 && !cleared)
|
|
2845
|
+
return;
|
|
2846
|
+
const changed = [];
|
|
2847
|
+
for (const id of dirty) {
|
|
2848
|
+
const entry = byId.get(id);
|
|
2849
|
+
if (entry)
|
|
2850
|
+
changed.push(entry);
|
|
2851
|
+
}
|
|
2852
|
+
dirty.clear();
|
|
2853
|
+
cleared = false;
|
|
2854
|
+
for (const listener of Array.from(listeners))
|
|
2855
|
+
listener(changed);
|
|
2856
|
+
}
|
|
2857
|
+
function touch(id) {
|
|
2858
|
+
if (listeners.size === 0)
|
|
2859
|
+
return;
|
|
2860
|
+
if (id === null)
|
|
2861
|
+
cleared = true;
|
|
2862
|
+
else
|
|
2863
|
+
dirty.add(id);
|
|
2864
|
+
cancel2 ??= schedule(flush);
|
|
2865
|
+
}
|
|
2866
|
+
function put(entry) {
|
|
2867
|
+
if (entry.timing.start < clearedAt)
|
|
2868
|
+
return;
|
|
2869
|
+
const old = byId.get(entry.id);
|
|
2870
|
+
byId.set(entry.id, entry);
|
|
2871
|
+
if (old)
|
|
2872
|
+
rows[rows.lastIndexOf(old)] = entry;
|
|
2873
|
+
else {
|
|
2874
|
+
let at = rows.length;
|
|
2875
|
+
while (at > 0 && (rows[at - 1]?.timing.start ?? 0) > entry.timing.start)
|
|
2876
|
+
at--;
|
|
2877
|
+
rows.splice(at, 0, entry);
|
|
2878
|
+
if (rows.length > RING_SIZE) {
|
|
2879
|
+
const gone = rows.shift();
|
|
2880
|
+
if (gone)
|
|
2881
|
+
byId.delete(gone.id);
|
|
2882
|
+
if (gone === entry)
|
|
2883
|
+
return;
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
touch(entry.id);
|
|
2887
|
+
}
|
|
2888
|
+
return {
|
|
2889
|
+
entries: () => rows,
|
|
2890
|
+
get: (id) => byId.get(id),
|
|
2891
|
+
nextId: () => `${options.seed}-${++count}`,
|
|
2892
|
+
put,
|
|
2893
|
+
update(id, patch) {
|
|
2894
|
+
const entry = byId.get(id);
|
|
2895
|
+
if (entry)
|
|
2896
|
+
put({ ...entry, ...patch, id });
|
|
2897
|
+
},
|
|
2898
|
+
clear() {
|
|
2899
|
+
rows = [];
|
|
2900
|
+
byId.clear();
|
|
2901
|
+
dirty.clear();
|
|
2902
|
+
clearedAt = options.now();
|
|
2903
|
+
touch(null);
|
|
2904
|
+
},
|
|
2905
|
+
subscribe(listener) {
|
|
2906
|
+
listeners.add(listener);
|
|
2907
|
+
return () => {
|
|
2908
|
+
listeners.delete(listener);
|
|
2909
|
+
};
|
|
2910
|
+
},
|
|
2911
|
+
flush,
|
|
2912
|
+
close() {
|
|
2913
|
+
cancel2?.();
|
|
2914
|
+
cancel2 = null;
|
|
2915
|
+
rows = [];
|
|
2916
|
+
byId.clear();
|
|
2917
|
+
dirty.clear();
|
|
2918
|
+
listeners.clear();
|
|
2919
|
+
}
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
// src/requests/xhr.ts
|
|
2924
|
+
var JSON_LIMIT = 4 * BODY_CAP;
|
|
2925
|
+
function parseHeaders(raw) {
|
|
2926
|
+
const list = [];
|
|
2927
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
2928
|
+
const cut = line.indexOf(":");
|
|
2929
|
+
if (cut > 0)
|
|
2930
|
+
list.push([line.slice(0, cut).trim(), line.slice(cut + 1).trim()]);
|
|
2931
|
+
}
|
|
2932
|
+
return list;
|
|
2933
|
+
}
|
|
2934
|
+
function head(xhr, url) {
|
|
2935
|
+
const responseHeaders = parseHeaders(xhr.getAllResponseHeaders() ?? "");
|
|
2936
|
+
const finalUrl = xhr.responseURL || null;
|
|
2937
|
+
return {
|
|
2938
|
+
status: xhr.status,
|
|
2939
|
+
statusText: xhr.statusText,
|
|
2940
|
+
responseHeaders,
|
|
2941
|
+
contentType: headerOf(responseHeaders, "content-type"),
|
|
2942
|
+
finalUrl,
|
|
2943
|
+
redirected: finalUrl !== null && finalUrl !== url.split("#", 1)[0]
|
|
2944
|
+
};
|
|
2945
|
+
}
|
|
2946
|
+
function sizeOf(value) {
|
|
2947
|
+
if (typeof value !== "object" || value === null)
|
|
2948
|
+
return null;
|
|
2949
|
+
const size = Reflect.get(value, "byteLength") ?? Reflect.get(value, "size");
|
|
2950
|
+
return typeof size === "number" ? size : null;
|
|
2951
|
+
}
|
|
2952
|
+
function bodyOf(xhr, type, loaded) {
|
|
2953
|
+
const kind = xhr.responseType;
|
|
2954
|
+
let record;
|
|
2955
|
+
if (kind === "" || kind === "text")
|
|
2956
|
+
record = clipText(xhr.responseText, type);
|
|
2957
|
+
else if (kind !== "json")
|
|
2958
|
+
record = unread("binary", sizeOf(xhr.response) ?? loaded, type || kind);
|
|
2959
|
+
else if (loaded !== null && loaded > JSON_LIMIT) {
|
|
2960
|
+
record = { kind: "text", text: "", size: loaded, truncated: true, type };
|
|
2961
|
+
} else
|
|
2962
|
+
record = clipText(JSON.stringify(xhr.response) ?? "", type);
|
|
2963
|
+
return record.size === 0 ? null : record;
|
|
2964
|
+
}
|
|
2965
|
+
var FAILS = ["error", "abort", "timeout"];
|
|
2966
|
+
function watch(xhr, id, url, log) {
|
|
2967
|
+
let outcome = null;
|
|
2968
|
+
let error = null;
|
|
2969
|
+
let over2 = false;
|
|
2970
|
+
let loaded = null;
|
|
2971
|
+
const unlisten = () => {
|
|
2972
|
+
xhr.removeEventListener("readystatechange", onState, true);
|
|
2973
|
+
xhr.removeEventListener("progress", onProgress, true);
|
|
2974
|
+
for (const type of FAILS)
|
|
2975
|
+
xhr.removeEventListener(type, onFail, true);
|
|
2976
|
+
xhr.removeEventListener("loadend", onEnd, true);
|
|
2977
|
+
};
|
|
2978
|
+
function finish2() {
|
|
2979
|
+
over2 = true;
|
|
2980
|
+
unlisten();
|
|
2981
|
+
try {
|
|
2982
|
+
const answer = head(xhr, url);
|
|
2983
|
+
const status = xhr.status;
|
|
2984
|
+
const state = outcome ?? (status === 0 || status >= 400 ? "failed" : "ok");
|
|
2985
|
+
const length = Number.parseInt(headerOf(answer.responseHeaders ?? [], "content-length"), 10);
|
|
2986
|
+
const size = loaded ?? (Number.isFinite(length) ? length : null);
|
|
2987
|
+
const responseBody = outcome ? null : bodyOf(xhr, answer.contentType ?? "", size);
|
|
2988
|
+
log.ended(id, { ...answer, status: status === 0 ? null : status, state, error, responseBody });
|
|
2989
|
+
} catch {
|
|
2990
|
+
log.ended(id, { state: outcome ?? "failed", error });
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
function onState() {
|
|
2994
|
+
try {
|
|
2995
|
+
if (xhr.readyState === 2)
|
|
2996
|
+
log.responded(id, head(xhr, url));
|
|
2997
|
+
} catch {}
|
|
2998
|
+
if (xhr.readyState === 4 && xhr.status !== 0)
|
|
2999
|
+
finish2();
|
|
3000
|
+
}
|
|
3001
|
+
function onProgress(event) {
|
|
3002
|
+
const so = Reflect.get(event, "loaded");
|
|
3003
|
+
if (typeof so === "number")
|
|
3004
|
+
loaded = so;
|
|
3005
|
+
}
|
|
3006
|
+
function onFail(event) {
|
|
3007
|
+
outcome = event.type === "abort" ? "aborted" : "failed";
|
|
3008
|
+
error = event.type === "abort" ? null : event.type;
|
|
3009
|
+
}
|
|
3010
|
+
function onEnd(event) {
|
|
3011
|
+
if (xhr.readyState !== 4)
|
|
3012
|
+
return;
|
|
3013
|
+
onProgress(event);
|
|
3014
|
+
finish2();
|
|
3015
|
+
}
|
|
3016
|
+
xhr.addEventListener("readystatechange", onState, true);
|
|
3017
|
+
xhr.addEventListener("progress", onProgress, true);
|
|
3018
|
+
for (const type of FAILS)
|
|
3019
|
+
xhr.addEventListener(type, onFail, true);
|
|
3020
|
+
xhr.addEventListener("loadend", onEnd, true);
|
|
3021
|
+
return () => {
|
|
3022
|
+
if (over2)
|
|
3023
|
+
return;
|
|
3024
|
+
over2 = true;
|
|
3025
|
+
unlisten();
|
|
3026
|
+
log.ended(id, { state: "aborted" });
|
|
3027
|
+
};
|
|
3028
|
+
}
|
|
3029
|
+
function patchXhr(patches, log) {
|
|
3030
|
+
if (typeof XMLHttpRequest !== "function")
|
|
3031
|
+
return;
|
|
3032
|
+
const opened = new WeakMap;
|
|
3033
|
+
const proto = XMLHttpRequest.prototype;
|
|
3034
|
+
install4(patches, proto, "open", (original) => function(...args) {
|
|
3035
|
+
const result = original.apply(this, args);
|
|
3036
|
+
try {
|
|
3037
|
+
opened.get(this)?.drop?.();
|
|
3038
|
+
opened.delete(this);
|
|
3039
|
+
if (log.active()) {
|
|
3040
|
+
const method = String(args[0]).toUpperCase();
|
|
3041
|
+
opened.set(this, { method, url: absolute(String(args[1])), headers: [], drop: null });
|
|
3042
|
+
}
|
|
3043
|
+
} catch {}
|
|
3044
|
+
return result;
|
|
3045
|
+
});
|
|
3046
|
+
install4(patches, proto, "setRequestHeader", (original) => function(...args) {
|
|
3047
|
+
const result = original.apply(this, args);
|
|
3048
|
+
opened.get(this)?.headers.push([String(args[0]), String(args[1])]);
|
|
3049
|
+
return result;
|
|
3050
|
+
});
|
|
3051
|
+
install4(patches, proto, "send", (original) => function(...args) {
|
|
3052
|
+
const request = opened.get(this);
|
|
3053
|
+
if (!request || !log.active())
|
|
3054
|
+
return original.apply(this, args);
|
|
3055
|
+
let id = null;
|
|
3056
|
+
try {
|
|
3057
|
+
const { method, url, headers } = request;
|
|
3058
|
+
const body = describeBody(args[0], headerOf(headers, "content-type"));
|
|
3059
|
+
const initiator = trimStack(new Error().stack, 1);
|
|
3060
|
+
id = log.start("xhr", { method, url, headers: [...headers], body, initiator });
|
|
3061
|
+
request.drop = watch(this, id, url, log);
|
|
3062
|
+
} catch {}
|
|
3063
|
+
try {
|
|
3064
|
+
return original.apply(this, args);
|
|
3065
|
+
} catch (error) {
|
|
3066
|
+
request.drop?.();
|
|
3067
|
+
request.drop = null;
|
|
3068
|
+
if (id !== null)
|
|
3069
|
+
log.set(id, { state: "failed", error: String(error) });
|
|
3070
|
+
throw error;
|
|
3071
|
+
}
|
|
3072
|
+
});
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
// src/requests/index.ts
|
|
3076
|
+
var HUSH_MOST = 100;
|
|
3077
|
+
var timer = typeof performance === "undefined" ? null : performance;
|
|
3078
|
+
var nativeNow = timer ? timer.now.bind(timer) : realNow;
|
|
3079
|
+
function pageClock() {
|
|
3080
|
+
const origin = timer ? timer.timeOrigin ?? realNow() - nativeNow() : 0;
|
|
3081
|
+
return { now: nativeNow, origin };
|
|
3082
|
+
}
|
|
3083
|
+
function bare2(url) {
|
|
3084
|
+
return absolute(url).split("#", 1)[0] ?? url;
|
|
3085
|
+
}
|
|
3086
|
+
function adopted(entry) {
|
|
3087
|
+
return {
|
|
3088
|
+
...entry,
|
|
3089
|
+
source: "frame",
|
|
3090
|
+
requestHeaders: entry.requestHeaders.map(([name, value]) => [name, value]),
|
|
3091
|
+
responseHeaders: entry.responseHeaders.map(([name, value]) => [name, value]),
|
|
3092
|
+
requestBody: entry.requestBody && { ...entry.requestBody },
|
|
3093
|
+
responseBody: entry.responseBody && { ...entry.responseBody },
|
|
3094
|
+
sizes: entry.sizes && { ...entry.sizes },
|
|
3095
|
+
timing: { ...entry.timing },
|
|
3096
|
+
phases: entry.phases && { ...entry.phases },
|
|
3097
|
+
messages: entry.messages.map((message) => ({ ...message }))
|
|
3098
|
+
};
|
|
3099
|
+
}
|
|
3100
|
+
function createRecorder(options) {
|
|
3101
|
+
const { source, clock: clock2, origin } = options;
|
|
3102
|
+
const seed = `${source.charAt(0)}${Math.floor(clock2.origin).toString(36)}${Math.floor(Math.random() * 46656).toString(36)}`;
|
|
3103
|
+
const store = createStore({ seed, now: () => clock2.origin + clock2.now(), schedule: options.schedule });
|
|
3104
|
+
const patches = [];
|
|
3105
|
+
let live = true;
|
|
3106
|
+
let quiet = 0;
|
|
3107
|
+
const always = new Set;
|
|
3108
|
+
let once = [];
|
|
3109
|
+
const log = createLog(store, clock2, source, () => live && quiet === 0);
|
|
3110
|
+
function hush(url, single) {
|
|
3111
|
+
const address = bare2(url);
|
|
3112
|
+
if (address.startsWith("data:"))
|
|
3113
|
+
return;
|
|
3114
|
+
if (!single)
|
|
3115
|
+
always.add(address);
|
|
3116
|
+
else
|
|
3117
|
+
once = [...once.slice(1 - HUSH_MOST), { url: address, at: clock2.now() }];
|
|
3118
|
+
}
|
|
3119
|
+
function hushed(entry) {
|
|
3120
|
+
if (always.has(entry.name))
|
|
3121
|
+
return true;
|
|
3122
|
+
const at = once.findIndex((mark2) => {
|
|
3123
|
+
const gap = entry.startTime - mark2.at;
|
|
3124
|
+
return mark2.url === entry.name && gap >= -MATCH_AFTER && gap <= MATCH_BEFORE;
|
|
3125
|
+
});
|
|
3126
|
+
if (at < 0)
|
|
3127
|
+
return false;
|
|
3128
|
+
once.splice(at, 1);
|
|
3129
|
+
return true;
|
|
3130
|
+
}
|
|
3131
|
+
function take(entry) {
|
|
3132
|
+
try {
|
|
3133
|
+
if (hushed(entry))
|
|
3134
|
+
return;
|
|
3135
|
+
const full = matchFull(store.entries(), entry, source);
|
|
3136
|
+
if (full)
|
|
3137
|
+
store.update(full.id, mergeTiming(full, entry, origin));
|
|
3138
|
+
else
|
|
3139
|
+
store.put(lightEntry(entry, store.nextId(), source, clock2, origin));
|
|
3140
|
+
} catch {}
|
|
3141
|
+
}
|
|
3142
|
+
function observe() {
|
|
3143
|
+
if (typeof PerformanceObserver !== "function")
|
|
3144
|
+
return () => {};
|
|
3145
|
+
const observer = new PerformanceObserver((list) => {
|
|
3146
|
+
if (live)
|
|
3147
|
+
for (const entry of list.getEntries())
|
|
3148
|
+
take(entry);
|
|
3149
|
+
});
|
|
3150
|
+
for (const type of ["navigation", "resource"]) {
|
|
3151
|
+
try {
|
|
3152
|
+
observer.observe({ type, buffered: true });
|
|
3153
|
+
} catch {}
|
|
3154
|
+
}
|
|
3155
|
+
return () => observer.disconnect();
|
|
3156
|
+
}
|
|
3157
|
+
let sentTo = null;
|
|
3158
|
+
function forward(changed) {
|
|
3159
|
+
const above = options.above?.() ?? null;
|
|
3160
|
+
if (above)
|
|
3161
|
+
above.adopt(above === sentTo ? changed : store.entries());
|
|
3162
|
+
sentTo = above;
|
|
3163
|
+
}
|
|
3164
|
+
function onHide(event) {
|
|
3165
|
+
if (Reflect.get(event, "persisted") === true)
|
|
3166
|
+
return;
|
|
3167
|
+
for (const row of [...store.entries()]) {
|
|
3168
|
+
if (row.state === "pending")
|
|
3169
|
+
store.update(row.id, { state: "aborted" });
|
|
3170
|
+
}
|
|
3171
|
+
store.flush();
|
|
3172
|
+
}
|
|
3173
|
+
install4(patches, globalThis, "fetch", (original) => wrapFetch(original, log, options.readFor));
|
|
3174
|
+
patchXhr(patches, log);
|
|
3175
|
+
patchEventSource(patches, log);
|
|
3176
|
+
const unobserve = observe();
|
|
3177
|
+
if (options.above) {
|
|
3178
|
+
store.subscribe(forward);
|
|
3179
|
+
globalThis.addEventListener?.("pagehide", onHide);
|
|
3180
|
+
}
|
|
3181
|
+
const recorder = {
|
|
3182
|
+
version: SHARED_VERSION,
|
|
3183
|
+
store,
|
|
3184
|
+
quietly(url, request) {
|
|
3185
|
+
hush(url, true);
|
|
3186
|
+
quiet++;
|
|
3187
|
+
try {
|
|
3188
|
+
return request();
|
|
3189
|
+
} finally {
|
|
3190
|
+
quiet--;
|
|
3191
|
+
}
|
|
3192
|
+
},
|
|
3193
|
+
hush,
|
|
3194
|
+
adopt(rows) {
|
|
3195
|
+
for (const row of rows)
|
|
3196
|
+
store.put(adopted(row));
|
|
3197
|
+
},
|
|
3198
|
+
uninstall() {
|
|
3199
|
+
live = false;
|
|
3200
|
+
restore(patches);
|
|
3201
|
+
unobserve();
|
|
3202
|
+
globalThis.removeEventListener?.("pagehide", onHide);
|
|
3203
|
+
store.close();
|
|
3204
|
+
if (shared() === recorder)
|
|
3205
|
+
share(null);
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
return recorder;
|
|
3209
|
+
}
|
|
3210
|
+
function above() {
|
|
3211
|
+
try {
|
|
3212
|
+
return window.parent === window ? null : shared(window.parent);
|
|
3213
|
+
} catch {
|
|
3214
|
+
return null;
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
function start() {
|
|
3218
|
+
if (shared())
|
|
3219
|
+
return;
|
|
3220
|
+
evict();
|
|
3221
|
+
const framed3 = typeof window !== "undefined" && isDevknobsFrame();
|
|
3222
|
+
const origin = typeof location === "undefined" ? "" : location.origin;
|
|
3223
|
+
share(createRecorder({
|
|
3224
|
+
source: framed3 ? "frame" : "top",
|
|
3225
|
+
clock: pageClock(),
|
|
3226
|
+
origin,
|
|
3227
|
+
above: framed3 ? above : undefined
|
|
3228
|
+
}));
|
|
3229
|
+
}
|
|
3230
|
+
function stop() {
|
|
3231
|
+
shared()?.uninstall();
|
|
3232
|
+
}
|
|
3233
|
+
function requestLog() {
|
|
3234
|
+
return shared()?.store ?? null;
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
// src/engine/header.ts
|
|
3238
|
+
var NOW_HEADER = "x-devknobs-now";
|
|
3239
|
+
var on = false;
|
|
3240
|
+
var installed2 = [];
|
|
3241
|
+
var ownOrigin = new WeakSet;
|
|
3242
|
+
function sends(clock2) {
|
|
3243
|
+
return clock2.header && clock2.mode !== "system";
|
|
3244
|
+
}
|
|
3245
|
+
function sameOrigin(url) {
|
|
3246
|
+
try {
|
|
3247
|
+
const { origin } = new URL(url, document.baseURI);
|
|
3248
|
+
return origin !== "null" && origin === location.origin;
|
|
3249
|
+
} catch {
|
|
3250
|
+
return false;
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
function stamp() {
|
|
3254
|
+
return new NativeDate(now()).toISOString();
|
|
3255
|
+
}
|
|
3256
|
+
function isRequest2(input) {
|
|
3257
|
+
return typeof input === "object" && "url" in input && "headers" in input;
|
|
3258
|
+
}
|
|
3259
|
+
function withHeader(input, init) {
|
|
3260
|
+
if (isRequest2(input) && init?.headers === undefined) {
|
|
3261
|
+
const copy = new Request(input);
|
|
3262
|
+
copy.headers.set(NOW_HEADER, stamp());
|
|
3263
|
+
return [copy, init];
|
|
3264
|
+
}
|
|
3265
|
+
const headers = new Headers(init?.headers);
|
|
3266
|
+
headers.set(NOW_HEADER, stamp());
|
|
3267
|
+
return [input, { ...init, headers }];
|
|
3268
|
+
}
|
|
3269
|
+
function install5(target, key, make) {
|
|
3270
|
+
const original = Reflect.get(target, key);
|
|
3271
|
+
if (typeof original !== "function")
|
|
3272
|
+
return;
|
|
3273
|
+
const value = make(original);
|
|
3274
|
+
if (Reflect.set(target, key, value))
|
|
3275
|
+
installed2.push({ target, key, original, value });
|
|
3276
|
+
}
|
|
3277
|
+
function patch() {
|
|
3278
|
+
if (installed2.length > 0)
|
|
3279
|
+
return;
|
|
3280
|
+
install5(globalThis, "fetch", (original) => function fetch(input, init) {
|
|
3281
|
+
const url = isRequest2(input) ? input.url : String(input);
|
|
3282
|
+
if (!on || !sameOrigin(url))
|
|
3283
|
+
return original.call(this, input, init);
|
|
3284
|
+
let args = [input, init];
|
|
3285
|
+
try {
|
|
3286
|
+
args = withHeader(input, init);
|
|
3287
|
+
} catch {}
|
|
3288
|
+
return original.call(this, ...args);
|
|
3289
|
+
});
|
|
3290
|
+
if (typeof XMLHttpRequest !== "function")
|
|
3291
|
+
return;
|
|
3292
|
+
const xhr = XMLHttpRequest.prototype;
|
|
3293
|
+
install5(xhr, "open", (original) => function(...args) {
|
|
3294
|
+
if (sameOrigin(String(args[1])))
|
|
3295
|
+
ownOrigin.add(this);
|
|
3296
|
+
else
|
|
3297
|
+
ownOrigin.delete(this);
|
|
3298
|
+
return original.apply(this, args);
|
|
3299
|
+
});
|
|
3300
|
+
install5(xhr, "send", (original) => function(...args) {
|
|
3301
|
+
if (on && ownOrigin.has(this)) {
|
|
3302
|
+
try {
|
|
3303
|
+
this.setRequestHeader(NOW_HEADER, stamp());
|
|
3304
|
+
} catch {}
|
|
3305
|
+
}
|
|
3306
|
+
return original.apply(this, args);
|
|
3307
|
+
});
|
|
3308
|
+
}
|
|
3309
|
+
function restore2() {
|
|
3310
|
+
for (const { target, key, original, value } of installed2.reverse()) {
|
|
3311
|
+
if (Reflect.get(target, key) === value)
|
|
3312
|
+
Reflect.set(target, key, original);
|
|
3313
|
+
}
|
|
3314
|
+
installed2 = [];
|
|
3315
|
+
}
|
|
3316
|
+
function apply11(value) {
|
|
3317
|
+
on = sends(value);
|
|
3318
|
+
if (on)
|
|
3319
|
+
patch();
|
|
3320
|
+
else
|
|
3321
|
+
restore2();
|
|
3322
|
+
}
|
|
3323
|
+
function reset10() {
|
|
3324
|
+
on = false;
|
|
3325
|
+
restore2();
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3328
|
+
// src/engine/network.ts
|
|
3329
|
+
var CONNECTIONS = {
|
|
3330
|
+
"slow-2g": { rtt: 2000, downlink: 0.05 },
|
|
3331
|
+
"2g": { rtt: 1400, downlink: 0.07 },
|
|
3332
|
+
"3g": { rtt: 270, downlink: 0.7 },
|
|
3333
|
+
"4g": { rtt: 50, downlink: 10 }
|
|
3334
|
+
};
|
|
3335
|
+
var CONNECTION_KEYS = ["effectiveType", "rtt", "downlink", "saveData"];
|
|
3336
|
+
var SYSTEM = { online: "system", type: "system", saveData: "system" };
|
|
3337
|
+
var shadowed = new Map;
|
|
3338
|
+
function shadow(target, key, value) {
|
|
3339
|
+
Object.defineProperty(target, key, { configurable: true, enumerable: true, get: () => value });
|
|
3340
|
+
const keys = shadowed.get(target) ?? new Set;
|
|
3341
|
+
keys.add(key);
|
|
3342
|
+
shadowed.set(target, keys);
|
|
3343
|
+
}
|
|
3344
|
+
function unshadow(target, key) {
|
|
3345
|
+
if (shadowed.get(target)?.delete(key))
|
|
3346
|
+
Reflect.deleteProperty(target, key);
|
|
3347
|
+
}
|
|
3348
|
+
function connection() {
|
|
3349
|
+
const value = navigator.connection;
|
|
3350
|
+
return value instanceof EventTarget ? value : null;
|
|
3351
|
+
}
|
|
3352
|
+
function readConnection(target) {
|
|
3353
|
+
return CONNECTION_KEYS.map((key) => String(Reflect.get(target, key))).join();
|
|
3354
|
+
}
|
|
3355
|
+
function apply12(value) {
|
|
3356
|
+
const wasOnline = navigator.onLine;
|
|
3357
|
+
if (value.online === "offline")
|
|
3358
|
+
shadow(navigator, "onLine", false);
|
|
3359
|
+
else
|
|
3360
|
+
unshadow(navigator, "onLine");
|
|
3361
|
+
if (navigator.onLine !== wasOnline) {
|
|
3362
|
+
window.dispatchEvent(new Event(navigator.onLine ? "online" : "offline"));
|
|
3363
|
+
}
|
|
3364
|
+
const target = connection();
|
|
3365
|
+
if (!target)
|
|
3366
|
+
return;
|
|
3367
|
+
const before2 = readConnection(target);
|
|
3368
|
+
if (value.type === "system") {
|
|
3369
|
+
for (const key of ["effectiveType", "rtt", "downlink"])
|
|
3370
|
+
unshadow(target, key);
|
|
3371
|
+
} else {
|
|
3372
|
+
shadow(target, "effectiveType", value.type);
|
|
3373
|
+
shadow(target, "rtt", CONNECTIONS[value.type].rtt);
|
|
3374
|
+
shadow(target, "downlink", CONNECTIONS[value.type].downlink);
|
|
3375
|
+
}
|
|
3376
|
+
if (value.saveData === "system")
|
|
3377
|
+
unshadow(target, "saveData");
|
|
3378
|
+
else
|
|
3379
|
+
shadow(target, "saveData", value.saveData === "on");
|
|
3380
|
+
if (readConnection(target) !== before2)
|
|
3381
|
+
target.dispatchEvent(new Event("change"));
|
|
3382
|
+
}
|
|
3383
|
+
function reset11() {
|
|
3384
|
+
if (shadowed.size > 0)
|
|
3385
|
+
apply12(SYSTEM);
|
|
3386
|
+
shadowed.clear();
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
// src/engine/outlines.ts
|
|
3390
|
+
var NAME = "outlines";
|
|
3391
|
+
function apply13(value) {
|
|
3392
|
+
if (!value) {
|
|
3393
|
+
reset12();
|
|
3394
|
+
return;
|
|
3395
|
+
}
|
|
3396
|
+
ensureStyle(NAME).textContent = "body *:not([data-devknobs],[data-devknobs] *){outline:1px solid rgba(127,127,127,.5)!important}";
|
|
3397
|
+
}
|
|
3398
|
+
function reset12() {
|
|
3399
|
+
removeStyle(NAME);
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
// src/engine/tree.ts
|
|
3403
|
+
function isOwn(node) {
|
|
3404
|
+
let current = node;
|
|
3405
|
+
while (current) {
|
|
3406
|
+
if (current instanceof Element && current.closest("[data-devknobs]"))
|
|
3407
|
+
return true;
|
|
3408
|
+
const root = current.getRootNode();
|
|
3409
|
+
current = root instanceof ShadowRoot ? root.host : null;
|
|
3410
|
+
}
|
|
3411
|
+
return false;
|
|
3412
|
+
}
|
|
3413
|
+
function walk(visit) {
|
|
3414
|
+
const pending = [document];
|
|
3415
|
+
for (let root = pending.pop();root; root = pending.pop()) {
|
|
3416
|
+
for (const element of Array.from(root.querySelectorAll("*"))) {
|
|
3417
|
+
if (element.hasAttribute("data-devknobs"))
|
|
3418
|
+
continue;
|
|
3419
|
+
visit(element);
|
|
3420
|
+
if (element.shadowRoot)
|
|
3421
|
+
pending.push(element.shadowRoot);
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
function shadowRoots() {
|
|
3426
|
+
const roots = [];
|
|
3427
|
+
walk((element) => {
|
|
3428
|
+
if (element.shadowRoot)
|
|
3429
|
+
roots.push(element.shadowRoot);
|
|
3430
|
+
});
|
|
3431
|
+
return roots;
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3434
|
+
// src/engine/overflow.ts
|
|
3435
|
+
var Z_INDEX = 2147483644;
|
|
3436
|
+
var MUTATION_THROTTLE = 250;
|
|
3437
|
+
var SLACK = 0.5;
|
|
3438
|
+
var CSS = `
|
|
3439
|
+
.mark {
|
|
3440
|
+
position: absolute;
|
|
3441
|
+
box-sizing: border-box;
|
|
3442
|
+
border: 1px solid #e5484d;
|
|
3443
|
+
background: rgba(229, 72, 77, 0.12);
|
|
3444
|
+
}
|
|
3445
|
+
`;
|
|
3446
|
+
var host2 = null;
|
|
3447
|
+
var layer = null;
|
|
3448
|
+
var sheet = null;
|
|
3449
|
+
var observer = null;
|
|
3450
|
+
var frame2 = 0;
|
|
3451
|
+
var timer2 = 0;
|
|
3452
|
+
var count = 0;
|
|
3453
|
+
var logged = new WeakSet;
|
|
3454
|
+
var loggedUnfound = false;
|
|
3455
|
+
var listeners = new Set;
|
|
3456
|
+
function overflowCount() {
|
|
3457
|
+
return count;
|
|
3458
|
+
}
|
|
3459
|
+
function onCount(listener) {
|
|
3460
|
+
listeners.add(listener);
|
|
3461
|
+
return () => {
|
|
3462
|
+
listeners.delete(listener);
|
|
3463
|
+
};
|
|
3464
|
+
}
|
|
3465
|
+
function setCount(next) {
|
|
3466
|
+
if (next === count)
|
|
3467
|
+
return;
|
|
3468
|
+
count = next;
|
|
3469
|
+
for (const listener of Array.from(listeners))
|
|
3470
|
+
listener(count);
|
|
3471
|
+
}
|
|
3472
|
+
function parentOf(element) {
|
|
3473
|
+
if (element.assignedSlot)
|
|
3474
|
+
return element.assignedSlot;
|
|
3475
|
+
if (element.parentElement)
|
|
3476
|
+
return element.parentElement;
|
|
3477
|
+
const root = element.getRootNode();
|
|
3478
|
+
return root instanceof ShadowRoot ? root.host : null;
|
|
3479
|
+
}
|
|
3480
|
+
function clipped(element) {
|
|
3481
|
+
const root = document.documentElement;
|
|
3482
|
+
const rootStyle = getComputedStyle(root);
|
|
3483
|
+
const viewport = rootStyle.overflowX === "visible" && rootStyle.overflowY === "visible" ? document.body : root;
|
|
3484
|
+
for (let node = parentOf(element);node; node = parentOf(node)) {
|
|
3485
|
+
const overflow = getComputedStyle(node).overflowX;
|
|
3486
|
+
if (node === root || node === viewport) {
|
|
3487
|
+
if (overflow === "hidden" || overflow === "clip")
|
|
3488
|
+
return true;
|
|
3489
|
+
continue;
|
|
3490
|
+
}
|
|
3491
|
+
if (overflow !== "visible")
|
|
3492
|
+
return true;
|
|
3493
|
+
}
|
|
3494
|
+
return false;
|
|
3495
|
+
}
|
|
3496
|
+
function startsIt(element, rect, right, left) {
|
|
3497
|
+
for (let node = parentOf(element);node; node = parentOf(node)) {
|
|
3498
|
+
const outer = node.getBoundingClientRect();
|
|
3499
|
+
if (outer.width === 0 && outer.height === 0)
|
|
3500
|
+
continue;
|
|
3501
|
+
return right && rect.right > outer.right + SLACK || left && rect.left < outer.left - SLACK;
|
|
3502
|
+
}
|
|
3503
|
+
return true;
|
|
3504
|
+
}
|
|
3505
|
+
function find() {
|
|
3506
|
+
const width = document.documentElement.clientWidth;
|
|
3507
|
+
const offenders = [];
|
|
3508
|
+
walk((element) => {
|
|
3509
|
+
const rect = element.getBoundingClientRect();
|
|
3510
|
+
if (rect.width === 0 && rect.height === 0)
|
|
3511
|
+
return;
|
|
3512
|
+
const right = rect.right + window.scrollX > width + SLACK;
|
|
3513
|
+
const left = rect.left + window.scrollX < -SLACK;
|
|
3514
|
+
if (!right && !left)
|
|
3515
|
+
return;
|
|
3516
|
+
if (!startsIt(element, rect, right, left) || clipped(element))
|
|
3517
|
+
return;
|
|
3518
|
+
offenders.push({ element, rect });
|
|
3519
|
+
});
|
|
3520
|
+
return offenders;
|
|
3521
|
+
}
|
|
3522
|
+
function log(offenders, excess) {
|
|
3523
|
+
const width = document.documentElement.clientWidth;
|
|
3524
|
+
if (offenders.length === 0) {
|
|
3525
|
+
if (excess > 0 && !loggedUnfound) {
|
|
3526
|
+
loggedUnfound = true;
|
|
3527
|
+
console.warn(`devknobs: the page scrolls ${excess}px past the ${width}px viewport, ` + "but no element box sticks out. a pseudo-element or a margin, maybe");
|
|
3528
|
+
}
|
|
3529
|
+
return;
|
|
3530
|
+
}
|
|
3531
|
+
if (offenders.every(({ element }) => logged.has(element)))
|
|
3532
|
+
return;
|
|
3533
|
+
for (const { element } of offenders)
|
|
3534
|
+
logged.add(element);
|
|
3535
|
+
console.warn(warning(offenders.length, width, excess), offenders.map(({ element }) => element));
|
|
3536
|
+
}
|
|
3537
|
+
function warning(count2, width, excess) {
|
|
3538
|
+
const boxes = count2 === 1 ? "1 element sticks" : `${count2} elements stick`;
|
|
3539
|
+
return `devknobs: ${boxes} out of the ${width}px viewport, the page scrolls ${excess}px sideways`;
|
|
3540
|
+
}
|
|
3541
|
+
function draw(offenders) {
|
|
3542
|
+
if (!layer)
|
|
3543
|
+
return;
|
|
3544
|
+
const marks = offenders.map(({ rect }) => {
|
|
3545
|
+
const mark2 = document.createElement("div");
|
|
3546
|
+
mark2.className = "mark";
|
|
3547
|
+
mark2.style.cssText = `left:${rect.left}px;top:${rect.top}px;width:${rect.width}px;height:${rect.height}px`;
|
|
3548
|
+
return mark2;
|
|
3549
|
+
});
|
|
3550
|
+
const node = sheet && styleNode(sheet);
|
|
3551
|
+
layer.replaceChildren(...node ? [node] : [], ...marks);
|
|
3552
|
+
}
|
|
3553
|
+
function update() {
|
|
3554
|
+
if (!host2)
|
|
3555
|
+
return;
|
|
3556
|
+
const root = document.documentElement;
|
|
3557
|
+
const offenders = find();
|
|
3558
|
+
draw(offenders);
|
|
3559
|
+
log(offenders, Math.max(0, root.scrollWidth - root.clientWidth));
|
|
3560
|
+
setCount(offenders.length);
|
|
3561
|
+
}
|
|
3562
|
+
function schedule() {
|
|
3563
|
+
if (frame2 || !host2)
|
|
3564
|
+
return;
|
|
3565
|
+
frame2 = requestAnimationFrame(() => {
|
|
3566
|
+
frame2 = 0;
|
|
3567
|
+
update();
|
|
3568
|
+
});
|
|
3569
|
+
}
|
|
3570
|
+
function onMutation(records) {
|
|
3571
|
+
if (timer2 || records.every((record) => isOwn(record.target)))
|
|
3572
|
+
return;
|
|
3573
|
+
timer2 = window.setTimeout(() => {
|
|
3574
|
+
timer2 = 0;
|
|
3575
|
+
schedule();
|
|
3576
|
+
}, MUTATION_THROTTLE);
|
|
3577
|
+
}
|
|
3578
|
+
function start2() {
|
|
3579
|
+
if (host2 || !document.body)
|
|
3580
|
+
return;
|
|
3581
|
+
host2 = document.createElement("div");
|
|
3582
|
+
host2.setAttribute("data-devknobs", "overflow");
|
|
3583
|
+
host2.style.cssText = `position:fixed;inset:0;overflow:hidden;pointer-events:none;z-index:${Z_INDEX}`;
|
|
3584
|
+
layer = host2.attachShadow({ mode: "open" });
|
|
3585
|
+
sheet = addStyle(layer, CSS);
|
|
3586
|
+
document.body.append(host2);
|
|
3587
|
+
window.addEventListener("resize", schedule);
|
|
3588
|
+
window.addEventListener("scroll", schedule, true);
|
|
3589
|
+
observer = new MutationObserver(onMutation);
|
|
3590
|
+
observer.observe(document.documentElement, {
|
|
3591
|
+
attributes: true,
|
|
3592
|
+
characterData: true,
|
|
3593
|
+
childList: true,
|
|
3594
|
+
subtree: true
|
|
3595
|
+
});
|
|
3596
|
+
update();
|
|
3597
|
+
}
|
|
3598
|
+
function apply14(value) {
|
|
3599
|
+
if (!value) {
|
|
3600
|
+
reset13();
|
|
3601
|
+
return;
|
|
3602
|
+
}
|
|
3603
|
+
if (document.body)
|
|
3604
|
+
start2();
|
|
3605
|
+
else
|
|
3606
|
+
document.addEventListener("DOMContentLoaded", start2, { once: true });
|
|
3607
|
+
}
|
|
3608
|
+
function reset13() {
|
|
3609
|
+
document.removeEventListener("DOMContentLoaded", start2);
|
|
3610
|
+
if (!host2)
|
|
3611
|
+
return;
|
|
3612
|
+
window.removeEventListener("resize", schedule);
|
|
3613
|
+
window.removeEventListener("scroll", schedule, true);
|
|
3614
|
+
observer?.disconnect();
|
|
3615
|
+
observer = null;
|
|
3616
|
+
if (frame2) {
|
|
3617
|
+
cancelAnimationFrame(frame2);
|
|
3618
|
+
frame2 = 0;
|
|
3619
|
+
}
|
|
3620
|
+
clearTimeout(timer2);
|
|
3621
|
+
timer2 = 0;
|
|
3622
|
+
host2.remove();
|
|
3623
|
+
host2 = null;
|
|
3624
|
+
layer = null;
|
|
3625
|
+
sheet = null;
|
|
3626
|
+
logged = new WeakSet;
|
|
3627
|
+
loggedUnfound = false;
|
|
3628
|
+
setCount(0);
|
|
3629
|
+
}
|
|
3630
|
+
|
|
3631
|
+
// src/engine/pseudo.ts
|
|
3632
|
+
var PLAIN = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
3633
|
+
var ACCENTED = "áƀçðéƒĝĥîĵķļɱñöþǫŕšţûṽŵẋýžÅƁÇÐÉƑĜĤÎĴĶĻṀÑÖÞǪŔŜŢÛṼŴẊÝŽ";
|
|
3634
|
+
var accented = Array.from(ACCENTED);
|
|
3635
|
+
var ACCENTS = new Map(Array.from(PLAIN, (char, i) => [char, accented[i] ?? char]));
|
|
3636
|
+
var GROWTH = 0.35;
|
|
3637
|
+
var ATTRIBUTES = ["placeholder", "title", "aria-label", "alt"];
|
|
3638
|
+
var SKIPPED = "script,style,noscript,textarea,option:not([value]),[data-devknobs]";
|
|
3639
|
+
var LETTER = /\p{L}/u;
|
|
3640
|
+
function pseudoText(text2) {
|
|
3641
|
+
const core = text2.trim();
|
|
3642
|
+
if (!LETTER.test(core))
|
|
3643
|
+
return text2;
|
|
3644
|
+
const start3 = text2.indexOf(core);
|
|
3645
|
+
let accented2 = "";
|
|
3646
|
+
for (const char of core)
|
|
3647
|
+
accented2 += ACCENTS.get(char) ?? char;
|
|
3648
|
+
const padding = "·".repeat(Math.ceil(core.length * GROWTH));
|
|
3649
|
+
return `${text2.slice(0, start3)}[${accented2} ${padding}]${text2.slice(start3 + core.length)}`;
|
|
3650
|
+
}
|
|
3651
|
+
var texts = new WeakMap;
|
|
3652
|
+
var attributes = new WeakMap;
|
|
3653
|
+
var originals = new Map;
|
|
3654
|
+
var swapped = new Set;
|
|
3655
|
+
var on2 = false;
|
|
3656
|
+
var observer2 = null;
|
|
3657
|
+
var cancelStart = null;
|
|
3658
|
+
function skipped(element) {
|
|
3659
|
+
if (!element)
|
|
3660
|
+
return true;
|
|
3661
|
+
return element.isContentEditable || element.closest(SKIPPED) !== null;
|
|
3662
|
+
}
|
|
3663
|
+
function unwrap(text2) {
|
|
3664
|
+
let next = text2;
|
|
3665
|
+
if (!next.includes("·]"))
|
|
3666
|
+
return next;
|
|
3667
|
+
for (const [pseudo, original] of originals) {
|
|
3668
|
+
if (next.includes(pseudo))
|
|
3669
|
+
next = next.split(pseudo).join(original);
|
|
3670
|
+
}
|
|
3671
|
+
return next;
|
|
3672
|
+
}
|
|
3673
|
+
function wrap(original) {
|
|
3674
|
+
const pseudo = pseudoText(original);
|
|
3675
|
+
if (pseudo !== original)
|
|
3676
|
+
originals.set(pseudo.trim(), original.trim());
|
|
3677
|
+
return pseudo;
|
|
3678
|
+
}
|
|
3679
|
+
function swapText(node) {
|
|
3680
|
+
const known = texts.get(node);
|
|
3681
|
+
if (known && node.data === known.pseudo)
|
|
3682
|
+
return;
|
|
3683
|
+
const original = unwrap(node.data);
|
|
3684
|
+
const pseudo = wrap(original);
|
|
3685
|
+
if (pseudo === original)
|
|
3686
|
+
return;
|
|
3687
|
+
if (!known)
|
|
3688
|
+
swapped.add(new WeakRef(node));
|
|
3689
|
+
texts.set(node, { original, pseudo });
|
|
3690
|
+
node.data = pseudo;
|
|
3691
|
+
}
|
|
3692
|
+
function swapAttribute(element, name) {
|
|
3693
|
+
const read = element.getAttribute(name);
|
|
3694
|
+
if (read === null)
|
|
3695
|
+
return;
|
|
3696
|
+
let swaps = attributes.get(element);
|
|
3697
|
+
const known = swaps?.get(name);
|
|
3698
|
+
if (known && read === known.pseudo)
|
|
3699
|
+
return;
|
|
3700
|
+
const value = unwrap(read);
|
|
3701
|
+
const pseudo = wrap(value);
|
|
3702
|
+
if (pseudo === value)
|
|
3703
|
+
return;
|
|
3704
|
+
if (!swaps) {
|
|
3705
|
+
swaps = new Map;
|
|
3706
|
+
attributes.set(element, swaps);
|
|
3707
|
+
swapped.add(new WeakRef(element));
|
|
3708
|
+
}
|
|
3709
|
+
swaps.set(name, { original: value, pseudo });
|
|
3710
|
+
element.setAttribute(name, pseudo);
|
|
3711
|
+
}
|
|
3712
|
+
function walk2(root, visit) {
|
|
3713
|
+
const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, {
|
|
3714
|
+
acceptNode: (node) => node.nodeType === Node.ELEMENT_NODE && (node.isContentEditable || node.matches(SKIPPED)) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
|
|
3715
|
+
});
|
|
3716
|
+
visit(root);
|
|
3717
|
+
for (let node = walker.nextNode();node; node = walker.nextNode())
|
|
3718
|
+
visit(node);
|
|
3719
|
+
}
|
|
3720
|
+
function swapNode(node) {
|
|
3721
|
+
if (node.nodeType === Node.TEXT_NODE)
|
|
3722
|
+
swapText(node);
|
|
3723
|
+
else
|
|
3724
|
+
for (const name of ATTRIBUTES)
|
|
3725
|
+
swapAttribute(node, name);
|
|
3726
|
+
}
|
|
3727
|
+
function swapTree(root) {
|
|
3728
|
+
if (root.nodeType === Node.TEXT_NODE) {
|
|
3729
|
+
if (!skipped(root.parentElement))
|
|
3730
|
+
swapText(root);
|
|
3731
|
+
return;
|
|
3732
|
+
}
|
|
3733
|
+
if (root.nodeType !== Node.ELEMENT_NODE || skipped(root))
|
|
3734
|
+
return;
|
|
3735
|
+
walk2(root, swapNode);
|
|
3736
|
+
}
|
|
3737
|
+
function restoreNode(node) {
|
|
3738
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
3739
|
+
const text2 = node;
|
|
3740
|
+
const known = texts.get(text2);
|
|
3741
|
+
if (known && text2.data === known.pseudo)
|
|
3742
|
+
text2.data = known.original;
|
|
3743
|
+
texts.delete(text2);
|
|
3744
|
+
return;
|
|
3745
|
+
}
|
|
3746
|
+
const element = node;
|
|
3747
|
+
const swaps = attributes.get(element);
|
|
3748
|
+
if (!swaps)
|
|
3749
|
+
return;
|
|
3750
|
+
for (const [name, swap] of swaps) {
|
|
3751
|
+
if (element.getAttribute(name) === swap.pseudo)
|
|
3752
|
+
element.setAttribute(name, swap.original);
|
|
3753
|
+
}
|
|
3754
|
+
attributes.delete(element);
|
|
3755
|
+
}
|
|
3756
|
+
function onMutations(records) {
|
|
3757
|
+
for (const record of records) {
|
|
3758
|
+
if (record.type === "childList") {
|
|
3759
|
+
for (const node of Array.from(record.addedNodes))
|
|
3760
|
+
swapTree(node);
|
|
3761
|
+
} else if (record.type === "characterData") {
|
|
3762
|
+
const node = record.target;
|
|
3763
|
+
if (!skipped(node.parentElement))
|
|
3764
|
+
swapText(node);
|
|
3765
|
+
} else if (record.attributeName) {
|
|
3766
|
+
const element = record.target;
|
|
3767
|
+
if (!skipped(element))
|
|
3768
|
+
swapAttribute(element, record.attributeName);
|
|
3769
|
+
}
|
|
3770
|
+
}
|
|
3771
|
+
observer2?.takeRecords();
|
|
3772
|
+
}
|
|
3773
|
+
function start3() {
|
|
3774
|
+
cancelStart = null;
|
|
3775
|
+
const body = document.body;
|
|
3776
|
+
if (!body)
|
|
3777
|
+
return;
|
|
3778
|
+
on2 = true;
|
|
3779
|
+
swapTree(body);
|
|
3780
|
+
observer2 = new MutationObserver(onMutations);
|
|
3781
|
+
observer2.observe(body, {
|
|
3782
|
+
childList: true,
|
|
3783
|
+
subtree: true,
|
|
3784
|
+
characterData: true,
|
|
3785
|
+
attributes: true,
|
|
3786
|
+
attributeFilter: ATTRIBUTES
|
|
3787
|
+
});
|
|
3788
|
+
}
|
|
3789
|
+
function whenIdle(run) {
|
|
3790
|
+
let idle2 = 0;
|
|
3791
|
+
let timer3 = 0;
|
|
3792
|
+
const schedule2 = () => {
|
|
3793
|
+
if (typeof requestIdleCallback === "function")
|
|
3794
|
+
idle2 = requestIdleCallback(run, { timeout: 1000 });
|
|
3795
|
+
else
|
|
3796
|
+
timer3 = window.setTimeout(run, 200);
|
|
3797
|
+
};
|
|
3798
|
+
if (document.readyState === "complete")
|
|
3799
|
+
schedule2();
|
|
3800
|
+
else
|
|
3801
|
+
window.addEventListener("load", schedule2, { once: true });
|
|
3802
|
+
return () => {
|
|
3803
|
+
window.removeEventListener("load", schedule2);
|
|
3804
|
+
if (idle2)
|
|
3805
|
+
cancelIdleCallback(idle2);
|
|
3806
|
+
clearTimeout(timer3);
|
|
3807
|
+
};
|
|
3808
|
+
}
|
|
3809
|
+
function apply15(value) {
|
|
3810
|
+
if (!value) {
|
|
3811
|
+
reset14();
|
|
3812
|
+
return;
|
|
3813
|
+
}
|
|
3814
|
+
if (on2 || cancelStart)
|
|
3815
|
+
return;
|
|
3816
|
+
cancelStart = whenIdle(start3);
|
|
3817
|
+
}
|
|
3818
|
+
function pending() {
|
|
3819
|
+
return cancelStart !== null;
|
|
3820
|
+
}
|
|
3821
|
+
function reset14() {
|
|
3822
|
+
cancelStart?.();
|
|
3823
|
+
cancelStart = null;
|
|
3824
|
+
if (!on2)
|
|
3825
|
+
return;
|
|
3826
|
+
on2 = false;
|
|
3827
|
+
observer2?.disconnect();
|
|
3828
|
+
observer2 = null;
|
|
3829
|
+
for (const ref of swapped) {
|
|
3830
|
+
const node = ref.deref();
|
|
3831
|
+
if (node)
|
|
3832
|
+
restoreNode(node);
|
|
3833
|
+
}
|
|
3834
|
+
swapped.clear();
|
|
3835
|
+
originals.clear();
|
|
3836
|
+
}
|
|
3837
|
+
|
|
3838
|
+
// src/engine/ready.ts
|
|
3839
|
+
var READY_WAIT = 1e4;
|
|
3840
|
+
function whenSettled(settled, leaving2, value, mounted, wait = READY_WAIT) {
|
|
3841
|
+
return new Promise((resolve, reject) => {
|
|
3842
|
+
const notMounted = () => new Error("devknobs: not mounted");
|
|
3843
|
+
if (!mounted()) {
|
|
3844
|
+
reject(notMounted());
|
|
3845
|
+
return;
|
|
3846
|
+
}
|
|
3847
|
+
let frame3 = 0;
|
|
3848
|
+
const stop2 = () => {
|
|
3849
|
+
window.cancelAnimationFrame(frame3);
|
|
3850
|
+
window.clearTimeout(timer3);
|
|
3851
|
+
};
|
|
3852
|
+
const check = () => {
|
|
3853
|
+
if (leaving2())
|
|
3854
|
+
return stop2();
|
|
3855
|
+
if (!mounted()) {
|
|
3856
|
+
stop2();
|
|
3857
|
+
reject(notMounted());
|
|
3858
|
+
return;
|
|
3859
|
+
}
|
|
3860
|
+
if (!settled()) {
|
|
3861
|
+
frame3 = window.requestAnimationFrame(check);
|
|
3862
|
+
return;
|
|
3863
|
+
}
|
|
3864
|
+
stop2();
|
|
3865
|
+
resolve(value());
|
|
3866
|
+
};
|
|
3867
|
+
const timer3 = window.setTimeout(() => {
|
|
3868
|
+
stop2();
|
|
3869
|
+
if (leaving2())
|
|
3870
|
+
return;
|
|
3871
|
+
if (!mounted())
|
|
3872
|
+
reject(notMounted());
|
|
3873
|
+
else if (settled())
|
|
3874
|
+
resolve(value());
|
|
3875
|
+
else
|
|
3876
|
+
reject(new Error("devknobs: not settled after 10 seconds"));
|
|
3877
|
+
}, wait);
|
|
3878
|
+
frame3 = window.requestAnimationFrame(check);
|
|
3879
|
+
});
|
|
3880
|
+
}
|
|
3881
|
+
|
|
3882
|
+
// src/engine/animations.ts
|
|
3883
|
+
function targetOf(animation) {
|
|
3884
|
+
const effect = animation.effect;
|
|
3885
|
+
return effect instanceof KeyframeEffect ? effect.target : null;
|
|
3886
|
+
}
|
|
3887
|
+
function onDocumentTimeline(animation) {
|
|
3888
|
+
return animation.timeline instanceof DocumentTimeline;
|
|
3889
|
+
}
|
|
3890
|
+
function collect(roots = shadowRoots()) {
|
|
3891
|
+
const found = new Set;
|
|
3892
|
+
const scopes = [document, ...roots];
|
|
3893
|
+
for (const scope of scopes) {
|
|
3894
|
+
if (typeof scope.getAnimations !== "function")
|
|
3895
|
+
continue;
|
|
3896
|
+
for (const animation of scope.getAnimations())
|
|
3897
|
+
found.add(animation);
|
|
3898
|
+
}
|
|
3899
|
+
return Array.from(found).filter((animation) => !isOwn(targetOf(animation)));
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3902
|
+
// src/engine/replay.ts
|
|
3903
|
+
var MARK = "data-devknobs-replay";
|
|
3904
|
+
var BOXES = [
|
|
3905
|
+
["", "self"],
|
|
3906
|
+
["::before", "before"],
|
|
3907
|
+
["::after", "after"]
|
|
3908
|
+
];
|
|
3909
|
+
var MARKED = BOXES.map(([pseudo, token]) => `[${MARK}~="${token}"]${pseudo}`).join(",");
|
|
3910
|
+
var RESTART = `${MARKED}{animation:none!important}`;
|
|
3911
|
+
function key(pseudo, name) {
|
|
3912
|
+
return `${pseudo} ${name}`;
|
|
3913
|
+
}
|
|
3914
|
+
function liveCss(animations) {
|
|
3915
|
+
const live = new Map;
|
|
3916
|
+
for (const animation of animations) {
|
|
3917
|
+
const target = targetOf(animation);
|
|
3918
|
+
if (!target || !(animation instanceof CSSAnimation))
|
|
3919
|
+
continue;
|
|
3920
|
+
const pseudo = animation.effect.pseudoElement ?? "";
|
|
3921
|
+
const names = live.get(target) ?? new Set;
|
|
3922
|
+
names.add(key(pseudo, animation.animationName));
|
|
3923
|
+
live.set(target, names);
|
|
3924
|
+
}
|
|
3925
|
+
return live;
|
|
3926
|
+
}
|
|
3927
|
+
function finished(element, pseudo, live) {
|
|
3928
|
+
const style = getComputedStyle(element, pseudo || null);
|
|
3929
|
+
if (style.animationName === "none")
|
|
3930
|
+
return false;
|
|
3931
|
+
const timelines = style.getPropertyValue("animation-timeline");
|
|
3932
|
+
if (timelines && timelines.split(",").some((timeline) => timeline.trim() !== "auto")) {
|
|
3933
|
+
return false;
|
|
3934
|
+
}
|
|
3935
|
+
return style.animationName.split(",").map((name) => name.trim()).some((name) => name !== "none" && !live?.has(key(pseudo, name)));
|
|
3936
|
+
}
|
|
3937
|
+
function restartFinished(live) {
|
|
3938
|
+
const marked = [];
|
|
3939
|
+
const roots = new Set;
|
|
3940
|
+
walk((element) => {
|
|
3941
|
+
const names = live.get(element);
|
|
3942
|
+
const tokens = BOXES.filter(([pseudo]) => finished(element, pseudo, names)).map(([, token]) => token);
|
|
3943
|
+
if (tokens.length === 0)
|
|
3944
|
+
return;
|
|
3945
|
+
element.setAttribute(MARK, tokens.join(" "));
|
|
3946
|
+
marked.push(element);
|
|
3947
|
+
roots.add(element.getRootNode());
|
|
3948
|
+
});
|
|
3949
|
+
if (marked.length === 0)
|
|
3950
|
+
return;
|
|
3951
|
+
const styles = Array.from(roots, (root) => addStyle(root, RESTART));
|
|
3952
|
+
document.documentElement.offsetHeight;
|
|
3953
|
+
for (const style of styles)
|
|
3954
|
+
style.remove();
|
|
3955
|
+
for (const element of marked)
|
|
3956
|
+
element.removeAttribute(MARK);
|
|
3957
|
+
}
|
|
3958
|
+
function replay() {
|
|
3959
|
+
const animations = collect();
|
|
3960
|
+
const live = liveCss(animations);
|
|
3961
|
+
for (const animation of animations) {
|
|
3962
|
+
if (!onDocumentTimeline(animation))
|
|
3963
|
+
continue;
|
|
3964
|
+
animation.cancel();
|
|
3965
|
+
animation.play();
|
|
3966
|
+
}
|
|
3967
|
+
restartFinished(live);
|
|
3968
|
+
}
|
|
3969
|
+
|
|
3970
|
+
// src/engine/spacing.ts
|
|
3971
|
+
var NAME2 = "spacing";
|
|
3972
|
+
var NOT_OURS = ":not([data-devknobs],[data-devknobs] *)";
|
|
3973
|
+
var CSS2 = `*${NOT_OURS}{line-height:1.5!important;letter-spacing:.12em!important;word-spacing:.16em!important}` + `p${NOT_OURS}{margin-bottom:2em!important}`;
|
|
3974
|
+
function apply16(value) {
|
|
3975
|
+
if (!value) {
|
|
3976
|
+
reset15();
|
|
3977
|
+
return;
|
|
3978
|
+
}
|
|
3979
|
+
ensureStyle(NAME2).textContent = CSS2;
|
|
3980
|
+
}
|
|
3981
|
+
function reset15() {
|
|
3982
|
+
removeStyle(NAME2);
|
|
3983
|
+
}
|
|
3984
|
+
|
|
3985
|
+
// src/engine/speed.ts
|
|
3986
|
+
var SPEED_MIN = 0;
|
|
3987
|
+
var SPEED_MAX = 16;
|
|
3988
|
+
var ROOT_INTERVAL = 500;
|
|
3989
|
+
var rate = 1;
|
|
3990
|
+
var originals2 = new Map;
|
|
3991
|
+
var roots = [];
|
|
3992
|
+
var lastWalk = 0;
|
|
3993
|
+
var frame3 = 0;
|
|
3994
|
+
var listening = false;
|
|
3995
|
+
var nativeAnimate = null;
|
|
3996
|
+
var patchedAnimate = null;
|
|
3997
|
+
var gsapScale = null;
|
|
3998
|
+
var gsapRate = 1;
|
|
3999
|
+
function setRate(animation, value) {
|
|
4000
|
+
if (typeof animation.updatePlaybackRate === "function")
|
|
4001
|
+
animation.updatePlaybackRate(value);
|
|
4002
|
+
else
|
|
4003
|
+
animation.playbackRate = value;
|
|
4004
|
+
}
|
|
4005
|
+
function adopt(animation) {
|
|
4006
|
+
if (originals2.has(animation) || !onDocumentTimeline(animation))
|
|
4007
|
+
return;
|
|
4008
|
+
const original = animation.playbackRate;
|
|
4009
|
+
originals2.set(animation, original);
|
|
4010
|
+
setRate(animation, original * rate);
|
|
4011
|
+
}
|
|
4012
|
+
function prune(current) {
|
|
4013
|
+
for (const [animation, original] of originals2) {
|
|
4014
|
+
if (current.has(animation))
|
|
4015
|
+
continue;
|
|
4016
|
+
setRate(animation, original);
|
|
4017
|
+
originals2.delete(animation);
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
function gsapTimeline() {
|
|
4021
|
+
const gsap = window.gsap;
|
|
4022
|
+
return gsap?.globalTimeline ?? null;
|
|
4023
|
+
}
|
|
4024
|
+
function syncGsap() {
|
|
4025
|
+
const timeline = gsapTimeline();
|
|
4026
|
+
if (!timeline)
|
|
4027
|
+
return;
|
|
4028
|
+
if (gsapScale === null) {
|
|
4029
|
+
const scale = Number(timeline.timeScale());
|
|
4030
|
+
gsapScale = Number.isFinite(scale) ? scale : 1;
|
|
4031
|
+
}
|
|
4032
|
+
if (gsapRate === rate)
|
|
4033
|
+
return;
|
|
4034
|
+
timeline.timeScale(gsapScale * rate);
|
|
4035
|
+
gsapRate = rate;
|
|
4036
|
+
}
|
|
4037
|
+
function restoreGsap() {
|
|
4038
|
+
const timeline = gsapTimeline();
|
|
4039
|
+
if (timeline && gsapScale !== null)
|
|
4040
|
+
timeline.timeScale(gsapScale);
|
|
4041
|
+
gsapScale = null;
|
|
4042
|
+
gsapRate = 1;
|
|
4043
|
+
}
|
|
4044
|
+
function sweep(full) {
|
|
4045
|
+
if (full)
|
|
4046
|
+
roots = shadowRoots();
|
|
4047
|
+
const animations = collect(roots);
|
|
4048
|
+
for (const animation of animations)
|
|
4049
|
+
adopt(animation);
|
|
4050
|
+
if (full)
|
|
4051
|
+
prune(new Set(animations));
|
|
4052
|
+
syncGsap();
|
|
4053
|
+
}
|
|
4054
|
+
function tick(now2) {
|
|
4055
|
+
frame3 = requestAnimationFrame(tick);
|
|
4056
|
+
const full = now2 - lastWalk >= ROOT_INTERVAL;
|
|
4057
|
+
if (full)
|
|
4058
|
+
lastWalk = now2;
|
|
4059
|
+
sweep(full);
|
|
4060
|
+
}
|
|
4061
|
+
function onStart(event) {
|
|
4062
|
+
const target = event.target;
|
|
4063
|
+
if (!(target instanceof Element) || isOwn(target))
|
|
4064
|
+
return;
|
|
4065
|
+
for (const animation of target.getAnimations({ subtree: event.pseudoElement !== "" })) {
|
|
4066
|
+
adopt(animation);
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
function patchAnimate() {
|
|
4070
|
+
if (patchedAnimate)
|
|
4071
|
+
return;
|
|
4072
|
+
const native2 = Element.prototype.animate;
|
|
4073
|
+
nativeAnimate = native2;
|
|
4074
|
+
patchedAnimate = function animate(...args) {
|
|
4075
|
+
const animation = native2.apply(this, args);
|
|
4076
|
+
if (rate !== 1 && !isOwn(this))
|
|
4077
|
+
adopt(animation);
|
|
4078
|
+
return animation;
|
|
4079
|
+
};
|
|
4080
|
+
Element.prototype.animate = patchedAnimate;
|
|
4081
|
+
}
|
|
4082
|
+
function restoreAnimate() {
|
|
4083
|
+
if (nativeAnimate && Element.prototype.animate === patchedAnimate) {
|
|
4084
|
+
Element.prototype.animate = nativeAnimate;
|
|
4085
|
+
}
|
|
4086
|
+
nativeAnimate = null;
|
|
4087
|
+
patchedAnimate = null;
|
|
4088
|
+
}
|
|
4089
|
+
function apply17(value) {
|
|
4090
|
+
const next = Number.isFinite(value) && value >= 0 ? value : 1;
|
|
4091
|
+
if (next === 1) {
|
|
4092
|
+
reset16();
|
|
4093
|
+
return;
|
|
4094
|
+
}
|
|
4095
|
+
if (next === rate && frame3)
|
|
4096
|
+
return;
|
|
4097
|
+
rate = next;
|
|
4098
|
+
for (const [animation, original] of originals2)
|
|
4099
|
+
setRate(animation, original * rate);
|
|
4100
|
+
patchAnimate();
|
|
4101
|
+
if (!listening) {
|
|
4102
|
+
window.addEventListener("animationstart", onStart, true);
|
|
4103
|
+
window.addEventListener("transitionrun", onStart, true);
|
|
4104
|
+
listening = true;
|
|
4105
|
+
}
|
|
4106
|
+
lastWalk = performance.now();
|
|
4107
|
+
sweep(true);
|
|
4108
|
+
if (!frame3)
|
|
4109
|
+
frame3 = requestAnimationFrame(tick);
|
|
4110
|
+
}
|
|
4111
|
+
function reset16() {
|
|
4112
|
+
rate = 1;
|
|
4113
|
+
if (frame3) {
|
|
4114
|
+
cancelAnimationFrame(frame3);
|
|
4115
|
+
frame3 = 0;
|
|
4116
|
+
}
|
|
4117
|
+
if (listening) {
|
|
4118
|
+
window.removeEventListener("animationstart", onStart, true);
|
|
4119
|
+
window.removeEventListener("transitionrun", onStart, true);
|
|
4120
|
+
listening = false;
|
|
4121
|
+
}
|
|
4122
|
+
restoreAnimate();
|
|
4123
|
+
for (const [animation, original] of originals2)
|
|
4124
|
+
setRate(animation, original);
|
|
4125
|
+
originals2.clear();
|
|
4126
|
+
roots = [];
|
|
4127
|
+
restoreGsap();
|
|
4128
|
+
}
|
|
4129
|
+
|
|
4130
|
+
// src/engine/index.ts
|
|
4131
|
+
var state = { ...DEFAULT_STATE };
|
|
4132
|
+
var persist = true;
|
|
4133
|
+
var running = false;
|
|
4134
|
+
var native2 = null;
|
|
4135
|
+
var nativeNote = null;
|
|
4136
|
+
var inFrame = false;
|
|
4137
|
+
var stopRelay = null;
|
|
4138
|
+
var panelMoving = null;
|
|
4139
|
+
var listeners2 = new Set;
|
|
4140
|
+
function getState() {
|
|
4141
|
+
return state;
|
|
4142
|
+
}
|
|
4143
|
+
function subscribe(listener) {
|
|
4144
|
+
listeners2.add(listener);
|
|
4145
|
+
return () => {
|
|
4146
|
+
listeners2.delete(listener);
|
|
4147
|
+
};
|
|
4148
|
+
}
|
|
4149
|
+
function driver() {
|
|
4150
|
+
return nativeEnabled() ? native2 : null;
|
|
4151
|
+
}
|
|
4152
|
+
function applyState(next) {
|
|
4153
|
+
state = inFrame ? framed(next) : next;
|
|
4154
|
+
const active2 = driver();
|
|
4155
|
+
const page = inPage(state, active2);
|
|
4156
|
+
const scheme = inFrame && nativeScheme(page.scheme) ? "system" : page.scheme;
|
|
4157
|
+
const touchScreen = inFrame && hasTouch(state.device);
|
|
4158
|
+
const nativeTouch = !inFrame && active2?.viewport !== undefined && nativeViewport(state)?.touch === true;
|
|
4159
|
+
apply3({
|
|
4160
|
+
scheme,
|
|
4161
|
+
motion: page.motion,
|
|
4162
|
+
contrast: page.contrast,
|
|
4163
|
+
transparency: page.transparency,
|
|
4164
|
+
touch: touchScreen
|
|
4165
|
+
});
|
|
4166
|
+
apply6({
|
|
4167
|
+
on: touchScreen || nativeTouch,
|
|
4168
|
+
points: !nativeTouch && uaPreset(state.ua.preset) === undefined
|
|
4169
|
+
});
|
|
4170
|
+
apply9(touchScreen && state.touchPointer);
|
|
4171
|
+
apply5(touchScreen);
|
|
4172
|
+
apply17(state.speed);
|
|
4173
|
+
apply7(state.locale);
|
|
4174
|
+
apply15(state.pseudo);
|
|
4175
|
+
apply(state.geo);
|
|
4176
|
+
apply8(resolveTimeZone(state.timeZone, state.geo), state.clock);
|
|
4177
|
+
apply11(state.clock);
|
|
4178
|
+
apply12(page.network);
|
|
4179
|
+
apply2(page.text);
|
|
4180
|
+
if (active2 && !inFrame)
|
|
4181
|
+
drive(active2, state);
|
|
4182
|
+
else if (native2 && !inFrame)
|
|
4183
|
+
driveUa(native2, state);
|
|
4184
|
+
apply16(state.spacing);
|
|
4185
|
+
apply4(state.ua);
|
|
4186
|
+
const sized2 = inFrame ? state : framing(state, active2);
|
|
4187
|
+
apply10(sized2);
|
|
4188
|
+
apply14(state.overflow && !needsFrame(sized2));
|
|
4189
|
+
apply13(state.outlines);
|
|
4190
|
+
if (persist)
|
|
4191
|
+
save(state);
|
|
4192
|
+
sync(sized2);
|
|
4193
|
+
for (const listener of Array.from(listeners2))
|
|
4194
|
+
listener(state);
|
|
4195
|
+
}
|
|
4196
|
+
function setNative(on3, note) {
|
|
4197
|
+
if (note !== undefined)
|
|
4198
|
+
nativeNote = note;
|
|
4199
|
+
const changed = on3 !== nativeEnabled();
|
|
4200
|
+
enableNative(on3);
|
|
4201
|
+
if (changed && !on3 && native2 && !inFrame)
|
|
4202
|
+
release(native2, false);
|
|
4203
|
+
if (running && (changed || note !== undefined))
|
|
4204
|
+
applyState(state);
|
|
4205
|
+
}
|
|
4206
|
+
function nativeSwitch() {
|
|
4207
|
+
if (!native2?.setting)
|
|
4208
|
+
return null;
|
|
4209
|
+
return { setting: native2.setting, on: nativeEnabled(), note: nativeNote };
|
|
4210
|
+
}
|
|
4211
|
+
function setState(patch2) {
|
|
4212
|
+
applyState(merge(state, patch2));
|
|
4213
|
+
return state;
|
|
4214
|
+
}
|
|
4215
|
+
function ready() {
|
|
4216
|
+
return whenSettled(() => idle() && !retrying() && !pending() && !panelMoving?.(), reloading, () => state, () => running);
|
|
4217
|
+
}
|
|
4218
|
+
function watchPanel(moving) {
|
|
4219
|
+
panelMoving = moving;
|
|
4220
|
+
return () => {
|
|
4221
|
+
if (panelMoving === moving)
|
|
4222
|
+
panelMoving = null;
|
|
4223
|
+
};
|
|
4224
|
+
}
|
|
4225
|
+
function keepPlace2() {
|
|
4226
|
+
if (persist)
|
|
4227
|
+
keepPlace(state);
|
|
4228
|
+
}
|
|
4229
|
+
function reset17() {
|
|
4230
|
+
applyState(resetState(state));
|
|
4231
|
+
}
|
|
4232
|
+
function onMessage(event) {
|
|
4233
|
+
const message = readMessage(event, window.parent, window.location.origin);
|
|
4234
|
+
if (message?.type === "state") {
|
|
4235
|
+
if (message.native !== undefined)
|
|
4236
|
+
enableNative(message.native);
|
|
4237
|
+
applyState(message.state);
|
|
4238
|
+
} else if (message?.type === "replay")
|
|
4239
|
+
replay();
|
|
4240
|
+
}
|
|
4241
|
+
function onNavigate(event) {
|
|
4242
|
+
const navigate = event;
|
|
4243
|
+
const url = leaveFor(navigate, window.location.origin);
|
|
4244
|
+
if (!url)
|
|
4245
|
+
return;
|
|
4246
|
+
navigate.preventDefault();
|
|
4247
|
+
post(window.parent, { source: "devknobs", type: "leave", url });
|
|
4248
|
+
}
|
|
4249
|
+
function navigation() {
|
|
4250
|
+
const found = Reflect.get(window, "navigation");
|
|
4251
|
+
return found instanceof EventTarget ? found : null;
|
|
4252
|
+
}
|
|
4253
|
+
function relay(count2) {
|
|
4254
|
+
post(window.parent, { source: "devknobs", type: "overflow", count: count2 });
|
|
4255
|
+
}
|
|
4256
|
+
function start4(options = {}) {
|
|
4257
|
+
if (running)
|
|
4258
|
+
return;
|
|
4259
|
+
running = true;
|
|
4260
|
+
inFrame = isDevknobsFrame();
|
|
4261
|
+
native2 = options.native ?? null;
|
|
4262
|
+
resume();
|
|
4263
|
+
const stored = options.persist !== false;
|
|
4264
|
+
persist = stored && !inFrame;
|
|
4265
|
+
if (inFrame) {
|
|
4266
|
+
window.addEventListener("message", onMessage);
|
|
4267
|
+
navigation()?.addEventListener("navigate", onNavigate);
|
|
4268
|
+
}
|
|
4269
|
+
start();
|
|
4270
|
+
onExit(() => setState(EXITED));
|
|
4271
|
+
onZoom((zoom) => setState({ zoom }));
|
|
4272
|
+
onRefused(native2?.refused ?? null);
|
|
4273
|
+
onFramed(native2?.framed ?? null);
|
|
4274
|
+
applyState(merge(stored ? load() : { ...DEFAULT_STATE }, options.state ?? {}));
|
|
4275
|
+
if (!inFrame)
|
|
4276
|
+
return;
|
|
4277
|
+
relay(overflowCount());
|
|
4278
|
+
stopRelay = onCount(relay);
|
|
4279
|
+
post(window.parent, { source: "devknobs", type: "ready" });
|
|
4280
|
+
}
|
|
4281
|
+
function stop2() {
|
|
4282
|
+
if (!running)
|
|
4283
|
+
return;
|
|
4284
|
+
running = false;
|
|
4285
|
+
window.removeEventListener("message", onMessage);
|
|
4286
|
+
navigation()?.removeEventListener("navigate", onNavigate);
|
|
4287
|
+
stopRelay?.();
|
|
4288
|
+
stopRelay = null;
|
|
4289
|
+
inFrame = false;
|
|
4290
|
+
onExit(null);
|
|
4291
|
+
onZoom(null);
|
|
4292
|
+
onRefused(null);
|
|
4293
|
+
onFramed(null);
|
|
4294
|
+
destroy();
|
|
4295
|
+
reset5();
|
|
4296
|
+
reset8();
|
|
4297
|
+
reset4();
|
|
4298
|
+
reset16();
|
|
4299
|
+
reset6();
|
|
4300
|
+
reset14();
|
|
4301
|
+
reset();
|
|
4302
|
+
reset7();
|
|
4303
|
+
reset10();
|
|
4304
|
+
reset11();
|
|
4305
|
+
reset2();
|
|
4306
|
+
reset15();
|
|
4307
|
+
reset3();
|
|
4308
|
+
reset9();
|
|
4309
|
+
reset13();
|
|
4310
|
+
reset12();
|
|
4311
|
+
if (native2)
|
|
4312
|
+
release(native2);
|
|
4313
|
+
native2 = null;
|
|
4314
|
+
enableNative(true);
|
|
4315
|
+
nativeNote = null;
|
|
4316
|
+
stop();
|
|
4317
|
+
state = { ...DEFAULT_STATE };
|
|
4318
|
+
}
|
|
4319
|
+
function replay2() {
|
|
4320
|
+
replay();
|
|
4321
|
+
post(frameWindow(), { source: "devknobs", type: "replay" });
|
|
4322
|
+
}
|
|
4323
|
+
|
|
4324
|
+
// src/ui/keys.ts
|
|
4325
|
+
function hotkeyOf(hotkey) {
|
|
4326
|
+
return (hotkey ?? "k").toLowerCase();
|
|
4327
|
+
}
|
|
4328
|
+
var MODIFIER_NAMES = {
|
|
4329
|
+
meta: "meta",
|
|
4330
|
+
cmd: "meta",
|
|
4331
|
+
command: "meta",
|
|
4332
|
+
ctrl: "ctrl",
|
|
4333
|
+
control: "ctrl",
|
|
4334
|
+
shift: "shift",
|
|
4335
|
+
alt: "alt",
|
|
4336
|
+
option: "alt",
|
|
4337
|
+
opt: "alt"
|
|
4338
|
+
};
|
|
4339
|
+
function parseCombo(spec) {
|
|
4340
|
+
if (!spec?.trim())
|
|
4341
|
+
return null;
|
|
4342
|
+
const parsed = { meta: false, ctrl: false, shift: false, alt: false, key: "" };
|
|
4343
|
+
for (const raw of spec.split("+")) {
|
|
4344
|
+
const part = raw.trim().toLowerCase();
|
|
4345
|
+
const modifier = MODIFIER_NAMES[part];
|
|
4346
|
+
if (modifier)
|
|
4347
|
+
parsed[modifier] = true;
|
|
4348
|
+
else if (part && !parsed.key)
|
|
4349
|
+
parsed.key = part;
|
|
4350
|
+
else
|
|
4351
|
+
return null;
|
|
4352
|
+
}
|
|
4353
|
+
return parsed.key ? parsed : null;
|
|
4354
|
+
}
|
|
4355
|
+
function comboText(combo) {
|
|
4356
|
+
const names = [
|
|
4357
|
+
combo.meta && "meta",
|
|
4358
|
+
combo.ctrl && "ctrl",
|
|
4359
|
+
combo.alt && "alt",
|
|
4360
|
+
combo.shift && "shift"
|
|
4361
|
+
];
|
|
4362
|
+
return [...names.filter((name) => Boolean(name)), combo.key].join("+");
|
|
4363
|
+
}
|
|
4364
|
+
function withShift(key2) {
|
|
4365
|
+
return { meta: false, ctrl: false, shift: true, alt: false, key: key2 };
|
|
4366
|
+
}
|
|
4367
|
+
function isFunctionKey(key2) {
|
|
4368
|
+
return /^f([1-9]|1[0-2])$/.test(key2);
|
|
4369
|
+
}
|
|
4370
|
+
function deletes(key2) {
|
|
4371
|
+
return key2 === "backspace" || key2 === "delete";
|
|
4372
|
+
}
|
|
4373
|
+
var KEY_GLYPHS = { backspace: "⌫", delete: "⌦" };
|
|
4374
|
+
var KEY_NAMES = { backspace: "Backspace", delete: "Delete" };
|
|
4375
|
+
function comboLabel(combo, mac) {
|
|
4376
|
+
const key2 = combo.key;
|
|
4377
|
+
if (mac) {
|
|
4378
|
+
const marks = `${combo.ctrl ? "⌃" : ""}${combo.alt ? "⌥" : ""}${combo.shift ? "⇧" : ""}${combo.meta ? "⌘" : ""}`;
|
|
4379
|
+
return `${marks}${KEY_GLYPHS[key2] ?? key2.toUpperCase()}`;
|
|
4380
|
+
}
|
|
4381
|
+
const names = [
|
|
4382
|
+
combo.ctrl && "Ctrl",
|
|
4383
|
+
combo.alt && "Alt",
|
|
4384
|
+
combo.shift && "Shift",
|
|
4385
|
+
combo.meta && "Meta"
|
|
4386
|
+
];
|
|
4387
|
+
const name = KEY_NAMES[key2] ?? key2.toUpperCase();
|
|
4388
|
+
return [...names.filter((part) => Boolean(part)), name].join(" ");
|
|
4389
|
+
}
|
|
4390
|
+
function comboSpoken(combo) {
|
|
4391
|
+
return comboText(combo).replaceAll("+", " ");
|
|
4392
|
+
}
|
|
4393
|
+
var INSPECT_KEYS = ["c", "i", "y"];
|
|
4394
|
+
function defaultKeys(options = {}) {
|
|
4395
|
+
const panel = withShift(hotkeyOf(options.hotkey));
|
|
4396
|
+
const grab = parseCombo(options.grabKey) ?? withShift("g");
|
|
4397
|
+
const taken = [panel, grab].map(comboText);
|
|
4398
|
+
const free = INSPECT_KEYS.find((key2) => !taken.includes(comboText(withShift(key2))));
|
|
4399
|
+
return {
|
|
4400
|
+
panel,
|
|
4401
|
+
grab,
|
|
4402
|
+
inspect: withShift(free ?? "c"),
|
|
4403
|
+
replay: withShift(REPLAY_KEY),
|
|
4404
|
+
requests: withShift(REQUESTS_KEY),
|
|
4405
|
+
storage: withShift(STORAGE_KEY),
|
|
4406
|
+
reset: withShift("backspace")
|
|
4407
|
+
};
|
|
4408
|
+
}
|
|
4409
|
+
var KEYS_FIELD = "data-devknobs-keys";
|
|
4410
|
+
function isTyping(node) {
|
|
4411
|
+
const element = node;
|
|
4412
|
+
const tag2 = element?.tagName;
|
|
4413
|
+
if (tag2 === "INPUT" || tag2 === "TEXTAREA")
|
|
4414
|
+
return true;
|
|
4415
|
+
return element?.isContentEditable === true;
|
|
4416
|
+
}
|
|
4417
|
+
function focusInClosedRoot(node) {
|
|
4418
|
+
if (typeof HTMLElement === "undefined" || !(node instanceof HTMLElement))
|
|
4419
|
+
return false;
|
|
4420
|
+
if (!node.tagName.includes("-"))
|
|
4421
|
+
return false;
|
|
4422
|
+
if (node.shadowRoot !== null || node.hasAttribute("tabindex") || node.tabIndex >= 0)
|
|
4423
|
+
return false;
|
|
4424
|
+
const root = node.getRootNode();
|
|
4425
|
+
if (root instanceof Document) {
|
|
4426
|
+
if (node === root.body || node === root.documentElement)
|
|
4427
|
+
return false;
|
|
4428
|
+
} else if (!(root instanceof ShadowRoot)) {
|
|
4429
|
+
return false;
|
|
4430
|
+
}
|
|
4431
|
+
return root.activeElement === node;
|
|
4432
|
+
}
|
|
4433
|
+
function isEditable(node) {
|
|
4434
|
+
return isTyping(node) || node?.tagName === "SELECT" || focusInClosedRoot(node);
|
|
4435
|
+
}
|
|
4436
|
+
function typesInField(event) {
|
|
4437
|
+
const target = event.composedPath?.()[0] ?? event.target;
|
|
4438
|
+
if (!isEditable(target))
|
|
4439
|
+
return false;
|
|
4440
|
+
return target?.hasAttribute?.(KEYS_FIELD) !== true;
|
|
4441
|
+
}
|
|
4442
|
+
function lowerKey(key2) {
|
|
4443
|
+
return key2 === "İ" ? "i" : key2.toLowerCase();
|
|
4444
|
+
}
|
|
4445
|
+
function letterMatches(event, letter) {
|
|
4446
|
+
const key2 = lowerKey(event.key);
|
|
4447
|
+
if (key2 === letter)
|
|
4448
|
+
return true;
|
|
4449
|
+
return [...key2].length === 1 && !/\p{Script=Latin}/u.test(key2) && event.code === `Key${letter.toUpperCase()}`;
|
|
4450
|
+
}
|
|
4451
|
+
function keyIs(event, key2) {
|
|
4452
|
+
if (/^[a-z]$/.test(key2)) {
|
|
4453
|
+
return letterMatches(event, key2) || event.altKey && event.code === `Key${key2.toUpperCase()}`;
|
|
4454
|
+
}
|
|
4455
|
+
if (event.key.toLowerCase() === key2)
|
|
4456
|
+
return true;
|
|
4457
|
+
if (/^[0-9]$/.test(key2))
|
|
4458
|
+
return event.code === `Digit${key2}`;
|
|
4459
|
+
return key2 === "backspace" && event.key === "Delete";
|
|
4460
|
+
}
|
|
4461
|
+
function comboMatches(event, combo) {
|
|
4462
|
+
return event.isComposing !== true && event.metaKey === combo.meta && event.ctrlKey === combo.ctrl && event.shiftKey === combo.shift && event.altKey === combo.alt && keyIs(event, combo.key);
|
|
4463
|
+
}
|
|
4464
|
+
function actsHere(event, combo) {
|
|
4465
|
+
if (isFunctionKey(combo.key))
|
|
4466
|
+
return true;
|
|
4467
|
+
if (deletes(combo.key))
|
|
4468
|
+
return !isEditable(event.composedPath?.()[0] ?? event.target);
|
|
4469
|
+
return !typesInField(event);
|
|
4470
|
+
}
|
|
4471
|
+
var REPLAY_KEY = "r";
|
|
4472
|
+
var REQUESTS_KEY = "n";
|
|
4473
|
+
var STORAGE_KEY = "s";
|
|
4474
|
+
function keyAction(event, keys) {
|
|
4475
|
+
if (event.key === "Escape")
|
|
4476
|
+
return "close";
|
|
4477
|
+
const steps = [
|
|
4478
|
+
["toggle", keys.panel],
|
|
4479
|
+
["replay", keys.replay],
|
|
4480
|
+
["requests", keys.requests],
|
|
4481
|
+
["reset", keys.reset],
|
|
4482
|
+
["storage", keys.storage]
|
|
4483
|
+
];
|
|
4484
|
+
for (const [action, combo] of steps) {
|
|
4485
|
+
if (combo && comboMatches(event, combo))
|
|
4486
|
+
return actsHere(event, combo) ? action : null;
|
|
4487
|
+
}
|
|
4488
|
+
return null;
|
|
4489
|
+
}
|
|
4490
|
+
function isSearchKey(event) {
|
|
4491
|
+
if (event.key !== "/" || event.altKey || event.ctrlKey || event.metaKey)
|
|
4492
|
+
return false;
|
|
4493
|
+
const target = event.composedPath?.()[0] ?? event.target;
|
|
4494
|
+
return !isEditable(target);
|
|
4495
|
+
}
|
|
4496
|
+
function typeAhead(event) {
|
|
4497
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.isComposing === true)
|
|
4498
|
+
return null;
|
|
4499
|
+
if ([...event.key].length !== 1 || event.key === " " || event.key === "/")
|
|
4500
|
+
return null;
|
|
4501
|
+
return isEditable(event.composedPath?.()[0] ?? event.target) ? null : event.key;
|
|
4502
|
+
}
|
|
4503
|
+
function zoomAction(event) {
|
|
4504
|
+
if (!event.metaKey && !event.ctrlKey || event.altKey)
|
|
4505
|
+
return null;
|
|
4506
|
+
if (isTyping(event.composedPath?.()[0] ?? event.target))
|
|
4507
|
+
return null;
|
|
4508
|
+
if (event.key === "=" || event.key === "+")
|
|
4509
|
+
return "zoom-in";
|
|
4510
|
+
if (event.key === "-" || event.key === "_")
|
|
4511
|
+
return "zoom-out";
|
|
4512
|
+
return event.key === "0" ? "zoom-fit" : null;
|
|
4513
|
+
}
|
|
4514
|
+
function escapeStep(scene) {
|
|
4515
|
+
if (scene.search)
|
|
4516
|
+
return "search";
|
|
4517
|
+
if (scene.filter)
|
|
4518
|
+
return "filter";
|
|
4519
|
+
if (scene.keys)
|
|
4520
|
+
return "keys";
|
|
4521
|
+
if (scene.view)
|
|
4522
|
+
return "view";
|
|
4523
|
+
if (scene.editor)
|
|
4524
|
+
return "editor";
|
|
4525
|
+
return "panel";
|
|
4526
|
+
}
|
|
4527
|
+
function highlightAt(cursor, count2, newQuery = false) {
|
|
4528
|
+
return Math.min(Math.max(newQuery ? 0 : cursor, 0), count2 - 1);
|
|
4529
|
+
}
|
|
4530
|
+
function paletteMove(key2, cursor, count2) {
|
|
4531
|
+
if (key2 === "ArrowDown" || key2 === "ArrowUp") {
|
|
4532
|
+
return { cursor: highlightAt(cursor + (key2 === "ArrowDown" ? 1 : -1), count2), pick: false };
|
|
4533
|
+
}
|
|
4534
|
+
if (key2 === "Enter")
|
|
4535
|
+
return { cursor: highlightAt(cursor, count2), pick: count2 > 0 };
|
|
4536
|
+
return null;
|
|
4537
|
+
}
|
|
4538
|
+
function radioMove(key2, index, count2) {
|
|
4539
|
+
if (count2 === 0)
|
|
4540
|
+
return null;
|
|
4541
|
+
if (key2 === "ArrowRight" || key2 === "ArrowDown")
|
|
4542
|
+
return (index + 1) % count2;
|
|
4543
|
+
if (key2 === "ArrowLeft" || key2 === "ArrowUp")
|
|
4544
|
+
return (index - 1 + count2) % count2;
|
|
4545
|
+
if (key2 === "Home")
|
|
4546
|
+
return 0;
|
|
4547
|
+
return key2 === "End" ? count2 - 1 : null;
|
|
4548
|
+
}
|
|
4549
|
+
function forwardKeys(keys = () => defaultKeys(), open = () => true) {
|
|
4550
|
+
function onKeydown(event) {
|
|
4551
|
+
const zoom = zoomAction(event);
|
|
4552
|
+
const search = isSearchKey(event) && open();
|
|
4553
|
+
const panelAction = keyAction(event, keys());
|
|
4554
|
+
if (zoom || search || panelAction && panelAction !== "close")
|
|
4555
|
+
event.preventDefault();
|
|
4556
|
+
const action = panelAction ?? zoom ?? (search ? "search" : null);
|
|
4557
|
+
if (action)
|
|
4558
|
+
post(window.parent, { source: "devknobs", type: "key", action });
|
|
4559
|
+
}
|
|
4560
|
+
window.addEventListener("keydown", onKeydown, true);
|
|
4561
|
+
return () => window.removeEventListener("keydown", onKeydown, true);
|
|
4562
|
+
}
|
|
4563
|
+
|
|
4564
|
+
export { BODY_CAP, READ_MS, requestLog, sends, canonicalTag, LOCALE_PRESETS, overflowCount, onCount, SPEED_MIN, SPEED_MAX, TIME_ZONE_PRESETS, canonicalZone, resolveTimeZone, composedParent, isDevknobs, isGrabbable, grabTargetAt, pause, frameWindow, panelSized, zoomKey, landSplash, takeHinge, moveHinge, letGo, holdingHinge, foldRest, watchFold, watchHinge, getState, subscribe, setNative, nativeSwitch, setState, ready, watchPanel, keepPlace2 as keepPlace, reset17 as reset, start4 as start, stop2 as stop, replay2 as replay, exports_engine, parseCombo, comboText, withShift, isFunctionKey, comboLabel, comboSpoken, defaultKeys, KEYS_FIELD, typesInField, lowerKey, keyIs, keyAction, isSearchKey, typeAhead, zoomAction, escapeStep, highlightAt, paletteMove, radioMove, forwardKeys, ROW_ICONS, rowIcon, BINDING_ICONS, icon, glyph };
|