@frontmcp/ui 0.5.0

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.
Files changed (393) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +438 -0
  3. package/package.json +147 -0
  4. package/src/adapters/index.d.ts +10 -0
  5. package/src/adapters/index.js +18 -0
  6. package/src/adapters/index.js.map +1 -0
  7. package/src/adapters/platform-meta.d.ts +165 -0
  8. package/src/adapters/platform-meta.js +310 -0
  9. package/src/adapters/platform-meta.js.map +1 -0
  10. package/src/base-template/bridge.d.ts +89 -0
  11. package/src/base-template/bridge.js +452 -0
  12. package/src/base-template/bridge.js.map +1 -0
  13. package/src/base-template/default-base-template.d.ts +91 -0
  14. package/src/base-template/default-base-template.js +435 -0
  15. package/src/base-template/default-base-template.js.map +1 -0
  16. package/src/base-template/index.d.ts +14 -0
  17. package/src/base-template/index.js +30 -0
  18. package/src/base-template/index.js.map +1 -0
  19. package/src/base-template/polyfills.d.ts +30 -0
  20. package/src/base-template/polyfills.js +190 -0
  21. package/src/base-template/polyfills.js.map +1 -0
  22. package/src/base-template/theme-styles.d.ts +73 -0
  23. package/src/base-template/theme-styles.js +95 -0
  24. package/src/base-template/theme-styles.js.map +1 -0
  25. package/src/bridge/adapters/base-adapter.d.ts +103 -0
  26. package/src/bridge/adapters/base-adapter.js +314 -0
  27. package/src/bridge/adapters/base-adapter.js.map +1 -0
  28. package/src/bridge/adapters/claude.adapter.d.ts +66 -0
  29. package/src/bridge/adapters/claude.adapter.js +145 -0
  30. package/src/bridge/adapters/claude.adapter.js.map +1 -0
  31. package/src/bridge/adapters/ext-apps.adapter.d.ts +142 -0
  32. package/src/bridge/adapters/ext-apps.adapter.js +416 -0
  33. package/src/bridge/adapters/ext-apps.adapter.js.map +1 -0
  34. package/src/bridge/adapters/gemini.adapter.d.ts +63 -0
  35. package/src/bridge/adapters/gemini.adapter.js +160 -0
  36. package/src/bridge/adapters/gemini.adapter.js.map +1 -0
  37. package/src/bridge/adapters/generic.adapter.d.ts +55 -0
  38. package/src/bridge/adapters/generic.adapter.js +108 -0
  39. package/src/bridge/adapters/generic.adapter.js.map +1 -0
  40. package/src/bridge/adapters/index.d.ts +25 -0
  41. package/src/bridge/adapters/index.js +65 -0
  42. package/src/bridge/adapters/index.js.map +1 -0
  43. package/src/bridge/adapters/openai.adapter.d.ts +64 -0
  44. package/src/bridge/adapters/openai.adapter.js +194 -0
  45. package/src/bridge/adapters/openai.adapter.js.map +1 -0
  46. package/src/bridge/core/adapter-registry.d.ts +121 -0
  47. package/src/bridge/core/adapter-registry.js +271 -0
  48. package/src/bridge/core/adapter-registry.js.map +1 -0
  49. package/src/bridge/core/bridge-factory.d.ts +198 -0
  50. package/src/bridge/core/bridge-factory.js +428 -0
  51. package/src/bridge/core/bridge-factory.js.map +1 -0
  52. package/src/bridge/core/index.d.ts +9 -0
  53. package/src/bridge/core/index.js +22 -0
  54. package/src/bridge/core/index.js.map +1 -0
  55. package/src/bridge/index.d.ts +61 -0
  56. package/src/bridge/index.js +94 -0
  57. package/src/bridge/index.js.map +1 -0
  58. package/src/bridge/runtime/iife-generator.d.ts +61 -0
  59. package/src/bridge/runtime/iife-generator.js +940 -0
  60. package/src/bridge/runtime/iife-generator.js.map +1 -0
  61. package/src/bridge/runtime/index.d.ts +8 -0
  62. package/src/bridge/runtime/index.js +16 -0
  63. package/src/bridge/runtime/index.js.map +1 -0
  64. package/src/bridge/types.d.ts +385 -0
  65. package/src/bridge/types.js +11 -0
  66. package/src/bridge/types.js.map +1 -0
  67. package/src/build/cdn-resources.d.ts +140 -0
  68. package/src/build/cdn-resources.js +314 -0
  69. package/src/build/cdn-resources.js.map +1 -0
  70. package/src/build/index.d.ts +294 -0
  71. package/src/build/index.js +325 -0
  72. package/src/build/index.js.map +1 -0
  73. package/src/build/widget-manifest.d.ts +212 -0
  74. package/src/build/widget-manifest.js +652 -0
  75. package/src/build/widget-manifest.js.map +1 -0
  76. package/src/bundler/bundler.d.ts +110 -0
  77. package/src/bundler/bundler.js +432 -0
  78. package/src/bundler/bundler.js.map +1 -0
  79. package/src/bundler/cache.d.ts +172 -0
  80. package/src/bundler/cache.js +250 -0
  81. package/src/bundler/cache.js.map +1 -0
  82. package/src/bundler/index.d.ts +41 -0
  83. package/src/bundler/index.js +73 -0
  84. package/src/bundler/index.js.map +1 -0
  85. package/src/bundler/sandbox/enclave-adapter.d.ts +120 -0
  86. package/src/bundler/sandbox/enclave-adapter.js +339 -0
  87. package/src/bundler/sandbox/enclave-adapter.js.map +1 -0
  88. package/src/bundler/sandbox/executor.d.ts +13 -0
  89. package/src/bundler/sandbox/executor.js +22 -0
  90. package/src/bundler/sandbox/executor.js.map +1 -0
  91. package/src/bundler/sandbox/policy.d.ts +61 -0
  92. package/src/bundler/sandbox/policy.js +238 -0
  93. package/src/bundler/sandbox/policy.js.map +1 -0
  94. package/src/bundler/types.d.ts +347 -0
  95. package/src/bundler/types.js +132 -0
  96. package/src/bundler/types.js.map +1 -0
  97. package/src/components/alert.d.ts +71 -0
  98. package/src/components/alert.js +189 -0
  99. package/src/components/alert.js.map +1 -0
  100. package/src/components/alert.schema.d.ts +114 -0
  101. package/src/components/alert.schema.js +105 -0
  102. package/src/components/alert.schema.js.map +1 -0
  103. package/src/components/avatar.d.ts +76 -0
  104. package/src/components/avatar.js +176 -0
  105. package/src/components/avatar.js.map +1 -0
  106. package/src/components/avatar.schema.d.ts +169 -0
  107. package/src/components/avatar.schema.js +103 -0
  108. package/src/components/avatar.schema.js.map +1 -0
  109. package/src/components/badge.d.ts +70 -0
  110. package/src/components/badge.js +149 -0
  111. package/src/components/badge.js.map +1 -0
  112. package/src/components/badge.schema.d.ts +109 -0
  113. package/src/components/badge.schema.js +96 -0
  114. package/src/components/badge.schema.js.map +1 -0
  115. package/src/components/button.d.ts +111 -0
  116. package/src/components/button.js +336 -0
  117. package/src/components/button.js.map +1 -0
  118. package/src/components/button.schema.d.ts +148 -0
  119. package/src/components/button.schema.js +121 -0
  120. package/src/components/button.schema.js.map +1 -0
  121. package/src/components/card.d.ts +60 -0
  122. package/src/components/card.js +117 -0
  123. package/src/components/card.js.map +1 -0
  124. package/src/components/card.schema.d.ts +113 -0
  125. package/src/components/card.schema.js +98 -0
  126. package/src/components/card.schema.js.map +1 -0
  127. package/src/components/form.d.ts +239 -0
  128. package/src/components/form.js +420 -0
  129. package/src/components/form.js.map +1 -0
  130. package/src/components/form.schema.d.ts +441 -0
  131. package/src/components/form.schema.js +406 -0
  132. package/src/components/form.schema.js.map +1 -0
  133. package/src/components/index.d.ts +29 -0
  134. package/src/components/index.js +98 -0
  135. package/src/components/index.js.map +1 -0
  136. package/src/components/list.d.ts +127 -0
  137. package/src/components/list.js +279 -0
  138. package/src/components/list.js.map +1 -0
  139. package/src/components/list.schema.d.ts +134 -0
  140. package/src/components/list.schema.js +168 -0
  141. package/src/components/list.schema.js.map +1 -0
  142. package/src/components/modal.d.ts +111 -0
  143. package/src/components/modal.js +260 -0
  144. package/src/components/modal.js.map +1 -0
  145. package/src/components/modal.schema.d.ts +186 -0
  146. package/src/components/modal.schema.js +167 -0
  147. package/src/components/modal.schema.js.map +1 -0
  148. package/src/components/table.d.ts +105 -0
  149. package/src/components/table.js +283 -0
  150. package/src/components/table.js.map +1 -0
  151. package/src/components/table.schema.d.ts +159 -0
  152. package/src/components/table.schema.js +173 -0
  153. package/src/components/table.schema.js.map +1 -0
  154. package/src/handlebars/helpers.d.ts +348 -0
  155. package/src/handlebars/helpers.js +605 -0
  156. package/src/handlebars/helpers.js.map +1 -0
  157. package/src/handlebars/index.d.ts +193 -0
  158. package/src/handlebars/index.js +350 -0
  159. package/src/handlebars/index.js.map +1 -0
  160. package/src/index.d.ts +50 -0
  161. package/src/index.js +192 -0
  162. package/src/index.js.map +1 -0
  163. package/src/layouts/base.d.ts +88 -0
  164. package/src/layouts/base.js +227 -0
  165. package/src/layouts/base.js.map +1 -0
  166. package/src/layouts/index.d.ts +7 -0
  167. package/src/layouts/index.js +25 -0
  168. package/src/layouts/index.js.map +1 -0
  169. package/src/layouts/presets.d.ts +133 -0
  170. package/src/layouts/presets.js +277 -0
  171. package/src/layouts/presets.js.map +1 -0
  172. package/src/pages/consent.d.ts +116 -0
  173. package/src/pages/consent.js +218 -0
  174. package/src/pages/consent.js.map +1 -0
  175. package/src/pages/error.d.ts +100 -0
  176. package/src/pages/error.js +263 -0
  177. package/src/pages/error.js.map +1 -0
  178. package/src/pages/index.d.ts +8 -0
  179. package/src/pages/index.js +27 -0
  180. package/src/pages/index.js.map +1 -0
  181. package/src/react/Alert.d.ts +101 -0
  182. package/src/react/Alert.js +51 -0
  183. package/src/react/Alert.js.map +1 -0
  184. package/src/react/Badge.d.ts +100 -0
  185. package/src/react/Badge.js +55 -0
  186. package/src/react/Badge.js.map +1 -0
  187. package/src/react/Button.d.ts +108 -0
  188. package/src/react/Button.js +52 -0
  189. package/src/react/Button.js.map +1 -0
  190. package/src/react/Card.d.ts +103 -0
  191. package/src/react/Card.js +55 -0
  192. package/src/react/Card.js.map +1 -0
  193. package/src/react/hooks/context.d.ts +178 -0
  194. package/src/react/hooks/context.js +287 -0
  195. package/src/react/hooks/context.js.map +1 -0
  196. package/src/react/hooks/index.d.ts +41 -0
  197. package/src/react/hooks/index.js +61 -0
  198. package/src/react/hooks/index.js.map +1 -0
  199. package/src/react/hooks/tools.d.ts +283 -0
  200. package/src/react/hooks/tools.js +465 -0
  201. package/src/react/hooks/tools.js.map +1 -0
  202. package/src/react/index.d.ts +80 -0
  203. package/src/react/index.js +113 -0
  204. package/src/react/index.js.map +1 -0
  205. package/src/react/types.d.ts +105 -0
  206. package/src/react/types.js +12 -0
  207. package/src/react/types.js.map +1 -0
  208. package/src/react/utils.d.ts +42 -0
  209. package/src/react/utils.js +99 -0
  210. package/src/react/utils.js.map +1 -0
  211. package/src/registry/index.d.ts +45 -0
  212. package/src/registry/index.js +67 -0
  213. package/src/registry/index.js.map +1 -0
  214. package/src/registry/render-template.d.ts +86 -0
  215. package/src/registry/render-template.js +239 -0
  216. package/src/registry/render-template.js.map +1 -0
  217. package/src/registry/tool-ui.registry.d.ts +260 -0
  218. package/src/registry/tool-ui.registry.js +438 -0
  219. package/src/registry/tool-ui.registry.js.map +1 -0
  220. package/src/registry/uri-utils.d.ts +55 -0
  221. package/src/registry/uri-utils.js +97 -0
  222. package/src/registry/uri-utils.js.map +1 -0
  223. package/src/render/index.d.ts +7 -0
  224. package/src/render/index.js +14 -0
  225. package/src/render/index.js.map +1 -0
  226. package/src/render/prerender.d.ts +56 -0
  227. package/src/render/prerender.js +98 -0
  228. package/src/render/prerender.js.map +1 -0
  229. package/src/renderers/cache.d.ts +144 -0
  230. package/src/renderers/cache.js +240 -0
  231. package/src/renderers/cache.js.map +1 -0
  232. package/src/renderers/html.renderer.d.ts +122 -0
  233. package/src/renderers/html.renderer.js +204 -0
  234. package/src/renderers/html.renderer.js.map +1 -0
  235. package/src/renderers/index.d.ts +35 -0
  236. package/src/renderers/index.js +70 -0
  237. package/src/renderers/index.js.map +1 -0
  238. package/src/renderers/mdx.renderer.d.ts +119 -0
  239. package/src/renderers/mdx.renderer.js +305 -0
  240. package/src/renderers/mdx.renderer.js.map +1 -0
  241. package/src/renderers/react.renderer.d.ts +95 -0
  242. package/src/renderers/react.renderer.js +260 -0
  243. package/src/renderers/react.renderer.js.map +1 -0
  244. package/src/renderers/registry.d.ts +133 -0
  245. package/src/renderers/registry.js +232 -0
  246. package/src/renderers/registry.js.map +1 -0
  247. package/src/renderers/types.d.ts +341 -0
  248. package/src/renderers/types.js +9 -0
  249. package/src/renderers/types.js.map +1 -0
  250. package/src/renderers/utils/detect.d.ts +106 -0
  251. package/src/renderers/utils/detect.js +267 -0
  252. package/src/renderers/utils/detect.js.map +1 -0
  253. package/src/renderers/utils/hash.d.ts +39 -0
  254. package/src/renderers/utils/hash.js +75 -0
  255. package/src/renderers/utils/hash.js.map +1 -0
  256. package/src/renderers/utils/index.d.ts +8 -0
  257. package/src/renderers/utils/index.js +28 -0
  258. package/src/renderers/utils/index.js.map +1 -0
  259. package/src/renderers/utils/transpiler.d.ts +88 -0
  260. package/src/renderers/utils/transpiler.js +215 -0
  261. package/src/renderers/utils/transpiler.js.map +1 -0
  262. package/src/runtime/adapters/html.adapter.d.ts +58 -0
  263. package/src/runtime/adapters/html.adapter.js +131 -0
  264. package/src/runtime/adapters/html.adapter.js.map +1 -0
  265. package/src/runtime/adapters/index.d.ts +25 -0
  266. package/src/runtime/adapters/index.js +54 -0
  267. package/src/runtime/adapters/index.js.map +1 -0
  268. package/src/runtime/adapters/mdx.adapter.d.ts +72 -0
  269. package/src/runtime/adapters/mdx.adapter.js +241 -0
  270. package/src/runtime/adapters/mdx.adapter.js.map +1 -0
  271. package/src/runtime/adapters/react.adapter.d.ts +69 -0
  272. package/src/runtime/adapters/react.adapter.js +245 -0
  273. package/src/runtime/adapters/react.adapter.js.map +1 -0
  274. package/src/runtime/adapters/types.d.ts +94 -0
  275. package/src/runtime/adapters/types.js +11 -0
  276. package/src/runtime/adapters/types.js.map +1 -0
  277. package/src/runtime/csp.d.ts +37 -0
  278. package/src/runtime/csp.js +140 -0
  279. package/src/runtime/csp.js.map +1 -0
  280. package/src/runtime/index.d.ts +16 -0
  281. package/src/runtime/index.js +72 -0
  282. package/src/runtime/index.js.map +1 -0
  283. package/src/runtime/mcp-bridge.d.ts +100 -0
  284. package/src/runtime/mcp-bridge.js +581 -0
  285. package/src/runtime/mcp-bridge.js.map +1 -0
  286. package/src/runtime/renderer-runtime.d.ts +132 -0
  287. package/src/runtime/renderer-runtime.js +389 -0
  288. package/src/runtime/renderer-runtime.js.map +1 -0
  289. package/src/runtime/sanitizer.d.ts +171 -0
  290. package/src/runtime/sanitizer.js +318 -0
  291. package/src/runtime/sanitizer.js.map +1 -0
  292. package/src/runtime/types.d.ts +414 -0
  293. package/src/runtime/types.js +12 -0
  294. package/src/runtime/types.js.map +1 -0
  295. package/src/runtime/wrapper.d.ts +375 -0
  296. package/src/runtime/wrapper.js +1793 -0
  297. package/src/runtime/wrapper.js.map +1 -0
  298. package/src/styles/index.d.ts +7 -0
  299. package/src/styles/index.js +11 -0
  300. package/src/styles/index.js.map +1 -0
  301. package/src/styles/variants.d.ts +50 -0
  302. package/src/styles/variants.js +175 -0
  303. package/src/styles/variants.js.map +1 -0
  304. package/src/theme/cdn.d.ts +194 -0
  305. package/src/theme/cdn.js +375 -0
  306. package/src/theme/cdn.js.map +1 -0
  307. package/src/theme/index.d.ts +17 -0
  308. package/src/theme/index.js +57 -0
  309. package/src/theme/index.js.map +1 -0
  310. package/src/theme/platforms.d.ts +106 -0
  311. package/src/theme/platforms.js +161 -0
  312. package/src/theme/platforms.js.map +1 -0
  313. package/src/theme/presets/github-openai.d.ts +49 -0
  314. package/src/theme/presets/github-openai.js +189 -0
  315. package/src/theme/presets/github-openai.js.map +1 -0
  316. package/src/theme/presets/index.d.ts +10 -0
  317. package/src/theme/presets/index.js +17 -0
  318. package/src/theme/presets/index.js.map +1 -0
  319. package/src/theme/theme.d.ts +395 -0
  320. package/src/theme/theme.js +332 -0
  321. package/src/theme/theme.js.map +1 -0
  322. package/src/tool-template/builder.d.ts +212 -0
  323. package/src/tool-template/builder.js +397 -0
  324. package/src/tool-template/builder.js.map +1 -0
  325. package/src/tool-template/index.d.ts +15 -0
  326. package/src/tool-template/index.js +38 -0
  327. package/src/tool-template/index.js.map +1 -0
  328. package/src/types/index.d.ts +13 -0
  329. package/src/types/index.js +26 -0
  330. package/src/types/index.js.map +1 -0
  331. package/src/types/ui-config.d.ts +357 -0
  332. package/src/types/ui-config.js +12 -0
  333. package/src/types/ui-config.js.map +1 -0
  334. package/src/types/ui-runtime.d.ts +965 -0
  335. package/src/types/ui-runtime.js +117 -0
  336. package/src/types/ui-runtime.js.map +1 -0
  337. package/src/validation/error-box.d.ts +55 -0
  338. package/src/validation/error-box.js +75 -0
  339. package/src/validation/error-box.js.map +1 -0
  340. package/src/validation/index.d.ts +12 -0
  341. package/src/validation/index.js +21 -0
  342. package/src/validation/index.js.map +1 -0
  343. package/src/validation/wrapper.d.ts +96 -0
  344. package/src/validation/wrapper.js +117 -0
  345. package/src/validation/wrapper.js.map +1 -0
  346. package/src/web-components/core/attribute-parser.d.ts +85 -0
  347. package/src/web-components/core/attribute-parser.js +189 -0
  348. package/src/web-components/core/attribute-parser.js.map +1 -0
  349. package/src/web-components/core/base-element.d.ts +197 -0
  350. package/src/web-components/core/base-element.js +289 -0
  351. package/src/web-components/core/base-element.js.map +1 -0
  352. package/src/web-components/core/index.d.ts +8 -0
  353. package/src/web-components/core/index.js +18 -0
  354. package/src/web-components/core/index.js.map +1 -0
  355. package/src/web-components/elements/fmcp-alert.d.ts +45 -0
  356. package/src/web-components/elements/fmcp-alert.js +93 -0
  357. package/src/web-components/elements/fmcp-alert.js.map +1 -0
  358. package/src/web-components/elements/fmcp-badge.d.ts +46 -0
  359. package/src/web-components/elements/fmcp-badge.js +99 -0
  360. package/src/web-components/elements/fmcp-badge.js.map +1 -0
  361. package/src/web-components/elements/fmcp-button.d.ts +124 -0
  362. package/src/web-components/elements/fmcp-button.js +233 -0
  363. package/src/web-components/elements/fmcp-button.js.map +1 -0
  364. package/src/web-components/elements/fmcp-card.d.ts +52 -0
  365. package/src/web-components/elements/fmcp-card.js +115 -0
  366. package/src/web-components/elements/fmcp-card.js.map +1 -0
  367. package/src/web-components/elements/fmcp-input.d.ts +95 -0
  368. package/src/web-components/elements/fmcp-input.js +248 -0
  369. package/src/web-components/elements/fmcp-input.js.map +1 -0
  370. package/src/web-components/elements/fmcp-select.d.ts +99 -0
  371. package/src/web-components/elements/fmcp-select.js +243 -0
  372. package/src/web-components/elements/fmcp-select.js.map +1 -0
  373. package/src/web-components/elements/index.d.ts +12 -0
  374. package/src/web-components/elements/index.js +34 -0
  375. package/src/web-components/elements/index.js.map +1 -0
  376. package/src/web-components/index.d.ts +49 -0
  377. package/src/web-components/index.js +75 -0
  378. package/src/web-components/index.js.map +1 -0
  379. package/src/web-components/register.d.ts +56 -0
  380. package/src/web-components/register.js +80 -0
  381. package/src/web-components/register.js.map +1 -0
  382. package/src/web-components/types.d.ts +121 -0
  383. package/src/web-components/types.js +25 -0
  384. package/src/web-components/types.js.map +1 -0
  385. package/src/widgets/index.d.ts +7 -0
  386. package/src/widgets/index.js +24 -0
  387. package/src/widgets/index.js.map +1 -0
  388. package/src/widgets/progress.d.ts +132 -0
  389. package/src/widgets/progress.js +303 -0
  390. package/src/widgets/progress.js.map +1 -0
  391. package/src/widgets/resource.d.ts +162 -0
  392. package/src/widgets/resource.js +340 -0
  393. package/src/widgets/resource.js.map +1 -0
@@ -0,0 +1,124 @@
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 With HTMX
16
+ * ```html
17
+ * <fmcp-button hx-post="/api/submit" hx-target="#result">
18
+ * Submit
19
+ * </fmcp-button>
20
+ * ```
21
+ *
22
+ * @example In React
23
+ * ```tsx
24
+ * import { registerFmcpButton } from '@frontmcp/ui/web-components';
25
+ * registerFmcpButton();
26
+ *
27
+ * function App() {
28
+ * return (
29
+ * <fmcp-button variant="primary" onClick={handleClick}>
30
+ * Click Me
31
+ * </fmcp-button>
32
+ * );
33
+ * }
34
+ * ```
35
+ *
36
+ * @module @frontmcp/ui/web-components/elements/fmcp-button
37
+ */
38
+ import { FmcpElement, type FmcpElementConfig } from '../core';
39
+ import { type ButtonOptions } from '../../components/button';
40
+ /**
41
+ * FmcpButton Web Component
42
+ *
43
+ * Attributes:
44
+ * - `variant` - 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'success' | 'link'
45
+ * - `size` - 'xs' | 'sm' | 'md' | 'lg' | 'xl'
46
+ * - `type` - 'button' | 'submit' | 'reset'
47
+ * - `disabled` - boolean (presence = true)
48
+ * - `loading` - boolean
49
+ * - `full-width` - boolean
50
+ * - `icon-only` - boolean
51
+ * - `href` - URL for link-style buttons
52
+ * - `target` - '_blank' | '_self'
53
+ * - `hx-get`, `hx-post`, etc. - HTMX attributes
54
+ *
55
+ * Properties (for React/Vue):
56
+ * - All attributes can be set as properties
57
+ * - `options` - Set all options at once
58
+ *
59
+ * Events:
60
+ * - `fmcp:render` - Fired after render with { options } detail
61
+ * - `fmcp:click` - Fired on button click with { options } detail
62
+ */
63
+ export declare class FmcpButton extends FmcpElement<ButtonOptions> {
64
+ protected readonly config: FmcpElementConfig<ButtonOptions>;
65
+ /**
66
+ * Attributes to observe for changes.
67
+ */
68
+ static get observedAttributes(): string[];
69
+ /**
70
+ * Render the button HTML using the button() function.
71
+ */
72
+ protected renderHtml(options: ButtonOptions, content: string): string;
73
+ set variant(value: ButtonOptions['variant']);
74
+ get variant(): ButtonOptions['variant'];
75
+ set size(value: ButtonOptions['size']);
76
+ get size(): ButtonOptions['size'];
77
+ set type(value: ButtonOptions['type']);
78
+ get type(): ButtonOptions['type'];
79
+ set disabled(value: boolean);
80
+ get disabled(): boolean;
81
+ set loading(value: boolean);
82
+ get loading(): boolean;
83
+ set fullWidth(value: boolean);
84
+ get fullWidth(): boolean;
85
+ set iconOnly(value: boolean);
86
+ get iconOnly(): boolean;
87
+ set iconBefore(value: string | undefined);
88
+ get iconBefore(): string | undefined;
89
+ set iconAfter(value: string | undefined);
90
+ get iconAfter(): string | undefined;
91
+ set href(value: string | undefined);
92
+ get href(): string | undefined;
93
+ set buttonAriaLabel(value: string | undefined);
94
+ get buttonAriaLabel(): string | undefined;
95
+ connectedCallback(): void;
96
+ private _handleClick;
97
+ /**
98
+ * Focus the inner button element.
99
+ */
100
+ focus(): void;
101
+ /**
102
+ * Blur the inner button element.
103
+ */
104
+ blur(): void;
105
+ /**
106
+ * Click the inner button programmatically.
107
+ */
108
+ click(): void;
109
+ }
110
+ /**
111
+ * Register the fmcp-button custom element.
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * import { registerFmcpButton } from '@frontmcp/ui/web-components';
116
+ *
117
+ * // Register once on app startup
118
+ * registerFmcpButton();
119
+ *
120
+ * // Then use in HTML
121
+ * // <fmcp-button variant="primary">Click</fmcp-button>
122
+ * ```
123
+ */
124
+ export declare function registerFmcpButton(): void;
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ /**
3
+ * @file fmcp-button.ts
4
+ * @description FrontMCP Button Web Component.
5
+ *
6
+ * A custom element wrapper around the button() HTML function.
7
+ * Works natively in React, Vue, Angular, and plain HTML.
8
+ *
9
+ * @example Basic usage
10
+ * ```html
11
+ * <fmcp-button>Click Me</fmcp-button>
12
+ * <fmcp-button variant="danger">Delete</fmcp-button>
13
+ * <fmcp-button disabled>Disabled</fmcp-button>
14
+ * ```
15
+ *
16
+ * @example With HTMX
17
+ * ```html
18
+ * <fmcp-button hx-post="/api/submit" hx-target="#result">
19
+ * Submit
20
+ * </fmcp-button>
21
+ * ```
22
+ *
23
+ * @example In React
24
+ * ```tsx
25
+ * import { registerFmcpButton } from '@frontmcp/ui/web-components';
26
+ * registerFmcpButton();
27
+ *
28
+ * function App() {
29
+ * return (
30
+ * <fmcp-button variant="primary" onClick={handleClick}>
31
+ * Click Me
32
+ * </fmcp-button>
33
+ * );
34
+ * }
35
+ * ```
36
+ *
37
+ * @module @frontmcp/ui/web-components/elements/fmcp-button
38
+ */
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.FmcpButton = void 0;
41
+ exports.registerFmcpButton = registerFmcpButton;
42
+ const core_1 = require("../core");
43
+ const button_1 = require("../../components/button");
44
+ const button_schema_1 = require("../../components/button.schema");
45
+ /**
46
+ * FmcpButton Web Component
47
+ *
48
+ * Attributes:
49
+ * - `variant` - 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'success' | 'link'
50
+ * - `size` - 'xs' | 'sm' | 'md' | 'lg' | 'xl'
51
+ * - `type` - 'button' | 'submit' | 'reset'
52
+ * - `disabled` - boolean (presence = true)
53
+ * - `loading` - boolean
54
+ * - `full-width` - boolean
55
+ * - `icon-only` - boolean
56
+ * - `href` - URL for link-style buttons
57
+ * - `target` - '_blank' | '_self'
58
+ * - `hx-get`, `hx-post`, etc. - HTMX attributes
59
+ *
60
+ * Properties (for React/Vue):
61
+ * - All attributes can be set as properties
62
+ * - `options` - Set all options at once
63
+ *
64
+ * Events:
65
+ * - `fmcp:render` - Fired after render with { options } detail
66
+ * - `fmcp:click` - Fired on button click with { options } detail
67
+ */
68
+ class FmcpButton extends core_1.FmcpElement {
69
+ config = {
70
+ name: 'button',
71
+ schema: button_schema_1.ButtonOptionsSchema,
72
+ defaults: {
73
+ variant: 'primary',
74
+ size: 'md',
75
+ type: 'button',
76
+ },
77
+ };
78
+ /**
79
+ * Attributes to observe for changes.
80
+ */
81
+ static get observedAttributes() {
82
+ return (0, core_1.getObservedAttributesFromSchema)(button_schema_1.ButtonOptionsSchema);
83
+ }
84
+ /**
85
+ * Render the button HTML using the button() function.
86
+ */
87
+ renderHtml(options, content) {
88
+ return (0, button_1.button)(content, options);
89
+ }
90
+ // ============================================
91
+ // Property Setters (Individual Props)
92
+ // ============================================
93
+ set variant(value) {
94
+ this._options.variant = value;
95
+ this._scheduleRender();
96
+ }
97
+ get variant() {
98
+ return this._options.variant;
99
+ }
100
+ set size(value) {
101
+ this._options.size = value;
102
+ this._scheduleRender();
103
+ }
104
+ get size() {
105
+ return this._options.size;
106
+ }
107
+ set type(value) {
108
+ this._options.type = value;
109
+ this._scheduleRender();
110
+ }
111
+ get type() {
112
+ return this._options.type;
113
+ }
114
+ set disabled(value) {
115
+ this._options.disabled = value;
116
+ this._scheduleRender();
117
+ }
118
+ get disabled() {
119
+ return this._options.disabled ?? false;
120
+ }
121
+ set loading(value) {
122
+ this._options.loading = value;
123
+ this._scheduleRender();
124
+ }
125
+ get loading() {
126
+ return this._options.loading ?? false;
127
+ }
128
+ set fullWidth(value) {
129
+ this._options.fullWidth = value;
130
+ this._scheduleRender();
131
+ }
132
+ get fullWidth() {
133
+ return this._options.fullWidth ?? false;
134
+ }
135
+ set iconOnly(value) {
136
+ this._options.iconOnly = value;
137
+ this._scheduleRender();
138
+ }
139
+ get iconOnly() {
140
+ return this._options.iconOnly ?? false;
141
+ }
142
+ set iconBefore(value) {
143
+ this._options.iconBefore = value;
144
+ this._scheduleRender();
145
+ }
146
+ get iconBefore() {
147
+ return this._options.iconBefore;
148
+ }
149
+ set iconAfter(value) {
150
+ this._options.iconAfter = value;
151
+ this._scheduleRender();
152
+ }
153
+ get iconAfter() {
154
+ return this._options.iconAfter;
155
+ }
156
+ set href(value) {
157
+ this._options.href = value;
158
+ this._scheduleRender();
159
+ }
160
+ get href() {
161
+ return this._options.href;
162
+ }
163
+ set buttonAriaLabel(value) {
164
+ this._options.ariaLabel = value;
165
+ this._scheduleRender();
166
+ }
167
+ get buttonAriaLabel() {
168
+ return this._options.ariaLabel;
169
+ }
170
+ // ============================================
171
+ // Event Forwarding
172
+ // ============================================
173
+ connectedCallback() {
174
+ super.connectedCallback();
175
+ // Forward click events from inner button
176
+ this.addEventListener('click', this._handleClick.bind(this));
177
+ }
178
+ _handleClick(e) {
179
+ // Only dispatch if click originated from inner button
180
+ const innerButton = this.getInnerElement();
181
+ if (innerButton && (e.target === innerButton || innerButton.contains(e.target))) {
182
+ this.dispatchEvent(new CustomEvent('fmcp:click', {
183
+ bubbles: true,
184
+ detail: { options: this.options },
185
+ }));
186
+ }
187
+ }
188
+ // ============================================
189
+ // Public API
190
+ // ============================================
191
+ /**
192
+ * Focus the inner button element.
193
+ */
194
+ focus() {
195
+ const inner = this.getInnerElement();
196
+ inner?.focus();
197
+ }
198
+ /**
199
+ * Blur the inner button element.
200
+ */
201
+ blur() {
202
+ const inner = this.getInnerElement();
203
+ inner?.blur();
204
+ }
205
+ /**
206
+ * Click the inner button programmatically.
207
+ */
208
+ click() {
209
+ const inner = this.getInnerElement();
210
+ inner?.click();
211
+ }
212
+ }
213
+ exports.FmcpButton = FmcpButton;
214
+ /**
215
+ * Register the fmcp-button custom element.
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * import { registerFmcpButton } from '@frontmcp/ui/web-components';
220
+ *
221
+ * // Register once on app startup
222
+ * registerFmcpButton();
223
+ *
224
+ * // Then use in HTML
225
+ * // <fmcp-button variant="primary">Click</fmcp-button>
226
+ * ```
227
+ */
228
+ function registerFmcpButton() {
229
+ if (typeof customElements !== 'undefined' && !customElements.get('fmcp-button')) {
230
+ customElements.define('fmcp-button', FmcpButton);
231
+ }
232
+ }
233
+ //# sourceMappingURL=fmcp-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fmcp-button.js","sourceRoot":"","sources":["../../../../src/web-components/elements/fmcp-button.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;;;AAqNH,gDAIC;AAvND,kCAA+F;AAC/F,oDAAqE;AACrE,kEAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,UAAW,SAAQ,kBAA0B;IACrC,MAAM,GAAqC;QAC5D,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,mCAAmB;QAC3B,QAAQ,EAAE;YACR,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,QAAQ;SACf;KACF,CAAC;IAEF;;OAEG;IACH,MAAM,KAAK,kBAAkB;QAC3B,OAAO,IAAA,sCAA+B,EAAC,mCAAmB,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACO,UAAU,CAAC,OAAsB,EAAE,OAAe;QAC1D,OAAO,IAAA,eAAM,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,+CAA+C;IAC/C,sCAAsC;IACtC,+CAA+C;IAE/C,IAAI,OAAO,CAAC,KAA+B;QACzC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p-button.ts\n * @description FrontMCP Button Web Component.\n *\n * A custom element wrapper around the button() HTML function.\n * Works natively in React, Vue, Angular, and plain HTML.\n *\n * @example Basic usage\n * ```html\n * <fmcp-button>Click Me</fmcp-button>\n * <fmcp-button variant=\"danger\">Delete</fmcp-button>\n * <fmcp-button disabled>Disabled</fmcp-button>\n * ```\n *\n * @example With HTMX\n * ```html\n * <fmcp-button hx-post=\"/api/submit\" hx-target=\"#result\">\n * Submit\n * </fmcp-button>\n * ```\n *\n * @example In React\n * ```tsx\n * import { registerFmcpButton } from '@frontmcp/ui/web-components';\n * registerFmcpButton();\n *\n * function App() {\n * return (\n * <fmcp-button variant=\"primary\" onClick={handleClick}>\n * Click Me\n * </fmcp-button>\n * );\n * }\n * ```\n *\n * @module @frontmcp/ui/web-components/elements/fmcp-button\n */\n\nimport { FmcpElement, type FmcpElementConfig, getObservedAttributesFromSchema } from '../core';\nimport { button, type ButtonOptions } from '../../components/button';\nimport { ButtonOptionsSchema } from '../../components/button.schema';\n\n/**\n * FmcpButton Web Component\n *\n * Attributes:\n * - `variant` - 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'success' | 'link'\n * - `size` - 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n * - `type` - 'button' | 'submit' | 'reset'\n * - `disabled` - boolean (presence = true)\n * - `loading` - boolean\n * - `full-width` - boolean\n * - `icon-only` - boolean\n * - `href` - URL for link-style buttons\n * - `target` - '_blank' | '_self'\n * - `hx-get`, `hx-post`, etc. - HTMX attributes\n *\n * Properties (for React/Vue):\n * - All attributes can be set as properties\n * - `options` - Set all options at once\n *\n * Events:\n * - `fmcp:render` - Fired after render with { options } detail\n * - `fmcp:click` - Fired on button click with { options } detail\n */\nexport class FmcpButton extends FmcpElement<ButtonOptions> {\n protected readonly config: FmcpElementConfig<ButtonOptions> = {\n name: 'button',\n schema: ButtonOptionsSchema,\n defaults: {\n variant: 'primary',\n size: 'md',\n type: 'button',\n },\n };\n\n /**\n * Attributes to observe for changes.\n */\n static get observedAttributes(): string[] {\n return getObservedAttributesFromSchema(ButtonOptionsSchema);\n }\n\n /**\n * Render the button HTML using the button() function.\n */\n protected renderHtml(options: ButtonOptions, content: string): string {\n return button(content, options);\n }\n\n // ============================================\n // Property Setters (Individual Props)\n // ============================================\n\n set variant(value: ButtonOptions['variant']) {\n this._options.variant = value;\n this._scheduleRender();\n }\n get variant(): ButtonOptions['variant'] {\n return this._options.variant;\n }\n\n set size(value: ButtonOptions['size']) {\n this._options.size = value;\n this._scheduleRender();\n }\n get size(): ButtonOptions['size'] {\n return this._options.size;\n }\n\n set type(value: ButtonOptions['type']) {\n this._options.type = value;\n this._scheduleRender();\n }\n get type(): ButtonOptions['type'] {\n return this._options.type;\n }\n\n set disabled(value: boolean) {\n this._options.disabled = value;\n this._scheduleRender();\n }\n get disabled(): boolean {\n return this._options.disabled ?? false;\n }\n\n set loading(value: boolean) {\n this._options.loading = value;\n this._scheduleRender();\n }\n get loading(): boolean {\n return this._options.loading ?? false;\n }\n\n set fullWidth(value: boolean) {\n this._options.fullWidth = value;\n this._scheduleRender();\n }\n get fullWidth(): boolean {\n return this._options.fullWidth ?? false;\n }\n\n set iconOnly(value: boolean) {\n this._options.iconOnly = value;\n this._scheduleRender();\n }\n get iconOnly(): boolean {\n return this._options.iconOnly ?? false;\n }\n\n set iconBefore(value: string | undefined) {\n this._options.iconBefore = value;\n this._scheduleRender();\n }\n get iconBefore(): string | undefined {\n return this._options.iconBefore;\n }\n\n set iconAfter(value: string | undefined) {\n this._options.iconAfter = value;\n this._scheduleRender();\n }\n get iconAfter(): string | undefined {\n return this._options.iconAfter;\n }\n\n set href(value: string | undefined) {\n this._options.href = value;\n this._scheduleRender();\n }\n get href(): string | undefined {\n return this._options.href;\n }\n\n set buttonAriaLabel(value: string | undefined) {\n this._options.ariaLabel = value;\n this._scheduleRender();\n }\n get buttonAriaLabel(): string | undefined {\n return this._options.ariaLabel;\n }\n\n // ============================================\n // Event Forwarding\n // ============================================\n\n override connectedCallback(): void {\n super.connectedCallback();\n\n // Forward click events from inner button\n this.addEventListener('click', this._handleClick.bind(this));\n }\n\n private _handleClick(e: Event): void {\n // Only dispatch if click originated from inner button\n const innerButton = this.getInnerElement<HTMLButtonElement>();\n if (innerButton && (e.target === innerButton || innerButton.contains(e.target as Node))) {\n this.dispatchEvent(\n new CustomEvent('fmcp:click', {\n bubbles: true,\n detail: { options: this.options },\n }),\n );\n }\n }\n\n // ============================================\n // Public API\n // ============================================\n\n /**\n * Focus the inner button element.\n */\n public override focus(): void {\n const inner = this.getInnerElement<HTMLButtonElement>();\n inner?.focus();\n }\n\n /**\n * Blur the inner button element.\n */\n public override blur(): void {\n const inner = this.getInnerElement<HTMLButtonElement>();\n inner?.blur();\n }\n\n /**\n * Click the inner button programmatically.\n */\n public override click(): void {\n const inner = this.getInnerElement<HTMLButtonElement>();\n inner?.click();\n }\n}\n\n/**\n * Register the fmcp-button custom element.\n *\n * @example\n * ```typescript\n * import { registerFmcpButton } from '@frontmcp/ui/web-components';\n *\n * // Register once on app startup\n * registerFmcpButton();\n *\n * // Then use in HTML\n * // <fmcp-button variant=\"primary\">Click</fmcp-button>\n * ```\n */\nexport function registerFmcpButton(): void {\n if (typeof customElements !== 'undefined' && !customElements.get('fmcp-button')) {\n customElements.define('fmcp-button', FmcpButton);\n }\n}\n"]}
@@ -0,0 +1,52 @@
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;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /**
3
+ * @file fmcp-card.ts
4
+ * @description FrontMCP Card Web Component.
5
+ *
6
+ * A custom element wrapper around the card() HTML function.
7
+ *
8
+ * @example Basic usage
9
+ * ```html
10
+ * <fmcp-card title="Welcome" subtitle="Description">
11
+ * <p>Card content goes here</p>
12
+ * </fmcp-card>
13
+ * ```
14
+ *
15
+ * @example Clickable card
16
+ * ```html
17
+ * <fmcp-card clickable href="/details" title="Item">
18
+ * <p>Click to view details</p>
19
+ * </fmcp-card>
20
+ * ```
21
+ *
22
+ * @module @frontmcp/ui/web-components/elements/fmcp-card
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.FmcpCard = void 0;
26
+ exports.registerFmcpCard = registerFmcpCard;
27
+ const core_1 = require("../core");
28
+ const card_1 = require("../../components/card");
29
+ const card_schema_1 = require("../../components/card.schema");
30
+ /**
31
+ * FmcpCard Web Component
32
+ */
33
+ class FmcpCard extends core_1.FmcpElement {
34
+ config = {
35
+ name: 'card',
36
+ schema: card_schema_1.CardOptionsSchema,
37
+ defaults: {
38
+ variant: 'default',
39
+ size: 'md',
40
+ },
41
+ };
42
+ static get observedAttributes() {
43
+ return (0, core_1.getObservedAttributesFromSchema)(card_schema_1.CardOptionsSchema);
44
+ }
45
+ renderHtml(options, content) {
46
+ return (0, card_1.card)(content, options);
47
+ }
48
+ // Property setters
49
+ set variant(value) {
50
+ this._options.variant = value;
51
+ this._scheduleRender();
52
+ }
53
+ get variant() {
54
+ return this._options.variant;
55
+ }
56
+ set size(value) {
57
+ this._options.size = value;
58
+ this._scheduleRender();
59
+ }
60
+ get size() {
61
+ return this._options.size;
62
+ }
63
+ set cardTitle(value) {
64
+ this._options.title = value;
65
+ this._scheduleRender();
66
+ }
67
+ get cardTitle() {
68
+ return this._options.title;
69
+ }
70
+ set subtitle(value) {
71
+ this._options.subtitle = value;
72
+ this._scheduleRender();
73
+ }
74
+ get subtitle() {
75
+ return this._options.subtitle;
76
+ }
77
+ set clickable(value) {
78
+ this._options.clickable = value;
79
+ this._scheduleRender();
80
+ }
81
+ get clickable() {
82
+ return this._options.clickable ?? false;
83
+ }
84
+ set href(value) {
85
+ this._options.href = value;
86
+ this._scheduleRender();
87
+ }
88
+ get href() {
89
+ return this._options.href;
90
+ }
91
+ set footer(value) {
92
+ this._options.footer = value;
93
+ this._scheduleRender();
94
+ }
95
+ get footer() {
96
+ return this._options.footer;
97
+ }
98
+ set headerActions(value) {
99
+ this._options.headerActions = value;
100
+ this._scheduleRender();
101
+ }
102
+ get headerActions() {
103
+ return this._options.headerActions;
104
+ }
105
+ }
106
+ exports.FmcpCard = FmcpCard;
107
+ /**
108
+ * Register the fmcp-card custom element.
109
+ */
110
+ function registerFmcpCard() {
111
+ if (typeof customElements !== 'undefined' && !customElements.get('fmcp-card')) {
112
+ customElements.define('fmcp-card', FmcpCard);
113
+ }
114
+ }
115
+ //# sourceMappingURL=fmcp-card.js.map
@@ -0,0 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EAAE,CAAC;QAC9E,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC","sourcesContent":["/**\n * @file fmcp-card.ts\n * @description FrontMCP Card Web Component.\n *\n * A custom element wrapper around the card() HTML function.\n *\n * @example Basic usage\n * ```html\n * <fmcp-card title=\"Welcome\" subtitle=\"Description\">\n * <p>Card content goes here</p>\n * </fmcp-card>\n * ```\n *\n * @example Clickable card\n * ```html\n * <fmcp-card clickable href=\"/details\" title=\"Item\">\n * <p>Click to view details</p>\n * </fmcp-card>\n * ```\n *\n * @module @frontmcp/ui/web-components/elements/fmcp-card\n */\n\nimport { FmcpElement, type FmcpElementConfig, getObservedAttributesFromSchema } from '../core';\nimport { card, type CardOptions } from '../../components/card';\nimport { CardOptionsSchema } from '../../components/card.schema';\n\n/**\n * FmcpCard Web Component\n */\nexport class FmcpCard extends FmcpElement<CardOptions> {\n protected readonly config: FmcpElementConfig<CardOptions> = {\n name: 'card',\n schema: CardOptionsSchema,\n defaults: {\n variant: 'default',\n size: 'md',\n },\n };\n\n static get observedAttributes(): string[] {\n return getObservedAttributesFromSchema(CardOptionsSchema);\n }\n\n protected renderHtml(options: CardOptions, content: string): string {\n return card(content, options);\n }\n\n // Property setters\n set variant(value: CardOptions['variant']) {\n this._options.variant = value;\n this._scheduleRender();\n }\n get variant(): CardOptions['variant'] {\n return this._options.variant;\n }\n\n set size(value: CardOptions['size']) {\n this._options.size = value;\n this._scheduleRender();\n }\n get size(): CardOptions['size'] {\n return this._options.size;\n }\n\n set cardTitle(value: string | undefined) {\n this._options.title = value;\n this._scheduleRender();\n }\n get cardTitle(): string | undefined {\n return this._options.title;\n }\n\n set subtitle(value: string | undefined) {\n this._options.subtitle = value;\n this._scheduleRender();\n }\n get subtitle(): string | undefined {\n return this._options.subtitle;\n }\n\n set clickable(value: boolean) {\n this._options.clickable = value;\n this._scheduleRender();\n }\n get clickable(): boolean {\n return this._options.clickable ?? false;\n }\n\n set href(value: string | undefined) {\n this._options.href = value;\n this._scheduleRender();\n }\n get href(): string | undefined {\n return this._options.href;\n }\n\n set footer(value: string | undefined) {\n this._options.footer = value;\n this._scheduleRender();\n }\n get footer(): string | undefined {\n return this._options.footer;\n }\n\n set headerActions(value: string | undefined) {\n this._options.headerActions = value;\n this._scheduleRender();\n }\n get headerActions(): string | undefined {\n return this._options.headerActions;\n }\n}\n\n/**\n * Register the fmcp-card custom element.\n */\nexport function registerFmcpCard(): void {\n if (typeof customElements !== 'undefined' && !customElements.get('fmcp-card')) {\n customElements.define('fmcp-card', FmcpCard);\n }\n}\n"]}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @file fmcp-input.ts
3
+ * @description FrontMCP Input Web Component.
4
+ *
5
+ * A custom element wrapper around the input() HTML function.
6
+ *
7
+ * @example Basic usage
8
+ * ```html
9
+ * <fmcp-input name="email" type="email" label="Email Address"></fmcp-input>
10
+ * <fmcp-input name="password" type="password" label="Password" required></fmcp-input>
11
+ * ```
12
+ *
13
+ * @example With validation
14
+ * ```html
15
+ * <fmcp-input
16
+ * name="username"
17
+ * label="Username"
18
+ * helper="Choose a unique username"
19
+ * pattern="[a-z0-9]+"
20
+ * ></fmcp-input>
21
+ * ```
22
+ *
23
+ * @module @frontmcp/ui/web-components/elements/fmcp-input
24
+ */
25
+ import { FmcpElement, type FmcpElementConfig } from '../core';
26
+ import { type InputOptions } from '../../components/form';
27
+ /**
28
+ * FmcpInput Web Component
29
+ */
30
+ export declare class FmcpInput extends FmcpElement<InputOptions> {
31
+ protected readonly config: FmcpElementConfig<InputOptions>;
32
+ static get observedAttributes(): string[];
33
+ protected renderHtml(options: InputOptions, _content: string): string;
34
+ set name(value: string);
35
+ get name(): string;
36
+ set type(value: InputOptions['type']);
37
+ get type(): InputOptions['type'];
38
+ set label(value: string | undefined);
39
+ get label(): string | undefined;
40
+ set placeholder(value: string | undefined);
41
+ get placeholder(): string | undefined;
42
+ set helper(value: string | undefined);
43
+ get helper(): string | undefined;
44
+ set error(value: string | undefined);
45
+ get error(): string | undefined;
46
+ set size(value: InputOptions['size']);
47
+ get size(): InputOptions['size'];
48
+ set state(value: InputOptions['state']);
49
+ get state(): InputOptions['state'];
50
+ set required(value: boolean);
51
+ get required(): boolean;
52
+ set disabled(value: boolean);
53
+ get disabled(): boolean;
54
+ set readonly(value: boolean);
55
+ get readonly(): boolean;
56
+ connectedCallback(): void;
57
+ private _handleInput;
58
+ private _handleChange;
59
+ /**
60
+ * Get current input value.
61
+ */
62
+ get value(): string;
63
+ /**
64
+ * Set input value.
65
+ */
66
+ set value(val: string);
67
+ /**
68
+ * Get validity state.
69
+ */
70
+ get validity(): ValidityState | undefined;
71
+ /**
72
+ * Check validity.
73
+ */
74
+ checkValidity(): boolean;
75
+ /**
76
+ * Report validity.
77
+ */
78
+ reportValidity(): boolean;
79
+ /**
80
+ * Focus the input.
81
+ */
82
+ focus(): void;
83
+ /**
84
+ * Blur the input.
85
+ */
86
+ blur(): void;
87
+ /**
88
+ * Select all text.
89
+ */
90
+ select(): void;
91
+ }
92
+ /**
93
+ * Register the fmcp-input custom element.
94
+ */
95
+ export declare function registerFmcpInput(): void;