mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: extract to @k8slens/routing
Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
1 parent
9af5159706
commit
15965b71f6
14 files changed
+262
-1
No files matched your search
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "@k8slens/eslint-config/eslint",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"module": {
|
||||
"type": "commonjs"
|
||||
},
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true,
|
||||
"decorators": true,
|
||||
"dynamicImport": false
|
||||
},
|
||||
"transform": {
|
||||
"legacyDecorator": true,
|
||||
"decoratorMetadata": true
|
||||
},
|
||||
"target": "es2019"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# @k8slens/error-boundary
|
||||
|
||||
This package contains stuff related to creating Lens-applications.
|
||||
|
||||
# Usage
|
||||
|
||||
```bash
|
||||
$ npm install @k8slens/error-boundary
|
||||
```
|
||||
|
||||
```typescript
|
||||
import { Tooltip, TooltipPosition } from "@k8slens/error-boundary";
|
||||
import { withTooltip } from "@k8slens/error-boundary";
|
||||
|
||||
import type { TooltipProps } from "@k8slens/error-boundary";
|
||||
import type { TooltipDecoratorProps } from "@k8slens/error-boundary";
|
||||
|
||||
```
|
||||
|
||||
## Extendability
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
export * from "./src/observable-history.injectable";
|
||||
@@ -0,0 +1,3 @@
|
||||
const { configForReact } = require("@k8slens/jest").monorepoPackageConfig(__dirname);
|
||||
|
||||
module.exports = configForReact;
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "@k8slens/routing",
|
||||
"private": false,
|
||||
"version": "1.0.0-alpha.0",
|
||||
"description": "Highly extendable error-boundary in the Lens.",
|
||||
"type": "commonjs",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lensapp/lens.git"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": {
|
||||
"name": "OpenLens Authors",
|
||||
"email": "info@k8slens.dev"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"lint": "lens-lint",
|
||||
"lint:fix": "lens-lint --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ogre-tools/injectable": "^15.3.1",
|
||||
"@ogre-tools/injectable-react": "^15.3.0",
|
||||
"history": "^4.10.1",
|
||||
"mobx-observable-history": "^2.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"auto-bind": "^4.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mobx": "^6.8.0",
|
||||
"mobx-react": "^7.6.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@async-fn/jest": "^1.6.4",
|
||||
"@k8slens/eslint-config": "6.5.0-alpha.1",
|
||||
"@k8slens/react-testing-library-discovery": "^1.0.0-alpha.0",
|
||||
"@testing-library/react": "^12.1.5",
|
||||
"@testing-library/user-event": "^12.8.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { createBrowserHistory } from "history";
|
||||
import type { History } from "history";
|
||||
|
||||
const historyInjectable = getInjectable({
|
||||
id: "history",
|
||||
instantiate: (): History => createBrowserHistory(),
|
||||
});
|
||||
|
||||
export default historyInjectable;
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { createObservableHistory } from "mobx-observable-history";
|
||||
import { searchParamsOptions } from "./search-params";
|
||||
import historyInjectable from "./history.injectable";
|
||||
|
||||
const observableHistoryInjectable = getInjectable({
|
||||
id: "observable-history",
|
||||
|
||||
instantiate: (di) => {
|
||||
const history = di.inject(historyInjectable);
|
||||
const navigation = createObservableHistory(history, {
|
||||
searchParams: searchParamsOptions,
|
||||
});
|
||||
|
||||
return navigation;
|
||||
},
|
||||
});
|
||||
|
||||
export default observableHistoryInjectable;
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { ObservableSearchParamsOptions } from "mobx-observable-history";
|
||||
|
||||
export const searchParamsOptions: ObservableSearchParamsOptions = {
|
||||
skipEmpty: true, // skip empty params, e.g. "?x=&y2=" will be "?y=2"
|
||||
joinArrays: false, // join multiple params with same name, e.g. "?x=1&x=2" => "?x=1,2"
|
||||
joinArraysWith: ",", // param values splitter, applicable only with {joinArrays:true}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
content: [
|
||||
path.join(__dirname, "src/**/*.tsx")
|
||||
],
|
||||
darkMode: "class",
|
||||
theme: {
|
||||
fontFamily: {
|
||||
sans: ["Roboto", "Helvetica", "Arial", "sans-serif"],
|
||||
},
|
||||
extend: {
|
||||
colors: {
|
||||
textAccent: "var(--textColorAccent)",
|
||||
textPrimary: "var(--textColorPrimary)",
|
||||
textTertiary: "var(--textColorTertiary)",
|
||||
textDimmed: "var(--textColorDimmed)",
|
||||
},
|
||||
},
|
||||
},
|
||||
variants: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "@k8slens/typescript/config/base.json",
|
||||
"include": ["**/*.ts", "**/*.tsx"],
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require("@k8slens/webpack").configForReact;
|
||||
@@ -37,6 +37,7 @@
|
||||
"peerDependencies": {
|
||||
"@k8slens/button": "^1.0.0-alpha.1",
|
||||
"@k8slens/utilities": "^1.0.0-alpha.1",
|
||||
"@k8slens/routing": "^1.0.0-alpha.0",
|
||||
"auto-bind": "^4.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mobx": "^6.8.0",
|
||||
|
||||
Reference in new issue
Block a user