tsquare 0.4.1 → 0.4.2

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2
4
+
5
+ - **Toast corners:** `position` also takes `topLeft`, `topRight`, `bottomLeft` and `bottomRight`, besides `top` and `bottom` (centered, the default). Desktop apps often show toasts in a corner.
6
+
3
7
  ## 0.4.1
4
8
 
5
9
  ```tsquare
package/dist/catalog.d.ts CHANGED
@@ -613,7 +613,11 @@ export declare const componentDefinitions: {
613
613
  icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
614
614
  position: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
615
615
  bottom: "bottom";
616
+ bottomLeft: "bottomLeft";
617
+ bottomRight: "bottomRight";
616
618
  top: "top";
619
+ topLeft: "topLeft";
620
+ topRight: "topRight";
617
621
  }>>>;
618
622
  }, z.core.$strip>;
619
623
  slots: never[];
@@ -1266,7 +1270,11 @@ export declare const catalog: import("@json-render/core").Catalog<{
1266
1270
  icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1267
1271
  position: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1268
1272
  bottom: "bottom";
1273
+ bottomLeft: "bottomLeft";
1274
+ bottomRight: "bottomRight";
1269
1275
  top: "top";
1276
+ topLeft: "topLeft";
1277
+ topRight: "topRight";
1270
1278
  }>>>;
1271
1279
  }, z.core.$strip>;
1272
1280
  slots: never[];
@@ -609,7 +609,7 @@ var componentDefinitions = {
609
609
  text: o(z.string()),
610
610
  action: o(z.string()).describe('A text button, e.g. "Undo"'),
611
611
  icon: o(iconName),
612
- position: o(z.enum(["bottom", "top"])).describe("Default bottom, above a TabBar")
612
+ position: o(z.enum(["bottom", "top", "topLeft", "topRight", "bottomLeft", "bottomRight"])).describe("Default bottom (centered), above a TabBar")
613
613
  }),
614
614
  slots: [],
615
615
  description: "Short message over the screen, e.g. after saving. Must be a direct child of a Screen, listed last.",
@@ -1692,8 +1692,10 @@ function Drawer({ element, children }) {
1692
1692
  }
1693
1693
  function Toast({ element, aboveTabBar }) {
1694
1694
  const p = element.props;
1695
- const top = p.position === "top";
1696
- return /* @__PURE__ */ jsx(Box, { style: { position: "absolute", left: 16, right: 16, justifyContent: "center", ...top ? { top: 16 } : { bottom: aboveTabBar ? 92 : 24 } }, children: /* @__PURE__ */ jsxs(Box, { style: { alignItems: "center", gap: 12, padding: "12px 16px", borderRadius: 12, backgroundColor: theme.ink, color: theme.onPrimary, fontSize: 14, boxShadow: "0 6px 20px rgba(0,0,0,0.22)", maxWidth: 420 }, children: [
1695
+ const position = p.position ?? "bottom";
1696
+ const top = position.startsWith("top");
1697
+ const side = position.endsWith("Left") ? "flex-start" : position.endsWith("Right") ? "flex-end" : "center";
1698
+ return /* @__PURE__ */ jsx(Box, { style: { position: "absolute", left: 16, right: 16, justifyContent: side, ...top ? { top: 16 } : { bottom: aboveTabBar ? 92 : 24 } }, children: /* @__PURE__ */ jsxs(Box, { style: { alignItems: "center", gap: 12, padding: "12px 16px", borderRadius: 12, backgroundColor: theme.ink, color: theme.onPrimary, fontSize: 14, boxShadow: "0 6px 20px rgba(0,0,0,0.22)", maxWidth: 420 }, children: [
1697
1699
  p.icon ? /* @__PURE__ */ jsx(IconGlyph, { name: p.icon, size: 18, color: theme.onPrimary }) : null,
1698
1700
  /* @__PURE__ */ jsx(Box, { style: { flexShrink: 1 }, children: p.text ?? "" }),
1699
1701
  p.action ? /* @__PURE__ */ jsx(Box, { style: { fontWeight: 700, marginLeft: 8, flexShrink: 0 }, children: p.action }) : null
package/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  printWireframeText,
7
7
  renderWireframe,
8
8
  wireframePrompt
9
- } from "./chunks/chunk-QLIHML44.js";
9
+ } from "./chunks/chunk-NREXWHAE.js";
10
10
 
11
11
  // src/cli.ts
12
12
  import { readFile, writeFile } from "node:fs/promises";
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  upgradeSpec,
21
21
  upgradeWireframe,
22
22
  wireframePrompt
23
- } from "./chunks/chunk-QLIHML44.js";
23
+ } from "./chunks/chunk-NREXWHAE.js";
24
24
 
25
25
  // src/share.ts
26
26
  import { deflateRawSync, inflateRawSync } from "node:zlib";
@@ -11,7 +11,7 @@ import {
11
11
  renderWireframePng,
12
12
  renderWireframeSvg,
13
13
  wireframePrompt
14
- } from "../chunks/chunk-QLIHML44.js";
14
+ } from "../chunks/chunk-NREXWHAE.js";
15
15
 
16
16
  // src/playground/index.ts
17
17
  import { createServer } from "node:http";
@@ -394,7 +394,12 @@ var EXAMPLES = {
394
394
  screen phone "Top"
395
395
  heading "Profile" level=2
396
396
  image height=160
397
- toast "Changes saved" position=top`
397
+ toast "Changes saved" position=top
398
+ screen desktop "Corners: topLeft, topRight, bottomLeft, bottomRight" width=900 height=420
399
+ heading "Dashboard" level=2
400
+ image height=220
401
+ toast "topRight" position=topRight
402
+ toast "bottomLeft" action="Undo" position=bottomLeft`
398
403
  };
399
404
 
400
405
  // src/playground/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsquare",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Wireframes in plain text: easy for LLMs to write, fast to render as SVG or PNG.",
5
5
  "keywords": [
6
6
  "wireframe",
@@ -248,4 +248,4 @@ Short message over the screen, e.g. after saving. Must be a direct child of a Sc
248
248
  - text: string (main text)
249
249
  - action: string — A text button, e.g. "Undo"
250
250
  - icon: string — Lucide icon name in kebab-case, e.g. menu, search, arrow-left, settings, bell, user
251
- - position: "bottom" | "top" — Default bottom, above a TabBar
251
+ - position: "bottom" | "top" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" — Default bottom (centered), above a TabBar