@tailorkit/react 0.1.0-beta.19 → 0.1.0-beta.21
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 +3 -0
- package/dist/components/context.d.ts +1 -1
- package/dist/components/slot.d.ts +20 -11
- package/dist/hooks/use-apps.d.ts +5 -4
- package/dist/hooks/use-slot-instances.d.ts +7 -7
- package/dist/index.js +195 -794
- package/dist/remote-context.d.ts +1 -1
- package/dist/scope-query.d.ts +1 -5
- package/dist/slot-view.d.ts +1 -22
- package/dist/tailorkit.d.ts +5 -36
- package/package.json +6 -5
- package/dist/node-store.d.ts +0 -16
- package/dist/preview-manager.d.ts +0 -11
- package/dist/store.d.ts +0 -43
- package/dist/view-registry.d.ts +0 -14
package/dist/remote-context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HostToIframePayload } from "@tailorkit/sandbox/protocol";
|
|
2
|
-
import type { NodeStore } from "
|
|
2
|
+
import type { NodeStore } from "@tailorkit/client-core";
|
|
3
3
|
export interface RemoteViewContext {
|
|
4
4
|
components: Record<string, unknown>;
|
|
5
5
|
dispatch: (payload: HostToIframePayload) => void;
|
package/dist/scope-query.d.ts
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function normalizeScopeSelection(scopes?: readonly string[]): {
|
|
3
|
-
key: string;
|
|
4
|
-
scopes?: readonly string[];
|
|
5
|
-
};
|
|
1
|
+
export { appendScopeSelection, normalizeScopeSelection } from "@tailorkit/client-core";
|
package/dist/slot-view.d.ts
CHANGED
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { TailorKitSchemaSpecType } from "@tailorkit/core/spec";
|
|
3
|
-
import type { TailorKitApp } from "./tailorkit";
|
|
4
|
-
/** Select the supported view without reading or composing its context. */
|
|
5
|
-
export declare function selectSlotView(views: NonNullable<TailorKitApp["views"]>, slot: string, activePath: string, schema: TailorKitSchemaSpecType): {
|
|
6
|
-
slot: string;
|
|
7
|
-
path: string;
|
|
8
|
-
instances?: true;
|
|
9
|
-
disabled?: true;
|
|
10
|
-
} | null;
|
|
11
|
-
/** Match the same path and compose the same ancestor context as the sandbox renderer. */
|
|
12
|
-
export declare function resolveSlotView(views: NonNullable<TailorKitApp["views"]>, slot: string, activeView: ActiveView, schema: TailorKitSchemaSpecType): {
|
|
13
|
-
view: string;
|
|
14
|
-
status: "ready";
|
|
15
|
-
context: Record<string, unknown>;
|
|
16
|
-
instances: boolean;
|
|
17
|
-
} | {
|
|
18
|
-
view: string;
|
|
19
|
-
status: "loading" | "error";
|
|
20
|
-
context?: never;
|
|
21
|
-
instances: boolean;
|
|
22
|
-
} | null;
|
|
1
|
+
export { resolveSlotView, selectSlotView } from "@tailorkit/client-core";
|
package/dist/tailorkit.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TailorKitFetchClient, TailorKitCacheOptions } from "@tailorkit/client-core";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
import type { TailorKitTheme, CallbackMap, ComponentDefinition, ComponentProps, Schema, ViewDefinition, SlotDefinitions, TailorKitSchema } from "@tailorkit/core/schema";
|
|
3
4
|
import type { primitives } from "./primitives";
|
|
@@ -19,44 +20,10 @@ type ComponentRenderers<TComponents extends Record<string, AnyComponentDefinitio
|
|
|
19
20
|
type CompleteComponentRenderers<TComponents extends Record<string, AnyComponentDefinition>> = {
|
|
20
21
|
[TName in keyof TComponents]-?: ComponentRenderer<TComponents[TName]>;
|
|
21
22
|
};
|
|
22
|
-
export
|
|
23
|
-
scope?: {
|
|
24
|
-
name: string;
|
|
25
|
-
};
|
|
26
|
-
views?: {
|
|
27
|
-
slot: string;
|
|
28
|
-
path: string;
|
|
29
|
-
instances?: true;
|
|
30
|
-
disabled?: true;
|
|
31
|
-
}[];
|
|
32
|
-
clientPath?: string;
|
|
33
|
-
description?: string;
|
|
34
|
-
id: string;
|
|
35
|
-
logoPaths?: {
|
|
36
|
-
dark?: string;
|
|
37
|
-
light?: string;
|
|
38
|
-
};
|
|
39
|
-
projectId?: string;
|
|
40
|
-
currentDeployment?: {
|
|
41
|
-
id: string;
|
|
42
|
-
} | null;
|
|
43
|
-
name?: string;
|
|
44
|
-
preview?: {
|
|
45
|
-
sessionId: string;
|
|
46
|
-
expiresAt: string;
|
|
47
|
-
websocketUrl: string;
|
|
48
|
-
token: string;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
export interface TailorKitView {
|
|
52
|
-
instances?: true;
|
|
53
|
-
id: string;
|
|
54
|
-
app: TailorKitApp;
|
|
55
|
-
slot: string;
|
|
56
|
-
path: string;
|
|
57
|
-
}
|
|
23
|
+
export type { TailorKitApp, TailorKitView } from "@tailorkit/client-core";
|
|
58
24
|
export interface TailorKitClientConfig {
|
|
59
25
|
readonly baseUrl: string | URL;
|
|
26
|
+
readonly fetchClient?: TailorKitFetchClient;
|
|
60
27
|
readonly components: Record<string, unknown>;
|
|
61
28
|
readonly theme: TailorKitTheme;
|
|
62
29
|
}
|
|
@@ -103,6 +70,8 @@ export declare function createTailorKitClient<TTailor extends TailorKitServerSha
|
|
|
103
70
|
baseUrl: string | URL;
|
|
104
71
|
components?: CompleteComponentRenderers<ServerComponents<TTailor>>;
|
|
105
72
|
theme?: TailorKitTheme;
|
|
73
|
+
cache?: TailorKitCacheOptions;
|
|
74
|
+
fetch?: typeof fetch;
|
|
106
75
|
}): TailorKitInstance<ServerViews<TTailor>, TTailor extends {
|
|
107
76
|
readonly $slots?: infer V extends SlotDefinitions;
|
|
108
77
|
} ? V : SlotDefinitions, ServerScopeNames<TTailor>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailorkit/react",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.21",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,10 +23,11 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@floating-ui/react-dom": "^2.1.9",
|
|
25
25
|
"@standard-schema/spec": "^1.1.0",
|
|
26
|
-
"@tailorkit/app": "0.1.0-beta.
|
|
27
|
-
"@tailorkit/client-
|
|
28
|
-
"@tailorkit/
|
|
29
|
-
"@tailorkit/
|
|
26
|
+
"@tailorkit/app": "0.1.0-beta.21",
|
|
27
|
+
"@tailorkit/client-core": "0.1.0-beta.21",
|
|
28
|
+
"@tailorkit/client-platform": "0.1.0-beta.21",
|
|
29
|
+
"@tailorkit/core": "0.1.0-beta.21",
|
|
30
|
+
"@tailorkit/sandbox": "0.1.0-beta.21"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@tailorkit/config": "0.0.0",
|
package/dist/node-store.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { RemoteNode } from "@tailorkit/sandbox/protocol";
|
|
2
|
-
type Listener = () => void;
|
|
3
|
-
export declare class NodeStore {
|
|
4
|
-
private nodes;
|
|
5
|
-
private signatures;
|
|
6
|
-
private nodeListeners;
|
|
7
|
-
private rootListeners;
|
|
8
|
-
private rootId;
|
|
9
|
-
clear(): void;
|
|
10
|
-
setSnapshot(tree: RemoteNode): void;
|
|
11
|
-
getRootId(): string | null;
|
|
12
|
-
getNode(id: string): RemoteNode | null;
|
|
13
|
-
subscribe(id: string, listener: Listener): () => void;
|
|
14
|
-
subscribeRoot(listener: Listener): () => void;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TailorKitApp } from "./tailorkit";
|
|
2
|
-
export interface PreviewSnapshot {
|
|
3
|
-
revision: number;
|
|
4
|
-
source: string | null;
|
|
5
|
-
}
|
|
6
|
-
export declare function createPreviewManager(baseUrl: URL, onEnded: () => void, onViews?: (appId: string, views: NonNullable<TailorKitApp["views"]>) => void): {
|
|
7
|
-
getSnapshot: (sessionId: string) => PreviewSnapshot;
|
|
8
|
-
updateApp: (app: TailorKitApp) => void;
|
|
9
|
-
subscribe: (app: TailorKitApp, listener: () => void) => (() => void);
|
|
10
|
-
dispose: () => void;
|
|
11
|
-
};
|
package/dist/store.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { TailorKitSchemaSpecType } from "@tailorkit/core/spec";
|
|
2
|
-
import type { TailorKitApp, TailorKitView } from "./tailorkit";
|
|
3
|
-
export interface TailorKitAppsSnapshot {
|
|
4
|
-
apps: TailorKitApp[];
|
|
5
|
-
views: TailorKitView[];
|
|
6
|
-
error: Error | null;
|
|
7
|
-
status: "error" | "idle" | "loading" | "ready";
|
|
8
|
-
}
|
|
9
|
-
interface TailorKitMetaSnapshot {
|
|
10
|
-
assetsBaseUrl: string | null;
|
|
11
|
-
error: Error | null;
|
|
12
|
-
schema: TailorKitSchemaSpecType | null;
|
|
13
|
-
status: "error" | "idle" | "loading" | "ready";
|
|
14
|
-
}
|
|
15
|
-
export type TailorKitStore = ReturnType<typeof createTailorKitStore>;
|
|
16
|
-
export declare function createTailorKitStore(baseUrlInput: string | URL, initialApps?: TailorKitApp[]): {
|
|
17
|
-
baseUrl: URL;
|
|
18
|
-
views: {
|
|
19
|
-
getSnapshot: () => import("@tailorkit/core/views").ActiveView | null;
|
|
20
|
-
subscribe(listener: () => void): () => void;
|
|
21
|
-
register(entry: Omit<import("./view-registry").ViewEntry, "order">): void;
|
|
22
|
-
unregister(id: symbol): void;
|
|
23
|
-
};
|
|
24
|
-
setProvidedApps(apps: TailorKitApp[] | undefined): void;
|
|
25
|
-
fetchApps: (options?: {
|
|
26
|
-
force?: boolean;
|
|
27
|
-
}) => Promise<void>;
|
|
28
|
-
fetchMeta: (options?: {
|
|
29
|
-
force?: boolean;
|
|
30
|
-
}) => Promise<void>;
|
|
31
|
-
getAppsSnapshot: () => TailorKitAppsSnapshot;
|
|
32
|
-
getMetaSnapshot: () => TailorKitMetaSnapshot;
|
|
33
|
-
subscribe: (listener: () => void) => (() => void);
|
|
34
|
-
subscribeApps: (listener: () => void) => (() => void);
|
|
35
|
-
previews: {
|
|
36
|
-
getSnapshot: (sessionId: string) => import("./preview-manager").PreviewSnapshot;
|
|
37
|
-
updateApp: (app: TailorKitApp) => void;
|
|
38
|
-
subscribe: (app: TailorKitApp, listener: () => void) => (() => void);
|
|
39
|
-
dispose: () => void;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export declare function toBaseUrl(value: string | URL): URL;
|
|
43
|
-
export {};
|
package/dist/view-registry.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ActiveView, ViewStatus } from "@tailorkit/core/views";
|
|
2
|
-
export interface ViewEntry {
|
|
3
|
-
id: symbol;
|
|
4
|
-
view: string;
|
|
5
|
-
context: unknown;
|
|
6
|
-
status: ViewStatus;
|
|
7
|
-
order: number;
|
|
8
|
-
}
|
|
9
|
-
export declare function createViewRegistry(): {
|
|
10
|
-
getSnapshot: () => ActiveView | null;
|
|
11
|
-
subscribe(listener: () => void): () => void;
|
|
12
|
-
register(entry: Omit<ViewEntry, "order">): void;
|
|
13
|
-
unregister(id: symbol): void;
|
|
14
|
-
};
|