lincd-cli 1.1.11 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/defaults/app-static/.env-cmdrc.json +17 -0
  2. package/defaults/app-static/package.json +8 -0
  3. package/defaults/app-static/src/index-static.tsx +3 -3
  4. package/defaults/app-with-backend/.env-cmdrc.json +1 -4
  5. package/defaults/app-with-backend/.eslintignore +3 -1
  6. package/defaults/app-with-backend/lincd.config.js +1 -3
  7. package/defaults/app-with-backend/package.json +11 -21
  8. package/defaults/app-with-backend/scripts/storage-config.js +6 -6
  9. package/defaults/app-with-backend/src/App.module.css +17 -0
  10. package/defaults/app-with-backend/src/App.tsx +11 -15
  11. package/defaults/app-with-backend/src/backend.ts +8 -0
  12. package/defaults/app-with-backend/src/components/Error.tsx +2 -5
  13. package/defaults/app-with-backend/src/components/Spinner.tsx +3 -3
  14. package/defaults/app-with-backend/src/config-frontend.ts +6 -6
  15. package/defaults/app-with-backend/src/index.tsx +1 -0
  16. package/defaults/app-with-backend/src/layout/DefaultLayout.module.css +12 -0
  17. package/defaults/app-with-backend/src/layout/DefaultLayout.tsx +3 -4
  18. package/defaults/app-with-backend/src/layout/Header.module.css +25 -0
  19. package/defaults/app-with-backend/src/layout/Header.tsx +10 -6
  20. package/defaults/app-with-backend/src/package.ts +1 -3
  21. package/defaults/app-with-backend/src/pages/Home.tsx +2 -3
  22. package/defaults/app-with-backend/src/routes.tsx +8 -7
  23. package/defaults/app-with-backend/src/theme.css +100 -0
  24. package/defaults/app-with-backend/tsconfig.json +8 -5
  25. package/defaults/component.tsx +1 -3
  26. package/defaults/package/package.json +2 -2
  27. package/defaults/package/src/index.ts +1 -0
  28. package/defaults/package/src/ontologies/example-ontology.ts +10 -3
  29. package/defaults/package/src/package.ts +11 -3
  30. package/defaults/package/src/types.d.ts +9 -0
  31. package/defaults/package/tsconfig-cjs.json +8 -0
  32. package/defaults/package/tsconfig-esm.json +9 -0
  33. package/defaults/set-component.tsx +2 -5
  34. package/defaults/shape.ts +2 -2
  35. package/lib/{cli-methods.js → cjs/cli-methods.js} +779 -322
  36. package/lib/cjs/cli-methods.js.map +1 -0
  37. package/lib/cjs/cli.js +208 -0
  38. package/lib/cjs/cli.js.map +1 -0
  39. package/lib/cjs/config-grunt.cjs +276 -0
  40. package/lib/cjs/config-grunt.cjs.map +1 -0
  41. package/lib/cjs/config-webpack-app.js +495 -0
  42. package/lib/cjs/config-webpack-app.js.map +1 -0
  43. package/lib/cjs/config-webpack.js +444 -0
  44. package/lib/cjs/config-webpack.js.map +1 -0
  45. package/lib/{index.js → cjs/index.js} +5 -5
  46. package/lib/cjs/index.js.map +1 -0
  47. package/lib/{interfaces.js.map → cjs/interfaces.js.map} +1 -1
  48. package/lib/cjs/loaders/css-loader.mjs +86 -0
  49. package/lib/cjs/loaders/css-loader.mjs.map +1 -0
  50. package/lib/cjs/loaders/register.js +11 -0
  51. package/lib/cjs/loaders/register.js.map +1 -0
  52. package/lib/cjs/metadata.js +155 -0
  53. package/lib/cjs/metadata.js.map +1 -0
  54. package/lib/cjs/package.json +141 -0
  55. package/lib/{plugins → cjs/plugins}/check-imports.js +1 -1
  56. package/lib/cjs/plugins/check-imports.js.map +1 -0
  57. package/lib/cjs/plugins/declaration-plugin.js +285 -0
  58. package/lib/cjs/plugins/declaration-plugin.js.map +1 -0
  59. package/lib/cjs/plugins/externalise-modules.js +190 -0
  60. package/lib/cjs/plugins/externalise-modules.js.map +1 -0
  61. package/lib/cjs/plugins/lincd-tailwind-sources.js +32 -0
  62. package/lib/cjs/plugins/lincd-tailwind-sources.js.map +1 -0
  63. package/lib/cjs/plugins/watch-run.js.map +1 -0
  64. package/lib/cjs/tailwind.config.js +18 -0
  65. package/lib/cjs/tailwind.config.js.map +1 -0
  66. package/lib/{utils.js → cjs/utils.js} +112 -52
  67. package/lib/cjs/utils.js.map +1 -0
  68. package/lib/esm/cli-methods.js +2045 -0
  69. package/lib/esm/cli-methods.js.map +1 -0
  70. package/lib/{cli.js → esm/cli.js} +65 -44
  71. package/lib/esm/cli.js.map +1 -0
  72. package/lib/{config-grunt.js → esm/config-grunt.cjs} +15 -16
  73. package/lib/esm/config-grunt.cjs.map +1 -0
  74. package/lib/esm/config-webpack-app.js +460 -0
  75. package/lib/esm/config-webpack-app.js.map +1 -0
  76. package/lib/{config-webpack.js → esm/config-webpack.js} +37 -50
  77. package/lib/esm/config-webpack.js.map +1 -0
  78. package/lib/esm/index.js +10 -0
  79. package/lib/esm/index.js.map +1 -0
  80. package/lib/esm/interfaces.js +2 -0
  81. package/lib/esm/interfaces.js.map +1 -0
  82. package/lib/esm/loaders/css-loader.mjs +86 -0
  83. package/lib/esm/loaders/css-loader.mjs.map +1 -0
  84. package/lib/esm/loaders/register.js +9 -0
  85. package/lib/esm/loaders/register.js.map +1 -0
  86. package/lib/esm/metadata.js +155 -0
  87. package/lib/esm/metadata.js.map +1 -0
  88. package/lib/esm/package.json +141 -0
  89. package/lib/esm/plugins/check-imports.js +65 -0
  90. package/lib/esm/plugins/check-imports.js.map +1 -0
  91. package/lib/{plugins → esm/plugins}/declaration-plugin.js +9 -8
  92. package/lib/esm/plugins/declaration-plugin.js.map +1 -0
  93. package/lib/{plugins → esm/plugins}/externalise-modules.js +5 -6
  94. package/lib/esm/plugins/externalise-modules.js.map +1 -0
  95. package/lib/esm/plugins/lincd-tailwind-sources.js +27 -0
  96. package/lib/esm/plugins/lincd-tailwind-sources.js.map +1 -0
  97. package/lib/esm/plugins/watch-run.js +44 -0
  98. package/lib/esm/plugins/watch-run.js.map +1 -0
  99. package/lib/esm/tailwind.config.js +13 -0
  100. package/lib/esm/tailwind.config.js.map +1 -0
  101. package/lib/esm/utils.js +521 -0
  102. package/lib/esm/utils.js.map +1 -0
  103. package/lib-template/cjs/package.json +3 -0
  104. package/lib-template/esm/package.json +3 -0
  105. package/package.json +64 -24
  106. package/tsconfig-cjs.json +9 -0
  107. package/tsconfig-esm.json +10 -0
  108. package/defaults/app-with-backend/babel.config.js +0 -4
  109. package/defaults/app-with-backend/src/App.scss +0 -6
  110. package/defaults/app-with-backend/src/App.scss.json +0 -1
  111. package/defaults/app-with-backend/src/components/Error.scss.json +0 -1
  112. package/defaults/app-with-backend/src/components/Spinner.scss.json +0 -1
  113. package/defaults/app-with-backend/src/layout/DefaultLayout.scss +0 -6
  114. package/defaults/app-with-backend/src/layout/DefaultLayout.scss.json +0 -1
  115. package/defaults/app-with-backend/src/layout/Header.scss +0 -10
  116. package/defaults/app-with-backend/src/layout/Header.scss.json +0 -1
  117. package/defaults/app-with-backend/src/pages/Home.scss.json +0 -1
  118. package/defaults/app-with-backend/src/scss/global-overwrites.scss +0 -11
  119. package/defaults/app-with-backend/src/scss/variables.scss +0 -23
  120. package/lib/cli-methods.js.map +0 -1
  121. package/lib/cli.js.map +0 -1
  122. package/lib/config-grunt.js.map +0 -1
  123. package/lib/config-webpack-app.js +0 -367
  124. package/lib/config-webpack-app.js.map +0 -1
  125. package/lib/config-webpack.js.map +0 -1
  126. package/lib/index.js.map +0 -1
  127. package/lib/metadata.js +0 -149
  128. package/lib/metadata.js.map +0 -1
  129. package/lib/plugins/check-imports.js.map +0 -1
  130. package/lib/plugins/declaration-plugin.js.map +0 -1
  131. package/lib/plugins/externalise-modules.js.map +0 -1
  132. package/lib/plugins/watch-run.js.map +0 -1
  133. package/lib/utils.js.map +0 -1
  134. /package/defaults/app-with-backend/{web → public}/favicon-144x144.png +0 -0
  135. /package/defaults/app-with-backend/{web → public}/favicon-57x57.png +0 -0
  136. /package/defaults/app-with-backend/{web → public}/favicon-72x72.png +0 -0
  137. /package/defaults/app-with-backend/{web → public}/favicon.ico +0 -0
  138. /package/defaults/app-with-backend/src/components/{Error.scss → Error.module.css} +0 -0
  139. /package/defaults/app-with-backend/src/components/{Spinner.scss → Spinner.module.css} +0 -0
  140. /package/defaults/app-with-backend/src/pages/{Home.scss → Home.module.css} +0 -0
  141. /package/{expose-grunt.js → expose-grunt.cjs} +0 -0
  142. /package/lib/{interfaces.js → cjs/interfaces.js} +0 -0
  143. /package/lib/{plugins → cjs/plugins}/watch-run.js +0 -0
@@ -0,0 +1,17 @@
1
+ {
2
+ "app-main": {
3
+ "APP_ID": "com.yourdomain.www",
4
+ "APP_ENV": true,
5
+ "OUTPUT_PATH": "./web/assets",
6
+ "ASSET_PATH": "./assets/",
7
+ "ENTRY_PATH": "./src/index-static.tsx"
8
+ },
9
+ "app-local-android": {
10
+ "NODE_ENV": "app",
11
+ "SITE_ROOT": "http://10.0.2.2:4000"
12
+ },
13
+ "app-local-ios": {
14
+ "NODE_ENV": "app",
15
+ "SITE_ROOT": "http://localhost:4000"
16
+ }
17
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "scripts": {
3
+ "app": "env-cmd -e _main,production,app-main node scripts/build.js && npx cap sync",
4
+ "app-local-ios": "env-cmd -e _main,development,app-main,app-local-ios node scripts/build.js && npx cap sync",
5
+ "app-local-android": "env-cmd -e _main,development,app-main,app-local-android node scripts/build.js && npx cap sync",
6
+ "app-staging": "env-cmd -e _main,staging,app-main,app-staging node scripts/build.js && npx cap sync"
7
+ }
8
+ }
@@ -8,7 +8,7 @@ import {AppContextProvider} from 'lincd-server-utils/lib/components/AppContext';
8
8
  import './config-frontend';
9
9
 
10
10
  const root = ReactDOM.createRoot(
11
- document.getElementById('root') as HTMLElement
11
+ document.getElementById('root') as HTMLElement,
12
12
  );
13
13
 
14
14
  root.render(
@@ -18,5 +18,5 @@ root.render(
18
18
  <App />
19
19
  </AppContextProvider>
20
20
  </BrowserRouter>
21
- </React.StrictMode>
22
- );
21
+ </React.StrictMode>,
22
+ );
@@ -9,11 +9,8 @@
9
9
  "NODE_ENV": "development",
10
10
  "SITE_ROOT": "http://localhost:4000"
11
11
  },
12
- "staging": {
13
- "NODE_ENV": "staging",
14
- "SITE_ROOT": "https://next.${hyphen_name}.com"
15
- },
16
12
  "production": {
13
+ "PORT": "4000",
17
14
  "NODE_ENV": "production",
18
15
  "SITE_ROOT": "https://app.${hyphen_name}.com"
19
16
  }
@@ -1,3 +1,5 @@
1
1
  node_modules
2
2
  public
3
- build
3
+ build
4
+ data
5
+ web
@@ -1,7 +1,5 @@
1
1
  module.exports = {
2
- cssMode: 'scss-modules',
2
+ cssMode: 'mixed',
3
3
  cacheWebpack:true,
4
- cssGlobalModulePaths:[/global-overwrites.scss/],
5
4
  analyse:false,
6
-
7
5
  };
@@ -16,13 +16,12 @@
16
16
  "main": "scripts/start-server.js",
17
17
  "license": "MIT",
18
18
  "scripts": {
19
- "start": "npm run server:dev",
20
- "server:prod": "yarn lincd start --env production",
19
+ "start": "node --import ./node_modules/lincd-cli/lib/esm/loaders/register.js node_modules/.bin/lincd-cli start --env development",
21
20
  "build": "yarn lincd build-app --env production",
22
- "build:production": "yarn lincd build-app --env production",
23
- "postinstall": "husky install",
21
+ "prepare": "husky",
24
22
  "prepack": "pinst --disable",
25
23
  "postpack": "pinst --enable",
24
+ "server:prod": "yarn lincd start --env production",
26
25
  "lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
27
26
  "lint:fix": "yarn lint --fix",
28
27
  "prettier": "prettier \"src/**/*.{js,jsx,ts,tsx,css,scss}\" --check",
@@ -37,7 +36,7 @@
37
36
  "prettier --write"
38
37
  ]
39
38
  },
40
- "workspaces" : [
39
+ "workspaces": [
41
40
  "packages/*"
42
41
  ],
43
42
  "keywords": [
@@ -50,27 +49,17 @@
50
49
  "web3"
51
50
  ],
52
51
  "dependencies": {
53
- "@babel/cli": "^7.22.9",
54
- "@babel/core": "^7.22.9",
55
- "@babel/plugin-proposal-decorators": "^7.22.7",
56
- "@babel/plugin-transform-runtime": "^7.22.9",
57
- "@babel/preset-env": "^7.22.9",
58
- "@babel/preset-react": "^7.22.5",
59
- "@babel/preset-typescript": "^7.22.5",
60
- "@babel/register": "^7.22.5",
61
- "chalk": "^4.1.2",
62
- "lincd": "^0.6",
63
- "lincd-auth": "^0.1.19",
64
- "lincd-jsonld": "^0.1.21",
65
- "lincd-server": "^0.1.39",
66
- "lincd-server-utils": "^0.1.7",
52
+ "lincd": "~1.0",
53
+ "lincd-auth": "~1.0",
54
+ "lincd-server": "~1.0",
55
+ "lincd-server-utils": "~1.0",
67
56
  "react": "^18.2",
68
57
  "react-dom": "^18.2",
69
58
  "react-error-boundary": "^3.1.3",
70
59
  "react-router-dom": "^6.3.0"
71
60
  },
72
61
  "devDependencies": {
73
- "@types/node": "^18.11.10",
62
+ "@types/node": "^20.12.7",
74
63
  "@types/react": "^18.0.17",
75
64
  "@types/react-dom": "^18.0.6",
76
65
  "@typescript-eslint/eslint-plugin": "latest",
@@ -83,10 +72,11 @@
83
72
  "eslint-plugin-react": "latest",
84
73
  "eslint-plugin-react-hooks": "^4.6.0",
85
74
  "husky": "^8.0.0",
86
- "lincd-cli": "~1.1",
75
+ "lincd-cli": "^1.1",
87
76
  "nodemon": "^2.0.22",
88
77
  "pinst": "^3.0.0",
89
78
  "pm2": "^5.3.0",
79
+ "typescript-plugin-css-modules": "^5.1.0",
90
80
  "which": "^3.0.1"
91
81
  },
92
82
  "packageManager": "yarn@3.6.1"
@@ -1,11 +1,11 @@
1
- const { Storage } = require('lincd/lib/utils/Storage');
2
- const { LocalFileStore } = require('lincd-server/lib/shapes/filestores/LocalFileStore');
3
- const { LinkedFileStorage } = require('lincd/lib/utils/LinkedFileStorage');
4
- const { N3FileStore } = require('lincd-server/lib/shapes/quadstores/N3FileStore');
1
+ import { LinkedStorage } from 'lincd/utils/LinkedStorage';
2
+ import { LinkedFileStorage } from 'lincd/utils/LinkedFileStorage';
3
+ import { LocalFileStore } from 'lincd-server/shapes/filestores/LocalFileStore';
4
+ import { N3FileStore } from 'lincd-server/shapes/quadstores/N3FileStore';
5
5
 
6
6
  //How quads are stored
7
- let fileStore = new N3FileStore(process.env.NODE_ENV + '-main');
8
- Storage.setDefaultStore(fileStore);
7
+ let quadStore = new N3FileStore(process.env.NODE_ENV + '-main');
8
+ LinkedStorage.setDefaultStore(quadStore);
9
9
 
10
10
  //How files are stored
11
11
  let fileStore = new LocalFileStore(process.env.NODE_ENV + '-main');
@@ -0,0 +1,17 @@
1
+ .App {
2
+ display: block;
3
+ color: #141414;
4
+ margin-top: 1.5rem;
5
+ }
6
+ body {
7
+ font-family: 'Roboto', sans-serif;
8
+ background-color: #ffffff;
9
+ }
10
+ h1 {
11
+ font-size: 2rem;
12
+ font-weight: 100;
13
+ }
14
+ h2 {
15
+ font-size: 1.5em;
16
+ font-weight: bold;
17
+ }
@@ -1,18 +1,14 @@
1
- import React, {Suspense} from 'react';
2
- import {ErrorBoundary} from 'react-error-boundary';
3
- import {Spinner} from './components/Spinner';
4
- import {Error} from './components/Error';
5
- import {AppRoot} from 'lincd-server-utils/lib/components/AppRoot';
6
- import {Head} from 'lincd-server-utils/lib/components/Head';
7
- import {Body} from 'lincd-server-utils/lib/components/Body';
8
- import AppRoutes, {ROUTES} from './routes';
9
- import {ProvideAuth} from 'lincd-auth/lib/hooks/useAuth';
10
-
11
- //Note that by default LINCD apps are set up with support for SCSS (sass) and CSS Modules
12
- //So any .scss file needs to be imported by itself
13
- import './App.scss';
14
- //and then the .scss.json file needs to be imported to access the class names (this file will be automatically generated)
15
- import style from './App.scss.json';
1
+ import './theme.css'; //needs to be the first import before importing other components
2
+ import React, { Suspense } from 'react';
3
+ import { ErrorBoundary } from 'react-error-boundary';
4
+ import { Spinner } from './components/Spinner';
5
+ import { Error } from './components/Error';
6
+ import { AppRoot } from 'lincd-server-utils/components/AppRoot';
7
+ import { Head } from 'lincd-server-utils/components/Head';
8
+ import { Body } from 'lincd-server-utils/components/Body';
9
+ import AppRoutes, { ROUTES } from './routes';
10
+ import { ProvideAuth } from 'lincd-auth/hooks/useAuth';
11
+ import style from './App.module.css'; //import any .module.css file like this and access the classnames from the style object
16
12
 
17
13
  export default function App() {
18
14
  return (
@@ -1 +1,9 @@
1
1
  //import all ShapeProviders here or define a generic BackendProvider, see documentation on https://docs.lincd.org
2
+
3
+ import { BackendProvider } from 'lincd-server-utils/utils/BackendProvider';
4
+
5
+ export class Backend extends BackendProvider {
6
+ constructor(server) {
7
+ super(server);
8
+ }
9
+ }
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- import style from './Error.scss.json';
3
- import './Error.scss';
2
+ import style from './Error.module.css';
4
3
 
5
- export function Error({error}) {
4
+ export function Error({ error }) {
6
5
  return (
7
6
  <div className={style.error}>
8
7
  <h1>Application Error</h1>
@@ -10,5 +9,3 @@ export function Error({error}) {
10
9
  </div>
11
10
  );
12
11
  }
13
-
14
-
@@ -1,7 +1,7 @@
1
- import './Spinner.scss';
2
- import * as style from './Spinner.scss.json';
1
+ import React from 'react';
2
+ import style from './Spinner.module.css';
3
3
 
4
- export function Spinner({active = true}) {
4
+ export function Spinner({ active = true }) {
5
5
  return (
6
6
  <div
7
7
  className={[style.spinner, active && style.active].join(' ')}
@@ -1,7 +1,7 @@
1
- import { LinkedFileStorage } from 'lincd/lib/utils/LinkedFileStorage';
2
- import { getAccessUrlLocalFileStore } from 'lincd-server/lib/utils/accessUrl';
3
- import { BackendAPIStore } from 'lincd-server/lib/shapes/quadstores/BackendAPIStore';
4
- import { LinkedStorage } from 'lincd/lib/utils/LinkedStorage';
1
+ import { LinkedFileStorage } from 'lincd/utils/LinkedFileStorage';
2
+ import { getAccessUrlLocalFileStore } from 'lincd-server/utils/accessUrl';
3
+ import { BackendAPIStore } from 'lincd-server/shapes/quadstores/BackendAPIStore';
4
+ import { LinkedStorage } from 'lincd/utils/LinkedStorage';
5
5
 
6
6
  // store all quads in a file on the backend named 'main'
7
7
  // export const store = new BackendFileStore('main');
@@ -10,8 +10,8 @@ LinkedStorage.setDefaultStore(store);
10
10
 
11
11
  // determine where assets at loaded from
12
12
  // if (process.env.NODE_ENV === 'development') {
13
- //by default assets are loaded from the file system of the node.js backend server
14
- LinkedFileStorage.setDefaultAccessURL(getAccessUrlLocalFileStore());
13
+ //by default assets are loaded from the file system of the node.js backend server
14
+ LinkedFileStorage.setDefaultAccessURL(getAccessUrlLocalFileStore());
15
15
  // } else {
16
16
  // LinkedFileStorage.setDefaultAccessURL(getAccessURLS3FileStore());
17
17
  // }
@@ -8,6 +8,7 @@ import { AppContextProvider } from 'lincd-server-utils/lib/components/AppContext
8
8
  //import the storage & file configuration for the frontend
9
9
  import './config-frontend';
10
10
 
11
+ //to avoid errors with react-refresh-webpack-plugin
11
12
  window['$RefreshReg$'] = () => {};
12
13
  window['$RefreshSig$'] = () => () => {};
13
14
 
@@ -0,0 +1,12 @@
1
+ .main {
2
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
3
+ Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
4
+ margin: auto;
5
+ width: min(66.6%, 1000px);
6
+ @media (max-width: 1024px) {
7
+ width: 80%;
8
+ }
9
+ @media (max-width: 768px) {
10
+ width: 90%;
11
+ }
12
+ }
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
- import {Header} from './Header';
3
- import './DefaultLayout.scss';
4
- import style from './DefaultLayout.scss.json';
2
+ import { Header } from './Header';
3
+ import style from './DefaultLayout.module.css';
5
4
 
6
- export function DefaultLayout({children}) {
5
+ export function DefaultLayout({ children }) {
7
6
  return (
8
7
  <main className={style.main}>
9
8
  <Header />
@@ -0,0 +1,25 @@
1
+ .header {
2
+ display: block;
3
+ }
4
+
5
+ .menu {
6
+ margin: 1rem 0 3rem;
7
+ display: grid;
8
+ grid-template-columns: repeat(6, 1fr);
9
+ grid-gap: 1rem;
10
+ > a {
11
+ text-align: center;
12
+ font-weight: bold;
13
+ font-size: 1.2rem;
14
+ background: black;
15
+ color: white;
16
+ padding: 5px 10px;
17
+ text-decoration: none;
18
+ &.active {
19
+ background: white;
20
+ color: black;
21
+ box-shadow: 1px 8px 10px #888;
22
+ border: 1px solid #444;
23
+ }
24
+ }
25
+ }
@@ -1,18 +1,22 @@
1
- import {Link} from 'react-router-dom';
1
+ import { Link, useLocation } from 'react-router-dom';
2
2
  import React from 'react';
3
- import style from './Header.scss.json';
4
- import './Header.scss';
5
- import {ROUTES} from '../routes';
3
+ import style from './Header.module.css';
4
+ import { ROUTES } from '../routes';
6
5
 
7
6
  export function Header() {
7
+ let path = useLocation();
8
8
  return (
9
9
  <header className={style.header}>
10
- <h1>${name}</h1>
10
+ <h1>LINCD 1.0 Demo App</h1>
11
11
  <nav className={style.menu}>
12
12
  {Object.keys(ROUTES).map((key) => {
13
13
  if (ROUTES[key].excludeFromMenu) return null;
14
14
  return (
15
- <Link key={key} to={ROUTES[key].path}>
15
+ <Link
16
+ key={key}
17
+ to={ROUTES[key].path}
18
+ className={ROUTES[key].path === path.pathname ? style.active : ''}
19
+ >
16
20
  {ROUTES[key].label || key}
17
21
  </Link>
18
22
  );
@@ -1,14 +1,12 @@
1
- import {linkedPackage} from 'lincd/lib/utils/Module';
1
+ import { linkedPackage } from 'lincd/utils/Package';
2
2
 
3
3
  export const {
4
4
  linkedComponent,
5
5
  linkedSetComponent,
6
- linkedComponentClass,
7
6
  linkedShape,
8
7
  linkedUtil,
9
8
  linkedOntology,
10
9
  registerPackageExport,
11
- registerPackageModule,
12
10
  packageExports,
13
11
  packageName,
14
12
  } = linkedPackage('${hyphen_name}');
@@ -1,6 +1,5 @@
1
- import {DefaultLayout} from '../layout/DefaultLayout';
2
- import './Home.scss';
3
- import style from './Home.scss.json';
1
+ import { DefaultLayout } from '../layout/DefaultLayout';
2
+ import style from './Home.module.css';
4
3
 
5
4
  export default function Home() {
6
5
  return (
@@ -1,10 +1,10 @@
1
- import React, {lazy, Suspense} from 'react';
2
- import {Route, Routes} from 'react-router-dom';
3
- import {Spinner} from './components/Spinner';
4
- import {RequireAuth} from 'lincd-auth/lib/components/RequireAuth';
1
+ import React, { lazy, Suspense } from 'react';
2
+ import { Route, Routes } from 'react-router-dom';
3
+ import { Spinner } from './components/Spinner';
4
+ import { RequireAuth } from 'lincd-auth/components/RequireAuth';
5
5
  import PageNotFound from './pages/PageNotFound';
6
6
 
7
- //In React 18 you can use 'lazy' to import pages only when you need them.
7
+ //From React 18 you can use 'lazy' to import pages only when you need them.
8
8
  //This will cause webpack to create multiple bundles, and the right bundles are automatically loaded
9
9
  interface RouteObj {
10
10
  path: string;
@@ -14,7 +14,8 @@ interface RouteObj {
14
14
  excludeFromMenu?: boolean;
15
15
  label?: string;
16
16
  }
17
- export const ROUTES: {[key: string]: RouteObj} = {
17
+
18
+ export const ROUTES: { [key: string]: RouteObj } = {
18
19
  index: {
19
20
  path: '/',
20
21
  component: lazy(() => import('./pages/Home' /* webpackPrefetch: true */)),
@@ -44,7 +45,7 @@ export default function AppRoutes() {
44
45
  //if a route is marked as requireAuth, wrap it in the RequireAuth component and pass the signinRoute
45
46
  const AuthGuard = route.requireAuth ? RequireAuth : React.Fragment;
46
47
  const authProps = route.requireAuth
47
- ? {signinRoute: ROUTES.signin.path}
48
+ ? { signinRoute: ROUTES.signin.path }
48
49
  : {};
49
50
 
50
51
  // define a render function that determines what to render based on the component and route.render
@@ -0,0 +1,100 @@
1
+ @import 'tailwindcss';
2
+ /*apply tailwind config, which ensures that all LINCD components are considered "content" for tailwind */
3
+ @config "../../node_modules/lincd-cli/lib/esm/tailwind.config.js";
4
+
5
+ /*Use this to generate ALL css variables */
6
+ /*@theme static {*/
7
+ /* --*: initial;*/
8
+ /*--color-primary: var(--color-red-500);*/
9
+ /*--color-secondary: var(--color-blue-500);*/
10
+ /*}*/
11
+
12
+ /*for theme variables, see https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/theme.css*/
13
+
14
+ /*@use 'todomvc-app-css/index.css';*/
15
+ /*@use 'todomvc-common/base.css';*/
16
+
17
+ /*LINCD uses tailwind for creating themes, see https://tailwindcss.com/docs/theme#what-are-theme-variables */
18
+ /*@theme {*/
19
+ /* --font-sans: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',*/
20
+ /* 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';*/
21
+ /* --font-serif: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;*/
22
+ /* --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,*/
23
+ /* 'Liberation Mono', 'Courier New', monospace;*/
24
+ /*}*/
25
+
26
+ @theme {
27
+ /* Primary Palette mapped to Tailwind sky */
28
+ --color-primary-50: var(--color-sky-50);
29
+ --color-primary-100: var(--color-sky-100);
30
+ --color-primary-200: var(--color-sky-200);
31
+ --color-primary-300: var(--color-sky-300);
32
+ --color-primary-400: var(--color-sky-400);
33
+ --color-primary-500: var(--color-sky-500);
34
+ --color-primary-600: var(--color-sky-600);
35
+ --color-primary-700: var(--color-sky-700);
36
+ --color-primary-800: var(--color-sky-800);
37
+ --color-primary-900: var(--color-sky-900);
38
+
39
+ /* === Shadows === */
40
+ --shadow-surface: var(--shadow-sm); /* Background panels, sections */
41
+ --shadow-card: var(--shadow-md); /* Cards, organized content blocks */
42
+ --shadow-popover: var(--shadow-lg); /* Tooltips, dropdowns, popovers */
43
+ --shadow-modal: var(--shadow-2xl); /* Modals, overlays */
44
+ --shadow-floating-action: var(
45
+ --shadow-lg
46
+ ); /* Floating buttons, floating toolbars */
47
+ --shadow-content: none; /* Buttons, inputs inside surfaces */
48
+
49
+ /* === Backgrounds / Surfaces === */
50
+ --bg-page: var(--color-gray-50); /* Main app background */
51
+ --bg-section: var(--color-gray-100); /* Sections inside pages */
52
+ --bg-card: var(--color-white); /* Cards */
53
+ --bg-popover: var(--color-white); /* Popovers, dropdowns */
54
+ --bg-modal: var(--color-white); /* Modals, dialogs */
55
+ --bg-sidebar: var(--color-gray-200); /* Sidebars */
56
+ --bg-footer: var(--color-gray-300); /* Footer areas */
57
+ --bg-overlay: var(--color-gray-900); /* Overlay scrims (dark) */
58
+
59
+ /* for bg-card and text-card? */
60
+ --color-card: var(--color-white);
61
+
62
+ /* === Z-Index === */
63
+ --z-base: 0; /* Normal document flow */
64
+ --z-surface: 10; /* Cards, panels */
65
+ --z-popover: 30; /* Dropdowns, popovers */
66
+ --z-modal: 50; /* Modals, dialogs */
67
+ --z-overlay: 75; /* Overlays, backdrops */
68
+ --z-tooltip: 100; /* Tooltips, highest priority */
69
+
70
+ /* === Border Radius === */
71
+ /*TODO: should this not be much larger then card? from large to small? */
72
+ --radius-surface: var(--radius-sm); /* Default background surfaces */
73
+ --radius-card: var(--radius-lg); /* Cards and panels */
74
+ /*TODO: we need something for items inside a card, like buttons and images. Or even if they are on surfaces */
75
+ --radius-element: var(--radius-md); /* Images and buttons */
76
+ --radius-popover: var(--radius-md); /* Popovers, tooltips, dropdowns */
77
+ --radius-modal: var(--radius-2xl); /* Modals, overlays */
78
+ --radius-floating-action: var(
79
+ --radius-full
80
+ ); /* Floating buttons, floating toolbars (FAB) */
81
+ --radius-none: 0px; /* Flat design option */
82
+
83
+ /* === Z-Index === */
84
+ --z-base: 0; /* Normal flow */
85
+ --z-surface: 10; /* Cards, panels */
86
+ --z-popover: 30; /* Dropdowns, popovers */
87
+ --z-modal: 50; /* Modals, dialogs */
88
+ --z-overlay: 75; /* Overlays, spinners */
89
+ --z-tooltip: 100; /* Tooltips, highest priority */
90
+
91
+ /* === Spacing (example for consistent gaps/padding) === */
92
+ --spacing-card: calc(var(--spacing) * 4);
93
+
94
+ /* TODO: set Header font family and font sizes in theme. Should they become increasingly bigger? Or should they be semantic? Like sub-header, ... we had some names once*/
95
+ }
96
+
97
+ /*@source utilities:bg:*,text:*,p-*,m-*,rounded-*,shadow-**/
98
+ /*@source inline("utilities:bg:*,text:*,p-*,m-*,w-*,h-*,min-w-*,min-h-*,max-w-*,max-h-*,gap-*,space-x-*,space-y-*,border-*,opacity-*,scale-*,rotate-*,translate-*,z-*,leading-*,tracking-*,font-*,rounded-*,shadow-*")*/
99
+ /*@source inline("components:btn-primary,card")*/
100
+ /*@source inline("shortcuts:container")*/
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "commonjs",
3
+ "module": "esnext",
4
4
  "moduleResolution": "node",
5
5
  "sourceMap": true,
6
- "target": "es2019",
6
+ "target": "es2018",
7
+ "resolveJsonModule": true,
7
8
  "declaration": false,
8
9
  "experimentalDecorators": true,
9
10
  "emitDecoratorMetadata": true,
@@ -11,9 +12,11 @@
11
12
  "resolveJsonModule": true,
12
13
  "jsx": "react-jsx",
13
14
  "types": ["node", "react", "react-dom"],
14
- "paths": {
15
- "react": ["../node_modules/@types/react","../../../node_modules/@types/react"]
16
- },
15
+ "plugins": [
16
+ {
17
+ "name": "typescript-plugin-css-modules"
18
+ }
19
+ ],
17
20
  "pretty": true
18
21
  },
19
22
  "files": ["./src/index.tsx"],
@@ -1,12 +1,10 @@
1
1
  import React from "react";
2
2
  import "./${hyphen_name}.scss";
3
3
  import {default as style} from "./${hyphen_name}.scss.json";
4
- import {registerPackageModule,linkedComponent} from '../package';
4
+ import {linkedComponent} from '../package';
5
5
 
6
6
  //TODO: replace SHAPE with an actual Shape class
7
7
  export const ${camel_name} = linkedComponent<SHAPE>(SHAPE,({source}) => {
8
8
  return <div className={style.${camel_name}}></div>;
9
9
  });
10
10
 
11
- //register all components in this file
12
- registerPackageModule(module);
@@ -29,10 +29,10 @@
29
29
  "web3"
30
30
  ],
31
31
  "dependencies": {
32
- "lincd": "^0.6",
32
+ "lincd": "^1.0",
33
33
  "lincd-jsonld": "^0.1"
34
34
  },
35
35
  "devDependencies": {
36
- "lincd-cli": "~1.1"
36
+ "lincd-cli": "^1.1"
37
37
  }
38
38
  }
@@ -1,3 +1,4 @@
1
+ import './types';
1
2
  import './ontologies/${hyphen_name}';
2
3
 
3
4
  //SHAPES FIRST
@@ -1,6 +1,6 @@
1
- import {NamedNode} from 'lincd/lib/models';
1
+ import {NamedNode} from 'lincd/models';
2
2
  import {JSONLD} from 'lincd-jsonld/lib/utils/JSONLD';
3
- import {createNameSpace} from 'lincd/lib/utils/NameSpace';
3
+ import {createNameSpace} from 'lincd/utils/NameSpace';
4
4
  import {linkedOntology} from '../package';
5
5
  //import all the exports of this file as one variable called _this (we need this at the end)
6
6
  import * as _this from './${hyphen_name}';
@@ -9,7 +9,14 @@ import * as _this from './${hyphen_name}';
9
9
  * Load the data of this ontology into memory, thus adding the properties of the entities of this ontology to the local graph.
10
10
  */
11
11
  export var loadData = () => {
12
- return import('../data/${hyphen_name}.json').then((data) => JSONLD.parse(data));
12
+ if (typeof module !== 'undefined' && typeof exports !== 'undefined') {
13
+ // CommonJS import
14
+ return import('../data/${hyphen_name}.json').then((data) => JSONLD.parse(data));
15
+ } else {
16
+ // ESM import
17
+ //@ts-ignore
18
+ return import('../data/${hyphen_name}.json',{ with: { type: "json" } }).then((data) => JSONLD.parse(data));
19
+ }
13
20
  };
14
21
 
15
22
  /**
@@ -1,4 +1,12 @@
1
- import {linkedPackage} from 'lincd/lib/utils/Module';
1
+ import {linkedPackage} from 'lincd/utils/Package';
2
2
 
3
- export const {linkedComponent, linkedComponentClass, linkedShape, linkedUtil, linkedOntology, registerPackageModule, registerPackageExport, packageExports, packageName} =
4
- linkedPackage('${package_name}');
3
+ export const {
4
+ linkedComponent,
5
+ linkedComponentClass,
6
+ linkedShape,
7
+ linkedUtil,
8
+ linkedOntology,
9
+ registerPackageExport,
10
+ packageExports,
11
+ packageName,
12
+ } = linkedPackage('${package_name}');