@primate/angular 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/lib/app.d.ts +5 -0
  2. package/lib/index.d.ts +3 -0
  3. package/lib/private/INITIAL_PROPS.d.ts +1 -1
  4. package/lib/private/client/AAA.d.ts +2 -0
  5. package/lib/private/client/AAA.js +2 -0
  6. package/lib/private/client/Data.d.ts +5 -0
  7. package/lib/private/client/Data.js +2 -0
  8. package/lib/private/client/Payload.d.ts +9 -0
  9. package/lib/private/client/Payload.js +2 -0
  10. package/lib/private/client/Validated.d.ts +2 -3
  11. package/lib/private/client/app.d.ts +7 -0
  12. package/lib/private/client/app.js +52 -0
  13. package/lib/private/client/field.d.ts +25 -0
  14. package/lib/private/client/{validate.js → field.js} +5 -5
  15. package/lib/private/client/form.d.ts +24 -0
  16. package/lib/private/client/form.js +47 -0
  17. package/lib/private/client/index.d.ts +29 -14
  18. package/lib/private/client/index.js +4 -68
  19. package/lib/private/client/root.d.ts +18 -0
  20. package/lib/private/client/root.js +17 -0
  21. package/lib/private/create-root.js +6 -1
  22. package/lib/private/default.d.ts +7 -0
  23. package/lib/private/{Default.js → default.js} +18 -20
  24. package/lib/private/init.d.ts +6 -0
  25. package/lib/private/{Runtime.js → init.js} +13 -14
  26. package/lib/private/request/store.d.ts +4 -0
  27. package/lib/private/request/store.js +4 -0
  28. package/lib/private/runtime.d.ts +7 -0
  29. package/lib/private/runtime.js +4 -0
  30. package/lib/public/app.d.ts +2 -0
  31. package/lib/public/app.js +2 -0
  32. package/lib/public/browser.d.ts +1 -1
  33. package/lib/public/browser.js +1 -1
  34. package/lib/public/client.d.ts +3 -0
  35. package/lib/public/client.js +2 -0
  36. package/lib/public/default.d.ts +1 -3
  37. package/lib/public/default.js +1 -2
  38. package/lib/public/runtime.d.ts +1 -3
  39. package/lib/public/runtime.js +1 -2
  40. package/package.json +29 -26
  41. package/lib/private/Default.d.ts +0 -17
  42. package/lib/private/Runtime.d.ts +0 -15
  43. package/lib/private/client/validate.d.ts +0 -25
  44. package/lib/public/Validated.d.ts +0 -2
  45. package/lib/public/Validated.js +0 -2
  46. package/lib/public/validate.d.ts +0 -2
  47. package/lib/public/validate.js +0 -2
package/lib/app.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ declare module "app:angular" {
2
+ import type { RequestPublic } from "@primate/core";
3
+ import type { Signal } from "@angular/core";
4
+ export const request: Signal<RequestPublic>;
5
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import "./app.d.ts";
2
+
3
+ export { default } from "./public/default";
@@ -1,5 +1,5 @@
1
1
  import { InjectionToken } from "@angular/core";
2
- import type Dict from "@rcompat/type/Dict";
2
+ import type { Dict } from "@rcompat/type";
3
3
  type RootProps = {
4
4
  views: any[];
5
5
  props: Dict[];
@@ -0,0 +1,2 @@
1
+ import "@angular/compiler";
2
+ //# sourceMappingURL=AAA.d.ts.map
@@ -0,0 +1,2 @@
1
+ import "@angular/compiler";
2
+ //# sourceMappingURL=AAA.js.map
@@ -0,0 +1,5 @@
1
+ import type Payload from "#client/Payload";
2
+ import type { Data as CoreData } from "@primate/core/client";
3
+ type Data = CoreData<Payload>;
4
+ export default Data;
5
+ //# sourceMappingURL=Data.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Data.js.map
@@ -0,0 +1,9 @@
1
+ import type { Mode } from "@primate/core";
2
+ import type { Dict } from "@rcompat/type";
3
+ type Payload = {
4
+ views: string[];
5
+ props: Dict[];
6
+ mode: Mode;
7
+ };
8
+ export default Payload;
9
+ //# sourceMappingURL=Payload.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Payload.js.map
@@ -1,6 +1,5 @@
1
- import { type Signal } from "@angular/core";
2
- import type ValidateUpdater from "@primate/core/client/ValidateUpdater";
3
- import type ValidationError from "@primate/core/client/ValidationError";
1
+ import type { Signal } from "@angular/core";
2
+ import type { ValidateUpdater, ValidationError } from "@primate/core/client";
4
3
  type Validated<T> = {
5
4
  error: Signal<null | ValidationError>;
6
5
  loading: Signal<boolean>;
@@ -0,0 +1,7 @@
1
+ import "#client/AAA";
2
+ import type Data from "#client/Data";
3
+ export default class AngularApp {
4
+ #private;
5
+ static mount(_view: string, data: Data): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1,52 @@
1
+ import "#client/AAA";
2
+ import root from "#client/root";
3
+ import INITIAL_PROPS from "#INITIAL_PROPS";
4
+ import { enableProdMode } from "@angular/core";
5
+ import { bootstrapApplication, provideClientHydration, } from "@angular/platform-browser";
6
+ import client from "@primate/core/client";
7
+ import RootView from "angular:root";
8
+ export default class AngularApp {
9
+ static #app;
10
+ static #root;
11
+ static async mount(_view, data) {
12
+ if (data.mode === "production")
13
+ enableProdMode();
14
+ const providers = [];
15
+ if (data.ssr)
16
+ providers.push(provideClientHydration());
17
+ else
18
+ document.body.appendChild(document.createElement("app-root"));
19
+ const props = root.toProps(data);
20
+ try {
21
+ this.#app = await bootstrapApplication(RootView, {
22
+ providers: [
23
+ ...providers,
24
+ {
25
+ provide: INITIAL_PROPS,
26
+ useValue: props,
27
+ },
28
+ ],
29
+ });
30
+ this.#root = this.#app.components[0];
31
+ this.#root.instance.p = props;
32
+ this.#app.tick();
33
+ if (data.spa) {
34
+ const start = () => client.boot((next, update) => {
35
+ this.#root.instance.p = root.toProps(next, update);
36
+ this.#app.tick();
37
+ update?.();
38
+ });
39
+ if (document.readyState === "loading") {
40
+ window.addEventListener("DOMContentLoaded", start, { once: true });
41
+ }
42
+ else {
43
+ start();
44
+ }
45
+ }
46
+ }
47
+ catch (error) {
48
+ console.error("Failed to bootstrap Angular application:", error);
49
+ }
50
+ }
51
+ }
52
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1,25 @@
1
+ import type Validated from "#client/Validated";
2
+ declare const field: <T>(initial: T) => {
3
+ delete: (url: string, options?: {
4
+ headers?: import("@rcompat/type").Dict<string>;
5
+ map?: ((v: T) => import("@rcompat/type").JSONValue) | undefined;
6
+ path?: import("@rcompat/type").JSONPointer;
7
+ } | undefined) => Validated<T>;
8
+ patch: (url: string, options?: {
9
+ headers?: import("@rcompat/type").Dict<string>;
10
+ map?: ((v: T) => import("@rcompat/type").JSONValue) | undefined;
11
+ path?: import("@rcompat/type").JSONPointer;
12
+ } | undefined) => Validated<T>;
13
+ post: (url: string, options?: {
14
+ headers?: import("@rcompat/type").Dict<string>;
15
+ map?: ((v: T) => import("@rcompat/type").JSONValue) | undefined;
16
+ path?: import("@rcompat/type").JSONPointer;
17
+ } | undefined) => Validated<T>;
18
+ put: (url: string, options?: {
19
+ headers?: import("@rcompat/type").Dict<string>;
20
+ map?: ((v: T) => import("@rcompat/type").JSONValue) | undefined;
21
+ path?: import("@rcompat/type").JSONPointer;
22
+ } | undefined) => Validated<T>;
23
+ };
24
+ export default field;
25
+ //# sourceMappingURL=field.d.ts.map
@@ -1,6 +1,5 @@
1
1
  import { signal } from "@angular/core";
2
- import toValidated from "@primate/core/client/toValidated";
3
- import validate from "@primate/core/client/validate";
2
+ import client from "@primate/core/client";
4
3
  function useValidate(init) {
5
4
  const value = signal(init.initial);
6
5
  const loading = signal(false);
@@ -12,7 +11,7 @@ function useValidate(init) {
12
11
  loading.set(true);
13
12
  error.set(null);
14
13
  try {
15
- await validate(init, next);
14
+ await client.validateField(init, next);
16
15
  }
17
16
  catch (e) {
18
17
  // rollback
@@ -25,5 +24,6 @@ function useValidate(init) {
25
24
  }
26
25
  return { error, loading, update, value };
27
26
  }
28
- export default toValidated(useValidate);
29
- //# sourceMappingURL=validate.js.map
27
+ const field = client.toValidated(useValidate);
28
+ export default field;
29
+ //# sourceMappingURL=field.js.map
@@ -0,0 +1,24 @@
1
+ import type { Signal } from "@angular/core";
2
+ import type { FormInit } from "@primate/core/client";
3
+ import type { Dict } from "@rcompat/type";
4
+ type Field<T> = {
5
+ name: string;
6
+ value: T;
7
+ errors: Signal<readonly string[]>;
8
+ error: Signal<string | null>;
9
+ };
10
+ type FormView<Values extends Dict> = {
11
+ id: string;
12
+ submitting: Signal<boolean>;
13
+ submitted: Signal<boolean>;
14
+ submit: (event?: Event) => Promise<void>;
15
+ errors: Signal<readonly string[]>;
16
+ field: <K extends keyof Values & string>(name: K) => Field<Values[K]>;
17
+ };
18
+ type Initial<Values extends Dict> = FormInit & {
19
+ initial?: Values;
20
+ };
21
+ declare function form<Values extends Dict>(init: Initial<Values>): FormView<Values>;
22
+ declare function form(init?: FormInit): FormView<Dict>;
23
+ export default form;
24
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { DestroyRef, computed, inject, signal } from "@angular/core";
2
+ import core from "@primate/core/client";
3
+ function try_destroy_ref() {
4
+ try {
5
+ return inject(DestroyRef);
6
+ }
7
+ catch {
8
+ return null;
9
+ }
10
+ }
11
+ function form(init) {
12
+ const { initial, ...form_init } = (init ?? {});
13
+ const controller = core.createForm(form_init);
14
+ const values = (initial ?? {});
15
+ const snap = signal(controller.read());
16
+ const unsub = controller.subscribe((next) => snap.set(next));
17
+ try_destroy_ref()?.onDestroy(unsub);
18
+ const submitting = computed(() => snap().submitting);
19
+ const submitted = computed(() => snap().submitted);
20
+ const errors = computed(() => snap().errors.form);
21
+ const cache = new Map();
22
+ function field(name) {
23
+ const key = name;
24
+ const cached = cache.get(key);
25
+ if (cached)
26
+ return cached;
27
+ const form_errors = computed(() => snap().errors.fields[key] ?? []);
28
+ const view = {
29
+ name: key,
30
+ value: values[name],
31
+ errors: form_errors,
32
+ error: computed(() => form_errors()[0] ?? null),
33
+ };
34
+ cache.set(key, view);
35
+ return view;
36
+ }
37
+ return {
38
+ id: controller.id,
39
+ submitting,
40
+ submitted,
41
+ submit: (event) => controller.submit(event),
42
+ errors,
43
+ field,
44
+ };
45
+ }
46
+ export default form;
47
+ //# sourceMappingURL=form.js.map
@@ -1,15 +1,30 @@
1
- import "@angular/compiler";
2
- import type ClientData from "@primate/core/client/Data";
3
- import type Mode from "@primate/core/Mode";
4
- import type Dict from "@rcompat/type/Dict";
5
- type Data = ClientData<{
6
- views: string[];
7
- props: Dict[];
8
- mode: Mode;
9
- }>;
10
- export default class AngularClient {
11
- #private;
12
- static mount(_view: string, data: ClientData<Data>): Promise<void>;
13
- }
14
- export {};
1
+ import type Validated from "#client/Validated";
2
+ import form from "#client/form";
3
+ declare const client: {
4
+ form: typeof form;
5
+ field: <T>(initial: T) => {
6
+ delete: (url: string, options?: {
7
+ headers?: import("@rcompat/type").Dict<string>;
8
+ map?: ((v: T) => import("@rcompat/type").JSONValue) | undefined;
9
+ path?: import("@rcompat/type").JSONPointer;
10
+ } | undefined) => Validated<T>;
11
+ patch: (url: string, options?: {
12
+ headers?: import("@rcompat/type").Dict<string>;
13
+ map?: ((v: T) => import("@rcompat/type").JSONValue) | undefined;
14
+ path?: import("@rcompat/type").JSONPointer;
15
+ } | undefined) => Validated<T>;
16
+ post: (url: string, options?: {
17
+ headers?: import("@rcompat/type").Dict<string>;
18
+ map?: ((v: T) => import("@rcompat/type").JSONValue) | undefined;
19
+ path?: import("@rcompat/type").JSONPointer;
20
+ } | undefined) => Validated<T>;
21
+ put: (url: string, options?: {
22
+ headers?: import("@rcompat/type").Dict<string>;
23
+ map?: ((v: T) => import("@rcompat/type").JSONValue) | undefined;
24
+ path?: import("@rcompat/type").JSONPointer;
25
+ } | undefined) => Validated<T>;
26
+ };
27
+ };
28
+ export default client;
29
+ export type { Validated };
15
30
  //# sourceMappingURL=index.d.ts.map
@@ -1,69 +1,5 @@
1
- import INITIAL_PROPS from "#INITIAL_PROPS";
2
- import "@angular/compiler";
3
- import { enableProdMode, } from "@angular/core";
4
- import { bootstrapApplication, provideClientHydration, } from "@angular/platform-browser";
5
- import spa from "@primate/core/client/spa";
6
- import root from "angular:root";
7
- import * as views from "angular:views";
8
- const make_props = (data) => ({
9
- views: data.views.map(name => views[name]),
10
- props: data.props,
11
- request: {
12
- ...data.request,
13
- url: new URL(location.href),
14
- },
15
- update: () => undefined,
16
- });
17
- export default class AngularClient {
18
- static #app;
19
- static #root;
20
- static async mount(_view, data) {
21
- if (data.mode === "production")
22
- enableProdMode();
23
- const providers = [];
24
- // add hydration provider for SSR
25
- if (data.ssr)
26
- providers.push(provideClientHydration());
27
- // in non-SSR mode, the HTML won't contain app-root, inject it
28
- else
29
- document.body.appendChild(document.createElement("app-root"));
30
- // create the root view props
31
- const props = make_props(data);
32
- // bootstrap the application
33
- try {
34
- this.#app = await bootstrapApplication(root, {
35
- providers: [
36
- ...providers,
37
- {
38
- provide: INITIAL_PROPS,
39
- useValue: props,
40
- },
41
- ],
42
- });
43
- this.#root = this.#app.components[0];
44
- // initial props
45
- if (this.#root.instance) {
46
- this.#root.instance.p = props;
47
- // change detection
48
- this.#app.tick();
49
- }
50
- if (data.spa) {
51
- this.#spa();
52
- }
53
- }
54
- catch (error) {
55
- console.error("Failed to bootstrap Angular application:", error);
56
- }
57
- }
58
- static #spa() {
59
- window.addEventListener("DOMContentLoaded", () => {
60
- spa((next, update) => {
61
- const props = { ...make_props(next), update };
62
- this.#root.instance.p = props;
63
- this.#app.tick();
64
- update?.();
65
- });
66
- });
67
- }
68
- }
1
+ import field from "#client/field";
2
+ import form from "#client/form";
3
+ const client = { form, field };
4
+ export default client;
69
5
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,18 @@
1
+ import type Data from "#client/Data";
2
+ import type { Type } from "@angular/core";
3
+ import type { Dict } from "@rcompat/type";
4
+ type ViewComponent = Type<unknown>;
5
+ export type RootProps = {
6
+ views: ViewComponent[];
7
+ props: Dict[];
8
+ request: Data["request"] & {
9
+ url: URL;
10
+ };
11
+ update?: () => void;
12
+ };
13
+ declare function toProps(data: Data, update?: () => void): RootProps;
14
+ declare const root: {
15
+ toProps: typeof toProps;
16
+ };
17
+ export default root;
18
+ //# sourceMappingURL=root.d.ts.map
@@ -0,0 +1,17 @@
1
+ import * as Views from "angular:views";
2
+ function toProps(data, update) {
3
+ return {
4
+ views: data.views.map(name => Views[name]),
5
+ props: data.props,
6
+ request: {
7
+ ...data.request,
8
+ url: new URL(data.request.url),
9
+ },
10
+ update,
11
+ };
12
+ }
13
+ const root = {
14
+ toProps,
15
+ };
16
+ export default root;
17
+ //# sourceMappingURL=root.js.map
@@ -40,6 +40,7 @@ import {
40
40
  } from "@angular/core";
41
41
  import { CommonModule, NgComponentOutlet } from "@angular/common";
42
42
  import INITIAL_PROPS from "@primate/angular/INITIAL_PROPS";
43
+ import { request } from "@primate/angular/app";
43
44
  ${i18n_imports}
44
45
 
45
46
  type Dict = Record<string, any>;
@@ -64,7 +65,10 @@ export default class RootComponent implements OnDestroy {
64
65
  constructor() {
65
66
  try {
66
67
  const initial = inject<any>(INITIAL_PROPS);
67
- if (initial) this.#p = initial;
68
+ if (initial) {
69
+ this.#p = initial;
70
+ request.set(initial.request);
71
+ }
68
72
  } catch {}
69
73
  ${i18n_setup}
70
74
  }
@@ -72,6 +76,7 @@ export default class RootComponent implements OnDestroy {
72
76
  @Input({ required: true })
73
77
  set p(value: RootProps) {
74
78
  this.#p = value;
79
+ request.set(value.request);
75
80
  this.#cdr.markForCheck(); // root on default CD
76
81
  }
77
82
  get p(): RootProps { return this.#p; }
@@ -0,0 +1,7 @@
1
+ declare const _default: (input?: {
2
+ extensions?: string[] | undefined;
3
+ spa?: boolean | undefined;
4
+ ssr?: boolean | undefined;
5
+ } | undefined) => import("@primate/core/frontend").Module;
6
+ export default _default;
7
+ //# sourceMappingURL=default.d.ts.map
@@ -1,14 +1,16 @@
1
1
  import create_root from "#create-root";
2
- import Runtime from "#Runtime";
2
+ import init from "#init";
3
+ import frontend from "@primate/core/frontend";
3
4
  import * as ts from "typescript";
4
- export default class Default extends Runtime {
5
- root = {
5
+ export default frontend({
6
+ ...init,
7
+ root: {
6
8
  create: create_root,
7
- };
8
- css = {
9
+ },
10
+ css: {
9
11
  filter: /\.component\.(css)$/,
10
- };
11
- compile = {
12
+ },
13
+ compile: {
12
14
  client: (text) => {
13
15
  const result = ts.transpileModule(text, {
14
16
  compilerOptions: {
@@ -20,18 +22,14 @@ export default class Default extends Runtime {
20
22
  moduleResolution: ts.ModuleResolutionKind.NodeJs,
21
23
  },
22
24
  });
23
- const styleMatch = text.match(/styles:\s*\[([\s\S]*?)\]/);
24
- let css = "";
25
- if (styleMatch) {
26
- // Extract and process inline styles
27
- css = styleMatch[1]
28
- .replace(/['"`]/g, "")
29
- .replace(/\\n/g, "\n")
30
- .trim();
31
- }
25
+ // extract inline styles
26
+ const style_match = text.match(/styles:\s*\[([\s\S]*?)\]/);
32
27
  return {
33
28
  js: result.outputText,
34
- css,
29
+ css: style_match === null ? "" : style_match[1]
30
+ .replace(/['"`]/g, "")
31
+ .replace(/\\n/g, "\n")
32
+ .trim(),
35
33
  };
36
34
  },
37
35
  server: (text) => {
@@ -49,6 +47,6 @@ export default class Default extends Runtime {
49
47
  // hinder treeshaking
50
48
  return `import "@angular/compiler";\n${result.outputText}`;
51
49
  },
52
- };
53
- }
54
- //# sourceMappingURL=Default.js.map
50
+ },
51
+ });
52
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1,6 @@
1
+ import "@angular/compiler";
2
+ import type { Type } from "@angular/core";
3
+ import type { Init } from "@primate/core/frontend";
4
+ declare const module: Init<Type<any>>;
5
+ export default module;
6
+ //# sourceMappingURL=init.d.ts.map
@@ -1,16 +1,15 @@
1
1
  import INITIAL_PROPS from "#INITIAL_PROPS";
2
2
  import root from "#root-selector";
3
3
  import "@angular/compiler";
4
- import { enableProdMode, importProvidersFrom, } from "@angular/core";
4
+ import { enableProdMode, importProvidersFrom } from "@angular/core";
5
5
  import { bootstrapApplication, BrowserModule, provideClientHydration, } from "@angular/platform-browser";
6
6
  import { provideServerRendering, renderApplication, } from "@angular/platform-server";
7
- import FrontendModule from "@primate/core/frontend/Module";
8
- export default class Runtime extends FrontendModule {
9
- name = "angular";
10
- defaultExtensions = [".component.ts"];
11
- layouts = true;
12
- client = true;
13
- render = async (view, props) => {
7
+ const module = {
8
+ name: "angular",
9
+ extensions: [".component.ts"],
10
+ layouts: true,
11
+ client: true,
12
+ async render(view, props) {
14
13
  const providers = [
15
14
  importProvidersFrom(BrowserModule),
16
15
  provideServerRendering(),
@@ -31,10 +30,10 @@ export default class Runtime extends FrontendModule {
31
30
  body: bodyMatch?.[1] || html,
32
31
  head: headMatch?.[1] || "",
33
32
  };
34
- };
35
- async serve(app, next) {
33
+ },
34
+ onServe(app) {
36
35
  app.mode === "production" && enableProdMode();
37
- return super.serve(app, next);
38
- }
39
- }
40
- //# sourceMappingURL=Runtime.js.map
36
+ },
37
+ };
38
+ export default module;
39
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1,4 @@
1
+ import type { RequestPublic } from "@primate/core";
2
+ declare const request: import("@angular/core").WritableSignal<RequestPublic>;
3
+ export default request;
4
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { signal } from "@angular/core";
2
+ const request = signal(undefined);
3
+ export default request;
4
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1,7 @@
1
+ declare const _default: (input?: {
2
+ extensions?: string[] | undefined;
3
+ spa?: boolean | undefined;
4
+ ssr?: boolean | undefined;
5
+ } | undefined) => import("@primate/core/frontend").Module;
6
+ export default _default;
7
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1,4 @@
1
+ import init from "#init";
2
+ import frontend from "@primate/core/frontend";
3
+ export default frontend(init);
4
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1,2 @@
1
+ export { default as request } from "#request/store";
2
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default as request } from "#request/store";
2
+ //# sourceMappingURL=app.js.map
@@ -1,2 +1,2 @@
1
- export { default } from "#client/index";
1
+ export { default } from "#client/app";
2
2
  //# sourceMappingURL=browser.d.ts.map
@@ -1,2 +1,2 @@
1
- export { default } from "#client/index";
1
+ export { default } from "#client/app";
2
2
  //# sourceMappingURL=browser.js.map
@@ -0,0 +1,3 @@
1
+ export type * from "#client/index";
2
+ export { default } from "#client/index";
3
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#client/index";
2
+ //# sourceMappingURL=client.js.map
@@ -1,4 +1,2 @@
1
- import Default from "#Default";
2
- declare const _default: (options?: typeof Default.input) => Default;
3
- export default _default;
1
+ export { default } from "#default";
4
2
  //# sourceMappingURL=default.d.ts.map
@@ -1,3 +1,2 @@
1
- import Default from "#Default";
2
- export default (options) => new Default(options);
1
+ export { default } from "#default";
3
2
  //# sourceMappingURL=default.js.map
@@ -1,4 +1,2 @@
1
- import Runtime from "#Runtime";
2
- declare const _default: (options?: typeof Runtime.input) => Runtime;
3
- export default _default;
1
+ export { default } from "#runtime";
4
2
  //# sourceMappingURL=runtime.d.ts.map
@@ -1,3 +1,2 @@
1
- import Runtime from "#Runtime";
2
- export default (options) => new Runtime(options);
1
+ export { default } from "#runtime";
3
2
  //# sourceMappingURL=runtime.js.map
package/package.json CHANGED
@@ -1,59 +1,62 @@
1
1
  {
2
2
  "name": "@primate/angular",
3
- "version": "0.5.0",
4
- "description": "Primate Angular frontend",
3
+ "version": "0.7.0",
4
+ "description": "Angular for Primate",
5
5
  "homepage": "https://primate.run/docs/frontend/angular",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
7
+ "type": "module",
7
8
  "license": "MIT",
8
- "files": [
9
- "/lib/**/*.js",
10
- "/lib/**/*.d.ts",
11
- "!/**/*.spec.*"
12
- ],
13
9
  "repository": {
14
10
  "type": "git",
15
11
  "url": "https://github.com/primate-run/primate",
16
12
  "directory": "packages/angular"
17
13
  },
14
+ "files": [
15
+ "/lib/**/*.js",
16
+ "/lib/**/*.d.ts",
17
+ "!/**/*.spec.*"
18
+ ],
19
+ "types": "lib/index.d.ts",
18
20
  "dependencies": {
19
- "@angular/common": "^21.0.0",
20
- "@angular/compiler": "^21.0.0",
21
- "@angular/core": "^21.0.0",
22
- "@angular/platform-browser": "^21.0.0",
23
- "@angular/platform-server": "^21.0.0",
24
- "@angular/ssr": "^21.0.0",
25
- "@rcompat/assert": "^0.3.1",
26
- "@rcompat/build": "^0.15.0",
27
- "@rcompat/crypto": "^0.11.0",
28
- "@rcompat/fs": "^0.22.3",
29
- "@rcompat/record": "^0.9.1",
30
- "typescript": "^5.9.2",
31
- "@primate/core": "^0.4.0"
21
+ "@angular/common": "^21.2.7",
22
+ "@angular/compiler": "^21.2.7",
23
+ "@angular/core": "^21.2.7",
24
+ "@angular/platform-browser": "^21.2.7",
25
+ "@angular/platform-server": "^21.2.7",
26
+ "@angular/ssr": "^21.2.6",
27
+ "typescript": "^5.9.3",
28
+ "@primate/core": "^0.6.0"
29
+ },
30
+ "devDependencies": {
31
+ "@rcompat/type": "^0.11.1",
32
+ "@primate/test": "^0.0.0"
32
33
  },
33
34
  "peerDependencies": {
34
- "primate": "^0.35.0"
35
+ "primate": "^0.37.0"
35
36
  },
36
- "type": "module",
37
37
  "imports": {
38
38
  "#*": {
39
- "apekit": "./src/private/*.ts",
39
+ "@primate/source": "./src/private/*.ts",
40
40
  "default": "./lib/private/*.js"
41
41
  }
42
42
  },
43
43
  "exports": {
44
44
  ".": {
45
+ "types": "./lib/index.d.ts",
46
+ "@primate/source": "./src/public/default.ts",
45
47
  "browser": "./lib/public/browser.js",
46
48
  "runtime": "./lib/public/runtime.js",
47
49
  "default": "./lib/public/default.js"
48
50
  },
49
51
  "./*": {
50
- "apekit": "./src/public/*.ts",
52
+ "@primate/source": "./src/public/*.ts",
51
53
  "default": "./lib/public/*.js"
52
54
  }
53
55
  },
54
56
  "scripts": {
55
- "build": "npm run clean && tsc",
57
+ "build": "npm run clean && tsc && cp src/types/{app,index}.d.ts lib",
56
58
  "clean": "rm -rf ./lib",
57
- "lint": "eslint ."
59
+ "lint": "eslint .",
60
+ "test": "npx proby"
58
61
  }
59
62
  }
@@ -1,17 +0,0 @@
1
- import Runtime from "#Runtime";
2
- export default class Default extends Runtime {
3
- root: {
4
- create: (depth: number, i18n_active: boolean) => string;
5
- };
6
- css: {
7
- filter: RegExp;
8
- };
9
- compile: {
10
- client: (text: string) => {
11
- js: string;
12
- css: string;
13
- };
14
- server: (text: string) => string;
15
- };
16
- }
17
- //# sourceMappingURL=Default.d.ts.map
@@ -1,15 +0,0 @@
1
- import "@angular/compiler";
2
- import { type Type } from "@angular/core";
3
- import FrontendModule from "@primate/core/frontend/Module";
4
- import type Render from "@primate/core/frontend/Render";
5
- import type NextServe from "@primate/core/NextServe";
6
- import type ServeApp from "@primate/core/ServeApp";
7
- export default class Runtime extends FrontendModule<Type<any>> {
8
- name: string;
9
- defaultExtensions: string[];
10
- layouts: boolean;
11
- client: boolean;
12
- render: Render<Type<any>>;
13
- serve(app: ServeApp, next: NextServe): Promise<ServeApp>;
14
- }
15
- //# sourceMappingURL=Runtime.d.ts.map
@@ -1,25 +0,0 @@
1
- import type Validated from "#client/Validated";
2
- declare const _default: <T>(initial: T) => {
3
- delete: (url: string, options?: {
4
- headers?: import("@rcompat/type/Dict").default<string>;
5
- map?: ((v: T) => import("@rcompat/type/JSONValue").default) | undefined;
6
- path?: import("@rcompat/type/JSONPointer").default;
7
- } | undefined) => Validated<T>;
8
- patch: (url: string, options?: {
9
- headers?: import("@rcompat/type/Dict").default<string>;
10
- map?: ((v: T) => import("@rcompat/type/JSONValue").default) | undefined;
11
- path?: import("@rcompat/type/JSONPointer").default;
12
- } | undefined) => Validated<T>;
13
- post: (url: string, options?: {
14
- headers?: import("@rcompat/type/Dict").default<string>;
15
- map?: ((v: T) => import("@rcompat/type/JSONValue").default) | undefined;
16
- path?: import("@rcompat/type/JSONPointer").default;
17
- } | undefined) => Validated<T>;
18
- put: (url: string, options?: {
19
- headers?: import("@rcompat/type/Dict").default<string>;
20
- map?: ((v: T) => import("@rcompat/type/JSONValue").default) | undefined;
21
- path?: import("@rcompat/type/JSONPointer").default;
22
- } | undefined) => Validated<T>;
23
- };
24
- export default _default;
25
- //# sourceMappingURL=validate.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#client/Validated";
2
- //# sourceMappingURL=Validated.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Validated.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#client/validate";
2
- //# sourceMappingURL=validate.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#client/validate";
2
- //# sourceMappingURL=validate.js.map