plotleaf 0.3.2 → 0.4.1

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.
@@ -20,7 +20,7 @@
20
20
  "imagePixels": 4000000
21
21
  },
22
22
  "data": {
23
- "shape": "array of flat JSON records; explicit table sparkline columns permit bounded numeric/null arrays only in their declared fields",
23
+ "shape": "component datasets are arrays of flat JSON records; explicit table sparkline columns permit bounded numeric/null arrays only in their declared fields; explore bundles use their component-specific inputs/views schema",
24
24
  "resolution": "relative to the report directory; local .json files only",
25
25
  "percent": "ratios: 0.12 displays as 12%",
26
26
  "percentagePoints": "point values: 0.8 displays as 0.8 pt",
@@ -29,6 +29,381 @@
29
29
  "timeZone": "UTC"
30
30
  },
31
31
  "components": {
32
+ "explore": {
33
+ "description": "Scoped native controls select complete agent-prepared views. No analytics or report JavaScript.",
34
+ "forms": [
35
+ "leaf"
36
+ ],
37
+ "children": [],
38
+ "props": {
39
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
40
+ "type": "object",
41
+ "properties": {
42
+ "data": {
43
+ "type": "string",
44
+ "minLength": 1,
45
+ "maxLength": 1000
46
+ },
47
+ "title": {
48
+ "type": "string",
49
+ "minLength": 1,
50
+ "maxLength": 1000
51
+ }
52
+ },
53
+ "required": [
54
+ "data",
55
+ "title"
56
+ ],
57
+ "additionalProperties": false
58
+ },
59
+ "example": "::explore{data=\"./regional-views.json\" title=\"Regional performance\"}",
60
+ "dataRules": {
61
+ "schema": {
62
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
63
+ "type": "object",
64
+ "properties": {
65
+ "inputs": {
66
+ "minItems": 1,
67
+ "maxItems": 6,
68
+ "type": "array",
69
+ "items": {
70
+ "oneOf": [
71
+ {
72
+ "type": "object",
73
+ "properties": {
74
+ "id": {
75
+ "type": "string",
76
+ "pattern": "^[a-z][a-z0-9_-]{0,47}$"
77
+ },
78
+ "label": {
79
+ "type": "string",
80
+ "minLength": 1,
81
+ "maxLength": 160
82
+ },
83
+ "type": {
84
+ "type": "string",
85
+ "enum": [
86
+ "select",
87
+ "segmented",
88
+ "text"
89
+ ]
90
+ },
91
+ "default": {
92
+ "type": "string",
93
+ "maxLength": 120
94
+ },
95
+ "options": {
96
+ "minItems": 1,
97
+ "maxItems": 20,
98
+ "type": "array",
99
+ "items": {
100
+ "type": "object",
101
+ "properties": {
102
+ "value": {
103
+ "type": "string",
104
+ "maxLength": 120
105
+ },
106
+ "label": {
107
+ "type": "string",
108
+ "minLength": 1,
109
+ "maxLength": 160
110
+ }
111
+ },
112
+ "required": [
113
+ "value",
114
+ "label"
115
+ ],
116
+ "additionalProperties": false
117
+ }
118
+ }
119
+ },
120
+ "required": [
121
+ "id",
122
+ "label",
123
+ "type",
124
+ "default",
125
+ "options"
126
+ ],
127
+ "additionalProperties": false
128
+ },
129
+ {
130
+ "type": "object",
131
+ "properties": {
132
+ "id": {
133
+ "type": "string",
134
+ "pattern": "^[a-z][a-z0-9_-]{0,47}$"
135
+ },
136
+ "label": {
137
+ "type": "string",
138
+ "minLength": 1,
139
+ "maxLength": 160
140
+ },
141
+ "type": {
142
+ "type": "string",
143
+ "const": "number"
144
+ },
145
+ "default": {
146
+ "type": "number"
147
+ },
148
+ "options": {
149
+ "minItems": 1,
150
+ "maxItems": 20,
151
+ "type": "array",
152
+ "items": {
153
+ "type": "object",
154
+ "properties": {
155
+ "value": {
156
+ "type": "number"
157
+ },
158
+ "label": {
159
+ "type": "string",
160
+ "minLength": 1,
161
+ "maxLength": 160
162
+ }
163
+ },
164
+ "required": [
165
+ "value",
166
+ "label"
167
+ ],
168
+ "additionalProperties": false
169
+ }
170
+ }
171
+ },
172
+ "required": [
173
+ "id",
174
+ "label",
175
+ "type",
176
+ "default",
177
+ "options"
178
+ ],
179
+ "additionalProperties": false
180
+ },
181
+ {
182
+ "type": "object",
183
+ "properties": {
184
+ "id": {
185
+ "type": "string",
186
+ "pattern": "^[a-z][a-z0-9_-]{0,47}$"
187
+ },
188
+ "label": {
189
+ "type": "string",
190
+ "minLength": 1,
191
+ "maxLength": 160
192
+ },
193
+ "type": {
194
+ "type": "string",
195
+ "const": "toggle"
196
+ },
197
+ "default": {
198
+ "type": "boolean"
199
+ }
200
+ },
201
+ "required": [
202
+ "id",
203
+ "label",
204
+ "type",
205
+ "default"
206
+ ],
207
+ "additionalProperties": false
208
+ },
209
+ {
210
+ "type": "object",
211
+ "properties": {
212
+ "id": {
213
+ "type": "string",
214
+ "pattern": "^[a-z][a-z0-9_-]{0,47}$"
215
+ },
216
+ "label": {
217
+ "type": "string",
218
+ "minLength": 1,
219
+ "maxLength": 160
220
+ },
221
+ "type": {
222
+ "type": "string",
223
+ "const": "date-range"
224
+ },
225
+ "default": {
226
+ "type": "object",
227
+ "properties": {
228
+ "start": {
229
+ "type": "string",
230
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
231
+ },
232
+ "end": {
233
+ "type": "string",
234
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
235
+ }
236
+ },
237
+ "required": [
238
+ "start",
239
+ "end"
240
+ ],
241
+ "additionalProperties": false
242
+ },
243
+ "options": {
244
+ "minItems": 1,
245
+ "maxItems": 20,
246
+ "type": "array",
247
+ "items": {
248
+ "type": "object",
249
+ "properties": {
250
+ "value": {
251
+ "type": "object",
252
+ "properties": {
253
+ "start": {
254
+ "type": "string",
255
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
256
+ },
257
+ "end": {
258
+ "type": "string",
259
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
260
+ }
261
+ },
262
+ "required": [
263
+ "start",
264
+ "end"
265
+ ],
266
+ "additionalProperties": false
267
+ },
268
+ "label": {
269
+ "type": "string",
270
+ "minLength": 1,
271
+ "maxLength": 160
272
+ }
273
+ },
274
+ "required": [
275
+ "value",
276
+ "label"
277
+ ],
278
+ "additionalProperties": false
279
+ }
280
+ }
281
+ },
282
+ "required": [
283
+ "id",
284
+ "label",
285
+ "type",
286
+ "default",
287
+ "options"
288
+ ],
289
+ "additionalProperties": false
290
+ }
291
+ ]
292
+ }
293
+ },
294
+ "views": {
295
+ "minItems": 1,
296
+ "maxItems": 32,
297
+ "type": "array",
298
+ "items": {
299
+ "type": "object",
300
+ "properties": {
301
+ "id": {
302
+ "type": "string",
303
+ "pattern": "^[a-z][a-z0-9_-]{0,47}$"
304
+ },
305
+ "label": {
306
+ "type": "string",
307
+ "minLength": 1,
308
+ "maxLength": 160
309
+ },
310
+ "when": {
311
+ "type": "object",
312
+ "propertyNames": {
313
+ "type": "string",
314
+ "pattern": "^[a-z][a-z0-9_-]{0,47}$"
315
+ },
316
+ "additionalProperties": {
317
+ "anyOf": [
318
+ {
319
+ "type": "string",
320
+ "maxLength": 120
321
+ },
322
+ {
323
+ "type": "number"
324
+ },
325
+ {
326
+ "type": "boolean"
327
+ },
328
+ {
329
+ "type": "object",
330
+ "properties": {
331
+ "start": {
332
+ "type": "string",
333
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
334
+ },
335
+ "end": {
336
+ "type": "string",
337
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
338
+ }
339
+ },
340
+ "required": [
341
+ "start",
342
+ "end"
343
+ ],
344
+ "additionalProperties": false
345
+ }
346
+ ]
347
+ }
348
+ },
349
+ "markdown": {
350
+ "type": "string",
351
+ "minLength": 1,
352
+ "maxLength": 1048576
353
+ },
354
+ "datasets": {
355
+ "default": {},
356
+ "type": "object",
357
+ "propertyNames": {
358
+ "type": "string",
359
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]*\\.json$"
360
+ },
361
+ "additionalProperties": {
362
+ "maxItems": 10000,
363
+ "type": "array",
364
+ "items": {
365
+ "type": "object",
366
+ "propertyNames": {
367
+ "type": "string"
368
+ },
369
+ "additionalProperties": {}
370
+ }
371
+ }
372
+ }
373
+ },
374
+ "required": [
375
+ "id",
376
+ "label",
377
+ "when",
378
+ "markdown",
379
+ "datasets"
380
+ ],
381
+ "additionalProperties": false
382
+ }
383
+ }
384
+ },
385
+ "required": [
386
+ "inputs",
387
+ "views"
388
+ ],
389
+ "additionalProperties": false
390
+ },
391
+ "resolution": "Relative JSON bundle; inline view datasets override the same plain filename only within that view.",
392
+ "limits": {
393
+ "inputs": 6,
394
+ "options": 20,
395
+ "views": 32,
396
+ "explorations": 4,
397
+ "components": 512,
398
+ "rows": 20000,
399
+ "dataBytes": 8388608,
400
+ "markdownBytes": 2097152,
401
+ "jsonDepth": 32,
402
+ "jsonContainers": 100000
403
+ },
404
+ "binding": "Every input affects exactly this exploration. Every view declares all input values. No matching combination hides the previous view."
405
+ }
406
+ },
32
407
  "grid": {
33
408
  "description": "A responsive row of one to four components.",
34
409
  "forms": [
@@ -575,6 +950,6 @@
575
950
  "Donut category/value fields must differ; category count is bounded, and all-zero values do not create equal slices.",
576
951
  "Funnel fields must differ; shares and denominators are supplied, validated and displayed per row, with no sorting or status inference.",
577
952
  "Only explicit image columns can load local static PNG/JPEG; every resource stays within the report root and shared byte limits.",
578
- "Filters, maps, arbitrary nested data and executable components are not supported in this release."
953
+ "explore selects finite agent-prepared views using scoped native controls; nested explorations, arbitrary row queries, maps and executable components are not supported."
579
954
  ]
580
955
  }
@@ -13,7 +13,7 @@ Use an installed `plotleaf` CLI or `npx plotleaf`. The CLI requires Node 22 or n
13
13
 
14
14
  Run `plotleaf schema` (or `npx plotleaf schema`) for the current machine-readable component/prop specifications, rules and input limits. Prefer that output over remembered syntax. Supported components include `grid`, `metric`, `line`, `area`, `bar`, `donut`, `funnel`, `table`, `column` and `callout`. Donut and funnel require plotleaf 0.2.0 or newer; check the installed CLI's schema when using an older version.
15
15
 
16
- Use ordinary Markdown for headings, prose, findings, emphasis, lists, links and dividers. Headings provide sections. Design is built in; do not add custom CSS, raw HTML or framework components. Image/sparkline column kinds require 0.3.0 or newer; check the installed CLI version and schema. Filters, maps, subtotals and executable/custom components remain future capabilities.
16
+ Use ordinary Markdown for headings, prose, findings, emphasis, lists, links and dividers. Headings provide sections. Design is built in; do not add custom CSS, raw HTML or framework components. Image/sparkline column kinds require 0.3.0 or newer; check the installed CLI version and schema. Scoped prepared-view controls are available since 0.4.0; maps, subtotals and executable/custom components remain future capabilities.
17
17
 
18
18
  ## Author prepared content
19
19
 
@@ -93,3 +93,63 @@ Repair diagnostics using their code, one-based source location, message and hint
93
93
  Export is one self-contained interactive HTML file. Check it after copying it away from sources and disabling networking. Charts require JavaScript; prose, metrics, tables and native chart-data disclosures remain readable without it. All displayed/embedded values are readable by recipients: collapsing a table or hiding a field visually is not redaction. Prepare sensitive data before rendering; explicit-column tables and chart field projection help avoid exporting unused fields.
94
94
 
95
95
  Inspect the result at a narrow viewport and in both system themes. Preserve the source's meaning and the product's quiet editorial design when making revisions.
96
+
97
+ ## Scoped interactions (0.4.0 or newer)
98
+
99
+ Use `::explore{data="./views.json" title="Regional performance"}` for a complete
100
+ agent-prepared interactive section. Check the installed schema first: older
101
+ releases do not support this directive. No calculation, arbitrary query or code
102
+ execution occurs when a reader changes controls.
103
+
104
+ Prepare one JSON bundle with `inputs` and `views`. Each input declares `id`,
105
+ `label`, `type`, `default` and (except toggle) `options` containing `{value,label}`.
106
+ Types are `select`, `segmented`, `toggle`, `text`, `number`, and `date-range`.
107
+ Text/number inputs accept declared literal values; unsupported values display an
108
+ unavailable state. A date-range value is `{start:"2026-11-01",end:"2026-11-07"}`:
109
+ real inclusive ISO calendar dates, and only supplied start/end pairs are supported.
110
+ Select All is an ordinary prepared value, not a special string or hidden reducer.
111
+
112
+ Each view declares `id`, `label`, `when` (exactly every input ID), `markdown` and
113
+ optional `datasets`. Markdown uses the same built-in components. A dataset named
114
+ `sales.json` resolves from `./sales.json` inside that view; undeclared dataset
115
+ references resolve from the report directory. Inline datasets undergo the same
116
+ shape/field/null/date/image/sparkline validation and field projection as ordinary
117
+ JSON. Nested explorations are rejected.
118
+
119
+ ```json
120
+ {
121
+ "inputs": [{
122
+ "id": "region", "label": "Region", "type": "select", "default": "all",
123
+ "options": [{"value": "all", "label": "All regions"}, {"value": "emea", "label": "EMEA"}]
124
+ }],
125
+ "views": [
126
+ {"id": "all", "label": "All regions", "when": {"region": "all"},
127
+ "markdown": "::metric{label=\"Orders\" value=\"100\"}\n\n::table{data=\"./sales.json\"}",
128
+ "datasets": {"sales.json": [{"region": "All regions", "orders": 100}]}},
129
+ {"id": "emea", "label": "EMEA", "when": {"region": "emea"},
130
+ "markdown": "::metric{label=\"Orders\" value=\"40\"}\n\n::table{data=\"./sales.json\"}",
131
+ "datasets": {"sales.json": [{"region": "EMEA", "orders": 40}]}}
132
+ ]
133
+ }
134
+ ```
135
+
136
+ Prepare metrics, comparisons, denominators, chart series, funnel stages, table rows
137
+ and scope-specific prose together. Every control affects only its exploration;
138
+ static content outside it stays fixed and must identify its scope. Every view
139
+ binds all inputs, duplicate conditions are invalid, and defaults must select one
140
+ view. Unsupported combinations hide the previous view; Reset restores defaults.
141
+ No view infers a total, percentage, business sentiment or arbitrary date range.
142
+
143
+ Bounds: four explorations per report, six inputs per exploration, 20 choices per
144
+ input, 32 views per exploration, 512 expanded components, 20,000 expanded component
145
+ rows, 8 MiB expanded prepared data and 2 MiB expanded Markdown per compilation. Bundles allow at most 32 JSON nesting
146
+ levels and 100,000 JSON containers, in addition to ordinary file and
147
+ data limits. Keep prepared bundles small. All selectable views/data remain
148
+ readable in exports; hiding views is not redaction. Default content and data
149
+ alternatives remain readable without JavaScript, with disabled controls.
150
+
151
+ Validate every view, then test transitions, reset, invalid/unavailable values,
152
+ empty data, keyboard access, narrow widths and both themes. Export and interact
153
+ offline after removing source files. The fictional interactions example and the
154
+ browser playground demonstrate all six control types. No URL state, persistence,
155
+ remote fetch, free-form row query or analytics engine is implied.