@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.esm.js CHANGED
@@ -702,6 +702,19 @@ function toDate(argument, context) {
702
702
  * @description
703
703
  * Add the specified number of days to the given date.
704
704
  *
705
+ * **You don't need date-fns\***:
706
+ *
707
+ * Temporal has a built-in `add` method on all its classes:
708
+ *
709
+ * - [`Temporal.Instant.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/add)
710
+ * - [`Temporal.PlainDate.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/add)
711
+ * - [`Temporal.PlainDateTime.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/add)
712
+ * - [`Temporal.PlainTime.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/add)
713
+ * - [`Temporal.PlainYearMonth.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/add)
714
+ * - [`Temporal.ZonedDateTime.prototype.add()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/add)
715
+ *
716
+ * \* **Not really**, see: https://date-fns.org/you-dont-need-date-fns
717
+ *
705
718
  * @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).
706
719
  * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
707
720
  *
@@ -715,6 +728,12 @@ function toDate(argument, context) {
715
728
  * // Add 10 days to 1 September 2014:
716
729
  * const result = addDays(new Date(2014, 8, 1), 10)
717
730
  * //=> Thu Sep 11 2014 00:00:00
731
+ *
732
+ * @example
733
+ * // Using Temporal:
734
+ * // Add 10 days to 1 September 2014:
735
+ * Temporal.PlainDate.from("2014-09-01").add({ days: 10 }).toString();
736
+ * //=> "2014-09-11"
718
737
  */
719
738
  function addDays(date, amount, options) {
720
739
  const _date = toDate(date, options?.in);
@@ -4681,7 +4700,13 @@ const createParseClassName = config => {
4681
4700
  continue;
4682
4701
  }
4683
4702
  }
4684
- if (currentCharacter === '[') bracketDepth++;else if (currentCharacter === ']') bracketDepth--;else if (currentCharacter === '(') parenDepth++;else if (currentCharacter === ')') parenDepth--;
4703
+ if (currentCharacter === '[') bracketDepth++;else if (currentCharacter === ']') bracketDepth--;else if (currentCharacter === '(') parenDepth++;else if (currentCharacter === ')') parenDepth--;else if (currentCharacter === '\\') index++;else if (currentCharacter === '"' || currentCharacter === "'") {
4704
+ // Quoted delimiters do not affect nesting or separate modifiers.
4705
+ while (++index < len) {
4706
+ const quotedCharacter = className[index];
4707
+ if (quotedCharacter === '\\') index++;else if (quotedCharacter === currentCharacter) break;
4708
+ }
4709
+ }
4685
4710
  }
4686
4711
  const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
4687
4712
  // Inline important modifier check
@@ -4699,7 +4724,13 @@ const createParseClassName = config => {
4699
4724
  baseClassName = baseClassNameWithImportantModifier.slice(1);
4700
4725
  hasImportantModifier = true;
4701
4726
  }
4702
- const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
4727
+ // `maybePostfixModifierPosition` is relative to `baseClassName`, so it must be shifted by
4728
+ // however much the important modifier shortened the name. A leading `!` is removed from
4729
+ // the front, which moves every following index down by one; the position was measured
4730
+ // against `baseClassNameWithImportantModifier`, so without this correction `!text-lg/7`
4731
+ // reports 8 instead of 7 and consumers slice `"text-lg/"`, matching no class group.
4732
+ const importantModifierOffset = hasImportantModifier && baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER) ? IMPORTANT_MODIFIER.length : 0;
4733
+ const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart - importantModifierOffset : undefined;
4703
4734
  return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
4704
4735
  };
4705
4736
  if (prefix) {
@@ -4932,8 +4963,11 @@ const arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
4932
4963
  const arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
4933
4964
  const fractionRegex = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/;
4934
4965
  const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
4935
- 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$/;
4936
- const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/;
4966
+ // 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.
4967
+ 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$/;
4968
+ // Case-insensitive because CSS function names are, and includes Tailwind's `--alpha()` because it resolves to a color.
4969
+ const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark|contrast-color|device-cmyk|--alpha)\(.+\)$/i;
4970
+ const maskPositionRegex = /^(?:_*[+-]?(?:\d|\.\d)|[\w-]+\(|_*(?:inherit|initial|revert(?:-layer)?|unset)_*$)/i;
4937
4971
  // Shadow always begins with x and y offset separated by underscore optionally prepended by inset
4938
4972
  const shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
4939
4973
  const imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
@@ -4948,6 +4982,9 @@ const isLengthOnly = value =>
4948
4982
  // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
4949
4983
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
4950
4984
  lengthUnitRegex.test(value) && !colorFunctionRegex.test(value);
4985
+ const isMaskPosition = value =>
4986
+ // Mask stops default to positions for variables and non-color CSS functions, including angles, so color functions need to be excluded explicitly.
4987
+ maskPositionRegex.test(value) && !colorFunctionRegex.test(value);
4951
4988
  const isNever = () => false;
4952
4989
  const isShadow = value => shadowRegex.test(value);
4953
4990
  const isImage = value => imageRegex.test(value);
@@ -4956,6 +4993,7 @@ const isNamedContainerQuery = value => value.startsWith('@container') && (value[
4956
4993
  const isArbitrarySize = value => getIsArbitraryValue(value, isLabelSize, isNever);
4957
4994
  const isArbitraryValue = value => arbitraryValueRegex.test(value);
4958
4995
  const isArbitraryLength = value => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
4996
+ const isArbitraryMaskPosition = value => getIsArbitraryValue(value, isLabelMaskPosition, isMaskPosition);
4959
4997
  const isArbitraryNumber = value => getIsArbitraryValue(value, isLabelNumber, isNumber);
4960
4998
  const isArbitraryWeight = value => getIsArbitraryValue(value, isLabelWeight, isAny);
4961
4999
  const isArbitraryFamilyName = value => getIsArbitraryValue(value, isLabelFamilyName, isNever);
@@ -4964,6 +5002,7 @@ const isArbitraryImage = value => getIsArbitraryValue(value, isLabelImage, isIma
4964
5002
  const isArbitraryShadow = value => getIsArbitraryValue(value, isLabelShadow, isShadow);
4965
5003
  const isArbitraryVariable = value => arbitraryVariableRegex.test(value);
4966
5004
  const isArbitraryVariableLength = value => getIsArbitraryVariable(value, isLabelLength);
5005
+ const isArbitraryVariableMaskPosition = value => getIsArbitraryVariable(value, isLabelMaskPosition, true);
4967
5006
  const isArbitraryVariableFamilyName = value => getIsArbitraryVariable(value, isLabelFamilyName);
4968
5007
  const isArbitraryVariablePosition = value => getIsArbitraryVariable(value, isLabelPosition);
4969
5008
  const isArbitraryVariableSize = value => getIsArbitraryVariable(value, isLabelSize);
@@ -4996,6 +5035,7 @@ const isLabelPosition = label => label === 'position' || label === 'percentage';
4996
5035
  const isLabelImage = label => label === 'image' || label === 'url';
4997
5036
  const isLabelSize = label => label === 'length' || label === 'size' || label === 'bg-size';
4998
5037
  const isLabelLength = label => label === 'length';
5038
+ const isLabelMaskPosition = label => label !== 'color';
4999
5039
  const isLabelNumber = label => label === 'number';
5000
5040
  const isLabelFamilyName = label => label === 'family-name';
5001
5041
  const isLabelWeight = label => label === 'number' || label === 'weight';
@@ -5076,7 +5116,7 @@ const getDefaultConfig = () => {
5076
5116
  const scaleBorderWidth = () => ['', isNumber, isArbitraryVariableLength, isArbitraryLength];
5077
5117
  const scaleLineStyle = () => ['solid', 'dashed', 'dotted', 'double'];
5078
5118
  const scaleBlendMode = () => ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'];
5079
- const scaleMaskImagePosition = () => [isNumber, isPercent, isArbitraryVariablePosition, isArbitraryPosition];
5119
+ const scaleMaskImagePosition = () => [isNumber, isPercent, isArbitraryVariableMaskPosition, isArbitraryMaskPosition];
5080
5120
  const scaleBlur = () => [
5081
5121
  // Deprecated since Tailwind CSS v4.0.0
5082
5122
  '', 'none', themeBlur, isArbitraryVariable, isArbitraryValue];
@@ -5187,7 +5227,12 @@ const getDefaultConfig = () => {
5187
5227
  * Screen Reader Only
5188
5228
  * @see https://tailwindcss.com/docs/display#screen-reader-only
5189
5229
  */
5190
- sr: ['sr-only', 'not-sr-only'],
5230
+ sr: ['sr-only'],
5231
+ /**
5232
+ * Not Screen Reader Only
5233
+ * @see https://tailwindcss.com/docs/display#screen-reader-only
5234
+ */
5235
+ 'not-sr': ['not-sr-only'],
5191
5236
  /**
5192
5237
  * Floats
5193
5238
  * @see https://tailwindcss.com/docs/float
@@ -5398,7 +5443,7 @@ const getDefaultConfig = () => {
5398
5443
  * @see https://tailwindcss.com/docs/flex
5399
5444
  */
5400
5445
  flex: [{
5401
- flex: [isNumber, isFraction, 'auto', 'initial', 'none', isArbitraryValue]
5446
+ flex: [isNumber, isFraction, 'auto', 'initial', 'none', isArbitraryVariable, isArbitraryValue]
5402
5447
  }],
5403
5448
  /**
5404
5449
  * Flex Grow
@@ -5954,7 +5999,7 @@ const getDefaultConfig = () => {
5954
5999
  * @see https://tailwindcss.com/docs/line-clamp
5955
6000
  */
5956
6001
  'line-clamp': [{
5957
- 'line-clamp': [isNumber, 'none', isArbitraryVariable, isArbitraryNumber]
6002
+ 'line-clamp': [isNumber, 'none', isArbitraryVariable, isArbitraryValue]
5958
6003
  }],
5959
6004
  /**
5960
6005
  * Line Height
@@ -6024,7 +6069,7 @@ const getDefaultConfig = () => {
6024
6069
  * @see https://tailwindcss.com/docs/text-decoration-thickness
6025
6070
  */
6026
6071
  'text-decoration-thickness': [{
6027
- decoration: [isNumber, 'from-font', 'auto', isArbitraryVariable, isArbitraryLength]
6072
+ decoration: [isNumber, 'from-font', 'auto', isArbitraryVariableLength, isArbitraryVariablePosition, isArbitraryLength]
6028
6073
  }],
6029
6074
  /**
6030
6075
  * Text Decoration Color
@@ -6799,7 +6844,7 @@ const getDefaultConfig = () => {
6799
6844
  'mask-radial-to': scaleColor()
6800
6845
  }],
6801
6846
  'mask-image-radial-shape': [{
6802
- 'mask-radial': ['circle', 'ellipse']
6847
+ mask: ['circle', 'ellipse']
6803
6848
  }],
6804
6849
  'mask-image-radial-size': [{
6805
6850
  'mask-radial': [{
@@ -7647,6 +7692,9 @@ const getDefaultConfig = () => {
7647
7692
  'inset-y': ['inset-bs', 'inset-be', 'top', 'bottom'],
7648
7693
  flex: ['basis', 'grow', 'shrink'],
7649
7694
  gap: ['gap-x', 'gap-y'],
7695
+ 'place-content': ['align-content', 'justify-content'],
7696
+ 'place-items': ['align-items', 'justify-items'],
7697
+ 'place-self': ['align-self', 'justify-self'],
7650
7698
  p: ['px', 'py', 'ps', 'pe', 'pbs', 'pbe', 'pt', 'pr', 'pb', 'pl'],
7651
7699
  px: ['ps', 'pe', 'pr', 'pl'],
7652
7700
  py: ['pbs', 'pbe', 'pt', 'pb'],
@@ -7654,7 +7702,6 @@ const getDefaultConfig = () => {
7654
7702
  mx: ['ms', 'me', 'mr', 'ml'],
7655
7703
  my: ['mbs', 'mbe', 'mt', 'mb'],
7656
7704
  size: ['w', 'h'],
7657
- 'font-size': ['leading'],
7658
7705
  'fvn-normal': ['fvn-ordinal', 'fvn-slashed-zero', 'fvn-figure', 'fvn-spacing', 'fvn-fraction'],
7659
7706
  'fvn-ordinal': ['fvn-normal'],
7660
7707
  'fvn-slashed-zero': ['fvn-normal'],
@@ -7662,6 +7709,11 @@ const getDefaultConfig = () => {
7662
7709
  'fvn-spacing': ['fvn-normal'],
7663
7710
  'fvn-fraction': ['fvn-normal'],
7664
7711
  'line-clamp': ['display', 'overflow'],
7712
+ // 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.
7713
+ // 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.
7714
+ // `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.
7715
+ 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'],
7716
+ 'not-sr': ['sr'],
7665
7717
  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'],
7666
7718
  'rounded-s': ['rounded-ss', 'rounded-es'],
7667
7719
  'rounded-e': ['rounded-se', 'rounded-ee'],
@@ -7676,6 +7728,14 @@ const getDefaultConfig = () => {
7676
7728
  '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'],
7677
7729
  'border-color-x': ['border-color-s', 'border-color-e', 'border-color-r', 'border-color-l'],
7678
7730
  'border-color-y': ['border-color-bs', 'border-color-be', 'border-color-t', 'border-color-b'],
7731
+ 'mask-image-x-from-pos': ['mask-image-r-from-pos', 'mask-image-l-from-pos'],
7732
+ 'mask-image-x-to-pos': ['mask-image-r-to-pos', 'mask-image-l-to-pos'],
7733
+ 'mask-image-x-from-color': ['mask-image-r-from-color', 'mask-image-l-from-color'],
7734
+ 'mask-image-x-to-color': ['mask-image-r-to-color', 'mask-image-l-to-color'],
7735
+ 'mask-image-y-from-pos': ['mask-image-t-from-pos', 'mask-image-b-from-pos'],
7736
+ 'mask-image-y-to-pos': ['mask-image-t-to-pos', 'mask-image-b-to-pos'],
7737
+ 'mask-image-y-from-color': ['mask-image-t-from-color', 'mask-image-b-from-color'],
7738
+ 'mask-image-y-to-color': ['mask-image-t-to-color', 'mask-image-b-to-color'],
7679
7739
  translate: ['translate-x', 'translate-y', 'translate-none'],
7680
7740
  'translate-none': ['translate', 'translate-x', 'translate-y', 'translate-z'],
7681
7741
  'scroll-m': ['scroll-mx', 'scroll-my', 'scroll-ms', 'scroll-me', 'scroll-mbs', 'scroll-mbe', 'scroll-mt', 'scroll-mr', 'scroll-mb', 'scroll-ml'],
@@ -7690,6 +7750,7 @@ const getDefaultConfig = () => {
7690
7750
  'touch-pz': ['touch']
7691
7751
  },
7692
7752
  conflictingClassGroupModifiers: {
7753
+ // 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.
7693
7754
  'font-size': ['leading']
7694
7755
  },
7695
7756
  postfixLookupClassGroups: ['container-type'],