lincd-cli 0.1.13 → 0.1.14

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 (51) hide show
  1. package/defaults/app/src/App.scss +3 -0
  2. package/defaults/app/src/App.tsx +5 -0
  3. package/defaults/app/src/index.tsx +10 -0
  4. package/defaults/app/tsconfig.json +18 -0
  5. package/defaults/app2/backend/src/server.js +152 -0
  6. package/defaults/app2/backend/src/server.js.map +1 -0
  7. package/defaults/app2/backend/src/server.tsx +137 -0
  8. package/defaults/app2/frontend/src/App.js +52 -0
  9. package/defaults/app2/frontend/src/App.js.map +1 -0
  10. package/defaults/app2/frontend/src/App.tsx +35 -0
  11. package/defaults/app2/frontend/src/Html.js +12 -0
  12. package/defaults/app2/frontend/src/Html.js.map +0 -0
  13. package/defaults/app2/frontend/src/Html.tsx +29 -0
  14. package/defaults/app2/frontend/src/Layout.js +153 -0
  15. package/defaults/app2/frontend/src/Layout.js.map +1 -0
  16. package/defaults/app2/frontend/src/Layout.tsx +5 -0
  17. package/defaults/app2/frontend/src/Spinner.js +9 -0
  18. package/defaults/app2/frontend/src/Spinner.js.map +0 -0
  19. package/defaults/app2/frontend/src/Spinner.scss +17 -0
  20. package/defaults/app2/frontend/src/Spinner.tsx +10 -0
  21. package/defaults/app2/frontend/src/index.js +14 -0
  22. package/defaults/app2/frontend/src/index.js.map +0 -0
  23. package/defaults/app2/frontend/src/index.tsx +16 -0
  24. package/defaults/app2/tsconfig.json +17 -0
  25. package/defaults/app3/frontend/src/App.tsx +72 -0
  26. package/defaults/app3/frontend/src/Header.tsx +16 -0
  27. package/defaults/app3/frontend/src/Html.tsx +29 -0
  28. package/defaults/app3/frontend/src/Layout.tsx +11 -0
  29. package/defaults/app3/frontend/src/_tailwind.scss +3 -0
  30. package/defaults/app3/frontend/src/components/Spinner.scss +17 -0
  31. package/defaults/app3/frontend/src/components/Spinner.tsx +10 -0
  32. package/defaults/app3/frontend/src/index.tsx +20 -0
  33. package/defaults/app3/frontend/src/pages/Home.tsx +15 -0
  34. package/defaults/app3/frontend/src/pages/Page1.scss +3 -0
  35. package/defaults/app3/frontend/src/pages/Page1.scss.json +1 -0
  36. package/defaults/app3/frontend/src/pages/Page1.tsx +15 -0
  37. package/defaults/app3/frontend/src/pages/Page2.scss +16 -0
  38. package/defaults/app3/frontend/src/pages/Page2.scss.json +1 -0
  39. package/defaults/app3/frontend/src/pages/Page2.tsx +21 -0
  40. package/defaults/app3/tsconfig.json +17 -0
  41. package/defaults/module/Gruntfile.js +16 -0
  42. package/defaults/module/src/components/ExampleComponent.tsx +20 -0
  43. package/defaults/module/src/data/example-ontology.json +20 -0
  44. package/defaults/module/src/data/example-ontology.json.d.ts +1 -0
  45. package/defaults/module/src/index.ts +7 -0
  46. package/defaults/module/src/module.ts +4 -0
  47. package/defaults/module/src/ontologies/example-ontology.ts +36 -0
  48. package/defaults/module/src/shapes/ExampleShapeClass.ts +29 -0
  49. package/defaults/module/tsconfig-es5.json +18 -0
  50. package/defaults/module/tsconfig.json +18 -0
  51. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ .app {
2
+ display:block;
3
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export function App()
3
+ {
4
+ return <div className="app">${name} - LINCD App</div>;
5
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import {createRoot} from 'react-dom/client';
3
+ import {App} from './App';
4
+
5
+ declare var document;
6
+ if (typeof document !== 'undefined') {
7
+ const container = document.getElementById('root');
8
+ const root = createRoot(container!);
9
+ root.render(<App></App>);
10
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "sourceMap": true,
5
+ "target": "es6",
6
+ "outDir": "lib",
7
+ "declaration": true,
8
+ "esModuleInterop": true,
9
+ "resolveJsonModule": true,
10
+ "downlevelIteration": true,
11
+ "experimentalDecorators": true,
12
+ "skipLibCheck": true,
13
+ "jsx": "react",
14
+ "baseUrl": "./",
15
+ "rootDir": "src"
16
+ },
17
+ "files": ["./src/index.tsx"]
18
+ }
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //not sure what this does, but removing it causes errors
7
+ // const babelRegister = require('@babel/register');
8
+ // babelRegister({
9
+ // ignore: [/[\\\/](frontend\/build|frontend\/lib|backend\/lib|node_modules)[\\\/]/],
10
+ // presets: [['react-app', {runtime: 'automatic'}]],
11
+ // plugins: ['@babel/transform-modules-commonjs'],
12
+ // });
13
+ //make sure nodejs doesn't choke when css files are imported in js
14
+ const ignore_styles_1 = __importDefault(require("ignore-styles"));
15
+ (0, ignore_styles_1.default)(['.sass', '.scss', '.css']);
16
+ const node_fetch_1 = __importDefault(require("node-fetch"));
17
+ const body_parser_1 = __importDefault(require("body-parser"));
18
+ const fs_1 = __importDefault(require("fs"));
19
+ globalThis.fetch = node_fetch_1.default;
20
+ const express = require('express');
21
+ const compress = require('compression');
22
+ const { readFileSync } = require('fs');
23
+ const path = require('path');
24
+ const render_1 = __importDefault(require("./render"));
25
+ const JSONWriter_1 = require("lincd-jsonld/lib/JSONWriter");
26
+ const Schema_1 = require("lincd-graphql/lib/shapes/Schema");
27
+ const GraphQLParser_1 = require("lincd-graphql/lib/GraphQLParser");
28
+ const JSONLDWriter_1 = require("lincd-jsonld/lib/JSONLDWriter");
29
+ const PORT = process.env.PORT || 4000;
30
+ const app = express();
31
+ const REGISTRY_URL = process.env.REGISTRY_URL;
32
+ //does this compress things with gzip?
33
+ app.use(compress());
34
+ app.use(body_parser_1.default.json());
35
+ // app.use(bodyParser.urlencoded({extended: true}));
36
+ app.use('/static', express.static('./frontend/web'));
37
+ app.use('/images', express.static('./frontend/web/images'));
38
+ app.use('/css', express.static('./frontend/web/css'));
39
+ app.use('/js', express.static('./frontend/build'));
40
+ app.get('*', handleErrors(async function (req, res) {
41
+ //make sure the frontend bundle has finished building
42
+ await waitForWebpack();
43
+ (0, render_1.default)(req.url, res);
44
+ }));
45
+ //reject any requests that are not from localhost
46
+ function localOnly(req, res, next) {
47
+ var hostmachine = req.headers.host.split(':')[0];
48
+ if (hostmachine !== 'localhost' && hostmachine !== 'dev.lincd.org' && hostmachine !== 'www.lincd.org') {
49
+ return res.send(401);
50
+ }
51
+ next();
52
+ }
53
+ const sendJson = async function (res, obj) {
54
+ let json = await JSONWriter_1.JSONWriter.stringify(obj, true);
55
+ // console.log('Sending data...', json);
56
+ res.send(json);
57
+ };
58
+ /**
59
+ * Handles data requests from the frontend and sends them off to the registry.
60
+ * We don't expose the registry through a URL. instead we always access it on the local network from the backend.
61
+ */
62
+ app.post('/request/*', async (req, res) => {
63
+ let url = REGISTRY_URL + req.url.substr('/request'.length);
64
+ let body = req.body;
65
+ // if(Object.keys(body).length === 0)
66
+ // {
67
+ // console.warn("Empty body");
68
+ // console.warn('Content type :'+req.headers['content-type']);
69
+ // res.send(false);
70
+ // return;
71
+ // }
72
+ return (0, node_fetch_1.default)(url, {
73
+ method: 'POST',
74
+ headers: {
75
+ Accept: 'application/json, text/plain, */*',
76
+ 'Content-Type': 'application/json',
77
+ },
78
+ body: JSON.stringify(body),
79
+ })
80
+ .then((res) => {
81
+ if (!res.ok) {
82
+ throw new Error(url + ' returned ' + res.status + ' - ' + res.statusText);
83
+ }
84
+ return res.json();
85
+ })
86
+ .then((jsonObject) => {
87
+ sendJson(res, jsonObject);
88
+ })
89
+ .catch((err) => {
90
+ console.warn('error during internal registry request to ' + url + ': ', err);
91
+ });
92
+ });
93
+ app.post('/api/tools/graphql', async (req, res) => {
94
+ let { url, headers } = req.body;
95
+ // let parser = new GraphQLParser(url);
96
+ let parseResult = await GraphQLParser_1.GraphQLParser.parseSchema(url, headers); //parser.parseSchema();
97
+ if (parseResult instanceof Schema_1.Schema) {
98
+ let rawJSONLD = await JSONLDWriter_1.JSONLDWriter.toJSONObject([parseResult.node, parseResult.publicShapes]);
99
+ fs_1.default.writeFile(path.join('../tmp', url.replace(/[^a-z0-9]+/gi, '-') + '.json'), JSON.stringify(rawJSONLD, null, 2), (err) => {
100
+ console.log(err);
101
+ });
102
+ }
103
+ sendJson(res, parseResult instanceof Schema_1.Schema ? parseResult.node : parseResult);
104
+ // if (type === owl.Ontology) {
105
+ // sendJson(res, instances);
106
+ });
107
+ app
108
+ .listen(PORT, () => {
109
+ console.log(`Up and running at http://localhost:${PORT}`);
110
+ })
111
+ .on('error', function (error) {
112
+ if (error.syscall !== 'listen') {
113
+ throw error;
114
+ }
115
+ const isPipe = (portOrPipe) => Number.isNaN(portOrPipe);
116
+ const bind = isPipe(PORT) ? 'Pipe ' + PORT : 'Port ' + PORT;
117
+ switch (error.code) {
118
+ case 'EACCES':
119
+ console.error(bind + ' requires elevated privileges');
120
+ process.exit(1);
121
+ break;
122
+ case 'EADDRINUSE':
123
+ console.error(bind + ' is already in use');
124
+ process.exit(1);
125
+ break;
126
+ default:
127
+ throw error;
128
+ }
129
+ });
130
+ function handleErrors(fn) {
131
+ return async function (req, res, next) {
132
+ try {
133
+ return await fn(req, res);
134
+ }
135
+ catch (x) {
136
+ next(x);
137
+ }
138
+ };
139
+ }
140
+ async function waitForWebpack() {
141
+ while (true) {
142
+ try {
143
+ readFileSync(path.resolve(__dirname, '../../frontend/build/main.js'));
144
+ return;
145
+ }
146
+ catch (err) {
147
+ console.log('Could not find webpack build output. Will retry in a second...');
148
+ await new Promise((resolve) => setTimeout(resolve, 1000));
149
+ }
150
+ }
151
+ }
152
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["server.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AAEb,wDAAwD;AACxD,oDAAoD;AACpD,kBAAkB;AAClB,sFAAsF;AACtF,qDAAqD;AACrD,mDAAmD;AACnD,MAAM;AAEN,kEAAkE;AAClE,kEAA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AAE,IAAI;QACnC,IAAI;YACF,OAAO,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SAC3B;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,CAAC,CAAC,CAAC;SACT;IACH,CAAC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,cAAc;IAC3B,OAAO,IAAI,EAAE;QACX,IAAI;YACF,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,8BAA8B,CAAC,CAAC,CAAC;YACtE,OAAO;SACR;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;YAC9E,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;SAC3D;KACF;AACH,CAAC"}
@@ -0,0 +1,137 @@
1
+ 'use strict';
2
+
3
+ //prevent errors in node.js when (s)css files are imported in js
4
+ import register from 'ignore-styles';
5
+ import fetch from 'node-fetch';
6
+ import bodyParser from 'body-parser';
7
+
8
+ import {JSONWriter} from 'lincd-jsonld/lib/utils/JSONWriter';
9
+ import * as React from 'react';
10
+ import {renderToPipeableStream} from 'react-dom/server';
11
+ import App from '../../frontend/src/App';
12
+ import {StaticRouter} from 'react-router-dom/server';
13
+
14
+ register(['.sass', '.scss', '.css']);
15
+
16
+ declare var globalThis: any;
17
+ globalThis.fetch = fetch;
18
+
19
+ const express = require('express');
20
+ const compress = require('compression');
21
+ const {readFileSync} = require('fs');
22
+ const path = require('path');
23
+
24
+ let assets = {
25
+ 'main.js': '/js/main.js', //output js bundle from Webpack of frontend/src
26
+ 'main.css': '/js/main.css', //output css from Webpack of frontend/src
27
+ };
28
+
29
+ const isProduction = process.env.NODE_ENV === 'production';
30
+ if (!isProduction) {
31
+ assets['tailwind-cdn'] = 'https://cdn.tailwindcss.com';
32
+ }
33
+
34
+ const PORT = process.env.PORT || 4000;
35
+ const app = express();
36
+
37
+ //compress server output with gzip
38
+ app.use(compress());
39
+ app.use(bodyParser.json());
40
+
41
+ app.use('/static', express.static('./frontend/web'));
42
+ app.use('/images', express.static('./frontend/web/images'));
43
+ app.use('/css', express.static('./frontend/web/css'));
44
+ app.use('/js', express.static('./frontend/build'));
45
+
46
+ app.get(
47
+ '*',
48
+ handleErrors(async function (req, res) {
49
+ //make sure the frontend bundle has finished building
50
+ await waitForWebpack();
51
+ render(req.url, res);
52
+ }),
53
+ );
54
+
55
+ const sendJson = async function (res, obj) {
56
+ let json = await JSONWriter.stringify(obj, true);
57
+ res.send(json);
58
+ };
59
+
60
+ app
61
+ .listen(PORT, () => {
62
+ console.log(`Up and running at http://localhost:${PORT}`);
63
+ })
64
+ .on('error', function (error) {
65
+ if (error.syscall !== 'listen') {
66
+ throw error;
67
+ }
68
+ const isPipe = (portOrPipe) => Number.isNaN(portOrPipe);
69
+ const bind = isPipe(PORT) ? 'Pipe ' + PORT : 'Port ' + PORT;
70
+ switch (error.code) {
71
+ case 'EACCES':
72
+ console.error(bind + ' requires elevated privileges');
73
+ process.exit(1);
74
+ break;
75
+ case 'EADDRINUSE':
76
+ console.error(bind + ' is already in use');
77
+ process.exit(1);
78
+ break;
79
+ default:
80
+ throw error;
81
+ }
82
+ });
83
+
84
+ function handleErrors(fn) {
85
+ return async function (req, res, next) {
86
+ try {
87
+ return await fn(req, res);
88
+ } catch (x) {
89
+ next(x);
90
+ }
91
+ };
92
+ }
93
+
94
+ async function waitForWebpack() {
95
+ while (true) {
96
+ try {
97
+ readFileSync(path.resolve(__dirname, '../../frontend/build/main.js'));
98
+ return;
99
+ } catch (err) {
100
+ console.log('Could not find webpack build output. Will retry in a second...');
101
+ await new Promise((resolve) => setTimeout(resolve, 1000));
102
+ }
103
+ }
104
+ }
105
+
106
+ function render(url, res) {
107
+ res.socket.on('error', (error) => {
108
+ console.error('Fatal', error);
109
+ });
110
+ let didError = false;
111
+
112
+ const stream = renderToPipeableStream(
113
+ <React.StrictMode>
114
+ <StaticRouter location={url}>
115
+ <App assets={assets} />
116
+ </StaticRouter>
117
+ </React.StrictMode>,
118
+ {
119
+ bootstrapScripts: [
120
+ assets['main.js'], //generated webpack bundle from frontend/src
121
+ ],
122
+ onShellReady() {
123
+ // If something errored before we started streaming, we set the error code appropriately.
124
+ res.statusCode = didError ? 500 : 200;
125
+ res.setHeader('Content-type', 'text/html');
126
+ stream.pipe(res);
127
+ },
128
+ onError(x) {
129
+ didError = true;
130
+ console.error(x);
131
+ },
132
+ },
133
+ );
134
+ // Abandon and switch to client rendering if enough time passes.
135
+ // Try lowering this to see the client recover.
136
+ setTimeout(() => stream.abort(), 10000);
137
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const jsx_runtime_1 = require("react/jsx-runtime");
30
+ const react_1 = require("react");
31
+ const react_error_boundary_1 = require("react-error-boundary");
32
+ const Html_1 = __importDefault(require("./Html"));
33
+ const Spinner_1 = __importDefault(require("./Spinner"));
34
+ const Layout_1 = __importDefault(require("./Layout"));
35
+ const react_router_dom_1 = require("react-router-dom");
36
+ const MappingTools_1 = require("./MappingTools");
37
+ const Browse = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./Browse' /* webpackPrefetch: true */))));
38
+ const Docs = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./Docs' /* webpackPrefetch: true */))));
39
+ const Academy = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./Academy' /* webpackPrefetch: true */))));
40
+ const Home = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./Home' /* webpackPrefetch: true */))));
41
+ function App({ assets = typeof window !== 'undefined' ? window['assetManifest'] : {} }) {
42
+ return ((0, jsx_runtime_1.jsx)(Html_1.default, { assets: assets, title: "LINCD - Linked Interoperable Code & Data", children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Spinner_1.default, {}), children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: Error, children: (0, jsx_runtime_1.jsx)(Content, {}) }) }) }));
43
+ }
44
+ exports.default = App;
45
+ function Content() {
46
+ let [sidebarIsOpen, setSidebarisOpen] = (0, react_1.useState)(false);
47
+ return ((0, jsx_runtime_1.jsx)(Layout_1.default, { sidebarIsOpen: sidebarIsOpen, setSidebarIsOpen: setSidebarisOpen, children: (0, jsx_runtime_1.jsx)("div", { className: "content", children: (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "/", element: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Spinner_1.default, {}), children: (0, jsx_runtime_1.jsx)(Home, {}) }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "/browse/*", element: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Spinner_1.default, {}), children: (0, jsx_runtime_1.jsx)(Browse, { sidebarIsOpen: sidebarIsOpen }) }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "/browse/mapping-tools", element: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Spinner_1.default, {}), children: (0, jsx_runtime_1.jsx)(MappingTools_1.MappingTools, {}) }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "/academy", element: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Spinner_1.default, {}), children: (0, jsx_runtime_1.jsx)(Academy, {}) }) })] }) }) }));
48
+ }
49
+ function Error({ error }) {
50
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { color: 'white', margin: '2rem' }, children: [(0, jsx_runtime_1.jsx)("h1", { children: "Application Error" }), (0, jsx_runtime_1.jsx)("pre", { style: { whiteSpace: 'pre-wrap', padding: '1rem' }, children: error.stack })] }));
51
+ }
52
+ //# sourceMappingURL=App.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.js","sourceRoot":"","sources":["App.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA+C;AAC/C,+DAAmD;AACnD,kDAA0B;AAC1B,wDAAgC;AAChC,sDAA8B;AAC9B,uDAA+C;AAC/C,iDAA4C;AAE5C,MAAM,MAAM,GAAG,IAAA,YAAI,EAAC,GAAG,EAAE,mDAAQ,UAAU,CAAC,2BAA2B,GAAC,CAAC,CAAC;AAC1E,MAAM,IAAI,GAAG,IAAA,YAAI,EAAC,GAAG,EAAE,mDAAQ,QAAQ,CAAC,2BAA2B,GAAC,CAAC,CAAC;AACtE,MAAM,OAAO,GAAG,IAAA,YAAI,EAAC,GAAG,EAAE,mD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,iBAAO,KAAG,YAC7B,uBAAC,2BAAY,KAAG,GACP,GAEb,EACF,uBAAC,wBAAK,IACJ,IAAI,EAAC,UAAU,EACf,OAAO,EACL,uBAAC,gBAAQ,IAAC,QAAQ,EAAE,uBAAC,iBAAO,KAAG,YAC7B,uBAAC,OAAO,KAAG,GACF,GAEb,IACK,GACL,GACC,CACV,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,EAAC,KAAK,EAAC;IACpB,OAAO,CACL,iCAAK,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAC,aAC1C,+DAA0B,EAC1B,gCAAK,KAAK,EAAE,EAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAC,YAAG,KAAK,CAAC,KAAK,GAAO,IACtE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ import {lazy, Suspense} from 'react';
2
+ import {ErrorBoundary} from 'react-error-boundary';
3
+ import Html from './Html';
4
+ import Spinner from './Spinner';
5
+ import Layout from './Layout';
6
+
7
+ declare var window;
8
+ export default function App({assets = typeof window !== 'undefined' ? window['assetManifest'] : {}}) {
9
+ return (
10
+ <Html assets={assets} title="${name} - LINCD App">
11
+ <Suspense fallback={<Spinner />}>
12
+ <ErrorBoundary FallbackComponent={Error}>
13
+ <Content />
14
+ </ErrorBoundary>
15
+ </Suspense>
16
+ </Html>
17
+ );
18
+ }
19
+
20
+ function Content() {
21
+ return (
22
+ <Layout>
23
+ <div>${name} - LINCD App</div>
24
+ </Layout>
25
+ );
26
+ }
27
+
28
+ function Error({error}) {
29
+ return (
30
+ <div style={{color: 'white', margin: '2rem'}}>
31
+ <h1>Application Error</h1>
32
+ <pre style={{whiteSpace: 'pre-wrap', padding: '1rem'}}>{error.stack}</pre>
33
+ </div>
34
+ );
35
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ function Html({ assets, children, title }) {
5
+ return ((0, jsx_runtime_1.jsxs)("html", { lang: "en", children: [(0, jsx_runtime_1.jsxs)("head", { children: [(0, jsx_runtime_1.jsx)("meta", { charSet: "utf-8" }), (0, jsx_runtime_1.jsx)("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), (0, jsx_runtime_1.jsx)("link", { rel: "shortcut icon", href: "/static/favicon.ico" }), (0, jsx_runtime_1.jsx)("link", { rel: "stylesheet", href: assets['webpack.css'] }), (0, jsx_runtime_1.jsx)("title", { children: title })] }), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)("noscript", { dangerouslySetInnerHTML: {
6
+ __html: `<b>Enable JavaScript to run this app.</b>`,
7
+ } }), children, (0, jsx_runtime_1.jsx)("script", { dangerouslySetInnerHTML: {
8
+ __html: `assetManifest = ${JSON.stringify(assets)};`,
9
+ } })] })] }));
10
+ }
11
+ exports.default = Html;
12
+ //# sourceMappingURL=Html.js.map
File without changes
@@ -0,0 +1,29 @@
1
+ export default function Html({assets, children, title}) {
2
+ return (
3
+ <html lang="en">
4
+ <head>
5
+ <meta charSet="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <link rel="shortcut icon" href="/static/favicon.ico" />
8
+ <link rel="stylesheet" href={assets['main.css']} />
9
+ {assets['tailwind-cdn'] && (
10
+ <script src={assets['tailwind-cdn']}></script>
11
+ )}
12
+ <title>{title}</title>
13
+ </head>
14
+ <body>
15
+ <noscript
16
+ dangerouslySetInnerHTML={{
17
+ __html: `<b>Enable JavaScript to run this app.</b>`,
18
+ }}
19
+ />
20
+ {children}
21
+ <script
22
+ dangerouslySetInnerHTML={{
23
+ __html: `assetManifest = ${JSON.stringify(assets)};`,
24
+ }}
25
+ />
26
+ </body>
27
+ </html>
28
+ );
29
+ }
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const NavBar_1 = __importDefault(require("./NavBar"));
8
+ const react_1 = require("react");
9
+ const Sidebar_1 = __importDefault(require("./Sidebar"));
10
+ const Spinner_1 = __importDefault(require("./Spinner"));
11
+ const react_router_dom_1 = require("react-router-dom");
12
+ const useWindowSize_1 = require("./hooks/useWindowSize");
13
+ const registry_1 = require("./hooks/registry");
14
+ const lincd_1 = require("lincd-modules/lib/ontologies/lincd");
15
+ const rdfs_1 = require("lincd-rdfs/lib/ontologies/rdfs");
16
+ const dcterms_1 = require("lincd-dcmi/lib/ontologies/dcterms");
17
+ const dc_1 = require("lincd-dcmi/lib/ontologies/dc");
18
+ const async_1 = __importDefault(require("react-select/async"));
19
+ const Shape_1 = require("lincd/lib/shapes/Shape");
20
+ const Component_1 = require("lincd-modules/lib/shapes/Component");
21
+ const Module_1 = require("lincd-modules/lib/shapes/Module");
22
+ const OntologyFile_1 = require("lincd-modules/lib/shapes/OntologyFile");
23
+ const npm_1 = require("lincd-npm/lib/ontologies/npm");
24
+ const Ontology_1 = require("lincd-owl/lib/shapes/Ontology");
25
+ const react_2 = __importDefault(require("react"));
26
+ class MenuOption {
27
+ }
28
+ function Layout({ sidebarIsOpen, setSidebarIsOpen, children }) {
29
+ //sidebar will behave differently from this size, see scss
30
+ let sidebarBreakpoint = 768 + 1;
31
+ let adjustContentWidthBasedOnSidebar = function (width = typeof window !== 'undefined' ? window.innerWidth : undefined) {
32
+ return typeof width && width > sidebarBreakpoint;
33
+ };
34
+ let { width } = (0, useWindowSize_1.useWindowSize)();
35
+ (0, react_1.useEffect)(() => {
36
+ setSidebarIsOpen(adjustContentWidthBasedOnSidebar(width));
37
+ }, [width]);
38
+ let navigate = (0, react_router_dom_1.useNavigate)();
39
+ let processChange = debounce((value, callback) => searchRegistry(value, navigate).then((res) => callback(res)));
40
+ let searchBarRef;
41
+ if (!searchBarRef) {
42
+ searchBarRef = react_2.default.createRef();
43
+ }
44
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "wrapper landing-page", children: (0, jsx_runtime_1.jsx)("div", { className: "dashboard", children: (0, jsx_runtime_1.jsx)("header", { children: (0, jsx_runtime_1.jsxs)("div", { className: 'search-bar' + (sidebarIsOpen ? ' small' : ''), children: [(0, jsx_runtime_1.jsx)(async_1.default, { cacheOptions: true, ref: searchBarRef, id: "lincd-search", loadingMessage: (searchBar) => `Searching for '${searchBar.inputValue}'`, noOptionsMessage: (searchBar) => searchBar.inputValue.length == 0
45
+ ? 'Start typing to search the registry!'
46
+ : `No results found for '${searchBar.inputValue}'`, loadOptions: (searchQuery, callback) => {
47
+ processChange(searchQuery, callback);
48
+ }, placeholder: "Search LINCD...", onChange: (option) => {
49
+ option.navigate();
50
+ searchBarRef['current'].select.clearValue();
51
+ }, onKeyDown: (e) => {
52
+ let target = e.target;
53
+ switch (e.key) {
54
+ case 'Home':
55
+ e.preventDefault();
56
+ if (e.shiftKey) {
57
+ target.selectionStart = 0;
58
+ }
59
+ else {
60
+ target.setSelectionRange(0, 0);
61
+ }
62
+ break;
63
+ case 'End':
64
+ e.preventDefault();
65
+ const len = target.value.length;
66
+ if (e.shiftKey) {
67
+ target.selectionEnd = len;
68
+ }
69
+ else {
70
+ target.setSelectionRange(len, len);
71
+ }
72
+ break;
73
+ }
74
+ }, styles: {
75
+ control: (provided) => ({
76
+ ...provided,
77
+ backgroundColor: 'rgba(0, 0, 0, 0)',
78
+ borderWidth: '0',
79
+ cursor: 'text',
80
+ }),
81
+ menu: (provided) => ({
82
+ ...provided,
83
+ backgroundColor: '#1e1f26',
84
+ padding: '0 1% 0 0',
85
+ margin: '0 1% 0 0',
86
+ width: 'calc(100% - 50px)',
87
+ }),
88
+ input: (provided) => ({
89
+ ...provided,
90
+ color: 'white',
91
+ }),
92
+ option: (provided, state) => ({
93
+ ...provided,
94
+ backgroundColor: state.isSelected || state.isFocused ? '#5a5f72' : '#1e1f26',
95
+ })
96
+ } }), (0, jsx_runtime_1.jsx)("img", { src: "/images/search.svg", alt: "" })] }) }) }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("aside", { className: 'sidenav ' + (sidebarIsOpen ? 'active-aside' : 'closed'), children: (0, jsx_runtime_1.jsxs)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Spinner_1.default, {}), children: [(0, jsx_runtime_1.jsx)(Sidebar_1.default, { setSidebarIsOpen: setSidebarIsOpen, sidebarIsOpen: sidebarIsOpen, sidebarBreakpoint: sidebarBreakpoint }), (0, jsx_runtime_1.jsx)(NavBar_1.default, {})] }) }) }), (0, jsx_runtime_1.jsxs)("main", { style: sidebarIsOpen && adjustContentWidthBasedOnSidebar()
97
+ ? {
98
+ width: 'calc(100vw - 220px)', // minus sidebar
99
+ }
100
+ : {
101
+ width: '100%',
102
+ }, children: [children, (0, jsx_runtime_1.jsx)("div", { style: {
103
+ display: 'flex',
104
+ marginTop: '200px',
105
+ }, children: (0, jsx_runtime_1.jsx)("footer", { style: { width: '100%' }, children: (0, jsx_runtime_1.jsxs)("div", { className: "container flex align-items-center ", children: [(0, jsx_runtime_1.jsxs)("a", { href: "https://twitter.com/lincd_org", target: "_blank", className: "flex align-items-center", children: [(0, jsx_runtime_1.jsx)("svg", { enableBackground: "new 0 0 56.693 56.693", height: "80px", id: "Layer_1", version: "1.1", viewBox: "0 0 56.693 56.693", width: "56.693px", xmlSpace: "preserve", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", children: (0, jsx_runtime_1.jsx)("path", { d: "M52.837,15.065c-1.811,0.805-3.76,1.348-5.805,1.591c2.088-1.25,3.689-3.23,4.444-5.592c-1.953,1.159-4.115,2-6.418,2.454 c-1.843-1.964-4.47-3.192-7.377-3.192c-5.581,0-10.106,4.525-10.106,10.107c0,0.791,0.089,1.562,0.262,2.303 c-8.4-0.422-15.848-4.445-20.833-10.56c-0.87,1.492-1.368,3.228-1.368,5.082c0,3.506,1.784,6.6,4.496,8.412 c-1.656-0.053-3.215-0.508-4.578-1.265c-0.001,0.042-0.001,0.085-0.001,0.128c0,4.896,3.484,8.98,8.108,9.91 c-0.848,0.23-1.741,0.354-2.663,0.354c-0.652,0-1.285-0.063-1.902-0.182c1.287,4.015,5.019,6.938,9.441,7.019 c-3.459,2.711-7.816,4.327-12.552,4.327c-0.815,0-1.62-0.048-2.411-0.142c4.474,2.869,9.786,4.541,15.493,4.541 c18.591,0,28.756-15.4,28.756-28.756c0-0.438-0.009-0.875-0.028-1.309C49.769,18.873,51.483,17.092,52.837,15.065z" }) }), ' ', "\u00A0 Tweet your work"] }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Link, { to: "/academy", children: (0, jsx_runtime_1.jsx)("button", { className: "btn-blue-outline", children: "Join us" }) }), (0, jsx_runtime_1.jsxs)("a", { href: "https://discord.gg/2PFnf7udET", target: "_blank", className: "flex align-items-center discord-footer", children: [(0, jsx_runtime_1.jsxs)("svg", { width: "40", viewBox: "0 0 20 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("g", { clipPath: "url(#clip0_1892_3407)", children: (0, jsx_runtime_1.jsx)("g", { clipPath: "url(#clip1_1892_3407)", children: (0, jsx_runtime_1.jsx)("path", { d: "M16.5317 1.25625C15.2774 0.669375 13.9362 0.242861 12.534 0C12.3618 0.311339 12.1606 0.730097 12.0219 1.06322C10.5313 0.839056 9.05449 0.839056 7.59134 1.06322C7.45266 0.730097 7.24691 0.311339 7.07316 0C5.66947 0.242861 4.32673 0.670942 3.0724 1.25935C0.542395 5.08252 -0.143448 8.81073 0.199474 12.486C1.87751 13.7391 3.50372 14.5003 5.10249 14.9985C5.49724 14.4552 5.84929 13.8777 6.15259 13.269C5.57496 13.0495 5.02171 12.7787 4.49896 12.4642C4.63765 12.3615 4.7733 12.254 4.90436 12.1435C8.09276 13.6348 11.557 13.6348 14.7074 12.1435C14.84 12.254 14.9756 12.3615 15.1128 12.4642C14.5885 12.7802 14.0337 13.0511 13.4561 13.2706C13.7594 13.8777 14.1099 14.4567 14.5062 15C16.1065 14.5019 17.7342 13.7407 19.4122 12.486C19.8146 8.22542 18.7249 4.53146 16.5317 1.25625ZM6.58696 10.2257C5.62984 10.2257 4.84491 9.3322 4.84491 8.2441C4.84491 7.15599 5.61307 6.26091 6.58696 6.26091C7.56088 6.26091 8.34577 7.15442 8.32901 8.2441C8.33052 9.3322 7.56088 10.2257 6.58696 10.2257ZM13.0248 10.2257C12.0676 10.2257 11.2827 9.3322 11.2827 8.2441C11.2827 7.15599 12.0508 6.26091 13.0248 6.26091C13.9986 6.26091 14.7836 7.15442 14.7668 8.2441C14.7668 9.3322 13.9986 10.2257 13.0248 10.2257Z", fill: "white" }) }) }), (0, jsx_runtime_1.jsxs)("defs", { children: [(0, jsx_runtime_1.jsx)("clipPath", { id: "clip0_1892_3407", children: (0, jsx_runtime_1.jsx)("rect", { width: "19.375", height: "15", fill: "white", transform: "translate(0.117188)" }) }), (0, jsx_runtime_1.jsx)("clipPath", { id: "clip1_1892_3407", children: (0, jsx_runtime_1.jsx)("rect", { width: "77.5", height: "15", fill: "white", transform: "translate(0.117188)" }) })] })] }), "\u00A0 Join the community"] })] }) }) })] })] }));
106
+ }
107
+ exports.default = Layout;
108
+ function debounce(func, timeout = 700) {
109
+ let timer;
110
+ return (...args) => {
111
+ clearTimeout(timer);
112
+ timer = setTimeout(() => {
113
+ func.apply(this, args);
114
+ }, timeout);
115
+ };
116
+ }
117
+ function searchRegistry(input, navigate) {
118
+ let searchTypes = [lincd_1.lincd.OntologyFile, lincd_1.lincd.Module, lincd_1.lincd.Component];
119
+ let results = (0, registry_1.fetchRegistry)(searchTypes, input).then(({ instances, registryURLs }) => {
120
+ console.log(registryURLs, instances);
121
+ return instances.map((instance) => {
122
+ let option = new MenuOption();
123
+ let resultShape;
124
+ let resultType;
125
+ option.label =
126
+ instance.getValue(dc_1.dcelems.title) ||
127
+ instance.getValue(dcterms_1.dcterms.title) ||
128
+ instance.getValue(lincd_1.lincd.prefix) ||
129
+ instance.getValue(rdfs_1.rdfs.label) ||
130
+ instance.getValue(npm_1.npm.packageName) ||
131
+ instance.getValue(lincd_1.lincd.npmPath);
132
+ resultShape = Shape_1.Shape.getInstanceByType(instance, Module_1.Module, OntologyFile_1.OntologyFile, Component_1.Component, Ontology_1.Ontology);
133
+ if (resultShape instanceof OntologyFile_1.OntologyFile) {
134
+ resultType = 'Ontology';
135
+ }
136
+ else if (resultShape instanceof Component_1.Component) {
137
+ resultType = 'Component';
138
+ }
139
+ else if (resultShape instanceof Module_1.Module) {
140
+ resultType = 'Module';
141
+ }
142
+ option.navigate = () => {
143
+ // Finding corresponding index of the current instance in the registryURLs
144
+ // array, since they will be in the same order
145
+ navigate(registryURLs[[...instances].indexOf(instance)]);
146
+ };
147
+ option.label = `${resultType} | ${option.label}`;
148
+ return option;
149
+ });
150
+ });
151
+ return results;
152
+ }
153
+ //# sourceMappingURL=Layout.js.map