@zhang_jifan/fanui 2.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.
Files changed (127) hide show
  1. package/ACCESSIBILITY.md +61 -0
  2. package/CHANGELOG.md +112 -0
  3. package/COMMERCIAL-LICENSE.md +71 -0
  4. package/DESIGN-SYSTEM.md +294 -0
  5. package/LICENSE +661 -0
  6. package/README.md +348 -0
  7. package/USAGE.md +1926 -0
  8. package/_index.scss +20 -0
  9. package/dist/fanui.cjs +15 -0
  10. package/dist/fanui.css +28209 -0
  11. package/dist/fanui.d.ts +353 -0
  12. package/dist/fanui.esm.js +71 -0
  13. package/dist/fanui.js +4782 -0
  14. package/dist/fanui.min.css +1 -0
  15. package/dist/fanui.mjs +71 -0
  16. package/dist/modules/fanui-advanced.css +830 -0
  17. package/dist/modules/fanui-advanced.min.css +129 -0
  18. package/dist/modules/fanui-alert.css +575 -0
  19. package/dist/modules/fanui-alert.min.css +122 -0
  20. package/dist/modules/fanui-badge.css +426 -0
  21. package/dist/modules/fanui-badge.min.css +77 -0
  22. package/dist/modules/fanui-base.css +1394 -0
  23. package/dist/modules/fanui-base.min.css +236 -0
  24. package/dist/modules/fanui-blog.css +762 -0
  25. package/dist/modules/fanui-blog.min.css +108 -0
  26. package/dist/modules/fanui-button.css +526 -0
  27. package/dist/modules/fanui-button.min.css +56 -0
  28. package/dist/modules/fanui-card.css +291 -0
  29. package/dist/modules/fanui-card.min.css +52 -0
  30. package/dist/modules/fanui-choice.css +539 -0
  31. package/dist/modules/fanui-choice.min.css +83 -0
  32. package/dist/modules/fanui-dashboard.css +1057 -0
  33. package/dist/modules/fanui-dashboard.min.css +160 -0
  34. package/dist/modules/fanui-data.css +687 -0
  35. package/dist/modules/fanui-data.min.css +125 -0
  36. package/dist/modules/fanui-feedback.css +432 -0
  37. package/dist/modules/fanui-feedback.min.css +79 -0
  38. package/dist/modules/fanui-form.css +779 -0
  39. package/dist/modules/fanui-form.min.css +123 -0
  40. package/dist/modules/fanui-glass.css +497 -0
  41. package/dist/modules/fanui-glass.min.css +46 -0
  42. package/dist/modules/fanui-input-plus.css +799 -0
  43. package/dist/modules/fanui-input-plus.min.css +124 -0
  44. package/dist/modules/fanui-interactive.css +960 -0
  45. package/dist/modules/fanui-interactive.min.css +138 -0
  46. package/dist/modules/fanui-layout.css +4399 -0
  47. package/dist/modules/fanui-layout.min.css +1172 -0
  48. package/dist/modules/fanui-marketing.css +1125 -0
  49. package/dist/modules/fanui-marketing.min.css +144 -0
  50. package/dist/modules/fanui-nav.css +458 -0
  51. package/dist/modules/fanui-nav.min.css +76 -0
  52. package/dist/modules/fanui-overlay.css +547 -0
  53. package/dist/modules/fanui-overlay.min.css +91 -0
  54. package/dist/modules/fanui-table.css +290 -0
  55. package/dist/modules/fanui-table.min.css +62 -0
  56. package/dist/modules/fanui-tabs.css +333 -0
  57. package/dist/modules/fanui-tabs.min.css +58 -0
  58. package/dist/modules/fanui-themes.css +2728 -0
  59. package/dist/modules/fanui-themes.min.css +40 -0
  60. package/dist/modules/fanui-tokens.css +587 -0
  61. package/dist/modules/fanui-tokens.min.css +3 -0
  62. package/dist/modules/fanui-utilities.css +6557 -0
  63. package/dist/modules/fanui-utilities.min.css +1762 -0
  64. package/dist/modules/sizes.json +103 -0
  65. package/docs/MIGRATION-v2.md +179 -0
  66. package/examples/01-script-tag.html +149 -0
  67. package/examples/02-react/README.md +39 -0
  68. package/examples/02-react/index.html +12 -0
  69. package/examples/02-react/package.json +20 -0
  70. package/examples/02-react/src/App.jsx +108 -0
  71. package/examples/02-react/src/main.jsx +13 -0
  72. package/examples/02-react/src/useFanUI.js +87 -0
  73. package/examples/02-react/vite.config.js +6 -0
  74. package/examples/03-vue3/README.md +67 -0
  75. package/examples/03-vue3/index.html +12 -0
  76. package/examples/03-vue3/package.json +19 -0
  77. package/examples/03-vue3/src/App.vue +93 -0
  78. package/examples/03-vue3/src/main.js +8 -0
  79. package/examples/03-vue3/src/useFanUI.js +85 -0
  80. package/examples/03-vue3/vite.config.js +6 -0
  81. package/examples/04-vue2-cdn.html +93 -0
  82. package/examples/README.md +34 -0
  83. package/package.json +127 -0
  84. package/src/_functions.scss +319 -0
  85. package/src/_mixins.scss +1202 -0
  86. package/src/_tokens.scss +180 -0
  87. package/src/_variables.scss +491 -0
  88. package/src/base/_animations.scss +210 -0
  89. package/src/base/_reset.scss +359 -0
  90. package/src/base/_rtl.scss +133 -0
  91. package/src/base/_typography.scss +353 -0
  92. package/src/components/_advanced.scss +763 -0
  93. package/src/components/_alert.scss +322 -0
  94. package/src/components/_badge.scss +279 -0
  95. package/src/components/_blog.scss +693 -0
  96. package/src/components/_button.scss +351 -0
  97. package/src/components/_capabilities.scss +463 -0
  98. package/src/components/_card.scss +281 -0
  99. package/src/components/_choice.scss +444 -0
  100. package/src/components/_dashboard.scss +950 -0
  101. package/src/components/_data.scss +618 -0
  102. package/src/components/_feedback.scss +403 -0
  103. package/src/components/_form.scss +408 -0
  104. package/src/components/_glass.scss +374 -0
  105. package/src/components/_input-plus.scss +730 -0
  106. package/src/components/_interactive.scss +885 -0
  107. package/src/components/_marketing.scss +982 -0
  108. package/src/components/_nav.scss +480 -0
  109. package/src/components/_overlay.scss +517 -0
  110. package/src/components/_table.scss +276 -0
  111. package/src/components/_tabs.scss +338 -0
  112. package/src/fanui.d.ts +353 -0
  113. package/src/fanui.js +4782 -0
  114. package/src/fanui.scss +79 -0
  115. package/src/glass/_switches.scss +36 -0
  116. package/src/glass/_tokens.scss +259 -0
  117. package/src/layout/_container.scss +111 -0
  118. package/src/layout/_flex.scss +164 -0
  119. package/src/layout/_grid.scss +180 -0
  120. package/src/themes/_accents.scss +201 -0
  121. package/src/themes/_palettes.scss +180 -0
  122. package/src/utilities/_borders.scss +104 -0
  123. package/src/utilities/_display.scss +145 -0
  124. package/src/utilities/_effects.scss +210 -0
  125. package/src/utilities/_sizing.scss +123 -0
  126. package/src/utilities/_spacing.scss +118 -0
  127. package/src/utilities/_texture.scss +323 -0
@@ -0,0 +1,353 @@
1
+ // =============================================================================
2
+ // fanUI · 字体排版 (Typography)
3
+ // -----------------------------------------------------------------------------
4
+ // 提供:层级标题、正文、辅助文本、列表、引用、代码、链接色、
5
+ // 以及字号 / 行高 / 字重 / 对齐 / 截断 等排版工具类。
6
+ // =============================================================================
7
+
8
+ @use "sass:map";
9
+ @use "../functions" as fn;
10
+ @use "../variables" as v;
11
+ @use "../mixins" as mx;
12
+
13
+ // -----------------------------------------------------------------------------
14
+ // 1. 字体族
15
+ // -----------------------------------------------------------------------------
16
+
17
+ .fanui-font-sans { font-family: fn.fanui-var("font-sans"); }
18
+ .fanui-font-serif { font-family: fn.fanui-var("font-serif"); }
19
+ .fanui-font-mono { font-family: fn.fanui-var("font-mono"); }
20
+
21
+ // -----------------------------------------------------------------------------
22
+ // 2. 标题层级
23
+ // -----------------------------------------------------------------------------
24
+
25
+ %fanui-heading {
26
+ margin-top: 0;
27
+ margin-bottom: fn.fanui-var("heading-margin-bottom", v.$fanui-heading-margin-bottom);
28
+ font-weight: v.$fanui-heading-font-weight;
29
+ line-height: v.$fanui-heading-line-height;
30
+ color: fn.fanui-var("color-text-strong");
31
+ text-wrap: balance;
32
+ }
33
+
34
+ h1, h2, h3, h4, h5, h6,
35
+ .fanui-h1, .fanui-h2, .fanui-h3, .fanui-h4, .fanui-h5, .fanui-h6 {
36
+ @extend %fanui-heading;
37
+ }
38
+
39
+ h1, .fanui-h1 { font-size: fn.fanui-var("font-size-3xl"); letter-spacing: -0.02em; }
40
+ h2, .fanui-h2 { font-size: fn.fanui-var("font-size-2xl"); letter-spacing: -0.015em; }
41
+ h3, .fanui-h3 { font-size: fn.fanui-var("font-size-xl"); }
42
+ h4, .fanui-h4 { font-size: fn.fanui-var("font-size-lg"); }
43
+ h5, .fanui-h5 { font-size: fn.fanui-var("font-size-md"); }
44
+ h6, .fanui-h6 { font-size: fn.fanui-var("font-size-base"); }
45
+
46
+ // 超大展示标题
47
+ .fanui-display-1 { font-size: fn.fanui-var("font-size-6xl"); font-weight: 800; line-height: 1.1; letter-spacing: -0.025em; }
48
+ .fanui-display-2 { font-size: fn.fanui-var("font-size-5xl"); font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
49
+ .fanui-display-3 { font-size: fn.fanui-var("font-size-4xl"); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
50
+
51
+ // -----------------------------------------------------------------------------
52
+ // 3. 正文与辅助文本
53
+ // -----------------------------------------------------------------------------
54
+
55
+ p {
56
+ margin-top: 0;
57
+ margin-bottom: fn.fanui-var("paragraph-margin-bottom", v.$fanui-paragraph-margin-bottom);
58
+ }
59
+
60
+ .fanui-lead {
61
+ font-size: fn.fanui-var("font-size-md");
62
+ line-height: fn.fanui-var("line-height-relaxed");
63
+ color: fn.fanui-var("color-text-muted");
64
+ }
65
+
66
+ .fanui-text-muted { color: fn.fanui-var("color-text-muted"); }
67
+ .fanui-text-subtle { color: fn.fanui-var("color-text-subtle"); }
68
+ .fanui-text-strong { color: fn.fanui-var("color-text-strong"); font-weight: 600; }
69
+ .fanui-text-inverse { color: fn.fanui-var("color-text-inverse"); }
70
+
71
+ // 语义文本色
72
+ @each $name, $color in v.$fanui-theme-colors {
73
+ .fanui-text-#{$name} { color: fn.fanui-var("#{$name}"); }
74
+ }
75
+
76
+ .fanui-text-gradient {
77
+ @include mx.fanui-text-gradient(fn.fanui-var("primary"), fn.fanui-var("accent"));
78
+ }
79
+
80
+ // -----------------------------------------------------------------------------
81
+ // 4. 字号 / 行高 / 字重 / 字距 工具类
82
+ // -----------------------------------------------------------------------------
83
+
84
+ @each $name, $size in v.$fanui-font-sizes {
85
+ .fanui-fs-#{$name} { font-size: fn.fanui-var("font-size-#{$name}"); }
86
+ }
87
+
88
+ // 首字母特大
89
+ .fanui-fs-lead-lg::first-letter {
90
+ font-size: fn.fanui-var("font-size-5xl");
91
+ font-weight: 700;
92
+ float: left;
93
+ line-height: 1;
94
+ margin-inline-end: 8px;
95
+ }
96
+
97
+ @each $name, $value in v.$fanui-line-heights {
98
+ .fanui-lh-#{$name} { line-height: $value; }
99
+ }
100
+
101
+ @each $name, $value in v.$fanui-font-weights {
102
+ .fanui-fw-#{$name} { font-weight: $value; }
103
+ }
104
+
105
+ @each $name, $value in v.$fanui-letter-spacings {
106
+ .fanui-tracking-#{$name} { letter-spacing: $value; }
107
+ }
108
+
109
+ .fanui-italic { font-style: italic; }
110
+ .fanui-not-italic { font-style: normal; }
111
+ .fanui-uppercase { text-transform: uppercase; }
112
+ .fanui-lowercase { text-transform: lowercase; }
113
+ .fanui-capitalize { text-transform: capitalize; }
114
+ .fanui-underline { text-decoration: underline; }
115
+ .fanui-line-through { text-decoration: line-through; }
116
+ .fanui-no-underline { text-decoration: none; }
117
+
118
+ // -----------------------------------------------------------------------------
119
+ // 5. 对齐 / 换行 / 截断
120
+ // -----------------------------------------------------------------------------
121
+
122
+ .fanui-text-start { text-align: start; }
123
+ .fanui-text-center { text-align: center; }
124
+ .fanui-text-end { text-align: end; }
125
+ .fanui-text-justify { text-align: justify; }
126
+
127
+ .fanui-text-wrap { white-space: normal; }
128
+ .fanui-text-nowrap { white-space: nowrap; }
129
+ .fanui-text-pre { white-space: pre; }
130
+ .fanui-text-pre-wrap { white-space: pre-wrap; }
131
+ .fanui-text-break { word-break: break-word; overflow-wrap: anywhere; }
132
+ .fanui-text-balance { text-wrap: balance; }
133
+ .fanui-text-pretty { text-wrap: pretty; }
134
+
135
+ .fanui-truncate { @include mx.fanui-truncate(1); }
136
+ .fanui-truncate-2 { @include mx.fanui-truncate(2); }
137
+ .fanui-truncate-3 { @include mx.fanui-truncate(3); }
138
+ .fanui-truncate-4 { @include mx.fanui-truncate(4); }
139
+
140
+ // -----------------------------------------------------------------------------
141
+ // 6. 列表
142
+ // -----------------------------------------------------------------------------
143
+
144
+ .fanui-list {
145
+ padding-inline-start: 1.25rem;
146
+ margin-bottom: 1em;
147
+
148
+ li { margin-bottom: 0.25em; }
149
+ }
150
+
151
+ .fanui-list-unstyled {
152
+ list-style: none;
153
+ padding-inline-start: 0;
154
+ margin-inline-start: 0;
155
+ }
156
+
157
+ .fanui-list-inline {
158
+ display: flex;
159
+ flex-wrap: wrap;
160
+ gap: fn.fanui-var("space-4");
161
+ list-style: none;
162
+ padding-inline-start: 0;
163
+ }
164
+
165
+ .fanui-list-dashed {
166
+ list-style: none;
167
+ padding-inline-start: 0;
168
+
169
+ > li {
170
+ position: relative;
171
+ padding-inline-start: 1.25em;
172
+
173
+ &::before {
174
+ content: "";
175
+ position: absolute;
176
+ left: 0.25em;
177
+ top: 0.65em;
178
+ width: 0.35em;
179
+ height: 0.35em;
180
+ border-radius: 50%;
181
+ background-color: fn.fanui-var("primary");
182
+ }
183
+ }
184
+ }
185
+
186
+ // -----------------------------------------------------------------------------
187
+ // 7. 引用 / 分隔 / 代码
188
+ // -----------------------------------------------------------------------------
189
+
190
+ .fanui-blockquote {
191
+ margin: 0 0 1em;
192
+ padding: fn.fanui-var("space-4") fn.fanui-var("space-5");
193
+ border-inline-start: 4px solid fn.fanui-var("primary");
194
+ background-color: fn.fanui-var("color-surface-sunken");
195
+ border-radius: 0 fn.fanui-var("radius-base") fn.fanui-var("radius-base") 0;
196
+ color: fn.fanui-var("color-text-muted");
197
+
198
+ footer {
199
+ margin-top: fn.fanui-var("space-2");
200
+ font-size: fn.fanui-var("font-size-sm");
201
+ color: fn.fanui-var("color-text-subtle");
202
+
203
+ &::before { content: "— "; }
204
+ }
205
+ }
206
+
207
+ .fanui-code {
208
+ padding: 0.15em 0.4em;
209
+ font-family: fn.fanui-var("font-mono");
210
+ font-size: 0.875em;
211
+ color: fn.fanui-var("danger");
212
+ background-color: fn.fanui-var("color-surface-sunken");
213
+ border: 1px solid fn.fanui-var("color-border-subtle");
214
+ border-radius: fn.fanui-var("radius-sm");
215
+ white-space: nowrap;
216
+ }
217
+
218
+ .fanui-pre {
219
+ display: block;
220
+ margin: 0 0 1em;
221
+ padding: fn.fanui-var("space-4");
222
+ font-family: fn.fanui-var("font-mono");
223
+ font-size: fn.fanui-var("font-size-sm");
224
+ line-height: fn.fanui-var("line-height-relaxed");
225
+ color: fn.fanui-var("color-text");
226
+ background-color: fn.fanui-var("color-surface-sunken");
227
+ border: 1px solid fn.fanui-var("color-border");
228
+ border-radius: fn.fanui-var("radius-md");
229
+ overflow-x: auto;
230
+ tab-size: 2;
231
+
232
+ code {
233
+ padding: 0;
234
+ background: none;
235
+ border: 0;
236
+ color: inherit;
237
+ font-size: inherit;
238
+ white-space: pre;
239
+ }
240
+ }
241
+
242
+ .fanui-kbd {
243
+ display: inline-block;
244
+ min-width: 1.6em;
245
+ padding: 0.1em 0.4em;
246
+ font-family: fn.fanui-var("font-mono");
247
+ font-size: 0.8125em;
248
+ line-height: 1.4;
249
+ text-align: center;
250
+ color: fn.fanui-var("color-text");
251
+ background-color: fn.fanui-var("color-surface");
252
+ border: 1px solid fn.fanui-var("color-border-strong");
253
+ border-bottom-width: 2px;
254
+ border-radius: fn.fanui-var("radius-sm");
255
+ box-shadow: fn.fanui-var("shadow-xs");
256
+ }
257
+
258
+ .fanui-mark {
259
+ padding: 0.1em 0.2em;
260
+ background-color: fn.fanui-alpha(#f59e0b, 0.28);
261
+ color: inherit;
262
+ border-radius: fn.fanui-var("radius-sm");
263
+ }
264
+
265
+ .fanui-link {
266
+ color: fn.fanui-var("primary");
267
+ text-decoration: none;
268
+ border-bottom: 1px solid fn.fanui-var("primary-border");
269
+ @include mx.fanui-transition((color, border-color), v.$fanui-duration-fast);
270
+
271
+ &:hover {
272
+ color: fn.fanui-var("primary-hover");
273
+ border-bottom-color: fn.fanui-var("primary-hover");
274
+ text-decoration: none;
275
+ }
276
+
277
+ &--subtle {
278
+ color: fn.fanui-var("color-text-muted");
279
+ border-bottom-color: fn.fanui-var("color-border");
280
+
281
+ &:hover { color: fn.fanui-var("color-text"); border-bottom-color: fn.fanui-var("color-border-strong"); }
282
+ }
283
+ }
284
+
285
+ // -----------------------------------------------------------------------------
286
+ // 8. 标题锚点(.fanui-anchor)
287
+ // -----------------------------------------------------------------------------
288
+
289
+ .fanui-anchor {
290
+ position: relative;
291
+ scroll-margin-top: fn.fanui-var("space-8");
292
+
293
+ > .fanui-anchor__link {
294
+ position: absolute;
295
+ left: -1.25em;
296
+ padding-inline-end: 0.25em;
297
+ color: fn.fanui-var("color-text-subtle");
298
+ opacity: 0;
299
+ @include mx.fanui-transition(opacity, v.$fanui-duration-fast);
300
+
301
+ &::before { content: "#"; }
302
+ }
303
+
304
+ &:hover > .fanui-anchor__link { opacity: 1; }
305
+ }
306
+
307
+ // -----------------------------------------------------------------------------
308
+ // 9. 排版组合容器(.fanui-prose)
309
+ // -----------------------------------------------------------------------------
310
+
311
+ .fanui-prose {
312
+ font-size: fn.fanui-var("font-size-md");
313
+ line-height: fn.fanui-var("line-height-relaxed");
314
+ color: fn.fanui-var("color-text");
315
+ max-width: 72ch;
316
+
317
+ > * + * { margin-top: 1em; }
318
+ > h2 { margin-top: 2em; }
319
+ > h3 { margin-top: 1.5em; }
320
+ > h2 + *,
321
+ > h3 + * { margin-top: 0.5em; }
322
+
323
+ ul, ol { padding-inline-start: 1.4em; }
324
+ li + li { margin-top: 0.35em; }
325
+ li > ul,
326
+ li > ol { margin-top: 0.35em; }
327
+
328
+ code { @extend .fanui-code; }
329
+ pre { @extend .fanui-pre; }
330
+
331
+ img { border-radius: fn.fanui-var("radius-md"); margin: 1.5em 0; }
332
+
333
+ hr { margin: 2.5em 0; }
334
+
335
+ table {
336
+ width: 100%;
337
+ border-collapse: collapse;
338
+ font-size: fn.fanui-var("font-size-base");
339
+ margin: 1.5em 0;
340
+
341
+ th,
342
+ td {
343
+ padding: 8px 12px;
344
+ text-align: start;
345
+ border: 1px solid fn.fanui-var("color-border");
346
+ }
347
+
348
+ th {
349
+ background-color: fn.fanui-var("color-surface-sunken");
350
+ font-weight: 600;
351
+ }
352
+ }
353
+ }