@fluixi-css/core 0.1.0-next.0 → 1.0.0-next.1
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/package.json +1 -1
- package/dist/reset.css +10 -1
- package/dist/src/engine/atom.js +6 -1
- package/dist/src/engine/atom.js.map +1 -1
- package/dist/src/engine/directives.js +44 -1
- package/dist/src/engine/directives.js.map +1 -1
- package/dist/src/engine/index.js +4 -0
- package/dist/src/engine/index.js.map +1 -1
- package/dist/src/engine/scanner.js +34 -6
- package/dist/src/engine/scanner.js.map +1 -1
- package/dist/src/engine/transform.js +2 -0
- package/dist/src/engine/transform.js.map +1 -1
- package/dist/src/engine/utilities/filters.d.ts +2 -0
- package/dist/src/engine/utilities/filters.js +86 -0
- package/dist/src/engine/utilities/filters.js.map +1 -0
- package/dist/src/engine/utilities/gradients.d.ts +2 -0
- package/dist/src/engine/utilities/gradients.js +40 -0
- package/dist/src/engine/utilities/gradients.js.map +1 -0
- package/dist/src/engine/utilities/index.js +8 -0
- package/dist/src/engine/utilities/index.js.map +1 -1
- package/dist/src/engine/utilities/transforms.d.ts +2 -0
- package/dist/src/engine/utilities/transforms.js +63 -0
- package/dist/src/engine/utilities/transforms.js.map +1 -0
- package/dist/src/engine/utilities/transitions.d.ts +2 -0
- package/dist/src/engine/utilities/transitions.js +61 -0
- package/dist/src/engine/utilities/transitions.js.map +1 -0
- package/dist/src/engine/variants.d.ts +1 -0
- package/dist/src/engine/variants.js +12 -5
- package/dist/src/engine/variants.js.map +1 -1
- package/dist/src/index.cjs +419 -20
- package/dist/src/index.cjs.map +1 -1
- package/dist/src/index.mjs +419 -21
- package/dist/src/index.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/reset.css +10 -1
package/dist/src/index.cjs
CHANGED
|
@@ -421,7 +421,11 @@ function splitModifier(base) {
|
|
|
421
421
|
|
|
422
422
|
// In arbitrary values `_` stands in for a space; `\_` is a literal underscore.
|
|
423
423
|
function decodeUnderscores(value) {
|
|
424
|
-
|
|
424
|
+
// `_` → space, `\_` → literal `_`. But a URL may legitimately contain underscores,
|
|
425
|
+
// so leave the inside of `url(...)` verbatim (the split keeps url() at odd indices).
|
|
426
|
+
return value.split(/(url\([^)]*\))/g).map(function (part, i) {
|
|
427
|
+
return i % 2 === 1 ? part : part.replace(/\\_/g, '\0').replace(/_/g, ' ').replace(/\0/g, '_');
|
|
428
|
+
}).join('');
|
|
425
429
|
}
|
|
426
430
|
|
|
427
431
|
// An arbitrary value may lead with a `type:` hint, e.g. `[length:12px]`.
|
|
@@ -2394,7 +2398,15 @@ function registerVariant(atRule, reg) {
|
|
|
2394
2398
|
var prelude = ((_atRule$preludeText2 = atRule.preludeText) !== null && _atRule$preludeText2 !== void 0 ? _atRule$preludeText2 : '').trim();
|
|
2395
2399
|
if (!prelude) return;
|
|
2396
2400
|
|
|
2397
|
-
//
|
|
2401
|
+
// Block form: `@custom-variant name { &:hover { @slot } }` — the prelude is just
|
|
2402
|
+
// the name and the block describes the wrapping, marked by `@slot`.
|
|
2403
|
+
if (atRule.block) {
|
|
2404
|
+
var wrap = blockToWrap(atRule.block.children);
|
|
2405
|
+
if (prelude && wrap) reg.variant(prelude, wrap);
|
|
2406
|
+
return;
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
// Shorthand: `@custom-variant name (condition)`.
|
|
2398
2410
|
var paren = prelude.indexOf('(');
|
|
2399
2411
|
if (paren === -1 || !prelude.endsWith(')')) return;
|
|
2400
2412
|
var name = prelude.slice(0, paren).trim();
|
|
@@ -2402,6 +2414,43 @@ function registerVariant(atRule, reg) {
|
|
|
2402
2414
|
if (!name || !condition) return;
|
|
2403
2415
|
reg.variant(name, wrapFor(condition));
|
|
2404
2416
|
}
|
|
2417
|
+
|
|
2418
|
+
// Walk the single path down to `@slot`, collecting the selector (nested rules,
|
|
2419
|
+
// combined by `&` substitution) and/or the wrapping at-rule (`@media`, `@supports`).
|
|
2420
|
+
// Supports one selector level, one at-rule level, or both nested.
|
|
2421
|
+
function blockToWrap(children) {
|
|
2422
|
+
var selector;
|
|
2423
|
+
var at;
|
|
2424
|
+
var node = firstBlockChild(children);
|
|
2425
|
+
while (node) {
|
|
2426
|
+
if (node.type === 'rule') {
|
|
2427
|
+
var _rawSelector, _children;
|
|
2428
|
+
var sel = ((_rawSelector = node.rawSelector) !== null && _rawSelector !== void 0 ? _rawSelector : '').trim();
|
|
2429
|
+
selector = selector ? sel.replace(/&/g, selector) : sel;
|
|
2430
|
+
node = firstBlockChild((_children = node.children) !== null && _children !== void 0 ? _children : []);
|
|
2431
|
+
} else if (node.type === 'atrule') {
|
|
2432
|
+
var _ar$preludeText;
|
|
2433
|
+
var ar = node;
|
|
2434
|
+
if (ar.name === 'slot') break;
|
|
2435
|
+
at = {
|
|
2436
|
+
name: ar.name,
|
|
2437
|
+
params: ((_ar$preludeText = ar.preludeText) !== null && _ar$preludeText !== void 0 ? _ar$preludeText : '').trim()
|
|
2438
|
+
};
|
|
2439
|
+
node = ar.block ? firstBlockChild(ar.block.children) : undefined;
|
|
2440
|
+
} else {
|
|
2441
|
+
node = undefined;
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
var wrap = {};
|
|
2445
|
+
if (selector) wrap.selector = selector.includes('&') ? selector : "&".concat(selector);
|
|
2446
|
+
if (at) wrap.atRule = at;
|
|
2447
|
+
return wrap.selector || wrap.atRule ? wrap : null;
|
|
2448
|
+
}
|
|
2449
|
+
function firstBlockChild(children) {
|
|
2450
|
+
return children.find(function (c) {
|
|
2451
|
+
return c.type === 'rule' || c.type === 'atrule';
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2405
2454
|
function wrapFor(condition) {
|
|
2406
2455
|
if (condition[0] === '@') {
|
|
2407
2456
|
var cut = condition.search(/[\s(]/);
|
|
@@ -3180,10 +3229,10 @@ function registerEffects(reg) {
|
|
|
3180
3229
|
reg.dynamicRule('shadow', function (_ref) {
|
|
3181
3230
|
var value = _ref.value,
|
|
3182
3231
|
theme = _ref.theme;
|
|
3183
|
-
if (value === null) return wrap(theme.resolve('shadow', 'DEFAULT'));
|
|
3232
|
+
if (value === null) return wrap$1(theme.resolve('shadow', 'DEFAULT'));
|
|
3184
3233
|
if (value.kind === 'arbitrary') return [decl('box-shadow', value.value)];
|
|
3185
3234
|
if (value.value === 'none') return [decl('box-shadow', 'none')];
|
|
3186
|
-
return wrap(theme.resolve('shadow', value.value));
|
|
3235
|
+
return wrap$1(theme.resolve('shadow', value.value));
|
|
3187
3236
|
});
|
|
3188
3237
|
reg.dynamicRule('opacity', function (_ref2) {
|
|
3189
3238
|
var value = _ref2.value;
|
|
@@ -3227,7 +3276,7 @@ function registerEffects(reg) {
|
|
|
3227
3276
|
auto: 'auto'
|
|
3228
3277
|
});
|
|
3229
3278
|
}
|
|
3230
|
-
function wrap(shadow) {
|
|
3279
|
+
function wrap$1(shadow) {
|
|
3231
3280
|
return shadow ? [decl('box-shadow', shadow)] : null;
|
|
3232
3281
|
}
|
|
3233
3282
|
var BLEND = {
|
|
@@ -3249,6 +3298,131 @@ var BLEND = {
|
|
|
3249
3298
|
luminosity: 'luminosity'
|
|
3250
3299
|
};
|
|
3251
3300
|
|
|
3301
|
+
// Same composition trick as transforms: each utility sets a `--flx-*` var and
|
|
3302
|
+
// re-declares the composed `filter`, with identity defaults so any one is valid
|
|
3303
|
+
// alone and several compose (`blur-sm grayscale`).
|
|
3304
|
+
var FILTER = 'blur(var(--flx-blur,0)) brightness(var(--flx-brightness,1)) contrast(var(--flx-contrast,1)) ' + 'grayscale(var(--flx-grayscale,0)) hue-rotate(var(--flx-hue-rotate,0)) invert(var(--flx-invert,0)) ' + 'saturate(var(--flx-saturate,1)) sepia(var(--flx-sepia,0)) drop-shadow(var(--flx-drop-shadow,0 0 #0000))';
|
|
3305
|
+
var BACKDROP = 'blur(var(--flx-backdrop-blur,0)) brightness(var(--flx-backdrop-brightness,1)) ' + 'contrast(var(--flx-backdrop-contrast,1)) grayscale(var(--flx-backdrop-grayscale,0)) ' + 'opacity(var(--flx-backdrop-opacity,1)) saturate(var(--flx-backdrop-saturate,1))';
|
|
3306
|
+
var compose$1 = function compose(prop, val) {
|
|
3307
|
+
return [decl(prop, val), decl('filter', FILTER)];
|
|
3308
|
+
};
|
|
3309
|
+
var backdrop = function backdrop(prop, val) {
|
|
3310
|
+
return [decl(prop, val), decl('backdrop-filter', BACKDROP)];
|
|
3311
|
+
};
|
|
3312
|
+
function registerFilters(reg) {
|
|
3313
|
+
reg.rule('filter-none', [decl('filter', 'none')]);
|
|
3314
|
+
reg.rule('backdrop-filter-none', [decl('backdrop-filter', 'none')]);
|
|
3315
|
+
reg.dynamicRule('blur', function (_ref) {
|
|
3316
|
+
var value = _ref.value;
|
|
3317
|
+
return v(compose$1, '--flx-blur', named$1(value, BLUR));
|
|
3318
|
+
});
|
|
3319
|
+
reg.dynamicRule('brightness', function (_ref2) {
|
|
3320
|
+
var value = _ref2.value;
|
|
3321
|
+
return v(compose$1, '--flx-brightness', ratio(value));
|
|
3322
|
+
});
|
|
3323
|
+
reg.dynamicRule('contrast', function (_ref3) {
|
|
3324
|
+
var value = _ref3.value;
|
|
3325
|
+
return v(compose$1, '--flx-contrast', ratio(value));
|
|
3326
|
+
});
|
|
3327
|
+
reg.dynamicRule('saturate', function (_ref4) {
|
|
3328
|
+
var value = _ref4.value;
|
|
3329
|
+
return v(compose$1, '--flx-saturate', ratio(value));
|
|
3330
|
+
});
|
|
3331
|
+
reg.dynamicRule('grayscale', function (_ref5) {
|
|
3332
|
+
var value = _ref5.value;
|
|
3333
|
+
return v(compose$1, '--flx-grayscale', pct(value));
|
|
3334
|
+
});
|
|
3335
|
+
reg.dynamicRule('invert', function (_ref6) {
|
|
3336
|
+
var value = _ref6.value;
|
|
3337
|
+
return v(compose$1, '--flx-invert', pct(value));
|
|
3338
|
+
});
|
|
3339
|
+
reg.dynamicRule('sepia', function (_ref7) {
|
|
3340
|
+
var value = _ref7.value;
|
|
3341
|
+
return v(compose$1, '--flx-sepia', pct(value));
|
|
3342
|
+
});
|
|
3343
|
+
reg.dynamicRule('hue-rotate', function (_ref8) {
|
|
3344
|
+
var value = _ref8.value,
|
|
3345
|
+
negative = _ref8.negative;
|
|
3346
|
+
return v(compose$1, '--flx-hue-rotate', deg(value, negative));
|
|
3347
|
+
});
|
|
3348
|
+
reg.dynamicRule('drop-shadow', function (_ref9) {
|
|
3349
|
+
var value = _ref9.value;
|
|
3350
|
+
return v(compose$1, '--flx-drop-shadow', named$1(value, DROP_SHADOW));
|
|
3351
|
+
});
|
|
3352
|
+
reg.dynamicRule('backdrop-blur', function (_ref0) {
|
|
3353
|
+
var value = _ref0.value;
|
|
3354
|
+
return v(backdrop, '--flx-backdrop-blur', named$1(value, BLUR));
|
|
3355
|
+
});
|
|
3356
|
+
reg.dynamicRule('backdrop-brightness', function (_ref1) {
|
|
3357
|
+
var value = _ref1.value;
|
|
3358
|
+
return v(backdrop, '--flx-backdrop-brightness', ratio(value));
|
|
3359
|
+
});
|
|
3360
|
+
reg.dynamicRule('backdrop-contrast', function (_ref10) {
|
|
3361
|
+
var value = _ref10.value;
|
|
3362
|
+
return v(backdrop, '--flx-backdrop-contrast', ratio(value));
|
|
3363
|
+
});
|
|
3364
|
+
reg.dynamicRule('backdrop-saturate', function (_ref11) {
|
|
3365
|
+
var value = _ref11.value;
|
|
3366
|
+
return v(backdrop, '--flx-backdrop-saturate', ratio(value));
|
|
3367
|
+
});
|
|
3368
|
+
reg.dynamicRule('backdrop-grayscale', function (_ref12) {
|
|
3369
|
+
var value = _ref12.value;
|
|
3370
|
+
return v(backdrop, '--flx-backdrop-grayscale', pct(value));
|
|
3371
|
+
});
|
|
3372
|
+
reg.dynamicRule('backdrop-opacity', function (_ref13) {
|
|
3373
|
+
var value = _ref13.value;
|
|
3374
|
+
return v(backdrop, '--flx-backdrop-opacity', ratio(value));
|
|
3375
|
+
});
|
|
3376
|
+
}
|
|
3377
|
+
function v(build, prop, val) {
|
|
3378
|
+
return val === null ? null : build(prop, val);
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
/** number → decimal ratio (brightness-50 → 0.5); arbitrary passes through. */
|
|
3382
|
+
function ratio(value) {
|
|
3383
|
+
if (!value) return null;
|
|
3384
|
+
if (value.kind === 'arbitrary') return value.value;
|
|
3385
|
+
return /^\d+$/.test(value.value) ? "".concat(+value.value / 100) : null;
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
/** bare → 100%, `0` → 0%, number → number% (grayscale/invert/sepia). */
|
|
3389
|
+
function pct(value) {
|
|
3390
|
+
if (!value) return '100%';
|
|
3391
|
+
if (value.kind === 'arbitrary') return value.value;
|
|
3392
|
+
return /^\d+$/.test(value.value) ? "".concat(value.value, "%") : null;
|
|
3393
|
+
}
|
|
3394
|
+
function deg(value, negative) {
|
|
3395
|
+
if (!value) return null;
|
|
3396
|
+
if (value.kind === 'arbitrary') return negative ? "calc(".concat(value.value, " * -1)") : value.value;
|
|
3397
|
+
return /^\d+$/.test(value.value) ? "".concat(negative ? '-' : '').concat(value.value, "deg") : null;
|
|
3398
|
+
}
|
|
3399
|
+
function named$1(value, map) {
|
|
3400
|
+
var _map$, _map$value$value;
|
|
3401
|
+
if (!value) return (_map$ = map['']) !== null && _map$ !== void 0 ? _map$ : null;
|
|
3402
|
+
if (value.kind === 'arbitrary') return value.value;
|
|
3403
|
+
return (_map$value$value = map[value.value]) !== null && _map$value$value !== void 0 ? _map$value$value : null;
|
|
3404
|
+
}
|
|
3405
|
+
var BLUR = {
|
|
3406
|
+
'': '8px',
|
|
3407
|
+
none: '0',
|
|
3408
|
+
xs: '2px',
|
|
3409
|
+
sm: '4px',
|
|
3410
|
+
md: '12px',
|
|
3411
|
+
lg: '16px',
|
|
3412
|
+
xl: '24px',
|
|
3413
|
+
'2xl': '40px',
|
|
3414
|
+
'3xl': '64px'
|
|
3415
|
+
};
|
|
3416
|
+
var DROP_SHADOW = {
|
|
3417
|
+
'': '0 1px 2px rgb(0 0 0 / 0.1)',
|
|
3418
|
+
none: '0 0 #0000',
|
|
3419
|
+
sm: '0 1px 1px rgb(0 0 0 / 0.05)',
|
|
3420
|
+
md: '0 4px 3px rgb(0 0 0 / 0.07)',
|
|
3421
|
+
lg: '0 10px 8px rgb(0 0 0 / 0.04)',
|
|
3422
|
+
xl: '0 20px 13px rgb(0 0 0 / 0.03)',
|
|
3423
|
+
'2xl': '0 25px 25px rgb(0 0 0 / 0.15)'
|
|
3424
|
+
};
|
|
3425
|
+
|
|
3252
3426
|
function registerFlexGrid(reg) {
|
|
3253
3427
|
props(reg, 'flex-direction', {
|
|
3254
3428
|
'flex-row': 'row',
|
|
@@ -3411,6 +3585,44 @@ function line(reg, root, property) {
|
|
|
3411
3585
|
});
|
|
3412
3586
|
}
|
|
3413
3587
|
|
|
3588
|
+
function registerGradients(reg) {
|
|
3589
|
+
keywords(reg, 'bg-gradient-to', 'background-image', {
|
|
3590
|
+
t: 'linear-gradient(to top, var(--flx-gradient-stops))',
|
|
3591
|
+
tr: 'linear-gradient(to top right, var(--flx-gradient-stops))',
|
|
3592
|
+
r: 'linear-gradient(to right, var(--flx-gradient-stops))',
|
|
3593
|
+
br: 'linear-gradient(to bottom right, var(--flx-gradient-stops))',
|
|
3594
|
+
b: 'linear-gradient(to bottom, var(--flx-gradient-stops))',
|
|
3595
|
+
bl: 'linear-gradient(to bottom left, var(--flx-gradient-stops))',
|
|
3596
|
+
l: 'linear-gradient(to left, var(--flx-gradient-stops))',
|
|
3597
|
+
tl: 'linear-gradient(to top left, var(--flx-gradient-stops))'
|
|
3598
|
+
});
|
|
3599
|
+
|
|
3600
|
+
// Color stops build up `--flx-gradient-stops`. `from` seeds a two-stop list that
|
|
3601
|
+
// `to` fills in; `via` promotes it to three stops. A bare `to` with no `from`
|
|
3602
|
+
// still works because the from stop defaults to transparent.
|
|
3603
|
+
reg.dynamicRule('from', function (_ref) {
|
|
3604
|
+
var value = _ref.value,
|
|
3605
|
+
modifier = _ref.modifier,
|
|
3606
|
+
theme = _ref.theme;
|
|
3607
|
+
var color = colorValue(value, modifier, theme);
|
|
3608
|
+
return color ? [decl('--flx-gradient-from', color), decl('--flx-gradient-stops', 'var(--flx-gradient-from), var(--flx-gradient-to, transparent)')] : null;
|
|
3609
|
+
});
|
|
3610
|
+
reg.dynamicRule('via', function (_ref2) {
|
|
3611
|
+
var value = _ref2.value,
|
|
3612
|
+
modifier = _ref2.modifier,
|
|
3613
|
+
theme = _ref2.theme;
|
|
3614
|
+
var color = colorValue(value, modifier, theme);
|
|
3615
|
+
return color ? [decl('--flx-gradient-via', color), decl('--flx-gradient-stops', 'var(--flx-gradient-from, transparent), var(--flx-gradient-via), var(--flx-gradient-to, transparent)')] : null;
|
|
3616
|
+
});
|
|
3617
|
+
reg.dynamicRule('to', function (_ref3) {
|
|
3618
|
+
var value = _ref3.value,
|
|
3619
|
+
modifier = _ref3.modifier,
|
|
3620
|
+
theme = _ref3.theme;
|
|
3621
|
+
var color = colorValue(value, modifier, theme);
|
|
3622
|
+
return color ? [decl('--flx-gradient-to', color)] : null;
|
|
3623
|
+
});
|
|
3624
|
+
}
|
|
3625
|
+
|
|
3414
3626
|
function registerLayout(reg) {
|
|
3415
3627
|
props(reg, 'display', {
|
|
3416
3628
|
block: 'block',
|
|
@@ -3603,6 +3815,154 @@ function spacing(reg, root, props, allowAuto) {
|
|
|
3603
3815
|
});
|
|
3604
3816
|
}
|
|
3605
3817
|
|
|
3818
|
+
// Each transform utility sets its own `--flx-*` var and re-declares the composed
|
|
3819
|
+
// `transform`. The vars carry identity defaults (0 / 1) as fallbacks, so any single
|
|
3820
|
+
// utility is valid on its own and several compose (`rotate-45 scale-90`) without an
|
|
3821
|
+
// ordering dependency or a shared base rule.
|
|
3822
|
+
var REST = 'rotate(var(--flx-rotate,0)) skewX(var(--flx-skew-x,0)) skewY(var(--flx-skew-y,0)) ' + 'scaleX(var(--flx-scale-x,1)) scaleY(var(--flx-scale-y,1))';
|
|
3823
|
+
var TRANSFORM = "translate(var(--flx-translate-x,0),var(--flx-translate-y,0)) ".concat(REST);
|
|
3824
|
+
var TRANSFORM_GPU = "translate3d(var(--flx-translate-x,0),var(--flx-translate-y,0),0) ".concat(REST);
|
|
3825
|
+
var compose = function compose(prop, val) {
|
|
3826
|
+
return [decl(prop, val), decl('transform', TRANSFORM)];
|
|
3827
|
+
};
|
|
3828
|
+
function registerTransforms(reg) {
|
|
3829
|
+
var rotate = function rotate(v, neg) {
|
|
3830
|
+
return angle(v, neg);
|
|
3831
|
+
};
|
|
3832
|
+
reg.dynamicRule('rotate', function (_ref) {
|
|
3833
|
+
var value = _ref.value,
|
|
3834
|
+
negative = _ref.negative;
|
|
3835
|
+
var v = rotate(value, negative);
|
|
3836
|
+
return v ? compose('--flx-rotate', v) : null;
|
|
3837
|
+
});
|
|
3838
|
+
reg.dynamicRule('skew-x', function (_ref2) {
|
|
3839
|
+
var value = _ref2.value,
|
|
3840
|
+
negative = _ref2.negative;
|
|
3841
|
+
return wrap('--flx-skew-x', angle(value, negative));
|
|
3842
|
+
});
|
|
3843
|
+
reg.dynamicRule('skew-y', function (_ref3) {
|
|
3844
|
+
var value = _ref3.value,
|
|
3845
|
+
negative = _ref3.negative;
|
|
3846
|
+
return wrap('--flx-skew-y', angle(value, negative));
|
|
3847
|
+
});
|
|
3848
|
+
reg.dynamicRule('scale', function (_ref4) {
|
|
3849
|
+
var value = _ref4.value,
|
|
3850
|
+
negative = _ref4.negative;
|
|
3851
|
+
var v = scaleVal(value, negative);
|
|
3852
|
+
return v ? [decl('--flx-scale-x', v), decl('--flx-scale-y', v), decl('transform', TRANSFORM)] : null;
|
|
3853
|
+
});
|
|
3854
|
+
reg.dynamicRule('scale-x', function (_ref5) {
|
|
3855
|
+
var value = _ref5.value,
|
|
3856
|
+
negative = _ref5.negative;
|
|
3857
|
+
return wrap('--flx-scale-x', scaleVal(value, negative));
|
|
3858
|
+
});
|
|
3859
|
+
reg.dynamicRule('scale-y', function (_ref6) {
|
|
3860
|
+
var value = _ref6.value,
|
|
3861
|
+
negative = _ref6.negative;
|
|
3862
|
+
return wrap('--flx-scale-y', scaleVal(value, negative));
|
|
3863
|
+
});
|
|
3864
|
+
reg.dynamicRule('translate-x', function (_ref7) {
|
|
3865
|
+
var value = _ref7.value,
|
|
3866
|
+
negative = _ref7.negative,
|
|
3867
|
+
theme = _ref7.theme;
|
|
3868
|
+
return wrap('--flx-translate-x', sizeValue(value, theme, {
|
|
3869
|
+
negative: negative
|
|
3870
|
+
}));
|
|
3871
|
+
});
|
|
3872
|
+
reg.dynamicRule('translate-y', function (_ref8) {
|
|
3873
|
+
var value = _ref8.value,
|
|
3874
|
+
negative = _ref8.negative,
|
|
3875
|
+
theme = _ref8.theme;
|
|
3876
|
+
return wrap('--flx-translate-y', sizeValue(value, theme, {
|
|
3877
|
+
negative: negative
|
|
3878
|
+
}));
|
|
3879
|
+
});
|
|
3880
|
+
reg.rule('transform-none', [decl('transform', 'none')]);
|
|
3881
|
+
reg.rule('transform-gpu', [decl('transform', TRANSFORM_GPU)]);
|
|
3882
|
+
reg.rule('transform-cpu', [decl('transform', TRANSFORM)]);
|
|
3883
|
+
keywords(reg, 'origin', 'transform-origin', {
|
|
3884
|
+
center: 'center',
|
|
3885
|
+
top: 'top',
|
|
3886
|
+
'top-right': 'top right',
|
|
3887
|
+
right: 'right',
|
|
3888
|
+
'bottom-right': 'bottom right',
|
|
3889
|
+
bottom: 'bottom',
|
|
3890
|
+
'bottom-left': 'bottom left',
|
|
3891
|
+
left: 'left',
|
|
3892
|
+
'top-left': 'top left'
|
|
3893
|
+
});
|
|
3894
|
+
}
|
|
3895
|
+
function wrap(prop, val) {
|
|
3896
|
+
return val ? compose(prop, val) : null;
|
|
3897
|
+
}
|
|
3898
|
+
function angle(value, negative) {
|
|
3899
|
+
if (!value) return null;
|
|
3900
|
+
if (value.kind === 'arbitrary') return negative ? "calc(".concat(value.value, " * -1)") : value.value;
|
|
3901
|
+
return "".concat(negative ? '-' : '').concat(value.value, "deg");
|
|
3902
|
+
}
|
|
3903
|
+
function scaleVal(value, negative) {
|
|
3904
|
+
if (!value) return null;
|
|
3905
|
+
if (value.kind === 'arbitrary') return negative ? "calc(".concat(value.value, " * -1)") : value.value;
|
|
3906
|
+
if (!/^\d+$/.test(value.value)) return null;
|
|
3907
|
+
var n = (negative ? -1 : 1) * (+value.value / 100);
|
|
3908
|
+
return "".concat(n);
|
|
3909
|
+
}
|
|
3910
|
+
|
|
3911
|
+
var DEFAULT_EASE = 'cubic-bezier(0.4, 0, 0.2, 1)';
|
|
3912
|
+
function registerTransitions(reg) {
|
|
3913
|
+
// `transition` (+ named property groups) also seeds a sensible default duration
|
|
3914
|
+
// and timing function, matching what a bare `transition` is expected to animate.
|
|
3915
|
+
reg.dynamicRule('transition', function (_ref) {
|
|
3916
|
+
var _PROPERTY_GROUPS$valu;
|
|
3917
|
+
var value = _ref.value;
|
|
3918
|
+
var property = value === null ? 'color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter' : (_PROPERTY_GROUPS$valu = PROPERTY_GROUPS[value.value]) !== null && _PROPERTY_GROUPS$valu !== void 0 ? _PROPERTY_GROUPS$valu : value.kind === 'arbitrary' ? value.value : null;
|
|
3919
|
+
if (property === null) return null;
|
|
3920
|
+
if (property === 'none') return [decl('transition-property', 'none')];
|
|
3921
|
+
return [decl('transition-property', property), decl('transition-timing-function', DEFAULT_EASE), decl('transition-duration', '150ms')];
|
|
3922
|
+
});
|
|
3923
|
+
reg.dynamicRule('duration', function (_ref2) {
|
|
3924
|
+
var value = _ref2.value;
|
|
3925
|
+
return time('transition-duration', value);
|
|
3926
|
+
});
|
|
3927
|
+
reg.dynamicRule('delay', function (_ref3) {
|
|
3928
|
+
var value = _ref3.value;
|
|
3929
|
+
return time('transition-delay', value);
|
|
3930
|
+
});
|
|
3931
|
+
keywords(reg, 'ease', 'transition-timing-function', {
|
|
3932
|
+
linear: 'linear',
|
|
3933
|
+
"in": 'cubic-bezier(0.4, 0, 1, 1)',
|
|
3934
|
+
out: 'cubic-bezier(0, 0, 0.2, 1)',
|
|
3935
|
+
'in-out': DEFAULT_EASE
|
|
3936
|
+
});
|
|
3937
|
+
keywords(reg, 'animate', 'animation', {
|
|
3938
|
+
none: 'none',
|
|
3939
|
+
spin: 'spin 1s linear infinite',
|
|
3940
|
+
ping: 'ping 1s cubic-bezier(0, 0, 0.2, 1) infinite',
|
|
3941
|
+
pulse: 'pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite',
|
|
3942
|
+
bounce: 'bounce 1s infinite'
|
|
3943
|
+
});
|
|
3944
|
+
keywords(reg, 'will-change', 'will-change', {
|
|
3945
|
+
auto: 'auto',
|
|
3946
|
+
scroll: 'scroll-position',
|
|
3947
|
+
contents: 'contents',
|
|
3948
|
+
transform: 'transform'
|
|
3949
|
+
});
|
|
3950
|
+
}
|
|
3951
|
+
var PROPERTY_GROUPS = {
|
|
3952
|
+
none: 'none',
|
|
3953
|
+
all: 'all',
|
|
3954
|
+
colors: 'color, background-color, border-color, text-decoration-color, fill, stroke',
|
|
3955
|
+
opacity: 'opacity',
|
|
3956
|
+
shadow: 'box-shadow',
|
|
3957
|
+
transform: 'transform'
|
|
3958
|
+
};
|
|
3959
|
+
function time(prop, value) {
|
|
3960
|
+
if (!value) return null;
|
|
3961
|
+
if (value.kind === 'arbitrary') return [decl(prop, value.value)];
|
|
3962
|
+
if (/^\d+$/.test(value.value)) return [decl(prop, "".concat(value.value, "ms"))];
|
|
3963
|
+
return null;
|
|
3964
|
+
}
|
|
3965
|
+
|
|
3606
3966
|
function registerTypography(reg) {
|
|
3607
3967
|
// `text-` is overloaded: a colour token, a font-size token, or an arbitrary of
|
|
3608
3968
|
// either kind. Alignment/overflow keywords (`text-center`, `text-ellipsis`) are
|
|
@@ -3744,6 +4104,10 @@ function registerUtilities(reg) {
|
|
|
3744
4104
|
registerBackgrounds(reg);
|
|
3745
4105
|
registerBorders(reg);
|
|
3746
4106
|
registerEffects(reg);
|
|
4107
|
+
registerTransforms(reg);
|
|
4108
|
+
registerTransitions(reg);
|
|
4109
|
+
registerFilters(reg);
|
|
4110
|
+
registerGradients(reg);
|
|
3747
4111
|
}
|
|
3748
4112
|
|
|
3749
4113
|
function registerVariants(reg) {
|
|
@@ -3780,16 +4144,7 @@ function registerVariants(reg) {
|
|
|
3780
4144
|
reg.variant('ltr', {
|
|
3781
4145
|
selector: '&:where([dir="ltr"], [dir="ltr"] *)'
|
|
3782
4146
|
});
|
|
3783
|
-
|
|
3784
|
-
var bp = _arr[_i4];
|
|
3785
|
-
var min = reg.theme.get("--breakpoint-".concat(bp));
|
|
3786
|
-
if (min) reg.variant(bp, {
|
|
3787
|
-
atRule: {
|
|
3788
|
-
name: 'media',
|
|
3789
|
-
params: "(min-width: ".concat(min, ")")
|
|
3790
|
-
}
|
|
3791
|
-
});
|
|
3792
|
-
}
|
|
4147
|
+
registerBreakpointVariants(reg);
|
|
3793
4148
|
|
|
3794
4149
|
// `max-md`, `min-lg` resolve the named breakpoint from the theme; `max-[600px]`
|
|
3795
4150
|
// takes the width verbatim. `max-*` overrides the `max-w`/`max-h` utilities here
|
|
@@ -3841,6 +4196,23 @@ function registerVariants(reg) {
|
|
|
3841
4196
|
} : null;
|
|
3842
4197
|
});
|
|
3843
4198
|
}
|
|
4199
|
+
|
|
4200
|
+
// The named breakpoints (`sm:`/`md:`/…) are static variants, so their media params
|
|
4201
|
+
// bake the theme value at registration. A `@theme { --breakpoint-md: … }` override
|
|
4202
|
+
// loaded later wouldn't reach them — so compile() re-runs this after loadTheme to
|
|
4203
|
+
// pick up overrides. (The dynamic `min-*`/`max-*` already resolve at apply time.)
|
|
4204
|
+
function registerBreakpointVariants(reg) {
|
|
4205
|
+
for (var _i4 = 0, _arr = ['sm', 'md', 'lg', 'xl', '2xl']; _i4 < _arr.length; _i4++) {
|
|
4206
|
+
var bp = _arr[_i4];
|
|
4207
|
+
var min = reg.theme.get("--breakpoint-".concat(bp));
|
|
4208
|
+
if (min) reg.variant(bp, {
|
|
4209
|
+
atRule: {
|
|
4210
|
+
name: 'media',
|
|
4211
|
+
params: "(min-width: ".concat(min, ")")
|
|
4212
|
+
}
|
|
4213
|
+
});
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
3844
4216
|
function mediaWidth(feature, value) {
|
|
3845
4217
|
return value ? {
|
|
3846
4218
|
atRule: {
|
|
@@ -3940,13 +4312,26 @@ function scanAtoms(source) {
|
|
|
3940
4312
|
continue;
|
|
3941
4313
|
}
|
|
3942
4314
|
var j = i;
|
|
3943
|
-
var
|
|
4315
|
+
var bracket = 0;
|
|
4316
|
+
var paren = 0;
|
|
3944
4317
|
while (j < n) {
|
|
3945
4318
|
var c = source[j];
|
|
3946
|
-
if (c === '[')
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
4319
|
+
if (c === '[') {
|
|
4320
|
+
bracket++;
|
|
4321
|
+
} else if (c === ']') {
|
|
4322
|
+
if (bracket === 0) break;
|
|
4323
|
+
bracket--;
|
|
4324
|
+
} else if (bracket > 0) ; else if (c === '(') {
|
|
4325
|
+
// Keep a shorthand paren whole (`bg-(--brand)`, `text-(length:--x)`), but
|
|
4326
|
+
// treat a plain function call (`clsx(…)`) as a boundary so its args scan.
|
|
4327
|
+
if (paren === 0 && !isShorthandParen(source, j)) break;
|
|
4328
|
+
paren++;
|
|
4329
|
+
} else if (c === ')') {
|
|
4330
|
+
if (paren === 0) break;
|
|
4331
|
+
paren--;
|
|
4332
|
+
} else if (paren === 0 && BOUNDARY.has(c)) {
|
|
4333
|
+
break;
|
|
4334
|
+
}
|
|
3950
4335
|
j++;
|
|
3951
4336
|
}
|
|
3952
4337
|
add(found, source.slice(i, j));
|
|
@@ -3954,6 +4339,15 @@ function scanAtoms(source) {
|
|
|
3954
4339
|
}
|
|
3955
4340
|
return _toConsumableArray(found);
|
|
3956
4341
|
}
|
|
4342
|
+
|
|
4343
|
+
// A `(` opens a class shorthand when it holds a CSS var (`(--brand)`) or a typed
|
|
4344
|
+
// value (`(length:--x)`) — otherwise it's a function call and ends the token.
|
|
4345
|
+
function isShorthandParen(s, open) {
|
|
4346
|
+
if (s[open + 1] === '-' && s[open + 2] === '-') return true;
|
|
4347
|
+
var k = open + 1;
|
|
4348
|
+
while (k < s.length && /[a-zA-Z-]/.test(s[k])) k++;
|
|
4349
|
+
return k > open + 1 && s[k] === ':';
|
|
4350
|
+
}
|
|
3957
4351
|
function add(found, token) {
|
|
3958
4352
|
// Trailing sentence/markup punctuation is never part of a class.
|
|
3959
4353
|
var cleaned = token.replace(/[.,;:]+$/, '');
|
|
@@ -4210,6 +4604,7 @@ function transform(input) {
|
|
|
4210
4604
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4211
4605
|
var reg = (_options$registry = options.registry) !== null && _options$registry !== void 0 ? _options$registry : createRegistry();
|
|
4212
4606
|
loadTheme(input, reg.theme);
|
|
4607
|
+
registerBreakpointVariants(reg); // pick up any @theme breakpoint overrides
|
|
4213
4608
|
loadDirectives(input, reg);
|
|
4214
4609
|
var classes = new Set((_options$classes = options.classes) !== null && _options$classes !== void 0 ? _options$classes : []);
|
|
4215
4610
|
var _iterator = _createForOfIteratorHelper((_options$sources = options.sources) !== null && _options$sources !== void 0 ? _options$sources : []),
|
|
@@ -4380,6 +4775,9 @@ function compile(input) {
|
|
|
4380
4775
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4381
4776
|
var reg = (_options$registry = options.registry) !== null && _options$registry !== void 0 ? _options$registry : createRegistry();
|
|
4382
4777
|
loadTheme(input, reg.theme);
|
|
4778
|
+
// Re-seed the named breakpoint variants so a `@theme` breakpoint override reaches
|
|
4779
|
+
// `sm:`/`md:`/… (they baked the default value at registry-creation time).
|
|
4780
|
+
registerBreakpointVariants(reg);
|
|
4383
4781
|
loadDirectives(input, reg);
|
|
4384
4782
|
var classes = new Set((_options$classes = options.classes) !== null && _options$classes !== void 0 ? _options$classes : []);
|
|
4385
4783
|
var _iterator2 = _createForOfIteratorHelper((_options$sources = options.sources) !== null && _options$sources !== void 0 ? _options$sources : []),
|
|
@@ -4502,6 +4900,7 @@ exports.parseSources = parseSources;
|
|
|
4502
4900
|
exports.parseVariant = parseVariant;
|
|
4503
4901
|
exports.props = props;
|
|
4504
4902
|
exports.raw = raw;
|
|
4903
|
+
exports.registerBreakpointVariants = registerBreakpointVariants;
|
|
4505
4904
|
exports.registerUtilities = registerUtilities;
|
|
4506
4905
|
exports.registerVariants = registerVariants;
|
|
4507
4906
|
exports.resolveSourceFiles = resolveSourceFiles;
|