@fieldia/core 0.32.0 → 0.33.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 (55) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/schema/page.schema.json +121 -1
  4. package/src/index.d.mts +2 -0
  5. package/src/index.d.ts +2 -0
  6. package/src/index.js +10 -2
  7. package/src/index.js.map +1 -1
  8. package/src/index.mjs +3 -0
  9. package/src/index.mjs.map +1 -1
  10. package/src/lib/format/layout.d.mts +856 -6
  11. package/src/lib/format/layout.d.ts +856 -6
  12. package/src/lib/format/layout.js +5 -1
  13. package/src/lib/format/layout.js.map +1 -1
  14. package/src/lib/format/layout.mjs +5 -1
  15. package/src/lib/format/layout.mjs.map +1 -1
  16. package/src/lib/format/loading-schema.d.mts +68 -0
  17. package/src/lib/format/loading-schema.d.ts +68 -0
  18. package/src/lib/format/loading-schema.js +49 -0
  19. package/src/lib/format/loading-schema.js.map +1 -0
  20. package/src/lib/format/loading-schema.mjs +45 -0
  21. package/src/lib/format/loading-schema.mjs.map +1 -0
  22. package/src/lib/format/loading.d.mts +77 -0
  23. package/src/lib/format/loading.d.ts +77 -0
  24. package/src/lib/format/loading.js +51 -0
  25. package/src/lib/format/loading.js.map +1 -0
  26. package/src/lib/format/loading.mjs +48 -0
  27. package/src/lib/format/loading.mjs.map +1 -0
  28. package/src/lib/format/page.d.mts +254 -2
  29. package/src/lib/format/page.d.ts +254 -2
  30. package/src/lib/format/page.js +2 -0
  31. package/src/lib/format/page.js.map +1 -1
  32. package/src/lib/format/page.mjs +2 -0
  33. package/src/lib/format/page.mjs.map +1 -1
  34. package/src/lib/format/upgrade.d.mts +3 -1
  35. package/src/lib/format/upgrade.d.ts +3 -1
  36. package/src/lib/format/upgrade.js +3 -1
  37. package/src/lib/format/upgrade.js.map +1 -1
  38. package/src/lib/format/upgrade.mjs +3 -1
  39. package/src/lib/format/upgrade.mjs.map +1 -1
  40. package/src/lib/format/version.d.mts +2 -2
  41. package/src/lib/format/version.d.ts +2 -2
  42. package/src/lib/format/version.js +2 -2
  43. package/src/lib/format/version.js.map +1 -1
  44. package/src/lib/format/version.mjs +2 -2
  45. package/src/lib/format/version.mjs.map +1 -1
  46. package/src/lib/record/data-source.d.mts +6 -0
  47. package/src/lib/record/data-source.d.ts +6 -0
  48. package/src/lib/record/data-source.js.map +1 -1
  49. package/src/lib/record/data-source.mjs.map +1 -1
  50. package/src/runtime.d.mts +1 -0
  51. package/src/runtime.d.ts +1 -0
  52. package/src/runtime.js +6 -4
  53. package/src/runtime.js.map +1 -1
  54. package/src/runtime.mjs +1 -0
  55. package/src/runtime.mjs.map +1 -1
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageLoadingSchema = void 0;
4
+ exports.loadingOptionIssues = loadingOptionIssues;
5
+ const z = require("zod");
6
+ const jitless_1 = require("./jitless");
7
+ const loading_1 = require("./loading");
8
+ // zod compiles no code for these schemas: a strict Content-Security-Policy refuses it (jitless.ts).
9
+ (0, jitless_1.makeSchemasJitless)();
10
+ /*
11
+ * The shape of `PageLoading` (loading.ts), where pages are made and checked (`validatePage`, the JSON Schema, the
12
+ * designer): an app showing forms never carries it.
13
+ */
14
+ /** A length of time in whole milliseconds, up to ten minutes. */
15
+ const ms = z.int().min(0).max(600000);
16
+ exports.PageLoadingSchema = z
17
+ .strictObject({
18
+ first: z.enum(loading_1.LOADING_TECHNIQUES.first).optional(),
19
+ refresh: z.enum(loading_1.LOADING_TECHNIQUES.refresh).optional(),
20
+ more: z.enum(loading_1.LOADING_TECHNIQUES.more).optional(),
21
+ search: z.enum(loading_1.LOADING_TECHNIQUES.search).optional(),
22
+ action: z.enum(loading_1.LOADING_TECHNIQUES.action).optional(),
23
+ skeleton: z.enum(loading_1.LOADING_VARIANTS.skeleton).optional(),
24
+ spinner: z.enum(loading_1.LOADING_VARIANTS.spinner).optional(),
25
+ progress: z.enum(loading_1.LOADING_VARIANTS.progress).optional(),
26
+ delay: ms.max(10000).optional(),
27
+ minShown: ms.max(10000).optional(),
28
+ slowAfter: ms.optional(),
29
+ timeout: ms.min(1).optional(),
30
+ error: z.enum(loading_1.LOADING_ERRORS).optional(),
31
+ })
32
+ .superRefine((loading, context) => {
33
+ // A wait that ends before anything could be said of it fails every slow answer unseen.
34
+ if (loading.timeout !== undefined && loading.timeout <= (loading.delay ?? loading_1.LOADING_DEFAULTS.delay)) {
35
+ context.addIssue({ code: 'custom', path: ['timeout'], message: `a timeout ends the wait as failed: make it longer than the delay before a loader shows (${loading.delay ?? loading_1.LOADING_DEFAULTS.delay} ms)` });
36
+ }
37
+ if (loading.timeout !== undefined && loading.slowAfter !== undefined && loading.slowAfter >= loading.timeout) {
38
+ context.addIssue({ code: 'custom', path: ['slowAfter'], message: `"Still loading…" is said before the wait ends: make slowAfter shorter than the timeout (${loading.timeout} ms)` });
39
+ }
40
+ })
41
+ .meta({ id: 'PageLoading' });
42
+ /** The issues of a field's `options.loading`, each at its path under `options`. */
43
+ function loadingOptionIssues(node) {
44
+ const loading = node.options?.['loading'];
45
+ if (loading === undefined)
46
+ return [];
47
+ return (exports.PageLoadingSchema.safeParse(loading).error?.issues ?? []).map((issue) => ({ message: issue.message, path: ['options', 'loading', ...issue.path] }));
48
+ }
49
+ //# sourceMappingURL=loading-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading-schema.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/loading-schema.ts"],"names":[],"mappings":";;;AA2CA,kDAIC;AA/CD,yBAAyB;AACzB,uCAA+C;AAC/C,uCAAmG;AAEnG,oGAAoG;AACpG,IAAA,4BAAkB,GAAE,CAAC;AAErB;;;GAGG;AAEH,iEAAiE;AACjE,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAEzB,QAAA,iBAAiB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ULTS, LOADING_ERRORS, LOADING_TECHNIQUES, LOADING_VARIANTS } from './loading.mjs';
4
+ // zod compiles no code for these schemas: a strict Content-Security-Policy refuses it (jitless.ts).
5
+ makeSchemasJitless();
6
+ /*
7
+ * The shape of `PageLoading` (loading.ts), where pages are made and checked (`validatePage`, the JSON Schema, the
8
+ * designer): an app showing forms never carries it.
9
+ */
10
+ /** A length of time in whole milliseconds, up to ten minutes. */
11
+ const ms = z.int().min(0).max(600000);
12
+ export const PageLoadingSchema = z
13
+ .strictObject({
14
+ first: z.enum(LOADING_TECHNIQUES.first).optional(),
15
+ refresh: z.enum(LOADING_TECHNIQUES.refresh).optional(),
16
+ more: z.enum(LOADING_TECHNIQUES.more).optional(),
17
+ search: z.enum(LOADING_TECHNIQUES.search).optional(),
18
+ action: z.enum(LOADING_TECHNIQUES.action).optional(),
19
+ skeleton: z.enum(LOADING_VARIANTS.skeleton).optional(),
20
+ spinner: z.enum(LOADING_VARIANTS.spinner).optional(),
21
+ progress: z.enum(LOADING_VARIANTS.progress).optional(),
22
+ delay: ms.max(10000).optional(),
23
+ minShown: ms.max(10000).optional(),
24
+ slowAfter: ms.optional(),
25
+ timeout: ms.min(1).optional(),
26
+ error: z.enum(LOADING_ERRORS).optional(),
27
+ })
28
+ .superRefine((loading, context) => {
29
+ // A wait that ends before anything could be said of it fails every slow answer unseen.
30
+ if (loading.timeout !== undefined && loading.timeout <= (loading.delay ?? LOADING_DEFAULTS.delay)) {
31
+ context.addIssue({ code: 'custom', path: ['timeout'], message: `a timeout ends the wait as failed: make it longer than the delay before a loader shows (${loading.delay ?? LOADING_DEFAULTS.delay} ms)` });
32
+ }
33
+ if (loading.timeout !== undefined && loading.slowAfter !== undefined && loading.slowAfter >= loading.timeout) {
34
+ context.addIssue({ code: 'custom', path: ['slowAfter'], message: `"Still loading…" is said before the wait ends: make slowAfter shorter than the timeout (${loading.timeout} ms)` });
35
+ }
36
+ })
37
+ .meta({ id: 'PageLoading' });
38
+ /** The issues of a field's `options.loading`, each at its path under `options`. */
39
+ export function loadingOptionIssues(node) {
40
+ const loading = node.options?.['loading'];
41
+ if (loading === undefined)
42
+ return [];
43
+ return (PageLoadingSchema.safeParse(loading).error?.issues ?? []).map((issue) => ({ message: issue.message, path: ['options', 'loading', ...issue.path] }));
44
+ }
45
+ //# sourceMappingURL=loading-schema.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading-schema.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/loading-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEnG,oGAAoG;AACpG,kBAAkB,EAAE,CAAC;AAErB;;;GAGG;AAEH,iEAAiE;AACjE,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,YAAY,CAAC;IACZ,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;IAClD,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE;IACtD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;IAChD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IACpD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IACpD,QAAQ,EAAE,CAAC,CAAC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AAE,OAAO,EAAE,2FAA2F,OAAO,CAAC,OAAO,MAAM,EAAE,CAAC,CAAC;IACvL,CAAC;AACH,CAAC,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;AAE/B,mFAAmF;AACnF,MAAM,UAAU,mBAAmB,CAAC,IAA2C;IAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;IAC1C,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrC,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,IAAI,CAAwB,EAAE,CAAC,CAAC,CAAC;AACrL,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * How a page looks while it waits for an answer (docs/plans/loading.md): at each of its moments, a way to show it, its
3
+ * looks and its timing, and what a failure shows. Set by the app for every page (the viewer's `loading`), by the page
4
+ * (`Page.loading`), and by a part of it — a list's, a related list's or a map's `loading`, a field's `options.loading` —
5
+ * the most specific winning, setting by setting; what nobody sets is `LOADING_DEFAULTS`.
6
+ *
7
+ * - `first`: a form, a list, a card, a map, a related list drawn for the first time.
8
+ * - `refresh`: a list or a part asked again — a search, a filter, an order, a record reloaded; a page turned (a list's
9
+ * pager, a related list's), a calendar's next week or month: whatever replaces what is shown.
10
+ * - `more`: rows put under those shown — endless scroll, Show more, a tree's children.
11
+ * - `search`: a link's or a dropdown's suggestions, choices from the app's lists, a filter's values.
12
+ * - `action`: a save, a send, a button's steps, a delete, an export.
13
+ *
14
+ * { "loading": { "first": "spinner", "refresh": "dim", "skeleton": "pulse", "delay": 250, "timeout": 20000 } }
15
+ */
16
+ export declare const LOADING_MOMENTS: readonly ["first", "refresh", "more", "search", "action"];
17
+ export type LoadingMoment = (typeof LOADING_MOMENTS)[number];
18
+ /** The ways each moment can be shown, its default first. `custom` is drawn by the app's own function (the viewer's `loading.custom`). */
19
+ export declare const LOADING_TECHNIQUES: {
20
+ readonly first: readonly ["skeleton", "spinner", "progress", "text", "none", "custom"];
21
+ readonly refresh: readonly ["keep", "dim", "skeleton", "spinner", "none", "custom"];
22
+ readonly more: readonly ["row", "spinner", "skeleton", "none", "custom"];
23
+ readonly search: readonly ["inline", "spinner", "none", "custom"];
24
+ readonly action: readonly ["button", "bar", "overlay", "none", "custom"];
25
+ };
26
+ export type LoadingTechnique<M extends LoadingMoment = LoadingMoment> = (typeof LOADING_TECHNIQUES)[M][number];
27
+ /** The looks a technique comes in: a skeleton's, a spinner's, a progress bar's — the default first. */
28
+ export declare const LOADING_VARIANTS: {
29
+ readonly skeleton: readonly ["shimmer", "pulse", "static"];
30
+ readonly spinner: readonly ["ring", "dots"];
31
+ readonly progress: readonly ["top", "inline"];
32
+ };
33
+ /** What a failed wait shows: words and Retry in its place, a toast with Retry, or the app's own. */
34
+ export declare const LOADING_ERRORS: readonly ["inline", "toast", "custom"];
35
+ export interface PageLoading {
36
+ /** A form, a list, a card, a map drawn for the first time: `skeleton` unless said. */
37
+ first?: LoadingTechnique<'first'>;
38
+ /** A list or a part asked again: `keep` — what is shown stays, a thin bar over it — unless said. */
39
+ refresh?: LoadingTechnique<'refresh'>;
40
+ /** Rows under those shown: `row` — "Loading more…" where they will come — unless said. */
41
+ more?: LoadingTechnique<'more'>;
42
+ /** Suggestions and choices asked for as a person types or opens a list: `inline` — "Searching…" in the list — unless said. */
43
+ search?: LoadingTechnique<'search'>;
44
+ /** A save, a send, a button's steps: `button` — the pressed button busy — unless said. */
45
+ action?: LoadingTechnique<'action'>;
46
+ /** How a skeleton moves: a band of light passing over it (`shimmer`), fading in and out (`pulse`), or not at all. */
47
+ skeleton?: (typeof LOADING_VARIANTS.skeleton)[number];
48
+ /** A spinner: a turning `ring`, or three `dots`. */
49
+ spinner?: (typeof LOADING_VARIANTS.spinner)[number];
50
+ /** A progress bar: along the top of what waits, or across its middle (`inline`). */
51
+ progress?: (typeof LOADING_VARIANTS.progress)[number];
52
+ /** Milliseconds before anything is drawn: a quicker answer shows no loader at all. 150 unless said. */
53
+ delay?: number;
54
+ /** Milliseconds a loader stays once drawn, so it never flickers off. 300 unless said. */
55
+ minShown?: number;
56
+ /** Milliseconds after which "Still loading…" is said. 5000 unless said. */
57
+ slowAfter?: number;
58
+ /** Milliseconds after which the wait ends as failed, with Retry. None unless said. */
59
+ timeout?: number;
60
+ /** What a failed wait shows: `inline` (words and Retry in its place) unless said, a `toast`, or the app's `custom`. */
61
+ error?: (typeof LOADING_ERRORS)[number];
62
+ }
63
+ /** What nobody set: the coordinator's proposal, 23 Oct (0.33). */
64
+ export declare const LOADING_DEFAULTS: {
65
+ readonly first: "skeleton";
66
+ readonly refresh: "keep";
67
+ readonly more: "row";
68
+ readonly search: "inline";
69
+ readonly action: "button";
70
+ readonly skeleton: "shimmer";
71
+ readonly spinner: "ring";
72
+ readonly progress: "top";
73
+ readonly delay: 150;
74
+ readonly minShown: 300;
75
+ readonly slowAfter: 5000;
76
+ readonly error: "inline";
77
+ };
@@ -0,0 +1,77 @@
1
+ /**
2
+ * How a page looks while it waits for an answer (docs/plans/loading.md): at each of its moments, a way to show it, its
3
+ * looks and its timing, and what a failure shows. Set by the app for every page (the viewer's `loading`), by the page
4
+ * (`Page.loading`), and by a part of it — a list's, a related list's or a map's `loading`, a field's `options.loading` —
5
+ * the most specific winning, setting by setting; what nobody sets is `LOADING_DEFAULTS`.
6
+ *
7
+ * - `first`: a form, a list, a card, a map, a related list drawn for the first time.
8
+ * - `refresh`: a list or a part asked again — a search, a filter, an order, a record reloaded; a page turned (a list's
9
+ * pager, a related list's), a calendar's next week or month: whatever replaces what is shown.
10
+ * - `more`: rows put under those shown — endless scroll, Show more, a tree's children.
11
+ * - `search`: a link's or a dropdown's suggestions, choices from the app's lists, a filter's values.
12
+ * - `action`: a save, a send, a button's steps, a delete, an export.
13
+ *
14
+ * { "loading": { "first": "spinner", "refresh": "dim", "skeleton": "pulse", "delay": 250, "timeout": 20000 } }
15
+ */
16
+ export declare const LOADING_MOMENTS: readonly ["first", "refresh", "more", "search", "action"];
17
+ export type LoadingMoment = (typeof LOADING_MOMENTS)[number];
18
+ /** The ways each moment can be shown, its default first. `custom` is drawn by the app's own function (the viewer's `loading.custom`). */
19
+ export declare const LOADING_TECHNIQUES: {
20
+ readonly first: readonly ["skeleton", "spinner", "progress", "text", "none", "custom"];
21
+ readonly refresh: readonly ["keep", "dim", "skeleton", "spinner", "none", "custom"];
22
+ readonly more: readonly ["row", "spinner", "skeleton", "none", "custom"];
23
+ readonly search: readonly ["inline", "spinner", "none", "custom"];
24
+ readonly action: readonly ["button", "bar", "overlay", "none", "custom"];
25
+ };
26
+ export type LoadingTechnique<M extends LoadingMoment = LoadingMoment> = (typeof LOADING_TECHNIQUES)[M][number];
27
+ /** The looks a technique comes in: a skeleton's, a spinner's, a progress bar's — the default first. */
28
+ export declare const LOADING_VARIANTS: {
29
+ readonly skeleton: readonly ["shimmer", "pulse", "static"];
30
+ readonly spinner: readonly ["ring", "dots"];
31
+ readonly progress: readonly ["top", "inline"];
32
+ };
33
+ /** What a failed wait shows: words and Retry in its place, a toast with Retry, or the app's own. */
34
+ export declare const LOADING_ERRORS: readonly ["inline", "toast", "custom"];
35
+ export interface PageLoading {
36
+ /** A form, a list, a card, a map drawn for the first time: `skeleton` unless said. */
37
+ first?: LoadingTechnique<'first'>;
38
+ /** A list or a part asked again: `keep` — what is shown stays, a thin bar over it — unless said. */
39
+ refresh?: LoadingTechnique<'refresh'>;
40
+ /** Rows under those shown: `row` — "Loading more…" where they will come — unless said. */
41
+ more?: LoadingTechnique<'more'>;
42
+ /** Suggestions and choices asked for as a person types or opens a list: `inline` — "Searching…" in the list — unless said. */
43
+ search?: LoadingTechnique<'search'>;
44
+ /** A save, a send, a button's steps: `button` — the pressed button busy — unless said. */
45
+ action?: LoadingTechnique<'action'>;
46
+ /** How a skeleton moves: a band of light passing over it (`shimmer`), fading in and out (`pulse`), or not at all. */
47
+ skeleton?: (typeof LOADING_VARIANTS.skeleton)[number];
48
+ /** A spinner: a turning `ring`, or three `dots`. */
49
+ spinner?: (typeof LOADING_VARIANTS.spinner)[number];
50
+ /** A progress bar: along the top of what waits, or across its middle (`inline`). */
51
+ progress?: (typeof LOADING_VARIANTS.progress)[number];
52
+ /** Milliseconds before anything is drawn: a quicker answer shows no loader at all. 150 unless said. */
53
+ delay?: number;
54
+ /** Milliseconds a loader stays once drawn, so it never flickers off. 300 unless said. */
55
+ minShown?: number;
56
+ /** Milliseconds after which "Still loading…" is said. 5000 unless said. */
57
+ slowAfter?: number;
58
+ /** Milliseconds after which the wait ends as failed, with Retry. None unless said. */
59
+ timeout?: number;
60
+ /** What a failed wait shows: `inline` (words and Retry in its place) unless said, a `toast`, or the app's `custom`. */
61
+ error?: (typeof LOADING_ERRORS)[number];
62
+ }
63
+ /** What nobody set: the coordinator's proposal, 23 Oct (0.33). */
64
+ export declare const LOADING_DEFAULTS: {
65
+ readonly first: "skeleton";
66
+ readonly refresh: "keep";
67
+ readonly more: "row";
68
+ readonly search: "inline";
69
+ readonly action: "button";
70
+ readonly skeleton: "shimmer";
71
+ readonly spinner: "ring";
72
+ readonly progress: "top";
73
+ readonly delay: 150;
74
+ readonly minShown: 300;
75
+ readonly slowAfter: 5000;
76
+ readonly error: "inline";
77
+ };
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LOADING_DEFAULTS = exports.LOADING_ERRORS = exports.LOADING_VARIANTS = exports.LOADING_TECHNIQUES = exports.LOADING_MOMENTS = void 0;
4
+ /**
5
+ * How a page looks while it waits for an answer (docs/plans/loading.md): at each of its moments, a way to show it, its
6
+ * looks and its timing, and what a failure shows. Set by the app for every page (the viewer's `loading`), by the page
7
+ * (`Page.loading`), and by a part of it — a list's, a related list's or a map's `loading`, a field's `options.loading` —
8
+ * the most specific winning, setting by setting; what nobody sets is `LOADING_DEFAULTS`.
9
+ *
10
+ * - `first`: a form, a list, a card, a map, a related list drawn for the first time.
11
+ * - `refresh`: a list or a part asked again — a search, a filter, an order, a record reloaded; a page turned (a list's
12
+ * pager, a related list's), a calendar's next week or month: whatever replaces what is shown.
13
+ * - `more`: rows put under those shown — endless scroll, Show more, a tree's children.
14
+ * - `search`: a link's or a dropdown's suggestions, choices from the app's lists, a filter's values.
15
+ * - `action`: a save, a send, a button's steps, a delete, an export.
16
+ *
17
+ * { "loading": { "first": "spinner", "refresh": "dim", "skeleton": "pulse", "delay": 250, "timeout": 20000 } }
18
+ */
19
+ exports.LOADING_MOMENTS = ['first', 'refresh', 'more', 'search', 'action'];
20
+ /** The ways each moment can be shown, its default first. `custom` is drawn by the app's own function (the viewer's `loading.custom`). */
21
+ exports.LOADING_TECHNIQUES = {
22
+ first: ['skeleton', 'spinner', 'progress', 'text', 'none', 'custom'],
23
+ refresh: ['keep', 'dim', 'skeleton', 'spinner', 'none', 'custom'],
24
+ more: ['row', 'spinner', 'skeleton', 'none', 'custom'],
25
+ search: ['inline', 'spinner', 'none', 'custom'],
26
+ action: ['button', 'bar', 'overlay', 'none', 'custom'],
27
+ };
28
+ /** The looks a technique comes in: a skeleton's, a spinner's, a progress bar's — the default first. */
29
+ exports.LOADING_VARIANTS = {
30
+ skeleton: ['shimmer', 'pulse', 'static'],
31
+ spinner: ['ring', 'dots'],
32
+ progress: ['top', 'inline'],
33
+ };
34
+ /** What a failed wait shows: words and Retry in its place, a toast with Retry, or the app's own. */
35
+ exports.LOADING_ERRORS = ['inline', 'toast', 'custom'];
36
+ /** What nobody set: the coordinator's proposal, 23 Oct (0.33). */
37
+ exports.LOADING_DEFAULTS = {
38
+ first: 'skeleton',
39
+ refresh: 'keep',
40
+ more: 'row',
41
+ search: 'inline',
42
+ action: 'button',
43
+ skeleton: 'shimmer',
44
+ spinner: 'ring',
45
+ progress: 'top',
46
+ delay: 150,
47
+ minShown: 300,
48
+ slowAfter: 5000,
49
+ error: 'inline',
50
+ };
51
+ //# sourceMappingURL=loading.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/loading.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACU,QAAA,eAAe,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAGzF,yIAAyI;AAC5H,QAAA,kBAAkB,GAAG;IAChC,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;IACpE,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC;IACjE,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC;IACtD,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC;IAC/C,MAAM,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC;CAC9C,CAAC;AAGX,uGAAuG;AAC1F,QAAA,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC;IACxC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;CACnB,CAAC;AAEX,oGAAoG;AACvF,QAAA,cAAc,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AA+BrE,kEAAkE;AACrD,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,GAAG;IACb,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,QAAQ;CACe,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * How a page looks while it waits for an answer (docs/plans/loading.md): at each of its moments, a way to show it, its
3
+ * looks and its timing, and what a failure shows. Set by the app for every page (the viewer's `loading`), by the page
4
+ * (`Page.loading`), and by a part of it — a list's, a related list's or a map's `loading`, a field's `options.loading` —
5
+ * the most specific winning, setting by setting; what nobody sets is `LOADING_DEFAULTS`.
6
+ *
7
+ * - `first`: a form, a list, a card, a map, a related list drawn for the first time.
8
+ * - `refresh`: a list or a part asked again — a search, a filter, an order, a record reloaded; a page turned (a list's
9
+ * pager, a related list's), a calendar's next week or month: whatever replaces what is shown.
10
+ * - `more`: rows put under those shown — endless scroll, Show more, a tree's children.
11
+ * - `search`: a link's or a dropdown's suggestions, choices from the app's lists, a filter's values.
12
+ * - `action`: a save, a send, a button's steps, a delete, an export.
13
+ *
14
+ * { "loading": { "first": "spinner", "refresh": "dim", "skeleton": "pulse", "delay": 250, "timeout": 20000 } }
15
+ */
16
+ export const LOADING_MOMENTS = ['first', 'refresh', 'more', 'search', 'action'];
17
+ /** The ways each moment can be shown, its default first. `custom` is drawn by the app's own function (the viewer's `loading.custom`). */
18
+ export const LOADING_TECHNIQUES = {
19
+ first: ['skeleton', 'spinner', 'progress', 'text', 'none', 'custom'],
20
+ refresh: ['keep', 'dim', 'skeleton', 'spinner', 'none', 'custom'],
21
+ more: ['row', 'spinner', 'skeleton', 'none', 'custom'],
22
+ search: ['inline', 'spinner', 'none', 'custom'],
23
+ action: ['button', 'bar', 'overlay', 'none', 'custom'],
24
+ };
25
+ /** The looks a technique comes in: a skeleton's, a spinner's, a progress bar's — the default first. */
26
+ export const LOADING_VARIANTS = {
27
+ skeleton: ['shimmer', 'pulse', 'static'],
28
+ spinner: ['ring', 'dots'],
29
+ progress: ['top', 'inline'],
30
+ };
31
+ /** What a failed wait shows: words and Retry in its place, a toast with Retry, or the app's own. */
32
+ export const LOADING_ERRORS = ['inline', 'toast', 'custom'];
33
+ /** What nobody set: the coordinator's proposal, 23 Oct (0.33). */
34
+ export const LOADING_DEFAULTS = {
35
+ first: 'skeleton',
36
+ refresh: 'keep',
37
+ more: 'row',
38
+ search: 'inline',
39
+ action: 'button',
40
+ skeleton: 'shimmer',
41
+ spinner: 'ring',
42
+ progress: 'top',
43
+ delay: 150,
44
+ minShown: 300,
45
+ slowAfter: 5000,
46
+ error: 'inline',
47
+ };
48
+ //# sourceMappingURL=loading.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/loading.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAGzF,yIAAyI;AACzI,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;IACpE,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC;IACjE,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC;IACtD,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC;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