@morya-ui/setup 0.2.6 → 0.2.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.
Files changed (33) hide show
  1. package/README.md +23 -10
  2. package/package.json +1 -1
  3. package/src/cli.mjs +90 -32
  4. package/src/copy-template.mjs +18 -2
  5. package/src/fs-utils.mjs +2 -1
  6. package/src/styles.mjs +2 -87
  7. package/template/.agents/skills/morya-ui-pages/SKILL.md +1 -3
  8. package/template/.agents/skills/morya-ui-pages/references/component-index.md +7 -1
  9. package/template/.agents/skills/morya-ui-pages/references/design-system.md +1 -1
  10. package/template/.agents/skills/morya-ui-pages/references/feedback.md +1 -1
  11. package/template/.agents/skills/morya-ui-pages/references/page-layouts.md +10 -10
  12. package/template/.agents/skills/morya-ui-pages/references/surfaces.md +3 -3
  13. package/template/.cursor/rules/component-usage.mdc +2 -2
  14. package/template/.cursor/rules/design-system.mdc +5 -5
  15. package/template/.cursor/rules/page-layout.mdc +7 -9
  16. package/template/DESIGN.md +15 -15
  17. package/template/design-tokens/tokens.css +0 -55
  18. package/template/design-tokens/tokens.json +0 -77
  19. package/template/docs/components.md +0 -145
  20. package/template/docs/feedback-message-vs-toast.md +0 -103
  21. package/template/docs/golden-pages/dashboard-page.vue +0 -103
  22. package/template/docs/golden-pages/empty-state.vue +0 -66
  23. package/template/docs/golden-pages/form-page.vue +0 -107
  24. package/template/docs/golden-pages/landing-page.vue +0 -328
  25. package/template/docs/golden-pages/list-page.vue +0 -138
  26. package/template/docs/golden-pages/login-page.vue +0 -191
  27. package/template/src/examples/DashboardPageExample.vue +0 -103
  28. package/template/src/examples/EmptyStateExample.vue +0 -66
  29. package/template/src/examples/FormPageExample.vue +0 -107
  30. package/template/src/examples/LandingPageExample.vue +0 -328
  31. package/template/src/examples/ListPageExample.vue +0 -138
  32. package/template/src/examples/LoginPageExample.vue +0 -191
  33. package/template/src/styles/morya-app-shell.css +0 -6
@@ -1,191 +0,0 @@
1
- <script setup lang="ts">
2
- /**
3
- * 黄金样例:登录页(Account + 轻量品牌)
4
- * @see DESIGN.md §3 · morya-ui-pages surfaces § Account
5
- */
6
- import {
7
- MButton,
8
- MConfigProvider,
9
- MForm,
10
- MFormItem,
11
- MInput,
12
- MInputPassword,
13
- MSpace,
14
- zhCN,
15
- } from 'morya-ui'
16
- import { reactive, ref } from 'vue'
17
-
18
- const submitting = ref(false)
19
- const formError = ref('')
20
-
21
- const model = reactive({
22
- email: '',
23
- password: '',
24
- })
25
-
26
- async function onSubmit() {
27
- formError.value = ''
28
- submitting.value = true
29
- try {
30
- // await api.login(model)
31
- if (!model.email || !model.password) {
32
- formError.value = '请输入邮箱和密码后再试。'
33
- return
34
- }
35
- } finally {
36
- submitting.value = false
37
- }
38
- }
39
- </script>
40
-
41
- <template>
42
- <MConfigProvider :locale="zhCN">
43
- <div class="login-shell">
44
- <aside class="login-brand" aria-label="品牌">
45
- <p class="login-brand__mark">青禾书房</p>
46
- <h1 class="login-brand__title">把好书留在手边</h1>
47
- <p class="login-brand__lead">
48
- 店员与会员共用同一套账户。登录后继续进货、上架与会员服务。
49
- </p>
50
- </aside>
51
-
52
- <main class="login-main">
53
- <div class="login-panel">
54
- <header class="login-panel__header">
55
- <h2>登录</h2>
56
- <p>使用工作邮箱进入后台。</p>
57
- </header>
58
-
59
- <!-- 表单级常驻错误:token 样式告警条(字段错误优先用 errorMessage) -->
60
- <p v-if="formError" class="login-alert" role="alert">
61
- {{ formError }}
62
- </p>
63
-
64
- <MForm @submit="onSubmit">
65
- <MFormItem label="邮箱" name="email" required>
66
- <MInput
67
- v-model="model.email"
68
- type="email"
69
- placeholder="name@qinghe.example"
70
- autocomplete="username"
71
- fluid
72
- />
73
- </MFormItem>
74
-
75
- <MFormItem label="密码" name="password" required>
76
- <MInputPassword
77
- v-model="model.password"
78
- placeholder="请输入密码"
79
- autocomplete="current-password"
80
- fluid
81
- />
82
- </MFormItem>
83
-
84
- <MSpace style="margin-top: var(--m-space-2)" alignment="center">
85
- <MButton type="submit" label="登录" :loading="submitting" />
86
- <MButton type="button" label="忘记密码" severity="secondary" text />
87
- </MSpace>
88
- </MForm>
89
- </div>
90
- </main>
91
- </div>
92
- </MConfigProvider>
93
- </template>
94
-
95
- <style scoped>
96
- .login-shell {
97
- display: grid;
98
- grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
99
- min-height: 100vh;
100
- background: var(--m-color-surface);
101
- color: var(--m-color-text);
102
- }
103
-
104
- .login-brand {
105
- display: flex;
106
- flex-direction: column;
107
- justify-content: flex-end;
108
- gap: var(--m-space-4);
109
- padding: clamp(2rem, 6vw, 4.5rem);
110
- background:
111
- linear-gradient(
112
- 165deg,
113
- color-mix(in srgb, var(--m-color-primary) 18%, var(--m-color-surface)) 0%,
114
- var(--m-color-surface) 55%,
115
- color-mix(in srgb, var(--m-color-border) 35%, var(--m-color-surface)) 100%
116
- );
117
- border-right: 1px solid var(--m-color-border);
118
- }
119
-
120
- .login-brand__mark {
121
- margin: 0;
122
- font-size: 0.8125rem;
123
- letter-spacing: 0.14em;
124
- text-transform: uppercase;
125
- color: var(--m-color-text-muted);
126
- }
127
-
128
- .login-brand__title {
129
- margin: 0;
130
- max-width: 12em;
131
- font-size: clamp(2rem, 4vw, 3rem);
132
- font-weight: 650;
133
- line-height: 1.15;
134
- letter-spacing: -0.03em;
135
- }
136
-
137
- .login-brand__lead {
138
- margin: 0;
139
- max-width: 28rem;
140
- color: var(--m-color-text-muted);
141
- line-height: 1.6;
142
- }
143
-
144
- .login-main {
145
- display: grid;
146
- place-items: center;
147
- padding: var(--m-space-6);
148
- }
149
-
150
- .login-panel {
151
- width: min(100%, 22rem);
152
- }
153
-
154
- .login-panel__header {
155
- margin-bottom: var(--m-space-5);
156
- }
157
-
158
- .login-panel__header h2 {
159
- margin: 0 0 var(--m-space-2);
160
- font-size: 1.5rem;
161
- font-weight: 650;
162
- }
163
-
164
- .login-panel__header p {
165
- margin: 0;
166
- color: var(--m-color-text-muted);
167
- }
168
-
169
- .login-alert {
170
- margin: 0 0 var(--m-space-4);
171
- padding: var(--m-space-3) var(--m-space-4);
172
- border: 1px solid color-mix(in srgb, var(--m-color-danger) 40%, var(--m-color-border));
173
- border-radius: var(--m-radius-md);
174
- background: color-mix(in srgb, var(--m-color-danger) 10%, var(--m-color-surface));
175
- color: var(--m-color-danger);
176
- font-size: 0.875rem;
177
- line-height: 1.45;
178
- }
179
-
180
- @media (max-width: 768px) {
181
- .login-shell {
182
- grid-template-columns: 1fr;
183
- }
184
-
185
- .login-brand {
186
- border-right: 0;
187
- border-bottom: 1px solid var(--m-color-border);
188
- min-height: 12rem;
189
- }
190
- }
191
- </style>
@@ -1,103 +0,0 @@
1
- <script setup lang="ts">
2
- /**
3
- * 黄金样例:仪表盘页
4
- * @see DESIGN.md §3
5
- */
6
- import {
7
- MBreadcrumb,
8
- MCard,
9
- MConfigProvider,
10
- MGrid,
11
- MGridItem,
12
- MLayout,
13
- MLayoutContent,
14
- MLayoutHeader,
15
- MPageContent,
16
- MPageHeader,
17
- MPagePlaceholder,
18
- MPageStat,
19
- MTable,
20
- MTag,
21
- zhCN,
22
- } from 'morya-ui'
23
-
24
- const stats = [
25
- { label: '总用户', value: '12,480', trend: '+8.2%', icon: 'users' },
26
- { label: '今日活跃', value: '1,926', trend: '+3.1%', icon: 'activity' },
27
- { label: '待处理工单', value: '47', trend: '-12%', trendSeverity: 'warn' as const, icon: 'clipboard' },
28
- { label: '系统健康', value: '99.9%', trend: '稳定', trendSeverity: 'secondary' as const, icon: 'heart' },
29
- ]
30
-
31
- const recentColumns = [
32
- { key: 'id', label: '工单号', width: 96 },
33
- { key: 'title', label: '标题' },
34
- { key: 'priority', label: '优先级', width: 96 },
35
- { key: 'status', label: '状态', width: 96 },
36
- ]
37
-
38
- const recentRows = [
39
- { id: 'WO-1024', title: '登录异常反馈', priority: 'high', status: 'open' },
40
- { id: 'WO-1023', title: '导出任务超时', priority: 'medium', status: 'progress' },
41
- { id: 'WO-1022', title: '权限配置咨询', priority: 'low', status: 'done' },
42
- ]
43
-
44
- function prioritySeverity(p: string) {
45
- if (p === 'high') return 'danger'
46
- if (p === 'medium') return 'warn'
47
- return 'secondary'
48
- }
49
-
50
- function statusLabel(s: string) {
51
- if (s === 'open') return '待处理'
52
- if (s === 'progress') return '进行中'
53
- return '已完成'
54
- }
55
- </script>
56
-
57
- <template>
58
- <MConfigProvider :locale="zhCN">
59
- <MLayout fill-viewport>
60
- <MLayoutHeader padding="var(--m-space-4) var(--m-space-6)">
61
- <MBreadcrumb :model="[{ label: '首页' }, { label: '仪表盘' }]" />
62
- </MLayoutHeader>
63
-
64
- <MLayoutContent>
65
- <MPageContent density="spacious">
66
- <MPageHeader title="仪表盘" />
67
-
68
- <MGrid :cols="4" :x-gap="16" :y-gap="16" responsive="screen">
69
- <MGridItem v-for="item in stats" :key="item.label" :span="1">
70
- <MPageStat
71
- :label="item.label"
72
- :value="item.value"
73
- :trend="item.trend"
74
- :trend-severity="item.trendSeverity ?? 'primary'"
75
- :icon="item.icon"
76
- />
77
- </MGridItem>
78
- </MGrid>
79
-
80
- <MGrid :cols="2" :x-gap="16" :y-gap="16">
81
- <MGridItem :span="1">
82
- <MCard title="趋势概览">
83
- <MPagePlaceholder aria-label="图表占位" description="图表区域(接入 ECharts / 业务组件)" />
84
- </MCard>
85
- </MGridItem>
86
- <MGridItem :span="1">
87
- <MCard title="最近工单">
88
- <MTable :columns="recentColumns" :rows="recentRows" size="small" :paginator="false" bordered>
89
- <template #cell-priority="{ value }">
90
- <MTag :value="String(value)" :severity="prioritySeverity(String(value))" />
91
- </template>
92
- <template #cell-status="{ value }">
93
- <MTag :value="statusLabel(String(value))" severity="info" />
94
- </template>
95
- </MTable>
96
- </MCard>
97
- </MGridItem>
98
- </MGrid>
99
- </MPageContent>
100
- </MLayoutContent>
101
- </MLayout>
102
- </MConfigProvider>
103
- </template>
@@ -1,66 +0,0 @@
1
- <script setup lang="ts">
2
- /**
3
- * 黄金样例:列表空状态(Flow)
4
- * @see DESIGN.md §3 · morya-ui-pages surfaces § Flow
5
- * 可嵌在列表页 MPageContent / MTable #empty 中;此处给出完整可运行骨架。
6
- */
7
- import {
8
- MBreadcrumb,
9
- MButton,
10
- MConfigProvider,
11
- MEmpty,
12
- MLayout,
13
- MLayoutContent,
14
- MLayoutHeader,
15
- MPageContent,
16
- MPageToolbar,
17
- zhCN,
18
- } from 'morya-ui'
19
- </script>
20
-
21
- <template>
22
- <MConfigProvider :locale="zhCN">
23
- <MLayout fill-viewport>
24
- <MLayoutHeader padding="var(--m-space-4) var(--m-space-6)">
25
- <MBreadcrumb :model="[{ label: '首页', to: '/' }, { label: '课程' }]" />
26
- </MLayoutHeader>
27
-
28
- <MLayoutContent>
29
- <MPageContent>
30
- <MPageToolbar title="课程">
31
- <template #actions>
32
- <MButton label="新建课程" />
33
- </template>
34
- </MPageToolbar>
35
-
36
- <div class="empty-state-shell">
37
- <MEmpty
38
- title="还没有课程"
39
- description="创建第一门课程后,学员就能在目录里看到它。也可以稍后从模板导入。"
40
- icon="book"
41
- >
42
- <template #extra>
43
- <MButton label="创建第一门课程" />
44
- <MButton label="从模板导入" severity="secondary" text />
45
- </template>
46
- </MEmpty>
47
- </div>
48
- </MPageContent>
49
- </MLayoutContent>
50
- </MLayout>
51
- </MConfigProvider>
52
- </template>
53
-
54
- <style scoped>
55
- .empty-state-shell {
56
- border: 1px dashed color-mix(in srgb, var(--m-color-border) 80%, var(--m-color-primary));
57
- border-radius: var(--m-radius-md);
58
- background:
59
- radial-gradient(
60
- 120% 80% at 50% 0%,
61
- color-mix(in srgb, var(--m-color-primary) 10%, transparent),
62
- transparent 55%
63
- ),
64
- var(--m-color-surface);
65
- }
66
- </style>
@@ -1,107 +0,0 @@
1
- <script setup lang="ts">
2
- /**
3
- * 黄金样例:表单页
4
- * @see DESIGN.md §3
5
- */
6
- import {
7
- MBreadcrumb,
8
- MButton,
9
- MConfigProvider,
10
- MDatePicker,
11
- MForm,
12
- MFormItem,
13
- MInput,
14
- MLayout,
15
- MLayoutContent,
16
- MLayoutHeader,
17
- MPageContent,
18
- MPageHeader,
19
- MPageSection,
20
- MSelect,
21
- MSpace,
22
- MSwitch,
23
- MTextarea,
24
- zhCN,
25
- } from 'morya-ui'
26
- import { reactive, ref } from 'vue'
27
-
28
- const submitting = ref(false)
29
-
30
- const model = reactive({
31
- name: '',
32
- email: '',
33
- role: undefined as string | undefined,
34
- active: true,
35
- joinedAt: null as string | null,
36
- bio: '',
37
- })
38
-
39
- const roleOptions = [
40
- { label: '管理员', value: 'admin' },
41
- { label: '成员', value: 'member' },
42
- ]
43
-
44
- async function onSubmit() {
45
- submitting.value = true
46
- try {
47
- // await api.save(model)
48
- } finally {
49
- submitting.value = false
50
- }
51
- }
52
- </script>
53
-
54
- <template>
55
- <MConfigProvider :locale="zhCN">
56
- <MLayout fill-viewport>
57
- <MLayoutHeader padding="var(--m-space-4) var(--m-space-6)">
58
- <MBreadcrumb :model="[{ label: '首页', to: '/' }, { label: '用户管理', to: '/users' }, { label: '新建用户' }]" />
59
- </MLayoutHeader>
60
-
61
- <MLayoutContent>
62
- <MPageContent width="narrow">
63
- <MPageHeader title="新建用户" description="填写基本信息并分配角色。" />
64
-
65
- <MPageSection variant="form">
66
- <MForm @submit="onSubmit">
67
- <MFormItem label="姓名" name="name" required>
68
- <MInput v-model="model.name" placeholder="请输入姓名" fluid />
69
- </MFormItem>
70
-
71
- <MFormItem label="邮箱" name="email" required>
72
- <MInput v-model="model.email" type="email" placeholder="name@example.com" fluid />
73
- </MFormItem>
74
-
75
- <MFormItem label="角色" name="role" required>
76
- <MSelect v-model="model.role" :options="roleOptions" placeholder="请选择角色" fluid />
77
- </MFormItem>
78
-
79
- <MFormItem label="入职日期" name="joinedAt">
80
- <MDatePicker v-model="model.joinedAt" placeholder="选择日期" fluid />
81
- </MFormItem>
82
-
83
- <MFormItem label="启用账号" name="active">
84
- <MSwitch v-model="model.active" />
85
- </MFormItem>
86
-
87
- <MFormItem label="简介" name="bio">
88
- <MTextarea v-model="model.bio" :rows="4" placeholder="可选" fluid />
89
- </MFormItem>
90
-
91
- <MPageSection variant="actions">
92
- <MSpace>
93
- <MButton native-type="submit" severity="primary" :loading="submitting">
94
- 保存
95
- </MButton>
96
- <MButton severity="secondary">
97
- 取消
98
- </MButton>
99
- </MSpace>
100
- </MPageSection>
101
- </MForm>
102
- </MPageSection>
103
- </MPageContent>
104
- </MLayoutContent>
105
- </MLayout>
106
- </MConfigProvider>
107
- </template>