@onereach/styles 27.0.2-beta.6094.0 → 27.0.2-beta.6096.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.
package/main-v3.css CHANGED
@@ -4,5 +4,6 @@
4
4
  @import "./font.css";
5
5
 
6
6
  @import "./base.layer.css";
7
+ @import "./legacy-utilities.layer.css";
7
8
 
8
9
  @config "./tailwind.config.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/styles",
3
- "version": "27.0.2-beta.6094.0",
3
+ "version": "27.0.2-beta.6096.0",
4
4
  "description": "Styles for or-ui-next",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -10,6 +10,7 @@
10
10
  "tailwind/**",
11
11
  "base.layer.css",
12
12
  "font.css",
13
+ "legacy-utilities.layer.css",
13
14
  "legacy-ui-warning.scss",
14
15
  "main-v3.css",
15
16
  "preflight-revert.css",
@@ -34,7 +35,7 @@
34
35
  "lint": "stylelint '**/*.scss'"
35
36
  },
36
37
  "dependencies": {
37
- "@onereach/font-icons": "^27.0.2-beta.6094.0",
38
+ "@onereach/font-icons": "^27.0.2-beta.6096.0",
38
39
  "tailwindcss": "4.3.2"
39
40
  },
40
41
  "devDependencies": {
@@ -0,0 +1,162 @@
1
+ const plugin = require('tailwindcss/plugin');
2
+
3
+ const screens = require('../../screens.json');
4
+
5
+ const spacingUtilities = {
6
+ p: ['padding'],
7
+ px: ['paddingInline'],
8
+ py: ['paddingBlock'],
9
+ pt: ['paddingTop'],
10
+ pr: ['paddingRight'],
11
+ pb: ['paddingBottom'],
12
+ pl: ['paddingLeft'],
13
+ ps: ['paddingInlineStart'],
14
+ pe: ['paddingInlineEnd'],
15
+ m: ['margin'],
16
+ mx: ['marginInline'],
17
+ my: ['marginBlock'],
18
+ mt: ['marginTop'],
19
+ mr: ['marginRight'],
20
+ mb: ['marginBottom'],
21
+ ml: ['marginLeft'],
22
+ ms: ['marginInlineStart'],
23
+ me: ['marginInlineEnd'],
24
+ gap: ['gap'],
25
+ w: ['width'],
26
+ h: ['height'],
27
+ 'min-w': ['minWidth'],
28
+ 'min-h': ['minHeight'],
29
+ 'max-w': ['maxWidth'],
30
+ 'max-h': ['maxHeight'],
31
+ };
32
+
33
+ const childrenUtilities = {
34
+ p: ['padding'],
35
+ px: ['paddingInline'],
36
+ py: ['paddingBlock'],
37
+ pt: ['paddingTop'],
38
+ pr: ['paddingRight'],
39
+ pb: ['paddingBottom'],
40
+ pl: ['paddingLeft'],
41
+ ps: ['paddingInlineStart'],
42
+ pe: ['paddingInlineEnd'],
43
+ m: ['margin'],
44
+ mx: ['marginInline'],
45
+ my: ['marginBlock'],
46
+ mt: ['marginTop'],
47
+ mr: ['marginRight'],
48
+ mb: ['marginBottom'],
49
+ ml: ['marginLeft'],
50
+ ms: ['marginInlineStart'],
51
+ me: ['marginInlineEnd'],
52
+ };
53
+
54
+ const firstLastChildrenUtilities = {
55
+ ms: ['marginInlineStart'],
56
+ me: ['marginInlineEnd'],
57
+ };
58
+
59
+ const escapeClassName = (className) => className
60
+ .replace(/!/g, '\\!')
61
+ .replace(/:/g, '\\:')
62
+ .replace(/\[/g, '\\[')
63
+ .replace(/\]/g, '\\]')
64
+ .replace(/\+/g, '\\+')
65
+ .replace(/\*/g, '\\*');
66
+
67
+ const toSelector = (className) => `.${escapeClassName(className)}`;
68
+
69
+ const toRule = (properties, value) => properties.reduce((rule, property) => {
70
+ rule[property] = value;
71
+ return rule;
72
+ }, {});
73
+
74
+ const important = (rule) => Object.fromEntries(
75
+ Object.entries(rule).map(([property, value]) => [property, `${value} !important`]),
76
+ );
77
+
78
+ const negate = (value) => `calc(${value} * -1)`;
79
+
80
+ const childSelector = (className) => `${toSelector(className)} > *`;
81
+
82
+ const addChildUtility = (utilities, className, rule) => {
83
+ utilities[childSelector(className)] = rule;
84
+ };
85
+
86
+ const addStateChildUtility = (utilities, state, className, rule) => {
87
+ utilities[`${toSelector(`${state}:children:${className}`)}:is([${state}]:not([${state}="false"])) > *`] = rule;
88
+ utilities[`${toSelector(`${state}:children:${className}`)}[force-state~="${state}"] > *`] = rule;
89
+ };
90
+
91
+ module.exports = {
92
+ plugin: plugin(({ addBase, theme }) => {
93
+ const spacing = theme('spacing');
94
+ const spacingEntries = Object.entries(spacing);
95
+
96
+ const utilities = {};
97
+
98
+ spacingEntries.forEach(([name, value]) => {
99
+ Object.entries(spacingUtilities).forEach(([utility, properties]) => {
100
+ utilities[toSelector(`${utility}-${name}`)] = toRule(properties, value);
101
+ utilities[toSelector(`!${utility}-${name}`)] = important(toRule(properties, value));
102
+ });
103
+
104
+ Object.entries(childrenUtilities).forEach(([utility, properties]) => {
105
+ addChildUtility(utilities, `children:${utility}-${name}`, toRule(properties, value));
106
+ addChildUtility(utilities, `children:!${utility}-${name}`, important(toRule(properties, value)));
107
+ addStateChildUtility(utilities, 'activated', `${utility}-${name}`, toRule(properties, value));
108
+ });
109
+
110
+ Object.entries(firstLastChildrenUtilities).forEach(([utility, properties]) => {
111
+ const firstImportantSelector = toSelector(`first:children:!${utility}-${name}`);
112
+ const lastImportantSelector = toSelector(`last:children:!${utility}-${name}`);
113
+
114
+ utilities[`${toSelector(`first:children:${utility}-${name}`)} > :first-child`] = toRule(properties, value);
115
+ utilities[`${toSelector(`last:children:${utility}-${name}`)} > :last-child`] = toRule(properties, value);
116
+ utilities[`${firstImportantSelector} > :first-child`] = important(toRule(properties, value));
117
+ utilities[`${lastImportantSelector} > :last-child`] = important(toRule(properties, value));
118
+ });
119
+
120
+ ['m', 'mx', 'my', 'mt', 'mr', 'mb', 'ml', 'ms', 'me'].forEach((utility) => {
121
+ utilities[toSelector(`-${utility}-${name}`)] = toRule(spacingUtilities[utility], negate(value));
122
+ utilities[toSelector(`!-${utility}-${name}`)] = important(toRule(spacingUtilities[utility], negate(value)));
123
+ });
124
+ });
125
+
126
+ addChildUtility(utilities, 'children:outline-none', { outlineStyle: 'none' });
127
+ addChildUtility(utilities, 'children:min-h-[46px]', { minHeight: '46px' });
128
+ addChildUtility(utilities, 'children:min-h-[34px]', { minHeight: '34px' });
129
+ addChildUtility(utilities, 'children:min-h-[30px]', { minHeight: '30px' });
130
+ addChildUtility(utilities, 'children:relative', { position: 'relative' });
131
+ addChildUtility(utilities, 'children:z-10', { zIndex: '10' });
132
+ addStateChildUtility(utilities, 'active', 'z-10', { zIndex: '10' });
133
+ addChildUtility(utilities, 'children:grow', { flexGrow: '1' });
134
+ addChildUtility(utilities, 'children:rounded-l-0', {
135
+ borderTopLeftRadius: '0',
136
+ borderBottomLeftRadius: '0',
137
+ });
138
+ addChildUtility(utilities, 'children:rounded-r-0', {
139
+ borderTopRightRadius: '0',
140
+ borderBottomRightRadius: '0',
141
+ });
142
+ addChildUtility(utilities, 'children:-ml-[1px]', { marginLeft: '-1px' });
143
+ utilities[toSelector('m-[10px]')] = { margin: '10px' };
144
+
145
+ const responsiveUtilities = {};
146
+
147
+ Object.entries(screens).forEach(([screen]) => {
148
+ Object.entries(utilities).forEach(([selector, rule]) => {
149
+ const responsiveSelector = `.${escapeClassName(`${screen}:`)}${selector.slice(1)}`;
150
+ responsiveUtilities[`${responsiveSelector}[force-screen~="${screen}"]`] = rule;
151
+ responsiveUtilities[`[force-screen~="${screen}"] ${responsiveSelector}`] = rule;
152
+ });
153
+ });
154
+
155
+ addBase({
156
+ '@layer utilities': {
157
+ ...utilities,
158
+ ...responsiveUtilities,
159
+ },
160
+ });
161
+ }),
162
+ };
@@ -13,6 +13,7 @@ const { plugin: core } = require('./tailwind/plugins/core');
13
13
  const { plugin: iconography } = require('./tailwind/plugins/iconography');
14
14
  const { plugin: interactivity } = require('./tailwind/plugins/interactivity');
15
15
  const { plugin: layout } = require('./tailwind/plugins/layout');
16
+ const { plugin: legacySpacing } = require('./tailwind/plugins/legacy-spacing');
16
17
  const { plugin: themeResponsive } = require('./tailwind/plugins/responsive');
17
18
  const { plugin: scrollbar } = require('./tailwind/plugins/scrollbar');
18
19
  const { plugin: themeBackground } = require('./tailwind/plugins/theme-background');
@@ -214,6 +215,7 @@ module.exports = {
214
215
  interactivity,
215
216
  typography,
216
217
  iconography,
218
+ legacySpacing,
217
219
 
218
220
  animationDelay,
219
221