@live-change/vue3-components 0.8.12 → 0.8.14

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/logic/locale.js +40 -19
  2. package/package.json +6 -6
package/logic/locale.js CHANGED
@@ -7,6 +7,8 @@ let localeRef = ref()
7
7
 
8
8
  export async function getOtherOwnerLocale(owner, context) {
9
9
  if(localeObservable) localeObservable.unbindProperty(localeRef, 'value')
10
+ context = context ?? getCurrentInstance().appContext
11
+ const api = useApi(context)
10
12
  if(typeof window === 'undefined') {
11
13
  const value = await api.get(api.views.localeSettings.localeSettings(owner))
12
14
  localeObservable = new ObservableValue(value)
@@ -64,31 +66,50 @@ export function captureLocale(context) {
64
66
  if(typeof navigator === 'undefined') return
65
67
  return (async () => {
66
68
  const localeSettings = await getLocale(context)
67
- console.log("LOCALE SETTINGS", localeSettings)
69
+ //console.log("LOCALE SETTINGS", JSON.stringify(localeSettings, null, ' '))
70
+
71
+ const capturedLanguage = navigator.language
72
+ const capturedDateTime = new Intl.DateTimeFormat().resolvedOptions()
73
+ const capturedList = new Intl.ListFormat().resolvedOptions()
74
+ const capturedNumber = new Intl.NumberFormat().resolvedOptions()
75
+ const capturedPlural = new Intl.PluralRules().resolvedOptions()
76
+ const capturedRelativeTime = new Intl.RelativeTimeFormat().resolvedOptions()
77
+
78
+ const capturedLocaleSettings = {
79
+ capturedLanguage,
80
+ capturedDateTime,
81
+ capturedList,
82
+ capturedNumber,
83
+ capturedPlural,
84
+ capturedRelativeTime
85
+ }
68
86
 
69
- const dateTimeOptions = new Intl.DateTimeFormat().resolvedOptions()
70
- const listOptions = new Intl.ListFormat().resolvedOptions()
71
- const numberOptions = new Intl.NumberFormat().resolvedOptions()
72
- const pluralOptions = new Intl.PluralRules().resolvedOptions()
73
- const relativeTimeOptions = new Intl.RelativeTimeFormat().resolvedOptions()
87
+ //console.log("CAPTURED LOCALE SETTINGS", JSON.stringify(capturedLocaleSettings, null, ' '))
74
88
 
89
+ /*console.log("language", localeSettings.capturedLanguage !== capturedLanguage)
90
+ console.log("dateTime", JSON.stringify(capturedDateTime) !== JSON.stringify(localeSettings.capturedDateTime))
91
+ console.log("list", JSON.stringify(capturedList) !== JSON.stringify(localeSettings.capturedList))
92
+ console.log("number", JSON.stringify(capturedNumber) !== JSON.stringify(localeSettings.capturedNumber))
93
+ console.log("plural", JSON.stringify(capturedPlural) !== JSON.stringify(localeSettings.capturedPlural))
94
+ console.log("relativeTime", JSON.stringify(capturedRelativeTime) !== JSON.stringify(localeSettings.capturedRelativeTime))
95
+ */
75
96
  if(!localeSettings
76
- || localeSettings.capturedLanguage !== navigator.language
77
- || JSON.stringify(localeSettings.capturedDateTime) !== JSON.stringify(dateTimeOptions)
78
- || JSON.stringify(localeSettings.capturedList) !== JSON.stringify(listOptions)
79
- || JSON.stringify(localeSettings.capturedNumber) !== JSON.stringify(numberOptions)
80
- || JSON.stringify(localeSettings.capturedPlural) !== JSON.stringify(pluralOptions)
81
- || JSON.stringify(localeSettings.capturedRelativeTime) !== JSON.stringify(relativeTimeOptions)
97
+ || localeSettings.capturedLanguage !== capturedLanguage
98
+ || JSON.stringify(localeSettings.capturedDateTime) !== JSON.stringify(capturedDateTime)
99
+ || JSON.stringify(localeSettings.capturedList) !== JSON.stringify(capturedList)
100
+ || JSON.stringify(localeSettings.capturedNumber) !== JSON.stringify(capturedNumber)
101
+ || JSON.stringify(localeSettings.capturedPlural) !== JSON.stringify(capturedPlural)
102
+ || JSON.stringify(localeSettings.capturedRelativeTime) !== JSON.stringify(capturedRelativeTime)
82
103
  ) {
83
104
  const update = {
84
- capturedLanguage: navigator.language,
85
- capturedDateTime: dateTimeOptions,
86
- capturedList: listOptions,
87
- capturedNumber: numberOptions,
88
- capturedPlural: pluralOptions,
89
- capturedRelativeTime: relativeTimeOptions
105
+ capturedLanguage,
106
+ capturedDateTime,
107
+ capturedList,
108
+ capturedNumber,
109
+ capturedPlural,
110
+ capturedRelativeTime
90
111
  }
91
- console.log("CAPTURED LOCALE SETTINGS", update)
112
+ console.log("UPDATE LOCALE SETTINGS", update)
92
113
  await updateLocale(update, context)
93
114
  }
94
115
  })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/vue3-components",
3
- "version": "0.8.12",
3
+ "version": "0.8.14",
4
4
  "description": "Live Change Framework - vue components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/live-change/live-change-framework-vue3.git"
11
+ "url": "git+https://github.com/live-change/live-change-stack.git"
12
12
  },
13
13
  "author": {
14
14
  "email": "m8@em8.pl",
@@ -17,14 +17,14 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "bugs": {
20
- "url": "https://github.com/live-change/live-change-framework-vue3/issues"
20
+ "url": "https://github.com/live-change/live-change-stack/issues"
21
21
  },
22
- "homepage": "https://github.com/live-change/live-change-framework-vue3",
22
+ "homepage": "https://github.com/live-change/live-change-stack",
23
23
  "dependencies": {
24
- "@live-change/vue3-ssr": "^0.8.12",
24
+ "@live-change/vue3-ssr": "^0.8.14",
25
25
  "debug": "^4.3.4",
26
26
  "mitt": "3.0.1",
27
27
  "vue": "^3.4.19"
28
28
  },
29
- "gitHead": "5c93162184742550bf6a5e7b37a5537c69f8a3c4"
29
+ "gitHead": "d81b573fb8891746ae1c67f4f68558123c9f85f7"
30
30
  }