@vuu-ui/vuu-utils 2.0.0 → 2.1.0-alpha.10
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/cjs/node_modules/@dnd-kit/react/hooks.js +3 -3
- package/cjs/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +492 -0
- package/cjs/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +1 -0
- package/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.js +987 -0
- package/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.js.map +1 -0
- package/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +130 -0
- package/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js.map +1 -0
- package/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +183 -0
- package/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +1 -0
- package/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +39 -0
- package/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/aria-announcer/AriaAnnouncerContext.js +10 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/aria-announcer/AriaAnnouncerContext.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/aria-announcer/AriaAnnouncerProvider.js +76 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/aria-announcer/AriaAnnouncerProvider.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/aria-announcer/useAriaAnnouncer.js +52 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/aria-announcer/useAriaAnnouncer.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/breakpoints/BreakpointProvider.js +59 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/breakpoints/BreakpointProvider.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/breakpoints/Breakpoints.js +12 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/breakpoints/Breakpoints.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/button/Button.css.js +6 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/button/Button.css.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/button/Button.js +96 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/button/Button.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/button/useButton.js +65 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/button/useButton.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/salt-provider/ProviderContext.js +11 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/salt-provider/ProviderContext.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/salt-provider/SaltProvider.css.js +6 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/salt-provider/SaltProvider.css.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/salt-provider/SaltProvider.js +160 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/salt-provider/SaltProvider.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/salt-provider/ThemeApplicator.js +115 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/salt-provider/ThemeApplicator.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/spinner/Spinner.css.js +6 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/spinner/Spinner.css.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/spinner/Spinner.js +86 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/spinner/Spinner.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/spinner/svgSpinners/SpinnerSVG.js +93 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/spinner/svgSpinners/SpinnerSVG.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/createChainedFunction.js +20 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/createChainedFunction.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/createContext.js +14 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/createContext.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/debounce.js +22 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/debounce.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/makePrefixer.js +6 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/makePrefixer.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/useFloatingUI/useFloatingUI.js +52 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/useFloatingUI/useFloatingUI.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/useId.js +45 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/useId.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/useIsomorphicLayoutEffect.js +8 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/useIsomorphicLayoutEffect.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/usePreventScroll.js +233 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/utils/usePreventScroll.js.map +1 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/viewport/ViewportProvider.js +35 -0
- package/cjs/node_modules/@salt-ds/core/dist-es/viewport/ViewportProvider.js.map +1 -0
- package/cjs/node_modules/@salt-ds/styles/dist-es/style-injection-provider/index.js +22 -0
- package/cjs/node_modules/@salt-ds/styles/dist-es/style-injection-provider/index.js.map +1 -0
- package/cjs/node_modules/@salt-ds/styles/dist-es/use-style-injection/InsertionPointProvider.js +16 -0
- package/cjs/node_modules/@salt-ds/styles/dist-es/use-style-injection/InsertionPointProvider.js.map +1 -0
- package/cjs/node_modules/@salt-ds/styles/dist-es/use-style-injection/useStyleInjection.js +75 -0
- package/cjs/node_modules/@salt-ds/styles/dist-es/use-style-injection/useStyleInjection.js.map +1 -0
- package/cjs/node_modules/@salt-ds/window/dist-es/WindowProvider.js +17 -0
- package/cjs/node_modules/@salt-ds/window/dist-es/WindowProvider.js.map +1 -0
- package/cjs/node_modules/tabbable/dist/index.esm.js +550 -0
- package/cjs/node_modules/tabbable/dist/index.esm.js.map +1 -0
- package/cjs/packages/vuu-utils/src/ThemeProvider.js +2 -2
- package/cjs/packages/vuu-utils/src/ThemeProvider.js.map +1 -1
- package/cjs/packages/vuu-utils/src/data-editing/DataEditingProvider.js +25 -0
- package/cjs/packages/vuu-utils/src/data-editing/DataEditingProvider.js.map +1 -0
- package/cjs/packages/vuu-utils/src/data-editing/EditButtons.js +31 -0
- package/cjs/packages/vuu-utils/src/data-editing/EditButtons.js.map +1 -0
- package/cjs/packages/vuu-utils/src/data-editing/EditTracker.js +157 -0
- package/cjs/packages/vuu-utils/src/data-editing/EditTracker.js.map +1 -0
- package/cjs/packages/vuu-utils/src/data-editing/useEditableTable.js +65 -0
- package/cjs/packages/vuu-utils/src/data-editing/useEditableTable.js.map +1 -0
- package/cjs/packages/vuu-utils/src/index.js +11 -0
- package/cjs/packages/vuu-utils/src/index.js.map +1 -1
- package/cjs/packages/vuu-utils/src/theme-utils.js +36 -0
- package/cjs/packages/vuu-utils/src/theme-utils.js.map +1 -0
- package/cjs/packages/vuu-utils/src/url-utils.js +2 -2
- package/cjs/packages/vuu-utils/src/url-utils.js.map +1 -1
- package/esm/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +489 -0
- package/esm/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +1 -0
- package/esm/node_modules/@floating-ui/react/dist/floating-ui.react.js +962 -0
- package/esm/node_modules/@floating-ui/react/dist/floating-ui.react.js.map +1 -0
- package/esm/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +114 -0
- package/esm/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js.map +1 -0
- package/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +162 -0
- package/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +1 -0
- package/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +33 -0
- package/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/aria-announcer/AriaAnnouncerContext.js +8 -0
- package/esm/node_modules/@salt-ds/core/dist-es/aria-announcer/AriaAnnouncerContext.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/aria-announcer/AriaAnnouncerProvider.js +73 -0
- package/esm/node_modules/@salt-ds/core/dist-es/aria-announcer/AriaAnnouncerProvider.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/aria-announcer/useAriaAnnouncer.js +50 -0
- package/esm/node_modules/@salt-ds/core/dist-es/aria-announcer/useAriaAnnouncer.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/breakpoints/BreakpointProvider.js +56 -0
- package/esm/node_modules/@salt-ds/core/dist-es/breakpoints/BreakpointProvider.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/breakpoints/Breakpoints.js +10 -0
- package/esm/node_modules/@salt-ds/core/dist-es/breakpoints/Breakpoints.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/button/Button.css.js +4 -0
- package/esm/node_modules/@salt-ds/core/dist-es/button/Button.css.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/button/Button.js +94 -0
- package/esm/node_modules/@salt-ds/core/dist-es/button/Button.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/button/useButton.js +63 -0
- package/esm/node_modules/@salt-ds/core/dist-es/button/useButton.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/salt-provider/ProviderContext.js +9 -0
- package/esm/node_modules/@salt-ds/core/dist-es/salt-provider/ProviderContext.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/salt-provider/SaltProvider.css.js +4 -0
- package/esm/node_modules/@salt-ds/core/dist-es/salt-provider/SaltProvider.css.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/salt-provider/SaltProvider.js +151 -0
- package/esm/node_modules/@salt-ds/core/dist-es/salt-provider/SaltProvider.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/salt-provider/ThemeApplicator.js +113 -0
- package/esm/node_modules/@salt-ds/core/dist-es/salt-provider/ThemeApplicator.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/spinner/Spinner.css.js +4 -0
- package/esm/node_modules/@salt-ds/core/dist-es/spinner/Spinner.css.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/spinner/Spinner.js +84 -0
- package/esm/node_modules/@salt-ds/core/dist-es/spinner/Spinner.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/spinner/svgSpinners/SpinnerSVG.js +91 -0
- package/esm/node_modules/@salt-ds/core/dist-es/spinner/svgSpinners/SpinnerSVG.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/createChainedFunction.js +18 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/createChainedFunction.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/createContext.js +12 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/createContext.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/debounce.js +20 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/debounce.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/makePrefixer.js +4 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/makePrefixer.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/useFloatingUI/useFloatingUI.js +50 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/useFloatingUI/useFloatingUI.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/useId.js +24 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/useId.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/useIsomorphicLayoutEffect.js +6 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/useIsomorphicLayoutEffect.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/usePreventScroll.js +231 -0
- package/esm/node_modules/@salt-ds/core/dist-es/utils/usePreventScroll.js.map +1 -0
- package/esm/node_modules/@salt-ds/core/dist-es/viewport/ViewportProvider.js +32 -0
- package/esm/node_modules/@salt-ds/core/dist-es/viewport/ViewportProvider.js.map +1 -0
- package/esm/node_modules/@salt-ds/styles/dist-es/style-injection-provider/index.js +19 -0
- package/esm/node_modules/@salt-ds/styles/dist-es/style-injection-provider/index.js.map +1 -0
- package/esm/node_modules/@salt-ds/styles/dist-es/use-style-injection/InsertionPointProvider.js +14 -0
- package/esm/node_modules/@salt-ds/styles/dist-es/use-style-injection/InsertionPointProvider.js.map +1 -0
- package/esm/node_modules/@salt-ds/styles/dist-es/use-style-injection/useStyleInjection.js +54 -0
- package/esm/node_modules/@salt-ds/styles/dist-es/use-style-injection/useStyleInjection.js.map +1 -0
- package/esm/node_modules/@salt-ds/window/dist-es/WindowProvider.js +15 -0
- package/esm/node_modules/@salt-ds/window/dist-es/WindowProvider.js.map +1 -0
- package/esm/node_modules/tabbable/dist/index.esm.js +546 -0
- package/esm/node_modules/tabbable/dist/index.esm.js.map +1 -0
- package/esm/packages/vuu-utils/src/ThemeProvider.js +2 -2
- package/esm/packages/vuu-utils/src/ThemeProvider.js.map +1 -1
- package/esm/packages/vuu-utils/src/context-definitions/WorkspaceContext.js +2 -2
- package/esm/packages/vuu-utils/src/context-definitions/WorkspaceContext.js.map +1 -1
- package/esm/packages/vuu-utils/src/data-editing/DataEditingProvider.js +22 -0
- package/esm/packages/vuu-utils/src/data-editing/DataEditingProvider.js.map +1 -0
- package/esm/packages/vuu-utils/src/data-editing/EditButtons.js +29 -0
- package/esm/packages/vuu-utils/src/data-editing/EditButtons.js.map +1 -0
- package/esm/packages/vuu-utils/src/data-editing/EditTracker.js +155 -0
- package/esm/packages/vuu-utils/src/data-editing/EditTracker.js.map +1 -0
- package/esm/packages/vuu-utils/src/data-editing/useEditableTable.js +63 -0
- package/esm/packages/vuu-utils/src/data-editing/useEditableTable.js.map +1 -0
- package/esm/packages/vuu-utils/src/feature-utils.js +2 -2
- package/esm/packages/vuu-utils/src/feature-utils.js.map +1 -1
- package/esm/packages/vuu-utils/src/index.js +5 -0
- package/esm/packages/vuu-utils/src/index.js.map +1 -1
- package/esm/packages/vuu-utils/src/theme-utils.js +34 -0
- package/esm/packages/vuu-utils/src/theme-utils.js.map +1 -0
- package/esm/packages/vuu-utils/src/url-utils.js +2 -2
- package/esm/packages/vuu-utils/src/url-utils.js.map +1 -1
- package/package.json +6 -6
- package/types/data-editing/DataEditingProvider.d.ts +7 -0
- package/types/data-editing/EditButtons.d.ts +7 -0
- package/types/data-editing/EditModeProvider.d.ts +13 -0
- package/types/data-editing/EditTracker.d.ts +24 -0
- package/types/data-editing/useEditableTable.d.ts +26 -0
- package/types/index.d.ts +6 -1
- package/types/theme-utils.d.ts +14 -0
- package/types/url-utils.d.ts +2 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var createChainedFunction = require('./createChainedFunction.js');
|
|
4
|
+
var useIsomorphicLayoutEffect = require('./useIsomorphicLayoutEffect.js');
|
|
5
|
+
|
|
6
|
+
const visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
7
|
+
const nonTextInputTypes = /* @__PURE__ */ new Set([
|
|
8
|
+
"checkbox",
|
|
9
|
+
"radio",
|
|
10
|
+
"range",
|
|
11
|
+
"color",
|
|
12
|
+
"file",
|
|
13
|
+
"image",
|
|
14
|
+
"button",
|
|
15
|
+
"submit",
|
|
16
|
+
"reset"
|
|
17
|
+
]);
|
|
18
|
+
let preventScrollCount = 0;
|
|
19
|
+
let restore;
|
|
20
|
+
function usePreventScroll(options = {}) {
|
|
21
|
+
const { isDisabled } = options;
|
|
22
|
+
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
|
|
23
|
+
if (isDisabled) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
preventScrollCount++;
|
|
27
|
+
if (preventScrollCount === 1) {
|
|
28
|
+
if (isIOS()) {
|
|
29
|
+
restore = preventScrollMobileSafari();
|
|
30
|
+
} else {
|
|
31
|
+
restore = preventScrollStandard();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return () => {
|
|
35
|
+
preventScrollCount--;
|
|
36
|
+
if (preventScrollCount === 0) {
|
|
37
|
+
restore();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, [isDisabled]);
|
|
41
|
+
}
|
|
42
|
+
function preventScrollStandard() {
|
|
43
|
+
return createChainedFunction.createChainedFunction(
|
|
44
|
+
setStyle(
|
|
45
|
+
document.documentElement,
|
|
46
|
+
"paddingRight",
|
|
47
|
+
`${window.innerWidth - document.documentElement.clientWidth}px`
|
|
48
|
+
),
|
|
49
|
+
setStyle(document.documentElement, "overflow", "hidden")
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function preventScrollMobileSafari() {
|
|
53
|
+
let scrollable;
|
|
54
|
+
let restoreScrollableStyles;
|
|
55
|
+
const onTouchStart = (e) => {
|
|
56
|
+
scrollable = getScrollParent(e.target, true);
|
|
57
|
+
if (scrollable === document.documentElement && scrollable === document.body) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === "auto") {
|
|
61
|
+
restoreScrollableStyles = setStyle(
|
|
62
|
+
scrollable,
|
|
63
|
+
"overscrollBehavior",
|
|
64
|
+
"contain"
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const onTouchMove = (e) => {
|
|
69
|
+
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const onTouchEnd = () => {
|
|
78
|
+
if (restoreScrollableStyles) {
|
|
79
|
+
restoreScrollableStyles();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const onFocus = (e) => {
|
|
83
|
+
const target = e.target;
|
|
84
|
+
if (willOpenKeyboard(target)) {
|
|
85
|
+
setupStyles();
|
|
86
|
+
target.style.transform = "translateY(-2000px)";
|
|
87
|
+
requestAnimationFrame(() => {
|
|
88
|
+
target.style.transform = "";
|
|
89
|
+
if (visualViewport) {
|
|
90
|
+
if (visualViewport.height < window.innerHeight) {
|
|
91
|
+
requestAnimationFrame(() => {
|
|
92
|
+
scrollIntoView(target);
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
visualViewport.addEventListener(
|
|
96
|
+
"resize",
|
|
97
|
+
() => scrollIntoView(target),
|
|
98
|
+
{ once: true }
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
let restoreStyles = null;
|
|
106
|
+
const setupStyles = () => {
|
|
107
|
+
if (restoreStyles) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const onWindowScroll = () => {
|
|
111
|
+
window.scrollTo(0, 0);
|
|
112
|
+
};
|
|
113
|
+
const scrollX = window.pageXOffset;
|
|
114
|
+
const scrollY = window.pageYOffset;
|
|
115
|
+
restoreStyles = createChainedFunction.createChainedFunction(
|
|
116
|
+
addEvent(window, "scroll", onWindowScroll),
|
|
117
|
+
setStyle(
|
|
118
|
+
document.documentElement,
|
|
119
|
+
"paddingRight",
|
|
120
|
+
`${window.innerWidth - document.documentElement.clientWidth}px`
|
|
121
|
+
),
|
|
122
|
+
setStyle(document.documentElement, "overflow", "hidden"),
|
|
123
|
+
setStyle(document.body, "marginTop", `-${scrollY}px`),
|
|
124
|
+
() => {
|
|
125
|
+
window.scrollTo(scrollX, scrollY);
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
window.scrollTo(0, 0);
|
|
129
|
+
};
|
|
130
|
+
const removeEvents = createChainedFunction.createChainedFunction(
|
|
131
|
+
addEvent(document, "touchstart", onTouchStart, {
|
|
132
|
+
passive: false,
|
|
133
|
+
capture: true
|
|
134
|
+
}),
|
|
135
|
+
addEvent(document, "touchmove", onTouchMove, {
|
|
136
|
+
passive: false,
|
|
137
|
+
capture: true
|
|
138
|
+
}),
|
|
139
|
+
addEvent(document, "touchend", onTouchEnd, {
|
|
140
|
+
passive: false,
|
|
141
|
+
capture: true
|
|
142
|
+
}),
|
|
143
|
+
addEvent(document, "focus", onFocus, true)
|
|
144
|
+
);
|
|
145
|
+
return () => {
|
|
146
|
+
restoreScrollableStyles == null ? void 0 : restoreScrollableStyles();
|
|
147
|
+
restoreStyles == null ? void 0 : restoreStyles();
|
|
148
|
+
removeEvents();
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function setStyle(element, style, value) {
|
|
152
|
+
const cur = element.style[style];
|
|
153
|
+
element.style[style] = value;
|
|
154
|
+
return () => {
|
|
155
|
+
element.style[style] = cur;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function addEvent(target, event, handler, options) {
|
|
159
|
+
target.addEventListener(event, handler, options);
|
|
160
|
+
return () => {
|
|
161
|
+
target.removeEventListener(event, handler, options);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function scrollIntoView(target) {
|
|
165
|
+
const root = document.scrollingElement || document.documentElement;
|
|
166
|
+
let nextTarget = target;
|
|
167
|
+
while (nextTarget && nextTarget !== root) {
|
|
168
|
+
const scrollable = getScrollParent(nextTarget);
|
|
169
|
+
if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {
|
|
170
|
+
const scrollableTop = scrollable.getBoundingClientRect().top;
|
|
171
|
+
const targetTop = nextTarget.getBoundingClientRect().top;
|
|
172
|
+
if (targetTop > scrollableTop + nextTarget.clientHeight) {
|
|
173
|
+
scrollable.scrollTop += targetTop - scrollableTop;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
nextTarget = scrollable.parentElement;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function willOpenKeyboard(target) {
|
|
180
|
+
return target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
|
|
181
|
+
}
|
|
182
|
+
function isScrollable(node, checkForOverflow) {
|
|
183
|
+
if (!node) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
const style = window.getComputedStyle(node);
|
|
187
|
+
let isScrollable2 = /(auto|scroll)/.test(
|
|
188
|
+
style.overflow + style.overflowX + style.overflowY
|
|
189
|
+
);
|
|
190
|
+
if (isScrollable2 && checkForOverflow) {
|
|
191
|
+
isScrollable2 = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
|
|
192
|
+
}
|
|
193
|
+
return isScrollable2;
|
|
194
|
+
}
|
|
195
|
+
function getScrollParent(node, checkForOverflow) {
|
|
196
|
+
let scrollableNode = node;
|
|
197
|
+
if (isScrollable(scrollableNode, checkForOverflow)) {
|
|
198
|
+
scrollableNode = scrollableNode.parentElement;
|
|
199
|
+
}
|
|
200
|
+
while (scrollableNode && !isScrollable(scrollableNode, checkForOverflow)) {
|
|
201
|
+
scrollableNode = scrollableNode.parentElement;
|
|
202
|
+
}
|
|
203
|
+
return scrollableNode || document.scrollingElement || document.documentElement;
|
|
204
|
+
}
|
|
205
|
+
function testPlatform(re) {
|
|
206
|
+
var _a;
|
|
207
|
+
return typeof window !== "undefined" && window.navigator != null ? re.test(
|
|
208
|
+
// @ts-expect-error userAgentData is only supported in Chrome 90+
|
|
209
|
+
((_a = window.navigator.userAgentData) == null ? void 0 : _a.platform) || window.navigator.platform
|
|
210
|
+
) : false;
|
|
211
|
+
}
|
|
212
|
+
function cached(fn) {
|
|
213
|
+
if (process.env.NODE_ENV === "test") {
|
|
214
|
+
return fn;
|
|
215
|
+
}
|
|
216
|
+
let res = null;
|
|
217
|
+
return () => {
|
|
218
|
+
if (res == null) {
|
|
219
|
+
res = fn();
|
|
220
|
+
}
|
|
221
|
+
return res;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
const isMac = cached(() => testPlatform(/^Mac/i));
|
|
225
|
+
const isIPhone = cached(() => testPlatform(/^iPhone/i));
|
|
226
|
+
const isIPad = cached(
|
|
227
|
+
() => testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
228
|
+
isMac() && navigator.maxTouchPoints > 1
|
|
229
|
+
);
|
|
230
|
+
const isIOS = cached(() => isIPhone() || isIPad());
|
|
231
|
+
|
|
232
|
+
exports.usePreventScroll = usePreventScroll;
|
|
233
|
+
//# sourceMappingURL=usePreventScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreventScroll.js","sources":["../../../../../../../../node_modules/@salt-ds/core/dist-es/utils/usePreventScroll.js"],"sourcesContent":["import { createChainedFunction } from './createChainedFunction.js';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';\n\nconst visualViewport = typeof document !== \"undefined\" && window.visualViewport;\nconst nonTextInputTypes = /* @__PURE__ */ new Set([\n \"checkbox\",\n \"radio\",\n \"range\",\n \"color\",\n \"file\",\n \"image\",\n \"button\",\n \"submit\",\n \"reset\"\n]);\nlet preventScrollCount = 0;\nlet restore;\nfunction usePreventScroll(options = {}) {\n const { isDisabled } = options;\n useIsomorphicLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore();\n }\n };\n }, [isDisabled]);\n}\nfunction preventScrollStandard() {\n return createChainedFunction(\n setStyle(\n document.documentElement,\n \"paddingRight\",\n `${window.innerWidth - document.documentElement.clientWidth}px`\n ),\n setStyle(document.documentElement, \"overflow\", \"hidden\")\n );\n}\nfunction preventScrollMobileSafari() {\n let scrollable;\n let restoreScrollableStyles;\n const onTouchStart = (e) => {\n scrollable = getScrollParent(e.target, true);\n if (scrollable === document.documentElement && scrollable === document.body) {\n return;\n }\n if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === \"auto\") {\n restoreScrollableStyles = setStyle(\n scrollable,\n \"overscrollBehavior\",\n \"contain\"\n );\n }\n };\n const onTouchMove = (e) => {\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) {\n e.preventDefault();\n }\n };\n const onTouchEnd = () => {\n if (restoreScrollableStyles) {\n restoreScrollableStyles();\n }\n };\n const onFocus = (e) => {\n const target = e.target;\n if (willOpenKeyboard(target)) {\n setupStyles();\n target.style.transform = \"translateY(-2000px)\";\n requestAnimationFrame(() => {\n target.style.transform = \"\";\n if (visualViewport) {\n if (visualViewport.height < window.innerHeight) {\n requestAnimationFrame(() => {\n scrollIntoView(target);\n });\n } else {\n visualViewport.addEventListener(\n \"resize\",\n () => scrollIntoView(target),\n { once: true }\n );\n }\n }\n });\n }\n };\n let restoreStyles = null;\n const setupStyles = () => {\n if (restoreStyles) {\n return;\n }\n const onWindowScroll = () => {\n window.scrollTo(0, 0);\n };\n const scrollX = window.pageXOffset;\n const scrollY = window.pageYOffset;\n restoreStyles = createChainedFunction(\n addEvent(window, \"scroll\", onWindowScroll),\n setStyle(\n document.documentElement,\n \"paddingRight\",\n `${window.innerWidth - document.documentElement.clientWidth}px`\n ),\n setStyle(document.documentElement, \"overflow\", \"hidden\"),\n setStyle(document.body, \"marginTop\", `-${scrollY}px`),\n () => {\n window.scrollTo(scrollX, scrollY);\n }\n );\n window.scrollTo(0, 0);\n };\n const removeEvents = createChainedFunction(\n addEvent(document, \"touchstart\", onTouchStart, {\n passive: false,\n capture: true\n }),\n addEvent(document, \"touchmove\", onTouchMove, {\n passive: false,\n capture: true\n }),\n addEvent(document, \"touchend\", onTouchEnd, {\n passive: false,\n capture: true\n }),\n addEvent(document, \"focus\", onFocus, true)\n );\n return () => {\n restoreScrollableStyles == null ? void 0 : restoreScrollableStyles();\n restoreStyles == null ? void 0 : restoreStyles();\n removeEvents();\n };\n}\nfunction setStyle(element, style, value) {\n const cur = element.style[style];\n element.style[style] = value;\n return () => {\n element.style[style] = cur;\n };\n}\nfunction addEvent(target, event, handler, options) {\n target.addEventListener(event, handler, options);\n return () => {\n target.removeEventListener(event, handler, options);\n };\n}\nfunction scrollIntoView(target) {\n const root = document.scrollingElement || document.documentElement;\n let nextTarget = target;\n while (nextTarget && nextTarget !== root) {\n const scrollable = getScrollParent(nextTarget);\n if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {\n const scrollableTop = scrollable.getBoundingClientRect().top;\n const targetTop = nextTarget.getBoundingClientRect().top;\n if (targetTop > scrollableTop + nextTarget.clientHeight) {\n scrollable.scrollTop += targetTop - scrollableTop;\n }\n }\n nextTarget = scrollable.parentElement;\n }\n}\nfunction willOpenKeyboard(target) {\n return target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;\n}\nfunction isScrollable(node, checkForOverflow) {\n if (!node) {\n return false;\n }\n const style = window.getComputedStyle(node);\n let isScrollable2 = /(auto|scroll)/.test(\n style.overflow + style.overflowX + style.overflowY\n );\n if (isScrollable2 && checkForOverflow) {\n isScrollable2 = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;\n }\n return isScrollable2;\n}\nfunction getScrollParent(node, checkForOverflow) {\n let scrollableNode = node;\n if (isScrollable(scrollableNode, checkForOverflow)) {\n scrollableNode = scrollableNode.parentElement;\n }\n while (scrollableNode && !isScrollable(scrollableNode, checkForOverflow)) {\n scrollableNode = scrollableNode.parentElement;\n }\n return scrollableNode || document.scrollingElement || document.documentElement;\n}\nfunction testPlatform(re) {\n var _a;\n return typeof window !== \"undefined\" && window.navigator != null ? re.test(\n // @ts-expect-error userAgentData is only supported in Chrome 90+\n ((_a = window.navigator.userAgentData) == null ? void 0 : _a.platform) || window.navigator.platform\n ) : false;\n}\nfunction cached(fn) {\n if (process.env.NODE_ENV === \"test\") {\n return fn;\n }\n let res = null;\n return () => {\n if (res == null) {\n res = fn();\n }\n return res;\n };\n}\nconst isMac = cached(() => testPlatform(/^Mac/i));\nconst isIPhone = cached(() => testPlatform(/^iPhone/i));\nconst isIPad = cached(\n () => testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n isMac() && navigator.maxTouchPoints > 1\n);\nconst isIOS = cached(() => isIPhone() || isIPad());\n\nexport { usePreventScroll };\n//# sourceMappingURL=usePreventScroll.js.map\n"],"names":["useIsomorphicLayoutEffect","createChainedFunction"],"mappings":";;;;;AAGA,MAAM,cAAc,GAAG,OAAO,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC,cAAc;AAC/E,MAAM,iBAAiB,mBAAmB,IAAI,GAAG,CAAC;AAClD,EAAE,UAAU;AACZ,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,MAAM;AACR,EAAE,OAAO;AACT,EAAE,QAAQ;AACV,EAAE,QAAQ;AACV,EAAE;AACF,CAAC,CAAC;AACF,IAAI,kBAAkB,GAAG,CAAC;AAC1B,IAAI,OAAO;AACX,SAAS,gBAAgB,CAAC,OAAO,GAAG,EAAE,EAAE;AACxC,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO;AAChC,EAAEA,mDAAyB,CAAC,MAAM;AAClC,IAAI,IAAI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AAY,CAAC,QAAQ,CAAC;AAC9B,EAAE,KAAK,EAAE,IAAI,SAAS,CAAC,cAAc,GAAG;AACxC,CAAC;AACD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,QAAQ,EAAE,IAAI,MAAM,EAAE,CAAC;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var useIsomorphicLayoutEffect = require('../utils/useIsomorphicLayoutEffect.js');
|
|
6
|
+
|
|
7
|
+
const ViewportContext = React.createContext(null);
|
|
8
|
+
const ViewportProvider = ({ children }) => {
|
|
9
|
+
const existingViewport = React.useContext(ViewportContext);
|
|
10
|
+
const [viewport, setViewport] = React.useState(existingViewport);
|
|
11
|
+
const noExistingViewport = existingViewport === null;
|
|
12
|
+
const viewportValue = existingViewport || viewport || 0;
|
|
13
|
+
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
|
|
14
|
+
let observer = null;
|
|
15
|
+
if (noExistingViewport) {
|
|
16
|
+
observer = new ResizeObserver(
|
|
17
|
+
(observerEntries) => {
|
|
18
|
+
setViewport(observerEntries[0].contentRect.width);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
observer.observe(document.body);
|
|
22
|
+
setViewport(document.body.getBoundingClientRect().width);
|
|
23
|
+
}
|
|
24
|
+
return () => {
|
|
25
|
+
if (observer) {
|
|
26
|
+
observer.disconnect();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}, [noExistingViewport]);
|
|
30
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ViewportContext.Provider, { value: viewportValue, children });
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.ViewportContext = ViewportContext;
|
|
34
|
+
exports.ViewportProvider = ViewportProvider;
|
|
35
|
+
//# sourceMappingURL=ViewportProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewportProvider.js","sources":["../../../../../../../../node_modules/@salt-ds/core/dist-es/viewport/ViewportProvider.js"],"sourcesContent":["import { jsx } from 'react/jsx-runtime';\nimport { createContext, useContext, useState } from 'react';\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect.js';\n\nconst ViewportContext = createContext(null);\nconst ViewportProvider = ({ children }) => {\n const existingViewport = useContext(ViewportContext);\n const [viewport, setViewport] = useState(existingViewport);\n const noExistingViewport = existingViewport === null;\n const viewportValue = existingViewport || viewport || 0;\n useIsomorphicLayoutEffect(() => {\n let observer = null;\n if (noExistingViewport) {\n observer = new ResizeObserver(\n (observerEntries) => {\n setViewport(observerEntries[0].contentRect.width);\n }\n );\n observer.observe(document.body);\n setViewport(document.body.getBoundingClientRect().width);\n }\n return () => {\n if (observer) {\n observer.disconnect();\n }\n };\n }, [noExistingViewport]);\n return /* @__PURE__ */ jsx(ViewportContext.Provider, { value: viewportValue, children });\n};\nconst useViewport = () => {\n const value = useContext(ViewportContext);\n return value === null ? 0 : value;\n};\n\nexport { ViewportContext, ViewportProvider, useViewport };\n//# sourceMappingURL=ViewportProvider.js.map\n"],"names":["createContext","useContext","useState","useIsomorphicLayoutEffect","jsx"],"mappings":";;;;;;AAIK,MAAC,eAAe,GAAGA,mBAAa,CAAC,IAAI;AACrC,MAAC,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK;AAC3C,EAAE,MAAM,gBAAgB,GAAGC,gBAAU,CAAC,eAAe,CAAC;AACtD,EAAE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAGC,cAAQ,CAAC,gBAAgB,CAAC;AAC5D,EAAE,MAAM,kBAAkB,GAAG,gBAAgB,KAAK,IAAI;AACtD,EAAE,MAAM,aAAa,GAAG,gBAAgB,IAAI,QAAQ,IAAI,CAAC;AACzD,EAAEC,mDAAyB,CAAC,MAAM;AAClC,IAAI,IAAI,QAAQ,GAAG,IAAI;AACvB,IAAI,IAAI,kBAAkB,EAAE;AAC5B,MAAM,QAAQ,GAAG,IAAI,cAAc;AACnC,QAAQ,CAAC,eAAe,KAAK;AAC7B,UAAU,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3D;AACA,OAAO;AACP,MAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;AACrC,MAAM,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC;AAC9D;AACA,IAAI,OAAO,MAAM;AACjB,MAAM,IAAI,QAAQ,EAAE;AACpB,QAAQ,QAAQ,CAAC,UAAU,EAAE;AAC7B;AACA,KAAK;AACL,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC;AAC1B,EAAE,uBAAuBC,cAAG,CAAC,eAAe,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;AAC1F;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const StyleInjectionContext = React.createContext(true);
|
|
7
|
+
function useStyleInjection(enableStyleInjection) {
|
|
8
|
+
const enableStyleInjectionFromContext = React.useContext(StyleInjectionContext);
|
|
9
|
+
return enableStyleInjection != null ? enableStyleInjection : enableStyleInjectionFromContext;
|
|
10
|
+
}
|
|
11
|
+
function StyleInjectionProvider(props) {
|
|
12
|
+
const { value: enableStyleInjectionProp, children } = props;
|
|
13
|
+
const value = useStyleInjection(enableStyleInjectionProp);
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyleInjectionContext.Provider, {
|
|
15
|
+
value,
|
|
16
|
+
children
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.StyleInjectionProvider = StyleInjectionProvider;
|
|
21
|
+
exports.useStyleInjection = useStyleInjection;
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@salt-ds/styles/dist-es/style-injection-provider/index.js"],"sourcesContent":["import { jsx } from 'react/jsx-runtime';\nimport { createContext, useContext } from 'react';\n\nconst StyleInjectionContext = createContext(true);\nfunction useStyleInjection(enableStyleInjection) {\n const enableStyleInjectionFromContext = useContext(StyleInjectionContext);\n return enableStyleInjection != null ? enableStyleInjection : enableStyleInjectionFromContext;\n}\nfunction StyleInjectionProvider(props) {\n const { value: enableStyleInjectionProp, children } = props;\n const value = useStyleInjection(enableStyleInjectionProp);\n return /* @__PURE__ */ jsx(StyleInjectionContext.Provider, {\n value,\n children\n });\n}\n\nexport { StyleInjectionProvider, useStyleInjection };\n//# sourceMappingURL=index.js.map\n"],"names":["createContext","useContext","jsx"],"mappings":";;;;;AAGA,MAAM,qBAAqB,GAAGA,mBAAa,CAAC,IAAI,CAAC;AACjD,SAAS,iBAAiB,CAAC,oBAAoB,EAAE;AACjD,EAAE,MAAM,+BAA+B,GAAGC,gBAAU,CAAC,qBAAqB,CAAC;AAC3E,EAAE,OAAO,oBAAoB,IAAI,IAAI,GAAG,oBAAoB,GAAG,+BAA+B;AAC9F;AACA,SAAS,sBAAsB,CAAC,KAAK,EAAE;AACvC,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,EAAE,QAAQ,EAAE,GAAG,KAAK;AAC7D,EAAE,MAAM,KAAK,GAAG,iBAAiB,CAAC,wBAAwB,CAAC;AAC3D,EAAE,uBAAuBC,cAAG,CAAC,qBAAqB,CAAC,QAAQ,EAAE;AAC7D,IAAI,KAAK;AACT,IAAI;AACJ,GAAG,CAAC;AACJ;;;;;","x_google_ignoreList":[0]}
|
package/cjs/node_modules/@salt-ds/styles/dist-es/use-style-injection/InsertionPointProvider.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const InsertionPointContext = React.createContext(null);
|
|
7
|
+
if (process.env.NODE_ENV !== "production") {
|
|
8
|
+
InsertionPointContext.displayName = "InsertionPointContext";
|
|
9
|
+
}
|
|
10
|
+
function useInsertionPoint() {
|
|
11
|
+
const value = React.useContext(InsertionPointContext);
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.useInsertionPoint = useInsertionPoint;
|
|
16
|
+
//# sourceMappingURL=InsertionPointProvider.js.map
|
package/cjs/node_modules/@salt-ds/styles/dist-es/use-style-injection/InsertionPointProvider.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsertionPointProvider.js","sources":["../../../../../../../../node_modules/@salt-ds/styles/dist-es/use-style-injection/InsertionPointProvider.js"],"sourcesContent":["import { jsx } from 'react/jsx-runtime';\nimport { createContext, useMemo, useContext } from 'react';\n\nconst InsertionPointContext = createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n InsertionPointContext.displayName = \"InsertionPointContext\";\n}\nfunction InsertionPointProvider(props) {\n const { insertionPoint: insertionPointProp, children } = props;\n const value = useMemo(() => insertionPointProp, [insertionPointProp]);\n return /* @__PURE__ */ jsx(InsertionPointContext.Provider, {\n value,\n children\n });\n}\nfunction useInsertionPoint() {\n const value = useContext(InsertionPointContext);\n return value;\n}\n\nexport { InsertionPointProvider, useInsertionPoint };\n//# sourceMappingURL=InsertionPointProvider.js.map\n"],"names":["createContext","useContext"],"mappings":";;;;;AAGA,MAAM,qBAAqB,GAAGA,mBAAa,CAAC,IAAI,CAAC;AACjD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AAC3C,EAAE,qBAAqB,CAAC,WAAW,GAAG,uBAAuB;AAC7D;AASA,SAAS,iBAAiB,GAAG;AAC7B,EAAE,MAAM,KAAK,GAAGC,gBAAU,CAAC,qBAAqB,CAAC;AACjD,EAAE,OAAO,KAAK;AACd;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var InsertionPointProvider = require('./InsertionPointProvider.js');
|
|
5
|
+
var index = require('../style-injection-provider/index.js');
|
|
6
|
+
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
25
|
+
|
|
26
|
+
var _a;
|
|
27
|
+
const maybeUseInsertionEffect = (_a = React__namespace["useInsertionEffect".toString()]) != null ? _a : React__namespace.useLayoutEffect;
|
|
28
|
+
const windowSheetsMap = /* @__PURE__ */ new WeakMap();
|
|
29
|
+
function useComponentCssInjection({
|
|
30
|
+
testId,
|
|
31
|
+
css,
|
|
32
|
+
window: targetWindow
|
|
33
|
+
}) {
|
|
34
|
+
const styleInjectionEnabled = index.useStyleInjection();
|
|
35
|
+
const insertionPoint = InsertionPointProvider.useInsertionPoint();
|
|
36
|
+
maybeUseInsertionEffect(() => {
|
|
37
|
+
var _a2, _b;
|
|
38
|
+
if (!targetWindow || !styleInjectionEnabled) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const sheetsMap = (_a2 = windowSheetsMap.get(targetWindow)) != null ? _a2 : /* @__PURE__ */ new Map();
|
|
42
|
+
const styleMap = (_b = sheetsMap.get(css)) != null ? _b : { styleElement: null, count: 0 };
|
|
43
|
+
if (styleMap.styleElement == null) {
|
|
44
|
+
styleMap.styleElement = targetWindow.document.createElement("style");
|
|
45
|
+
styleMap.styleElement.setAttribute("type", "text/css");
|
|
46
|
+
styleMap.styleElement.setAttribute("data-salt-style", testId || "");
|
|
47
|
+
styleMap.styleElement.textContent = css;
|
|
48
|
+
styleMap.count = 1;
|
|
49
|
+
targetWindow.document.head.insertBefore(
|
|
50
|
+
styleMap.styleElement,
|
|
51
|
+
insertionPoint || targetWindow.document.head.firstChild
|
|
52
|
+
);
|
|
53
|
+
} else {
|
|
54
|
+
styleMap.styleElement.textContent = css;
|
|
55
|
+
styleMap.count++;
|
|
56
|
+
}
|
|
57
|
+
sheetsMap.set(css, styleMap);
|
|
58
|
+
windowSheetsMap.set(targetWindow, sheetsMap);
|
|
59
|
+
return () => {
|
|
60
|
+
const sheetsMap2 = windowSheetsMap.get(targetWindow);
|
|
61
|
+
const styleMap2 = sheetsMap2 == null ? void 0 : sheetsMap2.get(css);
|
|
62
|
+
if (styleMap2 == null ? void 0 : styleMap2.styleElement) {
|
|
63
|
+
styleMap2.count--;
|
|
64
|
+
if (styleMap2.count < 1) {
|
|
65
|
+
targetWindow.document.head.removeChild(styleMap2.styleElement);
|
|
66
|
+
styleMap2.styleElement = null;
|
|
67
|
+
sheetsMap2 == null ? void 0 : sheetsMap2.delete(css);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}, [testId, css, targetWindow]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.useComponentCssInjection = useComponentCssInjection;
|
|
75
|
+
//# sourceMappingURL=useStyleInjection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStyleInjection.js","sources":["../../../../../../../../node_modules/@salt-ds/styles/dist-es/use-style-injection/useStyleInjection.js"],"sourcesContent":["import * as React from 'react';\nimport { useInsertionPoint } from './InsertionPointProvider.js';\nimport { useStyleInjection } from '../style-injection-provider/index.js';\n\nvar _a;\nconst maybeUseInsertionEffect = (_a = React[\"useInsertionEffect\".toString()]) != null ? _a : React.useLayoutEffect;\nconst windowSheetsMap = /* @__PURE__ */ new WeakMap();\nfunction useComponentCssInjection({\n testId,\n css,\n window: targetWindow\n}) {\n const styleInjectionEnabled = useStyleInjection();\n const insertionPoint = useInsertionPoint();\n maybeUseInsertionEffect(() => {\n var _a2, _b;\n if (!targetWindow || !styleInjectionEnabled) {\n return;\n }\n const sheetsMap = (_a2 = windowSheetsMap.get(targetWindow)) != null ? _a2 : /* @__PURE__ */ new Map();\n const styleMap = (_b = sheetsMap.get(css)) != null ? _b : { styleElement: null, count: 0 };\n if (styleMap.styleElement == null) {\n styleMap.styleElement = targetWindow.document.createElement(\"style\");\n styleMap.styleElement.setAttribute(\"type\", \"text/css\");\n styleMap.styleElement.setAttribute(\"data-salt-style\", testId || \"\");\n styleMap.styleElement.textContent = css;\n styleMap.count = 1;\n targetWindow.document.head.insertBefore(\n styleMap.styleElement,\n insertionPoint || targetWindow.document.head.firstChild\n );\n } else {\n styleMap.styleElement.textContent = css;\n styleMap.count++;\n }\n sheetsMap.set(css, styleMap);\n windowSheetsMap.set(targetWindow, sheetsMap);\n return () => {\n const sheetsMap2 = windowSheetsMap.get(targetWindow);\n const styleMap2 = sheetsMap2 == null ? void 0 : sheetsMap2.get(css);\n if (styleMap2 == null ? void 0 : styleMap2.styleElement) {\n styleMap2.count--;\n if (styleMap2.count < 1) {\n targetWindow.document.head.removeChild(styleMap2.styleElement);\n styleMap2.styleElement = null;\n sheetsMap2 == null ? void 0 : sheetsMap2.delete(css);\n }\n }\n };\n }, [testId, css, targetWindow]);\n}\n\nexport { useComponentCssInjection };\n//# sourceMappingURL=useStyleInjection.js.map\n"],"names":["React","useStyleInjection","useInsertionPoint"],"mapp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
require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const WindowContext = React.createContext(
|
|
7
|
+
typeof window !== "undefined" ? window : null
|
|
8
|
+
);
|
|
9
|
+
if (process.env.NODE_ENV !== "production") {
|
|
10
|
+
WindowContext.displayName = "WindowContext";
|
|
11
|
+
}
|
|
12
|
+
function useWindow() {
|
|
13
|
+
return React.useContext(WindowContext);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.useWindow = useWindow;
|
|
17
|
+
//# sourceMappingURL=WindowProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowProvider.js","sources":["../../../../../../../node_modules/@salt-ds/window/dist-es/WindowProvider.js"],"sourcesContent":["import { jsx } from 'react/jsx-runtime';\nimport { createContext, useContext } from 'react';\n\nconst WindowContext = createContext(\n typeof window !== \"undefined\" ? window : null\n);\nif (process.env.NODE_ENV !== \"production\") {\n WindowContext.displayName = \"WindowContext\";\n}\nfunction WindowProvider(props) {\n const { window: targetWindow, children } = props;\n return /* @__PURE__ */ jsx(WindowContext.Provider, {\n value: targetWindow,\n children\n });\n}\nfunction useWindow() {\n return useContext(WindowContext);\n}\n\nexport { WindowProvider, useWindow };\n//# sourceMappingURL=WindowProvider.js.map\n"],"names":["createContext","useContext"],"mappings":";;;;;AAGA,MAAM,aAAa,GAAGA,mBAAa;AACnC,EAAE,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG;AAC3C,CAAC;AACD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AAC3C,EAAE,aAAa,CAAC,WAAW,GAAG,eAAe;AAC7C;AAQA,SAAS,SAAS,GAAG;AACrB,EAAE,OAAOC,gBAAU,CAAC,aAAa,CAAC;AAClC;;;;","x_google_ignoreList":[0]}
|