monowind 0.2.11 → 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 +70 -2
- package/dist/borders.d.ts +24 -8
- package/dist/borders.d.ts.map +1 -1
- package/dist/cdn.js +42 -36
- package/dist/cdn.js.map +1 -1
- package/dist/color.d.ts +50 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/element.d.ts.map +1 -1
- package/dist/flex.d.ts.map +1 -1
- package/dist/glyphs.d.ts +66 -6
- package/dist/glyphs.d.ts.map +1 -1
- package/dist/gradient.d.ts +19 -0
- package/dist/gradient.d.ts.map +1 -0
- package/dist/grid.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2544 -1557
- package/dist/index.js.map +1 -1
- package/dist/lattice.d.ts.map +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/multicol.d.ts.map +1 -1
- package/dist/paint.d.ts +1 -0
- package/dist/paint.d.ts.map +1 -1
- package/dist/plain-text.d.ts +15 -0
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/style.d.ts.map +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/types.d.ts +103 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/styles.css +6 -0
package/README.md
CHANGED
|
@@ -111,11 +111,78 @@ 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
|
+
|
|
116
|
+
A set can also register corner glyphs by `border-radius` — a corner
|
|
117
|
+
draws the registration nearest its radius in cells, the plain corner
|
|
118
|
+
counting at 0 (the defaults round light-line corners to `╭ ╮ ╰ ╯`
|
|
119
|
+
from `rounded-xs` up) — and the shade ramp box shadows step through,
|
|
120
|
+
densest first (default `█ ▓ ▒ ░`):
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
registerBorderGlyphs("soft", {
|
|
124
|
+
solid: {
|
|
125
|
+
rounded: [{ radius: 2, tl: "◜", tr: "◝", bl: "◟", br: "◞" }],
|
|
126
|
+
shadow: ["▓", "▒", "░", "·"],
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
```
|
|
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
|
+
|
|
114
146
|
Borders, blocks, and scrollbars tile in any font: where a font draws
|
|
115
147
|
its box-drawing or block glyphs shorter than the row (Menlo and SF
|
|
116
148
|
Mono do, and any font under a taller `leading-*`), the grid fits them
|
|
117
149
|
to it, so rows never show a seam.
|
|
118
150
|
|
|
151
|
+
## Shadows and rounded corners
|
|
152
|
+
|
|
153
|
+
`shadow-*` paints a box's silhouette behind it in shade glyphs from
|
|
154
|
+
the glyph set: offsets in whole cells (a `4px` offset is one cell, the
|
|
155
|
+
classic DOS shadow), blur as rings that fade outward, spread in cells,
|
|
156
|
+
a translucent color as a lighter shade leaning on the theme's
|
|
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`
|
|
160
|
+
is a six-ring halo. For presets tuned to the grid, redefine them in
|
|
161
|
+
your Tailwind theme:
|
|
162
|
+
|
|
163
|
+
```css
|
|
164
|
+
@theme {
|
|
165
|
+
--shadow-sm: 4px 4px 0 0 rgb(0 0 0 / 0.1);
|
|
166
|
+
--shadow-md: 4px 4px 8px 0 rgb(0 0 0 / 0.1);
|
|
167
|
+
--shadow-lg: 4px 4px 16px 0 rgb(0 0 0 / 0.1);
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`rounded-*` picks the corner glyphs a set registers nearest the radius
|
|
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.
|
|
185
|
+
|
|
119
186
|
## Companion packages
|
|
120
187
|
|
|
121
188
|
The core is self-contained; these are optional:
|
|
@@ -137,7 +204,8 @@ The core is self-contained; these are optional:
|
|
|
137
204
|
every supported feature
|
|
138
205
|
- [Project overview and development setup](https://github.com/benface/monowind#readme)
|
|
139
206
|
- [Cell-model rules](https://github.com/benface/monowind/blob/main/.agents/specs/cell-model.md)
|
|
140
|
-
— the layout semantics (spacing scale: 1 cell = 0.25rem; border
|
|
141
|
-
|
|
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)
|
|
142
210
|
- [Example apps](https://github.com/benface/monowind/tree/main/apps) — CDN
|
|
143
211
|
mode, Vite + Tailwind, and more
|
package/dist/borders.d.ts
CHANGED
|
@@ -4,14 +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
|
-
*
|
|
8
|
-
* cells per edge; we render them as N concentric rings. Styles
|
|
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
|
+
/**
|
|
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.
|
|
23
|
+
*/
|
|
24
|
+
export declare function collectShadowRuns(style: CellStyle, box: Rect, inset: boolean, out: BorderRun[]): void;
|
|
15
25
|
/** Whether the child paints in the positioned step (Appendix E step
|
|
16
26
|
* 8+): positioned elements, and flex/grid items with an explicit
|
|
17
27
|
* z-index (z-index applies there per CSS, but `auto` items paint as
|
|
@@ -25,15 +35,17 @@ export declare function paintsInPositionedStep(child: LayoutNode, parent: Layout
|
|
|
25
35
|
* order breaks ties. Bucketed instead of full-sorted so the common
|
|
26
36
|
* case (single bucket, no z-index) is allocation-free. */
|
|
27
37
|
export declare function paintOrderedChildren(node: LayoutNode): LayoutNode[];
|
|
28
|
-
/** A style's straight line glyph, for lattice
|
|
29
|
-
|
|
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;
|
|
30
41
|
/** Junction glyph for a lattice intersection, from which of the four
|
|
31
|
-
* arms exist
|
|
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
|
|
32
44
|
* styles, decided by the caller) use the light set — the corner
|
|
33
45
|
* convention (specs/cell-model.md). Stubs (≤1 arm) fall back to plain
|
|
34
46
|
* line glyphs. An active glyph SET (specs/theming.md) overrides PER
|
|
35
47
|
* GLYPH by junction role. */
|
|
36
|
-
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;
|
|
37
49
|
/** One gap band a rule may occupy: `bandStart`/`bandSize` across the
|
|
38
50
|
* band's axis (x for a vertical rule), `start`/`end` along it. All in
|
|
39
51
|
* content-box cells. A `half` endpoint is an overlap-join extension
|
|
@@ -81,6 +93,9 @@ export interface GapRuleContext {
|
|
|
81
93
|
contentHeight: number;
|
|
82
94
|
border: Insets;
|
|
83
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>;
|
|
84
99
|
borderColor: PerSide<string | undefined>;
|
|
85
100
|
padding: Insets;
|
|
86
101
|
/** The owning container's resolved glyph set (specs/theming.md). */
|
|
@@ -91,7 +106,8 @@ export interface GapRuleContext {
|
|
|
91
106
|
* band (floor on the leading side), crossings get junction glyphs from
|
|
92
107
|
* their arms, and a rule that reaches the content edge through zero
|
|
93
108
|
* padding tees into the container's innermost border ring. Mixed styles
|
|
94
|
-
* 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.
|
|
95
111
|
*/
|
|
96
112
|
export declare function collectGapRuleRuns(ctx: GapRuleContext): BorderRun[];
|
|
97
113
|
//# sourceMappingURL=borders.d.ts.map
|
package/dist/borders.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"borders.d.ts","sourceRoot":"","sources":["../src/borders.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"borders.d.ts","sourceRoot":"","sources":["../src/borders.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,SAAS,EAET,OAAO,EACP,MAAM,EACN,UAAU,EACV,OAAO,EACP,IAAI,EAEL,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,IAAI,CA2CrF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,SAAS,EAAE,GACf,IAAI,CAmEN;AA0GD;;;;uCAIuC;AACvC,wBAAgB,sBAAsB,CAAC,KAAK,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