@wix/origami-transforms 0.1.8 → 0.1.9
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.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Babel and PostCSS checks and transforms for Wix origami page files.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
},
|
|
55
55
|
"type": "module",
|
|
56
56
|
"types": "./dist/index.d.ts",
|
|
57
|
-
"falconPackageHash": "
|
|
57
|
+
"falconPackageHash": "3225c4d857f7c4821fc78ea579b9a416bd05abd58f4bf0b0ac7906c0"
|
|
58
58
|
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
// A stack is a parent laid out with a non-wrapping flex, as DM derives it; an internal container writes its
|
|
5
5
|
// layout in its `@origami-target internal-container-content-wrapper` block. `flex-direction` says which way
|
|
6
|
-
// it stacks (column → vertical,
|
|
6
|
+
// it stacks (column → vertical, row or none → horizontal). Any other value, such as `inherit` or `var(--d)`,
|
|
7
|
+
// fails DM's import, so its children aren't checked here.
|
|
7
8
|
//
|
|
8
9
|
// Parent and child are the JSX tree's, so the tree comes from the item's structure file (see
|
|
9
10
|
// structureFile.js). The stylesheet is the page's, with its carriers already inlined (see
|
|
@@ -133,12 +134,16 @@ const effective = (byCondition, condition) => {
|
|
|
133
134
|
const selectorOf = (declaration, id) =>
|
|
134
135
|
declaration.parent.selectors.some(selector => selector.trim() === `#${id}`) ? `#${id}` : `.${id}`
|
|
135
136
|
|
|
137
|
+
// The flex-direction values DM's import accepts, matched as written.
|
|
138
|
+
const DIRECTIONS = { row: 'horizontal', 'row-reverse': 'horizontal', column: 'vertical', 'column-reverse': 'vertical' }
|
|
139
|
+
|
|
136
140
|
/** 'vertical' or 'horizontal' when these declarations make a stack, else undefined. */
|
|
137
141
|
const directionOf = declarations => {
|
|
138
142
|
if (declarations.get('display')?.value.trim() !== 'flex') return undefined
|
|
139
143
|
const wrap = declarations.get('flex-wrap')?.value.trim()
|
|
140
144
|
if (wrap !== undefined && wrap !== 'nowrap') return undefined
|
|
141
|
-
|
|
145
|
+
const direction = declarations.get('flex-direction')?.value.trim() ?? 'row'
|
|
146
|
+
return Object.hasOwn(DIRECTIONS, direction) ? DIRECTIONS[direction] : undefined
|
|
142
147
|
}
|
|
143
148
|
|
|
144
149
|
/** ` (layout.css:12)`: the carrier the declaration was written in, which the bundler doesn't name. */
|