@hyperfixi/core 3.3.0 → 4.0.1

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 (378) hide show
  1. package/README.md +57 -179
  2. package/dist/ast-utils/index.cjs +74 -806
  3. package/dist/ast-utils/index.d.ts +1 -1
  4. package/dist/ast-utils/index.mjs +74 -805
  5. package/dist/ast-utils/interchange/engine-positions.d.ts +3 -0
  6. package/dist/ast-utils/interchange/index.d.ts +1 -2
  7. package/dist/hyperfixi.js +19 -2
  8. package/dist/index.d.ts +2 -22
  9. package/dist/index.mjs +3 -29128
  10. package/dist/lsp-metadata.cjs +77 -73
  11. package/dist/lsp-metadata.d.ts +4 -4
  12. package/dist/lsp-metadata.mjs +77 -73
  13. package/dist/metadata.cjs +34 -266
  14. package/dist/metadata.d.ts +31 -26
  15. package/dist/metadata.mjs +34 -266
  16. package/dist/multilingual/index.cjs +16 -382
  17. package/dist/multilingual/index.d.ts +4 -32
  18. package/dist/multilingual/index.mjs +15 -377
  19. package/dist/reference/index.cjs +67 -216
  20. package/dist/reference/index.d.ts +0 -3
  21. package/dist/reference/index.mjs +68 -216
  22. package/dist/version.d.ts +1 -1
  23. package/package.json +13 -179
  24. package/dist/__test-utils__/context-builders.d.ts +0 -42
  25. package/dist/__test-utils__/error-testing.d.ts +0 -18
  26. package/dist/__test-utils__/index.d.ts +0 -6
  27. package/dist/__test-utils__/mock-types.d.ts +0 -57
  28. package/dist/__test-utils__/parser-context-mock.d.ts +0 -7
  29. package/dist/__test-utils__/parser-helpers.d.ts +0 -38
  30. package/dist/api/hyperscript-api.d.ts +0 -90
  31. package/dist/api/lokascript-api.d.ts +0 -9
  32. package/dist/ast/command-slots.d.ts +0 -140
  33. package/dist/ast/guards.d.ts +0 -15
  34. package/dist/ast/legacy.d.ts +0 -15
  35. package/dist/ast/nodes.d.ts +0 -243
  36. package/dist/ast-utils/interchange/from-core.d.ts +0 -12
  37. package/dist/ast-utils/interchange/to-core.d.ts +0 -8
  38. package/dist/behaviors/boosted.d.ts +0 -29
  39. package/dist/behaviors/history-swap.d.ts +0 -24
  40. package/dist/behaviors/index.cjs +0 -1155
  41. package/dist/behaviors/index.d.ts +0 -4
  42. package/dist/behaviors/index.mjs +0 -1145
  43. package/dist/bundle-generator/executor-core.d.ts +0 -4
  44. package/dist/bundle-generator/generator.d.ts +0 -4
  45. package/dist/bundle-generator/index.cjs +0 -2804
  46. package/dist/bundle-generator/index.d.ts +0 -6
  47. package/dist/bundle-generator/index.mjs +0 -2779
  48. package/dist/bundle-generator/parser-templates.d.ts +0 -6
  49. package/dist/bundle-generator/template-capabilities.d.ts +0 -12
  50. package/dist/bundle-generator/templates.d.ts +0 -12
  51. package/dist/bundle-generator/types.d.ts +0 -34
  52. package/dist/chunks/bridge-CI9SOl8u.js +0 -2
  53. package/dist/chunks/browser-modular-7CpI5VF2.js +0 -2
  54. package/dist/chunks/index-BwXDEK0m.js +0 -2
  55. package/dist/chunks/index-DQi2o8Lk.js +0 -2
  56. package/dist/chunks/index-uCOQ8Qn0.js +0 -2
  57. package/dist/commands/advanced/js.d.ts +0 -40
  58. package/dist/commands/animation/measure.d.ts +0 -43
  59. package/dist/commands/animation/settle.d.ts +0 -38
  60. package/dist/commands/animation/start-view-transition.d.ts +0 -38
  61. package/dist/commands/animation/take.d.ts +0 -41
  62. package/dist/commands/animation/transition.d.ts +0 -49
  63. package/dist/commands/async/fetch.d.ts +0 -61
  64. package/dist/commands/async/wait.d.ts +0 -51
  65. package/dist/commands/behaviors/install.d.ts +0 -40
  66. package/dist/commands/content/append.d.ts +0 -26
  67. package/dist/commands/content/insertion-base.d.ts +0 -60
  68. package/dist/commands/content/prepend.d.ts +0 -26
  69. package/dist/commands/control-flow/break.d.ts +0 -29
  70. package/dist/commands/control-flow/continue.d.ts +0 -29
  71. package/dist/commands/control-flow/exit.d.ts +0 -29
  72. package/dist/commands/control-flow/halt.d.ts +0 -39
  73. package/dist/commands/control-flow/if.d.ts +0 -58
  74. package/dist/commands/control-flow/repeat.d.ts +0 -50
  75. package/dist/commands/control-flow/return.d.ts +0 -33
  76. package/dist/commands/control-flow/signal-base.d.ts +0 -18
  77. package/dist/commands/control-flow/throw.d.ts +0 -34
  78. package/dist/commands/control-flow/unless.d.ts +0 -3
  79. package/dist/commands/data/clear.d.ts +0 -37
  80. package/dist/commands/data/decrement.d.ts +0 -3
  81. package/dist/commands/data/default.d.ts +0 -60
  82. package/dist/commands/data/get.d.ts +0 -35
  83. package/dist/commands/data/increment.d.ts +0 -42
  84. package/dist/commands/data/set.d.ts +0 -76
  85. package/dist/commands/decorators/index.d.ts +0 -14
  86. package/dist/commands/dom/add.d.ts +0 -44
  87. package/dist/commands/dom/close.d.ts +0 -32
  88. package/dist/commands/dom/dom-modification-base.d.ts +0 -48
  89. package/dist/commands/dom/empty.d.ts +0 -32
  90. package/dist/commands/dom/hide.d.ts +0 -28
  91. package/dist/commands/dom/make.d.ts +0 -34
  92. package/dist/commands/dom/open.d.ts +0 -34
  93. package/dist/commands/dom/process-partials.d.ts +0 -51
  94. package/dist/commands/dom/put.d.ts +0 -42
  95. package/dist/commands/dom/remove.d.ts +0 -46
  96. package/dist/commands/dom/reset.d.ts +0 -32
  97. package/dist/commands/dom/select.d.ts +0 -32
  98. package/dist/commands/dom/show.d.ts +0 -29
  99. package/dist/commands/dom/swap.d.ts +0 -65
  100. package/dist/commands/dom/toggle.d.ts +0 -69
  101. package/dist/commands/dom/visibility-base.d.ts +0 -22
  102. package/dist/commands/events/send.d.ts +0 -3
  103. package/dist/commands/events/trigger.d.ts +0 -49
  104. package/dist/commands/execution/blur.d.ts +0 -32
  105. package/dist/commands/execution/call.d.ts +0 -35
  106. package/dist/commands/execution/focus.d.ts +0 -32
  107. package/dist/commands/execution/pseudo-command.d.ts +0 -41
  108. package/dist/commands/helpers/attribute-manipulation.d.ts +0 -11
  109. package/dist/commands/helpers/attribute-target.d.ts +0 -9
  110. package/dist/commands/helpers/batch-dom-operations.d.ts +0 -12
  111. package/dist/commands/helpers/body-ops.d.ts +0 -10
  112. package/dist/commands/helpers/class-manipulation.d.ts +0 -11
  113. package/dist/commands/helpers/condition-helpers.d.ts +0 -4
  114. package/dist/commands/helpers/dom-mutation.d.ts +0 -16
  115. package/dist/commands/helpers/duration-parsing.d.ts +0 -8
  116. package/dist/commands/helpers/element-property-access.d.ts +0 -7
  117. package/dist/commands/helpers/element-resolution.d.ts +0 -16
  118. package/dist/commands/helpers/error-helpers.d.ts +0 -17
  119. package/dist/commands/helpers/event-helpers.d.ts +0 -13
  120. package/dist/commands/helpers/event-waiting.d.ts +0 -37
  121. package/dist/commands/helpers/index.d.ts +0 -32
  122. package/dist/commands/helpers/input-validator.d.ts +0 -23
  123. package/dist/commands/helpers/loop-executor.d.ts +0 -56
  124. package/dist/commands/helpers/numeric-target-parser.d.ts +0 -21
  125. package/dist/commands/helpers/property-target.d.ts +0 -20
  126. package/dist/commands/helpers/selector-type-detection.d.ts +0 -24
  127. package/dist/commands/helpers/slots.d.ts +0 -5
  128. package/dist/commands/helpers/smart-element.d.ts +0 -16
  129. package/dist/commands/helpers/style-manipulation.d.ts +0 -16
  130. package/dist/commands/helpers/target-elements.d.ts +0 -5
  131. package/dist/commands/helpers/temporal-modifiers.d.ts +0 -15
  132. package/dist/commands/helpers/url-argument-parser.d.ts +0 -13
  133. package/dist/commands/helpers/url-validation.d.ts +0 -7
  134. package/dist/commands/helpers/variable-access.d.ts +0 -13
  135. package/dist/commands/helpers/visibility-target-parser.d.ts +0 -15
  136. package/dist/commands/helpers/write-target.d.ts +0 -42
  137. package/dist/commands/index.cjs +0 -24168
  138. package/dist/commands/index.d.ts +0 -171
  139. package/dist/commands/index.mjs +0 -23981
  140. package/dist/commands/manifest.d.ts +0 -17
  141. package/dist/commands/navigation/go.d.ts +0 -58
  142. package/dist/commands/navigation/push-url.d.ts +0 -48
  143. package/dist/commands/navigation/replace-url.d.ts +0 -3
  144. package/dist/commands/navigation/scroll-to.d.ts +0 -43
  145. package/dist/commands/templates/render.d.ts +0 -47
  146. package/dist/commands/utility/beep.d.ts +0 -41
  147. package/dist/commands/utility/breakpoint.d.ts +0 -32
  148. package/dist/commands/utility/copy.d.ts +0 -41
  149. package/dist/commands/utility/log.d.ts +0 -36
  150. package/dist/commands/utility/pick.d.ts +0 -47
  151. package/dist/commands/utility/tell.d.ts +0 -39
  152. package/dist/compatibility/browser-bundle-classic.d.ts +0 -17
  153. package/dist/compatibility/browser-bundle-hybrid-complete.d.ts +0 -22
  154. package/dist/compatibility/browser-bundle-hybrid-hx.d.ts +0 -43
  155. package/dist/compatibility/browser-bundle-lite.d.ts +0 -15
  156. package/dist/compatibility/browser-bundle-modular.d.ts +0 -18
  157. package/dist/compatibility/browser-bundle-multilingual.d.ts +0 -19
  158. package/dist/compatibility/browser-bundle-semantic-complete.d.ts +0 -24
  159. package/dist/compatibility/browser-bundle-textshelf-minimal.d.ts +0 -16
  160. package/dist/compatibility/browser-bundle-textshelf-profile.d.ts +0 -18
  161. package/dist/compatibility/browser-modular.d.ts +0 -42
  162. package/dist/compatibility/browser-tests/helpers/semantic-page.d.ts +0 -3
  163. package/dist/compatibility/browser-tests/test-utils.d.ts +0 -21
  164. package/dist/compatibility/bundle-shell.d.ts +0 -13
  165. package/dist/compatibility/bundle-sources.d.ts +0 -4
  166. package/dist/compatibility/eval-hyperscript.d.ts +0 -16
  167. package/dist/compatibility/hyperscript-adapter.d.ts +0 -38
  168. package/dist/core/ast-property-utils.d.ts +0 -2
  169. package/dist/core/context.d.ts +0 -19
  170. package/dist/core/dom.d.ts +0 -15
  171. package/dist/core/evaluator-types.d.ts +0 -5
  172. package/dist/core/events.d.ts +0 -48
  173. package/dist/core/executor.d.ts +0 -34
  174. package/dist/core/expression-evaluator.d.ts +0 -6
  175. package/dist/core/expression-registry.d.ts +0 -8
  176. package/dist/core/scope-hooks.d.ts +0 -24
  177. package/dist/debug/debug-controller.d.ts +0 -62
  178. package/dist/debug/index.d.ts +0 -5
  179. package/dist/dom/attribute-processor.d.ts +0 -75
  180. package/dist/dom/detect-language.d.ts +0 -3
  181. package/dist/dom/minimal-attribute-processor.d.ts +0 -20
  182. package/dist/expressions/base-expression.d.ts +0 -27
  183. package/dist/expressions/bundles/common-expressions.d.ts +0 -10
  184. package/dist/expressions/bundles/core-expressions.d.ts +0 -8
  185. package/dist/expressions/bundles/full-expressions.d.ts +0 -11
  186. package/dist/expressions/bundles/index.d.ts +0 -7
  187. package/dist/expressions/collection/index.d.ts +0 -10
  188. package/dist/expressions/conversion/index.d.ts +0 -31
  189. package/dist/expressions/expression-tiers.d.ts +0 -13
  190. package/dist/expressions/index.cjs +0 -4331
  191. package/dist/expressions/index.d.ts +0 -13
  192. package/dist/expressions/index.mjs +0 -4312
  193. package/dist/expressions/logical/index.d.ts +0 -61
  194. package/dist/expressions/mathematical/index.d.ts +0 -80
  195. package/dist/expressions/positional/index.d.ts +0 -31
  196. package/dist/expressions/properties/index.d.ts +0 -27
  197. package/dist/expressions/property-access-utils.d.ts +0 -23
  198. package/dist/expressions/references/index.d.ts +0 -39
  199. package/dist/expressions/shared/comparison-utils.d.ts +0 -10
  200. package/dist/expressions/shared/index.d.ts +0 -10
  201. package/dist/expressions/shared/number-utils.d.ts +0 -8
  202. package/dist/expressions/shared/tracking.d.ts +0 -20
  203. package/dist/expressions/shared/validation-utils.d.ts +0 -13
  204. package/dist/expressions/special/index.d.ts +0 -78
  205. package/dist/expressions/type-helpers.d.ts +0 -11
  206. package/dist/expressions/type-registry.d.ts +0 -57
  207. package/dist/expressions/validation-helpers.d.ts +0 -15
  208. package/dist/htmx/hcon.d.ts +0 -9
  209. package/dist/htmx/htmx-attribute-processor.d.ts +0 -120
  210. package/dist/htmx/htmx-translator.d.ts +0 -22
  211. package/dist/htmx/i18n-hooks.d.ts +0 -18
  212. package/dist/htmx/i18n-orchestrator.d.ts +0 -16
  213. package/dist/htmx/index.d.ts +0 -3
  214. package/dist/htmx/lang-resolver.d.ts +0 -3
  215. package/dist/htmx/sse.d.ts +0 -60
  216. package/dist/htmx/ws.d.ts +0 -59
  217. package/dist/hyperfixi-browser-classic-i18n.js +0 -2
  218. package/dist/hyperfixi-browser.js +0 -2
  219. package/dist/hyperfixi-classic-i18n.js +0 -2
  220. package/dist/hyperfixi-hx-v4.js +0 -1
  221. package/dist/hyperfixi-hx.js +0 -1
  222. package/dist/hyperfixi-hybrid-complete.js +0 -1
  223. package/dist/hyperfixi-hybrid-hx.js +0 -1
  224. package/dist/hyperfixi-multilingual.js +0 -2
  225. package/dist/hyperfixi.mjs +0 -2
  226. package/dist/i18n/error-catalog.d.ts +0 -12
  227. package/dist/index.cjs +0 -29159
  228. package/dist/index.min.js +0 -2
  229. package/dist/lib/dom-globals-shim.d.ts +0 -2
  230. package/dist/lib/index.d.ts +0 -4
  231. package/dist/lib/morph-adapter.d.ts +0 -9
  232. package/dist/lib/swap-executor.d.ts +0 -12
  233. package/dist/lib/view-transitions.d.ts +0 -7
  234. package/dist/lokascript-browser-classic-i18n.js +0 -2
  235. package/dist/lokascript-browser.js +0 -2
  236. package/dist/lokascript-hybrid-complete.js +0 -1
  237. package/dist/lokascript-hybrid-hx.js +0 -1
  238. package/dist/lokascript-multilingual.js +0 -2
  239. package/dist/lse/index.cjs +0 -84
  240. package/dist/lse/index.d.ts +0 -15
  241. package/dist/lse/index.mjs +0 -71
  242. package/dist/multilingual/bridge.d.ts +0 -38
  243. package/dist/multilingual/schema-roles.d.ts +0 -3
  244. package/dist/parser/__types__/test-helpers.d.ts +0 -25
  245. package/dist/parser/command-grammar.d.ts +0 -14
  246. package/dist/parser/command-node-builder.d.ts +0 -46
  247. package/dist/parser/command-parsers/animation-commands.d.ts +0 -6
  248. package/dist/parser/command-parsers/async-commands.d.ts +0 -5
  249. package/dist/parser/command-parsers/control-flow-commands.d.ts +0 -7
  250. package/dist/parser/command-parsers/declared-commands.d.ts +0 -6
  251. package/dist/parser/command-parsers/dom-commands.d.ts +0 -11
  252. package/dist/parser/command-parsers/event-commands.d.ts +0 -4
  253. package/dist/parser/command-parsers/navigation-commands.d.ts +0 -6
  254. package/dist/parser/command-parsers/utility-commands.d.ts +0 -14
  255. package/dist/parser/command-parsers/variable-commands.d.ts +0 -12
  256. package/dist/parser/error-handler.d.ts +0 -34
  257. package/dist/parser/extensions.d.ts +0 -43
  258. package/dist/parser/full-parser.cjs +0 -7943
  259. package/dist/parser/full-parser.d.ts +0 -4
  260. package/dist/parser/full-parser.mjs +0 -7940
  261. package/dist/parser/helpers/ast-helpers.d.ts +0 -24
  262. package/dist/parser/helpers/parsing-helpers.d.ts +0 -19
  263. package/dist/parser/helpers/token-helpers.d.ts +0 -28
  264. package/dist/parser/hybrid/aliases.cjs +0 -44
  265. package/dist/parser/hybrid/aliases.d.ts +0 -7
  266. package/dist/parser/hybrid/aliases.mjs +0 -37
  267. package/dist/parser/hybrid/ast-types.cjs +0 -3
  268. package/dist/parser/hybrid/ast-types.d.ts +0 -97
  269. package/dist/parser/hybrid/ast-types.mjs +0 -2
  270. package/dist/parser/hybrid/index.cjs +0 -1185
  271. package/dist/parser/hybrid/index.d.ts +0 -6
  272. package/dist/parser/hybrid/index.mjs +0 -1175
  273. package/dist/parser/hybrid/parser-core.cjs +0 -1171
  274. package/dist/parser/hybrid/parser-core.d.ts +0 -69
  275. package/dist/parser/hybrid/parser-core.mjs +0 -1169
  276. package/dist/parser/hybrid/tokenizer.cjs +0 -255
  277. package/dist/parser/hybrid/tokenizer.d.ts +0 -9
  278. package/dist/parser/hybrid/tokenizer.mjs +0 -252
  279. package/dist/parser/hybrid-parser.cjs +0 -1249
  280. package/dist/parser/hybrid-parser.d.ts +0 -10
  281. package/dist/parser/hybrid-parser.mjs +0 -1242
  282. package/dist/parser/parser-constants.d.ts +0 -100
  283. package/dist/parser/parser-interface.d.ts +0 -12
  284. package/dist/parser/parser-types.d.ts +0 -164
  285. package/dist/parser/parser.d.ts +0 -165
  286. package/dist/parser/pratt-parser.d.ts +0 -41
  287. package/dist/parser/regex-parser.cjs +0 -422
  288. package/dist/parser/regex-parser.d.ts +0 -4
  289. package/dist/parser/regex-parser.mjs +0 -419
  290. package/dist/parser/runtime.d.ts +0 -14
  291. package/dist/parser/semantic-integration.d.ts +0 -17
  292. package/dist/parser/token-consumer.d.ts +0 -34
  293. package/dist/parser/token-predicates.d.ts +0 -77
  294. package/dist/parser/tokenizer.d.ts +0 -28
  295. package/dist/parser/types.d.ts +0 -105
  296. package/dist/performance/expression-cache.d.ts +0 -78
  297. package/dist/performance/integration.d.ts +0 -40
  298. package/dist/performance/production-monitor.d.ts +0 -67
  299. package/dist/registry/browser-types.cjs +0 -81
  300. package/dist/registry/browser-types.d.ts +0 -20
  301. package/dist/registry/browser-types.mjs +0 -76
  302. package/dist/registry/environment.cjs +0 -36
  303. package/dist/registry/environment.d.ts +0 -19
  304. package/dist/registry/environment.mjs +0 -30
  305. package/dist/registry/event-source-registry.d.ts +0 -54
  306. package/dist/registry/examples/server-commands.d.ts +0 -6
  307. package/dist/registry/examples/server-event-source.d.ts +0 -32
  308. package/dist/registry/index.cjs +0 -14055
  309. package/dist/registry/index.d.ts +0 -39
  310. package/dist/registry/index.mjs +0 -14039
  311. package/dist/registry/runtime-integration.d.ts +0 -23
  312. package/dist/registry/universal-types.cjs +0 -91
  313. package/dist/registry/universal-types.d.ts +0 -35
  314. package/dist/registry/universal-types.mjs +0 -86
  315. package/dist/runtime/cleanup-registry.d.ts +0 -47
  316. package/dist/runtime/command-adapter.d.ts +0 -69
  317. package/dist/runtime/environment.d.ts +0 -75
  318. package/dist/runtime/plugin.d.ts +0 -14
  319. package/dist/runtime/runtime-base.d.ts +0 -100
  320. package/dist/runtime/runtime-factory.d.ts +0 -29
  321. package/dist/runtime/runtime.d.ts +0 -20
  322. package/dist/runtime/temporal-modifiers.d.ts +0 -37
  323. package/dist/test-setup.d.ts +0 -28
  324. package/dist/test-utilities.d.ts +0 -39
  325. package/dist/types/base-types.d.ts +0 -231
  326. package/dist/types/code-fix.d.ts +0 -39
  327. package/dist/types/command-metadata.d.ts +0 -57
  328. package/dist/types/command-types.d.ts +0 -262
  329. package/dist/types/context-types.d.ts +0 -106
  330. package/dist/types/core-context.d.ts +0 -22
  331. package/dist/types/core.d.ts +0 -143
  332. package/dist/types/error-codes.d.ts +0 -207
  333. package/dist/types/expression-types.d.ts +0 -155
  334. package/dist/types/hooks.d.ts +0 -45
  335. package/dist/types/index.d.ts +0 -32
  336. package/dist/types/program.d.ts +0 -8
  337. package/dist/types/result.d.ts +0 -73
  338. package/dist/types/template-types.d.ts +0 -162
  339. package/dist/types/type-guards.d.ts +0 -24
  340. package/dist/types/unified-types.d.ts +0 -91
  341. package/dist/utils/beep.d.ts +0 -8
  342. package/dist/utils/debug-events.d.ts +0 -41
  343. package/dist/utils/debug.d.ts +0 -35
  344. package/dist/utils/dom-utils.d.ts +0 -16
  345. package/dist/utils/element-check.d.ts +0 -8
  346. package/dist/utils/keyboard-shortcuts.d.ts +0 -18
  347. package/dist/utils/performance.d.ts +0 -40
  348. package/dist/validation/command-pattern-validator.d.ts +0 -53
  349. package/dist/validation/common-validators.d.ts +0 -24
  350. package/dist/validation/lightweight-validators.d.ts +0 -113
  351. package/dist/validation/partial-validation-types.d.ts +0 -50
  352. package/dist/validation/partial-validator.d.ts +0 -6
  353. package/dist/validation/partial-warning-formatter.d.ts +0 -6
  354. package/dist/validation/validate-cli.d.ts +0 -41
  355. package/vocab/htmx/ar.js +0 -62
  356. package/vocab/htmx/bn.js +0 -65
  357. package/vocab/htmx/de.js +0 -83
  358. package/vocab/htmx/en.js +0 -24
  359. package/vocab/htmx/es.js +0 -79
  360. package/vocab/htmx/fr.js +0 -79
  361. package/vocab/htmx/he.js +0 -61
  362. package/vocab/htmx/hi.js +0 -81
  363. package/vocab/htmx/id.js +0 -76
  364. package/vocab/htmx/it.js +0 -79
  365. package/vocab/htmx/ja.js +0 -85
  366. package/vocab/htmx/ko.js +0 -81
  367. package/vocab/htmx/ms.js +0 -58
  368. package/vocab/htmx/pl.js +0 -80
  369. package/vocab/htmx/pt.js +0 -81
  370. package/vocab/htmx/qu.js +0 -83
  371. package/vocab/htmx/ru.js +0 -82
  372. package/vocab/htmx/sw.js +0 -79
  373. package/vocab/htmx/th.js +0 -67
  374. package/vocab/htmx/tl.js +0 -56
  375. package/vocab/htmx/tr.js +0 -86
  376. package/vocab/htmx/uk.js +0 -82
  377. package/vocab/htmx/vi.js +0 -59
  378. package/vocab/htmx/zh.js +0 -79
@@ -1,386 +1,24 @@
1
- import { getSchema } from '@lokascript/semantic';
2
- import { inferRolesFromSchema } from '@lokascript/intent';
3
-
4
- const DEFAULT_CONFIDENCE_THRESHOLD = 0.5;
5
-
6
- function checkDebugEnabled() {
7
- if (typeof localStorage !== 'undefined') {
8
- try {
9
- const ls = localStorage;
10
- const setting = ls.getItem('hyperfixi:debug') || ls.getItem('lokascript:debug');
11
- if (setting === '*' || setting === 'true')
12
- return true;
13
- }
14
- catch {
15
- }
16
- }
17
- if (typeof window !== 'undefined' && window.__HYPERFIXI_DEBUG__) {
18
- return true;
19
- }
20
- if (typeof process !== 'undefined' && process.env?.HYPERFIXI_DEBUG === 'true') {
21
- return true;
22
- }
23
- return false;
1
+ let semanticModule = null;
2
+ async function semantic() {
3
+ semanticModule ?? (semanticModule = await import('@lokascript/semantic'));
4
+ return semanticModule;
24
5
  }
25
- const isDebugEnabled = checkDebugEnabled();
26
- const DEBUG = {
27
- commands: isDebugEnabled,
28
- events: isDebugEnabled,
29
- parsing: isDebugEnabled,
30
- expressions: isDebugEnabled,
31
- styles: isDebugEnabled,
32
- runtime: isDebugEnabled,
33
- loops: isDebugEnabled,
34
- async: isDebugEnabled,
35
- };
36
- const debug = {
37
- command: (...args) => {
38
- if (DEBUG.commands)
39
- console.log('\ud83d\udd27', ...args);
40
- },
41
- event: (...args) => {
42
- if (DEBUG.events)
43
- console.log('\ud83c\udfaf', ...args);
44
- },
45
- parse: (...args) => {
46
- if (DEBUG.parsing)
47
- console.log('\ud83d\udcdd', ...args);
48
- },
49
- expr: (...args) => {
50
- if (DEBUG.expressions)
51
- console.log('\ud83d\udd0d', ...args);
52
- },
53
- expressions: (...args) => {
54
- if (DEBUG.expressions)
55
- console.log('\ud83d\udd0d', ...args);
56
- },
57
- style: (...args) => {
58
- if (DEBUG.styles)
59
- console.log('\ud83c\udfa8', ...args);
60
- },
61
- runtime: (...args) => {
62
- if (DEBUG.runtime)
63
- console.log('\ud83d\ude80', ...args);
64
- },
65
- loop: (...args) => {
66
- if (DEBUG.loops)
67
- console.log('\ud83d\udd01', ...args);
68
- },
69
- async: (...args) => {
70
- if (DEBUG.async)
71
- console.log('\u23f3', ...args);
72
- },
73
- };
74
-
75
- function unconsumedInputWarnings(node) {
76
- const diagnostics = node
77
- .diagnostics;
78
- if (!diagnostics?.length)
79
- return [];
80
- return diagnostics.filter(d => d.code === 'unconsumed-input').map(d => d.message);
81
- }
82
- let _semanticModule = null;
83
- async function getSemanticModule() {
84
- if (!_semanticModule) {
85
- _semanticModule = await import('@lokascript/semantic');
86
- }
87
- return _semanticModule;
6
+ async function parse(input, lang = 'en') {
7
+ return (await semantic()).parseSemantic(input, lang).node ?? null;
88
8
  }
89
- class SemanticGrammarBridge {
90
- constructor(config = {}) {
91
- this._initialized = false;
92
- this.config = {
93
- confidenceThreshold: config.confidenceThreshold ?? DEFAULT_CONFIDENCE_THRESHOLD,
94
- fallbackOnLowConfidence: config.fallbackOnLowConfidence ?? true,
95
- };
96
- }
97
- async initialize() {
98
- await getSemanticModule();
99
- this._initialized = true;
100
- }
101
- isInitialized() {
102
- return this._initialized;
103
- }
104
- async transform(input, sourceLang, targetLang) {
105
- if (!this.isInitialized()) {
106
- await this.initialize();
107
- }
108
- if (sourceLang === targetLang) {
109
- return {
110
- output: input,
111
- usedSemantic: false,
112
- confidence: 1.0,
113
- sourceLang,
114
- targetLang,
115
- };
116
- }
117
- const semantic = await getSemanticModule();
118
- try {
119
- const output = semantic.translate(input, sourceLang, targetLang);
120
- if (output !== input) {
121
- return {
122
- output,
123
- usedSemantic: true,
124
- confidence: 0.9,
125
- sourceLang,
126
- targetLang,
127
- };
128
- }
129
- }
130
- catch {
131
- }
132
- return {
133
- output: input,
134
- usedSemantic: false,
135
- confidence: 0,
136
- sourceLang,
137
- targetLang,
138
- };
139
- }
140
- async parse(input, lang) {
141
- if (!this.isInitialized()) {
142
- await this.initialize();
143
- }
144
- const semantic = await getSemanticModule();
145
- const result = semantic.parseSemantic(input, lang);
146
- return result.node ?? null;
147
- }
148
- async render(node, targetLang) {
149
- const semantic = await getSemanticModule();
150
- return semantic.render(node, targetLang);
151
- }
152
- async parseToAST(input, lang) {
153
- if (!this.isInitialized()) {
154
- await this.initialize();
155
- }
156
- const semantic = await getSemanticModule();
157
- const result = semantic.parseSemantic(input, lang);
158
- if (result.confidence >= this.config.confidenceThreshold && result.node) {
159
- try {
160
- const buildResult = semantic.buildAST(result.node);
161
- return buildResult.ast;
162
- }
163
- catch (error) {
164
- debug.runtime('[SemanticGrammarBridge] AST build failed, using fallback:', error);
165
- }
166
- }
167
- return null;
168
- }
169
- async parseToASTWithDetails(input, lang) {
170
- if (!this.isInitialized()) {
171
- await this.initialize();
172
- }
173
- const semantic = await getSemanticModule();
174
- const result = semantic.parseSemantic(input, lang);
175
- if (result.confidence >= this.config.confidenceThreshold && result.node) {
176
- try {
177
- const buildResult = semantic.buildAST(result.node);
178
- return {
179
- ast: buildResult.ast,
180
- usedDirectPath: true,
181
- confidence: result.confidence,
182
- lang,
183
- fallbackText: null,
184
- warnings: [...(buildResult.warnings ?? []), ...unconsumedInputWarnings(result.node)],
185
- };
186
- }
187
- catch {
188
- }
189
- }
190
- if (result.node && this.config.fallbackOnLowConfidence) {
191
- const englishText = semantic.render(result.node, 'en');
192
- return {
193
- ast: null,
194
- usedDirectPath: false,
195
- confidence: result.confidence,
196
- lang,
197
- fallbackText: englishText,
198
- };
199
- }
200
- return {
201
- ast: null,
202
- usedDirectPath: false,
203
- confidence: result.confidence,
204
- lang,
205
- fallbackText: null,
206
- };
207
- }
208
- async getAllTranslations(input, sourceLang) {
209
- const semantic = await getSemanticModule();
210
- const languages = semantic.getSupportedLanguages();
211
- const results = {};
212
- for (const lang of languages) {
213
- results[lang] = await this.transform(input, sourceLang, lang);
214
- }
215
- return results;
216
- }
217
- }
218
- let _defaultBridge = null;
219
- async function getDefaultBridge() {
220
- if (!_defaultBridge) {
221
- _defaultBridge = new SemanticGrammarBridge();
222
- await _defaultBridge.initialize();
223
- }
224
- return _defaultBridge;
9
+ async function render(node, lang) {
10
+ return (await semantic()).render(node, lang);
225
11
  }
226
12
  async function translate(input, sourceLang, targetLang) {
227
- const bridge = await getDefaultBridge();
228
- const result = await bridge.transform(input, sourceLang, targetLang);
229
- return result.output;
230
- }
231
-
232
- const INTERCHANGE_ADAPTER = {
233
- getIdentifierName(node) {
234
- if (node.type !== 'identifier')
235
- return undefined;
236
- const ident = node;
237
- if (typeof ident.name === 'string' && ident.name !== '')
238
- return ident.name;
239
- if (typeof ident.value === 'string')
240
- return ident.value;
241
- return undefined;
242
- },
243
- convertValue(node) {
244
- return node;
245
- },
246
- createLiteralValue(text) {
247
- return { type: 'literal', value: text };
248
- },
249
- };
250
- const schemaRoleInferrer = (name, args, modifiers, target) => {
251
- const schema = getSchema(name);
252
- if (!schema)
253
- return null;
254
- const inferred = inferRolesFromSchema(schema, args, modifiers, target, INTERCHANGE_ADAPTER);
255
- const declared = schema.ast
256
- ?.modifiers;
257
- if (declared && modifiers) {
258
- for (const [key, role] of Object.entries(declared)) {
259
- const value = modifiers[key];
260
- const isNode = !!value && typeof value === 'object' && 'type' in value;
261
- if (isNode && inferred[role] === undefined) {
262
- inferred[role] = value;
263
- }
264
- }
265
- }
266
- return Object.keys(inferred).length > 0
267
- ? inferred
268
- : null;
269
- };
270
-
271
- class MultilingualHyperscript {
272
- constructor(config = {}) {
273
- this.initialized = false;
274
- this.bridge = new SemanticGrammarBridge(config);
275
- }
276
- async initialize() {
277
- if (this.initialized)
278
- return;
279
- await this.bridge.initialize();
280
- this.initialized = true;
281
- }
282
- isInitialized() {
283
- return this.initialized;
284
- }
285
- async ensureInitialized() {
286
- if (!this.initialized) {
287
- await this.initialize();
288
- }
289
- }
290
- async parse(input, lang = 'en') {
291
- await this.ensureInitialized();
292
- return this.bridge.parse(input, lang);
293
- }
294
- async parseToAST(input, lang = 'en') {
295
- await this.ensureInitialized();
296
- return this.bridge.parseToAST(input, lang);
297
- }
298
- async parseToASTWithDetails(input, lang = 'en') {
299
- await this.ensureInitialized();
300
- return this.bridge.parseToASTWithDetails(input, lang);
13
+ if (sourceLang === targetLang)
14
+ return input;
15
+ try {
16
+ return (await semantic()).translate(input, sourceLang, targetLang);
301
17
  }
302
- async translate(input, from, to) {
303
- await this.ensureInitialized();
304
- const result = await this.bridge.transform(input, from, to);
305
- return result.output;
306
- }
307
- async translateWithDetails(input, from, to) {
308
- await this.ensureInitialized();
309
- return this.bridge.transform(input, from, to);
310
- }
311
- async render(node, lang) {
312
- await this.ensureInitialized();
313
- return this.bridge.render(node, lang);
314
- }
315
- async getAllTranslations(input, from) {
316
- await this.ensureInitialized();
317
- const all = await this.bridge.getAllTranslations(input, from);
318
- const supported = new Set(this.getSupportedLanguages());
319
- return Object.fromEntries(Object.entries(all).filter(([lang]) => supported.has(lang)));
320
- }
321
- getSupportedLanguages() {
322
- return [
323
- 'en',
324
- 'ja',
325
- 'ar',
326
- 'es',
327
- 'ko',
328
- 'zh',
329
- 'tr',
330
- 'pt',
331
- 'fr',
332
- 'de',
333
- 'id',
334
- 'qu',
335
- 'sw',
336
- ];
337
- }
338
- isLanguageSupported(lang) {
339
- return this.getSupportedLanguages().includes(lang);
340
- }
341
- getLanguageInfo(lang) {
342
- return LANGUAGE_INFO[lang];
343
- }
344
- getAllLanguageInfo() {
345
- return { ...LANGUAGE_INFO };
346
- }
347
- }
348
- const LANGUAGE_INFO = {
349
- en: { code: 'en', name: 'English', nativeName: 'English', direction: 'ltr', wordOrder: 'SVO' },
350
- ja: { code: 'ja', name: 'Japanese', nativeName: '\u65e5\u672c\u8a9e', direction: 'ltr', wordOrder: 'SOV' },
351
- ar: { code: 'ar', name: 'Arabic', nativeName: '\u0627\u0644\u0639\u0631\u0628\u064a\u0629', direction: 'rtl', wordOrder: 'VSO' },
352
- es: { code: 'es', name: 'Spanish', nativeName: 'Espa\u00f1ol', direction: 'ltr', wordOrder: 'SVO' },
353
- ko: { code: 'ko', name: 'Korean', nativeName: '\ud55c\uad6d\uc5b4', direction: 'ltr', wordOrder: 'SOV' },
354
- zh: { code: 'zh', name: 'Chinese', nativeName: '\u4e2d\u6587', direction: 'ltr', wordOrder: 'SVO' },
355
- tr: { code: 'tr', name: 'Turkish', nativeName: 'T\u00fcrk\u00e7e', direction: 'ltr', wordOrder: 'SOV' },
356
- pt: {
357
- code: 'pt',
358
- name: 'Portuguese',
359
- nativeName: 'Portugu\u00eas',
360
- direction: 'ltr',
361
- wordOrder: 'SVO',
362
- },
363
- fr: { code: 'fr', name: 'French', nativeName: 'Fran\u00e7ais', direction: 'ltr', wordOrder: 'SVO' },
364
- de: { code: 'de', name: 'German', nativeName: 'Deutsch', direction: 'ltr', wordOrder: 'SVO' },
365
- id: {
366
- code: 'id',
367
- name: 'Indonesian',
368
- nativeName: 'Bahasa Indonesia',
369
- direction: 'ltr',
370
- wordOrder: 'SVO',
371
- },
372
- qu: { code: 'qu', name: 'Quechua', nativeName: 'Runasimi', direction: 'ltr', wordOrder: 'SOV' },
373
- sw: { code: 'sw', name: 'Swahili', nativeName: 'Kiswahili', direction: 'ltr', wordOrder: 'SVO' },
374
- };
375
- let _defaultInstance = null;
376
- async function getMultilingual() {
377
- if (!_defaultInstance) {
378
- _defaultInstance = new MultilingualHyperscript();
379
- await _defaultInstance.initialize();
18
+ catch {
19
+ return input;
380
20
  }
381
- return _defaultInstance;
382
21
  }
383
- const multilingual = new MultilingualHyperscript();
384
22
 
385
- export { MultilingualHyperscript, SemanticGrammarBridge, getDefaultBridge, getMultilingual, multilingual, schemaRoleInferrer, translate };
23
+ export { parse, render, translate };
386
24
  //# sourceMappingURL=index.mjs.map