mol_jsx_lib 0.0.61 → 0.0.64

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
@@ -153,7 +153,7 @@ var $;
153
153
  function $mol_jsx(Elem, props, ...childNodes) {
154
154
  const id = props && props.id || '';
155
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;
156
+ const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
157
157
  if (Elem && $.$mol_jsx_booked) {
158
158
  if ($.$mol_jsx_booked.has(id)) {
159
159
  $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
@@ -229,7 +229,11 @@ var $;
229
229
  $mol_dom_render_children(node, [].concat(...childNodes));
230
230
  if (!Elem)
231
231
  return node;
232
+ if (guid)
233
+ node.id = guid;
232
234
  for (const key in props) {
235
+ if (key === 'id')
236
+ continue;
233
237
  if (typeof props[key] === 'string') {
234
238
  ;
235
239
  node.setAttribute(key, props[key]);
@@ -246,8 +250,6 @@ var $;
246
250
  node[key] = props[key];
247
251
  }
248
252
  }
249
- if (guid)
250
- node.id = guid;
251
253
  if ($.$mol_jsx_crumbs)
252
254
  node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
253
255
  return node;
@@ -527,6 +529,19 @@ var $;
527
529
  ;
528
530
  "use strict";
529
531
  var $;
532
+ (function ($) {
533
+ function $mol_const(value) {
534
+ var getter = (() => value);
535
+ getter['()'] = value;
536
+ getter[Symbol.toStringTag] = value;
537
+ return getter;
538
+ }
539
+ $.$mol_const = $mol_const;
540
+ })($ || ($ = {}));
541
+ //mol/const/const.ts
542
+ ;
543
+ "use strict";
544
+ var $;
530
545
  (function ($) {
531
546
  $['devtoolsFormatters'] = $['devtoolsFormatters'] || [];
532
547
  function $mol_dev_format_register(config) {
@@ -1361,6 +1376,40 @@ var $;
1361
1376
  ;
1362
1377
  "use strict";
1363
1378
  var $;
1379
+ (function ($) {
1380
+ function $mol_wire_field(host, field, descr) {
1381
+ if (!descr)
1382
+ descr = Reflect.getOwnPropertyDescriptor(host, field);
1383
+ const _get = descr?.get || $mol_const(descr?.value);
1384
+ const persist = $mol_wire_atom.getter(_get, 0);
1385
+ const _set = descr?.set || function (next) {
1386
+ persist(this, []).put(next);
1387
+ };
1388
+ const sup = Reflect.getPrototypeOf(host);
1389
+ const sup_descr = Reflect.getOwnPropertyDescriptor(sup, field);
1390
+ Object.defineProperty(_get, 'name', { value: sup_descr?.get?.name ?? field });
1391
+ Object.defineProperty(_set, 'name', { value: sup_descr?.set?.name ?? field });
1392
+ function get() {
1393
+ return persist(this, []).sync();
1394
+ }
1395
+ const temp = $mol_wire_task.getter(_set);
1396
+ function set(next) {
1397
+ temp(this, [next]).sync();
1398
+ }
1399
+ Object.defineProperty(get, 'name', { value: _get.name + '$' });
1400
+ Object.defineProperty(set, 'name', { value: _set.name + '@' });
1401
+ Object.assign(get, { orig: _get });
1402
+ Object.assign(set, { orig: _set });
1403
+ const { value, writable, ...descr2 } = { ...descr, get, set };
1404
+ Reflect.defineProperty(host, field, descr2);
1405
+ return descr2;
1406
+ }
1407
+ $.$mol_wire_field = $mol_wire_field;
1408
+ })($ || ($ = {}));
1409
+ //mol/wire/field/field.ts
1410
+ ;
1411
+ "use strict";
1412
+ var $;
1364
1413
  (function ($) {
1365
1414
  function $mol_wire_mem(keys) {
1366
1415
  const wrap = $mol_wire_mem_func(keys);
@@ -1428,12 +1477,8 @@ var $;
1428
1477
  ownerDocument;
1429
1478
  className;
1430
1479
  get childNodes() {
1431
- return this._kids();
1432
- }
1433
- set childNodes(next) {
1434
- this._kids(next);
1480
+ return [];
1435
1481
  }
1436
- _kids(next = []) { return next; }
1437
1482
  valueOf() {
1438
1483
  const prefix = $mol_jsx_prefix;
1439
1484
  const booked = $mol_jsx_booked;
@@ -1453,13 +1498,10 @@ var $;
1453
1498
  $mol_jsx_document = document;
1454
1499
  }
1455
1500
  }
1456
- render() {
1457
- return $mol_fail(new Error(`render() isn't implemented`));
1458
- }
1459
1501
  }
1460
1502
  __decorate([
1461
- $mol_mem
1462
- ], $mol_jsx_view.prototype, "_kids", null);
1503
+ $mol_wire_field
1504
+ ], $mol_jsx_view.prototype, "childNodes", null);
1463
1505
  __decorate([
1464
1506
  $mol_mem
1465
1507
  ], $mol_jsx_view.prototype, "valueOf", null);
@@ -1569,53 +1611,6 @@ var $;
1569
1611
  ;
1570
1612
  "use strict";
1571
1613
  var $;
1572
- (function ($) {
1573
- function $mol_const(value) {
1574
- var getter = (() => value);
1575
- getter['()'] = value;
1576
- getter[Symbol.toStringTag] = value;
1577
- return getter;
1578
- }
1579
- $.$mol_const = $mol_const;
1580
- })($ || ($ = {}));
1581
- //mol/const/const.ts
1582
- ;
1583
- "use strict";
1584
- var $;
1585
- (function ($) {
1586
- function $mol_wire_field(host, field, descr) {
1587
- if (!descr)
1588
- descr = Reflect.getOwnPropertyDescriptor(host, field);
1589
- const _get = descr?.get || $mol_const(descr?.value);
1590
- const persist = $mol_wire_atom.getter(_get, 0);
1591
- const _set = descr?.set || function (next) {
1592
- persist(this, []).put(next);
1593
- };
1594
- const sup = Reflect.getPrototypeOf(host);
1595
- const sup_descr = Reflect.getOwnPropertyDescriptor(sup, field);
1596
- Object.defineProperty(_get, 'name', { value: sup_descr?.get?.name ?? field });
1597
- Object.defineProperty(_set, 'name', { value: sup_descr?.set?.name ?? field });
1598
- function get() {
1599
- return persist(this, []).sync();
1600
- }
1601
- const temp = $mol_wire_task.getter(_set);
1602
- function set(next) {
1603
- temp(this, [next]).sync();
1604
- }
1605
- Object.defineProperty(get, 'name', { value: _get.name + '$' });
1606
- Object.defineProperty(set, 'name', { value: _set.name + '@' });
1607
- Object.assign(get, { orig: _get });
1608
- Object.assign(set, { orig: _set });
1609
- const { value, writable, ...descr2 } = { ...descr, get, set };
1610
- Reflect.defineProperty(host, field, descr2);
1611
- return descr2;
1612
- }
1613
- $.$mol_wire_field = $mol_wire_field;
1614
- })($ || ($ = {}));
1615
- //mol/wire/field/field.ts
1616
- ;
1617
- "use strict";
1618
- var $;
1619
1614
  (function ($) {
1620
1615
  function $mol_wire_patch(obj) {
1621
1616
  for (const field of Reflect.ownKeys(obj)) {