@marianmeres/collection-types 1.19.0 → 1.21.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.
@@ -1,29 +1,35 @@
1
1
  /**
2
- * Custom Pages Configuration Types
2
+ * Custom Pages Configuration Types (v2 - 3-Level Hierarchy)
3
3
  *
4
4
  * These types define the structure of the `__joy_custom_pages__` config record
5
- * stored in the project's config collection. They establish a contract for
6
- * defining project-specific custom UI pages with lazy loading support.
5
+ * stored in the project's config collection.
6
+ *
7
+ * Hierarchy:
8
+ * - Level 1: Group (shown in sidebar with expand/collapse)
9
+ * - Level 2: Page (shown as items within expanded group)
10
+ * - Level 3: Tab (shown as tabs within a page)
11
+ *
12
+ * URL Pattern: #/p/{projectId}/custom/{groupId}/{pageId}?/{tabPath}?
7
13
  *
8
14
  * @module custom-pages/types
9
15
  */
10
16
  import type { MaybeLocalized } from "./utils.js";
11
17
  /**
12
- * Nested route definition within a custom page.
13
- * Supports tabs, wizard steps, or multi-step flows.
18
+ * Tab definition within a page (Level 3).
19
+ * Tabs are rendered as secondary navigation within a page.
14
20
  */
15
- export interface CustomPageNestedRoute {
21
+ export interface CustomPageTab {
16
22
  /**
17
- * Unique path segment (e.g., "overview", "settings", "step-1").
18
- * Used in URL: #/p/{projectId}/custom/{pageId}/{path}
23
+ * Unique path segment for this tab.
24
+ * Used in URL: #/p/{projectId}/custom/{groupId}/{pageId}/{path}
19
25
  */
20
26
  path: string;
21
27
  /**
22
- * Display label for navigation (tabs, breadcrumbs).
28
+ * Display label for the tab.
23
29
  */
24
30
  label: MaybeLocalized<string>;
25
31
  /**
26
- * Icon identifier for the tab/step.
32
+ * Icon identifier for the tab.
27
33
  */
28
34
  icon?: string;
29
35
  /**
@@ -32,85 +38,119 @@ export interface CustomPageNestedRoute {
32
38
  */
33
39
  order?: number;
34
40
  /**
35
- * Whether this is the default route when parent page is accessed.
36
- * If no default is specified, the first route by order is used.
41
+ * Whether this is the default tab when page is accessed without tab path.
42
+ * If no default is specified, the first tab by order is used.
37
43
  */
38
44
  default?: boolean;
39
45
  /**
40
- * Component file name within _routes/ directory.
41
- * Defaults to path if not specified.
42
- * @example "Overview" for "_routes/Overview.svelte"
46
+ * Component file name within _tabs/ directory.
47
+ * Defaults to capitalized path if not specified.
48
+ * @example "Overview" for "_tabs/Overview.svelte"
43
49
  */
44
50
  component?: string;
45
51
  }
46
52
  /**
47
- * Navigation metadata for a custom page.
53
+ * Page definition within a group (Level 2).
54
+ * Pages are shown as items within an expanded group in the sidebar.
48
55
  */
49
- export interface CustomPageNavMeta {
56
+ export interface CustomPageDef {
50
57
  /**
51
- * Display label in navigation.
58
+ * Unique identifier for this page within the group.
59
+ * Used in URL: #/p/{projectId}/custom/{groupId}/{id}
60
+ * Must match directory name: src/custom-pages/pages/{groupId}/{id}/
61
+ */
62
+ id: string;
63
+ /**
64
+ * Display label for the page in navigation.
52
65
  */
53
66
  label: MaybeLocalized<string>;
54
67
  /**
55
- * Icon identifier (matches ICON_MAP in LeftSidebarNav).
68
+ * Human-readable description of what this page does.
69
+ */
70
+ description?: string;
71
+ /**
72
+ * Icon identifier for the page.
56
73
  */
57
74
  icon?: string;
58
75
  /**
59
- * Display order in the custom pages section (lower = first).
76
+ * Display order within the group (lower = first).
60
77
  * @default 0
61
78
  */
62
79
  order?: number;
63
80
  /**
64
- * Optional grouping label for organizing multiple custom pages.
81
+ * Whether this is the default page when group is accessed without page ID.
82
+ * If no default is specified, the first page by order is used.
65
83
  */
66
- group?: MaybeLocalized<string>;
84
+ default?: boolean;
85
+ /**
86
+ * Whether this page is enabled.
87
+ * @default true
88
+ */
89
+ enabled?: boolean;
67
90
  /**
68
- * Icon for the group header.
91
+ * Component file name (defaults to "Page" for Page.svelte).
69
92
  */
70
- groupIcon?: string;
93
+ component?: string;
94
+ /**
95
+ * Tabs within this page (Level 3).
96
+ * If specified and non-empty, the page will show tab navigation.
97
+ * If empty or undefined, page content is rendered directly.
98
+ */
99
+ tabs?: CustomPageTab[];
71
100
  }
72
101
  /**
73
- * A single custom page definition.
102
+ * Navigation metadata for a group.
74
103
  */
75
- export interface CustomPageDef {
104
+ export interface CustomPageNavMeta {
76
105
  /**
77
- * Unique identifier for this page.
78
- * Used in URL: #/p/{projectId}/custom/{id}
79
- * Must match directory name in src/custom-pages/pages/{id}/
106
+ * Display label in navigation.
80
107
  */
81
- id: string;
108
+ label: MaybeLocalized<string>;
82
109
  /**
83
- * Human-readable description of what this page does.
110
+ * Icon identifier (matches ICON_MAP in LeftSidebarNav).
84
111
  */
85
- description?: string;
112
+ icon?: string;
86
113
  /**
87
- * Route pattern for this page.
88
- * Supports parameters: /reports/[reportType]
89
- * Defaults to "/{id}" if not specified.
114
+ * Display order in the custom pages section (lower = first).
115
+ * @default 0
90
116
  */
91
- route?: string;
117
+ order?: number;
118
+ }
119
+ /**
120
+ * Group definition (Level 1).
121
+ * Groups are shown in the sidebar with expand/collapse functionality.
122
+ */
123
+ export interface CustomPageGroupDef {
92
124
  /**
93
- * Navigation metadata.
125
+ * Unique identifier for this group.
126
+ * Used in URL: #/p/{projectId}/custom/{id}
127
+ * Must match directory name: src/custom-pages/pages/{id}/
94
128
  */
95
- nav: CustomPageNavMeta;
129
+ id: string;
96
130
  /**
97
- * Nested routes (tabs, wizard steps, etc.)
98
- * If specified, the page component receives an `activeNestedRoute` prop.
131
+ * Human-readable description of this group.
99
132
  */
100
- nestedRoutes?: CustomPageNestedRoute[];
133
+ description?: string;
101
134
  /**
102
- * Whether this page is enabled.
135
+ * Whether this group is enabled.
103
136
  * @default true
104
137
  */
105
138
  enabled?: boolean;
139
+ /**
140
+ * Navigation metadata for the group.
141
+ */
142
+ nav: CustomPageNavMeta;
143
+ /**
144
+ * Pages within this group (Level 2).
145
+ */
146
+ pages: CustomPageDef[];
106
147
  /**
107
148
  * Priority for route matching (higher = checked first).
108
- * Prevents conflicts with more generic routes.
109
149
  * @default 0
110
150
  */
111
151
  priority?: number;
112
152
  /**
113
- * Required permissions to access this page.
153
+ * Required permissions to access this group.
114
154
  * If specified, user must have at least one of these permissions.
115
155
  */
116
156
  permissions?: string[];
@@ -133,19 +173,18 @@ export interface CustomPagesNavSection {
133
173
  divider?: boolean;
134
174
  }
135
175
  /**
136
- * The complete custom pages configuration structure.
176
+ * The complete custom pages configuration structure (v2).
137
177
  * Stored as the `value` of the `__joy_custom_pages__` config record.
138
178
  */
139
179
  export interface CustomPagesConfig {
140
180
  /**
141
- * Schema version for future migrations.
142
- * @default 1
181
+ * Schema version. Must be 2 for 3-level hierarchy.
143
182
  */
144
183
  version: number;
145
184
  /**
146
- * Array of custom page definitions.
185
+ * Array of group definitions (Level 1).
147
186
  */
148
- pages: CustomPageDef[];
187
+ groups: CustomPageGroupDef[];
149
188
  /**
150
189
  * Section configuration for the navigation.
151
190
  */
@@ -1,9 +1,15 @@
1
1
  /**
2
- * Custom Pages Configuration Types
2
+ * Custom Pages Configuration Types (v2 - 3-Level Hierarchy)
3
3
  *
4
4
  * These types define the structure of the `__joy_custom_pages__` config record
5
- * stored in the project's config collection. They establish a contract for
6
- * defining project-specific custom UI pages with lazy loading support.
5
+ * stored in the project's config collection.
6
+ *
7
+ * Hierarchy:
8
+ * - Level 1: Group (shown in sidebar with expand/collapse)
9
+ * - Level 2: Page (shown as items within expanded group)
10
+ * - Level 3: Tab (shown as tabs within a page)
11
+ *
12
+ * URL Pattern: #/p/{projectId}/custom/{groupId}/{pageId}?/{tabPath}?
7
13
  *
8
14
  * @module custom-pages/types
9
15
  */
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Base configuration interface for Joy admin UI.
3
+ * Extensible via index signature - consumers can add custom fields.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * // Extend with custom fields
8
+ * interface MyJoyConfig extends JoyConfig {
9
+ * myCustomField: string;
10
+ * stuic: {
11
+ * DismissibleMessage: {
12
+ * theme: "red" | "blue"; // Stricter typing
13
+ * };
14
+ * };
15
+ * }
16
+ * ```
17
+ */
18
+ export interface JoyConfig {
19
+ /** Project/app title */
20
+ title?: string;
21
+ /** Stuic component configuration overrides */
22
+ stuic?: {
23
+ DismissibleMessage?: {
24
+ /** Theme color for dismissible messages */
25
+ theme?: string;
26
+ };
27
+ [component: string]: Record<string, unknown> | undefined;
28
+ };
29
+ /** Index signature for custom extensions */
30
+ [key: string]: unknown;
31
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/mod.d.ts CHANGED
@@ -50,3 +50,4 @@ export * from "./schema-builder.js";
50
50
  export * from "./navigation.js";
51
51
  export * from "./form-routes.js";
52
52
  export * from "./custom-pages.js";
53
+ export * from "./joy-config.js";
package/dist/mod.js CHANGED
@@ -69,3 +69,5 @@ export * from "./navigation.js";
69
69
  export * from "./form-routes.js";
70
70
  // Custom Pages Configuration Types (admin UI)
71
71
  export * from "./custom-pages.js";
72
+ // Joy Config Types (admin UI)
73
+ export * from "./joy-config.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/collection-types",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "type": "module",
5
5
  "main": "dist/mod.js",
6
6
  "types": "dist/mod.d.ts",