@frigear-nu/dashboard 0.0.0-stage → 0.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/README.md +4 -2
- package/dist/module.d.mts +81 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +128 -0
- package/dist/runtime/access.d.ts +1 -0
- package/dist/runtime/access.js +12 -0
- package/dist/runtime/app/components/ActionCard.d.vue.ts +19 -0
- package/dist/runtime/app/components/ActionCard.vue +54 -0
- package/dist/runtime/app/components/ActionCard.vue.d.ts +19 -0
- package/dist/runtime/app/components/ChartCard.d.vue.ts +28 -0
- package/dist/runtime/app/components/ChartCard.vue +53 -0
- package/dist/runtime/app/components/ChartCard.vue.d.ts +28 -0
- package/dist/runtime/app/components/Dashboard.d.vue.ts +27 -0
- package/dist/runtime/app/components/Dashboard.vue +156 -0
- package/dist/runtime/app/components/Dashboard.vue.d.ts +27 -0
- package/dist/runtime/app/components/DashboardGrid.d.vue.ts +15 -0
- package/dist/runtime/app/components/DashboardGrid.vue +9 -0
- package/dist/runtime/app/components/DashboardGrid.vue.d.ts +15 -0
- package/dist/runtime/app/components/DashboardItem.d.vue.ts +26 -0
- package/dist/runtime/app/components/DashboardItem.vue +153 -0
- package/dist/runtime/app/components/DashboardItem.vue.d.ts +26 -0
- package/dist/runtime/app/components/EmptyCard.d.vue.ts +18 -0
- package/dist/runtime/app/components/EmptyCard.vue +25 -0
- package/dist/runtime/app/components/EmptyCard.vue.d.ts +18 -0
- package/dist/runtime/app/composables/useDashboard.d.ts +46 -0
- package/dist/runtime/app/composables/useDashboard.js +59 -0
- package/dist/runtime/app/composables/useDashboardItem.d.ts +34 -0
- package/dist/runtime/app/composables/useDashboardItem.js +28 -0
- package/dist/runtime/app/composables/useDashboardLayout.d.ts +24 -0
- package/dist/runtime/app/composables/useDashboardLayout.js +67 -0
- package/dist/runtime/app/composables/useDashboardPlatform.d.ts +10 -0
- package/dist/runtime/app/composables/useDashboardPlatform.js +17 -0
- package/dist/runtime/app/composables/useSavedDashboardLayouts.d.ts +20 -0
- package/dist/runtime/app/composables/useSavedDashboardLayouts.js +35 -0
- package/dist/runtime/app/pages/home.d.vue.ts +3 -0
- package/dist/runtime/app/pages/home.vue +16 -0
- package/dist/runtime/app/pages/home.vue.d.ts +3 -0
- package/dist/runtime/app/utils/components.d.ts +8 -0
- package/dist/runtime/app/utils/components.js +19 -0
- package/dist/runtime/app/utils/span.d.ts +1 -0
- package/dist/runtime/app/utils/span.js +10 -0
- package/dist/runtime/i18n/lang/da.json +49 -0
- package/dist/runtime/i18n/lang/en.json +49 -0
- package/dist/runtime/preferences.d.ts +37 -0
- package/dist/runtime/preferences.js +25 -0
- package/dist/runtime/server/layouts.d.ts +9 -0
- package/dist/runtime/server/layouts.js +25 -0
- package/dist/runtime/server/routes/me/layouts.get.d.ts +2 -0
- package/dist/runtime/server/routes/me/layouts.get.js +6 -0
- package/dist/runtime/server/routes/me/layouts.patch.d.ts +2 -0
- package/dist/runtime/server/routes/me/layouts.patch.js +10 -0
- package/dist/runtime/shared/home-tab.d.ts +31 -0
- package/dist/runtime/shared/home-tab.js +21 -0
- package/dist/runtime/shared/layout.d.ts +62 -0
- package/dist/runtime/shared/layout.js +110 -0
- package/dist/runtime/shared/registry.d.ts +11 -0
- package/dist/runtime/shared/registry.js +15 -0
- package/dist/runtime/shared/stored-layouts.d.ts +12 -0
- package/dist/runtime/shared/stored-layouts.js +16 -0
- package/dist/runtime/utils/api.d.ts +11 -0
- package/dist/runtime/utils/api.js +11 -0
- package/dist/runtime/utils/dashboard.d.ts +22 -0
- package/dist/runtime/utils/dashboard.js +32 -0
- package/dist/runtime/utils/index.d.ts +4 -0
- package/dist/runtime/utils/index.js +18 -0
- package/dist/types.d.mts +3 -0
- package/package.json +110 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const BASE = "/api/dashboard";
|
|
2
|
+
export const dashboardApi = {
|
|
3
|
+
me: {
|
|
4
|
+
/**
|
|
5
|
+
* `GET` the caller's layouts (`{ layouts: { [dashboard]: DashboardLayout } }`); `PATCH { layouts: { [dashboard]:
|
|
6
|
+
* DashboardLayout | null } }` replaces (or with `null` removes) the layouts it names, keeps the others, and answers
|
|
7
|
+
* like the `GET`. `dashboard:layouts`: a session, or a token given it. Only ever the caller's own.
|
|
8
|
+
*/
|
|
9
|
+
layouts: `${BASE}/me/layouts`
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Nuxt } from '@nuxt/schema';
|
|
2
|
+
import type { DashboardItem, DashboardRegistryEntry } from '../../types.js';
|
|
3
|
+
/** What dashboard keeps of every registered item, by dashboard name (read once every module is done). */
|
|
4
|
+
export declare function getDashboardItems(nuxt: Nuxt): Record<string, DashboardRegistryEntry[]>;
|
|
5
|
+
/**
|
|
6
|
+
* Adds items to a named dashboard (`crew.home`) from a module's `setup()`; the order between modules does not matter.
|
|
7
|
+
* The component goes into the widget area `dashboard.<name>` (`extendWidgets`), the title and where the item shows into
|
|
8
|
+
* `#dashboard/registry`. An item with an `id` that the dashboard has already replaces it. Always use this rather than
|
|
9
|
+
* `extendWidgets` on the area `dashboard.<name>`: a widget without the dashboard part is not shown.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { extendDashboard } from '@frigear-nu/dashboard/utils'
|
|
13
|
+
*
|
|
14
|
+
* extendDashboard(nuxt, 'crew.home', {
|
|
15
|
+
* id: 'shifts.next',
|
|
16
|
+
* component: resolver.resolve('./runtime/app/dashboard/NextShift.vue'),
|
|
17
|
+
* titleKey: 'shifts.dashboard.next',
|
|
18
|
+
* order: 10,
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function extendDashboard(nuxt: Nuxt, name: string, items: DashboardItem | DashboardItem[]): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { deriveWidgetId, extendWidgets } from "@frigear-nu/widget/utils";
|
|
2
|
+
import { dashboardArea } from "../shared/registry.js";
|
|
3
|
+
export function getDashboardItems(nuxt) {
|
|
4
|
+
return nuxt.options._dashboardItems ?? {};
|
|
5
|
+
}
|
|
6
|
+
export function extendDashboard(nuxt, name, items) {
|
|
7
|
+
const list = Array.isArray(items) ? items : [items];
|
|
8
|
+
if (!name) throw new Error("[@frigear-nu/dashboard] extendDashboard needs a dashboard name, such as `crew.home`.");
|
|
9
|
+
const widgets = [];
|
|
10
|
+
const entries = [];
|
|
11
|
+
for (const item of list) {
|
|
12
|
+
const { title, titleKey, platforms, when, ...widget } = item;
|
|
13
|
+
const id = deriveWidgetId(widget);
|
|
14
|
+
widgets.push({ ...widget, id });
|
|
15
|
+
entries.push({
|
|
16
|
+
id,
|
|
17
|
+
...title !== void 0 ? { title } : {},
|
|
18
|
+
...titleKey !== void 0 ? { titleKey } : {},
|
|
19
|
+
...platforms !== void 0 ? { platforms: [...platforms] } : {},
|
|
20
|
+
...when !== void 0 ? { when: { ...when } } : {}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
extendWidgets(nuxt, dashboardArea(name), widgets);
|
|
24
|
+
const options = nuxt.options;
|
|
25
|
+
const registry = options._dashboardItems ||= {};
|
|
26
|
+
const registered = registry[name] ||= [];
|
|
27
|
+
for (const entry of entries) {
|
|
28
|
+
const existing = registered.findIndex((item) => item.id === entry.id);
|
|
29
|
+
if (existing === -1) registered.push(entry);
|
|
30
|
+
else registered[existing] = entry;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { extendDashboard, getDashboardItems } from './dashboard.js';
|
|
2
|
+
export { dashboardArea, resolveDashboardRegistry } from '../shared/registry.js';
|
|
3
|
+
export { applyLayout, emptyLayout, filterByPlatform, hideItem, isOnPlatform, minimalOrder, moveItem, normalizeLayout, orderItems, pruneLayout, resetLayout, setItemSettings, showItem, toggleCollapsed, } from '../shared/layout.js';
|
|
4
|
+
export type { DashboardItem, DashboardItemCondition, DashboardLayout, DashboardPlatform, DashboardRegistryEntry, } from '../../types.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { extendDashboard, getDashboardItems } from "./dashboard.js";
|
|
2
|
+
export { dashboardArea, resolveDashboardRegistry } from "../shared/registry.js";
|
|
3
|
+
export {
|
|
4
|
+
applyLayout,
|
|
5
|
+
emptyLayout,
|
|
6
|
+
filterByPlatform,
|
|
7
|
+
hideItem,
|
|
8
|
+
isOnPlatform,
|
|
9
|
+
minimalOrder,
|
|
10
|
+
moveItem,
|
|
11
|
+
normalizeLayout,
|
|
12
|
+
orderItems,
|
|
13
|
+
pruneLayout,
|
|
14
|
+
resetLayout,
|
|
15
|
+
setItemSettings,
|
|
16
|
+
showItem,
|
|
17
|
+
toggleCollapsed
|
|
18
|
+
} from "../shared/layout.js";
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default } from './module.mjs'
|
|
2
|
+
|
|
3
|
+
export { type DashboardHomeTabOptions, type DashboardItem, type DashboardItemCondition, type DashboardLayout, type DashboardLayoutsDto, type DashboardPlatform, type DashboardPublicConfig, type DashboardRegistryEntry, type ModuleOptions } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,113 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frigear-nu/dashboard",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Customisable dashboards: modules add items to a named dashboard (extendDashboard), pages render them with <Dashboard> or their own layout (useDashboard), and each user reorders, hides and collapses items.",
|
|
5
|
+
"homepage": "https://docs.frigear.dev/modules/interface/dashboard",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Frigear-nu/frigear-nu.git",
|
|
9
|
+
"directory": "packages/dashboard"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/module.mjs",
|
|
14
|
+
"types": "./dist/types.d.mts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/types.d.mts",
|
|
18
|
+
"import": "./dist/module.mjs",
|
|
19
|
+
"default": "./dist/module.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./utils": {
|
|
22
|
+
"types": "./dist/runtime/utils/index.d.ts",
|
|
23
|
+
"import": "./dist/runtime/utils/index.js",
|
|
24
|
+
"default": "./dist/runtime/utils/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./api": {
|
|
27
|
+
"types": "./dist/runtime/utils/api.d.ts",
|
|
28
|
+
"import": "./dist/runtime/utils/api.js",
|
|
29
|
+
"default": "./dist/runtime/utils/api.js"
|
|
30
|
+
},
|
|
31
|
+
"./types": {
|
|
32
|
+
"types": "./dist/types.d.mts"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@frigear-nu/module-kit": "^1.3.7",
|
|
40
|
+
"@frigear-nu/ui": "^0.2.7",
|
|
41
|
+
"@frigear-nu/widget": "^0.4.0",
|
|
42
|
+
"@nuxt/kit": "^4.6.4",
|
|
43
|
+
"drizzle-orm": "^0.45.4",
|
|
44
|
+
"zod": "^4.6.7"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@frigear-nu/auth": "^0.6.4",
|
|
48
|
+
"@frigear-nu/mobile": "^0.6.2",
|
|
49
|
+
"@frigear-nu/preferences": "^0.3.1",
|
|
50
|
+
"@nuxt/ui": "^4.12.0",
|
|
51
|
+
"@nuxthub/core": "^0.10.12",
|
|
52
|
+
"vue": "3.x"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"@frigear-nu/auth": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"@frigear-nu/mobile": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"@frigear-nu/preferences": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
64
|
+
"@nuxthub/core": {
|
|
65
|
+
"optional": true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@frigear-nu/auth": "^0.6.4",
|
|
70
|
+
"@frigear-nu/mobile": "^0.6.2",
|
|
71
|
+
"@frigear-nu/preferences": "^0.3.1",
|
|
72
|
+
"@frigear-nu/users": "^3.1.2",
|
|
73
|
+
"@libsql/client": "^0.18.0",
|
|
74
|
+
"@nuxt/eslint-config": "^1.17.0",
|
|
75
|
+
"@nuxt/module-builder": "^1.0.4",
|
|
76
|
+
"@nuxt/schema": "^4.6.4",
|
|
77
|
+
"@nuxt/test-utils": "^4.4.0",
|
|
78
|
+
"@nuxt/ui": "^4.12.0",
|
|
79
|
+
"@nuxthub/core": "^0.10.12",
|
|
80
|
+
"@types/node": "^26.6.6",
|
|
81
|
+
"drizzle-kit": "^0.31.11",
|
|
82
|
+
"eslint": "^10.15.0",
|
|
83
|
+
"nuxt": "^4.6.4",
|
|
84
|
+
"typescript": "^6.0.3",
|
|
85
|
+
"vitest": "^5.1.0",
|
|
86
|
+
"vue": "^3.5.45",
|
|
87
|
+
"vue-tsc": "^3.3.14"
|
|
88
|
+
},
|
|
89
|
+
"scripts": {
|
|
90
|
+
"dev:stub": "nuxt-module-build build --stub && nuxt-module-build prepare",
|
|
91
|
+
"build": "nuxt-module-build build",
|
|
92
|
+
"lint": "eslint .",
|
|
93
|
+
"lint:fix": "eslint . --fix",
|
|
94
|
+
"test": "vitest run",
|
|
95
|
+
"test:watch": "vitest watch"
|
|
96
|
+
},
|
|
97
|
+
"typesVersions": {
|
|
98
|
+
"*": {
|
|
99
|
+
".": [
|
|
100
|
+
"./dist/types.d.mts"
|
|
101
|
+
],
|
|
102
|
+
"utils": [
|
|
103
|
+
"./dist/runtime/utils/index.d.ts"
|
|
104
|
+
],
|
|
105
|
+
"api": [
|
|
106
|
+
"./dist/runtime/utils/api.d.ts"
|
|
107
|
+
],
|
|
108
|
+
"types": [
|
|
109
|
+
"./dist/types.d.mts"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
6
113
|
}
|