astryx-dracula 0.4.0 → 0.5.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/package.json +6 -2
- package/shared/auth-chrome.tsx +156 -6
- package/shared/chaptered-doc.tsx +3 -4
- package/shared/chart-hues.ts +0 -5
- package/shared/chart-legend.tsx +2 -3
- package/shared/data-bar.tsx +5 -5
- package/shared/format-money.ts +3 -0
- package/shared/metric-card.tsx +127 -0
- package/shared/scene-hues.ts +0 -8
- package/shared/scene-tile.tsx +3 -11
- package/shared/settings-data.ts +28 -0
- package/shared/settings-rows.tsx +1 -6
- package/shared/stars.tsx +28 -0
- package/templates/ai-chat-landing.tsx +88 -58
- package/templates/ai-chat.tsx +65 -78
- package/templates/centered-hero.tsx +2 -2
- package/templates/dashboard-portfolio.tsx +77 -155
- package/templates/dashboard.tsx +17 -134
- package/templates/detail-page.tsx +14 -18
- package/templates/documentation-design.tsx +66 -519
- package/templates/documentation-technical.tsx +2 -22
- package/templates/editor.tsx +168 -185
- package/templates/file-explorer.tsx +10 -24
- package/templates/ide.tsx +12 -18
- package/templates/incident-console.tsx +48 -46
- package/templates/kanban-board.tsx +36 -85
- package/templates/library.tsx +42 -66
- package/templates/login-card.tsx +33 -126
- package/templates/login-split.tsx +91 -123
- package/templates/login-sso.tsx +12 -33
- package/templates/login.tsx +21 -121
- package/templates/messaging-shell.tsx +162 -168
- package/templates/payment-form.tsx +24 -26
- package/templates/product-detail.tsx +7 -40
- package/templates/product-tour.tsx +38 -60
- package/templates/settings-dialog.tsx +10 -32
- package/templates/settings-sidebar.tsx +44 -77
- package/templates/settings.tsx +208 -121
- package/templates/shell-nav.tsx +20 -75
- package/templates/shell-side-nav.tsx +16 -90
- package/templates/shell-top-nav.tsx +20 -53
- package/templates/side-gallery.tsx +19 -19
- package/templates/table-grouped.tsx +17 -164
- package/templates/table-page-chart.tsx +12 -11
- package/templates/table-page-heatmap-status.tsx +0 -17
- package/templates/table-page-shoe-store-heatmap.tsx +12 -12
- package/templates/table-page.tsx +4 -31
- package/templates/table.tsx +7 -10
- package/templates/tech-report.tsx +58 -72
- package/templates/theme-showcase.tsx +124 -415
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
// XLE (canonical structure, validated with `bunx astryx layout check`):
|
|
3
|
-
// L > (LC > V[g=8] > (V[g=2] > Hd"Getting started with Astryx Dracula"[level=1] + Tx"Last updated March 30, 2026"[t=supporting]) + (C > V[g=3] > (H[j=between] > (H[g=2] > Ic + Tx"AI Assistance"[t=body]) +
|
|
3
|
+
// L > (LC > V[g=8] > (V[g=2] > Hd"Getting started with Astryx Dracula"[level=1] + Tx"Last updated March 30, 2026"[t=supporting]) + (C > V[g=3] > (H[j=between] > (H[g=2] > Ic + Tx"AI Assistance"[t=body]) + B"Copy prompt") + Tx"Prompt description"[t=body]) + (V[g=4] > Hd"Prerequisites"[level=2] + UL) + D + (V[g=4] > Hd"Install the package"[level=2] + Tx"Description"[t=body] + (V[g=2] > Tx"Step"[t=body] + Cd)*3) + D + (V[g=4] > Hd"Configure theming"[level=2] + Tx"Description"[t=body] + Cd + Tx"Note"[t=body]) + D + (V[g=4] > Hd"Next steps"[level=2] + UL)) + (LP > Outline)
|
|
4
4
|
|
|
5
5
|
import {useCallback, useState} from 'react';
|
|
6
6
|
import {Heading, Text} from '@astryxdesign/core/Text';
|
|
7
7
|
import {Button} from '@astryxdesign/core/Button';
|
|
8
8
|
import {Card} from '@astryxdesign/core/Card';
|
|
9
|
-
import {DropdownMenu} from '@astryxdesign/core/DropdownMenu';
|
|
10
9
|
import {List, ListItem} from '@astryxdesign/core/List';
|
|
11
10
|
import {CodeBlock} from '@astryxdesign/core/CodeBlock';
|
|
12
11
|
import {Selector} from '@astryxdesign/core/Selector';
|
|
@@ -16,7 +15,7 @@ import {Divider} from '@astryxdesign/core/Divider';
|
|
|
16
15
|
import {Icon} from '@astryxdesign/core/Icon';
|
|
17
16
|
import {Outline, type OutlineItem} from '@astryxdesign/core/Outline';
|
|
18
17
|
import {useMediaQuery} from '@astryxdesign/core/hooks';
|
|
19
|
-
import {Sparkles, ClipboardCopy
|
|
18
|
+
import {Sparkles, ClipboardCopy} from 'lucide-react';
|
|
20
19
|
import {outlinePanel} from 'astryx-dracula/shared/chaptered-doc-config';
|
|
21
20
|
|
|
22
21
|
// ---------------------------------------------------------------------------
|
|
@@ -32,15 +31,6 @@ import {outlinePanel} from 'astryx-dracula/shared/chaptered-doc-config';
|
|
|
32
31
|
const SETUP_PROMPT =
|
|
33
32
|
'Help me get set up with Astryx Dracula. Based on my project, do the following: 1. Install @astryxdesign/core and the StyleX compiler. 2. Wrap my app in the Theme component. 3. Replace one existing component with an Astryx equivalent. After setup, suggest relevant next steps based on my project.';
|
|
34
33
|
|
|
35
|
-
// Copies the setup prompt in the shape each tool wants to receive it. The
|
|
36
|
-
// menu cannot navigate anywhere from a static template, so the action says
|
|
37
|
-
// what it does.
|
|
38
|
-
const PROMPT_TARGETS = ['v0', 'Claude', 'ChatGPT', 'Cursor'].map(target => ({
|
|
39
|
-
label: `Copy for ${target}`,
|
|
40
|
-
onClick: () => {
|
|
41
|
-
void navigator.clipboard.writeText(SETUP_PROMPT);
|
|
42
|
-
},
|
|
43
|
-
}));
|
|
44
34
|
|
|
45
35
|
const OUTLINE_ITEMS: OutlineItem[] = [
|
|
46
36
|
{id: 'prerequisites', label: 'Prerequisites', level: 2},
|
|
@@ -124,16 +114,6 @@ export default function DocumentationTechnical() {
|
|
|
124
114
|
void navigator.clipboard.writeText(SETUP_PROMPT);
|
|
125
115
|
}}
|
|
126
116
|
/>
|
|
127
|
-
<DropdownMenu
|
|
128
|
-
button={{
|
|
129
|
-
label: 'More options',
|
|
130
|
-
variant: 'ghost',
|
|
131
|
-
size: 'sm',
|
|
132
|
-
isIconOnly: true,
|
|
133
|
-
icon: <Icon icon={ChevronDown} />,
|
|
134
|
-
}}
|
|
135
|
-
items={PROMPT_TARGETS}
|
|
136
|
-
/>
|
|
137
117
|
</HStack>
|
|
138
118
|
<Text type="body" color="secondary">
|
|
139
119
|
Help me get set up with Astryx Dracula. Based on my project,
|
package/templates/editor.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
type CSSProperties,
|
|
10
10
|
type KeyboardEvent,
|
|
11
11
|
type MouseEvent,
|
|
12
|
+
type ReactNode,
|
|
12
13
|
type SVGProps,
|
|
13
14
|
} from 'react';
|
|
14
15
|
import {useMediaQuery} from '@astryxdesign/core/hooks';
|
|
@@ -158,10 +159,6 @@ const VIEWPORT_MAX: Record<ViewportSize, number> = {
|
|
|
158
159
|
phone: 375,
|
|
159
160
|
};
|
|
160
161
|
|
|
161
|
-
let nextId = 5;
|
|
162
|
-
function uid() {
|
|
163
|
-
return String(nextId++);
|
|
164
|
-
}
|
|
165
162
|
|
|
166
163
|
const DEFAULT_BLOCKS: Block[] = [
|
|
167
164
|
{
|
|
@@ -328,6 +325,36 @@ const iconCircle: CSSProperties = {
|
|
|
328
325
|
// Properties Form
|
|
329
326
|
// ---------------------------------------------------------------------------
|
|
330
327
|
|
|
328
|
+
// Heading/description pair shared by the hero/text/features/cta branches.
|
|
329
|
+
// Hero labels it "Subheading" and adds its own button/alignment controls;
|
|
330
|
+
// the merge keeps the shared pair, not the per-branch extras.
|
|
331
|
+
function HeadingDescriptionGroup({
|
|
332
|
+
props,
|
|
333
|
+
onUpdate,
|
|
334
|
+
descriptionKey,
|
|
335
|
+
descriptionLabel,
|
|
336
|
+
}: {
|
|
337
|
+
props: Record<string, unknown>;
|
|
338
|
+
onUpdate: (key: string, value: unknown) => void;
|
|
339
|
+
descriptionKey: string;
|
|
340
|
+
descriptionLabel: string;
|
|
341
|
+
}) {
|
|
342
|
+
return (
|
|
343
|
+
<>
|
|
344
|
+
<TextInput
|
|
345
|
+
label="Heading"
|
|
346
|
+
value={(props.heading as string) ?? ''}
|
|
347
|
+
onChange={(v: string) => onUpdate('heading', v)}
|
|
348
|
+
/>
|
|
349
|
+
<TextArea
|
|
350
|
+
label={descriptionLabel}
|
|
351
|
+
value={(props[descriptionKey] as string) ?? ''}
|
|
352
|
+
onChange={(v: string) => onUpdate(descriptionKey, v)}
|
|
353
|
+
/>
|
|
354
|
+
</>
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
331
358
|
function PropertiesForm({
|
|
332
359
|
block,
|
|
333
360
|
onUpdate,
|
|
@@ -341,15 +368,11 @@ function PropertiesForm({
|
|
|
341
368
|
case 'hero':
|
|
342
369
|
return (
|
|
343
370
|
<VStack gap={4}>
|
|
344
|
-
<
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
<TextArea
|
|
350
|
-
label="Subheading"
|
|
351
|
-
value={(props.subheading as string) ?? ''}
|
|
352
|
-
onChange={(v: string) => onUpdate('subheading', v)}
|
|
371
|
+
<HeadingDescriptionGroup
|
|
372
|
+
props={props}
|
|
373
|
+
onUpdate={onUpdate}
|
|
374
|
+
descriptionKey="subheading"
|
|
375
|
+
descriptionLabel="Subheading"
|
|
353
376
|
/>
|
|
354
377
|
<TextInput
|
|
355
378
|
label="Button Label"
|
|
@@ -372,15 +395,11 @@ function PropertiesForm({
|
|
|
372
395
|
case 'text':
|
|
373
396
|
return (
|
|
374
397
|
<VStack gap={4}>
|
|
375
|
-
<
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
<TextArea
|
|
381
|
-
label="Description"
|
|
382
|
-
value={(props.description as string) ?? ''}
|
|
383
|
-
onChange={(v: string) => onUpdate('description', v)}
|
|
398
|
+
<HeadingDescriptionGroup
|
|
399
|
+
props={props}
|
|
400
|
+
onUpdate={onUpdate}
|
|
401
|
+
descriptionKey="description"
|
|
402
|
+
descriptionLabel="Description"
|
|
384
403
|
/>
|
|
385
404
|
<TextInput
|
|
386
405
|
label="Button Label"
|
|
@@ -389,20 +408,15 @@ function PropertiesForm({
|
|
|
389
408
|
/>
|
|
390
409
|
</VStack>
|
|
391
410
|
);
|
|
392
|
-
|
|
393
411
|
case 'features':
|
|
394
412
|
case 'cta':
|
|
395
413
|
return (
|
|
396
414
|
<VStack gap={4}>
|
|
397
|
-
<
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
<TextArea
|
|
403
|
-
label="Description"
|
|
404
|
-
value={(props.description as string) ?? ''}
|
|
405
|
-
onChange={(v: string) => onUpdate('description', v)}
|
|
415
|
+
<HeadingDescriptionGroup
|
|
416
|
+
props={props}
|
|
417
|
+
onUpdate={onUpdate}
|
|
418
|
+
descriptionKey="description"
|
|
419
|
+
descriptionLabel="Description"
|
|
406
420
|
/>
|
|
407
421
|
</VStack>
|
|
408
422
|
);
|
|
@@ -458,187 +472,156 @@ function BlockPreview({
|
|
|
458
472
|
}) {
|
|
459
473
|
const {type, props} = block;
|
|
460
474
|
|
|
475
|
+
// One SelectableCard wrapper for every block; only the inner content
|
|
476
|
+
// switches. Keeps padding/label/selection in one place.
|
|
477
|
+
let content: ReactNode;
|
|
461
478
|
switch (type) {
|
|
462
479
|
case 'hero':
|
|
463
|
-
|
|
464
|
-
<
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
</Text>
|
|
476
|
-
{(props.buttonLabel as string) && (
|
|
477
|
-
<Button label={props.buttonLabel as string} />
|
|
478
|
-
)}
|
|
479
|
-
</VStack>
|
|
480
|
-
</SelectableCard>
|
|
480
|
+
content = (
|
|
481
|
+
<VStack gap={4}>
|
|
482
|
+
<Heading level={3}>
|
|
483
|
+
{(props.heading as string) || 'Hero Heading'}
|
|
484
|
+
</Heading>
|
|
485
|
+
<Text type="body" color="secondary">
|
|
486
|
+
{(props.subheading as string) || 'A whisper from the crypt…'}
|
|
487
|
+
</Text>
|
|
488
|
+
{(props.buttonLabel as string) && (
|
|
489
|
+
<Button label={props.buttonLabel as string} />
|
|
490
|
+
)}
|
|
491
|
+
</VStack>
|
|
481
492
|
);
|
|
493
|
+
break;
|
|
482
494
|
|
|
483
495
|
case 'text':
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
/>
|
|
504
|
-
</SelectableCard>
|
|
505
|
-
);
|
|
506
|
-
}
|
|
507
|
-
return (
|
|
508
|
-
<SelectableCard
|
|
509
|
-
padding={4}
|
|
510
|
-
label={block.label}
|
|
511
|
-
isSelected={isSelected}
|
|
512
|
-
onChange={onSelect}>
|
|
513
|
-
<Text type="body">
|
|
514
|
-
{(props.content as string) || 'Ink your midnight thoughts here…'}
|
|
515
|
-
</Text>
|
|
516
|
-
</SelectableCard>
|
|
496
|
+
content = props.heading ? (
|
|
497
|
+
<EmptyState
|
|
498
|
+
title={props.heading as string}
|
|
499
|
+
description={props.description as string}
|
|
500
|
+
icon={<Icon icon={FileText} color="secondary" />}
|
|
501
|
+
actions={
|
|
502
|
+
(props.buttonLabel as string) ? (
|
|
503
|
+
<Button
|
|
504
|
+
label={props.buttonLabel as string}
|
|
505
|
+
variant="secondary"
|
|
506
|
+
/>
|
|
507
|
+
) : undefined
|
|
508
|
+
}
|
|
509
|
+
/>
|
|
510
|
+
) : (
|
|
511
|
+
<Text type="body">
|
|
512
|
+
{(props.content as string) || 'Ink your midnight thoughts here…'}
|
|
513
|
+
</Text>
|
|
517
514
|
);
|
|
518
|
-
|
|
515
|
+
break;
|
|
519
516
|
case 'image':
|
|
520
|
-
|
|
521
|
-
<
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
title="Image Block"
|
|
528
|
-
description="Drop an image or enter a URL"
|
|
529
|
-
icon={<Icon icon={Image} color="secondary" />}
|
|
530
|
-
isCompact
|
|
531
|
-
/>
|
|
532
|
-
</SelectableCard>
|
|
517
|
+
content = (
|
|
518
|
+
<EmptyState
|
|
519
|
+
title="Image Block"
|
|
520
|
+
description="Drop an image or enter a URL"
|
|
521
|
+
icon={<Icon icon={Image} color="secondary" />}
|
|
522
|
+
isCompact
|
|
523
|
+
/>
|
|
533
524
|
);
|
|
525
|
+
break;
|
|
534
526
|
|
|
535
527
|
case 'button':
|
|
536
|
-
|
|
537
|
-
<
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
'primary'
|
|
548
|
-
}
|
|
549
|
-
size={(props.size as 'sm' | 'md' | 'lg') || 'md'}
|
|
550
|
-
/>
|
|
551
|
-
</Center>
|
|
552
|
-
</SelectableCard>
|
|
528
|
+
content = (
|
|
529
|
+
<Center>
|
|
530
|
+
<Button
|
|
531
|
+
label={(props.label as string) || 'Button'}
|
|
532
|
+
variant={
|
|
533
|
+
(props.variant as 'primary' | 'secondary' | 'ghost') ||
|
|
534
|
+
'primary'
|
|
535
|
+
}
|
|
536
|
+
size={(props.size as 'sm' | 'md' | 'lg') || 'md'}
|
|
537
|
+
/>
|
|
538
|
+
</Center>
|
|
553
539
|
);
|
|
540
|
+
break;
|
|
541
|
+
|
|
554
542
|
|
|
555
543
|
case 'features': {
|
|
556
544
|
const items = (props.items as Transaction[]) || [];
|
|
557
|
-
|
|
558
|
-
<
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
idKey="id"
|
|
581
|
-
hasHover
|
|
582
|
-
textOverflow="truncate"
|
|
583
|
-
/>
|
|
584
|
-
</VStack>
|
|
585
|
-
</SelectableCard>
|
|
545
|
+
content = (
|
|
546
|
+
<VStack gap={4}>
|
|
547
|
+
<HStack gap={3} vAlign="start" hAlign="between">
|
|
548
|
+
<VStack gap={1}>
|
|
549
|
+
<Heading level={3}>
|
|
550
|
+
{(props.heading as string) || 'Features'}
|
|
551
|
+
</Heading>
|
|
552
|
+
{(props.description as string) && (
|
|
553
|
+
<Text type="body" color="secondary">
|
|
554
|
+
{props.description as string}
|
|
555
|
+
</Text>
|
|
556
|
+
)}
|
|
557
|
+
</VStack>
|
|
558
|
+
<Button label="View All" variant="secondary" />
|
|
559
|
+
</HStack>
|
|
560
|
+
<Table
|
|
561
|
+
data={items}
|
|
562
|
+
columns={TRANSACTION_COLUMNS}
|
|
563
|
+
idKey="id"
|
|
564
|
+
hasHover
|
|
565
|
+
textOverflow="truncate"
|
|
566
|
+
/>
|
|
567
|
+
</VStack>
|
|
586
568
|
);
|
|
569
|
+
break;
|
|
587
570
|
}
|
|
588
571
|
|
|
589
572
|
case 'cards': {
|
|
590
573
|
const cardItems =
|
|
591
574
|
(props.cards as Array<{title: string; description: string}>) || [];
|
|
592
|
-
|
|
593
|
-
<
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
description={card.description}
|
|
607
|
-
/>
|
|
608
|
-
))}
|
|
609
|
-
</List>
|
|
610
|
-
</VStack>
|
|
611
|
-
</SelectableCard>
|
|
575
|
+
content = (
|
|
576
|
+
<VStack gap={4}>
|
|
577
|
+
<Heading level={3}>Cards</Heading>
|
|
578
|
+
<Divider />
|
|
579
|
+
<List density="balanced" hasDividers={false}>
|
|
580
|
+
{cardItems.map(card => (
|
|
581
|
+
<ListItem
|
|
582
|
+
key={card.title}
|
|
583
|
+
label={card.title}
|
|
584
|
+
description={card.description}
|
|
585
|
+
/>
|
|
586
|
+
))}
|
|
587
|
+
</List>
|
|
588
|
+
</VStack>
|
|
612
589
|
);
|
|
590
|
+
break;
|
|
613
591
|
}
|
|
614
592
|
|
|
615
593
|
case 'cta':
|
|
616
|
-
|
|
617
|
-
<
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
{(props.description as string) ||
|
|
632
|
-
'Words from the crypt gather here…'}
|
|
633
|
-
</Text>
|
|
634
|
-
</VStack>
|
|
635
|
-
</HStack>
|
|
636
|
-
</SelectableCard>
|
|
594
|
+
content = (
|
|
595
|
+
<HStack gap={4} vAlign="start">
|
|
596
|
+
<Center width={40} height={40} style={iconCircle}>
|
|
597
|
+
<Icon icon={Lock} color="secondary" />
|
|
598
|
+
</Center>
|
|
599
|
+
<VStack gap={1}>
|
|
600
|
+
<Heading level={3}>
|
|
601
|
+
{(props.heading as string) || 'Notice'}
|
|
602
|
+
</Heading>
|
|
603
|
+
<Text type="body" color="secondary">
|
|
604
|
+
{(props.description as string) ||
|
|
605
|
+
'Words from the crypt gather here…'}
|
|
606
|
+
</Text>
|
|
607
|
+
</VStack>
|
|
608
|
+
</HStack>
|
|
637
609
|
);
|
|
610
|
+
break;
|
|
638
611
|
|
|
639
612
|
default:
|
|
640
613
|
return null;
|
|
641
614
|
}
|
|
615
|
+
|
|
616
|
+
return (
|
|
617
|
+
<SelectableCard
|
|
618
|
+
padding={4}
|
|
619
|
+
label={block.label}
|
|
620
|
+
isSelected={isSelected}
|
|
621
|
+
onChange={onSelect}>
|
|
622
|
+
{content}
|
|
623
|
+
</SelectableCard>
|
|
624
|
+
);
|
|
642
625
|
}
|
|
643
626
|
|
|
644
627
|
// ---------------------------------------------------------------------------
|
|
@@ -701,7 +684,7 @@ export default function PageEditor() {
|
|
|
701
684
|
);
|
|
702
685
|
|
|
703
686
|
const addBlock = useCallback((type: BlockType) => {
|
|
704
|
-
const id =
|
|
687
|
+
const id = crypto.randomUUID();
|
|
705
688
|
const newBlock: Block = {
|
|
706
689
|
id,
|
|
707
690
|
type,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// XLE (canonical structure, validated with `bunx astryx layout check`):
|
|
3
3
|
// L > (Tbar[size=sm] > (H > IB"Go back" + IB"Go forward" + Tx"Folder"[t=label]) + (SG"View mode" > SGI*4) + (H > IB"Group" + IB"Share" + IB"Tags" + IB"More" + IB"Search")) + (LC[p=0 !scroll] > (Hd"File Explorer"[level=1] + H[h=fill] > (S.transparent[p=2 w=240 dv=[end]] > UL[density=compact !hasDividers] > (LI > Ic + Tx"Item"[t=body])*3)*3 + (S.transparent[p=6] > V[g=4 a=center] > Av[size=96] + (V[g=1 a=center] > Tx"Name"[t=body] + Tx"Kind"[t=supporting]) + (ML"Information" > MLI*3))))
|
|
4
4
|
|
|
5
|
-
import {useState, useMemo
|
|
5
|
+
import {useState, useMemo} from 'react';
|
|
6
6
|
import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
|
|
7
7
|
import {Toolbar} from '@astryxdesign/core/Toolbar';
|
|
8
8
|
import {List, ListItem} from '@astryxdesign/core/List';
|
|
@@ -262,19 +262,6 @@ const FILESYSTEM: FileSystemItem[] = [
|
|
|
262
262
|
},
|
|
263
263
|
];
|
|
264
264
|
|
|
265
|
-
const page: CSSProperties = {height: '100dvh'};
|
|
266
|
-
const columnRow: CSSProperties = {overflowX: 'auto', overflowY: 'hidden'};
|
|
267
|
-
const scrollable: CSSProperties = {overflowY: 'auto'};
|
|
268
|
-
const fixedColumn: CSSProperties = {flexShrink: 0};
|
|
269
|
-
// The column's 320px resting width rides on Section's `width` prop; grow
|
|
270
|
-
// lets it absorb whatever the fixed columns leave. Inline styles are for
|
|
271
|
-
// what props cannot express.
|
|
272
|
-
const detailColumn: CSSProperties = {
|
|
273
|
-
flexGrow: 1,
|
|
274
|
-
flexShrink: 0,
|
|
275
|
-
};
|
|
276
|
-
const controlsScroll: CSSProperties = {overflowX: 'auto'};
|
|
277
|
-
|
|
278
265
|
// Static toolbar content, hoisted out of the render path: neither element
|
|
279
266
|
// reads component state, so rebuilding them per render buys nothing.
|
|
280
267
|
const viewSwitcher = (
|
|
@@ -373,7 +360,6 @@ export default function FileExplorer() {
|
|
|
373
360
|
]);
|
|
374
361
|
|
|
375
362
|
const isNarrow = useMediaQuery('(max-width: 768px)');
|
|
376
|
-
const isPhone = isNarrow;
|
|
377
363
|
|
|
378
364
|
const columns = useMemo(() => {
|
|
379
365
|
// `id` names the folder a column lists, so the React key stays put when
|
|
@@ -480,19 +466,19 @@ export default function FileExplorer() {
|
|
|
480
466
|
|
|
481
467
|
return (
|
|
482
468
|
<Layout
|
|
483
|
-
style={
|
|
469
|
+
style={{height: '100dvh'}}
|
|
484
470
|
height="fill"
|
|
485
471
|
header={
|
|
486
472
|
<>
|
|
487
473
|
<Toolbar
|
|
488
474
|
label="File Explorer"
|
|
489
475
|
size="sm"
|
|
490
|
-
dividers={
|
|
476
|
+
dividers={isNarrow ? undefined : ['bottom']}
|
|
491
477
|
startContent={titleContent}
|
|
492
|
-
centerContent={
|
|
493
|
-
endContent={
|
|
478
|
+
centerContent={isNarrow ? undefined : viewSwitcher}
|
|
479
|
+
endContent={isNarrow ? undefined : fileActions}
|
|
494
480
|
/>
|
|
495
|
-
{
|
|
481
|
+
{isNarrow && (
|
|
496
482
|
<Section
|
|
497
483
|
variant="transparent"
|
|
498
484
|
padding={2}
|
|
@@ -500,7 +486,7 @@ export default function FileExplorer() {
|
|
|
500
486
|
<HStack
|
|
501
487
|
gap={2}
|
|
502
488
|
vAlign="center"
|
|
503
|
-
style={
|
|
489
|
+
style={{overflowX: 'auto'}}
|
|
504
490
|
role="region"
|
|
505
491
|
aria-label="View and file actions"
|
|
506
492
|
tabIndex={0}>
|
|
@@ -516,7 +502,7 @@ export default function FileExplorer() {
|
|
|
516
502
|
<VisuallyHidden as="h1">
|
|
517
503
|
File Explorer
|
|
518
504
|
</VisuallyHidden>
|
|
519
|
-
<HStack height="100%" style={
|
|
505
|
+
<HStack height="100%" style={{overflowX: 'auto', overflowY: 'hidden'}}>
|
|
520
506
|
{!isPreviewPane &&
|
|
521
507
|
visibleColumns.map((col, colIndex) => {
|
|
522
508
|
const trueIndex = columnOffset + colIndex;
|
|
@@ -529,7 +515,7 @@ export default function FileExplorer() {
|
|
|
529
515
|
padding={2}
|
|
530
516
|
variant="transparent"
|
|
531
517
|
dividers={showDivider ? ['end'] : undefined}
|
|
532
|
-
style={{
|
|
518
|
+
style={{overflowY: 'auto', flexShrink: 0}}
|
|
533
519
|
role="region"
|
|
534
520
|
aria-label={`Folder column ${trueIndex + 1}`}
|
|
535
521
|
tabIndex={0}>
|
|
@@ -600,7 +586,7 @@ export default function FileExplorer() {
|
|
|
600
586
|
// uses for exactly this (scaffolds.md new-site recipe).
|
|
601
587
|
padding={4}
|
|
602
588
|
variant="transparent"
|
|
603
|
-
style={{
|
|
589
|
+
style={{overflowY: 'auto', flexGrow: 1, flexShrink: 0}}
|
|
604
590
|
role="region"
|
|
605
591
|
aria-label={`Details for ${selectedFile.name}`}
|
|
606
592
|
tabIndex={0}>
|
package/templates/ide.tsx
CHANGED
|
@@ -75,6 +75,15 @@ const styles: Record<string, CSSProperties> = {
|
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
// Full-bleed CodeBlock inside a panel: the panel owns the chrome, so the
|
|
79
|
+
// block drops its own border and radius rather than drawing a box in a box.
|
|
80
|
+
const codeBlockFlush: CSSProperties = {
|
|
81
|
+
width: '100%',
|
|
82
|
+
height: '100%',
|
|
83
|
+
borderWidth: 0,
|
|
84
|
+
borderRadius: 0,
|
|
85
|
+
};
|
|
86
|
+
|
|
78
87
|
const EDITOR_CODE = `import {useState, useCallback} from 'react';
|
|
79
88
|
import {Button} from '@astryxdesign/core/Button';
|
|
80
89
|
import {Text} from '@astryxdesign/core/Text';
|
|
@@ -323,12 +332,7 @@ export default function IdeWorkspace() {
|
|
|
323
332
|
highlightLines={[21]}
|
|
324
333
|
hasCopyButton={false}
|
|
325
334
|
size="sm"
|
|
326
|
-
style={
|
|
327
|
-
width: '100%',
|
|
328
|
-
height: '100%',
|
|
329
|
-
borderWidth: 0,
|
|
330
|
-
borderRadius: 0,
|
|
331
|
-
}}
|
|
335
|
+
style={codeBlockFlush}
|
|
332
336
|
/>
|
|
333
337
|
</StackItem>
|
|
334
338
|
<ResizeHandle
|
|
@@ -366,12 +370,7 @@ export default function IdeWorkspace() {
|
|
|
366
370
|
hasLanguageLabel={false}
|
|
367
371
|
hasCopyButton={false}
|
|
368
372
|
size="sm"
|
|
369
|
-
style={
|
|
370
|
-
width: '100%',
|
|
371
|
-
height: '100%',
|
|
372
|
-
borderWidth: 0,
|
|
373
|
-
borderRadius: 0,
|
|
374
|
-
}}
|
|
373
|
+
style={codeBlockFlush}
|
|
375
374
|
/>
|
|
376
375
|
)}
|
|
377
376
|
{activeTermTab === 'output' && (
|
|
@@ -382,12 +381,7 @@ export default function IdeWorkspace() {
|
|
|
382
381
|
hasLanguageLabel={false}
|
|
383
382
|
hasCopyButton={false}
|
|
384
383
|
size="sm"
|
|
385
|
-
style={
|
|
386
|
-
width: '100%',
|
|
387
|
-
height: '100%',
|
|
388
|
-
borderWidth: 0,
|
|
389
|
-
borderRadius: 0,
|
|
390
|
-
}}
|
|
384
|
+
style={codeBlockFlush}
|
|
391
385
|
/>
|
|
392
386
|
)}
|
|
393
387
|
{activeTermTab === 'problems' && (
|