@svelterm/core 0.25.0 → 0.26.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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.26.0 — 2026-07-05
4
+
5
+ Sibling border collapse becomes explicit.
6
+
7
+ ### Changed (breaking)
8
+
9
+ - **Sibling border collapse is now opt-in.** Adjacent bordered siblings
10
+ (stacked blocks, flex items, grid items) previously always shared a
11
+ border line with junction glyphs (`├` `┬` `┼`). Now that happens only
12
+ under `border-collapse: collapse` — an extension of the CSS table
13
+ property to all boxes. It inherits per spec, so opt in once on the
14
+ container or app-wide:
15
+
16
+ ```css
17
+ :root { border-collapse: collapse; }
18
+ ```
19
+
20
+ Without it, sibling frames render separately, matching browsers.
21
+ `border-collapse: separate` on a child opts it back out.
22
+
23
+ ### Added
24
+
25
+ - `border-collapse` now inherits (CSS 2.2 §17.6) — previously it was
26
+ only read from the table element itself.
27
+
3
28
  ## 0.25.0 — 2026-07-05
4
29
 
5
30
  Grid and generated-content completeness.
@@ -227,6 +227,10 @@ export function resolveNode(node, stylesheet, styles, variables, scheme = 'dark'
227
227
  }
228
228
  function computeStyle(node, stylesheet, vars, parentStyle, scheme = 'dark') {
229
229
  const style = defaultStyle(node.tag);
230
+ // border-collapse is an inherited property (CSS 2.2 §17.6), so opting a
231
+ // container in flows down to the siblings the collapse applies between.
232
+ if (parentStyle)
233
+ style.borderCollapse = parentStyle.borderCollapse;
230
234
  // Collect all matching declarations with specificity
231
235
  const scored = [];
232
236
  let order = 0;
@@ -297,6 +301,7 @@ function parseInlineStyle(text) {
297
301
  return result;
298
302
  }
299
303
  const INHERITABLE_PROPERTIES = new Set([
304
+ 'border-collapse',
300
305
  'color', 'font-weight', 'font-style', 'text-decoration',
301
306
  'white-space', 'word-break', 'text-align', 'visibility', 'opacity',
302
307
  ]);
@@ -322,6 +327,9 @@ function applyInherit(style, property, parentStyle) {
322
327
  case 'white-space':
323
328
  style.whiteSpace = parentStyle.whiteSpace;
324
329
  break;
330
+ case 'border-collapse':
331
+ style.borderCollapse = parentStyle.borderCollapse;
332
+ break;
325
333
  case 'word-break':
326
334
  style.wordBreak = parentStyle.wordBreak;
327
335
  break;
@@ -8,7 +8,7 @@ const LAYOUT_PROPERTIES = [
8
8
  'width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight',
9
9
  'borderStyle', 'borderTop', 'borderRight', 'borderBottom', 'borderLeft',
10
10
  'position', 'top', 'right', 'bottom', 'left',
11
- 'overflow', 'whiteSpace',
11
+ 'overflow', 'whiteSpace', 'borderCollapse',
12
12
  ];
13
13
  /**
14
14
  * Incremental style resolution — re-resolves dirty nodes and their
@@ -7,13 +7,17 @@ import { imageIntrinsicSize } from '../render/image.js';
7
7
  import { resolveSize, constrain } from './size.js';
8
8
  import { parseCellLength } from '../css/values.js';
9
9
  /**
10
- * Check if two adjacent siblings both have borders on their shared edge.
11
- * Returns true if the gap between them should be reduced by 1 to account
12
- * for the visual spacing inherent in box-drawing border characters.
10
+ * Check if two adjacent siblings should share a single border line on
11
+ * their common edge (overlapping by 1 cell so the strokes merge into
12
+ * junction glyphs). Opt-in: both siblings must be under border-collapse:
13
+ * collapse — an inherited property, so setting it on the container (or
14
+ * :root) is enough — and both must have a border on the shared edge.
13
15
  */
14
16
  function shouldAdjustBorderGap(prevStyle, nextStyle, direction) {
15
17
  if (!prevStyle || !nextStyle)
16
18
  return false;
19
+ if (prevStyle.borderCollapse !== 'collapse' || nextStyle.borderCollapse !== 'collapse')
20
+ return false;
17
21
  if (prevStyle.borderStyle === 'none' || nextStyle.borderStyle === 'none')
18
22
  return false;
19
23
  if (direction === 'vertical') {
package/docs/reference.md CHANGED
@@ -178,7 +178,7 @@ adaptations. Lengths are cells (`cell`/`ch`, `%`, or `calc()`).
178
178
  | [Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout) | `grid-template-columns/rows` (`cell`/`ch`/`%`/`fr`, `repeat()`, `minmax()`), `grid-template-areas` + `grid-area` (named and numeric), `grid-column`, `grid-row` (start / start‑end / `span n`), `gap`, `grid-auto-flow: row \| column` (column flow wraps at the explicit row count; implicit columns take the last explicit column's width). Fractional `minmax()` minimums redistribute: a track clamped to its minimum leaves the pool and the freed space re-splits among the rest |
179
179
  | [Positioning](https://developer.mozilla.org/en-US/docs/Web/CSS/position) | `position: static/relative/absolute/fixed/sticky` with `top/right/bottom/left`, `z-index`. Relative offsets shift visually without moving flow; sticky is top-edge only inside scroll containers (no push-out at the containing block end) |
180
180
  | [Tables](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_table) | `border-collapse`, `border-spacing`, `caption-side`, `table-layout`, `empty-cells`, `vertical-align` (`baseline` ≈ `top`) |
181
- | Borders | `border`/`border-style`/`border-color`/`border-corner` + per-side toggles (terminal values above) |
181
+ | Borders | `border`/`border-style`/`border-color`/`border-corner` + per-side toggles (terminal values above). `border-collapse: collapse` on a container (inherited — `:root` works) makes adjacent bordered siblings in block flow, flex, and grid share a single border line with junction glyphs (`├` `┬` `┼`) — a cell-grid extension of the table property |
182
182
  | [Animation](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animations) | `animation` shorthand, `animation-name/-duration/-iteration-count` (incl. `infinite`)/`-timing-function`, `@keyframes` (from/to/percentages, values resolve `var()`/`light-dark()`) |
183
183
  | [Transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_transitions) | `transition` shorthand with per-property comma groups; `transition-property`/`-duration`/`-timing-function` longhand lists paired per spec; interruptions continue from the current value |
184
184
  | [Easing](https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function) | `linear`, `ease` (default), `ease-in`, `ease-out`, `ease-in-out`, `cubic-bezier()`, `steps()`, `step-start`, `step-end` |
@@ -61,10 +61,17 @@ Browser values (`solid`, `dashed`…) are ignored.
61
61
  - `border-corner: h | v | none` biases which line wins at corners.
62
62
  - `border-color` is standard, including `currentColor`.
63
63
  - Tables support `border-collapse: collapse` with shared grid lines.
64
+ - `border-collapse: collapse` extends beyond tables: on any container
65
+ (it inherits, so `:root` opts the whole app in), adjacent bordered
66
+ siblings — stacked blocks, flex items, grid items — share a single
67
+ border line, merging into junction glyphs (`├` `┬` `┼`) in the border's
68
+ family. Without it, sibling frames stay separate as in browsers.
69
+ `border-collapse: separate` on a child opts it back out.
64
70
 
65
71
  ```css
66
72
  .panel { border: rounded; border-color: cyan; }
67
73
  .rule { border-top: true; border-style: single; } /* horizontal rule */
74
+ .list { border-collapse: collapse; } /* children share dividers */
68
75
  ```
69
76
 
70
77
  ## Colour
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svelterm/core",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "Svelte 5 components rendered to the terminal with real CSS",
5
5
  "type": "module",
6
6
  "exports": {