sorbet/rbi/gems/view_component@3.13.0.rbi
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `view_component` gem.
# Please instead update this file by running `bin/tapioca gem view_component`.
module PreviewHelper
def find_template_data(lookup_context:, template_identifier:); end
def preview_source; end
def prism_css_source_url; end
def prism_js_source_url; end
private
def prism_language_name_by_template(template:); end
def prism_language_name_by_template_path(template_file_path:); end
def serve_static_preview_assets?; end
end
PreviewHelper::AVAILABLE_PRISM_LANGUAGES = T.let(T.unsafe(nil), Array)
PreviewHelper::FALLBACK_LANGUAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component.rb#6
module ViewComponent
extend ::ActiveSupport::Autoload
end
# source://view_component//lib/view_component/errors.rb#229
class ViewComponent::AlreadyDefinedPolymorphicSlotSetterError < ::StandardError
# @return [AlreadyDefinedPolymorphicSlotSetterError] a new instance of AlreadyDefinedPolymorphicSlotSetterError
#
# source://view_component//lib/view_component/errors.rb#234
def initialize(setter_method_name, setter_name); end
end
# source://view_component//lib/view_component/errors.rb#230
ViewComponent::AlreadyDefinedPolymorphicSlotSetterError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/base.rb#18
class ViewComponent::Base < ::ActionView::Base
include ::ViewComponent::InlineTemplate
include ::ViewComponent::UseHelpers
include ::ViewComponent::Slotable
include ::ViewComponent::Translatable
include ::ViewComponent::WithContentHelper
extend ::ViewComponent::InlineTemplate::ClassMethods
extend ::ViewComponent::UseHelpers::ClassMethods
extend ::ViewComponent::Slotable::ClassMethods
extend ::ViewComponent::Translatable::ClassMethods
# @private
# @return [Base] a new instance of Base
#
# source://view_component//lib/view_component/base.rb#192
def initialize(*_arg0); end
# Returns the value of attribute __vc_original_view_context.
#
# source://view_component//lib/view_component/base.rb#48
def __vc_original_view_context; end
# Sets the attribute __vc_original_view_context
#
# @param value the value to set the attribute __vc_original_view_context to.
#
# source://view_component//lib/view_component/base.rb#48
def __vc_original_view_context=(_arg0); end
# Called before rendering the component. Override to perform operations that
# depend on having access to the view context, such as helpers.
#
# @return [void]
#
# source://view_component//lib/view_component/base.rb#180
def before_render; end
# source://view_component//lib/view_component/base.rb#39
def config(*_arg0, **_arg1, &_arg2); end
# The content passed to the component instance as a block.
#
# @return [String]
#
# source://view_component//lib/view_component/base.rb#285
def content; end
# Whether `content` has been passed to the component.
#
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#300
def content?; end
# source://view_component//lib/view_component/base.rb#42
def content_security_policy_nonce(*_arg0, **_arg1, &_arg2); end
# The current controller. Use sparingly as doing so introduces coupling
# that inhibits encapsulation & reuse, often making testing difficult.
#
# @raise [ControllerCalledBeforeRenderError]
# @return [ActionController::Base]
#
# source://view_component//lib/view_component/base.rb#215
def controller; end
# source://view_component//lib/view_component/base.rb#39
def form_authenticity_token(*_arg0, **_arg1, &_arg2); end
# For caching, such as #cache_if
#
# @private
#
# source://view_component//lib/view_component/base.rb#270
def format; end
# A proxy through which to access helpers. Use sparingly as doing so introduces
# coupling that inhibits encapsulation & reuse, often making testing difficult.
#
# @raise [HelpersCalledBeforeRenderError]
# @return [ActionView::Base]
#
# source://view_component//lib/view_component/base.rb#225
def helpers; end
# source://view_component//lib/view_component/translatable.rb#16
def i18n_backend; end
# @private
#
# source://view_component//lib/view_component/base.rb#240
def method_missing(method_name, *args); end
# Optional content to be returned after the rendered template.
#
# @return [String]
#
# source://view_component//lib/view_component/base.rb#172
def output_postamble; end
# Optional content to be returned before the rendered template.
#
# @return [String]
#
# source://view_component//lib/view_component/base.rb#165
def output_preamble; end
# source://view_component//lib/view_component/base.rb#39
def protect_against_forgery?(*_arg0, **_arg1, &_arg2); end
# source://view_component//lib/view_component/slotable.rb#19
def registered_slots; end
# source://view_component//lib/view_component/slotable.rb#19
def registered_slots=(_arg0); end
# source://view_component//lib/view_component/slotable.rb#19
def registered_slots?; end
# Re-use original view_context if we're not rendering a component.
#
# This prevents an exception when rendering a partial inside of a component that has also been rendered outside
# of the component. This is due to the partials compiled template method existing in the parent `view_context`,
# and not the component's `view_context`.
#
# @private
#
# source://view_component//lib/view_component/base.rb#202
def render(options = T.unsafe(nil), args = T.unsafe(nil), &block); end
# Override to determine whether the ViewComponent should render.
#
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#187
def render?; end
# Entrypoint for rendering components.
#
# - `view_context`: ActionView context from calling view
# - `block`: optional block to be captured within the view context
#
# Returns HTML that has been escaped by the respective template handler.
#
# @return [String]
#
# source://view_component//lib/view_component/base.rb#71
def render_in(view_context, &block); end
# Subclass components that call `super` inside their template code will cause a
# double render if they emit the result.
#
# ```erb
# <%= super %> # double-renders
# <% super %> # doesn't double-render
# ```
#
# `super` also doesn't consider the current variant. `render_parent` renders the
# parent template considering the current variant and emits the result without
# double-rendering.
#
# source://view_component//lib/view_component/base.rb#134
def render_parent; end
# Renders the parent component to a string and returns it. This method is meant
# to be used inside custom #call methods when a string result is desired, eg.
#
# ```ruby
# def call
# "<div>#{render_parent_to_string}</div>"
# end
# ```
#
# When rendering the parent inside an .erb template, use `#render_parent` instead.
#
# source://view_component//lib/view_component/base.rb#149
def render_parent_to_string; end
# The current request. Use sparingly as doing so introduces coupling that
# inhibits encapsulation & reuse, often making testing difficult.
#
# @return [ActionDispatch::Request]
#
# source://view_component//lib/view_component/base.rb#278
def request; end
# Components render in their own view context. Helpers and other functionality
# require a reference to the original Rails view context, an instance of
# `ActionView::Base`. Use this method to set a reference to the original
# view context. Objects that implement this method will render in the component's
# view context, while objects that don't will render in the original view context
# so helpers, etc work as expected.
#
# @param view_context [ActionView::Base] The original view context.
# @return [void]
#
# source://view_component//lib/view_component/base.rb#59
def set_original_view_context(view_context); end
# For caching, such as #cache_if
#
# @private
#
# source://view_component//lib/view_component/base.rb#263
def view_cache_dependencies; end
# Exposes .virtual_path as an instance method
#
# @private
#
# source://view_component//lib/view_component/base.rb#257
def virtual_path; end
private
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#312
def __vc_content_set_by_with_content_defined?; end
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#308
def __vc_render_in_block_provided?; end
# source://view_component//lib/view_component/base.rb#354
def compiler; end
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#316
def content_evaluated?; end
# source://view_component//lib/view_component/base.rb#320
def maybe_escape_html(text); end
# source://view_component//lib/view_component/base.rb#348
def safe_output_postamble; end
# source://view_component//lib/view_component/base.rb#342
def safe_output_preamble; end
# source://view_component//lib/view_component/base.rb#332
def safe_render_template_for(variant); end
# Returns the value of attribute view_context.
#
# source://view_component//lib/view_component/base.rb#306
def view_context; end
class << self
# source://view_component//lib/view_component/base.rb#45
def __vc_strip_trailing_whitespace; end
# source://view_component//lib/view_component/base.rb#45
def __vc_strip_trailing_whitespace=(value); end
# source://view_component//lib/view_component/base.rb#20
def capture_compatibility_patch_enabled(*_arg0, **_arg1, &_arg2); end
# @private
#
# source://view_component//lib/view_component/base.rb#674
def collection_counter_parameter; end
# @private
#
# source://view_component//lib/view_component/base.rb#684
def collection_iteration_parameter; end
# @private
#
# source://view_component//lib/view_component/base.rb#669
def collection_parameter; end
# Compile templates to instance methods, assuming they haven't been compiled already.
#
# Do as much work as possible in this step, as doing so reduces the amount
# of work done each time a component is rendered.
#
# @private
#
# source://view_component//lib/view_component/base.rb#579
def compile(raise_errors: T.unsafe(nil), force: T.unsafe(nil)); end
# @private
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#565
def compiled?; end
# @private
#
# source://view_component//lib/view_component/base.rb#584
def compiler; end
# source://view_component//lib/view_component/base.rb#20
def component_parent_class(*_arg0, **_arg1, &_arg2); end
# Returns the current config.
#
# @return [ActiveSupport::OrderedOptions]
#
# source://view_component//lib/view_component/base.rb#25
def config; end
# @private
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#679
def counter_argument_present?; end
# source://view_component//lib/view_component/base.rb#20
def default_preview_layout(*_arg0, **_arg1, &_arg2); end
# @private
#
# source://view_component//lib/view_component/base.rb#570
def ensure_compiled; end
# @private
#
# source://view_component//lib/view_component/base.rb#595
def format; end
# source://view_component//lib/view_component/base.rb#20
def generate(*_arg0, **_arg1, &_arg2); end
# source://view_component//lib/view_component/translatable.rb#16
def i18n_backend; end
# source://view_component//lib/view_component/translatable.rb#16
def i18n_backend=(value); end
# @private
#
# source://view_component//lib/view_component/base.rb#600
def identifier; end
# @private
# @private
#
# source://view_component//lib/view_component/base.rb#510
def inherited(child); end
# source://view_component//lib/view_component/base.rb#20
def instrumentation_enabled(*_arg0, **_arg1, &_arg2); end
# @private
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#689
def iteration_argument_present?; end
# source://view_component//lib/view_component/base.rb#20
def preview_controller(*_arg0, **_arg1, &_arg2); end
# source://view_component//lib/view_component/base.rb#20
def preview_paths(*_arg0, **_arg1, &_arg2); end
# source://view_component//lib/view_component/base.rb#20
def preview_route(*_arg0, **_arg1, &_arg2); end
# source://view_component//lib/view_component/slotable.rb#19
def registered_slots; end
# source://view_component//lib/view_component/slotable.rb#19
def registered_slots=(value); end
# source://view_component//lib/view_component/slotable.rb#19
def registered_slots?; end
# source://view_component//lib/view_component/base.rb#20
def render_monkey_patch_enabled(*_arg0, **_arg1, &_arg2); end
# Provide identifier for ActionView template annotations
#
# @private
#
# source://view_component//lib/view_component/base.rb#505
def short_identifier; end
# source://view_component//lib/view_component/base.rb#20
def show_previews(*_arg0, **_arg1, &_arg2); end
# source://view_component//lib/view_component/base.rb#20
def show_previews_source(*_arg0, **_arg1, &_arg2); end
# Find sidecar files for the given extensions.
#
# The provided array of extensions is expected to contain
# strings starting without the dot, example: `["erb", "haml"]`.
#
# For example, one might collect sidecar CSS files that need to be compiled.
#
# @param extensions [Array<String>] Extensions of which to return matching sidecar files.
#
# source://view_component//lib/view_component/base.rb#455
def sidecar_files(extensions); end
# @private
#
# source://view_component//lib/view_component/base.rb#446
def source_location; end
# @private
#
# source://view_component//lib/view_component/base.rb#446
def source_location=(_arg0); end
# Strips trailing whitespace from templates before compiling them.
#
# ```ruby
# class MyComponent < ViewComponent::Base
# strip_trailing_whitespace
# end
# ```
#
# @param value [Boolean] Whether to strip newlines.
#
# source://view_component//lib/view_component/base.rb#625
def strip_trailing_whitespace(value = T.unsafe(nil)); end
# Whether trailing whitespace will be stripped before compilation.
#
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#632
def strip_trailing_whitespace?; end
# source://view_component//lib/view_component/base.rb#20
def test_controller(*_arg0, **_arg1, &_arg2); end
# we'll eventually want to update this to support other types
#
# @private
#
# source://view_component//lib/view_component/base.rb#590
def type; end
# source://view_component//lib/view_component/base.rb#20
def use_deprecated_instrumentation_name(*_arg0, **_arg1, &_arg2); end
# Ensure the component initializer accepts the
# collection parameter. By default, we don't
# validate that the default parameter name
# is accepted, as support for collection
# rendering is optional.
#
# @private TODO: add documentation
# @raise [MissingCollectionArgumentError]
#
# source://view_component//lib/view_component/base.rb#642
def validate_collection_parameter!(validate_default: T.unsafe(nil)); end
# Ensure the component initializer doesn't define
# invalid parameters that could override the framework's
# methods.
#
# @private TODO: add documentation
# @raise [ReservedParameterError]
#
# source://view_component//lib/view_component/base.rb#662
def validate_initialization_parameters!; end
# source://view_component//lib/view_component/base.rb#20
def view_component_path(*_arg0, **_arg1, &_arg2); end
# @private
#
# source://view_component//lib/view_component/base.rb#446
def virtual_path; end
# @private
#
# source://view_component//lib/view_component/base.rb#446
def virtual_path=(_arg0); end
# Render a component for each element in a collection ([documentation](/guide/collections)):
#
# ```ruby
# render(ProductsComponent.with_collection(@products, foo: :bar))
# ```
#
# @param collection [Enumerable] A list of items to pass the ViewComponent one at a time.
# @param args [Arguments] Arguments to pass to the ViewComponent every time.
#
# source://view_component//lib/view_component/base.rb#498
def with_collection(collection, **args); end
# Set the parameter name used when rendering elements of a collection ([documentation](/guide/collections)):
#
# ```ruby
# with_collection_parameter :item
# ```
#
# @param parameter [Symbol] The parameter name used when rendering elements of a collection.
#
# source://view_component//lib/view_component/base.rb#611
def with_collection_parameter(parameter); end
private
# source://view_component//lib/view_component/base.rb#700
def initialize_parameter_names; end
# source://view_component//lib/view_component/base.rb#708
def initialize_parameters; end
# source://view_component//lib/view_component/base.rb#712
def provided_collection_parameter; end
# @return [Boolean]
#
# source://view_component//lib/view_component/base.rb#695
def splatted_keyword_argument_present?; end
end
end
# source://view_component//lib/view_component/base.rb#36
ViewComponent::Base::RESERVED_PARAMETER = T.let(T.unsafe(nil), Symbol)
# source://view_component//lib/view_component/errors.rb#2
class ViewComponent::BaseError < ::StandardError
# @return [BaseError] a new instance of BaseError
#
# source://view_component//lib/view_component/errors.rb#3
def initialize; end
end
# CaptureCompatibility is a module that patches #capture to fix issues
# related to ViewComponent and functionality that relies on `capture`
# like forms, capture itself, turbo frames, etc.
#
# This underlying incompatibility with ViewComponent and capture is
# that several features like forms keep a reference to the primary
# `ActionView::Base` instance which has its own @output_buffer. When
# `#capture` is called on the original `ActionView::Base` instance while
# evaluating a block from a ViewComponent the @output_buffer is overridden
# in the ActionView::Base instance, and *not* the component. This results
# in a double render due to `#capture` implementation details.
#
# To resolve the issue, we override `#capture` so that we can delegate
# the `capture` logic to the ViewComponent that created the block.
#
# source://view_component//lib/view_component/capture_compatibility.rb#18
module ViewComponent::CaptureCompatibility
class << self
# @private
#
# source://view_component//lib/view_component/capture_compatibility.rb#19
def included(base); end
end
end
# source://view_component//lib/view_component/capture_compatibility.rb#29
module ViewComponent::CaptureCompatibility::InstanceMethods
# source://view_component//lib/view_component/capture_compatibility.rb#30
def capture(*args, &block); end
end
# source://view_component//lib/view_component/collection.rb#6
class ViewComponent::Collection
include ::Enumerable
# @return [Collection] a new instance of Collection
#
# source://view_component//lib/view_component/collection.rb#46
def initialize(component, object, **options); end
# Returns the value of attribute __vc_original_view_context.
#
# source://view_component//lib/view_component/collection.rb#13
def __vc_original_view_context; end
# Sets the attribute __vc_original_view_context
#
# @param value the value to set the attribute __vc_original_view_context to.
#
# source://view_component//lib/view_component/collection.rb#13
def __vc_original_view_context=(_arg0); end
# Returns the value of attribute component.
#
# source://view_component//lib/view_component/collection.rb#8
def component; end
# source://view_component//lib/view_component/collection.rb#26
def components; end
# source://view_component//lib/view_component/collection.rb#40
def each(&block); end
# source://view_component//lib/view_component/collection.rb#10
def format(*_arg0, **_arg1, &_arg2); end
# source://view_component//lib/view_component/collection.rb#19
def render_in(view_context, &block); end
# source://view_component//lib/view_component/collection.rb#15
def set_original_view_context(view_context); end
# source://view_component//lib/view_component/collection.rb#11
def size(*_arg0, **_arg1, &_arg2); end
private
# source://view_component//lib/view_component/collection.rb#52
def collection_variable(object); end
# source://view_component//lib/view_component/collection.rb#60
def component_options(item, iterator); end
end
# Keeps track of which templates have already been compiled
# This isn't part of the public API
#
# source://view_component//lib/view_component/compile_cache.rb#6
module ViewComponent::CompileCache
private
# source://view_component//lib/view_component/compile_cache.rb#17
def compiled?(klass); end
# source://view_component//lib/view_component/compile_cache.rb#25
def invalidate!; end
# source://view_component//lib/view_component/compile_cache.rb#21
def invalidate_class!(klass); end
# source://view_component//lib/view_component/compile_cache.rb#13
def register(klass); end
class << self
# source://view_component//lib/view_component/compile_cache.rb#7
def cache; end
# source://view_component//lib/view_component/compile_cache.rb#7
def cache=(val); end
# @return [Boolean]
#
# source://view_component//lib/view_component/compile_cache.rb#17
def compiled?(klass); end
# source://view_component//lib/view_component/compile_cache.rb#25
def invalidate!; end
# source://view_component//lib/view_component/compile_cache.rb#21
def invalidate_class!(klass); end
# source://view_component//lib/view_component/compile_cache.rb#13
def register(klass); end
end
end
# source://view_component//lib/view_component/compiler.rb#6
class ViewComponent::Compiler
# @return [Compiler] a new instance of Compiler
#
# source://view_component//lib/view_component/compiler.rb#16
def initialize(component_class); end
# source://view_component//lib/view_component/compiler.rb#30
def compile(raise_errors: T.unsafe(nil), force: T.unsafe(nil)); end
# @return [Boolean]
#
# source://view_component//lib/view_component/compiler.rb#22
def compiled?; end
# @return [Boolean]
#
# source://view_component//lib/view_component/compiler.rb#26
def development?; end
# source://view_component//lib/view_component/compiler.rb#14
def mode; end
# source://view_component//lib/view_component/compiler.rb#14
def mode=(_arg0); end
# source://view_component//lib/view_component/compiler.rb#14
def mode?; end
# @return [Boolean]
#
# source://view_component//lib/view_component/compiler.rb#94
def renders_template_for_variant?(variant); end
private
# @return [Boolean]
#
# source://view_component//lib/view_component/compiler.rb#300
def call_defined?; end
# source://view_component//lib/view_component/compiler.rb#280
def call_method_name(variant); end
# source://view_component//lib/view_component/compiler.rb#262
def compile_template(template, handler); end
# source://view_component//lib/view_component/compiler.rb#248
def compiled_inline_template(template); end
# source://view_component//lib/view_component/compiler.rb#255
def compiled_template(file_path); end
# Returns the value of attribute component_class.
#
# source://view_component//lib/view_component/compiler.rb#100
def component_class; end
# source://view_component//lib/view_component/compiler.rb#102
def define_render_template_for; end
# @return [Boolean]
#
# source://view_component//lib/view_component/compiler.rb#131
def has_inline_template?; end
# source://view_component//lib/view_component/compiler.rb#217
def inline_calls; end
# source://view_component//lib/view_component/compiler.rb#232
def inline_calls_defined_on_self; end
# source://view_component//lib/view_component/compiler.rb#288
def normalized_variant_name(variant); end
# Returns the value of attribute redefinition_lock.
#
# source://view_component//lib/view_component/compiler.rb#100
def redefinition_lock; end
# source://view_component//lib/view_component/compiler.rb#292
def safe_class_name; end
# @return [Boolean]
#
# source://view_component//lib/view_component/compiler.rb#296
def should_compile_superclass?; end
# source://view_component//lib/view_component/compiler.rb#135
def template_errors; end
# source://view_component//lib/view_component/compiler.rb#201
def templates; end
# source://view_component//lib/view_component/compiler.rb#236
def variants; end
# source://view_component//lib/view_component/compiler.rb#242
def variants_from_inline_calls(calls); end
class << self
# source://view_component//lib/view_component/compiler.rb#14
def mode; end
# source://view_component//lib/view_component/compiler.rb#14
def mode=(value); end
# source://view_component//lib/view_component/compiler.rb#14
def mode?; end
end
end
# Compiler mode. Can be either:
# * development (a blocking mode which ensures thread safety when redefining the `call` method for components,
# default in Rails development and test mode)
# * production (a non-blocking mode, default in Rails production mode)
#
# source://view_component//lib/view_component/compiler.rb#11
ViewComponent::Compiler::DEVELOPMENT_MODE = T.let(T.unsafe(nil), Symbol)
# source://view_component//lib/view_component/compiler.rb#12
ViewComponent::Compiler::PRODUCTION_MODE = T.let(T.unsafe(nil), Symbol)
# source://view_component//lib/view_component/component_error.rb#4
class ViewComponent::ComponentError < ::StandardError; end
# source://view_component//lib/view_component/config.rb#6
class ViewComponent::Config
# @return [Config] a new instance of Config
#
# source://view_component//lib/view_component/config.rb#191
def initialize; end
# Returns the current ViewComponent::Config. This is persisted against this
# class so that config options remain accessible before the rest of
# ViewComponent has loaded. Defaults to an instance of ViewComponent::Config
# with all other documented defaults set.
#
# @return [ViewComponent::Config]
#
# source://view_component//lib/view_component/config.rb#189
def current; end
# Returns the current ViewComponent::Config. This is persisted against this
# class so that config options remain accessible before the rest of
# ViewComponent has loaded. Defaults to an instance of ViewComponent::Config
# with all other documented defaults set.
#
# @return [ViewComponent::Config]
#
# source://view_component//lib/view_component/config.rb#189
def current=(_arg0); end
# source://activesupport/7.1.3.4/lib/active_support/core_ext/module/delegation.rb#331
def method_missing(method, *args, **_arg2, &block); end
private
# Returns the value of attribute config.
#
# source://view_component//lib/view_component/config.rb#199
def config; end
# source://activesupport/7.1.3.4/lib/active_support/core_ext/module/delegation.rb#323
def respond_to_missing?(name, include_private = T.unsafe(nil)); end
class << self
# source://view_component//lib/view_component/config.rb#189
def current; end
# source://view_component//lib/view_component/config.rb#189
def current=(value); end
# `new` without any arguments initializes the default configuration, but
# it's important to differentiate in case that's no longer the case in
# future.
def default(*_arg0); end
# source://view_component//lib/view_component/config.rb#176
def default_generate_options; end
# Enables the experimental capture compatibility patch that makes ViewComponent
# compatible with forms, capture, and other built-ins.
# previews.
# Defaults to `false`.
#
# @return [Boolean]
#
# source://view_component//lib/view_component/config.rb#170
def default_preview_paths; end
# source://view_component//lib/view_component/config.rb#13
def defaults; end
end
end
# source://view_component//lib/view_component/errors.rb#162
class ViewComponent::ContentAlreadySetForPolymorphicSlotError < ::StandardError
# @return [ContentAlreadySetForPolymorphicSlotError] a new instance of ContentAlreadySetForPolymorphicSlotError
#
# source://view_component//lib/view_component/errors.rb#165
def initialize(slot_name); end
end
# source://view_component//lib/view_component/errors.rb#163
ViewComponent::ContentAlreadySetForPolymorphicSlotError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#90
class ViewComponent::ContentSlotNameError < ::StandardError
# @return [ContentSlotNameError] a new instance of ContentSlotNameError
#
# source://view_component//lib/view_component/errors.rb#96
def initialize(klass_name); end
end
# source://view_component//lib/view_component/errors.rb#91
ViewComponent::ContentSlotNameError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#194
class ViewComponent::ControllerCalledBeforeRenderError < ::ViewComponent::BaseError; end
# source://view_component//lib/view_component/errors.rb#195
ViewComponent::ControllerCalledBeforeRenderError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/deprecation.rb#6
ViewComponent::DEPRECATION_HORIZON = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/deprecation.rb#7
ViewComponent::Deprecation = T.let(T.unsafe(nil), ActiveSupport::Deprecation)
# source://view_component//lib/view_component/errors.rb#39
class ViewComponent::DuplicateContentError < ::StandardError
# @return [DuplicateContentError] a new instance of DuplicateContentError
#
# source://view_component//lib/view_component/errors.rb#45
def initialize(klass_name); end
end
# source://view_component//lib/view_component/errors.rb#40
ViewComponent::DuplicateContentError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#8
class ViewComponent::DuplicateSlotContentError < ::StandardError
# @return [DuplicateSlotContentError] a new instance of DuplicateSlotContentError
#
# source://view_component//lib/view_component/errors.rb#14
def initialize(klass_name); end
end
# source://view_component//lib/view_component/errors.rb#9
ViewComponent::DuplicateSlotContentError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#50
class ViewComponent::EmptyOrInvalidInitializerError < ::StandardError
# @return [EmptyOrInvalidInitializerError] a new instance of EmptyOrInvalidInitializerError
#
# source://view_component//lib/view_component/errors.rb#57
def initialize(klass_name, parameter); end
end
# source://view_component//lib/view_component/errors.rb#51
ViewComponent::EmptyOrInvalidInitializerError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/engine.rb#8
class ViewComponent::Engine < ::Rails::Engine
# @return [Boolean]
#
# source://view_component//lib/view_component/engine.rb#126
def serve_static_preview_assets?(app_config); end
class << self
# source://activesupport/7.1.3.4/lib/active_support/callbacks.rb#70
def __callbacks; end
end
end
# source://view_component//lib/view_component/errors.rb#185
class ViewComponent::HelpersCalledBeforeRenderError < ::ViewComponent::BaseError; end
# source://view_component//lib/view_component/errors.rb#186
ViewComponent::HelpersCalledBeforeRenderError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/inline_template.rb#4
module ViewComponent::InlineTemplate
extend ::ActiveSupport::Concern
mixes_in_class_methods ::ViewComponent::InlineTemplate::ClassMethods
end
# source://view_component//lib/view_component/inline_template.rb#0
module ViewComponent::InlineTemplate::ClassMethods
# source://view_component//lib/view_component/inline_template.rb#49
def inherited(subclass); end
# source://view_component//lib/view_component/inline_template.rb#41
def inline_template; end
# source://view_component//lib/view_component/inline_template.rb#45
def inline_template_language; end
# source://view_component//lib/view_component/inline_template.rb#9
def method_missing(method, *args, **_arg2); end
private
# source://view_component//lib/view_component/inline_template.rb#37
def respond_to_missing?(method, include_all = T.unsafe(nil)); end
end
# source://view_component//lib/view_component/inline_template.rb#6
class ViewComponent::InlineTemplate::Template < ::Struct
# Returns the value of attribute language
#
# @return [Object] the current value of language
def language; end
# Sets the attribute language
#
# @param value [Object] the value to set the attribute language to.
# @return [Object] the newly set value
def language=(_); end
# Returns the value of attribute lineno
#
# @return [Object] the current value of lineno
def lineno; end
# Sets the attribute lineno
#
# @param value [Object] the value to set the attribute lineno to.
# @return [Object] the newly set value
def lineno=(_); end
# Returns the value of attribute path
#
# @return [Object] the current value of path
def path; end
# Sets the attribute path
#
# @param value [Object] the value to set the attribute path to.
# @return [Object] the newly set value
def path=(_); end
# Returns the value of attribute source
#
# @return [Object] the current value of source
def source; end
# Sets the attribute source
#
# @param value [Object] the value to set the attribute source to.
# @return [Object] the newly set value
def source=(_); end
class << self
def [](*_arg0); end
def inspect; end
def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
# source://view_component//lib/view_component/instrumentation.rb#6
module ViewComponent::Instrumentation
# source://view_component//lib/view_component/instrumentation.rb#11
def render_in(view_context, &block); end
private
# source://view_component//lib/view_component/instrumentation.rb#25
def notification_name; end
class << self
# @private
#
# source://view_component//lib/view_component/instrumentation.rb#7
def included(mod); end
end
end
# source://view_component//lib/view_component/errors.rb#84
class ViewComponent::InvalidCollectionArgumentError < ::ViewComponent::BaseError; end
# source://view_component//lib/view_component/errors.rb#85
ViewComponent::InvalidCollectionArgumentError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#101
class ViewComponent::InvalidSlotDefinitionError < ::ViewComponent::BaseError; end
# source://view_component//lib/view_component/errors.rb#102
ViewComponent::InvalidSlotDefinitionError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#107
class ViewComponent::InvalidSlotNameError < ::StandardError; end
# source://view_component//lib/view_component/errors.rb#62
class ViewComponent::MissingCollectionArgumentError < ::StandardError
# @return [MissingCollectionArgumentError] a new instance of MissingCollectionArgumentError
#
# source://view_component//lib/view_component/errors.rb#69
def initialize(klass_name, parameter); end
end
# source://view_component//lib/view_component/errors.rb#63
ViewComponent::MissingCollectionArgumentError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#29
class ViewComponent::MissingPreviewTemplateError < ::StandardError
# @return [MissingPreviewTemplateError] a new instance of MissingPreviewTemplateError
#
# source://view_component//lib/view_component/errors.rb#34
def initialize(example); end
end
# source://view_component//lib/view_component/errors.rb#30
ViewComponent::MissingPreviewTemplateError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#25
class ViewComponent::MultipleInlineTemplatesError < ::ViewComponent::BaseError; end
# source://view_component//lib/view_component/errors.rb#26
ViewComponent::MultipleInlineTemplatesError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#212
class ViewComponent::MultipleMatchingTemplatesForPreviewError < ::StandardError
# @return [MultipleMatchingTemplatesForPreviewError] a new instance of MultipleMatchingTemplatesForPreviewError
#
# source://view_component//lib/view_component/errors.rb#215
def initialize(template_identifier); end
end
# source://view_component//lib/view_component/errors.rb#213
ViewComponent::MultipleMatchingTemplatesForPreviewError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#170
class ViewComponent::NilWithContentError < ::ViewComponent::BaseError; end
# source://view_component//lib/view_component/errors.rb#171
ViewComponent::NilWithContentError::MESSAGE = T.let(T.unsafe(nil), String)
# :nocov:
#
# source://view_component//lib/view_component/errors.rb#204
class ViewComponent::NoMatchingTemplatesForPreviewError < ::StandardError
# @return [NoMatchingTemplatesForPreviewError] a new instance of NoMatchingTemplatesForPreviewError
#
# source://view_component//lib/view_component/errors.rb#207
def initialize(template_identifier); end
end
# source://view_component//lib/view_component/errors.rb#205
ViewComponent::NoMatchingTemplatesForPreviewError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/preview.rb#6
class ViewComponent::Preview
include ::ActionDispatch::Routing::PolymorphicRoutes
include ::ActionDispatch::Routing::UrlFor
include ::ActionView::Helpers::AssetUrlHelper
include ::ActionView::Helpers::CaptureHelper
include ::ActionView::Helpers::OutputSafetyHelper
include ::ActionView::Helpers::TagHelper
include ::ActionView::Helpers::AssetTagHelper
extend ::ActiveSupport::DescendantsTracker
# source://actionpack/7.1.3.4/lib/action_dispatch/routing/url_for.rb#97
def default_url_options; end
# source://actionpack/7.1.3.4/lib/action_dispatch/routing/url_for.rb#97
def default_url_options=(_arg0); end
# source://actionpack/7.1.3.4/lib/action_dispatch/routing/url_for.rb#97
def default_url_options?; end
# source://view_component//lib/view_component/preview.rb#16
def render(component, **args, &block); end
# source://view_component//lib/view_component/preview.rb#16
def render_component(component, **args, &block); end
# source://view_component//lib/view_component/preview.rb#26
def render_with_template(template: T.unsafe(nil), locals: T.unsafe(nil)); end
class << self
# source://actionpack/7.1.3.4/lib/action_dispatch/routing/route_set.rb#584
def _routes; end
# Returns all component preview classes.
#
# source://view_component//lib/view_component/preview.rb#37
def all; end
# source://actionpack/7.1.3.4/lib/action_dispatch/routing/url_for.rb#97
def default_url_options; end
# source://actionpack/7.1.3.4/lib/action_dispatch/routing/url_for.rb#97
def default_url_options=(value); end
# source://actionpack/7.1.3.4/lib/action_dispatch/routing/url_for.rb#97
def default_url_options?; end
# Returns all of the available examples for the component preview.
#
# source://view_component//lib/view_component/preview.rb#55
def examples; end
# Returns +true+ if the preview exists.
#
# @return [Boolean]
#
# source://view_component//lib/view_component/preview.rb#60
def exists?(preview); end
# Find a component preview by its underscored class name.
#
# source://view_component//lib/view_component/preview.rb#65
def find(preview); end
# Setter for layout name.
#
# source://view_component//lib/view_component/preview.rb#76
def layout(layout_name); end
# source://view_component//lib/view_component/preview.rb#103
def load_previews; end
# Returns the relative path (from preview_path) to the preview example template if the template exists
#
# @raise [MissingPreviewTemplateError]
#
# source://view_component//lib/view_component/preview.rb#82
def preview_example_template_path(example); end
# Returns the underscored name of the component preview without the suffix.
#
# source://view_component//lib/view_component/preview.rb#70
def preview_name; end
# Returns the method body for the example from the preview file.
#
# source://view_component//lib/view_component/preview.rb#98
def preview_source(example); end
# Returns the arguments for rendering of the component in its layout
#
# source://view_component//lib/view_component/preview.rb#44
def render_args(example, params: T.unsafe(nil)); end
private
# source://view_component//lib/view_component/preview.rb#111
def preview_paths; end
end
end
module ViewComponent::PreviewActions
extend ::ActiveSupport::Concern
def index; end
def previews; end
private
def default_preview_layout; end
def determine_layout(layout_override = T.unsafe(nil), prepend_views: T.unsafe(nil)); end
def find_preview; end
def prepend_application_view_paths; end
def prepend_preview_examples_view_path; end
def set_locale(&block); end
def show_previews?; end
end
# source://view_component//lib/view_component/errors.rb#122
class ViewComponent::RedefinedSlotError < ::StandardError
# @return [RedefinedSlotError] a new instance of RedefinedSlotError
#
# source://view_component//lib/view_component/errors.rb#127
def initialize(klass_name, slot_name); end
end
# source://view_component//lib/view_component/errors.rb#123
ViewComponent::RedefinedSlotError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#74
class ViewComponent::ReservedParameterError < ::StandardError
# @return [ReservedParameterError] a new instance of ReservedParameterError
#
# source://view_component//lib/view_component/errors.rb#79
def initialize(klass_name, parameter); end
end
# source://view_component//lib/view_component/errors.rb#75
ViewComponent::ReservedParameterError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#142
class ViewComponent::ReservedPluralSlotNameError < ::ViewComponent::InvalidSlotNameError
# @return [ReservedPluralSlotNameError] a new instance of ReservedPluralSlotNameError
#
# source://view_component//lib/view_component/errors.rb#147
def initialize(klass_name, slot_name); end
end
# source://view_component//lib/view_component/errors.rb#143
ViewComponent::ReservedPluralSlotNameError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#132
class ViewComponent::ReservedSingularSlotNameError < ::ViewComponent::InvalidSlotNameError
# @return [ReservedSingularSlotNameError] a new instance of ReservedSingularSlotNameError
#
# source://view_component//lib/view_component/errors.rb#137
def initialize(klass_name, slot_name); end
end
# source://view_component//lib/view_component/errors.rb#133
ViewComponent::ReservedSingularSlotNameError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/slot.rb#6
class ViewComponent::Slot
include ::ViewComponent::WithContentHelper
# @return [Slot] a new instance of Slot
#
# source://view_component//lib/view_component/slot.rb#11
def initialize(parent); end
# Sets the attribute __vc_component_instance
#
# @param value the value to set the attribute __vc_component_instance to.
#
# source://view_component//lib/view_component/slot.rb#9
def __vc_component_instance=(_arg0); end
# Sets the attribute __vc_content
#
# @param value the value to set the attribute __vc_content to.
#
# source://view_component//lib/view_component/slot.rb#9
def __vc_content=(_arg0); end
# Sets the attribute __vc_content_block
#
# @param value the value to set the attribute __vc_content_block to.
#
# source://view_component//lib/view_component/slot.rb#9
def __vc_content_block=(_arg0); end
# @return [Boolean]
#
# source://view_component//lib/view_component/slot.rb#15
def content?; end
# @return [Boolean]
#
# source://view_component//lib/view_component/slot.rb#109
def html_safe?; end
# Allow access to public component methods via the wrapper
#
# for example
#
# calling `header.name` (where `header` is a slot) will call `name`
# on the `HeaderComponent` instance.
#
# Where the component may look like:
#
# class MyComponent < ViewComponent::Base
# has_one :header, HeaderComponent
#
# class HeaderComponent < ViewComponent::Base
# def name
# @name
# end
# end
# end
#
# source://view_component//lib/view_component/slot.rb#104
def method_missing(symbol, *args, **_arg2, &block); end
# Used to render the slot content in the template
#
# There's currently 3 different values that may be set, that we can render.
#
# If the slot renderable is a component, the string class name of a
# component, or a function that returns a component, we render that
# component instance, returning the string.
#
# If the slot renderable is a function and returns a string, it's
# set as `@__vc_content` and is returned directly.
#
# If there is no slot renderable, we evaluate the block passed to
# the slot and return it.
#
# source://view_component//lib/view_component/slot.rb#45
def to_s; end
# source://view_component//lib/view_component/slot.rb#24
def with_content(args); end
private
# @return [Boolean]
#
# source://view_component//lib/view_component/slot.rb#121
def __vc_component_instance?; end
# @return [Boolean]
#
# source://view_component//lib/view_component/slot.rb#115
def respond_to_missing?(symbol, include_all = T.unsafe(nil)); end
end
# source://view_component//lib/view_component/errors.rb#110
class ViewComponent::SlotPredicateNameError < ::ViewComponent::InvalidSlotNameError
# @return [SlotPredicateNameError] a new instance of SlotPredicateNameError
#
# source://view_component//lib/view_component/errors.rb#117
def initialize(klass_name, slot_name); end
end
# source://view_component//lib/view_component/errors.rb#111
ViewComponent::SlotPredicateNameError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/slotable.rb#8
module ViewComponent::Slotable
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
mixes_in_class_methods GeneratedClassMethods
mixes_in_class_methods ::ViewComponent::Slotable::ClassMethods
# source://view_component//lib/view_component/slotable.rb#344
def get_slot(slot_name); end
# source://view_component//lib/view_component/slotable.rb#417
def set_polymorphic_slot(slot_name, poly_type = T.unsafe(nil), *args, **_arg3, &block); end
# source://view_component//lib/view_component/slotable.rb#359
def set_slot(slot_name, slot_definition = T.unsafe(nil), *args, **_arg3, &block); end
module GeneratedClassMethods
def registered_slots; end
def registered_slots=(value); end
def registered_slots?; end
end
module GeneratedInstanceMethods
def registered_slots; end
def registered_slots=(value); end
def registered_slots?; end
end
end
# source://view_component//lib/view_component/slotable.rb#0
module ViewComponent::Slotable::ClassMethods
# source://view_component//lib/view_component/slotable.rb#204
def inherited(child); end
# source://view_component//lib/view_component/slotable.rb#209
def register_polymorphic_slot(slot_name, types, collection:); end
# source://view_component//lib/view_component/slotable.rb#147
def renders_many(slot_name, callable = T.unsafe(nil)); end
# source://view_component//lib/view_component/slotable.rb#77
def renders_one(slot_name, callable = T.unsafe(nil)); end
# source://view_component//lib/view_component/slotable.rb#191
def slot_type(slot_name); end
private
# source://view_component//lib/view_component/slotable.rb#268
def define_slot(slot_name, collection:, callable:); end
# source://view_component//lib/view_component/slotable.rb#330
def raise_if_slot_conflicts_with_call(slot_name); end
# source://view_component//lib/view_component/slotable.rb#326
def raise_if_slot_ends_with_question_mark(slot_name); end
# source://view_component//lib/view_component/slotable.rb#336
def raise_if_slot_name_uncountable(slot_name); end
# source://view_component//lib/view_component/slotable.rb#319
def raise_if_slot_registered(slot_name); end
# source://view_component//lib/view_component/slotable.rb#264
def register_slot(slot_name, **kwargs); end
# source://view_component//lib/view_component/slotable.rb#294
def validate_plural_slot_name(slot_name); end
# source://view_component//lib/view_component/slotable.rb#305
def validate_singular_slot_name(slot_name); end
end
# source://view_component//lib/view_component/slotable.rb#11
ViewComponent::Slotable::RESERVED_NAMES = T.let(T.unsafe(nil), Hash)
# source://view_component//lib/view_component/system_test_case.rb#6
class ViewComponent::SystemTestCase < ::ActionDispatch::SystemTestCase
include ::ViewComponent::TestHelpers
include ::ViewComponent::SystemTestHelpers
# source://view_component//lib/view_component/system_test_case.rb#9
def page; end
end
# source://view_component//lib/view_component/errors.rb#225
class ViewComponent::SystemTestControllerNefariousPathError < ::ViewComponent::BaseError; end
# source://view_component//lib/view_component/errors.rb#226
ViewComponent::SystemTestControllerNefariousPathError::MESSAGE = T.let(T.unsafe(nil), String)
# :nocov:
#
# source://view_component//lib/view_component/errors.rb#221
class ViewComponent::SystemTestControllerOnlyAllowedInTestError < ::ViewComponent::BaseError; end
# source://view_component//lib/view_component/errors.rb#222
ViewComponent::SystemTestControllerOnlyAllowedInTestError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/system_test_helpers.rb#4
module ViewComponent::SystemTestHelpers
include ::Capybara::Minitest::Assertions
include ::ViewComponent::TestHelpers
# Returns a block that can be used to visit the path of the inline rendered component.
#
# @param fragment [Nokogiri::Fragment] The fragment returned from `render_inline`.
# @param layout [String] The (optional) layout to use.
# @return [Proc] A block that can be used to visit the path of the inline rendered component.
#
# source://view_component//lib/view_component/system_test_helpers.rb#12
def with_rendered_component_path(fragment, layout: T.unsafe(nil), &block); end
end
# source://view_component//lib/view_component/errors.rb#19
class ViewComponent::TemplateError < ::StandardError
# @return [TemplateError] a new instance of TemplateError
#
# source://view_component//lib/view_component/errors.rb#20
def initialize(errors); end
end
# source://view_component//lib/view_component/test_case.rb#6
class ViewComponent::TestCase < ::ActiveSupport::TestCase
include ::Capybara::Minitest::Assertions
include ::ViewComponent::TestHelpers
end
# source://view_component//lib/view_component/test_helpers.rb#4
module ViewComponent::TestHelpers
include ::Capybara::Minitest::Assertions
# source://view_component//lib/view_component/test_helpers.rb#10
def page; end
# source://view_component//lib/view_component/test_helpers.rb#14
def refute_component_rendered; end
# Execute the given block in the view context (using `instance_exec`).
# Internally sets `page` to be a `Capybara::Node::Simple`, allowing for
# Capybara assertions to be used. All arguments are forwarded to the block.
#
# ```ruby
# render_in_view_context(arg1, arg2: nil) do |arg1, arg2:|
# render(MyComponent.new(arg1, arg2))
# end
#
# assert_text("Hello, World!")
# ```
#
# source://view_component//lib/view_component/test_helpers.rb#110
def render_in_view_context(*args, **_arg1, &block); end
# Render a component inline. Internally sets `page` to be a `Capybara::Node::Simple`,
# allowing for Capybara assertions to be used:
#
# ```ruby
# render_inline(MyComponent.new)
# assert_text("Hello, World!")
# ```
#
# @param component [ViewComponent::Base, ViewComponent::Collection] The instance of the component to be rendered.
# @return [Nokogiri::HTML]
#
# source://view_component//lib/view_component/test_helpers.rb#46
def render_inline(component, **args, &block); end
# Render a preview inline. Internally sets `page` to be a `Capybara::Node::Simple`,
# allowing for Capybara assertions to be used:
#
# ```ruby
# render_preview(:default)
# assert_text("Hello, World!")
# ```
#
# Note: `#rendered_preview` expects a preview to be defined with the same class
# name as the calling test, but with `Test` replaced with `Preview`:
#
# MyComponentTest -> MyComponentPreview etc.
#
# In RSpec, `Preview` is appended to `described_class`.
#
# @param name [String] The name of the preview to be rendered.
# @param from [ViewComponent::Preview] The class of the preview to be rendered.
# @param params [Hash] Parameters to be passed to the preview.
# @return [Nokogiri::HTML]
#
# source://view_component//lib/view_component/test_helpers.rb#81
def render_preview(name, from: T.unsafe(nil), params: T.unsafe(nil)); end
# Returns the result of a render_inline call.
#
# @return [ActionView::OutputBuffer]
#
# source://view_component//lib/view_component/test_helpers.rb#34
def rendered_content; end
# Access the controller used by `render_inline`:
#
# ```ruby
# test "logged out user sees login link" do
# vc_test_controller.expects(:logged_in?).at_least_once.returns(false)
# render_inline(LoginComponent.new)
# assert_selector("[aria-label='You must be signed in']")
# end
# ```
#
# @return [ActionController::Base]
#
# source://view_component//lib/view_component/test_helpers.rb#225
def vc_test_controller; end
# Access the request used by `render_inline`:
#
# ```ruby
# test "component does not render in Firefox" do
# request.env["HTTP_USER_AGENT"] = "Mozilla/5.0"
# render_inline(NoFirefoxComponent.new)
# refute_component_rendered
# end
# ```
#
# @return [ActionDispatch::TestRequest]
#
# source://view_component//lib/view_component/test_helpers.rb#240
def vc_test_request; end
# Set the controller to be used while executing the given block,
# allowing access to controller-specific methods:
#
# ```ruby
# with_controller_class(UsersController) do
# render_inline(MyComponent.new)
# end
# ```
#
# @param klass [ActionController::Base] The controller to be used.
#
# source://view_component//lib/view_component/test_helpers.rb#145
def with_controller_class(klass); end
# Set the URL of the current request (such as when using request-dependent path helpers):
#
# ```ruby
# with_request_url("/users/42") do
# render_inline(MyComponent.new)
# end
# ```
#
# To use a specific host, pass the host param:
#
# ```ruby
# with_request_url("/users/42", host: "app.example.com") do
# render_inline(MyComponent.new)
# end
# ```
#
# To specify a request method, pass the method param:
#
# ```ruby
# with_request_url("/users/42", method: "POST") do
# render_inline(MyComponent.new)
# end
# ```
#
# @param full_path [String] The path to set for the current request.
# @param host [String] The host to set for the current request.
# @param method [String] The request method to set for the current request.
#
# source://view_component//lib/view_component/test_helpers.rb#181
def with_request_url(full_path, host: T.unsafe(nil), method: T.unsafe(nil), format: T.unsafe(nil)); end
# Set the Action Pack request variant for the given block:
#
# ```ruby
# with_variant(:phone) do
# render_inline(MyComponent.new)
# end
# ```
#
# @param variant [Symbol] The variant to be set for the provided block.
#
# source://view_component//lib/view_component/test_helpers.rb#126
def with_variant(variant); end
private
# source://view_component//lib/view_component/test_helpers.rb#254
def __vc_test_helpers_build_controller(klass); end
# source://view_component//lib/view_component/test_helpers.rb#258
def __vc_test_helpers_preview_class; end
end
# source://view_component//lib/view_component/translatable.rb#9
module ViewComponent::Translatable
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
mixes_in_class_methods GeneratedClassMethods
mixes_in_class_methods ::ViewComponent::Translatable::ClassMethods
# Exposes .i18n_scope as an instance method
#
# source://view_component//lib/view_component/translatable.rb#123
def i18n_scope; end
# @raise [ViewComponent::TranslateCalledBeforeRenderError]
#
# source://view_component//lib/view_component/translatable.rb#91
def t(key = T.unsafe(nil), **options); end
# @raise [ViewComponent::TranslateCalledBeforeRenderError]
#
# source://view_component//lib/view_component/translatable.rb#91
def translate(key = T.unsafe(nil), **options); end
private
# source://view_component//lib/view_component/translatable.rb#140
def html_escape_translation_options!(options); end
# source://view_component//lib/view_component/translatable.rb#129
def html_safe_translation(translation); end
module GeneratedClassMethods
def i18n_backend; end
def i18n_backend=(value); end
end
module GeneratedInstanceMethods
def i18n_backend; end
end
end
# source://view_component//lib/view_component/translatable.rb#0
module ViewComponent::Translatable::ClassMethods
# source://view_component//lib/view_component/translatable.rb#24
def build_i18n_backend; end
# source://view_component//lib/view_component/translatable.rb#44
def i18n_key(key, scope = T.unsafe(nil)); end
# source://view_component//lib/view_component/translatable.rb#20
def i18n_scope; end
# source://view_component//lib/view_component/translatable.rb#52
def t(key = T.unsafe(nil), **options); end
# source://view_component//lib/view_component/translatable.rb#52
def translate(key = T.unsafe(nil), **options); end
end
# source://view_component//lib/view_component/translatable.rb#12
ViewComponent::Translatable::HTML_SAFE_TRANSLATION_KEY = T.let(T.unsafe(nil), Regexp)
# source://view_component//lib/view_component/translatable.rb#66
class ViewComponent::Translatable::I18nBackend < ::I18n::Backend::Simple
# @return [I18nBackend] a new instance of I18nBackend
#
# source://view_component//lib/view_component/translatable.rb#69
def initialize(i18n_scope:, load_paths:); end
# Ensure the Simple backend won't load paths from ::I18n.load_path
#
# source://view_component//lib/view_component/translatable.rb#75
def load_translations; end
# source://view_component//lib/view_component/translatable.rb#79
def scope_data(data); end
# source://view_component//lib/view_component/translatable.rb#86
def store_translations(locale, data, options = T.unsafe(nil)); end
end
# source://view_component//lib/view_component/translatable.rb#67
ViewComponent::Translatable::I18nBackend::EMPTY_HASH = T.let(T.unsafe(nil), Hash)
# source://view_component//lib/view_component/translatable.rb#13
ViewComponent::Translatable::TRANSLATION_EXTENSIONS = T.let(T.unsafe(nil), Array)
# source://view_component//lib/view_component/errors.rb#176
class ViewComponent::TranslateCalledBeforeRenderError < ::ViewComponent::BaseError; end
# source://view_component//lib/view_component/errors.rb#177
ViewComponent::TranslateCalledBeforeRenderError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/errors.rb#152
class ViewComponent::UncountableSlotNameError < ::ViewComponent::InvalidSlotNameError
# @return [UncountableSlotNameError] a new instance of UncountableSlotNameError
#
# source://view_component//lib/view_component/errors.rb#157
def initialize(klass_name, slot_name); end
end
# source://view_component//lib/view_component/errors.rb#153
ViewComponent::UncountableSlotNameError::MESSAGE = T.let(T.unsafe(nil), String)
# source://view_component//lib/view_component/use_helpers.rb#3
module ViewComponent::UseHelpers
extend ::ActiveSupport::Concern
mixes_in_class_methods ::ViewComponent::UseHelpers::ClassMethods
end
# source://view_component//lib/view_component/use_helpers.rb#0
module ViewComponent::UseHelpers::ClassMethods
# source://view_component//lib/view_component/use_helpers.rb#11
def use_helper(helper_method, from: T.unsafe(nil)); end
# source://view_component//lib/view_component/use_helpers.rb#7
def use_helpers(*args, from: T.unsafe(nil)); end
private
# source://view_component//lib/view_component/use_helpers.rb#24
def define_helper(helper_method:, source:); end
end
# source://view_component//lib/view_component/with_content_helper.rb#4
module ViewComponent::WithContentHelper
# @raise [NilWithContentError]
#
# source://view_component//lib/view_component/with_content_helper.rb#5
def with_content(value); end
end
class ViewComponentsController < ::Rails::ApplicationController
include ::ViewComponent::PreviewActions
private
# source://actionview/7.1.3.4/lib/action_view/layouts.rb#330
def _layout(lookup_context, formats); end
class << self
# source://activesupport/7.1.3.4/lib/active_support/callbacks.rb#70
def __callbacks; end
# source://actionpack/7.1.3.4/lib/action_controller/metal.rb#262
def middleware_stack; end
end
end
class ViewComponentsSystemTestController < ::ActionController::Base
def system_test_entrypoint; end
private
# source://actionview/7.1.3.4/lib/action_view/layouts.rb#330
def _layout(lookup_context, formats); end
def validate_file_path; end
def validate_test_env; end
class << self
# source://activesupport/7.1.3.4/lib/active_support/callbacks.rb#70
def __callbacks; end
# source://actionpack/7.1.3.4/lib/action_controller/metal.rb#262
def middleware_stack; end
def temp_dir; end
end
end