monowind 0.2.12 → 0.2.13

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
@@ -111,6 +111,8 @@ registerBorderGlyphs("stars", { solid: { tl: "✧", tr: "✧", bl: "✧", br: "
111
111
  }
112
112
  ```
113
113
 
114
+ A registered set is frozen; to change one, register it again.
115
+
114
116
  A set can also register corner glyphs by `border-radius` — a corner
115
117
  draws the registration nearest its radius in cells, the plain corner
116
118
  counting at 0 (the defaults round light-line corners to `╭ ╮ ╰ ╯`
@@ -126,6 +128,21 @@ registerBorderGlyphs("soft", {
126
128
  });
127
129
  ```
128
130
 
131
+ `border-width` is a **weight** the set interprets: the defaults draw
132
+ `border-2` and up as heavy lines (`━ ┃ ┏ ┓ ┗ ┛`) in one cell, and
133
+ `rule-2` on a gap the same way. A set registers its own weight bands —
134
+ glyphs for a width, and the cells it takes — so a theme whose font has
135
+ no heavy glyphs can draw two rings instead, which is what `ascii`,
136
+ `single`, `rounded`, and `blocks` do (`cp437` draws double, as DOS
137
+ did):
138
+
139
+ ```js
140
+ registerBorderGlyphs("rings", { solid: { weights: [{ width: 2, cells: 2 }] } });
141
+ registerBorderGlyphs("bold", {
142
+ solid: { weights: [{ width: 2, h: "═", v: "║", tl: "╔", tr: "╗", bl: "╚", br: "╝" }] },
143
+ });
144
+ ```
145
+
129
146
  Borders, blocks, and scrollbars tile in any font: where a font draws
130
147
  its box-drawing or block glyphs shorter than the row (Menlo and SF
131
148
  Mono do, and any font under a taller `leading-*`), the grid fits them
@@ -137,8 +154,9 @@ to it, so rows never show a seam.
137
154
  the glyph set: offsets in whole cells (a `4px` offset is one cell, the
138
155
  classic DOS shadow), blur as rings that fade outward, spread in cells,
139
156
  a translucent color as a lighter shade leaning on the theme's
140
- foreground. Tailwind's presets are pixel recipes, and their blur and
141
- spread convert on the spacing scale (4px to a cell), so `shadow-2xl`
157
+ foreground, `inset` shadows inside the padding box. Tailwind's presets
158
+ are pixel recipes, and their blur and spread convert on the spacing
159
+ scale (4px to a cell), so `shadow-2xl`
142
160
  is a six-ring halo. For presets tuned to the grid, redefine them in
143
161
  your Tailwind theme:
144
162
 
@@ -151,8 +169,19 @@ your Tailwind theme:
151
169
  ```
152
170
 
153
171
  `rounded-*` picks the corner glyphs a set registers nearest the radius
154
- — the defaults' `╭ ╮ ╰ ╯` for light-line borders — while double
155
- borders stay square.
172
+ — the defaults' `╭ ╮ ╰ ╯` for light-line borders — while heavy and
173
+ double borders stay square.
174
+
175
+ ## Gradients
176
+
177
+ `bg-linear-*`, `bg-radial`, and `bg-conic` (with `from-*`, `via-*`,
178
+ `to-*`, positions, and a space such as `/srgb`, `/oklch`, `/longer`)
179
+ paint a color per cell: each cell takes the gradient's color at its
180
+ center, in CSS's geometry for the box, the stops interpolated as CSS
181
+ does, layers composited over the plain color. Text keeps its own
182
+ color, and `bg-clip-text text-transparent` shows the gradient through
183
+ it. Sizes, positions, and repeats of the background image are ignored,
184
+ as are `url()` images: a gradient always covers the box once.
156
185
 
157
186
  ## Companion packages
158
187
 
@@ -175,7 +204,8 @@ The core is self-contained; these are optional:
175
204
  every supported feature
176
205
  - [Project overview and development setup](https://github.com/benface/monowind#readme)
177
206
  - [Cell-model rules](https://github.com/benface/monowind/blob/main/.agents/specs/cell-model.md)
178
- — the layout semantics (spacing scale: 1 cell = 0.25rem; border scale:
179
- 1px = 1 cell; what's deliberately unsupported)
207
+ — the layout semantics (spacing scale: 1 cell = 0.25rem; border
208
+ width as a weight the glyph set draws; what's deliberately
209
+ unsupported)
180
210
  - [Example apps](https://github.com/benface/monowind/tree/main/apps) — CDN
181
211
  mode, Vite + Tailwind, and more
package/dist/borders.d.ts CHANGED
@@ -4,22 +4,24 @@ export type { BorderRun } from "./types.ts";
4
4
  /**
5
5
  * Emit runs of border glyphs for the box's engine-allocated border cells.
6
6
  *
7
- * For multi-cell borders (`border-2`, `border-3`, ) the engine allocates N
8
- * cells per edge; we render them as N concentric rings. Styles and colors
9
- * are per-side (see paintRing); every ring repeats them.
7
+ * A weight band of N cells (a set's rings, specs/theming.md) allocates N
8
+ * cells per edge; we render them as N concentric rings. Styles, weights,
9
+ * and colors are per-side (see paintRing); every ring repeats them.
10
10
  *
11
11
  * A single-cell-thin box (width < 2 or height < 2) has no interior; we draw
12
12
  * only vertical/horizontal runs and skip corners that would overlap.
13
13
  */
14
14
  export declare function collectBorderRuns(style: CellStyle, box: Rect, out: BorderRun[]): void;
15
15
  /**
16
- * Emit a box's outer shadows (specs/box-shadow.md): each the border box
17
- * moved by its offsets and grown by its spread, blurred into
18
- * `round(blur / 2)` rings of the owner's shade ramp fading outward,
19
- * the cells under the box left out the last declared first, so the
20
- * first paints on top.
16
+ * Emit a box's shadows (specs/box-shadow.md), `inset` the ones drawn
17
+ * inside the padding box, else the outer ones: each a silhouette in the
18
+ * owner's shade ramp an outer shadow the border box moved by its
19
+ * offsets and grown by its spread, blurred into `round(blur / 2)` rings
20
+ * fading outward, the cells under the box left out; an inset shadow the
21
+ * padding box less that same rectangle moved inward, its rings fading
22
+ * into the box — the last declared first, so the first paints on top.
21
23
  */
22
- export declare function collectShadowRuns(style: CellStyle, box: Rect, out: BorderRun[]): void;
24
+ export declare function collectShadowRuns(style: CellStyle, box: Rect, inset: boolean, out: BorderRun[]): void;
23
25
  /** Whether the child paints in the positioned step (Appendix E step
24
26
  * 8+): positioned elements, and flex/grid items with an explicit
25
27
  * z-index (z-index applies there per CSS, but `auto` items paint as
@@ -33,15 +35,17 @@ export declare function paintsInPositionedStep(child: LayoutNode, parent: Layout
33
35
  * order breaks ties. Bucketed instead of full-sorted so the common
34
36
  * case (single bucket, no z-index) is allocation-free. */
35
37
  export declare function paintOrderedChildren(node: LayoutNode): LayoutNode[];
36
- /** A style's straight line glyph, for lattice segments. */
37
- export declare function lineGlyph(style: BorderStyle, axis: "h" | "v", set?: BorderGlyphSet): string;
38
+ /** A style's straight line glyph at a weight (px), for lattice
39
+ * segments and rules. */
40
+ export declare function lineGlyph(style: BorderStyle, weight: number, axis: "h" | "v", set?: BorderGlyphSet): string;
38
41
  /** Junction glyph for a lattice intersection, from which of the four
39
- * arms exist. `double` has a full junction set; dashed/dotted (and mixed
42
+ * arms exist, at a weight (px) the heaviest arm's, decided by the
43
+ * caller. `double` has a full junction set; dashed/dotted (and mixed
40
44
  * styles, decided by the caller) use the light set — the corner
41
45
  * convention (specs/cell-model.md). Stubs (≤1 arm) fall back to plain
42
46
  * line glyphs. An active glyph SET (specs/theming.md) overrides PER
43
47
  * GLYPH by junction role. */
44
- export declare function junctionGlyph(style: BorderStyle, up: boolean, down: boolean, left: boolean, right: boolean, set?: BorderGlyphSet): string;
48
+ export declare function junctionGlyph(style: BorderStyle, weight: number, up: boolean, down: boolean, left: boolean, right: boolean, set?: BorderGlyphSet): string;
45
49
  /** One gap band a rule may occupy: `bandStart`/`bandSize` across the
46
50
  * band's axis (x for a vertical rule), `start`/`end` along it. All in
47
51
  * content-box cells. A `half` endpoint is an overlap-join extension
@@ -89,6 +93,9 @@ export interface GapRuleContext {
89
93
  contentHeight: number;
90
94
  border: Insets;
91
95
  borderStyle: PerSide<BorderStyle>;
96
+ /** The border's weight per side (px): a rule tees into it with the
97
+ * heavier of the two (junctionWeight). */
98
+ borderWeight: PerSide<number>;
92
99
  borderColor: PerSide<string | undefined>;
93
100
  padding: Insets;
94
101
  /** The owning container's resolved glyph set (specs/theming.md). */
@@ -99,7 +106,8 @@ export interface GapRuleContext {
99
106
  * band (floor on the leading side), crossings get junction glyphs from
100
107
  * their arms, and a rule that reaches the content edge through zero
101
108
  * padding tees into the container's innermost border ring. Mixed styles
102
- * fall back to the light set; all-double crossings use the double set.
109
+ * fall back to the light set; all-double crossings use the double set;
110
+ * a crossing of weights draws the heavier.
103
111
  */
104
112
  export declare function collectGapRuleRuns(ctx: GapRuleContext): BorderRun[];
105
113
  //# sourceMappingURL=borders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"borders.d.ts","sourceRoot":"","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