@molecule/app-ide-react 1.0.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.
Files changed (250) hide show
  1. package/LICENSE +115 -0
  2. package/dist/chatTimelineOrdering.d.ts +50 -0
  3. package/dist/chatTimelineOrdering.d.ts.map +1 -0
  4. package/dist/chatTimelineOrdering.js +46 -0
  5. package/dist/chatTimelineOrdering.js.map +1 -0
  6. package/dist/command-metadata.d.ts +78 -0
  7. package/dist/command-metadata.d.ts.map +1 -0
  8. package/dist/command-metadata.js +214 -0
  9. package/dist/command-metadata.js.map +1 -0
  10. package/dist/components/ActivityCard.d.ts +28 -0
  11. package/dist/components/ActivityCard.d.ts.map +1 -0
  12. package/dist/components/ActivityCard.js +62 -0
  13. package/dist/components/ActivityCard.js.map +1 -0
  14. package/dist/components/AutoCommitBadge.d.ts +58 -0
  15. package/dist/components/AutoCommitBadge.d.ts.map +1 -0
  16. package/dist/components/AutoCommitBadge.js +78 -0
  17. package/dist/components/AutoCommitBadge.js.map +1 -0
  18. package/dist/components/ChatPanel.d.ts +184 -0
  19. package/dist/components/ChatPanel.d.ts.map +1 -0
  20. package/dist/components/ChatPanel.js +6691 -0
  21. package/dist/components/ChatPanel.js.map +1 -0
  22. package/dist/components/CommandPalette.d.ts +18 -0
  23. package/dist/components/CommandPalette.d.ts.map +1 -0
  24. package/dist/components/CommandPalette.js +33 -0
  25. package/dist/components/CommandPalette.js.map +1 -0
  26. package/dist/components/DeviceFrameSelector.d.ts +60 -0
  27. package/dist/components/DeviceFrameSelector.d.ts.map +1 -0
  28. package/dist/components/DeviceFrameSelector.js +230 -0
  29. package/dist/components/DeviceFrameSelector.js.map +1 -0
  30. package/dist/components/EditorPanel.d.ts +17 -0
  31. package/dist/components/EditorPanel.d.ts.map +1 -0
  32. package/dist/components/EditorPanel.js +241 -0
  33. package/dist/components/EditorPanel.js.map +1 -0
  34. package/dist/components/FileExplorer.d.ts +64 -0
  35. package/dist/components/FileExplorer.d.ts.map +1 -0
  36. package/dist/components/FileExplorer.js +1111 -0
  37. package/dist/components/FileExplorer.js.map +1 -0
  38. package/dist/components/FileExplorerContextMenu.d.ts +37 -0
  39. package/dist/components/FileExplorerContextMenu.d.ts.map +1 -0
  40. package/dist/components/FileExplorerContextMenu.js +241 -0
  41. package/dist/components/FileExplorerContextMenu.js.map +1 -0
  42. package/dist/components/HelpCard.d.ts +34 -0
  43. package/dist/components/HelpCard.d.ts.map +1 -0
  44. package/dist/components/HelpCard.js +28 -0
  45. package/dist/components/HelpCard.js.map +1 -0
  46. package/dist/components/Icon.d.ts +50 -0
  47. package/dist/components/Icon.d.ts.map +1 -0
  48. package/dist/components/Icon.js +25 -0
  49. package/dist/components/Icon.js.map +1 -0
  50. package/dist/components/KeyboardShortcutsPanel.d.ts +19 -0
  51. package/dist/components/KeyboardShortcutsPanel.d.ts.map +1 -0
  52. package/dist/components/KeyboardShortcutsPanel.js +187 -0
  53. package/dist/components/KeyboardShortcutsPanel.js.map +1 -0
  54. package/dist/components/MarkdownContent.d.ts +52 -0
  55. package/dist/components/MarkdownContent.d.ts.map +1 -0
  56. package/dist/components/MarkdownContent.js +303 -0
  57. package/dist/components/MarkdownContent.js.map +1 -0
  58. package/dist/components/ModelsTable.d.ts +38 -0
  59. package/dist/components/ModelsTable.d.ts.map +1 -0
  60. package/dist/components/ModelsTable.js +96 -0
  61. package/dist/components/ModelsTable.js.map +1 -0
  62. package/dist/components/PreviewPanel.d.ts +66 -0
  63. package/dist/components/PreviewPanel.d.ts.map +1 -0
  64. package/dist/components/PreviewPanel.js +1752 -0
  65. package/dist/components/PreviewPanel.js.map +1 -0
  66. package/dist/components/QuickOpen.d.ts +20 -0
  67. package/dist/components/QuickOpen.d.ts.map +1 -0
  68. package/dist/components/QuickOpen.js +72 -0
  69. package/dist/components/QuickOpen.js.map +1 -0
  70. package/dist/components/QuickPicker.d.ts +21 -0
  71. package/dist/components/QuickPicker.d.ts.map +1 -0
  72. package/dist/components/QuickPicker.js +174 -0
  73. package/dist/components/QuickPicker.js.map +1 -0
  74. package/dist/components/RelevantSkillSuggestion.d.ts +41 -0
  75. package/dist/components/RelevantSkillSuggestion.d.ts.map +1 -0
  76. package/dist/components/RelevantSkillSuggestion.js +85 -0
  77. package/dist/components/RelevantSkillSuggestion.js.map +1 -0
  78. package/dist/components/ReportModal.d.ts +35 -0
  79. package/dist/components/ReportModal.d.ts.map +1 -0
  80. package/dist/components/ReportModal.js +112 -0
  81. package/dist/components/ReportModal.js.map +1 -0
  82. package/dist/components/ResizeHandle.d.ts +21 -0
  83. package/dist/components/ResizeHandle.d.ts.map +1 -0
  84. package/dist/components/ResizeHandle.js +109 -0
  85. package/dist/components/ResizeHandle.js.map +1 -0
  86. package/dist/components/ScriptsCard.d.ts +37 -0
  87. package/dist/components/ScriptsCard.d.ts.map +1 -0
  88. package/dist/components/ScriptsCard.js +177 -0
  89. package/dist/components/ScriptsCard.js.map +1 -0
  90. package/dist/components/SearchPanel.d.ts +18 -0
  91. package/dist/components/SearchPanel.d.ts.map +1 -0
  92. package/dist/components/SearchPanel.js +449 -0
  93. package/dist/components/SearchPanel.js.map +1 -0
  94. package/dist/components/SettingsCard.d.ts +49 -0
  95. package/dist/components/SettingsCard.d.ts.map +1 -0
  96. package/dist/components/SettingsCard.js +59 -0
  97. package/dist/components/SettingsCard.js.map +1 -0
  98. package/dist/components/ShareModal.d.ts +32 -0
  99. package/dist/components/ShareModal.d.ts.map +1 -0
  100. package/dist/components/ShareModal.js +126 -0
  101. package/dist/components/ShareModal.js.map +1 -0
  102. package/dist/components/SidebarTabs.d.ts +18 -0
  103. package/dist/components/SidebarTabs.d.ts.map +1 -0
  104. package/dist/components/SidebarTabs.js +20 -0
  105. package/dist/components/SidebarTabs.js.map +1 -0
  106. package/dist/components/SkillsCard.d.ts +86 -0
  107. package/dist/components/SkillsCard.d.ts.map +1 -0
  108. package/dist/components/SkillsCard.js +227 -0
  109. package/dist/components/SkillsCard.js.map +1 -0
  110. package/dist/components/StreamingIndicator.d.ts +50 -0
  111. package/dist/components/StreamingIndicator.d.ts.map +1 -0
  112. package/dist/components/StreamingIndicator.js +142 -0
  113. package/dist/components/StreamingIndicator.js.map +1 -0
  114. package/dist/components/TabBar.d.ts +37 -0
  115. package/dist/components/TabBar.d.ts.map +1 -0
  116. package/dist/components/TabBar.js +187 -0
  117. package/dist/components/TabBar.js.map +1 -0
  118. package/dist/components/TipCard.d.ts +22 -0
  119. package/dist/components/TipCard.d.ts.map +1 -0
  120. package/dist/components/TipCard.js +73 -0
  121. package/dist/components/TipCard.js.map +1 -0
  122. package/dist/components/ToolCallCard.d.ts +18 -0
  123. package/dist/components/ToolCallCard.d.ts.map +1 -0
  124. package/dist/components/ToolCallCard.js +716 -0
  125. package/dist/components/ToolCallCard.js.map +1 -0
  126. package/dist/components/UserAvatar.d.ts +45 -0
  127. package/dist/components/UserAvatar.d.ts.map +1 -0
  128. package/dist/components/UserAvatar.js +80 -0
  129. package/dist/components/UserAvatar.js.map +1 -0
  130. package/dist/components/WorkspaceLayout.d.ts +19 -0
  131. package/dist/components/WorkspaceLayout.d.ts.map +1 -0
  132. package/dist/components/WorkspaceLayout.js +56 -0
  133. package/dist/components/WorkspaceLayout.js.map +1 -0
  134. package/dist/components/activity-utilities.d.ts +107 -0
  135. package/dist/components/activity-utilities.d.ts.map +1 -0
  136. package/dist/components/activity-utilities.js +154 -0
  137. package/dist/components/activity-utilities.js.map +1 -0
  138. package/dist/components/chat-autocommit-utilities.d.ts +172 -0
  139. package/dist/components/chat-autocommit-utilities.d.ts.map +1 -0
  140. package/dist/components/chat-autocommit-utilities.js +185 -0
  141. package/dist/components/chat-autocommit-utilities.js.map +1 -0
  142. package/dist/components/chat-card-style.d.ts +64 -0
  143. package/dist/components/chat-card-style.d.ts.map +1 -0
  144. package/dist/components/chat-card-style.js +74 -0
  145. package/dist/components/chat-card-style.js.map +1 -0
  146. package/dist/components/chat-commands.d.ts +17 -0
  147. package/dist/components/chat-commands.d.ts.map +1 -0
  148. package/dist/components/chat-commands.js +17 -0
  149. package/dist/components/chat-commands.js.map +1 -0
  150. package/dist/components/chat-commit-utilities.d.ts +29 -0
  151. package/dist/components/chat-commit-utilities.d.ts.map +1 -0
  152. package/dist/components/chat-commit-utilities.js +31 -0
  153. package/dist/components/chat-commit-utilities.js.map +1 -0
  154. package/dist/components/chat-cost-utilities.d.ts +62 -0
  155. package/dist/components/chat-cost-utilities.d.ts.map +1 -0
  156. package/dist/components/chat-cost-utilities.js +66 -0
  157. package/dist/components/chat-cost-utilities.js.map +1 -0
  158. package/dist/components/chat-effort-utilities.d.ts +96 -0
  159. package/dist/components/chat-effort-utilities.d.ts.map +1 -0
  160. package/dist/components/chat-effort-utilities.js +97 -0
  161. package/dist/components/chat-effort-utilities.js.map +1 -0
  162. package/dist/components/chat-help-utilities.d.ts +89 -0
  163. package/dist/components/chat-help-utilities.d.ts.map +1 -0
  164. package/dist/components/chat-help-utilities.js +131 -0
  165. package/dist/components/chat-help-utilities.js.map +1 -0
  166. package/dist/components/chat-model-mode-utilities.d.ts +143 -0
  167. package/dist/components/chat-model-mode-utilities.d.ts.map +1 -0
  168. package/dist/components/chat-model-mode-utilities.js +191 -0
  169. package/dist/components/chat-model-mode-utilities.js.map +1 -0
  170. package/dist/components/chat-models-utilities.d.ts +98 -0
  171. package/dist/components/chat-models-utilities.d.ts.map +1 -0
  172. package/dist/components/chat-models-utilities.js +136 -0
  173. package/dist/components/chat-models-utilities.js.map +1 -0
  174. package/dist/components/chat-report-utilities.d.ts +149 -0
  175. package/dist/components/chat-report-utilities.d.ts.map +1 -0
  176. package/dist/components/chat-report-utilities.js +151 -0
  177. package/dist/components/chat-report-utilities.js.map +1 -0
  178. package/dist/components/chat-scripts-utilities.d.ts +140 -0
  179. package/dist/components/chat-scripts-utilities.d.ts.map +1 -0
  180. package/dist/components/chat-scripts-utilities.js +158 -0
  181. package/dist/components/chat-scripts-utilities.js.map +1 -0
  182. package/dist/components/chat-settings-utilities.d.ts +72 -0
  183. package/dist/components/chat-settings-utilities.d.ts.map +1 -0
  184. package/dist/components/chat-settings-utilities.js +56 -0
  185. package/dist/components/chat-settings-utilities.js.map +1 -0
  186. package/dist/components/chat-share-utilities.d.ts +104 -0
  187. package/dist/components/chat-share-utilities.d.ts.map +1 -0
  188. package/dist/components/chat-share-utilities.js +90 -0
  189. package/dist/components/chat-share-utilities.js.map +1 -0
  190. package/dist/components/chat-skills-utilities.d.ts +242 -0
  191. package/dist/components/chat-skills-utilities.d.ts.map +1 -0
  192. package/dist/components/chat-skills-utilities.js +433 -0
  193. package/dist/components/chat-skills-utilities.js.map +1 -0
  194. package/dist/components/chat-stream-utilities.d.ts +74 -0
  195. package/dist/components/chat-stream-utilities.d.ts.map +1 -0
  196. package/dist/components/chat-stream-utilities.js +103 -0
  197. package/dist/components/chat-stream-utilities.js.map +1 -0
  198. package/dist/components/chat-tips-utilities.d.ts +108 -0
  199. package/dist/components/chat-tips-utilities.d.ts.map +1 -0
  200. package/dist/components/chat-tips-utilities.js +137 -0
  201. package/dist/components/chat-tips-utilities.js.map +1 -0
  202. package/dist/components/device-cycle.d.ts +84 -0
  203. package/dist/components/device-cycle.d.ts.map +1 -0
  204. package/dist/components/device-cycle.js +77 -0
  205. package/dist/components/device-cycle.js.map +1 -0
  206. package/dist/components/index.d.ts +36 -0
  207. package/dist/components/index.d.ts.map +1 -0
  208. package/dist/components/index.js +33 -0
  209. package/dist/components/index.js.map +1 -0
  210. package/dist/components/tool-call-utilities.d.ts +69 -0
  211. package/dist/components/tool-call-utilities.d.ts.map +1 -0
  212. package/dist/components/tool-call-utilities.js +368 -0
  213. package/dist/components/tool-call-utilities.js.map +1 -0
  214. package/dist/components/user-avatar-utilities.d.ts +41 -0
  215. package/dist/components/user-avatar-utilities.d.ts.map +1 -0
  216. package/dist/components/user-avatar-utilities.js +56 -0
  217. package/dist/components/user-avatar-utilities.js.map +1 -0
  218. package/dist/components/workspace-layout-utilities.d.ts +37 -0
  219. package/dist/components/workspace-layout-utilities.d.ts.map +1 -0
  220. package/dist/components/workspace-layout-utilities.js +58 -0
  221. package/dist/components/workspace-layout-utilities.js.map +1 -0
  222. package/dist/customEventCards.d.ts +117 -0
  223. package/dist/customEventCards.d.ts.map +1 -0
  224. package/dist/customEventCards.js +36 -0
  225. package/dist/customEventCards.js.map +1 -0
  226. package/dist/hooks/index.d.ts +8 -0
  227. package/dist/hooks/index.d.ts.map +1 -0
  228. package/dist/hooks/index.js +8 -0
  229. package/dist/hooks/index.js.map +1 -0
  230. package/dist/hooks/useKeyboardShortcuts.d.ts +48 -0
  231. package/dist/hooks/useKeyboardShortcuts.d.ts.map +1 -0
  232. package/dist/hooks/useKeyboardShortcuts.js +112 -0
  233. package/dist/hooks/useKeyboardShortcuts.js.map +1 -0
  234. package/dist/hooks/useViewport.d.ts +42 -0
  235. package/dist/hooks/useViewport.d.ts.map +1 -0
  236. package/dist/hooks/useViewport.js +61 -0
  237. package/dist/hooks/useViewport.js.map +1 -0
  238. package/dist/index.d.ts +75 -0
  239. package/dist/index.d.ts.map +1 -0
  240. package/dist/index.js +74 -0
  241. package/dist/index.js.map +1 -0
  242. package/dist/settings-metadata.d.ts +78 -0
  243. package/dist/settings-metadata.d.ts.map +1 -0
  244. package/dist/settings-metadata.js +131 -0
  245. package/dist/settings-metadata.js.map +1 -0
  246. package/dist/types.d.ts +751 -0
  247. package/dist/types.d.ts.map +1 -0
  248. package/dist/types.js +25 -0
  249. package/dist/types.js.map +1 -0
  250. package/package.json +90 -0
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Registry for app-specific custom chat-stream events.
3
+ *
4
+ * The shared chat UI (ChatPanel) only understands generic events. To surface an
5
+ * app-specific event — emitted by a backend as `{ type: 'custom', name, data }`
6
+ * (see `@molecule/app-ai-chat`) — without coupling this package to that app, the
7
+ * consuming app registers a factory that turns the event's `data` into a chat system
8
+ * card. ChatPanel consults this registry when a `custom` event arrives. This is the
9
+ * sanctioned extension point: app-specific events/cards (e.g. a host app's build or
10
+ * billing notices) live in the app, never in this shared package's union or ChatPanel.
11
+ *
12
+ * @module
13
+ */
14
+ import type { IconName } from '@molecule/app-icons';
15
+ /**
16
+ * A single call-to-action on a chat card: a labelled link (`href`) and/or click
17
+ * handler. The app supplies any route/copy — the shared package never hardcodes one.
18
+ */
19
+ export interface ChatEventCardAction {
20
+ /** Button label (already localized by the app). */
21
+ label: string;
22
+ /** Link target. App-owned — e.g. the host's own pricing/auth route. */
23
+ href?: string;
24
+ /** Click handler (alternative to, or alongside, `href`). */
25
+ onClick?: () => void;
26
+ /**
27
+ * Render the action's label as inline monospace code — a command/identifier like
28
+ * `/report` or a skill name — so it stands out from prose while staying clickable.
29
+ */
30
+ code?: boolean;
31
+ }
32
+ /**
33
+ * A non-interactive inline monospace code span in a card body — a command or identifier
34
+ * the prose refers to (`/report`, a skill name) that should read as code but isn't
35
+ * clickable. For a *clickable* command, use {@link ChatEventCardAction} with `code: true`.
36
+ */
37
+ export interface ChatEventCardCode {
38
+ /** The code text, rendered monospaced/tinted. */
39
+ code: string;
40
+ }
41
+ /**
42
+ * One inline segment of a card's composable body: literal text, an inline monospace
43
+ * {@link ChatEventCardCode} span, or a labelled link/action ({@link ChatEventCardAction}).
44
+ * See {@link ChatEventCard.content}.
45
+ */
46
+ export type ChatEventCardSegment = string | ChatEventCardCode | ChatEventCardAction;
47
+ /**
48
+ * A chat system card: a short message with an optional action (or actions). Mirrors
49
+ * the system-card shape ChatPanel renders for upgrade prompts, guest reminders, etc.
50
+ */
51
+ export interface ChatEventCard {
52
+ /** The card's text. */
53
+ text: string;
54
+ /** An optional action button (or buttons): a link (`href`) and/or a click handler. */
55
+ action?: ChatEventCardAction | ChatEventCardAction[];
56
+ /**
57
+ * Composable inline body for a `tone` (tip) card: an ordered list of segments rendered
58
+ * in sequence — plain strings as text, {@link ChatEventCardAction}s as inline underlined
59
+ * links — so prose and links interleave freely (e.g. text → an inline link → a trailing
60
+ * period). When set, the renderer uses this INSTEAD of `text` + appended `action`s, so a
61
+ * link can sit mid-sentence rather than only at the end. Segments carry their own spacing
62
+ * (no auto-space is inserted between them). Keep `text` populated with a plain-text
63
+ * equivalent for accessibility / non-toned consumers. Only honored when `tone` is set.
64
+ */
65
+ content?: ChatEventCardSegment[];
66
+ /**
67
+ * When true, ChatPanel renders the card as a stand-out tip box rather than muted inline
68
+ * text. Prefer setting {@link ChatEventCard.tone} (which implies emphasis AND picks the
69
+ * accent colour + icon); `emphasized` without a `tone` falls back to the neutral `info`
70
+ * tone. The app opts in; the shared package never infers emphasis from a card's copy.
71
+ */
72
+ emphasized?: boolean;
73
+ /**
74
+ * The card's tip TONE — picks its accent colour + default icon so every notice card
75
+ * shares ONE consistent box (icon + tinted body + a uniform 1px border + actions),
76
+ * differing only by colour/icon per kind:
77
+ * - `info` — blue, info glyph (neutral notice)
78
+ * - `gold` — amber, lightbulb (an honest tip / onboarding note)
79
+ * - `upgrade` — amber, clock (a plan/limit/budget nudge)
80
+ * - `success` — green, check (a completed action, e.g. a saved script)
81
+ * - `signup` — primary, sign-in (an auth nudge)
82
+ *
83
+ * Setting `tone` implies emphasis. Cards that supply composable {@link ChatEventCard.content}
84
+ * render their inline links in the box; cards that supply `action`(s) render them as a
85
+ * consistent row of accent buttons. Omit `tone` (and `emphasized`) for a plain muted line.
86
+ */
87
+ tone?: 'info' | 'gold' | 'upgrade' | 'success' | 'signup';
88
+ /**
89
+ * Optional icon-name override (a `@molecule/app-icons` glyph) — defaults to the tone's
90
+ * icon. Use only a name that exists in the bonded set (`getIcon` throws otherwise);
91
+ * sets with extra glyphs register them via `CustomIconNames` augmentation.
92
+ */
93
+ icon?: IconName;
94
+ }
95
+ /**
96
+ * Turns a custom event's `data` payload into a chat card, or returns null to render
97
+ * nothing for that event.
98
+ */
99
+ export type ChatEventCardFactory = (data: Record<string, unknown> | undefined) => ChatEventCard | null;
100
+ /**
101
+ * Register a renderer for a custom chat-stream event. Consuming apps call this at
102
+ * startup so their own `{ type: 'custom', name }` events surface as chat cards —
103
+ * keeping app-specific events out of the core ai-chat union and this package's
104
+ * ChatPanel. Re-registering the same name overwrites the previous factory.
105
+ *
106
+ * @param name - The custom event `name` to handle (matches the emitted event's `name`).
107
+ * @param factory - Builds the card from the event's `data` (or returns null to skip).
108
+ */
109
+ export declare function registerCustomEventCard(name: string, factory: ChatEventCardFactory): void;
110
+ /**
111
+ * Resolve the registered card factory for a custom event name, if any.
112
+ *
113
+ * @param name - The custom event `name`.
114
+ * @returns The registered factory, or undefined if none is registered.
115
+ */
116
+ export declare function getCustomEventCardFactory(name: string): ChatEventCardFactory | undefined;
117
+ //# sourceMappingURL=customEventCards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customEventCards.d.ts","sourceRoot":"","sources":["../src/customEventCards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,iBAAiB,GAAG,mBAAmB,CAAA;AAEnF;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,sFAAsF;IACtF,MAAM,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,EAAE,CAAA;IACpD;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAA;IAChC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA;IACzD;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KACtC,aAAa,GAAG,IAAI,CAAA;AAIzB;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAEzF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAExF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Registry for app-specific custom chat-stream events.
3
+ *
4
+ * The shared chat UI (ChatPanel) only understands generic events. To surface an
5
+ * app-specific event — emitted by a backend as `{ type: 'custom', name, data }`
6
+ * (see `@molecule/app-ai-chat`) — without coupling this package to that app, the
7
+ * consuming app registers a factory that turns the event's `data` into a chat system
8
+ * card. ChatPanel consults this registry when a `custom` event arrives. This is the
9
+ * sanctioned extension point: app-specific events/cards (e.g. a host app's build or
10
+ * billing notices) live in the app, never in this shared package's union or ChatPanel.
11
+ *
12
+ * @module
13
+ */
14
+ const registry = new Map();
15
+ /**
16
+ * Register a renderer for a custom chat-stream event. Consuming apps call this at
17
+ * startup so their own `{ type: 'custom', name }` events surface as chat cards —
18
+ * keeping app-specific events out of the core ai-chat union and this package's
19
+ * ChatPanel. Re-registering the same name overwrites the previous factory.
20
+ *
21
+ * @param name - The custom event `name` to handle (matches the emitted event's `name`).
22
+ * @param factory - Builds the card from the event's `data` (or returns null to skip).
23
+ */
24
+ export function registerCustomEventCard(name, factory) {
25
+ registry.set(name, factory);
26
+ }
27
+ /**
28
+ * Resolve the registered card factory for a custom event name, if any.
29
+ *
30
+ * @param name - The custom event `name`.
31
+ * @returns The registered factory, or undefined if none is registered.
32
+ */
33
+ export function getCustomEventCardFactory(name) {
34
+ return registry.get(name);
35
+ }
36
+ //# sourceMappingURL=customEventCards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customEventCards.js","sourceRoot":"","sources":["../src/customEventCards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAgGH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAA;AAExD;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAY,EAAE,OAA6B;IACjF,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC7B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAY;IACpD,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * IDE React hooks.
3
+ *
4
+ * @module
5
+ */
6
+ export * from './useKeyboardShortcuts.js';
7
+ export * from './useViewport.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,2BAA2B,CAAA;AACzC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * IDE React hooks.
3
+ *
4
+ * @module
5
+ */
6
+ export * from './useKeyboardShortcuts.js';
7
+ export * from './useViewport.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,2BAA2B,CAAA;AACzC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Global keyboard shortcut hook for the IDE.
3
+ *
4
+ * Provides a centralized `document`-level keydown listener that maps
5
+ * platform-aware key combos (e.g. `"mod+p"`, `"mod+shift+f"`) to handlers.
6
+ *
7
+ * @module
8
+ */
9
+ import type { KeyboardShortcut } from '../types.js';
10
+ /** Detect macOS / iOS for Cmd vs Ctrl. */
11
+ export declare const IS_MAC: boolean;
12
+ /**
13
+ * Serialize a `KeyboardEvent` into a normalized combo string.
14
+ * Format: modifier keys in order `mod+ctrl+alt+shift+key` (lowercase).
15
+ * `mod` maps to Meta on Mac, Control elsewhere.
16
+ * @param e - The keyboard event.
17
+ * @param isMac - Override platform detection (for testing).
18
+ * @returns Serialized combo string.
19
+ */
20
+ export declare function serializeEvent(e: KeyboardEvent, isMac?: boolean): string;
21
+ /**
22
+ * Normalize a shortcut definition string into the same format produced by
23
+ * `serializeEvent`. Accepts `mod+shift+f` style strings (case-insensitive).
24
+ * @param keys - Raw shortcut string.
25
+ * @returns Normalized lowercase combo string.
26
+ */
27
+ export declare function normalizeKeys(keys: string): string;
28
+ /**
29
+ * Returns true when the event target is an interactive input element
30
+ * where shortcuts should be suppressed by default.
31
+ * @param e - The keyboard event.
32
+ * @returns Whether an input-like element is focused.
33
+ */
34
+ export declare function isInputFocused(e: KeyboardEvent): boolean;
35
+ /**
36
+ * Returns true when focus is inside a Monaco editor instance.
37
+ * @param e - The keyboard event.
38
+ * @returns Whether the target is inside `.monaco-editor`.
39
+ */
40
+ export declare function isMonacoFocused(e: KeyboardEvent): boolean;
41
+ /**
42
+ * Registers global keyboard shortcuts on the document.
43
+ *
44
+ * @param shortcuts - Array of shortcut definitions. Callers should wrap
45
+ * the array in `useMemo` to avoid unnecessary re-subscriptions.
46
+ */
47
+ export declare function useKeyboardShortcuts(shortcuts: KeyboardShortcut[]): void;
48
+ //# sourceMappingURL=useKeyboardShortcuts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeyboardShortcuts.d.ts","sourceRoot":"","sources":["../../src/hooks/useKeyboardShortcuts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,0CAA0C;AAC1C,eAAO,MAAM,MAAM,SACoE,CAAA;AAEvF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,UAAS,GAAG,MAAM,CAQvE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,CAOxD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,CAGzD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAmCxE"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Global keyboard shortcut hook for the IDE.
3
+ *
4
+ * Provides a centralized `document`-level keydown listener that maps
5
+ * platform-aware key combos (e.g. `"mod+p"`, `"mod+shift+f"`) to handlers.
6
+ *
7
+ * @module
8
+ */
9
+ import { useEffect } from 'react';
10
+ /** Detect macOS / iOS for Cmd vs Ctrl. */
11
+ export const IS_MAC = typeof navigator !== 'undefined' && /Mac|iPhone|iPad|iPod/i.test(navigator.userAgent);
12
+ /**
13
+ * Serialize a `KeyboardEvent` into a normalized combo string.
14
+ * Format: modifier keys in order `mod+ctrl+alt+shift+key` (lowercase).
15
+ * `mod` maps to Meta on Mac, Control elsewhere.
16
+ * @param e - The keyboard event.
17
+ * @param isMac - Override platform detection (for testing).
18
+ * @returns Serialized combo string.
19
+ */
20
+ export function serializeEvent(e, isMac = IS_MAC) {
21
+ const parts = [];
22
+ if (isMac ? e.metaKey : e.ctrlKey)
23
+ parts.push('mod');
24
+ if (isMac ? e.ctrlKey : false)
25
+ parts.push('ctrl');
26
+ if (e.altKey)
27
+ parts.push('alt');
28
+ if (e.shiftKey)
29
+ parts.push('shift');
30
+ parts.push(e.key.toLowerCase());
31
+ return parts.join('+');
32
+ }
33
+ /**
34
+ * Normalize a shortcut definition string into the same format produced by
35
+ * `serializeEvent`. Accepts `mod+shift+f` style strings (case-insensitive).
36
+ * @param keys - Raw shortcut string.
37
+ * @returns Normalized lowercase combo string.
38
+ */
39
+ export function normalizeKeys(keys) {
40
+ return keys
41
+ .toLowerCase()
42
+ .split('+')
43
+ .map((s) => s.trim())
44
+ .join('+');
45
+ }
46
+ /**
47
+ * Returns true when the event target is an interactive input element
48
+ * where shortcuts should be suppressed by default.
49
+ * @param e - The keyboard event.
50
+ * @returns Whether an input-like element is focused.
51
+ */
52
+ export function isInputFocused(e) {
53
+ const el = e.target;
54
+ if (!el)
55
+ return false;
56
+ const tag = el.tagName;
57
+ if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT')
58
+ return true;
59
+ if (el.isContentEditable)
60
+ return true;
61
+ return false;
62
+ }
63
+ /**
64
+ * Returns true when focus is inside a Monaco editor instance.
65
+ * @param e - The keyboard event.
66
+ * @returns Whether the target is inside `.monaco-editor`.
67
+ */
68
+ export function isMonacoFocused(e) {
69
+ const el = e.target;
70
+ return !!el?.closest?.('.monaco-editor');
71
+ }
72
+ /**
73
+ * Registers global keyboard shortcuts on the document.
74
+ *
75
+ * @param shortcuts - Array of shortcut definitions. Callers should wrap
76
+ * the array in `useMemo` to avoid unnecessary re-subscriptions.
77
+ */
78
+ export function useKeyboardShortcuts(shortcuts) {
79
+ useEffect(() => {
80
+ if (shortcuts.length === 0)
81
+ return;
82
+ // Pre-normalize keys for fast lookup
83
+ const entries = shortcuts.map((s) => ({
84
+ ...s,
85
+ normalized: normalizeKeys(s.keys),
86
+ }));
87
+ /**
88
+ * Keydown handler that matches events against registered shortcuts.
89
+ * @param e - The keyboard event to evaluate.
90
+ */
91
+ function handler(e) {
92
+ const combo = serializeEvent(e);
93
+ for (const entry of entries) {
94
+ if (combo !== entry.normalized)
95
+ continue;
96
+ // Skip if focused in input and not explicitly allowed
97
+ if (!entry.allowInInput && isInputFocused(e))
98
+ continue;
99
+ // Skip if focused in Monaco and not explicitly allowed
100
+ if (!entry.allowInEditor && isMonacoFocused(e))
101
+ continue;
102
+ e.preventDefault();
103
+ e.stopPropagation();
104
+ entry.handler();
105
+ return;
106
+ }
107
+ }
108
+ document.addEventListener('keydown', handler, true);
109
+ return () => document.removeEventListener('keydown', handler, true);
110
+ }, [shortcuts]);
111
+ }
112
+ //# sourceMappingURL=useKeyboardShortcuts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeyboardShortcuts.js","sourceRoot":"","sources":["../../src/hooks/useKeyboardShortcuts.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Viewport + pointer media-query hooks for touch/phone-aware rendering.
3
+ *
4
+ * The IDE components style themselves with inline values (per the ClassMap
5
+ * rule there are no stylesheets in this package), so responsive behavior is
6
+ * expressed by branching on these hooks rather than `@media` rules. Consumers
7
+ * (e.g. molecule.dev's Workspace) keep their own breakpoint in sync with
8
+ * {@link NARROW_VIEWPORT_QUERY}'s 768px threshold.
9
+ *
10
+ * @module
11
+ */
12
+ /**
13
+ * The phone-width media query — matches viewports below 768px, mirroring the
14
+ * host workspace's single-pane mobile breakpoint.
15
+ */
16
+ export declare const NARROW_VIEWPORT_QUERY = "(max-width: 767px)";
17
+ /**
18
+ * The touch-first media query — matches when the PRIMARY pointer is coarse
19
+ * (finger), i.e. phones/tablets, regardless of viewport width.
20
+ */
21
+ export declare const COARSE_POINTER_QUERY = "(pointer: coarse)";
22
+ /**
23
+ * Subscribes to a CSS media query. SSR-safe: reports `false` until mounted in
24
+ * a browser.
25
+ * @param query - A media query string, e.g. `'(max-width: 767px)'`.
26
+ * @returns Whether the query currently matches.
27
+ */
28
+ export declare function useMediaQueryMatch(query: string): boolean;
29
+ /**
30
+ * Whether the viewport is phone-width (below 768px). Use for layout-density
31
+ * decisions: bigger type, taller rows, `dvh`-capped popovers.
32
+ * @returns True on phone-width viewports.
33
+ */
34
+ export declare function useNarrowViewport(): boolean;
35
+ /**
36
+ * Whether the primary pointer is coarse (touch). Use for interaction
37
+ * decisions: ≥44px touch targets, always-visible controls that desktop
38
+ * reveals on hover (hover does not exist on touch).
39
+ * @returns True on touch-first devices.
40
+ */
41
+ export declare function useCoarsePointer(): boolean;
42
+ //# sourceMappingURL=useViewport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useViewport.d.ts","sourceRoot":"","sources":["../../src/hooks/useViewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,uBAAuB,CAAA;AAEzD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,sBAAsB,CAAA;AAEvD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAezD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Viewport + pointer media-query hooks for touch/phone-aware rendering.
3
+ *
4
+ * The IDE components style themselves with inline values (per the ClassMap
5
+ * rule there are no stylesheets in this package), so responsive behavior is
6
+ * expressed by branching on these hooks rather than `@media` rules. Consumers
7
+ * (e.g. molecule.dev's Workspace) keep their own breakpoint in sync with
8
+ * {@link NARROW_VIEWPORT_QUERY}'s 768px threshold.
9
+ *
10
+ * @module
11
+ */
12
+ import { useEffect, useState } from 'react';
13
+ /**
14
+ * The phone-width media query — matches viewports below 768px, mirroring the
15
+ * host workspace's single-pane mobile breakpoint.
16
+ */
17
+ export const NARROW_VIEWPORT_QUERY = '(max-width: 767px)';
18
+ /**
19
+ * The touch-first media query — matches when the PRIMARY pointer is coarse
20
+ * (finger), i.e. phones/tablets, regardless of viewport width.
21
+ */
22
+ export const COARSE_POINTER_QUERY = '(pointer: coarse)';
23
+ /**
24
+ * Subscribes to a CSS media query. SSR-safe: reports `false` until mounted in
25
+ * a browser.
26
+ * @param query - A media query string, e.g. `'(max-width: 767px)'`.
27
+ * @returns Whether the query currently matches.
28
+ */
29
+ export function useMediaQueryMatch(query) {
30
+ const [matches, setMatches] = useState(() => typeof window !== 'undefined' && typeof window.matchMedia === 'function'
31
+ ? window.matchMedia(query).matches
32
+ : false);
33
+ useEffect(() => {
34
+ if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
35
+ return;
36
+ const mql = window.matchMedia(query);
37
+ const onChange = (e) => setMatches(e.matches);
38
+ setMatches(mql.matches);
39
+ mql.addEventListener('change', onChange);
40
+ return () => mql.removeEventListener('change', onChange);
41
+ }, [query]);
42
+ return matches;
43
+ }
44
+ /**
45
+ * Whether the viewport is phone-width (below 768px). Use for layout-density
46
+ * decisions: bigger type, taller rows, `dvh`-capped popovers.
47
+ * @returns True on phone-width viewports.
48
+ */
49
+ export function useNarrowViewport() {
50
+ return useMediaQueryMatch(NARROW_VIEWPORT_QUERY);
51
+ }
52
+ /**
53
+ * Whether the primary pointer is coarse (touch). Use for interaction
54
+ * decisions: ≥44px touch targets, always-visible controls that desktop
55
+ * reveals on hover (hover does not exist on touch).
56
+ * @returns True on touch-first devices.
57
+ */
58
+ export function useCoarsePointer() {
59
+ return useMediaQueryMatch(COARSE_POINTER_QUERY);
60
+ }
61
+ //# sourceMappingURL=useViewport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useViewport.js","sourceRoot":"","sources":["../../src/hooks/useViewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAA;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAA;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAC1C,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;QACtE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO;QAClC,CAAC,CAAC,KAAK,CACV,CAAA;IACD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;YAAE,OAAM;QACpF,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QACpC,MAAM,QAAQ,GAAG,CAAC,CAAsB,EAAQ,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;QACxE,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACvB,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACxC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC1D,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACX,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,kBAAkB,CAAC,qBAAqB,CAAC,CAAA;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;AACjD,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * `@molecule/app-ide-react` — React components for an AI-powered IDE
3
+ * workspace: `WorkspaceLayout` (resizable panel row), `ChatPanel` (streaming
4
+ * AI chat with tool-call cards, @ file mentions, / commands), `EditorPanel`
5
+ * (tabbed Monaco editor), `PreviewPanel` (live-preview iframe with device
6
+ * frames + crash/blank recovery), `FileExplorer`, `CommandPalette`,
7
+ * `QuickOpen`, `TabBar`, plus `registerCustomEventCard()` for app-specific
8
+ * chat cards and `useKeyboardShortcuts()`.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { ChatPanel, EditorPanel, PreviewPanel, WorkspaceLayout } from '@molecule/app-ide-react'
13
+ *
14
+ * <WorkspaceLayout>
15
+ * <ChatPanel
16
+ * projectId="proj_abc123"
17
+ * onFileOpen={(path) => console.log('open', path)}
18
+ * onFileChange={(path, content) => console.log('changed', path, content.length)}
19
+ * onReadyToBuild={() => console.log('boot sandbox')}
20
+ * />
21
+ * <EditorPanel
22
+ * onActiveFileChange={(path) => console.log('active', path)}
23
+ * onFixWithAI={(req) => console.log('fix', req)}
24
+ * />
25
+ * <PreviewPanel onPreviewError={(errs) => console.error(errs)} />
26
+ * </WorkspaceLayout>
27
+ * ```
28
+ *
29
+ * @remarks
30
+ * - The panels are hook-driven and THROW without provider wiring: wrap the
31
+ * tree in `@molecule/app-react`'s `WorkspaceProvider`, `EditorProvider`,
32
+ * `ChatProvider`, and `PreviewProvider` (or the umbrella
33
+ * `MoleculeProvider`), each wired to a bond — typically
34
+ * `@molecule/app-ide-default` (workspace/layout state + persistence),
35
+ * `@molecule/app-code-editor-monaco`, `@molecule/app-ai-chat-http`
36
+ * (streaming chat endpoint), and `@molecule/app-live-preview-iframe`.
37
+ * `ChatPanel` additionally needs the bonded HTTP client
38
+ * (`useHttpClient`) and `I18nProvider`; `getClassMap()` needs a ClassMap
39
+ * bond.
40
+ * - `WorkspaceLayout` takes panels as CHILDREN and matches them in order to
41
+ * the workspace provider's panel configs (extra configs are ignored, so
42
+ * rendering 2 children against the default 3-panel layout works). Panel
43
+ * sizes persist through the workspace provider's `resizePanel`.
44
+ * - App-specific chat/stream events do NOT belong in this package — emit
45
+ * `{ type: 'custom', name, data }` events and register a card with
46
+ * `registerCustomEventCard(name, factory)` in the consuming app.
47
+ * - `ReportModal` and `ShareModal` are exported so a HOST can mount them
48
+ * itself. They need only `projectId` + the bonded HTTP client — no
49
+ * workspace/editor/preview provider, no chat, no running sandbox — because
50
+ * they POST to `/projects/:id/report` and `/projects/:id/shares` on the
51
+ * platform API. Do NOT route a host's "report a bug" / "share" button
52
+ * through `ChatPanel`'s `openReportSignal` / `openShareSignal` alone: those
53
+ * props are observed inside the panel, so in any phase where the host does
54
+ * not mount a `ChatPanel` (a hibernating sandbox, an error screen) the
55
+ * button silently does nothing. Mount the modal directly in those phases.
56
+ * `ChatPanel` renders its own copies for `/report` and `/share`; a host that
57
+ * mounts them too must gate on whether the panel is mounted so the modal
58
+ * never opens twice.
59
+ * - `ReportModal` does NOT show its own success state — it calls `onSubmitted`
60
+ * and closes, so a host that mounts it MUST surface the confirmation itself
61
+ * (`formatReportConfirmation(result)` returns the i18n key + default copy,
62
+ * and `result.url` is the filed issue). `ShareModal` does show the created
63
+ * link inline, but only until it is closed.
64
+ * - Text routes through `t('ide.*')` — `@molecule/app-locales-ide` supplies
65
+ * translations.
66
+ *
67
+ * @module
68
+ */
69
+ export * from './command-metadata.js';
70
+ export * from './components/index.js';
71
+ export * from './customEventCards.js';
72
+ export * from './hooks/index.js';
73
+ export * from './settings-metadata.js';
74
+ export type * from './types.js';
75
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,mBAAmB,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,74 @@
1
+ /**
2
+ * `@molecule/app-ide-react` — React components for an AI-powered IDE
3
+ * workspace: `WorkspaceLayout` (resizable panel row), `ChatPanel` (streaming
4
+ * AI chat with tool-call cards, @ file mentions, / commands), `EditorPanel`
5
+ * (tabbed Monaco editor), `PreviewPanel` (live-preview iframe with device
6
+ * frames + crash/blank recovery), `FileExplorer`, `CommandPalette`,
7
+ * `QuickOpen`, `TabBar`, plus `registerCustomEventCard()` for app-specific
8
+ * chat cards and `useKeyboardShortcuts()`.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { ChatPanel, EditorPanel, PreviewPanel, WorkspaceLayout } from '@molecule/app-ide-react'
13
+ *
14
+ * <WorkspaceLayout>
15
+ * <ChatPanel
16
+ * projectId="proj_abc123"
17
+ * onFileOpen={(path) => console.log('open', path)}
18
+ * onFileChange={(path, content) => console.log('changed', path, content.length)}
19
+ * onReadyToBuild={() => console.log('boot sandbox')}
20
+ * />
21
+ * <EditorPanel
22
+ * onActiveFileChange={(path) => console.log('active', path)}
23
+ * onFixWithAI={(req) => console.log('fix', req)}
24
+ * />
25
+ * <PreviewPanel onPreviewError={(errs) => console.error(errs)} />
26
+ * </WorkspaceLayout>
27
+ * ```
28
+ *
29
+ * @remarks
30
+ * - The panels are hook-driven and THROW without provider wiring: wrap the
31
+ * tree in `@molecule/app-react`'s `WorkspaceProvider`, `EditorProvider`,
32
+ * `ChatProvider`, and `PreviewProvider` (or the umbrella
33
+ * `MoleculeProvider`), each wired to a bond — typically
34
+ * `@molecule/app-ide-default` (workspace/layout state + persistence),
35
+ * `@molecule/app-code-editor-monaco`, `@molecule/app-ai-chat-http`
36
+ * (streaming chat endpoint), and `@molecule/app-live-preview-iframe`.
37
+ * `ChatPanel` additionally needs the bonded HTTP client
38
+ * (`useHttpClient`) and `I18nProvider`; `getClassMap()` needs a ClassMap
39
+ * bond.
40
+ * - `WorkspaceLayout` takes panels as CHILDREN and matches them in order to
41
+ * the workspace provider's panel configs (extra configs are ignored, so
42
+ * rendering 2 children against the default 3-panel layout works). Panel
43
+ * sizes persist through the workspace provider's `resizePanel`.
44
+ * - App-specific chat/stream events do NOT belong in this package — emit
45
+ * `{ type: 'custom', name, data }` events and register a card with
46
+ * `registerCustomEventCard(name, factory)` in the consuming app.
47
+ * - `ReportModal` and `ShareModal` are exported so a HOST can mount them
48
+ * itself. They need only `projectId` + the bonded HTTP client — no
49
+ * workspace/editor/preview provider, no chat, no running sandbox — because
50
+ * they POST to `/projects/:id/report` and `/projects/:id/shares` on the
51
+ * platform API. Do NOT route a host's "report a bug" / "share" button
52
+ * through `ChatPanel`'s `openReportSignal` / `openShareSignal` alone: those
53
+ * props are observed inside the panel, so in any phase where the host does
54
+ * not mount a `ChatPanel` (a hibernating sandbox, an error screen) the
55
+ * button silently does nothing. Mount the modal directly in those phases.
56
+ * `ChatPanel` renders its own copies for `/report` and `/share`; a host that
57
+ * mounts them too must gate on whether the panel is mounted so the modal
58
+ * never opens twice.
59
+ * - `ReportModal` does NOT show its own success state — it calls `onSubmitted`
60
+ * and closes, so a host that mounts it MUST surface the confirmation itself
61
+ * (`formatReportConfirmation(result)` returns the i18n key + default copy,
62
+ * and `result.url` is the filed issue). `ShareModal` does show the created
63
+ * link inline, but only until it is closed.
64
+ * - Text routes through `t('ide.*')` — `@molecule/app-locales-ide` supplies
65
+ * translations.
66
+ *
67
+ * @module
68
+ */
69
+ export * from './command-metadata.js';
70
+ export * from './components/index.js';
71
+ export * from './customEventCards.js';
72
+ export * from './hooks/index.js';
73
+ export * from './settings-metadata.js';
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA"}