@shepai/cli 1.116.3 → 1.117.0-pr377.9e8e17c
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/apis/json-schema/AnalyzeRepoTimeouts.yaml +10 -0
- package/apis/json-schema/SdlcLifecycle.yaml +1 -0
- package/apis/json-schema/StageTimeouts.yaml +35 -0
- package/apis/json-schema/WorkflowConfig.yaml +6 -0
- package/dist/packages/core/src/application/use-cases/features/create/create-feature.use-case.d.ts.map +1 -1
- package/dist/packages/core/src/application/use-cases/features/create/create-feature.use-case.js +17 -8
- package/dist/packages/core/src/application/use-cases/features/create/types.d.ts +2 -0
- package/dist/packages/core/src/application/use-cases/features/create/types.d.ts.map +1 -1
- package/dist/packages/core/src/application/use-cases/features/start-feature.use-case.d.ts +25 -0
- package/dist/packages/core/src/application/use-cases/features/start-feature.use-case.d.ts.map +1 -0
- package/dist/packages/core/src/application/use-cases/features/start-feature.use-case.js +116 -0
- package/dist/packages/core/src/domain/generated/output.d.ts +47 -0
- package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
- package/dist/packages/core/src/domain/generated/output.js +1 -0
- package/dist/packages/core/src/domain/lifecycle-gates.d.ts +3 -0
- package/dist/packages/core/src/domain/lifecycle-gates.d.ts.map +1 -1
- package/dist/packages/core/src/domain/lifecycle-gates.js +3 -0
- package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/di/container.js +5 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts +7 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.js +44 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/035-add-stage-timeout-ms.d.ts +22 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/035-add-stage-timeout-ms.d.ts.map +1 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/035-add-stage-timeout-ms.js +53 -0
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations.js +15 -6
- package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.js +15 -0
- package/dist/packages/core/src/infrastructure/services/agents/analyze-repo/analyze-repository-graph.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/analyze-repo/analyze-repository-graph.js +15 -0
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts +11 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.js +42 -3
- package/dist/src/presentation/cli/commands/feat/index.d.ts.map +1 -1
- package/dist/src/presentation/cli/commands/feat/index.js +2 -0
- package/dist/src/presentation/cli/commands/feat/ls.command.d.ts.map +1 -1
- package/dist/src/presentation/cli/commands/feat/ls.command.js +3 -0
- package/dist/src/presentation/cli/commands/feat/new.command.d.ts.map +1 -1
- package/dist/src/presentation/cli/commands/feat/new.command.js +9 -1
- package/dist/src/presentation/cli/commands/feat/start.command.d.ts +12 -0
- package/dist/src/presentation/cli/commands/feat/start.command.d.ts.map +1 -0
- package/dist/src/presentation/cli/commands/feat/start.command.js +43 -0
- package/dist/src/presentation/web/app/actions/create-feature.d.ts +2 -0
- package/dist/src/presentation/web/app/actions/create-feature.d.ts.map +1 -1
- package/dist/src/presentation/web/app/actions/create-feature.js +3 -1
- package/dist/src/presentation/web/app/actions/start-feature.d.ts +5 -0
- package/dist/src/presentation/web/app/actions/start-feature.d.ts.map +1 -0
- package/dist/src/presentation/web/app/actions/start-feature.js +16 -0
- package/dist/src/presentation/web/app/api/agent-events/route.d.ts.map +1 -1
- package/dist/src/presentation/web/app/api/agent-events/route.js +1 -0
- package/dist/src/presentation/web/components/common/base-drawer/base-drawer.js +1 -1
- package/dist/src/presentation/web/components/common/base-drawer/base-drawer.stories.js +1 -1
- package/dist/src/presentation/web/components/common/control-center-drawer/feature-drawer-client.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/control-center-drawer/feature-drawer-client.js +20 -1
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.d.ts +2 -0
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-create-drawer/feature-create-drawer.js +6 -2
- package/dist/src/presentation/web/components/common/feature-node/derive-feature-state.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-node/derive-feature-state.js +6 -0
- package/dist/src/presentation/web/components/common/feature-node/feature-node-state-config.d.ts +3 -2
- package/dist/src/presentation/web/components/common/feature-node/feature-node-state-config.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-node/feature-node-state-config.js +13 -1
- package/dist/src/presentation/web/components/common/feature-node/feature-node.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-node/feature-node.js +12 -3
- package/dist/src/presentation/web/components/common/feature-node/feature-node.stories.d.ts +2 -0
- package/dist/src/presentation/web/components/common/feature-node/feature-node.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-node/feature-node.stories.js +36 -2
- package/dist/src/presentation/web/components/common/merge-review/diff-view.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/merge-review/diff-view.js +166 -8
- package/dist/src/presentation/web/components/features/control-center/control-center-inner.d.ts.map +1 -1
- package/dist/src/presentation/web/components/features/control-center/control-center-inner.js +3 -1
- package/dist/src/presentation/web/components/features/control-center/use-control-center-state.d.ts +1 -0
- package/dist/src/presentation/web/components/features/control-center/use-control-center-state.d.ts.map +1 -1
- package/dist/src/presentation/web/components/features/control-center/use-control-center-state.js +23 -0
- package/dist/src/presentation/web/components/features/settings/settings-page-client.d.ts.map +1 -1
- package/dist/src/presentation/web/components/features/settings/settings-page-client.js +75 -2
- package/dist/src/presentation/web/components/features/settings/settings-page-client.stories.d.ts +1 -0
- package/dist/src/presentation/web/components/features/settings/settings-page-client.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/features/settings/settings-page-client.stories.js +23 -0
- package/dist/src/presentation/web/components/features/settings/timeout-slider.d.ts +11 -0
- package/dist/src/presentation/web/components/features/settings/timeout-slider.d.ts.map +1 -0
- package/dist/src/presentation/web/components/features/settings/timeout-slider.js +63 -0
- package/dist/src/presentation/web/components/features/settings/timeout-slider.stories.d.ts +10 -0
- package/dist/src/presentation/web/components/features/settings/timeout-slider.stories.d.ts.map +1 -0
- package/dist/src/presentation/web/components/features/settings/timeout-slider.stories.js +24 -0
- package/dist/src/presentation/web/components/features/settings/workflow-settings-section.d.ts.map +1 -1
- package/dist/src/presentation/web/components/features/settings/workflow-settings-section.js +97 -2
- package/dist/src/presentation/web/components/features/settings/workflow-settings-section.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/features/settings/workflow-settings-section.stories.js +22 -0
- package/dist/src/presentation/web/components/ui/code-block.d.ts +36 -0
- package/dist/src/presentation/web/components/ui/code-block.d.ts.map +1 -0
- package/dist/src/presentation/web/components/ui/code-block.js +103 -0
- package/dist/src/presentation/web/components/ui/code-block.stories.d.ts +16 -0
- package/dist/src/presentation/web/components/ui/code-block.stories.d.ts.map +1 -0
- package/dist/src/presentation/web/components/ui/code-block.stories.js +145 -0
- package/dist/src/presentation/web/components/ui/file-tree.d.ts +53 -0
- package/dist/src/presentation/web/components/ui/file-tree.d.ts.map +1 -0
- package/dist/src/presentation/web/components/ui/file-tree.js +185 -0
- package/dist/src/presentation/web/components/ui/file-tree.stories.d.ts +14 -0
- package/dist/src/presentation/web/components/ui/file-tree.stories.d.ts.map +1 -0
- package/dist/src/presentation/web/components/ui/file-tree.stories.js +84 -0
- package/dist/src/presentation/web/components/ui/slider.d.ts +5 -0
- package/dist/src/presentation/web/components/ui/slider.d.ts.map +1 -0
- package/dist/src/presentation/web/components/ui/slider.js +10 -0
- package/dist/src/presentation/web/components/ui/slider.stories.d.ts +7 -0
- package/dist/src/presentation/web/components/ui/slider.stories.d.ts.map +1 -0
- package/dist/src/presentation/web/components/ui/slider.stories.js +15 -0
- package/dist/src/presentation/web/hooks/sidebar-features-context.d.ts.map +1 -1
- package/dist/src/presentation/web/hooks/sidebar-features-context.js +1 -0
- package/dist/src/presentation/web/hooks/use-graph-state.d.ts.map +1 -1
- package/dist/src/presentation/web/hooks/use-graph-state.js +1 -0
- package/dist/src/presentation/web/lib/derive-graph.d.ts +2 -0
- package/dist/src/presentation/web/lib/derive-graph.d.ts.map +1 -1
- package/dist/src/presentation/web/lib/derive-graph.js +5 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +3 -3
- package/web/.next/required-server-files.json +3 -3
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +55 -40
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +67 -52
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +67 -52
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +51 -36
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +55 -40
- package/web/.next/server/app/(dashboard)/create/page.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +67 -52
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +67 -52
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +51 -36
- package/web/.next/server/app/(dashboard)/page.js +1 -1
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +51 -36
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
- package/web/.next/server/app/api/evidence/route.js.nft.json +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +5 -5
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/tools/page.js.nft.json +1 -1
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +1 -1
- package/web/.next/server/app/version/page.js.nft.json +1 -1
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_370c43b1.js +1 -1
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_370c43b1.js.map +1 -1
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_4d623b8e.js +2 -2
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_4d623b8e.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__7d5492a0._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__7d5492a0._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_ed372306.js +3 -0
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_ed372306.js.map +1 -0
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_32e26434.js +3 -0
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_32e26434.js.map +1 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__07a39ff2._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__0d4580d1._.js +4 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__0d4580d1._.js.map +1 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__2773312c._.js → [root-of-the-server]__172d9576._.js} +2 -2
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__e70c5627._.js.map → [root-of-the-server]__172d9576._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__24dd0927._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__24dd0927._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__cbd8062c._.js → [root-of-the-server]__2a5592d5._.js} +2 -2
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__cbd8062c._.js.map → [root-of-the-server]__2a5592d5._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__5d87af2e._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__89e8a5cc._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__89e8a5cc._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__98470b18._.js +3 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__98470b18._.js.map +1 -0
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__e70c5627._.js → [root-of-the-server]__a93289b0._.js} +2 -2
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__2773312c._.js.map → [root-of-the-server]__a93289b0._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__039967e3._.js → [root-of-the-server]__ac0304e7._.js} +2 -2
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__039967e3._.js.map → [root-of-the-server]__ac0304e7._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__ea2e0b1c._.js +3 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__ea2e0b1c._.js.map +1 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_009a242e._.js +3 -0
- package/web/.next/server/chunks/ssr/_009a242e._.js.map +1 -0
- package/web/.next/server/chunks/ssr/_135edb9c._.js +1 -1
- package/web/.next/server/chunks/ssr/_135edb9c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_1bb131c4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_250a63ae._.js +1 -1
- package/web/.next/server/chunks/ssr/_250a63ae._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_6d26a08f._.js +1 -1
- package/web/.next/server/chunks/ssr/_6d26a08f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_6f0118a0._.js → _786e1f56._.js} +2 -2
- package/web/.next/server/chunks/ssr/_786e1f56._.js.map +1 -0
- package/web/.next/server/chunks/ssr/_8dacd1e7._.js +1 -1
- package/web/.next/server/chunks/ssr/_8dacd1e7._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_aef4036f._.js +3 -0
- package/web/.next/server/chunks/ssr/_aef4036f._.js.map +1 -0
- package/web/.next/server/chunks/ssr/_c5e12a69._.js +3 -0
- package/web/.next/server/chunks/ssr/{_c5f84841._.js.map → _c5e12a69._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_cc77a143._.js +1 -1
- package/web/.next/server/chunks/ssr/_cc77a143._.js.map +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_0835b28e._.js +5 -0
- package/web/.next/server/chunks/ssr/src_presentation_web_0835b28e._.js.map +1 -0
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_e99d78dd.js +3 -0
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_e99d78dd.js.map +1 -0
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_ui_scroll-area_tsx_53ae5be7._.js +3 -0
- package/web/.next/server/chunks/ssr/src_presentation_web_components_ui_scroll-area_tsx_53ae5be7._.js.map +1 -0
- package/web/.next/server/chunks/ssr/src_presentation_web_e8034a29._.js +5 -0
- package/web/.next/server/chunks/ssr/src_presentation_web_e8034a29._.js.map +1 -0
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +300 -229
- package/web/.next/static/chunks/16ac819e75bae3d0.js +1 -0
- package/web/.next/static/chunks/26bf91fe491accce.js +1 -0
- package/web/.next/static/chunks/{52285fdb39925ad5.js → 2f750d537c3f7e31.js} +1 -1
- package/web/.next/static/chunks/{2babc8e3ae9ba6e8.js → 37a9d60101fcd7ae.js} +1 -1
- package/web/.next/static/chunks/3d673546d066ba0a.js +11 -0
- package/web/.next/static/chunks/4943e3f713ca59b9.js +1 -0
- package/web/.next/static/chunks/5382c19c5dff93e5.js +1 -0
- package/web/.next/static/chunks/60108fd0bf8db1b0.js +1 -0
- package/web/.next/static/chunks/69a1e15358d875cc.css +1 -0
- package/web/.next/static/chunks/{18de73b2f14204d3.js → 98af7ce84b9623c5.js} +1 -1
- package/web/.next/static/chunks/c0c8a062afe141ed.js +1 -0
- package/web/.next/static/chunks/{5de387864b89e64c.js → d3fb12295262040f.js} +2 -2
- package/web/.next/static/chunks/d59479021791a7c1.js +1 -0
- package/web/.next/static/chunks/db91e49ac07fb578.js +2 -0
- package/web/.next/static/chunks/eddc1cdee17c30ef.js +1 -0
- package/web/package.json +3 -1
- package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_d0119342._.js +0 -3
- package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_d0119342._.js.map +0 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_a1104008.js +0 -3
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_a1104008.js.map +0 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_92642200.js +0 -3
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_92642200.js.map +0 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6367aea0._.js +0 -3
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6367aea0._.js.map +0 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +0 -4
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +0 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__b1e68e34._.js +0 -3
- package/web/.next/server/chunks/ssr/[root-of-the-server]__b1e68e34._.js.map +0 -1
- package/web/.next/server/chunks/ssr/_6f0118a0._.js.map +0 -1
- package/web/.next/server/chunks/ssr/_c5f84841._.js +0 -3
- package/web/.next/server/chunks/ssr/_d2e408a9._.js +0 -3
- package/web/.next/server/chunks/ssr/_d2e408a9._.js.map +0 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_888633e1.js +0 -3
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_888633e1.js.map +0 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_ce7cbc3c._.js +0 -5
- package/web/.next/server/chunks/ssr/src_presentation_web_ce7cbc3c._.js.map +0 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_e2604413._.js +0 -5
- package/web/.next/server/chunks/ssr/src_presentation_web_e2604413._.js.map +0 -1
- package/web/.next/static/chunks/0b3ab176958a8286.js +0 -1
- package/web/.next/static/chunks/242446982e8d196e.js +0 -1
- package/web/.next/static/chunks/303a1217006489b9.js +0 -1
- package/web/.next/static/chunks/552e0f129144b54d.js +0 -1
- package/web/.next/static/chunks/57b45edf86522369.css +0 -1
- package/web/.next/static/chunks/619af41a8d3232e5.js +0 -1
- package/web/.next/static/chunks/7b924c47dd2a5a53.js +0 -2
- package/web/.next/static/chunks/b1f3c0e8e9872ef8.js +0 -1
- package/web/.next/static/chunks/c172f4a6010cb5b5.js +0 -1
- package/web/.next/static/chunks/e12f41ac3d49a7b5.js +0 -11
- /package/web/.next/static/{CStnC7-QgiTd6U99YUc1N → fBX3qEmi-temIllSxz1uu}/_buildManifest.js +0 -0
- /package/web/.next/static/{CStnC7-QgiTd6U99YUc1N → fBX3qEmi-temIllSxz1uu}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{CStnC7-QgiTd6U99YUc1N → fBX3qEmi-temIllSxz1uu}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
5
|
+
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
6
|
+
import { Check, Copy } from 'lucide-react';
|
|
7
|
+
import { cn } from '../../lib/utils.js';
|
|
8
|
+
export function CodeBlock({ language, filename, code, highlightLines = [], tabs = [], }) {
|
|
9
|
+
const [copied, setCopied] = React.useState(false);
|
|
10
|
+
const [activeTab, setActiveTab] = React.useState(0);
|
|
11
|
+
const tabsExist = tabs.length > 0;
|
|
12
|
+
const copyToClipboard = async () => {
|
|
13
|
+
const textToCopy = tabsExist ? tabs[activeTab].code : code;
|
|
14
|
+
if (textToCopy) {
|
|
15
|
+
await navigator.clipboard.writeText(textToCopy);
|
|
16
|
+
setCopied(true);
|
|
17
|
+
setTimeout(() => setCopied(false), 2000);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const activeCode = tabsExist ? tabs[activeTab].code : code;
|
|
21
|
+
const activeLanguage = tabsExist ? (tabs[activeTab].language ?? language) : language;
|
|
22
|
+
const activeHighlightLines = tabsExist ? (tabs[activeTab].highlightLines ?? []) : highlightLines;
|
|
23
|
+
return (_jsxs("div", { className: cn('relative w-full rounded-lg bg-slate-950 p-4 font-mono text-sm'), children: [_jsxs("div", { className: "flex flex-col gap-2", children: [tabsExist ? (_jsx("div", { className: "flex overflow-x-auto", children: tabs.map((tab, index) => (_jsx("button", { type: "button", onClick: () => setActiveTab(index), className: cn('px-3 py-2 font-sans text-xs transition-colors', activeTab === index ? 'text-white' : 'text-zinc-400 hover:text-zinc-200'), children: tab.name }, tab.name))) })) : null, !tabsExist && filename ? (_jsxs("div", { className: "flex items-center justify-between py-2", children: [_jsx("div", { className: "text-xs text-zinc-400", children: filename }), _jsx("button", { type: "button", onClick: copyToClipboard, className: "flex items-center gap-1 font-sans text-xs text-zinc-400 transition-colors hover:text-zinc-200", children: copied ? _jsx(Check, { className: "h-3.5 w-3.5" }) : _jsx(Copy, { className: "h-3.5 w-3.5" }) })] })) : null] }), _jsx(SyntaxHighlighter, { language: activeLanguage, style: oneDark, customStyle: {
|
|
24
|
+
margin: 0,
|
|
25
|
+
padding: 0,
|
|
26
|
+
background: 'transparent',
|
|
27
|
+
fontSize: '0.8125rem',
|
|
28
|
+
}, wrapLines: true, showLineNumbers: true, lineProps: (lineNumber) => ({
|
|
29
|
+
style: {
|
|
30
|
+
backgroundColor: activeHighlightLines.includes(lineNumber)
|
|
31
|
+
? 'rgba(255,255,255,0.1)'
|
|
32
|
+
: 'transparent',
|
|
33
|
+
display: 'block',
|
|
34
|
+
width: '100%',
|
|
35
|
+
},
|
|
36
|
+
}), PreTag: "div", children: String(activeCode) })] }));
|
|
37
|
+
}
|
|
38
|
+
const DIFF_LINE_BG = {
|
|
39
|
+
added: 'rgba(34, 197, 94, 0.12)',
|
|
40
|
+
removed: 'rgba(239, 68, 68, 0.12)',
|
|
41
|
+
context: 'transparent',
|
|
42
|
+
};
|
|
43
|
+
export function DiffCodeBlock({ language, filename, hunks }) {
|
|
44
|
+
const [copied, setCopied] = React.useState(false);
|
|
45
|
+
const allLines = React.useMemo(() => {
|
|
46
|
+
const result = [];
|
|
47
|
+
for (const hunk of hunks) {
|
|
48
|
+
result.push({ line: { type: 'context', content: '' }, hunkHeader: hunk.header });
|
|
49
|
+
for (const line of hunk.lines) {
|
|
50
|
+
result.push({ line });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}, [hunks]);
|
|
55
|
+
const codeString = React.useMemo(() => allLines
|
|
56
|
+
.map((entry) => {
|
|
57
|
+
if (entry.hunkHeader != null)
|
|
58
|
+
return entry.hunkHeader;
|
|
59
|
+
return entry.line.content || ' ';
|
|
60
|
+
})
|
|
61
|
+
.join('\n'), [allLines]);
|
|
62
|
+
const copyToClipboard = async () => {
|
|
63
|
+
const text = hunks.flatMap((h) => h.lines.map((l) => l.content)).join('\n');
|
|
64
|
+
await navigator.clipboard.writeText(text);
|
|
65
|
+
setCopied(true);
|
|
66
|
+
setTimeout(() => setCopied(false), 2000);
|
|
67
|
+
};
|
|
68
|
+
if (hunks.length === 0) {
|
|
69
|
+
return (_jsx("div", { className: "rounded-lg bg-slate-950 px-4 py-6 text-center font-mono text-xs text-zinc-500", children: "No diff content available" }));
|
|
70
|
+
}
|
|
71
|
+
return (_jsxs("div", { className: "relative w-full overflow-hidden rounded-lg bg-slate-950 font-mono text-sm", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-zinc-800 px-4 py-2", children: [_jsx("div", { className: "text-xs text-zinc-400", children: filename }), _jsx("button", { type: "button", onClick: copyToClipboard, className: "flex items-center gap-1 font-sans text-xs text-zinc-400 transition-colors hover:text-zinc-200", children: copied ? _jsx(Check, { className: "h-3.5 w-3.5" }) : _jsx(Copy, { className: "h-3.5 w-3.5" }) })] }), _jsx("div", { className: "overflow-x-auto", children: _jsx(SyntaxHighlighter, { language: language, style: oneDark, customStyle: {
|
|
72
|
+
margin: 0,
|
|
73
|
+
padding: '0.5rem 0',
|
|
74
|
+
background: 'transparent',
|
|
75
|
+
fontSize: '0.75rem',
|
|
76
|
+
lineHeight: '1.25rem',
|
|
77
|
+
}, wrapLines: true, showLineNumbers: false, lineProps: (lineNumber) => {
|
|
78
|
+
const idx = lineNumber - 1;
|
|
79
|
+
const entry = allLines[idx];
|
|
80
|
+
if (!entry)
|
|
81
|
+
return { style: { display: 'block', width: '100%' } };
|
|
82
|
+
if (entry.hunkHeader != null) {
|
|
83
|
+
return {
|
|
84
|
+
style: {
|
|
85
|
+
display: 'block',
|
|
86
|
+
width: '100%',
|
|
87
|
+
backgroundColor: 'rgba(100, 100, 200, 0.08)',
|
|
88
|
+
color: 'rgb(148, 163, 184)',
|
|
89
|
+
fontStyle: 'italic',
|
|
90
|
+
padding: '0 1rem',
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
style: {
|
|
96
|
+
display: 'block',
|
|
97
|
+
width: '100%',
|
|
98
|
+
backgroundColor: DIFF_LINE_BG[entry.line.type],
|
|
99
|
+
padding: '0 1rem',
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}, PreTag: "div", CodeTag: "div", children: codeString }) })] }));
|
|
103
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { CodeBlock, DiffCodeBlock } from './code-block.js';
|
|
3
|
+
declare const codeBlockMeta: Meta<typeof CodeBlock>;
|
|
4
|
+
export default codeBlockMeta;
|
|
5
|
+
type Story = StoryObj<typeof CodeBlock>;
|
|
6
|
+
/** Default code block with syntax highlighting */
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
/** With highlighted lines */
|
|
9
|
+
export declare const HighlightedLines: Story;
|
|
10
|
+
/** With multiple tabs */
|
|
11
|
+
export declare const WithTabs: Story;
|
|
12
|
+
export declare const DiffDefault: StoryObj<typeof DiffCodeBlock>;
|
|
13
|
+
export declare const DiffAdditionsOnly: StoryObj<typeof DiffCodeBlock>;
|
|
14
|
+
export declare const DiffDeletionsOnly: StoryObj<typeof DiffCodeBlock>;
|
|
15
|
+
export declare const DiffEmpty: StoryObj<typeof DiffCodeBlock>;
|
|
16
|
+
//# sourceMappingURL=code-block.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/web/components/ui/code-block.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAoBxD,QAAA,MAAM,aAAa,EAAE,IAAI,CAAC,OAAO,SAAS,CAczC,CAAC;AAEF,eAAe,aAAa,CAAC;AAC7B,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;AAExC,kDAAkD;AAClD,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,6BAA6B;AAC7B,eAAO,MAAM,gBAAgB,EAAE,KAO9B,CAAC;AAEF,yBAAyB;AACzB,eAAO,MAAM,QAAQ,EAAE,KAiBtB,CAAC;AA0EF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,OAAO,aAAa,CAUtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,OAAO,aAAa,CAM5D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,OAAO,aAAa,CAU5D,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,OAAO,aAAa,CAMpD,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CodeBlock, DiffCodeBlock } from './code-block.js';
|
|
3
|
+
/* ─── CodeBlock stories ─── */
|
|
4
|
+
const sampleCode = `import { useState } from 'react';
|
|
5
|
+
import { Button } from '../ui/button.js';
|
|
6
|
+
|
|
7
|
+
export function Counter() {
|
|
8
|
+
const [count, setCount] = useState(0);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex items-center gap-2">
|
|
12
|
+
<Button onClick={() => setCount(count - 1)}>-</Button>
|
|
13
|
+
<span>{count}</span>
|
|
14
|
+
<Button onClick={() => setCount(count + 1)}>+</Button>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}`;
|
|
18
|
+
const codeBlockMeta = {
|
|
19
|
+
title: 'Primitives/CodeBlock',
|
|
20
|
+
component: CodeBlock,
|
|
21
|
+
tags: ['autodocs'],
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: 'centered',
|
|
24
|
+
},
|
|
25
|
+
decorators: [
|
|
26
|
+
(Story) => (_jsx("div", { style: { width: '600px' }, children: _jsx(Story, {}) })),
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
export default codeBlockMeta;
|
|
30
|
+
/** Default code block with syntax highlighting */
|
|
31
|
+
export const Default = {
|
|
32
|
+
args: {
|
|
33
|
+
language: 'tsx',
|
|
34
|
+
filename: 'Counter.tsx',
|
|
35
|
+
code: sampleCode,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
/** With highlighted lines */
|
|
39
|
+
export const HighlightedLines = {
|
|
40
|
+
args: {
|
|
41
|
+
language: 'tsx',
|
|
42
|
+
filename: 'Counter.tsx',
|
|
43
|
+
code: sampleCode,
|
|
44
|
+
highlightLines: [4, 5, 6],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
/** With multiple tabs */
|
|
48
|
+
export const WithTabs = {
|
|
49
|
+
args: {
|
|
50
|
+
language: 'tsx',
|
|
51
|
+
filename: 'example',
|
|
52
|
+
tabs: [
|
|
53
|
+
{
|
|
54
|
+
name: 'Component.tsx',
|
|
55
|
+
code: sampleCode,
|
|
56
|
+
language: 'tsx',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'styles.css',
|
|
60
|
+
code: `.counter {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}`,
|
|
61
|
+
language: 'css',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
/* ─── DiffCodeBlock stories ─── */
|
|
67
|
+
const sampleHunks = [
|
|
68
|
+
{
|
|
69
|
+
header: '@@ -1,8 +1,12 @@',
|
|
70
|
+
lines: [
|
|
71
|
+
{ type: 'context', content: "import { useState } from 'react';", oldNumber: 1, newNumber: 1 },
|
|
72
|
+
{
|
|
73
|
+
type: 'context',
|
|
74
|
+
content: "import { Button } from '../ui/button.js';",
|
|
75
|
+
oldNumber: 2,
|
|
76
|
+
newNumber: 2,
|
|
77
|
+
},
|
|
78
|
+
{ type: 'added', content: "import { Input } from '../ui/input.js';", newNumber: 3 },
|
|
79
|
+
{ type: 'added', content: "import { Label } from '../ui/label.js';", newNumber: 4 },
|
|
80
|
+
{ type: 'context', content: '', oldNumber: 3, newNumber: 5 },
|
|
81
|
+
{ type: 'removed', content: 'export function LoginForm() {', oldNumber: 4 },
|
|
82
|
+
{
|
|
83
|
+
type: 'added',
|
|
84
|
+
content: 'export function LoginForm({ onSubmit }: LoginFormProps) {',
|
|
85
|
+
newNumber: 6,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'context',
|
|
89
|
+
content: " const [email, setEmail] = useState('');",
|
|
90
|
+
oldNumber: 5,
|
|
91
|
+
newNumber: 7,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'context',
|
|
95
|
+
content: " const [password, setPassword] = useState('');",
|
|
96
|
+
oldNumber: 6,
|
|
97
|
+
newNumber: 8,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: 'added',
|
|
101
|
+
content: ' const [isLoading, setIsLoading] = useState(false);',
|
|
102
|
+
newNumber: 9,
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
const additionsOnlyHunks = [
|
|
108
|
+
{
|
|
109
|
+
header: '@@ -0,0 +1,5 @@',
|
|
110
|
+
lines: [
|
|
111
|
+
{ type: 'added', content: "import { hash } from 'bcrypt';", newNumber: 1 },
|
|
112
|
+
{ type: 'added', content: '', newNumber: 2 },
|
|
113
|
+
{
|
|
114
|
+
type: 'added',
|
|
115
|
+
content: 'export async function hashPassword(password: string) {',
|
|
116
|
+
newNumber: 3,
|
|
117
|
+
},
|
|
118
|
+
{ type: 'added', content: ' return hash(password, 10);', newNumber: 4 },
|
|
119
|
+
{ type: 'added', content: '}', newNumber: 5 },
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
const deletionsOnlyHunks = [
|
|
124
|
+
{
|
|
125
|
+
header: '@@ -1,5 +0,0 @@',
|
|
126
|
+
lines: [
|
|
127
|
+
{ type: 'removed', content: '// Legacy auth utilities', oldNumber: 1 },
|
|
128
|
+
{ type: 'removed', content: 'export function oldLogin() {', oldNumber: 2 },
|
|
129
|
+
{ type: 'removed', content: " return fetch('/api/login');", oldNumber: 3 },
|
|
130
|
+
{ type: 'removed', content: '}', oldNumber: 4 },
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
export const DiffDefault = {
|
|
135
|
+
render: () => (_jsx("div", { style: { width: '600px' }, children: _jsx(DiffCodeBlock, { language: "tsx", filename: "src/components/auth/login-form.tsx", hunks: sampleHunks }) })),
|
|
136
|
+
};
|
|
137
|
+
export const DiffAdditionsOnly = {
|
|
138
|
+
render: () => (_jsx("div", { style: { width: '600px' }, children: _jsx(DiffCodeBlock, { language: "typescript", filename: "src/lib/auth.ts", hunks: additionsOnlyHunks }) })),
|
|
139
|
+
};
|
|
140
|
+
export const DiffDeletionsOnly = {
|
|
141
|
+
render: () => (_jsx("div", { style: { width: '600px' }, children: _jsx(DiffCodeBlock, { language: "typescript", filename: "src/utils/legacy-auth.ts", hunks: deletionsOnlyHunks }) })),
|
|
142
|
+
};
|
|
143
|
+
export const DiffEmpty = {
|
|
144
|
+
render: () => (_jsx("div", { style: { width: '600px' }, children: _jsx(DiffCodeBlock, { language: "typescript", filename: "empty-file.ts", hunks: [] }) })),
|
|
145
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface TreeViewElement {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type?: 'file' | 'folder';
|
|
6
|
+
isSelectable?: boolean;
|
|
7
|
+
children?: TreeViewElement[];
|
|
8
|
+
}
|
|
9
|
+
export type TreeSortMode = 'default' | 'none' | ((a: TreeViewElement, b: TreeViewElement) => number);
|
|
10
|
+
interface TreeContextProps {
|
|
11
|
+
selectedId: string | undefined;
|
|
12
|
+
expandedItems: string[] | undefined;
|
|
13
|
+
indicator: boolean;
|
|
14
|
+
handleExpand: (id: string) => void;
|
|
15
|
+
selectItem: (id: string) => void;
|
|
16
|
+
setExpandedItems?: React.Dispatch<React.SetStateAction<string[] | undefined>>;
|
|
17
|
+
openIcon?: React.ReactNode;
|
|
18
|
+
closeIcon?: React.ReactNode;
|
|
19
|
+
direction: 'rtl' | 'ltr';
|
|
20
|
+
}
|
|
21
|
+
declare const useTree: () => TreeContextProps;
|
|
22
|
+
interface TreeViewProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'defaultValue'> {
|
|
23
|
+
initialSelectedId?: string;
|
|
24
|
+
indicator?: boolean;
|
|
25
|
+
elements?: TreeViewElement[];
|
|
26
|
+
initialExpandedItems?: string[];
|
|
27
|
+
openIcon?: React.ReactNode;
|
|
28
|
+
closeIcon?: React.ReactNode;
|
|
29
|
+
dir?: 'rtl' | 'ltr';
|
|
30
|
+
onSelect?: (id: string) => void;
|
|
31
|
+
sort?: TreeSortMode;
|
|
32
|
+
}
|
|
33
|
+
declare const Tree: React.ForwardRefExoticComponent<TreeViewProps & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
interface FolderComponentProps {
|
|
35
|
+
element: string;
|
|
36
|
+
value: string;
|
|
37
|
+
isSelectable?: boolean;
|
|
38
|
+
isSelect?: boolean;
|
|
39
|
+
}
|
|
40
|
+
declare const Folder: React.ForwardRefExoticComponent<FolderComponentProps & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
41
|
+
declare const File: React.ForwardRefExoticComponent<{
|
|
42
|
+
value: string;
|
|
43
|
+
handleSelect?: (id: string) => void;
|
|
44
|
+
isSelectable?: boolean;
|
|
45
|
+
isSelect?: boolean;
|
|
46
|
+
fileIcon?: React.ReactNode;
|
|
47
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
48
|
+
declare const CollapseButton: React.ForwardRefExoticComponent<{
|
|
49
|
+
elements: TreeViewElement[];
|
|
50
|
+
expandAll?: boolean;
|
|
51
|
+
} & React.HTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
52
|
+
export { CollapseButton, File, Folder, Tree, useTree };
|
|
53
|
+
//# sourceMappingURL=file-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/web/components/ui/file-tree.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,MAAM,GACN,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,KAAK,MAAM,CAAC,CAAC;AAEzD,UAAU,gBAAgB;IACxB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,aAAa,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,gBAAgB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;IAC9E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;CAC1B;AAID,QAAA,MAAM,OAAO,wBAMZ,CAAC;AAqEF,UAAU,aACR,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;IAC/E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED,QAAA,MAAM,IAAI,sFA8GT,CAAC;AAwBF,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,oIAqDV,CAAC;AAIH,QAAA,MAAM,IAAI;WAGC,MAAM;mBACE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI;mBACpB,OAAO;eACX,OAAO;eACP,KAAK,CAAC,SAAS;2FA6C7B,CAAC;AAIF,QAAA,MAAM,cAAc;cAGN,eAAe,EAAE;gBACf,OAAO;qFAiDrB,CAAC;AAIH,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Accordion as AccordionPrimitive } from 'radix-ui';
|
|
5
|
+
import { FileIcon, FolderIcon, FolderOpenIcon, ChevronsDownUp, ChevronsUpDown } from 'lucide-react';
|
|
6
|
+
import { ScrollArea } from '../ui/scroll-area.js';
|
|
7
|
+
import { cn } from '../../lib/utils.js';
|
|
8
|
+
const TreeContext = React.createContext(null);
|
|
9
|
+
const useTree = () => {
|
|
10
|
+
const context = React.useContext(TreeContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error('useTree must be used within a TreeProvider');
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
};
|
|
16
|
+
const isFolderElement = (element) => {
|
|
17
|
+
if (element.type) {
|
|
18
|
+
return element.type === 'folder';
|
|
19
|
+
}
|
|
20
|
+
return Array.isArray(element.children);
|
|
21
|
+
};
|
|
22
|
+
const mergeExpandedItems = (currentItems, nextItems) => [
|
|
23
|
+
...new Set([...(currentItems ?? []), ...nextItems]),
|
|
24
|
+
];
|
|
25
|
+
const treeCollator = new Intl.Collator('en', {
|
|
26
|
+
numeric: true,
|
|
27
|
+
sensitivity: 'base',
|
|
28
|
+
});
|
|
29
|
+
const defaultTreeComparator = (a, b) => {
|
|
30
|
+
const aIsFolder = isFolderElement(a);
|
|
31
|
+
const bIsFolder = isFolderElement(b);
|
|
32
|
+
if (aIsFolder !== bIsFolder) {
|
|
33
|
+
return aIsFolder ? -1 : 1;
|
|
34
|
+
}
|
|
35
|
+
return treeCollator.compare(a.name, b.name);
|
|
36
|
+
};
|
|
37
|
+
const getTreeComparator = (sort) => {
|
|
38
|
+
if (sort === 'none')
|
|
39
|
+
return undefined;
|
|
40
|
+
if (sort === 'default')
|
|
41
|
+
return defaultTreeComparator;
|
|
42
|
+
return sort;
|
|
43
|
+
};
|
|
44
|
+
const sortTreeElements = (elements, sort) => {
|
|
45
|
+
const comparator = getTreeComparator(sort);
|
|
46
|
+
const nextElements = elements.map((element) => {
|
|
47
|
+
if (!Array.isArray(element.children))
|
|
48
|
+
return element;
|
|
49
|
+
return { ...element, children: sortTreeElements(element.children, sort) };
|
|
50
|
+
});
|
|
51
|
+
if (!comparator)
|
|
52
|
+
return nextElements;
|
|
53
|
+
return [...nextElements].sort(comparator);
|
|
54
|
+
};
|
|
55
|
+
const renderTreeElements = (elements, sort) => sortTreeElements(elements, sort).map((element) => {
|
|
56
|
+
if (isFolderElement(element)) {
|
|
57
|
+
return (_jsx(Folder, { value: element.id, element: element.name, isSelectable: element.isSelectable, children: Array.isArray(element.children) ? renderTreeElements(element.children, sort) : null }, element.id));
|
|
58
|
+
}
|
|
59
|
+
return (_jsx(File, { value: element.id, isSelectable: element.isSelectable, children: _jsx("span", { children: element.name }) }, element.id));
|
|
60
|
+
});
|
|
61
|
+
const Tree = React.forwardRef(({ className, elements, initialSelectedId, initialExpandedItems, children, indicator = true, openIcon, closeIcon, dir, onSelect, sort = 'default', ...props }, ref) => {
|
|
62
|
+
const [selectedId, setSelectedId] = React.useState(initialSelectedId);
|
|
63
|
+
const [expandedItems, setExpandedItems] = React.useState(initialExpandedItems);
|
|
64
|
+
const selectItem = React.useCallback((id) => {
|
|
65
|
+
setSelectedId(id);
|
|
66
|
+
onSelect?.(id);
|
|
67
|
+
}, [onSelect]);
|
|
68
|
+
const handleExpand = React.useCallback((id) => {
|
|
69
|
+
setExpandedItems((prev) => {
|
|
70
|
+
if (prev?.includes(id)) {
|
|
71
|
+
return prev.filter((item) => item !== id);
|
|
72
|
+
}
|
|
73
|
+
return [...(prev ?? []), id];
|
|
74
|
+
});
|
|
75
|
+
}, []);
|
|
76
|
+
const expandSpecificTargetedElements = React.useCallback((elems, selectId) => {
|
|
77
|
+
if (!elems || !selectId)
|
|
78
|
+
return;
|
|
79
|
+
const findParent = (currentElement, currentPath = []) => {
|
|
80
|
+
const isSelectable = currentElement.isSelectable ?? true;
|
|
81
|
+
const newPath = [...currentPath, currentElement.id];
|
|
82
|
+
if (currentElement.id === selectId) {
|
|
83
|
+
if (isSelectable) {
|
|
84
|
+
setExpandedItems((prev) => mergeExpandedItems(prev, newPath));
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (newPath.includes(currentElement.id)) {
|
|
88
|
+
newPath.pop();
|
|
89
|
+
setExpandedItems((prev) => mergeExpandedItems(prev, newPath));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (Array.isArray(currentElement.children) && currentElement.children.length > 0) {
|
|
95
|
+
currentElement.children.forEach((child) => {
|
|
96
|
+
findParent(child, newPath);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
elems.forEach((element) => {
|
|
101
|
+
findParent(element);
|
|
102
|
+
});
|
|
103
|
+
}, []);
|
|
104
|
+
React.useEffect(() => {
|
|
105
|
+
if (initialSelectedId) {
|
|
106
|
+
expandSpecificTargetedElements(elements, initialSelectedId);
|
|
107
|
+
}
|
|
108
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
109
|
+
}, [initialSelectedId, elements]);
|
|
110
|
+
const direction = dir === 'rtl' ? 'rtl' : 'ltr';
|
|
111
|
+
const treeChildren = children ?? (elements ? renderTreeElements(elements, sort) : null);
|
|
112
|
+
return (_jsx(TreeContext.Provider, { value: {
|
|
113
|
+
selectedId,
|
|
114
|
+
expandedItems,
|
|
115
|
+
handleExpand,
|
|
116
|
+
selectItem,
|
|
117
|
+
setExpandedItems,
|
|
118
|
+
indicator,
|
|
119
|
+
openIcon,
|
|
120
|
+
closeIcon,
|
|
121
|
+
direction,
|
|
122
|
+
}, children: _jsx("div", { className: cn('size-full', className), children: _jsx(ScrollArea, { ref: ref, className: "relative h-full px-2", dir: dir, children: _jsx(AccordionPrimitive.Root, { ...props, type: "multiple", value: expandedItems, className: "flex flex-col gap-1", dir: dir, children: treeChildren }) }) }) }));
|
|
123
|
+
});
|
|
124
|
+
Tree.displayName = 'Tree';
|
|
125
|
+
const TreeIndicator = React.forwardRef(({ className, ...props }, ref) => {
|
|
126
|
+
const { direction } = useTree();
|
|
127
|
+
return (_jsx("div", { dir: direction, ref: ref, className: cn('bg-muted absolute left-1.5 h-full w-px rounded-md py-3 duration-300 ease-in-out hover:bg-slate-300 rtl:right-1.5', className), ...props }));
|
|
128
|
+
});
|
|
129
|
+
TreeIndicator.displayName = 'TreeIndicator';
|
|
130
|
+
const Folder = React.forwardRef(({ className, element, value, isSelectable = true, isSelect, children, ...props }, ref) => {
|
|
131
|
+
const { direction, handleExpand, expandedItems, indicator, selectedId, selectItem, openIcon, closeIcon, } = useTree();
|
|
132
|
+
const isSelected = isSelect ?? selectedId === value;
|
|
133
|
+
return (_jsxs(AccordionPrimitive.Item, { ...props, ref: ref, value: value, className: "relative h-full overflow-hidden", children: [_jsxs(AccordionPrimitive.Trigger, { className: cn('flex items-center gap-1 rounded-md text-sm', className, {
|
|
134
|
+
'bg-muted rounded-md': isSelected && isSelectable,
|
|
135
|
+
'cursor-pointer': isSelectable,
|
|
136
|
+
'cursor-not-allowed opacity-50': !isSelectable,
|
|
137
|
+
}), disabled: !isSelectable, onClick: () => {
|
|
138
|
+
selectItem(value);
|
|
139
|
+
handleExpand(value);
|
|
140
|
+
}, children: [expandedItems?.includes(value)
|
|
141
|
+
? (openIcon ?? _jsx(FolderOpenIcon, { className: "size-4" }))
|
|
142
|
+
: (closeIcon ?? _jsx(FolderIcon, { className: "size-4" })), _jsx("span", { children: element })] }), _jsxs(AccordionPrimitive.Content, { className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down relative h-full overflow-hidden text-sm", children: [element && indicator ? _jsx(TreeIndicator, { "aria-hidden": "true" }) : null, _jsx(AccordionPrimitive.Root, { dir: direction, type: "multiple", className: "ml-5 flex flex-col gap-1 py-1 rtl:mr-5", value: expandedItems, children: children })] })] }));
|
|
143
|
+
});
|
|
144
|
+
Folder.displayName = 'Folder';
|
|
145
|
+
const File = React.forwardRef(({ value, className, handleSelect, onClick, isSelectable = true, isSelect, fileIcon, children, ...props }, ref) => {
|
|
146
|
+
const { direction, selectedId, selectItem } = useTree();
|
|
147
|
+
const isSelected = isSelect ?? selectedId === value;
|
|
148
|
+
return (_jsxs("button", { ref: ref, type: "button", disabled: !isSelectable, className: cn('flex w-fit items-center gap-1 rounded-md pr-1 text-sm duration-200 ease-in-out rtl:pr-0 rtl:pl-1', {
|
|
149
|
+
'bg-muted': isSelected && isSelectable,
|
|
150
|
+
}, isSelectable ? 'cursor-pointer' : 'cursor-not-allowed opacity-50', direction === 'rtl' ? 'rtl' : 'ltr', className), onClick: (event) => {
|
|
151
|
+
selectItem(value);
|
|
152
|
+
handleSelect?.(value);
|
|
153
|
+
onClick?.(event);
|
|
154
|
+
}, ...props, children: [fileIcon ?? _jsx(FileIcon, { className: "size-4" }), children] }));
|
|
155
|
+
});
|
|
156
|
+
File.displayName = 'File';
|
|
157
|
+
const CollapseButton = React.forwardRef(({ className, elements, expandAll = false, children, ...props }, ref) => {
|
|
158
|
+
const { expandedItems, setExpandedItems } = useTree();
|
|
159
|
+
const expandAllTree = React.useCallback((elems) => {
|
|
160
|
+
const ids = [];
|
|
161
|
+
const walk = (el) => {
|
|
162
|
+
if ((el.isSelectable ?? true) && el.children && el.children.length > 0) {
|
|
163
|
+
ids.push(el.id);
|
|
164
|
+
for (const child of el.children)
|
|
165
|
+
walk(child);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
for (const el of elems)
|
|
169
|
+
walk(el);
|
|
170
|
+
return [...new Set(ids)];
|
|
171
|
+
}, []);
|
|
172
|
+
const closeAll = React.useCallback(() => {
|
|
173
|
+
setExpandedItems?.([]);
|
|
174
|
+
}, [setExpandedItems]);
|
|
175
|
+
React.useEffect(() => {
|
|
176
|
+
if (expandAll) {
|
|
177
|
+
setExpandedItems?.(expandAllTree(elements));
|
|
178
|
+
}
|
|
179
|
+
}, [expandAll, elements, expandAllTree, setExpandedItems]);
|
|
180
|
+
const isExpanded = expandedItems && expandedItems.length > 0;
|
|
181
|
+
return (_jsxs("button", { type: "button", className: cn('text-muted-foreground hover:text-foreground flex items-center gap-1 rounded-md p-1 text-xs transition-colors', className), onClick: isExpanded ? closeAll : () => setExpandedItems?.(expandAllTree(elements)), ref: ref, ...props, children: [children ??
|
|
182
|
+
(isExpanded ? (_jsx(ChevronsDownUp, { className: "h-3.5 w-3.5" })) : (_jsx(ChevronsUpDown, { className: "h-3.5 w-3.5" }))), _jsx("span", { className: "sr-only", children: "Toggle" })] }));
|
|
183
|
+
});
|
|
184
|
+
CollapseButton.displayName = 'CollapseButton';
|
|
185
|
+
export { CollapseButton, File, Folder, Tree, useTree };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Tree } from './file-tree.js';
|
|
3
|
+
declare const meta: Meta<typeof Tree>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Tree>;
|
|
6
|
+
/** Default file tree with auto-rendered elements */
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
/** Custom-rendered tree nodes with status icons */
|
|
9
|
+
export declare const WithStatusIcons: Story;
|
|
10
|
+
/** Collapsed by default */
|
|
11
|
+
export declare const Collapsed: Story;
|
|
12
|
+
/** With a collapse/expand all button */
|
|
13
|
+
export declare const WithCollapseButton: Story;
|
|
14
|
+
//# sourceMappingURL=file-tree.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/web/components/ui/file-tree.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAgB,IAAI,EAAwC,MAAM,aAAa,CAAC;AA8CvF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CAsB3B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,oDAAoD;AACpD,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,eAAe,EAAE,KA8B7B,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,kBAAkB,EAAE,KAoChC,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { File, Folder, Tree, CollapseButton } from './file-tree.js';
|
|
3
|
+
import { FilePlus, FileEdit, FileMinus } from 'lucide-react';
|
|
4
|
+
const sampleElements = [
|
|
5
|
+
{
|
|
6
|
+
id: 'src',
|
|
7
|
+
name: 'src',
|
|
8
|
+
children: [
|
|
9
|
+
{
|
|
10
|
+
id: 'src/components',
|
|
11
|
+
name: 'components',
|
|
12
|
+
children: [
|
|
13
|
+
{ id: 'src/components/button.tsx', name: 'button.tsx' },
|
|
14
|
+
{ id: 'src/components/input.tsx', name: 'input.tsx' },
|
|
15
|
+
{ id: 'src/components/dialog.tsx', name: 'dialog.tsx' },
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: 'src/lib',
|
|
20
|
+
name: 'lib',
|
|
21
|
+
children: [
|
|
22
|
+
{ id: 'src/lib/utils.ts', name: 'utils.ts' },
|
|
23
|
+
{ id: 'src/lib/auth.ts', name: 'auth.ts' },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{ id: 'src/index.ts', name: 'index.ts' },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{ id: 'package.json', name: 'package.json' },
|
|
30
|
+
{ id: 'tsconfig.json', name: 'tsconfig.json' },
|
|
31
|
+
];
|
|
32
|
+
const allIds = [
|
|
33
|
+
'src',
|
|
34
|
+
'src/components',
|
|
35
|
+
'src/components/button.tsx',
|
|
36
|
+
'src/components/input.tsx',
|
|
37
|
+
'src/components/dialog.tsx',
|
|
38
|
+
'src/lib',
|
|
39
|
+
'src/lib/utils.ts',
|
|
40
|
+
'src/lib/auth.ts',
|
|
41
|
+
'src/index.ts',
|
|
42
|
+
'package.json',
|
|
43
|
+
'tsconfig.json',
|
|
44
|
+
];
|
|
45
|
+
const meta = {
|
|
46
|
+
title: 'Primitives/FileTree',
|
|
47
|
+
component: Tree,
|
|
48
|
+
tags: ['autodocs'],
|
|
49
|
+
parameters: {
|
|
50
|
+
layout: 'centered',
|
|
51
|
+
},
|
|
52
|
+
decorators: [
|
|
53
|
+
(Story) => (_jsx("div", { style: {
|
|
54
|
+
width: '300px',
|
|
55
|
+
height: '400px',
|
|
56
|
+
border: '1px solid var(--color-border)',
|
|
57
|
+
borderRadius: '8px',
|
|
58
|
+
padding: '8px',
|
|
59
|
+
}, children: _jsx(Story, {}) })),
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
export default meta;
|
|
63
|
+
/** Default file tree with auto-rendered elements */
|
|
64
|
+
export const Default = {
|
|
65
|
+
args: {
|
|
66
|
+
elements: sampleElements,
|
|
67
|
+
initialExpandedItems: allIds,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
/** Custom-rendered tree nodes with status icons */
|
|
71
|
+
export const WithStatusIcons = {
|
|
72
|
+
render: () => (_jsxs(Tree, { initialExpandedItems: allIds, elements: sampleElements, sort: "none", children: [_jsxs(Folder, { element: "src", value: "src", children: [_jsxs(Folder, { element: "components", value: "src/components", children: [_jsxs(File, { value: "src/components/button.tsx", fileIcon: _jsx(FileEdit, { className: "h-4 w-4 text-amber-600" }), children: [_jsx("span", { className: "text-xs", children: "button.tsx" }), _jsx("span", { className: "ml-auto pl-2 text-[10px] text-green-600", children: "+12" })] }), _jsxs(File, { value: "src/components/input.tsx", fileIcon: _jsx(FilePlus, { className: "h-4 w-4 text-green-600" }), children: [_jsx("span", { className: "text-xs", children: "input.tsx" }), _jsx("span", { className: "ml-auto pl-2 text-[10px] text-green-600", children: "+45" })] })] }), _jsx(Folder, { element: "lib", value: "src/lib", children: _jsxs(File, { value: "src/lib/utils.ts", fileIcon: _jsx(FileMinus, { className: "h-4 w-4 text-red-600" }), children: [_jsx("span", { className: "text-xs", children: "utils.ts" }), _jsx("span", { className: "ml-auto pl-2 text-[10px] text-red-600", children: "-8" })] }) })] }), _jsx(CollapseButton, { elements: sampleElements, className: "mt-1" })] })),
|
|
73
|
+
};
|
|
74
|
+
/** Collapsed by default */
|
|
75
|
+
export const Collapsed = {
|
|
76
|
+
args: {
|
|
77
|
+
elements: sampleElements,
|
|
78
|
+
initialExpandedItems: [],
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
/** With a collapse/expand all button */
|
|
82
|
+
export const WithCollapseButton = {
|
|
83
|
+
render: () => (_jsxs(Tree, { elements: sampleElements, initialExpandedItems: allIds, sort: "default", children: [_jsxs(Folder, { element: "src", value: "src", children: [_jsxs(Folder, { element: "components", value: "src/components", children: [_jsx(File, { value: "src/components/button.tsx", children: _jsx("span", { className: "text-xs", children: "button.tsx" }) }), _jsx(File, { value: "src/components/input.tsx", children: _jsx("span", { className: "text-xs", children: "input.tsx" }) }), _jsx(File, { value: "src/components/dialog.tsx", children: _jsx("span", { className: "text-xs", children: "dialog.tsx" }) })] }), _jsxs(Folder, { element: "lib", value: "src/lib", children: [_jsx(File, { value: "src/lib/utils.ts", children: _jsx("span", { className: "text-xs", children: "utils.ts" }) }), _jsx(File, { value: "src/lib/auth.ts", children: _jsx("span", { className: "text-xs", children: "auth.ts" }) })] }), _jsx(File, { value: "src/index.ts", children: _jsx("span", { className: "text-xs", children: "index.ts" }) })] }), _jsx(File, { value: "package.json", children: _jsx("span", { className: "text-xs", children: "package.json" }) }), _jsx(File, { value: "tsconfig.json", children: _jsx("span", { className: "text-xs", children: "tsconfig.json" }) }), _jsx(CollapseButton, { elements: sampleElements, className: "mt-2" })] })),
|
|
84
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slider as SliderPrimitive } from 'radix-ui';
|
|
3
|
+
declare function Slider({ className, defaultValue, value, min, max, ...props }: React.ComponentProps<typeof SliderPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export { Slider };
|
|
5
|
+
//# sourceMappingURL=slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/web/components/ui/slider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAIrD,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,YAAY,EACZ,KAAK,EACL,GAAO,EACP,GAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,2CAyCnD;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Slider as SliderPrimitive } from 'radix-ui';
|
|
5
|
+
import { cn } from '../../lib/utils.js';
|
|
6
|
+
function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }) {
|
|
7
|
+
const _values = React.useMemo(() => (Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max]), [value, defaultValue, min, max]);
|
|
8
|
+
return (_jsxs(SliderPrimitive.Root, { "data-slot": "slider", defaultValue: defaultValue, value: value, min: min, max: max, className: cn('relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col', className), ...props, children: [_jsx(SliderPrimitive.Track, { "data-slot": "slider-track", className: cn('bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5'), children: _jsx(SliderPrimitive.Range, { "data-slot": "slider-range", className: cn('bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full') }) }), Array.from({ length: _values.length }, (_, index) => (_jsx(SliderPrimitive.Thumb, { "data-slot": "slider-thumb", className: "border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50" }, index)))] }));
|
|
9
|
+
}
|
|
10
|
+
export { Slider };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Slider } from './slider.js';
|
|
3
|
+
declare const meta: Meta<typeof Slider>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Slider>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
//# sourceMappingURL=slider.stories.d.ts.map
|