clava 0.3.0 → 0.4.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/index.js CHANGED
@@ -223,7 +223,8 @@ function isHTMLObjStyle(style) {
223
223
  //#region src/index.ts
224
224
  const META_KEY = "__meta";
225
225
  const EMPTY_DEFAULTS = Object.freeze({});
226
- const MAX_COMPUTED_RUNS = 50;
226
+ const MAX_REFINE_RUNS = 50;
227
+ const REFINE_UNSTABLE_TRACKING_WINDOW = 10;
227
228
  function areVariantsEqual(a, b) {
228
229
  for (const key in a) {
229
230
  if (!Object.hasOwn(a, key)) continue;
@@ -235,10 +236,47 @@ function areVariantsEqual(a, b) {
235
236
  }
236
237
  return true;
237
238
  }
238
- function warnComputedLimit(runState) {
239
+ function captureCreationFrame(skipFn) {
240
+ if (process.env.NODE_ENV === "production") return void 0;
241
+ if (typeof Error.captureStackTrace === "function") {
242
+ const holder = {};
243
+ Error.captureStackTrace(holder, skipFn);
244
+ return holder;
245
+ }
246
+ return /* @__PURE__ */ new Error();
247
+ }
248
+ function formatCreationStack(frame) {
249
+ let stack = frame.stack;
250
+ if (!stack) return void 0;
251
+ const newlineIdx = stack.indexOf("\n");
252
+ if (newlineIdx > 0) {
253
+ const firstLine = stack.slice(0, newlineIdx);
254
+ if (firstLine === "Error" || firstLine.startsWith("Error:")) stack = stack.slice(newlineIdx + 1);
255
+ }
256
+ return stack;
257
+ }
258
+ function accumulateUnstableVariantKeys(into, prev, next) {
259
+ for (const key in next) {
260
+ if (!Object.hasOwn(next, key)) continue;
261
+ if (!Object.is(prev[key], next[key])) into.add(key);
262
+ }
263
+ for (const key in prev) {
264
+ if (!Object.hasOwn(prev, key)) continue;
265
+ if (Object.hasOwn(next, key)) continue;
266
+ into.add(key);
267
+ }
268
+ }
269
+ function warnRefineLimit(runState, creationFrame, unstableKeys) {
270
+ if (process.env.NODE_ENV === "production") return;
239
271
  if (runState.warned) return;
240
272
  runState.warned = true;
241
- if (process.env.NODE_ENV !== "production") console.warn("Clava: Maximum computed update iterations exceeded. This can happen when a computed callback calls setVariants or setDefaultVariants, but one of the variants changes on every run.");
273
+ let message = "Clava: Maximum refine iterations exceeded. This can happen when a refine callback calls setVariants or setDefaultVariants, but one of the variants changes on every run.";
274
+ if (unstableKeys && unstableKeys.size > 0) message += `\nVariant(s) that did not stabilize: ${Array.from(unstableKeys).join(", ")}.`;
275
+ if (creationFrame) {
276
+ const creationStack = formatCreationStack(creationFrame);
277
+ if (creationStack) message += `\nComponent created at:\n${creationStack}`;
278
+ }
279
+ console.warn(message);
242
280
  }
243
281
  function getExtUserVariantProps(userVariantProps, protectedVariants, changedVariants) {
244
282
  const extUserVariantProps = {};
@@ -334,10 +372,6 @@ function collectVariantKeys(config) {
334
372
  }
335
373
  keys.add(key);
336
374
  }
337
- if (config.computedVariants) for (const key in config.computedVariants) {
338
- if (!Object.hasOwn(config.computedVariants, key)) continue;
339
- keys.add(key);
340
- }
341
375
  return Array.from(keys);
342
376
  }
343
377
  function isVariantDisabled(config, key) {
@@ -514,28 +548,27 @@ function create({ transformClass = (className) => className } = {}) {
514
548
  const extend = config.extend;
515
549
  const hasExtend = !!extend && extend.length > 0;
516
550
  const variants = config.variants;
517
- const computedVariantsCfg = config.computedVariants;
518
- const computed = config.computed;
551
+ const refine = config.refine;
519
552
  const baseStyle = config.style;
520
553
  const hasBaseStyle = !!baseStyle;
521
554
  const variantEntryNames = [];
522
555
  const variantEntryDefs = [];
556
+ const functionVariantNames = [];
557
+ const functionVariantFns = [];
523
558
  if (variants) for (const name in variants) {
524
559
  if (!Object.hasOwn(variants, name)) continue;
525
560
  const variant = variants[name];
526
561
  if (variant === null) continue;
562
+ if (typeof variant === "function") {
563
+ functionVariantNames.push(name);
564
+ functionVariantFns.push(variant);
565
+ continue;
566
+ }
527
567
  variantEntryNames.push(name);
528
568
  variantEntryDefs.push(buildPrebuiltVariant(variant));
529
569
  }
530
570
  const variantEntryCount = variantEntryNames.length;
531
- const computedVariantNames = [];
532
- const computedVariantFns = [];
533
- if (computedVariantsCfg) for (const name in computedVariantsCfg) {
534
- if (!Object.hasOwn(computedVariantsCfg, name)) continue;
535
- computedVariantNames.push(name);
536
- computedVariantFns.push(computedVariantsCfg[name]);
537
- }
538
- const computedVariantCount = computedVariantNames.length;
571
+ const functionVariantCount = functionVariantNames.length;
539
572
  const staticDefaults = {};
540
573
  if (extend) for (const ext of extend) {
541
574
  const meta = getComponentMeta(ext);
@@ -576,18 +609,39 @@ function create({ transformClass = (className) => className } = {}) {
576
609
  } else extBaseClassesArr.push(meta.baseClass);
577
610
  }
578
611
  const extCount = extMetas.length;
579
- const extMetasWithComputed = [];
612
+ const extMetasWithRefine = [];
580
613
  for (let i = 0; i < extCount; i++) {
581
614
  const meta = extMetas[i];
582
- if (meta.resolveDefaults) extMetasWithComputed.push(meta);
615
+ if (meta.resolveDefaults) extMetasWithRefine.push(meta);
616
+ }
617
+ const extMetasWithRefineCount = extMetasWithRefine.length;
618
+ const shouldCollectChangedVariants = extMetasWithRefineCount > 0;
619
+ const creationFrame = !!refine || extMetasWithRefineCount > 0 ? captureCreationFrame(cv) : void 0;
620
+ const functionVariantKeys = /* @__PURE__ */ new Set();
621
+ for (let i = 0; i < extCount; i++) {
622
+ const fnKeys = extMetas[i].functionVariantKeys;
623
+ for (const k of fnKeys) {
624
+ if (disabledVariantKeys.has(k)) continue;
625
+ functionVariantKeys.add(k);
626
+ }
627
+ }
628
+ for (let i = 0; i < functionVariantCount; i++) functionVariantKeys.add(functionVariantNames[i]);
629
+ for (let i = 0; i < variantEntryCount; i++) functionVariantKeys.delete(variantEntryNames[i]);
630
+ let staticVariantsOverridingExtFn = null;
631
+ if (variantEntryCount > 0 && extCount > 0) for (let i = 0; i < variantEntryCount; i++) {
632
+ const name = variantEntryNames[i];
633
+ for (let j = 0; j < extCount; j++) if (extMetas[j].functionVariantKeys.has(name)) {
634
+ if (!staticVariantsOverridingExtFn) staticVariantsOverridingExtFn = [];
635
+ staticVariantsOverridingExtFn.push(name);
636
+ break;
637
+ }
583
638
  }
584
- const extMetasWithComputedCount = extMetasWithComputed.length;
585
- const shouldCollectChangedVariants = extMetasWithComputedCount > 0;
586
639
  let staticExtSkipKeys = null;
587
- if (hasDisabledVariantKeys || computedVariantCount > 0) {
640
+ if (hasDisabledVariantKeys || functionVariantCount > 0 || staticVariantsOverridingExtFn !== null) {
588
641
  staticExtSkipKeys = /* @__PURE__ */ new Set();
589
642
  for (const k of disabledVariantKeys) staticExtSkipKeys.add(k);
590
- for (let i = 0; i < computedVariantCount; i++) staticExtSkipKeys.add(computedVariantNames[i]);
643
+ for (let i = 0; i < functionVariantCount; i++) staticExtSkipKeys.add(functionVariantNames[i]);
644
+ if (staticVariantsOverridingExtFn) for (const k of staticVariantsOverridingExtFn) staticExtSkipKeys.add(k);
591
645
  }
592
646
  const staticExtSkipValues = hasDisabledVariantValues ? disabledVariantValues : null;
593
647
  function filterDisabledInto(input, out) {
@@ -606,7 +660,7 @@ function create({ transformClass = (className) => className } = {}) {
606
660
  out[key] = value;
607
661
  }
608
662
  }
609
- const resolveDefaultsFn = computed || extMetasWithComputedCount > 0 ? (childDefaults, userProps = EMPTY_DEFAULTS) => {
663
+ const resolveDefaultsFn = refine || extMetasWithRefineCount > 0 ? (childDefaults, userProps = EMPTY_DEFAULTS) => {
610
664
  const resolvedVariants = {};
611
665
  Object.assign(resolvedVariants, staticDefaults);
612
666
  for (const key in childDefaults) {
@@ -621,21 +675,21 @@ function create({ transformClass = (className) => className } = {}) {
621
675
  if (v === void 0) continue;
622
676
  resolvedVariants[key] = v;
623
677
  }
624
- const computedDefaults = {};
625
- for (let i = 0; i < extMetasWithComputedCount; i++) {
626
- const extDefaults = extMetasWithComputed[i].resolveDefaults(childDefaults, userProps);
678
+ const refineDefaults = {};
679
+ for (let i = 0; i < extMetasWithRefineCount; i++) {
680
+ const extDefaults = extMetasWithRefine[i].resolveDefaults(childDefaults, userProps);
627
681
  for (const k in extDefaults) {
628
682
  if (!Object.hasOwn(extDefaults, k)) continue;
629
- computedDefaults[k] = extDefaults[k];
683
+ refineDefaults[k] = extDefaults[k];
630
684
  }
631
685
  }
632
- if (computed) {
686
+ if (refine) {
633
687
  const ownVariants = {};
634
688
  for (let i = 0; i < variantKeysLength; i++) {
635
689
  const k = variantKeys[i];
636
690
  if (Object.hasOwn(resolvedVariants, k)) ownVariants[k] = resolvedVariants[k];
637
691
  }
638
- computed({
692
+ refine({
639
693
  variants: ownVariants,
640
694
  setVariants: noop,
641
695
  setDefaultVariants: (newDefaults) => {
@@ -645,23 +699,23 @@ function create({ transformClass = (className) => className } = {}) {
645
699
  if (userProps[key] !== void 0) continue;
646
700
  if (isVariantDisabled(config, key)) continue;
647
701
  if (isVariantValueDisabled(config, key, value)) continue;
648
- computedDefaults[key] = value;
702
+ refineDefaults[key] = value;
649
703
  }
650
704
  },
651
705
  addClass: noop,
652
706
  addStyle: noop
653
707
  });
654
708
  }
655
- return computedDefaults;
709
+ return refineDefaults;
656
710
  } : null;
657
711
  function resolveVariantsHot(propsVariants) {
658
712
  const defaults = {};
659
713
  Object.assign(defaults, staticDefaults);
660
- for (let i = 0; i < extMetasWithComputedCount; i++) {
661
- const extComputed = extMetasWithComputed[i].resolveDefaults(defaults, propsVariants);
662
- for (const k in extComputed) {
663
- if (!Object.hasOwn(extComputed, k)) continue;
664
- defaults[k] = extComputed[k];
714
+ for (let i = 0; i < extMetasWithRefineCount; i++) {
715
+ const extDefaults = extMetasWithRefine[i].resolveDefaults(defaults, propsVariants);
716
+ for (const k in extDefaults) {
717
+ if (!Object.hasOwn(extDefaults, k)) continue;
718
+ defaults[k] = extDefaults[k];
665
719
  }
666
720
  }
667
721
  for (const k in propsVariants) {
@@ -675,12 +729,12 @@ function create({ transformClass = (className) => className } = {}) {
675
729
  filterDisabledInto(defaults, result);
676
730
  return result;
677
731
  }
678
- const runComputedContext = (resolved, userVariantProps, filterOwnVariants, collectOutput, protectedVariants, pendingProtectedVariants, protectedVariantKeys) => {
732
+ const runRefineContext = (resolved, userVariantProps, filterOwnVariants, collectOutput, protectedVariants, pendingProtectedVariants, protectedVariantKeys) => {
679
733
  let workingResolved = resolved;
680
734
  let cClasses = null;
681
735
  let cStyle = null;
682
736
  let changedVariants = null;
683
- if (computed) {
737
+ if (refine) {
684
738
  let ownVariants = resolved;
685
739
  if (filterOwnVariants) {
686
740
  const filteredVariants = {};
@@ -713,7 +767,7 @@ function create({ transformClass = (className) => className } = {}) {
713
767
  const getCurrentVariantValue = (key) => {
714
768
  return updatedVariants ? updatedVariants[key] : ownVariants[key];
715
769
  };
716
- const result = computed({
770
+ const result = refine({
717
771
  variants: ownVariants,
718
772
  setVariants: (newVariants) => {
719
773
  if (!hasAnyDisabled) {
@@ -798,12 +852,12 @@ function create({ transformClass = (className) => className } = {}) {
798
852
  let cClasses = null;
799
853
  let cStyle = null;
800
854
  let changedVariants = null;
801
- if (computed) {
802
- const computedResult = runComputedContext(resolved, userVariantProps, true, true, protectedVariants, pendingProtectedVariants, protectedVariantKeys);
803
- workingResolved = computedResult.workingResolved;
804
- cClasses = computedResult.classes;
805
- cStyle = computedResult.style;
806
- changedVariants = computedResult.changedVariants;
855
+ if (refine) {
856
+ const refineResult = runRefineContext(resolved, userVariantProps, true, true, protectedVariants, pendingProtectedVariants, protectedVariantKeys);
857
+ workingResolved = refineResult.workingResolved;
858
+ cClasses = refineResult.classes;
859
+ cStyle = refineResult.style;
860
+ changedVariants = refineResult.changedVariants;
807
861
  }
808
862
  if (hasExtend) {
809
863
  let extSkipKeys;
@@ -828,7 +882,7 @@ function create({ transformClass = (className) => className } = {}) {
828
882
  } else extSkipVals[k] = staticExtSkipValues[k];
829
883
  }
830
884
  }
831
- const extUserVariantProps = extMetasWithComputedCount > 0 ? getExtUserVariantProps(userVariantProps, protectedVariants ?? null, changedVariants) : userVariantProps;
885
+ const extUserVariantProps = extMetasWithRefineCount > 0 ? getExtUserVariantProps(userVariantProps, protectedVariants ?? null, changedVariants) : userVariantProps;
832
886
  for (let i = 0; i < extCount; i++) {
833
887
  if (hasIsolatedExt && extIsolated[i]) {
834
888
  const extClasses = [];
@@ -838,7 +892,7 @@ function create({ transformClass = (className) => className } = {}) {
838
892
  if (joined.length > 0) classesOut.push(extMetas[i].transformClass(joined));
839
893
  }
840
894
  } else workingResolved = extMetas[i].compute(workingResolved, extUserVariantProps, extSkipKeys, extSkipVals, classesOut, styleOut, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys);
841
- if (protectedVariants && extMetasWithComputedCount > 0) Object.assign(extUserVariantProps, protectedVariants);
895
+ if (protectedVariants && extMetasWithRefineCount > 0) Object.assign(extUserVariantProps, protectedVariants);
842
896
  }
843
897
  }
844
898
  if (hasBaseStyle) Object.assign(styleOut, baseStyle);
@@ -865,14 +919,14 @@ function create({ transformClass = (className) => className } = {}) {
865
919
  if (v.style) Object.assign(styleOut, v.style);
866
920
  }
867
921
  }
868
- for (let i = 0; i < computedVariantCount; i++) {
869
- const variantName = computedVariantNames[i];
922
+ for (let i = 0; i < functionVariantCount; i++) {
923
+ const variantName = functionVariantNames[i];
870
924
  if (ownSkipKeys && ownSkipKeys.has(variantName)) continue;
871
925
  const selectedValue = workingResolved[variantName];
872
926
  if (selectedValue === void 0) continue;
873
927
  const selectedKey = getVariantValueKey(selectedValue);
874
928
  if (ownSkipValues && selectedKey != null && ownSkipValues[variantName]?.has(selectedKey)) continue;
875
- const fn = computedVariantFns[i];
929
+ const fn = functionVariantFns[i];
876
930
  const computedResult = fn(selectedValue);
877
931
  if (computedResult == null) continue;
878
932
  const r = extractClassAndStylePrebuilt(computedResult);
@@ -883,16 +937,12 @@ function create({ transformClass = (className) => className } = {}) {
883
937
  if (cStyle) Object.assign(styleOut, cStyle);
884
938
  return workingResolved;
885
939
  };
886
- const compute = !computed && extMetasWithComputedCount === 0 ? (resolved, userVariantProps, skipKeys, skipValues, classesOut, styleOut, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys) => {
887
- return computeOnce(resolved, userVariantProps, skipKeys, skipValues, classesOut, styleOut, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys);
888
- } : (resolved, userVariantProps, skipKeys, skipValues, classesOut, styleOut, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys) => {
889
- runState ??= {
890
- remaining: MAX_COMPUTED_RUNS,
891
- warned: false
892
- };
940
+ const compute = !refine && extMetasWithRefineCount === 0 ? computeOnce : (resolved, userVariantProps, skipKeys, skipValues, classesOut, styleOut, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys) => {
941
+ runState ??= { remaining: MAX_REFINE_RUNS };
893
942
  protectedVariants ??= {};
894
943
  protectedVariantKeys ??= /* @__PURE__ */ new Set();
895
944
  let workingResolved = resolved;
945
+ let unstableKeys = null;
896
946
  let lastClasses = [];
897
947
  let lastStyle = {};
898
948
  let isFirstRun = true;
@@ -920,8 +970,12 @@ function create({ transformClass = (className) => className } = {}) {
920
970
  }
921
971
  return nextResolved;
922
972
  }
973
+ if (process.env.NODE_ENV !== "production" && runState.remaining < REFINE_UNSTABLE_TRACKING_WINDOW) {
974
+ if (!unstableKeys) unstableKeys = /* @__PURE__ */ new Set();
975
+ accumulateUnstableVariantKeys(unstableKeys, workingResolved, nextResolved);
976
+ }
923
977
  if (useDirectOutput && runState.remaining === 0) {
924
- warnComputedLimit(runState);
978
+ warnRefineLimit(runState, creationFrame, unstableKeys);
925
979
  return nextResolved;
926
980
  }
927
981
  if (useDirectOutput) {
@@ -934,43 +988,41 @@ function create({ transformClass = (className) => className } = {}) {
934
988
  workingResolved = nextResolved;
935
989
  isFirstRun = false;
936
990
  }
937
- warnComputedLimit(runState);
991
+ warnRefineLimit(runState, creationFrame, unstableKeys);
938
992
  for (let i = 0; i < lastClasses.length; i++) classesOut.push(lastClasses[i]);
939
993
  Object.assign(styleOut, lastStyle);
940
994
  return workingResolved;
941
995
  };
942
- const resolveComputedOnce = (resolved, userVariantProps, filterOwnVariants = true, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys) => {
996
+ const resolveRefineOnce = (resolved, userVariantProps, filterOwnVariants = true, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys) => {
943
997
  let workingResolved = resolved;
944
998
  let changedVariants = null;
945
- if (computed) {
946
- const computedResult = runComputedContext(resolved, userVariantProps, filterOwnVariants, false, protectedVariants, pendingProtectedVariants, protectedVariantKeys);
947
- workingResolved = computedResult.workingResolved;
948
- changedVariants = computedResult.changedVariants;
999
+ if (refine) {
1000
+ const refineResult = runRefineContext(resolved, userVariantProps, filterOwnVariants, false, protectedVariants, pendingProtectedVariants, protectedVariantKeys);
1001
+ workingResolved = refineResult.workingResolved;
1002
+ changedVariants = refineResult.changedVariants;
949
1003
  }
950
- if (extMetasWithComputedCount > 0) {
1004
+ if (extMetasWithRefineCount > 0) {
951
1005
  const extUserVariantProps = getExtUserVariantProps(userVariantProps, protectedVariants ?? null, changedVariants);
952
- for (let i = 0; i < extMetasWithComputedCount; i++) {
953
- const resolveComputed = extMetasWithComputed[i].resolveComputed;
954
- if (!resolveComputed) continue;
955
- workingResolved = resolveComputed(workingResolved, extUserVariantProps, true, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys);
1006
+ for (let i = 0; i < extMetasWithRefineCount; i++) {
1007
+ const resolveRefine = extMetasWithRefine[i].resolveRefine;
1008
+ if (!resolveRefine) continue;
1009
+ workingResolved = resolveRefine(workingResolved, extUserVariantProps, true, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys);
956
1010
  if (protectedVariants) Object.assign(extUserVariantProps, protectedVariants);
957
1011
  }
958
1012
  }
959
1013
  return workingResolved;
960
1014
  };
961
- const resolveComputed = computed || extMetasWithComputedCount > 0 ? (resolved, userVariantProps, filterOwnVariants = true, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys) => {
962
- runState ??= {
963
- remaining: MAX_COMPUTED_RUNS,
964
- warned: false
965
- };
1015
+ const resolveRefine = refine || extMetasWithRefineCount > 0 ? (resolved, userVariantProps, filterOwnVariants = true, runState, protectedVariants, pendingProtectedVariants, protectedVariantKeys) => {
1016
+ runState ??= { remaining: MAX_REFINE_RUNS };
966
1017
  protectedVariants ??= {};
967
1018
  protectedVariantKeys ??= /* @__PURE__ */ new Set();
968
1019
  let workingResolved = resolved;
1020
+ let unstableKeys = null;
969
1021
  let reachedLimit = true;
970
1022
  while (runState.remaining > 0) {
971
1023
  runState.remaining -= 1;
972
1024
  const nextPendingProtectedVariants = {};
973
- const nextResolved = resolveComputedOnce(workingResolved, userVariantProps, filterOwnVariants, runState, protectedVariants, nextPendingProtectedVariants, protectedVariantKeys);
1025
+ const nextResolved = resolveRefineOnce(workingResolved, userVariantProps, filterOwnVariants, runState, protectedVariants, nextPendingProtectedVariants, protectedVariantKeys);
974
1026
  let protectedChanged;
975
1027
  if (pendingProtectedVariants) protectedChanged = mergeVariants(pendingProtectedVariants, nextPendingProtectedVariants, protectedVariantKeys);
976
1028
  else protectedChanged = mergeVariants(protectedVariants, nextPendingProtectedVariants, protectedVariantKeys);
@@ -979,9 +1031,13 @@ function create({ transformClass = (className) => className } = {}) {
979
1031
  reachedLimit = false;
980
1032
  break;
981
1033
  }
1034
+ if (process.env.NODE_ENV !== "production" && runState.remaining < REFINE_UNSTABLE_TRACKING_WINDOW) {
1035
+ if (!unstableKeys) unstableKeys = /* @__PURE__ */ new Set();
1036
+ accumulateUnstableVariantKeys(unstableKeys, workingResolved, nextResolved);
1037
+ }
982
1038
  workingResolved = nextResolved;
983
1039
  }
984
- if (reachedLimit) warnComputedLimit(runState);
1040
+ if (reachedLimit) warnRefineLimit(runState, creationFrame, unstableKeys);
985
1041
  return workingResolved;
986
1042
  } : null;
987
1043
  const computeResult = (props = EMPTY_DEFAULTS) => {
@@ -989,17 +1045,17 @@ function create({ transformClass = (className) => className } = {}) {
989
1045
  let resolved = {};
990
1046
  Object.assign(resolved, staticDefaults);
991
1047
  let userVariantProps;
992
- if (extMetasWithComputedCount > 0) {
1048
+ if (extMetasWithRefineCount > 0) {
993
1049
  const variantProps = {};
994
1050
  for (let i = 0; i < variantKeysLength; i++) {
995
1051
  const key = variantKeys[i];
996
1052
  if (Object.hasOwn(propsRecord, key)) variantProps[key] = propsRecord[key];
997
1053
  }
998
- for (let i = 0; i < extMetasWithComputedCount; i++) {
999
- const extComputed = extMetasWithComputed[i].resolveDefaults(resolved, variantProps);
1000
- for (const k in extComputed) {
1001
- if (!Object.hasOwn(extComputed, k)) continue;
1002
- resolved[k] = extComputed[k];
1054
+ for (let i = 0; i < extMetasWithRefineCount; i++) {
1055
+ const extDefaults = extMetasWithRefine[i].resolveDefaults(resolved, variantProps);
1056
+ for (const k in extDefaults) {
1057
+ if (!Object.hasOwn(extDefaults, k)) continue;
1058
+ resolved[k] = extDefaults[k];
1003
1059
  }
1004
1060
  }
1005
1061
  for (const k in variantProps) {
@@ -1050,7 +1106,7 @@ function create({ transformClass = (className) => className } = {}) {
1050
1106
  const getVariants = (variants) => {
1051
1107
  const variantProps = variants ?? EMPTY_DEFAULTS;
1052
1108
  let resolvedVariants = resolveVariantsHot(variantProps);
1053
- if (resolveComputed) resolvedVariants = resolveComputed(resolvedVariants, variantProps, false);
1109
+ if (resolveRefine) resolvedVariants = resolveRefine(resolvedVariants, variantProps, false);
1054
1110
  return resolvedVariants;
1055
1111
  };
1056
1112
  const computedBaseClass = hasExtend ? clsx(...extBaseClassesArr, config.class) : clsx(config.class);
@@ -1062,8 +1118,9 @@ function create({ transformClass = (className) => className } = {}) {
1062
1118
  staticDefaults,
1063
1119
  resolveDefaults: resolveDefaultsFn,
1064
1120
  compute,
1065
- resolveComputed,
1066
- transformClass
1121
+ resolveRefine,
1122
+ transformClass,
1123
+ functionVariantKeys
1067
1124
  };
1068
1125
  const initComponent = (c, propKeys, style) => {
1069
1126
  c.class = classFn;