Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/snowbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,17 @@
default: '0 10px 10px 10px',
},
},
typography: {
font: {
family: {
default: 'Consolas',
},
},
},
},
}

// TODO: Re-enable with isSelectable

Check warning on line 75 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / Linting

Unexpected 'todo' comment: 'TODO: Re-enable with isSelectable'
/*
// arbitrary condition for testing
const isEvenId = (mmlid) => Number(mmlid.slice(-1)) % 2 === 0
Expand All @@ -85,7 +92,7 @@
colorScheme,
startCenter: [573364, 6028874],
layers: [
// TODO: Add internalization to snowbox

Check warning on line 95 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / Linting

Unexpected 'todo' comment: 'TODO: Add internalization to snowbox'
{
id: basemapId,
visibility: true,
Expand Down Expand Up @@ -165,14 +172,14 @@
stroke: '#FFFFFF',
fill: '#333333',
},
// TODO(dopenguin): Has some HMR issues, needs to be fixed

Check warning on line 175 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / Linting

Unexpected 'todo' comment: 'TODO(dopenguin): Has some HMR issues,...'
// isSelectable: isReportSelectable,
},
],
clusterClickZoom: true,
},
// theme: dataportTheme,
/*

Check warning on line 182 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / Linting

Unexpected 'todo' comment: 'TODO(dopenguin): Surrounding application...'
TODO(dopenguin): Surrounding application should be able give information about dark or light mode via update of a state parameter; light mode by default
*/
locales: [
Expand Down Expand Up @@ -261,7 +268,7 @@
key: 'coordinate',
},
],
// TODO: Check if this works when addressSearch is implemented

Check warning on line 271 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / Linting

Unexpected 'todo' comment: 'TODO: Check if this works when...'
addressTarget: {
plugin: 'addressSearch',
key: 'selectResult',
Expand All @@ -286,7 +293,7 @@
},
],
menus: [
// TODO: Delete the mock plugins including the components once the correct plugins have been implemented

Check warning on line 296 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / Linting

Unexpected 'todo' comment: 'TODO: Delete the mock plugins including...'
[
{
plugin: pluginGeoLocation({
Expand Down
1 change: 0 additions & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
/* eslint-enable tsdoc/syntax */

import '@kern-ux/native/dist/fonts/fira-sans.css'
import { defineCustomElement } from 'vue'

import PolarContainer from './components/PolarContainer.ce.vue'
Expand Down
12 changes: 12 additions & 0 deletions src/core/types/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@ export interface KernThemeTree {
/**
* Describes the theming options of KERN.
* The exhaustive list of parameters is documented in `@kern-ux/native`.
*
* **About fonts**
*
* Please mind that setting a value to `kern.typography.font.family.default`
* will stop the client from loading the font `Fira Sans` used in the KERN
* design system. 'inherit' will not work as a value due to technical
* limitations of the ShadowDOM. To inherit whatever would naturally arrive or
* is styled on the host node, use `''` (empty string).
* You may also set `"Fira Sans", sans-serif` (the default value) to this
* variable in case you already have the font loaded to prevent loading it
* twice.
*/
export interface KernTheme {
color: KernThemeTree
metric: KernThemeTree
typography: KernThemeTree
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/core/utils/loadKern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export function loadKern(host: ShadowRoot, theme: Partial<KernTheme> = {}) {
`)
host.adoptedStyleSheets.push(kernSheet)

// @ts-expect-error | It's fine, we're getting `undefined` for an access on string, too.
if (typeof theme.typography?.font?.family?.default !== 'undefined') {
void import('@kern-ux/native/dist/fonts/fira-sans.css')
}

const kernTheme = buildKernTheme(theme)
host.adoptedStyleSheets.push(kernTheme)
}
Expand Down
Loading