btxui 1.0.5 → 1.0.7
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/dist/index.js +553 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.umd.cjs +1 -0
- package/package.json +4 -3
- package/index.js +0 -3289
- package/index.js.gz +0 -0
- package/index.umd.cjs +0 -1
- /package/{favicon.png → dist/favicon.png} +0 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
import { defineComponent, computed, reactive, onMounted, renderSlot, openBlock, createBlock, normalizeClass, withCtx, createElementVNode, normalizeStyle } from "vue";
|
|
2
|
+
const prestyles = {
|
|
3
|
+
//预置样式-----------------------------------------------------------------------------------
|
|
4
|
+
//重置初始字号及行高
|
|
5
|
+
"resize": `font-size: 1rem; lineHeight: 1.5;`,
|
|
6
|
+
//文字加粗
|
|
7
|
+
"bold": `font-weight: bold;`,
|
|
8
|
+
//隐藏显示
|
|
9
|
+
"show": `display: "block";`,
|
|
10
|
+
"hide": `display: "none";`,
|
|
11
|
+
//布局
|
|
12
|
+
"flex": `display: "flex"; justifyContent: "flex-start"; alignItems: "stretch";`,
|
|
13
|
+
"flex-column": `display: "flex"; flexDirection: "column";`,
|
|
14
|
+
"flex-1": `display: "flex"; justifyContent: "flex-start"; alignItems: "flex-start";`,
|
|
15
|
+
"flex-2": `display: "flex"; justifyContent: "center"; alignItems: "flex-start";`,
|
|
16
|
+
"flex-3": `display: "flex"; justifyContent: "flex-end"; alignItems: "flex-start";`,
|
|
17
|
+
"flex-4": `display: "flex"; justifyContent: "flex-start"; alignItems: "center"`,
|
|
18
|
+
"flex-5": {
|
|
19
|
+
display: "flex",
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
alignItems: "center"
|
|
22
|
+
},
|
|
23
|
+
"flex-6": {
|
|
24
|
+
display: "flex",
|
|
25
|
+
justifyContent: "flex-end",
|
|
26
|
+
alignItems: "center"
|
|
27
|
+
},
|
|
28
|
+
"flex-7": {
|
|
29
|
+
display: "flex",
|
|
30
|
+
justifyContent: "flex-start",
|
|
31
|
+
alignItems: "flex-end"
|
|
32
|
+
},
|
|
33
|
+
"flex-8": {
|
|
34
|
+
display: "flex",
|
|
35
|
+
justifyContent: "center",
|
|
36
|
+
alignItems: "flex-end"
|
|
37
|
+
},
|
|
38
|
+
"flex-9": {
|
|
39
|
+
display: "flex",
|
|
40
|
+
justifyContent: "flex-end",
|
|
41
|
+
alignItems: "flex-end"
|
|
42
|
+
},
|
|
43
|
+
"flex-between": {
|
|
44
|
+
display: "flex",
|
|
45
|
+
justifyContent: "space-between",
|
|
46
|
+
alignItems: "center"
|
|
47
|
+
},
|
|
48
|
+
"flex-around": {
|
|
49
|
+
display: "flex",
|
|
50
|
+
justifyContent: "space-around",
|
|
51
|
+
alignItems: "center"
|
|
52
|
+
},
|
|
53
|
+
"grid": {
|
|
54
|
+
display: "flex",
|
|
55
|
+
flexWrap: "wrap",
|
|
56
|
+
alignContent: "flex-start"
|
|
57
|
+
},
|
|
58
|
+
"max-h": {
|
|
59
|
+
height: "100%"
|
|
60
|
+
},
|
|
61
|
+
"max-w": {
|
|
62
|
+
width: "100%"
|
|
63
|
+
},
|
|
64
|
+
"max": {
|
|
65
|
+
height: "100%",
|
|
66
|
+
width: "100%"
|
|
67
|
+
},
|
|
68
|
+
"max-screen": {
|
|
69
|
+
height: "100%",
|
|
70
|
+
width: "100%",
|
|
71
|
+
position: "fixed",
|
|
72
|
+
left: 0,
|
|
73
|
+
top: 0
|
|
74
|
+
},
|
|
75
|
+
"item": {
|
|
76
|
+
breakInside: "avoid",
|
|
77
|
+
mozPageBreakInside: "avoid",
|
|
78
|
+
webkitColumnBreakInside: "avoid"
|
|
79
|
+
},
|
|
80
|
+
"fixed": { position: "fixed" },
|
|
81
|
+
"rel": { position: "relative" },
|
|
82
|
+
"abs": { position: "absolute" },
|
|
83
|
+
"z-1": { zIndex: -1 },
|
|
84
|
+
"z0": { zIndex: 0 },
|
|
85
|
+
"z1": { zIndex: 1 },
|
|
86
|
+
"z2": { zIndex: 2 },
|
|
87
|
+
"z3": { zIndex: 3 },
|
|
88
|
+
"z4": { zIndex: 4 },
|
|
89
|
+
"z5": { zIndex: 5 },
|
|
90
|
+
"z6": { zIndex: 6 },
|
|
91
|
+
"z7": { zIndex: 7 },
|
|
92
|
+
"z8": { zIndex: 8 },
|
|
93
|
+
"z9": { zIndex: 9 },
|
|
94
|
+
"z10": { zIndex: 10 },
|
|
95
|
+
//溢出处理
|
|
96
|
+
"no-scroll": { overflow: "hidden" },
|
|
97
|
+
"over-show": { overflow: "visible" },
|
|
98
|
+
"over-scroll": { overflow: "scroll" },
|
|
99
|
+
"over-hide": { overflow: "hidden" },
|
|
100
|
+
// 背景
|
|
101
|
+
"bg-repeat": { backgroundRepeat: "repeat" },
|
|
102
|
+
"bg-repeat-x": { backgroundRepeat: "repeat-x" },
|
|
103
|
+
"bg-repeat-y": { backgroundRepeat: "repeat-y" },
|
|
104
|
+
// size
|
|
105
|
+
"bg-size-cover": `background-size: cover;`,
|
|
106
|
+
"bg-size-contain": `background-size: contain;`,
|
|
107
|
+
"bg-size-max": `background-size: 100% 100%;`,
|
|
108
|
+
"bg-size-max-h": `background-size: auto 100%;`,
|
|
109
|
+
"bg-size-max-w": `background-size: 100% auto;`,
|
|
110
|
+
"bg-pos-1": { backgroundPosition: "left top" },
|
|
111
|
+
"bg-pos-2": { backgroundPosition: "center top" },
|
|
112
|
+
"bg-pos-3": { backgroundPosition: "right top" },
|
|
113
|
+
"bg-pos-4": { backgroundPosition: "left center" },
|
|
114
|
+
"bg-pos-5": { backgroundPosition: "center center" },
|
|
115
|
+
"bg-pos-6": { backgroundPosition: "right center" },
|
|
116
|
+
"bg-pos-7": { backgroundPosition: "left bottom" },
|
|
117
|
+
"bg-pos-8": { backgroundPosition: "center bottom" },
|
|
118
|
+
"bg-pos-9": { backgroundPosition: "right bottom" },
|
|
119
|
+
//圆角
|
|
120
|
+
"round": `border-radius: 50%;`,
|
|
121
|
+
"round-lg": `borderRadius: 24px;`,
|
|
122
|
+
"round-md": `border-radius: 10px;`,
|
|
123
|
+
"round-sm": `borderRadius: 4px;`,
|
|
124
|
+
"round-t": `borderBottomRightRadius: 0; borderBottomLeftRadius: 0;`,
|
|
125
|
+
"round-b": `borderTopRightRadius: 0; borderTopLeftRadius: 0;`,
|
|
126
|
+
"round-l": `borderTopRightRadius: 0; borderBottomRightRadius: 0;`,
|
|
127
|
+
"round-r": `borderTopLeftRadius: 0; borderBottomLeftRadius: 0;`,
|
|
128
|
+
//描边
|
|
129
|
+
"line": `borderStyle: solid;`,
|
|
130
|
+
"dashed": `borderStyle: dashed;`,
|
|
131
|
+
"line-l": `borderLeftStyle: solid;`,
|
|
132
|
+
"line-r": `borderRightStyle: solid;`,
|
|
133
|
+
"line-t": `borderTopStyle: solid;`,
|
|
134
|
+
"line-b": `borderBottomStyle: solid;`,
|
|
135
|
+
"dashed-l": `borderLeftStyle: dashed;`,
|
|
136
|
+
"dashed-r": `borderRightStyle: dashed;`,
|
|
137
|
+
"dashed-t": `borderTopStyle: dashed;`,
|
|
138
|
+
"dashed-b": `borderBottomStyle: dashed;`,
|
|
139
|
+
"line-outside": `backgroundClip: padding-box;`,
|
|
140
|
+
//文字描边
|
|
141
|
+
"text-line": {
|
|
142
|
+
textShadow: "1px 0 0 rgba(200, 200, 200, .5), -1px 0 0 rgba(200, 200, 200, .5), 0 1px 0 rgba(200, 200, 200, .5), 0 -1px 0 rgba(200, 200, 200, .5)"
|
|
143
|
+
},
|
|
144
|
+
//单行省略文本
|
|
145
|
+
"ellipsis": {
|
|
146
|
+
overflow: "hidden",
|
|
147
|
+
textOverflow: "ellipsis",
|
|
148
|
+
whiteSpace: "nowrap"
|
|
149
|
+
},
|
|
150
|
+
//阴影
|
|
151
|
+
"shadow": { boxShadow: "0 4px 17px" },
|
|
152
|
+
"shadow-sm": { boxShadow: "0 2px 4px" },
|
|
153
|
+
"shadow-lg": { boxShadow: "0 14px 40px" },
|
|
154
|
+
"shadow-relief": { boxShadow: "1px 1px 0 rgba(0,0,0,.7) inset, 1px 1px 0 rgba(255,255,255,.4)" },
|
|
155
|
+
//过渡动画
|
|
156
|
+
"trans": { transition: "all .7s" },
|
|
157
|
+
"trans-fast": { transition: "all .4s" },
|
|
158
|
+
"trans-slow": { transition: "all 1.4s" },
|
|
159
|
+
"trans-no": { transition: "none" },
|
|
160
|
+
//模糊滤镜
|
|
161
|
+
"blur-no": { filter: "blur(0px)" },
|
|
162
|
+
"blur-sm": { filter: "blur(2px)" },
|
|
163
|
+
"blur-md": { filter: "blur(7px)" },
|
|
164
|
+
"blur-lg": { filter: "blur(17px)" },
|
|
165
|
+
//明度滤镜
|
|
166
|
+
"dark-no": { filter: "brightness(100%)" },
|
|
167
|
+
"dark-sm": { filter: "brightness(80%)" },
|
|
168
|
+
"dark-md": { filter: "brightness(50%)" },
|
|
169
|
+
"dark-lg": { filter: "brightness(20%)" },
|
|
170
|
+
// 纯度滤镜
|
|
171
|
+
"gray-no": `filter: grayscale(0%);`,
|
|
172
|
+
"gray-sm": `filter: grayscale(40%);`,
|
|
173
|
+
"gray-md": `filter: grayscale(70%);`,
|
|
174
|
+
"gray-lg": `filter: grayscale(100%);`,
|
|
175
|
+
// 特殊
|
|
176
|
+
"bg-none": `pointerEvents: none;`,
|
|
177
|
+
"bg-use": `pointerEvents: auto;`,
|
|
178
|
+
"touch-none": `touchAction: none;`,
|
|
179
|
+
// 二段赋值-----------------------------------------------------------------------------------
|
|
180
|
+
// 文本对齐
|
|
181
|
+
"p": {
|
|
182
|
+
pro: "text-align"
|
|
183
|
+
},
|
|
184
|
+
// 文字颜色
|
|
185
|
+
"color": {
|
|
186
|
+
pro: "color"
|
|
187
|
+
},
|
|
188
|
+
// 背景色
|
|
189
|
+
"bg": {
|
|
190
|
+
pro: "background"
|
|
191
|
+
},
|
|
192
|
+
// 宽度
|
|
193
|
+
"w": {
|
|
194
|
+
pro: "width",
|
|
195
|
+
unit: "rem"
|
|
196
|
+
},
|
|
197
|
+
// 高度
|
|
198
|
+
"h": {
|
|
199
|
+
pro: "height",
|
|
200
|
+
unit: "rem"
|
|
201
|
+
},
|
|
202
|
+
// 内边距
|
|
203
|
+
"pad": {
|
|
204
|
+
pro: "padding",
|
|
205
|
+
unit: "rem"
|
|
206
|
+
},
|
|
207
|
+
// 外边距
|
|
208
|
+
"mrg": {
|
|
209
|
+
pro: "margin",
|
|
210
|
+
unit: "rem"
|
|
211
|
+
},
|
|
212
|
+
"rule_2": {
|
|
213
|
+
//字体
|
|
214
|
+
"font": {
|
|
215
|
+
pro: "fontFamily"
|
|
216
|
+
},
|
|
217
|
+
//字号
|
|
218
|
+
"fsize": {
|
|
219
|
+
pro: "fontSize",
|
|
220
|
+
unit: "em"
|
|
221
|
+
},
|
|
222
|
+
//行高
|
|
223
|
+
"lh": {
|
|
224
|
+
pro: "lineHeight"
|
|
225
|
+
},
|
|
226
|
+
//字符间距
|
|
227
|
+
"lspace": {
|
|
228
|
+
pro: "letterSpacing",
|
|
229
|
+
unit: "rem"
|
|
230
|
+
},
|
|
231
|
+
//不透明度
|
|
232
|
+
"alpha": {
|
|
233
|
+
pro: "opacity",
|
|
234
|
+
extra: {
|
|
235
|
+
visibility: "visible"
|
|
236
|
+
},
|
|
237
|
+
escape: {
|
|
238
|
+
"0": {
|
|
239
|
+
visibility: "hidden"
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
//描边颜色
|
|
244
|
+
"line": {
|
|
245
|
+
pro: "borderColor"
|
|
246
|
+
},
|
|
247
|
+
//自生长比率
|
|
248
|
+
"grow": {
|
|
249
|
+
pro: "flexGrow",
|
|
250
|
+
extra: {
|
|
251
|
+
flexBasis: 0
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
//弹性布局项目排序
|
|
255
|
+
"order": {
|
|
256
|
+
pro: "order"
|
|
257
|
+
},
|
|
258
|
+
//多列布局容器
|
|
259
|
+
"column": {
|
|
260
|
+
pro: "columnCount",
|
|
261
|
+
extra: {
|
|
262
|
+
columnGap: 0
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
//最大宽
|
|
266
|
+
"rw": {
|
|
267
|
+
pro: "maxWidth",
|
|
268
|
+
unit: "rem"
|
|
269
|
+
},
|
|
270
|
+
//最小宽
|
|
271
|
+
"lw": {
|
|
272
|
+
pro: "minWidth",
|
|
273
|
+
unit: "rem"
|
|
274
|
+
},
|
|
275
|
+
//最大高
|
|
276
|
+
"th": {
|
|
277
|
+
pro: "maxHeight",
|
|
278
|
+
unit: "rem"
|
|
279
|
+
},
|
|
280
|
+
//最小高
|
|
281
|
+
"bh": {
|
|
282
|
+
pro: "minHeight",
|
|
283
|
+
unit: "rem"
|
|
284
|
+
},
|
|
285
|
+
//基于容器左侧水平位移
|
|
286
|
+
"l": {
|
|
287
|
+
pro: "left",
|
|
288
|
+
unit: "rem"
|
|
289
|
+
},
|
|
290
|
+
//基于容器右侧水平位移
|
|
291
|
+
"r": {
|
|
292
|
+
pro: "right",
|
|
293
|
+
unit: "rem"
|
|
294
|
+
},
|
|
295
|
+
//基于容器上侧垂直位移
|
|
296
|
+
"t": {
|
|
297
|
+
pro: "top",
|
|
298
|
+
unit: "rem"
|
|
299
|
+
},
|
|
300
|
+
//基于容器下侧垂直位移
|
|
301
|
+
"b": {
|
|
302
|
+
pro: "bottom",
|
|
303
|
+
unit: "rem"
|
|
304
|
+
},
|
|
305
|
+
//水平位移
|
|
306
|
+
"translateX": {
|
|
307
|
+
pro: "transform",
|
|
308
|
+
tmp: "translateX(%{}%)",
|
|
309
|
+
unit: "%"
|
|
310
|
+
},
|
|
311
|
+
//垂直位移
|
|
312
|
+
"translateY": {
|
|
313
|
+
pro: "transform",
|
|
314
|
+
tmp: "translateY(%{}%)",
|
|
315
|
+
unit: "%"
|
|
316
|
+
},
|
|
317
|
+
//放缩
|
|
318
|
+
"scale": {
|
|
319
|
+
pro: "transform",
|
|
320
|
+
tmp: "scale(%{}%)"
|
|
321
|
+
},
|
|
322
|
+
//旋转
|
|
323
|
+
"rotate": {
|
|
324
|
+
pro: "transform",
|
|
325
|
+
tmp: "rotate(%{}%)",
|
|
326
|
+
unit: "deg"
|
|
327
|
+
},
|
|
328
|
+
//变形
|
|
329
|
+
"transform": {
|
|
330
|
+
pro: "transform"
|
|
331
|
+
},
|
|
332
|
+
//变形中心点
|
|
333
|
+
"origin": {
|
|
334
|
+
pro: "transformOrigin"
|
|
335
|
+
},
|
|
336
|
+
//描边粗细
|
|
337
|
+
"thick": {
|
|
338
|
+
pro: "borderWidth",
|
|
339
|
+
unit: "px"
|
|
340
|
+
},
|
|
341
|
+
//过渡动画延迟
|
|
342
|
+
"trans": {
|
|
343
|
+
pro: "transition"
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
//三段赋值-----------------------------------------------------------------------------------
|
|
347
|
+
"rule_3": {
|
|
348
|
+
//左侧
|
|
349
|
+
"l": {
|
|
350
|
+
pro: ["Left"],
|
|
351
|
+
unit: "rem"
|
|
352
|
+
},
|
|
353
|
+
//右侧
|
|
354
|
+
"r": {
|
|
355
|
+
pro: ["Right"],
|
|
356
|
+
unit: "rem"
|
|
357
|
+
},
|
|
358
|
+
//上侧
|
|
359
|
+
"t": {
|
|
360
|
+
pro: ["Top"],
|
|
361
|
+
unit: "rem"
|
|
362
|
+
},
|
|
363
|
+
//下侧
|
|
364
|
+
"b": {
|
|
365
|
+
pro: ["Bottom"],
|
|
366
|
+
unit: "rem"
|
|
367
|
+
},
|
|
368
|
+
//垂直方向
|
|
369
|
+
"v": {
|
|
370
|
+
pro: ["Top", "Bottom"],
|
|
371
|
+
unit: "rem"
|
|
372
|
+
},
|
|
373
|
+
//水平方向
|
|
374
|
+
"h": {
|
|
375
|
+
pro: ["Left", "Right"],
|
|
376
|
+
unit: "rem"
|
|
377
|
+
},
|
|
378
|
+
//背景颜色
|
|
379
|
+
"gradient": {
|
|
380
|
+
pro: ["Image"],
|
|
381
|
+
tmp: "-webkit-linear-gradient(%{}%)"
|
|
382
|
+
},
|
|
383
|
+
//背景颜色
|
|
384
|
+
"color": {
|
|
385
|
+
pro: ["Color"]
|
|
386
|
+
},
|
|
387
|
+
//背景尺寸
|
|
388
|
+
"size": {
|
|
389
|
+
pro: ["Size"]
|
|
390
|
+
},
|
|
391
|
+
//背景定位
|
|
392
|
+
"pos": {
|
|
393
|
+
pro: ["Position"]
|
|
394
|
+
},
|
|
395
|
+
//过渡动画延迟
|
|
396
|
+
"delay": {
|
|
397
|
+
pro: ["Delay"],
|
|
398
|
+
unit: "s"
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
const theme = {
|
|
403
|
+
// 预置主题色
|
|
404
|
+
colors: {
|
|
405
|
+
none: "transparent",
|
|
406
|
+
main: "#051c24",
|
|
407
|
+
sub: "#b4967a",
|
|
408
|
+
light: "#fff",
|
|
409
|
+
lgray: "#eee",
|
|
410
|
+
mgray: "#a7a7a7",
|
|
411
|
+
dgray: "#373737",
|
|
412
|
+
dark: "#111",
|
|
413
|
+
blue: "#4085f3",
|
|
414
|
+
green: "#02b9a1",
|
|
415
|
+
yellow: "#fdba00",
|
|
416
|
+
red: "#ec4334",
|
|
417
|
+
neutral: "rgba(134,134,134,.17)"
|
|
418
|
+
},
|
|
419
|
+
// 追加或覆盖主题色
|
|
420
|
+
append(colors) {
|
|
421
|
+
this.colors = { ...this.colors, ...colors };
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
const GLOBAL_STYLE_NAME = "BTXUIGlobal";
|
|
425
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
426
|
+
__name: "index",
|
|
427
|
+
props: {
|
|
428
|
+
// 样式集
|
|
429
|
+
class: {
|
|
430
|
+
type: String,
|
|
431
|
+
required: false
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
setup(__props) {
|
|
435
|
+
const props = __props;
|
|
436
|
+
const $style = ref();
|
|
437
|
+
const styleMap = computed(() => {
|
|
438
|
+
const list = [];
|
|
439
|
+
for (let item of $style.value.sheet.rules) {
|
|
440
|
+
list.push(item.selectorText.substr(1));
|
|
441
|
+
}
|
|
442
|
+
return list;
|
|
443
|
+
});
|
|
444
|
+
const initStyle = () => {
|
|
445
|
+
let $_style = document.head.querySelector(`#${GLOBAL_STYLE_NAME}`);
|
|
446
|
+
if (!$_style) {
|
|
447
|
+
$_style = document.createElement("style");
|
|
448
|
+
$_style.setAttribute("type", "text/css");
|
|
449
|
+
$_style.setAttribute("id", GLOBAL_STYLE_NAME);
|
|
450
|
+
document.head.appendChild($_style);
|
|
451
|
+
}
|
|
452
|
+
$style.value = $_style;
|
|
453
|
+
};
|
|
454
|
+
const styles = reactive({});
|
|
455
|
+
const validValue = (val) => {
|
|
456
|
+
if (!isNaN(val * 1))
|
|
457
|
+
return val;
|
|
458
|
+
if (theme.colors[val])
|
|
459
|
+
return theme.colors[val];
|
|
460
|
+
return false;
|
|
461
|
+
};
|
|
462
|
+
const parseStyle = (rule) => {
|
|
463
|
+
let style = prestyles[rule];
|
|
464
|
+
if (style)
|
|
465
|
+
return style;
|
|
466
|
+
const rules = rule.split("-");
|
|
467
|
+
const dirs = {
|
|
468
|
+
l: "left",
|
|
469
|
+
t: "top",
|
|
470
|
+
r: "right",
|
|
471
|
+
b: "bottom"
|
|
472
|
+
};
|
|
473
|
+
let [r1, r2, r3, r4] = rules;
|
|
474
|
+
style = prestyles[r1];
|
|
475
|
+
if (style) {
|
|
476
|
+
let value = validValue(r2);
|
|
477
|
+
if (value)
|
|
478
|
+
return `${style.pro}: ${value}${r3 || style.unit || ""}`;
|
|
479
|
+
value = validValue(r3);
|
|
480
|
+
if (value)
|
|
481
|
+
return `${style.pro}-${dirs[r2] || r2}: ${value}${r4 || style.unit || ""}`;
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
const parseStyles = () => {
|
|
485
|
+
if (!props.class)
|
|
486
|
+
return;
|
|
487
|
+
props.class.split(" ").forEach((rule) => {
|
|
488
|
+
if (!styleMap.value.includes(rule)) {
|
|
489
|
+
styleMap.value.push(rule);
|
|
490
|
+
styles[rule] = parseStyle(rule);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
const setStyle = () => {
|
|
495
|
+
Object.keys(styles).forEach((key) => {
|
|
496
|
+
$style.value.sheet.addRule(`.${key}`, styles[key]);
|
|
497
|
+
});
|
|
498
|
+
};
|
|
499
|
+
onMounted(() => {
|
|
500
|
+
initStyle();
|
|
501
|
+
parseStyles();
|
|
502
|
+
setStyle();
|
|
503
|
+
});
|
|
504
|
+
return (_ctx, _cache) => {
|
|
505
|
+
return renderSlot(_ctx.$slots, "default");
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
510
|
+
__name: "b-view",
|
|
511
|
+
props: {
|
|
512
|
+
class: {},
|
|
513
|
+
bgImg: {}
|
|
514
|
+
},
|
|
515
|
+
setup(__props) {
|
|
516
|
+
return (_ctx, _cache) => {
|
|
517
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
518
|
+
class: normalizeClass(_ctx.class)
|
|
519
|
+
}, {
|
|
520
|
+
default: withCtx(() => [
|
|
521
|
+
createElementVNode("div", {
|
|
522
|
+
class: normalizeClass(_ctx.class),
|
|
523
|
+
style: normalizeStyle({ backgroundImage: `url(${_ctx.bgImg})` })
|
|
524
|
+
}, [
|
|
525
|
+
renderSlot(_ctx.$slots, "default")
|
|
526
|
+
], 6)
|
|
527
|
+
]),
|
|
528
|
+
_: 3
|
|
529
|
+
}, 8, ["class"]);
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
const initGlobalComponents = [
|
|
534
|
+
{
|
|
535
|
+
name: "styles",
|
|
536
|
+
wid: _sfc_main$1
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
name: "b-view",
|
|
540
|
+
wid: _sfc_main
|
|
541
|
+
}
|
|
542
|
+
];
|
|
543
|
+
const index = {
|
|
544
|
+
name: "btxui",
|
|
545
|
+
install(app) {
|
|
546
|
+
initGlobalComponents.forEach((item) => {
|
|
547
|
+
app.component(item.name, item.wid);
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
export {
|
|
552
|
+
index as default
|
|
553
|
+
};
|
package/dist/index.js.gz
ADDED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).btxui=t(e.vue)}(this,(function(e){"use strict";const t={resize:"font-size: 1rem; lineHeight: 1.5;",bold:"font-weight: bold;",show:'display: "block";',hide:'display: "none";',flex:'display: "flex"; justifyContent: "flex-start"; alignItems: "stretch";',"flex-column":'display: "flex"; flexDirection: "column";',"flex-1":'display: "flex"; justifyContent: "flex-start"; alignItems: "flex-start";',"flex-2":'display: "flex"; justifyContent: "center"; alignItems: "flex-start";',"flex-3":'display: "flex"; justifyContent: "flex-end"; alignItems: "flex-start";',"flex-4":'display: "flex"; justifyContent: "flex-start"; alignItems: "center"',"flex-5":{display:"flex",justifyContent:"center",alignItems:"center"},"flex-6":{display:"flex",justifyContent:"flex-end",alignItems:"center"},"flex-7":{display:"flex",justifyContent:"flex-start",alignItems:"flex-end"},"flex-8":{display:"flex",justifyContent:"center",alignItems:"flex-end"},"flex-9":{display:"flex",justifyContent:"flex-end",alignItems:"flex-end"},"flex-between":{display:"flex",justifyContent:"space-between",alignItems:"center"},"flex-around":{display:"flex",justifyContent:"space-around",alignItems:"center"},grid:{display:"flex",flexWrap:"wrap",alignContent:"flex-start"},"max-h":{height:"100%"},"max-w":{width:"100%"},max:{height:"100%",width:"100%"},"max-screen":{height:"100%",width:"100%",position:"fixed",left:0,top:0},item:{breakInside:"avoid",mozPageBreakInside:"avoid",webkitColumnBreakInside:"avoid"},fixed:{position:"fixed"},rel:{position:"relative"},abs:{position:"absolute"},"z-1":{zIndex:-1},z0:{zIndex:0},z1:{zIndex:1},z2:{zIndex:2},z3:{zIndex:3},z4:{zIndex:4},z5:{zIndex:5},z6:{zIndex:6},z7:{zIndex:7},z8:{zIndex:8},z9:{zIndex:9},z10:{zIndex:10},"no-scroll":{overflow:"hidden"},"over-show":{overflow:"visible"},"over-scroll":{overflow:"scroll"},"over-hide":{overflow:"hidden"},"bg-repeat":{backgroundRepeat:"repeat"},"bg-repeat-x":{backgroundRepeat:"repeat-x"},"bg-repeat-y":{backgroundRepeat:"repeat-y"},"bg-size-cover":"background-size: cover;","bg-size-contain":"background-size: contain;","bg-size-max":"background-size: 100% 100%;","bg-size-max-h":"background-size: auto 100%;","bg-size-max-w":"background-size: 100% auto;","bg-pos-1":{backgroundPosition:"left top"},"bg-pos-2":{backgroundPosition:"center top"},"bg-pos-3":{backgroundPosition:"right top"},"bg-pos-4":{backgroundPosition:"left center"},"bg-pos-5":{backgroundPosition:"center center"},"bg-pos-6":{backgroundPosition:"right center"},"bg-pos-7":{backgroundPosition:"left bottom"},"bg-pos-8":{backgroundPosition:"center bottom"},"bg-pos-9":{backgroundPosition:"right bottom"},round:"border-radius: 50%;","round-lg":"borderRadius: 24px;","round-md":"border-radius: 10px;","round-sm":"borderRadius: 4px;","round-t":"borderBottomRightRadius: 0; borderBottomLeftRadius: 0;","round-b":"borderTopRightRadius: 0; borderTopLeftRadius: 0;","round-l":"borderTopRightRadius: 0; borderBottomRightRadius: 0;","round-r":"borderTopLeftRadius: 0; borderBottomLeftRadius: 0;",line:"borderStyle: solid;",dashed:"borderStyle: dashed;","line-l":"borderLeftStyle: solid;","line-r":"borderRightStyle: solid;","line-t":"borderTopStyle: solid;","line-b":"borderBottomStyle: solid;","dashed-l":"borderLeftStyle: dashed;","dashed-r":"borderRightStyle: dashed;","dashed-t":"borderTopStyle: dashed;","dashed-b":"borderBottomStyle: dashed;","line-outside":"backgroundClip: padding-box;","text-line":{textShadow:"1px 0 0 rgba(200, 200, 200, .5), -1px 0 0 rgba(200, 200, 200, .5), 0 1px 0 rgba(200, 200, 200, .5), 0 -1px 0 rgba(200, 200, 200, .5)"},ellipsis:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},shadow:{boxShadow:"0 4px 17px"},"shadow-sm":{boxShadow:"0 2px 4px"},"shadow-lg":{boxShadow:"0 14px 40px"},"shadow-relief":{boxShadow:"1px 1px 0 rgba(0,0,0,.7) inset, 1px 1px 0 rgba(255,255,255,.4)"},trans:{transition:"all .7s"},"trans-fast":{transition:"all .4s"},"trans-slow":{transition:"all 1.4s"},"trans-no":{transition:"none"},"blur-no":{filter:"blur(0px)"},"blur-sm":{filter:"blur(2px)"},"blur-md":{filter:"blur(7px)"},"blur-lg":{filter:"blur(17px)"},"dark-no":{filter:"brightness(100%)"},"dark-sm":{filter:"brightness(80%)"},"dark-md":{filter:"brightness(50%)"},"dark-lg":{filter:"brightness(20%)"},"gray-no":"filter: grayscale(0%);","gray-sm":"filter: grayscale(40%);","gray-md":"filter: grayscale(70%);","gray-lg":"filter: grayscale(100%);","bg-none":"pointerEvents: none;","bg-use":"pointerEvents: auto;","touch-none":"touchAction: none;",p:{pro:"text-align"},color:{pro:"color"},bg:{pro:"background"},w:{pro:"width",unit:"rem"},h:{pro:"height",unit:"rem"},pad:{pro:"padding",unit:"rem"},mrg:{pro:"margin",unit:"rem"},rule_2:{font:{pro:"fontFamily"},fsize:{pro:"fontSize",unit:"em"},lh:{pro:"lineHeight"},lspace:{pro:"letterSpacing",unit:"rem"},alpha:{pro:"opacity",extra:{visibility:"visible"},escape:{0:{visibility:"hidden"}}},line:{pro:"borderColor"},grow:{pro:"flexGrow",extra:{flexBasis:0}},order:{pro:"order"},column:{pro:"columnCount",extra:{columnGap:0}},rw:{pro:"maxWidth",unit:"rem"},lw:{pro:"minWidth",unit:"rem"},th:{pro:"maxHeight",unit:"rem"},bh:{pro:"minHeight",unit:"rem"},l:{pro:"left",unit:"rem"},r:{pro:"right",unit:"rem"},t:{pro:"top",unit:"rem"},b:{pro:"bottom",unit:"rem"},translateX:{pro:"transform",tmp:"translateX(%{}%)",unit:"%"},translateY:{pro:"transform",tmp:"translateY(%{}%)",unit:"%"},scale:{pro:"transform",tmp:"scale(%{}%)"},rotate:{pro:"transform",tmp:"rotate(%{}%)",unit:"deg"},transform:{pro:"transform"},origin:{pro:"transformOrigin"},thick:{pro:"borderWidth",unit:"px"},trans:{pro:"transition"}},rule_3:{l:{pro:["Left"],unit:"rem"},r:{pro:["Right"],unit:"rem"},t:{pro:["Top"],unit:"rem"},b:{pro:["Bottom"],unit:"rem"},v:{pro:["Top","Bottom"],unit:"rem"},h:{pro:["Left","Right"],unit:"rem"},gradient:{pro:["Image"],tmp:"-webkit-linear-gradient(%{}%)"},color:{pro:["Color"]},size:{pro:["Size"]},pos:{pro:["Position"]},delay:{pro:["Delay"],unit:"s"}}},r={colors:{none:"transparent",main:"#051c24",sub:"#b4967a",light:"#fff",lgray:"#eee",mgray:"#a7a7a7",dgray:"#373737",dark:"#111",blue:"#4085f3",green:"#02b9a1",yellow:"#fdba00",red:"#ec4334",neutral:"rgba(134,134,134,.17)"},append(e){this.colors={...this.colors,...e}}},o="BTXUIGlobal",i=e.defineComponent({__name:"index",props:{class:{type:String,required:!1}},setup(i){const n=i,l=ref(),a=e.computed((()=>{const e=[];for(let t of l.value.sheet.rules)e.push(t.selectorText.substr(1));return e})),s=e.reactive({}),d=e=>isNaN(1*e)?!!r.colors[e]&&r.colors[e]:e,p=()=>{n.class&&n.class.split(" ").forEach((e=>{a.value.includes(e)||(a.value.push(e),s[e]=(e=>{let r=t[e];if(r)return r;const o=e.split("-"),i={l:"left",t:"top",r:"right",b:"bottom"};let[n,l,a,s]=o;if(r=t[n],r){let e=d(l);if(e)return`${r.pro}: ${e}${a||r.unit||""}`;if(e=d(a),e)return`${r.pro}-${i[l]||l}: ${e}${s||r.unit||""}`}})(e))}))};return e.onMounted((()=>{(()=>{let e=document.head.querySelector(`#${o}`);e||(e=document.createElement("style"),e.setAttribute("type","text/css"),e.setAttribute("id",o),document.head.appendChild(e)),l.value=e})(),p(),Object.keys(s).forEach((e=>{l.value.sheet.addRule(`.${e}`,s[e])}))})),(t,r)=>e.renderSlot(t.$slots,"default")}}),n=[{name:"styles",wid:i},{name:"b-view",wid:e.defineComponent({__name:"b-view",props:{class:{},bgImg:{}},setup:t=>(t,r)=>(e.openBlock(),e.createBlock(i,{class:e.normalizeClass(t.class)},{default:e.withCtx((()=>[e.createElementVNode("div",{class:e.normalizeClass(t.class),style:e.normalizeStyle({backgroundImage:`url(${t.bgImg})`})},[e.renderSlot(t.$slots,"default")],6)])),_:3},8,["class"]))})}];return{name:"btxui",install(e){n.forEach((t=>{e.component(t.name,t.wid)}))}}}));
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "btxui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "btxstudio",
|
|
10
11
|
"license": "ISC"
|
|
11
12
|
}
|