monowind 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Benoît Rouleau
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # monowind
2
+
3
+ Build text-based user interfaces (TUIs) on the web from ordinary HTML and
4
+ Tailwind utility classes. A Web Component lays your HTML out on a strict
5
+ character grid — box-drawing borders, integer-cell geometry, monospace
6
+ everything — while native links, buttons, inputs, focus, forms, and
7
+ accessibility semantics stay fully intact.
8
+
9
+ **Early development.** APIs and behavior will change.
10
+
11
+ ## Try it — no build step
12
+
13
+ ```html
14
+ <script src="https://unpkg.com/monowind/dist/cdn.js"></script>
15
+
16
+ <mono-wind>
17
+ <div class="flex min-h-5 items-center justify-between border px-1">
18
+ <div>left</div>
19
+ <button>right</button>
20
+ </div>
21
+ </mono-wind>
22
+ ```
23
+
24
+ ## With your own Tailwind (v4) build
25
+
26
+ ```sh
27
+ npm install monowind
28
+ ```
29
+
30
+ ```css
31
+ /* app.css */
32
+ @import "tailwindcss";
33
+ @import "monowind";
34
+ ```
35
+
36
+ ```js
37
+ import { defineMonoWind } from "monowind";
38
+ defineMonoWind();
39
+ ```
40
+
41
+ ## Docs
42
+
43
+ - [Storybook](https://storybook.monowind.benface.com) — live examples of
44
+ every supported feature
45
+ - [Project overview and development setup](https://github.com/benface/monowind#readme)
46
+ - [Cell-model rules](https://github.com/benface/monowind/blob/main/.agents/specs/cell-model.md)
47
+ — the layout semantics (spacing scale: 1 cell = 0.25rem; border scale:
48
+ 1px = 1 cell; what's deliberately unsupported)
49
+ - [Example apps](https://github.com/benface/monowind/tree/main/apps) — CDN
50
+ mode, Vite + Tailwind, and more
@@ -0,0 +1,16 @@
1
+ import type { LayoutNode } from "./types.ts";
2
+ /**
3
+ * Render a laid-out tree as plain-text ASCII art: borders as box-drawing
4
+ * glyphs, leaf text word-wrapped inside its content box, everything else as
5
+ * spaces.
6
+ *
7
+ * This is the engine's "screenshot without a browser": deterministic,
8
+ * font-independent, and diffable — used for golden regression tests and as
9
+ * a debugging/agent-inspection tool. It intentionally renders geometry the
10
+ * way the browser would paint it (same border-run and word-wrap code), minus
11
+ * colors and fonts.
12
+ *
13
+ * Content that overflows the root box is clipped at the grid edges.
14
+ */
15
+ export declare function renderAscii(root: LayoutNode): string;
16
+ //# sourceMappingURL=ascii.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ascii.d.ts","sourceRoot":"","sources":["../src/ascii.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAepD"}
@@ -0,0 +1,21 @@
1
+ import type { CellStyle, Rect } from "./types.ts";
2
+ /** One run of identical border glyphs, in absolute cell coordinates. */
3
+ export interface BorderRun {
4
+ glyph: string;
5
+ x: number;
6
+ y: number;
7
+ length: number;
8
+ color: string | undefined;
9
+ }
10
+ /**
11
+ * Emit runs of border glyphs for the box's engine-allocated border cells.
12
+ *
13
+ * For multi-cell borders (`border-2`, `border-3`, …) the engine allocates N
14
+ * cells per edge; we render them as N concentric rings. Styles and colors
15
+ * are per-side (see paintRing); every ring repeats them.
16
+ *
17
+ * A single-cell-thin box (width < 2 or height < 2) has no interior; we draw
18
+ * only vertical/horizontal runs and skip corners that would overlap.
19
+ */
20
+ export declare function collectBorderRuns(style: CellStyle, box: Rect, out: BorderRun[]): void;
21
+ //# sourceMappingURL=borders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"borders.d.ts","sourceRoot":"","sources":["../src/borders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,SAAS,EAAW,IAAI,EAAE,MAAM,YAAY,CAAC;AAExE,wEAAwE;AACxE,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,IAAI,CAoBrF"}
package/dist/cdn.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * CDN entry point — the "Play CDN" experience, like Tailwind's:
3
+ *
4
+ * <script src="https://unpkg.com/monowind/dist/cdn.js"></script>
5
+ *
6
+ * One classic script tag, no build step. Bundles:
7
+ * - `@tailwindcss/browser` (compiles Tailwind classes in the browser at
8
+ * runtime, watching the DOM),
9
+ * - the monowind companion stylesheet (injected into <head>),
10
+ * - the engine, with <mono-wind> registered immediately.
11
+ */
12
+ import "@tailwindcss/browser";
13
+ //# sourceMappingURL=cdn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,sBAAsB,CAAC"}