phlex-hanami 0.2.0.pre.alpha.2 → 0.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +61 -1
- data/lib/phlex/hanami/component.rb +41 -0
- data/lib/phlex/hanami/context.rb +21 -1
- data/lib/phlex/hanami/contextual.rb +294 -0
- data/lib/phlex/hanami/errors/mailer_view_error.rb +1 -0
- data/lib/phlex/hanami/errors/missing_context_error.rb +1 -0
- data/lib/phlex/hanami/errors/relative_path_error.rb +1 -0
- data/lib/phlex/hanami/extensions/mailer.rb +6 -0
- data/lib/phlex/hanami/extensions/slice.rb +12 -3
- data/lib/phlex/hanami/helpers.rb +3 -2
- data/lib/phlex/hanami/mailer/renderable.rb +6 -0
- data/lib/phlex/hanami/mailer/text.rb +19 -6
- data/lib/phlex/hanami/renderable.rb +14 -237
- data/lib/phlex/hanami/rspec.rb +14 -0
- data/lib/phlex/hanami/slice_configured.rb +5 -1
- data/lib/phlex/hanami/slice_configured_context.rb +9 -1
- data/lib/phlex/hanami/testing.rb +156 -0
- data/lib/phlex/hanami.rb +3 -1
- data/sig/external/dry.rbs +9 -0
- data/sig/external/hanami.rbs +77 -0
- data/sig/external/hanami_view.rbs +9 -0
- data/sig/external/phlex.rbs +16 -0
- data/sig/phlex/hanami/component.rbs +9 -0
- data/sig/phlex/hanami/context.rbs +39 -0
- data/sig/phlex/hanami/contextual.rbs +57 -0
- data/sig/phlex/hanami/errors/error.rbs +8 -0
- data/sig/phlex/hanami/errors/mailer_view_error.rbs +9 -0
- data/sig/phlex/hanami/errors/missing_context_error.rbs +9 -0
- data/sig/phlex/hanami/errors/relative_path_error.rbs +9 -0
- data/sig/phlex/hanami/extensions/mailer.rbs +25 -0
- data/sig/phlex/hanami/extensions/slice.rbs +21 -0
- data/sig/phlex/hanami/helpers.rbs +13 -0
- data/sig/phlex/hanami/layout.rbs +9 -0
- data/sig/phlex/hanami/mailer/layout.rbs +11 -0
- data/sig/phlex/hanami/mailer/renderable.rbs +27 -0
- data/sig/phlex/hanami/mailer/text.rbs +47 -0
- data/sig/phlex/hanami/mailer/view.rbs +11 -0
- data/sig/phlex/hanami/mailer.rbs +8 -0
- data/sig/phlex/hanami/renderable.rbs +27 -0
- data/sig/phlex/hanami/rspec.rbs +1 -0
- data/sig/phlex/hanami/slice_configured.rbs +19 -0
- data/sig/phlex/hanami/slice_configured_context.rbs +27 -0
- data/sig/phlex/hanami/testing.rbs +19 -0
- data/sig/phlex/hanami/view.rbs +9 -0
- data/sig/phlex/hanami.rbs +7 -0
- data/sig/phlex-hanami.rbs +1 -2
- metadata +32 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "phlex/hanami"
|
|
4
|
+
require "rack/mock_request"
|
|
5
|
+
|
|
6
|
+
module Phlex
|
|
7
|
+
module Hanami
|
|
8
|
+
# Test support for view and component specs, whatever the test framework.
|
|
9
|
+
#
|
|
10
|
+
# A Phlex view is an ordinary Ruby object, so most of it needs no help: build one and call it.
|
|
11
|
+
# What it does need is a view context, because a view that reaches for `path`, `assets` or
|
|
12
|
+
# `flash` reads them off the context Hanami builds per request. {ViewHelpers} gives you that
|
|
13
|
+
# context without a request, and a fake request when the view wants one.
|
|
14
|
+
#
|
|
15
|
+
# `require "phlex/hanami/rspec"` includes the helpers into every RSpec example group tagged
|
|
16
|
+
# `type: :view`. Under any other framework, require this file and include the module yourself:
|
|
17
|
+
#
|
|
18
|
+
# # test/support/phlex.rb
|
|
19
|
+
# require "phlex/hanami/testing"
|
|
20
|
+
#
|
|
21
|
+
# class Hanami::Minitest::Test
|
|
22
|
+
# include Phlex::Hanami::Testing::ViewHelpers
|
|
23
|
+
# end
|
|
24
|
+
#
|
|
25
|
+
# @api public
|
|
26
|
+
# @since 0.2.0
|
|
27
|
+
module Testing
|
|
28
|
+
# Renders a view or component, and builds what a view needs to render.
|
|
29
|
+
#
|
|
30
|
+
# Nothing here is tied to a test framework. Include it into whichever class or example group
|
|
31
|
+
# your view tests run in.
|
|
32
|
+
#
|
|
33
|
+
# @example
|
|
34
|
+
# class PostIndexTest < Hanami::Minitest::Test
|
|
35
|
+
# include Phlex::Hanami::Testing::ViewHelpers
|
|
36
|
+
#
|
|
37
|
+
# test "lists the posts" do
|
|
38
|
+
# assert_includes render(MyApp::Views::Posts::Index.new(posts: [post])), "<h1>Posts</h1>"
|
|
39
|
+
# end
|
|
40
|
+
# end
|
|
41
|
+
#
|
|
42
|
+
# @api public
|
|
43
|
+
# @since 0.2.0
|
|
44
|
+
module ViewHelpers
|
|
45
|
+
# Renders a view or component and returns the markup.
|
|
46
|
+
#
|
|
47
|
+
# Renders the instance you pass, so no layout is applied. Call the class instead
|
|
48
|
+
# (`described_class.call(context: view_context, **input)`) to render a view inside its
|
|
49
|
+
# layout, the way Hanami does.
|
|
50
|
+
#
|
|
51
|
+
# The context comes from the view's own slice, so routes, assets and translations are the
|
|
52
|
+
# real ones. Pass `request:` for a view that reads the session, the flash or the CSRF
|
|
53
|
+
# token, or `context:` to supply the whole context yourself.
|
|
54
|
+
#
|
|
55
|
+
# @example A component that takes a block
|
|
56
|
+
# render(Card.new(title: "Hello")) { "body" }
|
|
57
|
+
#
|
|
58
|
+
# @param view [Phlex::SGML] the view or component instance
|
|
59
|
+
# @param context [Object, nil] a view context, built from the view's slice when omitted
|
|
60
|
+
# @param request [Hanami::Action::Request, nil] a request for the context to carry
|
|
61
|
+
#
|
|
62
|
+
# @return [String] the rendered markup
|
|
63
|
+
#
|
|
64
|
+
# @api public
|
|
65
|
+
# @since 0.2.0
|
|
66
|
+
#: (
|
|
67
|
+
# ::Phlex::SGML,
|
|
68
|
+
# ?context: (::Hanami::View::Context | Context)?,
|
|
69
|
+
# ?request: ::Hanami::Action::Request?
|
|
70
|
+
# ) ?{ (?) -> untyped } -> String
|
|
71
|
+
def render(view, context: nil, request: nil, &)
|
|
72
|
+
context ||= view_context(slice: slice_for(view), request: request)
|
|
73
|
+
|
|
74
|
+
view.call(context: { CONTEXT_KEY => context }, &)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Builds a view context.
|
|
78
|
+
#
|
|
79
|
+
# Uses the same context class an action would: a `Hanami::View::Context` subclass when
|
|
80
|
+
# hanami-view is bundled, otherwise a {Phlex::Hanami::Context} subclass. Either way the
|
|
81
|
+
# slice's own routes, assets, inflector and i18n backend are injected.
|
|
82
|
+
#
|
|
83
|
+
# Falls back to a bare {Phlex::Hanami::Context} when there is no slice to build from. That
|
|
84
|
+
# context answers `content_for` and raises a helpful error for anything needing a slice or
|
|
85
|
+
# a request, which is what a view rendered outside an app should see.
|
|
86
|
+
#
|
|
87
|
+
# @param slice [Hanami::Slice, nil] the slice to build from, defaulting to the app
|
|
88
|
+
# @param request [Hanami::Action::Request, nil] a request for the context to carry
|
|
89
|
+
# @param options [Hash] passed on to the context's initializer
|
|
90
|
+
#
|
|
91
|
+
# @return [Object] the context
|
|
92
|
+
#
|
|
93
|
+
# @api public
|
|
94
|
+
# @since 0.2.0
|
|
95
|
+
#: (
|
|
96
|
+
# ?slice: singleton(::Hanami::Slice)?,
|
|
97
|
+
# ?request: ::Hanami::Action::Request?,
|
|
98
|
+
# **untyped
|
|
99
|
+
# ) -> (::Hanami::View::Context | Context)
|
|
100
|
+
def view_context(slice: nil, request: nil, **)
|
|
101
|
+
slice ||= ::Hanami.app if ::Hanami.app?
|
|
102
|
+
context_class = slice ? Extensions::Slice.view_context_class(slice) : Context
|
|
103
|
+
|
|
104
|
+
context_class.new(request: request, **)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Builds a request for a view to read, without running an action.
|
|
108
|
+
#
|
|
109
|
+
# Sessions are always enabled on it, so `session`, `flash` and `csrf_token` answer rather
|
|
110
|
+
# than raising `Hanami::Action::MissingSessionError`.
|
|
111
|
+
#
|
|
112
|
+
# @example
|
|
113
|
+
# render(described_class.new, request: view_request("/posts", flash: { alert: "Nope" }))
|
|
114
|
+
#
|
|
115
|
+
# @param path [String] the request path
|
|
116
|
+
# @param csrf_token [String, nil] the token `csrf_token` returns
|
|
117
|
+
# @param flash [Hash] the flash for this request
|
|
118
|
+
# @param session [Hash] the session, keyed by String
|
|
119
|
+
# @param options [Hash] passed on to `Rack::MockRequest.env_for`
|
|
120
|
+
#
|
|
121
|
+
# @return [Hanami::Action::Request]
|
|
122
|
+
#
|
|
123
|
+
# @api public
|
|
124
|
+
# @since 0.2.0
|
|
125
|
+
#: (
|
|
126
|
+
# ?String,
|
|
127
|
+
# ?csrf_token: String?,
|
|
128
|
+
# ?flash: Hash[Symbol | String, untyped],
|
|
129
|
+
# ?session: Hash[Symbol | String, untyped],
|
|
130
|
+
# **untyped
|
|
131
|
+
# ) -> ::Hanami::Action::Request
|
|
132
|
+
def view_request(path = "/", csrf_token: nil, flash: {}, session: {}, **)
|
|
133
|
+
env = ::Rack::MockRequest.env_for(path, **)
|
|
134
|
+
env["rack.session"] = session.transform_keys(&:to_s)
|
|
135
|
+
env["rack.session"][::Hanami::Action::Flash::KEY] = flash unless flash.empty?
|
|
136
|
+
env["rack.session"][::Hanami::Action::CSRFProtection::CSRF_TOKEN.to_s] = csrf_token if csrf_token
|
|
137
|
+
|
|
138
|
+
::Hanami::Action::Request.new(
|
|
139
|
+
env: env,
|
|
140
|
+
params: ::Hanami::Action::Params.new(env: env),
|
|
141
|
+
session_enabled: true,
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
private
|
|
146
|
+
|
|
147
|
+
# The slice a view belongs to. Nil for a plain Phlex class, which has no `slice` at all,
|
|
148
|
+
# and for a Renderable one defined outside a slice namespace.
|
|
149
|
+
#: (::Phlex::SGML) -> singleton(::Hanami::Slice)?
|
|
150
|
+
def slice_for(view)
|
|
151
|
+
view.class.slice if view.class.respond_to?(:slice)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
data/lib/phlex/hanami.rb
CHANGED
|
@@ -36,7 +36,9 @@ Zeitwerk::Loader.new.tap do |loader|
|
|
|
36
36
|
loader.tag = "phlex-hanami"
|
|
37
37
|
loader.push_dir(lib_dir, namespace: Phlex::Hanami)
|
|
38
38
|
loader.collapse(File.join(lib_dir, "errors"))
|
|
39
|
-
|
|
39
|
+
# Test support is opt in, so nothing here should autoload it. `rspec.rb` also has no constant of
|
|
40
|
+
# its own for Zeitwerk to hang an autoload on.
|
|
41
|
+
loader.ignore(__FILE__, File.join(lib_dir, "rspec.rb"), File.join(lib_dir, "testing.rb"))
|
|
40
42
|
end.setup
|
|
41
43
|
|
|
42
44
|
# Installs the integration. Referencing the constant is what autoloads it, so this cannot move into
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
module Hanami
|
|
2
|
+
def self.app: () -> singleton(Slice)
|
|
3
|
+
|
|
4
|
+
def self.app?: () -> bool
|
|
5
|
+
|
|
6
|
+
def self.bundled?: (String) -> bool
|
|
7
|
+
|
|
8
|
+
class Error < StandardError
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class ComponentLoadError < Error
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
module SliceConfigurable
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# A slice is used as a class throughout, never instantiated, so every signature that takes one
|
|
18
|
+
# says `singleton(Hanami::Slice)`.
|
|
19
|
+
class Slice
|
|
20
|
+
def self.app: () -> singleton(Slice)
|
|
21
|
+
|
|
22
|
+
def self.[]: (String) -> untyped
|
|
23
|
+
|
|
24
|
+
def self.inflector: () -> Dry::Inflector
|
|
25
|
+
|
|
26
|
+
def self.key?: (String) -> bool
|
|
27
|
+
|
|
28
|
+
def self.namespace: () -> Module
|
|
29
|
+
|
|
30
|
+
def self.slice_name: () -> SliceName
|
|
31
|
+
|
|
32
|
+
class RoutesHelper
|
|
33
|
+
def path: (*untyped, **untyped) -> String
|
|
34
|
+
|
|
35
|
+
def url: (*untyped, **untyped) -> URI::Generic
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
class SliceName
|
|
40
|
+
def name: () -> String
|
|
41
|
+
|
|
42
|
+
def path: () -> String
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class Assets
|
|
46
|
+
def []: (String) -> _Asset
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
interface _Asset
|
|
50
|
+
def url: () -> String
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class Action
|
|
54
|
+
class Flash
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class Request
|
|
58
|
+
class Session
|
|
59
|
+
def []: (String | Symbol) -> untyped
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def flash: () -> Flash
|
|
63
|
+
|
|
64
|
+
def session: () -> Session
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class Mailer
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
module Providers
|
|
72
|
+
class I18n
|
|
73
|
+
class Backend
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# hanami-view is optional. When it is bundled Hanami builds the view context from its class rather
|
|
2
|
+
# than from ours, so a view's context is one or the other and every signature naming a context says
|
|
3
|
+
# so. Declaring the class here costs nothing when the gem is absent: RBS is never loaded at runtime.
|
|
4
|
+
module Hanami
|
|
5
|
+
class View
|
|
6
|
+
class Context
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Phlex
|
|
2
|
+
class SGML
|
|
3
|
+
def self.call: (?String, ?context: Hash[untyped, untyped], ?fragments: Array[String]?) ?{ (?) -> untyped } -> String
|
|
4
|
+
|
|
5
|
+
def call: (?String, ?context: Hash[untyped, untyped], ?fragments: Array[String]?) ?{ (?) -> untyped } -> String
|
|
6
|
+
|
|
7
|
+
def context: () -> Hash[untyped, untyped]
|
|
8
|
+
|
|
9
|
+
def raw: (untyped) -> void
|
|
10
|
+
|
|
11
|
+
def safe: (String) -> untyped
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class HTML < SGML
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/context.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Phlex
|
|
4
|
+
module Hanami
|
|
5
|
+
class Context
|
|
6
|
+
extend ::Hanami::SliceConfigurable
|
|
7
|
+
|
|
8
|
+
def self.configure_for_slice: (singleton(::Hanami::Slice)) -> void
|
|
9
|
+
|
|
10
|
+
attr_reader inflector: Dry::Inflector
|
|
11
|
+
|
|
12
|
+
def initialize: (?inflector: Dry::Inflector?, ?routes: ::Hanami::Slice::RoutesHelper?, ?assets: ::Hanami::Assets?, ?request: ::Hanami::Action::Request?, ?i18n: ::Hanami::Providers::I18n::Backend?, **untyped) -> void
|
|
13
|
+
|
|
14
|
+
def assets: () -> ::Hanami::Assets
|
|
15
|
+
|
|
16
|
+
def content_for: (Symbol, ?String?) ?{ () -> String } -> String?
|
|
17
|
+
|
|
18
|
+
def csrf_token: () -> String?
|
|
19
|
+
|
|
20
|
+
def flash: () -> ::Hanami::Action::Flash
|
|
21
|
+
|
|
22
|
+
def i18n: () -> ::Hanami::Providers::I18n::Backend
|
|
23
|
+
|
|
24
|
+
def initialize_copy: (self) -> void
|
|
25
|
+
|
|
26
|
+
def request: () -> ::Hanami::Action::Request
|
|
27
|
+
|
|
28
|
+
def request?: () -> bool
|
|
29
|
+
|
|
30
|
+
def routes: () -> ::Hanami::Slice::RoutesHelper
|
|
31
|
+
|
|
32
|
+
def session: () -> ::Hanami::Action::Request::Session
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def assets_hint: () -> String
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/contextual.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Phlex
|
|
4
|
+
module Hanami
|
|
5
|
+
module Contextual
|
|
6
|
+
def self.included: (singleton(::Phlex::SGML)) -> void
|
|
7
|
+
|
|
8
|
+
module I18nOverrides
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def _resolve_i18n_key: (String | Symbol) -> (String | Symbol)
|
|
12
|
+
|
|
13
|
+
def i18n_key_base: () -> String?
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module ClassMethods
|
|
17
|
+
def configure_for_slice: (singleton(::Hanami::Slice)) -> void
|
|
18
|
+
|
|
19
|
+
def slice: () -> singleton(::Hanami::Slice)?
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def asset_url: (String) -> String
|
|
23
|
+
|
|
24
|
+
def assets: () -> ::Hanami::Assets
|
|
25
|
+
|
|
26
|
+
def content_for: (Symbol, ?String?) ?{ () -> String } -> String?
|
|
27
|
+
|
|
28
|
+
def csrf_token: () -> String?
|
|
29
|
+
|
|
30
|
+
def flash: () -> ::Hanami::Action::Flash
|
|
31
|
+
|
|
32
|
+
def hanami_context: () -> (::Hanami::View::Context | Context)
|
|
33
|
+
|
|
34
|
+
def hanami_context?: () -> bool
|
|
35
|
+
|
|
36
|
+
def i18n: () -> ::Hanami::Providers::I18n::Backend
|
|
37
|
+
|
|
38
|
+
def path: (*untyped, **untyped) -> String
|
|
39
|
+
|
|
40
|
+
def request: () -> ::Hanami::Action::Request
|
|
41
|
+
|
|
42
|
+
def request?: () -> bool
|
|
43
|
+
|
|
44
|
+
def routes: () -> ::Hanami::Slice::RoutesHelper
|
|
45
|
+
|
|
46
|
+
def session: () -> ::Hanami::Action::Request::Session
|
|
47
|
+
|
|
48
|
+
def slice: () -> singleton(::Hanami::Slice)?
|
|
49
|
+
|
|
50
|
+
def url: (*untyped, **untyped) -> String
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def _context: () -> (::Hanami::View::Context | Context)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/extensions/mailer.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Phlex
|
|
4
|
+
module Hanami
|
|
5
|
+
module Extensions
|
|
6
|
+
module Mailer
|
|
7
|
+
def self.install: () -> void
|
|
8
|
+
|
|
9
|
+
module ClassMethods
|
|
10
|
+
def configure_for_slice: (singleton(::Hanami::Slice)) -> void
|
|
11
|
+
|
|
12
|
+
def phlex_view: () -> singleton(::Phlex::SGML)?
|
|
13
|
+
|
|
14
|
+
def slice: () -> singleton(::Hanami::Slice)?
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def view_name: (singleton(::Hanami::Slice)) -> String
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def view: () -> untyped
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/extensions/slice.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Phlex
|
|
4
|
+
module Hanami
|
|
5
|
+
module Extensions
|
|
6
|
+
module Slice
|
|
7
|
+
COMPONENT_INSTANCE: ^(untyped, *untyped, **untyped) -> untyped
|
|
8
|
+
|
|
9
|
+
def prepare: (?String?) -> untyped
|
|
10
|
+
|
|
11
|
+
def self.define_view_context: (singleton(::Hanami::Slice)) -> singleton(Context)?
|
|
12
|
+
|
|
13
|
+
def self.register_phlex_components: (singleton(::Hanami::Slice)) -> void
|
|
14
|
+
|
|
15
|
+
def self.view_context_class: (singleton(::Hanami::Slice)) -> (singleton(::Hanami::View::Context) | singleton(Context))
|
|
16
|
+
|
|
17
|
+
private def self.views_namespace: (singleton(::Hanami::Slice)) -> Module
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/helpers.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Phlex
|
|
4
|
+
module Hanami
|
|
5
|
+
module Helpers
|
|
6
|
+
OVERRIDDEN_METHODS: Hash[Symbol, UnboundMethod]
|
|
7
|
+
|
|
8
|
+
PhlexMethods: Module
|
|
9
|
+
|
|
10
|
+
def self.included: (singleton(::Phlex::SGML)) -> void
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/mailer/renderable.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Phlex
|
|
4
|
+
module Hanami
|
|
5
|
+
module Mailer
|
|
6
|
+
module Renderable
|
|
7
|
+
def self.included: (singleton(::Phlex::SGML)) -> void
|
|
8
|
+
|
|
9
|
+
module ClassMethods
|
|
10
|
+
def call: (?context: (::Hanami::View::Context | Context)?, ?format: Symbol | String, **untyped) -> String
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def default_layout: () -> singleton(::Phlex::SGML)?
|
|
15
|
+
|
|
16
|
+
def mail_context: () -> (::Hanami::View::Context | Context)?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module MailMethods
|
|
20
|
+
def path: (*untyped, **untyped) -> bot
|
|
21
|
+
|
|
22
|
+
def text_body: (String) -> String
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/mailer/text.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Phlex
|
|
4
|
+
module Hanami
|
|
5
|
+
module Mailer
|
|
6
|
+
class Text
|
|
7
|
+
BLOCK_ELEMENTS: Array[String]
|
|
8
|
+
|
|
9
|
+
BLOCK_PATTERN: Regexp
|
|
10
|
+
|
|
11
|
+
ENTITIES: Hash[String, String]
|
|
12
|
+
|
|
13
|
+
ENTITY_PATTERN: Regexp
|
|
14
|
+
|
|
15
|
+
LINK_CLOSE: String
|
|
16
|
+
|
|
17
|
+
LINK_OPEN: String
|
|
18
|
+
|
|
19
|
+
def self.call: (_ToS) -> String
|
|
20
|
+
|
|
21
|
+
private def self.anchor_text: (String, String) -> String
|
|
22
|
+
|
|
23
|
+
private def self.body_of: (String) -> String
|
|
24
|
+
|
|
25
|
+
private def self.expand_anchors: (String) -> String
|
|
26
|
+
|
|
27
|
+
private def self.expand_blocks: (String) -> String
|
|
28
|
+
|
|
29
|
+
private def self.expand_breaks: (String) -> String
|
|
30
|
+
|
|
31
|
+
private def self.expand_list_items: (String) -> String
|
|
32
|
+
|
|
33
|
+
private def self.href_in: (String) -> String
|
|
34
|
+
|
|
35
|
+
private def self.restore_links: (String) -> String
|
|
36
|
+
|
|
37
|
+
private def self.strip_hidden_elements: (String) -> String
|
|
38
|
+
|
|
39
|
+
private def self.strip_tags: (String) -> String
|
|
40
|
+
|
|
41
|
+
private def self.tidy: (String) -> String
|
|
42
|
+
|
|
43
|
+
private def self.unescape: (String) -> String
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/renderable.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Phlex
|
|
4
|
+
module Hanami
|
|
5
|
+
module Renderable
|
|
6
|
+
KEYWORD_TYPES: Array[Symbol]
|
|
7
|
+
|
|
8
|
+
UNSET: Object
|
|
9
|
+
|
|
10
|
+
def self.included: (singleton(::Phlex::SGML)) -> void
|
|
11
|
+
|
|
12
|
+
module ClassMethods
|
|
13
|
+
def call: (?context: (::Hanami::View::Context | Context)?, **untyped) -> String
|
|
14
|
+
|
|
15
|
+
def configured_layout: () -> (singleton(::Phlex::SGML) | Object | nil)
|
|
16
|
+
|
|
17
|
+
def layout: (?singleton(::Phlex::SGML)?) -> singleton(::Phlex::SGML)?
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def accepted_input: (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
22
|
+
|
|
23
|
+
def default_layout: () -> singleton(::Phlex::SGML)?
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/rspec.rb with RBS::Inline
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Generated from lib/phlex/hanami/slice_configured.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Phlex
|
|
4
|
+
module Hanami
|
|
5
|
+
class SliceConfigured < Module
|
|
6
|
+
attr_reader slice: singleton(::Hanami::Slice)
|
|
7
|
+
|
|
8
|
+
def initialize: (singleton(::Hanami::Slice)) -> void
|
|
9
|
+
|
|
10
|
+
def extended: (singleton(::Phlex::SGML) | singleton(::Hanami::Mailer)) -> void
|
|
11
|
+
|
|
12
|
+
def inspect: () -> String
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def define_slice: () -> void
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|