@lukylinek/app_projekt 0.5.0
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/eslint.config.js +38 -0
- package/index.html +20 -0
- package/library.html +22 -0
- package/library.test.html +29 -0
- package/package.json +40 -0
- package/src/App.jsx +18 -0
- package/src/AppNavbar.jsx +25 -0
- package/src/AppRouter.jsx +35 -0
- package/src/StandaloneEntry.jsx +15 -0
- package/src/index.css +38 -0
- package/src/index.js +0 -0
- package/src/main.jsx +10 -0
- package/vite.config.js +102 -0
package/eslint.config.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import react from 'eslint-plugin-react'
|
|
4
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
5
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{ ignores: ['dist'] },
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.{js,jsx}'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
ecmaVersion: 2020,
|
|
13
|
+
globals: globals.browser,
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaVersion: 'latest',
|
|
16
|
+
ecmaFeatures: { jsx: true },
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
settings: { react: { version: '18.3' } },
|
|
21
|
+
plugins: {
|
|
22
|
+
react,
|
|
23
|
+
'react-hooks': reactHooks,
|
|
24
|
+
'react-refresh': reactRefresh,
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
...js.configs.recommended.rules,
|
|
28
|
+
...react.configs.recommended.rules,
|
|
29
|
+
...react.configs['jsx-runtime'].rules,
|
|
30
|
+
...reactHooks.configs.recommended.rules,
|
|
31
|
+
'react/jsx-no-target-blank': 'off',
|
|
32
|
+
'react-refresh/only-export-components': [
|
|
33
|
+
'warn',
|
|
34
|
+
{ allowConstantExport: true },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
]
|
package/index.html
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>GQL Model Viewer</title>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
9
|
+
|
|
10
|
+
</head>
|
|
11
|
+
|
|
12
|
+
<body>
|
|
13
|
+
|
|
14
|
+
<div id="root_"></div>
|
|
15
|
+
<div id="root"></div>
|
|
16
|
+
|
|
17
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
18
|
+
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
package/library.html
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>GQL Model Viewer</title>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
+
<link rel="stylesheet" crossorigin href="/generic/app_dynamic.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
<script>
|
|
13
|
+
// Node-like shim pro knihovny, které čekají process.env
|
|
14
|
+
globalThis.process = globalThis.process || { env: {} };
|
|
15
|
+
globalThis.process.env = globalThis.process.env || {};
|
|
16
|
+
globalThis.process.env.NODE_ENV = globalThis.process.env.NODE_ENV || "development" || "production";
|
|
17
|
+
</script>
|
|
18
|
+
<script type="module">
|
|
19
|
+
import { mount } from "/generic/es/StandaloneEntry.js"
|
|
20
|
+
mount(document.getElementById("root"), { GQLENDPOINT: "/gql" });
|
|
21
|
+
</script>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>GQL Model Viewer</title>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
9
|
+
|
|
10
|
+
<script src="https://unpkg.com/react@19"></script>
|
|
11
|
+
<script src="https://unpkg.com/react-dom@19"></script>
|
|
12
|
+
|
|
13
|
+
<script src="https://unpkg.com/@reduxjs/toolkit@1.9.3/dist/redux-toolkit.umd.js"></script>
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
|
|
18
|
+
<div id="root_"></div>
|
|
19
|
+
<div id="root"></div>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</body>
|
|
23
|
+
<script type="module" src="./dist/umd/StandaloneEntry.js"></script>
|
|
24
|
+
<script>
|
|
25
|
+
const {mount } = MyApp
|
|
26
|
+
console.log("MyApp", MyApp)
|
|
27
|
+
console.log("mount", mount)
|
|
28
|
+
</script>
|
|
29
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lukylinek/app_projekt",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"lint": "eslint .",
|
|
10
|
+
"preview": "vite preview",
|
|
11
|
+
"build:production": "NODE_ENV=production vite build"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"react": "^19.2.1",
|
|
15
|
+
"react-dom": "^19.2.1",
|
|
16
|
+
"react-router": "^7.0.2",
|
|
17
|
+
"bootstrap": "^5.3.3",
|
|
18
|
+
"@popperjs/core": "^2.11.8",
|
|
19
|
+
"@apollo/client": "^4.0.10",
|
|
20
|
+
|
|
21
|
+
"@hrbolek/uoisfrontend-template": "*",
|
|
22
|
+
"@hrbolek/uoisfrontend-shared": "*",
|
|
23
|
+
"@hrbolek/uoisfrontend-gql-shared": "*",
|
|
24
|
+
"@hrbolek/uoisfrontend-ug": "*",
|
|
25
|
+
"@hrbolek/uoisfrontend-requests": "*",
|
|
26
|
+
"@hrbolek/uoisfrontend-zp": "*"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@eslint/js": "^9.15.0",
|
|
30
|
+
"@types/react": "^19.2.7",
|
|
31
|
+
"@types/react-dom": "^19.2.3",
|
|
32
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
33
|
+
"eslint": "^9.15.0",
|
|
34
|
+
"eslint-plugin-react": "^7.37.2",
|
|
35
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
36
|
+
"eslint-plugin-react-refresh": "^0.4.14",
|
|
37
|
+
"globals": "^15.12.0",
|
|
38
|
+
"vite": "^6.0.1"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/src/App.jsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
2
|
+
|
|
3
|
+
import { AppRouter } from './AppRouter';
|
|
4
|
+
import { RootProviders } from '../../../packages/dynamic/src/Store';
|
|
5
|
+
|
|
6
|
+
export const GQLENDPOINT_ = "/api/gql"
|
|
7
|
+
// const getSdl = () => client.sdl()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line react/prop-types
|
|
11
|
+
export const App = ({ GQLENDPOINT=GQLENDPOINT_}) => {
|
|
12
|
+
return (
|
|
13
|
+
<RootProviders clientOptions={{ endpoint: GQLENDPOINT }}>
|
|
14
|
+
<AppRouter />
|
|
15
|
+
</RootProviders>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useSelector } from "react-redux"
|
|
2
|
+
import { useParams } from "react-router"
|
|
3
|
+
|
|
4
|
+
import { selectItemById } from "../../../packages/dynamic/src/Store";
|
|
5
|
+
// import { MyNavDropdown as GroupTypeNavDropdown } from "../../../packages/_template/src/GroupTypeGQLModel";
|
|
6
|
+
// import { MyNavDropdown as UserNavDropdown } from "../../../packages/_template/src/UserGQLModel";
|
|
7
|
+
// import { MyNavDropdown as GroupNavDropdown } from "../../../packages/_template/src/GroupGQLModel";
|
|
8
|
+
// import { MyNavDropdown as RoleNavDropdown } from "../../../packages/_template/src/RoleGQLModel";
|
|
9
|
+
// import { MyNavDropdown as RoleTypeNavDropdown } from "../../../packages/_template/src/RoleTypeGQLModel";
|
|
10
|
+
import { PageNavbar } from "../../../packages/_template/src/Base/Pages/PageNavbar";
|
|
11
|
+
|
|
12
|
+
export const AppNavbar = () => {
|
|
13
|
+
const { id } = useParams()
|
|
14
|
+
const item = useSelector((dataroot) => selectItemById(dataroot, id)) || {}
|
|
15
|
+
// console.log("AppNavbar", id, item)
|
|
16
|
+
return (
|
|
17
|
+
<PageNavbar item={item}>
|
|
18
|
+
{/* <UserNavDropdown item={item} />
|
|
19
|
+
<GroupNavDropdown item={item} />
|
|
20
|
+
<RoleNavDropdown item={item} />
|
|
21
|
+
<GroupTypeNavDropdown item={item} />
|
|
22
|
+
<RoleTypeNavDropdown item={item} /> */}
|
|
23
|
+
</PageNavbar>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBrowserRouter,
|
|
3
|
+
Outlet,
|
|
4
|
+
RouterProvider,
|
|
5
|
+
} from "react-router-dom";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
NavigationHistoryLinks,
|
|
9
|
+
NavigationHistoryProvider
|
|
10
|
+
} from '../../../packages/_template/src/Base/Helpers/NavigationHistoryProvider';
|
|
11
|
+
|
|
12
|
+
import { AppNavbar } from "./AppNavbar";
|
|
13
|
+
import { ProjectGQLModelRouterSegments } from "../../../packages/projekt_lukas/src/ProjectGQLModel/Pages/RouterSegment";
|
|
14
|
+
|
|
15
|
+
const AppLayout = () => (
|
|
16
|
+
<NavigationHistoryProvider>
|
|
17
|
+
<AppNavbar />
|
|
18
|
+
{/* <NavigationHistoryLinks /> */}
|
|
19
|
+
<Outlet />
|
|
20
|
+
</NavigationHistoryProvider>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const Routes = [
|
|
24
|
+
{
|
|
25
|
+
path: "/",
|
|
26
|
+
element: <AppLayout />,
|
|
27
|
+
children: [
|
|
28
|
+
...ProjectGQLModelRouterSegments,
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const router = createBrowserRouter(Routes);
|
|
34
|
+
|
|
35
|
+
export const AppRouter = () => <RouterProvider router={router} />;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// import React from "react"
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import { App } from "./App";
|
|
4
|
+
|
|
5
|
+
export function mount(el, props = {}) {
|
|
6
|
+
if (!el) throw new Error("MyApp.mount: missing mount element");
|
|
7
|
+
console.log("inside mount, doing to render")
|
|
8
|
+
createRoot(el).render(<App {...props} />);
|
|
9
|
+
console.log("inside mount, render finished")
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// pro IIFE build to přilepíme na window
|
|
13
|
+
if (typeof window !== "undefined") {
|
|
14
|
+
window.MyApp = { mount };
|
|
15
|
+
}
|
package/src/index.css
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
body {
|
|
2
|
+
overflow-x: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
fieldset {
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
overflow-x: auto;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
table {
|
|
11
|
+
width: 100%;
|
|
12
|
+
max-width: 100%;
|
|
13
|
+
table-layout: fixed;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
th,
|
|
17
|
+
td {
|
|
18
|
+
word-break: break-word;
|
|
19
|
+
overflow-wrap: anywhere;
|
|
20
|
+
vertical-align: top;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
pre {
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
overflow-x: auto;
|
|
26
|
+
white-space: pre-wrap;
|
|
27
|
+
word-break: break-word;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.container,
|
|
31
|
+
.container-fluid {
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.card,
|
|
36
|
+
fieldset {
|
|
37
|
+
border-radius: 8px;
|
|
38
|
+
}
|
package/src/index.js
ADDED
|
File without changes
|
package/src/main.jsx
ADDED
package/vite.config.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
import react from "@vitejs/plugin-react"; // Enables React-specific optimizations and HMR
|
|
4
|
+
import path from "path"; // Provides utilities for working with file and directory paths
|
|
5
|
+
|
|
6
|
+
// Export the Vite configuration
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [react()],
|
|
9
|
+
|
|
10
|
+
// Module resolution settings
|
|
11
|
+
resolve: {
|
|
12
|
+
preserveSymlinks: true, // Prevents breaking symbolic links, useful for monorepos
|
|
13
|
+
alias: {
|
|
14
|
+
// Define aliases for modules, resolving them to specific paths
|
|
15
|
+
"@hrbolek/uoisfrontend-template": path.resolve(__dirname, "../../packages/_template/src"),
|
|
16
|
+
"@hrbolek/uoisfrontend-dynamic": path.resolve(__dirname, "../../packages/dynamic/src"),
|
|
17
|
+
"@hrbolek/uoisfrontend-shared": path.resolve(__dirname, "../../packages/shared/src"),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// Dependency optimization settings
|
|
22
|
+
optimizeDeps: {
|
|
23
|
+
include: [
|
|
24
|
+
// List dependencies to pre-bundle for faster development
|
|
25
|
+
'invariant',
|
|
26
|
+
'classnames',
|
|
27
|
+
'react-bootstrap',
|
|
28
|
+
'prop-types',
|
|
29
|
+
'graphql'
|
|
30
|
+
],
|
|
31
|
+
exclude: [
|
|
32
|
+
// Exclude specific libraries or modules from optimization
|
|
33
|
+
"@hrbolek/uoisfrontend-template",
|
|
34
|
+
|
|
35
|
+
"@hrbolek/uoisfrontend-dynamic",
|
|
36
|
+
"@hrbolek/uoisfrontend-shared",
|
|
37
|
+
"@hrbolek/uoisfrontend-gql-shared",
|
|
38
|
+
"@hrbolek/uoisfrontend-ug",
|
|
39
|
+
"@hrbolek/uoisfrontend-granting",
|
|
40
|
+
"@hrbolek/uoisfrontend-admissions",
|
|
41
|
+
"@hrbolek/uoisfrontend-requests",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
// Development server configuration
|
|
46
|
+
server: {
|
|
47
|
+
proxy: {
|
|
48
|
+
// Define proxy rules for API requests
|
|
49
|
+
// Example: Requests to /api/gql are proxied to http://localhost:33001
|
|
50
|
+
'/api/gql': 'http://localhost:33001',
|
|
51
|
+
},
|
|
52
|
+
watch: {
|
|
53
|
+
// Specify paths to watch for changes
|
|
54
|
+
ignored: [
|
|
55
|
+
// Ensure certain packages are not ignored during file watching
|
|
56
|
+
'!../../packages/_template/**',
|
|
57
|
+
'!../../packages/dynamic/**',
|
|
58
|
+
'!../../packages/shared/**',
|
|
59
|
+
'!../../packages/gql-shared/**',
|
|
60
|
+
'!../../packages/ug/**',
|
|
61
|
+
'!../../packages/granting/**',
|
|
62
|
+
'!../../packages/admissions/**',
|
|
63
|
+
'!../../packages/requests/**',
|
|
64
|
+
|
|
65
|
+
'!../../packages/z_pack/**',
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
hmr: {
|
|
69
|
+
overlay: true, // Display overlay in the browser for HMR errors
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// Build options
|
|
74
|
+
build: {
|
|
75
|
+
lib: {
|
|
76
|
+
// Could also be a dictionary or array of multiple entry points
|
|
77
|
+
entry: path.resolve(__dirname, 'src/StandaloneEntry.jsx'),
|
|
78
|
+
name: 'Dynamic',
|
|
79
|
+
// the proper extensions will be added
|
|
80
|
+
fileName: (format, name) => `${format}/${name}.js`,
|
|
81
|
+
formats: ['es', 'iife', 'umd']
|
|
82
|
+
// formats: ['es', 'umd']
|
|
83
|
+
},
|
|
84
|
+
rollupOptions: {
|
|
85
|
+
// input: {
|
|
86
|
+
// main: path.resolve(__dirname, 'library.html')
|
|
87
|
+
// },
|
|
88
|
+
// external: ['react', 'react-dom', '@reduxjs/toolkit'], // Prevent specific libraries from being bundled into the output
|
|
89
|
+
output: {
|
|
90
|
+
// Provide global variables to use in the UMD build
|
|
91
|
+
// for externalized deps
|
|
92
|
+
// globals: {
|
|
93
|
+
// "react": 'React',
|
|
94
|
+
// "react-dom": 'ReactDOM',
|
|
95
|
+
// "@reduxjs/toolkit": "RTK",
|
|
96
|
+
// // "react-bootstrap": "ReactBootstrap",
|
|
97
|
+
// // "process": 'JSON.parse("{env:{Node_ENV: ""}}")'
|
|
98
|
+
// },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
});
|