@tailorkit/app 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/builder.js +0 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -8
- package/package.json +2 -2
package/dist/builder.js
CHANGED
|
@@ -117,7 +117,6 @@ var createTailorKitUploadManifest = (logos) => tailorkitUploadManifestSchema.par
|
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
// src/builder/index.ts
|
|
120
|
-
var preactExternal = /^preact(?:\/.*)?$/u;
|
|
121
120
|
var preactPackageJson = "preact/package.json";
|
|
122
121
|
var preactPackageJsonModuleId = "\0tailorkit-preact-package-json";
|
|
123
122
|
var buildApp = async (options = {}) => {
|
|
@@ -139,7 +138,6 @@ var buildApp = async (options = {}) => {
|
|
|
139
138
|
watch: options.watch ? {} : null,
|
|
140
139
|
minify: "oxc",
|
|
141
140
|
rollupOptions: {
|
|
142
|
-
external: (id) => id !== preactPackageJson && id !== preactPackageJsonModuleId && preactExternal.test(id),
|
|
143
141
|
output: {
|
|
144
142
|
comments: {
|
|
145
143
|
annotation: false,
|
package/dist/index.d.ts
CHANGED
|
@@ -62,10 +62,10 @@ export declare const createScreen: <const TPath extends AppScreenPath>(path: TPa
|
|
|
62
62
|
loading?: View<Record<string, never>>;
|
|
63
63
|
}) => ScreenDefinition<TPath>;
|
|
64
64
|
export declare const defineClient: <const TScreens extends ScreenDefinitions>(client: TailorKitClient<TScreens> & RequireScreenPaths<TScreens> & RequireMatchingScreenKeys<TScreens>) => TailorKitClientWithMeta<TScreens>;
|
|
65
|
-
export declare const createRemoteComponent: <TProps extends object,
|
|
65
|
+
export declare const createRemoteComponent: <TProps extends object, TChildren extends boolean = false>(name: string, options?: {
|
|
66
66
|
callbacks?: Record<string, number>;
|
|
67
|
-
|
|
67
|
+
children?: TChildren;
|
|
68
68
|
}) => View<TProps & {
|
|
69
|
-
children?: ComponentChildren;
|
|
69
|
+
children?: TChildren extends true ? ComponentChildren : never;
|
|
70
70
|
}>;
|
|
71
71
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -43,14 +43,9 @@ var componentTagPrefix = "tailorkit-";
|
|
|
43
43
|
var toComponentTagName = (name) => `${componentTagPrefix}${name.replaceAll(/([a-z0-9])([A-Z])/gu, "$1-$2").replaceAll(/[\s_]+/gu, "-").toLowerCase()}`;
|
|
44
44
|
var toCallbackEventName = (name) => `tailorkitcallback${name.replaceAll(/[^A-Za-z0-9_$]/gu, "").toLowerCase()}`;
|
|
45
45
|
var toEventProp = (event) => `on${event}`;
|
|
46
|
-
var createRemoteComponent = (name, options) => {
|
|
46
|
+
var createRemoteComponent = (name, options = {}) => {
|
|
47
47
|
const tagName = toComponentTagName(name);
|
|
48
|
-
const callbacks = options.callbacks;
|
|
49
|
-
if (!callbacks || Object.keys(callbacks).length === 0) {
|
|
50
|
-
return function RemoteComponent({ children, ...props }) {
|
|
51
|
-
return h(tagName, props, children);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
48
|
+
const callbacks = options.callbacks ?? {};
|
|
54
49
|
return function RemoteComponent({ children, ...props }) {
|
|
55
50
|
const nextProps = { ...props };
|
|
56
51
|
const callbackMap = {};
|
|
@@ -66,10 +61,14 @@ var createRemoteComponent = (name, options) => {
|
|
|
66
61
|
callback(...(event.detail ?? []).slice(0, inputCount));
|
|
67
62
|
};
|
|
68
63
|
}
|
|
64
|
+
const serializedProps = Object.fromEntries(
|
|
65
|
+
Object.entries(nextProps).filter(([, value]) => typeof value !== "function")
|
|
66
|
+
);
|
|
67
|
+
nextProps["data-tailorkit-props"] = JSON.stringify(serializedProps);
|
|
69
68
|
if (Object.keys(callbackMap).length > 0) {
|
|
70
69
|
nextProps["data-tailorkit-callbacks"] = JSON.stringify(callbackMap);
|
|
71
70
|
}
|
|
72
|
-
return h(tagName, nextProps, children);
|
|
71
|
+
return h(tagName, nextProps, options.children ? children : void 0);
|
|
73
72
|
};
|
|
74
73
|
};
|
|
75
74
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailorkit/app",
|
|
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tailorkit/core": "0.1.0-beta.
|
|
36
|
+
"@tailorkit/core": "0.1.0-beta.8",
|
|
37
37
|
"cosmiconfig": "^10.0.0",
|
|
38
38
|
"vite": "^8.2.2",
|
|
39
39
|
"zod": "^4.4.3"
|