@hanzo/ui 8.4.12 → 8.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/dist/backends/gui/band.cjs +46 -0
- package/dist/backends/gui/band.d.ts +43 -0
- package/dist/backends/gui/band.d.ts.map +1 -0
- package/dist/backends/gui/band.js +44 -0
- package/dist/backends/gui/band.js.map +1 -0
- package/dist/backends/gui/index.cjs +15 -6
- package/dist/backends/gui/index.d.ts +5 -3
- package/dist/backends/gui/index.d.ts.map +1 -1
- package/dist/backends/gui/index.js +5 -3
- package/dist/backends/gui/index.js.map +1 -1
- package/dist/backends/gui/layout.cjs +12 -2
- package/dist/backends/gui/layout.d.ts +1 -1
- package/dist/backends/gui/layout.d.ts.map +1 -1
- package/dist/backends/gui/layout.js +11 -2
- package/dist/backends/gui/layout.js.map +1 -1
- package/dist/backends/gui/link.cjs +126 -0
- package/dist/backends/gui/link.d.ts +65 -0
- package/dist/backends/gui/link.d.ts.map +1 -0
- package/dist/backends/gui/link.js +88 -0
- package/dist/backends/gui/link.js.map +1 -0
- package/dist/backends/gui/prose.cjs +33 -0
- package/dist/backends/gui/prose.d.ts +39 -0
- package/dist/backends/gui/prose.d.ts.map +1 -0
- package/dist/backends/gui/prose.js +30 -0
- package/dist/backends/gui/prose.js.map +1 -0
- package/dist/backends/gui/video.cjs +89 -0
- package/dist/backends/gui/video.d.ts +33 -0
- package/dist/backends/gui/video.d.ts.map +1 -0
- package/dist/backends/gui/video.js +53 -0
- package/dist/backends/gui/video.js.map +1 -0
- package/dist/blocks/accordian.cjs +19 -0
- package/dist/blocks/accordian.d.ts +4 -0
- package/dist/blocks/accordian.d.ts.map +1 -0
- package/dist/blocks/accordian.js +16 -0
- package/dist/blocks/accordian.js.map +1 -0
- package/dist/blocks/bullet-cards.cjs +40 -0
- package/dist/blocks/bullet-cards.d.ts +10 -0
- package/dist/blocks/bullet-cards.d.ts.map +1 -0
- package/dist/blocks/bullet-cards.js +37 -0
- package/dist/blocks/bullet-cards.js.map +1 -0
- package/dist/blocks/card.cjs +58 -0
- package/dist/blocks/card.d.ts +14 -0
- package/dist/blocks/card.d.ts.map +1 -0
- package/dist/blocks/card.js +55 -0
- package/dist/blocks/card.js.map +1 -0
- package/dist/blocks/carte-blanche.cjs +38 -0
- package/dist/blocks/carte-blanche.d.ts +13 -0
- package/dist/blocks/carte-blanche.d.ts.map +1 -0
- package/dist/blocks/carte-blanche.js +35 -0
- package/dist/blocks/carte-blanche.js.map +1 -0
- package/dist/blocks/content.cjs +65 -0
- package/dist/blocks/content.d.ts +11 -0
- package/dist/blocks/content.d.ts.map +1 -0
- package/dist/blocks/content.js +61 -0
- package/dist/blocks/content.js.map +1 -0
- package/dist/blocks/cta.cjs +103 -0
- package/dist/blocks/cta.d.ts +13 -0
- package/dist/blocks/cta.d.ts.map +1 -0
- package/dist/blocks/cta.js +67 -0
- package/dist/blocks/cta.js.map +1 -0
- package/dist/blocks/def.cjs +24 -0
- package/dist/blocks/def.d.ts +191 -0
- package/dist/blocks/def.d.ts.map +1 -0
- package/dist/blocks/def.js +22 -0
- package/dist/blocks/def.js.map +1 -0
- package/dist/blocks/enh-heading.cjs +86 -0
- package/dist/blocks/enh-heading.d.ts +7 -0
- package/dist/blocks/enh-heading.d.ts.map +1 -0
- package/dist/blocks/enh-heading.js +83 -0
- package/dist/blocks/enh-heading.js.map +1 -0
- package/dist/blocks/grid.cjs +98 -0
- package/dist/blocks/grid.d.ts +18 -0
- package/dist/blocks/grid.d.ts.map +1 -0
- package/dist/blocks/grid.js +62 -0
- package/dist/blocks/grid.js.map +1 -0
- package/dist/blocks/group.cjs +43 -0
- package/dist/blocks/group.d.ts +4 -0
- package/dist/blocks/group.d.ts.map +1 -0
- package/dist/blocks/group.js +40 -0
- package/dist/blocks/group.js.map +1 -0
- package/dist/blocks/heading.cjs +22 -0
- package/dist/blocks/heading.d.ts +4 -0
- package/dist/blocks/heading.d.ts.map +1 -0
- package/dist/blocks/heading.js +19 -0
- package/dist/blocks/heading.js.map +1 -0
- package/dist/blocks/image.cjs +54 -0
- package/dist/blocks/image.d.ts +19 -0
- package/dist/blocks/image.d.ts.map +1 -0
- package/dist/blocks/image.js +51 -0
- package/dist/blocks/image.js.map +1 -0
- package/dist/blocks/index.cjs +65 -0
- package/dist/blocks/index.d.ts +18 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +30 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/blocks/screenful.cjs +139 -0
- package/dist/blocks/screenful.d.ts +18 -0
- package/dist/blocks/screenful.d.ts.map +1 -0
- package/dist/blocks/screenful.js +103 -0
- package/dist/blocks/screenful.js.map +1 -0
- package/dist/blocks/space.cjs +38 -0
- package/dist/blocks/space.d.ts +4 -0
- package/dist/blocks/space.d.ts.map +1 -0
- package/dist/blocks/space.js +35 -0
- package/dist/blocks/space.js.map +1 -0
- package/dist/blocks/spec.cjs +58 -0
- package/dist/blocks/spec.d.ts +60 -0
- package/dist/blocks/spec.d.ts.map +1 -0
- package/dist/blocks/spec.js +52 -0
- package/dist/blocks/spec.js.map +1 -0
- package/dist/blocks/video.cjs +103 -0
- package/dist/blocks/video.d.ts +22 -0
- package/dist/blocks/video.d.ts.map +1 -0
- package/dist/blocks/video.js +67 -0
- package/dist/blocks/video.js.map +1 -0
- package/dist/gallery.cjs +1 -1
- package/dist/gallery.html +104 -7
- package/dist/gallery.js +2 -2
- package/dist/gallery.js.map +1 -1
- package/dist/index.cjs +12 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.node.js +2 -2
- package/dist/primitives/ApplyTypography.cjs +8 -0
- package/dist/primitives/ApplyTypography.d.ts +2 -0
- package/dist/primitives/ApplyTypography.d.ts.map +1 -0
- package/dist/primitives/ApplyTypography.js +5 -0
- package/dist/primitives/ApplyTypography.js.map +1 -0
- package/dist/primitives/{Section.cjs → Band.cjs} +3 -3
- package/dist/primitives/Band.d.ts +2 -0
- package/dist/primitives/Band.d.ts.map +1 -0
- package/dist/primitives/{Section.js → Band.js} +2 -2
- package/dist/primitives/Band.js.map +1 -0
- package/dist/primitives/Fill.cjs +8 -0
- package/dist/primitives/Fill.d.ts +2 -0
- package/dist/primitives/Fill.d.ts.map +1 -0
- package/dist/primitives/Fill.js +5 -0
- package/dist/primitives/Fill.js.map +1 -0
- package/dist/primitives/Link.cjs +8 -0
- package/dist/primitives/Link.d.ts +2 -0
- package/dist/primitives/Link.d.ts.map +1 -0
- package/dist/primitives/Link.js +5 -0
- package/dist/primitives/Link.js.map +1 -0
- package/dist/primitives/LinkElement.cjs +8 -0
- package/dist/primitives/LinkElement.d.ts +2 -0
- package/dist/primitives/LinkElement.d.ts.map +1 -0
- package/dist/primitives/LinkElement.js +5 -0
- package/dist/primitives/LinkElement.js.map +1 -0
- package/dist/primitives/MDXLink.cjs +8 -0
- package/dist/primitives/MDXLink.d.ts +2 -0
- package/dist/primitives/MDXLink.d.ts.map +1 -0
- package/dist/primitives/MDXLink.js +5 -0
- package/dist/primitives/MDXLink.js.map +1 -0
- package/dist/primitives/Screen.cjs +8 -0
- package/dist/primitives/Screen.d.ts +2 -0
- package/dist/primitives/Screen.d.ts.map +1 -0
- package/dist/primitives/Screen.js +5 -0
- package/dist/primitives/Screen.js.map +1 -0
- package/dist/primitives/Separator.cjs +2 -2
- package/dist/primitives/Separator.d.ts +1 -1
- package/dist/primitives/Separator.d.ts.map +1 -1
- package/dist/primitives/Separator.js +1 -1
- package/dist/primitives/Separator.js.map +1 -1
- package/dist/primitives/VideoPlayer.cjs +8 -0
- package/dist/primitives/VideoPlayer.d.ts +2 -0
- package/dist/primitives/VideoPlayer.d.ts.map +1 -0
- package/dist/primitives/VideoPlayer.js +5 -0
- package/dist/primitives/VideoPlayer.js.map +1 -0
- package/dist/primitives/YouTubeEmbed.cjs +8 -0
- package/dist/primitives/YouTubeEmbed.d.ts +2 -0
- package/dist/primitives/YouTubeEmbed.d.ts.map +1 -0
- package/dist/primitives/YouTubeEmbed.js +5 -0
- package/dist/primitives/YouTubeEmbed.js.map +1 -0
- package/dist/primitives/useLink.cjs +8 -0
- package/dist/primitives/useLink.d.ts +2 -0
- package/dist/primitives/useLink.d.ts.map +1 -0
- package/dist/primitives/useLink.js +5 -0
- package/dist/primitives/useLink.js.map +1 -0
- package/dist/product/menu/items.d.ts +1 -1
- package/dist/product/menu/items.d.ts.map +1 -1
- package/dist/styles.css +101 -4
- package/dist/theme.css +101 -0
- package/dist/tw.cjs +52 -1
- package/dist/tw.d.ts.map +1 -1
- package/dist/tw.js +52 -1
- package/dist/tw.js.map +1 -1
- package/dist/types.cjs +32 -0
- package/dist/types.d.ts +136 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +30 -0
- package/dist/types.js.map +1 -0
- package/package.json +29 -17
- package/dist/backends/gui/section.cjs +0 -39
- package/dist/backends/gui/section.d.ts +0 -29
- package/dist/backends/gui/section.d.ts.map +0 -1
- package/dist/backends/gui/section.js +0 -37
- package/dist/backends/gui/section.js.map +0 -1
- package/dist/backends/gui/separator.cjs +0 -10
- package/dist/backends/gui/separator.d.ts +0 -11
- package/dist/backends/gui/separator.d.ts.map +0 -1
- package/dist/backends/gui/separator.js +0 -8
- package/dist/backends/gui/separator.js.map +0 -1
- package/dist/primitives/Section.d.ts +0 -2
- package/dist/primitives/Section.d.ts.map +0 -1
- package/dist/primitives/Section.js.map +0 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Links.
|
|
5
|
+
*
|
|
6
|
+
* This package imports no framework — `next` is an optional peer and nothing in
|
|
7
|
+
* `src` reaches for it. But an internal link in a routed app has to go through
|
|
8
|
+
* that router, or every in-app navigation becomes a full page load. Both facts
|
|
9
|
+
* hold at once by letting the HOST name the component once:
|
|
10
|
+
*
|
|
11
|
+
* import Next from 'next/link'
|
|
12
|
+
* <Link value={Next}>{app}</Link>
|
|
13
|
+
*
|
|
14
|
+
* Everything below reads that value, so one line at the root fixes routing for
|
|
15
|
+
* every link the library renders. Unset, it is `'a'` — correct output, just
|
|
16
|
+
* without client-side navigation, which is also the right answer for a Vite or
|
|
17
|
+
* Tauri host that has no router to offer.
|
|
18
|
+
*
|
|
19
|
+
* The 5.x originals imported `next/link` directly, which is why they could only
|
|
20
|
+
* ever live in a `primitives/next/` folder that a non-Next host could not touch.
|
|
21
|
+
*/
|
|
22
|
+
import * as React from 'react';
|
|
23
|
+
import { cn } from '../../core/cn.js';
|
|
24
|
+
import { buttonVariants } from './button.js';
|
|
25
|
+
/**
|
|
26
|
+
* The component every link renders through. `<Link value={NextLink}>` at the
|
|
27
|
+
* root of a routed app; left alone it is a plain anchor.
|
|
28
|
+
*/
|
|
29
|
+
export const Link = /* @__PURE__ */ React.createContext('a');
|
|
30
|
+
export const useLink = () => React.useContext(Link);
|
|
31
|
+
/** True when the href leaves the app, and so must not go through a router. */
|
|
32
|
+
const external = (href) => /^(https?:|mailto:|tel:)/.test(href);
|
|
33
|
+
/**
|
|
34
|
+
* A link in authored content — the `a` an .mdx file produces.
|
|
35
|
+
*
|
|
36
|
+
* Internal hrefs go through the host's link so navigation stays client-side;
|
|
37
|
+
* anything external opens in a new tab, with `rel` set because `target=_blank`
|
|
38
|
+
* without it hands the opened page a live reference back to this one.
|
|
39
|
+
*/
|
|
40
|
+
export const MDXLink = ({ href, children, ...rest }) => {
|
|
41
|
+
const Comp = useLink();
|
|
42
|
+
if (href && href.startsWith('/')) {
|
|
43
|
+
return (_jsx(Comp, { href: href, ...rest, children: children }));
|
|
44
|
+
}
|
|
45
|
+
return (_jsx("a", { href: href, target: "_blank", rel: "noreferrer noopener", ...rest, children: children }));
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A link wearing a button's clothes, described by a {@link LinkDef}.
|
|
49
|
+
*
|
|
50
|
+
* Given children, they replace the whole label — `title`, `icon` and
|
|
51
|
+
* `iconAfter` are then ignored, since the caller has said what to render.
|
|
52
|
+
*/
|
|
53
|
+
export const LinkElement = ({ def,
|
|
54
|
+
// No defaults on anything that also appears in `def` — a default here would
|
|
55
|
+
// outrank the def it is supposed to fall back to.
|
|
56
|
+
onClick, size, variant, icon, iconAfter, className, style, children, }) => {
|
|
57
|
+
const Comp = useLink();
|
|
58
|
+
const { href, newTab, title } = def;
|
|
59
|
+
const nav = {};
|
|
60
|
+
if (external(href)) {
|
|
61
|
+
nav.rel = 'noreferrer noopener';
|
|
62
|
+
// An external link opens in a new tab unless the def says otherwise.
|
|
63
|
+
if (newTab ?? true)
|
|
64
|
+
nav.target = '_blank';
|
|
65
|
+
}
|
|
66
|
+
else if (newTab) {
|
|
67
|
+
nav.target = '_blank';
|
|
68
|
+
}
|
|
69
|
+
const label = () => {
|
|
70
|
+
if (React.Children.count(children) > 0)
|
|
71
|
+
return children;
|
|
72
|
+
// Props beat def fields beat defaults.
|
|
73
|
+
const mark = icon ?? def.icon;
|
|
74
|
+
const after = iconAfter ?? def.iconAfter ?? false;
|
|
75
|
+
// `title` is optional: an icon-only link is a legal one.
|
|
76
|
+
return (_jsxs(_Fragment, { children: [mark && !after && _jsx("span", { style: { paddingRight: 4 }, children: mark }), title && _jsx("span", { children: title }), mark && after && _jsx("span", { style: { paddingLeft: 4 }, children: mark })] }));
|
|
77
|
+
};
|
|
78
|
+
return (_jsx(Comp, { href: href, className: cn(buttonVariants({
|
|
79
|
+
variant: variant ?? def.variant ?? 'link',
|
|
80
|
+
size: size ?? def.size ?? 'default',
|
|
81
|
+
}), className),
|
|
82
|
+
// A def with no href and no handler is a LABEL, not a link. Written as a
|
|
83
|
+
// style rather than a utility class because this renders a bare `<a>` and
|
|
84
|
+
// nothing in the shipped stylesheet defines `pointer-events-none` — the
|
|
85
|
+
// class would have been three dead tokens and a clickable label.
|
|
86
|
+
style: href.length > 0 || onClick ? style : { ...style, pointerEvents: 'none' }, ...(onClick ? { onClick } : {}), ...nav, children: label() }));
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/backends/gui/link.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplyTypography = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const box_1 = require("../../box.cjs");
|
|
6
|
+
const cn_1 = require("../../core/cn.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Namespaced, and this family especially: `.prose` is what Tailwind's own
|
|
9
|
+
* typography plugin claims. A site part-way through leaving that engine would
|
|
10
|
+
* otherwise have two stylesheets fighting over the same selector, and which one
|
|
11
|
+
* won would depend on import order.
|
|
12
|
+
*/
|
|
13
|
+
const RUNG = {
|
|
14
|
+
responsive: 'hz-prose-responsive',
|
|
15
|
+
// `base` is the unmodified `.hz-prose` rung, so it adds nothing.
|
|
16
|
+
base: '',
|
|
17
|
+
sm: 'hz-prose-sm',
|
|
18
|
+
lg: 'hz-prose-lg',
|
|
19
|
+
xl: 'hz-prose-xl',
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Through `Box`, so a caller's layout classes are converted rather than
|
|
23
|
+
* emitted: `<ApplyTypography className="flex w-full">` used to put two dead
|
|
24
|
+
* tokens on the element, since nothing here defines them. `Box` with a `tag`
|
|
25
|
+
* renders that one element and nothing around it, so the `>` child selectors
|
|
26
|
+
* the prose rules depend on still reach the content.
|
|
27
|
+
*
|
|
28
|
+
* `hz-prose*` survives the conversion and stays on the element — it is real
|
|
29
|
+
* css in theme.css, which is exactly what `tw` leaves alone.
|
|
30
|
+
*/
|
|
31
|
+
const ApplyTypography = ({ children, className, asTag = 'div', size = 'responsive', ...rest }) => ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: asTag, className: (0, cn_1.cn)('hz-prose', RUNG[size], className), ...rest, children: children }));
|
|
32
|
+
exports.ApplyTypography = ApplyTypography;
|
|
33
|
+
exports.default = exports.ApplyTypography;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ApplyTypography — turn on running-text styling for a subtree.
|
|
3
|
+
*
|
|
4
|
+
* Authored content (a CMS field, an .mdx file, a block's `content`) arrives as
|
|
5
|
+
* bare tags: `<h1>`, `<p>`, `<ul>`. Nothing inside it can carry a class, so the
|
|
6
|
+
* styling has to come from an ancestor and reach down by TAG. That is what this
|
|
7
|
+
* does, and it is the reason it exists rather than each block styling its own
|
|
8
|
+
* heading.
|
|
9
|
+
*
|
|
10
|
+
* The rules live in `theme.css` under `.prose`; this component only chooses
|
|
11
|
+
* which rung and which element. It is a plain host element on purpose — the
|
|
12
|
+
* rules select `>` children, and a gui `styled()` frame would insert one.
|
|
13
|
+
*
|
|
14
|
+
* `size` is 'responsive' by default and is the only rung that moves with the
|
|
15
|
+
* viewport. A t-shirt size is a decision the caller already made, so it stays
|
|
16
|
+
* put — asking for 'sm' and getting 'lg' on a wide screen would make the prop a
|
|
17
|
+
* suggestion.
|
|
18
|
+
*/
|
|
19
|
+
import * as React from 'react';
|
|
20
|
+
export type TypographySize = 'responsive' | 'sm' | 'base' | 'lg' | 'xl';
|
|
21
|
+
/** The tags a prose container is allowed to be — all of them block-level. */
|
|
22
|
+
export type ProseTag = 'div' | 'section' | 'nav' | 'main' | 'article' | 'aside';
|
|
23
|
+
export type ApplyTypographyProps = React.ComponentProps<'div'> & {
|
|
24
|
+
asTag?: ProseTag;
|
|
25
|
+
size?: TypographySize;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Through `Box`, so a caller's layout classes are converted rather than
|
|
29
|
+
* emitted: `<ApplyTypography className="flex w-full">` used to put two dead
|
|
30
|
+
* tokens on the element, since nothing here defines them. `Box` with a `tag`
|
|
31
|
+
* renders that one element and nothing around it, so the `>` child selectors
|
|
32
|
+
* the prose rules depend on still reach the content.
|
|
33
|
+
*
|
|
34
|
+
* `hz-prose*` survives the conversion and stays on the element — it is real
|
|
35
|
+
* css in theme.css, which is exactly what `tw` leaves alone.
|
|
36
|
+
*/
|
|
37
|
+
export declare const ApplyTypography: ({ children, className, asTag, size, ...rest }: ApplyTypographyProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export default ApplyTypography;
|
|
39
|
+
//# sourceMappingURL=prose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prose.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/prose.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvE,6EAA6E;AAC7E,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;AAE/E,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC/D,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,IAAI,CAAC,EAAE,cAAc,CAAA;CACtB,CAAA;AAiBD;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,kDAMzB,oBAAoB,4CAMtB,CAAA;eAEc,eAAe"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '../../box.js';
|
|
3
|
+
import { cn } from '../../core/cn.js';
|
|
4
|
+
/**
|
|
5
|
+
* Namespaced, and this family especially: `.prose` is what Tailwind's own
|
|
6
|
+
* typography plugin claims. A site part-way through leaving that engine would
|
|
7
|
+
* otherwise have two stylesheets fighting over the same selector, and which one
|
|
8
|
+
* won would depend on import order.
|
|
9
|
+
*/
|
|
10
|
+
const RUNG = {
|
|
11
|
+
responsive: 'hz-prose-responsive',
|
|
12
|
+
// `base` is the unmodified `.hz-prose` rung, so it adds nothing.
|
|
13
|
+
base: '',
|
|
14
|
+
sm: 'hz-prose-sm',
|
|
15
|
+
lg: 'hz-prose-lg',
|
|
16
|
+
xl: 'hz-prose-xl',
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Through `Box`, so a caller's layout classes are converted rather than
|
|
20
|
+
* emitted: `<ApplyTypography className="flex w-full">` used to put two dead
|
|
21
|
+
* tokens on the element, since nothing here defines them. `Box` with a `tag`
|
|
22
|
+
* renders that one element and nothing around it, so the `>` child selectors
|
|
23
|
+
* the prose rules depend on still reach the content.
|
|
24
|
+
*
|
|
25
|
+
* `hz-prose*` survives the conversion and stays on the element — it is real
|
|
26
|
+
* css in theme.css, which is exactly what `tw` leaves alone.
|
|
27
|
+
*/
|
|
28
|
+
export const ApplyTypography = ({ children, className, asTag = 'div', size = 'responsive', ...rest }) => (_jsx(Box, { tag: asTag, className: cn('hz-prose', RUNG[size], className), ...rest, children: children }));
|
|
29
|
+
export default ApplyTypography;
|
|
30
|
+
//# sourceMappingURL=prose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prose.js","sourceRoot":"","sources":["../../../src/backends/gui/prose.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAYlC;;;;;GAKG;AACH,MAAM,IAAI,GAAmC;IAC3C,UAAU,EAAE,qBAAqB;IACjC,iEAAiE;IACjE,IAAI,EAAE,EAAE;IACR,EAAE,EAAE,aAAa;IACjB,EAAE,EAAE,aAAa;IACjB,EAAE,EAAE,aAAa;CAClB,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,QAAQ,EACR,SAAS,EACT,KAAK,GAAG,KAAK,EACb,IAAI,GAAG,YAAY,EACnB,GAAG,IAAI,EACc,EAAE,EAAE,CAAC,CAG1B,KAAC,GAAG,IAAC,GAAG,EAAE,KAAc,EAAE,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,KAAO,IAAe,YAC7F,QAAQ,GACL,CACP,CAAA;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.YouTubeEmbed = exports.VideoPlayer = void 0;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
/**
|
|
40
|
+
* Video.
|
|
41
|
+
*
|
|
42
|
+
* `VideoPlayer` is a `<video>` that takes its sources as an array, because a
|
|
43
|
+
* block describes them that way and every caller was otherwise writing the same
|
|
44
|
+
* `<source>` map.
|
|
45
|
+
*
|
|
46
|
+
* `YouTubeEmbed` shows the poster first and mounts the iframe on click. That is
|
|
47
|
+
* not a nicety: an embed loads ~1MB and sets cookies on sight, so a page with
|
|
48
|
+
* several of them pays for all of them before anyone watches one. The
|
|
49
|
+
* `-nocookie` host is the same trade — YouTube's own domain for embeds that
|
|
50
|
+
* defers its cookie until playback starts.
|
|
51
|
+
*/
|
|
52
|
+
const React = __importStar(require("react"));
|
|
53
|
+
exports.VideoPlayer = React.forwardRef(({ sources, ...rest }, ref) => ((0, jsx_runtime_1.jsx)("video", { ref: ref, ...rest, children: sources.map((src, i) => ((0, jsx_runtime_1.jsx)("source", { src: src }, i))) })));
|
|
54
|
+
exports.VideoPlayer.displayName = 'VideoPlayer';
|
|
55
|
+
/** YouTube's own play mark, drawn rather than imported so this pulls no icon set. */
|
|
56
|
+
const Play = ({ size }) => ((0, jsx_runtime_1.jsxs)("svg", { width: size, height: size * 0.7, viewBox: "0 0 68 48", role: "img", "aria-hidden": true, style: { transition: 'transform .15s ease' }, children: [(0, jsx_runtime_1.jsx)("path", { d: "M66.5 7.7a8.6 8.6 0 0 0-6-6C55.2 0 34 0 34 0S12.8 0 7.5 1.6a8.6 8.6 0 0 0-6 6A89.7 89.7 0 0 0 0 24a89.7 89.7 0 0 0 1.5 16.3 8.6 8.6 0 0 0 6 6C12.8 48 34 48 34 48s21.2 0 26.5-1.6a8.6 8.6 0 0 0 6-6A89.7 89.7 0 0 0 68 24a89.7 89.7 0 0 0-1.5-16.3z", fill: "#f00" }), (0, jsx_runtime_1.jsx)("path", { d: "M27 34V14l18 10-18 10z", fill: "#fff" })] }));
|
|
57
|
+
const YouTubeEmbed = ({ youtubeID, width, height, buttonSize = 100, timeAt, title, caption, className, }) => {
|
|
58
|
+
const [playing, setPlaying] = React.useState(false);
|
|
59
|
+
if (playing) {
|
|
60
|
+
// autoplay is honoured because the iframe mounts inside a click.
|
|
61
|
+
const q = `${timeAt ? `?t=${timeAt}&` : '?'}rel=0&autoplay=1`;
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, children: (0, jsx_runtime_1.jsx)("iframe", { width: width, height: height, src: `https://www.youtube-nocookie.com/embed/${youtubeID}${q}`, allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true, title: title || 'YouTube video', style: { aspectRatio: '16 / 9', width: '100%', height: '100%', border: 0, padding: 0 } }) }));
|
|
63
|
+
}
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, children: (0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => setPlaying(true), "aria-label": title ? `Play ${title}` : 'Play video', style: {
|
|
65
|
+
position: 'relative',
|
|
66
|
+
aspectRatio: '16 / 9',
|
|
67
|
+
width: '100%',
|
|
68
|
+
padding: 0,
|
|
69
|
+
border: 0,
|
|
70
|
+
background: 'transparent',
|
|
71
|
+
cursor: 'pointer',
|
|
72
|
+
}, children: [(0, jsx_runtime_1.jsx)("img", { src: `https://img.youtube.com/vi/${youtubeID}/maxresdefault.jpg`, alt: "", width: width, height: height, loading: "lazy", style: { width: '100%', height: '100%', objectFit: 'cover' } }), (0, jsx_runtime_1.jsx)("span", { style: {
|
|
73
|
+
position: 'absolute',
|
|
74
|
+
left: '50%',
|
|
75
|
+
top: '50%',
|
|
76
|
+
transform: 'translate(-50%, -50%)',
|
|
77
|
+
display: 'grid',
|
|
78
|
+
placeItems: 'center',
|
|
79
|
+
opacity: 0.9,
|
|
80
|
+
}, children: (0, jsx_runtime_1.jsx)(Play, { size: buttonSize }) }), caption && ((0, jsx_runtime_1.jsx)("p", { className: "hz-prose", style: {
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
left: '50%',
|
|
83
|
+
top: 20,
|
|
84
|
+
transform: 'translateX(-50%)',
|
|
85
|
+
whiteSpace: 'nowrap',
|
|
86
|
+
margin: 0,
|
|
87
|
+
}, children: caption }))] }) }));
|
|
88
|
+
};
|
|
89
|
+
exports.YouTubeEmbed = YouTubeEmbed;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video.
|
|
3
|
+
*
|
|
4
|
+
* `VideoPlayer` is a `<video>` that takes its sources as an array, because a
|
|
5
|
+
* block describes them that way and every caller was otherwise writing the same
|
|
6
|
+
* `<source>` map.
|
|
7
|
+
*
|
|
8
|
+
* `YouTubeEmbed` shows the poster first and mounts the iframe on click. That is
|
|
9
|
+
* not a nicety: an embed loads ~1MB and sets cookies on sight, so a page with
|
|
10
|
+
* several of them pays for all of them before anyone watches one. The
|
|
11
|
+
* `-nocookie` host is the same trade — YouTube's own domain for embeds that
|
|
12
|
+
* defers its cookie until playback starts.
|
|
13
|
+
*/
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
export type VideoPlayerProps = Omit<React.ComponentPropsWithoutRef<'video'>, 'src'> & {
|
|
16
|
+
sources: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare const VideoPlayer: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "ref">, "src"> & {
|
|
19
|
+
sources: string[];
|
|
20
|
+
} & React.RefAttributes<HTMLVideoElement>>;
|
|
21
|
+
export type YouTubeEmbedProps = {
|
|
22
|
+
youtubeID: string;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
buttonSize?: number;
|
|
26
|
+
/** Start offset, e.g. `'5s'`. */
|
|
27
|
+
timeAt?: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
caption?: string;
|
|
30
|
+
className?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const YouTubeEmbed: ({ youtubeID, width, height, buttonSize, timeAt, title, caption, className, }: YouTubeEmbedProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/video.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG;IACpF,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,WAAW;aAHb,MAAM,EAAE;0CAWlB,CAAA;AAqBD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,YAAY,iFAStB,iBAAiB,4CA4EnB,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Video.
|
|
5
|
+
*
|
|
6
|
+
* `VideoPlayer` is a `<video>` that takes its sources as an array, because a
|
|
7
|
+
* block describes them that way and every caller was otherwise writing the same
|
|
8
|
+
* `<source>` map.
|
|
9
|
+
*
|
|
10
|
+
* `YouTubeEmbed` shows the poster first and mounts the iframe on click. That is
|
|
11
|
+
* not a nicety: an embed loads ~1MB and sets cookies on sight, so a page with
|
|
12
|
+
* several of them pays for all of them before anyone watches one. The
|
|
13
|
+
* `-nocookie` host is the same trade — YouTube's own domain for embeds that
|
|
14
|
+
* defers its cookie until playback starts.
|
|
15
|
+
*/
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
export const VideoPlayer = React.forwardRef(({ sources, ...rest }, ref) => (_jsx("video", { ref: ref, ...rest, children: sources.map((src, i) => (_jsx("source", { src: src }, i))) })));
|
|
18
|
+
VideoPlayer.displayName = 'VideoPlayer';
|
|
19
|
+
/** YouTube's own play mark, drawn rather than imported so this pulls no icon set. */
|
|
20
|
+
const Play = ({ size }) => (_jsxs("svg", { width: size, height: size * 0.7, viewBox: "0 0 68 48", role: "img", "aria-hidden": true, style: { transition: 'transform .15s ease' }, children: [_jsx("path", { d: "M66.5 7.7a8.6 8.6 0 0 0-6-6C55.2 0 34 0 34 0S12.8 0 7.5 1.6a8.6 8.6 0 0 0-6 6A89.7 89.7 0 0 0 0 24a89.7 89.7 0 0 0 1.5 16.3 8.6 8.6 0 0 0 6 6C12.8 48 34 48 34 48s21.2 0 26.5-1.6a8.6 8.6 0 0 0 6-6A89.7 89.7 0 0 0 68 24a89.7 89.7 0 0 0-1.5-16.3z", fill: "#f00" }), _jsx("path", { d: "M27 34V14l18 10-18 10z", fill: "#fff" })] }));
|
|
21
|
+
export const YouTubeEmbed = ({ youtubeID, width, height, buttonSize = 100, timeAt, title, caption, className, }) => {
|
|
22
|
+
const [playing, setPlaying] = React.useState(false);
|
|
23
|
+
if (playing) {
|
|
24
|
+
// autoplay is honoured because the iframe mounts inside a click.
|
|
25
|
+
const q = `${timeAt ? `?t=${timeAt}&` : '?'}rel=0&autoplay=1`;
|
|
26
|
+
return (_jsx("div", { className: className, children: _jsx("iframe", { width: width, height: height, src: `https://www.youtube-nocookie.com/embed/${youtubeID}${q}`, allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true, title: title || 'YouTube video', style: { aspectRatio: '16 / 9', width: '100%', height: '100%', border: 0, padding: 0 } }) }));
|
|
27
|
+
}
|
|
28
|
+
return (_jsx("div", { className: className, children: _jsxs("button", { type: "button", onClick: () => setPlaying(true), "aria-label": title ? `Play ${title}` : 'Play video', style: {
|
|
29
|
+
position: 'relative',
|
|
30
|
+
aspectRatio: '16 / 9',
|
|
31
|
+
width: '100%',
|
|
32
|
+
padding: 0,
|
|
33
|
+
border: 0,
|
|
34
|
+
background: 'transparent',
|
|
35
|
+
cursor: 'pointer',
|
|
36
|
+
}, children: [_jsx("img", { src: `https://img.youtube.com/vi/${youtubeID}/maxresdefault.jpg`, alt: "", width: width, height: height, loading: "lazy", style: { width: '100%', height: '100%', objectFit: 'cover' } }), _jsx("span", { style: {
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
left: '50%',
|
|
39
|
+
top: '50%',
|
|
40
|
+
transform: 'translate(-50%, -50%)',
|
|
41
|
+
display: 'grid',
|
|
42
|
+
placeItems: 'center',
|
|
43
|
+
opacity: 0.9,
|
|
44
|
+
}, children: _jsx(Play, { size: buttonSize }) }), caption && (_jsx("p", { className: "hz-prose", style: {
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
left: '50%',
|
|
47
|
+
top: 20,
|
|
48
|
+
transform: 'translateX(-50%)',
|
|
49
|
+
whiteSpace: 'nowrap',
|
|
50
|
+
margin: 0,
|
|
51
|
+
}, children: caption }))] }) }));
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=video.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.js","sourceRoot":"","sources":["../../../src/backends/gui/video.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccordianBlockComponent = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const accordion_1 = require("../backends/gui/accordion.cjs");
|
|
7
|
+
const prose_1 = require("../backends/gui/prose.cjs");
|
|
8
|
+
const box_1 = require("../box.cjs");
|
|
9
|
+
const spec_1 = require("./spec.cjs");
|
|
10
|
+
const AccordianBlockComponent = ({ block, className }) => {
|
|
11
|
+
if (block.blockType !== 'accordian')
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "accordian block required" });
|
|
13
|
+
const b = block;
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(accordion_1.Accordion, { type: "single", collapsible: true, ...(0, spec_1.sx)('w-full border rounded-xl overflow-hidden', className), children: b.items.map((item, i) => ((0, react_1.createElement)(accordion_1.AccordionItem, { ...(0, spec_1.sx)('border-b overflow-hidden'), value: `value-${i}`, key: i },
|
|
15
|
+
(0, jsx_runtime_1.jsx)(accordion_1.AccordionTrigger, { ...(0, spec_1.sx)('px-3 md:px-4 lg:px-6'), children: (0, jsx_runtime_1.jsx)(prose_1.ApplyTypography, { children: (0, jsx_runtime_1.jsx)(box_1.Box, { tag: "h6", className: "text-[1.05rem] font-semibold", children: item.trigger }) }) }),
|
|
16
|
+
(0, jsx_runtime_1.jsx)(accordion_1.AccordionContent, { ...(0, spec_1.sx)('p-4 border-t'), children: (0, jsx_runtime_1.jsx)(prose_1.ApplyTypography, { className: "items-start", children: typeof item.content === 'string' ? (0, jsx_runtime_1.jsx)(box_1.Box, { tag: "p", children: item.content }) : item.content }) })))) }));
|
|
17
|
+
};
|
|
18
|
+
exports.AccordianBlockComponent = AccordianBlockComponent;
|
|
19
|
+
exports.default = exports.AccordianBlockComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordian.d.ts","sourceRoot":"","sources":["../../src/blocks/accordian.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,mBAAmB,EAAM,MAAM,QAAQ,CAAA;AAErD,eAAO,MAAM,uBAAuB,yBAA0B,mBAAmB,4CAgChF,CAAA;eAEc,uBAAuB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';import { createElement as _createElement } from "react";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from '../backends/gui/accordion.js';
|
|
4
|
+
import { ApplyTypography } from '../backends/gui/prose.js';
|
|
5
|
+
import { Box } from '../box.js';
|
|
6
|
+
import { sx } from './spec.js';
|
|
7
|
+
export const AccordianBlockComponent = ({ block, className }) => {
|
|
8
|
+
if (block.blockType !== 'accordian')
|
|
9
|
+
return _jsx(_Fragment, { children: "accordian block required" });
|
|
10
|
+
const b = block;
|
|
11
|
+
return (_jsx(Accordion, { type: "single", collapsible: true, ...sx('w-full border rounded-xl overflow-hidden', className), children: b.items.map((item, i) => (_createElement(AccordionItem, { ...sx('border-b overflow-hidden'), value: `value-${i}`, key: i },
|
|
12
|
+
_jsx(AccordionTrigger, { ...sx('px-3 md:px-4 lg:px-6'), children: _jsx(ApplyTypography, { children: _jsx(Box, { tag: "h6", className: "text-[1.05rem] font-semibold", children: item.trigger }) }) }),
|
|
13
|
+
_jsx(AccordionContent, { ...sx('p-4 border-t'), children: _jsx(ApplyTypography, { className: "items-start", children: typeof item.content === 'string' ? _jsx(Box, { tag: "p", children: item.content }) : item.content }) })))) }));
|
|
14
|
+
};
|
|
15
|
+
export default AccordianBlockComponent;
|
|
16
|
+
//# sourceMappingURL=accordian.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordian.js","sourceRoot":"","sources":["../../src/blocks/accordian.tsx"],"names":[],"mappings":";;AAEA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5B,OAAO,EAA4B,EAAE,EAAE,MAAM,QAAQ,CAAA;AAErD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAuB,EAAE,EAAE;IACnF,IAAI,KAAK,CAAC,SAAS,KAAK,WAAW;QAAE,OAAO,yDAA6B,CAAA;IACzE,MAAM,CAAC,GAAG,KAAuB,CAAA;IAEjC,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAC,QAAQ,EACb,WAAW,WACP,EAAE,CAAC,0CAA0C,EAAE,SAAS,CAAC,YAE5D,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACxB,eAAC,aAAa,OACR,EAAE,CAAC,0BAA0B,CAAC,EAClC,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,GAAG,EAAE,CAAC;YAEN,KAAC,gBAAgB,OAAK,EAAE,CAAC,sBAAsB,CAAC,YAC9C,KAAC,eAAe,cACd,KAAC,GAAG,IAAC,GAAG,EAAC,IAAI,EAAC,SAAS,EAAC,8BAA8B,YACnD,IAAI,CAAC,OAAO,GACT,GACU,GACD;YACnB,KAAC,gBAAgB,OAAK,EAAE,CAAC,cAAc,CAAC,YACtC,KAAC,eAAe,IAAC,SAAS,EAAC,aAAa,YACrC,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAC,GAAG,IAAC,GAAG,EAAC,GAAG,YAAE,IAAI,CAAC,OAAO,GAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,GACpE,GACD,CACL,CACjB,CAAC,GACQ,CACb,CAAA;AACH,CAAC,CAAA;AAED,eAAe,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BulletCardsBlockComponent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const box_1 = require("../box.cjs");
|
|
6
|
+
const cn_1 = require("../core/cn.cjs");
|
|
7
|
+
const grid_1 = require("./grid.cjs");
|
|
8
|
+
const spec_1 = require("./spec.cjs");
|
|
9
|
+
/** An icon given as a url is drawn at `size`; given as a node it renders as-is. */
|
|
10
|
+
const Mark = ({ icon, size, phone, className, }) => {
|
|
11
|
+
if (!icon)
|
|
12
|
+
return null;
|
|
13
|
+
if (typeof icon === 'string') {
|
|
14
|
+
const s = phone ? size * 0.75 : size;
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(box_1.Box, { tag: "img", src: icon, width: s, height: s, alt: "", className: className });
|
|
16
|
+
}
|
|
17
|
+
return (0, jsx_runtime_1.jsx)(box_1.Box, { className: className, children: icon });
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A grid of one-line cards, each an icon beside its text.
|
|
21
|
+
*
|
|
22
|
+
* Borders arrive at `md` and not before: on a phone the grid is one column, so
|
|
23
|
+
* a border per card would draw a stack of boxes where the eye reads a list.
|
|
24
|
+
*/
|
|
25
|
+
const BulletCardsBlockComponent = ({ block, className, agent, }) => {
|
|
26
|
+
if (block.blockType !== 'bullet-cards')
|
|
27
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "bullet-cards block required" });
|
|
28
|
+
const b = block;
|
|
29
|
+
const spec = (s) => (0, spec_1.has)(b.specifiers, s);
|
|
30
|
+
const border = spec('no-card-border')
|
|
31
|
+
? 'border-0'
|
|
32
|
+
: (0, cn_1.cn)('md:border', spec('border-muted-3')
|
|
33
|
+
? 'md:border-muted-3'
|
|
34
|
+
: spec('border-muted-1')
|
|
35
|
+
? 'md:border-muted-1'
|
|
36
|
+
: 'md:border-muted-2');
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(grid_1.GridBlockComponent, { block: { blockType: 'grid', grid: b.grid }, className: className, agent: agent, children: b.cards.map((card, i) => ((0, jsx_runtime_1.jsxs)(box_1.Box, { className: (0, cn_1.cn)('px-0 sm:px-4 py-1 md:py-4 rounded-lg', 'flex flex-row justify-start items-center text-foreground', border), children: [(0, jsx_runtime_1.jsx)(Mark, { icon: card.icon, size: b.iconSize ?? 28, phone: agent === 'phone', className: "shrink-0 mr-2 md:mr-4" }), (0, jsx_runtime_1.jsx)(box_1.Box, { tag: "p", className: (0, cn_1.cn)('m-0 sm:text-base', spec('mobile-small-text') ? 'text-xs' : 'text-sm'), children: card.text })] }, i))) }));
|
|
38
|
+
};
|
|
39
|
+
exports.BulletCardsBlockComponent = BulletCardsBlockComponent;
|
|
40
|
+
exports.default = exports.BulletCardsBlockComponent;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type BlockComponentProps } from './spec.js';
|
|
2
|
+
/**
|
|
3
|
+
* A grid of one-line cards, each an icon beside its text.
|
|
4
|
+
*
|
|
5
|
+
* Borders arrive at `md` and not before: on a phone the grid is one column, so
|
|
6
|
+
* a border per card would draw a stack of boxes where the eye reads a list.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BulletCardsBlockComponent: ({ block, className, agent, }: BlockComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default BulletCardsBlockComponent;
|
|
10
|
+
//# sourceMappingURL=bullet-cards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bullet-cards.d.ts","sourceRoot":"","sources":["../../src/blocks/bullet-cards.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,mBAAmB,EAAO,MAAM,QAAQ,CAAA;AAsBtD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,iCAInC,mBAAmB,4CA4CrB,CAAA;eAEc,yBAAyB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '../box.js';
|
|
3
|
+
import { cn } from '../core/cn.js';
|
|
4
|
+
import { GridBlockComponent } from './grid.js';
|
|
5
|
+
import { has } from './spec.js';
|
|
6
|
+
/** An icon given as a url is drawn at `size`; given as a node it renders as-is. */
|
|
7
|
+
const Mark = ({ icon, size, phone, className, }) => {
|
|
8
|
+
if (!icon)
|
|
9
|
+
return null;
|
|
10
|
+
if (typeof icon === 'string') {
|
|
11
|
+
const s = phone ? size * 0.75 : size;
|
|
12
|
+
return _jsx(Box, { tag: "img", src: icon, width: s, height: s, alt: "", className: className });
|
|
13
|
+
}
|
|
14
|
+
return _jsx(Box, { className: className, children: icon });
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A grid of one-line cards, each an icon beside its text.
|
|
18
|
+
*
|
|
19
|
+
* Borders arrive at `md` and not before: on a phone the grid is one column, so
|
|
20
|
+
* a border per card would draw a stack of boxes where the eye reads a list.
|
|
21
|
+
*/
|
|
22
|
+
export const BulletCardsBlockComponent = ({ block, className, agent, }) => {
|
|
23
|
+
if (block.blockType !== 'bullet-cards')
|
|
24
|
+
return _jsx(_Fragment, { children: "bullet-cards block required" });
|
|
25
|
+
const b = block;
|
|
26
|
+
const spec = (s) => has(b.specifiers, s);
|
|
27
|
+
const border = spec('no-card-border')
|
|
28
|
+
? 'border-0'
|
|
29
|
+
: cn('md:border', spec('border-muted-3')
|
|
30
|
+
? 'md:border-muted-3'
|
|
31
|
+
: spec('border-muted-1')
|
|
32
|
+
? 'md:border-muted-1'
|
|
33
|
+
: 'md:border-muted-2');
|
|
34
|
+
return (_jsx(GridBlockComponent, { block: { blockType: 'grid', grid: b.grid }, className: className, agent: agent, children: b.cards.map((card, i) => (_jsxs(Box, { className: cn('px-0 sm:px-4 py-1 md:py-4 rounded-lg', 'flex flex-row justify-start items-center text-foreground', border), children: [_jsx(Mark, { icon: card.icon, size: b.iconSize ?? 28, phone: agent === 'phone', className: "shrink-0 mr-2 md:mr-4" }), _jsx(Box, { tag: "p", className: cn('m-0 sm:text-base', spec('mobile-small-text') ? 'text-xs' : 'text-sm'), children: card.text })] }, i))) }));
|
|
35
|
+
};
|
|
36
|
+
export default BulletCardsBlockComponent;
|
|
37
|
+
//# sourceMappingURL=bullet-cards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bullet-cards.js","sourceRoot":"","sources":["../../src/blocks/bullet-cards.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAA4B,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEtD,mFAAmF;AACnF,MAAM,IAAI,GAAG,CAAC,EACZ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,SAAS,GAMV,EAAE,EAAE;IACH,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IACtB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;QACpC,OAAO,KAAC,GAAG,IAAC,GAAG,EAAC,KAAK,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAC,EAAE,EAAC,SAAS,EAAE,SAAS,GAAI,CAAA;IACvF,CAAC;IACD,OAAO,KAAC,GAAG,IAAC,SAAS,EAAE,SAAS,YAAG,IAAI,GAAO,CAAA;AAChD,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,KAAK,EACL,SAAS,EACT,KAAK,GACe,EAAE,EAAE;IACxB,IAAI,KAAK,CAAC,SAAS,KAAK,cAAc;QAAE,OAAO,4DAAgC,CAAA;IAC/E,MAAM,CAAC,GAAG,KAAyB,CAAA;IACnC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAA;IAEhD,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC;QACnC,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,EAAE,CACA,WAAW,EACX,IAAI,CAAC,gBAAgB,CAAC;YACpB,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;gBACtB,CAAC,CAAC,mBAAmB;gBACrB,CAAC,CAAC,mBAAmB,CAC1B,CAAA;IAEL,OAAO,CACL,KAAC,kBAAkB,IACjB,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAC1C,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,YAEX,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACxB,MAAC,GAAG,IAEF,SAAS,EAAE,EAAE,CACX,sCAAsC,EACtC,0DAA0D,EAC1D,MAAM,CACP,aAED,KAAC,IAAI,IACH,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,CAAC,CAAC,QAAQ,IAAI,EAAE,EACtB,KAAK,EAAE,KAAK,KAAK,OAAO,EACxB,SAAS,EAAC,uBAAuB,GACjC,EACF,KAAC,GAAG,IAAC,GAAG,EAAC,GAAG,EAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,YAC9F,IAAI,CAAC,IAAI,GACN,KAfD,CAAC,CAgBF,CACP,CAAC,GACiB,CACtB,CAAA;AACH,CAAC,CAAA;AAED,eAAe,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CardBlockComponent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const card_1 = require("../backends/gui/card.cjs");
|
|
6
|
+
const card_2 = require("../backends/gui/card.cjs");
|
|
7
|
+
const link_1 = require("../backends/gui/link.cjs");
|
|
8
|
+
const prose_1 = require("../backends/gui/prose.cjs");
|
|
9
|
+
const box_1 = require("../box.cjs");
|
|
10
|
+
const cn_1 = require("../core/cn.cjs");
|
|
11
|
+
const cta_1 = require("./cta.cjs");
|
|
12
|
+
const image_1 = require("./image.cjs");
|
|
13
|
+
const video_1 = require("./video.cjs");
|
|
14
|
+
const spec_1 = require("./spec.cjs");
|
|
15
|
+
const SIZES = ['responsive', 'sm', 'base', 'lg', 'xl'];
|
|
16
|
+
/** `typography-lg` in the specifier bag picks the prose rung. */
|
|
17
|
+
const rung = (specifiers) => {
|
|
18
|
+
const hint = specifiers?.split(/\s+/).find((t) => t.startsWith('typography-'));
|
|
19
|
+
const last = hint?.split('-').pop();
|
|
20
|
+
return last && SIZES.includes(last) ? last : 'responsive';
|
|
21
|
+
};
|
|
22
|
+
/** A link that reads as a row: label left, an arrow out on the right. */
|
|
23
|
+
const LinkOut = ({ def }) => ((0, jsx_runtime_1.jsx)(link_1.LinkElement, { def: def, style: { justifyContent: 'space-between' }, variant: "link", iconAfter: true, icon: (0, jsx_runtime_1.jsx)("svg", { width: 18, height: 18, viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("path", { d: "M7 17 17 7M7 7h10v10", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }) }) }));
|
|
24
|
+
/**
|
|
25
|
+
* A card: a heading, some media, some content, and a call to action — any of
|
|
26
|
+
* which may be absent.
|
|
27
|
+
*
|
|
28
|
+
* `ghost` is the variant with everything taken away: no border, no padding, a
|
|
29
|
+
* larger left-aligned title. It reads as content on the page rather than as a
|
|
30
|
+
* card, which is what a card in a grid of prose usually wants to be.
|
|
31
|
+
*/
|
|
32
|
+
const CardBlockComponent = ({ block, className, contentClassName, agent, }) => {
|
|
33
|
+
if (block.blockType !== 'card')
|
|
34
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "card block required" });
|
|
35
|
+
const card = block;
|
|
36
|
+
const spec = (s) => (0, spec_1.has)(card.specifiers, s);
|
|
37
|
+
const ghost = spec('ghost');
|
|
38
|
+
const dim = spec('appear-disabled');
|
|
39
|
+
const hover = spec('reveal-content-on-hover');
|
|
40
|
+
const inline = spec('icon-inline');
|
|
41
|
+
const pad = ghost ? 'px-0 py-0' : 'px-6 py-3';
|
|
42
|
+
const border = dim ? 'border-muted-4' : 'border-muted-3';
|
|
43
|
+
const bg = spec('bg-card') ? 'bg-level-1' : '';
|
|
44
|
+
const place = (0, cn_1.cn)(spec('content-left') ? 'items-start' : 'items-center', spec('content-top') && 'justify-start', contentClassName);
|
|
45
|
+
const Header = ({ inContent = false, className: cls }) => card.title || card.byline || card.icon ? ((0, jsx_runtime_1.jsxs)(card_2.CardHeader, { ...(0, spec_1.sx)((0, cn_1.cn)('text-accent', dim && 'text-muted-2', pad, ghost && 'border-0', cls)), children: [(0, jsx_runtime_1.jsxs)(box_1.Box, { className: inline || inContent ? 'flex flex-row justify-start items-end my-3' : '', children: [card.icon && !card.iconAfter && ((0, jsx_runtime_1.jsx)(box_1.Box, { className: inline ? 'mr-1' : 'mb-2', children: card.icon })), card.title && ((0, jsx_runtime_1.jsx)(card_2.CardTitle, { ...(0, spec_1.sx)((0, cn_1.cn)('text-center text-lg font-medium', spec('heading-style-title') && 'font-heading text-base leading-tight', ghost && 'text-left md:text-xl', inline && 'md:text-xl')), children: card.title })), card.icon && card.iconAfter && ((0, jsx_runtime_1.jsx)(box_1.Box, { className: inline ? 'ml-1' : 'my-1', children: card.icon }))] }), card.byline && (0, jsx_runtime_1.jsx)(card_2.CardDescription, { children: card.byline })] })) : null;
|
|
46
|
+
const prose = (content) => typeof content === 'string' ? (0, jsx_runtime_1.jsx)(box_1.Box, { tag: "p", children: content }) : content;
|
|
47
|
+
const Body = ({ className: cls }) => spec('media-left') ? ((0, jsx_runtime_1.jsxs)(card_2.CardContent, { ...(0, spec_1.sx)((0, cn_1.cn)('flex flex-row justify-start items-stretch p-0 grow', border, bg, place, cls)), children: [card.media && ((0, jsx_runtime_1.jsx)(box_1.Box, { className: (0, cn_1.cn)('box-content grow-0', pad),
|
|
48
|
+
// This layout assumes the media is a video with an `sm` size — it
|
|
49
|
+
// is the width that decides the split, so it has to be known here.
|
|
50
|
+
style: { width: card.media.dim?.sm?.w }, children: (0, jsx_runtime_1.jsx)(video_1.VideoBlockComponent, { block: card.media, usePoster: spec('video-use-poster'), size: "sm", agent: agent, className: dim ? 'opacity-60' : '' }) })), card.content && ((0, jsx_runtime_1.jsx)(prose_1.ApplyTypography, { className: (0, cn_1.cn)('grow border-l flex flex-col justify-center', pad, border, place), size: rung(card.specifiers), children: prose(card.content) }))] })) : ((0, jsx_runtime_1.jsxs)(card_2.CardContent, { ...(0, spec_1.sx)((0, cn_1.cn)('grow flex flex-col justify-center', bg, pad, place, spec('full-width') && 'p-0', cls)), children: [hover && (0, jsx_runtime_1.jsx)(Header, { inContent: true }), card.content && spec('content-before') && prose(card.content), card.media &&
|
|
51
|
+
(card.media.blockType === 'image' ? ((0, jsx_runtime_1.jsx)(image_1.ImageBlockComponent, { block: card.media, agent: agent })) : ((0, jsx_runtime_1.jsx)(video_1.VideoBlockComponent, { block: card.media, agent: agent }))), card.content && !spec('content-before') && prose(card.content)] }));
|
|
52
|
+
const Foot = () => !card.cta ? null : spec('links-w-arrow') ? ((0, jsx_runtime_1.jsx)(card_2.CardFooter, { ...(0, spec_1.sx)((0, cn_1.cn)('flex flex-col justify-start items-stretch', pad)), children: (0, jsx_runtime_1.jsx)(cta_1.CTABlockComponent, { block: card.cta, agent: agent, renderLink: (def, key) => (0, jsx_runtime_1.jsx)(LinkOut, { def: def }, key) }) })) : ((0, jsx_runtime_1.jsx)(card_2.CardFooter, { ...(0, spec_1.sx)((0, cn_1.cn)('grid grid-cols-1 gap-2 md:flex md:flex-row md:justify-center', pad)), children: (0, jsx_runtime_1.jsx)(cta_1.CTABlockComponent, { block: card.cta, agent: agent }) }));
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(card_1.Card, { ...(0, spec_1.sx)((0, cn_1.cn)('flex flex-col self-stretch', hover && 'group relative', border, (spec('no-outer-border') || ghost) && 'border-0', bg, ghost && 'gap-2', className)), children: [(0, jsx_runtime_1.jsx)(Header, { className: hover ? 'absolute top-0 left-0 w-full hidden' : '' }), (0, jsx_runtime_1.jsx)(Body, { className: hover
|
|
54
|
+
? 'items-start justify-start rounded-lg p-4 transition-opacity duration-500 ease-out opacity-100'
|
|
55
|
+
: '' }), (0, jsx_runtime_1.jsx)(Foot, {})] }));
|
|
56
|
+
};
|
|
57
|
+
exports.CardBlockComponent = CardBlockComponent;
|
|
58
|
+
exports.default = exports.CardBlockComponent;
|