@nopon-web/styles 0.0.51 → 0.1.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/_mixin.scss DELETED
@@ -1,193 +0,0 @@
1
- @use "sass:map";
2
-
3
- @use "_config" as *;
4
- @use "_variables" as var;
5
- @use "_function" as func;
6
-
7
- @forward "_config";
8
- @forward "_variables";
9
- @forward "_function";
10
-
11
- // BEM
12
- $B: null;
13
- $__bem-context: null;
14
-
15
- @mixin b($block) {
16
- $B: $namespace + $common-separator + $block !global;
17
-
18
- .#{$B} {
19
- $__bem-context: "block" !global;
20
- @content;
21
- $__bem-context: null !global;
22
- }
23
- }
24
-
25
- @mixin e($element) {
26
- @if $__bem-context != "block" {
27
- @error "e() can only be used inside b()";
28
- }
29
-
30
- @each $E in $element {
31
- .#{$B + $element-separator + $E} {
32
- $__bem-context: "element" !global;
33
- @content;
34
- $__bem-context: "block" !global;
35
- }
36
- }
37
- }
38
-
39
- @mixin m($modifier) {
40
- @if $__bem-context != "block" and $__bem-context != "element" {
41
- @error "m() can only be used inside b() or e()";
42
- }
43
-
44
- @each $M in $modifier {
45
- &#{$modifier-separator + $M} {
46
- @content;
47
- }
48
- }
49
- }
50
-
51
- @mixin t($names: null) {
52
- @if $__bem-context != "block" {
53
- @error "t() can only be used inside b()";
54
- }
55
-
56
- // 解析 themes 列表
57
- $themes: ();
58
- @if $names == null {
59
- @if $theme-name == null or $theme-name == "" {
60
- @error "$theme-name must be set globally or passed to @include t().";
61
- }
62
- $themes: ($theme-name);
63
- } @else {
64
- $themes: $names;
65
- }
66
-
67
- // 逐个生成 theme 选择器
68
- @each $theme in $themes {
69
- @if $theme == null or $theme == "" {
70
- @error "Invalid theme name in @include t().";
71
- }
72
-
73
- $T: $theme-prefix + $common-separator + $theme;
74
-
75
- &.#{$B + $modifier-separator + $T} {
76
- @content;
77
- }
78
- }
79
- }
80
-
81
- @mixin when($state) {
82
- $state-selector: $state-prefix + $common-separator + $state;
83
-
84
- @at-root {
85
- @if & {
86
- &.#{$state-selector} {
87
- @content;
88
- }
89
- } @else {
90
- .#{$state-selector} {
91
- @content;
92
- }
93
- }
94
- }
95
- }
96
-
97
- @mixin absolute-center($x: true, $y: true) {
98
- $x-value: 0;
99
- $y-value: 0;
100
-
101
- position: absolute;
102
-
103
- @if $x {
104
- left: 50%;
105
- $x-value: -50%;
106
- }
107
-
108
- @if $y {
109
- top: 50%;
110
- $y-value: -50%;
111
- }
112
-
113
- transform: translate(#{$x-value}, #{$y-value});
114
- }
115
-
116
- @mixin set-z-index($number) {
117
- z-index: calc(var(--z-index-base, var.$z-index-base) + $number);
118
- }
119
-
120
- // 背景
121
- @mixin bg($w, $h, $image) {
122
- width: $w;
123
- height: $h;
124
- background-size: 100% 100%;
125
- background-repeat: no-repeat;
126
- background-position: center;
127
- background-image: func.get-image($image);
128
- }
129
-
130
- @mixin bg-text($image) {
131
- background-clip: text;
132
- -webkit-background-clip: text;
133
- color: transparent;
134
- -webkit-text-fill-color: transparent;
135
- background-image: func.get-image($image);
136
- }
137
-
138
- @mixin frame-border($frame) {
139
- $image: map.get($frame, image);
140
- $inset: map.get($frame, inset);
141
- $slice: map.get($frame, slice);
142
- $fill: map.get($frame, fill);
143
- $repeat: map.get($frame, repeat, stretch);
144
-
145
- @if not $image or not $inset or not $slice {
146
- @error "frame-border: image / inset / slice are required";
147
- }
148
-
149
- @if $fill {
150
- border-image-slice: #{$slice} fill;
151
- } @else {
152
- border-image-slice: #{$slice};
153
- }
154
-
155
- box-sizing: border-box;
156
- border-style: solid;
157
- border-width: $inset;
158
- border-image-source: func.get-image($image);
159
- border-image-repeat: $repeat;
160
- }
161
-
162
- @mixin text-stroke($size, $color: #000, $blur: 0) {
163
- text-shadow:
164
- #{$size} #{$size} #{$blur} #{$color},
165
- -#{$size} #{$size} #{$blur} #{$color},
166
- #{$size} -#{$size} #{$blur} #{$color},
167
- -#{$size} -#{$size} #{$blur} #{$color};
168
- }
169
-
170
- @mixin text-shadow($size, $color: #000, $offset-x: func.u(2), $offset-y: #{u(2)}) {
171
- position: relative;
172
- z-index: 0;
173
- font-size: 0;
174
- line-height: 1;
175
- font-size: #{func.u(10)};
176
-
177
- > * {
178
- font-size: $size;
179
- }
180
-
181
- &::before {
182
- content: attr(data-text);
183
- position: absolute;
184
- top: 50%;
185
- left: 50%;
186
- z-index: -1;
187
- color: $color;
188
- font-size: $size;
189
- white-space: nowrap;
190
- // 偏移量
191
- transform: translate(calc(-50% + #{$offset-x}), calc(-50% + #{$offset-y}));
192
- }
193
- }
package/atomic.scss DELETED
@@ -1,60 +0,0 @@
1
- // flex
2
- .flex {
3
- display: flex;
4
- }
5
- .flex-1 {
6
- flex: 1 1 0%;
7
- }
8
- .flex-auto {
9
- flex: 1 1 auto;
10
- }
11
- .flex-initial {
12
- flex: 0 1 auto;
13
- }
14
- .flex-none {
15
- flex: none;
16
- }
17
- .justify-normal {
18
- justify-content: normal;
19
- }
20
- .justify-start {
21
- justify-content: flex-start;
22
- }
23
- .justify-end {
24
- justify-content: flex-end;
25
- }
26
- .justify-center {
27
- justify-content: center;
28
- }
29
- .justify-between {
30
- justify-content: space-between;
31
- }
32
- .justify-around {
33
- justify-content: space-around;
34
- }
35
- .justify-evenly {
36
- justify-content: space-evenly;
37
- }
38
- .justify-stretch {
39
- justify-content: stretch;
40
- }
41
- .items-start {
42
- align-items: flex-start;
43
- }
44
- .items-end {
45
- align-items: flex-end;
46
- }
47
- .items-center {
48
- align-items: center;
49
- }
50
- .items-baseline {
51
- align-items: baseline;
52
- }
53
- .items-stretch {
54
- align-items: stretch;
55
- }
56
- .text-overflow {
57
- white-space: nowrap;
58
- overflow: hidden;
59
- text-overflow: ellipsis;
60
- }