@brillout/docpress 0.7.9-commit-ec0a3b5 → 0.7.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/package.json
CHANGED
|
@@ -12,28 +12,27 @@ export { getCSSForResponsiveFullcreenNavItems }
|
|
|
12
12
|
import assert from 'assert'
|
|
13
13
|
import { type NavItemGrouped } from '../navigation/Navigation'
|
|
14
14
|
|
|
15
|
+
const columnWidthMin = 300
|
|
16
|
+
const columnWidthMax = 350
|
|
17
|
+
|
|
15
18
|
function getCSSForResponsiveFullcreenNavItems(navItemsGrouped: NavItemGrouped[]) {
|
|
16
|
-
const columnWidthMin = 300
|
|
17
|
-
const columnWidthMax = 350
|
|
18
|
-
const columnsUnmerged = navItemsGrouped.map((navItem) => navItem.navItemChilds.length)
|
|
19
19
|
let CSS = '\n'
|
|
20
20
|
for (let numberOfColumns = navItemsGrouped.length; numberOfColumns >= 1; numberOfColumns--) {
|
|
21
21
|
let CSS_block: string[] = []
|
|
22
22
|
CSS_block.push(
|
|
23
23
|
...[
|
|
24
|
-
//
|
|
25
24
|
` html.navigation-fullscreen #navigation-content-main {`,
|
|
26
25
|
` column-count: ${numberOfColumns};`,
|
|
27
26
|
` max-width: min(100%, ${columnWidthMax * numberOfColumns}px);`,
|
|
28
27
|
` }`,
|
|
29
28
|
],
|
|
30
29
|
)
|
|
30
|
+
const columnsUnmerged = navItemsGrouped.map((navItem) => navItem.navItemChilds.length)
|
|
31
31
|
const columnsIdMap = determineColumns(columnsUnmerged, numberOfColumns)
|
|
32
32
|
const columnBreakPoints = determineColumnBreakPoints(columnsIdMap)
|
|
33
33
|
columnBreakPoints.forEach((columnBreakPoint, columnUngroupedId) => {
|
|
34
34
|
CSS_block.push(
|
|
35
35
|
...[
|
|
36
|
-
//
|
|
37
36
|
` .nav-items-group:nth-child(${columnUngroupedId + 1}) {`,
|
|
38
37
|
` break-before: ${columnBreakPoint ? 'column' : 'avoid'};`,
|
|
39
38
|
` }`,
|
|
@@ -57,8 +56,8 @@ function getCSSForResponsiveFullcreenNavItems(navItemsGrouped: NavItemGrouped[])
|
|
|
57
56
|
|
|
58
57
|
function determineColumnBreakPoints(columnsIdMap: number[]): boolean[] {
|
|
59
58
|
assert(columnsIdMap[0] === 0)
|
|
60
|
-
let columnGroupedIdBefore =
|
|
61
|
-
const columnBreakPoints = columnsIdMap.map((columnGroupedId
|
|
59
|
+
let columnGroupedIdBefore = -1
|
|
60
|
+
const columnBreakPoints = columnsIdMap.map((columnGroupedId) => {
|
|
62
61
|
assert(
|
|
63
62
|
[
|
|
64
63
|
//
|
|
@@ -92,8 +91,8 @@ function determineColumns(columnsUnmerged: number[], numberOfColumns: number): n
|
|
|
92
91
|
return columnsIdMap
|
|
93
92
|
}
|
|
94
93
|
type ColumnMerging = { columnIdsMerged: number[]; heightTotal: number }
|
|
95
|
-
function mergeColumns(columnsMerging: ColumnMerging[],
|
|
96
|
-
if (columnsMerging.length <=
|
|
94
|
+
function mergeColumns(columnsMerging: ColumnMerging[], numberOfColumns: number): ColumnMerging[] {
|
|
95
|
+
if (columnsMerging.length <= numberOfColumns) return columnsMerging
|
|
97
96
|
|
|
98
97
|
let mergeCandidate: null | (ColumnMerging & { i: number }) = null
|
|
99
98
|
for (let i = 0; i <= columnsMerging.length - 2; i++) {
|
|
@@ -124,5 +123,5 @@ function mergeColumns(columnsMerging: ColumnMerging[], maxNumberOfColumns: numbe
|
|
|
124
123
|
]
|
|
125
124
|
|
|
126
125
|
assert(columnsMergingMod.length === columnsMerging.length - 1)
|
|
127
|
-
return mergeColumns(columnsMergingMod,
|
|
126
|
+
return mergeColumns(columnsMergingMod, numberOfColumns)
|
|
128
127
|
}
|
|
@@ -21,8 +21,6 @@ Promise<Awaited<ReturnType<OnRenderHtmlAsync>>> => {
|
|
|
21
21
|
const navItemsGrouped = groupByLevelMin(navItemsAll)
|
|
22
22
|
const CSSResponsiveNavItems = getCSSForResponsiveFullcreenNavItems(navItemsGrouped)
|
|
23
23
|
|
|
24
|
-
pageContextResolved.navigationData.navItems
|
|
25
|
-
|
|
26
24
|
const descriptionTag = pageContextResolved.isLandingPage
|
|
27
25
|
? dangerouslySkipEscape(`<meta name="description" content="${pageContextResolved.meta.tagline}" />`)
|
|
28
26
|
: ''
|