@tailorkit/react 0.1.0-beta.7 → 0.1.0-beta.8
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/index.js +9 -13
- package/dist/primitives.d.ts +8 -16
- package/dist/remote-context.d.ts +2 -2
- package/dist/remote-view.d.ts +1 -2
- package/dist/tailor-kit.d.ts +5 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -360,10 +360,10 @@ var Primitive = ({
|
|
|
360
360
|
] });
|
|
361
361
|
};
|
|
362
362
|
var primitives = {
|
|
363
|
-
Box: ({ props,
|
|
364
|
-
Flex: ({ props,
|
|
365
|
-
Grid: ({ props,
|
|
366
|
-
Inline: ({ props,
|
|
363
|
+
Box: ({ props, children }) => /* @__PURE__ */ jsx2(Primitive, { display: "block", element: "div", props, children }),
|
|
364
|
+
Flex: ({ props, children }) => /* @__PURE__ */ jsx2(Primitive, { display: "flex", element: "div", props, children }),
|
|
365
|
+
Grid: ({ props, children }) => /* @__PURE__ */ jsx2(Primitive, { display: "grid", element: "div", props, children }),
|
|
366
|
+
Inline: ({ props, children }) => /* @__PURE__ */ jsx2(Primitive, { display: "inline", element: "span", props, children })
|
|
367
367
|
};
|
|
368
368
|
|
|
369
369
|
// src/remote-view.tsx
|
|
@@ -515,8 +515,7 @@ function RemoteViewHost({
|
|
|
515
515
|
appUrl,
|
|
516
516
|
components: components2,
|
|
517
517
|
createIframe,
|
|
518
|
-
props
|
|
519
|
-
runtimeUrl
|
|
518
|
+
props
|
|
520
519
|
}) {
|
|
521
520
|
const appKey = appUrl.toString();
|
|
522
521
|
const storeRef = useRef2(null);
|
|
@@ -560,8 +559,7 @@ function RemoteViewHost({
|
|
|
560
559
|
setError(error2);
|
|
561
560
|
setStatus("error");
|
|
562
561
|
},
|
|
563
|
-
props
|
|
564
|
-
runtimeUrl
|
|
562
|
+
props
|
|
565
563
|
});
|
|
566
564
|
dispatchRef.current = (payload) => host.dispatch(payload);
|
|
567
565
|
const unsubscribe = host.subscribe(() => {
|
|
@@ -579,7 +577,7 @@ function RemoteViewHost({
|
|
|
579
577
|
dispatchRef.current = null;
|
|
580
578
|
host.destroy();
|
|
581
579
|
};
|
|
582
|
-
}, [appUrl, createIframe, props,
|
|
580
|
+
}, [appUrl, createIframe, props, store]);
|
|
583
581
|
if (status === "error" && error) {
|
|
584
582
|
return createElement2("div", null, formatError(error));
|
|
585
583
|
}
|
|
@@ -663,7 +661,7 @@ function createReactTailorKitClient(options) {
|
|
|
663
661
|
}) {
|
|
664
662
|
return renderer({
|
|
665
663
|
props,
|
|
666
|
-
|
|
664
|
+
children
|
|
667
665
|
});
|
|
668
666
|
};
|
|
669
667
|
wrappedComponents[name] = TailorKitComponent;
|
|
@@ -676,7 +674,6 @@ function createReactTailorKitClient(options) {
|
|
|
676
674
|
app,
|
|
677
675
|
createIframe,
|
|
678
676
|
fallback = null,
|
|
679
|
-
runtimeUrl,
|
|
680
677
|
...screenProps
|
|
681
678
|
}) => {
|
|
682
679
|
const reactId = useId2();
|
|
@@ -731,8 +728,7 @@ function createReactTailorKitClient(options) {
|
|
|
731
728
|
appUrl,
|
|
732
729
|
components: wrappedComponents,
|
|
733
730
|
createIframe,
|
|
734
|
-
props
|
|
735
|
-
runtimeUrl
|
|
731
|
+
props
|
|
736
732
|
}
|
|
737
733
|
)
|
|
738
734
|
] }) });
|
package/dist/primitives.d.ts
CHANGED
|
@@ -8,29 +8,21 @@ interface PrimitiveThemeContextValue {
|
|
|
8
8
|
export declare const PrimitiveThemeContext: import("react").Context<PrimitiveThemeContextValue | null>;
|
|
9
9
|
export declare const buildThemeCss: (screenId: string, theme: TailorKitTheme) => string;
|
|
10
10
|
export declare const primitives: {
|
|
11
|
-
readonly Box: ({ props,
|
|
11
|
+
readonly Box: ({ props, children }: {
|
|
12
12
|
props: PrimitiveProps;
|
|
13
|
-
|
|
14
|
-
default?: ReactNode;
|
|
15
|
-
};
|
|
13
|
+
children?: ReactNode;
|
|
16
14
|
}) => import("react").JSX.Element;
|
|
17
|
-
readonly Flex: ({ props,
|
|
15
|
+
readonly Flex: ({ props, children }: {
|
|
18
16
|
props: PrimitiveProps;
|
|
19
|
-
|
|
20
|
-
default?: ReactNode;
|
|
21
|
-
};
|
|
17
|
+
children?: ReactNode;
|
|
22
18
|
}) => import("react").JSX.Element;
|
|
23
|
-
readonly Grid: ({ props,
|
|
19
|
+
readonly Grid: ({ props, children }: {
|
|
24
20
|
props: PrimitiveProps;
|
|
25
|
-
|
|
26
|
-
default?: ReactNode;
|
|
27
|
-
};
|
|
21
|
+
children?: ReactNode;
|
|
28
22
|
}) => import("react").JSX.Element;
|
|
29
|
-
readonly Inline: ({ props,
|
|
23
|
+
readonly Inline: ({ props, children }: {
|
|
30
24
|
props: PrimitiveProps;
|
|
31
|
-
|
|
32
|
-
default?: ReactNode;
|
|
33
|
-
};
|
|
25
|
+
children?: ReactNode;
|
|
34
26
|
}) => import("react").JSX.Element;
|
|
35
27
|
};
|
|
36
28
|
export type PrimitiveStyle = CSSProperties;
|
package/dist/remote-context.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostToIframePayload } from "@tailorkit/sandbox/protocol";
|
|
2
2
|
import type { NodeStore } from "./node-store";
|
|
3
3
|
export interface RemoteViewContext {
|
|
4
4
|
components: Record<string, unknown>;
|
|
5
|
-
dispatch: (payload:
|
|
5
|
+
dispatch: (payload: HostToIframePayload) => void;
|
|
6
6
|
store: NodeStore;
|
|
7
7
|
}
|
|
8
8
|
export declare const RemoteUIContext: import("react").Context<RemoteViewContext | null>;
|
package/dist/remote-view.d.ts
CHANGED
|
@@ -4,9 +4,8 @@ interface RemoteViewHostProps {
|
|
|
4
4
|
components: Record<string, unknown>;
|
|
5
5
|
createIframe?: () => HTMLIFrameElement;
|
|
6
6
|
props?: Record<string, unknown>;
|
|
7
|
-
runtimeUrl?: string | URL;
|
|
8
7
|
}
|
|
9
|
-
export declare function RemoteViewHost({ appUrl, components, createIframe, props,
|
|
8
|
+
export declare function RemoteViewHost({ appUrl, components, createIframe, props, }: RemoteViewHostProps): ReactNode;
|
|
10
9
|
interface RemoteViewProps {
|
|
11
10
|
nodeId: string;
|
|
12
11
|
}
|
package/dist/tailor-kit.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { TailorKitSchemaSpecType } from "@tailorkit/core/spec";
|
|
3
|
-
import type { TailorKitTheme, CallbackMap, ComponentDefinition, ComponentProps,
|
|
3
|
+
import type { TailorKitTheme, CallbackMap, ComponentDefinition, ComponentProps, Schema, ScreenDefinition, TailorKitSchema } from "@tailorkit/core/schema";
|
|
4
4
|
import type { primitives } from "./primitives";
|
|
5
5
|
import { Root } from "./components";
|
|
6
6
|
import type { UseAppsResult } from "./hooks/use-apps";
|
|
7
7
|
import type { CurrentScreenOptions, ScreenName } from "./hooks/use-current-screen";
|
|
8
|
-
type
|
|
9
|
-
[TSlot in keyof ComponentSlots<TComponent>]: ReactNode;
|
|
10
|
-
};
|
|
11
|
-
type AnyComponentDefinition = ComponentDefinition<Schema | undefined, CallbackMap, readonly string[] | undefined>;
|
|
8
|
+
type AnyComponentDefinition = ComponentDefinition<Schema | undefined, CallbackMap, boolean | undefined>;
|
|
12
9
|
type ComponentRenderer<TComponent extends AnyComponentDefinition> = (args: {
|
|
13
10
|
props: ComponentProps<TComponent>;
|
|
14
|
-
|
|
11
|
+
children?: TComponent extends {
|
|
12
|
+
children: true;
|
|
13
|
+
} ? ReactNode : never;
|
|
15
14
|
}) => ReactNode;
|
|
16
15
|
type ComponentRenderers<TComponents extends Record<string, AnyComponentDefinition>> = {
|
|
17
16
|
[TName in keyof TComponents]?: ComponentRenderer<TComponents[TName]>;
|
|
@@ -55,7 +54,6 @@ interface AppViewBaseProps {
|
|
|
55
54
|
app: TailorKitApp;
|
|
56
55
|
createIframe?: () => HTMLIFrameElement;
|
|
57
56
|
fallback?: ReactNode;
|
|
58
|
-
runtimeUrl?: string | URL;
|
|
59
57
|
}
|
|
60
58
|
type AppViewScreenProps<TScreens extends Record<string, ScreenDefinition>, TScreen extends ScreenName<TScreens> = ScreenName<TScreens>> = [ScreenName<TScreens>] extends [never] ? {
|
|
61
59
|
context?: never;
|
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.8",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@floating-ui/react-dom": "^2.1.9",
|
|
25
25
|
"@standard-schema/spec": "^1.1.0",
|
|
26
|
-
"@tailorkit/core": "0.1.0-beta.
|
|
27
|
-
"@tailorkit/sandbox": "0.1.0-beta.
|
|
26
|
+
"@tailorkit/core": "0.1.0-beta.8",
|
|
27
|
+
"@tailorkit/sandbox": "0.1.0-beta.8"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@tailorkit/config": "0.0.0",
|