@fluixi-css/core 0.1.0-next.0 → 1.0.0-next.2
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 +178 -147
- package/dist/src/css-parser.cjs +6 -1
- package/dist/src/css-parser.cjs.map +1 -1
- package/dist/src/css-parser.js +6 -2
- package/dist/src/css-parser.js.map +1 -1
- package/dist/src/css-parser.mjs +6 -1
- package/dist/src/css-parser.mjs.map +1 -1
- package/dist/src/engine/apply.d.ts +2 -0
- package/dist/src/engine/apply.js +75 -0
- package/dist/src/engine/apply.js.map +1 -0
- package/dist/src/engine/ast.js +25 -2
- package/dist/src/engine/ast.js.map +1 -1
- package/dist/src/engine/atom.js +6 -1
- package/dist/src/engine/atom.js.map +1 -1
- package/dist/src/engine/compile.js +48 -10
- package/dist/src/engine/compile.js.map +1 -1
- package/dist/src/engine/directives.js +89 -20
- package/dist/src/engine/directives.js.map +1 -1
- package/dist/src/engine/index.d.ts +4 -0
- package/dist/src/engine/index.js +10 -0
- package/dist/src/engine/index.js.map +1 -1
- package/dist/src/engine/log.d.ts +6 -0
- package/dist/src/engine/log.js +42 -0
- package/dist/src/engine/log.js.map +1 -0
- package/dist/src/engine/registry.d.ts +5 -4
- package/dist/src/engine/registry.js +2 -2
- package/dist/src/engine/registry.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.d.ts +22 -0
- package/dist/src/engine/transform.js +36 -9
- package/dist/src/engine/transform.js.map +1 -1
- package/dist/src/engine/utilities/backgrounds.js +11 -0
- package/dist/src/engine/utilities/backgrounds.js.map +1 -1
- package/dist/src/engine/utilities/borders.js +60 -1
- package/dist/src/engine/utilities/borders.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/layout.js +25 -0
- package/dist/src/engine/utilities/layout.js.map +1 -1
- package/dist/src/engine/utilities/spacing.js +25 -1
- package/dist/src/engine/utilities/spacing.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/utilities/typography.js +7 -0
- package/dist/src/engine/utilities/typography.js.map +1 -1
- package/dist/src/engine/variants.d.ts +1 -0
- package/dist/src/engine/variants.js +37 -11
- package/dist/src/engine/variants.js.map +1 -1
- package/dist/src/index.cjs +1038 -199
- package/dist/src/index.cjs.map +1 -1
- package/dist/src/index.mjs +1036 -200
- package/dist/src/index.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/reset.css +178 -147
package/dist/src/index.mjs
CHANGED
|
@@ -273,6 +273,34 @@ var Writer = /*#__PURE__*/function () {
|
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
+
|
|
277
|
+
// Emit verbatim text (a passed-through author slice or the reset) mapping each
|
|
278
|
+
// of its lines to consecutive source lines — so multi-line blocks are covered,
|
|
279
|
+
// not just their first line.
|
|
280
|
+
}, {
|
|
281
|
+
key: "emitMapped",
|
|
282
|
+
value: function emitMapped(text, loc) {
|
|
283
|
+
if (!this.map) {
|
|
284
|
+
this.emit(text);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
var lines = text.split('\n');
|
|
288
|
+
for (var i = 0; i < lines.length; i++) {
|
|
289
|
+
this.map.addMapping({
|
|
290
|
+
source: loc.source,
|
|
291
|
+
original: {
|
|
292
|
+
line: loc.line + i,
|
|
293
|
+
column: i === 0 ? loc.column : 0
|
|
294
|
+
},
|
|
295
|
+
generated: {
|
|
296
|
+
line: this.line,
|
|
297
|
+
column: this.column
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
this.emit(lines[i]);
|
|
301
|
+
if (i < lines.length - 1) this.emit('\n');
|
|
302
|
+
}
|
|
303
|
+
}
|
|
276
304
|
}]);
|
|
277
305
|
}();
|
|
278
306
|
function stringify(nodes) {
|
|
@@ -328,8 +356,8 @@ function write(node, depth, opts, w) {
|
|
|
328
356
|
}
|
|
329
357
|
if (node.kind === 'raw') {
|
|
330
358
|
w.emit(pad);
|
|
331
|
-
w.
|
|
332
|
-
w.emit(
|
|
359
|
+
if (node.loc) w.emitMapped(node.text, node.loc);else w.emit(node.text);
|
|
360
|
+
w.emit(nl);
|
|
333
361
|
return;
|
|
334
362
|
}
|
|
335
363
|
var header = node.kind === 'rule' ? node.selector : "@".concat(node.name).concat(node.params ? ' ' + node.params : '');
|
|
@@ -419,7 +447,11 @@ function splitModifier(base) {
|
|
|
419
447
|
|
|
420
448
|
// In arbitrary values `_` stands in for a space; `\_` is a literal underscore.
|
|
421
449
|
function decodeUnderscores(value) {
|
|
422
|
-
|
|
450
|
+
// `_` → space, `\_` → literal `_`. But a URL may legitimately contain underscores,
|
|
451
|
+
// so leave the inside of `url(...)` verbatim (the split keeps url() at odd indices).
|
|
452
|
+
return value.split(/(url\([^)]*\))/g).map(function (part, i) {
|
|
453
|
+
return i % 2 === 1 ? part : part.replace(/\\_/g, '\0').replace(/_/g, ' ').replace(/\0/g, '_');
|
|
454
|
+
}).join('');
|
|
423
455
|
}
|
|
424
456
|
|
|
425
457
|
// An arbitrary value may lead with a `type:` hint, e.g. `[length:12px]`.
|
|
@@ -667,6 +699,298 @@ function splitRootValue(base, ctx) {
|
|
|
667
699
|
};
|
|
668
700
|
}
|
|
669
701
|
|
|
702
|
+
// Turns a parsed atom into CSS. Returns null when the utility or any of its
|
|
703
|
+
// variants aren't registered, so an unknown class simply produces nothing.
|
|
704
|
+
function compileAtom(atom, reg) {
|
|
705
|
+
var produced = producedFor(atom, reg);
|
|
706
|
+
if (!produced || produced.length === 0) return null;
|
|
707
|
+
var flat = [];
|
|
708
|
+
var nested = [];
|
|
709
|
+
var _iterator = _createForOfIteratorHelper(produced),
|
|
710
|
+
_step;
|
|
711
|
+
try {
|
|
712
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
713
|
+
var node = _step.value;
|
|
714
|
+
if (node.kind === 'declaration') flat.push(node);else nested.push(node);
|
|
715
|
+
}
|
|
716
|
+
} catch (err) {
|
|
717
|
+
_iterator.e(err);
|
|
718
|
+
} finally {
|
|
719
|
+
_iterator.f();
|
|
720
|
+
}
|
|
721
|
+
if (atom.important) {
|
|
722
|
+
var _iterator2 = _createForOfIteratorHelper(flat),
|
|
723
|
+
_step2;
|
|
724
|
+
try {
|
|
725
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
726
|
+
var d = _step2.value;
|
|
727
|
+
d.important = true;
|
|
728
|
+
}
|
|
729
|
+
} catch (err) {
|
|
730
|
+
_iterator2.e(err);
|
|
731
|
+
} finally {
|
|
732
|
+
_iterator2.f();
|
|
733
|
+
}
|
|
734
|
+
var _iterator3 = _createForOfIteratorHelper(nested),
|
|
735
|
+
_step3;
|
|
736
|
+
try {
|
|
737
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
738
|
+
var n = _step3.value;
|
|
739
|
+
markImportant$1(n.nodes);
|
|
740
|
+
}
|
|
741
|
+
} catch (err) {
|
|
742
|
+
_iterator3.e(err);
|
|
743
|
+
} finally {
|
|
744
|
+
_iterator3.f();
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
var selector = '.' + escapeClass(atom.raw);
|
|
748
|
+
var atRules = [];
|
|
749
|
+
var _iterator4 = _createForOfIteratorHelper(atom.variants),
|
|
750
|
+
_step4;
|
|
751
|
+
try {
|
|
752
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
753
|
+
var variant = _step4.value;
|
|
754
|
+
var wrap = resolveVariant(variant, reg);
|
|
755
|
+
if (!wrap) return null;
|
|
756
|
+
if (wrap.selector) selector = substitute(wrap.selector, selector);
|
|
757
|
+
if (wrap.atRule) atRules.push(wrap.atRule);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// Flat declarations sit on the utility's own selector; nested rules weave that
|
|
761
|
+
// selector into their `&` (`space-x-4` → `.space-x-4 > :not([hidden]) ~ …`).
|
|
762
|
+
} catch (err) {
|
|
763
|
+
_iterator4.e(err);
|
|
764
|
+
} finally {
|
|
765
|
+
_iterator4.f();
|
|
766
|
+
}
|
|
767
|
+
var nodes = [];
|
|
768
|
+
if (flat.length) nodes.push(rule(selector, flat));
|
|
769
|
+
for (var _i = 0, _nested = nested; _i < _nested.length; _i++) {
|
|
770
|
+
var _n = _nested[_i];
|
|
771
|
+
nodes.push(rule(substitute(_n.selector, selector), _n.nodes));
|
|
772
|
+
}
|
|
773
|
+
for (var _i2 = 0, _atRules = atRules; _i2 < _atRules.length; _i2++) {
|
|
774
|
+
var ar = _atRules[_i2];
|
|
775
|
+
nodes = [atRule(ar.name, ar.params, nodes)];
|
|
776
|
+
}
|
|
777
|
+
return nodes;
|
|
778
|
+
}
|
|
779
|
+
function markImportant$1(nodes) {
|
|
780
|
+
var _iterator5 = _createForOfIteratorHelper(nodes),
|
|
781
|
+
_step5;
|
|
782
|
+
try {
|
|
783
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
784
|
+
var n = _step5.value;
|
|
785
|
+
if (n.kind === 'declaration') n.important = true;else if (n.kind === 'rule' || n.kind === 'at-rule') markImportant$1(n.nodes);
|
|
786
|
+
}
|
|
787
|
+
} catch (err) {
|
|
788
|
+
_iterator5.e(err);
|
|
789
|
+
} finally {
|
|
790
|
+
_iterator5.f();
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
function producedFor(atom, reg) {
|
|
794
|
+
if (atom.kind === 'arbitrary-property') {
|
|
795
|
+
return [decl(atom.property, atom.value)];
|
|
796
|
+
}
|
|
797
|
+
if (atom.kind === 'static') {
|
|
798
|
+
// Clone: static templates are shared, and `!important` / `&`-weaving mutate.
|
|
799
|
+
var products = reg.getRule(atom.root);
|
|
800
|
+
return products ? products.map(cloneProduct) : null;
|
|
801
|
+
}
|
|
802
|
+
var handler = reg.getDynamicRule(atom.root);
|
|
803
|
+
if (!handler) return null;
|
|
804
|
+
return handler({
|
|
805
|
+
value: atom.value,
|
|
806
|
+
modifier: atom.modifier,
|
|
807
|
+
negative: atom.negative,
|
|
808
|
+
theme: reg.theme
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
function cloneProduct(n) {
|
|
812
|
+
return n.kind === 'declaration' ? _objectSpread2({}, n) : cloneNode(n);
|
|
813
|
+
}
|
|
814
|
+
function cloneNode(n) {
|
|
815
|
+
if (n.kind === 'declaration') return _objectSpread2({}, n);
|
|
816
|
+
if (n.kind === 'rule') return rule(n.selector, n.nodes.map(cloneNode));
|
|
817
|
+
if (n.kind === 'at-rule') return atRule(n.name, n.params, n.nodes.map(cloneNode));
|
|
818
|
+
return _objectSpread2({}, n);
|
|
819
|
+
}
|
|
820
|
+
function resolveVariant(variant, reg) {
|
|
821
|
+
if (variant.kind === 'arbitrary') return arbitraryVariant(variant.selector);
|
|
822
|
+
if (variant.kind === 'static') return reg.getVariant(variant.root);
|
|
823
|
+
// functional: a null value means it's really a static variant (hover, md, …).
|
|
824
|
+
if (variant.value === null) return reg.getVariant(variant.root);
|
|
825
|
+
var handler = reg.getDynamicVariant(variant.root);
|
|
826
|
+
return handler ? handler(variant.value, variant.modifier) : null;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// `[&_p]` → `& p`, `[.parent_&]` → `.parent &`, `[@media(...)]` → an at-rule.
|
|
830
|
+
// A bare selector with no `&` is attached to the element.
|
|
831
|
+
function arbitraryVariant(source) {
|
|
832
|
+
if (source[0] === '@') {
|
|
833
|
+
var cut = source.search(/[\s(]/);
|
|
834
|
+
var name = cut === -1 ? source.slice(1) : source.slice(1, cut);
|
|
835
|
+
var params = cut === -1 ? '' : source.slice(cut).trim();
|
|
836
|
+
return {
|
|
837
|
+
atRule: {
|
|
838
|
+
name: name,
|
|
839
|
+
params: params
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
var sel = spacesFromUnderscores(source);
|
|
844
|
+
return {
|
|
845
|
+
selector: sel.includes('&') ? sel : "&".concat(sel)
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
function spacesFromUnderscores(s) {
|
|
849
|
+
return s.replace(/\\_/g, '\0').replace(/_/g, ' ').replace(/\0/g, '_');
|
|
850
|
+
}
|
|
851
|
+
function substitute(template, current) {
|
|
852
|
+
return template.replace(/&/g, current);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// Backslash-escape everything outside [A-Za-z0-9_-] so a utility name is a valid
|
|
856
|
+
// class selector (`hover:bg-red-500/50` → `hover\:bg-red-500\/50`).
|
|
857
|
+
function escapeClass(name) {
|
|
858
|
+
return name.replace(/[^a-zA-Z0-9_-]/g, function (c) {
|
|
859
|
+
return '\\' + c;
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// `@apply a b c;` — inline the declarations those utilities produce into the
|
|
864
|
+
// surrounding rule. Operates on author-CSS text (which `transform` passes through
|
|
865
|
+
// verbatim), replacing each `@apply` at-rule in place. Flat utilities inline as
|
|
866
|
+
// declarations; utilities that need their own selector (variants like `hover:` /
|
|
867
|
+
// `group-hover:`, child-combinators like `space-x`, at-rule variants like `md:`)
|
|
868
|
+
// emit a nested rule with `&` bound to the applying selector.
|
|
869
|
+
var APPLY_RE = /@apply\s+([^;{}]+);/g;
|
|
870
|
+
function expandApply(css, reg) {
|
|
871
|
+
if (!css.includes('@apply')) return css;
|
|
872
|
+
return css.replace(APPLY_RE, function (_match, listRaw) {
|
|
873
|
+
var list = listRaw.trim();
|
|
874
|
+
// A trailing `!important` marks every inlined declaration (Tailwind semantics).
|
|
875
|
+
var important = false;
|
|
876
|
+
var bang = list.match(/!important\s*$/);
|
|
877
|
+
if (bang) {
|
|
878
|
+
important = true;
|
|
879
|
+
list = list.slice(0, bang.index).trim();
|
|
880
|
+
}
|
|
881
|
+
var decls = [];
|
|
882
|
+
var rules = [];
|
|
883
|
+
var _iterator = _createForOfIteratorHelper(list.split(/\s+/)),
|
|
884
|
+
_step;
|
|
885
|
+
try {
|
|
886
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
887
|
+
var token = _step.value;
|
|
888
|
+
if (!token) continue;
|
|
889
|
+
var out = compileForApply(token, reg, important);
|
|
890
|
+
if (!out) continue;
|
|
891
|
+
if (out.decls) decls.push.apply(decls, _toConsumableArray(out.decls));
|
|
892
|
+
if (out.rule) rules.push(out.rule);
|
|
893
|
+
}
|
|
894
|
+
// Flat declarations first, then nested rules — same order as authored.
|
|
895
|
+
} catch (err) {
|
|
896
|
+
_iterator.e(err);
|
|
897
|
+
} finally {
|
|
898
|
+
_iterator.f();
|
|
899
|
+
}
|
|
900
|
+
return [].concat(decls, rules).join(' ');
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
function compileForApply(cls, reg, important) {
|
|
904
|
+
var atom = parseAtom(cls, reg);
|
|
905
|
+
if (!atom) return null;
|
|
906
|
+
var compiled = compileAtom(atom, reg);
|
|
907
|
+
if (!compiled || compiled.length === 0) return null;
|
|
908
|
+
var classSelector = '.' + escapeClass(atom.raw);
|
|
909
|
+
|
|
910
|
+
// A plain utility — one rule on the class itself with only declarations — inlines
|
|
911
|
+
// straight into the applying rule.
|
|
912
|
+
if (compiled.length === 1 && compiled[0].kind === 'rule' && compiled[0].selector === classSelector) {
|
|
913
|
+
var flat = compiled[0].nodes;
|
|
914
|
+
if (flat.every(function (n) {
|
|
915
|
+
return n.kind === 'declaration';
|
|
916
|
+
})) {
|
|
917
|
+
return {
|
|
918
|
+
decls: flat.map(function (n) {
|
|
919
|
+
return declText(n, important);
|
|
920
|
+
})
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
// Everything else keeps its structure but nests: swap the class's own selector
|
|
926
|
+
// for `&`, so `hover:` → `&:hover`, `group-hover:` → `.group:hover &`, `md:` →
|
|
927
|
+
// `@media(...) { & { … } }`.
|
|
928
|
+
if (important) markImportant(compiled);
|
|
929
|
+
var text = stringify(compiled, {
|
|
930
|
+
minify: false
|
|
931
|
+
}).split(classSelector).join('&');
|
|
932
|
+
return {
|
|
933
|
+
rule: text
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
function declText(d, important) {
|
|
937
|
+
return "".concat(d.property, ": ").concat(d.value).concat(important || d.important ? ' !important' : '', ";");
|
|
938
|
+
}
|
|
939
|
+
function markImportant(nodes) {
|
|
940
|
+
var _iterator2 = _createForOfIteratorHelper(nodes),
|
|
941
|
+
_step2;
|
|
942
|
+
try {
|
|
943
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
944
|
+
var n = _step2.value;
|
|
945
|
+
if (n.kind === 'declaration') n.important = true;else if (n.kind === 'rule' || n.kind === 'at-rule') markImportant(n.nodes);
|
|
946
|
+
}
|
|
947
|
+
} catch (err) {
|
|
948
|
+
_iterator2.e(err);
|
|
949
|
+
} finally {
|
|
950
|
+
_iterator2.f();
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// Renders a `transform()` result as a compact, colourised build line for the
|
|
955
|
+
// Vite/PostCSS plugins to print. Pure (returns a string) so css-core stays
|
|
956
|
+
// side-effect free — the plugins own the actual `console.log`.
|
|
957
|
+
|
|
958
|
+
var ANSI = {
|
|
959
|
+
reset: '\x1b[0m',
|
|
960
|
+
dim: '\x1b[2m',
|
|
961
|
+
bold: '\x1b[1m',
|
|
962
|
+
cyan: '\x1b[36m',
|
|
963
|
+
green: '\x1b[32m',
|
|
964
|
+
yellow: '\x1b[33m',
|
|
965
|
+
red: '\x1b[31m'
|
|
966
|
+
};
|
|
967
|
+
function paint(code, s, color) {
|
|
968
|
+
return color ? code + s + ANSI.reset : s;
|
|
969
|
+
}
|
|
970
|
+
function humanBytes(n) {
|
|
971
|
+
return n < 1024 ? "".concat(n, " B") : "".concat((n / 1024).toFixed(1), " kB");
|
|
972
|
+
}
|
|
973
|
+
function humanMs(ms) {
|
|
974
|
+
return ms < 1 ? "".concat(ms * 1000 | 0, " \xB5s") : ms < 1000 ? "".concat(ms.toFixed(1), " ms") : "".concat((ms / 1000).toFixed(2), " s");
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
// Green under 10 ms, yellow under 50 ms, red beyond — a quick "is it fast?" cue.
|
|
978
|
+
function timeColor(ms) {
|
|
979
|
+
return ms < 10 ? ANSI.green : ms < 50 ? ANSI.yellow : ANSI.red;
|
|
980
|
+
}
|
|
981
|
+
function formatBuildLog(label, stats) {
|
|
982
|
+
var _options$color;
|
|
983
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
984
|
+
var color = (_options$color = options.color) !== null && _options$color !== void 0 ? _options$color : true;
|
|
985
|
+
var head = paint(ANSI.cyan + ANSI.bold, '◆ fluixi', color);
|
|
986
|
+
var name = paint(ANSI.bold, label, color);
|
|
987
|
+
var time = paint(timeColor(stats.ms), humanMs(stats.ms), color);
|
|
988
|
+
var parts = ["".concat(stats.utilities, " ").concat(stats.utilities === 1 ? 'utility' : 'utilities'), "".concat(stats.scanned, " scanned"), humanBytes(stats.bytes)];
|
|
989
|
+
if (stats.sources) parts.push("".concat(stats.sources, " ").concat(stats.sources === 1 ? 'source' : 'sources'));
|
|
990
|
+
var detail = paint(ANSI.dim, parts.join(' · '), color);
|
|
991
|
+
return "".concat(head, " ").concat(name, " ").concat(time, "\n ").concat(detail);
|
|
992
|
+
}
|
|
993
|
+
|
|
670
994
|
// The resolved token table. Every entry is a CSS custom property (`--color-red-500`,
|
|
671
995
|
// `--spacing`, `--breakpoint-md`, …); utilities read them by namespace and emit
|
|
672
996
|
// `var()` references, so the tokens stay live and themeable at runtime.
|
|
@@ -1070,8 +1394,13 @@ var CssParser = /*#__PURE__*/function () {
|
|
|
1070
1394
|
case 'counter-style':
|
|
1071
1395
|
case 'viewport':
|
|
1072
1396
|
case 'theme':
|
|
1073
|
-
case 'utility':
|
|
1074
1397
|
return 'declarations';
|
|
1398
|
+
// `@utility` bodies mix flat declarations with nested rules
|
|
1399
|
+
// (`&:hover`, `&::-webkit-scrollbar`); `rule` mode does the
|
|
1400
|
+
// declaration-vs-nesting lookahead. (`mixed` would read every line
|
|
1401
|
+
// as a selector and corrupt the block.)
|
|
1402
|
+
case 'utility':
|
|
1403
|
+
return 'rule';
|
|
1075
1404
|
case 'media':
|
|
1076
1405
|
case 'supports':
|
|
1077
1406
|
case 'container':
|
|
@@ -2238,53 +2567,84 @@ function registerUtility(atRule, reg) {
|
|
|
2238
2567
|
var _atRule$preludeText;
|
|
2239
2568
|
var name = ((_atRule$preludeText = atRule.preludeText) !== null && _atRule$preludeText !== void 0 ? _atRule$preludeText : '').trim();
|
|
2240
2569
|
if (!name || !atRule.block) return;
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
});
|
|
2247
|
-
if (decls.length === 0) return;
|
|
2570
|
+
|
|
2571
|
+
// Flat declarations plus any nested rules (`&:hover`, `&::-webkit-scrollbar`);
|
|
2572
|
+
// the nested `&` is later woven with the utility's own selector by the compiler.
|
|
2573
|
+
var products = toProducts(atRule.block.children);
|
|
2574
|
+
if (products.length === 0) return;
|
|
2248
2575
|
|
|
2249
2576
|
// A trailing `-*` marks a functional utility: `tab-*` handles `tab-2`, `tab-[3]`.
|
|
2250
2577
|
if (name.endsWith('-*')) {
|
|
2251
2578
|
var root = name.slice(0, -2);
|
|
2252
2579
|
if (root) reg.dynamicRule(root, function (ctx) {
|
|
2253
|
-
return
|
|
2580
|
+
return resolveProducts(products, ctx);
|
|
2254
2581
|
});
|
|
2255
2582
|
return;
|
|
2256
2583
|
}
|
|
2257
|
-
reg.rule(name,
|
|
2584
|
+
reg.rule(name, products);
|
|
2258
2585
|
}
|
|
2259
|
-
|
|
2260
|
-
// Applies a functional utility's declaration templates to one atom. `--value()`
|
|
2261
|
-
// is required — if it can't resolve, the whole utility is dropped (returns null).
|
|
2262
|
-
// `--modifier()` is optional — a declaration using it is skipped when there's no
|
|
2263
|
-
// matching modifier, so `text-lg` and `text-lg/7` share one definition.
|
|
2264
|
-
function resolveDeclarations(templates, ctx) {
|
|
2586
|
+
function toProducts(children) {
|
|
2265
2587
|
var out = [];
|
|
2266
|
-
var _iterator2 = _createForOfIteratorHelper(
|
|
2588
|
+
var _iterator2 = _createForOfIteratorHelper(children),
|
|
2267
2589
|
_step2;
|
|
2268
2590
|
try {
|
|
2269
2591
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2270
|
-
var
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2592
|
+
var c = _step2.value;
|
|
2593
|
+
if (c.type === 'declaration') {
|
|
2594
|
+
var _d$rawValue;
|
|
2595
|
+
var d = c;
|
|
2596
|
+
out.push(decl(d.property, ((_d$rawValue = d.rawValue) !== null && _d$rawValue !== void 0 ? _d$rawValue : '').trim(), d.important === true));
|
|
2597
|
+
} else if (c.type === 'rule') {
|
|
2598
|
+
var _r$declarations, _r$children, _r$rawSelector;
|
|
2599
|
+
var r = c;
|
|
2600
|
+
// The parser splits a rule's own declarations from its nested rules; a
|
|
2601
|
+
// utility body wants both, declarations first.
|
|
2602
|
+
var kids = [].concat(_toConsumableArray((_r$declarations = r.declarations) !== null && _r$declarations !== void 0 ? _r$declarations : []), _toConsumableArray((_r$children = r.children) !== null && _r$children !== void 0 ? _r$children : []));
|
|
2603
|
+
out.push(rule(((_r$rawSelector = r.rawSelector) !== null && _r$rawSelector !== void 0 ? _r$rawSelector : '').trim(), toProducts(kids)));
|
|
2604
|
+
}
|
|
2282
2605
|
}
|
|
2283
2606
|
} catch (err) {
|
|
2284
2607
|
_iterator2.e(err);
|
|
2285
2608
|
} finally {
|
|
2286
2609
|
_iterator2.f();
|
|
2287
2610
|
}
|
|
2611
|
+
return out;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
// Applies a functional utility's templates to one atom, walking nested rules too.
|
|
2615
|
+
// `--value()` is required — if it can't resolve, the whole utility is dropped
|
|
2616
|
+
// (returns null). `--modifier()` is optional — a declaration using it is skipped
|
|
2617
|
+
// when there's no matching modifier, so `text-lg` and `text-lg/7` share one def.
|
|
2618
|
+
function resolveProducts(templates, ctx) {
|
|
2619
|
+
var out = [];
|
|
2620
|
+
var _iterator3 = _createForOfIteratorHelper(templates),
|
|
2621
|
+
_step3;
|
|
2622
|
+
try {
|
|
2623
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
2624
|
+
var t = _step3.value;
|
|
2625
|
+
if (t.kind === 'declaration') {
|
|
2626
|
+
var withValue = replaceFn(t.value, '--value', function (args) {
|
|
2627
|
+
return resolveValue(args, ctx);
|
|
2628
|
+
});
|
|
2629
|
+
if (withValue === null) return null;
|
|
2630
|
+
var withModifier = replaceFn(withValue, '--modifier', function (args) {
|
|
2631
|
+
return resolveModifier(args, ctx);
|
|
2632
|
+
});
|
|
2633
|
+
if (withModifier === null) continue;
|
|
2634
|
+
out.push(_objectSpread2(_objectSpread2({}, t), {}, {
|
|
2635
|
+
value: withModifier
|
|
2636
|
+
}));
|
|
2637
|
+
} else {
|
|
2638
|
+
var inner = resolveProducts(t.nodes, ctx);
|
|
2639
|
+
if (inner === null) return null;
|
|
2640
|
+
out.push(rule(t.selector, inner));
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2643
|
+
} catch (err) {
|
|
2644
|
+
_iterator3.e(err);
|
|
2645
|
+
} finally {
|
|
2646
|
+
_iterator3.f();
|
|
2647
|
+
}
|
|
2288
2648
|
return out.length ? out : null;
|
|
2289
2649
|
}
|
|
2290
2650
|
function resolveValue(args, ctx) {
|
|
@@ -2392,7 +2752,15 @@ function registerVariant(atRule, reg) {
|
|
|
2392
2752
|
var prelude = ((_atRule$preludeText2 = atRule.preludeText) !== null && _atRule$preludeText2 !== void 0 ? _atRule$preludeText2 : '').trim();
|
|
2393
2753
|
if (!prelude) return;
|
|
2394
2754
|
|
|
2395
|
-
//
|
|
2755
|
+
// Block form: `@custom-variant name { &:hover { @slot } }` — the prelude is just
|
|
2756
|
+
// the name and the block describes the wrapping, marked by `@slot`.
|
|
2757
|
+
if (atRule.block) {
|
|
2758
|
+
var wrap = blockToWrap(atRule.block.children);
|
|
2759
|
+
if (prelude && wrap) reg.variant(prelude, wrap);
|
|
2760
|
+
return;
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
// Shorthand: `@custom-variant name (condition)`.
|
|
2396
2764
|
var paren = prelude.indexOf('(');
|
|
2397
2765
|
if (paren === -1 || !prelude.endsWith(')')) return;
|
|
2398
2766
|
var name = prelude.slice(0, paren).trim();
|
|
@@ -2400,6 +2768,43 @@ function registerVariant(atRule, reg) {
|
|
|
2400
2768
|
if (!name || !condition) return;
|
|
2401
2769
|
reg.variant(name, wrapFor(condition));
|
|
2402
2770
|
}
|
|
2771
|
+
|
|
2772
|
+
// Walk the single path down to `@slot`, collecting the selector (nested rules,
|
|
2773
|
+
// combined by `&` substitution) and/or the wrapping at-rule (`@media`, `@supports`).
|
|
2774
|
+
// Supports one selector level, one at-rule level, or both nested.
|
|
2775
|
+
function blockToWrap(children) {
|
|
2776
|
+
var selector;
|
|
2777
|
+
var at;
|
|
2778
|
+
var node = firstBlockChild(children);
|
|
2779
|
+
while (node) {
|
|
2780
|
+
if (node.type === 'rule') {
|
|
2781
|
+
var _rawSelector, _children;
|
|
2782
|
+
var sel = ((_rawSelector = node.rawSelector) !== null && _rawSelector !== void 0 ? _rawSelector : '').trim();
|
|
2783
|
+
selector = selector ? sel.replace(/&/g, selector) : sel;
|
|
2784
|
+
node = firstBlockChild((_children = node.children) !== null && _children !== void 0 ? _children : []);
|
|
2785
|
+
} else if (node.type === 'atrule') {
|
|
2786
|
+
var _ar$preludeText;
|
|
2787
|
+
var ar = node;
|
|
2788
|
+
if (ar.name === 'slot') break;
|
|
2789
|
+
at = {
|
|
2790
|
+
name: ar.name,
|
|
2791
|
+
params: ((_ar$preludeText = ar.preludeText) !== null && _ar$preludeText !== void 0 ? _ar$preludeText : '').trim()
|
|
2792
|
+
};
|
|
2793
|
+
node = ar.block ? firstBlockChild(ar.block.children) : undefined;
|
|
2794
|
+
} else {
|
|
2795
|
+
node = undefined;
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
var wrap = {};
|
|
2799
|
+
if (selector) wrap.selector = selector.includes('&') ? selector : "&".concat(selector);
|
|
2800
|
+
if (at) wrap.atRule = at;
|
|
2801
|
+
return wrap.selector || wrap.atRule ? wrap : null;
|
|
2802
|
+
}
|
|
2803
|
+
function firstBlockChild(children) {
|
|
2804
|
+
return children.find(function (c) {
|
|
2805
|
+
return c.type === 'rule' || c.type === 'atrule';
|
|
2806
|
+
});
|
|
2807
|
+
}
|
|
2403
2808
|
function wrapFor(condition) {
|
|
2404
2809
|
if (condition[0] === '@') {
|
|
2405
2810
|
var cut = condition.search(/[\s(]/);
|
|
@@ -2417,6 +2822,10 @@ function wrapFor(condition) {
|
|
|
2417
2822
|
};
|
|
2418
2823
|
}
|
|
2419
2824
|
|
|
2825
|
+
// A utility produces declarations on its own selector, and/or nested rules whose
|
|
2826
|
+
// `&` is woven with that selector — the latter is how child-combinator utilities
|
|
2827
|
+
// like `space-x`/`divide-y` reach `& > * + *`.
|
|
2828
|
+
|
|
2420
2829
|
// A variant either narrows the selector (`&:hover`, `.group:hover &`) or wraps
|
|
2421
2830
|
// the rule in an at-rule (`@media`, `@supports`). It may do both.
|
|
2422
2831
|
|
|
@@ -2447,8 +2856,8 @@ var Registry = /*#__PURE__*/function () {
|
|
|
2447
2856
|
}
|
|
2448
2857
|
return _createClass(Registry, [{
|
|
2449
2858
|
key: "rule",
|
|
2450
|
-
value: function rule(name,
|
|
2451
|
-
this.rules.set(name,
|
|
2859
|
+
value: function rule(name, products) {
|
|
2860
|
+
this.rules.set(name, products);
|
|
2452
2861
|
return this;
|
|
2453
2862
|
}
|
|
2454
2863
|
}, {
|
|
@@ -2496,111 +2905,6 @@ var Registry = /*#__PURE__*/function () {
|
|
|
2496
2905
|
}]);
|
|
2497
2906
|
}();
|
|
2498
2907
|
|
|
2499
|
-
// Turns a parsed atom into CSS. Returns null when the utility or any of its
|
|
2500
|
-
// variants aren't registered, so an unknown class simply produces nothing.
|
|
2501
|
-
function compileAtom(atom, reg) {
|
|
2502
|
-
var declarations = declarationsFor(atom, reg);
|
|
2503
|
-
if (!declarations || declarations.length === 0) return null;
|
|
2504
|
-
if (atom.important) {
|
|
2505
|
-
var _iterator = _createForOfIteratorHelper(declarations),
|
|
2506
|
-
_step;
|
|
2507
|
-
try {
|
|
2508
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2509
|
-
var d = _step.value;
|
|
2510
|
-
d.important = true;
|
|
2511
|
-
}
|
|
2512
|
-
} catch (err) {
|
|
2513
|
-
_iterator.e(err);
|
|
2514
|
-
} finally {
|
|
2515
|
-
_iterator.f();
|
|
2516
|
-
}
|
|
2517
|
-
}
|
|
2518
|
-
var selector = '.' + escapeClass(atom.raw);
|
|
2519
|
-
var atRules = [];
|
|
2520
|
-
var _iterator2 = _createForOfIteratorHelper(atom.variants),
|
|
2521
|
-
_step2;
|
|
2522
|
-
try {
|
|
2523
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2524
|
-
var variant = _step2.value;
|
|
2525
|
-
var wrap = resolveVariant(variant, reg);
|
|
2526
|
-
if (!wrap) return null;
|
|
2527
|
-
if (wrap.selector) selector = substitute(wrap.selector, selector);
|
|
2528
|
-
if (wrap.atRule) atRules.push(wrap.atRule);
|
|
2529
|
-
}
|
|
2530
|
-
} catch (err) {
|
|
2531
|
-
_iterator2.e(err);
|
|
2532
|
-
} finally {
|
|
2533
|
-
_iterator2.f();
|
|
2534
|
-
}
|
|
2535
|
-
var node = rule(selector, declarations);
|
|
2536
|
-
for (var _i = 0, _atRules = atRules; _i < _atRules.length; _i++) {
|
|
2537
|
-
var ar = _atRules[_i];
|
|
2538
|
-
node = atRule(ar.name, ar.params, [node]);
|
|
2539
|
-
}
|
|
2540
|
-
return [node];
|
|
2541
|
-
}
|
|
2542
|
-
function declarationsFor(atom, reg) {
|
|
2543
|
-
if (atom.kind === 'arbitrary-property') {
|
|
2544
|
-
return [decl(atom.property, atom.value)];
|
|
2545
|
-
}
|
|
2546
|
-
if (atom.kind === 'static') {
|
|
2547
|
-
var decls = reg.getRule(atom.root);
|
|
2548
|
-
return decls ? decls.map(function (d) {
|
|
2549
|
-
return _objectSpread2({}, d);
|
|
2550
|
-
}) : null;
|
|
2551
|
-
}
|
|
2552
|
-
var handler = reg.getDynamicRule(atom.root);
|
|
2553
|
-
if (!handler) return null;
|
|
2554
|
-
return handler({
|
|
2555
|
-
value: atom.value,
|
|
2556
|
-
modifier: atom.modifier,
|
|
2557
|
-
negative: atom.negative,
|
|
2558
|
-
theme: reg.theme
|
|
2559
|
-
});
|
|
2560
|
-
}
|
|
2561
|
-
function resolveVariant(variant, reg) {
|
|
2562
|
-
if (variant.kind === 'arbitrary') return arbitraryVariant(variant.selector);
|
|
2563
|
-
if (variant.kind === 'static') return reg.getVariant(variant.root);
|
|
2564
|
-
// functional: a null value means it's really a static variant (hover, md, …).
|
|
2565
|
-
if (variant.value === null) return reg.getVariant(variant.root);
|
|
2566
|
-
var handler = reg.getDynamicVariant(variant.root);
|
|
2567
|
-
return handler ? handler(variant.value, variant.modifier) : null;
|
|
2568
|
-
}
|
|
2569
|
-
|
|
2570
|
-
// `[&_p]` → `& p`, `[.parent_&]` → `.parent &`, `[@media(...)]` → an at-rule.
|
|
2571
|
-
// A bare selector with no `&` is attached to the element.
|
|
2572
|
-
function arbitraryVariant(source) {
|
|
2573
|
-
if (source[0] === '@') {
|
|
2574
|
-
var cut = source.search(/[\s(]/);
|
|
2575
|
-
var name = cut === -1 ? source.slice(1) : source.slice(1, cut);
|
|
2576
|
-
var params = cut === -1 ? '' : source.slice(cut).trim();
|
|
2577
|
-
return {
|
|
2578
|
-
atRule: {
|
|
2579
|
-
name: name,
|
|
2580
|
-
params: params
|
|
2581
|
-
}
|
|
2582
|
-
};
|
|
2583
|
-
}
|
|
2584
|
-
var sel = spacesFromUnderscores(source);
|
|
2585
|
-
return {
|
|
2586
|
-
selector: sel.includes('&') ? sel : "&".concat(sel)
|
|
2587
|
-
};
|
|
2588
|
-
}
|
|
2589
|
-
function spacesFromUnderscores(s) {
|
|
2590
|
-
return s.replace(/\\_/g, '\0').replace(/_/g, ' ').replace(/\0/g, '_');
|
|
2591
|
-
}
|
|
2592
|
-
function substitute(template, current) {
|
|
2593
|
-
return template.replace(/&/g, current);
|
|
2594
|
-
}
|
|
2595
|
-
|
|
2596
|
-
// Backslash-escape everything outside [A-Za-z0-9_-] so a utility name is a valid
|
|
2597
|
-
// class selector (`hover:bg-red-500/50` → `hover\:bg-red-500\/50`).
|
|
2598
|
-
function escapeClass(name) {
|
|
2599
|
-
return name.replace(/[^a-zA-Z0-9_-]/g, function (c) {
|
|
2600
|
-
return '\\' + c;
|
|
2601
|
-
});
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
2908
|
var Palettes = {
|
|
2605
2909
|
"slate": {
|
|
2606
2910
|
"50": "#f8fafc",
|
|
@@ -3075,6 +3379,23 @@ function registerBackgrounds(reg) {
|
|
|
3075
3379
|
props(reg, 'background-image', {
|
|
3076
3380
|
'bg-none': 'none'
|
|
3077
3381
|
});
|
|
3382
|
+
|
|
3383
|
+
// Form-control colours.
|
|
3384
|
+
reg.dynamicRule('accent', function (_ref2) {
|
|
3385
|
+
var value = _ref2.value,
|
|
3386
|
+
modifier = _ref2.modifier,
|
|
3387
|
+
theme = _ref2.theme;
|
|
3388
|
+
if ((value === null || value === void 0 ? void 0 : value.kind) === 'named' && value.value === 'auto') return [decl('accent-color', 'auto')];
|
|
3389
|
+
var c = colorValue(value, modifier, theme);
|
|
3390
|
+
return c ? [decl('accent-color', c)] : null;
|
|
3391
|
+
});
|
|
3392
|
+
reg.dynamicRule('caret', function (_ref3) {
|
|
3393
|
+
var value = _ref3.value,
|
|
3394
|
+
modifier = _ref3.modifier,
|
|
3395
|
+
theme = _ref3.theme;
|
|
3396
|
+
var c = colorValue(value, modifier, theme);
|
|
3397
|
+
return c ? [decl('caret-color', c)] : null;
|
|
3398
|
+
});
|
|
3078
3399
|
}
|
|
3079
3400
|
|
|
3080
3401
|
function registerBorders(reg) {
|
|
@@ -3095,6 +3416,8 @@ function registerBorders(reg) {
|
|
|
3095
3416
|
hidden: 'hidden',
|
|
3096
3417
|
none: 'none'
|
|
3097
3418
|
});
|
|
3419
|
+
divide(reg);
|
|
3420
|
+
ring(reg);
|
|
3098
3421
|
rounded(reg, 'rounded', ['']);
|
|
3099
3422
|
rounded(reg, 'rounded-t', ['-top-left', '-top-right']);
|
|
3100
3423
|
rounded(reg, 'rounded-r', ['-top-right', '-bottom-right']);
|
|
@@ -3174,14 +3497,67 @@ function outline(reg) {
|
|
|
3174
3497
|
});
|
|
3175
3498
|
}
|
|
3176
3499
|
|
|
3500
|
+
// Borders *between* children (adjacent-sibling combinator). `divide-x`/`divide-y`
|
|
3501
|
+
// set the width, `divide-{color}`/`divide-{style}` the rest; `-reverse` flips the
|
|
3502
|
+
// edge via a `--flx-divide-*-reverse` toggle.
|
|
3503
|
+
var BETWEEN$1 = '& > :not([hidden]) ~ :not([hidden])';
|
|
3504
|
+
function divide(reg) {
|
|
3505
|
+
divideWidth(reg, 'x', 'border-right-width', 'border-left-width');
|
|
3506
|
+
divideWidth(reg, 'y', 'border-top-width', 'border-bottom-width');
|
|
3507
|
+
reg.dynamicRule('divide', function (_ref4) {
|
|
3508
|
+
var value = _ref4.value,
|
|
3509
|
+
modifier = _ref4.modifier,
|
|
3510
|
+
theme = _ref4.theme;
|
|
3511
|
+
if (value === null) return null;
|
|
3512
|
+
var style = value.kind === 'named' ? DIVIDE_STYLES[value.value] : undefined;
|
|
3513
|
+
if (style) return [rule(BETWEEN$1, [decl('border-style', style)])];
|
|
3514
|
+
var color = colorFor(value, modifier, theme);
|
|
3515
|
+
return color ? [rule(BETWEEN$1, [decl('border-color', color)])] : null;
|
|
3516
|
+
});
|
|
3517
|
+
}
|
|
3518
|
+
var DIVIDE_STYLES = {
|
|
3519
|
+
solid: 'solid',
|
|
3520
|
+
dashed: 'dashed',
|
|
3521
|
+
dotted: 'dotted',
|
|
3522
|
+
"double": 'double',
|
|
3523
|
+
none: 'none'
|
|
3524
|
+
};
|
|
3525
|
+
function divideWidth(reg, axis, reverseProp, mainProp) {
|
|
3526
|
+
var flag = "--flx-divide-".concat(axis, "-reverse");
|
|
3527
|
+
reg.dynamicRule("divide-".concat(axis), function (_ref5) {
|
|
3528
|
+
var value = _ref5.value;
|
|
3529
|
+
if ((value === null || value === void 0 ? void 0 : value.kind) === 'named' && value.value === 'reverse') return [rule(BETWEEN$1, [decl(flag, '1')])];
|
|
3530
|
+
var w = widthValue(value, '1px');
|
|
3531
|
+
if (w === null) return null;
|
|
3532
|
+
return [rule(BETWEEN$1, [decl(flag, '0'), decl(reverseProp, "calc(".concat(w, " * var(").concat(flag, "))")), decl(mainProp, "calc(".concat(w, " * calc(1 - var(").concat(flag, ")))"))])];
|
|
3533
|
+
});
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
// A focus/selection ring drawn as a box-shadow, composed through `--flx-ring-*`
|
|
3537
|
+
// (declared in reset.css) so `ring`, `ring-{color}` and `ring-inset` stack.
|
|
3538
|
+
function ring(reg) {
|
|
3539
|
+
reg.rule('ring-inset', [decl('--flx-ring-inset', 'inset')]);
|
|
3540
|
+
reg.dynamicRule('ring', function (_ref6) {
|
|
3541
|
+
var value = _ref6.value,
|
|
3542
|
+
modifier = _ref6.modifier,
|
|
3543
|
+
theme = _ref6.theme;
|
|
3544
|
+
var w = value === null ? '3px' : widthValue(value, null);
|
|
3545
|
+
if (w !== null) {
|
|
3546
|
+
return [decl('--flx-ring-shadow', "var(--flx-ring-inset) 0 0 0 calc(".concat(w, " + var(--flx-ring-offset-width)) var(--flx-ring-color)")), decl('box-shadow', 'var(--flx-ring-offset-shadow), var(--flx-ring-shadow), var(--flx-shadow, 0 0 #0000)')];
|
|
3547
|
+
}
|
|
3548
|
+
var color = colorFor(value, modifier, theme);
|
|
3549
|
+
return color ? [decl('--flx-ring-color', color)] : null;
|
|
3550
|
+
});
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3177
3553
|
function registerEffects(reg) {
|
|
3178
3554
|
reg.dynamicRule('shadow', function (_ref) {
|
|
3179
3555
|
var value = _ref.value,
|
|
3180
3556
|
theme = _ref.theme;
|
|
3181
|
-
if (value === null) return wrap(theme.resolve('shadow', 'DEFAULT'));
|
|
3557
|
+
if (value === null) return wrap$1(theme.resolve('shadow', 'DEFAULT'));
|
|
3182
3558
|
if (value.kind === 'arbitrary') return [decl('box-shadow', value.value)];
|
|
3183
3559
|
if (value.value === 'none') return [decl('box-shadow', 'none')];
|
|
3184
|
-
return wrap(theme.resolve('shadow', value.value));
|
|
3560
|
+
return wrap$1(theme.resolve('shadow', value.value));
|
|
3185
3561
|
});
|
|
3186
3562
|
reg.dynamicRule('opacity', function (_ref2) {
|
|
3187
3563
|
var value = _ref2.value;
|
|
@@ -3225,7 +3601,7 @@ function registerEffects(reg) {
|
|
|
3225
3601
|
auto: 'auto'
|
|
3226
3602
|
});
|
|
3227
3603
|
}
|
|
3228
|
-
function wrap(shadow) {
|
|
3604
|
+
function wrap$1(shadow) {
|
|
3229
3605
|
return shadow ? [decl('box-shadow', shadow)] : null;
|
|
3230
3606
|
}
|
|
3231
3607
|
var BLEND = {
|
|
@@ -3247,6 +3623,131 @@ var BLEND = {
|
|
|
3247
3623
|
luminosity: 'luminosity'
|
|
3248
3624
|
};
|
|
3249
3625
|
|
|
3626
|
+
// Same composition trick as transforms: each utility sets a `--flx-*` var and
|
|
3627
|
+
// re-declares the composed `filter`, with identity defaults so any one is valid
|
|
3628
|
+
// alone and several compose (`blur-sm grayscale`).
|
|
3629
|
+
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))';
|
|
3630
|
+
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))';
|
|
3631
|
+
var compose$1 = function compose(prop, val) {
|
|
3632
|
+
return [decl(prop, val), decl('filter', FILTER)];
|
|
3633
|
+
};
|
|
3634
|
+
var backdrop = function backdrop(prop, val) {
|
|
3635
|
+
return [decl(prop, val), decl('backdrop-filter', BACKDROP)];
|
|
3636
|
+
};
|
|
3637
|
+
function registerFilters(reg) {
|
|
3638
|
+
reg.rule('filter-none', [decl('filter', 'none')]);
|
|
3639
|
+
reg.rule('backdrop-filter-none', [decl('backdrop-filter', 'none')]);
|
|
3640
|
+
reg.dynamicRule('blur', function (_ref) {
|
|
3641
|
+
var value = _ref.value;
|
|
3642
|
+
return v(compose$1, '--flx-blur', named$1(value, BLUR));
|
|
3643
|
+
});
|
|
3644
|
+
reg.dynamicRule('brightness', function (_ref2) {
|
|
3645
|
+
var value = _ref2.value;
|
|
3646
|
+
return v(compose$1, '--flx-brightness', ratio(value));
|
|
3647
|
+
});
|
|
3648
|
+
reg.dynamicRule('contrast', function (_ref3) {
|
|
3649
|
+
var value = _ref3.value;
|
|
3650
|
+
return v(compose$1, '--flx-contrast', ratio(value));
|
|
3651
|
+
});
|
|
3652
|
+
reg.dynamicRule('saturate', function (_ref4) {
|
|
3653
|
+
var value = _ref4.value;
|
|
3654
|
+
return v(compose$1, '--flx-saturate', ratio(value));
|
|
3655
|
+
});
|
|
3656
|
+
reg.dynamicRule('grayscale', function (_ref5) {
|
|
3657
|
+
var value = _ref5.value;
|
|
3658
|
+
return v(compose$1, '--flx-grayscale', pct(value));
|
|
3659
|
+
});
|
|
3660
|
+
reg.dynamicRule('invert', function (_ref6) {
|
|
3661
|
+
var value = _ref6.value;
|
|
3662
|
+
return v(compose$1, '--flx-invert', pct(value));
|
|
3663
|
+
});
|
|
3664
|
+
reg.dynamicRule('sepia', function (_ref7) {
|
|
3665
|
+
var value = _ref7.value;
|
|
3666
|
+
return v(compose$1, '--flx-sepia', pct(value));
|
|
3667
|
+
});
|
|
3668
|
+
reg.dynamicRule('hue-rotate', function (_ref8) {
|
|
3669
|
+
var value = _ref8.value,
|
|
3670
|
+
negative = _ref8.negative;
|
|
3671
|
+
return v(compose$1, '--flx-hue-rotate', deg(value, negative));
|
|
3672
|
+
});
|
|
3673
|
+
reg.dynamicRule('drop-shadow', function (_ref9) {
|
|
3674
|
+
var value = _ref9.value;
|
|
3675
|
+
return v(compose$1, '--flx-drop-shadow', named$1(value, DROP_SHADOW));
|
|
3676
|
+
});
|
|
3677
|
+
reg.dynamicRule('backdrop-blur', function (_ref0) {
|
|
3678
|
+
var value = _ref0.value;
|
|
3679
|
+
return v(backdrop, '--flx-backdrop-blur', named$1(value, BLUR));
|
|
3680
|
+
});
|
|
3681
|
+
reg.dynamicRule('backdrop-brightness', function (_ref1) {
|
|
3682
|
+
var value = _ref1.value;
|
|
3683
|
+
return v(backdrop, '--flx-backdrop-brightness', ratio(value));
|
|
3684
|
+
});
|
|
3685
|
+
reg.dynamicRule('backdrop-contrast', function (_ref10) {
|
|
3686
|
+
var value = _ref10.value;
|
|
3687
|
+
return v(backdrop, '--flx-backdrop-contrast', ratio(value));
|
|
3688
|
+
});
|
|
3689
|
+
reg.dynamicRule('backdrop-saturate', function (_ref11) {
|
|
3690
|
+
var value = _ref11.value;
|
|
3691
|
+
return v(backdrop, '--flx-backdrop-saturate', ratio(value));
|
|
3692
|
+
});
|
|
3693
|
+
reg.dynamicRule('backdrop-grayscale', function (_ref12) {
|
|
3694
|
+
var value = _ref12.value;
|
|
3695
|
+
return v(backdrop, '--flx-backdrop-grayscale', pct(value));
|
|
3696
|
+
});
|
|
3697
|
+
reg.dynamicRule('backdrop-opacity', function (_ref13) {
|
|
3698
|
+
var value = _ref13.value;
|
|
3699
|
+
return v(backdrop, '--flx-backdrop-opacity', ratio(value));
|
|
3700
|
+
});
|
|
3701
|
+
}
|
|
3702
|
+
function v(build, prop, val) {
|
|
3703
|
+
return val === null ? null : build(prop, val);
|
|
3704
|
+
}
|
|
3705
|
+
|
|
3706
|
+
/** number → decimal ratio (brightness-50 → 0.5); arbitrary passes through. */
|
|
3707
|
+
function ratio(value) {
|
|
3708
|
+
if (!value) return null;
|
|
3709
|
+
if (value.kind === 'arbitrary') return value.value;
|
|
3710
|
+
return /^\d+$/.test(value.value) ? "".concat(+value.value / 100) : null;
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
/** bare → 100%, `0` → 0%, number → number% (grayscale/invert/sepia). */
|
|
3714
|
+
function pct(value) {
|
|
3715
|
+
if (!value) return '100%';
|
|
3716
|
+
if (value.kind === 'arbitrary') return value.value;
|
|
3717
|
+
return /^\d+$/.test(value.value) ? "".concat(value.value, "%") : null;
|
|
3718
|
+
}
|
|
3719
|
+
function deg(value, negative) {
|
|
3720
|
+
if (!value) return null;
|
|
3721
|
+
if (value.kind === 'arbitrary') return negative ? "calc(".concat(value.value, " * -1)") : value.value;
|
|
3722
|
+
return /^\d+$/.test(value.value) ? "".concat(negative ? '-' : '').concat(value.value, "deg") : null;
|
|
3723
|
+
}
|
|
3724
|
+
function named$1(value, map) {
|
|
3725
|
+
var _map$, _map$value$value;
|
|
3726
|
+
if (!value) return (_map$ = map['']) !== null && _map$ !== void 0 ? _map$ : null;
|
|
3727
|
+
if (value.kind === 'arbitrary') return value.value;
|
|
3728
|
+
return (_map$value$value = map[value.value]) !== null && _map$value$value !== void 0 ? _map$value$value : null;
|
|
3729
|
+
}
|
|
3730
|
+
var BLUR = {
|
|
3731
|
+
'': '8px',
|
|
3732
|
+
none: '0',
|
|
3733
|
+
xs: '2px',
|
|
3734
|
+
sm: '4px',
|
|
3735
|
+
md: '12px',
|
|
3736
|
+
lg: '16px',
|
|
3737
|
+
xl: '24px',
|
|
3738
|
+
'2xl': '40px',
|
|
3739
|
+
'3xl': '64px'
|
|
3740
|
+
};
|
|
3741
|
+
var DROP_SHADOW = {
|
|
3742
|
+
'': '0 1px 2px rgb(0 0 0 / 0.1)',
|
|
3743
|
+
none: '0 0 #0000',
|
|
3744
|
+
sm: '0 1px 1px rgb(0 0 0 / 0.05)',
|
|
3745
|
+
md: '0 4px 3px rgb(0 0 0 / 0.07)',
|
|
3746
|
+
lg: '0 10px 8px rgb(0 0 0 / 0.04)',
|
|
3747
|
+
xl: '0 20px 13px rgb(0 0 0 / 0.03)',
|
|
3748
|
+
'2xl': '0 25px 25px rgb(0 0 0 / 0.15)'
|
|
3749
|
+
};
|
|
3750
|
+
|
|
3250
3751
|
function registerFlexGrid(reg) {
|
|
3251
3752
|
props(reg, 'flex-direction', {
|
|
3252
3753
|
'flex-row': 'row',
|
|
@@ -3409,6 +3910,44 @@ function line(reg, root, property) {
|
|
|
3409
3910
|
});
|
|
3410
3911
|
}
|
|
3411
3912
|
|
|
3913
|
+
function registerGradients(reg) {
|
|
3914
|
+
keywords(reg, 'bg-gradient-to', 'background-image', {
|
|
3915
|
+
t: 'linear-gradient(to top, var(--flx-gradient-stops))',
|
|
3916
|
+
tr: 'linear-gradient(to top right, var(--flx-gradient-stops))',
|
|
3917
|
+
r: 'linear-gradient(to right, var(--flx-gradient-stops))',
|
|
3918
|
+
br: 'linear-gradient(to bottom right, var(--flx-gradient-stops))',
|
|
3919
|
+
b: 'linear-gradient(to bottom, var(--flx-gradient-stops))',
|
|
3920
|
+
bl: 'linear-gradient(to bottom left, var(--flx-gradient-stops))',
|
|
3921
|
+
l: 'linear-gradient(to left, var(--flx-gradient-stops))',
|
|
3922
|
+
tl: 'linear-gradient(to top left, var(--flx-gradient-stops))'
|
|
3923
|
+
});
|
|
3924
|
+
|
|
3925
|
+
// Color stops build up `--flx-gradient-stops`. `from` seeds a two-stop list that
|
|
3926
|
+
// `to` fills in; `via` promotes it to three stops. A bare `to` with no `from`
|
|
3927
|
+
// still works because the from stop defaults to transparent.
|
|
3928
|
+
reg.dynamicRule('from', function (_ref) {
|
|
3929
|
+
var value = _ref.value,
|
|
3930
|
+
modifier = _ref.modifier,
|
|
3931
|
+
theme = _ref.theme;
|
|
3932
|
+
var color = colorValue(value, modifier, theme);
|
|
3933
|
+
return color ? [decl('--flx-gradient-from', color), decl('--flx-gradient-stops', 'var(--flx-gradient-from), var(--flx-gradient-to, transparent)')] : null;
|
|
3934
|
+
});
|
|
3935
|
+
reg.dynamicRule('via', function (_ref2) {
|
|
3936
|
+
var value = _ref2.value,
|
|
3937
|
+
modifier = _ref2.modifier,
|
|
3938
|
+
theme = _ref2.theme;
|
|
3939
|
+
var color = colorValue(value, modifier, theme);
|
|
3940
|
+
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;
|
|
3941
|
+
});
|
|
3942
|
+
reg.dynamicRule('to', function (_ref3) {
|
|
3943
|
+
var value = _ref3.value,
|
|
3944
|
+
modifier = _ref3.modifier,
|
|
3945
|
+
theme = _ref3.theme;
|
|
3946
|
+
var color = colorValue(value, modifier, theme);
|
|
3947
|
+
return color ? [decl('--flx-gradient-to', color)] : null;
|
|
3948
|
+
});
|
|
3949
|
+
}
|
|
3950
|
+
|
|
3412
3951
|
function registerLayout(reg) {
|
|
3413
3952
|
props(reg, 'display', {
|
|
3414
3953
|
block: 'block',
|
|
@@ -3495,6 +4034,36 @@ function registerLayout(reg) {
|
|
|
3495
4034
|
if (value.value === 'auto') return [decl('z-index', 'auto')];
|
|
3496
4035
|
return /^\d+$/.test(value.value) ? [decl('z-index', value.value)] : null;
|
|
3497
4036
|
});
|
|
4037
|
+
reg.dynamicRule('columns', function (_ref2) {
|
|
4038
|
+
var value = _ref2.value;
|
|
4039
|
+
if (!value) return null;
|
|
4040
|
+
if (value.kind === 'arbitrary') return [decl('columns', value.value)];
|
|
4041
|
+
if (value.value === 'auto' || /^\d+$/.test(value.value)) return [decl('columns', value.value)];
|
|
4042
|
+
return null;
|
|
4043
|
+
});
|
|
4044
|
+
|
|
4045
|
+
// Scroll snapping. The axis utilities read `--flx-scroll-snap-strictness`
|
|
4046
|
+
// (reset.css defaults it to `proximity`), so `snap-x snap-mandatory` composes.
|
|
4047
|
+
props(reg, 'scroll-snap-type', {
|
|
4048
|
+
'snap-none': 'none',
|
|
4049
|
+
'snap-x': 'x var(--flx-scroll-snap-strictness)',
|
|
4050
|
+
'snap-y': 'y var(--flx-scroll-snap-strictness)',
|
|
4051
|
+
'snap-both': 'both var(--flx-scroll-snap-strictness)'
|
|
4052
|
+
});
|
|
4053
|
+
props(reg, '--flx-scroll-snap-strictness', {
|
|
4054
|
+
'snap-mandatory': 'mandatory',
|
|
4055
|
+
'snap-proximity': 'proximity'
|
|
4056
|
+
});
|
|
4057
|
+
props(reg, 'scroll-snap-align', {
|
|
4058
|
+
'snap-start': 'start',
|
|
4059
|
+
'snap-end': 'end',
|
|
4060
|
+
'snap-center': 'center',
|
|
4061
|
+
'snap-align-none': 'none'
|
|
4062
|
+
});
|
|
4063
|
+
props(reg, 'scroll-snap-stop', {
|
|
4064
|
+
'snap-normal': 'normal',
|
|
4065
|
+
'snap-always': 'always'
|
|
4066
|
+
});
|
|
3498
4067
|
}
|
|
3499
4068
|
var OVERFLOW = {
|
|
3500
4069
|
auto: 'auto',
|
|
@@ -3504,11 +4073,11 @@ var OVERFLOW = {
|
|
|
3504
4073
|
scroll: 'scroll'
|
|
3505
4074
|
};
|
|
3506
4075
|
function inset(reg, root, props) {
|
|
3507
|
-
reg.dynamicRule(root, function (
|
|
3508
|
-
var value =
|
|
3509
|
-
negative =
|
|
3510
|
-
modifier =
|
|
3511
|
-
theme =
|
|
4076
|
+
reg.dynamicRule(root, function (_ref3) {
|
|
4077
|
+
var value = _ref3.value,
|
|
4078
|
+
negative = _ref3.negative,
|
|
4079
|
+
modifier = _ref3.modifier,
|
|
4080
|
+
theme = _ref3.theme;
|
|
3512
4081
|
if ((value === null || value === void 0 ? void 0 : value.kind) === 'named' && value.value === 'auto') return props.map(function (p) {
|
|
3513
4082
|
return decl(p, 'auto');
|
|
3514
4083
|
});
|
|
@@ -3558,6 +4127,29 @@ function registerSpacing(reg) {
|
|
|
3558
4127
|
props = _Object$entries$_i[1];
|
|
3559
4128
|
spacing(reg, root, props, root[0] === 'm');
|
|
3560
4129
|
}
|
|
4130
|
+
spaceBetween(reg, 'x', 'margin-inline-start', 'margin-inline-end');
|
|
4131
|
+
spaceBetween(reg, 'y', 'margin-top', 'margin-bottom');
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
// Only the space *between* siblings, applied to every child after the first via
|
|
4135
|
+
// the adjacent-sibling combinator. `space-x-reverse` flips which edge carries the
|
|
4136
|
+
// margin (a `--flx-space-*-reverse` toggle, so it composes with the value util).
|
|
4137
|
+
var BETWEEN = '& > :not([hidden]) ~ :not([hidden])';
|
|
4138
|
+
function spaceBetween(reg, axis, startProp, endProp) {
|
|
4139
|
+
var flag = "--flx-space-".concat(axis, "-reverse");
|
|
4140
|
+
reg.dynamicRule("space-".concat(axis), function (_ref) {
|
|
4141
|
+
var value = _ref.value,
|
|
4142
|
+
negative = _ref.negative,
|
|
4143
|
+
theme = _ref.theme;
|
|
4144
|
+
if ((value === null || value === void 0 ? void 0 : value.kind) === 'named' && value.value === 'reverse') {
|
|
4145
|
+
return [rule(BETWEEN, [decl(flag, '1')])];
|
|
4146
|
+
}
|
|
4147
|
+
var v = sizeValue(value, theme, {
|
|
4148
|
+
negative: negative
|
|
4149
|
+
});
|
|
4150
|
+
if (!v) return null;
|
|
4151
|
+
return [rule(BETWEEN, [decl(flag, '0'), decl(startProp, "calc(".concat(v, " * calc(1 - var(").concat(flag, ")))")), decl(endProp, "calc(".concat(v, " * var(").concat(flag, "))"))])];
|
|
4152
|
+
});
|
|
3561
4153
|
}
|
|
3562
4154
|
|
|
3563
4155
|
// `px`/`py` expand to the physical left/right, top/bottom pair (not the logical
|
|
@@ -3585,10 +4177,10 @@ var SPACING = {
|
|
|
3585
4177
|
'scroll-p': ['scroll-padding']
|
|
3586
4178
|
};
|
|
3587
4179
|
function spacing(reg, root, props, allowAuto) {
|
|
3588
|
-
reg.dynamicRule(root, function (
|
|
3589
|
-
var value =
|
|
3590
|
-
negative =
|
|
3591
|
-
theme =
|
|
4180
|
+
reg.dynamicRule(root, function (_ref2) {
|
|
4181
|
+
var value = _ref2.value,
|
|
4182
|
+
negative = _ref2.negative,
|
|
4183
|
+
theme = _ref2.theme;
|
|
3592
4184
|
if (allowAuto && (value === null || value === void 0 ? void 0 : value.kind) === 'named' && value.value === 'auto') return props.map(function (p) {
|
|
3593
4185
|
return decl(p, 'auto');
|
|
3594
4186
|
});
|
|
@@ -3601,6 +4193,154 @@ function spacing(reg, root, props, allowAuto) {
|
|
|
3601
4193
|
});
|
|
3602
4194
|
}
|
|
3603
4195
|
|
|
4196
|
+
// Each transform utility sets its own `--flx-*` var and re-declares the composed
|
|
4197
|
+
// `transform`. The vars carry identity defaults (0 / 1) as fallbacks, so any single
|
|
4198
|
+
// utility is valid on its own and several compose (`rotate-45 scale-90`) without an
|
|
4199
|
+
// ordering dependency or a shared base rule.
|
|
4200
|
+
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))';
|
|
4201
|
+
var TRANSFORM = "translate(var(--flx-translate-x,0),var(--flx-translate-y,0)) ".concat(REST);
|
|
4202
|
+
var TRANSFORM_GPU = "translate3d(var(--flx-translate-x,0),var(--flx-translate-y,0),0) ".concat(REST);
|
|
4203
|
+
var compose = function compose(prop, val) {
|
|
4204
|
+
return [decl(prop, val), decl('transform', TRANSFORM)];
|
|
4205
|
+
};
|
|
4206
|
+
function registerTransforms(reg) {
|
|
4207
|
+
var rotate = function rotate(v, neg) {
|
|
4208
|
+
return angle(v, neg);
|
|
4209
|
+
};
|
|
4210
|
+
reg.dynamicRule('rotate', function (_ref) {
|
|
4211
|
+
var value = _ref.value,
|
|
4212
|
+
negative = _ref.negative;
|
|
4213
|
+
var v = rotate(value, negative);
|
|
4214
|
+
return v ? compose('--flx-rotate', v) : null;
|
|
4215
|
+
});
|
|
4216
|
+
reg.dynamicRule('skew-x', function (_ref2) {
|
|
4217
|
+
var value = _ref2.value,
|
|
4218
|
+
negative = _ref2.negative;
|
|
4219
|
+
return wrap('--flx-skew-x', angle(value, negative));
|
|
4220
|
+
});
|
|
4221
|
+
reg.dynamicRule('skew-y', function (_ref3) {
|
|
4222
|
+
var value = _ref3.value,
|
|
4223
|
+
negative = _ref3.negative;
|
|
4224
|
+
return wrap('--flx-skew-y', angle(value, negative));
|
|
4225
|
+
});
|
|
4226
|
+
reg.dynamicRule('scale', function (_ref4) {
|
|
4227
|
+
var value = _ref4.value,
|
|
4228
|
+
negative = _ref4.negative;
|
|
4229
|
+
var v = scaleVal(value, negative);
|
|
4230
|
+
return v ? [decl('--flx-scale-x', v), decl('--flx-scale-y', v), decl('transform', TRANSFORM)] : null;
|
|
4231
|
+
});
|
|
4232
|
+
reg.dynamicRule('scale-x', function (_ref5) {
|
|
4233
|
+
var value = _ref5.value,
|
|
4234
|
+
negative = _ref5.negative;
|
|
4235
|
+
return wrap('--flx-scale-x', scaleVal(value, negative));
|
|
4236
|
+
});
|
|
4237
|
+
reg.dynamicRule('scale-y', function (_ref6) {
|
|
4238
|
+
var value = _ref6.value,
|
|
4239
|
+
negative = _ref6.negative;
|
|
4240
|
+
return wrap('--flx-scale-y', scaleVal(value, negative));
|
|
4241
|
+
});
|
|
4242
|
+
reg.dynamicRule('translate-x', function (_ref7) {
|
|
4243
|
+
var value = _ref7.value,
|
|
4244
|
+
negative = _ref7.negative,
|
|
4245
|
+
theme = _ref7.theme;
|
|
4246
|
+
return wrap('--flx-translate-x', sizeValue(value, theme, {
|
|
4247
|
+
negative: negative
|
|
4248
|
+
}));
|
|
4249
|
+
});
|
|
4250
|
+
reg.dynamicRule('translate-y', function (_ref8) {
|
|
4251
|
+
var value = _ref8.value,
|
|
4252
|
+
negative = _ref8.negative,
|
|
4253
|
+
theme = _ref8.theme;
|
|
4254
|
+
return wrap('--flx-translate-y', sizeValue(value, theme, {
|
|
4255
|
+
negative: negative
|
|
4256
|
+
}));
|
|
4257
|
+
});
|
|
4258
|
+
reg.rule('transform-none', [decl('transform', 'none')]);
|
|
4259
|
+
reg.rule('transform-gpu', [decl('transform', TRANSFORM_GPU)]);
|
|
4260
|
+
reg.rule('transform-cpu', [decl('transform', TRANSFORM)]);
|
|
4261
|
+
keywords(reg, 'origin', 'transform-origin', {
|
|
4262
|
+
center: 'center',
|
|
4263
|
+
top: 'top',
|
|
4264
|
+
'top-right': 'top right',
|
|
4265
|
+
right: 'right',
|
|
4266
|
+
'bottom-right': 'bottom right',
|
|
4267
|
+
bottom: 'bottom',
|
|
4268
|
+
'bottom-left': 'bottom left',
|
|
4269
|
+
left: 'left',
|
|
4270
|
+
'top-left': 'top left'
|
|
4271
|
+
});
|
|
4272
|
+
}
|
|
4273
|
+
function wrap(prop, val) {
|
|
4274
|
+
return val ? compose(prop, val) : null;
|
|
4275
|
+
}
|
|
4276
|
+
function angle(value, negative) {
|
|
4277
|
+
if (!value) return null;
|
|
4278
|
+
if (value.kind === 'arbitrary') return negative ? "calc(".concat(value.value, " * -1)") : value.value;
|
|
4279
|
+
return "".concat(negative ? '-' : '').concat(value.value, "deg");
|
|
4280
|
+
}
|
|
4281
|
+
function scaleVal(value, negative) {
|
|
4282
|
+
if (!value) return null;
|
|
4283
|
+
if (value.kind === 'arbitrary') return negative ? "calc(".concat(value.value, " * -1)") : value.value;
|
|
4284
|
+
if (!/^\d+$/.test(value.value)) return null;
|
|
4285
|
+
var n = (negative ? -1 : 1) * (+value.value / 100);
|
|
4286
|
+
return "".concat(n);
|
|
4287
|
+
}
|
|
4288
|
+
|
|
4289
|
+
var DEFAULT_EASE = 'cubic-bezier(0.4, 0, 0.2, 1)';
|
|
4290
|
+
function registerTransitions(reg) {
|
|
4291
|
+
// `transition` (+ named property groups) also seeds a sensible default duration
|
|
4292
|
+
// and timing function, matching what a bare `transition` is expected to animate.
|
|
4293
|
+
reg.dynamicRule('transition', function (_ref) {
|
|
4294
|
+
var _PROPERTY_GROUPS$valu;
|
|
4295
|
+
var value = _ref.value;
|
|
4296
|
+
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;
|
|
4297
|
+
if (property === null) return null;
|
|
4298
|
+
if (property === 'none') return [decl('transition-property', 'none')];
|
|
4299
|
+
return [decl('transition-property', property), decl('transition-timing-function', DEFAULT_EASE), decl('transition-duration', '150ms')];
|
|
4300
|
+
});
|
|
4301
|
+
reg.dynamicRule('duration', function (_ref2) {
|
|
4302
|
+
var value = _ref2.value;
|
|
4303
|
+
return time('transition-duration', value);
|
|
4304
|
+
});
|
|
4305
|
+
reg.dynamicRule('delay', function (_ref3) {
|
|
4306
|
+
var value = _ref3.value;
|
|
4307
|
+
return time('transition-delay', value);
|
|
4308
|
+
});
|
|
4309
|
+
keywords(reg, 'ease', 'transition-timing-function', {
|
|
4310
|
+
linear: 'linear',
|
|
4311
|
+
"in": 'cubic-bezier(0.4, 0, 1, 1)',
|
|
4312
|
+
out: 'cubic-bezier(0, 0, 0.2, 1)',
|
|
4313
|
+
'in-out': DEFAULT_EASE
|
|
4314
|
+
});
|
|
4315
|
+
keywords(reg, 'animate', 'animation', {
|
|
4316
|
+
none: 'none',
|
|
4317
|
+
spin: 'spin 1s linear infinite',
|
|
4318
|
+
ping: 'ping 1s cubic-bezier(0, 0, 0.2, 1) infinite',
|
|
4319
|
+
pulse: 'pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite',
|
|
4320
|
+
bounce: 'bounce 1s infinite'
|
|
4321
|
+
});
|
|
4322
|
+
keywords(reg, 'will-change', 'will-change', {
|
|
4323
|
+
auto: 'auto',
|
|
4324
|
+
scroll: 'scroll-position',
|
|
4325
|
+
contents: 'contents',
|
|
4326
|
+
transform: 'transform'
|
|
4327
|
+
});
|
|
4328
|
+
}
|
|
4329
|
+
var PROPERTY_GROUPS = {
|
|
4330
|
+
none: 'none',
|
|
4331
|
+
all: 'all',
|
|
4332
|
+
colors: 'color, background-color, border-color, text-decoration-color, fill, stroke',
|
|
4333
|
+
opacity: 'opacity',
|
|
4334
|
+
shadow: 'box-shadow',
|
|
4335
|
+
transform: 'transform'
|
|
4336
|
+
};
|
|
4337
|
+
function time(prop, value) {
|
|
4338
|
+
if (!value) return null;
|
|
4339
|
+
if (value.kind === 'arbitrary') return [decl(prop, value.value)];
|
|
4340
|
+
if (/^\d+$/.test(value.value)) return [decl(prop, "".concat(value.value, "ms"))];
|
|
4341
|
+
return null;
|
|
4342
|
+
}
|
|
4343
|
+
|
|
3604
4344
|
function registerTypography(reg) {
|
|
3605
4345
|
// `text-` is overloaded: a colour token, a font-size token, or an arbitrary of
|
|
3606
4346
|
// either kind. Alignment/overflow keywords (`text-center`, `text-ellipsis`) are
|
|
@@ -3694,6 +4434,12 @@ function registerTypography(reg) {
|
|
|
3694
4434
|
var t = (value === null || value === void 0 ? void 0 : value.kind) === 'named' ? TRACKING[value.value] : null;
|
|
3695
4435
|
return t ? [decl('letter-spacing', t)] : null;
|
|
3696
4436
|
});
|
|
4437
|
+
reg.dynamicRule('content', function (_ref4) {
|
|
4438
|
+
var value = _ref4.value;
|
|
4439
|
+
if (!value) return null;
|
|
4440
|
+
if (value.kind === 'arbitrary') return [decl('content', value.value)];
|
|
4441
|
+
return value.value === 'none' ? [decl('content', 'none')] : null;
|
|
4442
|
+
});
|
|
3697
4443
|
}
|
|
3698
4444
|
var WEIGHTS = {
|
|
3699
4445
|
thin: '100',
|
|
@@ -3742,6 +4488,10 @@ function registerUtilities(reg) {
|
|
|
3742
4488
|
registerBackgrounds(reg);
|
|
3743
4489
|
registerBorders(reg);
|
|
3744
4490
|
registerEffects(reg);
|
|
4491
|
+
registerTransforms(reg);
|
|
4492
|
+
registerTransitions(reg);
|
|
4493
|
+
registerFilters(reg);
|
|
4494
|
+
registerGradients(reg);
|
|
3745
4495
|
}
|
|
3746
4496
|
|
|
3747
4497
|
function registerVariants(reg) {
|
|
@@ -3778,16 +4528,19 @@ function registerVariants(reg) {
|
|
|
3778
4528
|
reg.variant('ltr', {
|
|
3779
4529
|
selector: '&:where([dir="ltr"], [dir="ltr"] *)'
|
|
3780
4530
|
});
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
4531
|
+
reg.variant('*', {
|
|
4532
|
+
selector: '& > *'
|
|
4533
|
+
}); // direct children
|
|
4534
|
+
reg.variant('**', {
|
|
4535
|
+
selector: '& *'
|
|
4536
|
+
}); // all descendants
|
|
4537
|
+
reg.variant('open', {
|
|
4538
|
+
selector: '&:is([open], :open)'
|
|
4539
|
+
});
|
|
4540
|
+
reg.variant('inert', {
|
|
4541
|
+
selector: '&:is([inert], [inert] *)'
|
|
4542
|
+
});
|
|
4543
|
+
registerBreakpointVariants(reg);
|
|
3791
4544
|
|
|
3792
4545
|
// `max-md`, `min-lg` resolve the named breakpoint from the theme; `max-[600px]`
|
|
3793
4546
|
// takes the width verbatim. `max-*` overrides the `max-w`/`max-h` utilities here
|
|
@@ -3804,11 +4557,11 @@ function registerVariants(reg) {
|
|
|
3804
4557
|
reg.dynamicVariant('max', function (v) {
|
|
3805
4558
|
return mediaWidth('max-width', width(v));
|
|
3806
4559
|
});
|
|
3807
|
-
reg.dynamicVariant('group', function (v) {
|
|
3808
|
-
return relational(v, '.group', ' &');
|
|
4560
|
+
reg.dynamicVariant('group', function (v, m) {
|
|
4561
|
+
return relational(v, m, '.group', ' &');
|
|
3809
4562
|
});
|
|
3810
|
-
reg.dynamicVariant('peer', function (v) {
|
|
3811
|
-
return relational(v, '.peer', ' ~ &');
|
|
4563
|
+
reg.dynamicVariant('peer', function (v, m) {
|
|
4564
|
+
return relational(v, m, '.peer', ' ~ &');
|
|
3812
4565
|
});
|
|
3813
4566
|
reg.dynamicVariant('data', function (v) {
|
|
3814
4567
|
return named(v) ? {
|
|
@@ -3826,9 +4579,7 @@ function registerVariants(reg) {
|
|
|
3826
4579
|
} : null;
|
|
3827
4580
|
});
|
|
3828
4581
|
reg.dynamicVariant('not', function (v) {
|
|
3829
|
-
return
|
|
3830
|
-
selector: "&:not(".concat(named(v), ")")
|
|
3831
|
-
} : null;
|
|
4582
|
+
return notVariant(reg, v);
|
|
3832
4583
|
});
|
|
3833
4584
|
reg.dynamicVariant('supports', function (v) {
|
|
3834
4585
|
return named(v) ? {
|
|
@@ -3839,6 +4590,23 @@ function registerVariants(reg) {
|
|
|
3839
4590
|
} : null;
|
|
3840
4591
|
});
|
|
3841
4592
|
}
|
|
4593
|
+
|
|
4594
|
+
// The named breakpoints (`sm:`/`md:`/…) are static variants, so their media params
|
|
4595
|
+
// bake the theme value at registration. A `@theme { --breakpoint-md: … }` override
|
|
4596
|
+
// loaded later wouldn't reach them — so compile() re-runs this after loadTheme to
|
|
4597
|
+
// pick up overrides. (The dynamic `min-*`/`max-*` already resolve at apply time.)
|
|
4598
|
+
function registerBreakpointVariants(reg) {
|
|
4599
|
+
for (var _i4 = 0, _arr = ['sm', 'md', 'lg', 'xl', '2xl']; _i4 < _arr.length; _i4++) {
|
|
4600
|
+
var bp = _arr[_i4];
|
|
4601
|
+
var min = reg.theme.get("--breakpoint-".concat(bp));
|
|
4602
|
+
if (min) reg.variant(bp, {
|
|
4603
|
+
atRule: {
|
|
4604
|
+
name: 'media',
|
|
4605
|
+
params: "(min-width: ".concat(min, ")")
|
|
4606
|
+
}
|
|
4607
|
+
});
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
3842
4610
|
function mediaWidth(feature, value) {
|
|
3843
4611
|
return value ? {
|
|
3844
4612
|
atRule: {
|
|
@@ -3901,16 +4669,34 @@ function named(v) {
|
|
|
3901
4669
|
}
|
|
3902
4670
|
|
|
3903
4671
|
// `group-hover` → `.group:hover &`; `group-[.foo]` → `.group.foo &`. A named value
|
|
3904
|
-
// is a pseudo-class, an arbitrary one is a raw selector fragment.
|
|
3905
|
-
|
|
4672
|
+
// is a pseudo-class, an arbitrary one is a raw selector fragment. A `/name`
|
|
4673
|
+
// modifier scopes to a named group/peer (`group-hover/item` → `.group\/item:hover`).
|
|
4674
|
+
function relational(v, m, base, tail) {
|
|
3906
4675
|
var value = named(v);
|
|
3907
4676
|
if (!value) return null;
|
|
3908
4677
|
var cond = v.kind === 'arbitrary' ? value : ":".concat(value);
|
|
4678
|
+
var scope = m ? "".concat(base, "\\/").concat(m.value) : base;
|
|
3909
4679
|
return {
|
|
3910
|
-
selector: "".concat(
|
|
4680
|
+
selector: "".concat(scope).concat(cond).concat(tail)
|
|
3911
4681
|
};
|
|
3912
4682
|
}
|
|
3913
4683
|
|
|
4684
|
+
// `not-hover` → `&:not(:hover)`, `not-first` → `&:not(:first-child)`: resolve the
|
|
4685
|
+
// inner variant's pseudo, so the selector is valid (not the literal name). Only
|
|
4686
|
+
// simple pseudo variants compose; `not-[…]` takes an arbitrary selector.
|
|
4687
|
+
function notVariant(reg, v) {
|
|
4688
|
+
var _reg$getVariant;
|
|
4689
|
+
var value = named(v);
|
|
4690
|
+
if (!value) return null;
|
|
4691
|
+
if (v.kind === 'arbitrary') return {
|
|
4692
|
+
selector: "&:not(".concat(value, ")")
|
|
4693
|
+
};
|
|
4694
|
+
var frag = (_reg$getVariant = reg.getVariant(value)) === null || _reg$getVariant === void 0 || (_reg$getVariant = _reg$getVariant.selector) === null || _reg$getVariant === void 0 ? void 0 : _reg$getVariant.replace(/^&/, '').trim();
|
|
4695
|
+
return frag && frag.startsWith(':') ? {
|
|
4696
|
+
selector: "&:not(".concat(frag, ")")
|
|
4697
|
+
} : null;
|
|
4698
|
+
}
|
|
4699
|
+
|
|
3914
4700
|
// The batteries-included registry: the default token theme plus the utility
|
|
3915
4701
|
// families and variants. Projects extend it (`@utility`, `@theme`, JS config) or
|
|
3916
4702
|
// build a bare `new Registry(theme)` and register their own.
|
|
@@ -3938,13 +4724,26 @@ function scanAtoms(source) {
|
|
|
3938
4724
|
continue;
|
|
3939
4725
|
}
|
|
3940
4726
|
var j = i;
|
|
3941
|
-
var
|
|
4727
|
+
var bracket = 0;
|
|
4728
|
+
var paren = 0;
|
|
3942
4729
|
while (j < n) {
|
|
3943
4730
|
var c = source[j];
|
|
3944
|
-
if (c === '[')
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
4731
|
+
if (c === '[') {
|
|
4732
|
+
bracket++;
|
|
4733
|
+
} else if (c === ']') {
|
|
4734
|
+
if (bracket === 0) break;
|
|
4735
|
+
bracket--;
|
|
4736
|
+
} else if (bracket > 0) ; else if (c === '(') {
|
|
4737
|
+
// Keep a shorthand paren whole (`bg-(--brand)`, `text-(length:--x)`), but
|
|
4738
|
+
// treat a plain function call (`clsx(…)`) as a boundary so its args scan.
|
|
4739
|
+
if (paren === 0 && !isShorthandParen(source, j)) break;
|
|
4740
|
+
paren++;
|
|
4741
|
+
} else if (c === ')') {
|
|
4742
|
+
if (paren === 0) break;
|
|
4743
|
+
paren--;
|
|
4744
|
+
} else if (paren === 0 && BOUNDARY.has(c)) {
|
|
4745
|
+
break;
|
|
4746
|
+
}
|
|
3948
4747
|
j++;
|
|
3949
4748
|
}
|
|
3950
4749
|
add(found, source.slice(i, j));
|
|
@@ -3952,6 +4751,15 @@ function scanAtoms(source) {
|
|
|
3952
4751
|
}
|
|
3953
4752
|
return _toConsumableArray(found);
|
|
3954
4753
|
}
|
|
4754
|
+
|
|
4755
|
+
// A `(` opens a class shorthand when it holds a CSS var (`(--brand)`) or a typed
|
|
4756
|
+
// value (`(length:--x)`) — otherwise it's a function call and ends the token.
|
|
4757
|
+
function isShorthandParen(s, open) {
|
|
4758
|
+
if (s[open + 1] === '-' && s[open + 2] === '-') return true;
|
|
4759
|
+
var k = open + 1;
|
|
4760
|
+
while (k < s.length && /[a-zA-Z-]/.test(s[k])) k++;
|
|
4761
|
+
return k > open + 1 && s[k] === ':';
|
|
4762
|
+
}
|
|
3955
4763
|
function add(found, token) {
|
|
3956
4764
|
// Trailing sentence/markup punctuation is never part of a class.
|
|
3957
4765
|
var cleaned = token.replace(/[.,;:]+$/, '');
|
|
@@ -4204,10 +5012,14 @@ var MARKER = 'fluixi';
|
|
|
4204
5012
|
// directives are consumed, and an `@fluixi;` marker is replaced by the generated
|
|
4205
5013
|
// token `:root` + utilities. With no marker the generated block is appended.
|
|
4206
5014
|
function transform(input) {
|
|
4207
|
-
var _options$registry, _options$classes, _options$from, _options$sources;
|
|
5015
|
+
var _options$registry, _options$classes, _options$from, _options$resetFrom, _options$sources;
|
|
4208
5016
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5017
|
+
var started = performance.now();
|
|
4209
5018
|
var reg = (_options$registry = options.registry) !== null && _options$registry !== void 0 ? _options$registry : createRegistry();
|
|
4210
|
-
loadTheme(
|
|
5019
|
+
if (options.theme) loadTheme(options.theme, reg.theme);
|
|
5020
|
+
loadTheme(input, reg.theme); // the input's own @theme overrides the base
|
|
5021
|
+
registerBreakpointVariants(reg); // pick up any @theme breakpoint overrides
|
|
5022
|
+
if (options.theme) loadDirectives(options.theme, reg);
|
|
4211
5023
|
loadDirectives(input, reg);
|
|
4212
5024
|
var classes = new Set((_options$classes = options.classes) !== null && _options$classes !== void 0 ? _options$classes : []);
|
|
4213
5025
|
var _iterator = _createForOfIteratorHelper((_options$sources = options.sources) !== null && _options$sources !== void 0 ? _options$sources : []),
|
|
@@ -4309,7 +5121,8 @@ function transform(input) {
|
|
|
4309
5121
|
var start = (_node$loc = node.loc) === null || _node$loc === void 0 ? void 0 : _node$loc.start;
|
|
4310
5122
|
var end = (_node$loc2 = node.loc) === null || _node$loc2 === void 0 ? void 0 : _node$loc2.end;
|
|
4311
5123
|
if (start && end && typeof start.offset === 'number' && typeof end.offset === 'number') {
|
|
4312
|
-
|
|
5124
|
+
var text = expandApply(input.slice(start.offset, end.offset), reg);
|
|
5125
|
+
nodes.push(raw(text, {
|
|
4313
5126
|
source: from,
|
|
4314
5127
|
line: start.line,
|
|
4315
5128
|
column: Math.max(0, start.column - 1)
|
|
@@ -4322,30 +5135,48 @@ function transform(input) {
|
|
|
4322
5135
|
_iterator5.f();
|
|
4323
5136
|
}
|
|
4324
5137
|
if (!injected) nodes.push.apply(nodes, generated);
|
|
4325
|
-
|
|
5138
|
+
var resetFrom = (_options$resetFrom = options.resetFrom) !== null && _options$resetFrom !== void 0 ? _options$resetFrom : 'fluixi:reset.css';
|
|
5139
|
+
if (options.reset) nodes.unshift(raw(options.reset, {
|
|
5140
|
+
source: resetFrom,
|
|
5141
|
+
line: 1,
|
|
5142
|
+
column: 0
|
|
5143
|
+
}));
|
|
5144
|
+
var css;
|
|
5145
|
+
var map;
|
|
4326
5146
|
if (options.sourceMap) {
|
|
4327
|
-
var
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
map.setSourceContent(
|
|
4333
|
-
var json = map.toJSON();
|
|
5147
|
+
var out = stringifyWithMap(nodes, {
|
|
5148
|
+
minify: options.minify
|
|
5149
|
+
});
|
|
5150
|
+
css = out.css;
|
|
5151
|
+
out.map.setSourceContent(from, input);
|
|
5152
|
+
if (options.reset) out.map.setSourceContent(resetFrom, options.reset);
|
|
5153
|
+
var json = out.map.toJSON();
|
|
4334
5154
|
json.file = from;
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
classes: _toConsumableArray(classes),
|
|
4339
|
-
sources: sources,
|
|
4340
|
-
registry: reg
|
|
4341
|
-
};
|
|
4342
|
-
}
|
|
4343
|
-
return {
|
|
4344
|
-
css: stringify(nodes, {
|
|
5155
|
+
map = json;
|
|
5156
|
+
} else {
|
|
5157
|
+
css = stringify(nodes, {
|
|
4345
5158
|
minify: options.minify
|
|
4346
|
-
})
|
|
5159
|
+
});
|
|
5160
|
+
}
|
|
5161
|
+
var stats = {
|
|
5162
|
+
ms: performance.now() - started,
|
|
5163
|
+
scanned: classes.size,
|
|
5164
|
+
utilities: rules.length,
|
|
5165
|
+
bytes: css.length,
|
|
5166
|
+
sources: sources.length
|
|
5167
|
+
};
|
|
5168
|
+
return map ? {
|
|
5169
|
+
css: css,
|
|
5170
|
+
map: map,
|
|
5171
|
+
classes: _toConsumableArray(classes),
|
|
5172
|
+
sources: sources,
|
|
5173
|
+
stats: stats,
|
|
5174
|
+
registry: reg
|
|
5175
|
+
} : {
|
|
5176
|
+
css: css,
|
|
4347
5177
|
classes: _toConsumableArray(classes),
|
|
4348
5178
|
sources: sources,
|
|
5179
|
+
stats: stats,
|
|
4349
5180
|
registry: reg
|
|
4350
5181
|
};
|
|
4351
5182
|
}
|
|
@@ -4377,7 +5208,12 @@ function compile(input) {
|
|
|
4377
5208
|
var _options$registry, _options$classes, _options$sources;
|
|
4378
5209
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4379
5210
|
var reg = (_options$registry = options.registry) !== null && _options$registry !== void 0 ? _options$registry : createRegistry();
|
|
5211
|
+
if (options.theme) loadTheme(options.theme, reg.theme);
|
|
4380
5212
|
loadTheme(input, reg.theme);
|
|
5213
|
+
// Re-seed the named breakpoint variants so a `@theme` breakpoint override reaches
|
|
5214
|
+
// `sm:`/`md:`/… (they baked the default value at registry-creation time).
|
|
5215
|
+
registerBreakpointVariants(reg);
|
|
5216
|
+
if (options.theme) loadDirectives(options.theme, reg);
|
|
4381
5217
|
loadDirectives(input, reg);
|
|
4382
5218
|
var classes = new Set((_options$classes = options.classes) !== null && _options$classes !== void 0 ? _options$classes : []);
|
|
4383
5219
|
var _iterator2 = _createForOfIteratorHelper((_options$sources = options.sources) !== null && _options$sources !== void 0 ? _options$sources : []),
|
|
@@ -4476,5 +5312,5 @@ function compile(input) {
|
|
|
4476
5312
|
};
|
|
4477
5313
|
}
|
|
4478
5314
|
|
|
4479
|
-
export { Registry, SPECIAL_COLORS, Theme, atRule, collectVarRefs, colorValue, compile, compileAtom, compileClasses, createRegistry, decl, decodeUnderscores, defaultTheme, emitTheme, emitUiTheme, escapeClass, keywords, loadDirectives, loadTheme, parseAtom, parseSources, parseVariant, props, raw, registerUtilities, registerVariants, resolveSourceFiles, rule, scanAtoms, scanSourceFiles, sizeValue, splitAtTopLevel, statics, stringify, stringifyWithMap, transform, uiTokenBridges };
|
|
5315
|
+
export { Registry, SPECIAL_COLORS, Theme, atRule, collectVarRefs, colorValue, compile, compileAtom, compileClasses, createRegistry, decl, decodeUnderscores, defaultTheme, emitTheme, emitUiTheme, escapeClass, expandApply, formatBuildLog, keywords, loadDirectives, loadTheme, parseAtom, parseSources, parseVariant, props, raw, registerBreakpointVariants, registerUtilities, registerVariants, resolveSourceFiles, rule, scanAtoms, scanSourceFiles, sizeValue, splitAtTopLevel, statics, stringify, stringifyWithMap, transform, uiTokenBridges };
|
|
4480
5316
|
//# sourceMappingURL=index.mjs.map
|