@dra2020/baseclient 1.0.12 → 1.0.13
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 +16 -15
- package/LICENSE +0 -21
- package/README.md +0 -26
- package/dist/all/all.d.ts +0 -20
- package/dist/baseclient.js +0 -10113
- package/dist/baseclient.js.map +0 -1
- package/dist/context/all.d.ts +0 -1
- package/dist/context/context.d.ts +0 -13
- package/dist/filterexpr/all.d.ts +0 -1
- package/dist/filterexpr/filterexpr.d.ts +0 -67
- package/dist/fsm/all.d.ts +0 -1
- package/dist/fsm/fsm.d.ts +0 -119
- package/dist/geo/all.d.ts +0 -2
- package/dist/geo/geo.d.ts +0 -67
- package/dist/geo/vfeature.d.ts +0 -4
- package/dist/logabstract/all.d.ts +0 -1
- package/dist/logabstract/log.d.ts +0 -26
- package/dist/logclient/all.d.ts +0 -1
- package/dist/logclient/log.d.ts +0 -6
- package/dist/ot-editutil/all.d.ts +0 -2
- package/dist/ot-editutil/oteditutil.d.ts +0 -14
- package/dist/ot-editutil/otmaputil.d.ts +0 -21
- package/dist/ot-js/all.d.ts +0 -9
- package/dist/ot-js/otarray.d.ts +0 -111
- package/dist/ot-js/otclientengine.d.ts +0 -38
- package/dist/ot-js/otcomposite.d.ts +0 -37
- package/dist/ot-js/otcounter.d.ts +0 -17
- package/dist/ot-js/otengine.d.ts +0 -22
- package/dist/ot-js/otmap.d.ts +0 -19
- package/dist/ot-js/otserverengine.d.ts +0 -38
- package/dist/ot-js/otsession.d.ts +0 -114
- package/dist/ot-js/ottypes.d.ts +0 -29
- package/dist/poly/all.d.ts +0 -15
- package/dist/poly/blend.d.ts +0 -1
- package/dist/poly/boundbox.d.ts +0 -16
- package/dist/poly/cartesian.d.ts +0 -5
- package/dist/poly/graham-scan.d.ts +0 -8
- package/dist/poly/hash.d.ts +0 -1
- package/dist/poly/matrix.d.ts +0 -24
- package/dist/poly/minbound.d.ts +0 -1
- package/dist/poly/poly.d.ts +0 -52
- package/dist/poly/polybin.d.ts +0 -5
- package/dist/poly/polylabel.d.ts +0 -7
- package/dist/poly/polypack.d.ts +0 -30
- package/dist/poly/polyround.d.ts +0 -1
- package/dist/poly/polysimplify.d.ts +0 -1
- package/dist/poly/quad.d.ts +0 -48
- package/dist/poly/selfintersect.d.ts +0 -1
- package/dist/poly/shamos.d.ts +0 -1
- package/dist/poly/simplify.d.ts +0 -2
- package/dist/poly/topo.d.ts +0 -46
- package/dist/poly/union.d.ts +0 -49
- package/dist/util/all.d.ts +0 -5
- package/dist/util/bintrie.d.ts +0 -93
- package/dist/util/countedhash.d.ts +0 -19
- package/dist/util/gradient.d.ts +0 -15
- package/dist/util/indexedarray.d.ts +0 -15
- package/dist/util/util.d.ts +0 -68
- package/docs/context.md +0 -2
- package/docs/filterexpr.md +0 -22
- package/docs/fsm.md +0 -243
- package/docs/logabstract.md +0 -2
- package/docs/logclient.md +0 -2
- package/docs/ot-editutil.md +0 -2
- package/docs/ot-js.md +0 -95
- package/docs/poly.md +0 -103
- package/docs/util.md +0 -2
- package/lib/all/all.ts +0 -21
- package/lib/context/all.ts +0 -1
- package/lib/context/context.ts +0 -82
- package/lib/filterexpr/all.ts +0 -1
- package/lib/filterexpr/filterexpr.ts +0 -699
- package/lib/fsm/all.ts +0 -1
- package/lib/fsm/fsm.ts +0 -559
- package/lib/geo/all.ts +0 -2
- package/lib/geo/geo.ts +0 -452
- package/lib/geo/vfeature.ts +0 -34
- package/lib/logabstract/all.ts +0 -1
- package/lib/logabstract/log.ts +0 -55
- package/lib/logclient/all.ts +0 -1
- package/lib/logclient/log.ts +0 -105
- package/lib/ot-editutil/all.ts +0 -2
- package/lib/ot-editutil/oteditutil.ts +0 -180
- package/lib/ot-editutil/otmaputil.ts +0 -209
- package/lib/ot-js/all.ts +0 -9
- package/lib/ot-js/otarray.ts +0 -1168
- package/lib/ot-js/otclientengine.ts +0 -327
- package/lib/ot-js/otcomposite.ts +0 -247
- package/lib/ot-js/otcounter.ts +0 -145
- package/lib/ot-js/otengine.ts +0 -71
- package/lib/ot-js/otmap.ts +0 -144
- package/lib/ot-js/otserverengine.ts +0 -329
- package/lib/ot-js/otsession.ts +0 -202
- package/lib/ot-js/ottypes.ts +0 -98
- package/lib/poly/all.ts +0 -15
- package/lib/poly/blend.ts +0 -27
- package/lib/poly/boundbox.ts +0 -102
- package/lib/poly/cartesian.ts +0 -130
- package/lib/poly/graham-scan.ts +0 -401
- package/lib/poly/hash.ts +0 -15
- package/lib/poly/matrix.ts +0 -309
- package/lib/poly/minbound.ts +0 -211
- package/lib/poly/poly.ts +0 -767
- package/lib/poly/polybin.ts +0 -218
- package/lib/poly/polylabel.ts +0 -204
- package/lib/poly/polypack.ts +0 -468
- package/lib/poly/polyround.ts +0 -30
- package/lib/poly/polysimplify.ts +0 -24
- package/lib/poly/quad.ts +0 -272
- package/lib/poly/selfintersect.ts +0 -87
- package/lib/poly/shamos.ts +0 -297
- package/lib/poly/simplify.ts +0 -119
- package/lib/poly/topo.ts +0 -499
- package/lib/poly/union.ts +0 -388
- package/lib/util/all.ts +0 -5
- package/lib/util/bintrie.ts +0 -603
- package/lib/util/countedhash.ts +0 -83
- package/lib/util/gradient.ts +0 -108
- package/lib/util/indexedarray.ts +0 -80
- package/lib/util/util.ts +0 -695
package/lib/util/gradient.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
interface RGB
|
|
2
|
-
{
|
|
3
|
-
r: number,
|
|
4
|
-
g: number,
|
|
5
|
-
b: number,
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface Stop
|
|
9
|
-
{
|
|
10
|
-
color: string,
|
|
11
|
-
stop: number,
|
|
12
|
-
rgb?: RGB;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type GradientStops = Stop[];
|
|
16
|
-
|
|
17
|
-
function parseStops(stops: GradientStops): void
|
|
18
|
-
{
|
|
19
|
-
if (stops[0].rgb) return;
|
|
20
|
-
|
|
21
|
-
stops.forEach((s) => {
|
|
22
|
-
if (s.rgb === undefined)
|
|
23
|
-
{
|
|
24
|
-
let r = parseInt(s.color.substr(1, 2), 16);
|
|
25
|
-
let g = parseInt(s.color.substr(3, 2), 16);
|
|
26
|
-
let b = parseInt(s.color.substr(5, 2), 16);
|
|
27
|
-
s.rgb = { r: r, g: g, b: b };
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
stops.sort();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function asHex(v: number): string
|
|
34
|
-
{
|
|
35
|
-
return v.toString(16).padStart(2, '0');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function toHexColor(r: number, g: number, b: number): string
|
|
39
|
-
{
|
|
40
|
-
return `#${asHex(r)}${asHex(g)}${asHex(b)}`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function execGradient(stops: GradientStops, value: number): string
|
|
44
|
-
{
|
|
45
|
-
parseStops(stops);
|
|
46
|
-
let r = stops[stops.length-1].rgb.r;
|
|
47
|
-
let g = stops[stops.length-1].rgb.g;
|
|
48
|
-
let b = stops[stops.length-1].rgb.b;
|
|
49
|
-
for (let i = 1; i < stops.length; i++)
|
|
50
|
-
{
|
|
51
|
-
let e = stops[i];
|
|
52
|
-
if (value < e.stop)
|
|
53
|
-
{
|
|
54
|
-
let s = stops[i-1];
|
|
55
|
-
r = s.rgb.r + Math.floor(((e.rgb.r - s.rgb.r) * (value - s.stop) / (e.stop - s.stop)));
|
|
56
|
-
g = s.rgb.g + Math.floor(((e.rgb.g - s.rgb.g) * (value - s.stop) / (e.stop - s.stop)));
|
|
57
|
-
b = s.rgb.b + Math.floor(((e.rgb.b - s.rgb.b) * (value - s.stop) / (e.stop - s.stop)));
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return toHexColor(r, g, b);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function parseGradient(sStops: string): GradientStops
|
|
65
|
-
{
|
|
66
|
-
let stops: GradientStops = [];
|
|
67
|
-
let re = / ?([^ ]+) ([^ ,]+%?),?(.*)/;
|
|
68
|
-
|
|
69
|
-
if (sStops == null || sStops == '' ) return stops;
|
|
70
|
-
|
|
71
|
-
// Strip off leading CSS form if present
|
|
72
|
-
if (sStops.indexOf('linear-gradient') == 0)
|
|
73
|
-
{
|
|
74
|
-
let rePre = /^[^,]*, (.*)\)$/;
|
|
75
|
-
let a = rePre.exec(sStops);
|
|
76
|
-
if (a)
|
|
77
|
-
sStops = a[1];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
while (sStops && sStops != '')
|
|
81
|
-
{
|
|
82
|
-
let a = re.exec(sStops);
|
|
83
|
-
if (a == null)
|
|
84
|
-
break;
|
|
85
|
-
let stop = a[2];
|
|
86
|
-
sStops = a[3];
|
|
87
|
-
if (a[2].indexOf('%') >= 0)
|
|
88
|
-
{
|
|
89
|
-
stop = stop.substr(0, stop.length-1);
|
|
90
|
-
stop = String(Number(stop) * 0.01);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
stops.push({ color: a[1], stop: Number(stop) });
|
|
94
|
-
}
|
|
95
|
-
return stops;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function asCSSGradient(stops: GradientStops): string
|
|
99
|
-
{
|
|
100
|
-
parseStops(stops);
|
|
101
|
-
|
|
102
|
-
let a: string[] = [];
|
|
103
|
-
stops.forEach((s) => {
|
|
104
|
-
let stop = s.stop >= 0.0 && s.stop <= 1.0 ? `${Math.round(s.stop*100)}%` : String(s.stop);
|
|
105
|
-
a.push(`${toHexColor(s.rgb.r, s.rgb.g, s.rgb.b)} ${stop}`);
|
|
106
|
-
});
|
|
107
|
-
return `linear-gradient(to right, ${a.join(', ')})`;
|
|
108
|
-
}
|
package/lib/util/indexedarray.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
export class IndexedArray
|
|
2
|
-
{
|
|
3
|
-
o: any;
|
|
4
|
-
a: any[];
|
|
5
|
-
|
|
6
|
-
constructor()
|
|
7
|
-
{
|
|
8
|
-
this.o = {};
|
|
9
|
-
this.a = null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
ensure(): void
|
|
13
|
-
{
|
|
14
|
-
if (this.a === null)
|
|
15
|
-
{
|
|
16
|
-
this.a = [];
|
|
17
|
-
for (let p in this.o) if (this.o.hasOwnProperty(p))
|
|
18
|
-
this.a.push(p);
|
|
19
|
-
this.a.sort((a: string, b: string) => { a = a.toUpperCase(); b = b.toUpperCase(); return a < b ? -1 : (a > b ? 1 : 0); });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
asArray(): any[]
|
|
24
|
-
{
|
|
25
|
-
this.ensure();
|
|
26
|
-
return this.a;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get length(): number { this.ensure(); return this.a.length; }
|
|
30
|
-
|
|
31
|
-
test(s: string): boolean
|
|
32
|
-
{
|
|
33
|
-
return !!s && this.o[s] !== undefined;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
set(s: string): void
|
|
37
|
-
{
|
|
38
|
-
if (!!s && !this.test(s))
|
|
39
|
-
{
|
|
40
|
-
this.o[s] = true;
|
|
41
|
-
this.a = null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
setAll(a: string[]): void
|
|
46
|
-
{
|
|
47
|
-
if (a && a.length)
|
|
48
|
-
for (let i: number = 0; i < a.length; i++)
|
|
49
|
-
this.set(a[i]);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
clear(s: string): void
|
|
53
|
-
{
|
|
54
|
-
if (this.test(s))
|
|
55
|
-
{
|
|
56
|
-
delete this.o[s];
|
|
57
|
-
this.a = null;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
at(i: number): string
|
|
62
|
-
{
|
|
63
|
-
this.ensure();
|
|
64
|
-
if (i < 0 || i >= this.a.length)
|
|
65
|
-
return undefined;
|
|
66
|
-
return this.a[i];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
empty(): void
|
|
70
|
-
{
|
|
71
|
-
this.o = {};
|
|
72
|
-
this.a = null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
forEach(f: (s: string) => void): void
|
|
76
|
-
{
|
|
77
|
-
for (var s in this.o) if (this.o.hasOwnProperty(s))
|
|
78
|
-
f(s);
|
|
79
|
-
}
|
|
80
|
-
}
|