@astryxdesign/cli 0.7.11-canary.ec945c9 → 0.7.11

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 (64) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/api/build/kit/rank.mjs +4 -21
  3. package/api/build/kit/words.d.mts +0 -1
  4. package/api/build/kit/words.mjs +1 -1
  5. package/api/icon/_adapter.d.mts +2 -3
  6. package/api/icon/_adapter.mjs +2 -8
  7. package/api/icon/_authoring.d.mts +0 -1
  8. package/api/icon/_authoring.mjs +66 -586
  9. package/api/icon/_records.d.mts +1 -1
  10. package/api/icon/_records.mjs +0 -1
  11. package/api/icon/add/add.mjs +38 -224
  12. package/api/icon/icon.type.d.mts +2 -22
  13. package/api/icon/icon.type.mjs +2 -6
  14. package/api/icon/iconAdd.doc.mjs +2 -2
  15. package/api/icon/iconNewDefinition.doc.mjs +2 -3
  16. package/api/icon/iconNewSet.doc.mjs +4 -4
  17. package/api/icon/search/search.mjs +9 -10
  18. package/api/integration/add-helpers.d.mts +1 -11
  19. package/api/integration/add-helpers.mjs +2 -5
  20. package/api/integration/authoring-checks.d.mts +2 -0
  21. package/api/integration/authoring-checks.mjs +6 -1
  22. package/api/logger.mjs +1 -2
  23. package/api/swizzle/_adapter.d.mts +0 -1
  24. package/api/swizzle/_adapter.mjs +1 -4
  25. package/api/swizzle/copy/copy.d.mts +43 -2
  26. package/api/swizzle/copy/copy.mjs +314 -194
  27. package/api/swizzle/swizzle.d.mts +2 -0
  28. package/api/swizzle/swizzle.doc.mjs +4 -8
  29. package/api/swizzle/swizzle.mjs +7 -3
  30. package/api/swizzle/swizzle.type.d.mts +1 -1
  31. package/api/swizzle/swizzle.type.mjs +2 -2
  32. package/assets/discover/official-packages.json +0 -12
  33. package/assets/docs/tree/icon-sets.doc.mjs +5 -11
  34. package/assets/templates/pages/file-explorer/page.tsx +79 -103
  35. package/assets/templates/pages/table-grouped/page.tsx +232 -160
  36. package/assets/templates/pages/table-grouped/template.doc.mjs +2 -0
  37. package/assets/templates/pages/theme-showcase/page.tsx +792 -724
  38. package/assets/templates/pages/theme-showcase/template.doc.mjs +5 -4
  39. package/clients/cli/commands/experimental/icon.mjs +10 -31
  40. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  41. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +1 -2
  42. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  43. package/clients/cli/commands/swizzle.doc.mjs +3 -6
  44. package/clients/cli/commands/swizzle.mjs +9 -8
  45. package/foundation/discovery/component-loader.d.mts +1 -1
  46. package/foundation/discovery/doc-types.mjs +2 -9
  47. package/foundation/discovery/icon-ranking.d.mts +3 -27
  48. package/foundation/discovery/icon-ranking.mjs +8 -125
  49. package/foundation/discovery/icon-set-checks.mjs +35 -44
  50. package/foundation/discovery/icon-set-discovery.d.mts +0 -13
  51. package/foundation/discovery/icon-set-discovery.mjs +0 -25
  52. package/foundation/discovery/icon-set-writer.d.mts +16 -238
  53. package/foundation/discovery/icon-set-writer.mjs +79 -676
  54. package/foundation/discovery/module-exports.d.mts +2 -3
  55. package/foundation/discovery/module-exports.mjs +37 -167
  56. package/foundation/fs/paths.d.mts +1 -2
  57. package/foundation/fs/paths.mjs +4 -3
  58. package/package.json +6 -6
  59. package/api/icon/_default-look.d.mts +0 -155
  60. package/api/icon/_default-look.mjs +0 -474
  61. package/api/swizzle/_moduleGraph.d.mts +0 -162
  62. package/api/swizzle/_moduleGraph.mjs +0 -754
  63. package/foundation/text/shell-arg.d.mts +0 -14
  64. package/foundation/text/shell-arg.mjs +0 -17
@@ -2,7 +2,7 @@
2
2
 
3
3
  'use client';
4
4
 
5
- import {useState, useMemo} from 'react';
5
+ import React, {useState, useMemo} from 'react';
6
6
  import {useResizable, ResizeHandle} from '@astryxdesign/core/Resizable';
7
7
  import type {ResizableProps} from '@astryxdesign/core/Resizable';
8
8
  import {
@@ -37,13 +37,17 @@ import {Divider} from '@astryxdesign/core/Divider';
37
37
  import {MetadataList, MetadataListItem} from '@astryxdesign/core/MetadataList';
38
38
  import {
39
39
  Table,
40
+ TableBody,
41
+ TableRow,
42
+ TableCell,
40
43
  proportional,
41
44
  pixel,
42
- useTableGroupedRows,
45
+ resolveColumnWidths,
43
46
  } from '@astryxdesign/core/Table';
44
- import type {TableColumn, TablePlugin} from '@astryxdesign/core/Table';
45
- import {rtlStyles} from '@astryxdesign/core/utils';
47
+ import type {TableColumn} from '@astryxdesign/core/Table';
46
48
  import {
49
+ ChevronRightIcon,
50
+ ChevronDownIcon,
47
51
  PencilIcon,
48
52
  DocumentDuplicateIcon,
49
53
  ArrowRightIcon,
@@ -55,6 +59,16 @@ import {
55
59
  import {XMarkIcon} from '@heroicons/react/24/outline';
56
60
  import {ChartBarIcon} from '@heroicons/react/24/solid';
57
61
 
62
+ // Plain inline styles using Astryx design-token CSS variables (declared at
63
+ // :root by `@astryxdesign/core/astryx.css`). No StyleX compiler required.
64
+ // The group-header background + cursor live on the colSpan TableCell (which
65
+ // reliably forwards `style`) so they fill the full row width.
66
+ const groupHeaderCell: React.CSSProperties = {
67
+ cursor: 'pointer',
68
+ backgroundColor: 'var(--color-background-muted)',
69
+ padding: 'var(--spacing-3) var(--spacing-4)',
70
+ };
71
+
58
72
  // Types
59
73
  type TaskStatus = 'in_progress' | 'todo' | 'backlog' | 'done';
60
74
  type TaskPriority = 'urgent' | 'high' | 'medium' | 'low' | 'none';
@@ -557,6 +571,8 @@ const STATUS_LABEL: Record<TaskStatus, string> = {
557
571
  done: 'Done',
558
572
  };
559
573
 
574
+ const GROUP_ORDER: TaskStatus[] = ['in_progress', 'todo', 'backlog', 'done'];
575
+
560
576
  type GroupByField = 'status' | 'priority' | 'project' | 'assignee' | 'none';
561
577
 
562
578
  const GROUP_BY_OPTIONS: {value: GroupByField; label: string}[] = [
@@ -567,6 +583,26 @@ const GROUP_BY_OPTIONS: {value: GroupByField; label: string}[] = [
567
583
  {value: 'assignee', label: 'Assignee'},
568
584
  ];
569
585
 
586
+ function groupTasks(
587
+ tasks: TaskRow[],
588
+ groupBy: GroupByField,
589
+ ): Map<string, TaskRow[]> {
590
+ if (groupBy === 'none') {
591
+ return new Map([['All', tasks]]);
592
+ }
593
+ const map = new Map<string, TaskRow[]>();
594
+ for (const task of tasks) {
595
+ const key = String(task[groupBy]) || '—';
596
+ let group = map.get(key);
597
+ if (!group) {
598
+ group = [];
599
+ map.set(key, group);
600
+ }
601
+ group.push(task);
602
+ }
603
+ return map;
604
+ }
605
+
570
606
  function getGroupLabel(groupBy: GroupByField, key: string): string {
571
607
  if (groupBy === 'status') {
572
608
  return STATUS_LABEL[key as TaskStatus] ?? key;
@@ -589,137 +625,36 @@ const columns: TableColumn<TaskRow>[] = [
589
625
  key: 'status',
590
626
  header: '',
591
627
  width: pixel(44),
592
- renderCell: task => (
593
- <Center axis="horizontal">
594
- <StatusDot
595
- variant={STATUS_DOT_VARIANT[task.status]}
596
- label={STATUS_LABEL[task.status]}
597
- />
598
- </Center>
599
- ),
600
628
  },
601
629
  {
602
630
  key: 'title',
603
631
  header: 'Issue',
604
632
  width: proportional(1),
605
- renderCell: task => (
606
- <HStack gap={3} vAlign="center">
607
- <Icon
608
- icon={ChartBarIcon}
609
- size="sm"
610
- color={PRIORITY_COLOR[task.priority]}
611
- />
612
- <Text type="supporting" color="secondary">
613
- {task.taskId}
614
- </Text>
615
- <Text type="body" maxLines={1}>
616
- {task.title}
617
- </Text>
618
- {task.subtitle && (
619
- <Text type="body" color="secondary" maxLines={1}>
620
- › {task.subtitle}
621
- </Text>
622
- )}
623
- </HStack>
624
- ),
625
633
  },
626
634
  {
627
635
  key: 'project',
628
636
  header: 'Project',
629
637
  width: pixel(180),
630
- renderCell: task =>
631
- task.project ? (
632
- <Text type="body" maxLines={1}>
633
- {task.project}
634
- </Text>
635
- ) : (
636
- <Text type="supporting" color="secondary">
637
- —
638
- </Text>
639
- ),
640
638
  },
641
639
  {
642
640
  key: 'created',
643
641
  header: 'Created',
644
- width: pixel(88),
645
- renderCell: task => (
646
- <Text type="supporting" color="secondary">
647
- {task.created}
648
- </Text>
649
- ),
642
+ width: pixel(72),
650
643
  },
651
644
  {
652
645
  key: 'updated',
653
646
  header: 'Updated',
654
- width: pixel(88),
655
- renderCell: task => (
656
- <Text type="supporting" color="secondary">
657
- {task.updated}
658
- </Text>
659
- ),
647
+ width: pixel(72),
660
648
  },
661
649
  {
662
650
  key: 'assignee',
663
651
  header: 'Assignee',
664
- width: pixel(88),
665
- renderCell: task => <Avatar name={task.assignee} size="sm" />,
652
+ width: pixel(52),
666
653
  },
667
654
  {
668
655
  key: 'actions',
669
656
  header: '',
670
657
  width: pixel(56),
671
- renderCell: () => (
672
- <DropdownMenu
673
- button={{
674
- label: 'Actions',
675
- variant: 'ghost',
676
- size: 'sm',
677
- icon: <Icon icon={EllipsisHorizontalIcon} size="sm" />,
678
- isIconOnly: true,
679
- }}
680
- hasChevron={false}
681
- items={[
682
- {
683
- label: 'Edit issue',
684
- icon: PencilIcon,
685
- onClick: () => {},
686
- },
687
- {
688
- label: 'Assign to...',
689
- icon: UserIcon,
690
- onClick: () => {},
691
- },
692
- {
693
- label: 'Add label',
694
- icon: TagIcon,
695
- onClick: () => {},
696
- },
697
- {
698
- label: 'Duplicate',
699
- icon: DocumentDuplicateIcon,
700
- onClick: () => {},
701
- },
702
- {
703
- label: 'Move to project',
704
- icon: (
705
- <Icon
706
- icon={ArrowRightIcon}
707
- size="sm"
708
- color="secondary"
709
- xstyle={rtlStyles.mirror}
710
- />
711
- ),
712
- onClick: () => {},
713
- },
714
- {type: 'divider' as const},
715
- {
716
- label: 'Delete issue',
717
- icon: TrashIcon,
718
- onClick: () => {},
719
- },
720
- ]}
721
- />
722
- ),
723
658
  },
724
659
  ];
725
660
 
@@ -905,8 +840,8 @@ export default function DataTableTemplate() {
905
840
  ReadonlyArray<PowerSearchFilter>
906
841
  >([]);
907
842
  const [groupBy, setGroupBy] = useState<GroupByField>('status');
908
- const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(
909
- () => new Set(),
843
+ const [expandedGroups, setExpandedGroups] = useState<Set<string>>(
844
+ () => new Set(GROUP_ORDER as string[]),
910
845
  );
911
846
 
912
847
  const filtered = useMemo(() => {
@@ -926,8 +861,19 @@ export default function DataTableTemplate() {
926
861
  return data;
927
862
  }, [search, priorityFilter]);
928
863
 
864
+ const grouped = useMemo(
865
+ () => groupTasks(filtered, groupBy),
866
+ [filtered, groupBy],
867
+ );
868
+
869
+ const groupKeys = useMemo(() => Array.from(grouped.keys()), [grouped]);
870
+
871
+ React.useEffect(() => {
872
+ setExpandedGroups(new Set(groupKeys));
873
+ }, [groupKeys]);
874
+
929
875
  const toggleGroup = (key: string) => {
930
- setCollapsedGroups(prev => {
876
+ setExpandedGroups(prev => {
931
877
  const next = new Set(prev);
932
878
  if (next.has(key)) {
933
879
  next.delete(key);
@@ -938,48 +884,15 @@ export default function DataTableTemplate() {
938
884
  });
939
885
  };
940
886
 
941
- // Grouping by "None" shows the rows as one plain list, with no headers.
942
- const grouped = useTableGroupedRows<TaskRow>({
943
- data: filtered,
944
- // Groups are keyed by their visible label, which also names each
945
- // group's toggle button.
946
- groupBy: task =>
947
- groupBy === 'none'
948
- ? ''
949
- : getGroupLabel(groupBy, String(task[groupBy]) || '—'),
950
- collapsedGroups,
951
- onToggleGroup: toggleGroup,
952
- getRowKey: task => task.id,
953
- renderGroupHeader: (key, count) => (
954
- <HStack gap={2} vAlign="center">
955
- <Text type="body" weight="bold">
956
- {key}
957
- </Text>
958
- <Badge variant="neutral" label={String(count)} />
959
- </HStack>
960
- ),
961
- });
962
-
963
- // Clicking an issue row opens its details. Group header rows keep their
964
- // own toggle.
965
- const openTaskPlugin: TablePlugin<TaskRow> = {
966
- transformBodyRow(props, task) {
967
- if (task.id === '') {
968
- return props;
969
- }
970
- return {
971
- ...props,
972
- htmlProps: {...props.htmlProps, onClick: () => setSelectedTask(task)},
973
- };
974
- },
975
- };
976
-
977
887
  const detailPanel = useResizable({
978
888
  defaultSize: 360,
979
889
  minSize: 280,
980
890
  maxSize: 500,
981
891
  });
982
892
 
893
+ const COL_COUNT = columns.length;
894
+ const resolvedWidths = resolveColumnWidths(columns);
895
+
983
896
  return (
984
897
  <>
985
898
  <Layout
@@ -1018,10 +931,7 @@ export default function DataTableTemplate() {
1018
931
  <RadioList
1019
932
  label="Group by"
1020
933
  value={groupBy}
1021
- onChange={v => {
1022
- setGroupBy(v as GroupByField);
1023
- setCollapsedGroups(new Set());
1024
- }}>
934
+ onChange={v => setGroupBy(v as GroupByField)}>
1025
935
  {GROUP_BY_OPTIONS.map(opt => (
1026
936
  <RadioListItem
1027
937
  key={opt.value}
@@ -1041,19 +951,181 @@ export default function DataTableTemplate() {
1041
951
  content={
1042
952
  <LayoutContent role="main" padding={0}>
1043
953
  <Table
1044
- data={groupBy === 'none' ? filtered : grouped.data}
1045
954
  columns={columns}
1046
- idKey={groupBy === 'none' ? 'id' : grouped.idKey}
1047
955
  density="balanced"
1048
956
  dividers="rows"
1049
957
  textOverflow="truncate"
1050
- hasHover
1051
- plugins={
1052
- groupBy === 'none'
1053
- ? {openTask: openTaskPlugin}
1054
- : {grouped: grouped.plugin, openTask: openTaskPlugin}
1055
- }
1056
- />
958
+ hasHover>
959
+ <colgroup>
960
+ {columns.map(col => (
961
+ <col
962
+ key={col.key}
963
+ style={resolvedWidths.columns.get(col.key)?.style}
964
+ />
965
+ ))}
966
+ </colgroup>
967
+ <TableBody>
968
+ {groupKeys.map(key => {
969
+ const tasks = grouped.get(key);
970
+ if (!tasks || tasks.length === 0) {
971
+ return null;
972
+ }
973
+ const isExpanded = expandedGroups.has(key);
974
+
975
+ return (
976
+ <React.Fragment key={key}>
977
+ {groupBy !== 'none' && (
978
+ <TableRow
979
+ role="button"
980
+ tabIndex={0}
981
+ onClick={() => toggleGroup(key)}
982
+ onKeyDown={e => {
983
+ if (e.key === 'Enter' || e.key === ' ') {
984
+ e.preventDefault();
985
+ toggleGroup(key);
986
+ }
987
+ }}>
988
+ <TableCell
989
+ colSpan={COL_COUNT}
990
+ style={groupHeaderCell}>
991
+ <HStack gap={2} vAlign="center">
992
+ <Icon
993
+ icon={
994
+ isExpanded
995
+ ? ChevronDownIcon
996
+ : ChevronRightIcon
997
+ }
998
+ size="sm"
999
+ color="secondary"
1000
+ />
1001
+ <Text type="body" weight="bold">
1002
+ {getGroupLabel(groupBy, key)}
1003
+ </Text>
1004
+ <Badge
1005
+ variant="neutral"
1006
+ label={String(tasks.length)}
1007
+ />
1008
+ </HStack>
1009
+ </TableCell>
1010
+ </TableRow>
1011
+ )}
1012
+ {(groupBy === 'none' || isExpanded) &&
1013
+ tasks.map(task => (
1014
+ <TableRow
1015
+ key={task.id}
1016
+ onClick={() => setSelectedTask(task)}>
1017
+ <TableCell>
1018
+ <Center axis="horizontal">
1019
+ <StatusDot
1020
+ variant={STATUS_DOT_VARIANT[task.status]}
1021
+ label={STATUS_LABEL[task.status]}
1022
+ />
1023
+ </Center>
1024
+ </TableCell>
1025
+ <TableCell>
1026
+ <HStack gap={3} vAlign="center">
1027
+ <Icon
1028
+ icon={ChartBarIcon}
1029
+ size="sm"
1030
+ color={PRIORITY_COLOR[task.priority]}
1031
+ />
1032
+ <Text type="supporting" color="secondary">
1033
+ {task.taskId}
1034
+ </Text>
1035
+ <Text type="body" maxLines={1}>
1036
+ {task.title}
1037
+ </Text>
1038
+ {task.subtitle && (
1039
+ <Text
1040
+ type="body"
1041
+ color="secondary"
1042
+ maxLines={1}>
1043
+ › {task.subtitle}
1044
+ </Text>
1045
+ )}
1046
+ </HStack>
1047
+ </TableCell>
1048
+ <TableCell>
1049
+ {task.project ? (
1050
+ <Text type="body" maxLines={1}>
1051
+ {task.project}
1052
+ </Text>
1053
+ ) : (
1054
+ <Text type="supporting" color="secondary">
1055
+ —
1056
+ </Text>
1057
+ )}
1058
+ </TableCell>
1059
+ <TableCell>
1060
+ <Text type="supporting" color="secondary">
1061
+ {task.created}
1062
+ </Text>
1063
+ </TableCell>
1064
+ <TableCell>
1065
+ <Text type="supporting" color="secondary">
1066
+ {task.updated}
1067
+ </Text>
1068
+ </TableCell>
1069
+ <TableCell>
1070
+ <Avatar name={task.assignee} size="sm" />
1071
+ </TableCell>
1072
+ <TableCell>
1073
+ <DropdownMenu
1074
+ button={{
1075
+ label: 'Actions',
1076
+ variant: 'ghost',
1077
+ size: 'sm',
1078
+ icon: (
1079
+ <Icon
1080
+ icon={EllipsisHorizontalIcon}
1081
+ size="sm"
1082
+ />
1083
+ ),
1084
+ isIconOnly: true,
1085
+ }}
1086
+ hasChevron={false}
1087
+ items={[
1088
+ {
1089
+ label: 'Edit issue',
1090
+ icon: PencilIcon,
1091
+ onClick: () => {},
1092
+ },
1093
+ {
1094
+ label: 'Assign to...',
1095
+ icon: UserIcon,
1096
+ onClick: () => {},
1097
+ },
1098
+ {
1099
+ label: 'Add label',
1100
+ icon: TagIcon,
1101
+ onClick: () => {},
1102
+ },
1103
+ {
1104
+ label: 'Duplicate',
1105
+ icon: DocumentDuplicateIcon,
1106
+ onClick: () => {},
1107
+ },
1108
+ {
1109
+ label: 'Move to project',
1110
+ icon: ArrowRightIcon,
1111
+ onClick: () => {},
1112
+ },
1113
+ {type: 'divider' as const},
1114
+ {
1115
+ label: 'Delete issue',
1116
+ icon: TrashIcon,
1117
+ onClick: () => {},
1118
+ },
1119
+ ]}
1120
+ />
1121
+ </TableCell>
1122
+ </TableRow>
1123
+ ))}
1124
+ </React.Fragment>
1125
+ );
1126
+ })}
1127
+ </TableBody>
1128
+ </Table>
1057
1129
  </LayoutContent>
1058
1130
  }
1059
1131
  end={
@@ -25,6 +25,8 @@ export const doc = {
25
25
  icons: {
26
26
  ArrowRightIcon: 'arrowRight',
27
27
  ChartBarIcon: 'chart',
28
+ ChevronDownIcon: 'chevronDown',
29
+ ChevronRightIcon: 'chevronRight',
28
30
  DocumentDuplicateIcon: 'copy',
29
31
  EllipsisHorizontalIcon: 'moreHorizontal',
30
32
  PencilIcon: 'edit',