tsquare 0.12.3 → 0.13.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 +13 -0
- package/README.md +1 -1
- package/dist/anchors.d.ts +12 -3
- package/dist/browser/index.js +319 -86
- package/dist/chunks/{chunk-2FU5Z5ON.js → chunk-PGX7ANZH.js} +1 -1
- package/dist/chunks/{chunk-H4Y6VBEX.js → chunk-YOZFCNSK.js} +170 -70
- package/dist/cli.js +1 -1
- package/dist/compile.d.ts +2 -0
- package/dist/flows.d.ts +31 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +166 -3
- package/dist/measure.d.ts +97 -0
- package/dist/playground/index.js +2 -2
- package/dist/render.d.ts +24 -0
- package/dist/tsquare.min.js +68 -68
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
- **Element positions**, for making a board clickable (comment on an element, or ask a model to change it). `measureElements(spec, lines, { flows })` returns every element and flow arrow with where it's drawn, in board pixels, and its lines in the text: `line`, `endLine` (its whole block), `id`, `type`, `label`, `screenLine`, `parentLine` and `box`. Screens add the band with their name, elements with an open menu or a tooltip add their `overlays`, and modals and drawers say whether they dim the screen (`scrim`). A box is the part that shows (content cut off at a tab bar or a drawer's panel is cut there too); an element 0 tall or 0 wide, like a spacer in a row, is listed but never hit. Flows add `from`/`to` (the ids), `fromLine`/`toLine`, the drawn `path` and the label's box. `elementsAt(elements, x, y, { tolerance })` returns everything under a point, the most likely meant first: an open menu or tooltip's element, a flow's label, elements that hold no others, a flow's line, then stacks, screens and the board. A modal, drawer or toast hides what's under it; a modal or drawer that dims its screen hides all of it. The order doesn't depend on `lines`: an element missing from it gets line 0 and is still hit the same way. `elementsAtLine(elements, line)` returns the element on a line and the blocks around it, for a code view that follows the caret. See [Element positions](docs/element-positions.md). Thanks to @timweeda for the use case (tsquare-js/tsquare#37).
|
|
8
|
+
- **`compileWireframe` returns `lines`**: each element's line in the text, by its key in the spec.
|
|
9
|
+
|
|
10
|
+
## 0.12.4
|
|
11
|
+
|
|
12
|
+
The language hasn't changed. Boards whose screen names fit render exactly as in 0.12.3 (checked byte for byte on 438 boards); boards with a screen name wider than its screen are fixed:
|
|
13
|
+
|
|
14
|
+
- **A screen name wider than its screen ends in "…"** instead of widening its column. The board's layout sizes each column by its screen, so a long name pushed the screens after it right of where the layout put them, and the last screen was cut off at the board's right edge. Only names that might not fit are truncated, judged by an upper bound on each character's width in the font, so every other name renders as before.
|
|
15
|
+
|
|
3
16
|
## 0.12.3
|
|
4
17
|
|
|
5
18
|
The language hasn't changed. Screens whose content fits render exactly as in 0.12.2 (the same pixels; the SVG's internal mask ids differ). Screens whose content is taller than the screen are fixed:
|
package/README.md
CHANGED
|
@@ -151,7 +151,7 @@ const { issues } = compileWireframe(source); // problems by line, empt
|
|
|
151
151
|
const png = await renderWireframe(source, { format: "png", scale: 2 });
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
`tsquare/playground` exports the playground's request handler, for hosting it inside your own Node server. `tsquare/viewer` is the playground's zoomable board (zoom, pan, pinch, a chip per screen) for your own page: pass it the elements, then `show()` the SVG from `renderWireframeSvg` with the size and screens from `boardLayout`. It sets the styles its zoom math needs itself; give the stage a size, and optionally style the classes it toggles on the stage: `panning` (while dragging), `animate` (while fitting or zooming to a screen, e.g. `.animate > * { transition: transform .25s }`) and `stale` (from `setStale`, e.g. `.stale img { opacity: .35 }`). Call `destroy()` when you remove it. `languageData()` lists every component, prop, option word, icon and accent, for editor highlighting and autocomplete. In a browser bundle (esbuild, Vite, webpack) the same imports render SVG with no setup; PNG and share links need Node. On a page without a build step, `<script src="https://cdn.jsdelivr.net/npm/tsquare@0.
|
|
154
|
+
`tsquare/playground` exports the playground's request handler, for hosting it inside your own Node server. `tsquare/viewer` is the playground's zoomable board (zoom, pan, pinch, a chip per screen) for your own page: pass it the elements, then `show()` the SVG from `renderWireframeSvg` with the size and screens from `boardLayout`. It sets the styles its zoom math needs itself; give the stage a size, and optionally style the classes it toggles on the stage: `panning` (while dragging), `animate` (while fitting or zooming to a screen, e.g. `.animate > * { transition: transform .25s }`) and `stale` (from `setStale`, e.g. `.stale img { opacity: .35 }`). Call `destroy()` when you remove it. `languageData()` lists every component, prop, option word, icon and accent, for editor highlighting and autocomplete. In a browser bundle (esbuild, Vite, webpack) the same imports render SVG with no setup; PNG and share links need Node. On a page without a build step, `<script src="https://cdn.jsdelivr.net/npm/tsquare@0.13/dist/tsquare.min.js"></script>` draws every ```` ```tsquare ```` code block on the page (see [Embedding](docs/embedding.md#pages-written-in-markdown)). See [Using it with AI](docs/ai.md) for the prompt and the repair loop. `measureElements` gives each element's box on the board and its line in the text, and `elementsAt` what's under a click, for making a board clickable (see [Element positions](docs/element-positions.md)).
|
|
155
155
|
|
|
156
156
|
### The editor: `tsquare/editor`
|
|
157
157
|
|
package/dist/anchors.d.ts
CHANGED
|
@@ -36,10 +36,11 @@ export interface Anchor {
|
|
|
36
36
|
export declare function findAnchors(spec: Spec): Anchor[];
|
|
37
37
|
/**
|
|
38
38
|
* A copy of the spec whose anchored elements and screens carry marker colors in hidden props:
|
|
39
|
-
* `__mark` on the outer box (menus, tooltips, screens), `__markField` on a field (options, calendar)
|
|
40
|
-
*
|
|
39
|
+
* `__mark` on the outer box (menus, tooltips, screens), `__markField` on a field (options, calendar),
|
|
40
|
+
* `__markBody` on the content area of each screen in `bodies` (between its bars, where content is cut off).
|
|
41
|
+
* Box keys are the element id, `<id>#field` or `<id>#body`.
|
|
41
42
|
*/
|
|
42
|
-
export declare function tagForMeasuring(spec: Spec, anchors: Anchor[]): {
|
|
43
|
+
export declare function tagForMeasuring(spec: Spec, anchors: Anchor[], bodies?: string[]): {
|
|
43
44
|
tagged: Spec;
|
|
44
45
|
colors: Map<string, string>;
|
|
45
46
|
};
|
|
@@ -68,6 +69,14 @@ export declare function parseDate(value: unknown): {
|
|
|
68
69
|
month: string;
|
|
69
70
|
day?: number;
|
|
70
71
|
} | null;
|
|
72
|
+
/**
|
|
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). Menu, tooltip and option heights are estimates.
|
|
75
|
+
*/
|
|
76
|
+
export declare function overlayBoxes(spec: Spec, anchors: Anchor[], boxes: Record<string, Rect>): {
|
|
77
|
+
id: string;
|
|
78
|
+
box: Rect;
|
|
79
|
+
}[];
|
|
71
80
|
/**
|
|
72
81
|
* The top layer: each overlay inside a box covering its screen (clipped to it), placed from the
|
|
73
82
|
* measured boxes. `Calendar` is the board's own calendar component, reused for date pickers.
|