Comparing version 1.1.5 to 1.1.6
@@ -151,3 +151,5 @@ import { useSSRContext as C } from "vue"; | ||
if (n) | ||
throw new Error("Forbidden to call API in SSR mode, which will cause performance and other issues. Please use SSRContext mode to load data"); | ||
throw new Error( | ||
"Forbidden to call API in SSR mode, which will cause performance and other issues. Please use SSRContext mode to load data" | ||
); | ||
const a = await I(e, t, {}); | ||
@@ -245,5 +247,9 @@ if (a.error) | ||
const r = document.getElementsByTagName("head")[0], a = document.createElement("script"); | ||
a.src = i, a.type = "text/javascript", a.addEventListener ? a.addEventListener("load", function() { | ||
t(); | ||
}, !1) : a.attachEvent && a.attachEvent("onreadystatechange", function() { | ||
a.src = i, a.type = "text/javascript", a.addEventListener ? a.addEventListener( | ||
"load", | ||
function() { | ||
t(); | ||
}, | ||
!1 | ||
) : a.attachEvent && a.attachEvent("onreadystatechange", function() { | ||
window.event.srcElement.readyState === "loaded" && t(); | ||
@@ -250,0 +256,0 @@ }), r.appendChild(a); |
21
index.js
import store from './src/store/index.js' | ||
import { | ||
load, | ||
qrcode, | ||
table, | ||
copy, | ||
time, | ||
upload, | ||
personalization | ||
} from './libs/index.js' | ||
import { load, qrcode, table, copy, time, upload, personalization } from './libs/index.js' | ||
export { | ||
store, | ||
load, | ||
qrcode, | ||
table, | ||
copy, | ||
time, | ||
upload, | ||
personalization | ||
} | ||
export { store, load, qrcode, table, copy, time, upload, personalization } | ||
export default { | ||
@@ -23,0 +6,0 @@ store, |
{ | ||
"name": "@sumor/ux", | ||
"description": "Sumor Cloud UI Library", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"license": "MIT", | ||
"repository": "sumor-cloud/ux", | ||
"author": "Sumor Cloud Ltd", | ||
"homepage": "https://sumor.cloud", | ||
"homepage": "https://sumor.cloud/ux", | ||
"type": "module", | ||
@@ -32,11 +32,14 @@ "main": "./dist/index.umd.cjs", | ||
"@vitejs/plugin-vue": "^5.0.4", | ||
"fs-extra": "^11.2.0", | ||
"jsdom": "^24.0.0", | ||
"puppeteer": "^22.8.0", | ||
"vite": "^5.2.0", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-config-standard": "^17.1.0", | ||
"fs-extra": "^11.2.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"husky": "^9.0.11", | ||
"jest": "^29.7.0", | ||
"jest-html-reporter": "^3.10.2", | ||
"jsdom": "^24.0.0", | ||
"puppeteer": "^22.8.0", | ||
"vite": "^5.2.0" | ||
"prettier": "^3.2.5" | ||
}, | ||
@@ -55,2 +58,3 @@ "files": [ | ||
"lint": "eslint .", | ||
"autofix": "eslint --fix . && prettier --write . && npm audit fix --force", | ||
"build": "vite build", | ||
@@ -60,3 +64,3 @@ "setup-browser": "npx puppeteer browsers install chrome", | ||
"coverage": "npm run setup-browser && node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --testMatch='**/test/**/*.test.js'", | ||
"push-tag": "git push --tags && git push", | ||
"push-tag": "git push && git push --tags", | ||
"publish-beta": "npm version prerelease --preid beta && npm run push-tag", | ||
@@ -67,4 +71,4 @@ "publish-release-patch": "npm version patch && npm run push-tag", | ||
"prepare": "husky", | ||
"check": "eslint --fix . && npm audit fix --force && npm run coverage" | ||
"check": "eslint --fix . && prettier --write . && npm audit fix --force && npm run coverage" | ||
} | ||
} |
@@ -6,6 +6,6 @@ import { defineStore } from 'pinia' | ||
getters: { | ||
double: (state) => state.n * 2 | ||
double: state => state.n * 2 | ||
}, | ||
actions: { | ||
increment (amount = 1) { | ||
increment(amount = 1) { | ||
this.n += amount | ||
@@ -16,4 +16,2 @@ } | ||
export { | ||
useCounter | ||
} | ||
export { useCounter } |
@@ -8,3 +8,5 @@ import axios from 'axios' | ||
for (const i in params) { | ||
if (params[i] instanceof File) { multipart = true } | ||
if (params[i] instanceof File) { | ||
multipart = true | ||
} | ||
} | ||
@@ -11,0 +13,0 @@ let requestData |
@@ -6,3 +6,3 @@ import { useSSRContext } from 'vue' | ||
export default (options) => { | ||
export default options => { | ||
options = options || {} | ||
@@ -51,3 +51,3 @@ const SSR = options.SSR || false | ||
getters: { | ||
dark (state) { | ||
dark(state) { | ||
if (state.personalization.dark !== null) { | ||
@@ -59,3 +59,3 @@ return state.personalization.dark | ||
}, | ||
language (state) { | ||
language(state) { | ||
if (state.personalization.language !== null) { | ||
@@ -69,3 +69,3 @@ return state.personalization.language | ||
}, | ||
timezone (state) { | ||
timezone(state) { | ||
if (state.personalization.timezone !== null) { | ||
@@ -81,3 +81,3 @@ return state.personalization.timezone | ||
actions: { | ||
getSSRData () { | ||
getSSRData() { | ||
let data = null | ||
@@ -91,3 +91,3 @@ if (SSR) { | ||
}, | ||
setPageInfo ({ title, name, keywords, desc, description }) { | ||
setPageInfo({ title, name, keywords, desc, description }) { | ||
this.pageInfo.title = title || name || '' | ||
@@ -108,3 +108,3 @@ this.pageInfo.description = desc || description || '' | ||
}, | ||
updateScreen () { | ||
updateScreen() { | ||
if (typeof window !== 'undefined' && window) { | ||
@@ -127,3 +127,3 @@ const dark = window.matchMedia('(prefers-color-scheme: dark)').matches | ||
}, | ||
updatePersonalization (key, value) { | ||
updatePersonalization(key, value) { | ||
if (typeof window !== 'undefined' && window) { | ||
@@ -164,5 +164,7 @@ // load from localStorage | ||
}, | ||
async call (api, params) { | ||
async call(api, params) { | ||
if (SSR) { | ||
throw new Error('Forbidden to call API in SSR mode, which will cause performance and other issues. Please use SSRContext mode to load data') | ||
throw new Error( | ||
'Forbidden to call API in SSR mode, which will cause performance and other issues. Please use SSRContext mode to load data' | ||
) | ||
} | ||
@@ -185,3 +187,3 @@ const options = {} | ||
}, | ||
async updateMeta (force) { | ||
async updateMeta(force) { | ||
if (!this.meta.name || force) { | ||
@@ -192,3 +194,3 @@ const res = await call('/sumor/meta') | ||
}, | ||
async updateToken () { | ||
async updateToken() { | ||
const res = await this.call('/sumor/token') | ||
@@ -202,10 +204,10 @@ Object.assign(this.token, res.data) | ||
}, | ||
async logout () { | ||
async logout() { | ||
await this.call('/sumor/logout') | ||
await this.updateToken() | ||
}, | ||
form (path) { | ||
form(path) { | ||
const call = this.call | ||
class Form { | ||
constructor () { | ||
constructor() { | ||
// 发送状态 | ||
@@ -216,3 +218,3 @@ this.pending = false // 用于是否繁忙 | ||
async call (data) { | ||
async call(data) { | ||
data = Object.assign({}, this.data, data) | ||
@@ -232,3 +234,3 @@ this.pending = true | ||
}, | ||
listen () { | ||
listen() { | ||
if (!this._listened) { | ||
@@ -242,3 +244,3 @@ this._listened = true | ||
}, | ||
stop () { | ||
stop() { | ||
this._listened = false | ||
@@ -245,0 +247,0 @@ clearInterval(this._listenTimer) |
@@ -1,2 +0,2 @@ | ||
export default (store) => { | ||
export default store => { | ||
if (typeof window !== 'undefined' && window) { | ||
@@ -18,3 +18,3 @@ // listen to window resize | ||
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)') | ||
darkModeMediaQuery.addEventListener('change', (event) => { | ||
darkModeMediaQuery.addEventListener('change', event => { | ||
store.updateScreen() | ||
@@ -21,0 +21,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
173848
14
0
39
0
14
1140