app-studio 0.5.63 → 0.5.65
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/dist/animation/css.d.ts +5 -4
- package/dist/app-studio.cjs.development.js +167 -151
- package/dist/app-studio.cjs.development.js.map +1 -1
- package/dist/app-studio.cjs.production.min.js +1 -1
- package/dist/app-studio.esm.js +167 -151
- package/dist/app-studio.esm.js.map +1 -1
- package/dist/app-studio.umd.development.js +167 -151
- package/dist/app-studio.umd.development.js.map +1 -1
- package/dist/app-studio.umd.production.min.js +1 -1
- package/package.json +1 -1
package/dist/animation/css.d.ts
CHANGED
|
@@ -7,13 +7,9 @@ declare class UtilityClassManager {
|
|
|
7
7
|
private classCache;
|
|
8
8
|
private maxCacheSize;
|
|
9
9
|
private propertyShorthand;
|
|
10
|
-
private injectedRulesBase;
|
|
11
|
-
private injectedRulesMedia;
|
|
12
|
-
private injectedRulesModifier;
|
|
13
10
|
constructor(propertyShorthand: Record<string, string>, maxCacheSize?: number);
|
|
14
11
|
private initStyleSheets;
|
|
15
12
|
addDocument(targetDocument: Document): void;
|
|
16
|
-
private injectRuleToDocument;
|
|
17
13
|
private escapeClassName;
|
|
18
14
|
injectRule(cssRule: string, context?: StyleContext): void;
|
|
19
15
|
private getAllRegisteredDocuments;
|
|
@@ -21,6 +17,11 @@ declare class UtilityClassManager {
|
|
|
21
17
|
getClassNames(property: string, value: any, context: "base" | "pseudo" | "media" | "modifier" | undefined, modifier: string | undefined, getColor: (color: string) => string, mediaQueries?: string[]): string[];
|
|
22
18
|
removeDocument(targetDocument: Document): void;
|
|
23
19
|
clearCache(): void;
|
|
20
|
+
private clearStyleSheet;
|
|
21
|
+
regenerateStyles(targetDocument: Document): void;
|
|
22
|
+
regenerateAllStyles(): void;
|
|
23
|
+
private injectRuleToDocument;
|
|
24
|
+
printStyles(targetDocument: Document): void;
|
|
24
25
|
}
|
|
25
26
|
export declare const utilityClassManager: UtilityClassManager;
|
|
26
27
|
export declare const extractUtilityClasses: (props: ElementProps, getColor: (color: string) => string, mediaQueries: Record<string, string>, devices: Record<string, string[]>) => string[];
|
|
@@ -1260,9 +1260,6 @@ class UtilityClassManager {
|
|
|
1260
1260
|
this.mediaStyleSheet = new Map();
|
|
1261
1261
|
this.modifierStyleSheet = new Map();
|
|
1262
1262
|
this.classCache = new Map();
|
|
1263
|
-
this.injectedRulesBase = new Set();
|
|
1264
|
-
this.injectedRulesMedia = new Set();
|
|
1265
|
-
this.injectedRulesModifier = new Set();
|
|
1266
1263
|
this.propertyShorthand = propertyShorthand;
|
|
1267
1264
|
this.maxCacheSize = maxCacheSize;
|
|
1268
1265
|
if (typeof document !== 'undefined') {
|
|
@@ -1301,30 +1298,17 @@ class UtilityClassManager {
|
|
|
1301
1298
|
addDocument(targetDocument) {
|
|
1302
1299
|
this.initStyleSheets(targetDocument);
|
|
1303
1300
|
// Reinject all cached rules into the new document
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
case 'media':
|
|
1316
|
-
styleSheet = this.mediaStyleSheet.get(targetDocument) || null;
|
|
1317
|
-
break;
|
|
1318
|
-
case 'modifier':
|
|
1319
|
-
styleSheet = this.modifierStyleSheet.get(targetDocument) || null;
|
|
1320
|
-
break;
|
|
1321
|
-
}
|
|
1322
|
-
if (styleSheet) {
|
|
1323
|
-
try {
|
|
1324
|
-
styleSheet.insertRule(cssRule, styleSheet.cssRules.length);
|
|
1325
|
-
} catch (e) {
|
|
1326
|
-
console.error(`Error inserting CSS rule to document: "${cssRule}"`, e);
|
|
1327
|
-
}
|
|
1301
|
+
const values = Array.from(this.classCache.values());
|
|
1302
|
+
for (const {
|
|
1303
|
+
rules
|
|
1304
|
+
} of values) {
|
|
1305
|
+
rules.forEach(_ref => {
|
|
1306
|
+
let {
|
|
1307
|
+
rule,
|
|
1308
|
+
context
|
|
1309
|
+
} = _ref;
|
|
1310
|
+
this.injectRuleToDocument(rule, context, targetDocument);
|
|
1311
|
+
});
|
|
1328
1312
|
}
|
|
1329
1313
|
}
|
|
1330
1314
|
escapeClassName(className) {
|
|
@@ -1334,38 +1318,23 @@ class UtilityClassManager {
|
|
|
1334
1318
|
if (context === void 0) {
|
|
1335
1319
|
context = 'base';
|
|
1336
1320
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
case 'pseudo':
|
|
1341
|
-
injectedRules = this.injectedRulesBase;
|
|
1342
|
-
break;
|
|
1343
|
-
case 'media':
|
|
1344
|
-
injectedRules = this.injectedRulesMedia;
|
|
1345
|
-
break;
|
|
1346
|
-
case 'modifier':
|
|
1347
|
-
injectedRules = this.injectedRulesModifier;
|
|
1348
|
-
break;
|
|
1349
|
-
default:
|
|
1350
|
-
injectedRules = this.injectedRulesBase;
|
|
1351
|
-
}
|
|
1352
|
-
if (!injectedRules.has(cssRule)) {
|
|
1353
|
-
// Inject to all registered documents
|
|
1354
|
-
for (const targetDocument of this.getAllRegisteredDocuments()) {
|
|
1355
|
-
this.injectRuleToDocument(cssRule, context, targetDocument);
|
|
1356
|
-
}
|
|
1357
|
-
injectedRules.add(cssRule);
|
|
1321
|
+
// Inject to all registered documents
|
|
1322
|
+
for (const targetDocument of this.getAllRegisteredDocuments()) {
|
|
1323
|
+
this.injectRuleToDocument(cssRule, context, targetDocument);
|
|
1358
1324
|
}
|
|
1359
1325
|
}
|
|
1360
1326
|
getAllRegisteredDocuments() {
|
|
1361
1327
|
return Array.from(this.baseStyleSheet.keys());
|
|
1362
1328
|
}
|
|
1363
|
-
addToCache(key, className) {
|
|
1329
|
+
addToCache(key, className, rules) {
|
|
1364
1330
|
if (this.classCache.size >= this.maxCacheSize) {
|
|
1365
1331
|
const firstKey = this.classCache.keys().next().value;
|
|
1366
1332
|
if (firstKey) this.classCache.delete(firstKey);
|
|
1367
1333
|
}
|
|
1368
|
-
this.classCache.set(key,
|
|
1334
|
+
this.classCache.set(key, {
|
|
1335
|
+
className,
|
|
1336
|
+
rules
|
|
1337
|
+
});
|
|
1369
1338
|
}
|
|
1370
1339
|
getClassNames(property, value, context, modifier, getColor, mediaQueries) {
|
|
1371
1340
|
if (context === void 0) {
|
|
@@ -1393,10 +1362,10 @@ class UtilityClassManager {
|
|
|
1393
1362
|
if (modifier && context !== 'base') {
|
|
1394
1363
|
key = `${property}:${formattedValue}|${context}:${modifier}`;
|
|
1395
1364
|
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1365
|
+
const cached = this.classCache.get(key);
|
|
1366
|
+
if (cached) {
|
|
1367
|
+
return [cached.className];
|
|
1398
1368
|
}
|
|
1399
|
-
// Generate a unique class name with modifier
|
|
1400
1369
|
let shorthand = this.propertyShorthand[property];
|
|
1401
1370
|
if (!shorthand) {
|
|
1402
1371
|
shorthand = property.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
@@ -1404,53 +1373,64 @@ class UtilityClassManager {
|
|
|
1404
1373
|
let normalizedValue = formattedValue.toString().replace(/\./g, 'p').replace(/\s+/g, '-').replace(/[^a-zA-Z0-9\-]/g, '').replace(/%/g, 'pct').replace(/vw/g, 'vw').replace(/vh/g, 'vh').replace(/em/g, 'em').replace(/rem/g, 'rem');
|
|
1405
1374
|
let baseClassName = `${shorthand}-${normalizedValue}`;
|
|
1406
1375
|
let classNames = [baseClassName];
|
|
1407
|
-
|
|
1408
|
-
const pseudoClassName = `${baseClassName}--${modifier}`;
|
|
1409
|
-
classNames.push(pseudoClassName);
|
|
1410
|
-
} else if (context === 'media' && modifier) {
|
|
1411
|
-
mediaQueries.forEach(() => {
|
|
1412
|
-
const mediaClassName = `${modifier}--${baseClassName}`;
|
|
1413
|
-
classNames.push(mediaClassName);
|
|
1414
|
-
});
|
|
1415
|
-
} else {
|
|
1416
|
-
classNames.push(baseClassName);
|
|
1417
|
-
}
|
|
1376
|
+
let rules = [];
|
|
1418
1377
|
const cssProperty = property.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
1419
1378
|
let valueForCss = processedValue;
|
|
1420
|
-
if (typeof valueForCss === 'number') {
|
|
1421
|
-
|
|
1422
|
-
valueForCss = `${valueForCss}px`;
|
|
1423
|
-
}
|
|
1379
|
+
if (typeof valueForCss === 'number' && numericCssProperties.has(cssProperty)) {
|
|
1380
|
+
valueForCss = `${valueForCss}px`;
|
|
1424
1381
|
}
|
|
1425
|
-
|
|
1382
|
+
const generateRules = className => {
|
|
1426
1383
|
const escapedClassName = this.escapeClassName(className);
|
|
1427
|
-
let cssRules = [];
|
|
1428
1384
|
switch (context) {
|
|
1429
1385
|
case 'base':
|
|
1430
|
-
|
|
1386
|
+
rules.push({
|
|
1387
|
+
rule: `.${escapedClassName} { ${cssProperty}: ${valueForCss}; }`,
|
|
1388
|
+
context: 'base'
|
|
1389
|
+
});
|
|
1431
1390
|
break;
|
|
1432
1391
|
case 'pseudo':
|
|
1433
|
-
|
|
1392
|
+
rules.push({
|
|
1393
|
+
rule: `.${escapedClassName}:${modifier} { ${cssProperty}: ${valueForCss}; }`,
|
|
1394
|
+
context: 'pseudo'
|
|
1395
|
+
});
|
|
1434
1396
|
break;
|
|
1435
1397
|
case 'media':
|
|
1436
1398
|
mediaQueries.forEach(mq => {
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1399
|
+
rules.push({
|
|
1400
|
+
rule: `@media ${mq} { .${escapedClassName} { ${cssProperty}: ${valueForCss}; } }`,
|
|
1401
|
+
context: 'media'
|
|
1402
|
+
});
|
|
1403
|
+
if (window.isResponsive === true) {
|
|
1404
|
+
rules.push({
|
|
1405
|
+
rule: `.${modifier} { .${escapedClassName} { ${cssProperty}: ${valueForCss}; } }`,
|
|
1406
|
+
context: 'media'
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1443
1409
|
});
|
|
1444
|
-
|
|
1445
1410
|
break;
|
|
1446
|
-
default:
|
|
1447
|
-
cssRules.push(`.${escapedClassName} { ${cssProperty}: ${valueForCss}; }`);
|
|
1448
1411
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1412
|
+
};
|
|
1413
|
+
if (context === 'pseudo' && modifier) {
|
|
1414
|
+
const pseudoClassName = `${baseClassName}--${modifier}`;
|
|
1415
|
+
classNames = [pseudoClassName];
|
|
1416
|
+
generateRules(pseudoClassName);
|
|
1417
|
+
} else if (context === 'media' && modifier) {
|
|
1418
|
+
const mediaClassName = `${modifier}--${baseClassName}`;
|
|
1419
|
+
classNames = [mediaClassName];
|
|
1420
|
+
generateRules(mediaClassName);
|
|
1421
|
+
} else {
|
|
1422
|
+
generateRules(baseClassName);
|
|
1423
|
+
}
|
|
1424
|
+
// Inject all rules
|
|
1425
|
+
rules.forEach(_ref2 => {
|
|
1426
|
+
let {
|
|
1427
|
+
rule,
|
|
1428
|
+
context
|
|
1429
|
+
} = _ref2;
|
|
1430
|
+
this.injectRule(rule, context);
|
|
1453
1431
|
});
|
|
1432
|
+
// Cache the generated rules
|
|
1433
|
+
this.addToCache(key, classNames[0], rules);
|
|
1454
1434
|
return classNames;
|
|
1455
1435
|
}
|
|
1456
1436
|
removeDocument(targetDocument) {
|
|
@@ -1460,15 +1440,95 @@ class UtilityClassManager {
|
|
|
1460
1440
|
}
|
|
1461
1441
|
clearCache() {
|
|
1462
1442
|
this.classCache.clear();
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1443
|
+
}
|
|
1444
|
+
clearStyleSheet(styleSheet) {
|
|
1445
|
+
while (styleSheet.cssRules.length > 0) {
|
|
1446
|
+
styleSheet.deleteRule(0);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
regenerateStyles(targetDocument) {
|
|
1450
|
+
// Get all stylesheets for this document
|
|
1451
|
+
const baseSheet = this.baseStyleSheet.get(targetDocument);
|
|
1452
|
+
const mediaSheet = this.mediaStyleSheet.get(targetDocument);
|
|
1453
|
+
const modifierSheet = this.modifierStyleSheet.get(targetDocument);
|
|
1454
|
+
// Clear existing rules
|
|
1455
|
+
if (baseSheet) this.clearStyleSheet(baseSheet);
|
|
1456
|
+
if (mediaSheet) this.clearStyleSheet(mediaSheet);
|
|
1457
|
+
if (modifierSheet) this.clearStyleSheet(modifierSheet);
|
|
1458
|
+
// Reinject all cached rules
|
|
1459
|
+
const values = Array.from(this.classCache.values());
|
|
1460
|
+
for (const {
|
|
1461
|
+
rules
|
|
1462
|
+
} of values) {
|
|
1463
|
+
rules.forEach(_ref3 => {
|
|
1464
|
+
let {
|
|
1465
|
+
rule,
|
|
1466
|
+
context
|
|
1467
|
+
} = _ref3;
|
|
1468
|
+
this.injectRuleToDocument(rule, context, targetDocument);
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
regenerateAllStyles() {
|
|
1473
|
+
// Regenerate styles for all registered documents
|
|
1474
|
+
for (const document of this.getAllRegisteredDocuments()) {
|
|
1475
|
+
this.regenerateStyles(document);
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
injectRuleToDocument(cssRule, context, targetDocument) {
|
|
1479
|
+
let styleSheet = null;
|
|
1480
|
+
switch (context) {
|
|
1481
|
+
case 'base':
|
|
1482
|
+
case 'pseudo':
|
|
1483
|
+
styleSheet = this.baseStyleSheet.get(targetDocument) || null;
|
|
1484
|
+
break;
|
|
1485
|
+
case 'media':
|
|
1486
|
+
styleSheet = this.mediaStyleSheet.get(targetDocument) || null;
|
|
1487
|
+
break;
|
|
1488
|
+
case 'modifier':
|
|
1489
|
+
styleSheet = this.modifierStyleSheet.get(targetDocument) || null;
|
|
1490
|
+
break;
|
|
1491
|
+
}
|
|
1492
|
+
if (styleSheet) {
|
|
1493
|
+
try {
|
|
1494
|
+
styleSheet.insertRule(cssRule, styleSheet.cssRules.length);
|
|
1495
|
+
} catch (e) {
|
|
1496
|
+
console.error(`Error inserting CSS rule to document: "${cssRule}"`, e);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
// Optional: Add helpers for debugging
|
|
1501
|
+
printStyles(targetDocument) {
|
|
1502
|
+
console.group('Current styles for document:');
|
|
1503
|
+
console.group('Base styles:');
|
|
1504
|
+
const baseSheet = this.baseStyleSheet.get(targetDocument);
|
|
1505
|
+
if (baseSheet) {
|
|
1506
|
+
Array.from(baseSheet.cssRules).forEach((rule, i) => {
|
|
1507
|
+
console.log(`${i}: ${rule.cssText}`);
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
console.groupEnd();
|
|
1511
|
+
console.group('Media styles:');
|
|
1512
|
+
const mediaSheet = this.mediaStyleSheet.get(targetDocument);
|
|
1513
|
+
if (mediaSheet) {
|
|
1514
|
+
Array.from(mediaSheet.cssRules).forEach((rule, i) => {
|
|
1515
|
+
console.log(`${i}: ${rule.cssText}`);
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
console.groupEnd();
|
|
1519
|
+
console.group('Modifier styles:');
|
|
1520
|
+
const modifierSheet = this.modifierStyleSheet.get(targetDocument);
|
|
1521
|
+
if (modifierSheet) {
|
|
1522
|
+
Array.from(modifierSheet.cssRules).forEach((rule, i) => {
|
|
1523
|
+
console.log(`${i}: ${rule.cssText}`);
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
console.groupEnd();
|
|
1527
|
+
console.groupEnd();
|
|
1466
1528
|
}
|
|
1467
1529
|
}
|
|
1468
1530
|
/**
|
|
1469
1531
|
* Maps a React event to a CSS pseudo-class.
|
|
1470
|
-
* @param event The React event (e.g., 'hover', 'active')
|
|
1471
|
-
* @returns The corresponding CSS pseudo-class or null if unsupported.
|
|
1472
1532
|
*/
|
|
1473
1533
|
const mapEventToPseudo = event => {
|
|
1474
1534
|
const eventMap = {
|
|
@@ -1481,17 +1541,10 @@ const mapEventToPseudo = event => {
|
|
|
1481
1541
|
};
|
|
1482
1542
|
/**
|
|
1483
1543
|
* Generates shorthand abbreviations for CSS properties.
|
|
1484
|
-
* @param styledProps Array of CSS properties to abbreviate.
|
|
1485
|
-
* @returns An object mapping each CSS property to its abbreviation.
|
|
1486
1544
|
*/
|
|
1487
1545
|
function generatePropertyShorthand(styledProps) {
|
|
1488
1546
|
const propertyShorthand = {};
|
|
1489
1547
|
const usedAbbreviations = new Set();
|
|
1490
|
-
/**
|
|
1491
|
-
* Generates a unique abbreviation for a given CSS property.
|
|
1492
|
-
* @param prop The CSS property to abbreviate.
|
|
1493
|
-
* @returns The unique abbreviation generated.
|
|
1494
|
-
*/
|
|
1495
1548
|
function generateAbbreviation(prop) {
|
|
1496
1549
|
const first = prop[0].toLowerCase();
|
|
1497
1550
|
const last = prop[prop.length - 1].toLowerCase();
|
|
@@ -1504,7 +1557,7 @@ function generatePropertyShorthand(styledProps) {
|
|
|
1504
1557
|
let uniqueAbbr = abbr;
|
|
1505
1558
|
while (usedAbbreviations.has(uniqueAbbr)) {
|
|
1506
1559
|
i++;
|
|
1507
|
-
uniqueAbbr = abbr + prop.slice(-i
|
|
1560
|
+
uniqueAbbr = abbr + prop.slice(-i).toLowerCase();
|
|
1508
1561
|
}
|
|
1509
1562
|
usedAbbreviations.add(uniqueAbbr);
|
|
1510
1563
|
return uniqueAbbr;
|
|
@@ -1523,7 +1576,6 @@ function parseDuration(duration) {
|
|
|
1523
1576
|
const unit = match[2];
|
|
1524
1577
|
return unit === 's' ? value * 1000 : value;
|
|
1525
1578
|
}
|
|
1526
|
-
// Function to format a duration in milliseconds to a string with units
|
|
1527
1579
|
function formatDuration(ms) {
|
|
1528
1580
|
if (ms >= 1000 && ms % 1000 === 0) {
|
|
1529
1581
|
return `${ms / 1000}s`;
|
|
@@ -1532,10 +1584,9 @@ function formatDuration(ms) {
|
|
|
1532
1584
|
}
|
|
1533
1585
|
const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
1534
1586
|
const classes = [];
|
|
1535
|
-
// Computed styles based on props
|
|
1536
1587
|
const computedStyles = {};
|
|
1537
|
-
// Handle
|
|
1538
|
-
const size = props.height !== undefined && props.width !== undefined && props.height === props.width ? props.height : props.size
|
|
1588
|
+
// Handle size
|
|
1589
|
+
const size = props.height !== undefined && props.width !== undefined && props.height === props.width ? props.height : props.size || null;
|
|
1539
1590
|
if (size) {
|
|
1540
1591
|
const sizeValue = typeof size === 'number' ? `${size}px` : size;
|
|
1541
1592
|
computedStyles.width = sizeValue;
|
|
@@ -1562,7 +1613,7 @@ const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
|
1562
1613
|
computedStyles.marginTop = marginV;
|
|
1563
1614
|
computedStyles.marginBottom = marginV;
|
|
1564
1615
|
}
|
|
1565
|
-
//
|
|
1616
|
+
// Handle shadows
|
|
1566
1617
|
if (props.shadow) {
|
|
1567
1618
|
let shadowValue;
|
|
1568
1619
|
if (typeof props.shadow === 'number' && Shadows[props.shadow] !== undefined) {
|
|
@@ -1573,11 +1624,12 @@ const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
|
1573
1624
|
shadowValue = 2;
|
|
1574
1625
|
}
|
|
1575
1626
|
if (Shadows[shadowValue]) {
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1627
|
+
const {
|
|
1628
|
+
shadowColor,
|
|
1629
|
+
shadowOpacity,
|
|
1630
|
+
shadowOffset,
|
|
1631
|
+
shadowRadius
|
|
1632
|
+
} = Shadows[shadowValue];
|
|
1581
1633
|
const rgb = Color.hex.rgb(shadowColor);
|
|
1582
1634
|
const rgbaColor = `rgba(${rgb.join(',')}, ${shadowOpacity})`;
|
|
1583
1635
|
computedStyles.boxShadow = `${shadowOffset.height}px ${shadowOffset.width}px ${shadowRadius}px ${rgbaColor}`;
|
|
@@ -1594,7 +1646,7 @@ const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
|
1594
1646
|
const animationDirections = [];
|
|
1595
1647
|
const animationFillModes = [];
|
|
1596
1648
|
const animationPlayStates = [];
|
|
1597
|
-
let cumulativeTime = 0;
|
|
1649
|
+
let cumulativeTime = 0;
|
|
1598
1650
|
animations.forEach(animation => {
|
|
1599
1651
|
const {
|
|
1600
1652
|
keyframesName,
|
|
@@ -1604,16 +1656,10 @@ const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
|
1604
1656
|
utilityClassManager.injectRule(keyframes);
|
|
1605
1657
|
}
|
|
1606
1658
|
animationNames.push(keyframesName);
|
|
1607
|
-
|
|
1608
|
-
const
|
|
1609
|
-
const durationMs = parseDuration(durationStr);
|
|
1610
|
-
const delayStr = animation.delay || '0s';
|
|
1611
|
-
const delayMs = parseDuration(delayStr);
|
|
1612
|
-
// Calculate total delay for this animation
|
|
1659
|
+
const durationMs = parseDuration(animation.duration || '0s');
|
|
1660
|
+
const delayMs = parseDuration(animation.delay || '0s');
|
|
1613
1661
|
const totalDelayMs = cumulativeTime + delayMs;
|
|
1614
|
-
// Update cumulative time
|
|
1615
1662
|
cumulativeTime = totalDelayMs + durationMs;
|
|
1616
|
-
// Add formatted values to arrays
|
|
1617
1663
|
animationDurations.push(formatDuration(durationMs));
|
|
1618
1664
|
animationTimingFunctions.push(animation.timingFunction || 'ease');
|
|
1619
1665
|
animationDelays.push(formatDuration(totalDelayMs));
|
|
@@ -1631,12 +1677,7 @@ const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
|
1631
1677
|
computedStyles.animationFillMode = animationFillModes.join(', ');
|
|
1632
1678
|
computedStyles.animationPlayState = animationPlayStates.join(', ');
|
|
1633
1679
|
}
|
|
1634
|
-
|
|
1635
|
-
* Generates utility classes for a set of styles.
|
|
1636
|
-
* @param styles The styles to transform into utility classes.
|
|
1637
|
-
* @param context The context of the styles ('base', 'pseudo', 'media').
|
|
1638
|
-
* @param modifier The modifier for pseudo-classes or media queries.
|
|
1639
|
-
*/
|
|
1680
|
+
// Generate utility classes for computed styles
|
|
1640
1681
|
const generateUtilityClasses = function (styles, context, modifier) {
|
|
1641
1682
|
if (context === void 0) {
|
|
1642
1683
|
context = 'base';
|
|
@@ -1648,46 +1689,31 @@ const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
|
1648
1689
|
const value = styles[property];
|
|
1649
1690
|
let mediaQueriesForClass = [];
|
|
1650
1691
|
if (context === 'media') {
|
|
1651
|
-
// 'modifier' can be a breakpoint or a device
|
|
1652
1692
|
if (mediaQueries[modifier]) {
|
|
1653
1693
|
mediaQueriesForClass = [mediaQueries[modifier]];
|
|
1654
1694
|
} else if (devices[modifier]) {
|
|
1655
|
-
mediaQueriesForClass = devices[modifier].map(mq => mediaQueries[mq]).filter(mq => mq);
|
|
1695
|
+
mediaQueriesForClass = devices[modifier].map(mq => mediaQueries[mq]).filter(mq => mq);
|
|
1656
1696
|
}
|
|
1657
1697
|
}
|
|
1658
|
-
|
|
1659
1698
|
if (value !== undefined && value !== '') {
|
|
1660
|
-
const classNames = utilityClassManager.getClassNames(property, value, context, modifier, getColor,
|
|
1661
|
-
// Pass getColor with single parameter
|
|
1662
|
-
mediaQueriesForClass);
|
|
1699
|
+
const classNames = utilityClassManager.getClassNames(property, value, context, modifier, getColor, mediaQueriesForClass);
|
|
1663
1700
|
classes.push(...classNames);
|
|
1664
|
-
} else {
|
|
1665
|
-
if (window.isDebug === true) console.error({
|
|
1666
|
-
styles,
|
|
1667
|
-
value,
|
|
1668
|
-
property
|
|
1669
|
-
});
|
|
1670
1701
|
}
|
|
1671
1702
|
});
|
|
1672
1703
|
};
|
|
1673
|
-
// Generate utility classes for computed styles
|
|
1674
1704
|
generateUtilityClasses(computedStyles, 'base');
|
|
1675
|
-
// Iterate over
|
|
1705
|
+
// Iterate over remaining style props
|
|
1676
1706
|
Object.keys(props).forEach(property => {
|
|
1677
1707
|
if (property !== 'style' && (isStyleProp(property) || ['on', 'media'].includes(property))) {
|
|
1678
1708
|
const value = props[property];
|
|
1679
1709
|
if (typeof value === 'object' && value !== null) {
|
|
1680
1710
|
if (property === 'on') {
|
|
1681
|
-
// Styles related to events (pseudo-classes)
|
|
1682
1711
|
Object.keys(value).forEach(event => {
|
|
1683
1712
|
const eventStyles = value[event];
|
|
1684
|
-
// Separate transition properties and other properties
|
|
1685
|
-
// Extract 'animate' from event styles
|
|
1686
1713
|
const {
|
|
1687
1714
|
animate,
|
|
1688
1715
|
...otherEventStyles
|
|
1689
1716
|
} = eventStyles;
|
|
1690
|
-
// Handle animations in events
|
|
1691
1717
|
if (animate) {
|
|
1692
1718
|
const animations = Array.isArray(animate) ? animate : [animate];
|
|
1693
1719
|
const animationNames = [];
|
|
@@ -1715,7 +1741,6 @@ const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
|
1715
1741
|
animationFillModes.push(animation.fillMode || 'none');
|
|
1716
1742
|
animationPlayStates.push(animation.playState || 'running');
|
|
1717
1743
|
});
|
|
1718
|
-
// Create an object with animation properties
|
|
1719
1744
|
const animationStyles = {
|
|
1720
1745
|
animationName: animationNames.join(', '),
|
|
1721
1746
|
animationDuration: animationDurations.join(', '),
|
|
@@ -1726,10 +1751,8 @@ const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
|
1726
1751
|
animationFillMode: animationFillModes.join(', '),
|
|
1727
1752
|
animationPlayState: animationPlayStates.join(', ')
|
|
1728
1753
|
};
|
|
1729
|
-
// Merge animation styles with other event styles
|
|
1730
1754
|
Object.assign(otherEventStyles, animationStyles);
|
|
1731
1755
|
}
|
|
1732
|
-
// Generate classes for pseudo-classes
|
|
1733
1756
|
if (Object.keys(otherEventStyles).length > 0) {
|
|
1734
1757
|
const pseudo = mapEventToPseudo(event);
|
|
1735
1758
|
if (pseudo) {
|
|
@@ -1738,22 +1761,15 @@ const extractUtilityClasses = (props, getColor, mediaQueries, devices) => {
|
|
|
1738
1761
|
}
|
|
1739
1762
|
});
|
|
1740
1763
|
} else if (property === 'media') {
|
|
1741
|
-
// Conditional styles based on media queries or devices
|
|
1742
1764
|
Object.keys(value).forEach(screenOrDevice => {
|
|
1743
1765
|
const mediaStyles = value[screenOrDevice];
|
|
1744
1766
|
generateUtilityClasses(mediaStyles, 'media', screenOrDevice);
|
|
1745
1767
|
});
|
|
1746
1768
|
}
|
|
1747
1769
|
} else {
|
|
1748
|
-
// Generate a utility class for this property and value
|
|
1749
1770
|
if (value !== undefined && value !== '') {
|
|
1750
1771
|
const classNames = utilityClassManager.getClassNames(property, value, 'base', '', getColor, []);
|
|
1751
1772
|
classes.push(...classNames);
|
|
1752
|
-
} else {
|
|
1753
|
-
if (window.isDebug === true) console.error({
|
|
1754
|
-
value,
|
|
1755
|
-
property
|
|
1756
|
-
});
|
|
1757
1773
|
}
|
|
1758
1774
|
}
|
|
1759
1775
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-studio.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-studio.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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