@sedoo/unidoo 0.1.75 → 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 (97) hide show
  1. package/dist/unidoo/404.html +25 -0
  2. package/dist/unidoo/README.html +28 -0
  3. package/dist/unidoo/api-examples.html +115 -0
  4. package/dist/unidoo/assets/README.md.BZ5Xhpv0.js +1 -0
  5. package/dist/unidoo/assets/README.md.BZ5Xhpv0.lean.js +1 -0
  6. package/dist/unidoo/assets/api-examples.md.DBhC6zLa.js +16 -0
  7. package/dist/unidoo/assets/api-examples.md.DBhC6zLa.lean.js +1 -0
  8. package/dist/unidoo/assets/app._GYTos2W.js +1 -0
  9. package/dist/unidoo/assets/captcha_README.md.DD-ycQoE.js +14 -0
  10. package/dist/unidoo/assets/captcha_README.md.DD-ycQoE.lean.js +1 -0
  11. package/dist/unidoo/assets/chunks/framework.BNUUHgeN.js +20 -0
  12. package/dist/unidoo/assets/chunks/theme.dgUwZt0m.js +17 -0
  13. package/dist/unidoo/assets/confirm-dialog_README.md.TA2YAyOM.js +40 -0
  14. package/dist/unidoo/assets/confirm-dialog_README.md.TA2YAyOM.lean.js +1 -0
  15. package/dist/unidoo/assets/crud-table_README.md.DssifgeL.js +24 -0
  16. package/dist/unidoo/assets/crud-table_README.md.DssifgeL.lean.js +1 -0
  17. package/dist/unidoo/assets/index.md.D-nQzHqq.js +1 -0
  18. package/dist/unidoo/assets/index.md.D-nQzHqq.lean.js +1 -0
  19. package/dist/unidoo/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
  20. package/dist/unidoo/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
  21. package/dist/unidoo/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
  22. package/dist/unidoo/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
  23. package/dist/unidoo/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
  24. package/dist/unidoo/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
  25. package/dist/unidoo/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
  26. package/dist/unidoo/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
  27. package/dist/unidoo/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
  28. package/dist/unidoo/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
  29. package/dist/unidoo/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
  30. package/dist/unidoo/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
  31. package/dist/unidoo/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
  32. package/dist/unidoo/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
  33. package/dist/unidoo/assets/markdown-examples.md.qFdbvAEC.js +33 -0
  34. package/dist/unidoo/assets/markdown-examples.md.qFdbvAEC.lean.js +1 -0
  35. package/dist/unidoo/assets/style.DcdIs2mU.css +5 -0
  36. package/dist/unidoo/assets/unidoo-alert_README.md.CDBoKUvE.js +21 -0
  37. package/dist/unidoo/assets/unidoo-alert_README.md.CDBoKUvE.lean.js +1 -0
  38. package/dist/unidoo/assets/unidoo-formatError_README.md.D88kRSAN.js +20 -0
  39. package/dist/unidoo/assets/unidoo-formatError_README.md.D88kRSAN.lean.js +1 -0
  40. package/dist/unidoo/assets/unidoo-heatmap_README.md.CWPHTlQQ.js +9 -0
  41. package/dist/unidoo/assets/unidoo-heatmap_README.md.CWPHTlQQ.lean.js +1 -0
  42. package/dist/unidoo/assets/unidoo-integration_README.md.BfYvxL4t.js +3 -0
  43. package/dist/unidoo/assets/unidoo-integration_README.md.BfYvxL4t.lean.js +1 -0
  44. package/dist/unidoo/assets/unidoo-keycloak_README.md.BFwhUR1e.js +94 -0
  45. package/dist/unidoo/assets/unidoo-keycloak_README.md.BFwhUR1e.lean.js +1 -0
  46. package/dist/unidoo/assets/unidoo-mapgeofeatures_README.md.DRFYhHxL.js +17 -0
  47. package/dist/unidoo/assets/unidoo-mapgeofeatures_README.md.DRFYhHxL.lean.js +1 -0
  48. package/dist/unidoo/assets/unidoo-markdown_README.md.CJiUs_1Z.js +3 -0
  49. package/dist/unidoo/assets/unidoo-markdown_README.md.CJiUs_1Z.lean.js +1 -0
  50. package/dist/unidoo/assets/unidoo-player_README.md.C-ZkMmPM.js +41 -0
  51. package/dist/unidoo/assets/unidoo-player_README.md.C-ZkMmPM.lean.js +1 -0
  52. package/dist/unidoo/assets/unidoo-sso-users_README.md.CW5npEfC.js +1 -0
  53. package/dist/unidoo/assets/unidoo-sso-users_README.md.CW5npEfC.lean.js +1 -0
  54. package/dist/unidoo/assets/unidoo-trajectorymap_README.md.SsigyJ2k.js +4 -0
  55. package/dist/unidoo/assets/unidoo-trajectorymap_README.md.SsigyJ2k.lean.js +1 -0
  56. package/dist/unidoo/assets/unidoo-uuid_README.md.ciL1hMaH.js +7 -0
  57. package/dist/unidoo/assets/unidoo-uuid_README.md.ciL1hMaH.lean.js +1 -0
  58. package/dist/unidoo/assets/unidoo-viewer_README.md.ClgkM8DW.js +4 -0
  59. package/dist/unidoo/assets/unidoo-viewer_README.md.ClgkM8DW.lean.js +1 -0
  60. package/dist/unidoo/captcha/README.html +41 -0
  61. package/dist/unidoo/confirm-dialog/README.html +67 -0
  62. package/dist/unidoo/crud-table/README.html +51 -0
  63. package/dist/unidoo/hashmap.json +1 -0
  64. package/dist/unidoo/index.html +28 -0
  65. package/dist/unidoo/markdown-examples.html +60 -0
  66. package/dist/unidoo/unidoo-alert/README.html +48 -0
  67. package/dist/unidoo/unidoo-formatError/README.html +47 -0
  68. package/dist/unidoo/unidoo-heatmap/README.html +36 -0
  69. package/dist/unidoo/unidoo-integration/README.html +30 -0
  70. package/dist/unidoo/unidoo-keycloak/README.html +121 -0
  71. package/dist/unidoo/unidoo-mapgeofeatures/README.html +44 -0
  72. package/dist/unidoo/unidoo-markdown/README.html +30 -0
  73. package/dist/unidoo/unidoo-player/README.html +68 -0
  74. package/dist/unidoo/unidoo-sso-users/README.html +28 -0
  75. package/dist/unidoo/unidoo-trajectorymap/README.html +31 -0
  76. package/dist/unidoo/unidoo-uuid/README.html +34 -0
  77. package/dist/unidoo/unidoo-viewer/README.html +31 -0
  78. package/dist/unidoo/unidoo.css +1 -0
  79. package/dist/unidoo/unidoo.es.js +290 -0
  80. package/dist/unidoo/unidoo.umd.js +1 -1888
  81. package/dist/unidoo/vp-icons.css +1 -0
  82. package/package.json +29 -34
  83. package/src/components/UnidooAlert.vue +166 -117
  84. package/src/components/UnidooCaptcha.vue +70 -84
  85. package/src/globals.js +22 -0
  86. package/src/index.js +7 -0
  87. package/src/plugin.js +23 -278
  88. package/src/plugin.js.old +281 -0
  89. package/src/services/alertService.js +102 -0
  90. package/src/services/uuidService.js +25 -0
  91. package/dist/auth/auth.common.js +0 -11
  92. package/dist/auth/auth.umd.js +0 -11
  93. package/dist/auth/auth.umd.min.js +0 -11
  94. package/dist/auth/demo.html +0 -8
  95. package/dist/unidoo/demo.html +0 -8
  96. package/dist/unidoo/unidoo.common.js +0 -1888
  97. package/dist/unidoo/unidoo.umd.min.js +0 -1888
@@ -0,0 +1 @@
1
+ .vpi-social-github{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E")}
package/package.json CHANGED
@@ -1,15 +1,20 @@
1
1
  {
2
2
  "name": "@sedoo/unidoo",
3
- "version": "0.1.75",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
+ "publishConfig": {
6
+ "registry": "https://registry.npmjs.org/",
7
+ "access": "public"
8
+ },
5
9
  "scripts": {
6
- "build": "npm run build:unidoo && npm run build:auth",
7
- "build:unidoo": "vue-cli-service build --target lib --dest dist/unidoo --name unidoo src/plugin.js",
10
+ "build": "npm run build:unidoo",
11
+ "build:unidoo": "vite build",
8
12
  "build:auth": "vue-cli-service build --target lib --dest dist/auth --name auth src/auth.js",
9
- "lint": "vue-cli-service lint --fix && vue-cli-service lint dev --fix",
10
- "docs:dev": "vuepress dev docs",
11
- "docs:build": "vuepress build docs",
12
- "publish:local": "eval $(grep '^CI_NPMJS_TOKEN' .env.local) && npm config set -- '//registry.npmjs.org/:_authToken' \"${CI_NPMJS_TOKEN}\" && npm publish --access public"
13
+ "lint": "vite lint --fix && vite lint dev --fix",
14
+ "docs:dev": "vitepress dev docs",
15
+ "docs:build": "vitepress build docs",
16
+ "publish:local": "eval $(grep '^CI_NPMJS_TOKEN' .env.local) && npm config set -- '//registry.npmjs.org/:_authToken' \"${CI_NPMJS_TOKEN}\" && npm publish --access public",
17
+ "docs:preview": "vitepress preview docs"
13
18
  },
14
19
  "comments": {
15
20
  "scripts": "The build and docs:build script are used in the continuous integration process. They musn't be removed."
@@ -20,47 +25,33 @@
20
25
  "src/**/*"
21
26
  ],
22
27
  "dependencies": {
28
+ "axios": "^1.19.0",
23
29
  "date-fns": "^2.30.0",
24
30
  "date-fns-tz": "^1.3.8",
25
31
  "dompurify": "^3.2.4",
26
- "keycloak-js": "^8.0.2",
32
+ "keycloak-js": "^26.2.3",
27
33
  "marked": "^0.8.2",
34
+ "mitt": "^3.0.1",
28
35
  "moment": "^2.30.1",
29
36
  "ol": "^6.15.1",
30
37
  "ol-ext": "^4.0.23",
31
38
  "v-tooltip": "^2.1.3",
32
- "vue-axios": "3.2.4",
33
- "vue-custom-element": "^3.3.0"
39
+ "vue": "^3.5.43",
40
+ "vue-axios": "3.6.0",
41
+ "vuetify": "^3.13.4"
34
42
  },
35
43
  "devDependencies": {
36
- "caniuse-lite": "^1.0.30001741",
37
- "@vue/cli-plugin-babel": "^4.5.19",
38
- "@vue/cli-plugin-eslint": "^4.5.19",
39
- "@vue/cli-service": "^4.5.19",
40
- "@vue/eslint-config-standard": "5.1.2",
41
- "axios": "0.21.2",
44
+ "@vitejs/plugin-vue": "^5.2.3",
42
45
  "babel-eslint": "10.1.0",
46
+ "caniuse-lite": "^1.0.30001741",
43
47
  "core-js": "3.6.5",
44
48
  "eslint": "^7.32.0",
45
- "eslint-plugin-import": "2.22.1",
46
- "eslint-plugin-node": "11.1.0",
47
- "eslint-plugin-promise": "4.2.1",
48
- "eslint-plugin-standard": "4.0.0",
49
49
  "eslint-plugin-vue": "7.0.1",
50
- "moment-locales-webpack-plugin": "^1.2.0",
51
- "sass": "1.27.0",
52
- "sass-loader": "10.0.2",
53
- "vue": "2.6.14",
54
- "vue-cli-plugin-vuetify": "2.0.7",
50
+ "vite": "^6.2.4",
51
+ "vite-plugin-vuetify": "^2.1.3",
52
+ "vitepress": "^1.6.4",
55
53
  "vue-json-tree": "0.4.3",
56
- "vue-json-tree-view": "2.1.6",
57
- "vue-server-renderer": "2.6.14",
58
- "vue-template-compiler": "2.6.14",
59
- "vuepress": "1.8.2",
60
- "vuetify": "2.3.13",
61
- "vuetify-loader": "1.6.0",
62
- "webpack-bundle-analyzer": "^4.10.2",
63
- "webpack-cdn-upload-plugin": "2.0.2"
54
+ "vue-json-tree-view": "2.1.6"
64
55
  },
65
56
  "eslintConfig": {
66
57
  "root": true,
@@ -88,7 +79,11 @@
88
79
  ],
89
80
  "description": "Commons components to simplify vuetify based application developement",
90
81
  "exports": {
91
- ".": "./index.js"
82
+ ".": {
83
+ "import": "./dist/unidoo/unidoo.es.js",
84
+ "require": "./dist/unidoo/unidoo.umd.js"
85
+ },
86
+ "./style.css": "./dist/unidoo/style.css"
92
87
  },
93
88
  "repository": {
94
89
  "type": "git",
@@ -1,126 +1,175 @@
1
1
  <template>
2
- <span>
3
- <v-snackbar
4
- v-model="snackbar"
5
- :color="type"
6
- :timeout="timeout"
7
- :centered="position == 'centered'"
8
- :top="position == 'top'"
9
- :bottom="position == 'bottom'"
10
- >
11
- <v-container>
12
- <v-row>
13
- <v-progress-linear
14
- absolute
15
- top
16
- rounded
17
- rounded-bar
18
- :value="progressValue"
19
- :color="progressColor"
20
- />
21
- </v-row>
22
- <v-row align="center">
23
- {{ message }}
24
- <v-spacer></v-spacer>
25
- <v-btn dark text @click="snackbar = false">{{
26
- closeButtonLabel
27
- }}</v-btn>
28
- </v-row>
29
- </v-container>
30
- </v-snackbar>
31
- </span>
2
+ <v-snackbar
3
+ v-model="snackbar"
4
+ :color="type"
5
+ :timeout="timeout"
6
+ :location="snackbarLocation"
7
+ >
8
+ <v-container>
9
+ <v-row>
10
+ <v-progress-linear
11
+ absolute
12
+ top
13
+ rounded
14
+ rounded-bar
15
+ :model-value="progressValue"
16
+ :color="progressColor"
17
+ />
18
+ </v-row>
19
+
20
+ <v-row align="center">
21
+ <span>{{ message }}</span>
22
+
23
+ <v-spacer />
24
+
25
+ <v-btn
26
+ variant="text"
27
+ @click="snackbar = false"
28
+ >
29
+ {{ closeButtonLabel }}
30
+ </v-btn>
31
+ </v-row>
32
+ </v-container>
33
+ </v-snackbar>
32
34
  </template>
33
35
 
34
- <script>
35
- import Plugin from "../plugin.js";
36
-
37
- export default {
38
- components: {},
39
- computed: {
40
- progressValue() {
41
- return Math.floor(100 * (1 - this.currenttime / this.timeout));
42
- },
43
- progressColor() {
44
- if (this.type === "success") {
45
- return "#1B5E20";
46
- }
47
- if (this.type === "error") {
48
- return "#D50000";
49
- }
50
- if (this.type === "warning") {
51
- return "#E65100";
52
- }
53
- return "";
54
- },
55
- },
56
- data() {
57
- return {
58
- snackbar: false,
59
- message: "",
60
- type: "",
61
- position: "top",
62
- timeout: 4000,
63
- currenttime: 0,
64
- closeButtonLabel: "Close",
65
- };
66
- },
67
-
68
- watch: {
69
- snackbar(value) {
70
- this.computeProgression(value);
71
- },
72
- },
73
-
74
- methods: {
75
- show(params) {
76
- this.currenttime = 0;
77
- this.message = params.message;
78
- this.position = params.position ? params.position : this.position;
79
- this.timeout = params.timeout ? params.timeout : this.timeout;
80
- this.type = params.type ? params.type : this.type;
81
- this.closeButtonLabel = params.closeButtonLabel
82
- ? params.closeButtonLabel
83
- : this.closeButtonLabel;
84
- this.snackbar = true;
85
- },
86
-
87
- params(params) {
88
- this.position = params.position ? params.position : this.position;
89
- this.timeout = params.timeout ? params.timeout : this.timeout;
90
- this.type = params.type ? params.type : this.type;
91
- this.closeButtonLabel = params.closeButtonLabel
92
- ? params.closeButtonLabel
93
- : this.closeButtonLabel;
94
- },
95
-
96
- computeProgression(value) {
97
- if (value === false) {
98
- if (this.timer !== null) {
99
- clearInterval(this.timer);
100
- }
101
- } else {
102
- const self = this;
103
- this.timer = setInterval(() => {
104
- self.currenttime += 100;
105
- }, 100);
106
- }
107
- },
108
- },
109
-
110
- beforeMount() {
111
- Plugin.EventBus.$on("unidoo-alert-show", (params) => {
112
- this.show(params);
113
- });
114
-
115
- Plugin.EventBus.$on("unidoo-alert-params", (params) => {
116
- this.params(params);
117
- });
118
- },
119
- };
36
+ <script setup>
37
+ import {
38
+ computed,
39
+ inject,
40
+ onBeforeUnmount,
41
+ onMounted,
42
+ ref,
43
+ watch
44
+ } from 'vue'
45
+
46
+ const eventBus = inject('unidooEventBus')
47
+
48
+ if (!eventBus) {
49
+ throw new Error(
50
+ 'UnidooAlert must be used after Plugin Unidoo is installed.'
51
+ )
52
+ }
53
+
54
+ const defaultAlertParams = {
55
+ position: 'top',
56
+ timeout: 4000,
57
+ type: 'info',
58
+ closeButtonLabel: 'Close'
59
+ }
60
+
61
+ const snackbar = ref(false)
62
+ const message = ref('')
63
+ const currentTime = ref(0)
64
+ const timer = ref(null)
65
+ const position = ref(defaultAlertParams.position)
66
+ const timeout = ref(defaultAlertParams.timeout)
67
+ const type = ref(defaultAlertParams.type)
68
+ const closeButtonLabel = ref(defaultAlertParams.closeButtonLabel)
69
+
70
+
71
+ const progressValue = computed(() => {
72
+ if (!timeout.value) {
73
+ return 0
74
+ }
75
+
76
+ return Math.max(
77
+ 0,
78
+ Math.floor(100 * (1 - currentTime.value / timeout.value))
79
+ )
80
+ })
81
+
82
+ const progressColor = computed(() => {
83
+ switch (type.value) {
84
+ case 'success':
85
+ return '#1B5E20'
86
+ case 'error':
87
+ return '#D50000'
88
+ case 'warning':
89
+ return '#E65100'
90
+ default:
91
+ return undefined
92
+ }
93
+ })
94
+
95
+ const snackbarLocation = computed(() => {
96
+ switch (position.value) {
97
+ case 'top':
98
+ return 'top'
99
+ case 'bottom':
100
+ return 'bottom'
101
+ case 'centered':
102
+ case 'center':
103
+ return 'center'
104
+ default:
105
+ return position.value
106
+ }
107
+ })
108
+
109
+ function show(params = {}) {
110
+ currentTime.value = 0
111
+ message.value = params.message ?? ''
112
+ position.value = params.position ?? defaultAlertParams.position
113
+ timeout.value = params.timeout ?? defaultAlertParams.timeout
114
+ type.value = params.type ?? defaultAlertParams.type
115
+ closeButtonLabel.value = params.closeButtonLabel ?? defaultAlertParams.closeButtonLabel
116
+
117
+ snackbar.value = true
118
+ }
119
+
120
+ function updateParams(params = {}) {
121
+ position.value = params.position ?? position.value
122
+ timeout.value = params.timeout ?? timeout.value
123
+ type.value = params.type ?? type.value
124
+ closeButtonLabel.value =
125
+ params.closeButtonLabel ?? closeButtonLabel.value
126
+ }
127
+
128
+ function stopTimer() {
129
+ if (timer.value !== null) {
130
+ clearInterval(timer.value)
131
+ timer.value = null
132
+ }
133
+ }
134
+
135
+ function startTimer() {
136
+ stopTimer()
137
+
138
+ if (!timeout.value) {
139
+ return
140
+ }
141
+
142
+ timer.value = setInterval(() => {
143
+ currentTime.value += 100
144
+
145
+ if (currentTime.value >= timeout.value) {
146
+ stopTimer()
147
+ }
148
+ }, 100)
149
+ }
150
+
151
+ watch(snackbar, (value) => {
152
+ if (value) {
153
+ startTimer()
154
+ } else {
155
+ stopTimer()
156
+ }
157
+ })
158
+
159
+ onMounted(() => {
160
+ eventBus.on('unidoo-alert-show', show)
161
+ eventBus.on('unidoo-alert-params', updateParams)
162
+ })
163
+
164
+ onBeforeUnmount(() => {
165
+ eventBus.off('unidoo-alert-show', show)
166
+ eventBus.off('unidoo-alert-params', updateParams)
167
+ stopTimer()
168
+ })
120
169
  </script>
121
170
 
122
171
  <style scoped>
123
- .v-snack:not(.v-snack--absolute) {
172
+ .v-snackbar {
124
173
  z-index: 2000;
125
174
  }
126
175
  </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <span>
3
- <div ref="captcha"></div>
3
+ <div ref="captchaRef"></div>
4
4
  <div>
5
5
  <v-text-field :label="textFieldLabel" v-model="text"></v-text-field>
6
6
  <v-btn :color="color" @click="refresh">{{ refreshButtonLabel }}</v-btn>
@@ -8,98 +8,84 @@
8
8
  </span>
9
9
  </template>
10
10
 
11
- <script>
12
- export default {
13
- components: {},
11
+ <script setup>
12
+ import { computed, ref, watch, onMounted } from "vue";
14
13
 
15
- watch: {
16
- valid: function (value) {
17
- this.$emit("input", value);
18
- }
14
+ const emit = defineEmits(['update:modelValue'])
15
+ const props = defineProps({
16
+ size: {
17
+ type: String,
18
+ default: "6",
19
19
  },
20
-
21
- data() {
22
- return {
23
- captcha: [],
24
- width: 0,
25
- text: ""
26
- };
20
+ color: {
21
+ type: String,
22
+ default: "primary",
23
+ },
24
+ value: {
25
+ type: Boolean,
26
+ },
27
+ textFieldLabel: {
28
+ type: String,
29
+ default: "Text",
27
30
  },
28
- computed: {
29
- valid: function () {
30
- if (this.captchaText === this.text) {
31
- return true;
32
- }
33
- return false;
34
- },
35
- captchaText: function () {
36
- return this.captcha.join("");
37
- }
31
+ refreshButtonLabel: {
32
+ type: String,
33
+ default: "Refresh",
38
34
  },
39
- methods: {
40
- refresh() {
41
- this.text = "";
42
- this.generateCaptcha();
43
- },
35
+ });
44
36
 
45
- generateCaptcha() {
46
- if (typeof document !== "undefined") {
47
- const captcha = [];
48
- const charsArray =
49
- "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*";
50
- const size = Number.parseInt(this.size);
51
- for (var i = 0; i < size; i++) {
52
- // Eviter la repetition des characters
53
- var index = Math.floor(Math.random() * charsArray.length + 1);
54
- if (captcha.indexOf(charsArray[index]) === -1) {
55
- captcha.push(charsArray[index]);
56
- } else i--;
57
- }
58
- this.width = 20 * captcha.length;
59
- this.captcha = captcha;
37
+ onMounted(() => {
38
+ generateCaptcha()
39
+ })
60
40
 
61
- var canv = document.createElement("canvas");
62
- canv.id = "canvas";
63
- canv.width = this.width;
64
- canv.height = 50;
65
- var ctx = canv.getContext("2d");
66
- ctx.font = "25px Georgia";
67
- ctx.strokeText(this.captcha.join(""), 0, 30);
41
+ const captcha = ref([]);
42
+ const captchaRef = ref(null)
43
+ const captchaPhrase = ref("")
44
+ const width = ref(0);
45
+ const text = ref("");
68
46
 
69
- const captchaElement = this.$refs.captcha;
47
+ const valid = computed(() => {
48
+ return captchaPhrase.value === text.value;
49
+ });
70
50
 
71
- if (captchaElement != null) {
72
- captchaElement.innerHTML = "";
73
- captchaElement.appendChild(canv);
74
- }
75
- }
76
- }
77
- },
78
- beforeMount() {},
79
- mounted() {
80
- this.generateCaptcha();
81
- },
51
+ watch(valid, (value) => {
52
+ emit('update:modelValue', value);
53
+ })
54
+
55
+ const refresh = () => {
56
+ text.value = "";
57
+ generateCaptcha();
58
+ }
59
+
60
+ const generateCaptcha = () => {
61
+ const captchaLocal = [];
62
+ const charsArray =
63
+ "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*";
64
+ const size = Number.parseInt(props.size);
65
+ for (var i = 0; i < size; i++) {
66
+ // Eviter la repetition des characters
67
+ var index = Math.floor(Math.random() * charsArray.length + 1);
68
+ if (captchaLocal.indexOf(charsArray[index]) == -1) {
69
+ captchaLocal.push(charsArray[index]);
70
+ } else i--;
71
+ }
72
+ width.value = 20 * captchaLocal.length;
73
+ captcha.value = captchaLocal;
74
+ captchaPhrase.value = captcha.value.join("")
75
+
76
+ var canv = document.createElement("canvas");
77
+ canv.id = "canvas";
78
+ canv.width = width.value;
79
+ canv.height = 50;
80
+ var ctx = canv.getContext("2d");
81
+ ctx.font = "25px Georgia";
82
+ ctx.strokeText(captcha.value.join(""), 0, 30);
83
+
84
+ const captchaElement = captchaRef.value;
82
85
 
83
- props: {
84
- size: {
85
- type: String,
86
- default: "6"
87
- },
88
- color: {
89
- type: String,
90
- default: "primary"
91
- },
92
- value: {
93
- type: Boolean
94
- },
95
- textFieldLabel: {
96
- type: String,
97
- default: "Text"
98
- },
99
- refreshButtonLabel: {
100
- type: String,
101
- default: "Refresh"
102
- }
86
+ if (captchaElement != null) {
87
+ captchaElement.innerHTML = "";
88
+ captchaElement.appendChild(canv);
103
89
  }
104
90
  };
105
91
  </script>
package/src/globals.js ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Use globally in wordpress context
3
+ *
4
+ * @param {string} url
5
+ */
6
+ function setFaviconUrl(url) {
7
+ let link = document.querySelector("link[rel~='icon']");
8
+ if (!link) {
9
+ link = document.createElement("link");
10
+ link.rel = "icon";
11
+ document.head.appendChild(link);
12
+ }
13
+ link.href = url;
14
+ }
15
+
16
+ /**
17
+ * <script src="https://unpkg.com/@sedoo/unidoo/src/globals.js"></script>
18
+ <ftp-main-app></ftp-main-app>
19
+ <script>
20
+ setFavicon('https://wpedu2.sedoo.fr/wp-content-omp/uploads/sites/67/2025/09/sftpFavicon.png');
21
+ </script>
22
+ */
package/src/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { default as Unidoo } from '@/plugin.js'
2
+
3
+ export { createAlertService} from '@/services/alertService.js'
4
+ export { createUuidService } from '@/services/uuidService.js'
5
+
6
+ export { default as UnidooSnackbar } from '@/components/UnidooAlert.vue'
7
+ export { default as UnidooCaptcha } from '@/components/UnidooCaptcha.vue'