@wix/origami-transforms 0.1.4 → 0.1.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": "@wix/origami-transforms",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
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": "35811fffdca1725e0dd686efa31f1755a08fb3d17f32f9d20b06a808"
57
+ "falconPackageHash": "ca2361f449d0870ec5720dae8f71767a7dadabb976f2ed36c1481607"
58
58
  }
@@ -7,7 +7,7 @@ scrolling and clipping. The content wrapper arranges the children.
7
7
  In site-owned `layout.css`, `@origami-target` says which wrapper a style belongs to:
8
8
 
9
9
  ```css
10
- #container {
10
+ .container {
11
11
  --container-layout-type: FlexContainerLayout;
12
12
 
13
13
  @origami-target internal-container-content-wrapper {
@@ -68,7 +68,7 @@ check and collect the target nodes from the updated stylesheet.
68
68
  - `compiler.js` builds wrapper selectors, adds base styles and moves declarations.
69
69
 
70
70
  Targets must come from site-owned `layout.css` and belong to a single component ID
71
- rule. Unsupported targets or properties fail with an error rather than being ignored.
71
+ rule, written as `.compId` or `#compId`. Unsupported targets or properties fail with an error rather than being ignored.
72
72
 
73
73
  This plugin generates CSS; the runtime supplies the wrapper elements. SPX values
74
74
  are converted afterward by the SPX plugin.
@@ -41,7 +41,7 @@ export const compileContainers = (root, context) => {
41
41
  for (const owner of rules) {
42
42
  const { contentClass, overflowClass } = buildContainerClasses(owner.selector.slice(1))
43
43
  // In @scope, an unqualified selector cannot select the scoping root. DM emits
44
- // #id there too; :where(:scope) includes that root without adding specificity.
44
+ // the owner selector there too; :where(:scope) includes that root without adding specificity.
45
45
  let selector = owner.selector
46
46
  for (let ancestor = owner.parent; ancestor && ancestor.type !== 'root'; ancestor = ancestor.parent) {
47
47
  if (ancestor.type === 'atrule' && ancestor.name === 'scope') {
@@ -22,7 +22,12 @@ export const parseTargets = (root, context) => {
22
22
  const name = target.params.trim()
23
23
  if (!Object.hasOwn(targets, name)) throw target.error(`Unknown @origami-target ${name}`)
24
24
  const owner = target.parent
25
- if (owner?.type !== 'rule' || !owner.selector.startsWith('#') || !isValidContainerId(owner.selector.slice(1))) {
25
+ // DM writes component rules as .compId; #compId is still accepted.
26
+ if (
27
+ owner?.type !== 'rule' ||
28
+ !['.', '#'].includes(owner.selector[0]) ||
29
+ !isValidContainerId(owner.selector.slice(1))
30
+ ) {
26
31
  throw target.error('@origami-target requires a single component ID rule')
27
32
  }
28
33
  for (let ancestor = owner.parent; ancestor && ancestor.type !== 'root'; ancestor = ancestor.parent) {