tsquare 0.2.0 → 0.3.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/README.md +20 -6
- package/dist/catalog.d.ts +24 -8
- package/dist/chunks/{chunk-L6GTIZQH.js → chunk-YCIRLKKD.js} +389 -161
- package/dist/cli.js +1 -1
- package/dist/icons.d.ts +2 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +24 -1
- package/dist/playground/index.d.ts +12 -1
- package/dist/playground/index.html +180 -356
- package/dist/playground/index.js +100 -10
- package/dist/playground/language-data.d.ts +28 -0
- package/dist/playground/playground.js +50 -0
- package/dist/prompt.d.ts +1 -1
- package/dist/render.d.ts +21 -1
- package/dist/share.d.ts +8 -0
- package/dist/text.d.ts +6 -1
- package/dist/upgrade.d.ts +41 -0
- package/examples/checkout.tsq +15 -0
- package/examples/dashboard.tsq +27 -0
- package/examples/notes-mobile.tsq +9 -9
- package/examples/notes-web.tsq +6 -6
- package/examples/sign-in.tsq +14 -0
- package/examples/states.tsq +16 -0
- package/package.json +9 -1
- package/skill/tsquare/SKILL.md +3 -2
- package/skill/tsquare/reference.md +5 -4
package/dist/cli.js
CHANGED
package/dist/icons.d.ts
CHANGED
|
@@ -4,9 +4,8 @@ export declare const iconNames: string[];
|
|
|
4
4
|
export declare function iconNode(name: string): any;
|
|
5
5
|
export declare const isIcon: (name: string) => boolean;
|
|
6
6
|
/**
|
|
7
|
-
* Close matches for an unknown name:
|
|
8
|
-
* share a word with it ("cart" → shopping-cart
|
|
9
|
-
* There are no synonyms: "notification" won't find bell.
|
|
7
|
+
* Close matches for an unknown name: known guesses ("compose" → square-pen), near spellings
|
|
8
|
+
* ("serach" → search) and names that share a word with it ("cart" → shopping-cart).
|
|
10
9
|
*/
|
|
11
10
|
export declare function suggestIcons(name: string, limit?: number): string[];
|
|
12
11
|
export declare function unknownIconMessage(name: string): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
export { renderWireframe, compileWireframe, formatIssues, WireframeError, type CompileResult } from "./compile.js";
|
|
3
3
|
export { wireframePrompt, repairPrompt } from "./prompt.js";
|
|
4
4
|
export { printWireframeText as formatWireframe } from "./print.js";
|
|
5
|
-
export {
|
|
5
|
+
export { encodeWireframe, decodeWireframe, MAX_SHARED_TEXT } from "./share.js";
|
|
6
|
+
export { upgradeWireframe, upgradeSpec, RENAMED_PROPS, type UpgradeOptions } from "./upgrade.js";
|
|
7
|
+
export { renderWireframeSvg, renderWireframePng, checkSpec, boardSize, boardLayout, type BoardItem, type RenderWireframeOptions } from "./render.js";
|
|
6
8
|
export { parseWireframeText, type TextIssue, type ParseResult } from "./text.js";
|
|
7
9
|
export { catalog, componentDefinitions } from "./catalog.js";
|
|
8
10
|
export { registry } from "./components.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEVICES,
|
|
3
|
+
RENAMED_PROPS,
|
|
3
4
|
WireframeError,
|
|
5
|
+
boardLayout,
|
|
4
6
|
boardSize,
|
|
5
7
|
catalog,
|
|
6
8
|
checkSpec,
|
|
@@ -15,16 +17,35 @@ import {
|
|
|
15
17
|
renderWireframeSvg,
|
|
16
18
|
repairPrompt,
|
|
17
19
|
theme,
|
|
20
|
+
upgradeSpec,
|
|
21
|
+
upgradeWireframe,
|
|
18
22
|
wireframePrompt
|
|
19
|
-
} from "./chunks/chunk-
|
|
23
|
+
} from "./chunks/chunk-YCIRLKKD.js";
|
|
24
|
+
|
|
25
|
+
// src/share.ts
|
|
26
|
+
import { deflateRawSync, inflateRawSync } from "node:zlib";
|
|
27
|
+
var MAX_SHARED_TEXT = 64e3;
|
|
28
|
+
function encodeWireframe(text) {
|
|
29
|
+
return "z" + deflateRawSync(Buffer.from(text, "utf8"), { level: 9 }).toString("base64url");
|
|
30
|
+
}
|
|
31
|
+
function decodeWireframe(data) {
|
|
32
|
+
if (!data.startsWith("z")) throw new Error(`unknown encoding "${data.slice(0, 1)}" (expected a "z" prefix)`);
|
|
33
|
+
const text = inflateRawSync(Buffer.from(data.slice(1), "base64url"), { maxOutputLength: MAX_SHARED_TEXT }).toString("utf8");
|
|
34
|
+
return upgradeWireframe(text, { fromLink: true });
|
|
35
|
+
}
|
|
20
36
|
export {
|
|
21
37
|
DEVICES,
|
|
38
|
+
MAX_SHARED_TEXT,
|
|
39
|
+
RENAMED_PROPS,
|
|
22
40
|
WireframeError,
|
|
41
|
+
boardLayout,
|
|
23
42
|
boardSize,
|
|
24
43
|
catalog,
|
|
25
44
|
checkSpec,
|
|
26
45
|
compileWireframe,
|
|
27
46
|
componentDefinitions,
|
|
47
|
+
decodeWireframe,
|
|
48
|
+
encodeWireframe,
|
|
28
49
|
formatIssues,
|
|
29
50
|
printWireframeText as formatWireframe,
|
|
30
51
|
parseWireframeText,
|
|
@@ -34,5 +55,7 @@ export {
|
|
|
34
55
|
renderWireframeSvg,
|
|
35
56
|
repairPrompt,
|
|
36
57
|
theme,
|
|
58
|
+
upgradeSpec,
|
|
59
|
+
upgradeWireframe,
|
|
37
60
|
wireframePrompt
|
|
38
61
|
};
|
|
@@ -8,16 +8,27 @@
|
|
|
8
8
|
* `createPlaygroundHandler`:
|
|
9
9
|
*
|
|
10
10
|
* GET / the page
|
|
11
|
+
* GET /playground.js the page's script (CodeMirror editor and UI), bundled by the build
|
|
11
12
|
* GET /mark.png the logo mark (tab icon, header)
|
|
13
|
+
* GET /api/language what the editor needs to highlight and autocomplete
|
|
12
14
|
* GET /api/reference components, props and rendered examples
|
|
13
15
|
* GET /api/examples the example wireframes
|
|
14
16
|
* GET /api/prompt the model prompt
|
|
15
|
-
* POST /api/render wireframe text → { issues, svg? }
|
|
17
|
+
* POST /api/render wireframe text → { issues, svg?, width?, height?, items? } (items: where each screen sits)
|
|
16
18
|
* POST /api/png?scale=2 wireframe text → image/png
|
|
17
19
|
*/
|
|
18
20
|
import { type IncomingMessage, type ServerResponse } from "node:http";
|
|
19
21
|
/** Problems with the reference examples: a component without an example or group, or an example that doesn't compile. */
|
|
20
22
|
export declare function checkReferenceExamples(): string[];
|
|
23
|
+
/** esbuild options for the browser bundle; shared with scripts/build.ts. */
|
|
24
|
+
export declare const PLAYGROUND_BUNDLE: {
|
|
25
|
+
bundle: boolean;
|
|
26
|
+
format: "esm";
|
|
27
|
+
platform: "browser";
|
|
28
|
+
target: string;
|
|
29
|
+
minify: boolean;
|
|
30
|
+
legalComments: "eof";
|
|
31
|
+
};
|
|
21
32
|
/**
|
|
22
33
|
* Handles a playground request. Resolves to false when the path isn't a
|
|
23
34
|
* playground route, so a host server can serve its own routes around it.
|