mol_dump_lib 0.0.737 → 0.0.739

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.mjs CHANGED
@@ -3475,7 +3475,7 @@ var $;
3475
3475
  props.push(`\t${keys.join('-')}: ${val};\n`);
3476
3476
  }
3477
3477
  else if (val.constructor === Object) {
3478
- for (let suffix in val) {
3478
+ for (let suffix of Object.keys(val).reverse()) {
3479
3479
  addProp([...keys, kebab(suffix)], val[suffix]);
3480
3480
  }
3481
3481
  }
@@ -3493,13 +3493,13 @@ var $;
3493
3493
  }
3494
3494
  else if (key === '>') {
3495
3495
  const types = config[key];
3496
- for (let type in types) {
3496
+ for (let type of Object.keys(types).reverse()) {
3497
3497
  make_class(selector(prefix, path) + ' > :where([' + $mol_dom_qname(type) + '])', [], types[type]);
3498
3498
  }
3499
3499
  }
3500
3500
  else if (key === '@') {
3501
3501
  const attrs = config[key];
3502
- for (let name in attrs) {
3502
+ for (let name of Object.keys(attrs).reverse()) {
3503
3503
  for (let val in attrs[name]) {
3504
3504
  make_class(selector(prefix, path) + ':where([' + name + '=' + JSON.stringify(val) + '])', [], attrs[name][val]);
3505
3505
  }
@@ -3507,7 +3507,7 @@ var $;
3507
3507
  }
3508
3508
  else if (key === '@media') {
3509
3509
  const media = config[key];
3510
- for (let query in media) {
3510
+ for (let query of Object.keys(media).reverse()) {
3511
3511
  rules.push('}\n');
3512
3512
  make_class(prefix, path, media[query]);
3513
3513
  rules.push(`${key} ${query} {\n`);
@@ -3516,7 +3516,7 @@ var $;
3516
3516
  else if (key[0] === '[' && key[key.length - 1] === ']') {
3517
3517
  const attr = key.slice(1, -1);
3518
3518
  const vals = config[key];
3519
- for (let val in vals) {
3519
+ for (let val of Object.keys(vals).reverse()) {
3520
3520
  make_class(selector(prefix, path) + ':where([' + attr + '=' + JSON.stringify(val) + '])', [], vals[val]);
3521
3521
  }
3522
3522
  }
package/web.test.js CHANGED
@@ -2808,10 +2808,9 @@ var $;
2808
2808
  'various units'() {
2809
2809
  class $mol_style_sheet_test extends $mol_view {
2810
2810
  }
2811
- const { px, per } = $mol_style_unit;
2812
2811
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2813
- width: per(50),
2814
- height: px(50),
2812
+ width: '50%',
2813
+ height: '50px',
2815
2814
  });
2816
2815
  $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\twidth: 50%;\n\theight: 50px;\n}\n');
2817
2816
  },
@@ -2819,50 +2818,50 @@ var $;
2819
2818
  class $mol_style_sheet_test extends $mol_view {
2820
2819
  }
2821
2820
  const { calc } = $mol_style_func;
2822
- const { px, per } = $mol_style_unit;
2823
2821
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2824
- width: calc(`${per(100)} - ${px(1)}`),
2822
+ width: calc(`100% - 1px`),
2825
2823
  });
2826
2824
  $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\twidth: calc(100% - 1px);\n}\n');
2827
2825
  },
2828
2826
  'property groups'() {
2829
2827
  class $mol_style_sheet_test extends $mol_view {
2830
2828
  }
2831
- const { px } = $mol_style_unit;
2832
2829
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2833
2830
  flex: {
2834
- grow: 5
2831
+ grow: 5,
2832
+ shrink: 10,
2835
2833
  }
2836
2834
  });
2837
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tflex-grow: 5;\n}\n');
2835
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tflex-grow: 5;\n\tflex-shrink: 10;\n}\n');
2838
2836
  },
2839
2837
  'custom properties'() {
2840
2838
  class $mol_style_sheet_test extends $mol_view {
2841
2839
  }
2842
2840
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2843
2841
  '--isVariable': 'yes',
2842
+ '--is_variable': 'no',
2844
2843
  });
2845
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\t--is-variable: yes;\n}\n');
2844
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\t--is-variable: yes;\n\t--is_variable: no;\n}\n');
2846
2845
  },
2847
2846
  'custom property groups'() {
2848
2847
  class $mol_style_sheet_test extends $mol_view {
2849
2848
  }
2850
- const { px } = $mol_style_unit;
2851
2849
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2852
2850
  '--variable': {
2853
- test: px(5)
2854
- }
2851
+ test1: '5px',
2852
+ test2: '10px',
2853
+ },
2855
2854
  });
2856
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\t--variable-test: 5px;\n}\n');
2855
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\t--variable-test1: 5px;\n\t--variable-test2: 10px;\n}\n');
2857
2856
  },
2858
2857
  'property shorthand'() {
2859
2858
  class $mol_style_sheet_test extends $mol_view {
2860
2859
  }
2861
- const { px } = $mol_style_unit;
2862
2860
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2863
- padding: [px(5), 'auto']
2861
+ padding: ['5px', 'auto'],
2862
+ margin: ['10px', 'auto'],
2864
2863
  });
2865
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tpadding: 5px auto;\n}\n');
2864
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tpadding: 5px auto;\n\tmargin: 10px auto;\n}\n');
2866
2865
  },
2867
2866
  'sequenced values'() {
2868
2867
  class $mol_style_sheet_test extends $mol_view {
@@ -2871,15 +2870,14 @@ var $;
2871
2870
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2872
2871
  background: {
2873
2872
  image: [[url('foo')], [url('bar')]],
2873
+ size: [['cover'], ['contain']],
2874
2874
  },
2875
2875
  });
2876
- $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tbackground-image: url("foo"),url("bar");\n}\n');
2876
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tbackground-image: url("foo"),url("bar");\n\tbackground-size: cover,contain;\n}\n');
2877
2877
  },
2878
2878
  'sequenced structs'() {
2879
2879
  class $mol_style_sheet_test extends $mol_view {
2880
2880
  }
2881
- const { rem } = $mol_style_unit;
2882
- const { hsla } = $mol_style_func;
2883
2881
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2884
2882
  box: {
2885
2883
  shadow: [
@@ -2887,7 +2885,7 @@ var $;
2887
2885
  inset: true,
2888
2886
  x: 0,
2889
2887
  y: 0,
2890
- blur: rem(.5),
2888
+ blur: '0.5rem',
2891
2889
  spread: 0,
2892
2890
  color: 'red',
2893
2891
  },
@@ -2895,7 +2893,7 @@ var $;
2895
2893
  inset: false,
2896
2894
  x: 0,
2897
2895
  y: 0,
2898
- blur: rem(.5),
2896
+ blur: '0.5rem',
2899
2897
  spread: 0,
2900
2898
  color: 'blue',
2901
2899
  },
@@ -2908,36 +2906,39 @@ var $;
2908
2906
  class $mol_style_sheet_test extends $mol_view {
2909
2907
  }
2910
2908
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2909
+ color: 'red',
2911
2910
  ':focus': {
2912
- color: 'red',
2913
2911
  display: 'block',
2914
2912
  },
2915
2913
  });
2916
- $mol_assert_equal(sheet, '[mol_style_sheet_test]:focus {\n\tcolor: red;\n\tdisplay: block;\n}\n');
2914
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tcolor: red;\n}\n[mol_style_sheet_test]:focus {\n\tdisplay: block;\n}\n');
2917
2915
  },
2918
2916
  'component block styles with pseudo element'() {
2919
2917
  class $mol_style_sheet_test extends $mol_view {
2920
2918
  }
2921
2919
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2920
+ color: 'red',
2922
2921
  '::first-line': {
2923
- color: 'red',
2924
2922
  display: 'block',
2925
2923
  },
2926
2924
  });
2927
- $mol_assert_equal(sheet, '[mol_style_sheet_test]::first-line {\n\tcolor: red;\n\tdisplay: block;\n}\n');
2925
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tcolor: red;\n}\n[mol_style_sheet_test]::first-line {\n\tdisplay: block;\n}\n');
2928
2926
  },
2929
2927
  'component block styles with media query'() {
2930
2928
  class $mol_style_sheet_test extends $mol_view {
2931
2929
  }
2932
2930
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2931
+ color: 'red',
2933
2932
  '@media': {
2934
2933
  'print': {
2935
- color: 'red',
2936
2934
  display: 'block',
2937
2935
  },
2936
+ '(max-width: 640px)': {
2937
+ display: 'inline',
2938
+ },
2938
2939
  },
2939
2940
  });
2940
- $mol_assert_equal(sheet, '@media print {\n[mol_style_sheet_test] {\n\tcolor: red;\n\tdisplay: block;\n}\n}\n');
2941
+ $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');
2941
2942
  },
2942
2943
  'component block styles with attribute value'() {
2943
2944
  class $mol_style_sheet_test extends $mol_view {
@@ -2948,46 +2949,79 @@ var $;
2948
2949
  }
2949
2950
  }
2950
2951
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2952
+ color: 'red',
2951
2953
  '@': {
2952
2954
  mol_theme: {
2953
2955
  '$mol_theme_dark': {
2954
- color: 'red',
2955
2956
  display: 'block',
2956
2957
  },
2957
2958
  },
2959
+ disabled: {
2960
+ 'true': {
2961
+ width: '100%',
2962
+ },
2963
+ },
2958
2964
  },
2959
2965
  });
2960
- $mol_assert_equal(sheet, '[mol_style_sheet_test]:where([mol_theme="$mol_theme_dark"]) {\n\tcolor: red;\n\tdisplay: block;\n}\n');
2966
+ $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');
2967
+ },
2968
+ 'component block styles with attribute value (short syntax)'() {
2969
+ class $mol_style_sheet_test extends $mol_view {
2970
+ attr() {
2971
+ return {
2972
+ mol_theme: '$mol_theme_dark'
2973
+ };
2974
+ }
2975
+ }
2976
+ const sheet = $mol_style_sheet($mol_style_sheet_test, {
2977
+ color: 'red',
2978
+ '[mol_theme]': {
2979
+ '$mol_theme_dark': {
2980
+ display: 'block',
2981
+ },
2982
+ },
2983
+ '[disabled]': {
2984
+ 'true': {
2985
+ width: '100%',
2986
+ },
2987
+ 'false': {
2988
+ width: '50%',
2989
+ },
2990
+ },
2991
+ });
2992
+ $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');
2961
2993
  },
2962
2994
  'component element styles'() {
2963
2995
  class $mol_style_sheet_test extends $mol_view {
2964
2996
  Item() { return new $mol_view; }
2965
2997
  }
2966
2998
  const sheet = $mol_style_sheet($mol_style_sheet_test, {
2999
+ color: 'red',
2967
3000
  Item: {
2968
- color: 'red',
2969
3001
  display: 'block',
2970
3002
  },
2971
3003
  });
2972
- $mol_assert_equal(sheet, '[mol_style_sheet_test_item] {\n\tcolor: red;\n\tdisplay: block;\n}\n');
3004
+ $mol_assert_equal(sheet, '[mol_style_sheet_test] {\n\tcolor: red;\n}\n[mol_style_sheet_test_item] {\n\tdisplay: block;\n}\n');
2973
3005
  },
2974
3006
  'component element of element styles'() {
2975
3007
  const sheet = $mol_style_sheet($mol_style_sheet_test2, {
3008
+ width: '100%',
2976
3009
  List: {
3010
+ color: 'red',
2977
3011
  Item: {
2978
- color: 'red',
2979
3012
  display: 'block',
2980
3013
  },
2981
3014
  },
2982
3015
  });
2983
- $mol_assert_equal(sheet, '[mol_style_sheet_test2_list_item] {\n\tcolor: red;\n\tdisplay: block;\n}\n');
3016
+ $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');
2984
3017
  },
2985
3018
  'component element styles with block attribute value'() {
2986
3019
  class $mol_style_sheet_test extends $mol_view {
2987
3020
  Item() { return new $mol_view; }
2988
3021
  attr() {
2989
3022
  return {
2990
- mol_theme: '$mol_theme_dark'
3023
+ mol_theme: '$mol_theme_dark',
3024
+ disabled: true,
2991
3025
  };
2992
3026
  }
2993
3027
  }
@@ -3006,23 +3040,26 @@ var $;
3006
3040
  },
3007
3041
  'inner component styles by class'() {
3008
3042
  const sheet = $mol_style_sheet($mol_style_sheet_test2, {
3043
+ color: 'red',
3009
3044
  $mol_style_sheet_test1: {
3010
- color: 'red',
3011
3045
  display: 'block',
3012
3046
  },
3013
3047
  });
3014
- $mol_assert_equal(sheet, '[mol_style_sheet_test2] :where([mol_style_sheet_test1]) {\n\tcolor: red;\n\tdisplay: block;\n}\n');
3048
+ $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');
3015
3049
  },
3016
3050
  'child component styles by class'() {
3017
3051
  const sheet = $mol_style_sheet($mol_style_sheet_test2, {
3052
+ color: 'red',
3018
3053
  '>': {
3019
3054
  $mol_style_sheet_test1: {
3020
- color: 'red',
3021
3055
  display: 'block',
3022
3056
  },
3057
+ $mol_style_sheet_test2: {
3058
+ display: 'inline',
3059
+ },
3023
3060
  },
3024
3061
  });
3025
- $mol_assert_equal(sheet, '[mol_style_sheet_test2] > :where([mol_style_sheet_test1]) {\n\tcolor: red;\n\tdisplay: block;\n}\n');
3062
+ $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');
3026
3063
  },
3027
3064
  });
3028
3065
  })($ || ($ = {}));