mol_dump_lib 0.0.736 → 0.0.738

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.mjs CHANGED
@@ -4037,7 +4037,7 @@ var $;
4037
4037
  props.push(`\t${keys.join('-')}: ${val};\n`);
4038
4038
  }
4039
4039
  else if (val.constructor === Object) {
4040
- for (let suffix in val) {
4040
+ for (let suffix of Object.keys(val).reverse()) {
4041
4041
  addProp([...keys, kebab(suffix)], val[suffix]);
4042
4042
  }
4043
4043
  }
@@ -4055,13 +4055,13 @@ var $;
4055
4055
  }
4056
4056
  else if (key === '>') {
4057
4057
  const types = config[key];
4058
- for (let type in types) {
4058
+ for (let type of Object.keys(types).reverse()) {
4059
4059
  make_class(selector(prefix, path) + ' > :where([' + $mol_dom_qname(type) + '])', [], types[type]);
4060
4060
  }
4061
4061
  }
4062
4062
  else if (key === '@') {
4063
4063
  const attrs = config[key];
4064
- for (let name in attrs) {
4064
+ for (let name of Object.keys(attrs).reverse()) {
4065
4065
  for (let val in attrs[name]) {
4066
4066
  make_class(selector(prefix, path) + ':where([' + name + '=' + JSON.stringify(val) + '])', [], attrs[name][val]);
4067
4067
  }
@@ -4069,7 +4069,7 @@ var $;
4069
4069
  }
4070
4070
  else if (key === '@media') {
4071
4071
  const media = config[key];
4072
- for (let query in media) {
4072
+ for (let query of Object.keys(media).reverse()) {
4073
4073
  rules.push('}\n');
4074
4074
  make_class(prefix, path, media[query]);
4075
4075
  rules.push(`${key} ${query} {\n`);
@@ -4078,7 +4078,7 @@ var $;
4078
4078
  else if (key[0] === '[' && key[key.length - 1] === ']') {
4079
4079
  const attr = key.slice(1, -1);
4080
4080
  const vals = config[key];
4081
- for (let val in vals) {
4081
+ for (let val of Object.keys(vals).reverse()) {
4082
4082
  make_class(selector(prefix, path) + ':where([' + attr + '=' + JSON.stringify(val) + '])', [], vals[val]);
4083
4083
  }
4084
4084
  }
package/node.test.js CHANGED
@@ -4028,7 +4028,7 @@ var $;
4028
4028
  props.push(`\t${keys.join('-')}: ${val};\n`);
4029
4029
  }
4030
4030
  else if (val.constructor === Object) {
4031
- for (let suffix in val) {
4031
+ for (let suffix of Object.keys(val).reverse()) {
4032
4032
  addProp([...keys, kebab(suffix)], val[suffix]);
4033
4033
  }
4034
4034
  }
@@ -4046,13 +4046,13 @@ var $;
4046
4046
  }
4047
4047
  else if (key === '>') {
4048
4048
  const types = config[key];
4049
- for (let type in types) {
4049
+ for (let type of Object.keys(types).reverse()) {
4050
4050
  make_class(selector(prefix, path) + ' > :where([' + $mol_dom_qname(type) + '])', [], types[type]);
4051
4051
  }
4052
4052
  }
4053
4053
  else if (key === '@') {
4054
4054
  const attrs = config[key];
4055
- for (let name in attrs) {
4055
+ for (let name of Object.keys(attrs).reverse()) {
4056
4056
  for (let val in attrs[name]) {
4057
4057
  make_class(selector(prefix, path) + ':where([' + name + '=' + JSON.stringify(val) + '])', [], attrs[name][val]);
4058
4058
  }
@@ -4060,7 +4060,7 @@ var $;
4060
4060
  }
4061
4061
  else if (key === '@media') {
4062
4062
  const media = config[key];
4063
- for (let query in media) {
4063
+ for (let query of Object.keys(media).reverse()) {
4064
4064
  rules.push('}\n');
4065
4065
  make_class(prefix, path, media[query]);
4066
4066
  rules.push(`${key} ${query} {\n`);
@@ -4069,7 +4069,7 @@ var $;
4069
4069
  else if (key[0] === '[' && key[key.length - 1] === ']') {
4070
4070
  const attr = key.slice(1, -1);
4071
4071
  const vals = config[key];
4072
- for (let val in vals) {
4072
+ for (let val of Object.keys(vals).reverse()) {
4073
4073
  make_class(selector(prefix, path) + ':where([' + attr + '=' + JSON.stringify(val) + '])', [], vals[val]);
4074
4074
  }
4075
4075
  }
@@ -10226,10 +10226,9 @@ var $;
10226
10226
  'various units'() {
10227
10227
  class $mol_style_sheet_test extends $mol_view {
10228
10228
  }
10229
- const { px, per } = $mol_style_unit;
10230
10229
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10231
- width: per(50),
10232
- height: px(50),
10230
+ width: '50%',
10231
+ height: '50px',
10233
10232
  });
10234
10233
  $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\twidth: 50%;\n\theight: 50px;\n}\n');
10235
10234
  },
@@ -10237,50 +10236,50 @@ var $;
10237
10236
  class $mol_style_sheet_test extends $mol_view {
10238
10237
  }
10239
10238
  const { calc } = $mol_style_func;
10240
- const { px, per } = $mol_style_unit;
10241
10239
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10242
- width: calc(`${per(100)} - ${px(1)}`),
10240
+ width: calc(`100% - 1px`),
10243
10241
  });
10244
10242
  $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\twidth: calc(100% - 1px);\n}\n');
10245
10243
  },
10246
10244
  'property groups'() {
10247
10245
  class $mol_style_sheet_test extends $mol_view {
10248
10246
  }
10249
- const { px } = $mol_style_unit;
10250
10247
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10251
10248
  flex: {
10252
- grow: 5
10249
+ grow: 5,
10250
+ shrink: 10,
10253
10251
  }
10254
10252
  });
10255
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tflex-grow: 5;\n}\n');
10253
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tflex-grow: 5;\n\tflex-shrink: 10;\n}\n');
10256
10254
  },
10257
10255
  'custom properties'() {
10258
10256
  class $mol_style_sheet_test extends $mol_view {
10259
10257
  }
10260
10258
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10261
10259
  '--isVariable': 'yes',
10260
+ '--is_variable': 'no',
10262
10261
  });
10263
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\t--is-variable: yes;\n}\n');
10262
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\t--is-variable: yes;\n\t--is_variable: no;\n}\n');
10264
10263
  },
10265
10264
  'custom property groups'() {
10266
10265
  class $mol_style_sheet_test extends $mol_view {
10267
10266
  }
10268
- const { px } = $mol_style_unit;
10269
10267
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10270
10268
  '--variable': {
10271
- test: px(5)
10272
- }
10269
+ test1: '5px',
10270
+ test2: '10px',
10271
+ },
10273
10272
  });
10274
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\t--variable-test: 5px;\n}\n');
10273
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\t--variable-test1: 5px;\n\t--variable-test2: 10px;\n}\n');
10275
10274
  },
10276
10275
  'property shorthand'() {
10277
10276
  class $mol_style_sheet_test extends $mol_view {
10278
10277
  }
10279
- const { px } = $mol_style_unit;
10280
10278
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10281
- padding: [px(5), 'auto']
10279
+ padding: ['5px', 'auto'],
10280
+ margin: ['10px', 'auto'],
10282
10281
  });
10283
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tpadding: 5px auto;\n}\n');
10282
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tpadding: 5px auto;\n\tmargin: 10px auto;\n}\n');
10284
10283
  },
10285
10284
  'sequenced values'() {
10286
10285
  class $mol_style_sheet_test extends $mol_view {
@@ -10289,15 +10288,14 @@ var $;
10289
10288
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10290
10289
  background: {
10291
10290
  image: [[url('foo')], [url('bar')]],
10291
+ size: [['cover'], ['contain']],
10292
10292
  },
10293
10293
  });
10294
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tbackground-image: url("foo"),url("bar");\n}\n');
10294
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tbackground-image: url("foo"),url("bar");\n\tbackground-size: cover,contain;\n}\n');
10295
10295
  },
10296
10296
  'sequenced structs'() {
10297
10297
  class $mol_style_sheet_test extends $mol_view {
10298
10298
  }
10299
- const { rem } = $mol_style_unit;
10300
- const { hsla } = $mol_style_func;
10301
10299
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10302
10300
  box: {
10303
10301
  shadow: [
@@ -10305,7 +10303,7 @@ var $;
10305
10303
  inset: true,
10306
10304
  x: 0,
10307
10305
  y: 0,
10308
- blur: rem(.5),
10306
+ blur: '0.5rem',
10309
10307
  spread: 0,
10310
10308
  color: 'red',
10311
10309
  },
@@ -10313,7 +10311,7 @@ var $;
10313
10311
  inset: false,
10314
10312
  x: 0,
10315
10313
  y: 0,
10316
- blur: rem(.5),
10314
+ blur: '0.5rem',
10317
10315
  spread: 0,
10318
10316
  color: 'blue',
10319
10317
  },
@@ -10326,36 +10324,39 @@ var $;
10326
10324
  class $mol_style_sheet_test extends $mol_view {
10327
10325
  }
10328
10326
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10327
+ color: 'red',
10329
10328
  ':focus': {
10330
- color: 'red',
10331
10329
  display: 'block',
10332
10330
  },
10333
10331
  });
10334
- $mol_assert_equal(sheet, '[mol_style_sheet_test]:focus {\n\tcolor: red;\n\tdisplay: block;\n}\n');
10332
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tcolor: red;\n}\n[mol_style_sheet_test]:focus {\n\tdisplay: block;\n}\n');
10335
10333
  },
10336
10334
  'component block styles with pseudo element'() {
10337
10335
  class $mol_style_sheet_test extends $mol_view {
10338
10336
  }
10339
10337
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10338
+ color: 'red',
10340
10339
  '::first-line': {
10341
- color: 'red',
10342
10340
  display: 'block',
10343
10341
  },
10344
10342
  });
10345
- $mol_assert_equal(sheet, '[mol_style_sheet_test]::first-line {\n\tcolor: red;\n\tdisplay: block;\n}\n');
10343
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tcolor: red;\n}\n[mol_style_sheet_test]::first-line {\n\tdisplay: block;\n}\n');
10346
10344
  },
10347
10345
  'component block styles with media query'() {
10348
10346
  class $mol_style_sheet_test extends $mol_view {
10349
10347
  }
10350
10348
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10349
+ color: 'red',
10351
10350
  '@media': {
10352
10351
  'print': {
10353
- color: 'red',
10354
10352
  display: 'block',
10355
10353
  },
10354
+ '(max-width: 640px)': {
10355
+ display: 'inline',
10356
+ },
10356
10357
  },
10357
10358
  });
10358
- $mol_assert_equal(sheet, '@media print {\n[mol_style_sheet_test] {\n\tcolor: red;\n\tdisplay: block;\n}\n}\n');
10359
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tcolor: red;\n}\n@media print {\n[mol_style_sheet_test] {\n\tdisplay: block;\n}\n}\n@media (max-width: 640px) {\n[mol_style_sheet_test] {\n\tdisplay: inline;\n}\n}\n');
10359
10360
  },
10360
10361
  'component block styles with attribute value'() {
10361
10362
  class $mol_style_sheet_test extends $mol_view {
@@ -10366,46 +10367,79 @@ var $;
10366
10367
  }
10367
10368
  }
10368
10369
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10370
+ color: 'red',
10369
10371
  '@': {
10370
10372
  mol_theme: {
10371
10373
  '$mol_theme_dark': {
10372
- color: 'red',
10373
10374
  display: 'block',
10374
10375
  },
10375
10376
  },
10377
+ disabled: {
10378
+ 'true': {
10379
+ width: '100%',
10380
+ },
10381
+ },
10376
10382
  },
10377
10383
  });
10378
- $mol_assert_equal(sheet, '[mol_style_sheet_test]:where([mol_theme="$mol_theme_dark"]) {\n\tcolor: red;\n\tdisplay: block;\n}\n');
10384
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tcolor: red;\n}\n[mol_style_sheet_test]:where([mol_theme="$mol_theme_dark"]) {\n\tdisplay: block;\n}\n[mol_style_sheet_test]:where([disabled="true"]) {\n\twidth: 100%;\n}\n');
10385
+ },
10386
+ 'component block styles with attribute value (short syntax)'() {
10387
+ class $mol_style_sheet_test extends $mol_view {
10388
+ attr() {
10389
+ return {
10390
+ mol_theme: '$mol_theme_dark'
10391
+ };
10392
+ }
10393
+ }
10394
+ const sheet = $mol_style_sheet($mol_style_sheet_test, {
10395
+ color: 'red',
10396
+ '[mol_theme]': {
10397
+ '$mol_theme_dark': {
10398
+ display: 'block',
10399
+ },
10400
+ },
10401
+ '[disabled]': {
10402
+ 'true': {
10403
+ width: '100%',
10404
+ },
10405
+ 'false': {
10406
+ width: '50%',
10407
+ },
10408
+ },
10409
+ });
10410
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tcolor: red;\n}\n[mol_style_sheet_test]:where([mol_theme="$mol_theme_dark"]) {\n\tdisplay: block;\n}\n[mol_style_sheet_test]:where([disabled="true"]) {\n\twidth: 100%;\n}\n[mol_style_sheet_test]:where([disabled="false"]) {\n\twidth: 50%;\n}\n');
10379
10411
  },
10380
10412
  'component element styles'() {
10381
10413
  class $mol_style_sheet_test extends $mol_view {
10382
10414
  Item() { return new $mol_view; }
10383
10415
  }
10384
10416
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
10417
+ color: 'red',
10385
10418
  Item: {
10386
- color: 'red',
10387
10419
  display: 'block',
10388
10420
  },
10389
10421
  });
10390
- $mol_assert_equal(sheet, '[mol_style_sheet_test_item] {\n\tcolor: red;\n\tdisplay: block;\n}\n');
10422
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tcolor: red;\n}\n[mol_style_sheet_test_item] {\n\tdisplay: block;\n}\n');
10391
10423
  },
10392
10424
  'component element of element styles'() {
10393
10425
  const sheet = $mol_style_sheet($mol_style_sheet_test2, {
10426
+ width: '100%',
10394
10427
  List: {
10428
+ color: 'red',
10395
10429
  Item: {
10396
- color: 'red',
10397
10430
  display: 'block',
10398
10431
  },
10399
10432
  },
10400
10433
  });
10401
- $mol_assert_equal(sheet, '[mol_style_sheet_test2_list_item] {\n\tcolor: red;\n\tdisplay: block;\n}\n');
10434
+ $mol_assert_equal(sheet, '[mol_style_sheet_test2] {\n\twidth: 100%;\n}\n[mol_style_sheet_test2_list] {\n\tcolor: red;\n}\n[mol_style_sheet_test2_list_item] {\n\tdisplay: block;\n}\n');
10402
10435
  },
10403
10436
  'component element styles with block attribute value'() {
10404
10437
  class $mol_style_sheet_test extends $mol_view {
10405
10438
  Item() { return new $mol_view; }
10406
10439
  attr() {
10407
10440
  return {
10408
- mol_theme: '$mol_theme_dark'
10441
+ mol_theme: '$mol_theme_dark',
10442
+ disabled: true,
10409
10443
  };
10410
10444
  }
10411
10445
  }
@@ -10424,23 +10458,26 @@ var $;
10424
10458
  },
10425
10459
  'inner component styles by class'() {
10426
10460
  const sheet = $mol_style_sheet($mol_style_sheet_test2, {
10461
+ color: 'red',
10427
10462
  $mol_style_sheet_test1: {
10428
- color: 'red',
10429
10463
  display: 'block',
10430
10464
  },
10431
10465
  });
10432
- $mol_assert_equal(sheet, '[mol_style_sheet_test2] :where([mol_style_sheet_test1]) {\n\tcolor: red;\n\tdisplay: block;\n}\n');
10466
+ $mol_assert_equal(sheet, '[mol_style_sheet_test2] {\n\tcolor: red;\n}\n[mol_style_sheet_test2] :where([mol_style_sheet_test1]) {\n\tdisplay: block;\n}\n');
10433
10467
  },
10434
10468
  'child component styles by class'() {
10435
10469
  const sheet = $mol_style_sheet($mol_style_sheet_test2, {
10470
+ color: 'red',
10436
10471
  '>': {
10437
10472
  $mol_style_sheet_test1: {
10438
- color: 'red',
10439
10473
  display: 'block',
10440
10474
  },
10475
+ $mol_style_sheet_test2: {
10476
+ display: 'inline',
10477
+ },
10441
10478
  },
10442
10479
  });
10443
- $mol_assert_equal(sheet, '[mol_style_sheet_test2] > :where([mol_style_sheet_test1]) {\n\tcolor: red;\n\tdisplay: block;\n}\n');
10480
+ $mol_assert_equal(sheet, '[mol_style_sheet_test2] {\n\tcolor: red;\n}\n[mol_style_sheet_test2] > :where([mol_style_sheet_test1]) {\n\tdisplay: block;\n}\n[mol_style_sheet_test2] > :where([mol_style_sheet_test2]) {\n\tdisplay: inline;\n}\n');
10444
10481
  },
10445
10482
  });
10446
10483
  })($ || ($ = {}));