@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.
- package/README.md +9 -9
- package/dist/vite/logo.d.ts +3 -4
- package/dist/vite/logo.js +15 -16
- package/dist/vite/prerender.d.ts +17 -0
- package/dist/vite/prerender.js +57 -0
- package/dist/vite.d.ts +24 -24
- package/dist/vite.js +48 -46
- package/package.json +6 -6
- package/src/build-info.ts +23 -0
- package/src/clipboard.ts +34 -0
- package/src/components/AppFooter.vue +66 -0
- package/src/{komponenten/AppKopf.vue → components/AppHeader.vue} +13 -13
- package/src/components/CodeDisplay.vue +78 -0
- package/src/components/CollapsibleSection.vue +75 -0
- package/src/components/ComboboxField.vue +132 -0
- package/src/components/ConfirmDialog.vue +25 -0
- package/src/components/DateTimeField.vue +47 -0
- package/src/{komponenten → components}/EmberboxApp.vue +4 -4
- package/src/{komponenten/HilfeMockup.vue → components/HelpMockup.vue} +3 -3
- package/src/components/HelpPage.vue +16 -0
- package/src/components/HelpSection.vue +11 -0
- package/src/components/HelpTopic.vue +20 -0
- package/src/{komponenten/NeueFassung.vue → components/NewBuildBanner.vue} +8 -8
- package/src/components/TextAreaField.vue +14 -0
- package/src/components/TextField.vue +29 -0
- package/src/components/YesNoField.vue +47 -0
- package/src/composables/useConfirm.ts +27 -0
- package/src/composables/useNewBuild.ts +45 -0
- package/src/composables/usePolling.ts +55 -57
- package/src/create-app.ts +11 -0
- package/src/index.ts +28 -21
- package/src/page.ts +81 -0
- package/src/prerender.ts +23 -0
- package/src/{stil.css → style.css} +67 -58
- package/src/urls.ts +8 -0
- package/src/vite/logo.ts +16 -17
- package/src/vite/prerender.ts +72 -0
- package/src/vite.ts +57 -55
- package/dist/vite/vorrendern.d.ts +0 -17
- package/dist/vite/vorrendern.js +0 -57
- package/src/adressen.ts +0 -8
- package/src/app.ts +0 -11
- package/src/composables/useNeueFassung.ts +0 -45
- package/src/composables/useRueckfrage.ts +0 -27
- package/src/fassung.ts +0 -23
- package/src/komponenten/AppFuss.vue +0 -58
- package/src/komponenten/CodeAnzeige.vue +0 -79
- package/src/komponenten/HilfeAbschnitt.vue +0 -11
- package/src/komponenten/HilfeSeite.vue +0 -16
- package/src/komponenten/HilfeThema.vue +0 -20
- package/src/komponenten/Rueckfrage.vue +0 -24
- package/src/seite.ts +0 -81
- package/src/vite/vorrendern.ts +0 -72
- package/src/vorrendern.ts +0 -24
- package/src/zwischenablage.ts +0 -34
|
@@ -1,93 +1,91 @@
|
|
|
1
1
|
import {onBeforeUnmount, onMounted, ref} from 'vue'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
export interface
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
|
|
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
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
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
|
-
*
|
|
18
|
-
*
|
|
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
|
|
22
|
-
* @returns
|
|
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(
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
let
|
|
29
|
-
let
|
|
30
|
-
let
|
|
31
|
-
let
|
|
32
|
-
let
|
|
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
|
|
35
|
-
clearTimeout(
|
|
36
|
-
if (
|
|
37
|
-
|
|
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
|
|
42
|
-
if (
|
|
43
|
-
|
|
39
|
+
async function poll(): Promise<void> {
|
|
40
|
+
if (running) {
|
|
41
|
+
again = true
|
|
44
42
|
return
|
|
45
43
|
}
|
|
46
|
-
|
|
47
|
-
clearTimeout(
|
|
44
|
+
running = true
|
|
45
|
+
clearTimeout(timer)
|
|
48
46
|
try {
|
|
49
|
-
await
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
await request()
|
|
48
|
+
connected.value = true
|
|
49
|
+
delay = intervalMs
|
|
52
50
|
} catch {
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
connected.value = false
|
|
52
|
+
delay = Math.min(delay * 2, maxIntervalMs)
|
|
55
53
|
} finally {
|
|
56
|
-
|
|
54
|
+
running = false
|
|
57
55
|
}
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
void
|
|
56
|
+
if (again && active) {
|
|
57
|
+
again = false
|
|
58
|
+
void poll()
|
|
61
59
|
return
|
|
62
60
|
}
|
|
63
|
-
|
|
61
|
+
schedule()
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
function
|
|
64
|
+
function onVisibilityChange(): void {
|
|
67
65
|
if (document.visibilityState === 'visible') {
|
|
68
|
-
void
|
|
66
|
+
void poll()
|
|
69
67
|
} else {
|
|
70
|
-
clearTimeout(
|
|
68
|
+
clearTimeout(timer)
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
void
|
|
72
|
+
function refresh(): void {
|
|
73
|
+
delay = intervalMs
|
|
74
|
+
void poll()
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
onMounted(() => {
|
|
80
|
-
|
|
81
|
-
document.addEventListener('visibilitychange',
|
|
82
|
-
void
|
|
78
|
+
active = true
|
|
79
|
+
document.addEventListener('visibilitychange', onVisibilityChange)
|
|
80
|
+
void poll()
|
|
83
81
|
})
|
|
84
82
|
|
|
85
83
|
onBeforeUnmount(() => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
clearTimeout(
|
|
89
|
-
document.removeEventListener('visibilitychange',
|
|
84
|
+
active = false
|
|
85
|
+
again = false
|
|
86
|
+
clearTimeout(timer)
|
|
87
|
+
document.removeEventListener('visibilitychange', onVisibilityChange)
|
|
90
88
|
})
|
|
91
89
|
|
|
92
|
-
return {
|
|
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,
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {default as
|
|
14
|
-
export {default as
|
|
15
|
-
export {default as
|
|
16
|
-
export {default as
|
|
17
|
-
export {default as
|
|
18
|
-
export {default as
|
|
19
|
-
export {default as
|
|
20
|
-
export {default as
|
|
21
|
-
export {default as
|
|
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
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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
|
|
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
|
+
}
|
package/src/prerender.ts
ADDED
|
@@ -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-
|
|
31
|
-
--color-
|
|
32
|
-
--color-
|
|
33
|
-
--color-
|
|
34
|
-
--color-
|
|
35
|
-
--color-
|
|
36
|
-
--color-
|
|
37
|
-
--color-
|
|
38
|
-
--color-
|
|
39
|
-
--color-
|
|
40
|
-
--color-
|
|
41
|
-
|
|
42
|
-
--color-
|
|
43
|
-
--color-
|
|
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-
|
|
50
|
-
--ui-color-neutral-100: var(--color-
|
|
51
|
-
--ui-color-neutral-200: var(--color-
|
|
52
|
-
--ui-color-neutral-300: var(--color-
|
|
53
|
-
--ui-color-neutral-400: var(--color-
|
|
54
|
-
--ui-color-neutral-500: var(--color-
|
|
55
|
-
--ui-color-neutral-600: var(--color-
|
|
56
|
-
--ui-color-neutral-700: var(--color-
|
|
57
|
-
--ui-color-neutral-800: var(--color-
|
|
58
|
-
--ui-color-neutral-900: var(--color-
|
|
59
|
-
--ui-color-neutral-950: var(--color-
|
|
60
|
-
|
|
61
|
-
--ui-primary: var(--color-
|
|
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-
|
|
67
|
-
--ui-bg-elevated: var(--color-
|
|
68
|
-
--ui-bg-accented: var(--color-
|
|
69
|
-
--ui-bg-inverted: var(--color-
|
|
70
|
-
|
|
71
|
-
--ui-text-dimmed: var(--color-
|
|
72
|
-
--ui-text-muted: var(--color-
|
|
73
|
-
--ui-text-toned: var(--color-
|
|
74
|
-
--ui-text: var(--color-
|
|
75
|
-
--ui-text-highlighted: var(--color-
|
|
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-
|
|
79
|
-
--ui-border-muted: var(--color-
|
|
80
|
-
--ui-border-accented: var(--color-
|
|
81
|
-
--ui-border-inverted: var(--color-
|
|
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-
|
|
83
|
+
--eb-page: var(--color-steel-50);
|
|
84
84
|
--eb-signal-text: var(--color-signal-700);
|
|
85
|
-
--eb-
|
|
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-
|
|
94
|
-
--ui-bg-muted: var(--color-
|
|
95
|
-
--ui-bg-elevated: var(--color-
|
|
96
|
-
--ui-bg-accented: var(--color-
|
|
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-
|
|
99
|
+
--ui-text-dimmed: var(--color-steel-500);
|
|
100
100
|
--ui-text-muted: #8892a0;
|
|
101
|
-
--ui-text-toned: var(--color-
|
|
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-
|
|
104
|
+
--ui-text-inverted: var(--color-steel-950);
|
|
105
105
|
|
|
106
|
-
--ui-border: var(--color-
|
|
107
|
-
--ui-border-muted: var(--color-
|
|
108
|
-
--ui-border-accented: var(--color-
|
|
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-
|
|
111
|
+
--eb-page: var(--color-steel-950);
|
|
112
112
|
--eb-signal-text: #ff6a58;
|
|
113
|
-
--eb-
|
|
113
|
+
--eb-focus: var(--color-sky);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
html,
|
|
117
117
|
body {
|
|
118
|
-
background-color: var(--eb-
|
|
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-
|
|
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
|
|
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
|
-
/**
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
*
|
|
23
|
-
*
|
|
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
|
|
26
|
+
const files = logoFiles(logo)
|
|
28
27
|
return {
|
|
29
28
|
name: 'emberbox:logo',
|
|
30
29
|
configureServer(server) {
|
|
31
|
-
server.middlewares.use((
|
|
32
|
-
const name =
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
|
|
36
|
-
|
|
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,
|
|
42
|
-
this.emitFile({type: 'asset', fileName: name, source: readFileSync(
|
|
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: () => [
|