@live-change/vue3-components 0.8.142 → 0.8.144

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.
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <a target="_blank" :href="href" @click="handleClick">
3
+ <slot />
4
+ </a>
5
+ </template>
6
+
7
+ <script setup>
8
+
9
+ import { computed, defineProps, defineEmits, toRefs, ref } from 'vue'
10
+
11
+ const props = defineProps({
12
+ href: {
13
+ type: String,
14
+ required: true
15
+ },
16
+ analytics: {
17
+ type: Object
18
+ }
19
+ })
20
+
21
+ const { href, analytics: analyticsEvent } = toRefs(props)
22
+
23
+ import { analytics } from "@live-change/vue3-components"
24
+
25
+ function handleClick() {
26
+ if(analyticsEvent.value) {
27
+ analytics.emit(analyticsEvent.value.event ?? 'externalLink', {
28
+ ...analyticsEvent.value,
29
+ event: undefined,
30
+ href: href.value
31
+ })
32
+ } else {
33
+ analytics.emit('externalLink', { href: href.value })
34
+ }
35
+ }
36
+
37
+ </script>
38
+
39
+ <style scoped>
40
+
41
+ </style>
package/logic/index.js CHANGED
@@ -2,8 +2,9 @@ import Loading from "./Loading.vue"
2
2
  import LoadingZone from "./LoadingZone.vue"
3
3
  import WorkingZone from "./WorkingZone.vue"
4
4
  import Observe from "./Observe.vue"
5
+ import ExternalLink from "./ExternalLink.vue"
5
6
 
6
- export { Loading, LoadingZone, WorkingZone, Observe }
7
+ export { Loading, LoadingZone, WorkingZone, Observe, ExternalLink }
7
8
 
8
9
  import { analytics, useAnalytics, installRouterAnalytics } from "./analytics.js"
9
10
  export { analytics, useAnalytics, installRouterAnalytics }
@@ -22,6 +23,7 @@ function registerLogicComponents(app) {
22
23
  app.component("loading-zone", LoadingZone)
23
24
  app.component("working-zone", WorkingZone)
24
25
  app.component("observe", Observe)
26
+ app.component("external-link", ExternalLink)
25
27
  }
26
28
 
27
29
  export { registerLogicComponents }
package/logic/locale.js CHANGED
@@ -149,7 +149,8 @@ export class Locale {
149
149
  }
150
150
 
151
151
  localTime(date) {
152
- return new Date(new Date(date).getTime() + this.timezoneOffset?.value)
152
+ if(typeof window !== 'undefined') return date // convert to local time only on server
153
+ return new Date(new Date(date).getTime() - this.timezoneOffset?.value * 60 * 1000)
153
154
  }
154
155
 
155
156
  }
@@ -168,7 +169,6 @@ function nonEmptyObject(obj) { /// because command form can add empty objects on
168
169
  return obj
169
170
  }
170
171
 
171
-
172
172
  export function useLocale(context) {
173
173
  context = context ?? getCurrentInstance().appContext
174
174
  if(!context.config.globalProperties.$locale) {
@@ -176,4 +176,3 @@ export function useLocale(context) {
176
176
  }
177
177
  return context = context.config.globalProperties.$locale
178
178
  }
179
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/vue3-components",
3
- "version": "0.8.142",
3
+ "version": "0.8.144",
4
4
  "description": "Live Change Framework - vue components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,10 +21,10 @@
21
21
  },
22
22
  "homepage": "https://github.com/live-change/live-change-stack",
23
23
  "dependencies": {
24
- "@live-change/vue3-ssr": "^0.8.142",
24
+ "@live-change/vue3-ssr": "^0.8.144",
25
25
  "debug": "^4.3.4",
26
26
  "mitt": "3.0.1",
27
27
  "vue": "^3.4.29"
28
28
  },
29
- "gitHead": "6c6de9015268e09f3517dc2dbb28e673ea19fe74"
29
+ "gitHead": "cea115baa7d457fa6e3865d025662b1e11b15aac"
30
30
  }