btxui 1.0.9 → 1.0.10

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 CHANGED
@@ -1,14 +1,561 @@
1
- const styles = /* @__PURE__ */ Object.assign({ "./src/components/core/styles/index.vue": () => import("./index-3f640b42.js") });
2
- const bView = /* @__PURE__ */ Object.assign({ "./src/components/core/b-view.vue": () => import("./b-view-fa2f9966.js") });
3
- const bText = /* @__PURE__ */ Object.assign({ "./src/components/core/b-text.vue": () => import("./b-text-306818aa.js") });
4
- const initGlobalComponents = { ...styles, ...bView, ...bText };
1
+ import { defineComponent, ref, 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$2 = /* @__PURE__ */ defineComponent({
426
+ __name: "b-style",
427
+ props: {
428
+ class: {}
429
+ },
430
+ setup(__props) {
431
+ const props = __props;
432
+ const $style = ref();
433
+ const styleMap = computed(() => {
434
+ const list = [];
435
+ for (let item of $style.value.sheet.rules) {
436
+ list.push(item.selectorText.substr(1));
437
+ }
438
+ return list;
439
+ });
440
+ const initStyle = () => {
441
+ let $_style = document.head.querySelector(`#${GLOBAL_STYLE_NAME}`);
442
+ if (!$_style) {
443
+ $_style = document.createElement("style");
444
+ $_style.setAttribute("type", "text/css");
445
+ $_style.setAttribute("id", GLOBAL_STYLE_NAME);
446
+ document.head.appendChild($_style);
447
+ }
448
+ $style.value = $_style;
449
+ };
450
+ const styles = reactive({});
451
+ const validValue = (val) => {
452
+ if (!isNaN(val * 1))
453
+ return val;
454
+ if (theme.colors[val])
455
+ return theme.colors[val];
456
+ return false;
457
+ };
458
+ const parseStyle = (rule) => {
459
+ let style = prestyles[rule];
460
+ if (style)
461
+ return style;
462
+ const rules = rule.split("-");
463
+ const dirs = {
464
+ l: "left",
465
+ t: "top",
466
+ r: "right",
467
+ b: "bottom"
468
+ };
469
+ let [r1, r2, r3, r4] = rules;
470
+ style = prestyles[r1];
471
+ if (style) {
472
+ let value = validValue(r2);
473
+ if (value)
474
+ return `${style.pro}: ${value}${r3 || style.unit || ""}`;
475
+ value = validValue(r3);
476
+ if (value)
477
+ return `${style.pro}-${dirs[r2] || r2}: ${value}${r4 || style.unit || ""}`;
478
+ }
479
+ };
480
+ const parseStyles = (_class) => {
481
+ if (!_class)
482
+ return;
483
+ _class.split(" ").forEach((rule) => {
484
+ if (!styleMap.value.includes(rule)) {
485
+ styleMap.value.push(rule);
486
+ styles[rule] = parseStyle(rule);
487
+ }
488
+ });
489
+ };
490
+ const setStyle = () => {
491
+ Object.keys(styles).forEach((key) => {
492
+ $style.value.sheet.addRule(`.${key}`, styles[key]);
493
+ });
494
+ };
495
+ onMounted(() => {
496
+ if (props.class) {
497
+ initStyle();
498
+ parseStyles(props.class);
499
+ setStyle();
500
+ }
501
+ });
502
+ return (_ctx, _cache) => {
503
+ return renderSlot(_ctx.$slots, "default");
504
+ };
505
+ }
506
+ });
507
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
508
+ __name: "b-view",
509
+ props: {
510
+ class: {},
511
+ bgImg: {}
512
+ },
513
+ setup(__props) {
514
+ return (_ctx, _cache) => {
515
+ return openBlock(), createBlock(_sfc_main$2, {
516
+ class: normalizeClass(_ctx.class)
517
+ }, {
518
+ default: withCtx(() => [
519
+ createElementVNode("div", {
520
+ class: normalizeClass(_ctx.class),
521
+ style: normalizeStyle({ backgroundImage: `url(${_ctx.bgImg})` })
522
+ }, [
523
+ renderSlot(_ctx.$slots, "default")
524
+ ], 6)
525
+ ]),
526
+ _: 3
527
+ }, 8, ["class"]);
528
+ };
529
+ }
530
+ });
531
+ const _sfc_main = /* @__PURE__ */ defineComponent({
532
+ __name: "b-text",
533
+ props: {
534
+ class: {}
535
+ },
536
+ setup(__props) {
537
+ return (_ctx, _cache) => {
538
+ return openBlock(), createBlock(_sfc_main$2, {
539
+ class: normalizeClass(_ctx.class)
540
+ }, {
541
+ default: withCtx(() => [
542
+ createElementVNode("span", {
543
+ class: normalizeClass(_ctx.class)
544
+ }, [
545
+ renderSlot(_ctx.$slots, "default")
546
+ ], 2)
547
+ ]),
548
+ _: 3
549
+ }, 8, ["class"]);
550
+ };
551
+ }
552
+ });
553
+ const initGlobalComponents = [_sfc_main$2, _sfc_main$1, _sfc_main];
5
554
  const index = {
6
555
  name: "btxui",
7
556
  install(app) {
8
- Object.keys(initGlobalComponents).forEach((path) => {
9
- const pathBlocks = path.split("/");
10
- pathBlocks.pop();
11
- app.component(pathBlocks.pop(), initGlobalComponents[path]);
557
+ initGlobalComponents.forEach((wid) => {
558
+ app.component(wid.__name, wid);
12
559
  });
13
560
  }
14
561
  };
Binary file
@@ -1 +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={...Object.assign({"./src/components/core/styles/index.vue":()=>Promise.resolve().then((()=>s))}),...Object.assign({"./src/components/core/b-view.vue":()=>Promise.resolve().then((()=>d))}),...Object.assign({"./src/components/core/b-text.vue":()=>Promise.resolve().then((()=>u))})},o={name:"btxui",install(e){Object.keys(t).forEach((o=>{const r=o.split("/");r.pop(),e.component(r.pop(),t[o])}))}},r={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"}}},n={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}}},i="BTXUIGlobal",l=e.defineComponent({__name:"index",props:{class:{type:String,required:!1}},setup(t){const o=t,l=e.ref(),s=e.computed((()=>{const e=[];for(let t of l.value.sheet.rules)e.push(t.selectorText.substr(1));return e})),a=e.reactive({}),d=e=>isNaN(1*e)?!!n.colors[e]&&n.colors[e]:e,p=()=>{o.class&&o.class.split(" ").forEach((e=>{s.value.includes(e)||(s.value.push(e),a[e]=(e=>{let t=r[e];if(t)return t;const o=e.split("-"),n={l:"left",t:"top",r:"right",b:"bottom"};let[i,l,s,a]=o;if(t=r[i],t){let e=d(l);if(e)return`${t.pro}: ${e}${s||t.unit||""}`;if(e=d(s),e)return`${t.pro}-${n[l]||l}: ${e}${a||t.unit||""}`}})(e))}))};return e.onMounted((()=>{(()=>{let e=document.head.querySelector(`#${i}`);e||(e=document.createElement("style"),e.setAttribute("type","text/css"),e.setAttribute("id",i),document.head.appendChild(e)),l.value=e})(),p(),Object.keys(a).forEach((e=>{l.value.sheet.addRule(`.${e}`,a[e])}))})),(t,o)=>e.renderSlot(t.$slots,"default")}}),s=Object.freeze(Object.defineProperty({__proto__:null,default:l},Symbol.toStringTag,{value:"Module"})),a=e.defineComponent({__name:"b-view",props:{class:{},bgImg:{}},setup:t=>(t,o)=>(e.openBlock(),e.createBlock(l,{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"]))}),d=Object.freeze(Object.defineProperty({__proto__:null,default:a},Symbol.toStringTag,{value:"Module"})),p=e.defineComponent({__name:"b-text",props:{class:{}},setup:t=>(t,o)=>(e.openBlock(),e.createBlock(l,{class:e.normalizeClass(t.class)},{default:e.withCtx((()=>[e.createElementVNode("span",{class:e.normalizeClass(t.class)},[e.renderSlot(t.$slots,"default")],2)])),_:3},8,["class"]))}),u=Object.freeze(Object.defineProperty({__proto__:null,default:p},Symbol.toStringTag,{value:"Module"}));return o}));
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"}}},o={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}}},r="BTXUIGlobal",n=e.defineComponent({__name:"b-style",props:{class:{}},setup(n){const i=n,l=e.ref(),s=e.computed((()=>{const e=[];for(let t of l.value.sheet.rules)e.push(t.selectorText.substr(1));return e})),a=e.reactive({}),d=e=>isNaN(1*e)?!!o.colors[e]&&o.colors[e]:e,p=e=>{e&&e.split(" ").forEach((e=>{s.value.includes(e)||(s.value.push(e),a[e]=(e=>{let o=t[e];if(o)return o;const r=e.split("-"),n={l:"left",t:"top",r:"right",b:"bottom"};let[i,l,s,a]=r;if(o=t[i],o){let e=d(l);if(e)return`${o.pro}: ${e}${s||o.unit||""}`;if(e=d(s),e)return`${o.pro}-${n[l]||l}: ${e}${a||o.unit||""}`}})(e))}))};return e.onMounted((()=>{i.class&&((()=>{let e=document.head.querySelector(`#${r}`);e||(e=document.createElement("style"),e.setAttribute("type","text/css"),e.setAttribute("id",r),document.head.appendChild(e)),l.value=e})(),p(i.class),Object.keys(a).forEach((e=>{l.value.sheet.addRule(`.${e}`,a[e])})))})),(t,o)=>e.renderSlot(t.$slots,"default")}}),i=[n,e.defineComponent({__name:"b-view",props:{class:{},bgImg:{}},setup:t=>(t,o)=>(e.openBlock(),e.createBlock(n,{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"]))}),e.defineComponent({__name:"b-text",props:{class:{}},setup:t=>(t,o)=>(e.openBlock(),e.createBlock(n,{class:e.normalizeClass(t.class)},{default:e.withCtx((()=>[e.createElementVNode("span",{class:e.normalizeClass(t.class)},[e.renderSlot(t.$slots,"default")],2)])),_:3},8,["class"]))})];return{name:"btxui",install(e){i.forEach((t=>{e.component(t.__name,t)}))}}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btxui",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,27 +0,0 @@
1
- import { defineComponent, openBlock, createBlock, normalizeClass, withCtx, createElementVNode, renderSlot } from "vue";
2
- import { _ as _sfc_main$1 } from "./index.vue_vue_type_script_setup_true_lang-927c2ec4.js";
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "b-text",
5
- props: {
6
- class: {}
7
- },
8
- setup(__props) {
9
- return (_ctx, _cache) => {
10
- return openBlock(), createBlock(_sfc_main$1, {
11
- class: normalizeClass(_ctx.class)
12
- }, {
13
- default: withCtx(() => [
14
- createElementVNode("span", {
15
- class: normalizeClass(_ctx.class)
16
- }, [
17
- renderSlot(_ctx.$slots, "default")
18
- ], 2)
19
- ]),
20
- _: 3
21
- }, 8, ["class"]);
22
- };
23
- }
24
- });
25
- export {
26
- _sfc_main as default
27
- };
@@ -1,29 +0,0 @@
1
- import { defineComponent, openBlock, createBlock, normalizeClass, withCtx, createElementVNode, normalizeStyle, renderSlot } from "vue";
2
- import { _ as _sfc_main$1 } from "./index.vue_vue_type_script_setup_true_lang-927c2ec4.js";
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "b-view",
5
- props: {
6
- class: {},
7
- bgImg: {}
8
- },
9
- setup(__props) {
10
- return (_ctx, _cache) => {
11
- return openBlock(), createBlock(_sfc_main$1, {
12
- class: normalizeClass(_ctx.class)
13
- }, {
14
- default: withCtx(() => [
15
- createElementVNode("div", {
16
- class: normalizeClass(_ctx.class),
17
- style: normalizeStyle({ backgroundImage: `url(${_ctx.bgImg})` })
18
- }, [
19
- renderSlot(_ctx.$slots, "default")
20
- ], 6)
21
- ]),
22
- _: 3
23
- }, 8, ["class"]);
24
- };
25
- }
26
- });
27
- export {
28
- _sfc_main as default
29
- };
@@ -1,5 +0,0 @@
1
- import { _ as _sfc_main } from "./index.vue_vue_type_script_setup_true_lang-927c2ec4.js";
2
- import "vue";
3
- export {
4
- _sfc_main as default
5
- };
@@ -1,511 +0,0 @@
1
- import { defineComponent, ref, computed, reactive, onMounted, renderSlot } 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 = /* @__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
- export {
510
- _sfc_main as _
511
- };