@mrpelz/uikit-ish 7.8.0 → 7.10.0
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/dist/components/accordion/main.d.ts +12 -0
- package/dist/components/accordion/main.d.ts.map +1 -0
- package/dist/components/accordion/main.js +20 -0
- package/dist/components/accordion/main.js.map +1 -0
- package/dist/components/accordion/style.css +23 -0
- package/dist/components/action-sheet/main.d.ts +22 -16
- package/dist/components/action-sheet/main.d.ts.map +1 -1
- package/dist/components/action-sheet/main.js +89 -19
- package/dist/components/action-sheet/main.js.map +1 -1
- package/dist/components/action-sheet/props.d.ts +17 -5
- package/dist/components/action-sheet/props.d.ts.map +1 -1
- package/dist/components/action-sheet/style.css +24 -0
- package/dist/components/activity-view/main.d.ts +15 -4
- package/dist/components/activity-view/main.d.ts.map +1 -1
- package/dist/components/activity-view/main.js +27 -14
- package/dist/components/activity-view/main.js.map +1 -1
- package/dist/components/activity-view/props.d.ts +2 -10
- package/dist/components/activity-view/props.d.ts.map +1 -1
- package/dist/components/activity-view/style.css +29 -67
- package/dist/components/alert/main.d.ts +8 -7
- package/dist/components/alert/main.d.ts.map +1 -1
- package/dist/components/alert/main.js +32 -19
- package/dist/components/alert/main.js.map +1 -1
- package/dist/components/alert/props.d.ts +13 -2
- package/dist/components/alert/props.d.ts.map +1 -1
- package/dist/components/alert/style.css +36 -50
- package/dist/components/avatar/main.d.ts +5 -3
- package/dist/components/avatar/main.d.ts.map +1 -1
- package/dist/components/avatar/main.js +10 -8
- package/dist/components/avatar/main.js.map +1 -1
- package/dist/components/avatar/props.d.ts +4 -0
- package/dist/components/avatar/props.d.ts.map +1 -1
- package/dist/components/avatar/style.css +1 -7
- package/dist/components/badge/main.d.ts +3 -3
- package/dist/components/badge/main.d.ts.map +1 -1
- package/dist/components/badge/main.js +9 -9
- package/dist/components/badge/main.js.map +1 -1
- package/dist/components/badge/props.d.ts +4 -3
- package/dist/components/badge/props.d.ts.map +1 -1
- package/dist/components/badge/style.css +10 -4
- package/dist/components/button/main.d.ts.map +1 -1
- package/dist/components/button/main.js +15 -15
- package/dist/components/button/main.js.map +1 -1
- package/dist/components/button/props.d.ts +8 -8
- package/dist/components/button/props.d.ts.map +1 -1
- package/dist/components/button/style.css +37 -55
- package/dist/components/checkbox/main.d.ts.map +1 -1
- package/dist/components/checkbox/main.js +5 -7
- package/dist/components/checkbox/main.js.map +1 -1
- package/dist/components/checkbox/style.css +5 -8
- package/dist/components/collapsible/main.d.ts +9 -0
- package/dist/components/collapsible/main.d.ts.map +1 -0
- package/dist/components/collapsible/main.js +19 -0
- package/dist/components/collapsible/main.js.map +1 -0
- package/dist/components/collapsible/style.css +23 -0
- package/dist/components/color-picker/main.d.ts +27 -4
- package/dist/components/color-picker/main.d.ts.map +1 -1
- package/dist/components/color-picker/main.js +292 -110
- package/dist/components/color-picker/main.js.map +1 -1
- package/dist/components/color-picker/props.d.ts +64 -15
- package/dist/components/color-picker/props.d.ts.map +1 -1
- package/dist/components/color-picker/style.css +133 -65
- package/dist/components/contextual-menu/main.d.ts +11 -7
- package/dist/components/contextual-menu/main.d.ts.map +1 -1
- package/dist/components/contextual-menu/main.js +207 -202
- package/dist/components/contextual-menu/main.js.map +1 -1
- package/dist/components/contextual-menu/props.d.ts +21 -34
- package/dist/components/contextual-menu/props.d.ts.map +1 -1
- package/dist/components/contextual-menu/style.css +63 -34
- package/dist/components/date-picker/handle.d.ts +41 -0
- package/dist/components/date-picker/handle.d.ts.map +1 -0
- package/dist/components/date-picker/handle.js +47 -0
- package/dist/components/date-picker/handle.js.map +1 -0
- package/dist/components/date-picker/main.d.ts +31 -49
- package/dist/components/date-picker/main.d.ts.map +1 -1
- package/dist/components/date-picker/main.js +373 -178
- package/dist/components/date-picker/main.js.map +1 -1
- package/dist/components/date-picker/pager.d.ts +24 -0
- package/dist/components/date-picker/pager.d.ts.map +1 -0
- package/dist/components/date-picker/pager.js +307 -0
- package/dist/components/date-picker/pager.js.map +1 -0
- package/dist/components/date-picker/props.d.ts +98 -27
- package/dist/components/date-picker/props.d.ts.map +1 -1
- package/dist/components/date-picker/style.css +110 -118
- package/dist/components/drawer/main.d.ts +31 -0
- package/dist/components/drawer/main.d.ts.map +1 -0
- package/dist/components/drawer/main.js +119 -0
- package/dist/components/drawer/main.js.map +1 -0
- package/dist/components/drawer/props.d.ts +39 -0
- package/dist/components/drawer/props.d.ts.map +1 -0
- package/dist/components/drawer/props.js +2 -0
- package/dist/components/drawer/props.js.map +1 -0
- package/dist/components/drawer/style.css +135 -0
- package/dist/components/edit-menu/main.d.ts +7 -7
- package/dist/components/edit-menu/main.d.ts.map +1 -1
- package/dist/components/edit-menu/main.js +57 -40
- package/dist/components/edit-menu/main.js.map +1 -1
- package/dist/components/edit-menu/props.d.ts +14 -1
- package/dist/components/edit-menu/props.d.ts.map +1 -1
- package/dist/components/edit-menu/style.css +15 -8
- package/dist/components/form/main.d.ts +8 -0
- package/dist/components/form/main.d.ts.map +1 -1
- package/dist/components/form/main.js +18 -5
- package/dist/components/form/main.js.map +1 -1
- package/dist/components/form/props.d.ts +1 -2
- package/dist/components/form/props.d.ts.map +1 -1
- package/dist/components/glass/main.d.ts +1 -1
- package/dist/components/glass/main.js +4 -4
- package/dist/components/glass/main.js.map +1 -1
- package/dist/components/glass/props.d.ts +5 -5
- package/dist/components/glass/props.d.ts.map +1 -1
- package/dist/components/glass/style.css +176 -161
- package/dist/components/header/main.d.ts +5 -4
- package/dist/components/header/main.d.ts.map +1 -1
- package/dist/components/header/main.js +64 -34
- package/dist/components/header/main.js.map +1 -1
- package/dist/components/header/props.d.ts +2 -3
- package/dist/components/header/props.d.ts.map +1 -1
- package/dist/components/header/style.css +46 -65
- package/dist/components/index.d.ts +27 -23
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +17 -13
- package/dist/components/index.js.map +1 -1
- package/dist/components/layout/main.d.ts +2 -2
- package/dist/components/layout/main.d.ts.map +1 -1
- package/dist/components/layout/main.js +63 -167
- package/dist/components/layout/main.js.map +1 -1
- package/dist/components/layout/props.d.ts +2 -20
- package/dist/components/layout/props.d.ts.map +1 -1
- package/dist/components/layout/style.css +20 -91
- package/dist/components/list/main.d.ts +58 -10
- package/dist/components/list/main.d.ts.map +1 -1
- package/dist/components/list/main.js +1022 -465
- package/dist/components/list/main.js.map +1 -1
- package/dist/components/list/props.d.ts +211 -21
- package/dist/components/list/props.d.ts.map +1 -1
- package/dist/components/list/reorder.d.ts +146 -0
- package/dist/components/list/reorder.d.ts.map +1 -0
- package/dist/components/list/reorder.js +819 -0
- package/dist/components/list/reorder.js.map +1 -0
- package/dist/components/list/select.d.ts +6 -0
- package/dist/components/list/select.d.ts.map +1 -0
- package/dist/components/list/select.js +141 -0
- package/dist/components/list/select.js.map +1 -0
- package/dist/components/list/style.css +492 -507
- package/dist/components/list/swipe-actions-handle.d.ts +40 -0
- package/dist/components/list/swipe-actions-handle.d.ts.map +1 -0
- package/dist/components/list/swipe-actions-handle.js +51 -0
- package/dist/components/list/swipe-actions-handle.js.map +1 -0
- package/dist/components/menu/main.d.ts +102 -32
- package/dist/components/menu/main.d.ts.map +1 -1
- package/dist/components/menu/main.js +510 -99
- package/dist/components/menu/main.js.map +1 -1
- package/dist/components/menu/props.d.ts +5 -5
- package/dist/components/menu/props.d.ts.map +1 -1
- package/dist/components/menu/style.css +35 -43
- package/dist/components/navigation/main.d.ts +14 -2
- package/dist/components/navigation/main.d.ts.map +1 -1
- package/dist/components/navigation/main.js +437 -119
- package/dist/components/navigation/main.js.map +1 -1
- package/dist/components/navigation/props.d.ts +53 -3
- package/dist/components/navigation/props.d.ts.map +1 -1
- package/dist/components/navigation/style.css +56 -9
- package/dist/components/page/main.d.ts.map +1 -1
- package/dist/components/page/main.js +13 -8
- package/dist/components/page/main.js.map +1 -1
- package/dist/components/page/props.d.ts +8 -0
- package/dist/components/page/props.d.ts.map +1 -1
- package/dist/components/page/style.css +39 -4
- package/dist/components/page-control/main.d.ts +2 -2
- package/dist/components/page-control/main.d.ts.map +1 -1
- package/dist/components/page-control/main.js +66 -32
- package/dist/components/page-control/main.js.map +1 -1
- package/dist/components/page-control/props.d.ts +10 -2
- package/dist/components/page-control/props.d.ts.map +1 -1
- package/dist/components/page-control/style.css +7 -2
- package/dist/components/popover/main.d.ts +11 -6
- package/dist/components/popover/main.d.ts.map +1 -1
- package/dist/components/popover/main.js +63 -38
- package/dist/components/popover/main.js.map +1 -1
- package/dist/components/popover/props.d.ts +7 -6
- package/dist/components/popover/props.d.ts.map +1 -1
- package/dist/components/popover/style.css +54 -4
- package/dist/components/progress/main.d.ts +2 -3
- package/dist/components/progress/main.d.ts.map +1 -1
- package/dist/components/progress/main.js +148 -29
- package/dist/components/progress/main.js.map +1 -1
- package/dist/components/progress/props.d.ts +43 -9
- package/dist/components/progress/props.d.ts.map +1 -1
- package/dist/components/progress/style.css +82 -50
- package/dist/components/roll/main.d.ts +1 -1
- package/dist/components/roll/main.d.ts.map +1 -1
- package/dist/components/roll/main.js +90 -34
- package/dist/components/roll/main.js.map +1 -1
- package/dist/components/roll/props.d.ts +25 -8
- package/dist/components/roll/props.d.ts.map +1 -1
- package/dist/components/roll/style.css +12 -24
- package/dist/components/segmented/main.d.ts.map +1 -1
- package/dist/components/segmented/main.js +47 -30
- package/dist/components/segmented/main.js.map +1 -1
- package/dist/components/segmented/style.css +16 -23
- package/dist/components/sheet/main.d.ts +25 -15
- package/dist/components/sheet/main.d.ts.map +1 -1
- package/dist/components/sheet/main.js +66 -78
- package/dist/components/sheet/main.js.map +1 -1
- package/dist/components/sheet/props.d.ts +37 -3
- package/dist/components/sheet/props.d.ts.map +1 -1
- package/dist/components/sheet/style.css +183 -45
- package/dist/components/sidebar/main.d.ts.map +1 -1
- package/dist/components/sidebar/main.js +9 -13
- package/dist/components/sidebar/main.js.map +1 -1
- package/dist/components/sidebar/style.css +20 -14
- package/dist/components/slider/main.d.ts.map +1 -1
- package/dist/components/slider/main.js +23 -22
- package/dist/components/slider/main.js.map +1 -1
- package/dist/components/slider/props.d.ts +1 -2
- package/dist/components/slider/props.d.ts.map +1 -1
- package/dist/components/slider/style.css +27 -53
- package/dist/components/stepper/main.d.ts +4 -6
- package/dist/components/stepper/main.d.ts.map +1 -1
- package/dist/components/stepper/main.js +29 -25
- package/dist/components/stepper/main.js.map +1 -1
- package/dist/components/stepper/style.css +12 -16
- package/dist/components/switch/main.d.ts.map +1 -1
- package/dist/components/switch/main.js +40 -28
- package/dist/components/switch/main.js.map +1 -1
- package/dist/components/switch/props.d.ts +7 -5
- package/dist/components/switch/props.d.ts.map +1 -1
- package/dist/components/switch/style.css +40 -17
- package/dist/components/symbol/main.d.ts +2 -2
- package/dist/components/symbol/main.d.ts.map +1 -1
- package/dist/components/symbol/main.js +36 -28
- package/dist/components/symbol/main.js.map +1 -1
- package/dist/components/symbol/props.d.ts +39 -4
- package/dist/components/symbol/props.d.ts.map +1 -1
- package/dist/components/symbol/style.css +26 -5
- package/dist/components/tab-bar/main.d.ts +2 -2
- package/dist/components/tab-bar/main.d.ts.map +1 -1
- package/dist/components/tab-bar/main.js +133 -101
- package/dist/components/tab-bar/main.js.map +1 -1
- package/dist/components/tab-bar/props.d.ts +6 -6
- package/dist/components/tab-bar/props.d.ts.map +1 -1
- package/dist/components/tab-bar/style.css +113 -99
- package/dist/components/text-field/main.d.ts +3 -2
- package/dist/components/text-field/main.d.ts.map +1 -1
- package/dist/components/text-field/main.js +29 -30
- package/dist/components/text-field/main.js.map +1 -1
- package/dist/components/text-field/props.d.ts +23 -1
- package/dist/components/text-field/props.d.ts.map +1 -1
- package/dist/components/text-field/style.css +122 -82
- package/dist/components/toolbar/main.js +27 -27
- package/dist/components/toolbar/main.js.map +1 -1
- package/dist/components/toolbar/props.d.ts +10 -4
- package/dist/components/toolbar/props.d.ts.map +1 -1
- package/dist/components/toolbar/style.css +39 -33
- package/dist/components/tooltip/main.d.ts +10 -9
- package/dist/components/tooltip/main.d.ts.map +1 -1
- package/dist/components/tooltip/main.js +39 -10
- package/dist/components/tooltip/main.js.map +1 -1
- package/dist/components/tooltip/props.d.ts +2 -0
- package/dist/components/tooltip/props.d.ts.map +1 -1
- package/dist/components/tooltip/style.css +16 -16
- package/dist/components/typography/main.d.ts +2 -2
- package/dist/components/typography/main.d.ts.map +1 -1
- package/dist/components/typography/main.js +24 -16
- package/dist/components/typography/main.js.map +1 -1
- package/dist/components/typography/props.d.ts +11 -18
- package/dist/components/typography/props.d.ts.map +1 -1
- package/dist/components/typography/style.css +503 -623
- package/dist/components/utils/main.d.ts +78 -8
- package/dist/components/utils/main.d.ts.map +1 -1
- package/dist/components/utils/main.js +235 -16
- package/dist/components/utils/main.js.map +1 -1
- package/dist/components/utils/props.d.ts +27 -4
- package/dist/components/utils/props.d.ts.map +1 -1
- package/dist/components/utils/style.css +31 -18
- package/dist/components/viewport/edge-effect.d.ts +10 -0
- package/dist/components/viewport/edge-effect.d.ts.map +1 -0
- package/dist/components/viewport/edge-effect.js +100 -0
- package/dist/components/viewport/edge-effect.js.map +1 -0
- package/dist/components/viewport/edge.d.ts +39 -0
- package/dist/components/viewport/edge.d.ts.map +1 -0
- package/dist/components/viewport/edge.js +151 -0
- package/dist/components/viewport/edge.js.map +1 -0
- package/dist/components/viewport/input.d.ts +39 -0
- package/dist/components/viewport/input.d.ts.map +1 -0
- package/dist/components/viewport/input.js +280 -0
- package/dist/components/viewport/input.js.map +1 -0
- package/dist/components/viewport/main.d.ts +47 -9
- package/dist/components/viewport/main.d.ts.map +1 -1
- package/dist/components/viewport/main.js +745 -86
- package/dist/components/viewport/main.js.map +1 -1
- package/dist/components/viewport/padding.d.ts +78 -0
- package/dist/components/viewport/padding.d.ts.map +1 -0
- package/dist/components/viewport/padding.js +321 -0
- package/dist/components/viewport/padding.js.map +1 -0
- package/dist/components/viewport/props.d.ts +220 -11
- package/dist/components/viewport/props.d.ts.map +1 -1
- package/dist/components/viewport/style.css +377 -6
- package/dist/main.d.ts +0 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js.map +1 -1
- package/dist/styles.css +318 -302
- package/dist/styles.d.ts +2 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +2 -1
- package/dist/styles.js.map +1 -1
- package/package.json +8 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/utils/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/utils/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAEf,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3C,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GACzB,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC;AAExE,mFAAmF;AACnF,MAAM,MAAM,WAAW,GACrB,WAAW,GAAG,aAAa,GAAG,YAAY,GAAG,cAAc,CAAC;AAE9D,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC/C,oBAAoB,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACxD,eAAe,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACnD,aAAa,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACjD,aAAa,CAAC,EAAE,mBAAmB,CAAC,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ACH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC/D;;;OAGG;IACH,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,KAAK,KAAK,GAAG,SAAS,CAAC;CAC/D,CAAC"}
|
|
@@ -11,25 +11,22 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Recurring patterns:
|
|
13
13
|
*
|
|
14
|
-
* - Font weights, also between the static weights of the system font (
|
|
15
|
-
*
|
|
14
|
+
* - Font weights, also between the static weights of the system font (e.g.
|
|
15
|
+
* 510, 590): the exact weight on the variable weight axis
|
|
16
16
|
* (`font-variation-settings: 'wght' W`), `font-weight` rounded down to a
|
|
17
17
|
* static weight (`round(down, W, 100)`; fonts without the axis use that).
|
|
18
18
|
* Chrome would otherwise match e.g. 510 to the next heavier static face
|
|
19
|
-
* (Semibold), which the axis can't undo.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* `color-scheme`
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `@media (prefers-color-scheme: dark)`, and both again where
|
|
31
|
-
* `data-color-scheme` forces either (`&:where(:root[…] *)`: the rule's
|
|
32
|
-
* specificity kept, after the media query, so they win).
|
|
19
|
+
* (Semibold), which the axis can't undo. Symbols inside keep their one
|
|
20
|
+
* weight (see Symbol); emphasized (e.g. selected), a host sets
|
|
21
|
+
* `--uikit-symbol-emphasis` instead.
|
|
22
|
+
* - Color schemes: colors as `light-dark(light, dark)`, by the inherited
|
|
23
|
+
* `color-scheme` (the user's preference, or forced by a
|
|
24
|
+
* `data-color-scheme`, on the root element or any other, see
|
|
25
|
+
* styles.css). Other values (e.g. blend modes, shadows): light
|
|
26
|
+
* declarations, the dark ones in `@media (prefers-color-scheme: dark)`,
|
|
27
|
+
* and both again where `data-color-scheme` forces either
|
|
28
|
+
* (`&:where([…], […] *)`: the rule's specificity kept, after the media
|
|
29
|
+
* query, so they win).
|
|
33
30
|
* - Cursors, as `Button`'s: a `cursor` attribute (prop), or a fallback
|
|
34
31
|
* (`--uikit-utils-cursor: attr(cursor type(<custom-ident>), …)`), applied on
|
|
35
32
|
* devices that hover.
|
|
@@ -38,6 +35,20 @@
|
|
|
38
35
|
|
|
39
36
|
/* Utils (see main.tsx). */
|
|
40
37
|
@layer uikit-ish {
|
|
38
|
+
/* Scrollbars, hidden in every component's scroll container (none at
|
|
39
|
+
rest): they couldn't be lifted above the layers over them
|
|
40
|
+
(bars, glass, a scroll edge effect), nor kept whole in rounded
|
|
41
|
+
containers (a sheet's, a popover's corners). Scrolled by touch, a
|
|
42
|
+
wheel or a trackpad, and the keys. (No specificity: a component's or
|
|
43
|
+
an app's own rule overrides it.) */
|
|
44
|
+
:where([class*='uikit-']) {
|
|
45
|
+
scrollbar-width: none;
|
|
46
|
+
|
|
47
|
+
&::-webkit-scrollbar {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
.uikit-utils-reserve-layer {
|
|
42
53
|
grid-area: 1 / 1;
|
|
43
54
|
white-space: nowrap;
|
|
@@ -61,8 +72,10 @@
|
|
|
61
72
|
|
|
62
73
|
/* Moving (with a pointer hovering the items, or a touch dragging over
|
|
63
74
|
them, see `draggingAttribute`): quick, so it keeps up at normal
|
|
64
|
-
speeds. Otherwise (keys) it jumps.
|
|
65
|
-
|
|
75
|
+
speeds. Otherwise (keys, without a pointer that hovers) it jumps.
|
|
76
|
+
Any pointer: an iPad's is touch first (`hover: none`), its trackpad
|
|
77
|
+
hovering all the same. */
|
|
78
|
+
@media (any-hover: hover) {
|
|
66
79
|
transition-duration: 80ms;
|
|
67
80
|
transition-property: translate, width, height, border-radius, opacity;
|
|
68
81
|
transition-timing-function: ease-out;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionComponent, RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A scroller's edge effects (see above): render it in the scroller,
|
|
4
|
+
* given its element (internal; `Page.Root`'s, a sheet's content's, the
|
|
5
|
+
* content layer's).
|
|
6
|
+
*/
|
|
7
|
+
export declare const EdgeEffects: FunctionComponent<{
|
|
8
|
+
scroller: RefObject<HTMLElement | null>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=edge-effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-effect.d.ts","sourceRoot":"","sources":["../../../src/components/viewport/edge-effect.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EAIV,MAAM,OAAO,CAAC;AAkIf;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC;IAC1C,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzC,CA0BA,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useRef, useState, } from 'react';
|
|
3
|
+
import { edgeElementsIn, holdsScroller, subscribeEdgeElements, subscribeScrollers, } from './edge.js';
|
|
4
|
+
import { useEdgeEffectOf } from './padding.js';
|
|
5
|
+
/** How far content scrolls under the bars for the effect to show (px). */
|
|
6
|
+
const ramp = 16;
|
|
7
|
+
/**
|
|
8
|
+
* How far content's scrolled under an edge's bars, 0 to 1 (see `ramp`); a
|
|
9
|
+
* pixel's none (a page bouncing always scrolls by one, see Page).
|
|
10
|
+
*/
|
|
11
|
+
const progressOf = (scroller, edge) => {
|
|
12
|
+
const range = scroller.scrollHeight - scroller.clientHeight;
|
|
13
|
+
const under = edge === 'block-start' ? scroller.scrollTop : range - scroller.scrollTop;
|
|
14
|
+
return Math.min(Math.max((under - 1) / ramp, 0), 1);
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Its progress (see `progressOf`), and how far beyond the bars the edge
|
|
18
|
+
* elements stuck to them reach (px, from the bars' inner side, `line`):
|
|
19
|
+
* measured as the scroller scrolls or resizes, and as they change.
|
|
20
|
+
*/
|
|
21
|
+
const useMeasure = (layer, line, scroller, edge) => {
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
const { current: element } = scroller;
|
|
24
|
+
if (!element)
|
|
25
|
+
return undefined;
|
|
26
|
+
let frame = 0;
|
|
27
|
+
let written = '';
|
|
28
|
+
const measure = () => {
|
|
29
|
+
frame = 0;
|
|
30
|
+
const { current: target } = layer;
|
|
31
|
+
const lineRect = line.current?.getBoundingClientRect();
|
|
32
|
+
if (!target || !lineRect)
|
|
33
|
+
return;
|
|
34
|
+
let extent = 0;
|
|
35
|
+
for (const stuck of edgeElementsIn(element, edge)) {
|
|
36
|
+
const box = stuck.getBoundingClientRect();
|
|
37
|
+
if (edge === 'block-start' && box.top <= lineRect.top + 1) {
|
|
38
|
+
extent = Math.max(extent, box.bottom - lineRect.top);
|
|
39
|
+
}
|
|
40
|
+
if (edge === 'block-end' && box.bottom >= lineRect.top - 1) {
|
|
41
|
+
extent = Math.max(extent, lineRect.top - box.top);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const progress = String(progressOf(element, edge));
|
|
45
|
+
const value = `${String(Math.round(extent))}px`;
|
|
46
|
+
if (`${progress} ${value}` === written)
|
|
47
|
+
return;
|
|
48
|
+
written = `${progress} ${value}`;
|
|
49
|
+
target.style.setProperty('--uikit-viewport-edge-progress', progress);
|
|
50
|
+
target.style.setProperty('--uikit-viewport-edge-extent', value);
|
|
51
|
+
};
|
|
52
|
+
const schedule = () => {
|
|
53
|
+
if (frame === 0)
|
|
54
|
+
frame = requestAnimationFrame(measure);
|
|
55
|
+
};
|
|
56
|
+
measure();
|
|
57
|
+
element.addEventListener('scroll', schedule, { passive: true });
|
|
58
|
+
const observer = new ResizeObserver(schedule);
|
|
59
|
+
observer.observe(element);
|
|
60
|
+
const unsubscribe = subscribeEdgeElements(schedule);
|
|
61
|
+
return () => {
|
|
62
|
+
cancelAnimationFrame(frame);
|
|
63
|
+
element.removeEventListener('scroll', schedule);
|
|
64
|
+
observer.disconnect();
|
|
65
|
+
unsubscribe();
|
|
66
|
+
};
|
|
67
|
+
}, [edge, layer, line, scroller]);
|
|
68
|
+
};
|
|
69
|
+
const Layer = ({ edge, scroller }) => {
|
|
70
|
+
const effect = useEdgeEffectOf(edge);
|
|
71
|
+
const layer = useRef(null);
|
|
72
|
+
const line = useRef(null);
|
|
73
|
+
useMeasure(layer, line, scroller, edge);
|
|
74
|
+
if (!effect)
|
|
75
|
+
return null;
|
|
76
|
+
return (_jsx("div", { ref: layer, "aria-hidden": "true", className: "uikit-viewport-edge-effect", "data-edge": edge, "data-edge-effect": effect.effect, "data-edge-tinted": effect.tint ? '' : undefined, "data-keyboard": effect.keyboard, "data-viewport-part": "edge-effect", style: {
|
|
77
|
+
'--uikit-viewport-edge-size': `${String(effect.size)}px`,
|
|
78
|
+
'--uikit-viewport-edge-tint': effect.tint,
|
|
79
|
+
}, children: _jsx("div", { ref: line, className: "uikit-viewport-edge-line" }) }));
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* A scroller's edge effects (see above): render it in the scroller,
|
|
83
|
+
* given its element (internal; `Page.Root`'s, a sheet's content's, the
|
|
84
|
+
* content layer's).
|
|
85
|
+
*/
|
|
86
|
+
export const EdgeEffects = ({ scroller }) => {
|
|
87
|
+
const [isHolding, setHolding] = useState(false);
|
|
88
|
+
useLayoutEffect(() => {
|
|
89
|
+
const resolve = () => {
|
|
90
|
+
const { current: element } = scroller;
|
|
91
|
+
setHolding(element ? holdsScroller(element) : false);
|
|
92
|
+
};
|
|
93
|
+
resolve();
|
|
94
|
+
return subscribeScrollers(resolve);
|
|
95
|
+
}, [scroller]);
|
|
96
|
+
if (isHolding)
|
|
97
|
+
return null;
|
|
98
|
+
return (_jsxs(_Fragment, { children: [_jsx(Layer, { edge: "block-start", scroller: scroller }), _jsx(Layer, { edge: "block-end", scroller: scroller })] }));
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=edge-effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-effect.js","sourceRoot":"","sources":["../../../src/components/viewport/edge-effect.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,eAAe,EACf,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAiB/C,0EAA0E;AAC1E,MAAM,IAAI,GAAG,EAAE,CAAC;AAEhB;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,QAAiB,EAAE,IAAe,EAAE,EAAE;IACxD,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC5D,MAAM,KAAK,GACT,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC;IAC3E,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,GAAG,CACjB,KAAuC,EACvC,IAAsC,EACtC,QAAuC,EACvC,IAAe,EACf,EAAE;IACF,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;QACtC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC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C,WAAW,EAChB,QAAQ,EAAE,QAAQ,GAClB,IACD,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
type BlockEdge = 'block-start' | 'block-end';
|
|
3
|
+
/**
|
|
4
|
+
* The shown scroller filling `rect` (within `container`, if given): of
|
|
5
|
+
* nested ones, the innermost (what scrolls there); of others, the one
|
|
6
|
+
* overlapping it most.
|
|
7
|
+
*/
|
|
8
|
+
export declare const scrollerUnder: (rect: DOMRect, container?: Element | null) => Element | undefined;
|
|
9
|
+
/** Registers a scroller (see above), until the returned function. */
|
|
10
|
+
export declare const registerScroller: (element: Element) => (() => void);
|
|
11
|
+
/** A scroller (see above), registered while mounted. */
|
|
12
|
+
export declare const useScrollerRegistration: (ref: RefObject<Element | null>) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Tells `listener` of scrollers registered, resized, shown or hidden (e.g.
|
|
15
|
+
* for a provider to track the one filling its screen), until the returned
|
|
16
|
+
* function.
|
|
17
|
+
*/
|
|
18
|
+
export declare const subscribeScrollers: (listener: () => void) => (() => void);
|
|
19
|
+
/**
|
|
20
|
+
* Whether a registered scroller is within `scroller` (e.g. a page within
|
|
21
|
+
* the content layer: it draws the edge effects, see `EdgeEffects`).
|
|
22
|
+
*/
|
|
23
|
+
export declare const holdsScroller: (scroller: Element) => boolean;
|
|
24
|
+
/** The edge elements at `edge` within `scroller` (shown). */
|
|
25
|
+
export declare const edgeElementsIn: (scroller: Element, edge: BlockEdge) => HTMLElement[];
|
|
26
|
+
/**
|
|
27
|
+
* Tells `listener` of edge elements registered, or resized, until the
|
|
28
|
+
* returned function.
|
|
29
|
+
*/
|
|
30
|
+
export declare const subscribeEdgeElements: (listener: () => void) => (() => void);
|
|
31
|
+
/**
|
|
32
|
+
* Something sticking to an edge's bar (e.g. a header's accessory, stuck
|
|
33
|
+
* below it): while it's stuck, the edge's effect reaches beyond the bar to
|
|
34
|
+
* cover it too (see `EdgeEffects`). Registered while mounted; at the block
|
|
35
|
+
* start or end.
|
|
36
|
+
*/
|
|
37
|
+
export declare const useViewportEdgeElement: (ref: RefObject<HTMLElement | null>, edge: BlockEdge) => void;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=edge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../../src/components/viewport/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAC;AAUnD,KAAK,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;AA0B7C;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACxB,MAAM,OAAO,EACb,YAAY,OAAO,GAAG,IAAI,KACzB,OAAO,GAAG,SAiBZ,CAAC;AA+BF,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,CAAC,MAAM,IAAI,CAa9D,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,GAClC,KAAK,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,KAC7B,IAKF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAKpE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,OAAO,KAAG,OAG/C,CAAC;AAEJ,6DAA6D;AAC7D,eAAO,MAAM,cAAc,GACzB,UAAU,OAAO,EACjB,MAAM,SAAS,KACd,WAAW,EAMkB,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAKvE,CAAC;AAMF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,MAAM,SAAS,KACd,IAcF,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { useLayoutEffect } from 'react';
|
|
2
|
+
const scrollers = new Set();
|
|
3
|
+
/** Who's told of scrollers registered, resized, shown or hidden. */
|
|
4
|
+
const scrollerListeners = new Set();
|
|
5
|
+
const edgeElements = new Map();
|
|
6
|
+
/** Who's told of edge elements registered, or resized. */
|
|
7
|
+
const edgeElementListeners = new Set();
|
|
8
|
+
let frame = 0;
|
|
9
|
+
let resizeObserver;
|
|
10
|
+
let intersectionObserver;
|
|
11
|
+
const isShown = (element) => element.checkVisibility({ visibilityProperty: true });
|
|
12
|
+
const rectOf = (element) => element === document.scrollingElement
|
|
13
|
+
? new DOMRect(0, 0, innerWidth, innerHeight)
|
|
14
|
+
: element.getBoundingClientRect();
|
|
15
|
+
const overlap = (a, b) => Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left)) *
|
|
16
|
+
Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));
|
|
17
|
+
/**
|
|
18
|
+
* The shown scroller filling `rect` (within `container`, if given): of
|
|
19
|
+
* nested ones, the innermost (what scrolls there); of others, the one
|
|
20
|
+
* overlapping it most.
|
|
21
|
+
*/
|
|
22
|
+
export const scrollerUnder = (rect, container) => {
|
|
23
|
+
let best;
|
|
24
|
+
let bestArea = 0;
|
|
25
|
+
for (const scroller of scrollers) {
|
|
26
|
+
if (!scroller.isConnected || !isShown(scroller))
|
|
27
|
+
continue;
|
|
28
|
+
if (container && !container.contains(scroller))
|
|
29
|
+
continue;
|
|
30
|
+
const area = overlap(rect, rectOf(scroller));
|
|
31
|
+
if (area <= 0)
|
|
32
|
+
continue;
|
|
33
|
+
const isBetter = !best ||
|
|
34
|
+
best.contains(scroller) ||
|
|
35
|
+
(!scroller.contains(best) && area > bestArea);
|
|
36
|
+
if (!isBetter)
|
|
37
|
+
continue;
|
|
38
|
+
best = scroller;
|
|
39
|
+
bestArea = area;
|
|
40
|
+
}
|
|
41
|
+
return best;
|
|
42
|
+
};
|
|
43
|
+
const notify = () => {
|
|
44
|
+
if (frame !== 0)
|
|
45
|
+
return;
|
|
46
|
+
frame = requestAnimationFrame(() => {
|
|
47
|
+
frame = 0;
|
|
48
|
+
for (const listener of scrollerListeners)
|
|
49
|
+
listener();
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
/** Observing while scrollers are registered; let go of with the last. */
|
|
53
|
+
const observe = () => {
|
|
54
|
+
if (resizeObserver)
|
|
55
|
+
return;
|
|
56
|
+
resizeObserver = new ResizeObserver(notify);
|
|
57
|
+
intersectionObserver = new IntersectionObserver(notify, {
|
|
58
|
+
threshold: [0, 0.5, 1],
|
|
59
|
+
});
|
|
60
|
+
addEventListener('resize', notify);
|
|
61
|
+
};
|
|
62
|
+
const release = () => {
|
|
63
|
+
if (scrollers.size > 0)
|
|
64
|
+
return;
|
|
65
|
+
resizeObserver?.disconnect();
|
|
66
|
+
intersectionObserver?.disconnect();
|
|
67
|
+
resizeObserver = undefined;
|
|
68
|
+
intersectionObserver = undefined;
|
|
69
|
+
removeEventListener('resize', notify);
|
|
70
|
+
cancelAnimationFrame(frame);
|
|
71
|
+
frame = 0;
|
|
72
|
+
};
|
|
73
|
+
/** Registers a scroller (see above), until the returned function. */
|
|
74
|
+
export const registerScroller = (element) => {
|
|
75
|
+
observe();
|
|
76
|
+
scrollers.add(element);
|
|
77
|
+
resizeObserver?.observe(element);
|
|
78
|
+
intersectionObserver?.observe(element);
|
|
79
|
+
notify();
|
|
80
|
+
return () => {
|
|
81
|
+
scrollers.delete(element);
|
|
82
|
+
resizeObserver?.unobserve(element);
|
|
83
|
+
intersectionObserver?.unobserve(element);
|
|
84
|
+
notify();
|
|
85
|
+
release();
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
/** A scroller (see above), registered while mounted. */
|
|
89
|
+
export const useScrollerRegistration = (ref) => {
|
|
90
|
+
useLayoutEffect(() => {
|
|
91
|
+
const { current: element } = ref;
|
|
92
|
+
return element ? registerScroller(element) : undefined;
|
|
93
|
+
}, [ref]);
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Tells `listener` of scrollers registered, resized, shown or hidden (e.g.
|
|
97
|
+
* for a provider to track the one filling its screen), until the returned
|
|
98
|
+
* function.
|
|
99
|
+
*/
|
|
100
|
+
export const subscribeScrollers = (listener) => {
|
|
101
|
+
scrollerListeners.add(listener);
|
|
102
|
+
return () => {
|
|
103
|
+
scrollerListeners.delete(listener);
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Whether a registered scroller is within `scroller` (e.g. a page within
|
|
108
|
+
* the content layer: it draws the edge effects, see `EdgeEffects`).
|
|
109
|
+
*/
|
|
110
|
+
export const holdsScroller = (scroller) => [...scrollers].some((element) => element !== scroller && scroller.contains(element));
|
|
111
|
+
/** The edge elements at `edge` within `scroller` (shown). */
|
|
112
|
+
export const edgeElementsIn = (scroller, edge) => [...edgeElements]
|
|
113
|
+
.filter(([element, elementEdge]) => elementEdge === edge && scroller.contains(element) && isShown(element))
|
|
114
|
+
.map(([element]) => element);
|
|
115
|
+
/**
|
|
116
|
+
* Tells `listener` of edge elements registered, or resized, until the
|
|
117
|
+
* returned function.
|
|
118
|
+
*/
|
|
119
|
+
export const subscribeEdgeElements = (listener) => {
|
|
120
|
+
edgeElementListeners.add(listener);
|
|
121
|
+
return () => {
|
|
122
|
+
edgeElementListeners.delete(listener);
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
const edgeElementsChanged = () => {
|
|
126
|
+
for (const listener of edgeElementListeners)
|
|
127
|
+
listener();
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Something sticking to an edge's bar (e.g. a header's accessory, stuck
|
|
131
|
+
* below it): while it's stuck, the edge's effect reaches beyond the bar to
|
|
132
|
+
* cover it too (see `EdgeEffects`). Registered while mounted; at the block
|
|
133
|
+
* start or end.
|
|
134
|
+
*/
|
|
135
|
+
export const useViewportEdgeElement = (ref, edge) => {
|
|
136
|
+
useLayoutEffect(() => {
|
|
137
|
+
const { current: element } = ref;
|
|
138
|
+
if (!element)
|
|
139
|
+
return undefined;
|
|
140
|
+
edgeElements.set(element, edge);
|
|
141
|
+
const observer = new ResizeObserver(edgeElementsChanged);
|
|
142
|
+
observer.observe(element);
|
|
143
|
+
edgeElementsChanged();
|
|
144
|
+
return () => {
|
|
145
|
+
observer.disconnect();
|
|
146
|
+
edgeElements.delete(element);
|
|
147
|
+
edgeElementsChanged();
|
|
148
|
+
};
|
|
149
|
+
}, [edge, ref]);
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=edge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.js","sourceRoot":"","sources":["../../../src/components/viewport/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,OAAO,CAAC;AAYnD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAW,CAAC;AACrC,oEAAoE;AACpE,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAc,CAAC;AAEhD,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;AACvD,0DAA0D;AAC1D,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAc,CAAC;AAEnD,IAAI,KAAK,GAAG,CAAC,CAAC;AACd,IAAI,cAA0C,CAAC;AAC/C,IAAI,oBAAsD,CAAC;AAE3D,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAE,EAAE,CACnC,OAAO,CAAC,eAAe,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;AAExD,MAAM,MAAM,GAAG,CAAC,OAAgB,EAAE,EAAE,CAClC,OAAO,KAAK,QAAQ,CAAC,gBAAgB;IACnC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,WAAW,CAAC;IAC5C,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;AAEtC,MAAM,OAAO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CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* iOS: no zoom as a text field is focused (the viewport's `maximum-scale`
|
|
4
|
+
* 1; iOS still lets the page be pinch-zoomed). Held until the returned
|
|
5
|
+
* function lets go of it (the viewport's content restored with the last).
|
|
6
|
+
*/
|
|
7
|
+
export declare const preventInputZoom: () => (() => void);
|
|
8
|
+
/** `preventInputZoom`, while the component is mounted (and `enabled`). */
|
|
9
|
+
export declare const useInputZoomPrevention: (isEnabled?: boolean) => void;
|
|
10
|
+
/**
|
|
11
|
+
* iOS: a text field touched in `target` focused without scrolling (its
|
|
12
|
+
* touch's end: the field focused, `preventScroll`, instead of the
|
|
13
|
+
* browser's focusing, which scrolls the layout viewport); also touched
|
|
14
|
+
* just beside it (see `touchedField`). The touch's click doesn't follow,
|
|
15
|
+
* and the caret goes where the field puts it, not where it was touched.
|
|
16
|
+
* The page hidden with one focused and shown again (e.g. a Home Screen app
|
|
17
|
+
* left and reopened), it's focused again without scrolling, the layout
|
|
18
|
+
* viewport's scroll as it was. Until the returned function removes it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const preventFocusShift: (target?: Document | HTMLElement) => (() => void);
|
|
21
|
+
/**
|
|
22
|
+
* `preventFocusShift`, in `target` (or the document), while the component
|
|
23
|
+
* is mounted (and `enabled`).
|
|
24
|
+
*/
|
|
25
|
+
export declare const useFocusShiftPrevention: (target?: RefObject<HTMLElement | null>, isEnabled?: boolean) => void;
|
|
26
|
+
/**
|
|
27
|
+
* A held press in `target` (e.g. a menu's trigger opened by it, its
|
|
28
|
+
* `openOn="secondaryClick"`) selects no text in it and shows no callout
|
|
29
|
+
* nor the browser's own text menu (iOS: its `user-select` and
|
|
30
|
+
* `-webkit-touch-callout`, `none`). Until the returned function restores
|
|
31
|
+
* them. (An app's choice: the text may well stay selectable.)
|
|
32
|
+
*/
|
|
33
|
+
export declare const preventTextActions: (target: HTMLElement) => (() => void);
|
|
34
|
+
/**
|
|
35
|
+
* `preventTextActions` on `target`, while the component is mounted (and
|
|
36
|
+
* `enabled`).
|
|
37
|
+
*/
|
|
38
|
+
export declare const useTextActionsPrevention: (target: RefObject<HTMLElement | null>, isEnabled?: boolean) => void;
|
|
39
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/components/viewport/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AA+B7C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAO,CAAC,MAAM,IAAI,CAqB9C,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,GAAI,mBAAgB,KAAG,IAEzD,CAAC;AAiFF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAC5B,SAAQ,QAAQ,GAAG,WAAsB,KACxC,CAAC,MAAM,IAAI,CA6Gb,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACtC,mBAAgB,KACf,IAMF,CAAC;AASF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,WAAW,KAAG,CAAC,MAAM,IAAI,CAuBnE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACrC,mBAAgB,KACf,IAKF,CAAC"}
|