@kerfjs/ui 5.0.0-beta.125 → 5.0.0-beta.127
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/README.md +5 -0
- package/ai/application-ui-diagnostic-ids-v1.json +1 -0
- package/ai/component-catalog.json +77 -6
- package/ai/component-catalog.schema.json +14 -1
- package/ai/component-composition.json +27 -6
- package/ai/component-props.json +265 -40
- package/ai/components/combobox.md +1 -1
- package/ai/components/surface-scaffold.md +19 -5
- package/ai/components/tab-bar.md +2 -0
- package/ai/components/toolbar.md +1 -0
- package/ai/public-api-signatures-v1.md +251 -298
- package/ai/skill.md +10 -4
- package/ai/view-document.schema.json +55 -2
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/analyzer/cli.mjs +60 -24
- package/analyzer/index.mjs +331 -58
- package/catalog-projection-cli.mjs +86 -50
- package/dist/anchored-surface.js +2 -1
- package/dist/browser/editor.js +12 -7
- package/dist/catalog-resources.d.ts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.js +6 -6
- package/dist/{chunk-VX3YF2UD.js → chunk-3K5V3ZSD.js} +3 -3
- package/dist/{chunk-VX3YF2UD.js.map → chunk-3K5V3ZSD.js.map} +1 -1
- package/dist/{chunk-NHQOX7T4.js → chunk-3ZKUXWAV.js} +4 -4
- package/dist/chunk-3ZKUXWAV.js.map +1 -0
- package/dist/{chunk-ADMWT7FX.js → chunk-3ZWYGGEC.js} +136 -8
- package/dist/chunk-3ZWYGGEC.js.map +1 -0
- package/dist/{chunk-KLR3DCHH.js → chunk-4L5ZIKDZ.js} +1 -1
- package/dist/chunk-4L5ZIKDZ.js.map +1 -0
- package/dist/{chunk-2E7S5C4D.js → chunk-4UWLHKNU.js} +5 -5
- package/dist/chunk-4UWLHKNU.js.map +1 -0
- package/dist/{chunk-EXGDKG7B.js → chunk-5A2DN3LR.js} +5 -5
- package/dist/chunk-5A2DN3LR.js.map +1 -0
- package/dist/{chunk-DJ65XFVN.js → chunk-63TJH2RF.js} +4 -4
- package/dist/chunk-63TJH2RF.js.map +1 -0
- package/dist/{chunk-Q2CLQ3IJ.js → chunk-6PHG2DMG.js} +1 -1
- package/dist/chunk-6PHG2DMG.js.map +1 -0
- package/dist/{chunk-SPI6VMIY.js → chunk-6T7AX365.js} +4 -4
- package/dist/chunk-6T7AX365.js.map +1 -0
- package/dist/{chunk-GVII4JSD.js → chunk-6V6UHPJD.js} +4 -4
- package/dist/chunk-6V6UHPJD.js.map +1 -0
- package/dist/{chunk-NR3ZO4LK.js → chunk-7U65KLDL.js} +1 -1
- package/dist/chunk-7U65KLDL.js.map +1 -0
- package/dist/chunk-BMOZSNDU.js +133 -0
- package/dist/chunk-BMOZSNDU.js.map +1 -0
- package/dist/{chunk-2LM3PYHA.js → chunk-C2TY5DJC.js} +11 -8
- package/dist/chunk-C2TY5DJC.js.map +1 -0
- package/dist/{chunk-3WYREXW4.js → chunk-COMEWURO.js} +8 -6
- package/dist/chunk-COMEWURO.js.map +1 -0
- package/dist/{chunk-VPDSPD76.js → chunk-DB64I3DB.js} +4 -3
- package/dist/chunk-DB64I3DB.js.map +1 -0
- package/dist/{chunk-SBCXWGNP.js → chunk-DBCDYBZP.js} +2 -2
- package/dist/{chunk-SBCXWGNP.js.map → chunk-DBCDYBZP.js.map} +1 -1
- package/dist/{chunk-CNM6ZWP2.js → chunk-DJWBXEF4.js} +4 -2
- package/dist/chunk-DJWBXEF4.js.map +1 -0
- package/dist/{chunk-SVUJIVMR.js → chunk-E2MTHHLS.js} +3 -3
- package/dist/{chunk-SVUJIVMR.js.map → chunk-E2MTHHLS.js.map} +1 -1
- package/dist/{chunk-JG4ONAOI.js → chunk-EI55KWHP.js} +2 -2
- package/dist/chunk-EI55KWHP.js.map +1 -0
- package/dist/{chunk-MVKHSAKE.js → chunk-GE2BQXB3.js} +41 -4
- package/dist/chunk-GE2BQXB3.js.map +1 -0
- package/dist/chunk-GHV36C6I.js +94 -0
- package/dist/chunk-GHV36C6I.js.map +1 -0
- package/dist/{chunk-BCO673YW.js → chunk-GQUDCWOD.js} +10 -4
- package/dist/chunk-GQUDCWOD.js.map +1 -0
- package/dist/chunk-HD7ZLISK.js +808 -0
- package/dist/chunk-HD7ZLISK.js.map +1 -0
- package/dist/{chunk-KELWWCMX.js → chunk-I2K4OQKB.js} +4 -4
- package/dist/chunk-I2K4OQKB.js.map +1 -0
- package/dist/chunk-IFDTSVE6.js +9 -0
- package/dist/chunk-IFDTSVE6.js.map +1 -0
- package/dist/{chunk-TPLVC5BE.js → chunk-IR32NI2O.js} +336 -247
- package/dist/chunk-IR32NI2O.js.map +1 -0
- package/dist/{chunk-ZKKO4MHC.js → chunk-JYKP7TBZ.js} +4 -2
- package/dist/chunk-JYKP7TBZ.js.map +1 -0
- package/dist/{chunk-6OT7FOSA.js → chunk-K3C35KGR.js} +4 -4
- package/dist/chunk-K3C35KGR.js.map +1 -0
- package/dist/{chunk-4RECPEHI.js → chunk-KBS3GP6S.js} +4 -3
- package/dist/chunk-KBS3GP6S.js.map +1 -0
- package/dist/{chunk-YHRJNKD5.js → chunk-KS7EXW4P.js} +6 -4
- package/dist/chunk-KS7EXW4P.js.map +1 -0
- package/dist/{chunk-V6N3YLTM.js → chunk-LTOTL5AS.js} +3 -3
- package/dist/chunk-LTOTL5AS.js.map +1 -0
- package/dist/chunk-M64TAGZY.js +590 -0
- package/dist/chunk-M64TAGZY.js.map +1 -0
- package/dist/{chunk-JZZVWTUB.js → chunk-MMOQR426.js} +2 -2
- package/dist/chunk-MMOQR426.js.map +1 -0
- package/dist/{chunk-SJBMKA4X.js → chunk-OHT2AXER.js} +11 -10
- package/dist/chunk-OHT2AXER.js.map +1 -0
- package/dist/{chunk-TTFW6E6C.js → chunk-OZKBIPXU.js} +2 -2
- package/dist/chunk-OZKBIPXU.js.map +1 -0
- package/dist/{chunk-Q2SLOMN6.js → chunk-RHMY45DK.js} +4 -4
- package/dist/chunk-RHMY45DK.js.map +1 -0
- package/dist/{chunk-BZXA5SSA.js → chunk-S7QB5KMM.js} +2 -2
- package/dist/{chunk-BZXA5SSA.js.map → chunk-S7QB5KMM.js.map} +1 -1
- package/dist/{chunk-HDXUHLTQ.js → chunk-SHECA2N4.js} +8 -2
- package/dist/chunk-SHECA2N4.js.map +1 -0
- package/dist/{chunk-R6FIXYAE.js → chunk-SJEPM5ZU.js} +2 -2
- package/dist/{chunk-R6FIXYAE.js.map → chunk-SJEPM5ZU.js.map} +1 -1
- package/dist/{chunk-FJMABKKV.js → chunk-UQ4FRQ6M.js} +35 -17
- package/dist/chunk-UQ4FRQ6M.js.map +1 -0
- package/dist/{chunk-S4ZGTDSG.js → chunk-UU37OR3D.js} +2 -2
- package/dist/chunk-UU37OR3D.js.map +1 -0
- package/dist/{chunk-SWXWLSUD.js → chunk-WEQNPYVA.js} +1 -1
- package/dist/{chunk-SWXWLSUD.js.map → chunk-WEQNPYVA.js.map} +1 -1
- package/dist/{chunk-5SFHBYEY.js → chunk-WUVHP3UC.js} +97 -24
- package/dist/chunk-WUVHP3UC.js.map +1 -0
- package/dist/{chunk-3S3WXAZ5.js → chunk-X43QQWVC.js} +3 -2
- package/dist/chunk-X43QQWVC.js.map +1 -0
- package/dist/{chunk-Z3T24FX3.js → chunk-YE6KCAIN.js} +3 -2
- package/dist/chunk-YE6KCAIN.js.map +1 -0
- package/dist/{chunk-KQZIC5CA.js → chunk-ZC4KSRAF.js} +7 -7
- package/dist/chunk-ZC4KSRAF.js.map +1 -0
- package/dist/collapsible-panel.d.ts +2 -2
- package/dist/collapsible-panel.js +2 -2
- package/dist/collapsible-panel.js.map +1 -1
- package/dist/column-explorer.d.ts +3 -3
- package/dist/column-explorer.js +16 -138
- package/dist/column-explorer.js.map +1 -1
- package/dist/dialog-surface-controller-BeKZ3e8Z.d.ts +251 -0
- package/dist/editor-frame.d.ts +1 -1
- package/dist/editor-frame.js +1 -1
- package/dist/editor.d.ts +38 -20
- package/dist/editor.js +11651 -7052
- package/dist/editor.js.map +1 -1
- package/dist/file-picker.js +1 -1
- package/dist/help-tags-register.js +2 -1
- package/dist/help-tags-register.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +24 -23
- package/dist/list-action-row.d.ts +1 -1
- package/dist/list-action-row.js +1 -1
- package/dist/list-detail-dialog.d.ts +7 -7
- package/dist/list-detail-dialog.js +6 -5
- package/dist/list-detail-dialog.js.map +1 -1
- package/dist/list-header.d.ts +1 -1
- package/dist/list-header.js +1 -1
- package/dist/list-item.d.ts +1 -1
- package/dist/list-item.js +1 -1
- package/dist/message-composer.js +1 -1
- package/dist/nav-stack.d.ts +6 -6
- package/dist/nav-stack.js +1 -1
- package/dist/popup-menu-register.js +1 -7
- package/dist/popup-menu-register.js.map +1 -1
- package/dist/popup-menu.d.ts +2 -2
- package/dist/popup-menu.js +1 -1
- package/dist/resizable-region.js +1 -1
- package/dist/segmented-control.d.ts +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/select-register.js +17 -23
- package/dist/select-register.js.map +1 -1
- package/dist/split-view.d.ts +6 -6
- package/dist/split-view.js +1 -1
- package/dist/styles/collapsible-panel.css +34 -25
- package/dist/styles/components/actions/popup-menu/popup-menu.css +4 -4
- package/dist/styles/components/actions/toolbar/toolbar.css +34 -1
- package/dist/styles/components/actions/toolbar-control-group/toolbar-control-group.css +1 -1
- package/dist/styles/components/forms/segmented-control/segmented-control.css +1 -1
- package/dist/styles/components/layout/collapsible-panel/collapsible-panel.css +34 -25
- package/dist/styles/components/layout/split-view/split-view.css +19 -33
- package/dist/styles/components/navigation/nav-stack/nav-stack.css +15 -19
- package/dist/styles/components/navigation/tab-navigator/tab-navigator.css +30 -29
- package/dist/styles/components/surfaces/editor-frame/editor-frame.css +10 -3
- package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +291 -4
- package/dist/styles/editor/editor.css +78 -0
- package/dist/styles/editor-frame.css +10 -3
- package/dist/styles/nav-stack.css +15 -19
- package/dist/styles/popup-menu.css +4 -4
- package/dist/styles/segmented-control.css +1 -1
- package/dist/styles/split-view.css +19 -33
- package/dist/styles/surface-scaffold.css +291 -4
- package/dist/styles/tab-navigator.css +30 -29
- package/dist/styles/toolbar-control-group.css +1 -1
- package/dist/styles/toolbar.css +34 -1
- package/dist/styles/webawesome.css +4 -5
- package/dist/surface-scaffold-register.js +2 -1
- package/dist/surface-scaffold-register.js.map +1 -1
- package/dist/surface-scaffold.d.ts +155 -246
- package/dist/surface-scaffold.js +3 -2
- package/dist/toolbar-control-group.d.ts +2 -2
- package/dist/toolbar-control-group.js +1 -1
- package/dist/toolbar.d.ts +6 -1
- package/dist/toolbar.js +1 -1
- package/dist/tree-list.d.ts +4 -4
- package/dist/tree-list.js +2 -2
- package/dist/{tree-rows-eHnnGLGM.d.ts → tree-rows-Bms5QJvG.d.ts} +3 -0
- package/dist/wire-catalog.d.ts +1 -1
- package/dist/wire-catalog.js +3 -2
- package/dist/wire-catalog.js.map +1 -1
- package/dist/wire-checkboxes.js +2 -1
- package/dist/wire-choice-chips.js +2 -1
- package/dist/wire-color-fields.js +2 -1
- package/dist/wire-color-pickers.js +2 -1
- package/dist/wire-column-explorer.js +1 -92
- package/dist/wire-column-explorer.js.map +1 -1
- package/dist/wire-comboboxes.d.ts +2 -0
- package/dist/wire-comboboxes.js +2 -1
- package/dist/wire-content-items.js +2 -1
- package/dist/wire-corner-status.js +2 -1
- package/dist/wire-nav-stack.js +2 -1
- package/dist/wire-overlay-sheets.js +2 -1
- package/dist/wire-paged-views.js +2 -2
- package/dist/wire-paged-views.js.map +1 -1
- package/dist/wire-resizable-regions.js +2 -1
- package/dist/wire-scroll-dividers.js +1 -1
- package/dist/wire-search-fields.js +2 -1
- package/dist/wire-sidebar.js +2 -1
- package/dist/wire-tab-bars.d.ts +41 -2
- package/dist/wire-tab-bars.js +1 -1
- package/dist/wire-tab-navigator.js +2 -1
- package/dist/wire-tag-fields.js +2 -1
- package/dist/wire-workbench.js +2 -1
- package/dist/workbench-dialog.d.ts +7 -7
- package/dist/workbench-dialog.js +5 -4
- package/dist/workbench-dialog.js.map +1 -1
- package/dist/workbench.d.ts +1 -1
- package/dist/workbench.js +1 -1
- package/docs/accessibility.md +3 -6
- package/docs/component-contract.md +47 -7
- package/docs/component-selection.md +90 -80
- package/docs/design/templates.md +5 -4
- package/docs/editor-frame.md +1 -1
- package/docs/editor-host.md +15 -2
- package/docs/overlay-tooltip.md +1 -1
- package/docs/recipes.md +1 -1
- package/docs/surface-scaffold.md +63 -2
- package/docs/ui-analyzer.md +42 -0
- package/docs/ui-doctor.md +45 -1
- package/docs/ui-evaluator.md +35 -0
- package/docs/ux-demo.md +1 -1
- package/docs/view.md +314 -0
- package/docs/webawesome-theme.md +16 -0
- package/doctor/cli.mjs +36 -31
- package/doctor/index.mjs +349 -162
- package/evaluator/cli.mjs +36 -30
- package/llms.txt +17 -4
- package/package.json +6 -2
- package/props/cli.mjs +47 -21
- package/scripts/lib/cli-args.mjs +98 -0
- package/ux-demo/recipes/app-shell.tsx +48 -141
- package/ux-demo/recipes/collapsible-sidebar.tsx +43 -169
- package/ux-demo/recipes/compact-toolbar.tsx +22 -114
- package/ux-demo/recipes/composer-form.tsx +14 -104
- package/ux-demo/recipes/list-detail-dialog.tsx +38 -84
- package/ux-demo/recipes/list-workspace-states.tsx +29 -152
- package/ux-demo/recipes/loading-inspector.tsx +30 -174
- package/ux-demo/recipes/media-detail.tsx +29 -146
- package/ux-demo/recipes/navigation-sidebar.tsx +24 -113
- package/ux-demo/recipes/navigation-stack.tsx +7 -43
- package/ux-demo/recipes/workspace-header.tsx +2 -66
- package/view/catalog.mjs +229 -0
- package/view/child-kind.mjs +22 -0
- package/view/cli.mjs +142 -119
- package/view/contract.mjs +84 -11
- package/view/css-grammar.mjs +93 -0
- package/view/generate.d.mts +16 -0
- package/view/generate.mjs +155 -56
- package/view/index.d.mts +80 -14
- package/view/index.mjs +5 -9
- package/view/interpret.mjs +104 -36
- package/view/types.mjs +161 -0
- package/view/validate-move.mjs +66 -30
- package/view/validate.mjs +420 -654
- package/vite-editor.d.mts +16 -1
- package/vite-editor.mjs +74 -4
- package/dist/chunk-2E7S5C4D.js.map +0 -1
- package/dist/chunk-2LM3PYHA.js.map +0 -1
- package/dist/chunk-3S3WXAZ5.js.map +0 -1
- package/dist/chunk-3WYREXW4.js.map +0 -1
- package/dist/chunk-4RECPEHI.js.map +0 -1
- package/dist/chunk-5SFHBYEY.js.map +0 -1
- package/dist/chunk-6OT7FOSA.js.map +0 -1
- package/dist/chunk-ADMWT7FX.js.map +0 -1
- package/dist/chunk-BCO673YW.js.map +0 -1
- package/dist/chunk-CNM6ZWP2.js.map +0 -1
- package/dist/chunk-DJ65XFVN.js.map +0 -1
- package/dist/chunk-EXGDKG7B.js.map +0 -1
- package/dist/chunk-FJMABKKV.js.map +0 -1
- package/dist/chunk-GVII4JSD.js.map +0 -1
- package/dist/chunk-HDXUHLTQ.js.map +0 -1
- package/dist/chunk-JG4ONAOI.js.map +0 -1
- package/dist/chunk-JZZVWTUB.js.map +0 -1
- package/dist/chunk-KELWWCMX.js.map +0 -1
- package/dist/chunk-KLR3DCHH.js.map +0 -1
- package/dist/chunk-KQZIC5CA.js.map +0 -1
- package/dist/chunk-LD6A6PYB.js +0 -268
- package/dist/chunk-LD6A6PYB.js.map +0 -1
- package/dist/chunk-MVKHSAKE.js.map +0 -1
- package/dist/chunk-NHQOX7T4.js.map +0 -1
- package/dist/chunk-NR3ZO4LK.js.map +0 -1
- package/dist/chunk-Q2CLQ3IJ.js.map +0 -1
- package/dist/chunk-Q2SLOMN6.js.map +0 -1
- package/dist/chunk-S4ZGTDSG.js.map +0 -1
- package/dist/chunk-SJBMKA4X.js.map +0 -1
- package/dist/chunk-SPI6VMIY.js.map +0 -1
- package/dist/chunk-TPLVC5BE.js.map +0 -1
- package/dist/chunk-TTFW6E6C.js.map +0 -1
- package/dist/chunk-V6N3YLTM.js.map +0 -1
- package/dist/chunk-VNT4MXR5.js +0 -548
- package/dist/chunk-VNT4MXR5.js.map +0 -1
- package/dist/chunk-VPDSPD76.js.map +0 -1
- package/dist/chunk-YHRJNKD5.js.map +0 -1
- package/dist/chunk-Z3T24FX3.js.map +0 -1
- package/dist/chunk-ZKKO4MHC.js.map +0 -1
- package/dist/{nav-stack-DwxpXxqJ.d.ts → nav-stack-vQ3ieerq.d.ts} +3 -3
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
// src/wiring/wire-scroll-dividers.ts
|
|
2
|
+
var EDGES = ["t", "r", "b", "l"];
|
|
3
|
+
var FACING = { t: "b", r: "l", b: "t", l: "r" };
|
|
4
|
+
var TARGET_EDGES = {
|
|
5
|
+
t: "top",
|
|
6
|
+
r: "right",
|
|
7
|
+
b: "bottom",
|
|
8
|
+
l: "left"
|
|
9
|
+
};
|
|
10
|
+
var SCROLL_OVERFLOW = "data-scroll-overflow";
|
|
11
|
+
var SCROLL_DIVIDER = "data-scroll-divider";
|
|
12
|
+
var HEADER_OVERLAY = "data-header-overlay";
|
|
13
|
+
var CLEARANCE_BLOCK_START = "--kui-scroll-clearance-block-start";
|
|
14
|
+
var SCROLLBAR_INLINE_SIZE = "--kui-pane-scrollbar-inline-size";
|
|
15
|
+
var OVERLAY_PANE = '.kui-pane[data-header-presentation="overlay"]:not([data-chrome-placement="auto"])';
|
|
16
|
+
var THRESHOLD = 1;
|
|
17
|
+
var SCROLL_EDGE_PROGRESS = "--kui-scroll-edge-progress";
|
|
18
|
+
var SCROLL_EDGE_DISTANCE = "data-scroll-edge-distance";
|
|
19
|
+
var DEFAULT_SCROLL_EDGE_DISTANCE = 60;
|
|
20
|
+
var quoted = (value) => `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
21
|
+
function within(root, selector) {
|
|
22
|
+
const found = [...root.querySelectorAll(selector)];
|
|
23
|
+
if (root.nodeType === 1 && root.matches(selector))
|
|
24
|
+
found.unshift(root);
|
|
25
|
+
return found;
|
|
26
|
+
}
|
|
27
|
+
var directChild = (parent, selector) => [...parent.children].find(
|
|
28
|
+
(child) => child.matches(selector)
|
|
29
|
+
);
|
|
30
|
+
var PANE_CHROME = {
|
|
31
|
+
t: ".kui-pane__header, .kui-pane__toolbar",
|
|
32
|
+
b: ".kui-pane__footer"
|
|
33
|
+
};
|
|
34
|
+
var NAV_STACK_CHROME = {
|
|
35
|
+
t: ".kui-nav-stack__chrome:not([data-nav-chrome-copy])",
|
|
36
|
+
b: ".kui-nav-stack__bottom:not([data-nav-chrome-copy])"
|
|
37
|
+
};
|
|
38
|
+
function activeView(stack) {
|
|
39
|
+
const viewport = directChild(stack, ".kui-nav-stack__viewport");
|
|
40
|
+
if (!viewport) return void 0;
|
|
41
|
+
return [...viewport.children].filter(
|
|
42
|
+
(child) => child.matches(
|
|
43
|
+
'.kui-nav-stack__view[data-nav-active="true"]:not([data-nav-exiting="true"])'
|
|
44
|
+
)
|
|
45
|
+
).at(-1);
|
|
46
|
+
}
|
|
47
|
+
function activeScene(scaffold) {
|
|
48
|
+
const scenes = directChild(scaffold, ".kui-tab-scaffold__scenes");
|
|
49
|
+
return scenes ? directChild(scenes, '.kui-tab-scaffold__scene[data-active="true"]') : void 0;
|
|
50
|
+
}
|
|
51
|
+
function regionScrollers(region, edge) {
|
|
52
|
+
const found = [];
|
|
53
|
+
let current = region;
|
|
54
|
+
while (current) {
|
|
55
|
+
found.push(current);
|
|
56
|
+
if (current.children.length !== 1) break;
|
|
57
|
+
const child = current.children[0];
|
|
58
|
+
if (child.matches(".kui-pane")) {
|
|
59
|
+
current = directChild(child, PANE_CHROME[edge]) ? void 0 : directChild(child, ".kui-pane__content");
|
|
60
|
+
if (current) found.push(current);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
if (child.matches(".kui-nav-stack"))
|
|
64
|
+
current = directChild(child, NAV_STACK_CHROME[edge]) ? void 0 : activeView(child);
|
|
65
|
+
else if (child.matches(".kui-tab-scaffold") && edge === "t")
|
|
66
|
+
current = activeScene(child);
|
|
67
|
+
else current = void 0;
|
|
68
|
+
}
|
|
69
|
+
return found;
|
|
70
|
+
}
|
|
71
|
+
var sides = (edges) => EDGES.filter((edge) => edges.has(edge)).join("");
|
|
72
|
+
function measure(scroller) {
|
|
73
|
+
const edges = /* @__PURE__ */ new Set();
|
|
74
|
+
const maxY = scroller.scrollHeight - scroller.clientHeight;
|
|
75
|
+
if (maxY > THRESHOLD) {
|
|
76
|
+
if (scroller.scrollTop > THRESHOLD) edges.add("t");
|
|
77
|
+
if (maxY - scroller.scrollTop > THRESHOLD) edges.add("b");
|
|
78
|
+
}
|
|
79
|
+
const maxX = scroller.scrollWidth - scroller.clientWidth;
|
|
80
|
+
if (maxX > THRESHOLD) {
|
|
81
|
+
const view = scroller.ownerDocument.defaultView;
|
|
82
|
+
const rtl = view?.getComputedStyle(scroller).direction === "rtl";
|
|
83
|
+
const left = rtl ? maxX + scroller.scrollLeft : scroller.scrollLeft;
|
|
84
|
+
if (left > THRESHOLD) edges.add("l");
|
|
85
|
+
if (maxX - left > THRESHOLD) edges.add("r");
|
|
86
|
+
}
|
|
87
|
+
return sides(edges);
|
|
88
|
+
}
|
|
89
|
+
var CONTROLLERS = /* @__PURE__ */ new WeakMap();
|
|
90
|
+
function write(element, name, value) {
|
|
91
|
+
if (element.getAttribute(name) === (value || null)) return;
|
|
92
|
+
if (name === SCROLL_OVERFLOW) {
|
|
93
|
+
if (value) element.setAttribute(SCROLL_OVERFLOW, value);
|
|
94
|
+
else element.removeAttribute(SCROLL_OVERFLOW);
|
|
95
|
+
} else if (value) element.setAttribute(SCROLL_DIVIDER, value);
|
|
96
|
+
else element.removeAttribute(SCROLL_DIVIDER);
|
|
97
|
+
}
|
|
98
|
+
function wireScrollDividers(root, { targets = [] } = {}) {
|
|
99
|
+
const ownerDocument = root.nodeType === 9 ? root : root.ownerDocument;
|
|
100
|
+
let register = CONTROLLERS.get(ownerDocument);
|
|
101
|
+
if (!register) {
|
|
102
|
+
register = createController(ownerDocument);
|
|
103
|
+
CONTROLLERS.set(ownerDocument, register);
|
|
104
|
+
}
|
|
105
|
+
return register({ root, targets });
|
|
106
|
+
}
|
|
107
|
+
var STRUCTURAL_CLASSES = [
|
|
108
|
+
"kui-pane",
|
|
109
|
+
"kui-pane__content",
|
|
110
|
+
"kui-pane__header",
|
|
111
|
+
"kui-pane__toolbar",
|
|
112
|
+
"kui-pane__footer",
|
|
113
|
+
"kui-nav-stack",
|
|
114
|
+
"kui-nav-stack__viewport",
|
|
115
|
+
"kui-nav-stack__view",
|
|
116
|
+
"kui-nav-stack__chrome",
|
|
117
|
+
"kui-nav-stack__bottom",
|
|
118
|
+
"kui-tab-scaffold",
|
|
119
|
+
"kui-tab-scaffold__scenes",
|
|
120
|
+
"kui-tab-scaffold__scene",
|
|
121
|
+
"kui-tab-scaffold__bar"
|
|
122
|
+
];
|
|
123
|
+
var SCROLL_STRIP = "[data-kui-tab-list], [data-kui-scroll-strip]";
|
|
124
|
+
var STRUCTURAL_SELECTOR = [
|
|
125
|
+
...STRUCTURAL_CLASSES.map((name) => `.${name}`),
|
|
126
|
+
SCROLL_STRIP
|
|
127
|
+
].join(", ");
|
|
128
|
+
var hasStructuralClass = (value) => !!value && value.split(/\s+/).some((token) => STRUCTURAL_CLASSES.includes(token));
|
|
129
|
+
var byId = (root, id) => {
|
|
130
|
+
if (!id) return void 0;
|
|
131
|
+
const [match] = within(root, `[id=${quoted(id)}]`);
|
|
132
|
+
return match;
|
|
133
|
+
};
|
|
134
|
+
function collectPairings(registrations) {
|
|
135
|
+
const found = [];
|
|
136
|
+
for (const { root, targets } of registrations) {
|
|
137
|
+
for (const pane of within(root, ".kui-pane")) {
|
|
138
|
+
const scroller = directChild(pane, ".kui-pane__content");
|
|
139
|
+
const header = directChild(pane, PANE_CHROME.t);
|
|
140
|
+
const footer = directChild(pane, PANE_CHROME.b);
|
|
141
|
+
if (scroller && (header || footer))
|
|
142
|
+
found.push({ scroller, chrome: { t: header, b: footer } });
|
|
143
|
+
}
|
|
144
|
+
const pairRegion = (region, edge, chrome) => {
|
|
145
|
+
if (!region || !chrome) return;
|
|
146
|
+
for (const scroller of regionScrollers(region, edge))
|
|
147
|
+
found.push({ scroller, chrome: { [edge]: chrome } });
|
|
148
|
+
};
|
|
149
|
+
for (const stack of within(root, ".kui-nav-stack")) {
|
|
150
|
+
const view = activeView(stack);
|
|
151
|
+
for (const edge of ["t", "b"])
|
|
152
|
+
pairRegion(view, edge, directChild(stack, NAV_STACK_CHROME[edge]));
|
|
153
|
+
}
|
|
154
|
+
for (const scaffold of within(root, ".kui-tab-scaffold"))
|
|
155
|
+
pairRegion(
|
|
156
|
+
activeScene(scaffold),
|
|
157
|
+
"b",
|
|
158
|
+
directChild(scaffold, ".kui-tab-scaffold__bar")
|
|
159
|
+
);
|
|
160
|
+
for (const strip of within(root, SCROLL_STRIP))
|
|
161
|
+
found.push({ scroller: strip, chrome: {} });
|
|
162
|
+
for (const target of targets) {
|
|
163
|
+
const scroller = byId(root, target.scroller);
|
|
164
|
+
if (!scroller) continue;
|
|
165
|
+
const chrome = {};
|
|
166
|
+
for (const edge of EDGES)
|
|
167
|
+
chrome[edge] = byId(root, target[TARGET_EDGES[edge]]);
|
|
168
|
+
found.push({ scroller, chrome });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return found;
|
|
172
|
+
}
|
|
173
|
+
function collectOverlays(registrations) {
|
|
174
|
+
const found = /* @__PURE__ */ new Map();
|
|
175
|
+
for (const { root } of registrations)
|
|
176
|
+
for (const pane of within(root, OVERLAY_PANE)) {
|
|
177
|
+
const header = directChild(pane, PANE_CHROME.t);
|
|
178
|
+
if (header) found.set(header, pane);
|
|
179
|
+
}
|
|
180
|
+
return found;
|
|
181
|
+
}
|
|
182
|
+
function collectTargetIds(registrations) {
|
|
183
|
+
const ids = /* @__PURE__ */ new Set();
|
|
184
|
+
for (const { targets } of registrations)
|
|
185
|
+
for (const target of targets) {
|
|
186
|
+
ids.add(target.scroller);
|
|
187
|
+
for (const edge of EDGES) {
|
|
188
|
+
const id = target[TARGET_EDGES[edge]];
|
|
189
|
+
if (id) ids.add(id);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return ids;
|
|
193
|
+
}
|
|
194
|
+
var holds = (node, selector) => node.nodeType === 1 && (node.matches(selector) || !!node.querySelector(selector));
|
|
195
|
+
function changesPairings({
|
|
196
|
+
type,
|
|
197
|
+
target,
|
|
198
|
+
attributeName,
|
|
199
|
+
oldValue,
|
|
200
|
+
addedNodes,
|
|
201
|
+
removedNodes
|
|
202
|
+
}, ids, selector) {
|
|
203
|
+
if (type === "attributes" && (attributeName === SCROLL_OVERFLOW || attributeName === SCROLL_DIVIDER))
|
|
204
|
+
return false;
|
|
205
|
+
if (target.nodeType === 1 && target.matches(selector))
|
|
206
|
+
return true;
|
|
207
|
+
if (type === "attributes")
|
|
208
|
+
return attributeName === "class" ? hasStructuralClass(oldValue) : attributeName === "id" && oldValue !== null && ids.has(oldValue);
|
|
209
|
+
for (const node of [...addedNodes, ...removedNodes])
|
|
210
|
+
if (holds(node, selector)) return true;
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
function measureScrollbars(overlays, scrollbarSizes) {
|
|
214
|
+
let changed = false;
|
|
215
|
+
for (const [header, pane] of overlays) {
|
|
216
|
+
const scroller = directChild(pane, ".kui-pane__content");
|
|
217
|
+
let size = 0;
|
|
218
|
+
if (scroller) {
|
|
219
|
+
const style = scroller.ownerDocument.defaultView.getComputedStyle(scroller);
|
|
220
|
+
size = Math.max(
|
|
221
|
+
0,
|
|
222
|
+
scroller.offsetWidth - scroller.clientWidth - (Number.parseFloat(style.borderLeftWidth) || 0) - (Number.parseFloat(style.borderRightWidth) || 0)
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
if (scrollbarSizes.get(header) === size) continue;
|
|
226
|
+
scrollbarSizes.set(header, size);
|
|
227
|
+
changed = true;
|
|
228
|
+
}
|
|
229
|
+
return changed;
|
|
230
|
+
}
|
|
231
|
+
function publishClearance(overlays, headerSizes, scrollbarSizes, published, overlayObserver) {
|
|
232
|
+
const current = /* @__PURE__ */ new Map();
|
|
233
|
+
for (const [header, pane] of overlays) {
|
|
234
|
+
const size = headerSizes.get(header);
|
|
235
|
+
const scrollbar = scrollbarSizes.get(header);
|
|
236
|
+
if (size !== void 0)
|
|
237
|
+
current.set(pane, [`${size}px`, scrollbar ? `${scrollbar}px` : ""]);
|
|
238
|
+
}
|
|
239
|
+
overlayObserver?.disconnect();
|
|
240
|
+
for (const pane of published)
|
|
241
|
+
if (!current.has(pane)) {
|
|
242
|
+
pane.style.removeProperty(CLEARANCE_BLOCK_START);
|
|
243
|
+
pane.style.removeProperty(SCROLLBAR_INLINE_SIZE);
|
|
244
|
+
if (!pane.getAttribute("style")) pane.removeAttribute("style");
|
|
245
|
+
pane.removeAttribute(HEADER_OVERLAY);
|
|
246
|
+
}
|
|
247
|
+
published.clear();
|
|
248
|
+
for (const [pane, [value, scrollbar]] of current) {
|
|
249
|
+
if (pane.style.getPropertyValue(CLEARANCE_BLOCK_START) !== value)
|
|
250
|
+
pane.style.setProperty(CLEARANCE_BLOCK_START, value);
|
|
251
|
+
if (pane.style.getPropertyValue(SCROLLBAR_INLINE_SIZE) !== scrollbar) {
|
|
252
|
+
if (scrollbar) pane.style.setProperty(SCROLLBAR_INLINE_SIZE, scrollbar);
|
|
253
|
+
else pane.style.removeProperty(SCROLLBAR_INLINE_SIZE);
|
|
254
|
+
}
|
|
255
|
+
if (pane.getAttribute(HEADER_OVERLAY) !== "measured")
|
|
256
|
+
pane.setAttribute(HEADER_OVERLAY, "measured");
|
|
257
|
+
published.add(pane);
|
|
258
|
+
overlayObserver?.observe(pane, {
|
|
259
|
+
attributes: true,
|
|
260
|
+
attributeFilter: ["style", HEADER_OVERLAY]
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function fadeEdges(pairings, faded, only) {
|
|
265
|
+
const current = /* @__PURE__ */ new Set();
|
|
266
|
+
for (const { scroller, chrome } of pairings)
|
|
267
|
+
for (const edge of ["t", "b"]) {
|
|
268
|
+
const element = chrome[edge];
|
|
269
|
+
const owner = element?.parentElement;
|
|
270
|
+
if (!element || !owner?.hasAttribute("data-scroll-edge")) continue;
|
|
271
|
+
current.add(element);
|
|
272
|
+
if (only && scroller !== only) continue;
|
|
273
|
+
const distance = Number(owner.getAttribute(SCROLL_EDGE_DISTANCE)) || DEFAULT_SCROLL_EDGE_DISTANCE;
|
|
274
|
+
const travelled = edge === "t" ? scroller.scrollTop : scroller.scrollHeight - scroller.clientHeight - scroller.scrollTop;
|
|
275
|
+
const value = String(
|
|
276
|
+
Math.round(Math.min(1, Math.max(0, travelled / distance)) * 1e3) / 1e3
|
|
277
|
+
);
|
|
278
|
+
if (element.style.getPropertyValue(SCROLL_EDGE_PROGRESS) !== value)
|
|
279
|
+
element.style.setProperty(SCROLL_EDGE_PROGRESS, value);
|
|
280
|
+
}
|
|
281
|
+
if (only) return;
|
|
282
|
+
for (const element of faded)
|
|
283
|
+
if (!current.has(element)) {
|
|
284
|
+
element.style.removeProperty(SCROLL_EDGE_PROGRESS);
|
|
285
|
+
if (!element.getAttribute("style")) element.removeAttribute("style");
|
|
286
|
+
}
|
|
287
|
+
faded.clear();
|
|
288
|
+
for (const element of current) faded.add(element);
|
|
289
|
+
}
|
|
290
|
+
function applyOverflow(pairings, overflow, written, faded) {
|
|
291
|
+
const current = /* @__PURE__ */ new Map();
|
|
292
|
+
const dividers = /* @__PURE__ */ new Map();
|
|
293
|
+
for (const { scroller, chrome } of pairings) {
|
|
294
|
+
const edges = overflow.get(scroller);
|
|
295
|
+
(current.get(scroller) ?? current.set(scroller, /* @__PURE__ */ new Map()).get(scroller)).set(SCROLL_OVERFLOW, edges);
|
|
296
|
+
for (const edge of EDGES) {
|
|
297
|
+
const element = chrome[edge];
|
|
298
|
+
if (!element) continue;
|
|
299
|
+
const shown = dividers.get(element) ?? /* @__PURE__ */ new Set();
|
|
300
|
+
dividers.set(element, shown);
|
|
301
|
+
if (edges.includes(edge)) shown.add(FACING[edge]);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
for (const [element, shown] of dividers)
|
|
305
|
+
(current.get(element) ?? current.set(element, /* @__PURE__ */ new Map()).get(element)).set(
|
|
306
|
+
SCROLL_DIVIDER,
|
|
307
|
+
sides(shown)
|
|
308
|
+
);
|
|
309
|
+
for (const [element, values] of written)
|
|
310
|
+
for (const name of values.keys())
|
|
311
|
+
if (!current.get(element)?.has(name)) write(element, name, "");
|
|
312
|
+
written.clear();
|
|
313
|
+
for (const [element, values] of current) {
|
|
314
|
+
written.set(element, values);
|
|
315
|
+
for (const [name, value] of values) write(element, name, value);
|
|
316
|
+
}
|
|
317
|
+
fadeEdges(pairings, faded);
|
|
318
|
+
}
|
|
319
|
+
function observeSizes(resizeObserver, pairings, overlays, observed) {
|
|
320
|
+
if (!resizeObserver) return;
|
|
321
|
+
const wanted = /* @__PURE__ */ new Map();
|
|
322
|
+
for (const { scroller } of pairings) {
|
|
323
|
+
wanted.set(scroller, false);
|
|
324
|
+
for (const child of scroller.children) wanted.set(child, false);
|
|
325
|
+
}
|
|
326
|
+
for (const header of overlays.keys()) wanted.set(header, true);
|
|
327
|
+
for (const element of observed.keys())
|
|
328
|
+
if (!wanted.has(element)) {
|
|
329
|
+
resizeObserver.unobserve(element);
|
|
330
|
+
observed.delete(element);
|
|
331
|
+
}
|
|
332
|
+
for (const [element, borderBox] of wanted)
|
|
333
|
+
if (observed.get(element) !== borderBox) {
|
|
334
|
+
resizeObserver.observe(
|
|
335
|
+
element,
|
|
336
|
+
borderBox ? { box: "border-box" } : void 0
|
|
337
|
+
);
|
|
338
|
+
observed.set(element, borderBox);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function syncRootListeners(registrations, listenedRoots, onScroll, mutationObserver) {
|
|
342
|
+
const roots = new Set([...registrations].map(({ root }) => root));
|
|
343
|
+
for (const root of listenedRoots)
|
|
344
|
+
if (!roots.has(root)) {
|
|
345
|
+
root.removeEventListener("scroll", onScroll, { capture: true });
|
|
346
|
+
listenedRoots.delete(root);
|
|
347
|
+
}
|
|
348
|
+
for (const root of roots)
|
|
349
|
+
if (!listenedRoots.has(root)) {
|
|
350
|
+
root.addEventListener("scroll", onScroll, {
|
|
351
|
+
capture: true,
|
|
352
|
+
passive: true
|
|
353
|
+
});
|
|
354
|
+
listenedRoots.add(root);
|
|
355
|
+
}
|
|
356
|
+
mutationObserver?.disconnect();
|
|
357
|
+
for (const root of roots)
|
|
358
|
+
mutationObserver?.observe(root, {
|
|
359
|
+
subtree: true,
|
|
360
|
+
childList: true,
|
|
361
|
+
attributes: true,
|
|
362
|
+
// Old values tell a class or id that stopped being structural.
|
|
363
|
+
attributeOldValue: true,
|
|
364
|
+
// The shown NavStack view and TabNavigator scene change by attribute,
|
|
365
|
+
// and a Pane's header presentation by its attributes.
|
|
366
|
+
attributeFilter: [
|
|
367
|
+
"data-header-presentation",
|
|
368
|
+
"data-chrome-placement",
|
|
369
|
+
SCROLL_OVERFLOW,
|
|
370
|
+
SCROLL_DIVIDER,
|
|
371
|
+
"id",
|
|
372
|
+
"class",
|
|
373
|
+
"data-nav-active",
|
|
374
|
+
"data-nav-exiting",
|
|
375
|
+
"data-active"
|
|
376
|
+
]
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function createController(ownerDocument) {
|
|
380
|
+
const view = ownerDocument.defaultView;
|
|
381
|
+
let disposed = false;
|
|
382
|
+
const registrations = /* @__PURE__ */ new Set();
|
|
383
|
+
const listenedRoots = /* @__PURE__ */ new Set();
|
|
384
|
+
let pairings = [];
|
|
385
|
+
const overflow = /* @__PURE__ */ new Map();
|
|
386
|
+
const written = /* @__PURE__ */ new Map();
|
|
387
|
+
const faded = /* @__PURE__ */ new Set();
|
|
388
|
+
let overlays = /* @__PURE__ */ new Map();
|
|
389
|
+
const headerSizes = /* @__PURE__ */ new Map();
|
|
390
|
+
const scrollbarSizes = /* @__PURE__ */ new Map();
|
|
391
|
+
const published = /* @__PURE__ */ new Set();
|
|
392
|
+
const overlayObserver = view?.MutationObserver ? new view.MutationObserver(() => {
|
|
393
|
+
if (!disposed)
|
|
394
|
+
publishClearance(
|
|
395
|
+
overlays,
|
|
396
|
+
headerSizes,
|
|
397
|
+
scrollbarSizes,
|
|
398
|
+
published,
|
|
399
|
+
overlayObserver
|
|
400
|
+
);
|
|
401
|
+
}) : void 0;
|
|
402
|
+
const observed = /* @__PURE__ */ new Map();
|
|
403
|
+
let probe;
|
|
404
|
+
let probePending = false;
|
|
405
|
+
const resizeObserver = view?.ResizeObserver ? new view.ResizeObserver((entries) => {
|
|
406
|
+
if (disposed) return;
|
|
407
|
+
const scrollers = new Set(pairings.map(({ scroller }) => scroller));
|
|
408
|
+
let headerResized = false;
|
|
409
|
+
let scrollersResized = false;
|
|
410
|
+
for (const entry of entries) {
|
|
411
|
+
const { target } = entry;
|
|
412
|
+
if (overlays.has(target)) {
|
|
413
|
+
headerSizes.set(
|
|
414
|
+
target,
|
|
415
|
+
entry.borderBoxSize?.[0]?.blockSize ?? target.getBoundingClientRect().height
|
|
416
|
+
);
|
|
417
|
+
headerResized = true;
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
scrollersResized = true;
|
|
421
|
+
if (target === probe) {
|
|
422
|
+
probePending = false;
|
|
423
|
+
for (const scroller2 of overflow.keys())
|
|
424
|
+
overflow.set(scroller2, measure(scroller2));
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
const scroller = scrollers.has(target) ? target : target.parentElement;
|
|
428
|
+
if (scroller && scrollers.has(scroller))
|
|
429
|
+
overflow.set(scroller, measure(scroller));
|
|
430
|
+
}
|
|
431
|
+
if (scrollersResized && measureScrollbars(overlays, scrollbarSizes))
|
|
432
|
+
headerResized = true;
|
|
433
|
+
applyOverflow(pairings, overflow, written, faded);
|
|
434
|
+
if (headerResized)
|
|
435
|
+
publishClearance(
|
|
436
|
+
overlays,
|
|
437
|
+
headerSizes,
|
|
438
|
+
scrollbarSizes,
|
|
439
|
+
published,
|
|
440
|
+
overlayObserver
|
|
441
|
+
);
|
|
442
|
+
}) : void 0;
|
|
443
|
+
const refresh = (afterLayout = false) => {
|
|
444
|
+
const deferred = afterLayout && resizeObserver !== void 0;
|
|
445
|
+
const previous = deferred ? new Map(overflow) : void 0;
|
|
446
|
+
pairings = collectPairings(registrations);
|
|
447
|
+
overflow.clear();
|
|
448
|
+
for (const { scroller } of pairings)
|
|
449
|
+
overflow.set(
|
|
450
|
+
scroller,
|
|
451
|
+
previous ? previous.get(scroller) ?? "" : measure(scroller)
|
|
452
|
+
);
|
|
453
|
+
overlays = collectOverlays(registrations);
|
|
454
|
+
for (const sizes of [headerSizes, scrollbarSizes])
|
|
455
|
+
for (const header of sizes.keys())
|
|
456
|
+
if (!overlays.has(header)) sizes.delete(header);
|
|
457
|
+
if (!deferred) {
|
|
458
|
+
for (const header of overlays.keys())
|
|
459
|
+
if (!headerSizes.has(header))
|
|
460
|
+
headerSizes.set(header, header.getBoundingClientRect().height);
|
|
461
|
+
}
|
|
462
|
+
if (!deferred) measureScrollbars(overlays, scrollbarSizes);
|
|
463
|
+
observeSizes(resizeObserver, pairings, overlays, observed);
|
|
464
|
+
applyOverflow(pairings, overflow, written, faded);
|
|
465
|
+
publishClearance(
|
|
466
|
+
overlays,
|
|
467
|
+
headerSizes,
|
|
468
|
+
scrollbarSizes,
|
|
469
|
+
published,
|
|
470
|
+
overlayObserver
|
|
471
|
+
);
|
|
472
|
+
if (deferred) scheduleRemeasure();
|
|
473
|
+
};
|
|
474
|
+
const remeasure = () => {
|
|
475
|
+
let changed = false;
|
|
476
|
+
for (const scroller of overflow.keys()) {
|
|
477
|
+
const edges = measure(scroller);
|
|
478
|
+
if (edges === overflow.get(scroller)) continue;
|
|
479
|
+
overflow.set(scroller, edges);
|
|
480
|
+
changed = true;
|
|
481
|
+
}
|
|
482
|
+
if (changed) applyOverflow(pairings, overflow, written, faded);
|
|
483
|
+
if (measureScrollbars(overlays, scrollbarSizes))
|
|
484
|
+
publishClearance(
|
|
485
|
+
overlays,
|
|
486
|
+
headerSizes,
|
|
487
|
+
scrollbarSizes,
|
|
488
|
+
published,
|
|
489
|
+
overlayObserver
|
|
490
|
+
);
|
|
491
|
+
};
|
|
492
|
+
let remeasureFrame;
|
|
493
|
+
const scheduleRemeasure = () => {
|
|
494
|
+
if (resizeObserver) {
|
|
495
|
+
if (probePending) return;
|
|
496
|
+
probePending = true;
|
|
497
|
+
if (!probe) {
|
|
498
|
+
probe = ownerDocument.createElement("div");
|
|
499
|
+
probe.setAttribute("aria-hidden", "true");
|
|
500
|
+
probe.style.cssText = "position:fixed;top:0;left:0;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none;contain:strict";
|
|
501
|
+
resizeObserver.observe(probe);
|
|
502
|
+
}
|
|
503
|
+
if (!probe.isConnected) ownerDocument.documentElement.append(probe);
|
|
504
|
+
probe.style.width = probe.style.width === "1px" ? "0px" : "1px";
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
if (remeasureFrame !== void 0 || !view?.requestAnimationFrame) return;
|
|
508
|
+
remeasureFrame = view.requestAnimationFrame(() => {
|
|
509
|
+
remeasureFrame = void 0;
|
|
510
|
+
remeasure();
|
|
511
|
+
});
|
|
512
|
+
};
|
|
513
|
+
const onScroll = (event) => {
|
|
514
|
+
const scroller = event.target;
|
|
515
|
+
if (!overflow.has(scroller)) return;
|
|
516
|
+
fadeEdges(pairings, faded, scroller);
|
|
517
|
+
const edges = measure(scroller);
|
|
518
|
+
if (edges === overflow.get(scroller)) return;
|
|
519
|
+
overflow.set(scroller, edges);
|
|
520
|
+
applyOverflow(pairings, overflow, written, faded);
|
|
521
|
+
};
|
|
522
|
+
const mutationObserver = view?.MutationObserver ? new view.MutationObserver((records) => {
|
|
523
|
+
if (disposed) return;
|
|
524
|
+
const ids = collectTargetIds(registrations);
|
|
525
|
+
const selector = [
|
|
526
|
+
STRUCTURAL_SELECTOR,
|
|
527
|
+
...[...ids].map((id) => `[id=${quoted(id)}]`)
|
|
528
|
+
].join(", ");
|
|
529
|
+
if (records.some((record) => changesPairings(record, ids, selector)))
|
|
530
|
+
refresh(true);
|
|
531
|
+
else {
|
|
532
|
+
if (records.some(
|
|
533
|
+
({ attributeName }) => attributeName === SCROLL_OVERFLOW || attributeName === SCROLL_DIVIDER
|
|
534
|
+
))
|
|
535
|
+
applyOverflow(pairings, overflow, written, faded);
|
|
536
|
+
if (records.some(
|
|
537
|
+
({ attributeName }) => attributeName !== SCROLL_OVERFLOW && attributeName !== SCROLL_DIVIDER
|
|
538
|
+
))
|
|
539
|
+
scheduleRemeasure();
|
|
540
|
+
}
|
|
541
|
+
}) : void 0;
|
|
542
|
+
return (registration) => {
|
|
543
|
+
registrations.add(registration);
|
|
544
|
+
syncRootListeners(registrations, listenedRoots, onScroll, mutationObserver);
|
|
545
|
+
refresh();
|
|
546
|
+
return () => {
|
|
547
|
+
if (!registrations.delete(registration)) return;
|
|
548
|
+
syncRootListeners(
|
|
549
|
+
registrations,
|
|
550
|
+
listenedRoots,
|
|
551
|
+
onScroll,
|
|
552
|
+
mutationObserver
|
|
553
|
+
);
|
|
554
|
+
if (registrations.size) refresh();
|
|
555
|
+
else {
|
|
556
|
+
disposed = true;
|
|
557
|
+
if (remeasureFrame !== void 0)
|
|
558
|
+
view?.cancelAnimationFrame(remeasureFrame);
|
|
559
|
+
remeasureFrame = void 0;
|
|
560
|
+
resizeObserver?.disconnect();
|
|
561
|
+
probe?.remove();
|
|
562
|
+
probe = void 0;
|
|
563
|
+
probePending = false;
|
|
564
|
+
for (const [element, values] of written)
|
|
565
|
+
for (const name of values.keys()) write(element, name, "");
|
|
566
|
+
written.clear();
|
|
567
|
+
overlays.clear();
|
|
568
|
+
headerSizes.clear();
|
|
569
|
+
scrollbarSizes.clear();
|
|
570
|
+
publishClearance(
|
|
571
|
+
overlays,
|
|
572
|
+
headerSizes,
|
|
573
|
+
scrollbarSizes,
|
|
574
|
+
published,
|
|
575
|
+
overlayObserver
|
|
576
|
+
);
|
|
577
|
+
overlayObserver?.disconnect();
|
|
578
|
+
overflow.clear();
|
|
579
|
+
observed.clear();
|
|
580
|
+
pairings = [];
|
|
581
|
+
fadeEdges(pairings, faded);
|
|
582
|
+
CONTROLLERS.delete(ownerDocument);
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export { wireScrollDividers };
|
|
589
|
+
|
|
590
|
+
//# sourceMappingURL=chunk-M64TAGZY.js.map
|