@prosefly/astro-components 0.1.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/LICENSE +29 -0
- package/README.md +108 -0
- package/dist/astro-shim.d.ts +4 -0
- package/dist/client/accordions.d.ts +7 -0
- package/dist/client/accordions.d.ts.map +1 -0
- package/dist/client/accordions.js +70 -0
- package/dist/client/accordions.js.map +1 -0
- package/dist/client/image-gallery.d.ts +7 -0
- package/dist/client/image-gallery.d.ts.map +1 -0
- package/dist/client/image-gallery.js +103 -0
- package/dist/client/image-gallery.js.map +1 -0
- package/dist/client/tabs.d.ts +7 -0
- package/dist/client/tabs.d.ts.map +1 -0
- package/dist/client/tabs.js +160 -0
- package/dist/client/tabs.js.map +1 -0
- package/dist/icon/index.d.ts +8 -0
- package/dist/icon/index.d.ts.map +1 -0
- package/dist/icon/index.js +131 -0
- package/dist/icon/index.js.map +1 -0
- package/dist/icon/middleware.d.ts +3 -0
- package/dist/icon/middleware.d.ts.map +1 -0
- package/dist/icon/middleware.js +28 -0
- package/dist/icon/middleware.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown/image-gallery-plugin.d.ts +3 -0
- package/dist/markdown/image-gallery-plugin.d.ts.map +1 -0
- package/dist/markdown/image-gallery-plugin.js +125 -0
- package/dist/markdown/image-gallery-plugin.js.map +1 -0
- package/dist/markdown/image-gallery.css +119 -0
- package/dist/markdown/image-gallery.js +1 -0
- package/dist/markdown/index.d.ts +3 -0
- package/dist/markdown/index.d.ts.map +1 -0
- package/dist/markdown/index.js +3 -0
- package/dist/markdown/index.js.map +1 -0
- package/dist/markdown/package-manager-tabs.d.ts +3 -0
- package/dist/markdown/package-manager-tabs.d.ts.map +1 -0
- package/dist/markdown/package-manager-tabs.js +329 -0
- package/dist/markdown/package-manager-tabs.js.map +1 -0
- package/dist/mdx/AccordionItem.astro +54 -0
- package/dist/mdx/Accordions.astro +126 -0
- package/dist/mdx/Badge.astro +140 -0
- package/dist/mdx/Callout.astro +124 -0
- package/dist/mdx/Card.astro +138 -0
- package/dist/mdx/CardGrid.astro +18 -0
- package/dist/mdx/FileTree.astro +231 -0
- package/dist/mdx/FileTreeItem.astro +97 -0
- package/dist/mdx/Icon.astro +132 -0
- package/dist/mdx/Steps.astro +88 -0
- package/dist/mdx/TabItem.astro +21 -0
- package/dist/mdx/Tabs.astro +272 -0
- package/dist/mdx/rehype-file-tree.d.ts +14 -0
- package/dist/mdx/rehype-file-tree.d.ts.map +1 -0
- package/dist/mdx/rehype-file-tree.js +205 -0
- package/dist/mdx/rehype-file-tree.js.map +1 -0
- package/dist/mdx/rehype-steps.d.ts +4 -0
- package/dist/mdx/rehype-steps.d.ts.map +1 -0
- package/dist/mdx/rehype-steps.js +74 -0
- package/dist/mdx/rehype-steps.js.map +1 -0
- package/dist/mdx/rehype-tabs.d.ts +19 -0
- package/dist/mdx/rehype-tabs.d.ts.map +1 -0
- package/dist/mdx/rehype-tabs.js +127 -0
- package/dist/mdx/rehype-tabs.js.map +1 -0
- package/dist/virtual.d.ts +8 -0
- package/package.json +57 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Icon from './Icon.astro';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
title?: string;
|
|
6
|
+
type?: 'note' | 'tip' | 'warning' | 'danger';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const iconNames = {
|
|
10
|
+
danger: 'lucide:badge-alert',
|
|
11
|
+
note: 'lucide:info',
|
|
12
|
+
tip: 'lucide:lightbulb',
|
|
13
|
+
warning: 'lucide:triangle-alert',
|
|
14
|
+
} as const;
|
|
15
|
+
const { title, type = 'note' } = Astro.props;
|
|
16
|
+
const hasTitle = Boolean(title);
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<aside class="pl-callout" data-has-title={hasTitle ? 'true' : 'false'} data-type={type}>
|
|
20
|
+
<span class="pl-callout__icon" aria-hidden="true">
|
|
21
|
+
<Icon name={iconNames[type]} />
|
|
22
|
+
</span>
|
|
23
|
+
<div class="pl-callout__content">
|
|
24
|
+
{hasTitle && <p class="pl-callout__title">{title}</p>}
|
|
25
|
+
<div class="pl-callout__slot">
|
|
26
|
+
<slot />
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</aside>
|
|
30
|
+
|
|
31
|
+
<style>
|
|
32
|
+
.pl-callout {
|
|
33
|
+
--pl-callout-color: var(--pl-accent, #4f46e5);
|
|
34
|
+
--pl-callout-ink: var(--pl-accent, #4f46e5);
|
|
35
|
+
--pl-callout-bg: var(
|
|
36
|
+
--pl-accent-soft,
|
|
37
|
+
color-mix(in oklab, var(--pl-accent, #4f46e5) 8%, var(--pl-background, #ffffff))
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
display: grid;
|
|
41
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
42
|
+
gap: 0.875rem;
|
|
43
|
+
margin-block: 1.5rem;
|
|
44
|
+
border: 1px solid color-mix(in oklab, var(--pl-callout-color) 24%, var(--pl-surface, #f4f6f8));
|
|
45
|
+
border-radius: min(var(--pl-radius-lg, 0.75rem), 1rem);
|
|
46
|
+
background: var(--pl-callout-bg);
|
|
47
|
+
color: var(--pl-text, #182230);
|
|
48
|
+
padding: 1rem 1.25rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.pl-callout[data-type='tip'] {
|
|
52
|
+
--pl-callout-color: oklch(0.64 0.16 155);
|
|
53
|
+
--pl-callout-ink: oklch(0.45 0.13 155);
|
|
54
|
+
--pl-callout-bg: color-mix(in oklab, oklch(0.64 0.16 155) 10%, var(--pl-background, #ffffff));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.pl-callout[data-type='warning'] {
|
|
58
|
+
--pl-callout-color: oklch(0.74 0.16 80);
|
|
59
|
+
--pl-callout-ink: oklch(0.5 0.12 80);
|
|
60
|
+
--pl-callout-bg: color-mix(in oklab, oklch(0.74 0.16 80) 12%, var(--pl-background, #ffffff));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.pl-callout[data-type='danger'] {
|
|
64
|
+
--pl-callout-color: oklch(0.62 0.2 25);
|
|
65
|
+
--pl-callout-ink: oklch(0.52 0.16 25);
|
|
66
|
+
--pl-callout-bg: color-mix(in oklab, oklch(0.62 0.2 25) 10%, var(--pl-background, #ffffff));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.pl-callout[data-has-title='false'] {
|
|
70
|
+
align-items: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.pl-callout__icon {
|
|
74
|
+
align-items: center;
|
|
75
|
+
color: var(--pl-callout-ink);
|
|
76
|
+
display: inline-flex;
|
|
77
|
+
height: 1.25rem;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
line-height: 0;
|
|
80
|
+
margin-block-start: 0.125rem;
|
|
81
|
+
width: 1.25rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.pl-callout[data-has-title='false'] .pl-callout__icon {
|
|
85
|
+
margin-block-start: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.pl-callout__icon :global(.pl-icon) {
|
|
89
|
+
display: block;
|
|
90
|
+
height: 1.25rem;
|
|
91
|
+
width: 1.25rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.pl-callout__title {
|
|
95
|
+
color: var(--pl-callout-ink);
|
|
96
|
+
font-size: 1rem;
|
|
97
|
+
font-weight: 700;
|
|
98
|
+
line-height: 1.5;
|
|
99
|
+
margin: 0 0 0.5rem;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.pl-callout__slot {
|
|
103
|
+
color: var(--pl-text, #182230);
|
|
104
|
+
font-size: 0.9375rem;
|
|
105
|
+
line-height: 1.75;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.pl-callout[data-has-title='false'] .pl-callout__slot {
|
|
109
|
+
color: var(--pl-callout-ink);
|
|
110
|
+
font-size: 1rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.pl-callout__slot :global(> * + *) {
|
|
114
|
+
margin-top: 0.75rem;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.pl-callout__slot :global(> :first-child) {
|
|
118
|
+
margin-top: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.pl-callout__slot :global(> :last-child) {
|
|
122
|
+
margin-bottom: 0;
|
|
123
|
+
}
|
|
124
|
+
</style>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Icon from './Icon.astro';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
title?: string;
|
|
6
|
+
href?: string;
|
|
7
|
+
external?: boolean;
|
|
8
|
+
icon?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
title,
|
|
13
|
+
href,
|
|
14
|
+
external = false,
|
|
15
|
+
icon,
|
|
16
|
+
class: _className,
|
|
17
|
+
...attrs
|
|
18
|
+
} = Astro.props as Props & { class?: unknown } & Record<string, unknown>;
|
|
19
|
+
const Tag = href ? 'a' : 'article';
|
|
20
|
+
const linkAttrs = href
|
|
21
|
+
? {
|
|
22
|
+
href,
|
|
23
|
+
rel: external ? 'noreferrer' : undefined,
|
|
24
|
+
target: external ? '_blank' : undefined,
|
|
25
|
+
}
|
|
26
|
+
: {};
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<Tag
|
|
30
|
+
class:list={['pl-card', href && 'pl-card--link']}
|
|
31
|
+
data-external={href && external ? 'true' : undefined}
|
|
32
|
+
{...linkAttrs}
|
|
33
|
+
{...attrs}
|
|
34
|
+
>
|
|
35
|
+
<div class="pl-card__layout">
|
|
36
|
+
{
|
|
37
|
+
icon && (
|
|
38
|
+
<span aria-hidden="true" class="pl-card__icon">
|
|
39
|
+
<Icon name={icon} />
|
|
40
|
+
</span>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
<div class="pl-card__body">
|
|
44
|
+
{title && <h3 class="pl-card__title">{title}</h3>}
|
|
45
|
+
<div class="pl-card__content">
|
|
46
|
+
<slot />
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</Tag>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
.pl-card {
|
|
54
|
+
background: transparent;
|
|
55
|
+
border: 1px solid
|
|
56
|
+
color-mix(in oklab, var(--pl-text-muted, #667085) 18%, transparent);
|
|
57
|
+
border-radius: min(var(--pl-radius-lg, 0.75rem), 1rem);
|
|
58
|
+
color: inherit;
|
|
59
|
+
display: block;
|
|
60
|
+
padding: var(--pl-card-padding, 1rem);
|
|
61
|
+
text-decoration: none;
|
|
62
|
+
transition:
|
|
63
|
+
background-color 160ms ease,
|
|
64
|
+
border-color 160ms ease;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.pl-card--link:hover {
|
|
68
|
+
background: transparent;
|
|
69
|
+
border-color: var(--pl-accent, #4f46e5);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.pl-card--link:focus-visible {
|
|
73
|
+
outline: 2px solid var(--pl-accent, #4f46e5);
|
|
74
|
+
outline-offset: 2px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.pl-card__layout {
|
|
78
|
+
display: grid;
|
|
79
|
+
gap: var(--pl-card-layout-gap, 0.75rem);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.pl-card__body {
|
|
83
|
+
display: grid;
|
|
84
|
+
gap: var(--pl-card-body-gap, 0.375rem);
|
|
85
|
+
min-width: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.pl-card__icon {
|
|
89
|
+
align-items: center;
|
|
90
|
+
background: var(
|
|
91
|
+
--pl-accent-soft,
|
|
92
|
+
color-mix(in oklab, var(--pl-accent, #4f46e5) 12%, white)
|
|
93
|
+
);
|
|
94
|
+
border-radius: var(--pl-radius-md, 0.5rem);
|
|
95
|
+
color: var(--pl-accent, #4f46e5);
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
height: var(--pl-card-icon-size, 2.25rem);
|
|
98
|
+
justify-content: center;
|
|
99
|
+
line-height: 0;
|
|
100
|
+
width: var(--pl-card-icon-size, 2.25rem);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.pl-card--link:hover .pl-card__icon {
|
|
104
|
+
color: var(--pl-accent, #4f46e5);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.pl-card__icon :global(.pl-icon) {
|
|
108
|
+
display: block;
|
|
109
|
+
height: var(--pl-card-icon-glyph-size, 1.125rem);
|
|
110
|
+
width: var(--pl-card-icon-glyph-size, 1.125rem);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.pl-card__title {
|
|
114
|
+
color: var(--pl-text-strong, var(--pl-text, #182230));
|
|
115
|
+
font-size: var(--pl-card-title-size, 0.9375rem);
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
line-height: var(--pl-card-title-line-height, 1.375rem);
|
|
118
|
+
margin: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.pl-card__content {
|
|
122
|
+
color: var(--pl-text-muted, #667085);
|
|
123
|
+
font-size: var(--pl-card-content-size, 0.875rem);
|
|
124
|
+
line-height: var(--pl-card-content-line-height, 1.625);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.pl-card__content :global(> :first-child) {
|
|
128
|
+
margin-top: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.pl-card__content :global(> :last-child) {
|
|
132
|
+
margin-bottom: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.pl-card__content :global(> * + *) {
|
|
136
|
+
margin-top: var(--pl-card-content-gap, 0.5rem);
|
|
137
|
+
}
|
|
138
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<div class="pl-card-grid">
|
|
2
|
+
<slot />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<style>
|
|
6
|
+
.pl-card-grid {
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-columns: 1fr;
|
|
9
|
+
gap: var(--pl-card-grid-gap, 1rem);
|
|
10
|
+
margin-block: var(--pl-card-grid-margin, 2rem);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 48rem) {
|
|
14
|
+
.pl-card-grid {
|
|
15
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
import FileTreeItem from './FileTreeItem.astro';
|
|
3
|
+
import { parseFileTree } from './rehype-file-tree';
|
|
4
|
+
|
|
5
|
+
const fileTreeHtml = await Astro.slots.render('default');
|
|
6
|
+
const entries = parseFileTree(fileTreeHtml);
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<ul class="pl-file-tree" role="list">
|
|
10
|
+
{entries.map((entry) => <FileTreeItem entry={entry} />)}
|
|
11
|
+
</ul>
|
|
12
|
+
|
|
13
|
+
<style is:global>
|
|
14
|
+
.pl-file-tree {
|
|
15
|
+
--pl-file-tree-border: color-mix(
|
|
16
|
+
in oklab,
|
|
17
|
+
var(--pl-text-muted, #667085) 18%,
|
|
18
|
+
transparent
|
|
19
|
+
);
|
|
20
|
+
--pl-file-tree-line: color-mix(
|
|
21
|
+
in oklab,
|
|
22
|
+
var(--pl-text-muted, #667085) 16%,
|
|
23
|
+
transparent
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
background: var(--pl-background, #ffffff);
|
|
27
|
+
border: 1px solid var(--pl-file-tree-border);
|
|
28
|
+
border-radius: min(var(--pl-radius-lg, 0.75rem), 1rem);
|
|
29
|
+
color: var(--pl-text, #344054);
|
|
30
|
+
font-family:
|
|
31
|
+
var(--pl-font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
|
|
32
|
+
font-size: 0.875rem;
|
|
33
|
+
line-height: 1.5rem;
|
|
34
|
+
list-style: none;
|
|
35
|
+
margin-block: 1.5rem;
|
|
36
|
+
overflow-x: auto;
|
|
37
|
+
padding: 0.75rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.pl-file-tree,
|
|
41
|
+
.pl-file-tree ul {
|
|
42
|
+
list-style: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.pl-file-tree :where(ul, li, p) {
|
|
46
|
+
margin: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pl-file-tree :where(ul) {
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.pl-file-tree__list {
|
|
54
|
+
margin-block-start: 0.125rem;
|
|
55
|
+
padding-inline-start: 1.5rem;
|
|
56
|
+
position: relative;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.pl-file-tree__list::before {
|
|
60
|
+
background: var(--pl-file-tree-line);
|
|
61
|
+
bottom: 0.75rem;
|
|
62
|
+
content: "";
|
|
63
|
+
inset-inline-start: 0.625rem;
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 0;
|
|
66
|
+
width: 1px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.pl-file-tree__item {
|
|
70
|
+
margin: 0;
|
|
71
|
+
min-width: max-content;
|
|
72
|
+
padding: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.pl-file-tree__entry {
|
|
76
|
+
align-items: center;
|
|
77
|
+
border-radius: var(--pl-radius-md, 0.5rem);
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
gap: 0.375rem;
|
|
80
|
+
min-height: 1.75rem;
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.pl-file-tree__target {
|
|
85
|
+
align-items: center;
|
|
86
|
+
border-radius: var(--pl-radius-md, 0.5rem);
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
gap: 0.375rem;
|
|
90
|
+
min-height: 1.625rem;
|
|
91
|
+
padding: 0.125rem 0.5rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.pl-file-tree__target--highlighted {
|
|
95
|
+
background: var(
|
|
96
|
+
--pl-accent-soft,
|
|
97
|
+
color-mix(in oklab, var(--pl-accent, #4f46e5) 12%, var(--pl-background, #ffffff))
|
|
98
|
+
);
|
|
99
|
+
color: var(--pl-text-strong, var(--pl-text, #182230));
|
|
100
|
+
font-weight: 600;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.pl-file-tree__summary {
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
display: block;
|
|
106
|
+
list-style: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.pl-file-tree__summary::-webkit-details-marker {
|
|
110
|
+
display: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.pl-file-tree__summary:hover .pl-file-tree__target:not(.pl-file-tree__target--highlighted) {
|
|
114
|
+
background: var(--pl-surface, #f4f6f8);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.pl-file-tree__chevron {
|
|
118
|
+
align-items: center;
|
|
119
|
+
color: var(--pl-text-muted, #667085);
|
|
120
|
+
display: inline-flex;
|
|
121
|
+
flex: 0 0 auto;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
line-height: 0;
|
|
124
|
+
transition: transform 160ms ease;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.pl-file-tree__details[open] > .pl-file-tree__summary .pl-file-tree__chevron {
|
|
128
|
+
transform: rotate(90deg);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.pl-file-tree__icon {
|
|
132
|
+
align-items: center;
|
|
133
|
+
color: var(--pl-text-muted, #667085);
|
|
134
|
+
display: inline-flex;
|
|
135
|
+
flex: 0 0 auto;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
line-height: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.pl-file-tree__icon .pl-icon,
|
|
141
|
+
.pl-file-tree__icon-closed .pl-icon,
|
|
142
|
+
.pl-file-tree__icon-open .pl-icon,
|
|
143
|
+
.pl-file-tree__chevron .pl-icon {
|
|
144
|
+
display: block;
|
|
145
|
+
height: 1rem;
|
|
146
|
+
width: 1rem;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.pl-file-tree__icon-open,
|
|
150
|
+
.pl-file-tree__details[open] > .pl-file-tree__summary .pl-file-tree__icon-closed {
|
|
151
|
+
display: none;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.pl-file-tree__details[open] > .pl-file-tree__summary .pl-file-tree__icon-open {
|
|
155
|
+
display: inline-flex;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.pl-file-tree__icon[data-kind='directory'] {
|
|
159
|
+
color: color-mix(in oklab, var(--pl-accent, #4f46e5) 82%, var(--pl-text, #344054));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.pl-file-tree__icon[data-kind='code'] {
|
|
163
|
+
color: oklch(0.58 0.18 250);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.pl-file-tree__icon[data-kind='config'] {
|
|
167
|
+
color: oklch(0.56 0.14 155);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.pl-file-tree__icon[data-kind='style'] {
|
|
171
|
+
color: oklch(0.58 0.19 320);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.pl-file-tree__icon[data-kind='image'] {
|
|
175
|
+
color: oklch(0.58 0.16 80);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.pl-file-tree__name {
|
|
179
|
+
color: var(--pl-text, #344054);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.pl-file-tree__target--highlighted .pl-file-tree__name {
|
|
183
|
+
color: inherit;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.pl-file-tree__name code {
|
|
187
|
+
background: transparent;
|
|
188
|
+
border: 0;
|
|
189
|
+
border-radius: 0;
|
|
190
|
+
color: inherit;
|
|
191
|
+
font: inherit;
|
|
192
|
+
padding: 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.pl-file-tree__comment {
|
|
196
|
+
color: var(--pl-text-muted, #667085);
|
|
197
|
+
font-family:
|
|
198
|
+
var(--pl-font-sans, ui-sans-serif, system-ui, sans-serif);
|
|
199
|
+
font-size: 0.8125rem;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.pl-file-tree__comment :where(strong) {
|
|
203
|
+
color: var(--pl-text-strong, var(--pl-text, #182230));
|
|
204
|
+
font-weight: 600;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.pl-file-tree__comment :where(code) {
|
|
208
|
+
background: transparent;
|
|
209
|
+
border: 0;
|
|
210
|
+
color: inherit;
|
|
211
|
+
font: inherit;
|
|
212
|
+
padding: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.pl-file-tree__item--placeholder > .pl-file-tree__entry,
|
|
216
|
+
.pl-file-tree__item--placeholder .pl-file-tree__name {
|
|
217
|
+
color: var(--pl-text-muted, #667085);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.pl-file-tree__sr-only {
|
|
221
|
+
clip: rect(0, 0, 0, 0);
|
|
222
|
+
border: 0;
|
|
223
|
+
height: 1px;
|
|
224
|
+
margin: -1px;
|
|
225
|
+
overflow: hidden;
|
|
226
|
+
padding: 0;
|
|
227
|
+
position: absolute;
|
|
228
|
+
white-space: nowrap;
|
|
229
|
+
width: 1px;
|
|
230
|
+
}
|
|
231
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Icon from './Icon.astro';
|
|
3
|
+
import FileTreeItem from './FileTreeItem.astro';
|
|
4
|
+
import type { FileTreeEntry } from './rehype-file-tree';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
entry: FileTreeEntry;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { entry } = Astro.props;
|
|
11
|
+
const placeholderEntry: FileTreeEntry = {
|
|
12
|
+
children: [],
|
|
13
|
+
commentHtml: '',
|
|
14
|
+
highlighted: false,
|
|
15
|
+
isDirectory: false,
|
|
16
|
+
isPlaceholder: true,
|
|
17
|
+
kind: 'file',
|
|
18
|
+
nameHtml: '…',
|
|
19
|
+
nameText: '…',
|
|
20
|
+
};
|
|
21
|
+
const children = entry.children.length > 0 ? entry.children : [placeholderEntry];
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<li
|
|
25
|
+
class:list={[
|
|
26
|
+
'pl-file-tree__item',
|
|
27
|
+
entry.isDirectory ? 'pl-file-tree__item--directory' : 'pl-file-tree__item--file',
|
|
28
|
+
entry.isPlaceholder && 'pl-file-tree__item--placeholder',
|
|
29
|
+
entry.highlighted && 'pl-file-tree__item--highlighted',
|
|
30
|
+
]}
|
|
31
|
+
>
|
|
32
|
+
{
|
|
33
|
+
entry.isDirectory ? (
|
|
34
|
+
<details class="pl-file-tree__details" open={entry.children.length > 0 ? true : undefined}>
|
|
35
|
+
<summary class="pl-file-tree__summary">
|
|
36
|
+
<span class="pl-file-tree__entry">
|
|
37
|
+
{!entry.isPlaceholder && (
|
|
38
|
+
<span aria-hidden="true" class="pl-file-tree__chevron">
|
|
39
|
+
<Icon name="lucide:chevron-right" />
|
|
40
|
+
</span>
|
|
41
|
+
)}
|
|
42
|
+
<span
|
|
43
|
+
class:list={[
|
|
44
|
+
'pl-file-tree__target',
|
|
45
|
+
entry.highlighted && 'pl-file-tree__target--highlighted',
|
|
46
|
+
]}
|
|
47
|
+
>
|
|
48
|
+
{!entry.isPlaceholder && (
|
|
49
|
+
<span aria-hidden="true" class="pl-file-tree__icon" data-kind={entry.kind}>
|
|
50
|
+
<span class="pl-file-tree__icon-closed">
|
|
51
|
+
<Icon name="lucide:folder" />
|
|
52
|
+
</span>
|
|
53
|
+
<span class="pl-file-tree__icon-open">
|
|
54
|
+
<Icon name="lucide:folder-open" />
|
|
55
|
+
</span>
|
|
56
|
+
</span>
|
|
57
|
+
)}
|
|
58
|
+
<span class="pl-file-tree__name">
|
|
59
|
+
{!entry.isPlaceholder && <span class="pl-file-tree__sr-only">Directory </span>}
|
|
60
|
+
<Fragment set:html={entry.nameHtml} />
|
|
61
|
+
</span>
|
|
62
|
+
</span>
|
|
63
|
+
{
|
|
64
|
+
entry.commentHtml && (
|
|
65
|
+
<span class="pl-file-tree__comment" set:html={entry.commentHtml} />
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
</span>
|
|
69
|
+
</summary>
|
|
70
|
+
<ul class="pl-file-tree__list" role="list">
|
|
71
|
+
{children.map((child) => <FileTreeItem entry={child} />)}
|
|
72
|
+
</ul>
|
|
73
|
+
</details>
|
|
74
|
+
) : (
|
|
75
|
+
<span class="pl-file-tree__entry">
|
|
76
|
+
<span
|
|
77
|
+
class:list={[
|
|
78
|
+
'pl-file-tree__target',
|
|
79
|
+
entry.highlighted && 'pl-file-tree__target--highlighted',
|
|
80
|
+
]}
|
|
81
|
+
>
|
|
82
|
+
{!entry.isPlaceholder && (
|
|
83
|
+
<span aria-hidden="true" class="pl-file-tree__icon" data-kind={entry.kind}>
|
|
84
|
+
<Icon name="lucide:file" />
|
|
85
|
+
</span>
|
|
86
|
+
)}
|
|
87
|
+
<span class="pl-file-tree__name" set:html={entry.nameHtml} />
|
|
88
|
+
</span>
|
|
89
|
+
{
|
|
90
|
+
entry.commentHtml && (
|
|
91
|
+
<span class="pl-file-tree__comment" set:html={entry.commentHtml} />
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
</span>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
</li>
|