@zoneflow/renderer-dom 0.0.14 → 0.0.15

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.
@@ -6,6 +6,15 @@ const ZONE_TYPE_HEIGHT = 18;
6
6
  const ZONE_BADGE_HEIGHT = 20;
7
7
  const ZONE_BODY_MIN_HEIGHT = 28;
8
8
  const ZONE_FOOTER_HEIGHT = 18;
9
+ const ZONE_CHIP_PADDING_X = 10;
10
+ const ZONE_CHIP_PADDING_Y = 2;
11
+ /**
12
+ * When the zone's rendered height drops below this threshold the slot stack
13
+ * (padding + title) no longer fits, so we collapse into a compact single-slot
14
+ * layout that reads as a chip. Derived from the smallest normal layout height
15
+ * (ZONE_PADDING_Y * 2 + ZONE_TITLE_HEIGHT = 44).
16
+ */
17
+ const ZONE_CHIP_HEIGHT_THRESHOLD = ZONE_PADDING_Y * 2 + ZONE_TITLE_HEIGHT;
9
18
  const PATH_PADDING_X = 8;
10
19
  const PATH_PADDING_Y = 6;
11
20
  const PATH_GAP_Y = 4;
@@ -91,6 +100,18 @@ function shouldRenderPathSlot(density, slot) {
91
100
  function computeZoneSlots(params) {
92
101
  const { rect, density } = params;
93
102
  const slots = {};
103
+ // When the zone is short enough that the standard slot stack would not
104
+ // fit, fall back to a compact single-slot chip layout. Density "far" still
105
+ // renders no slots, matching the standard layout's behavior.
106
+ if (rect.height < ZONE_CHIP_HEIGHT_THRESHOLD) {
107
+ if (density === "far")
108
+ return slots;
109
+ const content = insetRect(rect, ZONE_CHIP_PADDING_X, ZONE_CHIP_PADDING_Y);
110
+ if (content.width > 0 && content.height > 0) {
111
+ slots.title = content;
112
+ }
113
+ return slots;
114
+ }
94
115
  let content = insetRect(rect, ZONE_PADDING_X, ZONE_PADDING_Y);
95
116
  if (shouldRenderZoneSlot(density, "title") && content.height > 0) {
96
117
  const { slot, rest } = takeTop(content, ZONE_TITLE_HEIGHT);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoneflow/renderer-dom",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "license": "MIT",
5
5
  "description": "Low-level DOM renderer engines for Zoneflow.",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "dist"
20
20
  ],
21
21
  "dependencies": {
22
- "@zoneflow/core": "0.0.14"
22
+ "@zoneflow/core": "0.0.15"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsc -p tsconfig.json",