@mastorscdn/core 1.0.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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +475 -0
  3. package/dist/mastors-core.css +4566 -0
  4. package/dist/mastors-core.css.map +1 -0
  5. package/dist/mastors-core.min.css +1 -0
  6. package/package.json +82 -0
  7. package/scss/_index.scss +109 -0
  8. package/scss/abstracts/_index.scss +5 -0
  9. package/scss/abstracts/_placeholders.scss +90 -0
  10. package/scss/accessibility/_a11y.scss +97 -0
  11. package/scss/accessibility/_index.scss +12 -0
  12. package/scss/base/_index.scss +16 -0
  13. package/scss/base/_motion.scss +19 -0
  14. package/scss/base/_reset.scss +178 -0
  15. package/scss/config/_index.scss +5 -0
  16. package/scss/config/_settings.scss +29 -0
  17. package/scss/functions/_index.scss +7 -0
  18. package/scss/functions/_map-helpers.scss +30 -0
  19. package/scss/functions/_math.scss +35 -0
  20. package/scss/functions/_token-accessors.scss +85 -0
  21. package/scss/generators/_colors.scss +30 -0
  22. package/scss/generators/_display.scss +78 -0
  23. package/scss/generators/_index.scss +18 -0
  24. package/scss/generators/_opacity.scss +13 -0
  25. package/scss/generators/_radius.scss +33 -0
  26. package/scss/generators/_shadows.scss +13 -0
  27. package/scss/generators/_transitions.scss +13 -0
  28. package/scss/generators/_zindex.scss +13 -0
  29. package/scss/helpers/_container.scss +34 -0
  30. package/scss/helpers/_index.scss +6 -0
  31. package/scss/helpers/_states.scss +120 -0
  32. package/scss/mastors-core.scss +35 -0
  33. package/scss/mixins/_css-vars.scss +77 -0
  34. package/scss/mixins/_helpers.scss +208 -0
  35. package/scss/mixins/_index.scss +7 -0
  36. package/scss/mixins/_responsive.scss +112 -0
  37. package/scss/themes/_custom.scss +33 -0
  38. package/scss/themes/_dark.scss +53 -0
  39. package/scss/themes/_index.scss +7 -0
  40. package/scss/themes/_light.scss +49 -0
  41. package/scss/tokens/_borders.scss +26 -0
  42. package/scss/tokens/_breakpoints.scss +24 -0
  43. package/scss/tokens/_colors.scss +83 -0
  44. package/scss/tokens/_index.scss +13 -0
  45. package/scss/tokens/_motion.scss +46 -0
  46. package/scss/tokens/_opacity.scss +22 -0
  47. package/scss/tokens/_radius.scss +15 -0
  48. package/scss/tokens/_shadows.scss +27 -0
  49. package/scss/tokens/_zindex.scss +27 -0
  50. package/scss/utilities/_borders.scss +35 -0
  51. package/scss/utilities/_index.scss +14 -0
  52. package/scss/utilities/_sizing.scss +131 -0
  53. package/scss/utilities/_spacing.scss +68 -0
  54. package/scss/vendors/_index.scss +5 -0
  55. package/scss/vendors/_normalize.scss +69 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mastors CDN
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,475 @@
1
+ # Mastors-Core
2
+
3
+ **Enterprise-grade SCSS foundational architecture for the Mastors CDN ecosystem.**
4
+
5
+ [![npm](https://img.shields.io/npm/v/@mastors/core)](https://www.npmjs.com/package/@mastors/core)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
+ [![Dart Sass](https://img.shields.io/badge/Dart%20Sass-1.70%2B-CC6699)](https://sass-lang.com)
8
+
9
+ ---
10
+
11
+ ## What is Mastors-Core?
12
+
13
+ Mastors-Core is the **foundational layer** of the entire Mastors CDN ecosystem. It provides:
14
+
15
+ - **Design Token System** — Colors, shadows, radius, z-index, opacity, breakpoints, motion
16
+ - **CSS Variable Engine** — Auto-generated CSS custom properties from all tokens
17
+ - **Theme Engine** — Light/dark/custom themes with `[data-theme]` switching
18
+ - **Responsive Engine** — Modern mobile-first media query mixins
19
+ - **Utility Generators** — Scoped utility classes (colors, shadows, spacing, sizing, etc.)
20
+ - **Helper Mixins** — Glassmorphism, neumorphism, skeleton loading, focus rings, and more
21
+ - **Accessibility System** — Focus visible, visually hidden, skip links, reduced motion
22
+ - **Base Reset** — Modern CSS reset, normalize supplement, motion defaults
23
+
24
+ ---
25
+
26
+ ## Architecture
27
+
28
+ ```
29
+ mastors-core/
30
+ ├── scss/
31
+ │ ├── config/ # Feature flags, settings
32
+ │ ├── tokens/ # Design tokens (colors, shadows, radius…)
33
+ │ ├── functions/ # Token accessors, math helpers
34
+ │ ├── mixins/ # Responsive engine, helpers, CSS var engine
35
+ │ ├── themes/ # Light, dark, custom themes
36
+ │ ├── generators/ # Utility class generators
37
+ │ ├── utilities/ # Spacing, sizing, border utilities
38
+ │ ├── base/ # Reset, motion defaults
39
+ │ ├── helpers/ # Container, state helpers
40
+ │ ├── accessibility/ # A11y system
41
+ │ ├── abstracts/ # Placeholders / silent classes
42
+ │ ├── vendors/ # Normalize supplement
43
+ │ ├── _index.scss # @use entry (functions/mixins/tokens API)
44
+ │ └── mastors-core.scss # CSS compile entry
45
+ ├── dist/ # Compiled output
46
+ ├── docs/ # Documentation
47
+ ├── package.json
48
+ ├── vite.config.js
49
+ └── README.md
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ npm install @mastors/core
58
+ ```
59
+
60
+ Or with Yarn:
61
+
62
+ ```bash
63
+ yarn add @mastors/core
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Quick Start
69
+
70
+ ### Compile the full CSS bundle
71
+
72
+ ```bash
73
+ npm run sass:all
74
+ ```
75
+
76
+ ### Use in your SCSS
77
+
78
+ ```scss
79
+ // Import the full API (functions, mixins, tokens — no CSS output)
80
+ @use '@mastors/core' as mc;
81
+
82
+ .my-card {
83
+ background-color: mc.color('surface');
84
+ border-radius: mc.radius('lg');
85
+ box-shadow: mc.shadow('md');
86
+ color: mc.semantic('text-primary');
87
+
88
+ @include mc.up('md') {
89
+ padding: 2rem;
90
+ }
91
+ }
92
+ ```
93
+
94
+ ### Use with configuration overrides
95
+
96
+ ```scss
97
+ @use '@mastors/core' with (
98
+ $enable-dark-theme: true,
99
+ $enable-utilities: true,
100
+ $enable-accessibility: true,
101
+ $mastors-prefix: 'mc'
102
+ );
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Integration with Mastors Libraries
108
+
109
+ Mastors-Core is the dependency base for the full Mastors CDN:
110
+
111
+ | Library | Role | Depends on Core |
112
+ |-------------------|---------------------------------------|-----------------|
113
+ | Mastors-Flexer | Flexbox utility system | ✅ Yes |
114
+ | Mastors-Gridder | CSS Grid layout system | ✅ Yes |
115
+ | Mastors-Fluider | Fluid typography & responsive fonts | ✅ Yes |
116
+
117
+ In each library:
118
+
119
+ ```scss
120
+ // At the top of every Mastors library
121
+ @use '@mastors/core' as mc;
122
+
123
+ // Then use core tokens, functions, mixins freely
124
+ .mastors-flex-row {
125
+ @include mc.up('md') { flex-direction: row; }
126
+ }
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Token Functions
132
+
133
+ ```scss
134
+ @use '@mastors/core' as mc;
135
+
136
+ // Color token
137
+ color: mc.color('primary'); // #2563eb
138
+ color: mc.color('neutral-700'); // #374151
139
+
140
+ // Semantic color
141
+ color: mc.semantic('text-muted'); // #6b7280
142
+
143
+ // Shadow
144
+ box-shadow: mc.shadow('lg'); // full shadow value
145
+
146
+ // Border radius
147
+ border-radius: mc.radius('xl'); // 16px
148
+
149
+ // Z-index
150
+ z-index: mc.z('modal'); // 500
151
+
152
+ // Layer
153
+ z-index: mc.layer('dialog'); // 4
154
+
155
+ // Opacity
156
+ opacity: mc.opacity('50'); // 0.5
157
+
158
+ // Breakpoint value
159
+ $bp: mc.breakpoint('md'); // 768px
160
+
161
+ // Container max-width
162
+ max-width: mc.container('xl'); // 1140px
163
+
164
+ // Duration
165
+ transition-duration: mc.duration('normal'); // 200ms
166
+
167
+ // Easing
168
+ transition-timing-function: mc.easing('smooth');
169
+
170
+ // Transition shorthand
171
+ transition: mc.transition('colors');
172
+
173
+ // Math helpers
174
+ font-size: mc.rem(18); // 1.125rem
175
+ font-size: mc.em(14); // 0.875em
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Responsive Mixins
181
+
182
+ ```scss
183
+ @use '@mastors/core' as mc;
184
+
185
+ .element {
186
+ // min-width (mobile first)
187
+ @include mc.up('md') { ... } // ≥ 768px
188
+ @include mc.up('xl') { ... } // ≥ 1200px
189
+
190
+ // max-width
191
+ @include mc.down('lg') { ... } // < 992px
192
+
193
+ // range
194
+ @include mc.between('sm', 'xl') { ... } // 576px – 1199px
195
+
196
+ // single breakpoint only
197
+ @include mc.only('md') { ... } // 768px – 991px
198
+
199
+ // device/media queries
200
+ @include mc.hover { ... } // pointer device hover
201
+ @include mc.prefers-dark { ... } // OS dark mode
202
+ @include mc.prefers-reduced-motion { ... }
203
+ @include mc.print { ... }
204
+ @include mc.portrait { ... }
205
+ @include mc.landscape { ... }
206
+ }
207
+ ```
208
+
209
+ ---
210
+
211
+ ## Helper Mixins
212
+
213
+ ```scss
214
+ @use '@mastors/core' as mc;
215
+
216
+ // Centering
217
+ .centered {
218
+ @include mc.absolute-center;
219
+ }
220
+
221
+ // Text truncation
222
+ .title {
223
+ @include mc.truncate;
224
+ }
225
+
226
+ // Multi-line clamp
227
+ .excerpt {
228
+ @include mc.line-clamp(3);
229
+ }
230
+
231
+ // Glassmorphism card
232
+ .glass-card {
233
+ @include mc.glassmorphism(
234
+ $blur: 20px,
235
+ $bg: rgba(255, 255, 255, 0.15),
236
+ $border: rgba(255, 255, 255, 0.2)
237
+ );
238
+ }
239
+
240
+ // Neumorphism button
241
+ .neu-btn {
242
+ @include mc.neumorphism(#e0e5ec);
243
+ }
244
+
245
+ // Custom scrollbar
246
+ .sidebar {
247
+ @include mc.custom-scrollbar($width: 6px);
248
+ }
249
+
250
+ // Focus ring (custom)
251
+ .input {
252
+ @include mc.focus-ring(#2563eb, 2px, 3px);
253
+ }
254
+
255
+ // Skeleton loading
256
+ .placeholder {
257
+ @include mc.skeleton-loading;
258
+ }
259
+
260
+ // Hover lift
261
+ .card {
262
+ @include mc.hover-lift;
263
+ }
264
+
265
+ // Smooth transition
266
+ .button {
267
+ @include mc.smooth-transition(all, 300ms);
268
+ }
269
+
270
+ // Visually hidden
271
+ .label {
272
+ @include mc.visually-hidden;
273
+ }
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Theme System
279
+
280
+ ### Data attribute (recommended)
281
+
282
+ ```html
283
+ <html data-theme="dark">
284
+ <html data-theme="light">
285
+ <html data-theme="enterprise">
286
+ ```
287
+
288
+ ### CSS Variable overrides
289
+
290
+ ```css
291
+ :root {
292
+ --mastors-color-primary: #0f4c75;
293
+ --mastors-bg-body: #1b262c;
294
+ }
295
+ ```
296
+
297
+ ### Custom Theme (SCSS)
298
+
299
+ ```scss
300
+ @use '@mastors/core/themes/custom' with (
301
+ $theme-name: 'enterprise',
302
+ $custom-tokens: (
303
+ '--mastors-color-primary': #0f4c75,
304
+ '--mastors-color-secondary': #1b4332,
305
+ '--mastors-bg-body': #1b262c,
306
+ '--mastors-text-primary': #e2e8f0,
307
+ )
308
+ );
309
+ ```
310
+
311
+ ---
312
+
313
+ ## CSS Variable Reference
314
+
315
+ All tokens are available as CSS custom properties:
316
+
317
+ ```css
318
+ /* Colors */
319
+ --mastors-color-primary
320
+ --mastors-color-secondary
321
+ --mastors-color-success
322
+ --mastors-color-danger
323
+ --mastors-color-warning
324
+
325
+ /* Semantic */
326
+ --mastors-text-primary
327
+ --mastors-text-secondary
328
+ --mastors-text-muted
329
+ --mastors-bg-body
330
+ --mastors-bg-subtle
331
+ --mastors-border-default
332
+ --mastors-border-focus
333
+ --mastors-surface
334
+
335
+ /* Shadows */
336
+ --mastors-shadow-sm
337
+ --mastors-shadow-md
338
+ --mastors-shadow-lg
339
+ --mastors-shadow-xl
340
+
341
+ /* Radius */
342
+ --mastors-radius-sm
343
+ --mastors-radius-md
344
+ --mastors-radius-lg
345
+ --mastors-radius-xl
346
+ --mastors-radius-full
347
+
348
+ /* Z-index */
349
+ --mastors-z-dropdown
350
+ --mastors-z-modal
351
+ --mastors-z-tooltip
352
+ --mastors-z-toast
353
+
354
+ /* Motion */
355
+ --mastors-duration-fast
356
+ --mastors-duration-normal
357
+ --mastors-easing-ease-in-out
358
+ --mastors-easing-spring
359
+ ```
360
+
361
+ ---
362
+
363
+ ## Utility Classes
364
+
365
+ ### Colors & Backgrounds
366
+ ```html
367
+ <p class="text-primary">Primary text</p>
368
+ <div class="bg-neutral-100">Neutral background</div>
369
+ <div class="border-color-danger">Danger border</div>
370
+ ```
371
+
372
+ ### Shadows
373
+ ```html
374
+ <div class="shadow-md">Medium shadow</div>
375
+ <div class="shadow-primary">Brand shadow</div>
376
+ ```
377
+
378
+ ### Border Radius
379
+ ```html
380
+ <div class="rounded-lg">Large radius</div>
381
+ <div class="rounded-full">Pill shape</div>
382
+ <div class="rounded-t-xl">Top rounded only</div>
383
+ ```
384
+
385
+ ### Opacity
386
+ ```html
387
+ <div class="opacity-50">50% opacity</div>
388
+ <div class="opacity-0">Hidden</div>
389
+ ```
390
+
391
+ ### Transitions
392
+ ```html
393
+ <div class="transition-all">All transitions</div>
394
+ <div class="transition-colors">Color transitions</div>
395
+ ```
396
+
397
+ ### Positioning & Display
398
+ ```html
399
+ <div class="position-relative">Relative</div>
400
+ <div class="d-none">Hidden</div>
401
+ <div class="d-block">Block</div>
402
+ <div class="overflow-hidden">Overflow hidden</div>
403
+ ```
404
+
405
+ ### Spacing
406
+ ```html
407
+ <div class="p-4">1rem padding</div>
408
+ <div class="mt-8">2rem top margin</div>
409
+ <div class="px-6 py-3">Horizontal/vertical padding</div>
410
+ ```
411
+
412
+ ### Sizing
413
+ ```html
414
+ <div class="w-full h-screen">Full width, full height</div>
415
+ <div class="max-w-4xl">Max width 4xl</div>
416
+ ```
417
+
418
+ ### Cursor & Object
419
+ ```html
420
+ <button class="cursor-pointer">Clickable</button>
421
+ <img class="object-cover aspect-video">
422
+ ```
423
+
424
+ ---
425
+
426
+ ## Accessibility
427
+
428
+ ```html
429
+ <!-- Skip to content link -->
430
+ <a href="#main" class="mastors-skip-link">Skip to content</a>
431
+
432
+ <!-- Screen reader only -->
433
+ <span class="mastors-sr-only">Loading...</span>
434
+
435
+ <!-- Skeleton loading -->
436
+ <div class="mastors-skeleton w-full h-4 rounded-md"></div>
437
+
438
+ <!-- Animations -->
439
+ <div class="mastors-pulse">...</div>
440
+ <div class="mastors-spin">...</div>
441
+ ```
442
+
443
+ ---
444
+
445
+ ## Build Commands
446
+
447
+ | Command | Description |
448
+ |--------------------|--------------------------------------|
449
+ | `npm run sass:build` | Expanded CSS with source maps |
450
+ | `npm run sass:min` | Minified CSS, no source maps |
451
+ | `npm run sass:watch` | Watch mode for development |
452
+ | `npm run sass:all` | Both expanded + minified |
453
+ | `npm run build` | Full Vite build |
454
+ | `npm run build:all` | Sass + Vite build |
455
+ | `npm run clean` | Clear dist/ folder |
456
+
457
+ ---
458
+
459
+ ## Breakpoints
460
+
461
+ | Key | Value |
462
+ |-------|---------|
463
+ | `xs` | 0px |
464
+ | `sm` | 576px |
465
+ | `md` | 768px |
466
+ | `lg` | 992px |
467
+ | `xl` | 1200px |
468
+ | `2xl` | 1400px |
469
+ | `3xl` | 1600px |
470
+
471
+ ---
472
+
473
+ ## License
474
+
475
+ MIT © Mastors CDN