From ec59dab90698f5affe400b19db10e2e3c20e6957 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 12:24:37 +0200 Subject: [PATCH 01/11] feat: extract resizing-anchor Signed-off-by: Gabriel --- package-lock.json | 56 +++++++++++++++++++ packages/core/package.json | 1 + .../src/renderer/components/dock/dock.tsx | 2 +- .../src/renderer/components/drawer/drawer.tsx | 2 +- .../components/layout/main-layout.tsx | 2 +- packages/open-lens/src/renderer/index.ts | 1 + .../resizing-anchor/.eslintrc.json | 6 ++ .../ui-components/resizing-anchor/.prettierrc | 1 + packages/ui-components/resizing-anchor/.swcrc | 19 +++++++ .../ui-components/resizing-anchor/README.md | 15 +++++ .../ui-components/resizing-anchor/index.ts | 6 ++ .../resizing-anchor/jest.config.js | 1 + .../resizing-anchor/package.json | 50 +++++++++++++++++ .../resizing-anchor/src}/index.ts | 0 .../resizing-anchor/src}/resizing-anchor.scss | 0 .../resizing-anchor/src}/resizing-anchor.tsx | 0 .../resizing-anchor/tailwind.config.js | 30 ++++++++++ .../resizing-anchor/tsconfig.json | 4 ++ .../resizing-anchor/webpack.config.js | 1 + 19 files changed, 194 insertions(+), 3 deletions(-) create mode 100644 packages/ui-components/resizing-anchor/.eslintrc.json create mode 100644 packages/ui-components/resizing-anchor/.prettierrc create mode 100644 packages/ui-components/resizing-anchor/.swcrc create mode 100644 packages/ui-components/resizing-anchor/README.md create mode 100644 packages/ui-components/resizing-anchor/index.ts create mode 100644 packages/ui-components/resizing-anchor/jest.config.js create mode 100644 packages/ui-components/resizing-anchor/package.json rename packages/{core/src/renderer/components/resizing-anchor => ui-components/resizing-anchor/src}/index.ts (100%) rename packages/{core/src/renderer/components/resizing-anchor => ui-components/resizing-anchor/src}/resizing-anchor.scss (100%) rename packages/{core/src/renderer/components/resizing-anchor => ui-components/resizing-anchor/src}/resizing-anchor.tsx (100%) create mode 100644 packages/ui-components/resizing-anchor/tailwind.config.js create mode 100644 packages/ui-components/resizing-anchor/tsconfig.json create mode 100644 packages/ui-components/resizing-anchor/webpack.config.js diff --git a/package-lock.json b/package-lock.json index ffb7dc57e5..035f3e22d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3946,6 +3946,10 @@ "resolved": "packages/release-tool", "link": true }, + "node_modules/@k8slens/resizing-anchor": { + "resolved": "packages/ui-components/resizing-anchor", + "link": true + }, "node_modules/@k8slens/run-many": { "resolved": "packages/utility-features/run-many", "link": true @@ -35060,6 +35064,7 @@ "@k8slens/messaging": "^1.0.0-alpha.1", "@k8slens/messaging-for-main": "^1.0.0-alpha.1", "@k8slens/messaging-for-renderer": "^1.0.0-alpha.1", + "@k8slens/resizing-anchor": "^1.0.0-alpha.0", "@k8slens/run-many": "^1.0.0-alpha.1", "@k8slens/startable-stoppable": "^1.0.0-alpha.1", "@k8slens/test-utils": "^1.0.0-alpha.1", @@ -36601,6 +36606,57 @@ "react-dom": "^17.0.2" } }, + "packages/ui-components/resizing-anchor": { + "name": "@k8slens/resizing-anchor", + "version": "1.0.0-alpha.0", + "license": "MIT", + "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" + }, + "peerDependencies": { + "@k8slens/feature-core": "^6.5.0-alpha.0", + "@k8slens/utilities": "^1.0.0-alpha.1", + "@ogre-tools/fp": "^15.1.2", + "@ogre-tools/injectable": "^15.1.2", + "@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2", + "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" + } + }, + "packages/ui-components/resizing-anchor/node_modules/@k8slens/eslint-config": { + "version": "6.5.0-alpha.1", + "resolved": "https://registry.npmjs.org/@k8slens/eslint-config/-/eslint-config-6.5.0-alpha.1.tgz", + "integrity": "sha512-6DdfKe/iafX85GBK/UlKgz29FOIOp/UVS03bFGLyw7Vmm7pauB0FEHTAdbr3g1qG/Zcn6nxhOM3uqQyRY/uEyA==", + "dev": true, + "bin": { + "lens-lint": "bin/lint" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": ">= 5", + "@typescript-eslint/parser": ">= 5", + "eslint": ">= 7", + "eslint-config-airbnb-typescript": ">= 17", + "eslint-config-prettier": ">= 8", + "eslint-config-react-app": "^7.0.1", + "eslint-plugin-import": ">= 2", + "eslint-plugin-jest": ">= 27", + "eslint-plugin-jsx-a11y": ">= 6", + "eslint-plugin-no-unsanitized": ">= 4.0.2", + "eslint-plugin-prettier": ">= 4", + "eslint-plugin-react-hooks": ">= 4", + "eslint-plugin-security": ">= 1.6.0", + "eslint-plugin-simple-import-sort": ">= 7", + "eslint-plugin-unused-imports": ">= 2", + "eslint-plugin-xss": ">= 0.1.12", + "prettier": ">= 2" + } + }, "packages/utility-features/react-testing-library-discovery": { "name": "@k8slens/react-testing-library-discovery", "version": "1.0.0-alpha.3", diff --git a/packages/core/package.json b/packages/core/package.json index 2cfe0c5ae5..4355508272 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -321,6 +321,7 @@ "@k8slens/run-many": "^1.0.0-alpha.1", "@k8slens/startable-stoppable": "^1.0.0-alpha.1", "@k8slens/test-utils": "^1.0.0-alpha.1", + "@k8slens/resizing-anchor": "^1.0.0-alpha.0", "@k8slens/utilities": "^1.0.0-alpha.1", "@ogre-tools/fp": "^15.3.1", "@ogre-tools/injectable": "^15.3.1", diff --git a/packages/core/src/renderer/components/dock/dock.tsx b/packages/core/src/renderer/components/dock/dock.tsx index b0e2b010c6..34643986eb 100644 --- a/packages/core/src/renderer/components/dock/dock.tsx +++ b/packages/core/src/renderer/components/dock/dock.tsx @@ -10,7 +10,7 @@ import { cssNames } from "@k8slens/utilities"; import { Icon } from "../icon"; import { MenuItem } from "../menu"; import { MenuActions } from "../menu/menu-actions"; -import { ResizeDirection, ResizingAnchor } from "../resizing-anchor"; +import { ResizeDirection, ResizingAnchor } from "@k8slens/resizing-anchor"; import { CreateResource } from "./create-resource/view"; import { DockTabs } from "./dock-tabs"; import type { DockStore, DockTab } from "./dock/store"; diff --git a/packages/core/src/renderer/components/drawer/drawer.tsx b/packages/core/src/renderer/components/drawer/drawer.tsx index 5959c0c098..3a4f2a72f4 100644 --- a/packages/core/src/renderer/components/drawer/drawer.tsx +++ b/packages/core/src/renderer/components/drawer/drawer.tsx @@ -13,7 +13,7 @@ import { cssNames, noop } from "@k8slens/utilities"; import { Icon } from "../icon"; import type { AnimateName } from "../animate"; import { Animate } from "../animate"; -import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "../resizing-anchor"; +import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor"; import drawerStorageInjectable, { defaultDrawerWidth } from "./drawer-storage/drawer-storage.injectable"; import { withInjectables } from "@ogre-tools/injectable-react"; import historyInjectable from "../../navigation/history.injectable"; diff --git a/packages/core/src/renderer/components/layout/main-layout.tsx b/packages/core/src/renderer/components/layout/main-layout.tsx index a078ac7b74..c97327cfe5 100755 --- a/packages/core/src/renderer/components/layout/main-layout.tsx +++ b/packages/core/src/renderer/components/layout/main-layout.tsx @@ -9,7 +9,7 @@ import React from "react"; import { observer } from "mobx-react"; import { cssNames } from "@k8slens/utilities"; import { ErrorBoundary } from "../error-boundary"; -import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "../resizing-anchor"; +import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor"; import { withInjectables } from "@ogre-tools/injectable-react"; import type { SidebarStorageState } from "./sidebar-storage/sidebar-storage.injectable"; import sidebarStorageInjectable, { defaultSidebarWidth } from "./sidebar-storage/sidebar-storage.injectable"; diff --git a/packages/open-lens/src/renderer/index.ts b/packages/open-lens/src/renderer/index.ts index 64c5810574..9ef0711271 100644 --- a/packages/open-lens/src/renderer/index.ts +++ b/packages/open-lens/src/renderer/index.ts @@ -1,4 +1,5 @@ import "@k8slens/core/styles"; +import "@k8slens/resizing-anchor/dist/index.css"; import { runInAction } from "mobx"; import { rendererExtensionApi as Renderer, diff --git a/packages/ui-components/resizing-anchor/.eslintrc.json b/packages/ui-components/resizing-anchor/.eslintrc.json new file mode 100644 index 0000000000..b15115cb69 --- /dev/null +++ b/packages/ui-components/resizing-anchor/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "extends": "@k8slens/eslint-config/eslint", + "parserOptions": { + "project": "./tsconfig.json" + } +} diff --git a/packages/ui-components/resizing-anchor/.prettierrc b/packages/ui-components/resizing-anchor/.prettierrc new file mode 100644 index 0000000000..edd47b479e --- /dev/null +++ b/packages/ui-components/resizing-anchor/.prettierrc @@ -0,0 +1 @@ +"@k8slens/eslint-config/prettier" diff --git a/packages/ui-components/resizing-anchor/.swcrc b/packages/ui-components/resizing-anchor/.swcrc new file mode 100644 index 0000000000..4dd5c11a89 --- /dev/null +++ b/packages/ui-components/resizing-anchor/.swcrc @@ -0,0 +1,19 @@ +{ + "module": { + "type": "commonjs" + }, + "jsc": { + "parser": { + "syntax": "typescript", + "tsx": true, + "decorators": true, + "dynamicImport": false + }, + "transform": { + "legacyDecorator": true, + "decoratorMetadata": true + }, + "target": "es2019" + } +} + diff --git a/packages/ui-components/resizing-anchor/README.md b/packages/ui-components/resizing-anchor/README.md new file mode 100644 index 0000000000..bcf7e3003e --- /dev/null +++ b/packages/ui-components/resizing-anchor/README.md @@ -0,0 +1,15 @@ +# @k8slens/resizing-anchor + +This package contains stuff related to creating Lens-applications. + +# Usage + +```bash +$ npm install @k8slens/resizing-anchor +``` + +```typescript +import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor"; +``` + +## Extendability diff --git a/packages/ui-components/resizing-anchor/index.ts b/packages/ui-components/resizing-anchor/index.ts new file mode 100644 index 0000000000..f76358c781 --- /dev/null +++ b/packages/ui-components/resizing-anchor/index.ts @@ -0,0 +1,6 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +export * from "./src/resizing-anchor"; diff --git a/packages/ui-components/resizing-anchor/jest.config.js b/packages/ui-components/resizing-anchor/jest.config.js new file mode 100644 index 0000000000..38d54ab7b6 --- /dev/null +++ b/packages/ui-components/resizing-anchor/jest.config.js @@ -0,0 +1 @@ +module.exports = require("@k8slens/jest").monorepoPackageConfig(__dirname).configForReact; diff --git a/packages/ui-components/resizing-anchor/package.json b/packages/ui-components/resizing-anchor/package.json new file mode 100644 index 0000000000..5df84aacfa --- /dev/null +++ b/packages/ui-components/resizing-anchor/package.json @@ -0,0 +1,50 @@ +{ + "name": "@k8slens/resizing-anchor", + "private": false, + "version": "1.0.0-alpha.0", + "description": "Highly extendable resizing-anchor 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", + "test:unit": "jest --coverage --runInBand", + "lint": "lens-lint", + "lint:fix": "lens-lint --fix" + }, + "peerDependencies": { + "@k8slens/feature-core": "^6.5.0-alpha.0", + "@k8slens/utilities": "^1.0.0-alpha.1", + "@ogre-tools/injectable": "^15.1.2", + "@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2", + "@ogre-tools/fp": "^15.1.2", + "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" + } +} diff --git a/packages/core/src/renderer/components/resizing-anchor/index.ts b/packages/ui-components/resizing-anchor/src/index.ts similarity index 100% rename from packages/core/src/renderer/components/resizing-anchor/index.ts rename to packages/ui-components/resizing-anchor/src/index.ts diff --git a/packages/core/src/renderer/components/resizing-anchor/resizing-anchor.scss b/packages/ui-components/resizing-anchor/src/resizing-anchor.scss similarity index 100% rename from packages/core/src/renderer/components/resizing-anchor/resizing-anchor.scss rename to packages/ui-components/resizing-anchor/src/resizing-anchor.scss diff --git a/packages/core/src/renderer/components/resizing-anchor/resizing-anchor.tsx b/packages/ui-components/resizing-anchor/src/resizing-anchor.tsx similarity index 100% rename from packages/core/src/renderer/components/resizing-anchor/resizing-anchor.tsx rename to packages/ui-components/resizing-anchor/src/resizing-anchor.tsx diff --git a/packages/ui-components/resizing-anchor/tailwind.config.js b/packages/ui-components/resizing-anchor/tailwind.config.js new file mode 100644 index 0000000000..59cf6201b3 --- /dev/null +++ b/packages/ui-components/resizing-anchor/tailwind.config.js @@ -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: [], +}; diff --git a/packages/ui-components/resizing-anchor/tsconfig.json b/packages/ui-components/resizing-anchor/tsconfig.json new file mode 100644 index 0000000000..9e140d79da --- /dev/null +++ b/packages/ui-components/resizing-anchor/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@k8slens/typescript/config/base.json", + "include": ["**/*.ts", "**/*.tsx"], +} diff --git a/packages/ui-components/resizing-anchor/webpack.config.js b/packages/ui-components/resizing-anchor/webpack.config.js new file mode 100644 index 0000000000..1cda407f5a --- /dev/null +++ b/packages/ui-components/resizing-anchor/webpack.config.js @@ -0,0 +1 @@ +module.exports = require("@k8slens/webpack").configForReact; From 94d479d977f689b267ef984a12d9eb015f385547 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 12:32:16 +0200 Subject: [PATCH 02/11] fix: remove default test script Signed-off-by: Gabriel --- packages/ui-components/resizing-anchor/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ui-components/resizing-anchor/package.json b/packages/ui-components/resizing-anchor/package.json index 5df84aacfa..368885050e 100644 --- a/packages/ui-components/resizing-anchor/package.json +++ b/packages/ui-components/resizing-anchor/package.json @@ -25,7 +25,6 @@ "homepage": "https://github.com/lensapp/lens", "scripts": { "build": "webpack", - "test:unit": "jest --coverage --runInBand", "lint": "lens-lint", "lint:fix": "lens-lint --fix" }, From 2f92f1cede17aad7d08e4b0871741141a85bcca6 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 13:09:18 +0200 Subject: [PATCH 03/11] fix: sass is not a dependency Signed-off-by: Gabriel --- .../src/plugins/protect-from-importing-non-dependencies.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js b/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js index 2df5e61d2c..f73124c567 100644 --- a/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js +++ b/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js @@ -12,6 +12,7 @@ class ProtectFromImportingNonDependencies { compiler.hooks.normalModuleFactory.tap("irrelevant", (normalModuleFactory) => { normalModuleFactory.hooks.resolve.tap("irrelevant", (toBeResolved) => { + const isSassDependency = toBeResolved.request.endsWith(".scss"); const isLocalDependency = toBeResolved.request.startsWith("."); const isDependencyOfDependency = toBeResolved.context.includes("node_modules"); @@ -19,7 +20,7 @@ class ProtectFromImportingNonDependencies { const dependencyName = getDependencyName(toBeResolved.request); const dependencyWeAreInterested = - !isLocalDependency && !isDependencyOfDependency && dependencyName; + !isSassDependency && !isLocalDependency && !isDependencyOfDependency && dependencyName; if (dependencyWeAreInterested) { nodeModulesToBeResolved.add(dependencyName); From 34c7d8547c2d998c5caa5beec5db19b3a71de046 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 12:24:37 +0200 Subject: [PATCH 04/11] feat: extract resizing-anchor Signed-off-by: Gabriel --- package-lock.json | 58 ++++++++++++++++++- packages/core/package.json | 1 + .../src/renderer/components/dock/dock.tsx | 2 +- .../src/renderer/components/drawer/drawer.tsx | 2 +- .../components/layout/main-layout.tsx | 2 +- packages/open-lens/src/renderer/index.ts | 1 + .../resizing-anchor/.eslintrc.json | 6 ++ .../ui-components/resizing-anchor/.prettierrc | 1 + packages/ui-components/resizing-anchor/.swcrc | 19 ++++++ .../ui-components/resizing-anchor/README.md | 15 +++++ .../ui-components/resizing-anchor/index.ts | 6 ++ .../resizing-anchor/jest.config.js | 1 + .../resizing-anchor/package.json | 50 ++++++++++++++++ .../resizing-anchor/src}/index.ts | 0 .../resizing-anchor/src}/resizing-anchor.scss | 0 .../resizing-anchor/src}/resizing-anchor.tsx | 0 .../resizing-anchor/tailwind.config.js | 30 ++++++++++ .../resizing-anchor/tsconfig.json | 4 ++ .../resizing-anchor/webpack.config.js | 1 + 19 files changed, 195 insertions(+), 4 deletions(-) create mode 100644 packages/ui-components/resizing-anchor/.eslintrc.json create mode 100644 packages/ui-components/resizing-anchor/.prettierrc create mode 100644 packages/ui-components/resizing-anchor/.swcrc create mode 100644 packages/ui-components/resizing-anchor/README.md create mode 100644 packages/ui-components/resizing-anchor/index.ts create mode 100644 packages/ui-components/resizing-anchor/jest.config.js create mode 100644 packages/ui-components/resizing-anchor/package.json rename packages/{core/src/renderer/components/resizing-anchor => ui-components/resizing-anchor/src}/index.ts (100%) rename packages/{core/src/renderer/components/resizing-anchor => ui-components/resizing-anchor/src}/resizing-anchor.scss (100%) rename packages/{core/src/renderer/components/resizing-anchor => ui-components/resizing-anchor/src}/resizing-anchor.tsx (100%) create mode 100644 packages/ui-components/resizing-anchor/tailwind.config.js create mode 100644 packages/ui-components/resizing-anchor/tsconfig.json create mode 100644 packages/ui-components/resizing-anchor/webpack.config.js diff --git a/package-lock.json b/package-lock.json index 6458f6172c..7ffe6c10dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3946,6 +3946,10 @@ "resolved": "packages/release-tool", "link": true }, + "node_modules/@k8slens/resizing-anchor": { + "resolved": "packages/ui-components/resizing-anchor", + "link": true + }, "node_modules/@k8slens/run-many": { "resolved": "packages/utility-features/run-many", "link": true @@ -35064,10 +35068,11 @@ "@k8slens/messaging": "^1.0.0-alpha.1", "@k8slens/messaging-for-main": "^1.0.0-alpha.1", "@k8slens/messaging-for-renderer": "^1.0.0-alpha.1", + "@k8slens/resizing-anchor": "^1.0.0-alpha.0", + "@k8slens/tooltip": "^1.0.0-alpha.0", "@k8slens/run-many": "^1.0.0-alpha.1", "@k8slens/startable-stoppable": "^1.0.0-alpha.1", "@k8slens/test-utils": "^1.0.0-alpha.1", - "@k8slens/tooltip": "^1.0.0-alpha.0", "@k8slens/utilities": "^1.0.0-alpha.1", "@ogre-tools/fp": "^15.3.1", "@ogre-tools/injectable": "^15.3.1", @@ -36606,6 +36611,57 @@ "react-dom": "^17.0.2" } }, + "packages/ui-components/resizing-anchor": { + "name": "@k8slens/resizing-anchor", + "version": "1.0.0-alpha.0", + "license": "MIT", + "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" + }, + "peerDependencies": { + "@k8slens/feature-core": "^6.5.0-alpha.0", + "@k8slens/utilities": "^1.0.0-alpha.1", + "@ogre-tools/fp": "^15.1.2", + "@ogre-tools/injectable": "^15.1.2", + "@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2", + "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" + } + }, + "packages/ui-components/resizing-anchor/node_modules/@k8slens/eslint-config": { + "version": "6.5.0-alpha.1", + "resolved": "https://registry.npmjs.org/@k8slens/eslint-config/-/eslint-config-6.5.0-alpha.1.tgz", + "integrity": "sha512-6DdfKe/iafX85GBK/UlKgz29FOIOp/UVS03bFGLyw7Vmm7pauB0FEHTAdbr3g1qG/Zcn6nxhOM3uqQyRY/uEyA==", + "dev": true, + "bin": { + "lens-lint": "bin/lint" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": ">= 5", + "@typescript-eslint/parser": ">= 5", + "eslint": ">= 7", + "eslint-config-airbnb-typescript": ">= 17", + "eslint-config-prettier": ">= 8", + "eslint-config-react-app": "^7.0.1", + "eslint-plugin-import": ">= 2", + "eslint-plugin-jest": ">= 27", + "eslint-plugin-jsx-a11y": ">= 6", + "eslint-plugin-no-unsanitized": ">= 4.0.2", + "eslint-plugin-prettier": ">= 4", + "eslint-plugin-react-hooks": ">= 4", + "eslint-plugin-security": ">= 1.6.0", + "eslint-plugin-simple-import-sort": ">= 7", + "eslint-plugin-unused-imports": ">= 2", + "eslint-plugin-xss": ">= 0.1.12", + "prettier": ">= 2" + } + }, "packages/ui-components/tooltip": { "name": "@k8slens/tooltip", "version": "1.0.0-alpha.0", diff --git a/packages/core/package.json b/packages/core/package.json index be95235ca4..ba20139b92 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -322,6 +322,7 @@ "@k8slens/startable-stoppable": "^1.0.0-alpha.1", "@k8slens/test-utils": "^1.0.0-alpha.1", "@k8slens/tooltip": "^1.0.0-alpha.0", + "@k8slens/resizing-anchor": "^1.0.0-alpha.0", "@k8slens/utilities": "^1.0.0-alpha.1", "@ogre-tools/fp": "^15.3.1", "@ogre-tools/injectable": "^15.3.1", diff --git a/packages/core/src/renderer/components/dock/dock.tsx b/packages/core/src/renderer/components/dock/dock.tsx index 4d18c316d9..c6111a31f4 100644 --- a/packages/core/src/renderer/components/dock/dock.tsx +++ b/packages/core/src/renderer/components/dock/dock.tsx @@ -10,7 +10,7 @@ import { cssNames } from "@k8slens/utilities"; import { Icon } from "../icon"; import { MenuItem } from "../menu"; import { MenuActions } from "../menu/menu-actions"; -import { ResizeDirection, ResizingAnchor } from "../resizing-anchor"; +import { ResizeDirection, ResizingAnchor } from "@k8slens/resizing-anchor"; import { CreateResource } from "./create-resource/view"; import { DockTabs } from "./dock-tabs"; import type { DockStore, DockTab } from "./dock/store"; diff --git a/packages/core/src/renderer/components/drawer/drawer.tsx b/packages/core/src/renderer/components/drawer/drawer.tsx index 5959c0c098..3a4f2a72f4 100644 --- a/packages/core/src/renderer/components/drawer/drawer.tsx +++ b/packages/core/src/renderer/components/drawer/drawer.tsx @@ -13,7 +13,7 @@ import { cssNames, noop } from "@k8slens/utilities"; import { Icon } from "../icon"; import type { AnimateName } from "../animate"; import { Animate } from "../animate"; -import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "../resizing-anchor"; +import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor"; import drawerStorageInjectable, { defaultDrawerWidth } from "./drawer-storage/drawer-storage.injectable"; import { withInjectables } from "@ogre-tools/injectable-react"; import historyInjectable from "../../navigation/history.injectable"; diff --git a/packages/core/src/renderer/components/layout/main-layout.tsx b/packages/core/src/renderer/components/layout/main-layout.tsx index a078ac7b74..c97327cfe5 100755 --- a/packages/core/src/renderer/components/layout/main-layout.tsx +++ b/packages/core/src/renderer/components/layout/main-layout.tsx @@ -9,7 +9,7 @@ import React from "react"; import { observer } from "mobx-react"; import { cssNames } from "@k8slens/utilities"; import { ErrorBoundary } from "../error-boundary"; -import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "../resizing-anchor"; +import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor"; import { withInjectables } from "@ogre-tools/injectable-react"; import type { SidebarStorageState } from "./sidebar-storage/sidebar-storage.injectable"; import sidebarStorageInjectable, { defaultSidebarWidth } from "./sidebar-storage/sidebar-storage.injectable"; diff --git a/packages/open-lens/src/renderer/index.ts b/packages/open-lens/src/renderer/index.ts index 2446390d29..3c24d56065 100644 --- a/packages/open-lens/src/renderer/index.ts +++ b/packages/open-lens/src/renderer/index.ts @@ -1,5 +1,6 @@ import "@k8slens/core/styles"; import "@k8slens/tooltip/dist/index.css"; +import "@k8slens/resizing-anchor/dist/index.css"; import { runInAction } from "mobx"; import { rendererExtensionApi as Renderer, diff --git a/packages/ui-components/resizing-anchor/.eslintrc.json b/packages/ui-components/resizing-anchor/.eslintrc.json new file mode 100644 index 0000000000..b15115cb69 --- /dev/null +++ b/packages/ui-components/resizing-anchor/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "extends": "@k8slens/eslint-config/eslint", + "parserOptions": { + "project": "./tsconfig.json" + } +} diff --git a/packages/ui-components/resizing-anchor/.prettierrc b/packages/ui-components/resizing-anchor/.prettierrc new file mode 100644 index 0000000000..edd47b479e --- /dev/null +++ b/packages/ui-components/resizing-anchor/.prettierrc @@ -0,0 +1 @@ +"@k8slens/eslint-config/prettier" diff --git a/packages/ui-components/resizing-anchor/.swcrc b/packages/ui-components/resizing-anchor/.swcrc new file mode 100644 index 0000000000..4dd5c11a89 --- /dev/null +++ b/packages/ui-components/resizing-anchor/.swcrc @@ -0,0 +1,19 @@ +{ + "module": { + "type": "commonjs" + }, + "jsc": { + "parser": { + "syntax": "typescript", + "tsx": true, + "decorators": true, + "dynamicImport": false + }, + "transform": { + "legacyDecorator": true, + "decoratorMetadata": true + }, + "target": "es2019" + } +} + diff --git a/packages/ui-components/resizing-anchor/README.md b/packages/ui-components/resizing-anchor/README.md new file mode 100644 index 0000000000..bcf7e3003e --- /dev/null +++ b/packages/ui-components/resizing-anchor/README.md @@ -0,0 +1,15 @@ +# @k8slens/resizing-anchor + +This package contains stuff related to creating Lens-applications. + +# Usage + +```bash +$ npm install @k8slens/resizing-anchor +``` + +```typescript +import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor"; +``` + +## Extendability diff --git a/packages/ui-components/resizing-anchor/index.ts b/packages/ui-components/resizing-anchor/index.ts new file mode 100644 index 0000000000..f76358c781 --- /dev/null +++ b/packages/ui-components/resizing-anchor/index.ts @@ -0,0 +1,6 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +export * from "./src/resizing-anchor"; diff --git a/packages/ui-components/resizing-anchor/jest.config.js b/packages/ui-components/resizing-anchor/jest.config.js new file mode 100644 index 0000000000..38d54ab7b6 --- /dev/null +++ b/packages/ui-components/resizing-anchor/jest.config.js @@ -0,0 +1 @@ +module.exports = require("@k8slens/jest").monorepoPackageConfig(__dirname).configForReact; diff --git a/packages/ui-components/resizing-anchor/package.json b/packages/ui-components/resizing-anchor/package.json new file mode 100644 index 0000000000..5df84aacfa --- /dev/null +++ b/packages/ui-components/resizing-anchor/package.json @@ -0,0 +1,50 @@ +{ + "name": "@k8slens/resizing-anchor", + "private": false, + "version": "1.0.0-alpha.0", + "description": "Highly extendable resizing-anchor 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", + "test:unit": "jest --coverage --runInBand", + "lint": "lens-lint", + "lint:fix": "lens-lint --fix" + }, + "peerDependencies": { + "@k8slens/feature-core": "^6.5.0-alpha.0", + "@k8slens/utilities": "^1.0.0-alpha.1", + "@ogre-tools/injectable": "^15.1.2", + "@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2", + "@ogre-tools/fp": "^15.1.2", + "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" + } +} diff --git a/packages/core/src/renderer/components/resizing-anchor/index.ts b/packages/ui-components/resizing-anchor/src/index.ts similarity index 100% rename from packages/core/src/renderer/components/resizing-anchor/index.ts rename to packages/ui-components/resizing-anchor/src/index.ts diff --git a/packages/core/src/renderer/components/resizing-anchor/resizing-anchor.scss b/packages/ui-components/resizing-anchor/src/resizing-anchor.scss similarity index 100% rename from packages/core/src/renderer/components/resizing-anchor/resizing-anchor.scss rename to packages/ui-components/resizing-anchor/src/resizing-anchor.scss diff --git a/packages/core/src/renderer/components/resizing-anchor/resizing-anchor.tsx b/packages/ui-components/resizing-anchor/src/resizing-anchor.tsx similarity index 100% rename from packages/core/src/renderer/components/resizing-anchor/resizing-anchor.tsx rename to packages/ui-components/resizing-anchor/src/resizing-anchor.tsx diff --git a/packages/ui-components/resizing-anchor/tailwind.config.js b/packages/ui-components/resizing-anchor/tailwind.config.js new file mode 100644 index 0000000000..59cf6201b3 --- /dev/null +++ b/packages/ui-components/resizing-anchor/tailwind.config.js @@ -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: [], +}; diff --git a/packages/ui-components/resizing-anchor/tsconfig.json b/packages/ui-components/resizing-anchor/tsconfig.json new file mode 100644 index 0000000000..9e140d79da --- /dev/null +++ b/packages/ui-components/resizing-anchor/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@k8slens/typescript/config/base.json", + "include": ["**/*.ts", "**/*.tsx"], +} diff --git a/packages/ui-components/resizing-anchor/webpack.config.js b/packages/ui-components/resizing-anchor/webpack.config.js new file mode 100644 index 0000000000..1cda407f5a --- /dev/null +++ b/packages/ui-components/resizing-anchor/webpack.config.js @@ -0,0 +1 @@ +module.exports = require("@k8slens/webpack").configForReact; From 0b067a19a39fb48907aac150247ab2ef10d47c37 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 12:32:16 +0200 Subject: [PATCH 05/11] fix: remove default test script Signed-off-by: Gabriel --- packages/ui-components/resizing-anchor/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ui-components/resizing-anchor/package.json b/packages/ui-components/resizing-anchor/package.json index 5df84aacfa..368885050e 100644 --- a/packages/ui-components/resizing-anchor/package.json +++ b/packages/ui-components/resizing-anchor/package.json @@ -25,7 +25,6 @@ "homepage": "https://github.com/lensapp/lens", "scripts": { "build": "webpack", - "test:unit": "jest --coverage --runInBand", "lint": "lens-lint", "lint:fix": "lens-lint --fix" }, From 9c97fda2114959d2bf1b0c18e0c815fc6d416519 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 13:09:18 +0200 Subject: [PATCH 06/11] fix: sass is not a dependency Signed-off-by: Gabriel --- .../src/plugins/protect-from-importing-non-dependencies.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js b/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js index 47331b9c76..f73124c567 100644 --- a/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js +++ b/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js @@ -20,7 +20,7 @@ class ProtectFromImportingNonDependencies { const dependencyName = getDependencyName(toBeResolved.request); const dependencyWeAreInterested = - !isSassDependency && !isLocalDependency && !isDependencyOfDependency && dependencyName; + !isSassDependency && !isLocalDependency && !isDependencyOfDependency && dependencyName; if (dependencyWeAreInterested) { nodeModulesToBeResolved.add(dependencyName); From fe3534ac44d05185d5e5d97afc8e11917ff84b81 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 18:11:38 +0200 Subject: [PATCH 07/11] fix: rename file for new config Signed-off-by: Gabriel --- packages/core/src/{jest.setup.tsx => jest.setup.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/core/src/{jest.setup.tsx => jest.setup.ts} (100%) diff --git a/packages/core/src/jest.setup.tsx b/packages/core/src/jest.setup.ts similarity index 100% rename from packages/core/src/jest.setup.tsx rename to packages/core/src/jest.setup.ts From 6edfd68d4e4fd44102f533cc70028a1c8cf6ecef Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 18:21:56 +0200 Subject: [PATCH 08/11] fix: renamed jest.setup back to tsx and aligned package.json --- packages/core/package.json | 2 +- packages/core/src/{jest.setup.ts => jest.setup.tsx} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/core/src/{jest.setup.ts => jest.setup.tsx} (100%) diff --git a/packages/core/package.json b/packages/core/package.json index 714947981e..ba20139b92 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -84,7 +84,7 @@ "/static/build" ], "setupFiles": [ - "/src/jest.setup.ts", + "/src/jest.setup.tsx", "jest-canvas-mock" ], "globalSetup": "/src/jest.timezone.ts", diff --git a/packages/core/src/jest.setup.ts b/packages/core/src/jest.setup.tsx similarity index 100% rename from packages/core/src/jest.setup.ts rename to packages/core/src/jest.setup.tsx From d96807ec744bb3ea9ada85ce3699d0697da97bf5 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 19:02:06 +0200 Subject: [PATCH 09/11] fix: remove test script for tooltip Signed-off-by: Gabriel --- packages/ui-components/tooltip/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ui-components/tooltip/package.json b/packages/ui-components/tooltip/package.json index ebe465a1e2..179361a21c 100644 --- a/packages/ui-components/tooltip/package.json +++ b/packages/ui-components/tooltip/package.json @@ -25,7 +25,6 @@ "homepage": "https://github.com/lensapp/lens", "scripts": { "build": "webpack", - "test:unit": "jest --coverage --runInBand", "lint": "lens-lint", "lint:fix": "lens-lint --fix" }, From 04da77ad0b9a768602664b1a8a113f7e3406ef03 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 19:06:36 +0200 Subject: [PATCH 10/11] fix: re-add tooltip test with updated package Signed-off-by: Gabriel --- package-lock.json | 4 ++-- packages/ui-components/tooltip/package.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7ffe6c10dd..dc2d90860a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35069,10 +35069,10 @@ "@k8slens/messaging-for-main": "^1.0.0-alpha.1", "@k8slens/messaging-for-renderer": "^1.0.0-alpha.1", "@k8slens/resizing-anchor": "^1.0.0-alpha.0", - "@k8slens/tooltip": "^1.0.0-alpha.0", "@k8slens/run-many": "^1.0.0-alpha.1", "@k8slens/startable-stoppable": "^1.0.0-alpha.1", "@k8slens/test-utils": "^1.0.0-alpha.1", + "@k8slens/tooltip": "^1.0.0-alpha.0", "@k8slens/utilities": "^1.0.0-alpha.1", "@ogre-tools/fp": "^15.3.1", "@ogre-tools/injectable": "^15.3.1", @@ -35152,7 +35152,7 @@ "version": "6.5.0-alpha.7", "license": "MIT", "dependencies": { - "@k8slens/core": "^6.5.0-alpha.7" + "@k8slens/core": "6.5.0-alpha.7" }, "devDependencies": { "@types/node": "^16.18.6", diff --git a/packages/ui-components/tooltip/package.json b/packages/ui-components/tooltip/package.json index 179361a21c..ebe465a1e2 100644 --- a/packages/ui-components/tooltip/package.json +++ b/packages/ui-components/tooltip/package.json @@ -25,6 +25,7 @@ "homepage": "https://github.com/lensapp/lens", "scripts": { "build": "webpack", + "test:unit": "jest --coverage --runInBand", "lint": "lens-lint", "lint:fix": "lens-lint --fix" }, From f20302a87b8b27d413ea4901a1236a9b0077b663 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 19 Apr 2023 21:05:09 +0200 Subject: [PATCH 11/11] fix: fix formatting alignment Signed-off-by: Gabriel --- .../src/plugins/protect-from-importing-non-dependencies.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js b/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js index f73124c567..47331b9c76 100644 --- a/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js +++ b/packages/infrastructure/webpack/src/plugins/protect-from-importing-non-dependencies.js @@ -20,7 +20,7 @@ class ProtectFromImportingNonDependencies { const dependencyName = getDependencyName(toBeResolved.request); const dependencyWeAreInterested = - !isSassDependency && !isLocalDependency && !isDependencyOfDependency && dependencyName; + !isSassDependency && !isLocalDependency && !isDependencyOfDependency && dependencyName; if (dependencyWeAreInterested) { nodeModulesToBeResolved.add(dependencyName);