@teactjs/renderer 0.1.0-alpha.4

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.
@@ -0,0 +1,23 @@
1
+ import type { OutputNode } from './types';
2
+ /**
3
+ * Internal mutable tree node used by the reconciler.
4
+ * After commit, the tree is serialized into immutable OutputNode objects.
5
+ */
6
+ export declare class TNode {
7
+ type: string;
8
+ props: Record<string, any>;
9
+ children: TNode[];
10
+ parent: TNode | null;
11
+ constructor(type: string, props?: Record<string, any>);
12
+ appendChild(child: TNode): void;
13
+ removeChild(child: TNode): void;
14
+ insertBefore(child: TNode, before: TNode): void;
15
+ /** Deep-serialize into a plain OutputNode tree (for adapter consumption). */
16
+ serialize(): OutputNode;
17
+ }
18
+ export declare class TextNode extends TNode {
19
+ text: string;
20
+ constructor(text: string);
21
+ serialize(): OutputNode;
22
+ }
23
+ //# sourceMappingURL=nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;GAGG;AACH,qBAAa,KAAK;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,QAAQ,EAAE,KAAK,EAAE,CAAM;IACvB,MAAM,EAAE,KAAK,GAAG,IAAI,CAAQ;gBAEhB,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAKzD,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAK/B,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAM/B,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,IAAI;IAU/C,6EAA6E;IAC7E,SAAS,IAAI,UAAU;CAOxB;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,IAAI,EAAE,MAAM,CAAC;gBAED,IAAI,EAAE,MAAM;IAKf,SAAS,IAAI,UAAU;CAGjC"}
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { OutputNode } from './types';
3
+ export declare const KNOWN_HOST_TYPES: Set<string>;
4
+ export interface TeactRoot {
5
+ render(element: ReactNode): void;
6
+ unmount(): void;
7
+ }
8
+ export declare function createRoot(onCommit: (tree: OutputNode) => void): TeactRoot;
9
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM1C,eAAO,MAAM,gBAAgB,aAS3B,CAAC;AA8JH,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,GAAG,SAAS,CAyB1E"}
@@ -0,0 +1,36 @@
1
+ /** Serialized output tree that adapters consume to send platform messages. */
2
+ export interface OutputNode {
3
+ type: string;
4
+ props: Record<string, any>;
5
+ children: OutputNode[];
6
+ }
7
+ export interface User {
8
+ id: string;
9
+ username?: string;
10
+ firstName?: string;
11
+ lastName?: string;
12
+ isBot?: boolean;
13
+ platform: string;
14
+ }
15
+ export interface BotContext {
16
+ chatId: string;
17
+ userId: string;
18
+ user: User;
19
+ platform: string;
20
+ messageId?: string;
21
+ text?: string;
22
+ callbackData?: string;
23
+ /** The bot's own username (e.g. "my_bot"), available after connection. */
24
+ botUsername?: string;
25
+ raw: any;
26
+ }
27
+ export interface SessionData {
28
+ [key: string]: any;
29
+ }
30
+ export interface SessionStore {
31
+ get(key: string): Promise<SessionData | null>;
32
+ set(key: string, data: SessionData): Promise<void>;
33
+ delete(key: string): Promise<void>;
34
+ }
35
+ export type Middleware = (ctx: BotContext, next: () => Promise<void>) => Promise<void>;
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,GAAG,CAAC;CACV;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@teactjs/renderer",
3
+ "version": "0.1.0-alpha.4",
4
+ "description": "Internal React reconciler for Teact",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": ["dist", "README.md"],
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "build": "bun build ./src/index.ts --outdir ./dist --format esm --target bun && tsc --emitDeclarationOnly --outDir dist --declaration --project tsconfig.build.json"
17
+ },
18
+ "peerDependencies": {
19
+ "react": "^18.0.0 || ^19.0.0"
20
+ },
21
+ "dependencies": {
22
+ "react-reconciler": "^0.31.0"
23
+ },
24
+ "license": "MIT"
25
+ }