@astryxdesign/cli 0.1.0-canary.f94dd07 → 0.1.1-canary.a514b99

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.
Files changed (137) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +117 -75
  3. package/bin/astryx.mjs +22 -7
  4. package/docs/icons.doc.mjs +1 -1
  5. package/docs/migration.doc.mjs +2 -2
  6. package/docs/shape.doc.mjs +1 -1
  7. package/docs/styling.doc.mjs +2 -2
  8. package/docs/theme.doc.dense.mjs +2 -2
  9. package/docs/theme.doc.mjs +14 -0
  10. package/docs/theme.doc.zh.mjs +2 -2
  11. package/docs/working-with-ai.doc.mjs +4 -4
  12. package/package.json +8 -8
  13. package/src/api/search.mjs +207 -13
  14. package/src/api/template.mjs +2 -1
  15. package/src/codemods/__tests__/registry.test.mjs +1 -0
  16. package/src/codemods/registry.mjs +1 -0
  17. package/src/codemods/runner.mjs +105 -51
  18. package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-config-surfaces.test.mjs +116 -0
  19. package/src/codemods/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +51 -0
  20. package/src/codemods/transforms/v0.1.0/index.mjs +28 -0
  21. package/src/codemods/transforms/v0.1.0/migrate-xds-config-surfaces.mjs +230 -0
  22. package/src/codemods/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +84 -0
  23. package/src/commands/agent-docs.mjs +92 -56
  24. package/src/commands/agent-docs.path-safety.test.mjs +1 -1
  25. package/src/commands/agent-docs.test.mjs +66 -10
  26. package/src/commands/build-theme.import-path.test.mjs +1 -1
  27. package/src/commands/build-theme.path-safety.test.mjs +1 -1
  28. package/src/commands/build-theme.prose.test.mjs +1 -1
  29. package/src/commands/build.mjs +196 -0
  30. package/src/commands/component-package.test.mjs +1 -1
  31. package/src/commands/component.test.mjs +1 -1
  32. package/src/commands/docs.test.mjs +1 -1
  33. package/src/commands/doctor.test.mjs +1 -1
  34. package/src/commands/external-showcase.test.mjs +1 -1
  35. package/src/commands/init.mjs +9 -1
  36. package/src/commands/interactive-guard.test.mjs +1 -1
  37. package/src/commands/json-contract.test.mjs +10 -3
  38. package/src/commands/swizzle-gap-safety.test.mjs +1 -1
  39. package/src/commands/swizzle.path-safety.test.mjs +1 -1
  40. package/src/commands/template.path-safety.test.mjs +1 -1
  41. package/src/commands/template.test.mjs +1 -1
  42. package/src/commands/upgrade.mjs +353 -169
  43. package/src/commands/upgrade.test.mjs +41 -27
  44. package/src/index.mjs +1 -0
  45. package/src/lib/config.mjs +12 -0
  46. package/src/lib/config.test.mjs +42 -0
  47. package/src/lib/error-codes.mjs +3 -0
  48. package/src/types/error-codes.d.ts +1 -0
  49. package/src/utils/interactive.mjs +1 -1
  50. package/src/utils/interactive.test.mjs +2 -0
  51. package/src/utils/package-manager.test.mjs +1 -1
  52. package/src/utils/path-safety.test.mjs +1 -1
  53. package/src/utils/paths.test.mjs +8 -8
  54. package/src/utils/update-check.mjs +4 -26
  55. package/src/utils/update-check.test.mjs +2 -64
  56. package/templates/blocks/components/AppShell/AppShellContentOnly.tsx +1 -9
  57. package/templates/blocks/components/AppShell/AppShellShowcase.tsx +1 -10
  58. package/templates/blocks/components/AppShell/AppShellSideNavOnly.tsx +1 -9
  59. package/templates/blocks/components/AppShell/AppShellTopNavOnly.tsx +1 -9
  60. package/templates/blocks/components/AppShell/AppShellTopNavWithSideNav.tsx +1 -9
  61. package/templates/blocks/components/AppShell/AppShellWithBanner.tsx +1 -9
  62. package/templates/blocks/components/AspectRatio/AspectRatioShowcase.tsx +12 -19
  63. package/templates/blocks/components/Banner/BannerShowcase.tsx +1 -8
  64. package/templates/blocks/components/Blockquote/BlockquoteShowcase.tsx +1 -8
  65. package/templates/blocks/components/Carousel/CarouselShowcase.tsx +2 -12
  66. package/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerShowcase.tsx +6 -9
  67. package/templates/blocks/components/ChatLayout/ChatLayoutPanelChat.tsx +10 -12
  68. package/templates/blocks/components/ChatMessageList/ChatMessageListDensity.tsx +1 -9
  69. package/templates/blocks/components/ChatMessageList/ChatMessageListFullFeatured.tsx +1 -9
  70. package/templates/blocks/components/ChatMessageList/ChatMessageListShowcase.tsx +1 -9
  71. package/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.tsx +1 -8
  72. package/templates/blocks/components/ChatSendButton/ChatSendButtonInComposer.tsx +1 -8
  73. package/templates/blocks/components/Citation/CitationInlineText.tsx +4 -4
  74. package/templates/blocks/components/Code/CodeInlineInParagraph.tsx +1 -8
  75. package/templates/blocks/components/CodeBlock/CodeBlockBashCommand.tsx +1 -1
  76. package/templates/blocks/components/CodeBlock/CodeBlockJSONConfig.tsx +1 -1
  77. package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemShowcase.tsx +9 -12
  78. package/templates/blocks/components/ContextMenu/ContextMenuShowcase.tsx +13 -15
  79. package/templates/blocks/components/Divider/DividerShowcase.tsx +1 -8
  80. package/templates/blocks/components/Divider/DividerVertical.tsx +7 -9
  81. package/templates/blocks/components/Field/FieldShowcase.tsx +1 -8
  82. package/templates/blocks/components/FormLayout/FormLayoutHorizontal.tsx +1 -6
  83. package/templates/blocks/components/Grid/GridResponsiveAutoFit.tsx +1 -9
  84. package/templates/blocks/components/HoverCard/HoverCardInlineTextHoverCard.tsx +4 -6
  85. package/templates/blocks/components/HoverCard/HoverCardInteractiveContent.tsx +1 -6
  86. package/templates/blocks/components/HoverCard/HoverCardProfileHoverCard.tsx +2 -8
  87. package/templates/blocks/components/HoverCard/HoverCardShowcase.tsx +1 -8
  88. package/templates/blocks/components/MoreMenu/MoreMenuInToolbar.tsx +2 -12
  89. package/templates/blocks/components/OverflowList/OverflowListOverflowBadges.tsx +8 -11
  90. package/templates/blocks/components/OverflowList/OverflowListOverflowDropdownActions.tsx +9 -12
  91. package/templates/blocks/components/Overlay/OverlayBottomStrip.tsx +4 -17
  92. package/templates/blocks/components/Overlay/OverlayHoverReveal.tsx +15 -16
  93. package/templates/blocks/components/Overlay/OverlayShowcase.tsx +5 -21
  94. package/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +2 -14
  95. package/templates/blocks/components/Pagination/PaginationPageSize.tsx +12 -14
  96. package/templates/blocks/components/Pagination/PaginationVariants.tsx +1 -8
  97. package/templates/blocks/components/Pagination/PaginationWithTable.tsx +2 -14
  98. package/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -6
  99. package/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -7
  100. package/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -6
  101. package/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -6
  102. package/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -6
  103. package/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -7
  104. package/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -6
  105. package/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -9
  106. package/templates/blocks/components/Toolbar/ToolbarCardHeader.tsx +1 -10
  107. package/templates/blocks/components/Toolbar/ToolbarSizes.tsx +1 -8
  108. package/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -8
  109. package/templates/blocks/components/Toolbar/ToolbarThreeSlot.tsx +1 -10
  110. package/templates/blocks/components/Toolbar/ToolbarWithTabs.tsx +8 -11
  111. package/templates/pages/ai-chat/page.tsx +71 -64
  112. package/templates/pages/ai-chat-landing/page.tsx +8 -12
  113. package/templates/pages/centered-hero/page.tsx +13 -15
  114. package/templates/pages/classic-gallery/page.tsx +27 -34
  115. package/templates/pages/detail-page/page.tsx +18 -18
  116. package/templates/pages/documentation/page.tsx +11 -14
  117. package/templates/pages/documentation-design/page.tsx +10 -13
  118. package/templates/pages/documentation-technical/page.tsx +15 -16
  119. package/templates/pages/editor/page.tsx +42 -54
  120. package/templates/pages/file-explorer/page.tsx +13 -16
  121. package/templates/pages/form-two-column/page.tsx +13 -17
  122. package/templates/pages/gallery-hero/page.tsx +13 -15
  123. package/templates/pages/ide/page.tsx +32 -39
  124. package/templates/pages/library/page.tsx +16 -23
  125. package/templates/pages/login/page.tsx +14 -18
  126. package/templates/pages/login-card/page.tsx +14 -18
  127. package/templates/pages/login-split/page.tsx +50 -48
  128. package/templates/pages/login-sso/page.tsx +9 -13
  129. package/templates/pages/mixed-gallery/page.tsx +51 -45
  130. package/templates/pages/payment-form/page.tsx +56 -70
  131. package/templates/pages/product-detail/page.tsx +27 -33
  132. package/templates/pages/product-gallery/page.tsx +7 -13
  133. package/templates/pages/settings-dialog/page.tsx +35 -43
  134. package/templates/pages/settings-sidebar/page.tsx +39 -47
  135. package/templates/pages/side-gallery/page.tsx +6 -9
  136. package/templates/pages/table-grouped/page.tsx +11 -15
  137. package/templates/pages/theme-showcase/page.tsx +33 -37
@@ -3,7 +3,6 @@
3
3
  'use client';
4
4
 
5
5
  import {type CSSProperties, type ReactNode} from 'react';
6
- import * as stylex from '@stylexjs/stylex';
7
6
  import {
8
7
  Plus,
9
8
  Search,
@@ -55,10 +54,10 @@ import {
55
54
  ChatSystemMessage,
56
55
  } from '@astryxdesign/core/Chat';
57
56
 
58
- // Styles passed to Astryx components via their `xstyle` prop. These are
59
- // applied by the components themselves, so they work in compiled builds
60
- // and in the live playground preview alike.
61
- const styles = stylex.create({
57
+ // Styles passed to Astryx components via their `style` prop. Astryx components
58
+ // forward the DOM `style` prop, so these work with no CSS compiler — in
59
+ // compiled builds and in the live playground preview alike.
60
+ const styles: Record<string, CSSProperties> = {
62
61
  card: {
63
62
  backgroundColor: 'var(--color-background-body)',
64
63
  color: 'var(--color-text-primary)',
@@ -169,14 +168,11 @@ const styles = stylex.create({
169
168
  cartButton: {
170
169
  flex: 1,
171
170
  },
172
- });
171
+ };
173
172
 
174
173
  // Styles applied directly to plain DOM elements via the `style` prop.
175
- // Kept as inline styles (rather than stylex.create) so they render in the
176
- // playground preview, which can't compile StyleX `stylex.props()` is a
177
- // no-op there, so raw `{...stylex.props(...)}` on a <div>/<img> would lose
178
- // these declarations. All are static (no media/pseudo variants), so inline
179
- // styles reproduce them exactly.
174
+ // Plain inline styles so they render with no CSS compiler. All are static
175
+ // (no media/pseudo variants), so inline styles reproduce them exactly.
180
176
  const inlineStyles: Record<string, CSSProperties> = {
181
177
  inventoryBannerWrap: {
182
178
  paddingInline: 'var(--spacing-6)',
@@ -439,10 +435,10 @@ function StorePreview({
439
435
  />
440
436
 
441
437
  <Section padding={6} variant="transparent">
442
- <VStack gap={10} xstyle={[styles.content, styles.contentFluid]}>
438
+ <VStack gap={10} style={{...styles.content, ...styles.contentFluid}}>
443
439
  <Center>
444
- <VStack gap={4} hAlign="center" xstyle={styles.heroText}>
445
- <Text type="display-2" xstyle={styles.heroHeadline}>
440
+ <VStack gap={4} hAlign="center" style={styles.heroText}>
441
+ <Text type="display-2" style={styles.heroHeadline}>
446
442
  Little joys,
447
443
  <br />
448
444
  everywhere you go
@@ -457,7 +453,7 @@ function StorePreview({
457
453
  <Grid columns={isMobile ? 1 : {minWidth: 200, max: 3}} gap={4}>
458
454
  {products.map((p, i) => (
459
455
  <Card key={p.name} padding={0} height="100%">
460
- <VStack gap={0} xstyle={styles.cardStack}>
456
+ <VStack gap={0} style={styles.cardStack}>
461
457
  <AspectRatio ratio={1}>
462
458
  <img
463
459
  src={images[PRODUCT_IMAGE_KEYS[i]]}
@@ -469,17 +465,17 @@ function StorePreview({
469
465
  <VStack
470
466
  gap={2}
471
467
  hAlign="center"
472
- xstyle={styles.cardStack}>
468
+ style={styles.cardStack}>
473
469
  <HStack>
474
470
  <Badge label={p.badge} variant={p.badgeVariant} />
475
471
  </HStack>
476
- <Heading level={2} xstyle={styles.centerText}>
472
+ <Heading level={2} style={styles.centerText}>
477
473
  {p.name}
478
474
  </Heading>
479
475
  <Text
480
476
  type="supporting"
481
477
  color="secondary"
482
- xstyle={[styles.cardDescription, styles.centerText]}>
478
+ style={{...styles.cardDescription, ...styles.centerText}}>
483
479
  {p.description}
484
480
  </Text>
485
481
  <HStack gap={2} vAlign="center" hAlign="center">
@@ -491,14 +487,14 @@ function StorePreview({
491
487
  min={1}
492
488
  max={99}
493
489
  size="sm"
494
- xstyle={styles.quantityInput}
490
+ style={styles.quantityInput}
495
491
  />
496
492
  <Button
497
493
  label="Add to cart"
498
494
  variant="secondary"
499
495
  size="sm"
500
496
  href="#"
501
- xstyle={styles.cartButton}
497
+ style={styles.cartButton}
502
498
  />
503
499
  </HStack>
504
500
  </VStack>
@@ -516,11 +512,11 @@ function StorePreview({
516
512
 
517
513
  function CheckoutCard({isMobile}: {isMobile: boolean}) {
518
514
  return (
519
- <Card padding={5} xstyle={styles.card}>
520
- <VStack gap={4} xstyle={styles.checkoutStack}>
515
+ <Card padding={5} style={styles.card}>
516
+ <VStack gap={4} style={styles.checkoutStack}>
521
517
  <Heading level={2}>Checkout</Heading>
522
518
 
523
- <VStack gap={3} xstyle={styles.checkoutStack}>
519
+ <VStack gap={3} style={styles.checkoutStack}>
524
520
  <TextInput
525
521
  label="Email"
526
522
  placeholder="you@studio.com"
@@ -566,7 +562,7 @@ function CheckoutCard({isMobile}: {isMobile: boolean}) {
566
562
  />
567
563
  </RadioList>
568
564
 
569
- <VStack gap={2} xstyle={styles.checkoutStack}>
565
+ <VStack gap={2} style={styles.checkoutStack}>
570
566
  <Text type="supporting" weight="bold">
571
567
  Payment method
572
568
  </Text>
@@ -579,7 +575,7 @@ function CheckoutCard({isMobile}: {isMobile: boolean}) {
579
575
  <VStack
580
576
  gap={1}
581
577
  hAlign="center"
582
- xstyle={styles.paymentCardContent}>
578
+ style={styles.paymentCardContent}>
583
579
  <CreditCard size={20} />
584
580
  <Text type="supporting" weight="bold">
585
581
  Card
@@ -594,7 +590,7 @@ function CheckoutCard({isMobile}: {isMobile: boolean}) {
594
590
  <VStack
595
591
  gap={1}
596
592
  hAlign="center"
597
- xstyle={styles.paymentCardContent}>
593
+ style={styles.paymentCardContent}>
598
594
  <Smartphone size={20} />
599
595
  <Text type="supporting" weight="bold">
600
596
  Apple Pay
@@ -609,7 +605,7 @@ function CheckoutCard({isMobile}: {isMobile: boolean}) {
609
605
  <VStack
610
606
  gap={1}
611
607
  hAlign="center"
612
- xstyle={styles.paymentCardContent}>
608
+ style={styles.paymentCardContent}>
613
609
  <Wallet size={20} />
614
610
  <Text type="supporting" weight="bold">
615
611
  Google Pay
@@ -687,12 +683,12 @@ const SUGGESTED_QUESTIONS = [
687
683
 
688
684
  function ChatCard() {
689
685
  return (
690
- <Card padding={0} xstyle={styles.chatCard}>
686
+ <Card padding={0} style={styles.chatCard}>
691
687
  <HStack
692
688
  hAlign="between"
693
689
  vAlign="center"
694
690
  gap={3}
695
- xstyle={styles.chatHeader}>
691
+ style={styles.chatHeader}>
696
692
  <Heading level={2}>Studio AI</Heading>
697
693
 
698
694
  <HStack gap={1} vAlign="center">
@@ -894,8 +890,8 @@ function formatAmount(amount: number): string {
894
890
 
895
891
  function LatestActivityCard({isMobile}: {isMobile: boolean}) {
896
892
  return (
897
- <Card padding={5} xstyle={styles.activityCard}>
898
- <VStack gap={4} xstyle={styles.activityCardStack}>
893
+ <Card padding={5} style={styles.activityCard}>
894
+ <VStack gap={4} style={styles.activityCardStack}>
899
895
  <Heading level={2}>Revenue</Heading>
900
896
 
901
897
  <Grid columns={isMobile ? 1 : 2} gap={3}>
@@ -920,7 +916,7 @@ function LatestActivityCard({isMobile}: {isMobile: boolean}) {
920
916
  <Link href="#">See all</Link>
921
917
  </HStack>
922
918
 
923
- <VStack gap={1} xstyle={styles.activityListFade}>
919
+ <VStack gap={1} style={styles.activityListFade}>
924
920
  {ACTIVITY.map(item => (
925
921
  <Item
926
922
  key={item.id}
@@ -1110,11 +1106,11 @@ function InventoryCard({
1110
1106
  row => row.available < LOW_STOCK_THRESHOLD,
1111
1107
  ).length;
1112
1108
  return (
1113
- <Card padding={0} xstyle={styles.inventoryCard}>
1109
+ <Card padding={0} style={styles.inventoryCard}>
1114
1110
  <HStack
1115
1111
  hAlign="between"
1116
1112
  vAlign="center"
1117
- xstyle={styles.inventoryHeader}>
1113
+ style={styles.inventoryHeader}>
1118
1114
  <Heading level={2}>Inventory</Heading>
1119
1115
  <Button
1120
1116
  label="Add item"
@@ -1130,7 +1126,7 @@ function InventoryCard({
1130
1126
  gap={3}
1131
1127
  vAlign="center"
1132
1128
  hAlign="between"
1133
- xstyle={styles.inventoryFilterRow}>
1129
+ style={styles.inventoryFilterRow}>
1134
1130
  <HStack gap={2} vAlign="center" style={{flex: 1, minWidth: 0}}>
1135
1131
  <TextInput
1136
1132
  label="Search inventory"
@@ -1139,7 +1135,7 @@ function InventoryCard({
1139
1135
  value=""
1140
1136
  onChange={() => {}}
1141
1137
  startIcon={<Search size={16} />}
1142
- xstyle={styles.searchInput}
1138
+ style={styles.searchInput}
1143
1139
  />
1144
1140
  <OverflowList
1145
1141
  gap={2}
@@ -1226,7 +1222,7 @@ function InventoryCard({
1226
1222
  </div>
1227
1223
  )}
1228
1224
 
1229
- <div {...stylex.props(styles.inventoryTableWrap)}>
1225
+ <div style={styles.inventoryTableWrap}>
1230
1226
  <Table<InventoryRow>
1231
1227
  data={inventory}
1232
1228
  columns={[