@frontmcp/ui 0.6.1 → 0.6.2
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/bridge/core/bridge-factory.d.ts +1 -0
- package/bridge/core/bridge-factory.d.ts.map +1 -1
- package/bridge/index.d.ts +1 -1
- package/bridge/index.d.ts.map +1 -1
- package/bridge/index.js +39 -881
- package/bundler/browser-components.d.ts +42 -0
- package/bundler/browser-components.d.ts.map +1 -0
- package/bundler/bundler.d.ts +78 -4
- package/bundler/bundler.d.ts.map +1 -1
- package/bundler/index.d.ts +8 -8
- package/bundler/index.d.ts.map +1 -1
- package/bundler/index.js +1315 -1854
- package/bundler/types.d.ts +188 -7
- package/bundler/types.d.ts.map +1 -1
- package/esm/bridge/{index.js → index.mjs} +40 -877
- package/esm/bundler/{index.js → index.mjs} +1391 -1895
- package/esm/{index.js → index.mjs} +215 -3091
- package/esm/layouts/{index.js → index.mjs} +3 -3
- package/esm/package.json +9 -8
- package/esm/react/index.mjs +1183 -0
- package/esm/renderers/index.mjs +611 -0
- package/esm/universal/{index.js → index.mjs} +266 -70
- package/index.d.ts +1 -4
- package/index.d.ts.map +1 -1
- package/index.js +208 -3113
- package/layouts/base.d.ts.map +1 -1
- package/layouts/index.js +3 -3
- package/layouts/presets.d.ts.map +1 -1
- package/package.json +9 -8
- package/react/Badge.d.ts.map +1 -1
- package/react/hooks/context.d.ts.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +57 -2001
- package/react/types.d.ts.map +1 -1
- package/renderers/index.d.ts +9 -4
- package/renderers/index.d.ts.map +1 -1
- package/renderers/index.js +328 -88
- package/renderers/mdx.renderer.d.ts +99 -0
- package/renderers/mdx.renderer.d.ts.map +1 -0
- package/renderers/react.renderer.d.ts +22 -13
- package/renderers/react.renderer.d.ts.map +1 -1
- package/renderers/transpiler.d.ts +49 -0
- package/renderers/transpiler.d.ts.map +1 -0
- package/universal/cached-runtime.d.ts +25 -1
- package/universal/cached-runtime.d.ts.map +1 -1
- package/universal/index.js +266 -70
- package/universal/runtime-builder.d.ts.map +1 -1
- package/universal/types.d.ts.map +1 -1
- package/web-components/elements/fmcp-input.d.ts.map +1 -1
- package/web-components/elements/fmcp-select.d.ts.map +1 -1
- package/web-components/index.d.ts +0 -1
- package/web-components/index.d.ts.map +1 -1
- package/bundler/cache.d.ts +0 -173
- package/bundler/cache.d.ts.map +0 -1
- package/bundler/file-cache/component-builder.d.ts +0 -167
- package/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/bundler/file-cache/index.d.ts +0 -12
- package/bundler/file-cache/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/bundler/file-cache/storage/index.d.ts +0 -11
- package/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/interface.d.ts +0 -152
- package/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/bundler/file-cache/storage/redis.d.ts +0 -139
- package/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/bundler/sandbox/executor.d.ts +0 -14
- package/bundler/sandbox/executor.d.ts.map +0 -1
- package/bundler/sandbox/policy.d.ts +0 -62
- package/bundler/sandbox/policy.d.ts.map +0 -1
- package/esm/bridge/adapters/base-adapter.d.ts +0 -104
- package/esm/bridge/adapters/base-adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/claude.adapter.d.ts +0 -67
- package/esm/bridge/adapters/claude.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/ext-apps.adapter.d.ts +0 -143
- package/esm/bridge/adapters/ext-apps.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/gemini.adapter.d.ts +0 -64
- package/esm/bridge/adapters/gemini.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/generic.adapter.d.ts +0 -56
- package/esm/bridge/adapters/generic.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/index.d.ts +0 -26
- package/esm/bridge/adapters/index.d.ts.map +0 -1
- package/esm/bridge/adapters/openai.adapter.d.ts +0 -65
- package/esm/bridge/adapters/openai.adapter.d.ts.map +0 -1
- package/esm/bridge/core/adapter-registry.d.ts +0 -122
- package/esm/bridge/core/adapter-registry.d.ts.map +0 -1
- package/esm/bridge/core/bridge-factory.d.ts +0 -199
- package/esm/bridge/core/bridge-factory.d.ts.map +0 -1
- package/esm/bridge/core/index.d.ts +0 -10
- package/esm/bridge/core/index.d.ts.map +0 -1
- package/esm/bridge/index.d.ts +0 -62
- package/esm/bridge/index.d.ts.map +0 -1
- package/esm/bridge/runtime/iife-generator.d.ts +0 -62
- package/esm/bridge/runtime/iife-generator.d.ts.map +0 -1
- package/esm/bridge/runtime/index.d.ts +0 -10
- package/esm/bridge/runtime/index.d.ts.map +0 -1
- package/esm/bridge/types.d.ts +0 -386
- package/esm/bridge/types.d.ts.map +0 -1
- package/esm/bundler/bundler.d.ts +0 -208
- package/esm/bundler/bundler.d.ts.map +0 -1
- package/esm/bundler/cache.d.ts +0 -173
- package/esm/bundler/cache.d.ts.map +0 -1
- package/esm/bundler/file-cache/component-builder.d.ts +0 -167
- package/esm/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/esm/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/esm/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/esm/bundler/file-cache/index.d.ts +0 -12
- package/esm/bundler/file-cache/index.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/esm/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/index.d.ts +0 -11
- package/esm/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/interface.d.ts +0 -152
- package/esm/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/redis.d.ts +0 -139
- package/esm/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/esm/bundler/index.d.ts +0 -43
- package/esm/bundler/index.d.ts.map +0 -1
- package/esm/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/esm/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/esm/bundler/sandbox/executor.d.ts +0 -14
- package/esm/bundler/sandbox/executor.d.ts.map +0 -1
- package/esm/bundler/sandbox/policy.d.ts +0 -62
- package/esm/bundler/sandbox/policy.d.ts.map +0 -1
- package/esm/bundler/types.d.ts +0 -702
- package/esm/bundler/types.d.ts.map +0 -1
- package/esm/components/alert.d.ts +0 -66
- package/esm/components/alert.d.ts.map +0 -1
- package/esm/components/alert.schema.d.ts +0 -98
- package/esm/components/alert.schema.d.ts.map +0 -1
- package/esm/components/avatar.d.ts +0 -77
- package/esm/components/avatar.d.ts.map +0 -1
- package/esm/components/avatar.schema.d.ts +0 -170
- package/esm/components/avatar.schema.d.ts.map +0 -1
- package/esm/components/badge.d.ts +0 -64
- package/esm/components/badge.d.ts.map +0 -1
- package/esm/components/badge.schema.d.ts +0 -91
- package/esm/components/badge.schema.d.ts.map +0 -1
- package/esm/components/button.d.ts +0 -100
- package/esm/components/button.d.ts.map +0 -1
- package/esm/components/button.schema.d.ts +0 -120
- package/esm/components/button.schema.d.ts.map +0 -1
- package/esm/components/card.d.ts +0 -53
- package/esm/components/card.d.ts.map +0 -1
- package/esm/components/card.schema.d.ts +0 -93
- package/esm/components/card.schema.d.ts.map +0 -1
- package/esm/components/form.d.ts +0 -212
- package/esm/components/form.d.ts.map +0 -1
- package/esm/components/form.schema.d.ts +0 -365
- package/esm/components/form.schema.d.ts.map +0 -1
- package/esm/components/index.d.ts +0 -29
- package/esm/components/index.d.ts.map +0 -1
- package/esm/components/list.d.ts +0 -121
- package/esm/components/list.d.ts.map +0 -1
- package/esm/components/list.schema.d.ts +0 -129
- package/esm/components/list.schema.d.ts.map +0 -1
- package/esm/components/modal.d.ts +0 -100
- package/esm/components/modal.d.ts.map +0 -1
- package/esm/components/modal.schema.d.ts +0 -151
- package/esm/components/modal.schema.d.ts.map +0 -1
- package/esm/components/table.d.ts +0 -91
- package/esm/components/table.d.ts.map +0 -1
- package/esm/components/table.schema.d.ts +0 -123
- package/esm/components/table.schema.d.ts.map +0 -1
- package/esm/index.d.ts +0 -40
- package/esm/index.d.ts.map +0 -1
- package/esm/layouts/base.d.ts +0 -86
- package/esm/layouts/base.d.ts.map +0 -1
- package/esm/layouts/index.d.ts +0 -8
- package/esm/layouts/index.d.ts.map +0 -1
- package/esm/layouts/presets.d.ts +0 -134
- package/esm/layouts/presets.d.ts.map +0 -1
- package/esm/pages/consent.d.ts +0 -117
- package/esm/pages/consent.d.ts.map +0 -1
- package/esm/pages/error.d.ts +0 -101
- package/esm/pages/error.d.ts.map +0 -1
- package/esm/pages/index.d.ts +0 -9
- package/esm/pages/index.d.ts.map +0 -1
- package/esm/pages/index.js +0 -1036
- package/esm/react/Alert.d.ts +0 -101
- package/esm/react/Alert.d.ts.map +0 -1
- package/esm/react/Badge.d.ts +0 -100
- package/esm/react/Badge.d.ts.map +0 -1
- package/esm/react/Button.d.ts +0 -108
- package/esm/react/Button.d.ts.map +0 -1
- package/esm/react/Card.d.ts +0 -103
- package/esm/react/Card.d.ts.map +0 -1
- package/esm/react/hooks/context.d.ts +0 -179
- package/esm/react/hooks/context.d.ts.map +0 -1
- package/esm/react/hooks/index.d.ts +0 -42
- package/esm/react/hooks/index.d.ts.map +0 -1
- package/esm/react/hooks/tools.d.ts +0 -284
- package/esm/react/hooks/tools.d.ts.map +0 -1
- package/esm/react/index.d.ts +0 -80
- package/esm/react/index.d.ts.map +0 -1
- package/esm/react/index.js +0 -3124
- package/esm/react/types.d.ts +0 -105
- package/esm/react/types.d.ts.map +0 -1
- package/esm/react/utils.d.ts +0 -43
- package/esm/react/utils.d.ts.map +0 -1
- package/esm/render/index.d.ts +0 -8
- package/esm/render/index.d.ts.map +0 -1
- package/esm/render/prerender.d.ts +0 -57
- package/esm/render/prerender.d.ts.map +0 -1
- package/esm/renderers/index.d.ts +0 -21
- package/esm/renderers/index.d.ts.map +0 -1
- package/esm/renderers/index.js +0 -381
- package/esm/renderers/react.adapter.d.ts +0 -70
- package/esm/renderers/react.adapter.d.ts.map +0 -1
- package/esm/renderers/react.renderer.d.ts +0 -96
- package/esm/renderers/react.renderer.d.ts.map +0 -1
- package/esm/universal/UniversalApp.d.ts +0 -108
- package/esm/universal/UniversalApp.d.ts.map +0 -1
- package/esm/universal/cached-runtime.d.ts +0 -115
- package/esm/universal/cached-runtime.d.ts.map +0 -1
- package/esm/universal/context.d.ts +0 -122
- package/esm/universal/context.d.ts.map +0 -1
- package/esm/universal/index.d.ts +0 -57
- package/esm/universal/index.d.ts.map +0 -1
- package/esm/universal/renderers/html.renderer.d.ts +0 -37
- package/esm/universal/renderers/html.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/index.d.ts +0 -112
- package/esm/universal/renderers/index.d.ts.map +0 -1
- package/esm/universal/renderers/markdown.renderer.d.ts +0 -33
- package/esm/universal/renderers/markdown.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/mdx.renderer.d.ts +0 -38
- package/esm/universal/renderers/mdx.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/react.renderer.d.ts +0 -46
- package/esm/universal/renderers/react.renderer.d.ts.map +0 -1
- package/esm/universal/runtime-builder.d.ts +0 -33
- package/esm/universal/runtime-builder.d.ts.map +0 -1
- package/esm/universal/store.d.ts +0 -135
- package/esm/universal/store.d.ts.map +0 -1
- package/esm/universal/types.d.ts +0 -199
- package/esm/universal/types.d.ts.map +0 -1
- package/esm/web-components/core/attribute-parser.d.ts +0 -82
- package/esm/web-components/core/attribute-parser.d.ts.map +0 -1
- package/esm/web-components/core/base-element.d.ts +0 -197
- package/esm/web-components/core/base-element.d.ts.map +0 -1
- package/esm/web-components/core/index.d.ts +0 -9
- package/esm/web-components/core/index.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-alert.d.ts +0 -46
- package/esm/web-components/elements/fmcp-alert.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-badge.d.ts +0 -47
- package/esm/web-components/elements/fmcp-badge.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-button.d.ts +0 -117
- package/esm/web-components/elements/fmcp-button.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-card.d.ts +0 -53
- package/esm/web-components/elements/fmcp-card.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-input.d.ts +0 -96
- package/esm/web-components/elements/fmcp-input.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-select.d.ts +0 -100
- package/esm/web-components/elements/fmcp-select.d.ts.map +0 -1
- package/esm/web-components/elements/index.d.ts +0 -13
- package/esm/web-components/elements/index.d.ts.map +0 -1
- package/esm/web-components/index.d.ts +0 -50
- package/esm/web-components/index.d.ts.map +0 -1
- package/esm/web-components/register.d.ts +0 -57
- package/esm/web-components/register.d.ts.map +0 -1
- package/esm/web-components/types.d.ts +0 -122
- package/esm/web-components/types.d.ts.map +0 -1
- package/esm/widgets/index.d.ts +0 -8
- package/esm/widgets/index.d.ts.map +0 -1
- package/esm/widgets/index.js +0 -883
- package/esm/widgets/progress.d.ts +0 -133
- package/esm/widgets/progress.d.ts.map +0 -1
- package/esm/widgets/resource.d.ts +0 -163
- package/esm/widgets/resource.d.ts.map +0 -1
- package/pages/consent.d.ts +0 -117
- package/pages/consent.d.ts.map +0 -1
- package/pages/error.d.ts +0 -101
- package/pages/error.d.ts.map +0 -1
- package/pages/index.d.ts +0 -9
- package/pages/index.d.ts.map +0 -1
- package/pages/index.js +0 -1065
- package/react/utils.d.ts +0 -43
- package/react/utils.d.ts.map +0 -1
- package/widgets/index.d.ts +0 -8
- package/widgets/index.d.ts.map +0 -1
- package/widgets/index.js +0 -910
- package/widgets/progress.d.ts +0 -133
- package/widgets/progress.d.ts.map +0 -1
- package/widgets/resource.d.ts +0 -163
- package/widgets/resource.d.ts.map +0 -1
- /package/esm/components/{index.js → index.mjs} +0 -0
- /package/esm/render/{index.js → index.mjs} +0 -0
- /package/esm/web-components/{index.js → index.mjs} +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file attribute-parser.ts
|
|
3
|
-
* @description Attribute parsing utilities for FrontMCP Web Components.
|
|
4
|
-
*
|
|
5
|
-
* Converts HTML attributes to typed options for component rendering.
|
|
6
|
-
* Handles boolean attributes and kebab-to-camel case conversion.
|
|
7
|
-
*
|
|
8
|
-
* @example Attribute parsing
|
|
9
|
-
* ```typescript
|
|
10
|
-
* // variant="primary" -> { variant: 'primary' }
|
|
11
|
-
* // disabled -> { disabled: true }
|
|
12
|
-
* // disabled="false" -> { disabled: false }
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* @module @frontmcp/ui/web-components/core/attribute-parser
|
|
16
|
-
*/
|
|
17
|
-
import type { ZodSchema } from 'zod';
|
|
18
|
-
/**
|
|
19
|
-
* Result of parsing an attribute value
|
|
20
|
-
*/
|
|
21
|
-
export interface ParsedAttribute {
|
|
22
|
-
/** The option key (camelCase) */
|
|
23
|
-
key: string | null;
|
|
24
|
-
/** The parsed value */
|
|
25
|
-
value: unknown;
|
|
26
|
-
/** Whether this is a data attribute */
|
|
27
|
-
isData?: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Parse an HTML attribute into a typed option value.
|
|
31
|
-
*
|
|
32
|
-
* Attribute naming conventions:
|
|
33
|
-
* - Simple: `variant="primary"` -> `{ variant: 'primary' }`
|
|
34
|
-
* - Boolean: `disabled` -> `{ disabled: true }`
|
|
35
|
-
* - Boolean false: `disabled="false"` -> `{ disabled: false }`
|
|
36
|
-
* - Data: `data-foo="bar"` -> `{ data: { foo: 'bar' } }`
|
|
37
|
-
*
|
|
38
|
-
* @param attrName - The attribute name (kebab-case)
|
|
39
|
-
* @param value - The attribute value (null for boolean attributes)
|
|
40
|
-
* @returns Parsed attribute with key and typed value
|
|
41
|
-
*/
|
|
42
|
-
export declare function parseAttributeValue(attrName: string, value: string | null): ParsedAttribute;
|
|
43
|
-
/**
|
|
44
|
-
* Convert kebab-case to camelCase.
|
|
45
|
-
*
|
|
46
|
-
* @param str - Kebab-case string
|
|
47
|
-
* @returns camelCase string
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* kebabToCamel('full-width') // 'fullWidth'
|
|
51
|
-
* kebabToCamel('icon-before') // 'iconBefore'
|
|
52
|
-
*/
|
|
53
|
-
export declare function kebabToCamel(str: string): string;
|
|
54
|
-
/**
|
|
55
|
-
* Convert camelCase to kebab-case.
|
|
56
|
-
*
|
|
57
|
-
* @param str - camelCase string
|
|
58
|
-
* @returns kebab-case string
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* camelToKebab('fullWidth') // 'full-width'
|
|
62
|
-
* camelToKebab('iconBefore') // 'icon-before'
|
|
63
|
-
*/
|
|
64
|
-
export declare function camelToKebab(str: string): string;
|
|
65
|
-
/**
|
|
66
|
-
* Extract observable attribute names from a Zod schema.
|
|
67
|
-
*
|
|
68
|
-
* @param schema - Zod schema to extract keys from
|
|
69
|
-
* @returns Array of kebab-case attribute names
|
|
70
|
-
*/
|
|
71
|
-
export declare function getObservedAttributesFromSchema<T>(schema: ZodSchema<T>): string[];
|
|
72
|
-
/**
|
|
73
|
-
* Merge a parsed attribute into an options object.
|
|
74
|
-
*
|
|
75
|
-
* Handles nested objects for data attributes.
|
|
76
|
-
*
|
|
77
|
-
* @param options - Current options object
|
|
78
|
-
* @param parsed - Parsed attribute result
|
|
79
|
-
* @returns Updated options object
|
|
80
|
-
*/
|
|
81
|
-
export declare function mergeAttributeIntoOptions<T>(options: Partial<T>, parsed: ParsedAttribute): Partial<T>;
|
|
82
|
-
//# sourceMappingURL=attribute-parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-parser.d.ts","sourceRoot":"","sources":["../../../../src/web-components/core/attribute-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,uBAAuB;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,CAiD3F;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAkBjF;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC,CAkBrG"}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file base-element.ts
|
|
3
|
-
* @description Base class for all FrontMCP Web Components.
|
|
4
|
-
*
|
|
5
|
-
* Provides a foundation for creating Custom Elements with:
|
|
6
|
-
* - Zod schema validation
|
|
7
|
-
* - Attribute-to-option mapping
|
|
8
|
-
* - Property setters for React/Vue compatibility
|
|
9
|
-
* - Batched rendering via queueMicrotask
|
|
10
|
-
* - Light DOM (no Shadow DOM) for Tailwind compatibility
|
|
11
|
-
*
|
|
12
|
-
* @example Creating a custom element
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { FmcpElement } from '@frontmcp/ui/web-components';
|
|
15
|
-
* import { ButtonOptionsSchema, type ButtonOptions } from '@frontmcp/ui/components';
|
|
16
|
-
* import { button } from '@frontmcp/ui/components';
|
|
17
|
-
*
|
|
18
|
-
* class FmcpButton extends FmcpElement<ButtonOptions> {
|
|
19
|
-
* protected readonly config = {
|
|
20
|
-
* name: 'button',
|
|
21
|
-
* schema: ButtonOptionsSchema,
|
|
22
|
-
* defaults: { variant: 'primary', size: 'md' },
|
|
23
|
-
* };
|
|
24
|
-
*
|
|
25
|
-
* static get observedAttributes() {
|
|
26
|
-
* return getObservedAttributesFromSchema(ButtonOptionsSchema);
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* protected renderHtml(options: ButtonOptions, content: string): string {
|
|
30
|
-
* return button(content, options);
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
*
|
|
34
|
-
* customElements.define('fmcp-button', FmcpButton);
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @module @frontmcp/ui/web-components/core/base-element
|
|
38
|
-
*/
|
|
39
|
-
import type { ZodSchema } from 'zod';
|
|
40
|
-
declare const HTMLElementBase: {
|
|
41
|
-
new (): HTMLElement;
|
|
42
|
-
prototype: HTMLElement;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Configuration for FmcpElement subclasses
|
|
46
|
-
*/
|
|
47
|
-
export interface FmcpElementConfig<TOptions> {
|
|
48
|
-
/** Component name (used in error messages) */
|
|
49
|
-
name: string;
|
|
50
|
-
/** Zod schema for validation */
|
|
51
|
-
schema: ZodSchema<TOptions>;
|
|
52
|
-
/** Default option values */
|
|
53
|
-
defaults?: Partial<TOptions>;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Custom event detail for fmcp:render event
|
|
57
|
-
*/
|
|
58
|
-
export interface FmcpRenderEventDetail<TOptions = unknown> {
|
|
59
|
-
options: TOptions;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Base class for all FrontMCP Web Components.
|
|
63
|
-
*
|
|
64
|
-
* Key features:
|
|
65
|
-
* - **Light DOM**: Renders directly to innerHTML (no Shadow DOM)
|
|
66
|
-
* - **Attribute Parsing**: Converts HTML attributes to typed options
|
|
67
|
-
* - **Property Setters**: React/Vue can set properties directly
|
|
68
|
-
* - **Zod Validation**: Invalid options render error box
|
|
69
|
-
* - **Batched Rendering**: Multiple changes batch via queueMicrotask
|
|
70
|
-
*
|
|
71
|
-
* @typeParam TOptions - The component's options type (from Zod schema)
|
|
72
|
-
*
|
|
73
|
-
* @example Usage in HTML
|
|
74
|
-
* ```html
|
|
75
|
-
* <fmcp-button variant="primary" disabled>
|
|
76
|
-
* Click Me
|
|
77
|
-
* </fmcp-button>
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* @example Usage in React
|
|
81
|
-
* ```tsx
|
|
82
|
-
* <fmcp-button
|
|
83
|
-
* variant="primary"
|
|
84
|
-
* onClick={handleClick}
|
|
85
|
-
* >
|
|
86
|
-
* Click Me
|
|
87
|
-
* </fmcp-button>
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
export declare abstract class FmcpElement<TOptions> extends HTMLElementBase {
|
|
91
|
-
/**
|
|
92
|
-
* Configuration provided by subclass.
|
|
93
|
-
* Must include component name, Zod schema, and optional defaults.
|
|
94
|
-
*/
|
|
95
|
-
protected abstract readonly config: FmcpElementConfig<TOptions>;
|
|
96
|
-
/** Internal options state */
|
|
97
|
-
protected _options: Partial<TOptions>;
|
|
98
|
-
/** Content passed as children (captured on connect) */
|
|
99
|
-
protected _content: string;
|
|
100
|
-
/** Whether component has been connected to DOM */
|
|
101
|
-
private _connected;
|
|
102
|
-
/** Whether a render is pending (for batching) */
|
|
103
|
-
private _pendingRender;
|
|
104
|
-
/** Whether initial render has completed */
|
|
105
|
-
private _initialRenderComplete;
|
|
106
|
-
/**
|
|
107
|
-
* Called when element is added to DOM.
|
|
108
|
-
* Captures content, parses attributes, and renders.
|
|
109
|
-
*
|
|
110
|
-
* Supports SSR hydration via `data-ssr` attribute:
|
|
111
|
-
* - If `data-ssr` is present, content was pre-rendered by server
|
|
112
|
-
* - Web component adopts existing content without re-rendering
|
|
113
|
-
* - This enables progressive enhancement for LLM platforms
|
|
114
|
-
*/
|
|
115
|
-
connectedCallback(): void;
|
|
116
|
-
/**
|
|
117
|
-
* Called when element is removed from DOM.
|
|
118
|
-
*/
|
|
119
|
-
disconnectedCallback(): void;
|
|
120
|
-
/**
|
|
121
|
-
* Called when an observed attribute changes.
|
|
122
|
-
* Updates options and schedules re-render.
|
|
123
|
-
*/
|
|
124
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
125
|
-
/**
|
|
126
|
-
* Set all options at once (React pattern).
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* const el = document.querySelector('fmcp-button');
|
|
131
|
-
* el.options = { variant: 'danger', size: 'lg' };
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
set options(value: Partial<TOptions>);
|
|
135
|
-
/**
|
|
136
|
-
* Get current options.
|
|
137
|
-
*/
|
|
138
|
-
get options(): Partial<TOptions>;
|
|
139
|
-
/**
|
|
140
|
-
* Parse all current attributes into options.
|
|
141
|
-
*/
|
|
142
|
-
private _parseAttributes;
|
|
143
|
-
/**
|
|
144
|
-
* Update a single option from an attribute change.
|
|
145
|
-
*/
|
|
146
|
-
private _updateOptionFromAttribute;
|
|
147
|
-
/**
|
|
148
|
-
* Schedule a render on next microtask.
|
|
149
|
-
* Batches multiple attribute/property changes.
|
|
150
|
-
*/
|
|
151
|
-
protected _scheduleRender(): void;
|
|
152
|
-
/**
|
|
153
|
-
* Perform the actual render.
|
|
154
|
-
* Validates options and updates innerHTML.
|
|
155
|
-
*/
|
|
156
|
-
private _render;
|
|
157
|
-
/**
|
|
158
|
-
* Generate HTML for the component.
|
|
159
|
-
* Subclasses must implement this to render their specific HTML.
|
|
160
|
-
*
|
|
161
|
-
* @param options - Validated options
|
|
162
|
-
* @param content - Original innerHTML content
|
|
163
|
-
* @returns HTML string to render
|
|
164
|
-
*/
|
|
165
|
-
protected abstract renderHtml(options: TOptions, content: string): string;
|
|
166
|
-
/**
|
|
167
|
-
* Force an immediate re-render.
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```typescript
|
|
171
|
-
* el.options = { loading: true };
|
|
172
|
-
* el.refresh(); // Force immediate render
|
|
173
|
-
* ```
|
|
174
|
-
*/
|
|
175
|
-
refresh(): void;
|
|
176
|
-
/**
|
|
177
|
-
* Get the first child element (the actual rendered component).
|
|
178
|
-
*
|
|
179
|
-
* @typeParam T - Expected element type
|
|
180
|
-
* @returns The first child element or null
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```typescript
|
|
184
|
-
* const button = el.getInnerElement<HTMLButtonElement>();
|
|
185
|
-
* button?.focus();
|
|
186
|
-
* ```
|
|
187
|
-
*/
|
|
188
|
-
getInnerElement<T extends Element = Element>(): T | null;
|
|
189
|
-
/**
|
|
190
|
-
* Update content and re-render.
|
|
191
|
-
*
|
|
192
|
-
* @param content - New content string
|
|
193
|
-
*/
|
|
194
|
-
setContent(content: string): void;
|
|
195
|
-
}
|
|
196
|
-
export {};
|
|
197
|
-
//# sourceMappingURL=base-element.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-element.d.ts","sourceRoot":"","sources":["../../../../src/web-components/core/base-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAOrC,QAAA,MAAM,eAAe;;;CAWoB,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,QAAQ;IACzC,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5B,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,QAAQ,GAAG,OAAO;IACvD,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,8BAAsB,WAAW,CAAC,QAAQ,CAAE,SAAQ,eAAe;IACjE;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAEhE,6BAA6B;IAC7B,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAM;IAE3C,uDAAuD;IACvD,SAAS,CAAC,QAAQ,SAAM;IAExB,kDAAkD;IAClD,OAAO,CAAC,UAAU,CAAS;IAE3B,iDAAiD;IACjD,OAAO,CAAC,cAAc,CAAS;IAE/B,2CAA2C;IAC3C,OAAO,CAAC,sBAAsB,CAAS;IAMvC;;;;;;;;OAQG;IACH,iBAAiB,IAAI,IAAI;IA8BzB;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAI5B;;;OAGG;IACH,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAe9F;;;;;;;;OAQG;IACH,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,EAGnC;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,CAE/B;IAMD;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IASlC;;;OAGG;IACH,SAAS,CAAC,eAAe,IAAI,IAAI;IAYjC;;;OAGG;IACH,OAAO,CAAC,OAAO;IAyCf;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAMzE;;;;;;;;OAQG;IACI,OAAO,IAAI,IAAI;IAMtB;;;;;;;;;;;OAWG;IACI,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,KAAK,CAAC,GAAG,IAAI;IAI/D;;;;OAIG;IACI,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAIzC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file core/index.ts
|
|
3
|
-
* @description Core utilities for FrontMCP Web Components.
|
|
4
|
-
*
|
|
5
|
-
* @module @frontmcp/ui/web-components/core
|
|
6
|
-
*/
|
|
7
|
-
export { FmcpElement, type FmcpElementConfig, type FmcpRenderEventDetail } from './base-element';
|
|
8
|
-
export { parseAttributeValue, kebabToCamel, camelToKebab, getObservedAttributesFromSchema, mergeAttributeIntoOptions, type ParsedAttribute, } from './attribute-parser';
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/web-components/core/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEjG,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,+BAA+B,EAC/B,yBAAyB,EACzB,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file fmcp-alert.ts
|
|
3
|
-
* @description FrontMCP Alert Web Component.
|
|
4
|
-
*
|
|
5
|
-
* A custom element wrapper around the alert() HTML function.
|
|
6
|
-
*
|
|
7
|
-
* @example Basic usage
|
|
8
|
-
* ```html
|
|
9
|
-
* <fmcp-alert variant="success">Operation completed!</fmcp-alert>
|
|
10
|
-
* <fmcp-alert variant="danger" title="Error">Something went wrong</fmcp-alert>
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @example Dismissible alert
|
|
14
|
-
* ```html
|
|
15
|
-
* <fmcp-alert variant="info" dismissible>
|
|
16
|
-
* Click X to dismiss
|
|
17
|
-
* </fmcp-alert>
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @module @frontmcp/ui/web-components/elements/fmcp-alert
|
|
21
|
-
*/
|
|
22
|
-
import { FmcpElement, type FmcpElementConfig } from '../core';
|
|
23
|
-
import { type AlertOptions } from '../../components/alert';
|
|
24
|
-
/**
|
|
25
|
-
* FmcpAlert Web Component
|
|
26
|
-
*/
|
|
27
|
-
export declare class FmcpAlert extends FmcpElement<AlertOptions> {
|
|
28
|
-
protected readonly config: FmcpElementConfig<AlertOptions>;
|
|
29
|
-
static get observedAttributes(): string[];
|
|
30
|
-
protected renderHtml(options: AlertOptions, content: string): string;
|
|
31
|
-
set variant(value: AlertOptions['variant']);
|
|
32
|
-
get variant(): AlertOptions['variant'];
|
|
33
|
-
set alertTitle(value: string | undefined);
|
|
34
|
-
get alertTitle(): string | undefined;
|
|
35
|
-
set showIcon(value: boolean);
|
|
36
|
-
get showIcon(): boolean;
|
|
37
|
-
set dismissible(value: boolean);
|
|
38
|
-
get dismissible(): boolean;
|
|
39
|
-
set actions(value: string | undefined);
|
|
40
|
-
get actions(): string | undefined;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Register the fmcp-alert custom element.
|
|
44
|
-
*/
|
|
45
|
-
export declare function registerFmcpAlert(): void;
|
|
46
|
-
//# sourceMappingURL=fmcp-alert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fmcp-alert.d.ts","sourceRoot":"","sources":["../../../../src/web-components/elements/fmcp-alert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAmC,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGlE;;GAEG;AACH,qBAAa,SAAU,SAAQ,WAAW,CAAC,YAAY,CAAC;IACtD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAOxD;IAEF,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAKpE,IAAI,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,EAGzC;IACD,IAAI,OAAO,IAAI,YAAY,CAAC,SAAS,CAAC,CAErC;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGvC;IACD,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAG1B;IACD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,WAAW,CAAC,KAAK,EAAE,OAAO,EAG7B;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGpC;IACD,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;CACF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file fmcp-badge.ts
|
|
3
|
-
* @description FrontMCP Badge Web Component.
|
|
4
|
-
*
|
|
5
|
-
* A custom element wrapper around the badge() HTML function.
|
|
6
|
-
*
|
|
7
|
-
* @example Basic usage
|
|
8
|
-
* ```html
|
|
9
|
-
* <fmcp-badge>Default</fmcp-badge>
|
|
10
|
-
* <fmcp-badge variant="success">Active</fmcp-badge>
|
|
11
|
-
* <fmcp-badge variant="danger" pill>Error</fmcp-badge>
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @example Removable badge
|
|
15
|
-
* ```html
|
|
16
|
-
* <fmcp-badge removable>Tag</fmcp-badge>
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @module @frontmcp/ui/web-components/elements/fmcp-badge
|
|
20
|
-
*/
|
|
21
|
-
import { FmcpElement, type FmcpElementConfig } from '../core';
|
|
22
|
-
import { type BadgeOptions } from '../../components/badge';
|
|
23
|
-
/**
|
|
24
|
-
* FmcpBadge Web Component
|
|
25
|
-
*/
|
|
26
|
-
export declare class FmcpBadge extends FmcpElement<BadgeOptions> {
|
|
27
|
-
protected readonly config: FmcpElementConfig<BadgeOptions>;
|
|
28
|
-
static get observedAttributes(): string[];
|
|
29
|
-
protected renderHtml(options: BadgeOptions, content: string): string;
|
|
30
|
-
set variant(value: BadgeOptions['variant']);
|
|
31
|
-
get variant(): BadgeOptions['variant'];
|
|
32
|
-
set size(value: BadgeOptions['size']);
|
|
33
|
-
get size(): BadgeOptions['size'];
|
|
34
|
-
set pill(value: boolean);
|
|
35
|
-
get pill(): boolean;
|
|
36
|
-
set dot(value: boolean);
|
|
37
|
-
get dot(): boolean;
|
|
38
|
-
set removable(value: boolean);
|
|
39
|
-
get removable(): boolean;
|
|
40
|
-
set icon(value: string | undefined);
|
|
41
|
-
get icon(): string | undefined;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Register the fmcp-badge custom element.
|
|
45
|
-
*/
|
|
46
|
-
export declare function registerFmcpBadge(): void;
|
|
47
|
-
//# sourceMappingURL=fmcp-badge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fmcp-badge.d.ts","sourceRoot":"","sources":["../../../../src/web-components/elements/fmcp-badge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAmC,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGlE;;GAEG;AACH,qBAAa,SAAU,SAAQ,WAAW,CAAC,YAAY,CAAC;IACtD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAOxD;IAEF,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAKpE,IAAI,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,EAGzC;IACD,IAAI,OAAO,IAAI,YAAY,CAAC,SAAS,CAAC,CAErC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,EAGnC;IACD,IAAI,IAAI,IAAI,YAAY,CAAC,MAAM,CAAC,CAE/B;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,EAGtB;IACD,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,IAAI,GAAG,CAAC,KAAK,EAAE,OAAO,EAGrB;IACD,IAAI,GAAG,IAAI,OAAO,CAEjB;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAG3B;IACD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGjC;IACD,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;CACF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file fmcp-button.ts
|
|
3
|
-
* @description FrontMCP Button Web Component.
|
|
4
|
-
*
|
|
5
|
-
* A custom element wrapper around the button() HTML function.
|
|
6
|
-
* Works natively in React, Vue, Angular, and plain HTML.
|
|
7
|
-
*
|
|
8
|
-
* @example Basic usage
|
|
9
|
-
* ```html
|
|
10
|
-
* <fmcp-button>Click Me</fmcp-button>
|
|
11
|
-
* <fmcp-button variant="danger">Delete</fmcp-button>
|
|
12
|
-
* <fmcp-button disabled>Disabled</fmcp-button>
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* @example In React
|
|
16
|
-
* ```tsx
|
|
17
|
-
* import { registerFmcpButton } from '@frontmcp/ui/web-components';
|
|
18
|
-
* registerFmcpButton();
|
|
19
|
-
*
|
|
20
|
-
* function App() {
|
|
21
|
-
* return (
|
|
22
|
-
* <fmcp-button variant="primary" onClick={handleClick}>
|
|
23
|
-
* Click Me
|
|
24
|
-
* </fmcp-button>
|
|
25
|
-
* );
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @module @frontmcp/ui/web-components/elements/fmcp-button
|
|
30
|
-
*/
|
|
31
|
-
import { FmcpElement, type FmcpElementConfig } from '../core';
|
|
32
|
-
import { type ButtonOptions } from '../../components/button';
|
|
33
|
-
/**
|
|
34
|
-
* FmcpButton Web Component
|
|
35
|
-
*
|
|
36
|
-
* Attributes:
|
|
37
|
-
* - `variant` - 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'success' | 'link'
|
|
38
|
-
* - `size` - 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
39
|
-
* - `type` - 'button' | 'submit' | 'reset'
|
|
40
|
-
* - `disabled` - boolean (presence = true)
|
|
41
|
-
* - `loading` - boolean
|
|
42
|
-
* - `full-width` - boolean
|
|
43
|
-
* - `icon-only` - boolean
|
|
44
|
-
* - `href` - URL for link-style buttons
|
|
45
|
-
* - `target` - '_blank' | '_self'
|
|
46
|
-
*
|
|
47
|
-
* Properties (for React/Vue):
|
|
48
|
-
* - All attributes can be set as properties
|
|
49
|
-
* - `options` - Set all options at once
|
|
50
|
-
*
|
|
51
|
-
* Events:
|
|
52
|
-
* - `fmcp:render` - Fired after render with { options } detail
|
|
53
|
-
* - `fmcp:click` - Fired on button click with { options } detail
|
|
54
|
-
*/
|
|
55
|
-
export declare class FmcpButton extends FmcpElement<ButtonOptions> {
|
|
56
|
-
protected readonly config: FmcpElementConfig<ButtonOptions>;
|
|
57
|
-
/**
|
|
58
|
-
* Attributes to observe for changes.
|
|
59
|
-
*/
|
|
60
|
-
static get observedAttributes(): string[];
|
|
61
|
-
/**
|
|
62
|
-
* Render the button HTML using the button() function.
|
|
63
|
-
*/
|
|
64
|
-
protected renderHtml(options: ButtonOptions, content: string): string;
|
|
65
|
-
set variant(value: ButtonOptions['variant']);
|
|
66
|
-
get variant(): ButtonOptions['variant'];
|
|
67
|
-
set size(value: ButtonOptions['size']);
|
|
68
|
-
get size(): ButtonOptions['size'];
|
|
69
|
-
set type(value: ButtonOptions['type']);
|
|
70
|
-
get type(): ButtonOptions['type'];
|
|
71
|
-
set disabled(value: boolean);
|
|
72
|
-
get disabled(): boolean;
|
|
73
|
-
set loading(value: boolean);
|
|
74
|
-
get loading(): boolean;
|
|
75
|
-
set fullWidth(value: boolean);
|
|
76
|
-
get fullWidth(): boolean;
|
|
77
|
-
set iconOnly(value: boolean);
|
|
78
|
-
get iconOnly(): boolean;
|
|
79
|
-
set iconBefore(value: string | undefined);
|
|
80
|
-
get iconBefore(): string | undefined;
|
|
81
|
-
set iconAfter(value: string | undefined);
|
|
82
|
-
get iconAfter(): string | undefined;
|
|
83
|
-
set href(value: string | undefined);
|
|
84
|
-
get href(): string | undefined;
|
|
85
|
-
set buttonAriaLabel(value: string | undefined);
|
|
86
|
-
get buttonAriaLabel(): string | undefined;
|
|
87
|
-
connectedCallback(): void;
|
|
88
|
-
private _handleClick;
|
|
89
|
-
/**
|
|
90
|
-
* Focus the inner button element.
|
|
91
|
-
*/
|
|
92
|
-
focus(): void;
|
|
93
|
-
/**
|
|
94
|
-
* Blur the inner button element.
|
|
95
|
-
*/
|
|
96
|
-
blur(): void;
|
|
97
|
-
/**
|
|
98
|
-
* Click the inner button programmatically.
|
|
99
|
-
*/
|
|
100
|
-
click(): void;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Register the fmcp-button custom element.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```typescript
|
|
107
|
-
* import { registerFmcpButton } from '@frontmcp/ui/web-components';
|
|
108
|
-
*
|
|
109
|
-
* // Register once on app startup
|
|
110
|
-
* registerFmcpButton();
|
|
111
|
-
*
|
|
112
|
-
* // Then use in HTML
|
|
113
|
-
* // <fmcp-button variant="primary">Click</fmcp-button>
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
export declare function registerFmcpButton(): void;
|
|
117
|
-
//# sourceMappingURL=fmcp-button.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fmcp-button.d.ts","sourceRoot":"","sources":["../../../../src/web-components/elements/fmcp-button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAmC,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,UAAW,SAAQ,WAAW,CAAC,aAAa,CAAC;IACxD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAQzD;IAEF;;OAEG;IACH,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAQrE,IAAI,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,EAG1C;IACD,IAAI,OAAO,IAAI,aAAa,CAAC,SAAS,CAAC,CAEtC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAGpC;IACD,IAAI,IAAI,IAAI,aAAa,CAAC,MAAM,CAAC,CAEhC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAGpC;IACD,IAAI,IAAI,IAAI,aAAa,CAAC,MAAM,CAAC,CAEhC;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAG1B;IACD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;IACD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAG3B;IACD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAG1B;IACD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGvC;IACD,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGtC;IACD,IAAI,SAAS,IAAI,MAAM,GAAG,SAAS,CAElC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGjC;IACD,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAG5C;IACD,IAAI,eAAe,IAAI,MAAM,GAAG,SAAS,CAExC;IAMQ,iBAAiB,IAAI,IAAI;IAOlC,OAAO,CAAC,YAAY;IAiBpB;;OAEG;IACa,KAAK,IAAI,IAAI;IAK7B;;OAEG;IACa,IAAI,IAAI,IAAI;IAK5B;;OAEG;IACa,KAAK,IAAI,IAAI;CAI9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file fmcp-card.ts
|
|
3
|
-
* @description FrontMCP Card Web Component.
|
|
4
|
-
*
|
|
5
|
-
* A custom element wrapper around the card() HTML function.
|
|
6
|
-
*
|
|
7
|
-
* @example Basic usage
|
|
8
|
-
* ```html
|
|
9
|
-
* <fmcp-card title="Welcome" subtitle="Description">
|
|
10
|
-
* <p>Card content goes here</p>
|
|
11
|
-
* </fmcp-card>
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @example Clickable card
|
|
15
|
-
* ```html
|
|
16
|
-
* <fmcp-card clickable href="/details" title="Item">
|
|
17
|
-
* <p>Click to view details</p>
|
|
18
|
-
* </fmcp-card>
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @module @frontmcp/ui/web-components/elements/fmcp-card
|
|
22
|
-
*/
|
|
23
|
-
import { FmcpElement, type FmcpElementConfig } from '../core';
|
|
24
|
-
import { type CardOptions } from '../../components/card';
|
|
25
|
-
/**
|
|
26
|
-
* FmcpCard Web Component
|
|
27
|
-
*/
|
|
28
|
-
export declare class FmcpCard extends FmcpElement<CardOptions> {
|
|
29
|
-
protected readonly config: FmcpElementConfig<CardOptions>;
|
|
30
|
-
static get observedAttributes(): string[];
|
|
31
|
-
protected renderHtml(options: CardOptions, content: string): string;
|
|
32
|
-
set variant(value: CardOptions['variant']);
|
|
33
|
-
get variant(): CardOptions['variant'];
|
|
34
|
-
set size(value: CardOptions['size']);
|
|
35
|
-
get size(): CardOptions['size'];
|
|
36
|
-
set cardTitle(value: string | undefined);
|
|
37
|
-
get cardTitle(): string | undefined;
|
|
38
|
-
set subtitle(value: string | undefined);
|
|
39
|
-
get subtitle(): string | undefined;
|
|
40
|
-
set clickable(value: boolean);
|
|
41
|
-
get clickable(): boolean;
|
|
42
|
-
set href(value: string | undefined);
|
|
43
|
-
get href(): string | undefined;
|
|
44
|
-
set footer(value: string | undefined);
|
|
45
|
-
get footer(): string | undefined;
|
|
46
|
-
set headerActions(value: string | undefined);
|
|
47
|
-
get headerActions(): string | undefined;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Register the fmcp-card custom element.
|
|
51
|
-
*/
|
|
52
|
-
export declare function registerFmcpCard(): void;
|
|
53
|
-
//# sourceMappingURL=fmcp-card.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fmcp-card.d.ts","sourceRoot":"","sources":["../../../../src/web-components/elements/fmcp-card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAmC,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG/D;;GAEG;AACH,qBAAa,QAAS,SAAQ,WAAW,CAAC,WAAW,CAAC;IACpD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAOvD;IAEF,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAKnE,IAAI,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,EAGxC;IACD,IAAI,OAAO,IAAI,WAAW,CAAC,SAAS,CAAC,CAEpC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAGlC;IACD,IAAI,IAAI,IAAI,WAAW,CAAC,MAAM,CAAC,CAE9B;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGtC;IACD,IAAI,SAAS,IAAI,MAAM,GAAG,SAAS,CAElC;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGrC;IACD,IAAI,QAAQ,IAAI,MAAM,GAAG,SAAS,CAEjC;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAG3B;IACD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGjC;IACD,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAGnC;IACD,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAED,IAAI,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAG1C;IACD,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;CACF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC"}
|