mol_plot_all 1.2.258 → 1.2.259
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.test.js +86 -26
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.test.js +86 -26
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -6085,28 +6085,52 @@ var $;
|
|
|
6085
6085
|
const Button = (props, target) => {
|
|
6086
6086
|
return $mol_jsx("button", { title: props.hint }, target());
|
|
6087
6087
|
};
|
|
6088
|
-
const dom = $mol_jsx(Button, { id: "
|
|
6089
|
-
$mol_assert_equal(dom.outerHTML, '<button title="click me" id="
|
|
6088
|
+
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
6089
|
+
$mol_assert_equal(dom.outerHTML, '<button title="click me" id="foo" class="Button">hey!</button>');
|
|
6090
6090
|
},
|
|
6091
6091
|
'Nested guid generation'() {
|
|
6092
6092
|
const Foo = () => {
|
|
6093
6093
|
return $mol_jsx("div", null,
|
|
6094
|
-
$mol_jsx(Bar, { id: "
|
|
6095
|
-
$mol_jsx("img", { id: "
|
|
6094
|
+
$mol_jsx(Bar, { id: "bar" },
|
|
6095
|
+
$mol_jsx("img", { id: "icon" })));
|
|
6096
6096
|
};
|
|
6097
6097
|
const Bar = (props, icon) => {
|
|
6098
|
-
return $mol_jsx("span", null,
|
|
6098
|
+
return $mol_jsx("span", null,
|
|
6099
|
+
icon,
|
|
6100
|
+
$mol_jsx("i", { id: "label" }));
|
|
6099
6101
|
};
|
|
6100
|
-
const dom = $mol_jsx(Foo, { id: "
|
|
6101
|
-
$mol_assert_equal(dom.outerHTML, '<div id="
|
|
6102
|
+
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
6103
|
+
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
6102
6104
|
},
|
|
6103
6105
|
'Fail on non unique ids'() {
|
|
6104
6106
|
const App = () => {
|
|
6105
6107
|
return $mol_jsx("div", null,
|
|
6106
|
-
$mol_jsx("span", { id: "
|
|
6107
|
-
$mol_jsx("span", { id: "
|
|
6108
|
+
$mol_jsx("span", { id: "bar" }),
|
|
6109
|
+
$mol_jsx("span", { id: "bar" }));
|
|
6108
6110
|
};
|
|
6109
|
-
$mol_assert_fail(() => $mol_jsx(App, { id: "
|
|
6111
|
+
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
6112
|
+
},
|
|
6113
|
+
'Owner based guid generationn'() {
|
|
6114
|
+
const Foo = () => {
|
|
6115
|
+
return $mol_jsx("div", null,
|
|
6116
|
+
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
6117
|
+
};
|
|
6118
|
+
const Bar = (props) => {
|
|
6119
|
+
return $mol_jsx("span", null, props.icon());
|
|
6120
|
+
};
|
|
6121
|
+
const dom = $mol_jsx(Foo, { id: "app" });
|
|
6122
|
+
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
6123
|
+
},
|
|
6124
|
+
'Fail on same ids from different caller'() {
|
|
6125
|
+
const Foo = () => {
|
|
6126
|
+
return $mol_jsx("div", null,
|
|
6127
|
+
$mol_jsx("img", { id: "icon" }),
|
|
6128
|
+
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
6129
|
+
};
|
|
6130
|
+
const Bar = (props) => {
|
|
6131
|
+
return $mol_jsx("span", null, props.icon());
|
|
6132
|
+
};
|
|
6133
|
+
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
6110
6134
|
},
|
|
6111
6135
|
});
|
|
6112
6136
|
})($ || ($ = {}));
|
|
@@ -6116,6 +6140,7 @@ var $;
|
|
|
6116
6140
|
var $;
|
|
6117
6141
|
(function ($) {
|
|
6118
6142
|
$.$mol_jsx_prefix = '';
|
|
6143
|
+
$.$mol_jsx_crumbs = '';
|
|
6119
6144
|
$.$mol_jsx_booked = null;
|
|
6120
6145
|
$.$mol_jsx_document = {
|
|
6121
6146
|
getElementById: () => null,
|
|
@@ -6125,16 +6150,45 @@ var $;
|
|
|
6125
6150
|
$.$mol_jsx_frag = '';
|
|
6126
6151
|
function $mol_jsx(Elem, props, ...childNodes) {
|
|
6127
6152
|
const id = props && props.id || '';
|
|
6153
|
+
const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
|
|
6154
|
+
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id}`) : $.$mol_jsx_crumbs;
|
|
6128
6155
|
if (Elem && $.$mol_jsx_booked) {
|
|
6129
6156
|
if ($.$mol_jsx_booked.has(id)) {
|
|
6130
|
-
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(
|
|
6157
|
+
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
6131
6158
|
}
|
|
6132
6159
|
else {
|
|
6133
6160
|
$.$mol_jsx_booked.add(id);
|
|
6134
6161
|
}
|
|
6135
6162
|
}
|
|
6136
|
-
const guid = $.$mol_jsx_prefix + id;
|
|
6137
6163
|
let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
|
|
6164
|
+
if ($.$mol_jsx_prefix) {
|
|
6165
|
+
const prefix_ext = $.$mol_jsx_prefix;
|
|
6166
|
+
const booked_ext = $.$mol_jsx_booked;
|
|
6167
|
+
const crumbs_ext = $.$mol_jsx_crumbs;
|
|
6168
|
+
for (const field in props) {
|
|
6169
|
+
const func = props[field];
|
|
6170
|
+
if (typeof func !== 'function')
|
|
6171
|
+
continue;
|
|
6172
|
+
const wrapper = function (...args) {
|
|
6173
|
+
const prefix = $.$mol_jsx_prefix;
|
|
6174
|
+
const booked = $.$mol_jsx_booked;
|
|
6175
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
6176
|
+
try {
|
|
6177
|
+
$.$mol_jsx_prefix = prefix_ext;
|
|
6178
|
+
$.$mol_jsx_booked = booked_ext;
|
|
6179
|
+
$.$mol_jsx_crumbs = crumbs_ext;
|
|
6180
|
+
return func.call(this, ...args);
|
|
6181
|
+
}
|
|
6182
|
+
finally {
|
|
6183
|
+
$.$mol_jsx_prefix = prefix;
|
|
6184
|
+
$.$mol_jsx_booked = booked;
|
|
6185
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
6186
|
+
}
|
|
6187
|
+
};
|
|
6188
|
+
$mol_func_name_from(wrapper, func);
|
|
6189
|
+
props[field] = wrapper;
|
|
6190
|
+
}
|
|
6191
|
+
}
|
|
6138
6192
|
if (typeof Elem !== 'string') {
|
|
6139
6193
|
if ('prototype' in Elem) {
|
|
6140
6194
|
const view = node && node[Elem] || new Elem;
|
|
@@ -6143,6 +6197,7 @@ var $;
|
|
|
6143
6197
|
view.childNodes = childNodes;
|
|
6144
6198
|
if (!view.ownerDocument)
|
|
6145
6199
|
view.ownerDocument = $.$mol_jsx_document;
|
|
6200
|
+
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
6146
6201
|
node = view.valueOf();
|
|
6147
6202
|
node[Elem] = view;
|
|
6148
6203
|
return node;
|
|
@@ -6150,14 +6205,17 @@ var $;
|
|
|
6150
6205
|
else {
|
|
6151
6206
|
const prefix = $.$mol_jsx_prefix;
|
|
6152
6207
|
const booked = $.$mol_jsx_booked;
|
|
6208
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
6153
6209
|
try {
|
|
6154
6210
|
$.$mol_jsx_prefix = guid;
|
|
6155
6211
|
$.$mol_jsx_booked = new Set;
|
|
6212
|
+
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
6156
6213
|
return Elem(props, ...childNodes);
|
|
6157
6214
|
}
|
|
6158
6215
|
finally {
|
|
6159
6216
|
$.$mol_jsx_prefix = prefix;
|
|
6160
6217
|
$.$mol_jsx_booked = booked;
|
|
6218
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
6161
6219
|
}
|
|
6162
6220
|
}
|
|
6163
6221
|
}
|
|
@@ -6188,6 +6246,8 @@ var $;
|
|
|
6188
6246
|
}
|
|
6189
6247
|
if (guid)
|
|
6190
6248
|
node.id = guid;
|
|
6249
|
+
if ($.$mol_jsx_crumbs)
|
|
6250
|
+
node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
|
|
6191
6251
|
return node;
|
|
6192
6252
|
}
|
|
6193
6253
|
$.$mol_jsx = $mol_jsx;
|
|
@@ -6428,6 +6488,20 @@ var $;
|
|
|
6428
6488
|
;
|
|
6429
6489
|
"use strict";
|
|
6430
6490
|
var $;
|
|
6491
|
+
(function ($_1) {
|
|
6492
|
+
$mol_test({
|
|
6493
|
+
'FQN of anon function'($) {
|
|
6494
|
+
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
6495
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
6496
|
+
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
6497
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
6498
|
+
},
|
|
6499
|
+
});
|
|
6500
|
+
})($ || ($ = {}));
|
|
6501
|
+
//mol/func/name/name.test.ts
|
|
6502
|
+
;
|
|
6503
|
+
"use strict";
|
|
6504
|
+
var $;
|
|
6431
6505
|
(function ($) {
|
|
6432
6506
|
$mol_test({
|
|
6433
6507
|
'get'() {
|
|
@@ -7725,20 +7799,6 @@ var $;
|
|
|
7725
7799
|
//mol/const/const.test.ts
|
|
7726
7800
|
;
|
|
7727
7801
|
"use strict";
|
|
7728
|
-
var $;
|
|
7729
|
-
(function ($_1) {
|
|
7730
|
-
$mol_test({
|
|
7731
|
-
'FQN of anon function'($) {
|
|
7732
|
-
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
7733
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
7734
|
-
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
7735
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
7736
|
-
},
|
|
7737
|
-
});
|
|
7738
|
-
})($ || ($ = {}));
|
|
7739
|
-
//mol/func/name/name.test.ts
|
|
7740
|
-
;
|
|
7741
|
-
"use strict";
|
|
7742
7802
|
//mol/type/keys/extract/extract.test.ts
|
|
7743
7803
|
;
|
|
7744
7804
|
"use strict";
|