tsquare 0.13.2 → 0.14.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsquare",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
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",
@@ -112,5 +112,5 @@
112
112
  "tsx": "^4.23.15",
113
113
  "typescript": "^7.0.2"
114
114
  },
115
- "gitHead": "724cb5fa44cbf867738f22141f1f8acb3973d04a"
115
+ "gitHead": "b508fbc1a540812092517ebca462e8b29fca6f79"
116
116
  }
@@ -1,65 +0,0 @@
1
- import {
2
- ACCENTS,
3
- PRIMARY_PROP,
4
- UNIVERSAL_PROPS,
5
- bareWords,
6
- componentDefinitions,
7
- iconNames,
8
- takesUniversalProps
9
- } from "./chunk-QYGOXTAG.js";
10
-
11
- // src/playground/language-data.ts
12
- function unwrap(t) {
13
- let cur = t;
14
- while (cur && ["optional", "nullable", "default"].includes(cur.def?.type)) cur = cur.def.innerType;
15
- return cur;
16
- }
17
- function describe(name, schema) {
18
- const s = unwrap(schema);
19
- const description = schema.description ?? s?.description;
20
- const iconish = /Lucide icon|Icon names/i.test(description ?? "");
21
- switch (s?.def?.type) {
22
- case "enum":
23
- return { name, kind: "enum", values: s.options, description };
24
- case "boolean":
25
- return { name, kind: "boolean", values: ["true", "false"], description };
26
- case "number":
27
- return { name, kind: "number", description };
28
- case "array": {
29
- const el = unwrap(s.def.element);
30
- const objects = el?.def?.type === "union" ? el.def.options.map(unwrap) : [el];
31
- const hasIcon = objects.some((x) => x?.def?.type === "object" && "icon" in x.shape);
32
- return { name, kind: "list", icon: iconish || hasIcon, description };
33
- }
34
- case "object":
35
- return { name, kind: "object", description };
36
- default:
37
- return { name, kind: "string", icon: iconish || void 0, accent: name === "accent" || void 0, description };
38
- }
39
- }
40
- var cache = null;
41
- function languageData() {
42
- if (cache) return cache;
43
- const components = Object.entries(componentDefinitions).map(([type, def]) => {
44
- const shape = def.props.shape;
45
- const props = Object.entries(shape).map(([name, schema]) => describe(name, schema));
46
- if (takesUniversalProps(type)) for (const [name, schema] of Object.entries(UNIVERSAL_PROPS)) props.push(describe(name, schema));
47
- if (type === "Icon") props.find((p) => p.name === "name").icon = true;
48
- const words = bareWords(type);
49
- const off = words.booleans.flatMap((b) => b === "on" ? ["off"] : b === "checked" ? ["unchecked"] : [`no-${b}`]);
50
- return {
51
- name: type.toLowerCase(),
52
- description: def.description,
53
- main: PRIMARY_PROP[type],
54
- children: def.slots.length > 0,
55
- props,
56
- words: [...words.options.map((o) => o.value), ...words.booleans, ...off]
57
- };
58
- });
59
- cache = { components, icons: [...new Set(iconNames)].sort(), accents: Object.keys(ACCENTS) };
60
- return cache;
61
- }
62
-
63
- export {
64
- languageData
65
- };