@skaldapp/shared 1.2.39 → 1.2.41

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 CHANGED
@@ -7,6 +7,7 @@ export type TPage = FromSchema<typeof Page> & {
7
7
  $children: TPage[];
8
8
  $index: number;
9
9
  $next?: TPage;
10
+ $parent?: TPage;
10
11
  $prev?: TPage;
11
12
  $siblings: TPage[];
12
13
  branch: TPage[];
@@ -21,6 +22,7 @@ export type TPage = FromSchema<typeof Page> & {
21
22
  to?: string;
22
23
  };
23
24
  export declare const sharedStore: {
25
+ $nodes: TPage[];
24
26
  kvNodes: Record<string, TPage>;
25
27
  nodes: TPage[];
26
28
  add: (pId: string) => string | undefined;
@@ -43,6 +45,7 @@ export declare const sharedStore: {
43
45
  $children: any[];
44
46
  $index: number;
45
47
  $next?: any;
48
+ $parent?: any;
46
49
  $prev?: any;
47
50
  $siblings: any[];
48
51
  branch: any[];
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import useFlatJsonTree from "@skaldapp/flat-json-tree";
2
2
  import AJV from "ajv";
3
3
  import dynamicDefaults from "ajv-keywords/dist/definitions/dynamicDefaults.js";
4
4
  import { generateSlug } from "random-word-slugs";
5
- import { reactive, ref, toRef, watch } from "vue";
5
+ import { computed, reactive, ref, toRef, watch } from "vue";
6
6
  import Credential from "./schemas/credential.js";
7
7
  import Nodes from "./schemas/nodes.js";
8
8
  import Page from "./schemas/page.js";
@@ -14,7 +14,8 @@ const esm = true, code = { esm }, coerceTypes = true, keywords = [dynamicDefault
14
14
  removeAdditional,
15
15
  schemas,
16
16
  useDefaults,
17
- }), immediate = true, properties = {
17
+ }), immediate = true, isRedirect = ({ id, parent, siblings }) => parent?.frontmatter["template"] &&
18
+ siblings.find(({ frontmatter: { hidden } }) => !hidden)?.id === id, properties = {
18
19
  $branch: {
19
20
  get() {
20
21
  return this.branch.filter(({ frontmatter: { hidden } }) => !hidden);
@@ -35,6 +36,11 @@ const esm = true, code = { esm }, coerceTypes = true, keywords = [dynamicDefault
35
36
  return this.$siblings[this.$index + 1];
36
37
  },
37
38
  },
39
+ $parent: {
40
+ get() {
41
+ return this.$branch[this.$branch.length - 2];
42
+ },
43
+ },
38
44
  $prev: {
39
45
  get() {
40
46
  return this.$siblings[this.$index - 1];
@@ -62,9 +68,11 @@ const esm = true, code = { esm }, coerceTypes = true, keywords = [dynamicDefault
62
68
  },
63
69
  },
64
70
  }, tree = ref([]), validate = Object.fromEntries(schemas.map(({ $id }) => [$id, ajv.getSchema($id)])), { kvNodes, nodes, ...flatJsonTree } = useFlatJsonTree(tree);
71
+ const $nodes = computed(() => nodes.value.filter((node) => !node.frontmatter["hidden"] && !isRedirect(node)));
65
72
  export const sharedStore = reactive({
66
73
  tree,
67
74
  ...flatJsonTree,
75
+ $nodes,
68
76
  kvNodes: kvNodes,
69
77
  nodes: nodes,
70
78
  });
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.39",
4
+ "version": "1.2.41",
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",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@skaldapp/configs": "^1.2.58",
45
- "@types/node": "^25.2.2",
45
+ "@types/node": "^25.2.3",
46
46
  "eslint": "^9.39.2"
47
47
  }
48
48
  }