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
@@ -1,9 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'net/http'
|
2
4
|
require 'json'
|
3
5
|
require_relative "inertia_rails"
|
4
6
|
|
5
7
|
module InertiaRails
|
6
8
|
class Renderer
|
9
|
+
KEEP_PROP = :keep
|
10
|
+
DONT_KEEP_PROP = :dont_keep
|
11
|
+
|
7
12
|
attr_reader(
|
8
13
|
:component,
|
9
14
|
:configuration,
|
@@ -64,24 +69,30 @@ module InertiaRails
|
|
64
69
|
# Functionally, this permits using either string or symbol keys in the controller. Since the results
|
65
70
|
# is cast to json, we should treat string/symbol keys as identical.
|
66
71
|
def merge_props(shared_data, props)
|
67
|
-
|
72
|
+
if @deep_merge
|
73
|
+
shared_data.deep_symbolize_keys.deep_merge!(props.deep_symbolize_keys)
|
74
|
+
else
|
75
|
+
shared_data.symbolize_keys.merge(props.symbolize_keys)
|
76
|
+
end
|
68
77
|
end
|
69
78
|
|
70
79
|
def computed_props
|
71
|
-
_props = merge_props(shared_data, props)
|
72
|
-
|
73
|
-
|
80
|
+
_props = merge_props(shared_data, props)
|
81
|
+
|
82
|
+
deep_transform_props _props do |prop, path|
|
83
|
+
next [DONT_KEEP_PROP] unless keep_prop?(prop, path)
|
84
|
+
|
85
|
+
transformed_prop = case prop
|
86
|
+
when BaseProp
|
87
|
+
prop.call(controller)
|
88
|
+
when Proc
|
89
|
+
controller.instance_exec(&prop)
|
74
90
|
else
|
75
|
-
|
91
|
+
prop
|
76
92
|
end
|
77
|
-
end
|
78
93
|
|
79
|
-
|
80
|
-
|
81
|
-
lambda do |prop|
|
82
|
-
prop.respond_to?(:call) ? controller.instance_exec(&prop) : prop
|
83
|
-
end
|
84
|
-
)
|
94
|
+
[KEEP_PROP, transformed_prop]
|
95
|
+
end
|
85
96
|
end
|
86
97
|
|
87
98
|
def page
|
@@ -93,18 +104,32 @@ module InertiaRails
|
|
93
104
|
}
|
94
105
|
end
|
95
106
|
|
96
|
-
def
|
97
|
-
|
107
|
+
def deep_transform_props(props, parent_path = [], &block)
|
108
|
+
props.reduce({}) do |transformed_props, (key, prop)|
|
109
|
+
current_path = parent_path + [key]
|
98
110
|
|
99
|
-
|
111
|
+
if prop.is_a?(Hash) && prop.any?
|
112
|
+
nested = deep_transform_props(prop, current_path, &block)
|
113
|
+
transformed_props.merge!(key => nested) unless nested.empty?
|
114
|
+
else
|
115
|
+
action, transformed_prop = block.call(prop, current_path)
|
116
|
+
transformed_props.merge!(key => transformed_prop) if action == KEEP_PROP
|
117
|
+
end
|
118
|
+
|
119
|
+
transformed_props
|
120
|
+
end
|
100
121
|
end
|
101
122
|
|
102
123
|
def partial_keys
|
103
|
-
(@request.headers['X-Inertia-Partial-Data'] || '').split(',').compact
|
124
|
+
(@request.headers['X-Inertia-Partial-Data'] || '').split(',').compact
|
125
|
+
end
|
126
|
+
|
127
|
+
def partial_except_keys
|
128
|
+
(@request.headers['X-Inertia-Partial-Except'] || '').split(',').compact
|
104
129
|
end
|
105
130
|
|
106
131
|
def rendering_partial_component?
|
107
|
-
@request.
|
132
|
+
@request.headers['X-Inertia-Partial-Component'] == component
|
108
133
|
end
|
109
134
|
|
110
135
|
def resolve_component(component)
|
@@ -112,5 +137,34 @@ module InertiaRails
|
|
112
137
|
|
113
138
|
configuration.component_path_resolver(path: controller.controller_path, action: controller.action_name)
|
114
139
|
end
|
140
|
+
|
141
|
+
def keep_prop?(prop, path)
|
142
|
+
return true if prop.is_a?(AlwaysProp)
|
143
|
+
|
144
|
+
if rendering_partial_component?
|
145
|
+
path_with_prefixes = path_prefixes(path)
|
146
|
+
return false if excluded_by_only_partial_keys?(path_with_prefixes)
|
147
|
+
return false if excluded_by_except_partial_keys?(path_with_prefixes)
|
148
|
+
end
|
149
|
+
|
150
|
+
# Precedence: Evaluate LazyProp only after partial keys have been checked
|
151
|
+
return false if prop.is_a?(LazyProp) && !rendering_partial_component?
|
152
|
+
|
153
|
+
true
|
154
|
+
end
|
155
|
+
|
156
|
+
def path_prefixes(parts)
|
157
|
+
(0...parts.length).map do |i|
|
158
|
+
parts[0..i].join('.')
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def excluded_by_only_partial_keys?(path_with_prefixes)
|
163
|
+
partial_keys.present? && (path_with_prefixes & partial_keys).empty?
|
164
|
+
end
|
165
|
+
|
166
|
+
def excluded_by_except_partial_keys?(path_with_prefixes)
|
167
|
+
partial_except_keys.present? && (path_with_prefixes & partial_except_keys).any?
|
168
|
+
end
|
115
169
|
end
|
116
170
|
end
|
@@ -4,14 +4,16 @@
|
|
4
4
|
# https://github.com/BetterErrors/better_errors/blob/v2.5.1/lib/better_errors/middleware.rb
|
5
5
|
#
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
return false if env["HTTP_X_INERTIA"]
|
7
|
+
module InertiaRails
|
8
|
+
module InertiaBetterErrors
|
9
|
+
def text?(env)
|
10
|
+
return false if env["HTTP_X_INERTIA"]
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
end)
|
12
|
+
super
|
13
|
+
end
|
16
14
|
end
|
17
15
|
end
|
16
|
+
|
17
|
+
if defined?(BetterErrors)
|
18
|
+
BetterErrors::Middleware.include InertiaRails::InertiaBetterErrors
|
19
|
+
end
|
@@ -4,8 +4,8 @@
|
|
4
4
|
# https://github.com/rails/rails/blob/5-0-stable/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
|
5
5
|
#
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
module InertiaRails
|
8
|
+
module InertiaDebugExceptions
|
9
9
|
def render_for_default_application(request, wrapper)
|
10
10
|
template = create_template(request, wrapper)
|
11
11
|
file = "rescues/#{wrapper.rescue_template}"
|
@@ -19,5 +19,9 @@ ActionDispatch::DebugExceptions.class_eval do
|
|
19
19
|
end
|
20
20
|
render(wrapper.status_code, body, format)
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
if defined?(ActionDispatch::DebugExceptions)
|
26
|
+
ActionDispatch::DebugExceptions.prepend InertiaRails::InertiaDebugExceptions
|
23
27
|
end
|
@@ -6,8 +6,8 @@
|
|
6
6
|
# https://github.com/rails/rails/blob/6-0-stable/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
|
7
7
|
#
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
module InertiaRails
|
10
|
+
module InertiaDebugExceptions
|
11
11
|
def render_for_browser_request(request, wrapper)
|
12
12
|
template = create_template(request, wrapper)
|
13
13
|
file = "rescues/#{wrapper.rescue_template}"
|
@@ -22,5 +22,9 @@ ActionDispatch::DebugExceptions.class_eval do
|
|
22
22
|
|
23
23
|
render(wrapper.status_code, body, format)
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if defined?(ActionDispatch::DebugExceptions)
|
29
|
+
ActionDispatch::DebugExceptions.prepend InertiaRails::InertiaDebugExceptions
|
26
30
|
end
|
data/lib/patches/mapper.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module InertiaRails
|
2
|
+
module InertiaMapper
|
3
|
+
def inertia(args, &block)
|
4
|
+
route = args.keys.first
|
5
|
+
component = args.values.first
|
5
6
|
|
6
|
-
|
7
|
+
get(route => 'inertia_rails/static#static', defaults: { component: component })
|
8
|
+
end
|
7
9
|
end
|
8
10
|
end
|
11
|
+
|
12
|
+
ActionDispatch::Routing::Mapper.include InertiaRails::InertiaMapper
|
data/lib/patches/request.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module InertiaRails
|
2
|
+
module InertiaRequest
|
3
|
+
def inertia?
|
4
|
+
key? 'HTTP_X_INERTIA'
|
5
|
+
end
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
def inertia_partial?
|
8
|
+
key?('HTTP_X_INERTIA_PARTIAL_COMPONENT')
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
12
|
+
|
13
|
+
ActionDispatch::Request.include InertiaRails::InertiaRequest
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inertia_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Knoles
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-11-
|
13
|
+
date: 2024-11-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|
@@ -41,22 +41,190 @@ files:
|
|
41
41
|
- README.md
|
42
42
|
- app/controllers/inertia_rails/static_controller.rb
|
43
43
|
- app/views/inertia.html.erb
|
44
|
-
- lib/generators/
|
45
|
-
- lib/generators/
|
46
|
-
- lib/generators/
|
47
|
-
- lib/generators/
|
48
|
-
- lib/generators/
|
49
|
-
- lib/generators/
|
50
|
-
- lib/generators/
|
51
|
-
- lib/generators/
|
44
|
+
- lib/generators/inertia/controller/controller_generator.rb
|
45
|
+
- lib/generators/inertia/controller/templates/controller.rb.tt
|
46
|
+
- lib/generators/inertia/install/frameworks.yml
|
47
|
+
- lib/generators/inertia/install/helpers.rb
|
48
|
+
- lib/generators/inertia/install/install_generator.rb
|
49
|
+
- lib/generators/inertia/install/js_package_manager.rb
|
50
|
+
- lib/generators/inertia/install/templates/assets/inertia.svg
|
51
|
+
- lib/generators/inertia/install/templates/assets/react.svg
|
52
|
+
- lib/generators/inertia/install/templates/assets/svelte.svg
|
53
|
+
- lib/generators/inertia/install/templates/assets/vite_ruby.svg
|
54
|
+
- lib/generators/inertia/install/templates/assets/vue.svg
|
55
|
+
- lib/generators/inertia/install/templates/controller.rb
|
56
|
+
- lib/generators/inertia/install/templates/dev
|
57
|
+
- lib/generators/inertia/install/templates/initializer.rb
|
58
|
+
- lib/generators/inertia/install/templates/react/InertiaExample.jsx
|
59
|
+
- lib/generators/inertia/install/templates/react/InertiaExample.module.css
|
60
|
+
- lib/generators/inertia/install/templates/react/InertiaExample.tsx
|
61
|
+
- lib/generators/inertia/install/templates/react/inertia.js
|
62
|
+
- lib/generators/inertia/install/templates/react/inertia.ts
|
63
|
+
- lib/generators/inertia/install/templates/react/tsconfig.app.json
|
64
|
+
- lib/generators/inertia/install/templates/react/tsconfig.json
|
65
|
+
- lib/generators/inertia/install/templates/react/tsconfig.node.json
|
66
|
+
- lib/generators/inertia/install/templates/react/vite-env.d.ts
|
67
|
+
- lib/generators/inertia/install/templates/svelte/InertiaExample.svelte
|
68
|
+
- lib/generators/inertia/install/templates/svelte/InertiaExample.ts.svelte
|
69
|
+
- lib/generators/inertia/install/templates/svelte/inertia.js
|
70
|
+
- lib/generators/inertia/install/templates/svelte/inertia.ts.tt
|
71
|
+
- lib/generators/inertia/install/templates/svelte/svelte.config.js
|
72
|
+
- lib/generators/inertia/install/templates/svelte/tsconfig.json
|
73
|
+
- lib/generators/inertia/install/templates/svelte/tsconfig.node.json
|
74
|
+
- lib/generators/inertia/install/templates/svelte/vite-env.d.ts
|
75
|
+
- lib/generators/inertia/install/templates/svelte4/InertiaExample.svelte
|
76
|
+
- lib/generators/inertia/install/templates/svelte4/InertiaExample.ts.svelte
|
77
|
+
- lib/generators/inertia/install/templates/svelte4/inertia.js
|
78
|
+
- lib/generators/inertia/install/templates/svelte4/inertia.ts.tt
|
79
|
+
- lib/generators/inertia/install/templates/svelte4/svelte.config.js
|
80
|
+
- lib/generators/inertia/install/templates/svelte4/tsconfig.json
|
81
|
+
- lib/generators/inertia/install/templates/svelte4/tsconfig.node.json
|
82
|
+
- lib/generators/inertia/install/templates/svelte4/vite-env.d.ts
|
83
|
+
- lib/generators/inertia/install/templates/tailwind/application.css
|
84
|
+
- lib/generators/inertia/install/templates/tailwind/postcss.config.js
|
85
|
+
- lib/generators/inertia/install/templates/tailwind/tailwind.config.js.tt
|
86
|
+
- lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue
|
87
|
+
- lib/generators/inertia/install/templates/vue/InertiaExample.vue
|
88
|
+
- lib/generators/inertia/install/templates/vue/inertia.js
|
89
|
+
- lib/generators/inertia/install/templates/vue/inertia.ts
|
90
|
+
- lib/generators/inertia/install/templates/vue/tsconfig.app.json
|
91
|
+
- lib/generators/inertia/install/templates/vue/tsconfig.json
|
92
|
+
- lib/generators/inertia/install/templates/vue/tsconfig.node.json
|
93
|
+
- lib/generators/inertia/install/templates/vue/vite-env.d.ts
|
94
|
+
- lib/generators/inertia/scaffold/scaffold_generator.rb
|
95
|
+
- lib/generators/inertia/scaffold_controller/scaffold_controller_generator.rb
|
96
|
+
- lib/generators/inertia/scaffold_controller/templates/controller.rb.tt
|
97
|
+
- lib/generators/inertia_templates/controller/controller_generator.rb
|
98
|
+
- lib/generators/inertia_templates/controller/templates/react/view.jsx.tt
|
99
|
+
- lib/generators/inertia_templates/controller/templates/react/view.tsx.tt
|
100
|
+
- lib/generators/inertia_templates/controller/templates/svelte/view.svelte.tt
|
101
|
+
- lib/generators/inertia_templates/controller/templates/svelte4/view.svelte.tt
|
102
|
+
- lib/generators/inertia_templates/controller/templates/vue/view.vue.tt
|
103
|
+
- lib/generators/inertia_templates/scaffold/scaffold_generator.rb
|
104
|
+
- lib/generators/inertia_templates/scaffold/templates/react/Edit.jsx.tt
|
105
|
+
- lib/generators/inertia_templates/scaffold/templates/react/Edit.tsx.tt
|
106
|
+
- lib/generators/inertia_templates/scaffold/templates/react/Form.jsx.tt
|
107
|
+
- lib/generators/inertia_templates/scaffold/templates/react/Form.tsx.tt
|
108
|
+
- lib/generators/inertia_templates/scaffold/templates/react/Index.jsx.tt
|
109
|
+
- lib/generators/inertia_templates/scaffold/templates/react/Index.tsx.tt
|
110
|
+
- lib/generators/inertia_templates/scaffold/templates/react/New.jsx.tt
|
111
|
+
- lib/generators/inertia_templates/scaffold/templates/react/New.tsx.tt
|
112
|
+
- lib/generators/inertia_templates/scaffold/templates/react/One.jsx.tt
|
113
|
+
- lib/generators/inertia_templates/scaffold/templates/react/One.tsx.tt
|
114
|
+
- lib/generators/inertia_templates/scaffold/templates/react/Show.jsx.tt
|
115
|
+
- lib/generators/inertia_templates/scaffold/templates/react/Show.tsx.tt
|
116
|
+
- lib/generators/inertia_templates/scaffold/templates/react/types.ts.tt
|
117
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/Edit.svelte.tt
|
118
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/Edit.ts.svelte.tt
|
119
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/Form.svelte.tt
|
120
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/Form.ts.svelte.tt
|
121
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/Index.svelte.tt
|
122
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/Index.ts.svelte.tt
|
123
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/New.svelte.tt
|
124
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/New.ts.svelte.tt
|
125
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/One.svelte.tt
|
126
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/One.ts.svelte.tt
|
127
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/Show.svelte.tt
|
128
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/Show.ts.svelte.tt
|
129
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte/types.ts.tt
|
130
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/Edit.svelte.tt
|
131
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/Edit.ts.svelte.tt
|
132
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/Form.svelte.tt
|
133
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/Form.ts.svelte.tt
|
134
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/Index.svelte.tt
|
135
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/Index.ts.svelte.tt
|
136
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/New.svelte.tt
|
137
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/New.ts.svelte.tt
|
138
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/One.svelte.tt
|
139
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/One.ts.svelte.tt
|
140
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/Show.svelte.tt
|
141
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/Show.ts.svelte.tt
|
142
|
+
- lib/generators/inertia_templates/scaffold/templates/svelte4/types.ts.tt
|
143
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/Edit.ts.vue.tt
|
144
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/Edit.vue.tt
|
145
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/Form.ts.vue.tt
|
146
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/Form.vue.tt
|
147
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/Index.ts.vue.tt
|
148
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/Index.vue.tt
|
149
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/New.ts.vue.tt
|
150
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/New.vue.tt
|
151
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/One.ts.vue.tt
|
152
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/One.vue.tt
|
153
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/Show.ts.vue.tt
|
154
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/Show.vue.tt
|
155
|
+
- lib/generators/inertia_templates/scaffold/templates/vue/types.ts.tt
|
156
|
+
- lib/generators/inertia_tw_templates/controller/controller_generator.rb
|
157
|
+
- lib/generators/inertia_tw_templates/controller/templates/react/view.jsx.tt
|
158
|
+
- lib/generators/inertia_tw_templates/controller/templates/react/view.tsx.tt
|
159
|
+
- lib/generators/inertia_tw_templates/controller/templates/svelte/view.svelte.tt
|
160
|
+
- lib/generators/inertia_tw_templates/controller/templates/svelte4/view.svelte.tt
|
161
|
+
- lib/generators/inertia_tw_templates/controller/templates/vue/view.vue.tt
|
162
|
+
- lib/generators/inertia_tw_templates/scaffold/scaffold_generator.rb
|
163
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.jsx.tt
|
164
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/Edit.tsx.tt
|
165
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/Form.jsx.tt
|
166
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/Form.tsx.tt
|
167
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/Index.jsx.tt
|
168
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/Index.tsx.tt
|
169
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt
|
170
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/New.tsx.tt
|
171
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/One.jsx.tt
|
172
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/One.tsx.tt
|
173
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/Show.jsx.tt
|
174
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/Show.tsx.tt
|
175
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/react/types.ts.tt
|
176
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.svelte.tt
|
177
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/Edit.ts.svelte.tt
|
178
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.svelte.tt
|
179
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/Form.ts.svelte.tt
|
180
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.svelte.tt
|
181
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/Index.ts.svelte.tt
|
182
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.svelte.tt
|
183
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/New.ts.svelte.tt
|
184
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.svelte.tt
|
185
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/One.ts.svelte.tt
|
186
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.svelte.tt
|
187
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/Show.ts.svelte.tt
|
188
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte/types.ts.tt
|
189
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Edit.svelte.tt
|
190
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Edit.ts.svelte.tt
|
191
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.svelte.tt
|
192
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Form.ts.svelte.tt
|
193
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.svelte.tt
|
194
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Index.ts.svelte.tt
|
195
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/New.svelte.tt
|
196
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/New.ts.svelte.tt
|
197
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.svelte.tt
|
198
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/One.ts.svelte.tt
|
199
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.svelte.tt
|
200
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/Show.ts.svelte.tt
|
201
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/svelte4/types.ts.tt
|
202
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.ts.vue.tt
|
203
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/Edit.vue.tt
|
204
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.ts.vue.tt
|
205
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/Form.vue.tt
|
206
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.ts.vue.tt
|
207
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/Index.vue.tt
|
208
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/New.ts.vue.tt
|
209
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/New.vue.tt
|
210
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/One.ts.vue.tt
|
211
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/One.vue.tt
|
212
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.ts.vue.tt
|
213
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/Show.vue.tt
|
214
|
+
- lib/generators/inertia_tw_templates/scaffold/templates/vue/types.ts.tt
|
52
215
|
- lib/inertia_rails.rb
|
53
216
|
- lib/inertia_rails/action_filter.rb
|
217
|
+
- lib/inertia_rails/always_prop.rb
|
218
|
+
- lib/inertia_rails/base_prop.rb
|
54
219
|
- lib/inertia_rails/configuration.rb
|
55
220
|
- lib/inertia_rails/controller.rb
|
56
221
|
- lib/inertia_rails/engine.rb
|
222
|
+
- lib/inertia_rails/generators/controller_template_base.rb
|
223
|
+
- lib/inertia_rails/generators/helper.rb
|
224
|
+
- lib/inertia_rails/generators/scaffold_template_base.rb
|
57
225
|
- lib/inertia_rails/helper.rb
|
58
226
|
- lib/inertia_rails/inertia_rails.rb
|
59
|
-
- lib/inertia_rails/
|
227
|
+
- lib/inertia_rails/lazy_prop.rb
|
60
228
|
- lib/inertia_rails/middleware.rb
|
61
229
|
- lib/inertia_rails/renderer.rb
|
62
230
|
- lib/inertia_rails/rspec.rb
|
@@ -86,14 +254,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
254
|
requirements:
|
87
255
|
- - ">="
|
88
256
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
257
|
+
version: '3.0'
|
90
258
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
259
|
requirements:
|
92
260
|
- - ">="
|
93
261
|
- !ruby/object:Gem::Version
|
94
262
|
version: '0'
|
95
263
|
requirements: []
|
96
|
-
rubygems_version: 3.5.
|
264
|
+
rubygems_version: 3.5.22
|
97
265
|
signing_key:
|
98
266
|
specification_version: 4
|
99
267
|
summary: Inertia.js adapter for Rails
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { App } from '@inertiajs/inertia-react';
|
2
|
-
import React from 'react';
|
3
|
-
import { render } from 'react-dom';
|
4
|
-
import { InertiaProgress } from '@inertiajs/progress';
|
5
|
-
|
6
|
-
document.addEventListener('DOMContentLoaded', () => {
|
7
|
-
InertiaProgress.init();
|
8
|
-
const el = document.getElementById('app')
|
9
|
-
|
10
|
-
render(
|
11
|
-
<App
|
12
|
-
initialPage={JSON.parse(el.dataset.page)}
|
13
|
-
resolveComponent={name => require(`../Pages/${name}`).default}
|
14
|
-
/>,
|
15
|
-
el
|
16
|
-
)
|
17
|
-
});
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { createInertiaApp } from '@inertiajs/inertia-svelte'
|
2
|
-
import { InertiaProgress } from '@inertiajs/progress'
|
3
|
-
|
4
|
-
document.addEventListener('DOMContentLoaded', () => {
|
5
|
-
InertiaProgress.init()
|
6
|
-
|
7
|
-
createInertiaApp({
|
8
|
-
id: 'app',
|
9
|
-
resolve: name => import(`../Pages/${name}.svelte`),
|
10
|
-
setup({ el, App, props }) {
|
11
|
-
new App({ target: el, props })
|
12
|
-
},
|
13
|
-
})
|
14
|
-
})
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import Vue from 'vue'
|
2
|
-
|
3
|
-
import { app, plugin } from '@inertiajs/inertia-vue'
|
4
|
-
import { InertiaProgress } from '@inertiajs/progress'
|
5
|
-
|
6
|
-
document.addEventListener('DOMContentLoaded', () => {
|
7
|
-
InertiaProgress.init();
|
8
|
-
const el = document.getElementById('app')
|
9
|
-
|
10
|
-
Vue.use(plugin)
|
11
|
-
|
12
|
-
new Vue({
|
13
|
-
render: h => h(app, {
|
14
|
-
props: {
|
15
|
-
initialPage: JSON.parse(el.dataset.page),
|
16
|
-
resolveComponent: name => require(`../Pages/${name}`).default,
|
17
|
-
},
|
18
|
-
}),
|
19
|
-
}).$mount(el)
|
20
|
-
})
|