@velarscript/web 0.10.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 (95) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +89 -0
  3. package/dist/analyzer.d.ts +302 -0
  4. package/dist/analyzer.d.ts.map +1 -0
  5. package/dist/analyzer.js +2931 -0
  6. package/dist/analyzer.js.map +1 -0
  7. package/dist/ast.d.ts +220 -0
  8. package/dist/ast.d.ts.map +1 -0
  9. package/dist/ast.js +102 -0
  10. package/dist/ast.js.map +1 -0
  11. package/dist/browser-test.d.ts +29 -0
  12. package/dist/browser-test.d.ts.map +1 -0
  13. package/dist/browser-test.js +33 -0
  14. package/dist/browser-test.js.map +1 -0
  15. package/dist/compiler.d.ts +9 -0
  16. package/dist/compiler.d.ts.map +1 -0
  17. package/dist/compiler.js +715 -0
  18. package/dist/compiler.js.map +1 -0
  19. package/dist/css-tokens.d.ts +46 -0
  20. package/dist/css-tokens.d.ts.map +1 -0
  21. package/dist/css-tokens.js +363 -0
  22. package/dist/css-tokens.js.map +1 -0
  23. package/dist/editor.d.ts +3 -0
  24. package/dist/editor.d.ts.map +1 -0
  25. package/dist/editor.js +147 -0
  26. package/dist/editor.js.map +1 -0
  27. package/dist/elements.d.ts +11 -0
  28. package/dist/elements.d.ts.map +1 -0
  29. package/dist/elements.js +24 -0
  30. package/dist/elements.js.map +1 -0
  31. package/dist/emitter.d.ts +79 -0
  32. package/dist/emitter.d.ts.map +1 -0
  33. package/dist/emitter.js +2699 -0
  34. package/dist/emitter.js.map +1 -0
  35. package/dist/host.d.ts +7 -0
  36. package/dist/host.d.ts.map +1 -0
  37. package/dist/host.js +224 -0
  38. package/dist/host.js.map +1 -0
  39. package/dist/index.d.ts +11 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +23 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/inspection.d.ts +3 -0
  44. package/dist/inspection.d.ts.map +1 -0
  45. package/dist/inspection.js +82 -0
  46. package/dist/inspection.js.map +1 -0
  47. package/dist/keyframes.d.ts +16 -0
  48. package/dist/keyframes.d.ts.map +1 -0
  49. package/dist/keyframes.js +29 -0
  50. package/dist/keyframes.js.map +1 -0
  51. package/dist/lexer.d.ts +85 -0
  52. package/dist/lexer.d.ts.map +1 -0
  53. package/dist/lexer.js +422 -0
  54. package/dist/lexer.js.map +1 -0
  55. package/dist/look-static.d.ts +31 -0
  56. package/dist/look-static.d.ts.map +1 -0
  57. package/dist/look-static.js +266 -0
  58. package/dist/look-static.js.map +1 -0
  59. package/dist/look.d.ts +134 -0
  60. package/dist/look.d.ts.map +1 -0
  61. package/dist/look.js +627 -0
  62. package/dist/look.js.map +1 -0
  63. package/dist/parser.d.ts +71 -0
  64. package/dist/parser.d.ts.map +1 -0
  65. package/dist/parser.js +976 -0
  66. package/dist/parser.js.map +1 -0
  67. package/dist/project-config.d.ts +33 -0
  68. package/dist/project-config.d.ts.map +1 -0
  69. package/dist/project-config.js +199 -0
  70. package/dist/project-config.js.map +1 -0
  71. package/dist/runtime-foundation.d.ts +7 -0
  72. package/dist/runtime-foundation.d.ts.map +1 -0
  73. package/dist/runtime-foundation.js +1245 -0
  74. package/dist/runtime-foundation.js.map +1 -0
  75. package/dist/runtime.d.ts +7 -0
  76. package/dist/runtime.d.ts.map +1 -0
  77. package/dist/runtime.js +3444 -0
  78. package/dist/runtime.js.map +1 -0
  79. package/dist/semantic.d.ts +3 -0
  80. package/dist/semantic.d.ts.map +1 -0
  81. package/dist/semantic.js +150 -0
  82. package/dist/semantic.js.map +1 -0
  83. package/dist/types.d.ts +56 -0
  84. package/dist/types.d.ts.map +1 -0
  85. package/dist/types.js +178 -0
  86. package/dist/types.js.map +1 -0
  87. package/dist/websocket-runtime.d.ts +2 -0
  88. package/dist/websocket-runtime.d.ts.map +1 -0
  89. package/dist/websocket-runtime.js +30 -0
  90. package/dist/websocket-runtime.js.map +1 -0
  91. package/dist/worker-runtime.d.ts +2 -0
  92. package/dist/worker-runtime.d.ts.map +1 -0
  93. package/dist/worker-runtime.js +72 -0
  94. package/dist/worker-runtime.js.map +1 -0
  95. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # @velarscript/web
2
+
3
+ The official Web framework for VelarScript. This package is the versioned
4
+ authority for the `velar/look`, `velar/app`, `velar/config`, `velar/web`, `velar/forms`,
5
+ `velar/http`, `velar/storage`, `velar/browser`, `velar/files`,
6
+ `velar/realtime`, `velar/worker`, `velar/websocket`, and `velar/web-test`
7
+ language modules. It also owns the
8
+ component/JSX, reactive, lifecycle, Look, DOM/CSS lowering, project-manifest,
9
+ and editor contributions that a Core-only VelarScript project does not load. Its
10
+ compiler entry owns the Web parser, analyzer, semantic index contribution,
11
+ intrinsic API rules, dependency/public-interface inspection, and emitter as
12
+ one versioned extension boundary. Its separate `./host` entry owns Web document
13
+ generation, the development reload client, initial compile-error document, CSP
14
+ and deployment projection, browser-test metadata, base-path behavior, and
15
+ production source-map policy. The Web editor contribution owns JSX tag/native
16
+ HTML/native SVG completion, JSX attribute completion, and the special
17
+ `children` rename guard; the generic CLI project semantic layer only supplies
18
+ checked symbols and members.
19
+
20
+ Applications keep the language-level imports:
21
+
22
+ ```velar
23
+
24
+ import {Head, Link, Router, route} from "velar/web"
25
+ import {http} from "velar/http"
26
+ import {rgb, spacing} from "velar/look"
27
+
28
+ const accent = rgb(45, 79, 190)
29
+ const pagePadding = spacing(24px, 16px)
30
+ ```
31
+
32
+ One-off base properties use the same checked table through JSX directives, and
33
+ remain ordered after any composed Look:
34
+
35
+ ```velar fragment
36
+ <button
37
+ look={controlLook}
38
+ look:color={paper}
39
+ look:background={accent}
40
+ >Save</button>
41
+ ```
42
+
43
+ State hooks, viewport conditions, pseudo-elements, and other structural visual
44
+ logic remain in a full `look:` value rather than being encoded into directive
45
+ names.
46
+
47
+ `Head` owns route-scoped metadata and accepts a checked `language` tag when an
48
+ application switches document language at runtime.
49
+
50
+ The project declares `"extensions": ["@velarscript/web"]`; the project-local
51
+ `velar` CLI resolves this package's compiler contract and injects its browser
52
+ runtime. Application code does not import the npm package directly. The
53
+ explicit `./compiler` and `./host` exports are tooling infrastructure, not
54
+ second application APIs. The CLI discovers those entries from the project
55
+ extension list, validates host protocol version 1 and the matching `web`
56
+ capability, and never installs or identifies this package itself.
57
+ The npm manifest declares generic `velar.extension` metadata with the owned
58
+ `web` project field, so `velar add` and `velar remove` can maintain project
59
+ activation without teaching the CLI this package's name.
60
+
61
+ The Web Worker runtime snapshots caller-owned transferable data, then transfers
62
+ nested `Bytes`, `UInt8Buffer`, `UInt16Buffer`, `UInt32Buffer`, and
63
+ `Float32Buffer` storage after checked request/response validation and a bounded
64
+ cycle-safe graph scan. Caller buffers stay intact. Pull WebSockets independently
65
+ bound unread message count, aggregate unread bytes, and pending send bytes;
66
+ normal EOF preserves queued messages for draining, while receive failure clears
67
+ them immediately.
68
+
69
+ `@velarscript/web` requires the exact matching `@velarscript/compiler`
70
+ version. It has no dependency on VelarOS Workbench and does not define the
71
+ future Canvas-oriented `velar/game` framework.
72
+
73
+ Browser HTTP responses expose `.bytes()`, IndexedDB databases expose
74
+ `getBytes`, `setBytes`, and atomic `batch`, and the same immutable `Bytes`
75
+ contract crosses WebSocket and Worker boundaries. Worker source entries come
76
+ from the project manifest, so application source does not construct bundle URLs.
77
+ Requests and responses are checked with runtime `Type` values; pools, call
78
+ queues, message queues, transfers, cancellation, timeout, and crash convergence
79
+ are bounded by the shared Core contracts. The existing `velar/realtime` text
80
+ surface remains available unchanged.
81
+
82
+ The package also owns Look, the checked visual language integrated with VelarScript
83
+ values and JSX. `look:` values, ordinary functions, imports/exports, named
84
+ `velar/look` builders, unit-aware properties and arithmetic, bounded `if` conditions, `@state` hooks, and
85
+ `@target` blocks lower to extracted standard CSS with stable readable markers.
86
+ Native and component JSX accept universal `class` and `look` props; inline
87
+ `style` directives are rejected. Raw CSS is available only through an explicit
88
+ `import css unsafe` declaration whose mandatory `before look` or `after look`
89
+ placement defines source order without inventing priority semantics.
@@ -0,0 +1,302 @@
1
+ import { type Diagnostic, type Span } from "@velarscript/compiler";
2
+ import { Analyzer, type AnalysisContext, type CompilerAnalysisExtension, type CompilerIntrinsicAnalysisContext, type Expression, type Program, type Statement, type TypeReference, type ValueType } from "@velarscript/compiler/extension";
3
+ export declare const routeContextIdentity = "@velarscript/web:velar/web#type:RouteContext";
4
+ export declare function inferWebIntrinsic(context: CompilerIntrinsicAnalysisContext): ValueType | undefined;
5
+ export declare class VelarWebAnalyzer extends Analyzer {
6
+ private componentStates;
7
+ private mountedDepth;
8
+ private cleanupDepth;
9
+ /** D51 (audit 12): a component `watch` body runs on a change and ends, exactly as a module `watch` body does. */
10
+ private watchBodyDepth;
11
+ private synchronousReactiveDepth;
12
+ private jsxDepth;
13
+ private readonly resources;
14
+ private readonly unsafeCssImports;
15
+ private readonly probedOperandTypes;
16
+ private readonly importedLookStaticValues;
17
+ private lookStaticValues;
18
+ private readonly lookEntryScopes;
19
+ private readonly derivedReactiveNames;
20
+ private readonly checkedBuilderCalls;
21
+ private readonly staticJsxKeys;
22
+ private readonly honoredJsxKeys;
23
+ private readonly reportedJsxKeys;
24
+ private lookBuilderNames;
25
+ private lookLiteralDepth;
26
+ /**
27
+ * D71 rule 182: the declaration spans of every `computed` binding in scope.
28
+ * A binding's span survives narrowing, so it identifies the declaration a
29
+ * name resolves to even where a narrowed copy answers the lookup.
30
+ */
31
+ private readonly computedBindingSpans;
32
+ /** Local names bound to an imported `export computed`, from the Web interface. */
33
+ private readonly importedComputedNames;
34
+ /** The resolved spans of those imports, so a local shadow of the name is not one. */
35
+ private readonly importedComputedSpans;
36
+ /** D71 migration state: retired `const x = computed(...)` sites, their reads, and every other `computed` reference. */
37
+ private readonly retiredAccessorDeclarations;
38
+ private readonly retiredAccessorReads;
39
+ private readonly retiredComputedReferences;
40
+ private readonly migratedComputedCallees;
41
+ /** Callee span identity -> call span, for every zero-argument call of a plain name. */
42
+ private readonly plainCallSpans;
43
+ /** D57 rule 138: `velar/web-test` is legal only where the browser runner looks. */
44
+ private readonly webModulePath;
45
+ /** D74: only props whose authors wrote a readonly contract receive prop-specific guidance. */
46
+ private explicitReadonlyPropBindings;
47
+ constructor(context?: AnalysisContext, extensions?: readonly CompilerAnalysisExtension[]);
48
+ analyze(program: Program): readonly Diagnostic[];
49
+ /**
50
+ * D57 rule 138: `velar/web-test` only has a runtime under `velar test
51
+ * --browser`, so an import of it anywhere else compiles a call that cannot
52
+ * succeed. D51 rule 109 puts the refusal at the declaration rather than at the
53
+ * eventual use, so the error lands on the `import` line — including the
54
+ * JavaScript-bridge and re-export spellings, which reach the same runtime.
55
+ */
56
+ private reportBrowserTestImports;
57
+ /**
58
+ * D72 rule 186: a Web module publishes its own type names, and a user
59
+ * declaration of one used to be accepted at the declaration and then lose at
60
+ * every use — `type Event:` compiled, and `describe({kind: "charge"})` was
61
+ * told it could not assign to `Event`, naming a type the author had just
62
+ * written. D51 rule 109 already settled where that refusal belongs: at the
63
+ * declaration, which is the only place a rename is cheap.
64
+ *
65
+ * The names come from the extension's own published table, so adding a type
66
+ * to `WEB_OWNED_TYPE_NAMES` extends this protection with it. The last time
67
+ * this family was repaired by listing names instead of deriving them, the
68
+ * list drifted; D57 rule 135 is the same repair on the Core roster.
69
+ */
70
+ private rejectWebOwnedTypeNames;
71
+ /**
72
+ * WEB-C1: charter §14 promises that a key outside a keyed shape is a
73
+ * diagnostic rather than a silent no-op. Interpolated positions report while
74
+ * their interpolation is walked; static positions are collected during JSX
75
+ * inference and reported once every keyed interpolation is known.
76
+ */
77
+ private reportStaticJsxKeys;
78
+ protected predeclareExtensionStatement(statement: Statement): boolean;
79
+ protected analyzeExtensionStatement(statement: Statement): boolean;
80
+ protected analyzeStatement(statement: Statement): void;
81
+ private directReadonlyPropMutation;
82
+ private rootBindingName;
83
+ protected prescanExtensionScopeDeclaration(statement: Statement): {
84
+ readonly name: string;
85
+ readonly span: Span;
86
+ } | null;
87
+ /**
88
+ * D71 rule 182: a derived value is reactive and read-only, which is exactly
89
+ * the reactive identity a component prop already carries — a bare read lowers
90
+ * through `.get()`, and nothing may write it. Registering that identity
91
+ * rather than `state` is what keeps `bind={doubled}` and every other writable
92
+ * position refusing a derived name for free.
93
+ */
94
+ private analyzeComputedDeclaration;
95
+ /**
96
+ * True when `name` resolves to a `computed` declaration or to an imported one.
97
+ * The question is asked of the *binding* the name resolves to, never of the
98
+ * spelling: a local `state` may shadow an imported derived name, and that
99
+ * shadow is writable state.
100
+ */
101
+ private isComputedBinding;
102
+ private isImportedComputedBinding;
103
+ /**
104
+ * D71 rule 184: a cross-module `computed` travels through `reactiveExports`
105
+ * so its bare read lowers through `.get()` like an exported `state` — but it
106
+ * is not writable, and the imported binding must not inherit the writable
107
+ * identity that carries `bind={...}` and `event => name = ...`. The Web
108
+ * extension publishes which exported names are derived, so the import is
109
+ * demoted to the read-only reactive identity here.
110
+ */
111
+ protected markDeclaredBindingReactive(name: string, kind?: "state" | "prop"): void;
112
+ protected inferExtensionExpression(expression: Expression, _contextualType: ValueType): ValueType | undefined;
113
+ protected inferExpression(expression: Expression, contextualType?: ValueType): ValueType;
114
+ private writableStateName;
115
+ /**
116
+ * D71 rule 182: a declared derived value is read bare, exactly like state.
117
+ * Calling one is the habit the retired `computed(...)` accessor taught, and it
118
+ * is also what a half-migrated project looks like from the importing side — so
119
+ * the answer names the one spelling and carries the edit that reaches it,
120
+ * which is what lets `velar fix` finish a migration that crosses modules.
121
+ */
122
+ private calledComputedBinding;
123
+ /**
124
+ * D69 rule 178: a `watch` body that can never run is a block of statements
125
+ * the compile silently drops — the same defect a bare `5` is already rejected
126
+ * for (VEL4030), reached from a position the rule could not see. The subject
127
+ * is refused only where the compile can *prove* nothing behind it moves, so a
128
+ * call whose reactivity lives inside another module is left alone: a rule that
129
+ * rejected those would be worse than the hole it closes.
130
+ *
131
+ * The two refusals are separate because their causes are: a reader that was
132
+ * not called has one correct spelling to name, and a frozen value has none.
133
+ */
134
+ private rejectFrozenWatchSubject;
135
+ /** A value that is read by calling it and takes no arguments to do so. */
136
+ private zeroArgumentReader;
137
+ /**
138
+ * True only for subjects built entirely from values the compile can see are
139
+ * frozen: literals, and non-reactive bindings whose type is a primitive, so no
140
+ * deep-reactive object can be hiding behind the name. Every member access,
141
+ * index, and call is excluded on purpose — `alias.done` on a const bound to a
142
+ * reactive element does track, and a call can read anything.
143
+ */
144
+ private frozenWatchSubject;
145
+ /** A primitive holds no reactive identity, so a non-reactive binding of one is a snapshot. */
146
+ private frozenValueType;
147
+ /**
148
+ * D71 rule 182: a derived value has no writable location behind it, so the
149
+ * const message ("cannot assign to const binding") would name the wrong
150
+ * reason. Answering here means the reader is told what a derived value is and
151
+ * which spelling holds a value that is written.
152
+ */
153
+ private rejectComputedAssignment;
154
+ /**
155
+ * D71 rule 183: `computed(...)` the function is retired in favour of
156
+ * `cached(...)`, and `const x = computed(() => E)` is retired in favour of the
157
+ * declaration. The declaration is recorded before the core walks the module so
158
+ * its reads can be matched against it — the rewrite that removes the call
159
+ * parentheses is only offered when every read is a plain `x()`.
160
+ */
161
+ private recordRetiredAccessorDeclaration;
162
+ /** Returns true when the name is the retired `computed` global this pass owns. */
163
+ private recordRetiredAccessorRead;
164
+ /**
165
+ * D71 migration: one message per retired site, and a mechanical rewrite only
166
+ * where the compile can prove the rewrite. Where the accessor is used as a
167
+ * value the choice between `computed x = E` and `cached(...)` turns on whether
168
+ * the caller wants the cache, which is the author's decision — so that site
169
+ * gets the message and no edit.
170
+ */
171
+ private reportRetiredComputedFunction;
172
+ /**
173
+ * D71 rule 183 keeps the export-boundary contract the retired spelling had:
174
+ * an exported cached reader has no inferable public type, so the annotation
175
+ * is required at the boundary rather than discovered by the importer.
176
+ */
177
+ private reportExportedCachedContract;
178
+ protected extensionFieldsOf(name: string): ReadonlyMap<string, ValueType> | null;
179
+ protected inferExtensionCall(callee: import("@velarscript/compiler/extension").ExtensionValueType, arguments_: readonly Expression[], argumentNames: readonly (string | null)[] | undefined, callSpan: Span): ValueType | undefined;
180
+ protected validateExtensionTypeSyntax(syntax: import("@velarscript/compiler/extension").TypeSyntax, validate: (syntax: import("@velarscript/compiler/extension").TypeSyntax) => boolean, resolve: (reference: TypeReference) => ValueType): boolean | undefined;
181
+ /**
182
+ * D43 item 69: a component body is a construction section, not a scope with
183
+ * an exit — its resources live until unmount. Ownership belongs to the
184
+ * lifecycle hook or to a function inside the component, so the setup section
185
+ * says so instead of releasing at the wrong moment.
186
+ */
187
+ protected ownershipScopeRejection(): string | null;
188
+ protected invalidExtensionAwaitContext(): boolean;
189
+ protected invalidExtensionAwaitMessage(): string | null;
190
+ private componentType;
191
+ private analyzeResourceDeclaration;
192
+ private actionType;
193
+ private analyzeActionDeclaration;
194
+ private analyzeComponent;
195
+ private containsReadonlyView;
196
+ private validateComponentHandleType;
197
+ protected resolveAnnotation(reference: TypeReference | null): ValueType;
198
+ private normalizeComponentContracts;
199
+ private validateComponentHost;
200
+ private analyzeLookEntries;
201
+ /**
202
+ * LOK-D1: a `look:` literal is constructed once, where it is written. Its
203
+ * conditions and its values are snapshot positions — a reactive read inside
204
+ * one compiles cleanly and then never updates, which is the quietest trap in
205
+ * the visual language. The two spellings that stay live are the JSX
206
+ * expression position and the `look:property` directive, so the read is
207
+ * rejected here and both are taught.
208
+ */
209
+ private reportLookSnapshotReads;
210
+ /**
211
+ * True when a name both belongs to a derived reactive declaration and still
212
+ * resolves to one here: a computed accessor is a zero-argument function, and a
213
+ * resource or action handle is a record with its reactive fields. An ordinary
214
+ * binding that happens to share the name — a function parameter, a local — is
215
+ * not a reactive read.
216
+ */
217
+ private derivedReactiveRead;
218
+ /**
219
+ * LOK-U8: the velar/look builders check their numeric domains at run time, so
220
+ * a literal out-of-range colour used to compile clean and blank the page on
221
+ * the first paint. Literal arguments are checked in the same terms while the
222
+ * module compiles; dynamic arguments keep the runtime guard.
223
+ */
224
+ private checkLookBuilderCall;
225
+ private checkAnimateBuilderCall;
226
+ private checkAnimationKeyword;
227
+ private analyzeKeyframes;
228
+ private reportKeyframeSnapshotReads;
229
+ /**
230
+ * Records one entry in its lowered scope (condition signature plus target) so
231
+ * two sibling blocks with the same condition report the property they both
232
+ * set. Returns false when the entry repeats. LOK-I4: the charter's duplicate
233
+ * promise used to hold only inside a single indented scope.
234
+ */
235
+ private recordLookEntry;
236
+ /**
237
+ * The vocabulary checks a Look property shares between the block spelling and
238
+ * the `look:`/`style:` directives. Returns false when the entry is already
239
+ * reported and its value needs no further checking. LOK-I1: an unrecognized
240
+ * property no longer co-reports a `stringType` fallback assignment error.
241
+ */
242
+ private analyzeLookValue;
243
+ private validateLookStringVocabulary;
244
+ /**
245
+ * LOK-D3: a bare number on a length property reaches CSS as a declaration the
246
+ * browser discards. The union already rejects it; this diagnostic replaces the
247
+ * union dump with the unit the author meant to write.
248
+ */
249
+ private reportLookNumberWithoutUnit;
250
+ private inferLookCondition;
251
+ private checkViewportThreshold;
252
+ private inferJsx;
253
+ private checkKeyedInterpolation;
254
+ private reportIneffectiveJsxKeys;
255
+ private analyzeComponentElement;
256
+ /**
257
+ * The `look=` attribute on either host kind. A Look block written inline is
258
+ * reported without inferring its entries, so the one directive-level message
259
+ * stands alone; an empty list names the accepted family rather than rendering
260
+ * `List<unknown>` (LOK-I3, LOK-I6).
261
+ */
262
+ private analyzeJsxLookAttribute;
263
+ private analyzeComponentRef;
264
+ private analyzeNativeJsxAttribute;
265
+ /**
266
+ * GRM-A4: an event handler runs for effect and returns null. The hole this
267
+ * closes is `on:click={() => {}}`: after a fat arrow, braces build a record,
268
+ * never a block, so the empty-record factory used to be accepted as a handler
269
+ * and silently did nothing on every click.
270
+ */
271
+ private checkEventHandlerResult;
272
+ /**
273
+ * D47 rule 84(A): a bind target is a writable reactive location — a state
274
+ * name, or a record-field / List-index / Map-key path rooted in one. A
275
+ * computed accessor, a const, and a function result stay rejected: nothing
276
+ * would receive the write.
277
+ */
278
+ private isWritableBindTarget;
279
+ /**
280
+ * Walks a member/index path inward to its root state binding, checking every
281
+ * segment is a writable location: a declared record field, a List element, or
282
+ * a Map value. Returns the root state name, or null when the path is not a
283
+ * writable reactive location.
284
+ */
285
+ private bindPathRoot;
286
+ /**
287
+ * D47 rule 84: `bind:group` binds a set of inputs that share one decision.
288
+ * A radio group holds the selected input's `value`; a checkbox group holds the
289
+ * checked values as a List<string>, so checking and unchecking are membership
290
+ * changes.
291
+ */
292
+ private analyzeBindGroup;
293
+ private eventAssignedStateBinding;
294
+ private isLookInput;
295
+ private isClassInput;
296
+ private isJsxRenderable;
297
+ private isJsxAttributeValue;
298
+ private isOptionalString;
299
+ private checkWebRouteComponent;
300
+ private analyzeInlineVisualAttribute;
301
+ }
302
+ //# sourceMappingURL=analyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EACL,QAAQ,EAgBR,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACrC,KAAK,UAAU,EAEf,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,iCAAiC,CAAC;AAwEzC,eAAO,MAAM,oBAAoB,iDAAiD,CAAC;AAsFnF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gCAAgC,GAAG,SAAS,GAAG,SAAS,CAyLlG;AAiaD,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,YAAY,CAAK;IACzB,iHAAiH;IACjH,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,wBAAwB,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