@creopse/bridge 0.0.1 → 0.1.1

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.
@@ -0,0 +1,16 @@
1
+ import { Bool as e } from "@creopse/utils";
2
+ import { ref as r } from "vue";
3
+ import { useI18n as t } from "vue-i18n";
4
+ const s = () => {
5
+ const { locale: o } = t();
6
+ return {
7
+ defaultPrefs: r({
8
+ inAppNotifEnabled: e.TRUE,
9
+ emailNotifEnabled: e.TRUE,
10
+ locale: o.value
11
+ })
12
+ };
13
+ };
14
+ export {
15
+ s as useUserPreference
16
+ };
package/package.json CHANGED
@@ -1,41 +1,112 @@
1
1
  {
2
2
  "name": "@creopse/bridge",
3
3
  "description": "Creopse Bridge Toolkit",
4
- "version": "0.0.1",
4
+ "version": "0.1.1",
5
5
  "private": false,
6
6
  "author": "Noé Gnanih <noegnanih@gmail.com>",
7
7
  "license": "MIT",
8
8
  "type": "module",
9
9
  "main": "dist/index.js",
10
10
  "exports": {
11
- "./vite": "./dist/vite/index.js",
12
- "./vite/vue": "./dist/vite/vue.js",
13
- "./vite/react": "./dist/vite/react.js",
14
- "./vue": "./dist/vue/index.js",
15
- "./react": "./dist/react/index.js",
16
- "./shared": "./dist/shared/index.js"
11
+ "./vite": {
12
+ "types": "./dist/vite/index.d.ts",
13
+ "import": "./dist/vite/index.js"
14
+ },
15
+ "./vite/vue": {
16
+ "types": "./dist/vite/vue.d.ts",
17
+ "import": "./dist/vite/vue.js"
18
+ },
19
+ "./vite/react": {
20
+ "types": "./dist/vite/react.d.ts",
21
+ "import": "./dist/vite/react.js"
22
+ },
23
+ "./vue": {
24
+ "types": "./dist/vue/index.d.ts",
25
+ "import": "./dist/vue/index.js"
26
+ },
27
+ "./react": {
28
+ "types": "./dist/react/index.d.ts",
29
+ "import": "./dist/react/index.js"
30
+ },
31
+ "./shared": {
32
+ "types": "./dist/shared/index.d.ts",
33
+ "import": "./dist/shared/index.js"
34
+ }
17
35
  },
18
36
  "types": "dist/index.d.ts",
19
37
  "files": [
20
38
  "dist",
21
39
  "README.md"
22
40
  ],
41
+ "peerDependencies": {
42
+ "@iconify/react": "^6.0.2",
43
+ "@iconify/vue": "^5.0.0",
44
+ "@vueuse/core": "^10.11.1",
45
+ "naive-ui": "^2.44.1",
46
+ "pinia": "^3.0.0",
47
+ "react": "^19.2.4",
48
+ "react-dom": "^19.2.4",
49
+ "vue": "^3.5.27",
50
+ "vue-i18n": "^11.3.0",
51
+ "vue-router": "^4.0.0",
52
+ "zustand": "^5.0.12"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "naive-ui": {
56
+ "optional": true
57
+ },
58
+ "@vueuse/core": {
59
+ "optional": true
60
+ },
61
+ "@iconify/vue": {
62
+ "optional": true
63
+ },
64
+ "@iconify/react": {
65
+ "optional": true
66
+ },
67
+ "vue": {
68
+ "optional": true
69
+ },
70
+ "vue-i18n": {
71
+ "optional": true
72
+ },
73
+ "vue-router": {
74
+ "optional": true
75
+ },
76
+ "pinia": {
77
+ "optional": true
78
+ },
79
+ "react": {
80
+ "optional": true
81
+ },
82
+ "react-dom": {
83
+ "optional": true
84
+ },
85
+ "zustand": {
86
+ "optional": true
87
+ }
88
+ },
89
+ "dependencies": {
90
+ "framer-motion": "^12.23.9",
91
+ "@creopse/utils": "0.1.1"
92
+ },
23
93
  "devDependencies": {
24
94
  "@originjs/vite-plugin-federation": "^1.4.1",
95
+ "@types/react": "^19.2.4",
96
+ "@types/react-dom": "^19.1.6",
25
97
  "@vitejs/plugin-basic-ssl": "^2.3.0",
26
98
  "@vitejs/plugin-react": "^4.6.0",
27
- "@vitejs/plugin-vue": "^6.0.0",
99
+ "@vitejs/plugin-vue": "^6.0.5",
28
100
  "comment-json": "^4.6.2",
29
101
  "rollup-plugin-copy": "^3.5.0",
30
- "tsc-alias": "^1.8.16",
102
+ "tsx": "^4.21.0",
31
103
  "typescript": "~5.8.3",
32
104
  "unocss": "^66.6.7",
33
105
  "vite": "^7.0.5",
34
- "vite-plugin-auto-import-lite": "^0.0.2",
35
106
  "vite-plugin-i18next-loader": "^3.1.3",
107
+ "vite-plugin-auto-import-lite": "^0.0.2",
36
108
  "vite-plugin-json5": "^1.2.0",
37
- "vite-plugin-top-level-await": "^1.6.0",
38
- "@creopse/utils": "0.0.16"
109
+ "vite-plugin-top-level-await": "^1.6.0"
39
110
  },
40
111
  "repository": {
41
112
  "type": "git",
@@ -50,6 +121,6 @@
50
121
  "access": "public"
51
122
  },
52
123
  "scripts": {
53
- "build": "tsc -b && tsc-alias"
124
+ "build": "tsx build.ts"
54
125
  }
55
126
  }
@@ -1,2 +0,0 @@
1
- export declare const DASHBOARD_MODULE_NAME = "PluginDashboard";
2
- export declare const SETTINGS_MODULE_NAME = "PluginSettings";
@@ -1,3 +0,0 @@
1
- // Modules
2
- export const DASHBOARD_MODULE_NAME = 'PluginDashboard';
3
- export const SETTINGS_MODULE_NAME = 'PluginSettings';
@@ -1,33 +0,0 @@
1
- /**
2
- * Returns the base URL of the current window location.
3
- *
4
- * @return {string} The base URL of the current window location.
5
- */
6
- export declare const getBaseUrl: () => string;
7
- /**
8
- * Returns the URL of the current page by appending the base URL with the pathname.
9
- *
10
- * @return {string} The URL of the current page.
11
- */
12
- export declare const getPageUrl: () => string;
13
- /**
14
- * Removes the trailing slash from a given path.
15
- *
16
- * @param {string} path - The path to remove the trailing slash from.
17
- * @return {string} The path without the trailing slash.
18
- */
19
- export declare const removeTrailingSlash: (path: string) => string;
20
- /**
21
- * Determines if a given string is a valid JSON string representing an object.
22
- *
23
- * @param {string} str - The string to be checked.
24
- * @return {boolean} Returns true if the string is a valid JSON string of an object, false otherwise.
25
- */
26
- export declare const isStringifiedObject: (str: string) => boolean;
27
- /**
28
- * Sanitizes an ID by removing any characters that are not a letter, number, slash, or dash and replacing any slashes with dashes.
29
- *
30
- * @param {string} id - The ID to be sanitized.
31
- * @return {string} The sanitized ID.
32
- */
33
- export declare const sanitizeId: (id: string) => string;
@@ -1,53 +0,0 @@
1
- /**
2
- * Returns the base URL of the current window location.
3
- *
4
- * @return {string} The base URL of the current window location.
5
- */
6
- export const getBaseUrl = () => {
7
- const { protocol, hostname, port } = window.location;
8
- return protocol + '//' + hostname + (port ? `:${port}` : '');
9
- };
10
- /**
11
- * Returns the URL of the current page by appending the base URL with the pathname.
12
- *
13
- * @return {string} The URL of the current page.
14
- */
15
- export const getPageUrl = () => {
16
- return getBaseUrl() + window.location.pathname;
17
- };
18
- /**
19
- * Removes the trailing slash from a given path.
20
- *
21
- * @param {string} path - The path to remove the trailing slash from.
22
- * @return {string} The path without the trailing slash.
23
- */
24
- export const removeTrailingSlash = (path) => {
25
- if (path.length > 1 && path.charAt(path.length - 1) === '/') {
26
- return path.substring(0, path.length - 1);
27
- }
28
- return path;
29
- };
30
- /**
31
- * Determines if a given string is a valid JSON string representing an object.
32
- *
33
- * @param {string} str - The string to be checked.
34
- * @return {boolean} Returns true if the string is a valid JSON string of an object, false otherwise.
35
- */
36
- export const isStringifiedObject = (str) => {
37
- try {
38
- const parsed = JSON.parse(str);
39
- return (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed));
40
- }
41
- catch (e) {
42
- return false;
43
- }
44
- };
45
- /**
46
- * Sanitizes an ID by removing any characters that are not a letter, number, slash, or dash and replacing any slashes with dashes.
47
- *
48
- * @param {string} id - The ID to be sanitized.
49
- * @return {string} The sanitized ID.
50
- */
51
- export const sanitizeId = (id) => {
52
- return id.replace(/[^a-z0-9\/-]/g, '').replace(/\//g, '-');
53
- };
@@ -1,2 +0,0 @@
1
- export * from './vue';
2
- export * from './react';
@@ -1,45 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export interface CreopseReactPluginOptions {
3
- /**
4
- * Path to the manifest.jsonc file, relative to the project root.
5
- * @default './manifest.jsonc'
6
- */
7
- manifestPath?: string;
8
- /**
9
- * Source directory, relative to the project root.
10
- * @default './src'
11
- */
12
- srcDir?: string;
13
- /**
14
- * Output directory for the build.
15
- * @default 'frontend'
16
- */
17
- outDir?: string;
18
- /**
19
- * Path to the i18n locales directory, relative to the project root.
20
- * @default './src/i18n/locales'
21
- */
22
- i18nLocalesPath?: string;
23
- /**
24
- * Directories to scan for auto-imports, relative to the project root.
25
- * @default ['src/hooks']
26
- */
27
- hooksDirs?: string[];
28
- /**
29
- * Shared modules for Module Federation.
30
- * 'react', 'react-dom' and 'zustand' are always included.
31
- * @default []
32
- */
33
- shared?: string[];
34
- /**
35
- * Whether to enable UnoCSS.
36
- * @default false
37
- */
38
- unocss?: boolean;
39
- /**
40
- * Whether to generate an eslint auto-import config file.
41
- * @default false
42
- */
43
- eslintAutoImport?: boolean;
44
- }
45
- export declare function CreopseReactPlugin(options?: CreopseReactPluginOptions): Plugin;
@@ -1,40 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export interface CreopseVuePluginOptions {
3
- /**
4
- * Path to the manifest.jsonc file, relative to the project root.
5
- * @default './manifest.jsonc'
6
- */
7
- manifestPath?: string;
8
- /**
9
- * Source directory, relative to the project root.
10
- * @default './src'
11
- */
12
- srcDir?: string;
13
- /**
14
- * Output directory for the build.
15
- * @default 'frontend'
16
- */
17
- outDir?: string;
18
- /**
19
- * Path to the i18n locales directory, relative to the project root.
20
- * @default './src/i18n/locales'
21
- */
22
- i18nLocalesPath?: string;
23
- /**
24
- * Directories to scan for auto-imports, relative to the project root.
25
- * @default ['src/composables']
26
- */
27
- composablesDirs?: string[];
28
- /**
29
- * Shared modules for Module Federation.
30
- * The 'vue' and 'pinia' are always included.
31
- * @default []
32
- */
33
- shared?: string[];
34
- /**
35
- * Whether to enable UnoCSS.
36
- * @default false
37
- */
38
- unocss?: boolean;
39
- }
40
- export declare function CreopseVuePlugin(options?: CreopseVuePluginOptions): Plugin;