mol_jsx_lib 0.0.57 → 0.0.60

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/web.js CHANGED
@@ -142,6 +142,7 @@ var $;
142
142
  var $;
143
143
  (function ($) {
144
144
  $.$mol_jsx_prefix = '';
145
+ $.$mol_jsx_crumbs = '';
145
146
  $.$mol_jsx_booked = null;
146
147
  $.$mol_jsx_document = {
147
148
  getElementById: () => null,
@@ -151,7 +152,8 @@ var $;
151
152
  $.$mol_jsx_frag = '';
152
153
  function $mol_jsx(Elem, props, ...childNodes) {
153
154
  const id = props && props.id || '';
154
- const guid = $.$mol_jsx_prefix + id;
155
+ const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
156
+ const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id}`) : $.$mol_jsx_crumbs;
155
157
  if (Elem && $.$mol_jsx_booked) {
156
158
  if ($.$mol_jsx_booked.has(id)) {
157
159
  $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
@@ -164,6 +166,7 @@ var $;
164
166
  if ($.$mol_jsx_prefix) {
165
167
  const prefix_ext = $.$mol_jsx_prefix;
166
168
  const booked_ext = $.$mol_jsx_booked;
169
+ const crumbs_ext = $.$mol_jsx_crumbs;
167
170
  for (const field in props) {
168
171
  const func = props[field];
169
172
  if (typeof func !== 'function')
@@ -171,14 +174,17 @@ var $;
171
174
  const wrapper = function (...args) {
172
175
  const prefix = $.$mol_jsx_prefix;
173
176
  const booked = $.$mol_jsx_booked;
177
+ const crumbs = $.$mol_jsx_crumbs;
174
178
  try {
175
179
  $.$mol_jsx_prefix = prefix_ext;
176
180
  $.$mol_jsx_booked = booked_ext;
181
+ $.$mol_jsx_crumbs = crumbs_ext;
177
182
  return func.call(this, ...args);
178
183
  }
179
184
  finally {
180
185
  $.$mol_jsx_prefix = prefix;
181
186
  $.$mol_jsx_booked = booked;
187
+ $.$mol_jsx_crumbs = crumbs;
182
188
  }
183
189
  };
184
190
  $mol_func_name_from(wrapper, func);
@@ -193,6 +199,7 @@ var $;
193
199
  view.childNodes = childNodes;
194
200
  if (!view.ownerDocument)
195
201
  view.ownerDocument = $.$mol_jsx_document;
202
+ view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
196
203
  node = view.valueOf();
197
204
  node[Elem] = view;
198
205
  return node;
@@ -200,14 +207,17 @@ var $;
200
207
  else {
201
208
  const prefix = $.$mol_jsx_prefix;
202
209
  const booked = $.$mol_jsx_booked;
210
+ const crumbs = $.$mol_jsx_crumbs;
203
211
  try {
204
212
  $.$mol_jsx_prefix = guid;
205
213
  $.$mol_jsx_booked = new Set;
214
+ $.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
206
215
  return Elem(props, ...childNodes);
207
216
  }
208
217
  finally {
209
218
  $.$mol_jsx_prefix = prefix;
210
219
  $.$mol_jsx_booked = booked;
220
+ $.$mol_jsx_crumbs = crumbs;
211
221
  }
212
222
  }
213
223
  }
@@ -238,6 +248,8 @@ var $;
238
248
  }
239
249
  if (guid)
240
250
  node.id = guid;
251
+ if ($.$mol_jsx_crumbs)
252
+ node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
241
253
  return node;
242
254
  }
243
255
  $.$mol_jsx = $mol_jsx;
@@ -1414,6 +1426,7 @@ var $;
1414
1426
  }
1415
1427
  attributes;
1416
1428
  ownerDocument;
1429
+ className;
1417
1430
  get childNodes() {
1418
1431
  return this._kids();
1419
1432
  }
@@ -1424,16 +1437,19 @@ var $;
1424
1437
  valueOf() {
1425
1438
  const prefix = $mol_jsx_prefix;
1426
1439
  const booked = $mol_jsx_booked;
1440
+ const crumbs = $mol_jsx_crumbs;
1427
1441
  const document = $mol_jsx_document;
1428
1442
  try {
1429
1443
  $mol_jsx_prefix = this[Symbol.toStringTag];
1430
1444
  $mol_jsx_booked = new Set;
1445
+ $mol_jsx_crumbs = this.className;
1431
1446
  $mol_jsx_document = this.ownerDocument;
1432
1447
  return this.render();
1433
1448
  }
1434
1449
  finally {
1435
1450
  $mol_jsx_prefix = prefix;
1436
1451
  $mol_jsx_booked = booked;
1452
+ $mol_jsx_crumbs = crumbs;
1437
1453
  $mol_jsx_document = document;
1438
1454
  }
1439
1455
  }