ds-one 0.2.5-alpha.12 → 0.2.5-alpha.14

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.
@@ -1,2 +1,172 @@
1
1
  // ds-banner.ts
2
- // Core component
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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rB;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,MAAM,CAAC;KACrB;CACF"}
@@ -84,10 +84,11 @@ Button.properties = {
84
84
  Button.styles = css `
85
85
  button {
86
86
  max-height: calc(var(--08) * var(--sf));
87
- border: none;
87
+ display: inline-flex;
88
+ align-items: center;
89
+ justify-content: center;
88
90
  cursor: pointer;
89
- font-size: calc(var(--type-size-default) * var(--sf));
90
- padding: 0 calc(1px * var(--sf));
91
+ padding: 0 calc(0.5px * var(--sf));
91
92
  color: var(--button-text-color);
92
93
  font-family: var(--typeface-regular);
93
94
  }
@@ -110,6 +111,19 @@ Button.styles = css `
110
111
  font-family: var(--typeface-regular);
111
112
  }
112
113
 
114
+ button.text {
115
+ background-color: transparent;
116
+ color: var(--button-color, var(--button-text-color));
117
+ font-family: var(--typeface-regular);
118
+ padding: 0;
119
+ text-decoration: none;
120
+ }
121
+
122
+ button.text:hover {
123
+ opacity: 0.8;
124
+ text-decoration: none;
125
+ }
126
+
113
127
  button[bold] {
114
128
  font-weight: var(--type-weight-bold);
115
129
  font-family: var(--typeface-medium);
@@ -95,7 +95,7 @@ Text.styles = css `
95
95
  :host {
96
96
  display: inline;
97
97
  font-family: var(--typeface-regular);
98
- font-size: calc(var(--type-size-default) * var(--sf));
98
+ font-size: var(--type-size-default);
99
99
  font-weight: var(--type-weight-default);
100
100
  line-height: calc(var(--type-lineheight-default) * var(--sf));
101
101
  letter-spacing: calc(var(--type-letterspacing-default) * var(--sf));
@@ -0,0 +1,17 @@
1
+ import { LitElement } from "lit";
2
+ declare global {
3
+ interface CustomElementRegistry {
4
+ define(name: string, constructor: typeof LitElement): void;
5
+ }
6
+ var customElements: CustomElementRegistry;
7
+ }
8
+ export declare class Container extends LitElement {
9
+ static styles: import("lit").CSSResult;
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ }
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ "ds-container": Container;
15
+ }
16
+ }
17
+ //# sourceMappingURL=ds-container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ds-container.d.ts","sourceRoot":"","sources":["../../DS1/4-page/ds-container.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,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,SAAU,SAAQ,UAAU;IACvC,MAAM,CAAC,MAAM,0BAiCX;IAEF,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,SAAS,CAAC;KAC3B;CACF"}
@@ -0,0 +1,43 @@
1
+ // ds-container.ts
2
+ // Container component with responsive width constraints
3
+ import { LitElement, html, css } from "lit";
4
+ export class Container extends LitElement {
5
+ render() {
6
+ return html `<slot></slot>`;
7
+ }
8
+ }
9
+ Container.styles = css `
10
+ :host {
11
+ display: flex;
12
+ width: 100%;
13
+ max-width: 100%;
14
+ flex-direction: column;
15
+ background-color: var(--background-color);
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ /* Ensure children don't overflow */
20
+ :host ::slotted(*) {
21
+ max-width: 100%;
22
+ box-sizing: border-box;
23
+ }
24
+
25
+ /* Mobile: 100% width */
26
+ @media (max-width: 820px) {
27
+ :host {
28
+ width: 100%;
29
+ max-width: 100%;
30
+ }
31
+ }
32
+
33
+ /* Desktop: max-width 1000px, centered */
34
+ @media (min-width: 821px) {
35
+ :host {
36
+ max-width: 1000px;
37
+ margin-left: auto;
38
+ margin-right: auto;
39
+ width: 100%;
40
+ }
41
+ }
42
+ `;
43
+ customElements.define("ds-container", Container);
@@ -12,7 +12,12 @@ export declare class Grid extends LitElement {
12
12
  };
13
13
  };
14
14
  align?: string;
15
+ private resizeObserver?;
16
+ private resizeTimeout?;
15
17
  static styles: import("lit").CSSResult;
18
+ connectedCallback(): void;
19
+ disconnectedCallback(): void;
20
+ private updateMobileClass;
16
21
  render(): import("lit-html").TemplateResult<1>;
17
22
  }
18
23
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"ds-grid.d.ts","sourceRoot":"","sources":["../../DS1/4-page/ds-grid.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,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,IAAK,SAAQ,UAAU;IAClC,MAAM,CAAC,UAAU;;;;MAEf;IAEF,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM,CAAC,MAAM,0BAsDX;IAEF,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAC;KACjB;CACF"}
1
+ {"version":3,"file":"ds-grid.d.ts","sourceRoot":"","sources":["../../DS1/4-page/ds-grid.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,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,IAAK,SAAQ,UAAU;IAClC,MAAM,CAAC,UAAU;;;;MAEf;IAEF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,cAAc,CAAC,CAAa;IACpC,OAAO,CAAC,aAAa,CAAC,CAAM;IAE5B,MAAM,CAAC,MAAM,0BAsDX;IAEF,iBAAiB;IAgBjB,oBAAoB;IAUpB,OAAO,CAAC,iBAAiB;IAWzB,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAC;KACjB;CACF"}
@@ -1,7 +1,42 @@
1
1
  // ds-grid.ts
2
2
  // Simple grid layout component
3
3
  import { LitElement, html, css } from "lit";
4
+ import { detectMobileDevice } from "../0-face/device";
4
5
  export class Grid extends LitElement {
6
+ connectedCallback() {
7
+ super.connectedCallback();
8
+ this.updateMobileClass();
9
+ // Listen for resize events to update mobile class
10
+ this.resizeObserver = () => {
11
+ if (this.resizeTimeout) {
12
+ clearTimeout(this.resizeTimeout);
13
+ }
14
+ this.resizeTimeout = setTimeout(() => {
15
+ this.updateMobileClass();
16
+ }, 100);
17
+ };
18
+ window.addEventListener("resize", this.resizeObserver);
19
+ }
20
+ disconnectedCallback() {
21
+ super.disconnectedCallback();
22
+ if (this.resizeObserver) {
23
+ window.removeEventListener("resize", this.resizeObserver);
24
+ }
25
+ if (this.resizeTimeout) {
26
+ clearTimeout(this.resizeTimeout);
27
+ }
28
+ }
29
+ updateMobileClass() {
30
+ const isMobile = detectMobileDevice();
31
+ if (isMobile) {
32
+ this.classList.add("mobile");
33
+ this.classList.remove("desktop");
34
+ }
35
+ else {
36
+ this.classList.add("desktop");
37
+ this.classList.remove("mobile");
38
+ }
39
+ }
5
40
  render() {
6
41
  return html ``;
7
42
  }
@@ -15,13 +50,13 @@ Grid.styles = css `
15
50
  margin-left: 0.5px !important;
16
51
  display: grid;
17
52
  width: 1440px;
18
- height: 360px;
53
+ height: 1280px;
19
54
  grid-template-columns: repeat(auto-fill, 19px);
20
55
  grid-template-rows: repeat(auto-fill, 19px);
21
56
  gap: 1px;
22
57
  row-rule: calc(1px * var(--sf)) solid var(--grid-color);
23
58
  column-rule: calc(1px * var(--sf)) solid var(--grid-color);
24
- outline: 1px solid black;
59
+ outline: calc(1px * var(--sf)) solid var(--yellow);
25
60
  position: fixed;
26
61
  top: 0;
27
62
  left: 50%;
@@ -34,7 +69,7 @@ Grid.styles = css `
34
69
  :host(.mobile) {
35
70
  width: calc(100% - calc(1px * var(--sf)));
36
71
  max-width: 100vw;
37
- margin-left: 0 !important;
72
+ margin-left: 0.5px !important;
38
73
  margin-top: 0 !important;
39
74
  box-sizing: border-box;
40
75
  position: fixed;
@@ -13,13 +13,13 @@ export declare class Layout extends LitElement {
13
13
  align: {
14
14
  type: StringConstructor;
15
15
  };
16
- debug: {
16
+ view: {
17
17
  type: BooleanConstructor;
18
18
  };
19
19
  };
20
20
  mode: string;
21
21
  align?: string;
22
- debug?: boolean;
22
+ view?: boolean;
23
23
  static styles: import("lit").CSSResult;
24
24
  render(): import("lit-html").TemplateResult<1>;
25
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ds-layout.d.ts","sourceRoot":"","sources":["../../DS1/4-page/ds-layout.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,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;;;;;;;;;;MAIf;IAEF,IAAI,EAAE,MAAM,CAAe;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,MAAM,CAAC,MAAM,0BAiNX;IAEF,MAAM;CAqEP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,MAAM,CAAC;KACrB;CACF"}
1
+ {"version":3,"file":"ds-layout.d.ts","sourceRoot":"","sources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