luxen-ui 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/custom-elements.json +3202 -3159
- package/cdn/elements/dialog/dialog.d.ts +1 -0
- package/cdn/elements/dialog/dialog.d.ts.map +1 -1
- package/cdn/elements/dialog/dialog.js +4 -1
- package/cdn/elements/dialog/dialog.js.map +1 -1
- package/cdn/elements/dialog/dialog.styles.js +1 -1
- package/cdn/elements/dialog/dialog.styles.js.map +1 -1
- package/cdn/elements/drawer/drawer.d.ts +2 -1
- package/cdn/elements/drawer/drawer.d.ts.map +1 -1
- package/cdn/elements/drawer/drawer.js +1 -1
- package/cdn/elements/drawer/drawer.js.map +1 -1
- package/cdn/standalone.css +0 -5
- package/cdn/standalone.js +13 -5
- package/cdn/standalone.js.map +1 -1
- package/cdn/styles/elements/close-button/square.css +0 -5
- package/dist/css/elements/close-button/square.css +0 -5
- package/dist/custom-elements.json +3202 -3159
- package/dist/elements/dialog/dialog.css +4 -2
- package/dist/elements/dialog/dialog.d.ts +1 -0
- package/dist/elements/dialog/dialog.d.ts.map +1 -1
- package/dist/elements/dialog/dialog.js +13 -2
- package/dist/elements/drawer/drawer.css +1 -1
- package/dist/elements/drawer/drawer.d.ts +2 -1
- package/dist/elements/drawer/drawer.d.ts.map +1 -1
- package/dist/elements/drawer/drawer.js +7 -1
- package/dist/templates/elements/close-button.md +24 -3
- package/package.json +3 -2
- package/postcss-plugin-prefix.d.ts +9 -0
- package/vite-plugin.ts +1 -1
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
--width: 31rem;
|
|
3
3
|
--border-radius: 6px;
|
|
4
4
|
--padding: 1.5rem;
|
|
5
|
+
--header-padding: var(--padding);
|
|
6
|
+
--footer-padding: var(--padding);
|
|
5
7
|
--show-duration: 200ms;
|
|
6
8
|
--hide-duration: 200ms;
|
|
7
9
|
--backdrop: var(--l-backdrop);
|
|
@@ -59,7 +61,7 @@ dialog {
|
|
|
59
61
|
justify-content: space-between;
|
|
60
62
|
align-items: center;
|
|
61
63
|
gap: 1rem;
|
|
62
|
-
padding: var(--padding);
|
|
64
|
+
padding: var(--header-padding);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
[part='title'] {
|
|
@@ -82,7 +84,7 @@ dialog {
|
|
|
82
84
|
display: flex;
|
|
83
85
|
place-content: end;
|
|
84
86
|
gap: 0.5rem;
|
|
85
|
-
padding: var(--padding);
|
|
87
|
+
padding: var(--footer-padding);
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
/* Without a header, the body has to provide its own block-start padding
|
|
@@ -41,6 +41,7 @@ export declare class Dialog extends LuxenElement {
|
|
|
41
41
|
/** Hide the header entirely (title and close slot). */
|
|
42
42
|
withoutHeader: boolean;
|
|
43
43
|
dialog: HTMLDialogElement;
|
|
44
|
+
protected _modalKind: 'centered' | 'edge';
|
|
44
45
|
private _mouseDownTarget;
|
|
45
46
|
private _commandListener;
|
|
46
47
|
connectedCallback(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/html/elements/dialog/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/html/elements/dialog/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAgC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,MAAO,SAAQ,YAAY;IACtC,MAAM,CAAC,MAAM,4BAAwB;IAErC,2CAA2C;IAE3C,KAAK,SAAM;IAEX,kCAAkC;IAElC,IAAI,UAAS;IAEb,0CAA0C;IAE1C,YAAY,UAAS;IAErB,uDAAuD;IAEvD,aAAa,UAAS;IAGtB,MAAM,EAAG,iBAAiB,CAAC;IAI3B,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAc;IAEvD,OAAO,CAAC,gBAAgB,CAA4B;IAEpD,OAAO,CAAC,gBAAgB,CAEtB;IAIF,iBAAiB;IAKjB,oBAAoB;IAKpB,YAAY;IASZ,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC;IA0BrC,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,eAAe,CAAC,CAAY;IAEpC,OAAO,CAAC,aAAa;YAcP,UAAU;IAUxB,OAAO,CAAC,qBAAqB;IAK7B,MAAM;CA0BP"}
|
|
@@ -14,10 +14,18 @@ const supportsClosedBy = typeof HTMLDialogElement !== 'undefined' && 'closedBy'
|
|
|
14
14
|
// `:has()` to freeze the root scroll container whenever any modal l-dialog
|
|
15
15
|
// is open. Purely declarative — no manual lock/unlock bookkeeping.
|
|
16
16
|
// Symbol guard makes the injection idempotent across HMR reloads.
|
|
17
|
+
//
|
|
18
|
+
// `scrollbar-gutter: stable` only applies to centered modals — it prevents
|
|
19
|
+
// the page behind from shifting horizontally when the scrollbar disappears.
|
|
20
|
+
// Edge-attached modals (drawers) opt out via `data-modal="edge"`: a reserved
|
|
21
|
+
// gutter would push the drawer off the actual viewport edge.
|
|
17
22
|
const SCROLL_LOCK_SHEET = Symbol.for('luxen-dialog-scroll-lock');
|
|
18
23
|
if (typeof document !== 'undefined' && !(SCROLL_LOCK_SHEET in document)) {
|
|
19
24
|
const sheet = new CSSStyleSheet();
|
|
20
|
-
sheet.replaceSync(`
|
|
25
|
+
sheet.replaceSync(`
|
|
26
|
+
html:has([data-modal]) { overflow: hidden; }
|
|
27
|
+
html:has([data-modal="centered"]) { scrollbar-gutter: stable; }
|
|
28
|
+
`);
|
|
21
29
|
document.adoptedStyleSheets.push(sheet);
|
|
22
30
|
Object.defineProperty(document, SCROLL_LOCK_SHEET, { value: sheet });
|
|
23
31
|
}
|
|
@@ -62,6 +70,9 @@ export class Dialog extends LuxenElement {
|
|
|
62
70
|
this.lightDismiss = false;
|
|
63
71
|
/** Hide the header entirely (title and close slot). */
|
|
64
72
|
this.withoutHeader = false;
|
|
73
|
+
// Drives the scroll-lock stylesheet: `centered` reserves the scrollbar
|
|
74
|
+
// gutter (no page shift); `edge` skips it (drawers sit flush to the edge).
|
|
75
|
+
this._modalKind = 'centered';
|
|
65
76
|
this._mouseDownTarget = null;
|
|
66
77
|
this._commandListener = {
|
|
67
78
|
handleEvent: (e) => this._onCommand(e),
|
|
@@ -90,7 +101,7 @@ export class Dialog extends LuxenElement {
|
|
|
90
101
|
if (this.open && !this.dialog.open) {
|
|
91
102
|
// Opening — not cancelable.
|
|
92
103
|
this.emit('show');
|
|
93
|
-
this.
|
|
104
|
+
this.setAttribute('data-modal', this._modalKind);
|
|
94
105
|
this.dialog.showModal();
|
|
95
106
|
this._focusAutofocusTarget();
|
|
96
107
|
void this._emitAfter('after-show');
|
|
@@ -16,7 +16,7 @@ import { Dialog } from '../dialog/dialog.js';
|
|
|
16
16
|
* @csspart footer - The footer wrapper around the footer slot.
|
|
17
17
|
*
|
|
18
18
|
* @cssproperty --size - Drawer size on the axis perpendicular to its edge (width for `start`/`end`, height for `bottom`). Default `320px`.
|
|
19
|
-
* @cssproperty --border-radius - Drawer border radius on the inner edges. Default `0.
|
|
19
|
+
* @cssproperty --border-radius - Drawer border radius on the inner edges. Default `0.375rem`.
|
|
20
20
|
* @cssproperty --show-duration - Open transition duration. Default `200ms`.
|
|
21
21
|
* @cssproperty --hide-duration - Close transition duration. Default `200ms`.
|
|
22
22
|
* @cssproperty --backdrop - Backdrop color.
|
|
@@ -28,6 +28,7 @@ import { Dialog } from '../dialog/dialog.js';
|
|
|
28
28
|
*/
|
|
29
29
|
export declare class Drawer extends Dialog {
|
|
30
30
|
static styles: import("lit").CSSResult[];
|
|
31
|
+
protected _modalKind: "edge";
|
|
31
32
|
/** Edge the drawer slides in from. Defaults to the start (inline-start) edge. */
|
|
32
33
|
placement?: 'start' | 'end' | 'bottom';
|
|
33
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/html/elements/drawer/drawer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,MAAO,SAAQ,MAAM;IAChC,OAAgB,MAAM,4BAA4C;
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/html/elements/drawer/drawer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,MAAO,SAAQ,MAAM;IAChC,OAAgB,MAAM,4BAA4C;IAIlE,UAAmB,UAAU,EAAG,MAAM,CAAU;IAEhD,iFAAiF;IAEjF,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;CACxC"}
|
|
@@ -28,7 +28,7 @@ const drawerStyles = unsafeCSS(rawDrawerStyles);
|
|
|
28
28
|
* @csspart footer - The footer wrapper around the footer slot.
|
|
29
29
|
*
|
|
30
30
|
* @cssproperty --size - Drawer size on the axis perpendicular to its edge (width for `start`/`end`, height for `bottom`). Default `320px`.
|
|
31
|
-
* @cssproperty --border-radius - Drawer border radius on the inner edges. Default `0.
|
|
31
|
+
* @cssproperty --border-radius - Drawer border radius on the inner edges. Default `0.375rem`.
|
|
32
32
|
* @cssproperty --show-duration - Open transition duration. Default `200ms`.
|
|
33
33
|
* @cssproperty --hide-duration - Close transition duration. Default `200ms`.
|
|
34
34
|
* @cssproperty --backdrop - Backdrop color.
|
|
@@ -39,6 +39,12 @@ const drawerStyles = unsafeCSS(rawDrawerStyles);
|
|
|
39
39
|
* @event after-hide - Fired after the close animation completes.
|
|
40
40
|
*/
|
|
41
41
|
export class Drawer extends Dialog {
|
|
42
|
+
constructor() {
|
|
43
|
+
super(...arguments);
|
|
44
|
+
// Edge-attached: opt out of the centered modal's stable scrollbar gutter,
|
|
45
|
+
// which would otherwise push the drawer off the actual viewport edge.
|
|
46
|
+
this._modalKind = 'edge';
|
|
47
|
+
}
|
|
42
48
|
}
|
|
43
49
|
Drawer.styles = [hostStyles, dialogStyles, drawerStyles];
|
|
44
50
|
__decorate([
|
|
@@ -19,7 +19,14 @@ Pick a visual style via `data-appearance`. Each appearance has its own CSS impor
|
|
|
19
19
|
|
|
20
20
|
#### Ring
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
```html
|
|
23
|
+
<button
|
|
24
|
+
type="button"
|
|
25
|
+
class="l-close"
|
|
26
|
+
data-appearance="ring"
|
|
27
|
+
aria-label="Close"
|
|
28
|
+
></button>
|
|
29
|
+
```
|
|
23
30
|
|
|
24
31
|
```css
|
|
25
32
|
@import 'luxen-ui/css/close-button/ring';
|
|
@@ -27,7 +34,14 @@ Pick a visual style via `data-appearance`. Each appearance has its own CSS impor
|
|
|
27
34
|
|
|
28
35
|
#### Square
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
```html
|
|
38
|
+
<button
|
|
39
|
+
type="button"
|
|
40
|
+
class="l-close"
|
|
41
|
+
data-appearance="square"
|
|
42
|
+
aria-label="Close"
|
|
43
|
+
></button>
|
|
44
|
+
```
|
|
31
45
|
|
|
32
46
|
```css
|
|
33
47
|
@import 'luxen-ui/css/close-button/square';
|
|
@@ -35,7 +49,14 @@ Pick a visual style via `data-appearance`. Each appearance has its own CSS impor
|
|
|
35
49
|
|
|
36
50
|
#### Circle
|
|
37
51
|
|
|
38
|
-
|
|
52
|
+
```html
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
class="l-close"
|
|
56
|
+
data-appearance="circle"
|
|
57
|
+
aria-label="Close"
|
|
58
|
+
></button>
|
|
59
|
+
```
|
|
39
60
|
|
|
40
61
|
```css
|
|
41
62
|
@import 'luxen-ui/css/close-button/circle';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "luxen-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Modern web components and CSS-first UI library built with Lit. Framework-agnostic, customizable prefix, design tokens.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"custom-elements",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"elements.json",
|
|
35
35
|
"vite-plugin.ts",
|
|
36
36
|
"postcss-plugin-prefix.js",
|
|
37
|
+
"postcss-plugin-prefix.d.ts",
|
|
37
38
|
"README.md",
|
|
38
39
|
"LICENSE"
|
|
39
40
|
],
|
|
@@ -140,7 +141,7 @@
|
|
|
140
141
|
"scripts": {
|
|
141
142
|
"dev": "WATCH=true DEV=true vp build --config vite.config.css.ts",
|
|
142
143
|
"dev:elements": "vp dev",
|
|
143
|
-
"build": "vp build --config vite.config.css.ts && tsc && node scripts/copy-styles.mjs && vp build && pnpm run manifest && node scripts/copy-cdn-assets.mjs && node scripts/build-standalone.mjs && vp build --config vite.config.cdn-standalone.ts && node scripts/prepare-skill-templates.mjs",
|
|
144
|
+
"build": "vp build --config vite.config.css.ts && tsc && tsc -p tsconfig.tooling.json && node scripts/copy-styles.mjs && vp build && pnpm run manifest && node scripts/copy-cdn-assets.mjs && node scripts/build-standalone.mjs && vp build --config vite.config.cdn-standalone.ts && node scripts/prepare-skill-templates.mjs",
|
|
144
145
|
"build:css": "vp build --config vite.config.css.ts",
|
|
145
146
|
"build:standalone": "node scripts/build-standalone.mjs && vp build --config vite.config.cdn-standalone.ts",
|
|
146
147
|
"build:skill-templates": "node scripts/prepare-skill-templates.mjs",
|
package/vite-plugin.ts
CHANGED
|
@@ -136,7 +136,7 @@ export default function luxen(options: LuxenOptions = {}): Plugin {
|
|
|
136
136
|
|
|
137
137
|
function isLuxenRegistry(id: string): boolean {
|
|
138
138
|
// Normalise for Windows + strip Vite query params (`?import`, `?used`, …)
|
|
139
|
-
const path = id.replace(/\\/g, '/').split('?')[0];
|
|
139
|
+
const path = id.replace(/\\/g, '/').split('?')[0] ?? '';
|
|
140
140
|
return /\/luxen-ui\/(?:dist|src\/html)\/registry\.(?:js|ts)$/.test(path);
|
|
141
141
|
}
|
|
142
142
|
|