ds-one 0.2.5-alpha.13 → 0.2.5-alpha.15
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/DS1/1-root/one.css +6 -2
- package/DS1/2-core/ds-banner.ts +194 -1
- package/DS1/2-core/ds-button.ts +17 -1
- package/DS1/4-page/ds-container.ts +1 -0
- package/DS1/4-page/ds-layout.ts +30 -25
- package/README.md +2 -2
- package/dist/2-core/ds-banner.d.ts +71 -0
- package/dist/2-core/ds-banner.d.ts.map +1 -1
- package/dist/2-core/ds-banner.js +171 -1
- package/dist/2-core/ds-button.d.ts.map +1 -1
- package/dist/2-core/ds-button.js +17 -1
- package/dist/4-page/ds-container.d.ts.map +1 -1
- package/dist/4-page/ds-container.js +1 -0
- package/dist/4-page/ds-layout.d.ts.map +1 -1
- package/dist/4-page/ds-layout.js +30 -25
- package/dist/ds-one.bundle.js +48 -26
- package/dist/ds-one.bundle.js.map +2 -2
- package/dist/ds-one.bundle.min.js +53 -31
- package/dist/ds-one.bundle.min.js.map +2 -2
- package/package.json +1 -1
package/DS1/1-root/one.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* version 0.2.5-alpha.
|
|
1
|
+
/* version 0.2.5-alpha.15 */
|
|
2
2
|
|
|
3
3
|
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@200");
|
|
4
4
|
|
|
@@ -28,7 +28,7 @@ input {
|
|
|
28
28
|
|
|
29
29
|
--black: #2a2a2a;
|
|
30
30
|
--white: rgb(255 255 255);
|
|
31
|
-
--slate: #
|
|
31
|
+
--slate: #1e1e1e;
|
|
32
32
|
--slate-light: #e6e6e6;
|
|
33
33
|
--slate-dark: #3c3c3c;
|
|
34
34
|
|
|
@@ -43,6 +43,8 @@ input {
|
|
|
43
43
|
--yellow: #eaff00;
|
|
44
44
|
--orange: #fec20d;
|
|
45
45
|
|
|
46
|
+
--accent-color: var(--apple-green);
|
|
47
|
+
|
|
46
48
|
/* 4-page component colors */
|
|
47
49
|
|
|
48
50
|
/* ds-grid color */
|
|
@@ -94,6 +96,7 @@ input {
|
|
|
94
96
|
--3: calc(var(--1) * 3);
|
|
95
97
|
--4: calc(var(--1) * 4);
|
|
96
98
|
--8: calc(var(--1) * 8);
|
|
99
|
+
--12: calc(var(--1) * 12);
|
|
97
100
|
|
|
98
101
|
/* Semantic sizing units */
|
|
99
102
|
|
|
@@ -106,6 +109,7 @@ input {
|
|
|
106
109
|
--triple: var(--3);
|
|
107
110
|
--quad: var(--4);
|
|
108
111
|
--oct: var(--8);
|
|
112
|
+
--dozen: var(--12);
|
|
109
113
|
|
|
110
114
|
/* size */
|
|
111
115
|
--outline-stroke: 1px solid light-dark(var(--black), var(--slate-dark));
|
package/DS1/2-core/ds-banner.ts
CHANGED
|
@@ -1,3 +1,196 @@
|
|
|
1
1
|
// ds-banner.ts
|
|
2
|
-
//
|
|
2
|
+
// Fixed banner component for notifications/alerts
|
|
3
3
|
|
|
4
|
+
import { LitElement, html, css } from "lit";
|
|
5
|
+
import { getText } from "../0-face/i18n.js";
|
|
6
|
+
import "./ds-text.js";
|
|
7
|
+
import "./ds-button.js";
|
|
8
|
+
|
|
9
|
+
declare global {
|
|
10
|
+
interface CustomElementRegistry {
|
|
11
|
+
define(name: string, constructor: typeof LitElement): void;
|
|
12
|
+
}
|
|
13
|
+
var customElements: CustomElementRegistry;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class Banner extends LitElement {
|
|
17
|
+
static properties = {
|
|
18
|
+
textKey: { type: String, attribute: "text-key" },
|
|
19
|
+
actionKey: { type: String, attribute: "action-key" },
|
|
20
|
+
href: { type: String },
|
|
21
|
+
mailto: { type: String },
|
|
22
|
+
subjectKey: { type: String, attribute: "subject-key" },
|
|
23
|
+
describeKey: { type: String, attribute: "describe-key" },
|
|
24
|
+
appVersionKey: { type: String, attribute: "app-version-key" },
|
|
25
|
+
variant: { type: String },
|
|
26
|
+
version: { type: String },
|
|
27
|
+
_showVersion: { type: Boolean, state: true },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
textKey: string = "";
|
|
31
|
+
actionKey: string = "";
|
|
32
|
+
href: string = "";
|
|
33
|
+
mailto: string = "";
|
|
34
|
+
subjectKey: string = "";
|
|
35
|
+
describeKey: string = "";
|
|
36
|
+
appVersionKey: string = "";
|
|
37
|
+
variant: string = "warning"; // warning, info, success, error
|
|
38
|
+
version: string = "";
|
|
39
|
+
_showVersion: boolean = false;
|
|
40
|
+
|
|
41
|
+
private _boundUpdate = () => this.requestUpdate();
|
|
42
|
+
|
|
43
|
+
connectedCallback() {
|
|
44
|
+
super.connectedCallback();
|
|
45
|
+
// Listen for translations and language changes to rebuild mailto URL
|
|
46
|
+
window.addEventListener("translations-loaded", this._boundUpdate);
|
|
47
|
+
window.addEventListener("language-changed", this._boundUpdate);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
disconnectedCallback() {
|
|
51
|
+
super.disconnectedCallback();
|
|
52
|
+
window.removeEventListener("translations-loaded", this._boundUpdate);
|
|
53
|
+
window.removeEventListener("language-changed", this._boundUpdate);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static styles = css`
|
|
57
|
+
:host {
|
|
58
|
+
display: flex;
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 0;
|
|
61
|
+
left: 0;
|
|
62
|
+
right: 0;
|
|
63
|
+
width: 100%;
|
|
64
|
+
height: calc(var(--unit) * var(--sf, 1));
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: space-between;
|
|
67
|
+
padding: 0 calc(var(--unit) * var(--sf, 1));
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
z-index: 9999;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([variant="warning"]) {
|
|
73
|
+
background-color: color-mix(in srgb, var(--yellow) 50%, transparent);
|
|
74
|
+
--banner-text-color: color-mix(in srgb, var(--black) 50%, transparent);
|
|
75
|
+
--banner-action-color: var(--slate);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host([variant="info"]) {
|
|
79
|
+
background-color: rgba(var(--sharp-blue-rgb, 0, 122, 255), 0.7);
|
|
80
|
+
--banner-text-color: var(--white, #fff);
|
|
81
|
+
--banner-action-color: var(--white, #fff);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:host([variant="success"]) {
|
|
85
|
+
background-color: rgba(var(--apple-green-rgb, 52, 199, 89), 0.7);
|
|
86
|
+
--banner-text-color: var(--white, #fff);
|
|
87
|
+
--banner-action-color: var(--white, #fff);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
:host([variant="error"]) {
|
|
91
|
+
background-color: rgba(var(--tuned-red-rgb, 255, 59, 48), 0.7);
|
|
92
|
+
--banner-text-color: var(--white, #fff);
|
|
93
|
+
--banner-action-color: var(--slate, #1e1e1e);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.text-wrapper {
|
|
97
|
+
flex: 1;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
user-select: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.text-wrapper ds-text,
|
|
103
|
+
.text-wrapper .version {
|
|
104
|
+
color: var(--banner-text-color);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.action-wrapper {
|
|
108
|
+
font-size: calc(12px * var(--sf, 1));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.action-wrapper a {
|
|
112
|
+
color: var(--banner-action-color);
|
|
113
|
+
text-decoration: none;
|
|
114
|
+
font-family: var(--typeface-regular);
|
|
115
|
+
font-size: calc(12px * var(--sf, 1));
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
pointer-events: auto;
|
|
118
|
+
display: inline-block;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.action-wrapper a:hover {
|
|
122
|
+
opacity: 0.8;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.action-wrapper ds-text {
|
|
126
|
+
color: var(--banner-action-color);
|
|
127
|
+
font-family: var(--typeface-regular);
|
|
128
|
+
font-size: calc(12px * var(--sf, 1));
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
private _toggleVersion() {
|
|
134
|
+
if (this.version) {
|
|
135
|
+
this._showVersion = !this._showVersion;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private _getMailtoHref(): string {
|
|
140
|
+
// If a direct href is provided, use it
|
|
141
|
+
if (this.href && this.href !== "#") return this.href;
|
|
142
|
+
|
|
143
|
+
// If mailto is provided, build internationalized URL
|
|
144
|
+
if (this.mailto) {
|
|
145
|
+
try {
|
|
146
|
+
const subject = this.subjectKey
|
|
147
|
+
? getText(this.subjectKey) || this.subjectKey
|
|
148
|
+
: "Issue report";
|
|
149
|
+
const describe = this.describeKey
|
|
150
|
+
? getText(this.describeKey) || this.describeKey
|
|
151
|
+
: "Describe the issue:";
|
|
152
|
+
const appVersionLabel = this.appVersionKey
|
|
153
|
+
? getText(this.appVersionKey) || this.appVersionKey
|
|
154
|
+
: "App version:";
|
|
155
|
+
|
|
156
|
+
const body = `${describe}\n\n\n${appVersionLabel} ${this.version || ""}`;
|
|
157
|
+
|
|
158
|
+
return `mailto:${this.mailto}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
|
|
159
|
+
} catch (error) {
|
|
160
|
+
// Fallback if translations fail
|
|
161
|
+
return `mailto:${this.mailto}?subject=Issue%20report&body=Describe%20the%20issue%3A%0A%0A%0AApp%20version%3A%20${this.version || ""}`;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return "#";
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
render() {
|
|
169
|
+
const mailtoHref = this._getMailtoHref();
|
|
170
|
+
|
|
171
|
+
return html`
|
|
172
|
+
<div class="text-wrapper" @click=${this._toggleVersion}>
|
|
173
|
+
${this._showVersion && this.version
|
|
174
|
+
? html`<ds-text default-value=${this.version}></ds-text>`
|
|
175
|
+
: html`<ds-text key=${this.textKey}><slot></slot></ds-text>`}
|
|
176
|
+
</div>
|
|
177
|
+
${this.actionKey
|
|
178
|
+
? html`
|
|
179
|
+
<div class="action-wrapper">
|
|
180
|
+
<a href=${mailtoHref}>
|
|
181
|
+
<ds-text key=${this.actionKey}></ds-text>
|
|
182
|
+
</a>
|
|
183
|
+
</div>
|
|
184
|
+
`
|
|
185
|
+
: ""}
|
|
186
|
+
`;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
customElements.define("ds-banner", Banner);
|
|
191
|
+
|
|
192
|
+
declare global {
|
|
193
|
+
interface HTMLElementTagNameMap {
|
|
194
|
+
"ds-banner": Banner;
|
|
195
|
+
}
|
|
196
|
+
}
|
package/DS1/2-core/ds-button.ts
CHANGED
|
@@ -56,9 +56,12 @@ export class Button extends LitElement {
|
|
|
56
56
|
static styles = css`
|
|
57
57
|
button {
|
|
58
58
|
max-height: calc(var(--08) * var(--sf));
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
59
62
|
border: none;
|
|
60
63
|
cursor: pointer;
|
|
61
|
-
padding: 0 calc(
|
|
64
|
+
padding: 0 calc(0.5px * var(--sf));
|
|
62
65
|
color: var(--button-text-color);
|
|
63
66
|
font-family: var(--typeface-regular);
|
|
64
67
|
}
|
|
@@ -81,6 +84,19 @@ export class Button extends LitElement {
|
|
|
81
84
|
font-family: var(--typeface-regular);
|
|
82
85
|
}
|
|
83
86
|
|
|
87
|
+
button.text {
|
|
88
|
+
background-color: transparent;
|
|
89
|
+
color: var(--button-color, var(--button-text-color));
|
|
90
|
+
font-family: var(--typeface-regular);
|
|
91
|
+
padding: 0;
|
|
92
|
+
text-decoration: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
button.text:hover {
|
|
96
|
+
opacity: 0.8;
|
|
97
|
+
text-decoration: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
84
100
|
button[bold] {
|
|
85
101
|
font-weight: var(--type-weight-bold);
|
|
86
102
|
font-family: var(--typeface-medium);
|
package/DS1/4-page/ds-layout.ts
CHANGED
|
@@ -28,6 +28,10 @@ export class Layout extends LitElement {
|
|
|
28
28
|
width: 100%;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
slot {
|
|
32
|
+
display: contents;
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
:host([mode="portfolio"]) {
|
|
32
36
|
--portfolio-cols: 120px 480px 40px;
|
|
33
37
|
--portfolio-rows: 120px 120px 60px 180px 60px 120px 60px 20px 120px 120px;
|
|
@@ -96,27 +100,25 @@ export class Layout extends LitElement {
|
|
|
96
100
|
|
|
97
101
|
/* App mode - Base */
|
|
98
102
|
:host([mode="app"]) {
|
|
99
|
-
--app-cols:
|
|
100
|
-
--app-rows: calc(var(--unit) * var(--sf)) calc(var(--
|
|
101
|
-
calc(var(--unit) * var(--sf)) calc(var(--
|
|
102
|
-
calc(var(--unit) * var(--sf));
|
|
103
|
-
--app-areas: "
|
|
104
|
-
--app-overlay-cols:
|
|
103
|
+
--app-cols: 100%;
|
|
104
|
+
--app-rows: calc(var(--unit) * var(--sf)) calc(var(--unit) * var(--sf))
|
|
105
|
+
calc(var(--unit) * var(--sf)) calc(var(--dozen) * var(--sf))
|
|
106
|
+
calc(var(--quad) * var(--sf)) calc(var(--unit) * var(--sf));
|
|
107
|
+
--app-areas: "banner" "." "header" "." "main" "." "footer";
|
|
108
|
+
--app-overlay-cols: 100%;
|
|
105
109
|
--app-overlay-rows: calc(var(--unit) * var(--sf))
|
|
106
|
-
calc(var(--
|
|
107
|
-
calc(var(--unit) * var(--sf))
|
|
110
|
+
calc(var(--unit) * var(--sf)) calc(var(--unit) * var(--sf))
|
|
111
|
+
calc(var(--unit) * var(--sf)) calc(var(--dozen) * var(--sf))
|
|
112
|
+
calc(var(--quad) * var(--sf)) calc(var(--unit) * var(--sf));
|
|
108
113
|
--app-overlay-areas: "banner" "." "header" "." "main" "." "footer";
|
|
109
114
|
grid-template-columns: var(--app-cols);
|
|
110
115
|
grid-template-rows: var(--app-rows);
|
|
111
116
|
grid-template-areas: var(--app-areas);
|
|
112
117
|
min-height: 100vh;
|
|
113
118
|
background-color: transparent;
|
|
114
|
-
width:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
padding: calc(60px * var(--sf, 1)) calc(28px * var(--sf, 1))
|
|
118
|
-
calc(9.751px * var(--sf, 1));
|
|
119
|
-
gap: calc(28px * var(--sf, 1));
|
|
119
|
+
width: calc(240px * var(--sf, 1));
|
|
120
|
+
max-width: calc(240px * var(--sf, 1));
|
|
121
|
+
margin: 0 auto;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
:host([mode="app"]) .view-overlay {
|
|
@@ -135,24 +137,27 @@ export class Layout extends LitElement {
|
|
|
135
137
|
pointer-events: none;
|
|
136
138
|
z-index: 1000;
|
|
137
139
|
display: grid;
|
|
138
|
-
font-size: 18px;
|
|
139
|
-
font-weight: bold;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
.view-area {
|
|
143
143
|
display: flex;
|
|
144
|
+
width: calc(240px * var(--sf, 1));
|
|
145
|
+
height: 100%;
|
|
144
146
|
align-items: center;
|
|
145
147
|
justify-content: center;
|
|
146
|
-
font-size: 10px;
|
|
147
|
-
font-weight: var(--type-weight-default);
|
|
148
148
|
font-family: var(--typeface-regular);
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
font-size: calc(var(--type-size-default) * var(--05));
|
|
150
|
+
color: color-mix(in srgb, var(--tuned-red) 25%, transparent);
|
|
151
|
+
background-color: color-mix(
|
|
152
|
+
in srgb,
|
|
153
|
+
var(--accent-color) 25%,
|
|
154
|
+
transparent
|
|
155
|
+
);
|
|
151
156
|
opacity: 1;
|
|
152
157
|
}
|
|
153
158
|
|
|
154
159
|
:host([mode="portfolio"]) .view-area:nth-of-type(1) {
|
|
155
|
-
|
|
160
|
+
background-color: color-mix(in srgb, var(--tuned-red) 25%, transparent);
|
|
156
161
|
}
|
|
157
162
|
:host([mode="portfolio"]) .view-area:nth-of-type(2) {
|
|
158
163
|
border-color: var(--sharp-blue);
|
|
@@ -184,16 +189,16 @@ export class Layout extends LitElement {
|
|
|
184
189
|
}
|
|
185
190
|
|
|
186
191
|
:host([mode="app"]) .view-area:nth-of-type(1) {
|
|
187
|
-
|
|
192
|
+
background-color: color-mix(in srgb, var(--tuned-red) 25%, transparent);
|
|
188
193
|
}
|
|
189
194
|
:host([mode="app"]) .view-area:nth-of-type(2) {
|
|
190
|
-
|
|
195
|
+
background-color: color-mix(in srgb, var(--sharp-blue) 25%, transparent);
|
|
191
196
|
}
|
|
192
197
|
:host([mode="app"]) .view-area:nth-of-type(3) {
|
|
193
|
-
|
|
198
|
+
background-color: color-mix(in srgb, var(--yellow) 25%, transparent);
|
|
194
199
|
}
|
|
195
200
|
:host([mode="app"]) .view-area:nth-of-type(4) {
|
|
196
|
-
|
|
201
|
+
background-color: color-mix(in srgb, var(--apple-green) 25%, transparent);
|
|
197
202
|
}
|
|
198
203
|
|
|
199
204
|
.view-square {
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# DS one (0.2.5-alpha.
|
|
1
|
+
# DS one (0.2.5-alpha.15)
|
|
2
2
|
|
|
3
3
|
A plug and play design system
|
|
4
4
|
|
|
@@ -20,7 +20,7 @@ yarn add ds-one@alpha
|
|
|
20
20
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
**Note**: Currently published as alpha version `0.2.5-alpha.
|
|
23
|
+
**Note**: Currently published as alpha version `0.2.5-alpha.15`
|
|
24
24
|
|
|
25
25
|
## Quick Start
|
|
26
26
|
|
|
@@ -1 +1,72 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "./ds-text.js";
|
|
3
|
+
import "./ds-button.js";
|
|
4
|
+
declare global {
|
|
5
|
+
interface CustomElementRegistry {
|
|
6
|
+
define(name: string, constructor: typeof LitElement): void;
|
|
7
|
+
}
|
|
8
|
+
var customElements: CustomElementRegistry;
|
|
9
|
+
}
|
|
10
|
+
export declare class Banner extends LitElement {
|
|
11
|
+
static properties: {
|
|
12
|
+
textKey: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
attribute: string;
|
|
15
|
+
};
|
|
16
|
+
actionKey: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
attribute: string;
|
|
19
|
+
};
|
|
20
|
+
href: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
};
|
|
23
|
+
mailto: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
};
|
|
26
|
+
subjectKey: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
attribute: string;
|
|
29
|
+
};
|
|
30
|
+
describeKey: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
attribute: string;
|
|
33
|
+
};
|
|
34
|
+
appVersionKey: {
|
|
35
|
+
type: StringConstructor;
|
|
36
|
+
attribute: string;
|
|
37
|
+
};
|
|
38
|
+
variant: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
};
|
|
41
|
+
version: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
};
|
|
44
|
+
_showVersion: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
state: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
textKey: string;
|
|
50
|
+
actionKey: string;
|
|
51
|
+
href: string;
|
|
52
|
+
mailto: string;
|
|
53
|
+
subjectKey: string;
|
|
54
|
+
describeKey: string;
|
|
55
|
+
appVersionKey: string;
|
|
56
|
+
variant: string;
|
|
57
|
+
version: string;
|
|
58
|
+
_showVersion: boolean;
|
|
59
|
+
private _boundUpdate;
|
|
60
|
+
connectedCallback(): void;
|
|
61
|
+
disconnectedCallback(): void;
|
|
62
|
+
static styles: import("lit").CSSResult;
|
|
63
|
+
private _toggleVersion;
|
|
64
|
+
private _getMailtoHref;
|
|
65
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
66
|
+
}
|
|
67
|
+
declare global {
|
|
68
|
+
interface HTMLElementTagNameMap {
|
|
69
|
+
"ds-banner": Banner;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
1
72
|
//# sourceMappingURL=ds-banner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds-banner.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-banner.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ds-banner.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-banner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,cAAc,CAAC;AACtB,OAAO,gBAAgB,CAAC;AAExB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,UAAU,GAAG,IAAI,CAAC;KAC5D;IACD,IAAI,cAAc,EAAE,qBAAqB,CAAC;CAC3C;AAED,qBAAa,MAAO,SAAQ,UAAU;IACpC,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWf;IAEF,OAAO,EAAE,MAAM,CAAM;IACrB,SAAS,EAAE,MAAM,CAAM;IACvB,IAAI,EAAE,MAAM,CAAM;IAClB,MAAM,EAAE,MAAM,CAAM;IACpB,UAAU,EAAE,MAAM,CAAM;IACxB,WAAW,EAAE,MAAM,CAAM;IACzB,aAAa,EAAE,MAAM,CAAM;IAC3B,OAAO,EAAE,MAAM,CAAa;IAC5B,OAAO,EAAE,MAAM,CAAM;IACrB,YAAY,EAAE,OAAO,CAAS;IAE9B,OAAO,CAAC,YAAY,CAA8B;IAElD,iBAAiB;IAOjB,oBAAoB;IAMpB,MAAM,CAAC,MAAM,0BA2EX;IAEF,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,cAAc;IA6BtB,MAAM;CAoBP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,MAAM,CAAC;KACrB;CACF"}
|
package/dist/2-core/ds-banner.js
CHANGED
|
@@ -1,2 +1,172 @@
|
|
|
1
1
|
// ds-banner.ts
|
|
2
|
-
//
|
|
2
|
+
// Fixed banner component for notifications/alerts
|
|
3
|
+
import { LitElement, html, css } from "lit";
|
|
4
|
+
import { getText } from "../0-face/i18n.js";
|
|
5
|
+
import "./ds-text.js";
|
|
6
|
+
import "./ds-button.js";
|
|
7
|
+
export class Banner extends LitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.textKey = "";
|
|
11
|
+
this.actionKey = "";
|
|
12
|
+
this.href = "";
|
|
13
|
+
this.mailto = "";
|
|
14
|
+
this.subjectKey = "";
|
|
15
|
+
this.describeKey = "";
|
|
16
|
+
this.appVersionKey = "";
|
|
17
|
+
this.variant = "warning"; // warning, info, success, error
|
|
18
|
+
this.version = "";
|
|
19
|
+
this._showVersion = false;
|
|
20
|
+
this._boundUpdate = () => this.requestUpdate();
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback();
|
|
24
|
+
// Listen for translations and language changes to rebuild mailto URL
|
|
25
|
+
window.addEventListener("translations-loaded", this._boundUpdate);
|
|
26
|
+
window.addEventListener("language-changed", this._boundUpdate);
|
|
27
|
+
}
|
|
28
|
+
disconnectedCallback() {
|
|
29
|
+
super.disconnectedCallback();
|
|
30
|
+
window.removeEventListener("translations-loaded", this._boundUpdate);
|
|
31
|
+
window.removeEventListener("language-changed", this._boundUpdate);
|
|
32
|
+
}
|
|
33
|
+
_toggleVersion() {
|
|
34
|
+
if (this.version) {
|
|
35
|
+
this._showVersion = !this._showVersion;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
_getMailtoHref() {
|
|
39
|
+
// If a direct href is provided, use it
|
|
40
|
+
if (this.href && this.href !== "#")
|
|
41
|
+
return this.href;
|
|
42
|
+
// If mailto is provided, build internationalized URL
|
|
43
|
+
if (this.mailto) {
|
|
44
|
+
try {
|
|
45
|
+
const subject = this.subjectKey
|
|
46
|
+
? getText(this.subjectKey) || this.subjectKey
|
|
47
|
+
: "Issue report";
|
|
48
|
+
const describe = this.describeKey
|
|
49
|
+
? getText(this.describeKey) || this.describeKey
|
|
50
|
+
: "Describe the issue:";
|
|
51
|
+
const appVersionLabel = this.appVersionKey
|
|
52
|
+
? getText(this.appVersionKey) || this.appVersionKey
|
|
53
|
+
: "App version:";
|
|
54
|
+
const body = `${describe}\n\n\n${appVersionLabel} ${this.version || ""}`;
|
|
55
|
+
return `mailto:${this.mailto}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
// Fallback if translations fail
|
|
59
|
+
return `mailto:${this.mailto}?subject=Issue%20report&body=Describe%20the%20issue%3A%0A%0A%0AApp%20version%3A%20${this.version || ""}`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return "#";
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
const mailtoHref = this._getMailtoHref();
|
|
66
|
+
return html `
|
|
67
|
+
<div class="text-wrapper" @click=${this._toggleVersion}>
|
|
68
|
+
${this._showVersion && this.version
|
|
69
|
+
? html `<ds-text default-value=${this.version}></ds-text>`
|
|
70
|
+
: html `<ds-text key=${this.textKey}><slot></slot></ds-text>`}
|
|
71
|
+
</div>
|
|
72
|
+
${this.actionKey
|
|
73
|
+
? html `
|
|
74
|
+
<div class="action-wrapper">
|
|
75
|
+
<a href=${mailtoHref}>
|
|
76
|
+
<ds-text key=${this.actionKey}></ds-text>
|
|
77
|
+
</a>
|
|
78
|
+
</div>
|
|
79
|
+
`
|
|
80
|
+
: ""}
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
Banner.properties = {
|
|
85
|
+
textKey: { type: String, attribute: "text-key" },
|
|
86
|
+
actionKey: { type: String, attribute: "action-key" },
|
|
87
|
+
href: { type: String },
|
|
88
|
+
mailto: { type: String },
|
|
89
|
+
subjectKey: { type: String, attribute: "subject-key" },
|
|
90
|
+
describeKey: { type: String, attribute: "describe-key" },
|
|
91
|
+
appVersionKey: { type: String, attribute: "app-version-key" },
|
|
92
|
+
variant: { type: String },
|
|
93
|
+
version: { type: String },
|
|
94
|
+
_showVersion: { type: Boolean, state: true },
|
|
95
|
+
};
|
|
96
|
+
Banner.styles = css `
|
|
97
|
+
:host {
|
|
98
|
+
display: flex;
|
|
99
|
+
position: absolute;
|
|
100
|
+
top: 0;
|
|
101
|
+
left: 0;
|
|
102
|
+
right: 0;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: calc(var(--unit) * var(--sf, 1));
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
padding: 0 calc(var(--unit) * var(--sf, 1));
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
z-index: 9999;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([variant="warning"]) {
|
|
113
|
+
background-color: color-mix(in srgb, var(--yellow) 50%, transparent);
|
|
114
|
+
--banner-text-color: color-mix(in srgb, var(--black) 50%, transparent);
|
|
115
|
+
--banner-action-color: var(--slate);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([variant="info"]) {
|
|
119
|
+
background-color: rgba(var(--sharp-blue-rgb, 0, 122, 255), 0.7);
|
|
120
|
+
--banner-text-color: var(--white, #fff);
|
|
121
|
+
--banner-action-color: var(--white, #fff);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:host([variant="success"]) {
|
|
125
|
+
background-color: rgba(var(--apple-green-rgb, 52, 199, 89), 0.7);
|
|
126
|
+
--banner-text-color: var(--white, #fff);
|
|
127
|
+
--banner-action-color: var(--white, #fff);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:host([variant="error"]) {
|
|
131
|
+
background-color: rgba(var(--tuned-red-rgb, 255, 59, 48), 0.7);
|
|
132
|
+
--banner-text-color: var(--white, #fff);
|
|
133
|
+
--banner-action-color: var(--slate, #1e1e1e);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.text-wrapper {
|
|
137
|
+
flex: 1;
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
user-select: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.text-wrapper ds-text,
|
|
143
|
+
.text-wrapper .version {
|
|
144
|
+
color: var(--banner-text-color);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.action-wrapper {
|
|
148
|
+
font-size: calc(12px * var(--sf, 1));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.action-wrapper a {
|
|
152
|
+
color: var(--banner-action-color);
|
|
153
|
+
text-decoration: none;
|
|
154
|
+
font-family: var(--typeface-regular);
|
|
155
|
+
font-size: calc(12px * var(--sf, 1));
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
pointer-events: auto;
|
|
158
|
+
display: inline-block;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.action-wrapper a:hover {
|
|
162
|
+
opacity: 0.8;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.action-wrapper ds-text {
|
|
166
|
+
color: var(--banner-action-color);
|
|
167
|
+
font-family: var(--typeface-regular);
|
|
168
|
+
font-size: calc(12px * var(--sf, 1));
|
|
169
|
+
pointer-events: none;
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
customElements.define("ds-banner", Banner);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds-button.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-button.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAC5C,OAAO,WAAW,CAAC;AAEnB,qBAAa,MAAO,SAAQ,UAAU;IACpC,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgBf;IAGM,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IAGb,QAAQ,EAAE,OAAO,CAAC;;IAiB1B,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"ds-button.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-button.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAC5C,OAAO,WAAW,CAAC;AAEnB,qBAAa,MAAO,SAAQ,UAAU;IACpC,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgBf;IAGM,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IAGb,QAAQ,EAAE,OAAO,CAAC;;IAiB1B,MAAM,CAAC,MAAM,0BAiEX;IAEF,iBAAiB;IAIjB,MAAM;IAsBN,OAAO,CAAC,YAAY;CAwBrB;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,MAAM,CAAC;KACrB;CACF"}
|
package/dist/2-core/ds-button.js
CHANGED
|
@@ -84,9 +84,12 @@ Button.properties = {
|
|
|
84
84
|
Button.styles = css `
|
|
85
85
|
button {
|
|
86
86
|
max-height: calc(var(--08) * var(--sf));
|
|
87
|
+
display: inline-flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
87
90
|
border: none;
|
|
88
91
|
cursor: pointer;
|
|
89
|
-
padding: 0 calc(
|
|
92
|
+
padding: 0 calc(0.5px * var(--sf));
|
|
90
93
|
color: var(--button-text-color);
|
|
91
94
|
font-family: var(--typeface-regular);
|
|
92
95
|
}
|
|
@@ -109,6 +112,19 @@ Button.styles = css `
|
|
|
109
112
|
font-family: var(--typeface-regular);
|
|
110
113
|
}
|
|
111
114
|
|
|
115
|
+
button.text {
|
|
116
|
+
background-color: transparent;
|
|
117
|
+
color: var(--button-color, var(--button-text-color));
|
|
118
|
+
font-family: var(--typeface-regular);
|
|
119
|
+
padding: 0;
|
|
120
|
+
text-decoration: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
button.text:hover {
|
|
124
|
+
opacity: 0.8;
|
|
125
|
+
text-decoration: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
112
128
|
button[bold] {
|
|
113
129
|
font-weight: var(--type-weight-bold);
|
|
114
130
|
font-family: var(--typeface-medium);
|