@mixd-id/web-scaffold 0.1.230406210 → 0.1.230406212

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406210",
4
+ "version": "0.1.230406212",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -130,19 +130,15 @@ export default{
130
130
 
131
131
  const index = this.index
132
132
  let left = 0
133
+ const gapPx = parseInt(window.getComputedStyle(this.$refs.inner).getPropertyValue('column-gap'))
133
134
  for(let curIndex = 0 ; curIndex < this.items.length ; curIndex++){
134
135
  const item = this.$refs.inner.children[curIndex]
135
136
  if(curIndex < index)
136
- left += item.clientWidth
137
+ left += (item.clientWidth + gapPx)
137
138
  }
138
139
 
139
- const gapPx = parseInt(window.getComputedStyle(this.$refs.inner).getPropertyValue('column-gap'))
140
- left += gapPx
141
-
142
140
  left *= -1
143
141
 
144
- console.log('left', left)
145
-
146
142
  if(!noAnimation){
147
143
  this.$el.firstElementChild.addEventListener('transitionend', function(){
148
144
  this.classList.remove('transition-carousel')
@@ -26,6 +26,7 @@
26
26
  <script>
27
27
 
28
28
  import {componentMixin} from "../mixin/component";
29
+ import {parseBoolean} from "../utils/helpers.mjs";
29
30
 
30
31
  const screens = {
31
32
  0: 'all',
@@ -44,6 +45,11 @@ export default{
44
45
 
45
46
  props:{
46
47
 
48
+ eager: {
49
+ type: [ Boolean, String ],
50
+ default: false
51
+ },
52
+
47
53
  editable:{
48
54
  type: [ Boolean, String ],
49
55
  default: false
@@ -93,12 +99,18 @@ export default{
93
99
  },
94
100
 
95
101
  mounted(){
96
- this.$observe.once(this.$el, () => {
102
+ this.$resize(this.onResize)
103
+
104
+ if(parseBoolean(this.eager)){
97
105
  this.isVisible = true
98
106
  this.loadSrc()
99
- })
100
-
101
- this.$resize(this.onResize)
107
+ }
108
+ else{
109
+ this.$observe.once(this.$el, () => {
110
+ this.isVisible = true
111
+ this.loadSrc()
112
+ })
113
+ }
102
114
  },
103
115
 
104
116
  unmounted() {
@@ -1205,7 +1205,23 @@ export default{
1205
1205
  'md:': '@media screen and (min-width: 640px)',
1206
1206
  }
1207
1207
 
1208
+ const fontFamilies = {
1209
+ '"Anton", sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Anton&display=swap');`,
1210
+ 'Dosis, sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Dosis:wght@400;700&display=swap');`,
1211
+ 'Lato, sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');`,
1212
+ 'Merriweather, sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&display=swap');`,
1213
+ 'Montserrat, sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');`,
1214
+ '"Noto Sans", sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;800&display=swap');`,
1215
+ 'Oswald, sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&display=swap');`,
1216
+ 'Poppins, sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');`,
1217
+ 'Raleway, sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap');`,
1218
+ '"Roboto", sans-serif': `@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');`,
1219
+ '"Roboto Slab", serif': `@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;800&display=swap');`,
1220
+ '"Work Sans", serif': `@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;700&display=swap');`,
1221
+ }
1222
+
1208
1223
  let text = ''
1224
+ const usedFonts = {}
1209
1225
  for(let mediaKey in styles.media){
1210
1226
  const css = styles.media[mediaKey]
1211
1227
 
@@ -1214,6 +1230,10 @@ export default{
1214
1230
  text += key + '{ '
1215
1231
  for(let selector in css[key]){
1216
1232
  text += selector + ':' + css[key][selector] + ';'
1233
+
1234
+ if(selector === 'font-family' && fontFamilies[css[key][selector]]){
1235
+ usedFonts[css[key][selector]] = fontFamilies[css[key][selector]]
1236
+ }
1217
1237
  }
1218
1238
  text += '}'
1219
1239
  }
@@ -1221,18 +1241,7 @@ export default{
1221
1241
  }
1222
1242
 
1223
1243
  return [
1224
- `@import url('https://fonts.googleapis.com/css2?family=Anton&display=swap');`,
1225
- `@import url('https://fonts.googleapis.com/css2?family=Dosis:wght@400;700&display=swap');`,
1226
- `@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');`,
1227
- `@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&display=swap');`,
1228
- `@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');`,
1229
- `@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;800&display=swap');`,
1230
- `@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&display=swap');`,
1231
- `@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');`,
1232
- `@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap');`,
1233
- `@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');`,
1234
- `@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;800&display=swap');`,
1235
- `@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;700&display=swap');`,
1244
+ ...Object.values(usedFonts),
1236
1245
  text
1237
1246
  ]
1238
1247
  .join("\n")