@fest-lib/veela 0.1.1

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 (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +533 -0
  3. package/dist/veela.js +878 -0
  4. package/package.json +83 -0
  5. package/src/scss/_layers.scss +16 -0
  6. package/src/scss/advanced/_index.scss +0 -0
  7. package/src/scss/advanced/animation/_motion.scss +317 -0
  8. package/src/scss/advanced/color/_color.scss +328 -0
  9. package/src/scss/advanced/color/_colorize.scss +325 -0
  10. package/src/scss/advanced/design/_design-tokens.scss +118 -0
  11. package/src/scss/advanced/design/_effects.scss +275 -0
  12. package/src/scss/advanced/design/_shadow.scss +359 -0
  13. package/src/scss/advanced/design/_surfaces.scss +76 -0
  14. package/src/scss/advanced/effects/_animations.scss +124 -0
  15. package/src/scss/advanced/effects/_shadows.scss +50 -0
  16. package/src/scss/advanced/font/_typography.scss +600 -0
  17. package/src/scss/advanced/index.scss +11 -0
  18. package/src/scss/advanced/index.ts +35 -0
  19. package/src/scss/advanced/layout/_content.scss +170 -0
  20. package/src/scss/advanced/layout/_index.scss +5 -0
  21. package/src/scss/advanced/layout/_normalize.scss +541 -0
  22. package/src/scss/advanced/layout/_shared-overlays.scss +162 -0
  23. package/src/scss/advanced/md3/_md3.scss +596 -0
  24. package/src/scss/advanced/md3/_utils.scss +114 -0
  25. package/src/scss/advanced/misc/_config.scss +119 -0
  26. package/src/scss/advanced/misc/_initials.scss +298 -0
  27. package/src/scss/advanced/misc/_mixins.scss +179 -0
  28. package/src/scss/advanced/misc/_queries.scss +34 -0
  29. package/src/scss/advanced/misc/_rendering.scss +82 -0
  30. package/src/scss/advanced/misc/_tokens.scss +74 -0
  31. package/src/scss/advanced/theme/_shared.scss +232 -0
  32. package/src/scss/advanced/theme/_states.scss +332 -0
  33. package/src/scss/advanced/theme/_variants.scss +354 -0
  34. package/src/scss/advanced/tokens/_material-color.scss +120 -0
  35. package/src/scss/advanced/tokens/_variables.scss +171 -0
  36. package/src/scss/basic/_layers.scss +0 -0
  37. package/src/scss/basic/design/_index.scss +3 -0
  38. package/src/scss/basic/design/_keyframes.scss +163 -0
  39. package/src/scss/basic/design/_shapes.scss +266 -0
  40. package/src/scss/basic/design/_wavy-runtime.scss +50 -0
  41. package/src/scss/basic/index.scss +19 -0
  42. package/src/scss/basic/index.ts +29 -0
  43. package/src/scss/basic/misc/_core-layout.scss +272 -0
  44. package/src/scss/basic/misc/_index.scss +18 -0
  45. package/src/scss/basic/misc/_layout.scss +1040 -0
  46. package/src/scss/basic/misc/_mixins.scss +179 -0
  47. package/src/scss/basic/misc/_motion.scss +28 -0
  48. package/src/scss/basic/misc/_normalize.scss +765 -0
  49. package/src/scss/basic/misc/_queries.scss +34 -0
  50. package/src/scss/basic/misc/_shared.scss +232 -0
  51. package/src/scss/basic/misc/_states.scss +135 -0
  52. package/src/scss/basic/misc/_tokens.scss +78 -0
  53. package/src/scss/basic/misc/_veela.scss +12 -0
  54. package/src/scss/core/index.scss +1 -0
  55. package/src/scss/core/interact/_draggable.scss +32 -0
  56. package/src/scss/core/interact/_position.scss +45 -0
  57. package/src/scss/core/interact/_ps-anchor.scss +28 -0
  58. package/src/scss/core/interact/_ps-centered.scss +28 -0
  59. package/src/scss/core/interact/_ps-cursor.scss +18 -0
  60. package/src/scss/core/interact/_ps-draggable.scss +25 -0
  61. package/src/scss/core/interact/_ps-mechanic.scss +0 -0
  62. package/src/scss/core/interact/_ps-properties.scss +54 -0
  63. package/src/scss/core/interact/_ps-resizable.scss +61 -0
  64. package/src/scss/core/interact/_resizable.scss +69 -0
  65. package/src/scss/core/interact/_viewport.scss +469 -0
  66. package/src/scss/core/misc/_color-properties.scss +64 -0
  67. package/src/scss/core/misc/_config.scss +110 -0
  68. package/src/scss/core/misc/_functions.scss +530 -0
  69. package/src/scss/core/misc/_icons.scss +109 -0
  70. package/src/scss/core/misc/_index.scss +6 -0
  71. package/src/scss/core/misc/_layout.scss +49 -0
  72. package/src/scss/core/misc/_mixins.scss +744 -0
  73. package/src/scss/core/misc/_properties.scss +245 -0
  74. package/src/scss/core/misc/_tokens.scss +947 -0
  75. package/src/scss/core/misc/_utilities.scss +941 -0
  76. package/src/scss/core/misc/_utils.scss +17 -0
  77. package/src/scss/index.scss +18 -0
  78. package/src/scss/index.ts +105 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Design Tokens - Centralized Constants
3
+ *
4
+ * Consolidates design-system-level constants used across buttons, forms,
5
+ * and other interactive elements.
6
+ *
7
+ * Contains:
8
+ * - State opacity values (hover, press, focus, disabled, drag)
9
+ * - Motion/timing defaults (duration, easing)
10
+ * - Shared styling constants
11
+ */
12
+
13
+ @use "sass:map";
14
+
15
+ // ============================================================================
16
+ // State Opacity Tokens
17
+ // ============================================================================
18
+ // Used across buttons, forms, inputs, and interactive elements
19
+
20
+ $state-opacity-hover: 0.08 !default;
21
+ $state-opacity-press: 0.12 !default;
22
+ $state-opacity-focus: 0.12 !default;
23
+ $state-opacity-disabled: 0.38 !default;
24
+ $state-opacity-drag: 0.16 !default;
25
+
26
+ $state-opacity-map: (
27
+ hover: $state-opacity-hover,
28
+ press: $state-opacity-press,
29
+ focus: $state-opacity-focus,
30
+ disabled: $state-opacity-disabled,
31
+ drag: $state-opacity-drag,
32
+ ) !default;
33
+
34
+ // ============================================================================
35
+ // Motion/Timing Tokens
36
+ // ============================================================================
37
+ // Used for transitions on interactive elements
38
+
39
+ $duration-fast: 140ms !default;
40
+ $duration-normal: 160ms !default;
41
+ $duration-slow: 200ms !default;
42
+
43
+ $motion-timing-map: (
44
+ fast: $duration-fast,
45
+ normal: $duration-normal,
46
+ slow: $duration-slow,
47
+ ) !default;
48
+
49
+ $ease-out: cubic-bezier(0, 0, 0.2, 1) !default;
50
+ $ease-in: cubic-bezier(0.4, 0, 1, 1) !default;
51
+ $ease-in-out: cubic-bezier(0.4, 0, 0.2, 1) !default;
52
+
53
+ // ============================================================================
54
+ // Button & Form Styling Tokens
55
+ // ============================================================================
56
+
57
+ $button-gap: var(--gap-sm) !default;
58
+ $button-padding-y: var(--padding-sm) !default;
59
+ $button-padding-x: var(--padding-lg) !default;
60
+ $button-radius: var(--radius-full) !default;
61
+ $button-min-height: fit-content !default;
62
+
63
+ $input-gap: var(--space-sm) !default;
64
+ $input-padding: var(--padding-sm) !default;
65
+ $input-padding-x: var(--padding-md) !default;
66
+
67
+ // ============================================================================
68
+ // Mixin: Export state opacity CSS variables
69
+ // ============================================================================
70
+
71
+ ///
72
+ /// Exports state opacity values as CSS custom properties.
73
+ /// Centralizes opacity values used across interactive elements.
74
+ ///
75
+ /// @param {map} $map - Opacity map (default: $state-opacity-map)
76
+ ///
77
+ @mixin export-state-opacity(
78
+ $map: $state-opacity-map
79
+ ) {
80
+ @each $state, $value in $map {
81
+ --state-opacity-#{$state}: #{$value};
82
+ }
83
+ }
84
+
85
+ // ============================================================================
86
+ // Mixin: Export motion timing CSS variables
87
+ // ============================================================================
88
+
89
+ ///
90
+ /// Exports motion timing values as CSS custom properties.
91
+ /// Centralizes duration and easing used for transitions.
92
+ ///
93
+ /// @param {map} $timing-map - Timing map (default: $motion-timing-map)
94
+ ///
95
+ @mixin export-motion-timing(
96
+ $timing-map: $motion-timing-map
97
+ ) {
98
+ @each $type, $duration in $timing-map {
99
+ --duration-#{$type}: #{$duration};
100
+ }
101
+
102
+ --ease-out: #{$ease-out};
103
+ --ease-in: #{$ease-in};
104
+ --ease-in-out: #{$ease-in-out};
105
+ }
106
+
107
+ // ============================================================================
108
+ // Mixin: Export all design tokens
109
+ // ============================================================================
110
+
111
+ ///
112
+ /// Convenience mixin to export all design tokens at once.
113
+ /// Useful for setting up root or component-level defaults.
114
+ ///
115
+ @mixin export-design-tokens() {
116
+ @include export-state-opacity();
117
+ @include export-motion-timing();
118
+ }
@@ -0,0 +1,275 @@
1
+ @use "sass:list";
2
+ @use "sass:map";
3
+ @use "sass:meta";
4
+
5
+ @use "./colorize" as colorize;
6
+ @use "./motion" as motion;
7
+ @use "./shadow" as shadow;
8
+ @use "./utils" as utils;
9
+
10
+ // =============================================================================
11
+ // VISUAL EFFECTS MIXINS (split from layout)
12
+ // =============================================================================
13
+
14
+ $effect-defaults: (
15
+ transition-duration: var(--duration-fast, #{motion.$ui-duration-fast}),
16
+ transition-timing: var(--ease-out, #{motion.$ui-ease-standard}),
17
+ lift: -2px,
18
+ scale: 1,
19
+ hover-shadow: var(--shadow-md, #{shadow.$shadow-md}),
20
+ glass-surface-opacity: var(--surface-opacity-muted, 0.06),
21
+ glass-border-opacity: var(--border-opacity-subtle, 0.14),
22
+ glass-blur: default,
23
+ shimmer-angle: 112deg,
24
+ shimmer-width: 28%,
25
+ shimmer-opacity: 0.32,
26
+ shimmer-duration: var(--duration-long, #{motion.$ui-duration-standard}),
27
+ shimmer-color: color-mix(in oklch, var(--color-primary, #ffffff) 36%, transparent),
28
+ shine-duration: var(--duration-normal, #{motion.$ui-duration-standard}),
29
+ shine-angle: 95deg,
30
+ shine-width: 22%,
31
+ shine-opacity: 0.28
32
+ );
33
+
34
+ $__effects-shimmer-keyframes-declared: false !default;
35
+ $shimmer-keyframes-name: veela-shimmer-glide;
36
+
37
+ @function _effect-token($token) {
38
+ @if map.has-key($effect-defaults, $token) {
39
+ @return map.get($effect-defaults, $token);
40
+ }
41
+
42
+ @error "Unknown visual effect token `#{$token}`.";
43
+ }
44
+
45
+ @mixin _ensure-shimmer-keyframes($name: $shimmer-keyframes-name) {
46
+ @if not $__effects-shimmer-keyframes-declared {
47
+ $__effects-shimmer-keyframes-declared: true !global;
48
+
49
+ @at-root {
50
+ @keyframes #{$name} {
51
+ 0% { transform: translate3d(-120%, 0, 0); }
52
+ 50% { transform: translate3d(0, 0, 0); }
53
+ 100% { transform: translate3d(120%, 0, 0); }
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+ @mixin effect-transition($properties: (transform, box-shadow), $duration: null, $timing: null) {
60
+ $prop-list: sass(if(sass(meta.type-of($properties) == "list"): $properties; else: ($properties,)));
61
+ $resolved-duration: sass(if(sass($duration == null): _effect-token(transition-duration); else: $duration));
62
+ $resolved-timing: sass(if(sass($timing == null): _effect-token(transition-timing); else: $timing));
63
+
64
+ @include motion.transition($prop-list, $resolved-duration, $resolved-timing);
65
+ }
66
+
67
+ @mixin interactive-effect(
68
+ $hover-transform: null,
69
+ $hover-shadow: null,
70
+ $rest-shadow: null,
71
+ $properties: (transform, box-shadow),
72
+ $duration: null,
73
+ $timing: null
74
+ ) {
75
+ $prop-list: sass(if(sass(meta.type-of($properties) == "list"): $properties; else: ($properties,)));
76
+
77
+ @include effect-transition($prop-list, $duration, $timing);
78
+
79
+ @if $rest-shadow != null {
80
+ box-shadow: $rest-shadow;
81
+ }
82
+
83
+ @include utils.when-hover {
84
+ @if $hover-transform != null {
85
+ transform: $hover-transform;
86
+ }
87
+
88
+ @if $hover-shadow != null {
89
+ box-shadow: $hover-shadow;
90
+ }
91
+ }
92
+
93
+ @include utils.when-active {
94
+ @if $hover-transform != null {
95
+ transform: $hover-transform;
96
+ }
97
+
98
+ @if $hover-shadow != null {
99
+ box-shadow: $hover-shadow;
100
+ }
101
+ }
102
+ }
103
+
104
+ @mixin glass-morphism(
105
+ $surface-opacity: null,
106
+ $border-opacity: null,
107
+ $blur: null
108
+ ) {
109
+ $surface-opacity: sass(if(sass($surface-opacity == null): _effect-token(glass-surface-opacity); else: $surface-opacity));
110
+ $border-opacity: sass(if(sass($border-opacity == null): _effect-token(glass-border-opacity); else: $border-opacity));
111
+ $blur-value: sass(if(sass($blur == null): _effect-token(glass-blur); else: $blur));
112
+
113
+ @include colorize.surface($surface-opacity);
114
+ @include colorize.border-color(var(--scrollbar-tint), $border-opacity);
115
+
116
+ @if meta.type-of($blur-value) == "string" {
117
+ @include colorize.backdrop-blur($blur-value);
118
+ } @else {
119
+ backdrop-filter: $blur-value;
120
+ }
121
+
122
+ background-color:
123
+ color-mix(
124
+ in oklch,
125
+ var(--surface-color, var(--md-sys-color-surface, #0f131a)) calc(#{$surface-opacity} * 100%),
126
+ transparent
127
+ );
128
+ }
129
+
130
+ @mixin gradient-text($gradient: var(--primary-gradient, linear-gradient(120deg, var(--color-primary, #6b8cff), var(--color-tertiary, #f86ed4)))) {
131
+ background-image: $gradient;
132
+ background-size: 200% 200%;
133
+ background-position: 0% 50%;
134
+ background-clip: text;
135
+ color: transparent;
136
+ -webkit-background-clip: text;
137
+ -webkit-text-fill-color: transparent;
138
+
139
+ @include effect-transition(background-position);
140
+
141
+ @include utils.when-hover {
142
+ background-position: 100% 50%;
143
+ }
144
+
145
+ @include utils.when-active {
146
+ background-position: 100% 50%;
147
+ }
148
+ }
149
+
150
+ @mixin hover-lift(
151
+ $lift: null,
152
+ $shadow: null,
153
+ $scale: null,
154
+ $rest-shadow: null,
155
+ $duration: null,
156
+ $timing: null
157
+ ) {
158
+ $resolved-lift: sass(if(sass($lift == null): _effect-token(lift); else: $lift));
159
+ $resolved-shadow: sass(if(sass($shadow == null): _effect-token(hover-shadow); else: $shadow));
160
+ $resolved-scale: sass(if(sass($scale == null): _effect-token(scale); else: $scale));
161
+
162
+ $hover-transform: translate3d(0, $resolved-lift, 0);
163
+
164
+ @if $resolved-scale != 1 {
165
+ $hover-transform: #{$hover-transform} scale(#{$resolved-scale});
166
+ }
167
+
168
+ @include interactive-effect(
169
+ $hover-transform: $hover-transform,
170
+ $hover-shadow: $resolved-shadow,
171
+ $rest-shadow: $rest-shadow,
172
+ $properties: (transform, box-shadow),
173
+ $duration: $duration,
174
+ $timing: $timing
175
+ );
176
+ }
177
+
178
+ @mixin shimmer-effect(
179
+ $duration: null,
180
+ $angle: null,
181
+ $width: null,
182
+ $opacity: null,
183
+ $color: null
184
+ ) {
185
+ $resolved-duration: sass(if(sass($duration == null): _effect-token(shimmer-duration); else: $duration));
186
+ $resolved-angle: sass(if(sass($angle == null): _effect-token(shimmer-angle); else: $angle));
187
+ $resolved-width: sass(if(sass($width == null): _effect-token(shimmer-width); else: $width));
188
+ $resolved-opacity: sass(if(sass($opacity == null): _effect-token(shimmer-opacity); else: $opacity));
189
+ $resolved-color: sass(if(sass($color == null): _effect-token(shimmer-color); else: $color));
190
+
191
+ position: relative;
192
+ overflow: hidden;
193
+ isolation: isolate;
194
+
195
+ @include effect-transition(filter);
196
+
197
+ @include _ensure-shimmer-keyframes();
198
+
199
+ &::after {
200
+ content: "";
201
+ position: absolute;
202
+ inset: -150%;
203
+ background: linear-gradient(
204
+ $resolved-angle,
205
+ transparent 0%,
206
+ color-mix(in oklch, #{$resolved-color} 0%, transparent) calc((100% - #{$resolved-width}) / 2),
207
+ #{$resolved-color} 50%,
208
+ color-mix(in oklch, #{$resolved-color} 0%, transparent) calc((100% + #{$resolved-width}) / 2),
209
+ transparent 100%
210
+ );
211
+ opacity: $resolved-opacity;
212
+ animation: #{$shimmer-keyframes-name} #{$resolved-duration} linear infinite;
213
+ pointer-events: none;
214
+ mix-blend-mode: screen;
215
+ }
216
+
217
+ @include motion.reduced-motion {
218
+ &::after {
219
+ animation-play-state: paused;
220
+ opacity: calc(#{$resolved-opacity} * 0.7);
221
+ }
222
+ }
223
+ }
224
+
225
+ @mixin button-shine(
226
+ $duration: null,
227
+ $angle: null,
228
+ $width: null,
229
+ $opacity: null,
230
+ $shadow: null
231
+ ) {
232
+ $resolved-duration: sass(if(sass($duration == null): _effect-token(shine-duration); else: $duration));
233
+ $resolved-angle: sass(if(sass($angle == null): _effect-token(shine-angle); else: $angle));
234
+ $resolved-width: sass(if(sass($width == null): _effect-token(shine-width); else: $width));
235
+ $resolved-opacity: sass(if(sass($opacity == null): _effect-token(shine-opacity); else: $opacity));
236
+ $resolved-shadow: sass(if(sass($shadow == null): _effect-token(hover-shadow); else: $shadow));
237
+
238
+ position: relative;
239
+ overflow: hidden;
240
+ isolation: isolate;
241
+
242
+ @include hover-lift(
243
+ $shadow: $resolved-shadow,
244
+ $rest-shadow: var(--shadow-sm, #{shadow.$shadow-sm})
245
+ );
246
+
247
+ &::before {
248
+ content: "";
249
+ position: absolute;
250
+ inset-block: -30%;
251
+ inset-inline: calc(-1 * #{$resolved-width});
252
+ background: linear-gradient(
253
+ $resolved-angle,
254
+ transparent 0%,
255
+ rgb(255 255 255 / 0) calc((100% - #{$resolved-width}) / 2),
256
+ rgb(255 255 255 / #{$resolved-opacity}) 50%,
257
+ rgb(255 255 255 / 0) calc((100% + #{$resolved-width}) / 2),
258
+ transparent 100%
259
+ );
260
+ transform: translate3d(-120%, 0, 0);
261
+ transition: transform #{$resolved-duration} var(--ease-in-out, #{motion.md3-easing(standard)});
262
+ pointer-events: none;
263
+ mix-blend-mode: soft-light;
264
+ }
265
+
266
+ @include utils.when-hover {
267
+ &::before { transform: translate3d(120%, 0, 0); }
268
+ }
269
+
270
+ @include motion.reduced-motion {
271
+ &::before {
272
+ transition-duration: calc(#{$resolved-duration} * 1.5);
273
+ }
274
+ }
275
+ }