@timus-networks/theme 1.0.143 → 1.0.145

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/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@timus-networks/theme",
3
- "version": "1.0.143",
3
+ "version": "1.0.145",
4
4
  "description": "A comprehensive Nuxt.js module providing a tailored theme experience with integrated TailwindCSS support for applications.",
5
5
  "main": "module.js",
6
6
  "types": "index.d.ts",
7
+ "typings": "./index.d.ts",
8
+ "author": "Serkan Konakcı<serkan.konakci@timusnetworks.com>",
9
+ "license": "MIT",
7
10
  "scripts": {
8
11
  "test": "echo \"Error: no test specified\" && exit 1",
9
12
  "convert-js": "node convert-js.js",
@@ -25,8 +28,6 @@
25
28
  "peerDependencies": {
26
29
  "vue": "*"
27
30
  },
28
- "author": "Serkan Konakcı<serkan.konakci@timusnetworks.com>",
29
- "license": "MIT",
30
31
  "dependencies": {
31
32
  "@nuxtjs/tailwindcss": "*",
32
33
  "sass": "*",
@@ -37,6 +38,5 @@
37
38
  "glob": "*",
38
39
  "sass": "*",
39
40
  "sass-loader": "*"
40
- },
41
- "typings": "./index.d.ts"
41
+ }
42
42
  }
@@ -10,13 +10,15 @@ import Vue from 'vue';
10
10
  const StringConverter = function (str) {
11
11
  console.log('convertera geldi', this, str);
12
12
  // `str` parametresini HTML olarak kabul edip onu güvenli bir string'e dönüştürmelisiniz
13
+
13
14
  return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
14
- }
15
+ };
15
16
 
16
17
  Vue.directive('str', {
17
18
  bind: (el, binding) => {
18
19
  // `binding.value` ile elementin içeriğini alabilirsiniz
19
20
  const convertedString = StringConverter(binding.value);
21
+
20
22
  el.innerHTML = convertedString; // İçeriği güncelleyin
21
23
  el.style.opacity = '0';
22
24
  console.log('bind', el);
@@ -27,7 +29,8 @@ Vue.directive('str', {
27
29
  },
28
30
  update: (el, binding) => {
29
31
  const convertedString = StringConverter(binding.value);
32
+
30
33
  el.innerHTML = convertedString;
31
34
  console.log('update', el);
32
35
  },
33
- })
36
+ });
@@ -1,10 +1,11 @@
1
1
  import Vue from 'vue';
2
2
 
3
+ // eslint-disable-next-line no-restricted-imports
4
+ import components from '../components-js/exporter';
5
+
3
6
  // get options passed from module.js
4
7
  const options = JSON.parse(`<%= JSON.stringify(options) %>`);
5
8
 
6
- import components from '../components-js/exporter';
7
-
8
9
  // loop through components and register them
9
10
  for (const name in components) {
10
11
  Vue.component(name, {
@@ -1,26 +1,30 @@
1
1
  import Vue from 'vue';
2
+
2
3
  /**
3
4
  * Helper functions to handle localStorage safely
4
5
  */
5
6
  function getDarkModeFromLocalStorage() {
6
- return process.client && localStorage.getItem('darkMode') === 'true';
7
+ return process.client && localStorage.getItem('darkMode') === 'true';
7
8
  }
9
+
8
10
  function setDarkModeToLocalStorage(value) {
9
- if (process.client) {
10
- localStorage.setItem('darkMode', value.toString());
11
- }
11
+ if (process.client) {
12
+ localStorage.setItem('darkMode', value.toString());
13
+ }
12
14
  }
15
+
13
16
  function setHtmlDarkClass(isDark) {
14
- if (process.client) {
15
- const htmlElement = document.documentElement;
16
- if (isDark) {
17
- htmlElement.classList.add('dark');
18
- }
19
- else {
20
- htmlElement.classList.remove('dark');
21
- }
17
+ if (process.client) {
18
+ const htmlElement = document.documentElement;
19
+
20
+ if (isDark) {
21
+ htmlElement.classList.add('dark');
22
+ } else {
23
+ htmlElement.classList.remove('dark');
22
24
  }
25
+ }
23
26
  }
27
+
24
28
  /**
25
29
  * ThemeProvider: A Vue instance to provide theme related functionalities.
26
30
  *
@@ -32,37 +36,37 @@ function setHtmlDarkClass(isDark) {
32
36
  * this.$theme.$on('darkMode', (value) => { console.log('darkMode:', value); });
33
37
  */
34
38
  export const ThemeProvider = new Vue({
35
- data() {
36
- return {
37
- isDarkMode: getDarkModeFromLocalStorage(),
38
- };
39
- },
40
- computed: {
41
- isDark: {
42
- get() {
43
- return this.isDarkMode;
44
- },
45
- set(value) {
46
- this.isDarkMode = value;
47
- setDarkModeToLocalStorage(value);
48
- this.$emit('darkMode', value);
49
- },
50
- },
51
- },
52
- watch: {
53
- isDark(newVal) {
54
- setHtmlDarkClass(newVal);
55
- },
39
+ data() {
40
+ return {
41
+ isDarkMode: getDarkModeFromLocalStorage(),
42
+ };
43
+ },
44
+ computed: {
45
+ isDark: {
46
+ get() {
47
+ return this.isDarkMode;
48
+ },
49
+ set(value) {
50
+ this.isDarkMode = value;
51
+ setDarkModeToLocalStorage(value);
52
+ this.$emit('darkMode', value);
53
+ },
56
54
  },
57
- methods: {
58
- setDarkMode(value) {
59
- this.isDark = value; // This will trigger the setter of isDark.
60
- },
55
+ },
56
+ watch: {
57
+ isDark(newVal) {
58
+ setHtmlDarkClass(newVal);
61
59
  },
62
- created() {
63
- setHtmlDarkClass(this.isDark); // Sayfa yüklendiğinde fonksiyonu manuel olarak tetikle
60
+ },
61
+ created() {
62
+ setHtmlDarkClass(this.isDark); // Sayfa yüklendiğinde fonksiyonu manuel olarak tetikle
63
+ },
64
+ methods: {
65
+ setDarkMode(value) {
66
+ this.isDark = value; // This will trigger the setter of isDark.
64
67
  },
68
+ },
65
69
  });
66
70
  export default (context, inject) => {
67
- inject('theme', ThemeProvider);
71
+ inject('theme', ThemeProvider);
68
72
  };
@@ -1,10 +1,11 @@
1
1
  import Vue from 'vue';
2
2
 
3
+ // eslint-disable-next-line no-restricted-imports
4
+ import components from '../components-ts/exporter';
5
+
3
6
  // get options passed from module.js
4
7
  const options = JSON.parse(`<%= JSON.stringify(options) %>`);
5
8
 
6
- import components from '../components-ts/exporter';
7
-
8
9
  // loop through components and register them
9
10
  for (const name in components) {
10
11
  Vue.component(name, {