@hanzo/build 0.2.36 → 0.2.38
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/lib/back.d.ts +1 -1
- package/lib/back.js +14 -4
- package/lib/shelf.js +8 -3
- package/package.json +1 -1
package/lib/back.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type Landing = {
|
|
|
16
16
|
};
|
|
17
17
|
/** The answer a return carried in `search`, or null when it carried none. */
|
|
18
18
|
export declare function landed(search: string): Landing | null;
|
|
19
|
-
/** `href` without the answer keys; `href` itself when it carries none. */
|
|
19
|
+
/** `href` without the answer keys, every other pair exactly as written; `href` itself when it carries none. */
|
|
20
20
|
export declare function clean(href: string): string;
|
|
21
21
|
/** This page's address, as a connect's return. */
|
|
22
22
|
export declare function here(): string;
|
package/lib/back.js
CHANGED
|
@@ -31,13 +31,23 @@ export function landed(search) {
|
|
|
31
31
|
return { kind: 'connected', provider: connected, account: q.get('account') ?? '' };
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
34
|
+
/** The decoded key of one `k=v` pair, or '' when it does not decode. */
|
|
35
|
+
function key(pair) {
|
|
36
|
+
try {
|
|
37
|
+
return decodeURIComponent(pair.split('=')[0].replace(/\+/g, ' '));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** `href` without the answer keys, every other pair exactly as written; `href` itself when it carries none. */
|
|
35
44
|
export function clean(href) {
|
|
36
45
|
const url = new URL(href);
|
|
37
|
-
|
|
46
|
+
const pairs = url.search.slice(1).split('&').filter(Boolean);
|
|
47
|
+
const kept = pairs.filter((p) => !ANSWER.includes(key(p)));
|
|
48
|
+
if (kept.length === pairs.length)
|
|
38
49
|
return href;
|
|
39
|
-
|
|
40
|
-
url.searchParams.delete(k);
|
|
50
|
+
url.search = kept.length ? `?${kept.join('&')}` : '';
|
|
41
51
|
return url.href;
|
|
42
52
|
}
|
|
43
53
|
/** This page's address, as a connect's return. */
|
package/lib/shelf.js
CHANGED
|
@@ -97,7 +97,7 @@ export function Artifacts() {
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
const said = failed || note;
|
|
100
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", items: "center", "$max-md": { px: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 1080, children: [_jsx(Head, { title: "Artifacts", says: "What this organization has built. Open one to keep building it." }), said ? (_jsx(SizableText, { size: "$2", color: "$soft", role: "status", pb: "$3", children: said })) : null, starters.value.length ? (_jsxs(YStack, { gap: "$3", pb: "$6", children: [_jsx(SizableText, { size: "$3", color: "$ink", children: "Make something new" }), _jsx(XStack, { flexWrap: "wrap", gap: "$3", children: starters.value.slice(0, 4).map((x) => (_jsxs(Card, { small: true, label: `Start from ${x.title}`, onPress: () => void take(x.slug), children: [_jsx(Shot, { slug: x.slug
|
|
100
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", items: "center", "$max-md": { px: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 1080, children: [_jsx(Head, { title: "Artifacts", says: "What this organization has built. Open one to keep building it." }), said ? (_jsx(SizableText, { size: "$2", color: "$soft", role: "status", pb: "$3", children: said })) : null, starters.value.length ? (_jsxs(YStack, { gap: "$3", pb: "$6", children: [_jsx(SizableText, { size: "$3", color: "$ink", children: "Make something new" }), _jsx(XStack, { flexWrap: "wrap", gap: "$3", children: starters.value.slice(0, 4).map((x) => (_jsxs(Card, { small: true, label: `Start from ${x.title}`, onPress: () => void take(x.slug), children: [_jsx(Shot, { slug: x.slug }), _jsx(YStack, { px: "$3", py: "$2.5", children: _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: busy === x.slug ? 'Copying…' : x.title }) })] }, x.slug))) })] })) : null, list.error ? (_jsx(SizableText, { size: "$2", color: "$soft", children: list.error.message })) : !host.person ? (_jsx(SizableText, { size: "$2", color: "$soft", children: "Sign in to see what your organization has built." })) : list.loading && list.value.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", children: "Reading your projects\u2026" })) : list.value.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", children: "Nothing built yet. Describe something on the New page and it lands here." })) : (_jsx(YStack, { gap: "$5", children: months(list.value).map((g) => (_jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: g.label }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", overflow: "hidden", children: g.rows.map((p, i) => (_jsxs(XStack, { items: "center", pr: "$2", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsxs(XStack, { flex: 1, minW: 0, render: "button", "aria-label": `Open ${p.name}`, onPress: () => host.go(p.slug), items: "center", gap: "$3", px: "$3", py: "$2.5", cursor: "pointer", style: { textAlign: 'left' }, children: [p.visibility === 'private' ? _jsx(Lock, { size: 16, opacity: 0.7 }) : _jsx(Globe, { size: 16, opacity: 0.7 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$3", color: "$ink", numberOfLines: 1, children: p.name }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: [p.visibility === 'private' ? 'Private' : 'Public', edited(when(p)), p.live ? new URL(p.live).host : 'Not deployed yet']
|
|
101
101
|
.filter(Boolean)
|
|
102
102
|
.join(' · ') })] })] }), _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": `Actions for ${p.name}`, px: "$1.5", py: "$1", rounded: "$2", hoverStyle: { bg: '$raised' }, children: _jsx(MoreHorizontal, { size: 16 }) }), items: [
|
|
103
103
|
{ key: 'rename', label: 'Rename', onSelect: () => setRenaming(p) },
|
|
@@ -114,9 +114,14 @@ export function Artifacts() {
|
|
|
114
114
|
list.reload();
|
|
115
115
|
} })) : null] }));
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
/**
|
|
118
|
+
* A starter's picture: a capture of its page from the top, 16:10. The frame has
|
|
119
|
+
* the capture's own shape at every width the grid gives a card, and the image is
|
|
120
|
+
* anchored at its top edge, so nothing of the page's header is cropped away.
|
|
121
|
+
*/
|
|
122
|
+
function Shot({ slug }) {
|
|
118
123
|
const [gone, setGone] = useState(false);
|
|
119
|
-
return (_jsxs(YStack, {
|
|
124
|
+
return (_jsxs(YStack, { width: "100%", aspectRatio: 16 / 10, bg: "$hover", items: "center", justify: "center", position: "relative", overflow: "hidden", children: [_jsxs(YStack, { items: "center", gap: "$2", opacity: 0.6, children: [_jsx(Boxes, { size: 24 }), _jsx(SizableText, { size: "$1", color: "$soft", textTransform: "uppercase", letterSpacing: 1, children: slug })] }), gone ? null : (_jsx("img", { src: `${SHOTS}/${encodeURIComponent(slug)}.webp`, alt: "", loading: "lazy", onError: () => setGone(true), style: { position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', objectPosition: 'top' } }))] }));
|
|
120
125
|
}
|
|
121
126
|
export function Templates() {
|
|
122
127
|
const t = useTarget();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/build",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"description": "Hanzo Build — say what you want, watch it built, deployed and running. The builder as a component, mounted by the Hanzo app at hanzo.ai.",
|