@massimo-cassandro/minimo 1.5.3 → 1.5.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/massimo-cassandro/minimo#readme",
@@ -1,7 +1,9 @@
1
1
  /*
2
2
  NB:
3
- `--_modal-popup-width` and `--_modal-popup-height` are used with a fallback value
4
- but can be set with a desired value caso per caso
3
+ `--modal-popup-width` and `--modal-popup-height` are used with a fallback value,
4
+ but can be set to the desired value on a case-by-case basis.
5
+
6
+ Same for min/max-width and min/max-height
5
7
 
6
8
  */
7
9
 
@@ -13,11 +15,11 @@ but can be set with a desired value caso per caso
13
15
  flex-direction: column;
14
16
 
15
17
  width: var(--_modal-popup-width, max-content);
16
- min-width: 400px;
17
- max-width: 98dvw;
18
+ min-width: var(--_modal-popup-min-width, 400px);
19
+ max-width: var(--_modal-popup-max-width, 98dvw);
18
20
  height: var(--_modal-popup-height, max-content);
19
- min-height: 300px;
20
- max-height: 90dvh;
21
+ min-height: var(--_modal-popup-min-height, 300px);
22
+ max-height: var(--_modal-popup-min-height, 90dvh);
21
23
  padding: 0;
22
24
  margin: auto;
23
25
  overflow: visible;
@@ -1,18 +1,14 @@
1
- const characters_to_escape = {
2
- '&': '&',
3
- '"': '"',
4
- '\'': ''',
5
- '<': '&lt;',
6
- '>': '&gt;'
1
+ const ESCAPE_MAP = {
2
+ '&' : '&amp;',
3
+ '"' : '&quot;',
4
+ '\'' : '&#039;',
5
+ '<' : '&lt;',
6
+ '>' : '&gt;'
7
7
  };
8
- export function escapeHTML(str) {
9
- const regexp = new RegExp(`[${Object.keys(characters_to_escape).join('')}]`, 'g');
10
- return str?.replace(regexp, m => characters_to_escape[m])?? '';
11
- }
8
+ const UNESCAPE_MAP = Object.fromEntries(Object.entries(ESCAPE_MAP).map(([k, v]) => [v, k]));
12
9
 
13
- export function unescapeHTML(str) {
14
- const regexp = new RegExp(Object.values(characters_to_escape).join('|'), 'g'),
15
- entities_to_unescape = Object.fromEntries(Object.entries(characters_to_escape).map(a => a.reverse()));
10
+ const ESCAPE_RE = /[&"'<>]/g;
11
+ const UNESCAPE_RE = /&amp;|&quot;|&#039;|&lt;|&gt;/g;
16
12
 
17
- return str?.replace(regexp, m => entities_to_unescape[m] )?? '';
18
- }
13
+ export const escapeHTML = str => str?.replace(ESCAPE_RE, m => ESCAPE_MAP[m]) ?? '';
14
+ export const unescapeHTML = str => str?.replace(UNESCAPE_RE, m => UNESCAPE_MAP[m]) ?? '';