firstly 0.0.3 → 0.0.5

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 (93) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/esm/{KitBaseEnum.d.ts → BaseEnum.d.ts} +18 -9
  3. package/esm/{KitBaseEnum.js → BaseEnum.js} +2 -13
  4. package/esm/{KitEntity.d.ts → FF_Entity.d.ts} +1 -1
  5. package/esm/{KitEntity.js → FF_Entity.js} +9 -9
  6. package/esm/{KitFields.d.ts → FF_Fields.d.ts} +4 -5
  7. package/esm/{KitFields.js → FF_Fields.js} +41 -55
  8. package/esm/ROUTES.d.ts +4 -2
  9. package/esm/ROUTES.js +4 -7
  10. package/esm/SqlDatabase/FF_LogToConsole.d.ts +1 -0
  11. package/esm/SqlDatabase/{LogToConsoleCustom.js → FF_LogToConsole.js} +1 -1
  12. package/esm/api/index.d.ts +1 -0
  13. package/esm/auth/Adapter.js +10 -8
  14. package/esm/auth/{AuthController.d.ts → AuthController.server.d.ts} +2 -2
  15. package/esm/auth/{AuthController.js → AuthController.server.js} +15 -51
  16. package/esm/auth/Entities.d.ts +18 -17
  17. package/esm/auth/Entities.js +66 -63
  18. package/esm/auth/README.md +13 -0
  19. package/esm/auth/{RoleController.d.ts → RoleHelpers.d.ts} +2 -4
  20. package/esm/auth/RoleHelpers.js +43 -0
  21. package/esm/auth/client/Auth.d.ts +69 -0
  22. package/esm/auth/client/Auth.js +121 -0
  23. package/esm/auth/client/index.d.ts +2 -0
  24. package/esm/auth/client/index.js +2 -0
  25. package/esm/auth/index.d.ts +10 -11
  26. package/esm/auth/index.js +37 -21
  27. package/esm/auth/providers/github.d.ts +22 -17
  28. package/esm/auth/providers/github.js +29 -15
  29. package/esm/auth/providers/strava.d.ts +22 -17
  30. package/esm/auth/providers/strava.js +23 -15
  31. package/esm/auth/static/assets/{Page-BwHye0GW.d.ts → Page-BYzkK4q3.d.ts} +1 -1
  32. package/esm/auth/static/assets/{Page-BwHye0GW.js → Page-BYzkK4q3.js} +1 -1
  33. package/esm/auth/static/assets/Page-ByIhtXVt.d.ts +5 -0
  34. package/esm/auth/static/assets/Page-ByIhtXVt.js +8190 -0
  35. package/esm/auth/static/assets/{Page-BMOLAIFx.d.ts → Page-Do7F0Mzd.d.ts} +1 -1
  36. package/esm/auth/static/assets/{Page-BMOLAIFx.js → Page-Do7F0Mzd.js} +1 -1
  37. package/esm/auth/static/assets/index-czJ1PA1n.js +2 -0
  38. package/esm/auth/static/index.html +1 -1
  39. package/esm/bin/cmd.js +182 -83
  40. package/esm/cellsBuildor.d.ts +45 -0
  41. package/esm/{kitCellsBuildor.js → cellsBuildor.js} +24 -14
  42. package/esm/feedback/ui/DialogIssue.svelte +2 -2
  43. package/esm/formats/dates.js +2 -2
  44. package/esm/formats/strings.js +0 -11
  45. package/esm/handle/index.d.ts +1 -0
  46. package/esm/helper.d.ts +8 -10
  47. package/esm/helper.js +13 -12
  48. package/esm/index.d.ts +37 -48
  49. package/esm/index.js +29 -20
  50. package/esm/{kitStoreItem.d.ts → storeItem.d.ts} +1 -1
  51. package/esm/{kitStoreItem.js → storeItem.js} +3 -3
  52. package/esm/{kitStoreList.d.ts → storeList.d.ts} +4 -4
  53. package/esm/{kitStoreList.js → storeList.js} +1 -1
  54. package/esm/ui/Button.svelte +7 -9
  55. package/esm/ui/Button.svelte.d.ts +2 -2
  56. package/esm/ui/Field.svelte +9 -8
  57. package/esm/ui/Field.svelte.d.ts +2 -2
  58. package/esm/ui/FieldGroup.svelte +5 -3
  59. package/esm/ui/FieldGroup.svelte.d.ts +4 -4
  60. package/esm/ui/Grid.svelte.d.ts +5 -5
  61. package/esm/ui/GridPaginate.svelte +3 -6
  62. package/esm/ui/Icon.svelte +6 -7
  63. package/esm/ui/LibIcon.js +0 -2
  64. package/esm/ui/dialog/DialogForm.svelte +5 -6
  65. package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +2 -2
  66. package/esm/ui/dialog/FormEditAction.svelte.d.ts +2 -2
  67. package/esm/ui/dialog/dialog.d.ts +7 -5
  68. package/esm/ui/dialog/dialog.js +1 -0
  69. package/esm/ui/index.d.ts +2 -2
  70. package/esm/ui/internals/FieldContainer.svelte +1 -1
  71. package/esm/ui/internals/Input.svelte +1 -1
  72. package/esm/ui/internals/select/MultiSelectMelt.svelte +16 -19
  73. package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +3 -3
  74. package/esm/ui/internals/select/SelectMelt.svelte +10 -14
  75. package/esm/ui/internals/select/SelectMelt.svelte.d.ts +3 -3
  76. package/esm/ui/internals/select/SelectRadio.svelte.d.ts +2 -2
  77. package/esm/ui/link/LinkPlus.svelte.d.ts +2 -2
  78. package/esm/utils/types.d.ts +0 -15
  79. package/esm/utils/types.js +1 -17
  80. package/esm/virtual/Customer.js +2 -2
  81. package/esm/virtual/FilterEntity.js +1 -1
  82. package/esm/virtual/StateDemoEnum.d.ts +4 -4
  83. package/esm/virtual/StateDemoEnum.js +2 -2
  84. package/esm/virtual/UIEntity.js +4 -4
  85. package/esm/vite/index.js +1 -1
  86. package/package.json +10 -5
  87. package/esm/SqlDatabase/LogToConsoleCustom.d.ts +0 -1
  88. package/esm/auth/RoleController.js +0 -57
  89. package/esm/auth/static/assets/Page-BMFREPjF.d.ts +0 -5
  90. package/esm/auth/static/assets/Page-BMFREPjF.js +0 -18
  91. package/esm/auth/static/assets/index-CKmKKRRL.js +0 -2
  92. package/esm/kitCellsBuildor.d.ts +0 -45
  93. /package/esm/auth/static/assets/{index-CKmKKRRL.d.ts → index-czJ1PA1n.d.ts} +0 -0
@@ -1,3 +1,4 @@
1
+ /// <reference types=".pnpm/@sveltejs+kit@2.5.24_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.18_vite@5.4.1_@types+node@_vtylvkjv5lewhfcl4vq2py4rce/node_modules/@sveltejs/kit" />
1
2
  import type { Handle } from '@sveltejs/kit';
2
3
  import type { RemultSveltekitServer } from 'remult/remult-sveltekit';
3
4
  import type { Module } from '../api';
package/esm/helper.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { type ErrorInfo, type FieldMetadata, type Repository } from 'remult';
2
- import { type KitBaseItem } from './index.js';
1
+ import type { ClassType, ErrorInfo, FieldMetadata, Repository } from 'remult';
2
+ import type { BaseEnum, BaseItem } from './index.js';
3
3
  export declare function isError<T>(object: any): object is ErrorInfo<T>;
4
4
  export declare const getFirstInterestingField: <Entity>(repo: Repository<Entity>) => FieldMetadata<any, Entity>;
5
- export declare const getEntityDisplayValue: <Entity>(repo: Repository<Entity>, row: Entity) => KitBaseItem;
6
- export declare const getFieldLinkDisplayValue: (field: FieldMetadata, row: any) => import("./KitBaseEnum.js").KitBaseEnumOptions & {
5
+ export declare const getEntityDisplayValue: <Entity>(repo: Repository<Entity>, row: Entity) => BaseItem;
6
+ export declare const getFieldLinkDisplayValue: (field: FieldMetadata, row: any) => import("./BaseEnum.js").BaseEnumOptions<any> & {
7
7
  id: string;
8
8
  captionSub?: string | (string | undefined)[] | undefined;
9
9
  href?: string | undefined;
@@ -16,7 +16,7 @@ export declare const getFieldLinkDisplayValue: (field: FieldMetadata, row: any)
16
16
  } & {
17
17
  href: string;
18
18
  };
19
- export declare const getEntityDisplayValueFromField: (field: FieldMetadata, row: any) => KitBaseItem & {
19
+ export declare const getEntityDisplayValueFromField: (field: FieldMetadata, row: any) => BaseItem & {
20
20
  href: string;
21
21
  };
22
22
  export type MetaTypeRelation = {
@@ -28,7 +28,7 @@ export type MetaTypeRelation = {
28
28
  type MetaTypeEnum = {
29
29
  kind: 'enum';
30
30
  subKind: 'single' | 'multi';
31
- values: KitBaseItem[];
31
+ values: BaseItem[];
32
32
  field: FieldMetadata;
33
33
  };
34
34
  type MetaTypePrimitive = {
@@ -43,8 +43,6 @@ type MetaTypeSlot = {
43
43
  export type FieldMetaType = MetaTypeRelation | MetaTypeEnum | MetaTypePrimitive | MetaTypeSlot;
44
44
  export declare const getFieldMetaType: (field?: FieldMetadata) => FieldMetaType;
45
45
  export declare const displayWithDefaultAndSuffix: (field: FieldMetadata<any, any> | undefined, value: any) => string;
46
- /**
47
- * same as `dbNamesOf` but with `tableName` set to `true` by default
48
- */
49
- export declare const kitDbNamesOf: <Entity>(repo: import("remult/src/remult3/RepositoryImplementation.js").EntityMetadataOverloads<Entity>, wrapIdentifierOrOptions?: ((name: string) => string) | import("remult").dbNamesOfOptions | undefined) => Promise<import("remult").EntityDbNames<Entity>>;
46
+ export declare const getEnum: <T extends BaseEnum<any>>(baseEnum: ClassType<T>, id: string | undefined | null) => T | undefined;
47
+ export declare const getEnums: <T extends BaseEnum<any>>(baseEnum: ClassType<T>) => T[];
50
48
  export {};
package/esm/helper.js CHANGED
@@ -1,7 +1,6 @@
1
- import { dbNamesOf, getEntityRef, } from 'remult';
1
+ import { getEntityRef, getValueList } from 'remult';
2
2
  import { getRelationFieldInfo } from 'remult/internals';
3
3
  import { suffixWithS } from './formats/strings.js';
4
- import {} from './index.js';
5
4
  export function isError(object) {
6
5
  return object;
7
6
  }
@@ -59,8 +58,6 @@ export const getFieldMetaType = (field) => {
59
58
  return {
60
59
  kind: 'enum',
61
60
  subKind: 'multi',
62
- // // @ts-ignore
63
- // values: getEnums(field.target) as KitBaseItem[],
64
61
  // @ts-ignore
65
62
  values: field.options.valueConverter.values,
66
63
  field,
@@ -87,9 +84,6 @@ export const getFieldMetaType = (field) => {
87
84
  };
88
85
  export const displayWithDefaultAndSuffix = (field, value) => {
89
86
  const toRet = [];
90
- // TODO: This method should be reviewed. Specifically, server expression & Field.date have
91
- // valueConverter by defualt, so we can't use displayValue if checking for valueConverter
92
- // Hummm... JYC: I didn't understand the above comment.
93
87
  if (field && field.valueConverter?.displayValue && !field.isServerExpression) {
94
88
  toRet.push(field.valueConverter?.displayValue(value) ?? '-');
95
89
  }
@@ -110,9 +104,16 @@ export const displayWithDefaultAndSuffix = (field, value) => {
110
104
  }
111
105
  return toRet.join(' ');
112
106
  };
113
- /**
114
- * same as `dbNamesOf` but with `tableName` set to `true` by default
115
- */
116
- export const kitDbNamesOf = async (...p) => {
117
- return dbNamesOf(p[0], { tableName: true, ...p[1] });
107
+ // FIXME: to remove ?
108
+ export const getEnum = (baseEnum, id) => {
109
+ if (!id) {
110
+ return undefined;
111
+ }
112
+ // @ts-ignore
113
+ const found = getValueList(baseEnum).find((c) => c.id === id);
114
+ return found;
115
+ };
116
+ // FIXME: to remove ?
117
+ export const getEnums = (baseEnum) => {
118
+ return getValueList(baseEnum) || [];
118
119
  };
package/esm/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { FindOptionsBase, Repository } from 'remult';
2
- import 'remult';
1
+ /// <reference types=".pnpm/@sveltejs+kit@2.5.24_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.18_vite@5.4.1_@types+node@_vtylvkjv5lewhfcl4vq2py4rce/node_modules/@sveltejs/kit" />
3
2
  import type { RequestEvent } from '@sveltejs/kit';
3
+ import type { FindOptionsBase } from 'remult';
4
4
  import { Log } from '@kitql/helpers';
5
- import type { KitBaseEnum, KitBaseEnumOptions, KitIcon } from './KitBaseEnum.js';
6
- import type { KitCellsInput as KitCellsInputForExport } from './kitCellsBuildor.js';
7
- import { kitStoreItem } from './kitStoreItem.js';
8
- import { kitStoreList } from './kitStoreList.js';
5
+ import type { BaseEnum, BaseItem, FF_Icon } from './BaseEnum.js';
6
+ import type { CellsInput as CellsInput_ForExport } from './cellsBuildor.js';
7
+ import { storeItem } from './storeItem.js';
8
+ import { storeList } from './storeList.js';
9
9
  import { default as Button } from './ui/Button.svelte';
10
10
  import { default as Clipboardable } from './ui/Clipboardable.svelte';
11
11
  import { default as DialogManagement } from './ui/dialog/DialogManagement.svelte';
@@ -21,48 +21,37 @@ import { default as Link } from './ui/link/Link.svelte';
21
21
  import { default as LinkPlus } from './ui/link/LinkPlus.svelte';
22
22
  import { default as Loading } from './ui/Loading.svelte';
23
23
  import { default as Tooltip } from './ui/Tooltip.svelte';
24
- export declare const logFirstly: Log;
25
- export declare const KitRole: {
24
+ export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
25
+ export declare const ff_Log: Log;
26
+ export declare const FF_Role: {
26
27
  Admin: string;
27
28
  };
28
- export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
29
- export { dialog } from './ui/dialog/dialog.js';
29
+ export type { BaseEnumOptions } from './BaseEnum.js';
30
+ export type { BaseItem };
31
+ export type BaseItemLight = Partial<BaseItem>;
30
32
  export type { DialogMetaDataInternal } from './ui/dialog/dialog.js';
31
- export { KitBaseEnum, getEnum, getEnums } from './KitBaseEnum.js';
32
- export type { KitBaseEnumOptions } from './KitBaseEnum.js';
33
- export { KitFields } from './KitFields.js';
34
- export { KitEntity } from './KitEntity.js';
35
- export { LogToConsoleCustom } from './SqlDatabase/LogToConsoleCustom.js';
36
- export { getEntityDisplayValue, isError, kitDbNamesOf, getFieldLinkDisplayValue } from './helper.js';
37
- export { buildWhere, getPlaceholder, buildSearchWhere, kitCellsBuildor, kitCellBuildor, fieldsOf, } from './kitCellsBuildor.js';
38
- export { kitStoreItem };
39
- export { kitStoreList };
40
- export type KitCellsInput<entityType> = KitCellsInputForExport<entityType>;
41
- export type { KitCell, VisibilityMode } from './kitCellsBuildor.js';
42
- export type { FindOptionsPlus } from './kitStoreList.js';
43
- export type KitBaseItem = KitBaseEnumOptions & {
44
- id: string;
45
- captionSub?: string | (string | undefined)[];
46
- href?: string;
47
- repo?: Repository<any>;
48
- sub?: {
49
- captionPre?: string;
50
- repo?: Repository<any>;
51
- item?: any;
52
- };
53
- };
54
- export type KitStoreItem<T> = ReturnType<typeof kitStoreItem<T>>;
55
- export type KitStoreList<T> = ReturnType<typeof kitStoreList<T>>;
56
- export type KitBaseItemLight = Partial<KitBaseItem>;
57
- export { FilterEntity } from './virtual/FilterEntity.js';
58
- export { UIEntity } from './virtual/UIEntity.js';
59
- export { LibIcon_Empty, LibIcon_Forbidden, LibIcon_ChevronDown, LibIcon_ChevronUp, LibIcon_ChevronLeft, LibIcon_ChevronRight, LibIcon_Search, LibIcon_Check, LibIcon_MultiCheck, LibIcon_Add, LibIcon_MultiAdd, LibIcon_Edit, LibIcon_Delete, LibIcon_Cross, LibIcon_Save, LibIcon_Man, LibIcon_Woman, LibIcon_Send, LibIcon_Load, LibIcon_Settings, LibIcon_Sort, LibIcon_SortAsc, LibIcon_SortDesc, } from './ui/LibIcon.js';
60
- export type { KitIcon };
33
+ export type CellsInput<entityType> = CellsInput_ForExport<entityType>;
34
+ export type { Cell, VisibilityMode } from './cellsBuildor.js';
35
+ export type { FF_FindOptions } from './storeList.js';
36
+ export type StoreItem<T> = ReturnType<typeof storeItem<T>>;
37
+ export type StoreList<T> = ReturnType<typeof storeList<T>>;
38
+ export type { ResolvedType, UnArray } from './utils/types.js';
39
+ export { FF_Fields } from './FF_Fields.js';
40
+ export { FF_Entity } from './FF_Entity.js';
41
+ export { FF_LogToConsole } from './SqlDatabase/FF_LogToConsole.js';
42
+ export { BaseEnum } from './BaseEnum.js';
43
+ export { dialog } from './ui/dialog/dialog.js';
44
+ export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, } from './helper.js';
45
+ export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, } from './cellsBuildor.js';
46
+ export { storeItem };
47
+ export { storeList };
61
48
  export { displayPhone, arrToStr } from './formats/strings.js';
62
49
  export { displayCurrency } from './formats/numbers.js';
63
50
  export { tw } from './utils/tailwind.js';
64
- export { litOrStr } from './utils/types.js';
65
- export type { ResolvedType, UnArray } from './utils/types.js';
51
+ export { FilterEntity } from './virtual/FilterEntity.js';
52
+ export { UIEntity } from './virtual/UIEntity.js';
53
+ export { LibIcon_Empty, LibIcon_Forbidden, LibIcon_ChevronDown, LibIcon_ChevronUp, LibIcon_ChevronLeft, LibIcon_ChevronRight, LibIcon_Search, LibIcon_Check, LibIcon_MultiCheck, LibIcon_Add, LibIcon_MultiAdd, LibIcon_Edit, LibIcon_Delete, LibIcon_Cross, LibIcon_Save, LibIcon_Man, LibIcon_Woman, LibIcon_Send, LibIcon_Load, LibIcon_Settings, LibIcon_Sort, LibIcon_SortAsc, LibIcon_SortDesc, } from './ui/LibIcon.js';
54
+ export type { FF_Icon };
66
55
  declare module 'remult' {
67
56
  interface RemultContext {
68
57
  url: URL;
@@ -87,12 +76,12 @@ declare module 'remult' {
87
76
  }
88
77
  interface EntityOptions<entityType> {
89
78
  searchableFind?: (str: string) => FindOptionsBase<entityType>;
90
- displayValue?: (item: entityType) => KitBaseItem;
91
- permissionApiCrud?: KitBaseEnum[] | KitBaseEnum;
92
- permissionApiDelete?: KitBaseEnum[] | KitBaseEnum;
93
- permissionApiInsert?: KitBaseEnum[] | KitBaseEnum;
94
- permissionApiRead?: KitBaseEnum[] | KitBaseEnum;
95
- permissionApiUpdate?: KitBaseEnum[] | KitBaseEnum;
79
+ displayValue?: (item: entityType) => BaseItem;
80
+ permissionApiCrud?: BaseEnum[] | BaseEnum;
81
+ permissionApiDelete?: BaseEnum[] | BaseEnum;
82
+ permissionApiInsert?: BaseEnum[] | BaseEnum;
83
+ permissionApiRead?: BaseEnum[] | BaseEnum;
84
+ permissionApiUpdate?: BaseEnum[] | BaseEnum;
96
85
  }
97
86
  interface UserInfo {
98
87
  session: {
package/esm/index.js CHANGED
@@ -1,7 +1,6 @@
1
- import 'remult';
2
1
  import { Log } from '@kitql/helpers';
3
- import { kitStoreItem } from './kitStoreItem.js';
4
- import { kitStoreList } from './kitStoreList.js';
2
+ import { storeItem } from './storeItem.js';
3
+ import { storeList } from './storeList.js';
5
4
  import { default as Button } from './ui/Button.svelte';
6
5
  import { default as Clipboardable } from './ui/Clipboardable.svelte';
7
6
  import { default as DialogManagement } from './ui/dialog/DialogManagement.svelte';
@@ -17,26 +16,36 @@ import { default as Link } from './ui/link/Link.svelte';
17
16
  import { default as LinkPlus } from './ui/link/LinkPlus.svelte';
18
17
  import { default as Loading } from './ui/Loading.svelte';
19
18
  import { default as Tooltip } from './ui/Tooltip.svelte';
20
- export const logFirstly = new Log('firstly');
21
- export const KitRole = {
22
- Admin: 'KitAdmin',
23
- };
19
+ // ******************************
20
+ // Svelte Components
21
+ // ******************************
24
22
  export { Field, FormEditAction, Grid, GridPaginate, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
23
+ // ******************************
24
+ // Objects
25
+ // ******************************
26
+ export const ff_Log = new Log('firstly');
27
+ export const FF_Role = {
28
+ Admin: 'FF_Role.Admin',
29
+ };
30
+ // ******************************
31
+ // Helpers
32
+ // ******************************
33
+ export { FF_Fields } from './FF_Fields.js';
34
+ export { FF_Entity } from './FF_Entity.js';
35
+ export { FF_LogToConsole } from './SqlDatabase/FF_LogToConsole.js';
36
+ export { BaseEnum } from './BaseEnum.js';
25
37
  export { dialog } from './ui/dialog/dialog.js';
26
- export { KitBaseEnum, getEnum, getEnums } from './KitBaseEnum.js';
27
- export { KitFields } from './KitFields.js';
28
- export { KitEntity } from './KitEntity.js';
29
- export { LogToConsoleCustom } from './SqlDatabase/LogToConsoleCustom.js';
30
- export { getEntityDisplayValue, isError, kitDbNamesOf, getFieldLinkDisplayValue } from './helper.js';
31
- export { buildWhere, getPlaceholder, buildSearchWhere, kitCellsBuildor, kitCellBuildor, fieldsOf, } from './kitCellsBuildor.js';
32
- export { kitStoreItem };
33
- export { kitStoreList };
38
+ export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, } from './helper.js';
39
+ export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, } from './cellsBuildor.js';
40
+ export { storeItem };
41
+ export { storeList };
42
+ export { displayPhone, arrToStr } from './formats/strings.js';
43
+ export { displayCurrency } from './formats/numbers.js';
44
+ export { tw } from './utils/tailwind.js';
45
+ // Hummm... I don't know if we should keep it...
34
46
  export { FilterEntity } from './virtual/FilterEntity.js';
35
47
  export { UIEntity } from './virtual/UIEntity.js';
48
+ // ******************************
36
49
  // Icons
50
+ // ******************************
37
51
  export { LibIcon_Empty, LibIcon_Forbidden, LibIcon_ChevronDown, LibIcon_ChevronUp, LibIcon_ChevronLeft, LibIcon_ChevronRight, LibIcon_Search, LibIcon_Check, LibIcon_MultiCheck, LibIcon_Add, LibIcon_MultiAdd, LibIcon_Edit, LibIcon_Delete, LibIcon_Cross, LibIcon_Save, LibIcon_Man, LibIcon_Woman, LibIcon_Send, LibIcon_Load, LibIcon_Settings, LibIcon_Sort, LibIcon_SortAsc, LibIcon_SortDesc, } from './ui/LibIcon.js';
38
- // Formats & Utils
39
- export { displayPhone, arrToStr } from './formats/strings.js';
40
- export { displayCurrency } from './formats/numbers.js';
41
- export { tw } from './utils/tailwind.js';
42
- export { litOrStr } from './utils/types.js';
@@ -6,7 +6,7 @@ type TheStoreItem<T> = {
6
6
  errors: ErrorInfo<T> | undefined;
7
7
  globalError?: string | undefined;
8
8
  };
9
- export declare const kitStoreItem: <T>(repo: Repository<T>, initValues?: TheStoreItem<T>) => {
9
+ export declare const storeItem: <T>(repo: Repository<T>, initValues?: TheStoreItem<T>) => {
10
10
  subscribe: (this: void, run: import("svelte/store").Subscriber<TheStoreItem<T>>, invalidate?: import("svelte/store").Invalidator<TheStoreItem<T>> | undefined) => import("svelte/store").Unsubscriber;
11
11
  create: (item: Partial<T>) => void;
12
12
  set: (newItem: TheStoreItem<T>) => void;
@@ -2,7 +2,7 @@ import { BROWSER } from 'esm-env';
2
2
  import { derived, get, writable } from 'svelte/store';
3
3
  import { Log } from '@kitql/helpers';
4
4
  import { isError } from './helper';
5
- export const kitStoreItem = (repo, initValues = {
5
+ export const storeItem = (repo, initValues = {
6
6
  item: undefined,
7
7
  loading: true,
8
8
  errors: undefined,
@@ -56,12 +56,12 @@ export const kitStoreItem = (repo, initValues = {
56
56
  internalStore.update((s) => ({
57
57
  ...s,
58
58
  loading: false,
59
- item,
59
+ item: item ?? {},
60
60
  errors: undefined,
61
61
  globalError: undefined,
62
62
  }));
63
63
  if (onNewData) {
64
- onNewData(item);
64
+ onNewData(item ?? {});
65
65
  }
66
66
  }
67
67
  catch (error) {
@@ -5,7 +5,7 @@ type TheStoreList<T> = {
5
5
  loading: boolean;
6
6
  totalCount: number | undefined;
7
7
  };
8
- export type FindOptionsPlus<T> = FindOptions<T> & {
8
+ export type FF_FindOptions<T> = FindOptions<T> & {
9
9
  withCount?: boolean;
10
10
  withItems?: boolean;
11
11
  };
@@ -23,11 +23,11 @@ export type FindOptionsPlus<T> = FindOptions<T> & {
23
23
  * $: browser && tasks.listen(data.options)
24
24
  * ```
25
25
  */
26
- export declare const kitStoreList: <T>(repo: Repository<T>, initValues?: TheStoreList<T>) => {
26
+ export declare const storeList: <T>(repo: Repository<T>, initValues?: TheStoreList<T>) => {
27
27
  subscribe: (this: void, run: import("svelte/store").Subscriber<TheStoreList<T>>, invalidate?: import("svelte/store").Invalidator<TheStoreList<T>> | undefined) => import("svelte/store").Unsubscriber;
28
28
  manualSet: (info: TheStoreList<T>) => void;
29
- fetch: (options?: FindOptionsPlus<T>, onNewData?: ((items?: T[], totalCount?: number) => void) | undefined) => Promise<void>;
30
- listen: (options?: FindOptionsPlus<T>) => Promise<void>;
29
+ fetch: (options?: FF_FindOptions<T>, onNewData?: ((items?: T[], totalCount?: number) => void) | undefined) => Promise<void>;
30
+ listen: (options?: FF_FindOptions<T>) => Promise<void>;
31
31
  getRepo: () => Repository<T>;
32
32
  };
33
33
  export {};
@@ -15,7 +15,7 @@ import { writable } from 'svelte/store';
15
15
  * $: browser && tasks.listen(data.options)
16
16
  * ```
17
17
  */
18
- export const kitStoreList = (repo, initValues = { items: [], loading: true, totalCount: undefined }) => {
18
+ export const storeList = (repo, initValues = { items: [], loading: true, totalCount: undefined }) => {
19
19
  const { subscribe, set, update } = writable(initValues);
20
20
  let unSub = null;
21
21
  onDestroy(async () => {
@@ -1,21 +1,19 @@
1
1
  <script>import { createTooltip } from "@melt-ui/svelte";
2
2
  import { fade, fly } from "svelte/transition";
3
3
  import { remult } from "remult";
4
- import { KitBaseEnum, tw } from "../";
4
+ import { BaseEnum, tw } from "../";
5
5
  export let isLoading = false;
6
6
  let className = void 0;
7
7
  export { className as class };
8
8
  export let permission = void 0;
9
9
  let permissionDisabled = false;
10
- $:
11
- disabled = $$restProps.disabled || permissionDisabled || isLoading;
10
+ $: disabled = $$restProps.disabled || permissionDisabled || isLoading;
12
11
  let triggerAnnimation = false;
13
- $:
14
- isLoading && setTimeout(() => {
15
- if (isLoading) {
16
- triggerAnnimation = true;
17
- }
18
- }, 200);
12
+ $: isLoading && setTimeout(() => {
13
+ if (isLoading) {
14
+ triggerAnnimation = true;
15
+ }
16
+ }, 200);
19
17
  let updates = (param) => {
20
18
  if (param && param.permission) {
21
19
  permissionDisabled = !remult.isAllowed(
@@ -1,11 +1,11 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import { KitBaseEnum } from '../';
2
+ import { BaseEnum } from '../';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  [x: string]: any;
6
6
  isLoading?: boolean | undefined;
7
7
  class?: string | undefined | null;
8
- permission?: KitBaseEnum[] | KitBaseEnum | undefined;
8
+ permission?: BaseEnum[] | BaseEnum | undefined;
9
9
  };
10
10
  events: {
11
11
  click: MouseEvent;
@@ -31,8 +31,7 @@ function dispatchSelected(_data) {
31
31
  value = _data;
32
32
  dispatch("selected", _data);
33
33
  }
34
- $:
35
- metaType = getFieldMetaType(cell.field);
34
+ $: metaType = getFieldMetaType(cell.field);
36
35
  const isViewMode = (_mode, _field) => {
37
36
  return _mode === "view" || _field?.dbReadOnly || _field?.options.allowApiUpdate === false;
38
37
  };
@@ -61,11 +60,7 @@ const toInput = (_metadata, _value) => {
61
60
  };
62
61
  const fromInput = (_metadata, _value) => {
63
62
  try {
64
- if (metaType.subKind === "number" && _value === 0) {
65
- return 0;
66
- }
67
- const val = _metadata?.valueConverter.fromInput(_value, metaType.subKind);
68
- return val;
63
+ return _metadata?.valueConverter.fromInput(_value, metaType.subKind);
69
64
  } catch (error2) {
70
65
  console.error(`error fromInput w field '${_metadata.key}'`, error2);
71
66
  }
@@ -161,7 +156,13 @@ const calcSuffix = (value2) => {
161
156
  {#if item && item?.icon}
162
157
  <Icon {...item.icon} />
163
158
  {/if}
164
- <span>{cell?.header ?? item?.caption ?? '-'}</span>
159
+ <div class="grid grid-cols-1">
160
+ <span>{cell?.header ?? item?.caption ?? '-'}</span>
161
+ <!-- && captionSubStyle === 'inline' -->
162
+ {#if item?.captionSub}
163
+ <span class="text-base-content/70 text-xs italic">{item.captionSub}</span>
164
+ {/if}
165
+ </div>
165
166
  </div>
166
167
  {:else if metaType.kind === 'enum'}
167
168
  {@const v = displayWithDefaultAndSuffix(cell.field, value)}
@@ -1,9 +1,9 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import { type KitCell } from '../';
2
+ import { type Cell } from '../';
3
3
  declare class __sveltets_Render<T extends Record<any, any>> {
4
4
  props(): {
5
5
  [x: string]: any;
6
- cell: KitCell<T>;
6
+ cell: Cell<T>;
7
7
  value?: any;
8
8
  cellsValues?: any;
9
9
  withDedounce?: boolean | undefined;
@@ -1,6 +1,6 @@
1
1
  <script generics="T extends Record<any, any>">import { createEventDispatcher } from "svelte";
2
2
  import { getRelationFieldInfo } from "remult/internals";
3
- import { tw } from "..";
3
+ import { tw } from "../";
4
4
  import Field from "./Field.svelte";
5
5
  import FieldContainer from "./internals/FieldContainer.svelte";
6
6
  import Loading from "./Loading.svelte";
@@ -38,8 +38,7 @@ const dispatch = createEventDispatcher();
38
38
  function dispatchChanged(_data) {
39
39
  dispatch("changed", _data);
40
40
  }
41
- $:
42
- dispatchChanged($store.item);
41
+ $: dispatchChanged($store.item);
43
42
  let size = ["", "w-1/2", "w-1/3", "w-1/4", "w-1/5", "w-1/6"];
44
43
  function isToFocus(currentKey, focusKey2, i) {
45
44
  if (focusKey2 === null || focusKey2 === void 0) {
@@ -56,6 +55,9 @@ function isToFocus(currentKey, focusKey2, i) {
56
55
  {@const focus = isToFocus(cell.field?.key, focusKey, i)}
57
56
  {#if shouldHide(cell, mode)}
58
57
  <!-- Do nothing -->
58
+ {:else if cell.field && !cell.field.includedInApi($store.item)}
59
+ <!-- Do nothing, but keep the class... -->
60
+ <div class={cell.class}></div>
59
61
  {:else}
60
62
  <div class={cell.class}>
61
63
  {#if cell.kind === 'header'}
@@ -1,12 +1,12 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  import type { FieldMetadata } from 'remult';
3
- import { type KitStoreItem } from '..';
4
- import type { KitCell } from '../kitCellsBuildor';
3
+ import { type StoreItem } from '../';
4
+ import type { Cell } from '../cellsBuildor';
5
5
  declare class __sveltets_Render<T extends Record<any, any>> {
6
6
  props(): {
7
7
  mode?: ("view" | "edit" | "filtre") | undefined;
8
- cells: KitCell<T>[];
9
- store: KitStoreItem<T>;
8
+ cells: Cell<T>[];
9
+ store: StoreItem<T>;
10
10
  focusKey?: string | null | undefined;
11
11
  };
12
12
  events(): {
@@ -1,11 +1,11 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  import type { EntityOrderBy } from 'remult';
3
- import { type KitStoreList } from '../index.js';
4
- import type { KitCell } from '../kitCellsBuildor.js';
3
+ import type { Cell } from '../cellsBuildor.js';
4
+ import { type StoreList } from '../index.js';
5
5
  declare class __sveltets_Render<T extends Record<any, any>> {
6
6
  props(): {
7
- cells: KitCell<T>[];
8
- store: KitStoreList<T>;
7
+ cells: Cell<T>[];
8
+ store: StoreList<T>;
9
9
  withAdd?: boolean | undefined;
10
10
  withEdit?: boolean | undefined;
11
11
  withDelete?: boolean | undefined;
@@ -33,7 +33,7 @@ declare class __sveltets_Render<T extends Record<any, any>> {
33
33
  cell: {
34
34
  row: T;
35
35
  field: import("remult").FieldMetadata<any, T> | undefined;
36
- cell: KitCell<T>;
36
+ cell: Cell<T>;
37
37
  };
38
38
  extra: {};
39
39
  };
@@ -18,12 +18,9 @@ const update = (op) => {
18
18
  }
19
19
  }
20
20
  };
21
- $:
22
- isValidValue = totalCount !== void 0 && totalCount !== null;
23
- $:
24
- needPaginate = isValidValue && (totalCount ?? 0) > pageSize;
25
- $:
26
- canGoNext = isValidValue && needPaginate && page < Math.ceil((totalCount ?? 0) / pageSize);
21
+ $: isValidValue = totalCount !== void 0 && totalCount !== null;
22
+ $: needPaginate = isValidValue && (totalCount ?? 0) > pageSize;
23
+ $: canGoNext = isValidValue && needPaginate && page < Math.ceil((totalCount ?? 0) / pageSize);
27
24
  </script>
28
25
 
29
26
  <FieldContainer {label} forId="paginate" classes={{ label: 'justify-end' }}>
@@ -14,16 +14,15 @@ let height = size;
14
14
  let viewBox = "0 0 24 24";
15
15
  let svg = "";
16
16
  let path = "";
17
- $:
18
- if (typeof data === "string") {
19
- if (data.toLowerCase().includes("<svg")) {
20
- svg = data.replace(/width="[^"]*"/, `width="${width}"`).replace(/height="[^"]*"/, `height="${height}"`);
21
- } else {
22
- path = data;
23
- }
17
+ $: if (typeof data === "string") {
18
+ if (data.toLowerCase().includes("<svg")) {
19
+ svg = data.replace(/width="[^"]*"/, `width="${width}"`).replace(/height="[^"]*"/, `height="${height}"`);
24
20
  } else {
25
21
  path = data;
26
22
  }
23
+ } else {
24
+ path = data;
25
+ }
27
26
  const getInfoProps = (props, i = 0) => {
28
27
  if (Array.isArray(props)) {
29
28
  return props[i] ?? "";
package/esm/ui/LibIcon.js CHANGED
@@ -1,7 +1,5 @@
1
1
  // Lib Icons
2
2
  // https://icones.js.org/ and https://pictogrammers.com/library/mdi/
3
- // Lib or App let's not grow to much here !
4
- // TODO : check code spliting...
5
3
  import { mdiAccountTie, mdiAccountTieWoman, mdiCancel, mdiCheck, mdiCheckAll, mdiChevronDown, mdiChevronLeft, mdiChevronRight, mdiChevronUp, mdiCloseCircleOutline, mdiCogOutline, mdiContentSaveEdit, mdiDelete, mdiLoading, mdiMagnify, mdiPencil, mdiPlusBoxMultiple, mdiPlusCircle, mdiSend, mdiSort, mdiSortReverseVariant, mdiSortVariant, } from '@mdi/js';
6
4
  export const LibIcon_Empty = ``;
7
5
  export const LibIcon_Forbidden = mdiCancel;
@@ -1,13 +1,11 @@
1
- <script>import { FieldGroup, kitStoreItem } from "../..";
2
- import { kitCellsBuildor } from "../../kitCellsBuildor";
1
+ <script>import { FieldGroup, storeItem } from "../..";
2
+ import { cellsBuildor } from "../../cellsBuildor";
3
3
  import { dialog } from "./dialog";
4
4
  import DialogPrimitive from "./DialogPrimitive.svelte";
5
5
  import FormEditAction from "./FormEditAction.svelte";
6
6
  export let toShow;
7
- $:
8
- cells = kitCellsBuildor(toShow.repo, toShow.cells);
9
- $:
10
- store = toShow.store ?? kitStoreItem(toShow.repo);
7
+ $: cells = cellsBuildor(toShow.repo, toShow.cells);
8
+ $: store = toShow.store ?? storeItem(toShow.repo);
11
9
  $: {
12
10
  if (toShow.type === "update" || toShow.type === "view") {
13
11
  store.set({ item: toShow.defaults, errors: {}, loading: false, globalError: void 0 });
@@ -52,6 +50,7 @@ const onDelete = async () => {
52
50
  <form on:submit|preventDefault={onInsert}>
53
51
  <div class="grid {toShow.classes?.formGrid ?? ''} gap-4 pb-4">
54
52
  <FieldGroup
53
+ focusKey={toShow.focusKey}
55
54
  {cells}
56
55
  {store}
57
56
  mode={toShow.type === 'view' ? 'view' : 'edit'}
@@ -1,8 +1,8 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import { type KitBaseItemLight } from '../../';
2
+ import { type BaseItemLight } from '../../';
3
3
  declare const __propDef: {
4
4
  props: {
5
- detail?: KitBaseItemLight | undefined;
5
+ detail?: BaseItemLight | undefined;
6
6
  open?: boolean | undefined;
7
7
  classes?: {
8
8
  root?: string | undefined;
@@ -1,10 +1,10 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { KitStoreItem } from '../..';
2
+ import type { StoreItem } from '../..';
3
3
  import type { DialogType } from './dialog';
4
4
  declare class __sveltets_Render<T extends any> {
5
5
  props(): {
6
6
  [x: string]: any;
7
- store: KitStoreItem<T>;
7
+ store: StoreItem<T>;
8
8
  type: DialogType;
9
9
  wDelete?: boolean | undefined;
10
10
  textCreate?: string | undefined;