@bongos/core 1.21.52 → 1.21.54

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 (70) hide show
  1. package/.bongos-core.json +88 -73
  2. package/clients/bongos-client/README.md +1 -1
  3. package/clients/bongos-client/bongos-client.global.js +4 -0
  4. package/clients/bongos-client/index.cjs +4 -0
  5. package/clients/bongos-client/index.d.ts +7 -0
  6. package/clients/bongos-client/index.mjs +4 -0
  7. package/docs/api/openapi.json +135 -3
  8. package/docs/api-reference.md +4 -2
  9. package/docs/copy-inventory.md +23 -11
  10. package/docs/copy-registry.json +142 -13
  11. package/docs/file-map.md +1 -0
  12. package/docs/module-api-changelog.md +4 -0
  13. package/docs/page-readings.json +202 -202
  14. package/modules/hall-ui/public/atlas.html +3 -3
  15. package/modules/hall-ui/public/blockers.html +3 -3
  16. package/modules/hall-ui/public/board-room.html +3 -3
  17. package/modules/hall-ui/public/city.html +3 -3
  18. package/modules/hall-ui/public/collab.html +3 -3
  19. package/modules/hall-ui/public/commands.html +3 -3
  20. package/modules/hall-ui/public/copy-desk.html +3 -3
  21. package/modules/hall-ui/public/craft-mode.js +7 -1
  22. package/modules/hall-ui/public/deploy.html +3 -3
  23. package/modules/hall-ui/public/diagrams.html +3 -3
  24. package/modules/hall-ui/public/drachmae.html +3 -3
  25. package/modules/hall-ui/public/fleet.html +3 -3
  26. package/modules/hall-ui/public/gate.html +3 -3
  27. package/modules/hall-ui/public/goal-map.html +3 -3
  28. package/modules/hall-ui/public/goals.html +3 -3
  29. package/modules/hall-ui/public/government.html +3 -3
  30. package/modules/hall-ui/public/idea.html +3 -3
  31. package/modules/hall-ui/public/ideas.html +3 -3
  32. package/modules/hall-ui/public/index.html +3 -3
  33. package/modules/hall-ui/public/lightbulb.js +213 -0
  34. package/modules/hall-ui/public/modules.html +3 -3
  35. package/modules/hall-ui/public/primer.html +3 -3
  36. package/modules/hall-ui/public/profile.html +3 -3
  37. package/modules/hall-ui/public/project-settings.html +3 -3
  38. package/modules/hall-ui/public/ranks.html +3 -3
  39. package/modules/hall-ui/public/roadmap.html +3 -3
  40. package/modules/hall-ui/public/roster.html +3 -3
  41. package/modules/hall-ui/public/sessions.html +3 -3
  42. package/modules/hall-ui/public/settings.html +3 -3
  43. package/modules/hall-ui/public/street-card.css +18 -0
  44. package/modules/hall-ui/public/street-card.js +259 -4
  45. package/modules/hall-ui/public/street-desk.js +11 -7
  46. package/modules/hall-ui/public/street.html +7 -7
  47. package/modules/hall-ui/public/street.js +121 -14
  48. package/modules/hall-ui/public/studio.html +3 -3
  49. package/modules/hall-ui/public/style.css +1 -0
  50. package/modules/hall-ui/public/task.html +3 -3
  51. package/modules/hall-ui/public/thinking.html +3 -3
  52. package/modules/hall-ui/public/tweak-editor.html +3 -3
  53. package/modules/hall-ui/public/watch.html +3 -3
  54. package/modules/hall-ui/public/work.html +3 -3
  55. package/modules/hall-ui/records/craft-mode.md +8 -0
  56. package/modules/hall-ui/records/governor-street.md +15 -0
  57. package/modules/page-notes/db.js +34 -0
  58. package/modules/page-notes/notes.js +54 -8
  59. package/modules/page-notes/routes/page-notes.js +49 -1
  60. package/modules/page-notes/split.js +39 -8
  61. package/package-lock.json +2 -2
  62. package/package.json +1 -1
  63. package/release-notes.json +16 -0
  64. package/src/module-api.js +1 -1
  65. package/tests/hall_street_desk.mjs +370 -5
  66. package/tests/hall_tweak_editor.mjs +1 -1
  67. package/tests/lightbulb.mjs +385 -0
  68. package/tests/page_notes_panel.mjs +3 -1
  69. package/tests/paintbrush.mjs +2 -1
  70. package/tests/privacy_matrix.mjs +689 -0
@@ -91,9 +91,9 @@
91
91
 
92
92
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
93
93
 
94
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
95
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
96
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
94
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
95
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
96
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
97
97
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
98
98
  <script src="/builders/palette.js" defer></script>
99
99
  <script src="/builders/atlas.js?v=2026-09-02-index" defer></script>
@@ -50,9 +50,9 @@
50
50
 
51
51
  <!-- The app shell (sidebar + top bar). Dependency-free; loaded FIRST so the
52
52
  chrome exists before the page script runs. -->
53
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
54
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
55
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
53
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
54
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
55
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
56
56
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
57
57
  <script src="/builders/palette.js" defer></script>
58
58
  <!-- shared frontend toolkit (window.OTB — rank labels, number formats) + the
@@ -60,9 +60,9 @@
60
60
 
61
61
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
62
62
 
63
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
64
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
65
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
63
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
64
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
65
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
66
66
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
67
67
  <script src="/builders/palette.js" defer></script>
68
68
  <script src="/builders/dom-utils.js?v=2026-06-16-board"></script>
@@ -83,9 +83,9 @@
83
83
  </div>
84
84
  </div>
85
85
 
86
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
87
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
88
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
86
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
87
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
88
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
89
89
  <script src="/builders/palette.js" defer></script>
90
90
  <script src="/builders/city-draw.js?v=2026-10-04-pins1"></script>
91
91
  <script src="/builders/city.js?v=2026-10-04-pins1"></script>
@@ -148,9 +148,9 @@
148
148
 
149
149
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
150
150
 
151
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
152
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
153
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
151
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
152
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
153
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
154
154
  <script src="/builders/palette.js" defer></script>
155
155
  <script src="/builders/dom-utils.js?v=2026-06-23-contrib"></script>
156
156
  <script src="/builders/collab-lib.js?v=2026-09-24-archive"></script>
@@ -54,9 +54,9 @@
54
54
 
55
55
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
56
56
 
57
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
58
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
59
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
57
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
58
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
59
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
60
60
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
61
61
  <script src="/builders/palette.js" defer></script>
62
62
  <script src="/builders/dom-utils.js?v=2026-06-14-domutils"></script>
@@ -177,9 +177,9 @@
177
177
 
178
178
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
179
179
 
180
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
181
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
182
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
180
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
181
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
182
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
183
183
  <script src="/builders/palette.js" defer></script>
184
184
  <script src="/builders/dom-utils.js?v=2026-06-23-contrib"></script>
185
185
  <script src="/builders/hall-kit.js"></script>
@@ -31,6 +31,7 @@
31
31
  ideating: '<path d="M6 12.5h4M6.6 14.5h2.8M8 1.8a4.2 4.2 0 0 0-2.6 7.5c.6.5 1 1.2 1 2h3.2c0-.8.4-1.5 1-2A4.2 4.2 0 0 0 8 1.8Z"/>',
32
32
  governing: '<path d="M2 6 8 2.5 14 6M3.5 6.5v6M6.5 6.5v6M9.5 6.5v6M12.5 6.5v6M2 13.5h12"/>',
33
33
  brush: '<path d="M13.6 2.4 7.4 8.6"/><path d="M7.4 8.6c-1.3-.7-3-.1-3.4 1.5-.3 1.3-.8 2.2-1.9 2.9 2.4.7 4.6.1 5.6-1.4.6-.9.5-2.1-.3-3Z"/>',
34
+ note: '<path d="M9.5 2.5h-6v11h9v-6"/><path d="M5.5 8h5M5.5 10.5h3.5"/><path d="M12.5 1.5v4M10.5 3.5h4"/>',
34
35
  modes: '<rect x="2.5" y="2.5" width="4.5" height="4.5" rx="1"/><rect x="9" y="2.5" width="4.5" height="4.5" rx="1"/><rect x="2.5" y="9" width="4.5" height="4.5" rx="1"/><rect x="9" y="9" width="4.5" height="4.5" rx="1"/>',
35
36
  };
36
37
  // The four crafts. `short` is the switch's label; `line` is the
@@ -129,7 +130,8 @@
129
130
 
130
131
  // ---------- each mode's tools (task 1004496 onward) ----------
131
132
  // Artistry has two: the palette (a feedback doc, page-notes.js) and the
132
- // paintbrush (the page's words as a wording change, paintbrush.js).
133
+ // paintbrush (the page's words as a wording change, paintbrush.js). Ideating
134
+ // has the lightbulb: text-only notes split into ideas (lightbulb.js).
133
135
  // A tool is a top-bar button beside the switch, shown only in its mode. Its
134
136
  // code is NOT on every page: pressing it loads the tool's own script once
135
137
  // (same ?v as this file) and calls its open(). Cosmetic, like the mode: the
@@ -140,6 +142,10 @@
140
142
  // Task 1004497: this page's words, edited where they stand as a proposed wording change.
141
143
  { id: 'paintbrush', icon: 'brush', short: 'Edit words', label: 'Edit this page\'s words', script: 'paintbrush.js', api: 'OTBPaintbrush' },
142
144
  ],
145
+ // Task 1004498: the ideator's notes about this page, split into ideas (lightbulb.js).
146
+ ideating: [
147
+ { id: 'lightbulb', icon: 'note', short: 'Ideas', label: 'Write ideas about this page', script: 'lightbulb.js', api: 'OTBLightbulb' },
148
+ ],
143
149
  };
144
150
  var SCRIPT_V = (function () {
145
151
  var src = document.currentScript && document.currentScript.src;
@@ -74,9 +74,9 @@
74
74
 
75
75
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
76
76
 
77
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
78
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
79
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
77
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
78
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
79
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
80
80
  <script src="/builders/palette.js" defer></script>
81
81
  <script src="/builders/dom-utils.js?v=2026-06-16-gate"></script>
82
82
  <script src="/builders/hall-kit.js"></script>
@@ -97,9 +97,9 @@
97
97
 
98
98
  <!-- The app shell (sidebar + top bar + footer). Dependency-free; runs at parse
99
99
  time so the chrome exists before the deferred page scripts execute. -->
100
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
101
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
102
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
100
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
101
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
102
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
103
103
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
104
104
  <script src="/builders/palette.js" defer></script>
105
105
  <script src="/builders/diagram-viewer.js?v=2026-06-14-diagviewer-1" defer></script>
@@ -98,9 +98,9 @@
98
98
 
99
99
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
100
100
 
101
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
102
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
103
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
101
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
102
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
103
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
104
104
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
105
105
  <script src="/builders/palette.js" defer></script>
106
106
  <script src="/builders/md-reader.js?v=2026-09-02-mdreader-2"></script>
@@ -54,9 +54,9 @@
54
54
 
55
55
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
56
56
 
57
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
58
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
59
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
57
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
58
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
59
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
60
60
  <script src="/builders/palette.js" defer></script>
61
61
  <script src="/builders/dom-utils.js?v=2026-06-16-gate"></script>
62
62
  <script src="/builders/hall-kit.js"></script>
@@ -77,9 +77,9 @@
77
77
  <div id="gate-modal-root"></div>
78
78
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
79
79
 
80
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
81
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
82
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
80
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
81
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
82
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
83
83
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
84
84
  <script src="/builders/palette.js" defer></script>
85
85
  <script src="/builders/dom-utils.js?v=2026-06-16-gate"></script>
@@ -137,9 +137,9 @@
137
137
  </div>
138
138
  </div>
139
139
 
140
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
141
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
142
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
140
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
141
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
142
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
143
143
  <script src="/builders/palette.js" defer></script>
144
144
 
145
145
  <script src="/builders/idea-objects.js?v=2026-09-27-split"></script>
@@ -230,9 +230,9 @@
230
230
 
231
231
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
232
232
 
233
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
234
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
235
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
233
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
234
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
235
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
236
236
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
237
237
  <script src="/builders/palette.js" defer></script>
238
238
  <script src="/builders/dom-utils.js?v=2026-06-14-domutils"></script>
@@ -134,9 +134,9 @@
134
134
 
135
135
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
136
136
 
137
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
138
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
139
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
137
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
138
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
139
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
140
140
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
141
141
  <script src="/builders/palette.js" defer></script>
142
142
  <script src="/builders/dom-utils.js?v=2026-06-16-gate"></script>
@@ -50,9 +50,9 @@
50
50
 
51
51
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
52
52
 
53
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
54
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
55
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
53
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
54
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
55
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
56
56
  <script src="/builders/palette.js" defer></script>
57
57
  <script src="/builders/dom-utils.js?v=2026-06-23-contrib" defer></script>
58
58
  <!-- task-detail.js still owns the #/idea/N and #/blocker/N overlay, so a ref
@@ -225,9 +225,9 @@
225
225
 
226
226
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
227
227
 
228
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
229
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
230
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
228
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
229
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
230
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
231
231
  <script src="/builders/palette.js" defer></script>
232
232
  <script src="/builders/dom-utils.js?v=2026-06-23-contrib"></script>
233
233
  <!-- task 1003069 (R08) — the quick-filing form's routed result links a task
@@ -106,9 +106,9 @@
106
106
  <script src="/builders/brand-apply.js?v=2026-06-27-r75" defer></script>
107
107
  <!-- The app shell (sidebar + top bar + view router). Dependency-free; loaded
108
108
  BEFORE builders.js so the chrome ids exist when events are wired. -->
109
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush" defer></script>
110
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush" defer></script>
111
- <script src="/builders/shell.js?v=2026-10-04-paintbrush" defer></script>
109
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb" defer></script>
110
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb" defer></script>
111
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb" defer></script>
112
112
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
113
113
  <script src="/builders/palette.js" defer></script>
114
114
  <!-- task 2166: the shared component kit (window.OTBKit) — pager/ledger/rail.
@@ -0,0 +1,213 @@
1
+ // lightbulb.js — the Ideating mode's lightbulb (task 1004498, goal 1000095
2
+ // WA6). Loaded on demand by craft-mode.js when the lightbulb is pressed; never
3
+ // on page load.
4
+ //
5
+ // A watered-down palette (page-notes.js): the same side sheet, text only. The
6
+ // ideator writes about the page they are on and presses "Turn into ideas"; the
7
+ // server's AI split files each point as its own idea under their name, each
8
+ // linking back to this page. Owner decisions, 2026-10-04: the text itself is
9
+ // NOT kept (no reference doc), the unsent text waits in THIS browser only
10
+ // (localStorage, per page), and below the box the panel lists the ideas
11
+ // already filed from this page.
12
+ //
13
+ // The walls are the server's (modules/page-notes). This file only draws.
14
+ (function () {
15
+ 'use strict';
16
+
17
+ var API = '/api/bongos/page-notes/ideas';
18
+ var DRAFT_PREFIX = 'hall-lightbulb:';
19
+ var MIN_TEXT = 20;
20
+
21
+ var sheet = null, returnFocus = null, saveTimer = null, busy = false;
22
+
23
+ function esc(s) {
24
+ return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) {
25
+ return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c];
26
+ });
27
+ }
28
+ function plural(n, one, many) { return n + ' ' + (n === 1 ? one : many); }
29
+ function day(iso) {
30
+ var d = iso ? new Date(iso) : null;
31
+ return d && !isNaN(d) ? d.toLocaleDateString(undefined, { month: 'short', day: 'numeric' }) : '';
32
+ }
33
+ // The same page identity the palette uses, so both tools name a page alike.
34
+ function page() {
35
+ if (window.OTBPageNotes && window.OTBPageNotes.page) return window.OTBPageNotes.page();
36
+ var b = document.body || { dataset: {} };
37
+ var slug = String((b.dataset && b.dataset.page) || 'home').toLowerCase().replace(/[^a-z0-9_-]/g, '-').slice(0, 64) || 'home';
38
+ var title = (b.dataset && b.dataset.pageTitle) || String(document.title || '').split(/\s[—-]\s/)[0] || slug;
39
+ var path = String((window.location && window.location.pathname) || '/').replace(/[^A-Za-z0-9/_.-]/g, '').slice(0, 200) || '/';
40
+ return { id: 'builders:' + slug, path: path, title: title.slice(0, 120) };
41
+ }
42
+
43
+ // The unsent text, kept in this browser per page. Storage that throws simply
44
+ // keeps nothing; the panel still works.
45
+ function draftKey() { return DRAFT_PREFIX + page().path; }
46
+ function readDraft() { try { return window.localStorage.getItem(draftKey()) || ''; } catch (_) { return ''; } }
47
+ function writeDraft(text) {
48
+ try {
49
+ if (text) window.localStorage.setItem(draftKey(), text);
50
+ else window.localStorage.removeItem(draftKey());
51
+ } catch (_) { /* private mode */ }
52
+ }
53
+
54
+ function request(method, path, body) {
55
+ var opts = { method: method, credentials: 'same-origin', headers: {} };
56
+ if (body !== undefined) { opts.headers['content-type'] = 'application/json'; opts.body = JSON.stringify(body); }
57
+ return fetch(API + path, opts).then(function (r) {
58
+ return r.json().catch(function () { return {}; }).then(function (j) {
59
+ if (!r.ok) {
60
+ var e = new Error((j && j.error && j.error.message) || (r.status === 401 ? 'Sign in to file ideas.' : 'That did not work. Try again in a moment.'));
61
+ e.status = r.status;
62
+ throw e;
63
+ }
64
+ return j;
65
+ });
66
+ });
67
+ }
68
+
69
+ // ---------- the sheet ----------
70
+ function shellHtml(p) {
71
+ return '<div class="pn__panel" role="dialog" aria-modal="true" aria-labelledby="lb-title">' +
72
+ '<div class="pn__head">' +
73
+ '<p class="pn__eyebrow">Ideas · ' + esc(p.title) + '</p>' +
74
+ '<h2 class="pn__title" id="lb-title">What could this page become?</h2>' +
75
+ '<button class="pn__close" type="button" data-lb-close aria-label="Close">' +
76
+ '<svg viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M5 5l8 8M13 5l-8 8"/></svg></button>' +
77
+ '</div>' +
78
+ '<div class="pn__body" id="lb-body"></div>' +
79
+ '</div>';
80
+ }
81
+ function writeHtml(text) {
82
+ return '<label class="pn__label" for="lb-text">Your ideas</label>' +
83
+ '<textarea class="pn__text" id="lb-text" rows="10" placeholder="Write what this page made you think of. Each separate point becomes its own idea.">' + esc(text) + '</textarea>' +
84
+ '<p class="pn__error" id="lb-error" role="alert"></p>' +
85
+ '<div class="pn__foot">' +
86
+ '<p class="pn__hint">When you submit, an AI splits this into separate ideas, filed under your name and linked to this page. The text itself is not kept.</p>' +
87
+ '<button class="pn__submit" type="button" data-lb-submit>Turn into ideas</button>' +
88
+ '</div>' +
89
+ '<section class="pn__list" aria-labelledby="lb-list-h"><h3 class="pn__list-h" id="lb-list-h">Ideas from this page</h3>' +
90
+ '<div id="lb-list"><p class="pn__quiet">Loading…</p></div>' +
91
+ '</section>';
92
+ }
93
+ function listHtml(ideas) {
94
+ if (!ideas || !ideas.length) return '<p class="pn__quiet">None yet. Yours will be the first.</p>';
95
+ return '<ul class="pn__rows">' + ideas.map(function (i) {
96
+ return '<li><a class="pn__row" href="/#/idea/' + esc(i.id) + '">' +
97
+ '<span class="pn__row-meta">' + esc(i.author_name || 'Someone') + ' · ' + esc(day(i.captured_at)) + '</span>' +
98
+ '<span class="pn__row-text">' + esc(i.title) + '</span>' +
99
+ '</a></li>';
100
+ }).join('') + '</ul>';
101
+ }
102
+ function doneHtml(ideas) {
103
+ return '<p class="pn__done" tabindex="-1" id="lb-done">Filed as ' + esc(plural(ideas.length, 'idea', 'ideas')) + ' under your name.</p>' +
104
+ '<ul class="pn__ideas">' + ideas.map(function (i) {
105
+ return '<li><a href="/#/idea/' + esc(i.id) + '">' + esc(i.title) + '</a></li>';
106
+ }).join('') + '</ul>' +
107
+ '<p class="pn__hint">Each one links back to this page.</p>' +
108
+ '<button class="pn__back" type="button" data-lb-new>Write more</button>';
109
+ }
110
+
111
+ function body() { return sheet && sheet.querySelector('#lb-body'); }
112
+ function setError(msg) { var e = sheet && sheet.querySelector('#lb-error'); if (e) e.textContent = msg || ''; }
113
+ function currentText() { var t = sheet && sheet.querySelector('#lb-text'); return t ? t.value : readDraft(); }
114
+
115
+ function refreshList() {
116
+ var p = page();
117
+ return request('GET', '?page_path=' + encodeURIComponent(p.path)).then(function (j) {
118
+ var l = sheet && sheet.querySelector('#lb-list');
119
+ if (l) l.innerHTML = listHtml(j.ideas || []);
120
+ }, function () {
121
+ var l = sheet && sheet.querySelector('#lb-list');
122
+ if (l) l.innerHTML = '<p class="pn__quiet">The earlier ideas could not be loaded. Reload the page to try again.</p>';
123
+ });
124
+ }
125
+ function showWrite() {
126
+ var b = body();
127
+ if (!b) return;
128
+ b.innerHTML = writeHtml(readDraft());
129
+ var t = b.querySelector('#lb-text');
130
+ if (t) { t.addEventListener('input', queueSave); t.focus(); }
131
+ refreshList();
132
+ }
133
+ function queueSave() {
134
+ if (saveTimer) clearTimeout(saveTimer);
135
+ saveTimer = setTimeout(saveNow, 400);
136
+ }
137
+ function saveNow() {
138
+ if (saveTimer) { clearTimeout(saveTimer); saveTimer = null; }
139
+ if (sheet && sheet.querySelector('#lb-text')) writeDraft(currentText().trim() ? currentText() : '');
140
+ }
141
+ function submit() {
142
+ if (busy) return;
143
+ setError('');
144
+ saveNow();
145
+ var text = currentText().trim();
146
+ if (text.length < MIN_TEXT) { setError('Write a little more first: a sentence or two about the idea.'); return; }
147
+ var btn = sheet.querySelector('[data-lb-submit]');
148
+ var t = sheet.querySelector('#lb-text');
149
+ busy = true;
150
+ if (btn) { btn.disabled = true; btn.textContent = 'Splitting into ideas…'; }
151
+ if (t) t.readOnly = true;
152
+ var p = page();
153
+ request('POST', '', { page_id: p.id, page_path: p.path, page_title: p.title, body_md: text }).then(function (j) {
154
+ busy = false;
155
+ writeDraft('');
156
+ var b = body();
157
+ if (!b) return;
158
+ b.innerHTML = doneHtml(j.ideas || []);
159
+ var d = b.querySelector('#lb-done');
160
+ if (d && d.focus) d.focus();
161
+ }, function (e) {
162
+ busy = false;
163
+ if (btn) { btn.disabled = false; btn.textContent = 'Turn into ideas'; }
164
+ if (t) t.readOnly = false;
165
+ setError(e.message);
166
+ });
167
+ }
168
+
169
+ function onClick(e) {
170
+ if (e.target === sheet) { close(); return; }
171
+ var btn = e.target.closest && e.target.closest('button');
172
+ if (!btn) return;
173
+ if (btn.hasAttribute('data-lb-close')) close();
174
+ else if (btn.hasAttribute('data-lb-submit')) submit();
175
+ else if (btn.hasAttribute('data-lb-new')) showWrite();
176
+ }
177
+ function onKey(e) {
178
+ if (!sheet) return;
179
+ if (e.key === 'Escape') { e.preventDefault(); close(); return; }
180
+ if (e.key !== 'Tab') return;
181
+ var f = Array.prototype.slice.call(sheet.querySelectorAll('button, textarea, a[href]')).filter(function (x) { return !x.disabled; });
182
+ if (!f.length) return;
183
+ if (e.shiftKey && document.activeElement === f[0]) { e.preventDefault(); f[f.length - 1].focus(); }
184
+ else if (!e.shiftKey && document.activeElement === f[f.length - 1]) { e.preventDefault(); f[0].focus(); }
185
+ }
186
+ function open() {
187
+ if (sheet) return;
188
+ returnFocus = document.activeElement;
189
+ sheet = document.createElement('div');
190
+ sheet.className = 'pn';
191
+ sheet.id = 'lightbulb';
192
+ sheet.innerHTML = shellHtml(page());
193
+ sheet.addEventListener('click', onClick);
194
+ document.addEventListener('keydown', onKey, true);
195
+ document.body.appendChild(sheet);
196
+ document.documentElement.classList.add('pn-open');
197
+ showWrite();
198
+ }
199
+ // Closing keeps the unsent text in this browser; a submit already sent still
200
+ // files on the server.
201
+ function close() {
202
+ if (!sheet) return;
203
+ saveNow();
204
+ document.removeEventListener('keydown', onKey, true);
205
+ if (sheet.parentNode) sheet.parentNode.removeChild(sheet);
206
+ sheet = null;
207
+ document.documentElement.classList.remove('pn-open');
208
+ if (returnFocus && returnFocus.focus) { try { returnFocus.focus(); } catch (_) { /* gone */ } }
209
+ returnFocus = null;
210
+ }
211
+
212
+ window.OTBLightbulb = { open: open, close: close, listHtml: listHtml };
213
+ })();
@@ -101,9 +101,9 @@
101
101
 
102
102
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
103
103
 
104
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
105
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
106
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
104
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
105
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
106
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
107
107
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
108
108
  <script src="/builders/palette.js" defer></script>
109
109
  <script src="/builders/dom-utils.js?v=2026-06-23-contrib"></script>
@@ -115,9 +115,9 @@
115
115
 
116
116
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
117
117
 
118
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
119
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
120
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
118
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
119
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
120
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
121
121
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
122
122
  <script src="/builders/palette.js" defer></script>
123
123
  <!-- the shared markdown reader (window.OTBMdReader) — primer.js renders through
@@ -206,9 +206,9 @@
206
206
 
207
207
  <!-- The app shell (sidebar + top bar). Dependency-free; loaded FIRST so the
208
208
  chrome exists before the page script runs. -->
209
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
210
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
211
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
209
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
210
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
211
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
212
212
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
213
213
  <script src="/builders/palette.js" defer></script>
214
214
  <!-- shared frontend toolkit (window.OTB) — loaded before profile.js, which pulls from it. -->
@@ -58,9 +58,9 @@
58
58
 
59
59
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
60
60
 
61
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
62
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
63
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
61
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
62
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
63
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
64
64
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
65
65
  <script src="/builders/palette.js" defer></script>
66
66
  <script src="/builders/dom-utils.js?v=2026-06-16-gate"></script>
@@ -77,9 +77,9 @@
77
77
 
78
78
  <!-- The app shell (sidebar + top bar). Dependency-free; loaded FIRST so the
79
79
  chrome exists before the page script runs. -->
80
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
81
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
82
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
80
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
81
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
82
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
83
83
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
84
84
  <script src="/builders/palette.js" defer></script>
85
85
  <!-- shared frontend toolkit (window.OTB) — loaded before ranks.js, which pulls from it. -->
@@ -41,9 +41,9 @@
41
41
 
42
42
  <div id="toast" class="toast" role="status" aria-live="polite" data-visible="0"></div>
43
43
 
44
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
45
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
46
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
44
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
45
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
46
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
47
47
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
48
48
  <script src="/builders/palette.js" defer></script>
49
49
  <script src="/builders/dom-utils.js?v=2026-06-14-domutils"></script>
@@ -53,9 +53,9 @@
53
53
 
54
54
  <!-- The app shell (sidebar + top bar). Dependency-free; loaded FIRST so the
55
55
  chrome exists before the page script runs. -->
56
- <script src="/builders/shell-trail.js?v=2026-10-04-paintbrush"></script>
57
- <script src="/builders/craft-mode.js?v=2026-10-04-paintbrush"></script>
58
- <script src="/builders/shell.js?v=2026-10-04-paintbrush"></script>
56
+ <script src="/builders/shell-trail.js?v=2026-10-04-lightbulb"></script>
57
+ <script src="/builders/craft-mode.js?v=2026-10-04-lightbulb"></script>
58
+ <script src="/builders/shell.js?v=2026-10-04-lightbulb"></script>
59
59
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
60
60
  <script src="/builders/palette.js" defer></script>
61
61
  <!-- shared frontend toolkit (window.OTB — rank labels, number formats) + the