mui-fast-start 0.3.2 → 0.3.3

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/README.md +403 -403
  2. package/README_KR.md +403 -403
  3. package/dist/components/Object/Select/ObjSelectRecord.d.ts +2 -1
  4. package/dist/components/Object/Select/ObjSelectRecord.d.ts.map +1 -1
  5. package/dist/components/Single/Select/SingleSelectRecord.d.ts +2 -1
  6. package/dist/components/Single/Select/SingleSelectRecord.d.ts.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/styles/FastStartProps.d.ts +2 -1
  9. package/dist/styles/FastStartProps.d.ts.map +1 -1
  10. package/dist/types/props.d.ts +1 -1
  11. package/dist/types/props.d.ts.map +1 -1
  12. package/dist/types/provider.d.ts +2 -1
  13. package/dist/types/provider.d.ts.map +1 -1
  14. package/examples/basic/README.md +73 -73
  15. package/examples/basic/eslint.config.js +23 -23
  16. package/examples/basic/index.html +13 -13
  17. package/examples/basic/package.json +37 -37
  18. package/examples/basic/src/App.css +4 -4
  19. package/examples/basic/src/App.tsx +28 -28
  20. package/examples/basic/src/index.css +29 -29
  21. package/examples/basic/src/main.tsx +50 -50
  22. package/examples/basic/src/pages/ObjPage.tsx +175 -175
  23. package/examples/basic/src/pages/SinglePage.tsx +137 -137
  24. package/examples/basic/tsconfig.app.json +43 -43
  25. package/examples/basic/tsconfig.json +7 -7
  26. package/examples/basic/tsconfig.node.json +40 -40
  27. package/examples/basic/vite.config.ts +28 -28
  28. package/mui-fast-start-0.1.4.tgz +0 -0
  29. package/package.json +67 -67
  30. package/src/components/Object/Checkbox/ObjCheckIcon.tsx +29 -29
  31. package/src/components/Object/Checkbox/ObjCheckbox.tsx +31 -31
  32. package/src/components/Object/Select/ObjSelectOne.tsx +33 -33
  33. package/src/components/Object/Select/ObjSelectRecord.tsx +33 -33
  34. package/src/components/Object/Textfield/ObjNumber.tsx +51 -51
  35. package/src/components/Object/Textfield/ObjText.tsx +29 -29
  36. package/src/components/Single/Checkbox/SingleCheckIcon.tsx +27 -27
  37. package/src/components/Single/Checkbox/SingleCheckbox.tsx +33 -33
  38. package/src/components/Single/Select/BaseSingleSelect.tsx +45 -45
  39. package/src/components/Single/Select/SingleSelectOne.tsx +56 -56
  40. package/src/components/Single/Select/SingleSelectRecord.tsx +51 -51
  41. package/src/components/Single/TextField/SingleNumber.tsx +18 -18
  42. package/src/components/Single/TextField/SingleText.tsx +13 -13
  43. package/src/components/index.ts +15 -15
  44. package/src/hooks/index.ts +3 -3
  45. package/src/hooks/splits/useSplitNumberProps.ts +161 -161
  46. package/src/hooks/splits/useSplitTextProps.ts +36 -36
  47. package/src/hooks/state/useObjToSingle.ts +24 -24
  48. package/src/index.ts +7 -7
  49. package/src/styles/FastStartProps.ts +82 -81
  50. package/src/styles/FastStartProvider.tsx +25 -25
  51. package/src/types/index.ts +3 -3
  52. package/src/types/props.internal.ts +21 -21
  53. package/src/types/props.ts +81 -81
  54. package/src/types/provider.ts +72 -71
  55. package/src/types/types.ts +9 -9
  56. package/src/utils/index.ts +2 -2
  57. package/src/utils/number/calculate.ts +102 -102
  58. package/src/utils/object/error.ts +15 -15
  59. package/src/utils/object/merge.ts +47 -47
  60. package/tsconfig.json +34 -34
  61. package/tsconfig.lib.json +9 -9
  62. package/vite.config.ts +35 -35
@@ -1,102 +1,102 @@
1
- type CalculateNumber = number | null | undefined;
2
-
3
- const floatCalculate = (
4
- value: string | null,
5
- min: CalculateNumber,
6
- max: CalculateNumber,
7
- def: CalculateNumber
8
- ): CalculateNumber => {
9
- let calc: CalculateNumber = 0;
10
- if (value == null || isEmpty(value)) {
11
- calc = def;
12
- } else {
13
- for (const token of value.split(/(?=[+-])/g)) {
14
- if (/^[+-]?\d+\.\d+$/.test(token)) {
15
- calc += parseFloat(token);
16
- } else if (/^[+-]?\d+$/.test(token)) {
17
- calc += parseInt(token, 10);
18
- }
19
- }
20
- }
21
-
22
- if (calc != null) {
23
- if (max != null) calc = Math.min(max, calc);
24
- if (min != null) calc = Math.max(min, calc);
25
- }
26
- return calc;
27
- }
28
-
29
- const integerCalculate = (
30
- value: string | null,
31
- min: CalculateNumber,
32
- max: CalculateNumber,
33
- def: CalculateNumber
34
- ): CalculateNumber => {
35
- let calc: CalculateNumber = 0;
36
- if (value == null || isEmpty(value)) {
37
- calc = def;
38
- } else {
39
- for (const token of value.split(/(?=[+-])/g)) {
40
- if (/^[+-]?\d+$/.test(token)) {
41
- calc += parseInt(token, 10);
42
- }
43
- }
44
- }
45
-
46
- if (calc != null) {
47
- if (max != null) calc = Math.min(max, calc);
48
- if (min != null) calc = Math.max(min, calc);
49
- }
50
- return calc;
51
- }
52
-
53
- const processFloat = (text: string): string => {
54
- const value: string = text
55
- .replace(/[^0-9+.-]/g, '')
56
- .replace(/([+-]){2,}/g, (match, op) => op);
57
-
58
- let result: string = '';
59
- let token: string = '';
60
- let decimalUsed: boolean = false;
61
-
62
- for (let i = 0; i < value.length; i++) {
63
- const char = value[i];
64
-
65
- if (char >= '0' && char <= '9') {
66
- token += char;
67
- } else if (char === '.') {
68
- if (!decimalUsed) {
69
- if (token === '') {
70
- token = '0';
71
- }
72
- token += '.';
73
- decimalUsed = true;
74
- }
75
- } else if (char === '+' || char === '-') {
76
- if (token !== '') {
77
- result += token;
78
- }
79
- result += char;
80
- token = '';
81
- decimalUsed = false;
82
- }
83
- }
84
- return result + token;
85
- }
86
-
87
- const processInteger = (text: string): string => text
88
- .replace(/[^0-9+-]/g, '')
89
- .replace(/\./g, '')
90
- .replace(/([+-]){2,}/g, (match, op) => op.charAt(0))
91
- .replace(/^([+-]{2,})/, match => match.charAt(0));
92
-
93
- function isEmpty(str: string): boolean {
94
- return str.length === 0 || !str.trim();
95
- }
96
-
97
- export {
98
- floatCalculate,
99
- integerCalculate,
100
- processFloat,
101
- processInteger
102
- }
1
+ type CalculateNumber = number | null | undefined;
2
+
3
+ const floatCalculate = (
4
+ value: string | null,
5
+ min: CalculateNumber,
6
+ max: CalculateNumber,
7
+ def: CalculateNumber
8
+ ): CalculateNumber => {
9
+ let calc: CalculateNumber = 0;
10
+ if (value == null || isEmpty(value)) {
11
+ calc = def;
12
+ } else {
13
+ for (const token of value.split(/(?=[+-])/g)) {
14
+ if (/^[+-]?\d+\.\d+$/.test(token)) {
15
+ calc += parseFloat(token);
16
+ } else if (/^[+-]?\d+$/.test(token)) {
17
+ calc += parseInt(token, 10);
18
+ }
19
+ }
20
+ }
21
+
22
+ if (calc != null) {
23
+ if (max != null) calc = Math.min(max, calc);
24
+ if (min != null) calc = Math.max(min, calc);
25
+ }
26
+ return calc;
27
+ }
28
+
29
+ const integerCalculate = (
30
+ value: string | null,
31
+ min: CalculateNumber,
32
+ max: CalculateNumber,
33
+ def: CalculateNumber
34
+ ): CalculateNumber => {
35
+ let calc: CalculateNumber = 0;
36
+ if (value == null || isEmpty(value)) {
37
+ calc = def;
38
+ } else {
39
+ for (const token of value.split(/(?=[+-])/g)) {
40
+ if (/^[+-]?\d+$/.test(token)) {
41
+ calc += parseInt(token, 10);
42
+ }
43
+ }
44
+ }
45
+
46
+ if (calc != null) {
47
+ if (max != null) calc = Math.min(max, calc);
48
+ if (min != null) calc = Math.max(min, calc);
49
+ }
50
+ return calc;
51
+ }
52
+
53
+ const processFloat = (text: string): string => {
54
+ const value: string = text
55
+ .replace(/[^0-9+.-]/g, '')
56
+ .replace(/([+-]){2,}/g, (match, op) => op);
57
+
58
+ let result: string = '';
59
+ let token: string = '';
60
+ let decimalUsed: boolean = false;
61
+
62
+ for (let i = 0; i < value.length; i++) {
63
+ const char = value[i];
64
+
65
+ if (char >= '0' && char <= '9') {
66
+ token += char;
67
+ } else if (char === '.') {
68
+ if (!decimalUsed) {
69
+ if (token === '') {
70
+ token = '0';
71
+ }
72
+ token += '.';
73
+ decimalUsed = true;
74
+ }
75
+ } else if (char === '+' || char === '-') {
76
+ if (token !== '') {
77
+ result += token;
78
+ }
79
+ result += char;
80
+ token = '';
81
+ decimalUsed = false;
82
+ }
83
+ }
84
+ return result + token;
85
+ }
86
+
87
+ const processInteger = (text: string): string => text
88
+ .replace(/[^0-9+-]/g, '')
89
+ .replace(/\./g, '')
90
+ .replace(/([+-]){2,}/g, (match, op) => op.charAt(0))
91
+ .replace(/^([+-]{2,})/, match => match.charAt(0));
92
+
93
+ function isEmpty(str: string): boolean {
94
+ return str.length === 0 || !str.trim();
95
+ }
96
+
97
+ export {
98
+ floatCalculate,
99
+ integerCalculate,
100
+ processFloat,
101
+ processInteger
102
+ }
@@ -1,15 +1,15 @@
1
- import {MfsErrorProps, MfsObjectProps} from "../../types";
2
- import {MfsObjectError} from "../../types/props.internal.ts";
3
-
4
- function errorObjectToString<Type extends object, Target = unknown>(
5
- name: MfsObjectProps<Type, Target>['name'],
6
- data: MfsErrorProps<Type, MfsObjectError<Type, Target>>['err']
7
- ): string | undefined {
8
- return (name != null && typeof data === 'object')
9
- ? (data as Record<string, string>)[name as string]
10
- : undefined;
11
- }
12
-
13
- export {
14
- errorObjectToString
15
- }
1
+ import {MfsErrorProps, MfsObjectProps} from "../../types";
2
+ import {MfsObjectError} from "../../types/props.internal.ts";
3
+
4
+ function errorObjectToString<Type extends object, Target = unknown>(
5
+ name: MfsObjectProps<Type, Target>['name'],
6
+ data: MfsErrorProps<Type, MfsObjectError<Type, Target>>['err']
7
+ ): string | undefined {
8
+ return (name != null && typeof data === 'object')
9
+ ? (data as Record<string, string>)[name as string]
10
+ : undefined;
11
+ }
12
+
13
+ export {
14
+ errorObjectToString
15
+ }
@@ -1,47 +1,47 @@
1
- import {DeepPartial} from "../../types";
2
-
3
- type AnyObj = Record<string, any>;
4
-
5
- function isPlainObject(v: any): v is AnyObj {
6
- return v !== null && typeof v === "object" && v.constructor === Object;
7
- }
8
-
9
- function isEmpty(v: object): boolean {
10
- return Object.keys(v).length === 0;
11
- }
12
-
13
- function fastDeepMerge<T extends object>(target: DeepPartial<T> | undefined, source: T): T {
14
- if (target === source || !isPlainObject(source) || isEmpty(source)) {
15
- return target as T;
16
- } else if (!isPlainObject(target) || isEmpty(target)) {
17
- return source;
18
- }
19
-
20
- const result: AnyObj = {...target};
21
- const stack: [AnyObj, AnyObj][] = [[result, source as AnyObj]];
22
-
23
- while (stack.length) {
24
- const [tNode, sNode] = stack.pop()!;
25
-
26
- for (const key in sNode) {
27
- if (!Object.prototype.hasOwnProperty.call(sNode, key)) continue;
28
-
29
- const sVal = sNode[key];
30
- const tVal = tNode[key];
31
-
32
- if (isPlainObject(tVal) && isPlainObject(sVal)) {
33
- const copy = {...tVal};
34
- tNode[key] = copy;
35
- stack.push([copy, sVal]);
36
- } else {
37
- tNode[key] = sVal;
38
- }
39
- }
40
- }
41
- return result as T;
42
- }
43
-
44
-
45
- export {
46
- fastDeepMerge
47
- }
1
+ import {DeepPartial} from "../../types";
2
+
3
+ type AnyObj = Record<string, any>;
4
+
5
+ function isPlainObject(v: any): v is AnyObj {
6
+ return v !== null && typeof v === "object" && v.constructor === Object;
7
+ }
8
+
9
+ function isEmpty(v: object): boolean {
10
+ return Object.keys(v).length === 0;
11
+ }
12
+
13
+ function fastDeepMerge<T extends object>(target: DeepPartial<T> | undefined, source: T): T {
14
+ if (target === source || !isPlainObject(source) || isEmpty(source)) {
15
+ return target as T;
16
+ } else if (!isPlainObject(target) || isEmpty(target)) {
17
+ return source;
18
+ }
19
+
20
+ const result: AnyObj = {...target};
21
+ const stack: [AnyObj, AnyObj][] = [[result, source as AnyObj]];
22
+
23
+ while (stack.length) {
24
+ const [tNode, sNode] = stack.pop()!;
25
+
26
+ for (const key in sNode) {
27
+ if (!Object.prototype.hasOwnProperty.call(sNode, key)) continue;
28
+
29
+ const sVal = sNode[key];
30
+ const tVal = tNode[key];
31
+
32
+ if (isPlainObject(tVal) && isPlainObject(sVal)) {
33
+ const copy = {...tVal};
34
+ tNode[key] = copy;
35
+ stack.push([copy, sVal]);
36
+ } else {
37
+ tNode[key] = sVal;
38
+ }
39
+ }
40
+ }
41
+ return result as T;
42
+ }
43
+
44
+
45
+ export {
46
+ fastDeepMerge
47
+ }
package/tsconfig.json CHANGED
@@ -1,34 +1,34 @@
1
- {
2
- "compilerOptions": {
3
- "useDefineForClassFields": true,
4
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
-
6
- "allowImportingTsExtensions": true,
7
- "moduleDetection": "force",
8
-
9
- /* Build options */
10
- "declaration": true,
11
- "declarationMap": true,
12
- "emitDeclarationOnly": true,
13
- "noEmit": false,
14
- "rootDir": "src",
15
- "outDir": "dist",
16
- "declarationDir": "dist",
17
-
18
- /* Bundler mode */
19
- "strict": true,
20
- "jsx": "react-jsx",
21
- "moduleResolution": "bundler",
22
- "module": "ESNext",
23
- "target": "ES2022",
24
-
25
- /* Interop */
26
- "allowSyntheticDefaultImports": true,
27
- "esModuleInterop": true,
28
-
29
- /* Library options */
30
- "skipLibCheck": true,
31
- "skipDefaultLibCheck": true,
32
- },
33
- "include": ["src"],
34
- }
1
+ {
2
+ "compilerOptions": {
3
+ "useDefineForClassFields": true,
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+
6
+ "allowImportingTsExtensions": true,
7
+ "moduleDetection": "force",
8
+
9
+ /* Build options */
10
+ "declaration": true,
11
+ "declarationMap": true,
12
+ "emitDeclarationOnly": true,
13
+ "noEmit": false,
14
+ "rootDir": "src",
15
+ "outDir": "dist",
16
+ "declarationDir": "dist",
17
+
18
+ /* Bundler mode */
19
+ "strict": true,
20
+ "jsx": "react-jsx",
21
+ "moduleResolution": "bundler",
22
+ "module": "ESNext",
23
+ "target": "ES2022",
24
+
25
+ /* Interop */
26
+ "allowSyntheticDefaultImports": true,
27
+ "esModuleInterop": true,
28
+
29
+ /* Library options */
30
+ "skipLibCheck": true,
31
+ "skipDefaultLibCheck": true,
32
+ },
33
+ "include": ["src"],
34
+ }
package/tsconfig.lib.json CHANGED
@@ -1,9 +1,9 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "noEmit": false,
5
- "declaration": true,
6
- "emitDeclarationOnly": true,
7
- "outDir": "dist"
8
- }
9
- }
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "declaration": true,
6
+ "emitDeclarationOnly": true,
7
+ "outDir": "dist"
8
+ }
9
+ }
package/vite.config.ts CHANGED
@@ -1,35 +1,35 @@
1
- import {defineConfig} from 'vite'
2
- import react from '@vitejs/plugin-react'
3
- import {resolve} from 'path'
4
-
5
- // https://vite.dev/config/
6
- export default defineConfig({
7
- plugins: [react()],
8
- resolve: {
9
- },
10
- build: {
11
- lib: {
12
- entry: resolve(__dirname, "src/index.ts"),
13
- name: 'MuiFastStart',
14
- fileName: 'index',
15
- formats: ['es']
16
- },
17
- rolldownOptions: {
18
- external: [
19
- 'react',
20
- 'react-dom',
21
- 'react/jsx-runtime',
22
- '@mui/material',
23
- '@emotion/react',
24
- '@emotion/styled'
25
- ],
26
- output: {
27
- globals: {
28
- 'react': 'React',
29
- 'react-dom': 'ReactDOM',
30
- '@mui/material': 'MaterialUI'
31
- }
32
- }
33
- }
34
- },
35
- })
1
+ import {defineConfig} from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+ import {resolve} from 'path'
4
+
5
+ // https://vite.dev/config/
6
+ export default defineConfig({
7
+ plugins: [react()],
8
+ resolve: {
9
+ },
10
+ build: {
11
+ lib: {
12
+ entry: resolve(__dirname, "src/index.ts"),
13
+ name: 'MuiFastStart',
14
+ fileName: 'index',
15
+ formats: ['es']
16
+ },
17
+ rolldownOptions: {
18
+ external: [
19
+ 'react',
20
+ 'react-dom',
21
+ 'react/jsx-runtime',
22
+ '@mui/material',
23
+ '@emotion/react',
24
+ '@emotion/styled'
25
+ ],
26
+ output: {
27
+ globals: {
28
+ 'react': 'React',
29
+ 'react-dom': 'ReactDOM',
30
+ '@mui/material': 'MaterialUI'
31
+ }
32
+ }
33
+ }
34
+ },
35
+ })