Compare commits
No commits in common. "master" and "v1.0.36" have entirely different histories.
@ -1,66 +0,0 @@
|
||||
name: Default (not tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install pnpm and npmci
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
|
||||
- name: Run npm prepare
|
||||
run: npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
@ -1,124 +0,0 @@
|
||||
name: Default (tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
||||
|
||||
release:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Release
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm publish
|
||||
|
||||
metadata:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Code quality
|
||||
run: |
|
||||
npmci command npm install -g typescript
|
||||
npmci npm install
|
||||
|
||||
- name: Trigger
|
||||
run: npmci trigger
|
||||
|
||||
- name: Build docs and upload artifacts
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
pnpm install -g @git.zone/tsdoc
|
||||
npmci command tsdoc
|
||||
continue-on-error: true
|
@ -12,36 +12,40 @@ stages:
|
||||
- release
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- pnpm install -g pnpm
|
||||
- pnpm install -g @shipzone/npmci
|
||||
- npmci npm prepare
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command pnpm audit --audit-level=high --prod
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command pnpm audit --audit-level=high --dev
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
@ -52,6 +56,7 @@ auditDevDependencies:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
@ -62,9 +67,10 @@ testStable:
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm build
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
@ -90,9 +96,10 @@ codequality:
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g typescript
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
@ -112,9 +119,11 @@ trigger:
|
||||
pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command npm run buildDocs
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,10 +2,28 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "npm test",
|
||||
"name": "Run npm test",
|
||||
"name": "current file",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
"args": [
|
||||
"${relativeFile}"
|
||||
],
|
||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
},
|
||||
{
|
||||
"name": "test.ts",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"test/test.ts"
|
||||
],
|
||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
362
changelog.md
362
changelog.md
@ -1,362 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## 2025-04-18 - 2.0.42 - fix(directives)
|
||||
Add explicit type annotations to subscribeWithTemplate directive export
|
||||
|
||||
- Imported DirectiveResult type for better typing
|
||||
- Defined SubscribeWithTemplateFn signature to ensure proper type inference
|
||||
- Used type assertion with 'as SubscribeWithTemplateFn' to improve type safety
|
||||
|
||||
## 2025-04-18 - 2.0.41 - fix(directives)
|
||||
Refactor export statements in directives index for consistency
|
||||
|
||||
- Changed individual export of 'resolve' and 'subscribe' to wildcard exports in ts/directives/index.ts
|
||||
- Simplified module export structure without altering functionality
|
||||
|
||||
## 2025-04-18 - 2.0.40 - fix(dees-element)
|
||||
Refactor project structure and update dependency versions. Internal modules (e.g. dees-element classes and directives) have been reorganized and deprecated paths removed, and package.json now includes an updated packageManager field.
|
||||
|
||||
- Updated versions for @git.zone/tsbuild, tsbundle, tstest, tapbundle, and lit.
|
||||
- Changed dependency @design.estate/dees-domtools from ^2.0.61 to ^2.3.2.
|
||||
- Reorganized internal file structure: moved code from dees-element.classes.* to classes.* and re-exported via index.
|
||||
- Added packageManager field in package.json for pnpm configuration.
|
||||
|
||||
## 2024-10-04 - 2.0.39 - fix(core)
|
||||
Update dependency version for @design.estate/dees-domtools
|
||||
|
||||
- Bumped @design.estate/dees-domtools dependency to version ^2.0.61 to include latest patches and improvements.
|
||||
|
||||
## 2024-10-02 - 2.0.38 - fix(dependencies)
|
||||
Bump `@design.estate/dees-domtools` to 2.0.60
|
||||
|
||||
- Updated @design.estate/dees-domtools from 2.0.59 to 2.0.60
|
||||
|
||||
## 2024-10-02 - 2.0.37 - fix(dependencies)
|
||||
Update dependencies to latest versions.
|
||||
|
||||
- Updated @git.zone/tsbuild from ^2.1.82 to ^2.1.84
|
||||
- Updated @types/node from ^20.14.9 to ^22.7.4
|
||||
- Updated @push.rocks/tapbundle from ^5.0.23 to ^5.3.0
|
||||
- Updated @design.estate/dees-domtools from ^2.0.57 to ^2.0.59
|
||||
- Updated lit from ^3.1.4 to ^3.2.0
|
||||
|
||||
## 2024-07-01 - 2.0.36 - fix(core)
|
||||
Ensure documentation completeness and code quality improvements
|
||||
|
||||
- Improved the README.md file to provide more detailed usage instructions and examples.
|
||||
- Refactored code for better readability and performance.
|
||||
- Updated npmextra.json to ensure accurate project metadata and configurations.
|
||||
|
||||
## 2024-07-01 - 2.0.35 - fix(dependencies)
|
||||
Update dependency versions and development dependencies
|
||||
|
||||
- Update @git.zone/tsbuild to version ^2.1.82
|
||||
- Update @git.zone/tstest to version ^1.0.90
|
||||
- Update @push.rocks/tapbundle to version ^5.0.23
|
||||
- Update @types/node to version ^20.14.9
|
||||
- Update lit to version ^3.1.4
|
||||
|
||||
## 2024-04-20 - 2.0.34 - Documentation
|
||||
Updated project documentation.
|
||||
|
||||
- Refreshed the documentation to include recent changes and improvements.
|
||||
|
||||
## 2023-10-31 - 2.0.33 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-10-26 - 2.0.32 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-10-23 - 2.0.31 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-10-23 - 2.0.30 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-09-17 - 2.0.29 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-09-17 - 2.0.28 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-09-04 - 2.0.27 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-09-04 - 2.0.26 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-08-07 - 2.0.25 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-08-07 - 2.0.24 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-08-07 - 2.0.23 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-03-29 - 2.0.22 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-03-29 - 2.0.21 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-03-26 - 2.0.20 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2023-03-15 - 2.0.19 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-12-31 - 2.0.18 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-12-31 - 2.0.17 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-05-21 - 2.0.16 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-05-12 - 2.0.15 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-05-02 - 2.0.14 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-05-01 - 2.0.13 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-04-22 - 2.0.12 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-04-21 - 2.0.11 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-04-19 - 2.0.10 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-04-19 - 2.0.9 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-04-18 - 2.0.8 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-04-15 - 2.0.7 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-03-29 - 2.0.6 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-03-25 - 2.0.5 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-03-24 - 2.0.4 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-03-23 - 2.0.3 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-03-16 - 2.0.2 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-03-16 - 2.0.1 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-03-16 - 2.0.0 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-03-16 - 1.0.36 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-01-07 - 1.0.35 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-01-06 - 1.0.34 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-01-06 - 1.0.33 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2022-01-06 - 1.0.32 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-12-14 - 1.0.31 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-12-13 - 1.0.30 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-12-10 - 1.0.29 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-12-10 - 1.0.28 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-11-27 - 1.0.27 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-09-27 - 1.0.26 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-09-16 - 1.0.25 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-09-16 - 1.0.24 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-09-13 - 1.0.23 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-09-08 - 1.0.22 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-09-08 - 1.0.21 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-09-08 - 1.0.20 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-03-29 - 1.0.19 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-03-29 - 1.0.18 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-03-29 - 1.0.17 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-03-28 - 1.0.16 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-03-28 - 1.0.15 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-03-28 - 1.0.14 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-03-27 - 1.0.13 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-03-27 - 1.0.12 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
||||
|
||||
## 2021-03-27 - 1.0.11 - Core
|
||||
Minor core fixes and optimizations.
|
||||
|
||||
- Updated core functionalities to improve performance.
|
@ -2,32 +2,17 @@
|
||||
"gitzone": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "code.foss.global",
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "designestate",
|
||||
"gitrepo": "dees-element",
|
||||
"description": "A library for creating custom elements extending the lit element class with additional functionalities.",
|
||||
"shortDescription": "a custom element class extending lit element class",
|
||||
"npmPackagename": "@designestate/dees-element",
|
||||
"license": "MIT",
|
||||
"projectDomain": "design.estate",
|
||||
"keywords": [
|
||||
"custom elements",
|
||||
"lit",
|
||||
"TypeScript",
|
||||
"CSS manager",
|
||||
"themes",
|
||||
"decorators",
|
||||
"async directive",
|
||||
"web components",
|
||||
"reactive programming",
|
||||
"DOM manipulation"
|
||||
]
|
||||
"projectDomain": "design.estate"
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||
}
|
||||
}
|
19505
package-lock.json
generated
Normal file
19505
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
44
package.json
44
package.json
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "@design.estate/dees-element",
|
||||
"version": "2.0.42",
|
||||
"name": "@designestate/dees-element",
|
||||
"version": "1.0.36",
|
||||
"private": false,
|
||||
"description": "A library for creating custom elements extending the lit element class with additional functionalities.",
|
||||
"description": "a custom element class extending lit element class",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
@ -10,21 +10,22 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/ --web)",
|
||||
"build": "(tsbuild --web --allowimplicitany && tsbundle npm)",
|
||||
"buildDocs": "tsdoc"
|
||||
"build": "(tsbuild --web --allowimplicitany --skiplibcheck && tsbundle npm)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.3.2",
|
||||
"@git.zone/tsbundle": "^2.2.5",
|
||||
"@git.zone/tstest": "^1.0.96",
|
||||
"@push.rocks/tapbundle": "^5.6.3",
|
||||
"@types/node": "^22.14.1"
|
||||
"@gitzone/tsbuild": "^2.1.56",
|
||||
"@gitzone/tsbundle": "^1.0.98",
|
||||
"@gitzone/tstest": "^1.0.68",
|
||||
"@pushrocks/tapbundle": "^5.0.2",
|
||||
"@types/node": "^17.0.21",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@design.estate/dees-domtools": "^2.3.2",
|
||||
"@push.rocks/isounique": "^1.0.5",
|
||||
"@push.rocks/smartrx": "^3.0.7",
|
||||
"lit": "^3.3.0"
|
||||
"@designestate/dees-domtools": "^2.0.0",
|
||||
"@pushrocks/isounique": "^1.0.5",
|
||||
"@pushrocks/smartrx": "^2.0.25",
|
||||
"lit": "^2.2.1"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
@ -40,18 +41,5 @@
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"keywords": [
|
||||
"custom elements",
|
||||
"lit",
|
||||
"TypeScript",
|
||||
"CSS manager",
|
||||
"themes",
|
||||
"decorators",
|
||||
"async directive",
|
||||
"web components",
|
||||
"reactive programming",
|
||||
"DOM manipulation"
|
||||
],
|
||||
"packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6"
|
||||
]
|
||||
}
|
||||
|
9861
pnpm-lock.yaml
generated
9861
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
|
182
readme.md
182
readme.md
@ -1,167 +1,39 @@
|
||||
# @design.estate/dees-element
|
||||
# @designestate/dees-element
|
||||
a custom element class extending lit element class
|
||||
|
||||
## Install
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@designestate/dees-element)
|
||||
* [gitlab.com (source)](https://gitlab.com/designestate/dees-element)
|
||||
* [github.com (source mirror)](https://github.com/designestate/dees-element)
|
||||
* [docs (typedoc)](https://designestate.gitlab.io/dees-element/)
|
||||
|
||||
To install `@design.estate/dees-element`, you need to run the following command using npm:
|
||||
## Status for master
|
||||
|
||||
```bash
|
||||
npm install @design.estate/dees-element
|
||||
```
|
||||
|
||||
Ensure you have TypeScript and the necessary compilers configured in your development environment since this package uses ESM syntax and TypeScript.
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||
npm | [](https://lossless.cloud)
|
||||
Snyk | [](https://lossless.cloud)
|
||||
TypeScript Support | [](https://lossless.cloud)
|
||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
This section provides a comprehensive exploration into the usage of `@design.estate/dees-element`, offering examples to illustrate its capabilities in creating custom elements by extending the lit element class. All examples assume the use of ESM syntax and TypeScript, aligning with modern best practices in web development.
|
||||
Use TypeScript for best in class intellisense
|
||||
|
||||
`@design.estate/dees-element` serves as a robust foundation for building custom web components, leveraging the power of the Lit library for reactive updates and efficient rendering management. This guide takes you through the process of creating, styling, and interacting with your custom elements.
|
||||
## Contribution
|
||||
|
||||
### Getting Started
|
||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
||||
|
||||
Firstly, ensure you have installed the package as described in the installation section. Once installed, you can start creating custom elements. Let's begin with a simple example:
|
||||
For further information read the linked docs at the top of this readme.
|
||||
|
||||
#### Define a Custom Element
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
|
||||
Create a file named `MyElement.ts`:
|
||||
|
||||
```typescript
|
||||
import { DeesElement, customElement, html, css, cssManager } from '@design.estate/dees-element';
|
||||
|
||||
@customElement('my-element')
|
||||
class MyElement extends DeesElement {
|
||||
render() {
|
||||
return html`<div>My Custom Element</div>`;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This code snippet defines a custom element `<my-element>` that renders a simple div. `DeesElement` extends the LitElement class, bringing in all of its reactive rendering capabilities along with additional features that `@design.estate/dees-element` offers.
|
||||
|
||||
#### Styling the Element
|
||||
|
||||
To style the element, utilize the static `styles` property:
|
||||
|
||||
```typescript
|
||||
@customElement('my-styled-element')
|
||||
class MyStyledElement extends DeesElement {
|
||||
static styles = [
|
||||
css`
|
||||
div {
|
||||
color: blue;
|
||||
padding: 16px;
|
||||
border: 1px solid blue;
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
render() {
|
||||
return html`<div>A Styled Custom Element</div>`;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The `css` template tag allows you to define CSS styles scoped to your custom element.
|
||||
|
||||
#### Leveraging the `cssManager` for Theme Management
|
||||
|
||||
`@design.estate/dees-element` introduces a powerful `CssManager` class that facilitates dynamic theming and responsive designs:
|
||||
|
||||
```typescript
|
||||
import { cssManager, DeesElement, customElement, html, css } from '@design.estate/dees-element';
|
||||
|
||||
@customElement('themed-element')
|
||||
class ThemedElement extends DeesElement {
|
||||
static styles = [
|
||||
cssManager.defaultStyles,
|
||||
css`
|
||||
:host {
|
||||
display: block;
|
||||
background-color: var(--theme-background-color, #fff);
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
cssManager.bdTheme('#fff', '#000'); // Define themes
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`<div>A Themed Custom Element</div>`;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The `CssManager` allows easy management of themes, breakpoints, and more, ensuring your custom elements remain consistent and responsive across different devices and themes.
|
||||
|
||||
### Reactive Properties and State Management
|
||||
|
||||
To make your elements interactive and data-driven, `@design.estate/dees-element` offers a seamless approach to managing properties and internal state:
|
||||
|
||||
```typescript
|
||||
@customElement('interactive-element')
|
||||
class InteractiveElement extends DeesElement {
|
||||
@property({ type: String }) labelText = 'Click me';
|
||||
|
||||
@state() private count = 0;
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<button @click="${this.incrementCount}">${this.labelText}: ${this.count}</button>
|
||||
`;
|
||||
}
|
||||
|
||||
incrementCount() {
|
||||
this.count++;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Here, `@property` and `@state` decorators are used to reactively update your custom element whenever the internal state or properties change.
|
||||
|
||||
### Advanced Scenarios: Directives and Async Data
|
||||
|
||||
`@design.estate/dees-element` supports Lit's directives for handling asynchronous data, complex rendering conditions, and more. Here's an example using the `resolve` directive to render content asynchronously:
|
||||
|
||||
```typescript
|
||||
import { resolve } from '@design.estate/dees-element';
|
||||
|
||||
@customElement('async-element')
|
||||
class AsyncElement extends DeesElement {
|
||||
private fetchData() {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => resolve('Data Loaded'), 2000);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`${resolve(this.fetchData())}`;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This example demonstrates how to render async data efficiently, ensuring your custom elements can handle dynamic content and states gracefully.
|
||||
|
||||
### Conclusion
|
||||
|
||||
`@design.estate/dees-element` enriches the development experience for building custom elements by extending the capabilities of LitElement. Through thoughtful design choices, such as enhanced theming with `CssManager` and the incorporation of useful plugins and decorators, it facilitates a seamless and powerful approach to developing custom web components.
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
### Trademarks
|
||||
|
||||
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Registered at District court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
import * as deesElement from '../ts/index.js';
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as deesElement from '../ts/index';
|
||||
|
||||
tap.test('should create a static element', async () => {
|
||||
@deesElement.customElement('my-button')
|
||||
@ -11,12 +11,12 @@ tap.test('should create a static element', async () => {
|
||||
.buttonClass {
|
||||
background: ${deesElement.cssManager.bdTheme('blue', 'black')};
|
||||
}
|
||||
`,
|
||||
`
|
||||
];
|
||||
|
||||
// INSTANCE
|
||||
render() {
|
||||
return deesElement.html`<div class="buttonClass">My Button</div>`;
|
||||
return deesElement.html`<div class="buttonClass">My Button</div>`
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@design.estate/dees-element',
|
||||
version: '2.0.42',
|
||||
description: 'A library for creating custom elements extending the lit element class with additional functionalities.'
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { CSSResult, unsafeCSS } from 'lit';
|
||||
import * as plugins from './plugins.js';
|
||||
import * as domtools from '@design.estate/dees-domtools';
|
||||
import * as plugins from './dees-element.plugins.js';
|
||||
import * as domtools from '@designestate/dees-domtools';
|
||||
|
||||
export interface IBdVarTriplet {
|
||||
cssVarName: string;
|
||||
@ -28,43 +28,24 @@ export class CssManager {
|
||||
});
|
||||
}
|
||||
|
||||
public get defaultStyles() {
|
||||
public get defaultStyles () {
|
||||
return domtools.elementBasic.staticStyles;
|
||||
}
|
||||
|
||||
public cssForDesktop(contentArg: CSSResult) {
|
||||
return unsafeCSS(domtools.breakpoints.cssForDesktop(contentArg));
|
||||
}
|
||||
|
||||
public cssForNotebook(contentArg: CSSResult) {
|
||||
return unsafeCSS(domtools.breakpoints.cssForNotebook(contentArg));
|
||||
}
|
||||
|
||||
public cssForTablet(contentArg: CSSResult) {
|
||||
return unsafeCSS(domtools.breakpoints.cssForTablet(contentArg));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public cssForPhablet(contentArg: CSSResult) {
|
||||
return unsafeCSS(domtools.breakpoints.cssForPhablet(contentArg));
|
||||
}
|
||||
|
||||
|
||||
public cssForPhone(contentArg: CSSResult) {
|
||||
return unsafeCSS(domtools.breakpoints.cssForPhone(contentArg));
|
||||
}
|
||||
};
|
||||
|
||||
public bdTheme(brightValueArg: string, darkValueArg: string): CSSResult {
|
||||
let returnCssVar: string;
|
||||
|
||||
// lets determine the default value for quick page rendering.
|
||||
let defaultValue: string;
|
||||
if (domtools.DomTools.getGlobalDomToolsSync()) {
|
||||
defaultValue = domtools.DomTools.getGlobalDomToolsSync().themeManager.goBrightBoolean
|
||||
? brightValueArg
|
||||
: darkValueArg;
|
||||
} else {
|
||||
defaultValue = darkValueArg;
|
||||
}
|
||||
|
||||
const existingTriplet = this.bdVarTripletStore.find(
|
||||
(tripletArg) =>
|
||||
tripletArg.darkValue === darkValueArg && tripletArg.brightValue === brightValueArg
|
||||
@ -78,14 +59,13 @@ export class CssManager {
|
||||
darkValue: darkValueArg,
|
||||
};
|
||||
this.bdVarTripletStore.push(newTriplet);
|
||||
|
||||
this.domtoolsPromise.then(async (domtoolsArg) => {
|
||||
await domtoolsArg.domReady.promise;
|
||||
document.body.style.setProperty(newTriplet.cssVarName, defaultValue);
|
||||
document.body.style.setProperty(newTriplet.cssVarName, this.goBright ? newTriplet.brightValue : newTriplet.darkValue);
|
||||
});
|
||||
returnCssVar = newTriplet.cssVarName;
|
||||
}
|
||||
return plugins.lit.unsafeCSS(`var(${returnCssVar}, ${defaultValue})`);
|
||||
return plugins.lit.unsafeCSS(`var(${returnCssVar})`);
|
||||
}
|
||||
|
||||
public cssGridColumns = (amountOfColumnsArg: number, gapSizeArg: number): CSSResult => {
|
@ -1,4 +1,4 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as plugins from './dees-element.plugins.js';
|
||||
|
||||
export class DeesElement extends plugins.lit.LitElement {
|
||||
// INSTANCE
|
||||
@ -6,20 +6,18 @@ export class DeesElement extends plugins.lit.LitElement {
|
||||
public goBright: boolean = false;
|
||||
|
||||
// domtools
|
||||
public domtoolsPromise: Promise<plugins.domtools.DomTools>;
|
||||
public domtoolsPromise = plugins.domtools.elementBasic.setup(this);
|
||||
|
||||
@plugins.lit.property()
|
||||
domtools?: plugins.domtools.DomTools;
|
||||
|
||||
public rxSubscriptions: plugins.smartrx.rxjs.Subscription[] = [];
|
||||
private themeSubscription: plugins.smartrx.rxjs.Subscription;
|
||||
|
||||
private elementDomReadyDeferred = plugins.domtools.plugins.smartpromise.defer();
|
||||
public elementDomReady = this.elementDomReadyDeferred.promise;
|
||||
|
||||
constructor(optionsArg: plugins.domtools.IDomToolsContructorOptions = {}) {
|
||||
constructor() {
|
||||
super();
|
||||
this.domtoolsPromise = plugins.domtools.elementBasic.setup(this, optionsArg);
|
||||
this.domtoolsPromise.then((domtoolsArg) => {
|
||||
this.domtools = domtoolsArg;
|
||||
});
|
||||
@ -30,11 +28,7 @@ export class DeesElement extends plugins.lit.LitElement {
|
||||
const domtools = await this.domtoolsPromise;
|
||||
this.themeSubscription = domtools.themeManager.themeObservable.subscribe((goBrightArg) => {
|
||||
this.goBright = goBrightArg;
|
||||
});
|
||||
this.rxSubscriptions.push(this.themeSubscription);
|
||||
for (const startupFunction of this.startupFunctions) {
|
||||
await startupFunction();
|
||||
}
|
||||
});
|
||||
this.dispatchEvent(new CustomEvent('deesElementConnected'));
|
||||
}
|
||||
|
||||
@ -43,25 +37,10 @@ export class DeesElement extends plugins.lit.LitElement {
|
||||
this.elementDomReadyDeferred.resolve();
|
||||
}
|
||||
|
||||
private startupFunctions: (() => void | Promise<any>)[] = [];
|
||||
public registerStartupFunction(startupFunctionArg: () => void) {
|
||||
this.startupFunctions.push(startupFunctionArg);
|
||||
}
|
||||
|
||||
private garbageFunctions: (() => void | Promise<any>)[] = [];
|
||||
public registerGarbageFunction(garbageFunctionArg: () => void) {
|
||||
this.garbageFunctions.push(garbageFunctionArg);
|
||||
}
|
||||
|
||||
public async disconnectedCallback() {
|
||||
await this.domtoolsPromise;
|
||||
super.disconnectedCallback();
|
||||
for (const subscription of this.rxSubscriptions) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
for (const garbageFunction of this.garbageFunctions) {
|
||||
await garbageFunction();
|
||||
}
|
||||
this.themeSubscription.unsubscribe();
|
||||
this.dispatchEvent(new CustomEvent('deesElementDisconnected'));
|
||||
}
|
||||
}
|
25
ts/dees-element.plugins.ts
Normal file
25
ts/dees-element.plugins.ts
Normal file
@ -0,0 +1,25 @@
|
||||
// pushrocks scope
|
||||
import * as isounique from '@pushrocks/isounique';
|
||||
import * as smartrx from '@pushrocks/smartrx';
|
||||
|
||||
export {
|
||||
isounique,
|
||||
smartrx
|
||||
};
|
||||
|
||||
// third party scope
|
||||
import { css, unsafeCSS, LitElement } from 'lit';
|
||||
import { property } from 'lit/decorators/property.js';
|
||||
const lit = {
|
||||
css,
|
||||
unsafeCSS,
|
||||
LitElement,
|
||||
property,
|
||||
};
|
||||
|
||||
import * as domtools from '@designestate/dees-domtools';
|
||||
|
||||
export {
|
||||
lit,
|
||||
domtools
|
||||
};
|
@ -1,53 +0,0 @@
|
||||
import { type TemplateResult, noChange } from 'lit';
|
||||
import { AsyncDirective, directive } from 'lit/async-directive.js';
|
||||
|
||||
/**
|
||||
* Resolves a promise and sets the value of the directive
|
||||
*/
|
||||
class ResolveDirective extends AsyncDirective {
|
||||
promise: Promise<unknown> | undefined;
|
||||
hasPromiseSettled: boolean = false;
|
||||
|
||||
render(promise: Promise<unknown>) {
|
||||
if (this.promise !== promise) {
|
||||
this.promise = promise;
|
||||
|
||||
if (this.isConnected) {
|
||||
this.handlePromise(promise);
|
||||
}
|
||||
}
|
||||
|
||||
return noChange;
|
||||
}
|
||||
|
||||
handlePromise(promise: Promise<unknown>) {
|
||||
this.hasPromiseSettled = false;
|
||||
|
||||
promise.then((value) => {
|
||||
if (this.promise === promise && !this.hasPromiseSettled) {
|
||||
this.setValue(value);
|
||||
this.hasPromiseSettled = true;
|
||||
}
|
||||
}).catch((error) => {
|
||||
if (this.promise === promise && !this.hasPromiseSettled) {
|
||||
this.setValue(error);
|
||||
this.hasPromiseSettled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
disconnected() {
|
||||
this.hasPromiseSettled = true; // prevent setting value if the promise settles after disconnection
|
||||
}
|
||||
|
||||
reconnected() {
|
||||
if (!this.hasPromiseSettled) {
|
||||
this.handlePromise(this.promise!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const resolve = directive(ResolveDirective);
|
||||
export const resolveExec = (funcArg: () => Promise<TemplateResult | unknown>) => {
|
||||
return resolve(funcArg());
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
import { noChange } from 'lit';
|
||||
import { AsyncDirective, directive } from 'lit/async-directive.js';
|
||||
import { rxjs } from '@push.rocks/smartrx';
|
||||
|
||||
/**
|
||||
* Subscribes to an observable
|
||||
*/
|
||||
class SubscribeDirective extends AsyncDirective {
|
||||
observable: rxjs.Observable<unknown> | undefined;
|
||||
sub: rxjs.Subscription | null = null;
|
||||
|
||||
render(observable: rxjs.Observable<unknown>) {
|
||||
if (this.observable !== observable) {
|
||||
this.sub?.unsubscribe();
|
||||
this.observable = observable;
|
||||
|
||||
if (this.isConnected) {
|
||||
this.subscribe(observable);
|
||||
}
|
||||
}
|
||||
|
||||
return noChange;
|
||||
}
|
||||
|
||||
subscribe(observable: rxjs.Observable<unknown>) {
|
||||
this.sub = observable.subscribe((v: unknown) => {
|
||||
this.setValue(v);
|
||||
});
|
||||
}
|
||||
|
||||
disconnected() {
|
||||
this.sub?.unsubscribe();
|
||||
}
|
||||
|
||||
reconnected() {
|
||||
this.subscribe(this.observable!);
|
||||
}
|
||||
}
|
||||
|
||||
export const subscribe = directive(SubscribeDirective);
|
@ -1,61 +0,0 @@
|
||||
import { type TemplateResult, noChange } from 'lit';
|
||||
import type { DirectiveResult } from 'lit/directive.js';
|
||||
import { AsyncDirective, directive } from 'lit/async-directive.js';
|
||||
import { rxjs } from '@push.rocks/smartrx';
|
||||
|
||||
/**
|
||||
* Subscribes to an observable and applies a template function to each emission.
|
||||
* @param observable - the source Observable
|
||||
* @param templateFn - function mapping each emitted value to a TemplateResult or other renderable content
|
||||
*/
|
||||
class SubscribeWithTemplateDirective extends AsyncDirective {
|
||||
private observable?: rxjs.Observable<unknown>;
|
||||
private templateFn?: (value: unknown) => TemplateResult | unknown;
|
||||
private sub: rxjs.Subscription | null = null;
|
||||
|
||||
render(
|
||||
observable: rxjs.Observable<unknown>,
|
||||
templateFn: (value: unknown) => TemplateResult | unknown
|
||||
) {
|
||||
const changed = this.observable !== observable || this.templateFn !== templateFn;
|
||||
if (changed) {
|
||||
this.sub?.unsubscribe();
|
||||
this.observable = observable;
|
||||
this.templateFn = templateFn;
|
||||
if (this.isConnected) {
|
||||
this.startSubscription();
|
||||
}
|
||||
}
|
||||
return noChange;
|
||||
}
|
||||
|
||||
private startSubscription() {
|
||||
this.sub = this.observable!.subscribe((v: unknown) => {
|
||||
const out = this.templateFn!(v);
|
||||
this.setValue(out);
|
||||
});
|
||||
}
|
||||
|
||||
disconnected() {
|
||||
this.sub?.unsubscribe();
|
||||
}
|
||||
|
||||
reconnected() {
|
||||
this.startSubscription();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Directive that renders templates for each emission of an Observable.
|
||||
* Usage: html`${subscribeWithTemplate(myObservable, v => html`<span>${v}</span>`)}`
|
||||
*/
|
||||
/**
|
||||
* Typed directive function signature: returns a Lit DirectiveResult.
|
||||
*/
|
||||
type SubscribeWithTemplateFn = <T>(
|
||||
observable: rxjs.Observable<T>,
|
||||
templateFn: (value: T) => TemplateResult | unknown
|
||||
) => DirectiveResult;
|
||||
export const subscribeWithTemplate = directive(
|
||||
SubscribeWithTemplateDirective
|
||||
) as SubscribeWithTemplateFn;
|
@ -1,9 +0,0 @@
|
||||
// better scoped exports
|
||||
export * from './classes.resolvedirective.js';
|
||||
export * from './classes.subscribedirective.js';
|
||||
|
||||
|
||||
export { subscribeWithTemplate } from './classes.subscribewithtemplate.js';
|
||||
|
||||
export { until } from 'lit/directives/until.js';
|
||||
export { asyncAppend } from 'lit/directives/async-append.js';
|
27
ts/index.ts
27
ts/index.ts
@ -1,35 +1,22 @@
|
||||
import { CssManager } from './classes.cssmanager.js';
|
||||
import { CssManager } from './dees-element.classes.cssmanager.js';
|
||||
|
||||
// lit exports
|
||||
export { html, type TemplateResult, css, unsafeCSS, render, type CSSResult } from 'lit';
|
||||
export { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
||||
export { html, TemplateResult, css, unsafeCSS, render } from 'lit';
|
||||
|
||||
export { customElement } from 'lit/decorators/custom-element.js';
|
||||
|
||||
export { property, state, query, queryAll, queryAsync } from 'lit/decorators.js';
|
||||
export { property } from 'lit/decorators/property.js';
|
||||
|
||||
export { state } from 'lit/decorators/state.js';
|
||||
|
||||
// domtools exports
|
||||
import * as domtools from '@design.estate/dees-domtools';
|
||||
import * as domtools from '@designestate/dees-domtools';
|
||||
export { domtools };
|
||||
|
||||
// DeesElements exports
|
||||
export * from './classes.dees-element.js';
|
||||
|
||||
// directives exports
|
||||
import * as directives from './directives/index.js';
|
||||
|
||||
export { directives };
|
||||
export { DeesElement } from './dees-element.classes.dees-element.js';
|
||||
|
||||
/**
|
||||
* a singleton instance of CssManager
|
||||
*/
|
||||
export const cssManager = new CssManager();
|
||||
|
||||
|
||||
|
||||
// type exports
|
||||
import type { rxjs } from '@push.rocks/smartrx';
|
||||
|
||||
export type {
|
||||
rxjs,
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// pushrocks scope
|
||||
import * as isounique from '@push.rocks/isounique';
|
||||
import * as smartrx from '@push.rocks/smartrx';
|
||||
|
||||
export { isounique, smartrx };
|
||||
|
||||
// third party scope
|
||||
import { css, unsafeCSS, LitElement } from 'lit';
|
||||
import { property } from 'lit/decorators/property.js';
|
||||
const lit = {
|
||||
css,
|
||||
unsafeCSS,
|
||||
LitElement,
|
||||
property,
|
||||
};
|
||||
|
||||
import * as domtools from '@design.estate/dees-domtools';
|
||||
|
||||
export { lit, domtools };
|
@ -1,14 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
]
|
||||
"target": "es2020",
|
||||
"module": "es2020",
|
||||
"moduleResolution": "node12",
|
||||
"experimentalDecorators": true
|
||||
}
|
||||
}
|
||||
|
17
tslint.json
Normal file
17
tslint.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user