@tailorkit/react 0.1.0-beta.0
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/LICENSE +674 -0
- package/dist/components/context.d.ts +11 -0
- package/dist/components/context.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/render.d.ts +20 -0
- package/dist/components/render.d.ts.map +1 -0
- package/dist/components/root.d.ts +11 -0
- package/dist/components/root.d.ts.map +1 -0
- package/dist/hooks/use-apps.d.ts +13 -0
- package/dist/hooks/use-apps.d.ts.map +1 -0
- package/dist/hooks/use-current-screen.d.ts +24 -0
- package/dist/hooks/use-current-screen.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +920 -0
- package/dist/node-store.d.ts +17 -0
- package/dist/node-store.d.ts.map +1 -0
- package/dist/primitives.d.ts +38 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/remote-context.d.ts +9 -0
- package/dist/remote-context.d.ts.map +1 -0
- package/dist/remote-view.d.ts +15 -0
- package/dist/remote-view.d.ts.map +1 -0
- package/dist/tailor-kit.d.ts +117 -0
- package/dist/tailor-kit.d.ts.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UseAppsResult } from "../hooks/use-apps";
|
|
2
|
+
import type { TailorKitApp } from "../tailor-kit";
|
|
3
|
+
export interface TailorRootContextValue {
|
|
4
|
+
apps: TailorKitApp[];
|
|
5
|
+
}
|
|
6
|
+
export interface RootTailor {
|
|
7
|
+
useApps: () => UseAppsResult;
|
|
8
|
+
}
|
|
9
|
+
export declare const TailorRootContext: import("react").Context<TailorRootContextValue | null>;
|
|
10
|
+
export declare function useTailorRootContext(component: string): TailorRootContextValue;
|
|
11
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/components/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,YAAY,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,aAAa,CAAC;CAC9B;AAED,eAAO,MAAM,iBAAiB,wDAAqD,CAAC;AAEpF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,sBAAsB,CAM9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ElementType, HTMLAttributes, ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
type ElementProps<TTagName extends ElementType> = ComponentPropsWithoutRef<TTagName> & {
|
|
3
|
+
ref?: Ref<unknown>;
|
|
4
|
+
};
|
|
5
|
+
export interface RenderProps {
|
|
6
|
+
render?: ReactElement<Record<string, unknown>>;
|
|
7
|
+
}
|
|
8
|
+
export type ComponentProps<TTagName extends ElementType> = ElementProps<TTagName> & RenderProps;
|
|
9
|
+
export declare function useRender<TTagName extends ElementType>({ defaultTagName, props, render, }: {
|
|
10
|
+
defaultTagName: TTagName;
|
|
11
|
+
props: ElementProps<TTagName>;
|
|
12
|
+
render?: ReactElement<Record<string, unknown>>;
|
|
13
|
+
}): ReactNode;
|
|
14
|
+
export declare function mergeProps<TProps extends Record<string, unknown>>(...propSets: (TProps | Record<string, unknown> | undefined)[]): TProps;
|
|
15
|
+
export declare function composeRefs<T>(...refs: (Ref<T> | undefined)[]): Ref<T>;
|
|
16
|
+
export type HtmlProps<TElement extends HTMLElement> = HTMLAttributes<TElement> & {
|
|
17
|
+
ref?: Ref<TElement>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/components/render.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,wBAAwB,EAExB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,SAAS,EACT,GAAG,EACJ,MAAM,OAAO,CAAC;AAEf,KAAK,YAAY,CAAC,QAAQ,SAAS,WAAW,IAAI,wBAAwB,CAAC,QAAQ,CAAC,GAAG;IACrF,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,cAAc,CAAC,QAAQ,SAAS,WAAW,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC;AAEhG,wBAAgB,SAAS,CAAC,QAAQ,SAAS,WAAW,EAAE,EACtD,cAAc,EACd,KAAK,EACL,MAAM,GACP,EAAE;IACD,cAAc,EAAE,QAAQ,CAAC;IACzB,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAChD,GAAG,SAAS,CAYZ;AAED,wBAAgB,UAAU,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,GAAG,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,EAAE,GAC5D,MAAM,CAiDR;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAUtE;AAMD,MAAM,MAAM,SAAS,CAAC,QAAQ,SAAS,WAAW,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG;IAC/E,GAAG,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { TailorKitApp } from "../tailor-kit";
|
|
3
|
+
import type { ComponentProps } from "./render";
|
|
4
|
+
import type { RootTailor } from "./context";
|
|
5
|
+
export interface RootProps extends ComponentProps<"div"> {
|
|
6
|
+
apps?: TailorKitApp[];
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
tailor: RootTailor;
|
|
9
|
+
}
|
|
10
|
+
export declare function Root({ apps: appsProp, children, render, tailor, ...props }: RootProps): ReactNode;
|
|
11
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/components/root.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,KAAK,EAAE,UAAU,EAA0B,MAAM,WAAW,CAAC;AAIpE,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,KAAK,CAAC;IACtD,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,GAAG,SAAS,CAoBjG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TailorKitApp, TailorKitStore } from "../tailor-kit";
|
|
2
|
+
export interface UseAppsResult {
|
|
3
|
+
data: TailorKitApp[] | undefined;
|
|
4
|
+
error: Error | null;
|
|
5
|
+
isError: boolean;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
isPending: boolean;
|
|
8
|
+
isSuccess: boolean;
|
|
9
|
+
refetch: () => Promise<void>;
|
|
10
|
+
status: "error" | "idle" | "loading" | "ready";
|
|
11
|
+
}
|
|
12
|
+
export declare function createUseApps(store: TailorKitStore): () => UseAppsResult;
|
|
13
|
+
//# sourceMappingURL=use-apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-apps.d.ts","sourceRoot":"","sources":["../../src/hooks/use-apps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAyB,cAAc,EAAE,MAAM,eAAe,CAAC;AAEzF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;IACjC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;CAChD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,aAAa,CAgBxE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StandardJSONSchemaV1 } from "@standard-schema/spec";
|
|
2
|
+
import type { ScreenDefinition } from "@tailorkit/core/schema";
|
|
3
|
+
import type { TailorKitStore } from "../tailor-kit";
|
|
4
|
+
export type ScreenName<TScreens extends Record<string, ScreenDefinition>> = keyof TScreens & string;
|
|
5
|
+
export type ScreenContext<TScreen> = TScreen extends ScreenDefinition<infer TContext> ? TContext extends StandardJSONSchemaV1 ? StandardJSONSchemaV1.InferOutput<TContext> : Record<string, never> : never;
|
|
6
|
+
interface ReadyScreenOptions<TScreens extends Record<string, ScreenDefinition>, TScreen extends ScreenName<TScreens>> {
|
|
7
|
+
context: ScreenContext<TScreens[TScreen]>;
|
|
8
|
+
screen: TScreen;
|
|
9
|
+
status?: "ready";
|
|
10
|
+
}
|
|
11
|
+
interface LoadingScreenOptions<TScreen extends string> {
|
|
12
|
+
context?: never;
|
|
13
|
+
screen: TScreen;
|
|
14
|
+
status: "loading";
|
|
15
|
+
}
|
|
16
|
+
interface ErrorScreenOptions<TScreen extends string> {
|
|
17
|
+
context?: never;
|
|
18
|
+
screen: TScreen;
|
|
19
|
+
status: "error";
|
|
20
|
+
}
|
|
21
|
+
export type CurrentScreenOptions<TScreens extends Record<string, ScreenDefinition>, TScreen extends ScreenName<TScreens> = ScreenName<TScreens>> = TScreen extends ScreenName<TScreens> ? ReadyScreenOptions<TScreens, TScreen> | LoadingScreenOptions<TScreen> | ErrorScreenOptions<TScreen> : never;
|
|
22
|
+
export declare function createUseCurrentScreen<TScreens extends Record<string, ScreenDefinition>>(store: TailorKitStore): <TScreen extends ScreenName<TScreens>>(options: CurrentScreenOptions<TScreens, TScreen>) => void;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=use-current-screen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-current-screen.d.ts","sourceRoot":"","sources":["../../src/hooks/use-current-screen.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc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