x4js 2.2.62 → 2.2.63

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": "x4js",
3
- "version": "2.2.62",
3
+ "version": "2.2.63",
4
4
  "type": "module",
5
5
  "main": "src/x4.ts",
6
6
  "module": "src/x4.ts",
@@ -33,7 +33,7 @@
33
33
  padding: 8px;
34
34
 
35
35
  #kb {
36
- width: 100vw;
36
+ width: 100%;
37
37
  max-width: 800px;
38
38
  zoom: var( --keyboard-zoom );
39
39
  }
@@ -114,10 +114,29 @@ export function unsafeHtml(x: string): UnsafeHtml {
114
114
  }
115
115
 
116
116
  export function unsafe(strings: TemplateStringsArray, ...values: any[]): UnsafeHtml {
117
+
118
+ const resolve = ( value: any ) : string | UnsafeHtml => {
119
+ let v: string;
120
+ if( !value ) {
121
+ return "";
122
+ }
123
+
124
+ if( isArray( value ) ) {
125
+ return value.map( resolve ).join( '' );
126
+ }
127
+
128
+ if ( value instanceof UnsafeHtml ) {
129
+ return value.toString();
130
+ }
131
+
132
+ return sanitizeHtml(value);
133
+ }
134
+
117
135
  const result = strings.reduce((acc, str, i) => {
118
- return acc + str + sanitizeHtml(values[i] ?? '');
136
+ return acc + str + resolve( values[i] );
119
137
  }, '');
120
- return unsafeHtml(result);
138
+
139
+ return new UnsafeHtml(result);
121
140
  }
122
141
 
123
142
  /**