@mythpe/quasar-ui-qui 0.0.7 → 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 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/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto eol=lf
@@ -1,4 +1,6 @@
1
1
  export * from './src/vue-plugin'
2
+ export * from './src/types'
3
+ export * from './src/utils'
2
4
 
3
5
  import * as VuePlugin from './src/vue-plugin'
4
6
  export default VuePlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mythpe/quasar-ui-qui",
3
- "version": "0.0.7",
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",
@@ -8,7 +8,7 @@
8
8
  "license": "MIT",
9
9
  "module": "src/index.esm.js",
10
10
  "main": "src/index.common.js",
11
- "types": "types.d.ts",
11
+ "type": "module",
12
12
  "scripts": {
13
13
  "dev": "cd ../dev && yarn dev && cd ..",
14
14
  "dev:umd": "yarn build && node build/script.open-umd.js",
@@ -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
- "dependencies": {
58
- "vue-i18n": "^11.0.0-beta.1"
70
+ "engines": {
71
+ "node": "^24 || ^22 || ^20 || ^18",
72
+ "npm": ">= 6.13.4",
73
+ "yarn": ">= 1.21.1"
59
74
  }
60
75
  }
@@ -1,16 +1,12 @@
1
1
  <script lang="ts" setup>
2
- import type { MBtnProps } from '../types'
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 '../utils'
6
+ import { MythOptions } from '../../utils'
7
7
 
8
8
  const props = defineProps<MBtnProps>()
9
- defineOptions({
10
- name: 'MBtn',
11
- inheritAttrs: !1
12
- })
13
- const options = computed(() => MythOptions.getDefaults().btn ?? {})
9
+ const options = computed(() => MythOptions.defaults.value.btn ?? {})
14
10
  const { t, te } = useI18n({ useScope: 'global' })
15
11
  const getLabel = computed(() => {
16
12
  if (props.label !== undefined) {
@@ -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>
@@ -1,4 +1,6 @@
1
1
  export * from './vue-plugin'
2
+ export * from './utils'
2
3
 
3
4
  import * as VuePlugin from './vue-plugin'
5
+
4
6
  export default VuePlugin
package/src/index.esm.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './vue-plugin'
2
+ export * from './utils'
2
3
 
3
4
  import * as VuePlugin from './vue-plugin'
5
+
4
6
  export default VuePlugin
package/src/index.umd.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './vue-plugin'
2
+ export * from './utils'
2
3
 
3
4
  import * as VuePlugin from './vue-plugin'
5
+
4
6
  export default VuePlugin
@@ -1,6 +1,9 @@
1
1
  import type { QBtnProps } from 'quasar'
2
+ import type { Ref } from 'vue'
3
+ import { MBlockProps } from './components'
2
4
 
3
5
  export interface UiOptions {
6
+ style?: Record<string, any>;
4
7
  btn?: {
5
8
  props?: Partial<QBtnProps>;
6
9
  loading?: {
@@ -10,4 +13,14 @@ export interface UiOptions {
10
13
  label?: boolean | undefined;
11
14
  }
12
15
  };
16
+ block?: Partial<MBlockProps>;
17
+ }
18
+
19
+ export interface MythOptionsContext {
20
+ defaults: Ref<UiOptions>;
21
+ getDefaults: () => UiOptions;
22
+ setDefaults: (values: Partial<UiOptions>) => void;
23
+ withDefaults: (values: Partial<UiOptions>) => void;
24
+ withBtnDefaults: (values: Partial<QBtnProps>) => void;
25
+ btnDefaults: () => UiOptions;
13
26
  }
@@ -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
+ }
@@ -1,2 +1,2 @@
1
- export * from './MBtn.d'
2
- export * from './VuePlugin.d'
1
+ export * from './components'
2
+ export * from './VuePlugin'
package/src/utils.js ADDED
@@ -0,0 +1,22 @@
1
+ import { ref } from 'vue';
2
+ const cmDefaults = ref({});
3
+ const MythOptions = {
4
+ defaults: cmDefaults,
5
+ setDefaults(values) {
6
+ cmDefaults.value = { ...values };
7
+ },
8
+ withDefaults(values) {
9
+ cmDefaults.value = { ...cmDefaults.value, ...values };
10
+ },
11
+ withBtnDefaults(values) {
12
+ cmDefaults.value = {
13
+ ...cmDefaults.value,
14
+ btn: {
15
+ ...cmDefaults.value.btn,
16
+ props: { ...values }
17
+ }
18
+ };
19
+ }
20
+ };
21
+ export default MythOptions;
22
+ export { MythOptions };
package/src/utils.ts CHANGED
@@ -1,28 +1,26 @@
1
1
  import { ref } from 'vue'
2
2
  import type { UiOptions } from './types'
3
- import { QBtnProps } from 'quasar'
3
+ import type { QBtnProps } from 'quasar'
4
4
 
5
- export const MythOptions = {
6
- defaults: ref<UiOptions>({}),
7
- getDefaults () {
8
- return this.defaults.value
9
- },
5
+ const cmDefaults = ref<UiOptions>({})
6
+ const MythOptions = {
7
+ defaults: cmDefaults,
10
8
  setDefaults (values: Partial<UiOptions>) {
11
- this.defaults.value = { ...values }
9
+ cmDefaults.value = { ...values }
12
10
  },
13
11
  withDefaults (values: Partial<UiOptions>) {
14
- this.defaults.value = { ...this.defaults.value, ...values }
12
+ cmDefaults.value = { ...cmDefaults.value, ...values }
15
13
  },
16
14
  withBtnDefaults (values: Partial<QBtnProps>) {
17
- this.defaults.value = {
18
- ...this.defaults.value,
15
+ cmDefaults.value = {
16
+ ...cmDefaults.value,
19
17
  btn: {
20
- ...this.defaults.value.btn,
18
+ ...cmDefaults.value.btn,
21
19
  props: { ...values }
22
20
  }
23
21
  }
24
- },
25
- btnDefaults () {
26
- return this.defaults.value.btn
27
22
  }
28
23
  }
24
+
25
+ export default MythOptions
26
+ export { MythOptions }
package/src/vue-plugin.js CHANGED
@@ -1,13 +1,15 @@
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
7
8
 
8
9
  function install (app, options = {}) {
9
- MythOptions.setDefaults(options)
10
- app.component(MBtn.name, MBtn)
10
+ MythOptions.withDefaults(options)
11
+ app.component('MBtn', MBtn)
12
+ app.component('MBlock', MBlock)
11
13
  }
12
14
 
13
15
  export {
@@ -16,3 +18,10 @@ export {
16
18
  install,
17
19
  MythOptions
18
20
  }
21
+
22
+ export default {
23
+ name,
24
+ version,
25
+ install,
26
+ MythOptions
27
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "Preserve",
5
+ "esModuleInterop": true,
6
+ "forceConsistentCasingInFileNames": true,
7
+ "strict": true,
8
+ "skipLibCheck": true
9
+ }
10
+ }
package/umd-test.html ADDED
@@ -0,0 +1,59 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en-US">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta content="IE=edge" http-equiv="X-UA-Compatible">
6
+ <meta content="telephone=no" name="format-detection">
7
+ <meta content="no" name="msapplication-tap-highlight">
8
+ <meta content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width" name="viewport">
9
+
10
+ <title>UMD test</title>
11
+ <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons" rel="stylesheet" type="text/css">
12
+ <link href="https://cdn.jsdelivr.net/npm/quasar@2/dist/quasar.prod.css" rel="stylesheet" type="text/css">
13
+ <link href="dist/index.css" rel="stylesheet" type="text/css">
14
+ </head>
15
+ <body>
16
+ <div id="q-app">
17
+ <q-layout view="lHh Lpr fff">
18
+ <q-header class="glossy bg-primary">
19
+ <q-toolbar>
20
+ <q-toolbar-title>
21
+ quasar-ui-qui v{{ version }}
22
+ </q-toolbar-title>
23
+
24
+ <div>Quasar v{{ $q.version }}</div>
25
+ </q-toolbar>
26
+ </q-header>
27
+
28
+ <q-page-container>
29
+ <q-page padding>
30
+ <ul class="q-mb-lg">
31
+ <li>In /ui, run: "yarn build"</li>
32
+ <li class="text-red">You need to build & refresh page on each change manually.</li>
33
+ <li>Use self-closing tags only!</li>
34
+ <li>Example: &lt;my-component&gt;&lt;/my-component&gt;</li>
35
+ </ul>
36
+ </q-page>
37
+ </q-page-container>
38
+ </q-layout>
39
+ </div>
40
+
41
+ <script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script>
42
+ <script src="https://cdn.jsdelivr.net/npm/quasar@2/dist/quasar.umd.prod.js"></script>
43
+ <script src="dist/index.umd.js"></script>
44
+
45
+ <script>
46
+ const app = Vue.createApp({
47
+ setup() {
48
+ return {
49
+ version: mythUi.version
50
+ }
51
+ }
52
+ })
53
+
54
+ app.use(Quasar)
55
+ app.use(mythUi)
56
+ app.mount('#q-app')
57
+ </script>
58
+ </body>
59
+ </html>
@@ -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
- }
package/types.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './src/types'