@decafhub/decaf-react-webapp 0.0.15 → 0.1.1

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 (62) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/components/Breadcrumb.d.ts +16 -0
  3. package/dist/components/Breadcrumb.d.ts.map +1 -0
  4. package/dist/components/DocumentationButton.d.ts +3 -0
  5. package/dist/components/DocumentationButton.d.ts.map +1 -0
  6. package/dist/components/Error.d.ts +5 -5
  7. package/dist/components/Layout.d.ts +16 -17
  8. package/dist/components/Layout.d.ts.map +1 -1
  9. package/dist/components/Logo.d.ts +2 -2
  10. package/dist/components/Menu.d.ts +9 -0
  11. package/dist/components/Menu.d.ts.map +1 -0
  12. package/dist/components/PageAbout.d.ts +8 -8
  13. package/dist/components/PageAbout.d.ts.map +1 -1
  14. package/dist/components/PageLayout.d.ts +10 -0
  15. package/dist/components/PageLayout.d.ts.map +1 -0
  16. package/dist/components/PageScroller.d.ts +2 -2
  17. package/dist/components/PageScroller.d.ts.map +1 -1
  18. package/dist/components/Screenshotter.d.ts +5 -5
  19. package/dist/components/Screenshotter.d.ts.map +1 -1
  20. package/dist/components/ThemeSwitcher.d.ts +7 -7
  21. package/dist/components/ThemeSwitcher.d.ts.map +1 -1
  22. package/dist/components/UserProfileDropdown.d.ts +3 -0
  23. package/dist/components/UserProfileDropdown.d.ts.map +1 -0
  24. package/dist/components/VersionSelector.d.ts +11 -11
  25. package/dist/components/VersionSelector.d.ts.map +1 -1
  26. package/dist/components/ZendeskWidget.d.ts +8 -8
  27. package/dist/components/ZendeskWidget.d.ts.map +1 -1
  28. package/dist/index.d.ts +7 -51
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.modern.mjs +2 -2
  33. package/dist/index.modern.mjs.map +1 -1
  34. package/dist/index.module.js +1 -1
  35. package/dist/index.module.js.map +1 -1
  36. package/dist/index.umd.js +1 -1
  37. package/dist/index.umd.js.map +1 -1
  38. package/dist/machinery/-plausible.d.ts +2 -0
  39. package/dist/machinery/-plausible.d.ts.map +1 -0
  40. package/dist/machinery/index.d.ts +91 -0
  41. package/dist/machinery/index.d.ts.map +1 -0
  42. package/dist/style.d.ts +4 -4
  43. package/dist/style.d.ts.map +1 -1
  44. package/dist/theme/-styles.d.ts +7 -0
  45. package/dist/theme/-styles.d.ts.map +1 -0
  46. package/dist/theme/-theme-context.d.ts +7 -0
  47. package/dist/theme/-theme-context.d.ts.map +1 -0
  48. package/dist/theme/-theme-hooks.d.ts +2 -0
  49. package/dist/theme/-theme-hooks.d.ts.map +1 -0
  50. package/dist/theme/-theme-provider.d.ts +9 -0
  51. package/dist/theme/-theme-provider.d.ts.map +1 -0
  52. package/dist/theme/index.d.ts +6 -0
  53. package/dist/theme/index.d.ts.map +1 -0
  54. package/dist/theme.d.ts +17 -17
  55. package/dist/theme.d.ts.map +1 -1
  56. package/dist/types.d.ts +12 -0
  57. package/dist/types.d.ts.map +1 -0
  58. package/dist/utils.d.ts +58 -24
  59. package/dist/utils.d.ts.map +1 -1
  60. package/dist/utils.spec.d.ts +2 -0
  61. package/dist/utils.spec.d.ts.map +1 -0
  62. package/package.json +36 -31
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ export interface BaseDecafMenuItem {
3
+ label: any;
4
+ icon?: React.ReactNode;
5
+ children?: DecafMenuItem[];
6
+ }
7
+ export type DecafMenuItem = BaseDecafMenuItem & ({
8
+ to?: string;
9
+ } | {
10
+ href?: string;
11
+ });
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,CAAC;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC"}
package/dist/utils.d.ts CHANGED
@@ -1,25 +1,59 @@
1
- /**
2
- * This hook is used to calculate the max possible height of a table.
3
- * It is used to set the height of the table to make it scrollable
4
- * when the content is too large.
5
- * @param elementId the id of the element that contains the table.
6
- * @param bottomSpace extra space to be added to the bottom of the table container.
7
- * @returns the max height of the table.
8
- * @example
9
- * ```tsx
10
- * const maxHeight = useTableMaxHeight('table-container', 50);
11
- * return (
12
- * <Table
13
- {...tableProps}
14
- id={'table-container'}
15
- scroll={{
16
- x: 'max-content',
17
- y: maxHeight,
18
- }}
19
- />
20
- * );
21
- * ```
22
- **/
23
- export declare function useTableMaxHeight(elementId: string, bottomSpace?: number): string | number;
24
- export declare function lightenDarkenColor(col: string, amt: number): string;
1
+ import { DecafClient } from '@decafhub/decaf-client';
2
+ import Decimal from 'decimal.js';
3
+ /**
4
+ * This hook is used to calculate the remaining height of an element.
5
+ * It takes into account the footer height and padding.
6
+ *
7
+ * @param elementId the id of the element to calculate the available height.
8
+ * @returns the remaining height of the element.
9
+ */
10
+ export declare function useRemaningHeight(elementId: string): number;
11
+ /**
12
+ * This hook is used to calculate the max possible height of a table.
13
+ * It is used to set the height of the table to make it scrollable
14
+ * when the content is too large.
15
+ * @param elementId the id of the element that contains the table.
16
+ * @param bottomSpace extra space to be added to the bottom of the table container.
17
+ * @returns the max height of the table.
18
+ * @example
19
+ * ```tsx
20
+ * const maxHeight = useTableMaxHeight('table-container', 50);
21
+ * return (
22
+ * <Table
23
+ {...tableProps}
24
+ id={'table-container'}
25
+ scroll={{
26
+ x: 'max-content',
27
+ y: maxHeight,
28
+ }}
29
+ />
30
+ * );
31
+ * ```
32
+ **/
33
+ export declare function useTableMaxHeight(elementId: string, bottomSpace?: number): string | number;
34
+ export declare function lightenDarkenColor(col: string, amt: number): string;
35
+ export declare function logout(client: DecafClient, fromAll?: boolean): void;
36
+ export declare function getGravatarUrl(email: string): Promise<string | undefined>;
37
+ export type BooleanMap<T> = {
38
+ True: T;
39
+ False: T;
40
+ };
41
+ export declare function booleanMap<T>(map: BooleanMap<T>): (x: boolean) => T;
42
+ export type NullableBooleanMap<T> = {
43
+ Null: T;
44
+ } & BooleanMap<T>;
45
+ export declare function nullableBooleanMap<T>(map: NullableBooleanMap<T>): (x?: boolean | undefined | null) => T;
46
+ export declare enum Direction {
47
+ Short = -1,
48
+ Square = 0,
49
+ Long = 1
50
+ }
51
+ export declare function toDirection(x: number | Decimal | Direction): Direction;
52
+ export type DirectionMap<T> = {
53
+ Short: T;
54
+ Square: T;
55
+ Long: T;
56
+ };
57
+ export declare function directionMap<T>(map: DirectionMap<T>): (x: number | Decimal | Direction) => T;
58
+ export declare function setAtKey<T>(array: T[], items: T[], key: keyof T): T[];
25
59
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAiC1F;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UA0B1D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,OAAO,MAAM,YAAY,CAAC;AASjC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA2B3D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,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,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,KAAK,CAAC,CAW5F;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAcrE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.spec.d.ts","sourceRoot":"","sources":["../src/utils.spec.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decafhub/decaf-react-webapp",
3
- "version": "0.0.15",
3
+ "version": "0.1.1",
4
4
  "keywords": [
5
5
  "decafhub",
6
6
  "react"
@@ -24,10 +24,10 @@
24
24
  "private": false,
25
25
  "scripts": {
26
26
  "start": "microbundle --jsx React.createElement --jsxFragment React.Fragment --watch",
27
- "build": "rm -rf dist && microbundle --jsx React.createElement --jsxFragment React.Fragment",
27
+ "build": "microbundle --jsx React.createElement --jsxFragment React.Fragment",
28
28
  "test": "jest --coverage",
29
29
  "make:docs": "typedoc",
30
- "prepare": "yarn build && husky install"
30
+ "prepare": "husky install"
31
31
  },
32
32
  "engines": {
33
33
  "node": ">=16"
@@ -35,39 +35,44 @@
35
35
  "peerDependencies": {
36
36
  "@ant-design/icons": "^5",
37
37
  "@decafhub/decaf-client": "^0.3",
38
- "@decafhub/decaf-react": "^0.1",
39
- "antd": "^5",
40
- "react": "^17 || ^18",
41
- "react-dom": "^17 || ^18",
38
+ "@decafhub/decaf-react": "^0.2",
39
+ "antd": "^5.4",
40
+ "react": "^18",
41
+ "react-dom": "^18",
42
42
  "react-router-dom": "^6"
43
43
  },
44
44
  "dependencies": {
45
45
  "@emotion/react": "^11.10.6",
46
46
  "@emotion/styled": "^11.10.6",
47
- "html2canvas": "^1.4.1"
47
+ "@tanem/react-nprogress": "^5.0.35",
48
+ "decimal.js": "^10.4.3",
49
+ "html2canvas": "^1.4.1",
50
+ "js-cookie": "^3.0.5",
51
+ "md5": "^2.3.0"
48
52
  },
49
53
  "devDependencies": {
50
54
  "@ant-design/icons": "^5.0.1",
51
- "@commitlint/cli": "^17.4.4",
52
- "@commitlint/config-conventional": "^17.4.4",
53
- "@decafhub/decaf-client": "^0.3.1",
54
- "@decafhub/decaf-react": "^0.1.9",
55
+ "@commitlint/cli": "^17.6.1",
56
+ "@commitlint/config-conventional": "^17.6.1",
57
+ "@decafhub/decaf-client": "^0.3.2",
58
+ "@decafhub/decaf-react": "^0.2.0",
55
59
  "@testing-library/jest-dom": "^5.16.5",
56
60
  "@testing-library/react": "^14.0.0",
57
- "@types/jest": "^29.4.0",
61
+ "@types/jest": "^29.5.1",
58
62
  "@types/js-cookie": "^3.0.3",
59
- "@types/node": "^18.14.3",
60
- "@types/react": "^18.0.28",
61
- "@types/react-dom": "^18.0.11",
62
- "@typescript-eslint/eslint-plugin": "^5.54.0",
63
- "@typescript-eslint/parser": "^5.54.0",
64
- "antd": "^5.2.3",
63
+ "@types/md5": "^2.3.2",
64
+ "@types/node": "^18.16.1",
65
+ "@types/react": "^18.2.0",
66
+ "@types/react-dom": "^18.2.1",
67
+ "@typescript-eslint/eslint-plugin": "^5.59.1",
68
+ "@typescript-eslint/parser": "^5.59.1",
69
+ "antd": "^5.4.6",
65
70
  "cross-env": "^7.0.3",
66
- "eslint": "^8.35.0",
67
- "eslint-config-prettier": "^8.6.0",
71
+ "eslint": "^8.39.0",
72
+ "eslint-config-prettier": "^8.8.0",
68
73
  "eslint-config-standard": "^17.0.0",
69
74
  "eslint-plugin-import": "^2.27.5",
70
- "eslint-plugin-n": "^15.6.1",
75
+ "eslint-plugin-n": "^15.7.0",
71
76
  "eslint-plugin-prettier": "^4.2.1",
72
77
  "eslint-plugin-promise": "^6.1.1",
73
78
  "eslint-plugin-react": "^7.32.2",
@@ -75,18 +80,18 @@
75
80
  "eslint-plugin-standard": "^5.0.0",
76
81
  "husky": "^8.0.3",
77
82
  "identity-obj-proxy": "^3.0.0",
78
- "jest": "^29.4.3",
79
- "jest-environment-jsdom": "^29.4.3",
80
- "lint-staged": "^13.1.2",
83
+ "jest": "^29.5.0",
84
+ "jest-environment-jsdom": "^29.5.0",
85
+ "lint-staged": "^13.2.2",
81
86
  "microbundle": "^0.15.1",
82
- "postcss": "^8.4.21",
83
- "prettier": "^2.8.4",
87
+ "postcss": "^8.4.23",
88
+ "prettier": "^2.8.8",
84
89
  "react": "^18.2.0",
85
90
  "react-dom": "^18.2.0",
86
- "react-router-dom": "^6.8.2",
87
- "ts-jest": "^29.0.5",
88
- "typedoc": "^0.23.26",
89
- "typescript": "^4.9.5"
91
+ "react-router-dom": "^6.10.0",
92
+ "ts-jest": "^29.1.0",
93
+ "typedoc": "^0.24.6",
94
+ "typescript": "^5.0.4"
90
95
  },
91
96
  "lint-staged": {
92
97
  "src/**/*.{ts,tsx}": [