zois-core 2.0.3 → 2.0.5
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/changelogs.js +32 -11
- package/dist/shards/buttonShard.js +3 -2
- package/dist/shards/checkboxShard.js +53 -25
- package/dist/shards/shard.js +18 -12
- package/dist/shards/textShard.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/shards/checkboxShard.d.ts +2 -0
- package/package.json +1 -1
package/dist/changelogs.js
CHANGED
|
@@ -107,24 +107,30 @@ function showChangelogModal() {
|
|
|
107
107
|
modal.appendChild(content);
|
|
108
108
|
overlay.appendChild(modal);
|
|
109
109
|
document.body.appendChild(overlay);
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const exitHandler = () => {
|
|
111
|
+
document.removeEventListener("keydown", keyDownHandler, { capture: true });
|
|
112
|
+
document.body.removeChild(overlay);
|
|
112
113
|
};
|
|
113
|
-
|
|
114
|
-
document.addEventListener("keydown", function handler(e) {
|
|
114
|
+
const keyDownHandler = (e) => {
|
|
115
115
|
if (e.key === "Escape") {
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
exitHandler();
|
|
118
119
|
}
|
|
119
|
-
}
|
|
120
|
+
};
|
|
121
|
+
overlay.onclick = (e) => {
|
|
122
|
+
if (e.target === overlay) exitHandler();
|
|
123
|
+
};
|
|
124
|
+
closeBtn.onclick = exitHandler;
|
|
125
|
+
document.addEventListener("keydown", keyDownHandler, { capture: true });
|
|
120
126
|
}
|
|
121
127
|
function createCommitElement(changelogCommit) {
|
|
122
128
|
try {
|
|
123
129
|
const commitDiv = document.createElement("div");
|
|
124
130
|
commitDiv.style.cssText = `
|
|
125
131
|
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
126
133
|
gap: 12px;
|
|
127
|
-
align-items: center;
|
|
128
134
|
padding: 12px;
|
|
129
135
|
border: 1px solid #e5e7eb;
|
|
130
136
|
border-radius: 8px;
|
|
@@ -132,6 +138,13 @@ function createCommitElement(changelogCommit) {
|
|
|
132
138
|
`;
|
|
133
139
|
commitDiv.onmouseover = () => commitDiv.style.borderColor = "#3b82f6";
|
|
134
140
|
commitDiv.onmouseout = () => commitDiv.style.borderColor = "#e5e7eb";
|
|
141
|
+
const avatarAndInfo = document.createElement("div");
|
|
142
|
+
avatarAndInfo.style.cssText = `
|
|
143
|
+
display: flex;
|
|
144
|
+
gap: 12px;
|
|
145
|
+
align-items: center;
|
|
146
|
+
`;
|
|
147
|
+
commitDiv.append(avatarAndInfo);
|
|
135
148
|
const avatar = document.createElement("img");
|
|
136
149
|
avatar.src = changelogCommit.author.avatar_url;
|
|
137
150
|
avatar.style.cssText = `
|
|
@@ -140,18 +153,29 @@ function createCommitElement(changelogCommit) {
|
|
|
140
153
|
border-radius: 50%;
|
|
141
154
|
flex-shrink: 0;
|
|
142
155
|
`;
|
|
156
|
+
avatarAndInfo.append(avatar);
|
|
143
157
|
const info = document.createElement("div");
|
|
144
158
|
info.style.flex = "1";
|
|
145
159
|
info.style.position = "relative";
|
|
160
|
+
avatarAndInfo.append(info);
|
|
146
161
|
const author = document.createElement("div");
|
|
147
162
|
author.textContent = changelogCommit.author.name;
|
|
148
163
|
author.style.fontWeight = "600";
|
|
149
164
|
author.style.marginBottom = "4px";
|
|
165
|
+
info.append(author);
|
|
150
166
|
const message = document.createElement("div");
|
|
151
167
|
message.textContent = changelogCommit.message;
|
|
152
168
|
message.style.cssText = "color: #374151; line-height: 1.4;";
|
|
169
|
+
info.append(message);
|
|
170
|
+
if (changelogCommit.note) {
|
|
171
|
+
const note = document.createElement("div");
|
|
172
|
+
note.textContent = changelogCommit.note ?? "";
|
|
173
|
+
note.style.cssText = "color: #374151; line-height: 1; font-size: 0.8em;";
|
|
174
|
+
commitDiv.append(note);
|
|
175
|
+
}
|
|
153
176
|
const tags = document.createElement("div");
|
|
154
177
|
tags.style.cssText = "display: flex; gap: 4px; position: absolute; right: 2px; top: 2px;";
|
|
178
|
+
info.append(tags);
|
|
155
179
|
for (const tag of changelogCommit.tags) {
|
|
156
180
|
const tagEl = document.createElement("p");
|
|
157
181
|
tagEl.textContent = TAGS[tag].name;
|
|
@@ -169,13 +193,10 @@ function createCommitElement(changelogCommit) {
|
|
|
169
193
|
});
|
|
170
194
|
tags.append(tagEl);
|
|
171
195
|
}
|
|
172
|
-
info.append(author, message, tags);
|
|
173
196
|
commitDiv.style.cursor = "pointer";
|
|
174
197
|
commitDiv.onclick = () => {
|
|
175
198
|
window.open(changelogCommit.commit_url, "_blank");
|
|
176
199
|
};
|
|
177
|
-
commitDiv.appendChild(avatar);
|
|
178
|
-
commitDiv.appendChild(info);
|
|
179
200
|
return commitDiv;
|
|
180
201
|
} catch (err) {
|
|
181
202
|
logger.error(`Failed to load commit ${changelogCommit.sha}:`, err);
|
|
@@ -107,8 +107,9 @@ class ButtonShard extends Shard {
|
|
|
107
107
|
if (text) {
|
|
108
108
|
textElement = document.createElement("span");
|
|
109
109
|
textElement.textContent = text;
|
|
110
|
-
textElement.style.
|
|
111
|
-
textElement.style.
|
|
110
|
+
textElement.style.overflow = "auto";
|
|
111
|
+
textElement.style.padding = "0.08em";
|
|
112
|
+
textElement.style.maxHeight = "100%";
|
|
112
113
|
btn.append(textElement);
|
|
113
114
|
}
|
|
114
115
|
if (tooltip) {
|
|
@@ -15,6 +15,7 @@ class CheckboxShard extends Shard {
|
|
|
15
15
|
display: "flex",
|
|
16
16
|
alignItems: "center",
|
|
17
17
|
justifyContent: "center",
|
|
18
|
+
flexShrink: "0",
|
|
18
19
|
transition: "background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
19
20
|
appearance: "none"
|
|
20
21
|
},
|
|
@@ -22,7 +23,7 @@ class CheckboxShard extends Shard {
|
|
|
22
23
|
backgroundColor: "var(--tmd-accent, black)",
|
|
23
24
|
borderColor: "var(--tmd-accent, black)"
|
|
24
25
|
},
|
|
25
|
-
":checked
|
|
26
|
+
":checked + svg": {
|
|
26
27
|
strokeDashoffset: "0"
|
|
27
28
|
},
|
|
28
29
|
":checked:hover": {
|
|
@@ -35,8 +36,33 @@ class CheckboxShard extends Shard {
|
|
|
35
36
|
},
|
|
36
37
|
".pop": {
|
|
37
38
|
animation: "pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards"
|
|
38
|
-
}
|
|
39
|
-
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
get dynamicClassCheckmark() {
|
|
43
|
+
return {
|
|
44
|
+
base: {
|
|
45
|
+
position: "absolute",
|
|
46
|
+
top: "50%",
|
|
47
|
+
left: "50%",
|
|
48
|
+
transform: "translate(-50%, -50%)",
|
|
49
|
+
width: "70%",
|
|
50
|
+
height: "70%",
|
|
51
|
+
pointerEvents: "none",
|
|
52
|
+
stroke: "var(--tmd-text, white)",
|
|
53
|
+
strokeWidth: "3.5",
|
|
54
|
+
strokeLinecap: "round",
|
|
55
|
+
strokeLinejoin: "round",
|
|
56
|
+
fill: "none",
|
|
57
|
+
strokeDasharray: "24",
|
|
58
|
+
strokeDashoffset: "24",
|
|
59
|
+
transition: "stroke-dashoffset 0.45s cubic-bezier(0.25, 0.1, 0.25, 1)"
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
get dynamicClassTooltip() {
|
|
64
|
+
return {
|
|
65
|
+
base: {
|
|
40
66
|
position: "absolute",
|
|
41
67
|
color: "var(--tmd-text, black)",
|
|
42
68
|
fontSize: "0.65em",
|
|
@@ -46,32 +72,29 @@ class CheckboxShard extends Shard {
|
|
|
46
72
|
background: "var(--tmd-element-hint, #e6e6e6)",
|
|
47
73
|
width: "max-content",
|
|
48
74
|
visibility: "hidden",
|
|
49
|
-
zIndex: "10"
|
|
75
|
+
zIndex: "10",
|
|
76
|
+
pointerEvents: "none",
|
|
77
|
+
whiteSpace: "nowrap"
|
|
50
78
|
},
|
|
51
|
-
"
|
|
79
|
+
"[position=left]": {
|
|
52
80
|
right: "calc(100% + 1vw)"
|
|
53
81
|
},
|
|
54
|
-
"
|
|
82
|
+
"[position=right]": {
|
|
55
83
|
left: "calc(100% + 1vw)"
|
|
56
|
-
},
|
|
57
|
-
":hover .tooltip": {
|
|
58
|
-
visibility: "visible"
|
|
59
84
|
}
|
|
60
85
|
};
|
|
61
86
|
}
|
|
62
|
-
get
|
|
87
|
+
get dynamicClassBox() {
|
|
63
88
|
return {
|
|
64
89
|
base: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
strokeDashoffset: "24",
|
|
74
|
-
transition: "stroke-dashoffset 0.45s cubic-bezier(0.25, 0.1, 0.25, 1)"
|
|
90
|
+
position: "relative",
|
|
91
|
+
display: "inline-flex",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
justifyContent: "center",
|
|
94
|
+
flexShrink: "0"
|
|
95
|
+
},
|
|
96
|
+
":hover .tooltip": {
|
|
97
|
+
visibility: "visible"
|
|
75
98
|
}
|
|
76
99
|
};
|
|
77
100
|
}
|
|
@@ -85,6 +108,9 @@ class CheckboxShard extends Shard {
|
|
|
85
108
|
wrapper.style.alignItems = "center";
|
|
86
109
|
wrapper.style.columnGap = "1vw";
|
|
87
110
|
wrapper.style.padding = "0.25em";
|
|
111
|
+
setFontFamily(wrapper, MOD_DATA.fontFamily);
|
|
112
|
+
const box = document.createElement("div");
|
|
113
|
+
addDynamicClass(box, this.dynamicClassBox);
|
|
88
114
|
const input = document.createElement("input");
|
|
89
115
|
input.type = "checkbox";
|
|
90
116
|
input.checked = isChecked;
|
|
@@ -93,12 +119,14 @@ class CheckboxShard extends Shard {
|
|
|
93
119
|
const checkmark = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
94
120
|
checkmark.setAttribute("viewBox", "0 0 24 24");
|
|
95
121
|
checkmark.setAttribute("class", "checkmark");
|
|
96
|
-
|
|
122
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
123
|
+
path.setAttribute("d", "M5 13L9 17L19 7");
|
|
124
|
+
checkmark.appendChild(path);
|
|
97
125
|
addDynamicClass(checkmark, this.dynamicClassCheckmark);
|
|
126
|
+
box.append(input, checkmark);
|
|
98
127
|
const label = document.createElement("p");
|
|
99
128
|
label.textContent = text;
|
|
100
129
|
label.style.color = this.textColor;
|
|
101
|
-
setFontFamily(label, MOD_DATA.fontFamily);
|
|
102
130
|
if (typeof isDisabled === "function" && isDisabled()) {
|
|
103
131
|
input.disabled = true;
|
|
104
132
|
wrapper.classList.add("zcDisabled");
|
|
@@ -112,14 +140,14 @@ class CheckboxShard extends Shard {
|
|
|
112
140
|
if (input.checked) {
|
|
113
141
|
}
|
|
114
142
|
});
|
|
115
|
-
|
|
116
|
-
wrapper.append(input, label);
|
|
143
|
+
wrapper.append(box, label);
|
|
117
144
|
if (tooltip) {
|
|
118
145
|
const tooltipEl = document.createElement("span");
|
|
119
146
|
tooltipEl.classList.add("tooltip");
|
|
120
147
|
tooltipEl.setAttribute("position", tooltip.position);
|
|
121
148
|
tooltipEl.textContent = tooltip.text;
|
|
122
|
-
|
|
149
|
+
addDynamicClass(tooltipEl, this.dynamicClassTooltip);
|
|
150
|
+
box.appendChild(tooltipEl);
|
|
123
151
|
}
|
|
124
152
|
return {
|
|
125
153
|
base: wrapper,
|
package/dist/shards/shard.js
CHANGED
|
@@ -33,10 +33,12 @@ class Shard {
|
|
|
33
33
|
for (const key of Object.keys(modules)) {
|
|
34
34
|
for (const module of modules[key] ?? []) {
|
|
35
35
|
if (module instanceof ShardModule) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
if (this.body?.[key]) {
|
|
37
|
+
try {
|
|
38
|
+
this.context = module.overrideContext(this.context, this.body[key]);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
logger.error("OverrideContext call failed in", module, e);
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -46,10 +48,12 @@ class Shard {
|
|
|
46
48
|
for (const key of Object.keys(modules)) {
|
|
47
49
|
for (const module of modules[key] ?? []) {
|
|
48
50
|
if (module instanceof ShardModule) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (this.body?.[key]) {
|
|
52
|
+
try {
|
|
53
|
+
module.layoutEffect(this.context, this.body[key]);
|
|
54
|
+
} catch (e) {
|
|
55
|
+
logger.error("LayoutEffect call failed in", module, e);
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -59,10 +63,12 @@ class Shard {
|
|
|
59
63
|
for (const key of Object.keys(modules)) {
|
|
60
64
|
for (const module of modules[key] ?? []) {
|
|
61
65
|
if (module instanceof ShardModule) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
if (this.body?.[key]) {
|
|
67
|
+
try {
|
|
68
|
+
module.effect(this.context, this.body[key]);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
logger.error("Effect call failed in", module, e);
|
|
71
|
+
}
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
}
|
package/dist/shards/textShard.js
CHANGED
|
@@ -9,7 +9,8 @@ class TextShard extends Shard {
|
|
|
9
9
|
const p = document.createElement("p");
|
|
10
10
|
p.innerHTML = this.context.text ?? "";
|
|
11
11
|
p.style.color = this.context.color ?? this.defaultColor;
|
|
12
|
-
p.style.overflow = "
|
|
12
|
+
p.style.overflow = "auto";
|
|
13
|
+
p.style.padding = "0.08em";
|
|
13
14
|
if (this.context.withBackground) p.style.background = "var(--tmd-element,rgb(239, 239, 239))";
|
|
14
15
|
if (this.context.withBorder) p.style.border = "2px solid var(--tmd-accent, rgb(236, 236, 236))";
|
|
15
16
|
setFontFamily(p, MOD_DATA.fontFamily);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface CheckboxShardContext extends ShardContext<"checkbox" | "label">
|
|
|
13
13
|
export declare class CheckboxShard extends Shard<CheckboxShardContext> {
|
|
14
14
|
protected get dynamicClassInput(): DynamicClassStyles;
|
|
15
15
|
protected get dynamicClassCheckmark(): DynamicClassStyles;
|
|
16
|
+
protected get dynamicClassTooltip(): DynamicClassStyles;
|
|
17
|
+
protected get dynamicClassBox(): DynamicClassStyles;
|
|
16
18
|
protected get textColor(): string;
|
|
17
19
|
generateBody(): Record<keyof NonNullable<CheckboxShardContext["modules"]>, HTMLElement | SVGElement>;
|
|
18
20
|
update(): void;
|