@datum-cloud/activity-ui 0.7.1-dev.9374d4c → 0.7.1-dev.9d895db

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
@@ -712,6 +712,19 @@ function toDate(argument, context) {
712
712
  * @description
713
713
  * Add the specified number of days to the given date.
714
714
  *
715
+ * **You don't need date-fns\***:
716
+ *
717
+ * Temporal has a built-in `add` method on all its classes:
718
+ *
719
+ * - [`Temporal.Instant.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/add)
720
+ * - [`Temporal.PlainDate.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/add)
721
+ * - [`Temporal.PlainDateTime.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/add)
722
+ * - [`Temporal.PlainTime.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/add)
723
+ * - [`Temporal.PlainYearMonth.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/add)
724
+ * - [`Temporal.ZonedDateTime.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/add)
725
+ *
726
+ * \* **Not really**, see: https://date-fns.org/you-dont-need-date-fns
727
+ *
715
728
  * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
716
729
  * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
717
730
  *
@@ -725,6 +738,12 @@ function toDate(argument, context) {
725
738
  * // Add 10 days to 1 September 2014:
726
739
  * const result = addDays(new Date(2014, 8, 1), 10)
727
740
  * //=> Thu Sep 11 2014 00:00:00
741
+ *
742
+ * @example
743
+ * // Using Temporal:
744
+ * // Add 10 days to 1 September 2014:
745
+ * Temporal.PlainDate.from("2014-09-01").add({ days: 10 }).toString();
746
+ * //=> "2014-09-11"
728
747
  */
729
748
  function addDays(date, amount, options) {
730
749
  const _date = toDate(date, options?.in);
@@ -4691,7 +4710,13 @@ const createParseClassName = config => {
4691
4710
  continue;
4692
4711
  }
4693
4712
  }
4694
- if (currentCharacter === '[') bracketDepth++;else if (currentCharacter === ']') bracketDepth--;else if (currentCharacter === '(') parenDepth++;else if (currentCharacter === ')') parenDepth--;
4713
+ if (currentCharacter === '[') bracketDepth++;else if (currentCharacter === ']') bracketDepth--;else if (currentCharacter === '(') parenDepth++;else if (currentCharacter === ')') parenDepth--;else if (currentCharacter === '\\') index++;else if (currentCharacter === '"' || currentCharacter === "'") {
4714
+ // Quoted delimiters do not affect nesting or separate modifiers.
4715
+ while (++index < len) {
4716
+ const quotedCharacter = className[index];
4717
+ if (quotedCharacter === '\\') index++;else if (quotedCharacter === currentCharacter) break;
4718
+ }
4719
+ }
4695
4720
  }
4696
4721
  const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
4697
4722
  // Inline important modifier check
@@ -4709,7 +4734,13 @@ const createParseClassName = config => {
4709
4734
  baseClassName = baseClassNameWithImportantModifier.slice(1);
4710
4735
  hasImportantModifier = true;
4711
4736
  }
4712
- const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
4737
+ // `maybePostfixModifierPosition` is relative to `baseClassName`, so it must be shifted by
4738
+ // however much the important modifier shortened the name. A leading `!` is removed from
4739
+ // the front, which moves every following index down by one; the position was measured
4740
+ // against `baseClassNameWithImportantModifier`, so without this correction `!text-lg/7`
4741
+ // reports 8 instead of 7 and consumers slice `"text-lg/"`, matching no class group.
4742
+ const importantModifierOffset = hasImportantModifier && baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER) ? IMPORTANT_MODIFIER.length : 0;
4743
+ const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart - importantModifierOffset : undefined;
4713
4744
  return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
4714
4745
  };
4715
4746
  if (prefix) {
@@ -4942,8 +4973,11 @@ const arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
4942
4973
  const arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
4943
4974
  const fractionRegex = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/;
4944
4975
  const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
4945
- const lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
4946
- const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/;
4976
+ // Includes Tailwind's `--spacing()` because Tailwind resolves it to `calc(var(--spacing) * n)` before detecting the value's type. Only a value starting with it counts: Tailwind treats an expression like `-1*--spacing(4)` outside of `calc()` as a color.
4977
+ const lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|Q|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^--spacing\(.+\)|^0$/;
4978
+ // Case-insensitive because CSS function names are, and includes Tailwind's `--alpha()` because it resolves to a color.
4979
+ const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark|contrast-color|device-cmyk|--alpha)\(.+\)$/i;
4980
+ const maskPositionRegex = /^(?:_*[+-]?(?:\d|\.\d)|[\w-]+\(|_*(?:inherit|initial|revert(?:-layer)?|unset)_*$)/i;
4947
4981
  // Shadow always begins with x and y offset separated by underscore optionally prepended by inset
4948
4982
  const shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
4949
4983
  const imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
@@ -4958,6 +4992,9 @@ const isLengthOnly = value =>
4958
4992
  // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
4959
4993
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
4960
4994
  lengthUnitRegex.test(value) && !colorFunctionRegex.test(value);
4995
+ const isMaskPosition = value =>
4996
+ // Mask stops default to positions for variables and non-color CSS functions, including angles, so color functions need to be excluded explicitly.
4997
+ maskPositionRegex.test(value) && !colorFunctionRegex.test(value);
4961
4998
  const isNever = () => false;
4962
4999
  const isShadow = value => shadowRegex.test(value);
4963
5000
  const isImage = value => imageRegex.test(value);
@@ -4966,6 +5003,7 @@ const isNamedContainerQuery = value => value.startsWith('@container') && (value[
4966
5003
  const isArbitrarySize = value => getIsArbitraryValue(value, isLabelSize, isNever);
4967
5004
  const isArbitraryValue = value => arbitraryValueRegex.test(value);
4968
5005
  const isArbitraryLength = value => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
5006
+ const isArbitraryMaskPosition = value => getIsArbitraryValue(value, isLabelMaskPosition, isMaskPosition);
4969
5007
  const isArbitraryNumber = value => getIsArbitraryValue(value, isLabelNumber, isNumber);
4970
5008
  const isArbitraryWeight = value => getIsArbitraryValue(value, isLabelWeight, isAny);
4971
5009
  const isArbitraryFamilyName = value => getIsArbitraryValue(value, isLabelFamilyName, isNever);
@@ -4974,6 +5012,7 @@ const isArbitraryImage = value => getIsArbitraryValue(value, isLabelImage, isIma
4974
5012
  const isArbitraryShadow = value => getIsArbitraryValue(value, isLabelShadow, isShadow);
4975
5013
  const isArbitraryVariable = value => arbitraryVariableRegex.test(value);
4976
5014
  const isArbitraryVariableLength = value => getIsArbitraryVariable(value, isLabelLength);
5015
+ const isArbitraryVariableMaskPosition = value => getIsArbitraryVariable(value, isLabelMaskPosition, true);
4977
5016
  const isArbitraryVariableFamilyName = value => getIsArbitraryVariable(value, isLabelFamilyName);
4978
5017
  const isArbitraryVariablePosition = value => getIsArbitraryVariable(value, isLabelPosition);
4979
5018
  const isArbitraryVariableSize = value => getIsArbitraryVariable(value, isLabelSize);
@@ -5006,6 +5045,7 @@ const isLabelPosition = label => label === 'position' || label === 'percentage';
5006
5045
  const isLabelImage = label => label === 'image' || label === 'url';
5007
5046
  const isLabelSize = label => label === 'length' || label === 'size' || label === 'bg-size';
5008
5047
  const isLabelLength = label => label === 'length';
5048
+ const isLabelMaskPosition = label => label !== 'color';
5009
5049
  const isLabelNumber = label => label === 'number';
5010
5050
  const isLabelFamilyName = label => label === 'family-name';
5011
5051
  const isLabelWeight = label => label === 'number' || label === 'weight';
@@ -5086,7 +5126,7 @@ const getDefaultConfig = () => {
5086
5126
  const scaleBorderWidth = () => ['', isNumber, isArbitraryVariableLength, isArbitraryLength];
5087
5127
  const scaleLineStyle = () => ['solid', 'dashed', 'dotted', 'double'];
5088
5128
  const scaleBlendMode = () => ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'];
5089
- const scaleMaskImagePosition = () => [isNumber, isPercent, isArbitraryVariablePosition, isArbitraryPosition];
5129
+ const scaleMaskImagePosition = () => [isNumber, isPercent, isArbitraryVariableMaskPosition, isArbitraryMaskPosition];
5090
5130
  const scaleBlur = () => [
5091
5131
  // Deprecated since Tailwind CSS v4.0.0
5092
5132
  '', 'none', themeBlur, isArbitraryVariable, isArbitraryValue];
@@ -5197,7 +5237,12 @@ const getDefaultConfig = () => {
5197
5237
  * Screen Reader Only
5198
5238
  * @see https://tailwindcss.com/docs/display#screen-reader-only
5199
5239
  */
5200
- sr: ['sr-only', 'not-sr-only'],
5240
+ sr: ['sr-only'],
5241
+ /**
5242
+ * Not Screen Reader Only
5243
+ * @see https://tailwindcss.com/docs/display#screen-reader-only
5244
+ */
5245
+ 'not-sr': ['not-sr-only'],
5201
5246
  /**
5202
5247
  * Floats
5203
5248
  * @see https://tailwindcss.com/docs/float
@@ -5408,7 +5453,7 @@ const getDefaultConfig = () => {
5408
5453
  * @see https://tailwindcss.com/docs/flex
5409
5454
  */
5410
5455
  flex: [{
5411
- flex: [isNumber, isFraction, 'auto', 'initial', 'none', isArbitraryValue]
5456
+ flex: [isNumber, isFraction, 'auto', 'initial', 'none', isArbitraryVariable, isArbitraryValue]
5412
5457
  }],
5413
5458
  /**
5414
5459
  * Flex Grow
@@ -5964,7 +6009,7 @@ const getDefaultConfig = () => {
5964
6009
  * @see https://tailwindcss.com/docs/line-clamp
5965
6010
  */
5966
6011
  'line-clamp': [{
5967
- 'line-clamp': [isNumber, 'none', isArbitraryVariable, isArbitraryNumber]
6012
+ 'line-clamp': [isNumber, 'none', isArbitraryVariable, isArbitraryValue]
5968
6013
  }],
5969
6014
  /**
5970
6015
  * Line Height
@@ -6034,7 +6079,7 @@ const getDefaultConfig = () => {
6034
6079
  * @see https://tailwindcss.com/docs/text-decoration-thickness
6035
6080
  */
6036
6081
  'text-decoration-thickness': [{
6037
- decoration: [isNumber, 'from-font', 'auto', isArbitraryVariable, isArbitraryLength]
6082
+ decoration: [isNumber, 'from-font', 'auto', isArbitraryVariableLength, isArbitraryVariablePosition, isArbitraryLength]
6038
6083
  }],
6039
6084
  /**
6040
6085
  * Text Decoration Color
@@ -6809,7 +6854,7 @@ const getDefaultConfig = () => {
6809
6854
  'mask-radial-to': scaleColor()
6810
6855
  }],
6811
6856
  'mask-image-radial-shape': [{
6812
- 'mask-radial': ['circle', 'ellipse']
6857
+ mask: ['circle', 'ellipse']
6813
6858
  }],
6814
6859
  'mask-image-radial-size': [{
6815
6860
  'mask-radial': [{
@@ -7657,6 +7702,9 @@ const getDefaultConfig = () => {
7657
7702
  'inset-y': ['inset-bs', 'inset-be', 'top', 'bottom'],
7658
7703
  flex: ['basis', 'grow', 'shrink'],
7659
7704
  gap: ['gap-x', 'gap-y'],
7705
+ 'place-content': ['align-content', 'justify-content'],
7706
+ 'place-items': ['align-items', 'justify-items'],
7707
+ 'place-self': ['align-self', 'justify-self'],
7660
7708
  p: ['px', 'py', 'ps', 'pe', 'pbs', 'pbe', 'pt', 'pr', 'pb', 'pl'],
7661
7709
  px: ['ps', 'pe', 'pr', 'pl'],
7662
7710
  py: ['pbs', 'pbe', 'pt', 'pb'],
@@ -7664,7 +7712,6 @@ const getDefaultConfig = () => {
7664
7712
  mx: ['ms', 'me', 'mr', 'ml'],
7665
7713
  my: ['mbs', 'mbe', 'mt', 'mb'],
7666
7714
  size: ['w', 'h'],
7667
- 'font-size': ['leading'],
7668
7715
  'fvn-normal': ['fvn-ordinal', 'fvn-slashed-zero', 'fvn-figure', 'fvn-spacing', 'fvn-fraction'],
7669
7716
  'fvn-ordinal': ['fvn-normal'],
7670
7717
  'fvn-slashed-zero': ['fvn-normal'],
@@ -7672,6 +7719,11 @@ const getDefaultConfig = () => {
7672
7719
  'fvn-spacing': ['fvn-normal'],
7673
7720
  'fvn-fraction': ['fvn-normal'],
7674
7721
  'line-clamp': ['display', 'overflow'],
7722
+ // Tailwind emits these utilities after `sr-only`, so keeping an earlier `relative` or `p-4` undoes the hide. Removing them is safe because `not-sr-only` resets the same properties when the element is revealed.
7723
+ // Border width and min/max sizes stay independent because `not-sr-only` doesn't reset them, so they still apply once the element is revealed. While hidden they don't undo the hide: the element is absolutely positioned and clipped away.
7724
+ // `not-sr-only` only conflicts with `sr-only`: Tailwind emits these utilities after it too, so an earlier `relative` or `p-4` is meant to apply once the element is visible.
7725
+ sr: ['not-sr', 'position', 'size', 'w', 'h', 'p', 'px', 'py', 'ps', 'pe', 'pbs', 'pbe', 'pt', 'pr', 'pb', 'pl', 'm', 'mx', 'my', 'ms', 'me', 'mbs', 'mbe', 'mt', 'mr', 'mb', 'ml', 'overflow', 'overflow-x', 'overflow-y', 'whitespace'],
7726
+ 'not-sr': ['sr'],
7675
7727
  rounded: ['rounded-s', 'rounded-e', 'rounded-t', 'rounded-r', 'rounded-b', 'rounded-l', 'rounded-ss', 'rounded-se', 'rounded-ee', 'rounded-es', 'rounded-tl', 'rounded-tr', 'rounded-br', 'rounded-bl'],
7676
7728
  'rounded-s': ['rounded-ss', 'rounded-es'],
7677
7729
  'rounded-e': ['rounded-se', 'rounded-ee'],
@@ -7686,6 +7738,14 @@ const getDefaultConfig = () => {
7686
7738
  'border-color': ['border-color-x', 'border-color-y', 'border-color-s', 'border-color-e', 'border-color-bs', 'border-color-be', 'border-color-t', 'border-color-r', 'border-color-b', 'border-color-l'],
7687
7739
  'border-color-x': ['border-color-s', 'border-color-e', 'border-color-r', 'border-color-l'],
7688
7740
  'border-color-y': ['border-color-bs', 'border-color-be', 'border-color-t', 'border-color-b'],
7741
+ 'mask-image-x-from-pos': ['mask-image-r-from-pos', 'mask-image-l-from-pos'],
7742
+ 'mask-image-x-to-pos': ['mask-image-r-to-pos', 'mask-image-l-to-pos'],
7743
+ 'mask-image-x-from-color': ['mask-image-r-from-color', 'mask-image-l-from-color'],
7744
+ 'mask-image-x-to-color': ['mask-image-r-to-color', 'mask-image-l-to-color'],
7745
+ 'mask-image-y-from-pos': ['mask-image-t-from-pos', 'mask-image-b-from-pos'],
7746
+ 'mask-image-y-to-pos': ['mask-image-t-to-pos', 'mask-image-b-to-pos'],
7747
+ 'mask-image-y-from-color': ['mask-image-t-from-color', 'mask-image-b-from-color'],
7748
+ 'mask-image-y-to-color': ['mask-image-t-to-color', 'mask-image-b-to-color'],
7689
7749
  translate: ['translate-x', 'translate-y', 'translate-none'],
7690
7750
  'translate-none': ['translate', 'translate-x', 'translate-y', 'translate-z'],
7691
7751
  'scroll-m': ['scroll-mx', 'scroll-my', 'scroll-ms', 'scroll-me', 'scroll-mbs', 'scroll-mbe', 'scroll-mt', 'scroll-mr', 'scroll-mb', 'scroll-ml'],
@@ -7700,6 +7760,7 @@ const getDefaultConfig = () => {
7700
7760
  'touch-pz': ['touch']
7701
7761
  },
7702
7762
  conflictingClassGroupModifiers: {
7763
+ // Only a font size with a line-height modifier like `text-lg/7` sets `line-height` directly. Without a modifier, font sizes don't conflict with `leading-*`: arbitrary ones only set `font-size`, and the theme ones set `line-height: var(--tw-leading, …)`, so an earlier `leading-*` keeps applying in Tailwind's CSS.
7703
7764
  'font-size': ['leading']
7704
7765
  },
7705
7766
  postfixLookupClassGroups: ['container-type'],