@hardimpactdev/craft-ui 0.0.27 → 0.0.29

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.
@@ -23,15 +23,14 @@ function craft() {
23
23
  if (id === "virtual:craft") {
24
24
  return `
25
25
  import { createInertiaApp } from "@inertiajs/vue3";
26
- import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers";
27
- import { createApp, h } from "vue";
28
26
  import { i18n } from "@hardimpactdev/craft-ui";
29
27
  import { TooltipProvider } from "reka-ui";
28
+ import { createApp, h } from "vue";
30
29
 
31
30
  const appName = import.meta.env.VITE_APP_NAME || "Laravel";
32
31
 
33
32
  export function initializeCraft(options) {
34
- const { enhanceVue, layouts } = options || {};
33
+ const { withApp: userWithApp, layout } = options || {};
35
34
 
36
35
  return createInertiaApp({
37
36
  title: (title) => \`\${title} - \${appName}\`,
@@ -42,37 +41,18 @@ function craft() {
42
41
 
43
42
  const page = pages[\`/resources/js/pages/\${name}.vue\`];
44
43
 
45
- let defaultLayout = undefined;
46
-
47
- if (layouts) {
48
- Object.entries(layouts).forEach(([key, value]) => {
49
- if(name.startsWith(key)) {
50
- defaultLayout = value;
51
- }
52
-
53
- if(!defaultLayout && layouts.default) {
54
- defaultLayout = layouts.default;
55
- }
56
- });
57
- }
58
-
59
- if(!page) {
60
- const errorMessage = \`Page not found: \${name}.vue\`;
61
-
62
- console.error(\`[Inertia] \${errorMessage}\`);
44
+ if (!page) {
45
+ console.error(\`[Inertia] Page not found: \${name}.vue\`);
63
46
  }
64
47
 
65
- page.default.layout = defaultLayout;
66
48
  return page;
67
49
  },
50
+ layout,
68
51
  setup({ el, App, props, plugin }) {
69
- // Get the language files and transform the paths
70
52
  const langGlob = import.meta.glob("/lang/*.json", { eager: true });
71
53
 
72
- // Transform absolute paths to relative paths expected by i18n
73
54
  const transformedLangs = {};
74
55
  Object.entries(langGlob).forEach(([absolutePath, module]) => {
75
- // Convert "/lang/en.json" to "../../lang/en.json"
76
56
  const relativePath = absolutePath.replace('/lang/', '../../lang/');
77
57
  transformedLangs[relativePath] = module;
78
58
  });
@@ -84,8 +64,8 @@ function craft() {
84
64
  changeLanguageRoute: '/change-language',
85
65
  });
86
66
 
87
- if (enhanceVue) {
88
- app = enhanceVue(app);
67
+ if (userWithApp) {
68
+ userWithApp(app, { ssr: false });
89
69
  }
90
70
 
91
71
  app.mount(el);
@@ -1,4 +1,6 @@
1
1
  import { loadEnv } from "vite";
2
+ import { readFileSync } from "fs";
3
+ import { homedir } from "os";
2
4
  function getServerConfig(mode) {
3
5
  const env = loadEnv(mode, process.cwd());
4
6
  const appUrl = env.VITE_APP_URL;
@@ -13,23 +15,27 @@ function getServerConfig(mode) {
13
15
  }
14
16
  try {
15
17
  const url = new URL(appUrl);
16
- const isHttps = url.protocol === "https:";
18
+ const certsPath = `${homedir()}/.config/orbit/certs`;
17
19
  return {
18
20
  // Accept connections from reverse proxy
19
- host: "0.0.0.0",
20
- // Tell Vite the public origin for asset URLs
21
- origin: appUrl,
22
- // Configure HMR to connect through the reverse proxy
23
- // Without this, browser would try localhost:5173 directly
24
- hmr: {
25
- host: url.hostname,
26
- protocol: isHttps ? "wss" : "ws",
27
- clientPort: isHttps ? 443 : parseInt(url.port) || 80
28
- },
21
+ host: url.hostname,
22
+ // // Tell Vite the public origin for asset URLs
23
+ // origin: appUrl,
24
+ // // Configure HMR to connect through the reverse proxy
25
+ // // Without this, browser would try localhost:5173 directly
26
+ // hmr: {
27
+ // host: url.hostname,
28
+ // protocol: isHttps ? 'wss' : 'ws',
29
+ // clientPort: isHttps ? 443 : (parseInt(url.port) || 80),
30
+ // },
29
31
  // Prevent ELOOP errors from circular symlinks in workspaces
30
32
  watch: {
31
33
  followSymlinks: false,
32
34
  ignored: ["**/vendor/**", "**/node_modules/**"]
35
+ },
36
+ https: {
37
+ key: readFileSync(`${certsPath}/wildcard.key`),
38
+ cert: readFileSync(`${certsPath}/wildcard.crt`)
33
39
  }
34
40
  };
35
41
  } catch {
@@ -26,15 +26,14 @@ export function craft() {
26
26
  if (id === 'virtual:craft') {
27
27
  return `
28
28
  import { createInertiaApp } from "@inertiajs/vue3";
29
- import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers";
30
- import { createApp, h } from "vue";
31
29
  import { i18n } from "@hardimpactdev/craft-ui";
32
30
  import { TooltipProvider } from "reka-ui";
31
+ import { createApp, h } from "vue";
33
32
 
34
33
  const appName = import.meta.env.VITE_APP_NAME || "Laravel";
35
34
 
36
35
  export function initializeCraft(options) {
37
- const { enhanceVue, layouts } = options || {};
36
+ const { withApp: userWithApp, layout } = options || {};
38
37
 
39
38
  return createInertiaApp({
40
39
  title: (title) => \`\${title} - \${appName}\`,
@@ -45,37 +44,18 @@ export function craft() {
45
44
 
46
45
  const page = pages[\`/resources/js/pages/\${name}.vue\`];
47
46
 
48
- let defaultLayout = undefined;
49
-
50
- if (layouts) {
51
- Object.entries(layouts).forEach(([key, value]) => {
52
- if(name.startsWith(key)) {
53
- defaultLayout = value;
54
- }
55
-
56
- if(!defaultLayout && layouts.default) {
57
- defaultLayout = layouts.default;
58
- }
59
- });
60
- }
61
-
62
- if(!page) {
63
- const errorMessage = \`Page not found: \${name}.vue\`;
64
-
65
- console.error(\`[Inertia] \${errorMessage}\`);
47
+ if (!page) {
48
+ console.error(\`[Inertia] Page not found: \${name}.vue\`);
66
49
  }
67
50
 
68
- page.default.layout = defaultLayout;
69
51
  return page;
70
52
  },
53
+ layout,
71
54
  setup({ el, App, props, plugin }) {
72
- // Get the language files and transform the paths
73
55
  const langGlob = import.meta.glob("/lang/*.json", { eager: true });
74
56
 
75
- // Transform absolute paths to relative paths expected by i18n
76
57
  const transformedLangs = {};
77
58
  Object.entries(langGlob).forEach(([absolutePath, module]) => {
78
- // Convert "/lang/en.json" to "../../lang/en.json"
79
59
  const relativePath = absolutePath.replace('/lang/', '../../lang/');
80
60
  transformedLangs[relativePath] = module;
81
61
  });
@@ -87,8 +67,8 @@ export function craft() {
87
67
  changeLanguageRoute: '/change-language',
88
68
  });
89
69
 
90
- if (enhanceVue) {
91
- app = enhanceVue(app);
70
+ if (userWithApp) {
71
+ userWithApp(app, { ssr: false });
92
72
  }
93
73
 
94
74
  app.mount(el);
@@ -1,5 +1,7 @@
1
1
  import { loadEnv } from 'vite';
2
2
  import type { ServerOptions } from 'vite';
3
+ import { readFileSync } from 'fs';
4
+ import { homedir } from 'os';
3
5
 
4
6
  /**
5
7
  * Configure Vite dev server for Laravel apps behind a reverse proxy (Caddy/nginx)
@@ -25,28 +27,34 @@ export function getServerConfig(mode: string): ServerOptions {
25
27
 
26
28
  try {
27
29
  const url = new URL(appUrl);
28
- const isHttps = url.protocol === 'https:';
30
+
31
+ const certsPath = `${homedir()}/.config/orbit/certs`;
29
32
 
30
33
  return {
31
34
  // Accept connections from reverse proxy
32
- host: '0.0.0.0',
35
+ host: url.hostname,
33
36
 
34
- // Tell Vite the public origin for asset URLs
35
- origin: appUrl,
37
+ // // Tell Vite the public origin for asset URLs
38
+ // origin: appUrl,
36
39
 
37
- // Configure HMR to connect through the reverse proxy
38
- // Without this, browser would try localhost:5173 directly
39
- hmr: {
40
- host: url.hostname,
41
- protocol: isHttps ? 'wss' : 'ws',
42
- clientPort: isHttps ? 443 : (parseInt(url.port) || 80),
43
- },
40
+ // // Configure HMR to connect through the reverse proxy
41
+ // // Without this, browser would try localhost:5173 directly
42
+ // hmr: {
43
+ // host: url.hostname,
44
+ // protocol: isHttps ? 'wss' : 'ws',
45
+ // clientPort: isHttps ? 443 : (parseInt(url.port) || 80),
46
+ // },
44
47
 
45
48
  // Prevent ELOOP errors from circular symlinks in workspaces
46
49
  watch: {
47
50
  followSymlinks: false,
48
51
  ignored: ['**/vendor/**', '**/node_modules/**'],
49
52
  },
53
+
54
+ https: {
55
+ key: readFileSync(`${certsPath}/wildcard.key`),
56
+ cert: readFileSync(`${certsPath}/wildcard.crt`),
57
+ },
50
58
  };
51
59
  } catch {
52
60
  return {
package/package.json CHANGED
@@ -57,7 +57,7 @@
57
57
  "types": "./dist/src/vite/defineCraftConfig.d.ts"
58
58
  }
59
59
  },
60
- "version": "0.0.27",
60
+ "version": "0.0.29",
61
61
  "type": "module",
62
62
  "scripts": {
63
63
  "dev": "vite",
@@ -79,8 +79,8 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@iconify/vue": "^5.0.0",
82
- "@inertiajs/core": "^2.3.16",
83
- "@inertiajs/vue3": "^2.3.16",
82
+ "@inertiajs/core": "3.0.0-beta.5",
83
+ "@inertiajs/vue3": "3.0.0-beta.5",
84
84
  "@tailwindcss/vite": "^4.2.1",
85
85
  "@tanstack/vue-table": "^8.21.3",
86
86
  "@tiptap/extension-bubble-menu": "^3.20.0",
@@ -98,7 +98,7 @@
98
98
  "class-variance-authority": "^0.7.1",
99
99
  "clsx": "^2.1.1",
100
100
  "embla-carousel-vue": "^8.6.0",
101
- "laravel-vite-plugin": "^2.1.0",
101
+ "laravel-vite-plugin": "^2.1.0 || ^3.0.0",
102
102
  "laravel-vue-i18n": "^2.8.0",
103
103
  "lucide-vue-next": "^0.575.0",
104
104
  "marked": "^17.0.3",
@@ -144,10 +144,10 @@
144
144
  "vue-tsc": "^3.2.5"
145
145
  },
146
146
  "peerDependencies": {
147
- "@inertiajs/vue3": "^2.0.0",
147
+ "@inertiajs/vue3": "^2.0.0 || ^3.0.0-beta.0",
148
148
  "@tailwindcss/vite": "^4.0.0",
149
149
  "@vitejs/plugin-vue": "^6.0.0",
150
- "laravel-vite-plugin": "^2.0.1",
150
+ "laravel-vite-plugin": "^2.0.1 || ^3.0.0",
151
151
  "laravel-vue-i18n": "^2.8.0",
152
152
  "vite-plugin-run": "^0.6.0",
153
153
  "vite-plugin-vue-devtools": "^8.0.0",