element-book 20.0.9 → 22.0.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/LICENSE-MIT
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isJsonEqual } from 'run-time-assertions';
|
|
2
2
|
import { BookEntryTypeEnum } from '../../../data/book-entry/book-entry-type';
|
|
3
3
|
export function shouldShowTreeNodeInNav(currentNode, selectedPath) {
|
|
4
4
|
if (currentNode.entry.entryType === BookEntryTypeEnum.Root) {
|
|
@@ -7,11 +7,11 @@ export function shouldShowTreeNodeInNav(currentNode, selectedPath) {
|
|
|
7
7
|
if (currentNode.entry.entryType === BookEntryTypeEnum.Page) {
|
|
8
8
|
return true;
|
|
9
9
|
}
|
|
10
|
-
const isParentSelected =
|
|
10
|
+
const isParentSelected = isJsonEqual(selectedPath, currentNode.fullUrlBreadcrumbs.slice(0, -1));
|
|
11
11
|
if (isParentSelected) {
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
|
-
const isSiblingSelected =
|
|
14
|
+
const isSiblingSelected = isJsonEqual(selectedPath?.slice(0, -1), currentNode.fullUrlBreadcrumbs.slice(0, -1));
|
|
15
15
|
if (isSiblingSelected) {
|
|
16
16
|
return true;
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { checkIfEntirelyInScrollView, waitForAnimationFrame } from '@augment-vir/browser';
|
|
2
|
-
import { areJsonEqual } from '@augment-vir/common';
|
|
3
2
|
import { classMap, css, html, renderIf } from 'element-vir';
|
|
3
|
+
import { isJsonEqual } from 'run-time-assertions';
|
|
4
4
|
import { Element16Icon, ViraIcon } from 'vira';
|
|
5
5
|
import { BookEntryTypeEnum } from '../../../data/book-entry/book-entry-type';
|
|
6
6
|
import { isBookTreeNode } from '../../../data/book-tree/book-tree';
|
|
@@ -92,7 +92,7 @@ export const BookNav = defineBookElement()({
|
|
|
92
92
|
class=${classMap({
|
|
93
93
|
'title-row': true,
|
|
94
94
|
selected: inputs.selectedPath
|
|
95
|
-
?
|
|
95
|
+
? isJsonEqual(inputs.selectedPath, treeNode.fullUrlBreadcrumbs)
|
|
96
96
|
: false,
|
|
97
97
|
})}
|
|
98
98
|
>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { waitForAnimationFrame } from '@augment-vir/browser';
|
|
2
|
-
import {
|
|
2
|
+
import { extractErrorMessage, isTruthy } from '@augment-vir/common';
|
|
3
3
|
import { css, defineElement, defineElementEvent, html, listen } from 'element-vir';
|
|
4
|
+
import { isJsonEqual } from 'run-time-assertions';
|
|
4
5
|
import { createNewControls, updateTreeControls, } from '../../../data/book-entry/book-page/controls-wrapper';
|
|
5
6
|
import { createBookTreeFromEntries } from '../../../data/book-tree/book-tree';
|
|
6
7
|
import { searchFlattenedNodes } from '../../../data/book-tree/search-nodes';
|
|
@@ -33,7 +34,8 @@ export const ElementBookApp = defineElement()({
|
|
|
33
34
|
},
|
|
34
35
|
styles: css `
|
|
35
36
|
:host {
|
|
36
|
-
display:
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
37
39
|
height: 100%;
|
|
38
40
|
width: 100%;
|
|
39
41
|
font-family: sans-serif;
|
|
@@ -46,7 +48,7 @@ export const ElementBookApp = defineElement()({
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
.root {
|
|
49
|
-
|
|
51
|
+
flex-grow: 1;
|
|
50
52
|
width: 100%;
|
|
51
53
|
display: flex;
|
|
52
54
|
position: relative;
|
|
@@ -92,7 +94,7 @@ export const ElementBookApp = defineElement()({
|
|
|
92
94
|
}
|
|
93
95
|
function areRoutesNew(newRouteInput) {
|
|
94
96
|
const newRoute = mergeRoutes(newRouteInput);
|
|
95
|
-
return !
|
|
97
|
+
return !isJsonEqual(state.currentRoute, newRoute);
|
|
96
98
|
}
|
|
97
99
|
function updateWindowTitle(topNodeTitle) {
|
|
98
100
|
if (!inputs.preventWindowTitleChange) {
|
|
@@ -124,13 +126,13 @@ export const ElementBookApp = defineElement()({
|
|
|
124
126
|
});
|
|
125
127
|
}
|
|
126
128
|
if (inputs.elementBookRoutePaths &&
|
|
127
|
-
!
|
|
129
|
+
!isJsonEqual(inputs.elementBookRoutePaths, state.currentRoute.paths)) {
|
|
128
130
|
dispatch(new events.pathUpdate(newRoute.paths ?? []));
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
try {
|
|
132
134
|
if (inputs.elementBookRoutePaths &&
|
|
133
|
-
!
|
|
135
|
+
!isJsonEqual(inputs.elementBookRoutePaths, state.currentRoute.paths)) {
|
|
134
136
|
updateRoutes({ paths: inputs.elementBookRoutePaths });
|
|
135
137
|
}
|
|
136
138
|
if (inputs.internalRouterConfig?.useInternalRouter && !state.router) {
|
|
@@ -148,7 +150,7 @@ export const ElementBookApp = defineElement()({
|
|
|
148
150
|
const inputThemeConfig = {
|
|
149
151
|
themeColor: inputs.themeColor,
|
|
150
152
|
};
|
|
151
|
-
if (!
|
|
153
|
+
if (!isJsonEqual(inputThemeConfig, state.colors?.config)) {
|
|
152
154
|
const newTheme = createTheme(inputThemeConfig);
|
|
153
155
|
updateState({
|
|
154
156
|
colors: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "element-book",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"book",
|
|
6
6
|
"design system",
|
|
@@ -42,32 +42,31 @@
|
|
|
42
42
|
"test:watch": "web-test-runner --color --watch --config configs/web-test-runner.config.mjs"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@augment-vir/browser": "^
|
|
46
|
-
"@augment-vir/common": "^
|
|
47
|
-
"colorjs.io": "0.
|
|
48
|
-
"lit-css-vars": "^3.0.
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"vira": "20.0.9"
|
|
45
|
+
"@augment-vir/browser": "^26.2.1",
|
|
46
|
+
"@augment-vir/common": "^26.2.1",
|
|
47
|
+
"colorjs.io": "0.5.0",
|
|
48
|
+
"lit-css-vars": "^3.0.9",
|
|
49
|
+
"spa-router-vir": "^3.0.4",
|
|
50
|
+
"typed-event-target": "^3.2.1",
|
|
51
|
+
"vira": "22.0.0"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
|
-
"@augment-vir/browser-testing": "^
|
|
54
|
+
"@augment-vir/browser-testing": "^26.2.1",
|
|
56
55
|
"@open-wc/testing": "^4.0.0",
|
|
57
|
-
"@types/chai": "^4.3.
|
|
56
|
+
"@types/chai": "^4.3.14",
|
|
58
57
|
"@types/mocha": "^10.0.6",
|
|
59
58
|
"@web/dev-server-esbuild": "^1.0.2",
|
|
60
|
-
"@web/test-runner": "^0.18.
|
|
59
|
+
"@web/test-runner": "^0.18.1",
|
|
61
60
|
"@web/test-runner-commands": "^0.9.0",
|
|
62
61
|
"@web/test-runner-playwright": "^0.11.0",
|
|
63
62
|
"@web/test-runner-visual-regression": "^0.9.0",
|
|
64
63
|
"element-vir": "*",
|
|
65
64
|
"istanbul-smart-text-reporter": "^1.1.4",
|
|
66
65
|
"markdown-code-example-inserter": "^1.0.0",
|
|
67
|
-
"run-time-assertions": "^1.
|
|
68
|
-
"type-fest": "^4.
|
|
69
|
-
"typedoc": "^0.25.
|
|
70
|
-
"typescript": "^5.
|
|
66
|
+
"run-time-assertions": "^1.2.0",
|
|
67
|
+
"type-fest": "^4.14.0",
|
|
68
|
+
"typedoc": "^0.25.12",
|
|
69
|
+
"typescript": "^5.4.3"
|
|
71
70
|
},
|
|
72
71
|
"peerDependencies": {
|
|
73
72
|
"element-vir": ">=17"
|