@sswroom/sswr 1.5.4 → 1.6.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/Changelog +30 -0
- package/cert.d.ts +411 -0
- package/cert.js +4616 -0
- package/certutil.d.ts +376 -0
- package/certutil.js +2692 -0
- package/cesium.d.ts +13 -13
- package/cesium.js +8 -4
- package/data.d.ts +76 -30
- package/data.js +342 -75
- package/geometry.d.ts +2 -2
- package/hash.d.ts +57 -0
- package/hash.js +269 -0
- package/hkoapi.d.ts +26 -26
- package/kml.d.ts +53 -16
- package/kml.js +115 -2
- package/leaflet.d.ts +17 -7
- package/leaflet.js +55 -4
- package/map.d.ts +17 -16
- package/map.js +1 -1
- package/math.d.ts +13 -13
- package/media.d.ts +119 -0
- package/media.js +2272 -0
- package/net.d.ts +1 -0
- package/net.js +5 -0
- package/olayer2.d.ts +2 -2
- package/olayer2.js +8 -4
- package/package.json +1 -1
- package/parser.d.ts +8 -2
- package/parser.js +539 -3
- package/text.d.ts +3 -1
- package/text.js +70 -2
- package/unit.d.ts +2 -0
- package/unit.js +110 -0
- package/web.d.ts +3 -1
- package/web.js +54 -4
package/text.js
CHANGED
|
@@ -216,8 +216,76 @@ export function toHex16(v)
|
|
|
216
216
|
|
|
217
217
|
export function toHex32(v)
|
|
218
218
|
{
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
return toHex16(v >> 16) + toHex16(v);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export function u8Arr2Hex(buff, byteSep, rowSep)
|
|
223
|
+
{
|
|
224
|
+
let rows = [];
|
|
225
|
+
let thisRow = [];
|
|
226
|
+
let i = 1;
|
|
227
|
+
let j = buff.length;
|
|
228
|
+
if (j == 0)
|
|
229
|
+
return "";
|
|
230
|
+
if (byteSep == null)
|
|
231
|
+
byteSep = "";
|
|
232
|
+
thisRow.push(toHex8(buff[0]));
|
|
233
|
+
while (i < j)
|
|
234
|
+
{
|
|
235
|
+
if ((i & 15) == 0)
|
|
236
|
+
{
|
|
237
|
+
rows.push(thisRow.join(byteSep));
|
|
238
|
+
thisRow = [];
|
|
239
|
+
}
|
|
240
|
+
thisRow.push(toHex8(buff[i]));
|
|
241
|
+
i++;
|
|
242
|
+
}
|
|
243
|
+
rows.push(thisRow.join(byteSep));
|
|
244
|
+
if (rowSep == null)
|
|
245
|
+
rowSep = byteSep;
|
|
246
|
+
return rows.join(rowSep);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export function splitLines(txt)
|
|
250
|
+
{
|
|
251
|
+
let lines = [];
|
|
252
|
+
let pos = 0;
|
|
253
|
+
let i;
|
|
254
|
+
let j;
|
|
255
|
+
while (true)
|
|
256
|
+
{
|
|
257
|
+
i = txt.indexOf("\r", pos);
|
|
258
|
+
j = txt.indexOf("\n", pos);
|
|
259
|
+
if (i == -1 && j == -1)
|
|
260
|
+
{
|
|
261
|
+
lines.push(txt.substring(pos));
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
else if (i == -1)
|
|
265
|
+
{
|
|
266
|
+
lines.push(txt.substring(pos, j));
|
|
267
|
+
pos = j + 1;
|
|
268
|
+
}
|
|
269
|
+
else if (j == -1)
|
|
270
|
+
{
|
|
271
|
+
lines.push(txt.substring(pos, i));
|
|
272
|
+
pos = i + 1;
|
|
273
|
+
}
|
|
274
|
+
else if (i < j)
|
|
275
|
+
{
|
|
276
|
+
lines.push(txt.substring(pos, i));
|
|
277
|
+
if (j == i + 1)
|
|
278
|
+
pos = j + 1;
|
|
279
|
+
else
|
|
280
|
+
pos = i + 1;
|
|
281
|
+
}
|
|
282
|
+
else
|
|
283
|
+
{
|
|
284
|
+
lines.push(txt.substring(pos, j));
|
|
285
|
+
pos = j + 1;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return lines;
|
|
221
289
|
}
|
|
222
290
|
|
|
223
291
|
export function getEncList()
|
package/unit.d.ts
CHANGED
|
@@ -83,6 +83,8 @@ export class Count
|
|
|
83
83
|
static getUnitInfo(u: Count.Unit): UnitInfo<Count.Unit> | null;
|
|
84
84
|
static getUnitRatio(u: Count.Unit) : number;
|
|
85
85
|
static convert(fromUnit: Count.Unit, toUnit: Count.Unit, fromValue: number): number;
|
|
86
|
+
static wellFormat(val: number, nDecimal?: number): string;
|
|
87
|
+
static wellFormatBin(val: number, nDecimal?: number): string;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
module Distance
|
package/unit.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as math from "./math.js";
|
|
2
|
+
|
|
1
3
|
export class UnitInfo
|
|
2
4
|
{
|
|
3
5
|
constructor(unit, symbol, name, ratio, scale)
|
|
@@ -216,6 +218,114 @@ export class Count
|
|
|
216
218
|
{
|
|
217
219
|
return fromValue * ApparentPower.getUnitRatio(fromUnit) / ApparentPower.getUnitRatio(toUnit);
|
|
218
220
|
}
|
|
221
|
+
|
|
222
|
+
static wellFormat(val, nDecimal)
|
|
223
|
+
{
|
|
224
|
+
if (nDecimal == null || nDecimal < 1)
|
|
225
|
+
nDecimal = 2;
|
|
226
|
+
let lval = Math.log10(val);
|
|
227
|
+
if (lval < 0)
|
|
228
|
+
{
|
|
229
|
+
if (lval >= -2)
|
|
230
|
+
{
|
|
231
|
+
return math.roundToStr(val * 100, nDecimal)+"c";
|
|
232
|
+
}
|
|
233
|
+
else if (lval >= -3)
|
|
234
|
+
{
|
|
235
|
+
return math.roundToStr(val * 1000, nDecimal)+"m";
|
|
236
|
+
}
|
|
237
|
+
else if (lval >= -6)
|
|
238
|
+
{
|
|
239
|
+
return math.roundToStr(val * 1000000, nDecimal)+"u";
|
|
240
|
+
}
|
|
241
|
+
else if (lval >= -9)
|
|
242
|
+
{
|
|
243
|
+
return math.roundToStr(val * 1.0e9, nDecimal)+"n";
|
|
244
|
+
}
|
|
245
|
+
else if (lval >= -12)
|
|
246
|
+
{
|
|
247
|
+
return math.roundToStr(val * 1.0e12, nDecimal)+"p";
|
|
248
|
+
}
|
|
249
|
+
else if (lval >= -15)
|
|
250
|
+
{
|
|
251
|
+
return math.roundToStr(val * 1.0e15, nDecimal)+"f";
|
|
252
|
+
}
|
|
253
|
+
else if (lval >= -18)
|
|
254
|
+
{
|
|
255
|
+
return math.roundToStr(val * 1.0e18, nDecimal)+"a";
|
|
256
|
+
}
|
|
257
|
+
else if (lval >= -21)
|
|
258
|
+
{
|
|
259
|
+
return math.roundToStr(val * 1.0e21, nDecimal)+"z";
|
|
260
|
+
}
|
|
261
|
+
else
|
|
262
|
+
{
|
|
263
|
+
return math.roundToStr(val * 1.0e24, nDecimal)+"y";
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
else if (lval < 3)
|
|
267
|
+
{
|
|
268
|
+
return math.roundToStr(val, nDecimal);
|
|
269
|
+
}
|
|
270
|
+
else if (lval < 6)
|
|
271
|
+
{
|
|
272
|
+
return math.roundToStr(val / 1.0e3, nDecimal)+"k";
|
|
273
|
+
}
|
|
274
|
+
else if (lval < 9)
|
|
275
|
+
{
|
|
276
|
+
return math.roundToStr(val / 1.0e6, nDecimal)+"M";
|
|
277
|
+
}
|
|
278
|
+
else if (val < 12)
|
|
279
|
+
{
|
|
280
|
+
return math.roundToStr(val / 1.0e9, nDecimal)+"G";
|
|
281
|
+
}
|
|
282
|
+
else if (val < 15)
|
|
283
|
+
{
|
|
284
|
+
return math.roundToStr(val / 1.0e12, nDecimal)+"T";
|
|
285
|
+
}
|
|
286
|
+
else if (val < 18)
|
|
287
|
+
{
|
|
288
|
+
return math.roundToStr(val / 1.0e15, nDecimal)+"P";
|
|
289
|
+
}
|
|
290
|
+
else if (val < 21)
|
|
291
|
+
{
|
|
292
|
+
return math.roundToStr(val / 1.0e18, nDecimal)+"E";
|
|
293
|
+
}
|
|
294
|
+
else if (val < 24)
|
|
295
|
+
{
|
|
296
|
+
return math.roundToStr(val / 1.0e21, nDecimal)+"Z";
|
|
297
|
+
}
|
|
298
|
+
else
|
|
299
|
+
{
|
|
300
|
+
return math.roundToStr(val / 1.0e24, nDecimal)+"Y";
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
static wellFormatBin(val, nDecimal)
|
|
305
|
+
{
|
|
306
|
+
if (nDecimal == null || nDecimal < 1)
|
|
307
|
+
nDecimal = 2;
|
|
308
|
+
if (val < 1024)
|
|
309
|
+
{
|
|
310
|
+
return math.roundToStr(val, nDecimal);
|
|
311
|
+
}
|
|
312
|
+
else if (val < 1048576)
|
|
313
|
+
{
|
|
314
|
+
return math.roundToStr(val / 1024, nDecimal)+"Ki";
|
|
315
|
+
}
|
|
316
|
+
else if (val < 1073741824)
|
|
317
|
+
{
|
|
318
|
+
return math.roundToStr(val / 1048576, nDecimal)+"Mi";
|
|
319
|
+
}
|
|
320
|
+
else if (val < 1099511627776)
|
|
321
|
+
{
|
|
322
|
+
return math.roundToStr(val / 1073741824, nDecimal)+"Gi";
|
|
323
|
+
}
|
|
324
|
+
else
|
|
325
|
+
{
|
|
326
|
+
return math.roundToStr(val / 1099511627776, nDecimal)+"Ti";
|
|
327
|
+
}
|
|
328
|
+
}
|
|
219
329
|
}
|
|
220
330
|
|
|
221
331
|
export class Distance
|
package/web.d.ts
CHANGED
|
@@ -16,13 +16,15 @@ export function getRequestURLBase(): string;
|
|
|
16
16
|
export function getParameterByName(name: string): string | null;
|
|
17
17
|
export function loadJSON(url: string, onResultFunc: Function): void;
|
|
18
18
|
export function buildTable(o: object | object[]): string;
|
|
19
|
-
export function openData(data: string, contentType: string, fileName?: string): void;
|
|
19
|
+
export function openData(data: string | Blob, contentType: string, fileName?: string): void;
|
|
20
20
|
export function parseCSSColor(c: string): Color;
|
|
21
21
|
export function handleFileDrop(ele: HTMLElement, hdlr: (file: File)=>void): void;
|
|
22
22
|
export function appendUrl(targetUrl: string, docUrl: string): string;
|
|
23
23
|
export function mimeFromFileName(fileName: string): string;
|
|
24
24
|
export function mimeFromExt(ext: string): string;
|
|
25
25
|
export function getImageInfo(url: string): Promise<ImageInfo|null>;
|
|
26
|
+
export function propertiesToHTML(prop: object): string;
|
|
27
|
+
export function getCacheSize(name: string): Promise<number>;
|
|
26
28
|
|
|
27
29
|
declare class DialogButton
|
|
28
30
|
{
|
package/web.js
CHANGED
|
@@ -95,6 +95,18 @@ export function openData(data, contentType, fileName)
|
|
|
95
95
|
ele.setAttribute('download', fileName);
|
|
96
96
|
ele.style.display = 'none';
|
|
97
97
|
|
|
98
|
+
document.body.appendChild(ele);
|
|
99
|
+
ele.click();
|
|
100
|
+
document.body.removeChild(ele);
|
|
101
|
+
}
|
|
102
|
+
else if (data instanceof Blob)
|
|
103
|
+
{
|
|
104
|
+
let ele = document.createElement("a");
|
|
105
|
+
ele.setAttribute('href', URL.createObjectURL(data));
|
|
106
|
+
if (fileName)
|
|
107
|
+
ele.setAttribute('download', fileName);
|
|
108
|
+
ele.style.display = 'none';
|
|
109
|
+
|
|
98
110
|
document.body.appendChild(ele);
|
|
99
111
|
ele.click();
|
|
100
112
|
document.body.removeChild(ele);
|
|
@@ -709,6 +721,44 @@ export function getImageInfo(url)
|
|
|
709
721
|
});
|
|
710
722
|
}
|
|
711
723
|
|
|
724
|
+
export function propertiesToHTML(prop)
|
|
725
|
+
{
|
|
726
|
+
let ret = ["<ul>"];
|
|
727
|
+
let i;
|
|
728
|
+
for (i in prop)
|
|
729
|
+
{
|
|
730
|
+
ret.push("<li><b>"+text.toHTMLText(i)+": </b>");
|
|
731
|
+
if (typeof prop[i] == "object")
|
|
732
|
+
{
|
|
733
|
+
ret.push(propertiesToHTML(prop[i]));
|
|
734
|
+
}
|
|
735
|
+
else
|
|
736
|
+
{
|
|
737
|
+
ret.push(text.toHTMLText(""+prop[i]));
|
|
738
|
+
}
|
|
739
|
+
ret.push("</li>");
|
|
740
|
+
}
|
|
741
|
+
ret.push("</ul>");
|
|
742
|
+
return ret.join("");
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
export async function getCacheSize(name)
|
|
746
|
+
{
|
|
747
|
+
const cache = await caches.open(name);
|
|
748
|
+
const keys = await cache.keys();
|
|
749
|
+
let i;
|
|
750
|
+
let size = 0;
|
|
751
|
+
for (i in keys)
|
|
752
|
+
{
|
|
753
|
+
let resp = await cache.match(keys[i]);
|
|
754
|
+
if (resp)
|
|
755
|
+
{
|
|
756
|
+
size += (await resp.arrayBuffer()).byteLength;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return size;
|
|
760
|
+
}
|
|
761
|
+
|
|
712
762
|
export class Dialog
|
|
713
763
|
{
|
|
714
764
|
constructor(content, options)
|
|
@@ -739,10 +789,10 @@ export class Dialog
|
|
|
739
789
|
darkColor.style.display = "flex";
|
|
740
790
|
darkColor.style.alignItems = "center";
|
|
741
791
|
darkColor.style.justifyContent = "center";
|
|
742
|
-
if (document.body.children.length > 0)
|
|
743
|
-
document.body.insertBefore(darkColor, document.body.children[0]);
|
|
792
|
+
if (top.document.body.children.length > 0)
|
|
793
|
+
top.document.body.insertBefore(darkColor, top.document.body.children[0]);
|
|
744
794
|
else
|
|
745
|
-
document.body.appendChild(darkColor);
|
|
795
|
+
top.document.body.appendChild(darkColor);
|
|
746
796
|
this.darkColor = darkColor;
|
|
747
797
|
let dialog = document.createElement("div");
|
|
748
798
|
dialog.style.backgroundColor = "#ffffff";
|
|
@@ -818,7 +868,7 @@ export class Dialog
|
|
|
818
868
|
{
|
|
819
869
|
if (this.darkColor)
|
|
820
870
|
{
|
|
821
|
-
document.body.removeChild(this.darkColor);
|
|
871
|
+
top.document.body.removeChild(this.darkColor);
|
|
822
872
|
this.darkColor = null;
|
|
823
873
|
}
|
|
824
874
|
}
|