so-web-components 0.1.8 → 0.1.10

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/README.md CHANGED
@@ -11,10 +11,12 @@ abgeleitet aus dem Layout-Prinzip von so.ch.
11
11
  - Schrift: `Frutiger, sans-serif`
12
12
  - `src/components/so-header.ts` – `<so-header>` Web Component (Shadow DOM)
13
13
  - `src/components/so-breadcrumb.ts` – `<so-breadcrumb>` Web Component (Shadow DOM)
14
+ - `src/components/so-lead-text.ts` – `<so-lead-text>` Web Component für Intro-/Lead-Absätze
14
15
  - `src/demo/index.html` – Demo-Seite
15
16
  - `src/demo/cdn-demo.html` – einfache CDN-Demo-Seite
16
17
  - `tests/so-header.test.ts` – Tests (Jest + JSDOM)
17
18
  - `tests/so-breadcrumb.test.ts` – Tests (Jest + JSDOM)
19
+ - `tests/so-lead-text.test.ts` – Tests (Jest + JSDOM)
18
20
 
19
21
  ## Voraussetzungen
20
22
 
@@ -41,6 +43,8 @@ Outputs:
41
43
  - `dist/styles/tokens.css`
42
44
  - `dist/styles/reset.css`
43
45
  - `dist/styles/fonts.css`
46
+ - `dist/styles/FrutigerLTW05-55Roman.woff2`
47
+ - `dist/styles/FrutigerLTW05-75Black.woff2`
44
48
  - `dist/demo/index.html`
45
49
  - `dist/demo/cdn-demo.html`
46
50
 
@@ -75,11 +79,11 @@ git push origin v0.1.1
75
79
  Nach dem Publish sind die Web Components z.B. über **unpkg** oder **jsDelivr** verfügbar:
76
80
 
77
81
  ```html
78
- <script type="module" src="https://unpkg.com/so-web-components@0.1.1/dist/index.js"></script>
82
+ <script type="module" src="https://unpkg.com/so-web-components@latest/dist/index.js"></script>
79
83
  ```
80
84
 
81
85
  ```html
82
- <script type="module" src="https://cdn.jsdelivr.net/npm/so-web-components@0.1.1/dist/index.js"></script>
86
+ <script type="module" src="https://cdn.jsdelivr.net/npm/so-web-components@latest/dist/index.js"></script>
83
87
  ```
84
88
 
85
89
  Optional ohne Versions-Pin:
@@ -92,7 +96,11 @@ Optional ohne Versions-Pin:
92
96
  <script type="module" src="https://cdn.jsdelivr.net/npm/so-web-components/dist/index.js"></script>
93
97
  ```
94
98
 
95
- ### Einfache Test-Webseite via CDN (Version `0.1.1`)
99
+ Hinweis:
100
+ - `@latest` ist möglich und lädt die aktuellste veröffentlichte Version.
101
+ - Für stabile Produktion empfiehlt sich trotzdem ein expliziter Versions-Pin (z.B. `@0.1.10`).
102
+
103
+ ### Einfache Test-Webseite via CDN (Version `latest`)
96
104
 
97
105
  Eine fertige Beispielseite liegt unter `src/demo/cdn-demo.html` (wird nach `dist/demo/cdn-demo.html` kopiert):
98
106
 
@@ -104,10 +112,10 @@ Eine fertige Beispielseite liegt unter `src/demo/cdn-demo.html` (wird nach `dist
104
112
  <meta name="viewport" content="width=device-width,initial-scale=1" />
105
113
  <title>so-web-components CDN Demo</title>
106
114
 
107
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@0.1.1/dist/styles/reset.css" />
108
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@0.1.1/dist/styles/fonts.css" />
109
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@0.1.1/dist/styles/tokens.css" />
110
- <script type="module" src="https://cdn.jsdelivr.net/npm/so-web-components@0.1.1/dist/index.js"></script>
115
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@latest/dist/styles/reset.css" />
116
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@latest/dist/styles/fonts.css" />
117
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@latest/dist/styles/tokens.css" />
118
+ <script type="module" src="https://cdn.jsdelivr.net/npm/so-web-components@latest/dist/index.js"></script>
111
119
  </head>
112
120
  <body>
113
121
  <so-header
@@ -127,7 +135,7 @@ Hinweis zu Fonts:
127
135
 
128
136
  - Die Schrift wird **nicht** automatisch durch `index.js` nachgeladen.
129
137
  - `dist/styles/fonts.css` muss explizit eingebunden werden (lokal oder via CDN).
130
- - In `fonts.css` ist die Frutiger-Webfont als `@font-face` enthalten.
138
+ - `fonts.css` referenziert die mitgelieferten `woff2`-Dateien aus `dist/styles/`.
131
139
 
132
140
  ## Dev / Demo starten
133
141
 
@@ -177,6 +185,9 @@ Dann im Browser öffnen:
177
185
 
178
186
  <so-header></so-header>
179
187
  <so-breadcrumb></so-breadcrumb>
188
+ <so-lead-text>
189
+ <p>Ein kurzer Leadtext mit <a href="#">Link</a>.</p>
190
+ </so-lead-text>
180
191
  ```
181
192
 
182
193
  ### 3) Navigation konfigurieren (optional)
@@ -250,8 +261,37 @@ Einfach per CSS Custom Properties:
250
261
  }
251
262
  ```
252
263
 
253
- > Hinweis: Wenn du `styles/fonts.css` einbindest, wird Frutiger als Webfont geladen.
264
+ > Hinweis: Wenn du `styles/fonts.css` einbindest, wird Frutiger über die mitgelieferten `woff2`-Dateien aus `styles/` geladen.
254
265
 
255
266
  ## Lizenz
256
267
 
257
268
  MIT (für dieses Beispielprojekt).
269
+
270
+
271
+ ### `<so-lead-text>`
272
+
273
+ Für grössere Intro-Absätze unter einer Seitentitel-Zeile.
274
+
275
+ **Beispiel**
276
+
277
+ ```html
278
+ <h1 class="so-page-title">Kartenkatalog</h1>
279
+ <so-lead-text>
280
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
281
+ <p>Mit <a href="https://www.cogeo.org/">einem Link</a> im Text.</p>
282
+ </so-lead-text>
283
+ ```
284
+
285
+ **Custom Properties**
286
+
287
+ - `--so-lead-text-margin-top` (Default `24px`)
288
+ - `--so-lead-text-font-size` (Default `1.125rem`)
289
+ - `--so-lead-text-line-height` (Default `1.55`)
290
+
291
+ ### Standard-Linkstyling in `tokens.css`
292
+
293
+ Ja, das passt gut in `tokens.css` für den globalen Fallback ausserhalb von Shadow-DOM-Komponenten.
294
+
295
+ - Links sind standardmässig unterstrichen.
296
+ - Hover/Focus rendert rot (`#e01f26`).
297
+ - Übersteuerbar via CSS-Variablen `--so-link-color` und `--so-link-hover-color`.
@@ -145,8 +145,8 @@ export class SoBreadcrumb extends HTMLElement {
145
145
  }
146
146
 
147
147
  .chevron{
148
- width: 21px;
149
- height: 21px;
148
+ width: 16px;
149
+ height: 16px;
150
150
  fill: #e01f26;
151
151
  flex: 0 0 auto;
152
152
  display: block;
@@ -0,0 +1,5 @@
1
+ export declare class SoLeadText extends HTMLElement {
2
+ constructor();
3
+ connectedCallback(): void;
4
+ private render;
5
+ }
@@ -0,0 +1,34 @@
1
+ export class SoLeadText extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ this.attachShadow({ mode: "open" });
5
+ }
6
+ connectedCallback() {
7
+ this.render();
8
+ }
9
+ render() {
10
+ if (!this.shadowRoot)
11
+ return;
12
+ this.shadowRoot.innerHTML = `
13
+ <style>
14
+ :host {
15
+ display: block;
16
+ margin-top: var(--so-lead-text-margin-top, 24px);
17
+ color: inherit;
18
+ }
19
+
20
+ ::slotted(p) {
21
+ margin: 0 0 18px;
22
+ font-size: var(--so-lead-text-font-size, 1.125rem);
23
+ line-height: var(--so-lead-text-line-height, 1.55);
24
+ }
25
+
26
+ ::slotted(p:last-child) {
27
+ margin-bottom: 0;
28
+ }
29
+ </style>
30
+
31
+ <slot></slot>
32
+ `;
33
+ }
34
+ }
@@ -6,12 +6,12 @@
6
6
  <title>so-web-components CDN Demo</title>
7
7
 
8
8
  <!-- Basis-Styles und Fonts von CDN -->
9
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@0.1.1/dist/styles/reset.css" />
10
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@0.1.1/dist/styles/fonts.css" />
11
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@0.1.1/dist/styles/tokens.css" />
9
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@latest/dist/styles/reset.css" />
10
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@latest/dist/styles/fonts.css" />
11
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/so-web-components@latest/dist/styles/tokens.css" />
12
12
 
13
13
  <!-- Web Components von CDN -->
14
- <script type="module" src="https://cdn.jsdelivr.net/npm/so-web-components@0.1.1/dist/index.js"></script>
14
+ <script type="module" src="https://cdn.jsdelivr.net/npm/so-web-components@latest/dist/index.js"></script>
15
15
 
16
16
  <style>
17
17
  body {
@@ -22,18 +22,17 @@
22
22
  }
23
23
 
24
24
  main {
25
- max-width: 960px;
25
+ max-width: 1040px;
26
26
  margin: 0 auto;
27
27
  padding: 24px;
28
28
  }
29
29
 
30
- h1 {
31
- margin: 0 0 12px;
32
- font-size: 1.5rem;
33
- }
34
-
35
- p {
30
+ .so-page-title {
36
31
  margin: 0;
32
+ font-size: 2.25rem;
33
+ line-height: 1.15;
34
+ font-weight: 900;
35
+ letter-spacing: 0;
37
36
  }
38
37
  </style>
39
38
  </head>
@@ -47,8 +46,11 @@
47
46
  </so-breadcrumb>
48
47
 
49
48
  <main>
50
- <h1>Demo-Seite für einfache Webseiten</h1>
51
- <p>Diese Seite lädt <code>so-header</code> und <code>so-breadcrumb</code> direkt aus dem CDN.</p>
49
+ <h1 class="so-page-title">Kartenkatalog</h1>
50
+ <so-lead-text>
51
+ <p>Lorem ipsum odor amet, consectetuer adipiscing elit. Nisi donec vulputate posuere auctor dictum ante. Eu convallis mi consequat per sollicitudin vestibulum odio ut maximus. Maecenas tellus sodales eget nunc volutpat nam integer?</p>
52
+ <p>Ad diam tristique netus conubia dui maecenas pretium aenean. Ridiculus <a href="https://www.cogeo.org/" target="_blank" rel="noopener noreferrer">Cloud Optimized GeoTIFF</a> dictum ligula pretium, ridiculus maecenas tortor.</p>
53
+ </so-lead-text>
52
54
  </main>
53
55
  </body>
54
56
  </html>
@@ -12,7 +12,15 @@
12
12
  body{ background: var(--so-bg); color: var(--so-fg); font-family: var(--so-font-family); }
13
13
  main{ padding: 2rem 0; }
14
14
  .so-container{ max-width: var(--so-container-size-full); margin-inline:auto; padding-inline: var(--so-container-padding); }
15
+ .so-page-title {
16
+ margin: 0;
17
+ font-size: 2.25rem;
18
+ line-height: 1.15;
19
+ font-weight: 900;
20
+ letter-spacing: 0;
21
+ }
15
22
  .hero{
23
+ margin-top: 2rem;
16
24
  height: 260px;
17
25
  border-radius: 12px;
18
26
  background: linear-gradient(135deg, rgba(0,0,0,0.08), rgba(0,0,0,0.02));
@@ -38,6 +46,11 @@
38
46
 
39
47
  <main>
40
48
  <div class="so-container">
49
+ <h1 class="so-page-title">Kartenkatalog</h1>
50
+ <so-lead-text>
51
+ <p>Lorem ipsum odor amet, consectetuer adipiscing elit. Nisi donec vulputate posuere auctor dictum ante. Eu convallis mi consequat per sollicitudin vestibulum odio ut maximus. Maecenas tellus sodales eget nunc volutpat nam integer?</p>
52
+ <p>Ad diam tristique netus conubia dui maecenas pretium aenean. Ridiculus <a href="https://www.cogeo.org/" target="_blank" rel="noopener noreferrer">Cloud Optimized GeoTIFF</a> dictum ligula pretium, ridiculus maecenas tortor.</p>
53
+ </so-lead-text>
41
54
  <div class="hero">Willkommen beim Kanton Solothurn</div>
42
55
  </div>
43
56
  </main>
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import { SoBreadcrumb, SoBreadcrumbItem } from "./components/so-breadcrumb.js";
2
2
  import { SoHeader } from "./components/so-header.js";
3
- export { SoBreadcrumb, SoBreadcrumbItem, SoHeader };
3
+ import { SoLeadText } from "./components/so-lead-text.js";
4
+ export { SoBreadcrumb, SoBreadcrumbItem, SoHeader, SoLeadText };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { SoBreadcrumb, SoBreadcrumbItem } from "./components/so-breadcrumb.js";
2
2
  import { SoHeader } from "./components/so-header.js";
3
+ import { SoLeadText } from "./components/so-lead-text.js";
3
4
  if (!customElements.get("so-header")) {
4
5
  customElements.define("so-header", SoHeader);
5
6
  }
@@ -9,4 +10,7 @@ if (!customElements.get("so-breadcrumb")) {
9
10
  if (!customElements.get("so-breadcrumb-item")) {
10
11
  customElements.define("so-breadcrumb-item", SoBreadcrumbItem);
11
12
  }
12
- export { SoBreadcrumb, SoBreadcrumbItem, SoHeader };
13
+ if (!customElements.get("so-lead-text")) {
14
+ customElements.define("so-lead-text", SoLeadText);
15
+ }
16
+ export { SoBreadcrumb, SoBreadcrumbItem, SoHeader, SoLeadText };