@origen-ui/admin-cli 1.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.
Files changed (430) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/bin/og-admin.mjs +131 -0
  4. package/package.json +28 -0
  5. package/templates/current/clean/.codebuddy/AGENTS.md +18 -0
  6. package/templates/current/clean/.codebuddy/rules/01-feature-architecture.md +12 -0
  7. package/templates/current/clean/.codebuddy/rules/02-vue-typescript.md +12 -0
  8. package/templates/current/clean/.codebuddy/rules/03-component-policy.md +30 -0
  9. package/templates/current/clean/.codebuddy/rules/04-api-auth-router.md +12 -0
  10. package/templates/current/clean/.codebuddy/rules/05-style.md +12 -0
  11. package/templates/current/clean/.codebuddy/rules/06-quality.md +12 -0
  12. package/templates/current/clean/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
  13. package/templates/current/clean/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
  14. package/templates/current/clean/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
  15. package/templates/current/clean/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
  16. package/templates/current/clean/.codebuddy/skills/use-og-form/SKILL.md +15 -0
  17. package/templates/current/clean/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
  18. package/templates/current/clean/.codebuddy/skills/use-og-http/SKILL.md +16 -0
  19. package/templates/current/clean/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
  20. package/templates/current/clean/.codebuddy/skills/use-og-search/SKILL.md +17 -0
  21. package/templates/current/clean/.codebuddy/skills/use-og-table/SKILL.md +19 -0
  22. package/templates/current/clean/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
  23. package/templates/current/clean/.codex/AGENTS.md +15 -0
  24. package/templates/current/clean/.codex/rules/01-feature-architecture.md +6 -0
  25. package/templates/current/clean/.codex/rules/02-vue-typescript.md +6 -0
  26. package/templates/current/clean/.codex/rules/03-component-policy.md +24 -0
  27. package/templates/current/clean/.codex/rules/04-api-auth-router.md +6 -0
  28. package/templates/current/clean/.codex/rules/05-style.md +6 -0
  29. package/templates/current/clean/.codex/rules/06-quality.md +6 -0
  30. package/templates/current/clean/.codex/skills/build-admin-feature/SKILL.md +14 -0
  31. package/templates/current/clean/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
  32. package/templates/current/clean/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
  33. package/templates/current/clean/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
  34. package/templates/current/clean/.codex/skills/use-og-dialog/SKILL.md +12 -0
  35. package/templates/current/clean/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
  36. package/templates/current/clean/.codex/skills/use-og-editor/SKILL.md +25 -0
  37. package/templates/current/clean/.codex/skills/use-og-form/SKILL.md +12 -0
  38. package/templates/current/clean/.codex/skills/use-og-form-table/SKILL.md +25 -0
  39. package/templates/current/clean/.codex/skills/use-og-http/SKILL.md +13 -0
  40. package/templates/current/clean/.codex/skills/use-og-http/agents/openai.yaml +4 -0
  41. package/templates/current/clean/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
  42. package/templates/current/clean/.codex/skills/use-og-search/SKILL.md +14 -0
  43. package/templates/current/clean/.codex/skills/use-og-table/SKILL.md +16 -0
  44. package/templates/current/clean/.codex/skills/use-og-upload/SKILL.md +25 -0
  45. package/templates/current/clean/.cursor/AGENTS.md +18 -0
  46. package/templates/current/clean/.cursor/rules/01-feature-architecture.mdc +12 -0
  47. package/templates/current/clean/.cursor/rules/02-vue-typescript.mdc +12 -0
  48. package/templates/current/clean/.cursor/rules/03-component-policy.mdc +30 -0
  49. package/templates/current/clean/.cursor/rules/04-api-auth-router.mdc +12 -0
  50. package/templates/current/clean/.cursor/rules/05-style.mdc +12 -0
  51. package/templates/current/clean/.cursor/rules/06-quality.mdc +12 -0
  52. package/templates/current/clean/.cursor/skills/build-admin-feature/SKILL.md +14 -0
  53. package/templates/current/clean/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
  54. package/templates/current/clean/.cursor/skills/use-og-dialog/SKILL.md +12 -0
  55. package/templates/current/clean/.cursor/skills/use-og-editor/SKILL.md +25 -0
  56. package/templates/current/clean/.cursor/skills/use-og-form/SKILL.md +12 -0
  57. package/templates/current/clean/.cursor/skills/use-og-form-table/SKILL.md +25 -0
  58. package/templates/current/clean/.cursor/skills/use-og-http/SKILL.md +13 -0
  59. package/templates/current/clean/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
  60. package/templates/current/clean/.cursor/skills/use-og-search/SKILL.md +14 -0
  61. package/templates/current/clean/.cursor/skills/use-og-table/SKILL.md +16 -0
  62. package/templates/current/clean/.cursor/skills/use-og-upload/SKILL.md +25 -0
  63. package/templates/current/clean/.env.example +7 -0
  64. package/templates/current/clean/.env.production.example +31 -0
  65. package/templates/current/clean/.qoder/AGENTS.md +15 -0
  66. package/templates/current/clean/.qoder/rules/01-feature-architecture.md +12 -0
  67. package/templates/current/clean/.qoder/rules/02-vue-typescript.md +12 -0
  68. package/templates/current/clean/.qoder/rules/03-component-policy.md +30 -0
  69. package/templates/current/clean/.qoder/rules/04-api-auth-router.md +12 -0
  70. package/templates/current/clean/.qoder/rules/05-style.md +12 -0
  71. package/templates/current/clean/.qoder/rules/06-quality.md +12 -0
  72. package/templates/current/clean/.qoder/skills/build-admin-feature/SKILL.md +14 -0
  73. package/templates/current/clean/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
  74. package/templates/current/clean/.qoder/skills/use-og-dialog/SKILL.md +12 -0
  75. package/templates/current/clean/.qoder/skills/use-og-editor/SKILL.md +25 -0
  76. package/templates/current/clean/.qoder/skills/use-og-form/SKILL.md +12 -0
  77. package/templates/current/clean/.qoder/skills/use-og-form-table/SKILL.md +25 -0
  78. package/templates/current/clean/.qoder/skills/use-og-http/SKILL.md +13 -0
  79. package/templates/current/clean/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
  80. package/templates/current/clean/.qoder/skills/use-og-search/SKILL.md +14 -0
  81. package/templates/current/clean/.qoder/skills/use-og-table/SKILL.md +16 -0
  82. package/templates/current/clean/.qoder/skills/use-og-upload/SKILL.md +25 -0
  83. package/templates/current/clean/AGENTS.md +16 -0
  84. package/templates/current/clean/README.md +116 -0
  85. package/templates/current/clean/component-catalog.json +765 -0
  86. package/templates/current/clean/e2e/admin-shell.spec.ts +150 -0
  87. package/templates/current/clean/e2e/demo-shell.spec.ts +328 -0
  88. package/templates/current/clean/evals/component-selection.json +29 -0
  89. package/templates/current/clean/gitignore +3 -0
  90. package/templates/current/clean/index.html +13 -0
  91. package/templates/current/clean/openapi.json +1623 -0
  92. package/templates/current/clean/package.json +65 -0
  93. package/templates/current/clean/playwright.config.ts +31 -0
  94. package/templates/current/clean/playwright.demo.config.ts +25 -0
  95. package/templates/current/clean/recipes/README.md +7 -0
  96. package/templates/current/clean/recipes/remote-crud-dialog-form.json +15 -0
  97. package/templates/current/clean/recipes/remote-crud-dialog-form.vue +66 -0
  98. package/templates/current/clean/scaffold.lock.json +12 -0
  99. package/templates/current/clean/scripts/check-admin-bundle.mjs +214 -0
  100. package/templates/current/clean/scripts/check-admin-scaffold.mjs +168 -0
  101. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
  102. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
  103. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
  104. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
  105. package/templates/current/clean/scripts/clean-overlay/src/main.ts +91 -0
  106. package/templates/current/clean/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
  107. package/templates/current/clean/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
  108. package/templates/current/clean/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
  109. package/templates/current/clean/scripts/demo-api.ts +797 -0
  110. package/templates/current/clean/scripts/generate-api.ts +27 -0
  111. package/templates/current/clean/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
  112. package/templates/current/clean/scripts/remove-examples.mjs +54 -0
  113. package/templates/current/clean/src/App.vue +67 -0
  114. package/templates/current/clean/src/api/client.spec.ts +66 -0
  115. package/templates/current/clean/src/api/client.ts +72 -0
  116. package/templates/current/clean/src/api/generated/data-contracts.ts +268 -0
  117. package/templates/current/clean/src/api/generated/http-client.ts +266 -0
  118. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
  119. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
  120. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
  121. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
  122. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
  123. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
  124. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
  125. package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +98 -0
  126. package/templates/current/clean/src/api/http-adapter.spec.ts +33 -0
  127. package/templates/current/clean/src/api/http-adapter.ts +83 -0
  128. package/templates/current/clean/src/api/index.ts +41 -0
  129. package/templates/current/clean/src/app/createAdminUi.spec.ts +110 -0
  130. package/templates/current/clean/src/app/createAdminUi.ts +78 -0
  131. package/templates/current/clean/src/app/menu.spec.ts +255 -0
  132. package/templates/current/clean/src/app/menu.ts +268 -0
  133. package/templates/current/clean/src/app/menuTypes.ts +17 -0
  134. package/templates/current/clean/src/app/origenUiLocale.spec.ts +14 -0
  135. package/templates/current/clean/src/app/origenUiLocale.ts +65 -0
  136. package/templates/current/clean/src/app/permission.ts +9 -0
  137. package/templates/current/clean/src/app/runtimeConfig.ts +77 -0
  138. package/templates/current/clean/src/demo-api.spec.ts +167 -0
  139. package/templates/current/clean/src/env.d.ts +14 -0
  140. package/templates/current/clean/src/features/appearance/components/ThemePanel.vue +200 -0
  141. package/templates/current/clean/src/features/appearance/composables/useTheme.ts +17 -0
  142. package/templates/current/clean/src/features/appearance/store/theme.ts +140 -0
  143. package/templates/current/clean/src/features/auth/pages/Login.vue +159 -0
  144. package/templates/current/clean/src/features/auth/store/auth.spec.ts +131 -0
  145. package/templates/current/clean/src/features/auth/store/auth.ts +210 -0
  146. package/templates/current/clean/src/features/errors/pages/Forbidden.vue +26 -0
  147. package/templates/current/clean/src/features/errors/pages/NotFound.vue +26 -0
  148. package/templates/current/clean/src/features/errors/pages/ServerError.vue +26 -0
  149. package/templates/current/clean/src/features/errors/pages/error-pages.spec.ts +32 -0
  150. package/templates/current/clean/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
  151. package/templates/current/clean/src/features/security/devtoolsProtection.spec.ts +211 -0
  152. package/templates/current/clean/src/features/security/devtoolsProtection.ts +242 -0
  153. package/templates/current/clean/src/features/shell/components/AdminWatermark.spec.ts +90 -0
  154. package/templates/current/clean/src/features/shell/components/AdminWatermark.vue +47 -0
  155. package/templates/current/clean/src/features/shell/components/RouteProgress.vue +68 -0
  156. package/templates/current/clean/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
  157. package/templates/current/clean/src/features/shell/composables/useRouteProgress.ts +52 -0
  158. package/templates/current/clean/src/features/shell/store/sidebar.ts +55 -0
  159. package/templates/current/clean/src/features/system/access/api/admin-repository.ts +279 -0
  160. package/templates/current/clean/src/features/system/access/api/rbac.spec.ts +72 -0
  161. package/templates/current/clean/src/features/system/access/api/rbac.ts +272 -0
  162. package/templates/current/clean/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
  163. package/templates/current/clean/src/features/workspace/pages/Empty.vue +18 -0
  164. package/templates/current/clean/src/features/workspace/pages/Profile.vue +183 -0
  165. package/templates/current/clean/src/layouts/AdminLayout.vue +61 -0
  166. package/templates/current/clean/src/layouts/BreadcrumbBar.vue +27 -0
  167. package/templates/current/clean/src/layouts/SideMenu.vue +119 -0
  168. package/templates/current/clean/src/layouts/TopBar.vue +301 -0
  169. package/templates/current/clean/src/layouts/WorkspaceTabs.vue +44 -0
  170. package/templates/current/clean/src/layouts/topBarMenuSearch.spec.ts +31 -0
  171. package/templates/current/clean/src/layouts/topBarMenuSearch.ts +21 -0
  172. package/templates/current/clean/src/locales/en-US.ts +55 -0
  173. package/templates/current/clean/src/locales/index.ts +119 -0
  174. package/templates/current/clean/src/locales/messages.spec.ts +23 -0
  175. package/templates/current/clean/src/locales/zh-CN.ts +55 -0
  176. package/templates/current/clean/src/locales/zh-TW.ts +44 -0
  177. package/templates/current/clean/src/main.ts +91 -0
  178. package/templates/current/clean/src/router/bootstrap.ts +76 -0
  179. package/templates/current/clean/src/router/componentRegistry.ts +25 -0
  180. package/templates/current/clean/src/router/dynamicRoutes.spec.ts +47 -0
  181. package/templates/current/clean/src/router/dynamicRoutes.ts +162 -0
  182. package/templates/current/clean/src/router/guards.ts +5 -0
  183. package/templates/current/clean/src/router/queryEncryption.spec.ts +82 -0
  184. package/templates/current/clean/src/router/queryEncryption.ts +133 -0
  185. package/templates/current/clean/src/router/routeQuery.spec.ts +11 -0
  186. package/templates/current/clean/src/router/routeQuery.ts +3 -0
  187. package/templates/current/clean/src/router/runtimeErrorRecovery.spec.ts +161 -0
  188. package/templates/current/clean/src/router/runtimeErrorRecovery.ts +108 -0
  189. package/templates/current/clean/src/router/staticRoutes.ts +63 -0
  190. package/templates/current/clean/src/router/useRouteQueryDefaults.spec.ts +90 -0
  191. package/templates/current/clean/src/router/useRouteQueryDefaults.ts +51 -0
  192. package/templates/current/clean/src/router/useRouteQueryDefaults.types.ts +19 -0
  193. package/templates/current/clean/src/store/index.ts +3 -0
  194. package/templates/current/clean/src/styles/element/index.scss +33 -0
  195. package/templates/current/clean/src/styles/index.css +39 -0
  196. package/templates/current/clean/src/styles/layout.css +115 -0
  197. package/templates/current/clean/src/styles/shell.css +196 -0
  198. package/templates/current/clean/src/styles/source-package-style-compat.css +1 -0
  199. package/templates/current/clean/src/templates/og-form.ts +48 -0
  200. package/templates/current/clean/src/templates/og-table.ts +212 -0
  201. package/templates/current/clean/src/templates/router.ts +51 -0
  202. package/templates/current/clean/src/templates/templates.spec.ts +90 -0
  203. package/templates/current/clean/src/theme/index.ts +7 -0
  204. package/templates/current/clean/src/utils/__tests__/color-mix.spec.ts +39 -0
  205. package/templates/current/clean/src/utils/color-mix.ts +76 -0
  206. package/templates/current/clean/src/utils/permissions.ts +6 -0
  207. package/templates/current/clean/tsconfig.json +40 -0
  208. package/templates/current/clean/tsconfig.node.json +9 -0
  209. package/templates/current/clean/vite.build-policy.ts +405 -0
  210. package/templates/current/clean/vite.config.ts +37 -0
  211. package/templates/current/examples/.codebuddy/AGENTS.md +18 -0
  212. package/templates/current/examples/.codebuddy/rules/01-feature-architecture.md +12 -0
  213. package/templates/current/examples/.codebuddy/rules/02-vue-typescript.md +12 -0
  214. package/templates/current/examples/.codebuddy/rules/03-component-policy.md +30 -0
  215. package/templates/current/examples/.codebuddy/rules/04-api-auth-router.md +12 -0
  216. package/templates/current/examples/.codebuddy/rules/05-style.md +12 -0
  217. package/templates/current/examples/.codebuddy/rules/06-quality.md +12 -0
  218. package/templates/current/examples/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
  219. package/templates/current/examples/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
  220. package/templates/current/examples/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
  221. package/templates/current/examples/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
  222. package/templates/current/examples/.codebuddy/skills/use-og-form/SKILL.md +15 -0
  223. package/templates/current/examples/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
  224. package/templates/current/examples/.codebuddy/skills/use-og-http/SKILL.md +16 -0
  225. package/templates/current/examples/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
  226. package/templates/current/examples/.codebuddy/skills/use-og-search/SKILL.md +17 -0
  227. package/templates/current/examples/.codebuddy/skills/use-og-table/SKILL.md +19 -0
  228. package/templates/current/examples/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
  229. package/templates/current/examples/.codex/AGENTS.md +15 -0
  230. package/templates/current/examples/.codex/rules/01-feature-architecture.md +6 -0
  231. package/templates/current/examples/.codex/rules/02-vue-typescript.md +6 -0
  232. package/templates/current/examples/.codex/rules/03-component-policy.md +24 -0
  233. package/templates/current/examples/.codex/rules/04-api-auth-router.md +6 -0
  234. package/templates/current/examples/.codex/rules/05-style.md +6 -0
  235. package/templates/current/examples/.codex/rules/06-quality.md +6 -0
  236. package/templates/current/examples/.codex/skills/build-admin-feature/SKILL.md +14 -0
  237. package/templates/current/examples/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
  238. package/templates/current/examples/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
  239. package/templates/current/examples/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
  240. package/templates/current/examples/.codex/skills/use-og-dialog/SKILL.md +12 -0
  241. package/templates/current/examples/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
  242. package/templates/current/examples/.codex/skills/use-og-editor/SKILL.md +25 -0
  243. package/templates/current/examples/.codex/skills/use-og-form/SKILL.md +12 -0
  244. package/templates/current/examples/.codex/skills/use-og-form-table/SKILL.md +25 -0
  245. package/templates/current/examples/.codex/skills/use-og-http/SKILL.md +13 -0
  246. package/templates/current/examples/.codex/skills/use-og-http/agents/openai.yaml +4 -0
  247. package/templates/current/examples/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
  248. package/templates/current/examples/.codex/skills/use-og-search/SKILL.md +14 -0
  249. package/templates/current/examples/.codex/skills/use-og-table/SKILL.md +16 -0
  250. package/templates/current/examples/.codex/skills/use-og-upload/SKILL.md +25 -0
  251. package/templates/current/examples/.cursor/AGENTS.md +18 -0
  252. package/templates/current/examples/.cursor/rules/01-feature-architecture.mdc +12 -0
  253. package/templates/current/examples/.cursor/rules/02-vue-typescript.mdc +12 -0
  254. package/templates/current/examples/.cursor/rules/03-component-policy.mdc +30 -0
  255. package/templates/current/examples/.cursor/rules/04-api-auth-router.mdc +12 -0
  256. package/templates/current/examples/.cursor/rules/05-style.mdc +12 -0
  257. package/templates/current/examples/.cursor/rules/06-quality.mdc +12 -0
  258. package/templates/current/examples/.cursor/skills/build-admin-feature/SKILL.md +14 -0
  259. package/templates/current/examples/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
  260. package/templates/current/examples/.cursor/skills/use-og-dialog/SKILL.md +12 -0
  261. package/templates/current/examples/.cursor/skills/use-og-editor/SKILL.md +25 -0
  262. package/templates/current/examples/.cursor/skills/use-og-form/SKILL.md +12 -0
  263. package/templates/current/examples/.cursor/skills/use-og-form-table/SKILL.md +25 -0
  264. package/templates/current/examples/.cursor/skills/use-og-http/SKILL.md +13 -0
  265. package/templates/current/examples/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
  266. package/templates/current/examples/.cursor/skills/use-og-search/SKILL.md +14 -0
  267. package/templates/current/examples/.cursor/skills/use-og-table/SKILL.md +16 -0
  268. package/templates/current/examples/.cursor/skills/use-og-upload/SKILL.md +25 -0
  269. package/templates/current/examples/.env.example +7 -0
  270. package/templates/current/examples/.env.production.example +31 -0
  271. package/templates/current/examples/.qoder/AGENTS.md +15 -0
  272. package/templates/current/examples/.qoder/rules/01-feature-architecture.md +12 -0
  273. package/templates/current/examples/.qoder/rules/02-vue-typescript.md +12 -0
  274. package/templates/current/examples/.qoder/rules/03-component-policy.md +30 -0
  275. package/templates/current/examples/.qoder/rules/04-api-auth-router.md +12 -0
  276. package/templates/current/examples/.qoder/rules/05-style.md +12 -0
  277. package/templates/current/examples/.qoder/rules/06-quality.md +12 -0
  278. package/templates/current/examples/.qoder/skills/build-admin-feature/SKILL.md +14 -0
  279. package/templates/current/examples/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
  280. package/templates/current/examples/.qoder/skills/use-og-dialog/SKILL.md +12 -0
  281. package/templates/current/examples/.qoder/skills/use-og-editor/SKILL.md +25 -0
  282. package/templates/current/examples/.qoder/skills/use-og-form/SKILL.md +12 -0
  283. package/templates/current/examples/.qoder/skills/use-og-form-table/SKILL.md +25 -0
  284. package/templates/current/examples/.qoder/skills/use-og-http/SKILL.md +13 -0
  285. package/templates/current/examples/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
  286. package/templates/current/examples/.qoder/skills/use-og-search/SKILL.md +14 -0
  287. package/templates/current/examples/.qoder/skills/use-og-table/SKILL.md +16 -0
  288. package/templates/current/examples/.qoder/skills/use-og-upload/SKILL.md +25 -0
  289. package/templates/current/examples/AGENTS.md +16 -0
  290. package/templates/current/examples/README.md +116 -0
  291. package/templates/current/examples/component-catalog.json +765 -0
  292. package/templates/current/examples/e2e/admin-shell.spec.ts +150 -0
  293. package/templates/current/examples/e2e/demo-shell.spec.ts +328 -0
  294. package/templates/current/examples/evals/component-selection.json +29 -0
  295. package/templates/current/examples/gitignore +3 -0
  296. package/templates/current/examples/index.html +13 -0
  297. package/templates/current/examples/openapi.json +1623 -0
  298. package/templates/current/examples/package.json +65 -0
  299. package/templates/current/examples/playwright.config.ts +31 -0
  300. package/templates/current/examples/playwright.demo.config.ts +25 -0
  301. package/templates/current/examples/recipes/README.md +7 -0
  302. package/templates/current/examples/recipes/remote-crud-dialog-form.json +15 -0
  303. package/templates/current/examples/recipes/remote-crud-dialog-form.vue +66 -0
  304. package/templates/current/examples/scaffold.lock.json +12 -0
  305. package/templates/current/examples/scripts/check-admin-bundle.mjs +214 -0
  306. package/templates/current/examples/scripts/check-admin-scaffold.mjs +168 -0
  307. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
  308. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
  309. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
  310. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
  311. package/templates/current/examples/scripts/clean-overlay/src/main.ts +91 -0
  312. package/templates/current/examples/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
  313. package/templates/current/examples/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
  314. package/templates/current/examples/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
  315. package/templates/current/examples/scripts/demo-api.ts +797 -0
  316. package/templates/current/examples/scripts/generate-api.ts +27 -0
  317. package/templates/current/examples/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
  318. package/templates/current/examples/scripts/remove-examples.mjs +54 -0
  319. package/templates/current/examples/src/App.vue +67 -0
  320. package/templates/current/examples/src/api/client.spec.ts +66 -0
  321. package/templates/current/examples/src/api/client.ts +72 -0
  322. package/templates/current/examples/src/api/generated/data-contracts.ts +268 -0
  323. package/templates/current/examples/src/api/generated/http-client.ts +266 -0
  324. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
  325. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
  326. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
  327. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
  328. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
  329. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
  330. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
  331. package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +98 -0
  332. package/templates/current/examples/src/api/http-adapter.spec.ts +33 -0
  333. package/templates/current/examples/src/api/http-adapter.ts +83 -0
  334. package/templates/current/examples/src/api/index.ts +41 -0
  335. package/templates/current/examples/src/app/createAdminUi.spec.ts +110 -0
  336. package/templates/current/examples/src/app/createAdminUi.ts +78 -0
  337. package/templates/current/examples/src/app/menu.spec.ts +255 -0
  338. package/templates/current/examples/src/app/menu.ts +268 -0
  339. package/templates/current/examples/src/app/menuTypes.ts +17 -0
  340. package/templates/current/examples/src/app/origenUiLocale.spec.ts +14 -0
  341. package/templates/current/examples/src/app/origenUiLocale.ts +65 -0
  342. package/templates/current/examples/src/app/permission.ts +9 -0
  343. package/templates/current/examples/src/app/runtimeConfig.ts +77 -0
  344. package/templates/current/examples/src/demo-api.spec.ts +167 -0
  345. package/templates/current/examples/src/env.d.ts +14 -0
  346. package/templates/current/examples/src/features/appearance/components/ThemePanel.vue +200 -0
  347. package/templates/current/examples/src/features/appearance/composables/useTheme.ts +17 -0
  348. package/templates/current/examples/src/features/appearance/store/theme.ts +140 -0
  349. package/templates/current/examples/src/features/auth/pages/Login.vue +159 -0
  350. package/templates/current/examples/src/features/auth/store/auth.spec.ts +131 -0
  351. package/templates/current/examples/src/features/auth/store/auth.ts +210 -0
  352. package/templates/current/examples/src/features/errors/pages/Forbidden.vue +26 -0
  353. package/templates/current/examples/src/features/errors/pages/NotFound.vue +26 -0
  354. package/templates/current/examples/src/features/errors/pages/ServerError.vue +26 -0
  355. package/templates/current/examples/src/features/errors/pages/error-pages.spec.ts +32 -0
  356. package/templates/current/examples/src/features/feature-composables.spec.ts +208 -0
  357. package/templates/current/examples/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
  358. package/templates/current/examples/src/features/security/devtoolsProtection.spec.ts +211 -0
  359. package/templates/current/examples/src/features/security/devtoolsProtection.ts +242 -0
  360. package/templates/current/examples/src/features/shell/components/AdminWatermark.spec.ts +90 -0
  361. package/templates/current/examples/src/features/shell/components/AdminWatermark.vue +47 -0
  362. package/templates/current/examples/src/features/shell/components/RouteProgress.vue +68 -0
  363. package/templates/current/examples/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
  364. package/templates/current/examples/src/features/shell/composables/useRouteProgress.ts +52 -0
  365. package/templates/current/examples/src/features/shell/store/sidebar.ts +55 -0
  366. package/templates/current/examples/src/features/system/access/api/admin-repository.ts +279 -0
  367. package/templates/current/examples/src/features/system/access/api/rbac.spec.ts +72 -0
  368. package/templates/current/examples/src/features/system/access/api/rbac.ts +272 -0
  369. package/templates/current/examples/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
  370. package/templates/current/examples/src/features/system/audit/composables/useAuditManagement.ts +117 -0
  371. package/templates/current/examples/src/features/system/audit/pages/AuditList.vue +20 -0
  372. package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +189 -0
  373. package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +327 -0
  374. package/templates/current/examples/src/features/system/menus/pages/MenuList.vue +49 -0
  375. package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +112 -0
  376. package/templates/current/examples/src/features/system/roles/composables/useRoleManagement.ts +198 -0
  377. package/templates/current/examples/src/features/system/roles/pages/RoleList.vue +45 -0
  378. package/templates/current/examples/src/features/system/users/components/UserEditorForm.vue +101 -0
  379. package/templates/current/examples/src/features/system/users/composables/useUserManagement.ts +233 -0
  380. package/templates/current/examples/src/features/system/users/pages/UserList.vue +49 -0
  381. package/templates/current/examples/src/features/workspace/pages/Dashboard.spec.ts +32 -0
  382. package/templates/current/examples/src/features/workspace/pages/Dashboard.vue +297 -0
  383. package/templates/current/examples/src/features/workspace/pages/Empty.vue +18 -0
  384. package/templates/current/examples/src/features/workspace/pages/Profile.vue +183 -0
  385. package/templates/current/examples/src/layouts/AdminLayout.vue +61 -0
  386. package/templates/current/examples/src/layouts/BreadcrumbBar.vue +27 -0
  387. package/templates/current/examples/src/layouts/SideMenu.vue +119 -0
  388. package/templates/current/examples/src/layouts/TopBar.vue +301 -0
  389. package/templates/current/examples/src/layouts/WorkspaceTabs.vue +44 -0
  390. package/templates/current/examples/src/layouts/topBarMenuSearch.spec.ts +31 -0
  391. package/templates/current/examples/src/layouts/topBarMenuSearch.ts +21 -0
  392. package/templates/current/examples/src/locales/en-US.ts +55 -0
  393. package/templates/current/examples/src/locales/index.ts +119 -0
  394. package/templates/current/examples/src/locales/messages.spec.ts +23 -0
  395. package/templates/current/examples/src/locales/zh-CN.ts +55 -0
  396. package/templates/current/examples/src/locales/zh-TW.ts +44 -0
  397. package/templates/current/examples/src/main.ts +91 -0
  398. package/templates/current/examples/src/router/bootstrap.ts +76 -0
  399. package/templates/current/examples/src/router/componentRegistry.ts +83 -0
  400. package/templates/current/examples/src/router/dynamicRoutes.spec.ts +109 -0
  401. package/templates/current/examples/src/router/dynamicRoutes.ts +162 -0
  402. package/templates/current/examples/src/router/guards.ts +5 -0
  403. package/templates/current/examples/src/router/queryEncryption.spec.ts +82 -0
  404. package/templates/current/examples/src/router/queryEncryption.ts +133 -0
  405. package/templates/current/examples/src/router/routeQuery.spec.ts +11 -0
  406. package/templates/current/examples/src/router/routeQuery.ts +3 -0
  407. package/templates/current/examples/src/router/runtimeErrorRecovery.spec.ts +161 -0
  408. package/templates/current/examples/src/router/runtimeErrorRecovery.ts +108 -0
  409. package/templates/current/examples/src/router/staticRoutes.ts +63 -0
  410. package/templates/current/examples/src/router/useRouteQueryDefaults.spec.ts +90 -0
  411. package/templates/current/examples/src/router/useRouteQueryDefaults.ts +51 -0
  412. package/templates/current/examples/src/router/useRouteQueryDefaults.types.ts +19 -0
  413. package/templates/current/examples/src/store/index.ts +3 -0
  414. package/templates/current/examples/src/styles/element/index.scss +33 -0
  415. package/templates/current/examples/src/styles/index.css +39 -0
  416. package/templates/current/examples/src/styles/layout.css +115 -0
  417. package/templates/current/examples/src/styles/shell.css +196 -0
  418. package/templates/current/examples/src/styles/source-package-style-compat.css +1 -0
  419. package/templates/current/examples/src/templates/og-form.ts +48 -0
  420. package/templates/current/examples/src/templates/og-table.ts +212 -0
  421. package/templates/current/examples/src/templates/router.ts +51 -0
  422. package/templates/current/examples/src/templates/templates.spec.ts +90 -0
  423. package/templates/current/examples/src/theme/index.ts +7 -0
  424. package/templates/current/examples/src/utils/__tests__/color-mix.spec.ts +39 -0
  425. package/templates/current/examples/src/utils/color-mix.ts +76 -0
  426. package/templates/current/examples/src/utils/permissions.ts +6 -0
  427. package/templates/current/examples/tsconfig.json +40 -0
  428. package/templates/current/examples/tsconfig.node.json +9 -0
  429. package/templates/current/examples/vite.build-policy.ts +405 -0
  430. package/templates/current/examples/vite.config.ts +37 -0
@@ -0,0 +1,242 @@
1
+ import { readonly, type Ref, shallowRef } from 'vue'
2
+
3
+ const unlockStorageKey = 'og-admin-devtools-unlocked'
4
+ const unlockTimeout = 2_000
5
+
6
+ type ShortcutState = 'idle' | 'awaiting-m'
7
+
8
+ export interface DevtoolsDetector {
9
+ start: (callbacks: { onClose: () => void, onError?: () => void, onOpen: () => void }) => void
10
+ stop: () => void
11
+ }
12
+
13
+ export interface StorageLike {
14
+ getItem: (key: string) => string | null
15
+ setItem: (key: string, value: string) => void
16
+ }
17
+
18
+ export interface KeyboardEventTarget {
19
+ addEventListener: (
20
+ type: 'keydown' | 'keyup',
21
+ listener: EventListener,
22
+ options?: AddEventListenerOptions | boolean,
23
+ ) => void
24
+ removeEventListener: (
25
+ type: 'keydown' | 'keyup',
26
+ listener: EventListener,
27
+ options?: EventListenerOptions | boolean,
28
+ ) => void
29
+ }
30
+
31
+ export interface DevtoolsProtectionOptions {
32
+ detector?: DevtoolsDetector
33
+ enabled?: boolean
34
+ keyboardTarget?: KeyboardEventTarget
35
+ now?: () => number
36
+ storage?: StorageLike | null
37
+ }
38
+
39
+ export interface DevtoolsProtection {
40
+ readonly blocked: Readonly<Ref<boolean>>
41
+ readonly unlocked: Readonly<Ref<boolean>>
42
+ start: () => void
43
+ stop: () => void
44
+ }
45
+
46
+ function createViewportDetector(): DevtoolsDetector {
47
+ let timer: ReturnType<typeof setInterval> | undefined
48
+ let open = false
49
+ return {
50
+ start(callbacks) {
51
+ const detect = () => {
52
+ try {
53
+ // Browser DevTools docked to an edge leaves a stable outer/inner
54
+ // viewport gap. This is deliberately advisory; it never mutates
55
+ // console, clipboard, DOM, or browser shortcuts.
56
+ const next = Math.max(
57
+ window.outerWidth - window.innerWidth,
58
+ window.outerHeight - window.innerHeight,
59
+ ) > 160
60
+ if (next === open) return
61
+ open = next
62
+ if (next) callbacks.onOpen()
63
+ else callbacks.onClose()
64
+ } catch {
65
+ callbacks.onError?.()
66
+ }
67
+ }
68
+ detect()
69
+ timer = setInterval(detect, 1_000)
70
+ },
71
+ stop() {
72
+ if (timer) clearInterval(timer)
73
+ timer = undefined
74
+ open = false
75
+ },
76
+ }
77
+ }
78
+
79
+ const viewportDetector = createViewportDetector()
80
+
81
+ function isProtectionEnabled(): boolean {
82
+ if (!import.meta.env.PROD || import.meta.env.MODE === 'debug') return false
83
+ // The detector infers DevTools from viewport geometry, which is unreliable
84
+ // on touch-first browsers and can block the entire mobile application.
85
+ return !window.matchMedia?.('(pointer: coarse)').matches
86
+ }
87
+
88
+ function getSessionStorage(): StorageLike | null {
89
+ try {
90
+ return window.sessionStorage
91
+ } catch {
92
+ return null
93
+ }
94
+ }
95
+
96
+ function readUnlock(storage: StorageLike | null | undefined): boolean {
97
+ try {
98
+ return storage?.getItem(unlockStorageKey) === 'true'
99
+ } catch {
100
+ return false
101
+ }
102
+ }
103
+
104
+ function writeUnlock(storage: StorageLike | null | undefined): void {
105
+ try {
106
+ storage?.setItem(unlockStorageKey, 'true')
107
+ } catch {
108
+ // Storage can be unavailable in restrictive browser contexts. The in-memory state still unlocks this page.
109
+ }
110
+ }
111
+
112
+ export function createDevtoolsProtection(
113
+ options: DevtoolsProtectionOptions = {},
114
+ ): DevtoolsProtection {
115
+ const blocked = shallowRef(false)
116
+ const unlocked = shallowRef(false)
117
+ const enabled = options.enabled ?? isProtectionEnabled()
118
+ const detector = options.detector ?? viewportDetector
119
+ const keyboardTarget =
120
+ options.keyboardTarget ?? (typeof window === 'undefined' ? undefined : window)
121
+ const storage =
122
+ 'storage' in options
123
+ ? options.storage
124
+ : typeof window === 'undefined'
125
+ ? null
126
+ : getSessionStorage()
127
+ const now = options.now ?? Date.now
128
+
129
+ let started = false
130
+ let detectorStarted = false
131
+ let shortcutState: ShortcutState = 'idle'
132
+ let firstKeyAt = 0
133
+
134
+ const resetShortcut = () => {
135
+ shortcutState = 'idle'
136
+ firstKeyAt = 0
137
+ }
138
+
139
+ const suspendDetector = () => {
140
+ if (!detectorStarted) return
141
+
142
+ detector.stop()
143
+ detectorStarted = false
144
+ }
145
+
146
+ const removeKeyboardListener = () => {
147
+ // eslint-disable-next-line ts/no-use-before-define
148
+ keyboardTarget?.removeEventListener('keydown', onKeydown, true)
149
+ // eslint-disable-next-line ts/no-use-before-define
150
+ keyboardTarget?.removeEventListener('keyup', onKeyup, true)
151
+ }
152
+
153
+ const unlock = () => {
154
+ if (unlocked.value) return
155
+
156
+ unlocked.value = true
157
+ blocked.value = false
158
+ writeUnlock(storage)
159
+ resetShortcut()
160
+ removeKeyboardListener()
161
+ suspendDetector()
162
+ }
163
+
164
+ const onKeydown = (event: Event) => {
165
+ const keyboardEvent = event as KeyboardEvent
166
+ if (keyboardEvent.isComposing || keyboardEvent.repeat) {
167
+ resetShortcut()
168
+ return
169
+ }
170
+
171
+ if (keyboardEvent.key === 'Shift') return
172
+
173
+ if (!keyboardEvent.shiftKey) {
174
+ resetShortcut()
175
+ return
176
+ }
177
+
178
+ const key = keyboardEvent.key.toUpperCase()
179
+ if (shortcutState === 'idle' && key === 'K') {
180
+ shortcutState = 'awaiting-m'
181
+ firstKeyAt = now()
182
+ return
183
+ }
184
+
185
+ if (shortcutState === 'awaiting-m' && key === 'M' && now() - firstKeyAt <= unlockTimeout) {
186
+ unlock()
187
+ return
188
+ }
189
+
190
+ resetShortcut()
191
+ }
192
+
193
+ const onKeyup = (event: Event) => {
194
+ if ((event as KeyboardEvent).key === 'Shift') resetShortcut()
195
+ }
196
+
197
+ const start = () => {
198
+ if (started) return
199
+
200
+ started = true
201
+ if (!enabled) return
202
+
203
+ if (readUnlock(storage)) {
204
+ unlocked.value = true
205
+ return
206
+ }
207
+
208
+ keyboardTarget?.addEventListener('keydown', onKeydown, true)
209
+ keyboardTarget?.addEventListener('keyup', onKeyup, true)
210
+ detector.start({
211
+ onClose: () => {
212
+ blocked.value = false
213
+ },
214
+ onError: () => {
215
+ blocked.value = true
216
+ },
217
+ onOpen: () => {
218
+ if (!unlocked.value) blocked.value = true
219
+ },
220
+ })
221
+ detectorStarted = true
222
+ }
223
+
224
+ const stop = () => {
225
+ if (!started) return
226
+
227
+ started = false
228
+ blocked.value = false
229
+ resetShortcut()
230
+ removeKeyboardListener()
231
+ suspendDetector()
232
+ }
233
+
234
+ return {
235
+ blocked: readonly(blocked),
236
+ start,
237
+ stop,
238
+ unlocked: readonly(unlocked),
239
+ }
240
+ }
241
+
242
+ export const devtoolsProtection = createDevtoolsProtection()
@@ -0,0 +1,90 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import { createPinia, setActivePinia } from 'pinia'
3
+ import { beforeEach, describe, expect, it } from 'vitest'
4
+ import { nextTick } from 'vue'
5
+ import { useThemeStore } from '../../appearance/store/theme'
6
+ import { useAuthStore } from '../../auth/store/auth'
7
+ import AdminWatermark from './AdminWatermark.vue'
8
+
9
+ const WatermarkStub = {
10
+ props: ['content', 'font', 'rotate', 'gap'],
11
+ template: '<div class="watermark-stub"><slot /></div>',
12
+ }
13
+
14
+ describe('adminWatermark', () => {
15
+ beforeEach(() => {
16
+ window.matchMedia = (() => ({
17
+ matches: false,
18
+ media: '',
19
+ onchange: null,
20
+ addListener: () => {},
21
+ removeListener: () => {},
22
+ addEventListener: () => {},
23
+ removeEventListener: () => {},
24
+ dispatchEvent: () => false,
25
+ })) as typeof window.matchMedia
26
+ setActivePinia(createPinia())
27
+ })
28
+
29
+ function mountWatermark() {
30
+ return mount(AdminWatermark, {
31
+ global: {
32
+ stubs: { ElWatermark: WatermarkStub },
33
+ },
34
+ })
35
+ }
36
+
37
+ it('renders the display name and username as watermark lines', () => {
38
+ const auth = useAuthStore()
39
+ auth.session = {
40
+ token: 'token',
41
+ user: { id: '1', username: 'alice', displayName: 'Alice' },
42
+ permissions: [],
43
+ roleIds: [],
44
+ authorizationRevision: 0,
45
+ }
46
+
47
+ const wrapper = mountWatermark()
48
+ const watermark = wrapper.findComponent(WatermarkStub)
49
+
50
+ expect(watermark.props('content')).toEqual(['Alice', 'alice'])
51
+ expect(watermark.props('rotate')).toBe(-22)
52
+ expect(watermark.props('gap')).toEqual([120, 100])
53
+ expect(wrapper.classes()).toContain('admin-watermark')
54
+ })
55
+
56
+ it('deduplicates identical display names and usernames', () => {
57
+ const auth = useAuthStore()
58
+ auth.session = {
59
+ token: 'token',
60
+ user: { id: '1', username: 'alice', displayName: ' alice ' },
61
+ permissions: [],
62
+ roleIds: [],
63
+ authorizationRevision: 0,
64
+ }
65
+
66
+ expect(mountWatermark().findComponent(WatermarkStub).props('content')).toEqual(['alice'])
67
+ })
68
+
69
+ it('passes empty content without a default Element Plus label when unauthenticated', () => {
70
+ const watermark = mountWatermark().findComponent(WatermarkStub)
71
+
72
+ expect(watermark.props('content')).toEqual([])
73
+ expect(JSON.stringify(watermark.props('content'))).not.toContain('Element Plus')
74
+ })
75
+
76
+ it('uses a low-opacity color for the active light or dark theme', async () => {
77
+ const theme = useThemeStore()
78
+ const wrapper = mountWatermark()
79
+ const watermark = wrapper.findComponent(WatermarkStub)
80
+
81
+ expect(watermark.props('font')).toMatchObject({ color: 'rgba(15, 23, 42, 0.10)', fontSize: 14 })
82
+
83
+ theme.setMode('dark')
84
+ await nextTick()
85
+ expect(watermark.props('font')).toMatchObject({
86
+ color: 'rgba(255, 255, 255, 0.12)',
87
+ fontSize: 14,
88
+ })
89
+ })
90
+ })
@@ -0,0 +1,47 @@
1
+ <script setup lang="ts">
2
+ import { ElWatermark } from 'element-plus'
3
+ import { computed } from 'vue'
4
+ import { useThemeStore } from '../../appearance/store/theme'
5
+ import { useAuthStore } from '../../auth/store/auth'
6
+
7
+ defineOptions({ name: 'AdminWatermark' })
8
+
9
+ const auth = useAuthStore()
10
+ const theme = useThemeStore()
11
+
12
+ const watermarkContent = computed<string[]>(() => {
13
+ const user = auth.session?.user
14
+ if (!user) return []
15
+
16
+ return Array.from(
17
+ new Set(
18
+ [user.displayName, user.username]
19
+ .map((value) => value?.trim())
20
+ .filter((value): value is string => Boolean(value)),
21
+ ),
22
+ )
23
+ })
24
+
25
+ const watermarkFont = computed(() => ({
26
+ color: theme.resolved === 'dark' ? 'rgba(255, 255, 255, 0.12)' : 'rgba(15, 23, 42, 0.10)',
27
+ fontSize: 14,
28
+ }))
29
+ </script>
30
+
31
+ <template>
32
+ <ElWatermark
33
+ class="admin-watermark"
34
+ :content="watermarkContent"
35
+ :font="watermarkFont"
36
+ :rotate="-22"
37
+ :gap="[120, 100]"
38
+ >
39
+ <slot />
40
+ </ElWatermark>
41
+ </template>
42
+
43
+ <style scoped>
44
+ .admin-watermark {
45
+ min-height: 100vh;
46
+ }
47
+ </style>
@@ -0,0 +1,68 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { getRouting } from '../../../router/bootstrap'
4
+ import { useRouteProgress } from '../composables/useRouteProgress'
5
+
6
+ defineOptions({ name: 'RouteProgress' })
7
+
8
+ const navigation = computed(() => getRouting().state.value.navigation)
9
+ const { visible, percentage, indeterminate } = useRouteProgress(navigation)
10
+ </script>
11
+
12
+ <template>
13
+ <div v-show="visible" class="route-progress" aria-hidden="true">
14
+ <span
15
+ class="route-progress__bar"
16
+ :class="{ 'is-indeterminate': indeterminate }"
17
+ :style="{ width: `${percentage}%` }"
18
+ />
19
+ </div>
20
+ </template>
21
+
22
+ <style scoped>
23
+ .route-progress {
24
+ position: fixed;
25
+ z-index: calc(var(--el-index-top) + 1);
26
+ top: 0;
27
+ right: 0;
28
+ left: 0;
29
+ height: 3px;
30
+ overflow: hidden;
31
+ background: transparent;
32
+ pointer-events: none;
33
+ }
34
+
35
+ .route-progress__bar {
36
+ display: block;
37
+ height: 100%;
38
+ background: var(--el-color-primary);
39
+ transform-origin: left center;
40
+ transition: width 0.2s ease-out;
41
+ }
42
+
43
+ .route-progress__bar.is-indeterminate {
44
+ animation: route-progress-indeterminate 1.4s ease-in-out infinite;
45
+ }
46
+
47
+ @keyframes route-progress-indeterminate {
48
+ 0% {
49
+ transform: translateX(-100%) scaleX(0.35);
50
+ }
51
+ 50% {
52
+ transform: translateX(45%) scaleX(0.7);
53
+ }
54
+ 100% {
55
+ transform: translateX(145%) scaleX(0.35);
56
+ }
57
+ }
58
+
59
+ @media (prefers-reduced-motion: reduce) {
60
+ .route-progress__bar {
61
+ transition: none;
62
+ }
63
+
64
+ .route-progress__bar.is-indeterminate {
65
+ animation: none;
66
+ }
67
+ }
68
+ </style>
@@ -0,0 +1,95 @@
1
+ import type { RouterAdapterState } from '@origen-ui/router'
2
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
3
+ import { effectScope, shallowRef } from 'vue'
4
+ import { useRouteProgress } from './useRouteProgress'
5
+
6
+ function setupRouteProgress() {
7
+ const navigation = shallowRef<RouterAdapterState['navigation']>('idle')
8
+ const scope = effectScope()
9
+ const progress = scope.run(() => useRouteProgress(navigation))
10
+
11
+ if (!progress) throw new Error('Failed to create route progress state')
12
+
13
+ return { navigation, progress, scope }
14
+ }
15
+
16
+ describe('useRouteProgress', () => {
17
+ beforeEach(() => {
18
+ vi.useFakeTimers()
19
+ })
20
+
21
+ afterEach(() => {
22
+ vi.clearAllTimers()
23
+ vi.useRealTimers()
24
+ })
25
+
26
+ it('starts hidden while navigation is idle', () => {
27
+ const { progress, scope } = setupRouteProgress()
28
+
29
+ expect(progress.visible.value).toBe(false)
30
+ expect(progress.percentage.value).toBe(0)
31
+ expect(progress.indeterminate.value).toBe(false)
32
+
33
+ scope.stop()
34
+ })
35
+
36
+ it('shows indeterminate progress when navigation starts', () => {
37
+ const { navigation, progress, scope } = setupRouteProgress()
38
+
39
+ navigation.value = 'navigating'
40
+
41
+ expect(progress.visible.value).toBe(true)
42
+ expect(progress.percentage.value).toBe(70)
43
+ expect(progress.indeterminate.value).toBe(true)
44
+
45
+ scope.stop()
46
+ })
47
+
48
+ it('finishes at 100 percent before hiding and resetting', () => {
49
+ const { navigation, progress, scope } = setupRouteProgress()
50
+
51
+ navigation.value = 'navigating'
52
+ navigation.value = 'idle'
53
+
54
+ expect(progress.visible.value).toBe(true)
55
+ expect(progress.percentage.value).toBe(100)
56
+ expect(progress.indeterminate.value).toBe(false)
57
+
58
+ vi.advanceTimersByTime(199)
59
+ expect(progress.visible.value).toBe(true)
60
+
61
+ vi.advanceTimersByTime(1)
62
+ expect(progress.visible.value).toBe(false)
63
+ expect(progress.percentage.value).toBe(0)
64
+
65
+ scope.stop()
66
+ })
67
+
68
+ it('cancels a pending hide when another navigation starts', () => {
69
+ const { navigation, progress, scope } = setupRouteProgress()
70
+
71
+ navigation.value = 'navigating'
72
+ navigation.value = 'idle'
73
+ vi.advanceTimersByTime(100)
74
+ navigation.value = 'navigating'
75
+ vi.advanceTimersByTime(200)
76
+
77
+ expect(progress.visible.value).toBe(true)
78
+ expect(progress.percentage.value).toBe(70)
79
+ expect(progress.indeterminate.value).toBe(true)
80
+
81
+ scope.stop()
82
+ })
83
+
84
+ it('clears the pending hide timer when its scope is disposed', () => {
85
+ const { navigation, scope } = setupRouteProgress()
86
+
87
+ navigation.value = 'navigating'
88
+ navigation.value = 'idle'
89
+ expect(vi.getTimerCount()).toBe(1)
90
+
91
+ scope.stop()
92
+
93
+ expect(vi.getTimerCount()).toBe(0)
94
+ })
95
+ })
@@ -0,0 +1,52 @@
1
+ import type { RouterAdapterState } from '@origen-ui/router'
2
+ import type { Ref } from 'vue'
3
+ import { onScopeDispose, readonly, shallowRef, watch } from 'vue'
4
+
5
+ const ACTIVE_PERCENTAGE = 70
6
+ const FINISH_DELAY_MS = 200
7
+
8
+ export function useRouteProgress(navigation: Readonly<Ref<RouterAdapterState['navigation']>>) {
9
+ const visible = shallowRef(false)
10
+ const percentage = shallowRef(0)
11
+ const indeterminate = shallowRef(false)
12
+ let hideTimer: ReturnType<typeof setTimeout> | undefined
13
+
14
+ function clearHideTimer(): void {
15
+ if (hideTimer === undefined) return
16
+ clearTimeout(hideTimer)
17
+ hideTimer = undefined
18
+ }
19
+
20
+ watch(
21
+ navigation,
22
+ (state) => {
23
+ clearHideTimer()
24
+
25
+ if (state === 'navigating') {
26
+ visible.value = true
27
+ percentage.value = ACTIVE_PERCENTAGE
28
+ indeterminate.value = true
29
+ return
30
+ }
31
+
32
+ if (!visible.value) return
33
+
34
+ percentage.value = 100
35
+ indeterminate.value = false
36
+ hideTimer = setTimeout(() => {
37
+ visible.value = false
38
+ percentage.value = 0
39
+ hideTimer = undefined
40
+ }, FINISH_DELAY_MS)
41
+ },
42
+ { immediate: true, flush: 'sync' },
43
+ )
44
+
45
+ onScopeDispose(clearHideTimer)
46
+
47
+ return {
48
+ visible: readonly(visible),
49
+ percentage: readonly(percentage),
50
+ indeterminate: readonly(indeterminate),
51
+ }
52
+ }
@@ -0,0 +1,55 @@
1
+ import { defineStore } from 'pinia'
2
+ import { shallowRef } from 'vue'
3
+
4
+ const STORAGE_KEY = 'og-admin-sidebar-collapsed'
5
+
6
+ function readPersisted(): boolean {
7
+ if (typeof window === 'undefined') return false
8
+ try {
9
+ return window.localStorage.getItem(STORAGE_KEY) === '1'
10
+ } catch {
11
+ return false
12
+ }
13
+ }
14
+
15
+ export const useSidebarStore = defineStore('admin-sidebar', () => {
16
+ const collapsed = shallowRef(readPersisted())
17
+ const mobileOpen = shallowRef(false)
18
+
19
+ function isMobileViewport(): boolean {
20
+ return typeof window !== 'undefined' && window.matchMedia('(max-width: 860px)').matches
21
+ }
22
+
23
+ function toggle(): void {
24
+ collapsed.value = !collapsed.value
25
+ persist()
26
+ }
27
+
28
+ function setCollapsed(value: boolean): void {
29
+ collapsed.value = value
30
+ persist()
31
+ }
32
+
33
+ function toggleNavigation(): void {
34
+ if (isMobileViewport()) {
35
+ mobileOpen.value = !mobileOpen.value
36
+ return
37
+ }
38
+ toggle()
39
+ }
40
+
41
+ function closeMobile(): void {
42
+ mobileOpen.value = false
43
+ }
44
+
45
+ function persist(): void {
46
+ if (typeof window === 'undefined') return
47
+ try {
48
+ window.localStorage.setItem(STORAGE_KEY, collapsed.value ? '1' : '0')
49
+ } catch {
50
+ // ignore quota / privacy errors
51
+ }
52
+ }
53
+
54
+ return { collapsed, mobileOpen, toggle, toggleNavigation, closeMobile, setCollapsed }
55
+ })