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.
Files changed (166) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/DESIGN.md +145 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +30 -0
  6. data/THIRD_PARTY_NOTICES.md +507 -0
  7. data/app/components/poetry/core/box/component.rb +82 -0
  8. data/app/components/poetry/core/component.rb +390 -0
  9. data/app/components/poetry/core/concerns/agent_tools.rb +418 -0
  10. data/app/components/poetry/core/concerns/declared_attributes.rb +267 -0
  11. data/app/components/poetry/core/concerns/introspection.rb +533 -0
  12. data/app/components/poetry/core/concerns/options.rb +262 -0
  13. data/app/components/poetry/core/concerns/parts.rb +148 -0
  14. data/app/components/poetry/core/concerns/stimulus.rb +363 -0
  15. data/app/components/poetry/core/concerns/styles.rb +323 -0
  16. data/app/components/poetry/core/style.rb +150 -0
  17. data/app/components/poetry/core/wrapper/component.rb +90 -0
  18. data/app/javascript/poetry/core/accordion_controller.js +165 -0
  19. data/app/javascript/poetry/core/action_bar_controller.js +109 -0
  20. data/app/javascript/poetry/core/autocomplete_controller.js +220 -0
  21. data/app/javascript/poetry/core/calendar_controller.js +406 -0
  22. data/app/javascript/poetry/core/carousel_controller.js +167 -0
  23. data/app/javascript/poetry/core/checkbox_group_controller.js +97 -0
  24. data/app/javascript/poetry/core/checked_controller.js +208 -0
  25. data/app/javascript/poetry/core/clipboard_text_controller.js +111 -0
  26. data/app/javascript/poetry/core/combobox_controller.js +1095 -0
  27. data/app/javascript/poetry/core/command_controller.js +510 -0
  28. data/app/javascript/poetry/core/context_menu_controller.js +204 -0
  29. data/app/javascript/poetry/core/date_field_controller.js +584 -0
  30. data/app/javascript/poetry/core/date_picker_controller.js +111 -0
  31. data/app/javascript/poetry/core/deferred_controller.js +111 -0
  32. data/app/javascript/poetry/core/dialog_controller.js +206 -0
  33. data/app/javascript/poetry/core/dismissable_controller.js +182 -0
  34. data/app/javascript/poetry/core/drawer_controller.js +365 -0
  35. data/app/javascript/poetry/core/file_input_controller.js +191 -0
  36. data/app/javascript/poetry/core/focus_scope_controller.js +162 -0
  37. data/app/javascript/poetry/core/helpers/announce.js +228 -0
  38. data/app/javascript/poetry/core/helpers/breakpoint.js +28 -0
  39. data/app/javascript/poetry/core/helpers/collection.js +18 -0
  40. data/app/javascript/poetry/core/helpers/direction.js +15 -0
  41. data/app/javascript/poetry/core/helpers/escape.js +38 -0
  42. data/app/javascript/poetry/core/helpers/filter_rank.js +104 -0
  43. data/app/javascript/poetry/core/helpers/focus_guards.js +46 -0
  44. data/app/javascript/poetry/core/helpers/hotkey.js +43 -0
  45. data/app/javascript/poetry/core/helpers/id_integrity.js +65 -0
  46. data/app/javascript/poetry/core/helpers/incomplete_date.js +328 -0
  47. data/app/javascript/poetry/core/helpers/mask.js +283 -0
  48. data/app/javascript/poetry/core/helpers/portal.js +217 -0
  49. data/app/javascript/poetry/core/helpers/presence.js +210 -0
  50. data/app/javascript/poetry/core/helpers/registration_guard.js +76 -0
  51. data/app/javascript/poetry/core/helpers/scroll_lock.js +67 -0
  52. data/app/javascript/poetry/core/helpers/scroller_geometry.js +422 -0
  53. data/app/javascript/poetry/core/helpers/state.js +80 -0
  54. data/app/javascript/poetry/core/helpers/tabbable.js +56 -0
  55. data/app/javascript/poetry/core/helpers/turbo_cache.js +21 -0
  56. data/app/javascript/poetry/core/helpers/typeahead.js +85 -0
  57. data/app/javascript/poetry/core/hotkey_controller.js +55 -0
  58. data/app/javascript/poetry/core/hover_card_controller.js +431 -0
  59. data/app/javascript/poetry/core/index.js +218 -0
  60. data/app/javascript/poetry/core/mask_controller.js +500 -0
  61. data/app/javascript/poetry/core/menu_controller.js +1050 -0
  62. data/app/javascript/poetry/core/menubar_controller.js +329 -0
  63. data/app/javascript/poetry/core/message_scroller_controller.js +930 -0
  64. data/app/javascript/poetry/core/navigation_menu_controller.js +458 -0
  65. data/app/javascript/poetry/core/number_field_controller.js +404 -0
  66. data/app/javascript/poetry/core/optimistic_form_controller.js +56 -0
  67. data/app/javascript/poetry/core/otp_controller.js +219 -0
  68. data/app/javascript/poetry/core/popover_controller.js +300 -0
  69. data/app/javascript/poetry/core/popper_controller.js +439 -0
  70. data/app/javascript/poetry/core/pressed_controller.js +74 -0
  71. data/app/javascript/poetry/core/questionnaire_controller.js +468 -0
  72. data/app/javascript/poetry/core/radio_group_controller.js +197 -0
  73. data/app/javascript/poetry/core/resizable_controller.js +202 -0
  74. data/app/javascript/poetry/core/roving_focus_controller.js +215 -0
  75. data/app/javascript/poetry/core/scroll_spy_controller.js +84 -0
  76. data/app/javascript/poetry/core/search_field_controller.js +95 -0
  77. data/app/javascript/poetry/core/select_controller.js +924 -0
  78. data/app/javascript/poetry/core/sensitive_input_controller.js +195 -0
  79. data/app/javascript/poetry/core/sheet_controller.js +24 -0
  80. data/app/javascript/poetry/core/sidebar_controller.js +272 -0
  81. data/app/javascript/poetry/core/slider_controller.js +419 -0
  82. data/app/javascript/poetry/core/state_controller.js +82 -0
  83. data/app/javascript/poetry/core/table_selection_controller.js +153 -0
  84. data/app/javascript/poetry/core/tabs_controller.js +151 -0
  85. data/app/javascript/poetry/core/tag_group_controller.js +134 -0
  86. data/app/javascript/poetry/core/toast_controller.js +228 -0
  87. data/app/javascript/poetry/core/toast_trigger_controller.js +26 -0
  88. data/app/javascript/poetry/core/toaster_controller.js +197 -0
  89. data/app/javascript/poetry/core/toggle_group_controller.js +206 -0
  90. data/app/javascript/poetry/core/tooltip_controller.js +541 -0
  91. data/app/javascript/poetry/core/tree_controller.js +265 -0
  92. data/app/javascript/poetry/core/vendor/floating_ui_core.js +1043 -0
  93. data/app/javascript/poetry/core/vendor/floating_ui_dom.js +794 -0
  94. data/app/javascript/poetry/core/vendor/floating_ui_utils.js +141 -0
  95. data/app/javascript/poetry/core/vendor/floating_ui_utils_dom.js +170 -0
  96. data/app/views/poetry/core/preview.html.erb +13 -0
  97. data/config/component_registry.yml +20 -0
  98. data/config/controllers_manifest.json +1528 -0
  99. data/config/importmap.rb +11 -0
  100. data/config/state_vocabulary.json +31 -0
  101. data/lib/active_model/type/list.rb +33 -0
  102. data/lib/active_model/type/symbol.rb +36 -0
  103. data/lib/poetry/core/check/stable_identity.rb +104 -0
  104. data/lib/poetry/core/check.rb +1445 -0
  105. data/lib/poetry/core/config.rb +286 -0
  106. data/lib/poetry/core/contrib/wrapped_helper.rb +68 -0
  107. data/lib/poetry/core/css/bem_merger.rb +45 -0
  108. data/lib/poetry/core/css/bem_reference.rb +87 -0
  109. data/lib/poetry/core/css/override_scan.rb +110 -0
  110. data/lib/poetry/core/css/resolver.rb +161 -0
  111. data/lib/poetry/core/css/safelist.rb +41 -0
  112. data/lib/poetry/core/css/tailwind_merger.rb +102 -0
  113. data/lib/poetry/core/css/template_classes.rb +102 -0
  114. data/lib/poetry/core/css/theme_coverage.rb +72 -0
  115. data/lib/poetry/core/css/var_coverage.rb +75 -0
  116. data/lib/poetry/core/css/verifier.rb +106 -0
  117. data/lib/poetry/core/design_lint.rb +720 -0
  118. data/lib/poetry/core/design_md/import.rb +250 -0
  119. data/lib/poetry/core/design_md.rb +461 -0
  120. data/lib/poetry/core/engine.rb +71 -0
  121. data/lib/poetry/core/errors.rb +53 -0
  122. data/lib/poetry/core/html/attributes.rb +667 -0
  123. data/lib/poetry/core/icons.rb +157 -0
  124. data/lib/poetry/core/llms_text.rb +354 -0
  125. data/lib/poetry/core/page_architectures.rb +304 -0
  126. data/lib/poetry/core/part_contract.rb +285 -0
  127. data/lib/poetry/core/preview/abstract.rb +121 -0
  128. data/lib/poetry/core/preview/base.rb +227 -0
  129. data/lib/poetry/core/preview/sidecarable.rb +136 -0
  130. data/lib/poetry/core/preview/template.rb +186 -0
  131. data/lib/poetry/core/recipe_items.rb +82 -0
  132. data/lib/poetry/core/registry.rb +363 -0
  133. data/lib/poetry/core/registry_address.rb +115 -0
  134. data/lib/poetry/core/registry_client.rb +217 -0
  135. data/lib/poetry/core/registry_installer.rb +234 -0
  136. data/lib/poetry/core/registry_items.rb +184 -0
  137. data/lib/poetry/core/skill_text.rb +288 -0
  138. data/lib/poetry/core/stable_id.rb +110 -0
  139. data/lib/poetry/core/stimulus/builder.rb +395 -0
  140. data/lib/poetry/core/stimulus/declarations.rb +444 -0
  141. data/lib/poetry/core/stimulus/manifest.rb +68 -0
  142. data/lib/poetry/core/stimulus/merger.rb +131 -0
  143. data/lib/poetry/core/stimulus_contract.rb +263 -0
  144. data/lib/poetry/core/tag_helper.rb +10 -0
  145. data/lib/poetry/core/template_compile.rb +74 -0
  146. data/lib/poetry/core/token_import.rb +317 -0
  147. data/lib/poetry/core/tokens/color.rb +215 -0
  148. data/lib/poetry/core/tokens/contrast_gate.rb +120 -0
  149. data/lib/poetry/core/tokens/generator.rb +211 -0
  150. data/lib/poetry/core/tokens.rb +117 -0
  151. data/lib/poetry/core/version.rb +9 -0
  152. data/lib/poetry/core.rb +52 -0
  153. data/lib/poetry-core.rb +5 -0
  154. data/tokens/aliases.css +145 -0
  155. data/tokens/tailwind-theme.css +47 -0
  156. data/tokens/tokens.css +78 -0
  157. data/tokens/tokens.dtcg.json +779 -0
  158. data/vendor/floating-ui/LICENSE +20 -0
  159. data/vendor/floating-ui/VENDORED_VERSIONS +15 -0
  160. data/vendor/shadcn-tailwind/LICENSE +21 -0
  161. data/vendor/shadcn-tailwind/VENDORED_COMMIT +1 -0
  162. data/vendor/shadcn-tailwind/tailwind.css +629 -0
  163. data/vendor/tw-animate-css/LICENSE +21 -0
  164. data/vendor/tw-animate-css/VENDORED_VERSION +1 -0
  165. data/vendor/tw-animate-css/tw-animate.css +1 -0
  166. metadata +267 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 72998473fe858b7965080423352da67d02f8cc6c35caf3bf53369f590808894d
4
+ data.tar.gz: ee168d90ba65226c1016ff00c857e782136a388d2d29cf19d4f0a35d6f330af1
5
+ SHA512:
6
+ metadata.gz: 9c0a44e06ddadad7ff598f256ffc0134da027d3fb00e528228bda28f901a9d72758d29ed0aab0055b196df1d8fa8453aaa644f37301bde3ad36fb6a12c60290e
7
+ data.tar.gz: 56b8888668d81cc38c4ff5c78240fc57fd2ecc8370c22f59980055ada7c7d9d4a5dd5dcdb0ba5f5d79bba0f05a501956a35201c5a3f5d2b2aa537a0ebeb25eef
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
data/DESIGN.md ADDED
@@ -0,0 +1,145 @@
1
+ ---
2
+ design_system: poetry
3
+ source: tokens/tokens.dtcg.json
4
+ generator: bin/rake tokens:generate
5
+ dark_mode: class .dark
6
+ radius: 0.625rem
7
+ radius_scale:
8
+ radius-sm: calc(var(--radius) * 0.6)
9
+ radius-md: calc(var(--radius) * 0.8)
10
+ radius-lg: var(--radius)
11
+ radius-xl: calc(var(--radius) * 1.4)
12
+ radius-2xl: calc(var(--radius) * 1.8)
13
+ radius-3xl: calc(var(--radius) * 2.2)
14
+ radius-4xl: calc(var(--radius) * 2.6)
15
+ colors:
16
+ light:
17
+ background: oklch(1 0 0)
18
+ foreground: oklch(0.145 0 0)
19
+ card: oklch(1 0 0)
20
+ card-foreground: oklch(0.145 0 0)
21
+ popover: oklch(1 0 0)
22
+ popover-foreground: oklch(0.145 0 0)
23
+ primary: oklch(0.205 0 0)
24
+ primary-foreground: oklch(0.985 0 0)
25
+ secondary: oklch(0.97 0 0)
26
+ secondary-foreground: oklch(0.205 0 0)
27
+ muted: oklch(0.97 0 0)
28
+ muted-foreground: oklch(0.545 0 0)
29
+ accent: oklch(0.97 0 0)
30
+ accent-foreground: oklch(0.205 0 0)
31
+ destructive: oklch(0.577 0.245 27.325)
32
+ success: oklch(0.596 0.145 163.225)
33
+ warning: oklch(0.555 0.163 48.998)
34
+ info: oklch(0.546 0.245 262.881)
35
+ border: oklch(0.922 0 0)
36
+ input: oklch(0.922 0 0)
37
+ ring: oklch(0.708 0 0)
38
+ chart-1: oklch(0.809 0.105 251.813)
39
+ chart-2: oklch(0.623 0.214 259.815)
40
+ chart-3: oklch(0.546 0.245 262.881)
41
+ chart-4: oklch(0.488 0.243 264.376)
42
+ chart-5: oklch(0.424 0.199 265.638)
43
+ sidebar: oklch(0.985 0 0)
44
+ sidebar-foreground: oklch(0.145 0 0)
45
+ sidebar-primary: oklch(0.205 0 0)
46
+ sidebar-primary-foreground: oklch(0.985 0 0)
47
+ sidebar-accent: oklch(0.97 0 0)
48
+ sidebar-accent-foreground: oklch(0.205 0 0)
49
+ sidebar-border: oklch(0.922 0 0)
50
+ sidebar-ring: oklch(0.708 0 0)
51
+ dark:
52
+ background: oklch(0.145 0 0)
53
+ foreground: oklch(0.985 0 0)
54
+ card: oklch(0.205 0 0)
55
+ card-foreground: oklch(0.985 0 0)
56
+ popover: oklch(0.205 0 0)
57
+ popover-foreground: oklch(0.985 0 0)
58
+ primary: oklch(0.922 0 0)
59
+ primary-foreground: oklch(0.205 0 0)
60
+ secondary: oklch(0.269 0 0)
61
+ secondary-foreground: oklch(0.985 0 0)
62
+ muted: oklch(0.269 0 0)
63
+ muted-foreground: oklch(0.708 0 0)
64
+ accent: oklch(0.269 0 0)
65
+ accent-foreground: oklch(0.985 0 0)
66
+ destructive: oklch(0.704 0.191 22.216)
67
+ success: oklch(0.765 0.177 163.223)
68
+ warning: oklch(0.828 0.189 84.429)
69
+ info: oklch(0.809 0.105 251.813)
70
+ border: oklch(1 0 0 / 10%)
71
+ input: oklch(1 0 0 / 15%)
72
+ ring: oklch(0.556 0 0)
73
+ chart-1: oklch(0.809 0.105 251.813)
74
+ chart-2: oklch(0.623 0.214 259.815)
75
+ chart-3: oklch(0.546 0.245 262.881)
76
+ chart-4: oklch(0.488 0.243 264.376)
77
+ chart-5: oklch(0.424 0.199 265.638)
78
+ sidebar: oklch(0.205 0 0)
79
+ sidebar-foreground: oklch(0.985 0 0)
80
+ sidebar-primary: oklch(0.488 0.243 264.376)
81
+ sidebar-primary-foreground: oklch(0.985 0 0)
82
+ sidebar-accent: oklch(0.269 0 0)
83
+ sidebar-accent-foreground: oklch(0.985 0 0)
84
+ sidebar-border: oklch(1 0 0 / 10%)
85
+ sidebar-ring: oklch(0.556 0 0)
86
+ contrast_policy:
87
+ floor: WCAG 2.2 AA (4.5:1) - locked, every gated pair
88
+ target: AAA (7:1) wherever achievable at lock time
89
+ gate: 'Poetry::Core::Tokens::ContrastGate (CI: rake test)'
90
+ aa_exceptions:
91
+ - "[light] muted-foreground on muted: 4.54:1 (locked AA, needs >= 4.5)"
92
+ - "[light] muted-foreground on background: 4.96:1 (locked AA, needs >= 4.5)"
93
+ - "[light] white on destructive: 4.76:1 (locked AA, needs >= 4.5)"
94
+ - "[dark] muted-foreground on muted: 5.83:1 (locked AA, needs >= 4.5)"
95
+ - "[dark] white on destructive/60% over background: 6.48:1 (locked AA, needs >=
96
+ 4.5)"
97
+ - "[dark] sidebar-primary-foreground on sidebar-primary: 6.54:1 (locked AA, needs
98
+ >= 4.5)"
99
+ parity:
100
+ base: shadcn/ui v4 neutral (cssVarsV4 drop-in var set)
101
+ deltas:
102
+ - 'light muted-foreground: oklch(0.545 0 0) vs the source''s 0.556 - darkened to
103
+ clear the locked WCAG AA floor (4.54:1 on muted, 4.96:1 on background; the source
104
+ value is 4.34:1 on muted, sub-AA).'
105
+ - 'chart-1..5: the source''s legacy blue base-color chart ramp (blue-300/500/600/700/800)
106
+ in both modes - the neutral base ships a gray ramp (0.87 / 0.556 / 0.439 / 0.371
107
+ / 0.269) that cannot separate series.'
108
+ - 'success, warning, info: poetry additions - the source ships no status roles.
109
+ success and info reuse source hues (a green base chart hue; the blue ramp''s third
110
+ stop); warning is the orange base''s primary. All three are gated like every other
111
+ role.'
112
+ ---
113
+
114
+ # DESIGN.md - the Poetry design constitution
115
+
116
+ The front matter above is **generated** from `tokens/tokens.dtcg.json`
117
+ (`bin/rake tokens:generate`) and lists the exact tokens; this body is the
118
+ judgment layer - edit it freely, it is preserved across regenerations.
119
+
120
+ ## Principles
121
+
122
+ - **Semantic roles only.** Components consume role tokens (`primary`,
123
+ `destructive`, `muted`, `accent`, ...) - never raw palette values, never
124
+ hex/oklch literals in markup (enforced by the class Verifier).
125
+ - **Both modes always.** Every surface must hold in light and dark; dark
126
+ mode is the `.dark` class convention, and the contrast gate
127
+ asserts every pair in both modes.
128
+ - **Contrast is law, not taste.** WCAG 2.2 AA is a locked floor; AAA is
129
+ enforced where achievable. Exceptions are explicit (front matter) and
130
+ reviewed - never silent.
131
+ - **Re-skin at the source.** Restyling the system means editing the DTCG
132
+ tokens (or dropping in a shadcn v4 theme over `tokens/tokens.css`) and
133
+ regenerating - one source, every surface.
134
+
135
+ ## Do / Don't
136
+
137
+ - Do pick variants by intent (one `primary` action per view; `destructive`
138
+ only for irreversible actions).
139
+ - Do keep borders subtle (`border`/`input` are deliberately low-contrast;
140
+ they are not text and are not gated as text).
141
+ - Don't paint white text on solid `destructive` in dark mode - dark
142
+ destructive surfaces are rendered at 60% over the background (2.9:1
143
+ solid vs 6.5:1 composited).
144
+ - Don't introduce new colors, shadows, or radii without adding tokens
145
+ here first.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Matt Solt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # poetry-core
2
+
3
+ The Rails engine, component DSL, and primitives that power **[poetry](https://github.com/roboruby/poetry)** — the AI-native, Rails-first component library. This gem is the *framework* layer (the engine, the `Component` base class plus the Styles/Options DSL, the Stimulus integration, the preview infrastructure). The components themselves live in `poetry-ui`.
4
+
5
+ > **Status: early release.** The API is settling but not frozen; the CHANGELOG lists every breaking change.
6
+
7
+ ## Installation
8
+
9
+ Most users should depend on the umbrella **`poetry`** gem rather than `poetry-core` directly.
10
+
11
+ ```bash
12
+ bundle add poetry-core
13
+ ```
14
+
15
+ ## Development
16
+
17
+ After checking out the repo, run `bin/setup` to install dependencies, then `bundle exec rake` to run the tests and RuboCop. `bin/console` gives an interactive prompt.
18
+
19
+ ## Release
20
+
21
+ Releases publish to [RubyGems.org](https://rubygems.org) via GitHub Actions OIDC **trusted publishing** (no API keys). Run `bundle exec rake "version:bump[X.Y.Z]"` (sets `Poetry::Core::VERSION` and package.json together; `rake version:verify` in the default chain fails on drift), commit, then push a `vX.Y.Z` tag — the `Release` workflow checks the tag against the version and publishes the gem.
22
+
23
+ ## Lineage
24
+
25
+ poetry-core evolves the framework layer of `view_component_plus` (the `Plus` gem) — itself a synthesis of view_component-contrib and fox_tail.
26
+
27
+ ## License
28
+
29
+ Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
30
+ See `THIRD_PARTY_NOTICES.md` for adapted code.