inertia_rails 3.4.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +6 -7
- data/lib/generators/inertia/controller/controller_generator.rb +18 -0
- data/lib/generators/inertia/controller/templates/controller.rb.tt +10 -0
- data/lib/generators/inertia/install/frameworks.yml +98 -0
- data/lib/generators/inertia/install/helpers.rb +51 -0
- data/lib/generators/inertia/install/install_generator.rb +291 -0
- data/lib/generators/inertia/install/js_package_manager.rb +50 -0
- data/lib/generators/inertia/install/templates/assets/inertia.svg +1 -0
- data/lib/generators/inertia/install/templates/assets/react.svg +1 -0
- data/lib/generators/inertia/install/templates/assets/svelte.svg +1 -0
- data/lib/generators/inertia/install/templates/assets/vite_ruby.svg +1 -0
- data/lib/generators/inertia/install/templates/assets/vue.svg +1 -0
- data/lib/generators/{inertia_rails/install → inertia/install/templates}/controller.rb +3 -1
- data/lib/generators/inertia/install/templates/dev +23 -0
- data/lib/generators/inertia/install/templates/initializer.rb +6 -0
- data/lib/generators/inertia/install/templates/react/InertiaExample.jsx +60 -0
- data/lib/generators/inertia/install/templates/react/InertiaExample.module.css +80 -0
- data/lib/generators/inertia/install/templates/react/InertiaExample.tsx +60 -0
- data/lib/generators/inertia/install/templates/react/inertia.js +45 -0
- data/lib/generators/inertia/install/templates/react/inertia.ts +51 -0
- data/lib/generators/inertia/install/templates/react/tsconfig.app.json +27 -0
- data/lib/generators/inertia/install/templates/react/tsconfig.json +11 -0
- data/lib/generators/inertia/install/templates/react/tsconfig.node.json +13 -0
- data/lib/generators/inertia/install/templates/react/vite-env.d.ts +1 -0
- data/lib/generators/inertia/install/templates/svelte/InertiaExample.svelte +112 -0
- data/lib/generators/inertia/install/templates/svelte/InertiaExample.ts.svelte +112 -0
- data/lib/generators/inertia/install/templates/svelte/inertia.js +44 -0
- data/lib/generators/inertia/install/templates/svelte/inertia.ts.tt +45 -0
- data/lib/generators/inertia/install/templates/svelte/svelte.config.js +7 -0
- data/lib/generators/inertia/install/templates/svelte/tsconfig.json +21 -0
- data/lib/generators/inertia/install/templates/svelte/tsconfig.node.json +12 -0
- data/lib/generators/inertia/install/templates/svelte/vite-env.d.ts +2 -0
- data/lib/generators/inertia/install/templates/svelte4/InertiaExample.svelte +116 -0
- data/lib/generators/inertia/install/templates/svelte4/InertiaExample.ts.svelte +116 -0
- data/lib/generators/inertia/install/templates/svelte4/inertia.js +43 -0
- data/lib/generators/inertia/install/templates/svelte4/inertia.ts.tt +44 -0
- data/lib/generators/inertia/install/templates/svelte4/svelte.config.js +7 -0
- data/lib/generators/inertia/install/templates/svelte4/tsconfig.json +21 -0
- data/lib/generators/inertia/install/templates/svelte4/tsconfig.node.json +12 -0
- data/lib/generators/inertia/install/templates/svelte4/vite-env.d.ts +2 -0
- data/lib/generators/inertia/install/templates/tailwind/application.css +13 -0
- data/lib/generators/inertia/install/templates/tailwind/postcss.config.js +6 -0
- data/lib/generators/inertia/install/templates/tailwind/tailwind.config.js.tt +18 -0
- data/lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue +117 -0
- data/lib/generators/inertia/install/templates/vue/InertiaExample.vue +117 -0
- data/lib/generators/inertia/install/templates/vue/inertia.js +35 -0
- data/lib/generators/inertia/install/templates/vue/inertia.ts +35 -0
- data/lib/generators/inertia/install/templates/vue/tsconfig.app.json +24 -0
- data/lib/generators/inertia/install/templates/vue/tsconfig.json +11 -0
- data/lib/generators/inertia/install/templates/vue/tsconfig.node.json +22 -0
- data/lib/generators/inertia/install/templates/vue/vite-env.d.ts +1 -0
- data/lib/generators/inertia/scaffold/scaffold_generator.rb +16 -0
- data/lib/generators/inertia/scaffold_controller/scaffold_controller_generator.rb +60 -0
- data/lib/generators/inertia/scaffold_controller/templates/controller.rb.tt +100 -0
- data/lib/generators/inertia_templates/controller/controller_generator.rb +12 -0
- data/lib/generators/inertia_templates/controller/templates/react/view.jsx.tt +8 -0
- data/lib/generators/inertia_templates/controller/templates/react/view.tsx.tt +8 -0
- data/lib/generators/inertia_templates/controller/templates/svelte/view.svelte.tt +2 -0
- data/lib/generators/inertia_templates/controller/templates/svelte4/view.svelte.tt +2 -0
- data/lib/generators/inertia_templates/controller/templates/vue/view.vue.tt +4 -0
- data/lib/generators/inertia_templates/scaffold/scaffold_generator.rb +12 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt +35 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/Edit.tsx.tt +40 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/Form.jsx.tt +111 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/Form.tsx.tt +130 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/Index.jsx.tt +26 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/Index.tsx.tt +32 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/New.jsx.tt +27 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/New.tsx.tt +32 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/One.jsx.tt +26 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/One.tsx.tt +32 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/Show.jsx.tt +32 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/Show.tsx.tt +38 -0
- data/lib/generators/inertia_templates/scaffold/templates/react/types.ts.tt +19 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Edit.svelte.tt +36 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Edit.ts.svelte.tt +37 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Form.svelte.tt +97 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Form.ts.svelte.tt +102 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Index.svelte.tt +35 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Index.ts.svelte.tt +39 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/New.svelte.tt +29 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/New.ts.svelte.tt +30 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/One.svelte.tt +28 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/One.ts.svelte.tt +30 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt +35 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/Show.ts.svelte.tt +39 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte/types.ts.tt +19 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Edit.svelte.tt +37 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Edit.ts.svelte.tt +38 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Form.svelte.tt +96 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Form.ts.svelte.tt +106 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Index.svelte.tt +36 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Index.ts.svelte.tt +37 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/New.svelte.tt +30 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/New.ts.svelte.tt +31 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/One.svelte.tt +28 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/One.ts.svelte.tt +30 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Show.svelte.tt +39 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/Show.ts.svelte.tt +40 -0
- data/lib/generators/inertia_templates/scaffold/templates/svelte4/types.ts.tt +19 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/Edit.ts.vue.tt +37 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/Edit.vue.tt +36 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/Form.ts.vue.tt +101 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/Form.vue.tt +94 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/Index.ts.vue.tt +35 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/Index.vue.tt +31 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/New.ts.vue.tt +30 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/New.vue.tt +29 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/One.ts.vue.tt +28 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/One.vue.tt +26 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/Show.ts.vue.tt +41 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/Show.vue.tt +37 -0
- data/lib/generators/inertia_templates/scaffold/templates/vue/types.ts.tt +19 -0
- data/lib/generators/inertia_tw_templates/controller/controller_generator.rb +12 -0
- data/lib/generators/inertia_tw_templates/controller/templates/react/view.jsx.tt +8 -0
- data/lib/generators/inertia_tw_templates/controller/templates/react/view.tsx.tt +8 -0
- data/lib/generators/inertia_tw_templates/controller/templates/svelte/view.svelte.tt +2 -0
- data/lib/generators/inertia_tw_templates/controller/templates/svelte4/view.svelte.tt +2 -0
- data/lib/generators/inertia_tw_templates/controller/templates/vue/view.vue.tt +4 -0
- data/lib/generators/inertia_tw_templates/scaffold/scaffold_generator.rb +12 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.jsx.tt +42 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.tsx.tt +47 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Form.jsx.tt +122 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Form.tsx.tt +142 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Index.jsx.tt +43 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Index.tsx.tt +49 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt +30 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/New.tsx.tt +35 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/One.jsx.tt +26 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/One.tsx.tt +32 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Show.jsx.tt +47 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/Show.tsx.tt +53 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/types.ts.tt +19 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.svelte.tt +44 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.ts.svelte.tt +45 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.svelte.tt +118 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.ts.svelte.tt +123 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.svelte.tt +42 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.ts.svelte.tt +46 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.svelte.tt +32 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.ts.svelte.tt +33 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.svelte.tt +28 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.ts.svelte.tt +30 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.svelte.tt +50 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.ts.svelte.tt +54 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/types.ts.tt +19 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Edit.svelte.tt +45 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Edit.ts.svelte.tt +46 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.svelte.tt +120 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.ts.svelte.tt +130 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.svelte.tt +43 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.ts.svelte.tt +44 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/New.svelte.tt +33 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/New.ts.svelte.tt +34 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.svelte.tt +28 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.ts.svelte.tt +30 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.svelte.tt +51 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.ts.svelte.tt +52 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte4/types.ts.tt +19 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.ts.vue.tt +45 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.vue.tt +44 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.ts.vue.tt +134 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.vue.tt +127 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.ts.vue.tt +47 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.vue.tt +43 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/New.ts.vue.tt +33 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/New.vue.tt +32 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/One.ts.vue.tt +28 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/One.vue.tt +26 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.ts.vue.tt +53 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.vue.tt +49 -0
- data/lib/generators/inertia_tw_templates/scaffold/templates/vue/types.ts.tt +19 -0
- data/lib/inertia_rails/always_prop.rb +6 -0
- data/lib/inertia_rails/base_prop.rb +14 -0
- data/lib/inertia_rails/configuration.rb +1 -1
- data/lib/inertia_rails/controller.rb +8 -1
- data/lib/inertia_rails/generators/controller_template_base.rb +63 -0
- data/lib/inertia_rails/generators/helper.rb +139 -0
- data/lib/inertia_rails/generators/scaffold_template_base.rb +45 -0
- data/lib/inertia_rails/inertia_rails.rb +18 -12
- data/lib/inertia_rails/lazy_prop.rb +20 -0
- data/lib/inertia_rails/renderer.rb +71 -17
- data/lib/inertia_rails/version.rb +1 -1
- data/lib/patches/better_errors.rb +10 -8
- data/lib/patches/debug_exceptions/patch-5-0.rb +7 -3
- data/lib/patches/debug_exceptions/patch-5-1.rb +7 -3
- data/lib/patches/mapper.rb +9 -5
- data/lib/patches/request.rb +10 -6
- metadata +181 -13
- data/lib/generators/inertia_rails/install/react/InertiaExample.jsx +0 -9
- data/lib/generators/inertia_rails/install/react/inertia.jsx +0 -17
- data/lib/generators/inertia_rails/install/svelte/InertiaExample.svelte +0 -11
- data/lib/generators/inertia_rails/install/svelte/inertia.js +0 -14
- data/lib/generators/inertia_rails/install/vue/InertiaExample.vue +0 -11
- data/lib/generators/inertia_rails/install/vue/inertia.js +0 -20
- data/lib/generators/inertia_rails/install_generator.rb +0 -84
- data/lib/inertia_rails/lazy.rb +0 -28
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"extends": "@tsconfig/svelte/tsconfig.json",
|
3
|
+
"compilerOptions": {
|
4
|
+
"target": "ESNext",
|
5
|
+
"useDefineForClassFields": true,
|
6
|
+
"module": "ESNext",
|
7
|
+
"resolveJsonModule": true,
|
8
|
+
/**
|
9
|
+
* Typecheck JS in `.svelte` and `.js` files by default.
|
10
|
+
* Disable checkJs if you'd like to use dynamic types in JS.
|
11
|
+
* Note that setting allowJs false does not prevent the use
|
12
|
+
* of JS in `.svelte` files.
|
13
|
+
*/
|
14
|
+
"allowJs": true,
|
15
|
+
"checkJs": true,
|
16
|
+
"isolatedModules": true,
|
17
|
+
"moduleDetection": "force",
|
18
|
+
},
|
19
|
+
"include": ["<%= js_destination_path %>/**/*.ts", "<%= js_destination_path %>/**/*.js", "<%= js_destination_path %>/**/*.svelte"],
|
20
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
21
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"composite": true,
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
5
|
+
"skipLibCheck": true,
|
6
|
+
"module": "ESNext",
|
7
|
+
"moduleResolution": "bundler",
|
8
|
+
"strict": true,
|
9
|
+
"noEmit": true,
|
10
|
+
},
|
11
|
+
"include": ["vite.config.ts"]
|
12
|
+
}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<script>
|
2
|
+
import svelteSvg from '/assets/svelte.svg'
|
3
|
+
import inertiaSvg from '/assets/inertia.svg'
|
4
|
+
import viteRubySvg from '/assets/vite_ruby.svg'
|
5
|
+
|
6
|
+
export let name
|
7
|
+
|
8
|
+
let count = 0
|
9
|
+
|
10
|
+
function handleClick() {
|
11
|
+
count += 1
|
12
|
+
}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<svelte:head>
|
16
|
+
<title>Inertia + Vite Ruby + Svelte Example</title>
|
17
|
+
</svelte:head>
|
18
|
+
|
19
|
+
<div class="inertia_example">
|
20
|
+
<h1>Hello {name}!</h1>
|
21
|
+
|
22
|
+
<div>
|
23
|
+
<a href="https://inertia-rails.netlify.app" target="_blank">
|
24
|
+
<img class="logo" src={inertiaSvg} alt="Inertia logo" />
|
25
|
+
</a>
|
26
|
+
<a href="https://vite-ruby.netlify.app" target="_blank">
|
27
|
+
<img class="logo vite" src={viteRubySvg} alt="Vite Ruby logo" />
|
28
|
+
</a>
|
29
|
+
<a href="https://svelte.dev" target="_blank">
|
30
|
+
<img class="logo svelte" src={svelteSvg} alt="Svelte logo" />
|
31
|
+
</a>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<h2>Inertia + Vite Ruby + Svelte</h2>
|
35
|
+
|
36
|
+
<div class="card">
|
37
|
+
<button on:click={handleClick}>
|
38
|
+
count is {count}
|
39
|
+
</button>
|
40
|
+
<p>
|
41
|
+
Edit <code>app/frontend/pages/InertiaExample.svelte</code> and save to test
|
42
|
+
HMR
|
43
|
+
</p>
|
44
|
+
</div>
|
45
|
+
<p class="read-the-docs">
|
46
|
+
Click on the Inertia, Vite Ruby, and Svelte logos to learn more
|
47
|
+
</p>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<style>
|
51
|
+
.inertia_example {
|
52
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
53
|
+
line-height: 1.5;
|
54
|
+
font-weight: 400;
|
55
|
+
color: #213547;
|
56
|
+
background-color: #ffffff;
|
57
|
+
max-width: 1280px;
|
58
|
+
margin: 0 auto;
|
59
|
+
padding: 2rem;
|
60
|
+
text-align: center;
|
61
|
+
}
|
62
|
+
|
63
|
+
h1 {
|
64
|
+
font-size: 3.2em;
|
65
|
+
line-height: 1.1;
|
66
|
+
}
|
67
|
+
|
68
|
+
h2 {
|
69
|
+
font-size: 2.6em;
|
70
|
+
line-height: 1.1;
|
71
|
+
}
|
72
|
+
|
73
|
+
button {
|
74
|
+
border-radius: 8px;
|
75
|
+
border: 1px solid transparent;
|
76
|
+
padding: 0.6em 1.2em;
|
77
|
+
font-size: 1em;
|
78
|
+
font-weight: 500;
|
79
|
+
font-family: inherit;
|
80
|
+
background-color: #f9f9f9;
|
81
|
+
cursor: pointer;
|
82
|
+
transition: border-color 0.25s;
|
83
|
+
}
|
84
|
+
button:hover {
|
85
|
+
border-color: #646cff;
|
86
|
+
}
|
87
|
+
button:focus,
|
88
|
+
button:focus-visible {
|
89
|
+
outline: 4px auto -webkit-focus-ring-color;
|
90
|
+
}
|
91
|
+
|
92
|
+
.logo {
|
93
|
+
display: inline-block;
|
94
|
+
height: 6em;
|
95
|
+
padding: 1.5em;
|
96
|
+
will-change: filter;
|
97
|
+
transition: filter 300ms;
|
98
|
+
}
|
99
|
+
.logo:hover {
|
100
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
101
|
+
}
|
102
|
+
.logo.vite:hover {
|
103
|
+
filter: drop-shadow(0 0 2em #e4023baa);
|
104
|
+
}
|
105
|
+
.logo.svelte:hover {
|
106
|
+
filter: drop-shadow(0 0 2em #ff3e00aa);
|
107
|
+
}
|
108
|
+
|
109
|
+
.card {
|
110
|
+
padding: 2em;
|
111
|
+
}
|
112
|
+
|
113
|
+
.read-the-docs {
|
114
|
+
color: #888;
|
115
|
+
}
|
116
|
+
</style>
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<script lang="ts">
|
2
|
+
import svelteSvg from '/assets/svelte.svg'
|
3
|
+
import inertiaSvg from '/assets/inertia.svg'
|
4
|
+
import viteRubySvg from '/assets/vite_ruby.svg'
|
5
|
+
|
6
|
+
export let name: string
|
7
|
+
|
8
|
+
let count = 0
|
9
|
+
|
10
|
+
function handleClick() {
|
11
|
+
count += 1
|
12
|
+
}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<svelte:head>
|
16
|
+
<title>Inertia + Vite Ruby + Svelte Example</title>
|
17
|
+
</svelte:head>
|
18
|
+
|
19
|
+
<div class="inertia_example">
|
20
|
+
<h1>Hello {name}!</h1>
|
21
|
+
|
22
|
+
<div>
|
23
|
+
<a href="https://inertia-rails.netlify.app" target="_blank">
|
24
|
+
<img class="logo" src={inertiaSvg} alt="Inertia logo" />
|
25
|
+
</a>
|
26
|
+
<a href="https://vite-ruby.netlify.app" target="_blank">
|
27
|
+
<img class="logo vite" src={viteRubySvg} alt="Vite Ruby logo" />
|
28
|
+
</a>
|
29
|
+
<a href="https://svelte.dev" target="_blank">
|
30
|
+
<img class="logo svelte" src={svelteSvg} alt="Svelte logo" />
|
31
|
+
</a>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<h2>Inertia + Vite Ruby + Svelte</h2>
|
35
|
+
|
36
|
+
<div class="card">
|
37
|
+
<button on:click={handleClick}>
|
38
|
+
count is {count}
|
39
|
+
</button>
|
40
|
+
<p>
|
41
|
+
Edit <code>app/frontend/pages/InertiaExample.svelte</code> and save to test
|
42
|
+
HMR
|
43
|
+
</p>
|
44
|
+
</div>
|
45
|
+
<p class="read-the-docs">
|
46
|
+
Click on the Inertia, Vite Ruby, and Svelte logos to learn more
|
47
|
+
</p>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<style>
|
51
|
+
.inertia_example {
|
52
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
53
|
+
line-height: 1.5;
|
54
|
+
font-weight: 400;
|
55
|
+
color: #213547;
|
56
|
+
background-color: #ffffff;
|
57
|
+
max-width: 1280px;
|
58
|
+
margin: 0 auto;
|
59
|
+
padding: 2rem;
|
60
|
+
text-align: center;
|
61
|
+
}
|
62
|
+
|
63
|
+
h1 {
|
64
|
+
font-size: 3.2em;
|
65
|
+
line-height: 1.1;
|
66
|
+
}
|
67
|
+
|
68
|
+
h2 {
|
69
|
+
font-size: 2.6em;
|
70
|
+
line-height: 1.1;
|
71
|
+
}
|
72
|
+
|
73
|
+
button {
|
74
|
+
border-radius: 8px;
|
75
|
+
border: 1px solid transparent;
|
76
|
+
padding: 0.6em 1.2em;
|
77
|
+
font-size: 1em;
|
78
|
+
font-weight: 500;
|
79
|
+
font-family: inherit;
|
80
|
+
background-color: #f9f9f9;
|
81
|
+
cursor: pointer;
|
82
|
+
transition: border-color 0.25s;
|
83
|
+
}
|
84
|
+
button:hover {
|
85
|
+
border-color: #646cff;
|
86
|
+
}
|
87
|
+
button:focus,
|
88
|
+
button:focus-visible {
|
89
|
+
outline: 4px auto -webkit-focus-ring-color;
|
90
|
+
}
|
91
|
+
|
92
|
+
.logo {
|
93
|
+
display: inline-block;
|
94
|
+
height: 6em;
|
95
|
+
padding: 1.5em;
|
96
|
+
will-change: filter;
|
97
|
+
transition: filter 300ms;
|
98
|
+
}
|
99
|
+
.logo:hover {
|
100
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
101
|
+
}
|
102
|
+
.logo.vite:hover {
|
103
|
+
filter: drop-shadow(0 0 2em #e4023baa);
|
104
|
+
}
|
105
|
+
.logo.svelte:hover {
|
106
|
+
filter: drop-shadow(0 0 2em #ff3e00aa);
|
107
|
+
}
|
108
|
+
|
109
|
+
.card {
|
110
|
+
padding: 2em;
|
111
|
+
}
|
112
|
+
|
113
|
+
.read-the-docs {
|
114
|
+
color: #888;
|
115
|
+
}
|
116
|
+
</style>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { createInertiaApp } from '@inertiajs/svelte'
|
2
|
+
|
3
|
+
createInertiaApp({
|
4
|
+
// Set default page title
|
5
|
+
// see https://inertia-rails.netlify.app/guide/title-and-meta
|
6
|
+
//
|
7
|
+
// title: title => title ? `${title} - App` : 'App',
|
8
|
+
|
9
|
+
// Disable progress bar
|
10
|
+
//
|
11
|
+
// see https://inertia-rails.netlify.app/guide/progress-indicators
|
12
|
+
// progress: false,
|
13
|
+
|
14
|
+
resolve: (name) => {
|
15
|
+
const pages = import.meta.glob('../pages/**/*.svelte', {
|
16
|
+
eager: true,
|
17
|
+
})
|
18
|
+
const page = pages[`../pages/${name}.svelte`]
|
19
|
+
if (!page) {
|
20
|
+
console.error(`Missing Inertia page component: '${name}.svelte'`)
|
21
|
+
}
|
22
|
+
|
23
|
+
// To use a default layout, import the Layout component
|
24
|
+
// and use the following lines.
|
25
|
+
// see https://inertia-rails.netlify.app/guide/pages#default-layouts
|
26
|
+
//
|
27
|
+
// return { default: page.default, layout: page.layout || Layout }
|
28
|
+
|
29
|
+
return page
|
30
|
+
},
|
31
|
+
|
32
|
+
setup({ el, App, props }) {
|
33
|
+
if (el) {
|
34
|
+
new App({ target: el, props })
|
35
|
+
} else {
|
36
|
+
console.error(
|
37
|
+
'Missing root element.\n\n' +
|
38
|
+
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
|
39
|
+
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.',
|
40
|
+
)
|
41
|
+
}
|
42
|
+
},
|
43
|
+
})
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { createInertiaApp, type ResolvedComponent } from '@inertiajs/svelte'
|
2
|
+
|
3
|
+
createInertiaApp({
|
4
|
+
// Set default page title
|
5
|
+
// see https://inertia-rails.netlify.app/guide/title-and-meta
|
6
|
+
//
|
7
|
+
// title: title => title ? `${title} - App` : 'App',
|
8
|
+
|
9
|
+
// Disable progress bar
|
10
|
+
//
|
11
|
+
// see https://inertia-rails.netlify.app/guide/progress-indicators
|
12
|
+
// progress: false,
|
13
|
+
|
14
|
+
resolve: (name) => {
|
15
|
+
const pages = import.meta.glob<ResolvedComponent>('../pages/**/*.svelte', {
|
16
|
+
eager: true,
|
17
|
+
})
|
18
|
+
const page = pages[`../pages/${name}.svelte`]
|
19
|
+
if (!page) {
|
20
|
+
console.error(`Missing Inertia page component: '${name}.svelte'`)
|
21
|
+
}
|
22
|
+
|
23
|
+
// To use a default layout, import the Layout component
|
24
|
+
// and use the following line.
|
25
|
+
// see https://inertia-rails.netlify.app/guide/pages#default-layouts
|
26
|
+
//
|
27
|
+
// return { default: page.default, layout: page.layout || Layout }
|
28
|
+
|
29
|
+
return page
|
30
|
+
},
|
31
|
+
|
32
|
+
setup({ el, App, props }) {
|
33
|
+
if (el) {
|
34
|
+
<%= "// @ts-expect-error 1.3.0 beta contains types mismatch\n" if inertia_resolved_version == Gem::Version.new('1.3.0-beta.2') -%>
|
35
|
+
new App({ target: el, props })
|
36
|
+
} else {
|
37
|
+
console.error(
|
38
|
+
'Missing root element.\n\n' +
|
39
|
+
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
|
40
|
+
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.',
|
41
|
+
)
|
42
|
+
}
|
43
|
+
},
|
44
|
+
})
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"extends": "@tsconfig/svelte/tsconfig.json",
|
3
|
+
"compilerOptions": {
|
4
|
+
"target": "ESNext",
|
5
|
+
"useDefineForClassFields": true,
|
6
|
+
"module": "ESNext",
|
7
|
+
"resolveJsonModule": true,
|
8
|
+
/**
|
9
|
+
* Typecheck JS in `.svelte` and `.js` files by default.
|
10
|
+
* Disable checkJs if you'd like to use dynamic types in JS.
|
11
|
+
* Note that setting allowJs false does not prevent the use
|
12
|
+
* of JS in `.svelte` files.
|
13
|
+
*/
|
14
|
+
"allowJs": true,
|
15
|
+
"checkJs": true,
|
16
|
+
"isolatedModules": true,
|
17
|
+
"moduleDetection": "force",
|
18
|
+
},
|
19
|
+
"include": ["<%= js_destination_path %>/**/*.ts", "<%= js_destination_path %>/**/*.js", "<%= js_destination_path %>/**/*.svelte"],
|
20
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
21
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"composite": true,
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
5
|
+
"skipLibCheck": true,
|
6
|
+
"module": "ESNext",
|
7
|
+
"moduleResolution": "bundler",
|
8
|
+
"strict": true,
|
9
|
+
"noEmit": true,
|
10
|
+
},
|
11
|
+
"include": ["vite.config.ts"]
|
12
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
content: [
|
5
|
+
'./public/*.html',
|
6
|
+
'./app/helpers/**/*.rb',
|
7
|
+
'./<%= js_destination_path %>/**/*.{js,ts,jsx,tsx,vue,svelte}',
|
8
|
+
'./app/views/**/*.{erb,haml,html,slim}'
|
9
|
+
],
|
10
|
+
theme: {
|
11
|
+
extend: {},
|
12
|
+
},
|
13
|
+
plugins: [
|
14
|
+
require('@tailwindcss/forms'),
|
15
|
+
require('@tailwindcss/typography'),
|
16
|
+
require('@tailwindcss/container-queries'),
|
17
|
+
]
|
18
|
+
}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<template>
|
2
|
+
<Head title="Inertia + Vite Ruby + Vue Example" />
|
3
|
+
|
4
|
+
<div class="root">
|
5
|
+
<h1 class="h1">Hello {{ name }}!</h1>
|
6
|
+
|
7
|
+
<div>
|
8
|
+
<a href="https://inertia-rails.netlify.app" target="_blank">
|
9
|
+
<img class="logo" :src="inertiaSvg" alt="Inertia logo" />
|
10
|
+
</a>
|
11
|
+
<a href="https://vite-ruby.netlify.app" target="_blank">
|
12
|
+
<img class="logo vite" :src="viteRubySvg" alt="Vite Ruby logo" />
|
13
|
+
</a>
|
14
|
+
<a href="https://vuejs.org" target="_blank">
|
15
|
+
<img class="logo vue" :src="vueSvg" alt="Vue logo" />
|
16
|
+
</a>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<h2 class="h2">Inertia + Vite Ruby + Vue</h2>
|
20
|
+
|
21
|
+
<div class="card">
|
22
|
+
<button class="button" type="button" @click="count++">
|
23
|
+
count is {{ count }}
|
24
|
+
</button>
|
25
|
+
<p>
|
26
|
+
Edit <code>app/frontend/pages/InertiaExample.vue</code> and save to test
|
27
|
+
HMR
|
28
|
+
</p>
|
29
|
+
</div>
|
30
|
+
<p class="readTheDocs">
|
31
|
+
Click on the Inertia, Vite Ruby, and Vue logos to learn more
|
32
|
+
</p>
|
33
|
+
</div>
|
34
|
+
</template>
|
35
|
+
|
36
|
+
<script setup lang="ts">
|
37
|
+
import { Head } from '@inertiajs/vue3'
|
38
|
+
import { ref } from 'vue'
|
39
|
+
|
40
|
+
import inertiaSvg from '/assets/inertia.svg'
|
41
|
+
import viteRubySvg from '/assets/vite_ruby.svg'
|
42
|
+
import vueSvg from '/assets/vue.svg'
|
43
|
+
|
44
|
+
defineProps({
|
45
|
+
name: String,
|
46
|
+
})
|
47
|
+
|
48
|
+
const count = ref(0)
|
49
|
+
</script>
|
50
|
+
|
51
|
+
<style scoped>
|
52
|
+
.root {
|
53
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
54
|
+
line-height: 1.5;
|
55
|
+
font-weight: 400;
|
56
|
+
color: #213547;
|
57
|
+
background-color: #ffffff;
|
58
|
+
max-width: 1280px;
|
59
|
+
margin: 0 auto;
|
60
|
+
padding: 2rem;
|
61
|
+
text-align: center;
|
62
|
+
}
|
63
|
+
|
64
|
+
.h1 {
|
65
|
+
font-size: 3.2em;
|
66
|
+
line-height: 1.1;
|
67
|
+
}
|
68
|
+
|
69
|
+
.h2 {
|
70
|
+
font-size: 2.6em;
|
71
|
+
line-height: 1.1;
|
72
|
+
}
|
73
|
+
|
74
|
+
.button {
|
75
|
+
border-radius: 8px;
|
76
|
+
border: 1px solid transparent;
|
77
|
+
padding: 0.6em 1.2em;
|
78
|
+
font-size: 1em;
|
79
|
+
font-weight: 500;
|
80
|
+
font-family: inherit;
|
81
|
+
background-color: #f9f9f9;
|
82
|
+
cursor: pointer;
|
83
|
+
transition: border-color 0.25s;
|
84
|
+
}
|
85
|
+
.button:hover {
|
86
|
+
border-color: #646cff;
|
87
|
+
}
|
88
|
+
.button:focus,
|
89
|
+
.button:focus-visible {
|
90
|
+
outline: 4px auto -webkit-focus-ring-color;
|
91
|
+
}
|
92
|
+
|
93
|
+
.logo {
|
94
|
+
display: inline-block;
|
95
|
+
height: 6em;
|
96
|
+
padding: 1.5em;
|
97
|
+
will-change: filter;
|
98
|
+
transition: filter 300ms;
|
99
|
+
}
|
100
|
+
.logo:hover {
|
101
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
102
|
+
}
|
103
|
+
.logo.vite:hover {
|
104
|
+
filter: drop-shadow(0 0 2em #e4023baa);
|
105
|
+
}
|
106
|
+
.logo.vue:hover {
|
107
|
+
filter: drop-shadow(0 0 2em #41b883aa);
|
108
|
+
}
|
109
|
+
|
110
|
+
.card {
|
111
|
+
padding: 2em;
|
112
|
+
}
|
113
|
+
|
114
|
+
.readTheDocs {
|
115
|
+
color: #888;
|
116
|
+
}
|
117
|
+
</style>
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<template>
|
2
|
+
<Head title="Inertia + Vite Ruby + Vue Example" />
|
3
|
+
|
4
|
+
<div class="root">
|
5
|
+
<h1 class="h1">Hello {{ name }}!</h1>
|
6
|
+
|
7
|
+
<div>
|
8
|
+
<a href="https://inertia-rails.netlify.app" target="_blank">
|
9
|
+
<img class="logo" :src="inertiaSvg" alt="Inertia logo" />
|
10
|
+
</a>
|
11
|
+
<a href="https://vite-ruby.netlify.app" target="_blank">
|
12
|
+
<img class="logo vite" :src="viteRubySvg" alt="Vite Ruby logo" />
|
13
|
+
</a>
|
14
|
+
<a href="https://vuejs.org" target="_blank">
|
15
|
+
<img class="logo vue" :src="vueSvg" alt="Vue logo" />
|
16
|
+
</a>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<h2 class="h2">Inertia + Vite Ruby + Vue</h2>
|
20
|
+
|
21
|
+
<div class="card">
|
22
|
+
<button class="button" type="button" @click="count++">
|
23
|
+
count is {{ count }}
|
24
|
+
</button>
|
25
|
+
<p>
|
26
|
+
Edit <code>app/frontend/pages/InertiaExample.vue</code> and save to test
|
27
|
+
HMR
|
28
|
+
</p>
|
29
|
+
</div>
|
30
|
+
<p class="readTheDocs">
|
31
|
+
Click on the Inertia, Vite Ruby, and Vue logos to learn more
|
32
|
+
</p>
|
33
|
+
</div>
|
34
|
+
</template>
|
35
|
+
|
36
|
+
<script setup>
|
37
|
+
import { Head } from '@inertiajs/vue3'
|
38
|
+
import { ref } from 'vue'
|
39
|
+
|
40
|
+
import inertiaSvg from '/assets/inertia.svg'
|
41
|
+
import viteRubySvg from '/assets/vite_ruby.svg'
|
42
|
+
import vueSvg from '/assets/vue.svg'
|
43
|
+
|
44
|
+
defineProps({
|
45
|
+
name: String,
|
46
|
+
})
|
47
|
+
|
48
|
+
const count = ref(0)
|
49
|
+
</script>
|
50
|
+
|
51
|
+
<style scoped>
|
52
|
+
.root {
|
53
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
54
|
+
line-height: 1.5;
|
55
|
+
font-weight: 400;
|
56
|
+
color: #213547;
|
57
|
+
background-color: #ffffff;
|
58
|
+
max-width: 1280px;
|
59
|
+
margin: 0 auto;
|
60
|
+
padding: 2rem;
|
61
|
+
text-align: center;
|
62
|
+
}
|
63
|
+
|
64
|
+
.h1 {
|
65
|
+
font-size: 3.2em;
|
66
|
+
line-height: 1.1;
|
67
|
+
}
|
68
|
+
|
69
|
+
.h2 {
|
70
|
+
font-size: 2.6em;
|
71
|
+
line-height: 1.1;
|
72
|
+
}
|
73
|
+
|
74
|
+
.button {
|
75
|
+
border-radius: 8px;
|
76
|
+
border: 1px solid transparent;
|
77
|
+
padding: 0.6em 1.2em;
|
78
|
+
font-size: 1em;
|
79
|
+
font-weight: 500;
|
80
|
+
font-family: inherit;
|
81
|
+
background-color: #f9f9f9;
|
82
|
+
cursor: pointer;
|
83
|
+
transition: border-color 0.25s;
|
84
|
+
}
|
85
|
+
.button:hover {
|
86
|
+
border-color: #646cff;
|
87
|
+
}
|
88
|
+
.button:focus,
|
89
|
+
.button:focus-visible {
|
90
|
+
outline: 4px auto -webkit-focus-ring-color;
|
91
|
+
}
|
92
|
+
|
93
|
+
.logo {
|
94
|
+
display: inline-block;
|
95
|
+
height: 6em;
|
96
|
+
padding: 1.5em;
|
97
|
+
will-change: filter;
|
98
|
+
transition: filter 300ms;
|
99
|
+
}
|
100
|
+
.logo:hover {
|
101
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
102
|
+
}
|
103
|
+
.logo.vite:hover {
|
104
|
+
filter: drop-shadow(0 0 2em #e4023baa);
|
105
|
+
}
|
106
|
+
.logo.vue:hover {
|
107
|
+
filter: drop-shadow(0 0 2em #41b883aa);
|
108
|
+
}
|
109
|
+
|
110
|
+
.card {
|
111
|
+
padding: 2em;
|
112
|
+
}
|
113
|
+
|
114
|
+
.readTheDocs {
|
115
|
+
color: #888;
|
116
|
+
}
|
117
|
+
</style>
|