@startsimpli/ui 0.4.142 → 0.4.144

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": "@startsimpli/ui",
3
- "version": "0.4.142",
3
+ "version": "0.4.144",
4
4
  "description": "Shared UI components package for StartSimpli applications",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -33,7 +33,8 @@
33
33
  "./terminal/styles": "./src/components/terminal/xterm.css",
34
34
  "./session": "./src/components/session/index.ts",
35
35
  "./session-console": "./src/components/session/AgentSessionConsole.tsx",
36
- "./tailwind": "./tailwind.preset.js"
36
+ "./tailwind": "./tailwind.preset.js",
37
+ "./track-changes": "./src/components/track-changes/index.ts"
37
38
  },
38
39
  "files": [
39
40
  "src",
@@ -49,6 +50,11 @@
49
50
  "next": "^14.0.0 || ^15.0.0 || ^16.0.0",
50
51
  "react": "^18.0.0 || ^19.0.0",
51
52
  "react-dom": "^18.0.0 || ^19.0.0",
53
+ "@codemirror/commands": "^6.0.0",
54
+ "@codemirror/lang-markdown": "^6.0.0",
55
+ "@codemirror/language": "^6.0.0",
56
+ "@codemirror/state": "^6.0.0",
57
+ "@codemirror/view": "^6.0.0",
52
58
  "@startsimpli/api": "^0.5.66",
53
59
  "@startsimpli/auth": "^0.4.38",
54
60
  "@startsimpli/i18n": "^0.1.3"
@@ -68,17 +74,25 @@
68
74
  },
69
75
  "@tanstack/react-query": {
70
76
  "optional": true
77
+ },
78
+ "@codemirror/commands": {
79
+ "optional": true
80
+ },
81
+ "@codemirror/lang-markdown": {
82
+ "optional": true
83
+ },
84
+ "@codemirror/language": {
85
+ "optional": true
86
+ },
87
+ "@codemirror/state": {
88
+ "optional": true
89
+ },
90
+ "@codemirror/view": {
91
+ "optional": true
71
92
  }
72
93
  },
73
94
  "dependencies": {
74
95
  "@hello-pangea/dnd": "^18.0.1",
75
- "@types/dagre": "^0.7.52",
76
- "@types/react-big-calendar": "^1.16.3",
77
- "@types/react-syntax-highlighter": "^15.5.13",
78
- "@xterm/addon-fit": "^0.10.0",
79
- "@xyflow/react": "^12.10.2",
80
- "dagre": "^0.8.5",
81
- "xterm": "^5.3.0",
82
96
  "@radix-ui/react-accordion": "^1.2.12",
83
97
  "@radix-ui/react-checkbox": "^1.3.3",
84
98
  "@radix-ui/react-collapsible": "^1.1.12",
@@ -93,8 +107,14 @@
93
107
  "@radix-ui/react-slot": "^1.2.4",
94
108
  "@radix-ui/react-tabs": "^1.1.13",
95
109
  "@radix-ui/react-tooltip": "^1.2.8",
110
+ "@types/dagre": "^0.7.52",
111
+ "@types/react-big-calendar": "^1.16.3",
112
+ "@types/react-syntax-highlighter": "^15.5.13",
113
+ "@xterm/addon-fit": "^0.10.0",
114
+ "@xyflow/react": "^12.10.2",
96
115
  "class-variance-authority": "^0.7.1",
97
116
  "clsx": "^2.1.1",
117
+ "dagre": "^0.8.5",
98
118
  "date-fns": "^3.6.0",
99
119
  "dompurify": "^3.4.1",
100
120
  "lucide-react": "^0.408.0",
@@ -106,9 +126,15 @@
106
126
  "remark-gfm": "^4.0.1",
107
127
  "tailwind-merge": "^2.6.1",
108
128
  "tailwindcss-animate": "^1.0.7",
109
- "xlsx": "^0.18.5"
129
+ "xlsx": "^0.18.5",
130
+ "xterm": "^5.3.0"
110
131
  },
111
132
  "devDependencies": {
133
+ "@codemirror/commands": "^6.11.1",
134
+ "@codemirror/lang-markdown": "^6.5.2",
135
+ "@codemirror/language": "^6.13.1",
136
+ "@codemirror/state": "^6.7.6",
137
+ "@codemirror/view": "^6.43.14",
112
138
  "@swc/core": "^1.15.30",
113
139
  "@swc/jest": "^0.2.39",
114
140
  "@tanstack/react-query": "^5.99.2",
@@ -126,8 +152,8 @@
126
152
  "tailwindcss": "^3.4.19",
127
153
  "tsup": "^8.5.1",
128
154
  "typescript": "^6.0.3",
129
- "@startsimpli/i18n": "0.1.3",
130
- "@startsimpli/realtime": "0.0.2"
155
+ "@startsimpli/realtime": "0.0.2",
156
+ "@startsimpli/i18n": "0.1.3"
131
157
  },
132
158
  "keywords": [
133
159
  "ui",
@@ -22,6 +22,23 @@ export interface MarkdownRendererProps {
22
22
  /** Syntax-highlighting style for fenced code blocks. Default `"light"`. */
23
23
  theme?: 'light' | 'dark'
24
24
  className?: string
25
+ /**
26
+ * Extra rehype plugins, run after GFM. The seam the track-changes Read view
27
+ * uses to draw marks by source position (bd startsim-whwxd.3); absent, the
28
+ * renderer is exactly what it was.
29
+ */
30
+ rehypePlugins?: React.ComponentProps<typeof ReactMarkdown>['rehypePlugins']
31
+ }
32
+
33
+ /** The plain text of rendered children. With a rehype plugin wrapping text
34
+ * runs (track-changes marks), a heading's children are elements, and
35
+ * `String(children)` would give every heading the id `object-object`. */
36
+ function textOf(node: React.ReactNode): string {
37
+ if (node == null || typeof node === 'boolean') return ''
38
+ if (typeof node === 'string' || typeof node === 'number') return String(node)
39
+ if (Array.isArray(node)) return node.map(textOf).join('')
40
+ if (React.isValidElement(node)) return textOf((node.props as { children?: React.ReactNode }).children)
41
+ return ''
25
42
  }
26
43
 
27
44
  function slugify(text: string): string {
@@ -31,7 +48,7 @@ function slugify(text: string): string {
31
48
  .replace(/(^-|-$)/g, '')
32
49
  }
33
50
 
34
- export function MarkdownRenderer({ content, theme = 'light', className }: MarkdownRendererProps) {
51
+ export function MarkdownRenderer({ content, theme = 'light', className, rehypePlugins }: MarkdownRendererProps) {
35
52
  // Wide GFM tables and long code lines both scroll sideways, and on macOS
36
53
  // neither said so (startsim-5pq7h.1).
37
54
  useScrollAffordance()
@@ -47,25 +64,26 @@ export function MarkdownRenderer({ content, theme = 'light', className }: Markdo
47
64
  <div className={cn('prose prose-lg max-w-none', className)}>
48
65
  <ReactMarkdown
49
66
  remarkPlugins={[remarkGfm]}
67
+ {...(rehypePlugins ? { rehypePlugins } : {})}
50
68
  components={{
51
69
  // h1 in content renders as h2 — the page template owns the real <h1>.
52
70
  h1: ({ children, ...props }) => (
53
- <h2 id={slugify(String(children ?? ''))} className="text-3xl font-heading font-semibold mb-4 mt-10 first:mt-0 text-foreground scroll-mt-8" {...props}>
71
+ <h2 id={slugify(textOf(children))} className="text-3xl font-heading font-semibold mb-4 mt-10 first:mt-0 text-foreground scroll-mt-8" {...props}>
54
72
  {children}
55
73
  </h2>
56
74
  ),
57
75
  h2: ({ children, ...props }) => (
58
- <h2 id={slugify(String(children ?? ''))} className="text-3xl font-heading font-semibold mb-4 mt-10 first:mt-0 text-foreground scroll-mt-8" {...props}>
76
+ <h2 id={slugify(textOf(children))} className="text-3xl font-heading font-semibold mb-4 mt-10 first:mt-0 text-foreground scroll-mt-8" {...props}>
59
77
  {children}
60
78
  </h2>
61
79
  ),
62
80
  h3: ({ children, ...props }) => (
63
- <h3 id={slugify(String(children ?? ''))} className="text-2xl font-heading font-semibold mb-3 mt-8 first:mt-0 text-foreground scroll-mt-8" {...props}>
81
+ <h3 id={slugify(textOf(children))} className="text-2xl font-heading font-semibold mb-3 mt-8 first:mt-0 text-foreground scroll-mt-8" {...props}>
64
82
  {children}
65
83
  </h3>
66
84
  ),
67
85
  h4: ({ children, ...props }) => (
68
- <h4 id={slugify(String(children ?? ''))} className="text-xl font-heading font-semibold mb-2 mt-6 first:mt-0 text-foreground scroll-mt-8" {...props}>
86
+ <h4 id={slugify(textOf(children))} className="text-xl font-heading font-semibold mb-2 mt-6 first:mt-0 text-foreground scroll-mt-8" {...props}>
69
87
  {children}
70
88
  </h4>
71
89
  ),