@unframework.dev/target-angular 0.2.0 → 0.3.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 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
@@ -282,7 +282,8 @@ parent, so the composable's effects stay the component's view effects.
282
282
  listeners, so the model's write runs first in the element's one template listener of its event,
283
283
  ahead of an author's listener there, a `once` or `passive` one included (a capture listener runs
284
284
  before the bubble phase at its target, on Vue too, and keeps its directive).
285
- - **Fallthrough.** A component whose root is an element or a component, and that does not set
285
+ - **Fallthrough.** A component whose root is an element, a component or a `<component is>` over
286
+ tags (ADR-0119, in each `@case`), and that does not set
286
287
  `inheritAttrs: false`, declares `class` and `style` inputs and merges them into its root: the
287
288
  class among its parts, the style in one map after the root's own, so a property the consumer
288
289
  leaves `undefined` removes the root's, as Vue's merge does. The host clears both with
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { ANGULAR_MEMBERS, bindingById, formOf, memberOf, moduleMember, planCompo
11
11
  import { classRules } from "./rules.js";
12
12
  import { fallthroughRoot, template, templateReads } from "./template.js";
13
13
  import { declaredTypes } from "./types.js";
14
- import { Placeholders, addTypeImports, angularDialect, codeKind, codeNames, componentTypes, defineTarget, directiveSpecifier, exportDeclaration, exportsOf, importedDirectives, js, kebabCase, moduleHelperName, ownDirectives, printExpression, printProgram, rewriteCode, scopeRoots, sourceNames, typeDeclarationCode, typeExportsCode, typeNames } from "@unframework.dev/codegen";
14
+ import { Placeholders, addTypeImports, angularDialect, candidateAttributes, codeKind, codeNames, componentTypes, defineTarget, directiveSpecifier, exportDeclaration, exportsOf, importedDirectives, js, kebabCase, moduleHelperName, ownDirectives, printExpression, printProgram, rewriteCode, scopeRoots, sourceNames, typeDeclarationCode, typeExportsCode, typeNames } from "@unframework.dev/codegen";
15
15
  import { codeOf, functionsOf, walk } from "@unframework.dev/ir";
16
16
  /** The note the emulated cells share: why a listener's option needs a directive. */
17
17
  const OPTION_NOTE = "A template's `(event)` binding takes no listener options: the file declares an attribute directive per event and option (`[ufClickCapture]`) that listens with `Renderer2.listen` and re-emits the event (ADR-0047).";
@@ -238,7 +238,13 @@ function emitComponent(component, context) {
238
238
  for (const guard of listeners.guards) templateMembers.add(guard);
239
239
  for (const slot of reads.slots) templateMembers.add(slotQuery(slot));
240
240
  const root = fallthroughRoot(component.render);
241
- const fallthrough = component.inheritAttrs !== false && root !== void 0 && (root.kind === "Component" || angularDialect.literalRegion?.(root) === void 0);
241
+ const fallthrough = component.inheritAttrs !== false && root !== void 0 && (root.kind === "Component" || (root.kind === "Dynamic" ? root.candidates.every((candidate) => candidate.kind === "Tag" && angularDialect.literalRegion?.({
242
+ kind: "Element",
243
+ tag: candidate.tag,
244
+ attributes: candidateAttributes(root, candidate.tag),
245
+ children: root.children,
246
+ span: root.span
247
+ }) === void 0) : angularDialect.literalRegion?.(root) === void 0));
242
248
  const clearsHost = fallthrough || component.inheritAttrs === false;
243
249
  reportApiClashes(component, composition, fallthrough, context);
244
250
  const refObject = component.setup.some((item) => (item.kind === "Provide" || item.kind === "Inject" && item.fallback) && keyOf(plan, item.key).ref) ? imports.claim("refObject") : void 0;
package/dist/template.js CHANGED
@@ -158,13 +158,16 @@ function template(plan, listeners, reads, composition, models, fallthrough, scop
158
158
  return [plan.resolved === void 0 ? content : `${outer}@if (${plan.resolved}()) {\n${content}\n${outer}}`, ...selects].join("\n");
159
159
  }
160
160
  /**
161
- * The component's root (an element, or a fragment of one element or component), which a
162
- * consumer's `class` and `style` fall through to (ADR-0054), or none.
161
+ * The component's root (an element, or a fragment of one element, one component or one
162
+ * `<component is>` over tags, ADR-0119), which a consumer's `class` and `style` fall through to
163
+ * (ADR-0054), or none. A `<component is>` takes them in each `@case`.
163
164
  */
164
165
  function fallthroughRoot(render) {
165
166
  if (render.kind === "Element") return render;
166
167
  const [only] = render.children;
167
- return render.children.length === 1 && (only?.kind === "Element" || only?.kind === "Component") ? only : void 0;
168
+ if (render.children.length !== 1) return void 0;
169
+ if (only?.kind === "Element" || only?.kind === "Component") return only;
170
+ return only?.kind === "Dynamic" && only.candidates.every((each) => each.kind === "Tag") ? only : void 0;
168
171
  }
169
172
  /**
170
173
  * The render tree with the consumer's `class` and `style` inputs merged into the root
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unframework.dev/target-angular",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "The Angular 22 target of the Unframework compiler: emits idiomatic Angular components from the portable IR, declares their capabilities, and provides the toolchain the tests use.",
5
5
  "keywords": [
6
6
  "angular",
@@ -47,8 +47,8 @@
47
47
  "access": "public"
48
48
  },
49
49
  "dependencies": {
50
- "@unframework.dev/codegen": "0.2.0",
51
- "@unframework.dev/ir": "0.2.0"
50
+ "@unframework.dev/codegen": "0.3.0",
51
+ "@unframework.dev/ir": "0.3.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@angular/common": "22.2.1",