@webjskit/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- package/bin/webjs.js +226 -0
- package/lib/create.js +519 -0
- package/lib/saas-template.js +238 -0
- package/package.json +35 -0
- package/templates/.claude/hooks/guard-branch-context.sh +39 -0
- package/templates/.claude/hooks/guard-main-merge.sh +44 -0
- package/templates/.claude/settings.json +24 -0
- package/templates/.claude.json +9 -0
- package/templates/.cursorrules +63 -0
- package/templates/.editorconfig +18 -0
- package/templates/.env.example +27 -0
- package/templates/.github/copilot-instructions.md +59 -0
- package/templates/.github/pull_request_template.md +14 -0
- package/templates/.hooks/pre-commit +24 -0
- package/templates/.windsurfrules +53 -0
- package/templates/CLAUDE.md +70 -0
- package/templates/CONVENTIONS.md +589 -0
- package/templates/app/_utils/ui.ts +83 -0
- package/templates/public/tailwind-browser.js +947 -0
- package/templates/test/browser/example.test.js +40 -0
- package/templates/test/e2e/example.test.ts +87 -0
- package/templates/test/unit/example.test.ts +24 -0
- package/templates/web-test-runner.config.js +26 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared UI helpers for pages, layouts, and components.
|
|
3
|
+
*
|
|
4
|
+
* When the same bundle of Tailwind classes repeats in 2+ places, extract
|
|
5
|
+
* it here. The helper runs at SSR time inside `html\`\``, so the browser
|
|
6
|
+
* receives fully materialised HTML — no client-side runtime, identical
|
|
7
|
+
* output to writing the classes inline.
|
|
8
|
+
*
|
|
9
|
+
* When to extract:
|
|
10
|
+
* • Classes repeat 2+ times identically → extract.
|
|
11
|
+
* • Varies by 1–2 props → extract with a small parameter.
|
|
12
|
+
* • Radically different per call site → keep inline.
|
|
13
|
+
*
|
|
14
|
+
* This file lives under `_utils/` — any folder whose name starts with `_`
|
|
15
|
+
* is ignored by the router, so it can never accidentally become a route.
|
|
16
|
+
*/
|
|
17
|
+
import { html } from '@webjskit/core';
|
|
18
|
+
|
|
19
|
+
/** `● label` kicker — small caps, accent colour, above headings. */
|
|
20
|
+
export function rubric(label: string, mb: 'sm' | 'md' = 'md') {
|
|
21
|
+
const mbCls = mb === 'sm' ? 'mb-3' : 'mb-4';
|
|
22
|
+
return html`
|
|
23
|
+
<span class="block font-mono text-[11px] leading-none font-semibold tracking-[0.2em] uppercase text-accent ${mbCls}">● ${label}</span>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Monospaced small-caps label — for stats, counts, bylines. */
|
|
28
|
+
export function stat(content: unknown, extraCls = '') {
|
|
29
|
+
return html`
|
|
30
|
+
<span class="font-mono text-[11px] leading-none font-medium tracking-[0.15em] uppercase text-fg-subtle ${extraCls}">${content}</span>
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** "← label" back link. */
|
|
35
|
+
export function backLink(href: string, label: string, mb: 'sm' | 'md' = 'md') {
|
|
36
|
+
const mbCls = mb === 'sm' ? 'mb-6' : 'mb-12';
|
|
37
|
+
return html`
|
|
38
|
+
<a href=${href} class="inline-block ${mbCls} text-fg-subtle no-underline font-mono text-[11px] leading-none font-medium tracking-[0.15em] uppercase transition-colors duration-fast hover:text-fg">← ${label}</a>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Large display heading — home / detail hero. */
|
|
43
|
+
export function displayH1(content: unknown) {
|
|
44
|
+
return html`
|
|
45
|
+
<h1 class="font-serif text-display leading-[1.02] tracking-[-0.035em] font-bold m-0 mb-6 text-balance">${content}</h1>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Clamp-scale H1 — login, compose, etc. */
|
|
50
|
+
export function clampH1(content: unknown) {
|
|
51
|
+
return html`
|
|
52
|
+
<h1 class="font-serif text-[clamp(2rem,1.5rem+1.6vw,2.8rem)] leading-[1.08] tracking-[-0.03em] font-bold m-0 mb-6">${content}</h1>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Section H2 — serif subheading. */
|
|
57
|
+
export function sectionH2(content: unknown, mb: 'sm' | 'md' = 'sm') {
|
|
58
|
+
const mbCls = mb === 'sm' ? 'mb-2' : 'mb-4';
|
|
59
|
+
return html`
|
|
60
|
+
<h2 class="font-serif text-[1.6rem] tracking-[-0.02em] font-bold m-0 ${mbCls}">${content}</h2>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Notice / banner paragraph — soft card above primary content. */
|
|
65
|
+
export function banner(content: unknown) {
|
|
66
|
+
return html`
|
|
67
|
+
<p class="p-6 bg-[color-mix(in_oklch,var(--bg-elev)_50%,transparent)] border border-border rounded-[10px] text-sm my-6 mb-12 text-fg-muted">${content}</p>
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Inline accent link — used inside body copy and banners. */
|
|
72
|
+
export function accentLink(href: string, label: unknown) {
|
|
73
|
+
return html`
|
|
74
|
+
<a href=${href} class="text-accent font-semibold no-underline hover:underline hover:underline-offset-[3px]">${label}</a>
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Small code chip — inline monospaced token with a tinted surface. */
|
|
79
|
+
export function codeChip(text: string) {
|
|
80
|
+
return html`
|
|
81
|
+
<code class="font-mono text-[0.88em] px-1.5 py-0.5 rounded-md bg-bg-subtle border border-border break-words [overflow-wrap:anywhere]">${text}</code>
|
|
82
|
+
`;
|
|
83
|
+
}
|