@jskit-ai/agent-docs 0.1.149 → 0.1.151
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/guide/agent/app-setup/existing-application-migration.md +8 -6
- package/guide/agent/app-setup/initial-scaffolding.md +9 -7
- package/guide/agent/app-setup/quickstart.md +9 -6
- package/guide/agent/framework/application-operations.md +91 -0
- package/guide/agent/framework/crud-operations.md +83 -0
- package/guide/agent/framework/material-3.md +113 -0
- package/guide/agent/framework/ui-operations.md +79 -0
- package/guide/agent/index.md +13 -3
- package/package.json +1 -1
- package/patterns/feature-package/example/booking-engine/package.json +1 -1
- package/patterns/minimal-foundation/PATTERN.md +2 -0
- package/patterns/minimal-foundation/example/AGENTS.md +12 -8
- package/patterns/minimal-foundation/example/Procfile +0 -1
- package/patterns/minimal-foundation/example/package.json +4 -5
- package/patterns/minimal-foundation/example/src/pages/home/index.vue +0 -27
- package/patterns/minimal-foundation/example/tests/e2e/base-shell.spec.ts +1 -1
- package/patterns/page-scaffolding.md +5 -3
- package/patterns/shell-foundation/PATTERN.md +2 -0
- package/patterns/shell-foundation/example/AGENTS.md +12 -8
- package/patterns/shell-foundation/example/Procfile +0 -1
- package/patterns/shell-foundation/example/package.json +5 -6
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/patterns/shell-foundation/example/src/pages/home/index.vue +5 -31
- package/patterns/shell-foundation/example/src/pages/home/settings/general/index.vue +3 -6
- package/patterns/shell-foundation/example/src/pages/home/settings.vue +0 -19
- package/patterns/shell-foundation/example/tests/e2e/base-shell.spec.ts +1 -1
- package/patterns/ui-contract.md +2 -0
- package/patterns/ui-testing.md +1 -1
- package/reference/autogen/PATTERN_INDEX.md +61 -61
- package/skills/jskit/SKILL.md +8 -5
- package/skills/jskit/references/app-operations.md +12 -11
- package/skills/jskit/references/crud-operations.md +10 -6
- package/skills/jskit/references/existing-application-migration.md +9 -12
- package/skills/jskit/references/material-3.md +5 -2
- package/skills/jskit/references/pattern-index.md +61 -61
- package/skills/jskit/references/patterns/app/minimal-foundation/PATTERN.md +107 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/.nvmrc +1 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +21 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/Procfile +1 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/app.json +14 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/bin/develop.js +71 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/bin/server.js +8 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/config/public.js +40 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/config/server.js +1 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/config/surfaceAccessPolicies.js +3 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/eslint.config.mjs +19 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/favicon.svg +7 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/gitignore +9 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/index.html +13 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/jsconfig.json +8 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +62 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/packages/main/package.json +42 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/packages/main/src/shared/index.js +10 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/packages/main/src/shared/schemas/index.js +22 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/playwright.config.mjs +31 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/runtimeEnv.js +45 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/surfaceRuntime.js +10 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server.js +195 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/App.vue +13 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/main.js +85 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/pages/home/index.vue +21 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/pages/home.vue +13 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/views/NotFound.vue +13 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/tests/client/smoke.vitest.js +7 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/tests/e2e/base-shell.spec.ts +23 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/tests/server/smoke.test.js +16 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/vite.config.mjs +80 -0
- package/skills/jskit/references/patterns/app/shell-foundation/PATTERN.md +113 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/.nvmrc +1 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +21 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/Procfile +1 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/app.json +14 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/bin/develop.js +71 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/bin/server.js +8 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/config/public.js +40 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/config/server.js +1 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/config/surfaceAccessPolicies.js +3 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/eslint.config.mjs +19 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/favicon.svg +7 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/gitignore +9 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/index.html +13 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/jsconfig.json +8 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +64 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +56 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/client/index.js +9 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/client/providers/MainClientProvider.js +18 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/shared/index.js +10 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/shared/schemas/index.js +22 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/playwright.config.mjs +31 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/runtimeEnv.js +45 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/surfaceRuntime.js +10 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server.js +195 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/App.vue +11 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/ShellLayout.vue +12 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/menus/MenuLinkItem.vue +30 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/menus/SurfaceAwareMenuLinkItem.vue +42 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/menus/TabLinkItem.vue +42 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/error.js +19 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/main.js +85 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/index.vue +90 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/settings/general/index.vue +37 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/settings/index.vue +7 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/settings.vue +90 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home.vue +20 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/placement.js +56 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/placementTopology.js +149 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/views/NotFound.vue +13 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/client/smoke.vitest.js +7 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/e2e/adaptive-shell.spec.ts +10 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/e2e/base-shell.spec.ts +23 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/server/smoke.test.js +16 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/vite.config.mjs +80 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/PATTERN.md +77 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/config/public.js +19 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/config/server.js +9 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/src/pages/admin/assistant/index.vue +7 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/src/pages/admin/settings/assistant/index.vue +7 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/src/placement.js +38 -0
- package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +90 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/pages/auth/login.vue +17 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/pages/auth/reset-password.vue +17 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/pages/auth/signout.vue +17 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/runtime/authGuardRuntime.js +7 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/runtime/authHttpClient.js +1 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/runtime/useSignOut.js +1 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/views/auth/LoginView.vue +7 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/views/auth/ResetPasswordView.vue +7 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/views/auth/SignOutView.vue +7 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/tools/preview-identity +5 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/PATTERN.md +67 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/example/.env.example +4 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/example/config/server.js +11 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +7 -0
- package/skills/jskit/references/patterns/console/console-surface/PATTERN.md +59 -0
- package/skills/jskit/references/patterns/console/console-surface/example/src/pages/console/index.vue +43 -0
- package/skills/jskit/references/patterns/console/console-surface/example/src/pages/console/settings/index.vue +16 -0
- package/skills/jskit/references/patterns/console/console-surface/example/src/pages/console/settings.vue +81 -0
- package/skills/jskit/references/patterns/console/console-surface/example/src/pages/console.vue +20 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/PATTERN.md +89 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookEditPage.vue +52 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookFormFields.vue +52 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookListPage.vue +50 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookNewPage.vue +43 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookViewPage.vue +49 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/formFields.js +31 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/listExtensions.js +9 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/PATTERN.md +160 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/migrations/20260815000000_books.cjs +22 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/package.json +41 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/server/BooksFeature.js +13 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/bookResource.js +83 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/index.js +1 -0
- package/skills/jskit/references/patterns/crud/resource-contract/PATTERN.md +102 -0
- package/skills/jskit/references/patterns/crud/resource-contract/example/bookResource.js +87 -0
- package/skills/jskit/references/patterns/database/mysql-application/PATTERN.md +80 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/.env.example +5 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/.github/workflows/verify.yml +39 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/knexfile.js +11 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +13 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/scripts/prepare-database.js +3 -0
- package/skills/jskit/references/patterns/database/postgres-application/PATTERN.md +80 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/.env.example +5 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/.github/workflows/verify.yml +38 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/knexfile.js +11 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +13 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/scripts/prepare-database.js +3 -0
- package/skills/jskit/references/patterns/mobile/android-application/PATTERN.md +71 -0
- package/skills/jskit/references/patterns/mobile/android-application/example/capacitor.config.json +10 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +69 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/example/.env.example +1 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +8 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/example/src/placement.js +17 -0
- package/skills/jskit/references/patterns/server/feature-package/PATTERN.md +108 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +48 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/BookingEngineProvider.js +33 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/actions.js +26 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/inputSchemas.js +19 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/AvailabilityEngineProvider.js +31 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/InvoiceRollupProvider.js +36 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/customKnexRepository.js +34 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/orchestratorService.js +23 -0
- package/skills/jskit/references/patterns/shell/application-shell/PATTERN.md +67 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/expected-existing/src/App.vue +13 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/expected-existing/src/pages/home/index.vue +21 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/expected-existing/src/pages/home.vue +13 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/App.vue +11 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/components/ShellLayout.vue +13 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/components/menus/MenuLinkItem.vue +30 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/components/menus/SurfaceAwareMenuLinkItem.vue +42 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/components/menus/TabLinkItem.vue +42 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/error.js +19 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/index.vue +80 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/settings/general/index.vue +37 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/settings/index.vue +7 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/settings.vue +90 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home.vue +20 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/placement.js +56 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/placementTopology.js +149 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/tests/e2e/adaptive-shell.spec.ts +10 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/PATTERN.md +77 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/packages/main/src/client/providers/MainClientProvider.js +14 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/components/SyncStatusElement.vue +16 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/pages/home/reports/activity.vue +7 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/pages/home/reports/index.vue +7 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/pages/home/reports/overview.vue +7 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/pages/home/reports.vue +25 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/placement.js +52 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/placementTopology.js +29 -0
- package/skills/jskit/references/patterns/users/account-settings/PATTERN.md +63 -0
- package/skills/jskit/references/patterns/users/account-settings/example/src/components/account/settings/AccountSettingsNotificationsSection.vue +67 -0
- package/skills/jskit/references/patterns/users/account-settings/example/src/components/account/settings/AccountSettingsPreferencesSection.vue +137 -0
- package/skills/jskit/references/patterns/users/account-settings/example/src/components/account/settings/AccountSettingsProfileSection.vue +106 -0
- package/skills/jskit/references/patterns/users/account-settings/example/src/pages/account/index.vue +17 -0
- package/skills/jskit/references/patterns/users/user-administration-server/PATTERN.md +64 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +42 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/server/UsersFeature.js +13 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/index.js +1 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/userResource.js +69 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +43 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/UsersWorkspaceFeature.js +22 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/index.js +1 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/userResource.js +56 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/PATTERN.md +60 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/config/roles.js +27 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/packages/main/src/server/email/workspaceInviteEmail.js +23 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/PATTERN.md +65 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/packages/main/src/client/components/AccountPendingInvitesCue.vue +106 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/packages/main/src/client/components/AccountSettingsInvitesSection.vue +7 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/components/WorkspaceNotFoundCard.vue +42 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/composables/useWorkspaceNotFoundState.js +41 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/admin/members/index.vue +7 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/admin/workspace/settings/index.vue +15 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/admin/workspace/settings.vue +81 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/invite/[token].vue +7 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/surfaces/admin/index.vue +58 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/surfaces/admin/root.vue +20 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/surfaces/app/index.vue +31 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/surfaces/app/root.vue +20 -0
- package/skills/jskit/references/ui-operations.md +7 -4
- package/templates/app/AGENTS.md +12 -8
package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/runtimeEnv.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { surfaceRuntime } from "./surfaceRuntime.js";
|
|
3
|
+
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
|
|
6
|
+
function toPort(value, fallback = 3000) {
|
|
7
|
+
const parsed = Number.parseInt(String(value || "").trim(), 10);
|
|
8
|
+
if (Number.isInteger(parsed) && parsed > 0) {
|
|
9
|
+
return parsed;
|
|
10
|
+
}
|
|
11
|
+
return fallback;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let envLoaded = false;
|
|
15
|
+
|
|
16
|
+
function ensureRuntimeEnvLoaded() {
|
|
17
|
+
if (envLoaded) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const dotenvModule = require("dotenv");
|
|
22
|
+
const loadDotEnv = dotenvModule?.config;
|
|
23
|
+
if (typeof loadDotEnv === "function") {
|
|
24
|
+
loadDotEnv();
|
|
25
|
+
}
|
|
26
|
+
} catch {
|
|
27
|
+
// dotenv is optional in base-shell; bundles can add it when needed.
|
|
28
|
+
}
|
|
29
|
+
envLoaded = true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function resolveRuntimeEnv() {
|
|
33
|
+
ensureRuntimeEnvLoaded();
|
|
34
|
+
const serverSurface = surfaceRuntime.normalizeSurfaceMode(
|
|
35
|
+
process.env.JSKIT_SERVER_SURFACE || process.env.SERVER_SURFACE
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
...process.env,
|
|
39
|
+
SERVER_SURFACE: serverSurface,
|
|
40
|
+
PORT: toPort(process.env.PORT, 3000),
|
|
41
|
+
HOST: String(process.env.HOST || "").trim() || "0.0.0.0"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { resolveRuntimeEnv };
|
package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/surfaceRuntime.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createSurfaceRuntime } from "@jskit-ai/kernel/shared/surface/runtime";
|
|
2
|
+
import { config } from "../../config/public.js";
|
|
3
|
+
|
|
4
|
+
const surfaceRuntime = createSurfaceRuntime({
|
|
5
|
+
allMode: config.surfaceModeAll,
|
|
6
|
+
surfaces: config.surfaceDefinitions,
|
|
7
|
+
defaultSurfaceId: config.surfaceDefaultId
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export { surfaceRuntime };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import Fastify from "fastify";
|
|
2
|
+
import fastifyStatic from "@fastify/static";
|
|
3
|
+
import { resolveRuntimeEnv } from "./server/lib/runtimeEnv.js";
|
|
4
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import {
|
|
7
|
+
createInstalledRuntime,
|
|
8
|
+
registerSurfaceRequestConstraint,
|
|
9
|
+
resolveRuntimeProfileFromSurface
|
|
10
|
+
} from "@jskit-ai/kernel/server/platform";
|
|
11
|
+
import { loadAppConfigFromAppRoot } from "@jskit-ai/kernel/server/support";
|
|
12
|
+
import { matchesPathPrefix, normalizePathname } from "@jskit-ai/kernel/shared/surface/paths";
|
|
13
|
+
import { surfaceRuntime } from "./server/lib/surfaceRuntime.js";
|
|
14
|
+
|
|
15
|
+
const SPA_INDEX_FILE = "index.html";
|
|
16
|
+
const API_BASE_PATH = "/api";
|
|
17
|
+
const STATIC_GLOBAL_UI_PATHS = Object.freeze([
|
|
18
|
+
"/assets",
|
|
19
|
+
"/favicon.svg",
|
|
20
|
+
"/favicon.ico",
|
|
21
|
+
"/robots.txt",
|
|
22
|
+
"/manifest.webmanifest"
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
function toRequestPathname(urlValue) {
|
|
26
|
+
const rawUrl = String(urlValue || "").trim() || "/";
|
|
27
|
+
try {
|
|
28
|
+
return normalizePathname(new URL(rawUrl, "http://localhost").pathname || "/");
|
|
29
|
+
} catch {
|
|
30
|
+
return normalizePathname(rawUrl.split("?")[0] || "/");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function isApiPath(pathname) {
|
|
35
|
+
return matchesPathPrefix(pathname, API_BASE_PATH);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function hasFileExtension(pathname) {
|
|
39
|
+
return path.extname(normalizePathname(pathname)) !== "";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function resolveGlobalUiPaths(runtimeGlobalUiPaths = []) {
|
|
43
|
+
const paths = new Set(Array.isArray(runtimeGlobalUiPaths) ? runtimeGlobalUiPaths : []);
|
|
44
|
+
for (const staticPath of STATIC_GLOBAL_UI_PATHS) {
|
|
45
|
+
paths.add(staticPath);
|
|
46
|
+
}
|
|
47
|
+
return [...paths];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function resolveStaticFilePath(pathname) {
|
|
51
|
+
const normalizedPathname = normalizePathname(pathname);
|
|
52
|
+
|
|
53
|
+
const relativePath = normalizedPathname.replace(/^\/+/, "");
|
|
54
|
+
if (!relativePath || relativePath.endsWith("/")) {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const normalizedRelativePath = path.posix.normalize(relativePath);
|
|
59
|
+
if (
|
|
60
|
+
!normalizedRelativePath ||
|
|
61
|
+
normalizedRelativePath === "." ||
|
|
62
|
+
normalizedRelativePath === ".." ||
|
|
63
|
+
normalizedRelativePath.startsWith("../") ||
|
|
64
|
+
normalizedRelativePath.includes("/../")
|
|
65
|
+
) {
|
|
66
|
+
return "";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return normalizedRelativePath;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function canServeStaticFile(distRoot, relativePath) {
|
|
73
|
+
if (!distRoot || !relativePath) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const normalizedDistRoot = path.resolve(distRoot);
|
|
78
|
+
const resolvedPath = path.resolve(normalizedDistRoot, relativePath);
|
|
79
|
+
if (!(resolvedPath === normalizedDistRoot || resolvedPath.startsWith(`${normalizedDistRoot}${path.sep}`))) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return existsSync(resolvedPath);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function createServer({ runtimeEnv = resolveRuntimeEnv() } = {}) {
|
|
87
|
+
const app = Fastify({
|
|
88
|
+
logger: true,
|
|
89
|
+
ajv: {
|
|
90
|
+
customOptions: {
|
|
91
|
+
allowUnionTypes: true
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
app.get("/api/health", async () => {
|
|
97
|
+
return {
|
|
98
|
+
ok: true,
|
|
99
|
+
app: "reading-room"
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
const appRoot = path.resolve(process.cwd());
|
|
103
|
+
const distRoot = path.resolve(appRoot, "dist");
|
|
104
|
+
const hasWebBuild = existsSync(path.resolve(distRoot, SPA_INDEX_FILE));
|
|
105
|
+
const spaDocument = hasWebBuild ? readFileSync(path.resolve(distRoot, SPA_INDEX_FILE), "utf8") : "";
|
|
106
|
+
const runtime = await createInstalledRuntime({
|
|
107
|
+
appRoot,
|
|
108
|
+
profile: resolveRuntimeProfileFromSurface({
|
|
109
|
+
surfaceRuntime,
|
|
110
|
+
serverSurface: runtimeEnv.SERVER_SURFACE
|
|
111
|
+
}),
|
|
112
|
+
config: await loadAppConfigFromAppRoot({ appRoot }),
|
|
113
|
+
env: runtimeEnv,
|
|
114
|
+
logger: app.log,
|
|
115
|
+
fastify: app
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
registerSurfaceRequestConstraint({
|
|
119
|
+
fastify: app,
|
|
120
|
+
surfaceRuntime,
|
|
121
|
+
serverSurface: runtimeEnv.SERVER_SURFACE,
|
|
122
|
+
globalUiPaths: resolveGlobalUiPaths(runtime?.globalUiPaths || [])
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (hasWebBuild) {
|
|
126
|
+
await app.register(fastifyStatic, {
|
|
127
|
+
root: distRoot,
|
|
128
|
+
index: false,
|
|
129
|
+
serve: false
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
app.log.warn("Frontend build not found (dist/index.html). Page routes will return 404 until `npm run build`.");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
app.setNotFoundHandler(async (request, reply) => {
|
|
136
|
+
const pathname = toRequestPathname(request?.url);
|
|
137
|
+
const method = String(request?.method || "GET")
|
|
138
|
+
.trim()
|
|
139
|
+
.toUpperCase();
|
|
140
|
+
if (isApiPath(pathname) || (method !== "GET" && method !== "HEAD")) {
|
|
141
|
+
return reply.code(404).send({
|
|
142
|
+
message: `Route ${method}:${pathname} not found`,
|
|
143
|
+
error: "Not Found",
|
|
144
|
+
statusCode: 404
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (hasFileExtension(pathname)) {
|
|
148
|
+
const staticFilePath = resolveStaticFilePath(pathname);
|
|
149
|
+
if (hasWebBuild && staticFilePath && canServeStaticFile(distRoot, staticFilePath)) {
|
|
150
|
+
return reply.sendFile(staticFilePath);
|
|
151
|
+
}
|
|
152
|
+
return reply.code(404).send({
|
|
153
|
+
message: `Route ${method}:${pathname} not found`,
|
|
154
|
+
error: "Not Found",
|
|
155
|
+
statusCode: 404
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (!hasWebBuild) {
|
|
159
|
+
return reply.code(404).send({
|
|
160
|
+
error: "Frontend build is not available. Run `npm run build`."
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return reply.type("text/html; charset=utf-8").send(spaDocument);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
app.log.info(
|
|
167
|
+
{
|
|
168
|
+
surface: surfaceRuntime.normalizeSurfaceMode(runtimeEnv.SERVER_SURFACE),
|
|
169
|
+
providerPackages: runtime.providerPackageOrder,
|
|
170
|
+
packageOrder: runtime.packageOrder,
|
|
171
|
+
capabilities: runtime.diagnostics.capabilityIds
|
|
172
|
+
},
|
|
173
|
+
"Started JSKIT installed runtime."
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
return app;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function startServer(options = {}) {
|
|
180
|
+
const runtimeEnv = resolveRuntimeEnv();
|
|
181
|
+
const configuredPort = options?.port === undefined ? runtimeEnv.PORT : Number(options.port);
|
|
182
|
+
const port = Number.isInteger(configuredPort) && configuredPort >= 0 ? configuredPort : runtimeEnv.PORT;
|
|
183
|
+
const host = String(options?.host || "").trim() || runtimeEnv.HOST;
|
|
184
|
+
const app = await createServer({
|
|
185
|
+
runtimeEnv: {
|
|
186
|
+
...runtimeEnv,
|
|
187
|
+
HOST: host,
|
|
188
|
+
PORT: port
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
await app.listen({ port, host });
|
|
192
|
+
return app;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export { createServer, startServer };
|
package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/ShellLayout.vue
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { h } from "vue";
|
|
3
|
+
import PackageShellLayout from "@jskit-ai/shell-web/client/components/ShellLayout";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: "ShellLayout",
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
setup(_, { attrs, slots }) {
|
|
9
|
+
return () => h(PackageShellLayout, attrs, slots);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ShellMenuLinkItem from "@jskit-ai/shell-web/client/components/ShellMenuLinkItem";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
label: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: ""
|
|
8
|
+
},
|
|
9
|
+
to: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ""
|
|
12
|
+
},
|
|
13
|
+
icon: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
exact: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<ShellMenuLinkItem v-bind="props" />
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ShellSurfaceAwareMenuLinkItem from "@jskit-ai/shell-web/client/components/ShellSurfaceAwareMenuLinkItem";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
label: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: ""
|
|
8
|
+
},
|
|
9
|
+
to: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ""
|
|
12
|
+
},
|
|
13
|
+
icon: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
surface: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
scopedSuffix: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "/"
|
|
24
|
+
},
|
|
25
|
+
unscopedSuffix: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "/"
|
|
28
|
+
},
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
exact: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<ShellSurfaceAwareMenuLinkItem v-bind="props" />
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ShellTabLinkItem from "@jskit-ai/shell-web/client/components/ShellTabLinkItem";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
label: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: ""
|
|
8
|
+
},
|
|
9
|
+
to: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ""
|
|
12
|
+
},
|
|
13
|
+
icon: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
surface: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
scopedSuffix: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "/"
|
|
24
|
+
},
|
|
25
|
+
unscopedSuffix: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "/"
|
|
28
|
+
},
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
exact: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<ShellTabLinkItem v-bind="props" />
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createDefaultErrorPolicy } from "@jskit-ai/shell-web/client/error";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* App-owned error handling contract.
|
|
5
|
+
* - intent chooses default presentation: resource-load, action-feedback, app-recoverable, blocking.
|
|
6
|
+
* - policy(event, ctx): decide channel + presenter + message.
|
|
7
|
+
* - defaultPresenterId: used when policy does not set presenterId.
|
|
8
|
+
* - presenters: optional custom presenters registered at boot.
|
|
9
|
+
*/
|
|
10
|
+
export default Object.freeze({
|
|
11
|
+
defaultPresenterId: "material.snackbar",
|
|
12
|
+
policy: createDefaultErrorPolicy({
|
|
13
|
+
resourceLoadChannel: "silent",
|
|
14
|
+
actionFeedbackChannel: "snackbar",
|
|
15
|
+
appRecoverableChannel: "banner",
|
|
16
|
+
blockingChannel: "dialog"
|
|
17
|
+
}),
|
|
18
|
+
presenters: []
|
|
19
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createApp } from "vue";
|
|
2
|
+
import { createPinia } from "pinia";
|
|
3
|
+
import { QueryClient, VueQueryPlugin } from "@tanstack/vue-query";
|
|
4
|
+
import { createRouter, createWebHistory } from "vue-router/auto";
|
|
5
|
+
import { routes } from "vue-router/auto-routes";
|
|
6
|
+
import "vuetify/styles";
|
|
7
|
+
import { createVuetify } from "vuetify";
|
|
8
|
+
import { aliases as mdiAliases, mdi } from "vuetify/iconsets/mdi-svg";
|
|
9
|
+
import App from "./App.vue";
|
|
10
|
+
import NotFoundView from "./views/NotFound.vue";
|
|
11
|
+
import { bootInstalledClientModules } from "virtual:jskit-client-bootstrap";
|
|
12
|
+
import { createSurfaceRuntime } from "@jskit-ai/kernel/shared/surface/runtime";
|
|
13
|
+
import {
|
|
14
|
+
shouldRetryTransientQueryFailure,
|
|
15
|
+
transientQueryRetryDelay
|
|
16
|
+
} from "@jskit-ai/kernel/shared/support";
|
|
17
|
+
import {
|
|
18
|
+
bootstrapClientShellApp,
|
|
19
|
+
createShellRouter
|
|
20
|
+
} from "@jskit-ai/kernel/client";
|
|
21
|
+
import { config } from "../config/public.js";
|
|
22
|
+
|
|
23
|
+
const surfaceRuntime = createSurfaceRuntime({
|
|
24
|
+
allMode: config.surfaceModeAll,
|
|
25
|
+
surfaces: config.surfaceDefinitions,
|
|
26
|
+
defaultSurfaceId: config.surfaceDefaultId
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const surfaceMode = surfaceRuntime.normalizeSurfaceMode(import.meta.env.VITE_SURFACE);
|
|
30
|
+
const { router, fallbackRoute } = createShellRouter({
|
|
31
|
+
createRouter,
|
|
32
|
+
history: createWebHistory(),
|
|
33
|
+
routes,
|
|
34
|
+
surfaceRuntime,
|
|
35
|
+
surfaceMode,
|
|
36
|
+
notFoundComponent: NotFoundView,
|
|
37
|
+
guard: {
|
|
38
|
+
surfaceDefinitions: config.surfaceDefinitions,
|
|
39
|
+
defaultSurfaceId: config.surfaceDefaultId,
|
|
40
|
+
webRootAllowed: config.webRootAllowed
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const vuetify = createVuetify({
|
|
45
|
+
theme: {
|
|
46
|
+
defaultTheme: "light"
|
|
47
|
+
},
|
|
48
|
+
icons: {
|
|
49
|
+
defaultSet: "mdi",
|
|
50
|
+
aliases: mdiAliases,
|
|
51
|
+
sets: { mdi }
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const pinia = createPinia();
|
|
55
|
+
const queryClient = new QueryClient({
|
|
56
|
+
defaultOptions: {
|
|
57
|
+
queries: {
|
|
58
|
+
refetchOnWindowFocus: false,
|
|
59
|
+
refetchOnReconnect: true,
|
|
60
|
+
retry: shouldRetryTransientQueryFailure,
|
|
61
|
+
retryDelay: transientQueryRetryDelay
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
void bootstrapClientShellApp({
|
|
67
|
+
createApp,
|
|
68
|
+
rootComponent: App,
|
|
69
|
+
appConfig: config,
|
|
70
|
+
appPlugins: [
|
|
71
|
+
pinia,
|
|
72
|
+
[VueQueryPlugin, { queryClient }],
|
|
73
|
+
vuetify
|
|
74
|
+
],
|
|
75
|
+
pinia,
|
|
76
|
+
queryClient,
|
|
77
|
+
router,
|
|
78
|
+
bootClientModules: bootInstalledClientModules,
|
|
79
|
+
surfaceRuntime,
|
|
80
|
+
surfaceMode,
|
|
81
|
+
env: import.meta.env,
|
|
82
|
+
fallbackRoute
|
|
83
|
+
}).catch((error) => {
|
|
84
|
+
console.error("Failed to bootstrap client app.", error);
|
|
85
|
+
});
|
package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/index.vue
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useQuery } from "@tanstack/vue-query";
|
|
4
|
+
|
|
5
|
+
const healthQuery = useQuery({
|
|
6
|
+
queryKey: ["shell-web", "health"],
|
|
7
|
+
queryFn: async () => {
|
|
8
|
+
const response = await fetch("/api/health");
|
|
9
|
+
if (!response.ok) {
|
|
10
|
+
throw new Error("Health request failed.");
|
|
11
|
+
}
|
|
12
|
+
return response.json();
|
|
13
|
+
},
|
|
14
|
+
refetchOnWindowFocus: false
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const health = computed(() => {
|
|
18
|
+
if (healthQuery.error.value) {
|
|
19
|
+
return "unreachable";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return healthQuery.data.value?.ok ? "ok" : "unhealthy";
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const healthPending = computed(
|
|
26
|
+
() => healthQuery.isPending.value || healthQuery.isFetching.value
|
|
27
|
+
);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<section class="home-surface-screen d-flex flex-column ga-4">
|
|
32
|
+
<div class="home-surface-screen__actions">
|
|
33
|
+
<v-btn color="primary" variant="flat" to="/home/settings/general">Settings</v-btn>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<v-sheet rounded="lg" border class="home-surface-screen__panel">
|
|
37
|
+
<div class="home-surface-screen__status">
|
|
38
|
+
<span class="text-caption text-medium-emphasis">Service health</span>
|
|
39
|
+
<v-skeleton-loader
|
|
40
|
+
v-if="healthPending"
|
|
41
|
+
aria-label="Loading service health"
|
|
42
|
+
class="home-surface-screen__health-skeleton"
|
|
43
|
+
type="text"
|
|
44
|
+
/>
|
|
45
|
+
<strong v-else>{{ health }}</strong>
|
|
46
|
+
</div>
|
|
47
|
+
<v-divider vertical class="d-none d-sm-block" />
|
|
48
|
+
<div class="home-surface-screen__status">
|
|
49
|
+
<span class="text-caption text-medium-emphasis">Route</span>
|
|
50
|
+
<strong>/home</strong>
|
|
51
|
+
</div>
|
|
52
|
+
</v-sheet>
|
|
53
|
+
</section>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<style scoped>
|
|
57
|
+
.home-surface-screen {
|
|
58
|
+
--home-surface-panel-padding: 1rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.home-surface-screen__actions {
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: flex-end;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.home-surface-screen__panel {
|
|
67
|
+
align-items: stretch;
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-wrap: wrap;
|
|
70
|
+
gap: 1rem;
|
|
71
|
+
padding: var(--home-surface-panel-padding);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.home-surface-screen__status {
|
|
75
|
+
display: grid;
|
|
76
|
+
gap: 0.15rem;
|
|
77
|
+
min-width: 9rem;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.home-surface-screen__health-skeleton {
|
|
81
|
+
max-width: 5rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (max-width: 640px) {
|
|
85
|
+
.home-surface-screen__actions :deep(.v-btn) {
|
|
86
|
+
min-height: 48px;
|
|
87
|
+
width: 100%;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useShellLayoutState } from "@jskit-ai/shell-web/client/composables/useShellLayoutState";
|
|
4
|
+
|
|
5
|
+
const { drawerDefaultOpen, setDrawerDefaultOpen } = useShellLayoutState();
|
|
6
|
+
|
|
7
|
+
const drawerDefaultOpenModel = computed({
|
|
8
|
+
get() {
|
|
9
|
+
return drawerDefaultOpen.value;
|
|
10
|
+
},
|
|
11
|
+
set(value) {
|
|
12
|
+
setDrawerDefaultOpen(Boolean(value));
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<section class="settings-general-screen d-flex flex-column ga-4">
|
|
19
|
+
<p class="text-body-2 text-medium-emphasis mb-0">
|
|
20
|
+
On wider screens, collapsed navigation remains available as a rail. Phone layouts close the drawer and keep primary navigation in the bottom bar.
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<v-switch
|
|
24
|
+
v-model="drawerDefaultOpenModel"
|
|
25
|
+
color="primary"
|
|
26
|
+
inset
|
|
27
|
+
hide-details="auto"
|
|
28
|
+
label="Start with expanded navigation on wider screens"
|
|
29
|
+
/>
|
|
30
|
+
</section>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
.settings-general-screen :deep(.v-switch) {
|
|
35
|
+
min-height: 48px;
|
|
36
|
+
}
|
|
37
|
+
</style>
|