@skaldapp/shared 1.2.46 → 1.2.47
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/index.d.ts +1 -2
- package/dist/index.js +11 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -24,8 +24,7 @@ export type TPage = FromSchema<typeof Page> & {
|
|
|
24
24
|
export declare const sharedStore: {
|
|
25
25
|
kvNodes: Record<string, TPage>;
|
|
26
26
|
nodes: TPage[];
|
|
27
|
-
removeHiddens: (pages: TPage[]) => TPage[];
|
|
28
|
-
removeRedirects: (pages: TPage[]) => TPage[];
|
|
27
|
+
removeHiddens: (pages: TPage[], redirects?: boolean) => TPage[];
|
|
29
28
|
add: (pId: string) => string | undefined;
|
|
30
29
|
addChild: (pId: string) => string | undefined;
|
|
31
30
|
down: (pId: string) => string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -7,10 +7,14 @@ import Credential from "./schemas/credential.js";
|
|
|
7
7
|
import Nodes from "./schemas/nodes.js";
|
|
8
8
|
import Page from "./schemas/page.js";
|
|
9
9
|
dynamicDefaults.DEFAULTS["uuid"] = () => generateSlug;
|
|
10
|
-
const removeHiddens = (pages) => pages.filter(({ frontmatter: { hidden }, path }) => path !== undefined &&
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const removeHiddens = (pages, redirects) => pages.filter(({ branch, frontmatter: { hidden }, id, path, siblings }) => path !== undefined &&
|
|
11
|
+
!hidden &&
|
|
12
|
+
(!redirects ||
|
|
13
|
+
!branch
|
|
14
|
+
.slice(0, -1)
|
|
15
|
+
.reverse()
|
|
16
|
+
.find(({ frontmatter: { hidden } }) => !hidden)?.frontmatter["template"] ||
|
|
17
|
+
siblings.find(({ frontmatter: { hidden } }) => !hidden)?.id !== id));
|
|
14
18
|
const esm = true, code = { esm }, coerceTypes = true, keywords = [dynamicDefaults()], removeAdditional = true, schemas = [Nodes, Page], useDefaults = true, ajv = new AJV({
|
|
15
19
|
code,
|
|
16
20
|
coerceTypes,
|
|
@@ -21,12 +25,12 @@ const esm = true, code = { esm }, coerceTypes = true, keywords = [dynamicDefault
|
|
|
21
25
|
}), immediate = true, properties = {
|
|
22
26
|
$branch: {
|
|
23
27
|
get() {
|
|
24
|
-
return
|
|
28
|
+
return removeHiddens(this.branch, true);
|
|
25
29
|
},
|
|
26
30
|
},
|
|
27
31
|
$children: {
|
|
28
32
|
get() {
|
|
29
|
-
return
|
|
33
|
+
return removeHiddens(this.children, true);
|
|
30
34
|
},
|
|
31
35
|
},
|
|
32
36
|
$index: {
|
|
@@ -51,7 +55,7 @@ const esm = true, code = { esm }, coerceTypes = true, keywords = [dynamicDefault
|
|
|
51
55
|
},
|
|
52
56
|
$siblings: {
|
|
53
57
|
get() {
|
|
54
|
-
return
|
|
58
|
+
return removeHiddens(this.siblings, true);
|
|
55
59
|
},
|
|
56
60
|
},
|
|
57
61
|
path: {
|
|
@@ -77,7 +81,6 @@ export const sharedStore = reactive({
|
|
|
77
81
|
kvNodes: kvNodes,
|
|
78
82
|
nodes: nodes,
|
|
79
83
|
removeHiddens,
|
|
80
|
-
removeRedirects,
|
|
81
84
|
});
|
|
82
85
|
watch(toRef(sharedStore, "nodes"), async (value) => {
|
|
83
86
|
if (!(await validate["nodes"]?.(value)))
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package",
|
|
3
3
|
"name": "@skaldapp/shared",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.47",
|
|
5
5
|
"description": "A TypeScript library providing reactive data structures, JSON schema validation, and tree utilities for Vue-based applications in the skald ecosystem.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vue",
|