@superblocksteam/vite-plugin-file-sync 2.0.114 → 2.0.115-next.1
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/dist/ai-service/agent/middleware.d.ts.map +1 -1
- package/dist/ai-service/agent/middleware.js +19 -0
- package/dist/ai-service/agent/middleware.js.map +1 -1
- package/dist/ai-service/agent/prompts/api-prompts.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/api-prompts.js +13 -17
- package/dist/ai-service/agent/prompts/api-prompts.js.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js +22 -3
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
- package/dist/ai-service/agent/subagents/coding/prompt-builder.d.ts +16 -0
- package/dist/ai-service/agent/subagents/coding/prompt-builder.d.ts.map +1 -0
- package/dist/ai-service/agent/subagents/coding/prompt-builder.js +30 -0
- package/dist/ai-service/agent/subagents/coding/prompt-builder.js.map +1 -0
- package/dist/ai-service/agent/subagents/coding/run-coding-subagent.d.ts +29 -0
- package/dist/ai-service/agent/subagents/coding/run-coding-subagent.d.ts.map +1 -0
- package/dist/ai-service/agent/subagents/coding/run-coding-subagent.js +108 -0
- package/dist/ai-service/agent/subagents/coding/run-coding-subagent.js.map +1 -0
- package/dist/ai-service/agent/subagents/types.d.ts +9 -1
- package/dist/ai-service/agent/subagents/types.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/types.js +8 -0
- package/dist/ai-service/agent/subagents/types.js.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.js +5 -0
- package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/api-validation-orchestrator.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/api-validation-orchestrator.js +2 -1
- package/dist/ai-service/agent/tools/apis/api-validation-orchestrator.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.d.ts +6 -0
- package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.js +138 -0
- package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.js.map +1 -0
- package/dist/ai-service/agent/tools/build-finalize.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-finalize.js +39 -15
- package/dist/ai-service/agent/tools/build-finalize.js.map +1 -1
- package/dist/ai-service/agent/tools/build-manage-checklist.d.ts +6 -3
- package/dist/ai-service/agent/tools/build-manage-checklist.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-manage-checklist.js +116 -49
- package/dist/ai-service/agent/tools/build-manage-checklist.js.map +1 -1
- package/dist/ai-service/agent/tools/index.d.ts +2 -0
- package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/index.js +2 -0
- package/dist/ai-service/agent/tools/index.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.d.ts +3 -0
- package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.js +330 -204
- package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
- package/dist/ai-service/agent/tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools.js +40 -2
- package/dist/ai-service/agent/tools.js.map +1 -1
- package/dist/ai-service/agent/tools2/access-control.d.ts +1 -1
- package/dist/ai-service/agent/tools2/access-control.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/access-control.js +15 -4
- package/dist/ai-service/agent/tools2/access-control.js.map +1 -1
- package/dist/ai-service/agent/tools2/registry.d.ts +3 -0
- package/dist/ai-service/agent/tools2/registry.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/registry.js +50 -8
- package/dist/ai-service/agent/tools2/registry.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js +3 -2
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-searchable-dropdown.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-searchable-dropdown.js +2 -1
- package/dist/ai-service/agent/tools2/tools/ask-searchable-dropdown.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/deploy-service.d.ts +16 -0
- package/dist/ai-service/agent/tools2/tools/deploy-service.d.ts.map +1 -0
- package/dist/ai-service/agent/tools2/tools/deploy-service.js +135 -0
- package/dist/ai-service/agent/tools2/tools/deploy-service.js.map +1 -0
- package/dist/ai-service/agent/tools2/tools/download-attachments.d.ts +33 -0
- package/dist/ai-service/agent/tools2/tools/download-attachments.d.ts.map +1 -0
- package/dist/ai-service/agent/tools2/tools/download-attachments.js +308 -0
- package/dist/ai-service/agent/tools2/tools/download-attachments.js.map +1 -0
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +8 -4
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/git.d.ts +57 -1
- package/dist/ai-service/agent/tools2/tools/git.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/git.js +275 -8
- package/dist/ai-service/agent/tools2/tools/git.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/index.d.ts +2 -1
- package/dist/ai-service/agent/tools2/tools/index.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/index.js +2 -1
- package/dist/ai-service/agent/tools2/tools/index.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.d.ts +4 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.js +20 -4
- package/dist/ai-service/agent/tools2/tools/list-attachments.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/spawn-coding-subagents.d.ts +28 -0
- package/dist/ai-service/agent/tools2/tools/spawn-coding-subagents.d.ts.map +1 -0
- package/dist/ai-service/agent/tools2/tools/spawn-coding-subagents.js +152 -0
- package/dist/ai-service/agent/tools2/tools/spawn-coding-subagents.js.map +1 -0
- package/dist/ai-service/agent/tools2/types.d.ts +1 -18
- package/dist/ai-service/agent/tools2/types.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/types.js.map +1 -1
- package/dist/ai-service/agent/utils.d.ts.map +1 -1
- package/dist/ai-service/agent/utils.js +22 -5
- package/dist/ai-service/agent/utils.js.map +1 -1
- package/dist/ai-service/app-interface/file-system-interface.d.ts +0 -4
- package/dist/ai-service/app-interface/file-system-interface.d.ts.map +1 -1
- package/dist/ai-service/app-interface/file-system-interface.js +0 -21
- package/dist/ai-service/app-interface/file-system-interface.js.map +1 -1
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts +11 -1
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts.map +1 -1
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.js +29 -7
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.js.map +1 -1
- package/dist/ai-service/app-interface/shell.d.ts +6 -0
- package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
- package/dist/ai-service/app-interface/shell.js +8 -0
- package/dist/ai-service/app-interface/shell.js.map +1 -1
- package/dist/ai-service/app-skills/helpers.d.ts.map +1 -1
- package/dist/ai-service/app-skills/helpers.js +4 -2
- package/dist/ai-service/app-skills/helpers.js.map +1 -1
- package/dist/ai-service/attachments/store.d.ts +18 -2
- package/dist/ai-service/attachments/store.d.ts.map +1 -1
- package/dist/ai-service/attachments/store.js +102 -9
- package/dist/ai-service/attachments/store.js.map +1 -1
- package/dist/ai-service/attachments/uploaded-content-part.d.ts +5 -2
- package/dist/ai-service/attachments/uploaded-content-part.d.ts.map +1 -1
- package/dist/ai-service/attachments/uploaded-content-part.js +32 -0
- package/dist/ai-service/attachments/uploaded-content-part.js.map +1 -1
- package/dist/ai-service/chat/chat-session-store.d.ts +2 -2
- package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
- package/dist/ai-service/chat/chat-session-store.js +45 -243
- package/dist/ai-service/chat/chat-session-store.js.map +1 -1
- package/dist/ai-service/chat/utils.d.ts +6 -0
- package/dist/ai-service/chat/utils.d.ts.map +1 -1
- package/dist/ai-service/chat/utils.js +47 -0
- package/dist/ai-service/chat/utils.js.map +1 -1
- package/dist/ai-service/features.d.ts +4 -0
- package/dist/ai-service/features.d.ts.map +1 -1
- package/dist/ai-service/features.js +4 -0
- package/dist/ai-service/features.js.map +1 -1
- package/dist/ai-service/index.d.ts +36 -11
- package/dist/ai-service/index.d.ts.map +1 -1
- package/dist/ai-service/index.js +228 -68
- package/dist/ai-service/index.js.map +1 -1
- package/dist/ai-service/judge/tools/playwright-action.d.ts +1 -1
- package/dist/ai-service/llm/client.d.ts.map +1 -1
- package/dist/ai-service/llm/client.js +4 -2
- package/dist/ai-service/llm/client.js.map +1 -1
- package/dist/ai-service/llm/stream/observers/retry-notification.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/observers/retry-notification.js +4 -2
- package/dist/ai-service/llm/stream/observers/retry-notification.js.map +1 -1
- package/dist/ai-service/prompt-builder-service/classifiers/prompt-interpret-task.d.ts.map +1 -1
- package/dist/ai-service/prompt-builder-service/classifiers/prompt-interpret-task.js +1 -16
- package/dist/ai-service/prompt-builder-service/classifiers/prompt-interpret-task.js.map +1 -1
- package/dist/ai-service/prompt-builder-service/types.d.ts +2 -13
- package/dist/ai-service/prompt-builder-service/types.d.ts.map +1 -1
- package/dist/ai-service/prompt-builder-service/types.js.map +1 -1
- package/dist/ai-service/skills/system/_registry.generated.d.ts.map +1 -1
- package/dist/ai-service/skills/system/_registry.generated.js +6 -0
- package/dist/ai-service/skills/system/_registry.generated.js.map +1 -1
- package/dist/ai-service/skills/system/superblocks-migration/references/focused-debug.generated.d.ts +2 -0
- package/dist/ai-service/skills/system/superblocks-migration/references/focused-debug.generated.d.ts.map +1 -0
- package/dist/ai-service/skills/system/superblocks-migration/references/focused-debug.generated.js +58 -0
- package/dist/ai-service/skills/system/superblocks-migration/references/focused-debug.generated.js.map +1 -0
- package/dist/ai-service/skills/system/superblocks-migration/references/yaml-block-mapping.generated.d.ts +2 -0
- package/dist/ai-service/skills/system/superblocks-migration/references/yaml-block-mapping.generated.d.ts.map +1 -0
- package/dist/ai-service/skills/system/superblocks-migration/references/yaml-block-mapping.generated.js +107 -0
- package/dist/ai-service/skills/system/superblocks-migration/references/yaml-block-mapping.generated.js.map +1 -0
- package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts +2 -0
- package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts.map +1 -0
- package/dist/ai-service/skills/system/superblocks-migration/skill.generated.js +137 -0
- package/dist/ai-service/skills/system/superblocks-migration/skill.generated.js.map +1 -0
- package/dist/ai-service/state-machine/clark-fsm.d.ts +26 -13
- package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.js +12 -7
- package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.js +51 -27
- package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/awaiting-user.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/awaiting-user.js +15 -6
- package/dist/ai-service/state-machine/handlers/awaiting-user.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/idle.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/idle.js +4 -2
- package/dist/ai-service/state-machine/handlers/idle.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js +48 -15
- package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/post-processing.d.ts +1 -1
- package/dist/ai-service/state-machine/handlers/post-processing.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/post-processing.js +23 -151
- package/dist/ai-service/state-machine/handlers/post-processing.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/runtime-reviewing.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/runtime-reviewing.js +16 -8
- package/dist/ai-service/state-machine/handlers/runtime-reviewing.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/change-info.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/change-info.js +2 -15
- package/dist/ai-service/state-machine/helpers/change-info.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/peer.d.ts +3 -3
- package/dist/ai-service/state-machine/helpers/peer.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/peer.js +9 -23
- package/dist/ai-service/state-machine/helpers/peer.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/stable-peer.d.ts +52 -0
- package/dist/ai-service/state-machine/helpers/stable-peer.d.ts.map +1 -0
- package/dist/ai-service/state-machine/helpers/stable-peer.js +141 -0
- package/dist/ai-service/state-machine/helpers/stable-peer.js.map +1 -0
- package/dist/ai-service/state-machine/mocks.d.ts.map +1 -1
- package/dist/ai-service/state-machine/mocks.js +0 -17
- package/dist/ai-service/state-machine/mocks.js.map +1 -1
- package/dist/ai-service/types.d.ts +2 -21
- package/dist/ai-service/types.d.ts.map +1 -1
- package/dist/ai-service/types.js.map +1 -1
- package/dist/ai-service/util/archive-extractors.d.ts +52 -0
- package/dist/ai-service/util/archive-extractors.d.ts.map +1 -0
- package/dist/ai-service/util/archive-extractors.js +278 -0
- package/dist/ai-service/util/archive-extractors.js.map +1 -0
- package/dist/codegen.d.ts +1 -22
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +1 -117
- package/dist/codegen.js.map +1 -1
- package/dist/components-manager.d.ts +0 -6
- package/dist/components-manager.d.ts.map +1 -1
- package/dist/components-manager.js +0 -27
- package/dist/components-manager.js.map +1 -1
- package/dist/file-sync-vite-plugin.d.ts.map +1 -1
- package/dist/file-sync-vite-plugin.js +47 -94
- package/dist/file-sync-vite-plugin.js.map +1 -1
- package/dist/file-system-manager.d.ts +2 -15
- package/dist/file-system-manager.d.ts.map +1 -1
- package/dist/file-system-manager.js +16 -128
- package/dist/file-system-manager.js.map +1 -1
- package/dist/git-service/live-branch.d.ts.map +1 -1
- package/dist/git-service/live-branch.js +15 -1
- package/dist/git-service/live-branch.js.map +1 -1
- package/dist/lock-service/index.d.ts.map +1 -1
- package/dist/lock-service/index.js +8 -5
- package/dist/lock-service/index.js.map +1 -1
- package/dist/migration/get-fullstack-template-dir.d.ts +37 -0
- package/dist/migration/get-fullstack-template-dir.d.ts.map +1 -0
- package/dist/migration/get-fullstack-template-dir.js +99 -0
- package/dist/migration/get-fullstack-template-dir.js.map +1 -0
- package/dist/migration/migration-checklist.d.ts +60 -0
- package/dist/migration/migration-checklist.d.ts.map +1 -0
- package/dist/migration/migration-checklist.js +230 -0
- package/dist/migration/migration-checklist.js.map +1 -0
- package/dist/migration/migration-routes.d.ts +23 -0
- package/dist/migration/migration-routes.d.ts.map +1 -0
- package/dist/migration/migration-routes.js +533 -0
- package/dist/migration/migration-routes.js.map +1 -0
- package/dist/migration/restructure.d.ts +76 -0
- package/dist/migration/restructure.d.ts.map +1 -0
- package/dist/migration/restructure.js +446 -0
- package/dist/migration/restructure.js.map +1 -0
- package/dist/migration/translation-prompt.d.ts +22 -0
- package/dist/migration/translation-prompt.d.ts.map +1 -0
- package/dist/migration/translation-prompt.js +27 -0
- package/dist/migration/translation-prompt.js.map +1 -0
- package/dist/migration-templates/app-fullstack/client/App.tsx +17 -0
- package/dist/migration-templates/app-fullstack/client/components/common/sonner.tsx +20 -0
- package/dist/migration-templates/app-fullstack/client/components/hooks/use-active-page.ts +73 -0
- package/dist/migration-templates/app-fullstack/client/components/hooks/use-mobile.ts +21 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/accordion.tsx +197 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/area-chart.tsx +432 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/aspect-ratio.tsx +45 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/avatar.tsx +117 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/badge.tsx +143 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/bar-chart.tsx +390 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/breadcrumb.tsx +259 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/button.tsx +182 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/calendar.tsx +300 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/card.tsx +129 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/chart.tsx +403 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/chat.tsx +2303 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/checkbox.tsx +97 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/code-block-content.tsx +66 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/date-range-picker.tsx +396 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/dialog.tsx +223 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/dropdown-menu.tsx +284 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/file-dropzone.tsx +395 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/file-input.tsx +166 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/hover-card.tsx +162 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/icon.tsx +133 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/image.tsx +68 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/input.tsx +219 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/label.tsx +55 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/line-chart.tsx +380 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/link.tsx +139 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/navigation-menu.tsx +345 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/pagination.tsx +192 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/pie-chart.tsx +295 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/popover.tsx +162 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/progress.tsx +69 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/radar-chart.tsx +386 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/radial-chart.tsx +402 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/scroll-area.tsx +86 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/select.tsx +229 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/separator.tsx +62 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/sheet.tsx +234 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/sidebar.tsx +974 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/skeleton.tsx +13 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/slider.tsx +198 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/switch.tsx +95 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/table.tsx +145 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/tabs.tsx +87 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/textarea.tsx +148 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/toggle-group.tsx +225 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/toggle.tsx +150 -0
- package/dist/migration-templates/app-fullstack/client/components/ui/tooltip.tsx +175 -0
- package/dist/migration-templates/app-fullstack/client/hooks/useApi.ts +25 -0
- package/dist/migration-templates/app-fullstack/client/hooks/useApiData.ts +10 -0
- package/dist/migration-templates/app-fullstack/client/index.css +131 -0
- package/dist/migration-templates/app-fullstack/client/lib/executeApi.ts +9 -0
- package/dist/migration-templates/app-fullstack/client/lib/utils.ts +6 -0
- package/dist/migration-templates/app-fullstack/client/pages/Page1/index.tsx +3 -0
- package/dist/migration-templates/app-fullstack/client/root.tsx +17 -0
- package/dist/migration-templates/app-fullstack/client/router.tsx +48 -0
- package/dist/migration-templates/app-fullstack/client/types/node.d.ts +9 -0
- package/dist/migration-templates/app-fullstack/components.json +21 -0
- package/dist/migration-templates/app-fullstack/eslint.config.js +108 -0
- package/dist/migration-templates/app-fullstack/package.json +89 -0
- package/dist/migration-templates/app-fullstack/server/.gitkeep +0 -0
- package/dist/migration-templates/app-fullstack/server/apis/index.ts +22 -0
- package/dist/migration-templates/app-fullstack/server/index.ts +2 -0
- package/dist/migration-templates/app-fullstack/tsconfig.client.json +27 -0
- package/dist/migration-templates/app-fullstack/tsconfig.eslint.json +8 -0
- package/dist/migration-templates/app-fullstack/tsconfig.json +25 -0
- package/dist/migration-templates/app-fullstack/tsconfig.server.json +13 -0
- package/dist/migration-templates/app-fullstack/vite.config.ts +17 -0
- package/dist/parsing/imports.d.ts +0 -16
- package/dist/parsing/imports.d.ts.map +1 -1
- package/dist/parsing/imports.js +0 -68
- package/dist/parsing/imports.js.map +1 -1
- package/dist/parsing/jsx.d.ts +0 -2
- package/dist/parsing/jsx.d.ts.map +1 -1
- package/dist/parsing/jsx.js +0 -62
- package/dist/parsing/jsx.js.map +1 -1
- package/dist/socket-manager.d.ts.map +1 -1
- package/dist/socket-manager.js +109 -32
- package/dist/socket-manager.js.map +1 -1
- package/dist/source-tracker.d.ts +7 -85
- package/dist/source-tracker.d.ts.map +1 -1
- package/dist/source-tracker.js +19 -695
- package/dist/source-tracker.js.map +1 -1
- package/dist/sync-service/index.d.ts +79 -2
- package/dist/sync-service/index.d.ts.map +1 -1
- package/dist/sync-service/index.js +139 -10
- package/dist/sync-service/index.js.map +1 -1
- package/package.json +11 -9
- package/dist/ai-service/artifacts/bolt.d.ts +0 -8
- package/dist/ai-service/artifacts/bolt.d.ts.map +0 -1
- package/dist/ai-service/artifacts/bolt.js +0 -92
- package/dist/ai-service/artifacts/bolt.js.map +0 -1
- package/dist/ai-service/result-buffer/bolt.d.ts +0 -18
- package/dist/ai-service/result-buffer/bolt.d.ts.map +0 -1
- package/dist/ai-service/result-buffer/bolt.js +0 -100
- package/dist/ai-service/result-buffer/bolt.js.map +0 -1
- package/dist/ai-service/result-buffer/shared.d.ts +0 -17
- package/dist/ai-service/result-buffer/shared.d.ts.map +0 -1
- package/dist/ai-service/result-buffer/shared.js +0 -7
- package/dist/ai-service/result-buffer/shared.js.map +0 -1
- package/dist/inject-no-select.d.ts +0 -15
- package/dist/inject-no-select.d.ts.map +0 -1
- package/dist/inject-no-select.js +0 -175
- package/dist/inject-no-select.js.map +0 -1
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
LineChart as LineChartComponent,
|
|
4
|
+
Line,
|
|
5
|
+
XAxis,
|
|
6
|
+
YAxis,
|
|
7
|
+
CartesianGrid,
|
|
8
|
+
LabelList,
|
|
9
|
+
} from "recharts";
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
registerComponent,
|
|
13
|
+
Prop,
|
|
14
|
+
Section,
|
|
15
|
+
PropsCategory,
|
|
16
|
+
} from "@superblocksteam/library";
|
|
17
|
+
|
|
18
|
+
import { cn } from "@/lib/utils";
|
|
19
|
+
|
|
20
|
+
import type { ChartConfig } from "./chart";
|
|
21
|
+
import {
|
|
22
|
+
ChartContainer,
|
|
23
|
+
ChartTooltip,
|
|
24
|
+
ChartTooltipContent,
|
|
25
|
+
ChartLegend,
|
|
26
|
+
ChartLegendContent,
|
|
27
|
+
sanitizeForCssVar,
|
|
28
|
+
fixColorFormat,
|
|
29
|
+
createKeyMapping,
|
|
30
|
+
} from "./chart";
|
|
31
|
+
|
|
32
|
+
type ComponentProps = Omit<
|
|
33
|
+
React.ComponentPropsWithoutRef<typeof ChartContainer>,
|
|
34
|
+
"children" | "config"
|
|
35
|
+
> & {
|
|
36
|
+
data?: any[];
|
|
37
|
+
xAxisKey?: string;
|
|
38
|
+
categories?: string[];
|
|
39
|
+
seriesLabels?: Record<string, string>;
|
|
40
|
+
colors?: string[];
|
|
41
|
+
gridStyle?: "solid" | "dashed" | "hidden";
|
|
42
|
+
showXAxis?: boolean;
|
|
43
|
+
showYAxis?: boolean;
|
|
44
|
+
showTooltip?: boolean;
|
|
45
|
+
showLegend?: boolean;
|
|
46
|
+
lineType?:
|
|
47
|
+
| "monotone"
|
|
48
|
+
| "linear"
|
|
49
|
+
| "step"
|
|
50
|
+
| "bump"
|
|
51
|
+
| "basis"
|
|
52
|
+
| "stepBefore"
|
|
53
|
+
| "stepAfter"
|
|
54
|
+
| "natural";
|
|
55
|
+
strokeWidth?: number;
|
|
56
|
+
connectNulls?: boolean;
|
|
57
|
+
enableAnimation?: boolean;
|
|
58
|
+
showDots?: boolean;
|
|
59
|
+
showPointLabels?: boolean;
|
|
60
|
+
onDataClick?: (data: any) => void;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const LineChart = ({ className, ...props }: ComponentProps) => {
|
|
64
|
+
const chartConfig: ChartConfig = React.useMemo(() => {
|
|
65
|
+
const effectiveCategories =
|
|
66
|
+
props.categories && props.categories.length > 0
|
|
67
|
+
? props.categories
|
|
68
|
+
: props.data && props.data.length > 0
|
|
69
|
+
? Object.keys(props.data[0]).filter((key) => {
|
|
70
|
+
if (key === props.xAxisKey) return false;
|
|
71
|
+
const value = props.data![0][key];
|
|
72
|
+
return typeof value === "number";
|
|
73
|
+
})
|
|
74
|
+
: [];
|
|
75
|
+
|
|
76
|
+
if (!effectiveCategories.length) return {};
|
|
77
|
+
|
|
78
|
+
const config: ChartConfig = {};
|
|
79
|
+
effectiveCategories.forEach((key, index) => {
|
|
80
|
+
const sanitizedKey = sanitizeForCssVar(key);
|
|
81
|
+
const label = props.seriesLabels?.[key] || key;
|
|
82
|
+
const color = fixColorFormat(
|
|
83
|
+
props.colors?.[index] || `var(--chart-${(index % 5) + 1})`,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
config[sanitizedKey] = {
|
|
87
|
+
label,
|
|
88
|
+
color,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return config;
|
|
93
|
+
}, [
|
|
94
|
+
props.categories,
|
|
95
|
+
props.seriesLabels,
|
|
96
|
+
props.colors,
|
|
97
|
+
props.data,
|
|
98
|
+
props.xAxisKey,
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
const keyMapping = React.useMemo(() => {
|
|
102
|
+
const effectiveCategories =
|
|
103
|
+
props.categories && props.categories.length > 0
|
|
104
|
+
? props.categories
|
|
105
|
+
: props.data && props.data.length > 0
|
|
106
|
+
? Object.keys(props.data[0]).filter((key) => {
|
|
107
|
+
if (key === props.xAxisKey) return false;
|
|
108
|
+
const value = props.data![0][key];
|
|
109
|
+
return typeof value === "number";
|
|
110
|
+
})
|
|
111
|
+
: [];
|
|
112
|
+
|
|
113
|
+
return effectiveCategories.length > 0
|
|
114
|
+
? createKeyMapping(
|
|
115
|
+
Object.fromEntries(effectiveCategories.map((k) => [k, { label: k }])),
|
|
116
|
+
)
|
|
117
|
+
: new Map();
|
|
118
|
+
}, [props.categories, props.data, props.xAxisKey]);
|
|
119
|
+
|
|
120
|
+
const hasData = Array.isArray(props.data) && props.data?.length;
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<ChartContainer
|
|
124
|
+
{...props}
|
|
125
|
+
className={cn("h-full w-full pt-4 pb-4 pr-4", className)}
|
|
126
|
+
config={chartConfig}
|
|
127
|
+
>
|
|
128
|
+
{hasData ? (
|
|
129
|
+
<LineChartComponent
|
|
130
|
+
data={props.data}
|
|
131
|
+
onClick={props.onDataClick}
|
|
132
|
+
accessibilityLayer
|
|
133
|
+
>
|
|
134
|
+
{props.gridStyle !== "hidden" && (
|
|
135
|
+
<CartesianGrid
|
|
136
|
+
vertical={false}
|
|
137
|
+
strokeDasharray={props.gridStyle === "dashed" ? "3 3" : "0"}
|
|
138
|
+
/>
|
|
139
|
+
)}
|
|
140
|
+
|
|
141
|
+
{props.showXAxis && (
|
|
142
|
+
<XAxis
|
|
143
|
+
dataKey={props.xAxisKey}
|
|
144
|
+
tickLine={false}
|
|
145
|
+
axisLine={false}
|
|
146
|
+
tickMargin={8}
|
|
147
|
+
/>
|
|
148
|
+
)}
|
|
149
|
+
|
|
150
|
+
{props.showYAxis && (
|
|
151
|
+
<YAxis tickLine={false} axisLine={false} tickMargin={8} />
|
|
152
|
+
)}
|
|
153
|
+
|
|
154
|
+
{props.showTooltip && (
|
|
155
|
+
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
|
|
156
|
+
)}
|
|
157
|
+
|
|
158
|
+
{props.showLegend && <ChartLegend content={<ChartLegendContent />} />}
|
|
159
|
+
|
|
160
|
+
{Object.keys(chartConfig).map((key) => {
|
|
161
|
+
const originalKey = keyMapping.get(key) || key;
|
|
162
|
+
const wouldHideLine = props.strokeWidth === 0;
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<Line
|
|
166
|
+
key={key}
|
|
167
|
+
dataKey={originalKey}
|
|
168
|
+
type={props.lineType}
|
|
169
|
+
stroke={`var(--color-${key})`}
|
|
170
|
+
{...(!wouldHideLine && { strokeWidth: props.strokeWidth })}
|
|
171
|
+
connectNulls={props.connectNulls}
|
|
172
|
+
isAnimationActive={props.enableAnimation}
|
|
173
|
+
dot={
|
|
174
|
+
props.showDots
|
|
175
|
+
? {
|
|
176
|
+
fill: `var(--color-${key})`,
|
|
177
|
+
strokeWidth: 2,
|
|
178
|
+
r: 2,
|
|
179
|
+
}
|
|
180
|
+
: false
|
|
181
|
+
}
|
|
182
|
+
activeDot={{
|
|
183
|
+
fill: `var(--color-${key})`,
|
|
184
|
+
strokeWidth: 2,
|
|
185
|
+
r: 4,
|
|
186
|
+
}}
|
|
187
|
+
>
|
|
188
|
+
{props.showPointLabels && (
|
|
189
|
+
<LabelList
|
|
190
|
+
dataKey={originalKey}
|
|
191
|
+
position="top"
|
|
192
|
+
offset={10}
|
|
193
|
+
className="fill-foreground font-semibold text-xs"
|
|
194
|
+
/>
|
|
195
|
+
)}
|
|
196
|
+
</Line>
|
|
197
|
+
);
|
|
198
|
+
})}
|
|
199
|
+
</LineChartComponent>
|
|
200
|
+
) : (
|
|
201
|
+
<div className="flex items-center justify-center h-full w-full min-h-32 text-muted-foreground">
|
|
202
|
+
No data available
|
|
203
|
+
</div>
|
|
204
|
+
)}
|
|
205
|
+
</ChartContainer>
|
|
206
|
+
);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
registerComponent(LineChart, {
|
|
210
|
+
general: Section.category(PropsCategory.Content).children({
|
|
211
|
+
data: Prop.array<any>()
|
|
212
|
+
.propertiesPanel({
|
|
213
|
+
label: "Data",
|
|
214
|
+
description: "Array of data objects for the line chart",
|
|
215
|
+
controlType: "FUNCTION_CODE_EDITOR",
|
|
216
|
+
isJSConvertible: false,
|
|
217
|
+
})
|
|
218
|
+
.docs({
|
|
219
|
+
description:
|
|
220
|
+
"Array of objects where each object represents a data point with X-axis and Y-axis values. Each object should contain the xAxisKey property and properties for each data series defined in categories. Example: [{month: 'January', desktop: 186, mobile: 80}, {month: 'February', desktop: 305, mobile: 200}]. Multiple Y-value properties create multiple line series that can be styled independently.",
|
|
221
|
+
}),
|
|
222
|
+
xAxisKey: Prop.string()
|
|
223
|
+
.propertiesPanel({
|
|
224
|
+
label: "X-axis data key",
|
|
225
|
+
description: " name for X-axis values (categories)",
|
|
226
|
+
placeholder: "month",
|
|
227
|
+
controlType: "DROP_DOWN",
|
|
228
|
+
options: function (this) {
|
|
229
|
+
if (!this.data || !Array.isArray(this.data) || !this.data.length) {
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
return Object.keys(this.data[0]).map((key) => ({
|
|
233
|
+
label: key,
|
|
234
|
+
value: key,
|
|
235
|
+
}));
|
|
236
|
+
},
|
|
237
|
+
})
|
|
238
|
+
.docs({
|
|
239
|
+
description:
|
|
240
|
+
"The property name in your data objects that contains the X-axis values (categories, dates, or sequential values). This determines the horizontal positioning and connection order of data points along the line. Should be consistent across all data objects.",
|
|
241
|
+
}),
|
|
242
|
+
categories: Prop.array<string>()
|
|
243
|
+
.propertiesPanel({
|
|
244
|
+
label: "Categories",
|
|
245
|
+
description:
|
|
246
|
+
"Array of data keys to plot as line series (optional, auto-detects numeric properties if not provided)",
|
|
247
|
+
controlType: "FUNCTION_CODE_EDITOR",
|
|
248
|
+
isJSConvertible: false,
|
|
249
|
+
})
|
|
250
|
+
.docs({
|
|
251
|
+
description:
|
|
252
|
+
"Array of property names from your data objects to plot as separate line series. Example: ['desktop', 'mobile'] will create two line series. Each category should correspond to a numeric property in your data. If not provided, automatically detects all numeric properties (excluding xAxisKey) from the data.",
|
|
253
|
+
}),
|
|
254
|
+
seriesLabels: Prop.any<Record<string, string>>()
|
|
255
|
+
.propertiesPanel({
|
|
256
|
+
label: "Series labels",
|
|
257
|
+
description:
|
|
258
|
+
"Optional labels for series (optional, defaults to category names)",
|
|
259
|
+
controlType: "FUNCTION_CODE_EDITOR",
|
|
260
|
+
isJSConvertible: false,
|
|
261
|
+
})
|
|
262
|
+
.docs({
|
|
263
|
+
description:
|
|
264
|
+
"Optional object mapping category keys to display labels. Example: {desktop: 'Desktop Users', mobile: 'Mobile Users'}. If not provided, the category keys are used as labels.",
|
|
265
|
+
}),
|
|
266
|
+
colors: Prop.array<string>()
|
|
267
|
+
.propertiesPanel({
|
|
268
|
+
label: "Colors",
|
|
269
|
+
description: "Array of colors for series (optional)",
|
|
270
|
+
controlType: "FUNCTION_CODE_EDITOR",
|
|
271
|
+
isJSConvertible: false,
|
|
272
|
+
})
|
|
273
|
+
.docs({
|
|
274
|
+
description:
|
|
275
|
+
"Optional array of color values to use for series in order. Can be hex codes, rgb values, or CSS variables like 'var(--chart-1)'. Falls back to theme colors if not provided.",
|
|
276
|
+
}),
|
|
277
|
+
}),
|
|
278
|
+
appearance: Section.category(PropsCategory.Appearance).children({
|
|
279
|
+
gridStyle: Prop.string<"solid" | "dashed" | "hidden">().propertiesPanel({
|
|
280
|
+
label: "Grid style",
|
|
281
|
+
description: "Style of the chart grid lines",
|
|
282
|
+
controlType: "DROP_DOWN",
|
|
283
|
+
options: [
|
|
284
|
+
{ label: "Solid", value: "solid" },
|
|
285
|
+
{ label: "Dashed", value: "dashed" },
|
|
286
|
+
{ label: "Hidden", value: "hidden" },
|
|
287
|
+
],
|
|
288
|
+
}),
|
|
289
|
+
showXAxis: Prop.boolean().propertiesPanel({
|
|
290
|
+
label: "Show X-axis",
|
|
291
|
+
description: "Display X-axis with labels",
|
|
292
|
+
controlType: "SWITCH",
|
|
293
|
+
}),
|
|
294
|
+
showYAxis: Prop.boolean().propertiesPanel({
|
|
295
|
+
label: "Show Y-axis",
|
|
296
|
+
description: "Display Y-axis with labels",
|
|
297
|
+
controlType: "SWITCH",
|
|
298
|
+
}),
|
|
299
|
+
showTooltip: Prop.boolean().propertiesPanel({
|
|
300
|
+
label: "Show tooltip",
|
|
301
|
+
description: "Display tooltip on hover",
|
|
302
|
+
controlType: "SWITCH",
|
|
303
|
+
}),
|
|
304
|
+
showLegend: Prop.boolean().propertiesPanel({
|
|
305
|
+
label: "Show legend",
|
|
306
|
+
description: "Display chart legend",
|
|
307
|
+
controlType: "SWITCH",
|
|
308
|
+
}),
|
|
309
|
+
showPointLabels: Prop.boolean().propertiesPanel({
|
|
310
|
+
label: "Show point labels",
|
|
311
|
+
description: "Display labels on data points",
|
|
312
|
+
controlType: "SWITCH",
|
|
313
|
+
}),
|
|
314
|
+
strokeWidth: Prop.number().propertiesPanel({
|
|
315
|
+
label: "Stroke width",
|
|
316
|
+
description: "Width of the line stroke",
|
|
317
|
+
}),
|
|
318
|
+
showDots: Prop.boolean().propertiesPanel({
|
|
319
|
+
label: "Show dots",
|
|
320
|
+
description: "Display dots on the line at data points",
|
|
321
|
+
controlType: "SWITCH",
|
|
322
|
+
}),
|
|
323
|
+
connectNulls: Prop.boolean().propertiesPanel({
|
|
324
|
+
label: "Connect nulls",
|
|
325
|
+
description: "Connect nulls with the previous non-null value",
|
|
326
|
+
controlType: "SWITCH",
|
|
327
|
+
}),
|
|
328
|
+
lineType: Prop.string<
|
|
329
|
+
| "linear"
|
|
330
|
+
| "bump"
|
|
331
|
+
| "step"
|
|
332
|
+
| "basis"
|
|
333
|
+
| "stepBefore"
|
|
334
|
+
| "stepAfter"
|
|
335
|
+
| "natural"
|
|
336
|
+
| "monotone"
|
|
337
|
+
>()
|
|
338
|
+
.propertiesPanel({
|
|
339
|
+
label: "Line type",
|
|
340
|
+
description: "Type of line to display",
|
|
341
|
+
controlType: "DROP_DOWN",
|
|
342
|
+
options: [
|
|
343
|
+
{ label: "Linear", value: "linear" },
|
|
344
|
+
{ label: "Bump", value: "bump" },
|
|
345
|
+
{ label: "Step", value: "step" },
|
|
346
|
+
{ label: "Basis", value: "basis" },
|
|
347
|
+
{ label: "Step Before", value: "stepBefore" },
|
|
348
|
+
{ label: "Step After", value: "stepAfter" },
|
|
349
|
+
{ label: "Natural", value: "natural" },
|
|
350
|
+
{ label: "Monotone", value: "monotone" },
|
|
351
|
+
],
|
|
352
|
+
})
|
|
353
|
+
.docs({
|
|
354
|
+
description:
|
|
355
|
+
"Curve interpolation type for line paths. 'linear' creates straight line segments between points, 'monotone' creates smooth curves that preserve monotonicity (no overshooting), 'natural' creates natural spline curves for smoothest appearance, 'step' creates step functions with sharp transitions, 'basis' creates B-spline curves, 'bump' creates rounded transitions, 'stepBefore' steps before each point, 'stepAfter' steps after each point. Choose 'monotone' for smooth data trends, 'linear' for precise point-to-point connections.",
|
|
356
|
+
}),
|
|
357
|
+
}),
|
|
358
|
+
interaction: Section.category(PropsCategory.Interaction).children({
|
|
359
|
+
enableAnimation: Prop.boolean().propertiesPanel({
|
|
360
|
+
label: "Enable animation",
|
|
361
|
+
description: "Enable chart animations on load",
|
|
362
|
+
controlType: "SWITCH",
|
|
363
|
+
}),
|
|
364
|
+
}),
|
|
365
|
+
events: Section.category(PropsCategory.EventHandlers).children({
|
|
366
|
+
onDataClick: Prop.eventHandler().propertiesPanel({
|
|
367
|
+
label: "onDataClick",
|
|
368
|
+
description: "Triggered when a line is clicked",
|
|
369
|
+
computedArgs: [
|
|
370
|
+
{
|
|
371
|
+
name: "data",
|
|
372
|
+
type: "object",
|
|
373
|
+
description: "The data point that was clicked",
|
|
374
|
+
},
|
|
375
|
+
],
|
|
376
|
+
}),
|
|
377
|
+
}),
|
|
378
|
+
}).editorConfig({ icon: "chart" });
|
|
379
|
+
|
|
380
|
+
export { LineChart };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { Link as BaseLink } from "react-router";
|
|
3
|
+
import type { LinkProps as RouterLinkProps } from "react-router";
|
|
4
|
+
|
|
5
|
+
import { registerComponent } from "@superblocksteam/library";
|
|
6
|
+
import {
|
|
7
|
+
Prop,
|
|
8
|
+
Section,
|
|
9
|
+
PropsCategory,
|
|
10
|
+
type PropertiesPanelDefinition,
|
|
11
|
+
type EditorConfig,
|
|
12
|
+
} from "@superblocksteam/library";
|
|
13
|
+
|
|
14
|
+
import { cn } from "@/lib/utils";
|
|
15
|
+
|
|
16
|
+
import { Button } from "./button";
|
|
17
|
+
|
|
18
|
+
// Base Link Component
|
|
19
|
+
type BaseLinkProps = RouterLinkProps &
|
|
20
|
+
React.RefAttributes<HTMLAnchorElement> & {
|
|
21
|
+
applyLinkStyles?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function BaseLinkComponent({
|
|
25
|
+
children,
|
|
26
|
+
className,
|
|
27
|
+
applyLinkStyles = true,
|
|
28
|
+
...props
|
|
29
|
+
}: BaseLinkProps) {
|
|
30
|
+
return (
|
|
31
|
+
<BaseLink
|
|
32
|
+
className={cn(
|
|
33
|
+
"cursor-pointer",
|
|
34
|
+
applyLinkStyles && "underline underline-offset-4",
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</BaseLink>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Link with Variant Support
|
|
45
|
+
export type LinkProps = BaseLinkProps & {
|
|
46
|
+
openInNewTab?: boolean;
|
|
47
|
+
variant?: "link" | "button-default" | "button-secondary";
|
|
48
|
+
} & Record<string, unknown>;
|
|
49
|
+
|
|
50
|
+
const Link = ({
|
|
51
|
+
children,
|
|
52
|
+
openInNewTab,
|
|
53
|
+
variant,
|
|
54
|
+
style,
|
|
55
|
+
...props
|
|
56
|
+
}: LinkProps) => {
|
|
57
|
+
const linkProps = useMemo(
|
|
58
|
+
() => ({
|
|
59
|
+
...props,
|
|
60
|
+
...(openInNewTab && {
|
|
61
|
+
target: "_blank",
|
|
62
|
+
rel: "noopener noreferrer",
|
|
63
|
+
}),
|
|
64
|
+
}),
|
|
65
|
+
[props, openInNewTab],
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const buttonVariant =
|
|
69
|
+
variant === "button-default"
|
|
70
|
+
? "default"
|
|
71
|
+
: variant === "button-secondary"
|
|
72
|
+
? "secondary"
|
|
73
|
+
: undefined;
|
|
74
|
+
|
|
75
|
+
if (buttonVariant) {
|
|
76
|
+
return (
|
|
77
|
+
<Button asChild variant={buttonVariant} style={style}>
|
|
78
|
+
<BaseLinkComponent applyLinkStyles={false} {...linkProps}>
|
|
79
|
+
{children}
|
|
80
|
+
</BaseLinkComponent>
|
|
81
|
+
</Button>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<BaseLinkComponent style={style} {...linkProps}>
|
|
87
|
+
{children}
|
|
88
|
+
</BaseLinkComponent>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Properties Definition
|
|
93
|
+
const propertiesDefinition: PropertiesPanelDefinition<LinkProps> = {
|
|
94
|
+
general: Section.category(PropsCategory.Content).add({
|
|
95
|
+
children: Prop.jsx().propertiesPanel({
|
|
96
|
+
label: "Text",
|
|
97
|
+
}),
|
|
98
|
+
openInNewTab: Prop.boolean().propertiesPanel({
|
|
99
|
+
label: "Open in new tab",
|
|
100
|
+
controlType: "SWITCH",
|
|
101
|
+
description: "Open the link in a new browser tab",
|
|
102
|
+
}),
|
|
103
|
+
}),
|
|
104
|
+
appearance: Section.category(PropsCategory.Appearance).children({
|
|
105
|
+
variant: Prop.string<"link" | "button-default" | "button-secondary">()
|
|
106
|
+
|
|
107
|
+
.propertiesPanel({
|
|
108
|
+
label: "Style",
|
|
109
|
+
controlType: "DROP_DOWN",
|
|
110
|
+
options: [
|
|
111
|
+
{ label: "Link", value: "link" },
|
|
112
|
+
{ label: "Default button", value: "button-default" },
|
|
113
|
+
{ label: "Secondary button", value: "button-secondary" },
|
|
114
|
+
],
|
|
115
|
+
description: "Choose how the link should be styled",
|
|
116
|
+
}),
|
|
117
|
+
}),
|
|
118
|
+
events: Section.category(PropsCategory.EventHandlers).children({
|
|
119
|
+
onClick: Prop.eventHandler().propertiesPanel({
|
|
120
|
+
label: "onClick",
|
|
121
|
+
description: "Triggered when the badge is clicked",
|
|
122
|
+
}),
|
|
123
|
+
}),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Editor Template
|
|
127
|
+
// Editor Config
|
|
128
|
+
const editorConfig: EditorConfig = {
|
|
129
|
+
icon: "link",
|
|
130
|
+
description:
|
|
131
|
+
"A link component used for navigating to other pages in the application.",
|
|
132
|
+
hasExtendedClickArea: true,
|
|
133
|
+
isDroppable: false,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Register Component
|
|
137
|
+
registerComponent(Link, propertiesDefinition).editorConfig(editorConfig);
|
|
138
|
+
|
|
139
|
+
export { Link };
|