jazz-tools 0.20.1 → 0.20.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.
- package/.turbo/turbo-build.log +48 -48
- package/CHANGELOG.md +10 -0
- package/dist/{chunk-2OPP7KWV.js → chunk-Q5RNSSUM.js} +121 -22
- package/dist/chunk-Q5RNSSUM.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspector/{chunk-MCTB5ZJC.js → chunk-6JPVMI3V.js} +302 -182
- package/dist/inspector/chunk-6JPVMI3V.js.map +1 -0
- package/dist/inspector/{custom-element-5YWVZBWA.js → custom-element-PWRX4VCA.js} +1337 -206
- package/dist/inspector/custom-element-PWRX4VCA.js.map +1 -0
- package/dist/inspector/in-app.d.ts +1 -0
- package/dist/inspector/in-app.d.ts.map +1 -1
- package/dist/inspector/index.d.ts +1 -0
- package/dist/inspector/index.d.ts.map +1 -1
- package/dist/inspector/index.js +1044 -17
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/pages/home.d.ts +4 -1
- package/dist/inspector/pages/home.d.ts.map +1 -1
- package/dist/inspector/pages/performance/PerformancePage.d.ts +7 -0
- package/dist/inspector/pages/performance/PerformancePage.d.ts.map +1 -0
- package/dist/inspector/pages/performance/SubscriptionDetailPanel.d.ts +8 -0
- package/dist/inspector/pages/performance/SubscriptionDetailPanel.d.ts.map +1 -0
- package/dist/inspector/pages/performance/SubscriptionRow.d.ts +11 -0
- package/dist/inspector/pages/performance/SubscriptionRow.d.ts.map +1 -0
- package/dist/inspector/pages/performance/Timeline.d.ts +12 -0
- package/dist/inspector/pages/performance/Timeline.d.ts.map +1 -0
- package/dist/inspector/pages/performance/helpers.d.ts +5 -0
- package/dist/inspector/pages/performance/helpers.d.ts.map +1 -0
- package/dist/inspector/pages/performance/index.d.ts +3 -0
- package/dist/inspector/pages/performance/index.d.ts.map +1 -0
- package/dist/inspector/pages/performance/types.d.ts +13 -0
- package/dist/inspector/pages/performance/types.d.ts.map +1 -0
- package/dist/inspector/pages/performance/usePerformanceEntries.d.ts +3 -0
- package/dist/inspector/pages/performance/usePerformanceEntries.d.ts.map +1 -0
- package/dist/inspector/register-custom-element.js +3 -1
- package/dist/inspector/register-custom-element.js.map +1 -1
- package/dist/inspector/standalone.js +1 -1
- package/dist/inspector/tests/pages/performance/PerformancePage.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/PerformancePage.test.d.ts.map +1 -0
- package/dist/inspector/tests/pages/performance/SubscriptionDetailPanel.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/SubscriptionDetailPanel.test.d.ts.map +1 -0
- package/dist/inspector/tests/pages/performance/SubscriptionRow.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/SubscriptionRow.test.d.ts.map +1 -0
- package/dist/inspector/tests/pages/performance/Timeline.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/Timeline.test.d.ts.map +1 -0
- package/dist/inspector/tests/pages/performance/helpers.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/helpers.test.d.ts.map +1 -0
- package/dist/inspector/viewer/delete-local-data.d.ts.map +1 -1
- package/dist/inspector/viewer/header.d.ts +4 -2
- package/dist/inspector/viewer/header.d.ts.map +1 -1
- package/dist/inspector/viewer/page-stack.d.ts +3 -1
- package/dist/inspector/viewer/page-stack.d.ts.map +1 -1
- package/dist/react-core/hooks.d.ts +2 -2
- package/dist/react-core/hooks.d.ts.map +1 -1
- package/dist/react-core/index.js +50 -18
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-core/subscription-provider.d.ts.map +1 -1
- package/dist/react-native-core/media/image.d.ts +1 -1
- package/dist/svelte/jazz.class.svelte.d.ts.map +1 -1
- package/dist/svelte/jazz.class.svelte.js +27 -22
- package/dist/testing.js +1 -1
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/exports.d.ts +1 -1
- package/dist/tools/exports.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionCache.d.ts +2 -2
- package/dist/tools/subscribe/SubscriptionCache.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts +19 -12
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/dist/tools/subscribe/errorReporting.d.ts +6 -0
- package/dist/tools/subscribe/errorReporting.d.ts.map +1 -1
- package/dist/tools/subscribe/index.d.ts +4 -4
- package/dist/tools/subscribe/index.d.ts.map +1 -1
- package/dist/tools/subscribe/types.d.ts +48 -3
- package/dist/tools/subscribe/types.d.ts.map +1 -1
- package/dist/tools/subscribe/utils.d.ts +1 -1
- package/dist/tools/subscribe/utils.d.ts.map +1 -1
- package/dist/tools/tests/SubscriptionScope.performance.test.d.ts +2 -0
- package/dist/tools/tests/SubscriptionScope.performance.test.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/inspector/in-app.tsx +41 -3
- package/src/inspector/index.tsx +5 -1
- package/src/inspector/pages/home.tsx +26 -3
- package/src/inspector/pages/performance/PerformancePage.tsx +215 -0
- package/src/inspector/pages/performance/SubscriptionDetailPanel.tsx +182 -0
- package/src/inspector/pages/performance/SubscriptionRow.tsx +242 -0
- package/src/inspector/pages/performance/Timeline.tsx +513 -0
- package/src/inspector/pages/performance/helpers.ts +70 -0
- package/src/inspector/pages/performance/index.ts +2 -0
- package/src/inspector/pages/performance/types.ts +12 -0
- package/src/inspector/pages/performance/usePerformanceEntries.ts +53 -0
- package/src/inspector/register-custom-element.ts +3 -0
- package/src/inspector/tests/pages/performance/PerformancePage.test.tsx +83 -0
- package/src/inspector/tests/pages/performance/SubscriptionDetailPanel.test.tsx +68 -0
- package/src/inspector/tests/pages/performance/SubscriptionRow.test.tsx +93 -0
- package/src/inspector/tests/pages/performance/Timeline.test.tsx +57 -0
- package/src/inspector/tests/pages/performance/helpers.test.ts +91 -0
- package/src/inspector/viewer/delete-local-data.tsx +24 -5
- package/src/inspector/viewer/header.tsx +96 -17
- package/src/inspector/viewer/page-stack.tsx +22 -18
- package/src/react-core/hooks.ts +34 -4
- package/src/react-core/subscription-provider.tsx +17 -8
- package/src/svelte/jazz.class.svelte.ts +51 -33
- package/src/tools/coValues/interfaces.ts +3 -0
- package/src/tools/exports.ts +1 -0
- package/src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts +13 -0
- package/src/tools/subscribe/SubscriptionCache.ts +6 -4
- package/src/tools/subscribe/SubscriptionScope.ts +141 -23
- package/src/tools/subscribe/errorReporting.ts +1 -1
- package/src/tools/subscribe/index.ts +1 -1
- package/src/tools/subscribe/types.ts +62 -9
- package/src/tools/subscribe/utils.ts +2 -2
- package/src/tools/tests/SubscriptionScope.performance.test.ts +149 -0
- package/dist/chunk-2OPP7KWV.js.map +0 -1
- package/dist/inspector/chunk-MCTB5ZJC.js.map +0 -1
- package/dist/inspector/custom-element-5YWVZBWA.js.map +0 -1
package/dist/tools/exports.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { CoValueBase } from "./internal.js";
|
|
|
8
8
|
export { Profile } from "./internal.js";
|
|
9
9
|
export { SchemaUnion } from "./internal.js";
|
|
10
10
|
export { co } from "./internal.js";
|
|
11
|
-
export type { CoValueClass, CoValueFromRaw, DeeplyLoaded, Resolved, RefsToResolve, RefsToResolveStrict, CoMapInit_DEPRECATED as CoMapInit, CoMapEdit, CoMapEdits, LastAndAllCoMapEdits, CoFeedEntry, SingleCoFeedEntry, TextPos, AccountClass, AccountCreationProps, BaseProfileShape, ExportedCoValue, } from "./internal.js";
|
|
11
|
+
export type { CoValueClass, CoValueFromRaw, DeeplyLoaded, Resolved, RefsToResolve, RefsToResolveStrict, CoMapInit_DEPRECATED as CoMapInit, CoMapEdit, CoMapEdits, LastAndAllCoMapEdits, CoFeedEntry, SingleCoFeedEntry, TextPos, AccountClass, AccountCreationProps, BaseProfileShape, ExportedCoValue, SubscriptionPerformanceDetail, } from "./internal.js";
|
|
12
12
|
export { CoMap, CoList, BinaryCoStream, CoFeed, CoStream, FileStream, CoPlainText, CoRichText, Account, assertLoaded, getLoadedOrUndefined, isControlledAccount, loadCoValue, subscribeToCoValue, ImageDefinition, SubscriptionScope, exportCoValue, importContentPieces, Ref, createUnloadedCoValue, unstable_loadUnique, getUnloadedCoValueWithoutId, setDefaultSchemaPermissions, deleteCoValues, getJazzErrorType, } from "./internal.js";
|
|
13
13
|
export { JazzContextManager, type JazzContextManagerAuthProps, } from "./internal.js";
|
|
14
14
|
export { AuthSecretStorage, type AuthSetPayload, } from "./auth/AuthSecretStorage.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/tools/exports.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,WAAW,GACZ,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,CAAC,MAAM,2CAA2C,CAAC;AAE/D,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEnC,YAAY,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,oBAAoB,IAAI,SAAS,EACjC,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,OAAO,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EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,KAAK,SAAS,GACf,MAAM,uBAAuB,CAAC;AAE/B,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,kBAAkB,IAAI,+BAA+B,EACrD,KAAK,+BAA+B,GACrC,MAAM,iCAAiC,CAAC"}
|
package/dist/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coValueSchemaTransformation.d.ts","sourceRoot":"","sources":["../../../../../src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts"],"names":[],"mappings":"AACA,OAAO,EAYL,YAAY,EASb,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,2BAA2B,EAC5B,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"coValueSchemaTransformation.d.ts","sourceRoot":"","sources":["../../../../../src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts"],"names":[],"mappings":"AACA,OAAO,EAYL,YAAY,EASb,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,2BAA2B,EAC5B,MAAM,iBAAiB,CAAC;AAqBzB,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,oBAAoB,CAOhC;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,qBAAqB,GAAG,YAAY,GAC3C,MAAM,IAAI,2BAA2B,CAAC,oBAAoB,CAAC,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,oBAAoB,EACrE,MAAM,EAAE,CAAC,GACR,2BAA2B,CAAC,CAAC,CAAC,CAwFhC;AAED;;;;;;;;GAQG;AACH,wBAAgB,oCAAoC,CAClD,CAAC,SAAS,oBAAoB,EAC9B,MAAM,EAAE,CAAC,GAAG,yBAAyB,CAAC,CAAC,CAAC,CAQzC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LocalNode } from "cojson";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CoValueClassOrSchema, Loaded, ResolveQuery } from "../internal.js";
|
|
3
3
|
import { SubscriptionScope } from "./SubscriptionScope.js";
|
|
4
4
|
import type { BranchDefinition } from "./types.js";
|
|
5
5
|
export declare class SubscriptionCache {
|
|
@@ -42,7 +42,7 @@ export declare class SubscriptionCache {
|
|
|
42
42
|
/**
|
|
43
43
|
* Get or create a SubscriptionScope from the cache
|
|
44
44
|
*/
|
|
45
|
-
getOrCreate<S extends CoValueClassOrSchema>(node: LocalNode, schema: S, id: string, resolve: ResolveQuery<S>, skipRetry?: boolean, bestEffortResolution?: boolean, branch?: BranchDefinition): SubscriptionScope<
|
|
45
|
+
getOrCreate<S extends CoValueClassOrSchema>(node: LocalNode, schema: S, id: string, resolve: ResolveQuery<S>, skipRetry?: boolean, bestEffortResolution?: boolean, branch?: BranchDefinition): SubscriptionScope<Loaded<S, ResolveQuery<S>>>;
|
|
46
46
|
/**
|
|
47
47
|
* Clear all cache entries and destroy all SubscriptionScope instances
|
|
48
48
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionCache.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/SubscriptionCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"SubscriptionCache.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/SubscriptionCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAEV,oBAAoB,EACpB,MAAM,EAGN,YAAY,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAanD,qBAAa,iBAAiB;IAE5B,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,cAAc,CAAS;gBAEnB,cAAc,GAAE,MAAa;IAKzC;;OAEG;IACH,OAAO,CAAC,QAAQ;IAIhB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACH,OAAO,CAAC,YAAY;IA+BpB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAsBzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAY9B;;OAEG;IACH,OAAO,CAAC,eAAe;IASvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IACH,OAAO,CAAC,YAAY;IA2BpB;;OAEG;IACH,WAAW,CAAC,CAAC,SAAS,oBAAoB,EACxC,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,CAAC,EACT,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,SAAS,CAAC,EAAE,OAAO,EACnB,oBAAoB,CAAC,EAAE,OAAO,EAC9B,MAAM,CAAC,EAAE,gBAAgB,GACxB,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IA8DhD;;OAEG;IACH,KAAK,IAAI,IAAI;CAiBd"}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { LocalNode } from "cojson";
|
|
2
|
-
import { type CoValue,
|
|
2
|
+
import { type CoValue, MaybeLoaded, NotLoaded, type RefEncoded, type RefsToResolve } from "../internal.js";
|
|
3
3
|
import { JazzError } from "./JazzError.js";
|
|
4
4
|
import type { BranchDefinition, SubscriptionValue, SubscriptionValueLoading } from "./types.js";
|
|
5
5
|
import { PromiseWithStatus } from "./utils.js";
|
|
6
6
|
export declare class SubscriptionScope<D extends CoValue> {
|
|
7
7
|
node: LocalNode;
|
|
8
|
-
id:
|
|
9
|
-
schema: RefEncoded<
|
|
8
|
+
id: string;
|
|
9
|
+
schema: RefEncoded<CoValue>;
|
|
10
10
|
skipRetry: boolean;
|
|
11
11
|
bestEffortResolution: boolean;
|
|
12
12
|
unstable_branch?: BranchDefinition | undefined;
|
|
13
|
+
static isProfilingEnabled: boolean;
|
|
14
|
+
static setProfilingEnabled(enabled: boolean): void;
|
|
15
|
+
static enableProfiling(): void;
|
|
16
|
+
private performanceUuid;
|
|
17
|
+
private performanceSource;
|
|
13
18
|
childNodes: Map<string, SubscriptionScope<CoValue>>;
|
|
14
|
-
childValues: Map<string, SubscriptionValue<
|
|
19
|
+
childValues: Map<string, SubscriptionValue<CoValue>>;
|
|
15
20
|
/**
|
|
16
21
|
* Explicitly-loaded child ids that are unloaded
|
|
17
22
|
*/
|
|
@@ -20,7 +25,7 @@ export declare class SubscriptionScope<D extends CoValue> {
|
|
|
20
25
|
* Autoloaded child ids that are unloaded
|
|
21
26
|
*/
|
|
22
27
|
private pendingAutoloadedChildren;
|
|
23
|
-
value: SubscriptionValue<D
|
|
28
|
+
value: SubscriptionValue<D> | SubscriptionValueLoading;
|
|
24
29
|
private childErrors;
|
|
25
30
|
private validationErrors;
|
|
26
31
|
errorFromChildren: JazzError | undefined;
|
|
@@ -43,11 +48,13 @@ export declare class SubscriptionScope<D extends CoValue> {
|
|
|
43
48
|
* when debugging "value unavailable" errors.
|
|
44
49
|
*/
|
|
45
50
|
callerStack: Error | undefined;
|
|
46
|
-
constructor(node: LocalNode, resolve: RefsToResolve<
|
|
47
|
-
|
|
51
|
+
constructor(node: LocalNode, resolve: RefsToResolve<any>, id: string, schema: RefEncoded<CoValue>, skipRetry?: boolean, bestEffortResolution?: boolean, unstable_branch?: BranchDefinition | undefined, callerStack?: Error | undefined);
|
|
52
|
+
trackLoadingPerformance(source: string): void;
|
|
53
|
+
private emitLoadingComplete;
|
|
54
|
+
updateValue(value: SubscriptionValue<D>): void;
|
|
48
55
|
private handleUpdate;
|
|
49
56
|
private computeChildErrors;
|
|
50
|
-
handleChildUpdate(id: string, value: SubscriptionValue<
|
|
57
|
+
handleChildUpdate(id: string, value: SubscriptionValue<CoValue> | SubscriptionValueLoading, key?: string): void;
|
|
51
58
|
private shouldSendUpdates;
|
|
52
59
|
unloadedValue: NotLoaded<D> | undefined;
|
|
53
60
|
private lastPromise;
|
|
@@ -62,7 +69,7 @@ export declare class SubscriptionScope<D extends CoValue> {
|
|
|
62
69
|
private getError;
|
|
63
70
|
private logError;
|
|
64
71
|
private triggerUpdate;
|
|
65
|
-
subscribers: Set<(value: SubscriptionValue<D
|
|
72
|
+
subscribers: Set<(value: SubscriptionValue<D>) => void>;
|
|
66
73
|
subscriberChangeCallbacks: Set<(count: number) => void>;
|
|
67
74
|
/**
|
|
68
75
|
* Subscribe to subscriber count changes
|
|
@@ -71,8 +78,8 @@ export declare class SubscriptionScope<D extends CoValue> {
|
|
|
71
78
|
*/
|
|
72
79
|
onSubscriberChange(callback: (count: number) => void): () => void;
|
|
73
80
|
private notifySubscriberChange;
|
|
74
|
-
subscribe(listener: (value: SubscriptionValue<D
|
|
75
|
-
setListener(listener: (value: SubscriptionValue<D
|
|
81
|
+
subscribe(listener: (value: SubscriptionValue<D>) => void): () => void;
|
|
82
|
+
setListener(listener: (value: SubscriptionValue<D>) => void): void;
|
|
76
83
|
subscribeToKey(key: string): void;
|
|
77
84
|
isSubscribedToId(id: string): boolean;
|
|
78
85
|
/**
|
|
@@ -80,7 +87,7 @@ export declare class SubscriptionScope<D extends CoValue> {
|
|
|
80
87
|
*
|
|
81
88
|
* Used to make the autoload work on closed subscription scopes
|
|
82
89
|
*/
|
|
83
|
-
pullValue(listener: (value: SubscriptionValue<D
|
|
90
|
+
pullValue(listener: (value: SubscriptionValue<D>) => void): void;
|
|
84
91
|
subscribeToId(id: string, descriptor: RefEncoded<any>): void;
|
|
85
92
|
private loadChildren;
|
|
86
93
|
private loadCoMapKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionScope.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/SubscriptionScope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAIL,KAAK,OAAO,EACZ,
|
|
1
|
+
{"version":3,"file":"SubscriptionScope.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/SubscriptionScope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAIL,KAAK,OAAO,EACZ,WAAW,EACX,SAAS,EACT,KAAK,UAAU,EACf,KAAK,aAAa,EAKnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,SAAS,EAGV,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,gBAAgB,EAEhB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAGL,iBAAiB,EAGlB,MAAM,YAAY,CAAC;AAEpB,qBAAa,iBAAiB,CAAC,CAAC,SAAS,OAAO;IAmDrC,IAAI,EAAE,SAAS;IAEf,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC;IAC3B,SAAS;IACT,oBAAoB;IACpB,eAAe,CAAC,EAAE,gBAAgB;IAxD3C,MAAM,CAAC,kBAAkB,UAAS;IAElC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO;IAI3C,MAAM,CAAC,eAAe;IAItB,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,iBAAiB,CAAqB;IAE9C,UAAU,0CAAiD;IAC3D,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAi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AY;IAoHpB,OAAO,CAAC,YAAY;IA8CpB,OAAO,CAAC,aAAa;IA0CrB,OAAO,CAAC,aAAa;IAwDrB,OAAO;CAcR"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { JazzError } from "./JazzError";
|
|
2
|
+
/**
|
|
3
|
+
* A platform agnostic way to check if we're in development mode
|
|
4
|
+
*
|
|
5
|
+
* Works in Node.js and bundled code, falls back to false if process is not available
|
|
6
|
+
*/
|
|
7
|
+
export declare const isDev: boolean;
|
|
2
8
|
type CustomErrorReporterProps = {
|
|
3
9
|
getPrettyStackTrace: () => string;
|
|
4
10
|
jazzError: JazzError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorReporting.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/errorReporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"errorReporting.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/errorReporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,KAAK,SAMd,CAAC;AAEL,KAAK,wBAAwB,GAAG;IAC9B,mBAAmB,EAAE,MAAM,MAAM,CAAC;IAClC,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,KAAK,mBAAmB,GAAG,CACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,wBAAwB,KAC5B,IAAI,CAAC;AAKV;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAEvD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,CAAC,EAAE,mBAAmB,QAEpE;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,YAAY,sBAE3B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,wBAAwB,QAIzE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CoValue, RefEncoded } from "../internal.js";
|
|
1
|
+
import type { CoValue, MaybeLoaded, RefEncoded } from "../internal.js";
|
|
2
2
|
import { SubscriptionScope } from "./SubscriptionScope.js";
|
|
3
|
-
export declare function getSubscriptionScope<D extends CoValue>(value: D): SubscriptionScope<CoValue
|
|
3
|
+
export declare function getSubscriptionScope<D extends CoValue>(value: D): SubscriptionScope<CoValue>;
|
|
4
4
|
/** Autoload internals */
|
|
5
5
|
/**
|
|
6
6
|
* Given a coValue, access a child coValue by key
|
|
@@ -8,7 +8,7 @@ export declare function getSubscriptionScope<D extends CoValue>(value: D): Subsc
|
|
|
8
8
|
* By subscribing to a given key, the subscription will automatically react to the id changes
|
|
9
9
|
* on that key (e.g. deleting the key value will result on unsubscribing from the id)
|
|
10
10
|
*/
|
|
11
|
-
export declare function accessChildByKey<D extends CoValue>(parent: D, childId: string, key: string):
|
|
11
|
+
export declare function accessChildByKey<D extends CoValue>(parent: D, childId: string, key: string): MaybeLoaded<CoValue>;
|
|
12
12
|
/**
|
|
13
13
|
* Given a coValue, access a child coValue by id
|
|
14
14
|
*
|
|
@@ -17,5 +17,5 @@ export declare function accessChildByKey<D extends CoValue>(parent: D, childId:
|
|
|
17
17
|
*
|
|
18
18
|
* Used for refs that never change (e.g. CoFeed entries, CoMap edits)
|
|
19
19
|
*/
|
|
20
|
-
export declare function accessChildById<D extends CoValue>(parent: CoValue, childId: string, schema: RefEncoded<D>):
|
|
20
|
+
export declare function accessChildById<D extends CoValue>(parent: CoValue, childId: string, schema: RefEncoded<D>): MaybeLoaded<D>;
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAEP,WAAW,EACX,UAAU,EACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,OAAO,EAAE,KAAK,EAAE,CAAC,8BA0B/D;AAED,yBAAyB;AAEzB;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,OAAO,EAChD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,wBA8BZ;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,OAAO,EAC/C,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,kBAoBtB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Account,
|
|
1
|
+
import type { Account, Group } from "../internal.js";
|
|
2
2
|
import type { JazzError } from "./JazzError.js";
|
|
3
3
|
export declare const CoValueLoadingState: {
|
|
4
4
|
/**
|
|
@@ -25,9 +25,9 @@ export declare const CoValueLoadingState: {
|
|
|
25
25
|
export type CoValueLoadingState = (typeof CoValueLoadingState)[keyof typeof CoValueLoadingState];
|
|
26
26
|
export type CoValueErrorState = typeof CoValueLoadingState.UNAVAILABLE | typeof CoValueLoadingState.DELETED | typeof CoValueLoadingState.UNAUTHORIZED;
|
|
27
27
|
export type NotLoadedCoValueState = typeof CoValueLoadingState.LOADING | CoValueErrorState;
|
|
28
|
-
export type SubscriptionValue<D
|
|
28
|
+
export type SubscriptionValue<D> = {
|
|
29
29
|
type: typeof CoValueLoadingState.LOADED;
|
|
30
|
-
value:
|
|
30
|
+
value: D;
|
|
31
31
|
id: string;
|
|
32
32
|
} | JazzError;
|
|
33
33
|
export type SubscriptionValueLoading = {
|
|
@@ -38,4 +38,49 @@ export type BranchDefinition = {
|
|
|
38
38
|
name: string;
|
|
39
39
|
owner?: Group | Account;
|
|
40
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Detail structure for subscription performance marks and measures.
|
|
43
|
+
* Used by SubscriptionScope.trackLoadingPerformance() to emit performance data.
|
|
44
|
+
*/
|
|
45
|
+
export interface SubscriptionPerformanceDetail {
|
|
46
|
+
/** Type of performance entry */
|
|
47
|
+
type: "jazz-subscription";
|
|
48
|
+
/** Unique identifier for this subscription instance */
|
|
49
|
+
uuid: string;
|
|
50
|
+
/** CoValue ID (e.g., "co_z1234...") */
|
|
51
|
+
id: string;
|
|
52
|
+
/** Source identifier (hook name or API) */
|
|
53
|
+
source: string;
|
|
54
|
+
/** The resolve query object */
|
|
55
|
+
resolve: any;
|
|
56
|
+
/** Current status of the subscription */
|
|
57
|
+
status: "pending" | "loaded" | "error";
|
|
58
|
+
/** When the subscription started loading (DOMHighResTimeStamp) */
|
|
59
|
+
startTime: number;
|
|
60
|
+
/** When loading completed (if completed) */
|
|
61
|
+
endTime?: number;
|
|
62
|
+
/** Total load time in ms (if completed) */
|
|
63
|
+
duration?: number;
|
|
64
|
+
/** Error type if status is "error" */
|
|
65
|
+
errorType?: "unavailable" | "unauthorized" | "deleted";
|
|
66
|
+
/** Stack trace captured at subscription creation time */
|
|
67
|
+
callerStack?: string;
|
|
68
|
+
devtools?: ExtensionTrackEntryPayload | ExtensionMarkerPayload;
|
|
69
|
+
}
|
|
70
|
+
type DevToolsColor = "primary" | "primary-light" | "primary-dark" | "secondary" | "secondary-light" | "secondary-dark" | "tertiary" | "tertiary-light" | "tertiary-dark" | "error";
|
|
71
|
+
interface ExtensionTrackEntryPayload {
|
|
72
|
+
dataType?: "track-entry";
|
|
73
|
+
color?: DevToolsColor;
|
|
74
|
+
track: string;
|
|
75
|
+
trackGroup?: string;
|
|
76
|
+
properties?: [string, string][];
|
|
77
|
+
tooltipText?: string;
|
|
78
|
+
}
|
|
79
|
+
interface ExtensionMarkerPayload {
|
|
80
|
+
dataType: "marker";
|
|
81
|
+
color?: DevToolsColor;
|
|
82
|
+
properties?: [string, string][];
|
|
83
|
+
tooltipText?: string;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
41
86
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAW,KAAK,EAAY,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,eAAO,MAAM,mBAAmB;IAC9B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;CAEK,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GACzB,OAAO,mBAAmB,CAAC,WAAW,GACtC,OAAO,mBAAmB,CAAC,OAAO,GAClC,OAAO,mBAAmB,CAAC,YAAY,CAAC;AAE5C,MAAM,MAAM,qBAAqB,GAC7B,OAAO,mBAAmB,CAAC,OAAO,GAClC,iBAAiB,CAAC;AAEtB,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAC3B;IACE,IAAI,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC;IACT,EAAE,EAAE,MAAM,CAAC;CACZ,GACD,SAAS,CAAC;AACd,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,OAAO,mBA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WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -2,7 +2,7 @@ import { RawCoValue, Role } from "cojson";
|
|
|
2
2
|
import { CoValue, RefEncoded, RefsToResolve } from "../internal.js";
|
|
3
3
|
import { SubscriptionScope } from "./SubscriptionScope.js";
|
|
4
4
|
export declare function myRoleForRawValue(raw: RawCoValue): Role | undefined;
|
|
5
|
-
export declare function createCoValue<D extends CoValue>(ref: RefEncoded<
|
|
5
|
+
export declare function createCoValue<D extends CoValue>(ref: RefEncoded<CoValue>, raw: RawCoValue, subscriptionScope: SubscriptionScope<D>): {
|
|
6
6
|
type: "loaded";
|
|
7
7
|
value: D;
|
|
8
8
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEtD,OAAO,EACL,OAAO,EACP,UAAU,EACV,aAAa,EAGd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAUnE;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,EAC7C,GAAG,EAAE,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEtD,OAAO,EACL,OAAO,EACP,UAAU,EACV,aAAa,EAGd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAUnE;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,EAC7C,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC,EACxB,GAAG,EAAE,UAAU,EACf,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC;;WAaG,CAAC;;EAG5C;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IAClD,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IAC9C,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAKjE;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAKxE;AAED,wBAAgB,oBAAoB,CAClC,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,EACrB,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,WAoDtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionScope.performance.test.d.ts","sourceRoot":"","sources":["../../../src/tools/tests/SubscriptionScope.performance.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
},
|
|
197
197
|
"type": "module",
|
|
198
198
|
"license": "MIT",
|
|
199
|
-
"version": "0.20.
|
|
199
|
+
"version": "0.20.2",
|
|
200
200
|
"dependencies": {
|
|
201
201
|
"@manuscripts/prosemirror-recreate-steps": "^0.1.4",
|
|
202
202
|
"@scure/base": "1.2.1",
|
|
@@ -213,9 +213,9 @@
|
|
|
213
213
|
"prosemirror-transform": "^1.9.0",
|
|
214
214
|
"use-sync-external-store": "^1.5.0",
|
|
215
215
|
"zod": "4.1.11",
|
|
216
|
-
"cojson": "0.20.
|
|
217
|
-
"cojson-storage-indexeddb": "0.20.
|
|
218
|
-
"cojson-transport-ws": "0.20.
|
|
216
|
+
"cojson": "0.20.2",
|
|
217
|
+
"cojson-storage-indexeddb": "0.20.2",
|
|
218
|
+
"cojson-transport-ws": "0.20.2"
|
|
219
219
|
},
|
|
220
220
|
"devDependencies": {
|
|
221
221
|
"@scure/bip39": "^1.3.0",
|
package/src/inspector/in-app.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CoID, LocalNode, RawAccount } from "cojson";
|
|
2
2
|
import { styled } from "goober";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
3
4
|
import { PageStack } from "./viewer/page-stack.js";
|
|
4
5
|
import { GlobalStyles } from "./ui/global-styles.js";
|
|
5
6
|
import { InspectorButton, type Position } from "./viewer/inspector-button.js";
|
|
@@ -7,6 +8,25 @@ import { useOpenInspector } from "./viewer/use-open-inspector.js";
|
|
|
7
8
|
import { NodeProvider } from "./contexts/node.js";
|
|
8
9
|
import { InMemoryRouterProvider } from "./router/in-memory-router.js";
|
|
9
10
|
import { Header } from "./viewer/header.js";
|
|
11
|
+
import { PerformancePage } from "./pages/performance/index.js";
|
|
12
|
+
import { HomePage } from "./pages/home.js";
|
|
13
|
+
import { SubscriptionScope } from "jazz-tools";
|
|
14
|
+
|
|
15
|
+
export type InspectorTab = "inspector" | "performance";
|
|
16
|
+
|
|
17
|
+
const STORAGE_KEY = "jazz-inspector-tab";
|
|
18
|
+
|
|
19
|
+
function getStoredTab(): InspectorTab {
|
|
20
|
+
try {
|
|
21
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
22
|
+
if (stored === "inspector" || stored === "performance") {
|
|
23
|
+
return stored;
|
|
24
|
+
}
|
|
25
|
+
} catch {
|
|
26
|
+
// localStorage not available
|
|
27
|
+
}
|
|
28
|
+
return "inspector";
|
|
29
|
+
}
|
|
10
30
|
|
|
11
31
|
export function InspectorInApp({
|
|
12
32
|
position = "right",
|
|
@@ -18,6 +38,16 @@ export function InspectorInApp({
|
|
|
18
38
|
accountId?: CoID<RawAccount>;
|
|
19
39
|
}) {
|
|
20
40
|
const [open, setOpen] = useOpenInspector();
|
|
41
|
+
const [activeTab, setActiveTabState] = useState<InspectorTab>(getStoredTab);
|
|
42
|
+
|
|
43
|
+
const setActiveTab = useCallback((tab: InspectorTab) => {
|
|
44
|
+
setActiveTabState(tab);
|
|
45
|
+
try {
|
|
46
|
+
localStorage.setItem(STORAGE_KEY, tab);
|
|
47
|
+
} catch {
|
|
48
|
+
// localStorage not available
|
|
49
|
+
}
|
|
50
|
+
}, []);
|
|
21
51
|
|
|
22
52
|
if (!open) {
|
|
23
53
|
return (
|
|
@@ -30,12 +60,20 @@ export function InspectorInApp({
|
|
|
30
60
|
<InMemoryRouterProvider>
|
|
31
61
|
<InspectorContainer as={GlobalStyles} style={{ zIndex: 999 }}>
|
|
32
62
|
<Header
|
|
33
|
-
showDeleteLocalData={true}
|
|
34
63
|
showClose={true}
|
|
35
64
|
onClose={() => setOpen(false)}
|
|
65
|
+
activeTab={activeTab}
|
|
66
|
+
onTabChange={setActiveTab}
|
|
67
|
+
/>
|
|
68
|
+
{/* Both components stay mounted, visibility controlled by CSS */}
|
|
69
|
+
<PageStack
|
|
70
|
+
style={{ display: activeTab === "inspector" ? "flex" : "none" }}
|
|
71
|
+
homePage={<HomePage showDeleteLocalData />}
|
|
72
|
+
/>
|
|
73
|
+
<PerformancePage
|
|
74
|
+
style={{ display: activeTab === "performance" ? "flex" : "none" }}
|
|
75
|
+
onNavigate={() => setActiveTab("inspector")}
|
|
36
76
|
/>
|
|
37
|
-
|
|
38
|
-
<PageStack />
|
|
39
77
|
</InspectorContainer>
|
|
40
78
|
</InMemoryRouterProvider>
|
|
41
79
|
</NodeProvider>
|
package/src/inspector/index.tsx
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { setup } from "goober";
|
|
3
3
|
import { useJazzContextValue } from "jazz-tools/react-core";
|
|
4
|
-
import { Account } from "jazz-tools";
|
|
4
|
+
import { Account, SubscriptionScope } from "jazz-tools";
|
|
5
5
|
import { InspectorInApp } from "./in-app.js";
|
|
6
6
|
import { Position } from "./viewer/inspector-button.js";
|
|
7
7
|
|
|
8
|
+
export function enableProfiling() {
|
|
9
|
+
SubscriptionScope.enableProfiling();
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
export function JazzInspector({ position = "right" }: { position?: Position }) {
|
|
9
13
|
const context = useJazzContextValue<Account>();
|
|
10
14
|
const localNode = context.node;
|
|
@@ -5,8 +5,13 @@ import { Button, Input } from "../ui";
|
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { CoID, RawCoValue } from "cojson";
|
|
7
7
|
import { useRouter } from "../router";
|
|
8
|
+
import { DeleteLocalData } from "../viewer/delete-local-data.js";
|
|
8
9
|
|
|
9
|
-
export
|
|
10
|
+
export interface HomePageProps {
|
|
11
|
+
showDeleteLocalData?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function HomePage({ showDeleteLocalData }: HomePageProps) {
|
|
10
15
|
const { localNode, accountID } = useNode();
|
|
11
16
|
const { path, setPage } = useRouter();
|
|
12
17
|
const [coValueId, setCoValueId] = useState<CoID<RawCoValue> | "">("");
|
|
@@ -24,7 +29,7 @@ export function HomePage() {
|
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
return (
|
|
27
|
-
|
|
32
|
+
<PageContainer>
|
|
28
33
|
<CenteredForm
|
|
29
34
|
onSubmit={handleCoValueIdSubmit}
|
|
30
35
|
aria-hidden={path.length !== 0}
|
|
@@ -55,10 +60,22 @@ export function HomePage() {
|
|
|
55
60
|
Inspect my account
|
|
56
61
|
</Button>
|
|
57
62
|
</CenteredForm>
|
|
58
|
-
|
|
63
|
+
|
|
64
|
+
{showDeleteLocalData && (
|
|
65
|
+
<BottomRight>
|
|
66
|
+
<DeleteLocalData />
|
|
67
|
+
</BottomRight>
|
|
68
|
+
)}
|
|
69
|
+
</PageContainer>
|
|
59
70
|
);
|
|
60
71
|
}
|
|
61
72
|
|
|
73
|
+
const PageContainer = styled("div")`
|
|
74
|
+
position: relative;
|
|
75
|
+
height: 100%;
|
|
76
|
+
width: 100%;
|
|
77
|
+
`;
|
|
78
|
+
|
|
62
79
|
const CenteredForm = styled("form")`
|
|
63
80
|
display: flex;
|
|
64
81
|
flex-direction: column;
|
|
@@ -75,3 +92,9 @@ const CenteredForm = styled("form")`
|
|
|
75
92
|
const OrText = styled("p")`
|
|
76
93
|
text-align: center;
|
|
77
94
|
`;
|
|
95
|
+
|
|
96
|
+
const BottomRight = styled("div")`
|
|
97
|
+
position: absolute;
|
|
98
|
+
bottom: 0.75rem;
|
|
99
|
+
right: 0;
|
|
100
|
+
`;
|