@roughapp/feature 0.4.0 → 0.4.2

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 (4) hide show
  1. package/README.md +207 -116
  2. package/index.js +38 -38
  3. package/package.json +2 -3
  4. package/CHANGELOG.md +0 -220
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roughapp/feature",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -19,8 +19,7 @@
19
19
  "index.js",
20
20
  "index.d.ts",
21
21
  "style.css",
22
- "README.md",
23
- "CHANGELOG.md"
22
+ "README.md"
24
23
  ],
25
24
  "sideEffects": [
26
25
  "./index.js",
package/CHANGELOG.md DELETED
@@ -1,220 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to `@roughapp/feature`.
4
-
5
- The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
- This package is pre-1.0, so a minor version bump can contain breaking changes.
7
-
8
- ## 0.3.0 - 2026-08-10
9
-
10
- **This release has breaking API changes.** Rough now uses an explicit client for
11
- each project instead of global initialization. Apps can safely show features
12
- from multiple Rough projects at the same time, and each client has a clear,
13
- awaitable lifecycle.
14
-
15
- ### Added
16
-
17
- - **`createRoughClient({ projectId, baseUrl?, fetchUserToken })`** creates and
18
- starts a client for one project. Keep the client for as long as your app needs
19
- that project, then call `await client.destroy()`.
20
- - **`whenRoughClientReady({ client })`** lets you wait for startup or handle a
21
- startup error.
22
- - **`openRoughCreate({ target })`** lets you attach the create modal inside the
23
- element that scopes your Rough theme. It defaults to `document.body`.
24
-
25
- ### Changed
26
-
27
- - **All stateful functions and components now take a client.** Pass `client` and
28
- `surface` to `getRoughFeatures()`, `openRoughCreate()`, `<rough-surface>`,
29
- `<rough-feature>`, `<rough-edit-button>` and the modal elements.
30
- - **Cleanup methods are asynchronous and safe to call more than once.** Await
31
- `client.destroy()`, `subscription.unsubscribe()` and `modal.close()` when you
32
- need to know that cleanup has finished.
33
- - **Create one client and share it for each signed-in person and project.** A
34
- second client for the same `baseUrl`, `projectId` and person fails with
35
- `RoughReplicacheIdentityConflictError`. Clients for different projects or
36
- different signed-in people can run together.
37
- - **`openRoughCreate()` no longer requires a mounted Rough component.** You can
38
- open it directly with a client and surface.
39
-
40
- ### Removed
41
-
42
- - **`initRough()` has been removed.** There is no default or global client.
43
- - **`defineSurface()` has been replaced by `defineRoughSurface()`.** Rename
44
- `toolList` to `tools` when updating your surface definitions.
45
- - **`registerSurfaceEntry` has been removed.** You no longer need to register a
46
- surface before using it.
47
-
48
- ### Migrating
49
-
50
- ```ts
51
- // Before
52
- initRough({ projectId, fetchUserToken })
53
- const surface = defineSurface({ key, name, description, toolList })
54
- const unsubscribe = getRoughFeatures(surface, onFeatures)
55
- openRoughCreate(surface, { projectId })
56
-
57
- // After
58
- const client = createRoughClient({ projectId, fetchUserToken })
59
- const surface = defineRoughSurface({ key, name, description, tools })
60
- const subscription = getRoughFeatures({ client, surface, onFeatures })
61
- const modal = await openRoughCreate({ client, surface })
62
-
63
- await modal.close()
64
- await subscription.unsubscribe()
65
- await client.destroy()
66
- ```
67
-
68
- ## 0.2.1 - 2026-08-05
69
-
70
- Add `CHANGELOG.md` to the published package.
71
-
72
- ## 0.2.0 - 2026-08-05
73
-
74
- **Upgrade from 0.1.0 as soon as you can.** Every read and write 0.1.0 performs
75
- goes through gateway REST routes that are being deleted. When that lands, a
76
- 0.1.0 install can no longer list, create, build or publish features. 0.2.0 does
77
- not call any of those routes.
78
-
79
- Upgrading needs no configuration change. `initRough` takes the same
80
- `projectId`, `fetchUserToken` and optional `baseUrl` it always did, and no
81
- export was added or removed. The work is in the type and theme changes below.
82
-
83
- ### Changed
84
-
85
- - **Breaking: sprite, surface and ping traffic now syncs through Replicache
86
- instead of the REST API.** 0.1.0 called ten routes under
87
- `/api/v1/project/{projectId}/` to list sprites, fetch a sprite, list and
88
- create builds, read a build and its logs, publish, register a surface and
89
- ping. 0.2.0 calls none of them. It syncs over
90
- `/api/v1/internal/replicache/pull` and `/api/v1/internal/replicache/push`,
91
- and the session token exchange at `/api/v1/project/{projectId}/session-token`
92
- is the only other request it makes. The ten legacy routes are removed in
93
- [#2181](https://github.com/build-great-products/rough.app/pull/2181), which
94
- is what makes this upgrade time sensitive.
95
-
96
- One consequence worth planning for: the SDK now keeps a sync loop open and
97
- polls for changes every 5 seconds for as long as the page is mounted, where
98
- 0.1.0 issued one request per call and then went quiet.
99
-
100
- - **Breaking: `Sprite` and `SpriteBuild` reference related records by ID
101
- instead of nesting them.**
102
-
103
- ```ts
104
- // 0.1.0
105
- type Sprite = {
106
- id: string
107
- name: string
108
- ownedByPersonId: string
109
- publishedSpriteBuild: SpriteBuild | null // full nested record
110
- }
111
- type SpriteBuild = {
112
- createdByPerson: { id: string; name: string }
113
- // ...
114
- }
115
-
116
- // 0.2.0
117
- type Sprite = {
118
- id: SpriteId
119
- name: string
120
- ownedByPersonId: PersonId
121
- publishedSpriteBuildId: SpriteBuildId | null // ID only
122
- }
123
- type SpriteBuild = {
124
- createdByPersonId: PersonId
125
- // ...
126
- }
127
- ```
128
-
129
- Anything reading `sprite.publishedSpriteBuild.artifactUrl`,
130
- `.status` or `.prompt` off a `getRoughFeatures` result must be reworked, and
131
- `SpriteBuild` no longer carries the build author's display name. There is no
132
- replacement for that name in the public API.
133
-
134
- - **Breaking: ID fields are branded string types.** `SpriteId`,
135
- `SpriteBuildId`, `SurfaceId` and `PersonId` are now `string & { __brand: … }`
136
- rather than `string`, on `RoughFeature`'s `featureId` and `buildId`,
137
- `RoughCreateModal`'s and `SpriteBuildMenu`'s `surfaceId`, `SpriteFrame`'s
138
- `spriteBuildId`, and `registerSurfaceEntry`'s `surfaceId`.
139
-
140
- Reading is unaffected, because a branded string is still assignable to
141
- `string`. Passing one in is not: an ID you hold as a plain `string`, from
142
- your own database or a URL parameter, is rejected. The brand types are not
143
- themselves exported, so reach them through the types that are:
144
-
145
- ```ts
146
- type SpriteId = Sprite['id']
147
- type SpriteBuildId = NonNullable<Sprite['publishedSpriteBuildId']>
148
- type SurfaceId = RoughCreateModalElement['surfaceId']
149
- ```
150
-
151
- IDs that flow straight out of `getRoughFeatures` into a component still
152
- typecheck with no cast.
153
-
154
- - **Breaking: the stylesheet ships a different set of design tokens.** The
155
- Solarized palette was replaced with a ShadCN-style token set, so any host
156
- theming Rough through CSS custom properties needs to remap. These eight are
157
- gone, with their nearest replacement:
158
-
159
- | Removed in 0.2.0 | Closest 0.2.0 token |
160
- | ------------------------- | ---------------------------------------------- |
161
- | `--rough-text` | `--rough-foreground` |
162
- | `--rough-text-secondary` | `--rough-muted-foreground` |
163
- | `--rough-surface` | `--rough-card` |
164
- | `--rough-surface-border` | `--rough-border` |
165
- | `--rough-background-muted` | `--rough-muted` |
166
- | `--rough-danger` | `--rough-destructive` |
167
- | `--rough-shadow` | `--rough-shadow-xs`, `-md`, `-lg` |
168
- | `--rough-accent-secondary` | no equivalent; `--rough-brand` is the saturated brand colour |
169
-
170
- Watch `--rough-accent` in particular. The name survived but the meaning did
171
- not: it was the primary action colour (Solarized blue) and is now the subtle
172
- hover background that ShadCN uses the name for. A host that set it to their
173
- brand colour to tint buttons will find it tinting hover states instead.
174
- `--rough-primary` is the token that now drives primary actions.
175
- `--rough-background` and `--rough-border` also kept their names with new
176
- values. Twenty-eight tokens were added, including a `--rough-radius` scale
177
- and `--rough-success` variants.
178
-
179
- - **`getRoughFeatures` is a live subscription rather than a one-shot fetch.**
180
- In 0.1.0 the callback fired once and only fired again when something called
181
- `triggerRefresh`. It now re-fires on every relevant change that syncs in, so
182
- a feature published in another tab or by another user appears without the
183
- host doing anything.
184
-
185
- - **A feature becomes visible on a published build rather than on a built
186
- artifact.** 0.1.0 listed a sprite only if its published build had an
187
- `artifactUrl`; 0.2.0 lists it as soon as a build is marked published. A
188
- published build with no artifact, which should not normally occur, now
189
- reaches the host and renders an empty frame instead of being filtered out.
190
-
191
- - The bundle is roughly three times larger, because the Replicache client is
192
- compiled into it: `index.js` goes from 105 kB to 320 kB raw, 27 kB to 77 kB
193
- gzipped. The stylesheet grows from 324 B to 5.2 kB with the larger token set.
194
-
195
- - The declared `svelte` dependency range moves from `^5.56.4` to `^5.56.8`.
196
- Every other runtime dependency is unchanged, `capnweb` included, so the
197
- version compatibility required between the two ends of the iframe bridge has
198
- not moved.
199
-
200
- ### Removed
201
-
202
- - **`onpublish` is gone from `RoughCreateModal`, `RoughEditButton` and
203
- `RoughEditModal`.** Because `getRoughFeatures` is now a live subscription, a
204
- publish already reaches the host through that callback, which is what the
205
- prop existed to signal. Move any publish handling into the
206
- `getRoughFeatures` callback. Note that the prop was optional, so depending on
207
- your setup this may fail quietly rather than at compile time.
208
-
209
- - **`triggerRefresh` is gone from the `SurfaceEntry` passed to
210
- `registerSurfaceEntry`.** It was the manual refresh hook for the old
211
- fetch-once model and has nothing to do now. Delete it from the object you
212
- pass in; leaving it there is an excess property and will be rejected.
213
-
214
- ### Added
215
-
216
- - A light and dark mode toggle in the Feature Builder. The stylesheet now
217
- carries a `.rough-dark` class holding the dark values for every token.
218
- - The Feature Builder's build log now reports token usage and estimated cost
219
- per agent step, formatted in cents below one dollar
220
- ([#2187](https://github.com/build-great-products/rough.app/pull/2187)).