@unframework.dev/target-angular 0.2.1 → 0.4.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.
- package/LICENSE +22 -0
- package/README.md +44 -12
- package/dist/composable.js +2 -1
- package/dist/composition.js +2 -2
- package/dist/directive.js +15 -7
- package/dist/directives.js +10 -1
- package/dist/effects.js +1 -1
- package/dist/elements.js +117 -0
- package/dist/fallthrough.js +283 -0
- package/dist/index.js +193 -63
- package/dist/listeners.js +85 -11
- package/dist/members.js +29 -1
- package/dist/models.js +24 -11
- package/dist/narrowing.js +6 -1
- package/dist/plan.js +58 -24
- package/dist/rules.js +3 -2
- package/dist/seeded.js +9 -9
- package/dist/shared.js +89 -0
- package/dist/statements.js +1 -1
- package/dist/template.js +142 -24
- package/dist/toolchain/client.d.ts +1 -1
- package/dist/toolchain/ngtsc-virtual.js +16 -2
- package/dist/toolchain/ngtsc.js +1 -1
- package/package.json +4 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 UXFront
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -7,13 +7,15 @@ templates, whose host element has `display: contents` (decision D6, ADR-0010).
|
|
|
7
7
|
|
|
8
8
|
One `<kebab-name>.ts` file per component (plan §6), in this order: the imports from
|
|
9
9
|
`@angular/core`, `@angular/common` and `@angular/platform-browser`, of the children's output files, of the composables'
|
|
10
|
-
(`./use-toggle`, ADR-0069)
|
|
11
|
-
|
|
10
|
+
(`./use-toggle`, ADR-0069), of the shared helper modules in the tree's `_unframework/`
|
|
11
|
+
(ADR-0121) and of the values the source imports from `.ts` modules, each under a name no source
|
|
12
|
+
name takes; the type declarations; the module's constants the component reads, and
|
|
12
13
|
those they read, as written (`const GAP = sizes.sm * 2;`, ADR-0070); the application's id
|
|
13
14
|
counter, an injection token (`idCounter`, ADR-0095), when the component makes ids; the
|
|
14
15
|
injection tokens of the module's keys; the inline helpers (`refObject`, the native controls'
|
|
15
|
-
`
|
|
16
|
-
|
|
16
|
+
`toggle`, `selectedValues`, `optionText` and their model helpers where the helpers are not
|
|
17
|
+
shared); the slot directives; where the helpers are not shared, the pipe `innerHTML`
|
|
18
|
+
reads its markup through (`TrustedHtmlPipe`, ADR-0097) and the directives its listeners'
|
|
17
19
|
options need; the component.
|
|
18
20
|
|
|
19
21
|
- **Types.** The source's type declarations the output reads (its inputs' and outputs' types, the
|
|
@@ -109,6 +111,7 @@ the template itself, which reads through `@let`, and a template statement's inpu
|
|
|
109
111
|
| `const { on, toggle } = useToggle(false)` | `protected readonly toggle_1 = useToggle(false)`, read as `this.toggle_1.on()` and `@let on = this.toggle_1.on();` (below) |
|
|
110
112
|
| `emit("change", value)` | `this.change.emit(value)`, by the payload rule |
|
|
111
113
|
| `nextTick()` | `this.nextTick()`, a private method that renders in a microtask with `ApplicationRef.tick()` (emulated, `next-tick`) |
|
|
114
|
+
| `if (isDev) { … }` | `if (typeof ngDevMode === "undefined" \|\| ngDevMode) { … }`, at the top level in `ngOnInit` (ADR-0117) |
|
|
112
115
|
| `watch(source, callback, options)` | an `effect()` created in `ngOnInit`; `afterRenderEffect()` with `flush: "post"` (below) |
|
|
113
116
|
| `watchEffect(effect)` | `afterRenderEffect(effect)` in the constructor: after the render, in the browser only |
|
|
114
117
|
| `onMounted(callback)` | `afterNextRender(callback)` in the constructor: in the browser, once the view is in the document |
|
|
@@ -255,7 +258,7 @@ parent, so the composable's effects stay the component's view effects.
|
|
|
255
258
|
| `defineModel("value", { default: 0 })` | `readonly value = model<number>(0)`, read and written as a signal; `model<number>(0, { alias: "value" })` where its binding has another name |
|
|
256
259
|
| `v-model:value={cups.value}` | `[(value)]="this.cups"`, on the signal |
|
|
257
260
|
| `v-model` on a control | `#nameField [value]="this.name()" (input)="this.name.set(nameField.value)"`, `[checked]` and `(change)` for a box, `[selected]` on a select's options, and a bound `<textarea>` the `TextCaret` directive, which puts a hydrated field's caret after its text (ADR-0095) |
|
|
258
|
-
| `class` and `style` on a component | `[class]`, `[style]`: the child's `class` and `style` inputs, merged into its root; the host clears both
|
|
261
|
+
| `class` and `style` on a component | `[class]`, `[style]`: the child's `class` and `style` inputs, merged into its root; the host clears both; any other attribute and DOM listener in `[ufAttributes]` and `[ufListeners]` (ADR-0118) |
|
|
259
262
|
| `defineExpose({ focus })`, `ref={search}` | `focus` public; `viewChild<{ focus(): void }>("search")`, read as `this.search()?.focus()` |
|
|
260
263
|
| `export const LocaleKey: InjectionKey<T>` | `export const LocaleKey = new InjectionToken<T>("…")` in the module's main component's file |
|
|
261
264
|
| `provide(LocaleKey, locale)` | `providers: [{ provide: LocaleKey, useFactory: () => inject(LocaleProvider).locale() }]`; `useValue` for a constant |
|
|
@@ -282,11 +285,18 @@ parent, so the composable's effects stay the component's view effects.
|
|
|
282
285
|
listeners, so the model's write runs first in the element's one template listener of its event,
|
|
283
286
|
ahead of an author's listener there, a `once` or `passive` one included (a capture listener runs
|
|
284
287
|
before the bubble phase at its target, on Vue too, and keeps its directive).
|
|
285
|
-
- **Fallthrough.** A component whose root is an element
|
|
288
|
+
- **Fallthrough.** A component whose root is an element, a component or a `<component is>` over
|
|
289
|
+
tags (ADR-0119, in each `@case`), and that does not set
|
|
286
290
|
`inheritAttrs: false`, declares `class` and `style` inputs and merges them into its root: the
|
|
287
291
|
class among its parts, the style in one map after the root's own, so a property the consumer
|
|
288
292
|
leaves `undefined` removes the root's, as Vue's merge does. The host clears both with
|
|
289
|
-
`[attr.class]` and `[attr.style]` bindings, keeping only `display: contents`.
|
|
293
|
+
`[attr.class]` and `[attr.style]` bindings, keeping only `display: contents`. Its other
|
|
294
|
+
attributes and DOM listeners a consumer passes arrive in two more inputs, `ufAttributes` and
|
|
295
|
+
`ufListeners`, which the `Fallthrough` directive on its fallthrough element (its root, or the
|
|
296
|
+
element that spreads the props' rest) sets through `Renderer2`, the consumer's value winning
|
|
297
|
+
and the root's own listener running first (ADR-0118). The directive and the listeners' types
|
|
298
|
+
are shared helper modules (ADR-0121). A ref on a component that exposes nothing
|
|
299
|
+
reads its `ufElement`, a `viewChild` of its root, which a root component forwards.
|
|
290
300
|
- **Context.** An injected value is read once the inputs are set, from the injector the class
|
|
291
301
|
holds: a consumer projected into its provider is created before the provider's inputs are set,
|
|
292
302
|
which a provided value may read (NG0950). A key of a ref (`InjectionKey<Ref<number>>`) holds
|
|
@@ -358,9 +368,11 @@ parent's attribute on a child's tag, and the child's `-s` on the content filled
|
|
|
358
368
|
sheet uses `:slotted()`, through `<ng-content>` and `ng-template` slots alike. The parent's
|
|
359
369
|
attribute lands on the child's host, which must keep only `display: contents`, and a template
|
|
360
370
|
cannot write an attribute whose name it does not know. So each root node of a component binds an
|
|
361
|
-
|
|
371
|
+
shared attribute directive to its host, `[ufScope]="this.host"` (`ScopeAttributes`, with the host
|
|
362
372
|
in a protected `host` member): in `ngOnInit` it takes the host's `data-uf-*` attributes off it,
|
|
363
|
-
keeps their names in
|
|
373
|
+
keeps their names in its module's `WeakMap` for a root that renders later, and sets them on its
|
|
374
|
+
node. The map is keyed by the host, which only its own component's roots read, so one map serves
|
|
375
|
+
the tree (ADR-0121, R2).
|
|
364
376
|
Its root nodes are those Vue's fallthrough reaches (`scopeRoots`): the root element, component or
|
|
365
377
|
each candidate of a root `<component is>`, or each branch of a root conditional that renders one
|
|
366
378
|
alone. A root component's own root directive runs after this one has set them on its host, so they
|
|
@@ -383,7 +395,7 @@ object), `style-binding` (emulated, `styleObject`, for a style bound to a value
|
|
|
383
395
|
spreads; ADR-0065), `raw-html` (emulated, `TrustedHtmlPipe`, a pure pipe that marks `innerHTML`'s
|
|
384
396
|
markup trusted, so Angular's sanitiser keeps it as written; ADR-0097) and composition's cells that ADR-0056 decides: `named-slot`, `scoped-slot` and
|
|
385
397
|
`slot-forwarding` (emulated, the slot directives `uf<Component><Slot>`), `model-array`
|
|
386
|
-
(`toggle`), `model-modifiers` (`modelText`), `fallthrough` (`
|
|
398
|
+
(`toggle`), `model-modifiers` (`modelText`), `fallthrough` (the shared `Fallthrough` directive), `expose` (`ufElement`, where a component exposes nothing), `reactive-context`
|
|
387
399
|
(`refObject`) and `dynamic-component` (`@switch`), all emulated, `default-slot-presence` and
|
|
388
400
|
`contextual-root`, unsupported (UF4001, errors), `child-root-scope` and `sheet-order`,
|
|
389
401
|
unsupported (UF4003 and UF4002, info), and `generic-slot-props`, unsupported (UF4004, info): slot
|
|
@@ -393,12 +405,30 @@ cannot infer. Where an unsupported cell is reported, the
|
|
|
393
405
|
output still compiles: default-slot presence reads `true`, and the forwarded default slot
|
|
394
406
|
re-projects `<ng-content />`.
|
|
395
407
|
|
|
396
|
-
`directive` is emulated (ADR-0099): a standalone attribute directive, `VFocusTrap` in `v-focus-trap.ts` for a `.uf.ts` module's, bound as `[vFocusTrap]` and in the component's `imports`, whose `afterRenderEffect` passes the value to an inline `runDirective` and whose `DestroyRef` stops it. The helper runs the hooks as a `MutationObserver` sees the element come into the document and leave it, since Angular creates projected content before a child puts it there, and queues them through
|
|
408
|
+
`directive` is emulated (ADR-0099): a standalone attribute directive, `VFocusTrap` in `v-focus-trap.ts` for a `.uf.ts` module's, bound as `[vFocusTrap]` and in the component's `imports`, whose `afterRenderEffect` passes the value to an inline `runDirective` and whose `DestroyRef` stops it. The helper runs the hooks as a `MutationObserver` sees the element come into the document and leave it, since Angular creates projected content before a child puts it there, and queues them through a shared `queueHook`, which runs them in Vue's order.
|
|
397
409
|
|
|
398
410
|
`transition` is emulated (ADR-0100): a `<Transition>`'s element takes an inline directive, `Transition`, bound as `[ufTransition]="'fade'"`, and a conditional child sits in `<ng-container [ufTransitionRegion]="…">`, whose inline directive, `TransitionRegion`, is created with the transition and holds the branch shown. The element's directive runs Vue's enter classes once its region has rendered, or with `appear`, and the leave through `(animate.leave)`'s function form, which holds the element's removal until the leave ends. Angular runs that function too when a view around the element goes, so the directive lets the element go at once while its region still shows its branch.
|
|
399
411
|
|
|
400
412
|
`teleport` is emulated (ADR-0098): an `<ng-template ufTeleport>` whose inline directive, `Teleport`, creates its view in its own view container once the application has rendered and moves the view's nodes into `to`. A render's teleports mount in the document's order, and a root teleport takes its parents' scope attributes off the host.
|
|
401
413
|
|
|
414
|
+
The shared helpers are modules of their own in the tree's `_unframework/` (ADR-0121), put
|
|
415
|
+
through `EmitContext.helper` and printed by `src/shared.ts`: `ScopeAttributes.ts`,
|
|
416
|
+
`TextCaret.ts`, `TrustedHtmlPipe.ts`, `styleObject.ts`, `modelText.ts`, `writeModelText.ts`,
|
|
417
|
+
`looseToNumber.ts`, `queueHook.ts`, `Fallthrough.ts`, `Listeners.ts` and one module for each
|
|
418
|
+
event and option a listener uses, such as `ClickCapture.ts`. Each imports Angular by its own
|
|
419
|
+
names, so its text depends only on the helper, and a helper that calls another imports it as its
|
|
420
|
+
sibling (`./looseToNumber`). `Listeners.ts` holds the types of the fallthrough listeners' record,
|
|
421
|
+
`Listeners` and, for an SVG element, `SvgListeners`, which a component imports with
|
|
422
|
+
`import type`, and which `Fallthrough`'s input takes either of.
|
|
423
|
+
|
|
424
|
+
A component imports each without the extension, `import { ScopeAttributes } from
|
|
425
|
+
"./_unframework/ScopeAttributes"`, under one name in every component of a source, and lists a
|
|
426
|
+
directive or a pipe in its `imports`. `Transition` and `TransitionRegion` stay inline: the
|
|
427
|
+
directive finds its region through `inject`, which looks through every ancestor's injector,
|
|
428
|
+
across component hosts, so a shared region class would let a child's transition read its
|
|
429
|
+
parent's region (R2). The directive runner, `Teleport`, `idCounter` and the short helpers stay
|
|
430
|
+
inline too. A context without `helper` gets every helper printed inline, as before.
|
|
431
|
+
|
|
402
432
|
Inline content on either side of a child component's host reads with a space in the accessible
|
|
403
433
|
name: Chrome adds one at every `display: contents` element, so Angular reads `Build passing` where
|
|
404
434
|
the other targets read `Buildpassing`. `harness/quarantine/angular.ts` lists the cells until M3's
|
|
@@ -412,7 +442,9 @@ Tests and tooling build, check and run the Angular output through three subpaths
|
|
|
412
442
|
- `vite("browser" | "ssr", context)`: Angular's AOT compiler (ngtsc, strict templates) for
|
|
413
443
|
the unframework plugin's virtual `X.uf.tsx.ts` modules and its modules of composables,
|
|
414
444
|
`X.uf.ts.ts`, which a component's program reads so its template is checked against the
|
|
415
|
-
composable's types (ADR-0069),
|
|
445
|
+
composable's types (ADR-0069), and for the shared helper modules it serves,
|
|
446
|
+
`_unframework/angular/ScopeAttributes.ts`, which a component's program reads too and which compile
|
|
447
|
+
ahead of time on their own (ADR-0121), Analog with `jit: false`, and the
|
|
416
448
|
Angular linker, over the pre-bundled framework in the browser and over the packages the SSR
|
|
417
449
|
module graph inlines on the server, so no JIT compiler runs.
|
|
418
450
|
- `frameworkCompile(files, context)` (L3) and `typecheck(files, context)` (L4): one ngtsc
|
package/dist/composable.js
CHANGED
|
@@ -156,7 +156,8 @@ function itemCode(item, context) {
|
|
|
156
156
|
case "Model":
|
|
157
157
|
case "Provide":
|
|
158
158
|
case "Inject":
|
|
159
|
-
case "Use":
|
|
159
|
+
case "Use":
|
|
160
|
+
case "DevCheck": throw new Error(`A composable holds a \`${item.kind}\` item, which the analyser rejects.`);
|
|
160
161
|
default: return unreachable(item);
|
|
161
162
|
}
|
|
162
163
|
}
|
package/dist/composition.js
CHANGED
|
@@ -12,7 +12,7 @@ function selectorOf(name) {
|
|
|
12
12
|
* selector in camel case and the slot's name (`ufCardTitle`).
|
|
13
13
|
*/
|
|
14
14
|
function slotAttribute(name, slot) {
|
|
15
|
-
return `${selectorOf(name).
|
|
15
|
+
return `${selectorOf(name).replaceAll(/-(\w)/g, (_, next) => next.toUpperCase())}${pascalCase(slot)}`;
|
|
16
16
|
}
|
|
17
17
|
/** Whether a slot is written through a directive: any but the default slot without props. */
|
|
18
18
|
function usesDirective(slot, scoped) {
|
|
@@ -209,6 +209,6 @@ function aliases(props) {
|
|
|
209
209
|
}
|
|
210
210
|
/** A prop's name as a context key a template variable can read: `data-id` → `dataId`. */
|
|
211
211
|
function contextAlias(key) {
|
|
212
|
-
return key.
|
|
212
|
+
return key.replaceAll(/[^A-Za-z0-9_$]+(.)?/g, (_, next) => next?.toUpperCase() ?? "").replace(/^(?=\d)/, "_");
|
|
213
213
|
}
|
|
214
214
|
export { childEvent, firstUse, keyOf, outputFile, planComposition, refObjectCode, selectorOf, slotDirectiveCode, tokenType, usesDirective };
|
package/dist/directive.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { importShared } from "./shared.js";
|
|
1
2
|
import { ImportSet, NameScope, dependencyImports, directiveDependencies, directiveElement, directiveHooksObject, directiveModuleNames, directiveRunnerCode, hookQueueCode, js, kebabCase, printProgram, wrapperNames } from "@unframework.dev/codegen";
|
|
2
3
|
/** The inline helper that runs a directive's hooks as its element comes and goes. */
|
|
3
4
|
const RUNNER_HELPER = "runDirective";
|
|
5
|
+
/** The helper that queues the hooks, shared in `_unframework/` where helpers are (ADR-0121). */
|
|
6
|
+
const QUEUE_HELPER = "queueHook";
|
|
4
7
|
/** The runner's names, each claimed through `claim` from its base. */
|
|
5
8
|
function runnerNames(claim) {
|
|
6
9
|
return {
|
|
@@ -11,12 +14,12 @@ function runnerNames(claim) {
|
|
|
11
14
|
watches: claim("documentWatches"),
|
|
12
15
|
checker: claim("directiveCheck"),
|
|
13
16
|
leftWatch: claim("watchLeft"),
|
|
14
|
-
queue: claim(
|
|
17
|
+
queue: claim(QUEUE_HELPER)
|
|
15
18
|
};
|
|
16
19
|
}
|
|
17
|
-
/** The runner and the queue it calls, as a file declares them. */
|
|
18
|
-
function runnerCode(names) {
|
|
19
|
-
return [...directiveRunnerCode(names), hookQueueCode(names.queue)].map((code) => `${code}\n`);
|
|
20
|
+
/** The runner and the queue it calls, as a file declares them: the queue unless it is shared. */
|
|
21
|
+
function runnerCode(names, queue = true) {
|
|
22
|
+
return [...directiveRunnerCode(names), ...queue ? [hookQueueCode(names.queue)] : []].map((code) => `${code}\n`);
|
|
20
23
|
}
|
|
21
24
|
/** The class an Angular directive is declared as: `VFocusTrap` for `vFocusTrap`. */
|
|
22
25
|
function directiveClassName(name) {
|
|
@@ -64,17 +67,22 @@ function emitDirective(directive, context) {
|
|
|
64
67
|
const imports = new ImportSet(new NameScope(directiveModuleNames(directive, dependencies)));
|
|
65
68
|
const runner = runnerNames((base) => imports.claim(base));
|
|
66
69
|
const directiveCode = directiveClassCode(directive, directiveClassName(directive.name), runner.run, imports);
|
|
70
|
+
const path = `${directiveFile(directive.name)}.ts`;
|
|
71
|
+
if (context.helper) importShared(context.helper, path, imports, [{
|
|
72
|
+
name: QUEUE_HELPER,
|
|
73
|
+
local: runner.queue
|
|
74
|
+
}]);
|
|
67
75
|
return [{
|
|
68
|
-
path
|
|
76
|
+
path,
|
|
69
77
|
contents: [
|
|
70
78
|
printProgram(js.program(imports.toDeclarations())).trim(),
|
|
71
79
|
...dependencyImports(dependencies),
|
|
72
80
|
"",
|
|
73
81
|
...dependencies.types.map((code) => `${code}\n`),
|
|
74
82
|
...dependencies.constants.length ? [`${dependencies.constants.join("\n")}\n`] : [],
|
|
75
|
-
...runnerCode(runner),
|
|
83
|
+
...runnerCode(runner, context.helper === void 0),
|
|
76
84
|
directiveCode
|
|
77
85
|
].join("\n")
|
|
78
86
|
}];
|
|
79
87
|
}
|
|
80
|
-
export { RUNNER_HELPER, directiveClassCode, directiveClassName, directiveFile, emitDirective, runnerCode, runnerNames };
|
|
88
|
+
export { QUEUE_HELPER, RUNNER_HELPER, directiveClassCode, directiveClassName, directiveFile, emitDirective, runnerCode, runnerNames };
|
package/dist/directives.js
CHANGED
|
@@ -343,4 +343,13 @@ class ${className} implements ${core("PipeTransform", true)} {
|
|
|
343
343
|
}
|
|
344
344
|
`;
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
/**
|
|
347
|
+
* A printed class with a blank line before each of its methods, as Angular code sets them apart
|
|
348
|
+
* from the fields and from each other (oxfmt keeps a blank line, and adds none). Read before the
|
|
349
|
+
* placeholders are spliced: a member starts at the class's indentation, and a method's line ends
|
|
350
|
+
* with its body's `{` where a field's holds ` = `.
|
|
351
|
+
*/
|
|
352
|
+
function spaced(printed) {
|
|
353
|
+
return printed.replaceAll(/\n(?= {2}[^\s}][^\n]*\{\n)(?! {2}[^\n]* = )/g, "\n\n");
|
|
354
|
+
}
|
|
355
|
+
export { TELEPORT_ATTRIBUTE, TELEPORT_HOST_INPUT, TRANSITION_APPEAR_INPUT, TRANSITION_ATTRIBUTE, TRANSITION_BRANCH_INPUT, TRANSITION_REGION_ATTRIBUTE, directiveCode, scopeDirectiveCode, spaced, teleportDirectiveCode, textCaretDirectiveCode, transitionDirectiveCode, transitionRegionCode, trustedHtmlPipeCode };
|
package/dist/effects.js
CHANGED
|
@@ -80,7 +80,7 @@ function watcherCode(item, plan, rules, names) {
|
|
|
80
80
|
*/
|
|
81
81
|
function watchedSignal(source, plan) {
|
|
82
82
|
const binding = source.kind === "Ref" ? bindingById(plan, source.binding) : source.getter.expression && source.getter.body.refs.length === 1 && source.getter.body.refs[0].kind === "Binding" && source.getter.body.refs[0].span.start === source.getter.body.span.start && source.getter.body.refs[0].span.end === source.getter.body.span.end ? bindingById(plan, source.getter.body.refs[0].binding) : void 0;
|
|
83
|
-
if (binding === void 0) return
|
|
83
|
+
if (binding === void 0) return;
|
|
84
84
|
const form = formOf(plan, binding);
|
|
85
85
|
switch (form) {
|
|
86
86
|
case "input":
|
package/dist/elements.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/** The DOM interface of an element by its tag: `button` → `HTMLButtonElement`. */
|
|
2
|
+
const ELEMENT_INTERFACES = /* @__PURE__ */ new Map([
|
|
3
|
+
["a", "HTMLAnchorElement"],
|
|
4
|
+
["abbr", "HTMLElement"],
|
|
5
|
+
["address", "HTMLElement"],
|
|
6
|
+
["area", "HTMLAreaElement"],
|
|
7
|
+
["article", "HTMLElement"],
|
|
8
|
+
["aside", "HTMLElement"],
|
|
9
|
+
["audio", "HTMLAudioElement"],
|
|
10
|
+
["b", "HTMLElement"],
|
|
11
|
+
["base", "HTMLBaseElement"],
|
|
12
|
+
["bdi", "HTMLElement"],
|
|
13
|
+
["bdo", "HTMLElement"],
|
|
14
|
+
["blockquote", "HTMLQuoteElement"],
|
|
15
|
+
["body", "HTMLBodyElement"],
|
|
16
|
+
["br", "HTMLBRElement"],
|
|
17
|
+
["button", "HTMLButtonElement"],
|
|
18
|
+
["canvas", "HTMLCanvasElement"],
|
|
19
|
+
["caption", "HTMLTableCaptionElement"],
|
|
20
|
+
["cite", "HTMLElement"],
|
|
21
|
+
["code", "HTMLElement"],
|
|
22
|
+
["col", "HTMLTableColElement"],
|
|
23
|
+
["colgroup", "HTMLTableColElement"],
|
|
24
|
+
["data", "HTMLDataElement"],
|
|
25
|
+
["datalist", "HTMLDataListElement"],
|
|
26
|
+
["dd", "HTMLElement"],
|
|
27
|
+
["del", "HTMLModElement"],
|
|
28
|
+
["details", "HTMLDetailsElement"],
|
|
29
|
+
["dfn", "HTMLElement"],
|
|
30
|
+
["dialog", "HTMLDialogElement"],
|
|
31
|
+
["div", "HTMLDivElement"],
|
|
32
|
+
["dl", "HTMLDListElement"],
|
|
33
|
+
["dt", "HTMLElement"],
|
|
34
|
+
["em", "HTMLElement"],
|
|
35
|
+
["embed", "HTMLEmbedElement"],
|
|
36
|
+
["fieldset", "HTMLFieldSetElement"],
|
|
37
|
+
["figcaption", "HTMLElement"],
|
|
38
|
+
["figure", "HTMLElement"],
|
|
39
|
+
["footer", "HTMLElement"],
|
|
40
|
+
["form", "HTMLFormElement"],
|
|
41
|
+
["h1", "HTMLHeadingElement"],
|
|
42
|
+
["h2", "HTMLHeadingElement"],
|
|
43
|
+
["h3", "HTMLHeadingElement"],
|
|
44
|
+
["h4", "HTMLHeadingElement"],
|
|
45
|
+
["h5", "HTMLHeadingElement"],
|
|
46
|
+
["h6", "HTMLHeadingElement"],
|
|
47
|
+
["head", "HTMLHeadElement"],
|
|
48
|
+
["header", "HTMLElement"],
|
|
49
|
+
["hgroup", "HTMLElement"],
|
|
50
|
+
["hr", "HTMLHRElement"],
|
|
51
|
+
["html", "HTMLHtmlElement"],
|
|
52
|
+
["i", "HTMLElement"],
|
|
53
|
+
["iframe", "HTMLIFrameElement"],
|
|
54
|
+
["img", "HTMLImageElement"],
|
|
55
|
+
["input", "HTMLInputElement"],
|
|
56
|
+
["ins", "HTMLModElement"],
|
|
57
|
+
["kbd", "HTMLElement"],
|
|
58
|
+
["label", "HTMLLabelElement"],
|
|
59
|
+
["legend", "HTMLLegendElement"],
|
|
60
|
+
["li", "HTMLLIElement"],
|
|
61
|
+
["link", "HTMLLinkElement"],
|
|
62
|
+
["main", "HTMLElement"],
|
|
63
|
+
["map", "HTMLMapElement"],
|
|
64
|
+
["mark", "HTMLElement"],
|
|
65
|
+
["menu", "HTMLMenuElement"],
|
|
66
|
+
["meta", "HTMLMetaElement"],
|
|
67
|
+
["meter", "HTMLMeterElement"],
|
|
68
|
+
["nav", "HTMLElement"],
|
|
69
|
+
["noscript", "HTMLElement"],
|
|
70
|
+
["object", "HTMLObjectElement"],
|
|
71
|
+
["ol", "HTMLOListElement"],
|
|
72
|
+
["optgroup", "HTMLOptGroupElement"],
|
|
73
|
+
["option", "HTMLOptionElement"],
|
|
74
|
+
["output", "HTMLOutputElement"],
|
|
75
|
+
["p", "HTMLParagraphElement"],
|
|
76
|
+
["picture", "HTMLPictureElement"],
|
|
77
|
+
["pre", "HTMLPreElement"],
|
|
78
|
+
["progress", "HTMLProgressElement"],
|
|
79
|
+
["q", "HTMLQuoteElement"],
|
|
80
|
+
["rp", "HTMLElement"],
|
|
81
|
+
["rt", "HTMLElement"],
|
|
82
|
+
["ruby", "HTMLElement"],
|
|
83
|
+
["s", "HTMLElement"],
|
|
84
|
+
["samp", "HTMLElement"],
|
|
85
|
+
["script", "HTMLScriptElement"],
|
|
86
|
+
["search", "HTMLElement"],
|
|
87
|
+
["section", "HTMLElement"],
|
|
88
|
+
["select", "HTMLSelectElement"],
|
|
89
|
+
["slot", "HTMLSlotElement"],
|
|
90
|
+
["small", "HTMLElement"],
|
|
91
|
+
["source", "HTMLSourceElement"],
|
|
92
|
+
["span", "HTMLSpanElement"],
|
|
93
|
+
["strong", "HTMLElement"],
|
|
94
|
+
["style", "HTMLStyleElement"],
|
|
95
|
+
["sub", "HTMLElement"],
|
|
96
|
+
["summary", "HTMLElement"],
|
|
97
|
+
["sup", "HTMLElement"],
|
|
98
|
+
["table", "HTMLTableElement"],
|
|
99
|
+
["tbody", "HTMLTableSectionElement"],
|
|
100
|
+
["td", "HTMLTableCellElement"],
|
|
101
|
+
["template", "HTMLTemplateElement"],
|
|
102
|
+
["textarea", "HTMLTextAreaElement"],
|
|
103
|
+
["tfoot", "HTMLTableSectionElement"],
|
|
104
|
+
["th", "HTMLTableCellElement"],
|
|
105
|
+
["thead", "HTMLTableSectionElement"],
|
|
106
|
+
["time", "HTMLTimeElement"],
|
|
107
|
+
["title", "HTMLTitleElement"],
|
|
108
|
+
["tr", "HTMLTableRowElement"],
|
|
109
|
+
["track", "HTMLTrackElement"],
|
|
110
|
+
["u", "HTMLElement"],
|
|
111
|
+
["ul", "HTMLUListElement"],
|
|
112
|
+
["var", "HTMLElement"],
|
|
113
|
+
["video", "HTMLVideoElement"],
|
|
114
|
+
["wbr", "HTMLElement"],
|
|
115
|
+
["svg", "SVGSVGElement"]
|
|
116
|
+
]);
|
|
117
|
+
export { ELEMENT_INTERFACES };
|