@abtnode/router-templates 1.8.6 → 1.8.7

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/lib/common.js CHANGED
@@ -72,6 +72,11 @@ const style = `
72
72
  </style>
73
73
  `;
74
74
 
75
+ const staticResources = (inBlockletContext) => {
76
+ const baseUrl = inBlockletContext ? '/.well-known/service/static/' : '/';
77
+ return `<link rel="stylesheet" href="${baseUrl}router-template-styles/styles.css">`;
78
+ };
79
+
75
80
  module.exports = ({
76
81
  status,
77
82
  icon,
@@ -85,6 +90,8 @@ module.exports = ({
85
90
  }) => {
86
91
  const hiddenText = `Blocklet Server version: ${nodeInfo.version}, mode: ${nodeInfo.mode}`;
87
92
  const adminPath = nodeInfo.routing ? nodeInfo.routing.adminPath : '';
93
+ // 如果传入了 appName, 认为模板渲染时处于 blocklet 环境中 (比如 blocklet-not-running)
94
+ const inBlockletContext = !!appName;
88
95
  // 明确指定了 status, 使用 result-html-pages 默认的渲染样式 (如 404/502/500)
89
96
  if (status) {
90
97
  return render(
@@ -95,7 +102,7 @@ module.exports = ({
95
102
  title,
96
103
  description: content,
97
104
  hiddenText,
98
- extra: inputExtra,
105
+ extra: (inputExtra || '') + staticResources(inBlockletContext),
99
106
  })
100
107
  );
101
108
  }
@@ -119,7 +126,7 @@ module.exports = ({
119
126
  `;
120
127
 
121
128
  let extra = inputExtra === undefined ? defaultExtra : inputExtra;
122
- extra = (extra || '') + style;
129
+ extra = (extra || '') + style + staticResources(inBlockletContext);
123
130
 
124
131
  return render(
125
132
  filterNullOrUndefined({
@@ -0,0 +1,26 @@
1
+ /* lato-latin-ext-400-normal*/
2
+ @font-face {
3
+ font-family: 'Lato';
4
+ font-style: normal;
5
+ font-display: swap;
6
+ font-weight: 400;
7
+ src: url('./fonts/lato-latin-ext-400-normal.woff2') format('woff2'),
8
+ url('./fonts/lato-all-400-normal.woff') format('woff');
9
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
10
+ }
11
+ /* lato-latin-400-normal*/
12
+ @font-face {
13
+ font-family: 'Lato';
14
+ font-style: normal;
15
+ font-display: swap;
16
+ font-weight: 400;
17
+ src: url('./fonts/lato-latin-400-normal.woff2') format('woff2'),
18
+ url('./fonts/lato-all-400-normal.woff') format('woff');
19
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
20
+ U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
21
+ }
22
+
23
+ body {
24
+ font-family: Lato, Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
25
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
26
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.6",
6
+ "version": "1.8.7",
7
7
  "description": "Provide page templates for ABT Node router",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,11 +19,11 @@
19
19
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@arcblock/result-html-pages": "^2.1.70",
23
- "@blocklet/meta": "1.8.6"
22
+ "@arcblock/result-html-pages": "^2.4.0",
23
+ "@blocklet/meta": "1.8.7"
24
24
  },
25
25
  "devDependencies": {
26
- "jest": "^27.4.5"
26
+ "jest": "^27.5.1"
27
27
  },
28
- "gitHead": "070dad4ce5e12c8961399788f9d206bf7d9d263f"
28
+ "gitHead": "9807ea28b3ae634f5806c875774ac3b7e38502a1"
29
29
  }