tsquare 0.12.3 → 0.12.4

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.4
4
+
5
+ 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:
6
+
7
+ - **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.
8
+
3
9
  ## 0.12.3
4
10
 
5
11
  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:
@@ -20789,6 +20789,16 @@ function BrowserBar() {
20789
20789
  }
20790
20790
  );
20791
20791
  }
20792
+ function mayOverflow(name, width) {
20793
+ let w2 = 0;
20794
+ for (const ch of name) {
20795
+ if (ch.charCodeAt(0) >= 128 || /[MWmw@%&]/.test(ch)) w2 += 16.5;
20796
+ else if (/[A-Z]/.test(ch)) w2 += 12.5;
20797
+ else if (/[ .,:;'!|il1jft()[\]{}"`-]/.test(ch)) w2 += 8.5;
20798
+ else w2 += 11;
20799
+ }
20800
+ return w2 > width;
20801
+ }
20792
20802
  function Screen({ element, children }) {
20793
20803
  const p = element.props;
20794
20804
  const s = screenSize(p);
@@ -20804,7 +20814,12 @@ function Screen({ element, children }) {
20804
20814
  else body.push(c2);
20805
20815
  }
20806
20816
  return /* @__PURE__ */ jsxs(Box, { style: { flexDirection: "column", flexShrink: 0 }, children: [
20807
- /* @__PURE__ */ jsx3(Box, { style: { height: LABEL_H, fontSize: 16, fontWeight: 600, color: theme.text }, children: p.name ?? "" }),
20817
+ mayOverflow(p.name ?? "", s.width) ? (
20818
+ // the board's layout sizes each column by its screen, so a name that may be wider than the
20819
+ // screen gets the screen's width and ends in "…" instead of widening the column. Only then:
20820
+ // the clip changes how the text is antialiased, and names that fit should render as before.
20821
+ /* @__PURE__ */ jsx3(Box, { style: { width: s.width, height: LABEL_H, fontSize: 16, fontWeight: 600, color: theme.text }, children: /* @__PURE__ */ jsx3("div", { style: { overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, children: p.name }) })
20822
+ ) : /* @__PURE__ */ jsx3(Box, { style: { height: LABEL_H, fontSize: 16, fontWeight: 600, color: theme.text }, children: p.name ?? "" }),
20808
20823
  /* @__PURE__ */ jsxs(
20809
20824
  Box,
20810
20825
  {
@@ -836,6 +836,16 @@ function BrowserBar() {
836
836
  }
837
837
  );
838
838
  }
839
+ function mayOverflow(name, width) {
840
+ let w = 0;
841
+ for (const ch of name) {
842
+ if (ch.charCodeAt(0) >= 128 || /[MWmw@%&]/.test(ch)) w += 16.5;
843
+ else if (/[A-Z]/.test(ch)) w += 12.5;
844
+ else if (/[ .,:;'!|il1jft()[\]{}"`-]/.test(ch)) w += 8.5;
845
+ else w += 11;
846
+ }
847
+ return w > width;
848
+ }
839
849
  function Screen({ element, children }) {
840
850
  const p = element.props;
841
851
  const s = screenSize(p);
@@ -851,7 +861,12 @@ function Screen({ element, children }) {
851
861
  else body.push(c);
852
862
  }
853
863
  return /* @__PURE__ */ jsxs(Box, { style: { flexDirection: "column", flexShrink: 0 }, children: [
854
- /* @__PURE__ */ jsx(Box, { style: { height: LABEL_H, fontSize: 16, fontWeight: 600, color: theme.text }, children: p.name ?? "" }),
864
+ mayOverflow(p.name ?? "", s.width) ? (
865
+ // the board's layout sizes each column by its screen, so a name that may be wider than the
866
+ // screen gets the screen's width and ends in "…" instead of widening the column. Only then:
867
+ // the clip changes how the text is antialiased, and names that fit should render as before.
868
+ /* @__PURE__ */ jsx(Box, { style: { width: s.width, height: LABEL_H, fontSize: 16, fontWeight: 600, color: theme.text }, children: /* @__PURE__ */ jsx("div", { style: { overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, children: p.name }) })
869
+ ) : /* @__PURE__ */ jsx(Box, { style: { height: LABEL_H, fontSize: 16, fontWeight: 600, color: theme.text }, children: p.name ?? "" }),
855
870
  /* @__PURE__ */ jsxs(
856
871
  Box,
857
872
  {
@@ -6,7 +6,7 @@ import {
6
6
  componentDefinitions,
7
7
  iconNames,
8
8
  takesUniversalProps
9
- } from "./chunk-H4Y6VBEX.js";
9
+ } from "./chunk-BSE346UI.js";
10
10
 
11
11
  // src/playground/language-data.ts
12
12
  function unwrap(t) {
package/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  printWireframeText,
7
7
  renderWireframe,
8
8
  wireframePrompt
9
- } from "./chunks/chunk-H4Y6VBEX.js";
9
+ } from "./chunks/chunk-BSE346UI.js";
10
10
 
11
11
  // src/cli.ts
12
12
  import { readFile, writeFile } from "node:fs/promises";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  languageData
3
- } from "./chunks/chunk-2FU5Z5ON.js";
3
+ } from "./chunks/chunk-XWGHLFRX.js";
4
4
  import {
5
5
  DEVICES,
6
6
  RENAMED_PROPS,
@@ -24,7 +24,7 @@ import {
24
24
  upgradeSpec,
25
25
  upgradeWireframe,
26
26
  wireframePrompt
27
- } from "./chunks/chunk-H4Y6VBEX.js";
27
+ } from "./chunks/chunk-BSE346UI.js";
28
28
 
29
29
  // src/deflate.ts
30
30
  import { deflateRawSync, inflateRawSync } from "node:zlib";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  languageData
3
- } from "../chunks/chunk-2FU5Z5ON.js";
3
+ } from "../chunks/chunk-XWGHLFRX.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-H4Y6VBEX.js";
12
+ } from "../chunks/chunk-BSE346UI.js";
13
13
 
14
14
  // src/playground/index.ts
15
15
  import { createServer } from "node:http";