@molecule/app-ide 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +265 -0
  2. package/package.json +7 -6
package/README.md ADDED
@@ -0,0 +1,265 @@
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-08-04T01:51:03.327Z
7
+ -->
8
+
9
+ # @molecule/app-ide
10
+
11
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
+ > It is written to be read by coding agents as much as by people, and is generated from this
13
+ > package's source — edit `src/index.ts` JSDoc, not this file.
14
+
15
+ IDE workspace core interface for molecule.dev.
16
+
17
+ Framework-agnostic contract for multi-panel workspace layouts (chat,
18
+ editor, preview, terminal, …): panel visibility, sizing, active panel,
19
+ and layout persistence. Bond a provider (e.g. `@molecule/app-ide-default`,
20
+ which persists layout in browser storage) at startup; a framework binding
21
+ (e.g. `@molecule/app-ide-react`) renders the layout from this state.
22
+
23
+ ## Quick Start
24
+
25
+ ```typescript
26
+ import { setProvider, requireProvider } from '@molecule/app-ide'
27
+ import { provider } from '@molecule/app-ide-default'
28
+
29
+ setProvider(provider) // once, at app startup (bonds.ts)
30
+
31
+ const workspace = requireProvider()
32
+ workspace.togglePanel('terminal')
33
+ const unsubscribe = workspace.subscribe((state) => renderLayout(state))
34
+ ```
35
+
36
+ ## Type
37
+
38
+ `core`
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ npm install @molecule/app-ide @molecule/app-bond @molecule/app-i18n
44
+ ```
45
+
46
+ ## API
47
+
48
+ ### Interfaces
49
+
50
+ #### `PanelConfig`
51
+
52
+ Configuration for an individual workspace panel including
53
+ position, sizing constraints, and visibility.
54
+
55
+ ```typescript
56
+ interface PanelConfig {
57
+ id: PanelId
58
+ position: PanelPosition
59
+ minWidth?: number
60
+ minHeight?: number
61
+ defaultSize?: number
62
+ resizable?: boolean
63
+ collapsible?: boolean
64
+ visible?: boolean
65
+ }
66
+ ```
67
+
68
+ #### `WorkspaceConfig`
69
+
70
+ Configuration options for creating a workspace provider.
71
+
72
+ ```typescript
73
+ interface WorkspaceConfig {
74
+ defaultLayout: WorkspaceLayout
75
+ persistLayout?: boolean
76
+ storageKey?: string
77
+ }
78
+ ```
79
+
80
+ #### `WorkspaceLayout`
81
+
82
+ Complete workspace layout describing panel arrangement and sizing.
83
+
84
+ ```typescript
85
+ interface WorkspaceLayout {
86
+ panels: PanelConfig[]
87
+ sizes: Record<PanelPosition, number[]>
88
+ }
89
+ ```
90
+
91
+ #### `WorkspaceProvider`
92
+
93
+ Workspace provider interface that all IDE workspace bond packages
94
+ must implement. Manages panel layout, sizing, and visibility.
95
+
96
+ ```typescript
97
+ interface WorkspaceProvider {
98
+ /** Provider name identifier. */
99
+ readonly name: string
100
+
101
+ /** Returns the current workspace layout. */
102
+ getLayout(): WorkspaceLayout
103
+
104
+ /** Sets the entire workspace layout. */
105
+ setLayout(layout: WorkspaceLayout): void
106
+
107
+ /** Toggles visibility of a panel by ID. */
108
+ togglePanel(panelId: PanelId): void
109
+
110
+ /** Resizes a panel to the given size. */
111
+ resizePanel(panelId: PanelId, size: number): void
112
+
113
+ /** Sets the active (focused) panel. */
114
+ setActivePanel(panelId: PanelId): void
115
+
116
+ /**
117
+ * Subscribes to workspace state changes.
118
+ *
119
+ * @returns An unsubscribe function.
120
+ */
121
+ subscribe(callback: (state: WorkspaceState) => void): () => void
122
+
123
+ /** Resets layout to the default configuration. */
124
+ resetLayout(): void
125
+ }
126
+ ```
127
+
128
+ #### `WorkspaceState`
129
+
130
+ Current workspace state including layout, active panel,
131
+ collapsed panels, and fullscreen mode.
132
+
133
+ ```typescript
134
+ interface WorkspaceState {
135
+ layout: WorkspaceLayout
136
+ activePanel: PanelId | null
137
+ collapsedPanels: Set<PanelId>
138
+ isFullscreen: boolean
139
+ }
140
+ ```
141
+
142
+ ### Types
143
+
144
+ #### `PanelId`
145
+
146
+ Identifier for a workspace panel (built-in names or custom strings).
147
+
148
+ ```typescript
149
+ type PanelId = 'chat' | 'editor' | 'preview' | 'terminal' | 'deploy' | 'files' | string
150
+ ```
151
+
152
+ #### `PanelPosition`
153
+
154
+ Position of a panel within the workspace layout.
155
+
156
+ ```typescript
157
+ type PanelPosition = 'left' | 'center' | 'right' | 'bottom'
158
+ ```
159
+
160
+ ### Functions
161
+
162
+ #### `getProvider()`
163
+
164
+ Retrieves the bonded IDE workspace provider, or `null` if none is bonded.
165
+
166
+ ```typescript
167
+ function getProvider(): WorkspaceProvider | null
168
+ ```
169
+
170
+ **Returns:** The bonded workspace provider, or `null`.
171
+
172
+ #### `hasProvider()`
173
+
174
+ Checks whether an IDE workspace provider is currently bonded.
175
+
176
+ ```typescript
177
+ function hasProvider(): boolean
178
+ ```
179
+
180
+ **Returns:** `true` if an IDE workspace provider is bonded.
181
+
182
+ #### `requireProvider()`
183
+
184
+ Retrieves the bonded IDE workspace provider, throwing if none is configured.
185
+
186
+ ```typescript
187
+ function requireProvider(): WorkspaceProvider
188
+ ```
189
+
190
+ **Returns:** The bonded workspace provider.
191
+
192
+ #### `setProvider(provider)`
193
+
194
+ Registers an IDE workspace provider as the active singleton.
195
+
196
+ ```typescript
197
+ function setProvider(provider: WorkspaceProvider): void
198
+ ```
199
+
200
+ - `provider` — The workspace provider implementation to bond.
201
+
202
+ ## Available Providers
203
+
204
+ | Provider | Package |
205
+ | -------- | --------------------------- |
206
+ | Default | `@molecule/app-ide-default` |
207
+
208
+ ## Injection Notes
209
+
210
+ ### Requirements
211
+
212
+ Peer dependencies:
213
+
214
+ - `@molecule/app-bond` ^1.0.1
215
+ - `@molecule/app-i18n` ^1.0.1
216
+
217
+ ### Runtime Dependencies
218
+
219
+ - `@molecule/app-bond`
220
+ - `@molecule/app-i18n`
221
+
222
+ - **This core manages layout STATE only — panels render via a framework
223
+ binding** (React: `@molecule/app-ide-react`) or your own components reading
224
+ `getLayout()` + `subscribe()`. Wire the bond before the workspace mounts.
225
+ - `subscribe()` returns an unsubscribe function — call it on teardown to avoid
226
+ duplicate renders after remounts.
227
+ - `PanelId` accepts custom strings beyond the built-ins ('chat' | 'editor' |
228
+ 'preview' | 'terminal' | 'deploy' | 'files') — register custom panels in the
229
+ layout rather than hardcoding a parallel layout system.
230
+ - Layout persistence is the provider's concern (the default bond uses browser
231
+ storage) — never write layout state to `localStorage` yourself.
232
+
233
+ ## E2E Tests
234
+
235
+ Integration checklist — drive the real rendered UI (live preview, no mocks):
236
+ `navigate_preview` to the IDE, `read_preview_ui` to snapshot the panel
237
+ regions, `interact_preview` to drag dividers and toggle panels. Adapt each
238
+ item to this app's actual panels/layout and check every box off one by one.
239
+ A box you can't check is an integration bug to fix — not a skip:
240
+
241
+ - [ ] The IDE renders its panel regions in the default layout — snapshot the
242
+ preview and confirm each visible panel the app configures (e.g. a left
243
+ sidebar/files, a center editor, a right preview, a bottom terminal) is
244
+ present and laid out, none overlapping or collapsed to nothing.
245
+ - [ ] Dragging a divider between two panels resizes the adjacent panels and
246
+ the sizes update live — grab the handle, drag, and confirm in a fresh
247
+ snapshot that both neighbors changed size (not the whole window, no
248
+ snap-back to the previous sizes).
249
+ - [ ] Toggling a panel's visibility (hide the terminal or the sidebar via its
250
+ control) removes it from the layout, and toggling again restores it in the
251
+ same position — the neighbors reflow to fill, they don't leave a blank gap.
252
+ - [ ] Collapsing a collapsible panel shrinks it out of the way and expanding
253
+ restores its prior size; clicking into a panel updates the active-panel
254
+ state (its highlight/toolbar follows the panel you focus).
255
+ - [ ] A resized / collapsed / hidden layout PERSISTS across a full reload —
256
+ after reload the panels return at the sizes and visibility you left them,
257
+ not reset to the default layout (the default bond persists to browser
258
+ storage).
259
+ - [ ] A panel's minimum size is respected — dragging a divider to the far end
260
+ cannot shrink a resizable panel to zero or an unusable sliver; it stops at
261
+ its configured min.
262
+
263
+ ## Translations
264
+
265
+ Translation strings are provided by `@molecule/app-locales-ide`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-ide",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "IDE workspace layout and resizable panel management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,8 @@
17
17
  }
18
18
  },
19
19
  "files": [
20
- "dist"
20
+ "dist",
21
+ "README.md"
21
22
  ],
22
23
  "keywords": [
23
24
  "molecule",
@@ -27,12 +28,12 @@
27
28
  ],
28
29
  "license": "Apache-2.0",
29
30
  "peerDependencies": {
30
- "@molecule/app-bond": "^1.0.0",
31
- "@molecule/app-i18n": "^1.0.0"
31
+ "@molecule/app-bond": "^1.0.1",
32
+ "@molecule/app-i18n": "^1.0.1"
32
33
  },
33
34
  "devDependencies": {
34
- "@molecule/app-bond": "1.0.0",
35
- "@molecule/app-i18n": "1.0.0",
35
+ "@molecule/app-bond": "1.0.1",
36
+ "@molecule/app-i18n": "1.0.1",
36
37
  "@types/node": "26.1.2",
37
38
  "typescript": "6.0.3",
38
39
  "vitest": "4.1.10"