Skip to content

Commit 284012d

Browse files
committed
feat(ui): further modernize codebase
1 parent 8eadbe4 commit 284012d

134 files changed

Lines changed: 1077 additions & 1353 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"**/dist": true,
2626
"**/.quasar": true,
2727
"**/quasar.config.js.temporary.*": true,
28+
"ui/playground/src/mock-data": true,
2829
"utils/render-ssr-error/compiled-assets": true
2930
}
3031
}

ui/build/build.api.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -630,14 +630,12 @@ const arrayRE = /(\[.*\])/
630630
const objectRE = /(\{.*\})/
631631
const functionRE = /^(\s*\(\s*\)\s*=>\s*).+/
632632
function encodeDefaultValue(val, isFunction) {
633-
if (typeof val === 'string') {
634-
return `'${val}'`
635-
}
633+
if (typeof val === 'string') return `'${val}'`
636634

637635
if (typeof val === 'function') {
638636
const fn = val.toString()
639637

640-
if (isFunction === true) return fn
638+
if (isFunction) return fn
641639

642640
const arrayMatch = fn.match(arrayRE)
643641
if (arrayMatch !== null) {
@@ -1373,14 +1371,14 @@ function fillAPI(apiType, list, encodeFn) {
13731371

13741372
const isRuntimeFunction =
13751373
runtimeTypes.length === 1 && runtimeTypes[0] === 'Function'
1374+
13761375
const runtimeDefinableApiTypes =
13771376
extractRuntimeDefinablePropTypes(apiTypes)
13781377

13791378
// API "type" validation against runtime
13801379
if (
13811380
runtimeDefinableApiTypes.length !== runtimeTypes.length ||
1382-
runtimeDefinableApiTypes.every((t, i) => t === runtimeTypes[i]) ===
1383-
false
1381+
!runtimeDefinableApiTypes.every((t, i) => t === runtimeTypes[i])
13841382
) {
13851383
logError(
13861384
`${name}: wrong definition for prop "${apiPropName}" - ` +
@@ -1418,7 +1416,7 @@ function fillAPI(apiType, list, encodeFn) {
14181416
if (apiEntry.default !== encodedValue) {
14191417
let handledAlready = false
14201418

1421-
if (isRuntimeFunction === true) {
1419+
if (isRuntimeFunction) {
14221420
const fn = runtimeDefaultValue.toString()
14231421

14241422
if (fn.includes('\n')) {

ui/build/build.types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function getPropDefinition({
149149
let propType = getTypeVal(definition)
150150

151151
if (
152-
(isCompProps === true || isRestParam) &&
152+
(isCompProps || isRestParam) &&
153153
name !== 'model-value' &&
154154
!definition.required &&
155155
!propType.includes(' undefined')

ui/playground/src-ssr/server.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,31 +118,31 @@ const pngRE = /\.png$/
118118

119119
export const renderPreloadTag = defineSsrRenderPreloadTag(
120120
(file /* , { ssrContext } */) => {
121-
if (jsRE.test(file) === true) {
121+
if (jsRE.test(file)) {
122122
return `<link rel="modulepreload" href="${file}" crossorigin>`
123123
}
124124

125-
if (cssRE.test(file) === true) {
125+
if (cssRE.test(file)) {
126126
return `<link rel="stylesheet" href="${file}" crossorigin>`
127127
}
128128

129-
if (woffRE.test(file) === true) {
129+
if (woffRE.test(file)) {
130130
return `<link rel="preload" href="${file}" as="font" type="font/woff" crossorigin>`
131131
}
132132

133-
if (woff2RE.test(file) === true) {
133+
if (woff2RE.test(file)) {
134134
return `<link rel="preload" href="${file}" as="font" type="font/woff2" crossorigin>`
135135
}
136136

137-
if (gifRE.test(file) === true) {
137+
if (gifRE.test(file)) {
138138
return `<link rel="preload" href="${file}" as="image" type="image/gif" crossorigin>`
139139
}
140140

141-
if (jpgRE.test(file) === true) {
141+
if (jpgRE.test(file)) {
142142
return `<link rel="preload" href="${file}" as="image" type="image/jpeg" crossorigin>`
143143
}
144144

145-
if (pngRE.test(file) === true) {
145+
if (pngRE.test(file)) {
146146
return `<link rel="preload" href="${file}" as="image" type="image/png" crossorigin>`
147147
}
148148

ui/playground/src/composables/useLocalStorageConfig.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ function hasDifferentKeys(a, b) {
55
const keys = Object.keys(a)
66
const length = keys.length
77

8-
if (length !== Object.keys(b).length) {
9-
return true
10-
}
8+
if (length !== Object.keys(b).length) return true
119

1210
for (let i = length; i-- !== 0; ) {
1311
const key = keys[i]
@@ -33,7 +31,7 @@ export function useLocalStorageConfig(localStorageKey, definition) {
3331

3432
if (config) {
3533
// if something changed in the definition, reset it to the default definition
36-
if (hasDifferentKeys(config, definition) === true) {
34+
if (hasDifferentKeys(config, definition)) {
3735
config = definition
3836
LocalStorage.set(localStorageKey, config)
3937
}

ui/playground/src/pages/IndexPage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ onMounted(() => {
100100
}
101101
102102
window.addEventListener('keydown', onKeyup, { passive: false, capture: true })
103-
if ($q.platform.is.desktop === true) filterRef.value.focus()
103+
if ($q.platform.is.desktop) filterRef.value.focus()
104104
})
105105
106106
onBeforeUnmount(() => {

ui/playground/src/pages/components/ajax-bar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export default {
148148
},
149149
150150
loadingState() {
151-
return LoadingBar.isActive === true ? 'active' : 'idle'
151+
return LoadingBar.isActive ? 'active' : 'idle'
152152
}
153153
},
154154
methods: {

ui/playground/src/pages/components/button-align-2.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ export default {
221221
},
222222
computed: {
223223
rowClass() {
224-
if (this.center === true) {
225-
return 'items-center'
226-
}
224+
return this.center ? 'items-center' : ''
227225
},
228226
229227
props() {

ui/playground/src/pages/components/button-functional.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@
160160
v-slot="{ href, route, isActive, isExactActive }"
161161
>
162162
<q-btn
163-
:flat="isActive !== true"
164-
:outline="isActive === true && isExactActive !== true"
163+
:flat="!isActive"
164+
:outline="isActive && !isExactActive"
165165
color="primary"
166166
size="lg"
167167
no-caps
@@ -175,8 +175,8 @@
175175
v-slot="{ href, route, isActive, isExactActive }"
176176
>
177177
<q-btn
178-
:flat="isActive !== true"
179-
:outline="isActive === true && isExactActive !== true"
178+
:flat="!isActive"
179+
:outline="isActive && !isExactActive"
180180
color="primary"
181181
size="lg"
182182
no-caps
@@ -190,8 +190,8 @@
190190
v-slot="{ href, route, isActive, isExactActive }"
191191
>
192192
<q-btn
193-
:flat="isActive !== true"
194-
:outline="isActive === true && isExactActive !== true"
193+
:flat="!isActive"
194+
:outline="isActive && !isExactActive"
195195
color="primary"
196196
size="lg"
197197
no-caps
@@ -205,8 +205,8 @@
205205
v-slot="{ href, route, isActive, isExactActive }"
206206
>
207207
<q-btn
208-
:flat="isActive !== true"
209-
:outline="isActive === true && isExactActive !== true"
208+
:flat="!isActive"
209+
:outline="isActive && !isExactActive"
210210
color="primary"
211211
size="lg"
212212
no-caps
@@ -220,8 +220,8 @@
220220
v-slot="{ href, route, isActive, isExactActive }"
221221
>
222222
<q-btn
223-
:flat="isActive !== true"
224-
:outline="isActive === true && isExactActive !== true"
223+
:flat="!isActive"
224+
:outline="isActive && !isExactActive"
225225
color="primary"
226226
size="lg"
227227
no-caps

ui/playground/src/pages/components/button.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,7 @@ export default {
15561556
},
15571557
handle(type, e, abort) {
15581558
console.log(type, e)
1559-
if (abort === true) e.preventDefault()
1559+
if (abort) e.preventDefault()
15601560
}
15611561
},
15621562
beforeUnmount() {

0 commit comments

Comments
 (0)