mol_jsx_lib 0.0.63 → 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/node.test.js CHANGED
@@ -1036,6 +1036,19 @@ var $;
1036
1036
  ;
1037
1037
  "use strict";
1038
1038
  var $;
1039
+ (function ($) {
1040
+ function $mol_const(value) {
1041
+ var getter = (() => value);
1042
+ getter['()'] = value;
1043
+ getter[Symbol.toStringTag] = value;
1044
+ return getter;
1045
+ }
1046
+ $.$mol_const = $mol_const;
1047
+ })($ || ($ = {}));
1048
+ //mol/const/const.ts
1049
+ ;
1050
+ "use strict";
1051
+ var $;
1039
1052
  (function ($) {
1040
1053
  $['devtoolsFormatters'] = $['devtoolsFormatters'] || [];
1041
1054
  function $mol_dev_format_register(config) {
@@ -1864,6 +1877,40 @@ var $;
1864
1877
  ;
1865
1878
  "use strict";
1866
1879
  var $;
1880
+ (function ($) {
1881
+ function $mol_wire_field(host, field, descr) {
1882
+ if (!descr)
1883
+ descr = Reflect.getOwnPropertyDescriptor(host, field);
1884
+ const _get = descr?.get || $mol_const(descr?.value);
1885
+ const persist = $mol_wire_atom.getter(_get, 0);
1886
+ const _set = descr?.set || function (next) {
1887
+ persist(this, []).put(next);
1888
+ };
1889
+ const sup = Reflect.getPrototypeOf(host);
1890
+ const sup_descr = Reflect.getOwnPropertyDescriptor(sup, field);
1891
+ Object.defineProperty(_get, 'name', { value: sup_descr?.get?.name ?? field });
1892
+ Object.defineProperty(_set, 'name', { value: sup_descr?.set?.name ?? field });
1893
+ function get() {
1894
+ return persist(this, []).sync();
1895
+ }
1896
+ const temp = $mol_wire_task.getter(_set);
1897
+ function set(next) {
1898
+ temp(this, [next]).sync();
1899
+ }
1900
+ Object.defineProperty(get, 'name', { value: _get.name + '$' });
1901
+ Object.defineProperty(set, 'name', { value: _set.name + '@' });
1902
+ Object.assign(get, { orig: _get });
1903
+ Object.assign(set, { orig: _set });
1904
+ const { value, writable, ...descr2 } = { ...descr, get, set };
1905
+ Reflect.defineProperty(host, field, descr2);
1906
+ return descr2;
1907
+ }
1908
+ $.$mol_wire_field = $mol_wire_field;
1909
+ })($ || ($ = {}));
1910
+ //mol/wire/field/field.ts
1911
+ ;
1912
+ "use strict";
1913
+ var $;
1867
1914
  (function ($) {
1868
1915
  function $mol_wire_mem(keys) {
1869
1916
  const wrap = $mol_wire_mem_func(keys);
@@ -1931,12 +1978,8 @@ var $;
1931
1978
  ownerDocument;
1932
1979
  className;
1933
1980
  get childNodes() {
1934
- return this._kids();
1935
- }
1936
- set childNodes(next) {
1937
- this._kids(next);
1981
+ return [];
1938
1982
  }
1939
- _kids(next = []) { return next; }
1940
1983
  valueOf() {
1941
1984
  const prefix = $mol_jsx_prefix;
1942
1985
  const booked = $mol_jsx_booked;
@@ -1956,13 +1999,10 @@ var $;
1956
1999
  $mol_jsx_document = document;
1957
2000
  }
1958
2001
  }
1959
- render() {
1960
- return $mol_fail(new Error(`render() isn't implemented`));
1961
- }
1962
2002
  }
1963
2003
  __decorate([
1964
- $mol_mem
1965
- ], $mol_jsx_view.prototype, "_kids", null);
2004
+ $mol_wire_field
2005
+ ], $mol_jsx_view.prototype, "childNodes", null);
1966
2006
  __decorate([
1967
2007
  $mol_mem
1968
2008
  ], $mol_jsx_view.prototype, "valueOf", null);
@@ -2072,53 +2112,6 @@ var $;
2072
2112
  ;
2073
2113
  "use strict";
2074
2114
  var $;
2075
- (function ($) {
2076
- function $mol_const(value) {
2077
- var getter = (() => value);
2078
- getter['()'] = value;
2079
- getter[Symbol.toStringTag] = value;
2080
- return getter;
2081
- }
2082
- $.$mol_const = $mol_const;
2083
- })($ || ($ = {}));
2084
- //mol/const/const.ts
2085
- ;
2086
- "use strict";
2087
- var $;
2088
- (function ($) {
2089
- function $mol_wire_field(host, field, descr) {
2090
- if (!descr)
2091
- descr = Reflect.getOwnPropertyDescriptor(host, field);
2092
- const _get = descr?.get || $mol_const(descr?.value);
2093
- const persist = $mol_wire_atom.getter(_get, 0);
2094
- const _set = descr?.set || function (next) {
2095
- persist(this, []).put(next);
2096
- };
2097
- const sup = Reflect.getPrototypeOf(host);
2098
- const sup_descr = Reflect.getOwnPropertyDescriptor(sup, field);
2099
- Object.defineProperty(_get, 'name', { value: sup_descr?.get?.name ?? field });
2100
- Object.defineProperty(_set, 'name', { value: sup_descr?.set?.name ?? field });
2101
- function get() {
2102
- return persist(this, []).sync();
2103
- }
2104
- const temp = $mol_wire_task.getter(_set);
2105
- function set(next) {
2106
- temp(this, [next]).sync();
2107
- }
2108
- Object.defineProperty(get, 'name', { value: _get.name + '$' });
2109
- Object.defineProperty(set, 'name', { value: _set.name + '@' });
2110
- Object.assign(get, { orig: _get });
2111
- Object.assign(set, { orig: _set });
2112
- const { value, writable, ...descr2 } = { ...descr, get, set };
2113
- Reflect.defineProperty(host, field, descr2);
2114
- return descr2;
2115
- }
2116
- $.$mol_wire_field = $mol_wire_field;
2117
- })($ || ($ = {}));
2118
- //mol/wire/field/field.ts
2119
- ;
2120
- "use strict";
2121
- var $;
2122
2115
  (function ($) {
2123
2116
  function $mol_wire_patch(obj) {
2124
2117
  for (const field of Reflect.ownKeys(obj)) {
@@ -2827,7 +2820,7 @@ var $;
2827
2820
  return $mol_jsx("button", { title: props.hint }, target());
2828
2821
  };
2829
2822
  const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
2830
- $mol_assert_equal(dom.outerHTML, '<button title="click me" id="foo" class="Button">hey!</button>');
2823
+ $mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
2831
2824
  },
2832
2825
  'Nested guid generation'() {
2833
2826
  const Foo = () => {
@@ -3811,6 +3804,19 @@ var $;
3811
3804
  ;
3812
3805
  "use strict";
3813
3806
  var $;
3807
+ (function ($) {
3808
+ $mol_test({
3809
+ 'const returns stored value'() {
3810
+ const foo = { bar: $mol_const(Math.random()) };
3811
+ $mol_assert_equal(foo.bar(), foo.bar());
3812
+ $mol_assert_equal(foo.bar(), foo.bar['()']);
3813
+ },
3814
+ });
3815
+ })($ || ($ = {}));
3816
+ //mol/const/const.test.ts
3817
+ ;
3818
+ "use strict";
3819
+ var $;
3814
3820
  (function ($) {
3815
3821
  $mol_test({
3816
3822
  'Primitives'() {
@@ -3873,6 +3879,41 @@ var $;
3873
3879
  ;
3874
3880
  "use strict";
3875
3881
  var $;
3882
+ (function ($_1) {
3883
+ $mol_test({
3884
+ 'Cached field'($) {
3885
+ class App extends $mol_object2 {
3886
+ static $ = $;
3887
+ static low = 1;
3888
+ static get high() {
3889
+ return this.low + 1;
3890
+ }
3891
+ static set high(next) {
3892
+ this.low = next - 1;
3893
+ }
3894
+ static test() {
3895
+ $mol_assert_equal(App.high, 2);
3896
+ App.high = 3;
3897
+ $mol_assert_equal(App.high, 3);
3898
+ }
3899
+ }
3900
+ __decorate([
3901
+ $mol_wire_field
3902
+ ], App, "low", void 0);
3903
+ __decorate([
3904
+ $mol_wire_field
3905
+ ], App, "high", null);
3906
+ __decorate([
3907
+ $mol_wire_method
3908
+ ], App, "test", null);
3909
+ App.test();
3910
+ },
3911
+ });
3912
+ })($ || ($ = {}));
3913
+ //mol/wire/field/field.test.ts
3914
+ ;
3915
+ "use strict";
3916
+ var $;
3876
3917
  (function ($_1) {
3877
3918
  $mol_test({
3878
3919
  'Class as component'() {
@@ -3969,54 +4010,6 @@ var $;
3969
4010
  ;
3970
4011
  "use strict";
3971
4012
  var $;
3972
- (function ($) {
3973
- $mol_test({
3974
- 'const returns stored value'() {
3975
- const foo = { bar: $mol_const(Math.random()) };
3976
- $mol_assert_equal(foo.bar(), foo.bar());
3977
- $mol_assert_equal(foo.bar(), foo.bar['()']);
3978
- },
3979
- });
3980
- })($ || ($ = {}));
3981
- //mol/const/const.test.ts
3982
- ;
3983
- "use strict";
3984
- var $;
3985
- (function ($_1) {
3986
- $mol_test({
3987
- 'Cached field'($) {
3988
- class App extends $mol_object2 {
3989
- static $ = $;
3990
- static low = 1;
3991
- static get high() {
3992
- return this.low + 1;
3993
- }
3994
- static set high(next) {
3995
- this.low = next - 1;
3996
- }
3997
- static test() {
3998
- $mol_assert_equal(App.high, 2);
3999
- App.high = 3;
4000
- $mol_assert_equal(App.high, 3);
4001
- }
4002
- }
4003
- __decorate([
4004
- $mol_wire_field
4005
- ], App, "low", void 0);
4006
- __decorate([
4007
- $mol_wire_field
4008
- ], App, "high", null);
4009
- __decorate([
4010
- $mol_wire_method
4011
- ], App, "test", null);
4012
- App.test();
4013
- },
4014
- });
4015
- })($ || ($ = {}));
4016
- //mol/wire/field/field.test.ts
4017
- ;
4018
- "use strict";
4019
- var $;
4020
4013
  (function ($_1) {
4021
4014
  $mol_test({
4022
4015
  'Watch one value'($) {