@reftrixmcp/mcp-server 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +1099 -0
- package/dist/api/health.d.ts +122 -0
- package/dist/api/health.d.ts.map +1 -0
- package/dist/api/health.js +267 -0
- package/dist/api/health.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +27 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/redis.d.ts +99 -0
- package/dist/config/redis.d.ts.map +1 -0
- package/dist/config/redis.js +234 -0
- package/dist/config/redis.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +247 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +14 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/project-context.d.ts +51 -0
- package/dist/lib/project-context.d.ts.map +1 -0
- package/dist/lib/project-context.js +109 -0
- package/dist/lib/project-context.js.map +1 -0
- package/dist/middleware/args-type-coercion.d.ts +59 -0
- package/dist/middleware/args-type-coercion.d.ts.map +1 -0
- package/dist/middleware/args-type-coercion.js +187 -0
- package/dist/middleware/args-type-coercion.js.map +1 -0
- package/dist/middleware/auth.d.ts +122 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +430 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/index.d.ts +10 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +38 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/light-response-controller.d.ts +206 -0
- package/dist/middleware/light-response-controller.d.ts.map +1 -0
- package/dist/middleware/light-response-controller.js +555 -0
- package/dist/middleware/light-response-controller.js.map +1 -0
- package/dist/middleware/response-size-warning.d.ts +97 -0
- package/dist/middleware/response-size-warning.d.ts.map +1 -0
- package/dist/middleware/response-size-warning.js +137 -0
- package/dist/middleware/response-size-warning.js.map +1 -0
- package/dist/queues/batch-quality-queue.d.ts +225 -0
- package/dist/queues/batch-quality-queue.d.ts.map +1 -0
- package/dist/queues/batch-quality-queue.js +375 -0
- package/dist/queues/batch-quality-queue.js.map +1 -0
- package/dist/queues/index.d.ts +10 -0
- package/dist/queues/index.d.ts.map +1 -0
- package/dist/queues/index.js +28 -0
- package/dist/queues/index.js.map +1 -0
- package/dist/queues/page-analyze-queue.d.ts +287 -0
- package/dist/queues/page-analyze-queue.d.ts.map +1 -0
- package/dist/queues/page-analyze-queue.js +219 -0
- package/dist/queues/page-analyze-queue.js.map +1 -0
- package/dist/router.d.ts +144 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +261 -0
- package/dist/router.js.map +1 -0
- package/dist/schemas/creative/index.d.ts +8 -0
- package/dist/schemas/creative/index.d.ts.map +1 -0
- package/dist/schemas/creative/index.js +23 -0
- package/dist/schemas/creative/index.js.map +1 -0
- package/dist/schemas/creative/palette.schema.d.ts +741 -0
- package/dist/schemas/creative/palette.schema.d.ts.map +1 -0
- package/dist/schemas/creative/palette.schema.js +154 -0
- package/dist/schemas/creative/palette.schema.js.map +1 -0
- package/dist/schemas/mood-brandtone-filters.d.ts +740 -0
- package/dist/schemas/mood-brandtone-filters.d.ts.map +1 -0
- package/dist/schemas/mood-brandtone-filters.js +265 -0
- package/dist/schemas/mood-brandtone-filters.js.map +1 -0
- package/dist/scripts/backfill-embeddings.d.ts +3 -0
- package/dist/scripts/backfill-embeddings.d.ts.map +1 -0
- package/dist/scripts/backfill-embeddings.js +385 -0
- package/dist/scripts/backfill-embeddings.js.map +1 -0
- package/dist/scripts/check-embedding-coverage.d.ts +3 -0
- package/dist/scripts/check-embedding-coverage.d.ts.map +1 -0
- package/dist/scripts/check-embedding-coverage.js +103 -0
- package/dist/scripts/check-embedding-coverage.js.map +1 -0
- package/dist/scripts/start-workers.d.ts +3 -0
- package/dist/scripts/start-workers.d.ts.map +1 -0
- package/dist/scripts/start-workers.js +447 -0
- package/dist/scripts/start-workers.js.map +1 -0
- package/dist/server.d.ts +49 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +237 -0
- package/dist/server.js.map +1 -0
- package/dist/services/background/background-design-db.service.d.ts +65 -0
- package/dist/services/background/background-design-db.service.d.ts.map +1 -0
- package/dist/services/background/background-design-db.service.js +138 -0
- package/dist/services/background/background-design-db.service.js.map +1 -0
- package/dist/services/background/background-design-detector.service.d.ts +125 -0
- package/dist/services/background/background-design-detector.service.d.ts.map +1 -0
- package/dist/services/background/background-design-detector.service.js +1106 -0
- package/dist/services/background/background-design-detector.service.js.map +1 -0
- package/dist/services/background/background-design-embedding.service.d.ts +188 -0
- package/dist/services/background/background-design-embedding.service.d.ts.map +1 -0
- package/dist/services/background/background-design-embedding.service.js +386 -0
- package/dist/services/background/background-design-embedding.service.js.map +1 -0
- package/dist/services/background-search.service.d.ts +43 -0
- package/dist/services/background-search.service.d.ts.map +1 -0
- package/dist/services/background-search.service.js +235 -0
- package/dist/services/background-search.service.js.map +1 -0
- package/dist/services/backup-service.d.ts +135 -0
- package/dist/services/backup-service.d.ts.map +1 -0
- package/dist/services/backup-service.js +357 -0
- package/dist/services/backup-service.js.map +1 -0
- package/dist/services/brief/brief-parser-service.d.ts +47 -0
- package/dist/services/brief/brief-parser-service.d.ts.map +1 -0
- package/dist/services/brief/brief-parser-service.js +380 -0
- package/dist/services/brief/brief-parser-service.js.map +1 -0
- package/dist/services/brief/schemas/brief-parser-schemas.d.ts +278 -0
- package/dist/services/brief/schemas/brief-parser-schemas.d.ts.map +1 -0
- package/dist/services/brief/schemas/brief-parser-schemas.js +116 -0
- package/dist/services/brief/schemas/brief-parser-schemas.js.map +1 -0
- package/dist/services/browser-process-manager.d.ts +116 -0
- package/dist/services/browser-process-manager.d.ts.map +1 -0
- package/dist/services/browser-process-manager.js +259 -0
- package/dist/services/browser-process-manager.js.map +1 -0
- package/dist/services/cache.d.ts +119 -0
- package/dist/services/cache.d.ts.map +1 -0
- package/dist/services/cache.js +233 -0
- package/dist/services/cache.js.map +1 -0
- package/dist/services/checksum-service.d.ts +122 -0
- package/dist/services/checksum-service.d.ts.map +1 -0
- package/dist/services/checksum-service.js +270 -0
- package/dist/services/checksum-service.js.map +1 -0
- package/dist/services/css-analysis-cache.service.d.ts +248 -0
- package/dist/services/css-analysis-cache.service.d.ts.map +1 -0
- package/dist/services/css-analysis-cache.service.js +398 -0
- package/dist/services/css-analysis-cache.service.js.map +1 -0
- package/dist/services/database-dumper.service.d.ts +181 -0
- package/dist/services/database-dumper.service.d.ts.map +1 -0
- package/dist/services/database-dumper.service.js +550 -0
- package/dist/services/database-dumper.service.js.map +1 -0
- package/dist/services/embedding-backfill.service.d.ts +53 -0
- package/dist/services/embedding-backfill.service.d.ts.map +1 -0
- package/dist/services/embedding-backfill.service.js +672 -0
- package/dist/services/embedding-backfill.service.js.map +1 -0
- package/dist/services/embedding-validation.service.d.ts +64 -0
- package/dist/services/embedding-validation.service.d.ts.map +1 -0
- package/dist/services/embedding-validation.service.js +141 -0
- package/dist/services/embedding-validation.service.js.map +1 -0
- package/dist/services/encryption-service.d.ts +171 -0
- package/dist/services/encryption-service.d.ts.map +1 -0
- package/dist/services/encryption-service.js +343 -0
- package/dist/services/encryption-service.js.map +1 -0
- package/dist/services/external-css-fetcher.d.ts +185 -0
- package/dist/services/external-css-fetcher.d.ts.map +1 -0
- package/dist/services/external-css-fetcher.js +667 -0
- package/dist/services/external-css-fetcher.js.map +1 -0
- package/dist/services/gpu-resource-manager.d.ts +180 -0
- package/dist/services/gpu-resource-manager.d.ts.map +1 -0
- package/dist/services/gpu-resource-manager.js +485 -0
- package/dist/services/gpu-resource-manager.js.map +1 -0
- package/dist/services/index.d.ts +15 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +73 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/layout/component-splitter.d.ts +63 -0
- package/dist/services/layout/component-splitter.d.ts.map +1 -0
- package/dist/services/layout/component-splitter.js +508 -0
- package/dist/services/layout/component-splitter.js.map +1 -0
- package/dist/services/layout/html-to-jsx-converter.d.ts +40 -0
- package/dist/services/layout/html-to-jsx-converter.d.ts.map +1 -0
- package/dist/services/layout/html-to-jsx-converter.js +484 -0
- package/dist/services/layout/html-to-jsx-converter.js.map +1 -0
- package/dist/services/layout/semantic-html-converter.d.ts +67 -0
- package/dist/services/layout/semantic-html-converter.d.ts.map +1 -0
- package/dist/services/layout/semantic-html-converter.js +247 -0
- package/dist/services/layout/semantic-html-converter.js.map +1 -0
- package/dist/services/layout/style-to-tailwind-mapper.d.ts +82 -0
- package/dist/services/layout/style-to-tailwind-mapper.d.ts.map +1 -0
- package/dist/services/layout/style-to-tailwind-mapper.js +1334 -0
- package/dist/services/layout/style-to-tailwind-mapper.js.map +1 -0
- package/dist/services/layout-embedding.service.d.ts +415 -0
- package/dist/services/layout-embedding.service.d.ts.map +1 -0
- package/dist/services/layout-embedding.service.js +1147 -0
- package/dist/services/layout-embedding.service.js.map +1 -0
- package/dist/services/layout-generate-code-service-export.d.ts +38 -0
- package/dist/services/layout-generate-code-service-export.d.ts.map +1 -0
- package/dist/services/layout-generate-code-service-export.js +77 -0
- package/dist/services/layout-generate-code-service-export.js.map +1 -0
- package/dist/services/layout-search-service-export.d.ts +31 -0
- package/dist/services/layout-search-service-export.d.ts.map +1 -0
- package/dist/services/layout-search-service-export.js +43 -0
- package/dist/services/layout-search-service-export.js.map +1 -0
- package/dist/services/layout-search.service.d.ts +111 -0
- package/dist/services/layout-search.service.d.ts.map +1 -0
- package/dist/services/layout-search.service.js +716 -0
- package/dist/services/layout-search.service.js.map +1 -0
- package/dist/services/layout-to-code.service.d.ts +85 -0
- package/dist/services/layout-to-code.service.d.ts.map +1 -0
- package/dist/services/layout-to-code.service.js +1368 -0
- package/dist/services/layout-to-code.service.js.map +1 -0
- package/dist/services/metrics-collector.d.ts +189 -0
- package/dist/services/metrics-collector.d.ts.map +1 -0
- package/dist/services/metrics-collector.js +344 -0
- package/dist/services/metrics-collector.js.map +1 -0
- package/dist/services/ml/mood-brandtone-embedding.service.d.ts +253 -0
- package/dist/services/ml/mood-brandtone-embedding.service.d.ts.map +1 -0
- package/dist/services/ml/mood-brandtone-embedding.service.js +678 -0
- package/dist/services/ml/mood-brandtone-embedding.service.js.map +1 -0
- package/dist/services/motion/analyzers/color-change.analyzer.d.ts +274 -0
- package/dist/services/motion/analyzers/color-change.analyzer.d.ts.map +1 -0
- package/dist/services/motion/analyzers/color-change.analyzer.js +644 -0
- package/dist/services/motion/analyzers/color-change.analyzer.js.map +1 -0
- package/dist/services/motion/analyzers/frame-diff.analyzer.d.ts +109 -0
- package/dist/services/motion/analyzers/frame-diff.analyzer.d.ts.map +1 -0
- package/dist/services/motion/analyzers/frame-diff.analyzer.js +315 -0
- package/dist/services/motion/analyzers/frame-diff.analyzer.js.map +1 -0
- package/dist/services/motion/analyzers/layout-shift.detector.d.ts +132 -0
- package/dist/services/motion/analyzers/layout-shift.detector.d.ts.map +1 -0
- package/dist/services/motion/analyzers/layout-shift.detector.js +179 -0
- package/dist/services/motion/analyzers/layout-shift.detector.js.map +1 -0
- package/dist/services/motion/analyzers/motion-vector.estimator.d.ts +88 -0
- package/dist/services/motion/analyzers/motion-vector.estimator.d.ts.map +1 -0
- package/dist/services/motion/analyzers/motion-vector.estimator.js +494 -0
- package/dist/services/motion/analyzers/motion-vector.estimator.js.map +1 -0
- package/dist/services/motion/analyzers/webgl-motion-analyzer.d.ts +167 -0
- package/dist/services/motion/analyzers/webgl-motion-analyzer.d.ts.map +1 -0
- package/dist/services/motion/analyzers/webgl-motion-analyzer.js +500 -0
- package/dist/services/motion/analyzers/webgl-motion-analyzer.js.map +1 -0
- package/dist/services/motion/animation-metrics-collector.service.d.ts +215 -0
- package/dist/services/motion/animation-metrics-collector.service.d.ts.map +1 -0
- package/dist/services/motion/animation-metrics-collector.service.js +502 -0
- package/dist/services/motion/animation-metrics-collector.service.js.map +1 -0
- package/dist/services/motion/cls-calculator.service.d.ts +186 -0
- package/dist/services/motion/cls-calculator.service.d.ts.map +1 -0
- package/dist/services/motion/cls-calculator.service.js +329 -0
- package/dist/services/motion/cls-calculator.service.js.map +1 -0
- package/dist/services/motion/existing-animation-detector.service.d.ts +208 -0
- package/dist/services/motion/existing-animation-detector.service.d.ts.map +1 -0
- package/dist/services/motion/existing-animation-detector.service.js +591 -0
- package/dist/services/motion/existing-animation-detector.service.js.map +1 -0
- package/dist/services/motion/fade-detector.service.d.ts +114 -0
- package/dist/services/motion/fade-detector.service.d.ts.map +1 -0
- package/dist/services/motion/fade-detector.service.js +249 -0
- package/dist/services/motion/fade-detector.service.js.map +1 -0
- package/dist/services/motion/frame-analysis-save.helper.d.ts +41 -0
- package/dist/services/motion/frame-analysis-save.helper.d.ts.map +1 -0
- package/dist/services/motion/frame-analysis-save.helper.js +235 -0
- package/dist/services/motion/frame-analysis-save.helper.js.map +1 -0
- package/dist/services/motion/frame-capture.service.d.ts +170 -0
- package/dist/services/motion/frame-capture.service.d.ts.map +1 -0
- package/dist/services/motion/frame-capture.service.js +476 -0
- package/dist/services/motion/frame-capture.service.js.map +1 -0
- package/dist/services/motion/frame-embedding.service.d.ts +315 -0
- package/dist/services/motion/frame-embedding.service.d.ts.map +1 -0
- package/dist/services/motion/frame-embedding.service.js +1023 -0
- package/dist/services/motion/frame-embedding.service.js.map +1 -0
- package/dist/services/motion/frame-image-analysis.service.d.ts +126 -0
- package/dist/services/motion/frame-image-analysis.service.d.ts.map +1 -0
- package/dist/services/motion/frame-image-analysis.service.js +982 -0
- package/dist/services/motion/frame-image-analysis.service.js.map +1 -0
- package/dist/services/motion/frame-image-analyzer.adapter.d.ts +168 -0
- package/dist/services/motion/frame-image-analyzer.adapter.d.ts.map +1 -0
- package/dist/services/motion/frame-image-analyzer.adapter.js +520 -0
- package/dist/services/motion/frame-image-analyzer.adapter.js.map +1 -0
- package/dist/services/motion/frame-worker-pool.service.d.ts +133 -0
- package/dist/services/motion/frame-worker-pool.service.d.ts.map +1 -0
- package/dist/services/motion/frame-worker-pool.service.js +410 -0
- package/dist/services/motion/frame-worker-pool.service.js.map +1 -0
- package/dist/services/motion/infrastructure/frame-loader.d.ts +77 -0
- package/dist/services/motion/infrastructure/frame-loader.d.ts.map +1 -0
- package/dist/services/motion/infrastructure/frame-loader.js +430 -0
- package/dist/services/motion/infrastructure/frame-loader.js.map +1 -0
- package/dist/services/motion/js-animation-detector.d.ts +382 -0
- package/dist/services/motion/js-animation-detector.d.ts.map +1 -0
- package/dist/services/motion/js-animation-detector.js +911 -0
- package/dist/services/motion/js-animation-detector.js.map +1 -0
- package/dist/services/motion/js-animation-embedding.service.d.ts +114 -0
- package/dist/services/motion/js-animation-embedding.service.d.ts.map +1 -0
- package/dist/services/motion/js-animation-embedding.service.js +289 -0
- package/dist/services/motion/js-animation-embedding.service.js.map +1 -0
- package/dist/services/motion/js-animation-search.service.d.ts +138 -0
- package/dist/services/motion/js-animation-search.service.d.ts.map +1 -0
- package/dist/services/motion/js-animation-search.service.js +503 -0
- package/dist/services/motion/js-animation-search.service.js.map +1 -0
- package/dist/services/motion/motion-db.service.d.ts +231 -0
- package/dist/services/motion/motion-db.service.d.ts.map +1 -0
- package/dist/services/motion/motion-db.service.js +676 -0
- package/dist/services/motion/motion-db.service.js.map +1 -0
- package/dist/services/motion/three-js-scene-extractor.d.ts +274 -0
- package/dist/services/motion/three-js-scene-extractor.d.ts.map +1 -0
- package/dist/services/motion/three-js-scene-extractor.js +1126 -0
- package/dist/services/motion/three-js-scene-extractor.js.map +1 -0
- package/dist/services/motion/types.d.ts +592 -0
- package/dist/services/motion/types.d.ts.map +1 -0
- package/dist/services/motion/types.js +121 -0
- package/dist/services/motion/types.js.map +1 -0
- package/dist/services/motion/visual-category-classifier.d.ts +273 -0
- package/dist/services/motion/visual-category-classifier.d.ts.map +1 -0
- package/dist/services/motion/visual-category-classifier.js +1060 -0
- package/dist/services/motion/visual-category-classifier.js.map +1 -0
- package/dist/services/motion/webgl-animation-categorizer.d.ts +151 -0
- package/dist/services/motion/webgl-animation-categorizer.d.ts.map +1 -0
- package/dist/services/motion/webgl-animation-categorizer.js +568 -0
- package/dist/services/motion/webgl-animation-categorizer.js.map +1 -0
- package/dist/services/motion/webgl-animation-detector.service.d.ts +204 -0
- package/dist/services/motion/webgl-animation-detector.service.d.ts.map +1 -0
- package/dist/services/motion/webgl-animation-detector.service.js +518 -0
- package/dist/services/motion/webgl-animation-detector.service.js.map +1 -0
- package/dist/services/motion/webgl-animation-embedding.service.d.ts +238 -0
- package/dist/services/motion/webgl-animation-embedding.service.d.ts.map +1 -0
- package/dist/services/motion/webgl-animation-embedding.service.js +368 -0
- package/dist/services/motion/webgl-animation-embedding.service.js.map +1 -0
- package/dist/services/motion-detect-service-export.d.ts +130 -0
- package/dist/services/motion-detect-service-export.d.ts.map +1 -0
- package/dist/services/motion-detect-service-export.js +160 -0
- package/dist/services/motion-detect-service-export.js.map +1 -0
- package/dist/services/motion-persistence.service.d.ts +144 -0
- package/dist/services/motion-persistence.service.d.ts.map +1 -0
- package/dist/services/motion-persistence.service.js +398 -0
- package/dist/services/motion-persistence.service.js.map +1 -0
- package/dist/services/motion-search-service.d.ts +10 -0
- package/dist/services/motion-search-service.d.ts.map +1 -0
- package/dist/services/motion-search-service.js +22 -0
- package/dist/services/motion-search-service.js.map +1 -0
- package/dist/services/motion-search.service.d.ts +210 -0
- package/dist/services/motion-search.service.d.ts.map +1 -0
- package/dist/services/motion-search.service.js +900 -0
- package/dist/services/motion-search.service.js.map +1 -0
- package/dist/services/narrative/analyzers/layout-structure.analyzer.d.ts +75 -0
- package/dist/services/narrative/analyzers/layout-structure.analyzer.d.ts.map +1 -0
- package/dist/services/narrative/analyzers/layout-structure.analyzer.js +489 -0
- package/dist/services/narrative/analyzers/layout-structure.analyzer.js.map +1 -0
- package/dist/services/narrative/analyzers/worldview.analyzer.d.ts +92 -0
- package/dist/services/narrative/analyzers/worldview.analyzer.d.ts.map +1 -0
- package/dist/services/narrative/analyzers/worldview.analyzer.js +477 -0
- package/dist/services/narrative/analyzers/worldview.analyzer.js.map +1 -0
- package/dist/services/narrative/generators/confidence-calculator.d.ts +65 -0
- package/dist/services/narrative/generators/confidence-calculator.d.ts.map +1 -0
- package/dist/services/narrative/generators/confidence-calculator.js +316 -0
- package/dist/services/narrative/generators/confidence-calculator.js.map +1 -0
- package/dist/services/narrative/generators/text-representation.generator.d.ts +67 -0
- package/dist/services/narrative/generators/text-representation.generator.d.ts.map +1 -0
- package/dist/services/narrative/generators/text-representation.generator.js +312 -0
- package/dist/services/narrative/generators/text-representation.generator.js.map +1 -0
- package/dist/services/narrative/index.d.ts +16 -0
- package/dist/services/narrative/index.d.ts.map +1 -0
- package/dist/services/narrative/index.js +63 -0
- package/dist/services/narrative/index.js.map +1 -0
- package/dist/services/narrative/narrative-analysis.service.d.ts +120 -0
- package/dist/services/narrative/narrative-analysis.service.d.ts.map +1 -0
- package/dist/services/narrative/narrative-analysis.service.js +479 -0
- package/dist/services/narrative/narrative-analysis.service.js.map +1 -0
- package/dist/services/narrative/narrative-search.service.d.ts +126 -0
- package/dist/services/narrative/narrative-search.service.d.ts.map +1 -0
- package/dist/services/narrative/narrative-search.service.js +516 -0
- package/dist/services/narrative/narrative-search.service.js.map +1 -0
- package/dist/services/narrative/types/narrative.types.d.ts +372 -0
- package/dist/services/narrative/types/narrative.types.d.ts.map +1 -0
- package/dist/services/narrative/types/narrative.types.js +5 -0
- package/dist/services/narrative/types/narrative.types.js.map +1 -0
- package/dist/services/orphaned-job-utils.d.ts +62 -0
- package/dist/services/orphaned-job-utils.d.ts.map +1 -0
- package/dist/services/orphaned-job-utils.js +130 -0
- package/dist/services/orphaned-job-utils.js.map +1 -0
- package/dist/services/page/css-animation-parser.service.d.ts +173 -0
- package/dist/services/page/css-animation-parser.service.d.ts.map +1 -0
- package/dist/services/page/css-animation-parser.service.js +537 -0
- package/dist/services/page/css-animation-parser.service.js.map +1 -0
- package/dist/services/page/fallback-analyzer.service.d.ts +140 -0
- package/dist/services/page/fallback-analyzer.service.d.ts.map +1 -0
- package/dist/services/page/fallback-analyzer.service.js +289 -0
- package/dist/services/page/fallback-analyzer.service.js.map +1 -0
- package/dist/services/page/frame-analyzer.service.d.ts +208 -0
- package/dist/services/page/frame-analyzer.service.d.ts.map +1 -0
- package/dist/services/page/frame-analyzer.service.js +628 -0
- package/dist/services/page/frame-analyzer.service.js.map +1 -0
- package/dist/services/page/layout-analyzer.service.d.ts +323 -0
- package/dist/services/page/layout-analyzer.service.d.ts.map +1 -0
- package/dist/services/page/layout-analyzer.service.js +2001 -0
- package/dist/services/page/layout-analyzer.service.js.map +1 -0
- package/dist/services/page/motion-category-classifier.service.d.ts +72 -0
- package/dist/services/page/motion-category-classifier.service.d.ts.map +1 -0
- package/dist/services/page/motion-category-classifier.service.js +340 -0
- package/dist/services/page/motion-category-classifier.service.js.map +1 -0
- package/dist/services/page/motion-detector.service.d.ts +76 -0
- package/dist/services/page/motion-detector.service.d.ts.map +1 -0
- package/dist/services/page/motion-detector.service.js +255 -0
- package/dist/services/page/motion-detector.service.js.map +1 -0
- package/dist/services/page/motion-performance-analyzer.service.d.ts +114 -0
- package/dist/services/page/motion-performance-analyzer.service.d.ts.map +1 -0
- package/dist/services/page/motion-performance-analyzer.service.js +315 -0
- package/dist/services/page/motion-performance-analyzer.service.js.map +1 -0
- package/dist/services/page/playwright-crawler.service.d.ts +106 -0
- package/dist/services/page/playwright-crawler.service.d.ts.map +1 -0
- package/dist/services/page/playwright-crawler.service.js +373 -0
- package/dist/services/page/playwright-crawler.service.js.map +1 -0
- package/dist/services/page/quality-evaluator.service.d.ts +107 -0
- package/dist/services/page/quality-evaluator.service.d.ts.map +1 -0
- package/dist/services/page/quality-evaluator.service.js +1138 -0
- package/dist/services/page/quality-evaluator.service.js.map +1 -0
- package/dist/services/page/runtime-animation-detector.service.d.ts +154 -0
- package/dist/services/page/runtime-animation-detector.service.d.ts.map +1 -0
- package/dist/services/page/runtime-animation-detector.service.js +480 -0
- package/dist/services/page/runtime-animation-detector.service.js.map +1 -0
- package/dist/services/page/section-postprocessor.service.d.ts +55 -0
- package/dist/services/page/section-postprocessor.service.d.ts.map +1 -0
- package/dist/services/page/section-postprocessor.service.js +708 -0
- package/dist/services/page/section-postprocessor.service.js.map +1 -0
- package/dist/services/page/video-recorder.service.d.ts +110 -0
- package/dist/services/page/video-recorder.service.d.ts.map +1 -0
- package/dist/services/page/video-recorder.service.js +441 -0
- package/dist/services/page/video-recorder.service.js.map +1 -0
- package/dist/services/page/webgl-detector.service.d.ts +113 -0
- package/dist/services/page/webgl-detector.service.d.ts.map +1 -0
- package/dist/services/page/webgl-detector.service.js +280 -0
- package/dist/services/page/webgl-detector.service.js.map +1 -0
- package/dist/services/page-analyze-service.d.ts +30 -0
- package/dist/services/page-analyze-service.d.ts.map +1 -0
- package/dist/services/page-analyze-service.js +58 -0
- package/dist/services/page-analyze-service.js.map +1 -0
- package/dist/services/page-ingest-adapter.d.ts +479 -0
- package/dist/services/page-ingest-adapter.d.ts.map +1 -0
- package/dist/services/page-ingest-adapter.js +1726 -0
- package/dist/services/page-ingest-adapter.js.map +1 -0
- package/dist/services/palette-service-export.d.ts +26 -0
- package/dist/services/palette-service-export.d.ts.map +1 -0
- package/dist/services/palette-service-export.js +22 -0
- package/dist/services/palette-service-export.js.map +1 -0
- package/dist/services/part/index.d.ts +22 -0
- package/dist/services/part/index.d.ts.map +1 -0
- package/dist/services/part/index.js +72 -0
- package/dist/services/part/index.js.map +1 -0
- package/dist/services/part/part-backfill.service.d.ts +66 -0
- package/dist/services/part/part-backfill.service.d.ts.map +1 -0
- package/dist/services/part/part-backfill.service.js +195 -0
- package/dist/services/part/part-backfill.service.js.map +1 -0
- package/dist/services/part/part-bbox-playwright.service.d.ts +85 -0
- package/dist/services/part/part-bbox-playwright.service.d.ts.map +1 -0
- package/dist/services/part/part-bbox-playwright.service.js +362 -0
- package/dist/services/part/part-bbox-playwright.service.js.map +1 -0
- package/dist/services/part/part-db.service.d.ts +41 -0
- package/dist/services/part/part-db.service.d.ts.map +1 -0
- package/dist/services/part/part-db.service.js +82 -0
- package/dist/services/part/part-db.service.js.map +1 -0
- package/dist/services/part/part-embedding-db.service.d.ts +52 -0
- package/dist/services/part/part-embedding-db.service.d.ts.map +1 -0
- package/dist/services/part/part-embedding-db.service.js +122 -0
- package/dist/services/part/part-embedding-db.service.js.map +1 -0
- package/dist/services/part/part-embedding.service.d.ts +140 -0
- package/dist/services/part/part-embedding.service.d.ts.map +1 -0
- package/dist/services/part/part-embedding.service.js +276 -0
- package/dist/services/part/part-embedding.service.js.map +1 -0
- package/dist/services/part/part-extraction.service.d.ts +75 -0
- package/dist/services/part/part-extraction.service.d.ts.map +1 -0
- package/dist/services/part/part-extraction.service.js +519 -0
- package/dist/services/part/part-extraction.service.js.map +1 -0
- package/dist/services/part/part-search.service.d.ts +180 -0
- package/dist/services/part/part-search.service.d.ts.map +1 -0
- package/dist/services/part/part-search.service.js +565 -0
- package/dist/services/part/part-search.service.js.map +1 -0
- package/dist/services/part/schemas.d.ts +232 -0
- package/dist/services/part/schemas.d.ts.map +1 -0
- package/dist/services/part/schemas.js +167 -0
- package/dist/services/part/schemas.js.map +1 -0
- package/dist/services/part/section-screenshot-fallback.service.d.ts +101 -0
- package/dist/services/part/section-screenshot-fallback.service.d.ts.map +1 -0
- package/dist/services/part/section-screenshot-fallback.service.js +489 -0
- package/dist/services/part/section-screenshot-fallback.service.js.map +1 -0
- package/dist/services/part/types.d.ts +189 -0
- package/dist/services/part/types.d.ts.map +1 -0
- package/dist/services/part/types.js +139 -0
- package/dist/services/part/types.js.map +1 -0
- package/dist/services/persistent-cache.d.ts +209 -0
- package/dist/services/persistent-cache.d.ts.map +1 -0
- package/dist/services/persistent-cache.js +633 -0
- package/dist/services/persistent-cache.js.map +1 -0
- package/dist/services/preference-profile.service.d.ts +143 -0
- package/dist/services/preference-profile.service.d.ts.map +1 -0
- package/dist/services/preference-profile.service.js +604 -0
- package/dist/services/preference-profile.service.js.map +1 -0
- package/dist/services/preference-rerank.helper.d.ts +128 -0
- package/dist/services/preference-rerank.helper.d.ts.map +1 -0
- package/dist/services/preference-rerank.helper.js +397 -0
- package/dist/services/preference-rerank.helper.js.map +1 -0
- package/dist/services/production-guard.d.ts +213 -0
- package/dist/services/production-guard.d.ts.map +1 -0
- package/dist/services/production-guard.js +357 -0
- package/dist/services/production-guard.js.map +1 -0
- package/dist/services/project-context-analyzer.d.ts +194 -0
- package/dist/services/project-context-analyzer.d.ts.map +1 -0
- package/dist/services/project-context-analyzer.js +747 -0
- package/dist/services/project-context-analyzer.js.map +1 -0
- package/dist/services/quality/axe-accessibility.service.d.ts +87 -0
- package/dist/services/quality/axe-accessibility.service.d.ts.map +1 -0
- package/dist/services/quality/axe-accessibility.service.js +188 -0
- package/dist/services/quality/axe-accessibility.service.js.map +1 -0
- package/dist/services/quality/axe-core-shared.d.ts +108 -0
- package/dist/services/quality/axe-core-shared.d.ts.map +1 -0
- package/dist/services/quality/axe-core-shared.js +136 -0
- package/dist/services/quality/axe-core-shared.js.map +1 -0
- package/dist/services/quality/benchmark.service.d.ts +178 -0
- package/dist/services/quality/benchmark.service.d.ts.map +1 -0
- package/dist/services/quality/benchmark.service.js +394 -0
- package/dist/services/quality/benchmark.service.js.map +1 -0
- package/dist/services/quality/content-gap-detector.service.d.ts +133 -0
- package/dist/services/quality/content-gap-detector.service.d.ts.map +1 -0
- package/dist/services/quality/content-gap-detector.service.js +364 -0
- package/dist/services/quality/content-gap-detector.service.js.map +1 -0
- package/dist/services/quality/index.d.ts +12 -0
- package/dist/services/quality/index.d.ts.map +1 -0
- package/dist/services/quality/index.js +12 -0
- package/dist/services/quality/index.js.map +1 -0
- package/dist/services/quality/pattern-matcher.service.d.ts +195 -0
- package/dist/services/quality/pattern-matcher.service.d.ts.map +1 -0
- package/dist/services/quality/pattern-matcher.service.js +630 -0
- package/dist/services/quality/pattern-matcher.service.js.map +1 -0
- package/dist/services/quality/playwright-axe.service.d.ts +84 -0
- package/dist/services/quality/playwright-axe.service.d.ts.map +1 -0
- package/dist/services/quality/playwright-axe.service.js +267 -0
- package/dist/services/quality/playwright-axe.service.js.map +1 -0
- package/dist/services/quality/quality-evaluate.service.interface.d.ts +216 -0
- package/dist/services/quality/quality-evaluate.service.interface.d.ts.map +1 -0
- package/dist/services/quality/quality-evaluate.service.interface.js +5 -0
- package/dist/services/quality/quality-evaluate.service.interface.js.map +1 -0
- package/dist/services/quality/visual-design-analyzer.service.d.ts +72 -0
- package/dist/services/quality/visual-design-analyzer.service.d.ts.map +1 -0
- package/dist/services/quality/visual-design-analyzer.service.js +762 -0
- package/dist/services/quality/visual-design-analyzer.service.js.map +1 -0
- package/dist/services/quality-evaluate-service-export.d.ts +122 -0
- package/dist/services/quality-evaluate-service-export.d.ts.map +1 -0
- package/dist/services/quality-evaluate-service-export.js +138 -0
- package/dist/services/quality-evaluate-service-export.js.map +1 -0
- package/dist/services/quality-search.service.d.ts +20 -0
- package/dist/services/quality-search.service.d.ts.map +1 -0
- package/dist/services/quality-search.service.js +260 -0
- package/dist/services/quality-search.service.js.map +1 -0
- package/dist/services/query-analyzer.d.ts +107 -0
- package/dist/services/query-analyzer.d.ts.map +1 -0
- package/dist/services/query-analyzer.js +222 -0
- package/dist/services/query-analyzer.js.map +1 -0
- package/dist/services/query-context-analyzer.d.ts +85 -0
- package/dist/services/query-context-analyzer.d.ts.map +1 -0
- package/dist/services/query-context-analyzer.js +728 -0
- package/dist/services/query-context-analyzer.js.map +1 -0
- package/dist/services/queue-cleanup.service.d.ts +102 -0
- package/dist/services/queue-cleanup.service.d.ts.map +1 -0
- package/dist/services/queue-cleanup.service.js +259 -0
- package/dist/services/queue-cleanup.service.js.map +1 -0
- package/dist/services/responsive/difference-detector.service.d.ts +77 -0
- package/dist/services/responsive/difference-detector.service.d.ts.map +1 -0
- package/dist/services/responsive/difference-detector.service.js +525 -0
- package/dist/services/responsive/difference-detector.service.js.map +1 -0
- package/dist/services/responsive/index.d.ts +16 -0
- package/dist/services/responsive/index.d.ts.map +1 -0
- package/dist/services/responsive/index.js +60 -0
- package/dist/services/responsive/index.js.map +1 -0
- package/dist/services/responsive/multi-viewport-capture.service.d.ts +103 -0
- package/dist/services/responsive/multi-viewport-capture.service.d.ts.map +1 -0
- package/dist/services/responsive/multi-viewport-capture.service.js +841 -0
- package/dist/services/responsive/multi-viewport-capture.service.js.map +1 -0
- package/dist/services/responsive/responsive-analysis-embedding.service.d.ts +114 -0
- package/dist/services/responsive/responsive-analysis-embedding.service.d.ts.map +1 -0
- package/dist/services/responsive/responsive-analysis-embedding.service.js +232 -0
- package/dist/services/responsive/responsive-analysis-embedding.service.js.map +1 -0
- package/dist/services/responsive/responsive-analysis.service.d.ts +37 -0
- package/dist/services/responsive/responsive-analysis.service.d.ts.map +1 -0
- package/dist/services/responsive/responsive-analysis.service.js +262 -0
- package/dist/services/responsive/responsive-analysis.service.js.map +1 -0
- package/dist/services/responsive/responsive-persistence.service.d.ts +45 -0
- package/dist/services/responsive/responsive-persistence.service.d.ts.map +1 -0
- package/dist/services/responsive/responsive-persistence.service.js +102 -0
- package/dist/services/responsive/responsive-persistence.service.js.map +1 -0
- package/dist/services/responsive/responsive-quality-evaluator.service.d.ts +80 -0
- package/dist/services/responsive/responsive-quality-evaluator.service.d.ts.map +1 -0
- package/dist/services/responsive/responsive-quality-evaluator.service.js +448 -0
- package/dist/services/responsive/responsive-quality-evaluator.service.js.map +1 -0
- package/dist/services/responsive/shared-browser-manager.d.ts +65 -0
- package/dist/services/responsive/shared-browser-manager.d.ts.map +1 -0
- package/dist/services/responsive/shared-browser-manager.js +112 -0
- package/dist/services/responsive/shared-browser-manager.js.map +1 -0
- package/dist/services/responsive/types.d.ts +367 -0
- package/dist/services/responsive/types.d.ts.map +1 -0
- package/dist/services/responsive/types.js +5 -0
- package/dist/services/responsive/types.js.map +1 -0
- package/dist/services/responsive/viewport-diff.service.d.ts +49 -0
- package/dist/services/responsive/viewport-diff.service.d.ts.map +1 -0
- package/dist/services/responsive/viewport-diff.service.js +178 -0
- package/dist/services/responsive/viewport-diff.service.js.map +1 -0
- package/dist/services/responsive-search.service.d.ts +52 -0
- package/dist/services/responsive-search.service.d.ts.map +1 -0
- package/dist/services/responsive-search.service.js +136 -0
- package/dist/services/responsive-search.service.js.map +1 -0
- package/dist/services/search/mood-brandtone-search.service.d.ts +99 -0
- package/dist/services/search/mood-brandtone-search.service.d.ts.map +1 -0
- package/dist/services/search/mood-brandtone-search.service.js +310 -0
- package/dist/services/search/mood-brandtone-search.service.js.map +1 -0
- package/dist/services/search-performance.service.d.ts +118 -0
- package/dist/services/search-performance.service.d.ts.map +1 -0
- package/dist/services/search-performance.service.js +181 -0
- package/dist/services/search-performance.service.js.map +1 -0
- package/dist/services/section-screenshot.service.d.ts +163 -0
- package/dist/services/section-screenshot.service.d.ts.map +1 -0
- package/dist/services/section-screenshot.service.js +363 -0
- package/dist/services/section-screenshot.service.js.map +1 -0
- package/dist/services/service-client.d.ts +181 -0
- package/dist/services/service-client.d.ts.map +1 -0
- package/dist/services/service-client.js +450 -0
- package/dist/services/service-client.js.map +1 -0
- package/dist/services/service-initializer.d.ts +174 -0
- package/dist/services/service-initializer.d.ts.map +1 -0
- package/dist/services/service-initializer.js +942 -0
- package/dist/services/service-initializer.js.map +1 -0
- package/dist/services/storage/index.d.ts +7 -0
- package/dist/services/storage/index.d.ts.map +1 -0
- package/dist/services/storage/index.js +14 -0
- package/dist/services/storage/index.js.map +1 -0
- package/dist/services/storage/local-storage.provider.d.ts +140 -0
- package/dist/services/storage/local-storage.provider.d.ts.map +1 -0
- package/dist/services/storage/local-storage.provider.js +333 -0
- package/dist/services/storage/local-storage.provider.js.map +1 -0
- package/dist/services/style/index.d.ts +7 -0
- package/dist/services/style/index.d.ts.map +1 -0
- package/dist/services/style/index.js +25 -0
- package/dist/services/style/index.js.map +1 -0
- package/dist/services/style/palette-service.d.ts +212 -0
- package/dist/services/style/palette-service.d.ts.map +1 -0
- package/dist/services/style/palette-service.js +423 -0
- package/dist/services/style/palette-service.js.map +1 -0
- package/dist/services/style/prisma-palette-repository.d.ts +35 -0
- package/dist/services/style/prisma-palette-repository.d.ts.map +1 -0
- package/dist/services/style/prisma-palette-repository.js +165 -0
- package/dist/services/style/prisma-palette-repository.js.map +1 -0
- package/dist/services/vision/brandtone.analyzer.d.ts +104 -0
- package/dist/services/vision/brandtone.analyzer.d.ts.map +1 -0
- package/dist/services/vision/brandtone.analyzer.js +279 -0
- package/dist/services/vision/brandtone.analyzer.js.map +1 -0
- package/dist/services/vision/hardware-detector.d.ts +166 -0
- package/dist/services/vision/hardware-detector.d.ts.map +1 -0
- package/dist/services/vision/hardware-detector.js +330 -0
- package/dist/services/vision/hardware-detector.js.map +1 -0
- package/dist/services/vision/image-optimizer.d.ts +152 -0
- package/dist/services/vision/image-optimizer.d.ts.map +1 -0
- package/dist/services/vision/image-optimizer.js +266 -0
- package/dist/services/vision/image-optimizer.js.map +1 -0
- package/dist/services/vision/index.d.ts +26 -0
- package/dist/services/vision/index.d.ts.map +1 -0
- package/dist/services/vision/index.js +80 -0
- package/dist/services/vision/index.js.map +1 -0
- package/dist/services/vision/llama-vision-adapter.d.ts +178 -0
- package/dist/services/vision/llama-vision-adapter.d.ts.map +1 -0
- package/dist/services/vision/llama-vision-adapter.js +307 -0
- package/dist/services/vision/llama-vision-adapter.js.map +1 -0
- package/dist/services/vision/mcp-progress-adapter.d.ts +128 -0
- package/dist/services/vision/mcp-progress-adapter.d.ts.map +1 -0
- package/dist/services/vision/mcp-progress-adapter.js +150 -0
- package/dist/services/vision/mcp-progress-adapter.js.map +1 -0
- package/dist/services/vision/mood.analyzer.d.ts +74 -0
- package/dist/services/vision/mood.analyzer.d.ts.map +1 -0
- package/dist/services/vision/mood.analyzer.js +258 -0
- package/dist/services/vision/mood.analyzer.js.map +1 -0
- package/dist/services/vision/ollama-readiness-probe.d.ts +87 -0
- package/dist/services/vision/ollama-readiness-probe.d.ts.map +1 -0
- package/dist/services/vision/ollama-readiness-probe.js +211 -0
- package/dist/services/vision/ollama-readiness-probe.js.map +1 -0
- package/dist/services/vision/ollama-vision-client.d.ts +129 -0
- package/dist/services/vision/ollama-vision-client.d.ts.map +1 -0
- package/dist/services/vision/ollama-vision-client.js +478 -0
- package/dist/services/vision/ollama-vision-client.js.map +1 -0
- package/dist/services/vision/progress-reporter.d.ts +140 -0
- package/dist/services/vision/progress-reporter.d.ts.map +1 -0
- package/dist/services/vision/progress-reporter.js +306 -0
- package/dist/services/vision/progress-reporter.js.map +1 -0
- package/dist/services/vision/scroll-vision-capture.service.d.ts +117 -0
- package/dist/services/vision/scroll-vision-capture.service.d.ts.map +1 -0
- package/dist/services/vision/scroll-vision-capture.service.js +266 -0
- package/dist/services/vision/scroll-vision-capture.service.js.map +1 -0
- package/dist/services/vision/scroll-vision-persistence.service.d.ts +48 -0
- package/dist/services/vision/scroll-vision-persistence.service.d.ts.map +1 -0
- package/dist/services/vision/scroll-vision-persistence.service.js +161 -0
- package/dist/services/vision/scroll-vision-persistence.service.js.map +1 -0
- package/dist/services/vision/scroll-vision.analyzer.d.ts +90 -0
- package/dist/services/vision/scroll-vision.analyzer.d.ts.map +1 -0
- package/dist/services/vision/scroll-vision.analyzer.js +280 -0
- package/dist/services/vision/scroll-vision.analyzer.js.map +1 -0
- package/dist/services/vision/theme.analyzer.d.ts +108 -0
- package/dist/services/vision/theme.analyzer.d.ts.map +1 -0
- package/dist/services/vision/theme.analyzer.js +315 -0
- package/dist/services/vision/theme.analyzer.js.map +1 -0
- package/dist/services/vision/timeout-calculator.d.ts +85 -0
- package/dist/services/vision/timeout-calculator.d.ts.map +1 -0
- package/dist/services/vision/timeout-calculator.js +142 -0
- package/dist/services/vision/timeout-calculator.js.map +1 -0
- package/dist/services/vision/vision-fallback.service.d.ts +121 -0
- package/dist/services/vision/vision-fallback.service.d.ts.map +1 -0
- package/dist/services/vision/vision-fallback.service.js +253 -0
- package/dist/services/vision/vision-fallback.service.js.map +1 -0
- package/dist/services/vision/vision.cache.d.ts +124 -0
- package/dist/services/vision/vision.cache.d.ts.map +1 -0
- package/dist/services/vision/vision.cache.js +261 -0
- package/dist/services/vision/vision.cache.js.map +1 -0
- package/dist/services/vision/vision.errors.d.ts +104 -0
- package/dist/services/vision/vision.errors.d.ts.map +1 -0
- package/dist/services/vision/vision.errors.js +133 -0
- package/dist/services/vision/vision.errors.js.map +1 -0
- package/dist/services/vision/vision.prompts.d.ts +47 -0
- package/dist/services/vision/vision.prompts.d.ts.map +1 -0
- package/dist/services/vision/vision.prompts.js +272 -0
- package/dist/services/vision/vision.prompts.js.map +1 -0
- package/dist/services/vision/vram-utils.d.ts +22 -0
- package/dist/services/vision/vram-utils.d.ts.map +1 -0
- package/dist/services/vision/vram-utils.js +57 -0
- package/dist/services/vision/vram-utils.js.map +1 -0
- package/dist/services/vision-adapter/index.d.ts +18 -0
- package/dist/services/vision-adapter/index.d.ts.map +1 -0
- package/dist/services/vision-adapter/index.js +31 -0
- package/dist/services/vision-adapter/index.js.map +1 -0
- package/dist/services/vision-adapter/interface.d.ts +1434 -0
- package/dist/services/vision-adapter/interface.d.ts.map +1 -0
- package/dist/services/vision-adapter/interface.js +326 -0
- package/dist/services/vision-adapter/interface.js.map +1 -0
- package/dist/services/vision-adapter/llama-vision.adapter.d.ts +373 -0
- package/dist/services/vision-adapter/llama-vision.adapter.d.ts.map +1 -0
- package/dist/services/vision-adapter/llama-vision.adapter.js +1751 -0
- package/dist/services/vision-adapter/llama-vision.adapter.js.map +1 -0
- package/dist/services/vision-adapter/llama-vision.prompts.d.ts +63 -0
- package/dist/services/vision-adapter/llama-vision.prompts.d.ts.map +1 -0
- package/dist/services/vision-adapter/llama-vision.prompts.js +234 -0
- package/dist/services/vision-adapter/llama-vision.prompts.js.map +1 -0
- package/dist/services/vision-adapter/llama-vision.types.d.ts +68 -0
- package/dist/services/vision-adapter/llama-vision.types.d.ts.map +1 -0
- package/dist/services/vision-adapter/llama-vision.types.js +21 -0
- package/dist/services/vision-adapter/llama-vision.types.js.map +1 -0
- package/dist/services/vision-adapter/local.adapter.d.ts +185 -0
- package/dist/services/vision-adapter/local.adapter.d.ts.map +1 -0
- package/dist/services/vision-adapter/local.adapter.js +835 -0
- package/dist/services/vision-adapter/local.adapter.js.map +1 -0
- package/dist/services/vision-adapter/mock.adapter.d.ts +174 -0
- package/dist/services/vision-adapter/mock.adapter.d.ts.map +1 -0
- package/dist/services/vision-adapter/mock.adapter.js +812 -0
- package/dist/services/vision-adapter/mock.adapter.js.map +1 -0
- package/dist/services/vision-embedding-search.service.d.ts +205 -0
- package/dist/services/vision-embedding-search.service.d.ts.map +1 -0
- package/dist/services/vision-embedding-search.service.js +742 -0
- package/dist/services/vision-embedding-search.service.js.map +1 -0
- package/dist/services/vision-embedding.service.d.ts +150 -0
- package/dist/services/vision-embedding.service.d.ts.map +1 -0
- package/dist/services/vision-embedding.service.js +461 -0
- package/dist/services/vision-embedding.service.js.map +1 -0
- package/dist/services/visual/css-variable-extractor.service.d.ts +97 -0
- package/dist/services/visual/css-variable-extractor.service.d.ts.map +1 -0
- package/dist/services/visual/css-variable-extractor.service.js +460 -0
- package/dist/services/visual/css-variable-extractor.service.js.map +1 -0
- package/dist/services/visual/typography-extractor.service.d.ts +137 -0
- package/dist/services/visual/typography-extractor.service.d.ts.map +1 -0
- package/dist/services/visual/typography-extractor.service.js +539 -0
- package/dist/services/visual/typography-extractor.service.js.map +1 -0
- package/dist/services/visual-extractor/color-extractor.service.d.ts +55 -0
- package/dist/services/visual-extractor/color-extractor.service.d.ts.map +1 -0
- package/dist/services/visual-extractor/color-extractor.service.js +281 -0
- package/dist/services/visual-extractor/color-extractor.service.js.map +1 -0
- package/dist/services/visual-extractor/density-calculator.service.d.ts +85 -0
- package/dist/services/visual-extractor/density-calculator.service.d.ts.map +1 -0
- package/dist/services/visual-extractor/density-calculator.service.js +369 -0
- package/dist/services/visual-extractor/density-calculator.service.js.map +1 -0
- package/dist/services/visual-extractor/gradient-detector.service.d.ts +134 -0
- package/dist/services/visual-extractor/gradient-detector.service.d.ts.map +1 -0
- package/dist/services/visual-extractor/gradient-detector.service.js +1172 -0
- package/dist/services/visual-extractor/gradient-detector.service.js.map +1 -0
- package/dist/services/visual-extractor/image-utils.d.ts +135 -0
- package/dist/services/visual-extractor/image-utils.d.ts.map +1 -0
- package/dist/services/visual-extractor/image-utils.js +305 -0
- package/dist/services/visual-extractor/image-utils.js.map +1 -0
- package/dist/services/visual-extractor/pixel-theme-detector.service.d.ts +58 -0
- package/dist/services/visual-extractor/pixel-theme-detector.service.d.ts.map +1 -0
- package/dist/services/visual-extractor/pixel-theme-detector.service.js +358 -0
- package/dist/services/visual-extractor/pixel-theme-detector.service.js.map +1 -0
- package/dist/services/visual-extractor/theme-detector.service.d.ts +101 -0
- package/dist/services/visual-extractor/theme-detector.service.d.ts.map +1 -0
- package/dist/services/visual-extractor/theme-detector.service.js +463 -0
- package/dist/services/visual-extractor/theme-detector.service.js.map +1 -0
- package/dist/services/visual-extractor/visual-decoration-detector.service.d.ts +43 -0
- package/dist/services/visual-extractor/visual-decoration-detector.service.d.ts.map +1 -0
- package/dist/services/visual-extractor/visual-decoration-detector.service.js +628 -0
- package/dist/services/visual-extractor/visual-decoration-detector.service.js.map +1 -0
- package/dist/services/visual-extractor/visual-feature-merger.service.d.ts +230 -0
- package/dist/services/visual-extractor/visual-feature-merger.service.d.ts.map +1 -0
- package/dist/services/visual-extractor/visual-feature-merger.service.js +482 -0
- package/dist/services/visual-extractor/visual-feature-merger.service.js.map +1 -0
- package/dist/services/web-page.service.d.ts +80 -0
- package/dist/services/web-page.service.d.ts.map +1 -0
- package/dist/services/web-page.service.js +211 -0
- package/dist/services/web-page.service.js.map +1 -0
- package/dist/services/worker-constants.d.ts +40 -0
- package/dist/services/worker-constants.d.ts.map +1 -0
- package/dist/services/worker-constants.js +51 -0
- package/dist/services/worker-constants.js.map +1 -0
- package/dist/services/worker-db-save.service.d.ts +311 -0
- package/dist/services/worker-db-save.service.d.ts.map +1 -0
- package/dist/services/worker-db-save.service.js +771 -0
- package/dist/services/worker-db-save.service.js.map +1 -0
- package/dist/services/worker-memory-monitor.service.d.ts +24 -0
- package/dist/services/worker-memory-monitor.service.d.ts.map +1 -0
- package/dist/services/worker-memory-monitor.service.js +105 -0
- package/dist/services/worker-memory-monitor.service.js.map +1 -0
- package/dist/services/worker-memory-profile.d.ts +65 -0
- package/dist/services/worker-memory-profile.d.ts.map +1 -0
- package/dist/services/worker-memory-profile.js +225 -0
- package/dist/services/worker-memory-profile.js.map +1 -0
- package/dist/services/worker-stall-recovery.service.d.ts +166 -0
- package/dist/services/worker-stall-recovery.service.d.ts.map +1 -0
- package/dist/services/worker-stall-recovery.service.js +335 -0
- package/dist/services/worker-stall-recovery.service.js.map +1 -0
- package/dist/services/worker-supervisor.service.d.ts +145 -0
- package/dist/services/worker-supervisor.service.d.ts.map +1 -0
- package/dist/services/worker-supervisor.service.js +635 -0
- package/dist/services/worker-supervisor.service.js.map +1 -0
- package/dist/tools/background/schemas.d.ts +85 -0
- package/dist/tools/background/schemas.d.ts.map +1 -0
- package/dist/tools/background/schemas.js +79 -0
- package/dist/tools/background/schemas.js.map +1 -0
- package/dist/tools/background/search.tool.d.ts +179 -0
- package/dist/tools/background/search.tool.d.ts.map +1 -0
- package/dist/tools/background/search.tool.js +318 -0
- package/dist/tools/background/search.tool.js.map +1 -0
- package/dist/tools/brief/index.d.ts +10 -0
- package/dist/tools/brief/index.d.ts.map +1 -0
- package/dist/tools/brief/index.js +54 -0
- package/dist/tools/brief/index.js.map +1 -0
- package/dist/tools/brief/schemas.d.ts +750 -0
- package/dist/tools/brief/schemas.d.ts.map +1 -0
- package/dist/tools/brief/schemas.js +212 -0
- package/dist/tools/brief/schemas.js.map +1 -0
- package/dist/tools/brief/validate.handler.d.ts +149 -0
- package/dist/tools/brief/validate.handler.d.ts.map +1 -0
- package/dist/tools/brief/validate.handler.js +247 -0
- package/dist/tools/brief/validate.handler.js.map +1 -0
- package/dist/tools/brief/validate.service.d.ts +100 -0
- package/dist/tools/brief/validate.service.d.ts.map +1 -0
- package/dist/tools/brief/validate.service.js +296 -0
- package/dist/tools/brief/validate.service.js.map +1 -0
- package/dist/tools/common/error-codes.d.ts +35 -0
- package/dist/tools/common/error-codes.d.ts.map +1 -0
- package/dist/tools/common/error-codes.js +92 -0
- package/dist/tools/common/error-codes.js.map +1 -0
- package/dist/tools/common/index.d.ts +7 -0
- package/dist/tools/common/index.d.ts.map +1 -0
- package/dist/tools/common/index.js +20 -0
- package/dist/tools/common/index.js.map +1 -0
- package/dist/tools/index.d.ts +2756 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +506 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/layout/batch-ingest.tool.d.ts +82 -0
- package/dist/tools/layout/batch-ingest.tool.d.ts.map +1 -0
- package/dist/tools/layout/batch-ingest.tool.js +410 -0
- package/dist/tools/layout/batch-ingest.tool.js.map +1 -0
- package/dist/tools/layout/index.d.ts +13 -0
- package/dist/tools/layout/index.d.ts.map +1 -0
- package/dist/tools/layout/index.js +62 -0
- package/dist/tools/layout/index.js.map +1 -0
- package/dist/tools/layout/ingest.tool.d.ts +338 -0
- package/dist/tools/layout/ingest.tool.d.ts.map +1 -0
- package/dist/tools/layout/ingest.tool.js +1308 -0
- package/dist/tools/layout/ingest.tool.js.map +1 -0
- package/dist/tools/layout/inspect/index.d.ts +11 -0
- package/dist/tools/layout/inspect/index.d.ts.map +1 -0
- package/dist/tools/layout/inspect/index.js +55 -0
- package/dist/tools/layout/inspect/index.js.map +1 -0
- package/dist/tools/layout/inspect/inspect.schemas.d.ts +4130 -0
- package/dist/tools/layout/inspect/inspect.schemas.d.ts.map +1 -0
- package/dist/tools/layout/inspect/inspect.schemas.js +400 -0
- package/dist/tools/layout/inspect/inspect.schemas.js.map +1 -0
- package/dist/tools/layout/inspect/inspect.tool.d.ts +164 -0
- package/dist/tools/layout/inspect/inspect.tool.d.ts.map +1 -0
- package/dist/tools/layout/inspect/inspect.tool.js +738 -0
- package/dist/tools/layout/inspect/inspect.tool.js.map +1 -0
- package/dist/tools/layout/inspect/inspect.utils.d.ts +200 -0
- package/dist/tools/layout/inspect/inspect.utils.d.ts.map +1 -0
- package/dist/tools/layout/inspect/inspect.utils.js +1104 -0
- package/dist/tools/layout/inspect/inspect.utils.js.map +1 -0
- package/dist/tools/layout/inspect/visual-extractors.schemas.d.ts +3372 -0
- package/dist/tools/layout/inspect/visual-extractors.schemas.d.ts.map +1 -0
- package/dist/tools/layout/inspect/visual-extractors.schemas.js +558 -0
- package/dist/tools/layout/inspect/visual-extractors.schemas.js.map +1 -0
- package/dist/tools/layout/inspect/visual-extractors.utils.d.ts +86 -0
- package/dist/tools/layout/inspect/visual-extractors.utils.d.ts.map +1 -0
- package/dist/tools/layout/inspect/visual-extractors.utils.js +231 -0
- package/dist/tools/layout/inspect/visual-extractors.utils.js.map +1 -0
- package/dist/tools/layout/schemas.d.ts +11074 -0
- package/dist/tools/layout/schemas.d.ts.map +1 -0
- package/dist/tools/layout/schemas.js +1497 -0
- package/dist/tools/layout/schemas.js.map +1 -0
- package/dist/tools/layout/search.tool.d.ts +470 -0
- package/dist/tools/layout/search.tool.d.ts.map +1 -0
- package/dist/tools/layout/search.tool.js +1582 -0
- package/dist/tools/layout/search.tool.js.map +1 -0
- package/dist/tools/layout/to-code.tool.d.ts +280 -0
- package/dist/tools/layout/to-code.tool.d.ts.map +1 -0
- package/dist/tools/layout/to-code.tool.js +317 -0
- package/dist/tools/layout/to-code.tool.js.map +1 -0
- package/dist/tools/motion/analyze-frames.handler.d.ts +157 -0
- package/dist/tools/motion/analyze-frames.handler.d.ts.map +1 -0
- package/dist/tools/motion/analyze-frames.handler.js +263 -0
- package/dist/tools/motion/analyze-frames.handler.js.map +1 -0
- package/dist/tools/motion/analyze-frames.schema.d.ts +4599 -0
- package/dist/tools/motion/analyze-frames.schema.d.ts.map +1 -0
- package/dist/tools/motion/analyze-frames.schema.js +420 -0
- package/dist/tools/motion/analyze-frames.schema.js.map +1 -0
- package/dist/tools/motion/css-mode-handler.d.ts +70 -0
- package/dist/tools/motion/css-mode-handler.d.ts.map +1 -0
- package/dist/tools/motion/css-mode-handler.js +754 -0
- package/dist/tools/motion/css-mode-handler.js.map +1 -0
- package/dist/tools/motion/detect.schemas.d.ts +14288 -0
- package/dist/tools/motion/detect.schemas.d.ts.map +1 -0
- package/dist/tools/motion/detect.schemas.js +1715 -0
- package/dist/tools/motion/detect.schemas.js.map +1 -0
- package/dist/tools/motion/detect.tool.d.ts +195 -0
- package/dist/tools/motion/detect.tool.d.ts.map +1 -0
- package/dist/tools/motion/detect.tool.js +1421 -0
- package/dist/tools/motion/detect.tool.js.map +1 -0
- package/dist/tools/motion/detection-modes.d.ts +72 -0
- package/dist/tools/motion/detection-modes.d.ts.map +1 -0
- package/dist/tools/motion/detection-modes.js +353 -0
- package/dist/tools/motion/detection-modes.js.map +1 -0
- package/dist/tools/motion/di-factories.d.ts +341 -0
- package/dist/tools/motion/di-factories.d.ts.map +1 -0
- package/dist/tools/motion/di-factories.js +376 -0
- package/dist/tools/motion/di-factories.js.map +1 -0
- package/dist/tools/motion/index.d.ts +12 -0
- package/dist/tools/motion/index.d.ts.map +1 -0
- package/dist/tools/motion/index.js +146 -0
- package/dist/tools/motion/index.js.map +1 -0
- package/dist/tools/motion/pattern-converter.d.ts +49 -0
- package/dist/tools/motion/pattern-converter.d.ts.map +1 -0
- package/dist/tools/motion/pattern-converter.js +493 -0
- package/dist/tools/motion/pattern-converter.js.map +1 -0
- package/dist/tools/motion/schemas.d.ts +10 -0
- package/dist/tools/motion/schemas.d.ts.map +1 -0
- package/dist/tools/motion/schemas.js +28 -0
- package/dist/tools/motion/schemas.js.map +1 -0
- package/dist/tools/motion/search.schemas.d.ts +7500 -0
- package/dist/tools/motion/search.schemas.d.ts.map +1 -0
- package/dist/tools/motion/search.schemas.js +596 -0
- package/dist/tools/motion/search.schemas.js.map +1 -0
- package/dist/tools/motion/search.tool.d.ts +416 -0
- package/dist/tools/motion/search.tool.d.ts.map +1 -0
- package/dist/tools/motion/search.tool.js +2088 -0
- package/dist/tools/motion/search.tool.js.map +1 -0
- package/dist/tools/motion/shared.schemas.d.ts +994 -0
- package/dist/tools/motion/shared.schemas.d.ts.map +1 -0
- package/dist/tools/motion/shared.schemas.js +354 -0
- package/dist/tools/motion/shared.schemas.js.map +1 -0
- package/dist/tools/narrative/analyze.tool.d.ts +96 -0
- package/dist/tools/narrative/analyze.tool.d.ts.map +1 -0
- package/dist/tools/narrative/analyze.tool.js +396 -0
- package/dist/tools/narrative/analyze.tool.js.map +1 -0
- package/dist/tools/narrative/index.d.ts +15 -0
- package/dist/tools/narrative/index.d.ts.map +1 -0
- package/dist/tools/narrative/index.js +83 -0
- package/dist/tools/narrative/index.js.map +1 -0
- package/dist/tools/narrative/schemas.d.ts +5553 -0
- package/dist/tools/narrative/schemas.d.ts.map +1 -0
- package/dist/tools/narrative/schemas.js +747 -0
- package/dist/tools/narrative/schemas.js.map +1 -0
- package/dist/tools/narrative/search.tool.d.ts +160 -0
- package/dist/tools/narrative/search.tool.d.ts.map +1 -0
- package/dist/tools/narrative/search.tool.js +434 -0
- package/dist/tools/narrative/search.tool.js.map +1 -0
- package/dist/tools/page/analyze.tool.d.ts +502 -0
- package/dist/tools/page/analyze.tool.d.ts.map +1 -0
- package/dist/tools/page/analyze.tool.js +875 -0
- package/dist/tools/page/analyze.tool.js.map +1 -0
- package/dist/tools/page/get-job-status.tool.d.ts +43 -0
- package/dist/tools/page/get-job-status.tool.d.ts.map +1 -0
- package/dist/tools/page/get-job-status.tool.js +178 -0
- package/dist/tools/page/get-job-status.tool.js.map +1 -0
- package/dist/tools/page/handlers/db-handler.d.ts +155 -0
- package/dist/tools/page/handlers/db-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/db-handler.js +368 -0
- package/dist/tools/page/handlers/db-handler.js.map +1 -0
- package/dist/tools/page/handlers/embedding-handler.d.ts +200 -0
- package/dist/tools/page/handlers/embedding-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/embedding-handler.js +541 -0
- package/dist/tools/page/handlers/embedding-handler.js.map +1 -0
- package/dist/tools/page/handlers/execution-status-tracker.d.ts +146 -0
- package/dist/tools/page/handlers/execution-status-tracker.d.ts.map +1 -0
- package/dist/tools/page/handlers/execution-status-tracker.js +348 -0
- package/dist/tools/page/handlers/execution-status-tracker.js.map +1 -0
- package/dist/tools/page/handlers/js-animation-handler.d.ts +197 -0
- package/dist/tools/page/handlers/js-animation-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/js-animation-handler.js +952 -0
- package/dist/tools/page/handlers/js-animation-handler.js.map +1 -0
- package/dist/tools/page/handlers/layout-handler.d.ts +31 -0
- package/dist/tools/page/handlers/layout-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/layout-handler.js +1181 -0
- package/dist/tools/page/handlers/layout-handler.js.map +1 -0
- package/dist/tools/page/handlers/motion-handler.d.ts +31 -0
- package/dist/tools/page/handlers/motion-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/motion-handler.js +940 -0
- package/dist/tools/page/handlers/motion-handler.js.map +1 -0
- package/dist/tools/page/handlers/narrative-handler.d.ts +23 -0
- package/dist/tools/page/handlers/narrative-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/narrative-handler.js +279 -0
- package/dist/tools/page/handlers/narrative-handler.js.map +1 -0
- package/dist/tools/page/handlers/phased-db-handler.d.ts +83 -0
- package/dist/tools/page/handlers/phased-db-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/phased-db-handler.js +120 -0
- package/dist/tools/page/handlers/phased-db-handler.js.map +1 -0
- package/dist/tools/page/handlers/phased-executor.d.ts +123 -0
- package/dist/tools/page/handlers/phased-executor.d.ts.map +1 -0
- package/dist/tools/page/handlers/phased-executor.js +205 -0
- package/dist/tools/page/handlers/phased-executor.js.map +1 -0
- package/dist/tools/page/handlers/quality-handler.d.ts +9 -0
- package/dist/tools/page/handlers/quality-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/quality-handler.js +100 -0
- package/dist/tools/page/handlers/quality-handler.js.map +1 -0
- package/dist/tools/page/handlers/result-builder.d.ts +105 -0
- package/dist/tools/page/handlers/result-builder.d.ts.map +1 -0
- package/dist/tools/page/handlers/result-builder.js +447 -0
- package/dist/tools/page/handlers/result-builder.js.map +1 -0
- package/dist/tools/page/handlers/retry-strategy.d.ts +106 -0
- package/dist/tools/page/handlers/retry-strategy.d.ts.map +1 -0
- package/dist/tools/page/handlers/retry-strategy.js +169 -0
- package/dist/tools/page/handlers/retry-strategy.js.map +1 -0
- package/dist/tools/page/handlers/sync-processing.d.ts +26 -0
- package/dist/tools/page/handlers/sync-processing.d.ts.map +1 -0
- package/dist/tools/page/handlers/sync-processing.js +1659 -0
- package/dist/tools/page/handlers/sync-processing.js.map +1 -0
- package/dist/tools/page/handlers/timeout-utils.d.ts +278 -0
- package/dist/tools/page/handlers/timeout-utils.d.ts.map +1 -0
- package/dist/tools/page/handlers/timeout-utils.js +600 -0
- package/dist/tools/page/handlers/timeout-utils.js.map +1 -0
- package/dist/tools/page/handlers/types.d.ts +1229 -0
- package/dist/tools/page/handlers/types.d.ts.map +1 -0
- package/dist/tools/page/handlers/types.js +21 -0
- package/dist/tools/page/handlers/types.js.map +1 -0
- package/dist/tools/page/handlers/video-handler.d.ts +11 -0
- package/dist/tools/page/handlers/video-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/video-handler.js +235 -0
- package/dist/tools/page/handlers/video-handler.js.map +1 -0
- package/dist/tools/page/handlers/webgl-animation-handler.d.ts +48 -0
- package/dist/tools/page/handlers/webgl-animation-handler.d.ts.map +1 -0
- package/dist/tools/page/handlers/webgl-animation-handler.js +237 -0
- package/dist/tools/page/handlers/webgl-animation-handler.js.map +1 -0
- package/dist/tools/page/handlers/webgl-detector.d.ts +184 -0
- package/dist/tools/page/handlers/webgl-detector.d.ts.map +1 -0
- package/dist/tools/page/handlers/webgl-detector.js +680 -0
- package/dist/tools/page/handlers/webgl-detector.js.map +1 -0
- package/dist/tools/page/handlers/webgl-domains.d.ts +133 -0
- package/dist/tools/page/handlers/webgl-domains.d.ts.map +1 -0
- package/dist/tools/page/handlers/webgl-domains.js +420 -0
- package/dist/tools/page/handlers/webgl-domains.js.map +1 -0
- package/dist/tools/page/handlers/webgl-pre-detector.d.ts +100 -0
- package/dist/tools/page/handlers/webgl-pre-detector.d.ts.map +1 -0
- package/dist/tools/page/handlers/webgl-pre-detector.js +248 -0
- package/dist/tools/page/handlers/webgl-pre-detector.js.map +1 -0
- package/dist/tools/page/index.d.ts +10 -0
- package/dist/tools/page/index.d.ts.map +1 -0
- package/dist/tools/page/index.js +84 -0
- package/dist/tools/page/index.js.map +1 -0
- package/dist/tools/page/input.schemas.d.ts +2223 -0
- package/dist/tools/page/input.schemas.d.ts.map +1 -0
- package/dist/tools/page/input.schemas.js +853 -0
- package/dist/tools/page/input.schemas.js.map +1 -0
- package/dist/tools/page/output.schemas.d.ts +26026 -0
- package/dist/tools/page/output.schemas.d.ts.map +1 -0
- package/dist/tools/page/output.schemas.js +1414 -0
- package/dist/tools/page/output.schemas.js.map +1 -0
- package/dist/tools/page/schemas.d.ts +10 -0
- package/dist/tools/page/schemas.d.ts.map +1 -0
- package/dist/tools/page/schemas.js +28 -0
- package/dist/tools/page/schemas.js.map +1 -0
- package/dist/tools/page/shared.schemas.d.ts +38 -0
- package/dist/tools/page/shared.schemas.d.ts.map +1 -0
- package/dist/tools/page/shared.schemas.js +69 -0
- package/dist/tools/page/shared.schemas.js.map +1 -0
- package/dist/tools/part/compare.tool.d.ts +106 -0
- package/dist/tools/part/compare.tool.d.ts.map +1 -0
- package/dist/tools/part/compare.tool.js +421 -0
- package/dist/tools/part/compare.tool.js.map +1 -0
- package/dist/tools/part/inspect.tool.d.ts +108 -0
- package/dist/tools/part/inspect.tool.d.ts.map +1 -0
- package/dist/tools/part/inspect.tool.js +279 -0
- package/dist/tools/part/inspect.tool.js.map +1 -0
- package/dist/tools/part/search.tool.d.ts +121 -0
- package/dist/tools/part/search.tool.d.ts.map +1 -0
- package/dist/tools/part/search.tool.js +381 -0
- package/dist/tools/part/search.tool.js.map +1 -0
- package/dist/tools/preference/get.tool.d.ts +74 -0
- package/dist/tools/preference/get.tool.d.ts.map +1 -0
- package/dist/tools/preference/get.tool.js +175 -0
- package/dist/tools/preference/get.tool.js.map +1 -0
- package/dist/tools/preference/hear.tool.d.ts +267 -0
- package/dist/tools/preference/hear.tool.d.ts.map +1 -0
- package/dist/tools/preference/hear.tool.js +268 -0
- package/dist/tools/preference/hear.tool.js.map +1 -0
- package/dist/tools/preference/index.d.ts +16 -0
- package/dist/tools/preference/index.d.ts.map +1 -0
- package/dist/tools/preference/index.js +43 -0
- package/dist/tools/preference/index.js.map +1 -0
- package/dist/tools/preference/reset.tool.d.ts +71 -0
- package/dist/tools/preference/reset.tool.d.ts.map +1 -0
- package/dist/tools/preference/reset.tool.js +205 -0
- package/dist/tools/preference/reset.tool.js.map +1 -0
- package/dist/tools/preference/schemas.d.ts +174 -0
- package/dist/tools/preference/schemas.d.ts.map +1 -0
- package/dist/tools/preference/schemas.js +142 -0
- package/dist/tools/preference/schemas.js.map +1 -0
- package/dist/tools/project-get.d.ts +42 -0
- package/dist/tools/project-get.d.ts.map +1 -0
- package/dist/tools/project-get.js +152 -0
- package/dist/tools/project-get.js.map +1 -0
- package/dist/tools/project-list.d.ts +66 -0
- package/dist/tools/project-list.d.ts.map +1 -0
- package/dist/tools/project-list.js +201 -0
- package/dist/tools/project-list.js.map +1 -0
- package/dist/tools/quality/batch-evaluate.tool.d.ts +101 -0
- package/dist/tools/quality/batch-evaluate.tool.d.ts.map +1 -0
- package/dist/tools/quality/batch-evaluate.tool.js +393 -0
- package/dist/tools/quality/batch-evaluate.tool.js.map +1 -0
- package/dist/tools/quality/evaluate-engine.d.ts +166 -0
- package/dist/tools/quality/evaluate-engine.d.ts.map +1 -0
- package/dist/tools/quality/evaluate-engine.js +1061 -0
- package/dist/tools/quality/evaluate-engine.js.map +1 -0
- package/dist/tools/quality/evaluate.tool.d.ts +286 -0
- package/dist/tools/quality/evaluate.tool.d.ts.map +1 -0
- package/dist/tools/quality/evaluate.tool.js +815 -0
- package/dist/tools/quality/evaluate.tool.js.map +1 -0
- package/dist/tools/quality/get-job-status.tool.d.ts +44 -0
- package/dist/tools/quality/get-job-status.tool.d.ts.map +1 -0
- package/dist/tools/quality/get-job-status.tool.js +291 -0
- package/dist/tools/quality/get-job-status.tool.js.map +1 -0
- package/dist/tools/quality/improvement-utils.d.ts +24 -0
- package/dist/tools/quality/improvement-utils.d.ts.map +1 -0
- package/dist/tools/quality/improvement-utils.js +307 -0
- package/dist/tools/quality/improvement-utils.js.map +1 -0
- package/dist/tools/quality/index.d.ts +11 -0
- package/dist/tools/quality/index.d.ts.map +1 -0
- package/dist/tools/quality/index.js +49 -0
- package/dist/tools/quality/index.js.map +1 -0
- package/dist/tools/quality/schemas.d.ts +14098 -0
- package/dist/tools/quality/schemas.d.ts.map +1 -0
- package/dist/tools/quality/schemas.js +950 -0
- package/dist/tools/quality/schemas.js.map +1 -0
- package/dist/tools/responsive/schemas.d.ts +156 -0
- package/dist/tools/responsive/schemas.d.ts.map +1 -0
- package/dist/tools/responsive/schemas.js +86 -0
- package/dist/tools/responsive/schemas.js.map +1 -0
- package/dist/tools/responsive/search.tool.d.ts +130 -0
- package/dist/tools/responsive/search.tool.d.ts.map +1 -0
- package/dist/tools/responsive/search.tool.js +324 -0
- package/dist/tools/responsive/search.tool.js.map +1 -0
- package/dist/tools/schemas/index.d.ts +10 -0
- package/dist/tools/schemas/index.d.ts.map +1 -0
- package/dist/tools/schemas/index.js +45 -0
- package/dist/tools/schemas/index.js.map +1 -0
- package/dist/tools/schemas/layout-schemas.d.ts +521 -0
- package/dist/tools/schemas/layout-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/layout-schemas.js +281 -0
- package/dist/tools/schemas/layout-schemas.js.map +1 -0
- package/dist/tools/schemas/project-schemas.d.ts +417 -0
- package/dist/tools/schemas/project-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/project-schemas.js +159 -0
- package/dist/tools/schemas/project-schemas.js.map +1 -0
- package/dist/tools/schemas/shared.d.ts +107 -0
- package/dist/tools/schemas/shared.d.ts.map +1 -0
- package/dist/tools/schemas/shared.js +150 -0
- package/dist/tools/schemas/shared.js.map +1 -0
- package/dist/tools/schemas/style-schemas.d.ts +114 -0
- package/dist/tools/schemas/style-schemas.d.ts.map +1 -0
- package/dist/tools/schemas/style-schemas.js +61 -0
- package/dist/tools/schemas/style-schemas.js.map +1 -0
- package/dist/tools/style-get-palette.d.ts +136 -0
- package/dist/tools/style-get-palette.d.ts.map +1 -0
- package/dist/tools/style-get-palette.js +259 -0
- package/dist/tools/style-get-palette.js.map +1 -0
- package/dist/tools/system-health.d.ts +255 -0
- package/dist/tools/system-health.d.ts.map +1 -0
- package/dist/tools/system-health.js +463 -0
- package/dist/tools/system-health.js.map +1 -0
- package/dist/transport.d.ts +29 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +50 -0
- package/dist/transport.js.map +1 -0
- package/dist/types/creative/index.d.ts +8 -0
- package/dist/types/creative/index.d.ts.map +1 -0
- package/dist/types/creative/index.js +5 -0
- package/dist/types/creative/index.js.map +1 -0
- package/dist/types/creative/palette.d.ts +142 -0
- package/dist/types/creative/palette.d.ts.map +1 -0
- package/dist/types/creative/palette.js +5 -0
- package/dist/types/creative/palette.js.map +1 -0
- package/dist/types/reftrix-window.d.ts +124 -0
- package/dist/types/reftrix-window.d.ts.map +1 -0
- package/dist/types/reftrix-window.js +68 -0
- package/dist/types/reftrix-window.js.map +1 -0
- package/dist/utils/actionable-warning.d.ts +170 -0
- package/dist/utils/actionable-warning.d.ts.map +1 -0
- package/dist/utils/actionable-warning.js +818 -0
- package/dist/utils/actionable-warning.js.map +1 -0
- package/dist/utils/blank-image-detector.d.ts +22 -0
- package/dist/utils/blank-image-detector.d.ts.map +1 -0
- package/dist/utils/blank-image-detector.js +133 -0
- package/dist/utils/blank-image-detector.js.map +1 -0
- package/dist/utils/color.d.ts +203 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/color.js +442 -0
- package/dist/utils/color.js.map +1 -0
- package/dist/utils/deprecation-warning.d.ts +43 -0
- package/dist/utils/deprecation-warning.d.ts.map +1 -0
- package/dist/utils/deprecation-warning.js +112 -0
- package/dist/utils/deprecation-warning.js.map +1 -0
- package/dist/utils/error-messages.d.ts +233 -0
- package/dist/utils/error-messages.d.ts.map +1 -0
- package/dist/utils/error-messages.js +721 -0
- package/dist/utils/error-messages.js.map +1 -0
- package/dist/utils/errors.d.ts +64 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +82 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/gpu-browser-args.d.ts +27 -0
- package/dist/utils/gpu-browser-args.d.ts.map +1 -0
- package/dist/utils/gpu-browser-args.js +42 -0
- package/dist/utils/gpu-browser-args.js.map +1 -0
- package/dist/utils/html-sanitizer.d.ts +116 -0
- package/dist/utils/html-sanitizer.d.ts.map +1 -0
- package/dist/utils/html-sanitizer.js +630 -0
- package/dist/utils/html-sanitizer.js.map +1 -0
- package/dist/utils/logger.d.ts +141 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +249 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mcp-response.d.ts +317 -0
- package/dist/utils/mcp-response.d.ts.map +1 -0
- package/dist/utils/mcp-response.js +270 -0
- package/dist/utils/mcp-response.js.map +1 -0
- package/dist/utils/path-security.d.ts +73 -0
- package/dist/utils/path-security.d.ts.map +1 -0
- package/dist/utils/path-security.js +389 -0
- package/dist/utils/path-security.js.map +1 -0
- package/dist/utils/prisma-wrapper-factory.d.ts +152 -0
- package/dist/utils/prisma-wrapper-factory.d.ts.map +1 -0
- package/dist/utils/prisma-wrapper-factory.js +124 -0
- package/dist/utils/prisma-wrapper-factory.js.map +1 -0
- package/dist/utils/safe-parse-int.d.ts +41 -0
- package/dist/utils/safe-parse-int.d.ts.map +1 -0
- package/dist/utils/safe-parse-int.js +49 -0
- package/dist/utils/safe-parse-int.js.map +1 -0
- package/dist/utils/url-normalizer.d.ts +38 -0
- package/dist/utils/url-normalizer.d.ts.map +1 -0
- package/dist/utils/url-normalizer.js +103 -0
- package/dist/utils/url-normalizer.js.map +1 -0
- package/dist/utils/url-validator.d.ts +86 -0
- package/dist/utils/url-validator.d.ts.map +1 -0
- package/dist/utils/url-validator.js +533 -0
- package/dist/utils/url-validator.js.map +1 -0
- package/dist/workers/batch-quality-worker.d.ts +87 -0
- package/dist/workers/batch-quality-worker.d.ts.map +1 -0
- package/dist/workers/batch-quality-worker.js +300 -0
- package/dist/workers/batch-quality-worker.js.map +1 -0
- package/dist/workers/page-analyze-worker.d.ts +63 -0
- package/dist/workers/page-analyze-worker.d.ts.map +1 -0
- package/dist/workers/page-analyze-worker.js +872 -0
- package/dist/workers/page-analyze-worker.js.map +1 -0
- package/dist/workers/phases/phase-0-ingest.d.ts +42 -0
- package/dist/workers/phases/phase-0-ingest.d.ts.map +1 -0
- package/dist/workers/phases/phase-0-ingest.js +197 -0
- package/dist/workers/phases/phase-0-ingest.js.map +1 -0
- package/dist/workers/phases/phase-1-layout.d.ts +63 -0
- package/dist/workers/phases/phase-1-layout.d.ts.map +1 -0
- package/dist/workers/phases/phase-1-layout.js +362 -0
- package/dist/workers/phases/phase-1-layout.js.map +1 -0
- package/dist/workers/phases/phase-2-motion.d.ts +93 -0
- package/dist/workers/phases/phase-2-motion.d.ts.map +1 -0
- package/dist/workers/phases/phase-2-motion.js +408 -0
- package/dist/workers/phases/phase-2-motion.js.map +1 -0
- package/dist/workers/phases/phase-3-quality.d.ts +61 -0
- package/dist/workers/phases/phase-3-quality.d.ts.map +1 -0
- package/dist/workers/phases/phase-3-quality.js +191 -0
- package/dist/workers/phases/phase-3-quality.js.map +1 -0
- package/dist/workers/phases/phase-4-narrative.d.ts +37 -0
- package/dist/workers/phases/phase-4-narrative.d.ts.map +1 -0
- package/dist/workers/phases/phase-4-narrative.js +309 -0
- package/dist/workers/phases/phase-4-narrative.js.map +1 -0
- package/dist/workers/phases/phase-5-embedding.d.ts +56 -0
- package/dist/workers/phases/phase-5-embedding.d.ts.map +1 -0
- package/dist/workers/phases/phase-5-embedding.js +1350 -0
- package/dist/workers/phases/phase-5-embedding.js.map +1 -0
- package/dist/workers/phases/types.d.ts +411 -0
- package/dist/workers/phases/types.d.ts.map +1 -0
- package/dist/workers/phases/types.js +540 -0
- package/dist/workers/phases/types.js.map +1 -0
- package/package.json +117 -0
- package/src/api/health.ts +372 -0
- package/src/config/index.ts +12 -0
- package/src/config/redis.ts +280 -0
- package/src/index.ts +360 -0
- package/src/lib/index.ts +9 -0
- package/src/lib/project-context.ts +109 -0
- package/src/middleware/args-type-coercion.ts +220 -0
- package/src/middleware/auth.ts +558 -0
- package/src/middleware/index.ts +56 -0
- package/src/middleware/light-response-controller.ts +723 -0
- package/src/middleware/response-size-warning.ts +196 -0
- package/src/queues/batch-quality-queue.ts +580 -0
- package/src/queues/index.ts +13 -0
- package/src/queues/page-analyze-queue.ts +472 -0
- package/src/router.ts +343 -0
- package/src/schemas/creative/index.ts +34 -0
- package/src/schemas/creative/palette.schema.ts +191 -0
- package/src/schemas/mood-brandtone-filters.ts +306 -0
- package/src/scripts/backfill-embeddings.ts +454 -0
- package/src/scripts/check-embedding-coverage.ts +119 -0
- package/src/scripts/start-workers.ts +560 -0
- package/src/server.ts +290 -0
- package/src/services/background/background-design-db.service.ts +206 -0
- package/src/services/background/background-design-detector.service.ts +1442 -0
- package/src/services/background/background-design-embedding.service.ts +599 -0
- package/src/services/background-search.service.ts +372 -0
- package/src/services/backup-service.ts +441 -0
- package/src/services/brief/brief-parser-service.ts +435 -0
- package/src/services/brief/schemas/brief-parser-schemas.ts +138 -0
- package/src/services/browser-process-manager.ts +334 -0
- package/src/services/cache.ts +297 -0
- package/src/services/checksum-service.ts +293 -0
- package/src/services/css-analysis-cache.service.ts +547 -0
- package/src/services/database-dumper.service.ts +675 -0
- package/src/services/embedding-backfill.service.ts +1055 -0
- package/src/services/embedding-validation.service.ts +194 -0
- package/src/services/encryption-service.ts +433 -0
- package/src/services/external-css-fetcher.ts +872 -0
- package/src/services/gpu-resource-manager.ts +615 -0
- package/src/services/index.ts +169 -0
- package/src/services/layout/component-splitter.ts +656 -0
- package/src/services/layout/html-to-jsx-converter.ts +591 -0
- package/src/services/layout/semantic-html-converter.ts +293 -0
- package/src/services/layout/style-to-tailwind-mapper.ts +1530 -0
- package/src/services/layout-embedding.service.ts +1552 -0
- package/src/services/layout-generate-code-service-export.ts +109 -0
- package/src/services/layout-search-service-export.ts +55 -0
- package/src/services/layout-search.service.ts +933 -0
- package/src/services/layout-to-code.service.ts +1631 -0
- package/src/services/metrics-collector.ts +473 -0
- package/src/services/ml/mood-brandtone-embedding.service.ts +1115 -0
- package/src/services/motion/analyzers/color-change.analyzer.ts +935 -0
- package/src/services/motion/analyzers/frame-diff.analyzer.ts +372 -0
- package/src/services/motion/analyzers/layout-shift.detector.ts +296 -0
- package/src/services/motion/analyzers/motion-vector.estimator.ts +698 -0
- package/src/services/motion/analyzers/webgl-motion-analyzer.ts +700 -0
- package/src/services/motion/animation-metrics-collector.service.ts +726 -0
- package/src/services/motion/cls-calculator.service.ts +519 -0
- package/src/services/motion/existing-animation-detector.service.ts +751 -0
- package/src/services/motion/fade-detector.service.ts +383 -0
- package/src/services/motion/frame-analysis-save.helper.ts +333 -0
- package/src/services/motion/frame-capture.service.ts +654 -0
- package/src/services/motion/frame-embedding.service.ts +1419 -0
- package/src/services/motion/frame-image-analysis.service.ts +1271 -0
- package/src/services/motion/frame-image-analyzer.adapter.ts +747 -0
- package/src/services/motion/frame-worker-pool.service.ts +519 -0
- package/src/services/motion/infrastructure/frame-loader.ts +450 -0
- package/src/services/motion/js-animation-detector.ts +1563 -0
- package/src/services/motion/js-animation-embedding.service.ts +423 -0
- package/src/services/motion/js-animation-search.service.ts +715 -0
- package/src/services/motion/motion-db.service.ts +952 -0
- package/src/services/motion/three-js-scene-extractor.ts +1556 -0
- package/src/services/motion/types.ts +820 -0
- package/src/services/motion/visual-category-classifier.ts +1426 -0
- package/src/services/motion/webgl-animation-categorizer.ts +761 -0
- package/src/services/motion/webgl-animation-detector.service.ts +772 -0
- package/src/services/motion/webgl-animation-embedding.service.ts +558 -0
- package/src/services/motion-detect-service-export.ts +300 -0
- package/src/services/motion-persistence.service.ts +541 -0
- package/src/services/motion-search-service.ts +38 -0
- package/src/services/motion-search.service.ts +1159 -0
- package/src/services/narrative/analyzers/layout-structure.analyzer.ts +628 -0
- package/src/services/narrative/analyzers/worldview.analyzer.ts +639 -0
- package/src/services/narrative/generators/confidence-calculator.ts +419 -0
- package/src/services/narrative/generators/text-representation.generator.ts +362 -0
- package/src/services/narrative/index.ts +72 -0
- package/src/services/narrative/narrative-analysis.service.ts +610 -0
- package/src/services/narrative/narrative-search.service.ts +704 -0
- package/src/services/narrative/types/narrative.types.ts +451 -0
- package/src/services/orphaned-job-utils.ts +160 -0
- package/src/services/page/css-animation-parser.service.ts +650 -0
- package/src/services/page/fallback-analyzer.service.ts +435 -0
- package/src/services/page/frame-analyzer.service.ts +824 -0
- package/src/services/page/layout-analyzer.service.ts +2534 -0
- package/src/services/page/motion-category-classifier.service.ts +463 -0
- package/src/services/page/motion-detector.service.ts +430 -0
- package/src/services/page/motion-performance-analyzer.service.ts +390 -0
- package/src/services/page/playwright-crawler.service.ts +478 -0
- package/src/services/page/quality-evaluator.service.ts +1473 -0
- package/src/services/page/runtime-animation-detector.service.ts +743 -0
- package/src/services/page/section-postprocessor.service.ts +874 -0
- package/src/services/page/video-recorder.service.ts +516 -0
- package/src/services/page/webgl-detector.service.ts +361 -0
- package/src/services/page-analyze-service.ts +83 -0
- package/src/services/page-ingest-adapter.ts +2256 -0
- package/src/services/palette-service-export.ts +50 -0
- package/src/services/part/index.ts +81 -0
- package/src/services/part/part-backfill.service.ts +308 -0
- package/src/services/part/part-bbox-playwright.service.ts +502 -0
- package/src/services/part/part-db.service.ts +121 -0
- package/src/services/part/part-embedding-db.service.ts +184 -0
- package/src/services/part/part-embedding.service.ts +406 -0
- package/src/services/part/part-extraction.service.ts +612 -0
- package/src/services/part/part-search.service.ts +806 -0
- package/src/services/part/schemas.ts +194 -0
- package/src/services/part/section-screenshot-fallback.service.ts +644 -0
- package/src/services/part/types.ts +299 -0
- package/src/services/persistent-cache.ts +760 -0
- package/src/services/preference-profile.service.ts +862 -0
- package/src/services/preference-rerank.helper.ts +549 -0
- package/src/services/production-guard.ts +423 -0
- package/src/services/project-context-analyzer.ts +915 -0
- package/src/services/quality/axe-accessibility.service.ts +253 -0
- package/src/services/quality/axe-core-shared.ts +203 -0
- package/src/services/quality/benchmark.service.ts +657 -0
- package/src/services/quality/content-gap-detector.service.ts +485 -0
- package/src/services/quality/index.ts +45 -0
- package/src/services/quality/pattern-matcher.service.ts +941 -0
- package/src/services/quality/playwright-axe.service.ts +343 -0
- package/src/services/quality/quality-evaluate.service.interface.ts +262 -0
- package/src/services/quality/visual-design-analyzer.service.ts +918 -0
- package/src/services/quality-evaluate-service-export.ts +268 -0
- package/src/services/quality-search.service.ts +406 -0
- package/src/services/query-analyzer.ts +306 -0
- package/src/services/query-context-analyzer.ts +843 -0
- package/src/services/queue-cleanup.service.ts +376 -0
- package/src/services/responsive/difference-detector.service.ts +647 -0
- package/src/services/responsive/index.ts +64 -0
- package/src/services/responsive/multi-viewport-capture.service.ts +943 -0
- package/src/services/responsive/responsive-analysis-embedding.service.ts +413 -0
- package/src/services/responsive/responsive-analysis.service.ts +325 -0
- package/src/services/responsive/responsive-persistence.service.ts +133 -0
- package/src/services/responsive/responsive-quality-evaluator.service.ts +515 -0
- package/src/services/responsive/shared-browser-manager.ts +118 -0
- package/src/services/responsive/types.ts +387 -0
- package/src/services/responsive/viewport-diff.service.ts +236 -0
- package/src/services/responsive-search.service.ts +230 -0
- package/src/services/search/mood-brandtone-search.service.ts +400 -0
- package/src/services/search-performance.service.ts +252 -0
- package/src/services/section-screenshot.service.ts +581 -0
- package/src/services/service-client.ts +643 -0
- package/src/services/service-initializer.ts +1386 -0
- package/src/services/storage/index.ts +15 -0
- package/src/services/storage/local-storage.provider.ts +370 -0
- package/src/services/style/index.ts +10 -0
- package/src/services/style/palette-service.ts +655 -0
- package/src/services/style/prisma-palette-repository.ts +216 -0
- package/src/services/vision/brandtone.analyzer.ts +371 -0
- package/src/services/vision/hardware-detector.ts +436 -0
- package/src/services/vision/image-optimizer.ts +377 -0
- package/src/services/vision/index.ts +131 -0
- package/src/services/vision/llama-vision-adapter.ts +526 -0
- package/src/services/vision/mcp-progress-adapter.ts +221 -0
- package/src/services/vision/mood.analyzer.ts +332 -0
- package/src/services/vision/ollama-readiness-probe.ts +271 -0
- package/src/services/vision/ollama-vision-client.ts +631 -0
- package/src/services/vision/progress-reporter.ts +377 -0
- package/src/services/vision/scroll-vision-capture.service.ts +409 -0
- package/src/services/vision/scroll-vision-persistence.service.ts +216 -0
- package/src/services/vision/scroll-vision.analyzer.ts +416 -0
- package/src/services/vision/theme.analyzer.ts +443 -0
- package/src/services/vision/timeout-calculator.ts +155 -0
- package/src/services/vision/vision-fallback.service.ts +368 -0
- package/src/services/vision/vision.cache.ts +332 -0
- package/src/services/vision/vision.errors.ts +186 -0
- package/src/services/vision/vision.prompts.ts +298 -0
- package/src/services/vision/vram-utils.ts +80 -0
- package/src/services/vision-adapter/index.ts +71 -0
- package/src/services/vision-adapter/interface.ts +911 -0
- package/src/services/vision-adapter/llama-vision.adapter.ts +2254 -0
- package/src/services/vision-adapter/llama-vision.prompts.ts +242 -0
- package/src/services/vision-adapter/llama-vision.types.ts +103 -0
- package/src/services/vision-adapter/local.adapter.ts +1079 -0
- package/src/services/vision-adapter/mock.adapter.ts +978 -0
- package/src/services/vision-embedding-search.service.ts +1071 -0
- package/src/services/vision-embedding.service.ts +631 -0
- package/src/services/visual/css-variable-extractor.service.ts +655 -0
- package/src/services/visual/typography-extractor.service.ts +767 -0
- package/src/services/visual-extractor/color-extractor.service.ts +397 -0
- package/src/services/visual-extractor/density-calculator.service.ts +616 -0
- package/src/services/visual-extractor/gradient-detector.service.ts +1794 -0
- package/src/services/visual-extractor/image-utils.ts +333 -0
- package/src/services/visual-extractor/pixel-theme-detector.service.ts +487 -0
- package/src/services/visual-extractor/theme-detector.service.ts +697 -0
- package/src/services/visual-extractor/visual-decoration-detector.service.ts +800 -0
- package/src/services/visual-extractor/visual-feature-merger.service.ts +831 -0
- package/src/services/web-page.service.ts +275 -0
- package/src/services/worker-constants.ts +52 -0
- package/src/services/worker-db-save.service.ts +1098 -0
- package/src/services/worker-memory-monitor.service.ts +126 -0
- package/src/services/worker-memory-profile.ts +336 -0
- package/src/services/worker-stall-recovery.service.ts +486 -0
- package/src/services/worker-supervisor.service.ts +746 -0
- package/src/tools/background/schemas.ts +93 -0
- package/src/tools/background/search.tool.ts +484 -0
- package/src/tools/brief/index.ts +76 -0
- package/src/tools/brief/schemas.ts +247 -0
- package/src/tools/brief/validate.handler.ts +278 -0
- package/src/tools/brief/validate.service.ts +409 -0
- package/src/tools/common/error-codes.ts +116 -0
- package/src/tools/common/index.ts +25 -0
- package/src/tools/index.ts +723 -0
- package/src/tools/layout/batch-ingest.tool.ts +466 -0
- package/src/tools/layout/index.ts +72 -0
- package/src/tools/layout/ingest.tool.ts +1564 -0
- package/src/tools/layout/inspect/index.ts +49 -0
- package/src/tools/layout/inspect/inspect.schemas.ts +518 -0
- package/src/tools/layout/inspect/inspect.tool.ts +844 -0
- package/src/tools/layout/inspect/inspect.utils.ts +1278 -0
- package/src/tools/layout/inspect/visual-extractors.schemas.ts +642 -0
- package/src/tools/layout/inspect/visual-extractors.utils.ts +328 -0
- package/src/tools/layout/schemas.ts +1670 -0
- package/src/tools/layout/search.tool.ts +2088 -0
- package/src/tools/layout/to-code.tool.ts +503 -0
- package/src/tools/motion/analyze-frames.handler.ts +388 -0
- package/src/tools/motion/analyze-frames.schema.ts +484 -0
- package/src/tools/motion/css-mode-handler.ts +939 -0
- package/src/tools/motion/detect.schemas.ts +2005 -0
- package/src/tools/motion/detect.tool.ts +1914 -0
- package/src/tools/motion/detection-modes.ts +480 -0
- package/src/tools/motion/di-factories.ts +767 -0
- package/src/tools/motion/index.ts +229 -0
- package/src/tools/motion/pattern-converter.ts +619 -0
- package/src/tools/motion/schemas.ts +12 -0
- package/src/tools/motion/search.schemas.ts +694 -0
- package/src/tools/motion/search.tool.ts +2518 -0
- package/src/tools/motion/shared.schemas.ts +414 -0
- package/src/tools/narrative/PAGE_ANALYZE_INTEGRATION.md +249 -0
- package/src/tools/narrative/analyze.tool.ts +460 -0
- package/src/tools/narrative/index.ts +133 -0
- package/src/tools/narrative/schemas.ts +886 -0
- package/src/tools/narrative/search.tool.ts +536 -0
- package/src/tools/page/analyze.tool.ts +992 -0
- package/src/tools/page/get-job-status.tool.ts +217 -0
- package/src/tools/page/handlers/db-handler.ts +638 -0
- package/src/tools/page/handlers/embedding-handler.ts +813 -0
- package/src/tools/page/handlers/execution-status-tracker.ts +461 -0
- package/src/tools/page/handlers/js-animation-handler.ts +1229 -0
- package/src/tools/page/handlers/layout-handler.ts +1423 -0
- package/src/tools/page/handlers/motion-handler.ts +1156 -0
- package/src/tools/page/handlers/narrative-handler.ts +345 -0
- package/src/tools/page/handlers/phased-db-handler.ts +186 -0
- package/src/tools/page/handlers/phased-executor.ts +356 -0
- package/src/tools/page/handlers/quality-handler.ts +114 -0
- package/src/tools/page/handlers/result-builder.ts +551 -0
- package/src/tools/page/handlers/retry-strategy.ts +223 -0
- package/src/tools/page/handlers/sync-processing.ts +2084 -0
- package/src/tools/page/handlers/timeout-utils.ts +835 -0
- package/src/tools/page/handlers/types.ts +1333 -0
- package/src/tools/page/handlers/video-handler.ts +299 -0
- package/src/tools/page/handlers/webgl-animation-handler.ts +309 -0
- package/src/tools/page/handlers/webgl-detector.ts +833 -0
- package/src/tools/page/handlers/webgl-domains.ts +482 -0
- package/src/tools/page/handlers/webgl-pre-detector.ts +308 -0
- package/src/tools/page/index.ts +142 -0
- package/src/tools/page/input.schemas.ts +945 -0
- package/src/tools/page/output.schemas.ts +1636 -0
- package/src/tools/page/schemas.ts +12 -0
- package/src/tools/page/shared.schemas.ts +86 -0
- package/src/tools/part/compare.tool.ts +542 -0
- package/src/tools/part/inspect.tool.ts +400 -0
- package/src/tools/part/search.tool.ts +470 -0
- package/src/tools/preference/get.tool.ts +238 -0
- package/src/tools/preference/hear.tool.ts +504 -0
- package/src/tools/preference/index.ts +65 -0
- package/src/tools/preference/reset.tool.ts +264 -0
- package/src/tools/preference/schemas.ts +161 -0
- package/src/tools/project-get.ts +194 -0
- package/src/tools/project-list.ts +240 -0
- package/src/tools/quality/batch-evaluate.tool.ts +480 -0
- package/src/tools/quality/evaluate-engine.ts +1329 -0
- package/src/tools/quality/evaluate.tool.ts +981 -0
- package/src/tools/quality/get-job-status.tool.ts +344 -0
- package/src/tools/quality/improvement-utils.ts +361 -0
- package/src/tools/quality/index.ts +49 -0
- package/src/tools/quality/schemas.ts +1114 -0
- package/src/tools/responsive/schemas.ts +103 -0
- package/src/tools/responsive/search.tool.ts +421 -0
- package/src/tools/schemas/index.ts +67 -0
- package/src/tools/schemas/layout-schemas.ts +334 -0
- package/src/tools/schemas/project-schemas.ts +233 -0
- package/src/tools/schemas/shared.ts +176 -0
- package/src/tools/schemas/style-schemas.ts +74 -0
- package/src/tools/style-get-palette.ts +344 -0
- package/src/tools/system-health.ts +729 -0
- package/src/transport.ts +54 -0
- package/src/types/creative/index.ts +22 -0
- package/src/types/creative/palette.ts +197 -0
- package/src/types/reftrix-window.ts +175 -0
- package/src/utils/actionable-warning.ts +997 -0
- package/src/utils/blank-image-detector.ts +143 -0
- package/src/utils/color.ts +534 -0
- package/src/utils/deprecation-warning.ts +146 -0
- package/src/utils/error-messages.ts +965 -0
- package/src/utils/errors.ts +95 -0
- package/src/utils/gpu-browser-args.ts +41 -0
- package/src/utils/html-sanitizer.ts +753 -0
- package/src/utils/logger.ts +292 -0
- package/src/utils/mcp-response.ts +397 -0
- package/src/utils/path-security.ts +412 -0
- package/src/utils/prisma-wrapper-factory.ts +283 -0
- package/src/utils/safe-parse-int.ts +74 -0
- package/src/utils/url-normalizer.ts +115 -0
- package/src/utils/url-validator.ts +615 -0
- package/src/workers/batch-quality-worker.ts +419 -0
- package/src/workers/page-analyze-worker.ts +1056 -0
- package/src/workers/phases/phase-0-ingest.ts +249 -0
- package/src/workers/phases/phase-1-layout.ts +522 -0
- package/src/workers/phases/phase-2-motion.ts +674 -0
- package/src/workers/phases/phase-3-quality.ts +293 -0
- package/src/workers/phases/phase-4-narrative.ts +409 -0
- package/src/workers/phases/phase-5-embedding.ts +1816 -0
- package/src/workers/phases/types.ts +909 -0
|
@@ -0,0 +1,2518 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 TKMD and Reftrix Contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* motion.search MCPツール
|
|
6
|
+
* モーションパターンを類似検索します
|
|
7
|
+
*
|
|
8
|
+
* 機能:
|
|
9
|
+
* - 自然言語クエリによる検索
|
|
10
|
+
* - サンプルパターンによる類似検索
|
|
11
|
+
* - フィルタリング(タイプ、duration範囲、トリガー)
|
|
12
|
+
* - 類似度しきい値によるフィルタリング
|
|
13
|
+
* - Phase3-3: コード生成機能の統合(action: 'generate')
|
|
14
|
+
*
|
|
15
|
+
* @module tools/motion/search.tool
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { logger, isDevelopment } from "../../utils/logger";
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
motionSearchInputSchema,
|
|
22
|
+
MOTION_SEARCH_ERROR_CODES,
|
|
23
|
+
MOTION_MCP_ERROR_CODES,
|
|
24
|
+
type MotionSearchInput,
|
|
25
|
+
type MotionSearchOutput,
|
|
26
|
+
type MotionSearchResultItem,
|
|
27
|
+
type MotionSearchQueryInfo,
|
|
28
|
+
type MotionSearchFilters,
|
|
29
|
+
type SamplePattern,
|
|
30
|
+
type MotionPatternInput,
|
|
31
|
+
type ImplementationFormat,
|
|
32
|
+
type ImplementationOptions,
|
|
33
|
+
type ImplementationMetadata,
|
|
34
|
+
type JSAnimationFilters,
|
|
35
|
+
type JSAnimationInfo,
|
|
36
|
+
type WebGLAnimationFilters,
|
|
37
|
+
type WebGLAnimationInfo,
|
|
38
|
+
type GenerationOptions,
|
|
39
|
+
type DuplicateCheckResult,
|
|
40
|
+
type MotionImplementation,
|
|
41
|
+
type MotionPattern,
|
|
42
|
+
type MotionCategory,
|
|
43
|
+
} from "./schemas";
|
|
44
|
+
|
|
45
|
+
import {
|
|
46
|
+
ExistingAnimationDetectorService,
|
|
47
|
+
type NewAnimationPattern,
|
|
48
|
+
} from "../../services/motion/existing-animation-detector.service";
|
|
49
|
+
import { applyPreferenceReranking } from "../../services/preference-rerank.helper";
|
|
50
|
+
import type { IPrismaClient } from "../../services/preference-profile.service";
|
|
51
|
+
|
|
52
|
+
// =====================================================
|
|
53
|
+
// 型定義
|
|
54
|
+
// =====================================================
|
|
55
|
+
|
|
56
|
+
export type { MotionSearchInput, MotionSearchOutput };
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 検索パラメータ
|
|
60
|
+
*/
|
|
61
|
+
export interface MotionSearchParams {
|
|
62
|
+
query?: string | undefined;
|
|
63
|
+
samplePattern?: SamplePattern | undefined;
|
|
64
|
+
filters?: MotionSearchFilters | undefined;
|
|
65
|
+
limit: number;
|
|
66
|
+
minSimilarity: number;
|
|
67
|
+
/** JSアニメーションを検索に含めるか(v0.1.0) */
|
|
68
|
+
include_js_animations?: boolean;
|
|
69
|
+
/** JSアニメーション検索フィルター(v0.1.0) */
|
|
70
|
+
js_animation_filters?: JSAnimationFilters | undefined;
|
|
71
|
+
/** WebGLアニメーションを検索に含めるか(v0.1.0) */
|
|
72
|
+
include_webgl_animations?: boolean;
|
|
73
|
+
/** WebGLアニメーション検索フィルター(v0.1.0) */
|
|
74
|
+
webgl_animation_filters?: WebGLAnimationFilters | undefined;
|
|
75
|
+
/** 検索結果に実装コードを含めるか(v0.1.0) */
|
|
76
|
+
include_implementation?: boolean;
|
|
77
|
+
/** 結果の多様性しきい値(v0.1.0、0.0-1.0、デフォルト: 0.3) */
|
|
78
|
+
diversity_threshold?: number;
|
|
79
|
+
/** カテゴリ分散を強制するか(v0.1.0、デフォルト: true) */
|
|
80
|
+
ensure_category_diversity?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* JSアニメーション検索結果アイテム
|
|
85
|
+
* MotionSearchResultItemにJSアニメーション情報を追加
|
|
86
|
+
*/
|
|
87
|
+
export interface JSAnimationSearchResultItem extends Omit<MotionSearchResultItem, "pattern"> {
|
|
88
|
+
/** パターン情報 */
|
|
89
|
+
pattern: MotionSearchResultItem["pattern"];
|
|
90
|
+
/** JSアニメーション固有情報 */
|
|
91
|
+
jsAnimationInfo?: JSAnimationInfo;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* WebGLアニメーション検索結果アイテム
|
|
96
|
+
* MotionSearchResultItemにWebGLアニメーション情報を追加
|
|
97
|
+
* v0.1.0
|
|
98
|
+
*/
|
|
99
|
+
export interface WebGLAnimationSearchResultItem extends Omit<MotionSearchResultItem, "pattern"> {
|
|
100
|
+
/** パターン情報 */
|
|
101
|
+
pattern: MotionSearchResultItem["pattern"];
|
|
102
|
+
/** WebGLアニメーション固有情報 */
|
|
103
|
+
webglAnimationInfo?: WebGLAnimationInfo;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 検索結果
|
|
108
|
+
*/
|
|
109
|
+
export interface MotionSearchResult {
|
|
110
|
+
results: MotionSearchResultItem[];
|
|
111
|
+
total: number;
|
|
112
|
+
query?: MotionSearchQueryInfo;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// =====================================================
|
|
116
|
+
// サービスインターフェース(DI用)
|
|
117
|
+
// =====================================================
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* モーション検索サービスインターフェース
|
|
121
|
+
*/
|
|
122
|
+
export interface IMotionSearchService {
|
|
123
|
+
/**
|
|
124
|
+
* モーションパターンを検索
|
|
125
|
+
*/
|
|
126
|
+
search: (params: MotionSearchParams) => Promise<MotionSearchResult>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* ハイブリッド検索(ベクトル + 全文検索、RRFマージ)
|
|
130
|
+
* 利用可能な場合に search() の代わりに使用される
|
|
131
|
+
*/
|
|
132
|
+
searchHybrid?: (params: MotionSearchParams) => Promise<MotionSearchResult>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* テキストからEmbeddingを取得(オプショナル)
|
|
136
|
+
*/
|
|
137
|
+
getEmbedding?: (text: string) => Promise<number[]>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* コード生成結果インターフェース
|
|
142
|
+
*/
|
|
143
|
+
export interface GenerationResult {
|
|
144
|
+
code: string;
|
|
145
|
+
metadata: ImplementationMetadata;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* コード生成サービスインターフェース(Phase3-3統合用)
|
|
150
|
+
*/
|
|
151
|
+
export interface IMotionImplementationService {
|
|
152
|
+
generate: (
|
|
153
|
+
pattern: MotionPatternInput,
|
|
154
|
+
format: ImplementationFormat,
|
|
155
|
+
options: ImplementationOptions
|
|
156
|
+
) => GenerationResult | null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* サービスファクトリ型
|
|
161
|
+
*/
|
|
162
|
+
type MotionSearchServiceFactory = () => IMotionSearchService;
|
|
163
|
+
type MotionImplementationServiceFactory = () => IMotionImplementationService | null;
|
|
164
|
+
|
|
165
|
+
let serviceFactory: MotionSearchServiceFactory | null = null;
|
|
166
|
+
let implementationServiceFactory: MotionImplementationServiceFactory | null = null;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* サービスファクトリを設定
|
|
170
|
+
*/
|
|
171
|
+
export function setMotionSearchServiceFactory(factory: MotionSearchServiceFactory): void {
|
|
172
|
+
serviceFactory = factory;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* サービスファクトリをリセット
|
|
177
|
+
*/
|
|
178
|
+
export function resetMotionSearchServiceFactory(): void {
|
|
179
|
+
serviceFactory = null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* コード生成サービスファクトリを設定(Phase3-3統合用)
|
|
184
|
+
*/
|
|
185
|
+
export function setMotionImplementationServiceFactory(
|
|
186
|
+
factory: MotionImplementationServiceFactory
|
|
187
|
+
): void {
|
|
188
|
+
implementationServiceFactory = factory;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* コード生成サービスファクトリをリセット
|
|
193
|
+
*/
|
|
194
|
+
export function resetMotionImplementationServiceFactory(): void {
|
|
195
|
+
implementationServiceFactory = null;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* PrismaClientファクトリー(嗜好リランキング用DI)
|
|
200
|
+
* PrismaClient factory (DI for preference reranking)
|
|
201
|
+
*/
|
|
202
|
+
let prismaClientFactory: (() => IPrismaClient) | null = null;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* PrismaClientファクトリーを設定(嗜好リランキング用)
|
|
206
|
+
* Set PrismaClient factory (for preference reranking)
|
|
207
|
+
*/
|
|
208
|
+
export function setMotionSearchPrismaClientFactory(factory: () => IPrismaClient): void {
|
|
209
|
+
prismaClientFactory = factory;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* PrismaClientファクトリーをリセット(テスト用)
|
|
214
|
+
* Reset PrismaClient factory (for testing)
|
|
215
|
+
*/
|
|
216
|
+
export function resetMotionSearchPrismaClientFactory(): void {
|
|
217
|
+
prismaClientFactory = null;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// =====================================================
|
|
221
|
+
// デフォルトコード生成実装(Phase3-3統合用)
|
|
222
|
+
// =====================================================
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* ミリ秒をCSS時間単位に変換
|
|
226
|
+
*/
|
|
227
|
+
function formatDuration(ms: number): string {
|
|
228
|
+
if (ms >= 1000 && ms % 1000 === 0) {
|
|
229
|
+
return `${ms / 1000}s`;
|
|
230
|
+
}
|
|
231
|
+
return `${ms}ms`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* キーフレームのパーセンテージを計算
|
|
236
|
+
*/
|
|
237
|
+
function offsetToPercent(offset: number): string {
|
|
238
|
+
return `${Math.round(offset * 100)}%`;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* 行数をカウント
|
|
243
|
+
*/
|
|
244
|
+
function countLines(code: string): number {
|
|
245
|
+
return code.split("\n").length;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* PascalCaseに変換
|
|
250
|
+
*/
|
|
251
|
+
function toPascalCase(str: string): string {
|
|
252
|
+
return str.replace(/[-_](\w)/g, (_, c) => c.toUpperCase()).replace(/^\w/, (c) => c.toUpperCase());
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* CSS生成
|
|
257
|
+
*/
|
|
258
|
+
function generateCSS(
|
|
259
|
+
pattern: MotionPatternInput,
|
|
260
|
+
options: ImplementationOptions
|
|
261
|
+
): GenerationResult {
|
|
262
|
+
const lines: string[] = [];
|
|
263
|
+
const selector = options.selector || ".animated";
|
|
264
|
+
const hasKeyframes = pattern.properties.some((p) => p.keyframes && p.keyframes.length > 0);
|
|
265
|
+
|
|
266
|
+
// @keyframes 生成
|
|
267
|
+
if (pattern.type !== "transition") {
|
|
268
|
+
lines.push(`@keyframes ${pattern.name} {`);
|
|
269
|
+
|
|
270
|
+
if (hasKeyframes) {
|
|
271
|
+
const allOffsets = new Set<number>();
|
|
272
|
+
pattern.properties.forEach((prop) => {
|
|
273
|
+
prop.keyframes?.forEach((kf) => allOffsets.add(kf.offset));
|
|
274
|
+
});
|
|
275
|
+
allOffsets.add(0);
|
|
276
|
+
allOffsets.add(1);
|
|
277
|
+
|
|
278
|
+
const sortedOffsets = Array.from(allOffsets).sort((a, b) => a - b);
|
|
279
|
+
|
|
280
|
+
for (const offset of sortedOffsets) {
|
|
281
|
+
lines.push(` ${offsetToPercent(offset)} {`);
|
|
282
|
+
for (const prop of pattern.properties) {
|
|
283
|
+
const kf = prop.keyframes?.find((k) => k.offset === offset);
|
|
284
|
+
if (kf) {
|
|
285
|
+
lines.push(` ${prop.name}: ${kf.value};`);
|
|
286
|
+
} else if (offset === 0) {
|
|
287
|
+
lines.push(` ${prop.name}: ${prop.from};`);
|
|
288
|
+
} else if (offset === 1) {
|
|
289
|
+
lines.push(` ${prop.name}: ${prop.to};`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
lines.push(" }");
|
|
293
|
+
}
|
|
294
|
+
} else {
|
|
295
|
+
lines.push(" from {");
|
|
296
|
+
for (const prop of pattern.properties) {
|
|
297
|
+
lines.push(` ${prop.name}: ${prop.from};`);
|
|
298
|
+
}
|
|
299
|
+
lines.push(" }");
|
|
300
|
+
lines.push(" to {");
|
|
301
|
+
for (const prop of pattern.properties) {
|
|
302
|
+
lines.push(` ${prop.name}: ${prop.to};`);
|
|
303
|
+
}
|
|
304
|
+
lines.push(" }");
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
lines.push("}");
|
|
308
|
+
lines.push("");
|
|
309
|
+
|
|
310
|
+
// ベンダープレフィックス
|
|
311
|
+
if (options.includeVendorPrefixes) {
|
|
312
|
+
lines.push(`@-webkit-keyframes ${pattern.name} {`);
|
|
313
|
+
if (hasKeyframes) {
|
|
314
|
+
const allOffsets = new Set<number>();
|
|
315
|
+
pattern.properties.forEach((prop) => {
|
|
316
|
+
prop.keyframes?.forEach((kf) => allOffsets.add(kf.offset));
|
|
317
|
+
});
|
|
318
|
+
allOffsets.add(0);
|
|
319
|
+
allOffsets.add(1);
|
|
320
|
+
|
|
321
|
+
const sortedOffsets = Array.from(allOffsets).sort((a, b) => a - b);
|
|
322
|
+
|
|
323
|
+
for (const offset of sortedOffsets) {
|
|
324
|
+
lines.push(` ${offsetToPercent(offset)} {`);
|
|
325
|
+
for (const prop of pattern.properties) {
|
|
326
|
+
const kf = prop.keyframes?.find((k) => k.offset === offset);
|
|
327
|
+
if (kf) {
|
|
328
|
+
lines.push(` ${prop.name}: ${kf.value};`);
|
|
329
|
+
} else if (offset === 0) {
|
|
330
|
+
lines.push(` ${prop.name}: ${prop.from};`);
|
|
331
|
+
} else if (offset === 1) {
|
|
332
|
+
lines.push(` ${prop.name}: ${prop.to};`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
lines.push(" }");
|
|
336
|
+
}
|
|
337
|
+
} else {
|
|
338
|
+
lines.push(" from {");
|
|
339
|
+
for (const prop of pattern.properties) {
|
|
340
|
+
lines.push(` ${prop.name}: ${prop.from};`);
|
|
341
|
+
}
|
|
342
|
+
lines.push(" }");
|
|
343
|
+
lines.push(" to {");
|
|
344
|
+
for (const prop of pattern.properties) {
|
|
345
|
+
lines.push(` ${prop.name}: ${prop.to};`);
|
|
346
|
+
}
|
|
347
|
+
lines.push(" }");
|
|
348
|
+
}
|
|
349
|
+
lines.push("}");
|
|
350
|
+
lines.push("");
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// セレクタルール
|
|
355
|
+
lines.push(`${selector} {`);
|
|
356
|
+
|
|
357
|
+
if (pattern.type === "transition") {
|
|
358
|
+
const props = pattern.properties.map((p) => p.name).join(", ");
|
|
359
|
+
lines.push(` transition: ${props} ${formatDuration(pattern.duration)} ${pattern.easing};`);
|
|
360
|
+
if (options.includeVendorPrefixes) {
|
|
361
|
+
lines.push(
|
|
362
|
+
` -webkit-transition: ${props} ${formatDuration(pattern.duration)} ${pattern.easing};`
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
const iterations = pattern.iterations === "infinite" ? "infinite" : pattern.iterations;
|
|
367
|
+
const animationValue = [
|
|
368
|
+
pattern.name,
|
|
369
|
+
formatDuration(pattern.duration),
|
|
370
|
+
pattern.easing,
|
|
371
|
+
pattern.delay > 0 ? formatDuration(pattern.delay) : null,
|
|
372
|
+
iterations !== 1 ? iterations : null,
|
|
373
|
+
pattern.direction !== "normal" ? pattern.direction : null,
|
|
374
|
+
pattern.fillMode !== "none" ? pattern.fillMode : null,
|
|
375
|
+
]
|
|
376
|
+
.filter(Boolean)
|
|
377
|
+
.join(" ");
|
|
378
|
+
|
|
379
|
+
lines.push(` animation: ${animationValue};`);
|
|
380
|
+
if (options.includeVendorPrefixes) {
|
|
381
|
+
lines.push(` -webkit-animation: ${animationValue};`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
lines.push("}");
|
|
386
|
+
|
|
387
|
+
// hover/scroll タイプの追加ルール
|
|
388
|
+
if (pattern.type === "hover") {
|
|
389
|
+
lines.push("");
|
|
390
|
+
lines.push(`${selector}:hover {`);
|
|
391
|
+
for (const prop of pattern.properties) {
|
|
392
|
+
lines.push(` ${prop.name}: ${prop.to};`);
|
|
393
|
+
}
|
|
394
|
+
lines.push("}");
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// prefers-reduced-motion
|
|
398
|
+
if (options.includeReducedMotion) {
|
|
399
|
+
lines.push("");
|
|
400
|
+
lines.push("@media (prefers-reduced-motion: reduce) {");
|
|
401
|
+
lines.push(` ${selector} {`);
|
|
402
|
+
if (pattern.type === "transition") {
|
|
403
|
+
lines.push(" transition: none;");
|
|
404
|
+
} else {
|
|
405
|
+
lines.push(" animation: none;");
|
|
406
|
+
}
|
|
407
|
+
lines.push(" }");
|
|
408
|
+
lines.push("}");
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const code = lines.join("\n");
|
|
412
|
+
|
|
413
|
+
return {
|
|
414
|
+
code,
|
|
415
|
+
metadata: {
|
|
416
|
+
linesOfCode: countLines(code),
|
|
417
|
+
hasKeyframes: pattern.type !== "transition",
|
|
418
|
+
hasReducedMotion: options.includeReducedMotion ?? true,
|
|
419
|
+
dependencies: [],
|
|
420
|
+
},
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* CSS Module生成
|
|
426
|
+
*/
|
|
427
|
+
function generateCSSModule(
|
|
428
|
+
pattern: MotionPatternInput,
|
|
429
|
+
options: ImplementationOptions
|
|
430
|
+
): GenerationResult {
|
|
431
|
+
const result = generateCSS(pattern, {
|
|
432
|
+
...options,
|
|
433
|
+
selector: `.${pattern.name}`,
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
return {
|
|
437
|
+
...result,
|
|
438
|
+
metadata: {
|
|
439
|
+
...result.metadata,
|
|
440
|
+
dependencies: [],
|
|
441
|
+
},
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Tailwind生成
|
|
447
|
+
*/
|
|
448
|
+
function generateTailwind(
|
|
449
|
+
pattern: MotionPatternInput,
|
|
450
|
+
options: ImplementationOptions
|
|
451
|
+
): GenerationResult {
|
|
452
|
+
const lines: string[] = [];
|
|
453
|
+
|
|
454
|
+
lines.push("/* Add to tailwind.config.js */");
|
|
455
|
+
lines.push("module.exports = {");
|
|
456
|
+
lines.push(" theme: {");
|
|
457
|
+
lines.push(" extend: {");
|
|
458
|
+
|
|
459
|
+
lines.push(" animation: {");
|
|
460
|
+
const iterations = pattern.iterations === "infinite" ? "infinite" : "";
|
|
461
|
+
const direction = pattern.direction !== "normal" ? pattern.direction : "";
|
|
462
|
+
lines.push(
|
|
463
|
+
` '${pattern.name}': '${pattern.name} ${formatDuration(pattern.duration)} ${pattern.easing} ${iterations} ${direction}'.trim(),`
|
|
464
|
+
);
|
|
465
|
+
lines.push(" },");
|
|
466
|
+
|
|
467
|
+
lines.push(" keyframes: {");
|
|
468
|
+
lines.push(` '${pattern.name}': {`);
|
|
469
|
+
|
|
470
|
+
if (pattern.properties.some((p) => p.keyframes && p.keyframes.length > 0)) {
|
|
471
|
+
const allOffsets = new Set<number>();
|
|
472
|
+
pattern.properties.forEach((prop) => {
|
|
473
|
+
prop.keyframes?.forEach((kf) => allOffsets.add(kf.offset));
|
|
474
|
+
});
|
|
475
|
+
allOffsets.add(0);
|
|
476
|
+
allOffsets.add(1);
|
|
477
|
+
|
|
478
|
+
const sortedOffsets = Array.from(allOffsets).sort((a, b) => a - b);
|
|
479
|
+
|
|
480
|
+
for (const offset of sortedOffsets) {
|
|
481
|
+
lines.push(` '${offsetToPercent(offset)}': {`);
|
|
482
|
+
for (const prop of pattern.properties) {
|
|
483
|
+
const kf = prop.keyframes?.find((k) => k.offset === offset);
|
|
484
|
+
if (kf) {
|
|
485
|
+
lines.push(` ${prop.name}: '${kf.value}',`);
|
|
486
|
+
} else if (offset === 0) {
|
|
487
|
+
lines.push(` ${prop.name}: '${prop.from}',`);
|
|
488
|
+
} else if (offset === 1) {
|
|
489
|
+
lines.push(` ${prop.name}: '${prop.to}',`);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
lines.push(" },");
|
|
493
|
+
}
|
|
494
|
+
} else {
|
|
495
|
+
lines.push(" '0%': {");
|
|
496
|
+
for (const prop of pattern.properties) {
|
|
497
|
+
lines.push(` ${prop.name}: '${prop.from}',`);
|
|
498
|
+
}
|
|
499
|
+
lines.push(" },");
|
|
500
|
+
lines.push(" '100%': {");
|
|
501
|
+
for (const prop of pattern.properties) {
|
|
502
|
+
lines.push(` ${prop.name}: '${prop.to}',`);
|
|
503
|
+
}
|
|
504
|
+
lines.push(" },");
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
lines.push(" },");
|
|
508
|
+
lines.push(" },");
|
|
509
|
+
lines.push(" },");
|
|
510
|
+
lines.push(" },");
|
|
511
|
+
lines.push("};");
|
|
512
|
+
lines.push("");
|
|
513
|
+
lines.push("/* Usage in JSX */");
|
|
514
|
+
lines.push(`<div className="animate-${pattern.name}">Content</div>`);
|
|
515
|
+
|
|
516
|
+
if (options.includeReducedMotion) {
|
|
517
|
+
lines.push("");
|
|
518
|
+
lines.push("/* For reduced motion support */");
|
|
519
|
+
lines.push(`<div className="animate-${pattern.name} motion-reduce:animate-none">Content</div>`);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const code = lines.join("\n");
|
|
523
|
+
|
|
524
|
+
return {
|
|
525
|
+
code,
|
|
526
|
+
metadata: {
|
|
527
|
+
linesOfCode: countLines(code),
|
|
528
|
+
hasKeyframes: true,
|
|
529
|
+
hasReducedMotion: options.includeReducedMotion ?? true,
|
|
530
|
+
dependencies: ["tailwindcss"],
|
|
531
|
+
},
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* styled-components生成
|
|
537
|
+
*/
|
|
538
|
+
function generateStyledComponents(
|
|
539
|
+
pattern: MotionPatternInput,
|
|
540
|
+
options: ImplementationOptions
|
|
541
|
+
): GenerationResult {
|
|
542
|
+
const lines: string[] = [];
|
|
543
|
+
const componentName = options.componentName || toPascalCase(pattern.name) + "Animation";
|
|
544
|
+
const ts = options.typescript ?? true;
|
|
545
|
+
|
|
546
|
+
lines.push("import styled, { keyframes } from 'styled-components';");
|
|
547
|
+
if (ts) {
|
|
548
|
+
lines.push("import type { FC, ReactNode } from 'react';");
|
|
549
|
+
}
|
|
550
|
+
lines.push("");
|
|
551
|
+
|
|
552
|
+
lines.push(`const ${pattern.name}Keyframes = keyframes\``);
|
|
553
|
+
|
|
554
|
+
if (pattern.properties.some((p) => p.keyframes && p.keyframes.length > 0)) {
|
|
555
|
+
const allOffsets = new Set<number>();
|
|
556
|
+
pattern.properties.forEach((prop) => {
|
|
557
|
+
prop.keyframes?.forEach((kf) => allOffsets.add(kf.offset));
|
|
558
|
+
});
|
|
559
|
+
allOffsets.add(0);
|
|
560
|
+
allOffsets.add(1);
|
|
561
|
+
|
|
562
|
+
const sortedOffsets = Array.from(allOffsets).sort((a, b) => a - b);
|
|
563
|
+
|
|
564
|
+
for (const offset of sortedOffsets) {
|
|
565
|
+
lines.push(` ${offsetToPercent(offset)} {`);
|
|
566
|
+
for (const prop of pattern.properties) {
|
|
567
|
+
const kf = prop.keyframes?.find((k) => k.offset === offset);
|
|
568
|
+
if (kf) {
|
|
569
|
+
lines.push(` ${prop.name}: ${kf.value};`);
|
|
570
|
+
} else if (offset === 0) {
|
|
571
|
+
lines.push(` ${prop.name}: ${prop.from};`);
|
|
572
|
+
} else if (offset === 1) {
|
|
573
|
+
lines.push(` ${prop.name}: ${prop.to};`);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
lines.push(" }");
|
|
577
|
+
}
|
|
578
|
+
} else {
|
|
579
|
+
lines.push(" from {");
|
|
580
|
+
for (const prop of pattern.properties) {
|
|
581
|
+
lines.push(` ${prop.name}: ${prop.from};`);
|
|
582
|
+
}
|
|
583
|
+
lines.push(" }");
|
|
584
|
+
lines.push(" to {");
|
|
585
|
+
for (const prop of pattern.properties) {
|
|
586
|
+
lines.push(` ${prop.name}: ${prop.to};`);
|
|
587
|
+
}
|
|
588
|
+
lines.push(" }");
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
lines.push("`;");
|
|
592
|
+
lines.push("");
|
|
593
|
+
|
|
594
|
+
const iterationsVal = pattern.iterations === "infinite" ? "infinite" : pattern.iterations;
|
|
595
|
+
const directionVal = pattern.direction !== "normal" ? pattern.direction : "";
|
|
596
|
+
const fillModeVal = pattern.fillMode !== "none" ? pattern.fillMode : "";
|
|
597
|
+
|
|
598
|
+
lines.push(`const ${componentName}Container = styled.div\``);
|
|
599
|
+
lines.push(
|
|
600
|
+
` animation: \${${pattern.name}Keyframes} ${formatDuration(pattern.duration)} ${pattern.easing}${pattern.delay > 0 ? ` ${formatDuration(pattern.delay)}` : ""}${iterationsVal !== 1 ? ` ${iterationsVal}` : ""}${directionVal ? ` ${directionVal}` : ""}${fillModeVal ? ` ${fillModeVal}` : ""};`
|
|
601
|
+
);
|
|
602
|
+
|
|
603
|
+
if (options.includeReducedMotion) {
|
|
604
|
+
lines.push("");
|
|
605
|
+
lines.push(" @media (prefers-reduced-motion: reduce) {");
|
|
606
|
+
lines.push(" animation: none;");
|
|
607
|
+
lines.push(" }");
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
lines.push("`;");
|
|
611
|
+
lines.push("");
|
|
612
|
+
|
|
613
|
+
if (ts) {
|
|
614
|
+
lines.push(`interface ${componentName}Props {`);
|
|
615
|
+
lines.push(" children: ReactNode;");
|
|
616
|
+
lines.push(" className?: string;");
|
|
617
|
+
lines.push("}");
|
|
618
|
+
lines.push("");
|
|
619
|
+
lines.push(
|
|
620
|
+
`export const ${componentName}: FC<${componentName}Props> = ({ children, className }) => {`
|
|
621
|
+
);
|
|
622
|
+
} else {
|
|
623
|
+
lines.push(`export const ${componentName} = ({ children, className }) => {`);
|
|
624
|
+
}
|
|
625
|
+
lines.push(
|
|
626
|
+
` return <${componentName}Container className={className}>{children}</${componentName}Container>;`
|
|
627
|
+
);
|
|
628
|
+
lines.push("};");
|
|
629
|
+
|
|
630
|
+
const code = lines.join("\n");
|
|
631
|
+
|
|
632
|
+
return {
|
|
633
|
+
code,
|
|
634
|
+
metadata: {
|
|
635
|
+
linesOfCode: countLines(code),
|
|
636
|
+
hasKeyframes: true,
|
|
637
|
+
hasReducedMotion: options.includeReducedMotion ?? true,
|
|
638
|
+
dependencies: ["styled-components"],
|
|
639
|
+
},
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Emotion生成
|
|
645
|
+
*/
|
|
646
|
+
function generateEmotion(
|
|
647
|
+
pattern: MotionPatternInput,
|
|
648
|
+
options: ImplementationOptions
|
|
649
|
+
): GenerationResult {
|
|
650
|
+
const lines: string[] = [];
|
|
651
|
+
const componentName = options.componentName || toPascalCase(pattern.name) + "Animation";
|
|
652
|
+
const ts = options.typescript ?? true;
|
|
653
|
+
|
|
654
|
+
lines.push("/** @jsxImportSource @emotion/react */");
|
|
655
|
+
lines.push("import { css, keyframes } from '@emotion/react';");
|
|
656
|
+
if (ts) {
|
|
657
|
+
lines.push("import type { FC, ReactNode } from 'react';");
|
|
658
|
+
}
|
|
659
|
+
lines.push("");
|
|
660
|
+
|
|
661
|
+
lines.push(`const ${pattern.name}Keyframes = keyframes\``);
|
|
662
|
+
|
|
663
|
+
if (pattern.properties.some((p) => p.keyframes && p.keyframes.length > 0)) {
|
|
664
|
+
const allOffsets = new Set<number>();
|
|
665
|
+
pattern.properties.forEach((prop) => {
|
|
666
|
+
prop.keyframes?.forEach((kf) => allOffsets.add(kf.offset));
|
|
667
|
+
});
|
|
668
|
+
allOffsets.add(0);
|
|
669
|
+
allOffsets.add(1);
|
|
670
|
+
|
|
671
|
+
const sortedOffsets = Array.from(allOffsets).sort((a, b) => a - b);
|
|
672
|
+
|
|
673
|
+
for (const offset of sortedOffsets) {
|
|
674
|
+
lines.push(` ${offsetToPercent(offset)} {`);
|
|
675
|
+
for (const prop of pattern.properties) {
|
|
676
|
+
const kf = prop.keyframes?.find((k) => k.offset === offset);
|
|
677
|
+
if (kf) {
|
|
678
|
+
lines.push(` ${prop.name}: ${kf.value};`);
|
|
679
|
+
} else if (offset === 0) {
|
|
680
|
+
lines.push(` ${prop.name}: ${prop.from};`);
|
|
681
|
+
} else if (offset === 1) {
|
|
682
|
+
lines.push(` ${prop.name}: ${prop.to};`);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
lines.push(" }");
|
|
686
|
+
}
|
|
687
|
+
} else {
|
|
688
|
+
lines.push(" from {");
|
|
689
|
+
for (const prop of pattern.properties) {
|
|
690
|
+
lines.push(` ${prop.name}: ${prop.from};`);
|
|
691
|
+
}
|
|
692
|
+
lines.push(" }");
|
|
693
|
+
lines.push(" to {");
|
|
694
|
+
for (const prop of pattern.properties) {
|
|
695
|
+
lines.push(` ${prop.name}: ${prop.to};`);
|
|
696
|
+
}
|
|
697
|
+
lines.push(" }");
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
lines.push("`;");
|
|
701
|
+
lines.push("");
|
|
702
|
+
|
|
703
|
+
const iterationsVal = pattern.iterations === "infinite" ? "infinite" : pattern.iterations;
|
|
704
|
+
const directionVal = pattern.direction !== "normal" ? pattern.direction : "";
|
|
705
|
+
const fillModeVal = pattern.fillMode !== "none" ? pattern.fillMode : "";
|
|
706
|
+
|
|
707
|
+
lines.push(`const ${pattern.name}Style = css\``);
|
|
708
|
+
lines.push(
|
|
709
|
+
` animation: \${${pattern.name}Keyframes} ${formatDuration(pattern.duration)} ${pattern.easing}${pattern.delay > 0 ? ` ${formatDuration(pattern.delay)}` : ""}${iterationsVal !== 1 ? ` ${iterationsVal}` : ""}${directionVal ? ` ${directionVal}` : ""}${fillModeVal ? ` ${fillModeVal}` : ""};`
|
|
710
|
+
);
|
|
711
|
+
|
|
712
|
+
if (options.includeReducedMotion) {
|
|
713
|
+
lines.push("");
|
|
714
|
+
lines.push(" @media (prefers-reduced-motion: reduce) {");
|
|
715
|
+
lines.push(" animation: none;");
|
|
716
|
+
lines.push(" }");
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
lines.push("`;");
|
|
720
|
+
lines.push("");
|
|
721
|
+
|
|
722
|
+
if (ts) {
|
|
723
|
+
lines.push(`interface ${componentName}Props {`);
|
|
724
|
+
lines.push(" children: ReactNode;");
|
|
725
|
+
lines.push(" className?: string;");
|
|
726
|
+
lines.push("}");
|
|
727
|
+
lines.push("");
|
|
728
|
+
lines.push(
|
|
729
|
+
`export const ${componentName}: FC<${componentName}Props> = ({ children, className }) => {`
|
|
730
|
+
);
|
|
731
|
+
} else {
|
|
732
|
+
lines.push(`export const ${componentName} = ({ children, className }) => {`);
|
|
733
|
+
}
|
|
734
|
+
lines.push(` return <div css={${pattern.name}Style} className={className}>{children}</div>;`);
|
|
735
|
+
lines.push("};");
|
|
736
|
+
|
|
737
|
+
const code = lines.join("\n");
|
|
738
|
+
|
|
739
|
+
return {
|
|
740
|
+
code,
|
|
741
|
+
metadata: {
|
|
742
|
+
linesOfCode: countLines(code),
|
|
743
|
+
hasKeyframes: true,
|
|
744
|
+
hasReducedMotion: options.includeReducedMotion ?? true,
|
|
745
|
+
dependencies: ["@emotion/react"],
|
|
746
|
+
},
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Framer Motion生成
|
|
752
|
+
*/
|
|
753
|
+
function generateFramerMotion(
|
|
754
|
+
pattern: MotionPatternInput,
|
|
755
|
+
options: ImplementationOptions
|
|
756
|
+
): GenerationResult {
|
|
757
|
+
const lines: string[] = [];
|
|
758
|
+
const componentName = options.componentName || toPascalCase(pattern.name) + "Motion";
|
|
759
|
+
const ts = options.typescript ?? true;
|
|
760
|
+
const isScroll = pattern.type === "scroll";
|
|
761
|
+
|
|
762
|
+
lines.push("import { motion } from 'framer-motion';");
|
|
763
|
+
if (ts) {
|
|
764
|
+
lines.push("import type { FC, ReactNode } from 'react';");
|
|
765
|
+
}
|
|
766
|
+
lines.push("");
|
|
767
|
+
|
|
768
|
+
lines.push(`const ${pattern.name}Variants = {`);
|
|
769
|
+
lines.push(" initial: {");
|
|
770
|
+
for (const prop of pattern.properties) {
|
|
771
|
+
const cssName = prop.name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
772
|
+
lines.push(` ${cssName}: ${JSON.stringify(prop.from)},`);
|
|
773
|
+
}
|
|
774
|
+
lines.push(" },");
|
|
775
|
+
lines.push(" animate: {");
|
|
776
|
+
for (const prop of pattern.properties) {
|
|
777
|
+
const cssName = prop.name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
778
|
+
lines.push(` ${cssName}: ${JSON.stringify(prop.to)},`);
|
|
779
|
+
}
|
|
780
|
+
lines.push(" },");
|
|
781
|
+
lines.push("};");
|
|
782
|
+
lines.push("");
|
|
783
|
+
|
|
784
|
+
lines.push(`const ${pattern.name}Transition = {`);
|
|
785
|
+
lines.push(` duration: ${pattern.duration / 1000},`);
|
|
786
|
+
lines.push(` ease: ${JSON.stringify(pattern.easing)},`);
|
|
787
|
+
if (pattern.delay > 0) {
|
|
788
|
+
lines.push(` delay: ${pattern.delay / 1000},`);
|
|
789
|
+
}
|
|
790
|
+
if (pattern.iterations === "infinite") {
|
|
791
|
+
lines.push(" repeat: Infinity,");
|
|
792
|
+
} else if (pattern.iterations > 1) {
|
|
793
|
+
lines.push(` repeat: ${pattern.iterations - 1},`);
|
|
794
|
+
}
|
|
795
|
+
if (pattern.direction === "alternate" || pattern.direction === "alternate-reverse") {
|
|
796
|
+
lines.push(" repeatType: 'reverse',");
|
|
797
|
+
}
|
|
798
|
+
lines.push("};");
|
|
799
|
+
lines.push("");
|
|
800
|
+
|
|
801
|
+
if (ts) {
|
|
802
|
+
lines.push(`interface ${componentName}Props {`);
|
|
803
|
+
lines.push(" children: ReactNode;");
|
|
804
|
+
lines.push(" className?: string;");
|
|
805
|
+
lines.push("}");
|
|
806
|
+
lines.push("");
|
|
807
|
+
lines.push(
|
|
808
|
+
`export const ${componentName}: FC<${componentName}Props> = ({ children, className }) => {`
|
|
809
|
+
);
|
|
810
|
+
} else {
|
|
811
|
+
lines.push(`export const ${componentName} = ({ children, className }) => {`);
|
|
812
|
+
}
|
|
813
|
+
lines.push(" return (");
|
|
814
|
+
lines.push(" <motion.div");
|
|
815
|
+
lines.push(` variants={${pattern.name}Variants}`);
|
|
816
|
+
lines.push(' initial="initial"');
|
|
817
|
+
|
|
818
|
+
if (isScroll) {
|
|
819
|
+
lines.push(' whileInView="animate"');
|
|
820
|
+
lines.push(" viewport={{ once: true }}");
|
|
821
|
+
} else {
|
|
822
|
+
lines.push(' animate="animate"');
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
lines.push(` transition={${pattern.name}Transition}`);
|
|
826
|
+
lines.push(" className={className}");
|
|
827
|
+
lines.push(" >");
|
|
828
|
+
lines.push(" {children}");
|
|
829
|
+
lines.push(" </motion.div>");
|
|
830
|
+
lines.push(" );");
|
|
831
|
+
lines.push("};");
|
|
832
|
+
|
|
833
|
+
if (options.includeReducedMotion) {
|
|
834
|
+
lines.push("");
|
|
835
|
+
lines.push("/* Note: Framer Motion automatically respects prefers-reduced-motion */");
|
|
836
|
+
lines.push(
|
|
837
|
+
'/* Set reducedMotion="user" in AnimatePresence or MotionConfig for custom handling */'
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
const code = lines.join("\n");
|
|
842
|
+
|
|
843
|
+
return {
|
|
844
|
+
code,
|
|
845
|
+
metadata: {
|
|
846
|
+
linesOfCode: countLines(code),
|
|
847
|
+
hasKeyframes: false,
|
|
848
|
+
hasReducedMotion: options.includeReducedMotion ?? true,
|
|
849
|
+
dependencies: ["framer-motion"],
|
|
850
|
+
},
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* GSAP生成
|
|
856
|
+
*/
|
|
857
|
+
function generateGSAP(
|
|
858
|
+
pattern: MotionPatternInput,
|
|
859
|
+
options: ImplementationOptions
|
|
860
|
+
): GenerationResult {
|
|
861
|
+
const lines: string[] = [];
|
|
862
|
+
const componentName = options.componentName || toPascalCase(pattern.name) + "GSAP";
|
|
863
|
+
const ts = options.typescript ?? true;
|
|
864
|
+
const isScroll = pattern.type === "scroll";
|
|
865
|
+
|
|
866
|
+
lines.push("import { gsap } from 'gsap';");
|
|
867
|
+
if (isScroll) {
|
|
868
|
+
lines.push("import { ScrollTrigger } from 'gsap/ScrollTrigger';");
|
|
869
|
+
lines.push("");
|
|
870
|
+
lines.push("gsap.registerPlugin(ScrollTrigger);");
|
|
871
|
+
}
|
|
872
|
+
if (ts) {
|
|
873
|
+
lines.push("import { useRef, useEffect } from 'react';");
|
|
874
|
+
lines.push("import type { FC, ReactNode } from 'react';");
|
|
875
|
+
} else {
|
|
876
|
+
lines.push("import { useRef, useEffect } from 'react';");
|
|
877
|
+
}
|
|
878
|
+
lines.push("");
|
|
879
|
+
|
|
880
|
+
lines.push(
|
|
881
|
+
`const use${toPascalCase(pattern.name)}Animation = (ref${ts ? ": React.RefObject<HTMLDivElement>" : ""}) => {`
|
|
882
|
+
);
|
|
883
|
+
lines.push(" useEffect(() => {");
|
|
884
|
+
lines.push(" if (!ref.current) return;");
|
|
885
|
+
lines.push("");
|
|
886
|
+
|
|
887
|
+
const toProps: string[] = [];
|
|
888
|
+
for (const prop of pattern.properties) {
|
|
889
|
+
const propName = prop.name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
890
|
+
toProps.push(` ${propName}: ${JSON.stringify(prop.to)}`);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
const fromProps: string[] = [];
|
|
894
|
+
for (const prop of pattern.properties) {
|
|
895
|
+
const propName = prop.name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
896
|
+
fromProps.push(` ${propName}: ${JSON.stringify(prop.from)}`);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
lines.push(" const animation = gsap.fromTo(");
|
|
900
|
+
lines.push(" ref.current,");
|
|
901
|
+
lines.push(" {");
|
|
902
|
+
lines.push(fromProps.join(",\n"));
|
|
903
|
+
lines.push(" },");
|
|
904
|
+
lines.push(" {");
|
|
905
|
+
lines.push(toProps.join(",\n") + ",");
|
|
906
|
+
lines.push(` duration: ${pattern.duration / 1000},`);
|
|
907
|
+
lines.push(` ease: ${JSON.stringify(pattern.easing)},`);
|
|
908
|
+
if (pattern.delay > 0) {
|
|
909
|
+
lines.push(` delay: ${pattern.delay / 1000},`);
|
|
910
|
+
}
|
|
911
|
+
if (pattern.iterations === "infinite") {
|
|
912
|
+
lines.push(" repeat: -1,");
|
|
913
|
+
} else if (pattern.iterations > 1) {
|
|
914
|
+
lines.push(` repeat: ${pattern.iterations - 1},`);
|
|
915
|
+
}
|
|
916
|
+
if (pattern.direction === "alternate" || pattern.direction === "alternate-reverse") {
|
|
917
|
+
lines.push(" yoyo: true,");
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (isScroll) {
|
|
921
|
+
lines.push(" scrollTrigger: {");
|
|
922
|
+
lines.push(" trigger: ref.current,");
|
|
923
|
+
lines.push(" start: 'top 80%',");
|
|
924
|
+
lines.push(" end: 'bottom 20%',");
|
|
925
|
+
lines.push(" toggleActions: 'play none none reverse',");
|
|
926
|
+
lines.push(" },");
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
lines.push(" }");
|
|
930
|
+
lines.push(" );");
|
|
931
|
+
lines.push("");
|
|
932
|
+
lines.push(" return () => {");
|
|
933
|
+
lines.push(" animation.kill();");
|
|
934
|
+
lines.push(" };");
|
|
935
|
+
lines.push(" }, [ref]);");
|
|
936
|
+
lines.push("};");
|
|
937
|
+
lines.push("");
|
|
938
|
+
|
|
939
|
+
if (ts) {
|
|
940
|
+
lines.push(`interface ${componentName}Props {`);
|
|
941
|
+
lines.push(" children: ReactNode;");
|
|
942
|
+
lines.push(" className?: string;");
|
|
943
|
+
lines.push("}");
|
|
944
|
+
lines.push("");
|
|
945
|
+
lines.push(
|
|
946
|
+
`export const ${componentName}: FC<${componentName}Props> = ({ children, className }) => {`
|
|
947
|
+
);
|
|
948
|
+
} else {
|
|
949
|
+
lines.push(`export const ${componentName} = ({ children, className }) => {`);
|
|
950
|
+
}
|
|
951
|
+
lines.push(` const ref = useRef${ts ? "<HTMLDivElement>" : ""}(null);`);
|
|
952
|
+
lines.push(` use${toPascalCase(pattern.name)}Animation(ref);`);
|
|
953
|
+
lines.push("");
|
|
954
|
+
lines.push(" return (");
|
|
955
|
+
lines.push(" <div ref={ref} className={className}>");
|
|
956
|
+
lines.push(" {children}");
|
|
957
|
+
lines.push(" </div>");
|
|
958
|
+
lines.push(" );");
|
|
959
|
+
lines.push("};");
|
|
960
|
+
|
|
961
|
+
if (options.includeReducedMotion) {
|
|
962
|
+
lines.push("");
|
|
963
|
+
lines.push("/* Add reduced motion check */");
|
|
964
|
+
lines.push(
|
|
965
|
+
'// const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;'
|
|
966
|
+
);
|
|
967
|
+
lines.push("// if (prefersReducedMotion) return;");
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
const code = lines.join("\n");
|
|
971
|
+
const dependencies = isScroll ? ["gsap", "gsap/ScrollTrigger"] : ["gsap"];
|
|
972
|
+
|
|
973
|
+
return {
|
|
974
|
+
code,
|
|
975
|
+
metadata: {
|
|
976
|
+
linesOfCode: countLines(code),
|
|
977
|
+
hasKeyframes: false,
|
|
978
|
+
hasReducedMotion: options.includeReducedMotion ?? true,
|
|
979
|
+
dependencies,
|
|
980
|
+
},
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Three.js (React Three Fiber) 生成
|
|
986
|
+
*
|
|
987
|
+
* @react-three/fiber を使用した3Dアニメーションコードを生成
|
|
988
|
+
* - useFrame によるアニメーションループ
|
|
989
|
+
* - scroll-driven アニメーション対応
|
|
990
|
+
* - TypeScript 型定義付き
|
|
991
|
+
*/
|
|
992
|
+
function generateThreeJS(
|
|
993
|
+
pattern: MotionPatternInput,
|
|
994
|
+
options: ImplementationOptions
|
|
995
|
+
): GenerationResult {
|
|
996
|
+
const lines: string[] = [];
|
|
997
|
+
const componentName = options.componentName || toPascalCase(pattern.name) + "Scene";
|
|
998
|
+
const ts = options.typescript ?? true;
|
|
999
|
+
const isScroll = pattern.type === "scroll";
|
|
1000
|
+
|
|
1001
|
+
// Imports
|
|
1002
|
+
lines.push("import { useRef } from 'react';");
|
|
1003
|
+
lines.push("import { Canvas, useFrame } from '@react-three/fiber';");
|
|
1004
|
+
if (isScroll) {
|
|
1005
|
+
lines.push("import { useScroll } from '@react-three/drei';");
|
|
1006
|
+
}
|
|
1007
|
+
if (ts) {
|
|
1008
|
+
lines.push("import type { FC } from 'react';");
|
|
1009
|
+
lines.push("import type { Mesh, Group } from 'three';");
|
|
1010
|
+
}
|
|
1011
|
+
lines.push("");
|
|
1012
|
+
|
|
1013
|
+
// Extract animation properties and convert to Three.js-compatible values
|
|
1014
|
+
const positionProps = pattern.properties.filter((p) =>
|
|
1015
|
+
["translateX", "translateY", "translateZ", "x", "y", "z"].includes(p.name)
|
|
1016
|
+
);
|
|
1017
|
+
const rotationProps = pattern.properties.filter((p) =>
|
|
1018
|
+
["rotateX", "rotateY", "rotateZ", "rotate"].includes(p.name)
|
|
1019
|
+
);
|
|
1020
|
+
const scaleProps = pattern.properties.filter((p) =>
|
|
1021
|
+
["scale", "scaleX", "scaleY", "scaleZ"].includes(p.name)
|
|
1022
|
+
);
|
|
1023
|
+
const opacityProps = pattern.properties.filter((p) => ["opacity"].includes(p.name));
|
|
1024
|
+
|
|
1025
|
+
// Helper function name
|
|
1026
|
+
const animatedObjectName = toPascalCase(pattern.name) + "Object";
|
|
1027
|
+
|
|
1028
|
+
// Animated Object Component
|
|
1029
|
+
if (ts) {
|
|
1030
|
+
lines.push(`interface ${animatedObjectName}Props {`);
|
|
1031
|
+
lines.push(" children?: React.ReactNode;");
|
|
1032
|
+
lines.push("}");
|
|
1033
|
+
lines.push("");
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
lines.push(
|
|
1037
|
+
`const ${animatedObjectName}${ts ? `: FC<${animatedObjectName}Props>` : ""} = ({ children }) => {`
|
|
1038
|
+
);
|
|
1039
|
+
lines.push(` const meshRef = useRef${ts ? "<Mesh>" : ""}(null);`);
|
|
1040
|
+
|
|
1041
|
+
if (isScroll) {
|
|
1042
|
+
lines.push(" const scroll = useScroll();");
|
|
1043
|
+
lines.push("");
|
|
1044
|
+
lines.push(" useFrame(() => {");
|
|
1045
|
+
lines.push(" if (!meshRef.current) return;");
|
|
1046
|
+
lines.push(" const progress = scroll.offset;");
|
|
1047
|
+
} else {
|
|
1048
|
+
lines.push(` const duration = ${pattern.duration / 1000}; // seconds`);
|
|
1049
|
+
lines.push(` const startTime = useRef${ts ? "<number>" : ""}(0);`);
|
|
1050
|
+
lines.push("");
|
|
1051
|
+
lines.push(" useFrame((state) => {");
|
|
1052
|
+
lines.push(" if (!meshRef.current) return;");
|
|
1053
|
+
lines.push(" if (startTime.current === 0) startTime.current = state.clock.elapsedTime;");
|
|
1054
|
+
lines.push("");
|
|
1055
|
+
lines.push(" const elapsed = state.clock.elapsedTime - startTime.current;");
|
|
1056
|
+
if (pattern.iterations === "infinite") {
|
|
1057
|
+
lines.push(" const progress = (elapsed % duration) / duration;");
|
|
1058
|
+
} else {
|
|
1059
|
+
lines.push(" const progress = Math.min(elapsed / duration, 1);");
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
lines.push("");
|
|
1064
|
+
|
|
1065
|
+
// Apply easing
|
|
1066
|
+
lines.push(" // Apply easing function");
|
|
1067
|
+
lines.push(
|
|
1068
|
+
` const eased = ease${toPascalCase(pattern.easing.replace(/[^a-zA-Z]/g, ""))}(progress);`
|
|
1069
|
+
);
|
|
1070
|
+
lines.push("");
|
|
1071
|
+
|
|
1072
|
+
// Position animations
|
|
1073
|
+
if (positionProps.length > 0) {
|
|
1074
|
+
lines.push(" // Position animation");
|
|
1075
|
+
for (const prop of positionProps) {
|
|
1076
|
+
const axis =
|
|
1077
|
+
prop.name.replace(/translate|[XYZ]/gi, "").toLowerCase() ||
|
|
1078
|
+
prop.name.charAt(prop.name.length - 1).toLowerCase();
|
|
1079
|
+
const fromVal = parseFloat(prop.from) || 0;
|
|
1080
|
+
const toVal = parseFloat(prop.to) || 0;
|
|
1081
|
+
lines.push(
|
|
1082
|
+
` meshRef.current.position.${axis} = ${fromVal} + (${toVal} - ${fromVal}) * eased;`
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// Rotation animations
|
|
1088
|
+
if (rotationProps.length > 0) {
|
|
1089
|
+
lines.push(" // Rotation animation");
|
|
1090
|
+
for (const prop of rotationProps) {
|
|
1091
|
+
const axis = prop.name.replace("rotate", "").toLowerCase() || "y";
|
|
1092
|
+
const fromVal = parseFloat(prop.from) || 0;
|
|
1093
|
+
const toVal = parseFloat(prop.to) || Math.PI * 2;
|
|
1094
|
+
lines.push(
|
|
1095
|
+
` meshRef.current.rotation.${axis} = ${fromVal} + (${toVal} - ${fromVal}) * eased;`
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
// Scale animations
|
|
1101
|
+
const scaleProp = scaleProps[0];
|
|
1102
|
+
if (scaleProp) {
|
|
1103
|
+
lines.push(" // Scale animation");
|
|
1104
|
+
const fromVal = parseFloat(scaleProp.from) || 1;
|
|
1105
|
+
const toVal = parseFloat(scaleProp.to) || 1;
|
|
1106
|
+
lines.push(` const scaleValue = ${fromVal} + (${toVal} - ${fromVal}) * eased;`);
|
|
1107
|
+
lines.push(" meshRef.current.scale.setScalar(scaleValue);");
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
// Opacity animations (material)
|
|
1111
|
+
const opacityProp = opacityProps[0];
|
|
1112
|
+
if (opacityProp) {
|
|
1113
|
+
lines.push(" // Opacity animation");
|
|
1114
|
+
const fromVal = parseFloat(opacityProp.from) || 1;
|
|
1115
|
+
const toVal = parseFloat(opacityProp.to) || 0;
|
|
1116
|
+
lines.push(` if (meshRef.current.material && 'opacity' in meshRef.current.material) {`);
|
|
1117
|
+
lines.push(
|
|
1118
|
+
` (meshRef.current.material as any).opacity = ${fromVal} + (${toVal} - ${fromVal}) * eased;`
|
|
1119
|
+
);
|
|
1120
|
+
lines.push(" }");
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
lines.push(" });");
|
|
1124
|
+
lines.push("");
|
|
1125
|
+
lines.push(" return (");
|
|
1126
|
+
lines.push(" <mesh ref={meshRef}>");
|
|
1127
|
+
lines.push(" {children || (");
|
|
1128
|
+
lines.push(" <>");
|
|
1129
|
+
lines.push(" <boxGeometry args={[1, 1, 1]} />");
|
|
1130
|
+
lines.push(' <meshStandardMaterial color="#4f46e5" transparent />');
|
|
1131
|
+
lines.push(" </>");
|
|
1132
|
+
lines.push(" )}");
|
|
1133
|
+
lines.push(" </mesh>");
|
|
1134
|
+
lines.push(" );");
|
|
1135
|
+
lines.push("};");
|
|
1136
|
+
lines.push("");
|
|
1137
|
+
|
|
1138
|
+
// Easing function
|
|
1139
|
+
lines.push("// Easing function");
|
|
1140
|
+
const easingName = `ease${toPascalCase(pattern.easing.replace(/[^a-zA-Z]/g, ""))}`;
|
|
1141
|
+
lines.push(`function ${easingName}(t${ts ? ": number" : ""})${ts ? ": number" : ""} {`);
|
|
1142
|
+
switch (pattern.easing) {
|
|
1143
|
+
case "ease-in":
|
|
1144
|
+
lines.push(" return t * t;");
|
|
1145
|
+
break;
|
|
1146
|
+
case "ease-out":
|
|
1147
|
+
lines.push(" return t * (2 - t);");
|
|
1148
|
+
break;
|
|
1149
|
+
case "ease-in-out":
|
|
1150
|
+
lines.push(" return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;");
|
|
1151
|
+
break;
|
|
1152
|
+
case "linear":
|
|
1153
|
+
lines.push(" return t;");
|
|
1154
|
+
break;
|
|
1155
|
+
default:
|
|
1156
|
+
// Default to ease-out for unknown easing
|
|
1157
|
+
lines.push(" return t * (2 - t);");
|
|
1158
|
+
}
|
|
1159
|
+
lines.push("}");
|
|
1160
|
+
lines.push("");
|
|
1161
|
+
|
|
1162
|
+
// Main Scene Component
|
|
1163
|
+
if (ts) {
|
|
1164
|
+
lines.push(`interface ${componentName}Props {`);
|
|
1165
|
+
lines.push(" className?: string;");
|
|
1166
|
+
lines.push("}");
|
|
1167
|
+
lines.push("");
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
lines.push(
|
|
1171
|
+
`export const ${componentName}${ts ? `: FC<${componentName}Props>` : ""} = ({ className }) => {`
|
|
1172
|
+
);
|
|
1173
|
+
|
|
1174
|
+
if (options.includeReducedMotion) {
|
|
1175
|
+
lines.push(" // Check for reduced motion preference");
|
|
1176
|
+
lines.push(' const prefersReducedMotion = typeof window !== "undefined"');
|
|
1177
|
+
lines.push(' && window.matchMedia("(prefers-reduced-motion: reduce)").matches;');
|
|
1178
|
+
lines.push("");
|
|
1179
|
+
lines.push(" if (prefersReducedMotion) {");
|
|
1180
|
+
lines.push(" return (");
|
|
1181
|
+
lines.push(
|
|
1182
|
+
' <div className={className} style={{ width: "100%", height: "400px", background: "#1a1a2e" }}>'
|
|
1183
|
+
);
|
|
1184
|
+
lines.push(" {/* Static fallback for reduced motion */}");
|
|
1185
|
+
lines.push(" </div>");
|
|
1186
|
+
lines.push(" );");
|
|
1187
|
+
lines.push(" }");
|
|
1188
|
+
lines.push("");
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
lines.push(" return (");
|
|
1192
|
+
lines.push(' <div className={className} style={{ width: "100%", height: "400px" }}>');
|
|
1193
|
+
lines.push(" <Canvas camera={{ position: [0, 0, 5], fov: 50 }}>");
|
|
1194
|
+
lines.push(" <ambientLight intensity={0.5} />");
|
|
1195
|
+
lines.push(" <pointLight position={[10, 10, 10]} />");
|
|
1196
|
+
lines.push(` <${animatedObjectName} />`);
|
|
1197
|
+
lines.push(" </Canvas>");
|
|
1198
|
+
lines.push(" </div>");
|
|
1199
|
+
lines.push(" );");
|
|
1200
|
+
lines.push("};");
|
|
1201
|
+
|
|
1202
|
+
const code = lines.join("\n");
|
|
1203
|
+
const dependencies = isScroll
|
|
1204
|
+
? ["@react-three/fiber", "@react-three/drei", "three"]
|
|
1205
|
+
: ["@react-three/fiber", "three"];
|
|
1206
|
+
|
|
1207
|
+
return {
|
|
1208
|
+
code,
|
|
1209
|
+
metadata: {
|
|
1210
|
+
linesOfCode: countLines(code),
|
|
1211
|
+
hasKeyframes: false,
|
|
1212
|
+
hasReducedMotion: options.includeReducedMotion ?? true,
|
|
1213
|
+
dependencies,
|
|
1214
|
+
},
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Lottie (lottie-react) 生成
|
|
1220
|
+
*
|
|
1221
|
+
* lottie-react を使用したアニメーションコンポーネントを生成
|
|
1222
|
+
* - アニメーションデータ構造生成(Lottie JSON形式)
|
|
1223
|
+
* - React コンポーネントラッパー
|
|
1224
|
+
* - TypeScript 型定義付き
|
|
1225
|
+
*/
|
|
1226
|
+
function generateLottie(
|
|
1227
|
+
pattern: MotionPatternInput,
|
|
1228
|
+
options: ImplementationOptions
|
|
1229
|
+
): GenerationResult {
|
|
1230
|
+
const lines: string[] = [];
|
|
1231
|
+
const componentName = options.componentName || toPascalCase(pattern.name) + "Animation";
|
|
1232
|
+
const ts = options.typescript ?? true;
|
|
1233
|
+
|
|
1234
|
+
// Imports
|
|
1235
|
+
lines.push("import Lottie from 'lottie-react';");
|
|
1236
|
+
if (ts) {
|
|
1237
|
+
lines.push("import type { FC } from 'react';");
|
|
1238
|
+
lines.push("import type { LottieComponentProps } from 'lottie-react';");
|
|
1239
|
+
}
|
|
1240
|
+
lines.push("");
|
|
1241
|
+
|
|
1242
|
+
// Convert CSS animation properties to Lottie keyframes format
|
|
1243
|
+
// Note: This generates a simplified Lottie JSON structure
|
|
1244
|
+
lines.push("/**");
|
|
1245
|
+
lines.push(" * Lottie Animation Data");
|
|
1246
|
+
lines.push(" * Generated from CSS animation pattern.");
|
|
1247
|
+
lines.push(
|
|
1248
|
+
" * For complex animations, replace with actual Lottie JSON export from After Effects/Figma."
|
|
1249
|
+
);
|
|
1250
|
+
lines.push(" */");
|
|
1251
|
+
|
|
1252
|
+
// Generate Lottie-like animation data structure
|
|
1253
|
+
const durationInFrames = Math.round((pattern.duration / 1000) * 60); // 60fps
|
|
1254
|
+
const startFrame = Math.round((pattern.delay / 1000) * 60);
|
|
1255
|
+
|
|
1256
|
+
lines.push(`const ${pattern.name}AnimationData = {`);
|
|
1257
|
+
lines.push(' v: "5.7.8",');
|
|
1258
|
+
lines.push(` fr: 60,`); // Frame rate
|
|
1259
|
+
lines.push(` ip: ${startFrame},`); // In point
|
|
1260
|
+
lines.push(` op: ${startFrame + durationInFrames},`); // Out point
|
|
1261
|
+
lines.push(" w: 200,"); // Width
|
|
1262
|
+
lines.push(" h: 200,"); // Height
|
|
1263
|
+
lines.push(' nm: "' + pattern.name + '",');
|
|
1264
|
+
lines.push(" ddd: 0,");
|
|
1265
|
+
lines.push(" assets: [],");
|
|
1266
|
+
lines.push(" layers: [");
|
|
1267
|
+
lines.push(" {");
|
|
1268
|
+
lines.push(" ddd: 0,");
|
|
1269
|
+
lines.push(" ind: 1,");
|
|
1270
|
+
lines.push(" ty: 4,"); // Shape layer
|
|
1271
|
+
lines.push(` nm: "${pattern.name}",`);
|
|
1272
|
+
lines.push(` sr: 1,`);
|
|
1273
|
+
lines.push(" ks: {"); // Transform
|
|
1274
|
+
|
|
1275
|
+
// Opacity animation
|
|
1276
|
+
const opacityProp = pattern.properties.find((p) => p.name === "opacity");
|
|
1277
|
+
if (opacityProp) {
|
|
1278
|
+
const fromOpacity = parseFloat(opacityProp.from) * 100 || 0;
|
|
1279
|
+
const toOpacity = parseFloat(opacityProp.to) * 100 || 100;
|
|
1280
|
+
lines.push(" o: {"); // Opacity
|
|
1281
|
+
lines.push(" a: 1,"); // Animated
|
|
1282
|
+
lines.push(" k: [");
|
|
1283
|
+
lines.push(
|
|
1284
|
+
` { i: { x: [0.4], y: [1] }, o: { x: [0.6], y: [0] }, t: ${startFrame}, s: [${fromOpacity}] },`
|
|
1285
|
+
);
|
|
1286
|
+
lines.push(` { t: ${startFrame + durationInFrames}, s: [${toOpacity}] }`);
|
|
1287
|
+
lines.push(" ]");
|
|
1288
|
+
lines.push(" },");
|
|
1289
|
+
} else {
|
|
1290
|
+
lines.push(" o: { a: 0, k: 100 },");
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
// Position animation (transform: translate)
|
|
1294
|
+
const translateXProp = pattern.properties.find((p) => p.name === "translateX");
|
|
1295
|
+
const translateYProp = pattern.properties.find((p) => p.name === "translateY");
|
|
1296
|
+
if (translateXProp || translateYProp) {
|
|
1297
|
+
const fromX = translateXProp ? parseFloat(translateXProp.from) || 0 : 0;
|
|
1298
|
+
const toX = translateXProp ? parseFloat(translateXProp.to) || 0 : 0;
|
|
1299
|
+
const fromY = translateYProp ? parseFloat(translateYProp.from) || 0 : 0;
|
|
1300
|
+
const toY = translateYProp ? parseFloat(translateYProp.to) || 0 : 0;
|
|
1301
|
+
lines.push(" p: {"); // Position
|
|
1302
|
+
lines.push(" a: 1,");
|
|
1303
|
+
lines.push(" k: [");
|
|
1304
|
+
lines.push(
|
|
1305
|
+
` { i: { x: 0.4, y: 1 }, o: { x: 0.6, y: 0 }, t: ${startFrame}, s: [${100 + fromX}, ${100 + fromY}, 0] },`
|
|
1306
|
+
);
|
|
1307
|
+
lines.push(
|
|
1308
|
+
` { t: ${startFrame + durationInFrames}, s: [${100 + toX}, ${100 + toY}, 0] }`
|
|
1309
|
+
);
|
|
1310
|
+
lines.push(" ]");
|
|
1311
|
+
lines.push(" },");
|
|
1312
|
+
} else {
|
|
1313
|
+
lines.push(" p: { a: 0, k: [100, 100, 0] },");
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// Scale animation
|
|
1317
|
+
const scaleProp = pattern.properties.find((p) => p.name === "scale");
|
|
1318
|
+
if (scaleProp) {
|
|
1319
|
+
const fromScale = parseFloat(scaleProp.from) * 100 || 100;
|
|
1320
|
+
const toScale = parseFloat(scaleProp.to) * 100 || 100;
|
|
1321
|
+
lines.push(" s: {"); // Scale
|
|
1322
|
+
lines.push(" a: 1,");
|
|
1323
|
+
lines.push(" k: [");
|
|
1324
|
+
lines.push(
|
|
1325
|
+
` { i: { x: [0.4], y: [1] }, o: { x: [0.6], y: [0] }, t: ${startFrame}, s: [${fromScale}, ${fromScale}, 100] },`
|
|
1326
|
+
);
|
|
1327
|
+
lines.push(
|
|
1328
|
+
` { t: ${startFrame + durationInFrames}, s: [${toScale}, ${toScale}, 100] }`
|
|
1329
|
+
);
|
|
1330
|
+
lines.push(" ]");
|
|
1331
|
+
lines.push(" },");
|
|
1332
|
+
} else {
|
|
1333
|
+
lines.push(" s: { a: 0, k: [100, 100, 100] },");
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
// Rotation animation
|
|
1337
|
+
const rotateProp = pattern.properties.find((p) => p.name === "rotate");
|
|
1338
|
+
if (rotateProp) {
|
|
1339
|
+
const fromRotate = parseFloat(rotateProp.from) || 0;
|
|
1340
|
+
const toRotate = parseFloat(rotateProp.to) || 0;
|
|
1341
|
+
lines.push(" r: {"); // Rotation
|
|
1342
|
+
lines.push(" a: 1,");
|
|
1343
|
+
lines.push(" k: [");
|
|
1344
|
+
lines.push(
|
|
1345
|
+
` { i: { x: [0.4], y: [1] }, o: { x: [0.6], y: [0] }, t: ${startFrame}, s: [${fromRotate}] },`
|
|
1346
|
+
);
|
|
1347
|
+
lines.push(` { t: ${startFrame + durationInFrames}, s: [${toRotate}] }`);
|
|
1348
|
+
lines.push(" ]");
|
|
1349
|
+
lines.push(" },");
|
|
1350
|
+
} else {
|
|
1351
|
+
lines.push(" r: { a: 0, k: 0 },");
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
lines.push(" a: { a: 0, k: [100, 100, 0] }"); // Anchor point
|
|
1355
|
+
lines.push(" },");
|
|
1356
|
+
|
|
1357
|
+
// Shape contents (simple rectangle)
|
|
1358
|
+
lines.push(" shapes: [");
|
|
1359
|
+
lines.push(" {");
|
|
1360
|
+
lines.push(' ty: "rc",'); // Rectangle
|
|
1361
|
+
lines.push(" d: 1,");
|
|
1362
|
+
lines.push(" s: { a: 0, k: [100, 100] },"); // Size
|
|
1363
|
+
lines.push(" p: { a: 0, k: [0, 0] },"); // Position
|
|
1364
|
+
lines.push(" r: { a: 0, k: 8 },"); // Corner radius
|
|
1365
|
+
lines.push(' nm: "Rectangle"');
|
|
1366
|
+
lines.push(" },");
|
|
1367
|
+
lines.push(" {");
|
|
1368
|
+
lines.push(' ty: "fl",'); // Fill
|
|
1369
|
+
lines.push(" c: { a: 0, k: [0.31, 0.275, 0.898, 1] },"); // Color (#4f46e5)
|
|
1370
|
+
lines.push(" o: { a: 0, k: 100 },");
|
|
1371
|
+
lines.push(' nm: "Fill"');
|
|
1372
|
+
lines.push(" }");
|
|
1373
|
+
lines.push(" ],");
|
|
1374
|
+
lines.push(` ip: ${startFrame},`);
|
|
1375
|
+
lines.push(` op: ${startFrame + durationInFrames},`);
|
|
1376
|
+
lines.push(" st: 0");
|
|
1377
|
+
lines.push(" }");
|
|
1378
|
+
lines.push(" ]");
|
|
1379
|
+
lines.push("};");
|
|
1380
|
+
lines.push("");
|
|
1381
|
+
|
|
1382
|
+
// React component
|
|
1383
|
+
if (ts) {
|
|
1384
|
+
lines.push(`interface ${componentName}Props {`);
|
|
1385
|
+
lines.push(" className?: string;");
|
|
1386
|
+
lines.push(" loop?: boolean;");
|
|
1387
|
+
lines.push(" autoplay?: boolean;");
|
|
1388
|
+
lines.push("}");
|
|
1389
|
+
lines.push("");
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
lines.push(`export const ${componentName}${ts ? `: FC<${componentName}Props>` : ""} = ({`);
|
|
1393
|
+
lines.push(" className,");
|
|
1394
|
+
lines.push(` loop = ${pattern.iterations === "infinite"},`);
|
|
1395
|
+
lines.push(" autoplay = true,");
|
|
1396
|
+
lines.push("}) => {");
|
|
1397
|
+
|
|
1398
|
+
if (options.includeReducedMotion) {
|
|
1399
|
+
lines.push(" // Check for reduced motion preference");
|
|
1400
|
+
lines.push(' const prefersReducedMotion = typeof window !== "undefined"');
|
|
1401
|
+
lines.push(' && window.matchMedia("(prefers-reduced-motion: reduce)").matches;');
|
|
1402
|
+
lines.push("");
|
|
1403
|
+
lines.push(" if (prefersReducedMotion) {");
|
|
1404
|
+
lines.push(" return (");
|
|
1405
|
+
lines.push(" <div className={className} style={{ width: 200, height: 200 }}>");
|
|
1406
|
+
lines.push(" {/* Static fallback for reduced motion */}");
|
|
1407
|
+
lines.push(
|
|
1408
|
+
' <div style={{ width: 100, height: 100, background: "#4f46e5", borderRadius: 8, margin: "auto" }} />'
|
|
1409
|
+
);
|
|
1410
|
+
lines.push(" </div>");
|
|
1411
|
+
lines.push(" );");
|
|
1412
|
+
lines.push(" }");
|
|
1413
|
+
lines.push("");
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
lines.push(" return (");
|
|
1417
|
+
lines.push(" <Lottie");
|
|
1418
|
+
lines.push(` animationData={${pattern.name}AnimationData}`);
|
|
1419
|
+
lines.push(" loop={loop}");
|
|
1420
|
+
lines.push(" autoplay={autoplay}");
|
|
1421
|
+
lines.push(" className={className}");
|
|
1422
|
+
lines.push(" style={{ width: 200, height: 200 }}");
|
|
1423
|
+
lines.push(" />");
|
|
1424
|
+
lines.push(" );");
|
|
1425
|
+
lines.push("};");
|
|
1426
|
+
lines.push("");
|
|
1427
|
+
|
|
1428
|
+
// Usage instructions
|
|
1429
|
+
lines.push("/**");
|
|
1430
|
+
lines.push(" * Usage:");
|
|
1431
|
+
lines.push(` * import { ${componentName} } from './path-to-component';`);
|
|
1432
|
+
lines.push(" *");
|
|
1433
|
+
lines.push(` * <${componentName} />`);
|
|
1434
|
+
lines.push(` * <${componentName} loop={false} autoplay={true} />`);
|
|
1435
|
+
lines.push(" *");
|
|
1436
|
+
lines.push(" * Note: For production use, export your animation from After Effects with");
|
|
1437
|
+
lines.push(" * Bodymovin plugin or from Figma, and replace the animationData above.");
|
|
1438
|
+
lines.push(" */");
|
|
1439
|
+
|
|
1440
|
+
const code = lines.join("\n");
|
|
1441
|
+
|
|
1442
|
+
return {
|
|
1443
|
+
code,
|
|
1444
|
+
metadata: {
|
|
1445
|
+
linesOfCode: countLines(code),
|
|
1446
|
+
hasKeyframes: false,
|
|
1447
|
+
hasReducedMotion: options.includeReducedMotion ?? true,
|
|
1448
|
+
dependencies: ["lottie-react"],
|
|
1449
|
+
},
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* メイン生成関数
|
|
1455
|
+
*/
|
|
1456
|
+
function generateImplementation(
|
|
1457
|
+
pattern: MotionPatternInput,
|
|
1458
|
+
format: ImplementationFormat,
|
|
1459
|
+
options: ImplementationOptions
|
|
1460
|
+
): GenerationResult {
|
|
1461
|
+
switch (format) {
|
|
1462
|
+
case "css":
|
|
1463
|
+
return generateCSS(pattern, options);
|
|
1464
|
+
case "css-module":
|
|
1465
|
+
return generateCSSModule(pattern, options);
|
|
1466
|
+
case "tailwind":
|
|
1467
|
+
return generateTailwind(pattern, options);
|
|
1468
|
+
case "styled-components":
|
|
1469
|
+
return generateStyledComponents(pattern, options);
|
|
1470
|
+
case "emotion":
|
|
1471
|
+
return generateEmotion(pattern, options);
|
|
1472
|
+
case "framer-motion":
|
|
1473
|
+
return generateFramerMotion(pattern, options);
|
|
1474
|
+
case "gsap":
|
|
1475
|
+
return generateGSAP(pattern, options);
|
|
1476
|
+
case "three-js":
|
|
1477
|
+
return generateThreeJS(pattern, options);
|
|
1478
|
+
case "lottie":
|
|
1479
|
+
return generateLottie(pattern, options);
|
|
1480
|
+
default:
|
|
1481
|
+
return generateCSS(pattern, options);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
// =====================================================
|
|
1486
|
+
// 実装コード生成ヘルパー(v0.1.0: include_implementation用)
|
|
1487
|
+
// =====================================================
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
* MotionTypeをMotionPatternInput用のtypeに変換
|
|
1491
|
+
* @param type MotionType
|
|
1492
|
+
* @returns MotionPatternInputType
|
|
1493
|
+
*/
|
|
1494
|
+
function mapMotionType(type: MotionPattern["type"]): MotionPatternInput["type"] {
|
|
1495
|
+
switch (type) {
|
|
1496
|
+
case "css_animation":
|
|
1497
|
+
case "library_animation":
|
|
1498
|
+
case "video_motion":
|
|
1499
|
+
return "animation";
|
|
1500
|
+
case "css_transition":
|
|
1501
|
+
return "transition";
|
|
1502
|
+
case "keyframes":
|
|
1503
|
+
return "keyframe";
|
|
1504
|
+
default:
|
|
1505
|
+
return "animation";
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* MotionPatternからMotionPatternInputに変換
|
|
1511
|
+
* @param pattern 検索結果のパターン
|
|
1512
|
+
* @returns コード生成用のパターン入力
|
|
1513
|
+
*/
|
|
1514
|
+
function patternToPatternInput(pattern: MotionPattern): MotionPatternInput {
|
|
1515
|
+
// animationオブジェクトから値を抽出、easingはオブジェクトの可能性あり
|
|
1516
|
+
const duration = pattern.animation?.duration ?? 300;
|
|
1517
|
+
const easingConfig = pattern.animation?.easing;
|
|
1518
|
+
// easingConfigがオブジェクトの場合はtypeまたはcubicBezierを使用
|
|
1519
|
+
let easing = "ease";
|
|
1520
|
+
if (easingConfig) {
|
|
1521
|
+
if (easingConfig.cubicBezier) {
|
|
1522
|
+
easing = `cubic-bezier(${easingConfig.cubicBezier.join(", ")})`;
|
|
1523
|
+
} else if (easingConfig.type && easingConfig.type !== "cubic-bezier") {
|
|
1524
|
+
easing = easingConfig.type;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
const delay = pattern.animation?.delay ?? 0;
|
|
1528
|
+
const iterations = pattern.animation?.iterations ?? 1;
|
|
1529
|
+
const direction = pattern.animation?.direction ?? "normal";
|
|
1530
|
+
const fillMode = pattern.animation?.fillMode ?? "none";
|
|
1531
|
+
|
|
1532
|
+
return {
|
|
1533
|
+
type: mapMotionType(pattern.type),
|
|
1534
|
+
name: pattern.name ?? "unnamed",
|
|
1535
|
+
duration,
|
|
1536
|
+
delay,
|
|
1537
|
+
easing,
|
|
1538
|
+
iterations,
|
|
1539
|
+
direction,
|
|
1540
|
+
fillMode,
|
|
1541
|
+
// propertiesのpropertyをnameに変換
|
|
1542
|
+
properties: pattern.properties?.map((p) => ({
|
|
1543
|
+
name: p.property ?? "opacity",
|
|
1544
|
+
from: String(p.from ?? "0"),
|
|
1545
|
+
to: String(p.to ?? "1"),
|
|
1546
|
+
})) ?? [{ name: "opacity", from: "0", to: "1" }],
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* 検索結果のパターンから実装コード情報を生成
|
|
1552
|
+
* @param pattern 検索結果のパターン
|
|
1553
|
+
* @returns 実装コード情報
|
|
1554
|
+
*/
|
|
1555
|
+
function generateImplementationForPattern(pattern: MotionPattern): MotionImplementation {
|
|
1556
|
+
const patternInput = patternToPatternInput(pattern);
|
|
1557
|
+
const implementation: MotionImplementation = {};
|
|
1558
|
+
|
|
1559
|
+
// transitionタイプの場合(css_transition)
|
|
1560
|
+
if (pattern.type === "css_transition") {
|
|
1561
|
+
const props = patternInput.properties.map((p) => p.name).join(", ");
|
|
1562
|
+
implementation.transition = `transition: ${props} ${formatDuration(patternInput.duration)} ${patternInput.easing};`;
|
|
1563
|
+
return implementation;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
// animation/@keyframesタイプの場合
|
|
1567
|
+
// @keyframes生成
|
|
1568
|
+
const keyframeLines: string[] = [];
|
|
1569
|
+
keyframeLines.push(`@keyframes ${pattern.name} {`);
|
|
1570
|
+
keyframeLines.push(" from {");
|
|
1571
|
+
for (const prop of patternInput.properties) {
|
|
1572
|
+
keyframeLines.push(` ${prop.name}: ${prop.from};`);
|
|
1573
|
+
}
|
|
1574
|
+
keyframeLines.push(" }");
|
|
1575
|
+
keyframeLines.push(" to {");
|
|
1576
|
+
for (const prop of patternInput.properties) {
|
|
1577
|
+
keyframeLines.push(` ${prop.name}: ${prop.to};`);
|
|
1578
|
+
}
|
|
1579
|
+
keyframeLines.push(" }");
|
|
1580
|
+
keyframeLines.push("}");
|
|
1581
|
+
implementation.keyframes = keyframeLines.join("\n");
|
|
1582
|
+
|
|
1583
|
+
// animationプロパティ生成
|
|
1584
|
+
implementation.animation = `animation: ${pattern.name} ${formatDuration(patternInput.duration)} ${patternInput.easing};`;
|
|
1585
|
+
|
|
1586
|
+
// Tailwindクラス生成
|
|
1587
|
+
implementation.tailwind = `animate-${pattern.name}`;
|
|
1588
|
+
|
|
1589
|
+
return implementation;
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
// =====================================================
|
|
1593
|
+
// 多様性フィルタリング (MMR強化)
|
|
1594
|
+
// =====================================================
|
|
1595
|
+
|
|
1596
|
+
/**
|
|
1597
|
+
* 2つの文字列の類似度を計算(Levenshtein距離ベース)
|
|
1598
|
+
* @param a 比較元文字列
|
|
1599
|
+
* @param b 比較先文字列
|
|
1600
|
+
* @returns 類似度 (0.0-1.0)
|
|
1601
|
+
*/
|
|
1602
|
+
function calculateNameSimilarity(a: string | undefined, b: string | undefined): number {
|
|
1603
|
+
if (!a || !b) {
|
|
1604
|
+
return 0;
|
|
1605
|
+
}
|
|
1606
|
+
const normalizedA = a.toLowerCase().replace(/[-_\s]/g, "");
|
|
1607
|
+
const normalizedB = b.toLowerCase().replace(/[-_\s]/g, "");
|
|
1608
|
+
|
|
1609
|
+
if (normalizedA === normalizedB) {
|
|
1610
|
+
return 1.0;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
// 共通のプレフィックスをチェック(例: fadeIn, fadeInUp → 高い類似度)
|
|
1614
|
+
let commonPrefixLen = 0;
|
|
1615
|
+
const minLen = Math.min(normalizedA.length, normalizedB.length);
|
|
1616
|
+
for (let i = 0; i < minLen; i++) {
|
|
1617
|
+
if (normalizedA[i] === normalizedB[i]) {
|
|
1618
|
+
commonPrefixLen++;
|
|
1619
|
+
} else {
|
|
1620
|
+
break;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
// プレフィックス類似度(4文字以上の共通プレフィックスで高い類似度)
|
|
1625
|
+
if (commonPrefixLen >= 4) {
|
|
1626
|
+
return 0.6 + 0.4 * (commonPrefixLen / Math.max(normalizedA.length, normalizedB.length));
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
// 部分文字列チェック
|
|
1630
|
+
if (normalizedA.includes(normalizedB) || normalizedB.includes(normalizedA)) {
|
|
1631
|
+
return 0.7;
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
return 0;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
/**
|
|
1638
|
+
* 2つのモーションパターン間の類似度を計算
|
|
1639
|
+
* 名前、カテゴリ、トリガー、アニメーション設定を比較
|
|
1640
|
+
* @param a 比較元パターン
|
|
1641
|
+
* @param b 比較先パターン
|
|
1642
|
+
* @returns 類似度 (0.0-1.0)
|
|
1643
|
+
*/
|
|
1644
|
+
function calculatePatternSimilarity(a: MotionSearchResultItem, b: MotionSearchResultItem): number {
|
|
1645
|
+
let similarityScore = 0;
|
|
1646
|
+
let weightTotal = 0;
|
|
1647
|
+
|
|
1648
|
+
// 名前の類似度 (重み: 0.25) - v0.1.0追加
|
|
1649
|
+
const nameWeight = 0.25;
|
|
1650
|
+
const nameSimilarity = calculateNameSimilarity(a.pattern.name, b.pattern.name);
|
|
1651
|
+
similarityScore += nameWeight * nameSimilarity;
|
|
1652
|
+
weightTotal += nameWeight;
|
|
1653
|
+
|
|
1654
|
+
// カテゴリの一致 (重み: 0.25)
|
|
1655
|
+
const categoryWeight = 0.25;
|
|
1656
|
+
if (a.pattern.category === b.pattern.category) {
|
|
1657
|
+
similarityScore += categoryWeight;
|
|
1658
|
+
}
|
|
1659
|
+
weightTotal += categoryWeight;
|
|
1660
|
+
|
|
1661
|
+
// トリガーの一致 (重み: 0.15)
|
|
1662
|
+
const triggerWeight = 0.15;
|
|
1663
|
+
if (a.pattern.trigger === b.pattern.trigger) {
|
|
1664
|
+
similarityScore += triggerWeight;
|
|
1665
|
+
}
|
|
1666
|
+
weightTotal += triggerWeight;
|
|
1667
|
+
|
|
1668
|
+
// タイプの一致 (重み: 0.1)
|
|
1669
|
+
const typeWeight = 0.1;
|
|
1670
|
+
if (a.pattern.type === b.pattern.type) {
|
|
1671
|
+
similarityScore += typeWeight;
|
|
1672
|
+
}
|
|
1673
|
+
weightTotal += typeWeight;
|
|
1674
|
+
|
|
1675
|
+
// duration類似度 (重み: 0.1)
|
|
1676
|
+
const durationWeight = 0.1;
|
|
1677
|
+
const durationA = a.pattern.animation?.duration ?? 0;
|
|
1678
|
+
const durationB = b.pattern.animation?.duration ?? 0;
|
|
1679
|
+
if (durationA > 0 && durationB > 0) {
|
|
1680
|
+
const durationRatio = Math.min(durationA, durationB) / Math.max(durationA, durationB);
|
|
1681
|
+
similarityScore += durationWeight * durationRatio;
|
|
1682
|
+
} else if (durationA === 0 && durationB === 0) {
|
|
1683
|
+
similarityScore += durationWeight;
|
|
1684
|
+
}
|
|
1685
|
+
weightTotal += durationWeight;
|
|
1686
|
+
|
|
1687
|
+
// easing類似度 (重み: 0.075)
|
|
1688
|
+
const easingWeight = 0.075;
|
|
1689
|
+
const easingA = a.pattern.animation?.easing?.type ?? "unknown";
|
|
1690
|
+
const easingB = b.pattern.animation?.easing?.type ?? "unknown";
|
|
1691
|
+
if (easingA === easingB) {
|
|
1692
|
+
similarityScore += easingWeight;
|
|
1693
|
+
}
|
|
1694
|
+
weightTotal += easingWeight;
|
|
1695
|
+
|
|
1696
|
+
// プロパティ類似度 (重み: 0.075)
|
|
1697
|
+
const propertiesWeight = 0.075;
|
|
1698
|
+
const propsA = new Set(a.pattern.properties?.map((p) => p.property) ?? []);
|
|
1699
|
+
const propsB = new Set(b.pattern.properties?.map((p) => p.property) ?? []);
|
|
1700
|
+
if (propsA.size > 0 && propsB.size > 0) {
|
|
1701
|
+
const intersection = [...propsA].filter((p) => propsB.has(p)).length;
|
|
1702
|
+
const union = new Set([...propsA, ...propsB]).size;
|
|
1703
|
+
similarityScore += propertiesWeight * (intersection / union);
|
|
1704
|
+
} else if (propsA.size === 0 && propsB.size === 0) {
|
|
1705
|
+
similarityScore += propertiesWeight;
|
|
1706
|
+
}
|
|
1707
|
+
weightTotal += propertiesWeight;
|
|
1708
|
+
|
|
1709
|
+
return weightTotal > 0 ? similarityScore / weightTotal : 0;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/**
|
|
1713
|
+
* MMR (Maximal Marginal Relevance) アルゴリズムで多様性フィルタリングを適用
|
|
1714
|
+
*
|
|
1715
|
+
* MMRスコア = λ * relevance - (1-λ) * max_similarity_to_selected
|
|
1716
|
+
*
|
|
1717
|
+
* @param results 検索結果配列(類似度順)
|
|
1718
|
+
* @param lambda λ値(0.0-1.0)- 0.0で最大多様性、1.0で関連度のみ
|
|
1719
|
+
* @param ensureCategoryDiversity カテゴリ分散を強制するか
|
|
1720
|
+
* @param limit 最大結果数
|
|
1721
|
+
* @returns フィルタリング後の検索結果
|
|
1722
|
+
*/
|
|
1723
|
+
function applyDiversityFilter(
|
|
1724
|
+
results: MotionSearchResultItem[],
|
|
1725
|
+
lambda: number,
|
|
1726
|
+
ensureCategoryDiversity: boolean,
|
|
1727
|
+
limit: number
|
|
1728
|
+
): MotionSearchResultItem[] {
|
|
1729
|
+
if (results.length === 0) {
|
|
1730
|
+
return results;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
// λ=1.0 の場合、多様性フィルタなし(関連度順のまま)
|
|
1734
|
+
if (lambda >= 1.0) {
|
|
1735
|
+
return results.slice(0, limit);
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
// λ=0.0 かつ ensureCategoryDiversity=false の場合、類似度順でフィルタリングのみ
|
|
1739
|
+
// ただし、同一名パターンは除外
|
|
1740
|
+
if (lambda <= 0.0 && !ensureCategoryDiversity) {
|
|
1741
|
+
const selected: MotionSearchResultItem[] = [];
|
|
1742
|
+
const usedNames = new Set<string>();
|
|
1743
|
+
|
|
1744
|
+
for (const result of results) {
|
|
1745
|
+
if (selected.length >= limit) break;
|
|
1746
|
+
|
|
1747
|
+
const name = result.pattern.name?.toLowerCase() ?? "";
|
|
1748
|
+
if (!usedNames.has(name)) {
|
|
1749
|
+
selected.push(result);
|
|
1750
|
+
if (name) usedNames.add(name);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
return selected;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
// MMRアルゴリズムによる選択
|
|
1757
|
+
const selected: MotionSearchResultItem[] = [];
|
|
1758
|
+
const remaining = [...results];
|
|
1759
|
+
const usedCategories = new Map<MotionCategory, number>();
|
|
1760
|
+
|
|
1761
|
+
while (remaining.length > 0 && selected.length < limit) {
|
|
1762
|
+
let bestIdx = 0;
|
|
1763
|
+
let bestScore = -Infinity;
|
|
1764
|
+
|
|
1765
|
+
for (let i = 0; i < remaining.length; i++) {
|
|
1766
|
+
const candidate = remaining[i];
|
|
1767
|
+
if (!candidate) continue;
|
|
1768
|
+
|
|
1769
|
+
// 関連度スコア(検索結果の類似度)
|
|
1770
|
+
const relevance = candidate.similarity;
|
|
1771
|
+
|
|
1772
|
+
// 選択済み結果との最大類似度を計算
|
|
1773
|
+
let maxSimilarityToSelected = 0;
|
|
1774
|
+
for (const sel of selected) {
|
|
1775
|
+
const sim = calculatePatternSimilarity(sel, candidate);
|
|
1776
|
+
if (sim > maxSimilarityToSelected) {
|
|
1777
|
+
maxSimilarityToSelected = sim;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
// MMRスコア計算: λ * relevance - (1-λ) * max_similarity_to_selected
|
|
1782
|
+
let mmrScore = lambda * relevance - (1 - lambda) * maxSimilarityToSelected;
|
|
1783
|
+
|
|
1784
|
+
// カテゴリ分散ボーナス(ensureCategoryDiversity=true の場合)
|
|
1785
|
+
if (ensureCategoryDiversity) {
|
|
1786
|
+
const category = candidate.pattern.category;
|
|
1787
|
+
const categoryCount = usedCategories.get(category) ?? 0;
|
|
1788
|
+
|
|
1789
|
+
// 未使用カテゴリにはボーナス
|
|
1790
|
+
if (categoryCount === 0) {
|
|
1791
|
+
mmrScore += 0.1;
|
|
1792
|
+
} else if (categoryCount >= 2) {
|
|
1793
|
+
// 同一カテゴリ3件以上は大きくペナルティ
|
|
1794
|
+
mmrScore -= 0.2 * categoryCount;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
if (mmrScore > bestScore) {
|
|
1799
|
+
bestScore = mmrScore;
|
|
1800
|
+
bestIdx = i;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
// 最良候補を選択
|
|
1805
|
+
const chosenItem = remaining.splice(bestIdx, 1)[0];
|
|
1806
|
+
if (!chosenItem) break;
|
|
1807
|
+
selected.push(chosenItem);
|
|
1808
|
+
|
|
1809
|
+
// カテゴリカウントを更新
|
|
1810
|
+
const category = chosenItem.pattern.category;
|
|
1811
|
+
usedCategories.set(category, (usedCategories.get(category) ?? 0) + 1);
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
if (isDevelopment()) {
|
|
1815
|
+
logger.info("[MCP Tool] motion.search MMR diversity filter applied", {
|
|
1816
|
+
originalCount: results.length,
|
|
1817
|
+
filteredCount: selected.length,
|
|
1818
|
+
lambda,
|
|
1819
|
+
ensureCategoryDiversity,
|
|
1820
|
+
categoryDistribution: Object.fromEntries(usedCategories),
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
return selected;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* 検索結果に実装コードを付与
|
|
1829
|
+
* @param results 検索結果配列
|
|
1830
|
+
* @returns 実装コードが付与された検索結果
|
|
1831
|
+
*/
|
|
1832
|
+
function enrichResultsWithImplementation(
|
|
1833
|
+
results: MotionSearchResultItem[]
|
|
1834
|
+
): MotionSearchResultItem[] {
|
|
1835
|
+
return results.map((result) => ({
|
|
1836
|
+
...result,
|
|
1837
|
+
implementation: generateImplementationForPattern(result.pattern),
|
|
1838
|
+
}));
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
// =====================================================
|
|
1842
|
+
// ハンドラー
|
|
1843
|
+
// =====================================================
|
|
1844
|
+
|
|
1845
|
+
/**
|
|
1846
|
+
* motion.search ツールハンドラー
|
|
1847
|
+
*
|
|
1848
|
+
* Phase3-3: action パラメータによる機能統合
|
|
1849
|
+
* - action: 'search' (デフォルト) → 検索機能
|
|
1850
|
+
* - action: 'generate' → コード生成機能
|
|
1851
|
+
*/
|
|
1852
|
+
export async function motionSearchHandler(input: unknown): Promise<MotionSearchOutput> {
|
|
1853
|
+
if (isDevelopment()) {
|
|
1854
|
+
logger.info("[MCP Tool] motion.search called", {
|
|
1855
|
+
hasInput: input !== null && input !== undefined,
|
|
1856
|
+
});
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
// 入力バリデーション
|
|
1860
|
+
let validated: MotionSearchInput;
|
|
1861
|
+
try {
|
|
1862
|
+
validated = motionSearchInputSchema.parse(input);
|
|
1863
|
+
} catch (error) {
|
|
1864
|
+
if (isDevelopment()) {
|
|
1865
|
+
logger.error("[MCP Tool] motion.search validation error", { error });
|
|
1866
|
+
}
|
|
1867
|
+
return {
|
|
1868
|
+
success: false,
|
|
1869
|
+
error: {
|
|
1870
|
+
code: MOTION_SEARCH_ERROR_CODES.VALIDATION_ERROR,
|
|
1871
|
+
message: error instanceof Error ? error.message : "Invalid input",
|
|
1872
|
+
},
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
// Phase3-3: action分岐
|
|
1877
|
+
const action = validated.action ?? "search";
|
|
1878
|
+
|
|
1879
|
+
if (action === "generate") {
|
|
1880
|
+
// コード生成処理
|
|
1881
|
+
return handleGenerateAction(validated);
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
// 検索処理(既存ロジック)
|
|
1885
|
+
return handleSearchAction(validated);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
/**
|
|
1889
|
+
* action: 'search' の処理
|
|
1890
|
+
*/
|
|
1891
|
+
async function handleSearchAction(validated: MotionSearchInput): Promise<MotionSearchOutput> {
|
|
1892
|
+
// サービスファクトリのチェック
|
|
1893
|
+
if (!serviceFactory) {
|
|
1894
|
+
if (isDevelopment()) {
|
|
1895
|
+
logger.error("[MCP Tool] motion.search service factory not set");
|
|
1896
|
+
}
|
|
1897
|
+
return {
|
|
1898
|
+
success: false,
|
|
1899
|
+
error: {
|
|
1900
|
+
code: MOTION_SEARCH_ERROR_CODES.SERVICE_UNAVAILABLE,
|
|
1901
|
+
message: "Motion search service is not available",
|
|
1902
|
+
},
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
try {
|
|
1907
|
+
const service = serviceFactory();
|
|
1908
|
+
|
|
1909
|
+
// 検索パラメータを構築(v0.1.0: JSアニメーション検索パラメータ追加、v0.1.0: WebGLアニメーション検索パラメータ追加、v0.1.0: include_implementation追加)
|
|
1910
|
+
const searchParams: MotionSearchParams = {
|
|
1911
|
+
query: validated.query,
|
|
1912
|
+
samplePattern: validated.samplePattern,
|
|
1913
|
+
filters: validated.filters,
|
|
1914
|
+
limit: validated.limit,
|
|
1915
|
+
minSimilarity: validated.minSimilarity,
|
|
1916
|
+
include_js_animations: validated.include_js_animations,
|
|
1917
|
+
js_animation_filters: validated.js_animation_filters,
|
|
1918
|
+
include_webgl_animations: validated.include_webgl_animations,
|
|
1919
|
+
webgl_animation_filters: validated.webgl_animation_filters,
|
|
1920
|
+
include_implementation: validated.include_implementation,
|
|
1921
|
+
};
|
|
1922
|
+
|
|
1923
|
+
if (isDevelopment()) {
|
|
1924
|
+
logger.info("[MCP Tool] motion.search executing search", {
|
|
1925
|
+
hasQuery: !!searchParams.query,
|
|
1926
|
+
hasSamplePattern: !!searchParams.samplePattern,
|
|
1927
|
+
hasFilters: !!searchParams.filters,
|
|
1928
|
+
limit: searchParams.limit,
|
|
1929
|
+
minSimilarity: searchParams.minSimilarity,
|
|
1930
|
+
includeJsAnimations: searchParams.include_js_animations,
|
|
1931
|
+
hasJsAnimationFilters: !!searchParams.js_animation_filters,
|
|
1932
|
+
includeWebglAnimations: searchParams.include_webgl_animations,
|
|
1933
|
+
hasWebglAnimationFilters: !!searchParams.webgl_animation_filters,
|
|
1934
|
+
includeImplementation: searchParams.include_implementation,
|
|
1935
|
+
diversityThreshold: validated.diversity_threshold ?? 0.3,
|
|
1936
|
+
ensureCategoryDiversity: validated.ensure_category_diversity ?? true,
|
|
1937
|
+
});
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
// 検索実行(ハイブリッド検索優先)
|
|
1941
|
+
const searchResult = service.searchHybrid
|
|
1942
|
+
? await service.searchHybrid(searchParams)
|
|
1943
|
+
: await service.search(searchParams);
|
|
1944
|
+
|
|
1945
|
+
// v0.1.0: 多様性フィルタリングを適用
|
|
1946
|
+
const diversityThreshold = validated.diversity_threshold ?? 0.3;
|
|
1947
|
+
const ensureCategoryDiversity = validated.ensure_category_diversity ?? true;
|
|
1948
|
+
const diverseResults = applyDiversityFilter(
|
|
1949
|
+
searchResult.results,
|
|
1950
|
+
diversityThreshold,
|
|
1951
|
+
ensureCategoryDiversity,
|
|
1952
|
+
validated.limit
|
|
1953
|
+
);
|
|
1954
|
+
|
|
1955
|
+
// v0.1.0: include_implementation が true の場合、実装コードを付与
|
|
1956
|
+
let results = validated.include_implementation
|
|
1957
|
+
? enrichResultsWithImplementation(diverseResults)
|
|
1958
|
+
: diverseResults;
|
|
1959
|
+
|
|
1960
|
+
// 嗜好プロファイルによるリランキング / Preference profile reranking
|
|
1961
|
+
// motion結果はpattern.idにIDがあるため、top-levelにidをマッピング
|
|
1962
|
+
// Motion results have ID in pattern.id, so map id to top-level
|
|
1963
|
+
const resultsWithId = results.map((r) => ({ ...r, id: r.pattern.id }));
|
|
1964
|
+
results = (await applyPreferenceReranking(
|
|
1965
|
+
resultsWithId,
|
|
1966
|
+
validated.profile_id,
|
|
1967
|
+
prismaClientFactory,
|
|
1968
|
+
"motion",
|
|
1969
|
+
"motion.search"
|
|
1970
|
+
)) as typeof results;
|
|
1971
|
+
|
|
1972
|
+
if (isDevelopment()) {
|
|
1973
|
+
logger.info("[MCP Tool] motion.search completed", {
|
|
1974
|
+
resultsCount: results.length,
|
|
1975
|
+
originalCount: searchResult.results.length,
|
|
1976
|
+
total: searchResult.total,
|
|
1977
|
+
includeImplementation: validated.include_implementation,
|
|
1978
|
+
diversityThreshold,
|
|
1979
|
+
ensureCategoryDiversity,
|
|
1980
|
+
});
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
return {
|
|
1984
|
+
success: true,
|
|
1985
|
+
data: {
|
|
1986
|
+
results,
|
|
1987
|
+
total: searchResult.total,
|
|
1988
|
+
query: searchResult.query,
|
|
1989
|
+
},
|
|
1990
|
+
};
|
|
1991
|
+
} catch (error) {
|
|
1992
|
+
if (isDevelopment()) {
|
|
1993
|
+
logger.error("[MCP Tool] motion.search error", { error });
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
// エラータイプに基づいてエラーコードを決定
|
|
1997
|
+
const errorCode =
|
|
1998
|
+
error instanceof Error && error.message.includes("Embedding")
|
|
1999
|
+
? MOTION_SEARCH_ERROR_CODES.EMBEDDING_ERROR
|
|
2000
|
+
: MOTION_SEARCH_ERROR_CODES.SEARCH_ERROR;
|
|
2001
|
+
|
|
2002
|
+
return {
|
|
2003
|
+
success: false,
|
|
2004
|
+
error: {
|
|
2005
|
+
code: errorCode,
|
|
2006
|
+
message: error instanceof Error ? error.message : "Search failed",
|
|
2007
|
+
},
|
|
2008
|
+
};
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
/**
|
|
2013
|
+
* action: 'generate' の処理(Phase3-3統合)
|
|
2014
|
+
* v0.1.0: 重複検出機能追加
|
|
2015
|
+
*/
|
|
2016
|
+
async function handleGenerateAction(validated: MotionSearchInput): Promise<MotionSearchOutput> {
|
|
2017
|
+
if (isDevelopment()) {
|
|
2018
|
+
logger.info("[MCP Tool] motion.search action: generate", {
|
|
2019
|
+
hasPattern: !!validated.pattern,
|
|
2020
|
+
format: validated.format,
|
|
2021
|
+
checkDuplicates: validated.generation_options?.check_duplicates,
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
// pattern が必須
|
|
2026
|
+
if (!validated.pattern) {
|
|
2027
|
+
return {
|
|
2028
|
+
success: false,
|
|
2029
|
+
error: {
|
|
2030
|
+
code: MOTION_MCP_ERROR_CODES.VALIDATION_ERROR,
|
|
2031
|
+
message: "action: generate には pattern パラメータが必要です",
|
|
2032
|
+
},
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
try {
|
|
2037
|
+
const pattern = validated.pattern;
|
|
2038
|
+
const format = validated.format ?? "css";
|
|
2039
|
+
const options: ImplementationOptions = {
|
|
2040
|
+
selector: validated.options?.selector ?? ".animated",
|
|
2041
|
+
includeVendorPrefixes: validated.options?.includeVendorPrefixes ?? false,
|
|
2042
|
+
includeReducedMotion: validated.options?.includeReducedMotion ?? true,
|
|
2043
|
+
typescript: validated.options?.typescript ?? true,
|
|
2044
|
+
componentName: validated.options?.componentName,
|
|
2045
|
+
};
|
|
2046
|
+
const generationOptions = validated.generation_options;
|
|
2047
|
+
|
|
2048
|
+
// v0.1.0: 重複チェック実行
|
|
2049
|
+
let duplicateCheckResult: DuplicateCheckResult | undefined;
|
|
2050
|
+
|
|
2051
|
+
if (generationOptions?.check_duplicates) {
|
|
2052
|
+
try {
|
|
2053
|
+
duplicateCheckResult = await performDuplicateCheck(pattern, generationOptions);
|
|
2054
|
+
|
|
2055
|
+
if (isDevelopment()) {
|
|
2056
|
+
logger.info("[MCP Tool] motion.search duplicate check completed", {
|
|
2057
|
+
hasDuplicates: duplicateCheckResult.has_duplicates,
|
|
2058
|
+
matchCount: duplicateCheckResult.existing_matches.length,
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
} catch (error) {
|
|
2062
|
+
if (isDevelopment()) {
|
|
2063
|
+
logger.warn("[MCP Tool] motion.search duplicate check failed, continuing generation", {
|
|
2064
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
// 重複チェック失敗時は警告のみでコード生成は続行
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
// サービス経由で生成(DIパターン)
|
|
2072
|
+
let result: GenerationResult | null = null;
|
|
2073
|
+
const service = implementationServiceFactory?.();
|
|
2074
|
+
|
|
2075
|
+
if (service?.generate) {
|
|
2076
|
+
try {
|
|
2077
|
+
result = service.generate(pattern, format, options);
|
|
2078
|
+
} catch (error) {
|
|
2079
|
+
if (isDevelopment()) {
|
|
2080
|
+
logger.error("[MCP Tool] motion.search generate service error", { error });
|
|
2081
|
+
}
|
|
2082
|
+
return {
|
|
2083
|
+
success: false,
|
|
2084
|
+
error: {
|
|
2085
|
+
code: MOTION_MCP_ERROR_CODES.INTERNAL_ERROR,
|
|
2086
|
+
message: error instanceof Error ? error.message : "Generation failed",
|
|
2087
|
+
},
|
|
2088
|
+
};
|
|
2089
|
+
}
|
|
2090
|
+
} else {
|
|
2091
|
+
// デフォルト実装
|
|
2092
|
+
result = generateImplementation(pattern, format, options);
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
if (!result) {
|
|
2096
|
+
return {
|
|
2097
|
+
success: false,
|
|
2098
|
+
error: {
|
|
2099
|
+
code: MOTION_MCP_ERROR_CODES.INTERNAL_ERROR,
|
|
2100
|
+
message: "Generation returned null",
|
|
2101
|
+
},
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
if (isDevelopment()) {
|
|
2106
|
+
logger.info("[MCP Tool] motion.search generate completed", {
|
|
2107
|
+
format,
|
|
2108
|
+
linesOfCode: result.metadata.linesOfCode,
|
|
2109
|
+
hasDuplicateCheck: !!duplicateCheckResult,
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
return {
|
|
2114
|
+
success: true,
|
|
2115
|
+
data: {
|
|
2116
|
+
code: result.code,
|
|
2117
|
+
format,
|
|
2118
|
+
metadata: result.metadata,
|
|
2119
|
+
duplicate_check: duplicateCheckResult,
|
|
2120
|
+
},
|
|
2121
|
+
};
|
|
2122
|
+
} catch (error) {
|
|
2123
|
+
if (isDevelopment()) {
|
|
2124
|
+
logger.error("[MCP Tool] motion.search generate error", { error });
|
|
2125
|
+
}
|
|
2126
|
+
return {
|
|
2127
|
+
success: false,
|
|
2128
|
+
error: {
|
|
2129
|
+
code: MOTION_MCP_ERROR_CODES.INTERNAL_ERROR,
|
|
2130
|
+
message: error instanceof Error ? error.message : "Generation failed",
|
|
2131
|
+
},
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
/**
|
|
2137
|
+
* 重複チェックを実行
|
|
2138
|
+
* v0.1.0: ExistingAnimationDetectorServiceを使用
|
|
2139
|
+
*/
|
|
2140
|
+
async function performDuplicateCheck(
|
|
2141
|
+
pattern: MotionPatternInput,
|
|
2142
|
+
generationOptions: GenerationOptions
|
|
2143
|
+
): Promise<DuplicateCheckResult> {
|
|
2144
|
+
const detector = new ExistingAnimationDetectorService();
|
|
2145
|
+
|
|
2146
|
+
// MotionPatternInput を NewAnimationPattern に変換
|
|
2147
|
+
const newPattern: NewAnimationPattern = {
|
|
2148
|
+
name: pattern.name,
|
|
2149
|
+
type: pattern.type,
|
|
2150
|
+
duration: pattern.duration,
|
|
2151
|
+
easing: pattern.easing,
|
|
2152
|
+
properties: pattern.properties.map((p) => {
|
|
2153
|
+
const prop: NewAnimationPattern["properties"][number] = {
|
|
2154
|
+
name: p.name,
|
|
2155
|
+
from: p.from,
|
|
2156
|
+
to: p.to,
|
|
2157
|
+
};
|
|
2158
|
+
// keyframesがundefinedでない場合のみ設定
|
|
2159
|
+
if (p.keyframes) {
|
|
2160
|
+
prop.keyframes = p.keyframes;
|
|
2161
|
+
}
|
|
2162
|
+
return prop;
|
|
2163
|
+
}),
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
// オプションを構築(undefinedフィールドを除外)
|
|
2167
|
+
const checkOptions: {
|
|
2168
|
+
projectCSSPath?: string;
|
|
2169
|
+
projectCSSPaths?: string[];
|
|
2170
|
+
similarityThreshold?: number;
|
|
2171
|
+
} = {
|
|
2172
|
+
similarityThreshold: generationOptions.similarity_threshold,
|
|
2173
|
+
};
|
|
2174
|
+
|
|
2175
|
+
if (generationOptions.project_css_path) {
|
|
2176
|
+
checkOptions.projectCSSPath = generationOptions.project_css_path;
|
|
2177
|
+
}
|
|
2178
|
+
if (generationOptions.project_css_paths) {
|
|
2179
|
+
checkOptions.projectCSSPaths = generationOptions.project_css_paths;
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
const result = await detector.checkDuplicates(newPattern, checkOptions);
|
|
2183
|
+
|
|
2184
|
+
// DuplicateCheckResult スキーマ形式に変換
|
|
2185
|
+
return {
|
|
2186
|
+
has_duplicates: result.hasDuplicates,
|
|
2187
|
+
existing_matches: result.existingMatches.map((match) => ({
|
|
2188
|
+
animation_name: match.animationName,
|
|
2189
|
+
file_path: match.filePath,
|
|
2190
|
+
similarity: match.similarity,
|
|
2191
|
+
suggestion: match.suggestion,
|
|
2192
|
+
})),
|
|
2193
|
+
warnings: result.warnings,
|
|
2194
|
+
};
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
// =====================================================
|
|
2198
|
+
// ツール定義
|
|
2199
|
+
// =====================================================
|
|
2200
|
+
|
|
2201
|
+
export const motionSearchToolDefinition = {
|
|
2202
|
+
name: "motion.search",
|
|
2203
|
+
description:
|
|
2204
|
+
"モーションパターンを類似検索、または実装コードを生成します。action: search(デフォルト)で検索、action: generateでCSS/JS実装コードを生成します。",
|
|
2205
|
+
annotations: {
|
|
2206
|
+
title: "Motion Search",
|
|
2207
|
+
readOnlyHint: true,
|
|
2208
|
+
idempotentHint: true,
|
|
2209
|
+
openWorldHint: false,
|
|
2210
|
+
},
|
|
2211
|
+
inputSchema: {
|
|
2212
|
+
type: "object" as const,
|
|
2213
|
+
properties: {
|
|
2214
|
+
// Phase3-3: action parameter for consolidation
|
|
2215
|
+
action: {
|
|
2216
|
+
type: "string",
|
|
2217
|
+
enum: ["search", "generate"],
|
|
2218
|
+
default: "search",
|
|
2219
|
+
description: "アクション: search(デフォルト)= モーション検索、generate = 実装コード生成",
|
|
2220
|
+
},
|
|
2221
|
+
// === Search parameters (action: search) ===
|
|
2222
|
+
query: {
|
|
2223
|
+
type: "string",
|
|
2224
|
+
minLength: 1,
|
|
2225
|
+
maxLength: 500,
|
|
2226
|
+
description: "検索クエリ(自然言語、1-500文字)。action: searchで使用。",
|
|
2227
|
+
},
|
|
2228
|
+
samplePattern: {
|
|
2229
|
+
type: "object",
|
|
2230
|
+
description: "サンプルパターンで類似検索。action: searchで使用。",
|
|
2231
|
+
properties: {
|
|
2232
|
+
type: {
|
|
2233
|
+
type: "string",
|
|
2234
|
+
enum: ["animation", "transition", "transform", "scroll", "hover", "keyframe"],
|
|
2235
|
+
description: "モーションタイプ",
|
|
2236
|
+
},
|
|
2237
|
+
duration: {
|
|
2238
|
+
type: "number",
|
|
2239
|
+
minimum: 0,
|
|
2240
|
+
description: "アニメーション時間(ms)",
|
|
2241
|
+
},
|
|
2242
|
+
easing: {
|
|
2243
|
+
type: "string",
|
|
2244
|
+
description: "イージング関数",
|
|
2245
|
+
},
|
|
2246
|
+
properties: {
|
|
2247
|
+
type: "array",
|
|
2248
|
+
items: { type: "string" },
|
|
2249
|
+
description: "アニメーション対象プロパティ",
|
|
2250
|
+
},
|
|
2251
|
+
},
|
|
2252
|
+
},
|
|
2253
|
+
filters: {
|
|
2254
|
+
type: "object",
|
|
2255
|
+
description: "検索フィルター。action: searchで使用。",
|
|
2256
|
+
properties: {
|
|
2257
|
+
type: {
|
|
2258
|
+
type: "string",
|
|
2259
|
+
enum: ["animation", "transition", "transform", "scroll", "hover", "keyframe"],
|
|
2260
|
+
description: "タイプでフィルタリング",
|
|
2261
|
+
},
|
|
2262
|
+
minDuration: {
|
|
2263
|
+
type: "number",
|
|
2264
|
+
minimum: 0,
|
|
2265
|
+
description: "最小duration(ms)",
|
|
2266
|
+
},
|
|
2267
|
+
maxDuration: {
|
|
2268
|
+
type: "number",
|
|
2269
|
+
minimum: 0,
|
|
2270
|
+
description: "最大duration(ms)",
|
|
2271
|
+
},
|
|
2272
|
+
trigger: {
|
|
2273
|
+
type: "string",
|
|
2274
|
+
enum: ["load", "hover", "scroll", "click", "focus", "custom"],
|
|
2275
|
+
description: "トリガーでフィルタリング",
|
|
2276
|
+
},
|
|
2277
|
+
},
|
|
2278
|
+
},
|
|
2279
|
+
limit: {
|
|
2280
|
+
type: "number",
|
|
2281
|
+
minimum: 1,
|
|
2282
|
+
maximum: 50,
|
|
2283
|
+
default: 10,
|
|
2284
|
+
description: "結果制限(1-50、デフォルト: 10)。action: searchで使用。",
|
|
2285
|
+
},
|
|
2286
|
+
minSimilarity: {
|
|
2287
|
+
type: "number",
|
|
2288
|
+
minimum: 0,
|
|
2289
|
+
maximum: 1,
|
|
2290
|
+
default: 0.5,
|
|
2291
|
+
description: "最小類似度しきい値(0-1、デフォルト: 0.5)。action: searchで使用。",
|
|
2292
|
+
},
|
|
2293
|
+
// === JSAnimation search parameters (v0.1.0) ===
|
|
2294
|
+
include_js_animations: {
|
|
2295
|
+
type: "boolean",
|
|
2296
|
+
default: true,
|
|
2297
|
+
description:
|
|
2298
|
+
"JSアニメーションパターンを検索結果に含める(デフォルト: true)。action: searchで使用。",
|
|
2299
|
+
},
|
|
2300
|
+
js_animation_filters: {
|
|
2301
|
+
type: "object",
|
|
2302
|
+
description: "JSアニメーション検索フィルター。action: searchで使用。",
|
|
2303
|
+
properties: {
|
|
2304
|
+
libraryType: {
|
|
2305
|
+
type: "string",
|
|
2306
|
+
enum: [
|
|
2307
|
+
"gsap",
|
|
2308
|
+
"framer_motion",
|
|
2309
|
+
"anime_js",
|
|
2310
|
+
"three_js",
|
|
2311
|
+
"lottie",
|
|
2312
|
+
"web_animations_api",
|
|
2313
|
+
"unknown",
|
|
2314
|
+
],
|
|
2315
|
+
description:
|
|
2316
|
+
"ライブラリタイプでフィルタリング(gsap, framer_motion, anime_js, three_js, lottie, web_animations_api, unknown)",
|
|
2317
|
+
},
|
|
2318
|
+
animationType: {
|
|
2319
|
+
type: "string",
|
|
2320
|
+
enum: [
|
|
2321
|
+
"tween",
|
|
2322
|
+
"timeline",
|
|
2323
|
+
"spring",
|
|
2324
|
+
"physics",
|
|
2325
|
+
"keyframe",
|
|
2326
|
+
"morphing",
|
|
2327
|
+
"path",
|
|
2328
|
+
"scroll_driven",
|
|
2329
|
+
"gesture",
|
|
2330
|
+
],
|
|
2331
|
+
description:
|
|
2332
|
+
"アニメーションタイプでフィルタリング(tween, timeline, spring, physics, keyframe, morphing, path, scroll_driven, gesture)",
|
|
2333
|
+
},
|
|
2334
|
+
},
|
|
2335
|
+
},
|
|
2336
|
+
// === WebGLAnimation search parameters (v0.1.0) ===
|
|
2337
|
+
include_webgl_animations: {
|
|
2338
|
+
type: "boolean",
|
|
2339
|
+
default: true,
|
|
2340
|
+
description:
|
|
2341
|
+
"WebGLアニメーションパターンを検索結果に含める(デフォルト: true)。action: searchで使用。",
|
|
2342
|
+
},
|
|
2343
|
+
webgl_animation_filters: {
|
|
2344
|
+
type: "object",
|
|
2345
|
+
description: "WebGLアニメーション検索フィルター。action: searchで使用。",
|
|
2346
|
+
properties: {
|
|
2347
|
+
category: {
|
|
2348
|
+
type: "string",
|
|
2349
|
+
enum: [
|
|
2350
|
+
"fade",
|
|
2351
|
+
"pulse",
|
|
2352
|
+
"wave",
|
|
2353
|
+
"particle",
|
|
2354
|
+
"morph",
|
|
2355
|
+
"rotation",
|
|
2356
|
+
"parallax",
|
|
2357
|
+
"noise",
|
|
2358
|
+
"complex",
|
|
2359
|
+
],
|
|
2360
|
+
description:
|
|
2361
|
+
"カテゴリでフィルタリング(fade, pulse, wave, particle, morph, rotation, parallax, noise, complex)",
|
|
2362
|
+
},
|
|
2363
|
+
detectedLibrary: {
|
|
2364
|
+
type: "string",
|
|
2365
|
+
description: "検出されたライブラリでフィルタリング(例: three.js, babylon.js)",
|
|
2366
|
+
},
|
|
2367
|
+
minConfidence: {
|
|
2368
|
+
type: "number",
|
|
2369
|
+
minimum: 0,
|
|
2370
|
+
maximum: 1,
|
|
2371
|
+
description: "最小信頼度しきい値(0-1)",
|
|
2372
|
+
},
|
|
2373
|
+
},
|
|
2374
|
+
},
|
|
2375
|
+
// === Implementation code parameter (v0.1.0) ===
|
|
2376
|
+
include_implementation: {
|
|
2377
|
+
type: "boolean",
|
|
2378
|
+
default: false,
|
|
2379
|
+
description:
|
|
2380
|
+
"検索結果に実装コード(@keyframes, animation, tailwindクラス)を含める(デフォルト: false)。action: searchで使用。",
|
|
2381
|
+
},
|
|
2382
|
+
// === Generate parameters (action: generate) ===
|
|
2383
|
+
pattern: {
|
|
2384
|
+
type: "object",
|
|
2385
|
+
description: "モーションパターン定義。action: generateで必須。",
|
|
2386
|
+
properties: {
|
|
2387
|
+
type: {
|
|
2388
|
+
type: "string",
|
|
2389
|
+
enum: ["animation", "transition", "transform", "scroll", "hover", "keyframe"],
|
|
2390
|
+
description: "パターンタイプ",
|
|
2391
|
+
},
|
|
2392
|
+
name: {
|
|
2393
|
+
type: "string",
|
|
2394
|
+
minLength: 1,
|
|
2395
|
+
maxLength: 100,
|
|
2396
|
+
description: "アニメーション名(1-100文字)",
|
|
2397
|
+
},
|
|
2398
|
+
properties: {
|
|
2399
|
+
type: "array",
|
|
2400
|
+
minItems: 1,
|
|
2401
|
+
description: "アニメーション対象プロパティ",
|
|
2402
|
+
items: {
|
|
2403
|
+
type: "object",
|
|
2404
|
+
properties: {
|
|
2405
|
+
name: { type: "string", description: "CSSプロパティ名" },
|
|
2406
|
+
from: { type: "string", description: "開始値" },
|
|
2407
|
+
to: { type: "string", description: "終了値" },
|
|
2408
|
+
keyframes: {
|
|
2409
|
+
type: "array",
|
|
2410
|
+
description: "中間キーフレーム(オプション)",
|
|
2411
|
+
items: {
|
|
2412
|
+
type: "object",
|
|
2413
|
+
properties: {
|
|
2414
|
+
offset: { type: "number", minimum: 0, maximum: 1 },
|
|
2415
|
+
value: { type: "string" },
|
|
2416
|
+
},
|
|
2417
|
+
},
|
|
2418
|
+
},
|
|
2419
|
+
},
|
|
2420
|
+
required: ["name", "from", "to"],
|
|
2421
|
+
},
|
|
2422
|
+
},
|
|
2423
|
+
duration: {
|
|
2424
|
+
type: "number",
|
|
2425
|
+
minimum: 0,
|
|
2426
|
+
maximum: 60000,
|
|
2427
|
+
default: 300,
|
|
2428
|
+
description: "アニメーション時間(ms、デフォルト: 300)",
|
|
2429
|
+
},
|
|
2430
|
+
delay: {
|
|
2431
|
+
type: "number",
|
|
2432
|
+
minimum: 0,
|
|
2433
|
+
maximum: 60000,
|
|
2434
|
+
default: 0,
|
|
2435
|
+
description: "遅延時間(ms、デフォルト: 0)",
|
|
2436
|
+
},
|
|
2437
|
+
easing: {
|
|
2438
|
+
type: "string",
|
|
2439
|
+
default: "ease",
|
|
2440
|
+
description: "イージング関数(デフォルト: ease)",
|
|
2441
|
+
},
|
|
2442
|
+
iterations: {
|
|
2443
|
+
oneOf: [
|
|
2444
|
+
{ type: "number", minimum: 1 },
|
|
2445
|
+
{ type: "string", enum: ["infinite"] },
|
|
2446
|
+
],
|
|
2447
|
+
default: 1,
|
|
2448
|
+
description: "繰り返し回数(デフォルト: 1、またはinfinite)",
|
|
2449
|
+
},
|
|
2450
|
+
direction: {
|
|
2451
|
+
type: "string",
|
|
2452
|
+
enum: ["normal", "reverse", "alternate", "alternate-reverse"],
|
|
2453
|
+
default: "normal",
|
|
2454
|
+
description: "アニメーション方向(デフォルト: normal)",
|
|
2455
|
+
},
|
|
2456
|
+
fillMode: {
|
|
2457
|
+
type: "string",
|
|
2458
|
+
enum: ["none", "forwards", "backwards", "both"],
|
|
2459
|
+
default: "none",
|
|
2460
|
+
description: "フィルモード(デフォルト: none)",
|
|
2461
|
+
},
|
|
2462
|
+
},
|
|
2463
|
+
required: ["type", "name", "properties"],
|
|
2464
|
+
},
|
|
2465
|
+
format: {
|
|
2466
|
+
type: "string",
|
|
2467
|
+
enum: [
|
|
2468
|
+
"css",
|
|
2469
|
+
"css-module",
|
|
2470
|
+
"tailwind",
|
|
2471
|
+
"styled-components",
|
|
2472
|
+
"emotion",
|
|
2473
|
+
"framer-motion",
|
|
2474
|
+
"gsap",
|
|
2475
|
+
],
|
|
2476
|
+
default: "css",
|
|
2477
|
+
description: "出力フォーマット(デフォルト: css)。action: generateで使用。",
|
|
2478
|
+
},
|
|
2479
|
+
options: {
|
|
2480
|
+
type: "object",
|
|
2481
|
+
description: "生成オプション。action: generateで使用。",
|
|
2482
|
+
properties: {
|
|
2483
|
+
selector: {
|
|
2484
|
+
type: "string",
|
|
2485
|
+
default: ".animated",
|
|
2486
|
+
description: "CSSセレクタ(デフォルト: .animated)",
|
|
2487
|
+
},
|
|
2488
|
+
componentName: {
|
|
2489
|
+
type: "string",
|
|
2490
|
+
description: "コンポーネント名(JSライブラリ用、省略時は自動生成)",
|
|
2491
|
+
},
|
|
2492
|
+
typescript: {
|
|
2493
|
+
type: "boolean",
|
|
2494
|
+
default: true,
|
|
2495
|
+
description: "TypeScriptコードを生成(デフォルト: true)",
|
|
2496
|
+
},
|
|
2497
|
+
includeReducedMotion: {
|
|
2498
|
+
type: "boolean",
|
|
2499
|
+
default: true,
|
|
2500
|
+
description: "prefers-reduced-motion対応を含める(デフォルト: true)",
|
|
2501
|
+
},
|
|
2502
|
+
includeVendorPrefixes: {
|
|
2503
|
+
type: "boolean",
|
|
2504
|
+
default: false,
|
|
2505
|
+
description: "ベンダープレフィックスを含める(デフォルト: false)",
|
|
2506
|
+
},
|
|
2507
|
+
},
|
|
2508
|
+
},
|
|
2509
|
+
// Preference reranking
|
|
2510
|
+
profile_id: {
|
|
2511
|
+
type: "string",
|
|
2512
|
+
format: "uuid",
|
|
2513
|
+
description:
|
|
2514
|
+
"嗜好プロファイルID(検索結果のリランキングに使用) / Preference profile ID (used for search result reranking)",
|
|
2515
|
+
},
|
|
2516
|
+
},
|
|
2517
|
+
},
|
|
2518
|
+
};
|