banhaten 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -1
- package/CONTRIBUTING.md +6 -4
- package/README.md +4 -2
- package/docs/design-spacing.md +13 -0
- package/docs/design-system/README.md +2 -0
- package/docs/design-system/appearances/default.md +1 -1
- package/docs/design-system/appearances/rounded.md +1 -1
- package/docs/design-system/appearances/sharp.md +1 -1
- package/docs/design-system/component-showcase-consistency-report.md +5 -5
- package/docs/design-system/components/README.md +15 -0
- package/docs/design-system/components/accordion.md +1 -1
- package/docs/design-system/components/activity-feed.md +1 -1
- package/docs/design-system/components/activity-heatmap.md +1 -1
- package/docs/design-system/components/agent-input.md +85 -0
- package/docs/design-system/components/alert-dialog.md +1 -1
- package/docs/design-system/components/alert.md +10 -4
- package/docs/design-system/components/app-header.md +97 -0
- package/docs/design-system/components/approval-card.md +134 -0
- package/docs/design-system/components/attribute.md +14 -2
- package/docs/design-system/components/avatar.md +1 -1
- package/docs/design-system/components/badge.md +1 -1
- package/docs/design-system/components/banner.md +1 -1
- package/docs/design-system/components/breadcrumbs.md +8 -3
- package/docs/design-system/components/button-group.md +1 -1
- package/docs/design-system/components/button.md +8 -5
- package/docs/design-system/components/card.md +15 -1
- package/docs/design-system/components/catalog-components.md +1 -1
- package/docs/design-system/components/chart.md +95 -24
- package/docs/design-system/components/checkbox.md +1 -1
- package/docs/design-system/components/collapsible.md +20 -6
- package/docs/design-system/components/command.md +1 -1
- package/docs/design-system/components/context-menu.md +1 -1
- package/docs/design-system/components/date-picker.md +1 -1
- package/docs/design-system/components/file-upload.md +1 -1
- package/docs/design-system/components/hover-card.md +1 -1
- package/docs/design-system/components/inline-citations.md +93 -0
- package/docs/design-system/components/input-group.md +1 -1
- package/docs/design-system/components/input.md +59 -3
- package/docs/design-system/components/item.md +1 -1
- package/docs/design-system/components/kbd.md +6 -4
- package/docs/design-system/components/menu.md +35 -4
- package/docs/design-system/components/menubar.md +1 -1
- package/docs/design-system/components/modal.md +2 -2
- package/docs/design-system/components/native-select.md +1 -1
- package/docs/design-system/components/navigation-menu.md +1 -1
- package/docs/design-system/components/onboarding-step-list-item.md +1 -1
- package/docs/design-system/components/page-header.md +58 -17
- package/docs/design-system/components/pagination.md +2 -2
- package/docs/design-system/components/popover.md +1 -1
- package/docs/design-system/components/progress-slider.md +1 -1
- package/docs/design-system/components/radio-card.md +1 -1
- package/docs/design-system/components/radio-group.md +1 -1
- package/docs/design-system/components/resizable.md +1 -1
- package/docs/design-system/components/rolling-count.md +61 -0
- package/docs/design-system/components/scroll-area.md +1 -1
- package/docs/design-system/components/select.md +12 -2
- package/docs/design-system/components/sheet.md +1 -1
- package/docs/design-system/components/shimmer-text.md +67 -0
- package/docs/design-system/components/sidebar.md +75 -8
- package/docs/design-system/components/skeleton.md +2 -2
- package/docs/design-system/components/slideout.md +1 -1
- package/docs/design-system/components/slider.md +2 -2
- package/docs/design-system/components/social-button.md +2 -2
- package/docs/design-system/components/streaming-text.md +82 -0
- package/docs/design-system/components/table.md +103 -21
- package/docs/design-system/components/tabs.md +25 -6
- package/docs/design-system/components/tag.md +1 -1
- package/docs/design-system/components/task-list.md +95 -0
- package/docs/design-system/components/textarea.md +1 -1
- package/docs/design-system/components/thinking-reasoning.md +72 -0
- package/docs/design-system/components/thinking-state.md +67 -0
- package/docs/design-system/components/timeline.md +1 -1
- package/docs/design-system/components/toast.md +1 -1
- package/docs/design-system/components/toggle.md +2 -2
- package/docs/design-system/components/toolbar.md +11 -6
- package/docs/design-system/components/tooltip.md +6 -4
- package/docs/design-system/density-and-elevation.md +16 -16
- package/docs/design-system/design-system-test-missing-items.md +8 -8
- package/docs/design-system/installation.md +2 -0
- package/docs/design-system/tabs.md +2 -1
- package/docs/design-system/template-gap-audit.md +32 -0
- package/docs/design-system/templates.md +59 -0
- package/docs/design-system/token-governance.md +15 -2
- package/package.json +2 -2
- package/registry/components/accordion.tsx +2 -2
- package/registry/components/agent-input-parts.tsx +552 -0
- package/registry/components/agent-input-state.ts +156 -0
- package/registry/components/agent-input.css +307 -0
- package/registry/components/agent-input.tsx +382 -0
- package/registry/components/alert-dialog.tsx +2 -2
- package/registry/components/alert.tsx +23 -7
- package/registry/components/app-header.tsx +151 -0
- package/registry/components/approval-card.css +409 -0
- package/registry/components/approval-card.tsx +401 -0
- package/registry/components/approval-frame.tsx +108 -0
- package/registry/components/approval-questions.tsx +559 -0
- package/registry/components/attribute.tsx +48 -13
- package/registry/components/autocomplete.tsx +15 -68
- package/registry/components/avatar.tsx +2 -2
- package/registry/components/badge.tsx +8 -7
- package/registry/components/button-group.tsx +2 -2
- package/registry/components/button.tsx +19 -14
- package/registry/components/card.tsx +18 -5
- package/registry/components/chart-block-data.ts +177 -0
- package/registry/components/chart-block.css +171 -0
- package/registry/components/chart-block.tsx +260 -0
- package/registry/components/chart-interactions.ts +123 -0
- package/registry/components/chart-options.cartesian.ts +162 -0
- package/registry/components/chart-options.paint.ts +99 -0
- package/registry/components/chart-options.parts.ts +72 -0
- package/registry/components/chart-options.radial.ts +109 -0
- package/registry/components/chart-options.ts +44 -0
- package/registry/components/chart-options.types.ts +67 -0
- package/registry/components/chart.tsx +1 -1
- package/registry/components/checkbox.tsx +6 -6
- package/registry/components/collapsible.tsx +43 -3
- package/registry/components/command.tsx +1 -1
- package/registry/components/context-menu.tsx +1 -1
- package/registry/components/data-chart.tsx +40 -0
- package/registry/components/date-picker.tsx +9 -9
- package/registry/components/echart-theme.ts +246 -0
- package/registry/components/echart.css +49 -0
- package/registry/components/echart.tsx +178 -0
- package/registry/components/expanded/Breadcrumbs.tsx +5 -1
- package/registry/components/expanded/PageHeader.tsx +67 -24
- package/registry/components/expanded/Table.tsx +60 -22
- package/registry/components/expanded/activityFeed.css +2 -2
- package/registry/components/expanded/activityHeatmap.css +1 -1
- package/registry/components/expanded/banner.css +2 -2
- package/registry/components/expanded/breadcrumbs.css +19 -2
- package/registry/components/expanded/catalogComponentsShowcase.css +1 -1
- package/registry/components/expanded/fileUpload.css +7 -7
- package/registry/components/expanded/onboardingStepListItem.css +2 -2
- package/registry/components/expanded/pageHeader.css +38 -44
- package/registry/components/expanded/slideout.css +4 -4
- package/registry/components/expanded/table.css +58 -9
- package/registry/components/expanded/timeline.css +1 -1
- package/registry/components/hover-card.tsx +1 -1
- package/registry/components/inline-citations.css +126 -0
- package/registry/components/inline-citations.tsx +292 -0
- package/registry/components/input-group.tsx +4 -4
- package/registry/components/input.tsx +150 -137
- package/registry/components/item.tsx +1 -1
- package/registry/components/kbd.tsx +3 -2
- package/registry/components/menu.tsx +117 -12
- package/registry/components/menubar.tsx +2 -2
- package/registry/components/modal.tsx +3 -3
- package/registry/components/native-select.tsx +4 -4
- package/registry/components/navigation-menu.tsx +2 -2
- package/registry/components/pagination.tsx +4 -4
- package/registry/components/popover.tsx +3 -3
- package/registry/components/progress-slider.tsx +1 -1
- package/registry/components/radio-card.tsx +7 -7
- package/registry/components/radio-group.tsx +2 -2
- package/registry/components/resizable.tsx +2 -2
- package/registry/components/rolling-count.css +37 -0
- package/registry/components/rolling-count.tsx +110 -0
- package/registry/components/scroll-area.tsx +1 -1
- package/registry/components/select.tsx +15 -10
- package/registry/components/sheet.tsx +2 -2
- package/registry/components/shimmer-text.css +69 -0
- package/registry/components/shimmer-text.tsx +43 -0
- package/registry/components/sidebar.tsx +528 -223
- package/registry/components/skeleton.tsx +1 -1
- package/registry/components/slider.tsx +2 -2
- package/registry/components/social-button.tsx +1 -1
- package/registry/components/streaming-text.css +45 -0
- package/registry/components/streaming-text.tsx +165 -0
- package/registry/components/table-elements.tsx +164 -5
- package/registry/components/tabs.css +32 -4
- package/registry/components/tabs.tsx +5 -1
- package/registry/components/tag.tsx +1 -1
- package/registry/components/task-list.css +328 -0
- package/registry/components/task-list.tsx +429 -0
- package/registry/components/textarea.tsx +4 -4
- package/registry/components/thinking-reasoning.css +178 -0
- package/registry/components/thinking-reasoning.tsx +253 -0
- package/registry/components/thinking-state.css +8 -0
- package/registry/components/thinking-state.tsx +46 -0
- package/registry/components/toast.tsx +1 -1
- package/registry/components/toggle.tsx +2 -2
- package/registry/components/toolbar.tsx +6 -6
- package/registry/components/tooltip.tsx +6 -4
- package/registry/examples/agent-input-demo.tsx +90 -0
- package/registry/examples/app-header-demo.tsx +40 -0
- package/registry/examples/approval-card-demo.tsx +83 -0
- package/registry/examples/button-demo.tsx +3 -0
- package/registry/examples/chart-block-demo.tsx +5 -0
- package/registry/examples/chart-demo.tsx +6 -21
- package/registry/examples/collection-filter-bar-demo.tsx +1 -1
- package/registry/examples/control-density-contract-demo.tsx +5 -1
- package/registry/examples/inline-citations-demo.tsx +31 -0
- package/registry/examples/input-actions-demo.tsx +36 -0
- package/registry/examples/menu-demo.tsx +1 -1
- package/registry/examples/popover-demo.tsx +1 -0
- package/registry/examples/rolling-count-demo.tsx +39 -0
- package/registry/examples/shimmer-text-demo.tsx +20 -0
- package/registry/examples/streaming-text-demo.tsx +28 -0
- package/registry/examples/task-list-demo.tsx +74 -0
- package/registry/examples/thinking-reasoning-demo.tsx +74 -0
- package/registry/examples/thinking-state-demo.tsx +13 -0
- package/registry/guidance/charts.LICENSE.txt +24 -0
- package/registry/hooks/use-controllable-state.ts +33 -0
- package/registry/hooks/use-listbox-navigation.ts +73 -0
- package/registry/hooks/use-motion-end.ts +55 -0
- package/registry/hooks/use-reduced-motion.ts +28 -0
- package/registry/index.json +1808 -190
- package/registry/styles/globals.css +992 -1088
- package/registry.json +385 -10
- package/schema/registry.schema.json +5 -1
- package/schema/tokens.schema.json +8 -4
- package/src/cli/file-transaction.js +15 -8
- package/src/cli/index.js +22 -29
- package/tokens/banhaten.tokens.json +490 -192
package/src/cli/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
assertFileUnchanged,
|
|
15
15
|
deferUntilApplied,
|
|
16
16
|
formatUnifiedDiff,
|
|
17
|
+
readFileForUpdate,
|
|
17
18
|
runFileTransaction,
|
|
18
19
|
writeFile,
|
|
19
20
|
} from "./file-transaction.js"
|
|
@@ -393,7 +394,7 @@ async function writeComponents(requestedNames, flags, options) {
|
|
|
393
394
|
}
|
|
394
395
|
|
|
395
396
|
async function readInstallReceipt(cwd) {
|
|
396
|
-
const receipt = await
|
|
397
|
+
const receipt = await readJsonForUpdate(path.join(cwd, INSTALL_RECEIPT_FILE))
|
|
397
398
|
if (!receipt) return null
|
|
398
399
|
if (receipt.schemaVersion !== 1 || !receipt.components) {
|
|
399
400
|
throw new Error(
|
|
@@ -446,7 +447,7 @@ async function findInstalledComponents(installPlan) {
|
|
|
446
447
|
async function writeInstallReceipt(installPlan, names, options) {
|
|
447
448
|
const { cwd } = installPlan
|
|
448
449
|
const receiptPath = path.join(cwd, INSTALL_RECEIPT_FILE)
|
|
449
|
-
const current = (await
|
|
450
|
+
const current = (await readJsonForUpdate(receiptPath)) || {
|
|
450
451
|
schemaVersion: 1,
|
|
451
452
|
components: {},
|
|
452
453
|
}
|
|
@@ -577,7 +578,7 @@ async function loadConfig(cwd) {
|
|
|
577
578
|
const componentsPath = path.join(cwd, "components.json")
|
|
578
579
|
const config = structuredClone(DEFAULT_CONFIG)
|
|
579
580
|
|
|
580
|
-
const componentsConfig = await
|
|
581
|
+
const componentsConfig = await readJsonForUpdate(componentsPath)
|
|
581
582
|
let hasExplicitCssPath = false
|
|
582
583
|
if (componentsConfig) {
|
|
583
584
|
if (componentsConfig.tailwind?.css) {
|
|
@@ -592,7 +593,7 @@ async function loadConfig(cwd) {
|
|
|
592
593
|
config.aliases.ui
|
|
593
594
|
}
|
|
594
595
|
|
|
595
|
-
const localConfig = await
|
|
596
|
+
const localConfig = await readJsonForUpdate(configPath)
|
|
596
597
|
if (localConfig) {
|
|
597
598
|
// Validate what the user actually wrote, before it is merged onto the
|
|
598
599
|
// defaults. Validating the merged object instead would apply
|
|
@@ -727,16 +728,17 @@ async function writeRegistryFiles(installPlan, files, options) {
|
|
|
727
728
|
: source
|
|
728
729
|
const target = relative(cwd, targetPath)
|
|
729
730
|
|
|
730
|
-
await
|
|
731
|
+
const current = await readFileForUpdate(targetPath)
|
|
732
|
+
assertManagedFileSafe(current, content, target, options)
|
|
731
733
|
|
|
732
734
|
const status = await writeFile(targetPath, content, options)
|
|
733
735
|
writes.push(`${status} ${target}`)
|
|
734
736
|
if (options.showDiff && status === "would update") {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
isTextRegistryFile(file.source) ? "utf8" :
|
|
738
|
-
|
|
739
|
-
|
|
737
|
+
writes.push(formatUnifiedDiff(
|
|
738
|
+
target,
|
|
739
|
+
isTextRegistryFile(file.source) ? current.toString("utf8") : current,
|
|
740
|
+
content
|
|
741
|
+
))
|
|
740
742
|
}
|
|
741
743
|
}
|
|
742
744
|
|
|
@@ -748,7 +750,7 @@ async function writeGlobalCss(installPlan, options) {
|
|
|
748
750
|
const cssPath = path.join(cwd, installPlan.destinations.css)
|
|
749
751
|
const sourcePath = path.join(registryRoot, "styles", "globals.css")
|
|
750
752
|
const tokenCss = await fs.readFile(sourcePath, "utf8")
|
|
751
|
-
const current = await
|
|
753
|
+
const current = await readTextForUpdate(cssPath)
|
|
752
754
|
const tokenBlock = current
|
|
753
755
|
? removeExistingTokenBlock(current, relative(cwd, cssPath))
|
|
754
756
|
: { content: "", found: false }
|
|
@@ -819,7 +821,7 @@ function getPackageChanges(installPlan, dependencies) {
|
|
|
819
821
|
|
|
820
822
|
async function updatePackageJson(cwd, changes, options) {
|
|
821
823
|
const packagePath = path.join(cwd, "package.json")
|
|
822
|
-
const currentSource = await
|
|
824
|
+
const currentSource = await readTextForUpdate(packagePath)
|
|
823
825
|
const packageExists = currentSource !== null
|
|
824
826
|
const packageJson = currentSource !== null ? JSON.parse(currentSource) : {
|
|
825
827
|
name: path.basename(cwd).toLowerCase(),
|
|
@@ -914,28 +916,19 @@ async function readJson(filePath) {
|
|
|
914
916
|
return JSON.parse(await fs.readFile(filePath, "utf8"))
|
|
915
917
|
}
|
|
916
918
|
|
|
917
|
-
async function
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
} catch (error) {
|
|
921
|
-
if (error.code === "ENOENT") return null
|
|
922
|
-
throw error
|
|
923
|
-
}
|
|
919
|
+
async function readJsonForUpdate(filePath) {
|
|
920
|
+
const source = await readTextForUpdate(filePath)
|
|
921
|
+
return source === null ? null : JSON.parse(source)
|
|
924
922
|
}
|
|
925
923
|
|
|
926
|
-
async function
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
} catch (error) {
|
|
930
|
-
if (error.code === "ENOENT") return null
|
|
931
|
-
throw error
|
|
932
|
-
}
|
|
924
|
+
async function readTextForUpdate(filePath) {
|
|
925
|
+
const source = await readFileForUpdate(filePath)
|
|
926
|
+
return source === null ? null : source.toString("utf8")
|
|
933
927
|
}
|
|
934
928
|
|
|
935
|
-
|
|
936
|
-
if (options.dryRun || options.force ||
|
|
929
|
+
function assertManagedFileSafe(current, nextContent, target, options) {
|
|
930
|
+
if (options.dryRun || options.force || current === null) return
|
|
937
931
|
|
|
938
|
-
const current = await fs.readFile(targetPath)
|
|
939
932
|
const next = Buffer.isBuffer(nextContent)
|
|
940
933
|
? nextContent
|
|
941
934
|
: Buffer.from(nextContent, "utf8")
|