bearminion 1.7.0 → 1.9.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/CHANGELOG.md +20 -0
- package/dist/astro.d.ts +2 -2
- package/dist/astro.js +17 -5
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +819 -0
- package/dist/content.d.ts +1 -1
- package/dist/content.js +2 -2
- package/dist/hash-BeBymBO1.js +59 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/marks-DPBilumg.js +174 -0
- package/dist/marks.js +1 -174
- package/dist/{options-BeJQnsZM.d.ts → options-4HWVEj9O.d.ts} +7 -1
- package/dist/{page-BfI9cD8g.d.ts → page-CA4iyFDS.d.ts} +7 -7
- package/dist/{page-NOFVEqn1.js → page-X-WnOu7-.js} +1 -1
- package/dist/{preview--S1QUrMM.js → preview-B_88I5Jm.js} +1 -1
- package/dist/{reload-BPkPoQ-P.js → reload-Dkp3xC0l.js} +1 -1
- package/dist/rich-text-70hddxMC.js +403 -0
- package/dist/rich-text.js +1 -403
- package/dist/sections-manifest-CO9QfJPG.js +97 -0
- package/dist/{theme-DFjHjgFO.js → theme-Dv7_7B56.js} +2 -2
- package/dist/ui/mount.js +20 -7
- package/package.json +7 -1
- package/registry/default/files/src/components/atoms/Button.astro +64 -0
- package/registry/default/files/src/components/atoms/Emphasis.astro +24 -0
- package/registry/default/files/src/components/atoms/Image.astro +78 -0
- package/registry/default/files/src/components/atoms/Typography.astro +53 -0
- package/registry/default/files/src/components/atoms/button.ts +31 -0
- package/registry/default/files/src/components/atoms/image.ts +34 -0
- package/registry/default/files/src/components/atoms/options.ts +39 -0
- package/registry/default/files/src/components/atoms/typography.ts +64 -0
- package/registry/default/files/src/components/molecules/CommandLine.astro +109 -0
- package/registry/default/files/src/components/molecules/MediaFrame.astro +71 -0
- package/registry/default/files/src/components/molecules/Pill.astro +24 -0
- package/registry/default/files/src/components/molecules/SectionHeader.astro +63 -0
- package/registry/default/files/src/components/molecules/SectionShell.astro +33 -0
- package/registry/default/files/src/components/sections/contact/Contact.astro +231 -0
- package/registry/default/files/src/components/sections/contact/definition.ts +52 -0
- package/registry/default/files/src/components/sections/contact/form.ts +313 -0
- package/registry/default/files/src/components/sections/contact/wireframe.ts +15 -0
- package/registry/default/files/src/components/sections/cta/Cta.astro +206 -0
- package/registry/default/files/src/components/sections/cta/definition.ts +49 -0
- package/registry/default/files/src/components/sections/cta/wireframe.ts +9 -0
- package/registry/default/files/src/components/sections/faq/Faq.astro +136 -0
- package/registry/default/files/src/components/sections/faq/definition.ts +54 -0
- package/registry/default/files/src/components/sections/faq/wireframe.ts +19 -0
- package/registry/default/files/src/components/sections/features/Features.astro +146 -0
- package/registry/default/files/src/components/sections/features/definition.ts +54 -0
- package/registry/default/files/src/components/sections/features/wireframe.ts +19 -0
- package/registry/default/files/src/components/sections/gallery/Gallery.astro +128 -0
- package/registry/default/files/src/components/sections/gallery/definition.ts +59 -0
- package/registry/default/files/src/components/sections/gallery/lightbox.ts +159 -0
- package/registry/default/files/src/components/sections/gallery/wireframe.ts +12 -0
- package/registry/default/files/src/components/sections/hero/Hero.astro +185 -0
- package/registry/default/files/src/components/sections/hero/HeroBadge.astro +26 -0
- package/registry/default/files/src/components/sections/hero/definition.ts +74 -0
- package/registry/default/files/src/components/sections/hero/wireframe.ts +12 -0
- package/registry/default/files/src/components/sections/logo-strip/LogoStrip.astro +107 -0
- package/registry/default/files/src/components/sections/logo-strip/definition.ts +30 -0
- package/registry/default/files/src/components/sections/logo-strip/wireframe.ts +11 -0
- package/registry/default/files/src/components/sections/media/Media.astro +118 -0
- package/registry/default/files/src/components/sections/media/MediaPlayer.astro +176 -0
- package/registry/default/files/src/components/sections/media/definition.ts +77 -0
- package/registry/default/files/src/components/sections/media/source.ts +3 -0
- package/registry/default/files/src/components/sections/media/wireframe.ts +9 -0
- package/registry/default/files/src/components/sections/pricing/Pricing.astro +210 -0
- package/registry/default/files/src/components/sections/pricing/definition.ts +62 -0
- package/registry/default/files/src/components/sections/pricing/wireframe.ts +18 -0
- package/registry/default/files/src/components/sections/shared.ts +13 -0
- package/registry/default/files/src/components/sections/stats/Stats.astro +110 -0
- package/registry/default/files/src/components/sections/stats/definition.ts +41 -0
- package/registry/default/files/src/components/sections/stats/wireframe.ts +15 -0
- package/registry/default/files/src/components/sections/steps/Steps.astro +139 -0
- package/registry/default/files/src/components/sections/steps/definition.ts +62 -0
- package/registry/default/files/src/components/sections/steps/icons.ts +27 -0
- package/registry/default/files/src/components/sections/steps/wireframe.ts +16 -0
- package/registry/default/files/src/components/sections/testimonials/Testimonials.astro +172 -0
- package/registry/default/files/src/components/sections/testimonials/definition.ts +42 -0
- package/registry/default/files/src/components/sections/testimonials/wireframe.ts +21 -0
- package/registry/default/files/src/components/sections/text/Text.astro +43 -0
- package/registry/default/files/src/components/sections/text/definition.ts +36 -0
- package/registry/default/files/src/components/sections/text/wireframe.ts +12 -0
- package/registry/default/files/src/components/sections/text-image/TextImage.astro +107 -0
- package/registry/default/files/src/components/sections/text-image/definition.ts +39 -0
- package/registry/default/files/src/components/sections/text-image/wireframe.ts +12 -0
- package/registry/default/files/src/lib/assets.ts +13 -0
- package/registry/default/files/src/lib/cn.ts +6 -0
- package/registry/default/files/src/lib/contact-form.ts +97 -0
- package/registry/default/files/src/lib/hidden-text.ts +32 -0
- package/registry/default/files/src/lib/image-url.ts +38 -0
- package/registry/default/files/src/lib/link-attrs.ts +74 -0
- package/registry/default/registry.json +670 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Image as AssetImage } from 'astro:assets'
|
|
3
|
+
import { isRemote, resolveLocalAsset } from '../../lib/assets'
|
|
4
|
+
import { cn } from '../../lib/cn'
|
|
5
|
+
import { image, type ImageVariants } from './image'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
src: string
|
|
9
|
+
alt: string
|
|
10
|
+
aspect?: NonNullable<ImageVariants['aspect']>
|
|
11
|
+
fit?: NonNullable<ImageVariants['fit']>
|
|
12
|
+
/** CSS object-position keywords, for example `top left`. Omitted means center. */
|
|
13
|
+
position?: string
|
|
14
|
+
rounded?: NonNullable<ImageVariants['rounded']>
|
|
15
|
+
loading?: 'eager' | 'lazy'
|
|
16
|
+
priority?: boolean
|
|
17
|
+
sizes?: string
|
|
18
|
+
widths?: number[]
|
|
19
|
+
class?: string
|
|
20
|
+
'data-field'?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
src,
|
|
25
|
+
alt,
|
|
26
|
+
aspect,
|
|
27
|
+
fit,
|
|
28
|
+
position,
|
|
29
|
+
rounded,
|
|
30
|
+
loading = 'lazy',
|
|
31
|
+
priority = false,
|
|
32
|
+
sizes = '(min-width: 1024px) 40vw, 100vw',
|
|
33
|
+
widths = [480, 800, 1200],
|
|
34
|
+
class: className,
|
|
35
|
+
'data-field': dataField,
|
|
36
|
+
} = Astro.props
|
|
37
|
+
|
|
38
|
+
const remote = isRemote(src)
|
|
39
|
+
const asset = remote ? undefined : resolveLocalAsset(src)
|
|
40
|
+
const looksLocal = src.replace(/^\//, '').startsWith('src/assets/')
|
|
41
|
+
let devSrc: string | undefined
|
|
42
|
+
if (import.meta.env.DEV && looksLocal && !asset) {
|
|
43
|
+
devSrc = `/__bearminion/assets?src=${encodeURIComponent(src.replace(/^\//, ''))}`
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (looksLocal && !asset && !devSrc) {
|
|
47
|
+
throw new Error(`No file in src/assets for image path "${src}". Restore the file, or choose another image in the editor and save.`)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const classes = cn(image({ aspect, fit, rounded }), className)
|
|
51
|
+
const style = position ? `object-position:${position}` : undefined
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
{
|
|
55
|
+
asset ? (
|
|
56
|
+
<AssetImage
|
|
57
|
+
src={asset}
|
|
58
|
+
alt={alt}
|
|
59
|
+
class={classes}
|
|
60
|
+
style={style}
|
|
61
|
+
widths={widths}
|
|
62
|
+
sizes={sizes}
|
|
63
|
+
loading={priority ? 'eager' : loading}
|
|
64
|
+
priority={priority}
|
|
65
|
+
data-field={dataField}
|
|
66
|
+
/>
|
|
67
|
+
) : (
|
|
68
|
+
<img
|
|
69
|
+
src={devSrc ?? src}
|
|
70
|
+
alt={alt}
|
|
71
|
+
class={classes}
|
|
72
|
+
style={style}
|
|
73
|
+
loading={priority ? 'eager' : loading}
|
|
74
|
+
fetchpriority={priority ? 'high' : undefined}
|
|
75
|
+
data-field={dataField}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { renderRichText } from 'bearminion/rich-text'
|
|
3
|
+
import { cn } from '../../lib/cn'
|
|
4
|
+
import { typography, type TypographyVariants } from './typography'
|
|
5
|
+
|
|
6
|
+
type TagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'blockquote' | 'div' | 'li' | 'figcaption'
|
|
7
|
+
|
|
8
|
+
const PHRASING_ONLY = new Set<string>(['p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
as?: TagName
|
|
12
|
+
size?: NonNullable<TypographyVariants['size']>
|
|
13
|
+
color?: NonNullable<TypographyVariants['color']>
|
|
14
|
+
weight?: NonNullable<TypographyVariants['weight']>
|
|
15
|
+
font?: NonNullable<TypographyVariants['font']>
|
|
16
|
+
align?: NonNullable<TypographyVariants['align']>
|
|
17
|
+
class?: string
|
|
18
|
+
id?: string
|
|
19
|
+
/** Markdown subset (bold, italic, links, lists, paragraphs). Renders sanitized HTML. */
|
|
20
|
+
markdown?: string
|
|
21
|
+
/** The markdown may hold `##` and `###` headings, and the editor offers them. */
|
|
22
|
+
richHeadings?: boolean
|
|
23
|
+
'data-field'?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
as: TagName = 'p',
|
|
28
|
+
size,
|
|
29
|
+
color,
|
|
30
|
+
weight,
|
|
31
|
+
font,
|
|
32
|
+
align,
|
|
33
|
+
class: className,
|
|
34
|
+
markdown,
|
|
35
|
+
richHeadings = false,
|
|
36
|
+
...rest
|
|
37
|
+
} = Astro.props
|
|
38
|
+
|
|
39
|
+
const html = markdown !== undefined ? renderRichText(markdown, { headings: richHeadings }) : undefined
|
|
40
|
+
// Rich text is `<p>`s and lists, which a `<p>`, `<span>` or heading cannot hold. A `blockquote`, `li` or `figcaption` can.
|
|
41
|
+
const Tag = html !== undefined && PHRASING_ONLY.has(TagName) ? 'div' : TagName
|
|
42
|
+
const classes = cn(typography({ size, color, weight, font, align }), className)
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
{
|
|
46
|
+
html !== undefined ? (
|
|
47
|
+
<Tag class={classes} data-field-kind="rich" data-rich-headings={richHeadings ? 'true' : undefined} set:html={html} {...rest} />
|
|
48
|
+
) : (
|
|
49
|
+
<TagName class={classes} {...rest}>
|
|
50
|
+
<slot />
|
|
51
|
+
</TagName>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
export const button = cva(
|
|
4
|
+
'inline-flex items-center justify-center gap-2 rounded-full font-medium transition-[filter,transform,box-shadow,background-color,color] duration-200',
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
primary: 'bg-accent text-on hover:brightness-[0.94]',
|
|
9
|
+
secondary: 'bg-transparent text-fg shadow-[inset_0_0_0_1px_var(--line)] hover:shadow-[inset_0_0_0_1px_var(--fg)]',
|
|
10
|
+
strong: 'bg-fg text-bg hover:-translate-y-px',
|
|
11
|
+
ghost: 'bg-transparent text-fg hover:bg-line',
|
|
12
|
+
text: 'h-auto rounded-none bg-transparent p-0 text-[0.9375rem] text-link underline-offset-4 hover:underline',
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
sm: 'h-10 px-4 text-[0.9375rem]',
|
|
16
|
+
md: 'h-12 px-[1.375rem] text-[0.9375rem]',
|
|
17
|
+
lg: 'h-[3.25rem] px-6 text-[0.9375rem]',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
compoundVariants: [
|
|
21
|
+
{ variant: 'text', class: 'h-auto px-0' },
|
|
22
|
+
{ variant: 'ghost', class: 'px-4' },
|
|
23
|
+
],
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
variant: 'primary',
|
|
26
|
+
size: 'md',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
export type ButtonVariants = VariantProps<typeof button>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
export const image = cva('max-w-full', {
|
|
4
|
+
variants: {
|
|
5
|
+
aspect: {
|
|
6
|
+
auto: '',
|
|
7
|
+
square: 'aspect-square',
|
|
8
|
+
video: 'aspect-video',
|
|
9
|
+
'4/3': 'aspect-[4/3]',
|
|
10
|
+
'4/5': 'aspect-[4/5]',
|
|
11
|
+
'3/2': 'aspect-[3/2]',
|
|
12
|
+
},
|
|
13
|
+
fit: {
|
|
14
|
+
cover: 'object-cover',
|
|
15
|
+
contain: 'object-contain',
|
|
16
|
+
},
|
|
17
|
+
rounded: {
|
|
18
|
+
none: 'rounded-none',
|
|
19
|
+
md: 'rounded-md',
|
|
20
|
+
lg: 'rounded-lg',
|
|
21
|
+
xl: 'rounded-xl',
|
|
22
|
+
'2xl': 'rounded-2xl',
|
|
23
|
+
'3xl': 'rounded-[2rem]',
|
|
24
|
+
full: 'rounded-full',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
aspect: 'auto',
|
|
29
|
+
fit: 'cover',
|
|
30
|
+
rounded: 'none',
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export type ImageVariants = VariantProps<typeof image>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Option } from 'bearminion'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This theme's atom vocabulary: button roles and sizes, typography sizes and colors. Storybook controls read it.
|
|
5
|
+
* It belongs to the theme, not to bearminion: section JSON never stores these, the section components pick them.
|
|
6
|
+
*/
|
|
7
|
+
export const buttonVariants = ['primary', 'secondary', 'strong', 'ghost', 'text'] as const
|
|
8
|
+
export const buttonSizes = ['sm', 'md', 'lg'] as const
|
|
9
|
+
export type ButtonVariant = (typeof buttonVariants)[number]
|
|
10
|
+
export type ButtonSize = (typeof buttonSizes)[number]
|
|
11
|
+
|
|
12
|
+
export const typographySizes = [
|
|
13
|
+
'display',
|
|
14
|
+
'display-center',
|
|
15
|
+
'display-editorial',
|
|
16
|
+
'h2',
|
|
17
|
+
'h2-lg',
|
|
18
|
+
'h3',
|
|
19
|
+
'lead',
|
|
20
|
+
'body',
|
|
21
|
+
'small',
|
|
22
|
+
'meta',
|
|
23
|
+
'eyebrow',
|
|
24
|
+
'mono',
|
|
25
|
+
'stat',
|
|
26
|
+
] as const
|
|
27
|
+
export const typographyColors = ['default', 'muted', 'accent', 'link', 'on'] as const
|
|
28
|
+
|
|
29
|
+
export const atomOptions = {
|
|
30
|
+
button: [
|
|
31
|
+
{ name: 'variant', label: 'Variant', type: 'enum', choices: buttonVariants, default: 'primary' },
|
|
32
|
+
{ name: 'size', label: 'Size', type: 'enum', choices: buttonSizes, default: 'md' },
|
|
33
|
+
{ name: 'arrow', label: 'Arrow', type: 'boolean', default: false },
|
|
34
|
+
],
|
|
35
|
+
typography: [
|
|
36
|
+
{ name: 'size', label: 'Size', type: 'enum', choices: typographySizes, default: 'body' },
|
|
37
|
+
{ name: 'color', label: 'Color', type: 'enum', choices: typographyColors, default: 'default' },
|
|
38
|
+
],
|
|
39
|
+
} as const satisfies Record<string, readonly Option[]>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
export const typography = cva('text-balance', {
|
|
4
|
+
variants: {
|
|
5
|
+
size: {
|
|
6
|
+
xs: 'text-xs',
|
|
7
|
+
sm: 'text-sm',
|
|
8
|
+
md: 'text-base',
|
|
9
|
+
lg: 'text-lg',
|
|
10
|
+
xl: 'text-xl',
|
|
11
|
+
'2xl': 'text-2xl',
|
|
12
|
+
'3xl': 'text-3xl',
|
|
13
|
+
'4xl': 'text-4xl',
|
|
14
|
+
'5xl': 'text-5xl',
|
|
15
|
+
'6xl': 'text-6xl',
|
|
16
|
+
display: 'font-sans text-[clamp(2.75rem,1.4rem+5.6cqi,5.75rem)] leading-[0.95] font-semibold tracking-[-0.045em]',
|
|
17
|
+
'display-center':
|
|
18
|
+
'mx-auto max-w-[16ch] font-sans text-[clamp(2.75rem,1.2rem+6.6cqi,7rem)] leading-[0.93] font-semibold tracking-[-0.05em]',
|
|
19
|
+
'display-editorial': 'font-sans text-[clamp(3.25rem,0.5rem+11cqi,10.5rem)] leading-[0.86] font-semibold tracking-[-0.06em]',
|
|
20
|
+
h2: 'font-sans text-[clamp(2rem,1.2rem+3.4cqi,3.75rem)] leading-none font-semibold tracking-[-0.04em]',
|
|
21
|
+
'h2-md': 'font-sans text-[clamp(2.25rem,1.3rem+3.6cqi,4rem)] leading-[0.98] font-semibold tracking-[-0.045em]',
|
|
22
|
+
'h2-lg': 'font-sans text-[clamp(2.25rem,1.2rem+4.4cqi,4.75rem)] leading-[0.95] font-semibold tracking-[-0.05em]',
|
|
23
|
+
h3: 'font-sans text-[1.25rem] leading-[1.25] font-semibold tracking-[-0.02em]',
|
|
24
|
+
lead: 'text-pretty font-sans text-[clamp(1.0625rem,1rem+0.35cqi,1.25rem)] leading-[1.55]',
|
|
25
|
+
body: 'text-pretty font-sans text-[0.9375rem] leading-[1.6]',
|
|
26
|
+
small: 'font-sans text-[0.875rem] leading-[1.5]',
|
|
27
|
+
meta: 'font-sans text-[0.8125rem] leading-[1.5]',
|
|
28
|
+
eyebrow: 'font-mono text-[0.75rem] tracking-[0.08em] uppercase',
|
|
29
|
+
mono: 'font-mono text-[0.75rem] tracking-[0.04em]',
|
|
30
|
+
stat: 'font-sans text-[clamp(3rem,2rem+4cqi,5.5rem)] leading-[0.9] font-semibold tracking-[-0.05em]',
|
|
31
|
+
},
|
|
32
|
+
color: {
|
|
33
|
+
default: 'text-fg',
|
|
34
|
+
muted: 'text-muted',
|
|
35
|
+
accent: 'text-accent',
|
|
36
|
+
link: 'text-link',
|
|
37
|
+
on: 'text-on',
|
|
38
|
+
},
|
|
39
|
+
weight: {
|
|
40
|
+
regular: 'font-normal',
|
|
41
|
+
medium: 'font-medium',
|
|
42
|
+
semibold: 'font-semibold',
|
|
43
|
+
bold: 'font-bold',
|
|
44
|
+
},
|
|
45
|
+
font: {
|
|
46
|
+
sans: 'font-sans',
|
|
47
|
+
serif: 'font-serif',
|
|
48
|
+
mono: 'font-mono',
|
|
49
|
+
},
|
|
50
|
+
align: {
|
|
51
|
+
left: 'text-left',
|
|
52
|
+
center: 'text-center',
|
|
53
|
+
right: 'text-right',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
// No default weight or font: the size already sets them (headings are semibold, eyebrows mono), and a default here
|
|
57
|
+
// would be merged in after the size and override it.
|
|
58
|
+
defaultVariants: {
|
|
59
|
+
size: 'body',
|
|
60
|
+
color: 'default',
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
export type TypographyVariants = VariantProps<typeof typography>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from '../../lib/cn'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
/** The shell command, such as `npm create bearminion@latest`. */
|
|
6
|
+
command: string
|
|
7
|
+
/**
|
|
8
|
+
* `chip`: a small pill. `action`: a pill as tall as a button, for a button row. `terminal`: a dark block with a
|
|
9
|
+
* "Terminal" bar, the same in every tone.
|
|
10
|
+
*/
|
|
11
|
+
variant?: 'chip' | 'action' | 'terminal'
|
|
12
|
+
class?: string
|
|
13
|
+
'data-field'?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { command, variant = 'chip', class: className, 'data-field': dataField } = Astro.props
|
|
17
|
+
const copyIcon = 'M8 8h11v11H8zM5 16V5h11'
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
{
|
|
21
|
+
variant === 'terminal' ? (
|
|
22
|
+
<div
|
|
23
|
+
class={cn(
|
|
24
|
+
'w-full max-w-[30rem] overflow-hidden rounded-2xl bg-[oklch(0.17_0.012_255)] text-left text-[oklch(0.93_0.004_250)] shadow-[0_0_0_1px_oklch(0.97_0.004_250/0.08),0_32px_64px_-40px_oklch(0.15_0.02_255/0.6)]',
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
data-command-line
|
|
28
|
+
>
|
|
29
|
+
<div class="flex items-center justify-between border-b border-[oklch(0.97_0.004_250/0.08)] py-2 ps-4 pe-2">
|
|
30
|
+
<span class="font-mono text-[0.6875rem] tracking-[0.08em] text-[oklch(0.93_0.004_250/0.55)] uppercase">Terminal</span>
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
class="h-[1.875rem] rounded-full bg-[oklch(0.97_0.004_250/0.08)] px-3 text-[0.75rem] font-medium transition-colors hover:bg-[oklch(0.97_0.004_250/0.14)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent"
|
|
34
|
+
aria-label="Copy command"
|
|
35
|
+
data-copy-command
|
|
36
|
+
>
|
|
37
|
+
<span data-copy-label>Copy</span>
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="flex gap-3 overflow-x-auto p-4 font-mono text-[0.8125rem] leading-[1.6] whitespace-pre">
|
|
41
|
+
<span class="text-[oklch(0.87_0.2_145)] select-none" aria-hidden="true">$</span>
|
|
42
|
+
<code data-command data-field={dataField}>{command}</code>
|
|
43
|
+
</div>
|
|
44
|
+
<span class="sr-only" role="status" data-copy-status />
|
|
45
|
+
</div>
|
|
46
|
+
) : (
|
|
47
|
+
<div
|
|
48
|
+
class={cn(
|
|
49
|
+
'inline-flex max-w-full items-center rounded-full bg-surface font-mono text-fg ring-line',
|
|
50
|
+
variant === 'action' ? 'h-12 gap-3.5 ps-[1.125rem] pe-1.5 text-[0.875rem]' : 'h-11 gap-3 ps-4 pe-1.5 text-[0.8125rem]',
|
|
51
|
+
className,
|
|
52
|
+
)}
|
|
53
|
+
data-command-line
|
|
54
|
+
>
|
|
55
|
+
<span class="text-muted select-none" aria-hidden="true">$</span>
|
|
56
|
+
<code class="min-w-0 truncate" data-command data-field={dataField}>{command}</code>
|
|
57
|
+
<button
|
|
58
|
+
type="button"
|
|
59
|
+
class={cn(
|
|
60
|
+
'inline-flex shrink-0 items-center gap-1.5 rounded-full bg-fg font-sans font-medium text-bg transition-opacity hover:opacity-85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent',
|
|
61
|
+
variant === 'action' ? 'h-9 px-3.5 text-[0.8125rem]' : 'h-8 px-3 text-[0.75rem]',
|
|
62
|
+
)}
|
|
63
|
+
aria-label="Copy command"
|
|
64
|
+
data-copy-command
|
|
65
|
+
>
|
|
66
|
+
{variant === 'action' && (
|
|
67
|
+
<svg viewBox="0 0 24 24" class="size-[13px]" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true">
|
|
68
|
+
<path d={copyIcon} />
|
|
69
|
+
</svg>
|
|
70
|
+
)}
|
|
71
|
+
<span data-copy-label>Copy</span>
|
|
72
|
+
</button>
|
|
73
|
+
<span class="sr-only" role="status" data-copy-status />
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
<script>
|
|
79
|
+
/** Copies the command as it is on the page now, so an edit in the editor is what gets copied. */
|
|
80
|
+
function bindCommandLines() {
|
|
81
|
+
for (const button of document.querySelectorAll<HTMLButtonElement>('[data-copy-command]')) {
|
|
82
|
+
if (button.dataset.bound === 'true') continue
|
|
83
|
+
button.dataset.bound = 'true'
|
|
84
|
+
const line = button.closest('[data-command-line]')
|
|
85
|
+
const label = button.querySelector('[data-copy-label]')
|
|
86
|
+
const status = line?.querySelector('[data-copy-status]')
|
|
87
|
+
button.addEventListener('click', async () => {
|
|
88
|
+
const code = line?.querySelector('[data-command]')
|
|
89
|
+
const command = code?.textContent?.trim() ?? ''
|
|
90
|
+
if (!command) return
|
|
91
|
+
try {
|
|
92
|
+
await navigator.clipboard.writeText(command)
|
|
93
|
+
} catch {
|
|
94
|
+
// No clipboard access (an insecure origin, or the permission was refused): select the text instead.
|
|
95
|
+
if (code) window.getSelection()?.selectAllChildren(code)
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
if (label) label.textContent = 'Copied'
|
|
99
|
+
if (status) status.textContent = 'Command copied'
|
|
100
|
+
window.setTimeout(() => {
|
|
101
|
+
if (label) label.textContent = 'Copy'
|
|
102
|
+
if (status) status.textContent = ''
|
|
103
|
+
}, 1600)
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
bindCommandLines()
|
|
108
|
+
document.addEventListener('bearminion:preview', bindCommandLines)
|
|
109
|
+
</script>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Image from '../atoms/Image.astro'
|
|
3
|
+
import { isRemote, resolveLocalAsset } from '../../lib/assets'
|
|
4
|
+
import { cn } from '../../lib/cn'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
src?: string
|
|
8
|
+
alt: string
|
|
9
|
+
aspectClass: string
|
|
10
|
+
/** `auto` lets the image keep its own aspect ratio. It needs an `aspect-*` class on the frame to replace, otherwise it falls back to `contain`. */
|
|
11
|
+
fit?: 'cover' | 'contain' | 'auto'
|
|
12
|
+
position?: string
|
|
13
|
+
roundedClass?: string
|
|
14
|
+
class?: string
|
|
15
|
+
priority?: boolean
|
|
16
|
+
'data-field'?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
src,
|
|
21
|
+
alt,
|
|
22
|
+
aspectClass,
|
|
23
|
+
fit = 'cover',
|
|
24
|
+
position,
|
|
25
|
+
roundedClass = 'rounded-card-lg',
|
|
26
|
+
class: className,
|
|
27
|
+
priority = false,
|
|
28
|
+
'data-field': dataField,
|
|
29
|
+
} = Astro.props
|
|
30
|
+
|
|
31
|
+
const looksLocal = Boolean(src && src.replace(/^\//, '').startsWith('src/assets/'))
|
|
32
|
+
const asset = src && !isRemote(src) ? resolveLocalAsset(src) : undefined
|
|
33
|
+
let devSrc: string | undefined
|
|
34
|
+
if (import.meta.env.DEV && looksLocal && !asset && src) {
|
|
35
|
+
devSrc = `/__bearminion/assets?src=${encodeURIComponent(src.replace(/^\//, ''))}`
|
|
36
|
+
}
|
|
37
|
+
if (looksLocal && !asset && !devSrc) {
|
|
38
|
+
throw new Error(`No file in src/assets for image path "${src}". Restore the file, or choose another image in the editor and save.`)
|
|
39
|
+
}
|
|
40
|
+
const showImage = Boolean(src && src !== 'placeholder' && (isRemote(src) || asset || devSrc))
|
|
41
|
+
// Natural size: drop the forced ratio (and its min height) so the frame wraps the image.
|
|
42
|
+
const natural = fit === 'auto' && showImage && /(^|\s)aspect-/.test(aspectClass)
|
|
43
|
+
const frameClass = natural ? aspectClass.split(/\s+/).filter((token) => !/^(aspect-|min-h-)/.test(token)).join(' ') : aspectClass
|
|
44
|
+
const objectFit = fit === 'auto' ? 'contain' : fit
|
|
45
|
+
// `data-field` goes on the frame, not the <img>: the frame is the image slot, so hovering or clicking anywhere on it
|
|
46
|
+
// (image, padding or placeholder stripes) edits the image.
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
<div
|
|
50
|
+
class={cn('relative flex items-end overflow-hidden p-4', !showImage && 'placeholder-stripes', frameClass, natural && 'p-0', roundedClass, className)}
|
|
51
|
+
data-field={dataField}
|
|
52
|
+
>
|
|
53
|
+
{
|
|
54
|
+
showImage && src ? (
|
|
55
|
+
<Image
|
|
56
|
+
src={src}
|
|
57
|
+
alt={alt}
|
|
58
|
+
fit={objectFit}
|
|
59
|
+
position={position}
|
|
60
|
+
rounded="none"
|
|
61
|
+
priority={priority}
|
|
62
|
+
class={natural ? 'block h-auto w-full' : 'absolute inset-0 size-full'}
|
|
63
|
+
sizes="(min-width: 1024px) 50vw, 100vw"
|
|
64
|
+
/>
|
|
65
|
+
) : (
|
|
66
|
+
<span class="font-mono text-[0.6875rem] tracking-[0.04em] text-muted">
|
|
67
|
+
{alt}
|
|
68
|
+
</span>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from '../../lib/cn'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string
|
|
6
|
+
'data-field'?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className, 'data-field': dataField } = Astro.props
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<span
|
|
13
|
+
class={cn(
|
|
14
|
+
'inline-flex items-center gap-2 rounded-full py-1.5 pr-3 pl-2.5 font-mono text-[0.75rem] tracking-[0.04em] text-muted ring-line',
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
data-field={dataField}
|
|
18
|
+
>
|
|
19
|
+
<span
|
|
20
|
+
class="size-2 rounded-full bg-accent shadow-[0_0_0_3px_color-mix(in_oklch,var(--accent)_30%,transparent)]"
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
></span>
|
|
23
|
+
<slot />
|
|
24
|
+
</span>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { TextMark } from 'bearminion/marks'
|
|
3
|
+
import Emphasis from '../atoms/Emphasis.astro'
|
|
4
|
+
import Typography from '../atoms/Typography.astro'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
eyebrow?: string
|
|
8
|
+
heading?: string
|
|
9
|
+
marks?: TextMark[]
|
|
10
|
+
em?: string
|
|
11
|
+
intro?: string
|
|
12
|
+
align?: 'left' | 'center'
|
|
13
|
+
headingAs?: 'h1' | 'h2'
|
|
14
|
+
size?: 'h2' | 'h2-md' | 'h2-lg' | 'display' | 'display-center' | 'display-editorial'
|
|
15
|
+
field?: (path: string) => string
|
|
16
|
+
/** Prop name used for the intro `data-field` path. */
|
|
17
|
+
introField?: string
|
|
18
|
+
headingClass?: string
|
|
19
|
+
class?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
eyebrow,
|
|
24
|
+
heading,
|
|
25
|
+
marks,
|
|
26
|
+
em,
|
|
27
|
+
intro,
|
|
28
|
+
align = 'left',
|
|
29
|
+
headingAs = 'h2',
|
|
30
|
+
size = 'h2',
|
|
31
|
+
field = (path: string) => path,
|
|
32
|
+
introField = 'intro',
|
|
33
|
+
headingClass,
|
|
34
|
+
class: className,
|
|
35
|
+
} = Astro.props
|
|
36
|
+
const hasContent = Boolean(eyebrow || heading || intro)
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
{
|
|
40
|
+
hasContent && (
|
|
41
|
+
<div class:list={['flex flex-col gap-4', align === 'center' && 'items-center text-center', className]}>
|
|
42
|
+
{
|
|
43
|
+
eyebrow && (
|
|
44
|
+
<Typography as="p" size="eyebrow" color="muted" data-field={field('eyebrow')}>
|
|
45
|
+
{eyebrow}
|
|
46
|
+
</Typography>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
{
|
|
50
|
+
heading && (
|
|
51
|
+
<Typography as={headingAs} size={size} align={align} class={headingClass}>
|
|
52
|
+
<Emphasis heading={heading} marks={marks} em={em} data-field={field('heading')} />
|
|
53
|
+
</Typography>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
{
|
|
57
|
+
intro && (
|
|
58
|
+
<Typography as="p" size="lead" color="muted" data-field={field(introField)} class="max-w-xl" markdown={intro} />
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { Tone } from 'bearminion'
|
|
3
|
+
import { cn } from '../../lib/cn'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
id: string
|
|
7
|
+
/** Optional page anchor. Rendered as the element id. `data-section-id` stays the section id. */
|
|
8
|
+
anchor?: string
|
|
9
|
+
type: string
|
|
10
|
+
variant: string
|
|
11
|
+
tone: Tone
|
|
12
|
+
motion: boolean
|
|
13
|
+
/** Logo strip reveals 16px; everything else 28px. */
|
|
14
|
+
reveal?: '16' | '28'
|
|
15
|
+
class?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { id, anchor, type, variant, tone, motion, reveal = '28', class: className } = Astro.props
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<section
|
|
22
|
+
id={anchor || undefined}
|
|
23
|
+
data-section-id={id}
|
|
24
|
+
data-section-type={type}
|
|
25
|
+
data-variant={variant}
|
|
26
|
+
data-tone={tone}
|
|
27
|
+
data-motion={motion ? 'true' : 'false'}
|
|
28
|
+
class={cn('relative overflow-clip', className)}
|
|
29
|
+
>
|
|
30
|
+
<div data-reveal={reveal}>
|
|
31
|
+
<slot />
|
|
32
|
+
</div>
|
|
33
|
+
</section>
|