@wix/origami-transforms 0.1.25 → 0.1.27

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": "@wix/origami-transforms",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "Babel and PostCSS checks and transforms for Wix origami page files.",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -18,8 +18,8 @@
18
18
  "@babel/core": "^7.26.0",
19
19
  "@babel/parser": "^7.25.0",
20
20
  "@babel/types": "^7.25.2",
21
- "@wix/origami-fonts": "1.0.3",
22
- "@wix/origami-system-components": "1.10.5",
21
+ "@wix/origami-fonts": "1.0.4",
22
+ "@wix/origami-system-components": "1.10.6",
23
23
  "postcss": "^8.5.3",
24
24
  "postcss-custom-media": "^12.0.1"
25
25
  },
@@ -69,5 +69,5 @@
69
69
  },
70
70
  "type": "module",
71
71
  "types": "./dist/index.d.ts",
72
- "falconPackageHash": "db3ec4aae3575547cf339696d8292fb79c71ee28b5c2fd4bc94a032c"
72
+ "falconPackageHash": "1c7523e78958c85b77bf2e3bdfc4a2a7b6842c08c8be0cebea118c68"
73
73
  }
@@ -17,14 +17,15 @@ import { literalIdOf, parseStructure, structureFileOf, walk } from './structureF
17
17
  const CONTENT_WRAPPER = 'internal-container-content-wrapper'
18
18
  const BASE = ''
19
19
 
20
- // What a stack child may write, per direction. `0` is allowed wherever a length is.
20
+ // What a stack child may write, per direction. `0` is allowed wherever a length is. Exports write `width: max-content`
21
+ // on a stack child, and DM's import accepts it.
21
22
  const ALLOWED = {
22
- vertical: { width: ['spx', 'px', 'vw', 'vh', '%', 'calc'], margin: ['spx', 'px', 'vw', 'vh', '%'] },
23
- horizontal: { width: ['spx', 'px', 'vw', 'vh', 'calc'], margin: ['spx', 'px', 'vw', 'vh'] },
23
+ vertical: { width: ['spx', 'px', 'vw', 'vh', '%', 'calc', 'max-content'], margin: ['spx', 'px', 'vw', 'vh', '%'] },
24
+ horizontal: { width: ['spx', 'px', 'vw', 'vh', 'calc', 'max-content'], margin: ['spx', 'px', 'vw', 'vh'] },
24
25
  }
25
26
 
26
27
  const UNIT = /^-?(?:\d+\.?\d*|\.\d+)(px|vw|vh|%)$/i
27
- const LABELS = { spx: '--spx()', px: 'px', vw: 'vw', vh: 'vh', '%': '%', calc: 'calc()' }
28
+ const LABELS = { spx: '--spx()', px: 'px', vw: 'vw', vh: 'vh', '%': '%', calc: 'calc()', 'max-content': 'max-content' }
28
29
 
29
30
  /** `width` → 'width', `margin`/`margin-*` → 'margin', anything else → undefined. */
30
31
  const kindOf = prop =>
@@ -47,9 +48,10 @@ const tokens = value => {
47
48
  return result
48
49
  }
49
50
 
50
- /** The kind of length a token is: 'spx', 'px', 'vw', 'vh', '%', 'calc', 'zero', or undefined. */
51
+ /** The kind of length a token is: 'spx', 'px', 'vw', 'vh', '%', 'calc', 'max-content', 'zero', or undefined. */
51
52
  const lengthOf = token => {
52
53
  if (/^--spx\(.*\)$/.test(token)) return 'spx'
54
+ if (/^max-content$/i.test(token)) return 'max-content'
53
55
  if (/^calc\(.*\)$/i.test(token)) return 'calc'
54
56
  if (/^-?0*\.?0+$/.test(token)) return 'zero'
55
57
  return UNIT.exec(token)?.[1].toLowerCase()