proscenium 0.19.0.beta10-aarch64-linux → 0.19.0.beta11-aarch64-linux
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/lib/proscenium/bundled_gems.rb +1 -1
- data/lib/proscenium/css_module.rb +0 -5
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/middleware.rb +0 -6
- data/lib/proscenium/phlex.rb +0 -6
- data/lib/proscenium/railtie.rb +0 -25
- data/lib/proscenium/resolver.rb +0 -9
- data/lib/proscenium/version.rb +1 -1
- data/lib/proscenium/view_component.rb +0 -6
- data/lib/proscenium.rb +5 -34
- metadata +24 -132
- data/lib/proscenium/registry/bundled_package.rb +0 -29
- data/lib/proscenium/registry/package.rb +0 -95
- data/lib/proscenium/registry/ruby_gem_package.rb +0 -30
- data/lib/proscenium/registry.rb +0 -29
- data/lib/proscenium/ruby_gems.rb +0 -67
- data/lib/proscenium/ui/breadcrumbs/component.module.css +0 -14
- data/lib/proscenium/ui/breadcrumbs/component.rb +0 -71
- data/lib/proscenium/ui/breadcrumbs/computed_element.rb +0 -69
- data/lib/proscenium/ui/breadcrumbs/control.rb +0 -95
- data/lib/proscenium/ui/breadcrumbs/mixins.css +0 -83
- data/lib/proscenium/ui/breadcrumbs.rb +0 -72
- data/lib/proscenium/ui/component.rb +0 -7
- data/lib/proscenium/ui/custom_element.js +0 -54
- data/lib/proscenium/ui/flash/bun.lock +0 -19
- data/lib/proscenium/ui/flash/index.css +0 -1
- data/lib/proscenium/ui/flash/index.js +0 -77
- data/lib/proscenium/ui/flash/node_modules/dom-mutations/index.d.ts +0 -33
- data/lib/proscenium/ui/flash/node_modules/dom-mutations/index.js +0 -44
- data/lib/proscenium/ui/flash/node_modules/dom-mutations/license +0 -9
- data/lib/proscenium/ui/flash/node_modules/dom-mutations/package.json +0 -59
- data/lib/proscenium/ui/flash/node_modules/dom-mutations/readme.md +0 -125
- data/lib/proscenium/ui/flash/node_modules/sourdough-toast/LICENSE +0 -20
- data/lib/proscenium/ui/flash/node_modules/sourdough-toast/README.md +0 -11
- data/lib/proscenium/ui/flash/node_modules/sourdough-toast/package.json +0 -44
- data/lib/proscenium/ui/flash/node_modules/sourdough-toast/src/sourdough-toast.css +0 -697
- data/lib/proscenium/ui/flash/node_modules/sourdough-toast/src/sourdough-toast.js +0 -537
- data/lib/proscenium/ui/flash/package.json +0 -11
- data/lib/proscenium/ui/flash.rb +0 -15
- data/lib/proscenium/ui/form/field_methods.rb +0 -88
- data/lib/proscenium/ui/form/fields/base.rb +0 -188
- data/lib/proscenium/ui/form/fields/checkbox/index.jsx +0 -48
- data/lib/proscenium/ui/form/fields/checkbox/index.module.css +0 -9
- data/lib/proscenium/ui/form/fields/checkbox/previews/basic.jsx +0 -8
- data/lib/proscenium/ui/form/fields/checkbox.rb +0 -32
- data/lib/proscenium/ui/form/fields/date.module.css +0 -27
- data/lib/proscenium/ui/form/fields/datetime.rb +0 -15
- data/lib/proscenium/ui/form/fields/hidden.rb +0 -9
- data/lib/proscenium/ui/form/fields/input/index.jsx +0 -71
- data/lib/proscenium/ui/form/fields/input/index.module.css +0 -13
- data/lib/proscenium/ui/form/fields/input/previews/basic.jsx +0 -8
- data/lib/proscenium/ui/form/fields/input.rb +0 -14
- data/lib/proscenium/ui/form/fields/radio_group.rb +0 -173
- data/lib/proscenium/ui/form/fields/radio_input/index.jsx +0 -44
- data/lib/proscenium/ui/form/fields/radio_input/index.module.css +0 -13
- data/lib/proscenium/ui/form/fields/radio_input/previews/basic.jsx +0 -8
- data/lib/proscenium/ui/form/fields/radio_input.rb +0 -17
- data/lib/proscenium/ui/form/fields/rich_textarea.css +0 -23
- data/lib/proscenium/ui/form/fields/rich_textarea.js +0 -6
- data/lib/proscenium/ui/form/fields/rich_textarea.rb +0 -18
- data/lib/proscenium/ui/form/fields/select.jsx +0 -47
- data/lib/proscenium/ui/form/fields/select.module.css +0 -46
- data/lib/proscenium/ui/form/fields/select.rb +0 -300
- data/lib/proscenium/ui/form/fields/tel.css +0 -297
- data/lib/proscenium/ui/form/fields/tel.js +0 -83
- data/lib/proscenium/ui/form/fields/tel.rb +0 -54
- data/lib/proscenium/ui/form/fields/textarea/index.jsx +0 -50
- data/lib/proscenium/ui/form/fields/textarea/index.module.css +0 -13
- data/lib/proscenium/ui/form/fields/textarea/previews/basic.jsx +0 -8
- data/lib/proscenium/ui/form/fields/textarea.rb +0 -18
- data/lib/proscenium/ui/form/translation.rb +0 -71
- data/lib/proscenium/ui/form.css +0 -52
- data/lib/proscenium/ui/form.rb +0 -211
- data/lib/proscenium/ui/props.css +0 -7
- data/lib/proscenium/ui/stimulus-loading.js +0 -65
- data/lib/proscenium/ui/test.js +0 -1
- data/lib/proscenium/ui/ujs/class.js +0 -15
- data/lib/proscenium/ui/ujs/data_confirm.js +0 -23
- data/lib/proscenium/ui/ujs/data_disable_with.js +0 -68
- data/lib/proscenium/ui/ujs/index.js +0 -9
- data/lib/proscenium/ui.rb +0 -11
- /data/lib/proscenium/{ui/react-manager → react-manager}/index.jsx +0 -0
- /data/lib/proscenium/{ui/react-manager → react-manager}/react.js +0 -0
data/lib/proscenium/ruby_gems.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubygems/package'
|
4
|
-
require 'rubygems/remote_fetcher'
|
5
|
-
|
6
|
-
module Proscenium
|
7
|
-
class RubyGems
|
8
|
-
def self.path_for(name, version = nil)
|
9
|
-
Pathname new(name, version).path
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize(name, version = nil)
|
13
|
-
@name = name
|
14
|
-
@version = version
|
15
|
-
end
|
16
|
-
|
17
|
-
def path
|
18
|
-
dependency = Gem::Dependency.new @name, @version
|
19
|
-
path = gem_path dependency
|
20
|
-
|
21
|
-
raise "Gem '#{@name}' not installed nor fetchable." unless path
|
22
|
-
|
23
|
-
basename = File.basename path, '.gem'
|
24
|
-
target_dir = File.expand_path basename, Rails.root.join('tmp', 'unpacked_gems')
|
25
|
-
|
26
|
-
Gem::Package.new(path).extract_files target_dir
|
27
|
-
|
28
|
-
target_dir
|
29
|
-
end
|
30
|
-
|
31
|
-
# Find cached filename in Gem.path. Returns nil if the file cannot be found.
|
32
|
-
def find_in_cache(filename)
|
33
|
-
Gem.path.each do |path|
|
34
|
-
this_path = File.join(path, 'cache', filename)
|
35
|
-
return this_path if File.exist? this_path
|
36
|
-
end
|
37
|
-
|
38
|
-
nil
|
39
|
-
end
|
40
|
-
|
41
|
-
# Return the full path to the cached gem file matching the given
|
42
|
-
# name and version requirement. Returns 'nil' if no match.
|
43
|
-
#
|
44
|
-
# Example:
|
45
|
-
#
|
46
|
-
# get_path 'rake', '> 0.4' # "/usr/lib/ruby/gems/1.8/cache/rake-0.4.2.gem"
|
47
|
-
# get_path 'rake', '< 0.1' # nil
|
48
|
-
# get_path 'rak' # nil (exact name required)
|
49
|
-
def gem_path(dependency)
|
50
|
-
return dependency.name if /\.gem$/i.match?(dependency.name)
|
51
|
-
|
52
|
-
specs = dependency.matching_specs
|
53
|
-
selected = specs.max_by(&:version)
|
54
|
-
|
55
|
-
return Gem::RemoteFetcher.fetcher.download_to_cache(dependency) unless selected
|
56
|
-
return unless /^#{selected.name}$/i.match?(dependency.name)
|
57
|
-
|
58
|
-
# We expect to find (basename).gem in the 'cache' directory. Furthermore,
|
59
|
-
# the name match must be exact (ignoring case).
|
60
|
-
path = find_in_cache File.basename selected.cache_file
|
61
|
-
|
62
|
-
return Gem::RemoteFetcher.fetcher.download_to_cache(dependency) unless path
|
63
|
-
|
64
|
-
path
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
@layer proscenium-ui-component {
|
2
|
-
/*
|
3
|
-
* Properties:
|
4
|
-
*
|
5
|
-
* --puiBreadcrumbs--link-color: LinkText;
|
6
|
-
* --puiBreadcrumbs--link-hover-color: HighlightText;
|
7
|
-
* --puiBreadcrumbs--separator-color: GrayText;
|
8
|
-
* --puiBreadcrumbs--separator: url("/proscenium/icons/angle-right-regular.svg");
|
9
|
-
*/
|
10
|
-
|
11
|
-
.base {
|
12
|
-
@mixin breadcrumbs from url("./mixins.css");
|
13
|
-
}
|
14
|
-
}
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Proscenium::UI
|
4
|
-
class Breadcrumbs::Component < Component
|
5
|
-
extend Literal::Properties
|
6
|
-
include Phlex::Rails::Helpers::URLFor
|
7
|
-
|
8
|
-
# The path (route) to use as the HREF for the home segment. Defaults to `:root`.
|
9
|
-
prop :home_path, _Union(String, Symbol), default: -> { :root }
|
10
|
-
|
11
|
-
# Assign false to hide the home segment.
|
12
|
-
prop :with_home, _Boolean, default: -> { true }
|
13
|
-
|
14
|
-
def view_template
|
15
|
-
div class: :@base do
|
16
|
-
ol do
|
17
|
-
if @with_home
|
18
|
-
li do
|
19
|
-
home_template
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
breadcrumbs.each do |ce|
|
24
|
-
li do
|
25
|
-
path = ce.path
|
26
|
-
path.nil? ? ce.name : a(href: url_for(path)) { ce.name }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
# Override this to customise the home breadcrumb. You can call super with a block to use the
|
36
|
-
# default template, but with custom content.
|
37
|
-
#
|
38
|
-
# @example
|
39
|
-
# def home_template
|
40
|
-
# super { 'hello' }
|
41
|
-
# end
|
42
|
-
def home_template(&block)
|
43
|
-
a(href: url_for(@home_path)) do
|
44
|
-
if block
|
45
|
-
yield
|
46
|
-
else
|
47
|
-
svg role: 'img', xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 576 512' do |s|
|
48
|
-
s.path fill: 'currentColor',
|
49
|
-
d: 'M488 312.7V456c0 13.3-10.7 24-24 24H348c-6.6 0-12-5.4-12-12V356c0-6.6-5.4-' \
|
50
|
-
'12-12-12h-72c-6.6 0-12 5.4-12 12v112c0 6.6-5.4 12-12 12H112c-13.3 0-24-10.' \
|
51
|
-
'7-24-24V312.7c0-3.6 1.6-7 4.4-9.3l188-154.8c4.4-3.6 10.8-3.6 15.3 0l188 15' \
|
52
|
-
'4.8c2.7 2.3 4.3 5.7 4.3 9.3zm83.6-60.9L488 182.9V44.4c0-6.6-5.4-12-12-12h-' \
|
53
|
-
'56c-6.6 0-12 5.4-12 12V117l-89.5-73.7c-17.7-14.6-43.3-14.6-61 0L4.4 251.8c' \
|
54
|
-
'-5.1 4.2-5.8 11.8-1.6 16.9l25.5 31c4.2 5.1 11.8 5.8 16.9 1.6l235.2-193.7c4' \
|
55
|
-
'.4-3.6 10.8-3.6 15.3 0l235.2 193.7c5.1 4.2 12.7 3.5 16.9-1.6l25.5-31c4.2-5' \
|
56
|
-
'.2 3.4-12.7-1.7-16.9z'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# Don't render if @hide_breadcrumbs is true.
|
63
|
-
def render?
|
64
|
-
helpers.assigns['hide_breadcrumbs'] != true
|
65
|
-
end
|
66
|
-
|
67
|
-
def breadcrumbs
|
68
|
-
helpers.controller.breadcrumbs.map { |e| Breadcrumbs::ComputedElement.new e, helpers }
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Proscenium::UI::Breadcrumbs
|
4
|
-
class ComputedElement
|
5
|
-
def initialize(element, context)
|
6
|
-
@element = element
|
7
|
-
@context = context
|
8
|
-
end
|
9
|
-
|
10
|
-
# If name is a Symbol of a controller method, that method is called.
|
11
|
-
# If name is a Symbol of a controller instance variable, that variable is returned.
|
12
|
-
# If name is a Proc, it is executed in the context of the controller instance.
|
13
|
-
#
|
14
|
-
# @return [String] the content of the breadcrumb element.
|
15
|
-
def name
|
16
|
-
@name ||= case name = @element.name
|
17
|
-
when Symbol
|
18
|
-
if name.to_s.starts_with?('@')
|
19
|
-
name = get_instance_variable(name)
|
20
|
-
name.respond_to?(:for_breadcrumb) ? name.for_breadcrumb : name.to_s
|
21
|
-
else
|
22
|
-
res = @context.controller.send(name)
|
23
|
-
res.try(:for_breadcrumb) || res.to_s
|
24
|
-
end
|
25
|
-
when Proc
|
26
|
-
@context.controller.instance_exec(&name)
|
27
|
-
else
|
28
|
-
name.respond_to?(:for_breadcrumb) ? name.for_breadcrumb : name.to_s
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# If path is a Symbol of a controller method, that method is called.
|
33
|
-
# If path is a Symbol of a controller instance variable, that variable is returned.
|
34
|
-
# If path is an Array, each element is processed as above.
|
35
|
-
# If path is a Proc, it is executed in the context of the controller instance.
|
36
|
-
#
|
37
|
-
# No matter what, the result is always passed to `url_for` before being returned.
|
38
|
-
#
|
39
|
-
# @return [String] the URL for the element
|
40
|
-
def path
|
41
|
-
@path ||= unless @element.path.nil?
|
42
|
-
case path = @element.path
|
43
|
-
when Array
|
44
|
-
path.map! { |x| x.to_s.starts_with?('@') ? get_instance_variable(x) : x }
|
45
|
-
when Symbol
|
46
|
-
if path.to_s.starts_with?('@')
|
47
|
-
path = get_instance_variable(path)
|
48
|
-
elsif @context.controller.respond_to?(path, true)
|
49
|
-
path = @context.controller.send(path)
|
50
|
-
end
|
51
|
-
when Proc
|
52
|
-
path = @context.controller.instance_exec(&path)
|
53
|
-
end
|
54
|
-
|
55
|
-
@context.url_for path
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
def get_instance_variable(element)
|
62
|
-
unless @context.instance_variable_defined?(element)
|
63
|
-
raise NameError, "undefined instance variable `#{element}' for breadcrumb", caller
|
64
|
-
end
|
65
|
-
|
66
|
-
@context.instance_variable_get element
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Proscenium::UI::Breadcrumbs
|
4
|
-
# Include this module in your controller to add support for adding breadcrumb elements. You can
|
5
|
-
# then use the `add_breadcrumb` and `prepend_breadcrumb` class methods to append and/or prepend
|
6
|
-
# breadcrumb elements.
|
7
|
-
module Control
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
include ActionView::Helpers::SanitizeHelper
|
10
|
-
|
11
|
-
included do
|
12
|
-
helper_method :breadcrumbs_as_json, :breadcrumbs_for_title if respond_to?(:helper_method)
|
13
|
-
end
|
14
|
-
|
15
|
-
module ClassMethods
|
16
|
-
# Appends a new breadcrumb element into the collection.
|
17
|
-
#
|
18
|
-
# @param name [String, Symbol, Proc, #for_breadcrumb] The name or content of the breadcrumb.
|
19
|
-
# @param path [String, Symbol, Array, Proc, nil] The path (route) to use as the HREF for the
|
20
|
-
# breadcrumb.
|
21
|
-
# @param filter_options [Hash] Options to pass through to the before_action filter.
|
22
|
-
def add_breadcrumb(name, path = nil, **filter_options)
|
23
|
-
element_options = filter_options.delete(:options) || {}
|
24
|
-
|
25
|
-
before_action(filter_options) do |controller|
|
26
|
-
controller.send :add_breadcrumb, name, path, element_options
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# Prepend a new breadcrumb element into the collection.
|
31
|
-
#
|
32
|
-
# @param name [String, Symbol, Proc, #for_breadcrumb] The name or content of the breadcrumb.
|
33
|
-
# @param path [String, Symbol, Array, Proc, nil] The path (route) to use as the HREF for the
|
34
|
-
# breadcrumb.
|
35
|
-
# @param filter_options [Hash] Options to pass through to the before_action filter.
|
36
|
-
def prepend_breadcrumb(name, path = nil, **filter_options)
|
37
|
-
element_options = filter_options.delete(:options) || {}
|
38
|
-
|
39
|
-
before_action(filter_options) do |controller|
|
40
|
-
controller.send :prepend_breadcrumb, name, path, element_options
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# Pushes a new breadcrumb element into the collection.
|
46
|
-
#
|
47
|
-
# @param name [String, Symbol, Proc, #for_breadcrumb] The name or content of the breadcrumb.
|
48
|
-
# @param path [String, Symbol, Array, Proc, nil] The path (route) to use as the HREF for the
|
49
|
-
# breadcrumb.
|
50
|
-
# @param options [Hash]
|
51
|
-
def add_breadcrumb(name, path = nil, options = {})
|
52
|
-
breadcrumbs << Element.new(name, path, options)
|
53
|
-
end
|
54
|
-
|
55
|
-
# Prepend a new breadcrumb element into the collection.
|
56
|
-
#
|
57
|
-
# @param name [String, Symbol, Proc, #for_breadcrumb] The name or content of the breadcrumb.
|
58
|
-
# @param path [String, Symbol, Array, Proc, nil] The path (route) to use as the HREF for the
|
59
|
-
# breadcrumb.
|
60
|
-
# @param options [Hash]
|
61
|
-
def prepend_breadcrumb(name, path = nil, options = {})
|
62
|
-
breadcrumbs.prepend Element.new(name, path, options)
|
63
|
-
end
|
64
|
-
|
65
|
-
def breadcrumbs
|
66
|
-
@breadcrumbs ||= []
|
67
|
-
end
|
68
|
-
|
69
|
-
def breadcrumbs_as_json
|
70
|
-
computed_breadcrumbs.map do |ele|
|
71
|
-
path = ele.path
|
72
|
-
|
73
|
-
{ name: ele.name, path: ele.path.nil? || helpers.current_page?(path) ? nil : path }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# @param primary [Boolean] whether to return only the primary breadcrumb.
|
78
|
-
def breadcrumbs_for_title(primary: false)
|
79
|
-
names = computed_breadcrumbs.map(&:name)
|
80
|
-
return names.pop if primary
|
81
|
-
|
82
|
-
out = [names.pop]
|
83
|
-
out << names.join(': ') unless names.empty?
|
84
|
-
strip_tags out.join(' - ')
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
def computed_breadcrumbs
|
90
|
-
@computed_breadcrumbs ||= breadcrumbs.map do |ele|
|
91
|
-
ComputedElement.new ele, helpers
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
@define-mixin breadcrumbs {
|
2
|
-
/* Default properties */
|
3
|
-
--_puiBreadcrumbs--separator-color: GrayText;
|
4
|
-
--_puiBreadcrumbs--separator: url("/proscenium/icons/angle-right-regular.svg");
|
5
|
-
|
6
|
-
margin: 10px;
|
7
|
-
|
8
|
-
ol {
|
9
|
-
list-style: none;
|
10
|
-
padding: 0;
|
11
|
-
margin: 0;
|
12
|
-
display: flex;
|
13
|
-
align-items: baseline;
|
14
|
-
|
15
|
-
li {
|
16
|
-
text-transform: uppercase;
|
17
|
-
display: flex;
|
18
|
-
align-items: center;
|
19
|
-
|
20
|
-
@media (max-width: 426px) {
|
21
|
-
&:not(:nth-last-child(2)) {
|
22
|
-
display: none;
|
23
|
-
}
|
24
|
-
|
25
|
-
&:nth-last-child(2)::before {
|
26
|
-
@mixin _separator;
|
27
|
-
margin: 0 0.5rem 0 0;
|
28
|
-
transform: rotate(180deg);
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
@media (min-width: 427px) {
|
33
|
-
&:not(:last-child)::after {
|
34
|
-
@mixin _separator;
|
35
|
-
margin: 0 0.5rem;
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
&:last-child {
|
40
|
-
font-weight: 500;
|
41
|
-
text-transform: none;
|
42
|
-
}
|
43
|
-
|
44
|
-
&:last-child > a {
|
45
|
-
font-weight: 500;
|
46
|
-
text-transform: none;
|
47
|
-
}
|
48
|
-
|
49
|
-
a {
|
50
|
-
color: var(--puiBreadcrumbs--link-color, revert);
|
51
|
-
display: flex;
|
52
|
-
|
53
|
-
&:hover {
|
54
|
-
color: var(--puiBreadcrumbs--link-hover-color, revert);
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
svg {
|
59
|
-
height: 1em;
|
60
|
-
width: 1em;
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
@define-mixin _separator {
|
67
|
-
display: inline-block;
|
68
|
-
content: "";
|
69
|
-
height: 1rem;
|
70
|
-
width: 1rem;
|
71
|
-
-webkit-mask: var(
|
72
|
-
--puiBreadcrumbs--separator,
|
73
|
-
var(--_puiBreadcrumbs--separator)
|
74
|
-
)
|
75
|
-
no-repeat center center;
|
76
|
-
mask: var(--puiBreadcrumbs--separator, var(--_puiBreadcrumbs--separator))
|
77
|
-
no-repeat center center;
|
78
|
-
vertical-align: sub;
|
79
|
-
background-color: var(
|
80
|
-
--puiBreadcrumbs--separator-color,
|
81
|
-
var(--_puiBreadcrumbs--separator-color)
|
82
|
-
);
|
83
|
-
}
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Proscenium::UI
|
4
|
-
# Provides breadcrumb functionality for controllers and views. Breadcrumbs are a type of
|
5
|
-
# navigation that show the user where they are in the application's hierarchy.
|
6
|
-
# The `Proscenium::UI::Breadcrumbs::Control` module provides the `add_breadcrumb` and
|
7
|
-
# `prepend_breadcrumb` class methods for adding breadcrumb elements, and is intended to be
|
8
|
-
# included in your controllers.
|
9
|
-
#
|
10
|
-
# The `add_breadcrumb` method adds a new breadcrumb element to the end of the collection, while
|
11
|
-
# the `prepend_breadcrumb` method adds a new breadcrumb element to the beginning of the
|
12
|
-
# collection. Both methods take a name, and path as arguments. The name argument is the name or
|
13
|
-
# content of the breadcrumb, while the path argument is the path (route) to use as the HREF for
|
14
|
-
# the breadcrumb.
|
15
|
-
#
|
16
|
-
# class UsersController < ApplicationController
|
17
|
-
# include Proscenium::UI::Breadcrumbs::Control
|
18
|
-
# add_breadcrumb 'Users', :users_path
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
# Display the breadcrumbs in your views with the breadcrumbs component.
|
22
|
-
# @see `Proscenium::UI::Breadcrumbs::Component`.
|
23
|
-
#
|
24
|
-
# At it's simplest, you can add a breadcrumb with a name of "User", and a path of "/users" like
|
25
|
-
# this:
|
26
|
-
#
|
27
|
-
# add_breadcrumb 'Foo', '/foo'
|
28
|
-
#
|
29
|
-
# The value of the path is always passed to `url_for` before being rendered. It is also optional,
|
30
|
-
# and if omitted, the breadcrumb will be rendered as plain text.
|
31
|
-
#
|
32
|
-
# Both name and path can be given a Symbol, which can be used to call a method of the same name on
|
33
|
-
# the controller. If a Symbol is given as the path, and no method of the same name exists, then
|
34
|
-
# `url_for` will be called with the Symbol as the argument. Likewise, if an Array is given as the
|
35
|
-
# path, then `url_for` will be called with the Array as the argument.
|
36
|
-
#
|
37
|
-
# If a Symbol is given as the path or name, and it begins with `@` (eg. `:@foo`), then the
|
38
|
-
# instance variable of the same name will be called.
|
39
|
-
#
|
40
|
-
# add_breadcrumb :@foo, :@bar
|
41
|
-
#
|
42
|
-
# A Proc can also be given as the name and/or path. The Proc will be called within the context of
|
43
|
-
# the controller.
|
44
|
-
#
|
45
|
-
# add_breadcrumb -> { @foo }, -> { @bar }
|
46
|
-
#
|
47
|
-
# Passing an object that responds to `#for_breadcrumb` as the name will call that method on the
|
48
|
-
# object to get the breadcrumb name.
|
49
|
-
#
|
50
|
-
module Breadcrumbs
|
51
|
-
extend ActiveSupport::Autoload
|
52
|
-
|
53
|
-
autoload :Control
|
54
|
-
autoload :ComputedElement
|
55
|
-
autoload :Component
|
56
|
-
|
57
|
-
# Represents a navigation element in the breadcrumb collection.
|
58
|
-
class Element
|
59
|
-
attr_accessor :name, :path, :options
|
60
|
-
|
61
|
-
# @param name [String] the element/link name
|
62
|
-
# @param path [String] the element/link URL
|
63
|
-
# @param options [Hash] the element/link options
|
64
|
-
# @return [Element]
|
65
|
-
def initialize(name, path = nil, options = {})
|
66
|
-
self.name = name
|
67
|
-
self.path = path
|
68
|
-
self.options = options
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Base class for custom elements, providing support for event delegation, and idempotent
|
3
|
-
* customElement registration.
|
4
|
-
*
|
5
|
-
* The `handleEvent` method is called any time an event defined in `delegatedEvents` is triggered.
|
6
|
-
* It's a central handler to handle events for this custom element.
|
7
|
-
*
|
8
|
-
* @example
|
9
|
-
* class MyComponent extends CustomElement {
|
10
|
-
* static componentName = 'my-component'
|
11
|
-
* static delegatedEvents = ['click']
|
12
|
-
*
|
13
|
-
* handleEvent(event) {
|
14
|
-
* console.log('Hello, world!')
|
15
|
-
* }
|
16
|
-
* }
|
17
|
-
* MyComponent.register()
|
18
|
-
*/
|
19
|
-
export default class CustomElement extends HTMLElement {
|
20
|
-
/**
|
21
|
-
* Register the component as a custom element, inferring the component name from the kebab-cased
|
22
|
-
* class name. You can override the component name by setting a static `componentName` property.
|
23
|
-
*
|
24
|
-
* This method is idempotent.
|
25
|
-
*/
|
26
|
-
static register() {
|
27
|
-
if (this.componentName === undefined) {
|
28
|
-
this.componentName = this.name
|
29
|
-
.replaceAll(/(.)([A-Z])/g, "$1-$2")
|
30
|
-
.toLowerCase();
|
31
|
-
}
|
32
|
-
|
33
|
-
if (!customElements.get(this.componentName)) {
|
34
|
-
customElements.define(this.componentName, this);
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
/**
|
39
|
-
* A list of event types to be delegated for the lifetime of the custom element.
|
40
|
-
*
|
41
|
-
* @type {Array}
|
42
|
-
*/
|
43
|
-
static delegatedEvents = [];
|
44
|
-
|
45
|
-
constructor() {
|
46
|
-
super();
|
47
|
-
|
48
|
-
if (typeof this.handleEvent !== "undefined") {
|
49
|
-
this.constructor.delegatedEvents?.forEach((event) => {
|
50
|
-
this.addEventListener(event, this);
|
51
|
-
});
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"lockfileVersion": 1,
|
3
|
-
"workspaces": {
|
4
|
-
"": {
|
5
|
-
"name": "@proscenium/flash",
|
6
|
-
"dependencies": {
|
7
|
-
"dom-mutations": "^1.0.0",
|
8
|
-
},
|
9
|
-
"devDependencies": {
|
10
|
-
"sourdough-toast": "latest",
|
11
|
-
},
|
12
|
-
},
|
13
|
-
},
|
14
|
-
"packages": {
|
15
|
-
"dom-mutations": ["dom-mutations@1.0.0", "", {}, "sha512-qr4ufk/qu+JKwtz7NPbu6TxpTM/7nqburohI07J+mKSM20USvhcUjEb8hWY6g2a3QYp3LtlGpi+mAZLPuxTi7g=="],
|
16
|
-
|
17
|
-
"sourdough-toast": ["sourdough-toast@0.1.0", "", {}, "sha512-ianhWqaaA5a0n9TRg6dLEt5DWflXqsQUMxEAGZi8JcHGqsPRm7XTWEfhhDKSi/zJ11CBbvh8b8oRcgxjCeYZeg=="],
|
18
|
-
}
|
19
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
@import "https://cdn.jsdelivr.net/npm/sourdough-toast/src/sourdough-toast.css";
|
@@ -1,77 +0,0 @@
|
|
1
|
-
import domMutations from "dom-mutations";
|
2
|
-
import { Sourdough, toast } from "sourdough-toast";
|
3
|
-
|
4
|
-
export function foo() {
|
5
|
-
console.log("foo");
|
6
|
-
}
|
7
|
-
|
8
|
-
class HueFlash extends HTMLElement {
|
9
|
-
static observedAttributes = ["data-flash-alert", "data-flash-notice"];
|
10
|
-
|
11
|
-
connectedCallback() {
|
12
|
-
this.#initSourdough();
|
13
|
-
}
|
14
|
-
|
15
|
-
async #initSourdough() {
|
16
|
-
if ("sourdoughBooted" in window) return;
|
17
|
-
|
18
|
-
const sourdough = new Sourdough({
|
19
|
-
richColors: true,
|
20
|
-
yPosition: "bottom",
|
21
|
-
xPosition: "center",
|
22
|
-
});
|
23
|
-
sourdough.boot();
|
24
|
-
window.sourdoughBooted = true;
|
25
|
-
|
26
|
-
// Watch for changes to htl:flashes meta tag
|
27
|
-
const flashesSelector = "meta[name='rails:flashes']";
|
28
|
-
for await (const mutation of domMutations(document.head, {
|
29
|
-
childList: true,
|
30
|
-
subtree: true,
|
31
|
-
attributes: true,
|
32
|
-
})) {
|
33
|
-
let $ele = null;
|
34
|
-
|
35
|
-
if (
|
36
|
-
mutation.type === "attributes" &&
|
37
|
-
mutation.target.nodeName == "META" &&
|
38
|
-
mutation.attributeName == "content"
|
39
|
-
) {
|
40
|
-
$ele = mutation.target;
|
41
|
-
} else if (mutation.type === "childList") {
|
42
|
-
for (const node of mutation.addedNodes) {
|
43
|
-
if (node.matches(flashesSelector)) {
|
44
|
-
$ele = node;
|
45
|
-
break;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
if ($ele) {
|
51
|
-
const flashes = JSON.parse($ele.getAttribute("content"));
|
52
|
-
for (const [type, message] of Object.entries(flashes)) {
|
53
|
-
if (type === "alert") {
|
54
|
-
toast.error(message);
|
55
|
-
} else if (type === "notice") {
|
56
|
-
toast.success(message);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
attributeChangedCallback(name, _oldValue, newValue) {
|
64
|
-
this.#initSourdough();
|
65
|
-
|
66
|
-
if (newValue === null) return;
|
67
|
-
|
68
|
-
if (name === "data-flash-alert") {
|
69
|
-
toast.warning(newValue);
|
70
|
-
} else if (name === "data-flash-notice") {
|
71
|
-
toast.success(newValue);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
!customElements.get("pui-flash") &&
|
77
|
-
customElements.define("pui-flash", HueFlash);
|
@@ -1,33 +0,0 @@
|
|
1
|
-
export type Options = MutationObserverInit & {signal?: AbortSignal};
|
2
|
-
|
3
|
-
/**
|
4
|
-
@returns An async iterable that yields [`MutationRecord`](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord) objects representing individual mutations.
|
5
|
-
|
6
|
-
@example
|
7
|
-
```
|
8
|
-
import domMutations from 'dom-mutations';
|
9
|
-
|
10
|
-
const target = document.querySelector('#unicorn');
|
11
|
-
|
12
|
-
for await (const mutation of domMutations(target, {childList: true})) {
|
13
|
-
console.log('Mutation:', mutation);
|
14
|
-
}
|
15
|
-
```
|
16
|
-
*/
|
17
|
-
export default function domMutations(target: Node, options?: Options): AsyncIterable<MutationRecord>;
|
18
|
-
|
19
|
-
/**
|
20
|
-
Similar to `domMutations()`, but yields batches of [`MutationRecord`](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord) objects, each batch representing a group of mutations captured together. This method is less convenient, but can be useful in some cases when you need to handle mutations together as a group.
|
21
|
-
|
22
|
-
@example
|
23
|
-
```
|
24
|
-
import {batchedDomMutations} from 'dom-mutations';
|
25
|
-
|
26
|
-
const target = document.querySelector('#unicorn');
|
27
|
-
|
28
|
-
for await (const mutations of batchedDomMutations(target, {childList: true})) {
|
29
|
-
console.log('Batch of mutations:', mutations);
|
30
|
-
}
|
31
|
-
```
|
32
|
-
*/
|
33
|
-
export function batchedDomMutations(target: Node, options?: Options): AsyncIterable<MutationRecord[]>;
|