esm-styles 0.1.13 → 0.2.0

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.
@@ -1,13 +1,17 @@
1
- export const contentValue = value => {
1
+ export const contentValue = (value) => {
2
2
  if (typeof value !== 'string')
3
3
  return value;
4
4
  // If already quoted, return as is
5
5
  if (/^'.*'$/.test(value) || /^".*"$/.test(value))
6
6
  return value;
7
- // Convert each character to CSS unicode escape: \00xxxx
7
+ // If all characters are printable ASCII, return as quoted string
8
+ if (/^[\x20-\x7E]*$/.test(value)) {
9
+ return `'${value}'`;
10
+ }
11
+ // Otherwise, convert each character to CSS unicode escape: \00xxxx
8
12
  const unicode = value
9
13
  .split('')
10
- .map(ch => {
14
+ .map((ch) => {
11
15
  const code = ch.codePointAt(0);
12
16
  if (!code)
13
17
  return '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esm-styles",
3
- "version": "0.1.13",
3
+ "version": "0.2.0",
4
4
  "description": "A library for working with ESM styles",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",