@hyperfixi/core 2.0.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 (381) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +218 -0
  3. package/dist/__test-utils__/context-builders.d.ts +42 -0
  4. package/dist/__test-utils__/error-testing.d.ts +18 -0
  5. package/dist/__test-utils__/index.d.ts +6 -0
  6. package/dist/__test-utils__/mock-types.d.ts +57 -0
  7. package/dist/__test-utils__/parser-context-mock.d.ts +7 -0
  8. package/dist/__test-utils__/parser-helpers.d.ts +38 -0
  9. package/dist/api/dom-processor.d.ts +17 -0
  10. package/dist/api/hyperscript-api.d.ts +68 -0
  11. package/dist/api/lokascript-api.d.ts +9 -0
  12. package/dist/ast-utils/analyzer.d.ts +19 -0
  13. package/dist/ast-utils/documentation.d.ts +8 -0
  14. package/dist/ast-utils/generator.d.ts +9 -0
  15. package/dist/ast-utils/index.d.ts +12 -0
  16. package/dist/ast-utils/index.js +3366 -0
  17. package/dist/ast-utils/index.mjs +3320 -0
  18. package/dist/ast-utils/interchange/from-core.d.ts +8 -0
  19. package/dist/ast-utils/interchange/index.d.ts +6 -0
  20. package/dist/ast-utils/interchange/lsp.d.ts +108 -0
  21. package/dist/ast-utils/interchange/to-core.d.ts +8 -0
  22. package/dist/ast-utils/interchange/types.d.ts +113 -0
  23. package/dist/ast-utils/query.d.ts +25 -0
  24. package/dist/ast-utils/transformer.d.ts +14 -0
  25. package/dist/ast-utils/types.d.ts +162 -0
  26. package/dist/ast-utils/visitor.d.ts +40 -0
  27. package/dist/behaviors/boosted.d.ts +29 -0
  28. package/dist/behaviors/history-swap.d.ts +24 -0
  29. package/dist/behaviors/index.d.ts +4 -0
  30. package/dist/behaviors/index.js +1149 -0
  31. package/dist/behaviors/index.mjs +1139 -0
  32. package/dist/bundle-generator/generator.d.ts +4 -0
  33. package/dist/bundle-generator/index.d.ts +6 -0
  34. package/dist/bundle-generator/index.js +2294 -0
  35. package/dist/bundle-generator/index.mjs +2271 -0
  36. package/dist/bundle-generator/parser-templates.d.ts +6 -0
  37. package/dist/bundle-generator/template-capabilities.d.ts +10 -0
  38. package/dist/bundle-generator/templates.d.ts +11 -0
  39. package/dist/bundle-generator/types.d.ts +34 -0
  40. package/dist/bundles/test-minimal.d.ts +3 -0
  41. package/dist/bundles/test-standard.d.ts +3 -0
  42. package/dist/chunks/bridge-I6ceoWxV.js +2 -0
  43. package/dist/chunks/browser-modular-Dv6PAV3c.js +2 -0
  44. package/dist/chunks/feature-eventsource-DWb514fy.js +2 -0
  45. package/dist/chunks/feature-sockets-3PFuvCVY.js +2 -0
  46. package/dist/chunks/feature-webworker-DTm_eh-E.js +2 -0
  47. package/dist/commands/advanced/async.d.ts +28 -0
  48. package/dist/commands/advanced/js.d.ts +28 -0
  49. package/dist/commands/animation/measure.d.ts +31 -0
  50. package/dist/commands/animation/settle.d.ts +26 -0
  51. package/dist/commands/animation/take.d.ts +28 -0
  52. package/dist/commands/animation/transition.d.ts +31 -0
  53. package/dist/commands/async/fetch.d.ts +44 -0
  54. package/dist/commands/async/wait.d.ts +41 -0
  55. package/dist/commands/behaviors/install.d.ts +41 -0
  56. package/dist/commands/content/append.d.ts +27 -0
  57. package/dist/commands/control-flow/break.d.ts +15 -0
  58. package/dist/commands/control-flow/continue.d.ts +15 -0
  59. package/dist/commands/control-flow/exit.d.ts +15 -0
  60. package/dist/commands/control-flow/halt.d.ts +25 -0
  61. package/dist/commands/control-flow/if.d.ts +45 -0
  62. package/dist/commands/control-flow/repeat.d.ts +35 -0
  63. package/dist/commands/control-flow/return.d.ts +23 -0
  64. package/dist/commands/control-flow/signal-base.d.ts +25 -0
  65. package/dist/commands/control-flow/throw.d.ts +22 -0
  66. package/dist/commands/control-flow/unless.d.ts +3 -0
  67. package/dist/commands/data/decrement.d.ts +3 -0
  68. package/dist/commands/data/default.d.ts +31 -0
  69. package/dist/commands/data/get.d.ts +23 -0
  70. package/dist/commands/data/increment.d.ts +25 -0
  71. package/dist/commands/data/set.d.ts +56 -0
  72. package/dist/commands/decorators/index.d.ts +30 -0
  73. package/dist/commands/dom/__tests__/add-standalone-helpers.d.ts +11 -0
  74. package/dist/commands/dom/add.d.ts +31 -0
  75. package/dist/commands/dom/dom-modification-base.d.ts +48 -0
  76. package/dist/commands/dom/hide.d.ts +12 -0
  77. package/dist/commands/dom/make.d.ts +21 -0
  78. package/dist/commands/dom/process-partials.d.ts +39 -0
  79. package/dist/commands/dom/put.d.ts +31 -0
  80. package/dist/commands/dom/remove.d.ts +33 -0
  81. package/dist/commands/dom/show.d.ts +13 -0
  82. package/dist/commands/dom/swap.d.ts +38 -0
  83. package/dist/commands/dom/toggle.d.ts +55 -0
  84. package/dist/commands/dom/visibility-base.d.ts +20 -0
  85. package/dist/commands/events/send.d.ts +3 -0
  86. package/dist/commands/events/trigger.d.ts +36 -0
  87. package/dist/commands/execution/call.d.ts +24 -0
  88. package/dist/commands/execution/pseudo-command.d.ts +42 -0
  89. package/dist/commands/helpers/attribute-manipulation.d.ts +11 -0
  90. package/dist/commands/helpers/batch-dom-operations.d.ts +12 -0
  91. package/dist/commands/helpers/class-manipulation.d.ts +11 -0
  92. package/dist/commands/helpers/condition-helpers.d.ts +4 -0
  93. package/dist/commands/helpers/dom-mutation.d.ts +15 -0
  94. package/dist/commands/helpers/duration-parsing.d.ts +8 -0
  95. package/dist/commands/helpers/element-property-access.d.ts +7 -0
  96. package/dist/commands/helpers/element-resolution.d.ts +17 -0
  97. package/dist/commands/helpers/error-helpers.d.ts +17 -0
  98. package/dist/commands/helpers/event-helpers.d.ts +13 -0
  99. package/dist/commands/helpers/event-waiting.d.ts +37 -0
  100. package/dist/commands/helpers/index.d.ts +32 -0
  101. package/dist/commands/helpers/input-validator.d.ts +23 -0
  102. package/dist/commands/helpers/loop-executor.d.ts +53 -0
  103. package/dist/commands/helpers/numeric-target-parser.d.ts +14 -0
  104. package/dist/commands/helpers/property-target.d.ts +30 -0
  105. package/dist/commands/helpers/selector-type-detection.d.ts +24 -0
  106. package/dist/commands/helpers/smart-element.d.ts +16 -0
  107. package/dist/commands/helpers/style-manipulation.d.ts +16 -0
  108. package/dist/commands/helpers/temporal-modifiers.d.ts +15 -0
  109. package/dist/commands/helpers/url-argument-parser.d.ts +10 -0
  110. package/dist/commands/helpers/url-validation.d.ts +7 -0
  111. package/dist/commands/helpers/variable-access.d.ts +10 -0
  112. package/dist/commands/helpers/visibility-target-parser.d.ts +11 -0
  113. package/dist/commands/index.d.ts +139 -0
  114. package/dist/commands/index.js +9186 -0
  115. package/dist/commands/index.mjs +9032 -0
  116. package/dist/commands/navigation/go.d.ts +35 -0
  117. package/dist/commands/navigation/push-url.d.ts +35 -0
  118. package/dist/commands/navigation/replace-url.d.ts +3 -0
  119. package/dist/commands/templates/render.d.ts +48 -0
  120. package/dist/commands/utility/beep.d.ts +32 -0
  121. package/dist/commands/utility/copy.d.ts +29 -0
  122. package/dist/commands/utility/log.d.ts +24 -0
  123. package/dist/commands/utility/pick.d.ts +26 -0
  124. package/dist/commands/utility/tell.d.ts +26 -0
  125. package/dist/compatibility/browser-bundle-animation-generated.d.ts +16 -0
  126. package/dist/compatibility/browser-bundle-classic-i18n.d.ts +63 -0
  127. package/dist/compatibility/browser-bundle-classic.d.ts +17 -0
  128. package/dist/compatibility/browser-bundle-forms-generated.d.ts +16 -0
  129. package/dist/compatibility/browser-bundle-hybrid-complete.d.ts +28 -0
  130. package/dist/compatibility/browser-bundle-hybrid-hx.d.ts +43 -0
  131. package/dist/compatibility/browser-bundle-lite-plus.d.ts +25 -0
  132. package/dist/compatibility/browser-bundle-lite.d.ts +23 -0
  133. package/dist/compatibility/browser-bundle-minimal-generated.d.ts +16 -0
  134. package/dist/compatibility/browser-bundle-minimal-v2.d.ts +17 -0
  135. package/dist/compatibility/browser-bundle-minimal.d.ts +8 -0
  136. package/dist/compatibility/browser-bundle-modular.d.ts +18 -0
  137. package/dist/compatibility/browser-bundle-multilingual.d.ts +19 -0
  138. package/dist/compatibility/browser-bundle-semantic-complete.d.ts +24 -0
  139. package/dist/compatibility/browser-bundle-standard-v2.d.ts +17 -0
  140. package/dist/compatibility/browser-bundle-standard.d.ts +8 -0
  141. package/dist/compatibility/browser-bundle-textshelf-minimal.d.ts +16 -0
  142. package/dist/compatibility/browser-bundle-textshelf-profile.d.ts +18 -0
  143. package/dist/compatibility/browser-bundle.d.ts +140 -0
  144. package/dist/compatibility/browser-modular.d.ts +53 -0
  145. package/dist/compatibility/browser-tests/test-utils.d.ts +21 -0
  146. package/dist/compatibility/eval-hyperscript.d.ts +15 -0
  147. package/dist/compatibility/feature-loader.d.ts +8 -0
  148. package/dist/compatibility/hyperscript-adapter.d.ts +38 -0
  149. package/dist/compatibility/hyperscript-tests/test-adapter.d.ts +13 -0
  150. package/dist/core/ast-property-utils.d.ts +2 -0
  151. package/dist/core/base-expression-evaluator.d.ts +70 -0
  152. package/dist/core/binary-expression-evaluator.d.ts +7 -0
  153. package/dist/core/call-expression-evaluator.d.ts +7 -0
  154. package/dist/core/configurable-expression-evaluator.d.ts +5 -0
  155. package/dist/core/context.d.ts +15 -0
  156. package/dist/core/dom.d.ts +15 -0
  157. package/dist/core/evaluator-types.d.ts +5 -0
  158. package/dist/core/events.d.ts +48 -0
  159. package/dist/core/executor.d.ts +34 -0
  160. package/dist/core/expression-evaluator.d.ts +6 -0
  161. package/dist/core/lazy-expression-evaluator.d.ts +22 -0
  162. package/dist/core/parser.d.ts +21 -0
  163. package/dist/core/selector-evaluator.d.ts +15 -0
  164. package/dist/core/template-literal-evaluator.d.ts +5 -0
  165. package/dist/dom/attribute-processor.d.ts +40 -0
  166. package/dist/dom/minimal-attribute-processor.d.ts +20 -0
  167. package/dist/experimental/binary-tree/accessor.d.ts +10 -0
  168. package/dist/experimental/binary-tree/ast-serializer.d.ts +26 -0
  169. package/dist/experimental/binary-tree/benchmark.d.ts +24 -0
  170. package/dist/experimental/binary-tree/buffer-context.d.ts +27 -0
  171. package/dist/experimental/binary-tree/deserializer.d.ts +17 -0
  172. package/dist/experimental/binary-tree/index.d.ts +22 -0
  173. package/dist/experimental/binary-tree/serializer.d.ts +4 -0
  174. package/dist/experimental/binary-tree/types.d.ts +54 -0
  175. package/dist/expressions/base-expression.d.ts +27 -0
  176. package/dist/expressions/bundles/common-expressions.d.ts +9 -0
  177. package/dist/expressions/bundles/core-expressions.d.ts +7 -0
  178. package/dist/expressions/bundles/full-expressions.d.ts +10 -0
  179. package/dist/expressions/bundles/index.d.ts +7 -0
  180. package/dist/expressions/comparison/index.d.ts +80 -0
  181. package/dist/expressions/comparison/utils.d.ts +2 -0
  182. package/dist/expressions/conversion/impl/bridge.d.ts +117 -0
  183. package/dist/expressions/conversion/impl/index.d.ts +59 -0
  184. package/dist/expressions/conversion/index.d.ts +23 -0
  185. package/dist/expressions/expression-tiers.d.ts +13 -0
  186. package/dist/expressions/index.d.ts +11 -0
  187. package/dist/expressions/index.js +6930 -0
  188. package/dist/expressions/index.mjs +6912 -0
  189. package/dist/expressions/logical/impl/index.d.ts +54 -0
  190. package/dist/expressions/logical/impl/pattern-matching.d.ts +58 -0
  191. package/dist/expressions/logical/index.d.ts +59 -0
  192. package/dist/expressions/mathematical/index.d.ts +69 -0
  193. package/dist/expressions/positional/impl/bridge.d.ts +95 -0
  194. package/dist/expressions/positional/impl/index.d.ts +73 -0
  195. package/dist/expressions/positional/index.d.ts +26 -0
  196. package/dist/expressions/properties/impl/index.d.ts +105 -0
  197. package/dist/expressions/properties/index.d.ts +26 -0
  198. package/dist/expressions/property/index.d.ts +55 -0
  199. package/dist/expressions/property-access-utils.d.ts +23 -0
  200. package/dist/expressions/references/impl/bridge.d.ts +54 -0
  201. package/dist/expressions/references/impl/index.d.ts +65 -0
  202. package/dist/expressions/references/index.d.ts +40 -0
  203. package/dist/expressions/shared/comparison-utils.d.ts +10 -0
  204. package/dist/expressions/shared/index.d.ts +9 -0
  205. package/dist/expressions/shared/number-utils.d.ts +7 -0
  206. package/dist/expressions/shared/validation-utils.d.ts +13 -0
  207. package/dist/expressions/special/index.d.ts +104 -0
  208. package/dist/expressions/type-helpers.d.ts +11 -0
  209. package/dist/expressions/type-registry.d.ts +57 -0
  210. package/dist/expressions/validation-helpers.d.ts +15 -0
  211. package/dist/extensions/index.d.ts +3 -0
  212. package/dist/extensions/tailwind.d.ts +22 -0
  213. package/dist/features/behaviors.d.ts +153 -0
  214. package/dist/features/def.d.ts +135 -0
  215. package/dist/features/eventsource.d.ts +140 -0
  216. package/dist/features/init.d.ts +135 -0
  217. package/dist/features/on.d.ts +131 -0
  218. package/dist/features/predefined-behaviors/dropdown-behavior.d.ts +20 -0
  219. package/dist/features/predefined-behaviors/index.d.ts +12 -0
  220. package/dist/features/predefined-behaviors/modal-behavior.d.ts +18 -0
  221. package/dist/features/predefined-behaviors/toggle-group-behavior.d.ts +23 -0
  222. package/dist/features/predefined-behaviors/types.d.ts +14 -0
  223. package/dist/features/sockets.d.ts +162 -0
  224. package/dist/features/webworker.d.ts +135 -0
  225. package/dist/htmx/htmx-attribute-processor.d.ts +84 -0
  226. package/dist/htmx/htmx-translator.d.ts +19 -0
  227. package/dist/htmx/index.d.ts +3 -0
  228. package/dist/hyperfixi-classic-i18n.js +2 -0
  229. package/dist/hyperfixi-hx.js +1 -0
  230. package/dist/hyperfixi-hybrid-complete.js +1 -0
  231. package/dist/hyperfixi-lite-plus.js +1 -0
  232. package/dist/hyperfixi-lite.js +1 -0
  233. package/dist/hyperfixi-minimal.js +1 -0
  234. package/dist/hyperfixi-multilingual.js +2 -0
  235. package/dist/hyperfixi-standard.js +2 -0
  236. package/dist/hyperfixi.js +2 -0
  237. package/dist/hyperfixi.mjs +2 -0
  238. package/dist/index.d.ts +25 -0
  239. package/dist/index.js +65387 -0
  240. package/dist/index.min.js +2 -0
  241. package/dist/index.mjs +65343 -0
  242. package/dist/lib/index.d.ts +4 -0
  243. package/dist/lib/morph-adapter.d.ts +22 -0
  244. package/dist/lib/swap-executor.d.ts +22 -0
  245. package/dist/lib/view-transitions.d.ts +33 -0
  246. package/dist/lokascript-browser-classic-i18n.js +2 -0
  247. package/dist/lokascript-browser-minimal.js +1 -0
  248. package/dist/lokascript-browser-standard.js +2 -0
  249. package/dist/lokascript-browser.js +2 -0
  250. package/dist/lokascript-hybrid-complete.js +1 -0
  251. package/dist/lokascript-hybrid-hx.js +1 -0
  252. package/dist/lokascript-lite-plus.js +1 -0
  253. package/dist/lokascript-lite.js +1 -0
  254. package/dist/lokascript-multilingual.js +2 -0
  255. package/dist/lsp-metadata.d.ts +25 -0
  256. package/dist/lsp-metadata.js +680 -0
  257. package/dist/lsp-metadata.mjs +670 -0
  258. package/dist/metadata.d.ts +213 -0
  259. package/dist/metadata.js +378 -0
  260. package/dist/metadata.mjs +368 -0
  261. package/dist/mod.d.ts +63 -0
  262. package/dist/multilingual/bridge.d.ts +36 -0
  263. package/dist/multilingual/index.d.ts +32 -0
  264. package/dist/multilingual/index.js +285 -0
  265. package/dist/multilingual/index.mjs +278 -0
  266. package/dist/parser/__types__/test-helpers.d.ts +25 -0
  267. package/dist/parser/command-node-builder.d.ts +45 -0
  268. package/dist/parser/command-parsers/animation-commands.d.ts +5 -0
  269. package/dist/parser/command-parsers/async-commands.d.ts +5 -0
  270. package/dist/parser/command-parsers/control-flow-commands.d.ts +7 -0
  271. package/dist/parser/command-parsers/dom-commands.d.ts +8 -0
  272. package/dist/parser/command-parsers/event-commands.d.ts +4 -0
  273. package/dist/parser/command-parsers/utility-commands.d.ts +9 -0
  274. package/dist/parser/command-parsers/variable-commands.d.ts +12 -0
  275. package/dist/parser/error-handler.d.ts +34 -0
  276. package/dist/parser/expression-parser.d.ts +6 -0
  277. package/dist/parser/full-parser.d.ts +4 -0
  278. package/dist/parser/full-parser.js +6532 -0
  279. package/dist/parser/full-parser.mjs +6529 -0
  280. package/dist/parser/helpers/ast-helpers.d.ts +22 -0
  281. package/dist/parser/helpers/parsing-helpers.d.ts +19 -0
  282. package/dist/parser/helpers/token-helpers.d.ts +28 -0
  283. package/dist/parser/hybrid/aliases.d.ts +7 -0
  284. package/dist/parser/hybrid/aliases.js +44 -0
  285. package/dist/parser/hybrid/aliases.mjs +37 -0
  286. package/dist/parser/hybrid/ast-types.d.ts +97 -0
  287. package/dist/parser/hybrid/ast-types.js +3 -0
  288. package/dist/parser/hybrid/ast-types.mjs +2 -0
  289. package/dist/parser/hybrid/index.d.ts +6 -0
  290. package/dist/parser/hybrid/index.js +1015 -0
  291. package/dist/parser/hybrid/index.mjs +1005 -0
  292. package/dist/parser/hybrid/parser-core.d.ts +57 -0
  293. package/dist/parser/hybrid/parser-core.js +1001 -0
  294. package/dist/parser/hybrid/parser-core.mjs +999 -0
  295. package/dist/parser/hybrid/tokenizer.d.ts +9 -0
  296. package/dist/parser/hybrid/tokenizer.js +242 -0
  297. package/dist/parser/hybrid/tokenizer.mjs +239 -0
  298. package/dist/parser/hybrid-parser.d.ts +10 -0
  299. package/dist/parser/hybrid-parser.js +1078 -0
  300. package/dist/parser/hybrid-parser.mjs +1071 -0
  301. package/dist/parser/parser-constants.d.ts +102 -0
  302. package/dist/parser/parser-interface.d.ts +11 -0
  303. package/dist/parser/parser-types.d.ts +175 -0
  304. package/dist/parser/parser.d.ts +146 -0
  305. package/dist/parser/regex-parser.d.ts +4 -0
  306. package/dist/parser/regex-parser.js +412 -0
  307. package/dist/parser/regex-parser.mjs +409 -0
  308. package/dist/parser/runtime.d.ts +3 -0
  309. package/dist/parser/semantic-integration.d.ts +61 -0
  310. package/dist/parser/token-consumer.d.ts +35 -0
  311. package/dist/parser/token-predicates.d.ts +77 -0
  312. package/dist/parser/tokenizer.d.ts +57 -0
  313. package/dist/parser/types.d.ts +118 -0
  314. package/dist/performance/expression-cache.d.ts +78 -0
  315. package/dist/performance/integration.d.ts +40 -0
  316. package/dist/performance/production-monitor.d.ts +67 -0
  317. package/dist/reference/index.d.ts +41 -0
  318. package/dist/reference/index.js +586 -0
  319. package/dist/reference/index.mjs +577 -0
  320. package/dist/registry/browser-types.d.ts +20 -0
  321. package/dist/registry/browser-types.js +81 -0
  322. package/dist/registry/browser-types.mjs +76 -0
  323. package/dist/registry/context-provider-registry.d.ts +38 -0
  324. package/dist/registry/environment.d.ts +19 -0
  325. package/dist/registry/environment.js +36 -0
  326. package/dist/registry/environment.mjs +30 -0
  327. package/dist/registry/event-source-registry.d.ts +54 -0
  328. package/dist/registry/examples/server-commands.d.ts +6 -0
  329. package/dist/registry/examples/server-event-source.d.ts +32 -0
  330. package/dist/registry/index.d.ts +54 -0
  331. package/dist/registry/index.js +7636 -0
  332. package/dist/registry/index.mjs +7612 -0
  333. package/dist/registry/multilingual/examples.d.ts +16 -0
  334. package/dist/registry/multilingual/index.d.ts +68 -0
  335. package/dist/registry/runtime-integration.d.ts +30 -0
  336. package/dist/registry/universal-types.d.ts +34 -0
  337. package/dist/registry/universal-types.js +91 -0
  338. package/dist/registry/universal-types.mjs +86 -0
  339. package/dist/runtime/cleanup-registry.d.ts +47 -0
  340. package/dist/runtime/command-adapter.d.ts +63 -0
  341. package/dist/runtime/environment.d.ts +75 -0
  342. package/dist/runtime/runtime-base.d.ts +78 -0
  343. package/dist/runtime/runtime-experimental.d.ts +18 -0
  344. package/dist/runtime/runtime-factory.d.ts +30 -0
  345. package/dist/runtime/runtime.d.ts +19 -0
  346. package/dist/runtime/temporal-modifiers.d.ts +37 -0
  347. package/dist/scripts/code-generator.d.ts +64 -0
  348. package/dist/scripts/generate-missing-commands.d.ts +4 -0
  349. package/dist/test-setup.d.ts +45 -0
  350. package/dist/test-utilities.d.ts +52 -0
  351. package/dist/tokenizer.d.ts +49 -0
  352. package/dist/types/base-types.d.ts +336 -0
  353. package/dist/types/code-fix.d.ts +39 -0
  354. package/dist/types/command-metadata.d.ts +57 -0
  355. package/dist/types/command-types.d.ts +272 -0
  356. package/dist/types/context-types.d.ts +106 -0
  357. package/dist/types/core-context.d.ts +21 -0
  358. package/dist/types/core.d.ts +203 -0
  359. package/dist/types/error-codes.d.ts +207 -0
  360. package/dist/types/expression-types.d.ts +155 -0
  361. package/dist/types/feature-types.d.ts +81 -0
  362. package/dist/types/hooks.d.ts +45 -0
  363. package/dist/types/index.d.ts +32 -0
  364. package/dist/types/result.d.ts +72 -0
  365. package/dist/types/template-types.d.ts +162 -0
  366. package/dist/types/type-guards.d.ts +24 -0
  367. package/dist/types/unified-types.d.ts +99 -0
  368. package/dist/utils/debug-events.d.ts +41 -0
  369. package/dist/utils/debug.d.ts +35 -0
  370. package/dist/utils/dom-utils.d.ts +16 -0
  371. package/dist/utils/element-check.d.ts +7 -0
  372. package/dist/utils/keyboard-shortcuts.d.ts +18 -0
  373. package/dist/utils/performance.d.ts +40 -0
  374. package/dist/validation/command-pattern-validator.d.ts +53 -0
  375. package/dist/validation/common-validators.d.ts +24 -0
  376. package/dist/validation/lightweight-validators.d.ts +113 -0
  377. package/dist/validation/partial-validation-types.d.ts +50 -0
  378. package/dist/validation/partial-validator.d.ts +6 -0
  379. package/dist/validation/partial-warning-formatter.d.ts +6 -0
  380. package/dist/validation/validate-cli.d.ts +41 -0
  381. package/package.json +292 -0
@@ -0,0 +1,162 @@
1
+ import type { BaseTypedExpression, TypedExpressionContext, EvaluationResult, ValidationResult, LLMDocumentation } from './base-types';
2
+ import type { HyperScriptValue } from './command-types';
3
+ import type { ExecutionContext } from './core.ts';
4
+ export interface TemplateExecutionContext extends TypedExpressionContext {
5
+ readonly templateBuffer: string[];
6
+ readonly templateDepth: number;
7
+ readonly iterationContext?: {
8
+ collection: HyperScriptValue;
9
+ currentIndex: number;
10
+ currentItem: HyperScriptValue;
11
+ totalItems: number;
12
+ };
13
+ readonly conditionalContext?: {
14
+ conditionMet: boolean;
15
+ elseAllowed: boolean;
16
+ branchExecuted: boolean;
17
+ } | undefined;
18
+ readonly templateMeta: {
19
+ templateName?: string;
20
+ compiledAt: number;
21
+ executionStartTime: number;
22
+ directiveStack: string[];
23
+ };
24
+ }
25
+ export type TemplateDirectiveType = '@if' | '@else' | '@repeat' | '@include' | '@end';
26
+ export type TemplateRenderStrategy = 'replace' | 'append' | 'conditional' | 'iterate';
27
+ export interface EnhancedTemplateDirective<TInput = unknown, TOutput = string> extends BaseTypedExpression<TOutput> {
28
+ readonly directiveType: TemplateDirectiveType;
29
+ readonly renderStrategy: TemplateRenderStrategy;
30
+ readonly createsScope: boolean;
31
+ readonly allowsNesting: boolean;
32
+ readonly allowedNext: TemplateDirectiveType[];
33
+ executeTemplate(context: TemplateExecutionContext, input: TInput, templateContent: string): Promise<EvaluationResult<string>>;
34
+ validateTemplateContext(context: TemplateExecutionContext, input: TInput): ValidationResult;
35
+ }
36
+ export declare const IfDirectiveInputSchema: import("../validation/lightweight-validators").RuntimeValidator<{
37
+ [x: string]: unknown;
38
+ }>;
39
+ export interface IfDirectiveInput {
40
+ condition: unknown;
41
+ templateContent: string;
42
+ }
43
+ export declare const ElseDirectiveInputSchema: import("../validation/lightweight-validators").RuntimeValidator<{
44
+ [x: string]: unknown;
45
+ }>;
46
+ export interface ElseDirectiveInput {
47
+ templateContent: string;
48
+ }
49
+ export declare const RepeatDirectiveInputSchema: import("../validation/lightweight-validators").RuntimeValidator<{
50
+ [x: string]: unknown;
51
+ }>;
52
+ export interface RepeatDirectiveInput {
53
+ collection: unknown;
54
+ iteratorVariable?: string;
55
+ templateContent: string;
56
+ }
57
+ export interface EnhancedCompiledTemplate {
58
+ directives: EnhancedTemplateDirective[];
59
+ content: string[];
60
+ interpolations: Array<{
61
+ expression: string;
62
+ startIndex: number;
63
+ endIndex: number;
64
+ evaluatedType?: string;
65
+ }>;
66
+ metadata: {
67
+ originalTemplate: string;
68
+ compiledAt: number;
69
+ directiveCount: number;
70
+ interpolationCount: number;
71
+ estimatedComplexity: 'simple' | 'medium' | 'complex';
72
+ };
73
+ dependencies: {
74
+ requiredVariables: string[];
75
+ usedFeatures: string[];
76
+ nestedTemplates: string[];
77
+ };
78
+ }
79
+ export interface TemplateError {
80
+ readonly name: 'TemplateCompilationError' | 'TemplateExecutionError' | 'TemplateValidationError';
81
+ readonly message: string;
82
+ readonly code: string;
83
+ readonly templateName?: string;
84
+ readonly lineNumber?: number;
85
+ readonly columnNumber?: number;
86
+ readonly directiveType?: TemplateDirectiveType;
87
+ readonly suggestions: string[];
88
+ readonly context?: {
89
+ originalTemplate: string;
90
+ compiledDirectives: string[];
91
+ executionStack: string[];
92
+ };
93
+ }
94
+ export interface TemplatePerformanceMetrics {
95
+ readonly compilationTime: number;
96
+ readonly executionTime: number;
97
+ readonly renderTime: number;
98
+ readonly memoryUsage: number;
99
+ readonly cacheHits: number;
100
+ readonly cacheMisses: number;
101
+ readonly directiveExecutions: Record<TemplateDirectiveType, number>;
102
+ }
103
+ export interface EnhancedTemplateConfig {
104
+ enableCaching: boolean;
105
+ maxCacheSize: number;
106
+ enableMetrics: boolean;
107
+ enableValidation: boolean;
108
+ executionTimeout: number;
109
+ maxNestingDepth: number;
110
+ customDirectives: Record<string, EnhancedTemplateDirective>;
111
+ preprocessors: Array<(template: string) => string>;
112
+ postprocessors: Array<(result: string) => string>;
113
+ }
114
+ export interface TemplateContextBridge {
115
+ toTemplateContext(context: ExecutionContext, options?: {
116
+ templateName?: string;
117
+ initialBuffer?: string[];
118
+ iterationContext?: TemplateExecutionContext['iterationContext'];
119
+ }): TemplateExecutionContext;
120
+ fromTemplateContext(templateContext: TemplateExecutionContext, originalContext: ExecutionContext): ExecutionContext;
121
+ }
122
+ export interface TemplateDirectiveRegistry {
123
+ register<T extends EnhancedTemplateDirective>(directive: T): void;
124
+ get(directiveType: TemplateDirectiveType): EnhancedTemplateDirective | undefined;
125
+ has(directiveType: TemplateDirectiveType): boolean;
126
+ list(): TemplateDirectiveType[];
127
+ validate(directiveType: TemplateDirectiveType, input: unknown): ValidationResult;
128
+ }
129
+ export interface TemplateLLMDocumentation extends LLMDocumentation {
130
+ patterns: Array<{
131
+ name: string;
132
+ template: string;
133
+ context: Record<string, unknown>;
134
+ expectedOutput: string;
135
+ explanation: string;
136
+ }>;
137
+ combinations: Array<{
138
+ directives: TemplateDirectiveType[];
139
+ description: string;
140
+ example: string;
141
+ useCase: string;
142
+ }>;
143
+ troubleshooting: Array<{
144
+ error: string;
145
+ cause: string;
146
+ solution: string;
147
+ prevention: string;
148
+ }>;
149
+ }
150
+ export type TemplateStringLiteral<T extends string> = T;
151
+ export type InterpolationPattern = `\${${string}}`;
152
+ export type DirectivePattern = `@${string}`;
153
+ export type TemplateDataTypes = string | number | boolean | null | undefined | Array<string | number | boolean | null | undefined | Record<string, unknown>> | Record<string, string | number | boolean | null | undefined | Array<unknown>>;
154
+ export interface StandardTemplateContext {
155
+ readonly data: Record<string, TemplateDataTypes>;
156
+ readonly parent?: StandardTemplateContext;
157
+ readonly helpers: Record<string, (...args: unknown[]) => unknown>;
158
+ readonly partials: Record<string, string>;
159
+ readonly options: Record<string, unknown>;
160
+ }
161
+ export type { BaseTypedExpression, TypedExpressionContext, ExpressionMetadata, ValidationResult, LLMDocumentation, } from './expression-types';
162
+ //# sourceMappingURL=template-types.d.ts.map
@@ -0,0 +1,24 @@
1
+ export declare function isInputElement(el: unknown): el is HTMLInputElement;
2
+ export declare function isFormElement(el: unknown): el is HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
3
+ export declare function isHTMLElement(el: unknown): el is HTMLElement;
4
+ export declare function isDOMElement(value: unknown): value is Element;
5
+ export declare function isDOMNode(value: unknown): value is Node;
6
+ export declare function isOptionElement(el: unknown): el is HTMLOptionElement;
7
+ export declare function isArrayLike(value: unknown): value is ArrayLike<unknown>;
8
+ export declare function isNodeList(value: unknown): value is NodeList;
9
+ export declare function isHTMLCollection(value: unknown): value is HTMLCollection;
10
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
11
+ export declare function isObject(value: unknown): value is object;
12
+ export declare function isFunction(value: unknown): value is Function;
13
+ export declare function isPromiseLike(value: unknown): value is PromiseLike<unknown>;
14
+ export declare function getProperty<T = unknown>(obj: unknown, key: string): T | undefined;
15
+ export declare function setProperty<T = unknown>(obj: unknown, key: string, value: T): boolean;
16
+ export declare function hasProperty(obj: unknown, key: string): boolean;
17
+ export declare function toNumber(value: unknown): number | undefined;
18
+ export declare function compareValues(left: unknown, right: unknown, op: '<' | '>' | '<=' | '>='): boolean | undefined;
19
+ export declare function getFormValue(el: unknown): string | undefined;
20
+ export declare function getChecked(el: unknown): boolean | undefined;
21
+ export declare function getDisabled(el: unknown): boolean | undefined;
22
+ export declare function getSelected(el: unknown): boolean | undefined;
23
+ export declare function getHidden(el: unknown): boolean | undefined;
24
+ //# sourceMappingURL=type-guards.d.ts.map
@@ -0,0 +1,99 @@
1
+ import type { RuntimeValidator } from '../validation/lightweight-validators';
2
+ import type { ExecutionContext, ValidationError, ValidationResult } from './base-types';
3
+ export type { CoreExecutionContext } from './core-context';
4
+ export { createCoreContext, isCoreExecutionContext, assertHTMLElement, asHTMLElement, } from './core-context';
5
+ export type { ValidationError, ValidationResult } from './base-types';
6
+ export type HyperScriptValueType = 'string' | 'number' | 'boolean' | 'element' | 'element-list' | 'array' | 'object' | 'promise' | 'fragment' | 'null' | 'undefined' | 'function' | 'event' | 'error' | 'unknown';
7
+ export type EvaluationType = HyperScriptValueType | 'Any' | 'Context' | 'Command' | 'Expression';
8
+ export type HyperScriptValue = string | number | boolean | HTMLElement | HTMLElement[] | unknown[] | Record<string, unknown> | Promise<unknown> | DocumentFragment | null | undefined | Function | Event;
9
+ export type { ExecutionContext, TypedExecutionContext } from './base-types';
10
+ export interface Result<T = unknown> {
11
+ readonly success: boolean;
12
+ readonly value?: T;
13
+ readonly error?: {
14
+ readonly name: string;
15
+ readonly message: string;
16
+ readonly code?: string;
17
+ readonly suggestions?: string[];
18
+ };
19
+ readonly type?: string;
20
+ }
21
+ export interface TypedResult<T = unknown> extends Result<T> {
22
+ readonly errors?: ValidationError[];
23
+ readonly suggestions?: readonly string[] | string[];
24
+ }
25
+ export type CommandCategory = 'dom-manipulation' | 'event-handling' | 'data-processing' | 'control-flow' | 'animation' | 'network' | 'utility' | 'navigation' | 'templates' | 'advanced';
26
+ export type SideEffect = 'dom-mutation' | 'network-request' | 'local-storage' | 'global-state' | 'event-emission' | 'timer-creation' | 'navigation' | 'dom-query' | 'history' | 'async' | 'attribute-transfer';
27
+ export type ExpressionCategory = 'Reference' | 'Property' | 'Logical' | 'Mathematical' | 'Conversion' | 'Positional' | 'Special' | 'Template';
28
+ export interface ExpressionMetadata {
29
+ readonly category: ExpressionCategory;
30
+ readonly complexity: 'simple' | 'medium' | 'complex';
31
+ readonly sideEffects?: SideEffect[];
32
+ readonly dependencies?: string[];
33
+ readonly returnTypes?: EvaluationType[];
34
+ readonly examples?: Array<{
35
+ readonly input: string;
36
+ readonly description: string;
37
+ readonly expectedOutput: unknown;
38
+ readonly context?: Partial<ExecutionContext>;
39
+ }>;
40
+ readonly relatedExpressions?: string[];
41
+ readonly performance?: {
42
+ readonly averageTime: number;
43
+ readonly complexity: string;
44
+ };
45
+ }
46
+ export interface ASTNode {
47
+ readonly type: string;
48
+ readonly line?: number;
49
+ readonly column?: number;
50
+ readonly start?: number;
51
+ readonly end?: number;
52
+ readonly raw?: string;
53
+ readonly [key: string]: unknown;
54
+ }
55
+ export interface ParseError {
56
+ readonly name?: string;
57
+ readonly message: string;
58
+ readonly line: number;
59
+ readonly column: number;
60
+ readonly position?: number;
61
+ readonly source?: string;
62
+ }
63
+ export interface LLMDocumentation {
64
+ readonly summary: string;
65
+ readonly parameters: Array<{
66
+ readonly name: string;
67
+ readonly type: string;
68
+ readonly description: string;
69
+ readonly optional: boolean;
70
+ readonly examples: string[];
71
+ }>;
72
+ readonly returns: {
73
+ readonly type: string;
74
+ readonly description: string;
75
+ readonly examples: string[];
76
+ };
77
+ readonly examples: Array<{
78
+ readonly title: string;
79
+ readonly code: string;
80
+ readonly explanation: string;
81
+ readonly output: unknown;
82
+ }>;
83
+ readonly seeAlso: string[];
84
+ readonly tags: string[];
85
+ }
86
+ export declare class Validator {
87
+ static validateInput<T>(input: unknown, schema: RuntimeValidator<T>): ValidationResult<T>;
88
+ static createValidationError(type: ValidationError['type'], message: string, suggestions?: string[], path?: string, code?: string): ValidationError;
89
+ static createSuccessResult<T>(data: T): ValidationResult<T>;
90
+ static createErrorResult<T>(errors: ValidationError[], suggestions?: string[]): ValidationResult<T>;
91
+ }
92
+ export declare function isValidationResult<T>(value: unknown): value is ValidationResult<T>;
93
+ export declare function isExecutionContext(value: unknown): value is ExecutionContext;
94
+ export declare const CoreTypes: {
95
+ Validator: typeof Validator;
96
+ isValidationResult: typeof isValidationResult;
97
+ isExecutionContext: typeof isExecutionContext;
98
+ };
99
+ //# sourceMappingURL=unified-types.d.ts.map
@@ -0,0 +1,41 @@
1
+ export interface SemanticParseEventDetail {
2
+ input: string;
3
+ language: string;
4
+ confidence: number;
5
+ threshold: number;
6
+ semanticSuccess: boolean;
7
+ fallbackTriggered: boolean;
8
+ command?: string;
9
+ roles?: Record<string, string>;
10
+ errors?: string[];
11
+ timestamp: number;
12
+ duration?: number;
13
+ }
14
+ export interface ParseCompleteEventDetail {
15
+ input: string;
16
+ method: 'semantic' | 'traditional' | 'expression';
17
+ success: boolean;
18
+ command?: string;
19
+ errors?: string[];
20
+ timestamp: number;
21
+ duration?: number;
22
+ }
23
+ export declare function enableDebugEvents(target?: EventTarget): void;
24
+ export declare function disableDebugEvents(): void;
25
+ export declare function isDebugEnabled(): boolean;
26
+ export declare function emitSemanticParseEvent(detail: SemanticParseEventDetail): void;
27
+ export declare function emitParseCompleteEvent(detail: ParseCompleteEventDetail): void;
28
+ export interface DebugStats {
29
+ totalParses: number;
30
+ semanticSuccesses: number;
31
+ semanticFallbacks: number;
32
+ traditionalParses: number;
33
+ averageConfidence: number;
34
+ confidenceHistory: number[];
35
+ }
36
+ export declare function updateDebugStats(event: SemanticParseEventDetail): void;
37
+ export declare function getDebugStats(): Readonly<DebugStats>;
38
+ export declare function resetDebugStats(): void;
39
+ export declare function getEventHistory(): readonly SemanticParseEventDetail[];
40
+ export declare function replayEvents(callback: (event: SemanticParseEventDetail) => void): void;
41
+ //# sourceMappingURL=debug-events.d.ts.map
@@ -0,0 +1,35 @@
1
+ export declare const DEBUG: {
2
+ commands: boolean;
3
+ events: boolean;
4
+ parsing: boolean;
5
+ expressions: boolean;
6
+ styles: boolean;
7
+ runtime: boolean;
8
+ loops: boolean;
9
+ async: boolean;
10
+ };
11
+ export declare const debug: {
12
+ command: (...args: any[]) => void;
13
+ event: (...args: any[]) => void;
14
+ parse: (...args: any[]) => void;
15
+ expr: (...args: any[]) => void;
16
+ expressions: (...args: any[]) => void;
17
+ style: (...args: any[]) => void;
18
+ runtime: (...args: any[]) => void;
19
+ loop: (...args: any[]) => void;
20
+ async: (...args: any[]) => void;
21
+ };
22
+ export declare const debugGroup: {
23
+ start: (label: string) => void;
24
+ end: () => void;
25
+ };
26
+ export declare const debugControl: {
27
+ enable(): void;
28
+ disable(): void;
29
+ isEnabled(): boolean;
30
+ status(): {
31
+ enabled: boolean;
32
+ source: string;
33
+ };
34
+ };
35
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1,16 @@
1
+ import type { TypedExecutionContext } from '../types/command-types.ts';
2
+ export declare function asHTMLElement(element: Element | null): HTMLElement | null;
3
+ export declare function asHTMLElement(element: Element | undefined): HTMLElement | undefined;
4
+ export declare function requireHTMLElement(element: Element | null | undefined, context?: string): HTMLElement;
5
+ export declare function asHTMLElements(elements: Element[]): HTMLElement[];
6
+ export declare function isHTMLElement(element: Element | null | undefined): element is HTMLElement;
7
+ export interface ResolveTargetsOptions {
8
+ allowEmpty?: boolean;
9
+ contextRequired?: boolean;
10
+ }
11
+ export declare function resolveTargets(context: TypedExecutionContext, target?: unknown, options?: ResolveTargetsOptions): HTMLElement[];
12
+ export declare function isValidClassName(className: string): boolean;
13
+ export declare function parseClasses(classExpression: unknown, validate?: boolean): string[];
14
+ export declare function isValidAttributeName(name: string): boolean;
15
+ export declare function isValidCSSSelector(selector: string): boolean;
16
+ //# sourceMappingURL=dom-utils.d.ts.map
@@ -0,0 +1,7 @@
1
+ export declare function isHTMLElement(value: unknown): value is HTMLElement;
2
+ export declare function isNode(value: unknown): value is Node;
3
+ export declare function isElement(value: unknown): value is Element;
4
+ export declare function isEventTarget(value: unknown): value is EventTarget;
5
+ export declare function isNodeList(value: unknown): value is NodeList;
6
+ export declare function isDocumentFragment(value: unknown): value is DocumentFragment;
7
+ //# sourceMappingURL=element-check.d.ts.map
@@ -0,0 +1,18 @@
1
+ export interface KeyboardShortcut {
2
+ key: string;
3
+ ctrl: boolean;
4
+ shift: boolean;
5
+ alt: boolean;
6
+ meta: boolean;
7
+ originalSyntax: string;
8
+ }
9
+ export declare function parseKeyboardShortcut(syntax: string): KeyboardShortcut | null;
10
+ export declare function createKeyboardFilter(shortcut: KeyboardShortcut): (event: KeyboardEvent) => boolean;
11
+ export declare function createFilterExpression(shortcut: KeyboardShortcut): string;
12
+ export declare function transformKeyboardEvent(eventType: string): {
13
+ type: string;
14
+ filter?: string;
15
+ };
16
+ export declare function isKeyboardShortcut(syntax: string): boolean;
17
+ export declare function getShortcutDescription(shortcut: KeyboardShortcut): string;
18
+ //# sourceMappingURL=keyboard-shortcuts.d.ts.map
@@ -0,0 +1,40 @@
1
+ export interface PoolMetrics {
2
+ allocations: number;
3
+ reuses: number;
4
+ peakPoolSize: number;
5
+ hitRate: number;
6
+ }
7
+ export declare class ObjectPool<T extends object> {
8
+ private pool;
9
+ private index;
10
+ private factory;
11
+ private reset;
12
+ private metrics;
13
+ constructor(factory: () => T, reset?: (obj: T) => void, initialSize?: number);
14
+ get(): T;
15
+ releaseAll(): void;
16
+ getMetrics(): PoolMetrics;
17
+ clear(): void;
18
+ }
19
+ export declare class StyleBatcher {
20
+ private pending;
21
+ private rafId;
22
+ private stylePool;
23
+ add(element: HTMLElement, styles: Record<string, string>): void;
24
+ private flush;
25
+ cancel(): void;
26
+ getPendingCount(): number;
27
+ getPoolMetrics(): PoolMetrics;
28
+ }
29
+ export declare const styleBatcher: StyleBatcher;
30
+ export declare class EventQueue {
31
+ private listeners;
32
+ wait(eventName: string, target: EventTarget): Promise<Event>;
33
+ private setupListener;
34
+ private getKey;
35
+ cleanup(target: EventTarget, eventName: string): void;
36
+ cleanupAll(): void;
37
+ getListenerCount(): number;
38
+ }
39
+ export declare const eventQueue: EventQueue;
40
+ //# sourceMappingURL=performance.d.ts.map
@@ -0,0 +1,53 @@
1
+ export interface PatternValidationResult {
2
+ isEnhanced: boolean;
3
+ score: number;
4
+ passed: string[];
5
+ failed: string[];
6
+ suggestions: string[];
7
+ details: {
8
+ hasCorrectInterface: boolean;
9
+ hasRequiredProperties: boolean;
10
+ hasProperMetadata: boolean;
11
+ hasValidation: boolean;
12
+ hasFactoryFunction: boolean;
13
+ hasBundleAnnotations: boolean;
14
+ hasAsyncExecute: boolean;
15
+ };
16
+ }
17
+ export interface CommandAnalysis {
18
+ commandName: string;
19
+ filePath: string;
20
+ validation: PatternValidationResult;
21
+ recommendations: string[];
22
+ }
23
+ export declare class CommandPatternValidator {
24
+ static validateCommand(CommandClass: new () => unknown, factoryFunction?: Function, sourceCode?: string): PatternValidationResult;
25
+ private static validateInterface;
26
+ private static validateRequiredProperties;
27
+ private static validateMetadataQuality;
28
+ private static validateValidationMethod;
29
+ private static validateBundleAnnotations;
30
+ private static validateAsyncExecute;
31
+ }
32
+ export declare class CommandSuiteValidator {
33
+ static validateCommandSuite(commands: Array<{
34
+ name: string;
35
+ filePath: string;
36
+ CommandClass: any;
37
+ factoryFunction?: Function;
38
+ }>): Promise<{
39
+ overall: {
40
+ total: number;
41
+ enhanced: number;
42
+ averageScore: number;
43
+ needsWork: number;
44
+ };
45
+ commands: CommandAnalysis[];
46
+ recommendations: string[];
47
+ }>;
48
+ }
49
+ export declare class ValidationReporter {
50
+ static printCommandValidation(analysis: CommandAnalysis): void;
51
+ static printSuiteValidation(result: Awaited<ReturnType<typeof CommandSuiteValidator.validateCommandSuite>>): void;
52
+ }
53
+ //# sourceMappingURL=command-pattern-validator.d.ts.map
@@ -0,0 +1,24 @@
1
+ import type { RuntimeValidator } from './lightweight-validators';
2
+ export declare const htmlElement: RuntimeValidator<HTMLElement>;
3
+ export declare const htmlElementArray: RuntimeValidator<HTMLElement[]>;
4
+ export declare const htmlElementOrNull: RuntimeValidator<HTMLElement | null | undefined>;
5
+ export declare const elementTarget: RuntimeValidator<HTMLElement | HTMLElement[] | string | null | undefined>;
6
+ export declare const nodeList: RuntimeValidator<NodeList>;
7
+ export declare const htmlCollection: RuntimeValidator<HTMLCollection>;
8
+ export declare const cssSelector: RuntimeValidator<string>;
9
+ export declare const cssClassName: RuntimeValidator<string>;
10
+ export declare const attributeName: RuntimeValidator<string>;
11
+ export declare const eventName: RuntimeValidator<string>;
12
+ export declare const validators: {
13
+ htmlElement: RuntimeValidator<HTMLElement>;
14
+ htmlElementArray: RuntimeValidator<HTMLElement[]>;
15
+ htmlElementOrNull: RuntimeValidator<HTMLElement | null | undefined>;
16
+ elementTarget: RuntimeValidator<string | HTMLElement | HTMLElement[] | null | undefined>;
17
+ nodeList: RuntimeValidator<NodeList>;
18
+ htmlCollection: RuntimeValidator<HTMLCollection>;
19
+ cssSelector: RuntimeValidator<string>;
20
+ cssClassName: RuntimeValidator<string>;
21
+ attributeName: RuntimeValidator<string>;
22
+ eventName: RuntimeValidator<string>;
23
+ };
24
+ //# sourceMappingURL=common-validators.d.ts.map
@@ -0,0 +1,113 @@
1
+ import type { ValidationError } from '../types/base-types';
2
+ export interface ValidationResult<T = unknown> {
3
+ success: boolean;
4
+ data?: T | undefined;
5
+ error?: ValidationError | undefined;
6
+ }
7
+ export interface RuntimeValidator<T = unknown> {
8
+ validate(value: unknown): ValidationResult<T>;
9
+ safeParse(value: unknown): {
10
+ success: boolean;
11
+ data?: T;
12
+ error?: {
13
+ errors: ValidationError[];
14
+ };
15
+ };
16
+ description?: string;
17
+ describe(description: string): RuntimeValidator<T>;
18
+ strict(): RuntimeValidator<T>;
19
+ optional(): RuntimeValidator<T | undefined>;
20
+ default(value: T): RuntimeValidator<T>;
21
+ min(value: number): RuntimeValidator<T>;
22
+ max(value: number): RuntimeValidator<T>;
23
+ url(): RuntimeValidator<T>;
24
+ email(): RuntimeValidator<T>;
25
+ uuid(): RuntimeValidator<T>;
26
+ regex(pattern: RegExp): RuntimeValidator<T>;
27
+ date(): RuntimeValidator<T>;
28
+ rest(): RuntimeValidator<T>;
29
+ parse(value: unknown): T;
30
+ merge(other: RuntimeValidator<any>): RuntimeValidator<T>;
31
+ refine(refineFn: (value: T) => boolean, errorMessage?: string): RuntimeValidator<T>;
32
+ _defaultValue?: T;
33
+ _isOptional?: boolean;
34
+ _baseValidator?: RuntimeValidator<any>;
35
+ }
36
+ export interface StringValidatorOptions {
37
+ minLength?: number;
38
+ maxLength?: number;
39
+ pattern?: RegExp;
40
+ optional?: boolean;
41
+ description?: string;
42
+ }
43
+ export declare function createStringValidator(options?: StringValidatorOptions): RuntimeValidator<string>;
44
+ export declare function createObjectValidator<T extends Record<string, RuntimeValidator>>(fields: T, options?: {
45
+ strict?: boolean;
46
+ } | undefined): RuntimeValidator<{
47
+ [K in keyof T]: T[K] extends RuntimeValidator<infer U> ? U : never;
48
+ }>;
49
+ export declare function createArrayValidator<T>(itemValidator: RuntimeValidator<T>): RuntimeValidator<T[]>;
50
+ export declare function createTupleValidator<T extends readonly RuntimeValidator[]>(validators: T): RuntimeValidator<{
51
+ [K in keyof T]: T[K] extends RuntimeValidator<infer U> ? U : never;
52
+ }>;
53
+ export declare function createUnionValidator<T>(validators: RuntimeValidator<T>[]): RuntimeValidator<T>;
54
+ export declare function createLiteralValidator<T extends string | number | boolean>(literalValue: T): RuntimeValidator<T>;
55
+ export declare function createNumberValidator(options?: {
56
+ min?: number;
57
+ max?: number;
58
+ }): RuntimeValidator<number>;
59
+ export declare function createBooleanValidator(): RuntimeValidator<boolean>;
60
+ export declare function createCustomValidator<T>(validator: (value: unknown) => boolean, errorMessage?: string): RuntimeValidator<T>;
61
+ export declare function createRecordValidator<K extends string | number | symbol, V>(keyValidator: RuntimeValidator<K>, valueValidator: RuntimeValidator<V>): RuntimeValidator<Record<K, V>>;
62
+ export declare function createEnumValidator<T extends readonly string[]>(values: T): RuntimeValidator<T[number]>;
63
+ export declare const v: {
64
+ string: (options?: StringValidatorOptions) => RuntimeValidator<string>;
65
+ number: (options?: {
66
+ min?: number;
67
+ max?: number;
68
+ }) => RuntimeValidator<number>;
69
+ boolean: () => RuntimeValidator<boolean>;
70
+ object: (fields: any) => RuntimeValidator<{
71
+ [x: string]: unknown;
72
+ }>;
73
+ array: (itemValidator: any) => RuntimeValidator<unknown[]>;
74
+ tuple: (validators: any) => RuntimeValidator<unknown[]>;
75
+ union: (validators: any) => RuntimeValidator<unknown>;
76
+ literal: (value: any) => RuntimeValidator<any>;
77
+ custom: (validator: any, errorMessage?: string) => RuntimeValidator<unknown>;
78
+ record: (keyValidator: any, valueValidator: any) => RuntimeValidator<Record<string | number | symbol, unknown>>;
79
+ enum: (values: readonly string[]) => RuntimeValidator<string>;
80
+ function: () => RuntimeValidator<unknown>;
81
+ unknown: () => RuntimeValidator<unknown>;
82
+ any: () => RuntimeValidator<any>;
83
+ null: () => RuntimeValidator<unknown>;
84
+ undefined: () => RuntimeValidator<unknown>;
85
+ instanceOf: (constructor: any) => RuntimeValidator<unknown>;
86
+ instanceof: (constructor: any) => RuntimeValidator<unknown>;
87
+ };
88
+ export declare const z: {
89
+ string: (options?: StringValidatorOptions) => RuntimeValidator<string>;
90
+ number: (options?: {
91
+ min?: number;
92
+ max?: number;
93
+ }) => RuntimeValidator<number>;
94
+ boolean: () => RuntimeValidator<boolean>;
95
+ object: (fields: any) => RuntimeValidator<{
96
+ [x: string]: unknown;
97
+ }>;
98
+ array: (itemValidator: any) => RuntimeValidator<unknown[]>;
99
+ tuple: (validators: any) => RuntimeValidator<unknown[]>;
100
+ union: (validators: any) => RuntimeValidator<unknown>;
101
+ literal: (value: any) => RuntimeValidator<any>;
102
+ custom: (validator: any, errorMessage?: string) => RuntimeValidator<unknown>;
103
+ record: (keyValidator: any, valueValidator: any) => RuntimeValidator<Record<string | number | symbol, unknown>>;
104
+ enum: (values: readonly string[]) => RuntimeValidator<string>;
105
+ function: () => RuntimeValidator<unknown>;
106
+ unknown: () => RuntimeValidator<unknown>;
107
+ any: () => RuntimeValidator<any>;
108
+ null: () => RuntimeValidator<unknown>;
109
+ undefined: () => RuntimeValidator<unknown>;
110
+ instanceOf: (constructor: any) => RuntimeValidator<unknown>;
111
+ instanceof: (constructor: any) => RuntimeValidator<unknown>;
112
+ };
113
+ //# sourceMappingURL=lightweight-validators.d.ts.map