layers-design-system 2.1.0 → 2.2.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/main.js +62 -50
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "layers-design-system",
3
3
  "main": "src/main.js",
4
- "version": "2.1.0",
4
+ "version": "2.2.0",
5
5
  "scripts": {
6
6
  "start": "vue-cli-service serve ./src/main-docs.js",
7
7
  "build": "vue-cli-service build --target lib ./src/main.js",
package/src/main.js CHANGED
@@ -1,80 +1,92 @@
1
- import lang from 'element-ui/lib/locale/lang/pt-br'
2
- import locale from 'element-ui/lib/locale'
3
- import 'dayjs/locale/pt-br'
4
- import dayjs from 'dayjs'
5
- import localizedFormatPlugin from 'dayjs/plugin/localizedFormat';
1
+ import lang from "element-ui/lib/locale/lang/pt-br";
2
+ import locale from "element-ui/lib/locale";
3
+ import "dayjs/locale/pt-br";
4
+ import dayjs from "dayjs";
5
+ import localizedFormatPlugin from "dayjs/plugin/localizedFormat";
6
6
 
7
- import './style/main.scss'
8
- import Colors from './helpers/Colors'
9
- import Icons from './helpers/Icons'
10
- import Schemas from './helpers/Schemas'
11
- import Notification from './helpers/Notification'
12
- import FieldTypeComponents from './helpers/FieldTypeComponents'
13
- import RegisterElementUIComponents from './helpers/RegisterElementUIComponents'
7
+ import "./style/main.scss";
8
+ import Colors from "./helpers/Colors";
9
+ import Icons from "./helpers/Icons";
10
+ import Schemas from "./helpers/Schemas";
11
+ import Notification from "./helpers/Notification";
12
+ import FieldTypeComponents from "./helpers/FieldTypeComponents";
13
+ import RegisterElementUIComponents from "./helpers/RegisterElementUIComponents";
14
14
 
15
15
  // Vant
16
- import Vant from 'vant'
17
- import 'vant/lib/index.css'
16
+ import Vant from "vant";
17
+ import "vant/lib/index.css";
18
18
  // Zoomer
19
- import VueZoomer from 'vue-zoomer'
19
+ import VueZoomer from "vue-zoomer";
20
20
 
21
- const LayersDesignSystem = {}
22
- LayersDesignSystem.install = function(Vue) {
23
- Vue.prototype.$L = {}
21
+ const LayersDesignSystem = {};
22
+ LayersDesignSystem.install = function (Vue) {
23
+ Vue.prototype.$L = {};
24
24
 
25
- Vue.use(Vant)
26
- Vue.use(VueZoomer)
27
- Vue.use(Colors)
28
- Vue.use(Icons)
29
- Vue.use(Schemas)
30
- Vue.use(FieldTypeComponents)
31
- Vue.use(RegisterElementUIComponents)
25
+ Vue.use(Vant);
26
+ Vue.use(VueZoomer);
27
+ Vue.use(Colors);
28
+ Vue.use(Icons);
29
+ Vue.use(Schemas);
30
+ Vue.use(FieldTypeComponents);
31
+ Vue.use(RegisterElementUIComponents);
32
32
 
33
- locale.use(lang)
34
- dayjs.extend(localizedFormatPlugin)
33
+ locale.use(lang);
34
+ dayjs.extend(localizedFormatPlugin);
35
35
 
36
36
  Vue.mixin({
37
37
  mounted() {
38
- this.__layers_addClassName()
38
+ this.__layers_addClassName();
39
39
  },
40
40
  updated() {
41
- this.__layers_addClassName()
41
+ this.__layers_addClassName();
42
42
  },
43
43
  methods: {
44
44
  __layers_addClassName() {
45
45
  if (!this.__layers_addedClassName) {
46
- const tagName = this.$options.tagName || ''
46
+ const tagName = this.$options.tagName || "";
47
47
  if (/^l-/.test(tagName) && this.$el.classList) {
48
- this.$el.classList.add(tagName)
48
+ this.$el.classList.add(tagName);
49
49
  }
50
- // this.__layers_addedClassName = true
51
50
  }
52
51
  },
53
52
  },
54
- })
53
+ });
55
54
 
56
- Vue.prototype.$notify = function(params) {
57
- const isClickable = params.onClick && params.onClick instanceof Function
55
+ Vue.prototype.$notify = function (params) {
56
+ const isClickable = params.onClick && params.onClick instanceof Function;
58
57
  const customClasses = [
59
58
  params.customClass,
60
59
  params.type,
61
- !params.customClass && !params.type && 'default',
62
- isClickable && 'cursor-pointer',
63
- ]
60
+ !params.customClass && !params.type && "default",
61
+ isClickable && "cursor-pointer",
62
+ ];
64
63
 
65
64
  return Notification({
66
65
  ...params,
67
- customClass: customClasses.filter((customClass) => customClass).join(' '),
68
- })
69
- }
66
+ customClass: customClasses.filter((customClass) => customClass).join(" "),
67
+ });
68
+ };
70
69
 
71
- const requireComponent = require.context('./components', true, /index.vue$/)
72
- requireComponent.keys().forEach((path) => {
73
- const component = requireComponent(path).default
74
- if (!component.tagName) throw new Error(`Missing tagName for ${path}`)
75
- Vue.component(component.tagName, component)
76
- })
77
- }
70
+ if (typeof require !== "undefined") {
71
+ const requireComponent = require.context(
72
+ "./components",
73
+ true,
74
+ /index.vue$/
75
+ );
76
+ requireComponent.keys().forEach((path) => {
77
+ const component = requireComponent(path).default;
78
+ if (!component.tagName) throw new Error(`Missing tagName for ${path}`);
79
+ Vue.component(component.tagName, component);
80
+ });
81
+ } else {
82
+ const components = import.meta.glob("./components/**/index.vue", {
83
+ eager: true,
84
+ });
85
+ for (const componentModule of Object.values(components)) {
86
+ Vue.component(componentModule.default.tagName, componentModule.default);
87
+ }
88
+ }
89
+ };
78
90
 
79
- export { Notification }
80
- export default LayersDesignSystem
91
+ export { Notification };
92
+ export default LayersDesignSystem;