@bquery/bquery 1.1.2 → 1.3.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 (307) hide show
  1. package/README.md +501 -323
  2. package/dist/batch-4LAvfLE7.js +13 -0
  3. package/dist/batch-4LAvfLE7.js.map +1 -0
  4. package/dist/component/component.d.ts +69 -0
  5. package/dist/component/component.d.ts.map +1 -0
  6. package/dist/component/html.d.ts +35 -0
  7. package/dist/component/html.d.ts.map +1 -0
  8. package/dist/component/index.d.ts +3 -126
  9. package/dist/component/index.d.ts.map +1 -1
  10. package/dist/component/props.d.ts +18 -0
  11. package/dist/component/props.d.ts.map +1 -0
  12. package/dist/component/types.d.ts +77 -0
  13. package/dist/component/types.d.ts.map +1 -0
  14. package/dist/component.es.mjs +90 -59
  15. package/dist/component.es.mjs.map +1 -1
  16. package/dist/core/collection.d.ts +36 -0
  17. package/dist/core/collection.d.ts.map +1 -1
  18. package/dist/core/dom.d.ts +6 -0
  19. package/dist/core/dom.d.ts.map +1 -0
  20. package/dist/core/element.d.ts +8 -0
  21. package/dist/core/element.d.ts.map +1 -1
  22. package/dist/core/index.d.ts +1 -0
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/utils/array.d.ts +74 -0
  25. package/dist/core/utils/array.d.ts.map +1 -0
  26. package/dist/core/utils/function.d.ts +70 -0
  27. package/dist/core/utils/function.d.ts.map +1 -0
  28. package/dist/core/utils/index.d.ts +70 -0
  29. package/dist/core/utils/index.d.ts.map +1 -0
  30. package/dist/core/utils/misc.d.ts +63 -0
  31. package/dist/core/utils/misc.d.ts.map +1 -0
  32. package/dist/core/utils/number.d.ts +65 -0
  33. package/dist/core/utils/number.d.ts.map +1 -0
  34. package/dist/core/utils/object.d.ts +133 -0
  35. package/dist/core/utils/object.d.ts.map +1 -0
  36. package/dist/core/utils/string.d.ts +80 -0
  37. package/dist/core/utils/string.d.ts.map +1 -0
  38. package/dist/core/utils/type-guards.d.ts +79 -0
  39. package/dist/core/utils/type-guards.d.ts.map +1 -0
  40. package/dist/core-COenAZjD.js +145 -0
  41. package/dist/core-COenAZjD.js.map +1 -0
  42. package/dist/core.es.mjs +411 -448
  43. package/dist/core.es.mjs.map +1 -1
  44. package/dist/full.d.ts +8 -2
  45. package/dist/full.d.ts.map +1 -1
  46. package/dist/full.es.mjs +86 -40
  47. package/dist/full.es.mjs.map +1 -1
  48. package/dist/full.iife.js +6 -1
  49. package/dist/full.iife.js.map +1 -1
  50. package/dist/full.umd.js +6 -1
  51. package/dist/full.umd.js.map +1 -1
  52. package/dist/index.d.ts +3 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.es.mjs +137 -44
  55. package/dist/index.es.mjs.map +1 -1
  56. package/dist/motion/animate.d.ts +25 -0
  57. package/dist/motion/animate.d.ts.map +1 -0
  58. package/dist/motion/easing.d.ts +30 -0
  59. package/dist/motion/easing.d.ts.map +1 -0
  60. package/dist/motion/flip.d.ts +55 -0
  61. package/dist/motion/flip.d.ts.map +1 -0
  62. package/dist/motion/index.d.ts +11 -138
  63. package/dist/motion/index.d.ts.map +1 -1
  64. package/dist/motion/keyframes.d.ts +21 -0
  65. package/dist/motion/keyframes.d.ts.map +1 -0
  66. package/dist/motion/reduced-motion.d.ts +12 -0
  67. package/dist/motion/reduced-motion.d.ts.map +1 -0
  68. package/dist/motion/scroll.d.ts +15 -0
  69. package/dist/motion/scroll.d.ts.map +1 -0
  70. package/dist/motion/spring.d.ts +42 -0
  71. package/dist/motion/spring.d.ts.map +1 -0
  72. package/dist/motion/stagger.d.ts +22 -0
  73. package/dist/motion/stagger.d.ts.map +1 -0
  74. package/dist/motion/timeline.d.ts +21 -0
  75. package/dist/motion/timeline.d.ts.map +1 -0
  76. package/dist/motion/transition.d.ts +22 -0
  77. package/dist/motion/transition.d.ts.map +1 -0
  78. package/dist/motion/types.d.ts +182 -0
  79. package/dist/motion/types.d.ts.map +1 -0
  80. package/dist/motion.es.mjs +320 -61
  81. package/dist/motion.es.mjs.map +1 -1
  82. package/dist/persisted-Dz_ryNuC.js +278 -0
  83. package/dist/persisted-Dz_ryNuC.js.map +1 -0
  84. package/dist/reactive/batch.d.ts +13 -0
  85. package/dist/reactive/batch.d.ts.map +1 -0
  86. package/dist/reactive/computed.d.ts +50 -0
  87. package/dist/reactive/computed.d.ts.map +1 -0
  88. package/dist/reactive/core.d.ts +60 -0
  89. package/dist/reactive/core.d.ts.map +1 -0
  90. package/dist/reactive/effect.d.ts +15 -0
  91. package/dist/reactive/effect.d.ts.map +1 -0
  92. package/dist/reactive/index.d.ts +2 -2
  93. package/dist/reactive/index.d.ts.map +1 -1
  94. package/dist/reactive/internals.d.ts +36 -0
  95. package/dist/reactive/internals.d.ts.map +1 -0
  96. package/dist/reactive/linked.d.ts +36 -0
  97. package/dist/reactive/linked.d.ts.map +1 -0
  98. package/dist/reactive/persisted.d.ts +14 -0
  99. package/dist/reactive/persisted.d.ts.map +1 -0
  100. package/dist/reactive/readonly.d.ts +26 -0
  101. package/dist/reactive/readonly.d.ts.map +1 -0
  102. package/dist/reactive/signal.d.ts +13 -305
  103. package/dist/reactive/signal.d.ts.map +1 -1
  104. package/dist/reactive/type-guards.d.ts +20 -0
  105. package/dist/reactive/type-guards.d.ts.map +1 -0
  106. package/dist/reactive/untrack.d.ts +29 -0
  107. package/dist/reactive/untrack.d.ts.map +1 -0
  108. package/dist/reactive/watch.d.ts +42 -0
  109. package/dist/reactive/watch.d.ts.map +1 -0
  110. package/dist/reactive.es.mjs +30 -154
  111. package/dist/reactive.es.mjs.map +1 -1
  112. package/dist/router/index.d.ts +41 -0
  113. package/dist/router/index.d.ts.map +1 -0
  114. package/dist/router/links.d.ts +44 -0
  115. package/dist/router/links.d.ts.map +1 -0
  116. package/dist/router/match.d.ts +20 -0
  117. package/dist/router/match.d.ts.map +1 -0
  118. package/dist/router/navigation.d.ts +45 -0
  119. package/dist/router/navigation.d.ts.map +1 -0
  120. package/dist/router/query.d.ts +16 -0
  121. package/dist/router/query.d.ts.map +1 -0
  122. package/dist/router/router.d.ts +34 -0
  123. package/dist/router/router.d.ts.map +1 -0
  124. package/dist/router/state.d.ts +27 -0
  125. package/dist/router/state.d.ts.map +1 -0
  126. package/dist/router/types.d.ts +88 -0
  127. package/dist/router/types.d.ts.map +1 -0
  128. package/dist/router/utils.d.ts +65 -0
  129. package/dist/router/utils.d.ts.map +1 -0
  130. package/dist/router.es.mjs +202 -0
  131. package/dist/router.es.mjs.map +1 -0
  132. package/dist/sanitize-1FBEPAFH.js +272 -0
  133. package/dist/sanitize-1FBEPAFH.js.map +1 -0
  134. package/dist/security/constants.d.ts +42 -0
  135. package/dist/security/constants.d.ts.map +1 -0
  136. package/dist/security/csp.d.ts +24 -0
  137. package/dist/security/csp.d.ts.map +1 -0
  138. package/dist/security/index.d.ts +4 -2
  139. package/dist/security/index.d.ts.map +1 -1
  140. package/dist/security/sanitize-core.d.ts +13 -0
  141. package/dist/security/sanitize-core.d.ts.map +1 -0
  142. package/dist/security/sanitize.d.ts +5 -57
  143. package/dist/security/sanitize.d.ts.map +1 -1
  144. package/dist/security/trusted-types.d.ts +25 -0
  145. package/dist/security/trusted-types.d.ts.map +1 -0
  146. package/dist/security/types.d.ts +36 -0
  147. package/dist/security/types.d.ts.map +1 -0
  148. package/dist/security.es.mjs +50 -277
  149. package/dist/security.es.mjs.map +1 -1
  150. package/dist/store/create-store.d.ts +15 -0
  151. package/dist/store/create-store.d.ts.map +1 -0
  152. package/dist/store/define-store.d.ts +28 -0
  153. package/dist/store/define-store.d.ts.map +1 -0
  154. package/dist/store/devtools.d.ts +22 -0
  155. package/dist/store/devtools.d.ts.map +1 -0
  156. package/dist/store/index.d.ts +12 -0
  157. package/dist/store/index.d.ts.map +1 -0
  158. package/dist/store/mapping.d.ts +28 -0
  159. package/dist/store/mapping.d.ts.map +1 -0
  160. package/dist/store/persisted.d.ts +13 -0
  161. package/dist/store/persisted.d.ts.map +1 -0
  162. package/dist/store/plugins.d.ts +13 -0
  163. package/dist/store/plugins.d.ts.map +1 -0
  164. package/dist/store/registry.d.ts +28 -0
  165. package/dist/store/registry.d.ts.map +1 -0
  166. package/dist/store/types.d.ts +71 -0
  167. package/dist/store/types.d.ts.map +1 -0
  168. package/dist/store/utils.d.ts +28 -0
  169. package/dist/store/utils.d.ts.map +1 -0
  170. package/dist/store/watch.d.ts +23 -0
  171. package/dist/store/watch.d.ts.map +1 -0
  172. package/dist/store.es.mjs +27 -0
  173. package/dist/store.es.mjs.map +1 -0
  174. package/dist/type-guards-DRma3-Kc.js +16 -0
  175. package/dist/type-guards-DRma3-Kc.js.map +1 -0
  176. package/dist/untrack-BuEQKH7_.js +6 -0
  177. package/dist/untrack-BuEQKH7_.js.map +1 -0
  178. package/dist/view/directives/bind.d.ts +7 -0
  179. package/dist/view/directives/bind.d.ts.map +1 -0
  180. package/dist/view/directives/class.d.ts +8 -0
  181. package/dist/view/directives/class.d.ts.map +1 -0
  182. package/dist/view/directives/for.d.ts +23 -0
  183. package/dist/view/directives/for.d.ts.map +1 -0
  184. package/dist/view/directives/html.d.ts +7 -0
  185. package/dist/view/directives/html.d.ts.map +1 -0
  186. package/dist/view/directives/if.d.ts +7 -0
  187. package/dist/view/directives/if.d.ts.map +1 -0
  188. package/dist/view/directives/index.d.ts +12 -0
  189. package/dist/view/directives/index.d.ts.map +1 -0
  190. package/dist/view/directives/model.d.ts +7 -0
  191. package/dist/view/directives/model.d.ts.map +1 -0
  192. package/dist/view/directives/on.d.ts +7 -0
  193. package/dist/view/directives/on.d.ts.map +1 -0
  194. package/dist/view/directives/ref.d.ts +7 -0
  195. package/dist/view/directives/ref.d.ts.map +1 -0
  196. package/dist/view/directives/show.d.ts +7 -0
  197. package/dist/view/directives/show.d.ts.map +1 -0
  198. package/dist/view/directives/style.d.ts +7 -0
  199. package/dist/view/directives/style.d.ts.map +1 -0
  200. package/dist/view/directives/text.d.ts +7 -0
  201. package/dist/view/directives/text.d.ts.map +1 -0
  202. package/dist/view/evaluate.d.ts +43 -0
  203. package/dist/view/evaluate.d.ts.map +1 -0
  204. package/dist/view/index.d.ts +111 -0
  205. package/dist/view/index.d.ts.map +1 -0
  206. package/dist/view/mount.d.ts +69 -0
  207. package/dist/view/mount.d.ts.map +1 -0
  208. package/dist/view/process.d.ts +26 -0
  209. package/dist/view/process.d.ts.map +1 -0
  210. package/dist/view/types.d.ts +36 -0
  211. package/dist/view/types.d.ts.map +1 -0
  212. package/dist/view.es.mjs +426 -0
  213. package/dist/view.es.mjs.map +1 -0
  214. package/dist/watch-CXyaBC_9.js +58 -0
  215. package/dist/watch-CXyaBC_9.js.map +1 -0
  216. package/package.json +26 -14
  217. package/src/component/component.ts +289 -0
  218. package/src/component/html.ts +53 -0
  219. package/src/component/index.ts +40 -414
  220. package/src/component/props.ts +116 -0
  221. package/src/component/types.ts +85 -0
  222. package/src/core/collection.ts +588 -454
  223. package/src/core/dom.ts +38 -0
  224. package/src/core/element.ts +746 -740
  225. package/src/core/index.ts +43 -0
  226. package/src/core/utils/array.ts +102 -0
  227. package/src/core/utils/function.ts +110 -0
  228. package/src/core/utils/index.ts +83 -0
  229. package/src/core/utils/misc.ts +82 -0
  230. package/src/core/utils/number.ts +78 -0
  231. package/src/core/utils/object.ts +206 -0
  232. package/src/core/utils/string.ts +112 -0
  233. package/src/core/utils/type-guards.ts +112 -0
  234. package/src/full.ts +187 -106
  235. package/src/index.ts +36 -27
  236. package/src/motion/animate.ts +113 -0
  237. package/src/motion/easing.ts +40 -0
  238. package/src/motion/flip.ts +176 -0
  239. package/src/motion/index.ts +41 -358
  240. package/src/motion/keyframes.ts +46 -0
  241. package/src/motion/reduced-motion.ts +17 -0
  242. package/src/motion/scroll.ts +57 -0
  243. package/src/motion/spring.ts +150 -0
  244. package/src/motion/stagger.ts +43 -0
  245. package/src/motion/timeline.ts +246 -0
  246. package/src/motion/transition.ts +51 -0
  247. package/src/motion/types.ts +198 -0
  248. package/src/reactive/batch.ts +22 -0
  249. package/src/reactive/computed.ts +92 -0
  250. package/src/reactive/core.ts +93 -0
  251. package/src/reactive/effect.ts +43 -0
  252. package/src/reactive/index.ts +23 -22
  253. package/src/reactive/internals.ts +105 -0
  254. package/src/reactive/linked.ts +56 -0
  255. package/src/reactive/persisted.ts +74 -0
  256. package/src/reactive/readonly.ts +35 -0
  257. package/src/reactive/signal.ts +20 -506
  258. package/src/reactive/type-guards.ts +22 -0
  259. package/src/reactive/untrack.ts +31 -0
  260. package/src/reactive/watch.ts +73 -0
  261. package/src/router/index.ts +41 -0
  262. package/src/router/links.ts +130 -0
  263. package/src/router/match.ts +106 -0
  264. package/src/router/navigation.ts +71 -0
  265. package/src/router/query.ts +35 -0
  266. package/src/router/router.ts +211 -0
  267. package/src/router/state.ts +46 -0
  268. package/src/router/types.ts +93 -0
  269. package/src/router/utils.ts +116 -0
  270. package/src/security/constants.ts +209 -0
  271. package/src/security/csp.ts +77 -0
  272. package/src/security/index.ts +4 -12
  273. package/src/security/sanitize-core.ts +343 -0
  274. package/src/security/sanitize.ts +66 -625
  275. package/src/security/trusted-types.ts +69 -0
  276. package/src/security/types.ts +40 -0
  277. package/src/store/create-store.ts +329 -0
  278. package/src/store/define-store.ts +48 -0
  279. package/src/store/devtools.ts +45 -0
  280. package/src/store/index.ts +22 -0
  281. package/src/store/mapping.ts +73 -0
  282. package/src/store/persisted.ts +61 -0
  283. package/src/store/plugins.ts +32 -0
  284. package/src/store/registry.ts +51 -0
  285. package/src/store/types.ts +94 -0
  286. package/src/store/utils.ts +141 -0
  287. package/src/store/watch.ts +52 -0
  288. package/src/view/directives/bind.ts +23 -0
  289. package/src/view/directives/class.ts +70 -0
  290. package/src/view/directives/for.ts +275 -0
  291. package/src/view/directives/html.ts +19 -0
  292. package/src/view/directives/if.ts +30 -0
  293. package/src/view/directives/index.ts +11 -0
  294. package/src/view/directives/model.ts +56 -0
  295. package/src/view/directives/on.ts +41 -0
  296. package/src/view/directives/ref.ts +41 -0
  297. package/src/view/directives/show.ts +26 -0
  298. package/src/view/directives/style.ts +47 -0
  299. package/src/view/directives/text.ts +15 -0
  300. package/src/view/evaluate.ts +274 -0
  301. package/src/view/index.ts +112 -0
  302. package/src/view/mount.ts +200 -0
  303. package/src/view/process.ts +92 -0
  304. package/src/view/types.ts +44 -0
  305. package/dist/core/utils.d.ts +0 -313
  306. package/dist/core/utils.d.ts.map +0 -1
  307. package/src/core/utils.ts +0 -444
@@ -0,0 +1,13 @@
1
+ import { e as t, b } from "./core-COenAZjD.js";
2
+ const e = (a) => {
3
+ b();
4
+ try {
5
+ a();
6
+ } finally {
7
+ t();
8
+ }
9
+ };
10
+ export {
11
+ e as b
12
+ };
13
+ //# sourceMappingURL=batch-4LAvfLE7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-4LAvfLE7.js","sources":["../src/reactive/batch.ts"],"sourcesContent":["/**\n * Batched reactive updates.\n */\n\nimport { beginBatch, endBatch } from './internals';\n\n/**\n * Batches multiple signal updates into a single notification cycle.\n *\n * Updates made inside the batch function are deferred until the batch\n * completes, preventing intermediate re-renders and improving performance.\n *\n * @param fn - Function containing multiple signal updates\n */\nexport const batch = (fn: () => void): void => {\n beginBatch();\n try {\n fn();\n } finally {\n endBatch();\n }\n};\n"],"names":["batch","fn","beginBatch","endBatch"],"mappings":";AAcO,MAAMA,IAAQ,CAACC,MAAyB;AAC7C,EAAAC,EAAA;AACA,MAAI;AACF,IAAAD,EAAA;AAAA,EACF,UAAA;AACE,IAAAE,EAAA;AAAA,EACF;AACF;"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Web Component factory and registry.
3
+ *
4
+ * @module bquery/component
5
+ */
6
+ import type { ComponentDefinition } from './types';
7
+ /**
8
+ * Creates a custom element class for a component definition.
9
+ *
10
+ * This is useful when you want to extend or register the class manually
11
+ * (e.g. with different tag names in tests or custom registries).
12
+ *
13
+ * @template TProps - Type of the component's props
14
+ * @param tagName - The custom element tag name (used for diagnostics)
15
+ * @param definition - The component configuration
16
+ */
17
+ export declare const defineComponent: <TProps extends Record<string, unknown>>(tagName: string, definition: ComponentDefinition<TProps>) => typeof HTMLElement;
18
+ /**
19
+ * Defines and registers a custom Web Component.
20
+ *
21
+ * This function creates a new custom element with the given tag name
22
+ * and configuration. The component uses Shadow DOM for encapsulation
23
+ * and automatically re-renders when observed attributes change.
24
+ *
25
+ * @template TProps - Type of the component's props
26
+ * @param tagName - The custom element tag name (must contain a hyphen)
27
+ * @param definition - The component configuration
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * component('counter-button', {
32
+ * props: {
33
+ * start: { type: Number, default: 0 },
34
+ * },
35
+ * state: { count: 0 },
36
+ * styles: `
37
+ * button { padding: 0.5rem 1rem; }
38
+ * `,
39
+ * connected() {
40
+ * // Use event delegation on shadow root so handler survives re-renders
41
+ * const handleClick = (event: Event) => {
42
+ * const target = event.target as HTMLElement | null;
43
+ * if (target?.matches('button')) {
44
+ * this.setState('count', (this.getState('count') as number) + 1);
45
+ * }
46
+ * };
47
+ * this.shadowRoot?.addEventListener('click', handleClick);
48
+ * // Store handler for cleanup
49
+ * (this as any)._handleClick = handleClick;
50
+ * },
51
+ * disconnected() {
52
+ * // Clean up event listener to prevent memory leaks
53
+ * const handleClick = (this as any)._handleClick;
54
+ * if (handleClick) {
55
+ * this.shadowRoot?.removeEventListener('click', handleClick);
56
+ * }
57
+ * },
58
+ * render({ props, state }) {
59
+ * return html`
60
+ * <button>
61
+ * Count: ${state.count}
62
+ * </button>
63
+ * `;
64
+ * },
65
+ * });
66
+ * ```
67
+ */
68
+ export declare const component: <TProps extends Record<string, unknown>>(tagName: string, definition: ComponentDefinition<TProps>) => void;
69
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/component/component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,SAAS,CAAC;AAEnE;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpE,SAAS,MAAM,EACf,YAAY,mBAAmB,CAAC,MAAM,CAAC,KACtC,OAAO,WA4MT,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,SAAS,MAAM,EACf,YAAY,mBAAmB,CAAC,MAAM,CAAC,KACtC,IAMF,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Tagged template literal for creating HTML strings.
3
+ *
4
+ * This function handles interpolation of values into HTML templates,
5
+ * converting null/undefined to empty strings.
6
+ *
7
+ * @param strings - Template literal string parts
8
+ * @param values - Interpolated values
9
+ * @returns Combined HTML string
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const name = 'World';
14
+ * const greeting = html`<h1>Hello, ${name}!</h1>`;
15
+ * // Result: '<h1>Hello, World!</h1>'
16
+ * ```
17
+ */
18
+ export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => string;
19
+ /**
20
+ * Escapes HTML entities in interpolated values for XSS prevention.
21
+ * Use this when you need to safely embed user content in templates.
22
+ *
23
+ * @param strings - Template literal string parts
24
+ * @param values - Interpolated values to escape
25
+ * @returns Combined HTML string with escaped values
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const userInput = '<script>alert("xss")</script>';
30
+ * const safe = safeHtml`<div>${userInput}</div>`;
31
+ * // Result: '<div>&lt;script&gt;alert("xss")&lt;/script&gt;</div>'
32
+ * ```
33
+ */
34
+ export declare const safeHtml: (strings: TemplateStringsArray, ...values: unknown[]) => string;
35
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/component/html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,GAAI,SAAS,oBAAoB,EAAE,GAAG,QAAQ,OAAO,EAAE,KAAG,MAE1E,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ,GAAI,SAAS,oBAAoB,EAAE,GAAG,QAAQ,OAAO,EAAE,KAAG,MAgB9E,CAAC"}
@@ -34,130 +34,7 @@
34
34
  * });
35
35
  * ```
36
36
  */
37
- /**
38
- * Defines a single prop's type and configuration.
39
- *
40
- * @template T - The TypeScript type of the prop value
41
- *
42
- * @example
43
- * ```ts
44
- * const myProp: PropDefinition<number> = {
45
- * type: Number,
46
- * required: false,
47
- * default: 0,
48
- * };
49
- * ```
50
- */
51
- export type PropDefinition<T = unknown> = {
52
- /** Constructor or converter function for the prop type */
53
- type: StringConstructor | NumberConstructor | BooleanConstructor | ObjectConstructor | ArrayConstructor | {
54
- new (value: unknown): T;
55
- } | ((value: unknown) => T);
56
- /** Whether the prop must be provided */
57
- required?: boolean;
58
- /** Default value when prop is not provided */
59
- default?: T;
60
- /** Optional validator function to validate prop values */
61
- validator?: (value: T) => boolean;
62
- };
63
- /**
64
- * Complete component definition including props, state, styles, and lifecycle.
65
- *
66
- * @template TProps - Type of the component's props
67
- */
68
- export type ComponentDefinition<TProps extends Record<string, unknown> = Record<string, unknown>> = {
69
- /** Prop definitions with types and defaults */
70
- props?: Record<keyof TProps, PropDefinition>;
71
- /** Initial internal state */
72
- state?: Record<string, unknown>;
73
- /** CSS styles scoped to the component's shadow DOM */
74
- styles?: string;
75
- /** Lifecycle hook called before the component mounts (before first render) */
76
- beforeMount?: () => void;
77
- /** Lifecycle hook called when component is added to DOM */
78
- connected?: () => void;
79
- /** Lifecycle hook called when component is removed from DOM */
80
- disconnected?: () => void;
81
- /** Lifecycle hook called before an update render; return false to prevent */
82
- beforeUpdate?: (props: TProps) => boolean | void;
83
- /** Lifecycle hook called after reactive updates trigger a render */
84
- updated?: () => void;
85
- /** Error handler for errors during rendering or lifecycle */
86
- onError?: (error: Error) => void;
87
- /** Render function returning HTML string */
88
- render: (context: {
89
- props: TProps;
90
- state: Record<string, unknown>;
91
- emit: (event: string, detail?: unknown) => void;
92
- }) => string;
93
- };
94
- /**
95
- * Tagged template literal for creating HTML strings.
96
- *
97
- * This function handles interpolation of values into HTML templates,
98
- * converting null/undefined to empty strings.
99
- *
100
- * @param strings - Template literal string parts
101
- * @param values - Interpolated values
102
- * @returns Combined HTML string
103
- *
104
- * @example
105
- * ```ts
106
- * const name = 'World';
107
- * const greeting = html`<h1>Hello, ${name}!</h1>`;
108
- * // Result: '<h1>Hello, World!</h1>'
109
- * ```
110
- */
111
- export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => string;
112
- /**
113
- * Escapes HTML entities in interpolated values for XSS prevention.
114
- * Use this when you need to safely embed user content in templates.
115
- *
116
- * @param strings - Template literal string parts
117
- * @param values - Interpolated values to escape
118
- * @returns Combined HTML string with escaped values
119
- *
120
- * @example
121
- * ```ts
122
- * const userInput = '<script>alert("xss")</script>';
123
- * const safe = safeHtml`<div>${userInput}</div>`;
124
- * // Result: '<div>&lt;script&gt;alert("xss")&lt;/script&gt;</div>'
125
- * ```
126
- */
127
- export declare const safeHtml: (strings: TemplateStringsArray, ...values: unknown[]) => string;
128
- /**
129
- * Defines and registers a custom Web Component.
130
- *
131
- * This function creates a new custom element with the given tag name
132
- * and configuration. The component uses Shadow DOM for encapsulation
133
- * and automatically re-renders when observed attributes change.
134
- *
135
- * @template TProps - Type of the component's props
136
- * @param tagName - The custom element tag name (must contain a hyphen)
137
- * @param definition - The component configuration
138
- *
139
- * @example
140
- * ```ts
141
- * component('counter-button', {
142
- * props: {
143
- * start: { type: Number, default: 0 },
144
- * },
145
- * state: { count: 0 },
146
- * styles: `
147
- * button { padding: 0.5rem 1rem; }
148
- * `,
149
- * connected() {
150
- * console.log('Counter mounted');
151
- * },
152
- * render({ props, state, emit }) {
153
- * return html`
154
- * <button onclick="this.getRootNode().host.increment()">
155
- * Count: ${state.count}
156
- * </button>
157
- * `;
158
- * },
159
- * });
160
- * ```
161
- */
162
- export declare const component: <TProps extends Record<string, unknown>>(tagName: string, definition: ComponentDefinition<TProps>) => void;
37
+ export { component, defineComponent } from './component';
38
+ export { html, safeHtml } from './html';
39
+ export type { ComponentDefinition, ComponentRenderContext, PropDefinition } from './types';
163
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/component/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI;IACxC,0DAA0D;IAC1D,IAAI,EACA,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB;QAAE,KAAK,KAAK,EAAE,OAAO,GAAG,CAAC,CAAA;KAAE,GAC3B,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,0DAA0D;IAC1D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;CACnC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAC9F;IACE,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7C,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC;IACjD,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,4CAA4C;IAC5C,MAAM,EAAE,CAAC,OAAO,EAAE;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/B,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;KACjD,KAAK,MAAM,CAAC;CACd,CAAC;AAsDJ;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,GAAI,SAAS,oBAAoB,EAAE,GAAG,QAAQ,OAAO,EAAE,KAAG,MAE1E,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ,GAAI,SAAS,oBAAoB,EAAE,GAAG,QAAQ,OAAO,EAAE,KAAG,MAgB9E,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,SAAS,MAAM,EACf,YAAY,mBAAmB,CAAC,MAAM,CAAC,KACtC,IAwKF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/component/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Prop coercion utilities.
3
+ *
4
+ * @module bquery/component
5
+ */
6
+ import type { PropDefinition } from './types';
7
+ /**
8
+ * Coerces a string attribute value into a typed prop value.
9
+ * Supports String, Number, Boolean, Object, Array, and custom converters.
10
+ *
11
+ * @internal
12
+ * @template T - The target type
13
+ * @param rawValue - The raw string value from the attribute
14
+ * @param config - The prop definition with type information
15
+ * @returns The coerced value of type T
16
+ */
17
+ export declare const coercePropValue: <T>(rawValue: string, config: PropDefinition<T>) => T;
18
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/component/props.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,UAAU,MAAM,EAAE,QAAQ,cAAc,CAAC,CAAC,CAAC,KAAG,CAiGhF,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Component types and render context definitions.
3
+ *
4
+ * @module bquery/component
5
+ */
6
+ /**
7
+ * Defines a single prop's type and configuration.
8
+ *
9
+ * @template T - The TypeScript type of the prop value
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const myProp: PropDefinition<number> = {
14
+ * type: Number,
15
+ * required: false,
16
+ * default: 0,
17
+ * };
18
+ * ```
19
+ */
20
+ export type PropDefinition<T = unknown> = {
21
+ /** Constructor or converter function for the prop type */
22
+ type: StringConstructor | NumberConstructor | BooleanConstructor | ObjectConstructor | ArrayConstructor | {
23
+ new (value: unknown): T;
24
+ } | ((value: unknown) => T);
25
+ /** Whether the prop must be provided */
26
+ required?: boolean;
27
+ /** Default value when prop is not provided */
28
+ default?: T;
29
+ /** Optional validator function to validate prop values */
30
+ validator?: (value: T) => boolean;
31
+ /**
32
+ * Explicitly control whether to invoke `type` with `new` (constructor) or as a plain function.
33
+ * - `true`: Always use `new type(value)` (for class constructors, Date, etc.)
34
+ * - `false`: Always call `type(value)` (for converter functions)
35
+ * - `undefined` (default): Auto-detect based on heuristics with fallback
36
+ */
37
+ construct?: boolean;
38
+ };
39
+ /**
40
+ * Render context passed into a component render function.
41
+ */
42
+ export type ComponentRenderContext<TProps extends Record<string, unknown>> = {
43
+ /** Typed props object populated from attributes */
44
+ props: TProps;
45
+ /** Internal mutable state object */
46
+ state: Record<string, unknown>;
47
+ /** Emit a custom event from the component */
48
+ emit: (event: string, detail?: unknown) => void;
49
+ };
50
+ /**
51
+ * Complete component definition including props, state, styles, and lifecycle.
52
+ *
53
+ * @template TProps - Type of the component's props
54
+ */
55
+ export type ComponentDefinition<TProps extends Record<string, unknown> = Record<string, unknown>> = {
56
+ /** Prop definitions with types and defaults */
57
+ props?: Record<keyof TProps, PropDefinition>;
58
+ /** Initial internal state */
59
+ state?: Record<string, unknown>;
60
+ /** CSS styles scoped to the component's shadow DOM */
61
+ styles?: string;
62
+ /** Lifecycle hook called before the component mounts (before first render) */
63
+ beforeMount?: () => void;
64
+ /** Lifecycle hook called when component is added to DOM */
65
+ connected?: () => void;
66
+ /** Lifecycle hook called when component is removed from DOM */
67
+ disconnected?: () => void;
68
+ /** Lifecycle hook called before an update render; return false to prevent */
69
+ beforeUpdate?: (props: TProps) => boolean | void;
70
+ /** Lifecycle hook called after reactive updates trigger a render */
71
+ updated?: () => void;
72
+ /** Error handler for errors during rendering or lifecycle */
73
+ onError?: (error: Error) => void;
74
+ /** Render function returning HTML string */
75
+ render: (context: ComponentRenderContext<TProps>) => string;
76
+ };
77
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/component/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI;IACxC,0DAA0D;IAC1D,IAAI,EACA,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB;QAAE,KAAK,KAAK,EAAE,OAAO,GAAG,CAAC,CAAA;KAAE,GAC3B,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,0DAA0D;IAC1D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IAClC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC3E,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,6CAA6C;IAC7C,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAC9F;IACE,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7C,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC;IACjD,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,4CAA4C;IAC5C,MAAM,EAAE,CAAC,OAAO,EAAE,sBAAsB,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;CAC7D,CAAC"}
@@ -1,43 +1,52 @@
1
- const u = (e, r) => {
2
- const { type: o } = r;
3
- if (o === String) return e;
4
- if (o === Number) {
5
- const s = Number(e);
6
- return Number.isNaN(s) ? e : s;
1
+ import { s as h } from "./sanitize-1FBEPAFH.js";
2
+ const p = (e, r) => {
3
+ const { type: s } = r;
4
+ if (s === String) return e;
5
+ if (s === Number)
6
+ return Number(e);
7
+ if (s === Boolean) {
8
+ const c = e.trim().toLowerCase();
9
+ return c === "" || c === "true" || c === "1" ? !0 : c === "false" || c === "0" ? !1 : !!e;
7
10
  }
8
- if (o === Boolean) {
9
- const s = e.trim().toLowerCase();
10
- return s === "" || s === "true" || s === "1" ? !0 : s === "false" || s === "0" ? !1 : !!e;
11
- }
12
- if (o === Object || o === Array)
11
+ if (s === Object || s === Array)
13
12
  try {
14
13
  return JSON.parse(e);
15
14
  } catch {
16
15
  return e;
17
16
  }
18
- if (typeof o == "function") {
19
- const s = o, t = o;
17
+ if (typeof s == "function") {
18
+ const c = s, t = s;
19
+ if (r.construct === !0)
20
+ return Reflect.construct(t, [e]);
21
+ if (r.construct === !1)
22
+ return c(e);
23
+ const o = s.prototype !== void 0 && s.prototype !== null, u = (o ? Object.getOwnPropertyNames(s.prototype) : []).length > 1, n = o && s.prototype.constructor !== s, l = /^class\s/.test(Function.prototype.toString.call(s));
24
+ if (u || n || l)
25
+ try {
26
+ return Reflect.construct(t, [e]);
27
+ } catch {
28
+ return c(e);
29
+ }
20
30
  try {
21
- return s(e);
22
- } catch {
23
- return new t(e);
31
+ const a = c(e);
32
+ if (a === void 0 && o)
33
+ try {
34
+ return Reflect.construct(t, [e]);
35
+ } catch {
36
+ return a;
37
+ }
38
+ return a;
39
+ } catch (a) {
40
+ if (a instanceof TypeError && /cannot be invoked without 'new'|is not a function/i.test(a.message))
41
+ return Reflect.construct(t, [e]);
42
+ throw a;
24
43
  }
25
44
  }
26
45
  return e;
27
- }, p = (e, ...r) => e.reduce((o, s, t) => `${o}${s}${r[t] ?? ""}`, ""), i = (e, ...r) => {
28
- const o = {
29
- "&": "&amp;",
30
- "<": "&lt;",
31
- ">": "&gt;",
32
- '"': "&quot;",
33
- "'": "&#x27;",
34
- "`": "&#x60;"
35
- }, s = (t) => String(t ?? "").replace(/[&<>"'`]/g, (n) => o[n]);
36
- return e.reduce((t, c, n) => `${t}${c}${s(r[n])}`, "");
37
46
  }, d = (e, r) => {
38
- class o extends HTMLElement {
47
+ class s extends HTMLElement {
39
48
  constructor() {
40
- super(), this.state = { ...r.state ?? {} }, this.props = {}, this.attachShadow({ mode: "open" }), this.syncProps();
49
+ super(), this.state = { ...r.state ?? {} }, this.props = {}, this.missingRequiredProps = /* @__PURE__ */ new Set(), this.hasMounted = !1, this.attachShadow({ mode: "open" }), this.syncProps();
41
50
  }
42
51
  /**
43
52
  * Returns the list of attributes to observe for changes.
@@ -50,11 +59,21 @@ const u = (e, r) => {
50
59
  */
51
60
  connectedCallback() {
52
61
  try {
53
- r.beforeMount?.call(this), r.connected?.call(this), this.render();
62
+ if (this.missingRequiredProps.size > 0)
63
+ return;
64
+ this.mount();
54
65
  } catch (t) {
55
66
  this.handleError(t);
56
67
  }
57
68
  }
69
+ /**
70
+ * Performs the initial mount of the component.
71
+ * Called when the element is connected and all required props are present.
72
+ * @internal
73
+ */
74
+ mount() {
75
+ this.hasMounted || (r.beforeMount?.call(this), r.connected?.call(this), this.render(), this.hasMounted = !0);
76
+ }
58
77
  /**
59
78
  * Called when the element is removed from the DOM.
60
79
  */
@@ -68,11 +87,11 @@ const u = (e, r) => {
68
87
  /**
69
88
  * Called when an observed attribute changes.
70
89
  */
71
- attributeChangedCallback() {
90
+ attributeChangedCallback(t, o, i) {
72
91
  try {
73
- this.syncProps(), this.render(!0);
74
- } catch (t) {
75
- this.handleError(t);
92
+ this.syncProps(), this.hasMounted ? this.render(!0) : this.isConnected && this.missingRequiredProps.size === 0 && this.mount();
93
+ } catch (u) {
94
+ this.handleError(u);
76
95
  }
77
96
  }
78
97
  /**
@@ -88,8 +107,8 @@ const u = (e, r) => {
88
107
  * @param key - The state property key
89
108
  * @param value - The new value
90
109
  */
91
- setState(t, c) {
92
- this.state[t] = c, this.render(!0);
110
+ setState(t, o) {
111
+ this.state[t] = o, this.render(!0);
93
112
  }
94
113
  /**
95
114
  * Gets a state property value.
@@ -106,20 +125,14 @@ const u = (e, r) => {
106
125
  */
107
126
  syncProps() {
108
127
  const t = r.props ?? {};
109
- for (const [c, n] of Object.entries(t)) {
110
- const l = this.getAttribute(c);
111
- let a;
112
- if (l == null) {
113
- if (n.required && n.default === void 0)
114
- throw new Error(`bQuery component: missing required prop "${c}"`);
115
- a = n.default ?? void 0;
116
- } else
117
- a = u(l, n);
118
- if (n.validator && a !== void 0 && !n.validator(a))
128
+ for (const [o, i] of Object.entries(t)) {
129
+ const u = this.getAttribute(o);
130
+ let n;
131
+ if (u == null ? i.required && i.default === void 0 ? (this.missingRequiredProps.add(o), n = void 0) : n = i.default ?? void 0 : (this.missingRequiredProps.has(o) && this.missingRequiredProps.delete(o), n = p(u, i)), i.validator && n !== void 0 && !i.validator(n))
119
132
  throw new Error(
120
- `bQuery component: validation failed for prop "${c}" with value ${JSON.stringify(a)}`
133
+ `bQuery component: validation failed for prop "${o}" with value ${JSON.stringify(n)}`
121
134
  );
122
- this.props[c] = a;
135
+ this.props[o] = n;
123
136
  }
124
137
  }
125
138
  /**
@@ -130,26 +143,44 @@ const u = (e, r) => {
130
143
  try {
131
144
  if (t && r.beforeUpdate && r.beforeUpdate.call(this, this.props) === !1)
132
145
  return;
133
- const c = (a, h) => {
134
- this.dispatchEvent(new CustomEvent(a, { detail: h, bubbles: !0, composed: !0 }));
146
+ const o = (n, l) => {
147
+ this.dispatchEvent(new CustomEvent(n, { detail: l, bubbles: !0, composed: !0 }));
135
148
  };
136
149
  if (!this.shadowRoot) return;
137
- const n = r.render({
150
+ const i = r.render({
138
151
  props: this.props,
139
152
  state: this.state,
140
- emit: c
141
- }), l = r.styles ? `<style>${r.styles}</style>` : "";
142
- this.shadowRoot.innerHTML = `${l}${n}`, t && r.updated?.call(this);
143
- } catch (c) {
144
- this.handleError(c);
153
+ emit: o
154
+ }), u = h(i);
155
+ if (this.shadowRoot.innerHTML = u, r.styles) {
156
+ const n = document.createElement("style");
157
+ n.textContent = r.styles, this.shadowRoot.prepend(n);
158
+ }
159
+ t && r.updated?.call(this);
160
+ } catch (o) {
161
+ this.handleError(o);
145
162
  }
146
163
  }
147
164
  }
148
- customElements.get(e) || customElements.define(e, o);
165
+ return s;
166
+ }, b = (e, r) => {
167
+ const s = d(e, r);
168
+ customElements.get(e) || customElements.define(e, s);
169
+ }, E = (e, ...r) => e.reduce((s, c, t) => `${s}${c}${r[t] ?? ""}`, ""), g = (e, ...r) => {
170
+ const s = {
171
+ "&": "&amp;",
172
+ "<": "&lt;",
173
+ ">": "&gt;",
174
+ '"': "&quot;",
175
+ "'": "&#x27;",
176
+ "`": "&#x60;"
177
+ }, c = (t) => String(t ?? "").replace(/[&<>"'`]/g, (i) => s[i]);
178
+ return e.reduce((t, o, i) => `${t}${o}${c(r[i])}`, "");
149
179
  };
150
180
  export {
151
- d as component,
152
- p as html,
153
- i as safeHtml
181
+ b as component,
182
+ d as defineComponent,
183
+ E as html,
184
+ g as safeHtml
154
185
  };
155
186
  //# sourceMappingURL=component.es.mjs.map