Create Libraries and basic tooltip

This commit is contained in:
2023-08-25 22:09:18 +02:00
parent 82561d8dc7
commit 14c1b97622
81 changed files with 9117 additions and 2036 deletions

View File

@@ -0,0 +1,42 @@
{
"extends": [
"../../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.json"
],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}

View File

@@ -0,0 +1,19 @@
# _internal-controllers
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build _internal-controllers` to build the library.
## Running unit tests
Run `nx test _internal-controllers` to execute the unit tests via [Jest](https://jestjs.io).

View File

@@ -0,0 +1,10 @@
{
"name": "@z-elements/_internal/controllers",
"version": "0.0.1",
"dependencies": {
"tslib": "^2.3.0"
},
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts"
}

View File

@@ -0,0 +1,45 @@
{
"name": "_internal-controllers",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/_internal/controllers/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/libs/_internal/controllers",
"main": "libs/_internal/controllers/src/index.ts",
"tsConfig": "libs/_internal/controllers/tsconfig.lib.json",
"assets": [
"libs/_internal/controllers/*.md"
]
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": [
"{options.outputFile}"
],
"options": {
"lintFilePatterns": [
"libs/_internal/controllers/**/*.ts",
"libs/_internal/controllers/package.json"
]
}
},
"test": {
"executor": "@nx/vite:test",
"outputs": [
"{options.reportsDirectory}"
],
"options": {
"passWithNoTests": true,
"reportsDirectory": "../../../coverage/libs/_internal/controllers"
}
}
},
"tags": []
}

View File

@@ -0,0 +1 @@
export * from './lib/destroy.controller';

View File

@@ -0,0 +1,28 @@
import { ReactiveController, ReactiveControllerHost } from 'lit';
import { Subject } from 'rxjs';
export class DestroyController implements ReactiveController {
/** Private variables */
private readonly _host: ReactiveControllerHost;
private readonly destroy$ = new Subject<void>();
/** Protected variables */
/** Public variables */
public readonly destroy = this.destroy$.asObservable();
/** constructor & lifecylce */
constructor(host: ReactiveControllerHost) {
(this._host = host).addController(this);
}
/** Public methods */
public hostDisconnected() {
this.destroy$.next();
this.destroy$.complete();
}
/** Protected methods */
/** Private methods */
}

View File

@@ -0,0 +1,25 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"types": [
"vitest"
]
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

View File

@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}

View File

@@ -0,0 +1,19 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node"]
},
"include": [
"vite.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}

View File

@@ -0,0 +1,35 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
export default defineConfig({
cacheDir: '../../../node_modules/.vite/_internal-controllers',
plugins: [
nxViteTsPaths(),
],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
test: {
globals: true,
cache: {
dir: '../../../node_modules/.vitest'
},
environment: 'node',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
},
});