@onereach/styles 27.0.2-beta.6103.0 → 27.0.2-beta.6105.0

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.
@@ -1,5 +1,6 @@
1
1
  /* stylelint-disable scss/at-rule-no-unknown */
2
- @import "tailwindcss";
2
+ @import "tailwindcss/theme";
3
+ @import "tailwindcss/utilities";
3
4
  @import "./dist/index.css";
4
5
 
5
6
  @config "./tailwind.config.js";
@@ -0,0 +1,13 @@
1
+ const importantMarker = '--or-tailwind-v3-important';
2
+
3
+ function markImportant(declarations) {
4
+ return {
5
+ ...declarations,
6
+ [importantMarker]: '1',
7
+ };
8
+ }
9
+
10
+ module.exports = {
11
+ importantMarker,
12
+ markImportant,
13
+ };
@@ -0,0 +1,133 @@
1
+ const spacingUtilities = [
2
+ 'p',
3
+ 'px',
4
+ 'py',
5
+ 'pt',
6
+ 'pr',
7
+ 'pb',
8
+ 'pl',
9
+ 'ps',
10
+ 'pe',
11
+ 'm',
12
+ 'mx',
13
+ 'my',
14
+ 'mt',
15
+ 'mr',
16
+ 'mb',
17
+ 'ml',
18
+ 'ms',
19
+ 'me',
20
+ 'gap',
21
+ 'gap-x',
22
+ 'gap-y',
23
+ 'w',
24
+ 'h',
25
+ 'min-w',
26
+ 'min-h',
27
+ 'max-w',
28
+ 'max-h',
29
+ ];
30
+
31
+ const childrenUtilities = spacingUtilities.filter((utility) => (
32
+ /^(?:p[trblxyse]?|m[trblxyse]?)$/.test(utility)
33
+ ));
34
+ const firstLastChildrenUtilities = ['ms', 'me'];
35
+ const negativeUtilities = ['m', 'mx', 'my', 'mt', 'mr', 'mb', 'ml', 'ms', 'me'];
36
+ const stateVariants = ['dark', 'hover', 'mobile', 'desktop'];
37
+
38
+ function generateLegacyCompatibilityCss({ spacing, screens }) {
39
+ const candidates = new Set();
40
+
41
+ legacySpacingAliasEntries(spacing).forEach(([, alias]) => {
42
+ spacingUtilities.forEach((utility) => {
43
+ addCandidateVariants(candidates, `${utility}-${alias}`, screens);
44
+ });
45
+
46
+ negativeUtilities.forEach((utility) => {
47
+ addCandidateVariants(candidates, `-${utility}-${alias}`, screens);
48
+ });
49
+
50
+ childrenUtilities.forEach((utility) => {
51
+ addChildrenCandidateVariants(candidates, `${utility}-${alias}`, screens);
52
+ });
53
+
54
+ firstLastChildrenUtilities.forEach((utility) => {
55
+ addPositionalChildrenCandidateVariants(
56
+ candidates,
57
+ `${utility}-${alias}`,
58
+ screens,
59
+ );
60
+ });
61
+
62
+ });
63
+
64
+ return `@source inline("${[...candidates].join(' ')}");`;
65
+ }
66
+
67
+ function withLegacySpacingAliases(spacing) {
68
+ return Object.fromEntries([
69
+ ...Object.entries(spacing),
70
+ ...legacySpacingAliasEntries(spacing)
71
+ .map(([legacyName, alias]) => [alias, spacing[legacyName]]),
72
+ ]);
73
+ }
74
+
75
+ function legacySpacingAliasEntries(spacing) {
76
+ return Object.keys(spacing)
77
+ .filter((name) => /[+*]/.test(name))
78
+ .map((name) => [name, legacySpacingAlias(name)]);
79
+ }
80
+
81
+ function legacySpacingAlias(name) {
82
+ const encodedName = name
83
+ .replaceAll('+', '-b')
84
+ .replaceAll('*', '-a');
85
+
86
+ return `or-tw4-legacy-${encodedName}`;
87
+ }
88
+
89
+ function addCandidateVariants(candidates, className, screens) {
90
+ addImportantCandidates(candidates, className);
91
+ stateVariants.forEach((variant) => {
92
+ addImportantCandidates(candidates, `${variant}:${className}`);
93
+ });
94
+ Object.keys(screens).forEach((screen) => {
95
+ addImportantCandidates(candidates, `${screen}:${className}`);
96
+ });
97
+ }
98
+
99
+ function addChildrenCandidateVariants(candidates, className, screens) {
100
+ addImportantCandidates(candidates, `children:${className}`);
101
+ addImportantCandidates(candidates, `activated:children:${className}`);
102
+ Object.keys(screens).forEach((screen) => {
103
+ addImportantCandidates(candidates, `${screen}:children:${className}`);
104
+ });
105
+ }
106
+
107
+ function addPositionalChildrenCandidateVariants(candidates, className, screens) {
108
+ ['first', 'last'].forEach((position) => {
109
+ addImportantCandidates(candidates, `${position}:children:${className}`);
110
+ Object.keys(screens).forEach((screen) => {
111
+ addImportantCandidates(
112
+ candidates,
113
+ `${screen}:${position}:children:${className}`,
114
+ );
115
+ });
116
+ });
117
+ }
118
+
119
+ function addImportantCandidates(candidates, className) {
120
+ const segments = className.split(':');
121
+ const utility = segments.pop();
122
+ const variants = segments.length > 0 ? `${segments.join(':')}:` : '';
123
+
124
+ candidates.add(className);
125
+ candidates.add(`${variants}!${utility}`);
126
+ candidates.add(`${className}!`);
127
+ }
128
+
129
+ module.exports = {
130
+ generateLegacyCompatibilityCss,
131
+ legacySpacingAliasEntries,
132
+ withLegacySpacingAliases,
133
+ };
@@ -1,5 +1,6 @@
1
1
  const plugin = require('tailwindcss/plugin');
2
2
 
3
+ const { markImportant } = require('../compatibility/important');
3
4
  const { resolveThemeValue } = require('../utils');
4
5
 
5
6
  const { variants } = require('./core');
@@ -203,9 +204,9 @@ module.exports = {
203
204
  return {
204
205
  backgroundColor: resolveThemeValue(theme, `backgroundColor.${token}` + suffix, token),
205
206
 
206
- [variants['disabled']]: ['white', 'black', 'transparent'].includes(token) ? null : {
207
- backgroundColor: `${resolveThemeValue(theme, 'backgroundColor.disabled' + suffix)} !important`,
208
- },
207
+ [variants['disabled']]: ['white', 'black', 'transparent'].includes(token) ? null : markImportant({
208
+ backgroundColor: resolveThemeValue(theme, 'backgroundColor.disabled' + suffix),
209
+ }),
209
210
 
210
211
  transitionProperty: 'color, background-color, border-color, outline-color',
211
212
  transitionDuration: theme('transitionDuration.short'),
@@ -1,5 +1,6 @@
1
1
  const plugin = require('tailwindcss/plugin');
2
2
 
3
+ const { markImportant } = require('../compatibility/important');
3
4
  const { resolveThemeValue } = require('../utils');
4
5
 
5
6
  const { variants } = require('./core');
@@ -54,9 +55,9 @@ module.exports = {
54
55
  borderStyle: 'solid',
55
56
  borderColor: resolveThemeValue(theme, `borderColor.${token}` + suffix, token),
56
57
 
57
- [variants['disabled']]: ['transparent'].includes(token) ? null : {
58
- borderColor: `${resolveThemeValue(theme, 'borderColor.disabled' + suffix)} !important`,
59
- },
58
+ [variants['disabled']]: ['transparent'].includes(token) ? null : markImportant({
59
+ borderColor: resolveThemeValue(theme, 'borderColor.disabled' + suffix),
60
+ }),
60
61
 
61
62
  transitionProperty: 'color, background-color, border-color, outline-color',
62
63
  transitionDuration: theme('transitionDuration.short'),
@@ -1,5 +1,6 @@
1
1
  const plugin = require('tailwindcss/plugin');
2
2
 
3
+ const { markImportant } = require('../compatibility/important');
3
4
  const { resolveThemeValue } = require('../utils');
4
5
 
5
6
  const { variants } = require('./core');
@@ -52,9 +53,9 @@ module.exports = {
52
53
 
53
54
  return {
54
55
  [variants['children']]: {
55
- '&:not(:first-child)': {
56
- borderInlineStartStyle: 'none !important',
57
- },
56
+ '&:not(:first-child)': markImportant({
57
+ borderInlineStartStyle: 'none',
58
+ }),
58
59
 
59
60
  '&:not(:last-child)': {
60
61
  borderInlineEndStyle: 'solid',
@@ -69,9 +70,9 @@ module.exports = {
69
70
 
70
71
  [variants['disabled']]: ['transparent'].includes(token) ? null : {
71
72
  [variants['children']]: {
72
- '&:not(:last-child)': {
73
- borderInlineEndColor: `${resolveThemeValue(theme, 'borderColor.disabled' + suffix)} !important`,
74
- },
73
+ '&:not(:last-child)': markImportant({
74
+ borderInlineEndColor: resolveThemeValue(theme, 'borderColor.disabled' + suffix),
75
+ }),
75
76
  },
76
77
  },
77
78
  };
@@ -1,5 +1,6 @@
1
1
  const plugin = require('tailwindcss/plugin');
2
2
 
3
+ const { markImportant } = require('../compatibility/important');
3
4
  const { resolveThemeValue } = require('../utils');
4
5
 
5
6
  const { variants } = require('./core');
@@ -200,9 +201,9 @@ module.exports = {
200
201
  return {
201
202
  color: resolveThemeValue(theme, `textColor.${token}` + suffix, token),
202
203
 
203
- [variants['disabled']]: ['white', 'black', 'transparent'].includes(token) ? null : {
204
- color: `${resolveThemeValue(theme, 'textColor.on-disabled' + suffix)} !important`,
205
- },
204
+ [variants['disabled']]: ['white', 'black', 'transparent'].includes(token) ? null : markImportant({
205
+ color: resolveThemeValue(theme, 'textColor.on-disabled' + suffix),
206
+ }),
206
207
 
207
208
  transitionProperty: 'color, background-color, border-color, outline-color',
208
209
  transitionDuration: theme('transitionDuration.short'),
@@ -1,5 +1,6 @@
1
1
  const plugin = require('tailwindcss/plugin');
2
2
 
3
+ const { markImportant } = require('../compatibility/important');
3
4
  const { resolveThemeValue } = require('../utils');
4
5
 
5
6
  const { variants } = require('./core');
@@ -45,9 +46,9 @@ module.exports = {
45
46
  outlineStyle: 'solid',
46
47
  outlineColor: resolveThemeValue(theme, `outlineColor.${token}` + suffix, token),
47
48
 
48
- [variants['disabled']]: ['transparent'].includes(token) ? null : {
49
- outlineColor: `${resolveThemeValue(theme, 'outlineColor.transparent' + suffix)} !important`,
50
- },
49
+ [variants['disabled']]: ['transparent'].includes(token) ? null : markImportant({
50
+ outlineColor: resolveThemeValue(theme, 'outlineColor.transparent' + suffix),
51
+ }),
51
52
 
52
53
  transitionProperty: 'color, background-color, border-color, outline-color',
53
54
  transitionDuration: theme('transitionDuration.short'),
@@ -1,5 +1,6 @@
1
1
  const plugin = require('tailwindcss/plugin');
2
2
 
3
+ const { markImportant } = require('../compatibility/important');
3
4
  const { resolveThemeValue } = require('../utils');
4
5
 
5
6
  const { variants } = require('./core');
@@ -58,10 +59,10 @@ module.exports = {
58
59
  },
59
60
  },
60
61
 
61
- [variants['disabled']]: {
62
- color: `${resolveThemeValue(theme, 'textColor.on-disabled' + suffix)} !important`,
63
- backgroundColor: `${resolveThemeValue(theme, 'backgroundColor.disabled' + suffix)} !important`,
64
- },
62
+ [variants['disabled']]: markImportant({
63
+ color: resolveThemeValue(theme, 'textColor.on-disabled' + suffix),
64
+ backgroundColor: resolveThemeValue(theme, 'backgroundColor.disabled' + suffix),
65
+ }),
65
66
 
66
67
  transitionProperty: 'color, background-color, border-color, outline-color',
67
68
  transitionDuration: theme('transitionDuration.short'),
@@ -98,10 +99,10 @@ module.exports = {
98
99
  },
99
100
  },
100
101
 
101
- [variants['disabled']]: {
102
- color: `${resolveThemeValue(theme, 'textColor.on-disabled' + suffix)} !important`,
103
- backgroundColor: `${resolveThemeValue(theme, 'backgroundColor.disabled' + suffix)} !important`,
104
- },
102
+ [variants['disabled']]: markImportant({
103
+ color: resolveThemeValue(theme, 'textColor.on-disabled' + suffix),
104
+ backgroundColor: resolveThemeValue(theme, 'backgroundColor.disabled' + suffix),
105
+ }),
105
106
 
106
107
  transitionProperty: 'color, background-color, border-color, outline-color',
107
108
  transitionDuration: theme('transitionDuration.short'),
@@ -138,10 +139,10 @@ module.exports = {
138
139
  },
139
140
  },
140
141
 
141
- [variants['disabled']]: {
142
- color: `${resolveThemeValue(theme, 'textColor.on-disabled' + suffix)} !important`,
143
- backgroundColor: 'transparent !important',
144
- },
142
+ [variants['disabled']]: markImportant({
143
+ color: resolveThemeValue(theme, 'textColor.on-disabled' + suffix),
144
+ backgroundColor: 'transparent',
145
+ }),
145
146
 
146
147
  transitionProperty: 'color, background-color, border-color, outline-color',
147
148
  transitionDuration: theme('transitionDuration.short'),
@@ -178,10 +179,10 @@ module.exports = {
178
179
  },
179
180
  },
180
181
 
181
- [variants['disabled']]: {
182
- color: `${resolveThemeValue(theme, 'textColor.on-disabled' + suffix)} !important`,
183
- backgroundColor: 'transparent !important',
184
- },
182
+ [variants['disabled']]: markImportant({
183
+ color: resolveThemeValue(theme, 'textColor.on-disabled' + suffix),
184
+ backgroundColor: 'transparent',
185
+ }),
185
186
 
186
187
  transitionProperty: 'color, background-color, border-color, outline-color',
187
188
  transitionDuration: theme('transitionDuration.short'),
@@ -8,7 +8,5 @@ module.exports = {
8
8
  './node_modules/@onereach/auth-ui-module/dist/auto/**/*.{vue,js,mjs,ts,jsx,tsx}',
9
9
  './node_modules/@onereach/ui-components/dist/esm/**/*.{vue,js,mjs,ts,jsx,tsx}',
10
10
  ],
11
- presets: [
12
- require('@onereach/styles/tailwind.config.preset.js'),
13
- ],
11
+ presets: [require('./tailwind.config.preset.v4.js')],
14
12
  };