@artisan-cloud/plugin-framework-admin 0.0.1-alpha

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/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ export interface PowerXAdminConfigOptions {
2
+ pluginId: string
3
+ starterPages?: boolean
4
+ }
5
+
6
+ export function definePowerXAdminConfig(options: PowerXAdminConfigOptions) {
7
+ return {
8
+ extends: ['@artisan-cloud/plugin-framework-admin/layer'],
9
+ appConfig: {
10
+ powerx: {
11
+ pluginId: options.pluginId,
12
+ starterPages: options.starterPages ?? true
13
+ }
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div class="px-admin-layout">
3
+ <header class="px-admin-layout__header">
4
+ <slot name="toolbar">
5
+ <h1>PowerX Admin</h1>
6
+ </slot>
7
+ </header>
8
+ <main class="px-admin-layout__body">
9
+ <slot />
10
+ </main>
11
+ </div>
12
+ </template>
13
+
14
+ <style scoped>
15
+ .px-admin-layout {
16
+ min-height: 100vh;
17
+ display: flex;
18
+ flex-direction: column;
19
+ }
20
+
21
+ .px-admin-layout__header {
22
+ padding: 1rem 2rem;
23
+ border-bottom: 1px solid #eee;
24
+ }
25
+
26
+ .px-admin-layout__body {
27
+ flex: 1;
28
+ padding: 2rem;
29
+ }
30
+ </style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <aside class="px-nav">
3
+ <slot>
4
+ <ul>
5
+ <li>Home</li>
6
+ </ul>
7
+ </slot>
8
+ </aside>
9
+ </template>
10
+
11
+ <style scoped>
12
+ .px-nav {
13
+ padding: 1rem;
14
+ }
15
+ </style>
@@ -0,0 +1,3 @@
1
+ export default defineNuxtRouteMiddleware(() => {
2
+ // 占位鉴权守卫:实际项目中应在此检查登录/权限状态。
3
+ })
@@ -0,0 +1,3 @@
1
+ export default defineNuxtRouteMiddleware(() => {
2
+ // 占位多租户上下文:实际实现应注入租户信息。
3
+ })
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <PXAdminLayout>
3
+ <p>默认启动页,使用 `starterPages: true` 时展示。</p>
4
+ </PXAdminLayout>
5
+ </template>
@@ -0,0 +1,8 @@
1
+ export default defineNuxtPlugin(() => {
2
+ // 占位权限指令注册点。
3
+ return {
4
+ provide: {
5
+ hasPermission: () => true
6
+ }
7
+ }
8
+ })
@@ -0,0 +1,37 @@
1
+ import { fileURLToPath } from 'node:url'
2
+ import { dirname, resolve } from 'node:path'
3
+ import type { NuxtConfig } from 'nuxt/schema'
4
+
5
+ const layerDir = dirname(fileURLToPath(import.meta.url))
6
+ const appDir = resolve(layerDir, 'app')
7
+
8
+ const config: NuxtConfig = {
9
+ imports: {
10
+ dirs: [
11
+ resolve(appDir, 'composables'),
12
+ resolve(appDir, 'composables/api')
13
+ ]
14
+ },
15
+ hooks: {
16
+ 'components:dirs'(dirs) {
17
+ dirs.push({
18
+ path: resolve(appDir, 'components'),
19
+ pathPrefix: false
20
+ })
21
+ },
22
+ 'pages:extend'(pages, nuxt) {
23
+ const starterEnabled = (nuxt?.options?.appConfig?.powerx?.starterPages ?? true) as boolean
24
+ if (starterEnabled) {
25
+ return
26
+ }
27
+ for (const page of [...pages]) {
28
+ if (typeof page.file === 'string' &&
29
+ (page.file.includes('app/pages/intro.vue') || page.file.includes('app/pages/templates/'))) {
30
+ pages.splice(pages.indexOf(page), 1)
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+ export default config
package/module.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { defineNuxtModule } from 'nuxt/kit'
2
+
3
+ export interface ModuleOptions {
4
+ pluginId: string
5
+ }
6
+
7
+ export default defineNuxtModule<ModuleOptions>({
8
+ meta: {
9
+ name: '@artisan-cloud/plugin-framework-admin'
10
+ },
11
+ setup() {
12
+ // 占位:后续可在此扩展 nuxt runtime 功能
13
+ }
14
+ })
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@artisan-cloud/plugin-framework-admin",
3
+ "version": "0.0.1-alpha",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.ts",
7
+ "./layer": "./layer/nuxt.config.ts",
8
+ "./layer/*": "./layer/*"
9
+ },
10
+ "files": [
11
+ "index.ts",
12
+ "module.ts",
13
+ "layer"
14
+ ],
15
+ "peerDependencies": {
16
+ "nuxt": "^4.2.0"
17
+ },
18
+ "devDependencies": {
19
+ "nuxt": "^4.2.0"
20
+ }
21
+ }