@stacksjs/defaults 0.70.207 → 0.70.208
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/TODO.md +21 -0
- package/ai/AGENTS.md +79 -0
- package/ai/README.md +45 -0
- package/ai/claude/launch.json +12 -0
- package/ai/skills/stacks-actions/SKILL.md +128 -0
- package/ai/skills/stacks-ai/SKILL.md +276 -0
- package/ai/skills/stacks-alias/SKILL.md +94 -0
- package/ai/skills/stacks-analytics/SKILL.md +91 -0
- package/ai/skills/stacks-api/SKILL.md +738 -0
- package/ai/skills/stacks-arrays/SKILL.md +277 -0
- package/ai/skills/stacks-auth/SKILL.md +422 -0
- package/ai/skills/stacks-auto-imports/SKILL.md +138 -0
- package/ai/skills/stacks-brandkit/SKILL.md +811 -0
- package/ai/skills/stacks-browse/SKILL.md +127 -0
- package/ai/skills/stacks-browse/scripts/browse.ts +492 -0
- package/ai/skills/stacks-browser/SKILL.md +145 -0
- package/ai/skills/stacks-buddy/SKILL.md +676 -0
- package/ai/skills/stacks-build/SKILL.md +163 -0
- package/ai/skills/stacks-cache/SKILL.md +125 -0
- package/ai/skills/stacks-calendar/SKILL.md +113 -0
- package/ai/skills/stacks-chat/SKILL.md +371 -0
- package/ai/skills/stacks-cli/SKILL.md +112 -0
- package/ai/skills/stacks-cloud/SKILL.md +192 -0
- package/ai/skills/stacks-cms/SKILL.md +217 -0
- package/ai/skills/stacks-collections/SKILL.md +82 -0
- package/ai/skills/stacks-commerce/SKILL.md +114 -0
- package/ai/skills/stacks-composables/SKILL.md +161 -0
- package/ai/skills/stacks-config/SKILL.md +144 -0
- package/ai/skills/stacks-configuration/SKILL.md +154 -0
- package/ai/skills/stacks-cron/SKILL.md +123 -0
- package/ai/skills/stacks-crosswind/SKILL.md +190 -0
- package/ai/skills/stacks-dashboard/SKILL.md +173 -0
- package/ai/skills/stacks-database/SKILL.md +286 -0
- package/ai/skills/stacks-datetime/SKILL.md +269 -0
- package/ai/skills/stacks-dependencies/SKILL.md +111 -0
- package/ai/skills/stacks-deploy/SKILL.md +102 -0
- package/ai/skills/stacks-design-brutalist/SKILL.md +110 -0
- package/ai/skills/stacks-design-minimalist/SKILL.md +115 -0
- package/ai/skills/stacks-design-output/SKILL.md +55 -0
- package/ai/skills/stacks-design-soft/SKILL.md +156 -0
- package/ai/skills/stacks-design-taste/SKILL.md +1012 -0
- package/ai/skills/stacks-design-taste-codex/SKILL.md +294 -0
- package/ai/skills/stacks-desktop/SKILL.md +78 -0
- package/ai/skills/stacks-development/SKILL.md +298 -0
- package/ai/skills/stacks-dns/SKILL.md +149 -0
- package/ai/skills/stacks-docs/SKILL.md +109 -0
- package/ai/skills/stacks-email/SKILL.md +236 -0
- package/ai/skills/stacks-enums/SKILL.md +100 -0
- package/ai/skills/stacks-env/SKILL.md +181 -0
- package/ai/skills/stacks-error-handling/SKILL.md +137 -0
- package/ai/skills/stacks-events/SKILL.md +228 -0
- package/ai/skills/stacks-faker/SKILL.md +158 -0
- package/ai/skills/stacks-git/SKILL.md +158 -0
- package/ai/skills/stacks-guard/SKILL.md +98 -0
- package/ai/skills/stacks-health/SKILL.md +75 -0
- package/ai/skills/stacks-http/SKILL.md +316 -0
- package/ai/skills/stacks-i18n/SKILL.md +198 -0
- package/ai/skills/stacks-image-to-code/SKILL.md +629 -0
- package/ai/skills/stacks-imagegen-mobile/SKILL.md +1474 -0
- package/ai/skills/stacks-imagegen-web/SKILL.md +998 -0
- package/ai/skills/stacks-investigate/SKILL.md +119 -0
- package/ai/skills/stacks-jobs/SKILL.md +136 -0
- package/ai/skills/stacks-lint/SKILL.md +184 -0
- package/ai/skills/stacks-listeners/SKILL.md +99 -0
- package/ai/skills/stacks-logging/SKILL.md +78 -0
- package/ai/skills/stacks-mail/SKILL.md +120 -0
- package/ai/skills/stacks-middleware/SKILL.md +249 -0
- package/ai/skills/stacks-migrations/SKILL.md +105 -0
- package/ai/skills/stacks-models/SKILL.md +267 -0
- package/ai/skills/stacks-new-feature/SKILL.md +206 -0
- package/ai/skills/stacks-notifications/SKILL.md +210 -0
- package/ai/skills/stacks-objects/SKILL.md +205 -0
- package/ai/skills/stacks-office-hours/SKILL.md +134 -0
- package/ai/skills/stacks-orm/SKILL.md +342 -0
- package/ai/skills/stacks-path/SKILL.md +118 -0
- package/ai/skills/stacks-payments/SKILL.md +373 -0
- package/ai/skills/stacks-plan-review/SKILL.md +152 -0
- package/ai/skills/stacks-plugins/SKILL.md +149 -0
- package/ai/skills/stacks-push/SKILL.md +376 -0
- package/ai/skills/stacks-query-builder/SKILL.md +128 -0
- package/ai/skills/stacks-queue/SKILL.md +559 -0
- package/ai/skills/stacks-realtime/SKILL.md +442 -0
- package/ai/skills/stacks-redesign/SKILL.md +182 -0
- package/ai/skills/stacks-registry/SKILL.md +58 -0
- package/ai/skills/stacks-repl/SKILL.md +80 -0
- package/ai/skills/stacks-retro/SKILL.md +122 -0
- package/ai/skills/stacks-review/SKILL.md +135 -0
- package/ai/skills/stacks-router/SKILL.md +231 -0
- package/ai/skills/stacks-routes/SKILL.md +105 -0
- package/ai/skills/stacks-scaffolding/SKILL.md +162 -0
- package/ai/skills/stacks-scheduler/SKILL.md +363 -0
- package/ai/skills/stacks-search-engine/SKILL.md +112 -0
- package/ai/skills/stacks-security/SKILL.md +129 -0
- package/ai/skills/stacks-security-audit/SKILL.md +128 -0
- package/ai/skills/stacks-server/SKILL.md +458 -0
- package/ai/skills/stacks-shell/SKILL.md +62 -0
- package/ai/skills/stacks-slug/SKILL.md +87 -0
- package/ai/skills/stacks-sms/SKILL.md +385 -0
- package/ai/skills/stacks-socials/SKILL.md +303 -0
- package/ai/skills/stacks-storage/SKILL.md +576 -0
- package/ai/skills/stacks-strings/SKILL.md +416 -0
- package/ai/skills/stacks-stx/SKILL.md +176 -0
- package/ai/skills/stacks-technical-diagrams/LICENSE +22 -0
- package/ai/skills/stacks-technical-diagrams/SKILL.md +290 -0
- package/ai/skills/stacks-technical-diagrams/agents/openai.yaml +4 -0
- package/ai/skills/stacks-technical-diagrams/assets/template.html +1252 -0
- package/ai/skills/stacks-technical-diagrams/bin/technical-diagrams.mjs +289 -0
- package/ai/skills/stacks-technical-diagrams/bunfig.toml +1 -0
- package/ai/skills/stacks-technical-diagrams/examples/agent-run.lifecycle.json +64 -0
- package/ai/skills/stacks-technical-diagrams/examples/agent-tool-call.workflow.json +88 -0
- package/ai/skills/stacks-technical-diagrams/examples/cache-miss-request.sequence.json +75 -0
- package/ai/skills/stacks-technical-diagrams/examples/product-analytics.dataflow.json +70 -0
- package/ai/skills/stacks-technical-diagrams/examples/web-app.architecture.json +41 -0
- package/ai/skills/stacks-technical-diagrams/renderers/architecture/grid.mjs +62 -0
- package/ai/skills/stacks-technical-diagrams/renderers/architecture/render-architecture.mjs +371 -0
- package/ai/skills/stacks-technical-diagrams/renderers/dataflow/README.md +82 -0
- package/ai/skills/stacks-technical-diagrams/renderers/dataflow/render-dataflow.mjs +295 -0
- package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/README.md +91 -0
- package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/render-lifecycle.mjs +384 -0
- package/ai/skills/stacks-technical-diagrams/renderers/sequence/README.md +84 -0
- package/ai/skills/stacks-technical-diagrams/renderers/sequence/render-sequence.mjs +257 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/cli.mjs +42 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/generated-validators.mjs +13 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/geometry.mjs +230 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/layout-report.mjs +40 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/utils.mjs +88 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/validator.mjs +40 -0
- package/ai/skills/stacks-technical-diagrams/renderers/workflow/README.md +103 -0
- package/ai/skills/stacks-technical-diagrams/renderers/workflow/render-workflow.mjs +481 -0
- package/ai/skills/stacks-technical-diagrams/schemas/README.md +68 -0
- package/ai/skills/stacks-technical-diagrams/schemas/architecture.schema.json +121 -0
- package/ai/skills/stacks-technical-diagrams/schemas/common.schema.json +43 -0
- package/ai/skills/stacks-technical-diagrams/schemas/dataflow.schema.json +221 -0
- package/ai/skills/stacks-technical-diagrams/schemas/lifecycle.schema.json +241 -0
- package/ai/skills/stacks-technical-diagrams/schemas/sequence.schema.json +186 -0
- package/ai/skills/stacks-technical-diagrams/schemas/workflow.schema.json +332 -0
- package/ai/skills/stacks-technical-diagrams/scripts/check-render-output.mjs +297 -0
- package/ai/skills/stacks-technical-diagrams/scripts/render-examples.mjs +28 -0
- package/ai/skills/stacks-testing/SKILL.md +129 -0
- package/ai/skills/stacks-tunnel/SKILL.md +125 -0
- package/ai/skills/stacks-types/SKILL.md +178 -0
- package/ai/skills/stacks-ui/SKILL.md +246 -0
- package/ai/skills/stacks-utils/SKILL.md +444 -0
- package/ai/skills/stacks-validation/SKILL.md +371 -0
- package/ai/skills/stacks-whois/SKILL.md +315 -0
- package/assets/world-map-data.ts +121 -0
- package/bootstrap.ts +114 -0
- package/docs/api-examples.md +46 -0
- package/docs/index.md +24 -0
- package/docs/markdown-examples.md +87 -0
- package/functions/analytics.ts +97 -0
- package/functions/api.ts +143 -0
- package/functions/auth.ts +208 -0
- package/functions/billing/payments.ts +149 -0
- package/functions/blog.ts +120 -0
- package/functions/cms/categorizables.ts +107 -0
- package/functions/cms/pages.ts +108 -0
- package/functions/cms/posts.ts +100 -0
- package/functions/cms/taggables.ts +102 -0
- package/functions/commerce/coupons.ts +128 -0
- package/functions/commerce/customers.ts +128 -0
- package/functions/commerce/gift-cards.ts +119 -0
- package/functions/commerce/orders.ts +112 -0
- package/functions/commerce/payments.ts +119 -0
- package/functions/commerce/products/categories.ts +123 -0
- package/functions/commerce/products/manufacturers.ts +123 -0
- package/functions/commerce/products/products.ts +123 -0
- package/functions/commerce/products/reviews.ts +123 -0
- package/functions/commerce/products/units.ts +123 -0
- package/functions/commerce/products/variants.ts +123 -0
- package/functions/commerce/shippings/delivery-routes.ts +123 -0
- package/functions/commerce/shippings/digital-deliveries.ts +119 -0
- package/functions/commerce/shippings/drivers.ts +123 -0
- package/functions/commerce/shippings/license-keys.ts +123 -0
- package/functions/commerce/shippings/shipping-methods.ts +123 -0
- package/functions/commerce/shippings/shipping-rates.ts +119 -0
- package/functions/commerce/shippings/shipping-zones.ts +119 -0
- package/functions/commerce/taxes.ts +119 -0
- package/functions/commerce/waitlist/products.ts +123 -0
- package/functions/commerce/waitlist/restaurants.ts +123 -0
- package/functions/craft.ts +107 -0
- package/functions/dashboard.ts +153 -0
- package/functions/inbox.ts +95 -0
- package/functions/jobs.ts +86 -0
- package/functions/monitoring/errors.ts +295 -0
- package/functions/queue.ts +111 -0
- package/functions/realtime/websockets.ts +96 -0
- package/functions/realtime.ts +52 -0
- package/functions/releases.ts +49 -0
- package/functions/search.ts +126 -0
- package/functions/toasts.ts +95 -0
- package/functions/uploads.ts +216 -0
- package/ide/.gitignore +4 -0
- package/ide/cursor/rules/auto-imports.mdc +574 -0
- package/ide/cursor/rules/code-style.mdc +12 -0
- package/ide/cursor/rules/documentation.mdc +9 -0
- package/ide/cursor/rules/error-handling-validation.mdc +11 -0
- package/ide/cursor/rules/key-conventions.mdc +11 -0
- package/ide/cursor/rules/project-structure.mdc +169 -0
- package/ide/cursor/rules/readme.mdc +318 -0
- package/ide/cursor/rules/syntax-formatting.mdc +9 -0
- package/ide/cursor/rules/testing.mdc +10 -0
- package/ide/cursor/rules/typescript.mdc +9 -0
- package/ide/cursor/rules/ui-styling.mdc +0 -0
- package/ide/dictionary.txt +397 -0
- package/ide/jetbrains/.fleet/settings.json +4 -0
- package/ide/jetbrains/.idea/.gitignore +5 -0
- package/ide/jetbrains/.idea/.name +1 -0
- package/ide/jetbrains/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/ide/jetbrains/.idea/jsLinters/eslint.xml +7 -0
- package/ide/jetbrains/.idea/modules.xml +8 -0
- package/ide/jetbrains/.idea/stacks.iml +22 -0
- package/ide/jetbrains/.idea/vcs.xml +6 -0
- package/ide/jetbrains/.idea/webResources.xml +14 -0
- package/ide/jetbrains/IntelliJ IDEA Global Settings +0 -0
- package/ide/jetbrains/installed.txt +4 -0
- package/ide/jetbrains/options/github-copilot.xml +5 -0
- package/ide/jetbrains/options/nodejs.xml +7 -0
- package/ide/jetbrains/options/templates.xml +124 -0
- package/ide/jetbrains/templates/JavaScript.xml +6 -0
- package/ide/jetbrains/templates/Stacks.xml +8 -0
- package/ide/vscode/.vscode/README.md +23 -0
- package/ide/vscode/.vscode/extensions.json +5 -0
- package/ide/vscode/.vscode/settings.json +176 -0
- package/ide/vscode/.vscode/stacks.code-snippets +181 -0
- package/ide/vscode/LICENSE.md +21 -0
- package/ide/vscode/README.md +36 -0
- package/ide/vscode/logo.png +0 -0
- package/ide/vscode/package.json +79 -0
- package/ide/zed/.zed/settings.json +139 -0
- package/lang/README.md +28 -0
- package/lang/de.yml +14 -0
- package/lang/en.yml +15 -0
- package/package.json +19 -3
- package/project/bootstrap +161 -0
- package/project/buddy +175 -0
- package/project/storage/framework/tsconfig.app.json +50 -0
- package/project/storage/framework/tsconfig.base.json +58 -0
- package/routes/core.ts +78 -0
- package/routes/dashboard-api.ts +233 -0
- package/routes/dashboard.ts +739 -0
- package/routes/email.ts +129 -0
- package/stores/[name].stx +16 -0
- package/stores/git.ts +71 -0
- package/stores/payment.ts +474 -0
- package/stores/queue.ts +43 -0
- package/stores/user.ts +29 -0
- package/stx-components-plugin.ts +25 -0
- package/styles/design-tokens.css +597 -0
- package/types/dashboard.ts +70 -0
- package/types/defaults.ts +438 -0
- package/vcs/github/CODE_OF_CONDUCT.md +83 -0
- package/vcs/github/CONTRIBUTING.md +187 -0
- package/vcs/github/EXPLANATIONS.md +41 -0
- package/vcs/github/FUNDING.yml +1 -0
- package/vcs/github/ISSUE_TEMPLATE/bug_report.yml +49 -0
- package/vcs/github/ISSUE_TEMPLATE/config.yml +10 -0
- package/vcs/github/ISSUE_TEMPLATE/feature_request.yml +44 -0
- package/vcs/github/SECURITY.md +70 -0
- package/vcs/github/renovate.json +5 -0
- package/vcs/github/stale.yml +14 -0
- package/vcs/github/workflows/README.md +16 -0
- package/vcs/github/workflows/ci.yml +114 -0
- package/vcs/github/workflows/export-size.yml +25 -0
- package/vcs/github/workflows/labeler.yml +13 -0
- package/vcs/github/workflows/release.yml +219 -0
- package/views/[...all].stx +8 -0
- package/views/about.md +3 -0
- package/views/auth/login.stx +1 -0
- package/views/auth/signup.stx +85 -0
- package/views/dashboard/.discovered-models.json +542 -0
- package/views/dashboard/AUDIT.md +904 -0
- package/views/dashboard/[...all].stx +89 -0
- package/views/dashboard/access-tokens/index.stx +177 -0
- package/views/dashboard/actions/index.stx +129 -0
- package/views/dashboard/analytics/blog/index.stx +356 -0
- package/views/dashboard/analytics/browsers/index.stx +263 -0
- package/views/dashboard/analytics/commerce/sales/index.stx +329 -0
- package/views/dashboard/analytics/commerce/web/index.stx +379 -0
- package/views/dashboard/analytics/countries/index.stx +289 -0
- package/views/dashboard/analytics/devices/index.stx +305 -0
- package/views/dashboard/analytics/events/index.stx +536 -0
- package/views/dashboard/analytics/index.stx +88 -0
- package/views/dashboard/analytics/marketing/index.stx +315 -0
- package/views/dashboard/analytics/pages/index.stx +271 -0
- package/views/dashboard/analytics/referrers/index.stx +319 -0
- package/views/dashboard/analytics/web/index.stx +356 -0
- package/views/dashboard/buddy/index.stx +198 -0
- package/views/dashboard/ci/index.stx +462 -0
- package/views/dashboard/cloud/index.stx +452 -0
- package/views/dashboard/commands/index.stx +295 -0
- package/views/dashboard/commerce/categories/index.stx +406 -0
- package/views/dashboard/commerce/coupons/index.stx +485 -0
- package/views/dashboard/commerce/customers/index.stx +410 -0
- package/views/dashboard/commerce/dashboard/index.stx +287 -0
- package/views/dashboard/commerce/delivery/delivery-routes.stx +305 -0
- package/views/dashboard/commerce/delivery/digital-delivery.stx +332 -0
- package/views/dashboard/commerce/delivery/drivers.stx +397 -0
- package/views/dashboard/commerce/delivery/index.stx +18 -0
- package/views/dashboard/commerce/delivery/license-keys.stx +380 -0
- package/views/dashboard/commerce/delivery/shipping-methods.stx +346 -0
- package/views/dashboard/commerce/delivery/shipping-rates.stx +338 -0
- package/views/dashboard/commerce/delivery/shipping-zones.stx +302 -0
- package/views/dashboard/commerce/delivery/tabs.ts +25 -0
- package/views/dashboard/commerce/gift-cards/index.stx +561 -0
- package/views/dashboard/commerce/manufacturers/index.stx +308 -0
- package/views/dashboard/commerce/orders/index.stx +247 -0
- package/views/dashboard/commerce/payments/index.stx +535 -0
- package/views/dashboard/commerce/pos/index.stx +653 -0
- package/views/dashboard/commerce/printers/devices/index.stx +273 -0
- package/views/dashboard/commerce/printers/receipts/index.stx +308 -0
- package/views/dashboard/commerce/products/detail.stx +563 -0
- package/views/dashboard/commerce/products/index.stx +370 -0
- package/views/dashboard/commerce/reviews/index.stx +656 -0
- package/views/dashboard/commerce/reviews/index.ts +0 -0
- package/views/dashboard/commerce/taxes/index.stx +377 -0
- package/views/dashboard/commerce/units/index.stx +317 -0
- package/views/dashboard/commerce/variants/index.stx +319 -0
- package/views/dashboard/commerce/waitlist/products.stx +942 -0
- package/views/dashboard/commerce/waitlist/restaurant.stx +1024 -0
- package/views/dashboard/components/index.stx +330 -0
- package/views/dashboard/composables/index.ts +19 -0
- package/views/dashboard/composables/useChart.ts +77 -0
- package/views/dashboard/composables/useNavigation.ts +99 -0
- package/views/dashboard/composables/useRole.ts +58 -0
- package/views/dashboard/composables/useTheme.ts +74 -0
- package/views/dashboard/content/authors/index.stx +171 -0
- package/views/dashboard/content/blog/index.stx +493 -0
- package/views/dashboard/content/categories/index.stx +169 -0
- package/views/dashboard/content/comments/index.stx +189 -0
- package/views/dashboard/content/dashboard.stx +383 -0
- package/views/dashboard/content/files/index.stx +706 -0
- package/views/dashboard/content/pages/index.stx +174 -0
- package/views/dashboard/content/posts/index.stx +269 -0
- package/views/dashboard/content/seo/index.stx +240 -0
- package/views/dashboard/content/tags/index.stx +167 -0
- package/views/dashboard/data/activity/index.stx +261 -0
- package/views/dashboard/data/dashboard/index.stx +116 -0
- package/views/dashboard/data/subscribers.stx +270 -0
- package/views/dashboard/data/teams.stx +275 -0
- package/views/dashboard/data/users.stx +279 -0
- package/views/dashboard/dependencies/index.stx +178 -0
- package/views/dashboard/deployments/[id].stx +234 -0
- package/views/dashboard/deployments/index.stx +9 -0
- package/views/dashboard/dns/index.stx +163 -0
- package/views/dashboard/environment/index.stx +283 -0
- package/views/dashboard/errors/index.stx +274 -0
- package/views/dashboard/forgot-password.stx +57 -0
- package/views/dashboard/functions/index.stx +159 -0
- package/views/dashboard/health/index.stx +248 -0
- package/views/dashboard/inbox/activity.stx +350 -0
- package/views/dashboard/inbox/index.stx +452 -0
- package/views/dashboard/inbox/settings.stx +290 -0
- package/views/dashboard/index.stx +252 -0
- package/views/dashboard/insights/index.stx +529 -0
- package/views/dashboard/jobs/[id].stx +430 -0
- package/views/dashboard/jobs/history.stx +222 -0
- package/views/dashboard/jobs/index.stx +214 -0
- package/views/dashboard/kanban/[id].stx +899 -0
- package/views/dashboard/kanban/index.stx +260 -0
- package/views/dashboard/layouts/default.stx +565 -0
- package/views/dashboard/layouts/guest.stx +10 -0
- package/views/dashboard/login.stx +48 -0
- package/views/dashboard/logs/index.stx +540 -0
- package/views/dashboard/mailboxes/index.stx +149 -0
- package/views/dashboard/management/permissions/index.stx +490 -0
- package/views/dashboard/marketing/campaigns/index.stx +604 -0
- package/views/dashboard/marketing/lists/index.stx +514 -0
- package/views/dashboard/marketing/reviews/index.stx +475 -0
- package/views/dashboard/marketing/social-posts/index.stx +560 -0
- package/views/dashboard/models/[model].stx +195 -0
- package/views/dashboard/models/index.stx +159 -0
- package/views/dashboard/monitoring/errors/index.stx +415 -0
- package/views/dashboard/notifications/dashboard.stx +383 -0
- package/views/dashboard/notifications/email.stx +336 -0
- package/views/dashboard/notifications/history.stx +373 -0
- package/views/dashboard/notifications/sms.stx +332 -0
- package/views/dashboard/packages/index.stx +195 -0
- package/views/dashboard/queries/[id].stx +381 -0
- package/views/dashboard/queries/history.stx +227 -0
- package/views/dashboard/queries/index.stx +335 -0
- package/views/dashboard/queries/slow.stx +318 -0
- package/views/dashboard/queue/index.stx +427 -0
- package/views/dashboard/realtime/index.stx +429 -0
- package/views/dashboard/register.stx +46 -0
- package/views/dashboard/releases/index.stx +389 -0
- package/views/dashboard/requests/index.stx +462 -0
- package/views/dashboard/serverless/index.stx +475 -0
- package/views/dashboard/servers/[id].stx +299 -0
- package/views/dashboard/servers/index.stx +483 -0
- package/views/dashboard/settings/billing.stx +50 -0
- package/views/dashboard/settings/index.stx +256 -0
- package/views/dashboard/settings/mail.stx +252 -0
- package/views/dashboard/stores/auth.ts +123 -0
- package/views/dashboard/stores/ci.ts +342 -0
- package/views/dashboard/stores/index.ts +129 -0
- package/views/dashboard/stores/kanban.ts +723 -0
- package/views/dashboard/stores/rbac.ts +350 -0
- package/views/dashboard/stx.config.ts +34 -0
- package/views/dashboard/teams/[id].stx +170 -0
- package/views/forum/category.stx +92 -0
- package/views/forum/index.stx +209 -0
- package/views/forum/new-topic.stx +113 -0
- package/views/forum/profile.stx +1 -0
- package/views/forum/topic.stx +143 -0
- package/views/hello-world/[name].stx +47 -0
- package/views/index.stx +21 -0
- package/views/system-tray/index.stx +147 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-cms
|
|
3
|
+
description: Use when working with the CMS in a Stacks application — posts, authors, pages, categories, tags, comments, blog configuration, RSS feeds, or sitemaps. Covers @stacksjs/cms, CMS models, routes, and actions.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks CMS
|
|
10
|
+
|
|
11
|
+
## Key Paths
|
|
12
|
+
- Core package: `storage/framework/core/cms/src/`
|
|
13
|
+
- Models: `storage/framework/defaults/app/Models/Content/` (Post, Author, Page)
|
|
14
|
+
- Models: `storage/framework/defaults/app/Models/` (Comment, Tag)
|
|
15
|
+
- Actions: `storage/framework/defaults/app/Actions/Cms/`
|
|
16
|
+
- Routes: `routes/api.ts` (CMS and blog endpoints)
|
|
17
|
+
- Config: `config/blog.ts`
|
|
18
|
+
|
|
19
|
+
## Source Files
|
|
20
|
+
```
|
|
21
|
+
cms/src/
|
|
22
|
+
├── index.ts # CmsNamespace — top-level API
|
|
23
|
+
├── posts/
|
|
24
|
+
│ ├── fetch.ts # fetchById, fetchAll, fetchByStatus, fetchByCategory, fetchByAuthor
|
|
25
|
+
│ ├── store.ts # store, attach, detach, sync (pivot tables)
|
|
26
|
+
│ ├── update.ts # update
|
|
27
|
+
│ └── destroy.ts # destroy, bulkDestroy
|
|
28
|
+
├── authors/
|
|
29
|
+
│ ├── fetch.ts # fetchAll, fetchById, findByEmail, findByName, findByUserId
|
|
30
|
+
│ ├── store.ts # store, findOrCreate
|
|
31
|
+
│ ├── update.ts # update
|
|
32
|
+
│ └── destroy.ts # destroy
|
|
33
|
+
├── pages/
|
|
34
|
+
│ ├── fetch.ts # fetchById, fetchAll, fetchByTemplate, fetchByAuthor
|
|
35
|
+
│ └── store.ts # store
|
|
36
|
+
├── categorizables/ # Categories with polymorphic pivot
|
|
37
|
+
├── taggables/ # Tags with polymorphic pivot
|
|
38
|
+
├── commentables/ # Comments with polymorphic support
|
|
39
|
+
└── build.ts # Blog static site generation
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## CMS Namespace
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
interface CmsNamespace {
|
|
46
|
+
posts: PostsModule
|
|
47
|
+
postCategories: PostCategoriesModule
|
|
48
|
+
tags: TagsModule
|
|
49
|
+
comments: CommentsModule
|
|
50
|
+
authors: AuthorsModule
|
|
51
|
+
pages: PagesModule
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Models
|
|
56
|
+
|
|
57
|
+
### Post
|
|
58
|
+
- **Table**: `posts`
|
|
59
|
+
- **Relationships**: `belongsTo(['Author'])`
|
|
60
|
+
- **Traits**: UUID, Timestamps, Search, Seeder (20), Categorizable, Taggable, Commentable, API routes
|
|
61
|
+
|
|
62
|
+
| Field | Type | Validation | Default |
|
|
63
|
+
|-------|------|------------|---------|
|
|
64
|
+
| title | string | required, 3-255 chars | — |
|
|
65
|
+
| content | string | required, 10-1000 chars | — |
|
|
66
|
+
| excerpt | string | optional, 10-500 chars | — |
|
|
67
|
+
| poster | string | optional, valid URL | — |
|
|
68
|
+
| views | number | — | 0 |
|
|
69
|
+
| publishedAt | timestamp | optional | — |
|
|
70
|
+
| status | enum | published/draft/archived | draft |
|
|
71
|
+
| isFeatured | number | 0 or 1 | — |
|
|
72
|
+
|
|
73
|
+
### Author
|
|
74
|
+
- **Table**: `authors`, **Relationships**: `hasMany(['Post'])`, `belongsTo(['User'])`
|
|
75
|
+
- **Attributes**: `name` (5-255), `email` (unique, valid email)
|
|
76
|
+
- **Indexes**: Composite on `(email, name)`
|
|
77
|
+
|
|
78
|
+
### Page
|
|
79
|
+
- **Table**: `pages`, **Relationships**: `belongsTo(['Author'])`
|
|
80
|
+
- **Attributes**: `title`, `template` (enum: default/landing/blog/contact), `views`, `conversions`, `publishedAt`
|
|
81
|
+
|
|
82
|
+
### Comment
|
|
83
|
+
- **Table**: `comments`, **Relationships**: `belongsTo(['Post', 'User'])`
|
|
84
|
+
- **Attributes**: `authorName`, `authorEmail`, `content` (1-2000), `status` (pending/approved/spam/trash), `ipAddress`, `userAgent`, `isApproved`
|
|
85
|
+
|
|
86
|
+
### Tag
|
|
87
|
+
- **Table**: `tags`
|
|
88
|
+
- **Attributes**: `name` (unique, 2-50), `slug` (unique), `description`, `postCount`, `color`
|
|
89
|
+
|
|
90
|
+
## Posts API
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// Fetch
|
|
94
|
+
cms.posts.fetchById(id: number): Promise<PostJsonResponse | undefined>
|
|
95
|
+
cms.posts.fetchAll(): Promise<PostJsonResponse[]>
|
|
96
|
+
cms.posts.fetchByStatus(status: 'published' | 'draft' | 'archived'): Promise<PostJsonResponse[]>
|
|
97
|
+
cms.posts.fetchByCategory(category: string): Promise<PostJsonResponse[]>
|
|
98
|
+
cms.posts.fetchByAuthor(author: string): Promise<PostJsonResponse[]>
|
|
99
|
+
cms.posts.fetchByMinViews(minViews: number): Promise<PostJsonResponse[]>
|
|
100
|
+
cms.posts.fetchPublishedAfter(timestamp: number): Promise<PostJsonResponse[]>
|
|
101
|
+
|
|
102
|
+
// Store with pivot auto-attach
|
|
103
|
+
cms.posts.store(data: NewPost & { body?: string, category?: string }): Promise<PostJsonResponse>
|
|
104
|
+
cms.posts.attach(postId, tableName: 'categorizable_models' | 'taggable_models', ids: number[]): Promise<void>
|
|
105
|
+
cms.posts.detach(postId, tableName, ids?: number[]): Promise<void>
|
|
106
|
+
cms.posts.sync(postId, tableName, ids: number[]): Promise<void>
|
|
107
|
+
|
|
108
|
+
// Update & Destroy
|
|
109
|
+
cms.posts.update(id: number, data: Partial<PostUpdate>): Promise<PostJsonResponse>
|
|
110
|
+
cms.posts.destroy(id: number): Promise<boolean>
|
|
111
|
+
cms.posts.bulkDestroy(ids: number[]): Promise<number>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Authors API
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
cms.authors.findOrCreate(data: AuthorData): Promise<AuthorJsonResponse>
|
|
118
|
+
cms.authors.store(data: NewAuthor): Promise<AuthorJsonResponse>
|
|
119
|
+
cms.authors.findByEmail(email: string): Promise<AuthorJsonResponse | undefined>
|
|
120
|
+
cms.authors.findByName(name: string): Promise<AuthorJsonResponse | undefined>
|
|
121
|
+
cms.authors.findByUserId(userId: number): Promise<AuthorJsonResponse | undefined>
|
|
122
|
+
cms.authors.fetchAll(): Promise<AuthorJsonResponse[]>
|
|
123
|
+
cms.authors.fetchById(id: number): Promise<AuthorJsonResponse | undefined>
|
|
124
|
+
cms.authors.update(id, data): Promise<AuthorJsonResponse>
|
|
125
|
+
cms.authors.destroy(id): Promise<boolean>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Tags API
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
cms.tags.findOrCreateMany(names: string[], taggableType: string): Promise<number[]>
|
|
132
|
+
cms.tags.firstOrCreate(name: string, taggableType: string): Promise<TaggableTable>
|
|
133
|
+
cms.tags.fetchTags(): Promise<TaggableTable[]>
|
|
134
|
+
cms.tags.fetchTagById(id: number): Promise<TaggableTable | undefined>
|
|
135
|
+
cms.tags.countTaggedPosts(taggableType: string): Promise<number>
|
|
136
|
+
cms.tags.findMostUsedTag(taggableType?: string): Promise<{ name: string, count: number } | null>
|
|
137
|
+
cms.tags.fetchTagsWithPostCounts(): Promise<Array<{ name: string, postCount: number }>>
|
|
138
|
+
cms.tags.fetchTagDistribution(): Promise<Array<{ name: string, count: number, percentage: number }>>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Comments API
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
cms.comments.createComment(data: CreateCommentInput): Promise<CommentablesTable>
|
|
145
|
+
cms.comments.updateComment(id: number, input: UpdateCommentInput): Promise<CommentablesTable>
|
|
146
|
+
cms.comments.approveComment(id: number): Promise<CommentablesTable>
|
|
147
|
+
cms.comments.rejectComment(id: number): Promise<CommentablesTable>
|
|
148
|
+
cms.comments.deleteComment(id: number): Promise<void>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Routes
|
|
152
|
+
|
|
153
|
+
### CMS Admin Routes
|
|
154
|
+
| Method | Path | Action |
|
|
155
|
+
|--------|------|--------|
|
|
156
|
+
| GET | `/cms/posts` | PostIndexAction |
|
|
157
|
+
| GET | `/cms/posts/{id}` | PostShowAction |
|
|
158
|
+
| POST | `/cms/posts` | PostStoreAction |
|
|
159
|
+
| PATCH | `/cms/posts/{id}` | PostUpdateAction |
|
|
160
|
+
| DELETE | `/cms/posts/{id}` | PostDestroyAction |
|
|
161
|
+
| PATCH | `/cms/posts/{id}/views` | PostViewsUpdateAction |
|
|
162
|
+
| CRUD | `/cms/authors/*` | Author CRUD |
|
|
163
|
+
| CRUD | `/cms/categories/*` | Categorizable CRUD |
|
|
164
|
+
| CRUD | `/cms/tags/*` | Taggable CRUD |
|
|
165
|
+
| CRUD | `/cms/comments/*` | Comment CRUD |
|
|
166
|
+
| CRUD | `/cms/pages/*` | Page CRUD |
|
|
167
|
+
|
|
168
|
+
### Public Blog Routes
|
|
169
|
+
| Method | Path | Description |
|
|
170
|
+
|--------|------|-------------|
|
|
171
|
+
| GET | `/blog/posts` | Public post listing |
|
|
172
|
+
| GET | `/blog/posts/{id}` | Public post detail |
|
|
173
|
+
| GET | `/blog/categories` | Public categories |
|
|
174
|
+
| GET | `/blog/tags` | Public tags |
|
|
175
|
+
| GET | `/blog/feed.xml` | RSS 2.0 feed (20 recent) |
|
|
176
|
+
| GET | `/blog/sitemap.xml` | XML sitemap for SEO |
|
|
177
|
+
|
|
178
|
+
## Blog Configuration (config/blog.ts)
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
{
|
|
182
|
+
subdomain: 'blog',
|
|
183
|
+
title: 'Stacks Blog',
|
|
184
|
+
description: 'The official Stacks.js blog',
|
|
185
|
+
postsPerPage: 10,
|
|
186
|
+
enableComments: true,
|
|
187
|
+
enableRss: true,
|
|
188
|
+
enableSitemap: true,
|
|
189
|
+
enableSearch: true,
|
|
190
|
+
social: { twitter: '@stacksjs', github: 'stacksjs/stacks' },
|
|
191
|
+
theme: { primaryColor: '#3451b2', logo: '/images/logos/logo-transparent.svg' },
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Database Tables
|
|
196
|
+
|
|
197
|
+
| Table | Purpose |
|
|
198
|
+
|-------|---------|
|
|
199
|
+
| `posts` | Blog posts |
|
|
200
|
+
| `authors` | Content creators |
|
|
201
|
+
| `pages` | Static pages |
|
|
202
|
+
| `comments` | Comments (polymorphic) |
|
|
203
|
+
| `tags` | Tag definitions |
|
|
204
|
+
| `taggable_models` | Polymorphic pivot: tag ↔ model |
|
|
205
|
+
| `categorizables` | Category definitions |
|
|
206
|
+
| `categorizable_models` | Polymorphic pivot: category ↔ model |
|
|
207
|
+
|
|
208
|
+
## Gotchas
|
|
209
|
+
- **Polymorphic relations** — categories, tags, and comments use `*_type` fields to support multiple model types
|
|
210
|
+
- **Post `content` maps from `body`** — the model attribute is `content` but the DB column mapping comes from `body`
|
|
211
|
+
- **Author uses findOrCreate** — `PostStoreAction` auto-creates authors if they don't exist
|
|
212
|
+
- **Post store auto-attaches** — creating a post with category/tag data automatically calls `attach()` on pivot tables
|
|
213
|
+
- **Post update uses sync** — updating categories/tags uses `sync()` (detaches removed, attaches new)
|
|
214
|
+
- **Views increment is atomic** — `PATCH /cms/posts/{id}/views` increments by 1
|
|
215
|
+
- **RSS returns 20 items** — hardcoded to 20 most recent published posts
|
|
216
|
+
- **Sitemap priorities** — posts 0.8, categories 0.6, blog homepage 0.9
|
|
217
|
+
- **Comment status flow** — starts `pending`, can be approved, rejected (→ spam), or trashed
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-collections
|
|
3
|
+
description: Use when working with collection data structures in Stacks — chaining array operations, Laravel-style collection methods, mapping, filtering, reducing, or grouping. Covers @stacksjs/collections which wraps ts-collect.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Collections
|
|
10
|
+
|
|
11
|
+
## Key Paths
|
|
12
|
+
- Core package: `storage/framework/core/collections/src/`
|
|
13
|
+
- Source: `storage/framework/core/collections/src/index.ts`
|
|
14
|
+
- Package: `@stacksjs/collections`
|
|
15
|
+
|
|
16
|
+
## API
|
|
17
|
+
|
|
18
|
+
The package re-exports `collect` from `ts-collect`:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { collect } from '@stacksjs/collections'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { collect } from '@stacksjs/collections'
|
|
28
|
+
|
|
29
|
+
// Basic operations
|
|
30
|
+
const result = collect([1, 2, 3, 4, 5])
|
|
31
|
+
.filter(n => n > 2)
|
|
32
|
+
.map(n => n * 2)
|
|
33
|
+
.toArray()
|
|
34
|
+
// [6, 8, 10]
|
|
35
|
+
|
|
36
|
+
// Aggregation
|
|
37
|
+
collect([10, 20, 30]).sum() // 60
|
|
38
|
+
collect([10, 20, 30]).avg() // 20
|
|
39
|
+
collect([10, 20, 30]).min() // 10
|
|
40
|
+
collect([10, 20, 30]).max() // 30
|
|
41
|
+
|
|
42
|
+
// Grouping
|
|
43
|
+
collect(users).groupBy('role')
|
|
44
|
+
// { admin: [...], user: [...] }
|
|
45
|
+
|
|
46
|
+
// Sorting
|
|
47
|
+
collect(items).sortBy('price').toArray()
|
|
48
|
+
collect(items).sortByDesc('price').toArray()
|
|
49
|
+
|
|
50
|
+
// Unique
|
|
51
|
+
collect([1, 2, 2, 3, 3]).unique().toArray() // [1, 2, 3]
|
|
52
|
+
|
|
53
|
+
// First / Last
|
|
54
|
+
collect([1, 2, 3]).first() // 1
|
|
55
|
+
collect([1, 2, 3]).last() // 3
|
|
56
|
+
|
|
57
|
+
// Chunk
|
|
58
|
+
collect([1, 2, 3, 4, 5]).chunk(2).toArray()
|
|
59
|
+
// [[1, 2], [3, 4], [5]]
|
|
60
|
+
|
|
61
|
+
// Pluck
|
|
62
|
+
collect(users).pluck('name').toArray() // ['Alice', 'Bob']
|
|
63
|
+
|
|
64
|
+
// Contains
|
|
65
|
+
collect([1, 2, 3]).contains(2) // true
|
|
66
|
+
|
|
67
|
+
// Reduce
|
|
68
|
+
collect([1, 2, 3]).reduce((sum, n) => sum + n, 0) // 6
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Laravel-Style Methods
|
|
72
|
+
|
|
73
|
+
The `ts-collect` library provides a comprehensive Laravel Collection-compatible API including:
|
|
74
|
+
|
|
75
|
+
`all`, `avg`, `chunk`, `collapse`, `combine`, `concat`, `contains`, `count`, `countBy`, `crossJoin`, `dd`, `diff`, `diffAssoc`, `diffKeys`, `dump`, `duplicates`, `each`, `every`, `except`, `filter`, `first`, `firstOrFail`, `firstWhere`, `flatMap`, `flatten`, `flip`, `forget`, `forPage`, `get`, `groupBy`, `has`, `implode`, `intersect`, `intersectByKeys`, `isEmpty`, `isNotEmpty`, `join`, `keyBy`, `keys`, `last`, `macro`, `map`, `mapInto`, `mapSpread`, `mapToGroups`, `mapWithKeys`, `max`, `median`, `merge`, `mergeRecursive`, `min`, `mode`, `nth`, `only`, `pad`, `partition`, `pipe`, `pluck`, `pop`, `prepend`, `pull`, `push`, `put`, `random`, `reduce`, `reject`, `replace`, `replaceRecursive`, `reverse`, `search`, `shift`, `shuffle`, `skip`, `skipUntil`, `skipWhile`, `slice`, `sole`, `some`, `sort`, `sortBy`, `sortByDesc`, `sortDesc`, `sortKeys`, `sortKeysDesc`, `splice`, `split`, `sum`, `take`, `takeUntil`, `takeWhile`, `tap`, `times`, `toArray`, `toJson`, `transform`, `union`, `unique`, `uniqueStrict`, `unless`, `unlessEmpty`, `unlessNotEmpty`, `unwrap`, `values`, `when`, `whenEmpty`, `whenNotEmpty`, `where`, `whereBetween`, `whereIn`, `whereInstanceOf`, `whereNotBetween`, `whereNotIn`, `whereNotNull`, `whereNull`, `wrap`, `zip`
|
|
76
|
+
|
|
77
|
+
## Gotchas
|
|
78
|
+
- **Thin wrapper** — re-exports `collect` from `ts-collect`, no custom additions
|
|
79
|
+
- **Collections are immutable** — operations return new collection instances
|
|
80
|
+
- **For simple array operations** — `@stacksjs/arrays` may be more appropriate
|
|
81
|
+
- **Laravel API compatibility** — method names and behavior match Laravel's Collection class
|
|
82
|
+
- **Not used for ORM results** — ORM queries return plain arrays, not collections. Wrap with `collect()` if needed
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-commerce
|
|
3
|
+
description: Use when building e-commerce features in Stacks — the commerce namespace with 13 sub-modules (products, orders, customers, coupons, payments, shipping, tax, gift cards, waitlists, devices, receipts, restaurant), 20+ commerce models, default commerce functions, or the commerce configuration. Covers @stacksjs/commerce.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Commerce
|
|
10
|
+
|
|
11
|
+
Comprehensive e-commerce module with 13 sub-modules and 20+ models.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Core package: `storage/framework/core/commerce/src/`
|
|
15
|
+
- Default functions: `storage/framework/defaults/functions/commerce/`
|
|
16
|
+
- Default models: `storage/framework/defaults/app/Models/commerce/`
|
|
17
|
+
|
|
18
|
+
## Commerce Namespace
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { commerce } from '@stacksjs/commerce'
|
|
22
|
+
|
|
23
|
+
// 13 sub-modules
|
|
24
|
+
commerce.products // Product CRUD
|
|
25
|
+
commerce.coupons // Coupon management
|
|
26
|
+
commerce.customers // Customer management
|
|
27
|
+
commerce.errors // Error tracking
|
|
28
|
+
commerce.giftCards // Gift card management
|
|
29
|
+
commerce.orders // Order management
|
|
30
|
+
commerce.payments // Payment processing
|
|
31
|
+
commerce.restaurant // Restaurant features
|
|
32
|
+
commerce.shippings // Shipping management
|
|
33
|
+
commerce.tax // Tax rate management
|
|
34
|
+
commerce.waitlists // Waitlist management
|
|
35
|
+
commerce.devices // Print device management
|
|
36
|
+
commerce.receipts // Receipt management
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Sub-Module Operations
|
|
40
|
+
|
|
41
|
+
Each sub-module typically provides:
|
|
42
|
+
- `index()` — list all
|
|
43
|
+
- `fetch(id)` — get one
|
|
44
|
+
- `store(data)` — create
|
|
45
|
+
- `update(id, data)` — update
|
|
46
|
+
- `destroy(id)` — delete
|
|
47
|
+
|
|
48
|
+
### Products Sub-Module
|
|
49
|
+
- Products: items, variants, units
|
|
50
|
+
- Manufacturers
|
|
51
|
+
- Reviews
|
|
52
|
+
- Categories
|
|
53
|
+
- Product waitlists
|
|
54
|
+
|
|
55
|
+
### Orders Sub-Module
|
|
56
|
+
- Order CRUD
|
|
57
|
+
- Order items
|
|
58
|
+
- Order export
|
|
59
|
+
|
|
60
|
+
### Shipping Sub-Module
|
|
61
|
+
- Shipping methods
|
|
62
|
+
- Shipping rates (weight-based)
|
|
63
|
+
- Shipping zones
|
|
64
|
+
- Delivery routes
|
|
65
|
+
- Drivers
|
|
66
|
+
- Digital deliveries
|
|
67
|
+
- License keys
|
|
68
|
+
|
|
69
|
+
## Commerce Models (20+)
|
|
70
|
+
|
|
71
|
+
| Model | Key Fields | Relationships |
|
|
72
|
+
|-------|-----------|---------------|
|
|
73
|
+
| Product | name, price, inventoryCount, allergens(JSON) | belongsTo: Category, Manufacturer; hasMany: Review, ProductUnit, ProductVariant |
|
|
74
|
+
| ProductVariant | SKU, options, pricing | belongsTo: Product |
|
|
75
|
+
| ProductUnit | unit pricing | belongsTo: Product |
|
|
76
|
+
| Category | name, slug, isActive, displayOrder | hasMany: Product |
|
|
77
|
+
| Cart | status, total, currency(USD), expiresAt | hasMany: CartItem; belongsTo: Customer |
|
|
78
|
+
| CartItem | quantity, unitPrice, totalPrice | belongsTo: Cart |
|
|
79
|
+
| Order | status, totalAmount, orderType, deliveryAddress | hasMany: OrderItem, Payment; belongsTo: Customer |
|
|
80
|
+
| OrderItem | quantity, price | belongsTo: Order, Product |
|
|
81
|
+
| Coupon | code(unique), discountType, discountValue, usageLimit | hasMany: Order |
|
|
82
|
+
| GiftCard | code(unique), initialBalance, currentBalance, isReloadable | belongsTo: Customer |
|
|
83
|
+
| Customer | name, email, totalSpent, status | hasMany: Order, GiftCard, Review, Payment |
|
|
84
|
+
| Manufacturer | manufacturer info | hasMany: Product |
|
|
85
|
+
| Review | rating(1-5), content, isVerifiedPurchase, helpfulVotes | belongsTo: Product, Customer |
|
|
86
|
+
| ShippingRate | weightFrom, weightTo, rate | belongsTo: ShippingMethod, ShippingZone |
|
|
87
|
+
| DeliveryRoute | stops, totalDistance | belongsTo: Driver |
|
|
88
|
+
| TaxRate | name, rate(0-100), type(VAT/GST/Sales Tax) | |
|
|
89
|
+
| LicenseKey | key(XXXX-XXXX-XXXX-XXXX-XXXX), template, status | belongsTo: Customer, Product, Order |
|
|
90
|
+
| DigitalDelivery | downloadLimit, expiryDays, automaticDelivery | |
|
|
91
|
+
| WaitlistProduct | product waitlist tracking | |
|
|
92
|
+
| Receipt | receipt records | |
|
|
93
|
+
|
|
94
|
+
## Integration with Payments
|
|
95
|
+
Commerce works with `@stacksjs/payments` for Stripe integration:
|
|
96
|
+
```typescript
|
|
97
|
+
import { Payment } from '@stacksjs/payments'
|
|
98
|
+
await Payment.charge(customer, order.totalAmount, paymentMethodId)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Dashboard Routes
|
|
102
|
+
All commerce models have dashboard views at `/dashboard/commerce/*`.
|
|
103
|
+
|
|
104
|
+
## Gotchas
|
|
105
|
+
- Commerce models are auto-generated — edit definitions, not generated files
|
|
106
|
+
- Use `buddy make:migration` when changing commerce schemas
|
|
107
|
+
- Order `observe: true` emits events on create/update/delete
|
|
108
|
+
- Products have JSON fields for allergens and nutritionalInfo
|
|
109
|
+
- Cart expiry is tracked via `expiresAt` field
|
|
110
|
+
- Coupon types: `fixed_amount` or `percentage`
|
|
111
|
+
- Gift card codes are unique and auto-generated
|
|
112
|
+
- License keys follow XXXX-XXXX-XXXX-XXXX-XXXX format
|
|
113
|
+
- Product dashboard is highlighted (`dashboard: { highlight: true }`)
|
|
114
|
+
- Default seeder counts: Product(10), Order(20), Review(50), Payment(50)
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-composables
|
|
3
|
+
description: Use when creating or using reactive composables in STX templates — 90+ composables for state management, DOM interaction, sensors, animation, browser APIs, async operations, or the complete list of auto-imported composables. Covers @stacksjs/composables.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Composables
|
|
10
|
+
|
|
11
|
+
90+ reactive composables for STX templates. All are auto-imported in STX templates.
|
|
12
|
+
|
|
13
|
+
## Key Path
|
|
14
|
+
- Core package: `storage/framework/core/composables/src/`
|
|
15
|
+
|
|
16
|
+
## Core Reactive Primitives
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
// From _shared.ts
|
|
20
|
+
type MaybeRef<T> = T | Ref<T>
|
|
21
|
+
type MaybeRefOrGetter<T> = T | Ref<T> | (() => T)
|
|
22
|
+
unref(val) // unwrap Ref
|
|
23
|
+
toValue(val) // unwrap Ref or getter
|
|
24
|
+
isRef(val) // type guard
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## State & Reactivity
|
|
28
|
+
- `useToggle(initial?)` → `[Ref<boolean>, toggle]`
|
|
29
|
+
- `useCounter(initial?)` → `{ count, increment, decrement, set, reset }`
|
|
30
|
+
- `useStepper(steps, initial?)` → step navigation
|
|
31
|
+
- `usePrevious(value)` → previous value
|
|
32
|
+
- `useCycleList(list)` → cycle through items
|
|
33
|
+
|
|
34
|
+
## Storage
|
|
35
|
+
- `useStorage(key, defaultValue, storage?)` → persistent Ref
|
|
36
|
+
- `useLocalStorage(key, defaultValue)` → localStorage-backed Ref
|
|
37
|
+
- `useSessionStorage(key, defaultValue)` → sessionStorage-backed Ref
|
|
38
|
+
|
|
39
|
+
## Time & Date
|
|
40
|
+
- `useNow(options?)` → `Ref<Date>` (auto-updating)
|
|
41
|
+
- `useDateFormat(date, format)` → `Ref<string>`
|
|
42
|
+
- `useTimeAgo(date)` → relative time string
|
|
43
|
+
- `useTimestamp(options?)` → `Ref<number>`
|
|
44
|
+
- `useInterval(fn, ms)` → interval control
|
|
45
|
+
- `useIntervalFn(fn, ms)` → interval with pause/resume
|
|
46
|
+
- `useTimeout(ms)` → timeout control
|
|
47
|
+
- `useTimeoutFn(fn, ms)` → delayed execution
|
|
48
|
+
|
|
49
|
+
## DOM & Browser
|
|
50
|
+
- `useWindowSize()` → `{ width, height }`
|
|
51
|
+
- `useWindowScroll()` → `{ x, y }`
|
|
52
|
+
- `useWindowFocus()` → `Ref<boolean>`
|
|
53
|
+
- `useDocumentVisibility()` → `Ref<string>`
|
|
54
|
+
- `useFullscreen(el?)` → `{ isFullscreen, enter, exit, toggle }`
|
|
55
|
+
- `useTitle(title)` → document title binding
|
|
56
|
+
- `useFavicon(url)` → favicon binding
|
|
57
|
+
- `useCssVar(prop, el?)` → CSS variable binding
|
|
58
|
+
- `useActiveElement()` → currently focused element
|
|
59
|
+
- `useTextSelection()` → selected text
|
|
60
|
+
- `useTextDirection()` → `Ref<'ltr' | 'rtl'>`
|
|
61
|
+
- `useNavigatorLanguage()` → browser language
|
|
62
|
+
|
|
63
|
+
## Mouse & Touch
|
|
64
|
+
- `useMouse()` → `{ x, y, sourceType }`
|
|
65
|
+
- `useMouseInElement(el)` → mouse position relative to element
|
|
66
|
+
- `useMousePressed()` → `{ pressed, sourceType }`
|
|
67
|
+
- `usePointer()` → pointer events
|
|
68
|
+
- `useSwipe(el)` → swipe detection
|
|
69
|
+
- `usePointerSwipe(el)` → pointer swipe
|
|
70
|
+
- `useDraggable(el)` → make element draggable
|
|
71
|
+
- `useDropZone(el)` → drop zone detection
|
|
72
|
+
- `onLongPress(el, handler)` → long press detection
|
|
73
|
+
- `onClickOutside(el, handler)` → click outside detection
|
|
74
|
+
|
|
75
|
+
## Sensors
|
|
76
|
+
- `useGeolocation()` → `{ coords, locatedAt, error }`
|
|
77
|
+
- `useDeviceMotion()` → acceleration & rotation
|
|
78
|
+
- `useDeviceOrientation()` → alpha, beta, gamma
|
|
79
|
+
- `useBattery()` → `{ charging, chargingTime, level }`
|
|
80
|
+
- `useDevicePixelRatio()` → `Ref<number>`
|
|
81
|
+
- `useScreenSafeArea()` → safe area insets
|
|
82
|
+
|
|
83
|
+
## Observers
|
|
84
|
+
- `useIntersectionObserver(el, callback)` → visibility detection
|
|
85
|
+
- `useResizeObserver(el, callback)` → size changes
|
|
86
|
+
- `useMutationObserver(el, callback)` → DOM mutations
|
|
87
|
+
- `useElementBounding(el)` → `{ top, left, width, height }`
|
|
88
|
+
- `useElementVisibility(el)` → `Ref<boolean>`
|
|
89
|
+
- `useElementHover(el)` → `Ref<boolean>`
|
|
90
|
+
|
|
91
|
+
## Async
|
|
92
|
+
- `useAsyncState(fn, initial)` → `{ state, isReady, isLoading, error, execute }`
|
|
93
|
+
- `useAsyncQueue(tasks)` → sequential async execution
|
|
94
|
+
- `computedAsync(fn)` → async computed value
|
|
95
|
+
- `computedEager(fn)` → immediately evaluated computed
|
|
96
|
+
|
|
97
|
+
## Network
|
|
98
|
+
- `useFetch(url, options?)` → fetch wrapper with reactive state
|
|
99
|
+
- `useWebSocket(url)` → WebSocket connection
|
|
100
|
+
- `useEventSource(url)` → SSE connection
|
|
101
|
+
- `useOnline()` → `Ref<boolean>` (network status)
|
|
102
|
+
|
|
103
|
+
## Input & Focus
|
|
104
|
+
- `useFocus(el)` → `{ focused, focus, blur }`
|
|
105
|
+
- `useFocusWithin(el)` → any child focused
|
|
106
|
+
- `useKeyModifier(key)` → modifier key state
|
|
107
|
+
- `usePermission(name)` → permission state
|
|
108
|
+
- `useShare(options)` → Web Share API
|
|
109
|
+
|
|
110
|
+
## Utilities
|
|
111
|
+
- `useDebounceFn(fn, ms)` → debounced function
|
|
112
|
+
- `useThrottleFn(fn, ms)` → throttled function
|
|
113
|
+
- `useDebouncedRef(ref, ms)` → debounced ref updates
|
|
114
|
+
- `useThrottledRef(ref, ms)` → throttled ref updates
|
|
115
|
+
- `watchDebounced(source, callback, ms)` → debounced watcher
|
|
116
|
+
- `watchThrottled(source, callback, ms)` → throttled watcher
|
|
117
|
+
- `watchOnce(source, callback)` → one-time watcher
|
|
118
|
+
- `whenever(source, callback)` → watch for truthy
|
|
119
|
+
- `until(source).toBe(value)` → wait for value
|
|
120
|
+
- `syncRef(refA, refB)` → bidirectional sync
|
|
121
|
+
|
|
122
|
+
## Dark Mode
|
|
123
|
+
- `useDark()` → `Ref<boolean>`
|
|
124
|
+
- `usePreferredDark()` → system preference
|
|
125
|
+
- `usePreferredColorScheme()` → color scheme preference
|
|
126
|
+
|
|
127
|
+
## Media
|
|
128
|
+
- `useMediaQuery(query)` → `Ref<boolean>`
|
|
129
|
+
- `usePreferredContrast()` → contrast preference
|
|
130
|
+
- `usePreferredLanguages()` → language preferences
|
|
131
|
+
- `usePreferredReducedMotion()` → reduce motion preference
|
|
132
|
+
|
|
133
|
+
## State Patterns
|
|
134
|
+
- `createEventHook()` → typed event hook
|
|
135
|
+
- `createGlobalState(fn)` → shared state across components
|
|
136
|
+
- `createSharedComposable(fn)` → shared composable instance
|
|
137
|
+
- `refDefault(ref, defaultValue)` → ref with default
|
|
138
|
+
- `refAutoReset(value, ms)` → auto-resetting ref
|
|
139
|
+
- `makeDestructurable(obj, arr)` → support both destructuring styles
|
|
140
|
+
- `useIdle(ms)` → user idle detection
|
|
141
|
+
- `usePageLeave()` → detect page leave
|
|
142
|
+
- `useFps()` → frames per second
|
|
143
|
+
- `useMounted()` → `Ref<boolean>` mount state
|
|
144
|
+
- `tryOnMounted(fn)` → safe onMounted
|
|
145
|
+
- `useObjectUrl(blob)` → object URL with auto-cleanup
|
|
146
|
+
|
|
147
|
+
## Script & Style Injection
|
|
148
|
+
- `useScriptTag(src, onLoaded?)` → inject `<script>`
|
|
149
|
+
- `useStyleTag(css)` → inject `<style>`
|
|
150
|
+
|
|
151
|
+
## Math
|
|
152
|
+
- `useAbs`, `useAverage`, `useCeil`, `useClamp`, `useFloor`, `useMax`, `useMin`, `usePrecision`, `useRound`, `useSum`, `useTrunc`
|
|
153
|
+
- `and`, `or`, `logicNot`, `logicOr`
|
|
154
|
+
|
|
155
|
+
## Gotchas
|
|
156
|
+
- All composables are auto-imported in STX templates — no import needed
|
|
157
|
+
- NEVER use vanilla JS (`var`, `document.*`, `window.*`) in STX `<script>` tags
|
|
158
|
+
- Only use stx-compatible code: signals, composables, directives
|
|
159
|
+
- Auto-imports defined in `storage/framework/browser-auto-imports.json`
|
|
160
|
+
- Many composables require a browser environment (won't work server-side)
|
|
161
|
+
- `useStorage` persists to localStorage by default
|