poetry-charts 0.0.2 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99231ee56a021b648de82294be7e444f38195bef2046f2df58bd24f0e3a8f46d
4
- data.tar.gz: 4561421c7a07d32b09212358b80fb7753e1022b401552d47d3da42d0787fbb05
3
+ metadata.gz: 1d9c28b2545df07306fa7b6f8392f8549a5123bd15ef1e55eb32fd5d3f5515d3
4
+ data.tar.gz: cb3328e0f55c18efb58e3d11f7f893d3509a84dd7825d7ea8ccb7c1df5fca5b9
5
5
  SHA512:
6
- metadata.gz: 0b4dfbc1ca25a2478d3696cd7b5f83e370b50dffd544c89185e1fec3843326920c263073a3cd42f464d2e97bf1d190cccc3bf35d973c0a047ff8dcaf6f6fb8ed
7
- data.tar.gz: 4e9e085244c9fc7ac1fcdf23546465854d5f1e6a921bbe6d9b8a9b6a84b1cecd294564b1571c9b1a636f31ad299f19e521254c2b7e470eac4bf6cd3f67577833
6
+ metadata.gz: f78a9851ffa415adabd9e06ac6d6780126bdfed09634be40ceb3d86ebcc40d553a03c22a95adc4b3ecfdcac9342af55079e48de8a8013b0a892199eba99921bd
7
+ data.tar.gz: 95be4f0045ae57905563522830a8b98703bdb1c068bc6a9333de4bb7f29132fb75d07ff2c29cdd96c3460a1f90766b72a932efadcb966ac296f3eae1954ba0aa
@@ -12,13 +12,13 @@ module Poetry
12
12
  # chrome. The content block is the chart body.
13
13
  #
14
14
  # @example
15
- # <%= poetry_chart_container(config: { desktop: { label: "Desktop", color: "var(--chart-1)" } }) do %>
15
+ # <%= poetry_container(config: { desktop: { label: "Desktop", color: "var(--chart-1)" } }) do %>
16
16
  # ...the chart body...
17
17
  # <% end %>
18
18
  class Component < Poetry::Core::Component
19
19
  # Projected into the registry and agent surface.
20
20
  AGENT_RULES = [
21
- "Every chart lives inside poetry_chart_container(config:) - the config maps series keys to labels/colors.",
21
+ "Every chart lives inside poetry_container(config:) - the config maps series keys to labels/colors.",
22
22
  "Reference series colors as var(--color-<key>); never hard-code a color in chart markup.",
23
23
  "Config colors point at theme tokens (var(--chart-1..5)) or use theme: { light:, dark: } maps.",
24
24
  "Give charts an explicit id: when the page renders more than one of the same chart."
@@ -10,7 +10,7 @@ module Poetry
10
10
  # to override, e.g. per-slice pie legends.
11
11
  #
12
12
  # @example
13
- # <%= poetry_chart_legend_content(config: config) %>
13
+ # <%= poetry_legend_content(config: config) %>
14
14
  class Component < Poetry::Core::Component
15
15
  # Projected into the registry and agent surface.
16
16
  AGENT_RULES = [
@@ -12,7 +12,7 @@ module Poetry
12
12
  # row's swatch follows its series.
13
13
  #
14
14
  # @example
15
- # <%= poetry_chart_tooltip_content(config: config,
15
+ # <%= poetry_tooltip_content(config: config,
16
16
  # items: [{ key: :desktop, value: 186 }]) %>
17
17
  #
18
18
  # Items are `{ key:, name:, value:, color: }` hashes; names resolve
@@ -2,8 +2,12 @@
2
2
 
3
3
  module Poetry
4
4
  module Charts
5
- # The poetry_chart_* view helpers - the agent-facing chart surface,
6
- # from the chart-root dispatcher down to the per-family helpers.
5
+ # The poetry_* chart view helpers - the agent-facing chart surface, from
6
+ # the chart-root dispatcher down to one helper per component. Every
7
+ # registered component answers to poetry_<component name>, the
8
+ # convention the registry, `poetry check`, llms.txt, and the skills
9
+ # derive helper names from; the three poetry_chart_* wrappers stay as
10
+ # aliases for callers that adopted them.
7
11
  module ComponentsHelper
8
12
  # Chart type symbols mapped to their component class names - the
9
13
  # dispatch table behind poetry_chart.
@@ -85,41 +89,133 @@ module Poetry
85
89
  render(Poetry::Charts::BarChart::Component.new(**), &)
86
90
  end
87
91
 
92
+ # Renders a composed chart - areas, bars, and lines sharing one x band
93
+ # and one y domain; declaration order is paint order.
94
+ #
95
+ # @example
96
+ # <%= poetry_composed_chart(data: data, config: config) do |c| %>
97
+ # <% c.with_bar data_key: :desktop %>
98
+ # <% c.with_line data_key: :mobile %>
99
+ # <% end %>
100
+ #
101
+ # @see Poetry::Charts::ComposedChart::Component
102
+ def poetry_composed_chart(**, &)
103
+ render(Poetry::Charts::ComposedChart::Component.new(**), &)
104
+ end
105
+
106
+ # Renders a pie chart - one or more rings of slices; inner_radius on a
107
+ # pie makes the donut, with_center_label fills the hole.
108
+ #
109
+ # @example
110
+ # <%= poetry_pie_chart(data: data, config: config) do |c| %>
111
+ # <% c.with_pie data_key: :visitors, name_key: :browser, inner_radius: 60 %>
112
+ # <% c.with_tooltip %>
113
+ # <% end %>
114
+ #
115
+ # @see Poetry::Charts::PieChart::Component
116
+ def poetry_pie_chart(**, &)
117
+ render(Poetry::Charts::PieChart::Component.new(**), &)
118
+ end
119
+
120
+ # Renders a radar chart - series drawn as polygons over a polar grid.
121
+ #
122
+ # @example
123
+ # <%= poetry_radar_chart(data: data, config: config) do |c| %>
124
+ # <% c.with_radar data_key: :desktop %>
125
+ # <% end %>
126
+ #
127
+ # @see Poetry::Charts::RadarChart::Component
128
+ def poetry_radar_chart(**, &)
129
+ render(Poetry::Charts::RadarChart::Component.new(**), &)
130
+ end
131
+
132
+ # Renders a radial bar chart - values as arcs around a shared center.
133
+ #
134
+ # @example
135
+ # <%= poetry_radial_bar_chart(data: data, config: config) do |c| %>
136
+ # <% c.with_radial_bar data_key: :visitors %>
137
+ # <% end %>
138
+ #
139
+ # @see Poetry::Charts::RadialBarChart::Component
140
+ def poetry_radial_bar_chart(**, &)
141
+ render(Poetry::Charts::RadialBarChart::Component.new(**), &)
142
+ end
143
+
144
+ # Renders a scatter chart - points positioned by two numeric keys.
145
+ #
146
+ # @example
147
+ # <%= poetry_scatter_chart(data: data, config: config) do |c| %>
148
+ # <% c.with_scatter data_key: :desktop %>
149
+ # <% end %>
150
+ #
151
+ # @see Poetry::Charts::ScatterChart::Component
152
+ def poetry_scatter_chart(**, &)
153
+ render(Poetry::Charts::ScatterChart::Component.new(**), &)
154
+ end
155
+
156
+ # Renders the adapter mount directly - the closed spec (type:,
157
+ # engine:, series:, axes:) handed to a registered client-side engine.
158
+ # poetry_chart(type, engine:) is the same call with the type first.
159
+ #
160
+ # @example
161
+ # <%= poetry_adapter_chart(type: :line, engine: :chartjs, data: data, config: config,
162
+ # series: [{ data_key: :desktop }]) %>
163
+ #
164
+ # @see Poetry::Charts::AdapterChart::Component
165
+ def poetry_adapter_chart(**)
166
+ render(Poetry::Charts::AdapterChart::Component.new(**))
167
+ end
168
+
88
169
  # Renders the chart container - the sized, theme-scoped wrapper that
89
170
  # emits var(--color-<key>) for every configured series and hosts the
90
171
  # chart plus its tooltip and legend.
91
172
  #
92
173
  # @example
93
- # <%= poetry_chart_container(config: config, class: "h-64") do %>
174
+ # <%= poetry_container(config: config, class: "h-64") do %>
94
175
  # <%= poetry_area_chart(data: data, config: config) %>
95
176
  # <% end %>
96
177
  #
97
178
  # @see Poetry::Charts::Container::Component
98
- def poetry_chart_container(**, &)
179
+ def poetry_container(**, &)
99
180
  render(Poetry::Charts::Container::Component.new(**), &)
100
181
  end
182
+ alias poetry_chart_container poetry_container
101
183
 
102
184
  # Renders the tooltip panel a chart's hover layer positions and fills -
103
185
  # place it inside the container alongside the chart.
104
186
  #
105
187
  # @example
106
- # <%= poetry_chart_tooltip_content(indicator: :line) %>
188
+ # <%= poetry_tooltip_content(indicator: :line) %>
107
189
  #
108
190
  # @see Poetry::Charts::TooltipContent::Component
109
- def poetry_chart_tooltip_content(**, &)
191
+ def poetry_tooltip_content(**, &)
110
192
  render(Poetry::Charts::TooltipContent::Component.new(**), &)
111
193
  end
194
+ alias poetry_chart_tooltip_content poetry_tooltip_content
195
+
196
+ # Renders the hover layer that positions the tooltip over a chart -
197
+ # the charts attach it themselves through with_tooltip; reach for the
198
+ # helper only when composing the layer by hand.
199
+ #
200
+ # @example
201
+ # <%= poetry_tooltip_layer(chart_id: "traffic") %>
202
+ #
203
+ # @see Poetry::Charts::TooltipLayer::Component
204
+ def poetry_tooltip_layer(**, &)
205
+ render(Poetry::Charts::TooltipLayer::Component.new(**), &)
206
+ end
112
207
 
113
208
  # Renders a standalone legend for the configured series - a swatch
114
209
  # plus label per entry.
115
210
  #
116
211
  # @example
117
- # <%= poetry_chart_legend_content(config: config) %>
212
+ # <%= poetry_legend_content(config: config) %>
118
213
  #
119
214
  # @see Poetry::Charts::LegendContent::Component
120
- def poetry_chart_legend_content(**, &)
215
+ def poetry_legend_content(**, &)
121
216
  render(Poetry::Charts::LegendContent::Component.new(**), &)
122
217
  end
218
+ alias poetry_chart_legend_content poetry_legend_content
123
219
  end
124
220
  end
125
221
  end
@@ -1314,7 +1314,7 @@ components:
1314
1314
  elements: []
1315
1315
  capsule: 7b90eeaff974
1316
1316
  agent_rules:
1317
- - Every chart lives inside poetry_chart_container(config:) - the config maps series
1317
+ - Every chart lives inside poetry_container(config:) - the config maps series
1318
1318
  keys to labels/colors.
1319
1319
  - Reference series colors as var(--color-<key>); never hard-code a color in chart
1320
1320
  markup.
@@ -3046,10 +3046,20 @@ helpers:
3046
3046
  poetry_chart:
3047
3047
  yields: the dispatched chart component
3048
3048
  helper_args:
3049
+ poetry_adapter_chart: 0
3049
3050
  poetry_area_chart: 0
3050
3051
  poetry_bar_chart: 0
3051
3052
  poetry_chart: 1
3052
3053
  poetry_chart_container: 0
3053
3054
  poetry_chart_legend_content: 0
3054
3055
  poetry_chart_tooltip_content: 0
3056
+ poetry_composed_chart: 0
3057
+ poetry_container: 0
3058
+ poetry_legend_content: 0
3055
3059
  poetry_line_chart: 0
3060
+ poetry_pie_chart: 0
3061
+ poetry_radar_chart: 0
3062
+ poetry_radial_bar_chart: 0
3063
+ poetry_scatter_chart: 0
3064
+ poetry_tooltip_content: 0
3065
+ poetry_tooltip_layer: 0
@@ -3,6 +3,6 @@
3
3
  module Poetry
4
4
  module Charts
5
5
  # The gem version.
6
- VERSION = "0.0.2"
6
+ VERSION = "0.0.4"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poetry-charts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Solt
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.0.2
18
+ version: 0.0.4
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.0.2
25
+ version: 0.0.4
26
26
  description: Charts whose geometry is computed on the server (Ruby; d3-scale/d3-shape
27
27
  semantics, recharts' nice ticks) and shipped as finished SVG - no-JS valid, CSS-variable
28
28
  themed, zero client chart math. Stimulus chrome reads server-embedded coordinates