@wrikka/solid-framework 0.0.0-stage → 0.15.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/README.md +104 -3
- package/dist/vite.d.ts +661 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +10 -0
- package/dist/vite.js.map +1 -0
- package/package.json +247 -5
- package/src/actions/index.ts +5 -0
- package/src/actions/modules/action/adapters/http/handler.ts +80 -0
- package/src/actions/modules/action/application/index.ts +1 -0
- package/src/actions/modules/action/application/usecases/create-action.ts +92 -0
- package/src/actions/modules/action/application/usecases/index.ts +2 -0
- package/src/actions/modules/action/application/usecases/registry.ts +20 -0
- package/src/actions/modules/action/index.ts +2 -0
- package/src/actions/presentation/index.ts +1 -0
- package/src/actions/presentation/useSubmission.ts +46 -0
- package/src/actions/types/index.ts +35 -0
- package/src/app/index.ts +126 -0
- package/src/app/modules/ai/domain/operations/handler.ts +46 -0
- package/src/app/modules/ai/domain/operations/llms.ts +54 -0
- package/src/app/modules/ai/domain/operations/mcp.ts +134 -0
- package/src/app/modules/ai/index.ts +3 -0
- package/src/app/modules/api-docs/domain/operations/openapi.ts +113 -0
- package/src/app/modules/api-docs/index.ts +1 -0
- package/src/app/modules/app-def/index.ts +225 -0
- package/src/app/modules/auth/application/usecases/auth.ts +161 -0
- package/src/app/modules/auth/application/usecases/oauth.ts +105 -0
- package/src/app/modules/auth/index.ts +2 -0
- package/src/app/modules/cache/adapters/edge-kv.ts +55 -0
- package/src/app/modules/cache/adapters/fs.ts +58 -0
- package/src/app/modules/cache/adapters/memory.ts +13 -0
- package/src/app/modules/cache/domain/operations/tags.ts +114 -0
- package/src/app/modules/cache/index.ts +7 -0
- package/src/app/modules/cache/ports/store.ts +14 -0
- package/src/app/modules/config/domain/index.ts +1 -0
- package/src/app/modules/config/domain/models/config.ts +72 -0
- package/src/app/modules/config/domain/models/index.ts +1 -0
- package/src/app/modules/config/index.ts +1 -0
- package/src/app/modules/content/domain/operations/collection.ts +109 -0
- package/src/app/modules/content/index.ts +8 -0
- package/src/app/modules/content/presentation/Markdown.tsx +78 -0
- package/src/app/modules/conventions/domain/index.ts +1 -0
- package/src/app/modules/conventions/domain/operations/index.ts +1 -0
- package/src/app/modules/conventions/domain/operations/scan.ts +73 -0
- package/src/app/modules/conventions/index.ts +1 -0
- package/src/app/modules/db/application/usecases/db.ts +49 -0
- package/src/app/modules/db/index.ts +1 -0
- package/src/app/modules/deploy/adapters/aws-lambda.ts +54 -0
- package/src/app/modules/deploy/adapters/bun.ts +15 -0
- package/src/app/modules/deploy/adapters/cloudflare.ts +15 -0
- package/src/app/modules/deploy/adapters/deno.ts +15 -0
- package/src/app/modules/deploy/adapters/netlify.ts +18 -0
- package/src/app/modules/deploy/adapters/node.ts +63 -0
- package/src/app/modules/deploy/adapters/vercel.ts +22 -0
- package/src/app/modules/deploy/domain/models/preset.ts +38 -0
- package/src/app/modules/deploy/domain/operations/presets.ts +92 -0
- package/src/app/modules/deploy/index.ts +9 -0
- package/src/app/modules/draft/domain/operations/draft-mode.ts +125 -0
- package/src/app/modules/draft/index.ts +1 -0
- package/src/app/modules/env/domain/operations/create-env.ts +156 -0
- package/src/app/modules/env/index.ts +1 -0
- package/src/app/modules/file-routes/application/usecases/api-client.ts +120 -0
- package/src/app/modules/file-routes/domain/errors.ts +61 -0
- package/src/app/modules/file-routes/domain/index.ts +63 -0
- package/src/app/modules/file-routes/domain/models/index.ts +1 -0
- package/src/app/modules/file-routes/domain/models/route.ts +38 -0
- package/src/app/modules/file-routes/domain/operations/actions.ts +107 -0
- package/src/app/modules/file-routes/domain/operations/api.ts +87 -0
- package/src/app/modules/file-routes/domain/operations/codegen.ts +76 -0
- package/src/app/modules/file-routes/domain/operations/content.ts +61 -0
- package/src/app/modules/file-routes/domain/operations/defer.ts +245 -0
- package/src/app/modules/file-routes/domain/operations/index.ts +65 -0
- package/src/app/modules/file-routes/domain/operations/loader.ts +138 -0
- package/src/app/modules/file-routes/domain/operations/manifest.ts +229 -0
- package/src/app/modules/file-routes/domain/operations/match.ts +75 -0
- package/src/app/modules/file-routes/domain/operations/static-params.ts +58 -0
- package/src/app/modules/file-routes/domain/operations/typed.ts +127 -0
- package/src/app/modules/file-routes/index.ts +143 -0
- package/src/app/modules/file-routes/presentation/DevtoolsOverlay.tsx +234 -0
- package/src/app/modules/file-routes/presentation/FileRoutes.ts +254 -0
- package/src/app/modules/file-routes/presentation/Form.tsx +122 -0
- package/src/app/modules/file-routes/presentation/Link.tsx +132 -0
- package/src/app/modules/file-routes/presentation/ServerComponent.tsx +100 -0
- package/src/app/modules/file-routes/presentation/content-page.tsx +26 -0
- package/src/app/modules/file-routes/presentation/dev-events.ts +112 -0
- package/src/app/modules/file-routes/presentation/index.ts +98 -0
- package/src/app/modules/file-routes/presentation/loader-cache.ts +96 -0
- package/src/app/modules/file-routes/presentation/loader-data.ts +207 -0
- package/src/app/modules/file-routes/presentation/location.ts +217 -0
- package/src/app/modules/file-routes/presentation/normalize-route.ts +155 -0
- package/src/app/modules/file-routes/presentation/page-tree.ts +211 -0
- package/src/app/modules/file-routes/presentation/route-contexts.ts +89 -0
- package/src/app/modules/file-routes/presentation/route-def.ts +154 -0
- package/src/app/modules/file-routes/presentation/route-fallbacks.ts +66 -0
- package/src/app/modules/file-routes/presentation/route-modules.ts +138 -0
- package/src/app/modules/file-routes/presentation/slot.tsx +43 -0
- package/src/app/modules/file-routes/presentation/status.ts +13 -0
- package/src/app/modules/file-routes/presentation/use-action.ts +81 -0
- package/src/app/modules/file-routes/presentation/use-optimistic.ts +50 -0
- package/src/app/modules/file-routes/presentation/use-preload.ts +38 -0
- package/src/app/modules/file-routes/presentation/use-route.ts +254 -0
- package/src/app/modules/flash/domain/operations/flash.ts +70 -0
- package/src/app/modules/flash/index.ts +1 -0
- package/src/app/modules/fonts/domain/operations/font.ts +91 -0
- package/src/app/modules/fonts/index.ts +1 -0
- package/src/app/modules/i18n/domain/operations/i18n-middleware.ts +76 -0
- package/src/app/modules/i18n/domain/operations/locale.ts +39 -0
- package/src/app/modules/i18n/index.ts +3 -0
- package/src/app/modules/i18n/presentation/use-locale.ts +16 -0
- package/src/app/modules/middleware/domain/operations/request-id.ts +33 -0
- package/src/app/modules/middleware/domain/operations/run.ts +29 -0
- package/src/app/modules/middleware/index.ts +7 -0
- package/src/app/modules/route-rules/domain/index.ts +1 -0
- package/src/app/modules/route-rules/domain/operations/ab-variant.ts +58 -0
- package/src/app/modules/route-rules/domain/operations/index.ts +4 -0
- package/src/app/modules/route-rules/domain/operations/match.ts +51 -0
- package/src/app/modules/route-rules/domain/operations/rate-limit.ts +63 -0
- package/src/app/modules/route-rules/domain/operations/security.ts +67 -0
- package/src/app/modules/route-rules/index.ts +1 -0
- package/src/app/modules/runtime-config/application/index.ts +1 -0
- package/src/app/modules/runtime-config/application/usecases/index.ts +1 -0
- package/src/app/modules/runtime-config/application/usecases/runtime-config.ts +42 -0
- package/src/app/modules/runtime-config/index.ts +1 -0
- package/src/app/modules/seo/domain/operations/og.ts +66 -0
- package/src/app/modules/seo/domain/operations/site.ts +106 -0
- package/src/app/modules/seo/index.ts +2 -0
- package/src/app/modules/server-entry/application/index.ts +1 -0
- package/src/app/modules/server-entry/application/usecases/create-app-server.ts +205 -0
- package/src/app/modules/server-entry/application/usecases/devtools-handler.ts +31 -0
- package/src/app/modules/server-entry/application/usecases/image-handler.ts +38 -0
- package/src/app/modules/server-entry/application/usecases/index.ts +3 -0
- package/src/app/modules/server-entry/application/usecases/ops-handler.ts +55 -0
- package/src/app/modules/server-entry/application/usecases/prerender-cache.ts +59 -0
- package/src/app/modules/server-entry/application/usecases/route-render.ts +276 -0
- package/src/app/modules/server-entry/application/usecases/routed-entry.ts +194 -0
- package/src/app/modules/server-entry/application/usecases/static-handler.ts +20 -0
- package/src/app/modules/server-entry/application/usecases/zone-handler.ts +37 -0
- package/src/app/modules/server-entry/index.ts +1 -0
- package/src/app/modules/session/index.ts +77 -0
- package/src/app/modules/static/domain/operations/serve.ts +88 -0
- package/src/app/modules/static/index.ts +1 -0
- package/src/app/presentation/App.tsx +34 -0
- package/src/app/presentation/define-config.ts +11 -0
- package/src/app/presentation/index.ts +3 -0
- package/src/app/presentation/providers.ts +80 -0
- package/src/app/types/index.ts +273 -0
- package/src/assets/adapters/sharp.ts +83 -0
- package/src/assets/index.ts +6 -0
- package/src/assets/modules/assets/domain/index.ts +1 -0
- package/src/assets/modules/assets/domain/operations/image.ts +67 -0
- package/src/assets/modules/assets/domain/operations/index.ts +2 -0
- package/src/assets/modules/assets/domain/operations/manifest.ts +29 -0
- package/src/assets/modules/assets/index.ts +1 -0
- package/src/assets/presentation/Image.tsx +90 -0
- package/src/assets/presentation/index.ts +1 -0
- package/src/assets/types/index.ts +21 -0
- package/src/cli/bin.ts +8 -0
- package/src/cli/commands.ts +145 -0
- package/src/cli/doctor.ts +111 -0
- package/src/cli/index.ts +3 -0
- package/src/cli/infra.ts +38 -0
- package/src/cli/migrate.ts +119 -0
- package/src/cli/nav.ts +164 -0
- package/src/cli/ops.ts +135 -0
- package/src/cli/routes.ts +240 -0
- package/src/cli/scaffold.ts +217 -0
- package/src/devtools/App.tsx +14 -0
- package/src/devtools/adapters/connector.ts +23 -0
- package/src/devtools/adapters/index.ts +4 -0
- package/src/devtools/index.ts +26 -0
- package/src/devtools/modules/component-inspector/application/index.ts +4 -0
- package/src/devtools/modules/component-inspector/application/usecases/component-inspector.ts +67 -0
- package/src/devtools/modules/component-inspector/application/usecases/index.ts +5 -0
- package/src/devtools/modules/component-inspector/application/usecases/useComponentInspector.ts +52 -0
- package/src/devtools/modules/component-inspector/domain/events/component-events.ts +37 -0
- package/src/devtools/modules/component-inspector/domain/events/index.ts +4 -0
- package/src/devtools/modules/component-inspector/domain/index.ts +7 -0
- package/src/devtools/modules/component-inspector/domain/models/component-node.ts +30 -0
- package/src/devtools/modules/component-inspector/domain/models/component-tree.ts +20 -0
- package/src/devtools/modules/component-inspector/domain/models/index.ts +5 -0
- package/src/devtools/modules/component-inspector/domain/operations/component-operations.ts +63 -0
- package/src/devtools/modules/component-inspector/domain/operations/index.ts +4 -0
- package/src/devtools/modules/component-inspector/index.ts +7 -0
- package/src/devtools/modules/devtools/application/index.ts +4 -0
- package/src/devtools/modules/devtools/application/usecases/devtools.ts +60 -0
- package/src/devtools/modules/devtools/application/usecases/index.ts +5 -0
- package/src/devtools/modules/devtools/application/usecases/useDevtools.ts +47 -0
- package/src/devtools/modules/devtools/domain/events/devtools-events.ts +56 -0
- package/src/devtools/modules/devtools/domain/events/index.ts +4 -0
- package/src/devtools/modules/devtools/domain/index.ts +8 -0
- package/src/devtools/modules/devtools/domain/models/devtools-state.ts +15 -0
- package/src/devtools/modules/devtools/domain/models/index.ts +4 -0
- package/src/devtools/modules/devtools/domain/operations/devtools-operations.ts +27 -0
- package/src/devtools/modules/devtools/domain/operations/index.ts +4 -0
- package/src/devtools/modules/devtools/domain/validators/devtools-validators.ts +36 -0
- package/src/devtools/modules/devtools/domain/validators/index.ts +4 -0
- package/src/devtools/modules/devtools/index.ts +7 -0
- package/src/devtools/modules/devtools/ports/connector.ts +10 -0
- package/src/devtools/modules/devtools/ports/index.ts +4 -0
- package/src/devtools/modules/timeline/application/index.ts +4 -0
- package/src/devtools/modules/timeline/application/usecases/index.ts +5 -0
- package/src/devtools/modules/timeline/application/usecases/timeline.ts +61 -0
- package/src/devtools/modules/timeline/application/usecases/useTimeline.ts +37 -0
- package/src/devtools/modules/timeline/domain/events/index.ts +4 -0
- package/src/devtools/modules/timeline/domain/events/timeline-events.ts +34 -0
- package/src/devtools/modules/timeline/domain/index.ts +7 -0
- package/src/devtools/modules/timeline/domain/models/index.ts +4 -0
- package/src/devtools/modules/timeline/domain/models/timeline-event.ts +27 -0
- package/src/devtools/modules/timeline/domain/operations/index.ts +4 -0
- package/src/devtools/modules/timeline/domain/operations/timeline-operations.ts +28 -0
- package/src/devtools/modules/timeline/index.ts +7 -0
- package/src/devtools/presentation/DevtoolsPanel.tsx +80 -0
- package/src/devtools/presentation/components/ComponentTreeView.tsx +79 -0
- package/src/devtools/presentation/components/StateInspector.tsx +70 -0
- package/src/devtools/presentation/components/TimelineView.tsx +52 -0
- package/src/devtools/presentation/components/index.ts +7 -0
- package/src/devtools/presentation/composables/index.ts +7 -0
- package/src/devtools/presentation/composables/useComponentInspector.ts +52 -0
- package/src/devtools/presentation/index.ts +5 -0
- package/src/devtools/shared/errors/index.ts +23 -0
- package/src/devtools/shared/index.ts +7 -0
- package/src/devtools/shared/types/index.ts +6 -0
- package/src/devtools/shared/types/option.ts +58 -0
- package/src/devtools/shared/types/result.ts +53 -0
- package/src/devtools/shared/utils/index.ts +32 -0
- package/src/devtools/style.css +2 -0
- package/src/head/index.ts +5 -0
- package/src/head/modules/head/application/index.ts +1 -0
- package/src/head/modules/head/application/usecases/head-manager.ts +68 -0
- package/src/head/modules/head/application/usecases/index.ts +1 -0
- package/src/head/modules/head/domain/index.ts +3 -0
- package/src/head/modules/head/domain/models/head-tag.ts +73 -0
- package/src/head/modules/head/domain/models/index.ts +1 -0
- package/src/head/modules/head/domain/operations/dedupe.ts +18 -0
- package/src/head/modules/head/domain/operations/index.ts +2 -0
- package/src/head/modules/head/domain/operations/render-tags.ts +43 -0
- package/src/head/modules/head/domain/validators/index.ts +12 -0
- package/src/head/modules/head/index.ts +3 -0
- package/src/head/modules/head/ports/index.ts +11 -0
- package/src/head/presentation/HeadProvider.tsx +42 -0
- package/src/head/presentation/Tags.tsx +90 -0
- package/src/head/presentation/head-context.ts +11 -0
- package/src/head/presentation/index.ts +3 -0
- package/src/head/presentation/useHead.ts +77 -0
- package/src/head/shared/index.ts +1 -0
- package/src/head/shared/types/index.ts +5 -0
- package/src/head/types/index.ts +47 -0
- package/src/hooks/adapters/config/constants.ts +12 -0
- package/src/hooks/adapters/config/index.ts +48 -0
- package/src/hooks/adapters/index.ts +13 -0
- package/src/hooks/adapters/monaco/index.ts +96 -0
- package/src/hooks/adapters/qr/index.ts +65 -0
- package/src/hooks/index.ts +21 -0
- package/src/hooks/modules/array/application/index.ts +2 -0
- package/src/hooks/modules/array/application/usecases/index.ts +123 -0
- package/src/hooks/modules/array/domain/events/index.ts +5 -0
- package/src/hooks/modules/array/domain/index.ts +3 -0
- package/src/hooks/modules/array/domain/models/index.ts +2 -0
- package/src/hooks/modules/array/domain/operations/create.ts +10 -0
- package/src/hooks/modules/array/domain/operations/index.ts +31 -0
- package/src/hooks/modules/array/domain/operations/modify.ts +61 -0
- package/src/hooks/modules/array/domain/operations/query.ts +36 -0
- package/src/hooks/modules/array/domain/validators/index.ts +5 -0
- package/src/hooks/modules/array/index.ts +5 -0
- package/src/hooks/modules/array/types/index.ts +9 -0
- package/src/hooks/modules/counter/application/index.ts +12 -0
- package/src/hooks/modules/counter/application/usecases/index.ts +156 -0
- package/src/hooks/modules/counter/domain/events/index.ts +6 -0
- package/src/hooks/modules/counter/domain/index.ts +21 -0
- package/src/hooks/modules/counter/domain/models/index.ts +2 -0
- package/src/hooks/modules/counter/domain/operations/calculate.ts +22 -0
- package/src/hooks/modules/counter/domain/operations/create.ts +22 -0
- package/src/hooks/modules/counter/domain/operations/index.ts +25 -0
- package/src/hooks/modules/counter/domain/operations/modify.ts +78 -0
- package/src/hooks/modules/counter/domain/operations/query.ts +38 -0
- package/src/hooks/modules/counter/domain/operations/validate.ts +58 -0
- package/src/hooks/modules/counter/domain/validators/counter-validators.ts +19 -0
- package/src/hooks/modules/counter/domain/validators/index.ts +2 -0
- package/src/hooks/modules/counter/index.ts +6 -0
- package/src/hooks/modules/counter/ports/index.ts +7 -0
- package/src/hooks/modules/counter/types/index.ts +13 -0
- package/src/hooks/modules/editor/application/index.ts +6 -0
- package/src/hooks/modules/editor/application/useCodeEditor.ts +81 -0
- package/src/hooks/modules/editor/domain/events/editor-events.ts +16 -0
- package/src/hooks/modules/editor/domain/events/index.ts +6 -0
- package/src/hooks/modules/editor/domain/index.ts +7 -0
- package/src/hooks/modules/editor/domain/models/editor.ts +16 -0
- package/src/hooks/modules/editor/domain/models/index.ts +6 -0
- package/src/hooks/modules/editor/domain/validators/index.ts +34 -0
- package/src/hooks/modules/editor/index.ts +8 -0
- package/src/hooks/modules/editor/types/index.ts +34 -0
- package/src/hooks/modules/sensor/application/index.ts +2 -0
- package/src/hooks/modules/sensor/application/usecases/index.ts +25 -0
- package/src/hooks/modules/sensor/domain/events/index.ts +12 -0
- package/src/hooks/modules/sensor/domain/index.ts +10 -0
- package/src/hooks/modules/sensor/domain/models/index.ts +7 -0
- package/src/hooks/modules/sensor/domain/operations/gamepad.ts +16 -0
- package/src/hooks/modules/sensor/domain/operations/index.ts +12 -0
- package/src/hooks/modules/sensor/domain/operations/motion.ts +10 -0
- package/src/hooks/modules/sensor/domain/operations/orientation.ts +10 -0
- package/src/hooks/modules/sensor/domain/validators/index.ts +2 -0
- package/src/hooks/modules/sensor/index.ts +10 -0
- package/src/hooks/modules/sensor/ports/index.ts +8 -0
- package/src/hooks/modules/sensor/types/index.ts +29 -0
- package/src/hooks/modules/storage/application/index.ts +2 -0
- package/src/hooks/modules/storage/application/usecases/index.ts +18 -0
- package/src/hooks/modules/storage/domain/events/index.ts +5 -0
- package/src/hooks/modules/storage/domain/index.ts +6 -0
- package/src/hooks/modules/storage/domain/models/index.ts +6 -0
- package/src/hooks/modules/storage/domain/models/storage.ts +11 -0
- package/src/hooks/modules/storage/domain/operations/index.ts +8 -0
- package/src/hooks/modules/storage/domain/operations/serialize.ts +22 -0
- package/src/hooks/modules/storage/domain/operations/validate.ts +7 -0
- package/src/hooks/modules/storage/domain/validators/index.ts +2 -0
- package/src/hooks/modules/storage/index.ts +6 -0
- package/src/hooks/modules/storage/ports/index.ts +7 -0
- package/src/hooks/modules/storage/types/index.ts +6 -0
- package/src/hooks/modules/time/application/index.ts +2 -0
- package/src/hooks/modules/time/application/usecases/index.ts +5 -0
- package/src/hooks/modules/time/application/usecases/use-debounce.ts +10 -0
- package/src/hooks/modules/time/application/usecases/use-interval.ts +10 -0
- package/src/hooks/modules/time/application/usecases/use-throttle.ts +10 -0
- package/src/hooks/modules/time/application/usecases/use-timeout.ts +10 -0
- package/src/hooks/modules/time/domain/events/index.ts +6 -0
- package/src/hooks/modules/time/domain/index.ts +12 -0
- package/src/hooks/modules/time/domain/models/index.ts +6 -0
- package/src/hooks/modules/time/domain/models/time.ts +16 -0
- package/src/hooks/modules/time/domain/operations/calculate.ts +8 -0
- package/src/hooks/modules/time/domain/operations/index.ts +11 -0
- package/src/hooks/modules/time/domain/operations/validate.ts +11 -0
- package/src/hooks/modules/time/domain/validators/index.ts +2 -0
- package/src/hooks/modules/time/index.ts +5 -0
- package/src/hooks/modules/time/ports/index.ts +9 -0
- package/src/hooks/modules/time/types/index.ts +18 -0
- package/src/hooks/modules/toggle/application/index.ts +2 -0
- package/src/hooks/modules/toggle/application/usecases/index.ts +48 -0
- package/src/hooks/modules/toggle/domain/events/index.ts +4 -0
- package/src/hooks/modules/toggle/domain/index.ts +11 -0
- package/src/hooks/modules/toggle/domain/models/index.ts +7 -0
- package/src/hooks/modules/toggle/domain/operations/create.ts +11 -0
- package/src/hooks/modules/toggle/domain/operations/index.ts +12 -0
- package/src/hooks/modules/toggle/domain/operations/modify.ts +18 -0
- package/src/hooks/modules/toggle/domain/operations/query.ts +9 -0
- package/src/hooks/modules/toggle/domain/validators/index.ts +2 -0
- package/src/hooks/modules/toggle/index.ts +6 -0
- package/src/hooks/modules/toggle/ports/index.ts +5 -0
- package/src/hooks/modules/toggle/types/index.ts +9 -0
- package/src/hooks/presentation/index.ts +2 -0
- package/src/hooks/presentation/solid/animation/index.ts +11 -0
- package/src/hooks/presentation/solid/animation/useElapsedTime.ts +75 -0
- package/src/hooks/presentation/solid/animation/useInterval.ts +68 -0
- package/src/hooks/presentation/solid/animation/useIntervalFn.ts +54 -0
- package/src/hooks/presentation/solid/animation/useNow.ts +57 -0
- package/src/hooks/presentation/solid/animation/useRafFn.ts +57 -0
- package/src/hooks/presentation/solid/animation/useTimeout.ts +55 -0
- package/src/hooks/presentation/solid/animation/useTimeoutFn.ts +55 -0
- package/src/hooks/presentation/solid/animation/useTimestamp.ts +61 -0
- package/src/hooks/presentation/solid/animation/useTransition.ts +87 -0
- package/src/hooks/presentation/solid/array/index.ts +14 -0
- package/src/hooks/presentation/solid/array/useArrayConcat.ts +18 -0
- package/src/hooks/presentation/solid/array/useArrayEvery.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayFilter.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayFind.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayIncludes.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayMap.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayPop.ts +18 -0
- package/src/hooks/presentation/solid/array/useArrayPush.ts +15 -0
- package/src/hooks/presentation/solid/array/useArrayReduce.ts +9 -0
- package/src/hooks/presentation/solid/array/useArrayShift.ts +18 -0
- package/src/hooks/presentation/solid/array/useArraySome.ts +8 -0
- package/src/hooks/presentation/solid/array/useArraySort.ts +12 -0
- package/src/hooks/presentation/solid/browser/index.ts +35 -0
- package/src/hooks/presentation/solid/browser/useBarcode.ts +15 -0
- package/src/hooks/presentation/solid/browser/useBattery.ts +37 -0
- package/src/hooks/presentation/solid/browser/useBeacon.ts +4 -0
- package/src/hooks/presentation/solid/browser/useBluetooth.ts +15 -0
- package/src/hooks/presentation/solid/browser/useClipboard.ts +17 -0
- package/src/hooks/presentation/solid/browser/useClipboardAdvanced.ts +54 -0
- package/src/hooks/presentation/solid/browser/useConnection.ts +22 -0
- package/src/hooks/presentation/solid/browser/useCredential.ts +18 -0
- package/src/hooks/presentation/solid/browser/useDisplayMedia.ts +24 -0
- package/src/hooks/presentation/solid/browser/useFaceDetection.ts +20 -0
- package/src/hooks/presentation/solid/browser/useFullscreen.ts +33 -0
- package/src/hooks/presentation/solid/browser/useGeolocation.ts +64 -0
- package/src/hooks/presentation/solid/browser/useLocalStorage.ts +11 -0
- package/src/hooks/presentation/solid/browser/useMediaDevices.ts +24 -0
- package/src/hooks/presentation/solid/browser/useMemory.ts +9 -0
- package/src/hooks/presentation/solid/browser/useNetwork.ts +43 -0
- package/src/hooks/presentation/solid/browser/useNotification.ts +21 -0
- package/src/hooks/presentation/solid/browser/usePayment.ts +17 -0
- package/src/hooks/presentation/solid/browser/usePerformance.ts +13 -0
- package/src/hooks/presentation/solid/browser/usePush.ts +12 -0
- package/src/hooks/presentation/solid/browser/useQrCode.ts +11 -0
- package/src/hooks/presentation/solid/browser/useScreenOrientation.ts +37 -0
- package/src/hooks/presentation/solid/browser/useServiceWorker.ts +29 -0
- package/src/hooks/presentation/solid/browser/useSessionStorage.ts +11 -0
- package/src/hooks/presentation/solid/browser/useShare.ts +12 -0
- package/src/hooks/presentation/solid/browser/useSpeechRecognition.ts +71 -0
- package/src/hooks/presentation/solid/browser/useSpeechSynthesis.ts +54 -0
- package/src/hooks/presentation/solid/browser/useStorage.ts +22 -0
- package/src/hooks/presentation/solid/browser/useTextDetection.ts +20 -0
- package/src/hooks/presentation/solid/browser/useUsb.ts +15 -0
- package/src/hooks/presentation/solid/browser/useUserMedia.ts +24 -0
- package/src/hooks/presentation/solid/browser/useVibration.ts +12 -0
- package/src/hooks/presentation/solid/browser/useWakeLock.ts +29 -0
- package/src/hooks/presentation/solid/browser/useWebAuthn.ts +35 -0
- package/src/hooks/presentation/solid/elements/index.ts +51 -0
- package/src/hooks/presentation/solid/elements/useActive.ts +33 -0
- package/src/hooks/presentation/solid/elements/useAudio.ts +82 -0
- package/src/hooks/presentation/solid/elements/useBreakpoints.ts +56 -0
- package/src/hooks/presentation/solid/elements/useCanvas.ts +43 -0
- package/src/hooks/presentation/solid/elements/useClick.ts +49 -0
- package/src/hooks/presentation/solid/elements/useDrag.ts +56 -0
- package/src/hooks/presentation/solid/elements/useDraggable.ts +57 -0
- package/src/hooks/presentation/solid/elements/useDraggableHandle.ts +92 -0
- package/src/hooks/presentation/solid/elements/useDrop.ts +54 -0
- package/src/hooks/presentation/solid/elements/useDropZone.ts +67 -0
- package/src/hooks/presentation/solid/elements/useElementBounding.ts +52 -0
- package/src/hooks/presentation/solid/elements/useElementSize.ts +30 -0
- package/src/hooks/presentation/solid/elements/useElementVisibility.ts +33 -0
- package/src/hooks/presentation/solid/elements/useFileDialog.ts +33 -0
- package/src/hooks/presentation/solid/elements/useFileInput.ts +20 -0
- package/src/hooks/presentation/solid/elements/useFocus.ts +49 -0
- package/src/hooks/presentation/solid/elements/useHover.ts +33 -0
- package/src/hooks/presentation/solid/elements/useImagePreview.ts +27 -0
- package/src/hooks/presentation/solid/elements/useImageUpload.ts +66 -0
- package/src/hooks/presentation/solid/elements/useInfiniteScroll.ts +52 -0
- package/src/hooks/presentation/solid/elements/useIntersectionAdvanced.ts +43 -0
- package/src/hooks/presentation/solid/elements/useIntersectionObserver.ts +40 -0
- package/src/hooks/presentation/solid/elements/useLayout.ts +47 -0
- package/src/hooks/presentation/solid/elements/useLongPress.ts +54 -0
- package/src/hooks/presentation/solid/elements/useMagicKeys.ts +60 -0
- package/src/hooks/presentation/solid/elements/useMediaQuery.ts +24 -0
- package/src/hooks/presentation/solid/elements/useModal.ts +24 -0
- package/src/hooks/presentation/solid/elements/useMouse.ts +51 -0
- package/src/hooks/presentation/solid/elements/useMutationObserver.ts +38 -0
- package/src/hooks/presentation/solid/elements/useOnClickOutside.ts +25 -0
- package/src/hooks/presentation/solid/elements/useOnKeyStroke.ts +33 -0
- package/src/hooks/presentation/solid/elements/useParallax.ts +34 -0
- package/src/hooks/presentation/solid/elements/usePerformanceObserver.ts +30 -0
- package/src/hooks/presentation/solid/elements/usePinch.ts +61 -0
- package/src/hooks/presentation/solid/elements/usePopover.ts +54 -0
- package/src/hooks/presentation/solid/elements/useResize.ts +34 -0
- package/src/hooks/presentation/solid/elements/useResizeObserver.ts +42 -0
- package/src/hooks/presentation/solid/elements/useRotate.ts +42 -0
- package/src/hooks/presentation/solid/elements/useScroll.ts +97 -0
- package/src/hooks/presentation/solid/elements/useScrollTo.ts +30 -0
- package/src/hooks/presentation/solid/elements/useSortable.ts +22 -0
- package/src/hooks/presentation/solid/elements/useSplitter.ts +61 -0
- package/src/hooks/presentation/solid/elements/useSticky.ts +33 -0
- package/src/hooks/presentation/solid/elements/useSvg.ts +31 -0
- package/src/hooks/presentation/solid/elements/useSwipe.ts +87 -0
- package/src/hooks/presentation/solid/elements/useTabs.ts +44 -0
- package/src/hooks/presentation/solid/elements/useTooltip.ts +57 -0
- package/src/hooks/presentation/solid/elements/useVideo.ts +83 -0
- package/src/hooks/presentation/solid/elements/useVirtualList.ts +43 -0
- package/src/hooks/presentation/solid/elements/useWebgl.ts +36 -0
- package/src/hooks/presentation/solid/index.ts +11 -0
- package/src/hooks/presentation/solid/math/index.ts +10 -0
- package/src/hooks/presentation/solid/math/useAbs.ts +9 -0
- package/src/hooks/presentation/solid/math/useCeil.ts +9 -0
- package/src/hooks/presentation/solid/math/useClamp.ts +24 -0
- package/src/hooks/presentation/solid/math/useExp.ts +9 -0
- package/src/hooks/presentation/solid/math/useFloor.ts +9 -0
- package/src/hooks/presentation/solid/math/useLog.ts +21 -0
- package/src/hooks/presentation/solid/math/useMath.ts +3 -0
- package/src/hooks/presentation/solid/math/useOffset.ts +20 -0
- package/src/hooks/presentation/solid/math/usePow.ts +16 -0
- package/src/hooks/presentation/solid/math/useRound.ts +24 -0
- package/src/hooks/presentation/solid/math/useSign.ts +9 -0
- package/src/hooks/presentation/solid/math/useSqrt.ts +9 -0
- package/src/hooks/presentation/solid/network/index.ts +5 -0
- package/src/hooks/presentation/solid/network/useEventSource.ts +87 -0
- package/src/hooks/presentation/solid/network/useFetch.ts +187 -0
- package/src/hooks/presentation/solid/network/useWebSocket.ts +120 -0
- package/src/hooks/presentation/solid/sensors/index.ts +21 -0
- package/src/hooks/presentation/solid/sensors/useAbsoluteOrientation.ts +41 -0
- package/src/hooks/presentation/solid/sensors/useAccelerometer.ts +39 -0
- package/src/hooks/presentation/solid/sensors/useAmbientLight.ts +35 -0
- package/src/hooks/presentation/solid/sensors/useDeviceMotion.ts +50 -0
- package/src/hooks/presentation/solid/sensors/useDeviceOrientation.ts +38 -0
- package/src/hooks/presentation/solid/sensors/useGamepad.ts +52 -0
- package/src/hooks/presentation/solid/sensors/useGamepadRumble.ts +28 -0
- package/src/hooks/presentation/solid/sensors/useGravity.ts +39 -0
- package/src/hooks/presentation/solid/sensors/useGyroscope.ts +39 -0
- package/src/hooks/presentation/solid/sensors/useHID.ts +19 -0
- package/src/hooks/presentation/solid/sensors/useLinearAcceleration.ts +41 -0
- package/src/hooks/presentation/solid/sensors/useMagnetometer.ts +39 -0
- package/src/hooks/presentation/solid/sensors/useMotion.ts +31 -0
- package/src/hooks/presentation/solid/sensors/useNFC.ts +19 -0
- package/src/hooks/presentation/solid/sensors/usePressure.ts +35 -0
- package/src/hooks/presentation/solid/sensors/useProximity.ts +38 -0
- package/src/hooks/presentation/solid/sensors/useRelativeOrientation.ts +41 -0
- package/src/hooks/presentation/solid/sensors/useSerial.ts +18 -0
- package/src/hooks/presentation/solid/sensors/useShake.ts +54 -0
- package/src/hooks/presentation/solid/sensors/useTilt.ts +31 -0
- package/src/hooks/presentation/solid/state/createSharedComposable.ts +24 -0
- package/src/hooks/presentation/solid/state/index.ts +14 -0
- package/src/hooks/presentation/solid/state/reactivity.ts +43 -0
- package/src/hooks/presentation/solid/state/refDebounced.ts +27 -0
- package/src/hooks/presentation/solid/state/refThrottled.ts +39 -0
- package/src/hooks/presentation/solid/state/syncRef.ts +24 -0
- package/src/hooks/presentation/solid/state/toRef.ts +18 -0
- package/src/hooks/presentation/solid/state/useArray.ts +55 -0
- package/src/hooks/presentation/solid/state/useCounter.ts +24 -0
- package/src/hooks/presentation/solid/state/useToggle.ts +20 -0
- package/src/hooks/presentation/solid/time/index.ts +6 -0
- package/src/hooks/presentation/solid/time/useDebounceFn.ts +18 -0
- package/src/hooks/presentation/solid/time/useInterval.ts +44 -0
- package/src/hooks/presentation/solid/time/useThrottleFn.ts +30 -0
- package/src/hooks/presentation/solid/time/useTimeout.ts +37 -0
- package/src/hooks/presentation/solid/time/watchDebounced.ts +19 -0
- package/src/hooks/presentation/solid/time/watchPausable.ts +29 -0
- package/src/hooks/presentation/solid/time/whenever.ts +13 -0
- package/src/hooks/presentation/solid/utilities/index.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayEvery.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayFilter.ts +11 -0
- package/src/hooks/presentation/solid/utilities/useArrayFind.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayIncludes.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayMap.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayReduce.ts +9 -0
- package/src/hooks/presentation/solid/utilities/useArraySome.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArraySort.ts +12 -0
- package/src/hooks/presentation/solid/utilities/useClamp.ts +24 -0
- package/src/hooks/presentation/solid/utilities/useDebounce.ts +32 -0
- package/src/hooks/presentation/solid/utilities/useEventBus.ts +57 -0
- package/src/hooks/presentation/solid/utilities/useMemoize.ts +15 -0
- package/src/hooks/presentation/solid/utilities/useOffset.ts +20 -0
- package/src/hooks/presentation/solid/utilities/useRound.ts +24 -0
- package/src/hooks/presentation/solid/utilities/useSorted.ts +12 -0
- package/src/hooks/presentation/solid/utilities/useThrottle.ts +44 -0
- package/src/hooks/presentation/solid/utilities/useToNumber.ts +11 -0
- package/src/hooks/presentation/solid/utilities/useToString.ts +10 -0
- package/src/hooks/realtime/use-sse.ts +70 -0
- package/src/hooks/shared/constants/index.ts +4 -0
- package/src/hooks/shared/errors/index.ts +1 -0
- package/src/hooks/shared/errors/validation-error.ts +28 -0
- package/src/hooks/shared/index.ts +8 -0
- package/src/hooks/shared/types/index.ts +17 -0
- package/src/hooks/shared/types/option.ts +17 -0
- package/src/hooks/shared/types/result.ts +34 -0
- package/src/hooks/shared/types/utilities.ts +102 -0
- package/src/hooks/shared/utils/identity.ts +2 -0
- package/src/hooks/shared/utils/index.ts +4 -0
- package/src/hooks/shared/utils/logger.ts +69 -0
- package/src/hooks/shared/utils/pipe.ts +5 -0
- package/src/hooks/shared/utils/result.ts +9 -0
- package/src/hooks/test/counter.test.ts +25 -0
- package/src/index.ts +16 -0
- package/src/internal.ts +61 -0
- package/src/query/adapters/devtools/index.ts +29 -0
- package/src/query/adapters/persistence/index.ts +62 -0
- package/src/query/adapters/solid/index.ts +10 -0
- package/src/query/adapters/solid/solid-query-context.ts +29 -0
- package/src/query/adapters/solid/solid-query-empty-result.ts +34 -0
- package/src/query/adapters/solid/solid-query-options.ts +52 -0
- package/src/query/adapters/solid/solid-query-use-infinite.ts +228 -0
- package/src/query/adapters/solid/solid-query-use-mutation.ts +54 -0
- package/src/query/adapters/solid/solid-query-use-query.ts +75 -0
- package/src/query/adapters/solid/solid.test.ts +53 -0
- package/src/query/adapters/validation/index.ts +20 -0
- package/src/query/index.test.ts +203 -0
- package/src/query/index.ts +4 -0
- package/src/query/modules/query/application/usecases/query-client-data.ts +29 -0
- package/src/query/modules/query/application/usecases/query-client-helpers.ts +49 -0
- package/src/query/modules/query/application/usecases/query-client-infinite.ts +39 -0
- package/src/query/modules/query/application/usecases/query-client.ts +251 -0
- package/src/query/modules/query/domain/models/mutation-cache.ts +115 -0
- package/src/query/modules/query/domain/models/mutation.ts +207 -0
- package/src/query/modules/query/domain/models/query-cache.ts +119 -0
- package/src/query/modules/query/domain/models/query-environment.ts +16 -0
- package/src/query/modules/query/domain/models/query-observer.ts +162 -0
- package/src/query/modules/query/domain/models/query-operations.ts +76 -0
- package/src/query/modules/query/domain/models/query.ts +239 -0
- package/src/query/modules/query/domain/operations/index.ts +76 -0
- package/src/query/modules/query/index.ts +9 -0
- package/src/query/modules/query/ports/index.ts +53 -0
- package/src/query/modules/query/types/index.ts +239 -0
- package/src/query/shared/index.ts +48 -0
- package/src/render/adapters/index.ts +1 -0
- package/src/render/adapters/solid-web/hydration.ts +35 -0
- package/src/render/adapters/solid-web/index.ts +3 -0
- package/src/render/adapters/solid-web/renderer.ts +20 -0
- package/src/render/index.ts +7 -0
- package/src/render/modules/render/application/index.ts +1 -0
- package/src/render/modules/render/application/usecases/index.ts +4 -0
- package/src/render/modules/render/application/usecases/remote-island.ts +46 -0
- package/src/render/modules/render/application/usecases/render-page.ts +86 -0
- package/src/render/modules/render/application/usecases/render-shell.ts +56 -0
- package/src/render/modules/render/application/usecases/stream-page.ts +159 -0
- package/src/render/modules/render/domain/index.ts +3 -0
- package/src/render/modules/render/domain/models/context.ts +34 -0
- package/src/render/modules/render/domain/models/document.ts +26 -0
- package/src/render/modules/render/domain/models/index.ts +2 -0
- package/src/render/modules/render/domain/operations/document.ts +58 -0
- package/src/render/modules/render/domain/operations/hydration.ts +58 -0
- package/src/render/modules/render/domain/operations/index.ts +3 -0
- package/src/render/modules/render/domain/operations/rsc.ts +53 -0
- package/src/render/modules/render/domain/validators/index.ts +11 -0
- package/src/render/modules/render/index.ts +3 -0
- package/src/render/modules/render/ports/index.ts +17 -0
- package/src/render/presentation/ClientComponent.tsx +42 -0
- package/src/render/presentation/Document.tsx +45 -0
- package/src/render/presentation/Island.tsx +146 -0
- package/src/render/presentation/RemoteIsland.tsx +68 -0
- package/src/render/presentation/entries.ts +83 -0
- package/src/render/presentation/index.ts +5 -0
- package/src/render/shared/index.ts +2 -0
- package/src/render/shared/types/index.ts +9 -0
- package/src/render/shared/utils/index.ts +1 -0
- package/src/render/shared/utils/result.ts +30 -0
- package/src/render/types/index.ts +58 -0
- package/src/router/adapters/index.ts +1 -0
- package/src/router/adapters/solid-start/index.ts +42 -0
- package/src/router/cli/bundle-analyzer.ts +142 -0
- package/src/router/cli/index.ts +3 -0
- package/src/router/cli/migration-cli.ts +217 -0
- package/src/router/cli/route-generator-config.ts +109 -0
- package/src/router/cli/route-generator-templates.ts +117 -0
- package/src/router/cli/route-generator-types.ts +9 -0
- package/src/router/cli/route-generator-utils.ts +40 -0
- package/src/router/cli/route-generator.ts +64 -0
- package/src/router/index.test.ts +7 -0
- package/src/router/index.ts +21 -0
- package/src/router/modules/navigation/application/index.ts +1 -0
- package/src/router/modules/navigation/application/usecases.ts +42 -0
- package/src/router/modules/navigation/domain/index.ts +2 -0
- package/src/router/modules/navigation/domain/models.ts +44 -0
- package/src/router/modules/navigation/domain/operations.ts +28 -0
- package/src/router/modules/navigation/index.ts +3 -0
- package/src/router/modules/navigation/types/index.ts +15 -0
- package/src/router/modules/route-cache/application/usecases/index.ts +74 -0
- package/src/router/modules/route-cache/domain/models/index.ts +63 -0
- package/src/router/modules/route-cache/domain/operations/cache-evict.ts +104 -0
- package/src/router/modules/route-cache/domain/operations/cache-invalidate.ts +101 -0
- package/src/router/modules/route-cache/domain/operations/cache-read.ts +74 -0
- package/src/router/modules/route-cache/domain/operations/cache-write.ts +62 -0
- package/src/router/modules/route-cache/domain/operations/index.ts +4 -0
- package/src/router/modules/route-cache/domain/validators/index.ts +25 -0
- package/src/router/modules/route-cache/index.ts +8 -0
- package/src/router/modules/route-cache/ports/index.ts +20 -0
- package/src/router/modules/route-cache/types/index.ts +8 -0
- package/src/router/modules/route-error-tracking/application/usecases/index.ts +182 -0
- package/src/router/modules/route-error-tracking/domain/index.ts +5 -0
- package/src/router/modules/route-error-tracking/domain/models/index.ts +130 -0
- package/src/router/modules/route-error-tracking/domain/operations/error-cleanup.ts +50 -0
- package/src/router/modules/route-error-tracking/domain/operations/error-queries.ts +103 -0
- package/src/router/modules/route-error-tracking/domain/operations/error-recording.ts +112 -0
- package/src/router/modules/route-error-tracking/domain/operations/error-reporting.ts +55 -0
- package/src/router/modules/route-error-tracking/domain/operations/index.ts +4 -0
- package/src/router/modules/route-error-tracking/domain/validators/index.ts +46 -0
- package/src/router/modules/route-error-tracking/index.ts +8 -0
- package/src/router/modules/route-error-tracking/ports/index.ts +20 -0
- package/src/router/modules/route-error-tracking/types/index.ts +6 -0
- package/src/router/modules/route-feature-flags/application/usecases/index.ts +159 -0
- package/src/router/modules/route-feature-flags/domain/index.ts +5 -0
- package/src/router/modules/route-feature-flags/domain/models/index.ts +102 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-audit.ts +37 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-conditions.ts +52 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-flags.ts +205 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-routes.ts +54 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-segments.ts +22 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-statistics.ts +22 -0
- package/src/router/modules/route-feature-flags/domain/operations/index.ts +6 -0
- package/src/router/modules/route-feature-flags/domain/validators/index.ts +40 -0
- package/src/router/modules/route-feature-flags/index.ts +8 -0
- package/src/router/modules/route-feature-flags/ports/index.ts +23 -0
- package/src/router/modules/route-feature-flags/types/index.ts +7 -0
- package/src/router/modules/route-i18n/application/usecases/index.ts +81 -0
- package/src/router/modules/route-i18n/domain/models/index.ts +85 -0
- package/src/router/modules/route-i18n/domain/operations/index.ts +201 -0
- package/src/router/modules/route-i18n/domain/validators/index.ts +43 -0
- package/src/router/modules/route-i18n/index.ts +8 -0
- package/src/router/modules/route-i18n/ports/index.ts +20 -0
- package/src/router/modules/route-i18n/types/index.ts +7 -0
- package/src/router/modules/route-navigation-timeline/application/usecases/index.ts +182 -0
- package/src/router/modules/route-navigation-timeline/domain/index.ts +5 -0
- package/src/router/modules/route-navigation-timeline/domain/models/index.ts +143 -0
- package/src/router/modules/route-navigation-timeline/domain/operations/index.ts +177 -0
- package/src/router/modules/route-navigation-timeline/domain/validators/index.ts +19 -0
- package/src/router/modules/route-navigation-timeline/index.ts +8 -0
- package/src/router/modules/route-navigation-timeline/ports/index.ts +30 -0
- package/src/router/modules/route-navigation-timeline/types/index.ts +5 -0
- package/src/router/modules/route-performance/application/usecases/index.ts +166 -0
- package/src/router/modules/route-performance/domain/models/index.ts +96 -0
- package/src/router/modules/route-performance/domain/operations/index.ts +5 -0
- package/src/router/modules/route-performance/domain/operations/performance-cleanup.ts +29 -0
- package/src/router/modules/route-performance/domain/operations/performance-queries.ts +91 -0
- package/src/router/modules/route-performance/domain/operations/performance-recording.ts +151 -0
- package/src/router/modules/route-performance/domain/operations/performance-reporting.ts +32 -0
- package/src/router/modules/route-performance/domain/operations/performance-tracking.ts +75 -0
- package/src/router/modules/route-performance/domain/validators/index.ts +55 -0
- package/src/router/modules/route-performance/index.ts +8 -0
- package/src/router/modules/route-performance/ports/index.ts +25 -0
- package/src/router/modules/route-performance/types/index.ts +6 -0
- package/src/router/modules/route-security/application/usecases/index.ts +153 -0
- package/src/router/modules/route-security/domain/models/index.ts +216 -0
- package/src/router/modules/route-security/domain/operations/index.ts +165 -0
- package/src/router/modules/route-security/domain/validators/index.ts +32 -0
- package/src/router/modules/route-security/index.ts +8 -0
- package/src/router/modules/route-security/ports/index.ts +31 -0
- package/src/router/modules/route-security/types/index.ts +11 -0
- package/src/router/modules/route-testing/application/usecases/index.ts +131 -0
- package/src/router/modules/route-testing/domain/models/index.ts +217 -0
- package/src/router/modules/route-testing/domain/operations/contract-testing-operations.ts +239 -0
- package/src/router/modules/route-testing/domain/operations/e2e-testing-operations.ts +167 -0
- package/src/router/modules/route-testing/domain/operations/index.ts +3 -0
- package/src/router/modules/route-testing/domain/operations/route-testing-core.ts +48 -0
- package/src/router/modules/route-testing/domain/validators/index.ts +34 -0
- package/src/router/modules/route-testing/index.ts +8 -0
- package/src/router/modules/route-testing/ports/index.ts +21 -0
- package/src/router/modules/route-testing/types/index.ts +13 -0
- package/src/router/modules/routing/application/index.ts +7 -0
- package/src/router/modules/routing/application/usecases.ts +49 -0
- package/src/router/modules/routing/domain/ab-testing.ts +86 -0
- package/src/router/modules/routing/domain/analytics.ts +88 -0
- package/src/router/modules/routing/domain/caching-evict.ts +104 -0
- package/src/router/modules/routing/domain/caching-invalidate.ts +101 -0
- package/src/router/modules/routing/domain/caching-read.ts +74 -0
- package/src/router/modules/routing/domain/caching-state.ts +38 -0
- package/src/router/modules/routing/domain/caching-types.ts +38 -0
- package/src/router/modules/routing/domain/caching-write.ts +62 -0
- package/src/router/modules/routing/domain/caching.ts +6 -0
- package/src/router/modules/routing/domain/code-splitting.ts +226 -0
- package/src/router/modules/routing/domain/contract-factory.ts +37 -0
- package/src/router/modules/routing/domain/contract-testing.ts +13 -0
- package/src/router/modules/routing/domain/contract-types.ts +32 -0
- package/src/router/modules/routing/domain/contract-validator.ts +246 -0
- package/src/router/modules/routing/domain/dynamic-imports.ts +67 -0
- package/src/router/modules/routing/domain/e2e-testing.ts +267 -0
- package/src/router/modules/routing/domain/error-boundaries.ts +54 -0
- package/src/router/modules/routing/domain/error-tracking.ts +277 -0
- package/src/router/modules/routing/domain/feature-flags.ts +255 -0
- package/src/router/modules/routing/domain/guards.ts +104 -0
- package/src/router/modules/routing/domain/i18n.ts +230 -0
- package/src/router/modules/routing/domain/index.ts +30 -0
- package/src/router/modules/routing/domain/interactive-docs-advanced-sections.ts +164 -0
- package/src/router/modules/routing/domain/interactive-docs-core-sections.ts +198 -0
- package/src/router/modules/routing/domain/interactive-docs.ts +154 -0
- package/src/router/modules/routing/domain/isr.ts +35 -0
- package/src/router/modules/routing/domain/middleware.ts +79 -0
- package/src/router/modules/routing/domain/models.ts +95 -0
- package/src/router/modules/routing/domain/navigation-timeline.ts +243 -0
- package/src/router/modules/routing/domain/operations.ts +36 -0
- package/src/router/modules/routing/domain/optimized-matcher.ts +75 -0
- package/src/router/modules/routing/domain/performance-alert-manager.ts +28 -0
- package/src/router/modules/routing/domain/performance-monitoring.ts +287 -0
- package/src/router/modules/routing/domain/performance-report.ts +29 -0
- package/src/router/modules/routing/domain/performance-types.ts +19 -0
- package/src/router/modules/routing/domain/predictive-preloading.ts +296 -0
- package/src/router/modules/routing/domain/rbac.ts +219 -0
- package/src/router/modules/routing/domain/resource-routes.ts +64 -0
- package/src/router/modules/routing/domain/route-autocomplete.ts +176 -0
- package/src/router/modules/routing/domain/route-groups.ts +63 -0
- package/src/router/modules/routing/domain/security-scanner.ts +225 -0
- package/src/router/modules/routing/domain/server-actions.ts +71 -0
- package/src/router/modules/routing/domain/testing.ts +80 -0
- package/src/router/modules/routing/domain/type-safe-links.ts +72 -0
- package/src/router/modules/routing/domain/validators.ts +23 -0
- package/src/router/modules/routing/index.ts +4 -0
- package/src/router/modules/routing/ports/index.ts +1 -0
- package/src/router/modules/routing/ports/router-port.ts +15 -0
- package/src/router/modules/routing/types/index.ts +14 -0
- package/src/router/modules/routing-core/application/usecases/index.ts +49 -0
- package/src/router/modules/routing-core/domain/models/index.ts +95 -0
- package/src/router/modules/routing-core/domain/operations/index.ts +36 -0
- package/src/router/modules/routing-core/domain/validators/index.ts +28 -0
- package/src/router/modules/routing-core/index.ts +8 -0
- package/src/router/modules/routing-core/ports/index.ts +16 -0
- package/src/router/modules/routing-core/types/index.ts +25 -0
- package/src/router/presentation/index.ts +1 -0
- package/src/router/presentation/solid/components/index.ts +1 -0
- package/src/router/presentation/solid/components/route-visualizer-details.tsx +37 -0
- package/src/router/presentation/solid/components/route-visualizer-helpers.ts +56 -0
- package/src/router/presentation/solid/components/route-visualizer-tree.tsx +99 -0
- package/src/router/presentation/solid/components/route-visualizer-types.ts +41 -0
- package/src/router/presentation/solid/components/route-visualizer.tsx +110 -0
- package/src/router/presentation/solid/components/router.ts +82 -0
- package/src/router/presentation/solid/devtools/index.ts +2 -0
- package/src/router/presentation/solid/devtools/router-devtools-panel.tsx +141 -0
- package/src/router/presentation/solid/devtools/router-inspector.ts +54 -0
- package/src/router/presentation/solid/hmr.ts +77 -0
- package/src/router/presentation/solid/index.ts +7 -0
- package/src/router/presentation/solid/lazy-loading.ts +111 -0
- package/src/router/presentation/solid/preloading.ts +81 -0
- package/src/router/presentation/solid/route-state.ts +58 -0
- package/src/router/presentation/solid/signals/index.ts +2 -0
- package/src/router/presentation/solid/signals/route-state.ts +39 -0
- package/src/router/presentation/solid/signals/search-params.ts +31 -0
- package/src/router/shared/constants/index.ts +6 -0
- package/src/router/shared/errors/enhanced-errors.ts +94 -0
- package/src/router/shared/errors/index.ts +30 -0
- package/src/router/shared/index.ts +4 -0
- package/src/router/shared/types/either.ts +55 -0
- package/src/router/shared/types/index.ts +5 -0
- package/src/router/shared/types/option.ts +20 -0
- package/src/router/shared/types/result.ts +34 -0
- package/src/router/shared/types/route-inference.ts +49 -0
- package/src/router/shared/types/routing.ts +31 -0
- package/src/router/shared/utils/index.ts +3 -0
- package/src/router/shared/utils/path.ts +43 -0
- package/src/router/shared/utils/result.ts +5 -0
- package/src/router/shared/utils/time-condition.ts +53 -0
- package/src/router/vite-plugin/index.ts +2 -0
- package/src/router/vite-plugin/vite-plugin-core.ts +79 -0
- package/src/router/vite-plugin/vite-plugin-options-advanced.ts +127 -0
- package/src/router/vite-plugin/vite-plugin-options-features.ts +117 -0
- package/src/router/vite-plugin/vite-plugin-options-routing.ts +70 -0
- package/src/router/vite-plugin/vite-plugin-options.ts +23 -0
- package/src/server/adapters/index.ts +2 -0
- package/src/server/adapters/platforms.ts +79 -0
- package/src/server/adapters/web-server/index.ts +281 -0
- package/src/server/index.ts +13 -0
- package/src/server/modules/http/domain/operations/cookies.ts +151 -0
- package/src/server/modules/http/domain/operations/metrics.ts +103 -0
- package/src/server/modules/http/domain/operations/request-context.ts +36 -0
- package/src/server/modules/http/domain/operations/session-store.ts +98 -0
- package/src/server/modules/http/index.ts +15 -0
- package/src/server/modules/loaders/application/index.ts +1 -0
- package/src/server/modules/loaders/application/usecases/create-route-loader.ts +88 -0
- package/src/server/modules/loaders/application/usecases/dehydrate.ts +21 -0
- package/src/server/modules/loaders/application/usecases/index.ts +2 -0
- package/src/server/modules/loaders/index.ts +1 -0
- package/src/server/modules/realtime/domain/operations/channels.ts +241 -0
- package/src/server/modules/realtime/domain/operations/sse.ts +63 -0
- package/src/server/modules/realtime/index.ts +2 -0
- package/src/server/modules/server-functions/adapters/http/handler.ts +128 -0
- package/src/server/modules/server-functions/application/index.ts +1 -0
- package/src/server/modules/server-functions/application/usecases/batch.ts +135 -0
- package/src/server/modules/server-functions/application/usecases/create-server-fn.ts +272 -0
- package/src/server/modules/server-functions/application/usecases/csrf.ts +67 -0
- package/src/server/modules/server-functions/application/usecases/index.ts +6 -0
- package/src/server/modules/server-functions/application/usecases/live.ts +172 -0
- package/src/server/modules/server-functions/application/usecases/registry.ts +22 -0
- package/src/server/modules/server-functions/application/usecases/scheduler.ts +115 -0
- package/src/server/modules/server-functions/domain/index.ts +24 -0
- package/src/server/modules/server-functions/domain/models/execution-result.ts +18 -0
- package/src/server/modules/server-functions/domain/models/index.ts +1 -0
- package/src/server/modules/server-functions/domain/operations/result.ts +61 -0
- package/src/server/modules/server-functions/domain/operations/serialize.ts +134 -0
- package/src/server/modules/server-functions/domain/operations/stream.ts +107 -0
- package/src/server/modules/server-functions/index.ts +3 -0
- package/src/server/modules/server-only/index.ts +30 -0
- package/src/server/node.ts +10 -0
- package/src/server/shared/errors/index.ts +1 -0
- package/src/server/shared/errors/server-fn-error.ts +27 -0
- package/src/server/shared/index.ts +2 -0
- package/src/server/shared/types/index.ts +5 -0
- package/src/server/types/index.ts +65 -0
- package/src/stores/adapters/analytics/index.ts +5 -0
- package/src/stores/adapters/analytics/monitoring.ts +164 -0
- package/src/stores/adapters/devtools/index.ts +80 -0
- package/src/stores/adapters/persistence/index.ts +5 -0
- package/src/stores/adapters/persistence/versioning.ts +142 -0
- package/src/stores/adapters/router/index.ts +144 -0
- package/src/stores/adapters/storage/index.ts +6 -0
- package/src/stores/adapters/storage/indexed-db.ts +83 -0
- package/src/stores/adapters/storage/local-storage.ts +44 -0
- package/src/stores/adapters/storage/session-storage.ts +44 -0
- package/src/stores/adapters/sync/index.ts +5 -0
- package/src/stores/adapters/sync/tab-sync.ts +148 -0
- package/src/stores/adapters/validation/arktype-validator.ts +32 -0
- package/src/stores/adapters/validation/error-handling.ts +27 -0
- package/src/stores/adapters/validation/index.ts +61 -0
- package/src/stores/adapters/validation/schemas/api-schemas.ts +30 -0
- package/src/stores/adapters/validation/schemas/common-schemas.ts +32 -0
- package/src/stores/adapters/validation/schemas/config-schemas.ts +22 -0
- package/src/stores/adapters/validation/schemas/constraint-schemas.ts +34 -0
- package/src/stores/adapters/validation/schemas/ecommerce-schemas.ts +43 -0
- package/src/stores/adapters/validation/schemas/form-schemas.ts +27 -0
- package/src/stores/adapters/validation/schemas/primitive-schemas.ts +9 -0
- package/src/stores/adapters/validation/schemas/store-schemas.ts +52 -0
- package/src/stores/adapters/validation/schemas.ts +11 -0
- package/src/stores/index.ts +13 -0
- package/src/stores/modules/query/index.ts +24 -0
- package/src/stores/modules/query/mutation-state.ts +33 -0
- package/src/stores/modules/query/mutation-store.ts +59 -0
- package/src/stores/modules/query/query-builder.ts +25 -0
- package/src/stores/modules/query/query-cache.ts +65 -0
- package/src/stores/modules/query/query-manager.ts +103 -0
- package/src/stores/modules/query/query-state.ts +39 -0
- package/src/stores/modules/query/query-store.ts +81 -0
- package/src/stores/modules/store/application/usecases/index.ts +217 -0
- package/src/stores/modules/store/domain/models/index.ts +38 -0
- package/src/stores/modules/store/domain/operations/actions.ts +120 -0
- package/src/stores/modules/store/domain/operations/composition.ts +205 -0
- package/src/stores/modules/store/domain/operations/derived-operations.ts +21 -0
- package/src/stores/modules/store/domain/operations/diffing.ts +272 -0
- package/src/stores/modules/store/domain/operations/event-bus.ts +255 -0
- package/src/stores/modules/store/domain/operations/history-operations.ts +101 -0
- package/src/stores/modules/store/domain/operations/hydration.ts +159 -0
- package/src/stores/modules/store/domain/operations/immutable.ts +173 -0
- package/src/stores/modules/store/domain/operations/index.ts +21 -0
- package/src/stores/modules/store/domain/operations/middleware.ts +193 -0
- package/src/stores/modules/store/domain/operations/mutations.ts +14 -0
- package/src/stores/modules/store/domain/operations/normalization.ts +195 -0
- package/src/stores/modules/store/domain/operations/optimistic.ts +171 -0
- package/src/stores/modules/store/domain/operations/persistence-operations.ts +26 -0
- package/src/stores/modules/store/domain/operations/queries.ts +296 -0
- package/src/stores/modules/store/domain/operations/selectors.ts +112 -0
- package/src/stores/modules/store/domain/operations/store-operations.ts +52 -0
- package/src/stores/modules/store/domain/operations/time-machine.ts +240 -0
- package/src/stores/modules/store/domain/operations/transactions.ts +198 -0
- package/src/stores/modules/store/domain/validators/action-validators.ts +20 -0
- package/src/stores/modules/store/domain/validators/history-validators.ts +19 -0
- package/src/stores/modules/store/domain/validators/index.ts +7 -0
- package/src/stores/modules/store/domain/validators/persistence-validators.ts +23 -0
- package/src/stores/modules/store/domain/validators/store-validators.ts +41 -0
- package/src/stores/modules/store/index.ts +9 -0
- package/src/stores/modules/store/ports/index.ts +104 -0
- package/src/stores/modules/store/types/index.ts +35 -0
- package/src/stores/shared/constants/index.ts +50 -0
- package/src/stores/shared/errors/index.ts +122 -0
- package/src/stores/shared/index.ts +7 -0
- package/src/stores/shared/schema-generator.ts +262 -0
- package/src/stores/shared/types/index.ts +147 -0
- package/src/testing/index.ts +90 -0
- package/src/vite/auto-imports.ts +65 -0
- package/src/vite/client.d.ts +25 -0
- package/src/vite/dev-middleware.ts +142 -0
- package/src/vite/index.ts +9 -0
- package/src/vite/plugin.ts +277 -0
- package/src/vite/prerender.ts +72 -0
- package/src/vite/server-fn-ids.ts +52 -0
- package/src/vite/types/index.ts +24 -0
- package/src/vite/virtual-modules.ts +68 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page Tree
|
|
3
|
+
* Composes the matched route's subtree — loader resource (SSR inline /
|
|
4
|
+
* client fetch with hydration seeding), poll revalidation, validated
|
|
5
|
+
* search params, context provider chain, and the layout wrap
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
createComponent,
|
|
10
|
+
createMemo,
|
|
11
|
+
createResource,
|
|
12
|
+
type JSX,
|
|
13
|
+
onCleanup,
|
|
14
|
+
} from "solid-js";
|
|
15
|
+
import { isServer } from "solid-js/web";
|
|
16
|
+
import type { HydrationPayload } from "#render/types";
|
|
17
|
+
import type { FileRouteMatch } from "../domain";
|
|
18
|
+
import {
|
|
19
|
+
LoaderDataContext,
|
|
20
|
+
LoaderRetryContext,
|
|
21
|
+
readHydrated,
|
|
22
|
+
runRouteLoader,
|
|
23
|
+
} from "./loader-data";
|
|
24
|
+
import type { AppLocation } from "./location";
|
|
25
|
+
import { SearchContext } from "./location";
|
|
26
|
+
import { RouteActionsContext, RouteMetaContext } from "./route-contexts";
|
|
27
|
+
import type { RouteModules } from "./route-modules";
|
|
28
|
+
import { peekModule, resolveModule, routeComponent } from "./route-modules";
|
|
29
|
+
import { SlotContext } from "./slot";
|
|
30
|
+
|
|
31
|
+
export interface PageTreeDeps {
|
|
32
|
+
modules: RouteModules;
|
|
33
|
+
location: AppLocation;
|
|
34
|
+
/** Current Request during SSR — provided by the routed server entry */
|
|
35
|
+
request: Request | undefined;
|
|
36
|
+
hydration: HydrationPayload | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const createPageTree = (
|
|
40
|
+
deps: PageTreeDeps,
|
|
41
|
+
m: FileRouteMatch,
|
|
42
|
+
): JSX.Element => {
|
|
43
|
+
const { location, request, hydration } = deps;
|
|
44
|
+
// Route `loader` export — SSR runs it inline (into the hydration
|
|
45
|
+
// payload); client navigation fetches /_server/loader.
|
|
46
|
+
// Hydration must not suspend: seed from the payload via
|
|
47
|
+
// ssrLoadFrom/initialValue, and skip the resource entirely when
|
|
48
|
+
// the module is already resolved and exports no loader
|
|
49
|
+
const resolved = peekModule(deps.modules, m.route.file);
|
|
50
|
+
const loaderData = (() => {
|
|
51
|
+
if (resolved && !resolved.loader) return undefined;
|
|
52
|
+
const path = location.pathname();
|
|
53
|
+
const hydrated = isServer ? undefined : readHydrated(path);
|
|
54
|
+
const [data, controls] = createResource(
|
|
55
|
+
// version() re-tracks so single-flight refresh() re-runs the
|
|
56
|
+
// loader — readHydrated then returns the flight payload
|
|
57
|
+
() => {
|
|
58
|
+
location.version();
|
|
59
|
+
// Loader chain — layout loaders run outermost→innermost,
|
|
60
|
+
// each receives the previous result as ctx.parent; the
|
|
61
|
+
// page loader's result becomes useLoaderData()
|
|
62
|
+
const files = [...m.route.layouts, m.route.file];
|
|
63
|
+
return files.reduce<Promise<unknown>>(
|
|
64
|
+
(parent, file) =>
|
|
65
|
+
parent.then((p) =>
|
|
66
|
+
resolveModule(deps.modules, file).then((mod) =>
|
|
67
|
+
runRouteLoader(
|
|
68
|
+
mod.loader as
|
|
69
|
+
| ((ctx: {
|
|
70
|
+
request: Request;
|
|
71
|
+
params: Record<string, string>;
|
|
72
|
+
parent?: unknown;
|
|
73
|
+
}) => unknown)
|
|
74
|
+
| undefined,
|
|
75
|
+
file === m.route.file ? path : file,
|
|
76
|
+
m.params,
|
|
77
|
+
request,
|
|
78
|
+
hydration,
|
|
79
|
+
p,
|
|
80
|
+
file === m.route.file ? path : undefined,
|
|
81
|
+
mod.loaderCache as
|
|
82
|
+
| { ttl?: number; tags?: string[] }
|
|
83
|
+
| undefined,
|
|
84
|
+
mod.schema as
|
|
85
|
+
| {
|
|
86
|
+
params?: (raw: Record<string, string>) => unknown;
|
|
87
|
+
body?: (raw: unknown) => unknown;
|
|
88
|
+
}
|
|
89
|
+
| undefined,
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
Promise.resolve(undefined),
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
initialValue: hydrated,
|
|
98
|
+
...(isServer ? {} : { ssrLoadFrom: "initial" as const }),
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
return { data, refetch: controls.refetch };
|
|
102
|
+
})();
|
|
103
|
+
|
|
104
|
+
// page({ poll }) — client-only interval revalidation of the
|
|
105
|
+
// loader chain (live dashboards without realtime setup)
|
|
106
|
+
const pollMs = (resolved as { poll?: number } | undefined)?.poll;
|
|
107
|
+
const pauseHidden =
|
|
108
|
+
(resolved as { pollPauseHidden?: boolean } | undefined)?.pollPauseHidden ??
|
|
109
|
+
false;
|
|
110
|
+
if (!isServer && pollMs && loaderData) {
|
|
111
|
+
const timer = setInterval(() => {
|
|
112
|
+
if (pauseHidden && document.hidden) return;
|
|
113
|
+
void loaderData.refetch();
|
|
114
|
+
}, pollMs);
|
|
115
|
+
onCleanup(() => clearInterval(timer));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Validated search params — route `validateSearch` export parses
|
|
119
|
+
// `?query` into the route's typed shape (raw record otherwise)
|
|
120
|
+
const search = createMemo(() => {
|
|
121
|
+
const raw = Object.fromEntries(new URLSearchParams(location.search()));
|
|
122
|
+
const validate = resolved?.validateSearch as
|
|
123
|
+
| ((raw: Record<string, string>) => unknown)
|
|
124
|
+
| undefined;
|
|
125
|
+
return validate ? validate(raw) : raw;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// innermost = page; wrap layouts innermost → outermost
|
|
129
|
+
const slotName = () => m.route.slot;
|
|
130
|
+
let tree: JSX.Element = createComponent(LoaderDataContext.Provider, {
|
|
131
|
+
value: loaderData?.data,
|
|
132
|
+
get children() {
|
|
133
|
+
return createComponent(LoaderRetryContext.Provider, {
|
|
134
|
+
get value() {
|
|
135
|
+
return loaderData?.refetch;
|
|
136
|
+
},
|
|
137
|
+
get children() {
|
|
138
|
+
return createComponent(SearchContext.Provider, {
|
|
139
|
+
get value() {
|
|
140
|
+
return search();
|
|
141
|
+
},
|
|
142
|
+
get children() {
|
|
143
|
+
return createComponent(SlotContext.Provider, {
|
|
144
|
+
value: slotName,
|
|
145
|
+
get children() {
|
|
146
|
+
return createComponent(RouteMetaContext.Provider, {
|
|
147
|
+
value:
|
|
148
|
+
(resolved as { meta?: Record<string, unknown> })?.meta ??
|
|
149
|
+
{},
|
|
150
|
+
get children() {
|
|
151
|
+
return createComponent(RouteActionsContext.Provider, {
|
|
152
|
+
value:
|
|
153
|
+
(resolved as { actionNames?: string[] })
|
|
154
|
+
?.actionNames ?? [],
|
|
155
|
+
get children() {
|
|
156
|
+
return createComponent(
|
|
157
|
+
routeComponent(deps.modules, m.route.file),
|
|
158
|
+
{
|
|
159
|
+
params: m.params,
|
|
160
|
+
// `route()` components read `props.data()` —
|
|
161
|
+
// flat-export pages use useLoaderData()
|
|
162
|
+
get data() {
|
|
163
|
+
return loaderData?.data;
|
|
164
|
+
},
|
|
165
|
+
get search() {
|
|
166
|
+
return search();
|
|
167
|
+
},
|
|
168
|
+
// `@slot` parallel routes receive their slot name
|
|
169
|
+
...(m.route.slot ? { slot: m.route.slot } : {}),
|
|
170
|
+
},
|
|
171
|
+
);
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
// page({ layout: false }) — opt out of inherited _layout files
|
|
185
|
+
const layoutOptOut =
|
|
186
|
+
(peekModule(deps.modules, m.route.file) as { layout?: boolean })?.layout ===
|
|
187
|
+
false;
|
|
188
|
+
// page({ scroll: false }) — restore the saved position instead
|
|
189
|
+
// of scrolling to top (feeds, chat UIs)
|
|
190
|
+
const keepScroll =
|
|
191
|
+
(peekModule(deps.modules, m.route.file) as { scroll?: boolean })?.scroll ===
|
|
192
|
+
false;
|
|
193
|
+
if (keepScroll && !isServer) {
|
|
194
|
+
queueMicrotask(() => {
|
|
195
|
+
const y = location.savedScroll(location.pathname());
|
|
196
|
+
if (y !== undefined) window.scrollTo(0, y);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
const layoutFiles = layoutOptOut ? [] : [...m.route.layouts].reverse();
|
|
200
|
+
for (const layoutFile of layoutFiles) {
|
|
201
|
+
const Layout = routeComponent(deps.modules, layoutFile);
|
|
202
|
+
const children = tree;
|
|
203
|
+
tree = createComponent(Layout, {
|
|
204
|
+
params: m.params,
|
|
205
|
+
get children() {
|
|
206
|
+
return children;
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return tree;
|
|
211
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route Contexts — the contexts FileRoutes provides around a match:
|
|
3
|
+
* nav items (`page({ meta: { nav } })`), route meta (`page({ meta })`),
|
|
4
|
+
* and named `page({ actions })` keys — plus the hooks that read them
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { type Accessor, createContext, useContext } from "solid-js";
|
|
8
|
+
import type { RouteManifest } from "../domain";
|
|
9
|
+
import { peekModule, type RouteModules } from "./route-modules";
|
|
10
|
+
|
|
11
|
+
/** Provided by FileRoutes around the matched page — `page({ meta })` */
|
|
12
|
+
export const RouteMetaContext = createContext<Record<string, unknown>>({});
|
|
13
|
+
|
|
14
|
+
/** Provided by FileRoutes — names of `page({ actions })` on the route */
|
|
15
|
+
export const RouteActionsContext = createContext<string[]>([]);
|
|
16
|
+
|
|
17
|
+
/** Provided by FileRoutes — routes whose module has `meta.nav` set */
|
|
18
|
+
export const NavContext = createContext<
|
|
19
|
+
Accessor<
|
|
20
|
+
Array<{ path: string; meta: Record<string, unknown>; order?: number }>
|
|
21
|
+
>
|
|
22
|
+
>(() => []);
|
|
23
|
+
|
|
24
|
+
/** Nav routes — `page({ meta: { nav: "main", title: "Home" } })` */
|
|
25
|
+
export const useNav = (): Array<{
|
|
26
|
+
path: string;
|
|
27
|
+
meta: Record<string, unknown>;
|
|
28
|
+
order?: number;
|
|
29
|
+
}> => useContext(NavContext)();
|
|
30
|
+
|
|
31
|
+
/** Nav grouped by `meta.nav.group` — `useNavTree()["docs"]` */
|
|
32
|
+
export const useNavTree = (): Record<
|
|
33
|
+
string,
|
|
34
|
+
Array<{ path: string; meta: Record<string, unknown>; order?: number }>
|
|
35
|
+
> => {
|
|
36
|
+
const items = useNav();
|
|
37
|
+
const groups: Record<
|
|
38
|
+
string,
|
|
39
|
+
Array<{ path: string; meta: Record<string, unknown>; order?: number }>
|
|
40
|
+
> = {};
|
|
41
|
+
for (const item of items) {
|
|
42
|
+
const g = String((item.meta.nav as Record<string, unknown>)?.group ?? "");
|
|
43
|
+
const list = groups[g] ?? [];
|
|
44
|
+
list.push(item);
|
|
45
|
+
groups[g] = list;
|
|
46
|
+
}
|
|
47
|
+
return groups;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Nav items — routes whose (loaded) module declares `meta.nav`,
|
|
52
|
+
* ordered by `page({ order })` (unordered last, then by path)
|
|
53
|
+
*/
|
|
54
|
+
export const computeNavItems = (
|
|
55
|
+
manifest: RouteManifest,
|
|
56
|
+
modules: RouteModules,
|
|
57
|
+
): Accessor<
|
|
58
|
+
Array<{ path: string; meta: Record<string, unknown>; order?: number }>
|
|
59
|
+
> => {
|
|
60
|
+
return () =>
|
|
61
|
+
manifest
|
|
62
|
+
.filter((r) => r.kind !== "api" && r.kind !== "content")
|
|
63
|
+
.map((r) => {
|
|
64
|
+
const mod = peekModule(modules, r.file) as
|
|
65
|
+
| {
|
|
66
|
+
meta?: Record<string, unknown>;
|
|
67
|
+
order?: number;
|
|
68
|
+
}
|
|
69
|
+
| undefined;
|
|
70
|
+
return mod?.meta?.nav !== undefined
|
|
71
|
+
? { path: r.path, meta: mod.meta, order: mod.order }
|
|
72
|
+
: undefined;
|
|
73
|
+
})
|
|
74
|
+
.filter(
|
|
75
|
+
(
|
|
76
|
+
x,
|
|
77
|
+
): x is {
|
|
78
|
+
path: string;
|
|
79
|
+
meta: Record<string, unknown>;
|
|
80
|
+
order: number | undefined;
|
|
81
|
+
} => Boolean(x),
|
|
82
|
+
)
|
|
83
|
+
.sort(
|
|
84
|
+
(a, b) =>
|
|
85
|
+
(a.order ?? Number.MAX_SAFE_INTEGER) -
|
|
86
|
+
(b.order ?? Number.MAX_SAFE_INTEGER) ||
|
|
87
|
+
a.path.localeCompare(b.path),
|
|
88
|
+
);
|
|
89
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `page()` - single-export page definition (replaces the flat
|
|
3
|
+
* loader/loaderCache/schema/beforeLoad/default export set):
|
|
4
|
+
*
|
|
5
|
+
* export default page({
|
|
6
|
+
* params: (p) => ({ id: String(p.id) }),
|
|
7
|
+
* search: (q) => ({ page: Number(q.page ?? 1) }),
|
|
8
|
+
* cache: { ttl: 60, tags: ["users"] },
|
|
9
|
+
* before: (ctx) => ctx.state.user ? undefined : redirect("/login"),
|
|
10
|
+
* load: async ({ params }) => db.user(params.id),
|
|
11
|
+
* head: ({ data }) => ({ title: data()?.name }),
|
|
12
|
+
* component: ({ data, params }) => <p>{data()?.name}</p>,
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* page() is an identity - FileRoutes normalizes the module so the
|
|
16
|
+
* runtime sees { default: component, loader, schema, ... } either way.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { Component } from "solid-js";
|
|
20
|
+
import type { HeadTag, SeoMetaInput } from "#head/types";
|
|
21
|
+
import type { RouteActionContext } from "../domain/operations/actions";
|
|
22
|
+
import type { LoaderContext } from "../domain/operations/loader";
|
|
23
|
+
|
|
24
|
+
const ROUTE_DEF = "__sfRoute";
|
|
25
|
+
|
|
26
|
+
export interface RouteComponentProps<D = unknown, Q = Record<string, string>> {
|
|
27
|
+
/** Loader result accessor - `data()` reactive */
|
|
28
|
+
data: () => D | undefined;
|
|
29
|
+
params: Record<string, string>;
|
|
30
|
+
/** Search params - parsed shape when `page({ search })` is set */
|
|
31
|
+
search: Q;
|
|
32
|
+
slot?: string;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Per-route head input - `SeoMetaInput` sugar or raw HeadTag list */
|
|
37
|
+
export type RouteHeadInput = SeoMetaInput | HeadTag[];
|
|
38
|
+
|
|
39
|
+
export interface RouteHeadContext<D = unknown, Q = Record<string, string>> {
|
|
40
|
+
params: Record<string, string>;
|
|
41
|
+
search: Q;
|
|
42
|
+
data: () => D | undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface RouteDef<D = unknown, Q = Record<string, string>> {
|
|
46
|
+
[ROUTE_DEF]: true;
|
|
47
|
+
/** Validate/transform route params before the loader runs */
|
|
48
|
+
params?: (raw: Record<string, string>) => Record<string, string>;
|
|
49
|
+
/** Validate the request body (non-GET/HEAD) before the loader runs */
|
|
50
|
+
body?: (raw: unknown) => unknown;
|
|
51
|
+
/** Parse/validate search params into the typed `Q` shape */
|
|
52
|
+
search?: (raw: Record<string, string>) => Q;
|
|
53
|
+
/** beforeLoad - may return a Response to short-circuit */
|
|
54
|
+
before?: (ctx: LoaderContext) => unknown | Response | Promise<unknown>;
|
|
55
|
+
/** Loader cache - `{ttl, tags}` enables tagged revalidation */
|
|
56
|
+
cache?: { ttl?: number; tags?: string[] };
|
|
57
|
+
/** The data loader - ctx: {request, params, parent, state} */
|
|
58
|
+
load?: (ctx: LoaderContext) => D | Promise<D>;
|
|
59
|
+
/** Per-route document head - meta/links, reactive on `data()` */
|
|
60
|
+
head?: (ctx: RouteHeadContext<D, Q>) => RouteHeadInput;
|
|
61
|
+
/**
|
|
62
|
+
* Named form actions — POST dispatch picks `form.get("__action")`
|
|
63
|
+
* (or "default" / the single key when unnamed)
|
|
64
|
+
*/
|
|
65
|
+
actions?: Record<
|
|
66
|
+
string,
|
|
67
|
+
(ctx: RouteActionContext) => unknown | Response | Promise<unknown>
|
|
68
|
+
>;
|
|
69
|
+
/** Static shell UI — Suspense/PPR fallback rendered instantly */
|
|
70
|
+
shell?: Component;
|
|
71
|
+
/** Error boundary UI (replaces error.tsx) — gets {error, reset} */
|
|
72
|
+
error?: Component<{ error: unknown; reset?: () => void }>;
|
|
73
|
+
/** Suspense fallback (replaces loading.tsx) */
|
|
74
|
+
loading?: Component;
|
|
75
|
+
/**
|
|
76
|
+
* Re-run the loader on an interval — `poll: 5000` or
|
|
77
|
+
* `poll: { every: 5000, pauseHidden: true }` (skips while tab hidden)
|
|
78
|
+
*/
|
|
79
|
+
poll?: number | { every: number; pauseHidden?: boolean };
|
|
80
|
+
/**
|
|
81
|
+
* Route guards — run before `before`/`load`; return a Response
|
|
82
|
+
* to short-circuit (redirect, 401) or nothing to continue
|
|
83
|
+
*/
|
|
84
|
+
guard?: Array<
|
|
85
|
+
(ctx: LoaderContext) => Response | undefined | Promise<Response | undefined>
|
|
86
|
+
>;
|
|
87
|
+
/** Shorthand for `cache: { ttl }` — `ttl: 30_000` */
|
|
88
|
+
ttl?: number;
|
|
89
|
+
/** view-transition-name applied to the route's root element */
|
|
90
|
+
transition?: string;
|
|
91
|
+
/** Loader freshness hint (ms) — consumers may skip refetch when fresh */
|
|
92
|
+
staleTime?: number;
|
|
93
|
+
/** PWA hint — route works offline (cache-first when offline) */
|
|
94
|
+
offline?: boolean;
|
|
95
|
+
/** `robots: "noindex"` → head robots meta without a head fn */
|
|
96
|
+
robots?: "index,follow" | "noindex" | "nofollow" | "none";
|
|
97
|
+
/** `<title>` shorthand — merged into head without writing a head fn */
|
|
98
|
+
title?: string;
|
|
99
|
+
/** `<meta name="description">` shorthand */
|
|
100
|
+
description?: string;
|
|
101
|
+
/** `<meta name="keywords">` shorthand */
|
|
102
|
+
keywords?: string;
|
|
103
|
+
/** Social image shorthand → `og:image` + `twitter:image` */
|
|
104
|
+
image?: string;
|
|
105
|
+
/** Canonical URL shorthand → `<link rel="canonical">` */
|
|
106
|
+
canonical?: string;
|
|
107
|
+
/** `layout: false` — opt out of inherited `_layout` wrapping */
|
|
108
|
+
layout?: false;
|
|
109
|
+
/**
|
|
110
|
+
* Static redirect — `page({ redirect: "/new" })` short-circuits
|
|
111
|
+
* every request with a 302 before guards/load run
|
|
112
|
+
*/
|
|
113
|
+
redirect?: string;
|
|
114
|
+
/**
|
|
115
|
+
* `scroll: false` — keep scroll position when navigating to this
|
|
116
|
+
* route (chat UIs, feeds)
|
|
117
|
+
*/
|
|
118
|
+
scroll?: false;
|
|
119
|
+
/** Sort key — `useNav()` orders items by it */
|
|
120
|
+
order?: number;
|
|
121
|
+
/** `scripts: false` — render without the hydration script (static page) */
|
|
122
|
+
scripts?: boolean;
|
|
123
|
+
/** Arbitrary route metadata — nav groups, icons; `useRoute().meta` */
|
|
124
|
+
meta?: Record<string, unknown>;
|
|
125
|
+
/** Per-route streaming opt-out (default follows route rules) */
|
|
126
|
+
streaming?: boolean;
|
|
127
|
+
/** Prerender this route at build time */
|
|
128
|
+
prerender?: boolean;
|
|
129
|
+
/** Static paths for dynamic params (SSG) */
|
|
130
|
+
staticParams?: () =>
|
|
131
|
+
| Record<string, string>[]
|
|
132
|
+
| Promise<Record<string, string>[]>;
|
|
133
|
+
component: Component<RouteComponentProps<D, Q>>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const page = <D = unknown, Q = Record<string, string>>(
|
|
137
|
+
def: Omit<RouteDef<D, Q>, typeof ROUTE_DEF>,
|
|
138
|
+
): RouteDef<D, Q> =>
|
|
139
|
+
({
|
|
140
|
+
[ROUTE_DEF]: true,
|
|
141
|
+
...def,
|
|
142
|
+
}) as RouteDef<D, Q>;
|
|
143
|
+
|
|
144
|
+
export const isRouteDef = (v: unknown): v is RouteDef =>
|
|
145
|
+
typeof v === "object" &&
|
|
146
|
+
v !== null &&
|
|
147
|
+
(v as Record<string, unknown>)[ROUTE_DEF] === true;
|
|
148
|
+
|
|
149
|
+
/** `redirect("/login")` - 302 Response for `before`/loaders/actions */
|
|
150
|
+
export const redirect = (path: string, status = 302): Response =>
|
|
151
|
+
new Response(null, { status, headers: { Location: path } });
|
|
152
|
+
|
|
153
|
+
/** Typed path + href - `link("/users/:id", { id: "1" })` */
|
|
154
|
+
export { link } from "../domain/operations/typed";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route Fallbacks
|
|
3
|
+
* 404 and error view resolution — inline module exports (page({ error }))
|
|
4
|
+
* beat the error.tsx/not-found.tsx conventions, which beat props
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { type Component, createComponent, type JSX } from "solid-js";
|
|
8
|
+
import { isServer } from "solid-js/web";
|
|
9
|
+
import { type FileRouteMatch, isNotFoundError } from "../domain";
|
|
10
|
+
import {
|
|
11
|
+
DefaultNotFound,
|
|
12
|
+
lazyModule,
|
|
13
|
+
peekModule,
|
|
14
|
+
type RouteModules,
|
|
15
|
+
} from "./route-modules";
|
|
16
|
+
import type { RouteStatus } from "./status";
|
|
17
|
+
|
|
18
|
+
export const DefaultError: Component<{ error: unknown }> = () => "Error";
|
|
19
|
+
|
|
20
|
+
export interface RouteFallbackDeps {
|
|
21
|
+
modules: RouteModules;
|
|
22
|
+
status: RouteStatus | undefined;
|
|
23
|
+
/** 404 component used when no route matches */
|
|
24
|
+
notFound?: Component;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const renderNotFoundView = (
|
|
28
|
+
deps: RouteFallbackDeps,
|
|
29
|
+
m: FileRouteMatch | null,
|
|
30
|
+
): JSX.Element => {
|
|
31
|
+
if (deps.status) deps.status.status = 404;
|
|
32
|
+
const file = m?.route.notFound;
|
|
33
|
+
const Comp = file
|
|
34
|
+
? lazyModule(deps.modules, file)
|
|
35
|
+
: (deps.notFound ?? DefaultNotFound);
|
|
36
|
+
return createComponent(Comp, {});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const renderErrorView = (
|
|
40
|
+
deps: RouteFallbackDeps,
|
|
41
|
+
m: FileRouteMatch | null,
|
|
42
|
+
error: unknown,
|
|
43
|
+
reset?: () => void,
|
|
44
|
+
): JSX.Element => {
|
|
45
|
+
if (!isServer) console.error("[solid-framework] route error:", error);
|
|
46
|
+
if (deps.status) deps.status.status = isNotFoundError(error) ? 404 : 500;
|
|
47
|
+
// page({ error }) inline component beats the error.tsx convention
|
|
48
|
+
const inline =
|
|
49
|
+
!isNotFoundError(error) && m
|
|
50
|
+
? ((
|
|
51
|
+
peekModule(deps.modules, m.route.file) as
|
|
52
|
+
| { error?: Component }
|
|
53
|
+
| undefined
|
|
54
|
+
)?.error ?? undefined)
|
|
55
|
+
: undefined;
|
|
56
|
+
const file = isNotFoundError(error) ? m?.route.notFound : m?.route.error;
|
|
57
|
+
const Comp =
|
|
58
|
+
inline ??
|
|
59
|
+
(file
|
|
60
|
+
? lazyModule(deps.modules, file)
|
|
61
|
+
: isNotFoundError(error)
|
|
62
|
+
? (deps.notFound ?? DefaultNotFound)
|
|
63
|
+
: DefaultError);
|
|
64
|
+
// error.tsx convention receives `reset` — retry the boundary
|
|
65
|
+
return createComponent(Comp, { error, reset });
|
|
66
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route Module Registry
|
|
3
|
+
* Resolves route modules from the vite glob map (lazy or eager),
|
|
4
|
+
* normalizes them once, and caches the result — plus <Link prefetch>
|
|
5
|
+
* warming of route code and loader endpoints
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { type Component, createComponent, lazy } from "solid-js";
|
|
9
|
+
import { isServer } from "solid-js/web";
|
|
10
|
+
import {
|
|
11
|
+
type I18nConfig,
|
|
12
|
+
stripLocale,
|
|
13
|
+
} from "../../i18n/domain/operations/locale";
|
|
14
|
+
import { matchFileRoute, type RouteManifest } from "../domain";
|
|
15
|
+
import { normalizeRouteModule } from "./normalize-route";
|
|
16
|
+
|
|
17
|
+
export interface RouteModule {
|
|
18
|
+
default?: Component<Record<string, unknown>>;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type RouteModules = Record<
|
|
23
|
+
string,
|
|
24
|
+
RouteModule | Promise<RouteModule> | (() => Promise<RouteModule>)
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
export const DefaultNotFound: Component = () => "Not Found";
|
|
28
|
+
|
|
29
|
+
const resolvedCache = new Map<string, RouteModule>();
|
|
30
|
+
|
|
31
|
+
export const resolveModule = (
|
|
32
|
+
modules: RouteModules,
|
|
33
|
+
file: string,
|
|
34
|
+
): Promise<RouteModule> => {
|
|
35
|
+
const cached = resolvedCache.get(file);
|
|
36
|
+
if (cached) return Promise.resolve(cached);
|
|
37
|
+
const entry = modules[file] ?? modules[`/${file}`];
|
|
38
|
+
if (!entry) return Promise.resolve({});
|
|
39
|
+
return Promise.resolve(typeof entry === "function" ? entry() : entry).then(
|
|
40
|
+
(mod) => {
|
|
41
|
+
const norm = normalizeRouteModule(mod as RouteModule);
|
|
42
|
+
resolvedCache.set(file, norm);
|
|
43
|
+
return norm;
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Sync access for eager-glob or already-resolved (preloaded) modules */
|
|
49
|
+
export const peekModule = (
|
|
50
|
+
modules: RouteModules,
|
|
51
|
+
file: string,
|
|
52
|
+
): RouteModule | undefined => {
|
|
53
|
+
const cached = resolvedCache.get(file);
|
|
54
|
+
if (cached) return cached;
|
|
55
|
+
const entry = modules[file] ?? modules[`/${file}`];
|
|
56
|
+
if (!entry || typeof entry === "function" || entry instanceof Promise) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const norm = normalizeRouteModule(entry as RouteModule);
|
|
60
|
+
resolvedCache.set(file, norm);
|
|
61
|
+
return norm;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const lazyModule = (modules: RouteModules, file: string): Component =>
|
|
65
|
+
lazy(async () => {
|
|
66
|
+
const mod = await resolveModule(modules, file);
|
|
67
|
+
return { default: mod.default ?? DefaultNotFound };
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Route component — renders synchronously once the module is resolved
|
|
72
|
+
* (required for clean hydration: lazy() suspends and mismatches SSR),
|
|
73
|
+
* falls back to lazy() for not-yet-loaded modules (nav code-splitting)
|
|
74
|
+
*/
|
|
75
|
+
export const routeComponent = (
|
|
76
|
+
modules: RouteModules,
|
|
77
|
+
file: string,
|
|
78
|
+
): Component => {
|
|
79
|
+
const mod = peekModule(modules, file);
|
|
80
|
+
if (mod) {
|
|
81
|
+
const Page = mod.default ?? DefaultNotFound;
|
|
82
|
+
return (p: Record<string, unknown>) =>
|
|
83
|
+
createComponent(Page as Component<Record<string, unknown>>, p);
|
|
84
|
+
}
|
|
85
|
+
return lazyModule(modules, file);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Warm the resolved-module cache for a path before render/hydrate —
|
|
90
|
+
* preloading makes routeComponent resolve synchronously so SSR and
|
|
91
|
+
* client hydration produce identical component depth (no mismatch)
|
|
92
|
+
*/
|
|
93
|
+
export const preloadFileRoute = async (
|
|
94
|
+
pathname: string,
|
|
95
|
+
manifest: RouteManifest,
|
|
96
|
+
modules: RouteModules,
|
|
97
|
+
): Promise<void> => {
|
|
98
|
+
const m = matchFileRoute(pathname, manifest);
|
|
99
|
+
if (!m) return;
|
|
100
|
+
const files = [
|
|
101
|
+
m.route.file,
|
|
102
|
+
...m.route.layouts,
|
|
103
|
+
m.route.loading,
|
|
104
|
+
m.route.error,
|
|
105
|
+
m.route.notFound,
|
|
106
|
+
].filter((f): f is string => Boolean(f));
|
|
107
|
+
await Promise.all(files.map((file) => resolveModule(modules, file)));
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Warm lazy route modules ahead of navigation — <Link prefetch>.
|
|
112
|
+
* "shell" warms code only; the other strategies also warm the
|
|
113
|
+
* loader endpoint so the data is hot on click
|
|
114
|
+
*/
|
|
115
|
+
export const createRoutePrefetch = (
|
|
116
|
+
manifest: RouteManifest,
|
|
117
|
+
modules: RouteModules,
|
|
118
|
+
i18n?: I18nConfig,
|
|
119
|
+
): ((path: string, shellOnly?: boolean) => void) => {
|
|
120
|
+
return (path, shellOnly = false) => {
|
|
121
|
+
const unprefixed = i18n ? stripLocale(path, i18n).path : path;
|
|
122
|
+
const m = matchFileRoute(unprefixed, manifest);
|
|
123
|
+
if (!m) return;
|
|
124
|
+
void resolveModule(modules, m.route.file);
|
|
125
|
+
for (const layout of m.route.layouts) {
|
|
126
|
+
void resolveModule(modules, layout);
|
|
127
|
+
}
|
|
128
|
+
if (!shellOnly && !isServer) {
|
|
129
|
+
void resolveModule(modules, m.route.file).then((mod) => {
|
|
130
|
+
if ((mod as { loader?: unknown } | undefined)?.loader) {
|
|
131
|
+
void fetch(
|
|
132
|
+
`/_server/loader?path=${encodeURIComponent(unprefixed)}`,
|
|
133
|
+
).catch(() => {});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel-route slots — `@name` route dirs render inside the layout's
|
|
3
|
+
* `<Outlet name>` placeholder (Next.js `{modal}` layout-prop pattern):
|
|
4
|
+
*
|
|
5
|
+
* // routes/layout.tsx
|
|
6
|
+
* <div>{props.children}<Outlet name="modal" /></div>
|
|
7
|
+
*
|
|
8
|
+
* // routes/@modal/photo.tsx renders into <Outlet name="modal">
|
|
9
|
+
* // when the url matches — nothing when no @modal route matches
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
type Accessor,
|
|
14
|
+
createContext,
|
|
15
|
+
createMemo,
|
|
16
|
+
type JSX,
|
|
17
|
+
useContext,
|
|
18
|
+
} from "solid-js";
|
|
19
|
+
|
|
20
|
+
/** Current slot name inside a `@slot` route — `useSlot()` → "modal" */
|
|
21
|
+
export const SlotContext = createContext<Accessor<string | undefined>>();
|
|
22
|
+
export const useSlot = (): string | undefined => useContext(SlotContext)?.();
|
|
23
|
+
|
|
24
|
+
/** Slot elements provided by <FileRoutes> — name → rendered subtree */
|
|
25
|
+
export const SlotsContext = createContext<
|
|
26
|
+
Accessor<Record<string, JSX.Element>>
|
|
27
|
+
>(() => ({}));
|
|
28
|
+
|
|
29
|
+
export interface OutletProps {
|
|
30
|
+
/** Slot name — the `@name` route rendered here (required) */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Rendered when no @name route matches the current url */
|
|
33
|
+
fallback?: JSX.Element;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Outlet — layout placeholder for a parallel `@name` route */
|
|
37
|
+
export const Outlet = (props: OutletProps): JSX.Element => {
|
|
38
|
+
const slots = useContext(SlotsContext);
|
|
39
|
+
// Accessor return — Solid unwraps function children reactively
|
|
40
|
+
return createMemo(
|
|
41
|
+
() => slots()[props.name] ?? props.fallback ?? null,
|
|
42
|
+
) as unknown as JSX.Element;
|
|
43
|
+
};
|