@brillout/docpress 0.9.3 → 0.9.4
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/Layout.tsx +5 -1
- package/dist/Layout.js +1 -1
- package/dist/renderer/usePageContext.js +6 -1
- package/package.json +1 -1
- package/renderer/usePageContext.tsx +6 -1
package/Layout.tsx
CHANGED
|
@@ -89,7 +89,11 @@ function LayoutDocsPage({ children }: { children: React.ReactNode }) {
|
|
|
89
89
|
<style>{getStyle()}</style>
|
|
90
90
|
<div style={{ display: 'flex', ...whitespaceBuster2 }}>
|
|
91
91
|
<NavLeft />
|
|
92
|
-
<div
|
|
92
|
+
<div
|
|
93
|
+
id="nav-left-margin"
|
|
94
|
+
className="low-prio-grow"
|
|
95
|
+
style={{ width: 0, maxWidth: 50, background: 'var(--bg-color)' }}
|
|
96
|
+
/>
|
|
93
97
|
<PageContent>{children}</PageContent>
|
|
94
98
|
</div>
|
|
95
99
|
</>
|
package/dist/Layout.js
CHANGED
|
@@ -89,7 +89,7 @@ function LayoutDocsPage(_a) {
|
|
|
89
89
|
React.createElement("style", null, getStyle()),
|
|
90
90
|
React.createElement("div", { style: __assign({ display: 'flex' }, whitespaceBuster2) },
|
|
91
91
|
React.createElement(NavLeft, null),
|
|
92
|
-
React.createElement("div", { id:
|
|
92
|
+
React.createElement("div", { id: "nav-left-margin", className: "low-prio-grow", style: { width: 0, maxWidth: 50, background: 'var(--bg-color)' } }),
|
|
93
93
|
React.createElement(PageContent, null, children))));
|
|
94
94
|
function getStyle() {
|
|
95
95
|
var style = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n@container container-viewport (min-width: ", "px) {\n .low-prio-grow {\n flex-grow: 1;\n }\n #navigation-container {\n width: ", "px !important;\n }\n}"], ["\n@container container-viewport (min-width: ", "px) {\n .low-prio-grow {\n flex-grow: 1;\n }\n #navigation-container {\n width: ", "px !important;\n }\n}"])), containerQueryExtraSpace, navLeftWidthMax);
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export { usePageContext };
|
|
2
2
|
export { PageContextProvider };
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
|
-
|
|
4
|
+
import { getGlobalObject } from '../utils/getGlobalObject';
|
|
5
|
+
var globalObject = getGlobalObject('onRenderClient.ts', {
|
|
6
|
+
Context: React.createContext(undefined),
|
|
7
|
+
});
|
|
5
8
|
function PageContextProvider(_a) {
|
|
6
9
|
var pageContext = _a.pageContext, children = _a.children;
|
|
10
|
+
var Context = globalObject.Context;
|
|
7
11
|
return React.createElement(Context.Provider, { value: pageContext }, children);
|
|
8
12
|
}
|
|
9
13
|
function usePageContext() {
|
|
14
|
+
var Context = globalObject.Context;
|
|
10
15
|
var pageContext = useContext(Context);
|
|
11
16
|
return pageContext;
|
|
12
17
|
}
|
package/package.json
CHANGED
|
@@ -4,8 +4,11 @@ export { PageContextProvider }
|
|
|
4
4
|
import React, { useContext } from 'react'
|
|
5
5
|
import type { PageContextResolved } from '../config/resolvePageContext'
|
|
6
6
|
import type { PageContext } from 'vike/types'
|
|
7
|
+
import { getGlobalObject } from '../utils/getGlobalObject'
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
+
const globalObject = getGlobalObject('onRenderClient.ts', {
|
|
10
|
+
Context: React.createContext<PageContextResolved>(undefined as any),
|
|
11
|
+
})
|
|
9
12
|
|
|
10
13
|
function PageContextProvider({
|
|
11
14
|
pageContext,
|
|
@@ -14,10 +17,12 @@ function PageContextProvider({
|
|
|
14
17
|
pageContext: PageContextResolved
|
|
15
18
|
children: React.ReactNode
|
|
16
19
|
}) {
|
|
20
|
+
const { Context } = globalObject
|
|
17
21
|
return <Context.Provider value={pageContext}>{children}</Context.Provider>
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
function usePageContext(): PageContextResolved {
|
|
25
|
+
const { Context } = globalObject
|
|
21
26
|
const pageContext = useContext(Context)
|
|
22
27
|
return pageContext
|
|
23
28
|
}
|