cfsa-antigravity 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.mjs +324 -0
- package/package.json +34 -0
- package/template/.agent/instructions/commands.md +48 -0
- package/template/.agent/instructions/patterns.md +61 -0
- package/template/.agent/instructions/structure.md +29 -0
- package/template/.agent/instructions/tech-stack.md +43 -0
- package/template/.agent/instructions/workflow.md +41 -0
- package/template/.agent/kit-sync.md +15 -0
- package/template/.agent/rules/boundary-not-placeholder.md +146 -0
- package/template/.agent/rules/completion-checklist.md +48 -0
- package/template/.agent/rules/decision-classification.md +103 -0
- package/template/.agent/rules/extensibility.md +47 -0
- package/template/.agent/rules/question-vs-command.md +81 -0
- package/template/.agent/rules/security-first.md +43 -0
- package/template/.agent/rules/specificity-standards.md +54 -0
- package/template/.agent/rules/tdd-contract-first.md +57 -0
- package/template/.agent/rules/vertical-slices.md +42 -0
- package/template/.agent/skill-library/MANIFEST.md +480 -0
- package/template/.agent/skill-library/README.md +38 -0
- package/template/.agent/skill-library/meta/brand-guidelines/SKILL.md +73 -0
- package/template/.agent/skill-library/meta/claude-code/README.md +9 -0
- package/template/.agent/skill-library/meta/claude-code/agent-development/SKILL.md +415 -0
- package/template/.agent/skill-library/meta/claude-code/hook-development/SKILL.md +712 -0
- package/template/.agent/skill-library/meta/claude-code/plugin-structure/SKILL.md +476 -0
- package/template/.agent/skill-library/meta/git-advanced/SKILL.md +972 -0
- package/template/.agent/skill-library/meta/mcp-builder/SKILL.md +236 -0
- package/template/.agent/skill-library/meta/product-marketing-context/SKILL.md +241 -0
- package/template/.agent/skill-library/meta/regex-patterns/SKILL.md +751 -0
- package/template/.agent/skill-library/meta/tmux-processes/SKILL.md +210 -0
- package/template/.agent/skill-library/meta/using-tmux-for-interactive-commands/SKILL.md +178 -0
- package/template/.agent/skill-library/stack/3d/threejs-pro/SKILL.md +300 -0
- package/template/.agent/skill-library/stack/ai/ai-sdk/SKILL.md +77 -0
- package/template/.agent/skill-library/stack/ai/langchain/SKILL.md +530 -0
- package/template/.agent/skill-library/stack/ai/ollama/SKILL.md +321 -0
- package/template/.agent/skill-library/stack/ai/openai-sdk/SKILL.md +549 -0
- package/template/.agent/skill-library/stack/analytics/google-analytics/SKILL.md +153 -0
- package/template/.agent/skill-library/stack/api/graphql/SKILL.md +1061 -0
- package/template/.agent/skill-library/stack/api/trpc/SKILL.md +576 -0
- package/template/.agent/skill-library/stack/auth/authjs/SKILL.md +569 -0
- package/template/.agent/skill-library/stack/auth/clerk/SKILL.md +590 -0
- package/template/.agent/skill-library/stack/auth/firebase-auth/SKILL.md +734 -0
- package/template/.agent/skill-library/stack/cms/payload-cms/SKILL.md +573 -0
- package/template/.agent/skill-library/stack/cms/shopify/SKILL.md +1193 -0
- package/template/.agent/skill-library/stack/cms/wordpress/SKILL.md +1104 -0
- package/template/.agent/skill-library/stack/css/sass-scss/SKILL.md +1121 -0
- package/template/.agent/skill-library/stack/css/tailwind-css-patterns/SKILL.md +863 -0
- package/template/.agent/skill-library/stack/css/tailwind-design-system/SKILL.md +490 -0
- package/template/.agent/skill-library/stack/css/vanilla-css/SKILL.md +1078 -0
- package/template/.agent/skill-library/stack/databases/clickhouse/SKILL.md +311 -0
- package/template/.agent/skill-library/stack/databases/influxdb/SKILL.md +280 -0
- package/template/.agent/skill-library/stack/databases/lancedb/SKILL.md +415 -0
- package/template/.agent/skill-library/stack/databases/mongodb/SKILL.md +1169 -0
- package/template/.agent/skill-library/stack/databases/neo4j/SKILL.md +839 -0
- package/template/.agent/skill-library/stack/databases/pgvector/SKILL.md +241 -0
- package/template/.agent/skill-library/stack/databases/pinecone/SKILL.md +212 -0
- package/template/.agent/skill-library/stack/databases/postgresql/SKILL.md +658 -0
- package/template/.agent/skill-library/stack/databases/qdrant/SKILL.md +312 -0
- package/template/.agent/skill-library/stack/databases/redis/SKILL.md +1079 -0
- package/template/.agent/skill-library/stack/databases/spacetimedb/SKILL.md +532 -0
- package/template/.agent/skill-library/stack/databases/sqlite/SKILL.md +1132 -0
- package/template/.agent/skill-library/stack/databases/supabase/SKILL.md +640 -0
- package/template/.agent/skill-library/stack/databases/surrealdb-expert/SKILL.md +945 -0
- package/template/.agent/skill-library/stack/databases/timescaledb/SKILL.md +745 -0
- package/template/.agent/skill-library/stack/databases/weaviate/SKILL.md +218 -0
- package/template/.agent/skill-library/stack/devops/github-actions/SKILL.md +554 -0
- package/template/.agent/skill-library/stack/devops/kubernetes/SKILL.md +950 -0
- package/template/.agent/skill-library/stack/devops/nginx/SKILL.md +841 -0
- package/template/.agent/skill-library/stack/devops/terraform/SKILL.md +860 -0
- package/template/.agent/skill-library/stack/email/resend/SKILL.md +391 -0
- package/template/.agent/skill-library/stack/engines/godot/SKILL.md +488 -0
- package/template/.agent/skill-library/stack/extensions/chrome-extension/SKILL.md +375 -0
- package/template/.agent/skill-library/stack/extensions/vscode-extension/SKILL.md +453 -0
- package/template/.agent/skill-library/stack/frameworks/astro-framework/SKILL.md +162 -0
- package/template/.agent/skill-library/stack/frameworks/electron/SKILL.md +1286 -0
- package/template/.agent/skill-library/stack/frameworks/fastapi/SKILL.md +650 -0
- package/template/.agent/skill-library/stack/frameworks/hono/SKILL.md +90 -0
- package/template/.agent/skill-library/stack/frameworks/nestjs/SKILL.md +878 -0
- package/template/.agent/skill-library/stack/frameworks/nextjs/SKILL.md +635 -0
- package/template/.agent/skill-library/stack/frameworks/nuxt/SKILL.md +564 -0
- package/template/.agent/skill-library/stack/frameworks/sveltekit/SKILL.md +614 -0
- package/template/.agent/skill-library/stack/frameworks/tauri/SKILL.md +920 -0
- package/template/.agent/skill-library/stack/gamedev/godot/SKILL.md +1032 -0
- package/template/.agent/skill-library/stack/gamedev/unity/SKILL.md +1175 -0
- package/template/.agent/skill-library/stack/hosting/aws/SKILL.md +467 -0
- package/template/.agent/skill-library/stack/hosting/cloudflare/SKILL.md +201 -0
- package/template/.agent/skill-library/stack/hosting/docker-expert/SKILL.md +409 -0
- package/template/.agent/skill-library/stack/hosting/vercel/SKILL.md +484 -0
- package/template/.agent/skill-library/stack/languages/bash-scripting/SKILL.md +773 -0
- package/template/.agent/skill-library/stack/languages/c-cpp/SKILL.md +712 -0
- package/template/.agent/skill-library/stack/languages/gdscript/SKILL.md +789 -0
- package/template/.agent/skill-library/stack/languages/go/SKILL.md +664 -0
- package/template/.agent/skill-library/stack/languages/java/SKILL.md +778 -0
- package/template/.agent/skill-library/stack/languages/kotlin/SKILL.md +665 -0
- package/template/.agent/skill-library/stack/languages/python/SKILL.md +678 -0
- package/template/.agent/skill-library/stack/languages/rust/SKILL.md +673 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/SKILL.md +141 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/advanced-generics.md +90 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/branded-types.md +57 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/builder-pattern.md +71 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/common-pitfalls.md +135 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/conditional-types.md +27 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/decorators.md +98 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/discriminated-unions.md +62 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/mapped-types.md +53 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/performance-best-practices.md +104 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/template-literal-types.md +49 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/testing-types.md +112 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/type-guards.md +70 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/type-inference.md +101 -0
- package/template/.agent/skill-library/stack/languages/typescript-advanced-patterns/references/utility-types.md +98 -0
- package/template/.agent/skill-library/stack/languages/vanilla-javascript/SKILL.md +803 -0
- package/template/.agent/skill-library/stack/messaging/kafka/SKILL.md +235 -0
- package/template/.agent/skill-library/stack/mobile/expo-react-native/SKILL.md +665 -0
- package/template/.agent/skill-library/stack/mobile/flutter/SKILL.md +316 -0
- package/template/.agent/skill-library/stack/mobile/react-native/SKILL.md +337 -0
- package/template/.agent/skill-library/stack/monitoring/posthog/SKILL.md +396 -0
- package/template/.agent/skill-library/stack/monitoring/sentry/SKILL.md +509 -0
- package/template/.agent/skill-library/stack/observability/datadog/SKILL.md +179 -0
- package/template/.agent/skill-library/stack/observability/distributed-tracing/SKILL.md +140 -0
- package/template/.agent/skill-library/stack/observability/logging-best-practices/SKILL.md +168 -0
- package/template/.agent/skill-library/stack/observability/opentelemetry/SKILL.md +164 -0
- package/template/.agent/skill-library/stack/observability/prometheus-grafana/SKILL.md +246 -0
- package/template/.agent/skill-library/stack/observability/python-observability/SKILL.md +158 -0
- package/template/.agent/skill-library/stack/orm/drizzle-orm/SKILL.md +613 -0
- package/template/.agent/skill-library/stack/orm/prisma/SKILL.md +744 -0
- package/template/.agent/skill-library/stack/payments/lemonsqueezy/SKILL.md +393 -0
- package/template/.agent/skill-library/stack/payments/stripe-integration/SKILL.md +457 -0
- package/template/.agent/skill-library/stack/queue/bullmq/SKILL.md +385 -0
- package/template/.agent/skill-library/stack/queue/inngest/SKILL.md +438 -0
- package/template/.agent/skill-library/stack/realtime/socketio/SKILL.md +595 -0
- package/template/.agent/skill-library/stack/search/elasticsearch/SKILL.md +248 -0
- package/template/.agent/skill-library/stack/search/meilisearch/SKILL.md +385 -0
- package/template/.agent/skill-library/stack/security/crypto-patterns/SKILL.md +437 -0
- package/template/.agent/skill-library/stack/security/csp-cors-headers/SKILL.md +588 -0
- package/template/.agent/skill-library/stack/security/dependency-auditing/SKILL.md +560 -0
- package/template/.agent/skill-library/stack/security/input-sanitization/SKILL.md +430 -0
- package/template/.agent/skill-library/stack/security/owasp-web-security/SKILL.md +421 -0
- package/template/.agent/skill-library/stack/state/tanstack-query/SKILL.md +637 -0
- package/template/.agent/skill-library/stack/state/zustand/SKILL.md +483 -0
- package/template/.agent/skill-library/stack/storage/aws-s3/SKILL.md +415 -0
- package/template/.agent/skill-library/stack/testing/playwright/SKILL.md +641 -0
- package/template/.agent/skill-library/stack/testing/storybook/SKILL.md +923 -0
- package/template/.agent/skill-library/stack/testing/testing-library/SKILL.md +872 -0
- package/template/.agent/skill-library/stack/testing/vitest/SKILL.md +714 -0
- package/template/.agent/skill-library/stack/ui/react-best-practices/SKILL.md +877 -0
- package/template/.agent/skill-library/stack/ui/react-composition-patterns/SKILL.md +1107 -0
- package/template/.agent/skill-library/stack/ui/react-flow/SKILL.md +425 -0
- package/template/.agent/skill-library/stack/ui/shadcn-ui/SKILL.md +703 -0
- package/template/.agent/skill-library/surface/api/api-caching/SKILL.md +458 -0
- package/template/.agent/skill-library/surface/api/api-documentation-openapi/SKILL.md +697 -0
- package/template/.agent/skill-library/surface/api/api-error-handling/SKILL.md +478 -0
- package/template/.agent/skill-library/surface/api/api-security-checklist/SKILL.md +147 -0
- package/template/.agent/skill-library/surface/api/api-versioning/SKILL.md +420 -0
- package/template/.agent/skill-library/surface/api/email-best-practices/SKILL.md +59 -0
- package/template/.agent/skill-library/surface/api/rate-limiting-abuse-protection/SKILL.md +147 -0
- package/template/.agent/skill-library/surface/api/rest-api-design/SKILL.md +478 -0
- package/template/.agent/skill-library/surface/api/webhook-design/SKILL.md +752 -0
- package/template/.agent/skill-library/surface/cli/cli-configuration-management/SKILL.md +445 -0
- package/template/.agent/skill-library/surface/cli/cli-error-diagnostics/SKILL.md +515 -0
- package/template/.agent/skill-library/surface/cli/cli-shell-integration/SKILL.md +479 -0
- package/template/.agent/skill-library/surface/cli/cli-ux-design/SKILL.md +477 -0
- package/template/.agent/skill-library/surface/desktop/desktop-app-distribution/SKILL.md +416 -0
- package/template/.agent/skill-library/surface/desktop/desktop-security-sandboxing/SKILL.md +407 -0
- package/template/.agent/skill-library/surface/desktop/desktop-ux-conventions/SKILL.md +361 -0
- package/template/.agent/skill-library/surface/desktop/native-os-integration/SKILL.md +563 -0
- package/template/.agent/skill-library/surface/extension/browser-extension-patterns/SKILL.md +482 -0
- package/template/.agent/skill-library/surface/extension/plugin-architecture-design/SKILL.md +632 -0
- package/template/.agent/skill-library/surface/extension/vscode-extension-development/SKILL.md +728 -0
- package/template/.agent/skill-library/surface/mobile/app-store-submission/SKILL.md +304 -0
- package/template/.agent/skill-library/surface/mobile/mobile-offline-sync/SKILL.md +443 -0
- package/template/.agent/skill-library/surface/mobile/mobile-responsive-patterns/SKILL.md +432 -0
- package/template/.agent/skill-library/surface/mobile/push-notifications/SKILL.md +495 -0
- package/template/.agent/skill-library/surface/web/accessibility-compliance/SKILL.md +827 -0
- package/template/.agent/skill-library/surface/web/ai-seo/SKILL.md +398 -0
- package/template/.agent/skill-library/surface/web/ai-seo/references/content-patterns.md +285 -0
- package/template/.agent/skill-library/surface/web/ai-seo/references/platform-ranking-factors.md +152 -0
- package/template/.agent/skill-library/surface/web/analytics-tracking/SKILL.md +309 -0
- package/template/.agent/skill-library/surface/web/analytics-tracking/references/event-library.md +260 -0
- package/template/.agent/skill-library/surface/web/analytics-tracking/references/ga4-implementation.md +300 -0
- package/template/.agent/skill-library/surface/web/analytics-tracking/references/gtm-implementation.md +390 -0
- package/template/.agent/skill-library/surface/web/authentication-ui-flows/SKILL.md +530 -0
- package/template/.agent/skill-library/surface/web/dark-mode-theming/SKILL.md +516 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/SKILL.md +105 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/charts.csv +26 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/colors.csv +97 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/landing.csv +31 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/styles.csv +59 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/typography.csv +58 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/data/ux-guidelines.csv +100 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/scripts/core.py +258 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/scripts/design_system.py +1067 -0
- package/template/.agent/skill-library/surface/web/design-reference-data/scripts/search.py +106 -0
- package/template/.agent/skill-library/surface/web/form-handling-validation/SKILL.md +675 -0
- package/template/.agent/skill-library/surface/web/frontend-design/SKILL.md +1393 -0
- package/template/.agent/skill-library/surface/web/frontend-design/templates/cppn-hero.tsx +299 -0
- package/template/.agent/skill-library/surface/web/frontend-design/templates/wave-hero.tsx +875 -0
- package/template/.agent/skill-library/surface/web/frontend-verification/SKILL.md +111 -0
- package/template/.agent/skill-library/surface/web/frontend-verification/scripts/ux_audit.py +739 -0
- package/template/.agent/skill-library/surface/web/i18n-localization/SKILL.md +154 -0
- package/template/.agent/skill-library/surface/web/offline-first-pwa/SKILL.md +657 -0
- package/template/.agent/skill-library/surface/web/page-cro/SKILL.md +182 -0
- package/template/.agent/skill-library/surface/web/page-cro/references/experiments.md +248 -0
- package/template/.agent/skill-library/surface/web/programmatic-seo/SKILL.md +238 -0
- package/template/.agent/skill-library/surface/web/programmatic-seo/references/playbooks.md +308 -0
- package/template/.agent/skill-library/surface/web/schema-markup/SKILL.md +179 -0
- package/template/.agent/skill-library/surface/web/schema-markup/references/schema-examples.md +398 -0
- package/template/.agent/skill-library/surface/web/seo-audit/SKILL.md +394 -0
- package/template/.agent/skill-library/surface/web/seo-audit/references/ai-writing-detection.md +200 -0
- package/template/.agent/skill-library/surface/web/web-performance-optimization/SKILL.md +646 -0
- package/template/.agent/skill-library/surface/web/web-scraping/SKILL.md +58 -0
- package/template/.agent/skills/accessibility/SKILL.md +522 -0
- package/template/.agent/skills/accessibility/references/WCAG.md +162 -0
- package/template/.agent/skills/adversarial-review/SKILL.md +90 -0
- package/template/.agent/skills/antigravity-workflows/SKILL.md +81 -0
- package/template/.agent/skills/antigravity-workflows/resources/implementation-playbook.md +36 -0
- package/template/.agent/skills/api-design-principles/SKILL.md +37 -0
- package/template/.agent/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/template/.agent/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/template/.agent/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/template/.agent/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/template/.agent/skills/api-design-principles/resources/implementation-playbook.md +513 -0
- package/template/.agent/skills/api-versioning/SKILL.md +420 -0
- package/template/.agent/skills/architecture-mapping/SKILL.md +219 -0
- package/template/.agent/skills/bootstrap-agents/SKILL.md +259 -0
- package/template/.agent/skills/brainstorming/SKILL.md +236 -0
- package/template/.agent/skills/brand-guidelines/SKILL.md +44 -0
- package/template/.agent/skills/clean-code/SKILL.md +94 -0
- package/template/.agent/skills/code-review-pro/SKILL.md +152 -0
- package/template/.agent/skills/concise-planning/SKILL.md +68 -0
- package/template/.agent/skills/cross-layer-consistency/SKILL.md +117 -0
- package/template/.agent/skills/database-schema-design/SKILL.md +429 -0
- package/template/.agent/skills/deployment-procedures/SKILL.md +241 -0
- package/template/.agent/skills/design-anti-cliche/SKILL.md +159 -0
- package/template/.agent/skills/design-direction/SKILL.md +45 -0
- package/template/.agent/skills/error-handling-patterns/SKILL.md +721 -0
- package/template/.agent/skills/find-skills/SKILL.md +145 -0
- package/template/.agent/skills/git-advanced/SKILL.md +972 -0
- package/template/.agent/skills/git-workflow/SKILL.md +420 -0
- package/template/.agent/skills/idea-extraction/SKILL.md +271 -0
- package/template/.agent/skills/logging-best-practices/SKILL.md +851 -0
- package/template/.agent/skills/migration-management/SKILL.md +384 -0
- package/template/.agent/skills/minimalist-surgical-development/SKILL.md +69 -0
- package/template/.agent/skills/parallel-agents/SKILL.md +165 -0
- package/template/.agent/skills/parallel-debugging/SKILL.md +135 -0
- package/template/.agent/skills/parallel-feature-development/SKILL.md +166 -0
- package/template/.agent/skills/performance-budgeting/SKILL.md +144 -0
- package/template/.agent/skills/pipeline-rubrics/SKILL.md +51 -0
- package/template/.agent/skills/pipeline-rubrics/references/architecture-rubric.md +19 -0
- package/template/.agent/skills/pipeline-rubrics/references/be-rubric.md +21 -0
- package/template/.agent/skills/pipeline-rubrics/references/fe-rubric.md +20 -0
- package/template/.agent/skills/pipeline-rubrics/references/ia-rubric.md +19 -0
- package/template/.agent/skills/pipeline-rubrics/references/scoring.md +28 -0
- package/template/.agent/skills/pipeline-rubrics/references/vision-rubric.md +11 -0
- package/template/.agent/skills/prd-templates/SKILL.md +88 -0
- package/template/.agent/skills/prd-templates/references/architecture-design-template.md +88 -0
- package/template/.agent/skills/prd-templates/references/be-spec-template.md +101 -0
- package/template/.agent/skills/prd-templates/references/data-placement-template.md +74 -0
- package/template/.agent/skills/prd-templates/references/decomposition-templates.md +211 -0
- package/template/.agent/skills/prd-templates/references/design-system-decisions.md +198 -0
- package/template/.agent/skills/prd-templates/references/engineering-standards-template.md +124 -0
- package/template/.agent/skills/prd-templates/references/fe-classification-procedures.md +47 -0
- package/template/.agent/skills/prd-templates/references/fe-spec-template.md +84 -0
- package/template/.agent/skills/prd-templates/references/infrastructure-report-template.md +71 -0
- package/template/.agent/skills/prd-templates/references/operational-templates.md +116 -0
- package/template/.agent/skills/prd-templates/references/placeholder-guard-template.md +21 -0
- package/template/.agent/skills/prd-templates/references/surface-model.md +61 -0
- package/template/.agent/skills/prd-templates/references/vision-template.md +66 -0
- package/template/.agent/skills/prompt-engineer/README.md +659 -0
- package/template/.agent/skills/prompt-engineer/SKILL.md +249 -0
- package/template/.agent/skills/regex-patterns/SKILL.md +751 -0
- package/template/.agent/skills/resolve-ambiguity/SKILL.md +278 -0
- package/template/.agent/skills/rest-api-design/SKILL.md +478 -0
- package/template/.agent/skills/security-scanning-security-hardening/SKILL.md +231 -0
- package/template/.agent/skills/session-continuity/SKILL.md +730 -0
- package/template/.agent/skills/session-continuity/protocols/01-session-resumption.md +38 -0
- package/template/.agent/skills/session-continuity/protocols/02-progress-generation.md +85 -0
- package/template/.agent/skills/session-continuity/protocols/03-progress-update.md +70 -0
- package/template/.agent/skills/session-continuity/protocols/04-pattern-extraction.md +60 -0
- package/template/.agent/skills/session-continuity/protocols/05-session-close.md +37 -0
- package/template/.agent/skills/session-continuity/protocols/06-decision-analysis.md +84 -0
- package/template/.agent/skills/session-continuity/protocols/07-spec-pipeline-generation.md +48 -0
- package/template/.agent/skills/session-continuity/protocols/08-spec-pipeline-update.md +43 -0
- package/template/.agent/skills/session-continuity/protocols/09-parallel-claim.md +122 -0
- package/template/.agent/skills/session-continuity/protocols/10-placeholder-verification-gate.md +104 -0
- package/template/.agent/skills/session-continuity/protocols/ambiguity-gates.md +48 -0
- package/template/.agent/skills/skill-creator/LICENSE.txt +202 -0
- package/template/.agent/skills/skill-creator/README.md +270 -0
- package/template/.agent/skills/skill-creator/SKILL.md +590 -0
- package/template/.agent/skills/skill-creator/references/output-patterns.md +82 -0
- package/template/.agent/skills/skill-creator/references/workflows.md +28 -0
- package/template/.agent/skills/skill-creator/scripts/init_skill.py +303 -0
- package/template/.agent/skills/skill-creator/scripts/package_skill.py +110 -0
- package/template/.agent/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/template/.agent/skills/spec-writing/SKILL.md +110 -0
- package/template/.agent/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/template/.agent/skills/systematic-debugging/SKILL.md +297 -0
- package/template/.agent/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/template/.agent/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/template/.agent/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/template/.agent/skills/systematic-debugging/find-polluter.sh +63 -0
- package/template/.agent/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/template/.agent/skills/systematic-debugging/test-academic.md +14 -0
- package/template/.agent/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/template/.agent/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/template/.agent/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/template/.agent/skills/tdd-workflow/SKILL.md +409 -0
- package/template/.agent/skills/tech-stack-catalog/SKILL.md +49 -0
- package/template/.agent/skills/tech-stack-catalog/references/constraint-questions.md +21 -0
- package/template/.agent/skills/tech-stack-catalog/references/dev-tooling-decisions.md +37 -0
- package/template/.agent/skills/tech-stack-catalog/references/surface-decision-tables.md +69 -0
- package/template/.agent/skills/technical-writer/SKILL.md +242 -0
- package/template/.agent/skills/testing-strategist/SKILL.md +932 -0
- package/template/.agent/skills/verification-before-completion/SKILL.md +145 -0
- package/template/.agent/skills/workflow-automation/SKILL.md +73 -0
- package/template/.agent/workflows/audit-ambiguity-execute.md +165 -0
- package/template/.agent/workflows/audit-ambiguity-rubrics.md +83 -0
- package/template/.agent/workflows/audit-ambiguity.md +64 -0
- package/template/.agent/workflows/bootstrap-agents-fill.md +201 -0
- package/template/.agent/workflows/bootstrap-agents-provision.md +197 -0
- package/template/.agent/workflows/bootstrap-agents.md +66 -0
- package/template/.agent/workflows/create-prd-architecture.md +119 -0
- package/template/.agent/workflows/create-prd-compile.md +138 -0
- package/template/.agent/workflows/create-prd-design-system.md +135 -0
- package/template/.agent/workflows/create-prd-security.md +113 -0
- package/template/.agent/workflows/create-prd-stack.md +91 -0
- package/template/.agent/workflows/create-prd.md +168 -0
- package/template/.agent/workflows/decompose-architecture-structure.md +82 -0
- package/template/.agent/workflows/decompose-architecture-validate.md +119 -0
- package/template/.agent/workflows/decompose-architecture.md +111 -0
- package/template/.agent/workflows/evolve-contract.md +98 -0
- package/template/.agent/workflows/evolve-feature-cascade.md +140 -0
- package/template/.agent/workflows/evolve-feature-classify.md +116 -0
- package/template/.agent/workflows/evolve-feature.md +56 -0
- package/template/.agent/workflows/ideate-discover.md +144 -0
- package/template/.agent/workflows/ideate-extract.md +129 -0
- package/template/.agent/workflows/ideate-validate.md +117 -0
- package/template/.agent/workflows/ideate.md +113 -0
- package/template/.agent/workflows/implement-slice-setup.md +113 -0
- package/template/.agent/workflows/implement-slice-tdd.md +198 -0
- package/template/.agent/workflows/implement-slice.md +50 -0
- package/template/.agent/workflows/plan-phase.md +202 -0
- package/template/.agent/workflows/propagate-decision-apply.md +135 -0
- package/template/.agent/workflows/propagate-decision-scan.md +147 -0
- package/template/.agent/workflows/propagate-decision.md +56 -0
- package/template/.agent/workflows/remediate-pipeline-assess.md +138 -0
- package/template/.agent/workflows/remediate-pipeline-execute.md +135 -0
- package/template/.agent/workflows/remediate-pipeline.md +55 -0
- package/template/.agent/workflows/resolve-ambiguity.md +82 -0
- package/template/.agent/workflows/sync-kit.md +209 -0
- package/template/.agent/workflows/update-architecture-map.md +74 -0
- package/template/.agent/workflows/validate-phase.md +219 -0
- package/template/.agent/workflows/verify-infrastructure.md +207 -0
- package/template/.agent/workflows/write-architecture-spec-deepen.md +139 -0
- package/template/.agent/workflows/write-architecture-spec-design.md +202 -0
- package/template/.agent/workflows/write-architecture-spec.md +63 -0
- package/template/.agent/workflows/write-be-spec-classify.md +165 -0
- package/template/.agent/workflows/write-be-spec-write.md +98 -0
- package/template/.agent/workflows/write-be-spec.md +76 -0
- package/template/.agent/workflows/write-fe-spec-classify.md +170 -0
- package/template/.agent/workflows/write-fe-spec-write.md +94 -0
- package/template/.agent/workflows/write-fe-spec.md +71 -0
- package/template/AGENTS.md +176 -0
- package/template/GEMINI.md +177 -0
- package/template/docs/README.md +187 -0
- package/template/docs/audits/.gitkeep +0 -0
- package/template/docs/audits/README.md +10 -0
- package/template/docs/plans/.gitkeep +0 -0
- package/template/docs/plans/README.md +21 -0
- package/template/docs/plans/be/.gitkeep +0 -0
- package/template/docs/plans/be/README.md +11 -0
- package/template/docs/plans/fe/.gitkeep +0 -0
- package/template/docs/plans/fe/README.md +11 -0
- package/template/docs/plans/ia/.gitkeep +0 -0
- package/template/docs/plans/ia/README.md +17 -0
- package/template/docs/plans/ia/deep-dives/.gitkeep +0 -0
- package/template/docs/plans/ia/deep-dives/README.md +5 -0
- package/template/docs/plans/phases/.gitkeep +0 -0
- package/template/docs/plans/phases/README.md +11 -0
|
@@ -0,0 +1,875 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wave Hero Section Template
|
|
3
|
+
*
|
|
4
|
+
* A hero section with animated wave bars using Three.js instanced rendering.
|
|
5
|
+
* Features bloom post-processing, film grain, and mouse-reactive glow effects.
|
|
6
|
+
*
|
|
7
|
+
* Dependencies:
|
|
8
|
+
* - three
|
|
9
|
+
* - gsap
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use client';
|
|
13
|
+
|
|
14
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
15
|
+
import * as THREE from 'three';
|
|
16
|
+
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
17
|
+
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
|
18
|
+
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
|
|
19
|
+
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
|
|
20
|
+
import gsap from 'gsap';
|
|
21
|
+
|
|
22
|
+
// ============================================
|
|
23
|
+
// TYPES
|
|
24
|
+
// ============================================
|
|
25
|
+
export interface WaveHeroProps {
|
|
26
|
+
className?: string;
|
|
27
|
+
style?: React.CSSProperties;
|
|
28
|
+
extendLeftPx?: number;
|
|
29
|
+
title?: string;
|
|
30
|
+
subtitle?: string;
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
buttonText?: string;
|
|
33
|
+
onPromptSubmit?: (value: string) => void;
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ============================================
|
|
38
|
+
// FILM GRAIN SHADER
|
|
39
|
+
// ============================================
|
|
40
|
+
const FilmGrainShader = {
|
|
41
|
+
uniforms: {
|
|
42
|
+
tDiffuse: { value: null as THREE.Texture | null },
|
|
43
|
+
time: { value: 0 },
|
|
44
|
+
intensity: { value: 1.1 },
|
|
45
|
+
grainScale: { value: 0.5 },
|
|
46
|
+
},
|
|
47
|
+
vertexShader: `
|
|
48
|
+
varying vec2 vUv;
|
|
49
|
+
void main() {
|
|
50
|
+
vUv = uv;
|
|
51
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
52
|
+
}
|
|
53
|
+
`,
|
|
54
|
+
fragmentShader: `
|
|
55
|
+
#ifdef GL_ES
|
|
56
|
+
precision highp int;
|
|
57
|
+
precision mediump float;
|
|
58
|
+
#else
|
|
59
|
+
precision mediump float;
|
|
60
|
+
#endif
|
|
61
|
+
uniform sampler2D tDiffuse;
|
|
62
|
+
uniform float time;
|
|
63
|
+
uniform float intensity;
|
|
64
|
+
uniform float grainScale;
|
|
65
|
+
varying vec2 vUv;
|
|
66
|
+
|
|
67
|
+
float sparkleNoise(vec2 p) {
|
|
68
|
+
vec2 jPos = p + vec2(37.0, 17.0) * fract(time * 0.07);
|
|
69
|
+
vec3 p3 = fract(vec3(jPos.xyx) * vec3(.1031, .1030, .0973) + time * 0.1);
|
|
70
|
+
p3 += dot(p3, p3.yxz + 19.19);
|
|
71
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
void main() {
|
|
75
|
+
vec4 color = texture2D(tDiffuse, vUv);
|
|
76
|
+
vec2 pos = gl_FragCoord.xy * 0.5 * grainScale;
|
|
77
|
+
float noise = sparkleNoise(pos);
|
|
78
|
+
noise = noise * 2.0 - 1.0;
|
|
79
|
+
vec3 result = color.rgb + noise * intensity * 0.1;
|
|
80
|
+
gl_FragColor = vec4(result, color.a);
|
|
81
|
+
}
|
|
82
|
+
`,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
function createFilmGrainPass(intensity = 0.9, grainScale = 0.3) {
|
|
86
|
+
const pass = new ShaderPass(FilmGrainShader as any);
|
|
87
|
+
(pass.uniforms as any).intensity.value = intensity;
|
|
88
|
+
(pass.uniforms as any).grainScale.value = grainScale;
|
|
89
|
+
return pass;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ============================================
|
|
93
|
+
// BAR MATERIAL SHADER
|
|
94
|
+
// ============================================
|
|
95
|
+
function createInstancedMaterial() {
|
|
96
|
+
const baseCol = new THREE.Color('hsl(220,100%,50%)');
|
|
97
|
+
const emisCol = new THREE.Color('#1f3dbc');
|
|
98
|
+
|
|
99
|
+
return new THREE.ShaderMaterial({
|
|
100
|
+
defines: { USE_INSTANCING: '' },
|
|
101
|
+
uniforms: {
|
|
102
|
+
uMouseClipX: { value: 0 },
|
|
103
|
+
uHalfW: { value: 0 },
|
|
104
|
+
uMaxGlowDist: { value: 690 },
|
|
105
|
+
uGlowFalloff: { value: 0.6 },
|
|
106
|
+
uSmoothSpeed: { value: 0 },
|
|
107
|
+
uGainMul: { value: 1 },
|
|
108
|
+
uBaseY: { value: 0 },
|
|
109
|
+
w1Gain: { value: 10 },
|
|
110
|
+
w1Len: { value: 0.5 },
|
|
111
|
+
w1Phase: { value: 0 },
|
|
112
|
+
w2Gain: { value: 0 },
|
|
113
|
+
w2Len: { value: 0.5 },
|
|
114
|
+
w2Phase: { value: 0 },
|
|
115
|
+
uFixedTipPx: { value: 10 },
|
|
116
|
+
uMinBottomWidthPx: { value: 0 },
|
|
117
|
+
uColor: { value: baseCol },
|
|
118
|
+
uEmissive: { value: emisCol },
|
|
119
|
+
uBaseEmissive: { value: 0.05 },
|
|
120
|
+
uRotationAngle: { value: THREE.MathUtils.degToRad(23.4) },
|
|
121
|
+
},
|
|
122
|
+
vertexShader: `
|
|
123
|
+
attribute float aXPos, aPosNorm, aGroup, aGlow;
|
|
124
|
+
uniform float uMouseClipX, uHalfW, uMaxGlowDist, uGlowFalloff;
|
|
125
|
+
uniform float uGainMul, uBaseY;
|
|
126
|
+
uniform float w1Gain, w1Len, w1Phase;
|
|
127
|
+
uniform float w2Gain, w2Len, w2Phase;
|
|
128
|
+
uniform float uRotationAngle;
|
|
129
|
+
varying float vGlow, vPulse, vHeight;
|
|
130
|
+
varying vec2 vUv;
|
|
131
|
+
|
|
132
|
+
float sineH(float g, float len, float ph, float t){
|
|
133
|
+
return max(20.0, (sin(ph + t * len) * 0.5 + 0.6) * g * uGainMul);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
void main(){
|
|
137
|
+
vUv = uv;
|
|
138
|
+
float h1 = sineH(w1Gain, w1Len, w1Phase, aPosNorm);
|
|
139
|
+
float h2 = sineH(w2Gain, w2Len, w2Phase, aPosNorm);
|
|
140
|
+
vHeight = mix(h1, h2, aGroup);
|
|
141
|
+
|
|
142
|
+
vec3 pos = position;
|
|
143
|
+
pos.x += aXPos;
|
|
144
|
+
pos.y = 0.0;
|
|
145
|
+
|
|
146
|
+
float height = vHeight * uv.y;
|
|
147
|
+
pos.x += height * tan(uRotationAngle);
|
|
148
|
+
pos.y += height;
|
|
149
|
+
|
|
150
|
+
pos.y += uBaseY;
|
|
151
|
+
|
|
152
|
+
vec4 clip = projectionMatrix * modelViewMatrix * vec4(pos,1.0);
|
|
153
|
+
float dxPx = abs(uMouseClipX - clip.x/clip.w) * uHalfW;
|
|
154
|
+
float prox = clamp(1.0 - pow(dxPx / uMaxGlowDist, uGlowFalloff), 0.0, 1.0);
|
|
155
|
+
|
|
156
|
+
vGlow = aGlow;
|
|
157
|
+
vPulse = prox;
|
|
158
|
+
gl_Position = clip;
|
|
159
|
+
}
|
|
160
|
+
`,
|
|
161
|
+
fragmentShader: `
|
|
162
|
+
#ifdef GL_ES
|
|
163
|
+
precision highp int;
|
|
164
|
+
precision mediump float;
|
|
165
|
+
#else
|
|
166
|
+
precision mediump float;
|
|
167
|
+
#endif
|
|
168
|
+
uniform vec3 uColor, uEmissive;
|
|
169
|
+
uniform float uBaseEmissive;
|
|
170
|
+
uniform float uFixedTipPx, uMinBottomWidthPx;
|
|
171
|
+
varying float vGlow, vPulse, vHeight;
|
|
172
|
+
varying vec2 vUv;
|
|
173
|
+
|
|
174
|
+
void main(){
|
|
175
|
+
float tipProp = clamp(uFixedTipPx / vHeight, 0.0, 0.95);
|
|
176
|
+
float transitionY = 1.0 - tipProp;
|
|
177
|
+
float xFromCenter = abs(vUv.x - 0.5) * 2.0;
|
|
178
|
+
float px = fwidth(vUv.x);
|
|
179
|
+
float allowedWidth;
|
|
180
|
+
|
|
181
|
+
if (vUv.y >= transitionY){
|
|
182
|
+
float topPos = (vUv.y - transitionY) / tipProp;
|
|
183
|
+
allowedWidth = 1.0 - pow(topPos, 0.9);
|
|
184
|
+
} else {
|
|
185
|
+
float bottomPos = vUv.y / transitionY;
|
|
186
|
+
allowedWidth = max(uMinBottomWidthPx * px * 10.0, pow(bottomPos, 0.5));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
float alpha = smoothstep(-px, px, allowedWidth - xFromCenter);
|
|
190
|
+
if (alpha < 0.01) discard;
|
|
191
|
+
|
|
192
|
+
float emissiveStrength = uBaseEmissive + vGlow * 0.9 + vPulse * 0.15;
|
|
193
|
+
vec3 finalColor = uColor + uEmissive * emissiveStrength;
|
|
194
|
+
gl_FragColor = vec4(finalColor, 0.35 * alpha);
|
|
195
|
+
}
|
|
196
|
+
`,
|
|
197
|
+
side: THREE.FrontSide,
|
|
198
|
+
transparent: true,
|
|
199
|
+
depthWrite: false,
|
|
200
|
+
blending: THREE.AdditiveBlending,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ============================================
|
|
205
|
+
// WAVE KEYFRAMES
|
|
206
|
+
// ============================================
|
|
207
|
+
const waveKeyframes1 = [
|
|
208
|
+
{ time: 0, gain: 10, frequency: 0, waveLength: 0.5 },
|
|
209
|
+
{ time: 4, gain: 300, frequency: 1, waveLength: 0.5 },
|
|
210
|
+
{ time: 6, gain: 300, frequency: 4, waveLength: Math.PI * 1.5 },
|
|
211
|
+
{ time: 8, gain: 225, frequency: 4, waveLength: Math.PI * 1.5 },
|
|
212
|
+
{ time: 10, gain: 500, frequency: 1, waveLength: Math.PI * 1.5 },
|
|
213
|
+
{ time: 14, gain: 225, frequency: 3, waveLength: Math.PI * 1.5 },
|
|
214
|
+
{ time: 22, gain: 100, frequency: 6, waveLength: Math.PI * 1.5 },
|
|
215
|
+
{ time: 28, gain: 0, frequency: 0.9, waveLength: 0.5 },
|
|
216
|
+
{ time: 30, gain: 128, frequency: 0.9, waveLength: 0.5 },
|
|
217
|
+
{ time: 32, gain: 190, frequency: 1.42, waveLength: 0.5 },
|
|
218
|
+
{ time: 39, gain: 499, frequency: 4.0, waveLength: Math.PI * 1.5 },
|
|
219
|
+
{ time: 40, gain: 500, frequency: 4.0, waveLength: Math.PI * 1.5 },
|
|
220
|
+
{ time: 42, gain: 400, frequency: 2.82, waveLength: Math.PI * 1.5 },
|
|
221
|
+
{ time: 44, gain: 327, frequency: 2.56, waveLength: Math.PI * 1.5 },
|
|
222
|
+
{ time: 48, gain: 188, frequency: 5.4, waveLength: 0.5 },
|
|
223
|
+
{ time: 52, gain: 32, frequency: 0.1, waveLength: 0.5 },
|
|
224
|
+
{ time: 55, gain: 10, frequency: 0, waveLength: 0.5 },
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
const waveKeyframes2 = [
|
|
228
|
+
{ time: 0, gain: 0, frequency: 0, waveLength: 0.5 },
|
|
229
|
+
{ time: 9, gain: 0, frequency: 0, waveLength: 0.5 },
|
|
230
|
+
{ time: 10, gain: 400, frequency: 1, waveLength: 0.5 },
|
|
231
|
+
{ time: 13, gain: 300, frequency: 4, waveLength: Math.PI * 1.5 },
|
|
232
|
+
{ time: 24, gain: 96, frequency: 2, waveLength: 0.5 },
|
|
233
|
+
{ time: 28, gain: 0, frequency: 0.9, waveLength: 0.5 },
|
|
234
|
+
{ time: 30, gain: 142, frequency: 0.9, waveLength: 0.5 },
|
|
235
|
+
{ time: 36, gain: 374, frequency: 4.0, waveLength: Math.PI * 1.5 },
|
|
236
|
+
{ time: 38, gain: 375, frequency: 4.0, waveLength: Math.PI * 1.5 },
|
|
237
|
+
{ time: 40, gain: 300, frequency: 2.26, waveLength: Math.PI * 1.5 },
|
|
238
|
+
{ time: 44, gain: 245, frequency: 2.05, waveLength: Math.PI * 1.5 },
|
|
239
|
+
{ time: 48, gain: 141, frequency: 5.12, waveLength: 0.5 },
|
|
240
|
+
{ time: 52, gain: 24, frequency: 0.08, waveLength: 0.5 },
|
|
241
|
+
{ time: 55, gain: 8, frequency: 0, waveLength: 0.5 },
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
// ============================================
|
|
245
|
+
// TYPING PLACEHOLDER HOOK
|
|
246
|
+
// ============================================
|
|
247
|
+
function useTypingPlaceholder(prompt: string, basePlaceholder: string) {
|
|
248
|
+
const suggestionsRef = useRef<string[]>([
|
|
249
|
+
' fitness app',
|
|
250
|
+
' recipe generator',
|
|
251
|
+
' marketing landing page',
|
|
252
|
+
' travel itinerary planner',
|
|
253
|
+
' blog engine',
|
|
254
|
+
' customer support chatbot',
|
|
255
|
+
' personal finance dashboard',
|
|
256
|
+
]);
|
|
257
|
+
const [animatedPlaceholder, setAnimatedPlaceholder] = useState<string>(basePlaceholder);
|
|
258
|
+
const typingStateRef = useRef({
|
|
259
|
+
suggestionIndex: 0,
|
|
260
|
+
charIndex: 0,
|
|
261
|
+
deleting: false,
|
|
262
|
+
running: true,
|
|
263
|
+
});
|
|
264
|
+
const timersRef = useRef<number[]>([]);
|
|
265
|
+
|
|
266
|
+
useEffect(() => {
|
|
267
|
+
typingStateRef.current.running = true;
|
|
268
|
+
const typeSpeed = 70;
|
|
269
|
+
const deleteSpeed = 40;
|
|
270
|
+
const pauseAtEnd = 1200;
|
|
271
|
+
const pauseBetween = 500;
|
|
272
|
+
|
|
273
|
+
function schedule(fn: () => void, delay: number) {
|
|
274
|
+
const id = window.setTimeout(fn, delay);
|
|
275
|
+
timersRef.current.push(id);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function clearTimers() {
|
|
279
|
+
for (const id of timersRef.current) window.clearTimeout(id);
|
|
280
|
+
timersRef.current = [];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function step() {
|
|
284
|
+
if (!typingStateRef.current.running) return;
|
|
285
|
+
if (prompt !== '') {
|
|
286
|
+
setAnimatedPlaceholder(basePlaceholder);
|
|
287
|
+
schedule(step, 300);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const state = typingStateRef.current;
|
|
292
|
+
const suggestions = suggestionsRef.current;
|
|
293
|
+
const current = suggestions[state.suggestionIndex % suggestions.length] || '';
|
|
294
|
+
|
|
295
|
+
if (!state.deleting) {
|
|
296
|
+
const nextIndex = state.charIndex + 1;
|
|
297
|
+
const next = current.slice(0, nextIndex);
|
|
298
|
+
setAnimatedPlaceholder(basePlaceholder + next);
|
|
299
|
+
state.charIndex = nextIndex;
|
|
300
|
+
if (nextIndex >= current.length) {
|
|
301
|
+
schedule(() => {
|
|
302
|
+
state.deleting = true;
|
|
303
|
+
step();
|
|
304
|
+
}, pauseAtEnd);
|
|
305
|
+
} else {
|
|
306
|
+
schedule(step, typeSpeed);
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
const nextIndex = Math.max(0, state.charIndex - 1);
|
|
310
|
+
const next = current.slice(0, nextIndex);
|
|
311
|
+
setAnimatedPlaceholder(basePlaceholder + next);
|
|
312
|
+
state.charIndex = nextIndex;
|
|
313
|
+
if (nextIndex <= 0) {
|
|
314
|
+
state.deleting = false;
|
|
315
|
+
state.suggestionIndex = (state.suggestionIndex + 1) % suggestions.length;
|
|
316
|
+
schedule(step, pauseBetween);
|
|
317
|
+
} else {
|
|
318
|
+
schedule(step, deleteSpeed);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
clearTimers();
|
|
324
|
+
schedule(step, 400);
|
|
325
|
+
return () => {
|
|
326
|
+
typingStateRef.current.running = false;
|
|
327
|
+
clearTimers();
|
|
328
|
+
};
|
|
329
|
+
}, [prompt, basePlaceholder]);
|
|
330
|
+
|
|
331
|
+
return animatedPlaceholder;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// ============================================
|
|
335
|
+
// COMPONENT
|
|
336
|
+
// ============================================
|
|
337
|
+
export function WaveHero({
|
|
338
|
+
className,
|
|
339
|
+
style,
|
|
340
|
+
extendLeftPx = 320,
|
|
341
|
+
title = 'Build with AI.',
|
|
342
|
+
subtitle = 'The AI Fullstack Engineer. Build prototypes, apps, and websites',
|
|
343
|
+
placeholder = 'Describe what you want to create...',
|
|
344
|
+
buttonText = 'Generate',
|
|
345
|
+
onPromptSubmit,
|
|
346
|
+
children,
|
|
347
|
+
}: WaveHeroProps) {
|
|
348
|
+
const [prompt, setPrompt] = useState('');
|
|
349
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
350
|
+
const waveRef = useRef<HTMLDivElement | null>(null);
|
|
351
|
+
const basePlaceholder = 'Make me a';
|
|
352
|
+
const animatedPlaceholder = useTypingPlaceholder(prompt, basePlaceholder);
|
|
353
|
+
|
|
354
|
+
useEffect(() => {
|
|
355
|
+
if (!containerRef.current || !waveRef.current) return;
|
|
356
|
+
|
|
357
|
+
// Wave state
|
|
358
|
+
const wave1 = { gain: 10, frequency: 0, waveLength: 0.5, currentAngle: 0 };
|
|
359
|
+
const wave2 = { gain: 0, frequency: 0, waveLength: 0.5, currentAngle: 0 };
|
|
360
|
+
|
|
361
|
+
// Mouse & glow config
|
|
362
|
+
const mouse = { x: 0, y: 0, active: false };
|
|
363
|
+
let proxyMouseX = 0,
|
|
364
|
+
proxyMouseY = 0,
|
|
365
|
+
proxyInitialized = false;
|
|
366
|
+
|
|
367
|
+
const glowConfig = {
|
|
368
|
+
maxGlowDistance: 690,
|
|
369
|
+
speedScale: 0.52,
|
|
370
|
+
fadeSpeed: 4.4,
|
|
371
|
+
glowFalloff: 0.6,
|
|
372
|
+
mouseSmoothing: 30.0,
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const glowDynamics = {
|
|
376
|
+
accumulation: 1.2,
|
|
377
|
+
decay: 3.3,
|
|
378
|
+
max: 40.0,
|
|
379
|
+
accumEase: 1.5,
|
|
380
|
+
speedEase: 8.5,
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// THREE.js setup
|
|
384
|
+
let DPR_CAP = 2;
|
|
385
|
+
const mm = gsap.matchMedia();
|
|
386
|
+
mm.add('(max-resolution: 180dpi)', () => {
|
|
387
|
+
DPR_CAP = 1.5;
|
|
388
|
+
});
|
|
389
|
+
const EFFECT_PR = Math.min(window.devicePixelRatio, DPR_CAP) * 0.5;
|
|
390
|
+
|
|
391
|
+
const waveContainer = waveRef.current!;
|
|
392
|
+
while (waveContainer.firstChild) {
|
|
393
|
+
waveContainer.removeChild(waveContainer.firstChild);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const waveRenderer = new THREE.WebGLRenderer({ antialias: false, alpha: true });
|
|
397
|
+
waveRenderer.setPixelRatio(EFFECT_PR);
|
|
398
|
+
waveRenderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
399
|
+
waveRenderer.toneMappingExposure = 1.0;
|
|
400
|
+
waveRenderer.autoClear = false;
|
|
401
|
+
waveContainer.appendChild(waveRenderer.domElement);
|
|
402
|
+
|
|
403
|
+
const waveScene = new THREE.Scene();
|
|
404
|
+
waveScene.fog = null as any;
|
|
405
|
+
waveScene.add(new THREE.AmbientLight(0xffffff, 0.2));
|
|
406
|
+
|
|
407
|
+
let waveCamera: THREE.OrthographicCamera;
|
|
408
|
+
let waveComposer: EffectComposer;
|
|
409
|
+
let waveBloomPass: UnrealBloomPass;
|
|
410
|
+
let grainPass: ShaderPass;
|
|
411
|
+
let cameraWidth = 0,
|
|
412
|
+
cameraHeight = 0,
|
|
413
|
+
waveCameraInitialized = false;
|
|
414
|
+
|
|
415
|
+
let setMouseNDC: (v: number) => void,
|
|
416
|
+
setSmoothSpeed: (v: number) => void,
|
|
417
|
+
setPhase1: (v: number) => void,
|
|
418
|
+
setPhase2: (v: number) => void;
|
|
419
|
+
|
|
420
|
+
// Bar instancing
|
|
421
|
+
const MAX_BARS = 256;
|
|
422
|
+
const FIXED_BAR_WIDTH = 14;
|
|
423
|
+
const FIXED_BAR_GAP = 10;
|
|
424
|
+
const EXTEND_LEFT_PX = extendLeftPx;
|
|
425
|
+
|
|
426
|
+
let instancedBars: THREE.InstancedMesh | null = null;
|
|
427
|
+
let currentBarCount = 0;
|
|
428
|
+
let barMaterial: THREE.ShaderMaterial;
|
|
429
|
+
let barCenters: Float32Array | null = null;
|
|
430
|
+
|
|
431
|
+
function updateGlowDistance() {
|
|
432
|
+
if (!barMaterial) return;
|
|
433
|
+
const totalWidth = currentBarCount * (FIXED_BAR_WIDTH + FIXED_BAR_GAP) - FIXED_BAR_GAP;
|
|
434
|
+
const spanPx = totalWidth * 0.3;
|
|
435
|
+
glowConfig.maxGlowDistance = spanPx;
|
|
436
|
+
(barMaterial.uniforms as any).uMaxGlowDist.value = spanPx;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function setupQuickSetters() {
|
|
440
|
+
const u = (instancedBars!.material as THREE.ShaderMaterial).uniforms as any;
|
|
441
|
+
setMouseNDC = gsap.quickSetter(u.uMouseClipX, 'value') as any;
|
|
442
|
+
setSmoothSpeed = gsap.quickSetter(u.uSmoothSpeed, 'value') as any;
|
|
443
|
+
setPhase1 = gsap.quickSetter(u.w1Phase, 'value') as any;
|
|
444
|
+
setPhase2 = gsap.quickSetter(u.w2Phase, 'value') as any;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const MAX_KEYFRAME_GAIN = 500;
|
|
448
|
+
const SCREEN_COVERAGE = 0.6;
|
|
449
|
+
function updateGainMultiplier() {
|
|
450
|
+
if (!barMaterial) return;
|
|
451
|
+
const targetPx = cameraHeight * SCREEN_COVERAGE;
|
|
452
|
+
(barMaterial.uniforms as any).uGainMul.value = targetPx / MAX_KEYFRAME_GAIN;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
let rect = { left: 0, top: 0 };
|
|
456
|
+
const listeners: Array<() => void> = [];
|
|
457
|
+
|
|
458
|
+
function setupPointerTracking() {
|
|
459
|
+
const el = waveRenderer.domElement;
|
|
460
|
+
const readCoords = (e: PointerEvent | TouchEvent): { x: number; y: number } => {
|
|
461
|
+
if ('clientX' in e) return { x: (e as PointerEvent).clientX, y: (e as PointerEvent).clientY };
|
|
462
|
+
const t = (e as TouchEvent).touches?.[0] || (e as TouchEvent).changedTouches?.[0];
|
|
463
|
+
return t ? { x: t.clientX, y: t.clientY } : { x: mouse.x, y: mouse.y };
|
|
464
|
+
};
|
|
465
|
+
const updatePos = (e: any, active: boolean) => {
|
|
466
|
+
const { x, y } = readCoords(e);
|
|
467
|
+
const r = rect;
|
|
468
|
+
mouse.x = x - r.left;
|
|
469
|
+
mouse.y = y - r.top;
|
|
470
|
+
mouse.active = active;
|
|
471
|
+
if (!proxyInitialized) {
|
|
472
|
+
proxyMouseX = mouse.x;
|
|
473
|
+
proxyMouseY = mouse.y;
|
|
474
|
+
proxyInitialized = true;
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
const activate = (e: any) => updatePos(e, true);
|
|
478
|
+
const move = (e: any) => updatePos(e, true);
|
|
479
|
+
const deactivate = () => {
|
|
480
|
+
mouse.active = false;
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
el.addEventListener('pointerdown', activate, { passive: true });
|
|
484
|
+
el.addEventListener('pointermove', move, { passive: true });
|
|
485
|
+
window.addEventListener('pointerup', deactivate as any, { passive: true });
|
|
486
|
+
el.addEventListener('pointerleave', deactivate as any, { passive: true });
|
|
487
|
+
el.addEventListener('touchstart', activate as any, { passive: true });
|
|
488
|
+
el.addEventListener('touchmove', move as any, { passive: true });
|
|
489
|
+
window.addEventListener('touchend', deactivate as any, { passive: true });
|
|
490
|
+
window.addEventListener('touchcancel', deactivate as any, { passive: true });
|
|
491
|
+
|
|
492
|
+
listeners.push(() => {
|
|
493
|
+
el.removeEventListener('pointerdown', activate as any);
|
|
494
|
+
el.removeEventListener('pointermove', move as any);
|
|
495
|
+
window.removeEventListener('pointerup', deactivate as any);
|
|
496
|
+
el.removeEventListener('pointerleave', deactivate as any);
|
|
497
|
+
el.removeEventListener('touchstart', activate as any);
|
|
498
|
+
el.removeEventListener('touchmove', move as any);
|
|
499
|
+
window.removeEventListener('touchend', deactivate as any);
|
|
500
|
+
window.removeEventListener('touchcancel', deactivate as any);
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
let smoothSpeed = 0;
|
|
505
|
+
|
|
506
|
+
function accumulateGlow(dt: number) {
|
|
507
|
+
if (!instancedBars) return;
|
|
508
|
+
const attr = instancedBars.geometry.getAttribute('aGlow') as THREE.InstancedBufferAttribute;
|
|
509
|
+
const arr = attr.array as Float32Array;
|
|
510
|
+
|
|
511
|
+
const mouseWorldX = proxyMouseX - cameraWidth * 0.5;
|
|
512
|
+
const mDist = glowConfig.maxGlowDistance;
|
|
513
|
+
const fall = glowConfig.glowFalloff;
|
|
514
|
+
|
|
515
|
+
const decayLerp = 1.0 - Math.exp(-glowDynamics.decay * dt);
|
|
516
|
+
const addEase = 1.0 - Math.exp(-glowDynamics.accumEase * dt);
|
|
517
|
+
const vmax = glowDynamics.max;
|
|
518
|
+
|
|
519
|
+
for (let i = 0; i < currentBarCount; i++) {
|
|
520
|
+
const dx = Math.abs(mouseWorldX - (barCenters as Float32Array)[i]);
|
|
521
|
+
const hit = dx < mDist ? 1.0 - Math.pow(dx / mDist, fall) : 0.0;
|
|
522
|
+
|
|
523
|
+
const targetAdd = hit * smoothSpeed;
|
|
524
|
+
const add = targetAdd * addEase;
|
|
525
|
+
|
|
526
|
+
let g = (arr as any)[i] + add - (arr as any)[i] * decayLerp;
|
|
527
|
+
|
|
528
|
+
if (g > vmax) g = vmax;
|
|
529
|
+
(arr as any)[i] = (arr as any)[i + currentBarCount] = g;
|
|
530
|
+
}
|
|
531
|
+
(attr as any).needsUpdate = true;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function createInstancedBars() {
|
|
535
|
+
if (instancedBars) {
|
|
536
|
+
waveScene.remove(instancedBars);
|
|
537
|
+
instancedBars.geometry.dispose();
|
|
538
|
+
(instancedBars.material as any).dispose();
|
|
539
|
+
instancedBars = null;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
const waveWidth = cameraWidth;
|
|
543
|
+
const span = waveWidth + EXTEND_LEFT_PX;
|
|
544
|
+
let barCount = Math.min(MAX_BARS, Math.max(1, Math.floor((span + FIXED_BAR_GAP) / (FIXED_BAR_WIDTH + FIXED_BAR_GAP))));
|
|
545
|
+
const gap = barCount > 1 ? (span - barCount * FIXED_BAR_WIDTH) / (barCount - 1) : 0;
|
|
546
|
+
currentBarCount = barCount;
|
|
547
|
+
|
|
548
|
+
const startX = -waveWidth / 2 - EXTEND_LEFT_PX;
|
|
549
|
+
const instCnt = barCount * 2;
|
|
550
|
+
barCenters = new Float32Array(barCount);
|
|
551
|
+
|
|
552
|
+
const aXPos = new Float32Array(instCnt);
|
|
553
|
+
const aPosNorm = new Float32Array(instCnt);
|
|
554
|
+
const aGroup = new Float32Array(instCnt);
|
|
555
|
+
const aGlow = new Float32Array(instCnt).fill(0);
|
|
556
|
+
|
|
557
|
+
for (let i = 0; i < barCount; i++) {
|
|
558
|
+
const x = startX + FIXED_BAR_WIDTH / 2 + i * (FIXED_BAR_WIDTH + gap);
|
|
559
|
+
(barCenters as Float32Array)[i] = x;
|
|
560
|
+
const t = barCount > 1 ? i / (barCount - 1) : 0;
|
|
561
|
+
aXPos[i] = x;
|
|
562
|
+
aXPos[i + barCount] = x;
|
|
563
|
+
aPosNorm[i] = t;
|
|
564
|
+
aPosNorm[i + barCount] = t;
|
|
565
|
+
aGroup[i] = 0;
|
|
566
|
+
aGroup[i + barCount] = 1;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
const geo = new THREE.PlaneGeometry(FIXED_BAR_WIDTH, 1, 1, 1);
|
|
570
|
+
geo.translate(0, 0.5, 0);
|
|
571
|
+
geo.setAttribute('aXPos', new THREE.InstancedBufferAttribute(aXPos, 1));
|
|
572
|
+
geo.setAttribute('aPosNorm', new THREE.InstancedBufferAttribute(aPosNorm, 1));
|
|
573
|
+
geo.setAttribute('aGroup', new THREE.InstancedBufferAttribute(aGroup, 1));
|
|
574
|
+
geo.setAttribute('aGlow', new THREE.InstancedBufferAttribute(aGlow, 1).setUsage(THREE.DynamicDrawUsage));
|
|
575
|
+
|
|
576
|
+
barMaterial = createInstancedMaterial();
|
|
577
|
+
instancedBars = new THREE.InstancedMesh(geo, barMaterial, instCnt);
|
|
578
|
+
instancedBars.frustumCulled = false;
|
|
579
|
+
waveScene.add(instancedBars);
|
|
580
|
+
|
|
581
|
+
setupQuickSetters();
|
|
582
|
+
updateGlowDistance();
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function buildKeyframeTweens(target: any, keyframes: Array<any>) {
|
|
586
|
+
const tl = gsap.timeline();
|
|
587
|
+
for (let i = 0; i < keyframes.length - 1; i++) {
|
|
588
|
+
const cur = keyframes[i];
|
|
589
|
+
const nxt = keyframes[i + 1];
|
|
590
|
+
const duration = nxt.time - cur.time;
|
|
591
|
+
tl.to(target, { gain: nxt.gain, frequency: nxt.frequency, waveLength: nxt.waveLength, duration, ease: 'power2.inOut' }, cur.time);
|
|
592
|
+
}
|
|
593
|
+
return tl;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function initWaveThree() {
|
|
597
|
+
cameraWidth = waveContainer.clientWidth;
|
|
598
|
+
cameraHeight = waveContainer.clientHeight;
|
|
599
|
+
waveCamera = new THREE.OrthographicCamera(-cameraWidth / 2, cameraWidth / 2, cameraHeight / 2, -cameraHeight / 2, -1000, 1000);
|
|
600
|
+
waveCamera.position.z = 10;
|
|
601
|
+
waveCamera.lookAt(0, 0, 0);
|
|
602
|
+
|
|
603
|
+
waveRenderer.setSize(cameraWidth, cameraHeight);
|
|
604
|
+
waveComposer = new EffectComposer(waveRenderer);
|
|
605
|
+
(waveComposer as any).setPixelRatio(EFFECT_PR);
|
|
606
|
+
|
|
607
|
+
const waveRenderPass = new RenderPass(waveScene, waveCamera);
|
|
608
|
+
waveComposer.addPass(waveRenderPass);
|
|
609
|
+
|
|
610
|
+
waveBloomPass = new UnrealBloomPass(new THREE.Vector2(cameraWidth, cameraHeight), 1.0, 0.68, 0.0);
|
|
611
|
+
(waveBloomPass as any).resolution.set(cameraWidth * 0.5, cameraHeight * 0.5);
|
|
612
|
+
waveComposer.addPass(waveBloomPass);
|
|
613
|
+
|
|
614
|
+
grainPass = createFilmGrainPass();
|
|
615
|
+
waveComposer.addPass(grainPass);
|
|
616
|
+
|
|
617
|
+
createInstancedBars();
|
|
618
|
+
setupPointerTracking();
|
|
619
|
+
updateGainMultiplier();
|
|
620
|
+
waveCameraInitialized = true;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
let pendingW = 0, pendingH = 0, heavyResizeTimer: any = null;
|
|
624
|
+
|
|
625
|
+
function onResize(newW: number, newH: number) {
|
|
626
|
+
if (!waveCameraInitialized) return;
|
|
627
|
+
pendingW = newW;
|
|
628
|
+
pendingH = newH;
|
|
629
|
+
|
|
630
|
+
cameraWidth = newW;
|
|
631
|
+
cameraHeight = newH;
|
|
632
|
+
waveCamera.left = -cameraWidth / 2;
|
|
633
|
+
waveCamera.right = cameraWidth / 2;
|
|
634
|
+
waveCamera.top = cameraHeight / 2;
|
|
635
|
+
waveCamera.bottom = -cameraHeight / 2;
|
|
636
|
+
waveCamera.updateProjectionMatrix();
|
|
637
|
+
|
|
638
|
+
const waveWidth = cameraWidth;
|
|
639
|
+
const span = waveWidth + EXTEND_LEFT_PX;
|
|
640
|
+
let barCount = Math.min(MAX_BARS, Math.max(1, Math.floor((span + FIXED_BAR_GAP) / (FIXED_BAR_WIDTH + FIXED_BAR_GAP))));
|
|
641
|
+
const gap = barCount > 1 ? (span - barCount * FIXED_BAR_WIDTH) / (barCount - 1) : 0;
|
|
642
|
+
|
|
643
|
+
if (barCount !== currentBarCount) {
|
|
644
|
+
currentBarCount = barCount;
|
|
645
|
+
createInstancedBars();
|
|
646
|
+
} else {
|
|
647
|
+
const startX = -waveWidth / 2 - EXTEND_LEFT_PX;
|
|
648
|
+
const aX = instancedBars!.geometry.getAttribute('aXPos') as THREE.InstancedBufferAttribute;
|
|
649
|
+
const aT = instancedBars!.geometry.getAttribute('aPosNorm') as THREE.InstancedBufferAttribute;
|
|
650
|
+
|
|
651
|
+
for (let i = 0; i < barCount; i++) {
|
|
652
|
+
const x = startX + FIXED_BAR_WIDTH / 2 + i * (FIXED_BAR_WIDTH + gap);
|
|
653
|
+
const t = barCount > 1 ? i / (barCount - 1) : 0;
|
|
654
|
+
(aX.array as any)[i] = (aX.array as any)[i + barCount] = x;
|
|
655
|
+
(aT.array as any)[i] = (aT.array as any)[i + barCount] = t;
|
|
656
|
+
}
|
|
657
|
+
aX.needsUpdate = true;
|
|
658
|
+
aT.needsUpdate = true;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
(barMaterial.uniforms as any).uHalfW.value = cameraWidth * 0.5;
|
|
662
|
+
updateGainMultiplier();
|
|
663
|
+
updateGlowDistance();
|
|
664
|
+
|
|
665
|
+
clearTimeout(heavyResizeTimer);
|
|
666
|
+
heavyResizeTimer = setTimeout(applyHeavyResize, 10);
|
|
667
|
+
rect = waveRenderer.domElement.getBoundingClientRect();
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function applyHeavyResize() {
|
|
671
|
+
heavyResizeTimer = null;
|
|
672
|
+
waveRenderer.setPixelRatio(EFFECT_PR);
|
|
673
|
+
waveRenderer.setSize(pendingW, pendingH);
|
|
674
|
+
(waveComposer as any).setSize(pendingW, pendingH);
|
|
675
|
+
(waveBloomPass as any)?.setSize(pendingW, pendingH);
|
|
676
|
+
(grainPass as any)?.setSize(pendingW, pendingH);
|
|
677
|
+
(grainPass.uniforms as any).grainScale.value = 0.5;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
function disposeWaveScene() {
|
|
681
|
+
gsap.globalTimeline.clear();
|
|
682
|
+
waveScene.traverse((obj: any) => {
|
|
683
|
+
if (obj.isMesh) {
|
|
684
|
+
obj.geometry.dispose();
|
|
685
|
+
if (Array.isArray(obj.material)) {
|
|
686
|
+
obj.material.forEach((m: any) => m.dispose());
|
|
687
|
+
} else {
|
|
688
|
+
obj.material.dispose();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
(grainPass as any)?.dispose?.();
|
|
693
|
+
(waveBloomPass as any)?.dispose?.();
|
|
694
|
+
(waveComposer as any)?.dispose?.();
|
|
695
|
+
(waveRenderer as any)?.dispose?.();
|
|
696
|
+
instancedBars = null;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
const ticker = () => {
|
|
700
|
+
if (!waveCameraInitialized || !instancedBars) return;
|
|
701
|
+
const dt = (gsap.ticker.deltaRatio() as number) * (1 / 60);
|
|
702
|
+
|
|
703
|
+
wave1.currentAngle = (wave1.currentAngle + wave1.frequency * dt) % (Math.PI * 2);
|
|
704
|
+
wave2.currentAngle = (wave2.currentAngle + wave2.frequency * dt) % (Math.PI * 2);
|
|
705
|
+
setPhase1(wave1.currentAngle);
|
|
706
|
+
setPhase2(wave2.currentAngle);
|
|
707
|
+
|
|
708
|
+
const kMouse = 1.0 - Math.exp(-glowConfig.mouseSmoothing * dt);
|
|
709
|
+
proxyMouseX += (mouse.x - proxyMouseX) * kMouse;
|
|
710
|
+
proxyMouseY += (mouse.y - proxyMouseY) * kMouse;
|
|
711
|
+
|
|
712
|
+
const dx = mouse.active ? mouse.x - proxyMouseX : 0;
|
|
713
|
+
const dy = mouse.active ? mouse.y - proxyMouseY : 0;
|
|
714
|
+
const rawSpeed = Math.hypot(dx, dy * 0.1) * glowConfig.speedScale;
|
|
715
|
+
|
|
716
|
+
const kSpeed = 1.0 - Math.exp(-glowDynamics.speedEase * dt);
|
|
717
|
+
smoothSpeed += (rawSpeed - smoothSpeed) * kSpeed;
|
|
718
|
+
setSmoothSpeed(smoothSpeed);
|
|
719
|
+
|
|
720
|
+
const u = (instancedBars.material as THREE.ShaderMaterial).uniforms as any;
|
|
721
|
+
u.w1Gain.value = wave1.gain;
|
|
722
|
+
u.w1Len.value = wave1.waveLength;
|
|
723
|
+
u.w2Gain.value = wave2.gain;
|
|
724
|
+
u.w2Len.value = wave2.waveLength;
|
|
725
|
+
|
|
726
|
+
const mouseClipX = (proxyMouseX / cameraWidth) * 2 - 1;
|
|
727
|
+
setMouseNDC(mouseClipX);
|
|
728
|
+
let baseOffset = 40;
|
|
729
|
+
if (window.innerWidth < 768) baseOffset = 20;
|
|
730
|
+
u.uBaseY.value = -cameraHeight * 0.5 + baseOffset;
|
|
731
|
+
|
|
732
|
+
(grainPass.uniforms as any).time.value += dt * 0.2;
|
|
733
|
+
|
|
734
|
+
accumulateGlow(dt);
|
|
735
|
+
waveComposer.render();
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
// Init
|
|
739
|
+
initWaveThree();
|
|
740
|
+
onResize(waveContainer.clientWidth, waveContainer.clientHeight);
|
|
741
|
+
|
|
742
|
+
gsap.to(waveContainer.querySelector('canvas'), { opacity: 1, duration: 1, ease: 'power2.out' });
|
|
743
|
+
|
|
744
|
+
const mainTimeline = gsap.timeline({ repeat: -1 });
|
|
745
|
+
mainTimeline.add(buildKeyframeTweens(wave1, waveKeyframes1), 0);
|
|
746
|
+
mainTimeline.add(buildKeyframeTweens(wave2, waveKeyframes2), 0);
|
|
747
|
+
mainTimeline.play(0);
|
|
748
|
+
|
|
749
|
+
gsap.ticker.add(ticker);
|
|
750
|
+
|
|
751
|
+
const ro = new ResizeObserver((entries) => {
|
|
752
|
+
for (const e of entries) {
|
|
753
|
+
if (e.target === waveContainer) {
|
|
754
|
+
onResize(e.contentRect.width, e.contentRect.height);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
ro.observe(waveContainer);
|
|
759
|
+
listeners.push(() => gsap.ticker.remove(ticker));
|
|
760
|
+
listeners.push(() => ro.disconnect());
|
|
761
|
+
|
|
762
|
+
const onVisibility = () => {
|
|
763
|
+
document.hidden ? gsap.globalTimeline.pause() : gsap.globalTimeline.resume();
|
|
764
|
+
};
|
|
765
|
+
document.addEventListener('visibilitychange', onVisibility);
|
|
766
|
+
listeners.push(() => document.removeEventListener('visibilitychange', onVisibility));
|
|
767
|
+
|
|
768
|
+
return () => {
|
|
769
|
+
listeners.forEach((fn) => fn());
|
|
770
|
+
try {
|
|
771
|
+
disposeWaveScene();
|
|
772
|
+
} catch {}
|
|
773
|
+
try {
|
|
774
|
+
const canvas = waveRenderer.domElement;
|
|
775
|
+
if (canvas && canvas.parentElement === waveContainer) {
|
|
776
|
+
waveContainer.removeChild(canvas);
|
|
777
|
+
}
|
|
778
|
+
} catch {}
|
|
779
|
+
};
|
|
780
|
+
}, [extendLeftPx]);
|
|
781
|
+
|
|
782
|
+
return (
|
|
783
|
+
<section ref={containerRef} className={className} style={{ position: 'relative', width: '100%', height: '100vh', ...style }} aria-label="Animated hero">
|
|
784
|
+
{children}
|
|
785
|
+
|
|
786
|
+
{/* Default Content Overlay */}
|
|
787
|
+
{!children && (
|
|
788
|
+
<div
|
|
789
|
+
style={{
|
|
790
|
+
position: 'absolute',
|
|
791
|
+
inset: 0,
|
|
792
|
+
zIndex: 3,
|
|
793
|
+
display: 'flex',
|
|
794
|
+
alignItems: 'center',
|
|
795
|
+
justifyContent: 'center',
|
|
796
|
+
pointerEvents: 'none',
|
|
797
|
+
padding: '24px',
|
|
798
|
+
}}
|
|
799
|
+
>
|
|
800
|
+
<div className="max-w-3xl w-full text-center" style={{ pointerEvents: 'auto' }}>
|
|
801
|
+
<h1 className="text-white text-3xl sm:text-5xl font-semibold tracking-tight drop-shadow-[0_1px_8px_rgba(31,61,188,0.25)]">
|
|
802
|
+
{title}
|
|
803
|
+
</h1>
|
|
804
|
+
<p className="text-gray-300/90 mt-3 sm:mt-4 text-sm sm:text-base">{subtitle}</p>
|
|
805
|
+
<form
|
|
806
|
+
className="mt-6 sm:mt-8 flex items-center justify-center"
|
|
807
|
+
onSubmit={(e) => {
|
|
808
|
+
e.preventDefault();
|
|
809
|
+
onPromptSubmit?.(prompt);
|
|
810
|
+
}}
|
|
811
|
+
>
|
|
812
|
+
<div className="relative w-full sm:w-[720px]">
|
|
813
|
+
<div className="relative rounded-2xl p-[2px] shadow-[0_1px_2px_0_rgba(0,0,0,0.06)] bg-gradient-to-br from-white/10 via-white/5 to-black/20">
|
|
814
|
+
<textarea
|
|
815
|
+
value={prompt}
|
|
816
|
+
onChange={(e) => setPrompt(e.target.value)}
|
|
817
|
+
placeholder={animatedPlaceholder}
|
|
818
|
+
rows={5}
|
|
819
|
+
className="w-full h-32 sm:h-36 resize-none rounded-2xl bg-[rgba(15,15,20,0.55)] border border-white/10 text-white placeholder:text-white/40 outline-none focus:ring-2 focus:ring-[#1f3dbc]/40 focus:border-[#1f3dbc]/40 backdrop-blur-md px-4 py-4 pr-16"
|
|
820
|
+
/>
|
|
821
|
+
</div>
|
|
822
|
+
<button
|
|
823
|
+
type="submit"
|
|
824
|
+
aria-label={buttonText}
|
|
825
|
+
className="absolute right-3 bottom-3 inline-flex items-center justify-center w-10 h-10 rounded-xl bg-[#f0f2ff] text-black hover:bg-white transition-colors"
|
|
826
|
+
>
|
|
827
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="w-5 h-5">
|
|
828
|
+
<path d="M7 17L17 7" />
|
|
829
|
+
<path d="M7 7h10v10" />
|
|
830
|
+
</svg>
|
|
831
|
+
</button>
|
|
832
|
+
</div>
|
|
833
|
+
</form>
|
|
834
|
+
</div>
|
|
835
|
+
</div>
|
|
836
|
+
)}
|
|
837
|
+
|
|
838
|
+
{/* Wave Canvas */}
|
|
839
|
+
<div ref={waveRef} id="waveCanvas" style={{ position: 'absolute', inset: 0, zIndex: 1, opacity: 0.8 }} />
|
|
840
|
+
</section>
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// ============================================
|
|
845
|
+
// USAGE EXAMPLE
|
|
846
|
+
// ============================================
|
|
847
|
+
/*
|
|
848
|
+
import { WaveHero } from './wave-hero';
|
|
849
|
+
|
|
850
|
+
function LandingPage() {
|
|
851
|
+
return (
|
|
852
|
+
<WaveHero
|
|
853
|
+
title="Build with AI."
|
|
854
|
+
subtitle="The AI Fullstack Engineer. Build prototypes, apps, and websites"
|
|
855
|
+
placeholder="Make me a"
|
|
856
|
+
buttonText="Generate"
|
|
857
|
+
onPromptSubmit={(value) => console.log('Prompt:', value)}
|
|
858
|
+
/>
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// With custom content overlay
|
|
863
|
+
function CustomHero() {
|
|
864
|
+
return (
|
|
865
|
+
<WaveHero>
|
|
866
|
+
<div className="absolute inset-0 z-10 flex items-center justify-center">
|
|
867
|
+
<h1 className="text-6xl text-white">Custom Content</h1>
|
|
868
|
+
</div>
|
|
869
|
+
</WaveHero>
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
*/
|
|
873
|
+
|
|
874
|
+
export default WaveHero;
|
|
875
|
+
|