@limo-labs/deity 0.2.0-alpha.0 → 0.2.1
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/README.md +118 -11
- package/dist/index.cjs +930 -306
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +720 -169
- package/dist/index.d.ts +720 -169
- package/dist/index.js +907 -303
- package/dist/index.js.map +1 -1
- package/dist/{jsx-dev-runtime-CKrGWO-8.d.cts → jsx-dev-runtime-Dg782FK5.d.cts} +309 -13
- package/dist/{jsx-dev-runtime-CKrGWO-8.d.ts → jsx-dev-runtime-Dg782FK5.d.ts} +309 -13
- package/dist/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +1 -1
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.cts +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js.map +1 -1
- package/package.json +10 -1
package/dist/jsx-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/jsx-runtime.ts"],"names":[],"mappings":";AAgEO,SAAS,GAAA,CACd,IAAA,EACA,KAAA,EACA,GAAA,EACG;AAEH,EAAA,MAAM,eAAA,GAAkB,SAAS,EAAC;AAGlC,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,SAAA,EAAU,GAAI,eAAA;AAGnC,EAAA,MAAM,aAAA,GAAgB,kBAAkB,QAAQ,CAAA;AAGhD,EAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,IAAA,OAAO,KAAK,EAAE,GAAG,SAAA,EAAW,QAAA,EAAU,eAAe,CAAA;AAAA,EACvD;AAGA,EAAA,OAAO,aAAA,CAAc,IAAA,EAAgB,SAAA,EAAW,aAAA,EAAe,GAAG,CAAA;AACpE;AAQO,SAAS,IAAA,CACd,IA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;AAEA,EAAA,IAAI,QAAA,CAAS,SAAS,CAAA,EAAG;AACvB,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAAA,EAClB;AAEA,EAAA,IAAI,QAAQ,MAAA,EAAW;AACrB,IAAA,IAAA,CAAK,KAAA,GAAQ,EAAE,GAAG,IAAA,CAAK,OAAO,GAAA,EAAI;AAAA,EACpC;AAEA,EAAA,OAAO,IAAA;AACT;AAKA,SAAS,UAAU,KAAA,EAAkC;AACnD,EAAA,OACE,OAAO,UAAU,QAAA,IACjB,KAAA,KAAU,QACV,MAAA,IAAU,KAAA,IACV,OAAQ,KAAA,CAAkB,IAAA,KAAS,QAAA;AAEvC","file":"jsx-runtime.js","sourcesContent":["/**\r\n * Deity TSX - JSX Runtime\r\n *\r\n * This module implements the JSX Factory for transforming TSX syntax into AST nodes.\r\n *\r\n * Design principles:\r\n * - Pure transformation (no side effects)\r\n * - Type-safe (leverage TypeScript's JSX type checking)\r\n * - Minimal runtime overhead\r\n */\r\n\r\nimport type { ASTNode } from './ast/types.js';\r\n\r\n// ============================================================================\r\n// JSX Runtime Types\r\n// ============================================================================\r\n\r\n/**\r\n * JSX Element Type\r\n *\r\n * Can be:\r\n * - String (intrinsic element): 'div', 'span', etc.\r\n * - Component function: (props) => ASTNode\r\n */\r\nexport type JSXElementType = string | JSXComponent;\r\n\r\n/**\r\n * JSX Component Function\r\n */\r\nexport type JSXComponent = (props: JSXProps) => ASTNode;\r\n\r\n/**\r\n * JSX Props (generic)\r\n */\r\nexport interface JSXProps {\r\n children?: ASTNode | ASTNode[];\r\n [key: string]: unknown;\r\n}\r\n\r\n// ============================================================================\r\n// JSX Factory Implementation\r\n// ============================================================================\r\n\r\n/**\r\n * JSX Factory - Transform JSX calls into AST nodes\r\n *\r\n * This is the core function called by TypeScript when it encounters JSX syntax.\r\n *\r\n * @example\r\n * // TSX code:\r\n * <Agent id=\"test\" input={schema} output={schema}>\r\n * <Prompt>...</Prompt>\r\n * </Agent>\r\n *\r\n * // Compiled to:\r\n * jsx('Agent', { id: 'test', input: schema, output: schema }, [\r\n * jsx('Prompt', {}, [...])\r\n * ])\r\n *\r\n * @param type - Element type (string or component function)\r\n * @param props - Element props (includes children)\r\n * @param key - Optional key (for lists)\r\n * @returns AST Node\r\n */\r\nexport function jsx<T extends ASTNode = ASTNode>(\r\n type: JSXElementType | ((props: any) => T),\r\n props: JSXProps | null,\r\n key?: string\r\n): T {\r\n // Normalize props\r\n const normalizedProps = props ?? {};\r\n\r\n // Extract children from props\r\n const { children, ...restProps } = normalizedProps;\r\n\r\n // Normalize children to array\r\n const childrenArray = normalizeChildren(children);\r\n\r\n // Handle component functions\r\n if (typeof type === 'function') {\r\n return type({ ...restProps, children: childrenArray }) as T;\r\n }\r\n\r\n // Handle intrinsic elements (string type)\r\n return createASTNode(type as string, restProps, childrenArray, key) as T;\r\n}\r\n\r\n/**\r\n * JSX Fragment - For <></> syntax\r\n *\r\n * Fragments are not used in Deity TSX (we use explicit nodes),\r\n * but we implement it for completeness.\r\n */\r\nexport function jsxs<T extends ASTNode = ASTNode>(\r\n type: JSXElementType | ((props: any) => T),\r\n props: JSXProps | null,\r\n key?: string\r\n): T {\r\n // jsxs is the same as jsx in our implementation\r\n return jsx(type, props, key);\r\n}\r\n\r\n/**\r\n * JSX Fragment component\r\n */\r\nexport const Fragment = Symbol('Fragment');\r\n\r\n// ============================================================================\r\n// Helper Functions\r\n// ============================================================================\r\n\r\n/**\r\n * Normalize children into an array\r\n *\r\n * Children can be:\r\n * - Undefined/null (no children)\r\n * - Single child (ASTNode or primitive)\r\n * - Array of children\r\n * - Function (for computed children)\r\n */\r\nfunction normalizeChildren(children: unknown): ASTNode[] {\r\n if (children === undefined || children === null) {\r\n return [];\r\n }\r\n\r\n if (Array.isArray(children)) {\r\n return children\r\n .filter(child => child !== null && child !== undefined)\r\n .flatMap(child => normalizeChildren(child));\r\n }\r\n\r\n // If it's already an ASTNode, return it\r\n if (isASTNode(children)) {\r\n return [children];\r\n }\r\n\r\n // If it's a function, we'll store it as a special TextNode\r\n // (This is for computed content like {(ctx) => \"...\"}\r\n if (typeof children === 'function') {\r\n return [{\r\n type: 'ComputedText',\r\n props: { compute: children },\r\n }];\r\n }\r\n\r\n // If it's a primitive (string/number/boolean), create a TextNode\r\n if (typeof children === 'string' || typeof children === 'number' || typeof children === 'boolean') {\r\n return [{\r\n type: 'Text',\r\n props: { content: String(children) },\r\n }];\r\n }\r\n\r\n return [];\r\n}\r\n\r\n/**\r\n * Create an AST Node from JSX elements\r\n */\r\nfunction createASTNode(\r\n type: string,\r\n props: Record<string, unknown>,\r\n children: ASTNode[],\r\n key?: string\r\n): ASTNode {\r\n const node: ASTNode = {\r\n type,\r\n props: { ...props },\r\n };\r\n\r\n if (children.length > 0) {\r\n node.children = children;\r\n }\r\n\r\n if (key !== undefined) {\r\n node.props = { ...node.props, key };\r\n }\r\n\r\n return node;\r\n}\r\n\r\n/**\r\n * Type guard for ASTNode\r\n */\r\nfunction isASTNode(value: unknown): value is ASTNode {\r\n return (\r\n typeof value === 'object' &&\r\n value !== null &&\r\n 'type' in value &&\r\n typeof (value as ASTNode).type === 'string'\r\n );\r\n}\r\n\r\n// ============================================================================\r\n// TypeScript JSX Namespace\r\n// ============================================================================\r\n\r\n/**\r\n * JSX Namespace Declaration\r\n *\r\n * This tells TypeScript how to type-check JSX elements.\r\n */\r\ndeclare global {\r\n namespace JSX {\r\n /**\r\n * Element type (return type of JSX expressions)\r\n *\r\n *
|
|
1
|
+
{"version":3,"sources":["../src/jsx-runtime.ts"],"names":[],"mappings":";AAgEO,SAAS,GAAA,CACd,IAAA,EACA,KAAA,EACA,GAAA,EACG;AAEH,EAAA,MAAM,eAAA,GAAkB,SAAS,EAAC;AAGlC,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,SAAA,EAAU,GAAI,eAAA;AAGnC,EAAA,MAAM,aAAA,GAAgB,kBAAkB,QAAQ,CAAA;AAGhD,EAAA,IAAI,OAAO,SAAS,UAAA,EAAY;A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AAEA,EAAA,OAAO,EAAC;AACV;AAKA,SAAS,aAAA,CACP,IAAA,EACA,KAAA,EACA,QAAA,EACA,GAAA,EACS;AACT,EAAA,MAAM,IAAA,GAAgB;AAAA,IACpB,IAAA;AAAA,IACA,KAAA,EAAO,EAAE,GAAG,KAAA;AAAM,GACpB;AAEA,EAAA,IAAI,QAAA,CAAS,SAAS,CAAA,EAAG;AACvB,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAAA,EAClB;AAEA,EAAA,IAAI,QAAQ,MAAA,EAAW;AACrB,IAAA,IAAA,CAAK,KAAA,GAAQ,EAAE,GAAG,IAAA,CAAK,OAAO,GAAA,EAAI;AAAA,EACpC;AAEA,EAAA,OAAO,IAAA;AACT;AAKA,SAAS,UAAU,KAAA,EAAkC;AACnD,EAAA,OACE,OAAO,UAAU,QAAA,IACjB,KAAA,KAAU,QACV,MAAA,IAAU,KAAA,IACV,OAAQ,KAAA,CAAkB,IAAA,KAAS,QAAA;AAEvC","file":"jsx-runtime.js","sourcesContent":["/**\r\n * Deity TSX - JSX Runtime\r\n *\r\n * This module implements the JSX Factory for transforming TSX syntax into AST nodes.\r\n *\r\n * Design principles:\r\n * - Pure transformation (no side effects)\r\n * - Type-safe (leverage TypeScript's JSX type checking)\r\n * - Minimal runtime overhead\r\n */\r\n\r\nimport type { ASTNode } from './ast/types.js';\r\n\r\n// ============================================================================\r\n// JSX Runtime Types\r\n// ============================================================================\r\n\r\n/**\r\n * JSX Element Type\r\n *\r\n * Can be:\r\n * - String (intrinsic element): 'div', 'span', etc.\r\n * - Component function: (props) => ASTNode\r\n */\r\nexport type JSXElementType = string | JSXComponent;\r\n\r\n/**\r\n * JSX Component Function\r\n */\r\nexport type JSXComponent = (props: JSXProps) => ASTNode;\r\n\r\n/**\r\n * JSX Props (generic)\r\n */\r\nexport interface JSXProps {\r\n children?: ASTNode | ASTNode[];\r\n [key: string]: unknown;\r\n}\r\n\r\n// ============================================================================\r\n// JSX Factory Implementation\r\n// ============================================================================\r\n\r\n/**\r\n * JSX Factory - Transform JSX calls into AST nodes\r\n *\r\n * This is the core function called by TypeScript when it encounters JSX syntax.\r\n *\r\n * @example\r\n * // TSX code:\r\n * <Agent id=\"test\" input={schema} output={schema}>\r\n * <Prompt>...</Prompt>\r\n * </Agent>\r\n *\r\n * // Compiled to:\r\n * jsx('Agent', { id: 'test', input: schema, output: schema }, [\r\n * jsx('Prompt', {}, [...])\r\n * ])\r\n *\r\n * @param type - Element type (string or component function)\r\n * @param props - Element props (includes children)\r\n * @param key - Optional key (for lists)\r\n * @returns AST Node\r\n */\r\nexport function jsx<T extends ASTNode = ASTNode>(\r\n type: JSXElementType | ((props: any) => T),\r\n props: JSXProps | null,\r\n key?: string\r\n): T {\r\n // Normalize props\r\n const normalizedProps = props ?? {};\r\n\r\n // Extract children from props\r\n const { children, ...restProps } = normalizedProps;\r\n\r\n // Normalize children to array\r\n const childrenArray = normalizeChildren(children);\r\n\r\n // Handle component functions\r\n if (typeof type === 'function') {\r\n return type({ ...restProps, children: childrenArray }) as T;\r\n }\r\n\r\n // Handle intrinsic elements (string type)\r\n return createASTNode(type as string, restProps, childrenArray, key) as T;\r\n}\r\n\r\n/**\r\n * JSX Fragment - For <></> syntax\r\n *\r\n * Fragments are not used in Deity TSX (we use explicit nodes),\r\n * but we implement it for completeness.\r\n */\r\nexport function jsxs<T extends ASTNode = ASTNode>(\r\n type: JSXElementType | ((props: any) => T),\r\n props: JSXProps | null,\r\n key?: string\r\n): T {\r\n // jsxs is the same as jsx in our implementation\r\n return jsx(type, props, key);\r\n}\r\n\r\n/**\r\n * JSX Fragment component\r\n */\r\nexport const Fragment = Symbol('Fragment');\r\n\r\n// ============================================================================\r\n// Helper Functions\r\n// ============================================================================\r\n\r\n/**\r\n * Normalize children into an array\r\n *\r\n * Children can be:\r\n * - Undefined/null (no children)\r\n * - Single child (ASTNode or primitive)\r\n * - Array of children\r\n * - Function (for computed children)\r\n */\r\nfunction normalizeChildren(children: unknown): ASTNode[] {\r\n if (children === undefined || children === null) {\r\n return [];\r\n }\r\n\r\n if (Array.isArray(children)) {\r\n return children\r\n .filter(child => child !== null && child !== undefined)\r\n .flatMap(child => normalizeChildren(child));\r\n }\r\n\r\n // If it's already an ASTNode, return it\r\n if (isASTNode(children)) {\r\n return [children];\r\n }\r\n\r\n // If it's a function, we'll store it as a special TextNode\r\n // (This is for computed content like {(ctx) => \"...\"}\r\n if (typeof children === 'function') {\r\n return [{\r\n type: 'ComputedText',\r\n props: { compute: children },\r\n }];\r\n }\r\n\r\n // If it's a primitive (string/number/boolean), create a TextNode\r\n if (typeof children === 'string' || typeof children === 'number' || typeof children === 'boolean') {\r\n return [{\r\n type: 'Text',\r\n props: { content: String(children) },\r\n }];\r\n }\r\n\r\n return [];\r\n}\r\n\r\n/**\r\n * Create an AST Node from JSX elements\r\n */\r\nfunction createASTNode(\r\n type: string,\r\n props: Record<string, unknown>,\r\n children: ASTNode[],\r\n key?: string\r\n): ASTNode {\r\n const node: ASTNode = {\r\n type,\r\n props: { ...props },\r\n };\r\n\r\n if (children.length > 0) {\r\n node.children = children;\r\n }\r\n\r\n if (key !== undefined) {\r\n node.props = { ...node.props, key };\r\n }\r\n\r\n return node;\r\n}\r\n\r\n/**\r\n * Type guard for ASTNode\r\n */\r\nfunction isASTNode(value: unknown): value is ASTNode {\r\n return (\r\n typeof value === 'object' &&\r\n value !== null &&\r\n 'type' in value &&\r\n typeof (value as ASTNode).type === 'string'\r\n );\r\n}\r\n\r\n// ============================================================================\r\n// TypeScript JSX Namespace\r\n// ============================================================================\r\n\r\n/**\r\n * JSX Namespace Declaration\r\n *\r\n * This tells TypeScript how to type-check JSX elements.\r\n */\r\ndeclare global {\r\n namespace JSX {\r\n /**\r\n * Element type (return type of JSX expressions)\r\n *\r\n * Instead of fixing this to ASTNode, we leave it generic so TypeScript\r\n * can infer the specific return type from the component function.\r\n */\r\n type Element = any; // Allows TypeScript to infer specific types from component functions\r\n\r\n /**\r\n * Intrinsic elements (built-in HTML-like elements)\r\n *\r\n * In Deity TSX, we don't use intrinsic elements.\r\n * All elements are explicit component types.\r\n */\r\n interface IntrinsicElements {\r\n [elemName: string]: never;\r\n }\r\n\r\n /**\r\n * Element class (for class components)\r\n *\r\n * Deity TSX only uses function components.\r\n */\r\n interface ElementClass {\r\n render(): any;\r\n }\r\n\r\n /**\r\n * Element attributes property\r\n */\r\n interface ElementAttributesProperty {\r\n props: {};\r\n }\r\n\r\n /**\r\n * Element children attribute\r\n */\r\n interface ElementChildrenAttribute {\r\n children: {};\r\n }\r\n }\r\n}\r\n\r\n// ============================================================================\r\n// Exports\r\n// ============================================================================\r\n\r\nexport { jsx as jsxDEV };\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limo-labs/deity",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Biological instincts for AI agents - minimal primitives, maximum control",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -63,6 +63,15 @@
|
|
|
63
63
|
],
|
|
64
64
|
"author": "Limo Labs",
|
|
65
65
|
"license": "MIT",
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "https://github.com/Limo-Labs/Limo-Deity.git",
|
|
69
|
+
"directory": "packages/core"
|
|
70
|
+
},
|
|
71
|
+
"homepage": "https://github.com/Limo-Labs/Limo-Deity#readme",
|
|
72
|
+
"bugs": {
|
|
73
|
+
"url": "https://github.com/Limo-Labs/Limo-Deity/issues"
|
|
74
|
+
},
|
|
66
75
|
"dependencies": {
|
|
67
76
|
"zod": "^4.3.6"
|
|
68
77
|
},
|