phlex-stimulus 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +16 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +341 -0
  6. data/Rakefile +12 -0
  7. data/lib/generators/phlex/stimulus/controller/USAGE +5 -0
  8. data/lib/generators/phlex/stimulus/controller/controller_generator.rb +49 -0
  9. data/lib/generators/phlex/stimulus/controller/templates/component.rb.erb +30 -0
  10. data/lib/generators/phlex/stimulus/controller/templates/controller.ts.erb +23 -0
  11. data/lib/generators/phlex/stimulus/generator_mixin.rb +21 -0
  12. data/lib/generators/phlex/stimulus/install/USAGE +5 -0
  13. data/lib/generators/phlex/stimulus/install/install_generator.rb +111 -0
  14. data/lib/generators/phlex/stimulus/install/templates/app/components/base.rb.erb +29 -0
  15. data/lib/generators/phlex/stimulus/install/templates/app/components/chain_controller.rb.erb +29 -0
  16. data/lib/generators/phlex/stimulus/install/templates/app/components/classlist_controller.rb.erb +30 -0
  17. data/lib/generators/phlex/stimulus/install/templates/app/components/controller.rb.erb +10 -0
  18. data/lib/generators/phlex/stimulus/install/templates/app/components/controller_chain.rb.erb +32 -0
  19. data/lib/generators/phlex/stimulus/install/templates/app/components/controller_template.rb.erb +24 -0
  20. data/lib/generators/phlex/stimulus/install/templates/app/components/log_controller.rb.erb +33 -0
  21. data/lib/generators/phlex/stimulus/install/templates/app/components/sleep_controller.rb.erb +30 -0
  22. data/lib/generators/phlex/stimulus/install/templates/app/components.rb.erb +7 -0
  23. data/lib/generators/phlex/stimulus/install/templates/app/javascript/application.ts.erb +5 -0
  24. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/application.ts.erb +10 -0
  25. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/chain_controller.ts.erb +32 -0
  26. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/chainable_controller.ts.erb +44 -0
  27. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/classlist_controller.ts.erb +30 -0
  28. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/index.ts.erb +4 -0
  29. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/log_controller.ts.erb +25 -0
  30. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/sleep_controller.ts.erb +19 -0
  31. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/typed_controller.ts.erb +53 -0
  32. data/lib/generators/phlex/stimulus/install/templates/app/javascript/utils/misc.ts.erb +37 -0
  33. data/lib/generators/phlex/stimulus/install/templates/app/javascript/utils/template.ts.erb +11 -0
  34. data/lib/phlex/stimulus/components/base.rb +81 -0
  35. data/lib/phlex/stimulus/components/controller.rb +170 -0
  36. data/lib/phlex/stimulus/components.rb +9 -0
  37. data/lib/phlex/stimulus/version.rb +8 -0
  38. data/lib/phlex/stimulus.rb +15 -0
  39. data/sorbet/config +7 -0
  40. data/sorbet/rbi/annotations/.gitattributes +1 -0
  41. data/sorbet/rbi/annotations/actionmailer.rbi +15 -0
  42. data/sorbet/rbi/annotations/actionpack.rbi +430 -0
  43. data/sorbet/rbi/annotations/actionview.rbi +75 -0
  44. data/sorbet/rbi/annotations/activejob.rbi +50 -0
  45. data/sorbet/rbi/annotations/activemodel.rbi +119 -0
  46. data/sorbet/rbi/annotations/activerecord.rbi +172 -0
  47. data/sorbet/rbi/annotations/activesupport.rbi +561 -0
  48. data/sorbet/rbi/annotations/globalid.rbi +30 -0
  49. data/sorbet/rbi/annotations/minitest.rbi +116 -0
  50. data/sorbet/rbi/annotations/railties.rbi +104 -0
  51. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  52. data/sorbet/rbi/dsl/.gitattributes +1 -0
  53. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  54. data/sorbet/rbi/gems/.gitattributes +1 -0
  55. data/sorbet/rbi/gems/action_text-trix@2.1.19.rbi +9 -0
  56. data/sorbet/rbi/gems/actioncable@8.1.3.rbi +9 -0
  57. data/sorbet/rbi/gems/actionmailbox@8.1.3.rbi +9 -0
  58. data/sorbet/rbi/gems/actionmailer@8.1.3.rbi +9 -0
  59. data/sorbet/rbi/gems/actionpack@8.1.3.rbi +20478 -0
  60. data/sorbet/rbi/gems/actiontext@8.1.3.rbi +9 -0
  61. data/sorbet/rbi/gems/actionview@8.1.3.rbi +14722 -0
  62. data/sorbet/rbi/gems/activejob@8.1.3.rbi +9 -0
  63. data/sorbet/rbi/gems/activemodel@8.1.3.rbi +9 -0
  64. data/sorbet/rbi/gems/activerecord@8.1.3.rbi +9 -0
  65. data/sorbet/rbi/gems/activestorage@8.1.3.rbi +9 -0
  66. data/sorbet/rbi/gems/activesupport@8.1.3.rbi +20153 -0
  67. data/sorbet/rbi/gems/ast@2.4.3.rbi +550 -0
  68. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  69. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +621 -0
  70. data/sorbet/rbi/gems/booleans@0.1.3.rbi +31 -0
  71. data/sorbet/rbi/gems/builder@3.3.0.rbi +9 -0
  72. data/sorbet/rbi/gems/byebug@12.0.0.rbi +49 -0
  73. data/sorbet/rbi/gems/concurrent-ruby@1.3.8.rbi +10656 -0
  74. data/sorbet/rbi/gems/connection_pool@3.0.2.rbi +9 -0
  75. data/sorbet/rbi/gems/crass@1.0.7.rbi +648 -0
  76. data/sorbet/rbi/gems/date@3.5.1.rbi +391 -0
  77. data/sorbet/rbi/gems/drb@2.2.3.rbi +9 -0
  78. data/sorbet/rbi/gems/erb@6.0.6.rbi +1600 -0
  79. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  80. data/sorbet/rbi/gems/globalid@1.4.0.rbi +9 -0
  81. data/sorbet/rbi/gems/i18n@1.15.2.rbi +2285 -0
  82. data/sorbet/rbi/gems/io-console@0.8.2.rbi +9 -0
  83. data/sorbet/rbi/gems/json@2.21.1.rbi +2289 -0
  84. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
  85. data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
  86. data/sorbet/rbi/gems/loofah@2.25.2.rbi +1134 -0
  87. data/sorbet/rbi/gems/mail@2.9.1.rbi +9 -0
  88. data/sorbet/rbi/gems/marcel@1.2.1.rbi +9 -0
  89. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
  90. data/sorbet/rbi/gems/minitest@6.0.6.rbi +1482 -0
  91. data/sorbet/rbi/gems/net-imap@0.6.4.1.rbi +9 -0
  92. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +9 -0
  93. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +244 -0
  94. data/sorbet/rbi/gems/net-smtp@0.5.1.rbi +9 -0
  95. data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
  96. data/sorbet/rbi/gems/nio4r@2.7.5.rbi +9 -0
  97. data/sorbet/rbi/gems/nokogiri@1.19.4.rbi +8168 -0
  98. data/sorbet/rbi/gems/parallel@1.28.0.rbi +270 -0
  99. data/sorbet/rbi/gems/phlex-rails@2.4.0.rbi +1945 -0
  100. data/sorbet/rbi/gems/phlex@2.4.1.rbi +1413 -0
  101. data/sorbet/rbi/gems/pp@0.6.4.rbi +387 -0
  102. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +455 -0
  103. data/sorbet/rbi/gems/prism@1.9.0.rbi +42226 -0
  104. data/sorbet/rbi/gems/racc@1.8.1.rbi +165 -0
  105. data/sorbet/rbi/gems/rack-session@2.1.2.rbi +756 -0
  106. data/sorbet/rbi/gems/rack-test@2.2.0.rbi +681 -0
  107. data/sorbet/rbi/gems/rack@3.2.6.rbi +4653 -0
  108. data/sorbet/rbi/gems/rackup@2.3.1.rbi +9 -0
  109. data/sorbet/rbi/gems/rails-dom-testing@2.3.0.rbi +517 -0
  110. data/sorbet/rbi/gems/rails-html-sanitizer@1.7.1.rbi +620 -0
  111. data/sorbet/rbi/gems/rails@8.1.3.rbi +9 -0
  112. data/sorbet/rbi/gems/railties@8.1.3.rbi +3507 -0
  113. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
  114. data/sorbet/rbi/gems/rake@13.4.2.rbi +3130 -0
  115. data/sorbet/rbi/gems/rbi@0.4.0.rbi +5706 -0
  116. data/sorbet/rbi/gems/rbs@4.0.3.rbi +6908 -0
  117. data/sorbet/rbi/gems/refract@1.1.0.rbi +9 -0
  118. data/sorbet/rbi/gems/reline@0.6.3.rbi +2446 -0
  119. data/sorbet/rbi/gems/require-hooks@0.4.0.rbi +152 -0
  120. data/sorbet/rbi/gems/rexml@3.4.4.rbi +4905 -0
  121. data/sorbet/rbi/gems/rubocop-espago@1.3.0.rbi +9 -0
  122. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  123. data/sorbet/rbi/gems/rubydex@0.2.9.rbi +841 -0
  124. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  125. data/sorbet/rbi/gems/shoulda-context@2.0.0.rbi +544 -0
  126. data/sorbet/rbi/gems/spoom@1.8.4.rbi +6738 -0
  127. data/sorbet/rbi/gems/tapioca@0.19.2.rbi +3599 -0
  128. data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
  129. data/sorbet/rbi/gems/timeout@0.6.1.rbi +200 -0
  130. data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
  131. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5474 -0
  132. data/sorbet/rbi/gems/unicode-display_width@3.2.0.rbi +130 -0
  133. data/sorbet/rbi/gems/unicode-emoji@4.2.0.rbi +332 -0
  134. data/sorbet/rbi/gems/uri@1.1.1.rbi +2402 -0
  135. data/sorbet/rbi/gems/useragent@0.16.11.rbi +9 -0
  136. data/sorbet/rbi/gems/websocket-driver@0.8.2.rbi +9 -0
  137. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +9 -0
  138. data/sorbet/rbi/gems/zeitwerk@2.8.2.rbi +9 -0
  139. data/sorbet/rbi/shims/gems/parser.rbi +12 -0
  140. data/sorbet/rbi/shims/gems/rails.rbi +55 -0
  141. data/sorbet/rbi/shims/gems/refract.rbi +13 -0
  142. data/sorbet/rbi/shims/gems/shoulda-context.rbi +16 -0
  143. data/sorbet/tapioca/compilers/phlex_controller.rb +80 -0
  144. data/sorbet/tapioca/config.yml +26 -0
  145. data/sorbet/tapioca/extensions/load_gem.rb +1 -0
  146. data/sorbet/tapioca/require.rb +4 -0
  147. metadata +266 -0
@@ -0,0 +1,9 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `connection_pool` gem.
5
+ # Please instead update this file by running `bin/tapioca gem connection_pool`.
6
+
7
+
8
+ # THIS IS AN EMPTY RBI FILE.
9
+ # see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
@@ -0,0 +1,648 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `crass` gem.
5
+ # Please instead update this file by running `bin/tapioca gem crass`.
6
+
7
+
8
+ # A CSS parser based on the CSS Syntax Module Level 3 spec.
9
+ #
10
+ # pkg:gem/crass#lib/crass/token-scanner.rb:3
11
+ module Crass
12
+ class << self
13
+ # Parses _input_ as a CSS stylesheet and returns a parse tree.
14
+ #
15
+ # Options:
16
+ #
17
+ # * **:maximum_depth** - Maximum nesting depth for simple blocks and
18
+ # functions. Constructs nested more deeply than this are discarded to
19
+ # prevent stack exhaustion. Defaults to {Parser::DEFAULT_MAXIMUM_DEPTH}.
20
+ #
21
+ # * **:preserve_comments** - If `true`, comments will be preserved as
22
+ # `:comment` tokens.
23
+ #
24
+ # * **:preserve_hacks** - If `true`, certain non-standard browser hacks
25
+ # such as the IE "*" hack will be preserved even though they violate
26
+ # CSS 3 syntax rules.
27
+ #
28
+ # pkg:gem/crass#lib/crass.rb:22
29
+ def parse(input, options = T.unsafe(nil)); end
30
+
31
+ # Parses _input_ as a string of CSS properties (such as the contents of an
32
+ # HTML element's `style` attribute) and returns a parse tree.
33
+ #
34
+ # See {Crass.parse} for _options_.
35
+ #
36
+ # pkg:gem/crass#lib/crass.rb:30
37
+ def parse_properties(input, options = T.unsafe(nil)); end
38
+ end
39
+ end
40
+
41
+ # Parses a CSS string or list of tokens.
42
+ #
43
+ # 5. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#parsing
44
+ #
45
+ # pkg:gem/crass#lib/crass/parser.rb:10
46
+ class Crass::Parser
47
+ # Initializes a parser based on the given _input_, which may be a CSS string
48
+ # or an array of tokens.
49
+ #
50
+ # See {Crass.parse} for _options_.
51
+ #
52
+ # pkg:gem/crass#lib/crass/parser.rb:140
53
+ def initialize(input, options = T.unsafe(nil)); end
54
+
55
+ # Consumes an at-rule and returns it.
56
+ #
57
+ # 5.4.2. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-at-rule
58
+ #
59
+ # pkg:gem/crass#lib/crass/parser.rb:153
60
+ def consume_at_rule(input = T.unsafe(nil)); end
61
+
62
+ # Consumes a component value and returns it, or `nil` if there are no more
63
+ # tokens.
64
+ #
65
+ # 5.4.6. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-component-value
66
+ #
67
+ # pkg:gem/crass#lib/crass/parser.rb:200
68
+ def consume_component_value(input = T.unsafe(nil)); end
69
+
70
+ # Consumes a declaration and returns it, or `nil` on parse error.
71
+ #
72
+ # 5.4.5. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-declaration
73
+ #
74
+ # pkg:gem/crass#lib/crass/parser.rb:225
75
+ def consume_declaration(input = T.unsafe(nil)); end
76
+
77
+ # Consumes a list of declarations and returns them.
78
+ #
79
+ # By default, the returned list may include `:comment`, `:semicolon`, and
80
+ # `:whitespace` nodes, which is non-standard.
81
+ #
82
+ # Options:
83
+ #
84
+ # * **:strict** - Set to `true` to exclude non-standard `:comment`,
85
+ # `:semicolon`, and `:whitespace` nodes.
86
+ #
87
+ # 5.4.4. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-list-of-declarations
88
+ #
89
+ # pkg:gem/crass#lib/crass/parser.rb:292
90
+ def consume_declarations(input = T.unsafe(nil), options = T.unsafe(nil)); end
91
+
92
+ # Consumes a function and returns it.
93
+ #
94
+ # 5.4.8. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-function
95
+ #
96
+ # pkg:gem/crass#lib/crass/parser.rb:342
97
+ def consume_function(input = T.unsafe(nil)); end
98
+
99
+ # Consumes a qualified rule and returns it, or `nil` if a parse error
100
+ # occurs.
101
+ #
102
+ # 5.4.3. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-qualified-rule
103
+ #
104
+ # pkg:gem/crass#lib/crass/parser.rb:383
105
+ def consume_qualified_rule(input = T.unsafe(nil)); end
106
+
107
+ # Consumes a list of rules and returns them.
108
+ #
109
+ # 5.4.1. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-list-of-rules
110
+ #
111
+ # pkg:gem/crass#lib/crass/parser.rb:424
112
+ def consume_rules(flags = T.unsafe(nil)); end
113
+
114
+ # Consumes and returns a simple block associated with the current input
115
+ # token.
116
+ #
117
+ # 5.4.7. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-simple-block
118
+ #
119
+ # pkg:gem/crass#lib/crass/parser.rb:460
120
+ def consume_simple_block(input = T.unsafe(nil)); end
121
+
122
+ # Creates and returns a new parse node with the given _properties_.
123
+ #
124
+ # pkg:gem/crass#lib/crass/parser.rb:526
125
+ def create_node(type, properties = T.unsafe(nil)); end
126
+
127
+ # Parses the given _input_ tokens into a selector node and returns it.
128
+ #
129
+ # Doesn't bother splitting the selector list into individual selectors or
130
+ # validating them. Feel free to do that yourself! It'll be fun!
131
+ #
132
+ # pkg:gem/crass#lib/crass/parser.rb:534
133
+ def create_selector(input); end
134
+
135
+ # Creates a `:style_rule` node from the given qualified _rule_, and returns
136
+ # it.
137
+ #
138
+ # pkg:gem/crass#lib/crass/parser.rb:542
139
+ def create_style_rule(rule); end
140
+
141
+ # Discards an over-nested simple block or function without recursing, then
142
+ # returns an `:error` node. Assumes `input.current` is the opening token (a
143
+ # `{`, `[`, `(`, or function token).
144
+ #
145
+ # This is reached only when the configured maximum nesting depth is
146
+ # exceeded. It iteratively consumes tokens up to the matching closing token
147
+ # (tracking nested blocks and functions with an explicit stack) so that a
148
+ # deeply nested construct can't exhaust the Ruby stack.
149
+ #
150
+ # pkg:gem/crass#lib/crass/parser.rb:501
151
+ def discard_block(input); end
152
+
153
+ # Parses a single component value and returns it.
154
+ #
155
+ # 5.3.7. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#parse-a-component-value
156
+ #
157
+ # pkg:gem/crass#lib/crass/parser.rb:551
158
+ def parse_component_value(input = T.unsafe(nil)); end
159
+
160
+ # Parses a list of component values and returns an array of parsed tokens.
161
+ #
162
+ # 5.3.8. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#parse-a-list-of-component-values
163
+ #
164
+ # pkg:gem/crass#lib/crass/parser.rb:578
165
+ def parse_component_values(input = T.unsafe(nil)); end
166
+
167
+ # Parses a single declaration and returns it.
168
+ #
169
+ # 5.3.5. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#parse-a-declaration
170
+ #
171
+ # pkg:gem/crass#lib/crass/parser.rb:592
172
+ def parse_declaration(input = T.unsafe(nil)); end
173
+
174
+ # Parses a list of declarations and returns them.
175
+ #
176
+ # See {#consume_declarations} for _options_.
177
+ #
178
+ # 5.3.6. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#parse-a-list-of-declarations
179
+ #
180
+ # pkg:gem/crass#lib/crass/parser.rb:620
181
+ def parse_declarations(input = T.unsafe(nil), options = T.unsafe(nil)); end
182
+
183
+ # Parses a list of declarations and returns an array of `:property` nodes
184
+ # (and any non-declaration nodes that were in the input). This is useful for
185
+ # parsing the contents of an HTML element's `style` attribute.
186
+ #
187
+ # pkg:gem/crass#lib/crass/parser.rb:628
188
+ def parse_properties(input = T.unsafe(nil)); end
189
+
190
+ # Parses a single rule and returns it.
191
+ #
192
+ # 5.3.4. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#parse-a-rule
193
+ #
194
+ # pkg:gem/crass#lib/crass/parser.rb:654
195
+ def parse_rule(input = T.unsafe(nil)); end
196
+
197
+ # Returns the unescaped value of a selector name or property declaration.
198
+ #
199
+ # pkg:gem/crass#lib/crass/parser.rb:683
200
+ def parse_value(nodes); end
201
+
202
+ # {TokenScanner} wrapping the tokens generated from this parser's input.
203
+ #
204
+ # pkg:gem/crass#lib/crass/parser.rb:134
205
+ def tokens; end
206
+
207
+ class << self
208
+ # Parses CSS properties (such as the contents of an HTML element's `style`
209
+ # attribute) and returns a parse tree.
210
+ #
211
+ # See {Crass.parse} for _options_.
212
+ #
213
+ # 5.3.6. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#parse-a-list-of-declarations
214
+ #
215
+ # pkg:gem/crass#lib/crass/parser.rb:39
216
+ def parse_properties(input, options = T.unsafe(nil)); end
217
+
218
+ # Parses CSS rules (such as the content of a `@media` block) and returns a
219
+ # parse tree. The only difference from {parse_stylesheet} is that CDO/CDC
220
+ # nodes (`<!--` and `-->`) aren't ignored.
221
+ #
222
+ # See {Crass.parse} for _options_.
223
+ #
224
+ # 5.3.3. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#parse-a-list-of-rules
225
+ #
226
+ # pkg:gem/crass#lib/crass/parser.rb:50
227
+ def parse_rules(input, options = T.unsafe(nil)); end
228
+
229
+ # Parses a CSS stylesheet and returns a parse tree.
230
+ #
231
+ # See {Crass.parse} for _options_.
232
+ #
233
+ # 5.3.2. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#parse-a-stylesheet
234
+ #
235
+ # pkg:gem/crass#lib/crass/parser.rb:68
236
+ def parse_stylesheet(input, options = T.unsafe(nil)); end
237
+
238
+ # Converts a node or array of nodes into a CSS string based on their
239
+ # original tokenized input.
240
+ #
241
+ # Options:
242
+ #
243
+ # * **:exclude_comments** - When `true`, comments will be excluded.
244
+ #
245
+ # pkg:gem/crass#lib/crass/parser.rb:88
246
+ def stringify(nodes, options = T.unsafe(nil)); end
247
+ end
248
+ end
249
+
250
+ # pkg:gem/crass#lib/crass/parser.rb:11
251
+ Crass::Parser::BLOCK_END_TOKENS = T.let(T.unsafe(nil), Hash)
252
+
253
+ # Default maximum nesting depth for simple blocks and functions. This is far
254
+ # higher than any legitimate CSS needs, but far below the depth at which
255
+ # Ruby would raise `SystemStackError` while recursively parsing nested
256
+ # constructs.
257
+ #
258
+ # Keeping this low also bounds memory usage: each nested simple block and
259
+ # function retains a `:tokens` array spanning its descendants for
260
+ # serialization, so the total serialization metadata grows with nesting
261
+ # depth. A modest limit prevents deeply nested (but otherwise valid) input
262
+ # from amplifying memory disproportionately.
263
+ #
264
+ # It can be overridden with the `:maximum_depth` option.
265
+ #
266
+ # pkg:gem/crass#lib/crass/parser.rb:29
267
+ Crass::Parser::DEFAULT_MAXIMUM_DEPTH = T.let(T.unsafe(nil), Integer)
268
+
269
+ # Similar to a StringScanner, but with extra functionality needed to tokenize
270
+ # CSS while preserving the original text.
271
+ #
272
+ # pkg:gem/crass#lib/crass/scanner.rb:8
273
+ class Crass::Scanner
274
+ # Creates a Scanner instance for the given _input_ string or IO instance.
275
+ #
276
+ # pkg:gem/crass#lib/crass/scanner.rb:29
277
+ def initialize(input); end
278
+
279
+ # Consumes the next character and returns it, advancing the pointer, or
280
+ # an empty string if the end of the string has been reached.
281
+ #
282
+ # pkg:gem/crass#lib/crass/scanner.rb:38
283
+ def consume; end
284
+
285
+ # Consumes the rest of the string and returns it, advancing the pointer to
286
+ # the end of the string. Returns an empty string is the end of the string
287
+ # has already been reached.
288
+ #
289
+ # pkg:gem/crass#lib/crass/scanner.rb:50
290
+ def consume_rest; end
291
+
292
+ # Current character, or `nil` if the scanner hasn't yet consumed a
293
+ # character, or is at the end of the string.
294
+ #
295
+ # pkg:gem/crass#lib/crass/scanner.rb:11
296
+ def current; end
297
+
298
+ # Returns `true` if the end of the string has been reached, `false`
299
+ # otherwise.
300
+ #
301
+ # pkg:gem/crass#lib/crass/scanner.rb:66
302
+ def eos?; end
303
+
304
+ # Sets the marker to the position of the next character that will be
305
+ # consumed.
306
+ #
307
+ # pkg:gem/crass#lib/crass/scanner.rb:72
308
+ def mark; end
309
+
310
+ # Returns the substring between {#marker} and {#pos}, without altering the
311
+ # pointer.
312
+ #
313
+ # pkg:gem/crass#lib/crass/scanner.rb:79
314
+ def marked; end
315
+
316
+ # Current marker position. Use {#marked} to get the substring between
317
+ # {#marker} and {#pos}.
318
+ #
319
+ # pkg:gem/crass#lib/crass/scanner.rb:15
320
+ def marker; end
321
+
322
+ # Current marker position. Use {#marked} to get the substring between
323
+ # {#marker} and {#pos}.
324
+ #
325
+ # pkg:gem/crass#lib/crass/scanner.rb:15
326
+ def marker=(_arg0); end
327
+
328
+ # Returns up to _length_ characters starting at the current position, but
329
+ # doesn't consume them. The number of characters returned may be less than
330
+ # _length_ if the end of the string is reached.
331
+ #
332
+ # pkg:gem/crass#lib/crass/scanner.rb:91
333
+ def peek(length = T.unsafe(nil)); end
334
+
335
+ # Position of the next character that will be consumed. This is a character
336
+ # position, not a byte position, so it accounts for multi-byte characters.
337
+ #
338
+ # Byte offsets (used internally for fast substring extraction) are tracked
339
+ # separately by the underlying StringScanner, whose `pos` always reflects
340
+ # the byte offset corresponding to this character position.
341
+ #
342
+ # pkg:gem/crass#lib/crass/scanner.rb:23
343
+ def pos; end
344
+
345
+ # Position of the next character that will be consumed. This is a character
346
+ # position, not a byte position, so it accounts for multi-byte characters.
347
+ #
348
+ # Byte offsets (used internally for fast substring extraction) are tracked
349
+ # separately by the underlying StringScanner, whose `pos` always reflects
350
+ # the byte offset corresponding to this character position.
351
+ #
352
+ # pkg:gem/crass#lib/crass/scanner.rb:23
353
+ def pos=(_arg0); end
354
+
355
+ # Moves the pointer back one character without changing the value of
356
+ # {#current}. The next call to {#consume} will re-consume the current
357
+ # character.
358
+ #
359
+ # pkg:gem/crass#lib/crass/scanner.rb:103
360
+ def reconsume; end
361
+
362
+ # Resets the pointer to the beginning of the string.
363
+ #
364
+ # pkg:gem/crass#lib/crass/scanner.rb:109
365
+ def reset; end
366
+
367
+ # Tries to match _pattern_ at the current position. If it matches, the
368
+ # matched substring will be returned and the pointer will be advanced.
369
+ # Otherwise, `nil` will be returned.
370
+ #
371
+ # pkg:gem/crass#lib/crass/scanner.rb:122
372
+ def scan(pattern); end
373
+
374
+ # Scans the string until the _pattern_ is matched. Returns the substring up
375
+ # to and including the end of the match, and advances the pointer. If there
376
+ # is no match, `nil` is returned and the pointer is not advanced.
377
+ #
378
+ # pkg:gem/crass#lib/crass/scanner.rb:134
379
+ def scan_until(pattern); end
380
+
381
+ # String being scanned.
382
+ #
383
+ # pkg:gem/crass#lib/crass/scanner.rb:26
384
+ def string; end
385
+ end
386
+
387
+ # Like {Scanner}, but for tokens!
388
+ #
389
+ # pkg:gem/crass#lib/crass/token-scanner.rb:6
390
+ class Crass::TokenScanner
391
+ # pkg:gem/crass#lib/crass/token-scanner.rb:9
392
+ def initialize(tokens); end
393
+
394
+ # Executes the given block, collects all tokens that are consumed during its
395
+ # execution, and returns them.
396
+ #
397
+ # pkg:gem/crass#lib/crass/token-scanner.rb:16
398
+ def collect; end
399
+
400
+ # Consumes the next token and returns it, advancing the pointer. Returns
401
+ # `nil` if there is no next token.
402
+ #
403
+ # pkg:gem/crass#lib/crass/token-scanner.rb:24
404
+ def consume; end
405
+
406
+ # pkg:gem/crass#lib/crass/token-scanner.rb:7
407
+ def current; end
408
+
409
+ # Returns the next token without consuming it, or `nil` if there is no next
410
+ # token.
411
+ #
412
+ # pkg:gem/crass#lib/crass/token-scanner.rb:32
413
+ def peek; end
414
+
415
+ # pkg:gem/crass#lib/crass/token-scanner.rb:7
416
+ def pos; end
417
+
418
+ # Reconsumes the current token, moving the pointer back one position.
419
+ #
420
+ # http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#reconsume-the-current-input-token
421
+ #
422
+ # pkg:gem/crass#lib/crass/token-scanner.rb:39
423
+ def reconsume; end
424
+
425
+ # Resets the pointer to the first token in the list.
426
+ #
427
+ # pkg:gem/crass#lib/crass/token-scanner.rb:44
428
+ def reset; end
429
+
430
+ # pkg:gem/crass#lib/crass/token-scanner.rb:7
431
+ def tokens; end
432
+ end
433
+
434
+ # Tokenizes a CSS string.
435
+ #
436
+ # 4. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#tokenization
437
+ #
438
+ # pkg:gem/crass#lib/crass/tokenizer.rb:9
439
+ class Crass::Tokenizer
440
+ # Initializes a new Tokenizer.
441
+ #
442
+ # Options:
443
+ #
444
+ # * **:preserve_comments** - If `true`, comments will be preserved as
445
+ # `:comment` tokens.
446
+ #
447
+ # * **:preserve_hacks** - If `true`, certain non-standard browser hacks
448
+ # such as the IE "*" hack will be preserved even though they violate
449
+ # CSS 3 syntax rules.
450
+ #
451
+ # pkg:gem/crass#lib/crass/tokenizer.rb:62
452
+ def initialize(input, options = T.unsafe(nil)); end
453
+
454
+ # Consumes a token and returns the token that was consumed.
455
+ #
456
+ # 4.3.1. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-token
457
+ #
458
+ # pkg:gem/crass#lib/crass/tokenizer.rb:70
459
+ def consume; end
460
+
461
+ # Consumes the remnants of a bad URL and returns the consumed text.
462
+ #
463
+ # 4.3.15. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-the-remnants-of-a-bad-url
464
+ #
465
+ # pkg:gem/crass#lib/crass/tokenizer.rb:276
466
+ def consume_bad_url; end
467
+
468
+ # Consumes comments and returns them, or `nil` if no comments were consumed.
469
+ #
470
+ # 4.3.2. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-comments
471
+ #
472
+ # pkg:gem/crass#lib/crass/tokenizer.rb:302
473
+ def consume_comments; end
474
+
475
+ # Consumes an escaped code point and returns its unescaped value.
476
+ #
477
+ # This method assumes that the `\` has already been consumed, and that the
478
+ # next character in the input has already been verified not to be a newline
479
+ # or EOF.
480
+ #
481
+ # 4.3.8. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-an-escaped-code-point
482
+ #
483
+ # pkg:gem/crass#lib/crass/tokenizer.rb:327
484
+ def consume_escaped; end
485
+
486
+ # Consumes an ident-like token and returns it.
487
+ #
488
+ # 4.3.4. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-an-ident-like-token
489
+ #
490
+ # pkg:gem/crass#lib/crass/tokenizer.rb:351
491
+ def consume_ident; end
492
+
493
+ # Consumes a name and returns it.
494
+ #
495
+ # 4.3.12. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-name
496
+ #
497
+ # pkg:gem/crass#lib/crass/tokenizer.rb:376
498
+ def consume_name; end
499
+
500
+ # Consumes a number and returns a 3-element array containing the number's
501
+ # original representation, its numeric value, and its type (either
502
+ # `:integer` or `:number`).
503
+ #
504
+ # 4.3.13. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-number
505
+ #
506
+ # pkg:gem/crass#lib/crass/tokenizer.rb:408
507
+ def consume_number; end
508
+
509
+ # Consumes a numeric token and returns it.
510
+ #
511
+ # 4.3.3. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-numeric-token
512
+ #
513
+ # pkg:gem/crass#lib/crass/tokenizer.rb:431
514
+ def consume_numeric; end
515
+
516
+ # Consumes a string token that ends at the given character, and returns the
517
+ # token.
518
+ #
519
+ # 4.3.5. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-string-token
520
+ #
521
+ # pkg:gem/crass#lib/crass/tokenizer.rb:470
522
+ def consume_string(ending = T.unsafe(nil)); end
523
+
524
+ # Consumes a Unicode range token and returns it. Assumes the initial "u+" or
525
+ # "U+" has already been consumed.
526
+ #
527
+ # 4.3.7. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-unicode-range-token
528
+ #
529
+ # pkg:gem/crass#lib/crass/tokenizer.rb:511
530
+ def consume_unicode_range; end
531
+
532
+ # Consumes a URL token and returns it. Assumes the original "url(" has
533
+ # already been consumed.
534
+ #
535
+ # 4.3.6. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#consume-a-url-token
536
+ #
537
+ # pkg:gem/crass#lib/crass/tokenizer.rb:543
538
+ def consume_url; end
539
+
540
+ # Converts a valid CSS number string into a number and returns the number.
541
+ #
542
+ # 4.3.14. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#convert-a-string-to-a-number
543
+ #
544
+ # pkg:gem/crass#lib/crass/tokenizer.rb:591
545
+ def convert_string_to_number(str); end
546
+
547
+ # Creates and returns a new token with the given _properties_.
548
+ #
549
+ # pkg:gem/crass#lib/crass/tokenizer.rb:643
550
+ def create_token(type, properties = T.unsafe(nil)); end
551
+
552
+ # Preprocesses _input_ to prepare it for the tokenizer.
553
+ #
554
+ # 3.3. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#input-preprocessing
555
+ #
556
+ # pkg:gem/crass#lib/crass/tokenizer.rb:654
557
+ def preprocess(input); end
558
+
559
+ # Returns `true` if the given three-character _text_ would start an
560
+ # identifier. If _text_ is `nil`, the current and next two characters in the
561
+ # input stream will be checked, but will not be consumed.
562
+ #
563
+ # 4.3.10. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#would-start-an-identifier
564
+ #
565
+ # pkg:gem/crass#lib/crass/tokenizer.rb:669
566
+ def start_identifier?(text = T.unsafe(nil)); end
567
+
568
+ # Returns `true` if the given three-character _text_ would start a number.
569
+ # If _text_ is `nil`, the current and next two characters in the input
570
+ # stream will be checked, but will not be consumed.
571
+ #
572
+ # 4.3.11. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#starts-with-a-number
573
+ #
574
+ # pkg:gem/crass#lib/crass/tokenizer.rb:693
575
+ def start_number?(text = T.unsafe(nil)); end
576
+
577
+ # Tokenizes the input stream and returns an array of tokens.
578
+ #
579
+ # pkg:gem/crass#lib/crass/tokenizer.rb:712
580
+ def tokenize; end
581
+
582
+ # Returns `true` if the given two-character _text_ is the beginning of a
583
+ # valid escape sequence. If _text_ is `nil`, the current and next character
584
+ # in the input stream will be checked, but will not be consumed.
585
+ #
586
+ # 4.3.9. https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#starts-with-a-valid-escape
587
+ #
588
+ # pkg:gem/crass#lib/crass/tokenizer.rb:729
589
+ def valid_escape?(text = T.unsafe(nil)); end
590
+
591
+ class << self
592
+ # Tokenizes the given _input_ as a CSS string and returns an array of
593
+ # tokens.
594
+ #
595
+ # See {#initialize} for _options_.
596
+ #
597
+ # pkg:gem/crass#lib/crass/tokenizer.rb:45
598
+ def tokenize(input, options = T.unsafe(nil)); end
599
+ end
600
+ end
601
+
602
+ # pkg:gem/crass#lib/crass/tokenizer.rb:10
603
+ Crass::Tokenizer::RE_COMMENT_CLOSE = T.let(T.unsafe(nil), Regexp)
604
+
605
+ # pkg:gem/crass#lib/crass/tokenizer.rb:11
606
+ Crass::Tokenizer::RE_DIGIT = T.let(T.unsafe(nil), Regexp)
607
+
608
+ # pkg:gem/crass#lib/crass/tokenizer.rb:12
609
+ Crass::Tokenizer::RE_ESCAPE = T.let(T.unsafe(nil), Regexp)
610
+
611
+ # pkg:gem/crass#lib/crass/tokenizer.rb:13
612
+ Crass::Tokenizer::RE_HEX = T.let(T.unsafe(nil), Regexp)
613
+
614
+ # pkg:gem/crass#lib/crass/tokenizer.rb:14
615
+ Crass::Tokenizer::RE_NAME = T.let(T.unsafe(nil), Regexp)
616
+
617
+ # pkg:gem/crass#lib/crass/tokenizer.rb:15
618
+ Crass::Tokenizer::RE_NAME_START = T.let(T.unsafe(nil), Regexp)
619
+
620
+ # pkg:gem/crass#lib/crass/tokenizer.rb:16
621
+ Crass::Tokenizer::RE_NON_PRINTABLE = T.let(T.unsafe(nil), Regexp)
622
+
623
+ # pkg:gem/crass#lib/crass/tokenizer.rb:17
624
+ Crass::Tokenizer::RE_NUMBER_DECIMAL = T.let(T.unsafe(nil), Regexp)
625
+
626
+ # pkg:gem/crass#lib/crass/tokenizer.rb:18
627
+ Crass::Tokenizer::RE_NUMBER_EXPONENT = T.let(T.unsafe(nil), Regexp)
628
+
629
+ # pkg:gem/crass#lib/crass/tokenizer.rb:19
630
+ Crass::Tokenizer::RE_NUMBER_SIGN = T.let(T.unsafe(nil), Regexp)
631
+
632
+ # pkg:gem/crass#lib/crass/tokenizer.rb:21
633
+ Crass::Tokenizer::RE_NUMBER_STR = T.let(T.unsafe(nil), Regexp)
634
+
635
+ # pkg:gem/crass#lib/crass/tokenizer.rb:33
636
+ Crass::Tokenizer::RE_QUOTED_URL_START = T.let(T.unsafe(nil), Regexp)
637
+
638
+ # pkg:gem/crass#lib/crass/tokenizer.rb:35
639
+ Crass::Tokenizer::RE_UNICODE_RANGE_END = T.let(T.unsafe(nil), Regexp)
640
+
641
+ # pkg:gem/crass#lib/crass/tokenizer.rb:34
642
+ Crass::Tokenizer::RE_UNICODE_RANGE_START = T.let(T.unsafe(nil), Regexp)
643
+
644
+ # pkg:gem/crass#lib/crass/tokenizer.rb:36
645
+ Crass::Tokenizer::RE_WHITESPACE = T.let(T.unsafe(nil), Regexp)
646
+
647
+ # pkg:gem/crass#lib/crass/tokenizer.rb:37
648
+ Crass::Tokenizer::RE_WHITESPACE_ANCHORED = T.let(T.unsafe(nil), Regexp)