@hamur/adapter-angular 0.0.1 → 0.0.3

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.
@@ -151,7 +151,8 @@ function selectorOf(selectors) {
151
151
 
152
152
  // packages/adapter-angular/src/compile.ts
153
153
  var COMPILE_ID = /^(?!.*[\\/]node_modules[\\/]).*\.[cm]?ts$/;
154
- var LINK_ID = /[\\/]node_modules[\\/].+\.m?js$/;
154
+ var LINK_ID = /[\\/]node_modules[\\/](?:.+\.m?js|(?:.+[\\/])?@hamur[\\/][^\\/]+[\\/]src[\\/].+\.ts)$/;
155
+ var INSTALLED = /[\\/]node_modules[\\/]/;
155
156
  var SCRIPT = /\.[cm]?ts$/;
156
157
  var DECORATED = /^\s*@(?:Component|Directive|Pipe|NgModule|Injectable)\s*\(/m;
157
158
  var ENTRY = /^(?:(pages|layouts)\/.+|(app|error))\.[cm]?ts$/;
@@ -247,9 +248,18 @@ function workspaceRoot(rootDir, base) {
247
248
  const root = [...modulePackages(rootDir), real(dirname(import.meta.dir + "/../../src"))].reduce(commonDir, real(rootDir));
248
249
  return { rootDir: root, ...base.rootDirs ? { rootDirs: [...base.rootDirs, root] } : {} };
249
250
  }
250
- function rootNames(rootDir) {
251
+ function generatedTypes(buildDir) {
252
+ const file = join(buildDir, "types/hamur.d.ts");
253
+ return existsSync(file) ? [file] : [];
254
+ }
255
+ function rootNames({ rootDir, buildDir }) {
251
256
  const app = join(rootDir, "app");
252
- return [...existsSync(app) ? scripts(app) : [], ...ownComponents(), ...moduleComponents(rootDir)];
257
+ return [
258
+ ...existsSync(app) ? scripts(app) : [],
259
+ ...ownComponents(),
260
+ ...moduleComponents(rootDir),
261
+ ...generatedTypes(buildDir)
262
+ ];
253
263
  }
254
264
  var shown = (rootDir, file) => relative(rootDir, file).split(sep).join("/");
255
265
  function diagnosticProblem(typescript, diagnostic, rootDir) {
@@ -334,6 +344,8 @@ function compilerHost(ng, options, setup) {
334
344
  const entry = setup.files.get(key) ?? { code: "" };
335
345
  if (fileName.endsWith(".map"))
336
346
  entry.map = text;
347
+ else if (fileName.endsWith(".d.ts"))
348
+ entry.types = text;
337
349
  else if (/\.[cm]?js$/.test(fileName))
338
350
  entry.code = text.replace(MAP_COMMENT, "");
339
351
  else
@@ -361,16 +373,8 @@ function compilerHost(ng, options, setup) {
361
373
  };
362
374
  return host;
363
375
  }
364
- function problemsOf(ng, program, rootDir, check) {
365
- const problems = [
366
- ...program.getNgOptionDiagnostics(),
367
- ...program.getNgStructuralDiagnostics(),
368
- ...program.getNgSemanticDiagnostics()
369
- ].filter((diagnostic) => diagnostic.category === ng.ts.DiagnosticCategory.Error).map((diagnostic) => diagnosticProblem(ng.ts, diagnostic, rootDir));
370
- if (check)
371
- problems.push(...check(program.getTsProgram()));
372
- return problems;
373
- }
376
+ var errorsOf = (ng, diagnostics, rootDir) => diagnostics.filter((diagnostic) => diagnostic.category === ng.ts.DiagnosticCategory.Error).map((diagnostic) => diagnosticProblem(ng.ts, diagnostic, rootDir));
377
+ var programErrors = (ng, program, rootDir) => errorsOf(ng, [...program.getNgOptionDiagnostics(), ...program.getNgStructuralDiagnostics()], rootDir);
374
378
  function emitOnly(program, emits) {
375
379
  program.emit({
376
380
  emitCallback: ({
@@ -383,11 +387,43 @@ function emitOnly(program, emits) {
383
387
  }) => targetSourceFile && !emits(real(targetSourceFile.fileName)) ? { emitSkipped: true, diagnostics: [] } : tsProgram.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)
384
388
  });
385
389
  }
386
- async function emitProgram(ng, rootDir, roots, options, preprocessStyle, emits, check) {
390
+ function reuseSourceFiles(host, parsed, stampOfFile) {
391
+ const read = host.getSourceFile.bind(host);
392
+ host.getSourceFile = (fileName, language, onError, fresh) => {
393
+ const stamp = stampOfFile(fileName);
394
+ const hit = parsed.get(fileName);
395
+ if (hit && hit.stamp === stamp && !fresh)
396
+ return hit.file;
397
+ const file = read(fileName, language, onError, fresh);
398
+ if (!file)
399
+ return file;
400
+ const same = hit && !fresh && hit.file.text === file.text;
401
+ parsed.set(fileName, { stamp, file: same ? hit.file : file });
402
+ return same ? hit.file : file;
403
+ };
404
+ }
405
+ var buildSources = new WeakMap;
406
+ function releaseBuildSources() {
407
+ buildSources = new WeakMap;
408
+ }
409
+ function sourcesOf(ng) {
410
+ let parsed = buildSources.get(ng);
411
+ if (!parsed)
412
+ buildSources.set(ng, parsed = new Map);
413
+ return parsed;
414
+ }
415
+ async function emitProgram(ng, rootDir, roots, options, preprocessStyle, emits, parsed, check) {
387
416
  const files = new Map;
388
- const program = new ng.cli.NgtscProgram(roots, options, compilerHost(ng, options, { rootDir, preprocessStyle, files }));
417
+ const host = compilerHost(ng, options, { rootDir, preprocessStyle, files });
418
+ if (parsed)
419
+ reuseSourceFiles(host, parsed, stampOf);
420
+ const program = new ng.cli.NgtscProgram(roots, options, host);
389
421
  await program.loadNgStructureAsync();
390
- const problems = problemsOf(ng, program, rootDir, check);
422
+ const problems = [
423
+ ...programErrors(ng, program, rootDir),
424
+ ...errorsOf(ng, program.getNgSemanticDiagnostics(), rootDir),
425
+ ...check?.(program.getTsProgram()) ?? []
426
+ ];
391
427
  if (problems.length)
392
428
  throw new Error(problems.map((problem) => problem.line).join(`
393
429
  `));
@@ -435,7 +471,7 @@ function compilerOptions(typescript, ctx) {
435
471
  }
436
472
  var programs = new Map;
437
473
  function angularProgram(ctx) {
438
- const roots = rootNames(ctx.rootDir);
474
+ const roots = rootNames(ctx);
439
475
  const stamp = roots.map((file) => {
440
476
  const stat = statSync(file);
441
477
  return `${file}:${stat.size}:${stat.mtimeMs}`;
@@ -447,7 +483,7 @@ function angularProgram(ctx) {
447
483
  return hit.files;
448
484
  const app = `${real(ctx.rootDir)}${sep}`;
449
485
  const own = new Set([...ownComponents(), ...moduleComponents(ctx.rootDir)].map(real));
450
- const files = loadAngular(ctx.rootDir).then((ng) => emitProgram(ng, ctx.rootDir, roots, compilerOptions(ng.ts, ctx), ctx.preprocessStyle, (path) => path.startsWith(app) || own.has(path), (program) => defaultExportErrors(ng.ts, program, ctx.rootDir, roots)));
486
+ const files = loadAngular(ctx.rootDir).then((ng) => emitProgram(ng, ctx.rootDir, roots, compilerOptions(ng.ts, ctx), ctx.preprocessStyle, (path) => path.startsWith(app) && !INSTALLED.test(path) || own.has(path), ctx.dev ? undefined : sourcesOf(ng), (program) => defaultExportErrors(ng.ts, program, ctx.rootDir, roots)));
451
487
  programs.set(key, { stamp, files });
452
488
  return files;
453
489
  }
@@ -498,10 +534,12 @@ class AngularDevProgram {
498
534
  own;
499
535
  files = new Map;
500
536
  texts = new Map;
537
+ fileNames = new Map;
501
538
  resources = new Map;
502
539
  importers = new Map;
503
540
  sourceFiles = new Map;
504
541
  resourcesOf = new Map;
542
+ checked = new Map;
505
543
  broken = new Set;
506
544
  options;
507
545
  program;
@@ -517,7 +555,7 @@ class AngularDevProgram {
517
555
  this.own = new Set([...ownComponents(), ...moduleComponents(ctx.rootDir)].map(real));
518
556
  }
519
557
  emits(path) {
520
- return path.startsWith(this.root) && !path.startsWith(this.server) || this.own.has(path);
558
+ return path.startsWith(this.root) && !path.startsWith(this.server) && !INSTALLED.test(path) || this.own.has(path);
521
559
  }
522
560
  async load(path) {
523
561
  if (!this.emits(path))
@@ -535,12 +573,24 @@ class AngularDevProgram {
535
573
  throw this.failure;
536
574
  if (!this.texts.has(path))
537
575
  return;
538
- const problems = this.problems.filter((problem) => problem.file === undefined || problem.file === path || this.reads(path, problem.file));
576
+ const problems = await this.problemsOf(path);
539
577
  if (problems.length)
540
578
  throw new Error(problems.map((problem) => problem.line).join(`
541
579
  `));
542
580
  return this.files.get(path);
543
581
  }
582
+ async problemsOf(path) {
583
+ const { program } = this;
584
+ const fileName = this.fileNames.get(path);
585
+ let own = this.checked.get(path);
586
+ if (!own && program && fileName !== undefined) {
587
+ const ng = await loadAngular(this.ctx.rootDir);
588
+ own = errorsOf(ng, program.getNgSemanticDiagnostics(fileName), this.ctx.rootDir);
589
+ if (program === this.program)
590
+ this.checked.set(path, own);
591
+ }
592
+ return [...this.problems.filter((problem) => problem.file === undefined || problem.file === path), ...own ?? []];
593
+ }
544
594
  stale(path, text) {
545
595
  const compiled = this.texts.get(path);
546
596
  if (compiled !== undefined)
@@ -572,7 +622,10 @@ class AngularDevProgram {
572
622
  await next;
573
623
  const components = this.dependentsOf(path);
574
624
  const program = this.program;
575
- const failing = this.failure || !program ? components : components.filter((component) => this.problems.some((problem) => problem.file === component || !!problem.file && this.reads(component, problem.file)));
625
+ const failing = [];
626
+ for (const component of components)
627
+ if (this.failure || !program || (await this.problemsOf(component)).length)
628
+ failing.push(component);
576
629
  if (failing.length || !program) {
577
630
  for (const component of failing)
578
631
  this.broken.add(component);
@@ -626,7 +679,7 @@ class AngularDevProgram {
626
679
  async build(modified) {
627
680
  const ng = await loadAngular(this.ctx.rootDir);
628
681
  const options = this.options ??= compilerOptions(ng.ts, this.ctx);
629
- const roots = rootNames(this.ctx.rootDir);
682
+ const roots = rootNames(this.ctx);
630
683
  const written = new Map;
631
684
  const host = compilerHost(ng, options, {
632
685
  rootDir: this.ctx.rootDir,
@@ -641,17 +694,7 @@ class AngularDevProgram {
641
694
  }
642
695
  });
643
696
  host.getModifiedResourceFiles = () => new Set(modified);
644
- const read = host.getSourceFile.bind(host);
645
- host.getSourceFile = (fileName, language, onError, fresh) => {
646
- const stamp = /[\\/]node_modules[\\/]/.test(fileName) ? "" : stampOf(fileName);
647
- const hit = this.sourceFiles.get(fileName);
648
- if (hit && hit.stamp === stamp && !fresh)
649
- return hit.file;
650
- const file = read(fileName, language, onError, fresh);
651
- if (file)
652
- this.sourceFiles.set(fileName, { stamp, file });
653
- return file;
654
- };
697
+ reuseSourceFiles(host, this.sourceFiles, (file) => INSTALLED.test(file) ? "" : stampOf(file));
655
698
  for (const file of modified)
656
699
  this.resources.set(file, stampOf(file));
657
700
  const program = new ng.cli.NgtscProgram(roots, options, host, this.program);
@@ -672,7 +715,11 @@ class AngularDevProgram {
672
715
  if (resources.length)
673
716
  this.resourcesOf.set(real(source.fileName), new Set(resources.map(real)));
674
717
  }
675
- this.problems = problemsOf(ng, program, this.ctx.rootDir, (tsProgram) => defaultExportErrors(ng.ts, tsProgram, this.ctx.rootDir, roots));
718
+ this.checked.clear();
719
+ this.problems = [
720
+ ...programErrors(ng, program, this.ctx.rootDir),
721
+ ...defaultExportErrors(ng.ts, program.getTsProgram(), this.ctx.rootDir, roots)
722
+ ];
676
723
  emitOnly(program, (path) => this.emits(path));
677
724
  this.program = program;
678
725
  this.emitted = [...written.keys()].filter((file) => this.texts.has(file));
@@ -681,12 +728,15 @@ class AngularDevProgram {
681
728
  }
682
729
  record(program) {
683
730
  this.texts.clear();
731
+ this.fileNames.clear();
684
732
  for (const source of program.getTsProgram().getSourceFiles()) {
685
733
  if (source.isDeclarationFile)
686
734
  continue;
687
735
  const path = real(source.fileName);
688
- if (path.startsWith(this.root) || this.own.has(path))
689
- this.texts.set(path, source.text);
736
+ if (!path.startsWith(this.root) && !this.own.has(path))
737
+ continue;
738
+ this.texts.set(path, source.text);
739
+ this.fileNames.set(path, source.fileName);
690
740
  }
691
741
  }
692
742
  }
@@ -703,7 +753,7 @@ function compileGenerated(ctx, id, code) {
703
753
  if (hit?.hash === hash)
704
754
  return hit.emit;
705
755
  const emit = loadAngular(ctx.rootDir).then(async (ng) => {
706
- const files = await emitProgram(ng, ctx.rootDir, [path], { ...compilerOptions(ng.ts, ctx), _enableHmr: false }, ctx.preprocessStyle, (file) => file === path);
756
+ const files = await emitProgram(ng, ctx.rootDir, [path, ...generatedTypes(ctx.buildDir)], { ...compilerOptions(ng.ts, ctx), _enableHmr: false }, ctx.preprocessStyle, (file) => file === path, ctx.dev ? undefined : sourcesOf(ng));
707
757
  const emitted = files.get(path);
708
758
  if (!emitted)
709
759
  throw new Error(`${shown(ctx.rootDir, id)}: the Angular program emitted nothing for the generated module`);
@@ -906,6 +956,7 @@ var angularHooks = {
906
956
  close: () => {
907
957
  const { rootDir, buildDir } = useHamur().options;
908
958
  releaseDevProgram(rootDir, buildDir);
959
+ releaseBuildSources();
909
960
  }
910
961
  };
911
962
 
@@ -1,3 +1,6 @@
1
+ import * as i0 from "@angular/core";
1
2
  /** The one Angular root, inside the core's root element; it renders the tree's first entry. */
2
3
  export declare class HamurApp {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<HamurApp, never>;
5
+ static ɵcmp: i0.ɵɵComponentDeclaration<HamurApp, "hamur-app", never, {}, {}, never, never, true, never>;
3
6
  }
@@ -1,10 +1,13 @@
1
1
  import { InjectionToken, type Resource, type Signal } from "@angular/core";
2
+ import * as i0 from "@angular/core";
2
3
  /**
3
4
  * `<div *hamurDevOnly>…</div>` renders its template only in a dev build. A production client keeps the template's code:
4
5
  * a component named in it is a static import of the compiled one.
5
6
  */
6
7
  export declare class DevOnly {
7
8
  constructor();
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<DevOnly, never>;
10
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DevOnly, "[hamurDevOnly]", never, {}, {}, never, never, true, never>;
8
11
  }
9
12
  /**
10
13
  * The value of a promise a loader returned, as Angular's `Resource<T>`: read with `@if (value.hasValue()) … @else if
@@ -2,7 +2,11 @@ import type { AdapterBuildContext, AdapterTransform } from "hamur/adapter";
2
2
  export interface AngularEmit {
3
3
  code: string;
4
4
  map?: string;
5
+ /** The declarations, emitted by `compilePartial` only. */
6
+ types?: string;
5
7
  }
8
+ /** Drops the parsed files, which hold hundreds of megabytes, at the end of a build. */
9
+ export declare function releaseBuildSources(): void;
6
10
  /**
7
11
  * The app's program, shared by the client and server builds of one `hamur build`: the client and server steps
8
12
  * find the same roots unchanged and take the same emit; a later build in the process whose roots changed compiles again.
@@ -31,7 +35,8 @@ export interface AngularHotUpdate {
31
35
  /**
32
36
  * Built on the first load, then built again with the last good `NgtscProgram` as `oldProgram` when a load finds a
33
37
  * root whose text, or a resource whose stamp, changed. Unchanged source files keep their `ts.SourceFile`, so Angular reuses
34
- * their analysis and emits only the files the change reaches.
38
+ * their analysis and emits only the files the change reaches. A file is type-checked when it is loaded: checking the whole
39
+ * program takes over a second, and an error only shows on the file that has it.
35
40
  */
36
41
  export declare class AngularDevProgram {
37
42
  /** The real paths the last build emitted. */
@@ -44,6 +49,8 @@ export declare class AngularDevProgram {
44
49
  private readonly files;
45
50
  /** Real path of each source file of the program to the text it compiled. */
46
51
  private readonly texts;
52
+ /** Real path of each source file of the program to its name there. */
53
+ private readonly fileNames;
47
54
  /** Each resource the program read (templates, style files, a style file's imports) to its stamp when read. */
48
55
  private readonly resources;
49
56
  /** A style file's import to the style files that import it: Angular tracks the style file, not its imports. */
@@ -51,6 +58,8 @@ export declare class AngularDevProgram {
51
58
  private readonly sourceFiles;
52
59
  /** Real path of each component file to the real paths of the resources it reads (`getResourceDependencies`). */
53
60
  private readonly resourcesOf;
61
+ /** Real path of each file checked since the last build to its errors. */
62
+ private readonly checked;
54
63
  /** Component files a hot update left with errors. */
55
64
  private readonly broken;
56
65
  private options;
@@ -64,6 +73,7 @@ export declare class AngularDevProgram {
64
73
  private emits;
65
74
  /** The emit of `path` (a real path) after any build its load calls for; throws the program's errors for that file. */
66
75
  load(path: string): Promise<AngularEmit | undefined>;
76
+ private problemsOf;
67
77
  private stale;
68
78
  /** The stamps of the resources the components of `path` read, so `hamur dev`'s cache misses after an edit of one. */
69
79
  version(path: string): string;
@@ -93,5 +103,5 @@ export declare function compileStep(ctx: AdapterBuildContext): AdapterTransform;
93
103
  export declare function hydrationStep(): AdapterTransform;
94
104
  /** Angular's linker on a partial-compiled package file (`ɵɵngDeclare*`), kept per path and size for the life of the process. */
95
105
  export declare function linkStep(ctx: AdapterBuildContext): AdapterTransform;
96
- /** The package's own components in `compilationMode: "partial"`, as `scripts/release.ts` publishes them: real source path to JavaScript. */
97
- export declare function compilePartial(packageDir: string, from?: string): Promise<Map<string, string>>;
106
+ /** The package's own components in `compilationMode: "partial"`, as `scripts/release.ts` publishes them: real source path to JavaScript and declarations. */
107
+ export declare function compilePartial(packageDir: string, from?: string): Promise<Map<string, AngularEmit>>;
@@ -16,7 +16,7 @@ export interface AsyncDataResource<T, D = undefined> extends Resource<T | D> {
16
16
  export interface InjectAsyncDataOptions<T = unknown, R = T, K extends keyof T & string = never, D = T> extends Omit<AsyncDataOptions<T, R, D>, "pick"> {
17
17
  /** Signals (or any getters) whose change runs the handler again. `false` is accepted and does nothing: nothing watches implicitly. */
18
18
  watch?: ReadonlyArray<() => unknown> | false;
19
- getCachedData?: GetCachedData<T>;
19
+ getCachedData?: GetCachedData<NoInfer<T>>;
20
20
  /** Top-level keys of an object result to keep. */
21
21
  pick?: readonly K[];
22
22
  }
@@ -28,10 +28,10 @@ export declare function injectAsyncData<I, R, T = R, K extends keyof T & string
28
28
  default: () => D;
29
29
  }): AsyncDataResource<PickFrom<T, K>, D>;
30
30
  export declare function injectAsyncData<I, R, T = R, K extends keyof T & string = never>(fn: Handler<I, R>, input?: NoInfer<I> | (() => NoInfer<I>), options?: InjectAsyncDataOptions<T, R, K, undefined>): AsyncDataResource<PickFrom<T, K>>;
31
- export declare function injectAsyncData<T = unknown, R = T, K extends keyof T & string = never, D = T>(key: string | (() => string), handler: AsyncDataHandler<R>, options: InjectAsyncDataOptions<T, R, K, D> & {
31
+ export declare function injectAsyncData<R, T = R, K extends keyof T & string = never, D = T>(key: string | (() => string), handler: AsyncDataHandler<R>, options: InjectAsyncDataOptions<T, R, K, D> & {
32
32
  default: () => D;
33
33
  }): AsyncDataResource<PickFrom<T, K>, D>;
34
- export declare function injectAsyncData<T = unknown, R = T, K extends keyof T & string = never>(key: string | (() => string), handler: AsyncDataHandler<R>, options?: InjectAsyncDataOptions<T, R, K, undefined>): AsyncDataResource<PickFrom<T, K>>;
34
+ export declare function injectAsyncData<R, T = R, K extends keyof T & string = never>(key: string | (() => string), handler: AsyncDataHandler<R>, options?: InjectAsyncDataOptions<T, R, K, undefined>): AsyncDataResource<PickFrom<T, K>>;
35
35
  /** What a literal `injectFetch` call is checked against; any other call stays loose. */
36
36
  type FetchInput<X> = X extends {
37
37
  key: infer K extends string;
@@ -1,5 +1,8 @@
1
1
  import type { ErrorPageProps } from "hamur/app";
2
+ import * as i0 from "@angular/core";
2
3
  export default class DefaultErrorPage {
3
- readonly error: import("@angular/core/types/core").InputSignal<ErrorPageProps>;
4
- readonly clearError: import("@angular/core/types/core").InputSignal<(() => void) | undefined>;
4
+ readonly error: import("@angular/core").InputSignal<ErrorPageProps>;
5
+ readonly clearError: import("@angular/core").InputSignal<(() => void) | undefined>;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<DefaultErrorPage, never>;
7
+ static ɵcmp: i0.ɵɵComponentDeclaration<DefaultErrorPage, "ng-component", never, { "error": { "alias": "error"; "required": true; "isSignal": true; }; "clearError": { "alias": "clearError"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
5
8
  }
@@ -1,6 +1,7 @@
1
1
  import { type Signal } from "@angular/core";
2
- import type { ActionOptions, ActionRunner, FormStatus, Handler } from "hamur/adapter";
3
- import type { ActionFailure, FieldsOf, HamurError, PendingRun, RouteLocation } from "hamur/app";
2
+ import type { ActionOptions, ActionRunner, ActionValue, FailureOf, FormStatus, Handler } from "hamur/adapter";
3
+ import type { FieldsOf, HamurError, PendingRun, RouteLocation } from "hamur/app";
4
+ import * as i0 from "@angular/core";
4
5
  type FormHandler = Handler<any, any>;
5
6
  type FormAction = string | RouteLocation | FormHandler;
6
7
  /**
@@ -8,15 +9,15 @@ type FormAction = string | RouteLocation | FormHandler;
8
9
  * `<form>`; with a handler it posts to the page with `_fn=<id>` without JavaScript and calls the handler's stub with it.
9
10
  */
10
11
  export declare class Form {
11
- readonly action: import("@angular/core/types/core.js").InputSignalWithTransform<FormAction | undefined, FormAction | undefined>;
12
- readonly method: import("@angular/core/types/core.js").InputSignal<"get" | "post" | undefined>;
13
- readonly encType: import("@angular/core/types/core.js").InputSignal<"application/x-www-form-urlencoded" | "multipart/form-data" | undefined>;
14
- readonly replace: import("@angular/core/types/core.js").InputSignalWithTransform<boolean, unknown>;
15
- readonly reset: import("@angular/core/types/core.js").InputSignalWithTransform<boolean, unknown>;
16
- readonly reloadDocument: import("@angular/core/types/core.js").InputSignalWithTransform<boolean, unknown>;
17
- readonly refresh: import("@angular/core/types/core.js").InputSignalWithTransform<boolean | undefined, unknown>;
18
- readonly restore: import("@angular/core/types/core.js").InputSignalWithTransform<boolean, unknown>;
19
- readonly instance: import("@angular/core/types/core.js").InputSignal<string | number | undefined>;
12
+ readonly action: import("@angular/core").InputSignalWithTransform<FormAction | undefined, FormAction | undefined>;
13
+ readonly method: import("@angular/core").InputSignal<"get" | "post" | undefined>;
14
+ readonly encType: import("@angular/core").InputSignal<"application/x-www-form-urlencoded" | "multipart/form-data" | undefined>;
15
+ readonly replace: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
16
+ readonly reset: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
17
+ readonly reloadDocument: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
18
+ readonly refresh: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
19
+ readonly restore: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
20
+ readonly instance: import("@angular/core").InputSignal<string | number | undefined>;
20
21
  private readonly app;
21
22
  private readonly route;
22
23
  private readonly router;
@@ -31,6 +32,8 @@ export declare class Form {
31
32
  /** The handler, `refresh` and `instance` of the moment of the submission, as `action` and `_fn` show them. */
32
33
  private post;
33
34
  protected flag(value: boolean): "" | null;
35
+ static ɵfac: i0.ɵɵFactoryDeclaration<Form, never>;
36
+ static ɵdir: i0.ɵɵDirectiveDeclaration<Form, "form[hamurForm]", never, { "action": { "alias": "hamurForm"; "required": false; "isSignal": true; }; "method": { "alias": "method"; "required": false; "isSignal": true; }; "encType": { "alias": "encType"; "required": false; "isSignal": true; }; "replace": { "alias": "replace"; "required": false; "isSignal": true; }; "reset": { "alias": "reset"; "required": false; "isSignal": true; }; "reloadDocument": { "alias": "reloadDocument"; "required": false; "isSignal": true; }; "refresh": { "alias": "refresh"; "required": false; "isSignal": true; }; "restore": { "alias": "restore"; "required": false; "isSignal": true; }; "instance": { "alias": "instance"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
34
37
  }
35
38
  /** The run of the `Form` the component is created in; idle outside one. */
36
39
  export declare function injectFormStatus(): Signal<FormStatus>;
@@ -50,10 +53,10 @@ export interface InjectFormResult<I, O> extends InjectFormInstance<I, O> {
50
53
  export declare function injectForm<I, O>(fn: Handler<I, O>): InjectFormResult<I, O>;
51
54
  export interface InjectActionResult<I, O> {
52
55
  readonly run: ActionRunner<I, O>["run"];
53
- readonly state: Signal<O | undefined>;
56
+ readonly state: Signal<ActionValue<O> | undefined>;
54
57
  readonly pending: Signal<boolean>;
55
58
  readonly error: Signal<HamurError | undefined>;
56
- readonly failure: Signal<ActionFailure | undefined>;
59
+ readonly failure: Signal<FailureOf<O> | undefined>;
57
60
  reset(): void;
58
61
  }
59
62
  /** Runs `fn` one call after another; below a `Form` of `fn` it shows that form's posts. */
@@ -9,6 +9,6 @@ declare module "hamur" {
9
9
  }
10
10
  /**
11
11
  * `modules:done` serves `/@ng/component`; `dev:change` sends the update, or lists the components
12
- * that read the file as dependents with `hmr` off, and with it on those a template error is shown in; `close` drops the program.
12
+ * that read the file as dependents with `hmr` off, and with it on those a template error is shown in; `close` drops the program and what the build parsed.
13
13
  */
14
14
  export declare const angularHooks: NonNullable<Adapter["hooks"]>;
@@ -1,5 +1,6 @@
1
1
  import { type OnInit, type Signal } from "@angular/core";
2
2
  import type { AnnouncerActions, AnnouncerPoliteness, LoadingIndicatorActions, LoadingIndicatorOptions, RouteAnnouncerActions, RouteAnnouncerPoliteness } from "hamur/adapter";
3
+ import * as i0 from "@angular/core";
3
4
  /** The bar's state as signals, and its `start`, `finish`, `set` and `clear`; it follows the navigation while a component that called it is alive. */
4
5
  export declare function injectLoadingIndicator(options?: LoadingIndicatorOptions): {
5
6
  progress: Signal<number>;
@@ -11,15 +12,17 @@ export declare function injectLoadingIndicator(options?: LoadingIndicatorOptions
11
12
  * written through `element.style` after the first render, so the server's element has no `style` attribute.
12
13
  */
13
14
  export declare class LoadingIndicator implements OnInit {
14
- readonly color: import("@angular/core/types/core.js").InputSignal<string | undefined>;
15
- readonly errorColor: import("@angular/core/types/core.js").InputSignal<string | undefined>;
16
- readonly height: import("@angular/core/types/core.js").InputSignal<number | undefined>;
17
- readonly duration: import("@angular/core/types/core.js").InputSignal<number | undefined>;
18
- readonly throttle: import("@angular/core/types/core.js").InputSignal<number | undefined>;
19
- readonly estimatedProgress: import("@angular/core/types/core.js").InputSignal<((duration: number, elapsed: number) => number) | undefined>;
15
+ readonly color: import("@angular/core").InputSignal<string | undefined>;
16
+ readonly errorColor: import("@angular/core").InputSignal<string | undefined>;
17
+ readonly height: import("@angular/core").InputSignal<number | undefined>;
18
+ readonly duration: import("@angular/core").InputSignal<number | undefined>;
19
+ readonly throttle: import("@angular/core").InputSignal<number | undefined>;
20
+ readonly estimatedProgress: import("@angular/core").InputSignal<((duration: number, elapsed: number) => number) | undefined>;
20
21
  private readonly injector;
21
22
  private readonly element;
22
23
  ngOnInit(): void;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<LoadingIndicator, never>;
25
+ static ɵcmp: i0.ɵɵComponentDeclaration<LoadingIndicator, "hamur-loading-indicator", never, { "color": { "alias": "color"; "required": false; "isSignal": true; }; "errorColor": { "alias": "errorColor"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "duration": { "alias": "duration"; "required": false; "isSignal": true; }; "throttle": { "alias": "throttle"; "required": false; "isSignal": true; }; "estimatedProgress": { "alias": "estimatedProgress"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
23
26
  }
24
27
  /** The page's route announcer as signals, and `set`, `polite` and `assertive`. */
25
28
  export declare function injectRouteAnnouncer(): {
@@ -32,7 +35,7 @@ export declare function injectRouteAnnouncer(): {
32
35
  * element keeps it visible.
33
36
  */
34
37
  export declare class RouteAnnouncer {
35
- readonly politeness: import("@angular/core/types/core.js").InputSignal<RouteAnnouncerPoliteness | undefined>;
38
+ readonly politeness: import("@angular/core").InputSignal<RouteAnnouncerPoliteness | undefined>;
36
39
  protected readonly id: string;
37
40
  private readonly store;
38
41
  private readonly state;
@@ -42,9 +45,11 @@ export declare class RouteAnnouncer {
42
45
  private readonly tick;
43
46
  protected readonly message: Signal<string>;
44
47
  protected readonly live: Signal<RouteAnnouncerPoliteness>;
45
- protected readonly role: Signal<"alert" | "status" | undefined>;
48
+ protected readonly role: Signal<"status" | "alert" | undefined>;
46
49
  protected readonly owner: Signal<boolean>;
47
50
  constructor();
51
+ static ɵfac: i0.ɵɵFactoryDeclaration<RouteAnnouncer, never>;
52
+ static ɵcmp: i0.ɵɵComponentDeclaration<RouteAnnouncer, "hamur-route-announcer", never, { "politeness": { "alias": "politeness"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
48
53
  }
49
54
  /** The page's announcer as signals, and `set`, `polite` and `assertive` (`polite` unless `politeness` says otherwise). */
50
55
  export declare function injectAnnouncer({ politeness }?: {
@@ -66,4 +71,6 @@ export declare class Announcer {
66
71
  private readonly polite;
67
72
  private readonly assertive;
68
73
  constructor();
74
+ static ɵfac: i0.ɵɵFactoryDeclaration<Announcer, never>;
75
+ static ɵcmp: i0.ɵɵComponentDeclaration<Announcer, "hamur-announcer", never, {}, {}, never, never, true, never>;
69
76
  }
@@ -1,5 +1,6 @@
1
1
  import { InjectionToken, Renderer2, type OnInit, type TemplateRef, type Type } from "@angular/core";
2
2
  import type { IslandOn } from "hamur/adapter";
3
+ import * as i0 from "@angular/core";
3
4
  /** A component that writes its own nodes below its host: a template it renders there is a view the application checks. */
4
5
  export declare abstract class HostWriter {
5
6
  protected readonly host: HTMLElement;
@@ -19,15 +20,15 @@ export declare const HAMUR_ISLAND_ELEMENT: InjectionToken<string>;
19
20
  */
20
21
  export declare class Island extends HostWriter implements OnInit {
21
22
  /** The default export of a file under `app/islands/`. */
22
- readonly component: import("@angular/core/types/core.js").InputSignal<Type<unknown>>;
23
- readonly props: import("@angular/core/types/core.js").InputSignal<Record<string, unknown> | undefined>;
23
+ readonly component: import("@angular/core").InputSignal<Type<unknown>>;
24
+ readonly props: import("@angular/core").InputSignal<Record<string, unknown> | undefined>;
24
25
  /** The island directive: when the island hydrates, `"only"` to mount it in the browser alone, or a directive a module adds; default `"load"`. */
25
- readonly on: import("@angular/core/types/core.js").InputSignal<IslandOn | undefined>;
26
- readonly fallback: import("@angular/core/types/core.js").InputSignal<TemplateRef<unknown> | undefined>;
26
+ readonly on: import("@angular/core").InputSignal<IslandOn | undefined>;
27
+ readonly fallback: import("@angular/core").InputSignal<TemplateRef<unknown> | undefined>;
27
28
  /** The island's id across swaps; a swap to a page with the same id keeps its element and state. */
28
- readonly persist: import("@angular/core/types/core.js").InputSignal<string | undefined>;
29
+ readonly persist: import("@angular/core").InputSignal<string | undefined>;
29
30
  /** With `persist`, a swap keeps the island's old props. */
30
- readonly persistProps: import("@angular/core/types/core.js").InputSignalWithTransform<boolean, unknown>;
31
+ readonly persistProps: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
31
32
  private readonly app;
32
33
  private readonly id;
33
34
  private readonly tasks;
@@ -36,4 +37,6 @@ export declare class Island extends HostWriter implements OnInit {
36
37
  private readonly element;
37
38
  constructor();
38
39
  ngOnInit(): void;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<Island, never>;
41
+ static ɵcmp: i0.ɵɵComponentDeclaration<Island, "hamur-island", never, { "component": { "alias": "component"; "required": true; "isSignal": true; }; "props": { "alias": "props"; "required": false; "isSignal": true; }; "on": { "alias": "on"; "required": false; "isSignal": true; }; "fallback": { "alias": "fallback"; "required": false; "isSignal": true; }; "persist": { "alias": "persist"; "required": false; "isSignal": true; }; "persistProps": { "alias": "persistProps"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
39
42
  }
@@ -1,6 +1,7 @@
1
1
  import { type Signal } from "@angular/core";
2
2
  import type { RouteLocation, ViewTransitionCall } from "hamur/app";
3
3
  import type { CheckedTarget, LinkSlot, Navigation, PrefetchOn, UseLinkOptions } from "hamur/adapter";
4
+ import * as i0 from "@angular/core";
4
5
  type AriaCurrent = "page" | "step" | "location" | "date" | "time" | "true";
5
6
  type Query = (prev: never) => Record<string, unknown>;
6
7
  /**
@@ -8,33 +9,33 @@ type Query = (prev: never) => Record<string, unknown>;
8
9
  * core navigator takes the click. A `target`, `rel` or `aria-current` written on the element stays.
9
10
  */
10
11
  export declare class Link<T extends string = string> {
11
- readonly to: import("@angular/core/types/core.js").InputSignal<T | ({
12
+ readonly to: import("@angular/core").InputSignal<({
12
13
  name: string;
13
14
  query?: Record<string, string | string[]>;
14
15
  hash?: string;
15
16
  } & {
16
17
  params?: Record<string, string | string[]> | undefined;
17
- })>;
18
- readonly replace: import("@angular/core/types/core.js").InputSignalWithTransform<boolean, unknown>;
19
- readonly prefetch: import("@angular/core/types/core.js").InputSignalWithTransform<boolean | undefined, unknown>;
20
- readonly prefetchOn: import("@angular/core/types/core.js").InputSignal<PrefetchOn | undefined>;
21
- readonly prefetchDelay: import("@angular/core/types/core.js").InputSignalWithTransform<number | undefined, unknown>;
22
- readonly viewTransition: import("@angular/core/types/core.js").InputSignal<ViewTransitionCall | undefined>;
23
- readonly query: import("@angular/core/types/core.js").InputSignal<Query | undefined>;
24
- readonly state: import("@angular/core/types/core.js").InputSignal<Record<string, unknown> | undefined>;
25
- readonly relative: import("@angular/core/types/core.js").InputSignal<"route" | undefined>;
26
- readonly mask: import("@angular/core/types/core.js").InputSignal<string | undefined>;
27
- readonly unmaskOnReload: import("@angular/core/types/core.js").InputSignalWithTransform<boolean | undefined, unknown>;
28
- readonly activeClass: import("@angular/core/types/core.js").InputSignal<string | undefined>;
29
- readonly exactActiveClass: import("@angular/core/types/core.js").InputSignal<string | undefined>;
30
- readonly pendingClass: import("@angular/core/types/core.js").InputSignal<string | undefined>;
31
- readonly prefetchedClass: import("@angular/core/types/core.js").InputSignal<string | undefined>;
32
- readonly ariaCurrentValue: import("@angular/core/types/core.js").InputSignal<AriaCurrent>;
33
- readonly external: import("@angular/core/types/core.js").InputSignalWithTransform<boolean, unknown>;
34
- readonly noRel: import("@angular/core/types/core.js").InputSignalWithTransform<boolean, unknown>;
35
- readonly scroll: import("@angular/core/types/core.js").InputSignalWithTransform<boolean | undefined, unknown>;
36
- readonly keepFocus: import("@angular/core/types/core.js").InputSignalWithTransform<boolean, unknown>;
37
- readonly beforeNavigate: import("@angular/core/types/_api-chunk.js").OutputEmitterRef<Navigation>;
18
+ }) | T>;
19
+ readonly replace: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
20
+ readonly prefetch: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
21
+ readonly prefetchOn: import("@angular/core").InputSignal<PrefetchOn | undefined>;
22
+ readonly prefetchDelay: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
23
+ readonly viewTransition: import("@angular/core").InputSignal<ViewTransitionCall | undefined>;
24
+ readonly query: import("@angular/core").InputSignal<Query | undefined>;
25
+ readonly state: import("@angular/core").InputSignal<Record<string, unknown> | undefined>;
26
+ readonly relative: import("@angular/core").InputSignal<"route" | undefined>;
27
+ readonly mask: import("@angular/core").InputSignal<string | undefined>;
28
+ readonly unmaskOnReload: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
29
+ readonly activeClass: import("@angular/core").InputSignal<string | undefined>;
30
+ readonly exactActiveClass: import("@angular/core").InputSignal<string | undefined>;
31
+ readonly pendingClass: import("@angular/core").InputSignal<string | undefined>;
32
+ readonly prefetchedClass: import("@angular/core").InputSignal<string | undefined>;
33
+ readonly ariaCurrentValue: import("@angular/core").InputSignal<AriaCurrent>;
34
+ readonly external: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
35
+ readonly noRel: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
36
+ readonly scroll: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
37
+ readonly keepFocus: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
38
+ readonly beforeNavigate: import("@angular/core").OutputEmitterRef<Navigation>;
38
39
  private readonly app;
39
40
  private readonly route;
40
41
  private readonly resolve;
@@ -55,6 +56,8 @@ export declare class Link<T extends string = string> {
55
56
  private readonly attrs;
56
57
  constructor();
57
58
  protected attr(name: string): string | undefined;
59
+ static ɵfac: i0.ɵɵFactoryDeclaration<Link<any>, never>;
60
+ static ɵdir: i0.ɵɵDirectiveDeclaration<Link<any>, "a[hamurLink]", never, { "to": { "alias": "hamurLink"; "required": true; "isSignal": true; }; "replace": { "alias": "replace"; "required": false; "isSignal": true; }; "prefetch": { "alias": "prefetch"; "required": false; "isSignal": true; }; "prefetchOn": { "alias": "prefetchOn"; "required": false; "isSignal": true; }; "prefetchDelay": { "alias": "prefetchDelay"; "required": false; "isSignal": true; }; "viewTransition": { "alias": "viewTransition"; "required": false; "isSignal": true; }; "query": { "alias": "query"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "relative": { "alias": "relative"; "required": false; "isSignal": true; }; "mask": { "alias": "mask"; "required": false; "isSignal": true; }; "unmaskOnReload": { "alias": "unmaskOnReload"; "required": false; "isSignal": true; }; "activeClass": { "alias": "activeClass"; "required": false; "isSignal": true; }; "exactActiveClass": { "alias": "exactActiveClass"; "required": false; "isSignal": true; }; "pendingClass": { "alias": "pendingClass"; "required": false; "isSignal": true; }; "prefetchedClass": { "alias": "prefetchedClass"; "required": false; "isSignal": true; }; "ariaCurrentValue": { "alias": "ariaCurrentValue"; "required": false; "isSignal": true; }; "external": { "alias": "external"; "required": false; "isSignal": true; }; "noRel": { "alias": "noRel"; "required": false; "isSignal": true; }; "scroll": { "alias": "scroll"; "required": false; "isSignal": true; }; "keepFocus": { "alias": "keepFocus"; "required": false; "isSignal": true; }; }, { "beforeNavigate": "beforeNavigate"; }, never, never, true, never>;
58
61
  }
59
62
  /** The `LinkSlot` of a link to `to`, for an element that renders its own `<a>`; `app.link` sets its defaults. */
60
63
  export declare function injectLink<T extends string = string>(to: CheckedTarget<T> | RouteLocation | (() => CheckedTarget<T> | RouteLocation), options?: UseLinkOptions | (() => UseLinkOptions)): Signal<LinkSlot>;