tsquare 0.13.0 → 0.13.1
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 +6 -0
- package/dist/anchors.d.ts +2 -1
- package/dist/browser/index.js +7 -3
- package/dist/chunks/{chunk-PGX7ANZH.js → chunk-HVGRKWIV.js} +1 -1
- package/dist/chunks/{chunk-YOZFCNSK.js → chunk-K3Y2E2QA.js} +7 -3
- package/dist/cli.js +1 -1
- package/dist/index.js +2 -2
- package/dist/measure.d.ts +1 -1
- package/dist/playground/index.js +2 -2
- package/dist/tsquare.min.js +44 -44
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.1
|
|
4
|
+
|
|
5
|
+
The language and the renderer haven't changed: every wireframe renders exactly as in 0.13.0.
|
|
6
|
+
|
|
7
|
+
- **An open menu's or option list's box is the list as drawn** (#43). `measureElements` sized it from the estimate used to place the list (36px a row), but the list is drawn at 32px a row plus padding and a border, so a 10-item menu's box ran 37px past it, and a click just below an open menu returned the menu's owner. The box now has the drawn height, opening down or up.
|
|
8
|
+
|
|
3
9
|
## 0.13.0
|
|
4
10
|
|
|
5
11
|
The language hasn't changed. Every wireframe renders exactly as in 0.12.4 except one kind: a flow arrow to a modal, drawer or toast now ends at its card, panel or pill, and a tooltip on one sits over it (they used to be placed against the dimmed screen or the full-width row around it). None of the 438 example and eval boards has either; they render byte for byte the same.
|
package/dist/anchors.d.ts
CHANGED
|
@@ -71,7 +71,8 @@ export declare function parseDate(value: unknown): {
|
|
|
71
71
|
} | null;
|
|
72
72
|
/**
|
|
73
73
|
* Each anchored overlay's box on the board, by the id of the element it belongs to (an element with
|
|
74
|
-
* an open menu and a tooltip gets both).
|
|
74
|
+
* an open menu and a tooltip gets both). Menus and option lists get the height they're drawn at; a
|
|
75
|
+
* tooltip's comes from its text and a date picker's from its weeks (within a few px).
|
|
75
76
|
*/
|
|
76
77
|
export declare function overlayBoxes(spec: Spec, anchors: Anchor[], boxes: Record<string, Rect>): {
|
|
77
78
|
id: string;
|
package/dist/browser/index.js
CHANGED
|
@@ -21879,6 +21879,7 @@ function place(anchor, size, screen, opts) {
|
|
|
21879
21879
|
return { x: x3 - screen.x, y: y - screen.y, bottom: screen.y + screen.h - (anchor.y - opts.gap), side };
|
|
21880
21880
|
}
|
|
21881
21881
|
var ROW = 36;
|
|
21882
|
+
var listHeight = (rows) => rows * (ROW - 4) + 2 * 4 + 2 * 1.5;
|
|
21882
21883
|
function ListCard({ items, width, selected, c: c2 }) {
|
|
21883
21884
|
return /* @__PURE__ */ jsx4("div", { style: { display: "flex", flexDirection: "column", width, padding: 4, backgroundColor: theme.paper, border: `1.5px solid ${theme.lineStrong}`, borderRadius: 8, boxShadow: "0 8px 24px rgba(0,0,0,0.18)" }, children: items.map((item, i2) => {
|
|
21884
21885
|
const on2 = selected != null && item.label === selected;
|
|
@@ -21922,14 +21923,14 @@ function placeOverlay(spec, a, boxes) {
|
|
|
21922
21923
|
if (a.kind === "options") {
|
|
21923
21924
|
const options = p.options?.length ? p.options : [p.value ?? "Option 1", "Option 2", "Option 3"];
|
|
21924
21925
|
const size2 = { w: anchor.w, h: options.length * ROW + 8 };
|
|
21925
|
-
return { screen, anchor, size: size2, pos: place(anchor, size2, screen, { prefer: "below", align: "start", gap: 4 }), options };
|
|
21926
|
+
return { screen, anchor, size: size2, drawnH: listHeight(options.length), pos: place(anchor, size2, screen, { prefer: "below", align: "start", gap: 4 }), options };
|
|
21926
21927
|
}
|
|
21927
21928
|
if (a.kind === "menu") {
|
|
21928
21929
|
const items = p.menu.map((i2) => typeof i2 === "string" ? { label: i2 } : i2);
|
|
21929
21930
|
const width = a.end ? 200 : Math.max(180, anchor.w);
|
|
21930
21931
|
const inRightHalf = anchor.x + anchor.w / 2 > screen.x + screen.w / 2;
|
|
21931
21932
|
const size2 = { w: width, h: items.length * ROW + 8 };
|
|
21932
|
-
return { screen, anchor, size: size2, pos: place(anchor, size2, screen, { prefer: "below", align: a.end || inRightHalf ? "end" : "start", gap: a.end ? -6 : 4 }), items };
|
|
21933
|
+
return { screen, anchor, size: size2, drawnH: listHeight(items.length), pos: place(anchor, size2, screen, { prefer: "below", align: a.end || inRightHalf ? "end" : "start", gap: a.end ? -6 : 4 }), items };
|
|
21933
21934
|
}
|
|
21934
21935
|
if (a.kind === "calendar") {
|
|
21935
21936
|
const date = parseDate(p.value);
|
|
@@ -21944,7 +21945,10 @@ function placeOverlay(spec, a, boxes) {
|
|
|
21944
21945
|
function overlayBoxes(spec, anchors, boxes) {
|
|
21945
21946
|
return anchors.flatMap((a) => {
|
|
21946
21947
|
const o2 = placeOverlay(spec, a, boxes);
|
|
21947
|
-
|
|
21948
|
+
if (!o2) return [];
|
|
21949
|
+
const h2 = "drawnH" in o2 && o2.drawnH != null ? o2.drawnH : o2.size.h;
|
|
21950
|
+
const top = o2.screen.y + o2.pos.y + (o2.pos.side === "above" ? o2.size.h - h2 : 0);
|
|
21951
|
+
return [{ id: a.id, box: { x: o2.screen.x + o2.pos.x, y: top, w: o2.size.w, h: h2 } }];
|
|
21948
21952
|
});
|
|
21949
21953
|
}
|
|
21950
21954
|
function overlayLayer(spec, anchors, boxes, c2, Calendar2) {
|
|
@@ -2422,6 +2422,7 @@ function place(anchor, size, screen, opts) {
|
|
|
2422
2422
|
return { x: x - screen.x, y: y - screen.y, bottom: screen.y + screen.h - (anchor.y - opts.gap), side };
|
|
2423
2423
|
}
|
|
2424
2424
|
var ROW = 36;
|
|
2425
|
+
var listHeight = (rows) => rows * (ROW - 4) + 2 * 4 + 2 * 1.5;
|
|
2425
2426
|
function ListCard({ items, width, selected, c }) {
|
|
2426
2427
|
return /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", width, padding: 4, backgroundColor: theme.paper, border: `1.5px solid ${theme.lineStrong}`, borderRadius: 8, boxShadow: "0 8px 24px rgba(0,0,0,0.18)" }, children: items.map((item, i) => {
|
|
2427
2428
|
const on = selected != null && item.label === selected;
|
|
@@ -2465,14 +2466,14 @@ function placeOverlay(spec, a, boxes) {
|
|
|
2465
2466
|
if (a.kind === "options") {
|
|
2466
2467
|
const options = p.options?.length ? p.options : [p.value ?? "Option 1", "Option 2", "Option 3"];
|
|
2467
2468
|
const size2 = { w: anchor.w, h: options.length * ROW + 8 };
|
|
2468
|
-
return { screen, anchor, size: size2, pos: place(anchor, size2, screen, { prefer: "below", align: "start", gap: 4 }), options };
|
|
2469
|
+
return { screen, anchor, size: size2, drawnH: listHeight(options.length), pos: place(anchor, size2, screen, { prefer: "below", align: "start", gap: 4 }), options };
|
|
2469
2470
|
}
|
|
2470
2471
|
if (a.kind === "menu") {
|
|
2471
2472
|
const items = p.menu.map((i) => typeof i === "string" ? { label: i } : i);
|
|
2472
2473
|
const width = a.end ? 200 : Math.max(180, anchor.w);
|
|
2473
2474
|
const inRightHalf = anchor.x + anchor.w / 2 > screen.x + screen.w / 2;
|
|
2474
2475
|
const size2 = { w: width, h: items.length * ROW + 8 };
|
|
2475
|
-
return { screen, anchor, size: size2, pos: place(anchor, size2, screen, { prefer: "below", align: a.end || inRightHalf ? "end" : "start", gap: a.end ? -6 : 4 }), items };
|
|
2476
|
+
return { screen, anchor, size: size2, drawnH: listHeight(items.length), pos: place(anchor, size2, screen, { prefer: "below", align: a.end || inRightHalf ? "end" : "start", gap: a.end ? -6 : 4 }), items };
|
|
2476
2477
|
}
|
|
2477
2478
|
if (a.kind === "calendar") {
|
|
2478
2479
|
const date = parseDate(p.value);
|
|
@@ -2487,7 +2488,10 @@ function placeOverlay(spec, a, boxes) {
|
|
|
2487
2488
|
function overlayBoxes(spec, anchors, boxes) {
|
|
2488
2489
|
return anchors.flatMap((a) => {
|
|
2489
2490
|
const o2 = placeOverlay(spec, a, boxes);
|
|
2490
|
-
|
|
2491
|
+
if (!o2) return [];
|
|
2492
|
+
const h = "drawnH" in o2 && o2.drawnH != null ? o2.drawnH : o2.size.h;
|
|
2493
|
+
const top = o2.screen.y + o2.pos.y + (o2.pos.side === "above" ? o2.size.h - h : 0);
|
|
2494
|
+
return [{ id: a.id, box: { x: o2.screen.x + o2.pos.x, y: top, w: o2.size.w, h } }];
|
|
2491
2495
|
});
|
|
2492
2496
|
}
|
|
2493
2497
|
function overlayLayer(spec, anchors, boxes, c, Calendar2) {
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
languageData
|
|
3
|
-
} from "./chunks/chunk-
|
|
3
|
+
} from "./chunks/chunk-HVGRKWIV.js";
|
|
4
4
|
import {
|
|
5
5
|
DEVICES,
|
|
6
6
|
LABEL_H,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
withBoardGap,
|
|
40
40
|
withMarkers,
|
|
41
41
|
withPalette
|
|
42
|
-
} from "./chunks/chunk-
|
|
42
|
+
} from "./chunks/chunk-K3Y2E2QA.js";
|
|
43
43
|
|
|
44
44
|
// src/deflate.ts
|
|
45
45
|
import { deflateRawSync, inflateRawSync } from "node:zlib";
|
package/dist/measure.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export interface MeasuredElement {
|
|
|
39
39
|
box: MeasuredBox;
|
|
40
40
|
/** Screens: the band above the frame with the screen's name. */
|
|
41
41
|
labelBox?: MeasuredBox;
|
|
42
|
-
/** Its open menu, option list or date picker, and its tooltip, in drawing order (
|
|
42
|
+
/** Its open menu, option list or date picker, and its tooltip, in drawing order (a tooltip's and a date picker's size within a few px). */
|
|
43
43
|
overlays?: MeasuredBox[];
|
|
44
44
|
/** Modals and drawers: whether the screen behind is dimmed (on unless the text says no-scrim). */
|
|
45
45
|
scrim?: boolean;
|
package/dist/playground/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
languageData
|
|
3
|
-
} from "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-HVGRKWIV.js";
|
|
4
4
|
import {
|
|
5
5
|
boardLayout,
|
|
6
6
|
compileWireframe,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
renderWireframePng,
|
|
10
10
|
renderWireframeSvg,
|
|
11
11
|
wireframePrompt
|
|
12
|
-
} from "../chunks/chunk-
|
|
12
|
+
} from "../chunks/chunk-K3Y2E2QA.js";
|
|
13
13
|
|
|
14
14
|
// src/playground/index.ts
|
|
15
15
|
import { createServer } from "node:http";
|