@kirill.konshin/utils 0.0.18 → 0.0.20
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.
- package/.ctirc +19 -10
- package/.storybook/main.ts +1 -20
- package/.storybook/preview.ts +1 -16
- package/.turbo/turbo-build.log +9 -66
- package/CHANGELOG.md +27 -0
- package/README.md +6 -0
- package/dist/bootstrap/index.d.ts +1 -12
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -9
- package/dist/core/index.d.ts.map +1 -1
- package/dist/electron/index.d.ts +1 -2
- package/dist/electron/index.d.ts.map +1 -1
- package/dist/electron-builder/index.d.ts +1 -2
- package/dist/electron-builder/index.d.ts.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/mui/index.d.ts +1 -4
- package/dist/mui/index.d.ts.map +1 -1
- package/dist/next/index.d.ts +1 -5
- package/dist/next/index.d.ts.map +1 -1
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/react/index.d.ts +1 -5
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react-native/index.d.ts +1 -3
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/tailwind/index.d.ts +1 -2
- package/dist/tailwind/index.d.ts.map +1 -1
- package/dist/worker/index.d.ts +2 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/package.json +41 -99
- package/src/bootstrap/index.ts +2 -12
- package/src/browser/index.ts +2 -0
- package/src/core/index.ts +2 -9
- package/src/electron/index.ts +2 -2
- package/src/electron-builder/index.ts +2 -2
- package/src/index.ts +12 -0
- package/src/mui/index.ts +2 -4
- package/src/next/index.ts +2 -5
- package/src/node/index.ts +2 -0
- package/src/react/index.ts +2 -5
- package/src/react-native/index.ts +2 -3
- package/src/tailwind/index.ts +2 -2
- package/src/worker/index.ts +2 -0
- package/tsconfig.json +2 -14
- package/vite.config.ts +2 -56
- package/.turbo/turbo-test.log +0 -171
- package/builders/.swcrc +0 -18
- package/builders/build.config.ts +0 -11
- package/builders/bun.build.js +0 -23
- package/builders/package.json +0 -209
- package/builders/perf.mjs +0 -63
- package/builders/rollup.config.mjs +0 -50
- package/builders/rslib.config.ts +0 -26
- package/builders/tsconfig.json +0 -21
- package/builders/tsup.config.ts +0 -20
- package/builders/turbo.json +0 -24
- package/builders/vite.config.ts +0 -37
- package/demo/worker-demo.ts +0 -73
- package/dist/bootstrap/adaptiveContainer.d.ts +0 -3
- package/dist/bootstrap/adaptiveContainer.d.ts.map +0 -1
- package/dist/bootstrap/adaptiveContainer.js +0 -11
- package/dist/bootstrap/adaptiveContainer.js.map +0 -1
- package/dist/bootstrap/controls.d.ts +0 -38
- package/dist/bootstrap/controls.d.ts.map +0 -1
- package/dist/bootstrap/controls.js +0 -78
- package/dist/bootstrap/controls.js.map +0 -1
- package/dist/bootstrap/controls.stories.d.ts +0 -9
- package/dist/bootstrap/controls.stories.d.ts.map +0 -1
- package/dist/bootstrap/error.d.ts +0 -7
- package/dist/bootstrap/error.d.ts.map +0 -1
- package/dist/bootstrap/error.js +0 -32
- package/dist/bootstrap/error.js.map +0 -1
- package/dist/bootstrap/error.stories.d.ts +0 -8
- package/dist/bootstrap/error.stories.d.ts.map +0 -1
- package/dist/bootstrap/field.d.ts +0 -9
- package/dist/bootstrap/field.d.ts.map +0 -1
- package/dist/bootstrap/field.js +0 -29
- package/dist/bootstrap/field.js.map +0 -1
- package/dist/bootstrap/field.stories.d.ts +0 -8
- package/dist/bootstrap/field.stories.d.ts.map +0 -1
- package/dist/bootstrap/footer.d.ts +0 -10
- package/dist/bootstrap/footer.d.ts.map +0 -1
- package/dist/bootstrap/footer.js +0 -40
- package/dist/bootstrap/footer.js.map +0 -1
- package/dist/bootstrap/globalLoading.d.ts +0 -4
- package/dist/bootstrap/globalLoading.d.ts.map +0 -1
- package/dist/bootstrap/globalLoading.js +0 -10
- package/dist/bootstrap/globalLoading.js.map +0 -1
- package/dist/bootstrap/globalLoading.stories.d.ts +0 -7
- package/dist/bootstrap/globalLoading.stories.d.ts.map +0 -1
- package/dist/bootstrap/index.js +0 -35
- package/dist/bootstrap/loading.d.ts +0 -8
- package/dist/bootstrap/loading.d.ts.map +0 -1
- package/dist/bootstrap/loading.js +0 -18
- package/dist/bootstrap/loading.js.map +0 -1
- package/dist/bootstrap/loading.stories.d.ts +0 -9
- package/dist/bootstrap/loading.stories.d.ts.map +0 -1
- package/dist/bootstrap/responsiveHelper.d.ts +0 -7
- package/dist/bootstrap/responsiveHelper.d.ts.map +0 -1
- package/dist/bootstrap/responsiveHelper.js +0 -46
- package/dist/bootstrap/responsiveHelper.js.map +0 -1
- package/dist/bootstrap/screen.d.ts +0 -20
- package/dist/bootstrap/screen.d.ts.map +0 -1
- package/dist/bootstrap/screen.js +0 -79
- package/dist/bootstrap/screen.js.map +0 -1
- package/dist/bootstrap/screen.stories.d.ts +0 -14
- package/dist/bootstrap/screen.stories.d.ts.map +0 -1
- package/dist/bootstrap/toaster.d.ts +0 -9
- package/dist/bootstrap/toaster.d.ts.map +0 -1
- package/dist/bootstrap/toaster.js +0 -37
- package/dist/bootstrap/toaster.js.map +0 -1
- package/dist/bootstrap/toaster.stories.d.ts +0 -8
- package/dist/bootstrap/toaster.stories.d.ts.map +0 -1
- package/dist/bootstrap/useModal.d.ts +0 -22
- package/dist/bootstrap/useModal.d.ts.map +0 -1
- package/dist/bootstrap/useModal.js +0 -50
- package/dist/bootstrap/useModal.js.map +0 -1
- package/dist/bootstrap/useModal.stories.d.ts +0 -9
- package/dist/bootstrap/useModal.stories.d.ts.map +0 -1
- package/dist/bootstrap/useWrappedForm.d.ts +0 -14
- package/dist/bootstrap/useWrappedForm.d.ts.map +0 -1
- package/dist/bootstrap/useWrappedForm.js +0 -32
- package/dist/bootstrap/useWrappedForm.js.map +0 -1
- package/dist/core/cache.d.ts +0 -120
- package/dist/core/cache.d.ts.map +0 -1
- package/dist/core/cache.js +0 -107
- package/dist/core/cache.js.map +0 -1
- package/dist/core/cache.test.d.ts +0 -2
- package/dist/core/cache.test.d.ts.map +0 -1
- package/dist/core/errors.d.ts +0 -2
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/errors.js +0 -15
- package/dist/core/errors.js.map +0 -1
- package/dist/core/files.d.ts +0 -3
- package/dist/core/files.d.ts.map +0 -1
- package/dist/core/files.js +0 -27
- package/dist/core/files.js.map +0 -1
- package/dist/core/index.js +0 -34
- package/dist/core/index.js.map +0 -1
- package/dist/core/ls.d.ts +0 -6
- package/dist/core/ls.d.ts.map +0 -1
- package/dist/core/ls.js +0 -12
- package/dist/core/ls.js.map +0 -1
- package/dist/core/measure.d.ts +0 -35
- package/dist/core/measure.d.ts.map +0 -1
- package/dist/core/measure.js +0 -56
- package/dist/core/measure.js.map +0 -1
- package/dist/core/mutex.d.ts +0 -6
- package/dist/core/mutex.d.ts.map +0 -1
- package/dist/core/mutex.js +0 -26
- package/dist/core/mutex.js.map +0 -1
- package/dist/core/worker.d.ts +0 -98
- package/dist/core/worker.d.ts.map +0 -1
- package/dist/core/worker.js +0 -240
- package/dist/core/worker.js.map +0 -1
- package/dist/core/worker.test.d.ts +0 -2
- package/dist/core/worker.test.d.ts.map +0 -1
- package/dist/core/workerUtils.d.ts +0 -3
- package/dist/core/workerUtils.d.ts.map +0 -1
- package/dist/core/workerUtils.js +0 -31
- package/dist/core/workerUtils.js.map +0 -1
- package/dist/core/wrpc.d.ts +0 -45
- package/dist/core/wrpc.d.ts.map +0 -1
- package/dist/core/wrpc.fixture.d.ts +0 -29
- package/dist/core/wrpc.fixture.d.ts.map +0 -1
- package/dist/core/wrpc.js +0 -242
- package/dist/core/wrpc.js.map +0 -1
- package/dist/core/wrpc.test.d.ts +0 -1
- package/dist/core/wrpc.test.d.ts.map +0 -1
- package/dist/electron/createWindow.d.ts +0 -23
- package/dist/electron/createWindow.d.ts.map +0 -1
- package/dist/electron/createWindow.js +0 -160
- package/dist/electron/createWindow.js.map +0 -1
- package/dist/electron/index.js +0 -9
- package/dist/electron/index.js.map +0 -1
- package/dist/electron/updater.d.ts +0 -2
- package/dist/electron/updater.d.ts.map +0 -1
- package/dist/electron/updater.js +0 -47
- package/dist/electron/updater.js.map +0 -1
- package/dist/electron-builder/builder.d.ts +0 -8
- package/dist/electron-builder/builder.d.ts.map +0 -1
- package/dist/electron-builder/builder.js +0 -130
- package/dist/electron-builder/builder.js.map +0 -1
- package/dist/electron-builder/images.d.ts +0 -7
- package/dist/electron-builder/images.d.ts.map +0 -1
- package/dist/electron-builder/images.js +0 -25
- package/dist/electron-builder/images.js.map +0 -1
- package/dist/electron-builder/index.js +0 -7
- package/dist/electron-builder/index.js.map +0 -1
- package/dist/mui/formControlFieldset.d.ts +0 -5
- package/dist/mui/formControlFieldset.d.ts.map +0 -1
- package/dist/mui/formControlFieldset.js +0 -28
- package/dist/mui/formControlFieldset.js.map +0 -1
- package/dist/mui/formControlFieldset.stories.d.ts +0 -7
- package/dist/mui/formControlFieldset.stories.d.ts.map +0 -1
- package/dist/mui/formLabelLegend.d.ts +0 -4
- package/dist/mui/formLabelLegend.d.ts.map +0 -1
- package/dist/mui/formLabelLegend.js +0 -12
- package/dist/mui/formLabelLegend.js.map +0 -1
- package/dist/mui/genericControl.d.ts +0 -7
- package/dist/mui/genericControl.d.ts.map +0 -1
- package/dist/mui/genericControl.js +0 -21
- package/dist/mui/genericControl.js.map +0 -1
- package/dist/mui/index.js +0 -11
- package/dist/mui/index.js.map +0 -1
- package/dist/mui/readOnly.d.ts +0 -6
- package/dist/mui/readOnly.d.ts.map +0 -1
- package/dist/mui/readOnly.js +0 -7
- package/dist/mui/readOnly.js.map +0 -1
- package/dist/next/appLink.d.ts +0 -8
- package/dist/next/appLink.d.ts.map +0 -1
- package/dist/next/appLink.js +0 -34
- package/dist/next/appLink.js.map +0 -1
- package/dist/next/index.js +0 -15
- package/dist/next/index.js.map +0 -1
- package/dist/next/measure.d.ts +0 -15
- package/dist/next/measure.d.ts.map +0 -1
- package/dist/next/measure.js +0 -9
- package/dist/next/measure.js.map +0 -1
- package/dist/next/noSSR.d.ts +0 -5
- package/dist/next/noSSR.d.ts.map +0 -1
- package/dist/next/noSSR.js +0 -15
- package/dist/next/noSSR.js.map +0 -1
- package/dist/next/redirect.d.ts +0 -6
- package/dist/next/redirect.d.ts.map +0 -1
- package/dist/next/useIsInner.d.ts +0 -3
- package/dist/next/useIsInner.d.ts.map +0 -1
- package/dist/next/useIsInner.js +0 -15
- package/dist/next/useIsInner.js.map +0 -1
- package/dist/react/apiCall.d.ts +0 -6
- package/dist/react/apiCall.d.ts.map +0 -1
- package/dist/react/apiCall.js +0 -24
- package/dist/react/apiCall.js.map +0 -1
- package/dist/react/form/client.d.ts +0 -7
- package/dist/react/form/client.d.ts.map +0 -1
- package/dist/react/form/client.js +0 -46
- package/dist/react/form/client.js.map +0 -1
- package/dist/react/form/form.d.ts +0 -45
- package/dist/react/form/form.d.ts.map +0 -1
- package/dist/react/form/form.js +0 -69
- package/dist/react/form/form.js.map +0 -1
- package/dist/react/form/index.d.ts +0 -3
- package/dist/react/form/index.d.ts.map +0 -1
- package/dist/react/index.js +0 -25
- package/dist/react/index.js.map +0 -1
- package/dist/react/keyboard.d.ts +0 -11
- package/dist/react/keyboard.d.ts.map +0 -1
- package/dist/react/keyboard.js +0 -38
- package/dist/react/keyboard.js.map +0 -1
- package/dist/react/useFetch.d.ts +0 -2
- package/dist/react/useFetch.d.ts.map +0 -1
- package/dist/react/useFetch.js +0 -20
- package/dist/react/useFetch.js.map +0 -1
- package/dist/react/useFetcher.d.ts +0 -10
- package/dist/react/useFetcher.d.ts.map +0 -1
- package/dist/react/useFetcher.js +0 -43
- package/dist/react/useFetcher.js.map +0 -1
- package/dist/react-native/index.js +0 -9
- package/dist/react-native/index.js.map +0 -1
- package/dist/react-native/share.d.ts +0 -9
- package/dist/react-native/share.d.ts.map +0 -1
- package/dist/react-native/share.js +0 -23
- package/dist/react-native/share.js.map +0 -1
- package/dist/react-native/update.d.ts +0 -4
- package/dist/react-native/update.d.ts.map +0 -1
- package/dist/react-native/update.js +0 -40
- package/dist/react-native/update.js.map +0 -1
- package/dist/react-native/useAppState.d.ts +0 -2
- package/dist/react-native/useAppState.d.ts.map +0 -1
- package/dist/react-native/useAppState.js +0 -18
- package/dist/react-native/useAppState.js.map +0 -1
- package/dist/tailwind/fullpage.d.ts +0 -7
- package/dist/tailwind/fullpage.d.ts.map +0 -1
- package/dist/tailwind/fullpage.js +0 -14
- package/dist/tailwind/fullpage.js.map +0 -1
- package/dist/tailwind/index.js +0 -7
- package/dist/tailwind/index.js.map +0 -1
- package/dist/tailwind/responsiveHelper.d.ts +0 -2
- package/dist/tailwind/responsiveHelper.d.ts.map +0 -1
- package/dist/tailwind/responsiveHelper.js +0 -16
- package/dist/tailwind/responsiveHelper.js.map +0 -1
- package/src/bootstrap/adaptiveContainer.tsx +0 -12
- package/src/bootstrap/controls.stories.tsx +0 -62
- package/src/bootstrap/controls.tsx +0 -119
- package/src/bootstrap/error.stories.tsx +0 -34
- package/src/bootstrap/error.tsx +0 -40
- package/src/bootstrap/field.stories.tsx +0 -42
- package/src/bootstrap/field.tsx +0 -35
- package/src/bootstrap/footer.tsx +0 -49
- package/src/bootstrap/globalLoading.stories.tsx +0 -25
- package/src/bootstrap/globalLoading.tsx +0 -17
- package/src/bootstrap/loading.stories.tsx +0 -35
- package/src/bootstrap/loading.tsx +0 -22
- package/src/bootstrap/main.scss +0 -86
- package/src/bootstrap/responsiveHelper.tsx +0 -50
- package/src/bootstrap/screen.stories.tsx +0 -160
- package/src/bootstrap/screen.tsx +0 -144
- package/src/bootstrap/toaster.stories.tsx +0 -32
- package/src/bootstrap/toaster.tsx +0 -38
- package/src/bootstrap/useModal.stories.tsx +0 -51
- package/src/bootstrap/useModal.tsx +0 -88
- package/src/bootstrap/useWrappedForm.ts +0 -40
- package/src/core/README.md +0 -91
- package/src/core/cache.test.ts +0 -121
- package/src/core/cache.ts +0 -239
- package/src/core/errors.ts +0 -14
- package/src/core/files.ts +0 -25
- package/src/core/ls.ts +0 -11
- package/src/core/measure.ts +0 -61
- package/src/core/mutex.ts +0 -22
- package/src/core/worker.test.ts +0 -197
- package/src/core/worker.ts +0 -340
- package/src/core/workerUtils.ts +0 -32
- package/src/core/wrpc.fixture.ts +0 -72
- package/src/core/wrpc.test.ts +0 -225
- package/src/core/wrpc.ts +0 -359
- package/src/electron/README.md +0 -13
- package/src/electron/createWindow.ts +0 -234
- package/src/electron/updater.ts +0 -54
- package/src/electron-builder/builder.ts +0 -150
- package/src/electron-builder/images.ts +0 -33
- package/src/mui/README.md +0 -3
- package/src/mui/formControlFieldset.stories.tsx +0 -71
- package/src/mui/formControlFieldset.tsx +0 -26
- package/src/mui/formLabelLegend.tsx +0 -11
- package/src/mui/genericControl.tsx +0 -20
- package/src/mui/readOnly.tsx +0 -6
- package/src/next/appLink.tsx +0 -40
- package/src/next/measure.ts +0 -7
- package/src/next/noSSR.tsx +0 -17
- package/src/next/redirect.tsx +0 -13
- package/src/next/useIsInner.ts +0 -13
- package/src/react/apiCall.ts +0 -25
- package/src/react/form/client.tsx +0 -62
- package/src/react/form/form.tsx +0 -129
- package/src/react/form/index.ts +0 -2
- package/src/react/keyboard.tsx +0 -49
- package/src/react/useFetch.ts +0 -29
- package/src/react/useFetcher.ts +0 -49
- package/src/react-native/share.ts +0 -31
- package/src/react-native/update.tsx +0 -40
- package/src/react-native/useAppState.ts +0 -18
- package/src/tailwind/README.md +0 -8
- package/src/tailwind/fullpage.tsx +0 -11
- package/src/tailwind/responsiveHelper.tsx +0 -16
- package/src-todo/auth0.tsx +0 -177
- package/vite.exports.ts +0 -121
- /package/dist/{bootstrap/index.js.map → index.js.map} +0 -0
package/src/electron/README.md
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import https from 'node:https';
|
|
3
|
-
import http from 'node:http';
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import fsp from 'node:fs/promises';
|
|
6
|
-
import url from 'node:url';
|
|
7
|
-
import { Menu, app, BrowserWindow, shell, protocol, Rectangle } from 'electron';
|
|
8
|
-
import defaultMenu from 'electron-default-menu';
|
|
9
|
-
import Store from 'electron-store';
|
|
10
|
-
import { checkForUpdates } from './updater.js';
|
|
11
|
-
|
|
12
|
-
export const isDev = process.env['NODE_ENV'] === 'development';
|
|
13
|
-
export const appPath = app.getAppPath();
|
|
14
|
-
|
|
15
|
-
// See https://cs.chromium.org/chromium/src/net/base/net_error_list.h
|
|
16
|
-
const FILE_NOT_FOUND = -6;
|
|
17
|
-
|
|
18
|
-
const getPath = async (path_, file = '') => {
|
|
19
|
-
try {
|
|
20
|
-
const result = await fsp.stat(path_);
|
|
21
|
-
|
|
22
|
-
if (result.isFile()) return path_;
|
|
23
|
-
|
|
24
|
-
if (result.isDirectory()) return getPath(path.join(path_, `${file}.html`));
|
|
25
|
-
} catch {
|
|
26
|
-
/* empty */
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export function createWindow({
|
|
31
|
-
width = 1000,
|
|
32
|
-
height = 1000,
|
|
33
|
-
disableSecurity = true,
|
|
34
|
-
disableSecurityWarnings = true,
|
|
35
|
-
quitOnClose = true,
|
|
36
|
-
onOpen,
|
|
37
|
-
onClose,
|
|
38
|
-
localhostUrl = 'http://localhost:3000',
|
|
39
|
-
productionUrl = '', // in this mode Electron acts as a browser for remote app
|
|
40
|
-
webPath = path.resolve(appPath, 'web'), // must conform to what is in electron-builder.js files section
|
|
41
|
-
useStaticInDev = false,
|
|
42
|
-
updater = false,
|
|
43
|
-
rememberBounds = true,
|
|
44
|
-
}: {
|
|
45
|
-
width?: number;
|
|
46
|
-
height?: number;
|
|
47
|
-
disableSecurity?: boolean;
|
|
48
|
-
disableSecurityWarnings?: boolean;
|
|
49
|
-
quitOnClose?: boolean;
|
|
50
|
-
onOpen?: (win: BrowserWindow) => void;
|
|
51
|
-
onClose?: (win: BrowserWindow) => void;
|
|
52
|
-
localhostUrl?: string;
|
|
53
|
-
productionUrl?: string;
|
|
54
|
-
webPath?: string;
|
|
55
|
-
useStaticInDev?: boolean;
|
|
56
|
-
updater?: boolean;
|
|
57
|
-
rememberBounds?: boolean;
|
|
58
|
-
} = {}) {
|
|
59
|
-
let mainWindow: BrowserWindow | null = null;
|
|
60
|
-
|
|
61
|
-
console.log('[APP] Starting Electron', {
|
|
62
|
-
isDev,
|
|
63
|
-
appPath,
|
|
64
|
-
useStaticInDev,
|
|
65
|
-
localhostUrl,
|
|
66
|
-
productionUrl,
|
|
67
|
-
webPath,
|
|
68
|
-
updater,
|
|
69
|
-
rememberBounds,
|
|
70
|
-
quitOnClose,
|
|
71
|
-
disableSecurity,
|
|
72
|
-
disableSecurityWarnings,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
if (!productionUrl && !webPath) {
|
|
76
|
-
throw new Error('productionUrl or webPath must be defined');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (productionUrl && webPath) {
|
|
80
|
-
throw new Error('productionUrl and webPath cannot be used together');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (!localhostUrl) {
|
|
84
|
-
throw new Error('localhostUrl must be defined');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const store = new Store<{ bounds: Rectangle }>({
|
|
88
|
-
schema: {
|
|
89
|
-
bounds: {
|
|
90
|
-
type: 'object',
|
|
91
|
-
properties: {
|
|
92
|
-
// Docs: https://electronjs.org/docs/api/structures/rectangle
|
|
93
|
-
height: { type: 'number' },
|
|
94
|
-
width: { type: 'number' },
|
|
95
|
-
x: { type: 'number' },
|
|
96
|
-
y: { type: 'number' },
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
if (disableSecurityWarnings) process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
|
103
|
-
process.env['ELECTRON_ENABLE_LOGGING'] = 'true';
|
|
104
|
-
|
|
105
|
-
process.on('SIGTERM', () => process.exit(0));
|
|
106
|
-
process.on('SIGINT', () => process.exit(0));
|
|
107
|
-
|
|
108
|
-
const openDevTools = () => {
|
|
109
|
-
if (!mainWindow) return;
|
|
110
|
-
mainWindow.setSize(width + 800, height);
|
|
111
|
-
mainWindow.center();
|
|
112
|
-
mainWindow.webContents.openDevTools();
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const createWindow = async () => {
|
|
116
|
-
mainWindow = new BrowserWindow({
|
|
117
|
-
width,
|
|
118
|
-
height,
|
|
119
|
-
icon: path.resolve(appPath, 'assets/icon.png'),
|
|
120
|
-
webPreferences: {
|
|
121
|
-
nodeIntegration: false, // is default value after Electron v5
|
|
122
|
-
contextIsolation: true, // protect against prototype pollution
|
|
123
|
-
webSecurity: !disableSecurity,
|
|
124
|
-
devTools: true,
|
|
125
|
-
},
|
|
126
|
-
...(rememberBounds ? store.get('bounds') : {}),
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
mainWindow.on('move', () => rememberBounds && mainWindow && store.set('bounds', mainWindow.getBounds()));
|
|
130
|
-
|
|
131
|
-
mainWindow.once('ready-to-show', () => isDev && openDevTools());
|
|
132
|
-
|
|
133
|
-
// Static interceptor
|
|
134
|
-
|
|
135
|
-
let interceptor: (() => void) | null = null;
|
|
136
|
-
|
|
137
|
-
if (webPath && (!isDev || useStaticInDev)) {
|
|
138
|
-
console.log(`[APP] Static Server Enabled, ${localhostUrl} will be intercepted to ${webPath}`);
|
|
139
|
-
|
|
140
|
-
//TODO https://localhost:3000
|
|
141
|
-
// @see https://github.com/sindresorhus/electron-serve/blob/main/index.js
|
|
142
|
-
protocol.interceptStreamProtocol('http', (request, callback) => {
|
|
143
|
-
if (request.url.startsWith(localhostUrl)) {
|
|
144
|
-
let fileUrl = url.parse(request.url, false).pathname;
|
|
145
|
-
|
|
146
|
-
if (!fileUrl) return callback({ error: FILE_NOT_FOUND });
|
|
147
|
-
|
|
148
|
-
if (fileUrl === '/') fileUrl = 'index.html';
|
|
149
|
-
|
|
150
|
-
const filePath = path.join(webPath, fileUrl);
|
|
151
|
-
|
|
152
|
-
const relativePath = path.relative(webPath, fileUrl);
|
|
153
|
-
|
|
154
|
-
const isSafe = !relativePath.startsWith('..') && !path.isAbsolute(relativePath);
|
|
155
|
-
|
|
156
|
-
if (!isSafe && !isDev) return callback({ error: FILE_NOT_FOUND });
|
|
157
|
-
|
|
158
|
-
// const finalPath = await getPath(filePath, options.file);
|
|
159
|
-
// const fileExtension = path.extname(filePath);
|
|
160
|
-
|
|
161
|
-
console.log('[APP] Static Server', fileUrl, '->', filePath);
|
|
162
|
-
|
|
163
|
-
// return {path: path.join(webPath, fileUrl)};
|
|
164
|
-
callback(fs.createReadStream(filePath));
|
|
165
|
-
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// return {url: request.url};
|
|
170
|
-
(request.url.startsWith('https') ? https : http).get(request.url, callback);
|
|
171
|
-
|
|
172
|
-
return true;
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
interceptor = () => protocol.uninterceptProtocol('http');
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
mainWindow.on('closed', () => {
|
|
179
|
-
interceptor?.();
|
|
180
|
-
onClose?.(mainWindow as never);
|
|
181
|
-
mainWindow = null;
|
|
182
|
-
interceptor = null;
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// External URLs
|
|
186
|
-
|
|
187
|
-
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
|
188
|
-
shell.openExternal(url).catch((e) => console.error(e));
|
|
189
|
-
return { action: 'deny' };
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
// Menu
|
|
193
|
-
|
|
194
|
-
const menu = defaultMenu(app, shell);
|
|
195
|
-
|
|
196
|
-
if (updater) {
|
|
197
|
-
(menu.at(-1)!.submenu as any).push(
|
|
198
|
-
{ type: 'separator' },
|
|
199
|
-
{
|
|
200
|
-
label: 'Check For Updates',
|
|
201
|
-
click: checkForUpdates,
|
|
202
|
-
},
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
Menu.setApplicationMenu(Menu.buildFromTemplate(menu)); //TODO onMenu
|
|
207
|
-
|
|
208
|
-
// Should be last, after all listeners and menu
|
|
209
|
-
|
|
210
|
-
await app.whenReady();
|
|
211
|
-
|
|
212
|
-
onOpen?.(mainWindow);
|
|
213
|
-
|
|
214
|
-
if (!onOpen && localhostUrl) {
|
|
215
|
-
await mainWindow.loadURL(productionUrl && !isDev ? productionUrl : `${localhostUrl}/`);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
console.log('[APP] Main Window Open');
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
app.on('ready', createWindow);
|
|
222
|
-
|
|
223
|
-
app.on('window-all-closed', () => {
|
|
224
|
-
if (process.platform !== 'darwin' || quitOnClose) app.quit();
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
app.on('activate', () => BrowserWindow.getAllWindows().length === 0 && !mainWindow && createWindow());
|
|
228
|
-
|
|
229
|
-
return {
|
|
230
|
-
get mainWindow() {
|
|
231
|
-
return mainWindow;
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
}
|
package/src/electron/updater.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// https://github.com/electron-userland/electron-builder/blob/docs-deprecated/encapsulated%20manual%20update%20via%20menu.js
|
|
2
|
-
import { dialog } from 'electron';
|
|
3
|
-
import updater from 'electron-updater';
|
|
4
|
-
const { autoUpdater } = updater;
|
|
5
|
-
|
|
6
|
-
let updateButton;
|
|
7
|
-
|
|
8
|
-
autoUpdater.autoDownload = false;
|
|
9
|
-
|
|
10
|
-
autoUpdater.on('error', (error) => {
|
|
11
|
-
dialog.showErrorBox('Error: ', !error ? 'unknown' : (error.stack || error).toString());
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
autoUpdater.on('update-available', async () => {
|
|
15
|
-
const { response } = await dialog.showMessageBox({
|
|
16
|
-
type: 'info',
|
|
17
|
-
title: 'Found Updates',
|
|
18
|
-
message: 'Found updates, do you want update now?',
|
|
19
|
-
buttons: ['Yes', 'No'],
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
updateButton.enabled = true;
|
|
23
|
-
updateButton = null;
|
|
24
|
-
|
|
25
|
-
if (response === 0) await autoUpdater.downloadUpdate();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
autoUpdater.on('update-not-available', async () => {
|
|
29
|
-
try {
|
|
30
|
-
await dialog.showMessageBox({
|
|
31
|
-
title: 'No Updates',
|
|
32
|
-
message: 'Current version is up-to-date.',
|
|
33
|
-
});
|
|
34
|
-
} catch (e) {
|
|
35
|
-
dialog.showErrorBox('Error: ', e.toString());
|
|
36
|
-
}
|
|
37
|
-
updateButton.enabled = true;
|
|
38
|
-
updateButton = null;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
autoUpdater.on('update-downloaded', async () => {
|
|
42
|
-
await dialog.showMessageBox({
|
|
43
|
-
title: 'Install Update',
|
|
44
|
-
message: 'Update downloaded, application will quit for update...',
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
autoUpdater.quitAndInstall();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export function checkForUpdates(menuItem, focusedWindow, event) {
|
|
51
|
-
updateButton = menuItem;
|
|
52
|
-
updateButton.enabled = false;
|
|
53
|
-
autoUpdater.checkForUpdates().catch((e) => console.error('Update error', e));
|
|
54
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type { Configuration, MacConfiguration } from 'electron-builder';
|
|
2
|
-
import type { GithubOptions, S3Options } from 'builder-util-runtime';
|
|
3
|
-
|
|
4
|
-
const {
|
|
5
|
-
GITHUB_REF_TYPE,
|
|
6
|
-
GITHUB_REF_NAME,
|
|
7
|
-
GITHUB_RUN_ID,
|
|
8
|
-
GITHUB_REF,
|
|
9
|
-
AWS_URL,
|
|
10
|
-
AWS_ACCESS_KEY_ID,
|
|
11
|
-
AWS_SECRET_ACCESS_KEY,
|
|
12
|
-
GH_TOKEN,
|
|
13
|
-
CSC_IDENTITY_AUTO_DISCOVERY,
|
|
14
|
-
} = process.env;
|
|
15
|
-
|
|
16
|
-
const isGithubTag = GITHUB_REF_TYPE === 'tag';
|
|
17
|
-
const isGithubMaster = GITHUB_REF_TYPE === 'branch' && GITHUB_REF_NAME === 'master';
|
|
18
|
-
const isDevPublish = AWS_URL?.includes(':9000');
|
|
19
|
-
const isNoAutoDiscovery = CSC_IDENTITY_AUTO_DISCOVERY === 'false';
|
|
20
|
-
const isSkipPublish = !isDevPublish && !isGithubMaster && !isGithubTag;
|
|
21
|
-
|
|
22
|
-
//FIXME Refine logic, tags should be versions, not channels, use branches? See how Changesets does it
|
|
23
|
-
const channel = isGithubTag ? 'latest' : GITHUB_REF_NAME; // https://www.electron.build/tutorials/release-using-channels.html
|
|
24
|
-
|
|
25
|
-
function getVersion() {
|
|
26
|
-
if (isGithubMaster) {
|
|
27
|
-
return `0.0.${GITHUB_RUN_ID}`; //TODO Figure out last normal in master and bump it
|
|
28
|
-
}
|
|
29
|
-
if (isGithubTag) {
|
|
30
|
-
return GITHUB_REF!.split('/').pop();
|
|
31
|
-
}
|
|
32
|
-
return `0.0.${Date.now()}`; //TODO Read from package.json?
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getTarget() {
|
|
36
|
-
const arch = ['arm64', isNoAutoDiscovery ? '' : 'x64'].filter(Boolean) as any;
|
|
37
|
-
|
|
38
|
-
const target: MacConfiguration['target'] = [
|
|
39
|
-
{
|
|
40
|
-
target: 'dmg',
|
|
41
|
-
arch,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
target: 'zip',
|
|
45
|
-
arch,
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
// Leave only DMG if no signing
|
|
50
|
-
if (isNoAutoDiscovery) {
|
|
51
|
-
console.log('Skipping signing...');
|
|
52
|
-
delete process.env.CSC_LINK;
|
|
53
|
-
return [target[0]]; // only keep DMG
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return target;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function builerConfig(options: {
|
|
60
|
-
config: Configuration;
|
|
61
|
-
s3?: Pick<S3Options, 'bucket'> & Partial<S3Options>; //TODO Omit?
|
|
62
|
-
githubReleases: Pick<GithubOptions, 'owner' | 'repo'> & Partial<GithubOptions>;
|
|
63
|
-
}): Configuration {
|
|
64
|
-
if (options.s3 && (!AWS_URL || !AWS_ACCESS_KEY_ID || !AWS_SECRET_ACCESS_KEY)) {
|
|
65
|
-
throw new Error('Missing AWS configuration');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (options.githubReleases && !GH_TOKEN) {
|
|
69
|
-
throw new Error('Missing AWS configuration');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const config: Configuration = {
|
|
73
|
-
files: [
|
|
74
|
-
'**/*',
|
|
75
|
-
'!electron-builder.js',
|
|
76
|
-
'!electron-builder.yml',
|
|
77
|
-
'!package.json',
|
|
78
|
-
'assets',
|
|
79
|
-
...(options.config.files as never),
|
|
80
|
-
],
|
|
81
|
-
directories: {
|
|
82
|
-
buildResources: 'assets',
|
|
83
|
-
},
|
|
84
|
-
mac: {
|
|
85
|
-
category: options.config.mac?.category ?? 'public.app-category.utils',
|
|
86
|
-
target: getTarget(),
|
|
87
|
-
},
|
|
88
|
-
//TODO Windows target
|
|
89
|
-
dmg: {
|
|
90
|
-
contents: [
|
|
91
|
-
{
|
|
92
|
-
x: 130,
|
|
93
|
-
y: 130,
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
x: 370,
|
|
97
|
-
y: 130,
|
|
98
|
-
type: 'link',
|
|
99
|
-
path: '/Applications',
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
publish: [
|
|
104
|
-
options.s3 &&
|
|
105
|
-
({
|
|
106
|
-
provider: 's3',
|
|
107
|
-
endpoint: AWS_URL,
|
|
108
|
-
channel,
|
|
109
|
-
...options.s3, // bucket
|
|
110
|
-
} as S3Options),
|
|
111
|
-
options.githubReleases &&
|
|
112
|
-
GH_TOKEN &&
|
|
113
|
-
(isGithubTag || isGithubMaster) &&
|
|
114
|
-
({
|
|
115
|
-
provider: 'github',
|
|
116
|
-
private: true,
|
|
117
|
-
token: GH_TOKEN,
|
|
118
|
-
releaseType: isGithubTag ? 'release' : 'draft',
|
|
119
|
-
channel,
|
|
120
|
-
...options.githubReleases, // repo, owner
|
|
121
|
-
} as GithubOptions),
|
|
122
|
-
].filter(Boolean) as never,
|
|
123
|
-
extraMetadata: {
|
|
124
|
-
version: getVersion(),
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
if (isSkipPublish) {
|
|
129
|
-
delete config.publish;
|
|
130
|
-
delete (config as never as any).extraMetadata;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
console.log('Electron Builder context', {
|
|
134
|
-
isDevPublish,
|
|
135
|
-
isGithubMaster,
|
|
136
|
-
isGithubTag,
|
|
137
|
-
isSkipPublish,
|
|
138
|
-
isNoAutoDiscovery,
|
|
139
|
-
channel,
|
|
140
|
-
GITHUB_RUN_ID: GITHUB_RUN_ID,
|
|
141
|
-
GITHUB_REF_TYPE: GITHUB_REF_TYPE,
|
|
142
|
-
GITHUB_REF_NAME: GITHUB_REF_NAME,
|
|
143
|
-
CSC_IDENTITY_AUTO_DISCOVERY: CSC_IDENTITY_AUTO_DISCOVERY,
|
|
144
|
-
AWS_URL: AWS_URL,
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
console.log('Electron Builder configuration', JSON.stringify(config, null, 2));
|
|
148
|
-
|
|
149
|
-
return config;
|
|
150
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import psd from 'psd';
|
|
2
|
-
import sharp from 'sharp';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
|
|
5
|
-
export async function generateImages({
|
|
6
|
-
iconPsdPath,
|
|
7
|
-
dmgBackgroundPsdPath,
|
|
8
|
-
electronAssetsPath,
|
|
9
|
-
webPublicPath,
|
|
10
|
-
}: {
|
|
11
|
-
iconPsdPath: string;
|
|
12
|
-
dmgBackgroundPsdPath: string;
|
|
13
|
-
electronAssetsPath: string;
|
|
14
|
-
webPublicPath: string;
|
|
15
|
-
}) {
|
|
16
|
-
const iconPsd = await psd.open(iconPsdPath);
|
|
17
|
-
await iconPsd.image!.saveAsPng(path.join(electronAssetsPath, 'icon.png'));
|
|
18
|
-
|
|
19
|
-
const bgPsd = await psd.open(dmgBackgroundPsdPath);
|
|
20
|
-
await bgPsd.image!.saveAsPng(path.join(electronAssetsPath, 'background@2x.png'));
|
|
21
|
-
|
|
22
|
-
const iconPng = sharp(path.join(electronAssetsPath, 'icon.png'));
|
|
23
|
-
const bgPng = sharp(path.join(electronAssetsPath, 'background@2x.png'));
|
|
24
|
-
|
|
25
|
-
await bgPng.resize(500).toFile(path.join(electronAssetsPath, 'background.png'));
|
|
26
|
-
|
|
27
|
-
await iconPng.toFile(path.join(electronAssetsPath, 'splash.webp'));
|
|
28
|
-
await iconPng.toFile(path.join(electronAssetsPath, 'icon.icns'));
|
|
29
|
-
|
|
30
|
-
//TODO Crop without icon BG
|
|
31
|
-
await iconPng.toFile(path.join(webPublicPath, 'icon.png'));
|
|
32
|
-
await iconPng.resize(32).toFile(path.join(webPublicPath, 'favicon.ico'));
|
|
33
|
-
}
|
package/src/mui/README.md
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { TextField, Stack, InputLabel, RadioGroup, Radio, FormControlLabel, Box } from '@mui/material';
|
|
5
|
-
|
|
6
|
-
import { GenericControl } from './genericControl';
|
|
7
|
-
import { ReadOnly } from './readOnly';
|
|
8
|
-
import { FormControlFieldset } from './formControlFieldset';
|
|
9
|
-
import { FormLabelLegend } from './formLabelLegend';
|
|
10
|
-
|
|
11
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
12
|
-
const meta: Meta<typeof GenericControl> = {
|
|
13
|
-
title: 'MUI / FormControlFieldset',
|
|
14
|
-
parameters: {
|
|
15
|
-
layout: 'centered',
|
|
16
|
-
},
|
|
17
|
-
tags: ['autodocs'],
|
|
18
|
-
argTypes: {},
|
|
19
|
-
render: function Render() {
|
|
20
|
-
return (
|
|
21
|
-
<Box sx={{ position: 'relative' }}>
|
|
22
|
-
<Rule top={12} />
|
|
23
|
-
<Rule top={37} />
|
|
24
|
-
<Rule top={48} />
|
|
25
|
-
<Stack direction="row" gap={3} sx={{ alignItems: 'flex-start' }}>
|
|
26
|
-
<FormControlFieldset>
|
|
27
|
-
<FormLabelLegend>Radios</FormLabelLegend>
|
|
28
|
-
<ReadOnly>
|
|
29
|
-
{/* TODO The size of the component. small is equivalent to the dense radio styling. */}
|
|
30
|
-
<RadioGroup row defaultValue="female" name="radio-buttons-group" sx={{ mt: -1 }}>
|
|
31
|
-
<FormControlLabel value="female" label="Female" control={<Radio size="small" />} />
|
|
32
|
-
<FormControlLabel value="male" label="Male" control={<Radio size="small" />} />
|
|
33
|
-
<FormControlLabel value="other" label="Other" control={<Radio size="small" />} />
|
|
34
|
-
</RadioGroup>
|
|
35
|
-
</ReadOnly>
|
|
36
|
-
</FormControlFieldset>
|
|
37
|
-
|
|
38
|
-
<GenericControl>
|
|
39
|
-
<InputLabel shrink>GenericControl</InputLabel>
|
|
40
|
-
<ReadOnly>
|
|
41
|
-
This is a <code>div</code>, not an input with <code>readOnly</code>
|
|
42
|
-
</ReadOnly>
|
|
43
|
-
</GenericControl>
|
|
44
|
-
|
|
45
|
-
<FormControlFieldset>
|
|
46
|
-
<FormLabelLegend>FormLabelLegend</FormLabelLegend>
|
|
47
|
-
<ReadOnly>
|
|
48
|
-
This is a <code>div</code>, not an input with <code>readOnly</code>
|
|
49
|
-
</ReadOnly>
|
|
50
|
-
</FormControlFieldset>
|
|
51
|
-
|
|
52
|
-
<TextField label="TextField" defaultValue="Bar" variant="standard" />
|
|
53
|
-
</Stack>
|
|
54
|
-
</Box>
|
|
55
|
-
);
|
|
56
|
-
},
|
|
57
|
-
} satisfies Meta<typeof GenericControl>;
|
|
58
|
-
|
|
59
|
-
export default meta;
|
|
60
|
-
|
|
61
|
-
type Story = StoryObj<typeof meta>;
|
|
62
|
-
|
|
63
|
-
function Rule({ top }) {
|
|
64
|
-
return (
|
|
65
|
-
<Box sx={{ background: 'red', position: 'absolute', left: 0, top: `${top}px`, width: '100%', height: '1px' }} />
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export const Default: Story = {
|
|
70
|
-
args: {},
|
|
71
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { GenericControl, GenericControlProps } from './genericControl';
|
|
3
|
-
import { inputClasses } from '@mui/material/Input';
|
|
4
|
-
|
|
5
|
-
export type FormControlFieldsetProps = GenericControlProps;
|
|
6
|
-
|
|
7
|
-
export const FormControlFieldset: React.FC<FormControlFieldsetProps> = function FormControlFieldset({
|
|
8
|
-
children,
|
|
9
|
-
sx,
|
|
10
|
-
...props
|
|
11
|
-
}) {
|
|
12
|
-
return (
|
|
13
|
-
<GenericControl
|
|
14
|
-
{...props}
|
|
15
|
-
component="fieldset"
|
|
16
|
-
sx={{
|
|
17
|
-
...sx,
|
|
18
|
-
[`legend + .${inputClasses.root}`]: {
|
|
19
|
-
marginTop: 2, //FIXME 16px, hardcoded from @mui/material/Input/Input.js @ 59
|
|
20
|
-
},
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
{children}
|
|
24
|
-
</GenericControl>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { default as InputLabel, InputLabelProps } from '@mui/material/InputLabel';
|
|
3
|
-
|
|
4
|
-
export const FormLabelLegend: React.FC<InputLabelProps> = ({ children, ...props }) => {
|
|
5
|
-
return (
|
|
6
|
-
// sx={(theme) => theme.typography.caption}
|
|
7
|
-
<InputLabel {...props} shrink={true} component={'legend' as any}>
|
|
8
|
-
{children}
|
|
9
|
-
</InputLabel>
|
|
10
|
-
);
|
|
11
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { FormControlProps, default as FormControl } from '@mui/material/FormControl';
|
|
3
|
-
import { inputClasses } from '@mui/material/Input';
|
|
4
|
-
|
|
5
|
-
export type GenericControlProps = FormControlProps & { children: any };
|
|
6
|
-
|
|
7
|
-
export const GenericControl: React.FC<GenericControlProps> = ({ children, sx, ...props }) => (
|
|
8
|
-
<FormControl
|
|
9
|
-
variant="standard"
|
|
10
|
-
sx={{
|
|
11
|
-
...sx,
|
|
12
|
-
[`& .${inputClasses.root}`]: {
|
|
13
|
-
'&:before, &:after': { display: 'none' },
|
|
14
|
-
},
|
|
15
|
-
}}
|
|
16
|
-
{...props}
|
|
17
|
-
>
|
|
18
|
-
{children}
|
|
19
|
-
</FormControl>
|
|
20
|
-
);
|
package/src/mui/readOnly.tsx
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { default as Input, InputProps } from '@mui/material/Input';
|
|
3
|
-
|
|
4
|
-
export const ReadOnly: React.FC<InputProps & { children: any }> = ({ children, inputProps, ...props }) => (
|
|
5
|
-
<Input {...props} inputComponent={'div' as any} inputProps={{ ...inputProps, children }}></Input>
|
|
6
|
-
);
|
package/src/next/appLink.tsx
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { ComponentProps, FC } from 'react';
|
|
4
|
-
import { usePathname } from 'next/navigation';
|
|
5
|
-
import Link, { LinkProps } from 'next/link';
|
|
6
|
-
import clsx from 'clsx';
|
|
7
|
-
|
|
8
|
-
//TODO Test this
|
|
9
|
-
export const AppLink: FC<
|
|
10
|
-
{
|
|
11
|
-
children: any;
|
|
12
|
-
exact?: boolean;
|
|
13
|
-
activeClassName?: any;
|
|
14
|
-
} & LinkProps &
|
|
15
|
-
ComponentProps<typeof Link>
|
|
16
|
-
> = function AppLink({
|
|
17
|
-
href,
|
|
18
|
-
children,
|
|
19
|
-
className = '',
|
|
20
|
-
activeClassName = '',
|
|
21
|
-
prefetch = false, // set explicit default
|
|
22
|
-
exact = false,
|
|
23
|
-
...props
|
|
24
|
-
}) {
|
|
25
|
-
const pathname = usePathname();
|
|
26
|
-
const hrefPath = typeof href === 'string' ? href : href.pathname || '/';
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Link
|
|
30
|
-
{...props}
|
|
31
|
-
href={href}
|
|
32
|
-
className={clsx(className, {
|
|
33
|
-
[activeClassName]: (!exact && pathname.startsWith(hrefPath)) || (exact && pathname === hrefPath),
|
|
34
|
-
})}
|
|
35
|
-
prefetch={prefetch}
|
|
36
|
-
>
|
|
37
|
-
{children}
|
|
38
|
-
</Link>
|
|
39
|
-
);
|
|
40
|
-
};
|
package/src/next/measure.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createMeasurer } from '../core/measure';
|
|
2
|
-
import { PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER } from 'next/constants';
|
|
3
|
-
|
|
4
|
-
export const isProd =
|
|
5
|
-
process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD || process.env.NEXT_PHASE === PHASE_PRODUCTION_SERVER;
|
|
6
|
-
|
|
7
|
-
export const measurer = createMeasurer({ colors: isProd });
|