tsquare 0.3.0 → 0.3.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/dist/share.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  /** Largest decoded text accepted, in bytes. Plenty for a board; stops a tiny URL from inflating into megabytes. */
2
2
  export declare const MAX_SHARED_TEXT = 64000;
3
3
  export declare function encodeWireframe(text: string): string;
4
+ /**
5
+ * The wireframe a link carries, upgraded to the current language: a link made
6
+ * by an older version means today what it meant then (see upgrade.ts).
7
+ */
4
8
  export declare function decodeWireframe(data: string): string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Everything tsquare does for wireframes written in an older version of the
3
+ * language, kept in one place so the parser, catalog and renderer only know
4
+ * the current language.
5
+ *
6
+ * upgradeWireframe(text) always-safe rewrites (renamed props);
7
+ * compileWireframe runs it first
8
+ * upgradeWireframe(text, { fromLink: true }) also the rules for text that came
9
+ * from a link made by an older version;
10
+ * decodeWireframe runs it
11
+ * upgradeSpec(spec) the renames, for JSON specs
12
+ *
13
+ * Rewrites keep every line where it was (except moving a comment onto its own
14
+ * line, which only happens for links), so problems still point at the right line.
15
+ *
16
+ * Adding an upgrade: a rename goes in RENAMED_PROPS. A change in meaning goes
17
+ * here only if old text can be recognised without guessing; otherwise new links
18
+ * get a new prefix letter in share.ts and the upgrade applies to the old letter.
19
+ */
20
+ /** Props renamed in 0.3.0. The prompt, docs and autocomplete only teach the new names; `tsquare fmt` rewrites old ones. */
21
+ export declare const RENAMED_PROPS: Record<string, Record<string, string>>;
22
+ export interface UpgradeOptions {
23
+ /** The text came from a link (share link or render URL), which may predate 0.3.0. */
24
+ fromLink?: boolean;
25
+ }
26
+ /** Rewrites older syntax to the current language. Text that's already current comes back unchanged. */
27
+ export declare function upgradeWireframe(text: string, options?: UpgradeOptions): string;
28
+ /** The renames, for a JSON spec. In place; safe to call more than once. */
29
+ export declare function upgradeSpec<S extends {
30
+ elements: Record<string, {
31
+ type: string;
32
+ props?: Record<string, unknown>;
33
+ }>;
34
+ }>(spec: S): S;
35
+ /**
36
+ * Components whose main text may be a plain word (`avatar JD`, `icon search`), the parser's
37
+ * WORD_PRIMARY. Neither has option words, so their first plain word is always the main text.
38
+ * Kept here rather than imported, so the playground's browser bundle doesn't pull in the parser
39
+ * and catalog; scripts/build.ts fails if this drifts from the parser.
40
+ */
41
+ export declare const PLAIN_WORD_MAIN_TEXT: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsquare",
3
- "version": "0.3.0",
3
+ "version": "0.3.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",
@@ -44,7 +44,8 @@
44
44
  "examples/*.tsq",
45
45
  "assets/mark.png",
46
46
  "LICENSE",
47
- "README.md"
47
+ "README.md",
48
+ "CHANGELOG.md"
48
49
  ],
49
50
  "engines": {
50
51
  "node": ">=20"
@@ -62,7 +63,8 @@
62
63
  "eval:prompts": "tsx eval/prompts.ts",
63
64
  "eval:score": "tsx eval/score.ts",
64
65
  "build": "tsx scripts/build.ts",
65
- "prepare": "npm run build"
66
+ "prepare": "npm run build",
67
+ "test": "tsx --test test/*.test.ts"
66
68
  },
67
69
  "dependencies": {
68
70
  "@fontsource/inter": "5.3.0",
@@ -142,6 +142,7 @@ Dropdown field (closed state).
142
142
  - label: string (main text)
143
143
  - value: string
144
144
  - placeholder: string
145
+ - grow: boolean — Fill the remaining space in a row
145
146
  - width: number | string — Fixed width, e.g. 320. Default fills the space.
146
147
 
147
148
  ### NavBar