@plumeria/utils 21.1.1 → 21.1.3

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) zss-in-js contributors
3
+ Copyright (c) zss-labs contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/parser.js CHANGED
@@ -2200,6 +2200,8 @@ function runScan(scanCwd, styleProp) {
2200
2200
  return;
2201
2201
  if (node.elements.some((element) => element?.spread))
2202
2202
  throw new Error('[plumeria] Spread elements in a style array are not supported. List each style explicitly.');
2203
+ if (propName === styleProp)
2204
+ return;
2203
2205
  throw new Error('[plumeria] A style prop array contains an unsupported style expression. Use defined styles, null, false, undefined, or conditional branches of defined styles.');
2204
2206
  }
2205
2207
  if (!containsStyleReference(node))
package/dist/transform.js CHANGED
@@ -2456,6 +2456,11 @@ const transformSource = async (env) => {
2456
2456
  }
2457
2457
  if (!node.value || node.value.type !== 'JSXExpressionContainer')
2458
2458
  return;
2459
+ const appliedBefore = receivesStyleProp
2460
+ ? new Set(appliedStyleProps)
2461
+ : null;
2462
+ if (appliedBefore)
2463
+ appliedStyleProps.clear();
2459
2464
  const expr = node.value.expression;
2460
2465
  const args = expr.type === 'ArrayExpression'
2461
2466
  ? expr.elements
@@ -2543,6 +2548,20 @@ const transformSource = async (env) => {
2543
2548
  content: `${keptClass}${styleAttr}`,
2544
2549
  });
2545
2550
  }
2551
+ if (appliedBefore) {
2552
+ const referenced = new Set(appliedStyleProps);
2553
+ for (const key of referenced) {
2554
+ const [owner, propName] = key.split(':');
2555
+ if (scannedTables.componentPropsTable?.[`${resourcePath}-${owner}`]?.[propName]) {
2556
+ throwCompilationError(`[plumeria] "${propName}" is a style received through a prop and cannot be passed on ` +
2557
+ `to a component that declares ${styleProp}. Apply it on an element this component renders.`, node);
2558
+ }
2559
+ }
2560
+ for (const applied of appliedBefore)
2561
+ appliedStyleProps.add(applied);
2562
+ for (const applied of referenced)
2563
+ appliedStyleProps.add(applied);
2564
+ }
2546
2565
  },
2547
2566
  CallExpression({ node }) {
2548
2567
  const callee = node.callee;
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@plumeria/utils",
3
- "version": "21.1.1",
3
+ "version": "21.1.3",
4
4
  "description": "Plumeria Utils",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
7
7
  "homepage": "https://plumeria.dev",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/zss-in-js/plumeria.git",
10
+ "url": "git+https://github.com/zss-labs/plumeria.git",
11
11
  "directory": "packages/utils"
12
12
  },
13
13
  "bugs": {
14
- "url": "https://github.com/zss-in-js/plumeria/issues"
14
+ "url": "https://github.com/zss-labs/plumeria/issues"
15
15
  },
16
16
  "sideEffects": false,
17
17
  "main": "dist/index.js",