@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
|
@@ -0,0 +1,2028 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// libs/ui/src/web-components/index.ts
|
|
21
|
+
var web_components_exports = {};
|
|
22
|
+
__export(web_components_exports, {
|
|
23
|
+
FmcpAlert: () => FmcpAlert,
|
|
24
|
+
FmcpBadge: () => FmcpBadge,
|
|
25
|
+
FmcpButton: () => FmcpButton,
|
|
26
|
+
FmcpCard: () => FmcpCard,
|
|
27
|
+
FmcpElement: () => FmcpElement,
|
|
28
|
+
FmcpInput: () => FmcpInput,
|
|
29
|
+
FmcpSelect: () => FmcpSelect,
|
|
30
|
+
camelToKebab: () => camelToKebab,
|
|
31
|
+
getObservedAttributesFromSchema: () => getObservedAttributesFromSchema,
|
|
32
|
+
kebabToCamel: () => kebabToCamel,
|
|
33
|
+
mergeAttributeIntoOptions: () => mergeAttributeIntoOptions,
|
|
34
|
+
parseAttributeValue: () => parseAttributeValue,
|
|
35
|
+
registerAllComponents: () => registerAllComponents,
|
|
36
|
+
registerFmcpAlert: () => registerFmcpAlert,
|
|
37
|
+
registerFmcpBadge: () => registerFmcpBadge,
|
|
38
|
+
registerFmcpButton: () => registerFmcpButton,
|
|
39
|
+
registerFmcpCard: () => registerFmcpCard,
|
|
40
|
+
registerFmcpInput: () => registerFmcpInput,
|
|
41
|
+
registerFmcpSelect: () => registerFmcpSelect
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(web_components_exports);
|
|
44
|
+
|
|
45
|
+
// libs/ui/src/web-components/core/base-element.ts
|
|
46
|
+
var import_validation = require("@frontmcp/uipack/validation");
|
|
47
|
+
|
|
48
|
+
// libs/ui/src/web-components/core/attribute-parser.ts
|
|
49
|
+
function parseAttributeValue(attrName, value) {
|
|
50
|
+
if (attrName.startsWith("data-fmcp-")) {
|
|
51
|
+
return { key: null, value: void 0 };
|
|
52
|
+
}
|
|
53
|
+
if (attrName.startsWith("data-")) {
|
|
54
|
+
const dataKey = attrName.slice(5);
|
|
55
|
+
return {
|
|
56
|
+
key: dataKey,
|
|
57
|
+
value: value ?? "",
|
|
58
|
+
isData: true
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const camelName = kebabToCamel(attrName);
|
|
62
|
+
if (value === null || value === "") {
|
|
63
|
+
return { key: camelName, value: true };
|
|
64
|
+
}
|
|
65
|
+
if (value === "true") {
|
|
66
|
+
return { key: camelName, value: true };
|
|
67
|
+
}
|
|
68
|
+
if (value === "false") {
|
|
69
|
+
return { key: camelName, value: false };
|
|
70
|
+
}
|
|
71
|
+
const numValue = Number(value);
|
|
72
|
+
if (!isNaN(numValue) && value.trim() !== "") {
|
|
73
|
+
return { key: camelName, value: numValue };
|
|
74
|
+
}
|
|
75
|
+
if (value.startsWith("{") || value.startsWith("[")) {
|
|
76
|
+
try {
|
|
77
|
+
return { key: camelName, value: JSON.parse(value) };
|
|
78
|
+
} catch {
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return { key: camelName, value };
|
|
82
|
+
}
|
|
83
|
+
function kebabToCamel(str) {
|
|
84
|
+
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
85
|
+
}
|
|
86
|
+
function camelToKebab(str) {
|
|
87
|
+
return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
88
|
+
}
|
|
89
|
+
function getObservedAttributesFromSchema(schema) {
|
|
90
|
+
const attributes = [];
|
|
91
|
+
const schemaAny = schema;
|
|
92
|
+
if (schemaAny.shape) {
|
|
93
|
+
for (const key of Object.keys(schemaAny.shape)) {
|
|
94
|
+
attributes.push(camelToKebab(key));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const commonAttrs = ["class", "id", "style"];
|
|
98
|
+
attributes.push(...commonAttrs);
|
|
99
|
+
return [...new Set(attributes)];
|
|
100
|
+
}
|
|
101
|
+
function mergeAttributeIntoOptions(options, parsed) {
|
|
102
|
+
if (parsed.key === null || parsed.value === void 0) {
|
|
103
|
+
return options;
|
|
104
|
+
}
|
|
105
|
+
const result = { ...options };
|
|
106
|
+
if (parsed.isData) {
|
|
107
|
+
const data = result["data"] ?? {};
|
|
108
|
+
data[parsed.key] = String(parsed.value);
|
|
109
|
+
result["data"] = data;
|
|
110
|
+
} else {
|
|
111
|
+
result[parsed.key] = parsed.value;
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// libs/ui/src/web-components/core/base-element.ts
|
|
117
|
+
var HTMLElementBase = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
|
118
|
+
innerHTML = "";
|
|
119
|
+
dispatchEvent() {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
getAttribute() {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var FmcpElement = class extends HTMLElementBase {
|
|
127
|
+
/** Internal options state */
|
|
128
|
+
_options = {};
|
|
129
|
+
/** Content passed as children (captured on connect) */
|
|
130
|
+
_content = "";
|
|
131
|
+
/** Whether component has been connected to DOM */
|
|
132
|
+
_connected = false;
|
|
133
|
+
/** Whether a render is pending (for batching) */
|
|
134
|
+
_pendingRender = false;
|
|
135
|
+
/** Whether initial render has completed */
|
|
136
|
+
_initialRenderComplete = false;
|
|
137
|
+
// ============================================
|
|
138
|
+
// Lifecycle Callbacks
|
|
139
|
+
// ============================================
|
|
140
|
+
/**
|
|
141
|
+
* Called when element is added to DOM.
|
|
142
|
+
* Captures content, parses attributes, and renders.
|
|
143
|
+
*
|
|
144
|
+
* Supports SSR hydration via `data-ssr` attribute:
|
|
145
|
+
* - If `data-ssr` is present, content was pre-rendered by server
|
|
146
|
+
* - Web component adopts existing content without re-rendering
|
|
147
|
+
* - This enables progressive enhancement for LLM platforms
|
|
148
|
+
*/
|
|
149
|
+
connectedCallback() {
|
|
150
|
+
this._connected = true;
|
|
151
|
+
const isHydrating = this.hasAttribute("data-ssr");
|
|
152
|
+
if (isHydrating) {
|
|
153
|
+
this._content = this.innerHTML;
|
|
154
|
+
this._initialRenderComplete = true;
|
|
155
|
+
this.removeAttribute("data-ssr");
|
|
156
|
+
this._parseAttributes();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (!this._initialRenderComplete) {
|
|
160
|
+
this._content = this.innerHTML;
|
|
161
|
+
}
|
|
162
|
+
this._parseAttributes();
|
|
163
|
+
this._render();
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Called when element is removed from DOM.
|
|
167
|
+
*/
|
|
168
|
+
disconnectedCallback() {
|
|
169
|
+
this._connected = false;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Called when an observed attribute changes.
|
|
173
|
+
* Updates options and schedules re-render.
|
|
174
|
+
*/
|
|
175
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
176
|
+
if (oldValue === newValue) return;
|
|
177
|
+
this._updateOptionFromAttribute(name, newValue);
|
|
178
|
+
this._scheduleRender();
|
|
179
|
+
}
|
|
180
|
+
// ============================================
|
|
181
|
+
// Property Accessors (React/Vue Compatibility)
|
|
182
|
+
// ============================================
|
|
183
|
+
/**
|
|
184
|
+
* Set all options at once (React pattern).
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* const el = document.querySelector('fmcp-button');
|
|
189
|
+
* el.options = { variant: 'danger', size: 'lg' };
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
set options(value) {
|
|
193
|
+
this._options = { ...this._options, ...value };
|
|
194
|
+
this._scheduleRender();
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get current options.
|
|
198
|
+
*/
|
|
199
|
+
get options() {
|
|
200
|
+
return { ...this._options };
|
|
201
|
+
}
|
|
202
|
+
// ============================================
|
|
203
|
+
// Attribute Parsing
|
|
204
|
+
// ============================================
|
|
205
|
+
/**
|
|
206
|
+
* Parse all current attributes into options.
|
|
207
|
+
*/
|
|
208
|
+
_parseAttributes() {
|
|
209
|
+
for (const attr of Array.from(this.attributes)) {
|
|
210
|
+
this._updateOptionFromAttribute(attr.name, attr.value);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Update a single option from an attribute change.
|
|
215
|
+
*/
|
|
216
|
+
_updateOptionFromAttribute(attrName, value) {
|
|
217
|
+
const parsed = parseAttributeValue(attrName, value);
|
|
218
|
+
this._options = mergeAttributeIntoOptions(this._options, parsed);
|
|
219
|
+
}
|
|
220
|
+
// ============================================
|
|
221
|
+
// Rendering
|
|
222
|
+
// ============================================
|
|
223
|
+
/**
|
|
224
|
+
* Schedule a render on next microtask.
|
|
225
|
+
* Batches multiple attribute/property changes.
|
|
226
|
+
*/
|
|
227
|
+
_scheduleRender() {
|
|
228
|
+
if (!this._connected || this._pendingRender) return;
|
|
229
|
+
this._pendingRender = true;
|
|
230
|
+
queueMicrotask(() => {
|
|
231
|
+
this._pendingRender = false;
|
|
232
|
+
if (this._connected) {
|
|
233
|
+
this._render();
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Perform the actual render.
|
|
239
|
+
* Validates options and updates innerHTML.
|
|
240
|
+
*/
|
|
241
|
+
_render() {
|
|
242
|
+
const mergedOptions = {
|
|
243
|
+
...this.config.defaults,
|
|
244
|
+
...this._options
|
|
245
|
+
};
|
|
246
|
+
const result = this.config.schema.safeParse(mergedOptions);
|
|
247
|
+
if (!result.success) {
|
|
248
|
+
const firstError = result.error.issues[0];
|
|
249
|
+
const invalidParam = firstError?.path.join(".") || "options";
|
|
250
|
+
this.innerHTML = (0, import_validation.validationErrorBox)({
|
|
251
|
+
componentName: this.config.name,
|
|
252
|
+
invalidParam
|
|
253
|
+
});
|
|
254
|
+
this._initialRenderComplete = true;
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const html = this.renderHtml(result.data, this._content);
|
|
258
|
+
this.innerHTML = html;
|
|
259
|
+
this._initialRenderComplete = true;
|
|
260
|
+
this.dispatchEvent(
|
|
261
|
+
new CustomEvent("fmcp:render", {
|
|
262
|
+
bubbles: true,
|
|
263
|
+
detail: { options: result.data }
|
|
264
|
+
})
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
// ============================================
|
|
268
|
+
// Public API
|
|
269
|
+
// ============================================
|
|
270
|
+
/**
|
|
271
|
+
* Force an immediate re-render.
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* el.options = { loading: true };
|
|
276
|
+
* el.refresh(); // Force immediate render
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
refresh() {
|
|
280
|
+
if (this._connected) {
|
|
281
|
+
this._render();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get the first child element (the actual rendered component).
|
|
286
|
+
*
|
|
287
|
+
* @typeParam T - Expected element type
|
|
288
|
+
* @returns The first child element or null
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```typescript
|
|
292
|
+
* const button = el.getInnerElement<HTMLButtonElement>();
|
|
293
|
+
* button?.focus();
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
getInnerElement() {
|
|
297
|
+
return this.firstElementChild;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Update content and re-render.
|
|
301
|
+
*
|
|
302
|
+
* @param content - New content string
|
|
303
|
+
*/
|
|
304
|
+
setContent(content) {
|
|
305
|
+
this._content = content;
|
|
306
|
+
this._scheduleRender();
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
// libs/ui/src/layouts/base.ts
|
|
311
|
+
var import_theme = require("@frontmcp/uipack/theme");
|
|
312
|
+
var import_utils = require("@frontmcp/uipack/utils");
|
|
313
|
+
var import_utils2 = require("@frontmcp/uipack/utils");
|
|
314
|
+
|
|
315
|
+
// libs/ui/src/components/button.ts
|
|
316
|
+
var import_validation2 = require("@frontmcp/uipack/validation");
|
|
317
|
+
|
|
318
|
+
// libs/ui/src/components/button.schema.ts
|
|
319
|
+
var import_zod = require("zod");
|
|
320
|
+
var ButtonVariantSchema = import_zod.z.enum(["primary", "secondary", "outline", "ghost", "danger", "success", "link"]);
|
|
321
|
+
var ButtonSizeSchema = import_zod.z.enum(["xs", "sm", "md", "lg", "xl"]);
|
|
322
|
+
var ButtonOptionsSchema = import_zod.z.object({
|
|
323
|
+
/** Button variant */
|
|
324
|
+
variant: ButtonVariantSchema.optional(),
|
|
325
|
+
/** Button size */
|
|
326
|
+
size: ButtonSizeSchema.optional(),
|
|
327
|
+
/** Button type attribute */
|
|
328
|
+
type: import_zod.z.enum(["button", "submit", "reset"]).optional(),
|
|
329
|
+
/** Disabled state */
|
|
330
|
+
disabled: import_zod.z.boolean().optional(),
|
|
331
|
+
/** Loading state */
|
|
332
|
+
loading: import_zod.z.boolean().optional(),
|
|
333
|
+
/** Full width */
|
|
334
|
+
fullWidth: import_zod.z.boolean().optional(),
|
|
335
|
+
/** Icon before text (HTML string) */
|
|
336
|
+
iconBefore: import_zod.z.string().optional(),
|
|
337
|
+
/** Icon after text (HTML string) */
|
|
338
|
+
iconAfter: import_zod.z.string().optional(),
|
|
339
|
+
/** Icon only (no text) */
|
|
340
|
+
iconOnly: import_zod.z.boolean().optional(),
|
|
341
|
+
/** Additional CSS classes */
|
|
342
|
+
className: import_zod.z.string().optional(),
|
|
343
|
+
/** Button ID */
|
|
344
|
+
id: import_zod.z.string().optional(),
|
|
345
|
+
/** Name attribute */
|
|
346
|
+
name: import_zod.z.string().optional(),
|
|
347
|
+
/** Value attribute */
|
|
348
|
+
value: import_zod.z.string().optional(),
|
|
349
|
+
/** Click handler (URL for links) */
|
|
350
|
+
href: import_zod.z.string().optional(),
|
|
351
|
+
/** Open in new tab */
|
|
352
|
+
target: import_zod.z.enum(["_blank", "_self"]).optional(),
|
|
353
|
+
/** Data attributes */
|
|
354
|
+
data: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).optional(),
|
|
355
|
+
/** ARIA label */
|
|
356
|
+
ariaLabel: import_zod.z.string().optional()
|
|
357
|
+
}).strict();
|
|
358
|
+
var ButtonGroupOptionsSchema = import_zod.z.object({
|
|
359
|
+
/** Attach buttons visually */
|
|
360
|
+
attached: import_zod.z.boolean().optional(),
|
|
361
|
+
/** Direction */
|
|
362
|
+
direction: import_zod.z.enum(["horizontal", "vertical"]).optional(),
|
|
363
|
+
/** Gap between buttons */
|
|
364
|
+
gap: import_zod.z.enum(["sm", "md", "lg"]).optional(),
|
|
365
|
+
/** Additional CSS classes */
|
|
366
|
+
className: import_zod.z.string().optional()
|
|
367
|
+
}).strict();
|
|
368
|
+
|
|
369
|
+
// libs/ui/src/components/button.ts
|
|
370
|
+
function getVariantClasses(variant) {
|
|
371
|
+
const variants = {
|
|
372
|
+
primary: "bg-primary hover:bg-primary/90 text-white shadow-sm",
|
|
373
|
+
secondary: "bg-secondary hover:bg-secondary/90 text-white shadow-sm",
|
|
374
|
+
outline: "border-2 border-primary text-primary hover:bg-primary/10",
|
|
375
|
+
ghost: "text-text-primary hover:bg-gray-100",
|
|
376
|
+
danger: "bg-danger hover:bg-danger/90 text-white shadow-sm",
|
|
377
|
+
success: "bg-success hover:bg-success/90 text-white shadow-sm",
|
|
378
|
+
link: "text-primary hover:text-primary/80 hover:underline"
|
|
379
|
+
};
|
|
380
|
+
return variants[variant];
|
|
381
|
+
}
|
|
382
|
+
function getSizeClasses(size, iconOnly) {
|
|
383
|
+
if (iconOnly) {
|
|
384
|
+
const iconSizes = {
|
|
385
|
+
xs: "p-1.5",
|
|
386
|
+
sm: "p-2",
|
|
387
|
+
md: "p-2.5",
|
|
388
|
+
lg: "p-3",
|
|
389
|
+
xl: "p-4"
|
|
390
|
+
};
|
|
391
|
+
return iconSizes[size];
|
|
392
|
+
}
|
|
393
|
+
const sizes = {
|
|
394
|
+
xs: "px-2.5 py-1.5 text-xs",
|
|
395
|
+
sm: "px-3 py-2 text-sm",
|
|
396
|
+
md: "px-4 py-2.5 text-sm",
|
|
397
|
+
lg: "px-5 py-3 text-base",
|
|
398
|
+
xl: "px-6 py-3.5 text-lg"
|
|
399
|
+
};
|
|
400
|
+
return sizes[size];
|
|
401
|
+
}
|
|
402
|
+
function sanitizeDataKey(key) {
|
|
403
|
+
const sanitized = key.toLowerCase().replace(/[^a-z0-9_-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
404
|
+
if (!sanitized) {
|
|
405
|
+
console.warn(`[frontmcp/ui] Dropping invalid data-* key: "${key}"`);
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
return sanitized;
|
|
409
|
+
}
|
|
410
|
+
var loadingSpinner = `<svg class="animate-spin -ml-1 mr-2 h-4 w-4" fill="none" viewBox="0 0 24 24">
|
|
411
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
412
|
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
413
|
+
</svg>`;
|
|
414
|
+
function isValidHrefProtocol(href) {
|
|
415
|
+
const trimmed = href.trim().toLowerCase();
|
|
416
|
+
return trimmed.startsWith("http://") || trimmed.startsWith("https://") || trimmed.startsWith("/") || trimmed.startsWith("#") || trimmed.startsWith("mailto:") || trimmed.startsWith("tel:");
|
|
417
|
+
}
|
|
418
|
+
function button(text, options = {}) {
|
|
419
|
+
const validation = (0, import_validation2.validateOptions)(options, {
|
|
420
|
+
schema: ButtonOptionsSchema,
|
|
421
|
+
componentName: "button"
|
|
422
|
+
});
|
|
423
|
+
if (!validation.success) {
|
|
424
|
+
return validation.error;
|
|
425
|
+
}
|
|
426
|
+
const validatedOptions = validation.data;
|
|
427
|
+
const {
|
|
428
|
+
variant = "primary",
|
|
429
|
+
size = "md",
|
|
430
|
+
type = "button",
|
|
431
|
+
disabled = false,
|
|
432
|
+
loading = false,
|
|
433
|
+
fullWidth = false,
|
|
434
|
+
iconBefore,
|
|
435
|
+
iconAfter,
|
|
436
|
+
iconOnly = false,
|
|
437
|
+
className = "",
|
|
438
|
+
id,
|
|
439
|
+
name,
|
|
440
|
+
value,
|
|
441
|
+
href,
|
|
442
|
+
target,
|
|
443
|
+
data,
|
|
444
|
+
ariaLabel
|
|
445
|
+
} = validatedOptions;
|
|
446
|
+
if (!iconOnly && !text.trim()) {
|
|
447
|
+
console.warn("[frontmcp/ui] Button has empty text. Consider providing text or using iconOnly with ariaLabel.");
|
|
448
|
+
}
|
|
449
|
+
if (iconOnly && !ariaLabel && !text.trim()) {
|
|
450
|
+
console.warn(
|
|
451
|
+
"[frontmcp/ui] iconOnly button requires non-empty text or ariaLabel for accessibility; control will have no label."
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
if (href && !isValidHrefProtocol(href)) {
|
|
455
|
+
console.warn(`[frontmcp/ui] Button href contains potentially dangerous protocol: "${href.slice(0, 20)}..."`);
|
|
456
|
+
}
|
|
457
|
+
const variantClasses = getVariantClasses(variant);
|
|
458
|
+
const sizeClasses = getSizeClasses(size, iconOnly);
|
|
459
|
+
const safeClassName = className ? (0, import_utils2.escapeHtml)(className) : "";
|
|
460
|
+
const baseClasses = [
|
|
461
|
+
"inline-flex items-center justify-center",
|
|
462
|
+
"font-medium",
|
|
463
|
+
"rounded-lg",
|
|
464
|
+
"transition-colors duration-200",
|
|
465
|
+
"focus:outline-none focus:ring-2 focus:ring-primary/50 focus:ring-offset-2",
|
|
466
|
+
disabled || loading ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
|
467
|
+
fullWidth ? "w-full" : "",
|
|
468
|
+
variantClasses,
|
|
469
|
+
sizeClasses,
|
|
470
|
+
safeClassName
|
|
471
|
+
].filter(Boolean).join(" ");
|
|
472
|
+
const dataAttrs = data ? Object.entries(data).map(([key, val]) => {
|
|
473
|
+
const safeKey = sanitizeDataKey(key);
|
|
474
|
+
return safeKey ? `data-${safeKey}="${(0, import_utils2.escapeHtml)(val)}"` : "";
|
|
475
|
+
}).filter(Boolean).join(" ") : "";
|
|
476
|
+
const idAttr = id ? `id="${(0, import_utils2.escapeHtml)(id)}"` : "";
|
|
477
|
+
const nameAttr = name ? `name="${(0, import_utils2.escapeHtml)(name)}"` : "";
|
|
478
|
+
const valueAttr = value ? `value="${(0, import_utils2.escapeHtml)(value)}"` : "";
|
|
479
|
+
const disabledAttr = disabled || loading ? "disabled" : "";
|
|
480
|
+
const targetAttr = target ? `target="${(0, import_utils2.escapeHtml)(target)}"` : "";
|
|
481
|
+
const relAttr = target === "_blank" ? 'rel="noopener noreferrer"' : "";
|
|
482
|
+
const trimmedText = text.trim();
|
|
483
|
+
const effectiveAriaLabel = ariaLabel ?? (iconOnly && trimmedText ? trimmedText : void 0);
|
|
484
|
+
const ariaLabelAttr = effectiveAriaLabel ? `aria-label="${(0, import_utils2.escapeHtml)(effectiveAriaLabel)}"` : "";
|
|
485
|
+
const iconBeforeHtml = iconBefore && !loading ? `<span class="${iconOnly ? "" : "mr-2"}">${iconBefore}</span>` : "";
|
|
486
|
+
const iconAfterHtml = iconAfter && !loading ? `<span class="${iconOnly ? "" : "ml-2"}">${iconAfter}</span>` : "";
|
|
487
|
+
const loadingHtml = loading ? loadingSpinner : "";
|
|
488
|
+
const textHtml = iconOnly ? "" : (0, import_utils2.escapeHtml)(text);
|
|
489
|
+
const contentHtml = `${loadingHtml}${iconBeforeHtml}${textHtml}${iconAfterHtml}`;
|
|
490
|
+
if (href && !disabled && !loading && isValidHrefProtocol(href)) {
|
|
491
|
+
return `<a href="${(0, import_utils2.escapeHtml)(
|
|
492
|
+
href
|
|
493
|
+
)}" class="${baseClasses}" ${idAttr} ${dataAttrs} ${ariaLabelAttr} ${targetAttr} ${relAttr}>
|
|
494
|
+
${contentHtml}
|
|
495
|
+
</a>`;
|
|
496
|
+
}
|
|
497
|
+
return `<button type="${type}" class="${baseClasses}" ${idAttr} ${nameAttr} ${valueAttr} ${disabledAttr} ${dataAttrs} ${ariaLabelAttr}>
|
|
498
|
+
${contentHtml}
|
|
499
|
+
</button>`;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// libs/ui/src/web-components/elements/fmcp-button.ts
|
|
503
|
+
var FmcpButton = class extends FmcpElement {
|
|
504
|
+
config = {
|
|
505
|
+
name: "button",
|
|
506
|
+
schema: ButtonOptionsSchema,
|
|
507
|
+
defaults: {
|
|
508
|
+
variant: "primary",
|
|
509
|
+
size: "md",
|
|
510
|
+
type: "button"
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Attributes to observe for changes.
|
|
515
|
+
*/
|
|
516
|
+
static get observedAttributes() {
|
|
517
|
+
return getObservedAttributesFromSchema(ButtonOptionsSchema);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Render the button HTML using the button() function.
|
|
521
|
+
*/
|
|
522
|
+
renderHtml(options, content) {
|
|
523
|
+
return button(content, options);
|
|
524
|
+
}
|
|
525
|
+
// ============================================
|
|
526
|
+
// Property Setters (Individual Props)
|
|
527
|
+
// ============================================
|
|
528
|
+
set variant(value) {
|
|
529
|
+
this._options.variant = value;
|
|
530
|
+
this._scheduleRender();
|
|
531
|
+
}
|
|
532
|
+
get variant() {
|
|
533
|
+
return this._options.variant;
|
|
534
|
+
}
|
|
535
|
+
set size(value) {
|
|
536
|
+
this._options.size = value;
|
|
537
|
+
this._scheduleRender();
|
|
538
|
+
}
|
|
539
|
+
get size() {
|
|
540
|
+
return this._options.size;
|
|
541
|
+
}
|
|
542
|
+
set type(value) {
|
|
543
|
+
this._options.type = value;
|
|
544
|
+
this._scheduleRender();
|
|
545
|
+
}
|
|
546
|
+
get type() {
|
|
547
|
+
return this._options.type;
|
|
548
|
+
}
|
|
549
|
+
set disabled(value) {
|
|
550
|
+
this._options.disabled = value;
|
|
551
|
+
this._scheduleRender();
|
|
552
|
+
}
|
|
553
|
+
get disabled() {
|
|
554
|
+
return this._options.disabled ?? false;
|
|
555
|
+
}
|
|
556
|
+
set loading(value) {
|
|
557
|
+
this._options.loading = value;
|
|
558
|
+
this._scheduleRender();
|
|
559
|
+
}
|
|
560
|
+
get loading() {
|
|
561
|
+
return this._options.loading ?? false;
|
|
562
|
+
}
|
|
563
|
+
set fullWidth(value) {
|
|
564
|
+
this._options.fullWidth = value;
|
|
565
|
+
this._scheduleRender();
|
|
566
|
+
}
|
|
567
|
+
get fullWidth() {
|
|
568
|
+
return this._options.fullWidth ?? false;
|
|
569
|
+
}
|
|
570
|
+
set iconOnly(value) {
|
|
571
|
+
this._options.iconOnly = value;
|
|
572
|
+
this._scheduleRender();
|
|
573
|
+
}
|
|
574
|
+
get iconOnly() {
|
|
575
|
+
return this._options.iconOnly ?? false;
|
|
576
|
+
}
|
|
577
|
+
set iconBefore(value) {
|
|
578
|
+
this._options.iconBefore = value;
|
|
579
|
+
this._scheduleRender();
|
|
580
|
+
}
|
|
581
|
+
get iconBefore() {
|
|
582
|
+
return this._options.iconBefore;
|
|
583
|
+
}
|
|
584
|
+
set iconAfter(value) {
|
|
585
|
+
this._options.iconAfter = value;
|
|
586
|
+
this._scheduleRender();
|
|
587
|
+
}
|
|
588
|
+
get iconAfter() {
|
|
589
|
+
return this._options.iconAfter;
|
|
590
|
+
}
|
|
591
|
+
set href(value) {
|
|
592
|
+
this._options.href = value;
|
|
593
|
+
this._scheduleRender();
|
|
594
|
+
}
|
|
595
|
+
get href() {
|
|
596
|
+
return this._options.href;
|
|
597
|
+
}
|
|
598
|
+
set buttonAriaLabel(value) {
|
|
599
|
+
this._options.ariaLabel = value;
|
|
600
|
+
this._scheduleRender();
|
|
601
|
+
}
|
|
602
|
+
get buttonAriaLabel() {
|
|
603
|
+
return this._options.ariaLabel;
|
|
604
|
+
}
|
|
605
|
+
// ============================================
|
|
606
|
+
// Event Forwarding
|
|
607
|
+
// ============================================
|
|
608
|
+
connectedCallback() {
|
|
609
|
+
super.connectedCallback();
|
|
610
|
+
this.addEventListener("click", this._handleClick.bind(this));
|
|
611
|
+
}
|
|
612
|
+
_handleClick(e) {
|
|
613
|
+
const innerButton = this.getInnerElement();
|
|
614
|
+
if (innerButton && (e.target === innerButton || innerButton.contains(e.target))) {
|
|
615
|
+
this.dispatchEvent(
|
|
616
|
+
new CustomEvent("fmcp:click", {
|
|
617
|
+
bubbles: true,
|
|
618
|
+
detail: { options: this.options }
|
|
619
|
+
})
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
// ============================================
|
|
624
|
+
// Public API
|
|
625
|
+
// ============================================
|
|
626
|
+
/**
|
|
627
|
+
* Focus the inner button element.
|
|
628
|
+
*/
|
|
629
|
+
focus() {
|
|
630
|
+
const inner = this.getInnerElement();
|
|
631
|
+
inner?.focus();
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Blur the inner button element.
|
|
635
|
+
*/
|
|
636
|
+
blur() {
|
|
637
|
+
const inner = this.getInnerElement();
|
|
638
|
+
inner?.blur();
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Click the inner button programmatically.
|
|
642
|
+
*/
|
|
643
|
+
click() {
|
|
644
|
+
const inner = this.getInnerElement();
|
|
645
|
+
inner?.click();
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
function registerFmcpButton() {
|
|
649
|
+
if (typeof customElements !== "undefined" && !customElements.get("fmcp-button")) {
|
|
650
|
+
customElements.define("fmcp-button", FmcpButton);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// libs/ui/src/components/card.ts
|
|
655
|
+
function getVariantClasses2(variant) {
|
|
656
|
+
const variants = {
|
|
657
|
+
default: "bg-white border border-border rounded-xl shadow-sm",
|
|
658
|
+
outlined: "bg-transparent border-2 border-border rounded-xl",
|
|
659
|
+
elevated: "bg-white rounded-xl shadow-lg",
|
|
660
|
+
filled: "bg-gray-50 rounded-xl",
|
|
661
|
+
ghost: "bg-transparent"
|
|
662
|
+
};
|
|
663
|
+
return variants[variant];
|
|
664
|
+
}
|
|
665
|
+
function getSizeClasses2(size) {
|
|
666
|
+
const sizes = {
|
|
667
|
+
sm: "p-4",
|
|
668
|
+
md: "p-6",
|
|
669
|
+
lg: "p-8"
|
|
670
|
+
};
|
|
671
|
+
return sizes[size];
|
|
672
|
+
}
|
|
673
|
+
function buildDataAttrs(data) {
|
|
674
|
+
if (!data) return "";
|
|
675
|
+
return Object.entries(data).map(([key, value]) => `data-${key}="${(0, import_utils2.escapeHtml)(value)}"`).join(" ");
|
|
676
|
+
}
|
|
677
|
+
function card(content, options = {}) {
|
|
678
|
+
const {
|
|
679
|
+
variant = "default",
|
|
680
|
+
size = "md",
|
|
681
|
+
title,
|
|
682
|
+
subtitle,
|
|
683
|
+
headerActions,
|
|
684
|
+
footer,
|
|
685
|
+
className = "",
|
|
686
|
+
id,
|
|
687
|
+
data,
|
|
688
|
+
clickable = false,
|
|
689
|
+
href
|
|
690
|
+
} = options;
|
|
691
|
+
const variantClasses = getVariantClasses2(variant);
|
|
692
|
+
const sizeClasses = getSizeClasses2(size);
|
|
693
|
+
const clickableClasses = clickable ? "cursor-pointer hover:shadow-md transition-shadow" : "";
|
|
694
|
+
const allClasses = [variantClasses, sizeClasses, clickableClasses, className].filter(Boolean).join(" ");
|
|
695
|
+
const dataAttrs = buildDataAttrs(data);
|
|
696
|
+
const idAttr = id ? `id="${(0, import_utils2.escapeHtml)(id)}"` : "";
|
|
697
|
+
const hasHeader = title || subtitle || headerActions;
|
|
698
|
+
const headerHtml = hasHeader ? `<div class="flex items-start justify-between mb-4">
|
|
699
|
+
<div>
|
|
700
|
+
${title ? `<h3 class="text-lg font-semibold text-text-primary">${(0, import_utils2.escapeHtml)(title)}</h3>` : ""}
|
|
701
|
+
${subtitle ? `<p class="text-sm text-text-secondary mt-1">${(0, import_utils2.escapeHtml)(subtitle)}</p>` : ""}
|
|
702
|
+
</div>
|
|
703
|
+
${headerActions ? `<div class="flex items-center gap-2">${headerActions}</div>` : ""}
|
|
704
|
+
</div>` : "";
|
|
705
|
+
const footerHtml = footer ? `<div class="mt-4 pt-4 border-t border-divider">${footer}</div>` : "";
|
|
706
|
+
if (href) {
|
|
707
|
+
return `<a href="${(0, import_utils2.escapeHtml)(href)}" class="${allClasses}" ${idAttr} ${dataAttrs}>
|
|
708
|
+
${headerHtml}
|
|
709
|
+
${content}
|
|
710
|
+
${footerHtml}
|
|
711
|
+
</a>`;
|
|
712
|
+
}
|
|
713
|
+
return `<div class="${allClasses}" ${idAttr} ${dataAttrs}>
|
|
714
|
+
${headerHtml}
|
|
715
|
+
${content}
|
|
716
|
+
${footerHtml}
|
|
717
|
+
</div>`;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// libs/ui/src/components/card.schema.ts
|
|
721
|
+
var import_zod2 = require("zod");
|
|
722
|
+
var CardVariantSchema = import_zod2.z.enum(["default", "outlined", "elevated", "filled", "ghost"]);
|
|
723
|
+
var CardSizeSchema = import_zod2.z.enum(["sm", "md", "lg"]);
|
|
724
|
+
var CardOptionsSchema = import_zod2.z.object({
|
|
725
|
+
/** Card variant */
|
|
726
|
+
variant: CardVariantSchema.optional(),
|
|
727
|
+
/** Card size (padding) */
|
|
728
|
+
size: CardSizeSchema.optional(),
|
|
729
|
+
/** Card title */
|
|
730
|
+
title: import_zod2.z.string().optional(),
|
|
731
|
+
/** Card subtitle/description */
|
|
732
|
+
subtitle: import_zod2.z.string().optional(),
|
|
733
|
+
/** Header actions (HTML string) */
|
|
734
|
+
headerActions: import_zod2.z.string().optional(),
|
|
735
|
+
/** Footer content (HTML string) */
|
|
736
|
+
footer: import_zod2.z.string().optional(),
|
|
737
|
+
/** Additional CSS classes */
|
|
738
|
+
className: import_zod2.z.string().optional(),
|
|
739
|
+
/** Card ID */
|
|
740
|
+
id: import_zod2.z.string().optional(),
|
|
741
|
+
/** Data attributes */
|
|
742
|
+
data: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
743
|
+
/** Clickable card (adds hover effects) */
|
|
744
|
+
clickable: import_zod2.z.boolean().optional(),
|
|
745
|
+
/** Click handler URL */
|
|
746
|
+
href: import_zod2.z.string().optional()
|
|
747
|
+
}).strict();
|
|
748
|
+
var CardGroupOptionsSchema = import_zod2.z.object({
|
|
749
|
+
/** Direction */
|
|
750
|
+
direction: import_zod2.z.enum(["horizontal", "vertical"]).optional(),
|
|
751
|
+
/** Gap between cards */
|
|
752
|
+
gap: import_zod2.z.enum(["sm", "md", "lg"]).optional(),
|
|
753
|
+
/** Additional CSS classes */
|
|
754
|
+
className: import_zod2.z.string().optional()
|
|
755
|
+
}).strict();
|
|
756
|
+
|
|
757
|
+
// libs/ui/src/web-components/elements/fmcp-card.ts
|
|
758
|
+
var FmcpCard = class extends FmcpElement {
|
|
759
|
+
config = {
|
|
760
|
+
name: "card",
|
|
761
|
+
schema: CardOptionsSchema,
|
|
762
|
+
defaults: {
|
|
763
|
+
variant: "default",
|
|
764
|
+
size: "md"
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
static get observedAttributes() {
|
|
768
|
+
return getObservedAttributesFromSchema(CardOptionsSchema);
|
|
769
|
+
}
|
|
770
|
+
renderHtml(options, content) {
|
|
771
|
+
return card(content, options);
|
|
772
|
+
}
|
|
773
|
+
// Property setters
|
|
774
|
+
set variant(value) {
|
|
775
|
+
this._options.variant = value;
|
|
776
|
+
this._scheduleRender();
|
|
777
|
+
}
|
|
778
|
+
get variant() {
|
|
779
|
+
return this._options.variant;
|
|
780
|
+
}
|
|
781
|
+
set size(value) {
|
|
782
|
+
this._options.size = value;
|
|
783
|
+
this._scheduleRender();
|
|
784
|
+
}
|
|
785
|
+
get size() {
|
|
786
|
+
return this._options.size;
|
|
787
|
+
}
|
|
788
|
+
set cardTitle(value) {
|
|
789
|
+
this._options.title = value;
|
|
790
|
+
this._scheduleRender();
|
|
791
|
+
}
|
|
792
|
+
get cardTitle() {
|
|
793
|
+
return this._options.title;
|
|
794
|
+
}
|
|
795
|
+
set subtitle(value) {
|
|
796
|
+
this._options.subtitle = value;
|
|
797
|
+
this._scheduleRender();
|
|
798
|
+
}
|
|
799
|
+
get subtitle() {
|
|
800
|
+
return this._options.subtitle;
|
|
801
|
+
}
|
|
802
|
+
set clickable(value) {
|
|
803
|
+
this._options.clickable = value;
|
|
804
|
+
this._scheduleRender();
|
|
805
|
+
}
|
|
806
|
+
get clickable() {
|
|
807
|
+
return this._options.clickable ?? false;
|
|
808
|
+
}
|
|
809
|
+
set href(value) {
|
|
810
|
+
this._options.href = value;
|
|
811
|
+
this._scheduleRender();
|
|
812
|
+
}
|
|
813
|
+
get href() {
|
|
814
|
+
return this._options.href;
|
|
815
|
+
}
|
|
816
|
+
set footer(value) {
|
|
817
|
+
this._options.footer = value;
|
|
818
|
+
this._scheduleRender();
|
|
819
|
+
}
|
|
820
|
+
get footer() {
|
|
821
|
+
return this._options.footer;
|
|
822
|
+
}
|
|
823
|
+
set headerActions(value) {
|
|
824
|
+
this._options.headerActions = value;
|
|
825
|
+
this._scheduleRender();
|
|
826
|
+
}
|
|
827
|
+
get headerActions() {
|
|
828
|
+
return this._options.headerActions;
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
function registerFmcpCard() {
|
|
832
|
+
if (typeof customElements !== "undefined" && !customElements.get("fmcp-card")) {
|
|
833
|
+
customElements.define("fmcp-card", FmcpCard);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// libs/ui/src/components/alert.ts
|
|
838
|
+
var alertIcons = {
|
|
839
|
+
info: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
840
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
841
|
+
</svg>`,
|
|
842
|
+
success: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
843
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
844
|
+
</svg>`,
|
|
845
|
+
warning: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
846
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
|
847
|
+
</svg>`,
|
|
848
|
+
danger: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
849
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
850
|
+
</svg>`,
|
|
851
|
+
neutral: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
852
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
853
|
+
</svg>`
|
|
854
|
+
};
|
|
855
|
+
function getVariantClasses3(variant) {
|
|
856
|
+
const variants = {
|
|
857
|
+
info: {
|
|
858
|
+
container: "bg-blue-50 border-blue-200 text-blue-800",
|
|
859
|
+
icon: "text-blue-500"
|
|
860
|
+
},
|
|
861
|
+
success: {
|
|
862
|
+
container: "bg-success/10 border-success/30 text-success",
|
|
863
|
+
icon: "text-success"
|
|
864
|
+
},
|
|
865
|
+
warning: {
|
|
866
|
+
container: "bg-warning/10 border-warning/30 text-warning",
|
|
867
|
+
icon: "text-warning"
|
|
868
|
+
},
|
|
869
|
+
danger: {
|
|
870
|
+
container: "bg-danger/10 border-danger/30 text-danger",
|
|
871
|
+
icon: "text-danger"
|
|
872
|
+
},
|
|
873
|
+
neutral: {
|
|
874
|
+
container: "bg-gray-50 border-gray-200 text-gray-800",
|
|
875
|
+
icon: "text-gray-500"
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
return variants[variant];
|
|
879
|
+
}
|
|
880
|
+
function alert(message, options = {}) {
|
|
881
|
+
const { variant = "info", title, showIcon = true, icon, dismissible = false, className = "", id, actions } = options;
|
|
882
|
+
const variantClasses = getVariantClasses3(variant);
|
|
883
|
+
const baseClasses = ["rounded-lg border p-4", variantClasses.container, className].filter(Boolean).join(" ");
|
|
884
|
+
const iconHtml = showIcon ? `<div class="flex-shrink-0 ${variantClasses.icon}">
|
|
885
|
+
${icon || alertIcons[variant]}
|
|
886
|
+
</div>` : "";
|
|
887
|
+
const titleHtml = title ? `<h3 class="font-semibold">${(0, import_utils2.escapeHtml)(title)}</h3>` : "";
|
|
888
|
+
const dismissHtml = dismissible ? `<button
|
|
889
|
+
type="button"
|
|
890
|
+
class="flex-shrink-0 ml-auto -mr-1 -mt-1 p-1 rounded hover:bg-black/5 transition-colors"
|
|
891
|
+
onclick="this.closest('.alert').remove()"
|
|
892
|
+
aria-label="Dismiss"
|
|
893
|
+
>
|
|
894
|
+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
895
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
|
896
|
+
</svg>
|
|
897
|
+
</button>` : "";
|
|
898
|
+
const actionsHtml = actions ? `<div class="mt-3">${actions}</div>` : "";
|
|
899
|
+
const idAttr = id ? `id="${(0, import_utils2.escapeHtml)(id)}"` : "";
|
|
900
|
+
return `<div class="alert ${baseClasses}" role="alert" ${idAttr}>
|
|
901
|
+
<div class="flex gap-3">
|
|
902
|
+
${iconHtml}
|
|
903
|
+
<div class="flex-1">
|
|
904
|
+
${titleHtml}
|
|
905
|
+
<div class="${title ? "mt-1" : ""}">${(0, import_utils2.escapeHtml)(message)}</div>
|
|
906
|
+
${actionsHtml}
|
|
907
|
+
</div>
|
|
908
|
+
${dismissHtml}
|
|
909
|
+
</div>
|
|
910
|
+
</div>`;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
// libs/ui/src/components/alert.schema.ts
|
|
914
|
+
var import_zod3 = require("zod");
|
|
915
|
+
var AlertVariantSchema = import_zod3.z.enum(["info", "success", "warning", "danger", "neutral"]);
|
|
916
|
+
var AlertOptionsSchema = import_zod3.z.object({
|
|
917
|
+
/** Alert variant */
|
|
918
|
+
variant: AlertVariantSchema.optional(),
|
|
919
|
+
/** Alert title */
|
|
920
|
+
title: import_zod3.z.string().optional(),
|
|
921
|
+
/** Show icon */
|
|
922
|
+
showIcon: import_zod3.z.boolean().optional(),
|
|
923
|
+
/** Custom icon (HTML string, overrides default) */
|
|
924
|
+
icon: import_zod3.z.string().optional(),
|
|
925
|
+
/** Dismissible alert */
|
|
926
|
+
dismissible: import_zod3.z.boolean().optional(),
|
|
927
|
+
/** Additional CSS classes */
|
|
928
|
+
className: import_zod3.z.string().optional(),
|
|
929
|
+
/** Alert ID */
|
|
930
|
+
id: import_zod3.z.string().optional(),
|
|
931
|
+
/** Actions (HTML string for buttons) */
|
|
932
|
+
actions: import_zod3.z.string().optional()
|
|
933
|
+
}).strict();
|
|
934
|
+
var ToastPositionSchema = import_zod3.z.enum([
|
|
935
|
+
"top-right",
|
|
936
|
+
"top-left",
|
|
937
|
+
"bottom-right",
|
|
938
|
+
"bottom-left",
|
|
939
|
+
"top-center",
|
|
940
|
+
"bottom-center"
|
|
941
|
+
]);
|
|
942
|
+
var ToastOptionsSchema = import_zod3.z.object({
|
|
943
|
+
/** Toast variant */
|
|
944
|
+
variant: AlertVariantSchema.optional(),
|
|
945
|
+
/** Toast title */
|
|
946
|
+
title: import_zod3.z.string().optional(),
|
|
947
|
+
/** Duration in ms (0 = no auto-dismiss) */
|
|
948
|
+
duration: import_zod3.z.number().min(0).optional(),
|
|
949
|
+
/** Position */
|
|
950
|
+
position: ToastPositionSchema.optional(),
|
|
951
|
+
/** Toast ID */
|
|
952
|
+
id: import_zod3.z.string().optional()
|
|
953
|
+
}).strict();
|
|
954
|
+
|
|
955
|
+
// libs/ui/src/web-components/elements/fmcp-alert.ts
|
|
956
|
+
var FmcpAlert = class extends FmcpElement {
|
|
957
|
+
config = {
|
|
958
|
+
name: "alert",
|
|
959
|
+
schema: AlertOptionsSchema,
|
|
960
|
+
defaults: {
|
|
961
|
+
variant: "info",
|
|
962
|
+
showIcon: true
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
static get observedAttributes() {
|
|
966
|
+
return getObservedAttributesFromSchema(AlertOptionsSchema);
|
|
967
|
+
}
|
|
968
|
+
renderHtml(options, content) {
|
|
969
|
+
return alert(content, options);
|
|
970
|
+
}
|
|
971
|
+
// Property setters
|
|
972
|
+
set variant(value) {
|
|
973
|
+
this._options.variant = value;
|
|
974
|
+
this._scheduleRender();
|
|
975
|
+
}
|
|
976
|
+
get variant() {
|
|
977
|
+
return this._options.variant;
|
|
978
|
+
}
|
|
979
|
+
set alertTitle(value) {
|
|
980
|
+
this._options.title = value;
|
|
981
|
+
this._scheduleRender();
|
|
982
|
+
}
|
|
983
|
+
get alertTitle() {
|
|
984
|
+
return this._options.title;
|
|
985
|
+
}
|
|
986
|
+
set showIcon(value) {
|
|
987
|
+
this._options.showIcon = value;
|
|
988
|
+
this._scheduleRender();
|
|
989
|
+
}
|
|
990
|
+
get showIcon() {
|
|
991
|
+
return this._options.showIcon ?? true;
|
|
992
|
+
}
|
|
993
|
+
set dismissible(value) {
|
|
994
|
+
this._options.dismissible = value;
|
|
995
|
+
this._scheduleRender();
|
|
996
|
+
}
|
|
997
|
+
get dismissible() {
|
|
998
|
+
return this._options.dismissible ?? false;
|
|
999
|
+
}
|
|
1000
|
+
set actions(value) {
|
|
1001
|
+
this._options.actions = value;
|
|
1002
|
+
this._scheduleRender();
|
|
1003
|
+
}
|
|
1004
|
+
get actions() {
|
|
1005
|
+
return this._options.actions;
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
function registerFmcpAlert() {
|
|
1009
|
+
if (typeof customElements !== "undefined" && !customElements.get("fmcp-alert")) {
|
|
1010
|
+
customElements.define("fmcp-alert", FmcpAlert);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// libs/ui/src/components/badge.ts
|
|
1015
|
+
function getVariantClasses4(variant) {
|
|
1016
|
+
const variants = {
|
|
1017
|
+
default: "bg-gray-100 text-gray-800",
|
|
1018
|
+
primary: "bg-primary/10 text-primary",
|
|
1019
|
+
secondary: "bg-secondary/10 text-secondary",
|
|
1020
|
+
success: "bg-success/10 text-success",
|
|
1021
|
+
warning: "bg-warning/10 text-warning",
|
|
1022
|
+
danger: "bg-danger/10 text-danger",
|
|
1023
|
+
info: "bg-blue-100 text-blue-800",
|
|
1024
|
+
outline: "border border-border text-text-primary bg-transparent"
|
|
1025
|
+
};
|
|
1026
|
+
return variants[variant];
|
|
1027
|
+
}
|
|
1028
|
+
function getSizeClasses3(size, dot) {
|
|
1029
|
+
if (dot) {
|
|
1030
|
+
const dotSizes = {
|
|
1031
|
+
sm: "w-2 h-2",
|
|
1032
|
+
md: "w-2.5 h-2.5",
|
|
1033
|
+
lg: "w-3 h-3"
|
|
1034
|
+
};
|
|
1035
|
+
return dotSizes[size];
|
|
1036
|
+
}
|
|
1037
|
+
const sizes = {
|
|
1038
|
+
sm: "px-2 py-0.5 text-xs",
|
|
1039
|
+
md: "px-2.5 py-1 text-xs",
|
|
1040
|
+
lg: "px-3 py-1.5 text-sm"
|
|
1041
|
+
};
|
|
1042
|
+
return sizes[size];
|
|
1043
|
+
}
|
|
1044
|
+
function badge(text, options = {}) {
|
|
1045
|
+
const {
|
|
1046
|
+
variant = "default",
|
|
1047
|
+
size = "md",
|
|
1048
|
+
pill = false,
|
|
1049
|
+
icon,
|
|
1050
|
+
dot = false,
|
|
1051
|
+
className = "",
|
|
1052
|
+
removable = false
|
|
1053
|
+
} = options;
|
|
1054
|
+
if (dot) {
|
|
1055
|
+
const dotVariants = {
|
|
1056
|
+
default: "bg-gray-400",
|
|
1057
|
+
primary: "bg-primary",
|
|
1058
|
+
secondary: "bg-secondary",
|
|
1059
|
+
success: "bg-success",
|
|
1060
|
+
warning: "bg-warning",
|
|
1061
|
+
danger: "bg-danger",
|
|
1062
|
+
info: "bg-blue-500",
|
|
1063
|
+
outline: "border border-current"
|
|
1064
|
+
};
|
|
1065
|
+
const dotClasses = ["inline-block rounded-full", getSizeClasses3(size, true), dotVariants[variant], className].filter(Boolean).join(" ");
|
|
1066
|
+
return `<span class="${dotClasses}" aria-label="${(0, import_utils2.escapeHtml)(text)}" title="${(0, import_utils2.escapeHtml)(text)}"></span>`;
|
|
1067
|
+
}
|
|
1068
|
+
const variantClasses = getVariantClasses4(variant);
|
|
1069
|
+
const sizeClasses = getSizeClasses3(size, false);
|
|
1070
|
+
const baseClasses = [
|
|
1071
|
+
"inline-flex items-center font-medium",
|
|
1072
|
+
pill ? "rounded-full" : "rounded-md",
|
|
1073
|
+
variantClasses,
|
|
1074
|
+
sizeClasses,
|
|
1075
|
+
className
|
|
1076
|
+
].filter(Boolean).join(" ");
|
|
1077
|
+
const iconHtml = icon ? `<span class="mr-1">${icon}</span>` : "";
|
|
1078
|
+
const removeHtml = removable ? `<button
|
|
1079
|
+
type="button"
|
|
1080
|
+
class="ml-1.5 -mr-1 hover:opacity-70 transition-opacity"
|
|
1081
|
+
onclick="this.parentElement.remove()"
|
|
1082
|
+
aria-label="Remove"
|
|
1083
|
+
>
|
|
1084
|
+
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
1085
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
|
1086
|
+
</svg>
|
|
1087
|
+
</button>` : "";
|
|
1088
|
+
return `<span class="${baseClasses}">
|
|
1089
|
+
${iconHtml}${(0, import_utils2.escapeHtml)(text)}${removeHtml}
|
|
1090
|
+
</span>`;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
// libs/ui/src/components/badge.schema.ts
|
|
1094
|
+
var import_zod4 = require("zod");
|
|
1095
|
+
var BadgeVariantSchema = import_zod4.z.enum([
|
|
1096
|
+
"default",
|
|
1097
|
+
"primary",
|
|
1098
|
+
"secondary",
|
|
1099
|
+
"success",
|
|
1100
|
+
"warning",
|
|
1101
|
+
"danger",
|
|
1102
|
+
"info",
|
|
1103
|
+
"outline"
|
|
1104
|
+
]);
|
|
1105
|
+
var BadgeSizeSchema = import_zod4.z.enum(["sm", "md", "lg"]);
|
|
1106
|
+
var BadgeOptionsSchema = import_zod4.z.object({
|
|
1107
|
+
/** Badge variant */
|
|
1108
|
+
variant: BadgeVariantSchema.optional(),
|
|
1109
|
+
/** Badge size */
|
|
1110
|
+
size: BadgeSizeSchema.optional(),
|
|
1111
|
+
/** Rounded pill style */
|
|
1112
|
+
pill: import_zod4.z.boolean().optional(),
|
|
1113
|
+
/** Icon before text (HTML string) */
|
|
1114
|
+
icon: import_zod4.z.string().optional(),
|
|
1115
|
+
/** Dot indicator (no text) */
|
|
1116
|
+
dot: import_zod4.z.boolean().optional(),
|
|
1117
|
+
/** Additional CSS classes */
|
|
1118
|
+
className: import_zod4.z.string().optional(),
|
|
1119
|
+
/** Removable badge */
|
|
1120
|
+
removable: import_zod4.z.boolean().optional()
|
|
1121
|
+
}).strict();
|
|
1122
|
+
var BadgeGroupOptionsSchema = import_zod4.z.object({
|
|
1123
|
+
/** Gap between badges */
|
|
1124
|
+
gap: import_zod4.z.enum(["sm", "md", "lg"]).optional(),
|
|
1125
|
+
/** Additional CSS classes */
|
|
1126
|
+
className: import_zod4.z.string().optional()
|
|
1127
|
+
}).strict();
|
|
1128
|
+
|
|
1129
|
+
// libs/ui/src/web-components/elements/fmcp-badge.ts
|
|
1130
|
+
var FmcpBadge = class extends FmcpElement {
|
|
1131
|
+
config = {
|
|
1132
|
+
name: "badge",
|
|
1133
|
+
schema: BadgeOptionsSchema,
|
|
1134
|
+
defaults: {
|
|
1135
|
+
variant: "default",
|
|
1136
|
+
size: "md"
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
static get observedAttributes() {
|
|
1140
|
+
return getObservedAttributesFromSchema(BadgeOptionsSchema);
|
|
1141
|
+
}
|
|
1142
|
+
renderHtml(options, content) {
|
|
1143
|
+
return badge(content, options);
|
|
1144
|
+
}
|
|
1145
|
+
// Property setters
|
|
1146
|
+
set variant(value) {
|
|
1147
|
+
this._options.variant = value;
|
|
1148
|
+
this._scheduleRender();
|
|
1149
|
+
}
|
|
1150
|
+
get variant() {
|
|
1151
|
+
return this._options.variant;
|
|
1152
|
+
}
|
|
1153
|
+
set size(value) {
|
|
1154
|
+
this._options.size = value;
|
|
1155
|
+
this._scheduleRender();
|
|
1156
|
+
}
|
|
1157
|
+
get size() {
|
|
1158
|
+
return this._options.size;
|
|
1159
|
+
}
|
|
1160
|
+
set pill(value) {
|
|
1161
|
+
this._options.pill = value;
|
|
1162
|
+
this._scheduleRender();
|
|
1163
|
+
}
|
|
1164
|
+
get pill() {
|
|
1165
|
+
return this._options.pill ?? false;
|
|
1166
|
+
}
|
|
1167
|
+
set dot(value) {
|
|
1168
|
+
this._options.dot = value;
|
|
1169
|
+
this._scheduleRender();
|
|
1170
|
+
}
|
|
1171
|
+
get dot() {
|
|
1172
|
+
return this._options.dot ?? false;
|
|
1173
|
+
}
|
|
1174
|
+
set removable(value) {
|
|
1175
|
+
this._options.removable = value;
|
|
1176
|
+
this._scheduleRender();
|
|
1177
|
+
}
|
|
1178
|
+
get removable() {
|
|
1179
|
+
return this._options.removable ?? false;
|
|
1180
|
+
}
|
|
1181
|
+
set icon(value) {
|
|
1182
|
+
this._options.icon = value;
|
|
1183
|
+
this._scheduleRender();
|
|
1184
|
+
}
|
|
1185
|
+
get icon() {
|
|
1186
|
+
return this._options.icon;
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
function registerFmcpBadge() {
|
|
1190
|
+
if (typeof customElements !== "undefined" && !customElements.get("fmcp-badge")) {
|
|
1191
|
+
customElements.define("fmcp-badge", FmcpBadge);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
// libs/ui/src/components/form.ts
|
|
1196
|
+
function getInputSizeClasses(size) {
|
|
1197
|
+
const sizes = {
|
|
1198
|
+
sm: "px-3 py-1.5 text-sm",
|
|
1199
|
+
md: "px-4 py-2.5 text-sm",
|
|
1200
|
+
lg: "px-5 py-3 text-base"
|
|
1201
|
+
};
|
|
1202
|
+
return sizes[size];
|
|
1203
|
+
}
|
|
1204
|
+
function getInputStateClasses(state) {
|
|
1205
|
+
const states = {
|
|
1206
|
+
default: "border-border focus:border-primary focus:ring-primary/20",
|
|
1207
|
+
error: "border-danger focus:border-danger focus:ring-danger/20",
|
|
1208
|
+
success: "border-success focus:border-success focus:ring-success/20",
|
|
1209
|
+
warning: "border-warning focus:border-warning focus:ring-warning/20"
|
|
1210
|
+
};
|
|
1211
|
+
return states[state];
|
|
1212
|
+
}
|
|
1213
|
+
function buildDataAttrs2(data) {
|
|
1214
|
+
if (!data) return "";
|
|
1215
|
+
return Object.entries(data).map(([key, value]) => `data-${key}="${(0, import_utils2.escapeHtml)(value)}"`).join(" ");
|
|
1216
|
+
}
|
|
1217
|
+
function input(options) {
|
|
1218
|
+
const {
|
|
1219
|
+
type = "text",
|
|
1220
|
+
name,
|
|
1221
|
+
id = name,
|
|
1222
|
+
value = "",
|
|
1223
|
+
placeholder = "",
|
|
1224
|
+
label,
|
|
1225
|
+
helper,
|
|
1226
|
+
error,
|
|
1227
|
+
size = "md",
|
|
1228
|
+
state = error ? "error" : "default",
|
|
1229
|
+
required = false,
|
|
1230
|
+
disabled = false,
|
|
1231
|
+
readonly = false,
|
|
1232
|
+
autocomplete,
|
|
1233
|
+
pattern,
|
|
1234
|
+
min,
|
|
1235
|
+
max,
|
|
1236
|
+
step,
|
|
1237
|
+
className = "",
|
|
1238
|
+
data,
|
|
1239
|
+
iconBefore,
|
|
1240
|
+
iconAfter
|
|
1241
|
+
} = options;
|
|
1242
|
+
const sizeClasses = getInputSizeClasses(size);
|
|
1243
|
+
const stateClasses = getInputStateClasses(state);
|
|
1244
|
+
const hasIcon = iconBefore || iconAfter;
|
|
1245
|
+
const baseClasses = [
|
|
1246
|
+
"w-full rounded-lg border bg-white",
|
|
1247
|
+
"transition-colors duration-200",
|
|
1248
|
+
"focus:outline-none focus:ring-2",
|
|
1249
|
+
disabled ? "opacity-50 cursor-not-allowed bg-gray-50" : "",
|
|
1250
|
+
sizeClasses,
|
|
1251
|
+
stateClasses,
|
|
1252
|
+
hasIcon ? (iconBefore ? "pl-10" : "") + (iconAfter ? " pr-10" : "") : "",
|
|
1253
|
+
className
|
|
1254
|
+
].filter(Boolean).join(" ");
|
|
1255
|
+
const dataAttrs = buildDataAttrs2(data);
|
|
1256
|
+
const inputAttrs = [
|
|
1257
|
+
`type="${type}"`,
|
|
1258
|
+
`name="${(0, import_utils2.escapeHtml)(name)}"`,
|
|
1259
|
+
`id="${(0, import_utils2.escapeHtml)(id)}"`,
|
|
1260
|
+
value ? `value="${(0, import_utils2.escapeHtml)(value)}"` : "",
|
|
1261
|
+
placeholder ? `placeholder="${(0, import_utils2.escapeHtml)(placeholder)}"` : "",
|
|
1262
|
+
required ? "required" : "",
|
|
1263
|
+
disabled ? "disabled" : "",
|
|
1264
|
+
readonly ? "readonly" : "",
|
|
1265
|
+
autocomplete ? `autocomplete="${(0, import_utils2.escapeHtml)(autocomplete)}"` : "",
|
|
1266
|
+
pattern ? `pattern="${(0, import_utils2.escapeHtml)(pattern)}"` : "",
|
|
1267
|
+
min !== void 0 ? `min="${(0, import_utils2.escapeHtml)(String(min))}"` : "",
|
|
1268
|
+
max !== void 0 ? `max="${(0, import_utils2.escapeHtml)(String(max))}"` : "",
|
|
1269
|
+
step !== void 0 ? `step="${(0, import_utils2.escapeHtml)(String(step))}"` : "",
|
|
1270
|
+
`class="${baseClasses}"`,
|
|
1271
|
+
dataAttrs
|
|
1272
|
+
].filter(Boolean).join(" ");
|
|
1273
|
+
const labelHtml = label ? `<label for="${(0, import_utils2.escapeHtml)(id)}" class="block text-sm font-medium text-text-primary mb-1.5">
|
|
1274
|
+
${(0, import_utils2.escapeHtml)(label)}${required ? '<span class="text-danger ml-1">*</span>' : ""}
|
|
1275
|
+
</label>` : "";
|
|
1276
|
+
const helperHtml = helper && !error ? `<p class="mt-1.5 text-sm text-text-secondary">${(0, import_utils2.escapeHtml)(helper)}</p>` : "";
|
|
1277
|
+
const errorHtml = error ? `<p class="mt-1.5 text-sm text-danger">${(0, import_utils2.escapeHtml)(error)}</p>` : "";
|
|
1278
|
+
const iconBeforeHtml = iconBefore ? `<span class="absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary">${iconBefore}</span>` : "";
|
|
1279
|
+
const iconAfterHtml = iconAfter ? `<span class="absolute right-3 top-1/2 -translate-y-1/2 text-text-secondary">${iconAfter}</span>` : "";
|
|
1280
|
+
const inputHtml = hasIcon ? `<div class="relative">
|
|
1281
|
+
${iconBeforeHtml}
|
|
1282
|
+
<input ${inputAttrs}>
|
|
1283
|
+
${iconAfterHtml}
|
|
1284
|
+
</div>` : `<input ${inputAttrs}>`;
|
|
1285
|
+
return `<div class="form-field">
|
|
1286
|
+
${labelHtml}
|
|
1287
|
+
${inputHtml}
|
|
1288
|
+
${helperHtml}
|
|
1289
|
+
${errorHtml}
|
|
1290
|
+
</div>`;
|
|
1291
|
+
}
|
|
1292
|
+
function select(options) {
|
|
1293
|
+
const {
|
|
1294
|
+
name,
|
|
1295
|
+
id = name,
|
|
1296
|
+
options: selectOptions,
|
|
1297
|
+
value,
|
|
1298
|
+
label,
|
|
1299
|
+
helper,
|
|
1300
|
+
error,
|
|
1301
|
+
size = "md",
|
|
1302
|
+
state = error ? "error" : "default",
|
|
1303
|
+
required = false,
|
|
1304
|
+
disabled = false,
|
|
1305
|
+
multiple = false,
|
|
1306
|
+
className = "",
|
|
1307
|
+
data
|
|
1308
|
+
} = options;
|
|
1309
|
+
const sizeClasses = getInputSizeClasses(size);
|
|
1310
|
+
const stateClasses = getInputStateClasses(state);
|
|
1311
|
+
const baseClasses = [
|
|
1312
|
+
"w-full rounded-lg border bg-white",
|
|
1313
|
+
"transition-colors duration-200",
|
|
1314
|
+
"focus:outline-none focus:ring-2",
|
|
1315
|
+
disabled ? "opacity-50 cursor-not-allowed bg-gray-50" : "",
|
|
1316
|
+
sizeClasses,
|
|
1317
|
+
stateClasses,
|
|
1318
|
+
className
|
|
1319
|
+
].filter(Boolean).join(" ");
|
|
1320
|
+
const dataAttrs = buildDataAttrs2(data);
|
|
1321
|
+
const optionsHtml = selectOptions.map((opt) => {
|
|
1322
|
+
const selected = opt.selected || opt.value === value ? "selected" : "";
|
|
1323
|
+
const optDisabled = opt.disabled ? "disabled" : "";
|
|
1324
|
+
return `<option value="${(0, import_utils2.escapeHtml)(opt.value)}" ${selected} ${optDisabled}>${(0, import_utils2.escapeHtml)(opt.label)}</option>`;
|
|
1325
|
+
}).join("\n");
|
|
1326
|
+
const labelHtml = label ? `<label for="${(0, import_utils2.escapeHtml)(id)}" class="block text-sm font-medium text-text-primary mb-1.5">
|
|
1327
|
+
${(0, import_utils2.escapeHtml)(label)}${required ? '<span class="text-danger ml-1">*</span>' : ""}
|
|
1328
|
+
</label>` : "";
|
|
1329
|
+
const helperHtml = helper && !error ? `<p class="mt-1.5 text-sm text-text-secondary">${(0, import_utils2.escapeHtml)(helper)}</p>` : "";
|
|
1330
|
+
const errorHtml = error ? `<p class="mt-1.5 text-sm text-danger">${(0, import_utils2.escapeHtml)(error)}</p>` : "";
|
|
1331
|
+
return `<div class="form-field">
|
|
1332
|
+
${labelHtml}
|
|
1333
|
+
<select
|
|
1334
|
+
name="${(0, import_utils2.escapeHtml)(name)}"
|
|
1335
|
+
id="${(0, import_utils2.escapeHtml)(id)}"
|
|
1336
|
+
class="${baseClasses}"
|
|
1337
|
+
${required ? "required" : ""}
|
|
1338
|
+
${disabled ? "disabled" : ""}
|
|
1339
|
+
${multiple ? "multiple" : ""}
|
|
1340
|
+
${dataAttrs}
|
|
1341
|
+
>
|
|
1342
|
+
${optionsHtml}
|
|
1343
|
+
</select>
|
|
1344
|
+
${helperHtml}
|
|
1345
|
+
${errorHtml}
|
|
1346
|
+
</div>`;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
// libs/ui/src/components/form.schema.ts
|
|
1350
|
+
var import_zod5 = require("zod");
|
|
1351
|
+
var InputTypeSchema = import_zod5.z.enum([
|
|
1352
|
+
"text",
|
|
1353
|
+
"email",
|
|
1354
|
+
"password",
|
|
1355
|
+
"number",
|
|
1356
|
+
"tel",
|
|
1357
|
+
"url",
|
|
1358
|
+
"search",
|
|
1359
|
+
"date",
|
|
1360
|
+
"time",
|
|
1361
|
+
"datetime-local",
|
|
1362
|
+
"hidden"
|
|
1363
|
+
]);
|
|
1364
|
+
var InputSizeSchema = import_zod5.z.enum(["sm", "md", "lg"]);
|
|
1365
|
+
var InputStateSchema = import_zod5.z.enum(["default", "error", "success", "warning"]);
|
|
1366
|
+
var InputOptionsSchema = import_zod5.z.object({
|
|
1367
|
+
/** Input type */
|
|
1368
|
+
type: InputTypeSchema.optional(),
|
|
1369
|
+
/** Input name (required) */
|
|
1370
|
+
name: import_zod5.z.string(),
|
|
1371
|
+
/** Input ID (defaults to name) */
|
|
1372
|
+
id: import_zod5.z.string().optional(),
|
|
1373
|
+
/** Input value */
|
|
1374
|
+
value: import_zod5.z.string().optional(),
|
|
1375
|
+
/** Placeholder text */
|
|
1376
|
+
placeholder: import_zod5.z.string().optional(),
|
|
1377
|
+
/** Label text */
|
|
1378
|
+
label: import_zod5.z.string().optional(),
|
|
1379
|
+
/** Helper text */
|
|
1380
|
+
helper: import_zod5.z.string().optional(),
|
|
1381
|
+
/** Error message */
|
|
1382
|
+
error: import_zod5.z.string().optional(),
|
|
1383
|
+
/** Input size */
|
|
1384
|
+
size: InputSizeSchema.optional(),
|
|
1385
|
+
/** Input state */
|
|
1386
|
+
state: InputStateSchema.optional(),
|
|
1387
|
+
/** Required field */
|
|
1388
|
+
required: import_zod5.z.boolean().optional(),
|
|
1389
|
+
/** Disabled state */
|
|
1390
|
+
disabled: import_zod5.z.boolean().optional(),
|
|
1391
|
+
/** Readonly state */
|
|
1392
|
+
readonly: import_zod5.z.boolean().optional(),
|
|
1393
|
+
/** Autocomplete attribute */
|
|
1394
|
+
autocomplete: import_zod5.z.string().optional(),
|
|
1395
|
+
/** Pattern for validation */
|
|
1396
|
+
pattern: import_zod5.z.string().optional(),
|
|
1397
|
+
/** Min value (for number/date) */
|
|
1398
|
+
min: import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number()]).optional(),
|
|
1399
|
+
/** Max value (for number/date) */
|
|
1400
|
+
max: import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number()]).optional(),
|
|
1401
|
+
/** Step value (for number) */
|
|
1402
|
+
step: import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number()]).optional(),
|
|
1403
|
+
/** Additional CSS classes */
|
|
1404
|
+
className: import_zod5.z.string().optional(),
|
|
1405
|
+
/** Data attributes */
|
|
1406
|
+
data: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.string()).optional(),
|
|
1407
|
+
/** Icon before input (HTML string) */
|
|
1408
|
+
iconBefore: import_zod5.z.string().optional(),
|
|
1409
|
+
/** Icon after input (HTML string) */
|
|
1410
|
+
iconAfter: import_zod5.z.string().optional()
|
|
1411
|
+
}).strict();
|
|
1412
|
+
var SelectOptionItemSchema = import_zod5.z.object({
|
|
1413
|
+
value: import_zod5.z.string(),
|
|
1414
|
+
label: import_zod5.z.string(),
|
|
1415
|
+
disabled: import_zod5.z.boolean().optional(),
|
|
1416
|
+
selected: import_zod5.z.boolean().optional()
|
|
1417
|
+
}).strict();
|
|
1418
|
+
var SelectOptionsSchema = import_zod5.z.object({
|
|
1419
|
+
/** Input name (required) */
|
|
1420
|
+
name: import_zod5.z.string(),
|
|
1421
|
+
/** Input ID (defaults to name) */
|
|
1422
|
+
id: import_zod5.z.string().optional(),
|
|
1423
|
+
/** Input value */
|
|
1424
|
+
value: import_zod5.z.string().optional(),
|
|
1425
|
+
/** Placeholder text */
|
|
1426
|
+
placeholder: import_zod5.z.string().optional(),
|
|
1427
|
+
/** Label text */
|
|
1428
|
+
label: import_zod5.z.string().optional(),
|
|
1429
|
+
/** Helper text */
|
|
1430
|
+
helper: import_zod5.z.string().optional(),
|
|
1431
|
+
/** Error message */
|
|
1432
|
+
error: import_zod5.z.string().optional(),
|
|
1433
|
+
/** Input size */
|
|
1434
|
+
size: InputSizeSchema.optional(),
|
|
1435
|
+
/** Input state */
|
|
1436
|
+
state: InputStateSchema.optional(),
|
|
1437
|
+
/** Required field */
|
|
1438
|
+
required: import_zod5.z.boolean().optional(),
|
|
1439
|
+
/** Disabled state */
|
|
1440
|
+
disabled: import_zod5.z.boolean().optional(),
|
|
1441
|
+
/** Readonly state */
|
|
1442
|
+
readonly: import_zod5.z.boolean().optional(),
|
|
1443
|
+
/** Additional CSS classes */
|
|
1444
|
+
className: import_zod5.z.string().optional(),
|
|
1445
|
+
/** Data attributes */
|
|
1446
|
+
data: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.string()).optional(),
|
|
1447
|
+
/** Icon before input (HTML string) */
|
|
1448
|
+
iconBefore: import_zod5.z.string().optional(),
|
|
1449
|
+
/** Icon after input (HTML string) */
|
|
1450
|
+
iconAfter: import_zod5.z.string().optional(),
|
|
1451
|
+
/** Select options (required) */
|
|
1452
|
+
options: import_zod5.z.array(SelectOptionItemSchema),
|
|
1453
|
+
/** Multiple selection */
|
|
1454
|
+
multiple: import_zod5.z.boolean().optional()
|
|
1455
|
+
}).strict();
|
|
1456
|
+
var TextareaResizeSchema = import_zod5.z.enum(["none", "vertical", "horizontal", "both"]);
|
|
1457
|
+
var TextareaOptionsSchema = import_zod5.z.object({
|
|
1458
|
+
/** Input name (required) */
|
|
1459
|
+
name: import_zod5.z.string(),
|
|
1460
|
+
/** Input ID (defaults to name) */
|
|
1461
|
+
id: import_zod5.z.string().optional(),
|
|
1462
|
+
/** Input value */
|
|
1463
|
+
value: import_zod5.z.string().optional(),
|
|
1464
|
+
/** Placeholder text */
|
|
1465
|
+
placeholder: import_zod5.z.string().optional(),
|
|
1466
|
+
/** Label text */
|
|
1467
|
+
label: import_zod5.z.string().optional(),
|
|
1468
|
+
/** Helper text */
|
|
1469
|
+
helper: import_zod5.z.string().optional(),
|
|
1470
|
+
/** Error message */
|
|
1471
|
+
error: import_zod5.z.string().optional(),
|
|
1472
|
+
/** Input size */
|
|
1473
|
+
size: InputSizeSchema.optional(),
|
|
1474
|
+
/** Input state */
|
|
1475
|
+
state: InputStateSchema.optional(),
|
|
1476
|
+
/** Required field */
|
|
1477
|
+
required: import_zod5.z.boolean().optional(),
|
|
1478
|
+
/** Disabled state */
|
|
1479
|
+
disabled: import_zod5.z.boolean().optional(),
|
|
1480
|
+
/** Readonly state */
|
|
1481
|
+
readonly: import_zod5.z.boolean().optional(),
|
|
1482
|
+
/** Autocomplete attribute */
|
|
1483
|
+
autocomplete: import_zod5.z.string().optional(),
|
|
1484
|
+
/** Additional CSS classes */
|
|
1485
|
+
className: import_zod5.z.string().optional(),
|
|
1486
|
+
/** Data attributes */
|
|
1487
|
+
data: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.string()).optional(),
|
|
1488
|
+
/** Icon before input (HTML string) */
|
|
1489
|
+
iconBefore: import_zod5.z.string().optional(),
|
|
1490
|
+
/** Icon after input (HTML string) */
|
|
1491
|
+
iconAfter: import_zod5.z.string().optional(),
|
|
1492
|
+
/** Number of rows */
|
|
1493
|
+
rows: import_zod5.z.number().min(1).optional(),
|
|
1494
|
+
/** Resize behavior */
|
|
1495
|
+
resize: TextareaResizeSchema.optional()
|
|
1496
|
+
}).strict();
|
|
1497
|
+
var CheckboxOptionsSchema = import_zod5.z.object({
|
|
1498
|
+
/** Input name (required) */
|
|
1499
|
+
name: import_zod5.z.string(),
|
|
1500
|
+
/** Input ID */
|
|
1501
|
+
id: import_zod5.z.string().optional(),
|
|
1502
|
+
/** Input value */
|
|
1503
|
+
value: import_zod5.z.string().optional(),
|
|
1504
|
+
/** Label text (required) */
|
|
1505
|
+
label: import_zod5.z.string(),
|
|
1506
|
+
/** Checked state */
|
|
1507
|
+
checked: import_zod5.z.boolean().optional(),
|
|
1508
|
+
/** Disabled state */
|
|
1509
|
+
disabled: import_zod5.z.boolean().optional(),
|
|
1510
|
+
/** Helper text */
|
|
1511
|
+
helper: import_zod5.z.string().optional(),
|
|
1512
|
+
/** Error message */
|
|
1513
|
+
error: import_zod5.z.string().optional(),
|
|
1514
|
+
/** Additional CSS classes */
|
|
1515
|
+
className: import_zod5.z.string().optional()
|
|
1516
|
+
}).strict();
|
|
1517
|
+
var RadioOptionItemSchema = import_zod5.z.object({
|
|
1518
|
+
value: import_zod5.z.string(),
|
|
1519
|
+
label: import_zod5.z.string(),
|
|
1520
|
+
disabled: import_zod5.z.boolean().optional()
|
|
1521
|
+
}).strict();
|
|
1522
|
+
var RadioGroupOptionsSchema = import_zod5.z.object({
|
|
1523
|
+
/** Group name (required) */
|
|
1524
|
+
name: import_zod5.z.string(),
|
|
1525
|
+
/** Radio options (required) */
|
|
1526
|
+
options: import_zod5.z.array(RadioOptionItemSchema),
|
|
1527
|
+
/** Selected value */
|
|
1528
|
+
value: import_zod5.z.string().optional(),
|
|
1529
|
+
/** Label for the group */
|
|
1530
|
+
label: import_zod5.z.string().optional(),
|
|
1531
|
+
/** Helper text */
|
|
1532
|
+
helper: import_zod5.z.string().optional(),
|
|
1533
|
+
/** Error message */
|
|
1534
|
+
error: import_zod5.z.string().optional(),
|
|
1535
|
+
/** Layout direction */
|
|
1536
|
+
direction: import_zod5.z.enum(["horizontal", "vertical"]).optional(),
|
|
1537
|
+
/** Additional CSS classes */
|
|
1538
|
+
className: import_zod5.z.string().optional()
|
|
1539
|
+
}).strict();
|
|
1540
|
+
var FormMethodSchema = import_zod5.z.enum(["get", "post", "dialog"]);
|
|
1541
|
+
var FormEnctypeSchema = import_zod5.z.enum(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
|
|
1542
|
+
var FormOptionsSchema = import_zod5.z.object({
|
|
1543
|
+
/** Form action URL */
|
|
1544
|
+
action: import_zod5.z.string().optional(),
|
|
1545
|
+
/** Form method */
|
|
1546
|
+
method: FormMethodSchema.optional(),
|
|
1547
|
+
/** Form ID */
|
|
1548
|
+
id: import_zod5.z.string().optional(),
|
|
1549
|
+
/** Form enctype */
|
|
1550
|
+
enctype: FormEnctypeSchema.optional(),
|
|
1551
|
+
/** Disable browser validation */
|
|
1552
|
+
novalidate: import_zod5.z.boolean().optional(),
|
|
1553
|
+
/** Autocomplete behavior */
|
|
1554
|
+
autocomplete: import_zod5.z.enum(["on", "off"]).optional(),
|
|
1555
|
+
/** Additional CSS classes */
|
|
1556
|
+
className: import_zod5.z.string().optional()
|
|
1557
|
+
}).strict();
|
|
1558
|
+
var FormRowOptionsSchema = import_zod5.z.object({
|
|
1559
|
+
/** Number of columns */
|
|
1560
|
+
cols: import_zod5.z.number().min(1).max(12).optional(),
|
|
1561
|
+
/** Gap between columns */
|
|
1562
|
+
gap: import_zod5.z.enum(["sm", "md", "lg"]).optional(),
|
|
1563
|
+
/** Additional CSS classes */
|
|
1564
|
+
className: import_zod5.z.string().optional()
|
|
1565
|
+
}).strict();
|
|
1566
|
+
var FormSectionOptionsSchema = import_zod5.z.object({
|
|
1567
|
+
/** Section title */
|
|
1568
|
+
title: import_zod5.z.string().optional(),
|
|
1569
|
+
/** Section description */
|
|
1570
|
+
description: import_zod5.z.string().optional(),
|
|
1571
|
+
/** Additional CSS classes */
|
|
1572
|
+
className: import_zod5.z.string().optional()
|
|
1573
|
+
}).strict();
|
|
1574
|
+
var FormActionsOptionsSchema = import_zod5.z.object({
|
|
1575
|
+
/** Alignment */
|
|
1576
|
+
align: import_zod5.z.enum(["left", "center", "right", "between"]).optional(),
|
|
1577
|
+
/** Additional CSS classes */
|
|
1578
|
+
className: import_zod5.z.string().optional()
|
|
1579
|
+
}).strict();
|
|
1580
|
+
|
|
1581
|
+
// libs/ui/src/web-components/elements/fmcp-input.ts
|
|
1582
|
+
var FmcpInput = class extends FmcpElement {
|
|
1583
|
+
config = {
|
|
1584
|
+
name: "input",
|
|
1585
|
+
schema: InputOptionsSchema,
|
|
1586
|
+
defaults: {
|
|
1587
|
+
type: "text",
|
|
1588
|
+
size: "md",
|
|
1589
|
+
state: "default"
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
static get observedAttributes() {
|
|
1593
|
+
return [
|
|
1594
|
+
"name",
|
|
1595
|
+
"type",
|
|
1596
|
+
"id",
|
|
1597
|
+
"value",
|
|
1598
|
+
"placeholder",
|
|
1599
|
+
"label",
|
|
1600
|
+
"helper",
|
|
1601
|
+
"error",
|
|
1602
|
+
"size",
|
|
1603
|
+
"state",
|
|
1604
|
+
"required",
|
|
1605
|
+
"disabled",
|
|
1606
|
+
"readonly",
|
|
1607
|
+
"autocomplete",
|
|
1608
|
+
"pattern",
|
|
1609
|
+
"min",
|
|
1610
|
+
"max",
|
|
1611
|
+
"step",
|
|
1612
|
+
"class",
|
|
1613
|
+
"icon-before",
|
|
1614
|
+
"icon-after"
|
|
1615
|
+
];
|
|
1616
|
+
}
|
|
1617
|
+
renderHtml(options, _content) {
|
|
1618
|
+
return input(options);
|
|
1619
|
+
}
|
|
1620
|
+
// ============================================
|
|
1621
|
+
// Property Setters
|
|
1622
|
+
// ============================================
|
|
1623
|
+
set name(value) {
|
|
1624
|
+
this._options.name = value;
|
|
1625
|
+
this._scheduleRender();
|
|
1626
|
+
}
|
|
1627
|
+
get name() {
|
|
1628
|
+
return this._options.name ?? "";
|
|
1629
|
+
}
|
|
1630
|
+
set type(value) {
|
|
1631
|
+
this._options.type = value;
|
|
1632
|
+
this._scheduleRender();
|
|
1633
|
+
}
|
|
1634
|
+
get type() {
|
|
1635
|
+
return this._options.type;
|
|
1636
|
+
}
|
|
1637
|
+
set label(value) {
|
|
1638
|
+
this._options.label = value;
|
|
1639
|
+
this._scheduleRender();
|
|
1640
|
+
}
|
|
1641
|
+
get label() {
|
|
1642
|
+
return this._options.label;
|
|
1643
|
+
}
|
|
1644
|
+
set placeholder(value) {
|
|
1645
|
+
this._options.placeholder = value;
|
|
1646
|
+
this._scheduleRender();
|
|
1647
|
+
}
|
|
1648
|
+
get placeholder() {
|
|
1649
|
+
return this._options.placeholder;
|
|
1650
|
+
}
|
|
1651
|
+
set helper(value) {
|
|
1652
|
+
this._options.helper = value;
|
|
1653
|
+
this._scheduleRender();
|
|
1654
|
+
}
|
|
1655
|
+
get helper() {
|
|
1656
|
+
return this._options.helper;
|
|
1657
|
+
}
|
|
1658
|
+
set error(value) {
|
|
1659
|
+
this._options.error = value;
|
|
1660
|
+
this._scheduleRender();
|
|
1661
|
+
}
|
|
1662
|
+
get error() {
|
|
1663
|
+
return this._options.error;
|
|
1664
|
+
}
|
|
1665
|
+
set size(value) {
|
|
1666
|
+
this._options.size = value;
|
|
1667
|
+
this._scheduleRender();
|
|
1668
|
+
}
|
|
1669
|
+
get size() {
|
|
1670
|
+
return this._options.size;
|
|
1671
|
+
}
|
|
1672
|
+
set state(value) {
|
|
1673
|
+
this._options.state = value;
|
|
1674
|
+
this._scheduleRender();
|
|
1675
|
+
}
|
|
1676
|
+
get state() {
|
|
1677
|
+
return this._options.state;
|
|
1678
|
+
}
|
|
1679
|
+
set required(value) {
|
|
1680
|
+
this._options.required = value;
|
|
1681
|
+
this._scheduleRender();
|
|
1682
|
+
}
|
|
1683
|
+
get required() {
|
|
1684
|
+
return this._options.required ?? false;
|
|
1685
|
+
}
|
|
1686
|
+
set disabled(value) {
|
|
1687
|
+
this._options.disabled = value;
|
|
1688
|
+
this._scheduleRender();
|
|
1689
|
+
}
|
|
1690
|
+
get disabled() {
|
|
1691
|
+
return this._options.disabled ?? false;
|
|
1692
|
+
}
|
|
1693
|
+
set readonly(value) {
|
|
1694
|
+
this._options.readonly = value;
|
|
1695
|
+
this._scheduleRender();
|
|
1696
|
+
}
|
|
1697
|
+
get readonly() {
|
|
1698
|
+
return this._options.readonly ?? false;
|
|
1699
|
+
}
|
|
1700
|
+
// ============================================
|
|
1701
|
+
// Form Integration
|
|
1702
|
+
// ============================================
|
|
1703
|
+
connectedCallback() {
|
|
1704
|
+
super.connectedCallback();
|
|
1705
|
+
this.addEventListener("input", this._handleInput.bind(this));
|
|
1706
|
+
this.addEventListener("change", this._handleChange.bind(this));
|
|
1707
|
+
}
|
|
1708
|
+
_handleInput(e) {
|
|
1709
|
+
const inputEl = this.querySelector("input");
|
|
1710
|
+
if (inputEl && (e.target === inputEl || inputEl.contains(e.target))) {
|
|
1711
|
+
this.dispatchEvent(
|
|
1712
|
+
new CustomEvent("fmcp:input", {
|
|
1713
|
+
bubbles: true,
|
|
1714
|
+
detail: { value: inputEl.value, name: this._options.name }
|
|
1715
|
+
})
|
|
1716
|
+
);
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
_handleChange(e) {
|
|
1720
|
+
const inputEl = this.querySelector("input");
|
|
1721
|
+
if (inputEl && (e.target === inputEl || inputEl.contains(e.target))) {
|
|
1722
|
+
this.dispatchEvent(
|
|
1723
|
+
new CustomEvent("fmcp:change", {
|
|
1724
|
+
bubbles: true,
|
|
1725
|
+
detail: { value: inputEl.value, name: this._options.name }
|
|
1726
|
+
})
|
|
1727
|
+
);
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* Get current input value.
|
|
1732
|
+
*/
|
|
1733
|
+
get value() {
|
|
1734
|
+
const inputEl = this.querySelector("input");
|
|
1735
|
+
return inputEl?.value ?? this._options.value ?? "";
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* Set input value.
|
|
1739
|
+
*/
|
|
1740
|
+
set value(val) {
|
|
1741
|
+
const inputEl = this.querySelector("input");
|
|
1742
|
+
if (inputEl) {
|
|
1743
|
+
inputEl.value = val;
|
|
1744
|
+
}
|
|
1745
|
+
this._options.value = val;
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Get validity state.
|
|
1749
|
+
*/
|
|
1750
|
+
get validity() {
|
|
1751
|
+
return this.querySelector("input")?.validity;
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Check validity.
|
|
1755
|
+
*/
|
|
1756
|
+
checkValidity() {
|
|
1757
|
+
return this.querySelector("input")?.checkValidity() ?? true;
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Report validity.
|
|
1761
|
+
*/
|
|
1762
|
+
reportValidity() {
|
|
1763
|
+
return this.querySelector("input")?.reportValidity() ?? true;
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Focus the input.
|
|
1767
|
+
*/
|
|
1768
|
+
focus() {
|
|
1769
|
+
this.querySelector("input")?.focus();
|
|
1770
|
+
}
|
|
1771
|
+
/**
|
|
1772
|
+
* Blur the input.
|
|
1773
|
+
*/
|
|
1774
|
+
blur() {
|
|
1775
|
+
this.querySelector("input")?.blur();
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Select all text.
|
|
1779
|
+
*/
|
|
1780
|
+
select() {
|
|
1781
|
+
this.querySelector("input")?.select();
|
|
1782
|
+
}
|
|
1783
|
+
};
|
|
1784
|
+
function registerFmcpInput() {
|
|
1785
|
+
if (typeof customElements !== "undefined" && !customElements.get("fmcp-input")) {
|
|
1786
|
+
customElements.define("fmcp-input", FmcpInput);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
// libs/ui/src/web-components/elements/fmcp-select.ts
|
|
1791
|
+
var FmcpSelect = class extends FmcpElement {
|
|
1792
|
+
config = {
|
|
1793
|
+
name: "select",
|
|
1794
|
+
schema: SelectOptionsSchema,
|
|
1795
|
+
defaults: {
|
|
1796
|
+
size: "md",
|
|
1797
|
+
state: "default"
|
|
1798
|
+
}
|
|
1799
|
+
};
|
|
1800
|
+
/** Select options stored separately since they're complex objects */
|
|
1801
|
+
_selectOptions = [];
|
|
1802
|
+
static get observedAttributes() {
|
|
1803
|
+
return [
|
|
1804
|
+
"name",
|
|
1805
|
+
"id",
|
|
1806
|
+
"value",
|
|
1807
|
+
"placeholder",
|
|
1808
|
+
"label",
|
|
1809
|
+
"helper",
|
|
1810
|
+
"error",
|
|
1811
|
+
"size",
|
|
1812
|
+
"state",
|
|
1813
|
+
"required",
|
|
1814
|
+
"disabled",
|
|
1815
|
+
"multiple",
|
|
1816
|
+
"class"
|
|
1817
|
+
];
|
|
1818
|
+
}
|
|
1819
|
+
renderHtml(options, _content) {
|
|
1820
|
+
const mergedOptions = {
|
|
1821
|
+
...options,
|
|
1822
|
+
options: this._selectOptions.length > 0 ? this._selectOptions : options.options
|
|
1823
|
+
};
|
|
1824
|
+
return select(mergedOptions);
|
|
1825
|
+
}
|
|
1826
|
+
// ============================================
|
|
1827
|
+
// Property Setters
|
|
1828
|
+
// ============================================
|
|
1829
|
+
set name(value) {
|
|
1830
|
+
this._options.name = value;
|
|
1831
|
+
this._scheduleRender();
|
|
1832
|
+
}
|
|
1833
|
+
get name() {
|
|
1834
|
+
return this._options.name ?? "";
|
|
1835
|
+
}
|
|
1836
|
+
set label(value) {
|
|
1837
|
+
this._options.label = value;
|
|
1838
|
+
this._scheduleRender();
|
|
1839
|
+
}
|
|
1840
|
+
get label() {
|
|
1841
|
+
return this._options.label;
|
|
1842
|
+
}
|
|
1843
|
+
set placeholder(value) {
|
|
1844
|
+
this._options.placeholder = value;
|
|
1845
|
+
this._scheduleRender();
|
|
1846
|
+
}
|
|
1847
|
+
get placeholder() {
|
|
1848
|
+
return this._options.placeholder;
|
|
1849
|
+
}
|
|
1850
|
+
set helper(value) {
|
|
1851
|
+
this._options.helper = value;
|
|
1852
|
+
this._scheduleRender();
|
|
1853
|
+
}
|
|
1854
|
+
get helper() {
|
|
1855
|
+
return this._options.helper;
|
|
1856
|
+
}
|
|
1857
|
+
set error(value) {
|
|
1858
|
+
this._options.error = value;
|
|
1859
|
+
this._scheduleRender();
|
|
1860
|
+
}
|
|
1861
|
+
get error() {
|
|
1862
|
+
return this._options.error;
|
|
1863
|
+
}
|
|
1864
|
+
set size(value) {
|
|
1865
|
+
this._options.size = value;
|
|
1866
|
+
this._scheduleRender();
|
|
1867
|
+
}
|
|
1868
|
+
get size() {
|
|
1869
|
+
return this._options.size;
|
|
1870
|
+
}
|
|
1871
|
+
set state(value) {
|
|
1872
|
+
this._options.state = value;
|
|
1873
|
+
this._scheduleRender();
|
|
1874
|
+
}
|
|
1875
|
+
get state() {
|
|
1876
|
+
return this._options.state;
|
|
1877
|
+
}
|
|
1878
|
+
set required(value) {
|
|
1879
|
+
this._options.required = value;
|
|
1880
|
+
this._scheduleRender();
|
|
1881
|
+
}
|
|
1882
|
+
get required() {
|
|
1883
|
+
return this._options.required ?? false;
|
|
1884
|
+
}
|
|
1885
|
+
set disabled(value) {
|
|
1886
|
+
this._options.disabled = value;
|
|
1887
|
+
this._scheduleRender();
|
|
1888
|
+
}
|
|
1889
|
+
get disabled() {
|
|
1890
|
+
return this._options.disabled ?? false;
|
|
1891
|
+
}
|
|
1892
|
+
set multiple(value) {
|
|
1893
|
+
this._options.multiple = value;
|
|
1894
|
+
this._scheduleRender();
|
|
1895
|
+
}
|
|
1896
|
+
get multiple() {
|
|
1897
|
+
return this._options.multiple ?? false;
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Set select options (array of { value, label, disabled?, selected? })
|
|
1901
|
+
*/
|
|
1902
|
+
set selectOptions(value) {
|
|
1903
|
+
this._selectOptions = value;
|
|
1904
|
+
this._scheduleRender();
|
|
1905
|
+
}
|
|
1906
|
+
get selectOptions() {
|
|
1907
|
+
return this._selectOptions;
|
|
1908
|
+
}
|
|
1909
|
+
// ============================================
|
|
1910
|
+
// Form Integration
|
|
1911
|
+
// ============================================
|
|
1912
|
+
connectedCallback() {
|
|
1913
|
+
super.connectedCallback();
|
|
1914
|
+
this.addEventListener("change", this._handleChange.bind(this));
|
|
1915
|
+
}
|
|
1916
|
+
_handleChange(e) {
|
|
1917
|
+
const selectEl = this.querySelector("select");
|
|
1918
|
+
if (selectEl && (e.target === selectEl || selectEl.contains(e.target))) {
|
|
1919
|
+
this.dispatchEvent(
|
|
1920
|
+
new CustomEvent("fmcp:change", {
|
|
1921
|
+
bubbles: true,
|
|
1922
|
+
detail: {
|
|
1923
|
+
value: selectEl.value,
|
|
1924
|
+
name: this._options.name,
|
|
1925
|
+
selectedOptions: Array.from(selectEl.selectedOptions).map((opt) => opt.value)
|
|
1926
|
+
}
|
|
1927
|
+
})
|
|
1928
|
+
);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Get current select value.
|
|
1933
|
+
*/
|
|
1934
|
+
get value() {
|
|
1935
|
+
const selectEl = this.querySelector("select");
|
|
1936
|
+
return selectEl?.value ?? this._options.value ?? "";
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Set select value.
|
|
1940
|
+
*/
|
|
1941
|
+
set value(val) {
|
|
1942
|
+
const selectEl = this.querySelector("select");
|
|
1943
|
+
if (selectEl) {
|
|
1944
|
+
selectEl.value = val;
|
|
1945
|
+
}
|
|
1946
|
+
this._options.value = val;
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* Get selected options (for multiple select).
|
|
1950
|
+
*/
|
|
1951
|
+
get selectedOptions() {
|
|
1952
|
+
const selectEl = this.querySelector("select");
|
|
1953
|
+
return selectEl ? Array.from(selectEl.selectedOptions).map((opt) => opt.value) : [];
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Get validity state.
|
|
1957
|
+
*/
|
|
1958
|
+
get validity() {
|
|
1959
|
+
return this.querySelector("select")?.validity;
|
|
1960
|
+
}
|
|
1961
|
+
/**
|
|
1962
|
+
* Check validity.
|
|
1963
|
+
*/
|
|
1964
|
+
checkValidity() {
|
|
1965
|
+
return this.querySelector("select")?.checkValidity() ?? true;
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Report validity.
|
|
1969
|
+
*/
|
|
1970
|
+
reportValidity() {
|
|
1971
|
+
return this.querySelector("select")?.reportValidity() ?? true;
|
|
1972
|
+
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Focus the select.
|
|
1975
|
+
*/
|
|
1976
|
+
focus() {
|
|
1977
|
+
this.querySelector("select")?.focus();
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Blur the select.
|
|
1981
|
+
*/
|
|
1982
|
+
blur() {
|
|
1983
|
+
this.querySelector("select")?.blur();
|
|
1984
|
+
}
|
|
1985
|
+
};
|
|
1986
|
+
function registerFmcpSelect() {
|
|
1987
|
+
if (typeof customElements !== "undefined" && !customElements.get("fmcp-select")) {
|
|
1988
|
+
customElements.define("fmcp-select", FmcpSelect);
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
// libs/ui/src/web-components/register.ts
|
|
1993
|
+
function registerAllComponents() {
|
|
1994
|
+
registerFmcpButton();
|
|
1995
|
+
registerFmcpCard();
|
|
1996
|
+
registerFmcpAlert();
|
|
1997
|
+
registerFmcpBadge();
|
|
1998
|
+
registerFmcpInput();
|
|
1999
|
+
registerFmcpSelect();
|
|
2000
|
+
}
|
|
2001
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
2002
|
+
const script = document.currentScript;
|
|
2003
|
+
if (script?.hasAttribute("data-auto-register")) {
|
|
2004
|
+
registerAllComponents();
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2008
|
+
0 && (module.exports = {
|
|
2009
|
+
FmcpAlert,
|
|
2010
|
+
FmcpBadge,
|
|
2011
|
+
FmcpButton,
|
|
2012
|
+
FmcpCard,
|
|
2013
|
+
FmcpElement,
|
|
2014
|
+
FmcpInput,
|
|
2015
|
+
FmcpSelect,
|
|
2016
|
+
camelToKebab,
|
|
2017
|
+
getObservedAttributesFromSchema,
|
|
2018
|
+
kebabToCamel,
|
|
2019
|
+
mergeAttributeIntoOptions,
|
|
2020
|
+
parseAttributeValue,
|
|
2021
|
+
registerAllComponents,
|
|
2022
|
+
registerFmcpAlert,
|
|
2023
|
+
registerFmcpBadge,
|
|
2024
|
+
registerFmcpButton,
|
|
2025
|
+
registerFmcpCard,
|
|
2026
|
+
registerFmcpInput,
|
|
2027
|
+
registerFmcpSelect
|
|
2028
|
+
});
|