@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,6 @@
1
+ export declare const LITE_PARSER_TEMPLATE = "\n// Lite Parser - Regex-based for minimal bundle size\n\nfunction parseLite(code) {\n const trimmed = code.trim();\n\n // Handle event handlers: \"on click toggle .active\"\n const onMatch = trimmed.match(/^on\\s+(\\w+)(?:\\s+from\\s+([^\\s]+))?\\s+(.+)$/i);\n if (onMatch) {\n return {\n type: 'event',\n event: onMatch[1],\n filter: onMatch[2] ? { type: 'selector', value: onMatch[2] } : undefined,\n modifiers: {},\n body: parseCommands(onMatch[3]),\n };\n }\n\n // Handle \"every Nms\" event pattern\n const everyMatch = trimmed.match(/^every\\s+(\\d+)(ms|s)?\\s+(.+)$/i);\n if (everyMatch) {\n const ms = everyMatch[2] === 's' ? parseInt(everyMatch[1]) * 1000 : parseInt(everyMatch[1]);\n return {\n type: 'event',\n event: 'interval:' + ms,\n modifiers: {},\n body: parseCommands(everyMatch[3]),\n };\n }\n\n // Handle \"init\" pattern\n const initMatch = trimmed.match(/^init\\s+(.+)$/i);\n if (initMatch) {\n return {\n type: 'event',\n event: 'init',\n modifiers: {},\n body: parseCommands(initMatch[1]),\n };\n }\n\n return { type: 'sequence', commands: parseCommands(trimmed) };\n}\n\nfunction parseCommands(code) {\n const parts = code.split(/\\s+(?:then|and)\\s+/i);\n return parts.map(parseCommand).filter(Boolean);\n}\n\nfunction parseCommand(code) {\n const trimmed = code.trim();\n if (!trimmed) return null;\n\n let match;\n\n // toggle .class [on target]\n match = trimmed.match(/^toggle\\s+(\\.\\w+|\\w+)(?:\\s+on\\s+(.+))?$/i);\n if (match) {\n return {\n type: 'command',\n name: 'toggle',\n args: [{ type: 'selector', value: match[1] }],\n target: match[2] ? parseTarget(match[2]) : undefined,\n };\n }\n\n // add .class [to target]\n match = trimmed.match(/^add\\s+(\\.\\w+|\\w+)(?:\\s+to\\s+(.+))?$/i);\n if (match) {\n return {\n type: 'command',\n name: 'add',\n args: [{ type: 'selector', value: match[1] }],\n target: match[2] ? parseTarget(match[2]) : undefined,\n };\n }\n\n // remove .class [from target] | remove [target]\n match = trimmed.match(/^remove\\s+(\\.\\w+)(?:\\s+from\\s+(.+))?$/i);\n if (match) {\n return {\n type: 'command',\n name: 'removeClass',\n args: [{ type: 'selector', value: match[1] }],\n target: match[2] ? parseTarget(match[2]) : undefined,\n };\n }\n match = trimmed.match(/^remove\\s+(.+)$/i);\n if (match) {\n return {\n type: 'command',\n name: 'remove',\n args: [],\n target: parseTarget(match[1]),\n };\n }\n\n // put \"content\" into target\n match = trimmed.match(/^put\\s+(?:\"([^\"]+)\"|'([^']+)'|(\\S+))\\s+(into|before|after)\\s+(.+)$/i);\n if (match) {\n const content = match[1] || match[2] || match[3];\n return {\n type: 'command',\n name: 'put',\n args: [{ type: 'literal', value: content }],\n modifier: match[4],\n target: parseTarget(match[5]),\n };\n }\n\n // set target to value | set :var to value\n match = trimmed.match(/^set\\s+(.+?)\\s+to\\s+(.+)$/i);\n if (match) {\n return {\n type: 'command',\n name: 'set',\n args: [parseTarget(match[1]), parseLiteValue(match[2])],\n };\n }\n\n // log message\n match = trimmed.match(/^log\\s+(.+)$/i);\n if (match) {\n return {\n type: 'command',\n name: 'log',\n args: [parseLiteValue(match[1])],\n };\n }\n\n // send event [to target]\n match = trimmed.match(/^send\\s+(\\w+)(?:\\s+to\\s+(.+))?$/i);\n if (match) {\n return {\n type: 'command',\n name: 'send',\n args: [{ type: 'literal', value: match[1] }],\n target: match[2] ? parseTarget(match[2]) : undefined,\n };\n }\n\n // wait Nms | wait Ns\n match = trimmed.match(/^wait\\s+(\\d+)(ms|s)?$/i);\n if (match) {\n const ms = match[2] === 's' ? parseInt(match[1]) * 1000 : parseInt(match[1]);\n return {\n type: 'command',\n name: 'wait',\n args: [{ type: 'literal', value: ms }],\n };\n }\n\n // show/hide shortcuts\n match = trimmed.match(/^(show|hide)(?:\\s+(.+))?$/i);\n if (match) {\n return {\n type: 'command',\n name: match[1].toLowerCase(),\n args: [],\n target: match[2] ? parseTarget(match[2]) : undefined,\n };\n }\n\n // Unknown command - try generic parsing\n const parts = trimmed.split(/\\s+/);\n if (parts.length > 0) {\n return {\n type: 'command',\n name: parts[0],\n args: parts.slice(1).map(p => ({ type: 'literal', value: p })),\n };\n }\n\n return null;\n}\n\nfunction parseTarget(str) {\n const s = str.trim();\n if (s === 'me') return { type: 'identifier', value: 'me' };\n if (s === 'body') return { type: 'identifier', value: 'body' };\n if (s.startsWith('#') || s.startsWith('.') || s.startsWith('[')) {\n return { type: 'selector', value: s };\n }\n if (s.startsWith(':')) {\n return { type: 'variable', name: s, scope: 'local' };\n }\n return { type: 'identifier', value: s };\n}\n\nfunction parseLiteValue(str) {\n const s = str.trim();\n if ((s.startsWith('\"') && s.endsWith('\"')) || (s.startsWith(\"'\") && s.endsWith(\"'\"))) {\n return { type: 'literal', value: s.slice(1, -1) };\n }\n if (/^-?\\d+(\\.\\d+)?$/.test(s)) {\n return { type: 'literal', value: parseFloat(s) };\n }\n if (s === 'true') return { type: 'literal', value: true };\n if (s === 'false') return { type: 'literal', value: false };\n if (s === 'null') return { type: 'literal', value: null };\n if (s.startsWith(':')) return { type: 'variable', name: s, scope: 'local' };\n if (s === 'me') return { type: 'identifier', value: 'me' };\n return { type: 'identifier', value: s };\n}\n";
2
+ export declare const HYBRID_PARSER_TEMPLATE = "\n// Hybrid Parser - Full AST with operator precedence\n\n// Tokenizer\nconst KEYWORDS = new Set([\n 'on', 'from', 'to', 'into', 'before', 'after', 'in', 'of', 'at', 'with',\n 'if', 'else', 'unless', 'end', 'then', 'and', 'or', 'not',\n 'repeat', 'times', 'for', 'each', 'while', 'until',\n 'toggle', 'add', 'remove', 'put', 'set', 'get', 'call', 'return', 'append',\n 'log', 'send', 'trigger', 'wait', 'settle', 'fetch', 'as',\n 'show', 'hide', 'take', 'increment', 'decrement', 'focus', 'blur', 'go', 'transition', 'over',\n 'the', 'a', 'an', 'my', 'its', 'me', 'it', 'you',\n 'first', 'last', 'next', 'previous', 'closest', 'parent',\n 'true', 'false', 'null', 'undefined',\n 'is', 'matches', 'contains', 'includes', 'exists', 'has', 'init', 'every', 'by',\n]);\n\nconst COMMAND_ALIASES = {\n flip: 'toggle', switch: 'toggle', display: 'show', reveal: 'show',\n conceal: 'hide', increase: 'increment', decrease: 'decrement',\n fire: 'trigger', dispatch: 'send', navigate: 'go', goto: 'go',\n};\n\nconst EVENT_ALIASES = {\n clicked: 'click', pressed: 'keydown', changed: 'change',\n submitted: 'submit', loaded: 'load',\n};\n\nfunction normalizeCommand(name) {\n const lower = name.toLowerCase();\n return COMMAND_ALIASES[lower] || lower;\n}\n\nfunction normalizeEvent(name) {\n const lower = name.toLowerCase();\n return EVENT_ALIASES[lower] || lower;\n}\n\nfunction tokenize(code) {\n const tokens = [];\n let pos = 0;\n\n while (pos < code.length) {\n if (/\\s/.test(code[pos])) { pos++; continue; }\n if (code.slice(pos, pos + 2) === '--') {\n while (pos < code.length && code[pos] !== '\\n') pos++;\n continue;\n }\n\n const start = pos;\n\n // HTML selector <tag/>\n if (code[pos] === '<' && /[a-zA-Z]/.test(code[pos + 1] || '')) {\n pos++;\n while (pos < code.length && code[pos] !== '>') pos++;\n if (code[pos] === '>') pos++;\n const val = code.slice(start, pos);\n if (val.endsWith('/>') || val.endsWith('>')) {\n const normalized = val.slice(1).replace(/\\/?>$/, '');\n tokens.push({ type: 'selector', value: normalized, pos: start });\n continue;\n }\n }\n\n // Possessive 's\n if (code.slice(pos, pos + 2) === \"'s\" && !/[a-zA-Z]/.test(code[pos + 2] || '')) {\n tokens.push({ type: 'operator', value: \"'s\", pos: start });\n pos += 2;\n continue;\n }\n\n // String literals\n if (code[pos] === '\"' || code[pos] === \"'\") {\n const quote = code[pos++];\n while (pos < code.length && code[pos] !== quote) {\n if (code[pos] === '\\\\') pos++;\n pos++;\n }\n pos++;\n tokens.push({ type: 'string', value: code.slice(start, pos), pos: start });\n continue;\n }\n\n // Numbers with units\n if (/\\d/.test(code[pos]) || (code[pos] === '-' && /\\d/.test(code[pos + 1] || ''))) {\n if (code[pos] === '-') pos++;\n while (pos < code.length && /[\\d.]/.test(code[pos])) pos++;\n if (code.slice(pos, pos + 2) === 'ms') pos += 2;\n else if (code[pos] === 's' && !/[a-zA-Z]/.test(code[pos + 1] || '')) pos++;\n else if (code.slice(pos, pos + 2) === 'px') pos += 2;\n tokens.push({ type: 'number', value: code.slice(start, pos), pos: start });\n continue;\n }\n\n // Local variable :name\n if (code[pos] === ':') {\n pos++;\n while (pos < code.length && /[\\w]/.test(code[pos])) pos++;\n tokens.push({ type: 'localVar', value: code.slice(start, pos), pos: start });\n continue;\n }\n\n // Global variable $name\n if (code[pos] === '$') {\n pos++;\n while (pos < code.length && /[\\w]/.test(code[pos])) pos++;\n tokens.push({ type: 'globalVar', value: code.slice(start, pos), pos: start });\n continue;\n }\n\n // CSS selectors: #id, .class\n if (code[pos] === '#' || code[pos] === '.') {\n if (code[pos] === '.') {\n const afterDot = code.slice(pos + 1).match(/^(once|prevent|stop|debounce|throttle)\\b/i);\n if (afterDot) {\n tokens.push({ type: 'symbol', value: '.', pos: start });\n pos++;\n continue;\n }\n }\n pos++;\n while (pos < code.length && /[\\w-]/.test(code[pos])) pos++;\n tokens.push({ type: 'selector', value: code.slice(start, pos), pos: start });\n continue;\n }\n\n // Array literal vs Attribute selector\n if (code[pos] === '[') {\n let lookahead = pos + 1;\n while (lookahead < code.length && /\\s/.test(code[lookahead])) lookahead++;\n const nextChar = code[lookahead] || '';\n const isArrayLiteral = /['\"\\d\\[\\]:\\$\\-]/.test(nextChar) || nextChar === '';\n if (isArrayLiteral) {\n tokens.push({ type: 'symbol', value: '[', pos: start });\n pos++;\n continue;\n } else {\n pos++;\n let depth = 1;\n while (pos < code.length && depth > 0) {\n if (code[pos] === '[') depth++;\n if (code[pos] === ']') depth--;\n pos++;\n }\n tokens.push({ type: 'selector', value: code.slice(start, pos), pos: start });\n continue;\n }\n }\n\n if (code[pos] === ']') {\n tokens.push({ type: 'symbol', value: ']', pos: start });\n pos++;\n continue;\n }\n\n // Multi-char operators\n const twoChar = code.slice(pos, pos + 2);\n if (['==', '!=', '<=', '>=', '&&', '||'].includes(twoChar)) {\n tokens.push({ type: 'operator', value: twoChar, pos: start });\n pos += 2;\n continue;\n }\n\n // Style property *opacity\n if (code[pos] === '*' && /[a-zA-Z]/.test(code[pos + 1] || '')) {\n pos++;\n while (pos < code.length && /[\\w-]/.test(code[pos])) pos++;\n tokens.push({ type: 'styleProperty', value: code.slice(start, pos), pos: start });\n continue;\n }\n\n if ('+-*/%<>!'.includes(code[pos])) {\n tokens.push({ type: 'operator', value: code[pos], pos: start });\n pos++;\n continue;\n }\n\n if ('()[]{},.'.includes(code[pos])) {\n tokens.push({ type: 'symbol', value: code[pos], pos: start });\n pos++;\n continue;\n }\n\n if (/[a-zA-Z_]/.test(code[pos])) {\n while (pos < code.length && /[\\w-]/.test(code[pos])) pos++;\n const value = code.slice(start, pos);\n const type = KEYWORDS.has(value.toLowerCase()) ? 'keyword' : 'identifier';\n tokens.push({ type, value, pos: start });\n continue;\n }\n\n pos++;\n }\n\n tokens.push({ type: 'eof', value: '', pos: code.length });\n return tokens;\n}\n\n// Parser\nclass HybridParser {\n constructor(code) {\n this.tokens = tokenize(code);\n this.pos = 0;\n }\n\n peek(offset = 0) {\n return this.tokens[Math.min(this.pos + offset, this.tokens.length - 1)];\n }\n\n advance() {\n return this.tokens[this.pos++];\n }\n\n match(...values) {\n const token = this.peek();\n return values.some(v => token.value.toLowerCase() === v.toLowerCase());\n }\n\n matchType(...types) {\n return types.includes(this.peek().type);\n }\n\n expect(value) {\n if (!this.match(value) && normalizeCommand(this.peek().value) !== value) {\n throw new Error(\"Expected '\" + value + \"', got '\" + this.peek().value + \"'\");\n }\n return this.advance();\n }\n\n isAtEnd() {\n return this.peek().type === 'eof';\n }\n\n parse() {\n if (this.match('on')) return this.parseEventHandler();\n if (this.match('init')) {\n this.advance();\n return { type: 'event', event: 'init', modifiers: {}, body: this.parseCommandSequence() };\n }\n if (this.match('every')) return this.parseEveryHandler();\n return { type: 'sequence', commands: this.parseCommandSequence() };\n }\n\n parseEventHandler() {\n this.expect('on');\n const eventName = this.advance().value;\n const modifiers = {};\n let filter;\n\n while (this.peek().value === '.') {\n this.advance();\n const mod = this.advance().value.toLowerCase();\n if (mod === 'once') modifiers.once = true;\n else if (mod === 'prevent') modifiers.prevent = true;\n else if (mod === 'stop') modifiers.stop = true;\n else if (mod === 'debounce' || mod === 'throttle') {\n if (this.peek().value === '(') {\n this.advance();\n const num = this.advance().value;\n this.expect(')');\n if (mod === 'debounce') modifiers.debounce = parseInt(num) || 100;\n else modifiers.throttle = parseInt(num) || 100;\n }\n }\n }\n\n if (this.match('from')) {\n this.advance();\n filter = this.parseExpression();\n }\n\n return { type: 'event', event: normalizeEvent(eventName), filter, modifiers, body: this.parseCommandSequence() };\n }\n\n parseEveryHandler() {\n this.expect('every');\n const interval = this.advance().value;\n return { type: 'event', event: 'interval:' + interval, modifiers: {}, body: this.parseCommandSequence() };\n }\n\n parseCommandSequence() {\n const commands = [];\n while (!this.isAtEnd() && !this.match('end', 'else')) {\n const cmd = this.parseCommand();\n if (cmd) commands.push(cmd);\n if (this.match('then', 'and')) this.advance();\n }\n return commands;\n }\n\n parseCommand() {\n if (this.match('if', 'unless')) return this.parseIf();\n if (this.match('repeat')) return this.parseRepeat();\n if (this.match('for')) return this.parseFor();\n if (this.match('while')) return this.parseWhile();\n if (this.match('fetch')) return this.parseFetchBlock();\n\n const cmdMap = {\n toggle: () => this.parseToggle(),\n add: () => this.parseAdd(),\n remove: () => this.parseRemove(),\n put: () => this.parsePut(),\n append: () => this.parseAppend(),\n set: () => this.parseSet(),\n get: () => this.parseGet(),\n call: () => this.parseCall(),\n log: () => this.parseLog(),\n send: () => this.parseSend(),\n trigger: () => this.parseSend(),\n wait: () => this.parseWait(),\n show: () => this.parseShow(),\n hide: () => this.parseHide(),\n take: () => this.parseTake(),\n increment: () => this.parseIncDec('increment'),\n decrement: () => this.parseIncDec('decrement'),\n focus: () => this.parseFocusBlur('focus'),\n blur: () => this.parseFocusBlur('blur'),\n go: () => this.parseGo(),\n return: () => this.parseReturn(),\n transition: () => this.parseTransition(),\n };\n\n const normalized = normalizeCommand(this.peek().value);\n if (cmdMap[normalized]) return cmdMap[normalized]();\n\n if (!this.isAtEnd() && !this.match('then', 'and', 'end', 'else')) this.advance();\n return null;\n }\n\n parseIf() {\n const isUnless = this.match('unless');\n this.advance();\n const condition = this.parseExpression();\n const body = this.parseCommandSequence();\n let elseBody;\n\n if (this.match('else')) {\n this.advance();\n elseBody = this.parseCommandSequence();\n }\n if (this.match('end')) this.advance();\n\n return {\n type: 'if',\n condition: isUnless ? { type: 'unary', operator: 'not', operand: condition } : condition,\n body,\n elseBody,\n };\n }\n\n parseRepeat() {\n this.expect('repeat');\n let count;\n if (!this.match('until', 'while', 'forever')) {\n count = this.parseExpression();\n if (this.match('times')) this.advance();\n }\n const body = this.parseCommandSequence();\n if (this.match('end')) this.advance();\n return { type: 'repeat', condition: count, body };\n }\n\n parseFor() {\n this.expect('for');\n if (this.match('each')) this.advance();\n const variable = this.advance().value;\n this.expect('in');\n const iterable = this.parseExpression();\n const body = this.parseCommandSequence();\n if (this.match('end')) this.advance();\n return { type: 'for', condition: { type: 'forCondition', variable, iterable }, body };\n }\n\n parseWhile() {\n this.expect('while');\n const condition = this.parseExpression();\n const body = this.parseCommandSequence();\n if (this.match('end')) this.advance();\n return { type: 'while', condition, body };\n }\n\n parseFetchBlock() {\n this.expect('fetch');\n const url = this.parseExpression();\n let responseType = { type: 'literal', value: 'text' };\n if (this.match('as')) {\n this.advance();\n responseType = this.parseExpression();\n }\n if (this.match('then')) this.advance();\n const body = this.parseCommandSequence();\n return { type: 'fetch', condition: { type: 'fetchConfig', url, responseType }, body };\n }\n\n parseToggle() {\n this.expect('toggle');\n const what = this.parseExpression();\n let target;\n if (this.match('on')) {\n this.advance();\n target = this.parseExpression();\n }\n return { type: 'command', name: 'toggle', args: [what], target };\n }\n\n parseAdd() {\n this.expect('add');\n const what = this.parseExpression();\n let target;\n if (this.match('to')) {\n this.advance();\n target = this.parseExpression();\n }\n return { type: 'command', name: 'add', args: [what], target };\n }\n\n parseRemove() {\n this.expect('remove');\n if (this.matchType('selector')) {\n const what = this.parseExpression();\n let target;\n if (this.match('from')) {\n this.advance();\n target = this.parseExpression();\n }\n return { type: 'command', name: 'removeClass', args: [what], target };\n }\n const target = this.parseExpression();\n return { type: 'command', name: 'remove', args: [], target };\n }\n\n parsePut() {\n this.expect('put');\n const content = this.parseExpression();\n let modifier = 'into';\n if (this.match('into', 'before', 'after', 'at')) {\n modifier = this.advance().value;\n if (modifier === 'at') {\n const pos = this.advance().value;\n this.expect('of');\n modifier = 'at ' + pos + ' of';\n }\n }\n const target = this.parseExpression();\n return { type: 'command', name: 'put', args: [content], target, modifier };\n }\n\n parseAppend() {\n this.expect('append');\n const content = this.parseExpression();\n let target;\n if (this.match('to')) {\n this.advance();\n target = this.parseExpression();\n }\n return { type: 'command', name: 'append', args: [content], target };\n }\n\n parseSet() {\n this.expect('set');\n const target = this.parseExpression();\n if (this.match('to')) {\n this.advance();\n const value = this.parseExpression();\n return { type: 'command', name: 'set', args: [target, value] };\n }\n return { type: 'command', name: 'set', args: [target] };\n }\n\n parseGet() {\n this.expect('get');\n return { type: 'command', name: 'get', args: [this.parseExpression()] };\n }\n\n parseCall() {\n this.expect('call');\n return { type: 'command', name: 'call', args: [this.parseExpression()] };\n }\n\n parseLog() {\n this.expect('log');\n const args = [];\n while (!this.isAtEnd() && !this.match('then', 'and', 'end', 'else')) {\n args.push(this.parseExpression());\n if (this.match(',')) this.advance();\n else break;\n }\n return { type: 'command', name: 'log', args };\n }\n\n parseSend() {\n this.advance();\n const event = this.advance().value;\n let target;\n if (this.match('to')) {\n this.advance();\n target = this.parseExpression();\n }\n return { type: 'command', name: 'send', args: [{ type: 'literal', value: event }], target };\n }\n\n parseWait() {\n this.expect('wait');\n if (this.match('for')) {\n this.advance();\n const event = this.advance().value;\n let target;\n if (this.match('from')) {\n this.advance();\n target = this.parseExpression();\n }\n return { type: 'command', name: 'waitFor', args: [{ type: 'literal', value: event }], target };\n }\n return { type: 'command', name: 'wait', args: [this.parseExpression()] };\n }\n\n parseShow() {\n this.expect('show');\n let target;\n const modifiers = {};\n if (!this.isAtEnd() && !this.match('then', 'and', 'end', 'else', 'when', 'where')) {\n target = this.parseExpression();\n }\n if (!this.isAtEnd() && this.match('when', 'where')) {\n const keyword = this.advance().value;\n modifiers[keyword] = this.parseExpression();\n }\n return { type: 'command', name: 'show', args: [], target, modifiers };\n }\n\n parseHide() {\n this.expect('hide');\n let target;\n const modifiers = {};\n if (!this.isAtEnd() && !this.match('then', 'and', 'end', 'else', 'when', 'where')) {\n target = this.parseExpression();\n }\n if (!this.isAtEnd() && this.match('when', 'where')) {\n const keyword = this.advance().value;\n modifiers[keyword] = this.parseExpression();\n }\n return { type: 'command', name: 'hide', args: [], target, modifiers };\n }\n\n parseTake() {\n this.expect('take');\n const what = this.parseExpression();\n let from;\n if (this.match('from')) {\n this.advance();\n from = this.parseExpression();\n }\n return { type: 'command', name: 'take', args: [what], target: from };\n }\n\n parseIncDec(name) {\n this.advance();\n const target = this.parseExpression();\n let amount = { type: 'literal', value: 1 };\n if (this.match('by')) {\n this.advance();\n amount = this.parseExpression();\n }\n return { type: 'command', name, args: [target, amount] };\n }\n\n parseFocusBlur(name) {\n this.advance();\n let target;\n if (!this.isAtEnd() && !this.match('then', 'and', 'end', 'else')) {\n target = this.parseExpression();\n }\n return { type: 'command', name, args: [], target };\n }\n\n parseGo() {\n this.expect('go');\n if (this.match('to')) this.advance();\n if (this.match('url')) this.advance();\n const dest = this.parseExpression();\n return { type: 'command', name: 'go', args: [dest] };\n }\n\n parseReturn() {\n this.expect('return');\n let value;\n if (!this.isAtEnd() && !this.match('then', 'and', 'end', 'else')) {\n value = this.parseExpression();\n }\n return { type: 'command', name: 'return', args: value ? [value] : [] };\n }\n\n parseTransition() {\n this.expect('transition');\n let target;\n if (this.match('my', 'its')) {\n const ref = this.advance().value;\n target = { type: 'identifier', value: ref === 'my' ? 'me' : 'it' };\n } else if (this.matchType('selector')) {\n const expr = this.parseExpression();\n if (expr.type === 'possessive') {\n return this.parseTransitionRest(expr.object, expr.property);\n }\n target = expr;\n }\n\n const propToken = this.peek();\n let property;\n if (propToken.type === 'styleProperty') {\n property = this.advance().value;\n } else if (propToken.type === 'identifier' || propToken.type === 'keyword') {\n property = this.advance().value;\n } else {\n property = 'opacity';\n }\n\n return this.parseTransitionRest(target, property);\n }\n\n parseTransitionRest(target, property) {\n let toValue = { type: 'literal', value: 1 };\n if (this.match('to')) {\n this.advance();\n toValue = this.parseExpression();\n }\n let duration = { type: 'literal', value: 300 };\n if (this.match('over')) {\n this.advance();\n duration = this.parseExpression();\n }\n return { type: 'command', name: 'transition', args: [{ type: 'literal', value: property }, toValue, duration], target };\n }\n\n parseExpression() { return this.parseOr(); }\n\n parseOr() {\n let left = this.parseAnd();\n while (this.match('or', '||')) {\n this.advance();\n left = { type: 'binary', operator: 'or', left, right: this.parseAnd() };\n }\n return left;\n }\n\n parseAnd() {\n let left = this.parseEquality();\n while (this.match('and', '&&') && !this.isCommandKeyword(this.peek(1))) {\n this.advance();\n left = { type: 'binary', operator: 'and', left, right: this.parseEquality() };\n }\n return left;\n }\n\n isCommandKeyword(token) {\n const cmds = ['toggle', 'add', 'remove', 'set', 'put', 'log', 'send', 'wait', 'show', 'hide', 'increment', 'decrement', 'focus', 'blur', 'go'];\n return cmds.includes(normalizeCommand(token.value));\n }\n\n parseEquality() {\n let left = this.parseComparison();\n while (this.match('==', '!=', 'is', 'matches', 'contains', 'includes', 'has')) {\n const op = this.advance().value;\n if (op.toLowerCase() === 'is' && this.match('not')) {\n this.advance();\n left = { type: 'binary', operator: 'is not', left, right: this.parseComparison() };\n } else {\n left = { type: 'binary', operator: op, left, right: this.parseComparison() };\n }\n }\n return left;\n }\n\n parseComparison() {\n let left = this.parseAdditive();\n while (this.match('<', '>', '<=', '>=')) {\n const op = this.advance().value;\n left = { type: 'binary', operator: op, left, right: this.parseAdditive() };\n }\n return left;\n }\n\n parseAdditive() {\n let left = this.parseMultiplicative();\n while (this.match('+', '-')) {\n const op = this.advance().value;\n left = { type: 'binary', operator: op, left, right: this.parseMultiplicative() };\n }\n return left;\n }\n\n parseMultiplicative() {\n let left = this.parseUnary();\n while (this.match('*', '/', '%')) {\n const op = this.advance().value;\n left = { type: 'binary', operator: op, left, right: this.parseUnary() };\n }\n return left;\n }\n\n parseUnary() {\n if (this.match('not', '!')) {\n this.advance();\n return { type: 'unary', operator: 'not', operand: this.parseUnary() };\n }\n if (this.match('-') && this.peek(1).type === 'number') {\n this.advance();\n const num = this.advance();\n return { type: 'literal', value: -parseFloat(num.value) };\n }\n return this.parsePostfix();\n }\n\n parsePostfix() {\n let left = this.parsePrimary();\n while (true) {\n if (this.match(\"'s\")) {\n this.advance();\n const next = this.peek();\n const prop = next.type === 'styleProperty' ? this.advance().value : this.advance().value;\n left = { type: 'possessive', object: left, property: prop };\n } else if (this.peek().type === 'styleProperty') {\n const prop = this.advance().value;\n left = { type: 'possessive', object: left, property: prop };\n } else if (this.peek().value === '.') {\n this.advance();\n const prop = this.advance().value;\n left = { type: 'member', object: left, property: prop };\n } else if (this.peek().type === 'selector' && this.peek().value.startsWith('.')) {\n const prop = this.advance().value.slice(1);\n left = { type: 'member', object: left, property: prop };\n } else if (this.peek().value === '(') {\n this.advance();\n const args = [];\n while (!this.match(')')) {\n args.push(this.parseExpression());\n if (this.match(',')) this.advance();\n }\n this.expect(')');\n left = { type: 'call', callee: left, args };\n } else if (this.peek().value === '[' && left.type !== 'selector') {\n this.advance();\n const index = this.parseExpression();\n this.expect(']');\n left = { type: 'member', object: left, property: index, computed: true };\n } else {\n break;\n }\n }\n return left;\n }\n\n parsePrimary() {\n const token = this.peek();\n\n if (token.value === '(') {\n this.advance();\n const expr = this.parseExpression();\n this.expect(')');\n return expr;\n }\n\n if (token.value === '{') return this.parseObjectLiteral();\n if (token.value === '[') return this.parseArrayLiteral();\n\n if (token.type === 'number') {\n this.advance();\n const val = token.value;\n if (val.endsWith('ms')) return { type: 'literal', value: parseInt(val), unit: 'ms' };\n if (val.endsWith('s')) return { type: 'literal', value: parseFloat(val) * 1000, unit: 'ms' };\n return { type: 'literal', value: parseFloat(val) };\n }\n\n if (token.type === 'string') {\n this.advance();\n return { type: 'literal', value: token.value.slice(1, -1) };\n }\n\n if (this.match('true')) { this.advance(); return { type: 'literal', value: true }; }\n if (this.match('false')) { this.advance(); return { type: 'literal', value: false }; }\n if (this.match('null')) { this.advance(); return { type: 'literal', value: null }; }\n if (this.match('undefined')) { this.advance(); return { type: 'literal', value: undefined }; }\n\n if (token.type === 'localVar') {\n this.advance();\n return { type: 'variable', name: token.value, scope: 'local' };\n }\n if (token.type === 'globalVar') {\n this.advance();\n return { type: 'variable', name: token.value, scope: 'global' };\n }\n if (token.type === 'selector') {\n this.advance();\n return { type: 'selector', value: token.value };\n }\n\n if (this.match('my')) {\n this.advance();\n const next = this.peek();\n if ((next.type === 'identifier' || next.type === 'keyword') && !this.isCommandKeyword(next)) {\n const prop = this.advance().value;\n return { type: 'possessive', object: { type: 'identifier', value: 'me' }, property: prop };\n }\n return { type: 'identifier', value: 'me' };\n }\n if (this.match('its')) {\n this.advance();\n const next = this.peek();\n if ((next.type === 'identifier' || next.type === 'keyword') && !this.isCommandKeyword(next)) {\n const prop = this.advance().value;\n return { type: 'possessive', object: { type: 'identifier', value: 'it' }, property: prop };\n }\n return { type: 'identifier', value: 'it' };\n }\n if (this.match('me')) { this.advance(); return { type: 'identifier', value: 'me' }; }\n if (this.match('it')) { this.advance(); return { type: 'identifier', value: 'it' }; }\n if (this.match('you')) { this.advance(); return { type: 'identifier', value: 'you' }; }\n\n if (this.match('the', 'a', 'an')) {\n this.advance();\n if (this.match('first', 'last', 'next', 'previous', 'closest', 'parent')) {\n const position = this.advance().value;\n const target = this.parsePositionalTarget();\n return { type: 'positional', position, target };\n }\n return this.parsePrimary();\n }\n\n if (this.match('first', 'last', 'next', 'previous', 'closest', 'parent')) {\n const position = this.advance().value;\n const target = this.parsePositionalTarget();\n return { type: 'positional', position, target };\n }\n\n if (token.type === 'identifier' || token.type === 'keyword') {\n this.advance();\n return { type: 'identifier', value: token.value };\n }\n\n this.advance();\n return { type: 'identifier', value: token.value };\n }\n\n parseObjectLiteral() {\n this.expect('{');\n const properties = [];\n while (!this.match('}')) {\n const key = this.advance().value;\n this.expect(':');\n const value = this.parseExpression();\n properties.push({ key, value });\n if (this.match(',')) this.advance();\n }\n this.expect('}');\n return { type: 'object', properties };\n }\n\n parseArrayLiteral() {\n this.expect('[');\n const elements = [];\n while (!this.match(']')) {\n elements.push(this.parseExpression());\n if (this.match(',')) this.advance();\n }\n this.expect(']');\n return { type: 'array', elements };\n }\n\n parsePositionalTarget() {\n const token = this.peek();\n if (token.type === 'selector') {\n return { type: 'selector', value: this.advance().value };\n }\n if (token.type === 'identifier' || token.type === 'keyword') {\n return { type: 'identifier', value: this.advance().value };\n }\n return this.parseExpression();\n }\n}\n";
3
+ export declare function getParserTemplate(type: 'lite' | 'hybrid'): string;
4
+ export declare const LITE_PARSER_COMMANDS: readonly ["toggle", "add", "remove", "put", "set", "log", "send", "wait", "show", "hide"];
5
+ export declare function canUseLiteParser(commands: string[], blocks: string[], positional: boolean): boolean;
6
+ //# sourceMappingURL=parser-templates.d.ts.map
@@ -0,0 +1,10 @@
1
+ export declare const AVAILABLE_COMMANDS: readonly ["toggle", "add", "remove", "removeClass", "show", "hide", "put", "append", "take", "set", "get", "increment", "decrement", "wait", "transition", "send", "trigger", "log", "call", "copy", "beep", "go", "push", "push-url", "replace", "replace-url", "focus", "blur", "return", "break", "continue", "halt", "exit", "throw", "js", "morph"];
2
+ export declare const AVAILABLE_BLOCKS: readonly ["if", "repeat", "for", "while", "fetch"];
3
+ export declare const FULL_RUNTIME_ONLY_COMMANDS: readonly ["async", "make", "swap", "process-partials", "bind", "persist", "default", "tell", "pick", "unless", "settle", "measure", "install"];
4
+ export type AvailableCommand = (typeof AVAILABLE_COMMANDS)[number];
5
+ export type AvailableBlock = (typeof AVAILABLE_BLOCKS)[number];
6
+ export type FullRuntimeOnlyCommand = (typeof FULL_RUNTIME_ONLY_COMMANDS)[number];
7
+ export declare function isAvailableCommand(command: string): command is AvailableCommand;
8
+ export declare function isAvailableBlock(block: string): block is AvailableBlock;
9
+ export declare function requiresFullRuntime(command: string): boolean;
10
+ //# sourceMappingURL=template-capabilities.d.ts.map
@@ -0,0 +1,11 @@
1
+ export type CodeFormat = 'ts' | 'js';
2
+ export declare const STYLE_COMMANDS: string[];
3
+ export declare const ELEMENT_ARRAY_COMMANDS: string[];
4
+ export declare const MORPH_COMMANDS: string[];
5
+ export declare function getCommandImplementations(format?: CodeFormat): Record<string, string>;
6
+ export declare function getBlockImplementations(format?: CodeFormat): Record<string, string>;
7
+ export declare function getAvailableCommands(): string[];
8
+ export declare function getAvailableBlocks(): string[];
9
+ export declare const COMMAND_IMPLEMENTATIONS: Record<string, string>;
10
+ export declare const BLOCK_IMPLEMENTATIONS: Record<string, string>;
11
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1,34 @@
1
+ export interface ValidationOptions {
2
+ strict?: boolean;
3
+ }
4
+ export interface ValidationError {
5
+ type: 'unknown-command' | 'unknown-block';
6
+ message: string;
7
+ name: string;
8
+ }
9
+ export interface BundleConfig {
10
+ name: string;
11
+ commands: string[];
12
+ blocks?: string[];
13
+ output?: string;
14
+ htmxIntegration?: boolean;
15
+ globalName?: string;
16
+ positionalExpressions?: boolean;
17
+ }
18
+ export interface GeneratorOptions extends BundleConfig {
19
+ parserImportPath?: string;
20
+ autoInit?: boolean;
21
+ esModule?: boolean;
22
+ format?: 'ts' | 'js';
23
+ validation?: ValidationOptions;
24
+ maxLoopIterations?: number;
25
+ }
26
+ export interface GeneratedBundle {
27
+ code: string;
28
+ commands: string[];
29
+ blocks: string[];
30
+ positional: boolean;
31
+ warnings: string[];
32
+ errors: ValidationError[];
33
+ }
34
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare const runtime: import("../runtime/runtime-experimental").RuntimeExperimental;
2
+ export default runtime;
3
+ //# sourceMappingURL=test-minimal.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare const runtime: import("../runtime/runtime-experimental").RuntimeExperimental;
2
+ export default runtime;
3
+ //# sourceMappingURL=test-standard.d.ts.map
@@ -0,0 +1,2 @@
1
+ import{D as n}from"./browser-modular-Dv6PAV3c.js";import"./feature-sockets-3PFuvCVY.js";let e=null;async function t(){return e||(e=await import("./browser-modular-Dv6PAV3c.js").then(function(n){return n.n})),e}class a{constructor(e={}){this.analyzer=null,this.config={confidenceThreshold:e.confidenceThreshold??n,fallbackOnLowConfidence:e.fallbackOnLowConfidence??!0}}async initialize(){const n=await t();this.analyzer=n.createSemanticAnalyzer()}isInitialized(){return null!==this.analyzer}async transform(n,e,a){if(this.isInitialized()||await this.initialize(),e===a)return{output:n,usedSemantic:!1,confidence:1,sourceLang:e,targetLang:a};const i=await t();try{const t=i.translate(n,e,a);if(t!==n)return{output:t,usedSemantic:!0,confidence:.9,sourceLang:e,targetLang:a}}catch{}return{output:n,usedSemantic:!1,confidence:0,sourceLang:e,targetLang:a}}async parse(n,e){if(this.isInitialized()||await this.initialize(),!this.analyzer)return null;return this.analyzer.analyze(n,e).node??null}async render(n,e){return(await t()).render(n,e)}async parseToAST(n,e){if(this.isInitialized()||await this.initialize(),!this.analyzer)return null;const a=this.analyzer.analyze(n,e);if(a.confidence>=this.config.confidenceThreshold&&a.node){const n=await t();try{return n.buildAST(a.node).ast}catch(n){}}return null}async parseToASTWithDetails(n,e){if(this.isInitialized()||await this.initialize(),!this.analyzer)return{ast:null,usedDirectPath:!1,confidence:0,lang:e,fallbackText:null};const a=this.analyzer.analyze(n,e),i=await t();if(a.confidence>=this.config.confidenceThreshold&&a.node)try{const n=i.buildAST(a.node);return{ast:n.ast,usedDirectPath:!0,confidence:a.confidence,lang:e,fallbackText:null,warnings:n.warnings}}catch{}if(a.node&&this.config.fallbackOnLowConfidence){const n=i.render(a.node,"en");return{ast:null,usedDirectPath:!1,confidence:a.confidence,lang:e,fallbackText:n}}return{ast:null,usedDirectPath:!1,confidence:a.confidence,lang:e,fallbackText:null}}async getAllTranslations(n,e){const a=(await t()).getSupportedLanguages(),i={};for(const t of a)i[t]=await this.transform(n,e,t);return i}}export{a as SemanticGrammarBridge};
2
+ //# sourceMappingURL=bridge-I6ceoWxV.js.map