@petrarca/sonnet-ui 0.7.0 → 0.9.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": "@petrarca/sonnet-ui",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "UI primitives, data components, and table schema system for the Petrarca Sonnet component library",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -18,59 +18,76 @@
18
18
  "import": "./dist/json-editor/index.js",
19
19
  "types": "./dist/json-editor/index.d.ts"
20
20
  },
21
+ "./markdown": {
22
+ "import": "./dist/markdown/index.js",
23
+ "types": "./dist/markdown/index.d.ts"
24
+ },
25
+ "./code-editor": {
26
+ "import": "./dist/code-editor/index.js",
27
+ "types": "./dist/code-editor/index.d.ts"
28
+ },
21
29
  "./styles.css": "./styles.css",
22
- "./tailwind-preset": "./tailwind-preset.js"
30
+ "./tailwind-preset": "./tailwind-preset.js",
31
+ "./tailwind-content": "./tailwind-content.cjs"
23
32
  },
24
33
  "files": [
25
34
  "dist",
26
35
  "styles.css",
27
- "tailwind-preset.js"
36
+ "tailwind-preset.js",
37
+ "tailwind-content.cjs"
28
38
  ],
29
39
  "dependencies": {
30
- "@radix-ui/react-avatar": "^1.1.11",
31
- "@radix-ui/react-checkbox": "^1.3.3",
32
- "@radix-ui/react-collapsible": "^1.1.12",
33
- "@radix-ui/react-dialog": "^1.1.15",
34
- "@radix-ui/react-dropdown-menu": "^2.1.16",
35
- "@radix-ui/react-label": "^2.1.8",
36
- "@radix-ui/react-popover": "^1.1.15",
37
- "@radix-ui/react-scroll-area": "^1.2.10",
38
- "@radix-ui/react-select": "^2.3.3",
39
- "@radix-ui/react-separator": "^1.1.8",
40
- "@radix-ui/react-slot": "^1.2.4",
41
- "@radix-ui/react-tabs": "^1.1.13",
42
- "@radix-ui/react-tooltip": "^1.2.8",
40
+ "@radix-ui/react-avatar": "^1.3.1",
41
+ "@radix-ui/react-checkbox": "^1.4.1",
42
+ "@radix-ui/react-collapsible": "^1.2.1",
43
+ "@radix-ui/react-dialog": "^1.3.1",
44
+ "@radix-ui/react-dropdown-menu": "^2.2.1",
45
+ "@radix-ui/react-label": "^2.1.17",
46
+ "@radix-ui/react-popover": "^1.3.1",
47
+ "@radix-ui/react-scroll-area": "^1.4.0",
48
+ "@radix-ui/react-select": "^2.4.1",
49
+ "@radix-ui/react-separator": "^1.2.0",
50
+ "@radix-ui/react-slot": "^1.5.0",
51
+ "@radix-ui/react-tabs": "^1.2.1",
52
+ "@radix-ui/react-tooltip": "^1.4.1",
43
53
  "@tanstack/react-table": "^8.21.3",
54
+ "@tanstack/react-virtual": "^3.14.25",
44
55
  "class-variance-authority": "^0.7.1",
45
56
  "cmdk": "^1.1.1",
46
57
  "lucide-react": "^0.553.0",
47
- "radix-ui": "^1.4.3",
58
+ "radix-ui": "^1.8.1",
48
59
  "react-json-tree": "0.20.0",
60
+ "rehype-slug": "^6.0.0",
49
61
  "zustand": "5.0.8",
50
- "@petrarca/sonnet-core": "0.7.0"
62
+ "@petrarca/sonnet-core": "0.9.0"
51
63
  },
52
64
  "peerDependencies": {
53
65
  "@codemirror/lang-json": ">=6",
66
+ "@codemirror/language": ">=6",
67
+ "@codemirror/language-data": ">=6",
54
68
  "@codemirror/state": ">=6",
55
69
  "@codemirror/view": ">=6",
70
+ "@lezer/highlight": ">=1",
56
71
  "@tailwindcss/typography": ">=0.5",
57
72
  "@uiw/react-codemirror": ">=4",
73
+ "mermaid": ">=11",
58
74
  "react": ">=19",
59
75
  "react-dom": ">=19",
76
+ "streamdown": ">=2",
60
77
  "tailwindcss": ">=3",
61
78
  "tailwindcss-animate": ">=1"
62
79
  },
63
80
  "devDependencies": {
64
- "@types/react": "^19.0.0",
65
- "@types/react-dom": "^19.0.0",
66
- "tsup": "^8.4.0",
67
- "typescript": "^5.9.2"
81
+ "@types/react": "^19.3.0",
82
+ "@types/react-dom": "^19.3.0",
83
+ "tsup": "^9.0.0",
84
+ "typescript": "^5.9.3"
68
85
  },
69
86
  "scripts": {
70
87
  "build": "tsup",
71
88
  "dev": "tsup --watch",
72
89
  "typecheck": "tsc --noEmit",
73
- "test": "vitest run",
90
+ "test": "vitest run --config ../../vitest.config.ts",
74
91
  "clean": "rm -rf dist *.tsbuildinfo"
75
92
  }
76
93
  }
package/styles.css CHANGED
@@ -59,6 +59,29 @@
59
59
 
60
60
  /* Layout */
61
61
  --radius: 0.5rem;
62
+
63
+ /* JSON syntax highlighting (sonnet-core formatJsonValue) */
64
+ --json-key: #2563eb;
65
+ --json-string: #16a34a;
66
+ --json-number: #ea580c;
67
+ --json-boolean: #2563eb;
68
+ --json-null: #64748b;
69
+ --json-punctuation: #475569;
70
+ --json-fallback: #6b7280;
71
+
72
+ /* Code syntax highlighting (CodeEditor) */
73
+ --code-keyword: #7c3aed;
74
+ --code-string: #16a34a;
75
+ --code-number: #ea580c;
76
+ --code-comment: #6b7280;
77
+ --code-function: #2563eb;
78
+ --code-type: #0891b2;
79
+ --code-property: #1d4ed8;
80
+ --code-operator: #475569;
81
+ --code-meta: #9333ea;
82
+ --code-heading: #1e40af;
83
+ --code-link: #2563eb;
84
+ --code-invalid: #dc2626;
62
85
  }
63
86
 
64
87
  /* ── Design tokens: dark theme ───────────────────────────────────── */
@@ -102,6 +125,29 @@
102
125
 
103
126
  /* Focus */
104
127
  --ring: 218 65% 58%;
128
+
129
+ /* JSON syntax highlighting */
130
+ --json-key: #60a5fa;
131
+ --json-string: #4ade80;
132
+ --json-number: #fb923c;
133
+ --json-boolean: #60a5fa;
134
+ --json-null: #94a3b8;
135
+ --json-punctuation: #94a3b8;
136
+ --json-fallback: #9ca3af;
137
+
138
+ /* Code syntax highlighting */
139
+ --code-keyword: #c084fc;
140
+ --code-string: #4ade80;
141
+ --code-number: #fb923c;
142
+ --code-comment: #94a3b8;
143
+ --code-function: #60a5fa;
144
+ --code-type: #22d3ee;
145
+ --code-property: #93c5fd;
146
+ --code-operator: #cbd5e1;
147
+ --code-meta: #e879f9;
148
+ --code-heading: #93c5fd;
149
+ --code-link: #60a5fa;
150
+ --code-invalid: #f87171;
105
151
  }
106
152
  }
107
153
 
@@ -0,0 +1,30 @@
1
+ // @petrarca/sonnet-ui -- Tailwind content for the packages sonnet-ui renders
2
+ // with. Tailwind does not merge `content` from a preset, so an app adds these
3
+ // to its own:
4
+ //
5
+ // module.exports = {
6
+ // presets: [require("@petrarca/sonnet-ui/tailwind-preset")],
7
+ // content: [
8
+ // "./src/**/*.{ts,tsx}",
9
+ // "./node_modules/@petrarca/sonnet-*/dist/**/*.js",
10
+ // ...require("@petrarca/sonnet-ui/tailwind-content"),
11
+ // ],
12
+ // };
13
+ //
14
+ // Today: Streamdown, which the MarkdownViewer (./markdown) renders with and
15
+ // which styles itself with Tailwind classes. Each package is found from here,
16
+ // wherever the package manager put it; one that is not installed is left out.
17
+
18
+ const path = require("path");
19
+
20
+ // A package's built files, found through a file it exports.
21
+ function distOf(pkg, exportedFile) {
22
+ try {
23
+ const root = path.dirname(require.resolve(`${pkg}/${exportedFile}`));
24
+ return path.join(root, "dist", "**", "*.js");
25
+ } catch {
26
+ return null;
27
+ }
28
+ }
29
+
30
+ module.exports = [distOf("streamdown", "styles.css")].filter(Boolean);