@webstir-io/webstir 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.
Files changed (123) hide show
  1. package/README.md +69 -0
  2. package/assets/features/client_nav/client_nav.ts +469 -0
  3. package/assets/features/content_nav/content_nav.css +170 -0
  4. package/assets/features/content_nav/content_nav.ts +358 -0
  5. package/assets/features/router/router-types.ts +6 -0
  6. package/assets/features/router/router.ts +118 -0
  7. package/assets/features/search/search.css +204 -0
  8. package/assets/features/search/search.ts +627 -0
  9. package/assets/templates/api/src/backend/index.ts +13 -0
  10. package/assets/templates/api/src/backend/tsconfig.json +15 -0
  11. package/assets/templates/api/src/shared/router-types.ts +23 -0
  12. package/assets/templates/api/src/shared/tsconfig.json +10 -0
  13. package/assets/templates/api/src/shared/types/index.ts +4 -0
  14. package/assets/templates/full/src/backend/index.ts +13 -0
  15. package/assets/templates/full/src/backend/tsconfig.json +15 -0
  16. package/assets/templates/full/src/frontend/app/app.css +65 -0
  17. package/assets/templates/full/src/frontend/app/app.html +13 -0
  18. package/assets/templates/full/src/frontend/app/app.ts +188 -0
  19. package/assets/templates/full/src/frontend/app/error.ts +127 -0
  20. package/assets/templates/full/src/frontend/app/hmr.js +355 -0
  21. package/assets/templates/full/src/frontend/app/navigation.ts +8 -0
  22. package/assets/templates/full/src/frontend/app/refresh.js +114 -0
  23. package/assets/templates/full/src/frontend/app/router.ts +126 -0
  24. package/assets/templates/full/src/frontend/app/styles/base.css +2 -0
  25. package/assets/templates/full/src/frontend/app/styles/reset.css +48 -0
  26. package/assets/templates/full/src/frontend/pages/home/index.css +21 -0
  27. package/assets/templates/full/src/frontend/pages/home/index.html +10 -0
  28. package/assets/templates/full/src/frontend/pages/home/index.ts +18 -0
  29. package/assets/templates/full/src/frontend/pages/home/tests/home.test.ts +21 -0
  30. package/assets/templates/full/src/frontend/tsconfig.json +20 -0
  31. package/assets/templates/full/src/shared/router-types.ts +23 -0
  32. package/assets/templates/full/src/shared/tsconfig.json +10 -0
  33. package/assets/templates/full/src/shared/types/index.ts +4 -0
  34. package/assets/templates/shared/Errors.404.html +23 -0
  35. package/assets/templates/shared/Errors.500.html +23 -0
  36. package/assets/templates/shared/Errors.default.html +23 -0
  37. package/assets/templates/shared/types/global.d.ts +32 -0
  38. package/assets/templates/shared/types.global.d.ts +32 -0
  39. package/assets/templates/spa/src/frontend/app/app.css +65 -0
  40. package/assets/templates/spa/src/frontend/app/app.html +13 -0
  41. package/assets/templates/spa/src/frontend/app/app.ts +188 -0
  42. package/assets/templates/spa/src/frontend/app/error.ts +127 -0
  43. package/assets/templates/spa/src/frontend/app/hmr.js +355 -0
  44. package/assets/templates/spa/src/frontend/app/navigation.ts +8 -0
  45. package/assets/templates/spa/src/frontend/app/refresh.js +114 -0
  46. package/assets/templates/spa/src/frontend/app/router.ts +126 -0
  47. package/assets/templates/spa/src/frontend/app/styles/base.css +2 -0
  48. package/assets/templates/spa/src/frontend/app/styles/reset.css +48 -0
  49. package/assets/templates/spa/src/frontend/pages/home/index.css +21 -0
  50. package/assets/templates/spa/src/frontend/pages/home/index.html +10 -0
  51. package/assets/templates/spa/src/frontend/pages/home/index.ts +18 -0
  52. package/assets/templates/spa/src/frontend/pages/home/tests/home.test.ts +21 -0
  53. package/assets/templates/spa/src/frontend/tsconfig.json +20 -0
  54. package/assets/templates/spa/src/shared/router-types.ts +23 -0
  55. package/assets/templates/spa/src/shared/tsconfig.json +10 -0
  56. package/assets/templates/spa/src/shared/types/index.ts +4 -0
  57. package/assets/templates/ssg/src/frontend/app/app.css +12 -0
  58. package/assets/templates/ssg/src/frontend/app/app.html +43 -0
  59. package/assets/templates/ssg/src/frontend/app/app.ts +190 -0
  60. package/assets/templates/ssg/src/frontend/app/error.ts +127 -0
  61. package/assets/templates/ssg/src/frontend/app/hmr.js +370 -0
  62. package/assets/templates/ssg/src/frontend/app/refresh.js +163 -0
  63. package/assets/templates/ssg/src/frontend/app/scripts/components/drawer.ts +183 -0
  64. package/assets/templates/ssg/src/frontend/app/scripts/components/menu.ts +75 -0
  65. package/assets/templates/ssg/src/frontend/app/styles/base.css +77 -0
  66. package/assets/templates/ssg/src/frontend/app/styles/components/buttons.css +108 -0
  67. package/assets/templates/ssg/src/frontend/app/styles/components/drawer.css +12 -0
  68. package/assets/templates/ssg/src/frontend/app/styles/components/header.css +164 -0
  69. package/assets/templates/ssg/src/frontend/app/styles/components/markdown.css +25 -0
  70. package/assets/templates/ssg/src/frontend/app/styles/layout.css +41 -0
  71. package/assets/templates/ssg/src/frontend/app/styles/reset.css +56 -0
  72. package/assets/templates/ssg/src/frontend/app/styles/tokens.css +72 -0
  73. package/assets/templates/ssg/src/frontend/app/styles/utilities.css +14 -0
  74. package/assets/templates/ssg/src/frontend/content/_sidebar.json +14 -0
  75. package/assets/templates/ssg/src/frontend/content/content-pipeline.md +82 -0
  76. package/assets/templates/ssg/src/frontend/content/css-playbook.md +68 -0
  77. package/assets/templates/ssg/src/frontend/content/hosting.md +48 -0
  78. package/assets/templates/ssg/src/frontend/pages/about/index.css +33 -0
  79. package/assets/templates/ssg/src/frontend/pages/about/index.html +60 -0
  80. package/assets/templates/ssg/src/frontend/pages/docs/index.css +505 -0
  81. package/assets/templates/ssg/src/frontend/pages/docs/index.html +52 -0
  82. package/assets/templates/ssg/src/frontend/pages/docs/index.ts +495 -0
  83. package/assets/templates/ssg/src/frontend/pages/home/index.css +91 -0
  84. package/assets/templates/ssg/src/frontend/pages/home/index.html +38 -0
  85. package/assets/templates/ssg/src/frontend/pages/home/tests/home.test.ts +24 -0
  86. package/assets/templates/ssg/src/frontend/tsconfig.json +13 -0
  87. package/package.json +41 -0
  88. package/scripts/pack-standalone.mjs +127 -0
  89. package/scripts/sync-assets.mjs +87 -0
  90. package/src/add-backend.ts +164 -0
  91. package/src/add.ts +112 -0
  92. package/src/api-watch.ts +84 -0
  93. package/src/backend-inspect.ts +45 -0
  94. package/src/backend-runtime.ts +286 -0
  95. package/src/build-plan.ts +12 -0
  96. package/src/build.ts +10 -0
  97. package/src/cli.ts +569 -0
  98. package/src/compile-tests.ts +61 -0
  99. package/src/dev-server.ts +393 -0
  100. package/src/enable-assets.ts +196 -0
  101. package/src/enable.ts +477 -0
  102. package/src/execute.ts +85 -0
  103. package/src/format.ts +254 -0
  104. package/src/frontend-watch.ts +145 -0
  105. package/src/full-watch.ts +80 -0
  106. package/src/index.ts +20 -0
  107. package/src/init-assets.ts +96 -0
  108. package/src/init.ts +339 -0
  109. package/src/paths.ts +26 -0
  110. package/src/providers.ts +88 -0
  111. package/src/publish.ts +8 -0
  112. package/src/refresh.ts +56 -0
  113. package/src/repair.ts +414 -0
  114. package/src/runtime.ts +48 -0
  115. package/src/smoke.ts +161 -0
  116. package/src/stop-signal.ts +26 -0
  117. package/src/test.ts +215 -0
  118. package/src/types.ts +29 -0
  119. package/src/watch-daemon-client.ts +171 -0
  120. package/src/watch-events.ts +195 -0
  121. package/src/watch.ts +66 -0
  122. package/src/workspace-watcher.ts +251 -0
  123. package/src/workspace.ts +55 -0
@@ -0,0 +1,82 @@
1
+ # Content pipeline
2
+
3
+ This starter supports Markdown docs out of the box.
4
+
5
+ If you add files under `src/frontend/content/**/*.md`, Webstir will:
6
+
7
+ - Convert Markdown to HTML at build time
8
+ - Wrap it in your shared layout (`src/frontend/app/app.html`)
9
+ - Write real pages under `/docs/.../`
10
+
11
+ The starter includes a docs hub at `/docs/` with basic navigation.
12
+
13
+ ## Add a doc
14
+
15
+ Create a file like:
16
+
17
+ - `src/frontend/content/my-doc.md`
18
+
19
+ It becomes:
20
+
21
+ - `/docs/my-doc/`
22
+
23
+ ## Where the output goes
24
+
25
+ For example, this file:
26
+
27
+ - `src/frontend/content/content-pipeline.md`
28
+
29
+ builds to:
30
+
31
+ - `/docs/content-pipeline/`
32
+
33
+ ## Routing rules (simple)
34
+
35
+ - In a folder, `index.md` becomes the folder root (e.g. `src/frontend/content/guides/index.md` → `/docs/guides/`)
36
+ - In a folder, `readme.md` also becomes the folder root (e.g. `src/frontend/content/guides/readme.md` → `/docs/guides/`)
37
+ - Otherwise, the file name becomes a segment (e.g. `content-pipeline.md` → `/docs/content-pipeline/`)
38
+
39
+ ## Frontmatter (optional)
40
+
41
+ You can set a title/description at the top of a Markdown file:
42
+
43
+ ```md
44
+ ---
45
+ title: My doc
46
+ description: A short summary for the docs index.
47
+ order: 10
48
+ ---
49
+ ```
50
+
51
+ ## Manifests
52
+
53
+ Webstir also emits helper manifests for docs navigation:
54
+
55
+ - `/docs-nav.json`
56
+
57
+ It’s written alongside your built frontend output:
58
+
59
+ - `build/frontend/docs-nav.json` while watching
60
+ - `dist/frontend/docs-nav.json` for publish output
61
+
62
+ ## Search (optional)
63
+
64
+ Enable site-wide search:
65
+
66
+ - `webstir enable search`
67
+
68
+ When enabled, Webstir generates search data and adds the search UI assets to your app:
69
+
70
+ - `/search.json` (used by the search feature module)
71
+ - `src/frontend/app/scripts/features/search.ts` (search behavior, added to your source tree and imported by `src/frontend/app/app.ts`)
72
+ - `src/frontend/app/styles/features/search.css` (search UI styling, added to your source tree)
73
+
74
+ ## Development vs publish
75
+
76
+ - `webstir watch` builds to `build/frontend/` for a fast dev loop.
77
+ - `webstir publish` writes `dist/frontend/` for static hosting.
78
+
79
+ ## Clean URLs on static hosts
80
+
81
+ If you deploy `dist/frontend/` with folder-style URLs (like `/docs/content-pipeline/`), configure your host to serve
82
+ `index.html` for directory paths.
@@ -0,0 +1,68 @@
1
+ # CSS Playbook
2
+
3
+ This starter uses a small, convention-first CSS system. The goal is to keep styling predictable and reduce "naming entropy" (lots of one-off classes and tokens).
4
+
5
+ ## Principles
6
+
7
+ - Tokens-first: use CSS custom properties instead of ad-hoc `#hex`/`px` values.
8
+ - Tiny surface area: prefer a few layout building blocks + a few components over "utility everything".
9
+ - Deterministic cascade: use cascade layers so "where do I put this?" is obvious.
10
+ - Accessible defaults: focus rings, readable type, and sensible spacing are part of the system.
11
+
12
+ ## The Contract (v0)
13
+
14
+ ### Layout (classes)
15
+
16
+ Use a small fixed set of layout building blocks:
17
+
18
+ - `.ws-container` - centered max-width container
19
+ - `.ws-stack` - vertical layout with gap
20
+ - `.ws-cluster` - inline row with wrap + gap
21
+ - `.ws-grid` - responsive grid
22
+ - `.ws-sidebar` - content + sidebar layout
23
+
24
+ Tune layout building blocks with CSS variables instead of creating more classes:
25
+
26
+ ```html
27
+ <div class="ws-stack" style="--ws-gap: var(--ws-space-4)">
28
+ ...
29
+ </div>
30
+ ```
31
+
32
+ ### Components (`data-ui`)
33
+
34
+ Target components by `data-ui` and use a small set of variant attributes:
35
+
36
+ - `data-ui="btn"` (and other component ids)
37
+ - `data-variant="solid|ghost|outline|soft"`
38
+ - `data-size="sm|md|lg"`
39
+ - `data-tone="neutral|accent|danger|success|warning"`
40
+
41
+ Example:
42
+
43
+ ```html
44
+ <a data-ui="btn" data-variant="solid" data-tone="accent" href="/about">About</a>
45
+ ```
46
+
47
+ Prefer `aria-*` and native attributes for state:
48
+
49
+ - `aria-current="page"`, `aria-expanded="true|false"`, `disabled`, etc.
50
+
51
+ ### Tokens
52
+
53
+ Define and customize design values via CSS variables (custom properties).
54
+
55
+ Common token categories:
56
+
57
+ - Color: `--ws-bg`, `--ws-fg`, `--ws-muted`, `--ws-border`, `--ws-accent`
58
+ - Space: `--ws-space-1..8`
59
+ - Radius: `--ws-radius-1..3`
60
+ - Type: `--ws-font-sans`, `--ws-font-mono`
61
+
62
+ ### Scoping
63
+
64
+ Docs-only rules should be scoped under a stable attribute:
65
+
66
+ - `[data-scope="docs"] { ... }`
67
+
68
+ This keeps "docs chrome" styles from leaking into app pages.
@@ -0,0 +1,48 @@
1
+ ---
2
+ title: Deploying your site
3
+ description: Clean URLs, sitemap, and static hosting notes for Webstir SSG.
4
+ order: 2
5
+ ---
6
+
7
+ # Deploying your site
8
+
9
+ Webstir SSG outputs plain HTML files that can be hosted on any static host (S3, Netlify, Cloudflare Pages, etc.).
10
+
11
+ ## Clean URLs (recommended)
12
+
13
+ The publish output is directory-based:
14
+
15
+ - `/about/` → `about/index.html`
16
+ - `/docs/content-pipeline/` → `docs/content-pipeline/index.html`
17
+
18
+ Your host should serve `index.html` automatically when a URL points at a directory.
19
+
20
+ If you want `/about` (no trailing slash) to work too, configure your host to treat it like a directory request.
21
+
22
+ Example (nginx):
23
+
24
+ ```nginx
25
+ location / {
26
+ try_files $uri $uri/ $uri/index.html =404;
27
+ }
28
+ ```
29
+
30
+ ## Sitemap
31
+
32
+ Webstir writes `sitemap.xml` during SSG publish. For absolute `<loc>` entries, set:
33
+
34
+ - `WEBSTIR_SITE_URL=https://your-domain.com`
35
+
36
+ Or add to `package.json`:
37
+
38
+ ```json
39
+ {
40
+ "webstir": {
41
+ "siteUrl": "https://your-domain.com"
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## Broken link checks
47
+
48
+ During SSG publish, Webstir validates internal links and `#hash` anchors across the generated HTML pages and fails with actionable errors if anything is broken.
@@ -0,0 +1,33 @@
1
+ @layer overrides {
2
+ .page {
3
+ padding: 48px 0 96px;
4
+ --ws-container: 100%;
5
+ }
6
+
7
+ .page .ws-stack {
8
+ --ws-gap: 32px;
9
+ }
10
+
11
+ .page-header {
12
+ max-width: none;
13
+ }
14
+
15
+ .lead {
16
+ color: var(--ws-muted);
17
+ font-size: 1.1rem;
18
+ margin: 0;
19
+ }
20
+
21
+ ul {
22
+ margin: 0;
23
+ padding-left: 20px;
24
+ }
25
+
26
+ li {
27
+ margin: 10px 0;
28
+ }
29
+
30
+ .bullets {
31
+ max-width: none;
32
+ }
33
+ }
@@ -0,0 +1,60 @@
1
+ <head>
2
+ <title>About</title>
3
+ <link rel="stylesheet" href="index.css" />
4
+ </head>
5
+ <body>
6
+ <main>
7
+ <section class="page">
8
+ <div class="ws-container">
9
+ <div class="ws-stack">
10
+ <header class="page-header">
11
+ <h1>About</h1>
12
+ <p class="lead">
13
+ This starter uses static site generation (SSG): your pages become fast, standalone HTML you can deploy anywhere.
14
+ </p>
15
+ </header>
16
+
17
+ <section>
18
+ <h2>What is SSG?</h2>
19
+ <p>
20
+ With SSG, your site is rendered at build time. Visitors get a real HTML page (great for performance and SEO),
21
+ and you can still add JavaScript later when you need interactivity.
22
+ </p>
23
+ </section>
24
+
25
+ <section>
26
+ <h2>How Webstir helps</h2>
27
+ <ul class="bullets">
28
+ <li>Keep pages simple: plain HTML and CSS per page.</li>
29
+ <li>Share a layout: common markup lives in <code>src/frontend/app/app.html</code>.</li>
30
+ <li>Ship production output with <code>webstir publish</code>.</li>
31
+ </ul>
32
+ </section>
33
+
34
+ <section>
35
+ <h2>Dev experience</h2>
36
+ <p>
37
+ Run <code>webstir watch</code> while you edit for fast refresh and hot reload, so you can iterate without a full rebuild.
38
+ </p>
39
+ </section>
40
+
41
+ <section>
42
+ <h2>Build output</h2>
43
+ <ul class="bullets">
44
+ <li>Dev builds go to <code>build/frontend/</code> (used by <code>webstir watch</code>).</li>
45
+ <li>Publish output goes to <code>dist/frontend/</code> (used by <code>webstir publish</code>).</li>
46
+ </ul>
47
+ </section>
48
+
49
+ <section>
50
+ <h2>Deploying</h2>
51
+ <p>
52
+ <code>dist/frontend/</code> is a plain static site. If you want clean URLs (like <code>/docs/content-pipeline/</code>),
53
+ configure your host to serve <code>index.html</code> for directory paths.
54
+ </p>
55
+ </section>
56
+ </div>
57
+ </div>
58
+ </section>
59
+ </main>
60
+ </body>