@ecopages/kitajs 0.2.0-beta.8 → 0.2.0-rc.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/package.json +3 -3
- package/src/eco-embed.js +8 -10
- package/src/kitajs-renderer.d.ts +2 -12
- package/src/kitajs-renderer.js +12 -62
- package/src/kitajs.constants.js +1 -4
- package/src/kitajs.plugin.d.ts +3 -16
- package/src/kitajs.plugin.js +15 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/kitajs",
|
|
3
|
-
"version": "0.2.0-
|
|
3
|
+
"version": "0.2.0-rc.0",
|
|
4
4
|
"description": "Kitajs plugin for Ecopages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecopages",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
|
-
"url": "https://github.com/ecopages/ecopages.git",
|
|
30
|
+
"url": "git+https://github.com/ecopages/ecopages.git",
|
|
31
31
|
"directory": "packages/integrations/kitajs"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@ecopages/core": "0.2.0-
|
|
34
|
+
"@ecopages/core": "0.2.0-rc.0",
|
|
35
35
|
"@kitajs/html": "^4.1.0",
|
|
36
36
|
"@kitajs/ts-html-plugin": "^4.0.1"
|
|
37
37
|
}
|
package/src/eco-embed.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/** @jsxImportSource @kitajs/html */
|
|
2
|
+
import { eco } from '@ecopages/core';
|
|
3
|
+
/**
|
|
4
|
+
* Renders a foreign or same-integration eco component from a Kita JSX file
|
|
5
|
+
* without forcing inline mixed-JSX authoring.
|
|
6
|
+
*/
|
|
7
|
+
export function EcoEmbed({ component, props, children, }) {
|
|
8
|
+
return eco.embed(component, props, children);
|
|
8
9
|
}
|
|
9
|
-
export {
|
|
10
|
-
EcoEmbed
|
|
11
|
-
};
|
package/src/kitajs-renderer.d.ts
CHANGED
|
@@ -2,21 +2,11 @@
|
|
|
2
2
|
* This module contains the Kita.js renderer
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import { IntegrationRenderer, type RenderToResponseContext } from '@ecopages/core/route-renderer/integration-renderer';
|
|
5
|
+
import { StringMarkupRenderer } from '@ecopages/core/route-renderer/orchestration/string-markup-renderer';
|
|
7
6
|
/**
|
|
8
7
|
* A renderer for the Kita.js integration.
|
|
9
8
|
* It renders a page using the HtmlTemplate and Page components.
|
|
10
9
|
*/
|
|
11
|
-
export declare class KitaRenderer extends
|
|
10
|
+
export declare class KitaRenderer extends StringMarkupRenderer {
|
|
12
11
|
name: string;
|
|
13
|
-
private isFunctionComponent;
|
|
14
|
-
/**
|
|
15
|
-
* Renders a Kita-owned foreign subtree for component-level orchestration.
|
|
16
|
-
*
|
|
17
|
-
* Includes component-scoped dependency assets when declared.
|
|
18
|
-
*/
|
|
19
|
-
renderComponent(input: ComponentRenderInput): Promise<ComponentRenderResult>;
|
|
20
|
-
render({ params, query, props, locals, pageLocals, metadata, Page, Layout, HtmlTemplate, }: IntegrationRendererRenderOptions): Promise<RouteRendererBody>;
|
|
21
|
-
renderToResponse<P = Record<string, unknown>>(view: EcoComponent<P>, props: P, ctx: RenderToResponseContext): Promise<Response>;
|
|
22
12
|
}
|
package/src/kitajs-renderer.js
CHANGED
|
@@ -1,63 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
async renderComponent(input) {
|
|
14
|
-
if (!this.isFunctionComponent(input.component)) {
|
|
15
|
-
throw new TypeError("Kita renderer expected a callable component.");
|
|
16
|
-
}
|
|
17
|
-
return this.renderStringComponentWithQueuedForeignSubtrees(input, input.component);
|
|
18
|
-
}
|
|
19
|
-
async render({
|
|
20
|
-
params,
|
|
21
|
-
query,
|
|
22
|
-
props,
|
|
23
|
-
locals,
|
|
24
|
-
pageLocals,
|
|
25
|
-
metadata,
|
|
26
|
-
Page,
|
|
27
|
-
Layout,
|
|
28
|
-
HtmlTemplate
|
|
29
|
-
}) {
|
|
30
|
-
try {
|
|
31
|
-
return await this.renderPageWithDocumentShell({
|
|
32
|
-
page: {
|
|
33
|
-
component: Page,
|
|
34
|
-
props: { params, query, ...props, locals: pageLocals }
|
|
35
|
-
},
|
|
36
|
-
layout: Layout ? {
|
|
37
|
-
component: Layout,
|
|
38
|
-
props: locals ? { locals } : {}
|
|
39
|
-
} : void 0,
|
|
40
|
-
htmlTemplate: HtmlTemplate,
|
|
41
|
-
metadata,
|
|
42
|
-
pageProps: props ?? {}
|
|
43
|
-
});
|
|
44
|
-
} catch (error) {
|
|
45
|
-
throw this.createRenderError("Error rendering page", error);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async renderToResponse(view, props, ctx) {
|
|
49
|
-
try {
|
|
50
|
-
return await this.renderViewWithDocumentShell({
|
|
51
|
-
view,
|
|
52
|
-
props,
|
|
53
|
-
ctx,
|
|
54
|
-
layout: view.config?.layout
|
|
55
|
-
});
|
|
56
|
-
} catch (error) {
|
|
57
|
-
throw this.createRenderError("Error rendering view", error);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* This module contains the Kita.js renderer
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { StringMarkupRenderer } from '@ecopages/core/route-renderer/orchestration/string-markup-renderer';
|
|
6
|
+
import { KITAJS_PLUGIN_NAME } from './kitajs.constants.js';
|
|
7
|
+
/**
|
|
8
|
+
* A renderer for the Kita.js integration.
|
|
9
|
+
* It renders a page using the HtmlTemplate and Page components.
|
|
10
|
+
*/
|
|
11
|
+
export class KitaRenderer extends StringMarkupRenderer {
|
|
12
|
+
name = KITAJS_PLUGIN_NAME;
|
|
60
13
|
}
|
|
61
|
-
export {
|
|
62
|
-
KitaRenderer
|
|
63
|
-
};
|
package/src/kitajs.constants.js
CHANGED
package/src/kitajs.plugin.d.ts
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import { IntegrationPlugin, type IntegrationPluginConfig } from '@ecopages/core/plugins/integration-plugin';
|
|
2
|
-
import { KitaRenderer } from './kitajs-renderer.js';
|
|
3
1
|
/**
|
|
4
2
|
* The name of the Kita.js plugin
|
|
5
3
|
*/
|
|
6
4
|
export declare const PLUGIN_NAME = "kitajs";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
export declare class KitaHtmlPlugin extends IntegrationPlugin {
|
|
12
|
-
renderer: typeof KitaRenderer;
|
|
13
|
-
constructor(options?: Omit<IntegrationPluginConfig, 'name'>);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Factory function to create a Kita.js plugin instance.
|
|
17
|
-
* @param options Configuration options for the Kita.js plugin
|
|
18
|
-
* @returns A new KitaHtmlPlugin instance
|
|
19
|
-
*/
|
|
20
|
-
export declare function kitajsPlugin(options?: Omit<IntegrationPluginConfig, 'name'>): KitaHtmlPlugin;
|
|
5
|
+
export declare const kitajsPlugin: import("@ecopages/core/plugins/define-integration").DefinedIntegration<import("@ecopages/core").EcoPagesElement>;
|
|
6
|
+
/** @deprecated Use {@link kitajsPlugin.Plugin} or {@link kitajsPlugin} instead. */
|
|
7
|
+
export declare const KitaHtmlPlugin: new (options?: Omit<import("@ecopages/core/plugins/integration-plugin").IntegrationPluginConfig, "name">) => import("@ecopages/core/plugins/integration-plugin").IntegrationPlugin<import("@ecopages/core").EcoPagesElement>;
|
package/src/kitajs.plugin.js
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KitaRenderer } from
|
|
3
|
-
import { KITAJS_PLUGIN_NAME } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function kitajsPlugin(options) {
|
|
17
|
-
return new KitaHtmlPlugin(options);
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
KitaHtmlPlugin,
|
|
21
|
-
PLUGIN_NAME,
|
|
22
|
-
kitajsPlugin
|
|
23
|
-
};
|
|
1
|
+
import { defineIntegration } from '@ecopages/core/plugins/define-integration';
|
|
2
|
+
import { KitaRenderer } from './kitajs-renderer.js';
|
|
3
|
+
import { KITAJS_PLUGIN_NAME } from './kitajs.constants.js';
|
|
4
|
+
/**
|
|
5
|
+
* The name of the Kita.js plugin
|
|
6
|
+
*/
|
|
7
|
+
export const PLUGIN_NAME = KITAJS_PLUGIN_NAME;
|
|
8
|
+
export const kitajsPlugin = defineIntegration({
|
|
9
|
+
name: PLUGIN_NAME,
|
|
10
|
+
extensions: ['.kita.tsx'],
|
|
11
|
+
jsxImportSource: '@kitajs/html',
|
|
12
|
+
renderer: KitaRenderer,
|
|
13
|
+
});
|
|
14
|
+
/** @deprecated Use {@link kitajsPlugin.Plugin} or {@link kitajsPlugin} instead. */
|
|
15
|
+
export const KitaHtmlPlugin = kitajsPlugin.Plugin;
|