Create Libraries and basic tooltip
This commit is contained in:
42
libs/_internal/directives/.eslintrc.json
Normal file
42
libs/_internal/directives/.eslintrc.json
Normal 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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
19
libs/_internal/directives/README.md
Normal file
19
libs/_internal/directives/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# _internal-directives
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build _internal-directives` to build the library.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test _internal-directives` to execute the unit tests via [Jest](https://jestjs.io).
|
||||
|
||||
|
||||
10
libs/_internal/directives/package.json
Normal file
10
libs/_internal/directives/package.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@z-elements/_internal/directives",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"main": "./src/index.js",
|
||||
"typings": "./src/index.d.ts"
|
||||
}
|
||||
45
libs/_internal/directives/project.json
Normal file
45
libs/_internal/directives/project.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "_internal-directives",
|
||||
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/_internal/directives/src",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/_internal/directives",
|
||||
"main": "libs/_internal/directives/src/index.ts",
|
||||
"tsConfig": "libs/_internal/directives/tsconfig.lib.json",
|
||||
"assets": [
|
||||
"libs/_internal/directives/*.md"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
],
|
||||
"options": {
|
||||
"lintFilePatterns": [
|
||||
"libs/_internal/directives/**/*.ts",
|
||||
"libs/_internal/directives/package.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/vite:test",
|
||||
"outputs": [
|
||||
"{options.reportsDirectory}"
|
||||
],
|
||||
"options": {
|
||||
"passWithNoTests": true,
|
||||
"reportsDirectory": "../../../coverage/libs/_internal/directives"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
1
libs/_internal/directives/src/index.ts
Normal file
1
libs/_internal/directives/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { asyncDirective } from './lib/async-directive';
|
||||
28
libs/_internal/directives/src/lib/async-directive.ts
Normal file
28
libs/_internal/directives/src/lib/async-directive.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { noChange } from 'lit';
|
||||
import { AsyncDirective, directive } from 'lit/async-directive.js';
|
||||
import { Observable, Subject, tap } from 'rxjs';
|
||||
|
||||
class Async extends AsyncDirective {
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
render(observable: Observable<unknown>) {
|
||||
observable
|
||||
.pipe(
|
||||
tap((value: unknown) => {
|
||||
this.setValue(value);
|
||||
}),
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
return noChange;
|
||||
}
|
||||
|
||||
protected override disconnected(): void {
|
||||
super.disconnected();
|
||||
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
}
|
||||
|
||||
export const asyncDirective = directive(Async);
|
||||
25
libs/_internal/directives/tsconfig.json
Normal file
25
libs/_internal/directives/tsconfig.json
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
10
libs/_internal/directives/tsconfig.lib.json
Normal file
10
libs/_internal/directives/tsconfig.lib.json
Normal 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"]
|
||||
}
|
||||
19
libs/_internal/directives/tsconfig.spec.json
Normal file
19
libs/_internal/directives/tsconfig.spec.json
Normal 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"
|
||||
]
|
||||
}
|
||||
35
libs/_internal/directives/vite.config.ts
Normal file
35
libs/_internal/directives/vite.config.ts
Normal 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-directives',
|
||||
|
||||
|
||||
|
||||
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}'],
|
||||
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user