@mythpe/quasar-ui-qui 0.0.8 → 0.0.9
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.
- package/.eslintrc.cjs +103 -0
- package/package.json +18 -3
- package/src/components/{MBtn.vue → form/MBtn.vue} +6 -9
- package/src/components/grid/MBlock.vue +36 -0
- package/src/index.common.js +1 -0
- package/src/index.esm.js +1 -0
- package/src/index.umd.js +1 -0
- package/src/types/VuePlugin.d.ts +4 -0
- package/src/types/components.d.ts +44 -0
- package/src/types/index.d.ts +1 -1
- package/src/vue-plugin.js +3 -1
- package/build/config.js +0 -13
- package/build/index.js +0 -19
- package/build/script.app-ext.js +0 -60
- package/build/script.clean.js +0 -6
- package/build/script.css.js +0 -75
- package/build/script.javascript.js +0 -213
- package/build/script.open-umd.js +0 -6
- package/build/utils.js +0 -54
- package/src/types/MBtn.d.ts +0 -21
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
|
|
3
|
+
// This option interrupts the configuration hierarchy at this file
|
|
4
|
+
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
|
|
5
|
+
root: true,
|
|
6
|
+
|
|
7
|
+
// https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
|
|
8
|
+
// Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working
|
|
9
|
+
// `parser: 'vue-eslint-parser'` is already included with any 'plugin:vue/**' config and should be omitted
|
|
10
|
+
parserOptions: {
|
|
11
|
+
parser: require.resolve('@typescript-eslint/parser'),
|
|
12
|
+
extraFileExtensions: ['.vue']
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
env: {
|
|
16
|
+
browser: true,
|
|
17
|
+
es2021: true,
|
|
18
|
+
node: true
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// Rules order is important, please avoid shuffling them
|
|
22
|
+
extends: [
|
|
23
|
+
// Base ESLint recommended rules
|
|
24
|
+
// 'eslint:recommended',
|
|
25
|
+
|
|
26
|
+
// https://typescript-eslint.io/getting-started/legacy-eslint-setup
|
|
27
|
+
// ESLint typescript rules
|
|
28
|
+
'plugin:@typescript-eslint/recommended',
|
|
29
|
+
|
|
30
|
+
// Uncomment any of the lines below to choose desired strictness,
|
|
31
|
+
// but leave only one uncommented!
|
|
32
|
+
// See https://eslint.vuejs.org/rules/#available-rules
|
|
33
|
+
//'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention)
|
|
34
|
+
'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
|
|
35
|
+
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
|
|
36
|
+
'standard'
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
plugins: [
|
|
40
|
+
// required to apply rules which need type information
|
|
41
|
+
'@typescript-eslint',
|
|
42
|
+
|
|
43
|
+
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
|
|
44
|
+
// required to lint *.vue files
|
|
45
|
+
'vue'
|
|
46
|
+
|
|
47
|
+
],
|
|
48
|
+
|
|
49
|
+
globals: {
|
|
50
|
+
ga: 'readonly', // Google Analytics
|
|
51
|
+
cordova: 'readonly',
|
|
52
|
+
__statics: 'readonly',
|
|
53
|
+
__QUASAR_SSR__: 'readonly',
|
|
54
|
+
__QUASAR_SSR_SERVER__: 'readonly',
|
|
55
|
+
__QUASAR_SSR_CLIENT__: 'readonly',
|
|
56
|
+
__QUASAR_SSR_PWA__: 'readonly',
|
|
57
|
+
process: 'readonly',
|
|
58
|
+
Capacitor: 'readonly',
|
|
59
|
+
chrome: 'readonly'
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
// add your custom rules here
|
|
63
|
+
rules: {
|
|
64
|
+
|
|
65
|
+
// allow async-await
|
|
66
|
+
'generator-star-spacing': 'off',
|
|
67
|
+
// allow paren-less arrow functions
|
|
68
|
+
'arrow-parens': 'off',
|
|
69
|
+
'one-var': 'off',
|
|
70
|
+
'no-void': 'off',
|
|
71
|
+
'multiline-ternary': 'off',
|
|
72
|
+
|
|
73
|
+
'import/first': 'off',
|
|
74
|
+
'import/namespace': 'error',
|
|
75
|
+
'import/default': 'error',
|
|
76
|
+
'import/export': 'error',
|
|
77
|
+
'import/extensions': 'off',
|
|
78
|
+
'import/no-unresolved': 'off',
|
|
79
|
+
'import/no-extraneous-dependencies': 'off',
|
|
80
|
+
|
|
81
|
+
// The core 'import/named' rules
|
|
82
|
+
// does not work with type definitions
|
|
83
|
+
'import/named': 'off',
|
|
84
|
+
|
|
85
|
+
'prefer-promise-reject-errors': 'off',
|
|
86
|
+
|
|
87
|
+
quotes: ['warn', 'single', { avoidEscape: true }],
|
|
88
|
+
|
|
89
|
+
// this rule, if on, would require explicit return type on the `render` function
|
|
90
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
91
|
+
|
|
92
|
+
// in plain CommonJS modules, you can't use `import foo = require('foo')` to pass this rule, so it has to be disabled
|
|
93
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
94
|
+
|
|
95
|
+
// The core 'no-unused-vars' rules (in the eslint:recommended ruleset)
|
|
96
|
+
// does not work with type definitions
|
|
97
|
+
'no-unused-vars': 'off',
|
|
98
|
+
|
|
99
|
+
// allow debugger during development only
|
|
100
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
101
|
+
'@typescript-eslint/no-explicit-any': 'off'
|
|
102
|
+
}
|
|
103
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mythpe/quasar-ui-qui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "MyTh Quasar UI Kit App Extension",
|
|
5
5
|
"author": "MyTh Ahmed Faiz <mythpe@gmail.com>",
|
|
6
6
|
"email": "mythpe@gmail.com",
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
"build:js": "node build/script.javascript.js",
|
|
21
21
|
"build:css": "node build/script.css.js"
|
|
22
22
|
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"vee-validate": "^4.14.7",
|
|
25
|
+
"vue-i18n": "^10.0.4"
|
|
26
|
+
},
|
|
23
27
|
"devDependencies": {
|
|
24
28
|
"@quasar/app-webpack": "^3.13.0",
|
|
25
29
|
"@quasar/extras": "^1.16.4",
|
|
@@ -27,10 +31,19 @@
|
|
|
27
31
|
"@rollup/plugin-json": "^4.0.0",
|
|
28
32
|
"@rollup/plugin-node-resolve": "^11.2.1",
|
|
29
33
|
"@rollup/plugin-replace": "^2.4.2",
|
|
34
|
+
"@types/node": "^20.5.9",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^7.16.0",
|
|
36
|
+
"@typescript-eslint/parser": "^7.16.0",
|
|
30
37
|
"autoprefixer": "^10.0.2",
|
|
31
38
|
"chalk": "^4.1.0",
|
|
32
39
|
"core-js": "^3.0.0",
|
|
33
40
|
"cssnano": "^4.1.10",
|
|
41
|
+
"eslint": "^8.57.0",
|
|
42
|
+
"eslint-config-standard": "^17.0.0",
|
|
43
|
+
"eslint-plugin-import": "^2.19.1",
|
|
44
|
+
"eslint-plugin-n": "^15.0.0",
|
|
45
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
46
|
+
"eslint-plugin-vue": "^9.0.0",
|
|
34
47
|
"fs-extra": "^8.1.0",
|
|
35
48
|
"open": "^7.3.0",
|
|
36
49
|
"postcss": "^8.1.9",
|
|
@@ -54,7 +67,9 @@
|
|
|
54
67
|
"last 4 FirefoxAndroid versions",
|
|
55
68
|
"last 4 iOS versions"
|
|
56
69
|
],
|
|
57
|
-
"
|
|
58
|
-
"
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": "^24 || ^22 || ^20 || ^18",
|
|
72
|
+
"npm": ">= 6.13.4",
|
|
73
|
+
"yarn": ">= 1.21.1"
|
|
59
74
|
}
|
|
60
75
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import type { MBtnProps } from '
|
|
2
|
+
import type { MBtnProps } from '../../types'
|
|
3
3
|
import { useI18n } from 'vue-i18n'
|
|
4
4
|
import { computed } from 'vue'
|
|
5
5
|
import { extend } from 'quasar'
|
|
6
|
-
import { MythOptions } from '
|
|
6
|
+
import { MythOptions } from '../../utils'
|
|
7
7
|
|
|
8
8
|
const props = defineProps<MBtnProps>()
|
|
9
|
-
defineOptions({
|
|
10
|
-
name: 'MBtn',
|
|
11
|
-
inheritAttrs: !1
|
|
12
|
-
})
|
|
13
9
|
const options = computed(() => MythOptions.defaults.value.btn ?? {})
|
|
14
10
|
const { t, te } = useI18n({ useScope: 'global' })
|
|
15
11
|
const getLabel = computed(() => {
|
|
@@ -23,12 +19,13 @@ const getLabel = computed(() => {
|
|
|
23
19
|
}
|
|
24
20
|
return props.label
|
|
25
21
|
})
|
|
22
|
+
defineOptions({
|
|
23
|
+
name: 'MBtn',
|
|
24
|
+
inheritAttrs: !1
|
|
25
|
+
})
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
28
|
<template>
|
|
29
|
-
<div>
|
|
30
|
-
<pre>{{ options }}</pre>
|
|
31
|
-
</div>
|
|
32
29
|
<q-btn v-bind="extend(!0,{...$attrs},options.props,{...$props},{label: getLabel})">
|
|
33
30
|
<template
|
|
34
31
|
v-if="!!options.loading && !$slots.loading"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { MBlockProps } from '../../types'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import MythOptions from '../../utils'
|
|
5
|
+
import { extend } from 'quasar'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
size?: MBlockProps['size'];
|
|
9
|
+
rounded?: MBlockProps['rounded'];
|
|
10
|
+
shadow?: MBlockProps['shadow'];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
14
|
+
size: 'md',
|
|
15
|
+
rounded: !1,
|
|
16
|
+
shadow: 'none'
|
|
17
|
+
})
|
|
18
|
+
const block = computed(() => MythOptions.defaults.value.block ?? {})
|
|
19
|
+
const options = computed<Props>(() => extend(!0, { ...props }, block.value))
|
|
20
|
+
defineOptions({ name: 'MBlock', inheritAttrs: !1 })
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div
|
|
25
|
+
:class="{
|
|
26
|
+
'm---block' : !0,
|
|
27
|
+
[`q-pa-${options.size}`] : !!options.size && options.size !== 'none',
|
|
28
|
+
'rounded-borders' : options.rounded === !0,
|
|
29
|
+
[`shadow-${options.shadow}`] : !!options.shadow && options.shadow !== 'none'
|
|
30
|
+
}"
|
|
31
|
+
v-bind="$attrs"
|
|
32
|
+
>
|
|
33
|
+
<pre style="direction: ltr;">{{ options }}</pre>
|
|
34
|
+
<slot />
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
package/src/index.common.js
CHANGED
package/src/index.esm.js
CHANGED
package/src/index.umd.js
CHANGED
package/src/types/VuePlugin.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { QBtnProps } from 'quasar'
|
|
2
2
|
import type { Ref } from 'vue'
|
|
3
|
+
import { MBlockProps } from './components'
|
|
3
4
|
|
|
4
5
|
export interface UiOptions {
|
|
6
|
+
style?: Record<string, any>;
|
|
5
7
|
btn?: {
|
|
6
8
|
props?: Partial<QBtnProps>;
|
|
7
9
|
loading?: {
|
|
@@ -11,7 +13,9 @@ export interface UiOptions {
|
|
|
11
13
|
label?: boolean | undefined;
|
|
12
14
|
}
|
|
13
15
|
};
|
|
16
|
+
block?: Partial<MBlockProps>;
|
|
14
17
|
}
|
|
18
|
+
|
|
15
19
|
export interface MythOptionsContext {
|
|
16
20
|
defaults: Ref<UiOptions>;
|
|
17
21
|
getDefaults: () => UiOptions;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { GlobalComponentConstructor, QBtnProps, QBtnSlots } from 'quasar'
|
|
2
|
+
import type { VNode } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface MBtnProps extends QBtnProps {
|
|
5
|
+
//
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface MBtnSlots extends QBtnSlots {
|
|
9
|
+
/**
|
|
10
|
+
* Use for custom content, instead of relying on 'icon' and 'label' props
|
|
11
|
+
*/
|
|
12
|
+
default: () => VNode[];
|
|
13
|
+
/**
|
|
14
|
+
* Override the default QSpinner when in 'loading' state
|
|
15
|
+
*/
|
|
16
|
+
loading: () => VNode[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface MBlockProps {
|
|
20
|
+
/**
|
|
21
|
+
* Size of the padding block.
|
|
22
|
+
* Default: 'md'
|
|
23
|
+
*/
|
|
24
|
+
readonly size?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Rounded block
|
|
27
|
+
*/
|
|
28
|
+
readonly rounded?: boolean | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Shadow level
|
|
31
|
+
*/
|
|
32
|
+
readonly shadow?: string | number | 'transition' | 'none' | undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface MBlockSlots {
|
|
36
|
+
default?: () => VNode[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '@vue/runtime-core' {
|
|
40
|
+
interface GlobalComponents {
|
|
41
|
+
MBtn: GlobalComponentConstructor<MBtnProps, MBtnSlots>;
|
|
42
|
+
MBlock: GlobalComponentConstructor<MBlockProps, MBlockSlots>;
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './components'
|
|
2
2
|
export * from './VuePlugin'
|
package/src/vue-plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import MBtn from './components/MBtn.vue'
|
|
1
|
+
import MBtn from './components/form/MBtn.vue'
|
|
2
2
|
import js from '../package.json'
|
|
3
3
|
import { MythOptions } from './utils'
|
|
4
|
+
import MBlock from './components/grid/MBlock.vue'
|
|
4
5
|
|
|
5
6
|
const name = js.name
|
|
6
7
|
const version = js.version
|
|
@@ -8,6 +9,7 @@ const version = js.version
|
|
|
8
9
|
function install (app, options = {}) {
|
|
9
10
|
MythOptions.withDefaults(options)
|
|
10
11
|
app.component('MBtn', MBtn)
|
|
12
|
+
app.component('MBlock', MBlock)
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export {
|
package/build/config.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const { name, author, version } = require('../package.json')
|
|
2
|
-
const year = (new Date()).getFullYear()
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
name,
|
|
6
|
-
version,
|
|
7
|
-
banner:
|
|
8
|
-
'/*!\n' +
|
|
9
|
-
' * ' + name + ' v' + version + '\n' +
|
|
10
|
-
' * (c) ' + year + ' ' + author + '\n' +
|
|
11
|
-
' * Released under the MIT License.\n' +
|
|
12
|
-
' */\n'
|
|
13
|
-
}
|
package/build/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
process.env.NODE_ENV = 'production'
|
|
2
|
-
|
|
3
|
-
const parallel = require('os').cpus().length > 1
|
|
4
|
-
const runJob = parallel ? require('child_process').fork : require
|
|
5
|
-
const { join } = require('path')
|
|
6
|
-
const { createFolder } = require('./utils')
|
|
7
|
-
const { green, blue } = require('chalk')
|
|
8
|
-
|
|
9
|
-
console.log()
|
|
10
|
-
|
|
11
|
-
require('./script.app-ext.js').syncAppExt()
|
|
12
|
-
require('./script.clean.js')
|
|
13
|
-
|
|
14
|
-
console.log(` 📦 Building ${green('v' + require('../package.json').version)}...${parallel ? blue(' [multi-threaded]') : ''}\n`)
|
|
15
|
-
|
|
16
|
-
// createFolder('dist')
|
|
17
|
-
|
|
18
|
-
// runJob(join(__dirname, './script.javascript.js'))
|
|
19
|
-
// runJob(join(__dirname, './script.css.js'))
|
package/build/script.app-ext.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const
|
|
2
|
-
fs = require('fs'),
|
|
3
|
-
path = require('path'),
|
|
4
|
-
root = path.resolve(__dirname, '../..'),
|
|
5
|
-
resolvePath = file => path.resolve(root, file),
|
|
6
|
-
{ blue } = require('chalk')
|
|
7
|
-
|
|
8
|
-
const writeJson = function (file, json) {
|
|
9
|
-
return fs.writeFileSync(file, JSON.stringify(json, null, 2) + '\n', 'utf-8')
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports.syncAppExt = function (both = true) {
|
|
13
|
-
// make sure this project has an app-extension project
|
|
14
|
-
const appExtDir = resolvePath('app-extension')
|
|
15
|
-
if (!fs.existsSync(appExtDir)) {
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// make sure this project has an ui project
|
|
20
|
-
const uiDir = resolvePath('ui')
|
|
21
|
-
if (!fs.existsSync(uiDir)) {
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// get version and name from ui package.json
|
|
26
|
-
const { name, version } = require(resolvePath(resolvePath('ui/package.json')))
|
|
27
|
-
|
|
28
|
-
// read app-ext package.json
|
|
29
|
-
const appExtFile = resolvePath('app-extension/package.json')
|
|
30
|
-
let appExtJson = require(appExtFile),
|
|
31
|
-
finished = false
|
|
32
|
-
|
|
33
|
-
// sync version numbers
|
|
34
|
-
if (both === true) {
|
|
35
|
-
appExtJson.version = version
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// check dependencies
|
|
39
|
-
if (appExtJson.dependencies !== void 0) {
|
|
40
|
-
if (appExtJson.dependencies[name] !== void 0) {
|
|
41
|
-
appExtJson.dependencies[name] = '^' + version
|
|
42
|
-
finished = true
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// check devDependencies, if not finished
|
|
46
|
-
if (finished === false && appExtJson.devDependencies !== void 0) {
|
|
47
|
-
if (appExtJson.devDependencies[name] !== void 0) {
|
|
48
|
-
appExtJson.devDependencies[name] = '^' + version
|
|
49
|
-
finished = true
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (finished === true) {
|
|
54
|
-
writeJson(appExtFile, appExtJson)
|
|
55
|
-
console.log(` ⭐️ App Extension version ${blue(appExtJson.name)} synced with UI version.\n`)
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
console.error(' App Extension version and dependency NOT synced.\n')
|
|
60
|
-
}
|
package/build/script.clean.js
DELETED
package/build/script.css.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const sass = require('sass')
|
|
3
|
-
const postcss = require('postcss')
|
|
4
|
-
const cssnano = require('cssnano')
|
|
5
|
-
const rtl = require('rtlcss')
|
|
6
|
-
const autoprefixer = require('autoprefixer')
|
|
7
|
-
|
|
8
|
-
const buildConf = require('./config')
|
|
9
|
-
const buildUtils = require('./utils')
|
|
10
|
-
|
|
11
|
-
const postCssCompiler = postcss([autoprefixer])
|
|
12
|
-
const postCssRtlCompiler = postcss([rtl({})])
|
|
13
|
-
|
|
14
|
-
const nano = postcss([
|
|
15
|
-
cssnano({
|
|
16
|
-
preset: ['default', {
|
|
17
|
-
mergeLonghand: false,
|
|
18
|
-
convertValues: false,
|
|
19
|
-
cssDeclarationSorter: false,
|
|
20
|
-
reduceTransforms: false
|
|
21
|
-
}]
|
|
22
|
-
})
|
|
23
|
-
])
|
|
24
|
-
|
|
25
|
-
Promise
|
|
26
|
-
.all([
|
|
27
|
-
generate('src/index.sass', 'dist/index')
|
|
28
|
-
])
|
|
29
|
-
.catch(e => {
|
|
30
|
-
console.error(e)
|
|
31
|
-
process.exit(1)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Helpers
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
function resolve (_path) {
|
|
39
|
-
return path.resolve(__dirname, '..', _path)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function generate (src, dest) {
|
|
43
|
-
src = resolve(src)
|
|
44
|
-
dest = resolve(dest)
|
|
45
|
-
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
sass.render({ file: src, includePaths: ['node_modules'] }, (err, result) => {
|
|
48
|
-
if (err) {
|
|
49
|
-
reject(err)
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
resolve(result.css)
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
.then(code => buildConf.banner + code)
|
|
57
|
-
.then(code => postCssCompiler.process(code, { from: void 0 }))
|
|
58
|
-
.then(code => {
|
|
59
|
-
code.warnings().forEach(warn => {
|
|
60
|
-
console.warn(warn.toString())
|
|
61
|
-
})
|
|
62
|
-
return code.css
|
|
63
|
-
})
|
|
64
|
-
.then(code => Promise.all([
|
|
65
|
-
generateUMD(dest, code),
|
|
66
|
-
postCssRtlCompiler.process(code, { from: void 0 })
|
|
67
|
-
.then(code => generateUMD(dest, code.css, '.rtl'))
|
|
68
|
-
]))
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function generateUMD (dest, code, ext = '') {
|
|
72
|
-
return buildUtils.writeFile(`${dest}${ext}.css`, code, true)
|
|
73
|
-
.then(code => nano.process(code, { from: void 0 }))
|
|
74
|
-
.then(code => buildUtils.writeFile(`${dest}${ext}.min.css`, code.css, true))
|
|
75
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
const fse = require('fs-extra')
|
|
4
|
-
const rollup = require('rollup')
|
|
5
|
-
const uglify = require('uglify-js')
|
|
6
|
-
const buble = require('@rollup/plugin-buble')
|
|
7
|
-
const json = require('@rollup/plugin-json')
|
|
8
|
-
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
|
9
|
-
const replace = require('@rollup/plugin-replace')
|
|
10
|
-
|
|
11
|
-
const { version } = require('../package.json')
|
|
12
|
-
|
|
13
|
-
const buildConf = require('./config')
|
|
14
|
-
const buildUtils = require('./utils')
|
|
15
|
-
|
|
16
|
-
const rollupPlugins = [
|
|
17
|
-
replace({
|
|
18
|
-
preventAssignment: false,
|
|
19
|
-
values: {
|
|
20
|
-
__UI_VERSION__: `'${version}'`
|
|
21
|
-
}
|
|
22
|
-
}),
|
|
23
|
-
nodeResolve({
|
|
24
|
-
extensions: ['.js'],
|
|
25
|
-
preferBuiltins: false
|
|
26
|
-
}),
|
|
27
|
-
json(),
|
|
28
|
-
buble({
|
|
29
|
-
objectAssign: 'Object.assign'
|
|
30
|
-
})
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
const builds = [
|
|
34
|
-
{
|
|
35
|
-
rollup: {
|
|
36
|
-
input: {
|
|
37
|
-
input: pathResolve('../src/index.esm.js')
|
|
38
|
-
},
|
|
39
|
-
output: {
|
|
40
|
-
file: pathResolve('../dist/index.esm.js'),
|
|
41
|
-
format: 'es'
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
build: {
|
|
45
|
-
// unminified: true,
|
|
46
|
-
minified: true
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
rollup: {
|
|
51
|
-
input: {
|
|
52
|
-
input: pathResolve('../src/index.common.js')
|
|
53
|
-
},
|
|
54
|
-
output: {
|
|
55
|
-
file: pathResolve('../dist/index.common.js'),
|
|
56
|
-
format: 'cjs'
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
build: {
|
|
60
|
-
// unminified: true,
|
|
61
|
-
minified: true
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
rollup: {
|
|
66
|
-
input: {
|
|
67
|
-
input: pathResolve('../src/index.umd.js')
|
|
68
|
-
},
|
|
69
|
-
output: {
|
|
70
|
-
name: 'mythUi',
|
|
71
|
-
file: pathResolve('../dist/index.umd.js'),
|
|
72
|
-
format: 'umd'
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
build: {
|
|
76
|
-
unminified: true,
|
|
77
|
-
minified: true,
|
|
78
|
-
minExt: true
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
|
|
83
|
-
// Add your asset folders here, if needed
|
|
84
|
-
// addAssets(builds, 'icon-set', 'iconSet')
|
|
85
|
-
// addAssets(builds, 'lang', 'lang')
|
|
86
|
-
|
|
87
|
-
build(builds)
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Helpers
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
function pathResolve (_path) {
|
|
94
|
-
return path.resolve(__dirname, _path)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// eslint-disable-next-line no-unused-vars
|
|
98
|
-
function addAssets (builds, type, injectName) {
|
|
99
|
-
const
|
|
100
|
-
files = fs.readdirSync(pathResolve('../../ui/src/components/' + type)),
|
|
101
|
-
plugins = [buble(/* bubleConfig */)],
|
|
102
|
-
outputDir = pathResolve(`../dist/${type}`)
|
|
103
|
-
|
|
104
|
-
fse.mkdirp(outputDir)
|
|
105
|
-
|
|
106
|
-
files
|
|
107
|
-
.filter(file => file.endsWith('.js'))
|
|
108
|
-
.forEach(file => {
|
|
109
|
-
const name = file.substr(0, file.length - 3).replace(/-([a-z])/g, g => g[1].toUpperCase())
|
|
110
|
-
builds.push({
|
|
111
|
-
rollup: {
|
|
112
|
-
input: {
|
|
113
|
-
input: pathResolve(`../src/components/${type}/${file}`),
|
|
114
|
-
plugins
|
|
115
|
-
},
|
|
116
|
-
output: {
|
|
117
|
-
file: addExtension(pathResolve(`../dist/${type}/${file}`), 'umd'),
|
|
118
|
-
format: 'umd',
|
|
119
|
-
name: `mythUi.${injectName}.${name}`
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
build: {
|
|
123
|
-
minified: true
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function build (builds) {
|
|
130
|
-
return Promise
|
|
131
|
-
.all(builds.map(genConfig).map(buildEntry))
|
|
132
|
-
.catch(buildUtils.logError)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function genConfig (opts) {
|
|
136
|
-
Object.assign(opts.rollup.input, {
|
|
137
|
-
plugins: rollupPlugins,
|
|
138
|
-
external: ['vue', 'quasar']
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
Object.assign(opts.rollup.output, {
|
|
142
|
-
banner: buildConf.banner,
|
|
143
|
-
globals: { vue: 'Vue', quasar: 'Quasar' }
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
return opts
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function addExtension (filename, ext = 'min') {
|
|
150
|
-
const insertionPoint = filename.lastIndexOf('.')
|
|
151
|
-
return `${filename.slice(0, insertionPoint)}.${ext}${filename.slice(insertionPoint)}`
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function buildEntry (config) {
|
|
155
|
-
return rollup
|
|
156
|
-
.rollup(config.rollup.input)
|
|
157
|
-
.then(bundle => bundle.generate(config.rollup.output))
|
|
158
|
-
.then(({ output }) => {
|
|
159
|
-
const code = config.rollup.output.format === 'umd'
|
|
160
|
-
? injectVueRequirement(output[0].code)
|
|
161
|
-
: output[0].code
|
|
162
|
-
|
|
163
|
-
return config.build.unminified
|
|
164
|
-
? buildUtils.writeFile(config.rollup.output.file, code)
|
|
165
|
-
: code
|
|
166
|
-
})
|
|
167
|
-
.then(code => {
|
|
168
|
-
if (!config.build.minified) {
|
|
169
|
-
return code
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const minified = uglify.minify(code, {
|
|
173
|
-
compress: {
|
|
174
|
-
pure_funcs: ['makeMap']
|
|
175
|
-
}
|
|
176
|
-
})
|
|
177
|
-
|
|
178
|
-
if (minified.error) {
|
|
179
|
-
return Promise.reject(minified.error)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return buildUtils.writeFile(
|
|
183
|
-
config.build.minExt === true
|
|
184
|
-
? addExtension(config.rollup.output.file)
|
|
185
|
-
: config.rollup.output.file,
|
|
186
|
-
buildConf.banner + minified.code,
|
|
187
|
-
true
|
|
188
|
-
)
|
|
189
|
-
})
|
|
190
|
-
.catch(err => {
|
|
191
|
-
console.error(err)
|
|
192
|
-
process.exit(1)
|
|
193
|
-
})
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function injectVueRequirement (code) {
|
|
197
|
-
// eslint-disable-next-line
|
|
198
|
-
const index = code.indexOf(`Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue`)
|
|
199
|
-
|
|
200
|
-
if (index === -1) {
|
|
201
|
-
return code
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const checkMe = ` if (Vue === void 0) {
|
|
205
|
-
console.error('[ Quasar ] Vue is required to run. Please add a script tag for it before loading Quasar.')
|
|
206
|
-
return
|
|
207
|
-
}
|
|
208
|
-
`
|
|
209
|
-
|
|
210
|
-
return code.substring(0, index - 1) +
|
|
211
|
-
checkMe +
|
|
212
|
-
code.substring(index)
|
|
213
|
-
}
|
package/build/script.open-umd.js
DELETED
package/build/utils.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const
|
|
2
|
-
fs = require('fs'),
|
|
3
|
-
path = require('path'),
|
|
4
|
-
zlib = require('zlib'),
|
|
5
|
-
{ green, blue, red, cyan } = require('chalk')
|
|
6
|
-
|
|
7
|
-
function getSize (code) {
|
|
8
|
-
return (code.length / 1024).toFixed(2) + 'kb'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
module.exports.createFolder = function (folder) {
|
|
12
|
-
const dir = path.join(__dirname, '..', folder)
|
|
13
|
-
if (!fs.existsSync(dir)) {
|
|
14
|
-
fs.mkdirSync(dir)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
module.exports.writeFile = function (dest, code, zip) {
|
|
19
|
-
const banner = dest.indexOf('.json') > -1
|
|
20
|
-
? red('[json]')
|
|
21
|
-
: dest.indexOf('.js') > -1
|
|
22
|
-
? green('[js] ')
|
|
23
|
-
: dest.indexOf('.ts') > -1
|
|
24
|
-
? cyan('[ts] ')
|
|
25
|
-
: blue('[css] ')
|
|
26
|
-
|
|
27
|
-
return new Promise((resolve, reject) => {
|
|
28
|
-
function report (extra) {
|
|
29
|
-
console.log(`${banner} ${path.relative(process.cwd(), dest).padEnd(41)} ${getSize(code).padStart(8)}${extra || ''}`)
|
|
30
|
-
resolve(code)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
fs.writeFile(dest, code, err => {
|
|
34
|
-
if (err) return reject(err)
|
|
35
|
-
if (zip) {
|
|
36
|
-
zlib.gzip(code, (err, zipped) => {
|
|
37
|
-
if (err) return reject(err)
|
|
38
|
-
report(` (gzipped: ${getSize(zipped).padStart(8)})`)
|
|
39
|
-
})
|
|
40
|
-
} else {
|
|
41
|
-
report()
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports.readFile = function (file) {
|
|
48
|
-
return fs.readFileSync(file, 'utf-8')
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
module.exports.logError = function (err) {
|
|
52
|
-
console.error('\n' + red('[Error]'), err)
|
|
53
|
-
console.log()
|
|
54
|
-
}
|
package/src/types/MBtn.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { GlobalComponentConstructor, QBtnProps, QBtnSlots } from 'quasar'
|
|
2
|
-
import type { VNode } from 'vue'
|
|
3
|
-
|
|
4
|
-
export type MBtnProps = QBtnProps
|
|
5
|
-
|
|
6
|
-
export interface MBtnSlots extends QBtnSlots {
|
|
7
|
-
/**
|
|
8
|
-
* Use for custom content, instead of relying on 'icon' and 'label' props
|
|
9
|
-
*/
|
|
10
|
-
default: () => VNode[];
|
|
11
|
-
/**
|
|
12
|
-
* Override the default QSpinner when in 'loading' state
|
|
13
|
-
*/
|
|
14
|
-
loading: () => VNode[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare module '@vue/runtime-core' {
|
|
18
|
-
interface GlobalComponents {
|
|
19
|
-
MBtn: GlobalComponentConstructor<MBtnProps, MBtnSlots>;
|
|
20
|
-
}
|
|
21
|
-
}
|