tsquare 0.12.4 → 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 +13 -0
- package/README.md +1 -1
- package/dist/anchors.d.ts +13 -3
- package/dist/browser/index.js +307 -85
- package/dist/chunks/{chunk-XWGHLFRX.js → chunk-HVGRKWIV.js} +1 -1
- package/dist/chunks/{chunk-BSE346UI.js → chunk-K3Y2E2QA.js} +158 -69
- 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.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
|
+
|
|
9
|
+
## 0.13.0
|
|
10
|
+
|
|
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.
|
|
12
|
+
|
|
13
|
+
- **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).
|
|
14
|
+
- **`compileWireframe` returns `lines`**: each element's line in the text, by its key in the spec.
|
|
15
|
+
|
|
3
16
|
## 0.12.4
|
|
4
17
|
|
|
5
18
|
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:
|
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,15 @@ 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). 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).
|
|
76
|
+
*/
|
|
77
|
+
export declare function overlayBoxes(spec: Spec, anchors: Anchor[], boxes: Record<string, Rect>): {
|
|
78
|
+
id: string;
|
|
79
|
+
box: Rect;
|
|
80
|
+
}[];
|
|
71
81
|
/**
|
|
72
82
|
* The top layer: each overlay inside a box covering its screen (clipped to it), placed from the
|
|
73
83
|
* measured boxes. `Calendar` is the board's own calendar component, reused for date pickers.
|