@bbki.ng/site 5.5.27 → 5.5.29

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 5.5.29
4
+
5
+ ### Patch Changes
6
+
7
+ - 1f5f015: fix lineheight
8
+
9
+ ## 5.5.28
10
+
11
+ ### Patch Changes
12
+
13
+ - a1c157f: icon font preloading
14
+
3
15
  ## 5.5.27
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "5.5.27",
3
+ "version": "5.5.29",
4
4
  "description": "code behind bbki.ng",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -22,6 +22,7 @@ export const FontRules: Array<FontRule> = [
22
22
  src: '/fonts/yao-icons.woff2',
23
23
  format: 'woff2',
24
24
  hideGlyphOnLoading: true,
25
+ preload: true,
25
26
  },
26
27
  },
27
28
  ];
@@ -75,7 +75,7 @@ class XwyPlugin implements IPlugin {
75
75
  return content
76
76
  .replace(
77
77
  /小乌鸦/g,
78
- `<span class="font-xwy text-content-special text-[1.6rem] align-middle">小乌鸦</span>`
78
+ `<span class="font-xwy text-content-special text-[1.6rem] align-middle leading-[28px]">小乌鸦</span>`
79
79
  )
80
80
  .replace(
81
81
  /公园/,
@@ -5,6 +5,7 @@ export interface FontConfig {
5
5
  fontWeight?: string;
6
6
  fontStyle?: string;
7
7
  hideGlyphOnLoading?: boolean;
8
+ preload?: boolean;
8
9
  }
9
10
 
10
11
  export interface FontRule {
@@ -13,6 +13,17 @@ export const loadFont = (config: FontConfig) => {
13
13
  `
14
14
  : '';
15
15
 
16
+ const existingLink = document.querySelector(`link[rel="preload"][href="${config.src}"]`);
17
+ if (config.preload && !existingLink) {
18
+ const link = document.createElement('link');
19
+ link.rel = 'preload';
20
+ link.as = 'font';
21
+ link.href = config.src;
22
+ link.type = `font/${config.format}`;
23
+ link.crossOrigin = 'anonymous';
24
+ document.head.appendChild(link);
25
+ }
26
+
16
27
  const style = document.createElement('style');
17
28
  style.id = styleId;
18
29
  style.textContent = `