@liwe3/webcomponents 1.0.14 → 1.1.0
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/dist/AITextEditor.d.ts +173 -0
- package/dist/AITextEditor.d.ts.map +1 -0
- package/dist/ChunkUploader.d.ts +103 -0
- package/dist/ChunkUploader.d.ts.map +1 -0
- package/dist/ChunkUploader.js +614 -0
- package/dist/ChunkUploader.js.map +1 -0
- package/dist/ContainerBox.d.ts +112 -0
- package/dist/ContainerBox.d.ts.map +1 -0
- package/dist/ContainerBox.js +359 -0
- package/dist/ContainerBox.js.map +1 -0
- package/dist/DateSelector.d.ts +103 -0
- package/dist/DateSelector.d.ts.map +1 -0
- package/dist/Drawer.d.ts +63 -0
- package/dist/Drawer.d.ts.map +1 -0
- package/dist/Drawer.js +340 -0
- package/dist/Drawer.js.map +1 -0
- package/dist/ImageView.d.ts +42 -0
- package/dist/ImageView.d.ts.map +1 -0
- package/dist/ImageView.js +209 -0
- package/dist/ImageView.js.map +1 -0
- package/dist/PopoverMenu.d.ts +103 -0
- package/dist/PopoverMenu.d.ts.map +1 -0
- package/dist/SmartSelect.d.ts +99 -0
- package/dist/SmartSelect.d.ts.map +1 -0
- package/dist/Toast.d.ts +127 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +79 -49
- package/dist/Toast.js.map +1 -1
- package/dist/TreeView.d.ts +84 -0
- package/dist/TreeView.d.ts.map +1 -0
- package/dist/TreeView.js +478 -0
- package/dist/TreeView.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/package.json +28 -3
- package/src/ChunkUploader.ts +921 -0
- package/src/ContainerBox.ts +570 -0
- package/src/Drawer.ts +435 -0
- package/src/ImageView.ts +265 -0
- package/src/Toast.ts +96 -32
- package/src/TreeView.ts +673 -0
- package/src/index.ts +45 -6
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DateSelector Web Component
|
|
3
|
+
* A customizable date picker with single date and range selection modes
|
|
4
|
+
*/
|
|
5
|
+
export type DateRange = {
|
|
6
|
+
start: string | null;
|
|
7
|
+
end: string | null;
|
|
8
|
+
};
|
|
9
|
+
export declare class DateSelectorElement extends HTMLElement {
|
|
10
|
+
shadowRoot: ShadowRoot;
|
|
11
|
+
private currentDate;
|
|
12
|
+
private selectedDate;
|
|
13
|
+
private selectedRange;
|
|
14
|
+
private readonly MONTH_NAMES;
|
|
15
|
+
private readonly DAY_NAMES;
|
|
16
|
+
constructor();
|
|
17
|
+
static get observedAttributes(): string[];
|
|
18
|
+
attributeChangedCallback(name: string): void;
|
|
19
|
+
get rangeMode(): boolean;
|
|
20
|
+
set rangeMode(value: boolean);
|
|
21
|
+
/**
|
|
22
|
+
* Renders the date selector component
|
|
23
|
+
*/
|
|
24
|
+
private render;
|
|
25
|
+
/**
|
|
26
|
+
* Generates year options for the dropdown (current year ±10 years)
|
|
27
|
+
*/
|
|
28
|
+
private generateYearOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Generates the calendar grid with day headers and day cells
|
|
31
|
+
*/
|
|
32
|
+
private generateCalendarGrid;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if two date strings match
|
|
35
|
+
*/
|
|
36
|
+
private dateMatches;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if a date is within the selected range
|
|
39
|
+
*/
|
|
40
|
+
private isDateInRange;
|
|
41
|
+
/**
|
|
42
|
+
* Attaches main event listeners (called once during construction)
|
|
43
|
+
*/
|
|
44
|
+
private attachEventListeners;
|
|
45
|
+
/**
|
|
46
|
+
* Called after each render to setup any post-render event listeners
|
|
47
|
+
*/
|
|
48
|
+
private attachEventListenersToShadowRoot;
|
|
49
|
+
/**
|
|
50
|
+
* Navigates to the previous or next month
|
|
51
|
+
*/
|
|
52
|
+
private navigateMonth;
|
|
53
|
+
/**
|
|
54
|
+
* Navigates to a specific year
|
|
55
|
+
*/
|
|
56
|
+
private navigateToYear;
|
|
57
|
+
/**
|
|
58
|
+
* Handles click on a day cell
|
|
59
|
+
*/
|
|
60
|
+
private handleDayClick;
|
|
61
|
+
/**
|
|
62
|
+
* Handles single date selection
|
|
63
|
+
*/
|
|
64
|
+
private handleSingleSelection;
|
|
65
|
+
/**
|
|
66
|
+
* Handles range selection
|
|
67
|
+
*/
|
|
68
|
+
private handleRangeSelection;
|
|
69
|
+
/**
|
|
70
|
+
* Updates hover effect when selecting a range
|
|
71
|
+
*/
|
|
72
|
+
private updateRangeHover;
|
|
73
|
+
/**
|
|
74
|
+
* Clears the hover effect for range selection
|
|
75
|
+
*/
|
|
76
|
+
private clearRangeHover;
|
|
77
|
+
/**
|
|
78
|
+
* Sets the selected date programmatically (single date mode only)
|
|
79
|
+
*/
|
|
80
|
+
setDate(dateStr: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Sets the selected range programmatically (range mode only)
|
|
83
|
+
*/
|
|
84
|
+
setRange(startDate: string, endDate: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the currently selected date
|
|
87
|
+
*/
|
|
88
|
+
getSelectedDate(): string | null;
|
|
89
|
+
/**
|
|
90
|
+
* Gets the currently selected range
|
|
91
|
+
*/
|
|
92
|
+
getSelectedRange(): DateRange;
|
|
93
|
+
/**
|
|
94
|
+
* Clears the current selection
|
|
95
|
+
*/
|
|
96
|
+
clear(): void;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Conditionally defines the custom element if in a browser environment.
|
|
100
|
+
*/
|
|
101
|
+
declare const defineDateSelector: (tagName?: string) => void;
|
|
102
|
+
export { defineDateSelector };
|
|
103
|
+
//# sourceMappingURL=DateSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateSelector.d.ts","sourceRoot":"","sources":["../src/DateSelector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAAG;IACtB,KAA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IACI,eAAe,IAAI,MAAM,GAAG,IAAI;IAIvC;;OAEG;IACI,gBAAgB,IAAI,SAAS;IAIpC;;OAEG;IACI,KAAK,IAAI,IAAI;CAKrB;AAED;;GAEG;AACH,QAAA,MAAM,kBAAkB,GAAI,UAAS,MAA8B,KAAG,IAIrE,CAAC;AAKF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/Drawer.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drawer Web Component
|
|
3
|
+
* A container that can be expanded, shrunk, or closed with smooth animations
|
|
4
|
+
*/
|
|
5
|
+
export type DrawerDirection = 'horizontal' | 'vertical';
|
|
6
|
+
export type DrawerState = 'expanded' | 'shrunk' | 'closed';
|
|
7
|
+
export interface DrawerConfig {
|
|
8
|
+
direction?: DrawerDirection;
|
|
9
|
+
duration?: number;
|
|
10
|
+
showTitleWhenShrunk?: boolean;
|
|
11
|
+
closable?: boolean;
|
|
12
|
+
title?: string;
|
|
13
|
+
icon?: string;
|
|
14
|
+
showToggleButton?: boolean;
|
|
15
|
+
contentPadding?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class DrawerElement extends HTMLElement {
|
|
18
|
+
shadowRoot: ShadowRoot;
|
|
19
|
+
private currentState;
|
|
20
|
+
private config;
|
|
21
|
+
constructor();
|
|
22
|
+
static get observedAttributes(): string[];
|
|
23
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
24
|
+
get direction(): DrawerDirection;
|
|
25
|
+
set direction(value: DrawerDirection);
|
|
26
|
+
get duration(): number;
|
|
27
|
+
set duration(value: number);
|
|
28
|
+
get showTitleWhenShrunk(): boolean;
|
|
29
|
+
set showTitleWhenShrunk(value: boolean);
|
|
30
|
+
get closable(): boolean;
|
|
31
|
+
set closable(value: boolean);
|
|
32
|
+
get title(): string;
|
|
33
|
+
set title(value: string);
|
|
34
|
+
get icon(): string;
|
|
35
|
+
set icon(value: string);
|
|
36
|
+
get showToggleButton(): boolean;
|
|
37
|
+
set showToggleButton(value: boolean);
|
|
38
|
+
get contentPadding(): string;
|
|
39
|
+
set contentPadding(value: string);
|
|
40
|
+
get state(): DrawerState;
|
|
41
|
+
set state(value: DrawerState);
|
|
42
|
+
/**
|
|
43
|
+
* Expand the drawer
|
|
44
|
+
*/
|
|
45
|
+
expand(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Shrink the drawer
|
|
48
|
+
*/
|
|
49
|
+
shrink(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Close the drawer (removes from DOM)
|
|
52
|
+
*/
|
|
53
|
+
close(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Toggle between expanded and shrunk states
|
|
56
|
+
*/
|
|
57
|
+
toggle(): void;
|
|
58
|
+
private setState;
|
|
59
|
+
private bindEvents;
|
|
60
|
+
private render;
|
|
61
|
+
}
|
|
62
|
+
export declare function defineDrawer(tagName?: string): void;
|
|
63
|
+
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../src/Drawer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,UAAU,CAAC;AACxD,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,aAAc,SAAQ,WAAW;IACpC,UAAU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OAAO,CAAC,MAAM;CA+Kf;AAQD,wBAAgB,YAAY,CAAG,OAAO,GAAE,MAAuB,GAAI,IAAI,CAItE"}
|
package/dist/Drawer.js
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
class n extends HTMLElement {
|
|
2
|
+
constructor() {
|
|
3
|
+
super(), this.currentState = "expanded", this.config = {
|
|
4
|
+
direction: "horizontal",
|
|
5
|
+
duration: 300,
|
|
6
|
+
showTitleWhenShrunk: !1,
|
|
7
|
+
closable: !0,
|
|
8
|
+
title: "",
|
|
9
|
+
icon: "☰",
|
|
10
|
+
showToggleButton: !0,
|
|
11
|
+
contentPadding: "16px"
|
|
12
|
+
}, this.attachShadow({ mode: "open" }), this.render(), this.bindEvents();
|
|
13
|
+
}
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return ["direction", "duration", "show-title-when-shrunk", "closable", "title", "icon", "state", "show-toggle-button", "content-padding"];
|
|
16
|
+
}
|
|
17
|
+
attributeChangedCallback(t, r, e) {
|
|
18
|
+
if (r !== e) {
|
|
19
|
+
switch (t) {
|
|
20
|
+
case "direction":
|
|
21
|
+
this.config.direction = e || "horizontal";
|
|
22
|
+
break;
|
|
23
|
+
case "duration":
|
|
24
|
+
this.config.duration = parseInt(e || "300", 10);
|
|
25
|
+
break;
|
|
26
|
+
case "show-title-when-shrunk":
|
|
27
|
+
this.config.showTitleWhenShrunk = e === "true";
|
|
28
|
+
break;
|
|
29
|
+
case "closable":
|
|
30
|
+
this.config.closable = e !== "false";
|
|
31
|
+
break;
|
|
32
|
+
case "title":
|
|
33
|
+
this.config.title = e || "";
|
|
34
|
+
break;
|
|
35
|
+
case "icon":
|
|
36
|
+
this.config.icon = e || "☰";
|
|
37
|
+
break;
|
|
38
|
+
case "state":
|
|
39
|
+
this.currentState = e || "expanded";
|
|
40
|
+
break;
|
|
41
|
+
case "show-toggle-button":
|
|
42
|
+
this.config.showToggleButton = e !== "false";
|
|
43
|
+
break;
|
|
44
|
+
case "content-padding":
|
|
45
|
+
this.config.contentPadding = e ?? void 0;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
this.render();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
get direction() {
|
|
52
|
+
return this.config.direction;
|
|
53
|
+
}
|
|
54
|
+
set direction(t) {
|
|
55
|
+
this.config.direction = t, this.setAttribute("direction", t);
|
|
56
|
+
}
|
|
57
|
+
get duration() {
|
|
58
|
+
return this.config.duration;
|
|
59
|
+
}
|
|
60
|
+
set duration(t) {
|
|
61
|
+
this.config.duration = t, this.setAttribute("duration", t.toString());
|
|
62
|
+
}
|
|
63
|
+
get showTitleWhenShrunk() {
|
|
64
|
+
return this.config.showTitleWhenShrunk;
|
|
65
|
+
}
|
|
66
|
+
set showTitleWhenShrunk(t) {
|
|
67
|
+
this.config.showTitleWhenShrunk = t, this.setAttribute("show-title-when-shrunk", t.toString());
|
|
68
|
+
}
|
|
69
|
+
get closable() {
|
|
70
|
+
return this.config.closable;
|
|
71
|
+
}
|
|
72
|
+
set closable(t) {
|
|
73
|
+
this.config.closable = t, this.setAttribute("closable", t.toString());
|
|
74
|
+
}
|
|
75
|
+
get title() {
|
|
76
|
+
return this.config.title;
|
|
77
|
+
}
|
|
78
|
+
set title(t) {
|
|
79
|
+
this.config.title = t, this.setAttribute("title", t);
|
|
80
|
+
}
|
|
81
|
+
get icon() {
|
|
82
|
+
return this.config.icon;
|
|
83
|
+
}
|
|
84
|
+
set icon(t) {
|
|
85
|
+
this.config.icon = t, this.setAttribute("icon", t);
|
|
86
|
+
}
|
|
87
|
+
get showToggleButton() {
|
|
88
|
+
return this.config.showToggleButton;
|
|
89
|
+
}
|
|
90
|
+
set showToggleButton(t) {
|
|
91
|
+
this.config.showToggleButton = t, this.setAttribute("show-toggle-button", t.toString());
|
|
92
|
+
}
|
|
93
|
+
get contentPadding() {
|
|
94
|
+
return this.config.contentPadding ?? "16px";
|
|
95
|
+
}
|
|
96
|
+
set contentPadding(t) {
|
|
97
|
+
this.config.contentPadding = t, this.setAttribute("content-padding", t);
|
|
98
|
+
}
|
|
99
|
+
get state() {
|
|
100
|
+
return this.currentState;
|
|
101
|
+
}
|
|
102
|
+
set state(t) {
|
|
103
|
+
this.setState(t);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Expand the drawer
|
|
107
|
+
*/
|
|
108
|
+
expand() {
|
|
109
|
+
this.setState("expanded");
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Shrink the drawer
|
|
113
|
+
*/
|
|
114
|
+
shrink() {
|
|
115
|
+
this.setState("shrunk");
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Close the drawer (removes from DOM)
|
|
119
|
+
*/
|
|
120
|
+
close() {
|
|
121
|
+
this.setState("closed");
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Toggle between expanded and shrunk states
|
|
125
|
+
*/
|
|
126
|
+
toggle() {
|
|
127
|
+
this.currentState === "expanded" ? this.shrink() : this.currentState === "shrunk" && this.expand();
|
|
128
|
+
}
|
|
129
|
+
setState(t) {
|
|
130
|
+
const r = this.currentState;
|
|
131
|
+
this.currentState = t, this.setAttribute("state", t);
|
|
132
|
+
const e = this.shadowRoot.querySelector(".drawer-container");
|
|
133
|
+
if (e) {
|
|
134
|
+
if (this.dispatchEvent(new CustomEvent("drawer-state-change", {
|
|
135
|
+
detail: { oldState: r, newState: t },
|
|
136
|
+
bubbles: !0,
|
|
137
|
+
composed: !0
|
|
138
|
+
})), t === "closed") {
|
|
139
|
+
e.style.display = "none", this.dispatchEvent(new CustomEvent("drawer-closed", { bubbles: !0, composed: !0 })), this.remove();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (t === "shrunk") {
|
|
143
|
+
e.style.display = "block", e.classList.add("shrunk"), e.classList.remove("expanded"), this.dispatchEvent(new CustomEvent("drawer-shrunk", { bubbles: !0, composed: !0 }));
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (t === "expanded") {
|
|
147
|
+
e.style.display = "block", e.classList.remove("shrunk"), e.classList.add("expanded"), this.dispatchEvent(new CustomEvent("drawer-expanded", { bubbles: !0, composed: !0 }));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
bindEvents() {
|
|
153
|
+
this.shadowRoot.addEventListener("click", (t) => {
|
|
154
|
+
const r = t.target;
|
|
155
|
+
r.closest(".drawer-toggle") && (t.preventDefault(), this.toggle()), r.closest(".drawer-close") && this.config.closable && (t.preventDefault(), this.close());
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
render() {
|
|
159
|
+
const t = this.config.direction === "horizontal", r = this.config.showTitleWhenShrunk, e = this.config.showToggleButton !== !1, o = this.config.contentPadding ?? "16px";
|
|
160
|
+
this.shadowRoot.innerHTML = `
|
|
161
|
+
<style>
|
|
162
|
+
:host {
|
|
163
|
+
display: block;
|
|
164
|
+
--drawer-duration: ${this.config.duration}ms;
|
|
165
|
+
--drawer-bg: #ffffff;
|
|
166
|
+
--drawer-border: #e5e7eb;
|
|
167
|
+
--drawer-text: #1f2937;
|
|
168
|
+
--drawer-icon-bg: #f3f4f6;
|
|
169
|
+
--drawer-icon-hover: #e5e7eb;
|
|
170
|
+
--drawer-button-hover: #f9fafb;
|
|
171
|
+
--drawer-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* Container when expanded */
|
|
175
|
+
.drawer-container {
|
|
176
|
+
background: var(--drawer-bg);
|
|
177
|
+
border: 1px solid var(--drawer-border);
|
|
178
|
+
border-radius: 8px;
|
|
179
|
+
box-shadow: var(--drawer-shadow);
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
position: relative;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.drawer-container.horizontal {
|
|
185
|
+
width: var(--drawer-horizontal-size, 300px);
|
|
186
|
+
height: auto;
|
|
187
|
+
transition: none;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.drawer-container.vertical {
|
|
191
|
+
width: auto;
|
|
192
|
+
height: var(--drawer-vertical-size, 300px);
|
|
193
|
+
transition: none;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.drawer-container.expanded {
|
|
197
|
+
opacity: 1;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.drawer-container.shrunk.horizontal {
|
|
201
|
+
width: var(--drawer-horizontal-shrunk-size, 48px);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.drawer-container.shrunk.vertical {
|
|
205
|
+
height: var(--drawer-vertical-shrunk-size, 48px);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Header area with title and buttons */
|
|
209
|
+
.drawer-header {
|
|
210
|
+
display: flex;
|
|
211
|
+
align-items: center;
|
|
212
|
+
gap: 12px;
|
|
213
|
+
padding: 12px;
|
|
214
|
+
border-bottom: 1px solid var(--drawer-border);
|
|
215
|
+
transition: none;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.drawer-container.shrunk .drawer-header {
|
|
219
|
+
border-bottom: none;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.drawer-container.shrunk .drawer-title:not(.keep-visible),
|
|
223
|
+
.drawer-container.shrunk .drawer-close {
|
|
224
|
+
display: none;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.drawer-container.shrunk .drawer-title.keep-visible {
|
|
228
|
+
display: block;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.drawer-toggle {
|
|
232
|
+
display: flex;
|
|
233
|
+
align-items: center;
|
|
234
|
+
justify-content: center;
|
|
235
|
+
width: 28px;
|
|
236
|
+
height: 28px;
|
|
237
|
+
background: var(--drawer-icon-bg);
|
|
238
|
+
border: none;
|
|
239
|
+
border-radius: 6px;
|
|
240
|
+
cursor: pointer;
|
|
241
|
+
font-size: 16px;
|
|
242
|
+
transition: background 0.2s;
|
|
243
|
+
flex-shrink: 0;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.drawer-toggle:hover {
|
|
247
|
+
background: var(--drawer-icon-hover);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.drawer-title {
|
|
251
|
+
flex: 1;
|
|
252
|
+
font-size: 16px;
|
|
253
|
+
font-weight: 600;
|
|
254
|
+
color: var(--drawer-text);
|
|
255
|
+
transition: none;
|
|
256
|
+
white-space: nowrap;
|
|
257
|
+
overflow: hidden;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.drawer-close {
|
|
261
|
+
display: flex;
|
|
262
|
+
align-items: center;
|
|
263
|
+
justify-content: center;
|
|
264
|
+
width: 24px;
|
|
265
|
+
height: 24px;
|
|
266
|
+
background: transparent;
|
|
267
|
+
border: none;
|
|
268
|
+
border-radius: 4px;
|
|
269
|
+
cursor: pointer;
|
|
270
|
+
font-size: 18px;
|
|
271
|
+
color: #6b7280;
|
|
272
|
+
transition: none;
|
|
273
|
+
flex-shrink: 0;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.drawer-close:hover {
|
|
277
|
+
background: var(--drawer-button-hover);
|
|
278
|
+
color: #ef4444;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* Content area */
|
|
282
|
+
.drawer-content {
|
|
283
|
+
padding: var(--drawer-content-padding, 16px);
|
|
284
|
+
transition: none;
|
|
285
|
+
overflow: auto;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.drawer-container.shrunk .drawer-content {
|
|
289
|
+
opacity: 0;
|
|
290
|
+
height: 0;
|
|
291
|
+
padding: 0;
|
|
292
|
+
overflow: hidden;
|
|
293
|
+
position: absolute;
|
|
294
|
+
z-index: -1;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* Vertical specific styles */
|
|
298
|
+
.drawer-container.vertical {
|
|
299
|
+
display: flex;
|
|
300
|
+
flex-direction: column;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.drawer-container.vertical .drawer-content {
|
|
304
|
+
flex: 1;
|
|
305
|
+
overflow: auto;
|
|
306
|
+
}
|
|
307
|
+
</style>
|
|
308
|
+
|
|
309
|
+
<div class="drawer-container ${t ? "horizontal" : "vertical"} ${this.currentState}" style="display:block; --drawer-content-padding:${o};">
|
|
310
|
+
<div class="drawer-header">
|
|
311
|
+
${e ? `
|
|
312
|
+
<button class="drawer-toggle" aria-label="Toggle drawer">
|
|
313
|
+
${this.config.icon}
|
|
314
|
+
</button>
|
|
315
|
+
` : ""}
|
|
316
|
+
<div class="drawer-title ${r ? "keep-visible" : ""}">
|
|
317
|
+
${this.config.title}
|
|
318
|
+
</div>
|
|
319
|
+
${this.config.closable ? `
|
|
320
|
+
<button class="drawer-close" aria-label="Close drawer">
|
|
321
|
+
×
|
|
322
|
+
</button>
|
|
323
|
+
` : ""}
|
|
324
|
+
</div>
|
|
325
|
+
<div class="drawer-content">
|
|
326
|
+
<slot></slot>
|
|
327
|
+
</div>
|
|
328
|
+
</div>
|
|
329
|
+
`;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
customElements.get("liwe3-drawer") || customElements.define("liwe3-drawer", n);
|
|
333
|
+
function s(i = "liwe3-drawer") {
|
|
334
|
+
customElements.get(i) || customElements.define(i, n);
|
|
335
|
+
}
|
|
336
|
+
export {
|
|
337
|
+
n as DrawerElement,
|
|
338
|
+
s as defineDrawer
|
|
339
|
+
};
|
|
340
|
+
//# sourceMappingURL=Drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawer.js","sources":["../src/Drawer.ts"],"sourcesContent":["/**\n * Drawer Web Component\n * A container that can be expanded, shrunk, or closed with smooth animations\n */\n\nexport type DrawerDirection = 'horizontal' | 'vertical';\nexport type DrawerState = 'expanded' | 'shrunk' | 'closed';\n\nexport interface DrawerConfig {\n direction?: DrawerDirection;\n duration?: number;\n showTitleWhenShrunk?: boolean;\n closable?: boolean;\n title?: string;\n icon?: string;\n showToggleButton?: boolean;\n contentPadding?: string;\n}\n\nexport class DrawerElement extends HTMLElement {\n declare shadowRoot: ShadowRoot;\n private currentState: DrawerState = 'expanded';\n private config: DrawerConfig = {\n direction: 'horizontal',\n duration: 300,\n showTitleWhenShrunk: false,\n closable: true,\n title: '',\n icon: '☰',\n showToggleButton: true,\n contentPadding: '16px'\n };\n\n constructor () {\n super();\n this.attachShadow( { mode: 'open' } );\n this.render();\n this.bindEvents();\n }\n\n static get observedAttributes (): string[] {\n return [ 'direction', 'duration', 'show-title-when-shrunk', 'closable', 'title', 'icon', 'state', 'show-toggle-button', 'content-padding' ];\n }\n\n attributeChangedCallback ( name: string, oldValue: string | null, newValue: string | null ): void {\n if ( oldValue !== newValue ) {\n switch ( name ) {\n case 'direction':\n this.config.direction = ( newValue as DrawerDirection ) || 'horizontal';\n break;\n case 'duration':\n this.config.duration = parseInt( newValue || '300', 10 );\n break;\n case 'show-title-when-shrunk':\n this.config.showTitleWhenShrunk = newValue === 'true';\n break;\n case 'closable':\n this.config.closable = newValue !== 'false';\n break;\n case 'title':\n this.config.title = newValue || '';\n break;\n case 'icon':\n this.config.icon = newValue || '☰';\n break;\n case 'state':\n this.currentState = ( newValue as DrawerState ) || 'expanded';\n break;\n case 'show-toggle-button':\n this.config.showToggleButton = newValue !== 'false';\n break;\n case 'content-padding':\n this.config.contentPadding = newValue ?? undefined;\n break;\n }\n this.render();\n }\n }\n\n get direction (): DrawerDirection {\n return this.config.direction!;\n }\n\n set direction ( value: DrawerDirection ) {\n this.config.direction = value;\n this.setAttribute( 'direction', value );\n }\n\n get duration (): number {\n return this.config.duration!;\n }\n\n set duration ( value: number ) {\n this.config.duration = value;\n this.setAttribute( 'duration', value.toString() );\n }\n\n get showTitleWhenShrunk (): boolean {\n return this.config.showTitleWhenShrunk!;\n }\n\n set showTitleWhenShrunk ( value: boolean ) {\n this.config.showTitleWhenShrunk = value;\n this.setAttribute( 'show-title-when-shrunk', value.toString() );\n }\n\n get closable (): boolean {\n return this.config.closable!;\n }\n\n set closable ( value: boolean ) {\n this.config.closable = value;\n this.setAttribute( 'closable', value.toString() );\n }\n\n get title (): string {\n return this.config.title!;\n }\n\n set title ( value: string ) {\n this.config.title = value;\n this.setAttribute( 'title', value );\n }\n\n get icon (): string {\n return this.config.icon!;\n }\n\n set icon ( value: string ) {\n this.config.icon = value;\n this.setAttribute( 'icon', value );\n }\n\n get showToggleButton (): boolean {\n return this.config.showToggleButton!;\n }\n\n set showToggleButton ( value: boolean ) {\n this.config.showToggleButton = value;\n this.setAttribute( 'show-toggle-button', value.toString() );\n }\n\n get contentPadding (): string {\n return this.config.contentPadding ?? '16px';\n }\n\n set contentPadding ( value: string ) {\n this.config.contentPadding = value;\n this.setAttribute( 'content-padding', value );\n }\n\n get state (): DrawerState {\n return this.currentState;\n }\n\n set state ( value: DrawerState ) {\n this.setState( value );\n }\n\n /**\n * Expand the drawer\n */\n expand (): void {\n this.setState( 'expanded' );\n }\n\n /**\n * Shrink the drawer\n */\n shrink (): void {\n this.setState( 'shrunk' );\n }\n\n /**\n * Close the drawer (removes from DOM)\n */\n close (): void {\n this.setState( 'closed' );\n }\n\n /**\n * Toggle between expanded and shrunk states\n */\n toggle (): void {\n if ( this.currentState === 'expanded' ) {\n this.shrink();\n } else if ( this.currentState === 'shrunk' ) {\n this.expand();\n }\n }\n\n private setState ( newState: DrawerState ): void {\n const oldState = this.currentState;\n this.currentState = newState;\n this.setAttribute( 'state', newState );\n\n const container = this.shadowRoot.querySelector( '.drawer-container' ) as HTMLElement;\n if ( !container ) return;\n\n // Dispatch state change event\n this.dispatchEvent( new CustomEvent( 'drawer-state-change', {\n detail: { oldState, newState },\n bubbles: true,\n composed: true\n } ) );\n\n if ( newState === 'closed' ) {\n // Immediately remove from DOM (no animation) without visual jump\n container.style.display = 'none';\n this.dispatchEvent( new CustomEvent( 'drawer-closed', { bubbles: true, composed: true } ) );\n this.remove();\n return;\n }\n\n if ( newState === 'shrunk' ) {\n container.style.display = 'block';\n container.classList.add( 'shrunk' );\n container.classList.remove( 'expanded' );\n this.dispatchEvent( new CustomEvent( 'drawer-shrunk', { bubbles: true, composed: true } ) );\n return;\n }\n\n if ( newState === 'expanded' ) {\n container.style.display = 'block';\n container.classList.remove( 'shrunk' );\n container.classList.add( 'expanded' );\n this.dispatchEvent( new CustomEvent( 'drawer-expanded', { bubbles: true, composed: true } ) );\n return;\n }\n }\n\n private bindEvents (): void {\n this.shadowRoot.addEventListener( 'click', ( e ) => {\n const target = e.target as HTMLElement;\n\n if ( target.closest( '.drawer-toggle' ) ) {\n e.preventDefault();\n this.toggle();\n }\n\n if ( target.closest( '.drawer-close' ) && this.config.closable ) {\n e.preventDefault();\n this.close();\n }\n } );\n }\n\n private render (): void {\n const isHorizontal = this.config.direction === 'horizontal';\n const showTitle = this.config.showTitleWhenShrunk;\n const showToggleButton = this.config.showToggleButton !== false;\n const contentPadding = this.config.contentPadding ?? '16px';\n\n this.shadowRoot.innerHTML = `\n <style>\n :host {\n display: block;\n --drawer-duration: ${ this.config.duration }ms;\n --drawer-bg: #ffffff;\n --drawer-border: #e5e7eb;\n --drawer-text: #1f2937;\n --drawer-icon-bg: #f3f4f6;\n --drawer-icon-hover: #e5e7eb;\n --drawer-button-hover: #f9fafb;\n --drawer-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n }\n\n /* Container when expanded */\n .drawer-container {\n background: var(--drawer-bg);\n border: 1px solid var(--drawer-border);\n border-radius: 8px;\n box-shadow: var(--drawer-shadow);\n overflow: hidden;\n position: relative;\n }\n\n .drawer-container.horizontal {\n width: var(--drawer-horizontal-size, 300px);\n height: auto;\n transition: none;\n }\n\n .drawer-container.vertical {\n width: auto;\n height: var(--drawer-vertical-size, 300px);\n transition: none;\n }\n\n .drawer-container.expanded {\n opacity: 1;\n }\n\n .drawer-container.shrunk.horizontal {\n width: var(--drawer-horizontal-shrunk-size, 48px);\n }\n\n .drawer-container.shrunk.vertical {\n height: var(--drawer-vertical-shrunk-size, 48px);\n }\n\n /* Header area with title and buttons */\n .drawer-header {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 12px;\n border-bottom: 1px solid var(--drawer-border);\n transition: none;\n }\n\n .drawer-container.shrunk .drawer-header {\n border-bottom: none;\n }\n\n .drawer-container.shrunk .drawer-title:not(.keep-visible),\n .drawer-container.shrunk .drawer-close {\n display: none;\n }\n\n .drawer-container.shrunk .drawer-title.keep-visible {\n display: block;\n }\n\n .drawer-toggle {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n background: var(--drawer-icon-bg);\n border: none;\n border-radius: 6px;\n cursor: pointer;\n font-size: 16px;\n transition: background 0.2s;\n flex-shrink: 0;\n }\n\n .drawer-toggle:hover {\n background: var(--drawer-icon-hover);\n }\n\n .drawer-title {\n flex: 1;\n font-size: 16px;\n font-weight: 600;\n color: var(--drawer-text);\n transition: none;\n white-space: nowrap;\n overflow: hidden;\n }\n\n .drawer-close {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n background: transparent;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 18px;\n color: #6b7280;\n transition: none;\n flex-shrink: 0;\n }\n\n .drawer-close:hover {\n background: var(--drawer-button-hover);\n color: #ef4444;\n }\n\n /* Content area */\n .drawer-content {\n padding: var(--drawer-content-padding, 16px);\n transition: none;\n overflow: auto;\n }\n\n .drawer-container.shrunk .drawer-content {\n opacity: 0;\n height: 0;\n padding: 0;\n overflow: hidden;\n position: absolute;\n z-index: -1;\n }\n\n /* Vertical specific styles */\n .drawer-container.vertical {\n display: flex;\n flex-direction: column;\n }\n\n .drawer-container.vertical .drawer-content {\n flex: 1;\n overflow: auto;\n }\n </style>\n\n <div class=\"drawer-container ${ isHorizontal ? 'horizontal' : 'vertical' } ${ this.currentState }\" style=\"display:block; --drawer-content-padding:${ contentPadding };\">\n <div class=\"drawer-header\">\n ${ showToggleButton ? `\n <button class=\"drawer-toggle\" aria-label=\"Toggle drawer\">\n ${ this.config.icon }\n </button>\n ` : '' }\n <div class=\"drawer-title ${ showTitle ? 'keep-visible' : '' }\">\n ${ this.config.title }\n </div>\n ${ this.config.closable ? `\n <button class=\\\"drawer-close\\\" aria-label=\\\"Close drawer\\\">\\n ×\\n </button>\n ` : '' }\n </div>\n <div class=\"drawer-content\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n}\n\n// Auto-register the custom element\nif ( !customElements.get( 'liwe3-drawer' ) ) {\n customElements.define( 'liwe3-drawer', DrawerElement );\n}\n\n// Export a function to manually register with a custom tag name\nexport function defineDrawer ( tagName: string = 'liwe3-drawer' ): void {\n if ( !customElements.get( tagName ) ) {\n customElements.define( tagName, DrawerElement );\n }\n}\n"],"names":["DrawerElement","name","oldValue","newValue","value","newState","oldState","container","e","target","isHorizontal","showTitle","showToggleButton","contentPadding","defineDrawer","tagName"],"mappings":"AAmBO,MAAMA,UAAsB,YAAY;AAAA,EAc7C,cAAe;AACb,UAAA,GAbF,KAAQ,eAA4B,YACpC,KAAQ,SAAuB;AAAA,MAC7B,WAAW;AAAA,MACX,UAAU;AAAA,MACV,qBAAqB;AAAA,MACrB,UAAU;AAAA,MACV,OAAO;AAAA,MACP,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,IAAA,GAKhB,KAAK,aAAc,EAAE,MAAM,OAAA,CAAS,GACpC,KAAK,OAAA,GACL,KAAK,WAAA;AAAA,EACP;AAAA,EAEA,WAAW,qBAAgC;AACzC,WAAO,CAAE,aAAa,YAAY,0BAA0B,YAAY,SAAS,QAAQ,SAAS,sBAAsB,iBAAkB;AAAA,EAC5I;AAAA,EAEA,yBAA2BC,GAAcC,GAAyBC,GAAgC;AAChG,QAAKD,MAAaC,GAAW;AAC3B,cAASF,GAAA;AAAA,QACP,KAAK;AACH,eAAK,OAAO,YAAcE,KAAiC;AAC3D;AAAA,QACF,KAAK;AACH,eAAK,OAAO,WAAW,SAAUA,KAAY,OAAO,EAAG;AACvD;AAAA,QACF,KAAK;AACH,e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ACF;AAGM,eAAe,IAAK,cAAe,KACvC,eAAe,OAAQ,gBAAgBX,CAAc;AAIhD,SAASc,EAAeC,IAAkB,gBAAuB;AACtE,EAAM,eAAe,IAAKA,CAAQ,KAChC,eAAe,OAAQA,GAASf,CAAc;AAElD;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type ImageMode = 'stretch' | '1:1' | 'cover' | 'contain';
|
|
2
|
+
export type ImagePosition = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
3
|
+
export type ImageFX = 'none' | 'bokeh' | 'pan-left' | 'pan-right' | 'zoom-in' | 'zoom-out';
|
|
4
|
+
export declare class ImageView extends HTMLElement {
|
|
5
|
+
private _src;
|
|
6
|
+
private _width;
|
|
7
|
+
private _height;
|
|
8
|
+
private _mode;
|
|
9
|
+
private _position;
|
|
10
|
+
private _fx;
|
|
11
|
+
private _fxHover;
|
|
12
|
+
private _alt;
|
|
13
|
+
private _isHovering;
|
|
14
|
+
private container;
|
|
15
|
+
private img;
|
|
16
|
+
constructor();
|
|
17
|
+
private _handleMouseEnter;
|
|
18
|
+
private _handleMouseLeave;
|
|
19
|
+
static get observedAttributes(): string[];
|
|
20
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
private updateDimensions;
|
|
23
|
+
private updateClasses;
|
|
24
|
+
private render;
|
|
25
|
+
get src(): string;
|
|
26
|
+
set src(value: string);
|
|
27
|
+
get width(): string;
|
|
28
|
+
set width(value: string);
|
|
29
|
+
get height(): string;
|
|
30
|
+
set height(value: string);
|
|
31
|
+
get mode(): ImageMode;
|
|
32
|
+
set mode(value: ImageMode);
|
|
33
|
+
get position(): ImagePosition;
|
|
34
|
+
set position(value: ImagePosition);
|
|
35
|
+
get fx(): ImageFX;
|
|
36
|
+
set fx(value: ImageFX);
|
|
37
|
+
get fxHover(): ImageFX;
|
|
38
|
+
set fxHover(value: ImageFX);
|
|
39
|
+
get alt(): string;
|
|
40
|
+
set alt(value: string);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=ImageView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageView.d.ts","sourceRoot":"","sources":["../src/ImageView.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;AACvI,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAE3F,qBAAa,SAAU,SAAQ,WAAW;IACzC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,GAAG,CAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,WAAW,CAAkB;IAErC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,GAAG,CAAmB;;IAuH9B,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,iBAAiB;IAOzB,MAAM,KAAK,kBAAkB,aAE5B;IAED,wBAAwB,CAAG,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAuC3E,iBAAiB;IAMjB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,MAAM;IAqBd,IAAI,GAAG,IAAK,MAAM,CAAsB;I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