yaml-flow 4.0.0 → 5.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 (96) hide show
  1. package/browser/board-livegraph-runtime.js +1453 -0
  2. package/browser/board-livegraph-runtime.js.map +1 -0
  3. package/browser/card-compute.js +36 -17
  4. package/browser/live-cards.js +848 -109
  5. package/browser/live-cards.schema.json +46 -21
  6. package/dist/board-livegraph-runtime/index.cjs +1448 -0
  7. package/dist/board-livegraph-runtime/index.cjs.map +1 -0
  8. package/dist/board-livegraph-runtime/index.d.cts +101 -0
  9. package/dist/board-livegraph-runtime/index.d.ts +101 -0
  10. package/dist/board-livegraph-runtime/index.js +1441 -0
  11. package/dist/board-livegraph-runtime/index.js.map +1 -0
  12. package/dist/card-compute/index.cjs +159 -44
  13. package/dist/card-compute/index.cjs.map +1 -1
  14. package/dist/card-compute/index.d.cts +36 -11
  15. package/dist/card-compute/index.d.ts +36 -11
  16. package/dist/card-compute/index.js +156 -44
  17. package/dist/card-compute/index.js.map +1 -1
  18. package/dist/cli/board-live-cards-cli.cjs +476 -105
  19. package/dist/cli/board-live-cards-cli.cjs.map +1 -1
  20. package/dist/cli/board-live-cards-cli.d.cts +8 -16
  21. package/dist/cli/board-live-cards-cli.d.ts +8 -16
  22. package/dist/cli/board-live-cards-cli.js +476 -106
  23. package/dist/cli/board-live-cards-cli.js.map +1 -1
  24. package/dist/continuous-event-graph/index.cjs +74 -33
  25. package/dist/continuous-event-graph/index.cjs.map +1 -1
  26. package/dist/continuous-event-graph/index.d.cts +7 -23
  27. package/dist/continuous-event-graph/index.d.ts +7 -23
  28. package/dist/continuous-event-graph/index.js +73 -32
  29. package/dist/continuous-event-graph/index.js.map +1 -1
  30. package/dist/index.cjs +1440 -56
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +21 -3
  33. package/dist/index.d.ts +21 -3
  34. package/dist/index.js +1434 -56
  35. package/dist/index.js.map +1 -1
  36. package/dist/journal-DRfJiheM.d.cts +28 -0
  37. package/dist/journal-NLYuqege.d.ts +28 -0
  38. package/dist/{journal-B_2JnBMF.d.ts → live-cards-bridge-Or7fdEJV.d.ts} +5 -32
  39. package/dist/{journal-BJDjWb5Q.d.cts → live-cards-bridge-vGJ6tMzN.d.cts} +5 -32
  40. package/dist/schedule-CMcZe5Ny.d.ts +21 -0
  41. package/dist/schedule-CiucyCan.d.cts +21 -0
  42. package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +1 -1
  43. package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +3 -3
  44. package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +1 -1
  45. package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +3 -3
  46. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
  47. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +33 -5
  48. package/examples/browser/livecards-browser/index.html +37 -684
  49. package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
  50. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +3 -3
  51. package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
  52. package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +3 -3
  53. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +2 -2
  54. package/examples/example-board/board.yaml +23 -0
  55. package/examples/example-board/bootstrap_payload.json +1 -0
  56. package/examples/example-board/cards/card-chain-region-alert.json +39 -0
  57. package/examples/example-board/cards/card-chain-region-totals.json +26 -0
  58. package/examples/example-board/cards/card-chain-top-region.json +24 -0
  59. package/examples/example-board/cards/card-ex-actions.json +32 -0
  60. package/examples/example-board/cards/card-ex-chart.json +30 -0
  61. package/examples/example-board/cards/card-ex-filter.json +36 -0
  62. package/examples/example-board/cards/card-ex-filtered-by-preference.json +59 -0
  63. package/examples/example-board/cards/card-ex-form.json +91 -0
  64. package/examples/example-board/cards/card-ex-list.json +22 -0
  65. package/examples/example-board/cards/card-ex-markdown.json +17 -0
  66. package/examples/example-board/cards/card-ex-metric.json +19 -0
  67. package/examples/example-board/cards/card-ex-narrative.json +36 -0
  68. package/examples/example-board/cards/card-ex-source-http.json +28 -0
  69. package/examples/example-board/cards/card-ex-source.json +21 -0
  70. package/examples/example-board/cards/card-ex-status.json +35 -0
  71. package/examples/example-board/cards/card-ex-table.json +30 -0
  72. package/examples/example-board/cards/card-ex-todo.json +29 -0
  73. package/examples/example-board/demo-chat-handler.js +69 -0
  74. package/examples/example-board/demo-server-config.json +7 -0
  75. package/examples/example-board/demo-server.js +124 -0
  76. package/examples/example-board/demo-shell-browser.html +806 -0
  77. package/examples/example-board/demo-shell-with-server.html +280 -0
  78. package/examples/example-board/demo-shell.html +62 -0
  79. package/examples/example-board/demo-task-executor.js +255 -0
  80. package/examples/example-board/mock.db +15 -0
  81. package/examples/example-board/reusable-board-runtime-client.js +265 -0
  82. package/examples/example-board/reusable-runtime-artifacts-adapter.js +233 -0
  83. package/examples/example-board/reusable-server-runtime.js +1341 -0
  84. package/examples/index.html +16 -9
  85. package/examples/npm-libs/continuous-event-graph/live-cards-board.ts +17 -17
  86. package/examples/npm-libs/continuous-event-graph/live-portfolio-dashboard.ts +23 -23
  87. package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
  88. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +3 -3
  89. package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
  90. package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +1 -1
  91. package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
  92. package/package.json +16 -2
  93. package/schema/card-runtime.schema.json +25 -0
  94. package/schema/live-cards.schema.json +46 -21
  95. package/browser/ingest-board.js +0 -296
  96. package/examples/ingest.js +0 -733
@@ -3,7 +3,7 @@
3
3
  "meta": { "title": "Holdings Table" },
4
4
  "requires": ["holdings", "prices"],
5
5
  "provides": [{ "bindTo": "table", "src": "computed_values.table" }],
6
- "state": {},
6
+ "card_data": {},
7
7
  "compute": [
8
8
  {
9
9
  "bindTo": "table",
@@ -6,10 +6,10 @@
6
6
  "provides": [
7
7
  {
8
8
  "bindTo": "holdings",
9
- "src": "state.holdings"
9
+ "src": "card_data.holdings"
10
10
  }
11
11
  ],
12
- "state": {
12
+ "card_data": {
13
13
  "holdings": [
14
14
  {
15
15
  "symbol": "AAPL",
@@ -31,7 +31,7 @@
31
31
  "kind": "table",
32
32
  "label": "Holdings",
33
33
  "data": {
34
- "bind": "state.holdings",
34
+ "bind": "card_data.holdings",
35
35
  "columns": [
36
36
  "symbol",
37
37
  "qty"
@@ -3,7 +3,7 @@
3
3
  "meta": { "title": "Portfolio Total Value" },
4
4
  "requires": ["table"],
5
5
  "provides": [{ "bindTo": "totalValue", "src": "computed_values.totalValue" }],
6
- "state": {},
6
+ "card_data": {},
7
7
  "compute": [
8
8
  { "bindTo": "totalValue", "expr": "$sum(requires.table.rows.value)" }
9
9
  ],
@@ -2,14 +2,14 @@
2
2
  "id": "price-fetch",
3
3
  "meta": { "title": "Fetch Market Prices" },
4
4
  "requires": ["holdings"],
5
- "provides": [{ "bindTo": "prices", "src": "sources.prices" }],
6
- "state": {},
5
+ "provides": [{ "bindTo": "prices", "src": "fetched_sources.prices" }],
6
+ "card_data": {},
7
7
  "sources": [
8
8
  { "cli": "node ../fetch-prices.js --tmp-file-name tmp_file1", "bindTo": "prices", "outputFile": "prices.json" }
9
9
  ],
10
10
  "view": {
11
11
  "elements": [
12
- { "kind": "table", "label": "Market Prices", "data": { "bind": "sources.prices" } }
12
+ { "kind": "table", "label": "Market Prices", "data": { "bind": "fetched_sources.prices" } }
13
13
  ]
14
14
  }
15
15
  }
@@ -18,8 +18,8 @@ try {
18
18
  const cardPath = path.join(cardsDir, 'portfolio-form.json');
19
19
  const raw = fs.readFileSync(cardPath, 'utf-8');
20
20
  const card = JSON.parse(raw);
21
- card.state = card.state ?? {};
22
- card.state.holdings = holdings;
21
+ card.card_data = card.card_data ?? {};
22
+ card.card_data.holdings = holdings;
23
23
  fs.writeFileSync(cardPath, `${JSON.stringify(card, null, 2)}\n`, 'utf-8');
24
24
 
25
25
  runBoardCli(['update-card', '--rg', boardDir, '--card-id', 'portfolio-form', '--restart']);
@@ -0,0 +1,23 @@
1
+ # Example board.yaml — demonstrates board configuration
2
+ name: Example Dashboard
3
+ desc: Reference board demonstrating all LiveCard v4 card patterns and element kinds
4
+
5
+ # Connections are domain-specific. Define your own based on what your task-executor supports.
6
+ # The schema allows any properties on source entries (additionalProperties: true).
7
+ # These connect entries are examples — replace with your actual data sources.
8
+ connects:
9
+ - id: orders-db
10
+ type: script
11
+ desc: Order data fetched via a local script
12
+
13
+ - id: pricing-api
14
+ type: http
15
+ url: https://api.example.com/v1/prices
16
+ desc: External pricing API
17
+
18
+ vocabulary:
19
+ tokens:
20
+ fresh: { color: "green", label: "Fresh" }
21
+ stale: { color: "orange", label: "Stale" }
22
+ linked: { color: "blue", label: "Linked" }
23
+ alert: { color: "red", label: "Alert" }
@@ -0,0 +1 @@
1
+ {"cardDefinitions":[{"id":"card-ex-chart","meta":{"title":"Orders by Region","tags":[],"desc":"Bar chart — JSONata group-by region with count aggregation"},"requires":["orders"],"compute":[{"bindTo":"regionCounts","expr":"$each($reduce(requires.orders, function($acc, $v){ $merge([$acc, { $v.region: ($lookup($acc, $v.region) ? $lookup($acc, $v.region) + 1 : 1) }]) }, {}), function($v, $k){ { 'region': $k, 'count': $v } })"}],"view":{"elements":[{"kind":"chart","label":"Orders by Region","data":{"bind":"computed_values.regionCounts","chartType":"bar","chartOptions":{"indexAxis":"x"}}}],"layout":{"board":{"col":6,"order":6},"canvas":{"x":50,"y":530,"w":350,"h":220}}},"card_data":{}},{"id":"card-ex-filter","meta":{"title":"Filters","tags":[],"desc":"Interactive filter controls — user selects region and product"},"requires":["orders"],"provides":[{"bindTo":"selections","src":"card_data.fieldValues"}],"compute":[{"bindTo":"region","expr":"$sort($distinct(requires.orders.region))"},{"bindTo":"product","expr":"$sort($distinct(requires.orders.product))"}],"view":{"elements":[{"kind":"filter","data":{"bind":"computed_values","writeTo":"card_data.fieldValues","fields":{"type":"object","properties":{"region":{"type":"string","title":"Region"},"product":{"type":"string","title":"Product"}}}}}],"layout":{"board":{"col":4,"order":3},"canvas":{"x":50,"y":320,"w":220,"h":160}}},"card_data":{"fieldValues":{}}},{"id":"card-ex-filtered-by-preference","meta":{"title":"Orders by Favorite Product","tags":["filtered","computed"],"desc":"Shows orders filtered by the Favorite Product selected in the preferences form. Demonstrates cascading updates: when form changes, this card auto-recomputes."},"requires":["orders","card-ex-form"],"compute":[{"bindTo":"favoriteProduct","expr":"($lookup(requires, 'card-ex-form').preferences.favoriteProduct) ? $lookup(requires, 'card-ex-form').preferences.favoriteProduct : 'Widget A'"},{"bindTo":"filteredOrders","expr":"$filter(requires.orders, function($v){ $v.product = computed_values.favoriteProduct })"},{"bindTo":"filteredCount","expr":"$count(computed_values.filteredOrders)"},{"bindTo":"filteredRevenue","expr":"$round($sum(computed_values.filteredOrders.amount), 2)"}],"view":{"elements":[{"kind":"metric","label":"Filtered Product","data":{"bind":"computed_values.favoriteProduct"}},{"kind":"metric","label":"Order Count","data":{"bind":"computed_values.filteredCount"}},{"kind":"metric","label":"Total Revenue","data":{"bind":"computed_values.filteredRevenue"}},{"kind":"list","label":"Orders","data":{"bind":"computed_values.filteredOrders","template":"{id} | {product} | Qty {quantity} | ${amount} | {region}"}}],"layout":{"board":{"col":4,"order":13},"canvas":{"x":920,"y":400,"w":300,"h":250}}},"card_data":{}},{"id":"card-ex-form","meta":{"title":"Widget Preferences","tags":["form","settings"],"desc":"Form to update user preferences — demonstrates bidirectional data flow and card state mutations"},"provides":[{"bindTo":"card-ex-form","src":"card_data"}],"view":{"elements":[{"kind":"form","label":"Update Preferences","data":{"writeTo":"card_data.preferences","fields":{"type":"object","title":"Widget Preferences","properties":{"favoriteProduct":{"type":"string","title":"Favorite Product","enum":["Widget A","Widget B","Widget C"],"description":"Your preferred widget type"},"preferredRegion":{"type":"string","title":"Preferred Region","enum":["North","South","East","West"],"description":"Your sales region"},"discountThreshold":{"type":"number","title":"Discount Threshold ($)","minimum":0,"maximum":100000,"description":"Minimum order amount for discounts"},"enableNotifications":{"type":"boolean","title":"Enable Email Notifications","description":"Receive alerts for order updates"}},"required":["favoriteProduct","preferredRegion"]}}}],"layout":{"board":{"col":4,"order":12},"canvas":{"x":600,"y":400,"w":280,"h":200}}},"card_data":{"preferences":{"favoriteProduct":"Widget C","preferredRegion":"North","discountThreshold":5000,"enableNotifications":true}}},{"id":"card-ex-list","meta":{"title":"Top 5 Products","tags":[],"desc":"Ranked list — JSONata sort by revenue descending, slice top 5"},"requires":["orders"],"compute":[{"bindTo":"topProducts","expr":"requires.orders^(>amount)#$i[$i<5].(product & ' — $' & $string(amount))"}],"view":{"elements":[{"kind":"list","data":{"bind":"computed_values.topProducts"}}],"layout":{"board":{"col":3,"order":5},"canvas":{"x":550,"y":320,"w":220,"h":180}}},"card_data":{}},{"id":"card-ex-markdown","meta":{"title":"Board Notes","tags":[],"desc":"Free-text markdown notes — no source or compute"},"view":{"elements":[{"kind":"markdown","data":{"bind":"card_data.content"}}],"layout":{"board":{"col":4,"order":9},"canvas":{"x":700,"y":530,"w":260,"h":200}}},"card_data":{"content":"## Quick Notes\n\n- Review regional targets quarterly\n- Check supplier delivery SLAs\n- Update pricing model before next sprint"}},{"id":"card-ex-metric","meta":{"title":"Total Revenue","tags":[],"desc":"Single KPI — sum of all order amounts via JSONata $sum"},"requires":["orders"],"compute":[{"bindTo":"totalRevenue","expr":"$round($sum(requires.orders.amount), 2)"}],"view":{"elements":[{"kind":"metric","label":"Revenue","data":{"bind":"computed_values.totalRevenue"}}],"layout":{"board":{"col":3,"order":4},"canvas":{"x":320,"y":320,"w":180,"h":120}}},"card_data":{}},{"id":"card-ex-narrative","meta":{"title":"Sales Insight","tags":[],"desc":"AI-generated narrative from Copilot source execution"},"requires":["orders","prices"],"compute":[{"bindTo":"orderCount","expr":"$count(requires.orders)"},{"bindTo":"totalRevenue","expr":"$sum(requires.orders.amount)"}],"sources":[{"bindTo":"raw","outputFile":"card-ex-narrative-raw.json","copilot":{"prompt_template":"You are a concise sales analyst. Write 5-7 bullet points about business signals to monitor this week for a small B2B widget company. Keep it under 120 words."}}],"view":{"elements":[{"kind":"text","label":"Data In (orders: {{count}}, revenue: ${{rev}})","data":{"bind":"computed_values.orderCount","style":"muted"}},{"kind":"narrative","data":{"bind":"fetched_sources.raw"}}],"layout":{"board":{"col":6,"order":10},"canvas":{"x":600,"y":800,"w":350,"h":250}},"features":{"refresh":true,"chat":true}},"card_data":{}},{"id":"card-ex-source-http","meta":{"title":"Product Prices","tags":["data","linked"],"desc":"Fetches pricing for products derived from upstream order data"},"requires":["orders"],"provides":[{"bindTo":"prices","src":"fetched_sources.raw"}],"sources":[{"bindTo":"raw","outputFile":"card-ex-source-http-raw.json","mock":"prices"}],"compute":[{"bindTo":"PRODUCT_LIST","expr":"$join($distinct(requires.orders.product), ',')"}],"view":{"elements":[{"kind":"table","data":{"bind":"fetched_sources.raw","columns":["product","price","currency"],"sortable":true}}],"layout":{"board":{"col":6,"order":2},"canvas":{"x":450,"y":50,"w":350,"h":220}}},"card_data":{}},{"id":"card-ex-source","meta":{"title":"Order Data","tags":["data"],"desc":"Root data source — fetches order records via a script"},"provides":[{"bindTo":"orders","src":"fetched_sources.raw"}],"sources":[{"bindTo":"raw","outputFile":"card-ex-source-raw.json","mock":"orders"}],"view":{"elements":[{"kind":"table","data":{"bind":"fetched_sources.raw","columns":["id","product","quantity","amount","region"],"maxRows":10}}],"layout":{"board":{"col":6,"order":1},"canvas":{"x":50,"y":50,"w":350,"h":220}}},"card_data":{}},{"id":"card-ex-status","meta":{"title":"Revenue Health","tags":[],"desc":"Status badge with threshold logic — JSONata ternary for green/amber/red"},"requires":["orders"],"compute":[{"bindTo":"totalRevenue","expr":"$sum(requires.orders.amount)"},{"bindTo":"orderCount","expr":"$count(requires.orders)"},{"bindTo":"health","expr":"computed_values.totalRevenue > 100000 ? { 'label': 'Healthy', 'value': computed_values.totalRevenue, 'orders': computed_values.orderCount } : computed_values.totalRevenue > 50000 ? { 'label': 'Moderate', 'value': computed_values.totalRevenue, 'orders': computed_values.orderCount } : { 'label': 'Low', 'value': computed_values.totalRevenue, 'orders': computed_values.orderCount }"}],"view":{"elements":[{"kind":"badge","data":{"bind":"computed_values.health.label","colorMap":{"Healthy":"success","Moderate":"warning","Low":"danger"}}},{"kind":"metric","label":"Revenue","data":{"bind":"computed_values.health.value"}}],"layout":{"board":{"col":3,"order":8},"canvas":{"x":450,"y":530,"w":200,"h":170}}},"card_data":{}},{"id":"card-ex-table","meta":{"title":"Order Details","tags":[],"desc":"Filtered and sorted table — combines source data with user filter selections"},"requires":["orders","selections"],"compute":[{"bindTo":"filtered","expr":"[$filter(requires.orders, function($v){ ($exists(requires.selections.region) ? $v.region = requires.selections.region : true) and ($exists(requires.selections.product) ? $v.product = requires.selections.product : true) })^(>amount)#$i[$i<20]]"}],"view":{"elements":[{"kind":"table","data":{"bind":"computed_values.filtered","columns":["id","product","quantity","amount","region"],"sortable":true,"maxRows":20}}],"layout":{"board":{"col":8,"order":7},"canvas":{"x":50,"y":800,"w":500,"h":250}}},"card_data":{}},{"id":"card-ex-todo","meta":{"title":"Action Items","tags":[],"desc":"Interactive todo list — persistent user input via writeTo"},"view":{"elements":[{"kind":"todo","label":"Tasks","data":{"bind":"card_data.items","writeTo":"card_data.items","placeholder":"No tasks yet — add one above"}}],"layout":{"board":{"col":4,"order":11},"canvas":{"x":700,"y":320,"w":260,"h":180}}},"card_data":{"items":[{"text":"Set up task-executor for your data sources","done":false},{"text":"Configure board.yaml connections","done":false},{"text":"Run board-live-cards-cli init","done":false}]}},{"id":"card-ex-actions","meta":{"title":"Action Router","tags":["actions","interactive"],"desc":"Simple button actions routed through board-level handler"},"view":{"elements":[{"kind":"actions","label":"Workflow Actions","data":{"buttons":[{"id":"approve","label":"Approve","style":"success"},{"id":"needs-review","label":"Needs Review","style":"warning"},{"id":"escalate","label":"Escalate","style":"danger"}]}},{"kind":"text","label":"Last Action","data":{"bind":"card_data.lastActionText","style":"muted"}}],"layout":{"board":{"col":4,"order":14},"canvas":{"x":980,"y":320,"w":260,"h":180}}},"card_data":{"lastActionText":"No action yet"}},{"id":"card-ex-chat","meta":{"title":"Collaboration Chat","tags":["chat","interactive"],"desc":"Board-level chat action routing with optional file attachments"},"view":{"elements":[{"id":"chat","kind":"chat","label":"Discuss This Board","data":{"bind":"card_data.messages","fileAttach":true,"fileAccept":[".txt",".md",".json",".png",".jpg"],"placeholder":"Type a message or attach files..."}}],"layout":{"board":{"col":6,"order":12},"canvas":{"x":980,"y":530,"w":360,"h":240}}},"card_data":{}},{"id":"card-ex-file-upload","meta":{"title":"Attachment Inbox","tags":["files","interactive"],"desc":"File-upload card — files are committed automatically when dropped or selected"},"view":{"elements":[{"id":"files-upload","kind":"file-upload","label":"Upload Supporting Files","data":{"bind":"card_data.files","accept":[".txt",".csv",".md",".json",".png",".jpg",".pdf"],"multiple":true,"placeholder":"Drop or select files — they are saved immediately"}},{"id":"files-list","kind":"text","label":"Uploaded Files","data":{"bind":"card_data.files","format":"file-links","cardId":"card-ex-file-upload"}}],"layout":{"board":{"col":6,"order":13},"canvas":{"x":980,"y":820,"w":360,"h":300}}},"card_data":{"files":[]}},{"id":"card-chain-region-totals","meta":{"title":"Revenue by Region","tags":["chain","level-2"],"desc":"Chain level 2 of 4 — groups order amounts by region. Auto-recomputes whenever the upstream orders data changes."},"requires":["orders"],"provides":[{"bindTo":"regionTotals","src":"computed_values.byRegion"}],"compute":[{"bindTo":"byRegion","expr":"$each($reduce(requires.orders, function($acc, $v){ $merge([$acc, { $v.region: ($lookup($acc, $v.region) ? $lookup($acc, $v.region) + $v.amount : $v.amount) }]) }, {}), function($v, $k){ { 'region': $k, 'total': $v } })"}],"view":{"elements":[{"kind":"table","data":{"bind":"computed_values.byRegion","columns":["region","total"],"sortable":true}}],"layout":{"board":{"col":3,"order":20},"canvas":{"x":50,"y":1100,"w":250,"h":200}}},"card_data":{}},{"id":"card-chain-top-region","meta":{"title":"Top Region","tags":["chain","level-3"],"desc":"Chain level 3 of 4 — picks the highest-revenue region from the aggregated totals. Recomputes whenever region totals update."},"requires":["regionTotals"],"provides":[{"bindTo":"topRegion","src":"computed_values.leader"}],"compute":[{"bindTo":"leader","expr":"requires.regionTotals^(>total)[0]"}],"view":{"elements":[{"kind":"metric","label":"Top Region","data":{"bind":"computed_values.leader.region"}},{"kind":"metric","label":"Revenue","data":{"bind":"computed_values.leader.total"}}],"layout":{"board":{"col":3,"order":21},"canvas":{"x":330,"y":1100,"w":200,"h":200}}},"card_data":{}},{"id":"card-chain-region-alert","meta":{"title":"Region Dominance Alert","tags":["chain","level-4"],"desc":"Chain level 4 of 4 — computes whether the top region dominates total revenue. Full cascade: orders → regionTotals → topRegion → this card. Change any upstream source and all four levels update automatically."},"requires":["topRegion","regionTotals"],"compute":[{"bindTo":"totalRevenue","expr":"$sum(requires.regionTotals.total)"},{"bindTo":"topShare","expr":"$round(requires.topRegion.total / computed_values.totalRevenue * 100, 1)"},{"bindTo":"dominance","expr":"computed_values.topShare > 40 ? 'Dominant' : computed_values.topShare > 25 ? 'Leading' : 'Balanced'"}],"view":{"elements":[{"kind":"badge","data":{"bind":"computed_values.dominance","colorMap":{"Dominant":"danger","Leading":"warning","Balanced":"success"}}},{"kind":"metric","label":"Top Region","data":{"bind":"requires.topRegion.region"}},{"kind":"metric","label":"Share %","data":{"bind":"computed_values.topShare"}},{"kind":"metric","label":"Total Revenue","data":{"bind":"computed_values.totalRevenue"}}],"layout":{"board":{"col":4,"order":22},"canvas":{"x":560,"y":1100,"w":260,"h":210}}},"card_data":{}}],"statusSnapshot":{"schema_version":"v1","meta":{"board":{"path":"C:\\Users\\sreenaga\\AppData\\Local\\Temp\\board-live-cards-demo-board"}},"summary":{"card_count":20,"completed":19,"eligible":0,"pending":0,"blocked":0,"unresolved":0,"failed":0,"in_progress":0,"orphan_cards":5,"topology":{"edge_count":6,"max_fan_out_card":"card-demo-orders","max_fan_out":10}},"cards":[{"name":"card-chain-region-alert","status":"completed","requires":["topRegion","regionTotals"],"requires_satisfied":["topRegion","regionTotals"],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T09:14:40.590Z","last_completed_at":"2026-04-22T09:14:40.590Z","last_restarted_at":"2026-04-22T09:14:39.155Z","status_age_ms":5920564}},{"name":"card-chain-region-totals","status":"completed","requires":["orders"],"requires_satisfied":["orders"],"requires_missing":[],"provides_declared":["regionTotals"],"provides_runtime":["regionTotals"],"blocked_by":[],"unblocks":["card-chain-region-alert","card-chain-top-region"],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T09:13:40.762Z","last_completed_at":"2026-04-22T09:13:40.762Z","last_restarted_at":"2026-04-22T09:13:39.316Z","status_age_ms":5980392}},{"name":"card-chain-top-region","status":"completed","requires":["regionTotals"],"requires_satisfied":["regionTotals"],"requires_missing":[],"provides_declared":["topRegion"],"provides_runtime":["topRegion"],"blocked_by":[],"unblocks":["card-chain-region-alert"],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T09:14:13.028Z","last_completed_at":"2026-04-22T09:14:13.028Z","last_restarted_at":"2026-04-22T09:14:12.931Z","status_age_ms":5948126}},{"name":"card-demo-orders","status":"completed","requires":[],"requires_satisfied":[],"requires_missing":[],"provides_declared":["orders"],"provides_runtime":["orders"],"blocked_by":[],"unblocks":["card-chain-region-totals","card-ex-chart","card-ex-filter","card-ex-filtered-by-preference","card-ex-list","card-ex-metric","card-ex-narrative","card-ex-source-http","card-ex-status","card-ex-table"],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T07:32:40.511Z","last_completed_at":"2026-04-22T07:32:40.510Z","last_restarted_at":"2026-04-22T07:32:36.740Z","status_age_ms":12040643}},{"name":"card-ex-actions","status":"completed","requires":[],"requires_satisfied":[],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T09:03:08.885Z","last_completed_at":"2026-04-22T09:03:08.885Z","last_restarted_at":"2026-04-22T09:03:08.861Z","status_age_ms":6612269}},{"name":"card-ex-chart","status":"completed","requires":["orders"],"requires_satisfied":["orders"],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T07:32:41.410Z","last_completed_at":"2026-04-22T07:32:41.410Z","last_restarted_at":"2026-04-22T07:32:40.530Z","status_age_ms":12039744}},{"name":"card-ex-chat","status":"completed","requires":[],"requires_satisfied":[],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T09:03:08.885Z","last_completed_at":"2026-04-22T09:03:08.885Z","last_restarted_at":"2026-04-22T09:03:08.862Z","status_age_ms":6612269}},{"name":"card-ex-file-upload","status":"completed","requires":[],"requires_satisfied":[],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":6,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T10:45:17.840Z","last_completed_at":"2026-04-22T10:45:17.840Z","last_restarted_at":"2026-04-22T10:45:17.800Z","status_age_ms":483314}},{"name":"card-ex-filter","status":"completed","requires":["orders"],"requires_satisfied":["orders"],"requires_missing":[],"provides_declared":["selections"],"provides_runtime":["selections"],"blocked_by":[],"unblocks":["card-ex-table"],"runtime":{"attempt_count":5,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T09:05:44.830Z","last_completed_at":"2026-04-22T09:05:44.829Z","last_restarted_at":"2026-04-22T09:05:43.659Z","status_age_ms":6456324}},{"name":"card-ex-filtered-by-preference","status":"completed","requires":["orders","card-ex-form"],"requires_satisfied":["orders","card-ex-form"],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":8,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T10:19:45.710Z","last_completed_at":"2026-04-22T10:19:45.710Z","last_restarted_at":"2026-04-22T10:19:45.633Z","status_age_ms":2015444}},{"name":"card-ex-form","status":"completed","requires":[],"requires_satisfied":[],"requires_missing":[],"provides_declared":["card-ex-form"],"provides_runtime":["card-ex-form"],"blocked_by":[],"unblocks":["card-ex-filtered-by-preference"],"runtime":{"attempt_count":8,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T10:19:45.629Z","last_completed_at":"2026-04-22T10:19:45.629Z","last_restarted_at":"2026-04-22T10:19:45.594Z","status_age_ms":2015525}},{"name":"card-ex-list","status":"completed","requires":["orders"],"requires_satisfied":["orders"],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T07:32:41.410Z","last_completed_at":"2026-04-22T07:32:41.410Z","last_restarted_at":"2026-04-22T07:32:40.530Z","status_age_ms":12039744}},{"name":"card-ex-markdown","status":"completed","requires":[],"requires_satisfied":[],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T07:32:36.764Z","last_completed_at":"2026-04-22T07:32:36.764Z","last_restarted_at":"2026-04-22T07:32:36.740Z","status_age_ms":12044390}},{"name":"card-ex-metric","status":"completed","requires":["orders"],"requires_satisfied":["orders"],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T07:32:41.410Z","last_completed_at":"2026-04-22T07:32:41.410Z","last_restarted_at":"2026-04-22T07:32:40.530Z","status_age_ms":12039744}},{"name":"card-ex-narrative","status":"running","requires":["orders","prices"],"requires_satisfied":["orders","prices"],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":2,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T10:05:28.019Z","last_completed_at":null,"last_restarted_at":"2026-04-22T10:05:28.019Z","status_age_ms":2873135}},{"name":"card-ex-source","status":"completed","requires":[],"requires_satisfied":[],"requires_missing":[],"provides_declared":["orders"],"provides_runtime":["orders"],"blocked_by":[],"unblocks":["card-chain-region-totals","card-ex-chart","card-ex-filter","card-ex-filtered-by-preference","card-ex-list","card-ex-metric","card-ex-narrative","card-ex-source-http","card-ex-status","card-ex-table"],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T07:32:40.511Z","last_completed_at":"2026-04-22T07:32:40.511Z","last_restarted_at":"2026-04-22T07:32:36.740Z","status_age_ms":12040643}},{"name":"card-ex-source-http","status":"completed","requires":["orders"],"requires_satisfied":["orders"],"requires_missing":[],"provides_declared":["prices"],"provides_runtime":["prices"],"blocked_by":[],"unblocks":["card-ex-narrative"],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T07:32:45.005Z","last_completed_at":"2026-04-22T07:32:45.005Z","last_restarted_at":"2026-04-22T07:32:40.530Z","status_age_ms":12036149}},{"name":"card-ex-status","status":"completed","requires":["orders"],"requires_satisfied":["orders"],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T07:32:41.410Z","last_completed_at":"2026-04-22T07:32:41.410Z","last_restarted_at":"2026-04-22T07:32:40.530Z","status_age_ms":12039744}},{"name":"card-ex-table","status":"completed","requires":["orders","selections"],"requires_satisfied":["orders","selections"],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":4,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T09:05:44.962Z","last_completed_at":"2026-04-22T09:05:44.962Z","last_restarted_at":"2026-04-22T09:05:44.835Z","status_age_ms":6456192}},{"name":"card-ex-todo","status":"completed","requires":[],"requires_satisfied":[],"requires_missing":[],"provides_declared":[],"provides_runtime":[],"blocked_by":[],"unblocks":[],"runtime":{"attempt_count":1,"restart_count":0,"in_progress_since":null,"last_transition_at":"2026-04-22T07:32:36.764Z","last_completed_at":"2026-04-22T07:32:36.764Z","last_restarted_at":"2026-04-22T07:32:36.740Z","status_age_ms":12044390}}]},"dataObjectsByToken":{"card-ex-form":{"preferences":{"favoriteProduct":"Widget A","preferredRegion":"North","discountThreshold":5000,"enableNotifications":true}},"orders":[{"id":"ORD-1001","product":"Widget A","quantity":3,"amount":12400,"region":"North"},{"id":"ORD-1002","product":"Widget B","quantity":2,"amount":8700,"region":"South"},{"id":"ORD-1003","product":"Widget A","quantity":4,"amount":15200,"region":"East"},{"id":"ORD-1004","product":"Widget C","quantity":1,"amount":6300,"region":"West"},{"id":"ORD-1005","product":"Widget B","quantity":2,"amount":9100,"region":"North"},{"id":"ORD-1006","product":"Widget C","quantity":3,"amount":9800,"region":"South"}],"prices":[{"product":"Widget A","price":4133.33,"currency":"USD"},{"product":"Widget B","price":4450,"currency":"USD"},{"product":"Widget C","price":3266.67,"currency":"USD"}],"regionTotals":[{"region":"North","total":21500},{"region":"South","total":18500},{"region":"East","total":15200},{"region":"West","total":6300}],"selections":{"product":"Widget B"},"topRegion":{"region":"North","total":21500}},"cardRuntimeById":{"card-ex-chart":{"schema_version":"v1","card_id":"card-ex-chart","computed_values":{"regionCounts":[{"region":"North","count":2},{"region":"South","count":2},{"region":"East","count":1},{"region":"West","count":1}]},"fetched_sources":{},"card_data":{},"sources":[],"__sourcesData":{}},"card-ex-filter":{"schema_version":"v1","card_id":"card-ex-filter","computed_values":{"region":["East","North","South","West"],"product":["Widget A","Widget B","Widget C"]},"fetched_sources":{},"card_data":{"fieldValues":{}},"sources":[],"__sourcesData":{}},"card-ex-filtered-by-preference":{"schema_version":"v1","card_id":"card-ex-filtered-by-preference","computed_values":{"favoriteProduct":"Widget A","filteredOrders":[{"id":"ORD-1001","product":"Widget A","quantity":3,"amount":12400,"region":"North"},{"id":"ORD-1003","product":"Widget A","quantity":4,"amount":15200,"region":"East"}],"filteredCount":2,"filteredRevenue":27600},"card_data":{},"sources":[],"__sourcesData":{}},"card-ex-form":{"schema_version":"v1","card_id":"card-ex-form","computed_values":{},"card_data":{"preferences":{"favoriteProduct":"Widget C","preferredRegion":"North","discountThreshold":5000,"enableNotifications":true}},"sources":[],"__sourcesData":{}},"card-ex-list":{"schema_version":"v1","card_id":"card-ex-list","computed_values":{"topProducts":["Widget A — $15200","Widget A — $12400","Widget C — $9800","Widget B — $9100","Widget B — $8700"]},"fetched_sources":{},"card_data":{},"sources":[],"__sourcesData":{}},"card-ex-markdown":{"schema_version":"v1","card_id":"card-ex-markdown","computed_values":{},"fetched_sources":{},"card_data":{"content":"## Quick Notes\n\n- Review regional targets quarterly\n- Check supplier delivery SLAs\n- Update pricing model before next sprint"},"sources":[],"__sourcesData":{}},"card-ex-metric":{"schema_version":"v1","card_id":"card-ex-metric","computed_values":{"totalRevenue":61500},"fetched_sources":{},"card_data":{},"sources":[],"__sourcesData":{}},"card-ex-narrative":{"schema_version":"v1","card_id":"card-ex-narrative","computed_values":{"orderCount":6,"totalRevenue":61500},"card_data":{},"sources":[{"bindTo":"raw","outputFile":"card-ex-narrative-raw.json","copilot":{"prompt_template":"You are a concise sales analyst. Write 5-7 bullet points about business signals to monitor this week for a small B2B widget company. Keep it under 120 words."}}],"__sourcesData":{}},"card-ex-source-http":{"schema_version":"v1","card_id":"card-ex-source-http","computed_values":{"PRODUCT_LIST":"Widget A,Widget B,Widget C"},"fetched_sources":{"raw":[{"product":"Widget A","price":4133.33,"currency":"USD"},{"product":"Widget B","price":4450,"currency":"USD"},{"product":"Widget C","price":3266.67,"currency":"USD"}]},"card_data":{},"sources":[{"bindTo":"raw","outputFile":"card-ex-source-http-raw.json","mock":"prices"}],"__sourcesData":{"raw":[{"product":"Widget A","price":4133.33,"currency":"USD"},{"product":"Widget B","price":4450,"currency":"USD"},{"product":"Widget C","price":3266.67,"currency":"USD"}]}},"card-ex-source":{"schema_version":"v1","card_id":"card-ex-source","computed_values":{},"fetched_sources":{"raw":[{"id":"ORD-1001","product":"Widget A","quantity":3,"amount":12400,"region":"North"},{"id":"ORD-1002","product":"Widget B","quantity":2,"amount":8700,"region":"South"},{"id":"ORD-1003","product":"Widget A","quantity":4,"amount":15200,"region":"East"},{"id":"ORD-1004","product":"Widget C","quantity":1,"amount":6300,"region":"West"},{"id":"ORD-1005","product":"Widget B","quantity":2,"amount":9100,"region":"North"},{"id":"ORD-1006","product":"Widget C","quantity":3,"amount":9800,"region":"South"}]},"card_data":{},"sources":[{"bindTo":"raw","outputFile":"card-ex-source-raw.json","mock":"orders"}],"__sourcesData":{"raw":[{"id":"ORD-1001","product":"Widget A","quantity":3,"amount":12400,"region":"North"},{"id":"ORD-1002","product":"Widget B","quantity":2,"amount":8700,"region":"South"},{"id":"ORD-1003","product":"Widget A","quantity":4,"amount":15200,"region":"East"},{"id":"ORD-1004","product":"Widget C","quantity":1,"amount":6300,"region":"West"},{"id":"ORD-1005","product":"Widget B","quantity":2,"amount":9100,"region":"North"},{"id":"ORD-1006","product":"Widget C","quantity":3,"amount":9800,"region":"South"}]}},"card-ex-status":{"schema_version":"v1","card_id":"card-ex-status","computed_values":{"totalRevenue":61500,"orderCount":6,"health":{"label":"Moderate","value":61500,"orders":6}},"fetched_sources":{},"card_data":{},"sources":[],"__sourcesData":{}},"card-ex-table":{"schema_version":"v1","card_id":"card-ex-table","computed_values":{"filtered":[{"id":"ORD-1005","product":"Widget B","quantity":2,"amount":9100,"region":"North"},{"id":"ORD-1002","product":"Widget B","quantity":2,"amount":8700,"region":"South"}]},"fetched_sources":{},"card_data":{},"sources":[],"__sourcesData":{}},"card-ex-todo":{"schema_version":"v1","card_id":"card-ex-todo","computed_values":{},"fetched_sources":{},"card_data":{"items":[{"text":"Set up task-executor for your data sources","done":false},{"text":"Configure board.yaml connections","done":false},{"text":"Run board-live-cards-cli init","done":false}]},"sources":[],"__sourcesData":{}},"card-ex-actions":{"schema_version":"v1","card_id":"card-ex-actions","computed_values":{},"fetched_sources":{},"card_data":{"lastActionText":"No action yet"},"sources":[],"__sourcesData":{}},"card-ex-chat":{"schema_version":"v1","card_id":"card-ex-chat","computed_values":{},"fetched_sources":{},"card_data":{},"sources":[],"__sourcesData":{}},"card-ex-file-upload":{"schema_version":"v1","card_id":"card-ex-file-upload","computed_values":{},"card_data":{"files":[]},"sources":[],"__sourcesData":{}},"card-chain-region-totals":{"schema_version":"v1","card_id":"card-chain-region-totals","computed_values":{"byRegion":[{"region":"North","total":21500},{"region":"South","total":18500},{"region":"East","total":15200},{"region":"West","total":6300}]},"fetched_sources":{},"card_data":{},"sources":[],"__sourcesData":{}},"card-chain-top-region":{"schema_version":"v1","card_id":"card-chain-top-region","computed_values":{"leader":{"region":"North","total":21500}},"fetched_sources":{},"card_data":{},"sources":[],"__sourcesData":{}},"card-chain-region-alert":{"schema_version":"v1","card_id":"card-chain-region-alert","computed_values":{"totalRevenue":61500,"topShare":35,"dominance":"Leading"},"fetched_sources":{},"card_data":{},"sources":[],"__sourcesData":{}}}}
@@ -0,0 +1,39 @@
1
+ {
2
+ "id": "card-chain-region-alert",
3
+ "meta": {
4
+ "title": "Region Dominance Alert",
5
+ "tags": ["chain", "level-4"],
6
+ "desc": "Chain level 4 of 4 — computes whether the top region dominates total revenue. Full cascade: orders → regionTotals → topRegion → this card. Change any upstream source and all four levels update automatically."
7
+ },
8
+ "requires": ["topRegion", "regionTotals"],
9
+ "compute": [
10
+ {
11
+ "bindTo": "totalRevenue",
12
+ "expr": "$sum(requires.regionTotals.total)"
13
+ },
14
+ {
15
+ "bindTo": "topShare",
16
+ "expr": "$round(requires.topRegion.total / computed_values.totalRevenue * 100, 1)"
17
+ },
18
+ {
19
+ "bindTo": "dominance",
20
+ "expr": "computed_values.topShare > 40 ? 'Dominant' : computed_values.topShare > 25 ? 'Leading' : 'Balanced'"
21
+ }
22
+ ],
23
+ "view": {
24
+ "elements": [
25
+ {
26
+ "kind": "badge",
27
+ "data": {
28
+ "bind": "computed_values.dominance",
29
+ "colorMap": { "Dominant": "danger", "Leading": "warning", "Balanced": "success" }
30
+ }
31
+ },
32
+ { "kind": "metric", "label": "Top Region", "data": { "bind": "requires.topRegion.region" } },
33
+ { "kind": "metric", "label": "Share %", "data": { "bind": "computed_values.topShare" } },
34
+ { "kind": "metric", "label": "Total Revenue", "data": { "bind": "computed_values.totalRevenue" } }
35
+ ],
36
+ "layout": { "board": { "col": 4, "order": 22 }, "canvas": { "x": 560, "y": 1100, "w": 260, "h": 210 } }
37
+ },
38
+ "card_data": {}
39
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "id": "card-chain-region-totals",
3
+ "meta": {
4
+ "title": "Revenue by Region",
5
+ "tags": ["chain", "level-2"],
6
+ "desc": "Chain level 2 of 4 — groups order amounts by region. Auto-recomputes whenever the upstream orders data changes."
7
+ },
8
+ "requires": ["orders"],
9
+ "provides": [{ "bindTo": "regionTotals", "src": "computed_values.byRegion" }],
10
+ "compute": [
11
+ {
12
+ "bindTo": "byRegion",
13
+ "expr": "$each($reduce(requires.orders, function($acc, $v){ $merge([$acc, { $v.region: ($lookup($acc, $v.region) ? $lookup($acc, $v.region) + $v.amount : $v.amount) }]) }, {}), function($v, $k){ { 'region': $k, 'total': $v } })"
14
+ }
15
+ ],
16
+ "view": {
17
+ "elements": [
18
+ {
19
+ "kind": "table",
20
+ "data": { "bind": "computed_values.byRegion", "columns": ["region", "total"], "sortable": true }
21
+ }
22
+ ],
23
+ "layout": { "board": { "col": 3, "order": 20 }, "canvas": { "x": 50, "y": 1100, "w": 250, "h": 200 } }
24
+ },
25
+ "card_data": {}
26
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "id": "card-chain-top-region",
3
+ "meta": {
4
+ "title": "Top Region",
5
+ "tags": ["chain", "level-3"],
6
+ "desc": "Chain level 3 of 4 — picks the highest-revenue region from the aggregated totals. Recomputes whenever region totals update."
7
+ },
8
+ "requires": ["regionTotals"],
9
+ "provides": [{ "bindTo": "topRegion", "src": "computed_values.leader" }],
10
+ "compute": [
11
+ {
12
+ "bindTo": "leader",
13
+ "expr": "requires.regionTotals^(>total)[0]"
14
+ }
15
+ ],
16
+ "view": {
17
+ "elements": [
18
+ { "kind": "metric", "label": "Top Region", "data": { "bind": "computed_values.leader.region" } },
19
+ { "kind": "metric", "label": "Revenue", "data": { "bind": "computed_values.leader.total" } }
20
+ ],
21
+ "layout": { "board": { "col": 3, "order": 21 }, "canvas": { "x": 330, "y": 1100, "w": 200, "h": 200 } }
22
+ },
23
+ "card_data": {}
24
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "id": "card-ex-actions",
3
+ "meta": {
4
+ "title": "Action Router",
5
+ "tags": ["actions", "interactive"],
6
+ "desc": "Simple button actions routed through board-level handler"
7
+ },
8
+ "view": {
9
+ "elements": [
10
+ {
11
+ "kind": "actions",
12
+ "label": "Workflow Actions",
13
+ "data": {
14
+ "buttons": [
15
+ { "id": "approve", "label": "Approve", "style": "success" },
16
+ { "id": "needs-review", "label": "Needs Review", "style": "warning" },
17
+ { "id": "escalate", "label": "Escalate", "style": "danger" }
18
+ ]
19
+ }
20
+ },
21
+ {
22
+ "kind": "text",
23
+ "label": "Last Action",
24
+ "data": { "bind": "card_data.lastActionText", "style": "muted" }
25
+ }
26
+ ],
27
+ "layout": { "board": { "col": 4, "order": 14 }, "canvas": { "x": 980, "y": 320, "w": 260, "h": 180 } }
28
+ },
29
+ "card_data": {
30
+ "lastActionText": "No action yet"
31
+ }
32
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "id": "card-ex-chart",
3
+ "meta": {
4
+ "title": "Orders by Region",
5
+ "tags": [],
6
+ "desc": "Bar chart — JSONata group-by region with count aggregation"
7
+ },
8
+ "requires": ["orders"],
9
+ "compute": [
10
+ {
11
+ "bindTo": "regionCounts",
12
+ "expr": "$each($reduce(requires.orders, function($acc, $v){ $merge([$acc, { $v.region: ($lookup($acc, $v.region) ? $lookup($acc, $v.region) + 1 : 1) }]) }, {}), function($v, $k){ { 'region': $k, 'count': $v } })"
13
+ }
14
+ ],
15
+ "view": {
16
+ "elements": [
17
+ {
18
+ "kind": "chart",
19
+ "label": "Orders by Region",
20
+ "data": {
21
+ "bind": "computed_values.regionCounts",
22
+ "chartType": "bar",
23
+ "chartOptions": { "indexAxis": "x" }
24
+ }
25
+ }
26
+ ],
27
+ "layout": { "board": { "col": 6, "order": 6 }, "canvas": { "x": 50, "y": 530, "w": 350, "h": 220 } }
28
+ },
29
+ "card_data": {}
30
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "id": "card-ex-filter",
3
+ "meta": {
4
+ "title": "Filters",
5
+ "tags": [],
6
+ "desc": "Interactive filter controls — user selects region and product"
7
+ },
8
+ "requires": ["orders"],
9
+ "provides": [{ "bindTo": "selections", "src": "card_data.fieldValues" }],
10
+ "compute": [
11
+ { "bindTo": "region", "expr": "$sort($distinct(requires.orders.region))" },
12
+ { "bindTo": "product", "expr": "$sort($distinct(requires.orders.product))" }
13
+ ],
14
+ "view": {
15
+ "elements": [
16
+ {
17
+ "kind": "filter",
18
+ "data": {
19
+ "bind": "computed_values",
20
+ "writeTo": "card_data.fieldValues",
21
+ "fields": {
22
+ "type": "object",
23
+ "properties": {
24
+ "region": { "type": "string", "title": "Region" },
25
+ "product": { "type": "string", "title": "Product" }
26
+ }
27
+ }
28
+ }
29
+ }
30
+ ],
31
+ "layout": { "board": { "col": 4, "order": 3 }, "canvas": { "x": 50, "y": 320, "w": 220, "h": 160 } }
32
+ },
33
+ "card_data": {
34
+ "fieldValues": {}
35
+ }
36
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "id": "card-ex-filtered-by-preference",
3
+ "meta": {
4
+ "title": "Orders by Favorite Product",
5
+ "tags": ["filtered", "computed"],
6
+ "desc": "Shows orders filtered by the Favorite Product selected in the preferences form. Demonstrates cascading updates: when form changes, this card auto-recomputes."
7
+ },
8
+ "requires": ["orders", "card-ex-form"],
9
+ "compute": [
10
+ {
11
+ "bindTo": "favoriteProduct",
12
+ "expr": "($lookup(requires, 'card-ex-form').preferences.favoriteProduct) ? $lookup(requires, 'card-ex-form').preferences.favoriteProduct : 'Widget A'"
13
+ },
14
+ {
15
+ "bindTo": "filteredOrders",
16
+ "expr": "$filter(requires.orders, function($v){ $v.product = computed_values.favoriteProduct })"
17
+ },
18
+ {
19
+ "bindTo": "filteredCount",
20
+ "expr": "$count(computed_values.filteredOrders)"
21
+ },
22
+ {
23
+ "bindTo": "filteredRevenue",
24
+ "expr": "$round($sum(computed_values.filteredOrders.amount), 2)"
25
+ }
26
+ ],
27
+ "view": {
28
+ "elements": [
29
+ {
30
+ "kind": "metric",
31
+ "label": "Filtered Product",
32
+ "data": { "bind": "computed_values.favoriteProduct" }
33
+ },
34
+ {
35
+ "kind": "metric",
36
+ "label": "Order Count",
37
+ "data": { "bind": "computed_values.filteredCount" }
38
+ },
39
+ {
40
+ "kind": "metric",
41
+ "label": "Total Revenue",
42
+ "data": { "bind": "computed_values.filteredRevenue" }
43
+ },
44
+ {
45
+ "kind": "list",
46
+ "label": "Orders",
47
+ "data": {
48
+ "bind": "computed_values.filteredOrders",
49
+ "template": "{id} | {product} | Qty {quantity} | ${amount} | {region}"
50
+ }
51
+ }
52
+ ],
53
+ "layout": {
54
+ "board": { "col": 4, "order": 13 },
55
+ "canvas": { "x": 920, "y": 400, "w": 300, "h": 250 }
56
+ }
57
+ },
58
+ "card_data": {}
59
+ }
@@ -0,0 +1,91 @@
1
+ {
2
+ "id": "card-ex-form",
3
+ "meta": {
4
+ "title": "Widget Preferences",
5
+ "tags": [
6
+ "form",
7
+ "settings"
8
+ ],
9
+ "desc": "Form to update user preferences — demonstrates bidirectional data flow and card state mutations"
10
+ },
11
+ "provides": [
12
+ {
13
+ "bindTo": "card-ex-form",
14
+ "src": "card_data"
15
+ }
16
+ ],
17
+ "view": {
18
+ "elements": [
19
+ {
20
+ "kind": "form",
21
+ "label": "Update Preferences",
22
+ "data": {
23
+ "writeTo": "card_data.preferences",
24
+ "fields": {
25
+ "type": "object",
26
+ "title": "Widget Preferences",
27
+ "properties": {
28
+ "favoriteProduct": {
29
+ "type": "string",
30
+ "title": "Favorite Product",
31
+ "enum": [
32
+ "Widget A",
33
+ "Widget B",
34
+ "Widget C"
35
+ ],
36
+ "description": "Your preferred widget type"
37
+ },
38
+ "preferredRegion": {
39
+ "type": "string",
40
+ "title": "Preferred Region",
41
+ "enum": [
42
+ "North",
43
+ "South",
44
+ "East",
45
+ "West"
46
+ ],
47
+ "description": "Your sales region"
48
+ },
49
+ "discountThreshold": {
50
+ "type": "number",
51
+ "title": "Discount Threshold ($)",
52
+ "minimum": 0,
53
+ "maximum": 100000,
54
+ "description": "Minimum order amount for discounts"
55
+ },
56
+ "enableNotifications": {
57
+ "type": "boolean",
58
+ "title": "Enable Email Notifications",
59
+ "description": "Receive alerts for order updates"
60
+ }
61
+ },
62
+ "required": [
63
+ "favoriteProduct",
64
+ "preferredRegion"
65
+ ]
66
+ }
67
+ }
68
+ }
69
+ ],
70
+ "layout": {
71
+ "board": {
72
+ "col": 4,
73
+ "order": 12
74
+ },
75
+ "canvas": {
76
+ "x": 600,
77
+ "y": 400,
78
+ "w": 280,
79
+ "h": 200
80
+ }
81
+ }
82
+ },
83
+ "card_data": {
84
+ "preferences": {
85
+ "favoriteProduct": "Widget C",
86
+ "preferredRegion": "North",
87
+ "discountThreshold": 5000,
88
+ "enableNotifications": true
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "id": "card-ex-list",
3
+ "meta": {
4
+ "title": "Top 5 Products",
5
+ "tags": [],
6
+ "desc": "Ranked list — JSONata sort by revenue descending, slice top 5"
7
+ },
8
+ "requires": ["orders"],
9
+ "compute": [
10
+ {
11
+ "bindTo": "topProducts",
12
+ "expr": "requires.orders^(>amount)#$i[$i<5].(product & ' — $' & $string(amount))"
13
+ }
14
+ ],
15
+ "view": {
16
+ "elements": [
17
+ { "kind": "list", "data": { "bind": "computed_values.topProducts" } }
18
+ ],
19
+ "layout": { "board": { "col": 3, "order": 5 }, "canvas": { "x": 550, "y": 320, "w": 220, "h": 180 } }
20
+ },
21
+ "card_data": {}
22
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "id": "card-ex-markdown",
3
+ "meta": {
4
+ "title": "Board Notes",
5
+ "tags": [],
6
+ "desc": "Free-text markdown notes — no source or compute"
7
+ },
8
+ "view": {
9
+ "elements": [
10
+ { "kind": "markdown", "data": { "bind": "card_data.content" } }
11
+ ],
12
+ "layout": { "board": { "col": 4, "order": 9 }, "canvas": { "x": 700, "y": 530, "w": 260, "h": 200 } }
13
+ },
14
+ "card_data": {
15
+ "content": "## Quick Notes\n\n- Review regional targets quarterly\n- Check supplier delivery SLAs\n- Update pricing model before next sprint"
16
+ }
17
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "id": "card-ex-metric",
3
+ "meta": {
4
+ "title": "Total Revenue",
5
+ "tags": [],
6
+ "desc": "Single KPI — sum of all order amounts via JSONata $sum"
7
+ },
8
+ "requires": ["orders"],
9
+ "compute": [
10
+ { "bindTo": "totalRevenue", "expr": "$round($sum(requires.orders.amount), 2)" }
11
+ ],
12
+ "view": {
13
+ "elements": [
14
+ { "kind": "metric", "label": "Revenue", "data": { "bind": "computed_values.totalRevenue" } }
15
+ ],
16
+ "layout": { "board": { "col": 3, "order": 4 }, "canvas": { "x": 320, "y": 320, "w": 180, "h": 120 } }
17
+ },
18
+ "card_data": {}
19
+ }