@astryxdesign/cli 0.4.3 → 0.4.4-canary.0f4d45f

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 (54) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +45 -43
  3. package/api/discover/_adapter.d.mts +5 -3
  4. package/api/discover/_adapter.mjs +6 -4
  5. package/api/template/cdn/cdn.d.mts +23 -0
  6. package/api/template/cdn/cdn.mjs +86 -0
  7. package/api/template/cdn/cdn.test.mjs +108 -0
  8. package/api/template/template.d.mts +2 -0
  9. package/api/template/template.doc.mjs +21 -3
  10. package/api/template/template.mjs +16 -2
  11. package/api/template/template.type.d.mts +19 -0
  12. package/api/template/template.type.mjs +12 -0
  13. package/api/theme/theme.type.d.mts +16 -0
  14. package/api/theme/theme.type.mjs +11 -0
  15. package/assets/cdn.template.html +124 -0
  16. package/assets/docs/theme.doc.dense.mjs +1 -1
  17. package/assets/docs/theme.doc.mjs +5 -4
  18. package/assets/docs/theme.doc.zh.mjs +1 -1
  19. package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.doc.mjs +21 -0
  20. package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.tsx +46 -0
  21. package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.doc.mjs +23 -0
  22. package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.tsx +100 -0
  23. package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.doc.mjs +22 -0
  24. package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.tsx +47 -0
  25. package/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.doc.mjs +22 -0
  26. package/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx +51 -0
  27. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs +26 -0
  28. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx +221 -0
  29. package/assets/theme.template.ts +4 -3
  30. package/authoring/doctypes/base/type.ts +9 -0
  31. package/clients/cli/commands/build-theme.mjs +154 -65
  32. package/clients/cli/commands/build-theme.multi.test.mjs +148 -0
  33. package/clients/cli/commands/build-theme.watch.test.mjs +67 -0
  34. package/clients/cli/commands/discover.broken-integration.test.mjs +112 -0
  35. package/clients/cli/commands/discover.mjs +12 -0
  36. package/clients/cli/commands/search.mjs +9 -0
  37. package/clients/cli/commands/template-cdn.behavior.test.mjs +113 -0
  38. package/clients/cli/commands/template.doc.mjs +12 -2
  39. package/clients/cli/commands/template.mjs +24 -3
  40. package/clients/cli/commands/theme-build.doc.mjs +11 -5
  41. package/clients/cli/lib/json-shim.test.mjs +1 -1
  42. package/clients/cli/lib/manifest.mjs +3 -2
  43. package/clients/cli/lib/manifest.test.mjs +4 -2
  44. package/foundation/integrations/integration-warnings.test.mjs +17 -0
  45. package/foundation/integrations/validate-contributions.mjs +7 -0
  46. package/foundation/response/response-types.doc.mjs +11 -0
  47. package/foundation/text/copyright-header.mjs +11 -4
  48. package/package.json +12 -9
  49. package/assets/templates/pages/table-page-chart/page.tsx +0 -577
  50. package/assets/templates/pages/table-page-chart/template.doc.mjs +0 -13
  51. package/assets/templates/pages/table-page-heatmap-status/page.tsx +0 -467
  52. package/assets/templates/pages/table-page-heatmap-status/template.doc.mjs +0 -13
  53. package/assets/templates/pages/table-page-shoe-store-heatmap/page.tsx +0 -931
  54. package/assets/templates/pages/table-page-shoe-store-heatmap/template.doc.mjs +0 -13
@@ -1,577 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- import {
6
- VStack,
7
- HStack,
8
- StackItem,
9
- Layout,
10
- LayoutContent,
11
- LayoutHeader,
12
- } from '@astryxdesign/core/Layout';
13
- import {Text, Heading} from '@astryxdesign/core/Text';
14
- import {Button} from '@astryxdesign/core/Button';
15
- import {IconButton} from '@astryxdesign/core/IconButton';
16
- import {Icon} from '@astryxdesign/core/Icon';
17
- import {Badge} from '@astryxdesign/core/Badge';
18
- import {Link} from '@astryxdesign/core/Link';
19
- import {Thumbnail} from '@astryxdesign/core/Thumbnail';
20
- import {Table, proportional, pixel} from '@astryxdesign/core/Table';
21
- import type {TableColumn} from '@astryxdesign/core/Table';
22
- import {Chart, ChartGrid, ChartAxis, area, line} from '@astryxdesign/charts';
23
- import {
24
- FunnelIcon,
25
- ArrowDownTrayIcon,
26
- PlusIcon,
27
- } from '@heroicons/react/24/outline';
28
-
29
- // ============= DATA =============
30
-
31
- type ProductCategory = 'Matcha' | 'Coffee' | 'Tea' | 'Smoothie' | 'Specialty';
32
-
33
- interface OrderRow extends Record<string, unknown> {
34
- id: string;
35
- customer: string;
36
- email: string;
37
- product: string;
38
- category: ProductCategory;
39
- imageIndex: number;
40
- amount: number;
41
- status: 'completed' | 'processing' | 'shipped' | 'refunded';
42
- date: string;
43
- }
44
-
45
- const PRODUCTS = [
46
- {
47
- name: 'Ceremonial Matcha Latte',
48
- category: 'Matcha' as ProductCategory,
49
- image: '/template-assets/matcha-product-1.png',
50
- price: 6,
51
- },
52
- {
53
- name: 'Oat Milk Cappuccino',
54
- category: 'Coffee' as ProductCategory,
55
- image: '/template-assets/matcha-product-2.png',
56
- price: 5,
57
- },
58
- {
59
- name: 'Jasmine Green Tea',
60
- category: 'Tea' as ProductCategory,
61
- image: '/template-assets/matcha-product-3.png',
62
- price: 4,
63
- },
64
- {
65
- name: 'Mango Matcha Smoothie',
66
- category: 'Smoothie' as ProductCategory,
67
- image: '/template-assets/matcha-product-4.png',
68
- price: 8,
69
- },
70
- {
71
- name: 'Hojicha Latte',
72
- category: 'Specialty' as ProductCategory,
73
- image: '/template-assets/matcha-product-5.png',
74
- price: 7,
75
- },
76
- {
77
- name: 'Iced Yuzu Matcha',
78
- category: 'Matcha' as ProductCategory,
79
- image: '/template-assets/matcha-product-6.png',
80
- price: 7,
81
- },
82
- ];
83
-
84
- const orders: OrderRow[] = [
85
- {
86
- id: 'ORD-1001',
87
- customer: 'Sarah Chen',
88
- email: 'sarah.chen@acme.co',
89
- product: PRODUCTS[0].name,
90
- category: PRODUCTS[0].category,
91
- imageIndex: 0,
92
- amount: 6,
93
- status: 'completed',
94
- date: '2025-01-15',
95
- },
96
- {
97
- id: 'ORD-1002',
98
- customer: 'Marcus Rivera',
99
- email: 'mrivera@globex.com',
100
- product: PRODUCTS[1].name,
101
- category: PRODUCTS[1].category,
102
- imageIndex: 1,
103
- amount: 5,
104
- status: 'completed',
105
- date: '2025-01-15',
106
- },
107
- {
108
- id: 'ORD-1003',
109
- customer: 'Aisha Patel',
110
- email: 'aisha.p@initech.io',
111
- product: PRODUCTS[2].name,
112
- category: PRODUCTS[2].category,
113
- imageIndex: 2,
114
- amount: 4,
115
- status: 'shipped',
116
- date: '2025-01-14',
117
- },
118
- {
119
- id: 'ORD-1004',
120
- customer: "James O'Brien",
121
- email: 'jobrien@umbrella.net',
122
- product: PRODUCTS[3].name,
123
- category: PRODUCTS[3].category,
124
- imageIndex: 3,
125
- amount: 8,
126
- status: 'processing',
127
- date: '2025-01-14',
128
- },
129
- {
130
- id: 'ORD-1005',
131
- customer: 'Yuki Tanaka',
132
- email: 'yuki@soylent.jp',
133
- product: PRODUCTS[4].name,
134
- category: PRODUCTS[4].category,
135
- imageIndex: 4,
136
- amount: 7,
137
- status: 'completed',
138
- date: '2025-01-13',
139
- },
140
- {
141
- id: 'ORD-1006',
142
- customer: 'Elena Volkov',
143
- email: 'elena.v@wayne.com',
144
- product: PRODUCTS[5].name,
145
- category: PRODUCTS[5].category,
146
- imageIndex: 5,
147
- amount: 7,
148
- status: 'refunded',
149
- date: '2025-01-13',
150
- },
151
- {
152
- id: 'ORD-1007',
153
- customer: 'David Kim',
154
- email: 'dkim@stark.io',
155
- product: PRODUCTS[0].name,
156
- category: PRODUCTS[0].category,
157
- imageIndex: 0,
158
- amount: 6,
159
- status: 'completed',
160
- date: '2025-01-12',
161
- },
162
- {
163
- id: 'ORD-1008',
164
- customer: 'Fatima Al-Rashid',
165
- email: 'fatima@oscorp.ae',
166
- product: PRODUCTS[1].name,
167
- category: PRODUCTS[1].category,
168
- imageIndex: 1,
169
- amount: 5,
170
- status: 'shipped',
171
- date: '2025-01-12',
172
- },
173
- {
174
- id: 'ORD-1009',
175
- customer: 'Lucas Andersson',
176
- email: 'lucas.a@cyberdyne.se',
177
- product: PRODUCTS[2].name,
178
- category: PRODUCTS[2].category,
179
- imageIndex: 2,
180
- amount: 4,
181
- status: 'completed',
182
- date: '2025-01-11',
183
- },
184
- {
185
- id: 'ORD-1010',
186
- customer: 'Priya Sharma',
187
- email: 'priya@aperture.in',
188
- product: PRODUCTS[3].name,
189
- category: PRODUCTS[3].category,
190
- imageIndex: 3,
191
- amount: 8,
192
- status: 'processing',
193
- date: '2025-01-11',
194
- },
195
- {
196
- id: 'ORD-1011',
197
- customer: 'Noah Williams',
198
- email: 'noah.w@massive.com',
199
- product: PRODUCTS[4].name,
200
- category: PRODUCTS[4].category,
201
- imageIndex: 4,
202
- amount: 7,
203
- status: 'completed',
204
- date: '2025-01-10',
205
- },
206
- {
207
- id: 'ORD-1012',
208
- customer: 'Sofia Garcia',
209
- email: 'sgarcia@tyrell.mx',
210
- product: PRODUCTS[5].name,
211
- category: PRODUCTS[5].category,
212
- imageIndex: 5,
213
- amount: 7,
214
- status: 'completed',
215
- date: '2025-01-10',
216
- },
217
- {
218
- id: 'ORD-1013',
219
- customer: 'Oliver Brown',
220
- email: 'oliver.b@weyland.uk',
221
- product: PRODUCTS[0].name,
222
- category: PRODUCTS[0].category,
223
- imageIndex: 0,
224
- amount: 6,
225
- status: 'shipped',
226
- date: '2025-01-09',
227
- },
228
- {
229
- id: 'ORD-1014',
230
- customer: 'Mei Lin',
231
- email: 'mei.lin@choam.cn',
232
- product: PRODUCTS[1].name,
233
- category: PRODUCTS[1].category,
234
- imageIndex: 1,
235
- amount: 5,
236
- status: 'completed',
237
- date: '2025-01-09',
238
- },
239
- {
240
- id: 'ORD-1015',
241
- customer: 'Hassan Ahmed',
242
- email: 'hahmed@abstergo.eg',
243
- product: PRODUCTS[2].name,
244
- category: PRODUCTS[2].category,
245
- imageIndex: 2,
246
- amount: 4,
247
- status: 'refunded',
248
- date: '2025-01-08',
249
- },
250
- {
251
- id: 'ORD-1016',
252
- customer: 'Isabella Rossi',
253
- email: 'irossi@genom.it',
254
- product: PRODUCTS[3].name,
255
- category: PRODUCTS[3].category,
256
- imageIndex: 3,
257
- amount: 8,
258
- status: 'completed',
259
- date: '2025-01-08',
260
- },
261
- {
262
- id: 'ORD-1017',
263
- customer: 'Liam Murphy',
264
- email: 'liam.m@mishima.ie',
265
- product: PRODUCTS[4].name,
266
- category: PRODUCTS[4].category,
267
- imageIndex: 4,
268
- amount: 7,
269
- status: 'processing',
270
- date: '2025-01-07',
271
- },
272
- {
273
- id: 'ORD-1018',
274
- customer: 'Chloe Dubois',
275
- email: 'cdubois@armacham.fr',
276
- product: PRODUCTS[5].name,
277
- category: PRODUCTS[5].category,
278
- imageIndex: 5,
279
- amount: 7,
280
- status: 'completed',
281
- date: '2025-01-07',
282
- },
283
- {
284
- id: 'ORD-1019',
285
- customer: 'Andre Santos',
286
- email: 'asantos@shinra.br',
287
- product: PRODUCTS[0].name,
288
- category: PRODUCTS[0].category,
289
- imageIndex: 0,
290
- amount: 6,
291
- status: 'shipped',
292
- date: '2025-01-06',
293
- },
294
- {
295
- id: 'ORD-1020',
296
- customer: 'Nina Johansson',
297
- email: 'nina.j@lexcorp.se',
298
- product: PRODUCTS[1].name,
299
- category: PRODUCTS[1].category,
300
- imageIndex: 1,
301
- amount: 5,
302
- status: 'completed',
303
- date: '2025-01-06',
304
- },
305
- {
306
- id: 'ORD-1021',
307
- customer: 'Raj Kapoor',
308
- email: 'raj.k@vaultec.in',
309
- product: PRODUCTS[2].name,
310
- category: PRODUCTS[2].category,
311
- imageIndex: 2,
312
- amount: 4,
313
- status: 'completed',
314
- date: '2025-01-05',
315
- },
316
- {
317
- id: 'ORD-1022',
318
- customer: 'Emma Thompson',
319
- email: 'ethompson@monarch.uk',
320
- product: PRODUCTS[3].name,
321
- category: PRODUCTS[3].category,
322
- imageIndex: 3,
323
- amount: 8,
324
- status: 'completed',
325
- date: '2025-01-05',
326
- },
327
- {
328
- id: 'ORD-1023',
329
- customer: 'Carlos Mendez',
330
- email: 'cmendez@sirius.ar',
331
- product: PRODUCTS[4].name,
332
- category: PRODUCTS[4].category,
333
- imageIndex: 4,
334
- amount: 7,
335
- status: 'shipped',
336
- date: '2025-01-04',
337
- },
338
- {
339
- id: 'ORD-1024',
340
- customer: 'Zoe Mitchell',
341
- email: 'zoe.m@hyperion.au',
342
- product: PRODUCTS[5].name,
343
- category: PRODUCTS[5].category,
344
- imageIndex: 5,
345
- amount: 7,
346
- status: 'processing',
347
- date: '2025-01-04',
348
- },
349
- {
350
- id: 'ORD-1025',
351
- customer: 'Henrik Larsson',
352
- email: 'hlarsson@volvo.se',
353
- product: PRODUCTS[0].name,
354
- category: PRODUCTS[0].category,
355
- imageIndex: 0,
356
- amount: 6,
357
- status: 'completed',
358
- date: '2025-01-03',
359
- },
360
- {
361
- id: 'ORD-1026',
362
- customer: 'Amara Okafor',
363
- email: 'aokafor@wakanda.ng',
364
- product: PRODUCTS[1].name,
365
- category: PRODUCTS[1].category,
366
- imageIndex: 1,
367
- amount: 5,
368
- status: 'completed',
369
- date: '2025-01-03',
370
- },
371
- {
372
- id: 'ORD-1027',
373
- customer: 'Leo Fischer',
374
- email: 'lfischer@kruger.de',
375
- product: PRODUCTS[2].name,
376
- category: PRODUCTS[2].category,
377
- imageIndex: 2,
378
- amount: 4,
379
- status: 'completed',
380
- date: '2025-01-02',
381
- },
382
- {
383
- id: 'ORD-1028',
384
- customer: 'Maya Petrov',
385
- email: 'mpetrov@kaiba.ru',
386
- product: PRODUCTS[3].name,
387
- category: PRODUCTS[3].category,
388
- imageIndex: 3,
389
- amount: 8,
390
- status: 'shipped',
391
- date: '2025-01-02',
392
- },
393
- {
394
- id: 'ORD-1029',
395
- customer: 'Tomás Herrera',
396
- email: 'therrera@nexus.co',
397
- product: PRODUCTS[4].name,
398
- category: PRODUCTS[4].category,
399
- imageIndex: 4,
400
- amount: 7,
401
- status: 'completed',
402
- date: '2025-01-01',
403
- },
404
- {
405
- id: 'ORD-1030',
406
- customer: 'Grace Nakamura',
407
- email: 'gnakamura@capsule.jp',
408
- product: PRODUCTS[5].name,
409
- category: PRODUCTS[5].category,
410
- imageIndex: 5,
411
- amount: 7,
412
- status: 'completed',
413
- date: '2025-01-01',
414
- },
415
- ];
416
-
417
- const revenueData = [
418
- {date: 'Jan 1', revenue: 84},
419
- {date: 'Jan 2', revenue: 72},
420
- {date: 'Jan 3', revenue: 91},
421
- {date: 'Jan 4', revenue: 68},
422
- {date: 'Jan 5', revenue: 105},
423
- {date: 'Jan 6', revenue: 118},
424
- {date: 'Jan 7', revenue: 96},
425
- {date: 'Jan 8', revenue: 132},
426
- {date: 'Jan 9', revenue: 110},
427
- {date: 'Jan 10', revenue: 98},
428
- {date: 'Jan 11', revenue: 125},
429
- {date: 'Jan 12', revenue: 142},
430
- {date: 'Jan 13', revenue: 108},
431
- {date: 'Jan 14', revenue: 156},
432
- {date: 'Jan 15', revenue: 138},
433
- ];
434
-
435
- const statusColor: Record<string, 'green' | 'blue' | 'orange' | 'red'> = {
436
- completed: 'green',
437
- shipped: 'blue',
438
- processing: 'orange',
439
- refunded: 'red',
440
- };
441
-
442
- const columns: TableColumn<OrderRow>[] = [
443
- {
444
- key: 'id',
445
- header: 'Order',
446
- width: pixel(110),
447
- renderCell: (item: OrderRow) => (
448
- <Link href="#" isStandalone>
449
- {item.id}
450
- </Link>
451
- ),
452
- },
453
- {
454
- key: 'product',
455
- header: 'Product',
456
- width: proportional(3),
457
- renderCell: (item: OrderRow) => (
458
- <HStack gap={3} vAlign="center">
459
- <Thumbnail
460
- src={PRODUCTS[item.imageIndex].image}
461
- alt={item.product}
462
- label={item.product}
463
- style={{width: 36, height: 36, flexShrink: 0}}
464
- />
465
- <VStack gap={0}>
466
- <Text type="body">{item.product}</Text>
467
- <Text type="supporting" color="secondary">
468
- {item.category}
469
- </Text>
470
- </VStack>
471
- </HStack>
472
- ),
473
- },
474
- {
475
- key: 'amount',
476
- header: 'Amount',
477
- width: pixel(90),
478
- renderCell: (item: OrderRow) => <Text type="body">${item.amount}</Text>,
479
- },
480
- {
481
- key: 'customer',
482
- header: 'Customer',
483
- width: proportional(2),
484
- renderCell: (item: OrderRow) => <Text type="body">{item.customer}</Text>,
485
- },
486
- {
487
- key: 'email',
488
- header: 'Email',
489
- width: proportional(2),
490
- renderCell: (item: OrderRow) => <Text type="body">{item.email}</Text>,
491
- },
492
- {
493
- key: 'status',
494
- header: 'Status',
495
- width: pixel(120),
496
- renderCell: (item: OrderRow) => (
497
- <Badge
498
- label={item.status.charAt(0).toUpperCase() + item.status.slice(1)}
499
- variant={statusColor[item.status]}
500
- />
501
- ),
502
- },
503
- {
504
- key: 'date',
505
- header: 'Date',
506
- width: pixel(110),
507
- renderCell: (item: OrderRow) => <Text type="body">{item.date}</Text>,
508
- },
509
- ];
510
-
511
- // ============= PAGE =============
512
-
513
- export default function TablePageChartTemplate() {
514
- return (
515
- <Layout
516
- height="fill"
517
- header={
518
- <LayoutHeader hasDivider>
519
- <HStack gap={2} vAlign="center">
520
- <StackItem size="fill">
521
- <Heading level={1}>Sales</Heading>
522
- </StackItem>
523
- <IconButton
524
- label="Filter"
525
- icon={<Icon icon={FunnelIcon} size="sm" />}
526
- variant="ghost"
527
- />
528
- <IconButton
529
- label="Export"
530
- icon={<Icon icon={ArrowDownTrayIcon} size="sm" />}
531
- variant="ghost"
532
- />
533
- <Button
534
- label="New order"
535
- icon={<Icon icon={PlusIcon} size="sm" />}
536
- />
537
- </HStack>
538
- </LayoutHeader>
539
- }
540
- content={
541
- <LayoutContent padding={3}>
542
- <VStack gap={4}>
543
- <Chart
544
- data={revenueData}
545
- xKey="date"
546
- series={[
547
- area('revenue', {color: '#14b8a6', gradient: true}),
548
- line('revenue', {color: '#14b8a6'}),
549
- ]}
550
- grid={<ChartGrid horizontal />}
551
- axes={
552
- <>
553
- <ChartAxis position="bottom" />
554
- <ChartAxis
555
- position="left"
556
- tickFormat={(v: unknown) => `$${v}`}
557
- />
558
- </>
559
- }
560
- height={280}
561
- margin={{left: 40, right: 10, top: 10, bottom: 30}}
562
- />
563
-
564
- <Table<OrderRow>
565
- data={orders}
566
- columns={columns}
567
- idKey="id"
568
- density="balanced"
569
- dividers="rows"
570
- hasHover
571
- />
572
- </VStack>
573
- </LayoutContent>
574
- }
575
- />
576
- );
577
- }
@@ -1,13 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
- export const doc = {
5
- type: 'page',
6
- name: 'Matcha Sales Table',
7
- displayName: 'Matcha Sales Table',
8
- description:
9
- 'Matcha store sales data table with a revenue area chart and product thumbnails.',
10
- isReady: true,
11
- category: 'Table - Chart',
12
- isHiddenFromOverview: true,
13
- };