aliascss 1.3.1 → 1.3.3

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.
@@ -0,0 +1,204 @@
1
+ export const customStaticClassNames = {
2
+ // ----------------------Border-Radius
3
+ 'x-lorem': `content:"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."`,
4
+ 'x-lorem-2': `content:"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"`,
5
+ 'x-lorem-3': `content:"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."`,
6
+ 'x-lorem-4': `content:"The quick brown fox jumps over the lazy dog"`,
7
+ "x-radius-none": 'border-radius:var(--x-radius-none,0px)',
8
+ "x-radius-xxs": 'border-radius:var(--x-radius-xxs,2px)',
9
+ "x-radius-xs": 'border-radius:var(--x-radius-xs,4px)',
10
+ "x-radius-sm": 'border-radius:var(--x-radius-sm,6px)',
11
+ "x-radius-md": 'border-radius:var(--x-radius-md,8px)',
12
+ "x-radius-lg": 'border-radius:var(--x-radius-lg,10px)',
13
+ "x-radius-xl": 'border-radius:var(--x-radius-xl,12px)',
14
+ "x-radius-2xl": 'border-radius:var(--x-radius-2xl,16px)',
15
+ "x-radius-3xl": 'border-radius:var(--x-radius-3xl,20px)',
16
+ "x-radius-4xl": 'border-radius:var(--x-radius-4xl,24px)',
17
+ "x-radius-full": 'border-radius:var(--x-radius-full,9999px)',
18
+ // -------- end
19
+ // --Padding/Spacing
20
+ "x-padding-none": 'padding:var(--x-padding-none,0px)',
21
+ "x-padding-xxs": 'padding:var(--x-padding-xxs,2px)',
22
+ "x-padding-xs": 'padding:var(--x-padding-xs,4px)',
23
+ "x-padding-sm": 'padding:var(--x-padding-sm,6px)',
24
+ "x-padding-md": 'padding:var(--x-padding-md,8px)',
25
+ "x-padding-lg": 'padding:var(--x-padding-lg,12px)',
26
+ "x-padding-xl": 'padding:var(--x-padding-xl,16px)',
27
+ "x-padding-2xl": 'padding:var(--x-padding-2xl,20px)',
28
+ "x-padding-3xl": 'padding:var(--x-padding-3xl,24px)',
29
+ "x-padding-4xl": 'padding:var(--x-padding-4xl,32px)',
30
+ "x-padding-5xl": 'padding:var(--x-padding-5xl,40px)',
31
+ "x-padding-6xl": 'padding:var(--x-padding-6xl,48px)',
32
+ "x-padding-7xl": 'padding:var(--x-padding-7xl,64px)',
33
+ "x-padding-8xl": 'padding:var(--x-padding-8xl,80px)',
34
+ "x-padding-9xl": 'padding:var(--x-padding-9xl,96px)',
35
+ "x-padding-10xl": 'padding:var(--x-padding-10xl,128px)',
36
+ "x-padding-11xl": 'padding:var(--x-padding-11xl,160px)',
37
+ "x-padding-mobile": 'padding:var(--x-padding-mobile,16px)',
38
+ "x-container-padding-mobile": 'padding:var(--x-container-padding-mobile,16px)',
39
+ "x-padding-desktop": 'padding:var(--x-padding-desktop,32px)',
40
+ "x-container-padding-desktop": 'padding:var(--x-container-padding-desktop,32px)',
41
+ "x-spacing-none": 'padding:var(--x-spacing-none,0px)',
42
+ "x-spacing-xxs": 'padding:var(--x-spacing-xxs,2px)',
43
+ "x-spacing-xs": 'padding:var(--x-spacing-xs,4px)',
44
+ "x-spacing-sm": 'padding:var(--x-spacing-sm,6px)',
45
+ "x-spacing-md": 'padding:var(--x-spacing-md,8px)',
46
+ "x-spacing-lg": 'padding:var(--x-spacing-lg,12px)',
47
+ "x-spacing-xl": 'padding:var(--x-spacing-xl,16px)',
48
+ "x-spacing-2xl": 'padding:var(--x-spacing-2xl,20px)',
49
+ "x-spacing-3xl": 'padding:var(--x-spacing-3xl,24px)',
50
+ "x-spacing-4xl": 'padding:var(--x-spacing-4xl,32px)',
51
+ "x-spacing-5xl": 'padding:var(--x-spacing-5xl,40px)',
52
+ "x-spacing-6xl": 'padding:var(--x-spacing-6xl,48px)',
53
+ "x-spacing-7xl": 'padding:var(--x-spacing-7xl,64px)',
54
+ "x-spacing-8xl": 'padding:var(--x-spacing-8xl,80px)',
55
+ "x-spacing-9xl": 'padding:var(--x-spacing-9xl,96px)',
56
+ "x-spacing-10xl": 'padding:var(--x-spacing-10xl,128px)',
57
+ "x-spacing-11xl": 'padding:var(--x-spacing-11xl,160px)',
58
+ // ---Width
59
+ "x-width-xxs": 'width:var(--x-width-xxs,320px)',
60
+ "x-width-xs": 'width:var(--x-width-xs,384px)',
61
+ "x-width-sm": 'width:var(--x-width-sm,480px)',
62
+ "x-width-md": 'width:var(--x-width-md,560px)',
63
+ "x-width-lg": 'width:var(--x-width-lg,640px)',
64
+ "x-width-xl": 'width:var(--x-width-xl,768px)',
65
+ "x-width-2xl": 'width:var(--x-width-2xl,1024px)',
66
+ "x-width-3xl": 'width:var(--x-width-3xl,1280px)',
67
+ "x-width-4xl": 'width:var(--x-width-4xl,1440px)',
68
+ "x-width-5xl": 'width:var(--x-width-5xl,1600px)',
69
+ "x-width-6xl": 'width:var(--x-width-6xl,1920px)',
70
+ "x-max-width-desktop": 'max-width:var(--x-max-width-desktop,1280px)',
71
+ "x-desktop-width-desktop": 'width:var(--x-desktop-width-desktop,1280px)',
72
+ "x-width-tablet": 'width:var(--x-width-tablet,768px)',
73
+ "x-max-width-tablet": 'max-width:var(--x-max-width-tablet,768px)',
74
+ "x-width-mobile": 'width:var(--x-width-mobile,375px)',
75
+ "x-max-width-mobile": 'max-width:var(--x-max-width-mobile,375px)',
76
+ "x-container-max-width-desktop": 'max-width:var(--x-container-max-width-desktop,1280px)',
77
+ "x-paragraph-max-width": 'max-width:var(--x-paragraph-max-width,720px)',
78
+ // ---old
79
+ 'x-flex-center': 'display:flex; justify-content:center;align-items:center',
80
+ 'x-inline-flex-center': 'display:inline-flex; justify-content:center;align-items:center',
81
+ 'x-grid-center': 'display:grid; justify-content:center;align-content:center',
82
+ 'x-inline-grid-center': 'display:inline-grid; justify-content:center;align-content:center',
83
+ 'x-absolute-center': "position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;",
84
+ 'x-fixed-center': "position:fixed;margin:auto;top:0;left:0;right:0;bottom:0;",
85
+ 'x-sr-only': 'position:absolute;overflow:hidden;clip-path:rect(0 0 0 0);height:1px;width:1px;margin:-1px;padding:0;border:0',
86
+ 'x-display-2xl': 'font-size:72px ; line-height:90px ; letter-spacing:-0.02em',
87
+ // 'x-display-xxl': 'font-size:72px ; line-height:90px ; letter-spacing:-0.02em',
88
+ 'x-display-xl': 'font-size: 60px; line-height: 72px; letter-spacing:-0.02em',
89
+ 'x-display-lg': 'font-size:48px ; line-height: 60px; letter-spacing:-0.02em',
90
+ 'x-display-md': 'font-size: 36px; line-height: 44px; letter-spacing:-0.02em',
91
+ 'x-display-sm': 'font-size: 30px; line-height: 38px',
92
+ 'x-display-xs': 'font-size: 24px; line-height: 32px',
93
+ 'x-heading-2xl': 'font-size:72px ; line-height:90px ; letter-spacing:-0.02em',
94
+ // 'x-heading-xxl': 'font-size:72px ; line-height:90px ; letter-spacing:-0.02em',
95
+ 'x-heading-xl': 'font-size: 60px; line-height: 72px; letter-spacing:-0.02em',
96
+ 'x-heading-lg': 'font-size:48px ; line-height: 60px; letter-spacing:-0.02em',
97
+ 'x-heading-md': 'font-size: 36px; line-height: 44px; letter-spacing:-0.02em',
98
+ 'x-heading-sm': 'font-size: 30px; line-height: 38px',
99
+ 'x-heading-xs': 'font-size: 24px; line-height: 32px',
100
+ 'x-h-2xl': 'font-size:72px ; line-height:90px ; letter-spacing:-0.02em',
101
+ 'x-h-xxl': 'font-size:72px ; line-height:90px ; letter-spacing:-0.02em',
102
+ 'x-h-xl': 'font-size: 60px; line-height: 72px; letter-spacing:-0.02em',
103
+ 'x-h-lg': 'font-size:48px ; line-height: 60px; letter-spacing:-0.02em',
104
+ 'x-h-md': 'font-size: 36px; line-height: 44px; letter-spacing:-0.02em',
105
+ 'x-h-sm': 'font-size: 30px; line-height: 38px',
106
+ 'x-h-xs': 'font-size: 24px; line-height: 32px',
107
+ 'x-text-xl': 'font-size:20px;line-height:30px',
108
+ 'x-text-lg': 'font-size:18px;line-height:28px',
109
+ 'x-text-md': 'font-size:16px;line-height:24px',
110
+ 'x-text-sm': 'font-size:14px;line-height:20px',
111
+ 'x-text-xs': 'font-size:12px;line-height:18px',
112
+ 'x-t-xl': 'font-size:20px;line-height:30px',
113
+ 'x-t-lg': 'font-size:18px;line-height:28px',
114
+ 'x-t-md': 'font-size:16px;line-height:24px',
115
+ 'x-t-sm': 'font-size:14px;line-height:20px',
116
+ 'x-t-xs': 'font-size:12px;line-height:18px',
117
+ // 'x-button-xxl':
118
+ // 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:16px 28px;border-radius:8px;box-sizing:border-box',
119
+ // 'x-button-2xl':
120
+ // 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:16px 28px;border-radius:8px;box-sizing:border-box',
121
+ // 'x-button-xl':
122
+ // 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:12px 20px;border-radius:8px;box-sizing:border-box',
123
+ // 'x-button-lg':
124
+ // 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:10px 18px;border-radius:8px;box-sizing:border-box',
125
+ // 'x-button-md':
126
+ // 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:10px 16px;border-radius:8px;box-sizing:border-box',
127
+ // 'x-button-sm':
128
+ // 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:8px 14px;border-radius:8px;box-sizing:border-box',
129
+ // 'x-button-xs':
130
+ // 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:8px 12px;border-radius:8px;box-sizing:border-box',
131
+ 'x-shadow-3xl': 'box-shadow:var(--x-shadow-3xl, 0px 32px 64px -12px rgba(16, 24, 40, 0.14))',
132
+ // 'x-shadow-xxxl': 'box-shadow:var(--x-shadow-xxxl, 0px 32px 64px -12px rgba(16, 24, 40, 0.14))',
133
+ 'x-shadow-2xl': 'box-shadow:var(--x-shadow-2xl, 0px 24px 48px -12px rgba(16, 24, 40, 0.18))',
134
+ // 'x-shadow-xxl': 'box-shadow:var(--x-shadow-xxl, 0px 24px 48px -12px rgba(16, 24, 40, 0.18))',
135
+ 'x-shadow-xl': 'box-shadow:var(--x-shadow-xl, 0px 20px 24px -4px rgba(16, 24, 40, 0.08), 0px 8px 8px -4px rgba(16, 24, 40, 0.03))',
136
+ 'x-shadow-lg': 'box-shadow:var(--x-shadow-lg, 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03))',
137
+ 'x-shadow-md': 'box-shadow:var(--x-shadow-md, 0px 4px 8px -2px rgba(16, 24, 40, 0.1), 0px 2px 4px -2px rgba(16, 24, 40, 0.06))',
138
+ 'x-shadow-sm': 'box-shadow:var(--x-shadow-sm, 0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 2px rgba(16, 24, 40, 0.06))',
139
+ 'x-shadow-xs': 'box-shadow:var(--x-shadow-xs, 0px 1px 2px rgba(16, 24, 40, 0.05))',
140
+ 'x-ring-brand': 'box-shadow:var(--x-ring-brand, 0px 0px 0px 4px rgba(158, 119, 237, 0.24))',
141
+ 'x-ring-gray': 'box-shadow:var(--x-ring-gray, 0px 0px 0px 4px rgba(152, 162, 179, 0.14))',
142
+ 'x-ring-gray-secondary': 'box-shadow:var(--x-ring-gray-secondary, 0px 0px 0px 4px rgba(152, 162, 179, 0.20))',
143
+ 'x-ring-error': 'box-shadow:var(--x-ring-error, 0px 0px 0px 4px rgba(240, 68, 56, 0.24))',
144
+ 'x-ring-brand-shadow-xs': 'box-shadow:var(--x-ring-brand-shadow-xs, 0px 1px 2px 0px rgba(16, 24, 40, 0.05), 0px 0px 0px 4px rgba(158, 119, 237, 0.24))',
145
+ 'x-ring-brand-shadow-sm': 'box-shadow:var(--x-ring-brand-shadow-sm, 0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06), 0px 0px 0px 4px rgba(158, 119, 237, 0.24))',
146
+ 'x-ring-brand-gray-xs': 'box-shadow:var(--x-ring-brand-gray-xs, 0px 1px 2px 0px rgba(16, 24, 40, 0.05), 0px 0px 0px 4px rgba(152, 162, 179, 0.14))',
147
+ 'x-ring-brand-gray-sm': 'box-shadow:var(--x-ring-brand-gray-sm, 0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06), 0px 0px 0px 4px rgba(152, 162, 179, 0.14))',
148
+ 'x-ring-brand-error-xs': 'box-shadow:var(--x-ring-brand-error-xs, 0px 1px 2px 0px rgba(16, 24, 40, 0.05), 0px 0px 0px 4px rgba(240, 68, 56, 0.24))',
149
+ // Blur
150
+ 'x-blur-sm': 'backdrop-filter: var(--x-blur-sm,blur(4px))',
151
+ 'x-blur-md': 'backdrop-filter: var(--x-blur-md,blur(8px))',
152
+ 'x-blur-lg': 'backdrop-filter: var(--x-blur-lg,blur(12px))',
153
+ 'x-blur-xl': 'backdrop-filter: var(--x-blur-xl,blur(20px))',
154
+ 'x-colorize-dark': 'background:#0f0f0f;color:#e3e3e3',
155
+ 'x-colorize-light': 'background:#e3e3e3;color:rgba(0,0,0,0.8)',
156
+ 'x-clip-menu': 'clip-path: polygon(0% 10%,100% 10%,100% 20%,0% 20%,0% 45%,100% 45%,100% 55%,0% 55%,0% 80%,100% 80%,100% 90%,0% 90%);',
157
+ 'x-clip-message': 'clip-path: polygon(0% 0%,100% 0%,100% 80%,60% 80%,50% 100%,40% 80%,0% 80%);',
158
+ 'x-clip-star': 'clip-path: polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);',
159
+ 'x-clip-close': 'clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%)',
160
+ 'x-clip-plus': 'clip-path: polygon(40% 0%,60% 0%,60% 40%,100% 40%,100% 60%,60% 60%,60% 100%,40% 100%,40% 60%,0% 60%,0% 40%,40% 40%);',
161
+ 'flex-center': 'display:flex;align-items:center;justify-content:center',
162
+ 'inline-flex-center': 'display:inline-flex;align-items:center;justify-content:center',
163
+ 'absolute-center': 'position:absolute;top:0;right:0;left:0;bottom:0:margin:auto',
164
+ 'sr-only': 'position:absolute;overflow:hidden;clip:rect(0 0 0 0);height:1px;width:1px;margin:-1px;padding:0;border:0',
165
+ 'hidden': 'display:none',
166
+ 'x-hidden': 'display:none',
167
+ 'uppercase': 'text-transform: uppercase',
168
+ 'x-uppercase': 'text-transform: uppercase',
169
+ 'lowercase': 'text-transform: lowercase',
170
+ 'x-lowercase': 'text-transform: lowercase',
171
+ 'capitalize': 'text-transform: capitalize',
172
+ 'x-capitalize': 'text-transform: capitalize',
173
+ 'w-full': 'width:100%',
174
+ 'x-w-full': 'width:100%',
175
+ 'width-full': 'width:100%',
176
+ 'x-width-full': 'width:100%',
177
+ 'w-screen': 'width:100vw',
178
+ 'x-w-screen': 'width:100vw',
179
+ 'width-screen': 'width:100vw',
180
+ 'x-width-screen': 'width:100vw',
181
+ 'w-screen-d': 'width:100dvw',
182
+ 'x-w-screen-d': 'width:100dvw',
183
+ 'width-screen-d': 'width:100dvw',
184
+ 'x-width-screen-d': 'width:100dvw',
185
+ 'h-screen': 'width:100vh',
186
+ 'x-h-screen': 'width:100vh',
187
+ 'height-screen': 'width:100vh',
188
+ 'x-height-screen': 'width:100vh',
189
+ 'h-screen-d': 'width:100dvh',
190
+ 'x-h-screen-d': 'width:100dvh',
191
+ 'height-screen-d': 'width:100dvh',
192
+ 'x-height-screen-d': 'width:100dvh',
193
+ 'fixed': 'position:fixed',
194
+ 'x-fixed': 'position:fixed',
195
+ 'absolute': 'position:absolute',
196
+ 'x-absolute': 'position:absolute',
197
+ 'relative': 'position:relative',
198
+ 'x-relative': 'position:relative',
199
+ 'x-jusitfy-between': 'justify-content: space-between',
200
+ 'x-flex': 'display:flex',
201
+ 'x-flex-between': 'display:flex;align-items:center;justify-content:space-between',
202
+ 'flex-between': 'display:flex;align-items:center;justify-content:space-between',
203
+ 'x-items-center': 'align-items: center'
204
+ };
@@ -19,12 +19,6 @@ const AliasCSS = {
19
19
  AliasCSS.classPrinter.run(el);
20
20
  }
21
21
  },
22
- // compileEle(el: any) {
23
- // if (typeof el === 'string') el = document.querySelector(el) || '';
24
- // if (el && el.toString().includes('HTML')) {
25
- // return AliasCSS.classPrinter.returnStatement(el);
26
- // }
27
- // },
28
22
  toString() {
29
23
  return 'AliasCSS Object';
30
24
  },
@@ -34,17 +28,6 @@ const AliasCSS = {
34
28
  extend(a, b, c) {
35
29
  this.statementMaker.prebuild(a, b, c);
36
30
  },
37
- // Live editor
38
- // liveEditor: openAcssRibbionBar,
39
- // close live editor in browser
40
- // closeEditor() {
41
- // const ele: any = document.getElementById('quickChangeBox');
42
- // if (ele) ele.parentNode.removeChild(ele);
43
- // },
44
- // // string can be passed with psedu and selector, group is optional
45
- // appendCSS(str: string, group: string) {
46
- // this.classPrinter.appendToStyleTag(this.statementMaker.fromString(str, group));
47
- // },
48
31
  addCustom(custom) {
49
32
  Object.keys(custom).forEach((key) => {
50
33
  this.statementMaker.addCustom(key, custom[key]);
@@ -57,7 +40,7 @@ if (!window.AliasCSS) {
57
40
  // @ts-ignore
58
41
  window.AliasCSS = AliasCSS;
59
42
  }
60
- window.addEventListener('load', () => {
43
+ window.addEventListener('DOMContentLoaded', () => {
61
44
  AliasCSS.classPrinter.run();
62
45
  console.log(' AliasCSS is running');
63
46
  });
@@ -1,11 +1,17 @@
1
1
  // custom.color will be provided {primary:'#2d3f3e....}
2
2
  export default function color(color, custom) {
3
+ // ----check for css variables
3
4
  if (color.match(/^--[a-zA-Z]/))
4
5
  return `var(${color})`;
6
+ // remove - before the color
5
7
  color = color.replace(/^[-]/, '');
8
+ // custom-color
6
9
  if (custom.hasOwnProperty('colors') && typeof custom.colors === 'object') {
7
10
  if (custom.colors.hasOwnProperty(color))
8
11
  return custom.colors[color];
12
+ // custom-color try replacing -
13
+ if (custom.colors.hasOwnProperty(color.replace(/-/g, '')))
14
+ return custom.colors[color.replace(/-/g, '')];
9
15
  }
10
16
  // hexadecimal =+ alpha 00-ff
11
17
  if (/^[0-9a-fA-F]{3,8}$/.test(color)) {
@@ -1,7 +1,14 @@
1
1
  export default function length(data) {
2
- return data.replace(/[-]?fit-content-([-]?\w+)/g, ' fit-content( $1 )')
3
- .replace(/[-]([-]?[0-9])/g, ' $1').replace(/([\d])d([\d])/g, '$1.$2').replace(/-auto/g, ' auto')
4
- .replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/-(f|m)/g, '$1');
2
+ if (data.match(/^-clamp\(/)) {
3
+ return data.replace(/^-/, '')
4
+ .replace(/([,+-/*])/g, '$1 ')
5
+ .replace(/([+-/*])/g, ' $1');
6
+ }
7
+ else {
8
+ return data.replace(/[-]?fit-content-([-]?\w+)/g, ' fit-content( $1 )')
9
+ .replace(/[-]([-]?[0-9])/g, ' $1').replace(/([\d])d([\d])/g, '$1.$2').replace(/-auto/g, ' auto')
10
+ .replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/-(f|m)/g, '$1');
11
+ }
5
12
  }
6
13
  export const lenByNumPer = (value) => value.replace(/[-]([-]?[\w])/g, ' $1').replace(/([\d])d([\d])/g, '$1.$2').replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/[\s]by[\s]/g, ' / ').replace(/auto flow/g, 'auto-flow');
7
14
  // const lenNumPer=(value:string)=>value.replace(/[-]([-]?[\w])/g,' $1').replace(/([\d])d([\d])/g,'$1.$2').replace(/([\d])p[\s]/g,"$1% ").replace(/([\d])p$/,"$1%").replace(/([a-z])([\d-])/g,'$1 $2');
@@ -4,9 +4,17 @@ export default function transition(data) {
4
4
  .replace(/^-/, '')
5
5
  .split(/__/)
6
6
  .forEach((e) => {
7
+ let cssVar = '';
8
+ if (e.match(/--/)) {
9
+ cssVar = '--' + e.split(/--/)[1];
10
+ e = e.replace(cssVar, '');
11
+ }
7
12
  const m = e.match(/^([a-z-]+)([0-9]+[d|/.]?[0-9]*[m]?[s])([\w-_]*)/);
8
- if (!m)
13
+ if (!m) {
14
+ if (cssVar)
15
+ return e + " var(" + cssVar + ")";
9
16
  return;
17
+ }
10
18
  const tf = m[3].replace(/^-/, '');
11
19
  if (tf && func[tf]) {
12
20
  holder += m[1].replace(/-$/, '') + ' ' + m[2].replace(/d/, '.') + ' ' + func[tf] + ',';
@@ -14,6 +22,8 @@ export default function transition(data) {
14
22
  else {
15
23
  holder += m[1].replace(/-$/, '') + ' ' + m[2].replace(/d/, '.') + ',';
16
24
  }
25
+ if (cssVar)
26
+ holder += ' var(' + cssVar + ')';
17
27
  });
18
28
  return holder.replace(/[,]$/, '');
19
29
  }
package/lib/config.js CHANGED
@@ -25,7 +25,13 @@ const config = {
25
25
  `${7 / 4}rem:7`,
26
26
  `${8 / 4}rem:8`,
27
27
  `${9 / 4}rem:9`,
28
- `${10 / 4}rem:10`],
28
+ `${10 / 4}rem:10`,
29
+ `${12 / 4}rem:12`,
30
+ `${16 / 4}rem:16`,
31
+ `${20 / 4}rem:20`,
32
+ `${24 / 4}rem:24`,
33
+ `${32 / 4}rem:32`,
34
+ ],
29
35
  remUnitsNegative: [`-${1 / 4}rem:-1`,
30
36
  `-${2 / 4}rem:-2`,
31
37
  `-${3 / 4}rem:-3`,
@@ -35,7 +41,13 @@ const config = {
35
41
  `-${7 / 4}rem:-7`,
36
42
  `-${8 / 4}rem:-8`,
37
43
  `-${9 / 4}rem:-9`,
38
- `-${10 / 4}rem:-10`],
44
+ `-${10 / 4}rem:-10`,
45
+ `-${12 / 4}rem:-12`,
46
+ `-${16 / 4}rem:-16`,
47
+ `-${20 / 4}rem:-20`,
48
+ `-${24 / 4}rem:-24`,
49
+ `-${32 / 4}rem:-32`,
50
+ ],
39
51
  modes: ['normal:nl', 'multiply:m', 'screen:s', 'overlay:o', 'darken:d', 'lighten:l', 'color-dodge:cd', 'color-burn:cb', 'hard-light:hl',
40
52
  'soft-light:sl', 'difference:di:d2', 'exclusion:e', 'hue:h', 'saturation:sa:s2', 'color:c', 'luminosity:lu:l2'],
41
53
  };
@@ -992,7 +992,7 @@ const cssProps = {
992
992
  alias: '',
993
993
  type: 'd',
994
994
  compiler: length,
995
- values: [''],
995
+ values: ['none:n'],
996
996
  },
997
997
  'flex-basis': {
998
998
  alias: 'fb',
@@ -0,0 +1,7 @@
1
+ export declare function createRegexForPseudo(prefix: {
2
+ [key: string]: string;
3
+ }): RegExp;
4
+ declare const prefix: {
5
+ [key: string]: string;
6
+ };
7
+ export default prefix;
@@ -0,0 +1,145 @@
1
+ export function createRegexForPseudo(prefix) {
2
+ const prefixAlias = Object.keys(prefix).reduce((previous, current) => previous + "|" + current);
3
+ return new RegExp("^(" + prefixAlias + ")(?=[-(|_])");
4
+ }
5
+ const prefix = {
6
+ '--active': ':active', // -a
7
+ '-a': ':active',
8
+ '-ac': ':active',
9
+ '--after-hover': '::after:hover',
10
+ '-afh': '::after:hover',
11
+ '--after': '::after', // -af
12
+ '-af': '::after', // -af
13
+ '--autofill': ':-webkit-autofill',
14
+ '-atf': ':-webkit-autofill',
15
+ '--any-link': ':any-link',
16
+ '-al': ':any-link',
17
+ '--backdrop': '::backdrop',
18
+ '-bd': '::backdrop',
19
+ '--blank': ':blank',
20
+ '-bl': ':blank',
21
+ '--before-hover': '::before:hover', // -bfh
22
+ '-bfh': '::before:hover', // -bfh
23
+ '--before': '::before', // -bf
24
+ '-bf': '::before', // -bf
25
+ '--checked': ':checked', // -ck
26
+ '-ch': ':checked', // -ck
27
+ '--current': ':current', // -ck
28
+ '-cur': ':current',
29
+ '--cue': '::cue',
30
+ '-cu': '::cue',
31
+ '--default': ':default', // -df
32
+ '-de': ':default', // -df
33
+ '--disabled': ':disabled', // -ds
34
+ '-di': ':disabled', // -ds
35
+ '--empty': ':empty', // -em
36
+ '-em': ':empty', // -em
37
+ '--enabled': ':enabled', // -en
38
+ '-en': ':enabled', // -en
39
+ '--file-selector-button': '::file-selector-button',
40
+ '-fsb': '::file-selector-button',
41
+ '--first-child': ':first-child', // -fc
42
+ '-fc': ':first-child',
43
+ '--first-letter': '::first-letter', // -f
44
+ '-fl': '::first-letter', // -fl
45
+ '--first-line': '::first-line', // -fln
46
+ '-fln': '::first-line', // -fln
47
+ '--first-of-type': ':first-of-type', // -fot
48
+ '-fot': ':first-of-type',
49
+ '--focus-within': ':focus-within', // -fo
50
+ '-fw': ':focus-within', // -fo
51
+ '--focus-visible': ':focus-visible', // -fo
52
+ '-fv': ':focus-visible', // -fo
53
+ '--focus': ':focus', // -fo
54
+ '-fo': ':focus', // -fo
55
+ '-f': ':focus', // -fo
56
+ '--fullscreen': ':fullscreen',
57
+ '-fs': ':fullscreen',
58
+ '--has': ':has', // --has
59
+ '-hs': ':has', // -hs
60
+ '--hover-after': ':hover::after', // -haf
61
+ '-haf': ':hover::after', // -haf
62
+ '--hover-before': ':hover::before', // -hbf
63
+ '-hbf': ':hover::before', // -hbf
64
+ '--hover-target': ':hover:target', // -htg
65
+ '-htg': ':hover:target', // -htg
66
+ '--hover': ':hover', // -h
67
+ '-h': ':hover', // -h
68
+ '-ho': ':hover', // -h
69
+ '--in-range': ':in-range', // -ir
70
+ '-ir': ':in-range', // -ir
71
+ '--indeterminate': ':indeterminate', // idt
72
+ '-ind': ':indeterminate', // idt
73
+ '--invalid': ':invalid', // -in
74
+ '-inv': ':invalid', // -in
75
+ '--is': ':is',
76
+ '-is': ':is',
77
+ '--lang': ':lang', // -ln
78
+ '-lan': ':lan', // -ln
79
+ '--last-child': ':last-child', // -lc
80
+ '-lc': ':last-child', // -lc
81
+ '--last-of-type': ':last-of-type', // -lot
82
+ '-lot': ':last-of-type', // -lot
83
+ '--link': ':link', // -l
84
+ '-ln': ':link', // -l
85
+ '-l': ':link', // -l
86
+ '--marker': '::marker',
87
+ '-m': '::marker',
88
+ '--not': ':not', // -n-
89
+ '-n': ':not', // -n-
90
+ '--nth-child': ':nth-child', // -nc2n
91
+ '-nc': ':nth-child', // -nc2n
92
+ '--nth-last-child': ':nth-last-child', // -nlc2n
93
+ '-nlc': ':nth-last-child', // -nlc2n
94
+ '--nth-last-of-type': ':nth-last-of-type', // -nlot2n
95
+ '-nlot': ':nth-last-of-type', // -nlot2n
96
+ '--nth-of-type': ':nth-of-type', // -not
97
+ '-not': ':nth-of-type', // -not
98
+ '--only-of-type': ':only-of-type', // -oot
99
+ '-oot': ':only-of-type', // -oot
100
+ '--only-child': ':only-child', // -oc
101
+ '-oc': ':only-child', // -oc
102
+ '--optional': ':optional', // -o
103
+ '-op': ':optional', // -o
104
+ '--out-of-range': ':out-of-range', // -oor
105
+ '-oor': ':out-of-range', // -oor
106
+ '--placeholder': '::placeholder', // -ph
107
+ '-ph': '::placeholder', // -ph
108
+ '--placeholder-shown': ':placeholder-shown', // -phs
109
+ '-phs': ':placeholder-shown', // -phs
110
+ '--popover-open': ':popover-open',
111
+ '-po': ':popover-open',
112
+ '--read-only': ':read-only', // -ro
113
+ '-ro': ':read-only', // -ro
114
+ '--read-write': ':read-write', // -rw
115
+ '-rw': ':read-write', // -rw
116
+ '--required': ':required', // -rq
117
+ '-rq': ':required', // -rq
118
+ '--root': ':root', // -rt
119
+ '-rt': ':root', // -rt
120
+ '--selection': '::selection', // -sl
121
+ '-s': '::selection', // -sl
122
+ '--spelling-error': '::spelling-error',
123
+ '-se': '::spelling-error',
124
+ '--scrollbar': '::-webkit-scrollbar',
125
+ '--webkit-scrollbar': '::-webkit-scrollbar',
126
+ '-sb': '::-webkit-scrollbar',
127
+ '--scrollbar-track': '::-webkit-scrollbar-track',
128
+ '--webkit-scrollbar-track': '::-webkit-scrollbar-track',
129
+ '-st': '::-webkit-scrollbar-track',
130
+ '--scrollbar-thumb': '::-webkit-scrollbar-thumb',
131
+ '--web-kit-scrollbar-thumb': '::-webkit-scrollbar-thumb',
132
+ '-stm': '::-webkit-scrollbar-thumb',
133
+ '--target': ':target', // -tg
134
+ '-tg': ':target', // -tg
135
+ '--user-invalid': ':user-invalid',
136
+ '-ui': ':user-invalid',
137
+ '--valid': ':valid', // -vl
138
+ '-va': ':valid', // -vl
139
+ '--visited': ':visited', // -vi
140
+ '-vi': ':visited', // -vi
141
+ '-v': ':visited', // -vi
142
+ '--where': ':where',
143
+ '-w': ':where'
144
+ };
145
+ export default prefix;
@@ -55,6 +55,8 @@ const prefix = {
55
55
  '--f': ':focus', // -fo
56
56
  '--fullscreen': ':fullscreen',
57
57
  '--fs': ':fullscreen',
58
+ '--grammar-error': '::grammar-error',
59
+ '--ge': '::grammar-error',
58
60
  '--has': ':has', // --has
59
61
  '--hs': ':has', // -hs
60
62
  '--hover-after': ':hover::after', // -haf
@@ -132,6 +134,8 @@ const prefix = {
132
134
  '--stm': '::-webkit-scrollbar-thumb',
133
135
  '--target': ':target', // -tg
134
136
  '--tg': ':target', // -tg
137
+ '--target-text': '::target-text', // -tg
138
+ '--tt': '::target-text', // -tg
135
139
  '--user-invalid': ':user-invalid',
136
140
  '--ui': ':user-invalid',
137
141
  '--valid': ':valid', // -vl
@@ -1,4 +1,4 @@
1
- import prefix, { createRegexForPseudo } from './PseudoPrefix.js';
1
+ import prefix, { createRegexForPseudo } from './PseudoPrefixNew.js';
2
2
  export default function PseudoEleState(data) {
3
3
  const match = createRegexForPseudo(prefix);
4
4
  if (!match.test(data))
@@ -22,6 +22,24 @@ bool = false) {
22
22
  if (cssPropertiesWithAlias.hasOwnProperty(possiblePropsName) && cssPropertiesWithAlias[possiblePropsName].hasOwnProperty('compiler') && typeof cssPropertiesWithAlias[possiblePropsName].compiler === 'function') {
23
23
  compiler = cssPropertiesWithAlias[possiblePropsName].compiler;
24
24
  }
25
+ // New Case :()
26
+ // check if has :()
27
+ if (/^\(.+\)[_]?$/.test(value)) {
28
+ if (value.match(/_$/)) {
29
+ const val = value.replace(/(--[\w-]+)/g, 'var($1)')
30
+ .replace(/^[(]/, '').replace(/_$/, '').replace(/[)]$/, '')
31
+ .replace(/,/g, ', ');
32
+ value = val;
33
+ }
34
+ else {
35
+ const val = value.replace(/(--[\w-]+)/g, 'var($1)')
36
+ .replace(/^[(]/, '').replace(/[)]$/, '')
37
+ .replace(/,/g, ' ');
38
+ value = val;
39
+ }
40
+ return bool ? [property, value] : property + ":" + value;
41
+ }
42
+ //
25
43
  // case 1: CSS Variable inside css variable
26
44
  if (/^calc/.test(value)) {
27
45
  return bool ? [property, value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2')] : property + ":" + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2');
@@ -108,13 +126,17 @@ bool = false) {
108
126
  }
109
127
  const valuePortion = className.replace(propertyKey, '');
110
128
  // New Update function value
111
- if (/^\(.*\)[_]?$/.test(valuePortion)) {
129
+ if (/^\(.+\)[_]?$/.test(valuePortion)) {
112
130
  if (valuePortion.match(/_$/)) {
113
- const val = valuePortion.replace(/[(_)]/g, '').replace(/,/g, ' ');
131
+ const val = valuePortion.replace(/(--[\w-]+)/g, 'var($1)')
132
+ .replace(/^[(]/, '').replace(/_$/, '').replace(/[)]$/, '')
133
+ .replace(/,/g, ', ');
114
134
  return bool ? [prop, val] : prop + ":" + val;
115
135
  }
116
136
  else {
117
- const val = valuePortion.replace(/[(_)]/g, '').replace(/,/g, ', ');
137
+ const val = valuePortion.replace(/(--[\w-]+)/g, 'var($1)')
138
+ .replace(/^[(]/, '').replace(/[)]$/, '')
139
+ .replace(/,/g, ' ');
118
140
  return bool ? [prop, val] : prop + ":" + val;
119
141
  }
120
142
  }
@@ -127,6 +149,23 @@ bool = false) {
127
149
  if (valuePortion.includes(':')) {
128
150
  let value = valuePortion.slice(valuePortion.indexOf(':')).replace(':', '');
129
151
  const cssVar = valuePortion.replace(value, '').replace(':', '');
152
+ // check if has :()
153
+ if (/^\(.+\)[_]?$/.test(value)) {
154
+ if (value.match(/_$/)) {
155
+ const val = value.replace(/(--[\w-]+)/g, 'var($1)')
156
+ .replace(/^[(]/, '').replace(/_$/, '').replace(/[)]$/, '')
157
+ .replace(/,/g, ', ');
158
+ value = val;
159
+ }
160
+ else {
161
+ const val = value.replace(/(--[\w-]+)/g, 'var($1)')
162
+ .replace(/^[(]/, '').replace(/[)]$/, '')
163
+ .replace(/,/g, ' ');
164
+ value = val;
165
+ }
166
+ return bool ? [prop, "var(" + cssVar + ',' + value + ')'] : prop + ": var(" + cssVar + ',' + value + ')';
167
+ }
168
+ //
130
169
  if (/^calc\(/.test(value)) {
131
170
  return bool ? [prop, "var(" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')'] : prop + ": var(" + cssVar + ',' + value.replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2') + ')';
132
171
  }
@@ -2,7 +2,6 @@ import getPropertyAndValue from "./returnPropertyAndValue.js";
2
2
  import { customStaticClassNames } from "./static/customStaticClassNames.js";
3
3
  import media, { createRegexForMedia } from "./prefix/responsive.js";
4
4
  import { customColors } from './static/customColors.js';
5
- import { customColors as customColors2 } from './static/customColors2.js';
6
5
  import { customColorsRadix } from './static/customColorsRadix.js';
7
6
  import extractPrefix from './prefix/extractPrefix.js';
8
7
  import extractMediaPrefix from './prefix/extractMediaPrefix.js';
@@ -18,7 +17,8 @@ const [staticClassNamesWithAlias, cssPropsWithAlias] = createCompilerObj(cssProp
18
17
  export const compiler = {
19
18
  // cache will cache propertyAndValue
20
19
  cache: { propertyAndValue: Object.assign({}, customStaticClassNames) },
21
- custom: Object.assign({ colors: Object.assign(Object.assign(Object.assign({}, customColors), customColors2), customColorsRadix) }),
20
+ // custom:{...{colors:{...customColors,...customColors2,...customColorsRadix}}},
21
+ custom: Object.assign({ colors: Object.assign(Object.assign({}, customColors), customColorsRadix) }),
22
22
  mediaSelector: Object.assign({}, media.target),
23
23
  mediaTest: null,
24
24
  staticClassNames: Object.assign(Object.assign({}, staticClassNamesAlias), staticClassNamesWithAlias),
@@ -262,6 +262,9 @@ export const compiler = {
262
262
  addMedia(obj) {
263
263
  this.mediaSelector = Object.assign(Object.assign({}, this.mediaSelector), obj);
264
264
  },
265
+ addPseudo(obj) {
266
+ // this.mediaSelector={...this.mediaSelector,...obj}
267
+ },
265
268
  // styleToAliascss(value:string,bool:boolean){
266
269
  // let classValue='';
267
270
  // let styleValue='';
@@ -0,0 +1 @@
1
+ export {};