@sfxcode/nuxt-ui-mongocamp 1.5.6 → 1.5.8
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/module.d.mts +26 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -0
- package/dist/runtime/components/MongocampAccount.vue +12 -14
- package/dist/runtime/components/MongocampAggregationBuilder.vue +27 -43
- package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +1 -1
- package/dist/runtime/components/MongocampBucketFiles.vue +25 -34
- package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
- package/dist/runtime/components/MongocampChart.vue +1 -1
- package/dist/runtime/components/MongocampCollectionCharts.vue +6 -5
- package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCollectionCopy.vue +6 -6
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampCollectionData.vue +37 -62
- package/dist/runtime/components/MongocampCollectionInfos.vue +18 -23
- package/dist/runtime/components/MongocampCollectionRename.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
- package/dist/runtime/components/MongocampCollectionRename.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampCollections.vue +24 -33
- package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
- package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
- package/dist/runtime/components/MongocampDashboard.vue +5 -3
- package/dist/runtime/components/MongocampDatabases.vue +14 -8
- package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
- package/dist/runtime/components/MongocampDocumentView.vue +6 -8
- package/dist/runtime/components/MongocampEmptyState.vue +4 -1
- package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
- package/dist/runtime/components/MongocampExportAll.vue +7 -7
- package/dist/runtime/components/MongocampFilePreview.vue +7 -6
- package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
- package/dist/runtime/components/MongocampGrantList.vue +6 -2
- package/dist/runtime/components/MongocampImport.vue +29 -28
- package/dist/runtime/components/MongocampIndexes.vue +15 -17
- package/dist/runtime/components/MongocampJobs.vue +20 -20
- package/dist/runtime/components/MongocampLogin.vue +2 -1
- package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
- package/dist/runtime/components/MongocampQueryBar.vue +18 -32
- package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
- package/dist/runtime/components/MongocampRoles.vue +28 -32
- package/dist/runtime/components/MongocampServerInfo.vue +17 -12
- package/dist/runtime/components/MongocampServerOverview.vue +16 -12
- package/dist/runtime/components/MongocampServerStatus.vue +2 -1
- package/dist/runtime/components/MongocampSettings.vue +15 -11
- package/dist/runtime/components/MongocampUserAccess.vue +11 -6
- package/dist/runtime/components/MongocampUsers.vue +32 -35
- package/dist/runtime/components/MongocampVersion.vue +6 -4
- package/dist/runtime/composables/useMongocampAdmin.d.ts +4 -4
- package/dist/runtime/composables/useMongocampClientApi.d.ts +13 -1
- package/dist/runtime/composables/useMongocampConnection.d.ts +25 -0
- package/dist/runtime/composables/useMongocampConnection.js +33 -0
- package/dist/runtime/composables/useMongocampRoles.d.ts +5 -5
- package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/plugin.d.ts +5 -1
- package/dist/runtime/plugin.js +62 -2
- package/dist/runtime/publicUtils.d.ts +1 -0
- package/dist/runtime/publicUtils.js +1 -0
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/connection.d.ts +23 -0
- package/dist/runtime/utils/connection.js +31 -0
- package/dist/runtime/utils/sessionGuard.d.ts +1 -0
- package/dist/runtime/utils/sessionGuard.js +8 -0
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +13 -13
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { AlertProps, BadgeProps, ButtonProps } from '@nuxt/ui';
|
|
2
|
+
/**
|
|
3
|
+
* The module's own look, set by an app in `app.config.ts` (key `ui` under `nuxtUiMongocamp`) and read through
|
|
4
|
+
* `useMongocampUi()`. Roles, not components: one entry styles every button/alert/badge of that kind in
|
|
5
|
+
* every Mongocamp component. Colours that carry a meaning (`error`, `warning`, `success`, `info` on a
|
|
6
|
+
* delete button, an error alert, a status badge) are not themeable — only the variant and size around them.
|
|
7
|
+
*/
|
|
8
|
+
export type ControlSize = NonNullable<ButtonProps['size']>;
|
|
9
|
+
export interface ButtonStyle {
|
|
10
|
+
color?: ButtonProps['color'];
|
|
11
|
+
variant?: ButtonProps['variant'];
|
|
12
|
+
size?: ButtonProps['size'];
|
|
13
|
+
}
|
|
14
|
+
export interface MongocampUiTheme {
|
|
15
|
+
/** Inputs, selects and field groups inside the components' toolbars and editors. */
|
|
16
|
+
controlSize: ControlSize;
|
|
17
|
+
/** Reload and other buttons in a component's own toolbar. */
|
|
18
|
+
toolbarButton: ButtonStyle;
|
|
19
|
+
/** Small icon buttons: table row actions (a delete keeps its `error` colour) and toolbar icons. */
|
|
20
|
+
iconButton: ButtonStyle;
|
|
21
|
+
/** The sortable column headers of tables. */
|
|
22
|
+
sortHeader: ButtonStyle;
|
|
23
|
+
/** Cancel, close and back in dialog footers. */
|
|
24
|
+
dialogCancel: ButtonStyle;
|
|
25
|
+
/** The confirming button of an irreversible action (delete, regenerate). */
|
|
26
|
+
dangerAction: ButtonStyle;
|
|
27
|
+
/** Secondary actions beside content: copy, download, stop. */
|
|
28
|
+
secondaryAction: ButtonStyle;
|
|
29
|
+
/** Small buttons inside dense editors (document tree, aggregation stages, chips). */
|
|
30
|
+
compactButton: ButtonStyle;
|
|
31
|
+
/** Every alert; its colour stays the one that fits the message. */
|
|
32
|
+
alert: {
|
|
33
|
+
variant?: AlertProps['variant'];
|
|
34
|
+
};
|
|
35
|
+
/** A button inside an alert (retry, log in again); its colour follows the alert. */
|
|
36
|
+
alertAction: {
|
|
37
|
+
variant?: ButtonProps['variant'];
|
|
38
|
+
size?: ButtonProps['size'];
|
|
39
|
+
};
|
|
40
|
+
/** Every badge; its colour stays the one that fits the value. */
|
|
41
|
+
badge: {
|
|
42
|
+
variant?: BadgeProps['variant'];
|
|
43
|
+
};
|
|
44
|
+
/** Widths of dialogs and drawers (`content` classes) and the footer layout. */
|
|
45
|
+
modal: {
|
|
46
|
+
md: string;
|
|
47
|
+
lg: string;
|
|
48
|
+
xl: string;
|
|
49
|
+
footer: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export type MongocampUiThemeInput = {
|
|
53
|
+
[K in keyof MongocampUiTheme]?: MongocampUiTheme[K] extends string ? MongocampUiTheme[K] : Partial<MongocampUiTheme[K]>;
|
|
54
|
+
};
|
|
55
|
+
/** Today's look. Changing a value here changes every consumer app that has not set it. */
|
|
56
|
+
export declare const DEFAULT_UI: MongocampUiTheme;
|
|
57
|
+
/** Values of `data-mongocamp-part`. Public API: a stylesheet can target them. */
|
|
58
|
+
export declare const MONGOCAMP_PARTS: readonly ["heading", "toolbar", "table", "row-actions", "empty", "error"];
|
|
59
|
+
export type MongocampPart = typeof MONGOCAMP_PARTS[number];
|
|
60
|
+
/**
|
|
61
|
+
* Merges an app's (partial, unchecked) theme over the defaults. Unknown keys are ignored, a value that is
|
|
62
|
+
* not a non-empty string falls back to the default, a role's field the default leaves open (`size` of
|
|
63
|
+
* `toolbarButton`) can be set. Always returns fresh objects.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveUi(input: unknown): MongocampUiTheme;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const DEFAULT_UI = {
|
|
2
|
+
controlSize: "sm",
|
|
3
|
+
toolbarButton: { color: "neutral", variant: "ghost" },
|
|
4
|
+
iconButton: { color: "neutral", variant: "ghost", size: "sm" },
|
|
5
|
+
sortHeader: { color: "neutral", variant: "ghost" },
|
|
6
|
+
dialogCancel: { color: "neutral", variant: "ghost" },
|
|
7
|
+
dangerAction: { color: "error" },
|
|
8
|
+
secondaryAction: { color: "neutral", variant: "subtle" },
|
|
9
|
+
compactButton: { color: "neutral", variant: "ghost", size: "xs" },
|
|
10
|
+
alert: { variant: "subtle" },
|
|
11
|
+
alertAction: { variant: "subtle" },
|
|
12
|
+
badge: { variant: "subtle" },
|
|
13
|
+
modal: { md: "sm:max-w-xl", lg: "sm:max-w-3xl", xl: "sm:max-w-5xl", footer: "justify-end" }
|
|
14
|
+
};
|
|
15
|
+
export const MONGOCAMP_PARTS = ["heading", "toolbar", "table", "row-actions", "empty", "error"];
|
|
16
|
+
function isRecord(value) {
|
|
17
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18
|
+
}
|
|
19
|
+
function isText(value) {
|
|
20
|
+
return typeof value === "string" && value.trim() !== "";
|
|
21
|
+
}
|
|
22
|
+
export function resolveUi(input) {
|
|
23
|
+
const source = isRecord(input) ? input : {};
|
|
24
|
+
const result = {};
|
|
25
|
+
for (const [key, fallback] of Object.entries(DEFAULT_UI)) {
|
|
26
|
+
const given = source[key];
|
|
27
|
+
if (typeof fallback === "string") {
|
|
28
|
+
result[key] = isText(given) ? given.trim() : fallback;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const base = fallback;
|
|
32
|
+
const fields = key === "modal" ? Object.keys(base) : roleFields(key);
|
|
33
|
+
const merged = {};
|
|
34
|
+
for (const field of fields) {
|
|
35
|
+
const value = isRecord(given) ? given[field] : void 0;
|
|
36
|
+
if (isText(value)) merged[field] = value.trim();
|
|
37
|
+
else if (base[field] !== void 0) merged[field] = base[field];
|
|
38
|
+
}
|
|
39
|
+
result[key] = merged;
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
function roleFields(key) {
|
|
44
|
+
if (key === "alert" || key === "badge") return ["variant"];
|
|
45
|
+
if (key === "alertAction") return ["variant", "size"];
|
|
46
|
+
return ["color", "variant", "size"];
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfxcode/nuxt-ui-mongocamp",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"description": "A Nuxt module that wraps @sfxcode/nuxt-mongocamp-server with ready-made UI components, composables, and a runtime plugin",
|
|
5
5
|
"repository": "sfxcode/nuxt-ui-mongocamp",
|
|
6
6
|
"homepage": "https://sfxcode.github.io/nuxt-ui-mongocamp/",
|
|
@@ -62,38 +62,38 @@
|
|
|
62
62
|
"docs:preview": "vitepress preview docs"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@formkit/nuxt": "^2.
|
|
65
|
+
"@formkit/nuxt": "^2.10.0",
|
|
66
66
|
"@internationalized/date": "^3.12.4",
|
|
67
|
-
"@nuxt/ui": "^4.
|
|
68
|
-
"@nuxtjs/i18n": "^10.
|
|
67
|
+
"@nuxt/ui": "^4.13.1",
|
|
68
|
+
"@nuxtjs/i18n": "^10.7.0",
|
|
69
69
|
"@sfxcode/nuxt-mongocamp-server": "^1.9.2",
|
|
70
|
-
"@sfxcode/nuxt-ui-formkit": "^1.
|
|
70
|
+
"@sfxcode/nuxt-ui-formkit": "^1.5.0",
|
|
71
71
|
"@tanstack/charts": "^1.5.0",
|
|
72
72
|
"@tanstack/vue-table": "^8.21.3",
|
|
73
73
|
"consola": "^3.4.2",
|
|
74
74
|
"defu": "^6.1.7",
|
|
75
|
-
"minimatch": "^11.0.
|
|
75
|
+
"minimatch": "^11.0.9",
|
|
76
76
|
"unocss-nuxt-ui": "^1.3.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@iconify-json/lucide": "^1.2.
|
|
80
|
-
"@nuxt/devtools": "^4.2.
|
|
79
|
+
"@iconify-json/lucide": "^1.2.160",
|
|
80
|
+
"@nuxt/devtools": "^4.2.2",
|
|
81
81
|
"@nuxt/eslint-config": "^1.17.0",
|
|
82
|
-
"@nuxt/kit": "^4.
|
|
82
|
+
"@nuxt/kit": "^4.7.0",
|
|
83
83
|
"@nuxt/module-builder": "^1.0.4",
|
|
84
|
-
"@nuxt/schema": "^4.
|
|
84
|
+
"@nuxt/schema": "^4.7.0",
|
|
85
85
|
"@nuxt/test-utils": "^4.4.0",
|
|
86
86
|
"@playwright/test": "^1.65.1",
|
|
87
87
|
"@types/node": "latest",
|
|
88
|
-
"@unhead/vue": "^3.
|
|
88
|
+
"@unhead/vue": "^3.5.3",
|
|
89
89
|
"@vue/test-utils": "^2.6.0",
|
|
90
90
|
"changelogen": "^0.6.2",
|
|
91
91
|
"eslint": "^10.15.0",
|
|
92
92
|
"happy-dom": "^21.0.4",
|
|
93
|
-
"nuxt": "^4.
|
|
93
|
+
"nuxt": "^4.7.0",
|
|
94
94
|
"typescript": "~6.0.3",
|
|
95
95
|
"vitepress": "2.0.0-alpha.18",
|
|
96
|
-
"vitest": "^5.1.
|
|
96
|
+
"vitest": "^5.1.2",
|
|
97
97
|
"vue-tsc": "^3.3.14"
|
|
98
98
|
},
|
|
99
99
|
"packageManager": "pnpm@11.21.0+sha512.521705bce689924eac72f5a3587122f362689ef6571e55ba80076fd637c11132ecffada26fad4ea79c485bfddbfd3d5a2a5b05805a77e893de71ec8a6cca3bb1"
|