@tailorkit/react 0.1.0-beta.21 → 0.1.0-beta.23
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/components/slot.d.ts +1 -1
- package/dist/hooks/use-apps.d.ts +3 -3
- package/dist/hooks/{use-register-view.d.ts → use-view-context.d.ts} +2 -2
- package/dist/hooks/use-views.d.ts +9 -5
- package/dist/index.d.ts +3 -4
- package/dist/index.js +62 -68
- package/dist/tailorkit.d.ts +10 -7
- package/package.json +6 -6
- package/dist/hooks/use-slot-instances.d.ts +0 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ViewInstance } from "@tailorkit/app/client";
|
|
2
2
|
import type { SlotDefinitions, ViewDefinition } from "@tailorkit/core/schema";
|
|
3
3
|
import type { ReactNode } from "react";
|
|
4
|
-
import type { ViewContext, ViewName } from "../hooks/use-
|
|
4
|
+
import type { ViewContext, ViewName } from "../hooks/use-view-context";
|
|
5
5
|
import type { TailorKitApp } from "../tailorkit";
|
|
6
6
|
type DefaultViews = Record<`/${string}`, ViewDefinition>;
|
|
7
7
|
type ContextPaths<TViews extends Record<string, ViewDefinition>, TView extends ViewName<TViews>> = {
|
package/dist/hooks/use-apps.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TailorKitApp } from "../tailorkit";
|
|
2
|
-
import type {
|
|
3
|
-
export interface UseAppsOptions<TScopeNames extends string = string>
|
|
2
|
+
import type { TailorKitAppsSnapshot, TailorKitStore } from "@tailorkit/client-core";
|
|
3
|
+
export interface UseAppsOptions<TScopeNames extends string = string> {
|
|
4
4
|
scopes?: readonly TScopeNames[];
|
|
5
5
|
appIds?: readonly string[];
|
|
6
6
|
}
|
|
@@ -18,5 +18,5 @@ export interface UseAppsResult {
|
|
|
18
18
|
export declare function useApps(options?: UseAppsOptions): UseAppsResult;
|
|
19
19
|
export declare function useAppsStore(store: TailorKitStore, options?: UseAppsOptions): UseAppsResult;
|
|
20
20
|
export { matchesApp } from "@tailorkit/client-core";
|
|
21
|
-
export declare function useAppsSnapshot(store: TailorKitStore
|
|
21
|
+
export declare function useAppsSnapshot(store: TailorKitStore): TailorKitAppsSnapshot;
|
|
22
22
|
export declare function toUseAppsResult(snapshot: TailorKitAppsSnapshot, refetch: () => Promise<void>): UseAppsResult;
|
|
@@ -20,6 +20,6 @@ interface ErrorViewOptions<TView extends string> {
|
|
|
20
20
|
}
|
|
21
21
|
export type ViewOptions<TViews extends Record<string, ViewDefinition> = DefaultViews, TView extends ViewName<TViews> = ViewName<TViews>> = TView extends ViewName<TViews> ? ReadyViewOptions<TViews, TView> | LoadingViewOptions<TView> | ErrorViewOptions<TView> : never;
|
|
22
22
|
export type ViewState<TViews extends Record<string, ViewDefinition> = DefaultViews, TView extends ViewName<TViews> = ViewName<TViews>> = Omit<ReadyViewOptions<TViews, TView>, "view"> | Omit<LoadingViewOptions<TView>, "view"> | Omit<ErrorViewOptions<TView>, "view">;
|
|
23
|
-
export type
|
|
24
|
-
export declare function
|
|
23
|
+
export type UseViewContext<TViews extends Record<string, ViewDefinition>> = <TView extends ViewName<TViews>>(view: TView, options: ViewState<TViews, NoInfer<TView>>) => void;
|
|
24
|
+
export declare function useViewContext<TViews extends Record<string, ViewDefinition> = DefaultViews, TView extends ViewName<TViews> = ViewName<TViews>>(view: TView, options: ViewState<TViews, NoInfer<TView>>): void;
|
|
25
25
|
export {};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TailorKitApp, SlotItem } from "@tailorkit/client-core";
|
|
2
2
|
import type { UseAppsOptions, UseAppsResult } from "./use-apps";
|
|
3
|
+
export type { SlotItem } from "@tailorkit/client-core";
|
|
3
4
|
export interface UseViewsOptions<TScopeNames extends string = string, TSlot extends string = string> extends UseAppsOptions<TScopeNames> {
|
|
4
|
-
slot
|
|
5
|
+
slot: TSlot;
|
|
5
6
|
}
|
|
6
|
-
export interface UseViewsResult extends Omit<UseAppsResult, "data"> {
|
|
7
|
-
data:
|
|
7
|
+
export interface UseViewsResult<TMultiple extends boolean = boolean> extends Omit<UseAppsResult, "data"> {
|
|
8
|
+
data: SlotItem<TMultiple>[] | undefined;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
/** List apps for single-view slots or resolve instances for multiple-view slots. */
|
|
11
|
+
export declare function useViews({ slot, scopes, appIds }: UseViewsOptions): UseViewsResult;
|
|
12
|
+
/** Managed Slot resolves only its explicitly supplied app. */
|
|
13
|
+
export declare function useAppSlot(app: TailorKitApp, slot: string): UseViewsResult;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export { Slot } from "./components/slot";
|
|
2
2
|
export type { ControlledSlotProps, SlotComponent, SlotContext, SlotProps } from "./components/slot";
|
|
3
3
|
export { components, createTailorKitClient } from "./tailorkit";
|
|
4
|
-
export type { TailorKitApp,
|
|
4
|
+
export type { TailorKitApp, TailorKitClientConfig, TailorKitInstance } from "./tailorkit";
|
|
5
5
|
export { Root } from "./components/root";
|
|
6
6
|
export type { UseAppsOptions, UseAppsResult } from "./hooks/use-apps";
|
|
7
|
-
export type { UseViewsOptions, UseViewsResult } from "./hooks/use-views";
|
|
8
|
-
export type {
|
|
9
|
-
export type { UseRegisterView, ViewOptions, ViewState } from "./hooks/use-register-view";
|
|
7
|
+
export type { SlotItem, UseViewsOptions, UseViewsResult } from "./hooks/use-views";
|
|
8
|
+
export type { UseViewContext, ViewOptions, ViewState } from "./hooks/use-view-context";
|
|
10
9
|
export { primitives } from "./primitives";
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ function useStableContext(value) {
|
|
|
12
12
|
return ref.current.value;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
// src/hooks/use-
|
|
16
|
-
import {
|
|
15
|
+
// src/hooks/use-views.ts
|
|
16
|
+
import { createSlotStore, matchesApp as matchesApp3, serializeCacheKey } from "@tailorkit/client-core";
|
|
17
17
|
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
18
18
|
|
|
19
19
|
// src/components/context.ts
|
|
@@ -45,28 +45,25 @@ function useApps(options = {}) {
|
|
|
45
45
|
return useAppsStore(useTailorRootContext("useApps").store, options);
|
|
46
46
|
}
|
|
47
47
|
function useAppsStore(store, options = {}) {
|
|
48
|
-
const snapshot = useAppsSnapshot(store
|
|
48
|
+
const snapshot = useAppsSnapshot(store);
|
|
49
49
|
const scopes = normalizeScopeSelection(options.scopes);
|
|
50
50
|
const appIds = normalizeScopeSelection(options.appIds);
|
|
51
51
|
const data = useMemo(
|
|
52
52
|
() => snapshot.status === "ready" ? snapshot.apps.filter((app) => matchesApp(app, scopes.scopes, appIds.scopes)) : void 0,
|
|
53
53
|
[snapshot, scopes.key, appIds.key]
|
|
54
54
|
);
|
|
55
|
-
const refetch = useCallback(
|
|
56
|
-
() => store.fetchApps({ force: true, staleTime: options.staleTime }),
|
|
57
|
-
[store, options.staleTime]
|
|
58
|
-
);
|
|
55
|
+
const refetch = useCallback(() => store.fetchApps({ force: true }), [store]);
|
|
59
56
|
return { ...toUseAppsResult(snapshot, refetch), data };
|
|
60
57
|
}
|
|
61
|
-
function useAppsSnapshot(store
|
|
58
|
+
function useAppsSnapshot(store) {
|
|
62
59
|
const snapshot = useSyncExternalStore(
|
|
63
60
|
store.subscribeApps,
|
|
64
61
|
store.getAppsSnapshot,
|
|
65
62
|
store.getAppsSnapshot
|
|
66
63
|
);
|
|
67
64
|
useEffect(() => {
|
|
68
|
-
void store.fetchApps(
|
|
69
|
-
}, [store
|
|
65
|
+
void store.fetchApps();
|
|
66
|
+
}, [store]);
|
|
70
67
|
return snapshot;
|
|
71
68
|
}
|
|
72
69
|
function toUseAppsResult(snapshot, refetch) {
|
|
@@ -83,43 +80,59 @@ function toUseAppsResult(snapshot, refetch) {
|
|
|
83
80
|
};
|
|
84
81
|
}
|
|
85
82
|
|
|
86
|
-
// src/hooks/use-
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}) {
|
|
92
|
-
const apps = useApps();
|
|
93
|
-
const instances = useResolvedSlotInstances(slot, apps.data, apps.status, apps.error, {
|
|
94
|
-
staleTime,
|
|
95
|
-
gcTime
|
|
96
|
-
});
|
|
83
|
+
// src/hooks/use-views.ts
|
|
84
|
+
function useViews({ slot, scopes, appIds }) {
|
|
85
|
+
const { store } = useTailorRootContext("useViews");
|
|
86
|
+
const apps = useApps({ scopes, appIds });
|
|
87
|
+
const items = useResolvedSlot(slot, apps.data, apps.status, apps.error);
|
|
97
88
|
const refetch = useCallback2(async () => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
const multiple = store.client.meta().getSnapshot().data?.schema.slots[slot]?.multiple;
|
|
90
|
+
if (apps.isSuccess && multiple === true) {
|
|
91
|
+
await items.refetch();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
await apps.refetch();
|
|
95
|
+
let previousKey;
|
|
96
|
+
while (true) {
|
|
97
|
+
const discovery = store.getAppsSnapshot();
|
|
98
|
+
if (discovery.status !== "ready") return;
|
|
99
|
+
const schema = store.getMetaSnapshot().schema;
|
|
100
|
+
const options = {
|
|
101
|
+
apps: discovery.apps.filter((app) => matchesApp3(app, scopes, appIds)),
|
|
102
|
+
slot,
|
|
103
|
+
activeView: schema === null || schema.slots[slot]?.multiple === true ? store.views.getSnapshot() : null
|
|
104
|
+
};
|
|
105
|
+
const key = serializeCacheKey([options.apps, slot, options.activeView]);
|
|
106
|
+
if (key === previousKey) return;
|
|
107
|
+
previousKey = key;
|
|
108
|
+
await createSlotStore(store.client, options).fetch();
|
|
109
|
+
}
|
|
110
|
+
}, [store, slot, scopes, appIds, apps.isSuccess, apps.refetch, items.refetch]);
|
|
111
|
+
return { ...items, isFetching: apps.isFetching || items.isFetching, refetch };
|
|
102
112
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
113
|
+
function useAppSlot(app, slot) {
|
|
114
|
+
return useResolvedSlot(slot, [app], "ready", null);
|
|
105
115
|
}
|
|
106
|
-
function
|
|
107
|
-
const { store } = useTailorRootContext("
|
|
116
|
+
function useResolvedSlot(slot, apps, appsStatus, appsError) {
|
|
117
|
+
const { store } = useTailorRootContext("useViews");
|
|
108
118
|
const activeView = useSyncExternalStore2(
|
|
109
119
|
store.views.subscribe,
|
|
110
120
|
store.views.getSnapshot,
|
|
111
121
|
store.views.getSnapshot
|
|
112
122
|
);
|
|
113
|
-
const
|
|
123
|
+
const meta = useSyncExternalStore2(store.subscribe, store.getMetaSnapshot, store.getMetaSnapshot);
|
|
124
|
+
const options = useStableContext({
|
|
125
|
+
apps: apps ?? [],
|
|
126
|
+
slot,
|
|
127
|
+
activeView: meta.schema === null || meta.schema.slots[slot]?.multiple === true ? activeView : null
|
|
128
|
+
});
|
|
114
129
|
const query = useMemo2(
|
|
115
|
-
() =>
|
|
130
|
+
() => createSlotStore(store.client, {
|
|
116
131
|
...options,
|
|
117
132
|
appsStatus,
|
|
118
|
-
appsError
|
|
119
|
-
staleTime,
|
|
120
|
-
gcTime
|
|
133
|
+
appsError
|
|
121
134
|
}),
|
|
122
|
-
[store.client, options, appsStatus, appsError
|
|
135
|
+
[store.client, options, appsStatus, appsError]
|
|
123
136
|
);
|
|
124
137
|
const snapshot = useSyncExternalStore2(query.subscribe, query.getSnapshot, query.getSnapshot);
|
|
125
138
|
useEffect2(() => {
|
|
@@ -537,9 +550,11 @@ function InstanceSlot({
|
|
|
537
550
|
state
|
|
538
551
|
}) {
|
|
539
552
|
const { store } = useTailorRootContext("Slot");
|
|
540
|
-
const instances =
|
|
553
|
+
const instances = useAppSlot(app, name);
|
|
541
554
|
const meta = useSyncExternalStore4(store.subscribe, store.getMetaSnapshot, store.getMetaSnapshot);
|
|
542
|
-
const instance = instances.data?.find(
|
|
555
|
+
const instance = instances.data?.find(
|
|
556
|
+
(item) => "key" in item && item.key === instanceKey
|
|
557
|
+
);
|
|
543
558
|
const resolved = instances.isSuccess && instance && meta.schema ? resolveSlotView(app.views ?? [], name, state, meta.schema) : null;
|
|
544
559
|
const view = resolved?.status === "ready" ? resolved.view : void 0;
|
|
545
560
|
const stableContext = useStableContext(resolved?.context);
|
|
@@ -692,10 +707,10 @@ function SlotRenderer({ app, name, state }) {
|
|
|
692
707
|
import { createTailorKitFetchClient } from "@tailorkit/client-core";
|
|
693
708
|
import { createElement as createElement2 } from "react";
|
|
694
709
|
|
|
695
|
-
// src/hooks/use-
|
|
710
|
+
// src/hooks/use-view-context.ts
|
|
696
711
|
import { useEffect as useEffect5, useMemo as useMemo6 } from "react";
|
|
697
|
-
function
|
|
698
|
-
const { store } = useTailorRootContext("
|
|
712
|
+
function useViewContext(view, options) {
|
|
713
|
+
const { store } = useTailorRootContext("useViewContext");
|
|
699
714
|
const id = useMemo6(() => /* @__PURE__ */ Symbol("tailorkit-current-view"), []);
|
|
700
715
|
const status = options.status ?? "ready";
|
|
701
716
|
const context = "context" in options ? options.context : void 0;
|
|
@@ -716,23 +731,6 @@ function useRegisterView(view, options) {
|
|
|
716
731
|
}, [contextSnapshot, id, view, status, store]);
|
|
717
732
|
}
|
|
718
733
|
|
|
719
|
-
// src/hooks/use-views.ts
|
|
720
|
-
import { useCallback as useCallback5, useMemo as useMemo7 } from "react";
|
|
721
|
-
function useViews(options = {}) {
|
|
722
|
-
const { store } = useTailorRootContext("useViews");
|
|
723
|
-
const snapshot = useAppsSnapshot(store, options);
|
|
724
|
-
const scopes = normalizeScopeSelection(options.scopes);
|
|
725
|
-
const appIds = normalizeScopeSelection(options.appIds);
|
|
726
|
-
const data = useMemo7(
|
|
727
|
-
() => snapshot.status === "ready" ? snapshot.views.filter(
|
|
728
|
-
(view) => (options.slot === void 0 || view.slot === options.slot) && matchesApp2(view.app, scopes.scopes, appIds.scopes)
|
|
729
|
-
) : void 0,
|
|
730
|
-
[snapshot, scopes.key, appIds.key, options.slot]
|
|
731
|
-
);
|
|
732
|
-
const refetch = useCallback5(() => store.fetchApps({ force: true }), [store]);
|
|
733
|
-
return { ...toUseAppsResult(snapshot, refetch), data };
|
|
734
|
-
}
|
|
735
|
-
|
|
736
734
|
// src/tailorkit.tsx
|
|
737
735
|
var componentTagPrefix = "tailorkit-";
|
|
738
736
|
var toComponentTagName = (name) => `${componentTagPrefix}${name.replaceAll(/([a-z0-9])([A-Z])/gu, "$1-$2").replaceAll(/[\s_]+/gu, "-").toLowerCase()}`;
|
|
@@ -792,30 +790,26 @@ function createReactTailorKitClient(options) {
|
|
|
792
790
|
useTailorRootContext("useViews", client);
|
|
793
791
|
return useViews(options2);
|
|
794
792
|
},
|
|
795
|
-
|
|
796
|
-
useTailorRootContext("
|
|
797
|
-
|
|
798
|
-
},
|
|
799
|
-
useRegisterView: function useClientRegisterView(view, options2) {
|
|
800
|
-
useTailorRootContext("useRegisterView", client);
|
|
801
|
-
useRegisterView(view, options2);
|
|
793
|
+
useViewContext: function useClientViewContext(view, options2) {
|
|
794
|
+
useTailorRootContext("useViewContext", client);
|
|
795
|
+
useViewContext(view, options2);
|
|
802
796
|
}
|
|
803
797
|
};
|
|
804
798
|
return client;
|
|
805
799
|
}
|
|
806
800
|
|
|
807
801
|
// src/components/root.tsx
|
|
808
|
-
import { useEffect as useEffect6, useMemo as
|
|
802
|
+
import { useEffect as useEffect6, useMemo as useMemo8, useState as useState2 } from "react";
|
|
809
803
|
import { createTailorKitStore, toBaseUrl as toBaseUrl2 } from "@tailorkit/client-core";
|
|
810
804
|
|
|
811
805
|
// src/components/render.tsx
|
|
812
|
-
import { cloneElement, createElement as createElement3, isValidElement, useMemo as
|
|
806
|
+
import { cloneElement, createElement as createElement3, isValidElement, useMemo as useMemo7 } from "react";
|
|
813
807
|
function useRender({
|
|
814
808
|
defaultTagName,
|
|
815
809
|
props,
|
|
816
810
|
render
|
|
817
811
|
}) {
|
|
818
|
-
return
|
|
812
|
+
return useMemo7(() => {
|
|
819
813
|
if (render) {
|
|
820
814
|
if (!isValidElement(render)) {
|
|
821
815
|
throw new Error("The render prop must be a valid React element.");
|
|
@@ -899,7 +893,7 @@ function Root({ apps: appsProp, children, render, client, ...props }) {
|
|
|
899
893
|
store.setProvidedApps(appsProp);
|
|
900
894
|
}, [store, appsProp]);
|
|
901
895
|
useEffect6(() => () => store.previews.dispose(), [store]);
|
|
902
|
-
const context =
|
|
896
|
+
const context = useMemo8(
|
|
903
897
|
() => ({
|
|
904
898
|
store,
|
|
905
899
|
client
|
package/dist/tailorkit.d.ts
CHANGED
|
@@ -2,10 +2,9 @@ import type { TailorKitFetchClient, TailorKitCacheOptions } from "@tailorkit/cli
|
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { TailorKitTheme, CallbackMap, ComponentDefinition, ComponentProps, Schema, ViewDefinition, SlotDefinitions, TailorKitSchema } from "@tailorkit/core/schema";
|
|
4
4
|
import type { primitives } from "./primitives";
|
|
5
|
-
import type {
|
|
5
|
+
import type { UseViewContext } from "./hooks/use-view-context";
|
|
6
6
|
import type { UseAppsOptions, UseAppsResult } from "./hooks/use-apps";
|
|
7
7
|
import type { UseViewsOptions, UseViewsResult } from "./hooks/use-views";
|
|
8
|
-
import type { UseSlotInstancesOptions, UseSlotInstancesResult } from "./hooks/use-slot-instances";
|
|
9
8
|
import type { SlotComponent } from "./components/slot";
|
|
10
9
|
type AnyComponentDefinition = ComponentDefinition<Schema | undefined, CallbackMap, boolean | undefined>;
|
|
11
10
|
type ComponentRenderer<TComponent extends AnyComponentDefinition> = (args: {
|
|
@@ -20,7 +19,7 @@ type ComponentRenderers<TComponents extends Record<string, AnyComponentDefinitio
|
|
|
20
19
|
type CompleteComponentRenderers<TComponents extends Record<string, AnyComponentDefinition>> = {
|
|
21
20
|
[TName in keyof TComponents]-?: ComponentRenderer<TComponents[TName]>;
|
|
22
21
|
};
|
|
23
|
-
export type { TailorKitApp
|
|
22
|
+
export type { TailorKitApp } from "@tailorkit/client-core";
|
|
24
23
|
export interface TailorKitClientConfig {
|
|
25
24
|
readonly baseUrl: string | URL;
|
|
26
25
|
readonly fetchClient?: TailorKitFetchClient;
|
|
@@ -32,10 +31,14 @@ export interface TailorKitInstance<TViews extends Record<string, ViewDefinition>
|
|
|
32
31
|
readonly $views?: TViews;
|
|
33
32
|
readonly Slot: SlotComponent<TViews, TSlots>;
|
|
34
33
|
readonly useApps: (options?: UseAppsOptions<TScopeNames>) => UseAppsResult;
|
|
35
|
-
readonly useViews:
|
|
36
|
-
readonly
|
|
37
|
-
readonly useRegisterView: UseRegisterView<TViews>;
|
|
34
|
+
readonly useViews: <TSlot extends keyof TSlots & string>(options: UseViewsOptions<TScopeNames, TSlot>) => UseViewsResult<SlotMultiple<TSlots[TSlot]>>;
|
|
35
|
+
readonly useViewContext: UseViewContext<TViews>;
|
|
38
36
|
}
|
|
37
|
+
type SlotMultiple<TSlot> = TSlot extends {
|
|
38
|
+
multiple: infer TMultiple extends boolean;
|
|
39
|
+
} ? TMultiple : TSlot extends {
|
|
40
|
+
multiple?: infer TMultiple extends boolean;
|
|
41
|
+
} ? TMultiple | false : false;
|
|
39
42
|
type PrimitiveRenderers = typeof primitives;
|
|
40
43
|
type CustomComponentRenderers<TComponents extends Record<string, AnyComponentDefinition>> = {
|
|
41
44
|
[TName in Exclude<keyof TComponents, keyof PrimitiveRenderers>]?: ComponentRenderer<TComponents[TName]>;
|
|
@@ -75,4 +78,4 @@ export declare function createTailorKitClient<TTailor extends TailorKitServerSha
|
|
|
75
78
|
}): TailorKitInstance<ServerViews<TTailor>, TTailor extends {
|
|
76
79
|
readonly $slots?: infer V extends SlotDefinitions;
|
|
77
80
|
} ? V : SlotDefinitions, ServerScopeNames<TTailor>>;
|
|
78
|
-
export type { ViewOptions } from "./hooks/use-
|
|
81
|
+
export type { ViewOptions } from "./hooks/use-view-context";
|
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.23",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,11 +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-core": "0.1.0-beta.
|
|
28
|
-
"@tailorkit/client-platform": "0.1.0-beta.
|
|
29
|
-
"@tailorkit/core": "0.1.0-beta.
|
|
30
|
-
"@tailorkit/sandbox": "0.1.0-beta.
|
|
26
|
+
"@tailorkit/app": "0.1.0-beta.23",
|
|
27
|
+
"@tailorkit/client-core": "0.1.0-beta.23",
|
|
28
|
+
"@tailorkit/client-platform": "0.1.0-beta.23",
|
|
29
|
+
"@tailorkit/core": "0.1.0-beta.23",
|
|
30
|
+
"@tailorkit/sandbox": "0.1.0-beta.23"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@tailorkit/config": "0.0.0",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { FetchCacheOptions, TailorKitApp, SlotInstance } from "@tailorkit/client-core";
|
|
2
|
-
import type { UseAppsResult } from "./use-apps";
|
|
3
|
-
export type { SlotInstance } from "@tailorkit/client-core";
|
|
4
|
-
export interface UseSlotInstancesOptions<TSlot extends string = string> extends FetchCacheOptions {
|
|
5
|
-
slot: TSlot;
|
|
6
|
-
}
|
|
7
|
-
export interface UseSlotInstancesResult extends Omit<UseAppsResult, "data"> {
|
|
8
|
-
data: SlotInstance[] | undefined;
|
|
9
|
-
}
|
|
10
|
-
/** Resolve instances across discovered apps while sharing endpoint state in client-core. */
|
|
11
|
-
export declare function useSlotInstances({ slot, staleTime, gcTime, }: UseSlotInstancesOptions): UseSlotInstancesResult;
|
|
12
|
-
/** Managed Slot resolves only its explicitly supplied app. */
|
|
13
|
-
export declare function useAppSlotInstances(app: TailorKitApp, slot: string): UseSlotInstancesResult;
|