mol_view_tree2_lib 1.0.36 → 1.0.38
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/node.d.ts +2 -1
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +34 -5
- package/node.js.map +1 -1
- package/node.mjs +34 -5
- package/node.test.js +59 -10
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +2 -3
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +34 -12
- package/web.js.map +1 -1
- package/web.mjs +34 -12
- package/web.test.js +25 -5
- package/web.test.js.map +1 -1
package/web.mjs
CHANGED
|
@@ -199,7 +199,7 @@ var $;
|
|
|
199
199
|
if (this[$mol_ambient_ref])
|
|
200
200
|
return this[$mol_ambient_ref];
|
|
201
201
|
const owner = $mol_owning_get(this);
|
|
202
|
-
return this[$mol_ambient_ref] = owner?.$ || $mol_object2.$;
|
|
202
|
+
return this[$mol_ambient_ref] = owner?.$ || this.constructor.$ || $mol_object2.$;
|
|
203
203
|
}
|
|
204
204
|
set $(next) {
|
|
205
205
|
if (this[$mol_ambient_ref])
|
|
@@ -4083,23 +4083,45 @@ var $;
|
|
|
4083
4083
|
$.$mol_charset_decode = $mol_charset_decode;
|
|
4084
4084
|
})($ || ($ = {}));
|
|
4085
4085
|
|
|
4086
|
-
;
|
|
4087
|
-
"use strict";
|
|
4088
|
-
|
|
4089
|
-
;
|
|
4090
|
-
"use strict";
|
|
4091
|
-
var $node = $node || {};
|
|
4092
|
-
|
|
4093
4086
|
;
|
|
4094
4087
|
"use strict";
|
|
4095
4088
|
var $;
|
|
4096
4089
|
(function ($) {
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4090
|
+
let buf = new Uint8Array(2 ** 12);
|
|
4091
|
+
function $mol_charset_encode(str) {
|
|
4092
|
+
const capacity = str.length * 3;
|
|
4093
|
+
if (buf.byteLength < capacity)
|
|
4094
|
+
buf = new Uint8Array(capacity);
|
|
4095
|
+
return buf.slice(0, $mol_charset_encode_to(str, buf));
|
|
4101
4096
|
}
|
|
4102
4097
|
$.$mol_charset_encode = $mol_charset_encode;
|
|
4098
|
+
function $mol_charset_encode_to(str, buf, from = 0) {
|
|
4099
|
+
let pos = from;
|
|
4100
|
+
for (let i = 0; i < str.length; i++) {
|
|
4101
|
+
let code = str.charCodeAt(i);
|
|
4102
|
+
if (code < 0x80) {
|
|
4103
|
+
buf[pos++] = code;
|
|
4104
|
+
}
|
|
4105
|
+
else if (code < 0x800) {
|
|
4106
|
+
buf[pos++] = 0xc0 | (code >> 6);
|
|
4107
|
+
buf[pos++] = 0x80 | (code & 0x3f);
|
|
4108
|
+
}
|
|
4109
|
+
else if (code < 0xd800 || code >= 0xe000) {
|
|
4110
|
+
buf[pos++] = 0xe0 | (code >> 12);
|
|
4111
|
+
buf[pos++] = 0x80 | ((code >> 6) & 0x3f);
|
|
4112
|
+
buf[pos++] = 0x80 | (code & 0x3f);
|
|
4113
|
+
}
|
|
4114
|
+
else {
|
|
4115
|
+
const point = ((code - 0xd800) << 10) + str.charCodeAt(++i) + 0x2400;
|
|
4116
|
+
buf[pos++] = 0xf0 | (point >> 18);
|
|
4117
|
+
buf[pos++] = 0x80 | ((point >> 12) & 0x3f);
|
|
4118
|
+
buf[pos++] = 0x80 | ((point >> 6) & 0x3f);
|
|
4119
|
+
buf[pos++] = 0x80 | (point & 0x3f);
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
return pos - from;
|
|
4123
|
+
}
|
|
4124
|
+
$.$mol_charset_encode_to = $mol_charset_encode_to;
|
|
4103
4125
|
})($ || ($ = {}));
|
|
4104
4126
|
|
|
4105
4127
|
;
|
package/web.test.js
CHANGED
|
@@ -2341,7 +2341,7 @@ var $;
|
|
|
2341
2341
|
;
|
|
2342
2342
|
"use strict";
|
|
2343
2343
|
var $;
|
|
2344
|
-
(function ($) {
|
|
2344
|
+
(function ($_1) {
|
|
2345
2345
|
$mol_test({
|
|
2346
2346
|
'init with overload'() {
|
|
2347
2347
|
class X extends $mol_object {
|
|
@@ -2354,6 +2354,13 @@ var $;
|
|
|
2354
2354
|
});
|
|
2355
2355
|
$mol_assert_equal(x.foo(), 2);
|
|
2356
2356
|
},
|
|
2357
|
+
'Context in instance inherits from class'($) {
|
|
2358
|
+
const custom = $.$mol_ambient({});
|
|
2359
|
+
class X extends $.$mol_object {
|
|
2360
|
+
static $ = custom;
|
|
2361
|
+
}
|
|
2362
|
+
$mol_assert_equal(new X().$, custom);
|
|
2363
|
+
},
|
|
2357
2364
|
});
|
|
2358
2365
|
})($ || ($ = {}));
|
|
2359
2366
|
|
|
@@ -5987,10 +5994,23 @@ var $;
|
|
|
5987
5994
|
var $;
|
|
5988
5995
|
(function ($) {
|
|
5989
5996
|
$mol_test({
|
|
5990
|
-
'encode
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5997
|
+
'encode empty'() {
|
|
5998
|
+
$mol_assert_equal($mol_charset_encode(''), new Uint8Array([]));
|
|
5999
|
+
},
|
|
6000
|
+
'encode 1 octet'() {
|
|
6001
|
+
$mol_assert_equal($mol_charset_encode('F'), new Uint8Array([0x46]));
|
|
6002
|
+
},
|
|
6003
|
+
'encode 2 octet'() {
|
|
6004
|
+
$mol_assert_equal($mol_charset_encode('Б'), new Uint8Array([0xd0, 0x91]));
|
|
6005
|
+
},
|
|
6006
|
+
'encode 3 octet'() {
|
|
6007
|
+
$mol_assert_equal($mol_charset_encode('ह'), new Uint8Array([0xe0, 0xa4, 0xb9]));
|
|
6008
|
+
},
|
|
6009
|
+
'encode 4 octet'() {
|
|
6010
|
+
$mol_assert_equal($mol_charset_encode('𐍈'), new Uint8Array([0xf0, 0x90, 0x8d, 0x88]));
|
|
6011
|
+
},
|
|
6012
|
+
'encode surrogate pair'() {
|
|
6013
|
+
$mol_assert_equal($mol_charset_encode('😀'), new Uint8Array([0xf0, 0x9f, 0x98, 0x80]));
|
|
5994
6014
|
},
|
|
5995
6015
|
});
|
|
5996
6016
|
})($ || ($ = {}));
|