Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e049b041e2 | |||
| caf228b32d | |||
| f4f4ec5024 | |||
| ba56173966 | |||
| 3e6e953461 | |||
| 343d02c40d |
@@ -35,5 +35,15 @@
|
||||
},
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": []
|
||||
},
|
||||
"@git.zone/tsbundle": {
|
||||
"bundles": [
|
||||
{
|
||||
"from": "./ts/index.ts",
|
||||
"to": "./dist_bundle/bundle.js",
|
||||
"outputMode": "bundle",
|
||||
"bundler": "esbuild"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
20
changelog.md
20
changelog.md
@@ -1,5 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-03-27 - 2.2.4 - fix(build)
|
||||
migrate package config to .smartconfig and align build tooling
|
||||
|
||||
- replace npmextra.json with .smartconfig.json and include tsbundle bundle configuration
|
||||
- update build script and package files list to use the new smartconfig-based setup
|
||||
- bump build-related dependencies and add Node types to tsconfig
|
||||
- add definite assignment assertions for element properties to satisfy TypeScript checks
|
||||
|
||||
## 2026-03-12 - 2.2.3 - fix(repo)
|
||||
no changes to commit
|
||||
|
||||
|
||||
## 2026-03-11 - 2.2.2 - fix(decorators)
|
||||
patch container-responsive styles to fix stale container queries and add customElement wrapper that sets .is and warns on class/tag mismatch
|
||||
|
||||
- containerResponsive now derives the kebab name and replaces stale '@container <derived>' occurrences inside CSSResult cssText using unsafeCSS to correct container queries produced before decorators ran
|
||||
- containerResponsive appends containerContextStyles to the component styles while preserving/processing existing static styles
|
||||
- Added a customElement decorator wrapper that assigns .is on the class, logs a warning if the class name kebab-cases to a different tag name, and delegates to Lit's customElement
|
||||
- ts/index.ts now re-exports customElement from the local decorator so the new behavior is used project-wide
|
||||
|
||||
## 2026-03-11 - 2.2.1 - fix(dees-element)
|
||||
rename cssForCustom to cssForConstraint, remove DeesElement static cssFor* helpers, and add optional elementClass parameter to cssManager breakpoint helpers
|
||||
|
||||
|
||||
2
license
2
license
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2020 Lossless GmbH (hello@lossless.com)
|
||||
Copyright (c) 2020 Task Venture Capital GmbH (hello@task.vc)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
16
package.json
16
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@design.estate/dees-element",
|
||||
"version": "2.2.1",
|
||||
"version": "2.2.4",
|
||||
"private": false,
|
||||
"description": "A library for creating custom elements extending the lit element class with additional functionalities.",
|
||||
"main": "dist_ts/index.js",
|
||||
@@ -10,17 +10,17 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/ --verbose)",
|
||||
"build": "(tsbuild tsfolders --web --allowimplicitany && tsbundle npm)",
|
||||
"build": "(tsbuild tsfolders --web --allowimplicitany && tsbundle)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^4.1.2",
|
||||
"@git.zone/tsbundle": "^2.8.3",
|
||||
"@git.zone/tstest": "^3.1.8",
|
||||
"@types/node": "^25.0.10"
|
||||
"@git.zone/tsbuild": "^4.4.0",
|
||||
"@git.zone/tsbundle": "^2.10.0",
|
||||
"@git.zone/tstest": "^3.6.1",
|
||||
"@types/node": "^25.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@design.estate/dees-domtools": "^2.5.1",
|
||||
"@design.estate/dees-domtools": "^2.5.3",
|
||||
"@push.rocks/isounique": "^1.0.5",
|
||||
"@push.rocks/smartrx": "^3.0.10",
|
||||
"lit": "^3.3.2"
|
||||
@@ -37,7 +37,7 @@
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
".smartconfig.json",
|
||||
"readme.md"
|
||||
],
|
||||
"keywords": [
|
||||
|
||||
3168
pnpm-lock.yaml
generated
3168
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@design.estate/dees-element',
|
||||
version: '2.2.1',
|
||||
version: '2.2.4',
|
||||
description: 'A library for creating custom elements extending the lit element class with additional functionalities.'
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ export class DeesElement extends plugins.lit.LitElement {
|
||||
public domtoolsPromise: Promise<plugins.domtools.DomTools>;
|
||||
|
||||
@plugins.lit.property()
|
||||
public accessor 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();
|
||||
public elementDomReady = this.elementDomReadyDeferred.promise;
|
||||
|
||||
@@ -1,19 +1,47 @@
|
||||
import { unsafeCSS, type CSSResult } from 'lit';
|
||||
import * as domtools from '@design.estate/dees-domtools';
|
||||
|
||||
const camelToKebab = (name: string) =>
|
||||
name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
||||
|
||||
export function containerResponsive() {
|
||||
return function (target: any) {
|
||||
const tagName: string =
|
||||
target.is || target.name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
||||
const containerStyles = domtools.breakpoints.containerContextStyles(tagName);
|
||||
|
||||
const original = target.styles;
|
||||
if (Array.isArray(original)) {
|
||||
target.styles = [...original, containerStyles];
|
||||
} else if (original) {
|
||||
target.styles = [original, containerStyles];
|
||||
// If .is differs from the regex-derived name, cssManager.cssFor*(css, this)
|
||||
// in static styles (evaluated before decorators) used the wrong container name.
|
||||
// Fix those stale references now.
|
||||
const derivedName = target.name ? camelToKebab(target.name) : null;
|
||||
if (derivedName && derivedName !== tagName) {
|
||||
const fixStyle = (style: CSSResult) => {
|
||||
if (style && style.cssText && style.cssText.includes(`@container ${derivedName}`)) {
|
||||
return unsafeCSS(
|
||||
style.cssText.replaceAll(`@container ${derivedName}`, `@container ${tagName}`)
|
||||
);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
const original = target.styles;
|
||||
if (Array.isArray(original)) {
|
||||
target.styles = original.map(fixStyle);
|
||||
} else if (original) {
|
||||
target.styles = fixStyle(original);
|
||||
}
|
||||
}
|
||||
|
||||
// Append containment context styles
|
||||
const containerStyles = domtools.breakpoints.containerContextStyles(tagName);
|
||||
const current = target.styles;
|
||||
if (Array.isArray(current)) {
|
||||
target.styles = [...current, containerStyles];
|
||||
} else if (current) {
|
||||
target.styles = [current, containerStyles];
|
||||
} else {
|
||||
target.styles = [containerStyles];
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
}
|
||||
|
||||
25
ts/decorators.customelement.ts
Normal file
25
ts/decorators.customelement.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { customElement as litCustomElement } from 'lit/decorators/custom-element.js';
|
||||
|
||||
const camelToKebab = (name: string) =>
|
||||
name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
||||
|
||||
export function customElement(tagName: string) {
|
||||
return (classOrTarget: any, context?: any) => {
|
||||
// Set .is so that other decorators and utilities can read the tag name
|
||||
classOrTarget.is = tagName;
|
||||
|
||||
// Warn if class name convention doesn't match the tag
|
||||
if (classOrTarget.name) {
|
||||
const derived = camelToKebab(classOrTarget.name);
|
||||
if (derived !== tagName) {
|
||||
console.warn(
|
||||
`[dees-element] Class "${classOrTarget.name}" kebab-cases to "${derived}" but tag is "${tagName}". ` +
|
||||
`Container queries use .is ("${tagName}").`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Delegate to Lit's original decorator
|
||||
return litCustomElement(tagName)(classOrTarget, context);
|
||||
};
|
||||
}
|
||||
@@ -7,7 +7,7 @@ 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 './decorators.customelement.js';
|
||||
|
||||
export { property, state, query, queryAll, queryAsync } from 'lit/decorators.js';
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
"verbatimModuleSyntax": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
|
||||
Reference in New Issue
Block a user