Compare commits
79 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c85ad8b43 | |||
| fe2f80ed7f | |||
| 766858d2f1 | |||
| 3f2ecbc7fa | |||
| 7892be0707 | |||
| adbf910993 | |||
| c726cd5af8 | |||
| 8d60911b34 | |||
| 217ea3e9d4 | |||
| 8263a4fe73 | |||
| 340582e042 | |||
| a8e07f9682 | |||
| aa37652b6d | |||
| 7e26cd39d7 | |||
| 05cc971c0b | |||
| 8d39592d23 | |||
| 0d6f9b7f19 | |||
| 8fc1a4ae5d | |||
| 82d672abc2 | |||
| 387b415de9 | |||
| 74229cb226 | |||
| 2e64489e9b | |||
| af2b4048d0 | |||
| a4992c26be | |||
| 02f32f5e4f | |||
| a9d5fce1b2 | |||
| 1dd6756213 | |||
| 07dcfb41be | |||
| fb2dc2e315 | |||
| 3d67a757ca | |||
| 1b2206a8f9 | |||
| 5631c9cbb0 | |||
| e50bc60bfb | |||
| ffd95a2e2f | |||
| 7263110837 | |||
| f41f0211a4 | |||
| 20547a00d5 | |||
| 009674d78c | |||
| dcca685021 | |||
| 8eff93febc | |||
| 11f731aa61 | |||
| a8e7d2f335 | |||
| 219390e895 | |||
| e321286259 | |||
| 5f141feb50 | |||
| 7b99c70275 | |||
| 9f3b396633 | |||
| 8dd48fdc05 | |||
| 2538f59769 | |||
| 216a605f93 | |||
| 0808b9a5f9 | |||
| dc13ad997b | |||
| 1c7c1c2432 | |||
| 969cd12725 | |||
| f2aa825f95 | |||
| 9d072cde61 | |||
| 3b100a5b20 | |||
| ef76535d2b | |||
| b6e307d2e1 | |||
| 4b24440e2a | |||
| 4867099008 | |||
| ac7e109f6c | |||
| 019297f998 | |||
| d0ddeaca5d | |||
| fe50d39d01 | |||
| 6da377f0f6 | |||
| a39d46458a | |||
| 45be5f90ee | |||
| 67927cc3a2 | |||
| f4b8260c45 | |||
| 5c86ee7bf3 | |||
| 50c4be30b8 | |||
| dce8ec6470 | |||
| 14446ece3c | |||
| 794281541b | |||
| fdd3a5da90 | |||
| 0394a656cc | |||
| 78051a5577 | |||
| 59c564af0a |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
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
|
||||||
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
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
|
||||||
141
.gitlab-ci.yml
141
.gitlab-ci.yml
@@ -1,141 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: '$CI_BUILD_STAGE'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- npm install -g @shipzone/npmci
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- 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:
|
|
||||||
- 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 npm audit --audit-level=high --only=dev
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g tslint typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci node install lts
|
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command tsdoc
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
||||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -22,6 +22,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"typescript.tsdk": "node_modules/typescript/lib"
|
|
||||||
}
|
}
|
||||||
|
|||||||
428
changelog.md
Normal file
428
changelog.md
Normal file
@@ -0,0 +1,428 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-01-27 - 2.1.6 - fix(docs, deps, tests)
|
||||||
|
update README with expanded usage docs and examples; bump devDependencies and dees-domtools; fix test import path
|
||||||
|
|
||||||
|
- Bumped devDependencies: @git.zone/tsbuild -> ^4.1.2, @git.zone/tsbundle -> ^2.8.3, @git.zone/tstest -> ^3.1.8, @types/node -> ^25.0.10
|
||||||
|
- Bumped dependency @design.estate/dees-domtools -> ^2.3.8
|
||||||
|
- README rewritten/expanded: more complete usage examples, theme management (cssManager) docs, directives reference, lifecycle helpers, install and issue reporting guidance
|
||||||
|
- Test fix: updated import to use @git.zone/tstest/tapbundle instead of @push.rocks/tapbundle
|
||||||
|
|
||||||
|
## 2026-01-04 - 2.1.5 - fix(build)
|
||||||
|
bump @design.estate/dees-domtools to ^2.3.7 and remove experimentalDecorators and useDefineForClassFields from tsconfig.json
|
||||||
|
|
||||||
|
- Bumped @design.estate/dees-domtools from ^2.3.6 to ^2.3.7.
|
||||||
|
- Removed "experimentalDecorators" and "useDefineForClassFields" compiler options from tsconfig.json.
|
||||||
|
|
||||||
|
## 2026-01-04 - 2.1.4 - fix(build)
|
||||||
|
update dev and runtime dependencies, export additional lit directives, switch test export to default, convert class properties to accessors, and update npmextra configuration
|
||||||
|
|
||||||
|
- Bump devDependencies: @git.zone/tsbuild -> ^4.0.2, @git.zone/tsbundle -> ^2.6.3, @git.zone/tstest -> ^3.1.4, @types/node -> ^25.0.3
|
||||||
|
- Bump runtime deps: @design.estate/dees-domtools -> ^2.3.6, lit -> ^3.3.2
|
||||||
|
- Change test script to run tstest in verbose mode and export default tap.start() in test entry
|
||||||
|
- Convert DeesElement properties to use 'accessor' syntax and make domtools non-optional in type
|
||||||
|
- Add exports for lit directives keyed and repeat in directives index
|
||||||
|
- Update packageManager to pnpm@10.27.0 and adjust npmextra.json: rename keys, add release registries and accessLevel
|
||||||
|
|
||||||
|
## 2025-11-16 - 2.1.3 - fix(CssManager)
|
||||||
|
Make CssManager a singleton and export the shared instance via getSingleton; update tests and dependencies
|
||||||
|
|
||||||
|
- Convert CssManager to a singleton by adding a private static instance and a public static getSingleton() method.
|
||||||
|
- Use CssManager.getSingleton() for the exported cssManager in ts/index.ts to ensure a single shared instance across the app.
|
||||||
|
- Add a Chromium-focused test (test.chromium.ts) and remove the browser-specific test file.
|
||||||
|
- Bump devDependencies (@git.zone/tsbuild, @git.zone/tsbundle, @git.zone/tstest) and update lit to ^3.3.1.
|
||||||
|
- Add readme.hints.md documenting the CssManager singleton pattern and supported access patterns.
|
||||||
|
|
||||||
|
## 2025-07-06 - 2.1.2 - fix(build)
|
||||||
|
Update build script in package.json to include 'tsfolders' in tsbuild command
|
||||||
|
|
||||||
|
- Changed build script from 'tsbuild --web --allowimplicitany && tsbundle npm' to 'tsbuild tsfolders --web --allowimplicitany && tsbundle npm'
|
||||||
|
|
||||||
|
## 2025-07-06 - 2.1.1 - fix(documentation)
|
||||||
|
Refine project documentation and metadata for clarity
|
||||||
|
|
||||||
|
- Update readme examples to better illustrate custom element usage
|
||||||
|
- Clarify CssManager theming and API usage in documentation
|
||||||
|
- Ensure package.json and commitinfo reflect accurate project details
|
||||||
|
|
||||||
|
## 2025-07-06 - 2.1.0 - feat(DeesElement)
|
||||||
|
Add invocation of the themeChanged hook in connectedCallback
|
||||||
|
|
||||||
|
- Now calls themeChanged (if defined) when the theme changes, enabling custom handlers for theme switches
|
||||||
|
- Improves lifecycle management by allowing extensions to react to bright/dark mode changes
|
||||||
|
|
||||||
|
## 2025-06-20 - 2.0.44 - fix(ci)
|
||||||
|
Remove obsolete GitLab CI configuration
|
||||||
|
|
||||||
|
- Deleted the .gitlab-ci.yml file to remove outdated CI configuration from the repository.
|
||||||
|
|
||||||
|
## 2025-06-20 - 2.0.43 - fix(dependencies)
|
||||||
|
Bump build and runtime dependencies to newer versions for improved tooling and compatibility.
|
||||||
|
|
||||||
|
- Bumped @git.zone/tsbuild from ^2.3.2 to ^2.6.4
|
||||||
|
- Bumped @git.zone/tsbundle from ^2.2.5 to ^2.4.0
|
||||||
|
- Bumped @git.zone/tstest from ^1.0.96 to ^2.3.1
|
||||||
|
- Bumped @push.rocks/tapbundle from ^5.6.3 to ^6.0.3
|
||||||
|
- Bumped @design.estate/dees-domtools from ^2.3.2 to ^2.3.3
|
||||||
|
- Bumped @push.rocks/smartrx from ^3.0.7 to ^3.0.10
|
||||||
|
|
||||||
|
## 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.
|
||||||
@@ -1,18 +1,39 @@
|
|||||||
{
|
{
|
||||||
"gitzone": {
|
"@git.zone/cli": {
|
||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "designestate",
|
"gitscope": "designestate",
|
||||||
"gitrepo": "dees-element",
|
"gitrepo": "dees-element",
|
||||||
"description": "a custom element class extending lit element class",
|
"description": "A library for creating custom elements extending the lit element class with additional functionalities.",
|
||||||
"npmPackagename": "@designestate/dees-element",
|
"npmPackagename": "@designestate/dees-element",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "design.estate"
|
"projectDomain": "design.estate",
|
||||||
|
"keywords": [
|
||||||
|
"custom elements",
|
||||||
|
"lit",
|
||||||
|
"TypeScript",
|
||||||
|
"CSS manager",
|
||||||
|
"themes",
|
||||||
|
"decorators",
|
||||||
|
"async directive",
|
||||||
|
"web components",
|
||||||
|
"reactive programming",
|
||||||
|
"DOM manipulation"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"release": {
|
||||||
|
"registries": [
|
||||||
|
"https://verdaccio.lossless.digital",
|
||||||
|
"https://registry.npmjs.org"
|
||||||
|
],
|
||||||
|
"accessLevel": "public"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"@git.zone/tsdoc": {
|
||||||
"npmGlobalTools": [],
|
"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"
|
||||||
"npmAccessLevel": "public"
|
},
|
||||||
|
"@ship.zone/szci": {
|
||||||
|
"npmGlobalTools": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
19379
package-lock.json
generated
19379
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
45
package.json
45
package.json
@@ -1,31 +1,29 @@
|
|||||||
{
|
{
|
||||||
"name": "@designestate/dees-element",
|
"name": "@design.estate/dees-element",
|
||||||
"version": "2.0.13",
|
"version": "2.1.6",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a custom element class extending lit element class",
|
"description": "A library for creating custom elements extending the lit element class with additional functionalities.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --verbose)",
|
||||||
"build": "(tsbuild --web --allowimplicitany --skiplibcheck && tsbundle npm)"
|
"build": "(tsbuild tsfolders --web --allowimplicitany && tsbundle npm)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.61",
|
"@git.zone/tsbuild": "^4.1.2",
|
||||||
"@gitzone/tsbundle": "^1.0.102",
|
"@git.zone/tsbundle": "^2.8.3",
|
||||||
"@gitzone/tstest": "^1.0.70",
|
"@git.zone/tstest": "^3.1.8",
|
||||||
"@pushrocks/tapbundle": "^5.0.3",
|
"@types/node": "^25.0.10"
|
||||||
"@types/node": "^17.0.25",
|
|
||||||
"tslint": "^6.1.3",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@designestate/dees-domtools": "^2.0.20",
|
"@design.estate/dees-domtools": "^2.3.8",
|
||||||
"@pushrocks/isounique": "^1.0.5",
|
"@push.rocks/isounique": "^1.0.5",
|
||||||
"@pushrocks/smartrx": "^2.0.25",
|
"@push.rocks/smartrx": "^3.0.10",
|
||||||
"lit": "^2.2.2"
|
"lit": "^3.3.2"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
@@ -41,5 +39,18 @@
|
|||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
]
|
],
|
||||||
|
"keywords": [
|
||||||
|
"custom elements",
|
||||||
|
"lit",
|
||||||
|
"TypeScript",
|
||||||
|
"CSS manager",
|
||||||
|
"themes",
|
||||||
|
"decorators",
|
||||||
|
"async directive",
|
||||||
|
"web components",
|
||||||
|
"reactive programming",
|
||||||
|
"DOM manipulation"
|
||||||
|
],
|
||||||
|
"packageManager": "pnpm@10.27.0"
|
||||||
}
|
}
|
||||||
|
|||||||
8355
pnpm-lock.yaml
generated
Normal file
8355
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
15
readme.hints.md
Normal file
15
readme.hints.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Project Hints
|
||||||
|
|
||||||
|
## CssManager Singleton Pattern
|
||||||
|
|
||||||
|
**Location:** `ts/classes.cssmanager.ts`
|
||||||
|
|
||||||
|
The `CssManager` class uses a singleton pattern:
|
||||||
|
- **Static method:** `CssManager.getSingleton()` - Returns the singleton instance
|
||||||
|
- **Exported instance:** `cssManager` (from `ts/index.ts`) - Uses `getSingleton()` internally
|
||||||
|
|
||||||
|
Both access patterns are supported for backward compatibility:
|
||||||
|
- `cssManager.method()` - Legacy pattern (still works)
|
||||||
|
- `CssManager.getSingleton().method()` - Preferred pattern
|
||||||
|
|
||||||
|
The singleton ensures only one instance manages CSS variables and theme changes throughout the application.
|
||||||
298
readme.md
298
readme.md
@@ -1,39 +1,281 @@
|
|||||||
# @designestate/dees-element
|
# @design.estate/dees-element
|
||||||
a custom element class extending lit element class
|
|
||||||
|
|
||||||
## Availabililty and Links
|
A powerful custom element base class that extends Lit's `LitElement` with integrated theming, responsive CSS utilities, RxJS-powered directives, and DOM tooling — so you can build web components that look great and stay reactive out of the box.
|
||||||
* [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/)
|
|
||||||
|
|
||||||
## Status for master
|
## Issue Reporting and Security
|
||||||
|
|
||||||
Status Category | Status Badge
|
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
||||||
-- | --
|
|
||||||
GitLab Pipelines | [](https://lossless.cloud)
|
## Install
|
||||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
|
||||||
npm | [](https://lossless.cloud)
|
```bash
|
||||||
Snyk | [](https://lossless.cloud)
|
npm install @design.estate/dees-element
|
||||||
TypeScript Support | [](https://lossless.cloud)
|
# or
|
||||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
pnpm install @design.estate/dees-element
|
||||||
Code Style | [](https://lossless.cloud)
|
```
|
||||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
|
||||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
This package ships as ESM and is written in TypeScript. Make sure your project targets ES2022+ with a modern module resolution strategy (e.g. `NodeNext`).
|
||||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
|
||||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class intellisense
|
Everything you need is exported from the main entry point:
|
||||||
|
|
||||||
## Contribution
|
```typescript
|
||||||
|
import {
|
||||||
|
DeesElement,
|
||||||
|
customElement,
|
||||||
|
property,
|
||||||
|
state,
|
||||||
|
html,
|
||||||
|
css,
|
||||||
|
cssManager,
|
||||||
|
directives,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
|
```
|
||||||
|
|
||||||
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). :)
|
### 🧱 Creating a Custom Element
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
Extend `DeesElement` and apply the `@customElement` decorator:
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
```typescript
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
import { DeesElement, customElement, html, css, cssManager } from '@design.estate/dees-element';
|
||||||
|
|
||||||
[](https://maintainedby.lossless.com)
|
@customElement('my-button')
|
||||||
|
class MyButton extends DeesElement {
|
||||||
|
static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
|
css`
|
||||||
|
.btn {
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: ${cssManager.bdTheme('#0060df', '#3a8fff')};
|
||||||
|
color: ${cssManager.bdTheme('#fff', '#fff')};
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`<button class="btn"><slot></slot></button>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
That single `bdTheme()` call generates a CSS variable that automatically flips between the bright and dark values when the user's theme changes — no manual toggling needed.
|
||||||
|
|
||||||
|
### 🎨 Theme Management with `cssManager`
|
||||||
|
|
||||||
|
The singleton `cssManager` is the central hub for theming and responsive layout:
|
||||||
|
|
||||||
|
| Method | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| `cssManager.defaultStyles` | Base styles for consistent element rendering |
|
||||||
|
| `cssManager.bdTheme(bright, dark)` | Returns a `CSSResult` that auto-switches between bright/dark values |
|
||||||
|
| `cssManager.cssForDesktop(css)` | Media-query wrapper for desktop breakpoints |
|
||||||
|
| `cssManager.cssForNotebook(css)` | Media-query wrapper for notebook breakpoints |
|
||||||
|
| `cssManager.cssForTablet(css)` | Media-query wrapper for tablet breakpoints |
|
||||||
|
| `cssManager.cssForPhablet(css)` | Media-query wrapper for phablet breakpoints |
|
||||||
|
| `cssManager.cssForPhone(css)` | Media-query wrapper for phone breakpoints |
|
||||||
|
| `cssManager.cssGridColumns(cols, gap)` | Generates CSS grid column widths |
|
||||||
|
|
||||||
|
Example — responsive + themed styles:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
@customElement('my-card')
|
||||||
|
class MyCard extends DeesElement {
|
||||||
|
static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
|
css`
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
padding: 16px;
|
||||||
|
background: ${cssManager.bdTheme('#ffffff', '#1e1e1e')};
|
||||||
|
color: ${cssManager.bdTheme('#111', '#eee')};
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
cssManager.cssForPhone(css`
|
||||||
|
:host { padding: 8px; }
|
||||||
|
`),
|
||||||
|
];
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`<slot></slot>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### ⚡ Reactive Properties & State
|
||||||
|
|
||||||
|
Use the standard Lit decorators, re-exported for convenience:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { DeesElement, customElement, property, state, html } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
@customElement('my-counter')
|
||||||
|
class MyCounter extends DeesElement {
|
||||||
|
@property({ type: String })
|
||||||
|
accessor label = 'Count';
|
||||||
|
|
||||||
|
@state()
|
||||||
|
accessor count = 0;
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`
|
||||||
|
<button @click=${() => this.count++}>
|
||||||
|
${this.label}: ${this.count}
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note:** This library uses the TC39 standard decorators with the `accessor` keyword for decorated class properties.
|
||||||
|
|
||||||
|
### 🔄 Theme Change Callbacks
|
||||||
|
|
||||||
|
`DeesElement` tracks the current theme via the `goBright` property and exposes an optional `themeChanged` callback:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
@customElement('theme-aware')
|
||||||
|
class ThemeAware extends DeesElement {
|
||||||
|
protected themeChanged(goBright: boolean) {
|
||||||
|
console.log(goBright ? 'Switched to bright' : 'Switched to dark');
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`<p>Current theme: ${this.goBright ? 'bright' : 'dark'}</p>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🚀 Lifecycle Helpers
|
||||||
|
|
||||||
|
`DeesElement` adds lifecycle utilities on top of LitElement:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
@customElement('my-widget')
|
||||||
|
class MyWidget extends DeesElement {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
// Runs once after the element is connected to the DOM
|
||||||
|
this.registerStartupFunction(async () => {
|
||||||
|
console.log('Widget connected!');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Runs when the element is disconnected — perfect for cleanup
|
||||||
|
this.registerGarbageFunction(() => {
|
||||||
|
console.log('Widget removed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`<p>Hello World</p>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Additionally, `this.elementDomReady` is a promise that resolves after `firstUpdated`, which is handy when you need to wait for the initial render:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
await this.elementDomReady;
|
||||||
|
// The element's shadow DOM is now fully rendered
|
||||||
|
```
|
||||||
|
|
||||||
|
### 📡 Directives
|
||||||
|
|
||||||
|
The `directives` namespace includes powerful template helpers, accessible via `directives.*`:
|
||||||
|
|
||||||
|
#### `resolve` — Render a Promise
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { html, directives } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`${directives.resolve(this.fetchData())}`;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `resolveExec` — Resolve a lazy async function
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
render() {
|
||||||
|
return html`${directives.resolveExec(() => this.loadContent())}`;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `subscribe` — Render an RxJS Observable
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { html, directives } from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`<span>${directives.subscribe(this.count$)}</span>`;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `subscribeWithTemplate` — Observable + template transform
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
render() {
|
||||||
|
return html`
|
||||||
|
${directives.subscribeWithTemplate(
|
||||||
|
this.items$,
|
||||||
|
(items) => html`<ul>${items.map(i => html`<li>${i}</li>`)}</ul>`
|
||||||
|
)}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Re-exported Lit directives
|
||||||
|
|
||||||
|
The directives namespace also re-exports these commonly used Lit directives:
|
||||||
|
|
||||||
|
- `until` — render a placeholder while a promise resolves
|
||||||
|
- `asyncAppend` — append values from an async iterable
|
||||||
|
- `keyed` — force re-creation of a template when a key changes
|
||||||
|
- `repeat` — efficiently render lists with identity tracking
|
||||||
|
|
||||||
|
### 📦 Full Export Reference
|
||||||
|
|
||||||
|
| Export | Description |
|
||||||
|
|---|---|
|
||||||
|
| `DeesElement` | Base class for custom elements |
|
||||||
|
| `CssManager` | CSS/theme management class |
|
||||||
|
| `cssManager` | Singleton `CssManager` instance |
|
||||||
|
| `customElement` | Class decorator to register elements |
|
||||||
|
| `property` | Reactive property decorator |
|
||||||
|
| `state` | Internal state decorator |
|
||||||
|
| `query`, `queryAll`, `queryAsync` | Shadow DOM query decorators |
|
||||||
|
| `html` | Lit html template tag |
|
||||||
|
| `css` | Lit css template tag |
|
||||||
|
| `unsafeCSS` | Create `CSSResult` from a string |
|
||||||
|
| `unsafeHTML` | Render raw HTML in templates |
|
||||||
|
| `render` | Lit render function |
|
||||||
|
| `static` / `unsafeStatic` | Static html template helpers |
|
||||||
|
| `domtools` | DOM tooling utilities |
|
||||||
|
| `directives` | All directives (resolve, subscribe, etc.) |
|
||||||
|
| `rxjs` (type) | RxJS type re-export |
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
|
||||||
|
|
||||||
|
**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 or third parties, 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 or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District Court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or 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.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||||
import * as deesElement from '../ts/index.js';
|
import * as deesElement from '../ts/index.js';
|
||||||
|
|
||||||
tap.test('should create a static element', async () => {
|
tap.test('should create a static element', async () => {
|
||||||
@@ -21,4 +21,4 @@ tap.test('should create a static element', async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
export default tap.start();
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* autocreated commitinfo by @pushrocks/commitinfo
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@designestate/dees-element',
|
name: '@design.estate/dees-element',
|
||||||
version: '2.0.13',
|
version: '2.1.6',
|
||||||
description: 'a custom element class extending lit element class'
|
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 { CSSResult, unsafeCSS } from 'lit';
|
||||||
import * as plugins from './dees-element.plugins.js';
|
import * as plugins from './plugins.js';
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
|
||||||
export interface IBdVarTriplet {
|
export interface IBdVarTriplet {
|
||||||
cssVarName: string;
|
cssVarName: string;
|
||||||
@@ -9,6 +9,21 @@ export interface IBdVarTriplet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class CssManager {
|
export class CssManager {
|
||||||
|
// STATIC
|
||||||
|
private static instance: CssManager | null = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the singleton instance of CssManager
|
||||||
|
*/
|
||||||
|
public static getSingleton(): CssManager {
|
||||||
|
if (!CssManager.instance) {
|
||||||
|
CssManager.instance = new CssManager();
|
||||||
|
}
|
||||||
|
return CssManager.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
public domtoolsPromise = domtools.DomTools.setupDomTools();
|
public domtoolsPromise = domtools.DomTools.setupDomTools();
|
||||||
public goBright: boolean = false;
|
public goBright: boolean = false;
|
||||||
public bdVarTripletStore: IBdVarTriplet[] = [];
|
public bdVarTripletStore: IBdVarTriplet[] = [];
|
||||||
@@ -58,12 +73,13 @@ export class CssManager {
|
|||||||
// lets determine the default value for quick page rendering.
|
// lets determine the default value for quick page rendering.
|
||||||
let defaultValue: string;
|
let defaultValue: string;
|
||||||
if (domtools.DomTools.getGlobalDomToolsSync()) {
|
if (domtools.DomTools.getGlobalDomToolsSync()) {
|
||||||
defaultValue = domtools.DomTools.getGlobalDomToolsSync().themeManager.goBrightBoolean ? brightValueArg : darkValueArg;
|
defaultValue = domtools.DomTools.getGlobalDomToolsSync().themeManager.goBrightBoolean
|
||||||
|
? brightValueArg
|
||||||
|
: darkValueArg;
|
||||||
} else {
|
} else {
|
||||||
defaultValue = darkValueArg
|
defaultValue = darkValueArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const existingTriplet = this.bdVarTripletStore.find(
|
const existingTriplet = this.bdVarTripletStore.find(
|
||||||
(tripletArg) =>
|
(tripletArg) =>
|
||||||
tripletArg.darkValue === darkValueArg && tripletArg.brightValue === brightValueArg
|
tripletArg.darkValue === darkValueArg && tripletArg.brightValue === brightValueArg
|
||||||
@@ -80,10 +96,7 @@ export class CssManager {
|
|||||||
|
|
||||||
this.domtoolsPromise.then(async (domtoolsArg) => {
|
this.domtoolsPromise.then(async (domtoolsArg) => {
|
||||||
await domtoolsArg.domReady.promise;
|
await domtoolsArg.domReady.promise;
|
||||||
document.body.style.setProperty(
|
document.body.style.setProperty(newTriplet.cssVarName, defaultValue);
|
||||||
newTriplet.cssVarName,
|
|
||||||
defaultValue
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
returnCssVar = newTriplet.cssVarName;
|
returnCssVar = newTriplet.cssVarName;
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,17 @@
|
|||||||
import * as plugins from './dees-element.plugins.js';
|
import * as plugins from './plugins.js';
|
||||||
|
|
||||||
export class DeesElement extends plugins.lit.LitElement {
|
export class DeesElement extends plugins.lit.LitElement {
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
@plugins.lit.property({ type: Boolean })
|
@plugins.lit.property({ type: Boolean })
|
||||||
public goBright: boolean = false;
|
public accessor goBright: boolean = false;
|
||||||
|
|
||||||
// domtools
|
// domtools
|
||||||
public domtoolsPromise: Promise<plugins.domtools.DomTools>;
|
public domtoolsPromise: Promise<plugins.domtools.DomTools>;
|
||||||
|
|
||||||
@plugins.lit.property()
|
@plugins.lit.property()
|
||||||
domtools?: plugins.domtools.DomTools;
|
public accessor domtools: plugins.domtools.DomTools;
|
||||||
|
|
||||||
|
public rxSubscriptions: plugins.smartrx.rxjs.Subscription[] = [];
|
||||||
private themeSubscription: plugins.smartrx.rxjs.Subscription;
|
private themeSubscription: plugins.smartrx.rxjs.Subscription;
|
||||||
|
|
||||||
private elementDomReadyDeferred = plugins.domtools.plugins.smartpromise.defer();
|
private elementDomReadyDeferred = plugins.domtools.plugins.smartpromise.defer();
|
||||||
@@ -24,12 +25,27 @@ export class DeesElement extends plugins.lit.LitElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the theme changes between bright and dark.
|
||||||
|
* Override this method to handle theme changes.
|
||||||
|
* @param goBright - true if switching to bright theme, false if switching to dark theme
|
||||||
|
*/
|
||||||
|
protected themeChanged?(goBright: boolean): void;
|
||||||
|
|
||||||
public async connectedCallback() {
|
public async connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
const domtools = await this.domtoolsPromise;
|
const domtools = await this.domtoolsPromise;
|
||||||
this.themeSubscription = domtools.themeManager.themeObservable.subscribe((goBrightArg) => {
|
this.themeSubscription = domtools.themeManager.themeObservable.subscribe((goBrightArg) => {
|
||||||
this.goBright = goBrightArg;
|
this.goBright = goBrightArg;
|
||||||
|
// Call themeChanged if it's defined
|
||||||
|
if (this.themeChanged) {
|
||||||
|
this.themeChanged(goBrightArg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
this.rxSubscriptions.push(this.themeSubscription);
|
||||||
|
for (const startupFunction of this.startupFunctions) {
|
||||||
|
await startupFunction();
|
||||||
|
}
|
||||||
this.dispatchEvent(new CustomEvent('deesElementConnected'));
|
this.dispatchEvent(new CustomEvent('deesElementConnected'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,10 +54,25 @@ export class DeesElement extends plugins.lit.LitElement {
|
|||||||
this.elementDomReadyDeferred.resolve();
|
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() {
|
public async disconnectedCallback() {
|
||||||
await this.domtoolsPromise;
|
await this.domtoolsPromise;
|
||||||
super.disconnectedCallback();
|
super.disconnectedCallback();
|
||||||
this.themeSubscription.unsubscribe();
|
for (const subscription of this.rxSubscriptions) {
|
||||||
|
subscription.unsubscribe();
|
||||||
|
}
|
||||||
|
for (const garbageFunction of this.garbageFunctions) {
|
||||||
|
await garbageFunction();
|
||||||
|
}
|
||||||
this.dispatchEvent(new CustomEvent('deesElementDisconnected'));
|
this.dispatchEvent(new CustomEvent('deesElementDisconnected'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
53
ts/directives/classes.resolvedirective.ts
Normal file
53
ts/directives/classes.resolvedirective.ts
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
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());
|
||||||
|
}
|
||||||
40
ts/directives/classes.subscribedirective.ts
Normal file
40
ts/directives/classes.subscribedirective.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
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);
|
||||||
61
ts/directives/classes.subscribewithtemplate.ts
Normal file
61
ts/directives/classes.subscribewithtemplate.ts
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
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;
|
||||||
11
ts/directives/index.ts
Normal file
11
ts/directives/index.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// 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';
|
||||||
|
export { keyed } from 'lit/directives/keyed.js';
|
||||||
|
export { repeat } from 'lit/directives/repeat.js';
|
||||||
28
ts/index.ts
28
ts/index.ts
@@ -1,20 +1,38 @@
|
|||||||
import { CssManager } from './dees-element.classes.cssmanager.js';
|
import { CssManager } from './classes.cssmanager.js';
|
||||||
|
|
||||||
// lit exports
|
// lit exports
|
||||||
export { html, TemplateResult, css, unsafeCSS, render } from 'lit';
|
export { html, type TemplateResult, css, unsafeCSS, render, type CSSResult } from 'lit';
|
||||||
|
|
||||||
|
export { html as static, unsafeStatic } from 'lit/static-html.js';
|
||||||
|
|
||||||
|
export { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
||||||
|
|
||||||
export { customElement } from 'lit/decorators/custom-element.js';
|
export { customElement } from 'lit/decorators/custom-element.js';
|
||||||
|
|
||||||
export { property, state, query, queryAll, queryAsync } from 'lit/decorators.js';
|
export { property, state, query, queryAll, queryAsync } from 'lit/decorators.js';
|
||||||
|
|
||||||
// domtools exports
|
// domtools exports
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
export { domtools };
|
export { domtools };
|
||||||
|
|
||||||
// DeesElements exports
|
// DeesElements exports
|
||||||
export { DeesElement } from './dees-element.classes.dees-element.js';
|
export * from './classes.dees-element.js';
|
||||||
|
|
||||||
|
// directives exports
|
||||||
|
import * as directives from './directives/index.js';
|
||||||
|
|
||||||
|
export { directives };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a singleton instance of CssManager
|
* a singleton instance of CssManager
|
||||||
*/
|
*/
|
||||||
export const cssManager = new CssManager();
|
export const cssManager = CssManager.getSingleton();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// type exports
|
||||||
|
import type { rxjs } from '@push.rocks/smartrx';
|
||||||
|
|
||||||
|
export type {
|
||||||
|
rxjs,
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
import * as isounique from '@pushrocks/isounique';
|
import * as isounique from '@push.rocks/isounique';
|
||||||
import * as smartrx from '@pushrocks/smartrx';
|
import * as smartrx from '@push.rocks/smartrx';
|
||||||
|
|
||||||
export { isounique, smartrx };
|
export { isounique, smartrx };
|
||||||
|
|
||||||
@@ -14,6 +14,6 @@ const lit = {
|
|||||||
property,
|
property,
|
||||||
};
|
};
|
||||||
|
|
||||||
import * as domtools from '@designestate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
|
|
||||||
export { lit, domtools };
|
export { lit, domtools };
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2020",
|
"target": "ES2022",
|
||||||
"module": "es2020",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "node12",
|
"moduleResolution": "NodeNext",
|
||||||
"experimentalDecorators": true
|
"esModuleInterop": true,
|
||||||
}
|
"verbatimModuleSyntax": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
17
tslint.json
17
tslint.json
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user