@velarscript/web 0.30.1 → 0.32.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 (385) hide show
  1. package/README.md +1 -1
  2. package/dist/analysis/calls/intrinsics/config.d.ts +10 -0
  3. package/dist/analysis/calls/intrinsics/config.d.ts.map +1 -0
  4. package/dist/analysis/calls/intrinsics/config.js +19 -0
  5. package/dist/analysis/calls/intrinsics/config.js.map +1 -0
  6. package/dist/analysis/calls/intrinsics/forms.d.ts +10 -0
  7. package/dist/analysis/calls/intrinsics/forms.d.ts.map +1 -0
  8. package/dist/analysis/calls/intrinsics/forms.js +38 -0
  9. package/dist/analysis/calls/intrinsics/forms.js.map +1 -0
  10. package/dist/analysis/calls/intrinsics/http.d.ts +10 -0
  11. package/dist/analysis/calls/intrinsics/http.d.ts.map +1 -0
  12. package/dist/analysis/calls/intrinsics/http.js +37 -0
  13. package/dist/analysis/calls/intrinsics/http.js.map +1 -0
  14. package/dist/analysis/calls/intrinsics/reactive.d.ts +10 -0
  15. package/dist/analysis/calls/intrinsics/reactive.d.ts.map +1 -0
  16. package/dist/analysis/calls/intrinsics/reactive.js +30 -0
  17. package/dist/analysis/calls/intrinsics/reactive.js.map +1 -0
  18. package/dist/analysis/calls/intrinsics/storage.d.ts +12 -0
  19. package/dist/analysis/calls/intrinsics/storage.d.ts.map +1 -0
  20. package/dist/analysis/calls/intrinsics/storage.js +86 -0
  21. package/dist/analysis/calls/intrinsics/storage.js.map +1 -0
  22. package/dist/analysis/calls/intrinsics/web.d.ts +10 -0
  23. package/dist/analysis/calls/intrinsics/web.d.ts.map +1 -0
  24. package/dist/analysis/calls/intrinsics/web.js +100 -0
  25. package/dist/analysis/calls/intrinsics/web.js.map +1 -0
  26. package/dist/analysis/calls/intrinsics.d.ts +13 -0
  27. package/dist/analysis/calls/intrinsics.d.ts.map +1 -0
  28. package/dist/analysis/calls/intrinsics.js +31 -0
  29. package/dist/analysis/calls/intrinsics.js.map +1 -0
  30. package/dist/analysis/components/contracts.d.ts +19 -0
  31. package/dist/analysis/components/contracts.d.ts.map +1 -0
  32. package/dist/analysis/components/contracts.js +83 -0
  33. package/dist/analysis/components/contracts.js.map +1 -0
  34. package/dist/analysis/components/declaration.d.ts +4 -0
  35. package/dist/analysis/components/declaration.d.ts.map +1 -0
  36. package/dist/analysis/components/declaration.js +163 -0
  37. package/dist/analysis/components/declaration.js.map +1 -0
  38. package/dist/analysis/components/host.d.ts +61 -0
  39. package/dist/analysis/components/host.d.ts.map +1 -0
  40. package/dist/analysis/components/host.js +22 -0
  41. package/dist/analysis/components/host.js.map +1 -0
  42. package/dist/analysis/components/lifecycle.d.ts +22 -0
  43. package/dist/analysis/components/lifecycle.d.ts.map +1 -0
  44. package/dist/analysis/components/lifecycle.js +33 -0
  45. package/dist/analysis/components/lifecycle.js.map +1 -0
  46. package/dist/analysis/components/ownership.d.ts +74 -0
  47. package/dist/analysis/components/ownership.d.ts.map +1 -0
  48. package/dist/analysis/components/ownership.js +106 -0
  49. package/dist/analysis/components/ownership.js.map +1 -0
  50. package/dist/analysis/declarations.d.ts +99 -0
  51. package/dist/analysis/declarations.d.ts.map +1 -0
  52. package/dist/analysis/declarations.js +176 -0
  53. package/dist/analysis/declarations.js.map +1 -0
  54. package/dist/analysis/inference.d.ts +67 -0
  55. package/dist/analysis/inference.d.ts.map +1 -0
  56. package/dist/analysis/inference.js +236 -0
  57. package/dist/analysis/inference.js.map +1 -0
  58. package/dist/analysis/jsx/attributes.d.ts +103 -0
  59. package/dist/analysis/jsx/attributes.d.ts.map +1 -0
  60. package/dist/analysis/jsx/attributes.js +601 -0
  61. package/dist/analysis/jsx/attributes.js.map +1 -0
  62. package/dist/analysis/jsx/elements.d.ts +17 -0
  63. package/dist/analysis/jsx/elements.d.ts.map +1 -0
  64. package/dist/analysis/jsx/elements.js +213 -0
  65. package/dist/analysis/jsx/elements.js.map +1 -0
  66. package/dist/analysis/jsx/host.d.ts +61 -0
  67. package/dist/analysis/jsx/host.d.ts.map +1 -0
  68. package/dist/analysis/jsx/host.js +15 -0
  69. package/dist/analysis/jsx/host.js.map +1 -0
  70. package/dist/analysis/jsx/keys.d.ts +15 -0
  71. package/dist/analysis/jsx/keys.d.ts.map +1 -0
  72. package/dist/analysis/jsx/keys.js +67 -0
  73. package/dist/analysis/jsx/keys.js.map +1 -0
  74. package/dist/analysis/jsx/security.d.ts +29 -0
  75. package/dist/analysis/jsx/security.d.ts.map +1 -0
  76. package/dist/analysis/jsx/security.js +61 -0
  77. package/dist/analysis/jsx/security.js.map +1 -0
  78. package/dist/analysis/jsx-detection.d.ts +49 -0
  79. package/dist/analysis/jsx-detection.d.ts.map +1 -0
  80. package/dist/analysis/jsx-detection.js +196 -0
  81. package/dist/analysis/jsx-detection.js.map +1 -0
  82. package/dist/analysis/keyed-rebuild.d.ts +148 -0
  83. package/dist/analysis/keyed-rebuild.d.ts.map +1 -0
  84. package/dist/analysis/keyed-rebuild.js +299 -0
  85. package/dist/analysis/keyed-rebuild.js.map +1 -0
  86. package/dist/analysis/keyframes-analysis.d.ts +6 -0
  87. package/dist/analysis/keyframes-analysis.d.ts.map +1 -0
  88. package/dist/analysis/keyframes-analysis.js +79 -0
  89. package/dist/analysis/keyframes-analysis.js.map +1 -0
  90. package/dist/analysis/look/builders.d.ts +29 -0
  91. package/dist/analysis/look/builders.d.ts.map +1 -0
  92. package/dist/analysis/look/builders.js +168 -0
  93. package/dist/analysis/look/builders.js.map +1 -0
  94. package/dist/analysis/look/conditions.d.ts +13 -0
  95. package/dist/analysis/look/conditions.d.ts.map +1 -0
  96. package/dist/analysis/look/conditions.js +84 -0
  97. package/dist/analysis/look/conditions.js.map +1 -0
  98. package/dist/analysis/look/edits.d.ts +25 -0
  99. package/dist/analysis/look/edits.d.ts.map +1 -0
  100. package/dist/analysis/look/edits.js +57 -0
  101. package/dist/analysis/look/edits.js.map +1 -0
  102. package/dist/analysis/look/entries.d.ts +56 -0
  103. package/dist/analysis/look/entries.d.ts.map +1 -0
  104. package/dist/analysis/look/entries.js +223 -0
  105. package/dist/analysis/look/entries.js.map +1 -0
  106. package/dist/analysis/look/host.d.ts +47 -0
  107. package/dist/analysis/look/host.d.ts.map +1 -0
  108. package/dist/analysis/look/host.js +16 -0
  109. package/dist/analysis/look/host.js.map +1 -0
  110. package/dist/analysis/look/tokens.d.ts +75 -0
  111. package/dist/analysis/look/tokens.d.ts.map +1 -0
  112. package/dist/analysis/look/tokens.js +151 -0
  113. package/dist/analysis/look/tokens.js.map +1 -0
  114. package/dist/analysis/look/values.d.ts +45 -0
  115. package/dist/analysis/look/values.d.ts.map +1 -0
  116. package/dist/analysis/look/values.js +148 -0
  117. package/dist/analysis/look/values.js.map +1 -0
  118. package/dist/analysis/look-conditions.d.ts +47 -0
  119. package/dist/analysis/look-conditions.d.ts.map +1 -0
  120. package/dist/analysis/look-conditions.js +157 -0
  121. package/dist/analysis/look-conditions.js.map +1 -0
  122. package/dist/analysis/look-sites.d.ts +54 -0
  123. package/dist/analysis/look-sites.d.ts.map +1 -0
  124. package/dist/analysis/look-sites.js +104 -0
  125. package/dist/analysis/look-sites.js.map +1 -0
  126. package/dist/analysis/look-vocabulary-guidance.d.ts +76 -0
  127. package/dist/analysis/look-vocabulary-guidance.d.ts.map +1 -0
  128. package/dist/analysis/look-vocabulary-guidance.js +338 -0
  129. package/dist/analysis/look-vocabulary-guidance.js.map +1 -0
  130. package/dist/analysis/media-conditions.d.ts +33 -0
  131. package/dist/analysis/media-conditions.d.ts.map +1 -0
  132. package/dist/analysis/media-conditions.js +92 -0
  133. package/dist/analysis/media-conditions.js.map +1 -0
  134. package/dist/analysis/program-passes.d.ts +106 -0
  135. package/dist/analysis/program-passes.d.ts.map +1 -0
  136. package/dist/analysis/program-passes.js +149 -0
  137. package/dist/analysis/program-passes.js.map +1 -0
  138. package/dist/analysis/reactivity/bindings.d.ts +37 -0
  139. package/dist/analysis/reactivity/bindings.d.ts.map +1 -0
  140. package/dist/analysis/reactivity/bindings.js +88 -0
  141. package/dist/analysis/reactivity/bindings.js.map +1 -0
  142. package/dist/analysis/reactivity/derived.d.ts +39 -0
  143. package/dist/analysis/reactivity/derived.d.ts.map +1 -0
  144. package/dist/analysis/reactivity/derived.js +80 -0
  145. package/dist/analysis/reactivity/derived.js.map +1 -0
  146. package/dist/analysis/reactivity/host.d.ts +38 -0
  147. package/dist/analysis/reactivity/host.d.ts.map +1 -0
  148. package/dist/analysis/reactivity/host.js +14 -0
  149. package/dist/analysis/reactivity/host.js.map +1 -0
  150. package/dist/analysis/reactivity/retired-accessors.d.ts +82 -0
  151. package/dist/analysis/reactivity/retired-accessors.d.ts.map +1 -0
  152. package/dist/analysis/reactivity/retired-accessors.js +118 -0
  153. package/dist/analysis/reactivity/retired-accessors.js.map +1 -0
  154. package/dist/analysis/renderable.d.ts +47 -0
  155. package/dist/analysis/renderable.d.ts.map +1 -0
  156. package/dist/analysis/renderable.js +105 -0
  157. package/dist/analysis/renderable.js.map +1 -0
  158. package/dist/analysis/routes.d.ts +64 -0
  159. package/dist/analysis/routes.d.ts.map +1 -0
  160. package/dist/analysis/routes.js +182 -0
  161. package/dist/analysis/routes.js.map +1 -0
  162. package/dist/analysis/url-attributes.d.ts +12 -0
  163. package/dist/analysis/url-attributes.d.ts.map +1 -0
  164. package/dist/analysis/url-attributes.js +48 -0
  165. package/dist/analysis/url-attributes.js.map +1 -0
  166. package/dist/analysis/watch-cycles.d.ts +102 -0
  167. package/dist/analysis/watch-cycles.d.ts.map +1 -1
  168. package/dist/analysis/watch-cycles.js +240 -1
  169. package/dist/analysis/watch-cycles.js.map +1 -1
  170. package/dist/analysis/watch-subject.d.ts +45 -0
  171. package/dist/analysis/watch-subject.d.ts.map +1 -0
  172. package/dist/analysis/watch-subject.js +272 -0
  173. package/dist/analysis/watch-subject.js.map +1 -0
  174. package/dist/analysis/web-types.d.ts +27 -0
  175. package/dist/analysis/web-types.d.ts.map +1 -0
  176. package/dist/analysis/web-types.js +170 -0
  177. package/dist/analysis/web-types.js.map +1 -0
  178. package/dist/analyzer.d.ts +18 -617
  179. package/dist/analyzer.d.ts.map +1 -1
  180. package/dist/analyzer.js +208 -4853
  181. package/dist/analyzer.js.map +1 -1
  182. package/dist/compiler.d.ts +20 -0
  183. package/dist/compiler.d.ts.map +1 -1
  184. package/dist/compiler.js +29 -864
  185. package/dist/compiler.js.map +1 -1
  186. package/dist/documentation.d.ts +28 -0
  187. package/dist/documentation.d.ts.map +1 -0
  188. package/dist/documentation.js +67 -0
  189. package/dist/documentation.js.map +1 -0
  190. package/dist/editor/completions.d.ts +12 -0
  191. package/dist/editor/completions.d.ts.map +1 -0
  192. package/dist/editor/completions.js +6 -0
  193. package/dist/editor/completions.js.map +1 -0
  194. package/dist/editor/jsx-completion.d.ts +12 -0
  195. package/dist/editor/jsx-completion.d.ts.map +1 -0
  196. package/dist/editor/jsx-completion.js +137 -0
  197. package/dist/editor/jsx-completion.js.map +1 -0
  198. package/dist/editor/look-completion.d.ts +29 -0
  199. package/dist/editor/look-completion.d.ts.map +1 -0
  200. package/dist/editor/look-completion.js +159 -0
  201. package/dist/editor/look-completion.js.map +1 -0
  202. package/dist/editor.d.ts.map +1 -1
  203. package/dist/editor.js +12 -288
  204. package/dist/editor.js.map +1 -1
  205. package/dist/emit/components.d.ts +33 -0
  206. package/dist/emit/components.d.ts.map +1 -0
  207. package/dist/emit/components.js +135 -0
  208. package/dist/emit/components.js.map +1 -0
  209. package/dist/emit/jsx.d.ts +57 -0
  210. package/dist/emit/jsx.d.ts.map +1 -0
  211. package/dist/emit/jsx.js +384 -0
  212. package/dist/emit/jsx.js.map +1 -0
  213. package/dist/emit/look-css.d.ts +44 -0
  214. package/dist/emit/look-css.d.ts.map +1 -0
  215. package/dist/emit/look-css.js +177 -0
  216. package/dist/emit/look-css.js.map +1 -0
  217. package/dist/emit/look.d.ts +39 -0
  218. package/dist/emit/look.d.ts.map +1 -0
  219. package/dist/emit/look.js +218 -0
  220. package/dist/emit/look.js.map +1 -0
  221. package/dist/emit/runtime-imports.d.ts +40 -0
  222. package/dist/emit/runtime-imports.d.ts.map +1 -0
  223. package/dist/emit/runtime-imports.js +184 -0
  224. package/dist/emit/runtime-imports.js.map +1 -0
  225. package/dist/emitter.d.ts +15 -68
  226. package/dist/emitter.d.ts.map +1 -1
  227. package/dist/emitter.js +79 -1008
  228. package/dist/emitter.js.map +1 -1
  229. package/dist/look/animation.d.ts +7 -0
  230. package/dist/look/animation.d.ts.map +1 -0
  231. package/dist/look/animation.js +13 -0
  232. package/dist/look/animation.js.map +1 -0
  233. package/dist/look/builders.d.ts +35 -0
  234. package/dist/look/builders.d.ts.map +1 -0
  235. package/dist/look/builders.js +74 -0
  236. package/dist/look/builders.js.map +1 -0
  237. package/dist/look/css-functions.d.ts +28 -0
  238. package/dist/look/css-functions.d.ts.map +1 -0
  239. package/dist/look/css-functions.js +54 -0
  240. package/dist/look/css-functions.js.map +1 -0
  241. package/dist/look/keyword-sets.d.ts +41 -0
  242. package/dist/look/keyword-sets.d.ts.map +1 -0
  243. package/dist/look/keyword-sets.js +117 -0
  244. package/dist/look/keyword-sets.js.map +1 -0
  245. package/dist/look/keywords.d.ts +55 -0
  246. package/dist/look/keywords.d.ts.map +1 -0
  247. package/dist/look/keywords.js +387 -0
  248. package/dist/look/keywords.js.map +1 -0
  249. package/dist/look/media.d.ts +19 -0
  250. package/dist/look/media.d.ts.map +1 -0
  251. package/dist/look/media.js +27 -0
  252. package/dist/look/media.js.map +1 -0
  253. package/dist/look/naming.d.ts +9 -0
  254. package/dist/look/naming.d.ts.map +1 -0
  255. package/dist/look/naming.js +45 -0
  256. package/dist/look/naming.js.map +1 -0
  257. package/dist/look/properties.d.ts +16 -0
  258. package/dist/look/properties.d.ts.map +1 -0
  259. package/dist/look/properties.js +52 -0
  260. package/dist/look/properties.js.map +1 -0
  261. package/dist/look/shorthands.d.ts +25 -0
  262. package/dist/look/shorthands.d.ts.map +1 -0
  263. package/dist/look/shorthands.js +130 -0
  264. package/dist/look/shorthands.js.map +1 -0
  265. package/dist/look/tokens.d.ts +38 -0
  266. package/dist/look/tokens.d.ts.map +1 -0
  267. package/dist/look/tokens.js +59 -0
  268. package/dist/look/tokens.js.map +1 -0
  269. package/dist/look/units.d.ts +24 -0
  270. package/dist/look/units.d.ts.map +1 -0
  271. package/dist/look/units.js +33 -0
  272. package/dist/look/units.js.map +1 -0
  273. package/dist/look.d.ts +32 -227
  274. package/dist/look.d.ts.map +1 -1
  275. package/dist/look.js +28 -933
  276. package/dist/look.js.map +1 -1
  277. package/dist/module-roster.d.ts +16 -0
  278. package/dist/module-roster.d.ts.map +1 -0
  279. package/dist/module-roster.js +28 -0
  280. package/dist/module-roster.js.map +1 -0
  281. package/dist/modules/app.d.ts +9 -0
  282. package/dist/modules/app.d.ts.map +1 -0
  283. package/dist/modules/app.js +20 -0
  284. package/dist/modules/app.js.map +1 -0
  285. package/dist/modules/browser-test.d.ts +9 -0
  286. package/dist/modules/browser-test.d.ts.map +1 -0
  287. package/dist/modules/browser-test.js +67 -0
  288. package/dist/modules/browser-test.js.map +1 -0
  289. package/dist/modules/browser.d.ts +10 -0
  290. package/dist/modules/browser.d.ts.map +1 -0
  291. package/dist/modules/browser.js +89 -0
  292. package/dist/modules/browser.js.map +1 -0
  293. package/dist/modules/config.d.ts +9 -0
  294. package/dist/modules/config.d.ts.map +1 -0
  295. package/dist/modules/config.js +14 -0
  296. package/dist/modules/config.js.map +1 -0
  297. package/dist/modules/files.d.ts +9 -0
  298. package/dist/modules/files.d.ts.map +1 -0
  299. package/dist/modules/files.js +16 -0
  300. package/dist/modules/files.js.map +1 -0
  301. package/dist/modules/forms.d.ts +9 -0
  302. package/dist/modules/forms.d.ts.map +1 -0
  303. package/dist/modules/forms.js +26 -0
  304. package/dist/modules/forms.js.map +1 -0
  305. package/dist/modules/http.d.ts +9 -0
  306. package/dist/modules/http.d.ts.map +1 -0
  307. package/dist/modules/http.js +127 -0
  308. package/dist/modules/http.js.map +1 -0
  309. package/dist/modules/look.d.ts +9 -0
  310. package/dist/modules/look.d.ts.map +1 -0
  311. package/dist/modules/look.js +58 -0
  312. package/dist/modules/look.js.map +1 -0
  313. package/dist/modules/realtime.d.ts +9 -0
  314. package/dist/modules/realtime.d.ts.map +1 -0
  315. package/dist/modules/realtime.js +163 -0
  316. package/dist/modules/realtime.js.map +1 -0
  317. package/dist/modules/storage.d.ts +9 -0
  318. package/dist/modules/storage.d.ts.map +1 -0
  319. package/dist/modules/storage.js +59 -0
  320. package/dist/modules/storage.js.map +1 -0
  321. package/dist/modules/types.d.ts +78 -0
  322. package/dist/modules/types.d.ts.map +1 -0
  323. package/dist/modules/types.js +154 -0
  324. package/dist/modules/types.js.map +1 -0
  325. package/dist/modules/web.d.ts +9 -0
  326. package/dist/modules/web.d.ts.map +1 -0
  327. package/dist/modules/web.js +63 -0
  328. package/dist/modules/web.js.map +1 -0
  329. package/dist/modules/websocket.d.ts +11 -0
  330. package/dist/modules/websocket.d.ts.map +1 -0
  331. package/dist/modules/websocket.js +75 -0
  332. package/dist/modules/websocket.js.map +1 -0
  333. package/dist/parser/expressions/jsx.d.ts +17 -0
  334. package/dist/parser/expressions/jsx.d.ts.map +1 -0
  335. package/dist/parser/expressions/jsx.js +43 -0
  336. package/dist/parser/expressions/jsx.js.map +1 -0
  337. package/dist/parser/expressions/keyframes.d.ts +15 -0
  338. package/dist/parser/expressions/keyframes.d.ts.map +1 -0
  339. package/dist/parser/expressions/keyframes.js +33 -0
  340. package/dist/parser/expressions/keyframes.js.map +1 -0
  341. package/dist/parser/expressions/look.d.ts +16 -0
  342. package/dist/parser/expressions/look.d.ts.map +1 -0
  343. package/dist/parser/expressions/look.js +37 -0
  344. package/dist/parser/expressions/look.js.map +1 -0
  345. package/dist/parser/expressions/visual-block.d.ts +17 -0
  346. package/dist/parser/expressions/visual-block.d.ts.map +1 -0
  347. package/dist/parser/expressions/visual-block.js +21 -0
  348. package/dist/parser/expressions/visual-block.js.map +1 -0
  349. package/dist/parser/keyframes-source.d.ts +24 -0
  350. package/dist/parser/keyframes-source.d.ts.map +1 -0
  351. package/dist/parser/keyframes-source.js +133 -0
  352. package/dist/parser/keyframes-source.js.map +1 -0
  353. package/dist/parser/look-source.d.ts +25 -0
  354. package/dist/parser/look-source.d.ts.map +1 -0
  355. package/dist/parser/look-source.js +189 -0
  356. package/dist/parser/look-source.js.map +1 -0
  357. package/dist/parser/spans.d.ts +24 -0
  358. package/dist/parser/spans.d.ts.map +1 -0
  359. package/dist/parser/spans.js +113 -0
  360. package/dist/parser/spans.js.map +1 -0
  361. package/dist/parser/statements/components.d.ts +37 -0
  362. package/dist/parser/statements/components.d.ts.map +1 -0
  363. package/dist/parser/statements/components.js +185 -0
  364. package/dist/parser/statements/components.js.map +1 -0
  365. package/dist/parser/statements/heads.d.ts +38 -0
  366. package/dist/parser/statements/heads.d.ts.map +1 -0
  367. package/dist/parser/statements/heads.js +55 -0
  368. package/dist/parser/statements/heads.js.map +1 -0
  369. package/dist/parser/statements/imports.d.ts +9 -0
  370. package/dist/parser/statements/imports.d.ts.map +1 -0
  371. package/dist/parser/statements/imports.js +31 -0
  372. package/dist/parser/statements/imports.js.map +1 -0
  373. package/dist/parser/statements/reactive.d.ts +31 -0
  374. package/dist/parser/statements/reactive.d.ts.map +1 -0
  375. package/dist/parser/statements/reactive.js +68 -0
  376. package/dist/parser/statements/reactive.js.map +1 -0
  377. package/dist/parser/statements/unsafe-css.d.ts +21 -0
  378. package/dist/parser/statements/unsafe-css.d.ts.map +1 -0
  379. package/dist/parser/statements/unsafe-css.js +42 -0
  380. package/dist/parser/statements/unsafe-css.js.map +1 -0
  381. package/dist/parser.d.ts +37 -50
  382. package/dist/parser.d.ts.map +1 -1
  383. package/dist/parser.js +98 -882
  384. package/dist/parser.js.map +1 -1
  385. package/package.json +2 -2
@@ -0,0 +1,99 @@
1
+ /**
2
+ * What a Web declaration means and what analyzing one does: the types a
3
+ * `component` and an `action` publish, the four reactive declarations
4
+ * (`state`, `computed`, `resource`, `action`), the module-level `import css
5
+ * unsafe`, the scope prescan's answer, and the demotion an imported derived
6
+ * name receives.
7
+ *
8
+ * D115 P4 R3c. Every one of these is reached from the analyzer's statement
9
+ * seams, which stay on the root as the dispatch over statement kinds; the arms
10
+ * themselves live here. `analyzeComponent` calls the same four declaration
11
+ * analyzers from a component body, which is why they are a module both the root
12
+ * and `components/` can call and why the import runs one way only:
13
+ * `components/` reads this module, and this module never reads `components/`.
14
+ */
15
+ import { type Diagnostic, type Span } from "@velarscript/compiler";
16
+ import { type Expression, type Statement, type TypeReference, type ValueType } from "@velarscript/compiler/extension";
17
+ import { type WebActionDeclaration as ActionDeclaration, type WebComponentDeclaration as ComponentDeclaration, type WebComputedDeclaration as ComputedDeclaration, type WebResourceDeclaration as ResourceDeclaration, type WebStateDeclaration as StateDeclaration, type WebUnsafeCssDeclaration as UnsafeCssDeclaration } from "../ast.ts";
18
+ import { type KeyedRebuildHost } from "./keyed-rebuild.ts";
19
+ /**
20
+ * What the declaration analyzers ask of the analyzer that hosts them: the four
21
+ * span tables a declaration records itself in, the module's unsafe-CSS and
22
+ * resource inputs, and the base-analyzer operations declaring a name performs.
23
+ *
24
+ * It extends `KeyedRebuildHost` because a `computed` declaration is one of the
25
+ * two places a keyed-list rebuild is recorded, so analyzing a declaration
26
+ * really does need everything that advisory needs.
27
+ */
28
+ export interface DeclarationAnalysisHost extends KeyedRebuildHost {
29
+ /** D71 rule 182: the declaration spans of every `computed` binding in scope. */
30
+ readonly computedBindingSpans: Set<string>;
31
+ /** Local names bound to an imported `export computed`, from the Web interface. */
32
+ readonly importedComputedNames: ReadonlySet<string>;
33
+ /** The resolved spans of those imports, so a local shadow of the name is not one. */
34
+ readonly importedComputedSpans: Set<string>;
35
+ /** The project resources this compile read, which is where an external unsafe stylesheet's text comes from. */
36
+ readonly resources: ReadonlyMap<string, string>;
37
+ /** D114 W: the declaration spans of every `resource` in scope. */
38
+ readonly resourceBindingSpans: Set<string>;
39
+ /** Each external stylesheet already given an order position, which is how a second import of one is recognised. */
40
+ readonly unsafeCssImports: Set<string>;
41
+ /** How many synchronous reactive bodies enclose the expression being inferred; a `computed` initializer is one. */
42
+ synchronousReactiveDepth: number;
43
+ readonly diagnostics: Diagnostic[];
44
+ analyzeFunctionDeclaration(statement: ActionDeclaration, className: null, method: boolean, declareSelf: boolean, forceAsynchronous: boolean, declarationKind: string): void;
45
+ declareBinding(name: string, mutable: boolean, type: ValueType, declarationSpan: Span): void;
46
+ inferExpression(expression: Expression, contextualType?: ValueType): ValueType;
47
+ inferredFunctionResult(statement: ActionDeclaration): ValueType;
48
+ isTopLevelScope(): boolean;
49
+ markDeclaredBindingReactive(name: string, kind: "state" | "prop"): void;
50
+ requireAssignable(actual: ValueType, expected: ValueType, valueSpan: Span): void;
51
+ requireSettledCollectionElement(initializer: Expression, declared: ValueType, annotated: boolean): void;
52
+ resolveAnnotation(reference: TypeReference | null): ValueType;
53
+ resolveValidatedAnnotation(reference: TypeReference | null): ValueType;
54
+ resolvedAsyncResult(type: ValueType): ValueType;
55
+ validateTypeReference(reference: TypeReference): boolean;
56
+ }
57
+ export declare function componentType(host: DeclarationAnalysisHost, statement: ComponentDeclaration): ValueType;
58
+ /**
59
+ * A `state` declaration, at module scope and in a component body alike: the two
60
+ * arms are the same eight lines, so they are written once here.
61
+ */
62
+ export declare function analyzeStateDeclaration(host: DeclarationAnalysisHost, statement: StateDeclaration): void;
63
+ /**
64
+ * D71 rule 182: a derived value is reactive and read-only, which is exactly
65
+ * the reactive identity a component prop already carries — a bare read lowers
66
+ * through `.get()`, and nothing may write it. Registering that identity
67
+ * rather than `state` is what keeps `bind={doubled}` and every other writable
68
+ * position refusing a derived name for free.
69
+ */
70
+ export declare function analyzeComputedDeclaration(host: DeclarationAnalysisHost, statement: ComputedDeclaration): void;
71
+ export declare function analyzeResourceDeclaration(host: DeclarationAnalysisHost, statement: ResourceDeclaration): void;
72
+ export declare function actionType(host: DeclarationAnalysisHost, statement: ActionDeclaration): ValueType;
73
+ export declare function analyzeActionDeclaration(host: DeclarationAnalysisHost, statement: ActionDeclaration): void;
74
+ /**
75
+ * LOK-D2 / D53: unsafe CSS is a module-level ordering declaration, whether its
76
+ * source is an external resource or an inline raw block. Nested inside a
77
+ * component or a function it used to pass every check, build, and then appear
78
+ * in no output at all.
79
+ */
80
+ export declare function analyzeUnsafeCssDeclaration(host: DeclarationAnalysisHost, statement: UnsafeCssDeclaration): void;
81
+ /** The three Web declarations a scope prescan has to see, so a later shadow of one is recognised. */
82
+ export declare function webScopeDeclaration(statement: Statement): {
83
+ readonly name: string;
84
+ readonly span: Span;
85
+ } | null;
86
+ /**
87
+ * D71 rule 184: a cross-module `computed` travels through `reactiveExports`
88
+ * so its bare read lowers through `.get()` like an exported `state` — but it
89
+ * is not writable, and the imported binding must not inherit the writable
90
+ * identity that carries `bind={...}` and `event => name = ...`. The Web
91
+ * extension publishes which exported names are derived, so the import is
92
+ * demoted to the read-only reactive identity here.
93
+ *
94
+ * `markCore` is the base analyzer's own registration, which only the class can
95
+ * reach: this rule decides which identity the name receives and then hands the
96
+ * decision back.
97
+ */
98
+ export declare function markWebBindingReactive(host: DeclarationAnalysisHost, name: string, kind: "state" | "prop", markCore: (name: string, kind: "state" | "prop") => void): void;
99
+ //# sourceMappingURL=declarations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../../src/analysis/declarations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAUL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,oBAAoB,IAAI,iBAAiB,EAC9C,KAAK,uBAAuB,IAAI,oBAAoB,EACpD,KAAK,sBAAsB,IAAI,mBAAmB,EAClD,KAAK,sBAAsB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KG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,uBAAuB,EAAE,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAkBhH;AAED,qGAAqG;AACrG,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG,IAAI,CAM/G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,uBAAuB,EAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,GAAG,MAAM,EACtB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,GACvD,IAAI,CAWN"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * What a Web declaration means and what analyzing one does: the types a
3
+ * `component` and an `action` publish, the four reactive declarations
4
+ * (`state`, `computed`, `resource`, `action`), the module-level `import css
5
+ * unsafe`, the scope prescan's answer, and the demotion an imported derived
6
+ * name receives.
7
+ *
8
+ * D115 P4 R3c. Every one of these is reached from the analyzer's statement
9
+ * seams, which stay on the root as the dispatch over statement kinds; the arms
10
+ * themselves live here. `analyzeComponent` calls the same four declaration
11
+ * analyzers from a component body, which is why they are a module both the root
12
+ * and `components/` can call and why the import runs one way only:
13
+ * `components/` reads this module, and this module never reads `components/`.
14
+ */
15
+ import {} from "@velarscript/compiler";
16
+ import { anyType, boolType, describeType, isInvalidType, nullType, optionalOf, spanIdentity, stringType, unknownType, } from "@velarscript/compiler/extension";
17
+ import { isWebStatement, } from "../ast.js";
18
+ import { webComponentConstructor } from "../types.js";
19
+ import { recordDerivedKeyedListRebuild } from "./keyed-rebuild.js";
20
+ import { containsCssImport, firstRelativeCssAssetAddress } from "./look-sites.js";
21
+ import { diagnostic } from "./web-types.js";
22
+ export function componentType(host, statement) {
23
+ const props = new Map(statement.parameters.map((parameter) => [parameter.name, host.resolveValidatedAnnotation(parameter.type)]));
24
+ if (!props.has("class"))
25
+ props.set("class", optionalOf(stringType));
26
+ if (!props.has("look"))
27
+ props.set("look", optionalOf({ kind: "named", name: "Look" }));
28
+ return webComponentConstructor(statement.name, props, new Set(statement.parameters.filter((parameter) => !parameter.defaultValue).map((parameter) => parameter.name)), statement.handleType ? host.resolveValidatedAnnotation(statement.handleType) : null);
29
+ }
30
+ /**
31
+ * A `state` declaration, at module scope and in a component body alike: the two
32
+ * arms are the same eight lines, so they are written once here.
33
+ */
34
+ export function analyzeStateDeclaration(host, statement) {
35
+ const annotationValid = statement.type ? host.validateTypeReference(statement.type) : true;
36
+ const annotationContext = statement.type ? host.resolveValidatedAnnotation(statement.type) : null;
37
+ const actual = host.inferExpression(statement.initializer, annotationContext ?? unknownType);
38
+ const declared = annotationContext ?? actual;
39
+ if (annotationValid)
40
+ host.requireAssignable(actual, declared, statement.initializer.span);
41
+ host.requireSettledCollectionElement(statement.initializer, declared, annotationContext !== null);
42
+ host.declareBinding(statement.name, true, declared, statement.span);
43
+ host.markDeclaredBindingReactive(statement.name, "state");
44
+ }
45
+ /**
46
+ * D71 rule 182: a derived value is reactive and read-only, which is exactly
47
+ * the reactive identity a component prop already carries — a bare read lowers
48
+ * through `.get()`, and nothing may write it. Registering that identity
49
+ * rather than `state` is what keeps `bind={doubled}` and every other writable
50
+ * position refusing a derived name for free.
51
+ */
52
+ export function analyzeComputedDeclaration(host, statement) {
53
+ const annotationValid = statement.type ? host.validateTypeReference(statement.type) : true;
54
+ const annotationContext = statement.type ? host.resolveValidatedAnnotation(statement.type) : null;
55
+ // The initializer re-runs on every dependency change, so it is a deferred
56
+ // read for the module-initialization-cycle classification, exactly like a
57
+ // watch subject.
58
+ host.synchronousReactiveDepth += 1;
59
+ const actual = host.inferExpression(statement.initializer, annotationContext ?? unknownType);
60
+ host.synchronousReactiveDepth -= 1;
61
+ const declared = annotationContext ?? actual;
62
+ if (annotationValid)
63
+ host.requireAssignable(actual, declared, statement.initializer.span);
64
+ host.declareBinding(statement.name, false, declared, statement.span);
65
+ host.markDeclaredBindingReactive(statement.name, "prop");
66
+ host.computedBindingSpans.add(spanIdentity(statement.span));
67
+ recordDerivedKeyedListRebuild(host, statement);
68
+ }
69
+ export function analyzeResourceDeclaration(host, statement) {
70
+ const annotated = statement.type ? host.resolveAnnotation(statement.type) : null;
71
+ const annotationValid = statement.type ? host.validateTypeReference(statement.type) : true;
72
+ const annotationContext = statement.type ? host.resolveValidatedAnnotation(statement.type) : null;
73
+ const expected = annotationContext ? { kind: "promise", value: annotationContext } : unknownType;
74
+ const actual = host.inferExpression(statement.initializer, expected);
75
+ let value = annotationContext ?? unknownType;
76
+ if (actual.kind === "promise") {
77
+ if (annotated && annotationValid)
78
+ host.requireAssignable(actual.value, annotated, statement.initializer.span);
79
+ else if (!statement.type)
80
+ value = actual.value;
81
+ }
82
+ else if (actual.kind === "any") {
83
+ value = annotationContext ?? anyType;
84
+ }
85
+ else if (!isInvalidType(actual)) {
86
+ host.diagnostics.push(diagnostic("VEL4016", `A resource initializer must return Promise<T>, received ${describeType(actual)}`, statement.initializer.span));
87
+ }
88
+ const fields = new Map([
89
+ ["value", value.kind === "null" ? nullType : optionalOf(value)],
90
+ ["loading", boolType],
91
+ ["ready", boolType],
92
+ ["error", optionalOf({ kind: "class", name: "Error" })],
93
+ ["reload", { kind: "function", parameters: [], requiredParameters: 0, result: { kind: "promise", value: nullType } }],
94
+ ]);
95
+ host.declareBinding(statement.name, false, { kind: "object", fields }, statement.span);
96
+ host.resourceBindingSpans.add(spanIdentity(statement.span));
97
+ }
98
+ export function actionType(host, statement) {
99
+ const declaredResult = host.resolvedAsyncResult(host.inferredFunctionResult(statement));
100
+ const rest = statement.parameters.find((parameter) => parameter.rest);
101
+ return {
102
+ kind: "action",
103
+ parameters: statement.parameters.filter((parameter) => !parameter.rest).map((parameter) => host.resolveValidatedAnnotation(parameter.type)),
104
+ parameterNames: statement.parameters.filter((parameter) => !parameter.rest).map((parameter) => parameter.name),
105
+ requiredParameters: statement.parameters.filter((parameter) => !parameter.rest && !parameter.defaultValue).length,
106
+ ...(rest ? { rest: host.resolveValidatedAnnotation(rest.type) } : {}),
107
+ result: { kind: "promise", value: declaredResult },
108
+ };
109
+ }
110
+ export function analyzeActionDeclaration(host, statement) {
111
+ host.declareBinding(statement.name, false, actionType(host, statement), statement.span);
112
+ host.analyzeFunctionDeclaration(statement, null, true, false, true, "Action");
113
+ }
114
+ /**
115
+ * LOK-D2 / D53: unsafe CSS is a module-level ordering declaration, whether its
116
+ * source is an external resource or an inline raw block. Nested inside a
117
+ * component or a function it used to pass every check, build, and then appear
118
+ * in no output at all.
119
+ */
120
+ export function analyzeUnsafeCssDeclaration(host, statement) {
121
+ if (!host.isTopLevelScope()) {
122
+ host.diagnostics.push(diagnostic("VEL5037", "Unsafe CSS is module-level; move the declaration to the top of the module so its order against Look stays visible", statement.span));
123
+ return;
124
+ }
125
+ if (statement.source.kind === "external" && host.unsafeCssImports.has(statement.source.path)) {
126
+ host.diagnostics.push(diagnostic("VEL5037", `Unsafe CSS '${statement.source.path}' is imported more than once; each stylesheet must have one explicit order position`, statement.span));
127
+ }
128
+ if (statement.source.kind === "external")
129
+ host.unsafeCssImports.add(statement.source.path);
130
+ const source = statement.source.kind === "inline" ? statement.source.css : host.resources.get(statement.source.path);
131
+ const subject = statement.source.kind === "inline" ? "Inline unsafe CSS" : `Unsafe CSS '${statement.source.path}'`;
132
+ if (source && containsCssImport(source)) {
133
+ host.diagnostics.push(diagnostic("VEL5037", `${subject} contains @import; declare every stylesheet with 'import css unsafe' so project order remains visible`, statement.source.span));
134
+ }
135
+ if (source) {
136
+ const relativeAddress = firstRelativeCssAssetAddress(source);
137
+ if (relativeAddress)
138
+ host.diagnostics.push(diagnostic("VEL5037", `${subject} uses relative asset address ${relativeAddress.syntax}(${JSON.stringify(relativeAddress.value)}); use a project-public /path, data URL, fragment, or absolute URL so extracted asset ownership stays explicit`, statement.source.span));
139
+ }
140
+ }
141
+ /** The three Web declarations a scope prescan has to see, so a later shadow of one is recognised. */
142
+ export function webScopeDeclaration(statement) {
143
+ if (!isWebStatement(statement))
144
+ return null;
145
+ return statement.kind === "ExtensionStatement:web:state" || statement.kind === "ExtensionStatement:web:computed"
146
+ || statement.kind === "ExtensionStatement:web:resource"
147
+ ? { name: statement.name, span: statement.span }
148
+ : null;
149
+ }
150
+ /**
151
+ * D71 rule 184: a cross-module `computed` travels through `reactiveExports`
152
+ * so its bare read lowers through `.get()` like an exported `state` — but it
153
+ * is not writable, and the imported binding must not inherit the writable
154
+ * identity that carries `bind={...}` and `event => name = ...`. The Web
155
+ * extension publishes which exported names are derived, so the import is
156
+ * demoted to the read-only reactive identity here.
157
+ *
158
+ * `markCore` is the base analyzer's own registration, which only the class can
159
+ * reach: this rule decides which identity the name receives and then hands the
160
+ * decision back.
161
+ */
162
+ export function markWebBindingReactive(host, name, kind, markCore) {
163
+ // Only the import itself is demoted. A local `state` of the same name in a
164
+ // component or a block is a shadow that really is writable, and demoting it
165
+ // would compile its assignment as a plain store into the handle.
166
+ const imported = kind === "state" && host.isTopLevelScope() && host.importedComputedNames.has(name);
167
+ markCore(name, imported ? "prop" : kind);
168
+ if (!imported)
169
+ return;
170
+ const binding = host.lookup(name);
171
+ if (!binding)
172
+ return;
173
+ host.computedBindingSpans.add(spanIdentity(binding.span));
174
+ host.importedComputedSpans.add(spanIdentity(binding.span));
175
+ }
176
+ //# sourceMappingURL=declarations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarations.js","sourceRoot":"","sources":["../../src/analysis/declarations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAA8B,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACL,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,GAKZ,MAAM,iCAAiC,CAAC;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AAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,SAAS,CAAC,IAAI,KAAK,8BAA8B,IAAI,SAAS,CAAC,IAAI,KAAK,iCAAiC;WAC3G,SAAS,CAAC,IAAI,KAAK,iCAAiC;QACvD,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE;QAChD,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAA6B,EAC7B,IAAY,EACZ,IAAsB,EACtB,QAAwD;IAExD,2EAA2E;IAC3E,4EAA4E;IAC5E,iEAAiE;IACjE,MAAM,QAAQ,GAAG,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,eAAe,EAAE,IAAI,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpG,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC,QAAQ;QAAE,OAAO;IACtB,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * What the Web extension adds to expression inference, either side of the core
3
+ * walk: the shapes it refuses before the core sees them, the answers it has
4
+ * already computed and hands back instead of walking again, the Look length a
5
+ * builder call folds to, and the two reports a call earns once its type is
6
+ * known. The extension's own call and type-syntax rules — a component element
7
+ * called like a function, and `Component<Props, Handle>` — are here too.
8
+ *
9
+ * D115 P4 R3c. The dispatch itself stays on the analyzer: `inferExpression` and
10
+ * `inferExtensionExpression` are seams the core owns, and what they hand to the
11
+ * JSX, keyframes and Look walks is the one thing that is genuinely a dispatch.
12
+ * Everything on either side of it is a rule, and rules live here.
13
+ */
14
+ import { type Span } from "@velarscript/compiler";
15
+ import { type Expression, type ExtensionValueType, type TypeReference, type TypeSyntax, type ValueType } from "@velarscript/compiler/extension";
16
+ import { type LookAnalysisHost } from "./look/host.ts";
17
+ import { type ReactiveNamesHost } from "./reactivity/host.ts";
18
+ import { type RetiredAccessorHost } from "./reactivity/retired-accessors.ts";
19
+ /** The state the inference rules own: the probe cache, and the two module inputs a call is proved against. */
20
+ export interface ExpressionInferenceHost {
21
+ /** The Look-arithmetic hints this walk records for the emitter, keyed by expression span. */
22
+ readonly extensionCalls: Map<string, string>;
23
+ /**
24
+ * Operands probed for Look arithmetic. The core analyzer re-requests one
25
+ * immediately after the probe declines, so the answer is parked here and
26
+ * consumed once — that is what keeps operand analysis single-run and operand
27
+ * diagnostics unrepeated.
28
+ */
29
+ readonly probedOperandTypes: Map<string, ValueType>;
30
+ /** The names this module declares as public configuration, from the program's own reading. Replaced per program. */
31
+ readonly publicConfigNames: ReadonlySet<string>;
32
+ /** D114 0.29.0 LC-D1: the manifest's `web.publicConfig`, or null when this compile read no project manifest. */
33
+ readonly webPublicConfig: Readonly<Record<string, unknown>> | null;
34
+ /** The module's source, which is what a component-call refusal quotes the arguments out of. */
35
+ readonly webSourceText: string;
36
+ fieldsOf(identity: string): ReadonlyMap<string, ValueType> | null;
37
+ typeError(message: string, errorSpan: Span): void;
38
+ }
39
+ /**
40
+ * The one face the inference rules read. It is an intersection because the
41
+ * rules on either side of the core walk really do reach three other groups: a
42
+ * call is checked as a Look builder call, a zero-argument call of a derived
43
+ * name is refused, and an identifier read is recorded for the D71 migration.
44
+ */
45
+ export type InferenceHost = ExpressionInferenceHost & LookAnalysisHost & ReactiveNamesHost & RetiredAccessorHost;
46
+ /**
47
+ * The Web shapes refused before the core analyzer sees the expression, in the
48
+ * order they are asked. `undefined` means nothing here claimed the expression
49
+ * and the extension dispatch continues.
50
+ */
51
+ export declare function webExpressionShapeRefusals(host: InferenceHost, expression: Expression): ValueType | undefined;
52
+ /** The two Web expressions that are a value rather than a walk: a misplaced Look hook, and a unit literal. */
53
+ export declare function webExtensionValueType(host: InferenceHost, expression: Expression): ValueType | undefined;
54
+ /**
55
+ * The answers the Web extension already holds for this expression, given back
56
+ * instead of walking it a second time. Null means the core walk should run.
57
+ */
58
+ export declare function answeredBeforeInference(host: InferenceHost, expression: Expression): ValueType | null;
59
+ /** The compile-time Look length a builder call folds to, or null when the call is not one. */
60
+ export declare function foldedWebLength(host: InferenceHost, expression: Expression): ValueType | null;
61
+ /** Infers one builder slot and parks the answer in the probe cache, so the call's own analysis reads it back. */
62
+ export declare function probedSlotType(host: InferenceHost, argument: Expression): ValueType;
63
+ /** The two reports a call earns once the core walk has answered its type. */
64
+ export declare function reportInferredWebCall(host: InferenceHost, expression: Expression, result: ValueType): void;
65
+ export declare function inferWebExtensionCall(host: InferenceHost, callee: ExtensionValueType, arguments_: readonly Expression[], argumentNames: readonly (string | null)[] | undefined, callSpan: Span): ValueType | undefined;
66
+ export declare function validateWebExtensionTypeSyntax(host: InferenceHost, syntax: TypeSyntax, validate: (syntax: TypeSyntax) => boolean, resolve: (reference: TypeReference) => ValueType): boolean | undefined;
67
+ //# sourceMappingURL=inference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../src/analysis/inference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,iCAAiC,CAAC;AAMzC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aAAa,EAAE,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI,CAwBrG;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI,CAG7F;AAED,iHAAiH;AACjH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,GAAG,SAAS,CAInF;AAED,6EAA6E;AAC7E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAO1G;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,SAAS,UAAU,EAAE,EACjC,aAAa,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,EACrD,QAAQ,EAAE,IAAI,GACb,SAAS,GAAG,SAAS,CAKvB;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,EACzC,OAAO,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,SAAS,GAC/C,OAAO,GAAG,SAAS,CA8CrB"}
@@ -0,0 +1,236 @@
1
+ /**
2
+ * What the Web extension adds to expression inference, either side of the core
3
+ * walk: the shapes it refuses before the core sees them, the answers it has
4
+ * already computed and hands back instead of walking again, the Look length a
5
+ * builder call folds to, and the two reports a call earns once its type is
6
+ * known. The extension's own call and type-syntax rules — a component element
7
+ * called like a function, and `Component<Props, Handle>` — are here too.
8
+ *
9
+ * D115 P4 R3c. The dispatch itself stays on the analyzer: `inferExpression` and
10
+ * `inferExtensionExpression` are seams the core owns, and what they hand to the
11
+ * JSX, keyframes and Look walks is the one thing that is genuinely a dispatch.
12
+ * Everything on either side of it is a rule, and rules live here.
13
+ */
14
+ import {} from "@velarscript/compiler";
15
+ import { boolType, describeType, expressionContainsDirectAwait, invalidType, spanIdentity, unknownType, } from "@velarscript/compiler/extension";
16
+ import { isWebExpression, isWebJsx, isWebUnit } from "../ast.js";
17
+ import { LOOK_ARITHMETIC_HINT, LOOK_UNIT_TYPES } from "../look.js";
18
+ import { isWebComponentType, isWebNodeType, webComponentName, webNodeType } from "../types.js";
19
+ import { componentCallRefusal } from "./component-guidance.js";
20
+ import { checkLookBuilderCall } from "./look/builders.js";
21
+ import {} from "./look/host.js";
22
+ import { foldedLengthPercentage, isLookNumericType } from "./look-values.js";
23
+ import { lookJoin, lookLiteralZero } from "./look-sites.js";
24
+ import { lookSourceOf } from "./media-conditions.js";
25
+ import { publicConfigDiagnostic } from "./public-config.js";
26
+ import { calledComputedBinding } from "./reactivity/derived.js";
27
+ import {} from "./reactivity/host.js";
28
+ import { recordRetiredAccessorRead, RETIRED_ACCESSOR_TYPE } from "./reactivity/retired-accessors.js";
29
+ import { diagnostic, webEventDeadFields, webEventTypeNames } from "./web-types.js";
30
+ /**
31
+ * The Web shapes refused before the core analyzer sees the expression, in the
32
+ * order they are asked. `undefined` means nothing here claimed the expression
33
+ * and the extension dispatch continues.
34
+ */
35
+ export function webExpressionShapeRefusals(host, expression) {
36
+ if (expression.kind === "CallExpression" && expression.callee.kind === "IdentifierExpression"
37
+ && expression.callee.name === "mount") {
38
+ const namedNode = expression.argumentNames?.findIndex((name) => name === "node") ?? -1;
39
+ const node = expression.arguments[namedNode >= 0 ? namedNode : 0];
40
+ if (node && expressionContainsDirectAwait(node, (value) => value.kind === "ExtensionExpression:web:jsx" ? false : undefined)) {
41
+ host.diagnostics.push(diagnostic("VEL4007", "mount constructs its root synchronously; await the root in a separate module binding before calling mount", node.span));
42
+ }
43
+ }
44
+ if (expression.kind === "UnaryExpression" && (expression.operator === "+" || expression.operator === "-")) {
45
+ const operand = host.inferExpression(expression.operand);
46
+ if (isLookNumericType(operand)) {
47
+ host.extensionCalls.set(spanIdentity(expression.span), LOOK_ARITHMETIC_HINT);
48
+ return operand;
49
+ }
50
+ host.probedOperandTypes.set(spanIdentity(expression.operand.span), operand);
51
+ }
52
+ // WEB-U15 / GRM-A3: '&&' rendering is the React habit. The lexer now starts
53
+ // JSX after 'and'/'or' so the shape parses and this rejection names the
54
+ // conditional-rendering spelling instead of leaking a bool type error.
55
+ if (expression.kind === "BinaryExpression" && (expression.operator === "and" || expression.operator === "or")
56
+ && (isWebJsx(expression.left) || isWebJsx(expression.right))) {
57
+ const rightIsElement = isWebJsx(expression.right);
58
+ const tag = rightIsElement ? expression.right.tag : isWebJsx(expression.left) ? expression.left.tag : "";
59
+ const condition = lookSourceOf(rightIsElement ? expression.left : expression.right);
60
+ host.inferExpression(expression.left);
61
+ host.inferExpression(expression.right);
62
+ host.diagnostics.push(diagnostic("VEL5029", `'${expression.operator}' combines bool values and cannot yield an element; render conditionally with '{${condition} ? <${tag || ">"} ... : null}'`, expression.span));
63
+ return invalidType;
64
+ }
65
+ if (expression.kind === "BinaryExpression" && ["+", "-", "*", "/"].includes(expression.operator)) {
66
+ const left = host.inferExpression(expression.left);
67
+ const right = host.inferExpression(expression.right);
68
+ if (!isLookNumericType(left) && !isLookNumericType(right)) {
69
+ host.probedOperandTypes.set(spanIdentity(expression.left.span), left);
70
+ host.probedOperandTypes.set(spanIdentity(expression.right.span), right);
71
+ }
72
+ else {
73
+ const additive = expression.operator === "+" || expression.operator === "-" ? lookJoin(left, right) : null;
74
+ const result = additive
75
+ ?? ((expression.operator === "*" || expression.operator === "/") && isLookNumericType(left) && right.kind === "number" ? left : null)
76
+ ?? (expression.operator === "*" && left.kind === "number" && isLookNumericType(right) ? right : null);
77
+ if (result) {
78
+ // LOK-U8: dividing a visual value by a literal zero produces a
79
+ // non-finite length that the runtime rejects on first construction.
80
+ if (expression.operator === "/" && lookLiteralZero(expression.right)) {
81
+ host.diagnostics.push(diagnostic("VEL5042", "Look unit arithmetic cannot divide by zero", expression.span));
82
+ return invalidType;
83
+ }
84
+ host.extensionCalls.set(spanIdentity(expression.span), LOOK_ARITHMETIC_HINT);
85
+ return result;
86
+ }
87
+ // The rejection is final: returning the invalid type keeps the Look
88
+ // property's own assignment error from co-reporting a union dump on the
89
+ // very expression that was already named (LOK-I1).
90
+ host.diagnostics.push(diagnostic("VEL5042", `Look unit arithmetic cannot apply '${expression.operator}' to ${describeType(left)} and ${describeType(right)}`, expression.span));
91
+ return invalidType;
92
+ }
93
+ }
94
+ // WEB-N2 / D47 rule 84: the event object is typed down to event semantics
95
+ // and deliberately carries no target, so `event.target.value` is a dead end
96
+ // that used to cascade into three unknown-access errors. The read is where
97
+ // the author wanted two-way binding, so it names that spelling and stops.
98
+ if (expression.kind === "MemberExpression" && !expression.optional && webEventDeadFields.has(expression.property)
99
+ && expression.object.kind === "IdentifierExpression") {
100
+ const binding = host.lookup(expression.object.name);
101
+ const expanded = binding ? host.expandAliases(binding.type) : null;
102
+ if (expanded?.kind === "named" && webEventTypeNames.has(expanded.name)) {
103
+ host.diagnostics.push(diagnostic("VEL5019", `A VelarScript event object carries typed event fields only and has no '${expression.property}': read the element's value through a two-way binding instead — 'bind:value={name}' binds a state name, and 'bind:value={form.field}' or 'bind:value={items[0]}' binds a writable path inside state`, expression.span));
104
+ return invalidType;
105
+ }
106
+ }
107
+ return undefined;
108
+ }
109
+ /** The two Web expressions that are a value rather than a walk: a misplaced Look hook, and a unit literal. */
110
+ export function webExtensionValueType(host, expression) {
111
+ if (isWebExpression(expression) && expression.kind === "ExtensionExpression:web:look-hook") {
112
+ host.diagnostics.push(diagnostic("VEL5038", `Look hook '@${expression.name}' is only valid inside a Look condition`, expression.span));
113
+ return boolType;
114
+ }
115
+ if (isWebUnit(expression)) {
116
+ const type = LOOK_UNIT_TYPES.get(expression.unit);
117
+ if (type)
118
+ return { kind: "named", name: type };
119
+ return unknownType;
120
+ }
121
+ return undefined;
122
+ }
123
+ /**
124
+ * The answers the Web extension already holds for this expression, given back
125
+ * instead of walking it a second time. Null means the core walk should run.
126
+ */
127
+ export function answeredBeforeInference(host, expression) {
128
+ // Operands probed for Look arithmetic are re-requested by the core analyzer immediately after the
129
+ // probe declines; reusing the probe result (consume-once) keeps operand analysis single-run so
130
+ // operand diagnostics are not reported twice.
131
+ const key = spanIdentity(expression.span);
132
+ const probed = host.probedOperandTypes.get(key);
133
+ if (probed !== undefined) {
134
+ host.probedOperandTypes.delete(key);
135
+ return probed;
136
+ }
137
+ if (expression.kind === "CallExpression" && expression.arguments.length === 0
138
+ && expression.callee.kind === "IdentifierExpression") {
139
+ host.plainCallSpans.set(spanIdentity(expression.callee.span), expression.span);
140
+ const called = calledComputedBinding(host, expression);
141
+ if (called)
142
+ return called;
143
+ }
144
+ if (expression.kind === "IdentifierExpression") {
145
+ const retired = recordRetiredAccessorRead(host, expression);
146
+ // The retired name is answered here rather than left to fall through as an
147
+ // unknown one: the author gets its migration and nothing else, and the
148
+ // call around it still type-checks against the signature it always had.
149
+ if (retired)
150
+ return RETIRED_ACCESSOR_TYPE;
151
+ }
152
+ return null;
153
+ }
154
+ /** The compile-time Look length a builder call folds to, or null when the call is not one. */
155
+ export function foldedWebLength(host, expression) {
156
+ return expression.kind !== "CallExpression" ? null
157
+ : foldedLengthPercentage(expression, (name) => host.lookBuilderNames.get(name), (argument) => probedSlotType(host, argument), lookJoin);
158
+ }
159
+ /** Infers one builder slot and parks the answer in the probe cache, so the call's own analysis reads it back. */
160
+ export function probedSlotType(host, argument) {
161
+ const inferred = host.inferExpression(argument);
162
+ host.probedOperandTypes.set(spanIdentity(argument.span), inferred);
163
+ return host.expandAliases(inferred);
164
+ }
165
+ /** The two reports a call earns once the core walk has answered its type. */
166
+ export function reportInferredWebCall(host, expression, result) {
167
+ if (expression.kind !== "CallExpression")
168
+ return;
169
+ checkLookBuilderCall(host, expression);
170
+ // D114 0.29.0 LC-D1: the manifest this build bakes in, proved against the declared type.
171
+ const report = publicConfigDiagnostic(expression, result, host.publicConfigNames, host.webPublicConfig, { expandAliases: (type) => host.expandAliases(type), fieldsOf: (identity) => host.fieldsOf(identity), describeType });
172
+ if (report)
173
+ host.diagnostics.push(report);
174
+ }
175
+ export function inferWebExtensionCall(host, callee, arguments_, argumentNames, callSpan) {
176
+ if (!isWebComponentType(callee))
177
+ return undefined;
178
+ host.typeError(componentCallRefusal(webComponentName(callee), arguments_, argumentNames, host.webSourceText), callSpan);
179
+ for (const argument of arguments_)
180
+ host.inferExpression(argument);
181
+ return webNodeType;
182
+ }
183
+ export function validateWebExtensionTypeSyntax(host, syntax, validate, resolve) {
184
+ if (syntax.kind !== "GenericTypeSyntax" || syntax.name !== "Component")
185
+ return undefined;
186
+ let valid = true;
187
+ if (syntax.arguments.length < 1 || syntax.arguments.length > 2) {
188
+ host.typeError("Component<Props, Handle> requires a named prop signature and at most one Handle type", syntax.span);
189
+ valid = false;
190
+ }
191
+ const argumentsValid = syntax.arguments.map(validate).every(Boolean);
192
+ const signature = syntax.arguments[0];
193
+ if (!signature)
194
+ return false;
195
+ if (signature.kind !== "FunctionTypeSyntax") {
196
+ host.typeError("Component<Props, Handle> requires a named function signature such as Component<(title: string) -> WebNode, DialogHandle>", signature.span);
197
+ valid = false;
198
+ }
199
+ else {
200
+ const names = new Set();
201
+ for (const parameter of signature.parameters) {
202
+ if (!parameter.name) {
203
+ host.typeError("Every Component signature prop requires a name", parameter.span);
204
+ valid = false;
205
+ }
206
+ else if (names.has(parameter.name)) {
207
+ host.typeError(`Component signature prop '${parameter.name}' is declared more than once`, parameter.span);
208
+ valid = false;
209
+ }
210
+ else
211
+ names.add(parameter.name);
212
+ if (parameter.rest) {
213
+ host.typeError("Component signatures use named props and cannot declare a rest parameter", parameter.span);
214
+ valid = false;
215
+ }
216
+ }
217
+ const result = resolve({ syntax: signature.result, span: signature.result.span });
218
+ if (!isWebNodeType(result)) {
219
+ host.typeError(`A Component signature must return WebNode, received ${describeType(result)}`, signature.result.span);
220
+ valid = false;
221
+ }
222
+ }
223
+ const handleSyntax = syntax.arguments[1];
224
+ if (handleSyntax && argumentsValid) {
225
+ const handle = host.expandAliases(resolve({ syntax: handleSyntax, span: handleSyntax.span }));
226
+ const fields = handle.kind === "object"
227
+ ? handle.fields
228
+ : handle.kind === "named" ? host.fieldsOf(handle.identity ?? handle.name) : null;
229
+ if (!fields) {
230
+ host.typeError(`A Component Handle must be a concrete record type, received ${describeType(handle)}`, handleSyntax.span);
231
+ valid = false;
232
+ }
233
+ }
234
+ return valid && argumentsValid;
235
+ }
236
+ //# sourceMappingURL=inference.js.map