ds-one 0.2.0-alpha.1 → 0.2.0-alpha.3
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 +1 -1
- package/DS1/2-core/{article-v1.ts → ds-article.ts} +5 -4
- package/DS1/2-core/{attributes-v1.ts → ds-attributes.ts} +4 -3
- package/DS1/2-core/{cycle-v1.ts → ds-cycle.ts} +11 -10
- package/DS1/2-core/{downloadcv-v1.ts → ds-downloadcv.ts} +9 -8
- package/DS1/2-core/{header-v1.ts → ds-header.ts} +4 -3
- package/DS1/2-core/{home-v1.ts → ds-home.ts} +3 -2
- package/DS1/2-core/{icon-v1.ts → ds-icon.ts} +2 -2
- package/DS1/2-core/{link-v1.ts → ds-link.ts} +5 -5
- package/DS1/2-core/{markdown-v1.ts → ds-markdown.ts} +3 -2
- package/DS1/2-core/{price-v1.ts → ds-price.ts} +4 -3
- package/DS1/2-core/{squarecircle-v1.ts → ds-squarecircle.ts} +4 -3
- package/DS1/2-core/{title-v1.ts → ds-title.ts} +5 -4
- package/DS1/2-core/{tooltip-v1.ts → ds-tooltip.ts} +4 -3
- package/DS1/2-core/{viewtoggle-v1.ts → ds-viewtoggle.ts} +4 -3
- package/DS1/2-core/{year-v1.ts → ds-year.ts} +4 -3
- package/DS1/3-unit/{doublenav-v1.ts → ds-doublenav.ts} +9 -8
- package/DS1/3-unit/{list-v1.ts → ds-list.ts} +3 -2
- package/DS1/3-unit/{panel-v1.ts → ds-panel.ts} +3 -2
- package/DS1/3-unit/{row-v1.ts → ds-row.ts} +3 -2
- package/DS1/3-unit/{singlenav-v1.ts → ds-singlenav.ts} +5 -4
- package/DS1/index.ts +20 -20
- package/DS1/utils/cdn-loader.ts +20 -44
- package/README.md +4 -4
- package/dist/2-core/ds-article.d.ts +129 -0
- package/dist/2-core/ds-article.d.ts.map +1 -0
- package/dist/2-core/ds-article.js +361 -0
- package/dist/2-core/ds-attributes.d.ts +47 -0
- package/dist/2-core/ds-attributes.d.ts.map +1 -0
- package/dist/2-core/ds-attributes.js +128 -0
- package/dist/2-core/ds-cycle.d.ts +66 -0
- package/dist/2-core/ds-cycle.d.ts.map +1 -0
- package/dist/2-core/ds-cycle.js +586 -0
- package/dist/2-core/ds-downloadcv.d.ts +58 -0
- package/dist/2-core/ds-downloadcv.d.ts.map +1 -0
- package/dist/2-core/ds-downloadcv.js +119 -0
- package/dist/2-core/ds-header.d.ts +28 -0
- package/dist/2-core/ds-header.d.ts.map +1 -0
- package/dist/2-core/ds-header.js +66 -0
- package/dist/2-core/ds-home.d.ts +26 -0
- package/dist/2-core/ds-home.d.ts.map +1 -0
- package/dist/2-core/ds-home.js +148 -0
- package/dist/2-core/ds-icon.d.ts +28 -0
- package/dist/2-core/ds-icon.d.ts.map +1 -0
- package/dist/2-core/ds-icon.js +297 -0
- package/dist/2-core/ds-link.d.ts +35 -0
- package/dist/2-core/ds-link.d.ts.map +1 -0
- package/dist/2-core/ds-link.js +85 -0
- package/dist/2-core/ds-markdown.d.ts +7 -0
- package/dist/2-core/ds-markdown.d.ts.map +1 -0
- package/dist/2-core/ds-markdown.js +240 -0
- package/dist/2-core/ds-price.d.ts +46 -0
- package/dist/2-core/ds-price.d.ts.map +1 -0
- package/dist/2-core/ds-price.js +72 -0
- package/dist/2-core/ds-squarecircle.d.ts +50 -0
- package/dist/2-core/ds-squarecircle.d.ts.map +1 -0
- package/dist/2-core/ds-squarecircle.js +133 -0
- package/dist/2-core/ds-title.d.ts +50 -0
- package/dist/2-core/ds-title.d.ts.map +1 -0
- package/dist/2-core/ds-title.js +103 -0
- package/dist/2-core/ds-tooltip.d.ts +39 -0
- package/dist/2-core/ds-tooltip.d.ts.map +1 -0
- package/dist/2-core/ds-tooltip.js +145 -0
- package/dist/2-core/ds-viewtoggle.d.ts +27 -0
- package/dist/2-core/ds-viewtoggle.d.ts.map +1 -0
- package/dist/2-core/ds-viewtoggle.js +49 -0
- package/dist/2-core/ds-year.d.ts +16 -0
- package/dist/2-core/ds-year.d.ts.map +1 -0
- package/dist/2-core/ds-year.js +21 -0
- package/dist/3-unit/ds-doublenav.d.ts +51 -0
- package/dist/3-unit/ds-doublenav.d.ts.map +1 -0
- package/dist/3-unit/ds-doublenav.js +88 -0
- package/dist/3-unit/ds-list.d.ts +11 -0
- package/dist/3-unit/ds-list.d.ts.map +1 -0
- package/dist/3-unit/ds-list.js +15 -0
- package/dist/3-unit/ds-panel.d.ts +11 -0
- package/dist/3-unit/ds-panel.d.ts.map +1 -0
- package/dist/3-unit/ds-panel.js +16 -0
- package/dist/3-unit/ds-row.d.ts +25 -0
- package/dist/3-unit/ds-row.d.ts.map +1 -0
- package/dist/3-unit/ds-row.js +32 -0
- package/dist/3-unit/ds-singlenav.d.ts +32 -0
- package/dist/3-unit/ds-singlenav.d.ts.map +1 -0
- package/dist/3-unit/ds-singlenav.js +62 -0
- package/dist/ds-one.bundle.js +79 -99
- package/dist/ds-one.bundle.js.map +3 -3
- package/dist/ds-one.bundle.min.js +47 -47
- package/dist/ds-one.bundle.min.js.map +4 -4
- package/dist/index.d.ts +20 -20
- package/dist/index.js +20 -20
- package/dist/utils/cdn-loader.d.ts.map +1 -1
- package/dist/utils/cdn-loader.js +20 -38
- package/package.json +2 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A component for displaying the monthly price label based on language/region
|
|
4
|
+
*
|
|
5
|
+
* @element ds-price
|
|
6
|
+
* @prop {string} country - Preferred country (overrides language mapping)
|
|
7
|
+
* @prop {string} region - Alias for country; if provided, takes precedence over country
|
|
8
|
+
*/
|
|
9
|
+
export declare class Price extends LitElement {
|
|
10
|
+
static get properties(): {
|
|
11
|
+
country: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
reflect: boolean;
|
|
14
|
+
};
|
|
15
|
+
region: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
reflect: boolean;
|
|
18
|
+
};
|
|
19
|
+
_label: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
state: boolean;
|
|
22
|
+
};
|
|
23
|
+
_loading: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
state: boolean;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
country: string;
|
|
29
|
+
region: string;
|
|
30
|
+
_label: string;
|
|
31
|
+
_loading: boolean;
|
|
32
|
+
private boundHandlers;
|
|
33
|
+
constructor();
|
|
34
|
+
static styles: import("lit").CSSResult;
|
|
35
|
+
connectedCallback(): void;
|
|
36
|
+
disconnectedCallback(): void;
|
|
37
|
+
updated(changed: Map<string, unknown>): void;
|
|
38
|
+
private _loadPrice;
|
|
39
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
40
|
+
}
|
|
41
|
+
declare global {
|
|
42
|
+
interface HTMLElementTagNameMap {
|
|
43
|
+
"ds-price": Price;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=ds-price.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-price.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-price.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C;;;;;;GAMG;AACH,qBAAa,KAAM,SAAQ,UAAU;IACnC,MAAM,KAAK,UAAU;;;;;;;;;;;;;;;;;MAOpB;IAEO,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,aAAa,CAAqC;;IAgB1D,MAAM,CAAC,MAAM,0BAOX;IAEF,iBAAiB;IAajB,oBAAoB;IAYpB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAOrC,OAAO,CAAC,UAAU;IAUlB,MAAM;CAKP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,KAAK,CAAC;KACnB;CACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { currentLanguage } from "../utils/language";
|
|
3
|
+
import { getPriceLabel } from "../utils/pricing";
|
|
4
|
+
/**
|
|
5
|
+
* A component for displaying the monthly price label based on language/region
|
|
6
|
+
*
|
|
7
|
+
* @element ds-price
|
|
8
|
+
* @prop {string} country - Preferred country (overrides language mapping)
|
|
9
|
+
* @prop {string} region - Alias for country; if provided, takes precedence over country
|
|
10
|
+
*/
|
|
11
|
+
export class Price extends LitElement {
|
|
12
|
+
static get properties() {
|
|
13
|
+
return {
|
|
14
|
+
country: { type: String, reflect: true },
|
|
15
|
+
region: { type: String, reflect: true },
|
|
16
|
+
_label: { type: String, state: true },
|
|
17
|
+
_loading: { type: Boolean, state: true },
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.country = "";
|
|
23
|
+
this.region = "";
|
|
24
|
+
this._label = "";
|
|
25
|
+
this._loading = true;
|
|
26
|
+
this.boundHandlers = {
|
|
27
|
+
languageChanged: (() => {
|
|
28
|
+
this._loadPrice();
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback();
|
|
34
|
+
this._loadPrice();
|
|
35
|
+
window.addEventListener("language-changed", this.boundHandlers.languageChanged);
|
|
36
|
+
window.addEventListener("translations-loaded", this.boundHandlers.languageChanged);
|
|
37
|
+
}
|
|
38
|
+
disconnectedCallback() {
|
|
39
|
+
super.disconnectedCallback();
|
|
40
|
+
window.removeEventListener("language-changed", this.boundHandlers.languageChanged);
|
|
41
|
+
window.removeEventListener("translations-loaded", this.boundHandlers.languageChanged);
|
|
42
|
+
}
|
|
43
|
+
updated(changed) {
|
|
44
|
+
super.updated(changed);
|
|
45
|
+
if (changed.has("country") || changed.has("region")) {
|
|
46
|
+
this._loadPrice();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
_loadPrice() {
|
|
50
|
+
this._loading = true;
|
|
51
|
+
const lang = currentLanguage.value;
|
|
52
|
+
const preferredCountry = this.region || this.country;
|
|
53
|
+
const label = getPriceLabel({ language: lang, country: preferredCountry });
|
|
54
|
+
this._label = label;
|
|
55
|
+
this._loading = false;
|
|
56
|
+
this.requestUpdate();
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
return html `<span class="${this._loading ? "loading" : ""}"
|
|
60
|
+
>${this._label}</span
|
|
61
|
+
>`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
Price.styles = css `
|
|
65
|
+
:host {
|
|
66
|
+
display: inline;
|
|
67
|
+
}
|
|
68
|
+
.loading {
|
|
69
|
+
opacity: 0.6;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
customElements.define("ds-price", Price);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A component for theme toggle or project links (square or circle shape)
|
|
4
|
+
*
|
|
5
|
+
* @element ds-squarecircle
|
|
6
|
+
* @prop {string} type - "theme-toggle" or "link"
|
|
7
|
+
* @prop {string} shape - "square" or "circle"
|
|
8
|
+
* @prop {string} href - URL for link type
|
|
9
|
+
* @prop {string} project - Project name for color theming
|
|
10
|
+
* @prop {boolean} loading - Loading state with pulse animation
|
|
11
|
+
*/
|
|
12
|
+
export declare class SquareCircle extends LitElement {
|
|
13
|
+
static get properties(): {
|
|
14
|
+
type: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
reflect: boolean;
|
|
17
|
+
};
|
|
18
|
+
shape: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
reflect: boolean;
|
|
21
|
+
};
|
|
22
|
+
href: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
};
|
|
25
|
+
project: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
reflect: boolean;
|
|
28
|
+
};
|
|
29
|
+
loading: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
reflect: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
type: "theme-toggle" | "link";
|
|
35
|
+
shape: "square" | "circle";
|
|
36
|
+
href: string;
|
|
37
|
+
project: string;
|
|
38
|
+
loading: boolean;
|
|
39
|
+
constructor();
|
|
40
|
+
static styles: import("lit").CSSResult;
|
|
41
|
+
private _handleClick;
|
|
42
|
+
connectedCallback(): void;
|
|
43
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
44
|
+
}
|
|
45
|
+
declare global {
|
|
46
|
+
interface HTMLElementTagNameMap {
|
|
47
|
+
"ds-squarecircle": SquareCircle;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=ds-squarecircle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-squarecircle.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-squarecircle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C;;;;;;;;;GASG;AACH,qBAAa,YAAa,SAAQ,UAAU;IAC1C,MAAM,KAAK,UAAU;;;;;;;;;;;;;;;;;;;;MAQpB;IAEO,IAAI,EAAE,cAAc,GAAG,MAAM,CAAC;IAC9B,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;;IAWzB,MAAM,CAAC,MAAM,0BAgEX;IAEF,OAAO,CAAC,YAAY;IAQpB,iBAAiB;IAOjB,MAAM;CAyBP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,YAAY,CAAC;KACjC;CACF"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { setTheme, currentTheme } from "../utils/theme";
|
|
3
|
+
/**
|
|
4
|
+
* A component for theme toggle or project links (square or circle shape)
|
|
5
|
+
*
|
|
6
|
+
* @element ds-squarecircle
|
|
7
|
+
* @prop {string} type - "theme-toggle" or "link"
|
|
8
|
+
* @prop {string} shape - "square" or "circle"
|
|
9
|
+
* @prop {string} href - URL for link type
|
|
10
|
+
* @prop {string} project - Project name for color theming
|
|
11
|
+
* @prop {boolean} loading - Loading state with pulse animation
|
|
12
|
+
*/
|
|
13
|
+
export class SquareCircle extends LitElement {
|
|
14
|
+
static get properties() {
|
|
15
|
+
return {
|
|
16
|
+
type: { type: String, reflect: true },
|
|
17
|
+
shape: { type: String, reflect: true },
|
|
18
|
+
href: { type: String },
|
|
19
|
+
project: { type: String, reflect: true },
|
|
20
|
+
loading: { type: Boolean, reflect: true },
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.type = "theme-toggle";
|
|
26
|
+
this.shape = "circle";
|
|
27
|
+
this.href = "";
|
|
28
|
+
this.project = "";
|
|
29
|
+
this.loading = false;
|
|
30
|
+
}
|
|
31
|
+
_handleClick(e) {
|
|
32
|
+
if (this.type === "theme-toggle") {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
const newTheme = currentTheme.get() === "light" ? "dark" : "light";
|
|
35
|
+
setTheme(newTheme);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
connectedCallback() {
|
|
39
|
+
super.connectedCallback();
|
|
40
|
+
this.addEventListener("click", (e) => {
|
|
41
|
+
this._handleClick(e);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
const content = html `<div
|
|
46
|
+
class="container"
|
|
47
|
+
@click="${(e) => {
|
|
48
|
+
this._handleClick(e);
|
|
49
|
+
}}"
|
|
50
|
+
></div>`;
|
|
51
|
+
if (this.type === "link" && this.href) {
|
|
52
|
+
return html `
|
|
53
|
+
<a href="${this.href}" @click="${this._handleClick}">${content}</a>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
return html `
|
|
57
|
+
<div
|
|
58
|
+
class="wrapper"
|
|
59
|
+
@click="${(e) => {
|
|
60
|
+
this._handleClick(e);
|
|
61
|
+
}}"
|
|
62
|
+
>
|
|
63
|
+
${content}
|
|
64
|
+
</div>
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
SquareCircle.styles = css `
|
|
69
|
+
:host {
|
|
70
|
+
background-color: light-dark(var(--black), var(--white));
|
|
71
|
+
display: block;
|
|
72
|
+
width: calc(120px * var(--scaling-factor));
|
|
73
|
+
height: calc(120px * var(--scaling-factor));
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
pointer-events: auto;
|
|
76
|
+
position: relative;
|
|
77
|
+
z-index: 1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:host([shape="circle"]) {
|
|
81
|
+
border-radius: 9999px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:host([shape="circle"]) .wrapper,
|
|
85
|
+
:host([shape="circle"]) .container {
|
|
86
|
+
border-radius: 9999px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.wrapper {
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100%;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
pointer-events: auto;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.container {
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: 100%;
|
|
99
|
+
background-color: inherit;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
pointer-events: auto;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.container:hover {
|
|
105
|
+
opacity: 0.8;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
a {
|
|
109
|
+
display: block;
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 100%;
|
|
112
|
+
text-decoration: none;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
pointer-events: auto;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:host([loading]) {
|
|
118
|
+
animation: gentle-pulse 2s ease-in-out infinite;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@keyframes gentle-pulse {
|
|
122
|
+
0% {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
}
|
|
125
|
+
50% {
|
|
126
|
+
opacity: 0.7;
|
|
127
|
+
}
|
|
128
|
+
100% {
|
|
129
|
+
opacity: 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
customElements.define("ds-squarecircle", SquareCircle);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A component for displaying page titles with localization support
|
|
4
|
+
*
|
|
5
|
+
* @element ds-title
|
|
6
|
+
* @prop {string} key - The translation key to use
|
|
7
|
+
* @prop {string} defaultValue - Default value if translation is not found
|
|
8
|
+
*/
|
|
9
|
+
export declare class Title extends LitElement {
|
|
10
|
+
private _gridArea;
|
|
11
|
+
static get properties(): {
|
|
12
|
+
gridarea: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
reflect: boolean;
|
|
15
|
+
};
|
|
16
|
+
key: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
reflect: boolean;
|
|
19
|
+
};
|
|
20
|
+
defaultValue: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
reflect: boolean;
|
|
23
|
+
attribute: string;
|
|
24
|
+
};
|
|
25
|
+
_text: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
state: boolean;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
key: string;
|
|
31
|
+
defaultValue: string;
|
|
32
|
+
_text: string;
|
|
33
|
+
private boundHandlers;
|
|
34
|
+
set gridarea(value: string);
|
|
35
|
+
get gridarea(): string;
|
|
36
|
+
static styles: import("lit").CSSResult;
|
|
37
|
+
constructor();
|
|
38
|
+
connectedCallback(): void;
|
|
39
|
+
disconnectedCallback(): void;
|
|
40
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
41
|
+
_loadText(): void;
|
|
42
|
+
firstUpdated(): void;
|
|
43
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
44
|
+
}
|
|
45
|
+
declare global {
|
|
46
|
+
interface HTMLElementTagNameMap {
|
|
47
|
+
"ds-title": Title;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=ds-title.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-title.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-title.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C;;;;;;GAMG;AACH,qBAAa,KAAM,SAAQ,UAAU;IACnC,OAAO,CAAC,SAAS,CAAM;IAEvB,MAAM,KAAK,UAAU;;;;;;;;;;;;;;;;;;MAOpB;IAEO,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,aAAa,CAAqC;IAE1D,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAKzB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,MAAM,CAAC,MAAM,0BAwBX;;IAeF,iBAAiB;IASjB,oBAAoB;IAQpB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAM/C,SAAS;IAkBT,YAAY;IAMZ,MAAM;CAKP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,KAAK,CAAC;KACnB;CACF"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { getText } from "../utils/language";
|
|
3
|
+
/**
|
|
4
|
+
* A component for displaying page titles with localization support
|
|
5
|
+
*
|
|
6
|
+
* @element ds-title
|
|
7
|
+
* @prop {string} key - The translation key to use
|
|
8
|
+
* @prop {string} defaultValue - Default value if translation is not found
|
|
9
|
+
*/
|
|
10
|
+
export class Title extends LitElement {
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
gridarea: { type: String, reflect: true },
|
|
14
|
+
key: { type: String, reflect: true },
|
|
15
|
+
defaultValue: { type: String, reflect: true, attribute: "default-value" },
|
|
16
|
+
_text: { type: String, state: true },
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
set gridarea(value) {
|
|
20
|
+
const oldValue = this._gridArea;
|
|
21
|
+
this._gridArea = value;
|
|
22
|
+
this.style.gridArea = value;
|
|
23
|
+
this.requestUpdate("gridarea", oldValue);
|
|
24
|
+
}
|
|
25
|
+
get gridarea() {
|
|
26
|
+
return this._gridArea;
|
|
27
|
+
}
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
this._gridArea = "";
|
|
31
|
+
this.key = "";
|
|
32
|
+
this.defaultValue = "";
|
|
33
|
+
this._text = "";
|
|
34
|
+
this.boundHandlers = {
|
|
35
|
+
languageChanged: (() => {
|
|
36
|
+
this._loadText();
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
super.connectedCallback();
|
|
42
|
+
this._loadText();
|
|
43
|
+
window.addEventListener("language-changed", this.boundHandlers.languageChanged);
|
|
44
|
+
}
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
super.disconnectedCallback();
|
|
47
|
+
window.removeEventListener("language-changed", this.boundHandlers.languageChanged);
|
|
48
|
+
}
|
|
49
|
+
updated(changedProperties) {
|
|
50
|
+
if (changedProperties.has("key") || changedProperties.has("defaultValue")) {
|
|
51
|
+
this._loadText();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_loadText() {
|
|
55
|
+
if (!this.key) {
|
|
56
|
+
this._text = this.defaultValue || "";
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const text = getText(this.key);
|
|
61
|
+
this._text = text || this.defaultValue || this.key;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.error(`[ds-title] Error loading text for key "${this.key}":`, error);
|
|
65
|
+
this._text = this.defaultValue || this.key;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
firstUpdated() {
|
|
69
|
+
if (this.hasAttribute("gridarea")) {
|
|
70
|
+
this.style.gridArea = this.getAttribute("gridarea") || "";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
const hasKey = this.key && this._text;
|
|
75
|
+
return html ` <h1>${hasKey ? this._text : html `<slot></slot>`}</h1> `;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
Title.styles = css `
|
|
79
|
+
:host {
|
|
80
|
+
display: flex;
|
|
81
|
+
padding: calc(2px * var(--scaling-factor));
|
|
82
|
+
align-items: flex-start;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
h1 {
|
|
86
|
+
display: block;
|
|
87
|
+
place-content: center;
|
|
88
|
+
font-family: var(--typeface);
|
|
89
|
+
color: light-dark(var(--black), var(--white));
|
|
90
|
+
font-size: calc(36px * var(--scaling-factor));
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
align-items: center;
|
|
93
|
+
letter-spacing: -0.72px;
|
|
94
|
+
margin: 0;
|
|
95
|
+
height: 45px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
::slotted(*) {
|
|
99
|
+
margin: 0;
|
|
100
|
+
width: 100%;
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
customElements.define("ds-title", Title);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare class Tooltip extends LitElement {
|
|
3
|
+
static properties: {
|
|
4
|
+
key: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
reflect: boolean;
|
|
7
|
+
};
|
|
8
|
+
defaultValue: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
reflect: boolean;
|
|
11
|
+
attribute: string;
|
|
12
|
+
};
|
|
13
|
+
_text: {
|
|
14
|
+
state: boolean;
|
|
15
|
+
};
|
|
16
|
+
_visible: {
|
|
17
|
+
state: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
key: string;
|
|
21
|
+
defaultValue: string;
|
|
22
|
+
private _text;
|
|
23
|
+
private _visible;
|
|
24
|
+
private boundWindowHandlers;
|
|
25
|
+
private boundHostHandlers;
|
|
26
|
+
constructor();
|
|
27
|
+
static styles: import("lit").CSSResult;
|
|
28
|
+
connectedCallback(): void;
|
|
29
|
+
disconnectedCallback(): void;
|
|
30
|
+
updated(changed: Map<string, unknown>): void;
|
|
31
|
+
_loadText(): Promise<void>;
|
|
32
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
interface HTMLElementTagNameMap {
|
|
36
|
+
"ds-tooltip": Tooltip;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ds-tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-tooltip.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,qBAAa,OAAQ,SAAQ,UAAU;IACrC,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;MAKf;IAEM,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,mBAAmB,CAGzB;IACF,OAAO,CAAC,iBAAiB,CAKvB;;IAsCF,MAAM,CAAC,MAAM,0BA6CX;IAEF,iBAAiB,IAAI,IAAI;IAmBzB,oBAAoB,IAAI,IAAI;IAiB5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMtC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBhC,MAAM;CAUP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,OAAO,CAAC;KACvB;CACF"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { translate, getNotionText } from "../utils/language";
|
|
3
|
+
export class Tooltip extends LitElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.key = "";
|
|
7
|
+
this.defaultValue = "";
|
|
8
|
+
this._text = "";
|
|
9
|
+
this._visible = false;
|
|
10
|
+
this.boundWindowHandlers = {
|
|
11
|
+
languageChanged: (() => {
|
|
12
|
+
this._loadText();
|
|
13
|
+
}),
|
|
14
|
+
translationsLoaded: (() => {
|
|
15
|
+
this._loadText();
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
this.boundHostHandlers = {
|
|
19
|
+
mouseenter: (() => {
|
|
20
|
+
this._visible = true;
|
|
21
|
+
this.requestUpdate();
|
|
22
|
+
}),
|
|
23
|
+
mouseleave: (() => {
|
|
24
|
+
this._visible = false;
|
|
25
|
+
this.requestUpdate();
|
|
26
|
+
}),
|
|
27
|
+
focusin: (() => {
|
|
28
|
+
this._visible = true;
|
|
29
|
+
this.requestUpdate();
|
|
30
|
+
}),
|
|
31
|
+
focusout: (() => {
|
|
32
|
+
this._visible = false;
|
|
33
|
+
this.requestUpdate();
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
super.connectedCallback();
|
|
39
|
+
this._loadText();
|
|
40
|
+
window.addEventListener("language-changed", this.boundWindowHandlers.languageChanged);
|
|
41
|
+
window.addEventListener("translations-loaded", this.boundWindowHandlers.translationsLoaded);
|
|
42
|
+
this.addEventListener("mouseenter", this.boundHostHandlers.mouseenter);
|
|
43
|
+
this.addEventListener("mouseleave", this.boundHostHandlers.mouseleave);
|
|
44
|
+
this.addEventListener("focusin", this.boundHostHandlers.focusin);
|
|
45
|
+
this.addEventListener("focusout", this.boundHostHandlers.focusout);
|
|
46
|
+
}
|
|
47
|
+
disconnectedCallback() {
|
|
48
|
+
super.disconnectedCallback();
|
|
49
|
+
window.removeEventListener("language-changed", this.boundWindowHandlers.languageChanged);
|
|
50
|
+
window.removeEventListener("translations-loaded", this.boundWindowHandlers.translationsLoaded);
|
|
51
|
+
this.removeEventListener("mouseenter", this.boundHostHandlers.mouseenter);
|
|
52
|
+
this.removeEventListener("mouseleave", this.boundHostHandlers.mouseleave);
|
|
53
|
+
this.removeEventListener("focusin", this.boundHostHandlers.focusin);
|
|
54
|
+
this.removeEventListener("focusout", this.boundHostHandlers.focusout);
|
|
55
|
+
}
|
|
56
|
+
updated(changed) {
|
|
57
|
+
if (changed.has("key") || changed.has("defaultValue")) {
|
|
58
|
+
this._loadText();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async _loadText() {
|
|
62
|
+
if (!this.key) {
|
|
63
|
+
this._text = this.defaultValue || "";
|
|
64
|
+
this.requestUpdate();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const notionText = await getNotionText(this.key);
|
|
69
|
+
if (notionText) {
|
|
70
|
+
this._text = notionText;
|
|
71
|
+
this.requestUpdate();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const t = translate(this.key);
|
|
75
|
+
this._text = t && t !== this.key ? t : this.defaultValue || this.key;
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
console.error("ds-tooltip: error loading text for key", this.key, err);
|
|
79
|
+
this._text = this.defaultValue || this.key;
|
|
80
|
+
}
|
|
81
|
+
this.requestUpdate();
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
const bubbleClasses = ["bubble", this._visible ? "visible" : ""].join(" ");
|
|
85
|
+
return html `
|
|
86
|
+
<span class="slot-wrapper"><slot></slot></span>
|
|
87
|
+
${this._text
|
|
88
|
+
? html `<div class="${bubbleClasses}">${this._text}</div>`
|
|
89
|
+
: null}
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
Tooltip.properties = {
|
|
94
|
+
key: { type: String, reflect: true },
|
|
95
|
+
defaultValue: { type: String, reflect: true, attribute: "default-value" },
|
|
96
|
+
_text: { state: true },
|
|
97
|
+
_visible: { state: true },
|
|
98
|
+
};
|
|
99
|
+
Tooltip.styles = css `
|
|
100
|
+
:host {
|
|
101
|
+
position: relative;
|
|
102
|
+
display: inline-block;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.slot-wrapper {
|
|
106
|
+
display: inline-flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.bubble {
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
position: absolute;
|
|
115
|
+
left: 50%;
|
|
116
|
+
bottom: 100%;
|
|
117
|
+
transform: translate(-50%, calc(-2px * var(--scaling-factor)));
|
|
118
|
+
z-index: 1000;
|
|
119
|
+
pointer-events: none;
|
|
120
|
+
height: calc(var(--08) * var(--scaling-factor));
|
|
121
|
+
opacity: 0;
|
|
122
|
+
transition: opacity 120ms ease, transform 120ms ease;
|
|
123
|
+
background-color: light-dark(var(--black), var(--white));
|
|
124
|
+
color: light-dark(var(--white), var(--black));
|
|
125
|
+
border-radius: 0;
|
|
126
|
+
font-size: var(--type-size-default);
|
|
127
|
+
padding: 0px calc(1px * var(--scaling-factor));
|
|
128
|
+
font-family: var(
|
|
129
|
+
--typeface,
|
|
130
|
+
-apple-system,
|
|
131
|
+
BlinkMacSystemFont,
|
|
132
|
+
"Segoe UI",
|
|
133
|
+
Roboto,
|
|
134
|
+
sans-serif
|
|
135
|
+
);
|
|
136
|
+
font-weight: 500;
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
min-width: max-content;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.bubble.visible {
|
|
142
|
+
opacity: 1;
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
customElements.define("ds-tooltip", Tooltip);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A component for toggling between text and image view modes
|
|
4
|
+
*
|
|
5
|
+
* @element ds-viewtoggle
|
|
6
|
+
*/
|
|
7
|
+
export declare class ViewToggle extends LitElement {
|
|
8
|
+
static properties: {
|
|
9
|
+
_mode: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
state: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
_mode: "text" | "image";
|
|
15
|
+
private boundHandlers;
|
|
16
|
+
constructor();
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
private _toggle;
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
}
|
|
22
|
+
declare global {
|
|
23
|
+
interface HTMLElementTagNameMap {
|
|
24
|
+
"ds-viewtoggle": ViewToggle;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ds-viewtoggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-viewtoggle.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-viewtoggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAIvC;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,MAAM,CAAC,UAAU;;;;;MAEf;IAEM,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAEhC,OAAO,CAAC,aAAa,CAGnB;;IAkBF,iBAAiB;IAYjB,oBAAoB;IAYpB,OAAO,CAAC,OAAO,CAGb;IAEF,MAAM;CAOP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,UAAU,CAAC;KAC7B;CACF"}
|