@idealyst/theme 1.2.25 → 1.2.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 +1 -1
- package/src/babel/plugin.js +19 -0
package/package.json
CHANGED
package/src/babel/plugin.js
CHANGED
|
@@ -374,6 +374,16 @@ function findIteratorPattern(t, node, themeParam, debugLog = () => {}) {
|
|
|
374
374
|
return;
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
+
// $typography is a top-level iterator (uses typography keys)
|
|
378
|
+
// Pattern: theme.sizes.$typography.fontSize expands to h1, h2, body1, etc.
|
|
379
|
+
if (iteratorName === 'typography') {
|
|
380
|
+
result = {
|
|
381
|
+
type: 'typography',
|
|
382
|
+
accessPath: chain.slice(i + 1),
|
|
383
|
+
};
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
|
|
377
387
|
if (i > 0 && chain[i - 1] === 'sizes') {
|
|
378
388
|
result = {
|
|
379
389
|
type: 'sizes',
|
|
@@ -432,6 +442,9 @@ function expandVariantWithIterator(t, valueNode, themeParam, keys, iteratorInfo,
|
|
|
432
442
|
|
|
433
443
|
if (iteratorInfo.type === 'intents') {
|
|
434
444
|
keysToExpand = keys?.intents || [];
|
|
445
|
+
} else if (iteratorInfo.type === 'typography') {
|
|
446
|
+
// Typography is a top-level key array (h1, h2, body1, etc.)
|
|
447
|
+
keysToExpand = keys?.typography || [];
|
|
435
448
|
} else if (iteratorInfo.type === 'sizes' && iteratorInfo.componentName) {
|
|
436
449
|
keysToExpand = keys?.sizes?.[iteratorInfo.componentName] || [];
|
|
437
450
|
}
|
|
@@ -483,6 +496,12 @@ function replaceIteratorRefs(t, node, themeParam, iteratorInfo, key) {
|
|
|
483
496
|
dollarIndex = i;
|
|
484
497
|
break;
|
|
485
498
|
}
|
|
499
|
+
// Typography iterator: theme.sizes.$typography.X -> theme.sizes.typography.{key}.X
|
|
500
|
+
if (iteratorInfo.type === 'typography' && iterName === 'typography') {
|
|
501
|
+
hasIterator = true;
|
|
502
|
+
dollarIndex = i;
|
|
503
|
+
break;
|
|
504
|
+
}
|
|
486
505
|
if (iteratorInfo.type === 'sizes' && iterName === iteratorInfo.componentName && i > 0 && chain[i - 1] === 'sizes') {
|
|
487
506
|
hasIterator = true;
|
|
488
507
|
dollarIndex = i;
|