monowind 0.2.12 → 0.2.14
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 +36 -6
- package/dist/animate.d.ts.map +1 -1
- package/dist/animation.d.ts +40 -0
- package/dist/animation.d.ts.map +1 -0
- package/dist/borders.d.ts +22 -14
- package/dist/borders.d.ts.map +1 -1
- package/dist/cdn.js +90 -69
- 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 +44 -11
- 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 +6769 -5535
- package/dist/index.js.map +1 -1
- package/dist/lattice.d.ts.map +1 -1
- package/dist/multicol.d.ts.map +1 -1
- package/dist/paint.d.ts +35 -0
- package/dist/paint.d.ts.map +1 -1
- package/dist/plain-text.d.ts +60 -7
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/style.d.ts +4 -0
- package/dist/style.d.ts.map +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/types.d.ts +95 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/styles.css +30 -20
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
|
|
141
|
-
|
|
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
|
|
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
|
|
179
|
-
|
|
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/animate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate.d.ts","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"animate.d.ts","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA6BH;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,mBAAmB,GAAG,MAAM,CAgC3F;AAED;;;;;;;qDAOqD;AACrD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CA2BhE;AAED,wBAAgB,yBAAyB,IAAI,OAAO,CASnD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyframe animations sampled like transitions (specs/animations.md):
|
|
3
|
+
* a light element's running CSS animations, read through
|
|
4
|
+
* `getAnimations()`, classified by the properties their keyframes
|
|
5
|
+
* touch into what a frame must do to show them.
|
|
6
|
+
*/
|
|
7
|
+
import type { LayoutNode } from "./types.ts";
|
|
8
|
+
/** What a frame does for an element's running animations: `box`
|
|
9
|
+
* places its layer's box again from the computed effects; `paint`
|
|
10
|
+
* resamples its live paint-only properties into its node and
|
|
11
|
+
* repaints the last layout; `layout` re-lays-out, which reads every
|
|
12
|
+
* animated value under `[measuring]`. */
|
|
13
|
+
export type AnimationPath = "box" | "paint" | "layout";
|
|
14
|
+
/** The properties of `el`'s running CSS animations, camel-cased as
|
|
15
|
+
* keyframes name them; empty without one, or where the platform has
|
|
16
|
+
* no `getAnimations`. With the computed style at hand — a measure
|
|
17
|
+
* pass's read — an `animation-name` of none skips the call, and an
|
|
18
|
+
* animating element is noted for its host. */
|
|
19
|
+
export declare function animatedProperties(el: Element, cs?: CSSStyleDeclaration): Set<string>;
|
|
20
|
+
/** The elements a pass found animating inside `host`, once each. */
|
|
21
|
+
export declare function drainAnimated(host: Element): Element[];
|
|
22
|
+
/** The path for a set of animated properties on an element's layout
|
|
23
|
+
* node (null for an inline element); null with nothing animated. A
|
|
24
|
+
* `color` repaints only on a leaf without inline elements, since the
|
|
25
|
+
* children's and the inline runs' colors are snapshots of what they
|
|
26
|
+
* inherited; a border color only off a collapsed table, whose lattice
|
|
27
|
+
* took its colors at layout. */
|
|
28
|
+
export declare function animationPath(properties: Set<string>, node: LayoutNode | null): AnimationPath | null;
|
|
29
|
+
/** Whether `el` animates a layer effect, for the read: a running
|
|
30
|
+
* animation or transition of one keeps the element a layer root
|
|
31
|
+
* through its identity frames, a transition's first among them. A
|
|
32
|
+
* `transition-duration` of zero skips the call. */
|
|
33
|
+
export declare function animatesEffect(el: Element, cs: CSSStyleDeclaration): boolean;
|
|
34
|
+
/** Whether `el` animates its background: its value is the browser's,
|
|
35
|
+
* read as it is. */
|
|
36
|
+
export declare function animatesBackground(el: Element, cs: CSSStyleDeclaration): boolean;
|
|
37
|
+
/** The layout node of an element, found once per layout: the
|
|
38
|
+
* element's own, an anonymous run of its text left to it. */
|
|
39
|
+
export declare function nodeIndex(root: LayoutNode): Map<Element, LayoutNode>;
|
|
40
|
+
//# sourceMappingURL=animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../src/animation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;yCAIyC;AACzC,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AA2BvD;;;;8CAI8C;AAC9C,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,mBAAmB,GAAG,GAAG,CAAC,MAAM,CAAC,CAarF;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,EAAE,CAQtD;AAED;;;;;gCAKgC;AAChC,wBAAgB,aAAa,CAC3B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,IAAI,EAAE,UAAU,GAAG,IAAI,GACtB,aAAa,GAAG,IAAI,CAYtB;AAED;;;mDAGmD;AACnD,wBAAgB,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAQ5E;AAED;oBACoB;AACpB,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAEhF;AAED;6DAC6D;AAC7D,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAQpE"}
|
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
|
-
*
|
|
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
15
|
/**
|
|
16
|
-
* Emit a box's
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
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
|
|
37
|
-
|
|
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
|
|
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
|
package/dist/borders.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"borders.d.ts","sourceRoot":"","sources":["../src/borders.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
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,M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