@frontmcp/uipack 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/CLAUDE.md +246 -0
- package/LICENSE +201 -0
- package/README.md +150 -0
- package/adapters/index.d.ts +13 -0
- package/adapters/index.d.ts.map +1 -0
- package/adapters/index.js +462 -0
- package/adapters/platform-meta.d.ts +166 -0
- package/adapters/platform-meta.d.ts.map +1 -0
- package/adapters/response-builder.d.ts +108 -0
- package/adapters/response-builder.d.ts.map +1 -0
- package/adapters/serving-mode.d.ts +107 -0
- package/adapters/serving-mode.d.ts.map +1 -0
- package/base-template/bridge.d.ts +90 -0
- package/base-template/bridge.d.ts.map +1 -0
- package/base-template/default-base-template.d.ts +92 -0
- package/base-template/default-base-template.d.ts.map +1 -0
- package/base-template/index.d.ts +15 -0
- package/base-template/index.d.ts.map +1 -0
- package/base-template/index.js +1398 -0
- package/base-template/polyfills.d.ts +31 -0
- package/base-template/polyfills.d.ts.map +1 -0
- package/base-template/theme-styles.d.ts +74 -0
- package/base-template/theme-styles.d.ts.map +1 -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-runtime/index.js +883 -0
- package/build/cdn-resources.d.ts +243 -0
- package/build/cdn-resources.d.ts.map +1 -0
- package/build/index.d.ts +295 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +6861 -0
- package/build/widget-manifest.d.ts +362 -0
- package/build/widget-manifest.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 +35 -0
- package/bundler/index.d.ts.map +1 -0
- package/bundler/index.js +2947 -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/dependency/cdn-registry.d.ts +98 -0
- package/dependency/cdn-registry.d.ts.map +1 -0
- package/dependency/import-map.d.ts +186 -0
- package/dependency/import-map.d.ts.map +1 -0
- package/dependency/import-parser.d.ts +82 -0
- package/dependency/import-parser.d.ts.map +1 -0
- package/dependency/index.d.ts +17 -0
- package/dependency/index.d.ts.map +1 -0
- package/dependency/index.js +3215 -0
- package/dependency/resolver.d.ts +164 -0
- package/dependency/resolver.d.ts.map +1 -0
- package/dependency/schemas.d.ts +486 -0
- package/dependency/schemas.d.ts.map +1 -0
- package/dependency/template-loader.d.ts +204 -0
- package/dependency/template-loader.d.ts.map +1 -0
- package/dependency/template-processor.d.ts +118 -0
- package/dependency/template-processor.d.ts.map +1 -0
- package/dependency/types.d.ts +739 -0
- package/dependency/types.d.ts.map +1 -0
- package/esm/adapters/index.d.ts +13 -0
- package/esm/adapters/index.d.ts.map +1 -0
- package/esm/adapters/index.js +427 -0
- package/esm/adapters/platform-meta.d.ts +166 -0
- package/esm/adapters/platform-meta.d.ts.map +1 -0
- package/esm/adapters/response-builder.d.ts +108 -0
- package/esm/adapters/response-builder.d.ts.map +1 -0
- package/esm/adapters/serving-mode.d.ts +107 -0
- package/esm/adapters/serving-mode.d.ts.map +1 -0
- package/esm/base-template/bridge.d.ts +90 -0
- package/esm/base-template/bridge.d.ts.map +1 -0
- package/esm/base-template/default-base-template.d.ts +92 -0
- package/esm/base-template/default-base-template.d.ts.map +1 -0
- package/esm/base-template/index.d.ts +15 -0
- package/esm/base-template/index.d.ts.map +1 -0
- package/esm/base-template/index.js +1364 -0
- package/esm/base-template/polyfills.d.ts +31 -0
- package/esm/base-template/polyfills.d.ts.map +1 -0
- package/esm/base-template/theme-styles.d.ts +74 -0
- package/esm/base-template/theme-styles.d.ts.map +1 -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-runtime/index.js +853 -0
- package/esm/build/cdn-resources.d.ts +243 -0
- package/esm/build/cdn-resources.d.ts.map +1 -0
- package/esm/build/index.d.ts +295 -0
- package/esm/build/index.d.ts.map +1 -0
- package/esm/build/index.js +6786 -0
- package/esm/build/widget-manifest.d.ts +362 -0
- package/esm/build/widget-manifest.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 +35 -0
- package/esm/bundler/index.d.ts.map +1 -0
- package/esm/bundler/index.js +2882 -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/dependency/cdn-registry.d.ts +98 -0
- package/esm/dependency/cdn-registry.d.ts.map +1 -0
- package/esm/dependency/import-map.d.ts +186 -0
- package/esm/dependency/import-map.d.ts.map +1 -0
- package/esm/dependency/import-parser.d.ts +82 -0
- package/esm/dependency/import-parser.d.ts.map +1 -0
- package/esm/dependency/index.d.ts +17 -0
- package/esm/dependency/index.d.ts.map +1 -0
- package/esm/dependency/index.js +3096 -0
- package/esm/dependency/resolver.d.ts +164 -0
- package/esm/dependency/resolver.d.ts.map +1 -0
- package/esm/dependency/schemas.d.ts +486 -0
- package/esm/dependency/schemas.d.ts.map +1 -0
- package/esm/dependency/template-loader.d.ts +204 -0
- package/esm/dependency/template-loader.d.ts.map +1 -0
- package/esm/dependency/template-processor.d.ts +118 -0
- package/esm/dependency/template-processor.d.ts.map +1 -0
- package/esm/dependency/types.d.ts +739 -0
- package/esm/dependency/types.d.ts.map +1 -0
- package/esm/handlebars/expression-extractor.d.ts +147 -0
- package/esm/handlebars/expression-extractor.d.ts.map +1 -0
- package/esm/handlebars/helpers.d.ts +339 -0
- package/esm/handlebars/helpers.d.ts.map +1 -0
- package/esm/handlebars/index.d.ts +195 -0
- package/esm/handlebars/index.d.ts.map +1 -0
- package/esm/handlebars/index.js +587 -0
- package/esm/index.d.ts +50 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +12434 -0
- package/esm/package.json +68 -0
- package/esm/registry/index.d.ts +46 -0
- package/esm/registry/index.d.ts.map +1 -0
- package/esm/registry/index.js +6237 -0
- package/esm/registry/render-template.d.ts +91 -0
- package/esm/registry/render-template.d.ts.map +1 -0
- package/esm/registry/tool-ui.registry.d.ts +294 -0
- package/esm/registry/tool-ui.registry.d.ts.map +1 -0
- package/esm/registry/uri-utils.d.ts +56 -0
- package/esm/registry/uri-utils.d.ts.map +1 -0
- package/esm/renderers/cache.d.ts +145 -0
- package/esm/renderers/cache.d.ts.map +1 -0
- package/esm/renderers/html.renderer.d.ts +123 -0
- package/esm/renderers/html.renderer.d.ts.map +1 -0
- package/esm/renderers/index.d.ts +36 -0
- package/esm/renderers/index.d.ts.map +1 -0
- package/esm/renderers/index.js +1654 -0
- package/esm/renderers/mdx.renderer.d.ts +120 -0
- package/esm/renderers/mdx.renderer.d.ts.map +1 -0
- package/esm/renderers/registry.d.ts +133 -0
- package/esm/renderers/registry.d.ts.map +1 -0
- package/esm/renderers/types.d.ts +342 -0
- package/esm/renderers/types.d.ts.map +1 -0
- package/esm/renderers/utils/detect.d.ts +107 -0
- package/esm/renderers/utils/detect.d.ts.map +1 -0
- package/esm/renderers/utils/hash.d.ts +40 -0
- package/esm/renderers/utils/hash.d.ts.map +1 -0
- package/esm/renderers/utils/index.d.ts +9 -0
- package/esm/renderers/utils/index.d.ts.map +1 -0
- package/esm/renderers/utils/transpiler.d.ts +89 -0
- package/esm/renderers/utils/transpiler.d.ts.map +1 -0
- package/esm/runtime/adapters/html.adapter.d.ts +59 -0
- package/esm/runtime/adapters/html.adapter.d.ts.map +1 -0
- package/esm/runtime/adapters/index.d.ts +26 -0
- package/esm/runtime/adapters/index.d.ts.map +1 -0
- package/esm/runtime/adapters/mdx.adapter.d.ts +73 -0
- package/esm/runtime/adapters/mdx.adapter.d.ts.map +1 -0
- package/esm/runtime/adapters/types.d.ts +95 -0
- package/esm/runtime/adapters/types.d.ts.map +1 -0
- package/esm/runtime/csp.d.ts +48 -0
- package/esm/runtime/csp.d.ts.map +1 -0
- package/esm/runtime/index.d.ts +17 -0
- package/esm/runtime/index.d.ts.map +1 -0
- package/esm/runtime/index.js +4976 -0
- package/esm/runtime/mcp-bridge.d.ts +101 -0
- package/esm/runtime/mcp-bridge.d.ts.map +1 -0
- package/esm/runtime/renderer-runtime.d.ts +133 -0
- package/esm/runtime/renderer-runtime.d.ts.map +1 -0
- package/esm/runtime/sanitizer.d.ts +172 -0
- package/esm/runtime/sanitizer.d.ts.map +1 -0
- package/esm/runtime/types.d.ts +415 -0
- package/esm/runtime/types.d.ts.map +1 -0
- package/esm/runtime/wrapper.d.ts +421 -0
- package/esm/runtime/wrapper.d.ts.map +1 -0
- package/esm/styles/index.d.ts +8 -0
- package/esm/styles/index.d.ts.map +1 -0
- package/esm/styles/index.js +171 -0
- package/esm/styles/variants.d.ts +51 -0
- package/esm/styles/variants.d.ts.map +1 -0
- package/esm/theme/cdn.d.ts +195 -0
- package/esm/theme/cdn.d.ts.map +1 -0
- package/esm/theme/index.d.ts +18 -0
- package/esm/theme/index.d.ts.map +1 -0
- package/esm/theme/index.js +700 -0
- package/esm/theme/platforms.d.ts +107 -0
- package/esm/theme/platforms.d.ts.map +1 -0
- package/esm/theme/presets/github-openai.d.ts +50 -0
- package/esm/theme/presets/github-openai.d.ts.map +1 -0
- package/esm/theme/presets/index.d.ts +11 -0
- package/esm/theme/presets/index.d.ts.map +1 -0
- package/esm/theme/theme.d.ts +396 -0
- package/esm/theme/theme.d.ts.map +1 -0
- package/esm/tool-template/builder.d.ts +213 -0
- package/esm/tool-template/builder.d.ts.map +1 -0
- package/esm/tool-template/index.d.ts +16 -0
- package/esm/tool-template/index.d.ts.map +1 -0
- package/esm/tool-template/index.js +3518 -0
- package/esm/types/index.d.ts +14 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/index.js +75 -0
- package/esm/types/ui-config.d.ts +641 -0
- package/esm/types/ui-config.d.ts.map +1 -0
- package/esm/types/ui-runtime.d.ts +1008 -0
- package/esm/types/ui-runtime.d.ts.map +1 -0
- package/esm/typings/cache/cache-adapter.d.ts +125 -0
- package/esm/typings/cache/cache-adapter.d.ts.map +1 -0
- package/esm/typings/cache/index.d.ts +10 -0
- package/esm/typings/cache/index.d.ts.map +1 -0
- package/esm/typings/cache/memory-cache.d.ts +92 -0
- package/esm/typings/cache/memory-cache.d.ts.map +1 -0
- package/esm/typings/dts-parser.d.ts +90 -0
- package/esm/typings/dts-parser.d.ts.map +1 -0
- package/esm/typings/index.d.ts +48 -0
- package/esm/typings/index.d.ts.map +1 -0
- package/esm/typings/index.js +812 -0
- package/esm/typings/schemas.d.ts +232 -0
- package/esm/typings/schemas.d.ts.map +1 -0
- package/esm/typings/type-fetcher.d.ts +89 -0
- package/esm/typings/type-fetcher.d.ts.map +1 -0
- package/esm/typings/types.d.ts +320 -0
- package/esm/typings/types.d.ts.map +1 -0
- package/esm/utils/escape-html.d.ts +58 -0
- package/esm/utils/escape-html.d.ts.map +1 -0
- package/esm/utils/index.d.ts +10 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +40 -0
- package/esm/utils/safe-stringify.d.ts +30 -0
- package/esm/utils/safe-stringify.d.ts.map +1 -0
- package/esm/validation/error-box.d.ts +56 -0
- package/esm/validation/error-box.d.ts.map +1 -0
- package/esm/validation/index.d.ts +13 -0
- package/esm/validation/index.d.ts.map +1 -0
- package/esm/validation/index.js +542 -0
- package/esm/validation/schema-paths.d.ts +118 -0
- package/esm/validation/schema-paths.d.ts.map +1 -0
- package/esm/validation/template-validator.d.ts +143 -0
- package/esm/validation/template-validator.d.ts.map +1 -0
- package/esm/validation/wrapper.d.ts +97 -0
- package/esm/validation/wrapper.d.ts.map +1 -0
- package/handlebars/expression-extractor.d.ts +147 -0
- package/handlebars/expression-extractor.d.ts.map +1 -0
- package/handlebars/helpers.d.ts +339 -0
- package/handlebars/helpers.d.ts.map +1 -0
- package/handlebars/index.d.ts +195 -0
- package/handlebars/index.d.ts.map +1 -0
- package/handlebars/index.js +666 -0
- package/index.d.ts +50 -0
- package/index.d.ts.map +1 -0
- package/index.js +12683 -0
- package/package.json +66 -0
- package/registry/index.d.ts +46 -0
- package/registry/index.d.ts.map +1 -0
- package/registry/index.js +6280 -0
- package/registry/render-template.d.ts +91 -0
- package/registry/render-template.d.ts.map +1 -0
- package/registry/tool-ui.registry.d.ts +294 -0
- package/registry/tool-ui.registry.d.ts.map +1 -0
- package/registry/uri-utils.d.ts +56 -0
- package/registry/uri-utils.d.ts.map +1 -0
- package/renderers/cache.d.ts +145 -0
- package/renderers/cache.d.ts.map +1 -0
- package/renderers/html.renderer.d.ts +123 -0
- package/renderers/html.renderer.d.ts.map +1 -0
- package/renderers/index.d.ts +36 -0
- package/renderers/index.d.ts.map +1 -0
- package/renderers/index.js +1706 -0
- package/renderers/mdx.renderer.d.ts +120 -0
- package/renderers/mdx.renderer.d.ts.map +1 -0
- package/renderers/registry.d.ts +133 -0
- package/renderers/registry.d.ts.map +1 -0
- package/renderers/types.d.ts +342 -0
- package/renderers/types.d.ts.map +1 -0
- package/renderers/utils/detect.d.ts +107 -0
- package/renderers/utils/detect.d.ts.map +1 -0
- package/renderers/utils/hash.d.ts +40 -0
- package/renderers/utils/hash.d.ts.map +1 -0
- package/renderers/utils/index.d.ts +9 -0
- package/renderers/utils/index.d.ts.map +1 -0
- package/renderers/utils/transpiler.d.ts +89 -0
- package/renderers/utils/transpiler.d.ts.map +1 -0
- package/runtime/adapters/html.adapter.d.ts +59 -0
- package/runtime/adapters/html.adapter.d.ts.map +1 -0
- package/runtime/adapters/index.d.ts +26 -0
- package/runtime/adapters/index.d.ts.map +1 -0
- package/runtime/adapters/mdx.adapter.d.ts +73 -0
- package/runtime/adapters/mdx.adapter.d.ts.map +1 -0
- package/runtime/adapters/types.d.ts +95 -0
- package/runtime/adapters/types.d.ts.map +1 -0
- package/runtime/csp.d.ts +48 -0
- package/runtime/csp.d.ts.map +1 -0
- package/runtime/index.d.ts +17 -0
- package/runtime/index.d.ts.map +1 -0
- package/runtime/index.js +5052 -0
- package/runtime/mcp-bridge.d.ts +101 -0
- package/runtime/mcp-bridge.d.ts.map +1 -0
- package/runtime/renderer-runtime.d.ts +133 -0
- package/runtime/renderer-runtime.d.ts.map +1 -0
- package/runtime/sanitizer.d.ts +172 -0
- package/runtime/sanitizer.d.ts.map +1 -0
- package/runtime/types.d.ts +415 -0
- package/runtime/types.d.ts.map +1 -0
- package/runtime/wrapper.d.ts +421 -0
- package/runtime/wrapper.d.ts.map +1 -0
- package/styles/index.d.ts +8 -0
- package/styles/index.d.ts.map +1 -0
- package/styles/index.js +222 -0
- package/styles/variants.d.ts +51 -0
- package/styles/variants.d.ts.map +1 -0
- package/theme/cdn.d.ts +195 -0
- package/theme/cdn.d.ts.map +1 -0
- package/theme/index.d.ts +18 -0
- package/theme/index.d.ts.map +1 -0
- package/theme/index.js +757 -0
- package/theme/platforms.d.ts +107 -0
- package/theme/platforms.d.ts.map +1 -0
- package/theme/presets/github-openai.d.ts +50 -0
- package/theme/presets/github-openai.d.ts.map +1 -0
- package/theme/presets/index.d.ts +11 -0
- package/theme/presets/index.d.ts.map +1 -0
- package/theme/theme.d.ts +396 -0
- package/theme/theme.d.ts.map +1 -0
- package/tool-template/builder.d.ts +213 -0
- package/tool-template/builder.d.ts.map +1 -0
- package/tool-template/index.d.ts +16 -0
- package/tool-template/index.d.ts.map +1 -0
- package/tool-template/index.js +3562 -0
- package/types/index.d.ts +14 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +108 -0
- package/types/ui-config.d.ts +641 -0
- package/types/ui-config.d.ts.map +1 -0
- package/types/ui-runtime.d.ts +1008 -0
- package/types/ui-runtime.d.ts.map +1 -0
- package/typings/cache/cache-adapter.d.ts +125 -0
- package/typings/cache/cache-adapter.d.ts.map +1 -0
- package/typings/cache/index.d.ts +10 -0
- package/typings/cache/index.d.ts.map +1 -0
- package/typings/cache/memory-cache.d.ts +92 -0
- package/typings/cache/memory-cache.d.ts.map +1 -0
- package/typings/dts-parser.d.ts +90 -0
- package/typings/dts-parser.d.ts.map +1 -0
- package/typings/index.d.ts +48 -0
- package/typings/index.d.ts.map +1 -0
- package/typings/index.js +868 -0
- package/typings/schemas.d.ts +232 -0
- package/typings/schemas.d.ts.map +1 -0
- package/typings/type-fetcher.d.ts +89 -0
- package/typings/type-fetcher.d.ts.map +1 -0
- package/typings/types.d.ts +320 -0
- package/typings/types.d.ts.map +1 -0
- package/utils/escape-html.d.ts +58 -0
- package/utils/escape-html.d.ts.map +1 -0
- package/utils/index.d.ts +10 -0
- package/utils/index.d.ts.map +1 -0
- package/utils/index.js +70 -0
- package/utils/safe-stringify.d.ts +30 -0
- package/utils/safe-stringify.d.ts.map +1 -0
- package/validation/error-box.d.ts +56 -0
- package/validation/error-box.d.ts.map +1 -0
- package/validation/index.d.ts +13 -0
- package/validation/index.d.ts.map +1 -0
- package/validation/index.js +583 -0
- package/validation/schema-paths.d.ts +118 -0
- package/validation/schema-paths.d.ts.map +1 -0
- package/validation/template-validator.d.ts +143 -0
- package/validation/template-validator.d.ts.map +1 -0
- package/validation/wrapper.d.ts +97 -0
- package/validation/wrapper.d.ts.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/handlebars/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAuBhE;;GAEG;AACH,wBAAsB,qB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function escapeHtml(str) {
|
|
3
|
+
if (str === null || str === void 0) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
const s = String(str);
|
|
7
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// libs/uipack/src/handlebars/helpers.ts
|
|
11
|
+
function formatDate(date, format) {
|
|
12
|
+
if (date === null || date === void 0) {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
let dateObj;
|
|
16
|
+
if (date instanceof Date) {
|
|
17
|
+
dateObj = date;
|
|
18
|
+
} else if (typeof date === "string" || typeof date === "number") {
|
|
19
|
+
dateObj = new Date(date);
|
|
20
|
+
} else {
|
|
21
|
+
return String(date);
|
|
22
|
+
}
|
|
23
|
+
if (isNaN(dateObj.getTime())) {
|
|
24
|
+
return String(date);
|
|
25
|
+
}
|
|
26
|
+
const options = {};
|
|
27
|
+
switch (format) {
|
|
28
|
+
case "short":
|
|
29
|
+
options.dateStyle = "short";
|
|
30
|
+
break;
|
|
31
|
+
case "medium":
|
|
32
|
+
options.dateStyle = "medium";
|
|
33
|
+
break;
|
|
34
|
+
case "long":
|
|
35
|
+
options.dateStyle = "long";
|
|
36
|
+
break;
|
|
37
|
+
case "full":
|
|
38
|
+
options.dateStyle = "full";
|
|
39
|
+
break;
|
|
40
|
+
case "time":
|
|
41
|
+
options.timeStyle = "short";
|
|
42
|
+
break;
|
|
43
|
+
case "datetime":
|
|
44
|
+
options.dateStyle = "medium";
|
|
45
|
+
options.timeStyle = "short";
|
|
46
|
+
break;
|
|
47
|
+
case "iso":
|
|
48
|
+
return dateObj.toISOString();
|
|
49
|
+
case "relative":
|
|
50
|
+
return formatRelativeDate(dateObj);
|
|
51
|
+
default:
|
|
52
|
+
options.dateStyle = "medium";
|
|
53
|
+
}
|
|
54
|
+
return new Intl.DateTimeFormat("en-US", options).format(dateObj);
|
|
55
|
+
}
|
|
56
|
+
function formatRelativeDate(date) {
|
|
57
|
+
const now = /* @__PURE__ */ new Date();
|
|
58
|
+
const diffMs = now.getTime() - date.getTime();
|
|
59
|
+
const diffSecs = Math.floor(diffMs / 1e3);
|
|
60
|
+
const diffMins = Math.floor(diffSecs / 60);
|
|
61
|
+
const diffHours = Math.floor(diffMins / 60);
|
|
62
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
63
|
+
if (diffSecs < 60) {
|
|
64
|
+
return "just now";
|
|
65
|
+
} else if (diffMins < 60) {
|
|
66
|
+
return `${diffMins} minute${diffMins === 1 ? "" : "s"} ago`;
|
|
67
|
+
} else if (diffHours < 24) {
|
|
68
|
+
return `${diffHours} hour${diffHours === 1 ? "" : "s"} ago`;
|
|
69
|
+
} else if (diffDays < 7) {
|
|
70
|
+
return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
|
|
71
|
+
} else {
|
|
72
|
+
return formatDate(date, "medium");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function formatCurrency(amount, currency) {
|
|
76
|
+
if (amount === null || amount === void 0) {
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
const num = typeof amount === "number" ? amount : parseFloat(String(amount));
|
|
80
|
+
if (isNaN(num)) {
|
|
81
|
+
return String(amount);
|
|
82
|
+
}
|
|
83
|
+
return new Intl.NumberFormat("en-US", {
|
|
84
|
+
style: "currency",
|
|
85
|
+
currency: typeof currency === "string" ? currency : "USD"
|
|
86
|
+
}).format(num);
|
|
87
|
+
}
|
|
88
|
+
function formatNumber(value, decimals) {
|
|
89
|
+
if (value === null || value === void 0) {
|
|
90
|
+
return "";
|
|
91
|
+
}
|
|
92
|
+
const num = typeof value === "number" ? value : parseFloat(String(value));
|
|
93
|
+
if (isNaN(num)) {
|
|
94
|
+
return String(value);
|
|
95
|
+
}
|
|
96
|
+
const options = {};
|
|
97
|
+
if (typeof decimals === "number") {
|
|
98
|
+
options.minimumFractionDigits = decimals;
|
|
99
|
+
options.maximumFractionDigits = decimals;
|
|
100
|
+
}
|
|
101
|
+
return new Intl.NumberFormat("en-US", options).format(num);
|
|
102
|
+
}
|
|
103
|
+
function jsonEmbed(data) {
|
|
104
|
+
const json2 = JSON.stringify(data ?? null);
|
|
105
|
+
return json2.replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
106
|
+
}
|
|
107
|
+
function json(data, pretty) {
|
|
108
|
+
return JSON.stringify(data ?? null, null, pretty ? 2 : void 0);
|
|
109
|
+
}
|
|
110
|
+
function eq(a, b) {
|
|
111
|
+
return a === b;
|
|
112
|
+
}
|
|
113
|
+
function ne(a, b) {
|
|
114
|
+
return a !== b;
|
|
115
|
+
}
|
|
116
|
+
function gt(a, b) {
|
|
117
|
+
return Number(a) > Number(b);
|
|
118
|
+
}
|
|
119
|
+
function gte(a, b) {
|
|
120
|
+
return Number(a) >= Number(b);
|
|
121
|
+
}
|
|
122
|
+
function lt(a, b) {
|
|
123
|
+
return Number(a) < Number(b);
|
|
124
|
+
}
|
|
125
|
+
function lte(a, b) {
|
|
126
|
+
return Number(a) <= Number(b);
|
|
127
|
+
}
|
|
128
|
+
function and(a, b) {
|
|
129
|
+
return Boolean(a) && Boolean(b);
|
|
130
|
+
}
|
|
131
|
+
function or(a, b) {
|
|
132
|
+
return Boolean(a) || Boolean(b);
|
|
133
|
+
}
|
|
134
|
+
function not(value) {
|
|
135
|
+
return !value;
|
|
136
|
+
}
|
|
137
|
+
function first(arr) {
|
|
138
|
+
if (!Array.isArray(arr)) return void 0;
|
|
139
|
+
return arr[0];
|
|
140
|
+
}
|
|
141
|
+
function last(arr) {
|
|
142
|
+
if (!Array.isArray(arr)) return void 0;
|
|
143
|
+
return arr[arr.length - 1];
|
|
144
|
+
}
|
|
145
|
+
function length(value) {
|
|
146
|
+
if (Array.isArray(value)) return value.length;
|
|
147
|
+
if (typeof value === "string") return value.length;
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
function includes(arr, value) {
|
|
151
|
+
if (!Array.isArray(arr)) return false;
|
|
152
|
+
return arr.includes(value);
|
|
153
|
+
}
|
|
154
|
+
function join(arr, separator) {
|
|
155
|
+
if (!Array.isArray(arr)) return "";
|
|
156
|
+
return arr.join(typeof separator === "string" ? separator : ", ");
|
|
157
|
+
}
|
|
158
|
+
function uppercase(str) {
|
|
159
|
+
return String(str ?? "").toUpperCase();
|
|
160
|
+
}
|
|
161
|
+
function lowercase(str) {
|
|
162
|
+
return String(str ?? "").toLowerCase();
|
|
163
|
+
}
|
|
164
|
+
function capitalize(str) {
|
|
165
|
+
const s = String(str ?? "");
|
|
166
|
+
return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
|
|
167
|
+
}
|
|
168
|
+
function truncate(str, maxLength, suffix) {
|
|
169
|
+
const s = String(str ?? "");
|
|
170
|
+
const len = typeof maxLength === "number" ? maxLength : 50;
|
|
171
|
+
const suf = typeof suffix === "string" ? suffix : "...";
|
|
172
|
+
if (s.length <= len) return s;
|
|
173
|
+
return s.slice(0, len - suf.length) + suf;
|
|
174
|
+
}
|
|
175
|
+
function defaultValue(value, defaultValue2) {
|
|
176
|
+
return value || defaultValue2;
|
|
177
|
+
}
|
|
178
|
+
var idCounter = 0;
|
|
179
|
+
function uniqueId(prefix) {
|
|
180
|
+
const id = ++idCounter;
|
|
181
|
+
return prefix ? `${prefix}-${id}` : `id-${id}`;
|
|
182
|
+
}
|
|
183
|
+
function resetUniqueIdCounter() {
|
|
184
|
+
idCounter = 0;
|
|
185
|
+
}
|
|
186
|
+
function classNames(...classes) {
|
|
187
|
+
return classes.filter(Boolean).map(String).join(" ");
|
|
188
|
+
}
|
|
189
|
+
var builtinHelpers = {
|
|
190
|
+
// Escaping
|
|
191
|
+
escapeHtml,
|
|
192
|
+
// Formatting
|
|
193
|
+
formatDate,
|
|
194
|
+
formatCurrency,
|
|
195
|
+
formatNumber,
|
|
196
|
+
json,
|
|
197
|
+
jsonEmbed,
|
|
198
|
+
// Comparison
|
|
199
|
+
eq,
|
|
200
|
+
ne,
|
|
201
|
+
gt,
|
|
202
|
+
gte,
|
|
203
|
+
lt,
|
|
204
|
+
lte,
|
|
205
|
+
// Logical
|
|
206
|
+
and,
|
|
207
|
+
or,
|
|
208
|
+
not,
|
|
209
|
+
// Array
|
|
210
|
+
first,
|
|
211
|
+
last,
|
|
212
|
+
length,
|
|
213
|
+
includes,
|
|
214
|
+
join,
|
|
215
|
+
// String
|
|
216
|
+
uppercase,
|
|
217
|
+
lowercase,
|
|
218
|
+
capitalize,
|
|
219
|
+
truncate,
|
|
220
|
+
// Utility
|
|
221
|
+
default: defaultValue,
|
|
222
|
+
uniqueId,
|
|
223
|
+
classNames
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// libs/uipack/src/handlebars/expression-extractor.ts
|
|
227
|
+
var EXPRESSION_REGEX = /\{\{\{?(?!!)(#|\/)?([^}]+?)\}?\}\}/g;
|
|
228
|
+
var PATH_REGEX = /\b(output|input|structuredContent)(\.[a-zA-Z_$][a-zA-Z0-9_$]*|\.\[[^\]]+\])+/g;
|
|
229
|
+
var KEYWORDS = /* @__PURE__ */ new Set(["this", "else", "@index", "@key", "@first", "@last", "@root"]);
|
|
230
|
+
function extractExpressions(template) {
|
|
231
|
+
const expressions = [];
|
|
232
|
+
const lines = template.split("\n");
|
|
233
|
+
const positionMap = buildPositionMap(template);
|
|
234
|
+
let match;
|
|
235
|
+
EXPRESSION_REGEX.lastIndex = 0;
|
|
236
|
+
while ((match = EXPRESSION_REGEX.exec(template)) !== null) {
|
|
237
|
+
const fullExpression = match[0];
|
|
238
|
+
const prefix = match[1];
|
|
239
|
+
const content = match[2].trim();
|
|
240
|
+
const position = positionMap.get(match.index) ?? { line: 1, column: 1 };
|
|
241
|
+
let type = "variable";
|
|
242
|
+
let helperName;
|
|
243
|
+
if (prefix === "/") {
|
|
244
|
+
type = "block-close";
|
|
245
|
+
helperName = content;
|
|
246
|
+
} else if (prefix === "#") {
|
|
247
|
+
type = "block";
|
|
248
|
+
const parts = content.split(/\s+/);
|
|
249
|
+
helperName = parts[0];
|
|
250
|
+
} else {
|
|
251
|
+
const parts = content.split(/\s+/);
|
|
252
|
+
if (parts.length > 1 && !content.startsWith("(")) {
|
|
253
|
+
const firstToken = parts[0];
|
|
254
|
+
if (!firstToken.includes(".") && !KEYWORDS.has(firstToken)) {
|
|
255
|
+
type = "helper";
|
|
256
|
+
helperName = firstToken;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const paths = extractPathsFromContent(content);
|
|
261
|
+
for (const path of paths) {
|
|
262
|
+
expressions.push({
|
|
263
|
+
path,
|
|
264
|
+
fullExpression,
|
|
265
|
+
line: position.line,
|
|
266
|
+
column: position.column,
|
|
267
|
+
type,
|
|
268
|
+
helperName
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
if (paths.length === 0 && type === "variable") {
|
|
272
|
+
const cleanContent = content.trim();
|
|
273
|
+
if (!KEYWORDS.has(cleanContent) && !cleanContent.includes(" ") && !cleanContent.startsWith("(")) {
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return expressions;
|
|
278
|
+
}
|
|
279
|
+
function extractPathsFromContent(content) {
|
|
280
|
+
const paths = [];
|
|
281
|
+
let match;
|
|
282
|
+
const regex = new RegExp(PATH_REGEX.source, "g");
|
|
283
|
+
while ((match = regex.exec(content)) !== null) {
|
|
284
|
+
paths.push(match[0]);
|
|
285
|
+
}
|
|
286
|
+
return paths;
|
|
287
|
+
}
|
|
288
|
+
function buildPositionMap(template) {
|
|
289
|
+
const map = /* @__PURE__ */ new Map();
|
|
290
|
+
let line = 1;
|
|
291
|
+
let column = 1;
|
|
292
|
+
for (let i = 0; i < template.length; i++) {
|
|
293
|
+
map.set(i, { line, column });
|
|
294
|
+
if (template[i] === "\n") {
|
|
295
|
+
line++;
|
|
296
|
+
column = 1;
|
|
297
|
+
} else {
|
|
298
|
+
column++;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return map;
|
|
302
|
+
}
|
|
303
|
+
function extractVariablePaths(template) {
|
|
304
|
+
const expressions = extractExpressions(template);
|
|
305
|
+
const paths = new Set(expressions.map((e) => e.path));
|
|
306
|
+
return Array.from(paths);
|
|
307
|
+
}
|
|
308
|
+
function extractOutputPaths(template) {
|
|
309
|
+
return extractVariablePaths(template).filter((p) => p.startsWith("output."));
|
|
310
|
+
}
|
|
311
|
+
function extractInputPaths(template) {
|
|
312
|
+
return extractVariablePaths(template).filter((p) => p.startsWith("input."));
|
|
313
|
+
}
|
|
314
|
+
function extractStructuredContentPaths(template) {
|
|
315
|
+
return extractVariablePaths(template).filter((p) => p.startsWith("structuredContent."));
|
|
316
|
+
}
|
|
317
|
+
function extractAll(template) {
|
|
318
|
+
const expressions = extractExpressions(template);
|
|
319
|
+
const paths = [...new Set(expressions.map((e) => e.path))];
|
|
320
|
+
return {
|
|
321
|
+
expressions,
|
|
322
|
+
paths,
|
|
323
|
+
outputPaths: paths.filter((p) => p.startsWith("output.")),
|
|
324
|
+
inputPaths: paths.filter((p) => p.startsWith("input.")),
|
|
325
|
+
structuredContentPaths: paths.filter((p) => p.startsWith("structuredContent."))
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function hasVariablePaths(template) {
|
|
329
|
+
return extractVariablePaths(template).length > 0;
|
|
330
|
+
}
|
|
331
|
+
function getExpressionAt(template, line, column) {
|
|
332
|
+
const expressions = extractExpressions(template);
|
|
333
|
+
return expressions.find((expr) => {
|
|
334
|
+
if (expr.line !== line) return false;
|
|
335
|
+
const exprEnd = expr.column + expr.fullExpression.length;
|
|
336
|
+
return column >= expr.column && column <= exprEnd;
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
function normalizePath(path) {
|
|
340
|
+
return path.replace(/\.\d+\./g, ".[].").replace(/\.\d+$/g, ".[]").replace(/\[\d+\]/g, ".[]");
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// libs/uipack/src/handlebars/index.ts
|
|
344
|
+
var Handlebars = null;
|
|
345
|
+
async function loadHandlebars() {
|
|
346
|
+
if (Handlebars !== null) {
|
|
347
|
+
return Handlebars;
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
Handlebars = await import("handlebars");
|
|
351
|
+
return Handlebars;
|
|
352
|
+
} catch {
|
|
353
|
+
throw new Error("Handlebars is required for template rendering. Install it: npm install handlebars");
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
async function isHandlebarsAvailable() {
|
|
357
|
+
try {
|
|
358
|
+
await loadHandlebars();
|
|
359
|
+
return true;
|
|
360
|
+
} catch {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
var HandlebarsRenderer = class {
|
|
365
|
+
options;
|
|
366
|
+
compiledTemplates = /* @__PURE__ */ new Map();
|
|
367
|
+
initialized = false;
|
|
368
|
+
hbs = null;
|
|
369
|
+
constructor(options = {}) {
|
|
370
|
+
this.options = {
|
|
371
|
+
strict: false,
|
|
372
|
+
autoEscape: true,
|
|
373
|
+
...options
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Initialize the renderer with Handlebars.
|
|
378
|
+
*/
|
|
379
|
+
async init() {
|
|
380
|
+
if (this.initialized) return;
|
|
381
|
+
this.hbs = await loadHandlebars();
|
|
382
|
+
for (const [name, helper] of Object.entries(builtinHelpers)) {
|
|
383
|
+
this.hbs.registerHelper(name, helper);
|
|
384
|
+
}
|
|
385
|
+
if (this.options.helpers) {
|
|
386
|
+
for (const [name, helper] of Object.entries(this.options.helpers)) {
|
|
387
|
+
this.hbs.registerHelper(name, helper);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (this.options.partials) {
|
|
391
|
+
for (const [name, template] of Object.entries(this.options.partials)) {
|
|
392
|
+
this.hbs.registerPartial(name, template);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
this.initialized = true;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Render a Handlebars template.
|
|
399
|
+
*
|
|
400
|
+
* @param template - Template string
|
|
401
|
+
* @param context - Render context with input/output
|
|
402
|
+
* @returns Rendered HTML string
|
|
403
|
+
*/
|
|
404
|
+
async render(template, context) {
|
|
405
|
+
await this.init();
|
|
406
|
+
if (!this.hbs) {
|
|
407
|
+
throw new Error("Handlebars not initialized");
|
|
408
|
+
}
|
|
409
|
+
let compiled = this.compiledTemplates.get(template);
|
|
410
|
+
if (!compiled) {
|
|
411
|
+
compiled = this.hbs.compile(template, {
|
|
412
|
+
strict: this.options.strict,
|
|
413
|
+
noEscape: !this.options.autoEscape
|
|
414
|
+
});
|
|
415
|
+
this.compiledTemplates.set(template, compiled);
|
|
416
|
+
}
|
|
417
|
+
const data = {
|
|
418
|
+
input: context.input ?? {},
|
|
419
|
+
output: context.output ?? {},
|
|
420
|
+
structuredContent: context.structuredContent,
|
|
421
|
+
// Also expose at root level for convenience
|
|
422
|
+
...context.input,
|
|
423
|
+
...typeof context.output === "object" && context.output !== null ? context.output : {}
|
|
424
|
+
};
|
|
425
|
+
try {
|
|
426
|
+
return compiled(data);
|
|
427
|
+
} catch (error) {
|
|
428
|
+
throw new Error(`Template rendering failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Render a template synchronously.
|
|
433
|
+
*
|
|
434
|
+
* Note: Requires Handlebars to be pre-loaded. Use `render()` for async loading.
|
|
435
|
+
*
|
|
436
|
+
* @param template - Template string
|
|
437
|
+
* @param context - Render context
|
|
438
|
+
* @returns Rendered HTML string
|
|
439
|
+
*/
|
|
440
|
+
renderSync(template, context) {
|
|
441
|
+
if (!this.initialized || !this.hbs) {
|
|
442
|
+
throw new Error("HandlebarsRenderer not initialized. Call render() first or use initSync().");
|
|
443
|
+
}
|
|
444
|
+
let compiled = this.compiledTemplates.get(template);
|
|
445
|
+
if (!compiled) {
|
|
446
|
+
compiled = this.hbs.compile(template, {
|
|
447
|
+
strict: this.options.strict,
|
|
448
|
+
noEscape: !this.options.autoEscape
|
|
449
|
+
});
|
|
450
|
+
this.compiledTemplates.set(template, compiled);
|
|
451
|
+
}
|
|
452
|
+
const data = {
|
|
453
|
+
input: context.input ?? {},
|
|
454
|
+
output: context.output ?? {},
|
|
455
|
+
structuredContent: context.structuredContent,
|
|
456
|
+
...context.input,
|
|
457
|
+
...typeof context.output === "object" && context.output !== null ? context.output : {}
|
|
458
|
+
};
|
|
459
|
+
return compiled(data);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Initialize synchronously (for environments where Handlebars is already loaded).
|
|
463
|
+
*/
|
|
464
|
+
initSync(handlebars) {
|
|
465
|
+
this.hbs = handlebars;
|
|
466
|
+
for (const [name, helper] of Object.entries(builtinHelpers)) {
|
|
467
|
+
this.hbs.registerHelper(name, helper);
|
|
468
|
+
}
|
|
469
|
+
if (this.options.helpers) {
|
|
470
|
+
for (const [name, helper] of Object.entries(this.options.helpers)) {
|
|
471
|
+
this.hbs.registerHelper(name, helper);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (this.options.partials) {
|
|
475
|
+
for (const [name, template] of Object.entries(this.options.partials)) {
|
|
476
|
+
this.hbs.registerPartial(name, template);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
this.initialized = true;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Register a custom helper.
|
|
483
|
+
*
|
|
484
|
+
* @param name - Helper name
|
|
485
|
+
* @param fn - Helper function
|
|
486
|
+
*/
|
|
487
|
+
registerHelper(name, fn) {
|
|
488
|
+
if (this.hbs) {
|
|
489
|
+
this.hbs.registerHelper(name, fn);
|
|
490
|
+
}
|
|
491
|
+
if (!this.options.helpers) {
|
|
492
|
+
this.options.helpers = {};
|
|
493
|
+
}
|
|
494
|
+
this.options.helpers[name] = fn;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Register a partial template.
|
|
498
|
+
*
|
|
499
|
+
* @param name - Partial name
|
|
500
|
+
* @param template - Partial template string
|
|
501
|
+
*/
|
|
502
|
+
registerPartial(name, template) {
|
|
503
|
+
if (this.hbs) {
|
|
504
|
+
this.hbs.registerPartial(name, template);
|
|
505
|
+
}
|
|
506
|
+
if (!this.options.partials) {
|
|
507
|
+
this.options.partials = {};
|
|
508
|
+
}
|
|
509
|
+
this.options.partials[name] = template;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Clear compiled template cache.
|
|
513
|
+
*/
|
|
514
|
+
clearCache() {
|
|
515
|
+
this.compiledTemplates.clear();
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Check if a template string contains Handlebars syntax.
|
|
519
|
+
*
|
|
520
|
+
* @param template - Template string to check
|
|
521
|
+
* @returns true if contains {{...}} syntax
|
|
522
|
+
*/
|
|
523
|
+
static containsHandlebars(template) {
|
|
524
|
+
return /\{\{(?!!)[\s\S]*?\}\}/.test(template);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Check if the renderer is initialized.
|
|
528
|
+
*/
|
|
529
|
+
get isInitialized() {
|
|
530
|
+
return this.initialized;
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
function createHandlebarsRenderer(options) {
|
|
534
|
+
return new HandlebarsRenderer(options);
|
|
535
|
+
}
|
|
536
|
+
async function renderTemplate(template, context) {
|
|
537
|
+
const renderer = createHandlebarsRenderer();
|
|
538
|
+
return renderer.render(template, context);
|
|
539
|
+
}
|
|
540
|
+
function containsHandlebars(template) {
|
|
541
|
+
return HandlebarsRenderer.containsHandlebars(template);
|
|
542
|
+
}
|
|
543
|
+
export {
|
|
544
|
+
HandlebarsRenderer,
|
|
545
|
+
and,
|
|
546
|
+
builtinHelpers,
|
|
547
|
+
capitalize,
|
|
548
|
+
classNames,
|
|
549
|
+
containsHandlebars,
|
|
550
|
+
createHandlebarsRenderer,
|
|
551
|
+
defaultValue,
|
|
552
|
+
eq,
|
|
553
|
+
escapeHtml,
|
|
554
|
+
extractAll,
|
|
555
|
+
extractExpressions,
|
|
556
|
+
extractInputPaths,
|
|
557
|
+
extractOutputPaths,
|
|
558
|
+
extractStructuredContentPaths,
|
|
559
|
+
extractVariablePaths,
|
|
560
|
+
first,
|
|
561
|
+
formatCurrency,
|
|
562
|
+
formatDate,
|
|
563
|
+
formatNumber,
|
|
564
|
+
getExpressionAt,
|
|
565
|
+
gt,
|
|
566
|
+
gte,
|
|
567
|
+
hasVariablePaths,
|
|
568
|
+
includes,
|
|
569
|
+
isHandlebarsAvailable,
|
|
570
|
+
join,
|
|
571
|
+
json,
|
|
572
|
+
jsonEmbed,
|
|
573
|
+
last,
|
|
574
|
+
length,
|
|
575
|
+
lowercase,
|
|
576
|
+
lt,
|
|
577
|
+
lte,
|
|
578
|
+
ne,
|
|
579
|
+
normalizePath,
|
|
580
|
+
not,
|
|
581
|
+
or,
|
|
582
|
+
renderTemplate,
|
|
583
|
+
resetUniqueIdCounter,
|
|
584
|
+
truncate,
|
|
585
|
+
uniqueId,
|
|
586
|
+
uppercase
|
|
587
|
+
};
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @frontmcp/uipack
|
|
3
|
+
*
|
|
4
|
+
* Build tools, bundling, and platform adapters for FrontMCP UI development.
|
|
5
|
+
* This package provides the infrastructure for compiling and deploying UI templates.
|
|
6
|
+
*
|
|
7
|
+
* For UI components (HTML and React), theming, and layouts, use @frontmcp/ui.
|
|
8
|
+
*
|
|
9
|
+
* Key features:
|
|
10
|
+
* - Platform-aware adapters (OpenAI, Claude, etc.)
|
|
11
|
+
* - Runtime JSX/TSX transpilation with SWC
|
|
12
|
+
* - Build-time API for pre-compiling UI templates
|
|
13
|
+
* - Template rendering and widget registration
|
|
14
|
+
*
|
|
15
|
+
* ## Usage
|
|
16
|
+
*
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Import standalone types
|
|
19
|
+
* import type { UITemplateConfig, TemplateContext } from '@frontmcp/uipack/types';
|
|
20
|
+
*
|
|
21
|
+
* // Import platform adapters
|
|
22
|
+
* import { buildUIMeta } from '@frontmcp/uipack/adapters';
|
|
23
|
+
*
|
|
24
|
+
* // Import build-time API
|
|
25
|
+
* import { buildToolUI } from '@frontmcp/uipack/build';
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* For UI components and theming, use @frontmcp/ui instead:
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { card, button, table } from '@frontmcp/ui/components';
|
|
31
|
+
* import { DEFAULT_THEME, createTheme } from '.../theme';
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export * from './types';
|
|
35
|
+
export { type AIPlatformType, type UIMetadata, type BuildUIMetaOptions, type BuildToolDiscoveryMetaOptions, buildUIMeta, buildToolDiscoveryMeta, buildOpenAICSP, type ResolvedServingMode, type ResolveServingModeOptions, resolveServingMode, isPlatformModeSupported, getDefaultServingMode, platformUsesStructuredContent, platformSupportsWidgets, type TextContentBlock, type BuildToolResponseOptions, type ToolResponseContent, buildToolResponseContent, } from './adapters';
|
|
36
|
+
export { type BuildTargetPlatform, type BuildOptions, type BuildResult, type MultiBuildOptions, type MultiBuildResult, type StaticWidgetOptions, buildToolUI, buildToolUIMulti, buildStaticWidget, } from './build';
|
|
37
|
+
export { type ProviderType, type DisplayMode, type ThemeMode, type HostContext, type MCPBridge, type MCPBridgeExtended, type WrapToolUIOptions, type OpenAIRuntime, type OpenAIUserAgent, type SafeAreaInsets, MCP_BRIDGE_RUNTIME, getMCPBridgeScript, isMCPBridgeSupported, DEFAULT_CDN_DOMAINS, DEFAULT_CSP_DIRECTIVES, RESTRICTIVE_CSP_DIRECTIVES, buildCSPDirectives, buildCSPMetaTag, validateCSPDomain, sanitizeCSPDomains, type WrapToolUIFullOptions, wrapToolUI, wrapToolUIMinimal, createTemplateHelpers, getToolUIMimeType, type SanitizerFn, type SanitizeOptions, REDACTION_TOKENS, PII_PATTERNS, sanitizeInput, createSanitizer, detectPII, isEmail, isPhone, isCreditCard, isSSN, isIPv4, detectPIIType, redactPIIFromText, } from './runtime';
|
|
38
|
+
export { generateBridgeIIFE, generatePlatformBundle, UNIVERSAL_BRIDGE_SCRIPT, BRIDGE_SCRIPT_TAGS, type IIFEGeneratorOptions, } from './bridge-runtime';
|
|
39
|
+
export * from './tool-template';
|
|
40
|
+
export * from './base-template';
|
|
41
|
+
export * from './renderers';
|
|
42
|
+
export { ToolUIRegistry, type RenderOptions, type UIRenderResult, type CompileStaticWidgetOptions, type HybridComponentPayload, type BuildHybridComponentPayloadOptions, renderToolTemplate, renderToolTemplateAsync, isReactComponent, hasUIConfig, containsMdxSyntax, type RenderTemplateOptions, UI_RESOURCE_SCHEME, isUIResourceUri, isStaticWidgetUri, parseWidgetUri, buildStaticWidgetUri, getUIResourceMimeType, type ParsedWidgetUri, } from './registry';
|
|
43
|
+
export { type CDNProvider, type CDNPlatformType, type CDNDependency, type FileBundleOptions, type ImportMap, type ResolvedDependency, type ComponentBuildManifest, type CDNRegistryEntry, type CDNRegistry, type ParsedImport, type ParsedImportResult, type TemplateMode, detectTemplateMode, DEFAULT_CDN_REGISTRY, lookupPackage, getPackageCDNUrl, isPackageRegistered, parseImports, extractExternalPackages, getPackageName, DependencyResolver, createResolver, createClaudeResolver, createOpenAIResolver, resolveDependencies, generateImportMapForPackages, createImportMap, generateImportMapScriptTag, generateDependencyHTML, generateUMDShim, } from './dependency';
|
|
44
|
+
export { ComponentBuilder, createFilesystemBuilder, createRedisBuilder, type ComponentBuildOptions, type ComponentBuildResult, FilesystemStorage, RedisStorage, type BuildCacheStorage, sha256, calculateComponentHash, calculateQuickHash, generateBuildId, } from './bundler/file-cache';
|
|
45
|
+
export { type TypeFetchResult, type TypeFetchError, type TypeFetchErrorCode, type TypeFetchBatchRequest, type TypeFetchBatchResult, type TypeCacheEntry, type TypeCacheStats, type DtsImport, type DtsParseResult, type TypeFetcherOptions, type PackageResolution, DEFAULT_TYPE_FETCHER_OPTIONS, TYPE_CACHE_PREFIX, DEFAULT_TYPE_CACHE_TTL, type TypeCacheAdapter, type TypeCacheOptions, DEFAULT_CACHE_OPTIONS as DEFAULT_TYPE_CACHE_OPTIONS, MemoryTypeCache, globalTypeCache, parseDtsImports, isRelativeImport, getPackageFromSpecifier, getSubpathFromSpecifier, parseImportStatement, combineDtsContents, TypeFetcher, createTypeFetcher, } from './typings';
|
|
46
|
+
export * from './theme';
|
|
47
|
+
export * from './validation';
|
|
48
|
+
export * from './utils';
|
|
49
|
+
export * from './styles';
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAMH,cAAc,SAAS,CAAC;AAKxB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EAClC,WAAW,EACX,sBAAsB,EACtB,cAAc,EAEd,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,uBAAuB,EAEvB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAKjB,OAAO,EA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