@mythpe/quasar-app-extension-qui 0.0.22 → 0.0.25

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 ADDED
@@ -0,0 +1,109 @@
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
+ 'vue/setup-compiler-macros': true
20
+ },
21
+
22
+ // Rules order is important, please avoid shuffling them
23
+ extends: [
24
+ // Base ESLint recommended rules
25
+ // 'eslint:recommended',
26
+
27
+ // https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#usage
28
+ // ESLint typescript rules
29
+ 'plugin:@typescript-eslint/recommended',
30
+
31
+ // Uncomment any of the lines below to choose desired strictness,
32
+ // but leave only one uncommented!
33
+ // See https://eslint.vuejs.org/rules/#available-rules
34
+ // 'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention)
35
+ 'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
36
+ // 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
37
+
38
+ 'standard'
39
+
40
+ ],
41
+
42
+ plugins: [
43
+ // required to apply rules which need type information
44
+ '@typescript-eslint',
45
+
46
+ // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
47
+ // required to lint *.vue files
48
+ 'vue'
49
+
50
+ ],
51
+
52
+ globals: {
53
+ ga: 'readonly', // Google Analytics
54
+ cordova: 'readonly',
55
+ __statics: 'readonly',
56
+ __QUASAR_SSR__: 'readonly',
57
+ __QUASAR_SSR_SERVER__: 'readonly',
58
+ __QUASAR_SSR_CLIENT__: 'readonly',
59
+ __QUASAR_SSR_PWA__: 'readonly',
60
+ process: 'readonly',
61
+ Capacitor: 'readonly',
62
+ chrome: 'readonly'
63
+ },
64
+
65
+ // add your custom rules here
66
+ rules: {
67
+
68
+ // allow async-await
69
+ 'generator-star-spacing': 'off',
70
+ // allow paren-less arrow functions
71
+ 'arrow-parens': 'off',
72
+ 'one-var': 'off',
73
+ 'no-void': 'off',
74
+ 'multiline-ternary': 'off',
75
+
76
+ 'import/first': 'off',
77
+ 'import/namespace': 'error',
78
+ 'import/default': 'error',
79
+ 'import/export': 'error',
80
+ 'import/extensions': 'off',
81
+ 'import/no-unresolved': 'off',
82
+ 'import/no-extraneous-dependencies': 'off',
83
+
84
+ // The core 'import/named' rules
85
+ // does not work with type definitions
86
+ 'import/named': 'off',
87
+
88
+ 'prefer-promise-reject-errors': 'off',
89
+
90
+ quotes: ['warn', 'single', { avoidEscape: true }],
91
+
92
+ // this rule, if on, would require explicit return type on the `render` function
93
+ '@typescript-eslint/explicit-function-return-type': 'off',
94
+
95
+ // in plain CommonJS modules, you can't use `import foo = require('foo')` to pass this rule, so it has to be disabled
96
+ '@typescript-eslint/no-var-requires': 'off',
97
+
98
+ // The core 'no-unused-vars' rules (in the eslint:recommended ruleset)
99
+ // does not work with type definitions
100
+ 'no-unused-vars': 'off',
101
+
102
+ // allow debugger during development only
103
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
104
+
105
+ '@typescript-eslint/no-explicit-any': 'off',
106
+
107
+ 'no-labels' : 0
108
+ }
109
+ }
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,19 @@
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.cjs')
7
+ const { green, blue } = require('chalk')
8
+
9
+ console.log()
10
+
11
+ // require('./script.app-ext.cjs').syncAppExt()
12
+ require('./script.clean.cjs')
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.cjs'))
19
+ runJob(join(__dirname, './script.css.cjs'))
@@ -0,0 +1,60 @@
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
+ }
@@ -0,0 +1,6 @@
1
+ const
2
+ rimraf = require('rimraf'),
3
+ path = require('path')
4
+
5
+ rimraf.sync(path.resolve(__dirname, '../dist/*'))
6
+ console.log(' 💥 Cleaned build artifacts.\n')
@@ -0,0 +1,75 @@
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.cjs')
9
+ const buildUtils = require('./utils.cjs')
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
+ }
@@ -0,0 +1,213 @@
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.cjs')
14
+ const buildUtils = require('./utils.cjs')
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
+ }
@@ -0,0 +1,6 @@
1
+ const { resolve } = require('path')
2
+ const open = require('open')
3
+
4
+ open(
5
+ resolve(__dirname, '../umd-test.html')
6
+ )
@@ -0,0 +1,54 @@
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/jsconfig.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "."
4
+ }
5
+ }
package/package.json CHANGED
@@ -1,20 +1,73 @@
1
1
  {
2
2
  "name": "@mythpe/quasar-app-extension-qui",
3
- "version": "0.0.22",
3
+ "version": "0.0.25",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": "MyTh Ahmed Faiz <mythpe@gmail.com>",
6
- "mobile": "+966590470092",
7
6
  "email": "mythpe@gmail.com",
7
+ "mobile": "+966590470092",
8
8
  "license": "MIT",
9
9
  "type": "module",
10
+ "module": "src/index.esm.js",
11
+ "main": "src/index.common.js",
10
12
  "scripts": {
11
13
  "lint": "eslint --ext .js,.ts,.vue ./",
12
- "lint:fix": "eslint --ext .js,.ts,.vue ./ --fix"
14
+ "lint:fix": "eslint --ext .js,.ts,.vue ./ --fix",
15
+ "build": "node build/index.cjs",
16
+ "build:js": "node build/script.javascript.cjs",
17
+ "build:css": "node build/script.css.cjs"
13
18
  },
14
19
  "dependencies": {
15
- "@mythpe/quasar-ui-qui": "latest"
20
+ "@mythpe/quasar-ui-qui": "^0.0.25",
21
+ "@vee-validate/i18n": "^4.14.0",
22
+ "@vee-validate/rules": "^4.14.0",
23
+ "lodash": "^4.17.0",
24
+ "lodash-inflection": "^1.5.0",
25
+ "typed.js": "^2.0.0",
26
+ "vee-validate": "^4.14.0",
27
+ "vue-i18n": "^10.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@intlify/unplugin-vue-i18n": "^2.0.0",
31
+ "@quasar/app-vite": "^2.0.0-rc.1",
32
+ "@quasar/app-webpack": "^3.13.0",
33
+ "@quasar/cli": "^2.4.1",
34
+ "@quasar/extras": "^1.16.4",
35
+ "@rollup/plugin-buble": "^0.21.3",
36
+ "@rollup/plugin-json": "^4.0.0",
37
+ "@rollup/plugin-node-resolve": "^11.2.1",
38
+ "@rollup/plugin-replace": "^2.4.2",
39
+ "@types/lodash": "^4.17.13",
40
+ "@types/node": "^20.5.9",
41
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
42
+ "@typescript-eslint/parser": "^7.16.0",
43
+ "@vitejs/plugin-vue": "^5.2.0",
44
+ "autoprefixer": "^10.4.2",
45
+ "chalk": "^4.1.0",
46
+ "core-js": "^3.0.0",
47
+ "cssnano": "^4.1.10",
48
+ "eslint": "^8.57.0",
49
+ "eslint-config-standard": "^17.0.0",
50
+ "eslint-plugin-import": "^2.19.1",
51
+ "eslint-plugin-n": "^15.0.0",
52
+ "eslint-plugin-promise": "^6.0.0",
53
+ "eslint-plugin-vue": "^9.0.0",
54
+ "fs-extra": "^8.1.0",
55
+ "open": "^7.3.0",
56
+ "postcss": "^8.1.9",
57
+ "quasar": "^2.16.0",
58
+ "rimraf": "^3.0.0",
59
+ "rollup": "^2.45.0",
60
+ "rtlcss": "^2.6.1",
61
+ "sass": "^1.33.0",
62
+ "typescript": "~5.5.3",
63
+ "uglify-js": "^3.13.3",
64
+ "vite": "^5.4.11",
65
+ "vite-plugin-checker": "^0.8.0",
66
+ "vue": "^3.0.0",
67
+ "vue-router": "^4.0.0",
68
+ "vue-tsc": "^2.0.29",
69
+ "zlib": "^1.0.5"
16
70
  },
17
- "devDependencies": {},
18
71
  "engines": {
19
72
  "node": "^24 || ^22 || ^20 || ^18",
20
73
  "npm": ">= 6.13.4",