@pygmalionjs/pygmalion 0.2.16 → 0.2.18
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/README.md +28 -0
- package/dist-lib/pygmalion.js +1092 -993
- package/node/dev-mirror.mjs +44 -0
- package/package.json +1 -1
- package/types.d.ts +39 -0
package/README.md
CHANGED
|
@@ -116,6 +116,34 @@ mirror.sourceRef; // what it is tracking now
|
|
|
116
116
|
to a throwaway commit, leaving your branch, HEAD, and index untouched. It covers
|
|
117
117
|
tracked changes only; untracked files raise a warning on the returned status.
|
|
118
118
|
|
|
119
|
+
To offer a choice instead of asking for a ref string, list the revisions and
|
|
120
|
+
render the shipped control in your toolbar:
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
const { sourceRefs, switchSource, mirror } = usePygmalionProject();
|
|
124
|
+
|
|
125
|
+
<SourceRefControl
|
|
126
|
+
value={mirror.sourceRef}
|
|
127
|
+
refs={sourceRefs.refs}
|
|
128
|
+
defaultRef={sourceRefs.defaultRef}
|
|
129
|
+
worktreeRef={sourceRefs.worktreeRef}
|
|
130
|
+
busy={mirror.state === 'syncing'}
|
|
131
|
+
onChange={(ref) => void switchSource(ref)}
|
|
132
|
+
>
|
|
133
|
+
{/* Optional: your own trigger, so the control reads as part of the toolbar. */}
|
|
134
|
+
<span>{mirror.sourceRef ?? 'dev'}@{mirror.shortCommit}</span>
|
|
135
|
+
</SourceRefControl>;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The menu is a native select layered over that trigger, so keyboard access,
|
|
139
|
+
mobile behavior, and placement stay with the platform while the painted trigger
|
|
140
|
+
stays yours. `[data-pygmalion-source-ref]` and `[data-busy]` are available for
|
|
141
|
+
styling.
|
|
142
|
+
|
|
143
|
+
`GET /__pygmalion-dev-control/refs` backs this list with local branches, remote
|
|
144
|
+
tracking branches, the default revision, and the worktree ref. `loadSourceRefs()`
|
|
145
|
+
reloads it after branches change.
|
|
146
|
+
|
|
119
147
|
Preview artifacts are cached per source SHA, so switching invalidates that cache
|
|
120
148
|
and the next capture runs again from scratch. A capture already running for the
|
|
121
149
|
previous revision is discarded instead of published, so it cannot overwrite the
|