proscenium 0.19.0.beta15-arm64-darwin → 0.19.0.test1-arm64-darwin

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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -0
  3. data/lib/proscenium/bundled_gems.rb +1 -1
  4. data/lib/proscenium/css_module.rb +5 -0
  5. data/lib/proscenium/middleware.rb +6 -0
  6. data/lib/proscenium/monkey.rb +9 -2
  7. data/lib/proscenium/phlex.rb +6 -0
  8. data/lib/proscenium/railtie.rb +22 -2
  9. data/lib/proscenium/react_componentable.rb +1 -1
  10. data/lib/proscenium/registry/bundled_package.rb +29 -0
  11. data/lib/proscenium/registry/package.rb +95 -0
  12. data/lib/proscenium/registry/ruby_gem_package.rb +30 -0
  13. data/lib/proscenium/registry.rb +29 -0
  14. data/lib/proscenium/resolver.rb +9 -0
  15. data/lib/proscenium/ruby_gems.rb +67 -0
  16. data/lib/proscenium/ui/breadcrumbs/component.module.css +14 -0
  17. data/lib/proscenium/ui/breadcrumbs/component.rb +71 -0
  18. data/lib/proscenium/ui/breadcrumbs/computed_element.rb +69 -0
  19. data/lib/proscenium/ui/breadcrumbs/control.rb +95 -0
  20. data/lib/proscenium/ui/breadcrumbs/mixins.css +83 -0
  21. data/lib/proscenium/ui/breadcrumbs.rb +72 -0
  22. data/lib/proscenium/ui/component.rb +7 -0
  23. data/lib/proscenium/ui/custom_element.js +54 -0
  24. data/lib/proscenium/ui/flash/bun.lock +19 -0
  25. data/lib/proscenium/ui/flash/index.css +1 -0
  26. data/lib/proscenium/ui/flash/index.js +77 -0
  27. data/lib/proscenium/ui/flash/node_modules/dom-mutations/index.d.ts +33 -0
  28. data/lib/proscenium/ui/flash/node_modules/dom-mutations/index.js +44 -0
  29. data/lib/proscenium/ui/flash/node_modules/dom-mutations/license +9 -0
  30. data/lib/proscenium/ui/flash/node_modules/dom-mutations/package.json +59 -0
  31. data/lib/proscenium/ui/flash/node_modules/dom-mutations/readme.md +125 -0
  32. data/lib/proscenium/ui/flash/node_modules/sourdough-toast/LICENSE +20 -0
  33. data/lib/proscenium/ui/flash/node_modules/sourdough-toast/README.md +11 -0
  34. data/lib/proscenium/ui/flash/node_modules/sourdough-toast/package.json +44 -0
  35. data/lib/proscenium/ui/flash/node_modules/sourdough-toast/src/sourdough-toast.css +697 -0
  36. data/lib/proscenium/ui/flash/node_modules/sourdough-toast/src/sourdough-toast.js +537 -0
  37. data/lib/proscenium/ui/flash/package.json +11 -0
  38. data/lib/proscenium/ui/flash.rb +15 -0
  39. data/lib/proscenium/ui/form/field_methods.rb +88 -0
  40. data/lib/proscenium/ui/form/fields/base.rb +188 -0
  41. data/lib/proscenium/ui/form/fields/checkbox/index.jsx +48 -0
  42. data/lib/proscenium/ui/form/fields/checkbox/index.module.css +9 -0
  43. data/lib/proscenium/ui/form/fields/checkbox/previews/basic.jsx +8 -0
  44. data/lib/proscenium/ui/form/fields/checkbox.rb +32 -0
  45. data/lib/proscenium/ui/form/fields/date.module.css +27 -0
  46. data/lib/proscenium/ui/form/fields/datetime.rb +15 -0
  47. data/lib/proscenium/ui/form/fields/hidden.rb +9 -0
  48. data/lib/proscenium/ui/form/fields/input/index.jsx +71 -0
  49. data/lib/proscenium/ui/form/fields/input/index.module.css +13 -0
  50. data/lib/proscenium/ui/form/fields/input/previews/basic.jsx +8 -0
  51. data/lib/proscenium/ui/form/fields/input.rb +14 -0
  52. data/lib/proscenium/ui/form/fields/radio_group.rb +173 -0
  53. data/lib/proscenium/ui/form/fields/radio_input/index.jsx +44 -0
  54. data/lib/proscenium/ui/form/fields/radio_input/index.module.css +13 -0
  55. data/lib/proscenium/ui/form/fields/radio_input/previews/basic.jsx +8 -0
  56. data/lib/proscenium/ui/form/fields/radio_input.rb +17 -0
  57. data/lib/proscenium/ui/form/fields/rich_textarea.css +23 -0
  58. data/lib/proscenium/ui/form/fields/rich_textarea.js +6 -0
  59. data/lib/proscenium/ui/form/fields/rich_textarea.rb +18 -0
  60. data/lib/proscenium/ui/form/fields/select.jsx +47 -0
  61. data/lib/proscenium/ui/form/fields/select.module.css +46 -0
  62. data/lib/proscenium/ui/form/fields/select.rb +300 -0
  63. data/lib/proscenium/ui/form/fields/tel.css +297 -0
  64. data/lib/proscenium/ui/form/fields/tel.js +83 -0
  65. data/lib/proscenium/ui/form/fields/tel.rb +54 -0
  66. data/lib/proscenium/ui/form/fields/textarea/index.jsx +50 -0
  67. data/lib/proscenium/ui/form/fields/textarea/index.module.css +13 -0
  68. data/lib/proscenium/ui/form/fields/textarea/previews/basic.jsx +8 -0
  69. data/lib/proscenium/ui/form/fields/textarea.rb +18 -0
  70. data/lib/proscenium/ui/form/translation.rb +71 -0
  71. data/lib/proscenium/ui/form.css +52 -0
  72. data/lib/proscenium/ui/form.rb +211 -0
  73. data/lib/proscenium/ui/props.css +7 -0
  74. data/lib/proscenium/ui/stimulus-loading.js +65 -0
  75. data/lib/proscenium/ui/test.js +1 -0
  76. data/lib/proscenium/ui/ujs/class.js +15 -0
  77. data/lib/proscenium/ui/ujs/data_confirm.js +23 -0
  78. data/lib/proscenium/ui/ujs/data_disable_with.js +68 -0
  79. data/lib/proscenium/ui/ujs/index.js +9 -0
  80. data/lib/proscenium/ui.rb +11 -0
  81. data/lib/proscenium/version.rb +1 -1
  82. data/lib/proscenium/view_component/css_modules.rb +11 -0
  83. data/lib/proscenium/view_component/react_component.rb +22 -0
  84. data/lib/proscenium/view_component/sideload.rb +4 -0
  85. data/lib/proscenium/view_component.rb +36 -0
  86. data/lib/proscenium.rb +34 -6
  87. metadata +136 -24
  88. /data/lib/proscenium/{react-manager → ui/react-manager}/index.jsx +0 -0
  89. /data/lib/proscenium/{react-manager → ui/react-manager}/react.js +0 -0
@@ -0,0 +1,211 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Proscenium::UI
4
+ # Helpers to aid in building forms and associated inputs with built-in styling, and inspired by
5
+ # Rails form helpers and SimpleForm.
6
+ #
7
+ # Start by creating the form with `Proscenium::UI::Form`, which expects a model
8
+ # instance, and a block in which you define one or more fields. It automatically includes a hidden
9
+ # authenticity token field for you.
10
+ #
11
+ # Example:
12
+ #
13
+ # render Proscenium::UI::Form.new(User.new) do |f|
14
+ # f.text_field :name
15
+ # f.radio_group :role, %i[admin manager]
16
+ # f.submit 'Save'
17
+ # end
18
+ #
19
+ # The following fields (inputs) are available:
20
+ #
21
+ # - `url_field` - <input> with 'url' type.
22
+ # - `text_field` - <input> with 'text' type.
23
+ # - `textarea_field` - <textarea>.
24
+ # - `rich_textarea_field` - A rich <textarea> using ActionText and Trix.
25
+ # - `email_field` - <input> with 'email' type.
26
+ # - `number_field` - <input> with 'number' type.
27
+ # - `color_field` - <input> with 'color' type.
28
+ # - `hidden_field` - <input> with 'hidden' type.
29
+ # - `search_field` - <input> with 'search' type.
30
+ # - `password_field` - <input> with 'password' type.
31
+ # - `tel_field` - <input> with 'tel' type.
32
+ # - `range_field` - <input> with 'range' type.
33
+ # - `time_field` - <input> with 'time' type.
34
+ # - `date_field` - <input> with 'date' type.
35
+ # - `week_field` - <input> with 'week' type.
36
+ # - `month_field` - <input> with 'month' type.
37
+ # - `datetime_local_field` - <input> with 'datetime-local' type.
38
+ # - `checkbox_field` - <input> with 'checkbox' type.
39
+ # - `radio_field` - <input> with 'radio' type.
40
+ # - `radio_group` - group of <input>'s with 'radio' type.
41
+ # - `select_field` - <select> input.
42
+ #
43
+ class Form < Proscenium::UI::Component
44
+ extend ActiveSupport::Autoload
45
+ extend Literal::Properties
46
+
47
+ autoload :FieldMethods
48
+ autoload :Translation
49
+
50
+ module Fields
51
+ extend ActiveSupport::Autoload
52
+
53
+ autoload :Base
54
+ autoload :Input
55
+ autoload :Hidden
56
+ autoload :RadioInput
57
+ autoload :Checkbox
58
+ autoload :Textarea
59
+ autoload :RichTextarea
60
+ autoload :RadioGroup
61
+ autoload :Select
62
+ autoload :Tel
63
+ end
64
+
65
+ include FieldMethods
66
+ include Translation
67
+
68
+ STANDARD_METHOD_VERBS = %w[get post].freeze
69
+
70
+ def self.input_field(method_name, type:)
71
+ define_method method_name do |*args, **attributes|
72
+ merge_bang_attributes! args, attributes
73
+ render Fields::Input.new(args, @model, self, type:, **attributes)
74
+ end
75
+ end
76
+
77
+ prop :model, _Interface(:to_model), :positional, reader: :public
78
+
79
+ prop :method, _Union?(:get, :post, :put, :patch, :delete,
80
+ 'get', 'post', 'put', 'patch', 'delete') do |value|
81
+ value ||= 'patch' if @model.respond_to?(:persisted?) && @model.persisted?
82
+ value&.to_s&.downcase || 'post'
83
+ end
84
+
85
+ # The form action, which can be any value that can be passed to Rails `url_for` helper.
86
+ prop :action, _Union?(String, Symbol, Array, Hash)
87
+
88
+ prop :attributes, Hash, :**
89
+
90
+ # Use the given `field_class` to render a custom field. This allows you to create a custom
91
+ # form field on an as-needed basis. The `field_class` must be a subclass of
92
+ # `Proscenium::UI::Form::Fields::Base`.
93
+ #
94
+ # Example:
95
+ #
96
+ # render Proscenium::UI::Form.new @resource do |f|
97
+ # f.use_field Administrator::EmailField, :email, :required!
98
+ # end
99
+ #
100
+ # @param field_class [Class<Proscenium::UI::Form::Fields::Base>]
101
+ # @param args [Array<Symbol>] name or nested names of model attribute
102
+ # @param attributes [Hash] passed through to each input
103
+ def use_field(field_class, *args, **attributes)
104
+ merge_bang_attributes! args, attributes
105
+ render field_class.new(args, model, self, **attributes)
106
+ end
107
+
108
+ # Returns a button with type of 'submit', using the `value` given.
109
+ #
110
+ # @param value [String] Value of the `value` attribute.
111
+ def submit(value = 'Save', **)
112
+ input(name: 'commit', type: :submit, value:, **)
113
+ end
114
+
115
+ # Returns a <div> with the given `message` as its content. If `message` is not given, and
116
+ # `attribute` is, then first error message for the given model `attribute`.
117
+ #
118
+ # @param message [String] error message to display.
119
+ # @param attribute [Symbol] name of the model attribute.
120
+ def error(message: nil, attribute: nil, &content)
121
+ if message.nil? && attribute.nil? && !content
122
+ raise ArgumentError, 'One of `message:`, `attribute:` or a block is required'
123
+ end
124
+
125
+ if content
126
+ div class: :@error, &content
127
+ else
128
+ div class: :@error do
129
+ message || @model.errors[attribute]&.first
130
+ end
131
+ end
132
+ end
133
+
134
+ def view_template(&block)
135
+ form action:, method:, **@attributes do
136
+ method_field
137
+ authenticity_token_field
138
+ error_for_base
139
+ yield_content(&block)
140
+ end
141
+ end
142
+
143
+ def error_for_base
144
+ return unless @model.errors.key?(:base)
145
+
146
+ callout :danger do |x|
147
+ x.title { 'Unable to save...' }
148
+ div { @model.errors.full_messages_for(:base).first }
149
+ end
150
+ end
151
+
152
+ def field_name(*names, multiple: false)
153
+ # Delete the `?` suffix if present.
154
+ lname = names.pop.to_s
155
+ names.append lname.delete_suffix('?').to_sym
156
+
157
+ @_view_context.field_name(ActiveModel::Naming.param_key(@model.class), *names,
158
+ multiple:)
159
+ end
160
+
161
+ def field_id(*)
162
+ @_view_context.field_id(ActiveModel::Naming.param_key(@model.class), *)
163
+ end
164
+
165
+ def authenticity_token_field
166
+ return if method == 'get'
167
+
168
+ input(
169
+ name: 'authenticity_token',
170
+ type: 'hidden',
171
+ value: @_view_context.form_authenticity_token(form_options: { action:,
172
+ method: @method })
173
+ )
174
+ end
175
+
176
+ def action
177
+ @_view_context.url_for(@action || @model)
178
+ end
179
+
180
+ def method_field
181
+ return if STANDARD_METHOD_VERBS.include?(@method)
182
+
183
+ input type: 'hidden', name: '_method', value: @method, autocomplete: 'off'
184
+ end
185
+
186
+ def method
187
+ STANDARD_METHOD_VERBS.include?(@method) ? @method : 'post'
188
+ end
189
+
190
+ input_field :file_field, type: 'file'
191
+ input_field :url_field, type: 'url'
192
+ input_field :text_field, type: 'text'
193
+ input_field :time_field, type: 'time'
194
+ input_field :date_field, type: 'date'
195
+ input_field :number_field, type: 'number'
196
+ input_field :week_field, type: 'week'
197
+ input_field :month_field, type: 'month'
198
+ input_field :email_field, type: 'email'
199
+ input_field :color_field, type: 'color'
200
+ input_field :search_field, type: 'search'
201
+ input_field :password_field, type: 'password'
202
+ input_field :range_field, type: 'range'
203
+
204
+ private
205
+
206
+ def merge_bang_attributes!(attrs, kw_attributes, additional_bang_attrs: [])
207
+ Proscenium::Utils.merge_bang_attributes! attrs, kw_attributes,
208
+ %i[required disabled].concat(additional_bang_attrs)
209
+ end
210
+ end
211
+ end
@@ -0,0 +1,7 @@
1
+ :where(html) {
2
+ --pui-input-border: 1px solid gray;
3
+ --pui-input-color: FieldText;
4
+ --pui-input-accent-color: lightgray;
5
+ --pui-input-border-radius: 2px;
6
+ --pui-input-background-color: Field;
7
+ }
@@ -0,0 +1,65 @@
1
+ export function lazyLoadControllersFrom(under, app, element = document) {
2
+ const { controllerAttribute } = app.schema;
3
+
4
+ lazyLoadExistingControllers(element);
5
+
6
+ // Lazy load new controllers.
7
+ new MutationObserver((mutationsList) => {
8
+ for (const { attributeName, target, type } of mutationsList) {
9
+ switch (type) {
10
+ case "attributes": {
11
+ if (
12
+ attributeName == controllerAttribute &&
13
+ target.getAttribute(controllerAttribute)
14
+ ) {
15
+ extractControllerNamesFrom(target).forEach((controllerName) =>
16
+ loadController(controllerName)
17
+ );
18
+ }
19
+ }
20
+
21
+ case "childList": {
22
+ lazyLoadExistingControllers(target);
23
+ }
24
+ }
25
+ }
26
+ }).observe(element, {
27
+ attributeFilter: [controllerAttribute],
28
+ subtree: true,
29
+ childList: true,
30
+ });
31
+
32
+ function lazyLoadExistingControllers(element) {
33
+ Array.from(element.querySelectorAll(`[${controllerAttribute}]`))
34
+ .map(extractControllerNamesFrom)
35
+ .flat()
36
+ .forEach(loadController);
37
+ }
38
+
39
+ function extractControllerNamesFrom(element) {
40
+ return element
41
+ .getAttribute(controllerAttribute)
42
+ .split(/\s+/)
43
+ .filter((content) => content.length);
44
+ }
45
+
46
+ function loadController(name) {
47
+ if (canRegisterController(name)) {
48
+ const fileToImport = `${under}/${name
49
+ .replace(/--/g, "/")
50
+ .replace(/-/g, "_")}_controller.js`;
51
+
52
+ import(fileToImport)
53
+ .then((module) => {
54
+ canRegisterController(name) && app.register(name, module.default);
55
+ })
56
+ .catch((error) =>
57
+ console.error(`Failed to autoload controller: ${name}`, error)
58
+ );
59
+ }
60
+ }
61
+
62
+ function canRegisterController(name) {
63
+ return !app.router.modulesByIdentifier.has(name);
64
+ }
65
+ }
@@ -0,0 +1 @@
1
+ console.log("proscenium/test.js");
@@ -0,0 +1,15 @@
1
+ import DataConfirm from "./data_confirm";
2
+ import DataDisableWith from "./data_disable_with";
3
+
4
+ export default class UJS {
5
+ constructor() {
6
+ this.dc = new DataConfirm();
7
+ this.ddw = new DataDisableWith();
8
+
9
+ document.addEventListener("submit", this, { capture: true });
10
+ }
11
+
12
+ handleEvent(event) {
13
+ this.dc.onSubmit(event) && this.ddw.onSubmit(event);
14
+ }
15
+ }
@@ -0,0 +1,23 @@
1
+ export default class DataConfirm {
2
+ onSubmit = (event) => {
3
+ if (
4
+ !event.target.matches("[data-turbo=true]") &&
5
+ event.submitter &&
6
+ "confirm" in event.submitter.dataset
7
+ ) {
8
+ const v = event.submitter.dataset.confirm;
9
+
10
+ if (
11
+ v !== "false" &&
12
+ !confirm(v === "true" || v === "" ? "Are you sure?" : v)
13
+ ) {
14
+ event.preventDefault();
15
+ event.stopPropagation();
16
+ event.stopImmediatePropagation();
17
+ return false;
18
+ }
19
+ }
20
+
21
+ return true;
22
+ };
23
+ }
@@ -0,0 +1,68 @@
1
+ export default class DataDisableWith {
2
+ onSubmit = event => {
3
+ const target = event.target
4
+ const formId = target.id
5
+
6
+ if (target.matches('[data-turbo=true]')) return
7
+
8
+ const submitElements = Array.from(
9
+ target.querySelectorAll(
10
+ ['input[type=submit][data-disable-with]', 'button[type=submit][data-disable-with]'].join(
11
+ ', '
12
+ )
13
+ )
14
+ )
15
+
16
+ submitElements.push(
17
+ ...Array.from(
18
+ document.querySelectorAll(
19
+ [
20
+ `input[type=submit][data-disable-with][form='${formId}']`,
21
+ `button[type=submit][data-disable-with][form='${formId}']`
22
+ ].join(', ')
23
+ )
24
+ )
25
+ )
26
+
27
+ for (const ele of submitElements) {
28
+ if (ele.hasAttribute('form') && ele.getAttribute('form') !== target.id) continue
29
+
30
+ this.#disableButton(ele)
31
+ }
32
+ }
33
+
34
+ #disableButton(ele) {
35
+ const defaultTextValue = 'Please wait...'
36
+ let textValue = ele.dataset.disableWith || defaultTextValue
37
+ if (textValue === 'false') return
38
+ if (textValue === 'true') {
39
+ textValue = defaultTextValue
40
+ }
41
+
42
+ ele.disabled = true
43
+
44
+ if (ele.matches('button')) {
45
+ ele.dataset.valueBeforeDisabled = ele.innerHTML
46
+ ele.innerHTML = textValue
47
+ } else {
48
+ ele.dataset.valueBeforeDisabled = ele.value
49
+ ele.value = textValue
50
+ }
51
+
52
+ if (ele.resetDisableWith === undefined) {
53
+ // This function can be called on the element to reset the disabled state. Useful for when
54
+ // form submission fails, and the button should be re-enabled.
55
+ ele.resetDisableWith = function () {
56
+ this.disabled = false
57
+
58
+ if (this.matches('button')) {
59
+ this.innerHTML = this.dataset.valueBeforeDisabled
60
+ } else {
61
+ this.value = this.dataset.valueBeforeDisabled
62
+ }
63
+
64
+ delete this.dataset.valueBeforeDisabled
65
+ }
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,9 @@
1
+ export default async () => {
2
+ window.Proscenium = window.Proscenium || {};
3
+
4
+ if (!window.Proscenium.UJS) {
5
+ const classPath = "/node_modules/@rubygems/proscenium/ujs/class.js";
6
+ const module = await import(classPath);
7
+ window.Proscenium.UJS = new module.default();
8
+ }
9
+ };
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Proscenium::UI
4
+ extend ActiveSupport::Autoload
5
+ extend Phlex::Kit
6
+
7
+ autoload :Component
8
+ autoload :Breadcrumbs
9
+ autoload :Form
10
+ autoload :Flash
11
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Proscenium
4
- VERSION = '0.19.0.beta15'
4
+ VERSION = '0.19.0.test1'
5
5
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Proscenium
4
+ module ViewComponent::CssModules
5
+ include Proscenium::CssModule
6
+
7
+ def self.included(base)
8
+ base.extend CssModule::Path
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Proscenium
4
+ # Renders a <div> for use with React components, with data attributes specifying the component
5
+ # path and props.
6
+ #
7
+ # If a content block is given, that content will be rendered inside the component, allowing for a
8
+ # "loading" UI. If no block is given, then a "loading..." text will be rendered. It is intended
9
+ # that the component is mounted to this div, and the loading UI will then be replaced with the
10
+ # component's rendered output.
11
+ class ViewComponent::ReactComponent < ViewComponent
12
+ self.abstract_class = true
13
+
14
+ include ReactComponentable
15
+
16
+ def call
17
+ tag.send root_tag, data: data_attributes do
18
+ tag.div content || 'loading...'
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Proscenium::ViewComponent::Sideload
4
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Proscenium::ViewComponent < ViewComponent::Base
4
+ extend ActiveSupport::Autoload
5
+
6
+ autoload :Sideload
7
+ autoload :ReactComponent
8
+ autoload :CssModules
9
+
10
+ include Proscenium::SourcePath
11
+ include CssModules
12
+
13
+ module Sideload
14
+ def before_render
15
+ Proscenium::SideLoad.sideload_inheritance_chain self, controller.sideload_assets_options
16
+
17
+ super
18
+ end
19
+ end
20
+
21
+ class_attribute :sideload_assets_options
22
+
23
+ class << self
24
+ attr_accessor :abstract_class
25
+
26
+ def inherited(child)
27
+ child.prepend Sideload
28
+
29
+ super
30
+ end
31
+
32
+ def sideload_assets(value)
33
+ self.sideload_assets_options = value
34
+ end
35
+ end
36
+ end
data/lib/proscenium.rb CHANGED
@@ -1,13 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'zeitwerk'
4
- require 'proscenium/railtie'
5
-
6
- loader = Zeitwerk::Loader.for_gem
7
- loader.ignore "#{__dir__}/proscenium/core_ext/object/css_module_ivars.rb"
8
- loader.setup
3
+ require 'active_support'
4
+ require 'active_record/type' # needed by Literal, even though we're not using ActiveRecord
5
+ require 'literal'
9
6
 
10
7
  module Proscenium
8
+ extend ActiveSupport::Autoload
9
+
11
10
  FILE_EXTENSIONS = ['js', 'mjs', 'ts', 'jsx', 'tsx', 'css', 'js.map', 'mjs.map', 'jsx.map',
12
11
  'ts.map', 'tsx.map', 'css.map'].freeze
13
12
 
@@ -23,6 +22,25 @@ module Proscenium
23
22
  # Environment variables that should always be passed to the builder.
24
23
  DEFAULT_ENV_VARS = Set['RAILS_ENV', 'NODE_ENV'].freeze
25
24
 
25
+ autoload :SourcePath
26
+ autoload :Utils
27
+ autoload :Monkey
28
+ autoload :Middleware
29
+ autoload :EnsureLoaded
30
+ autoload :SideLoad
31
+ autoload :CssModule
32
+ autoload :ReactComponentable
33
+ autoload :ViewComponent
34
+ autoload :Phlex
35
+ autoload :Helper
36
+ autoload :Builder
37
+ autoload :Importer
38
+ autoload :Resolver
39
+ autoload :BundledGems
40
+ autoload :RubyGems
41
+ autoload :Registry
42
+ autoload :UI
43
+
26
44
  class Deprecator
27
45
  def deprecation_warning(name, message, _caller_backtrace = nil)
28
46
  msg = "`#{name}` is deprecated and will be removed in a near future release of Proscenium"
@@ -47,8 +65,18 @@ module Proscenium
47
65
  @config ||= Railtie.config.proscenium
48
66
  end
49
67
 
68
+ def ui_path
69
+ @ui_path ||= Railtie.root.join('lib', 'proscenium', 'ui')
70
+ end
71
+
72
+ def ui_path_regex
73
+ @ui_path_regex ||= Regexp.new("^#{Proscenium.ui_path}/")
74
+ end
75
+
50
76
  def root
51
77
  Railtie.root
52
78
  end
53
79
  end
54
80
  end
81
+
82
+ require 'proscenium/railtie'