@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.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/bin/og-admin.mjs +131 -0
- package/package.json +28 -0
- package/templates/current/clean/.codebuddy/AGENTS.md +18 -0
- package/templates/current/clean/.codebuddy/rules/01-feature-architecture.md +12 -0
- package/templates/current/clean/.codebuddy/rules/02-vue-typescript.md +12 -0
- package/templates/current/clean/.codebuddy/rules/03-component-policy.md +30 -0
- package/templates/current/clean/.codebuddy/rules/04-api-auth-router.md +12 -0
- package/templates/current/clean/.codebuddy/rules/05-style.md +12 -0
- package/templates/current/clean/.codebuddy/rules/06-quality.md +12 -0
- package/templates/current/clean/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
- package/templates/current/clean/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
- package/templates/current/clean/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
- package/templates/current/clean/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
- package/templates/current/clean/.codebuddy/skills/use-og-form/SKILL.md +15 -0
- package/templates/current/clean/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
- package/templates/current/clean/.codebuddy/skills/use-og-http/SKILL.md +16 -0
- package/templates/current/clean/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
- package/templates/current/clean/.codebuddy/skills/use-og-search/SKILL.md +17 -0
- package/templates/current/clean/.codebuddy/skills/use-og-table/SKILL.md +19 -0
- package/templates/current/clean/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
- package/templates/current/clean/.codex/AGENTS.md +15 -0
- package/templates/current/clean/.codex/rules/01-feature-architecture.md +6 -0
- package/templates/current/clean/.codex/rules/02-vue-typescript.md +6 -0
- package/templates/current/clean/.codex/rules/03-component-policy.md +24 -0
- package/templates/current/clean/.codex/rules/04-api-auth-router.md +6 -0
- package/templates/current/clean/.codex/rules/05-style.md +6 -0
- package/templates/current/clean/.codex/rules/06-quality.md +6 -0
- package/templates/current/clean/.codex/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/clean/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
- package/templates/current/clean/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/clean/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
- package/templates/current/clean/.codex/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/clean/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
- package/templates/current/clean/.codex/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/clean/.codex/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/clean/.codex/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/clean/.codex/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/clean/.codex/skills/use-og-http/agents/openai.yaml +4 -0
- package/templates/current/clean/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/clean/.codex/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/clean/.codex/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/clean/.codex/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/clean/.cursor/AGENTS.md +18 -0
- package/templates/current/clean/.cursor/rules/01-feature-architecture.mdc +12 -0
- package/templates/current/clean/.cursor/rules/02-vue-typescript.mdc +12 -0
- package/templates/current/clean/.cursor/rules/03-component-policy.mdc +30 -0
- package/templates/current/clean/.cursor/rules/04-api-auth-router.mdc +12 -0
- package/templates/current/clean/.cursor/rules/05-style.mdc +12 -0
- package/templates/current/clean/.cursor/rules/06-quality.mdc +12 -0
- package/templates/current/clean/.cursor/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/clean/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/clean/.cursor/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/clean/.cursor/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/clean/.cursor/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/clean/.cursor/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/clean/.cursor/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/clean/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/clean/.cursor/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/clean/.cursor/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/clean/.cursor/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/clean/.env.example +7 -0
- package/templates/current/clean/.env.production.example +31 -0
- package/templates/current/clean/.qoder/AGENTS.md +15 -0
- package/templates/current/clean/.qoder/rules/01-feature-architecture.md +12 -0
- package/templates/current/clean/.qoder/rules/02-vue-typescript.md +12 -0
- package/templates/current/clean/.qoder/rules/03-component-policy.md +30 -0
- package/templates/current/clean/.qoder/rules/04-api-auth-router.md +12 -0
- package/templates/current/clean/.qoder/rules/05-style.md +12 -0
- package/templates/current/clean/.qoder/rules/06-quality.md +12 -0
- package/templates/current/clean/.qoder/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/clean/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/clean/.qoder/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/clean/.qoder/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/clean/.qoder/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/clean/.qoder/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/clean/.qoder/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/clean/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/clean/.qoder/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/clean/.qoder/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/clean/.qoder/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/clean/AGENTS.md +16 -0
- package/templates/current/clean/README.md +116 -0
- package/templates/current/clean/component-catalog.json +765 -0
- package/templates/current/clean/e2e/admin-shell.spec.ts +150 -0
- package/templates/current/clean/e2e/demo-shell.spec.ts +328 -0
- package/templates/current/clean/evals/component-selection.json +29 -0
- package/templates/current/clean/gitignore +3 -0
- package/templates/current/clean/index.html +13 -0
- package/templates/current/clean/openapi.json +1623 -0
- package/templates/current/clean/package.json +65 -0
- package/templates/current/clean/playwright.config.ts +31 -0
- package/templates/current/clean/playwright.demo.config.ts +25 -0
- package/templates/current/clean/recipes/README.md +7 -0
- package/templates/current/clean/recipes/remote-crud-dialog-form.json +15 -0
- package/templates/current/clean/recipes/remote-crud-dialog-form.vue +66 -0
- package/templates/current/clean/scaffold.lock.json +12 -0
- package/templates/current/clean/scripts/check-admin-bundle.mjs +214 -0
- package/templates/current/clean/scripts/check-admin-scaffold.mjs +168 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/clean/scripts/clean-overlay/src/main.ts +91 -0
- package/templates/current/clean/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
- package/templates/current/clean/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
- package/templates/current/clean/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
- package/templates/current/clean/scripts/demo-api.ts +797 -0
- package/templates/current/clean/scripts/generate-api.ts +27 -0
- package/templates/current/clean/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
- package/templates/current/clean/scripts/remove-examples.mjs +54 -0
- package/templates/current/clean/src/App.vue +67 -0
- package/templates/current/clean/src/api/client.spec.ts +66 -0
- package/templates/current/clean/src/api/client.ts +72 -0
- package/templates/current/clean/src/api/generated/data-contracts.ts +268 -0
- package/templates/current/clean/src/api/generated/http-client.ts +266 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +98 -0
- package/templates/current/clean/src/api/http-adapter.spec.ts +33 -0
- package/templates/current/clean/src/api/http-adapter.ts +83 -0
- package/templates/current/clean/src/api/index.ts +41 -0
- package/templates/current/clean/src/app/createAdminUi.spec.ts +110 -0
- package/templates/current/clean/src/app/createAdminUi.ts +78 -0
- package/templates/current/clean/src/app/menu.spec.ts +255 -0
- package/templates/current/clean/src/app/menu.ts +268 -0
- package/templates/current/clean/src/app/menuTypes.ts +17 -0
- package/templates/current/clean/src/app/origenUiLocale.spec.ts +14 -0
- package/templates/current/clean/src/app/origenUiLocale.ts +65 -0
- package/templates/current/clean/src/app/permission.ts +9 -0
- package/templates/current/clean/src/app/runtimeConfig.ts +77 -0
- package/templates/current/clean/src/demo-api.spec.ts +167 -0
- package/templates/current/clean/src/env.d.ts +14 -0
- package/templates/current/clean/src/features/appearance/components/ThemePanel.vue +200 -0
- package/templates/current/clean/src/features/appearance/composables/useTheme.ts +17 -0
- package/templates/current/clean/src/features/appearance/store/theme.ts +140 -0
- package/templates/current/clean/src/features/auth/pages/Login.vue +159 -0
- package/templates/current/clean/src/features/auth/store/auth.spec.ts +131 -0
- package/templates/current/clean/src/features/auth/store/auth.ts +210 -0
- package/templates/current/clean/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/clean/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/clean/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/clean/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/clean/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
- package/templates/current/clean/src/features/security/devtoolsProtection.spec.ts +211 -0
- package/templates/current/clean/src/features/security/devtoolsProtection.ts +242 -0
- package/templates/current/clean/src/features/shell/components/AdminWatermark.spec.ts +90 -0
- package/templates/current/clean/src/features/shell/components/AdminWatermark.vue +47 -0
- package/templates/current/clean/src/features/shell/components/RouteProgress.vue +68 -0
- package/templates/current/clean/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
- package/templates/current/clean/src/features/shell/composables/useRouteProgress.ts +52 -0
- package/templates/current/clean/src/features/shell/store/sidebar.ts +55 -0
- package/templates/current/clean/src/features/system/access/api/admin-repository.ts +279 -0
- package/templates/current/clean/src/features/system/access/api/rbac.spec.ts +72 -0
- package/templates/current/clean/src/features/system/access/api/rbac.ts +272 -0
- package/templates/current/clean/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
- package/templates/current/clean/src/features/workspace/pages/Empty.vue +18 -0
- package/templates/current/clean/src/features/workspace/pages/Profile.vue +183 -0
- package/templates/current/clean/src/layouts/AdminLayout.vue +61 -0
- package/templates/current/clean/src/layouts/BreadcrumbBar.vue +27 -0
- package/templates/current/clean/src/layouts/SideMenu.vue +119 -0
- package/templates/current/clean/src/layouts/TopBar.vue +301 -0
- package/templates/current/clean/src/layouts/WorkspaceTabs.vue +44 -0
- package/templates/current/clean/src/layouts/topBarMenuSearch.spec.ts +31 -0
- package/templates/current/clean/src/layouts/topBarMenuSearch.ts +21 -0
- package/templates/current/clean/src/locales/en-US.ts +55 -0
- package/templates/current/clean/src/locales/index.ts +119 -0
- package/templates/current/clean/src/locales/messages.spec.ts +23 -0
- package/templates/current/clean/src/locales/zh-CN.ts +55 -0
- package/templates/current/clean/src/locales/zh-TW.ts +44 -0
- package/templates/current/clean/src/main.ts +91 -0
- package/templates/current/clean/src/router/bootstrap.ts +76 -0
- package/templates/current/clean/src/router/componentRegistry.ts +25 -0
- package/templates/current/clean/src/router/dynamicRoutes.spec.ts +47 -0
- package/templates/current/clean/src/router/dynamicRoutes.ts +162 -0
- package/templates/current/clean/src/router/guards.ts +5 -0
- package/templates/current/clean/src/router/queryEncryption.spec.ts +82 -0
- package/templates/current/clean/src/router/queryEncryption.ts +133 -0
- package/templates/current/clean/src/router/routeQuery.spec.ts +11 -0
- package/templates/current/clean/src/router/routeQuery.ts +3 -0
- package/templates/current/clean/src/router/runtimeErrorRecovery.spec.ts +161 -0
- package/templates/current/clean/src/router/runtimeErrorRecovery.ts +108 -0
- package/templates/current/clean/src/router/staticRoutes.ts +63 -0
- package/templates/current/clean/src/router/useRouteQueryDefaults.spec.ts +90 -0
- package/templates/current/clean/src/router/useRouteQueryDefaults.ts +51 -0
- package/templates/current/clean/src/router/useRouteQueryDefaults.types.ts +19 -0
- package/templates/current/clean/src/store/index.ts +3 -0
- package/templates/current/clean/src/styles/element/index.scss +33 -0
- package/templates/current/clean/src/styles/index.css +39 -0
- package/templates/current/clean/src/styles/layout.css +115 -0
- package/templates/current/clean/src/styles/shell.css +196 -0
- package/templates/current/clean/src/styles/source-package-style-compat.css +1 -0
- package/templates/current/clean/src/templates/og-form.ts +48 -0
- package/templates/current/clean/src/templates/og-table.ts +212 -0
- package/templates/current/clean/src/templates/router.ts +51 -0
- package/templates/current/clean/src/templates/templates.spec.ts +90 -0
- package/templates/current/clean/src/theme/index.ts +7 -0
- package/templates/current/clean/src/utils/__tests__/color-mix.spec.ts +39 -0
- package/templates/current/clean/src/utils/color-mix.ts +76 -0
- package/templates/current/clean/src/utils/permissions.ts +6 -0
- package/templates/current/clean/tsconfig.json +40 -0
- package/templates/current/clean/tsconfig.node.json +9 -0
- package/templates/current/clean/vite.build-policy.ts +405 -0
- package/templates/current/clean/vite.config.ts +37 -0
- package/templates/current/examples/.codebuddy/AGENTS.md +18 -0
- package/templates/current/examples/.codebuddy/rules/01-feature-architecture.md +12 -0
- package/templates/current/examples/.codebuddy/rules/02-vue-typescript.md +12 -0
- package/templates/current/examples/.codebuddy/rules/03-component-policy.md +30 -0
- package/templates/current/examples/.codebuddy/rules/04-api-auth-router.md +12 -0
- package/templates/current/examples/.codebuddy/rules/05-style.md +12 -0
- package/templates/current/examples/.codebuddy/rules/06-quality.md +12 -0
- package/templates/current/examples/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
- package/templates/current/examples/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
- package/templates/current/examples/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
- package/templates/current/examples/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
- package/templates/current/examples/.codebuddy/skills/use-og-form/SKILL.md +15 -0
- package/templates/current/examples/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
- package/templates/current/examples/.codebuddy/skills/use-og-http/SKILL.md +16 -0
- package/templates/current/examples/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
- package/templates/current/examples/.codebuddy/skills/use-og-search/SKILL.md +17 -0
- package/templates/current/examples/.codebuddy/skills/use-og-table/SKILL.md +19 -0
- package/templates/current/examples/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
- package/templates/current/examples/.codex/AGENTS.md +15 -0
- package/templates/current/examples/.codex/rules/01-feature-architecture.md +6 -0
- package/templates/current/examples/.codex/rules/02-vue-typescript.md +6 -0
- package/templates/current/examples/.codex/rules/03-component-policy.md +24 -0
- package/templates/current/examples/.codex/rules/04-api-auth-router.md +6 -0
- package/templates/current/examples/.codex/rules/05-style.md +6 -0
- package/templates/current/examples/.codex/rules/06-quality.md +6 -0
- package/templates/current/examples/.codex/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/examples/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
- package/templates/current/examples/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/examples/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
- package/templates/current/examples/.codex/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/examples/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
- package/templates/current/examples/.codex/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/examples/.codex/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/examples/.codex/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/examples/.codex/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/examples/.codex/skills/use-og-http/agents/openai.yaml +4 -0
- package/templates/current/examples/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/examples/.codex/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/examples/.codex/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/examples/.codex/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/examples/.cursor/AGENTS.md +18 -0
- package/templates/current/examples/.cursor/rules/01-feature-architecture.mdc +12 -0
- package/templates/current/examples/.cursor/rules/02-vue-typescript.mdc +12 -0
- package/templates/current/examples/.cursor/rules/03-component-policy.mdc +30 -0
- package/templates/current/examples/.cursor/rules/04-api-auth-router.mdc +12 -0
- package/templates/current/examples/.cursor/rules/05-style.mdc +12 -0
- package/templates/current/examples/.cursor/rules/06-quality.mdc +12 -0
- package/templates/current/examples/.cursor/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/examples/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/examples/.cursor/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/examples/.cursor/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/examples/.cursor/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/examples/.cursor/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/examples/.cursor/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/examples/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/examples/.cursor/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/examples/.cursor/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/examples/.cursor/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/examples/.env.example +7 -0
- package/templates/current/examples/.env.production.example +31 -0
- package/templates/current/examples/.qoder/AGENTS.md +15 -0
- package/templates/current/examples/.qoder/rules/01-feature-architecture.md +12 -0
- package/templates/current/examples/.qoder/rules/02-vue-typescript.md +12 -0
- package/templates/current/examples/.qoder/rules/03-component-policy.md +30 -0
- package/templates/current/examples/.qoder/rules/04-api-auth-router.md +12 -0
- package/templates/current/examples/.qoder/rules/05-style.md +12 -0
- package/templates/current/examples/.qoder/rules/06-quality.md +12 -0
- package/templates/current/examples/.qoder/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/examples/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/examples/.qoder/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/examples/.qoder/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/examples/.qoder/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/examples/.qoder/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/examples/.qoder/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/examples/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/examples/.qoder/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/examples/.qoder/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/examples/.qoder/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/examples/AGENTS.md +16 -0
- package/templates/current/examples/README.md +116 -0
- package/templates/current/examples/component-catalog.json +765 -0
- package/templates/current/examples/e2e/admin-shell.spec.ts +150 -0
- package/templates/current/examples/e2e/demo-shell.spec.ts +328 -0
- package/templates/current/examples/evals/component-selection.json +29 -0
- package/templates/current/examples/gitignore +3 -0
- package/templates/current/examples/index.html +13 -0
- package/templates/current/examples/openapi.json +1623 -0
- package/templates/current/examples/package.json +65 -0
- package/templates/current/examples/playwright.config.ts +31 -0
- package/templates/current/examples/playwright.demo.config.ts +25 -0
- package/templates/current/examples/recipes/README.md +7 -0
- package/templates/current/examples/recipes/remote-crud-dialog-form.json +15 -0
- package/templates/current/examples/recipes/remote-crud-dialog-form.vue +66 -0
- package/templates/current/examples/scaffold.lock.json +12 -0
- package/templates/current/examples/scripts/check-admin-bundle.mjs +214 -0
- package/templates/current/examples/scripts/check-admin-scaffold.mjs +168 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/examples/scripts/clean-overlay/src/main.ts +91 -0
- package/templates/current/examples/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
- package/templates/current/examples/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
- package/templates/current/examples/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
- package/templates/current/examples/scripts/demo-api.ts +797 -0
- package/templates/current/examples/scripts/generate-api.ts +27 -0
- package/templates/current/examples/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
- package/templates/current/examples/scripts/remove-examples.mjs +54 -0
- package/templates/current/examples/src/App.vue +67 -0
- package/templates/current/examples/src/api/client.spec.ts +66 -0
- package/templates/current/examples/src/api/client.ts +72 -0
- package/templates/current/examples/src/api/generated/data-contracts.ts +268 -0
- package/templates/current/examples/src/api/generated/http-client.ts +266 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +98 -0
- package/templates/current/examples/src/api/http-adapter.spec.ts +33 -0
- package/templates/current/examples/src/api/http-adapter.ts +83 -0
- package/templates/current/examples/src/api/index.ts +41 -0
- package/templates/current/examples/src/app/createAdminUi.spec.ts +110 -0
- package/templates/current/examples/src/app/createAdminUi.ts +78 -0
- package/templates/current/examples/src/app/menu.spec.ts +255 -0
- package/templates/current/examples/src/app/menu.ts +268 -0
- package/templates/current/examples/src/app/menuTypes.ts +17 -0
- package/templates/current/examples/src/app/origenUiLocale.spec.ts +14 -0
- package/templates/current/examples/src/app/origenUiLocale.ts +65 -0
- package/templates/current/examples/src/app/permission.ts +9 -0
- package/templates/current/examples/src/app/runtimeConfig.ts +77 -0
- package/templates/current/examples/src/demo-api.spec.ts +167 -0
- package/templates/current/examples/src/env.d.ts +14 -0
- package/templates/current/examples/src/features/appearance/components/ThemePanel.vue +200 -0
- package/templates/current/examples/src/features/appearance/composables/useTheme.ts +17 -0
- package/templates/current/examples/src/features/appearance/store/theme.ts +140 -0
- package/templates/current/examples/src/features/auth/pages/Login.vue +159 -0
- package/templates/current/examples/src/features/auth/store/auth.spec.ts +131 -0
- package/templates/current/examples/src/features/auth/store/auth.ts +210 -0
- package/templates/current/examples/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/examples/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/examples/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/examples/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/examples/src/features/feature-composables.spec.ts +208 -0
- package/templates/current/examples/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
- package/templates/current/examples/src/features/security/devtoolsProtection.spec.ts +211 -0
- package/templates/current/examples/src/features/security/devtoolsProtection.ts +242 -0
- package/templates/current/examples/src/features/shell/components/AdminWatermark.spec.ts +90 -0
- package/templates/current/examples/src/features/shell/components/AdminWatermark.vue +47 -0
- package/templates/current/examples/src/features/shell/components/RouteProgress.vue +68 -0
- package/templates/current/examples/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
- package/templates/current/examples/src/features/shell/composables/useRouteProgress.ts +52 -0
- package/templates/current/examples/src/features/shell/store/sidebar.ts +55 -0
- package/templates/current/examples/src/features/system/access/api/admin-repository.ts +279 -0
- package/templates/current/examples/src/features/system/access/api/rbac.spec.ts +72 -0
- package/templates/current/examples/src/features/system/access/api/rbac.ts +272 -0
- package/templates/current/examples/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
- package/templates/current/examples/src/features/system/audit/composables/useAuditManagement.ts +117 -0
- package/templates/current/examples/src/features/system/audit/pages/AuditList.vue +20 -0
- package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +189 -0
- package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +327 -0
- package/templates/current/examples/src/features/system/menus/pages/MenuList.vue +49 -0
- package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +112 -0
- package/templates/current/examples/src/features/system/roles/composables/useRoleManagement.ts +198 -0
- package/templates/current/examples/src/features/system/roles/pages/RoleList.vue +45 -0
- package/templates/current/examples/src/features/system/users/components/UserEditorForm.vue +101 -0
- package/templates/current/examples/src/features/system/users/composables/useUserManagement.ts +233 -0
- package/templates/current/examples/src/features/system/users/pages/UserList.vue +49 -0
- package/templates/current/examples/src/features/workspace/pages/Dashboard.spec.ts +32 -0
- package/templates/current/examples/src/features/workspace/pages/Dashboard.vue +297 -0
- package/templates/current/examples/src/features/workspace/pages/Empty.vue +18 -0
- package/templates/current/examples/src/features/workspace/pages/Profile.vue +183 -0
- package/templates/current/examples/src/layouts/AdminLayout.vue +61 -0
- package/templates/current/examples/src/layouts/BreadcrumbBar.vue +27 -0
- package/templates/current/examples/src/layouts/SideMenu.vue +119 -0
- package/templates/current/examples/src/layouts/TopBar.vue +301 -0
- package/templates/current/examples/src/layouts/WorkspaceTabs.vue +44 -0
- package/templates/current/examples/src/layouts/topBarMenuSearch.spec.ts +31 -0
- package/templates/current/examples/src/layouts/topBarMenuSearch.ts +21 -0
- package/templates/current/examples/src/locales/en-US.ts +55 -0
- package/templates/current/examples/src/locales/index.ts +119 -0
- package/templates/current/examples/src/locales/messages.spec.ts +23 -0
- package/templates/current/examples/src/locales/zh-CN.ts +55 -0
- package/templates/current/examples/src/locales/zh-TW.ts +44 -0
- package/templates/current/examples/src/main.ts +91 -0
- package/templates/current/examples/src/router/bootstrap.ts +76 -0
- package/templates/current/examples/src/router/componentRegistry.ts +83 -0
- package/templates/current/examples/src/router/dynamicRoutes.spec.ts +109 -0
- package/templates/current/examples/src/router/dynamicRoutes.ts +162 -0
- package/templates/current/examples/src/router/guards.ts +5 -0
- package/templates/current/examples/src/router/queryEncryption.spec.ts +82 -0
- package/templates/current/examples/src/router/queryEncryption.ts +133 -0
- package/templates/current/examples/src/router/routeQuery.spec.ts +11 -0
- package/templates/current/examples/src/router/routeQuery.ts +3 -0
- package/templates/current/examples/src/router/runtimeErrorRecovery.spec.ts +161 -0
- package/templates/current/examples/src/router/runtimeErrorRecovery.ts +108 -0
- package/templates/current/examples/src/router/staticRoutes.ts +63 -0
- package/templates/current/examples/src/router/useRouteQueryDefaults.spec.ts +90 -0
- package/templates/current/examples/src/router/useRouteQueryDefaults.ts +51 -0
- package/templates/current/examples/src/router/useRouteQueryDefaults.types.ts +19 -0
- package/templates/current/examples/src/store/index.ts +3 -0
- package/templates/current/examples/src/styles/element/index.scss +33 -0
- package/templates/current/examples/src/styles/index.css +39 -0
- package/templates/current/examples/src/styles/layout.css +115 -0
- package/templates/current/examples/src/styles/shell.css +196 -0
- package/templates/current/examples/src/styles/source-package-style-compat.css +1 -0
- package/templates/current/examples/src/templates/og-form.ts +48 -0
- package/templates/current/examples/src/templates/og-table.ts +212 -0
- package/templates/current/examples/src/templates/router.ts +51 -0
- package/templates/current/examples/src/templates/templates.spec.ts +90 -0
- package/templates/current/examples/src/theme/index.ts +7 -0
- package/templates/current/examples/src/utils/__tests__/color-mix.spec.ts +39 -0
- package/templates/current/examples/src/utils/color-mix.ts +76 -0
- package/templates/current/examples/src/utils/permissions.ts +6 -0
- package/templates/current/examples/tsconfig.json +40 -0
- package/templates/current/examples/tsconfig.node.json +9 -0
- package/templates/current/examples/vite.build-policy.ts +405 -0
- package/templates/current/examples/vite.config.ts +37 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import type { Plugin, Rollup, UserConfig } from 'vite'
|
|
2
|
+
import { writeFile } from 'node:fs/promises'
|
|
3
|
+
import { resolve } from 'node:path'
|
|
4
|
+
import process from 'node:process'
|
|
5
|
+
|
|
6
|
+
const packageBuildDirectories = new Set(['dist', 'es', 'esm', 'lib', 'src'])
|
|
7
|
+
const splitModuleDirectories = new Set(['components', 'languages', 'locale'])
|
|
8
|
+
const ASYNC_COMPONENT_CHUNK_BUCKETS = 4
|
|
9
|
+
const INITIAL_CHUNK_BUCKETS = 3
|
|
10
|
+
|
|
11
|
+
function chunkName(value: string): string {
|
|
12
|
+
return value
|
|
13
|
+
.replace(/^@/, '')
|
|
14
|
+
.replaceAll(/[^\w-]+/g, '-')
|
|
15
|
+
.replaceAll(/^-+|-+$/g, '')
|
|
16
|
+
.toLowerCase()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function dependencyPath(normalized: string): { name: string, path: string[] } | undefined {
|
|
20
|
+
const marker = '/node_modules/'
|
|
21
|
+
const nodeModulesIndex = normalized.lastIndexOf(marker)
|
|
22
|
+
if (nodeModulesIndex < 0) return undefined
|
|
23
|
+
|
|
24
|
+
const segments = normalized.slice(nodeModulesIndex + marker.length).split('/')
|
|
25
|
+
const scoped = segments[0]?.startsWith('@')
|
|
26
|
+
const packageSegments = scoped ? segments.slice(0, 2) : segments.slice(0, 1)
|
|
27
|
+
if (packageSegments.some((segment) => !segment)) return undefined
|
|
28
|
+
return {
|
|
29
|
+
name: packageSegments.join('/'),
|
|
30
|
+
path: segments.slice(packageSegments.length),
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function workspacePackagePath(normalized: string): { name: string, path: string[] } | undefined {
|
|
35
|
+
const match = normalized.match(/\/packages\/([^/]+)\/(?:dist|src)\/(.+)$/)
|
|
36
|
+
if (!match) return undefined
|
|
37
|
+
return { name: `og-${match[1]}`, path: match[2].split('/') }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function moduleLocation(id: string) {
|
|
41
|
+
const normalized = id.split('?')[0].replaceAll('\\', '/')
|
|
42
|
+
const dependency = dependencyPath(normalized) ?? workspacePackagePath(normalized)
|
|
43
|
+
if (!dependency) return undefined
|
|
44
|
+
|
|
45
|
+
const path = [...dependency.path]
|
|
46
|
+
const buildDirectory = packageBuildDirectories.has(path[0]) ? path.shift() : undefined
|
|
47
|
+
return { ...dependency, path, buildDirectory }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isStyleModule(id: string): boolean {
|
|
51
|
+
return /\.(?:css|less|sass|scss|styl)(?:$|\?)/.test(id)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function moduleUnitKey(id: string): string | undefined {
|
|
55
|
+
const location = moduleLocation(id)
|
|
56
|
+
if (!location) return undefined
|
|
57
|
+
const [directory, moduleName] = location.path
|
|
58
|
+
if (!directory || !splitModuleDirectories.has(directory)) return location.name
|
|
59
|
+
if (directory === 'components' && moduleName)
|
|
60
|
+
return `${location.name}\0${directory}\0${moduleName}`
|
|
61
|
+
return `${location.name}\0${directory}`
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function stableHash(value: string): string {
|
|
65
|
+
let hash = 2_166_136_261
|
|
66
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
67
|
+
hash ^= value.charCodeAt(index)
|
|
68
|
+
hash = Math.imul(hash, 16_777_619)
|
|
69
|
+
}
|
|
70
|
+
return (hash >>> 0).toString(36)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function dynamicRootLabels(ids: readonly string[]): ReadonlyMap<string, string> {
|
|
74
|
+
const used = new Map<string, number>()
|
|
75
|
+
const labels = new Map<string, string>()
|
|
76
|
+
for (const id of [...ids].sort()) {
|
|
77
|
+
const normalized = id.split('?')[0].replaceAll('\\', '/')
|
|
78
|
+
const filename = normalized.slice(normalized.lastIndexOf('/') + 1).replace(/\.[^.]+$/, '')
|
|
79
|
+
const base = chunkName(filename || 'async') || 'async'
|
|
80
|
+
const count = (used.get(base) ?? 0) + 1
|
|
81
|
+
used.set(base, count)
|
|
82
|
+
labels.set(id, count === 1 ? base : `${base}-${count}`)
|
|
83
|
+
}
|
|
84
|
+
return labels
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function moduleOwners(
|
|
88
|
+
meta: Parameters<Rollup.GetManualChunk>[1],
|
|
89
|
+
): ReadonlyMap<string, readonly string[]> {
|
|
90
|
+
const ids = [...meta.getModuleIds()].sort()
|
|
91
|
+
const ownerSets = new Map<string, Set<string>>()
|
|
92
|
+
const entryRoots = ids.filter((id) => meta.getModuleInfo(id)?.isEntry)
|
|
93
|
+
const dynamicRoots = [
|
|
94
|
+
...new Set(ids.flatMap((id) => meta.getModuleInfo(id)?.dynamicallyImportedIds ?? [])),
|
|
95
|
+
]
|
|
96
|
+
const labels = dynamicRootLabels(dynamicRoots)
|
|
97
|
+
|
|
98
|
+
function markStaticClosure(root: string, owner: string): void {
|
|
99
|
+
const stack = [root]
|
|
100
|
+
while (stack.length > 0) {
|
|
101
|
+
const id = stack.pop()!
|
|
102
|
+
const info = meta.getModuleInfo(id)
|
|
103
|
+
if (!info || info.isExternal) continue
|
|
104
|
+
const owners = ownerSets.get(id) ?? new Set<string>()
|
|
105
|
+
if (owners.has(owner)) continue
|
|
106
|
+
owners.add(owner)
|
|
107
|
+
ownerSets.set(id, owners)
|
|
108
|
+
stack.push(...info.importedIds)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
for (const root of entryRoots) markStaticClosure(root, 'entry')
|
|
113
|
+
for (const root of dynamicRoots) markStaticClosure(root, labels.get(root) ?? 'async')
|
|
114
|
+
|
|
115
|
+
return new Map([...ownerSets].map(([id, owners]) => [id, [...owners].sort()]))
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function asyncOwnerLabel(owners: readonly string[]): string {
|
|
119
|
+
const asyncOwners = owners.filter((owner) => owner !== 'entry')
|
|
120
|
+
if (asyncOwners.length === 0) return 'orphan'
|
|
121
|
+
if (asyncOwners.length === 1) return asyncOwners[0]
|
|
122
|
+
return `shared-${stableHash(asyncOwners.join('|'))}`
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function isInitialOnly(owners: readonly string[]): boolean {
|
|
126
|
+
return owners.length === 1 && owners[0] === 'entry'
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function stronglyConnectedComponents(units: Map<string, { edges: Set<string> }>): string[][] {
|
|
130
|
+
const indices = new Map<string, number>()
|
|
131
|
+
const lowLinks = new Map<string, number>()
|
|
132
|
+
const stack: string[] = []
|
|
133
|
+
const stacked = new Set<string>()
|
|
134
|
+
const components: string[][] = []
|
|
135
|
+
let index = 0
|
|
136
|
+
|
|
137
|
+
function visit(key: string) {
|
|
138
|
+
indices.set(key, index)
|
|
139
|
+
lowLinks.set(key, index++)
|
|
140
|
+
stack.push(key)
|
|
141
|
+
stacked.add(key)
|
|
142
|
+
|
|
143
|
+
for (const edge of [...(units.get(key)?.edges ?? [])].sort()) {
|
|
144
|
+
if (!units.has(edge)) continue
|
|
145
|
+
if (!indices.has(edge)) {
|
|
146
|
+
visit(edge)
|
|
147
|
+
lowLinks.set(key, Math.min(lowLinks.get(key)!, lowLinks.get(edge)!))
|
|
148
|
+
} else if (stacked.has(edge)) {
|
|
149
|
+
lowLinks.set(key, Math.min(lowLinks.get(key)!, indices.get(edge)!))
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (lowLinks.get(key) !== indices.get(key)) return
|
|
154
|
+
const component: string[] = []
|
|
155
|
+
let member: string
|
|
156
|
+
do {
|
|
157
|
+
member = stack.pop()!
|
|
158
|
+
stacked.delete(member)
|
|
159
|
+
component.push(member)
|
|
160
|
+
} while (member !== key)
|
|
161
|
+
components.push(component.sort())
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
for (const key of [...units.keys()].sort()) {
|
|
165
|
+
if (!indices.has(key)) visit(key)
|
|
166
|
+
}
|
|
167
|
+
return components
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function topologicallyOrderedComponents(units: Map<string, { edges: Set<string> }>): string[][] {
|
|
171
|
+
const components = stronglyConnectedComponents(units)
|
|
172
|
+
const componentByUnit = new Map<string, number>()
|
|
173
|
+
components.forEach((component, index) => {
|
|
174
|
+
for (const key of component) componentByUnit.set(key, index)
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
const edges = components.map(() => new Set<number>())
|
|
178
|
+
const indegrees = components.map(() => 0)
|
|
179
|
+
for (const [unit, value] of units) {
|
|
180
|
+
const from = componentByUnit.get(unit)!
|
|
181
|
+
for (const dependency of value.edges) {
|
|
182
|
+
const to = componentByUnit.get(dependency)
|
|
183
|
+
if (to === undefined || to === from || edges[from].has(to)) continue
|
|
184
|
+
edges[from].add(to)
|
|
185
|
+
indegrees[to] += 1
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const available = components
|
|
190
|
+
.map((_, index) => index)
|
|
191
|
+
.filter((index) => indegrees[index] === 0)
|
|
192
|
+
.sort((left, right) => components[left].join('\0').localeCompare(components[right].join('\0')))
|
|
193
|
+
const ordered: string[][] = []
|
|
194
|
+
while (available.length > 0) {
|
|
195
|
+
const index = available.shift()!
|
|
196
|
+
ordered.push(components[index])
|
|
197
|
+
for (const dependency of edges[index]) {
|
|
198
|
+
indegrees[dependency] -= 1
|
|
199
|
+
if (indegrees[dependency] === 0) {
|
|
200
|
+
available.push(dependency)
|
|
201
|
+
available.sort((left, right) =>
|
|
202
|
+
components[left].join('\0').localeCompare(components[right].join('\0')),
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return ordered
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function assignBuckets(
|
|
211
|
+
units: Map<string, { edges: Set<string>, size: number }>,
|
|
212
|
+
bucketCount: number,
|
|
213
|
+
): ReadonlyMap<string, string> {
|
|
214
|
+
const components = topologicallyOrderedComponents(units)
|
|
215
|
+
const totalSize = components.reduce(
|
|
216
|
+
(total, component) => total + component.reduce((size, key) => size + units.get(key)!.size, 0),
|
|
217
|
+
0,
|
|
218
|
+
)
|
|
219
|
+
const assignments = new Map<string, string>()
|
|
220
|
+
let consumedSize = 0
|
|
221
|
+
for (const component of components) {
|
|
222
|
+
const componentSize = component.reduce((size, key) => size + units.get(key)!.size, 0)
|
|
223
|
+
const midpoint = consumedSize + componentSize / 2
|
|
224
|
+
const bucket = Math.min(
|
|
225
|
+
Math.floor((midpoint * bucketCount) / Math.max(totalSize, 1)),
|
|
226
|
+
bucketCount - 1,
|
|
227
|
+
)
|
|
228
|
+
for (const key of component) assignments.set(key, String(bucket))
|
|
229
|
+
consumedSize += componentSize
|
|
230
|
+
}
|
|
231
|
+
return assignments
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function initialChunkAssignments(
|
|
235
|
+
meta: Parameters<Rollup.GetManualChunk>[1],
|
|
236
|
+
owners: ReadonlyMap<string, readonly string[]>,
|
|
237
|
+
): ReadonlyMap<string, string> {
|
|
238
|
+
const units = new Map<string, { edges: Set<string>, size: number }>()
|
|
239
|
+
const unitByModule = new Map<string, string>()
|
|
240
|
+
|
|
241
|
+
for (const id of [...meta.getModuleIds()].sort()) {
|
|
242
|
+
if (!isInitialOnly(owners.get(id) ?? [])) continue
|
|
243
|
+
const key = moduleUnitKey(id)
|
|
244
|
+
if (!key) continue
|
|
245
|
+
const unit = units.get(key) ?? { edges: new Set(), size: 0 }
|
|
246
|
+
unit.size += meta.getModuleInfo(id)?.code?.length ?? 1
|
|
247
|
+
units.set(key, unit)
|
|
248
|
+
unitByModule.set(id, key)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
for (const [id, key] of unitByModule) {
|
|
252
|
+
for (const importedId of meta.getModuleInfo(id)?.importedIds ?? []) {
|
|
253
|
+
const importedKey = unitByModule.get(importedId)
|
|
254
|
+
if (importedKey && importedKey !== key) units.get(key)!.edges.add(importedKey)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const unitAssignments = assignBuckets(units, INITIAL_CHUNK_BUCKETS)
|
|
259
|
+
return new Map([...unitByModule].map(([id, key]) => [id, unitAssignments.get(key) ?? '0']))
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function asyncComponentAssignments(
|
|
263
|
+
meta: Parameters<Rollup.GetManualChunk>[1],
|
|
264
|
+
owners: ReadonlyMap<string, readonly string[]>,
|
|
265
|
+
): ReadonlyMap<string, string> {
|
|
266
|
+
const modulesByGroup = new Map<string, Map<string, string>>()
|
|
267
|
+
const unitsByGroup = new Map<string, Map<string, { edges: Set<string>, size: number }>>()
|
|
268
|
+
|
|
269
|
+
for (const id of [...meta.getModuleIds()].sort()) {
|
|
270
|
+
const location = moduleLocation(id)
|
|
271
|
+
const moduleOwners = owners.get(id) ?? []
|
|
272
|
+
if (isInitialOnly(moduleOwners) || location?.path[0] !== 'components' || !location.path[1])
|
|
273
|
+
continue
|
|
274
|
+
const group = `${asyncOwnerLabel(moduleOwners)}\0${location.name}`
|
|
275
|
+
const key = `${group}\0${location.path[1]}`
|
|
276
|
+
const units = unitsByGroup.get(group) ?? new Map()
|
|
277
|
+
const unit = units.get(key) ?? { edges: new Set<string>(), size: 0 }
|
|
278
|
+
unit.size += meta.getModuleInfo(id)?.code?.length ?? 1
|
|
279
|
+
units.set(key, unit)
|
|
280
|
+
unitsByGroup.set(group, units)
|
|
281
|
+
const modules = modulesByGroup.get(group) ?? new Map()
|
|
282
|
+
modules.set(id, key)
|
|
283
|
+
modulesByGroup.set(group, modules)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const assignments = new Map<string, string>()
|
|
287
|
+
for (const [group, modules] of modulesByGroup) {
|
|
288
|
+
const units = unitsByGroup.get(group)!
|
|
289
|
+
for (const [id, key] of modules) {
|
|
290
|
+
for (const importedId of meta.getModuleInfo(id)?.importedIds ?? []) {
|
|
291
|
+
const importedKey = modules.get(importedId)
|
|
292
|
+
if (importedKey && importedKey !== key) units.get(key)!.edges.add(importedKey)
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const buckets = assignBuckets(units, ASYNC_COMPONENT_CHUNK_BUCKETS)
|
|
296
|
+
for (const [id, key] of modules) assignments.set(id, buckets.get(key) ?? '0')
|
|
297
|
+
}
|
|
298
|
+
return assignments
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export function createAdminManualChunks(): Rollup.GetManualChunk {
|
|
302
|
+
let owners: ReadonlyMap<string, readonly string[]> | undefined
|
|
303
|
+
let initialChunks: ReadonlyMap<string, string> | undefined
|
|
304
|
+
let componentChunks: ReadonlyMap<string, string> | undefined
|
|
305
|
+
return (id, meta) => {
|
|
306
|
+
if (id.startsWith('\0') || isStyleModule(id)) return undefined
|
|
307
|
+
const location = moduleLocation(id)
|
|
308
|
+
if (!location) return undefined
|
|
309
|
+
|
|
310
|
+
owners ??= moduleOwners(meta)
|
|
311
|
+
initialChunks ??= initialChunkAssignments(meta, owners)
|
|
312
|
+
componentChunks ??= asyncComponentAssignments(meta, owners)
|
|
313
|
+
const currentOwners = owners.get(id) ?? []
|
|
314
|
+
// These runtime families are shared by the same feature surfaces; keeping
|
|
315
|
+
// them together avoids repeated module wrappers across async chunks.
|
|
316
|
+
if (location.name === 'vue' || location.name.startsWith('@vue/')) return 'vendor-vue-runtime'
|
|
317
|
+
if (location.name === 'vue-i18n' || location.name.startsWith('@intlify/'))
|
|
318
|
+
return 'vendor-vue-i18n'
|
|
319
|
+
if (location.name.startsWith('@vueuse/')) return 'vendor-vueuse'
|
|
320
|
+
if (location.name.startsWith('@floating-ui/') || location.name === '@sxzz/popperjs-es')
|
|
321
|
+
return 'vendor-positioning'
|
|
322
|
+
if (
|
|
323
|
+
location.name === 'og-table' ||
|
|
324
|
+
location.name === 'og-table-search' ||
|
|
325
|
+
location.name === 'og-search'
|
|
326
|
+
) {
|
|
327
|
+
return 'vendor-table-suite'
|
|
328
|
+
}
|
|
329
|
+
if (isInitialOnly(currentOwners)) return `vendor-initial-${initialChunks.get(id) ?? '0'}`
|
|
330
|
+
if (currentOwners.includes('entry')) return undefined
|
|
331
|
+
if (location.name === 'element-plus') return undefined
|
|
332
|
+
|
|
333
|
+
const owner = asyncOwnerLabel(currentOwners)
|
|
334
|
+
const packageName = chunkName(location.name)
|
|
335
|
+
const [directory, moduleName] = location.path
|
|
336
|
+
if (splitModuleDirectories.has(directory)) {
|
|
337
|
+
if (directory === 'components' && moduleName)
|
|
338
|
+
return `vendor-${owner}-${packageName}-components-${componentChunks.get(id) ?? '0'}`
|
|
339
|
+
return `vendor-${owner}-${packageName}-${chunkName(directory)}`
|
|
340
|
+
}
|
|
341
|
+
return `vendor-${owner}-${packageName}`
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function normalizeEmptyChunks(): Plugin {
|
|
346
|
+
return {
|
|
347
|
+
name: 'admin-normalize-empty-chunks',
|
|
348
|
+
renderChunk(code) {
|
|
349
|
+
const payload = code.replaceAll(/\/\*[\s\S]*?\*\//g, '').trim()
|
|
350
|
+
if (!payload || /^export\s*\{\s*\}\s*;?$/.test(payload)) return 'void 0;\n'
|
|
351
|
+
return null
|
|
352
|
+
},
|
|
353
|
+
generateBundle(_options, bundle) {
|
|
354
|
+
for (const output of Object.values(bundle)) {
|
|
355
|
+
const payload =
|
|
356
|
+
output.type === 'chunk'
|
|
357
|
+
? output.code.replaceAll(/\/\*[\s\S]*?\*\//g, '').trim()
|
|
358
|
+
: undefined
|
|
359
|
+
if (output.type === 'chunk' && (!payload || /^export\s*\{\s*\}\s*;?$/.test(payload))) {
|
|
360
|
+
output.code = 'void 0;\n'
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
async writeBundle(_options, bundle) {
|
|
365
|
+
await Promise.all(
|
|
366
|
+
Object.values(bundle).map(async (output) => {
|
|
367
|
+
if (output.type !== 'chunk') return
|
|
368
|
+
const payload = output.code.replaceAll(/\/\*[\s\S]*?\*\//g, '').trim()
|
|
369
|
+
if (!payload || /^export\s*\{\s*\}\s*;?$/.test(payload))
|
|
370
|
+
await writeFile(resolve(process.cwd(), 'dist', output.fileName), 'void 0;\n')
|
|
371
|
+
}),
|
|
372
|
+
)
|
|
373
|
+
},
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export function createAdminBuildPlugins(): Plugin[] {
|
|
378
|
+
return [normalizeEmptyChunks()]
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export function createAdminBuildOptions(isDebugBuild: boolean): UserConfig['build'] {
|
|
382
|
+
return {
|
|
383
|
+
outDir: 'dist',
|
|
384
|
+
sourcemap: isDebugBuild,
|
|
385
|
+
minify: isDebugBuild ? false : 'esbuild',
|
|
386
|
+
target: 'es2020',
|
|
387
|
+
modulePreload: false,
|
|
388
|
+
rollupOptions: {
|
|
389
|
+
onwarn(warning, warn) {
|
|
390
|
+
if (warning.code === 'EMPTY_BUNDLE') return
|
|
391
|
+
if (
|
|
392
|
+
warning.code === 'INVALID_ANNOTATION' &&
|
|
393
|
+
warning.id?.includes('@vueuse/core/dist/index.js')
|
|
394
|
+
) {
|
|
395
|
+
return
|
|
396
|
+
}
|
|
397
|
+
warn(warning)
|
|
398
|
+
},
|
|
399
|
+
output: {
|
|
400
|
+
manualChunks: createAdminManualChunks(),
|
|
401
|
+
onlyExplicitManualChunks: true,
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
}
|
|
405
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
import vue from '@vitejs/plugin-vue'
|
|
4
|
+
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
5
|
+
import ElementPlus from 'unplugin-element-plus/vite'
|
|
6
|
+
import { loadEnv } from 'vite'
|
|
7
|
+
import { defineConfig } from 'vitest/config'
|
|
8
|
+
// This file is copied to the scaffold root, where the shared policy is copied
|
|
9
|
+
// with the application source as ./vite.build-policy.ts.
|
|
10
|
+
import { createAdminBuildOptions, createAdminBuildPlugins } from './vite.build-policy'
|
|
11
|
+
|
|
12
|
+
export default defineConfig(({ command, mode }) => {
|
|
13
|
+
const loadedEnv = loadEnv(mode, process.cwd(), '')
|
|
14
|
+
const apiTarget = loadedEnv.VITE_API_TARGET || 'http://127.0.0.1:8080'
|
|
15
|
+
const isDebugBuild = command === 'build' && mode === 'debug'
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
plugins: [vue(), vueJsx(), ...createAdminBuildPlugins(), ElementPlus({ useSource: true })],
|
|
19
|
+
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
|
|
20
|
+
esbuild: {
|
|
21
|
+
jsx: 'preserve',
|
|
22
|
+
jsxImportSource: 'vue',
|
|
23
|
+
...(command === 'build' && !isDebugBuild ? { drop: ['console', 'debugger'] } : {}),
|
|
24
|
+
},
|
|
25
|
+
server: {
|
|
26
|
+
port: 5175,
|
|
27
|
+
proxy: { '/api': { target: apiTarget, changeOrigin: true } },
|
|
28
|
+
},
|
|
29
|
+
build: createAdminBuildOptions(isDebugBuild),
|
|
30
|
+
test: {
|
|
31
|
+
environment: 'jsdom',
|
|
32
|
+
include: ['src/**/*.spec.ts'],
|
|
33
|
+
clearMocks: true,
|
|
34
|
+
server: { deps: { inline: ['element-plus'] } },
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: og-admin-scaffold
|
|
3
|
+
description: Official guidance for the standalone @origen-ui Admin scaffold.
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
globs:
|
|
6
|
+
- '**/*'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# @origen-ui Admin scaffold
|
|
10
|
+
|
|
11
|
+
Read `AGENTS.local.md` when it exists. Keep product code in `src/app` and
|
|
12
|
+
`src/features`; do not modify managed files or generated agent files without an
|
|
13
|
+
upgrade migration. Run `pnpm type-check` and `pnpm test` for every application change.
|
|
14
|
+
|
|
15
|
+
Use `build-admin-feature` before adding a feature. Use matching `use-og-*` skills
|
|
16
|
+
for tables, search, forms, dialogs, routing, or HTTP. Remote lists must use
|
|
17
|
+
`OgTableWithSearch`; forms use `OgForm`; dialogs use `OgDialog`; network
|
|
18
|
+
requests use `@origen-ui/http`. Do not replace these with Element Plus equivalents.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 01-feature-architecture
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
globs:
|
|
5
|
+
- '**/*'
|
|
6
|
+
---
|
|
7
|
+
# Feature architecture
|
|
8
|
+
|
|
9
|
+
- Keep route pages thin composition surfaces under `src/features/<feature>/pages`.
|
|
10
|
+
- Put UI sections in `components`, stateful side effects in `composables`, and API adapters in `api`.
|
|
11
|
+
- Keep data flow as props down and typed events up. Do not mutate props.
|
|
12
|
+
- `src/app` owns application integration; `src/features` owns business behavior; examples never become feature dependencies.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 02-vue-typescript
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
globs:
|
|
5
|
+
- '**/*'
|
|
6
|
+
---
|
|
7
|
+
# Vue and TypeScript
|
|
8
|
+
|
|
9
|
+
- Use Vue 3 `<script setup lang="ts">` and Composition API.
|
|
10
|
+
- Keep source state minimal, derive values with `computed`, and use watchers only for side effects.
|
|
11
|
+
- Type props, emits, exposed APIs, composable inputs, API payloads, and route metadata.
|
|
12
|
+
- Use `useTemplateRef` for imperative component APIs and keep templates declarative.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 03-component-policy
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
globs:
|
|
5
|
+
- '**/*'
|
|
6
|
+
---
|
|
7
|
+
# @origen-ui component policy
|
|
8
|
+
|
|
9
|
+
<!-- component-catalog:start -->
|
|
10
|
+
- `OgDialog` (@origen-ui/dialog): Parent-controlled dialog UI; avoid Element Plus ElDialog in business features.
|
|
11
|
+
- `createOgDialog` (@origen-ui/dialog): Awaitable or manager-owned dialog workflows; avoid createApp or a global fallback manager.
|
|
12
|
+
- `OgEditor` (@origen-ui/editor): Rich text authoring; avoid Unsanitized HTML persistence or direct DOM insertion.
|
|
13
|
+
- `OgEditorViewer` (@origen-ui/editor): Readonly rich text rendering; avoid Rendering untrusted HTML without server sanitization.
|
|
14
|
+
- `OgForm` (@origen-ui/form): Schema-driven create, edit, or readonly forms; avoid Element Plus ElForm or removed legacy APIs.
|
|
15
|
+
- `OgFormTable` (@origen-ui/form-table): Editable array fields and line-item forms; avoid Mutating parent form arrays or duplicate remote table fetching.
|
|
16
|
+
- `OgSearch` (@origen-ui/search): Standalone query/filter panels; avoid Owning list loading or pagination.
|
|
17
|
+
- `OgTable` (@origen-ui/table): Typed local or remote data tables; avoid Legacy fetch/searchSchema APIs or ElTable.
|
|
18
|
+
- `OgTableLocal` (@origen-ui/table): Editable local tables embedded in a form or workflow; avoid Treating local rows as an implicit remote data source.
|
|
19
|
+
- `OgTableWithSearch` (@origen-ui/table-search): Remote CRUD lists with search and paging; avoid Separate ad-hoc search and table state.
|
|
20
|
+
- `OgTabs` (@origen-ui/tabs): Page-local business tabs; avoid Using page-local tabs for route workspace state.
|
|
21
|
+
- `OgUpload` (@origen-ui/upload): Validated file uploads and URL projection; avoid Package-level transport clients or mutating internal files.
|
|
22
|
+
- `OgFormItem` (@origen-ui/form): A single schema-aware field needs to participate in an existing OgForm context; avoid Using it as a transparent Element Plus ElFormItem replacement.
|
|
23
|
+
- `FieldRenderer` (@origen-ui/form): An advanced integration needs the registered OgForm control renderer; avoid Treating it as a general-purpose Element Plus control wrapper.
|
|
24
|
+
- `SvgIcon` (@origen-ui/icons): Rendering a project SVG sprite icon; avoid Passing untrusted or arbitrary symbol identifiers.
|
|
25
|
+
- `RouterViewHost` (@origen-ui/router): Rendering a route workspace with keep-alive semantics; avoid Using it as a transparent vue-router RouterView replacement.
|
|
26
|
+
<!-- component-catalog:end -->
|
|
27
|
+
|
|
28
|
+
- Route workspace: `@origen-ui/router`; page-local business tabs: `OgTabs`.
|
|
29
|
+
- Use Element Plus only for primitives. Do not add `ElTable`, `ElForm`, `ElDialog`, axios, or raw fetch to a business feature.
|
|
30
|
+
- Pass AbortSignal through every list and async-options implementation. Configure permissions explicitly when a component declares them.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 04-api-auth-router
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
globs:
|
|
5
|
+
- '**/*'
|
|
6
|
+
---
|
|
7
|
+
# API, authentication, and routing
|
|
8
|
+
|
|
9
|
+
- Create application-owned `ApiClient` instances with explicit response adapters.
|
|
10
|
+
- Keep token, refresh URL, CSRF source, and login navigation in the application adapter.
|
|
11
|
+
- Resolve backend component keys through the local registry; never import a backend-supplied path.
|
|
12
|
+
- Local authentication and menu providers are development-only. Remote failures must reach the caller.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 05-style
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
globs:
|
|
5
|
+
- '**/*'
|
|
6
|
+
---
|
|
7
|
+
# Styling
|
|
8
|
+
|
|
9
|
+
- Use Element Plus CSS variables and the application theme tokens.
|
|
10
|
+
- Keep component styles scoped and use class selectors.
|
|
11
|
+
- Load only required `origen-ui/*.css` entries. `origen-ui/style.css` does not exist.
|
|
12
|
+
- Preserve responsive layouts and avoid hard-coded theme colors outside token definitions.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 06-quality
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
globs:
|
|
5
|
+
- '**/*'
|
|
6
|
+
---
|
|
7
|
+
# Quality gates
|
|
8
|
+
|
|
9
|
+
- Run `pnpm type-check`, `pnpm test`, and `pnpm build` for application changes.
|
|
10
|
+
- Run `pnpm agents:check` after changing official rules or Skills.
|
|
11
|
+
- Do not use deprecated component APIs such as `resetFields`, `dependsOn`, global renderer registration, or legacy OgTable read APIs.
|
|
12
|
+
- Add focused unit or browser coverage for user-visible behavior and failed requests.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-admin-feature
|
|
3
|
+
description: Build a typed Vue Admin business feature. Use when adding a page, CRUD workflow, feature folder, business API adapter, permissioned menu, or route in the standalone @origen-ui Admin scaffold.
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
globs:
|
|
6
|
+
- 'packages/**'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Build an Admin feature
|
|
10
|
+
|
|
11
|
+
1. Define the feature model, permissions, API contract, and route before writing a page.
|
|
12
|
+
2. Create `api`, `composables`, `components`, and `pages` only when the responsibility exists.
|
|
13
|
+
3. Select the mandatory @origen-ui business component before writing view code.
|
|
14
|
+
4. Register a local component key for a remote menu; never trust a backend import path.
|
|
15
|
+
5. Add a focused test and run application quality gates.
|
|
16
|
+
|
|
17
|
+
Read `references/component-selection.md` before choosing a UI primitive.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: style-og-origen-ui
|
|
3
|
+
description: Style a standalone @origen-ui Admin page with origen-ui CSS entries, Element Plus design tokens, dark-mode variables, and responsive enterprise layout conventions.
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
globs:
|
|
6
|
+
- 'packages/**'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Style Admin UI
|
|
10
|
+
|
|
11
|
+
Load `origen-ui/style.css` by default. Use an explicit component entry such as
|
|
12
|
+
`origen-ui/table-search.css` only when the application intentionally adopts
|
|
13
|
+
on-demand styles. Use Element Plus variables and application tokens, keep local styles
|
|
14
|
+
scoped, and verify light/dark rendering before finishing.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: use-og-dialog
|
|
3
|
+
description: Build parent-controlled dialogs or awaitable edit workflows with @origen-ui/dialog. Use for dialog confirmation, close guards, dynamic form content, manager-owned sessions, and typed dialog outcomes.
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
globs:
|
|
6
|
+
- 'packages/dialog/**'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Use OgDialog
|
|
10
|
+
|
|
11
|
+
Use `<OgDialog v-model>` for parent-owned visibility. For workflows, call
|
|
12
|
+
`app.use(createOgDialog())` once, render `OgDialogHost` in the application tree, and
|
|
13
|
+
open through `useDialog().open`. Handle the discriminated `DialogOutcome` and
|
|
14
|
+
keep dynamic content in the current Vue application context. Never call
|
|
15
|
+
`createApp()` or use a global fallback manager.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: use-og-editor
|
|
3
|
+
description: Build rich text authoring and readonly content surfaces with @origen-ui/editor. Use for HTML editing, toolbar presets, media uploads, source mode, and content limits.
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
globs:
|
|
6
|
+
- 'packages/editor/**'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Use OgEditor
|
|
10
|
+
|
|
11
|
+
Use `OgEditor` with `v-model` for authoring and `OgEditorViewer` for readonly
|
|
12
|
+
content. Load `@origen-ui/editor/style.css` (or the matching explicit
|
|
13
|
+
`origen-ui/editor.css` entry). Choose editor initialization through
|
|
14
|
+
the discriminated `setup` prop, then use `maxLength`, `readonly`, or `disabled` rather than wrapping
|
|
15
|
+
the editor in ad-hoc state.
|
|
16
|
+
|
|
17
|
+
Configure image, video, and attachment uploads independently through
|
|
18
|
+
`EditorUploadOptions`. Each `request` must honor the supplied `AbortSignal`,
|
|
19
|
+
report progress, and return an `EditorUploadResult`; keep transport and auth in
|
|
20
|
+
the application service. The component pipeline is
|
|
21
|
+
`validate -> transform -> request -> insert` for selection, drag/drop, and
|
|
22
|
+
pasted media, so do not bypass it with direct DOM insertion.
|
|
23
|
+
|
|
24
|
+
Treat initial HTML, pasted content, and source-mode edits as untrusted. Keep the
|
|
25
|
+
package sanitizer enabled and sanitize again on the server before persistence or
|
|
26
|
+
rendering. Use exposed methods such as `focus`, `setContent`, `retryUpload`, and
|
|
27
|
+
`cancelUpload` through a typed template ref, and handle upload events for
|
|
28
|
+
telemetry without duplicating upload state.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: use-og-form
|
|
3
|
+
description: Build schema-driven create, edit, and readonly business forms with @origen-ui/form. Use for typed fields, permissions, validation, linkage, async options, custom renderers, and submission transforms.
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
globs:
|
|
6
|
+
- 'packages/form/**'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Use OgForm
|
|
10
|
+
|
|
11
|
+
Use `FormField<T>` with `prop: keyof T & string`. Prefer visible, disabled, readonly,
|
|
12
|
+
dependencies plus linkage, compute, valueChange, or validators for cross-field behavior.
|
|
13
|
+
Use `type: 'custom'` with an instance `RendererRegistry`; unknown renderers must fail.
|
|
14
|
+
Custom controls must update the supplied model. Do not use removed `resetFields` or
|
|
15
|
+
`dependsOn` APIs.
|