dynim-react 1.0.51 → 1.0.52
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/dist/DynimProvider.d.ts +7 -1
- package/dist/DynimProvider.d.ts.map +1 -1
- package/dist/DynimProvider.js +31 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/DynimProvider.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - Shared context for bundles to access React, packages, etc.
|
|
8
8
|
*/
|
|
9
9
|
import { type ReactNode } from 'react';
|
|
10
|
-
import type { CodeMessage } from 'dynim-core';
|
|
10
|
+
import type { CodeMessage, Checkpoint, RestoreResult } from 'dynim-core';
|
|
11
11
|
export interface DynimConfig {
|
|
12
12
|
/** Function to fetch a session token for authentication */
|
|
13
13
|
getSession?: () => Promise<{
|
|
@@ -36,6 +36,12 @@ export interface DynimContextValue {
|
|
|
36
36
|
saveCode: () => Promise<void>;
|
|
37
37
|
/** Abandon/discard current edits */
|
|
38
38
|
abandonCode: () => Promise<void>;
|
|
39
|
+
/** Get active checkpoints for the project */
|
|
40
|
+
getCheckpoints: () => Promise<Checkpoint[]>;
|
|
41
|
+
/** Restore to a specific checkpoint (reloads bundle on success) */
|
|
42
|
+
restoreCheckpoint: (checkpointId: string) => Promise<RestoreResult>;
|
|
43
|
+
/** Whether a checkpoint restore is in progress */
|
|
44
|
+
isRestoring: boolean;
|
|
39
45
|
/** Current code message state (thinking, edits, etc.) */
|
|
40
46
|
codeMessage: CodeMessage;
|
|
41
47
|
/** Whether a bundle is currently loaded */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynimProvider.d.ts","sourceRoot":"","sources":["../src/DynimProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAc,EAQZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAWf,OAAO,KAAK,EAKV,WAAW,
|
|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C,mEAAmE;IACnE,iBAAiB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACpE,kDAAkD;IAClD,WAAW,EAAE,OAAO,CAAC;IACrB,yDAAyD;IACzD,WAAW,EAAE,WAAW,CAAC;IACzB,2CAA2C;IAC3C,cAAc,EAAE,OAAO,CAAC;IACxB,gCAAgC;IAChC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,MAAW,GACZ,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAkdlC;AAED;;GAEG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C"}
|
package/dist/DynimProvider.js
CHANGED
|
@@ -41,6 +41,7 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
41
41
|
const [isInitialLoadComplete, setIsInitialLoadComplete] = useState(false);
|
|
42
42
|
const [TenantApp, setTenantApp] = useState(null);
|
|
43
43
|
const [bundleError, setBundleError] = useState(null);
|
|
44
|
+
const [isRestoring, setIsRestoring] = useState(false);
|
|
44
45
|
const [codeMessage, setCodeMessage] = useState({
|
|
45
46
|
thinking: '',
|
|
46
47
|
text: '',
|
|
@@ -141,7 +142,9 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
141
142
|
codeClientRef.current?.resetMessage();
|
|
142
143
|
},
|
|
143
144
|
loadBundle: (bundleUrl) => {
|
|
144
|
-
isExitingRef
|
|
145
|
+
// Note: isExitingRef is already set by onExitStart for the exit flow.
|
|
146
|
+
// Don't set it here — this callback is also used by checkpoint restore
|
|
147
|
+
// while the builder is still active.
|
|
145
148
|
return loadBundleRef.current?.(bundleUrl) ?? Promise.resolve();
|
|
146
149
|
},
|
|
147
150
|
onEnter: () => {
|
|
@@ -357,6 +360,27 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
357
360
|
// Reload saved CSS (may have been showing temp CSS)
|
|
358
361
|
getCSSLoader().loadWithCacheBust('/api/code/css');
|
|
359
362
|
}, [loadSavedBundle, getCSSLoader]);
|
|
363
|
+
const getCheckpoints = useCallback(async () => {
|
|
364
|
+
return codeClientRef.current?.getCheckpoints() ?? [];
|
|
365
|
+
}, []);
|
|
366
|
+
const restoreCheckpoint = useCallback(async (checkpointId) => {
|
|
367
|
+
if (!codeClientRef.current) {
|
|
368
|
+
throw new Error('Code client not initialized');
|
|
369
|
+
}
|
|
370
|
+
setIsRestoring(true);
|
|
371
|
+
try {
|
|
372
|
+
const result = await codeClientRef.current.restoreCheckpoint(checkpointId);
|
|
373
|
+
// Reload bundle + CSS on success (loadBundle handles CSS when loadCSS=true)
|
|
374
|
+
if (result.bundle_ready) {
|
|
375
|
+
const bundleUrl = `/api/code/bundle?temp=true&_t=${Date.now()}`;
|
|
376
|
+
await loadBundleRef.current?.(bundleUrl, true);
|
|
377
|
+
}
|
|
378
|
+
return result;
|
|
379
|
+
}
|
|
380
|
+
finally {
|
|
381
|
+
setIsRestoring(false);
|
|
382
|
+
}
|
|
383
|
+
}, []);
|
|
360
384
|
const contextValue = useMemo(() => ({
|
|
361
385
|
enterBuilder,
|
|
362
386
|
exitBuilder,
|
|
@@ -364,6 +388,9 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
364
388
|
sendCode,
|
|
365
389
|
saveCode,
|
|
366
390
|
abandonCode,
|
|
391
|
+
getCheckpoints,
|
|
392
|
+
restoreCheckpoint,
|
|
393
|
+
isRestoring,
|
|
367
394
|
codeMessage,
|
|
368
395
|
isBundleLoaded,
|
|
369
396
|
isBundleLoading,
|
|
@@ -374,6 +401,9 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
374
401
|
sendCode,
|
|
375
402
|
saveCode,
|
|
376
403
|
abandonCode,
|
|
404
|
+
getCheckpoints,
|
|
405
|
+
restoreCheckpoint,
|
|
406
|
+
isRestoring,
|
|
377
407
|
codeMessage,
|
|
378
408
|
isBundleLoaded,
|
|
379
409
|
isBundleLoading,
|
package/dist/index.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ export { DynimProvider, useDynim } from './DynimProvider';
|
|
|
14
14
|
export type { DynimConfig, DynimContextValue, DynimProviderProps } from './DynimProvider';
|
|
15
15
|
export { defaultTheme } from './theme';
|
|
16
16
|
export type { DynimTheme } from './theme';
|
|
17
|
-
export type { CodeMessage, CodeEdit, Message } from 'dynim-core';
|
|
17
|
+
export type { CodeMessage, CodeEdit, Checkpoint, RestoreResult, Message } from 'dynim-core';
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1F,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1F,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dynim-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dev": "tsc --watch"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"dynim-core": "^1.0.
|
|
30
|
+
"dynim-core": "^1.0.26"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=17.0.0",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@types/react-dom": "^18.3.7",
|
|
45
45
|
"react": "^19.2.3",
|
|
46
46
|
"react-dom": "^19.2.3",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
47
|
+
"typescript": "^5.9.3",
|
|
48
|
+
"vite": "^5.0.11"
|
|
49
49
|
},
|
|
50
50
|
"license": "MIT"
|
|
51
51
|
}
|