@sealcode/sealgen 0.19.16 → 0.19.17

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 (118) hide show
  1. package/@types/app-config/get-app-port.d.ts +1 -0
  2. package/@types/app-config/load-app-config.d.ts +4 -0
  3. package/@types/app-config/resolve-app-config-path.d.ts +1 -0
  4. package/@types/forms/fields/structured-array.d.ts +2 -2
  5. package/@types/utils/translate.d.ts +2 -1
  6. package/lib/forms/controls/tickable.js +1 -3
  7. package/lib/forms/fields/collection-field.js +2 -1
  8. package/lib/generate-routes.js +23 -1
  9. package/lib/utils/translate.js +4 -4
  10. package/package.json +2 -2
  11. package/src/forms/fields/collection-field.ts +2 -1
  12. package/src/forms/fields/structured-array.ts +2 -11
  13. package/src/generate-routes.ts +38 -9
  14. package/.xunit +0 -75
  15. package/@types/add-verbose-crud.d.ts +0 -3
  16. package/@types/builders/colors-builder.d.sync-conflict-20250918-184323-TFDLWFG.ts +0 -10
  17. package/@types/builders/fonts-builder.d.sync-conflict-20250918-184322-TFDLWFG.ts +0 -7
  18. package/@types/controllers/table-add-button.d.ts +0 -6
  19. package/@types/crud-field-snippets.d.ts +0 -1
  20. package/@types/find-css-includes.d.ts +0 -1
  21. package/@types/forms/controls/array.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -33
  22. package/@types/forms/controls/array.sync-conflict-20250918-222045-TFDLWFG.d.ts +0 -33
  23. package/@types/forms/controls/autocomplete.d.sync-conflict-20250918-222042-TFDLWFG.ts +0 -22
  24. package/@types/forms/controls/checkbox-group.d.sync-conflict-20250918-184319-TFDLWFG.ts +0 -21
  25. package/@types/forms/controls/checkboxed-list-input.d.sync-conflict-20250918-184323-TFDLWFG.ts +0 -21
  26. package/@types/forms/controls/derived-frame.d.sync-conflict-20250918-184314-TFDLWFG.ts +0 -19
  27. package/@types/forms/controls/dropdown.d.sync-conflict-20250918-222044-TFDLWFG.ts +0 -30
  28. package/@types/forms/controls/file.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -13
  29. package/@types/forms/controls/form-control.d.sync-conflict-20250918-184322-TFDLWFG.ts +0 -19
  30. package/@types/forms/controls/form-control.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -19
  31. package/@types/forms/controls/multiple-files.d.sync-conflict-20250918-184318-TFDLWFG.ts +0 -42
  32. package/@types/forms/controls/multiple-photos.d.ts +0 -19
  33. package/@types/forms/controls/number.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -13
  34. package/@types/forms/controls/photo.d.sync-conflict-20250918-184321-TFDLWFG.ts +0 -19
  35. package/@types/forms/controls/photo.d.ts +0 -19
  36. package/@types/forms/controls/photo.test.d.ts +0 -1
  37. package/@types/forms/controls/reverse-single-reference.d.ts +0 -1
  38. package/@types/forms/controls/simple-input.d.sync-conflict-20250918-184310-TFDLWFG.ts +0 -33
  39. package/@types/forms/controls/simple-input.d.sync-conflict-20250918-222042-TFDLWFG.ts +0 -33
  40. package/@types/forms/controls/simple-input.sync-conflict-20250918-222045-TFDLWFG.d.ts +0 -33
  41. package/@types/forms/controls/table.d.sync-conflict-20250918-184302-TFDLWFG.ts +0 -39
  42. package/@types/forms/controls/table.sync-conflict-20250918-222042-TFDLWFG.d.ts +0 -39
  43. package/@types/forms/controls/textarea.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -25
  44. package/@types/forms/fields/boolean.d.sync-conflict-20250918-184325-TFDLWFG.ts +0 -22
  45. package/@types/forms/fields/boolean.sync-conflict-20250918-222042-TFDLWFG.d.ts +0 -22
  46. package/@types/forms/fields/checkboxed-list.d.sync-conflict-20250918-184325-TFDLWFG.ts +0 -23
  47. package/@types/forms/fields/collection-field.d.sync-conflict-20250918-184319-TFDLWFG.ts +0 -22
  48. package/@types/forms/fields/collection-field.d.sync-conflict-20250918-222047-TFDLWFG.ts +0 -22
  49. package/@types/forms/fields/coordinates.d.sync-conflict-20250918-222044-TFDLWFG.ts +0 -14
  50. package/@types/forms/fields/datetime.d.sync-conflict-20250918-222050-TFDLWFG.ts +0 -4
  51. package/@types/forms/fields/email.d.sync-conflict-20250918-184303-TFDLWFG.ts +0 -8
  52. package/@types/forms/fields/enum-multiple-sealious.sync-conflict-20250918-222047-TFDLWFG.d.ts +0 -16
  53. package/@types/forms/fields/enum-multiple.d.ts +0 -18
  54. package/@types/forms/fields/enum-multiple.test.d.ts +0 -1
  55. package/@types/forms/fields/enum.d.ts +0 -18
  56. package/@types/forms/fields/enum.test.d.ts +0 -1
  57. package/@types/forms/fields/field.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -70
  58. package/@types/forms/fields/fields.d.sync-conflict-20250918-184314-TFDLWFG.ts +0 -29
  59. package/@types/forms/fields/file.d.sync-conflict-20250918-184310-TFDLWFG.ts +0 -23
  60. package/@types/forms/fields/file.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -23
  61. package/@types/forms/fields/file.sync-conflict-20250918-222049-TFDLWFG.d.ts +0 -23
  62. package/@types/forms/fields/get-field-for-sealious.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -29
  63. package/@types/forms/fields/get-field-for-sealious.sync-conflict-20250918-222042-TFDLWFG.d.ts +0 -29
  64. package/@types/forms/fields/image.d.sync-conflict-20250918-222042-TFDLWFG.ts +0 -5
  65. package/@types/forms/fields/multiple-files.d.sync-conflict-20250918-184304-TFDLWFG.ts +0 -16
  66. package/@types/forms/fields/number.d.sync-conflict-20250918-184317-TFDLWFG.ts +0 -25
  67. package/@types/forms/fields/number.d.sync-conflict-20250918-222047-TFDLWFG.ts +0 -25
  68. package/@types/forms/fields/pick-from-list.d.sync-conflict-20250918-184322-TFDLWFG.ts +0 -15
  69. package/@types/forms/fields/proxy-field.d.sync-conflict-20250918-184307-TFDLWFG.ts +0 -15
  70. package/@types/forms/fields/regexp.d.sync-conflict-20250918-184305-TFDLWFG.ts +0 -21
  71. package/@types/forms/fields/regexp.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -21
  72. package/@types/forms/fields/regexp.sync-conflict-20250918-222047-TFDLWFG.d.ts +0 -21
  73. package/@types/forms/fields/reverse-single-reference.d.ts +0 -13
  74. package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-184309-TFDLWFG.ts +0 -29
  75. package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-222044-TFDLWFG.ts +0 -29
  76. package/@types/forms/fields/simple-form-field.sync-conflict-20250918-222049-TFDLWFG.d.ts +0 -29
  77. package/@types/forms/fields/single-reference.sync-conflict-20250918-222043-TFDLWFG.d.ts +0 -10
  78. package/@types/forms/fields/structured-array.d.sync-conflict-20250918-184302-TFDLWFG.ts +0 -27
  79. package/@types/forms/fields/structured-array.d.sync-conflict-20250918-222049-TFDLWFG.ts +0 -27
  80. package/@types/forms/fields/structured-array.sync-conflict-20250918-222047-TFDLWFG.d.ts +0 -27
  81. package/@types/forms/fields/table.d.sync-conflict-20250918-184303-TFDLWFG.ts +0 -16
  82. package/@types/forms/form-types.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -26
  83. package/@types/forms/form.d.sync-conflict-20250918-184315-TFDLWFG.ts +0 -32
  84. package/@types/forms/form.d.sync-conflict-20250918-222049-TFDLWFG.ts +0 -32
  85. package/@types/forms/form.sync-conflict-20250918-222049-TFDLWFG.d.ts +0 -33
  86. package/@types/forms/form.test.d.sync-conflict-20250918-184318-TFDLWFG.ts +0 -6
  87. package/@types/forms/form.test.d.sync-conflict-20250918-222047-TFDLWFG.ts +0 -6
  88. package/@types/forms/multiform.d.sync-conflict-20250918-184308-TFDLWFG.ts +0 -23
  89. package/@types/forms/multiform.sync-conflict-20250918-222044-TFDLWFG.d.ts +0 -23
  90. package/@types/index.d.sync-conflict-20250918-184316-TFDLWFG.ts +0 -46
  91. package/@types/mount.d.sync-conflict-20250918-184320-TFDLWFG.ts +0 -6
  92. package/@types/page/list.d.sync-conflict-20250918-184318-TFDLWFG.ts +0 -48
  93. package/@types/page/list.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -48
  94. package/@types/page/list.sync-conflict-20250918-222048-TFDLWFG.d.ts +0 -48
  95. package/@types/page/mountable-with-fields.d.sync-conflict-20250918-184321-TFDLWFG.ts +0 -42
  96. package/@types/page/mountable-with-fields.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -42
  97. package/@types/page/mountable-with-fields.sync-conflict-20250918-222044-TFDLWFG.d.ts +0 -42
  98. package/@types/page/mountable.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -10
  99. package/@types/page/page.d.sync-conflict-20250918-184320-TFDLWFG.ts +0 -18
  100. package/@types/page/props-parser.d.sync-conflict-20250918-184305-TFDLWFG.ts +0 -15
  101. package/@types/page/stateful-page.d.sync-conflict-20250918-184326-TFDLWFG.ts +0 -62
  102. package/@types/templates/shared/handlers/boolean.d.ts +0 -2
  103. package/@types/templates/shared/handlers/date.d.ts +0 -2
  104. package/@types/templates/shared/handlers/deep-reverse-single-reference.d.ts +0 -2
  105. package/@types/templates/shared/handlers/default.d.ts +0 -2
  106. package/@types/templates/shared/handlers/enum.d.ts +0 -2
  107. package/@types/templates/shared/handlers/file.d.ts +0 -2
  108. package/@types/templates/shared/handlers/image.d.ts +0 -2
  109. package/@types/templates/shared/handlers/int.d.ts +0 -2
  110. package/@types/templates/shared/handlers/jdd.d.ts +0 -2
  111. package/@types/templates/shared/handlers/single-reference.d.ts +0 -2
  112. package/@types/templates/shared/handlers/structured-array.d.ts +0 -2
  113. package/@types/templates/shared/shared-crud-form-fields.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -1
  114. package/@types/test_utils/test-on-real-app.d.sync-conflict-20250918-184320-TFDLWFG.ts +0 -26
  115. package/@types/utils/extract-fields-from-collection.d.sync-conflict-20250918-184312-TFDLWFG.ts +0 -18
  116. package/@types/utils/extract-fields-from-collection.sync-conflict-20250918-222045-TFDLWFG.d.ts +0 -18
  117. /package/@types/{add-crud.d.sync-conflict-20250918-184311-TFDLWFG.ts → app-config/get-app-port.test.d.ts} +0 -0
  118. /package/@types/{crud-field-snippets.d.sync-conflict-20250918-184323-TFDLWFG.ts → app-config/load-app-config.test.d.ts} +0 -0
@@ -1,16 +0,0 @@
1
- import { Context } from "koa";
2
- import { FormDataValue } from "../form-types.js";
3
- import { FieldParseResult, FormField } from "./field.js";
4
- import { Table as TableControl } from "../controls/table.js";
5
- export type ExtractFormFieldParsed<Field extends FormField> = Field extends FormField<true, infer T> ? NonNullable<T> : Field extends FormField<true, infer T> ? T : never;
6
- export type TableFieldParsed<F extends Record<string, FormField>> = {
7
- [field_name in keyof F]: ExtractFormFieldParsed<F[field_name]>;
8
- }[];
9
- export declare class Table<F extends Record<string, FormField>> extends FormField<false, TableFieldParsed<F>> {
10
- columns: F;
11
- constructor(columns: F);
12
- getEmptyValue(): never[];
13
- setName(name: string): void;
14
- parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<TableFieldParsed<F>>>;
15
- getControl(): TableControl<F>;
16
- }
@@ -1,26 +0,0 @@
1
- import { FilePointer } from "@sealcode/file-manager";
2
- import type { FlatTemplatable } from "tempstream";
3
- import type { FormField } from "./fields/field.js";
4
- export type FormDataPrimitive = string | string[] | number | undefined | FilePointer;
5
- export type FormDataValue = FormDataPrimitive | Record<string, FormDataPrimitive>;
6
- export type FieldValueType<F extends FormField> = F extends FormField<infer R> ? R : never;
7
- export type FormFieldsToValues<F extends Record<string, FormField<boolean, keyof F>>> = {
8
- [Property in keyof F]: FieldValueType<F[Property]>;
9
- };
10
- export type FormMessage = {
11
- type: "info" | "success" | "error";
12
- text: string;
13
- };
14
- export type FormData<Fieldnames extends string = string> = {
15
- raw_values: Record<Fieldnames, FormDataValue>;
16
- messages: FormMessage[];
17
- };
18
- export type FormReaction = {
19
- action: "stay";
20
- content: FlatTemplatable;
21
- messages?: FormMessage[];
22
- } | {
23
- action: "redirect";
24
- url: string;
25
- messages?: FormMessage[];
26
- };
@@ -1,32 +0,0 @@
1
- import { Context } from "koa";
2
- import Router from "@koa/router";
3
- import { FormData, FormDataValue, FormMessage, FormReaction } from "./form-types.js";
4
- import { Fields, MountableWithFields, PageErrorMessage } from "../page/mountable-with-fields.js";
5
- import { Readable } from "stream";
6
- import { FormField } from "../index.js";
7
- export declare abstract class Form<F extends Fields, SubmitResult> extends MountableWithFields<F> {
8
- defaultSuccessMessage: string;
9
- submitButtonText: string;
10
- action: string;
11
- useTurbo: boolean;
12
- form_id: string;
13
- canAccess(_: Context): Promise<{
14
- canAccess: boolean;
15
- message: string;
16
- }>;
17
- renderError(_: Context, error: PageErrorMessage): Promise<JSX.Element | Readable>;
18
- makeSubmitButton(): JSX.Element;
19
- render(ctx: Context, data: FormData, show_field_errors: boolean): Promise<JSX.Element | Readable>;
20
- makeFormClasses(_ctx: Context): Promise<string[]>;
21
- makeOpenFormTag(ctx: Context): JSX.Element;
22
- makeCloseFormTag(): JSX.Element;
23
- onValuesInvalid(ctx: Context, form_messages: FormMessage[], _field_errors: Partial<Record<keyof Fields, string>>): Promise<FormReaction>;
24
- onError(ctx: Context, data: FormData, error: unknown): Promise<FormReaction>;
25
- abstract onSubmit(ctx: Context, data: FormData): SubmitResult | Promise<SubmitResult>;
26
- onSuccess(ctx: Context, _data: FormData, _submitResult: SubmitResult): Promise<FormReaction>;
27
- getRawValuesOnSuccess(ctx: Context): Promise<Record<string, FormDataValue>>;
28
- handlePost(ctx: Context): Promise<FormReaction>;
29
- mount(router: Router, path: string): void;
30
- extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
31
- static initFieldNames(fields: Record<string, FormField>): void;
32
- }
@@ -1,32 +0,0 @@
1
- import { Context } from "koa";
2
- import Router from "@koa/router";
3
- import { FormData, FormDataValue, FormMessage, FormReaction } from "./form-types.js";
4
- import { Fields, MountableWithFields, PageErrorMessage } from "../page/mountable-with-fields.js";
5
- import { Readable } from "stream";
6
- import { FormField } from "../index.js";
7
- export declare abstract class Form<F extends Fields, SubmitResult> extends MountableWithFields<F> {
8
- defaultSuccessMessage: string;
9
- submitButtonText: string;
10
- action: string;
11
- useTurbo: boolean;
12
- form_id: string;
13
- canAccess(_: Context): Promise<{
14
- canAccess: boolean;
15
- message: string;
16
- }>;
17
- renderError(_: Context, error: PageErrorMessage): Promise<JSX.Element | Readable>;
18
- makeSubmitButton(): JSX.Element;
19
- render(ctx: Context, data: FormData, show_field_errors: boolean): Promise<JSX.Element | Readable>;
20
- makeFormClasses(_ctx: Context): Promise<string[]>;
21
- makeOpenFormTag(ctx: Context): JSX.Element;
22
- makeCloseFormTag(): JSX.Element;
23
- onValuesInvalid(ctx: Context, form_messages: FormMessage[], _field_errors: Partial<Record<keyof Fields, string>>): Promise<FormReaction>;
24
- onError(ctx: Context, data: FormData, error: unknown): Promise<FormReaction>;
25
- abstract onSubmit(ctx: Context, data: FormData): SubmitResult | Promise<SubmitResult>;
26
- onSuccess(ctx: Context, _data: FormData, _submitResult: SubmitResult): Promise<FormReaction>;
27
- getRawValuesOnSuccess(ctx: Context): Promise<Record<string, FormDataValue>>;
28
- handlePost(ctx: Context): Promise<FormReaction>;
29
- mount(router: Router, path: string): void;
30
- extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
31
- static initFieldNames(fields: Record<string, FormField>): void;
32
- }
@@ -1,33 +0,0 @@
1
- import { Context } from "koa";
2
- import Router from "@koa/router";
3
- import { FormData, FormDataValue, FormMessage, FormReaction } from "./form-types.js";
4
- import { Fields, MountableWithFields, PageErrorMessage } from "../page/mountable-with-fields.js";
5
- import { Readable } from "stream";
6
- import { FormField } from "../index.js";
7
- import { FieldMessages } from "./controls/form-control.js";
8
- export declare abstract class Form<F extends Fields, SubmitResult> extends MountableWithFields<F> {
9
- defaultSuccessMessage: string;
10
- submitButtonText: string;
11
- action: string;
12
- useTurbo: boolean;
13
- form_id: string;
14
- canAccess(_: Context): Promise<{
15
- canAccess: boolean;
16
- message: string;
17
- }>;
18
- renderError(_: Context, error: PageErrorMessage): Promise<JSX.Element | Readable>;
19
- makeSubmitButton(): JSX.Element;
20
- render(ctx: Context, data: FormData, show_field_errors: boolean): Promise<JSX.Element | Readable>;
21
- makeFormClasses(_ctx: Context): Promise<string[]>;
22
- makeOpenFormTag(ctx: Context): JSX.Element;
23
- makeCloseFormTag(): JSX.Element;
24
- onValuesInvalid(ctx: Context, form_messages: FormMessage[], field_errors: FieldMessages<keyof Fields>): Promise<FormReaction>;
25
- onError(ctx: Context, data: FormData, error: unknown): Promise<FormReaction>;
26
- abstract onSubmit(ctx: Context, data: FormData): SubmitResult | Promise<SubmitResult>;
27
- onSuccess(ctx: Context, _data: FormData, _submitResult: SubmitResult): Promise<FormReaction>;
28
- getRawValuesOnSuccess(ctx: Context): Promise<Record<string, FormDataValue>>;
29
- handlePost(ctx: Context): Promise<FormReaction>;
30
- mount(router: Router, path: string): void;
31
- extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
32
- static initFieldNames(fields: Record<string, FormField>): void;
33
- }
@@ -1,6 +0,0 @@
1
- import { Controls, Fields, Form, Mountable } from "../index.js";
2
- declare const fields: {
3
- text: Fields.TextBasedSimpleField<true, Controls.SimpleInput<string | null, import("./controls/simple-input.js").SimpleInputOptions>>;
4
- };
5
- export declare function form_factory(canAccessFun?: Mountable["canAccess"]): Form<typeof fields, void>;
6
- export {};
@@ -1,6 +0,0 @@
1
- import { Controls, Fields, Form, Mountable } from "../index.js";
2
- declare const fields: {
3
- text: Fields.TextBasedSimpleField<true, Controls.SimpleInput<string | null, import("./controls/simple-input.js").SimpleInputOptions>>;
4
- };
5
- export declare function form_factory(canAccessFun?: Mountable["canAccess"]): Form<typeof fields, void>;
6
- export {};
@@ -1,23 +0,0 @@
1
- import Router from "@koa/router";
2
- import { Context } from "koa";
3
- import { FlatTemplatable } from "tempstream";
4
- import { Fields, MountableWithFields } from "../page/mountable-with-fields.js";
5
- import type { FormDataValue, FormMessage } from "./form-types.js";
6
- import { Form } from "./form.js";
7
- export declare class Multiform extends MountableWithFields {
8
- controls: never[];
9
- name: string;
10
- forms: Record<string, Form<Fields, unknown>>;
11
- init(): void;
12
- extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
13
- canAccess(): Promise<{
14
- canAccess: boolean;
15
- message: string;
16
- }>;
17
- getSubformsToRender(ctx: Context): Array<readonly [string, Form<any, unknown>]>;
18
- renderSubform(ctx: Context, sub_form_name: string, show_field_errors: boolean): Promise<FlatTemplatable>;
19
- getSubformRawValues(ctx: Context, sub_form_name: string): Promise<Record<string, FormDataValue>>;
20
- render(ctx: Context, messages: FormMessage[], prerenderedForms: Record<string, FlatTemplatable | undefined> | undefined, show_field_errors: boolean): Promise<FlatTemplatable>;
21
- makeBottomScript(): string;
22
- mount(router: Router, path: string): void;
23
- }
@@ -1,23 +0,0 @@
1
- import Router from "@koa/router";
2
- import { Context } from "koa";
3
- import { FlatTemplatable } from "tempstream";
4
- import { Fields, MountableWithFields } from "../page/mountable-with-fields.js";
5
- import type { FormDataValue, FormMessage } from "./form-types.js";
6
- import { Form } from "./form.js";
7
- export declare class Multiform extends MountableWithFields {
8
- controls: never[];
9
- name: string;
10
- forms: Record<string, Form<Fields, unknown>>;
11
- init(): void;
12
- extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
13
- canAccess(): Promise<{
14
- canAccess: boolean;
15
- message: string;
16
- }>;
17
- getSubformsToRender(ctx: Context): Array<readonly [string, Form<any, unknown>]>;
18
- renderSubform(ctx: Context, sub_form_name: string, show_field_errors: boolean): Promise<FlatTemplatable>;
19
- getSubformRawValues(ctx: Context, sub_form_name: string): Promise<Record<string, FormDataValue>>;
20
- render(ctx: Context, messages: FormMessage[], prerenderedForms: Record<string, FlatTemplatable | undefined> | undefined, show_field_errors: boolean): Promise<FlatTemplatable>;
21
- makeBottomScript(): string;
22
- mount(router: Router, path: string): void;
23
- }
@@ -1,46 +0,0 @@
1
- export * as Controls from "./forms/controls/controls.js";
2
- export * from "./forms/fields/field.js";
3
- export * as Fields from "./forms/fields/fields.js";
4
- export * from "./page/mountable.js";
5
- export * from "./page/page.js";
6
- export * from "./page/stateful-page.js";
7
- export * from "./forms/form-types.js";
8
- export * from "./forms/form.js";
9
- export * from "./page/props-parser.js";
10
- export * from "./utils/utils.js";
11
- export * from "./page/list.js";
12
- export * from "./page/sealious-list.js";
13
- export * from "./utils/translate.js";
14
- export * as sanitize from "./sanitize.js";
15
- export * from "./forms/multiform.js";
16
- export * as Components from "./components/components.js";
17
- export * from "./mount.js";
18
- export * from "./page/default-list-filters.js";
19
- export * from "./forms/fields/get-field-for-sealious.js";
20
- import { Context } from "koa";
21
- import { Readable } from "node:stream";
22
- export interface HTMLOptions {
23
- morphing?: boolean;
24
- }
25
- export interface HTMLHeadOptions {
26
- ctx: Context;
27
- title: string | Promise<string | Readable>;
28
- htmlOptions: Partial<HTMLOptions>;
29
- metaImage?: string;
30
- canonicalPath?: string;
31
- css_clumps: string[];
32
- description: string;
33
- }
34
- export interface HTMLArgs {
35
- ctx: Context;
36
- title: string | Promise<string>;
37
- body: string | Promise<string> | Readable;
38
- htmlOptions?: Partial<HTMLOptions>;
39
- makeHead?: (args: HTMLHeadOptions) => string | Promise<string> | Readable | Promise<Readable>;
40
- metaImage?: string;
41
- canonicalPath?: string;
42
- css_clumps?: string[];
43
- description: string;
44
- hideNavigation?: boolean;
45
- }
46
- export type HTMLFunc = (args: HTMLArgs) => Readable | Promise<Readable>;
@@ -1,6 +0,0 @@
1
- import Router from "@koa/router";
2
- import { FileManager } from "@sealcode/file-manager";
3
- import { Mountable } from "./page/mountable.js";
4
- export declare function mount(router: Router, url: string | {
5
- rawURL: string;
6
- }, mountable: Mountable, use_dummy_app?: boolean, file_manager?: FileManager | undefined): void;
@@ -1,48 +0,0 @@
1
- import { Context } from "koa";
2
- import { Templatable, FlatTemplatable } from "tempstream";
3
- import { Page } from "./page.js";
4
- import { ShapeToType } from "@sealcode/ts-predicates";
5
- import { FormControl } from "../forms/controls/controls.js";
6
- import { FormField } from "../forms/fields/field.js";
7
- import { NumberField } from "../forms/fields/number.js";
8
- import { TextBasedSimpleField } from "../forms/fields/simple-form-field.js";
9
- import { FormDataValue } from "../forms/form-types.js";
10
- export declare const BasePagePropsShape: {};
11
- export type BasePageProps = ShapeToType<typeof BasePagePropsShape>;
12
- export declare const DEFAULT_ITEMS_PER_PAGE = 12;
13
- export declare const BaseListPageFields: {
14
- readonly page: NumberField<1, false>;
15
- readonly itemsPerPage: NumberField<12, false>;
16
- readonly sort: TextBasedSimpleField<false, import("../forms/controls/simple-input.js").SimpleInput<string | null, import("../forms/controls/simple-input.js").SimpleInputOptions>>;
17
- };
18
- export type ListSort = {
19
- field: string;
20
- order: "asc" | "desc";
21
- };
22
- export declare abstract class ListPage<ItemType, F extends typeof BaseListPageFields> extends Page<F> {
23
- abstract getItems(ctx: Context, page: number, itemsPerPage: number | null, values: Record<string, FormDataValue>): Promise<ItemType[]>;
24
- abstract getTotalPages(ctx: Context, itemsPerPage: number, values: Record<string, FormDataValue>): Promise<number>;
25
- abstract renderItem(ctx: Context, item: ItemType, index: number): Promise<FlatTemplatable>;
26
- filterFields: Record<string, FormField>;
27
- filterControls: FormControl[];
28
- init(): void;
29
- renderListContainer(_: Context, content: Templatable): FlatTemplatable;
30
- getPaginationConfig(ctx: Context): Promise<{
31
- page: number;
32
- itemsPerPage: number | null;
33
- }>;
34
- renderItems(ctx: Context, values?: Record<string, FormDataValue>, items?: ItemType[]): Promise<FlatTemplatable>;
35
- renderPagination(ctx: Context, values: Record<string, FormDataValue>): Promise<FlatTemplatable>;
36
- private renderPageButton;
37
- getFilterValues(ctx: Context): Promise<Record<string, unknown>>;
38
- getSort(ctx: Context): Promise<ListSort | null>;
39
- makeSortLink(ctx: Context, field: string, order: "asc" | "desc" | null): string;
40
- renderFilters(ctx: Context): Promise<FlatTemplatable>;
41
- renderHeading(ctx: Context, field: string, label?: string): Promise<FlatTemplatable>;
42
- getDefaultSort(_: Context): ListSort | null;
43
- renderTableHead(ctx: Context, fields: {
44
- field: string;
45
- label?: string;
46
- }[]): FlatTemplatable;
47
- render(ctx: Context): Promise<FlatTemplatable>;
48
- }
@@ -1,48 +0,0 @@
1
- import { Context } from "koa";
2
- import { Templatable, FlatTemplatable } from "tempstream";
3
- import { Page } from "./page.js";
4
- import { ShapeToType } from "@sealcode/ts-predicates";
5
- import { FormControl } from "../forms/controls/controls.js";
6
- import { FormField } from "../forms/fields/field.js";
7
- import { NumberField } from "../forms/fields/number.js";
8
- import { TextBasedSimpleField } from "../forms/fields/simple-form-field.js";
9
- import { FormDataValue } from "../forms/form-types.js";
10
- export declare const BasePagePropsShape: {};
11
- export type BasePageProps = ShapeToType<typeof BasePagePropsShape>;
12
- export declare const DEFAULT_ITEMS_PER_PAGE = 12;
13
- export declare const BaseListPageFields: {
14
- readonly page: NumberField<1, false>;
15
- readonly itemsPerPage: NumberField<12, false>;
16
- readonly sort: TextBasedSimpleField<false, import("../forms/controls/simple-input.js").SimpleInput<string | null, import("../forms/controls/simple-input.js").SimpleInputOptions>>;
17
- };
18
- export type ListSort = {
19
- field: string;
20
- order: "asc" | "desc";
21
- };
22
- export declare abstract class ListPage<ItemType, F extends typeof BaseListPageFields> extends Page<F> {
23
- abstract getItems(ctx: Context, page: number, itemsPerPage: number | null, values: Record<string, FormDataValue>): Promise<ItemType[]>;
24
- abstract getTotalPages(ctx: Context, itemsPerPage: number, values: Record<string, FormDataValue>): Promise<number>;
25
- abstract renderItem(ctx: Context, item: ItemType, index: number): Promise<FlatTemplatable>;
26
- filterFields: Record<string, FormField>;
27
- filterControls: FormControl[];
28
- init(): void;
29
- renderListContainer(_: Context, content: Templatable): FlatTemplatable;
30
- getPaginationConfig(ctx: Context): Promise<{
31
- page: number;
32
- itemsPerPage: number | null;
33
- }>;
34
- renderItems(ctx: Context, values?: Record<string, FormDataValue>, items?: ItemType[]): Promise<FlatTemplatable>;
35
- renderPagination(ctx: Context, values: Record<string, FormDataValue>): Promise<FlatTemplatable>;
36
- private renderPageButton;
37
- getFilterValues(ctx: Context): Promise<Record<string, unknown>>;
38
- getSort(ctx: Context): Promise<ListSort | null>;
39
- makeSortLink(ctx: Context, field: string, order: "asc" | "desc" | null): string;
40
- renderFilters(ctx: Context): Promise<FlatTemplatable>;
41
- renderHeading(ctx: Context, field: string, label?: string): Promise<FlatTemplatable>;
42
- getDefaultSort(_: Context): ListSort | null;
43
- renderTableHead(ctx: Context, fields: {
44
- field: string;
45
- label?: string;
46
- }[]): FlatTemplatable;
47
- render(ctx: Context): Promise<FlatTemplatable>;
48
- }
@@ -1,48 +0,0 @@
1
- import { Context } from "koa";
2
- import { Templatable, FlatTemplatable } from "tempstream";
3
- import { Page } from "./page.js";
4
- import { ShapeToType } from "@sealcode/ts-predicates";
5
- import { FormControl } from "../forms/controls/controls.js";
6
- import { FormField } from "../forms/fields/field.js";
7
- import { NumberField } from "../forms/fields/number.js";
8
- import { TextBasedSimpleField } from "../forms/fields/simple-form-field.js";
9
- import { FormDataValue } from "../forms/form-types.js";
10
- export declare const BasePagePropsShape: {};
11
- export type BasePageProps = ShapeToType<typeof BasePagePropsShape>;
12
- export declare const DEFAULT_ITEMS_PER_PAGE = 12;
13
- export declare const BaseListPageFields: {
14
- readonly page: NumberField<1, false>;
15
- readonly itemsPerPage: NumberField<12, false>;
16
- readonly sort: TextBasedSimpleField<false, import("../forms/controls/simple-input.js").SimpleInput<import("../forms/controls/simple-input.js").SimpleInputOptions>>;
17
- };
18
- export type ListSort = {
19
- field: string;
20
- order: "asc" | "desc";
21
- };
22
- export declare abstract class ListPage<ItemType, F extends typeof BaseListPageFields> extends Page<F> {
23
- abstract getItems(ctx: Context, page: number, itemsPerPage: number | null, values: Record<string, FormDataValue>): Promise<ItemType[]>;
24
- abstract getTotalPages(ctx: Context, itemsPerPage: number, values: Record<string, FormDataValue>): Promise<number>;
25
- abstract renderItem(ctx: Context, item: ItemType, index: number): Promise<FlatTemplatable>;
26
- filterFields: Record<string, FormField>;
27
- filterControls: FormControl[];
28
- init(): void;
29
- renderListContainer(_: Context, content: Templatable): FlatTemplatable;
30
- getPaginationConfig(ctx: Context): Promise<{
31
- page: number;
32
- itemsPerPage: number | null;
33
- }>;
34
- renderItems(ctx: Context, values?: Record<string, FormDataValue>, items?: ItemType[]): Promise<FlatTemplatable>;
35
- renderPagination(ctx: Context, values: Record<string, FormDataValue>): Promise<FlatTemplatable>;
36
- private renderPageButton;
37
- getFilterValues(ctx: Context): Promise<Record<string, unknown>>;
38
- getSort(ctx: Context): Promise<ListSort | null>;
39
- makeSortLink(ctx: Context, field: string, order: "asc" | "desc" | null): string;
40
- renderFilters(ctx: Context): Promise<FlatTemplatable>;
41
- renderHeading(ctx: Context, field: string, label?: string): Promise<FlatTemplatable>;
42
- getDefaultSort(_: Context): ListSort | null;
43
- renderTableHead(ctx: Context, fields: {
44
- field: string;
45
- label?: string;
46
- }[]): FlatTemplatable;
47
- render(ctx: Context): Promise<FlatTemplatable>;
48
- }
@@ -1,42 +0,0 @@
1
- import { ShapeToType } from "@sealcode/ts-predicates";
2
- import { Context } from "koa";
3
- import { FlatTemplatable } from "tempstream";
4
- import { FormControl, FormControlContext } from "../forms/controls/form-control.js";
5
- import type { FieldsToShape, FormField } from "../forms/fields/field.js";
6
- import type { FormDataValue, FormMessage, FormData } from "../forms/form-types.js";
7
- import { Mountable } from "./mountable.js";
8
- export type PageErrorMessage = {
9
- type: "access" | "internal";
10
- message: string;
11
- };
12
- export type Fields = Record<string, FormField<boolean, any>>;
13
- type Resolved<T> = T extends Promise<infer X> ? X : never;
14
- type ParsedValue<T extends FormField> = Resolved<ReturnType<T["getParsedValue"]>>["parsed"];
15
- export declare abstract class MountableWithFields<F extends Fields = Fields> extends Mountable {
16
- fields: F;
17
- field_names_prefix: string;
18
- form_id: string;
19
- abstract controls: FormControl[];
20
- constructor();
21
- init(): void;
22
- makeFormControlContext(ctx: Context, data: FormData, validate: boolean, field_name_prefix?: string, form_id?: string): FormControlContext;
23
- validateValues(_ctx: Context, _data: Record<string, FormDataValue>): Promise<{
24
- valid: boolean;
25
- error: string;
26
- }>;
27
- getInitialValues(_ctx: Context): Promise<Record<string, FormDataValue>>;
28
- validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
29
- valid: boolean;
30
- field_errors: Partial<Record<keyof Fields, string>>;
31
- form_messages: FormMessage[];
32
- }>;
33
- renderControls(fctx: FormControlContext): FlatTemplatable;
34
- renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
35
- renderMessages(_: Context, data: FormData<keyof Fields>): FlatTemplatable;
36
- abstract extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
37
- getParsedValues(ctx: Context): Promise<{
38
- [field in keyof F]: F[field] extends FormField<true> ? Exclude<ParsedValue<F[field]>, null> : ParsedValue<F[field]>;
39
- }>;
40
- getDatabaseValues(ctx: Context): Promise<ShapeToType<FieldsToShape<F>>>;
41
- }
42
- export {};
@@ -1,42 +0,0 @@
1
- import { ShapeToType } from "@sealcode/ts-predicates";
2
- import { Context } from "koa";
3
- import { FlatTemplatable } from "tempstream";
4
- import { FormControl, FormControlContext } from "../forms/controls/form-control.js";
5
- import type { FieldsToShape, FormField } from "../forms/fields/field.js";
6
- import type { FormDataValue, FormMessage, FormData } from "../forms/form-types.js";
7
- import { Mountable } from "./mountable.js";
8
- export type PageErrorMessage = {
9
- type: "access" | "internal";
10
- message: string;
11
- };
12
- export type Fields = Record<string, FormField<boolean, any>>;
13
- type Resolved<T> = T extends Promise<infer X> ? X : never;
14
- type ParsedValue<T extends FormField> = Resolved<ReturnType<T["getParsedValue"]>>["parsed"];
15
- export declare abstract class MountableWithFields<F extends Fields = Fields> extends Mountable {
16
- fields: F;
17
- field_names_prefix: string;
18
- form_id: string;
19
- abstract controls: FormControl[];
20
- constructor();
21
- init(): void;
22
- makeFormControlContext(ctx: Context, data: FormData, validate: boolean, field_name_prefix?: string, form_id?: string): FormControlContext;
23
- validateValues(_ctx: Context, _data: Record<string, FormDataValue>): Promise<{
24
- valid: boolean;
25
- error: string;
26
- }>;
27
- getInitialValues(_ctx: Context): Promise<Record<string, FormDataValue>>;
28
- validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
29
- valid: boolean;
30
- field_errors: Partial<Record<keyof Fields, string>>;
31
- form_messages: FormMessage[];
32
- }>;
33
- renderControls(fctx: FormControlContext): FlatTemplatable;
34
- renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
35
- renderMessages(_: Context, data: FormData<keyof Fields>): FlatTemplatable;
36
- abstract extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
37
- getParsedValues(ctx: Context): Promise<{
38
- [field in keyof F]: F[field] extends FormField<true> ? Exclude<ParsedValue<F[field]>, null> : ParsedValue<F[field]>;
39
- }>;
40
- getDatabaseValues(ctx: Context): Promise<ShapeToType<FieldsToShape<F>>>;
41
- }
42
- export {};
@@ -1,42 +0,0 @@
1
- import { ShapeToType } from "@sealcode/ts-predicates";
2
- import { Context } from "koa";
3
- import { FlatTemplatable } from "tempstream";
4
- import { FieldMessages, FormControl, FormControlContext } from "../forms/controls/form-control.js";
5
- import type { FieldsToShape, FormField } from "../forms/fields/field.js";
6
- import type { FormDataValue, FormMessage, FormData } from "../forms/form-types.js";
7
- import { Mountable } from "./mountable.js";
8
- export type PageErrorMessage = {
9
- type: "access" | "internal";
10
- message: string;
11
- };
12
- export type Fields = Record<string, FormField<boolean, any>>;
13
- type Resolved<T> = T extends Promise<infer X> ? X : never;
14
- type ParsedValue<T extends FormField> = Resolved<ReturnType<T["getParsedValue"]>>["parsed"];
15
- export declare abstract class MountableWithFields<F extends Fields = Fields> extends Mountable {
16
- fields: F;
17
- field_names_prefix: string;
18
- form_id: string;
19
- abstract controls: FormControl[];
20
- constructor();
21
- init(): void;
22
- makeFormControlContext(ctx: Context, data: FormData, validate: boolean, field_messages: FieldMessages, field_name_prefix?: string, form_id?: string): FormControlContext;
23
- validateValues(_ctx: Context, _data: Record<string, FormDataValue>): Promise<{
24
- valid: boolean;
25
- error: string;
26
- }>;
27
- getInitialValues(_ctx: Context): Promise<Record<string, FormDataValue>>;
28
- validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
29
- valid: boolean;
30
- field_errors: Partial<Record<keyof Fields, string>>;
31
- form_messages: FormMessage[];
32
- }>;
33
- renderControls(fctx: FormControlContext): FlatTemplatable;
34
- renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
35
- renderMessages(_: Context, data: FormData<keyof Fields>): FlatTemplatable;
36
- abstract extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
37
- getParsedValues(ctx: Context): Promise<{
38
- [field in keyof F]: F[field] extends FormField<true> ? Exclude<ParsedValue<F[field]>, null> : ParsedValue<F[field]>;
39
- }>;
40
- getDatabaseValues(ctx: Context): Promise<ShapeToType<FieldsToShape<F>>>;
41
- }
42
- export {};
@@ -1,10 +0,0 @@
1
- import Router from "@koa/router";
2
- import { Context } from "koa";
3
- export declare abstract class Mountable {
4
- init(): void;
5
- abstract mount(router: Router, path: string): void;
6
- abstract canAccess(ctx: Context): Promise<{
7
- canAccess: boolean;
8
- message: string;
9
- }>;
10
- }
@@ -1,18 +0,0 @@
1
- import Router from "@koa/router";
2
- import { Context } from "koa";
3
- import { FlatTemplatable } from "tempstream";
4
- import type { FormDataValue } from "../forms/form-types.js";
5
- import { Fields, MountableWithFields, PageErrorMessage } from "./mountable-with-fields.js";
6
- import { PagePropsParser } from "./props-parser.js";
7
- export declare abstract class Page<F extends Fields = Record<string, never>> extends MountableWithFields<F> {
8
- propsParser: PagePropsParser<Record<keyof Fields, unknown>>;
9
- controls: never[];
10
- mount(router: Router, path: string): void;
11
- canAccess(_: Context): Promise<{
12
- canAccess: boolean;
13
- message: string;
14
- }>;
15
- renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
16
- abstract render(ctx: Context): Promise<FlatTemplatable>;
17
- extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
18
- }
@@ -1,15 +0,0 @@
1
- import { Context } from "koa";
2
- import { FormDataValue } from "../forms/form-types.js";
3
- import type { BasePageProps } from "./list.js";
4
- export type EncodedProps = Record<string, unknown>;
5
- export declare abstract class PagePropsParser<PropsType> {
6
- abstract decode(ctx: Context): Record<string, FormDataValue>;
7
- abstract encode(props: Record<string, FormData>): EncodedProps;
8
- abstract getHTMLInputName(prop_name: string): string;
9
- overwriteProp(ctx: Context, new_props: Partial<PropsType>): EncodedProps;
10
- }
11
- export declare class AllQueryParams<PropsType extends BasePageProps> extends PagePropsParser<PropsType> {
12
- decode(ctx: Context): Record<string, FormDataValue>;
13
- encode(props: PropsType): Record<string, unknown>;
14
- getHTMLInputName(prop_name: string): string;
15
- }