@frontmcp/ui 0.5.1 → 0.6.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 +140 -362
- package/bridge/adapters/base-adapter.d.ts +104 -0
- package/bridge/adapters/base-adapter.d.ts.map +1 -0
- package/bridge/adapters/claude.adapter.d.ts +67 -0
- package/bridge/adapters/claude.adapter.d.ts.map +1 -0
- package/bridge/adapters/ext-apps.adapter.d.ts +143 -0
- package/bridge/adapters/ext-apps.adapter.d.ts.map +1 -0
- package/bridge/adapters/gemini.adapter.d.ts +64 -0
- package/bridge/adapters/gemini.adapter.d.ts.map +1 -0
- package/bridge/adapters/generic.adapter.d.ts +56 -0
- package/bridge/adapters/generic.adapter.d.ts.map +1 -0
- package/bridge/adapters/index.d.ts +26 -0
- package/bridge/adapters/index.d.ts.map +1 -0
- package/bridge/adapters/openai.adapter.d.ts +65 -0
- package/bridge/adapters/openai.adapter.d.ts.map +1 -0
- package/bridge/core/adapter-registry.d.ts +122 -0
- package/bridge/core/adapter-registry.d.ts.map +1 -0
- package/bridge/core/bridge-factory.d.ts +199 -0
- package/bridge/core/bridge-factory.d.ts.map +1 -0
- package/bridge/core/index.d.ts +10 -0
- package/bridge/core/index.d.ts.map +1 -0
- package/bridge/index.d.ts +62 -0
- package/bridge/index.d.ts.map +1 -0
- package/bridge/index.js +2540 -0
- package/bridge/runtime/iife-generator.d.ts +62 -0
- package/bridge/runtime/iife-generator.d.ts.map +1 -0
- package/bridge/runtime/index.d.ts +10 -0
- package/bridge/runtime/index.d.ts.map +1 -0
- package/bridge/types.d.ts +386 -0
- package/bridge/types.d.ts.map +1 -0
- package/bundler/bundler.d.ts +208 -0
- package/bundler/bundler.d.ts.map +1 -0
- package/bundler/cache.d.ts +173 -0
- package/bundler/cache.d.ts.map +1 -0
- package/bundler/file-cache/component-builder.d.ts +167 -0
- package/bundler/file-cache/component-builder.d.ts.map +1 -0
- package/bundler/file-cache/hash-calculator.d.ts +155 -0
- package/bundler/file-cache/hash-calculator.d.ts.map +1 -0
- package/bundler/file-cache/index.d.ts +12 -0
- package/bundler/file-cache/index.d.ts.map +1 -0
- package/bundler/file-cache/storage/filesystem.d.ts +149 -0
- package/bundler/file-cache/storage/filesystem.d.ts.map +1 -0
- package/bundler/file-cache/storage/index.d.ts +11 -0
- package/bundler/file-cache/storage/index.d.ts.map +1 -0
- package/bundler/file-cache/storage/interface.d.ts +152 -0
- package/bundler/file-cache/storage/interface.d.ts.map +1 -0
- package/bundler/file-cache/storage/redis.d.ts +139 -0
- package/bundler/file-cache/storage/redis.d.ts.map +1 -0
- package/bundler/index.d.ts +43 -0
- package/bundler/index.d.ts.map +1 -0
- package/bundler/index.js +3707 -0
- package/bundler/sandbox/enclave-adapter.d.ts +121 -0
- package/bundler/sandbox/enclave-adapter.d.ts.map +1 -0
- package/bundler/sandbox/executor.d.ts +14 -0
- package/bundler/sandbox/executor.d.ts.map +1 -0
- package/bundler/sandbox/policy.d.ts +62 -0
- package/bundler/sandbox/policy.d.ts.map +1 -0
- package/bundler/types.d.ts +702 -0
- package/bundler/types.d.ts.map +1 -0
- package/components/alert.d.ts +66 -0
- package/components/alert.d.ts.map +1 -0
- package/components/alert.schema.d.ts +98 -0
- package/components/alert.schema.d.ts.map +1 -0
- package/components/avatar.d.ts +77 -0
- package/components/avatar.d.ts.map +1 -0
- package/components/avatar.schema.d.ts +170 -0
- package/components/avatar.schema.d.ts.map +1 -0
- package/components/badge.d.ts +64 -0
- package/components/badge.d.ts.map +1 -0
- package/components/badge.schema.d.ts +91 -0
- package/components/badge.schema.d.ts.map +1 -0
- package/components/button.d.ts +100 -0
- package/components/button.d.ts.map +1 -0
- package/components/button.schema.d.ts +120 -0
- package/components/button.schema.d.ts.map +1 -0
- package/components/card.d.ts +53 -0
- package/components/card.d.ts.map +1 -0
- package/components/card.schema.d.ts +93 -0
- package/components/card.schema.d.ts.map +1 -0
- package/components/form.d.ts +212 -0
- package/components/form.d.ts.map +1 -0
- package/components/form.schema.d.ts +365 -0
- package/components/form.schema.d.ts.map +1 -0
- package/components/index.d.ts +29 -0
- package/components/index.d.ts.map +1 -0
- package/components/index.js +2525 -0
- package/components/list.d.ts +121 -0
- package/components/list.d.ts.map +1 -0
- package/components/list.schema.d.ts +129 -0
- package/components/list.schema.d.ts.map +1 -0
- package/components/modal.d.ts +100 -0
- package/components/modal.d.ts.map +1 -0
- package/components/modal.schema.d.ts +151 -0
- package/components/modal.schema.d.ts.map +1 -0
- package/components/table.d.ts +91 -0
- package/components/table.d.ts.map +1 -0
- package/components/table.schema.d.ts +123 -0
- package/components/table.schema.d.ts.map +1 -0
- package/esm/bridge/adapters/base-adapter.d.ts +104 -0
- package/esm/bridge/adapters/base-adapter.d.ts.map +1 -0
- package/esm/bridge/adapters/claude.adapter.d.ts +67 -0
- package/esm/bridge/adapters/claude.adapter.d.ts.map +1 -0
- package/esm/bridge/adapters/ext-apps.adapter.d.ts +143 -0
- package/esm/bridge/adapters/ext-apps.adapter.d.ts.map +1 -0
- package/esm/bridge/adapters/gemini.adapter.d.ts +64 -0
- package/esm/bridge/adapters/gemini.adapter.d.ts.map +1 -0
- package/esm/bridge/adapters/generic.adapter.d.ts +56 -0
- package/esm/bridge/adapters/generic.adapter.d.ts.map +1 -0
- package/esm/bridge/adapters/index.d.ts +26 -0
- package/esm/bridge/adapters/index.d.ts.map +1 -0
- package/esm/bridge/adapters/openai.adapter.d.ts +65 -0
- package/esm/bridge/adapters/openai.adapter.d.ts.map +1 -0
- package/esm/bridge/core/adapter-registry.d.ts +122 -0
- package/esm/bridge/core/adapter-registry.d.ts.map +1 -0
- package/esm/bridge/core/bridge-factory.d.ts +199 -0
- package/esm/bridge/core/bridge-factory.d.ts.map +1 -0
- package/esm/bridge/core/index.d.ts +10 -0
- package/esm/bridge/core/index.d.ts.map +1 -0
- package/esm/bridge/index.d.ts +62 -0
- package/esm/bridge/index.d.ts.map +1 -0
- package/esm/bridge/index.js +2487 -0
- package/esm/bridge/runtime/iife-generator.d.ts +62 -0
- package/esm/bridge/runtime/iife-generator.d.ts.map +1 -0
- package/esm/bridge/runtime/index.d.ts +10 -0
- package/esm/bridge/runtime/index.d.ts.map +1 -0
- package/esm/bridge/types.d.ts +386 -0
- package/esm/bridge/types.d.ts.map +1 -0
- package/esm/bundler/bundler.d.ts +208 -0
- package/esm/bundler/bundler.d.ts.map +1 -0
- package/esm/bundler/cache.d.ts +173 -0
- package/esm/bundler/cache.d.ts.map +1 -0
- package/esm/bundler/file-cache/component-builder.d.ts +167 -0
- package/esm/bundler/file-cache/component-builder.d.ts.map +1 -0
- package/esm/bundler/file-cache/hash-calculator.d.ts +155 -0
- package/esm/bundler/file-cache/hash-calculator.d.ts.map +1 -0
- package/esm/bundler/file-cache/index.d.ts +12 -0
- package/esm/bundler/file-cache/index.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/filesystem.d.ts +149 -0
- package/esm/bundler/file-cache/storage/filesystem.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/index.d.ts +11 -0
- package/esm/bundler/file-cache/storage/index.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/interface.d.ts +152 -0
- package/esm/bundler/file-cache/storage/interface.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/redis.d.ts +139 -0
- package/esm/bundler/file-cache/storage/redis.d.ts.map +1 -0
- package/esm/bundler/index.d.ts +43 -0
- package/esm/bundler/index.d.ts.map +1 -0
- package/esm/bundler/index.js +3640 -0
- package/esm/bundler/sandbox/enclave-adapter.d.ts +121 -0
- package/esm/bundler/sandbox/enclave-adapter.d.ts.map +1 -0
- package/esm/bundler/sandbox/executor.d.ts +14 -0
- package/esm/bundler/sandbox/executor.d.ts.map +1 -0
- package/esm/bundler/sandbox/policy.d.ts +62 -0
- package/esm/bundler/sandbox/policy.d.ts.map +1 -0
- package/esm/bundler/types.d.ts +702 -0
- package/esm/bundler/types.d.ts.map +1 -0
- package/esm/components/alert.d.ts +66 -0
- package/esm/components/alert.d.ts.map +1 -0
- package/esm/components/alert.schema.d.ts +98 -0
- package/esm/components/alert.schema.d.ts.map +1 -0
- package/esm/components/avatar.d.ts +77 -0
- package/esm/components/avatar.d.ts.map +1 -0
- package/esm/components/avatar.schema.d.ts +170 -0
- package/esm/components/avatar.schema.d.ts.map +1 -0
- package/esm/components/badge.d.ts +64 -0
- package/esm/components/badge.d.ts.map +1 -0
- package/esm/components/badge.schema.d.ts +91 -0
- package/esm/components/badge.schema.d.ts.map +1 -0
- package/esm/components/button.d.ts +100 -0
- package/esm/components/button.d.ts.map +1 -0
- package/esm/components/button.schema.d.ts +120 -0
- package/esm/components/button.schema.d.ts.map +1 -0
- package/esm/components/card.d.ts +53 -0
- package/esm/components/card.d.ts.map +1 -0
- package/esm/components/card.schema.d.ts +93 -0
- package/esm/components/card.schema.d.ts.map +1 -0
- package/esm/components/form.d.ts +212 -0
- package/esm/components/form.d.ts.map +1 -0
- package/esm/components/form.schema.d.ts +365 -0
- package/esm/components/form.schema.d.ts.map +1 -0
- package/esm/components/index.d.ts +29 -0
- package/esm/components/index.d.ts.map +1 -0
- package/esm/components/index.js +2396 -0
- package/esm/components/list.d.ts +121 -0
- package/esm/components/list.d.ts.map +1 -0
- package/esm/components/list.schema.d.ts +129 -0
- package/esm/components/list.schema.d.ts.map +1 -0
- package/esm/components/modal.d.ts +100 -0
- package/esm/components/modal.d.ts.map +1 -0
- package/esm/components/modal.schema.d.ts +151 -0
- package/esm/components/modal.schema.d.ts.map +1 -0
- package/esm/components/table.d.ts +91 -0
- package/esm/components/table.d.ts.map +1 -0
- package/esm/components/table.schema.d.ts +123 -0
- package/esm/components/table.schema.d.ts.map +1 -0
- package/esm/index.d.ts +40 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +8326 -0
- package/esm/layouts/base.d.ts +86 -0
- package/esm/layouts/base.d.ts.map +1 -0
- package/esm/layouts/index.d.ts +8 -0
- package/esm/layouts/index.d.ts.map +1 -0
- package/esm/layouts/index.js +409 -0
- package/esm/layouts/presets.d.ts +134 -0
- package/esm/layouts/presets.d.ts.map +1 -0
- package/esm/package.json +72 -0
- package/esm/pages/consent.d.ts +117 -0
- package/esm/pages/consent.d.ts.map +1 -0
- package/esm/pages/error.d.ts +101 -0
- package/esm/pages/error.d.ts.map +1 -0
- package/esm/pages/index.d.ts +9 -0
- package/esm/pages/index.d.ts.map +1 -0
- package/esm/pages/index.js +1036 -0
- package/esm/react/Alert.d.ts +101 -0
- package/esm/react/Alert.d.ts.map +1 -0
- package/esm/react/Badge.d.ts +100 -0
- package/esm/react/Badge.d.ts.map +1 -0
- package/esm/react/Button.d.ts +108 -0
- package/esm/react/Button.d.ts.map +1 -0
- package/esm/react/Card.d.ts +103 -0
- package/esm/react/Card.d.ts.map +1 -0
- package/esm/react/hooks/context.d.ts +179 -0
- package/esm/react/hooks/context.d.ts.map +1 -0
- package/esm/react/hooks/index.d.ts +42 -0
- package/esm/react/hooks/index.d.ts.map +1 -0
- package/esm/react/hooks/tools.d.ts +284 -0
- package/esm/react/hooks/tools.d.ts.map +1 -0
- package/esm/react/index.d.ts +80 -0
- package/esm/react/index.d.ts.map +1 -0
- package/esm/react/index.js +3124 -0
- package/esm/react/types.d.ts +105 -0
- package/esm/react/types.d.ts.map +1 -0
- package/esm/react/utils.d.ts +43 -0
- package/esm/react/utils.d.ts.map +1 -0
- package/esm/render/index.d.ts +8 -0
- package/esm/render/index.d.ts.map +1 -0
- package/esm/render/index.js +45 -0
- package/esm/render/prerender.d.ts +57 -0
- package/esm/render/prerender.d.ts.map +1 -0
- package/esm/renderers/index.d.ts +21 -0
- package/esm/renderers/index.d.ts.map +1 -0
- package/esm/renderers/index.js +381 -0
- package/esm/renderers/react.adapter.d.ts +70 -0
- package/esm/renderers/react.adapter.d.ts.map +1 -0
- package/esm/renderers/react.renderer.d.ts +96 -0
- package/esm/renderers/react.renderer.d.ts.map +1 -0
- package/esm/universal/UniversalApp.d.ts +108 -0
- package/esm/universal/UniversalApp.d.ts.map +1 -0
- package/esm/universal/cached-runtime.d.ts +115 -0
- package/esm/universal/cached-runtime.d.ts.map +1 -0
- package/esm/universal/context.d.ts +122 -0
- package/esm/universal/context.d.ts.map +1 -0
- package/esm/universal/index.d.ts +57 -0
- package/esm/universal/index.d.ts.map +1 -0
- package/esm/universal/index.js +1755 -0
- package/esm/universal/renderers/html.renderer.d.ts +37 -0
- package/esm/universal/renderers/html.renderer.d.ts.map +1 -0
- package/esm/universal/renderers/index.d.ts +112 -0
- package/esm/universal/renderers/index.d.ts.map +1 -0
- package/esm/universal/renderers/markdown.renderer.d.ts +33 -0
- package/esm/universal/renderers/markdown.renderer.d.ts.map +1 -0
- package/esm/universal/renderers/mdx.renderer.d.ts +38 -0
- package/esm/universal/renderers/mdx.renderer.d.ts.map +1 -0
- package/esm/universal/renderers/react.renderer.d.ts +46 -0
- package/esm/universal/renderers/react.renderer.d.ts.map +1 -0
- package/esm/universal/runtime-builder.d.ts +33 -0
- package/esm/universal/runtime-builder.d.ts.map +1 -0
- package/esm/universal/store.d.ts +135 -0
- package/esm/universal/store.d.ts.map +1 -0
- package/esm/universal/types.d.ts +199 -0
- package/esm/universal/types.d.ts.map +1 -0
- package/esm/web-components/core/attribute-parser.d.ts +82 -0
- package/esm/web-components/core/attribute-parser.d.ts.map +1 -0
- package/esm/web-components/core/base-element.d.ts +197 -0
- package/esm/web-components/core/base-element.d.ts.map +1 -0
- package/esm/web-components/core/index.d.ts +9 -0
- package/esm/web-components/core/index.d.ts.map +1 -0
- package/esm/web-components/elements/fmcp-alert.d.ts +46 -0
- package/esm/web-components/elements/fmcp-alert.d.ts.map +1 -0
- package/esm/web-components/elements/fmcp-badge.d.ts +47 -0
- package/esm/web-components/elements/fmcp-badge.d.ts.map +1 -0
- package/esm/web-components/elements/fmcp-button.d.ts +117 -0
- package/esm/web-components/elements/fmcp-button.d.ts.map +1 -0
- package/esm/web-components/elements/fmcp-card.d.ts +53 -0
- package/esm/web-components/elements/fmcp-card.d.ts.map +1 -0
- package/esm/web-components/elements/fmcp-input.d.ts +96 -0
- package/esm/web-components/elements/fmcp-input.d.ts.map +1 -0
- package/esm/web-components/elements/fmcp-select.d.ts +100 -0
- package/esm/web-components/elements/fmcp-select.d.ts.map +1 -0
- package/esm/web-components/elements/index.d.ts +13 -0
- package/esm/web-components/elements/index.d.ts.map +1 -0
- package/esm/web-components/index.d.ts +50 -0
- package/esm/web-components/index.d.ts.map +1 -0
- package/esm/web-components/index.js +1993 -0
- package/esm/web-components/register.d.ts +57 -0
- package/esm/web-components/register.d.ts.map +1 -0
- package/esm/web-components/types.d.ts +122 -0
- package/esm/web-components/types.d.ts.map +1 -0
- package/esm/widgets/index.d.ts +8 -0
- package/esm/widgets/index.d.ts.map +1 -0
- package/esm/widgets/index.js +883 -0
- package/esm/widgets/progress.d.ts +133 -0
- package/esm/widgets/progress.d.ts.map +1 -0
- package/esm/widgets/resource.d.ts +163 -0
- package/esm/widgets/resource.d.ts.map +1 -0
- package/index.d.ts +40 -0
- package/index.d.ts.map +1 -0
- package/index.js +8526 -0
- package/layouts/base.d.ts +86 -0
- package/layouts/base.d.ts.map +1 -0
- package/layouts/index.d.ts +8 -0
- package/layouts/index.d.ts.map +1 -0
- package/layouts/index.js +437 -0
- package/layouts/presets.d.ts +134 -0
- package/layouts/presets.d.ts.map +1 -0
- package/package.json +33 -110
- package/pages/consent.d.ts +117 -0
- package/pages/consent.d.ts.map +1 -0
- package/pages/error.d.ts +101 -0
- package/pages/error.d.ts.map +1 -0
- package/pages/index.d.ts +9 -0
- package/pages/index.d.ts.map +1 -0
- package/pages/index.js +1065 -0
- package/react/Alert.d.ts +101 -0
- package/react/Alert.d.ts.map +1 -0
- package/react/Badge.d.ts +100 -0
- package/react/Badge.d.ts.map +1 -0
- package/react/Button.d.ts +108 -0
- package/react/Button.d.ts.map +1 -0
- package/react/Card.d.ts +103 -0
- package/react/Card.d.ts.map +1 -0
- package/react/hooks/context.d.ts +179 -0
- package/react/hooks/context.d.ts.map +1 -0
- package/react/hooks/index.d.ts +42 -0
- package/react/hooks/index.d.ts.map +1 -0
- package/react/hooks/tools.d.ts +284 -0
- package/react/hooks/tools.d.ts.map +1 -0
- package/react/index.d.ts +80 -0
- package/react/index.d.ts.map +1 -0
- package/react/index.js +3160 -0
- package/react/types.d.ts +105 -0
- package/react/types.d.ts.map +1 -0
- package/react/utils.d.ts +43 -0
- package/react/utils.d.ts.map +1 -0
- package/render/index.d.ts +8 -0
- package/render/index.d.ts.map +1 -0
- package/render/index.js +77 -0
- package/render/prerender.d.ts +57 -0
- package/render/prerender.d.ts.map +1 -0
- package/renderers/index.d.ts +21 -0
- package/renderers/index.d.ts.map +1 -0
- package/renderers/index.js +416 -0
- package/renderers/react.adapter.d.ts +70 -0
- package/renderers/react.adapter.d.ts.map +1 -0
- package/renderers/react.renderer.d.ts +96 -0
- package/renderers/react.renderer.d.ts.map +1 -0
- package/universal/UniversalApp.d.ts +108 -0
- package/universal/UniversalApp.d.ts.map +1 -0
- package/universal/cached-runtime.d.ts +115 -0
- package/universal/cached-runtime.d.ts.map +1 -0
- package/universal/context.d.ts +122 -0
- package/universal/context.d.ts.map +1 -0
- package/universal/index.d.ts +57 -0
- package/universal/index.d.ts.map +1 -0
- package/universal/index.js +1841 -0
- package/universal/renderers/html.renderer.d.ts +37 -0
- package/universal/renderers/html.renderer.d.ts.map +1 -0
- package/universal/renderers/index.d.ts +112 -0
- package/universal/renderers/index.d.ts.map +1 -0
- package/universal/renderers/markdown.renderer.d.ts +33 -0
- package/universal/renderers/markdown.renderer.d.ts.map +1 -0
- package/universal/renderers/mdx.renderer.d.ts +38 -0
- package/universal/renderers/mdx.renderer.d.ts.map +1 -0
- package/universal/renderers/react.renderer.d.ts +46 -0
- package/universal/renderers/react.renderer.d.ts.map +1 -0
- package/universal/runtime-builder.d.ts +33 -0
- package/universal/runtime-builder.d.ts.map +1 -0
- package/universal/store.d.ts +135 -0
- package/universal/store.d.ts.map +1 -0
- package/universal/types.d.ts +199 -0
- package/universal/types.d.ts.map +1 -0
- package/web-components/core/attribute-parser.d.ts +82 -0
- package/web-components/core/attribute-parser.d.ts.map +1 -0
- package/web-components/core/base-element.d.ts +197 -0
- package/web-components/core/base-element.d.ts.map +1 -0
- package/web-components/core/index.d.ts +9 -0
- package/web-components/core/index.d.ts.map +1 -0
- package/web-components/elements/fmcp-alert.d.ts +46 -0
- package/web-components/elements/fmcp-alert.d.ts.map +1 -0
- package/web-components/elements/fmcp-badge.d.ts +47 -0
- package/web-components/elements/fmcp-badge.d.ts.map +1 -0
- package/web-components/elements/fmcp-button.d.ts +117 -0
- package/web-components/elements/fmcp-button.d.ts.map +1 -0
- package/web-components/elements/fmcp-card.d.ts +53 -0
- package/web-components/elements/fmcp-card.d.ts.map +1 -0
- package/web-components/elements/fmcp-input.d.ts +96 -0
- package/web-components/elements/fmcp-input.d.ts.map +1 -0
- package/web-components/elements/fmcp-select.d.ts +100 -0
- package/web-components/elements/fmcp-select.d.ts.map +1 -0
- package/web-components/elements/index.d.ts +13 -0
- package/web-components/elements/index.d.ts.map +1 -0
- package/web-components/index.d.ts +50 -0
- package/web-components/index.d.ts.map +1 -0
- package/web-components/index.js +2028 -0
- package/web-components/register.d.ts +57 -0
- package/web-components/register.d.ts.map +1 -0
- package/web-components/types.d.ts +122 -0
- package/web-components/types.d.ts.map +1 -0
- package/widgets/index.d.ts +8 -0
- package/widgets/index.d.ts.map +1 -0
- package/widgets/index.js +910 -0
- package/widgets/progress.d.ts +133 -0
- package/widgets/progress.d.ts.map +1 -0
- package/widgets/resource.d.ts +163 -0
- package/widgets/resource.d.ts.map +1 -0
- package/src/adapters/index.d.ts +0 -10
- package/src/adapters/index.js +0 -18
- package/src/adapters/index.js.map +0 -1
- package/src/adapters/platform-meta.d.ts +0 -165
- package/src/adapters/platform-meta.js +0 -310
- package/src/adapters/platform-meta.js.map +0 -1
- package/src/base-template/bridge.d.ts +0 -89
- package/src/base-template/bridge.js +0 -452
- package/src/base-template/bridge.js.map +0 -1
- package/src/base-template/default-base-template.d.ts +0 -91
- package/src/base-template/default-base-template.js +0 -435
- package/src/base-template/default-base-template.js.map +0 -1
- package/src/base-template/index.d.ts +0 -14
- package/src/base-template/index.js +0 -30
- package/src/base-template/index.js.map +0 -1
- package/src/base-template/polyfills.d.ts +0 -30
- package/src/base-template/polyfills.js +0 -190
- package/src/base-template/polyfills.js.map +0 -1
- package/src/base-template/theme-styles.d.ts +0 -73
- package/src/base-template/theme-styles.js +0 -95
- package/src/base-template/theme-styles.js.map +0 -1
- package/src/bridge/adapters/base-adapter.d.ts +0 -103
- package/src/bridge/adapters/base-adapter.js +0 -314
- package/src/bridge/adapters/base-adapter.js.map +0 -1
- package/src/bridge/adapters/claude.adapter.d.ts +0 -66
- package/src/bridge/adapters/claude.adapter.js +0 -145
- package/src/bridge/adapters/claude.adapter.js.map +0 -1
- package/src/bridge/adapters/ext-apps.adapter.d.ts +0 -142
- package/src/bridge/adapters/ext-apps.adapter.js +0 -416
- package/src/bridge/adapters/ext-apps.adapter.js.map +0 -1
- package/src/bridge/adapters/gemini.adapter.d.ts +0 -63
- package/src/bridge/adapters/gemini.adapter.js +0 -160
- package/src/bridge/adapters/gemini.adapter.js.map +0 -1
- package/src/bridge/adapters/generic.adapter.d.ts +0 -55
- package/src/bridge/adapters/generic.adapter.js +0 -108
- package/src/bridge/adapters/generic.adapter.js.map +0 -1
- package/src/bridge/adapters/index.d.ts +0 -25
- package/src/bridge/adapters/index.js +0 -65
- package/src/bridge/adapters/index.js.map +0 -1
- package/src/bridge/adapters/openai.adapter.d.ts +0 -64
- package/src/bridge/adapters/openai.adapter.js +0 -194
- package/src/bridge/adapters/openai.adapter.js.map +0 -1
- package/src/bridge/core/adapter-registry.d.ts +0 -121
- package/src/bridge/core/adapter-registry.js +0 -271
- package/src/bridge/core/adapter-registry.js.map +0 -1
- package/src/bridge/core/bridge-factory.d.ts +0 -198
- package/src/bridge/core/bridge-factory.js +0 -428
- package/src/bridge/core/bridge-factory.js.map +0 -1
- package/src/bridge/core/index.d.ts +0 -9
- package/src/bridge/core/index.js +0 -22
- package/src/bridge/core/index.js.map +0 -1
- package/src/bridge/index.d.ts +0 -61
- package/src/bridge/index.js +0 -94
- package/src/bridge/index.js.map +0 -1
- package/src/bridge/runtime/iife-generator.d.ts +0 -61
- package/src/bridge/runtime/iife-generator.js +0 -940
- package/src/bridge/runtime/iife-generator.js.map +0 -1
- package/src/bridge/runtime/index.d.ts +0 -8
- package/src/bridge/runtime/index.js +0 -16
- package/src/bridge/runtime/index.js.map +0 -1
- package/src/bridge/types.d.ts +0 -385
- package/src/bridge/types.js +0 -11
- package/src/bridge/types.js.map +0 -1
- package/src/build/cdn-resources.d.ts +0 -140
- package/src/build/cdn-resources.js +0 -314
- package/src/build/cdn-resources.js.map +0 -1
- package/src/build/index.d.ts +0 -294
- package/src/build/index.js +0 -325
- package/src/build/index.js.map +0 -1
- package/src/build/widget-manifest.d.ts +0 -212
- package/src/build/widget-manifest.js +0 -652
- package/src/build/widget-manifest.js.map +0 -1
- package/src/bundler/bundler.d.ts +0 -110
- package/src/bundler/bundler.js +0 -432
- package/src/bundler/bundler.js.map +0 -1
- package/src/bundler/cache.d.ts +0 -172
- package/src/bundler/cache.js +0 -250
- package/src/bundler/cache.js.map +0 -1
- package/src/bundler/index.d.ts +0 -41
- package/src/bundler/index.js +0 -73
- package/src/bundler/index.js.map +0 -1
- package/src/bundler/sandbox/enclave-adapter.d.ts +0 -120
- package/src/bundler/sandbox/enclave-adapter.js +0 -339
- package/src/bundler/sandbox/enclave-adapter.js.map +0 -1
- package/src/bundler/sandbox/executor.d.ts +0 -13
- package/src/bundler/sandbox/executor.js +0 -22
- package/src/bundler/sandbox/executor.js.map +0 -1
- package/src/bundler/sandbox/policy.d.ts +0 -61
- package/src/bundler/sandbox/policy.js +0 -238
- package/src/bundler/sandbox/policy.js.map +0 -1
- package/src/bundler/types.d.ts +0 -347
- package/src/bundler/types.js +0 -132
- package/src/bundler/types.js.map +0 -1
- package/src/components/alert.d.ts +0 -71
- package/src/components/alert.js +0 -189
- package/src/components/alert.js.map +0 -1
- package/src/components/alert.schema.d.ts +0 -114
- package/src/components/alert.schema.js +0 -105
- package/src/components/alert.schema.js.map +0 -1
- package/src/components/avatar.d.ts +0 -76
- package/src/components/avatar.js +0 -176
- package/src/components/avatar.js.map +0 -1
- package/src/components/avatar.schema.d.ts +0 -169
- package/src/components/avatar.schema.js +0 -103
- package/src/components/avatar.schema.js.map +0 -1
- package/src/components/badge.d.ts +0 -70
- package/src/components/badge.js +0 -149
- package/src/components/badge.js.map +0 -1
- package/src/components/badge.schema.d.ts +0 -109
- package/src/components/badge.schema.js +0 -96
- package/src/components/badge.schema.js.map +0 -1
- package/src/components/button.d.ts +0 -111
- package/src/components/button.js +0 -336
- package/src/components/button.js.map +0 -1
- package/src/components/button.schema.d.ts +0 -148
- package/src/components/button.schema.js +0 -121
- package/src/components/button.schema.js.map +0 -1
- package/src/components/card.d.ts +0 -60
- package/src/components/card.js +0 -117
- package/src/components/card.js.map +0 -1
- package/src/components/card.schema.d.ts +0 -113
- package/src/components/card.schema.js +0 -98
- package/src/components/card.schema.js.map +0 -1
- package/src/components/form.d.ts +0 -239
- package/src/components/form.js +0 -420
- package/src/components/form.js.map +0 -1
- package/src/components/form.schema.d.ts +0 -441
- package/src/components/form.schema.js +0 -406
- package/src/components/form.schema.js.map +0 -1
- package/src/components/index.d.ts +0 -29
- package/src/components/index.js +0 -98
- package/src/components/index.js.map +0 -1
- package/src/components/list.d.ts +0 -127
- package/src/components/list.js +0 -279
- package/src/components/list.js.map +0 -1
- package/src/components/list.schema.d.ts +0 -134
- package/src/components/list.schema.js +0 -168
- package/src/components/list.schema.js.map +0 -1
- package/src/components/modal.d.ts +0 -111
- package/src/components/modal.js +0 -260
- package/src/components/modal.js.map +0 -1
- package/src/components/modal.schema.d.ts +0 -186
- package/src/components/modal.schema.js +0 -167
- package/src/components/modal.schema.js.map +0 -1
- package/src/components/table.d.ts +0 -105
- package/src/components/table.js +0 -283
- package/src/components/table.js.map +0 -1
- package/src/components/table.schema.d.ts +0 -159
- package/src/components/table.schema.js +0 -173
- package/src/components/table.schema.js.map +0 -1
- package/src/handlebars/helpers.d.ts +0 -348
- package/src/handlebars/helpers.js +0 -605
- package/src/handlebars/helpers.js.map +0 -1
- package/src/handlebars/index.d.ts +0 -193
- package/src/handlebars/index.js +0 -350
- package/src/handlebars/index.js.map +0 -1
- package/src/index.d.ts +0 -50
- package/src/index.js +0 -192
- package/src/index.js.map +0 -1
- package/src/layouts/base.d.ts +0 -88
- package/src/layouts/base.js +0 -227
- package/src/layouts/base.js.map +0 -1
- package/src/layouts/index.d.ts +0 -7
- package/src/layouts/index.js +0 -25
- package/src/layouts/index.js.map +0 -1
- package/src/layouts/presets.d.ts +0 -133
- package/src/layouts/presets.js +0 -277
- package/src/layouts/presets.js.map +0 -1
- package/src/pages/consent.d.ts +0 -116
- package/src/pages/consent.js +0 -218
- package/src/pages/consent.js.map +0 -1
- package/src/pages/error.d.ts +0 -100
- package/src/pages/error.js +0 -263
- package/src/pages/error.js.map +0 -1
- package/src/pages/index.d.ts +0 -8
- package/src/pages/index.js +0 -27
- package/src/pages/index.js.map +0 -1
- package/src/react/Alert.d.ts +0 -101
- package/src/react/Alert.js +0 -51
- package/src/react/Alert.js.map +0 -1
- package/src/react/Badge.d.ts +0 -100
- package/src/react/Badge.js +0 -55
- package/src/react/Badge.js.map +0 -1
- package/src/react/Button.d.ts +0 -108
- package/src/react/Button.js +0 -52
- package/src/react/Button.js.map +0 -1
- package/src/react/Card.d.ts +0 -103
- package/src/react/Card.js +0 -55
- package/src/react/Card.js.map +0 -1
- package/src/react/hooks/context.d.ts +0 -178
- package/src/react/hooks/context.js +0 -287
- package/src/react/hooks/context.js.map +0 -1
- package/src/react/hooks/index.d.ts +0 -41
- package/src/react/hooks/index.js +0 -61
- package/src/react/hooks/index.js.map +0 -1
- package/src/react/hooks/tools.d.ts +0 -283
- package/src/react/hooks/tools.js +0 -465
- package/src/react/hooks/tools.js.map +0 -1
- package/src/react/index.d.ts +0 -80
- package/src/react/index.js +0 -113
- package/src/react/index.js.map +0 -1
- package/src/react/types.d.ts +0 -105
- package/src/react/types.js +0 -12
- package/src/react/types.js.map +0 -1
- package/src/react/utils.d.ts +0 -42
- package/src/react/utils.js +0 -99
- package/src/react/utils.js.map +0 -1
- package/src/registry/index.d.ts +0 -45
- package/src/registry/index.js +0 -67
- package/src/registry/index.js.map +0 -1
- package/src/registry/render-template.d.ts +0 -86
- package/src/registry/render-template.js +0 -239
- package/src/registry/render-template.js.map +0 -1
- package/src/registry/tool-ui.registry.d.ts +0 -260
- package/src/registry/tool-ui.registry.js +0 -438
- package/src/registry/tool-ui.registry.js.map +0 -1
- package/src/registry/uri-utils.d.ts +0 -55
- package/src/registry/uri-utils.js +0 -97
- package/src/registry/uri-utils.js.map +0 -1
- package/src/render/index.d.ts +0 -7
- package/src/render/index.js +0 -14
- package/src/render/index.js.map +0 -1
- package/src/render/prerender.d.ts +0 -56
- package/src/render/prerender.js +0 -98
- package/src/render/prerender.js.map +0 -1
- package/src/renderers/cache.d.ts +0 -144
- package/src/renderers/cache.js +0 -240
- package/src/renderers/cache.js.map +0 -1
- package/src/renderers/html.renderer.d.ts +0 -122
- package/src/renderers/html.renderer.js +0 -204
- package/src/renderers/html.renderer.js.map +0 -1
- package/src/renderers/index.d.ts +0 -35
- package/src/renderers/index.js +0 -70
- package/src/renderers/index.js.map +0 -1
- package/src/renderers/mdx.renderer.d.ts +0 -119
- package/src/renderers/mdx.renderer.js +0 -305
- package/src/renderers/mdx.renderer.js.map +0 -1
- package/src/renderers/react.renderer.d.ts +0 -95
- package/src/renderers/react.renderer.js +0 -260
- package/src/renderers/react.renderer.js.map +0 -1
- package/src/renderers/registry.d.ts +0 -133
- package/src/renderers/registry.js +0 -232
- package/src/renderers/registry.js.map +0 -1
- package/src/renderers/types.d.ts +0 -341
- package/src/renderers/types.js +0 -9
- package/src/renderers/types.js.map +0 -1
- package/src/renderers/utils/detect.d.ts +0 -106
- package/src/renderers/utils/detect.js +0 -267
- package/src/renderers/utils/detect.js.map +0 -1
- package/src/renderers/utils/hash.d.ts +0 -39
- package/src/renderers/utils/hash.js +0 -75
- package/src/renderers/utils/hash.js.map +0 -1
- package/src/renderers/utils/index.d.ts +0 -8
- package/src/renderers/utils/index.js +0 -28
- package/src/renderers/utils/index.js.map +0 -1
- package/src/renderers/utils/transpiler.d.ts +0 -88
- package/src/renderers/utils/transpiler.js +0 -215
- package/src/renderers/utils/transpiler.js.map +0 -1
- package/src/runtime/adapters/html.adapter.d.ts +0 -58
- package/src/runtime/adapters/html.adapter.js +0 -131
- package/src/runtime/adapters/html.adapter.js.map +0 -1
- package/src/runtime/adapters/index.d.ts +0 -25
- package/src/runtime/adapters/index.js +0 -54
- package/src/runtime/adapters/index.js.map +0 -1
- package/src/runtime/adapters/mdx.adapter.d.ts +0 -72
- package/src/runtime/adapters/mdx.adapter.js +0 -241
- package/src/runtime/adapters/mdx.adapter.js.map +0 -1
- package/src/runtime/adapters/react.adapter.d.ts +0 -69
- package/src/runtime/adapters/react.adapter.js +0 -245
- package/src/runtime/adapters/react.adapter.js.map +0 -1
- package/src/runtime/adapters/types.d.ts +0 -94
- package/src/runtime/adapters/types.js +0 -11
- package/src/runtime/adapters/types.js.map +0 -1
- package/src/runtime/csp.d.ts +0 -37
- package/src/runtime/csp.js +0 -140
- package/src/runtime/csp.js.map +0 -1
- package/src/runtime/index.d.ts +0 -16
- package/src/runtime/index.js +0 -72
- package/src/runtime/index.js.map +0 -1
- package/src/runtime/mcp-bridge.d.ts +0 -100
- package/src/runtime/mcp-bridge.js +0 -581
- package/src/runtime/mcp-bridge.js.map +0 -1
- package/src/runtime/renderer-runtime.d.ts +0 -132
- package/src/runtime/renderer-runtime.js +0 -389
- package/src/runtime/renderer-runtime.js.map +0 -1
- package/src/runtime/sanitizer.d.ts +0 -171
- package/src/runtime/sanitizer.js +0 -318
- package/src/runtime/sanitizer.js.map +0 -1
- package/src/runtime/types.d.ts +0 -414
- package/src/runtime/types.js +0 -12
- package/src/runtime/types.js.map +0 -1
- package/src/runtime/wrapper.d.ts +0 -375
- package/src/runtime/wrapper.js +0 -1793
- package/src/runtime/wrapper.js.map +0 -1
- package/src/styles/index.d.ts +0 -7
- package/src/styles/index.js +0 -11
- package/src/styles/index.js.map +0 -1
- package/src/styles/variants.d.ts +0 -50
- package/src/styles/variants.js +0 -175
- package/src/styles/variants.js.map +0 -1
- package/src/theme/cdn.d.ts +0 -194
- package/src/theme/cdn.js +0 -375
- package/src/theme/cdn.js.map +0 -1
- package/src/theme/index.d.ts +0 -17
- package/src/theme/index.js +0 -57
- package/src/theme/index.js.map +0 -1
- package/src/theme/platforms.d.ts +0 -106
- package/src/theme/platforms.js +0 -161
- package/src/theme/platforms.js.map +0 -1
- package/src/theme/presets/github-openai.d.ts +0 -49
- package/src/theme/presets/github-openai.js +0 -189
- package/src/theme/presets/github-openai.js.map +0 -1
- package/src/theme/presets/index.d.ts +0 -10
- package/src/theme/presets/index.js +0 -17
- package/src/theme/presets/index.js.map +0 -1
- package/src/theme/theme.d.ts +0 -395
- package/src/theme/theme.js +0 -332
- package/src/theme/theme.js.map +0 -1
- package/src/tool-template/builder.d.ts +0 -212
- package/src/tool-template/builder.js +0 -397
- package/src/tool-template/builder.js.map +0 -1
- package/src/tool-template/index.d.ts +0 -15
- package/src/tool-template/index.js +0 -38
- package/src/tool-template/index.js.map +0 -1
- package/src/types/index.d.ts +0 -13
- package/src/types/index.js +0 -26
- package/src/types/index.js.map +0 -1
- package/src/types/ui-config.d.ts +0 -357
- package/src/types/ui-config.js +0 -12
- package/src/types/ui-config.js.map +0 -1
- package/src/types/ui-runtime.d.ts +0 -965
- package/src/types/ui-runtime.js +0 -117
- package/src/types/ui-runtime.js.map +0 -1
- package/src/validation/error-box.d.ts +0 -55
- package/src/validation/error-box.js +0 -75
- package/src/validation/error-box.js.map +0 -1
- package/src/validation/index.d.ts +0 -12
- package/src/validation/index.js +0 -21
- package/src/validation/index.js.map +0 -1
- package/src/validation/wrapper.d.ts +0 -96
- package/src/validation/wrapper.js +0 -117
- package/src/validation/wrapper.js.map +0 -1
- package/src/web-components/core/attribute-parser.d.ts +0 -85
- package/src/web-components/core/attribute-parser.js +0 -189
- package/src/web-components/core/attribute-parser.js.map +0 -1
- package/src/web-components/core/base-element.d.ts +0 -197
- package/src/web-components/core/base-element.js +0 -289
- package/src/web-components/core/base-element.js.map +0 -1
- package/src/web-components/core/index.d.ts +0 -8
- package/src/web-components/core/index.js +0 -18
- package/src/web-components/core/index.js.map +0 -1
- package/src/web-components/elements/fmcp-alert.d.ts +0 -45
- package/src/web-components/elements/fmcp-alert.js +0 -93
- package/src/web-components/elements/fmcp-alert.js.map +0 -1
- package/src/web-components/elements/fmcp-badge.d.ts +0 -46
- package/src/web-components/elements/fmcp-badge.js +0 -99
- package/src/web-components/elements/fmcp-badge.js.map +0 -1
- package/src/web-components/elements/fmcp-button.d.ts +0 -124
- package/src/web-components/elements/fmcp-button.js +0 -233
- package/src/web-components/elements/fmcp-button.js.map +0 -1
- package/src/web-components/elements/fmcp-card.d.ts +0 -52
- package/src/web-components/elements/fmcp-card.js +0 -115
- package/src/web-components/elements/fmcp-card.js.map +0 -1
- package/src/web-components/elements/fmcp-input.d.ts +0 -95
- package/src/web-components/elements/fmcp-input.js +0 -248
- package/src/web-components/elements/fmcp-input.js.map +0 -1
- package/src/web-components/elements/fmcp-select.d.ts +0 -99
- package/src/web-components/elements/fmcp-select.js +0 -243
- package/src/web-components/elements/fmcp-select.js.map +0 -1
- package/src/web-components/elements/index.d.ts +0 -12
- package/src/web-components/elements/index.js +0 -34
- package/src/web-components/elements/index.js.map +0 -1
- package/src/web-components/index.d.ts +0 -49
- package/src/web-components/index.js +0 -75
- package/src/web-components/index.js.map +0 -1
- package/src/web-components/register.d.ts +0 -56
- package/src/web-components/register.js +0 -80
- package/src/web-components/register.js.map +0 -1
- package/src/web-components/types.d.ts +0 -121
- package/src/web-components/types.js +0 -25
- package/src/web-components/types.js.map +0 -1
- package/src/widgets/index.d.ts +0 -7
- package/src/widgets/index.js +0 -24
- package/src/widgets/index.js.map +0 -1
- package/src/widgets/progress.d.ts +0 -132
- package/src/widgets/progress.js +0 -303
- package/src/widgets/progress.js.map +0 -1
- package/src/widgets/resource.d.ts +0 -162
- package/src/widgets/resource.js +0 -340
- package/src/widgets/resource.js.map +0 -1
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Template Type Detection Utilities
|
|
4
|
-
*
|
|
5
|
-
* Provides functions to detect whether a template is:
|
|
6
|
-
* - A React component (imported or inline)
|
|
7
|
-
* - A JSX string (needs runtime transpilation)
|
|
8
|
-
* - MDX content
|
|
9
|
-
* - Plain HTML
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.isReactComponent = isReactComponent;
|
|
13
|
-
exports.isTemplateBuilderFunction = isTemplateBuilderFunction;
|
|
14
|
-
exports.containsJsx = containsJsx;
|
|
15
|
-
exports.containsMdxSyntax = containsMdxSyntax;
|
|
16
|
-
exports.isPlainHtml = isPlainHtml;
|
|
17
|
-
exports.detectTemplateType = detectTemplateType;
|
|
18
|
-
/**
|
|
19
|
-
* Check if a value is a React component (FC or class).
|
|
20
|
-
*
|
|
21
|
-
* Detection heuristics:
|
|
22
|
-
* 1. Has $$typeof symbol (React.memo, React.forwardRef, etc.)
|
|
23
|
-
* 2. Has prototype.isReactComponent (class components)
|
|
24
|
-
* 3. Is a function with 0-1 parameters (function components)
|
|
25
|
-
*
|
|
26
|
-
* @param value - Value to check
|
|
27
|
-
* @returns True if it's a React component
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* const MyComponent = ({ output }) => <div>{output.name}</div>;
|
|
32
|
-
* isReactComponent(MyComponent); // true
|
|
33
|
-
*
|
|
34
|
-
* const htmlFn = (ctx) => `<div>${ctx.output.name}</div>`;
|
|
35
|
-
* isReactComponent(htmlFn); // false (returns string)
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
function isReactComponent(value) {
|
|
39
|
-
if (typeof value !== 'function') {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
const fn = value;
|
|
43
|
-
// Check for React's internal type symbols (memo, forwardRef, lazy)
|
|
44
|
-
const typeofSymbol = fn.$$typeof;
|
|
45
|
-
if (typeofSymbol) {
|
|
46
|
-
const symbolString = typeofSymbol.toString();
|
|
47
|
-
return (symbolString.includes('react.memo') ||
|
|
48
|
-
symbolString.includes('react.forward_ref') ||
|
|
49
|
-
symbolString.includes('react.lazy'));
|
|
50
|
-
}
|
|
51
|
-
// Check for class components
|
|
52
|
-
if (fn.prototype?.isReactComponent) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
// For function components, we can't reliably detect without execution.
|
|
56
|
-
// Heuristic: functions with 0-1 parameters that aren't template builders
|
|
57
|
-
// Template builders receive a context object and return a string.
|
|
58
|
-
// React components receive props and return JSX.Element.
|
|
59
|
-
// Check if function name suggests a component (PascalCase)
|
|
60
|
-
if (fn.name && /^[A-Z]/.test(fn.name)) {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
// Function with specific parameter count
|
|
64
|
-
// React FC: (props) => JSX or () => JSX
|
|
65
|
-
// Template: (ctx) => string
|
|
66
|
-
// We can't distinguish these without execution or source analysis
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Check if a function is likely a template builder (returns string).
|
|
71
|
-
*
|
|
72
|
-
* This is a heuristic based on function characteristics.
|
|
73
|
-
*
|
|
74
|
-
* @param fn - Function to check
|
|
75
|
-
* @returns True if likely a template builder function
|
|
76
|
-
*/
|
|
77
|
-
function isTemplateBuilderFunction(fn) {
|
|
78
|
-
// If it's a React component, it's not a template builder
|
|
79
|
-
if (isReactComponent(fn)) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
// Template builders typically have lowercase names or no name
|
|
83
|
-
if (fn.name && /^[A-Z]/.test(fn.name)) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
// At this point, assume it's a template builder
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Check if a string contains JSX syntax.
|
|
91
|
-
*
|
|
92
|
-
* Looks for patterns like:
|
|
93
|
-
* - `<Component` - JSX component tags
|
|
94
|
-
* - `</Component>` - JSX closing tags
|
|
95
|
-
* - `<div className=` - JSX attributes
|
|
96
|
-
* - `return (` followed by JSX
|
|
97
|
-
*
|
|
98
|
-
* @param source - String to check
|
|
99
|
-
* @returns True if string contains JSX
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* containsJsx('<div>Hello</div>'); // false (just HTML)
|
|
104
|
-
* containsJsx('<MyComponent />'); // true (JSX component)
|
|
105
|
-
* containsJsx('function() { return <div /> }'); // true
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
function containsJsx(source) {
|
|
109
|
-
// JSX component tag (PascalCase)
|
|
110
|
-
if (/<[A-Z][a-zA-Z0-9]*(\s|>|\/)/.test(source)) {
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
// Self-closing JSX with component
|
|
114
|
-
if (/<[A-Z][a-zA-Z0-9]*[^>]*\/>/.test(source)) {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
// JSX with curly braces (expressions)
|
|
118
|
-
if (/<[a-z]+[^>]*\{[^}]+\}/.test(source)) {
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
// React-specific attributes (className, onClick, etc.)
|
|
122
|
-
if (/\s(className|onClick|onChange|onSubmit|htmlFor)=/.test(source)) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
// JSX fragments
|
|
126
|
-
if (/<>|<\/>|<React\.Fragment>/.test(source)) {
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
// Arrow function returning JSX
|
|
130
|
-
if (/=>\s*\(?\s*</.test(source)) {
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
// Function returning JSX
|
|
134
|
-
if (/return\s*\(?\s*</.test(source)) {
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Check if a string contains MDX syntax.
|
|
141
|
-
*
|
|
142
|
-
* MDX is Markdown with JSX components. Patterns:
|
|
143
|
-
* - Frontmatter: `---\ntitle: ...\n---`
|
|
144
|
-
* - JSX components: `<Component />`
|
|
145
|
-
* - JSX attributes: `className`, `onClick`, `htmlFor`
|
|
146
|
-
* - JS expressions: `{variable}` or `{items.map(...)}`
|
|
147
|
-
* - Import/export statements
|
|
148
|
-
*
|
|
149
|
-
* @param source - String to check
|
|
150
|
-
* @returns True if string contains MDX syntax
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```typescript
|
|
154
|
-
* containsMdxSyntax('# Title\n<Card />'); // true
|
|
155
|
-
* containsMdxSyntax('# Title\n{data.name}'); // true
|
|
156
|
-
* containsMdxSyntax('<div className="test">...'); // true (JSX attribute)
|
|
157
|
-
* containsMdxSyntax('# Title\nSome text'); // false (just Markdown)
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
function containsMdxSyntax(source) {
|
|
161
|
-
// Has JSX component tags (PascalCase)
|
|
162
|
-
if (/<[A-Z][a-zA-Z0-9]*/.test(source)) {
|
|
163
|
-
return true;
|
|
164
|
-
}
|
|
165
|
-
// Has import/export statements (ESM)
|
|
166
|
-
if (/^(import|export)\s/m.test(source)) {
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
// Has JSX-specific attributes (className, onClick, etc.)
|
|
170
|
-
// These are only valid in JSX, not in regular HTML
|
|
171
|
-
if (/\s(className|onClick|onChange|onSubmit|htmlFor|dangerouslySetInnerHTML)=/.test(source)) {
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
// Has JS expressions in curly braces (not just HTML attributes)
|
|
175
|
-
// Look for expressions outside of quotes
|
|
176
|
-
if (/\{[^}"'\n]*\}/.test(source) && !/=\s*["'][^"']*\{/.test(source)) {
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
// Has frontmatter
|
|
180
|
-
if (/^---[\s\S]*?---/m.test(source)) {
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
// Has JSX fragments
|
|
184
|
-
if (/<>|<\/>/.test(source)) {
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Check if a string is plain HTML (no JSX or MDX).
|
|
191
|
-
*
|
|
192
|
-
* @param source - String to check
|
|
193
|
-
* @returns True if string is plain HTML
|
|
194
|
-
*/
|
|
195
|
-
function isPlainHtml(source) {
|
|
196
|
-
return !containsJsx(source) && !containsMdxSyntax(source);
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Detect the type of a template.
|
|
200
|
-
*
|
|
201
|
-
* Priority order:
|
|
202
|
-
* 1. React component (imported, already transpiled)
|
|
203
|
-
* 2. MDX string
|
|
204
|
-
* 3. JSX string (needs transpilation)
|
|
205
|
-
* 4. HTML template function
|
|
206
|
-
* 5. Static HTML string
|
|
207
|
-
*
|
|
208
|
-
* @param template - Template to analyze
|
|
209
|
-
* @returns Detected type and confidence
|
|
210
|
-
*/
|
|
211
|
-
function detectTemplateType(template) {
|
|
212
|
-
// Function templates
|
|
213
|
-
if (typeof template === 'function') {
|
|
214
|
-
if (isReactComponent(template)) {
|
|
215
|
-
return {
|
|
216
|
-
type: 'react',
|
|
217
|
-
confidence: 0.9,
|
|
218
|
-
reason: 'Function detected as React component (PascalCase name or React symbols)',
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
return {
|
|
222
|
-
type: 'html-function',
|
|
223
|
-
confidence: 0.8,
|
|
224
|
-
reason: 'Function assumed to be HTML template builder',
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
// String templates
|
|
228
|
-
if (typeof template === 'string') {
|
|
229
|
-
// Check for MDX first (Markdown + JSX)
|
|
230
|
-
if (containsMdxSyntax(template)) {
|
|
231
|
-
// Could be MDX or just JSX string
|
|
232
|
-
// MDX typically has markdown features (headers, lists, etc.)
|
|
233
|
-
const hasMarkdown = /^#{1,6}\s|^\*\s|^\d+\.\s|^-\s/m.test(template);
|
|
234
|
-
if (hasMarkdown) {
|
|
235
|
-
return {
|
|
236
|
-
type: 'mdx',
|
|
237
|
-
confidence: 0.9,
|
|
238
|
-
reason: 'String contains Markdown with JSX components',
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
return {
|
|
242
|
-
type: 'jsx-string',
|
|
243
|
-
confidence: 0.8,
|
|
244
|
-
reason: 'String contains JSX syntax',
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
if (containsJsx(template)) {
|
|
248
|
-
return {
|
|
249
|
-
type: 'jsx-string',
|
|
250
|
-
confidence: 0.85,
|
|
251
|
-
reason: 'String contains JSX component tags or expressions',
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
return {
|
|
255
|
-
type: 'html-string',
|
|
256
|
-
confidence: 1.0,
|
|
257
|
-
reason: 'Plain HTML string',
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
// Default fallback
|
|
261
|
-
return {
|
|
262
|
-
type: 'html-string',
|
|
263
|
-
confidence: 0.5,
|
|
264
|
-
reason: 'Unknown template type, defaulting to HTML',
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
//# sourceMappingURL=detect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../../../src/renderers/utils/detect.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Template Type Detection Utilities\n *\n * Provides functions to detect whether a template is:\n * - A React component (imported or inline)\n * - A JSX string (needs runtime transpilation)\n * - MDX content\n * - Plain HTML\n */\n\n/**\n * Check if a value is a React component (FC or class).\n *\n * Detection heuristics:\n * 1. Has $$typeof symbol (React.memo, React.forwardRef, etc.)\n * 2. Has prototype.isReactComponent (class components)\n * 3. Is a function with 0-1 parameters (function components)\n *\n * @param value - Value to check\n * @returns True if it's a React component\n *\n * @example\n * ```typescript\n * const MyComponent = ({ output }) => <div>{output.name}</div>;\n * isReactComponent(MyComponent); // true\n *\n * const htmlFn = (ctx) => `<div>${ctx.output.name}</div>`;\n * isReactComponent(htmlFn); // false (returns string)\n * ```\n */\nexport function isReactComponent(value: unknown): boolean {\n if (typeof value !== 'function') {\n return false;\n }\n\n const fn = value as Function;\n\n // Check for React's internal type symbols (memo, forwardRef, lazy)\n const typeofSymbol = (fn as { $$typeof?: symbol }).$$typeof;\n if (typeofSymbol) {\n const symbolString = typeofSymbol.toString();\n return (\n symbolString.includes('react.memo') ||\n symbolString.includes('react.forward_ref') ||\n symbolString.includes('react.lazy')\n );\n }\n\n // Check for class components\n if (fn.prototype?.isReactComponent) {\n return true;\n }\n\n // For function components, we can't reliably detect without execution.\n // Heuristic: functions with 0-1 parameters that aren't template builders\n // Template builders receive a context object and return a string.\n // React components receive props and return JSX.Element.\n\n // Check if function name suggests a component (PascalCase)\n if (fn.name && /^[A-Z]/.test(fn.name)) {\n return true;\n }\n\n // Function with specific parameter count\n // React FC: (props) => JSX or () => JSX\n // Template: (ctx) => string\n // We can't distinguish these without execution or source analysis\n\n return false;\n}\n\n/**\n * Check if a function is likely a template builder (returns string).\n *\n * This is a heuristic based on function characteristics.\n *\n * @param fn - Function to check\n * @returns True if likely a template builder function\n */\nexport function isTemplateBuilderFunction(fn: Function): boolean {\n // If it's a React component, it's not a template builder\n if (isReactComponent(fn)) {\n return false;\n }\n\n // Template builders typically have lowercase names or no name\n if (fn.name && /^[A-Z]/.test(fn.name)) {\n return false;\n }\n\n // At this point, assume it's a template builder\n return true;\n}\n\n/**\n * Check if a string contains JSX syntax.\n *\n * Looks for patterns like:\n * - `<Component` - JSX component tags\n * - `</Component>` - JSX closing tags\n * - `<div className=` - JSX attributes\n * - `return (` followed by JSX\n *\n * @param source - String to check\n * @returns True if string contains JSX\n *\n * @example\n * ```typescript\n * containsJsx('<div>Hello</div>'); // false (just HTML)\n * containsJsx('<MyComponent />'); // true (JSX component)\n * containsJsx('function() { return <div /> }'); // true\n * ```\n */\nexport function containsJsx(source: string): boolean {\n // JSX component tag (PascalCase)\n if (/<[A-Z][a-zA-Z0-9]*(\\s|>|\\/)/.test(source)) {\n return true;\n }\n\n // Self-closing JSX with component\n if (/<[A-Z][a-zA-Z0-9]*[^>]*\\/>/.test(source)) {\n return true;\n }\n\n // JSX with curly braces (expressions)\n if (/<[a-z]+[^>]*\\{[^}]+\\}/.test(source)) {\n return true;\n }\n\n // React-specific attributes (className, onClick, etc.)\n if (/\\s(className|onClick|onChange|onSubmit|htmlFor)=/.test(source)) {\n return true;\n }\n\n // JSX fragments\n if (/<>|<\\/>|<React\\.Fragment>/.test(source)) {\n return true;\n }\n\n // Arrow function returning JSX\n if (/=>\\s*\\(?\\s*</.test(source)) {\n return true;\n }\n\n // Function returning JSX\n if (/return\\s*\\(?\\s*</.test(source)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Check if a string contains MDX syntax.\n *\n * MDX is Markdown with JSX components. Patterns:\n * - Frontmatter: `---\\ntitle: ...\\n---`\n * - JSX components: `<Component />`\n * - JSX attributes: `className`, `onClick`, `htmlFor`\n * - JS expressions: `{variable}` or `{items.map(...)}`\n * - Import/export statements\n *\n * @param source - String to check\n * @returns True if string contains MDX syntax\n *\n * @example\n * ```typescript\n * containsMdxSyntax('# Title\\n<Card />'); // true\n * containsMdxSyntax('# Title\\n{data.name}'); // true\n * containsMdxSyntax('<div className=\"test\">...'); // true (JSX attribute)\n * containsMdxSyntax('# Title\\nSome text'); // false (just Markdown)\n * ```\n */\nexport function containsMdxSyntax(source: string): boolean {\n // Has JSX component tags (PascalCase)\n if (/<[A-Z][a-zA-Z0-9]*/.test(source)) {\n return true;\n }\n\n // Has import/export statements (ESM)\n if (/^(import|export)\\s/m.test(source)) {\n return true;\n }\n\n // Has JSX-specific attributes (className, onClick, etc.)\n // These are only valid in JSX, not in regular HTML\n if (/\\s(className|onClick|onChange|onSubmit|htmlFor|dangerouslySetInnerHTML)=/.test(source)) {\n return true;\n }\n\n // Has JS expressions in curly braces (not just HTML attributes)\n // Look for expressions outside of quotes\n if (/\\{[^}\"'\\n]*\\}/.test(source) && !/=\\s*[\"'][^\"']*\\{/.test(source)) {\n return true;\n }\n\n // Has frontmatter\n if (/^---[\\s\\S]*?---/m.test(source)) {\n return true;\n }\n\n // Has JSX fragments\n if (/<>|<\\/>/.test(source)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Check if a string is plain HTML (no JSX or MDX).\n *\n * @param source - String to check\n * @returns True if string is plain HTML\n */\nexport function isPlainHtml(source: string): boolean {\n return !containsJsx(source) && !containsMdxSyntax(source);\n}\n\n/**\n * Detect the type of a template.\n *\n * Priority order:\n * 1. React component (imported, already transpiled)\n * 2. MDX string\n * 3. JSX string (needs transpilation)\n * 4. HTML template function\n * 5. Static HTML string\n *\n * @param template - Template to analyze\n * @returns Detected type and confidence\n */\nexport function detectTemplateType(template: unknown): {\n type: 'react' | 'mdx' | 'jsx-string' | 'html-function' | 'html-string';\n confidence: number;\n reason: string;\n} {\n // Function templates\n if (typeof template === 'function') {\n if (isReactComponent(template)) {\n return {\n type: 'react',\n confidence: 0.9,\n reason: 'Function detected as React component (PascalCase name or React symbols)',\n };\n }\n\n return {\n type: 'html-function',\n confidence: 0.8,\n reason: 'Function assumed to be HTML template builder',\n };\n }\n\n // String templates\n if (typeof template === 'string') {\n // Check for MDX first (Markdown + JSX)\n if (containsMdxSyntax(template)) {\n // Could be MDX or just JSX string\n // MDX typically has markdown features (headers, lists, etc.)\n const hasMarkdown = /^#{1,6}\\s|^\\*\\s|^\\d+\\.\\s|^-\\s/m.test(template);\n\n if (hasMarkdown) {\n return {\n type: 'mdx',\n confidence: 0.9,\n reason: 'String contains Markdown with JSX components',\n };\n }\n\n return {\n type: 'jsx-string',\n confidence: 0.8,\n reason: 'String contains JSX syntax',\n };\n }\n\n if (containsJsx(template)) {\n return {\n type: 'jsx-string',\n confidence: 0.85,\n reason: 'String contains JSX component tags or expressions',\n };\n }\n\n return {\n type: 'html-string',\n confidence: 1.0,\n reason: 'Plain HTML string',\n };\n }\n\n // Default fallback\n return {\n type: 'html-string',\n confidence: 0.5,\n reason: 'Unknown template type, defaulting to HTML',\n };\n}\n"]}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hash Utilities for Renderer Caching
|
|
3
|
-
*
|
|
4
|
-
* Fast, non-cryptographic hashing for content-addressable cache keys.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Generate a fast hash string from source content.
|
|
8
|
-
* Uses FNV-1a algorithm for good distribution and speed.
|
|
9
|
-
*
|
|
10
|
-
* @param source - String to hash
|
|
11
|
-
* @returns Base36 encoded hash string
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const hash = hashString('function Component() { return <div>Hello</div> }');
|
|
16
|
-
* // Returns something like "1a2b3c4d"
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function hashString(source: string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Generate a hash combining multiple values.
|
|
22
|
-
* Useful for creating cache keys from multiple inputs.
|
|
23
|
-
*
|
|
24
|
-
* @param values - Values to combine into a hash
|
|
25
|
-
* @returns Combined hash string
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* const key = hashCombined('template-source', { location: 'NYC' }, { temp: 72 });
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function hashCombined(...values: unknown[]): string;
|
|
33
|
-
/**
|
|
34
|
-
* Check if a string likely represents a hash (short alphanumeric).
|
|
35
|
-
*
|
|
36
|
-
* @param value - Value to check
|
|
37
|
-
* @returns True if it looks like a hash
|
|
38
|
-
*/
|
|
39
|
-
export declare function isHash(value: string): boolean;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Hash Utilities for Renderer Caching
|
|
4
|
-
*
|
|
5
|
-
* Fast, non-cryptographic hashing for content-addressable cache keys.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.hashString = hashString;
|
|
9
|
-
exports.hashCombined = hashCombined;
|
|
10
|
-
exports.isHash = isHash;
|
|
11
|
-
/**
|
|
12
|
-
* Generate a fast hash string from source content.
|
|
13
|
-
* Uses FNV-1a algorithm for good distribution and speed.
|
|
14
|
-
*
|
|
15
|
-
* @param source - String to hash
|
|
16
|
-
* @returns Base36 encoded hash string
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const hash = hashString('function Component() { return <div>Hello</div> }');
|
|
21
|
-
* // Returns something like "1a2b3c4d"
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
function hashString(source) {
|
|
25
|
-
// FNV-1a hash algorithm - fast and well-distributed
|
|
26
|
-
let hash = 2166136261; // FNV offset basis
|
|
27
|
-
for (let i = 0; i < source.length; i++) {
|
|
28
|
-
hash ^= source.charCodeAt(i);
|
|
29
|
-
// FNV prime for 32-bit: 16777619
|
|
30
|
-
hash = (hash * 16777619) >>> 0; // Keep as unsigned 32-bit
|
|
31
|
-
}
|
|
32
|
-
return hash.toString(36);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Generate a hash combining multiple values.
|
|
36
|
-
* Useful for creating cache keys from multiple inputs.
|
|
37
|
-
*
|
|
38
|
-
* @param values - Values to combine into a hash
|
|
39
|
-
* @returns Combined hash string
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* const key = hashCombined('template-source', { location: 'NYC' }, { temp: 72 });
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
function hashCombined(...values) {
|
|
47
|
-
const combined = values
|
|
48
|
-
.map((v) => {
|
|
49
|
-
if (typeof v === 'string')
|
|
50
|
-
return v;
|
|
51
|
-
if (v === null)
|
|
52
|
-
return 'null';
|
|
53
|
-
if (v === undefined)
|
|
54
|
-
return 'undefined';
|
|
55
|
-
try {
|
|
56
|
-
return JSON.stringify(v);
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
return String(v);
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
.join('|');
|
|
63
|
-
return hashString(combined);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Check if a string likely represents a hash (short alphanumeric).
|
|
67
|
-
*
|
|
68
|
-
* @param value - Value to check
|
|
69
|
-
* @returns True if it looks like a hash
|
|
70
|
-
*/
|
|
71
|
-
function isHash(value) {
|
|
72
|
-
// Hash strings from hashString() are typically 6-8 characters of base36
|
|
73
|
-
return /^[0-9a-z]{5,10}$/i.test(value);
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=hash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../../src/renderers/utils/hash.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAeH,gCAWC;AAcD,oCAeC;AAQD,wBAGC;AAhED;;;;;;;;;;;;GAYG;AACH,SAAgB,UAAU,CAAC,MAAc;IACvC,oDAAoD;IACpD,IAAI,IAAI,GAAG,UAAU,CAAC,CAAC,mBAAmB;IAE1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,iCAAiC;QACjC,IAAI,GAAG,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B;IAC5D,CAAC;IAED,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,YAAY,CAAC,GAAG,MAAiB;IAC/C,MAAM,QAAQ,GAAG,MAAM;SACpB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC;QAC9B,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,WAAW,CAAC;QACxC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,MAAM,CAAC,KAAa;IAClC,wEAAwE;IACxE,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC","sourcesContent":["/**\n * Hash Utilities for Renderer Caching\n *\n * Fast, non-cryptographic hashing for content-addressable cache keys.\n */\n\n/**\n * Generate a fast hash string from source content.\n * Uses FNV-1a algorithm for good distribution and speed.\n *\n * @param source - String to hash\n * @returns Base36 encoded hash string\n *\n * @example\n * ```typescript\n * const hash = hashString('function Component() { return <div>Hello</div> }');\n * // Returns something like \"1a2b3c4d\"\n * ```\n */\nexport function hashString(source: string): string {\n // FNV-1a hash algorithm - fast and well-distributed\n let hash = 2166136261; // FNV offset basis\n\n for (let i = 0; i < source.length; i++) {\n hash ^= source.charCodeAt(i);\n // FNV prime for 32-bit: 16777619\n hash = (hash * 16777619) >>> 0; // Keep as unsigned 32-bit\n }\n\n return hash.toString(36);\n}\n\n/**\n * Generate a hash combining multiple values.\n * Useful for creating cache keys from multiple inputs.\n *\n * @param values - Values to combine into a hash\n * @returns Combined hash string\n *\n * @example\n * ```typescript\n * const key = hashCombined('template-source', { location: 'NYC' }, { temp: 72 });\n * ```\n */\nexport function hashCombined(...values: unknown[]): string {\n const combined = values\n .map((v) => {\n if (typeof v === 'string') return v;\n if (v === null) return 'null';\n if (v === undefined) return 'undefined';\n try {\n return JSON.stringify(v);\n } catch {\n return String(v);\n }\n })\n .join('|');\n\n return hashString(combined);\n}\n\n/**\n * Check if a string likely represents a hash (short alphanumeric).\n *\n * @param value - Value to check\n * @returns True if it looks like a hash\n */\nexport function isHash(value: string): boolean {\n // Hash strings from hashString() are typically 6-8 characters of base36\n return /^[0-9a-z]{5,10}$/i.test(value);\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Renderer Utilities
|
|
3
|
-
*
|
|
4
|
-
* Utility functions for template detection, hashing, and transpilation.
|
|
5
|
-
*/
|
|
6
|
-
export { isReactComponent, isTemplateBuilderFunction, containsJsx, containsMdxSyntax, isPlainHtml, detectTemplateType, } from './detect';
|
|
7
|
-
export { hashString, hashCombined, isHash } from './hash';
|
|
8
|
-
export { transpileJsx, isSwcAvailable, executeTranspiledCode, transpileAndExecute } from './transpiler';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Renderer Utilities
|
|
4
|
-
*
|
|
5
|
-
* Utility functions for template detection, hashing, and transpilation.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.transpileAndExecute = exports.executeTranspiledCode = exports.isSwcAvailable = exports.transpileJsx = exports.isHash = exports.hashCombined = exports.hashString = exports.detectTemplateType = exports.isPlainHtml = exports.containsMdxSyntax = exports.containsJsx = exports.isTemplateBuilderFunction = exports.isReactComponent = void 0;
|
|
9
|
-
// Detection utilities
|
|
10
|
-
var detect_1 = require("./detect");
|
|
11
|
-
Object.defineProperty(exports, "isReactComponent", { enumerable: true, get: function () { return detect_1.isReactComponent; } });
|
|
12
|
-
Object.defineProperty(exports, "isTemplateBuilderFunction", { enumerable: true, get: function () { return detect_1.isTemplateBuilderFunction; } });
|
|
13
|
-
Object.defineProperty(exports, "containsJsx", { enumerable: true, get: function () { return detect_1.containsJsx; } });
|
|
14
|
-
Object.defineProperty(exports, "containsMdxSyntax", { enumerable: true, get: function () { return detect_1.containsMdxSyntax; } });
|
|
15
|
-
Object.defineProperty(exports, "isPlainHtml", { enumerable: true, get: function () { return detect_1.isPlainHtml; } });
|
|
16
|
-
Object.defineProperty(exports, "detectTemplateType", { enumerable: true, get: function () { return detect_1.detectTemplateType; } });
|
|
17
|
-
// Hash utilities
|
|
18
|
-
var hash_1 = require("./hash");
|
|
19
|
-
Object.defineProperty(exports, "hashString", { enumerable: true, get: function () { return hash_1.hashString; } });
|
|
20
|
-
Object.defineProperty(exports, "hashCombined", { enumerable: true, get: function () { return hash_1.hashCombined; } });
|
|
21
|
-
Object.defineProperty(exports, "isHash", { enumerable: true, get: function () { return hash_1.isHash; } });
|
|
22
|
-
// Transpilation utilities
|
|
23
|
-
var transpiler_1 = require("./transpiler");
|
|
24
|
-
Object.defineProperty(exports, "transpileJsx", { enumerable: true, get: function () { return transpiler_1.transpileJsx; } });
|
|
25
|
-
Object.defineProperty(exports, "isSwcAvailable", { enumerable: true, get: function () { return transpiler_1.isSwcAvailable; } });
|
|
26
|
-
Object.defineProperty(exports, "executeTranspiledCode", { enumerable: true, get: function () { return transpiler_1.executeTranspiledCode; } });
|
|
27
|
-
Object.defineProperty(exports, "transpileAndExecute", { enumerable: true, get: function () { return transpiler_1.transpileAndExecute; } });
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/renderers/utils/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,sBAAsB;AACtB,mCAOkB;AANhB,0GAAA,gBAAgB,OAAA;AAChB,mHAAA,yBAAyB,OAAA;AACzB,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AACjB,qGAAA,WAAW,OAAA;AACX,4GAAA,kBAAkB,OAAA;AAGpB,iBAAiB;AACjB,+BAA0D;AAAjD,kGAAA,UAAU,OAAA;AAAE,oGAAA,YAAY,OAAA;AAAE,8FAAA,MAAM,OAAA;AAEzC,0BAA0B;AAC1B,2CAAwG;AAA/F,0GAAA,YAAY,OAAA;AAAE,4GAAA,cAAc,OAAA;AAAE,mHAAA,qBAAqB,OAAA;AAAE,iHAAA,mBAAmB,OAAA","sourcesContent":["/**\n * Renderer Utilities\n *\n * Utility functions for template detection, hashing, and transpilation.\n */\n\n// Detection utilities\nexport {\n isReactComponent,\n isTemplateBuilderFunction,\n containsJsx,\n containsMdxSyntax,\n isPlainHtml,\n detectTemplateType,\n} from './detect';\n\n// Hash utilities\nexport { hashString, hashCombined, isHash } from './hash';\n\n// Transpilation utilities\nexport { transpileJsx, isSwcAvailable, executeTranspiledCode, transpileAndExecute } from './transpiler';\n"]}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime JSX/TSX Transpiler
|
|
3
|
-
*
|
|
4
|
-
* Uses SWC to transpile JSX/TSX strings to executable JavaScript at runtime.
|
|
5
|
-
* This enables dynamic React templates without requiring a build step.
|
|
6
|
-
*/
|
|
7
|
-
import type { TranspileResult } from '../types';
|
|
8
|
-
/**
|
|
9
|
-
* SWC transformation options for JSX.
|
|
10
|
-
*/
|
|
11
|
-
interface SwcTransformOptions {
|
|
12
|
-
/** Enable TypeScript syntax */
|
|
13
|
-
typescript?: boolean;
|
|
14
|
-
/** Enable JSX syntax */
|
|
15
|
-
jsx?: boolean;
|
|
16
|
-
/** JSX runtime mode ('automatic' for React 17+, 'classic' for older) */
|
|
17
|
-
jsxRuntime?: 'automatic' | 'classic';
|
|
18
|
-
/** Enable development mode (better error messages) */
|
|
19
|
-
development?: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Transpile a JSX/TSX string to executable JavaScript.
|
|
23
|
-
*
|
|
24
|
-
* Uses SWC with React 17+ automatic JSX runtime.
|
|
25
|
-
* Results are cached by content hash.
|
|
26
|
-
*
|
|
27
|
-
* @param source - JSX/TSX source code string
|
|
28
|
-
* @param options - Transpilation options
|
|
29
|
-
* @returns Transpiled result with code and caching metadata
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* const source = `
|
|
34
|
-
* function Widget({ output }) {
|
|
35
|
-
* return <div>{output.name}</div>;
|
|
36
|
-
* }
|
|
37
|
-
* `;
|
|
38
|
-
*
|
|
39
|
-
* const result = await transpileJsx(source);
|
|
40
|
-
* console.log(result.code); // JavaScript code
|
|
41
|
-
* console.log(result.cached); // Whether from cache
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export declare function transpileJsx(source: string, options?: SwcTransformOptions): Promise<TranspileResult>;
|
|
45
|
-
/**
|
|
46
|
-
* Check if SWC is available for runtime transpilation.
|
|
47
|
-
*
|
|
48
|
-
* @returns Promise resolving to true if SWC is available
|
|
49
|
-
*/
|
|
50
|
-
export declare function isSwcAvailable(): Promise<boolean>;
|
|
51
|
-
/**
|
|
52
|
-
* Execute transpiled JavaScript code and extract the component.
|
|
53
|
-
*
|
|
54
|
-
* Creates a sandboxed environment with React available,
|
|
55
|
-
* executes the code, and returns the exported component.
|
|
56
|
-
*
|
|
57
|
-
* @param code - Transpiled JavaScript code
|
|
58
|
-
* @param context - Additional context to inject
|
|
59
|
-
* @returns The exported component or default export
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* const code = `
|
|
64
|
-
* "use strict";
|
|
65
|
-
* Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
-
* const jsx_runtime = require("react/jsx-runtime");
|
|
67
|
-
* function Widget(props) {
|
|
68
|
-
* return jsx_runtime.jsx("div", { children: props.output.name });
|
|
69
|
-
* }
|
|
70
|
-
* exports.default = Widget;
|
|
71
|
-
* `;
|
|
72
|
-
*
|
|
73
|
-
* const Component = await executeTranspiledCode(code);
|
|
74
|
-
* // Component is now a usable React component function
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
export declare function executeTranspiledCode(code: string, context?: Record<string, any>): Promise<any>;
|
|
78
|
-
/**
|
|
79
|
-
* Transpile and execute a JSX string, returning the component.
|
|
80
|
-
*
|
|
81
|
-
* Convenience function that combines transpileJsx and executeTranspiledCode.
|
|
82
|
-
*
|
|
83
|
-
* @param source - JSX/TSX source code
|
|
84
|
-
* @param context - Additional context for execution
|
|
85
|
-
* @returns The component function
|
|
86
|
-
*/
|
|
87
|
-
export declare function transpileAndExecute(source: string, context?: Record<string, any>): Promise<any>;
|
|
88
|
-
export {};
|