monowind 0.1.10 → 0.2.1

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 CHANGED
@@ -38,6 +38,47 @@ import { defineMonoWind } from "monowind";
38
38
  defineMonoWind();
39
39
  ```
40
40
 
41
+ ## Border & rule glyphs
42
+
43
+ Border styles render through a **glyph set** — swap the characters
44
+ without touching your markup. Pick a built-in with a `borders-*`
45
+ utility on the element that owns the decoration (or any ancestor —
46
+ it inherits):
47
+
48
+ ```html
49
+ <div class="border borders-rounded">╭─╮ corners</div>
50
+ <div class="border border-double borders-ascii">+=+ everywhere</div>
51
+ <div class="border border-double borders-single">─│ only, DEC-style</div>
52
+ ```
53
+
54
+ Built-ins: `default`, `rounded`, `ascii`, `single`, `blocks`, `cp437`. Or register your
55
+ own (per-glyph fallback — override only what you need) and reference
56
+ it the same way:
57
+
58
+ ```js
59
+ import { registerBorderGlyphs } from "monowind";
60
+ registerBorderGlyphs("stars", { solid: { tl: "✧", tr: "✧", bl: "✧", br: "✧" } });
61
+ ```
62
+
63
+ ```css
64
+ .fancy {
65
+ --mw-border-glyphs: stars; /* what the borders-* utilities set */
66
+ }
67
+ ```
68
+
69
+ ## Companion packages
70
+
71
+ The core is self-contained; these are optional:
72
+
73
+ - [`@monowind/themes`](https://www.npmjs.com/package/@monowind/themes) —
74
+ class-scoped themes modeled on real systems (`dos`, `c64`,
75
+ `green-phosphor`, …): authentic palettes, period fonts, era-correct
76
+ border characters
77
+ - [`@monowind/ascii`](https://www.npmjs.com/package/@monowind/ascii) —
78
+ `<mono-ascii>` FIGlet banner text with gradient/metal effects
79
+ - [`@monowind/vite`](https://www.npmjs.com/package/@monowind/vite) —
80
+ zero-config Vite plugin, Tailwind included
81
+
41
82
  ## Docs
42
83
 
43
84
  - [Storybook](https://storybook.monowind.benface.com) — live examples of
package/dist/borders.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { BorderGlyphSet } from "./glyphs.ts";
1
2
  import type { RuleBreak, RuleVisibilityItems, BorderRun, BorderStyle, CellStyle, GapRule, Insets, LayoutNode, PerSide, Rect } from "./types.ts";
2
3
  export type { BorderRun } from "./types.ts";
3
4
  /**
@@ -22,13 +23,14 @@ export declare function zIndexApplies(child: LayoutNode, parent: LayoutNode): bo
22
23
  * allocation-free. */
23
24
  export declare function paintOrderedChildren(node: LayoutNode): LayoutNode[];
24
25
  /** A style's straight line glyph, for lattice segments. */
25
- export declare function lineGlyph(style: BorderStyle, axis: "h" | "v"): string;
26
+ export declare function lineGlyph(style: BorderStyle, axis: "h" | "v", set?: BorderGlyphSet): string;
26
27
  /** Junction glyph for a lattice intersection, from which of the four
27
28
  * arms exist. `double` has a full junction set; dashed/dotted (and mixed
28
29
  * styles, decided by the caller) use the light set — the corner
29
30
  * convention (specs/cell-model.md). Stubs (≤1 arm) fall back to plain
30
- * line glyphs. */
31
- export declare function junctionGlyph(style: BorderStyle, up: boolean, down: boolean, left: boolean, right: boolean): string;
31
+ * line glyphs. An active glyph SET (specs/theming.md) overrides PER
32
+ * GLYPH by junction role. */
33
+ export declare function junctionGlyph(style: BorderStyle, up: boolean, down: boolean, left: boolean, right: boolean, set?: BorderGlyphSet): string;
32
34
  /** One gap band a rule may occupy: `bandStart`/`bandSize` across the
33
35
  * band's axis (x for a vertical rule), `start`/`end` along it. All in
34
36
  * content-box cells. A `half` endpoint is an overlap-join extension
@@ -78,6 +80,8 @@ export interface GapRuleContext {
78
80
  borderStyle: PerSide<BorderStyle>;
79
81
  borderColor: PerSide<string | undefined>;
80
82
  padding: Insets;
83
+ /** The owning container's resolved glyph set (specs/theming.md). */
84
+ glyphs?: BorderGlyphSet | undefined;
81
85
  }
82
86
  /**
83
87
  * Paint gap rules as node-local glyph runs: each rule centers in its
@@ -1 +1 @@
1
- {"version":3,"file":"borders.d.ts","sourceRoot":"","sources":["../src/borders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,SA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