@emberbox/ui 0.1.0 → 0.3.0

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.
Files changed (55) hide show
  1. package/README.md +9 -9
  2. package/dist/vite/logo.d.ts +3 -4
  3. package/dist/vite/logo.js +15 -16
  4. package/dist/vite/prerender.d.ts +17 -0
  5. package/dist/vite/prerender.js +57 -0
  6. package/dist/vite.d.ts +24 -24
  7. package/dist/vite.js +48 -46
  8. package/package.json +6 -6
  9. package/src/build-info.ts +23 -0
  10. package/src/clipboard.ts +34 -0
  11. package/src/components/AppFooter.vue +66 -0
  12. package/src/{komponenten/AppKopf.vue → components/AppHeader.vue} +13 -13
  13. package/src/components/CodeDisplay.vue +78 -0
  14. package/src/components/CollapsibleSection.vue +75 -0
  15. package/src/components/ComboboxField.vue +132 -0
  16. package/src/components/ConfirmDialog.vue +25 -0
  17. package/src/components/DateTimeField.vue +47 -0
  18. package/src/{komponenten → components}/EmberboxApp.vue +4 -4
  19. package/src/{komponenten/HilfeMockup.vue → components/HelpMockup.vue} +3 -3
  20. package/src/components/HelpPage.vue +16 -0
  21. package/src/components/HelpSection.vue +11 -0
  22. package/src/components/HelpTopic.vue +20 -0
  23. package/src/{komponenten/NeueFassung.vue → components/NewBuildBanner.vue} +8 -8
  24. package/src/components/TextAreaField.vue +14 -0
  25. package/src/components/TextField.vue +29 -0
  26. package/src/components/YesNoField.vue +47 -0
  27. package/src/composables/useConfirm.ts +27 -0
  28. package/src/composables/useNewBuild.ts +45 -0
  29. package/src/composables/usePolling.ts +55 -57
  30. package/src/create-app.ts +11 -0
  31. package/src/index.ts +28 -21
  32. package/src/page.ts +81 -0
  33. package/src/prerender.ts +23 -0
  34. package/src/{stil.css → style.css} +67 -58
  35. package/src/urls.ts +8 -0
  36. package/src/vite/logo.ts +16 -17
  37. package/src/vite/prerender.ts +72 -0
  38. package/src/vite.ts +57 -55
  39. package/dist/vite/vorrendern.d.ts +0 -17
  40. package/dist/vite/vorrendern.js +0 -57
  41. package/src/adressen.ts +0 -8
  42. package/src/app.ts +0 -11
  43. package/src/composables/useNeueFassung.ts +0 -45
  44. package/src/composables/useRueckfrage.ts +0 -27
  45. package/src/fassung.ts +0 -23
  46. package/src/komponenten/AppFuss.vue +0 -58
  47. package/src/komponenten/CodeAnzeige.vue +0 -79
  48. package/src/komponenten/HilfeAbschnitt.vue +0 -11
  49. package/src/komponenten/HilfeSeite.vue +0 -16
  50. package/src/komponenten/HilfeThema.vue +0 -20
  51. package/src/komponenten/Rueckfrage.vue +0 -24
  52. package/src/seite.ts +0 -81
  53. package/src/vite/vorrendern.ts +0 -72
  54. package/src/vorrendern.ts +0 -24
  55. package/src/zwischenablage.ts +0 -34
@@ -1,93 +1,91 @@
1
1
  import {onBeforeUnmount, onMounted, ref} from 'vue'
2
2
 
3
- /** Wie ein Werkzeug den Server abfragt. */
4
- export interface PollingOptionen {
5
- /** Abstand zwischen zwei Abfragen, solange der Server antwortet. */
6
- intervallMs?: number
7
- /** Längster Abstand, auf den das Warten nach Fehlern anwächst. */
8
- hoechstensMs?: number
3
+ /** How a tool polls the server. */
4
+ export interface PollingOptions {
5
+ /** Delay between two requests while the server answers. */
6
+ intervalMs?: number
7
+ /** Longest delay the wait grows to after failures. */
8
+ maxIntervalMs?: number
9
9
  }
10
10
 
11
11
  /**
12
- * Fragt regelmäßig ab, solange die Seite sichtbar ist. Scheitert eine Abfrage, verdoppelt sich der
13
- * Abstand bis `hoechstensMs`, damit ein ausgefallener Server nicht im Sekundentakt angefragt wird;
14
- * die erste gelungene Abfrage setzt ihn zurück. Ein verdeckter Tab fragt nicht, und beim
15
- * Zurückkehren wird sofort abgefragt.
12
+ * Polls regularly while the page is visible. When a request fails, the delay doubles up to
13
+ * `maxIntervalMs`, so a server that is down is not hit every second; the first successful request
14
+ * resets it. A hidden tab does not poll, and coming back polls at once.
16
15
  *
17
- * Es läuft nie mehr als eine Abfrage zugleich, damit eine spät eintreffende ältere Antwort keine
18
- * neuere überschreibt. Wird während einer laufenden Abfrage erneut angestoßen, folgt genau eine
19
- * weitere, sobald sie fertig ist.
16
+ * Never more than one request runs at a time, so a late older answer cannot overwrite a newer one.
17
+ * A trigger during a running request queues exactly one more request after it.
20
18
  *
21
- * @param abfrage holt den Stand; ein Fehler gilt als verlorene Verbindung
22
- * @returns ob die letzte Abfrage gelang, und `jetzt`, das sofort neu abfragt
19
+ * @param request fetches the state; an error counts as a lost connection
20
+ * @returns whether the last request succeeded, and `refresh`, which polls immediately
23
21
  */
24
- export function usePolling(abfrage: () => Promise<unknown>, optionen: PollingOptionen = {}) {
25
- const intervallMs = optionen.intervallMs ?? 2_000
26
- const hoechstensMs = optionen.hoechstensMs ?? 30_000
27
- const verbunden = ref(false)
28
- let abstand = intervallMs
29
- let zeitgeber: ReturnType<typeof setTimeout> | undefined
30
- let aktiv = false
31
- let laeuft = false
32
- let nochmal = false
22
+ export function usePolling(request: () => Promise<unknown>, options: PollingOptions = {}) {
23
+ const intervalMs = options.intervalMs ?? 2_000
24
+ const maxIntervalMs = options.maxIntervalMs ?? 30_000
25
+ const connected = ref(false)
26
+ let delay = intervalMs
27
+ let timer: ReturnType<typeof setTimeout> | undefined
28
+ let active = false
29
+ let running = false
30
+ let again = false
33
31
 
34
- function planen(): void {
35
- clearTimeout(zeitgeber)
36
- if (aktiv && document.visibilityState === 'visible') {
37
- zeitgeber = setTimeout(() => void runde(), abstand)
32
+ function schedule(): void {
33
+ clearTimeout(timer)
34
+ if (active && document.visibilityState === 'visible') {
35
+ timer = setTimeout(() => void poll(), delay)
38
36
  }
39
37
  }
40
38
 
41
- async function runde(): Promise<void> {
42
- if (laeuft) {
43
- nochmal = true
39
+ async function poll(): Promise<void> {
40
+ if (running) {
41
+ again = true
44
42
  return
45
43
  }
46
- laeuft = true
47
- clearTimeout(zeitgeber)
44
+ running = true
45
+ clearTimeout(timer)
48
46
  try {
49
- await abfrage()
50
- verbunden.value = true
51
- abstand = intervallMs
47
+ await request()
48
+ connected.value = true
49
+ delay = intervalMs
52
50
  } catch {
53
- verbunden.value = false
54
- abstand = Math.min(abstand * 2, hoechstensMs)
51
+ connected.value = false
52
+ delay = Math.min(delay * 2, maxIntervalMs)
55
53
  } finally {
56
- laeuft = false
54
+ running = false
57
55
  }
58
- if (nochmal && aktiv) {
59
- nochmal = false
60
- void runde()
56
+ if (again && active) {
57
+ again = false
58
+ void poll()
61
59
  return
62
60
  }
63
- planen()
61
+ schedule()
64
62
  }
65
63
 
66
- function sichtbar(): void {
64
+ function onVisibilityChange(): void {
67
65
  if (document.visibilityState === 'visible') {
68
- void runde()
66
+ void poll()
69
67
  } else {
70
- clearTimeout(zeitgeber)
68
+ clearTimeout(timer)
71
69
  }
72
70
  }
73
71
 
74
- function jetzt(): void {
75
- abstand = intervallMs
76
- void runde()
72
+ function refresh(): void {
73
+ delay = intervalMs
74
+ void poll()
77
75
  }
78
76
 
79
77
  onMounted(() => {
80
- aktiv = true
81
- document.addEventListener('visibilitychange', sichtbar)
82
- void runde()
78
+ active = true
79
+ document.addEventListener('visibilitychange', onVisibilityChange)
80
+ void poll()
83
81
  })
84
82
 
85
83
  onBeforeUnmount(() => {
86
- aktiv = false
87
- nochmal = false
88
- clearTimeout(zeitgeber)
89
- document.removeEventListener('visibilitychange', sichtbar)
84
+ active = false
85
+ again = false
86
+ clearTimeout(timer)
87
+ document.removeEventListener('visibilitychange', onVisibilityChange)
90
88
  })
91
89
 
92
- return {verbunden, jetzt}
90
+ return {connected, refresh}
93
91
  }
@@ -0,0 +1,11 @@
1
+ import {type Component, createApp, createSSRApp} from 'vue'
2
+
3
+ /**
4
+ * Creates a tool's app in the browser. On a prerendered page Vue takes over the existing HTML
5
+ * (hydration), otherwise it builds the page from scratch. Wait for `router.isReady()` before
6
+ * `mount`, so hydration hits the same page.
7
+ */
8
+ export function createToolApp(root: Component) {
9
+ const prerendered = (document.getElementById('app')?.childElementCount ?? 0) > 0
10
+ return prerendered ? createSSRApp(root) : createApp(root)
11
+ }
package/src/index.ts CHANGED
@@ -2,32 +2,39 @@ import {_api} from '@iconify/vue'
2
2
  import nuxtUi from '@nuxt/ui/vue-plugin'
3
3
  import type {App} from 'vue'
4
4
 
5
- export {HUB_URL, IMPRESSUM_URL, DATENSCHUTZ_URL} from './adressen'
6
- export {fassung, gebautLesbar} from './fassung'
7
- export {appErzeugen} from './app'
8
- export {ADRESSE, useSeite, werkzeugDaten, type SeitenAngaben, type WerkzeugAngaben} from './seite'
9
- export {useNeueFassung} from './composables/useNeueFassung'
10
- export {usePolling, type PollingOptionen} from './composables/usePolling'
11
- export {useRueckfrage, type RueckfrageOptionen} from './composables/useRueckfrage'
12
- export {default as EmberboxApp} from './komponenten/EmberboxApp.vue'
13
- export {default as AppKopf} from './komponenten/AppKopf.vue'
14
- export {default as AppFuss} from './komponenten/AppFuss.vue'
15
- export {default as NeueFassung} from './komponenten/NeueFassung.vue'
16
- export {default as CodeAnzeige} from './komponenten/CodeAnzeige.vue'
17
- export {default as Rueckfrage} from './komponenten/Rueckfrage.vue'
18
- export {default as HilfeSeite} from './komponenten/HilfeSeite.vue'
19
- export {default as HilfeAbschnitt} from './komponenten/HilfeAbschnitt.vue'
20
- export {default as HilfeThema} from './komponenten/HilfeThema.vue'
21
- export {default as HilfeMockup} from './komponenten/HilfeMockup.vue'
5
+ export {HUB_URL, IMPRINT_URL, PRIVACY_URL} from './urls'
6
+ export {buildInfo, formatBuiltAt} from './build-info'
7
+ export {createToolApp} from './create-app'
8
+ export {copyToClipboard} from './clipboard'
9
+ export {SITE_URL, usePage, webApplicationData, type PageMeta, type WebApplicationInfo} from './page'
10
+ export {useNewBuild} from './composables/useNewBuild'
11
+ export {usePolling, type PollingOptions} from './composables/usePolling'
12
+ export {useConfirm, type ConfirmOptions} from './composables/useConfirm'
13
+ export {default as EmberboxApp} from './components/EmberboxApp.vue'
14
+ export {default as AppHeader} from './components/AppHeader.vue'
15
+ export {default as AppFooter} from './components/AppFooter.vue'
16
+ export {default as NewBuildBanner} from './components/NewBuildBanner.vue'
17
+ export {default as CodeDisplay} from './components/CodeDisplay.vue'
18
+ export {default as ConfirmDialog} from './components/ConfirmDialog.vue'
19
+ export {default as HelpPage} from './components/HelpPage.vue'
20
+ export {default as HelpSection} from './components/HelpSection.vue'
21
+ export {default as HelpTopic} from './components/HelpTopic.vue'
22
+ export {default as HelpMockup} from './components/HelpMockup.vue'
23
+ export {default as TextField} from './components/TextField.vue'
24
+ export {default as TextAreaField} from './components/TextAreaField.vue'
25
+ export {default as ComboboxField} from './components/ComboboxField.vue'
26
+ export {default as YesNoField} from './components/YesNoField.vue'
27
+ export {default as DateTimeField} from './components/DateTimeField.vue'
28
+ export {default as CollapsibleSection} from './components/CollapsibleSection.vue'
22
29
 
23
30
  /**
24
- * Vue-Plugin, das Nuxt UI im Emberbox-Stil in eine App einhängt. Icons kommen ausschließlich aus
25
- * dem gebündelten Satz; ein fehlendes Icon bleibt leer, statt bei der Iconify-API nachgeladen zu
26
- * werden, damit kein Besuch eines Werkzeugs bei einem Dritten landet.
31
+ * Vue plugin that installs Nuxt UI in the Emberbox style. Icons come only from the bundled set; a
32
+ * missing icon stays empty instead of being fetched from the Iconify API, so no visit to a tool
33
+ * reaches a third party.
27
34
  */
28
35
  export const emberboxUi = {
29
36
  install(app: App) {
30
- _api.setFetch(() => Promise.reject(new Error('Icons werden nicht nachgeladen.')))
37
+ _api.setFetch(() => Promise.reject(new Error('Icons are not fetched at runtime.')))
31
38
  app.use(nuxtUi)
32
39
  },
33
40
  }
package/src/page.ts ADDED
@@ -0,0 +1,81 @@
1
+ import {useHead, useSeoMeta} from '@unhead/vue'
2
+
3
+ declare const __EMBERBOX_URL__: string | undefined
4
+ declare const __EMBERBOX_IMAGE__: string | undefined
5
+
6
+ /** The tool's public address, as `emberbox({url})` sets it at build time. */
7
+ export const SITE_URL = typeof __EMBERBOX_URL__ === 'string' ? __EMBERBOX_URL__ : ''
8
+
9
+ /** The preview image when a page names none: the tool's logo from `emberbox({logo})`. */
10
+ const DEFAULT_IMAGE = typeof __EMBERBOX_IMAGE__ === 'string' ? __EMBERBOX_IMAGE__ : ''
11
+
12
+ /** What search engines and link previews learn about a page. */
13
+ export interface PageMeta {
14
+ /** The full title as it appears in the tab and in search results. */
15
+ title: string
16
+ /** One or two sentences for search results and previews. */
17
+ description: string
18
+ /** The page's path; together with `url` it becomes the canonical address. */
19
+ path?: string
20
+ /** `false` for pages that do not belong in search results, such as exercises with a code. */
21
+ index?: boolean
22
+ /** Preview image as an absolute address or a path below `url`; the logo otherwise. */
23
+ image?: string
24
+ /** Structured data (JSON-LD), for example from `webApplicationData`. */
25
+ structuredData?: object[]
26
+ }
27
+
28
+ function absolute(path: string): string {
29
+ return /^https?:\/\//.test(path) ? path : `${SITE_URL}${path}`
30
+ }
31
+
32
+ /**
33
+ * Sets a page's title, description, canonical address, OpenGraph and Twitter tags, `robots` and
34
+ * structured data. Works the same in the browser and when prerendering.
35
+ */
36
+ export function usePage(meta: PageMeta): void {
37
+ const index = meta.index ?? true
38
+ const url = meta.path !== undefined && SITE_URL ? absolute(meta.path) : undefined
39
+ const imageSource = meta.image ?? DEFAULT_IMAGE
40
+ const image = imageSource && SITE_URL ? absolute(imageSource) : undefined
41
+ useHead({
42
+ title: meta.title,
43
+ link: url ? [{rel: 'canonical', href: url}] : [],
44
+ script: (meta.structuredData ?? []).map(data => ({type: 'application/ld+json', innerHTML: JSON.stringify(data)})),
45
+ })
46
+ useSeoMeta({
47
+ description: meta.description,
48
+ robots: index ? 'index, follow' : 'noindex, nofollow',
49
+ ogType: 'website',
50
+ ogLocale: 'de_DE',
51
+ ogSiteName: 'Emberbox',
52
+ ogTitle: meta.title,
53
+ ogDescription: meta.description,
54
+ ogUrl: url,
55
+ ogImage: image,
56
+ twitterCard: meta.image ? 'summary_large_image' : 'summary',
57
+ })
58
+ }
59
+
60
+ /** What a tool states about itself as a web application. */
61
+ export interface WebApplicationInfo {
62
+ name: string
63
+ description: string
64
+ url?: string
65
+ }
66
+
67
+ /** Structured data (schema.org `WebApplication`) for a tool's start page. */
68
+ export function webApplicationData(info: WebApplicationInfo): object {
69
+ return {
70
+ '@context': 'https://schema.org',
71
+ '@type': 'WebApplication',
72
+ name: info.name,
73
+ description: info.description,
74
+ url: info.url ?? (SITE_URL || undefined),
75
+ applicationCategory: 'EducationalApplication',
76
+ operatingSystem: 'Web',
77
+ inLanguage: 'de',
78
+ isAccessibleForFree: true,
79
+ offers: {'@type': 'Offer', price: '0', priceCurrency: 'EUR'},
80
+ }
81
+ }
@@ -0,0 +1,23 @@
1
+ import {createHead, transformHtmlTemplate} from '@unhead/vue/server'
2
+ import type {App} from 'vue'
3
+ import {renderToString} from 'vue/server-renderer'
4
+ import {emberboxUi} from './index'
5
+
6
+ /**
7
+ * Renders a fully set up app (router on the path, data loaded) to a complete HTML page. Installs
8
+ * head management and Nuxt UI itself, so the app must not use `emberboxUi` yet. The content goes
9
+ * into the template's `<div id="app">`, title and meta tags into its head.
10
+ *
11
+ * @param app the app created with `createSSRApp`
12
+ * @param template the tool's built `index.html`
13
+ * @returns the prerendered page
14
+ */
15
+ export async function renderPage(app: App, template: string): Promise<string> {
16
+ const head = createHead({disableDefaults: true})
17
+ app.use(head)
18
+ app.use(emberboxUi)
19
+ const content = await renderToString(app)
20
+ const page = template.replace('<div id="app"></div>', `<div id="app">${content}</div>`)
21
+ if (page === template) throw new Error('The template has no empty <div id="app"></div>.')
22
+ return transformHtmlTemplate(head, page)
23
+ }
@@ -27,62 +27,62 @@
27
27
  --color-signal-900: #721914;
28
28
  --color-signal-950: #2a1614;
29
29
 
30
- --color-stahl-50: #f4f6f8;
31
- --color-stahl-100: #eef1f4;
32
- --color-stahl-200: #dce1e7;
33
- --color-stahl-300: #c1c8d1;
34
- --color-stahl-400: #8a94a2;
35
- --color-stahl-500: #5c6775;
36
- --color-stahl-600: #444e5b;
37
- --color-stahl-700: #2a333e;
38
- --color-stahl-800: #212932;
39
- --color-stahl-900: #1a2027;
40
- --color-stahl-950: #12161c;
41
-
42
- --color-tinte: #10141a;
43
- --color-band: #4fa3e3;
30
+ --color-steel-50: #f4f6f8;
31
+ --color-steel-100: #eef1f4;
32
+ --color-steel-200: #dce1e7;
33
+ --color-steel-300: #c1c8d1;
34
+ --color-steel-400: #8a94a2;
35
+ --color-steel-500: #5c6775;
36
+ --color-steel-600: #444e5b;
37
+ --color-steel-700: #2a333e;
38
+ --color-steel-800: #212932;
39
+ --color-steel-900: #1a2027;
40
+ --color-steel-950: #12161c;
41
+
42
+ --color-ink: #10141a;
43
+ --color-sky: #4fa3e3;
44
44
  }
45
45
 
46
46
  :root {
47
47
  --ui-radius: 4px;
48
48
 
49
- --ui-color-neutral-50: var(--color-stahl-50);
50
- --ui-color-neutral-100: var(--color-stahl-100);
51
- --ui-color-neutral-200: var(--color-stahl-200);
52
- --ui-color-neutral-300: var(--color-stahl-300);
53
- --ui-color-neutral-400: var(--color-stahl-400);
54
- --ui-color-neutral-500: var(--color-stahl-500);
55
- --ui-color-neutral-600: var(--color-stahl-600);
56
- --ui-color-neutral-700: var(--color-stahl-700);
57
- --ui-color-neutral-800: var(--color-stahl-800);
58
- --ui-color-neutral-900: var(--color-stahl-900);
59
- --ui-color-neutral-950: var(--color-stahl-950);
60
-
61
- --ui-primary: var(--color-tinte);
49
+ --ui-color-neutral-50: var(--color-steel-50);
50
+ --ui-color-neutral-100: var(--color-steel-100);
51
+ --ui-color-neutral-200: var(--color-steel-200);
52
+ --ui-color-neutral-300: var(--color-steel-300);
53
+ --ui-color-neutral-400: var(--color-steel-400);
54
+ --ui-color-neutral-500: var(--color-steel-500);
55
+ --ui-color-neutral-600: var(--color-steel-600);
56
+ --ui-color-neutral-700: var(--color-steel-700);
57
+ --ui-color-neutral-800: var(--color-steel-800);
58
+ --ui-color-neutral-900: var(--color-steel-900);
59
+ --ui-color-neutral-950: var(--color-steel-950);
60
+
61
+ --ui-primary: var(--color-ink);
62
62
  --ui-signal: var(--color-signal-500);
63
63
  --ui-error: var(--color-signal-500);
64
64
 
65
65
  --ui-bg: #ffffff;
66
- --ui-bg-muted: var(--color-stahl-50);
67
- --ui-bg-elevated: var(--color-stahl-100);
68
- --ui-bg-accented: var(--color-stahl-200);
69
- --ui-bg-inverted: var(--color-tinte);
70
-
71
- --ui-text-dimmed: var(--color-stahl-400);
72
- --ui-text-muted: var(--color-stahl-500);
73
- --ui-text-toned: var(--color-stahl-600);
74
- --ui-text: var(--color-tinte);
75
- --ui-text-highlighted: var(--color-tinte);
66
+ --ui-bg-muted: var(--color-steel-50);
67
+ --ui-bg-elevated: var(--color-steel-100);
68
+ --ui-bg-accented: var(--color-steel-200);
69
+ --ui-bg-inverted: var(--color-ink);
70
+
71
+ --ui-text-dimmed: var(--color-steel-400);
72
+ --ui-text-muted: var(--color-steel-500);
73
+ --ui-text-toned: var(--color-steel-600);
74
+ --ui-text: var(--color-ink);
75
+ --ui-text-highlighted: var(--color-ink);
76
76
  --ui-text-inverted: #ffffff;
77
77
 
78
- --ui-border: var(--color-stahl-200);
79
- --ui-border-muted: var(--color-stahl-100);
80
- --ui-border-accented: var(--color-stahl-300);
81
- --ui-border-inverted: var(--color-tinte);
78
+ --ui-border: var(--color-steel-200);
79
+ --ui-border-muted: var(--color-steel-100);
80
+ --ui-border-accented: var(--color-steel-300);
81
+ --ui-border-inverted: var(--color-ink);
82
82
 
83
- --eb-seite: var(--color-stahl-50);
83
+ --eb-page: var(--color-steel-50);
84
84
  --eb-signal-text: var(--color-signal-700);
85
- --eb-fokus: var(--color-signal-500);
85
+ --eb-focus: var(--color-signal-500);
86
86
  }
87
87
 
88
88
  :root.dark {
@@ -90,32 +90,32 @@
90
90
  --ui-signal: var(--color-signal-400);
91
91
  --ui-error: #ff6a58;
92
92
 
93
- --ui-bg: var(--color-stahl-900);
94
- --ui-bg-muted: var(--color-stahl-950);
95
- --ui-bg-elevated: var(--color-stahl-800);
96
- --ui-bg-accented: var(--color-stahl-700);
93
+ --ui-bg: var(--color-steel-900);
94
+ --ui-bg-muted: var(--color-steel-950);
95
+ --ui-bg-elevated: var(--color-steel-800);
96
+ --ui-bg-accented: var(--color-steel-700);
97
97
  --ui-bg-inverted: #edf0f3;
98
98
 
99
- --ui-text-dimmed: var(--color-stahl-500);
99
+ --ui-text-dimmed: var(--color-steel-500);
100
100
  --ui-text-muted: #8892a0;
101
- --ui-text-toned: var(--color-stahl-300);
101
+ --ui-text-toned: var(--color-steel-300);
102
102
  --ui-text: #edf0f3;
103
103
  --ui-text-highlighted: #ffffff;
104
- --ui-text-inverted: var(--color-stahl-950);
104
+ --ui-text-inverted: var(--color-steel-950);
105
105
 
106
- --ui-border: var(--color-stahl-700);
107
- --ui-border-muted: var(--color-stahl-800);
108
- --ui-border-accented: var(--color-stahl-600);
106
+ --ui-border: var(--color-steel-700);
107
+ --ui-border-muted: var(--color-steel-800);
108
+ --ui-border-accented: var(--color-steel-600);
109
109
  --ui-border-inverted: #edf0f3;
110
110
 
111
- --eb-seite: var(--color-stahl-950);
111
+ --eb-page: var(--color-steel-950);
112
112
  --eb-signal-text: #ff6a58;
113
- --eb-fokus: var(--color-band);
113
+ --eb-focus: var(--color-sky);
114
114
  }
115
115
 
116
116
  html,
117
117
  body {
118
- background-color: var(--eb-seite);
118
+ background-color: var(--eb-page);
119
119
  }
120
120
 
121
121
  body {
@@ -128,7 +128,7 @@ body {
128
128
 
129
129
  @layer base {
130
130
  :where(button, a, input, select, textarea, [tabindex]):focus-visible {
131
- outline: 2px solid var(--eb-fokus);
131
+ outline: 2px solid var(--eb-focus);
132
132
  outline-offset: 2px;
133
133
  }
134
134
  }
@@ -161,7 +161,7 @@ body {
161
161
  }
162
162
  }
163
163
 
164
- @utility feld-label {
164
+ @utility field-label {
165
165
  font-family: var(--font-condensed);
166
166
  font-weight: 600;
167
167
  font-size: 12px;
@@ -170,3 +170,12 @@ body {
170
170
  text-transform: uppercase;
171
171
  color: var(--ui-text-muted);
172
172
  }
173
+
174
+ @utility section-title {
175
+ font-family: var(--font-condensed);
176
+ font-weight: 700;
177
+ font-size: 15px;
178
+ letter-spacing: 0.06em;
179
+ text-transform: uppercase;
180
+ color: var(--ui-text-highlighted);
181
+ }
package/src/urls.ts ADDED
@@ -0,0 +1,8 @@
1
+ /** The start page of all Emberbox tools. */
2
+ export const HUB_URL = 'https://emberbox.app'
3
+
4
+ /** The imprint shared by all tools. */
5
+ export const IMPRINT_URL = `${HUB_URL}/impressum`
6
+
7
+ /** The privacy policy shared by all tools. */
8
+ export const PRIVACY_URL = `${HUB_URL}/datenschutz`
package/src/vite/logo.ts CHANGED
@@ -2,13 +2,15 @@ import {readFileSync} from 'node:fs'
2
2
  import {fileURLToPath} from 'node:url'
3
3
  import type {Plugin} from 'vite'
4
4
 
5
- /** Die Werkzeuge, für die `@emberbox/ui` ein Logo mitbringt. */
5
+ /** The tools for which `@emberbox/ui` ships a logo. */
6
6
  export type Logo = 'emberbox' | 'alarmzettel' | 'statussim' | 'calltaker'
7
7
 
8
8
  const LOGOS = fileURLToPath(new URL('../../logos/', import.meta.url))
9
9
 
10
- /** Welche Datei unter welchem Namen im Wurzelverzeichnis des Werkzeugs liegt. */
11
- function dateien(logo: Logo): Record<string, string> {
10
+ const CONTENT_TYPES: Record<string, string> = {svg: 'image/svg+xml', png: 'image/png'}
11
+
12
+ /** Which file is served under which name at the tool's root. */
13
+ function logoFiles(logo: Logo): Record<string, string> {
12
14
  return {
13
15
  'favicon.svg': `${LOGOS}${logo}.svg`,
14
16
  'apple-touch-icon.png': `${LOGOS}${logo}-180.png`,
@@ -16,30 +18,27 @@ function dateien(logo: Logo): Record<string, string> {
16
18
  }
17
19
  }
18
20
 
19
- const TYPEN: Record<string, string> = {svg: 'image/svg+xml', png: 'image/png'}
20
-
21
21
  /**
22
- * Liefert das Logo eines Werkzeugs als `favicon.svg`, `apple-touch-icon.png` und `logo-512.png`
23
- * im Wurzelverzeichnis aus, im Entwicklungsserver wie im Build, und verlinkt die ersten beiden im
24
- * Kopf jeder Seite.
22
+ * Serves a tool's logo as `favicon.svg`, `apple-touch-icon.png` and `logo-512.png` at the root, in
23
+ * the dev server as in the build, and links the first two in the head of every page.
25
24
  */
26
25
  export function logoPlugin(logo: Logo): Plugin {
27
- const liste = dateien(logo)
26
+ const files = logoFiles(logo)
28
27
  return {
29
28
  name: 'emberbox:logo',
30
29
  configureServer(server) {
31
- server.middlewares.use((anfrage, antwort, weiter) => {
32
- const name = anfrage.url?.split('?')[0]?.slice(1) ?? ''
33
- const datei = liste[name]
34
- if (!datei) return weiter()
35
- antwort.setHeader('Content-Type', TYPEN[name.split('.').pop() ?? ''] ?? 'application/octet-stream')
36
- antwort.end(readFileSync(datei))
30
+ server.middlewares.use((request, response, next) => {
31
+ const name = request.url?.split('?')[0]?.slice(1) ?? ''
32
+ const file = files[name]
33
+ if (!file) return next()
34
+ response.setHeader('Content-Type', CONTENT_TYPES[name.split('.').pop() ?? ''] ?? 'application/octet-stream')
35
+ response.end(readFileSync(file))
37
36
  })
38
37
  },
39
38
  generateBundle() {
40
39
  if (this.environment?.config.build.ssr) return
41
- for (const [name, datei] of Object.entries(liste)) {
42
- this.emitFile({type: 'asset', fileName: name, source: readFileSync(datei)})
40
+ for (const [name, file] of Object.entries(files)) {
41
+ this.emitFile({type: 'asset', fileName: name, source: readFileSync(file)})
43
42
  }
44
43
  },
45
44
  transformIndexHtml: () => [