@simsustech/quasar-components 0.1.2 → 0.2.0

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{QSubmitButton.vue_vue_type_script_setup_true_lang.fe90878f.js → QSubmitButton.vue_vue_type_script_setup_true_lang.65d6ac94.js} +7 -3
  3. package/dist/authentication.js +26 -8
  4. package/dist/en-US.d5751f99.js +217 -0
  5. package/dist/flags.js +5 -215
  6. package/dist/form.js +492 -0
  7. package/dist/general.js +341 -12
  8. package/dist/icons.js +2 -2
  9. package/dist/{nl.6b0aedb7.js → nl.1df15493.js} +1 -1
  10. package/dist/nl.7a710ba4.js +35 -0
  11. package/dist/style.css +2 -2
  12. package/dist/types/ui/authentication/ConsentList.vue.d.ts +2 -2
  13. package/dist/types/ui/authentication/EmailChangeForm.vue.d.ts +3 -3
  14. package/dist/types/ui/authentication/EmailChangeStepper.vue.d.ts +2 -2
  15. package/dist/types/ui/authentication/LoginButton.vue.d.ts +2 -2
  16. package/dist/types/ui/authentication/LoginForm.vue.d.ts +3 -3
  17. package/dist/types/ui/authentication/OtpInput.vue.d.ts +2 -2
  18. package/dist/types/ui/authentication/PasswordChangeForm.vue.d.ts +10 -10
  19. package/dist/types/ui/authentication/PasswordChangeStepper.vue.d.ts +2 -2
  20. package/dist/types/ui/authentication/RegisterForm.vue.d.ts +10 -10
  21. package/dist/types/ui/authentication/RequestOtpForm.vue.d.ts +3 -3
  22. package/dist/types/ui/authentication/UserMenuButton.vue.d.ts +2 -2
  23. package/dist/types/ui/authentication/VerificationSlider.vue.d.ts +2 -2
  24. package/dist/types/ui/form/BooleanItem.vue.d.ts +57 -0
  25. package/dist/types/ui/form/BooleanSelect.vue.d.ts +66 -0
  26. package/dist/types/ui/form/DateInput.vue.d.ts +61 -0
  27. package/dist/types/ui/form/FormInput.vue.d.ts +60 -0
  28. package/dist/types/ui/form/FormItem.vue.d.ts +64 -0
  29. package/dist/types/ui/form/GenderItem.vue.d.ts +57 -0
  30. package/dist/types/ui/form/GenderSelect.vue.d.ts +66 -0
  31. package/dist/types/ui/form/PostalCodeInput.vue.d.ts +67 -0
  32. package/dist/types/ui/form/TelephoneNumberInput.vue.d.ts +65 -0
  33. package/dist/types/ui/form/index.d.ts +9 -0
  34. package/dist/types/ui/form/lang/en-US.d.ts +3 -0
  35. package/dist/types/ui/form/lang/index.d.ts +68 -0
  36. package/dist/types/ui/form/lang/nl.d.ts +3 -0
  37. package/dist/types/ui/general/QLanguageSelect.vue.d.ts +58 -0
  38. package/dist/types/ui/general/QStyledCard.vue.d.ts +2 -2
  39. package/dist/types/ui/general/QStyledLayout.vue.d.ts +2 -2
  40. package/dist/types/ui/general/QSubmitButton.vue.d.ts +21 -1
  41. package/dist/types/ui/general/ResourcePage.vue.d.ts +159 -0
  42. package/dist/types/ui/general/ResponsiveDialog.vue.d.ts +108 -0
  43. package/dist/types/ui/general/index.d.ts +3 -0
  44. package/dist/types/virtualModules.d.ts +3 -0
  45. package/dist/types/vite-plugin.d.ts +3 -1
  46. package/dist/virtualModules.d.ts +3 -0
  47. package/dist/virtualModules.js +3 -0
  48. package/dist/vite-plugin.d.ts +3 -1
  49. package/dist/vite-plugin.js +61 -25
  50. package/package.json +13 -5
  51. package/src/ui/authentication/EmailChangeForm.vue +7 -2
  52. package/src/ui/authentication/EmailChangeStepper.vue +4 -0
  53. package/src/ui/authentication/LoginForm.vue +7 -2
  54. package/src/ui/authentication/PasswordChangeForm.vue +7 -2
  55. package/src/ui/authentication/PasswordChangeStepper.vue +4 -0
  56. package/src/ui/authentication/RegisterForm.vue +7 -2
  57. package/src/ui/authentication/RequestOtpForm.vue +2 -2
  58. package/src/ui/authentication/lang/en-US.ts +1 -2
  59. package/src/ui/authentication/lang/nl.ts +1 -2
  60. package/src/ui/flags/README.md +1 -1
  61. package/src/ui/form/BooleanItem.vue +34 -0
  62. package/src/ui/form/BooleanSelect.vue +55 -0
  63. package/src/ui/form/DateInput.vue +70 -0
  64. package/src/ui/form/FormInput.vue +44 -0
  65. package/src/ui/form/FormItem.vue +50 -0
  66. package/src/ui/form/GenderItem.vue +35 -0
  67. package/src/ui/form/GenderSelect.vue +59 -0
  68. package/src/ui/form/PostalCodeInput.vue +47 -0
  69. package/src/ui/form/TelephoneNumberInput.vue +35 -0
  70. package/src/ui/form/index.ts +9 -0
  71. package/src/ui/form/lang/en-US.ts +36 -0
  72. package/src/ui/form/lang/index.ts +70 -0
  73. package/src/ui/form/lang/nl.ts +36 -0
  74. package/src/ui/general/QLanguageSelect.vue +86 -0
  75. package/src/ui/general/QStyledCard.vue +1 -1
  76. package/src/ui/general/QSubmitButton.vue +7 -2
  77. package/src/ui/general/ResourcePage.vue +121 -0
  78. package/src/ui/general/ResponsiveDialog.vue +94 -0
  79. package/src/ui/general/index.ts +3 -0
  80. package/src/ui/icons/README.md +2 -0
  81. package/src/virtualModules.ts +113 -0
  82. package/src/vite-plugin.ts +60 -17
  83. package/tsconfig.build.plugin.json +1 -1
  84. package/tsconfig.node.json +1 -1
  85. package/vite.config.ts +93 -93
  86. package/dist/types/ui/index.d.ts +0 -2
  87. package/src/ui/index.ts +0 -2
  88. /package/dist/types/ui/icons/{icons.d.ts → labels.d.ts} +0 -0
  89. /package/src/ui/icons/{icons.ts → labels.ts} +0 -0
@@ -0,0 +1,113 @@
1
+ export const FlagIcon = (locale: string) => `
2
+ import { computed, ref, watch, h } from 'vue'
3
+ import { useQuasar, QIcon } from 'quasar'
4
+ import { useLang, loadLang } from '${
5
+ new URL(`../src/ui/flags/lang`, import.meta.url).pathname
6
+ }'
7
+ import icon from '${
8
+ new URL(`../src/ui/flags/assets/${locale}.svg`, import.meta.url).pathname
9
+ }'
10
+ export default {
11
+ setup(props, context) {
12
+ const $q = useQuasar()
13
+ const lang = useLang()
14
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
15
+ watch($q.lang, (val) => {
16
+ loadLang($q.lang.isoName)
17
+ })
18
+
19
+ const country = computed(
20
+ () => lang.value.countries['${locale}']
21
+ )
22
+ // @ts-ignore
23
+ // const language = computed(() => lang.value.languages['${locale}'])
24
+ const language = computed(() => lang.value.languages['${locale}'])
25
+ const variables = ref({
26
+ country,
27
+ language
28
+ // header: lang.value.some.nested.prop
29
+ })
30
+ const functions = ref({
31
+ // submit
32
+ })
33
+
34
+ context.expose({
35
+ variables,
36
+ functions
37
+ })
38
+
39
+ // return the render function
40
+ return () => h(QIcon, { name: \`img:\${icon}\` })
41
+ }}
42
+ `
43
+
44
+ export const Icon = (icon: string) => `
45
+ import { computed, ref, watch, h } from 'vue'
46
+ import { useQuasar, QIcon } from 'quasar'
47
+ import icon from '${
48
+ new URL(`../src/ui/icons/assets/${icon}.svg`, import.meta.url).pathname
49
+ }'
50
+ import labels from '${
51
+ new URL(`../src/ui/icons/labels.ts`, import.meta.url).pathname
52
+ }'
53
+ export default {
54
+ setup(props, context) {
55
+ const $q = useQuasar()
56
+
57
+ const variables = ref(labels['${icon}'])
58
+
59
+ const functions = ref({
60
+ // submit
61
+ })
62
+
63
+ context.expose({
64
+ variables,
65
+ functions
66
+ })
67
+
68
+ // return the render function
69
+ return () => h(QIcon, { name: \`img:\${icon}\` })
70
+ }}
71
+ `
72
+
73
+ export const FormItem = (field: string) => `
74
+ import { ref, watch, useAttrs, h } from 'vue'
75
+ import { QItem, QItemLabel, QItemSection, useQuasar } from 'quasar'
76
+ import { useLang, loadLang } from '${
77
+ new URL(`../src/ui/form/lang/index.ts`, import.meta.url).pathname
78
+ }'
79
+
80
+ export default {
81
+ setup(props, context) {
82
+ const $q = useQuasar()
83
+ const attrs = useAttrs()
84
+
85
+ const lang = useLang()
86
+
87
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
88
+ watch($q.lang, (val) => {
89
+ loadLang($q.lang.isoName)
90
+ })
91
+
92
+ const variables = ref({})
93
+
94
+ const functions = ref({
95
+ // submit
96
+ })
97
+
98
+ context.expose({
99
+ variables,
100
+ functions
101
+ })
102
+
103
+ // return the render function
104
+ return () =>
105
+ h(QItem, { attrs }, [
106
+ h(QItemSection, {}, [
107
+ h(QItemLabel, { overline: true }, 'field'),
108
+ h(QItemLabel, {}, 'field')
109
+ ])
110
+ ])
111
+ }
112
+ }
113
+ `
@@ -1,29 +1,72 @@
1
1
  import type { Plugin } from 'vite'
2
+ import { promises } from 'fs'
3
+ import { Icon, FlagIcon } from './virtualModules.js'
4
+ const { readFile } = promises
5
+
6
+ export default async function ({
7
+ buildFromSrc
8
+ }: {
9
+ buildFromSrc?: boolean
10
+ } = {}): Promise<Plugin> {
11
+ const pkgJson = JSON.parse(
12
+ await readFile(
13
+ new URL('../package.json', import.meta.url).pathname,
14
+ 'utf-8'
15
+ )
16
+ )
17
+ const exports = pkgJson.exports as Record<
18
+ string,
19
+ {
20
+ types: string
21
+ import: string
22
+ src: string
23
+ }
24
+ >[]
25
+ const name = pkgJson.name
2
26
 
3
- export default async function (): Promise<Plugin> {
4
27
  return {
5
- name: '@simsustech/quasar-components-plugin',
28
+ name: `${name}-plugin`,
29
+ enforce: 'pre',
30
+ resolveId: (id) => {
31
+ if (id.includes('.flag')) return id
32
+ else if (id.includes('.icon')) return id
33
+ },
34
+ load: (id) => {
35
+ if (id.includes('.flag')) {
36
+ const locale = id.slice(0, -5)
37
+ const flag = FlagIcon(locale)
38
+ return flag
39
+ } else if (id.includes('.icon')) {
40
+ const iconId = id.slice(0, -5)
41
+ const icon = Icon(iconId)
42
+ return icon
43
+ }
44
+ },
6
45
  config(config, { mode }) {
7
- if (mode === 'development') {
46
+ if (mode === 'development' || buildFromSrc) {
47
+ const alias = Object.entries(exports)
48
+ .filter(([key, val]) => {
49
+ return val.src
50
+ })
51
+ .map(([key, val]) => {
52
+ return {
53
+ find: new RegExp(
54
+ `^${
55
+ name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + key.slice(1)
56
+ }$`
57
+ ),
58
+ // name: name + key.slice(1),
59
+ replacement: new URL('.' + val.src, import.meta.url).pathname
60
+ }
61
+ })
62
+
8
63
  return {
9
64
  resolve: {
10
- alias: [
11
- {
12
- find: '@simsustech/quasar-components/flags',
13
- replacement: new URL(
14
- '../src/ui/flags/index.ts',
15
- import.meta.url
16
- ).pathname
17
- },
18
- {
19
- find: '@simsustech/quasar-components',
20
- replacement: new URL('../src/ui/index.ts', import.meta.url)
21
- .pathname
22
- }
23
- ]
65
+ alias
24
66
  }
25
67
  }
26
68
  }
69
+
27
70
  return {}
28
71
  }
29
72
  }
@@ -3,5 +3,5 @@
3
3
  "rootDir": "src/"
4
4
  },
5
5
  "extends": "./tsconfig.node.json",
6
- "include": ["./src/vite-plugin.ts"]
6
+ "include": ["./src/vite-plugin.ts", "./src/virtualModules.ts"]
7
7
  }
@@ -6,5 +6,5 @@
6
6
  "outDir": "./dist",
7
7
  "declaration": true
8
8
  },
9
- "include": ["vite.config.ts"]
9
+ "include": ["vite.config.ts", "src/virtualModules.ts"]
10
10
  }
package/vite.config.ts CHANGED
@@ -1,107 +1,103 @@
1
- import { defineConfig } from 'vite'
1
+ import { defineConfig, Plugin } from 'vite'
2
2
  import vue from '@vitejs/plugin-vue'
3
3
  import Components from 'unplugin-vue-components/vite'
4
4
  import { QuasarResolver } from 'unplugin-vue-components/resolvers'
5
+ import { FlagIcon, Icon } from './src/virtualModules.js'
6
+ // export const FlagIcon = (locale) => `
7
+ // import { computed, ref, watch, h } from 'vue'
8
+ // import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
9
+ // import { useLang, loadLang } from '${
10
+ // new URL(`./src/ui/flags/lang`, import.meta.url).pathname
11
+ // }'
12
+ // import icon from '${
13
+ // new URL(`./src/ui/flags/assets/${locale}.svg`, import.meta.url).pathname
14
+ // }'
15
+ // export default {
16
+ // setup(props, context) {
17
+ // const $q = useQuasar()
18
+ // const lang = useLang()
19
+ // if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
20
+ // watch($q.lang, (val) => {
21
+ // loadLang($q.lang.isoName)
22
+ // })
5
23
 
6
- const FlagIcon = (locale) => `
7
- import { computed, ref, watch, h } from 'vue'
8
- import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
9
- import { useLang, loadLang } from '${
10
- new URL(`./src/ui/flags/lang`, import.meta.url).pathname
11
- }'
12
- import icon from '${
13
- new URL(`./src/ui/flags/assets/${locale}.svg`, import.meta.url).pathname
14
- }'
15
- export default {
16
- setup(props, context) {
17
- const $q = useQuasar()
18
- const lang = useLang()
19
- if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
20
- watch($q.lang, (val) => {
21
- loadLang($q.lang.isoName)
22
- })
23
-
24
- const country = computed(
25
- () => lang.value.countries['${locale}']
26
- )
27
- // @ts-ignore
28
- const language = computed(() => lang.value.languages['${locale}'])
29
- const variables = ref({
30
- country,
31
- language
32
- // header: lang.value.some.nested.prop
33
- })
34
- const functions = ref({
35
- // submit
36
- })
24
+ // const country = computed(
25
+ // () => lang.value.countries['${locale}']
26
+ // )
27
+ // // @ts-ignore
28
+ // const language = computed(() => lang.value.languages['${locale}'])
29
+ // const variables = ref({
30
+ // country,
31
+ // language
32
+ // // header: lang.value.some.nested.prop
33
+ // })
34
+ // const functions = ref({
35
+ // // submit
36
+ // })
37
37
 
38
- context.expose({
39
- variables,
40
- functions
41
- })
38
+ // context.expose({
39
+ // variables,
40
+ // functions
41
+ // })
42
42
 
43
- // return the render function
44
- return () => h(QIcon, { name: \`img:\${icon}\` })
45
- }}
46
- `
43
+ // // return the render function
44
+ // return () => h(QIcon, { name: \`img:\${icon}\` })
45
+ // }}
46
+ // `
47
47
 
48
- const Icon = (icon) => `
49
- import { computed, ref, watch, h } from 'vue'
50
- import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
51
- import icon from '${
52
- new URL(`./src/ui/icons/assets/${icon}.svg`, import.meta.url).pathname
53
- }'
54
- import icons from '${
55
- new URL(`./src/ui/icons/icons.ts`, import.meta.url).pathname
56
- }'
57
- export default {
58
- setup(props, context) {
59
- const $q = useQuasar()
48
+ // export const Icon = (icon) => `
49
+ // import { computed, ref, watch, h } from 'vue'
50
+ // import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
51
+ // import icon from '${
52
+ // new URL(`./src/ui/icons/assets/${icon}.svg`, import.meta.url).pathname
53
+ // }'
54
+ // import icons from '${
55
+ // new URL(`./src/ui/icons/icons.ts`, import.meta.url).pathname
56
+ // }'
57
+ // export default {
58
+ // setup(props, context) {
59
+ // const $q = useQuasar()
60
60
 
61
- const variables = ref(icons['${icon}'])
61
+ // const variables = ref(icons['${icon}'])
62
62
 
63
- const functions = ref({
64
- // submit
65
- })
63
+ // const functions = ref({
64
+ // // submit
65
+ // })
66
66
 
67
- context.expose({
68
- variables,
69
- functions
70
- })
67
+ // context.expose({
68
+ // variables,
69
+ // functions
70
+ // })
71
71
 
72
- // return the render function
73
- return () => h(QIcon, { name: \`img:\${icon}\` })
74
- }}
75
- `
72
+ // // return the render function
73
+ // return () => h(QIcon, { name: \`img:\${icon}\` })
74
+ // }}
75
+ // `
76
+
77
+ export const moduleTransformPlugin: Plugin = {
78
+ name: 'module-tranform-plugin',
79
+ enforce: 'pre',
80
+ resolveId: (id) => {
81
+ if (id.includes('.flag')) return id
82
+ else if (id.includes('.icon')) return id
83
+ },
84
+ load: (id) => {
85
+ if (id.includes('.flag')) {
86
+ const locale = id.slice(0, -5)
87
+ console.log(locale)
88
+ const flag = FlagIcon(locale)
89
+ return flag
90
+ } else if (id.includes('.icon')) {
91
+ const iconId = id.slice(0, -5)
92
+ const icon = Icon(iconId)
93
+ return icon
94
+ }
95
+ }
96
+ }
76
97
 
77
98
  export default defineConfig(async ({ command, mode }) => ({
78
99
  plugins: [
79
- {
80
- name: 'module-tranform-plugin',
81
- enforce: 'pre',
82
- resolveId: (id) => {
83
- if (id.includes('.flag')) return id
84
- else if (id.includes('.icon')) return id
85
- },
86
- load: (id) => {
87
- if (id.includes('.flag')) {
88
- const locale = id.slice(0, -5)
89
- const flag = FlagIcon(locale)
90
- return flag
91
- } else if (id.includes('.icon')) {
92
- const iconId = id.slice(0, -5)
93
- const icon = Icon(iconId)
94
- return icon
95
- }
96
- }
97
- // resolveId: (source) => {
98
- // if (source.includes('FlagIcon.vue')) {
99
- // const split = source.split('FlagIcon.vue')
100
- // split[0].slice(2)
101
- // return { id: './FlagIcon.vue' }
102
- // }
103
- // }
104
- },
100
+ moduleTransformPlugin,
105
101
  Components({
106
102
  resolvers: [QuasarResolver()]
107
103
  }),
@@ -111,7 +107,9 @@ export default defineConfig(async ({ command, mode }) => ({
111
107
  // minify: false,
112
108
  lib: {
113
109
  // UMD not supported for code-splitting builds
114
- fileName: 'ui',
110
+ fileName: (format, entryName) => {
111
+ return entryName + '.js'
112
+ },
115
113
  formats: ['es'],
116
114
  entry: './src/ui/index.ts'
117
115
  },
@@ -125,10 +123,12 @@ export default defineConfig(async ({ command, mode }) => ({
125
123
  ).pathname,
126
124
  general: new URL('./src/ui/general/index.ts', import.meta.url).pathname,
127
125
  flags: new URL('./src/ui/flags/index.ts', import.meta.url).pathname,
128
- icons: new URL('./src/ui/icons/index.ts', import.meta.url).pathname
126
+ icons: new URL('./src/ui/icons/index.ts', import.meta.url).pathname,
127
+ form: new URL('./src/ui/form/index.ts', import.meta.url).pathname
129
128
  },
130
129
  output: {
131
- entryFileNames: '[name].js'
130
+ // entryFileNames: '[name].js',
131
+ // assetFileNames: '[name].[ext]'
132
132
  },
133
133
  external: ['vue', 'vue-router', 'quasar']
134
134
  }
@@ -1,2 +0,0 @@
1
- export * from './authentication/index';
2
- export * from './general/index';
package/src/ui/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './authentication/index'
2
- export * from './general/index'
File without changes
File without changes