@wikala/spmkt 3.0.0-beta.0 → 3.0.0-beta.2

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 (43) hide show
  1. package/MIGRATION_GUIDE.md +50 -1
  2. package/api/request.js +3 -2
  3. package/components/Address/Edit.vue +8 -28
  4. package/components/Address/address.schema.js +4 -4
  5. package/components/Cart/CreditCard/Everyware.vue +2 -2
  6. package/components/Cart/CreditCard/ExtendedCreditCard.vue +2 -2
  7. package/components/Cart/CreditCard/StandardCreditCard.vue +2 -2
  8. package/components/Cart/Delivery/Delivery.vue +2 -2
  9. package/components/Cart/Delivery/ReservationSlots.vue +3 -3
  10. package/components/Cart/Payment/Payment.vue +2 -2
  11. package/components/Cart/ShoppingCart.vue +2 -2
  12. package/components/Cart/Store/getters.js +5 -3
  13. package/components/Cart/Store/mutations.js +10 -8
  14. package/components/Cart/Store/state.js +2 -2
  15. package/components/Cart/UserIdentity.vue +2 -2
  16. package/components/Category/CategoryFilter.vue +37 -34
  17. package/components/DobInput.vue +1 -1
  18. package/components/Gmaps/GmapsAutocomplete.vue +2 -2
  19. package/components/Gmaps/GmapsLocations.vue +2 -2
  20. package/components/MobileMenu/icons/LeftArrowIcon.vue +1 -1
  21. package/components/MobileMenu/icons/MenuIcon.vue +1 -1
  22. package/components/MobileMenu/icons/RightArrowIcon.vue +1 -1
  23. package/components/ModalContainer/ModalContainer.vue +8 -4
  24. package/components/ModalContainer/index.js +3 -2
  25. package/components/Product/AddToCart.vue +10 -7
  26. package/components/Product/Compare.vue +32 -10
  27. package/components/Product/CompareBox.vue +6 -4
  28. package/components/Product/Lookup.vue +2 -2
  29. package/components/Product/ProductAutocomplete.vue +2 -2
  30. package/components/Product/Variants.vue +17 -17
  31. package/components/Product/reviews-questions/ReviewImages.vue +4 -4
  32. package/components/QuantityInput.vue +2 -2
  33. package/install.js +17 -4
  34. package/package.json +8 -9
  35. package/utils/animate.css +50 -0
  36. package/utils/animate.js +1 -1
  37. package/utils/buefy.js +62 -0
  38. package/utils/filters.js +54 -3
  39. package/utils/format-date.js +17 -0
  40. package/utils/google/gmaps.js +2 -2
  41. package/utils/parse-url-filters.js +19 -0
  42. package/utils/random-id.js +10 -0
  43. package/components/Category/FilterMixin.js +0 -70
@@ -13,7 +13,11 @@
13
13
 
14
14
  <script>
15
15
  import { markRaw } from 'vue'
16
- import config from 'buefy/src/utils/config'
16
+ import { ConfigProgrammatic } from 'buefy'
17
+
18
+ // Buefy's own config, which installSpmkt's buefy options set. Read it on each use:
19
+ // setOptions() replaces the object rather than mutating it.
20
+ const config = () => ConfigProgrammatic.getOptions()
17
21
 
18
22
  export default {
19
23
  name: 'ModalContainer',
@@ -38,7 +42,7 @@ export default {
38
42
  canCancel: {
39
43
  type: [Array, Boolean],
40
44
  default: () => {
41
- return config.defaultModalCanCancel
45
+ return config().defaultModalCanCancel
42
46
  }
43
47
  },
44
48
  onCancel: {
@@ -48,7 +52,7 @@ export default {
48
52
  scroll: {
49
53
  type: String,
50
54
  default: () => {
51
- return config.defaultModalScroll ? config.defaultModalScroll : 'clip'
55
+ return config().defaultModalScroll ? config().defaultModalScroll : 'clip'
52
56
  },
53
57
  validator: (value) => {
54
58
  return ['clip', 'keep'].indexOf(value) >= 0
@@ -66,7 +70,7 @@ export default {
66
70
  },
67
71
  computed: {
68
72
  cancelOptions() {
69
- return typeof this.canCancel === 'boolean' ? (this.canCancel ? config.defaultModalCanCancel : []) : this.canCancel
73
+ return typeof this.canCancel === 'boolean' ? (this.canCancel ? config().defaultModalCanCancel : []) : this.canCancel
70
74
  },
71
75
  showX() {
72
76
  return this.cancelOptions.indexOf('x') >= 0
@@ -5,7 +5,8 @@
5
5
  */
6
6
  import { createApp, h, ref } from 'vue'
7
7
  import Modal from './ModalContainer.vue'
8
- import Buefy, { copyAppContext } from 'buefy'
8
+ import { copyAppContext } from 'buefy'
9
+ import { installBuefy } from '../../utils/buefy'
9
10
 
10
11
  const ModalContainer = {
11
12
  instance: null,
@@ -65,7 +66,7 @@ const ModalContainer = {
65
66
  copyAppContext(this.parentApp, app)
66
67
  } else {
67
68
  // Install Buefy in the modal app instance so components like b-autocomplete work
68
- app.use(Buefy)
69
+ installBuefy(app)
69
70
  }
70
71
 
71
72
  app.mount(container)
@@ -17,7 +17,10 @@
17
17
  <script setup>
18
18
  import { ref, computed, onMounted, onBeforeUnmount, nextTick, getCurrentInstance } from 'vue'
19
19
  import { useBuefy, useBus, useMq, useT } from '../../composables/globals'
20
- import _ from 'underscore'
20
+ import pluck from 'underscore/modules/pluck.js'
21
+ import findWhere from 'underscore/modules/findWhere.js'
22
+ import isEmpty from 'underscore/modules/isEmpty.js'
23
+ import contains from 'underscore/modules/contains.js'
21
24
  import animateCSS from '../../utils/animate'
22
25
  import GoogleAnalyticsEEC from '../../utils/google/google-analytics-eec.js'
23
26
  import { Cart } from '../../api'
@@ -77,11 +80,11 @@ const eecProduct = () => {
77
80
  if (selectedVariant.value) {
78
81
  eecProduct = {
79
82
  item_id: props.product.id, //selectedVariant.value.id
80
- item_name: props.product.name, //props.product.name + ' - ' + _.pluck(selectedVariant.value.options, 'value').join(', '),
83
+ item_name: props.product.name, //props.product.name + ' - ' + pluck(selectedVariant.value.options, 'value').join(', '),
81
84
  price: selectedVariant.value.price,
82
85
  item_brand: props.product.brand ? props.product.brand.name : '',
83
86
  item_category: props.product?.category?.path.startsWith('/') ? props.product?.category?.path.substr(1) : props.product?.category?.path,
84
- item_variant: _.pluck(selectedVariant.value.options, 'value').join(', '),
87
+ item_variant: pluck(selectedVariant.value.options, 'value').join(', '),
85
88
  quantity: parseInt(qty.value)
86
89
  }
87
90
  }
@@ -93,7 +96,7 @@ const productDetails = () => {
93
96
  let product = eecProduct()
94
97
  product.image_url = props.product.images && props.product.images[0] ? props.product.images[0].url : ''
95
98
  if (selectedVariant.value) {
96
- let variantImage = _.findWhere(props.product.images, { id: selectedVariant.value.default_image_id })
99
+ let variantImage = findWhere(props.product.images, { id: selectedVariant.value.default_image_id })
97
100
  product.image_url = variantImage?.url
98
101
  }
99
102
  return product
@@ -131,7 +134,7 @@ const updateCart = async () => {
131
134
  const variantSelected = () => {
132
135
  variantModalActive.value = false
133
136
  //console.log('variant ids ', variantIds.value, 'product ', product_id.value)
134
- if (!_.isEmpty(variantIds.value) && !_.contains(variantIds.value, product_id.value)) {
137
+ if (!isEmpty(variantIds.value) && !contains(variantIds.value, product_id.value)) {
135
138
  $bus.emit('noVariantSelected')
136
139
  if (mq.value === 'mobile' && variantModalActive.value) {
137
140
  animateCSS('.wkl-modal-container .variant-options', 'pulse')
@@ -203,7 +206,7 @@ const onSelectVariant = (variant_id) => {
203
206
  submitEnabled.value = false
204
207
  product_id.value = null
205
208
  } else {
206
- selectedVariant.value = _.findWhere(props.product.variants, {
209
+ selectedVariant.value = findWhere(props.product.variants, {
207
210
  id: parseInt(variant_id)
208
211
  })
209
212
  submitEnabled.value = true
@@ -267,7 +270,7 @@ onMounted(() => {
267
270
  if (!product_id.value && props.product.id) {
268
271
  product_id.value = props.product.id
269
272
  if (props.product.variants && props.product.variants.length > 0) {
270
- variantIds.value = _.pluck(props.product.variants, 'id')
273
+ variantIds.value = pluck(props.product.variants, 'id')
271
274
  }
272
275
  }
273
276
  cleanupScroll = handleScroll()
@@ -56,9 +56,8 @@
56
56
  </template>
57
57
 
58
58
  <script setup>
59
- import { ref, onMounted, getCurrentInstance } from 'vue'
59
+ import { ref, onMounted, onUnmounted, getCurrentInstance } from 'vue'
60
60
  import Lookup from './Lookup.vue'
61
- import scrollMonitor from 'scrollmonitor'
62
61
 
63
62
  defineOptions({ name: 'ComparePage' })
64
63
 
@@ -92,18 +91,33 @@ const stringFilter = (value) => {
92
91
  return value
93
92
  }
94
93
 
94
+ let onScroll = null
95
+
96
+ // Adds .scrolled to the product name headers while the first one is out of view. Its
97
+ // position is read once, since .scrolled makes the headers fixed, which moves them.
95
98
  const initScrollMonitor = () => {
96
99
  const elToWatch = document.querySelectorAll('.fixedContent')
100
+ if (!elToWatch.length) return
101
+
102
+ const rect = elToWatch[0].getBoundingClientRect()
103
+ const top = rect.top + window.scrollY
104
+ const bottom = rect.bottom + window.scrollY
105
+ const isInViewport = () => top < window.scrollY + window.innerHeight && bottom > window.scrollY
106
+ const setScrolled = (scrolled) => elToWatch.forEach((el) => el.classList.toggle('scrolled', scrolled))
97
107
 
98
- const watcher = scrollMonitor.create(elToWatch)
99
- watcher.lock()
108
+ let inViewport = isInViewport()
109
+ if (!inViewport && top < window.scrollY) {
110
+ setScrolled(true)
111
+ }
100
112
 
101
- watcher.exitViewport(function () {
102
- elToWatch.forEach((el) => el.classList.add('scrolled'))
103
- })
104
- watcher.enterViewport(function () {
105
- elToWatch.forEach((el) => el.classList.remove('scrolled'))
106
- })
113
+ onScroll = () => {
114
+ if (isInViewport() !== inViewport) {
115
+ inViewport = !inViewport
116
+ setScrolled(!inViewport)
117
+ }
118
+ }
119
+ window.addEventListener('scroll', onScroll, { passive: true })
120
+ window.addEventListener('resize', onScroll, { passive: true })
107
121
  }
108
122
 
109
123
  // Lifecycle hooks
@@ -125,4 +139,12 @@ onMounted(() => {
125
139
 
126
140
  window.addEventListener('load', initScrollMonitor, false)
127
141
  })
142
+
143
+ onUnmounted(() => {
144
+ window.removeEventListener('load', initScrollMonitor, false)
145
+ if (onScroll) {
146
+ window.removeEventListener('scroll', onScroll)
147
+ window.removeEventListener('resize', onScroll)
148
+ }
149
+ })
128
150
  </script>
@@ -22,7 +22,9 @@
22
22
  <script setup>
23
23
  import { ref, onMounted, onBeforeUnmount } from 'vue'
24
24
  import { useBuefy, useMq, useT } from '../../composables/globals'
25
- import _ from 'underscore'
25
+ import compact from 'underscore/modules/compact.js'
26
+ import reject from 'underscore/modules/reject.js'
27
+ import findWhere from 'underscore/modules/findWhere.js'
26
28
  import Cookie from 'js-cookie'
27
29
  import { eventBus } from '../../utils/event-bus'
28
30
 
@@ -58,7 +60,7 @@ const initCompareList = () => {
58
60
  console.log('Cannot parse compareList', Cookie.get('compareList'))
59
61
  }
60
62
  if (cCompareList) {
61
- products.value = _.compact(cCompareList)
63
+ products.value = compact(cCompareList)
62
64
  products.value.forEach((product) => {
63
65
  setCompareIconStatus(product.id, 'on')
64
66
  })
@@ -104,7 +106,7 @@ const compare = () => {
104
106
  }
105
107
 
106
108
  const removeProd = (id) => {
107
- setProducts(_.reject(products.value, (product) => product.id == id))
109
+ setProducts(reject(products.value, (product) => product.id == id))
108
110
  setCompareIconStatus(id, 'off')
109
111
  }
110
112
 
@@ -129,7 +131,7 @@ const hideCompareBox = () => {
129
131
  }
130
132
 
131
133
  const handleCompareProduct = (productData) => {
132
- if (_.findWhere(products.value, { id: productData.id })) {
134
+ if (findWhere(products.value, { id: productData.id })) {
133
135
  removeProd(productData.id)
134
136
  } else {
135
137
  if (products.value.length > 0 && productData.att_template_id !== attTemplateId.value) {
@@ -28,7 +28,7 @@
28
28
  <script setup>
29
29
  import { ref, onMounted, onBeforeUnmount } from 'vue'
30
30
  import { useBuefy, useBus } from '../../composables/globals'
31
- import _ from 'underscore'
31
+ import debounce from 'underscore/modules/debounce.js'
32
32
  import { request } from '../../api'
33
33
 
34
34
  defineOptions({ name: 'ProductLookup' })
@@ -63,7 +63,7 @@ const isFetching = ref(false)
63
63
  const selectedIds = ref([])
64
64
 
65
65
  // Methods
66
- const getAsyncData = _.debounce(function (query) {
66
+ const getAsyncData = debounce(function (query) {
67
67
  if (!query.length) {
68
68
  data.value = []
69
69
  return
@@ -39,7 +39,7 @@
39
39
  </template>
40
40
  <script setup>
41
41
  import { ref, inject, onMounted } from 'vue'
42
- import _ from 'underscore'
42
+ import debounce from 'underscore/modules/debounce.js'
43
43
  import liveAddEventListener from '../../utils/native-dom'
44
44
  import { Product } from '../../api'
45
45
 
@@ -65,7 +65,7 @@ const isFetching = ref(false)
65
65
  const enter = ref(true)
66
66
  const active = ref(0)
67
67
 
68
- const searchProducts = _.debounce((query_string) => {
68
+ const searchProducts = debounce((query_string) => {
69
69
  if (!query_string.length) {
70
70
  data.value = []
71
71
  return
@@ -36,8 +36,7 @@
36
36
  import { ref, reactive, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue'
37
37
  import { formatMoney } from '../../utils/filters'
38
38
  import { useBus } from '../../composables/globals'
39
- import _ from 'underscore'
40
- import formatDate from 'intl-dateformat'
39
+ import formatDate from '../../utils/format-date'
41
40
 
42
41
  const props = defineProps({
43
42
  product: {
@@ -97,7 +96,7 @@ watch(() => props.product, (val) => {
97
96
  // Methods
98
97
  function setOptionCombinations() {
99
98
  optionCombinations.value = []
100
- let allOptions = _.pluck(productVariants.value, 'options')
99
+ let allOptions = productVariants.value.map((pv) => pv.options)
101
100
  allOptions.forEach((options) => {
102
101
  let v = []
103
102
  options.forEach((o) => {
@@ -112,13 +111,15 @@ function setFittingUnselected() {
112
111
  fittingUnselected.value = []
113
112
  if (selectedEntries.value.length === 1) {
114
113
  let selectedKey = parseInt(Object.keys(selectedOptions)[0])
115
- let selectedKeyOptionValues = _.findWhere(productVariantOptions.value, { id: selectedKey }).values
116
- fitting = selectedKeyOptionValues.map((skov) => selectedKey + '-' + skov)
114
+ let selectedKeyOption = productVariantOptions.value.find((pvo) => pvo.id === selectedKey)
115
+ if (selectedKeyOption) {
116
+ fitting = selectedKeyOption.values.map((skov) => selectedKey + '-' + skov)
117
+ }
117
118
  }
118
119
  selectedEntries.value.forEach((so) => {
119
- fitting.push(_.filter(optionCombinations.value, (c) => c.includes(so)))
120
+ fitting.push(optionCombinations.value.filter((c) => c.includes(so)))
120
121
  })
121
- fittingUnselected.value = _.uniq(_.flatten(fitting))
122
+ fittingUnselected.value = [...new Set(fitting.flat(Infinity))]
122
123
  }
123
124
 
124
125
  function getMatchingVariant() {
@@ -126,13 +127,13 @@ function getMatchingVariant() {
126
127
  return false
127
128
  }
128
129
  let match = false
129
- _.each(productVariants.value, (pv) => {
130
+ productVariants.value.forEach((pv) => {
130
131
  let pvoptions = pv.options
131
132
  .map((pvo) => {
132
133
  return pvo.attribute_id + '-' + pvo.value
133
134
  })
134
135
  .sort()
135
- if (_.difference(selectedEntries.value, pvoptions).length === 0) {
136
+ if (selectedEntries.value.every((se) => pvoptions.includes(se))) {
136
137
  match = pv
137
138
  }
138
139
  })
@@ -149,7 +150,7 @@ function removeUnfitting(optionValue, optionId) {
149
150
  continue
150
151
  }
151
152
  let kv = selectedKey + '-' + selectedOptions[selectedKey]
152
- let fits = _.any(optionCombinations.value, (c) => {
153
+ let fits = optionCombinations.value.some((c) => {
153
154
  return c.includes(kv) && c.includes(akv)
154
155
  })
155
156
  if (fits === false) {
@@ -289,7 +290,7 @@ function getVariantByOption(optionId, optionValue) {
289
290
  return {}
290
291
  }
291
292
  let match = {}
292
- _.each(productVariants.value, (pv) => {
293
+ productVariants.value.forEach((pv) => {
293
294
  if(pv.in_stock && pv.options[0].attribute_id === optionId && pv.options[0].value === optionValue) {
294
295
  match = pv
295
296
  }
@@ -301,7 +302,7 @@ function getVariantFromProp() {
301
302
  if(!props.variantId) {
302
303
  return
303
304
  }
304
- let variant = _.findWhere(productVariants.value, { id: props.variantId })
305
+ let variant = productVariants.value.find((pv) => pv.id === props.variantId)
305
306
  if (!variant) {
306
307
  return
307
308
  }
@@ -316,7 +317,7 @@ function getVariantFromURL() {
316
317
  if (!variant_id) {
317
318
  return
318
319
  }
319
- let variant = _.findWhere(productVariants.value, { id: variant_id })
320
+ let variant = productVariants.value.find((pv) => pv.id === variant_id)
320
321
  if (!variant || !variant.in_stock) {
321
322
  return
322
323
  }
@@ -334,10 +335,9 @@ function preselect() {
334
335
  if(urlVariant) {
335
336
  setSelectedVariant(urlVariant)
336
337
  } else {
337
- let inStockVariants = _.sortBy(
338
- _.filter(productVariants.value, (item) => item.in_stock && item.price > 0),
339
- 'price'
340
- )
338
+ let inStockVariants = productVariants.value
339
+ .filter((item) => item.in_stock && item.price > 0)
340
+ .sort((a, b) => a.price - b.price)
341
341
 
342
342
  if (inStockVariants.length === 0) {
343
343
  return
@@ -72,7 +72,7 @@
72
72
  <script setup>
73
73
  import { ref, computed, onMounted, nextTick } from 'vue'
74
74
  import { useMq, useT } from '../../../composables/globals'
75
- import _ from 'underscore'
75
+ import findIndex from 'underscore/modules/findIndex.js'
76
76
  import { ProductReviews } from '../../../api'
77
77
  import { eventBus } from '../../../utils/event-bus'
78
78
  import Review from './Review.vue'
@@ -142,7 +142,7 @@ async function getImages() {
142
142
  function updateCumulativeData(reviews) {
143
143
  reviews.forEach((review) => {
144
144
  if (review.images.length) {
145
- let exists = _.findIndex(cumulativeData.value, { id: review.id })
145
+ let exists = findIndex(cumulativeData.value, { id: review.id })
146
146
  if (exists === -1) {
147
147
  cumulativeData.value.push(review)
148
148
  }
@@ -211,13 +211,13 @@ onMounted(async () => {
211
211
  return
212
212
  }
213
213
 
214
- collectionIndex.value = _.findIndex(cumulativeData.value, {
214
+ collectionIndex.value = findIndex(cumulativeData.value, {
215
215
  id: pl.review_id
216
216
  })
217
217
  if (collectionIndex.value === -1) {
218
218
  return false
219
219
  }
220
- reviewImageIndex.value = _.findIndex(cumulativeData.value[collectionIndex.value]['images'], { id: pl.image_id })
220
+ reviewImageIndex.value = findIndex(cumulativeData.value[collectionIndex.value]['images'], { id: pl.image_id })
221
221
 
222
222
  openModal(collectionIndex.value, reviewImageIndex.value)
223
223
  })
@@ -12,7 +12,7 @@
12
12
  </template>
13
13
 
14
14
  <script>
15
- import _ from 'underscore'
15
+ import range from 'underscore/modules/range.js'
16
16
 
17
17
  export default {
18
18
  name: 'QuantityInput',
@@ -58,7 +58,7 @@ export default {
58
58
 
59
59
  computed: {
60
60
  selectRange() {
61
- return _.range(this.selectMin, this.selectMax + 1)
61
+ return range(this.selectMin, this.selectMax + 1)
62
62
  }
63
63
  },
64
64
 
package/install.js CHANGED
@@ -41,17 +41,27 @@
41
41
  * See .storybook/preview.js for minimal stand-ins.
42
42
  */
43
43
 
44
- import Buefy from 'buefy'
45
-
44
+ import { installBuefy } from './utils/buefy'
46
45
  import { EventBusPlugin } from './utils/event-bus'
47
46
  import registerDirectives from './utils/directives'
48
47
  import registerFilters from './utils/filters'
49
48
  import ModalContainerPlugin from './components/ModalContainer'
49
+ // window.customEventBus and window.GoogleAnalyticsEEC, which host scripts may use on
50
+ // pages whose components don't import them
51
+ import './utils/custom-event-bus'
52
+ import './utils/google/google-analytics-eec'
53
+
54
+ // window._post / window._get for the host's inline scripts. request.js (and axios) loads
55
+ // on the first call, so pages whose components make no API calls don't bundle it.
56
+ const lazyRequest = (name) => (...args) => {
57
+ import('./api/request').then((request) => request[name](...args))
58
+ return true
59
+ }
50
60
 
51
61
  export const installSpmkt = {
52
62
  install(app, options = {}) {
53
- // Install Buefy 3 (Vue 3 compatible version)
54
- app.use(Buefy, options.buefy)
63
+ // Install the Buefy 3 components spmkt uses (see utils/buefy.js)
64
+ installBuefy(app, options.buefy)
55
65
 
56
66
  // Install event bus ($bus)
57
67
  app.use(EventBusPlugin)
@@ -65,6 +75,9 @@ export const installSpmkt = {
65
75
  // Register global filters as $filters
66
76
  registerFilters(app)
67
77
 
78
+ window._post = lazyRequest('_post')
79
+ window._get = lazyRequest('_get')
80
+
68
81
  // Store config in global properties if provided
69
82
  if (options.config) {
70
83
  app.config.globalProperties.$spmktConfig = options.config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "3.0.0-beta.0",
3
+ "version": "3.0.0-beta.2",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "type": "module",
@@ -10,6 +10,12 @@
10
10
  "build-storybook": "storybook build"
11
11
  },
12
12
  "main": "index.js",
13
+ "sideEffects": [
14
+ "*.css",
15
+ "*.scss",
16
+ "./utils/custom-event-bus.js",
17
+ "./utils/google/google-analytics-eec.js"
18
+ ],
13
19
  "files": [
14
20
  "index.js",
15
21
  "install.js",
@@ -25,18 +31,12 @@
25
31
  ],
26
32
  "dependencies": {
27
33
  "@googlemaps/js-api-loader": "^1.12.2",
28
- "animate.css": "^4.1.1",
29
34
  "axios": "^1.20.0",
30
- "bulma-divider": "^0.2.0",
31
35
  "currency.js": "^2.0.4",
32
36
  "embedo": "^1.14.0",
33
- "intl-dateformat": "^0.1.4",
34
37
  "js-cookie": "^3.0.1",
35
38
  "mitt": "^3.0.1",
36
- "scrollmonitor": "^1.2.4",
37
- "shortid": "^2.2.16",
38
- "underscore": "^1.13.1",
39
- "vue3-mq": "^3.1.3"
39
+ "underscore": "^1.13.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@storybook/addon-docs": "^10.1.11",
@@ -48,7 +48,6 @@
48
48
  "msw": "2.12.7",
49
49
  "prettier": "^2.3.1",
50
50
  "pretty-quick": "^3.1.0",
51
- "sass": "^1.39.0",
52
51
  "storybook": "^10.1.11",
53
52
  "vite": "^6.0.0",
54
53
  "vitest": "^4.1.11",
@@ -0,0 +1,50 @@
1
+ /*
2
+ * The two animate.css (https://animate.style/, MIT) animations animateCSS() is called
3
+ * with, under animate.css's class names. A host that uses others imports animate.css.
4
+ */
5
+ .animate__animated {
6
+ animation-duration: var(--animate-duration, 1s);
7
+ animation-fill-mode: both;
8
+ }
9
+
10
+ @keyframes pulse {
11
+ from {
12
+ transform: scale3d(1, 1, 1);
13
+ }
14
+
15
+ 50% {
16
+ transform: scale3d(1.05, 1.05, 1.05);
17
+ }
18
+
19
+ to {
20
+ transform: scale3d(1, 1, 1);
21
+ }
22
+ }
23
+
24
+ .animate__pulse {
25
+ animation-name: pulse;
26
+ animation-timing-function: ease-in-out;
27
+ }
28
+
29
+ @keyframes slideInUp {
30
+ from {
31
+ transform: translate3d(0, 100%, 0);
32
+ visibility: visible;
33
+ }
34
+
35
+ to {
36
+ transform: translate3d(0, 0, 0);
37
+ }
38
+ }
39
+
40
+ .animate__slideInUp {
41
+ animation-name: slideInUp;
42
+ }
43
+
44
+ @media print, (prefers-reduced-motion: reduce) {
45
+ .animate__animated {
46
+ animation-duration: 1ms !important;
47
+ transition-duration: 1ms !important;
48
+ animation-iteration-count: 1 !important;
49
+ }
50
+ }
package/utils/animate.js CHANGED
@@ -1,4 +1,4 @@
1
- import 'animate.css'
1
+ import './animate.css'
2
2
 
3
3
  function animateCSS(element, animationName, callback) {
4
4
 
package/utils/buefy.js ADDED
@@ -0,0 +1,62 @@
1
+ import {
2
+ ConfigProgrammatic,
3
+ Autocomplete,
4
+ Button,
5
+ Carousel,
6
+ Checkbox,
7
+ Dialog,
8
+ Field,
9
+ Icon,
10
+ Input,
11
+ Loading,
12
+ Modal,
13
+ Pagination,
14
+ Progress,
15
+ Radio,
16
+ Select,
17
+ Slider,
18
+ Snackbar,
19
+ Table,
20
+ Tabs,
21
+ Toast,
22
+ Upload
23
+ } from 'buefy'
24
+
25
+ /**
26
+ * The Buefy plugins spmkt's components use (<b-*> tags and $buefy.dialog/toast/
27
+ * loading/snackbar). Installing these instead of all of Buefy keeps the ~25 unused
28
+ * components (pickers, taginput, steps, ...) out of the host's bundle. A host whose
29
+ * own templates use another one installs it itself: app.use(Tooltip).
30
+ */
31
+ export const buefyPlugins = [
32
+ Autocomplete,
33
+ Button,
34
+ Carousel,
35
+ Checkbox,
36
+ Dialog,
37
+ Field,
38
+ Icon,
39
+ Input,
40
+ Loading,
41
+ Modal,
42
+ Pagination,
43
+ Progress,
44
+ Radio,
45
+ Select,
46
+ Slider,
47
+ Snackbar,
48
+ Table,
49
+ Tabs,
50
+ Toast,
51
+ Upload
52
+ ]
53
+
54
+ // What app.use(Buefy, options) does, for buefyPlugins only
55
+ export function installBuefy(app, options = {}) {
56
+ ConfigProgrammatic.setOptions(options)
57
+ buefyPlugins.forEach((plugin) => app.use(plugin))
58
+
59
+ const buefy = app.config.globalProperties.$buefy
60
+ buefy.config = ConfigProgrammatic
61
+ buefy.globalNoticeInterval = undefined
62
+ }