xmlui 0.9.82 → 0.9.83
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/lib/{index-z40PVcrw.mjs → index-aMRikNoc.mjs} +34 -16
- package/dist/lib/{initMock-BPsXM5rg.mjs → initMock-CYGUM37_.mjs} +1 -1
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/{collectedComponentMetadata-DMqRnWLT.mjs → collectedComponentMetadata-BD1Fa8Cz.mjs} +34 -16
- package/dist/metadata/{initMock-qDOHn1cO.mjs → initMock-CzVkUblk.mjs} +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/Bookmark/Bookmark.js +5 -0
- package/dist/scripts/src/components/Bookmark/BookmarkNative.js +11 -1
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +3 -1
- package/dist/scripts/src/components-core/rendering/AppContent.js +8 -3
- package/dist/standalone/xmlui-standalone.umd.js +8 -8
- package/package.json +1 -1
|
@@ -35,6 +35,11 @@ exports.BookmarkMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
35
35
|
defaultValue: BookmarkNative_1.defaultProps.omitFromToc,
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
|
+
apis: {
|
|
39
|
+
scrollIntoView: {
|
|
40
|
+
description: "Scrolls the bookmark into view.",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
38
43
|
});
|
|
39
44
|
exports.bookmarkComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.BookmarkMd, (rendererContext) => {
|
|
40
45
|
const { node, renderChild, extractValue, layoutContext } = rendererContext;
|
|
@@ -12,11 +12,21 @@ exports.defaultProps = {
|
|
|
12
12
|
level: 1,
|
|
13
13
|
omitFromToc: false,
|
|
14
14
|
};
|
|
15
|
-
const Bookmark = ({ uid, level = exports.defaultProps.level, children, title, omitFromToc = exports.defaultProps.omitFromToc, }) => {
|
|
15
|
+
const Bookmark = ({ uid, level = exports.defaultProps.level, children, title, omitFromToc = exports.defaultProps.omitFromToc, registerComponentApi, }) => {
|
|
16
16
|
const elementRef = (0, react_1.useRef)(null);
|
|
17
17
|
const tableOfContentsContext = (0, react_1.useContext)(TableOfContentsContext_1.TableOfContentsContext);
|
|
18
18
|
const registerHeading = tableOfContentsContext === null || tableOfContentsContext === void 0 ? void 0 : tableOfContentsContext.registerHeading;
|
|
19
19
|
const observeIntersection = tableOfContentsContext === null || tableOfContentsContext === void 0 ? void 0 : tableOfContentsContext.hasTableOfContents;
|
|
20
|
+
const scrollIntoView = (0, react_1.useCallback)((options) => {
|
|
21
|
+
if (elementRef.current) {
|
|
22
|
+
elementRef.current.scrollIntoView(Object.assign({ behavior: 'smooth', block: 'start' }, options));
|
|
23
|
+
}
|
|
24
|
+
}, []);
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
27
|
+
scrollIntoView,
|
|
28
|
+
});
|
|
29
|
+
}, [registerComponentApi, scrollIntoView]);
|
|
20
30
|
(0, react_1.useLayoutEffect)(() => {
|
|
21
31
|
var _a, _b, _c;
|
|
22
32
|
if (observeIntersection && elementRef.current && uid && !omitFromToc) {
|
|
@@ -121,7 +121,9 @@ exports.ModalDialog = react_1.default.forwardRef(({ children, style, isInitially
|
|
|
121
121
|
// NOTE: at this point, we can't use useAppContext here,
|
|
122
122
|
// since the ModalDialog context provider (via ConfirmationModalContextProvider) is mounted outside of the AppContext,
|
|
123
123
|
// and ModalDialogs can also be called using the imperative API (see functions like "confirm")
|
|
124
|
-
|
|
124
|
+
// String-based type checking: Use constructor.name to identify ShadowRoot
|
|
125
|
+
// This avoids direct ShadowRoot type dependency while being more explicit than duck typing
|
|
126
|
+
const isDialogRootInShadowDom = typeof ShadowRoot !== 'undefined' && (root === null || root === void 0 ? void 0 : root.getRootNode()) instanceof ShadowRoot;
|
|
125
127
|
const modalRef = (0, react_1.useRef)(null);
|
|
126
128
|
const composedRef = ref ? (0, react_compose_refs_1.composeRefs)(ref, modalRef) : modalRef;
|
|
127
129
|
const { isOpen, doClose, doOpen } = useModalOpenState(isInitiallyOpen, onOpen, onClose);
|
|
@@ -197,8 +197,10 @@ function AppContent({ rootContainer, routerBaseName, globalProps, standalone, tr
|
|
|
197
197
|
var _a;
|
|
198
198
|
if (!rootNode)
|
|
199
199
|
return;
|
|
200
|
-
// --- If element is in shadow DOM
|
|
201
|
-
|
|
200
|
+
// --- If element is in shadow DOM (string-based type checking)
|
|
201
|
+
// --- Check constructor.name to avoid direct ShadowRoot type dependency
|
|
202
|
+
// --- More precise than duck typing, works reliably across different environments
|
|
203
|
+
if (typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot) {
|
|
202
204
|
const el = rootNode.getElementById(lastHash.current);
|
|
203
205
|
if (!el)
|
|
204
206
|
return;
|
|
@@ -281,7 +283,10 @@ function AppContent({ rootContainer, routerBaseName, globalProps, standalone, tr
|
|
|
281
283
|
environment,
|
|
282
284
|
mediaSize,
|
|
283
285
|
queryClient: AppRoot_1.queryClient,
|
|
284
|
-
standalone,
|
|
286
|
+
standalone,
|
|
287
|
+
// String-based type checking: Use constructor.name to identify ShadowRoot
|
|
288
|
+
// This avoids direct ShadowRoot type dependency while being more explicit than duck typing
|
|
289
|
+
appIsInShadowDom: typeof ShadowRoot !== 'undefined' && (root === null || root === void 0 ? void 0 : root.getRootNode()) instanceof ShadowRoot }, date_functions_1.dateFunctions), math_function_1.mathFunctions), {
|
|
285
290
|
// --- File Utilities
|
|
286
291
|
formatFileSizeInBytes: misc_1.formatFileSizeInBytes,
|
|
287
292
|
getFileExtension: misc_1.getFileExtension,
|