poetry-core 0.0.2
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 +7 -0
- data/CHANGELOG.md +3 -0
- data/DESIGN.md +145 -0
- data/LICENSE.txt +21 -0
- data/README.md +30 -0
- data/THIRD_PARTY_NOTICES.md +507 -0
- data/app/components/poetry/core/box/component.rb +82 -0
- data/app/components/poetry/core/component.rb +390 -0
- data/app/components/poetry/core/concerns/agent_tools.rb +418 -0
- data/app/components/poetry/core/concerns/declared_attributes.rb +267 -0
- data/app/components/poetry/core/concerns/introspection.rb +533 -0
- data/app/components/poetry/core/concerns/options.rb +262 -0
- data/app/components/poetry/core/concerns/parts.rb +148 -0
- data/app/components/poetry/core/concerns/stimulus.rb +363 -0
- data/app/components/poetry/core/concerns/styles.rb +323 -0
- data/app/components/poetry/core/style.rb +150 -0
- data/app/components/poetry/core/wrapper/component.rb +90 -0
- data/app/javascript/poetry/core/accordion_controller.js +165 -0
- data/app/javascript/poetry/core/action_bar_controller.js +109 -0
- data/app/javascript/poetry/core/autocomplete_controller.js +220 -0
- data/app/javascript/poetry/core/calendar_controller.js +406 -0
- data/app/javascript/poetry/core/carousel_controller.js +167 -0
- data/app/javascript/poetry/core/checkbox_group_controller.js +97 -0
- data/app/javascript/poetry/core/checked_controller.js +208 -0
- data/app/javascript/poetry/core/clipboard_text_controller.js +111 -0
- data/app/javascript/poetry/core/combobox_controller.js +1095 -0
- data/app/javascript/poetry/core/command_controller.js +510 -0
- data/app/javascript/poetry/core/context_menu_controller.js +204 -0
- data/app/javascript/poetry/core/date_field_controller.js +584 -0
- data/app/javascript/poetry/core/date_picker_controller.js +111 -0
- data/app/javascript/poetry/core/deferred_controller.js +111 -0
- data/app/javascript/poetry/core/dialog_controller.js +206 -0
- data/app/javascript/poetry/core/dismissable_controller.js +182 -0
- data/app/javascript/poetry/core/drawer_controller.js +365 -0
- data/app/javascript/poetry/core/file_input_controller.js +191 -0
- data/app/javascript/poetry/core/focus_scope_controller.js +162 -0
- data/app/javascript/poetry/core/helpers/announce.js +228 -0
- data/app/javascript/poetry/core/helpers/breakpoint.js +28 -0
- data/app/javascript/poetry/core/helpers/collection.js +18 -0
- data/app/javascript/poetry/core/helpers/direction.js +15 -0
- data/app/javascript/poetry/core/helpers/escape.js +38 -0
- data/app/javascript/poetry/core/helpers/filter_rank.js +104 -0
- data/app/javascript/poetry/core/helpers/focus_guards.js +46 -0
- data/app/javascript/poetry/core/helpers/hotkey.js +43 -0
- data/app/javascript/poetry/core/helpers/id_integrity.js +65 -0
- data/app/javascript/poetry/core/helpers/incomplete_date.js +328 -0
- data/app/javascript/poetry/core/helpers/mask.js +283 -0
- data/app/javascript/poetry/core/helpers/portal.js +217 -0
- data/app/javascript/poetry/core/helpers/presence.js +210 -0
- data/app/javascript/poetry/core/helpers/registration_guard.js +76 -0
- data/app/javascript/poetry/core/helpers/scroll_lock.js +67 -0
- data/app/javascript/poetry/core/helpers/scroller_geometry.js +422 -0
- data/app/javascript/poetry/core/helpers/state.js +80 -0
- data/app/javascript/poetry/core/helpers/tabbable.js +56 -0
- data/app/javascript/poetry/core/helpers/turbo_cache.js +21 -0
- data/app/javascript/poetry/core/helpers/typeahead.js +85 -0
- data/app/javascript/poetry/core/hotkey_controller.js +55 -0
- data/app/javascript/poetry/core/hover_card_controller.js +431 -0
- data/app/javascript/poetry/core/index.js +218 -0
- data/app/javascript/poetry/core/mask_controller.js +500 -0
- data/app/javascript/poetry/core/menu_controller.js +1050 -0
- data/app/javascript/poetry/core/menubar_controller.js +329 -0
- data/app/javascript/poetry/core/message_scroller_controller.js +930 -0
- data/app/javascript/poetry/core/navigation_menu_controller.js +458 -0
- data/app/javascript/poetry/core/number_field_controller.js +404 -0
- data/app/javascript/poetry/core/optimistic_form_controller.js +56 -0
- data/app/javascript/poetry/core/otp_controller.js +219 -0
- data/app/javascript/poetry/core/popover_controller.js +300 -0
- data/app/javascript/poetry/core/popper_controller.js +439 -0
- data/app/javascript/poetry/core/pressed_controller.js +74 -0
- data/app/javascript/poetry/core/questionnaire_controller.js +468 -0
- data/app/javascript/poetry/core/radio_group_controller.js +197 -0
- data/app/javascript/poetry/core/resizable_controller.js +202 -0
- data/app/javascript/poetry/core/roving_focus_controller.js +215 -0
- data/app/javascript/poetry/core/scroll_spy_controller.js +84 -0
- data/app/javascript/poetry/core/search_field_controller.js +95 -0
- data/app/javascript/poetry/core/select_controller.js +924 -0
- data/app/javascript/poetry/core/sensitive_input_controller.js +195 -0
- data/app/javascript/poetry/core/sheet_controller.js +24 -0
- data/app/javascript/poetry/core/sidebar_controller.js +272 -0
- data/app/javascript/poetry/core/slider_controller.js +419 -0
- data/app/javascript/poetry/core/state_controller.js +82 -0
- data/app/javascript/poetry/core/table_selection_controller.js +153 -0
- data/app/javascript/poetry/core/tabs_controller.js +151 -0
- data/app/javascript/poetry/core/tag_group_controller.js +134 -0
- data/app/javascript/poetry/core/toast_controller.js +228 -0
- data/app/javascript/poetry/core/toast_trigger_controller.js +26 -0
- data/app/javascript/poetry/core/toaster_controller.js +197 -0
- data/app/javascript/poetry/core/toggle_group_controller.js +206 -0
- data/app/javascript/poetry/core/tooltip_controller.js +541 -0
- data/app/javascript/poetry/core/tree_controller.js +265 -0
- data/app/javascript/poetry/core/vendor/floating_ui_core.js +1043 -0
- data/app/javascript/poetry/core/vendor/floating_ui_dom.js +794 -0
- data/app/javascript/poetry/core/vendor/floating_ui_utils.js +141 -0
- data/app/javascript/poetry/core/vendor/floating_ui_utils_dom.js +170 -0
- data/app/views/poetry/core/preview.html.erb +13 -0
- data/config/component_registry.yml +20 -0
- data/config/controllers_manifest.json +1528 -0
- data/config/importmap.rb +11 -0
- data/config/state_vocabulary.json +31 -0
- data/lib/active_model/type/list.rb +33 -0
- data/lib/active_model/type/symbol.rb +36 -0
- data/lib/poetry/core/check/stable_identity.rb +104 -0
- data/lib/poetry/core/check.rb +1445 -0
- data/lib/poetry/core/config.rb +286 -0
- data/lib/poetry/core/contrib/wrapped_helper.rb +68 -0
- data/lib/poetry/core/css/bem_merger.rb +45 -0
- data/lib/poetry/core/css/bem_reference.rb +87 -0
- data/lib/poetry/core/css/override_scan.rb +110 -0
- data/lib/poetry/core/css/resolver.rb +161 -0
- data/lib/poetry/core/css/safelist.rb +41 -0
- data/lib/poetry/core/css/tailwind_merger.rb +102 -0
- data/lib/poetry/core/css/template_classes.rb +102 -0
- data/lib/poetry/core/css/theme_coverage.rb +72 -0
- data/lib/poetry/core/css/var_coverage.rb +75 -0
- data/lib/poetry/core/css/verifier.rb +106 -0
- data/lib/poetry/core/design_lint.rb +720 -0
- data/lib/poetry/core/design_md/import.rb +250 -0
- data/lib/poetry/core/design_md.rb +461 -0
- data/lib/poetry/core/engine.rb +71 -0
- data/lib/poetry/core/errors.rb +53 -0
- data/lib/poetry/core/html/attributes.rb +667 -0
- data/lib/poetry/core/icons.rb +157 -0
- data/lib/poetry/core/llms_text.rb +354 -0
- data/lib/poetry/core/page_architectures.rb +304 -0
- data/lib/poetry/core/part_contract.rb +285 -0
- data/lib/poetry/core/preview/abstract.rb +121 -0
- data/lib/poetry/core/preview/base.rb +227 -0
- data/lib/poetry/core/preview/sidecarable.rb +136 -0
- data/lib/poetry/core/preview/template.rb +186 -0
- data/lib/poetry/core/recipe_items.rb +82 -0
- data/lib/poetry/core/registry.rb +363 -0
- data/lib/poetry/core/registry_address.rb +115 -0
- data/lib/poetry/core/registry_client.rb +217 -0
- data/lib/poetry/core/registry_installer.rb +234 -0
- data/lib/poetry/core/registry_items.rb +184 -0
- data/lib/poetry/core/skill_text.rb +288 -0
- data/lib/poetry/core/stable_id.rb +110 -0
- data/lib/poetry/core/stimulus/builder.rb +395 -0
- data/lib/poetry/core/stimulus/declarations.rb +444 -0
- data/lib/poetry/core/stimulus/manifest.rb +68 -0
- data/lib/poetry/core/stimulus/merger.rb +131 -0
- data/lib/poetry/core/stimulus_contract.rb +263 -0
- data/lib/poetry/core/tag_helper.rb +10 -0
- data/lib/poetry/core/template_compile.rb +74 -0
- data/lib/poetry/core/token_import.rb +317 -0
- data/lib/poetry/core/tokens/color.rb +215 -0
- data/lib/poetry/core/tokens/contrast_gate.rb +120 -0
- data/lib/poetry/core/tokens/generator.rb +211 -0
- data/lib/poetry/core/tokens.rb +117 -0
- data/lib/poetry/core/version.rb +9 -0
- data/lib/poetry/core.rb +52 -0
- data/lib/poetry-core.rb +5 -0
- data/tokens/aliases.css +145 -0
- data/tokens/tailwind-theme.css +47 -0
- data/tokens/tokens.css +78 -0
- data/tokens/tokens.dtcg.json +779 -0
- data/vendor/floating-ui/LICENSE +20 -0
- data/vendor/floating-ui/VENDORED_VERSIONS +15 -0
- data/vendor/shadcn-tailwind/LICENSE +21 -0
- data/vendor/shadcn-tailwind/VENDORED_COMMIT +1 -0
- data/vendor/shadcn-tailwind/tailwind.css +629 -0
- data/vendor/tw-animate-css/LICENSE +21 -0
- data/vendor/tw-animate-css/VENDORED_VERSION +1 -0
- data/vendor/tw-animate-css/tw-animate.css +1 -0
- metadata +267 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
# Third-party notices - poetry-core
|
|
2
|
+
|
|
3
|
+
poetry-core adapts or vendors code from the permissively licensed
|
|
4
|
+
projects below (MIT unless an entry says otherwise). Vendored assets keep their license text next to the code
|
|
5
|
+
(`vendor/floating-ui/`, `vendor/shadcn-tailwind/LICENSE`,
|
|
6
|
+
`vendor/tw-animate-css/LICENSE`); the license texts for adapted files
|
|
7
|
+
are reproduced here.
|
|
8
|
+
|
|
9
|
+
## shadcn/ui
|
|
10
|
+
|
|
11
|
+
- Source: https://github.com/shadcn-ui/ui (MIT)
|
|
12
|
+
- Vendored: vendor/shadcn-tailwind/tailwind.css (the bridge variants from packages/shadcn/src/tailwind.css, at the commit in vendor/shadcn-tailwind/VENDORED_COMMIT; license beside it)
|
|
13
|
+
- Adapted: tokens/tokens.dtcg.json (the semantic role token set follows shadcn/ui v4's neutral theme variables, with the AA contrast deltas noted inline), tokens/aliases.css (the Radix-namespaced content variable names the source's class strings read); lib/poetry/core/registry_items.rb targets the shadcn registry-item JSON schema; app/javascript/poetry/core/message_scroller_controller.js and app/javascript/poetry/core/helpers/scroller_geometry.js (the message-scroller state machine and its geometry module, ported); app/javascript/poetry/core/questionnaire_controller.js (the questionnaire primitive, ported)
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
MIT License
|
|
17
|
+
|
|
18
|
+
Copyright (c) 2023 shadcn
|
|
19
|
+
|
|
20
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
21
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
22
|
+
in the Software without restriction, including without limitation the rights
|
|
23
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
24
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
25
|
+
furnished to do so, subject to the following conditions:
|
|
26
|
+
|
|
27
|
+
The above copyright notice and this permission notice shall be included in all
|
|
28
|
+
copies or substantial portions of the Software.
|
|
29
|
+
|
|
30
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
31
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
32
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
33
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
34
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
35
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
36
|
+
SOFTWARE.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## fox_tail
|
|
40
|
+
|
|
41
|
+
- Source: https://github.com/jefawks3/fox_tail (MIT)
|
|
42
|
+
- Adapted: lib/poetry/core/css/merger.rb, lib/poetry/core/html/attributes.rb, lib/poetry/core/stimulus/builder.rb, lib/poetry/core/stimulus/merger.rb
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Copyright 2023 James Fawks
|
|
46
|
+
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of this software and associated documentation files (the
|
|
49
|
+
"Software"), to deal in the Software without restriction, including
|
|
50
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
51
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
52
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
53
|
+
the following conditions:
|
|
54
|
+
|
|
55
|
+
The above copyright notice and this permission notice shall be
|
|
56
|
+
included in all copies or substantial portions of the Software.
|
|
57
|
+
|
|
58
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
59
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
60
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
61
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
62
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
63
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
64
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## view_component-contrib
|
|
68
|
+
|
|
69
|
+
- Source: https://github.com/palkan/view_component-contrib (MIT)
|
|
70
|
+
- Adapted: lib/poetry/core/preview/{abstract,base,template,sidecarable}.rb, lib/poetry/core/contrib/wrapped_helper.rb, app/components/poetry/core/wrapper/component.rb
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
Copyright (c) 2021 Vladimir Dementyev
|
|
74
|
+
|
|
75
|
+
MIT License
|
|
76
|
+
|
|
77
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
78
|
+
a copy of this software and associated documentation files (the
|
|
79
|
+
"Software"), to deal in the Software without restriction, including
|
|
80
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
81
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
82
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
83
|
+
the following conditions:
|
|
84
|
+
|
|
85
|
+
The above copyright notice and this permission notice shall be
|
|
86
|
+
included in all copies or substantial portions of the Software.
|
|
87
|
+
|
|
88
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
89
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
90
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
91
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
92
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
93
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
94
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## kumo
|
|
98
|
+
|
|
99
|
+
- Source: https://github.com/cloudflare/kumo (MIT)
|
|
100
|
+
- Adapted: app/javascript/poetry/core/clipboard_text_controller.js, app/javascript/poetry/core/sensitive_input_controller.js
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
MIT License Copyright (c) 2026 Cloudflare, Inc.
|
|
104
|
+
|
|
105
|
+
Permission is hereby granted, free of
|
|
106
|
+
charge, to any person obtaining a copy of this software and associated
|
|
107
|
+
documentation files (the "Software"), to deal in the Software without
|
|
108
|
+
restriction, including without limitation the rights to use, copy, modify, merge,
|
|
109
|
+
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
110
|
+
permit persons to whom the Software is furnished to do so, subject to the
|
|
111
|
+
following conditions:
|
|
112
|
+
|
|
113
|
+
The above copyright notice and this permission notice
|
|
114
|
+
(including the next paragraph) shall be included in all copies or substantial
|
|
115
|
+
portions of the Software.
|
|
116
|
+
|
|
117
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
118
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
119
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
120
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
121
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
122
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
123
|
+
THE SOFTWARE.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## hotwire_club-toolbox
|
|
127
|
+
|
|
128
|
+
- Source: https://github.com/TheHotwireClub/hotwire_club-toolbox (MIT)
|
|
129
|
+
- Adapted: app/javascript/poetry/core/optimistic_form_controller.js
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
Copyright Julian Rubisch
|
|
133
|
+
|
|
134
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
135
|
+
a copy of this software and associated documentation files (the
|
|
136
|
+
"Software"), to deal in the Software without restriction, including
|
|
137
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
138
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
139
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
140
|
+
the following conditions:
|
|
141
|
+
|
|
142
|
+
The above copyright notice and this permission notice shall be
|
|
143
|
+
included in all copies or substantial portions of the Software.
|
|
144
|
+
|
|
145
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
146
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
147
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
148
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
149
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
150
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
151
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Base UI
|
|
155
|
+
|
|
156
|
+
- Source: https://github.com/mui/base-ui (MIT)
|
|
157
|
+
- Behavior contracts translated into the Stimulus controllers under app/javascript/poetry/core/ (documented per component)
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
MIT License
|
|
161
|
+
|
|
162
|
+
Copyright (c) 2019 Material-UI SAS
|
|
163
|
+
|
|
164
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
165
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
166
|
+
in the Software without restriction, including without limitation the rights
|
|
167
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
168
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
169
|
+
furnished to do so, subject to the following conditions:
|
|
170
|
+
|
|
171
|
+
The above copyright notice and this permission notice shall be included in all
|
|
172
|
+
copies or substantial portions of the Software.
|
|
173
|
+
|
|
174
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
175
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
176
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
177
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
178
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
179
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
180
|
+
SOFTWARE.
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Mantine (use-mask)
|
|
184
|
+
|
|
185
|
+
- Source: https://github.com/mantinedev/mantine (MIT)
|
|
186
|
+
- Adapted: app/javascript/poetry/core/helpers/mask.js, app/javascript/poetry/core/mask_controller.js (the input-mask engine and controller, ported from the use-mask hook)
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
MIT License
|
|
190
|
+
|
|
191
|
+
Copyright (c) 2021 Vitaly Rtishchev
|
|
192
|
+
|
|
193
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
194
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
195
|
+
in the Software without restriction, including without limitation the rights
|
|
196
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
197
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
198
|
+
furnished to do so, subject to the following conditions:
|
|
199
|
+
|
|
200
|
+
The above copyright notice and this permission notice shall be included in all
|
|
201
|
+
copies or substantial portions of the Software.
|
|
202
|
+
|
|
203
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
204
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
205
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
206
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
207
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
208
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
209
|
+
SOFTWARE.
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## react-day-picker
|
|
213
|
+
|
|
214
|
+
- Source: https://github.com/gpbl/react-day-picker (MIT)
|
|
215
|
+
- Adapted: app/javascript/poetry/core/calendar_controller.js (the addToRange range-selection algorithm, transcribed)
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
The MIT License (MIT)
|
|
219
|
+
|
|
220
|
+
Copyright (c) 2014-2026 Giampaolo Bellavite <io@gpbl.dev> and contributors
|
|
221
|
+
|
|
222
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
223
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
224
|
+
in the Software without restriction, including without limitation the rights
|
|
225
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
226
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
227
|
+
furnished to do so, subject to the following conditions:
|
|
228
|
+
|
|
229
|
+
The above copyright notice and this permission notice shall be included in all
|
|
230
|
+
copies or substantial portions of the Software.
|
|
231
|
+
|
|
232
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
233
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
234
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
235
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
236
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
237
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
238
|
+
SOFTWARE.
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Radix Primitives
|
|
242
|
+
|
|
243
|
+
- Source: https://github.com/radix-ui/primitives (MIT)
|
|
244
|
+
- Adapted: app/javascript/poetry/core/hover_card_controller.js (the containSelection/hasSelection text-selection hold)
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
MIT License
|
|
248
|
+
|
|
249
|
+
Copyright (c) 2022 WorkOS
|
|
250
|
+
|
|
251
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
252
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
253
|
+
in the Software without restriction, including without limitation the rights
|
|
254
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
255
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
256
|
+
furnished to do so, subject to the following conditions:
|
|
257
|
+
|
|
258
|
+
The above copyright notice and this permission notice shall be included in all
|
|
259
|
+
copies or substantial portions of the Software.
|
|
260
|
+
|
|
261
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
262
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
263
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
264
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
265
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
266
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
267
|
+
SOFTWARE.
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## React Spectrum (react-aria)
|
|
271
|
+
|
|
272
|
+
- Source: https://github.com/adobe/react-spectrum (Apache-2.0)
|
|
273
|
+
- Adapted: app/javascript/poetry/core/helpers/incomplete_date.js (the IncompleteDate nullable-segment value model and the DateFormatter hour-cycle Intl bug detections)
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
Apache License
|
|
277
|
+
Version 2.0, January 2004
|
|
278
|
+
http://www.apache.org/licenses/
|
|
279
|
+
|
|
280
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
281
|
+
|
|
282
|
+
1. Definitions.
|
|
283
|
+
|
|
284
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
285
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
286
|
+
|
|
287
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
288
|
+
the copyright owner that is granting the License.
|
|
289
|
+
|
|
290
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
291
|
+
other entities that control, are controlled by, or are under common
|
|
292
|
+
control with that entity. For the purposes of this definition,
|
|
293
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
294
|
+
direction or management of such entity, whether by contract or
|
|
295
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
296
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
297
|
+
|
|
298
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
299
|
+
exercising permissions granted by this License.
|
|
300
|
+
|
|
301
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
302
|
+
including but not limited to software source code, documentation
|
|
303
|
+
source, and configuration files.
|
|
304
|
+
|
|
305
|
+
"Object" form shall mean any form resulting from mechanical
|
|
306
|
+
transformation or translation of a Source form, including but
|
|
307
|
+
not limited to compiled object code, generated documentation,
|
|
308
|
+
and conversions to other media types.
|
|
309
|
+
|
|
310
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
311
|
+
Object form, made available under the License, as indicated by a
|
|
312
|
+
copyright notice that is included in or attached to the work
|
|
313
|
+
(an example is provided in the Appendix below).
|
|
314
|
+
|
|
315
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
316
|
+
form, that is based on (or derived from) the Work and for which the
|
|
317
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
318
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
319
|
+
of this License, Derivative Works shall not include works that remain
|
|
320
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
321
|
+
the Work and Derivative Works thereof.
|
|
322
|
+
|
|
323
|
+
"Contribution" shall mean any work of authorship, including
|
|
324
|
+
the original version of the Work and any modifications or additions
|
|
325
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
326
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
327
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
328
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
329
|
+
means any form of electronic, verbal, or written communication sent
|
|
330
|
+
to the Licensor or its representatives, including but not limited to
|
|
331
|
+
communication on electronic mailing lists, source code control systems,
|
|
332
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
333
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
334
|
+
excluding communication that is conspicuously marked or otherwise
|
|
335
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
336
|
+
|
|
337
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
338
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
339
|
+
subsequently incorporated within the Work.
|
|
340
|
+
|
|
341
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
342
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
343
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
344
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
345
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
346
|
+
Work and such Derivative Works in Source or Object form.
|
|
347
|
+
|
|
348
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
349
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
350
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
351
|
+
(except as stated in this section) patent license to make, have made,
|
|
352
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
353
|
+
where such license applies only to those patent claims licensable
|
|
354
|
+
by such Contributor that are necessarily infringed by their
|
|
355
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
356
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
357
|
+
institute patent litigation against any entity (including a
|
|
358
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
359
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
360
|
+
or contributory patent infringement, then any patent licenses
|
|
361
|
+
granted to You under this License for that Work shall terminate
|
|
362
|
+
as of the date such litigation is filed.
|
|
363
|
+
|
|
364
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
365
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
366
|
+
modifications, and in Source or Object form, provided that You
|
|
367
|
+
meet the following conditions:
|
|
368
|
+
|
|
369
|
+
(a) You must give any other recipients of the Work or
|
|
370
|
+
Derivative Works a copy of this License; and
|
|
371
|
+
|
|
372
|
+
(b) You must cause any modified files to carry prominent notices
|
|
373
|
+
stating that You changed the files; and
|
|
374
|
+
|
|
375
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
376
|
+
that You distribute, all copyright, patent, trademark, and
|
|
377
|
+
attribution notices from the Source form of the Work,
|
|
378
|
+
excluding those notices that do not pertain to any part of
|
|
379
|
+
the Derivative Works; and
|
|
380
|
+
|
|
381
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
382
|
+
distribution, then any Derivative Works that You distribute must
|
|
383
|
+
include a readable copy of the attribution notices contained
|
|
384
|
+
within such NOTICE file, excluding those notices that do not
|
|
385
|
+
pertain to any part of the Derivative Works, in at least one
|
|
386
|
+
of the following places: within a NOTICE text file distributed
|
|
387
|
+
as part of the Derivative Works; within the Source form or
|
|
388
|
+
documentation, if provided along with the Derivative Works; or,
|
|
389
|
+
within a display generated by the Derivative Works, if and
|
|
390
|
+
wherever such third-party notices normally appear. The contents
|
|
391
|
+
of the NOTICE file are for informational purposes only and
|
|
392
|
+
do not modify the License. You may add Your own attribution
|
|
393
|
+
notices within Derivative Works that You distribute, alongside
|
|
394
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
395
|
+
that such additional attribution notices cannot be construed
|
|
396
|
+
as modifying the License.
|
|
397
|
+
|
|
398
|
+
You may add Your own copyright statement to Your modifications and
|
|
399
|
+
may provide additional or different license terms and conditions
|
|
400
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
401
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
402
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
403
|
+
the conditions stated in this License.
|
|
404
|
+
|
|
405
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
406
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
407
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
408
|
+
this License, without any additional terms or conditions.
|
|
409
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
410
|
+
the terms of any separate license agreement you may have executed
|
|
411
|
+
with Licensor regarding such Contributions.
|
|
412
|
+
|
|
413
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
414
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
415
|
+
except as required for reasonable and customary use in describing the
|
|
416
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
417
|
+
|
|
418
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
419
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
420
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
421
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
422
|
+
implied, including, without limitation, any warranties or conditions
|
|
423
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
424
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
425
|
+
appropriateness of using or redistributing the Work and assume any
|
|
426
|
+
risks associated with Your exercise of permissions under this License.
|
|
427
|
+
|
|
428
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
429
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
430
|
+
unless required by applicable law (such as deliberate and grossly
|
|
431
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
432
|
+
liable to You for damages, including any direct, indirect, special,
|
|
433
|
+
incidental, or consequential damages of any character arising as a
|
|
434
|
+
result of this License or out of the use or inability to use the
|
|
435
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
436
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
437
|
+
other commercial damages or losses), even if such Contributor
|
|
438
|
+
has been advised of the possibility of such damages.
|
|
439
|
+
|
|
440
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
441
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
442
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
443
|
+
or other liability obligations and/or rights consistent with this
|
|
444
|
+
License. However, in accepting such obligations, You may act only
|
|
445
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
446
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
447
|
+
defend, and hold each Contributor harmless for any liability
|
|
448
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
449
|
+
of your accepting any such warranty or additional liability.
|
|
450
|
+
|
|
451
|
+
END OF TERMS AND CONDITIONS
|
|
452
|
+
|
|
453
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
454
|
+
|
|
455
|
+
To apply the Apache License to your work, attach the following
|
|
456
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
457
|
+
replaced with your own identifying information. (Don't include
|
|
458
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
459
|
+
comment syntax for the file format. We also recommend that a
|
|
460
|
+
file or class name and description of purpose be included on the
|
|
461
|
+
same "printed page" as the copyright notice for easier
|
|
462
|
+
identification within third-party archives.
|
|
463
|
+
|
|
464
|
+
Copyright 2019 Adobe
|
|
465
|
+
|
|
466
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
467
|
+
you may not use this file except in compliance with the License.
|
|
468
|
+
You may obtain a copy of the License at
|
|
469
|
+
|
|
470
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
471
|
+
|
|
472
|
+
Unless required by applicable law or agreed to in writing, software
|
|
473
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
474
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
475
|
+
See the License for the specific language governing permissions and
|
|
476
|
+
limitations under the License.
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
## heroicons-rails
|
|
480
|
+
|
|
481
|
+
- Source: https://github.com/lab2023/heroicons-rails (MIT)
|
|
482
|
+
- Adapted: lib/poetry/core/errors.rb (the IconNotFound error class)
|
|
483
|
+
|
|
484
|
+
```
|
|
485
|
+
Copyright © 2013-2024 lab2023 - information technologies
|
|
486
|
+
|
|
487
|
+
MIT License
|
|
488
|
+
|
|
489
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
490
|
+
a copy of this software and associated documentation files (the
|
|
491
|
+
"Software"), to deal in the Software without restriction, including
|
|
492
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
493
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
494
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
495
|
+
the following conditions:
|
|
496
|
+
|
|
497
|
+
The above copyright notice and this permission notice shall be
|
|
498
|
+
included in all copies or substantial portions of the Software.
|
|
499
|
+
|
|
500
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
501
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
502
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
503
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
504
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
505
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
506
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
507
|
+
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Poetry
|
|
4
|
+
module Core
|
|
5
|
+
# Namespace of the Box primitive.
|
|
6
|
+
module Box
|
|
7
|
+
# The polymorphic-tag primitive: one element, any tag, the full
|
|
8
|
+
# poetry attribute machinery. Box exists for the bare styled
|
|
9
|
+
# element a real component would be too much for - a spacer, a
|
|
10
|
+
# semantic wrapper, a grid cell - while keeping the class merger,
|
|
11
|
+
# Stimulus `data:` merging, and self-identification that a raw
|
|
12
|
+
# `content_tag` skips. Void elements (`br`, `hr`, `img`, ...)
|
|
13
|
+
# self-close and take no content block.
|
|
14
|
+
#
|
|
15
|
+
# @example A semantic wrapper
|
|
16
|
+
# render Poetry::Core::Box::Component.new(html_tag: "section", class: "grid gap-4") do
|
|
17
|
+
# "content"
|
|
18
|
+
# end
|
|
19
|
+
#
|
|
20
|
+
# @example A void element
|
|
21
|
+
# render Poetry::Core::Box::Component.new(html_tag: "hr", class: "my-6")
|
|
22
|
+
class Component < Poetry::Core::Component
|
|
23
|
+
# The HTML void elements: they emit a self-closing tag and take
|
|
24
|
+
# no content block.
|
|
25
|
+
VOID_TAGS = %w[
|
|
26
|
+
area base br col embed hr img input link meta param source track wbr
|
|
27
|
+
].freeze
|
|
28
|
+
|
|
29
|
+
# Tag names: letters, digits, and dashes (custom elements),
|
|
30
|
+
# starting with a letter.
|
|
31
|
+
TAG_NAME = /\A[a-z][a-z0-9-]*\z/i
|
|
32
|
+
|
|
33
|
+
option :html_tag, :string, default: "div",
|
|
34
|
+
doc: "The element to render ('div', 'section', 'span', ...); void elements " \
|
|
35
|
+
"(br, hr, img, ...) self-close and take no content block."
|
|
36
|
+
|
|
37
|
+
part "box", "The rendered element itself - the whole component is one part"
|
|
38
|
+
|
|
39
|
+
# Enforces the tag-name contract with teaching messages.
|
|
40
|
+
# @api private
|
|
41
|
+
def before_render
|
|
42
|
+
raise ArgumentError, "Box requires html_tag: (the element to render)" if html_tag.blank?
|
|
43
|
+
raise ArgumentError, "Box html_tag: #{html_tag.inspect} is not a tag name" unless html_tag.match?(TAG_NAME)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Emits the chosen tag: self-closing for void elements, wrapping
|
|
47
|
+
# the content block otherwise. A void element with a content
|
|
48
|
+
# block raises - the content would be silently unrenderable.
|
|
49
|
+
#
|
|
50
|
+
# @return [ActiveSupport::SafeBuffer]
|
|
51
|
+
def call
|
|
52
|
+
if void?
|
|
53
|
+
raise ArgumentError, "Box html_tag: #{html_tag} is a void element - it takes no content block" if content?
|
|
54
|
+
|
|
55
|
+
tag(html_tag, box_attributes.to_attributes)
|
|
56
|
+
else
|
|
57
|
+
content_tag(html_tag, content, **box_attributes.to_attributes)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# The element's attributes: caller HTML attributes (class merged,
|
|
62
|
+
# Stimulus keys concatenated) over the self-identification pair.
|
|
63
|
+
#
|
|
64
|
+
# @return [Poetry::Core::HTML::Attributes]
|
|
65
|
+
def box_attributes
|
|
66
|
+
html_attributes.merge_if_not_set(
|
|
67
|
+
{ "data-slot" => "box" }.merge(component_data_attributes)
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
private
|
|
72
|
+
|
|
73
|
+
# Whether the chosen tag is a void element.
|
|
74
|
+
def void?
|
|
75
|
+
VOID_TAGS.include?(html_tag.to_s.downcase)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
private :box_attributes
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|