@varlet/ui 2.2.1 → 2.3.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 (109) hide show
  1. package/es/action-sheet/ActionSheet.js +1 -1
  2. package/es/app-bar/AppBar.js +1 -1
  3. package/es/badge/Badge.js +5 -3
  4. package/es/button/Button.js +1 -1
  5. package/es/button/button.css +1 -1
  6. package/es/button/props.js +1 -2
  7. package/es/card/Card.js +3 -3
  8. package/es/cell/Cell.js +0 -1
  9. package/es/chip/Chip.js +6 -4
  10. package/es/chip/chip.css +1 -1
  11. package/es/col/Col.js +1 -1
  12. package/es/counter/Counter.js +2 -2
  13. package/es/date-picker/DatePicker.js +1 -1
  14. package/es/dialog/Dialog.js +1 -1
  15. package/es/divider/Divider.js +1 -1
  16. package/es/image/Image.js +1 -1
  17. package/es/image-preview/ImagePreview.js +3 -3
  18. package/es/index-anchor/IndexAnchor.js +1 -1
  19. package/es/index.js +5 -0
  20. package/es/input/Input.js +2 -2
  21. package/es/link/Link.js +102 -0
  22. package/es/link/LinkSfc.css +0 -0
  23. package/es/link/index.js +8 -0
  24. package/es/link/link.css +1 -0
  25. package/es/link/props.js +50 -0
  26. package/es/link/style/index.js +3 -0
  27. package/es/list/List.js +1 -1
  28. package/es/loading/Loading.js +1 -1
  29. package/es/menu/Menu.js +1 -1
  30. package/es/option/Option.js +2 -2
  31. package/es/pagination/Pagination.js +3 -3
  32. package/es/picker/Picker.js +1 -1
  33. package/es/popup/Popup.js +4 -4
  34. package/es/pull-refresh/PullRefresh.js +1 -1
  35. package/es/row/Row.js +1 -1
  36. package/es/select/Select.js +3 -3
  37. package/es/skeleton/Skeleton.js +1 -1
  38. package/es/slider/Slider.js +1 -1
  39. package/es/snackbar/core.js +1 -1
  40. package/es/snackbar/style/index.js +1 -1
  41. package/es/space/Space.js +2 -4
  42. package/es/style.css +1 -1
  43. package/es/style.js +1 -0
  44. package/es/switch/Switch.js +1 -1
  45. package/es/tab/Tab.js +2 -2
  46. package/es/table/Table.js +1 -1
  47. package/es/tabs/Tabs.js +2 -2
  48. package/es/time-picker/TimePicker.js +1 -1
  49. package/es/umdIndex.js +5 -0
  50. package/es/uploader/Uploader.js +3 -3
  51. package/es/utils/components.js +9 -3
  52. package/es/varlet.esm.js +3772 -3650
  53. package/highlight/attributes.json +38 -2
  54. package/highlight/tags.json +13 -0
  55. package/highlight/web-types.json +101 -3
  56. package/lib/action-sheet/ActionSheet.js +1 -1
  57. package/lib/app-bar/AppBar.js +1 -1
  58. package/lib/badge/Badge.js +5 -3
  59. package/lib/button/Button.js +1 -1
  60. package/lib/button/button.css +1 -1
  61. package/lib/button/props.js +1 -2
  62. package/lib/card/Card.js +3 -3
  63. package/lib/cell/Cell.js +0 -1
  64. package/lib/chip/Chip.js +6 -4
  65. package/lib/chip/chip.css +1 -1
  66. package/lib/col/Col.js +1 -1
  67. package/lib/counter/Counter.js +2 -2
  68. package/lib/date-picker/DatePicker.js +1 -1
  69. package/lib/dialog/Dialog.js +1 -1
  70. package/lib/divider/Divider.js +1 -1
  71. package/lib/image/Image.js +1 -1
  72. package/lib/image-preview/ImagePreview.js +3 -3
  73. package/lib/index-anchor/IndexAnchor.js +1 -1
  74. package/lib/index.js +3 -0
  75. package/lib/input/Input.js +2 -2
  76. package/lib/link/Link.js +115 -0
  77. package/lib/link/LinkSfc.css +0 -0
  78. package/lib/link/index.js +17 -0
  79. package/lib/link/link.css +1 -0
  80. package/lib/link/props.js +56 -0
  81. package/lib/link/style/index.js +3 -0
  82. package/lib/list/List.js +1 -1
  83. package/lib/loading/Loading.js +1 -1
  84. package/lib/menu/Menu.js +1 -1
  85. package/lib/option/Option.js +2 -2
  86. package/lib/pagination/Pagination.js +3 -3
  87. package/lib/picker/Picker.js +1 -1
  88. package/lib/popup/Popup.js +4 -4
  89. package/lib/pull-refresh/PullRefresh.js +1 -1
  90. package/lib/row/Row.js +1 -1
  91. package/lib/select/Select.js +3 -3
  92. package/lib/skeleton/Skeleton.js +1 -1
  93. package/lib/slider/Slider.js +1 -1
  94. package/lib/snackbar/core.js +1 -1
  95. package/lib/snackbar/style/index.js +1 -1
  96. package/lib/space/Space.js +2 -4
  97. package/lib/style.css +1 -1
  98. package/lib/style.js +1 -0
  99. package/lib/switch/Switch.js +1 -1
  100. package/lib/tab/Tab.js +2 -2
  101. package/lib/table/Table.js +1 -1
  102. package/lib/tabs/Tabs.js +2 -2
  103. package/lib/time-picker/TimePicker.js +1 -1
  104. package/lib/uploader/Uploader.js +3 -3
  105. package/lib/utils/components.js +9 -3
  106. package/package.json +7 -7
  107. package/types/index.d.ts +2 -0
  108. package/types/link.d.ts +30 -0
  109. package/umd/varlet.js +7 -7
package/lib/style.js CHANGED
@@ -28,6 +28,7 @@ require('./index-anchor/style')
28
28
  require('./index-bar/style')
29
29
  require('./input/style')
30
30
  require('./lazy/style')
31
+ require('./link/style')
31
32
  require('./list/style')
32
33
  require('./loading/style')
33
34
  require('./locale/style')
@@ -52,7 +52,7 @@ function render(_ctx, _cache) {
52
52
  style: (0, _vue.normalizeStyle)(_ctx.styleComputed.ripple)
53
53
  }, [(0, _vue.createElementVNode)("div", {
54
54
  style: (0, _vue.normalizeStyle)(_ctx.styleComputed.handle),
55
- class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('handle'), 'var-elevation--2', [_ctx.modelValue === _ctx.activeValue, _ctx.n('handle--active')], [_ctx.errorMessage, _ctx.n('handle--error')]))
55
+ class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('handle'), _ctx.n('$-elevation--2'), [_ctx.modelValue === _ctx.activeValue, _ctx.n('handle--active')], [_ctx.errorMessage, _ctx.n('handle--error')]))
56
56
  }, [_ctx.loading ? ((0, _vue.openBlock)(), (0, _vue.createBlock)(_component_var_loading, {
57
57
  key: 0,
58
58
  radius: _ctx.radius,
package/lib/tab/Tab.js CHANGED
@@ -25,7 +25,7 @@ function render(_ctx, _cache) {
25
25
  var _directive_ripple = (0, _vue.resolveDirective)("ripple");
26
26
 
27
27
  return (0, _vue.withDirectives)(((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
28
- class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), 'var--box', _ctx.computeColorClass(), _ctx.n("--" + _ctx.itemDirection))),
28
+ class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), _ctx.n('$--box'), _ctx.computeColorClass(), _ctx.n("--" + _ctx.itemDirection))),
29
29
  ref: "tabEl",
30
30
  style: (0, _vue.normalizeStyle)({
31
31
  color: _ctx.computeColorStyle()
@@ -88,7 +88,7 @@ var _default = (0, _vue.defineComponent)({
88
88
  disabled,
89
89
  name
90
90
  } = props;
91
- return disabled ? 'var-tab--disabled' : active.value === name || active.value === (index == null ? void 0 : index.value) ? 'var-tab--active' : 'var-tab--inactive';
91
+ return disabled ? n('$-tab--disabled') : active.value === name || active.value === (index == null ? void 0 : index.value) ? n('$-tab--active') : n('$-tab--inactive');
92
92
  };
93
93
 
94
94
  var handleClick = event => {
@@ -17,7 +17,7 @@ var {
17
17
 
18
18
  function render(_ctx, _cache) {
19
19
  return (0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
20
- class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), 'var-elevation--1 var--box'))
20
+ class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), _ctx.n('$-elevation--1'), _ctx.n('$--box')))
21
21
  }, [(0, _vue.createElementVNode)("div", {
22
22
  class: (0, _vue.normalizeClass)(_ctx.n('main'))
23
23
  }, [(0, _vue.createElementVNode)("table", {
package/lib/tabs/Tabs.js CHANGED
@@ -32,11 +32,11 @@ var {
32
32
  } = (0, _components.createNamespace)('tabs');
33
33
 
34
34
  function render(_ctx, _cache) {
35
- return (0, _vue.openBlock)(), (0, _vue.createBlock)((0, _vue.resolveDynamicComponent)(_ctx.sticky ? 'var-sticky' : _ctx.Transition), {
35
+ return (0, _vue.openBlock)(), (0, _vue.createBlock)((0, _vue.resolveDynamicComponent)(_ctx.sticky ? _ctx.n('$-sticky') : _ctx.Transition), {
36
36
  "offset-top": _ctx.sticky ? _ctx.offsetTop : null
37
37
  }, {
38
38
  default: (0, _vue.withCtx)(() => [(0, _vue.createElementVNode)("div", (0, _vue.mergeProps)({
39
- class: _ctx.classes(_ctx.n(), 'var--box', _ctx.n("--item-" + _ctx.itemDirection), _ctx.n("--layout-" + _ctx.layoutDirection + "-padding"), [_ctx.elevation, 'var-elevation--4'], [_ctx.fixedBottom, _ctx.n('--fixed-bottom')], [_ctx.safeArea, _ctx.n('--safe-area')]),
39
+ class: _ctx.classes(_ctx.n(), _ctx.n('$--box'), _ctx.n("--item-" + _ctx.itemDirection), _ctx.n("--layout-" + _ctx.layoutDirection + "-padding"), [_ctx.elevation, _ctx.n('$-elevation--4')], [_ctx.fixedBottom, _ctx.n('--fixed-bottom')], [_ctx.safeArea, _ctx.n('--safe-area')]),
40
40
  style: {
41
41
  background: _ctx.color
42
42
  }
@@ -41,7 +41,7 @@ function render(_ctx, _cache) {
41
41
  var _component_clock = (0, _vue.resolveComponent)("clock");
42
42
 
43
43
  return (0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
44
- class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), [_ctx.elevation, 'var-elevation--2'])),
44
+ class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), [_ctx.elevation, _ctx.n('$-elevation--2')])),
45
45
  ref: "picker"
46
46
  }, [(0, _vue.createElementVNode)("div", {
47
47
  class: (0, _vue.normalizeClass)(_ctx.n('title')),
@@ -56,12 +56,12 @@ function render(_ctx, _cache) {
56
56
  var _directive_ripple = (0, _vue.resolveDirective)("ripple");
57
57
 
58
58
  return (0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
59
- class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), 'var--box'))
59
+ class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), _ctx.n('$--box')))
60
60
  }, [(0, _vue.createElementVNode)("div", {
61
61
  class: (0, _vue.normalizeClass)(_ctx.n('file-list'))
62
62
  }, [((0, _vue.openBlock)(true), (0, _vue.createElementBlock)(_vue.Fragment, null, (0, _vue.renderList)(_ctx.files, f => {
63
63
  return (0, _vue.withDirectives)(((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
64
- class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('file'), 'var-elevation--2', [f.state === 'loading', _ctx.n('--loading')])),
64
+ class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('file'), _ctx.n('$-elevation--2'), [f.state === 'loading', _ctx.n('--loading')])),
65
65
  key: f.id,
66
66
  onClick: $event => _ctx.preview(f)
67
67
  }, [(0, _vue.createElementVNode)("div", {
@@ -103,7 +103,7 @@ function render(_ctx, _cache) {
103
103
  /* KEYED_FRAGMENT */
104
104
  )), !_ctx.maxlength || _ctx.modelValue.length < _ctx.maxlength ? (0, _vue.withDirectives)(((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
105
105
  key: 0,
106
- class: (0, _vue.normalizeClass)(_ctx.classes([!_ctx.$slots.default, _ctx.n('action') + " var-elevation--2"], [_ctx.disabled || _ctx.formDisabled, _ctx.n('--disabled')])),
106
+ class: (0, _vue.normalizeClass)(_ctx.classes([!_ctx.$slots.default, _ctx.n('action') + " " + _ctx.n('$-elevation--2')], [_ctx.disabled || _ctx.formDisabled, _ctx.n('--disabled')])),
107
107
  onClick: _cache[1] || (_cache[1] = function () {
108
108
  return _ctx.triggerAction && _ctx.triggerAction(...arguments);
109
109
  })
@@ -295,11 +295,17 @@ function exposeApis(apis) {
295
295
  }
296
296
 
297
297
  function createNamespace(name) {
298
- var namespace = "var-" + name;
298
+ var namespace = "var";
299
+ var componentName = namespace + "-" + name;
299
300
 
300
301
  var createBEM = suffix => {
301
- if (!suffix) return namespace;
302
- return suffix.startsWith('--') ? "" + namespace + suffix : namespace + "__" + suffix;
302
+ if (!suffix) return componentName;
303
+
304
+ if (suffix[0] === '$') {
305
+ return suffix.replace('$', namespace);
306
+ }
307
+
308
+ return suffix.startsWith('--') ? "" + componentName + suffix : componentName + "__" + suffix;
303
309
  };
304
310
 
305
311
  var classes = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "A material like components library",
5
5
  "module": "es/index.js",
6
6
  "main": "lib/index.js",
@@ -46,17 +46,15 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@popperjs/core": "^2.11.6",
49
- "@varlet/icons": "2.2.1",
50
- "@varlet/shared": "2.2.1",
51
49
  "dayjs": "^1.10.4",
52
- "decimal.js": "^10.2.1"
50
+ "decimal.js": "^10.2.1",
51
+ "@varlet/icons": "2.3.0",
52
+ "@varlet/shared": "2.3.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/jest": "^26.0.15",
56
56
  "@types/lodash-es": "^4.17.6",
57
57
  "@types/node": "^18.7.18",
58
- "@varlet/cli": "2.2.1",
59
- "@varlet/touch-emulator": "2.2.1",
60
58
  "@vue/runtime-core": "3.2.25",
61
59
  "@vue/test-utils": "^2.0.2",
62
60
  "clipboard": "^2.0.6",
@@ -65,7 +63,9 @@
65
63
  "postcss-px-to-viewport": "^1.1.1",
66
64
  "typescript": "^4.4.4",
67
65
  "vue": "3.2.25",
68
- "vue-router": "4.0.12"
66
+ "vue-router": "4.0.12",
67
+ "@varlet/cli": "2.3.0",
68
+ "@varlet/touch-emulator": "2.3.0"
69
69
  },
70
70
  "browserslist": [
71
71
  "Chrome >= 54",
package/types/index.d.ts CHANGED
@@ -31,6 +31,7 @@ export * from './indexAnchor'
31
31
  export * from './indexBar'
32
32
  export * from './input'
33
33
  export * from './lazy'
34
+ export * from './link'
34
35
  export * from './list'
35
36
  export * from './loading'
36
37
  export * from './locale'
@@ -100,6 +101,7 @@ declare module 'vue' {
100
101
  VarIndexBar: typeof import('@varlet/ui')['_IndexBarComponent']
101
102
  VarInput: typeof import('@varlet/ui')['_InputComponent']
102
103
  VarLazy: typeof import('@varlet/ui')['_LazyComponent']
104
+ VarLink: typeof import('@varlet/ui')['_LinkComponent']
103
105
  VarList: typeof import('@varlet/ui')['_ListComponent']
104
106
  VarLoading: typeof import('@varlet/ui')['_LoadingComponent']
105
107
  VarLocale: typeof import('@varlet/ui')['_LocaleComponent']
@@ -0,0 +1,30 @@
1
+ import { VarComponent, BasicAttributes, Type as LinkType } from './varComponent'
2
+ import { VNode } from 'vue'
3
+ import type { RouteLocationRaw } from 'vue-router'
4
+
5
+ export type LinkUnderline = 'always' | 'hover' | 'none'
6
+
7
+ export { LinkType }
8
+
9
+ export interface LinkProps extends BasicAttributes {
10
+ type?: LinkType
11
+ href?: string
12
+ target?: string
13
+ to?: RouteLocationRaw
14
+ replace?: boolean
15
+ underline?: LinkUnderline
16
+ disabled?: boolean
17
+ textColor?: string
18
+ textSize?: string | number
19
+ onClick?: (e: Event) => void
20
+ }
21
+
22
+ export class Link extends VarComponent {
23
+ $props: LinkProps
24
+
25
+ $slots: {
26
+ default(): VNode[]
27
+ }
28
+ }
29
+
30
+ export class _LinkComponent extends Link {}