@meith/settings 0.29.1 → 0.30.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meith/settings",
3
- "version": "0.29.1",
3
+ "version": "0.30.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "zod": "^4.4.3",
23
- "@meith/core": "0.29.1",
24
- "@meith/i18n": "0.29.1"
23
+ "@meith/core": "0.30.0",
24
+ "@meith/i18n": "0.30.0"
25
25
  }
26
26
  }
package/src/branding.ts CHANGED
@@ -4,6 +4,8 @@ export const LOGO_SCHEMES: readonly LogoScheme[] = ['light', 'dark']
4
4
 
5
5
  const LOGO_KEY = /^board\/logo-(light|dark)-[a-f0-9-]{36}\.(png|jpg|webp|svg)$/
6
6
 
7
+ const FAVICON_KEY = /^board\/favicon-[a-f0-9-]{36}\.(png|jpg|webp|svg)$/
8
+
7
9
  export function isLogoScheme(value: unknown): value is LogoScheme {
8
10
  return value === 'light' || value === 'dark'
9
11
  }
@@ -12,10 +14,22 @@ export function isLogoKey(value: string): boolean {
12
14
  return LOGO_KEY.test(value)
13
15
  }
14
16
 
17
+ export function isFaviconKey(value: string): boolean {
18
+ return FAVICON_KEY.test(value)
19
+ }
20
+
15
21
  export function logoFormat(key: string): string | null {
16
22
  return LOGO_KEY.exec(key)?.[2] ?? null
17
23
  }
18
24
 
25
+ export function faviconFormat(key: string): string | null {
26
+ return FAVICON_KEY.exec(key)?.[1] ?? null
27
+ }
28
+
29
+ export function faviconPath(key: string): string {
30
+ return `/brand/favicon?v=${key.slice(-16, -4)}`
31
+ }
32
+
19
33
  export function logoPath(scheme: LogoScheme, key: string): string {
20
34
  return `/logo/${scheme}?v=${key.slice(-16, -4)}`
21
35
  }
@@ -302,6 +302,19 @@ export const SETTING_DEFINITIONS = [
302
302
  invalidates: ['settings', 'layout'],
303
303
  ui: { managed: true },
304
304
  }),
305
+ define({
306
+ key: 'board.favicon',
307
+ group: 'board',
308
+ label: 'Favicon',
309
+ description:
310
+ 'The icon browser tabs, bookmarks and an installed shortcut show for this board. ' +
311
+ 'Uploaded, not typed. Left empty, an icon is generated from the board name and its ' +
312
+ 'theme colours.',
313
+ schema: z.string().max(300),
314
+ default: '',
315
+ invalidates: ['settings', 'layout'],
316
+ ui: { managed: true },
317
+ }),
305
318
  define({
306
319
  key: 'board.logo_alt',
307
320
  group: 'board',
package/src/index.ts CHANGED
@@ -7,6 +7,9 @@ export {
7
7
  resolveBoardUrl,
8
8
  } from './board-url'
9
9
  export {
10
+ faviconFormat,
11
+ faviconPath,
12
+ isFaviconKey,
10
13
  isLogoKey,
11
14
  isLogoScheme,
12
15
  LOGO_SCHEMES,