create-pmos 0.399.0 → 0.401.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.
- package/package.json +30 -25
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +2 -2
- package/workspace/briefing-premium-board-test.js +3 -3
- package/workspace/briefing-premium-doc-edit-test.js +2 -8
- package/workspace/briefing-premium-sources-test.js +2 -0
- package/workspace/briefing-premium-test.js +6 -2
- package/workspace/briefing-premium-work-test.js +9 -4
- package/workspace/c3-capture-test.js +0 -17
- package/workspace/changelog.json +29 -0
- package/workspace/guide/briefing-premium.md +2 -2
- package/workspace/guide/home.md +24 -3
- package/workspace/guide/layout.md +2 -2
- package/workspace/guide/notes.md +2 -2
- package/workspace/guide/phone-companion.md +1 -1
- package/workspace/lib/core-docs.js +2 -2
- package/workspace/lib/route-modules.js +1 -9
- package/workspace/lib/routes-phone-day.js +18 -9
- package/workspace/lib/routes-slash.js +95 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -2
- package/workspace/premium-chat-goal-view-test.js +1 -1
- package/workspace/premium-chat-term-test.js +0 -10
- package/workspace/premium-menu-rows-test.js +1 -1
- package/workspace/premium-phone-card-test.js +8 -3
- package/workspace/premium-vw-cal-test.js +4 -1
- package/workspace/premium-vw-doc-test.js +1 -8
- package/workspace/premium-work-depth-test.js +2 -3
- package/workspace/public/capture.html +23 -0
- package/workspace/public/pm/c3-base.js +47 -0
- package/workspace/public/pm/c3-capture.js +1 -1
- package/workspace/public/pm/c3-ini-ui.js +1 -1
- package/workspace/public/pm/c3-sheet.js +1 -1
- package/workspace/public/pm/c3-toast.js +1 -1
- package/workspace/public/pm/console3.css +3 -0
- package/workspace/public/pm/cozy-home.css +21 -6
- package/workspace/public/pm/cozy-today.css +4 -3
- package/workspace/public/pm/cozy-viewer.js +4 -2
- package/workspace/public/pm/cozy.css +9 -0
- package/workspace/public/pm/goal-chat.js +5 -1
- package/workspace/public/pm/home-app.js +65 -33
- package/workspace/public/pm/home-chat.js +34 -29
- package/workspace/public/pm/home-data.js +10 -2
- package/workspace/public/pm/home-dictate.js +7 -4
- package/workspace/public/pm/home-ini.js +13 -3
- package/workspace/public/pm/home-list.js +18 -10
- package/workspace/public/pm/home-more.js +2 -2
- package/workspace/public/pm/home-phone-card.js +9 -4
- package/workspace/public/pm/home-review.js +2 -3
- package/workspace/public/pm/home-today.js +11 -8
- package/workspace/public/pm/home-work.js +13 -8
- package/workspace/public/pm/note-dock.js +1 -2
- package/workspace/public/pm/notes-links.js +1 -2
- package/workspace/public/pm/notes-task.js +3 -4
- package/workspace/public/pm/premium-board.js +1 -1
- package/workspace/public/pm/premium-initiative-head.js +3 -3
- package/workspace/public/pm/premium-vw-doc.css +20 -2
- package/workspace/public/pm/premium-vw-doc.js +22 -7
- package/workspace/public/pm/premium-vw-item.css +6 -0
- package/workspace/public/pm/view-notes.js +2 -2
- package/workspace/replaced-tests.json +435 -0
- package/workspace/run-tests.js +323 -28
- package/workspace/server.js +15 -10
- package/workspace/test-files.json +4 -140
- package/workspace/test-lists/base.json +1 -2
- package/workspace/test-lists/c3-desktop-light-load.json +1 -2
- package/workspace/test-lists/c3-initiative-boards.json +1 -2
- package/workspace/test-lists/c3-meeting-focus.json +2 -12
- package/workspace/test-lists/c3-work-agent.json +1 -2
- package/workspace/test-lists/calendar-tidy-up.json +1 -2
- package/workspace/test-lists/console3-reports.json +1 -2
- package/workspace/test-lists/docs-three-way-sync.json +1 -2
- package/workspace/test-lists/extension-capture.json +5 -0
- package/workspace/test-lists/jira-wbs.json +1 -2
- package/workspace/test-lists/legacy-cleanup-a.json +9 -0
- package/workspace/test-lists/meeting-material.json +1 -2
- package/workspace/test-lists/meeting-notes.json +2 -36
- package/workspace/test-lists/meeting-replay.json +1 -2
- package/workspace/test-lists/mm-capture.json +2 -12
- package/workspace/test-lists/my-work.json +2 -10
- package/workspace/test-lists/onboarding-firstrun.json +2 -12
- package/workspace/test-lists/people-directory.json +1 -2
- package/workspace/test-lists/run2-a.json +1 -2
- package/workspace/test-lists/run2-d.json +2 -19
- package/workspace/test-lists/run3-b.json +1 -2
- package/workspace/test-lists/run3-c.json +2 -12
- package/workspace/test-lists/run4-b.json +1 -2
- package/workspace/test-lists/run4-d.json +1 -5
- package/workspace/test-lists/run5-c.json +1 -11
- package/workspace/test-lists/run6.json +1 -5
- package/workspace/test-lists/workspace-launch-flags.json +2 -12
- package/workspace/test-lists/workspace-profile-detection.json +2 -10
- package/workspace/test-timings.json +242 -123
- package/workspace/c3-briefing-test.js +0 -136
- package/workspace/c3-core-docs-test.js +0 -170
- package/workspace/c3-driver-fixture.js +0 -64
- package/workspace/c3-driver-test.js +0 -169
- package/workspace/c3-foundation-test.js +0 -163
- package/workspace/c3-ib-items-test.js +0 -114
- package/workspace/c3-ib-more-test.js +0 -146
- package/workspace/c3-ib-triage-backlog-test.js +0 -128
- package/workspace/c3-ini-harness.js +0 -66
- package/workspace/c3-ini-life-test.js +0 -167
- package/workspace/c3-initiatives-test.js +0 -186
- package/workspace/c3-light-load-test.js +0 -112
- package/workspace/c3-one-home-test.js +0 -149
- package/workspace/c3-phone-test.js +0 -289
- package/workspace/c3-quiet-test.js +0 -157
- package/workspace/c3-report-design-real-test.js +0 -264
- package/workspace/c3-report-design-test.js +0 -442
- package/workspace/c3-report-setup-test.js +0 -192
- package/workspace/c3-report-structure-real-test.js +0 -248
- package/workspace/c3-report-structure-test.js +0 -397
- package/workspace/c3-reports-test.js +0 -288
- package/workspace/c3-scan-test.js +0 -517
- package/workspace/c3-sessions-panel-test.js +0 -365
- package/workspace/c3-settings-test.js +0 -204
- package/workspace/c3-updates-test.js +0 -131
- package/workspace/c3-work-test.js +0 -260
- package/workspace/cut-stub.js +0 -40
- package/workspace/first-paint-audit.js +0 -160
- package/workspace/lib/c3-full-console.js +0 -15
- package/workspace/lib/engine/derived/trust.js +0 -3
- package/workspace/lib/engine/plan-forecast.js +0 -342
- package/workspace/lib/engine/report-families.js +0 -175
- package/workspace/lib/engine/truth-table.js +0 -57
- package/workspace/lib/routes-c3-init.js +0 -54
- package/workspace/lib/routes-c3-life.js +0 -120
- package/workspace/lib/routes-c3-timeline.js +0 -192
- package/workspace/lib/routes-forecast.js +0 -86
- package/workspace/lib/routes-releases.js +0 -130
- package/workspace/lib/routes-report-facts.js +0 -85
- package/workspace/lib/routes-report-families.js +0 -33
- package/workspace/lib/routes-signals.js +0 -51
- package/workspace/lib/routes-timeline.js +0 -197
- package/workspace/public/c3.html +0 -35
- package/workspace/public/index.html +0 -156
- package/workspace/public/pm/app.js +0 -831
- package/workspace/public/pm/bd-board.js +0 -159
- package/workspace/public/pm/bd-drag.js +0 -59
- package/workspace/public/pm/bd-model.js +0 -152
- package/workspace/public/pm/bd-timeline.js +0 -233
- package/workspace/public/pm/bd-tree.js +0 -244
- package/workspace/public/pm/board-copy.js +0 -59
- package/workspace/public/pm/board-read.js +0 -38
- package/workspace/public/pm/branches-sheet.js +0 -56
- package/workspace/public/pm/breakdown-api.js +0 -58
- package/workspace/public/pm/breakdown-copy.js +0 -138
- package/workspace/public/pm/briefing-deck.js +0 -441
- package/workspace/public/pm/briefing-model.js +0 -251
- package/workspace/public/pm/c3-ambient.js +0 -100
- package/workspace/public/pm/c3-audience-link.js +0 -21
- package/workspace/public/pm/c3-audience.js +0 -46
- package/workspace/public/pm/c3-boot.js +0 -13
- package/workspace/public/pm/c3-breakdown.js +0 -240
- package/workspace/public/pm/c3-brief-data.js +0 -11
- package/workspace/public/pm/c3-brief-mentions.js +0 -137
- package/workspace/public/pm/c3-brief-needs.js +0 -288
- package/workspace/public/pm/c3-brief-pulse.js +0 -112
- package/workspace/public/pm/c3-brief-summary.js +0 -139
- package/workspace/public/pm/c3-brief-today.js +0 -79
- package/workspace/public/pm/c3-brief.js +0 -279
- package/workspace/public/pm/c3-cal-strategy.js +0 -529
- package/workspace/public/pm/c3-calendar.js +0 -965
- package/workspace/public/pm/c3-calpop.js +0 -111
- package/workspace/public/pm/c3-case.js +0 -196
- package/workspace/public/pm/c3-core-docs.css +0 -18
- package/workspace/public/pm/c3-core-docs.js +0 -236
- package/workspace/public/pm/c3-daypart.js +0 -176
- package/workspace/public/pm/c3-demo-boards.js +0 -764
- package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
- package/workspace/public/pm/c3-demo-brief-page.js +0 -70
- package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
- package/workspace/public/pm/c3-demo-cal2.js +0 -66
- package/workspace/public/pm/c3-demo-cal3.js +0 -173
- package/workspace/public/pm/c3-demo-cal4.js +0 -169
- package/workspace/public/pm/c3-demo-cal5.js +0 -52
- package/workspace/public/pm/c3-demo-coredocs.js +0 -221
- package/workspace/public/pm/c3-demo-data.js +0 -552
- package/workspace/public/pm/c3-demo-focus.js +0 -181
- package/workspace/public/pm/c3-demo-init.js +0 -430
- package/workspace/public/pm/c3-demo-life.js +0 -77
- package/workspace/public/pm/c3-demo-material.js +0 -58
- package/workspace/public/pm/c3-demo-misc2.js +0 -34
- package/workspace/public/pm/c3-demo-phone.js +0 -48
- package/workspace/public/pm/c3-demo-plan2.js +0 -30
- package/workspace/public/pm/c3-demo-rd.js +0 -432
- package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
- package/workspace/public/pm/c3-demo-rep2.js +0 -130
- package/workspace/public/pm/c3-demo-rep3.js +0 -138
- package/workspace/public/pm/c3-demo-rs.js +0 -287
- package/workspace/public/pm/c3-demo-term.js +0 -153
- package/workspace/public/pm/c3-demo-time.js +0 -49
- package/workspace/public/pm/c3-demo-work-ix.js +0 -32
- package/workspace/public/pm/c3-demo.js +0 -131
- package/workspace/public/pm/c3-design-studio.js +0 -369
- package/workspace/public/pm/c3-doc-formats.js +0 -153
- package/workspace/public/pm/c3-doc-sheet.js +0 -1230
- package/workspace/public/pm/c3-dock.js +0 -206
- package/workspace/public/pm/c3-docs.js +0 -291
- package/workspace/public/pm/c3-driver-work.js +0 -110
- package/workspace/public/pm/c3-driver.css +0 -18
- package/workspace/public/pm/c3-driver.js +0 -298
- package/workspace/public/pm/c3-focus.css +0 -304
- package/workspace/public/pm/c3-focus.js +0 -983
- package/workspace/public/pm/c3-ib-docs.js +0 -92
- package/workspace/public/pm/c3-ib-initiatives.js +0 -201
- package/workspace/public/pm/c3-ib-items.js +0 -210
- package/workspace/public/pm/c3-ib-releases.js +0 -48
- package/workspace/public/pm/c3-ib-sprints.js +0 -201
- package/workspace/public/pm/c3-ib-triage.js +0 -177
- package/workspace/public/pm/c3-ii-tabs.js +0 -252
- package/workspace/public/pm/c3-ini-life.css +0 -34
- package/workspace/public/pm/c3-ini-life.js +0 -379
- package/workspace/public/pm/c3-ini-records.js +0 -197
- package/workspace/public/pm/c3-ini-timeline.js +0 -278
- package/workspace/public/pm/c3-ini-work.js +0 -139
- package/workspace/public/pm/c3-init-extras.js +0 -170
- package/workspace/public/pm/c3-initiatives.js +0 -852
- package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
- package/workspace/public/pm/c3-look.js +0 -27
- package/workspace/public/pm/c3-material.css +0 -22
- package/workspace/public/pm/c3-material.js +0 -321
- package/workspace/public/pm/c3-md.js +0 -3
- package/workspace/public/pm/c3-misc-panels.js +0 -89
- package/workspace/public/pm/c3-new-session.js +0 -110
- package/workspace/public/pm/c3-notes.js +0 -751
- package/workspace/public/pm/c3-phone-boot.js +0 -47
- package/workspace/public/pm/c3-phone-detail.js +0 -97
- package/workspace/public/pm/c3-phone-model.js +0 -3
- package/workspace/public/pm/c3-phone.css +0 -66
- package/workspace/public/pm/c3-phone.js +0 -444
- package/workspace/public/pm/c3-plan-panels.js +0 -163
- package/workspace/public/pm/c3-plan.js +0 -193
- package/workspace/public/pm/c3-quiet.css +0 -113
- package/workspace/public/pm/c3-quiet.js +0 -177
- package/workspace/public/pm/c3-replay.css +0 -133
- package/workspace/public/pm/c3-replay.js +0 -429
- package/workspace/public/pm/c3-report-deck.css +0 -163
- package/workspace/public/pm/c3-report-deck.js +0 -598
- package/workspace/public/pm/c3-report-frame.css +0 -20
- package/workspace/public/pm/c3-report-print.css +0 -20
- package/workspace/public/pm/c3-report-setup.css +0 -67
- package/workspace/public/pm/c3-report-setup.js +0 -298
- package/workspace/public/pm/c3-report-store.js +0 -244
- package/workspace/public/pm/c3-report-structure.css +0 -44
- package/workspace/public/pm/c3-report-structure.js +0 -473
- package/workspace/public/pm/c3-reports.css +0 -68
- package/workspace/public/pm/c3-reports.js +0 -377
- package/workspace/public/pm/c3-roadmap.js +0 -249
- package/workspace/public/pm/c3-scan-api.js +0 -167
- package/workspace/public/pm/c3-scan-next.js +0 -248
- package/workspace/public/pm/c3-scan-setup.js +0 -313
- package/workspace/public/pm/c3-scan-words.js +0 -41
- package/workspace/public/pm/c3-scan.css +0 -74
- package/workspace/public/pm/c3-scan.js +0 -93
- package/workspace/public/pm/c3-session-chat.js +0 -103
- package/workspace/public/pm/c3-session-conv.js +0 -165
- package/workspace/public/pm/c3-session-term.js +0 -216
- package/workspace/public/pm/c3-settings.css +0 -85
- package/workspace/public/pm/c3-settings.js +0 -1045
- package/workspace/public/pm/c3-shell.js +0 -628
- package/workspace/public/pm/c3-signals.js +0 -196
- package/workspace/public/pm/c3-strategy-panels.js +0 -45
- package/workspace/public/pm/c3-swipe.js +0 -230
- package/workspace/public/pm/c3-terminal-data.js +0 -48
- package/workspace/public/pm/c3-terminal-edge.js +0 -91
- package/workspace/public/pm/c3-terminal-icons.js +0 -40
- package/workspace/public/pm/c3-terminal-results.js +0 -141
- package/workspace/public/pm/c3-terminal.js +0 -52
- package/workspace/public/pm/c3-tickets.js +0 -163
- package/workspace/public/pm/c3-timeline.js +0 -201
- package/workspace/public/pm/calendar-views.js +0 -1049
- package/workspace/public/pm/console3-lift.md +0 -220
- package/workspace/public/pm/cozy-home.js +0 -172
- package/workspace/public/pm/cozy-initiative.css +0 -138
- package/workspace/public/pm/cycle-review.js +0 -125
- package/workspace/public/pm/data.js +0 -1577
- package/workspace/public/pm/dest-board.js +0 -444
- package/workspace/public/pm/dest-docs.js +0 -530
- package/workspace/public/pm/dest-initiatives.js +0 -162
- package/workspace/public/pm/dest-mywork.js +0 -307
- package/workspace/public/pm/dest-notes.js +0 -537
- package/workspace/public/pm/dest-people.js +0 -449
- package/workspace/public/pm/dest-reports.js +0 -383
- package/workspace/public/pm/dest-settings.js +0 -601
- package/workspace/public/pm/dest-today.js +0 -267
- package/workspace/public/pm/display-word.js +0 -56
- package/workspace/public/pm/doc-editor.js +0 -473
- package/workspace/public/pm/doc-graph.js +0 -272
- package/workspace/public/pm/doc-health-panel.js +0 -110
- package/workspace/public/pm/doc-rail.js +0 -167
- package/workspace/public/pm/doc-remote.js +0 -180
- package/workspace/public/pm/dock-sessions.js +0 -472
- package/workspace/public/pm/dock.js +0 -216
- package/workspace/public/pm/fixture.js +0 -821
- package/workspace/public/pm/flag-picker.js +0 -104
- package/workspace/public/pm/frame-copy.js +0 -278
- package/workspace/public/pm/freshness-line.js +0 -149
- package/workspace/public/pm/handoff-box.js +0 -82
- package/workspace/public/pm/initiative-list.js +0 -235
- package/workspace/public/pm/initiative-sheet.js +0 -331
- package/workspace/public/pm/initiatives-api.js +0 -95
- package/workspace/public/pm/initiatives-copy.js +0 -287
- package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
- package/workspace/public/pm/initiatives-timeline.js +0 -410
- package/workspace/public/pm/initiatives-ui.js +0 -291
- package/workspace/public/pm/item-sheet.js +0 -268
- package/workspace/public/pm/keep-card.js +0 -204
- package/workspace/public/pm/lifecycle-lens-model.js +0 -246
- package/workspace/public/pm/lifecycle-lens.js +0 -276
- package/workspace/public/pm/lifecycle.js +0 -111
- package/workspace/public/pm/mobile.css +0 -366
- package/workspace/public/pm/mobile.js +0 -581
- package/workspace/public/pm/modes-live.js +0 -453
- package/workspace/public/pm/modes.js +0 -147
- package/workspace/public/pm/my-work-card.js +0 -51
- package/workspace/public/pm/my-work-data.js +0 -36
- package/workspace/public/pm/new-initiative-sheet.js +0 -169
- package/workspace/public/pm/next-step-ui.js +0 -190
- package/workspace/public/pm/outbox-panel.js +0 -125
- package/workspace/public/pm/palette-copy.js +0 -55
- package/workspace/public/pm/palette.js +0 -343
- package/workspace/public/pm/panel-breakdown.js +0 -702
- package/workspace/public/pm/panel-cockpit.js +0 -425
- package/workspace/public/pm/panel-detail.js +0 -1513
- package/workspace/public/pm/panel-initiatives.js +0 -929
- package/workspace/public/pm/panel-newsess.js +0 -709
- package/workspace/public/pm/panel-repos.js +0 -741
- package/workspace/public/pm/panel-tabs.js +0 -1506
- package/workspace/public/pm/panel-trees.js +0 -204
- package/workspace/public/pm/people-link.js +0 -106
- package/workspace/public/pm/phone-deck.js +0 -167
- package/workspace/public/pm/pm-work-view.js +0 -1533
- package/workspace/public/pm/portfolio-report.js +0 -61
- package/workspace/public/pm/premium-acts.js +0 -280
- package/workspace/public/pm/premium-brief.js +0 -111
- package/workspace/public/pm/premium-chat.js +0 -22
- package/workspace/public/pm/premium-doc-sheet.js +0 -312
- package/workspace/public/pm/premium-initiative.js +0 -324
- package/workspace/public/pm/premium-insights.css +0 -228
- package/workspace/public/pm/premium-metric-tiles.js +0 -68
- package/workspace/public/pm/premium-report-brief.js +0 -132
- package/workspace/public/pm/premium-vw-rec.js +0 -67
- package/workspace/public/pm/premium-wide.css +0 -30
- package/workspace/public/pm/print.css +0 -44
- package/workspace/public/pm/provider-cards.js +0 -136
- package/workspace/public/pm/registry.js +0 -203
- package/workspace/public/pm/release-card.js +0 -110
- package/workspace/public/pm/releases-view.js +0 -248
- package/workspace/public/pm/report-families-view.js +0 -505
- package/workspace/public/pm/report-slides.js +0 -438
- package/workspace/public/pm/report-tab.js +0 -33
- package/workspace/public/pm/report-view.js +0 -337
- package/workspace/public/pm/reports-copy.js +0 -134
- package/workspace/public/pm/roadmap.js +0 -294
- package/workspace/public/pm/run-card.js +0 -260
- package/workspace/public/pm/sessions-panel.js +0 -219
- package/workspace/public/pm/sheet-jira.js +0 -353
- package/workspace/public/pm/shell-bell.js +0 -163
- package/workspace/public/pm/shell-model.js +0 -83
- package/workspace/public/pm/shell-phone.js +0 -124
- package/workspace/public/pm/shell-readaloud.js +0 -53
- package/workspace/public/pm/shell-recording.js +0 -274
- package/workspace/public/pm/shell-ticker.js +0 -90
- package/workspace/public/pm/sig-watch.js +0 -41
- package/workspace/public/pm/slide-confirm.js +0 -163
- package/workspace/public/pm/slides-copy.js +0 -52
- package/workspace/public/pm/status-banner.js +0 -95
- package/workspace/public/pm/tab-doc.js +0 -859
- package/workspace/public/pm/tab-gone.js +0 -21
- package/workspace/public/pm/tab-term.js +0 -1210
- package/workspace/public/pm/tab-web.js +0 -90
- package/workspace/public/pm/timeline-copy.js +0 -48
- package/workspace/public/pm/timeline-forecast-view.js +0 -164
- package/workspace/public/pm/today-agenda.js +0 -331
- package/workspace/public/pm/today-cards.js +0 -244
- package/workspace/public/pm/today-copy.js +0 -506
- package/workspace/public/pm/today-day.js +0 -1371
- package/workspace/public/pm/today-goals.js +0 -297
- package/workspace/public/pm/today-jobs.js +0 -84
- package/workspace/public/pm/today-mentions.js +0 -50
- package/workspace/public/pm/topbar.js +0 -202
- package/workspace/public/pm/triage-card.js +0 -60
- package/workspace/public/pm/undo-hold.js +0 -103
- package/workspace/public/pm/view-addrepo.js +0 -208
- package/workspace/public/pm/view-files.js +0 -197
- package/workspace/public/pm/view-livenotes.js +0 -399
- package/workspace/public/pm/view-today.js +0 -13
- package/workspace/public/pm/view-validate.js +0 -171
- package/workspace/public/pm/welcome.js +0 -391
- package/workspace/public/pm/work-place.js +0 -68
- package/workspace/public/pm/xlsx-read.js +0 -117
- package/workspace/public/welcome.html +0 -22
- package/workspace/test-lists/browser-suites-green.json +0 -5
- package/workspace/test-lists/c3-core-docs.json +0 -9
- package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
- package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
- package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
- package/workspace/test-lists/c3-ib-items.json +0 -9
- package/workspace/test-lists/c3-ib-more.json +0 -9
- package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
- package/workspace/test-lists/c3-ini-life.json +0 -9
- package/workspace/test-lists/c3-meeting-board.json +0 -5
- package/workspace/test-lists/c3-meeting-card.json +0 -5
- package/workspace/test-lists/c3-notes-place.json +0 -5
- package/workspace/test-lists/c3-notes-series.json +0 -5
- package/workspace/test-lists/calendar-time-page.json +0 -5
- package/workspace/test-lists/calpop.json +0 -4
- package/workspace/test-lists/console3-briefing.json +0 -9
- package/workspace/test-lists/console3-foundation.json +0 -9
- package/workspace/test-lists/console3-work-page.json +0 -9
- package/workspace/test-lists/premium-brief-parity.json +0 -9
- package/workspace/test-lists/report-design-studio-ui.json +0 -5
- package/workspace/test-lists/report-structure-ui.json +0 -11
- package/workspace/test-lists/report-workspace-ui.json +0 -5
- package/workspace/test-lists/run3-a.json +0 -5
- package/workspace/test-lists/run3-d.json +0 -6
- package/workspace/test-lists/run4-c.json +0 -13
- package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
- package/workspace/test-lists/today-mentions-cards.json +0 -5
- package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/* pm/c3-signals.js — the Signals sub-view of Initiatives on /c3.html (console3.html SIGS line 2861, sigRow 2881, viewLeft and viewRight at lines
|
|
2
|
-
* 3833 and 3857, creepSVG and driftSVG at 3715 and 3724, the "What the agent watches" card).
|
|
3
|
-
* REAL: GET /api/signals ({ rules, readings (latest per metric), trips, open }) and GET /api/records/kr-metrics (KR rows: metric, baseline, target,
|
|
4
|
-
* by). A rule is { id, metric, op, threshold, severity: watch|act|critical }; it is tripping when it is in `open`. The page draws one row per rule:
|
|
5
|
-
* the headline is the rule, the evidence is the latest reading, the right side is open or not tripped. The ledger keeps only the latest reading
|
|
6
|
-
* per metric, so a real row has no sparkline. Severity maps to the mockup's chips: critical Pivot, act Drift, watch Watch.
|
|
7
|
-
* DEMO ONLY (optional fields the real rule does not carry): title, evidence, action, when, spark, sev (up for upside), initiative, and the response's
|
|
8
|
-
* head and charts (scope creep, delay). They are drawn when present; real mode never shows them.
|
|
9
|
-
* Writes (page presses, through pmPost): POST /api/signals/rule and POST /api/signals/reading, from the two small forms of the empty state and the
|
|
10
|
-
* rules card. A press the server refuses shows its reason. No dialog is used. */
|
|
11
|
-
import { el } from './dom.js';
|
|
12
|
-
import { pmGet, pmPost } from './http.js';
|
|
13
|
-
import { c3ic } from './pm-work-view.js';
|
|
14
|
-
import { makeView, frame, card, listCard, emptyRow, short, wireRow, caseNode, markDone, say } from './c3-init-extras.js';
|
|
15
|
-
|
|
16
|
-
const NS = 'http://www.w3.org/2000/svg';
|
|
17
|
-
const sv = (tag, a, ...kids) => { const n = document.createElementNS(NS, tag); for (const k of Object.keys(a || {})) if (a[k] != null) n.setAttribute(k, a[k]); for (const c of kids) if (c) n.appendChild(c); return n; };
|
|
18
|
-
const svt = (x, y, t, a) => { const n = sv('text', { x, y, ...(a || {}) }); n.textContent = t; return n; };
|
|
19
|
-
const SEV = { watch: ['Watch', 'var(--acc)', 'eye'], drift: ['Drift', 'var(--warning)', 'clock'], pivot: ['Pivot', 'var(--destructive)', 'alert'], up: ['Upside', 'var(--success)', 'up'] };
|
|
20
|
-
const ORDER = ['pivot', 'drift', 'watch', 'up'];
|
|
21
|
-
const OF_SEV = { critical: 'pivot', act: 'drift', watch: 'watch' };
|
|
22
|
-
|
|
23
|
-
function spark(a, c) {
|
|
24
|
-
const W = 64; const H = 26; const mn = Math.min(...a); const mx = Math.max(...a); const X = (i) => 3 + i * (W - 6) / (a.length - 1); const Y = (v) => H - 4 - (v - mn) / (mx - mn || 1) * (H - 8);
|
|
25
|
-
return sv('svg', { class: 'spk', viewBox: `0 0 ${W} ${H}`, 'aria-hidden': 'true' }, sv('polyline', { points: a.map((v, i) => X(i) + ',' + Y(v)).join(' '), fill: 'none', stroke: c, 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' }), sv('circle', { cx: X(a.length - 1), cy: Y(a[a.length - 1]), r: 3, fill: c }));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** The signals the page draws: one per rule of the ledger, with the demo's optional narrative when the rule carries it. */
|
|
29
|
-
export function signalsOf(j) {
|
|
30
|
-
const open = new Set(((j && j.open) || []).map((t) => t.rule_id));
|
|
31
|
-
const read = new Map(((j && j.readings) || []).map((r) => [r.metric, r]));
|
|
32
|
-
return ((j && j.rules) || []).map((r) => {
|
|
33
|
-
const rd = read.get(r.metric); const on = open.has(r.id);
|
|
34
|
-
return { id: r.id, sev: r.sev || OF_SEV[r.severity] || 'watch', on, initiative: r.initiative || '',
|
|
35
|
-
raw: r, read: rd || null, t: r.title || r.metric + ' ' + r.op + ' ' + r.threshold, ev: r.evidence || (rd ? 'Latest reading of ' + r.metric + ': ' + rd.value + ' (' + String(rd.at).slice(0, 10) + ').' : 'No reading of ' + r.metric + ' yet.'),
|
|
36
|
-
thr: r.action || 'Trips when ' + r.metric + ' ' + r.op + ' ' + r.threshold, ttt: r.when || (on ? 'tripped' : rd ? 'not tripped' : 'waiting for a reading'), sp: r.spark || null };
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/** The count on the Signals button: the signals that drift or call for a pivot. */
|
|
40
|
-
export async function badge() {
|
|
41
|
-
const j = await pmGet('/api/signals');
|
|
42
|
-
if (!j || !j.ok) return null;
|
|
43
|
-
return signalsOf(j).filter((s) => s.sev === 'drift' || s.sev === 'pivot').length;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const NEXT_SEV = { watch: 'act', act: 'critical' };
|
|
47
|
-
const PREV_SEV = { critical: 'act', act: 'watch' };
|
|
48
|
-
const SEVW = { watch: 'Watch', act: 'Drift', critical: 'Pivot' };
|
|
49
|
-
|
|
50
|
-
/** The case file of a signal (console3.html SIGC, line 2864). A demo rule carries the mockup's own `case`; a real rule gets the rule, its latest reading and its
|
|
51
|
-
* trips from the ledger, and its moves are the ones the page may make: keep watching, or change the severity (a page press on /api/signals/rule). */
|
|
52
|
-
function caseOf(V, s, S) {
|
|
53
|
-
if (s.raw && s.raw.case) return s.raw.case;
|
|
54
|
-
const r = s.raw; const trips = ((S && S.trips) || []).filter((t) => t.rule_id === s.id); const rd = s.read;
|
|
55
|
-
const chg = [['target', 'The rule: ' + r.metric + ' ' + r.op + ' ' + r.threshold, 'rule'],
|
|
56
|
-
rd ? ['clock', 'Latest reading ' + rd.value + ' on ' + String(rd.at).slice(0, 10), 'ledger', s.on ? 'bad' : 'ok'] : ['clock', 'No reading of ' + r.metric + ' yet', 'ledger', 'warn']];
|
|
57
|
-
trips.slice(-3).forEach((t) => chg.push(['alert', 'Tripped ' + String(t.at).slice(0, 10) + (t.reading ? ' at ' + t.reading.value : ''), 'trip', 'bad']));
|
|
58
|
-
chg.push(['info', trips.length + ' trip' + (trips.length === 1 ? '' : 's') + ' recorded, severity ' + (SEVW[r.severity] || r.severity), 'ledger']);
|
|
59
|
-
const opts = [{ id: 'w', l: s.on ? 'Keep watching' : 'Keep watching it', rec: !s.on || !NEXT_SEV[r.severity], fx: [['eye', 'The rule stays as it is', 'ok']] }];
|
|
60
|
-
if (NEXT_SEV[r.severity]) opts.push({ id: 'up', l: 'Raise it to ' + SEVW[NEXT_SEV[r.severity]], rec: s.on, fx: [['alert', 'A trip is treated as more urgent', 'warn']] });
|
|
61
|
-
if (PREV_SEV[r.severity]) opts.push({ id: 'dn', l: 'Lower it to ' + SEVW[PREV_SEV[r.severity]], fx: [['clock', 'A trip is treated as less urgent', 'warn']] });
|
|
62
|
-
return { sit: s.on ? 'This rule is tripping now. ' + s.ev : 'This rule is not tripping. ' + s.ev, conf: s.on ? 74 : 80, chg, opts, cta: 'Slide to confirm', unsure: 'A rule is a number against a threshold. It does not know why the number moved.' };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async function setSeverity(V, s, sev) {
|
|
66
|
-
const r = s.raw; const was = r.severity;
|
|
67
|
-
const put = (v) => pmPost('/api/signals/rule', { id: r.id, metric: r.metric, op: r.op, threshold: r.threshold, severity: v });
|
|
68
|
-
const out = await put(sev);
|
|
69
|
-
if (!out || !out.ok) { say('Not saved: ' + ((out && out.error) || 'the server refused it.')); return null; }
|
|
70
|
-
return async () => { await put(was); reload(V); };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function row(V, s, S) {
|
|
74
|
-
const SV = SEV[s.sev] || SEV.watch; const key = 'sg-' + s.id;
|
|
75
|
-
const xp = el('div', { class: 'xp' }, el('div', { class: 'xi' }, caseNode(V, 'sig:' + s.id, caseOf(V, s, S), {
|
|
76
|
-
onConfirm: async (o) => {
|
|
77
|
-
if (s.raw && s.raw.case) { const m = (s.raw.case.opts || []).find((q) => q.id === o.id); markDone(V, 'sig:' + s.id, (m && m.msg) || 'Recorded.'); say((m && m.msg) || 'Recorded.'); return; }
|
|
78
|
-
if (o.id === 'w') { markDone(V, 'sig:' + s.id, 'Watching. No change to the rule.'); return; }
|
|
79
|
-
const to = o.id === 'up' ? NEXT_SEV[s.raw.severity] : PREV_SEV[s.raw.severity];
|
|
80
|
-
const undo = await setSeverity(V, s, to);
|
|
81
|
-
if (undo) { say('Severity is now ' + SEVW[to] + '.', undo); await reload(V); }
|
|
82
|
-
} })));
|
|
83
|
-
const li = el('li', { class: 'sgr', style: '--c:' + SV[1], 'data-in-signal': s.id, 'data-id': s.id, tabindex: '0' },
|
|
84
|
-
el('span', { class: 'ki', style: 'color:' + SV[1] }, c3ic(SV[2])),
|
|
85
|
-
el('div', { style: 'min-width:0' }, el('div', { class: 'st1 tt' }, s.t), el('div', { class: 'st2' }, s.ev),
|
|
86
|
-
el('div', { class: 'st3' }, el('span', { class: 'sv' }, SV[0]), el('span', null, c3ic('target', 'sm'), s.thr), el('span', null, c3ic('clock', 'sm'), s.ttt)), xp),
|
|
87
|
-
s.sp && s.sp.length > 1 ? spark(s.sp, SV[1]) : el('span'));
|
|
88
|
-
wireRow(V, li, xp, key, null);
|
|
89
|
-
return li;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/* the mockup's creepSVG and driftSVG, from the response's `charts` */
|
|
93
|
-
function creepChart(C) {
|
|
94
|
-
const P = C.points; const W = 560; const H = 170; const x0 = 36; const x1 = W - 20; const y0 = 16; const y1 = H - 32; const mn = 15; const mx = 38;
|
|
95
|
-
const X = (i) => x0 + i * (x1 - x0) / (P.length - 1); const Y = (v) => y1 - (v - mn) / (mx - mn) * (y1 - y0);
|
|
96
|
-
const s = sv('svg', { class: 'mat', viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': 'Scope in points against the baseline of ' + C.baseline + ' points' });
|
|
97
|
-
[20, 30].forEach((v) => s.append(sv('line', { x1: x0, x2: x1, y1: Y(v), y2: Y(v), stroke: 'var(--border)' }), svt(x0 - 5, Y(v) + 4, v, { 'text-anchor': 'end' })));
|
|
98
|
-
const pts = []; P.forEach((p, i) => { if (i) pts.push(X(i).toFixed(1) + ',' + Y(P[i - 1][1]).toFixed(1)); pts.push(X(i).toFixed(1) + ',' + Y(p[1]).toFixed(1)); });
|
|
99
|
-
const base = []; for (let i = P.length - 1; i >= 0; i--) base.push(X(i).toFixed(1) + ',' + Y(C.baseline).toFixed(1));
|
|
100
|
-
s.append(sv('polygon', { points: pts.join(' ') + ' ' + base.join(' '), fill: 'var(--destructive)', 'fill-opacity': '.12' }),
|
|
101
|
-
sv('line', { x1: x0, x2: x1, y1: Y(C.baseline), y2: Y(C.baseline), stroke: 'var(--ring)', 'stroke-dasharray': '5 4', 'stroke-width': 2 }),
|
|
102
|
-
sv('polyline', { points: pts.join(' '), fill: 'none', stroke: 'var(--destructive)', 'stroke-width': 2.5, 'stroke-linejoin': 'round' }));
|
|
103
|
-
P.forEach((p, i) => {
|
|
104
|
-
s.append(sv('circle', { cx: X(i), cy: Y(p[1]), r: 4, fill: 'var(--destructive)', stroke: 'var(--card)', 'stroke-width': 2 }), svt(X(i), H - 16, p[0], { 'text-anchor': 'middle' }));
|
|
105
|
-
if (p[2] && i) s.append(svt(X(i), Y(p[1]) - 9, '+' + (p[1] - P[i - 1][1]) + ' ' + short(p[2], 16), { 'text-anchor': i === P.length - 1 ? 'end' : 'middle' }));
|
|
106
|
-
});
|
|
107
|
-
s.append(svt(x1, Y(C.baseline) + 14, 'baseline ' + C.baseline + ' points', { 'text-anchor': 'end' }));
|
|
108
|
-
return s;
|
|
109
|
-
}
|
|
110
|
-
function delayChart(C) {
|
|
111
|
-
const P = C.points; const W = 560; const H = 160; const x0 = 58; const x1 = W - 20; const y0 = 16; const y1 = H - 30; const mn = 22; const mx = 33;
|
|
112
|
-
const X = (i) => x0 + i * (x1 - x0) / (P.length - 1); const Y = (v) => y1 - (v - mn) / (mx - mn) * (y1 - y0);
|
|
113
|
-
const s = sv('svg', { class: 'mat', viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': 'Forecast ship date at each weekly check against the promised ' + C.promised + ' Oct' });
|
|
114
|
-
[24, 28, 32].forEach((v) => s.append(sv('line', { x1: x0, x2: x1, y1: Y(v), y2: Y(v), stroke: 'var(--border)' }), svt(x0 - 5, Y(v) + 4, v > 31 ? (v - 31) + ' Nov' : v + ' Oct', { 'text-anchor': 'end' })));
|
|
115
|
-
s.append(sv('line', { x1: x0, x2: x1, y1: Y(C.promised), y2: Y(C.promised), stroke: 'var(--success)', 'stroke-dasharray': '5 4', 'stroke-width': 2 }),
|
|
116
|
-
sv('polyline', { points: P.map((p, i) => X(i).toFixed(1) + ',' + Y(p[1]).toFixed(1)).join(' '), fill: 'none', stroke: 'var(--destructive)', 'stroke-width': 2.5, 'stroke-linejoin': 'round' }));
|
|
117
|
-
P.forEach((p, i) => s.append(sv('circle', { cx: X(i), cy: Y(p[1]), r: 4, fill: 'var(--destructive)', stroke: 'var(--card)', 'stroke-width': 2 }), svt(X(i), H - 12, p[0], { 'text-anchor': 'middle' })));
|
|
118
|
-
s.append(svt(x1, Y(C.promised) - 6, 'promised ' + C.promised + ' Oct', { 'text-anchor': 'end', fill: 'var(--success)' }), svt(X(P.length - 1), Y(P[P.length - 1][1]) - 9, P[P.length - 1][1] + ' Oct', { 'text-anchor': 'end' }));
|
|
119
|
-
return s;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/* a small form of the page's own: a rule or a reading, pressed through pmPost; the server's refusal is shown as it is */
|
|
123
|
-
const field = (label, attrs) => el('label', { class: 'dim mono', style: 'display:grid;gap:4px;font-size:var(--fs-2)' }, label, el('input', { ...attrs, style: 'min-height:44px;width:100%;box-sizing:border-box;font:inherit;padding:8px 10px;border:1px solid var(--ring);border-radius:8px;background:var(--card);color:var(--foreground)' }));
|
|
124
|
-
function ruleForm(V) {
|
|
125
|
-
const id = field('Rule id', { name: 'id', placeholder: 'conversion-floor', autocomplete: 'off', 'data-in-f': 'id' });
|
|
126
|
-
const metric = field('Metric', { name: 'metric', placeholder: 'checkout.conversion', autocomplete: 'off', 'data-in-f': 'metric' });
|
|
127
|
-
const op = el('select', { 'data-in-f': 'op', 'aria-label': 'Operator', style: 'min-height:44px;font:inherit;padding:8px;border:1px solid var(--ring);border-radius:8px;background:var(--card);color:var(--foreground)' }, ['<', '<=', '>', '>=', '=='].map((o) => el('option', { value: o }, o)));
|
|
128
|
-
const th = field('Threshold', { name: 'threshold', type: 'number', step: 'any', 'data-in-f': 'threshold' });
|
|
129
|
-
const sev = el('select', { 'data-in-f': 'severity', 'aria-label': 'Severity', style: 'min-height:44px;font:inherit;padding:8px;border:1px solid var(--ring);border-radius:8px;background:var(--card);color:var(--foreground)' }, ['watch', 'act', 'critical'].map((o) => el('option', { value: o }, o)));
|
|
130
|
-
const msg = el('p', { class: 'dim mono', style: 'font-size:var(--fs-2);margin:0', role: 'status', 'data-in-msg': '' });
|
|
131
|
-
const go = el('button', { type: 'button', class: 'pill', 'data-in-add-rule': '', style: 'min-height:44px', onClick: async () => {
|
|
132
|
-
const r = await pmPost('/api/signals/rule', { id: id.querySelector('input').value.trim(), metric: metric.querySelector('input').value.trim(), op: op.value, threshold: Number(th.querySelector('input').value), severity: sev.value });
|
|
133
|
-
if (r && r.ok) { msg.textContent = ''; reload(V); } else msg.textContent = 'Not saved: ' + ((r && r.error) || 'the server refused it.');
|
|
134
|
-
} }, c3ic('plus', 'sm'), 'Add the rule');
|
|
135
|
-
return el('div', { class: 'form', style: 'display:grid;gap:8px', 'data-in-rule-form': '' }, id, metric, el('div', { style: 'display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:end' }, op, th, sev), el('div', { class: 'chips2' }, go), msg);
|
|
136
|
-
}
|
|
137
|
-
function readingForm(V, rules) {
|
|
138
|
-
const metrics = [...new Set(rules.map((r) => r.metric))];
|
|
139
|
-
const metric = el('select', { 'data-in-f': 'rmetric', 'aria-label': 'Metric', style: 'min-height:44px;font:inherit;padding:8px;border:1px solid var(--ring);border-radius:8px;background:var(--card);color:var(--foreground)' }, metrics.map((m) => el('option', { value: m }, m)));
|
|
140
|
-
const val = field('Reading', { name: 'value', type: 'number', step: 'any', 'data-in-f': 'rvalue' });
|
|
141
|
-
const msg = el('p', { class: 'dim mono', style: 'font-size:var(--fs-2);margin:0', role: 'status' });
|
|
142
|
-
const go = el('button', { type: 'button', class: 'pill', 'data-in-add-reading': '', style: 'min-height:44px', onClick: async () => {
|
|
143
|
-
const r = await pmPost('/api/signals/reading', { metric: metric.value, value: Number(val.querySelector('input').value) });
|
|
144
|
-
if (r && r.ok) { msg.textContent = ''; reload(V); } else msg.textContent = 'Not saved: ' + ((r && r.error) || 'the server refused it.');
|
|
145
|
-
} }, c3ic('plus', 'sm'), 'Record the reading');
|
|
146
|
-
return el('div', { class: 'form', style: 'display:grid;gap:8px', 'data-in-reading-form': '' }, metric, val, el('div', { class: 'chips2' }, go), msg);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function reload(V) {
|
|
150
|
-
return Promise.all([pmGet('/api/signals'), pmGet('/api/records/kr-metrics')]).then(([s, k]) => {
|
|
151
|
-
if (V.disposed) return;
|
|
152
|
-
V.data = { s: s && s.ok ? s : null, k: k && k.ok ? k.records || [] : [], err: s && s.ok ? null : (s && s.error) || 'The signals could not be read.' };
|
|
153
|
-
V.render();
|
|
154
|
-
}, () => { V.data = { s: null, k: [], err: 'The signals could not be read.' }; V.render(); });
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function render(V) {
|
|
158
|
-
const D = V.data;
|
|
159
|
-
const S = D && D.s ? D.s : null;
|
|
160
|
-
const all = S ? signalsOf(S) : [];
|
|
161
|
-
const scoped = V.scope && all.some((s) => s.initiative);
|
|
162
|
-
const list = (scoped ? all.filter((s) => (s.initiative || '').split(',').includes(V.scope)) : all).sort((a, b) => ORDER.indexOf(a.sev) - ORDER.indexOf(b.sev));
|
|
163
|
-
const head = !D ? { icon: 'alert', h: 'Reading the signals', s: 'A signal is a rule on a measured number.', ring: [0, 1] }
|
|
164
|
-
: S && S.head ? { icon: 'alert', ...S.head }
|
|
165
|
-
: all.length ? { icon: 'alert', h: S.open.length + ' of ' + all.length + ' rule' + (all.length === 1 ? ' is' : 's are') + ' tripping', s: 'Each row is a rule, with its latest reading. The agent watches them; you decide what to do.', ring: [all.length - S.open.length, all.length] }
|
|
166
|
-
: { icon: 'alert', h: D.err ? 'The signals could not be read' : 'No signal rules yet', s: D.err || 'A signal is a rule on a measured number, such as “conversion below 3.0%”. Add one to start watching.', ring: [0, 1] };
|
|
167
|
-
|
|
168
|
-
const left = [];
|
|
169
|
-
if (!D) left.push(listCard('alert', 'Signals', null, '', [emptyRow('clock', 'Reading the signals.', { role: 'status' })]));
|
|
170
|
-
else {
|
|
171
|
-
left.push(el('section', { class: 'card sect', 'data-in-list': 'signals' }, el('div', { class: 'sh2' }, el('h2', null, c3ic('alert', 'sm'), 'Signals ', el('span', { class: 'bdg g' }, String(list.length)))),
|
|
172
|
-
list.length ? el('ul', { class: 'sgl', style: 'list-style:none;margin:0;padding:0' }, list.map((x) => row(V, x, S))) : el('ul', { class: 'list' }, emptyRow('moon', all.length ? 'No signal belongs to this initiative.' : 'No signal rules yet, so nothing is being watched.', { 'data-in-empty': '' }))));
|
|
173
|
-
const krs = D.k || [];
|
|
174
|
-
if (krs.length) left.push(listCard('target', 'Key results', krs.length, 'baseline to target', krs.map((k) => el('li', { class: 'nrow', 'data-in-kr': k.rid },
|
|
175
|
-
el('span', { class: 'ki' }, c3ic('target')), el('div', { class: 'nb' }, el('span', { class: 'tt' }, k.metric),
|
|
176
|
-
el('div', { class: 'chips' }, el('span', { class: 'chip2 mono' }, k.baseline + ' to ' + k.target), el('span', { class: 'chip2' }, c3ic('cal', 'sm'), 'by ' + k.by)))))));
|
|
177
|
-
}
|
|
178
|
-
const right = [];
|
|
179
|
-
const ch = S && S.charts;
|
|
180
|
-
if (ch && ch.creep) right.push(card('alert', 'Scope creep', 'points against baseline', creepChart(ch.creep)));
|
|
181
|
-
if (ch && ch.delay) right.push(card('clock', 'Delay', 'forecast ship date, each weekly check', delayChart(ch.delay)));
|
|
182
|
-
if (D && S) {
|
|
183
|
-
const watch = S.watch || S.rules.map((r) => ({ tone: S.open.some((t) => t.rule_id === r.id) ? 'bad' : 'ok', text: r.metric + ' ' + r.op + ' ' + r.threshold + ' (' + r.severity + ')', note: (() => { const rd = S.readings.find((x) => x.metric === r.metric); return rd ? 'latest ' + rd.value : 'no reading yet'; })() }));
|
|
184
|
-
right.push(card('shield', 'What the agent watches', '',
|
|
185
|
-
watch.length ? el('ul', { class: 'chgl' }, watch.map((r) => el('li', { class: r.tone, 'data-in-rule': '' }, c3ic(r.tone === 'ok' ? 'check' : 'alert', 'sm'), el('span', null, r.text + (r.note ? ' · ' + r.note : ''))))) : el('p', { class: 'dim', style: 'font-size:var(--fs-2);margin:0' }, 'Nothing yet. A rule names a metric, a comparison, a threshold and a severity.')));
|
|
186
|
-
if (!ch) { // real mode: the two page presses (the demo shows the mockup's charts instead and saves nothing)
|
|
187
|
-
right.push(card('plus', 'Add a rule', 'a number to watch', ruleForm(V)));
|
|
188
|
-
if (S.rules.length) right.push(card('plus', 'Record a reading', 'the latest value of a metric', readingForm(V, S.rules)));
|
|
189
|
-
}
|
|
190
|
-
} else if (D && D.err) right.push(card('alert', 'Not read', '', el('p', { class: 'dim', style: 'font-size:var(--fs-2);margin:0' }, D.err)));
|
|
191
|
-
frame(V, { head, left, right });
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const view = makeView('signals', { init: reload, render });
|
|
195
|
-
export const mount = view.mount;
|
|
196
|
-
export const dispose = view.dispose;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/* pm/c3-strategy-panels.js — the strategy panels of the Calendar's Quarter and Year panes (c3-cal-strategy.js), mounted where the console3 mockup draws the same
|
|
2
|
-
* panel a second time: Initiatives > Lifecycle > Strategize (maturity 3582, bets, north star 3595, early signals, synergy) and Reports > Product (north star,
|
|
3
|
-
* quarter outcomes, console3.html line 4345). The builders are the Calendar's own, so the two places cannot drift; this file only supplies the read.
|
|
4
|
-
*
|
|
5
|
-
* strategyPanel(name, ctx, opts) -> a node. name: north | outcomes | signals | synergy | maturity | bets.
|
|
6
|
-
* The node is a `display:contents` wrapper, so the card sits in its column as if it were a direct child. It shows a one-line reading note until
|
|
7
|
-
* GET /api/c3-strategy answers (read once, kept a minute by c3-cal-strategy.js), then it holds the card. A panel with no source draws its honest
|
|
8
|
-
* empty card (what is missing and what fills it); an unreadable route says so. Nothing is invented.
|
|
9
|
-
* ctx = { goInit(id, title), today?, data? } opts = { view: 'year'|'quarter', n: signals shown, plain: heading "North star" only }
|
|
10
|
-
* DATA: the same route as the Calendar (workspace/lib/routes-c3-strategy.js); in demo mode c3-demo-cal3.js answers it with the mockup's own sample. */
|
|
11
|
-
import { el } from './dom.js';
|
|
12
|
-
import { ensureC3Css } from './pm-work-view.js';
|
|
13
|
-
import { PANEL_BUILDERS, readModel, cachedModel, todayStr } from './c3-cal-strategy.js';
|
|
14
|
-
|
|
15
|
-
function build(name, M0, ctx, opts) {
|
|
16
|
-
const M = M0.signalsAll ? M0 : { ...M0, signalsAll: (M0.signals || []).map((s) => ({ ...s })) }; // the Calendar adds the late initiatives from its gantt rows; this page has none, so the rule signals stand alone
|
|
17
|
-
const live = !M.demo; const today = ctx.today || M.today || todayStr(Date.now());
|
|
18
|
-
switch (name) {
|
|
19
|
-
case 'north': return PANEL_BUILDERS.north(M, opts.view || 'year', today, !!opts.plain);
|
|
20
|
-
case 'outcomes': return PANEL_BUILDERS.outcomes(M);
|
|
21
|
-
case 'signals': return PANEL_BUILDERS.signals(M, opts.n || 4, ctx, live);
|
|
22
|
-
case 'synergy': return PANEL_BUILDERS.synergy(M);
|
|
23
|
-
case 'maturity': return PANEL_BUILDERS.maturity(M);
|
|
24
|
-
case 'bets': return PANEL_BUILDERS.bets(M, ctx);
|
|
25
|
-
default: return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function strategyPanel(name, ctx, opts) {
|
|
30
|
-
ensureC3Css();
|
|
31
|
-
const c = ctx || {}; const o = opts || {};
|
|
32
|
-
const host = el('div', { style: 'display:contents', 'data-sp': name });
|
|
33
|
-
const fill = (M) => {
|
|
34
|
-
if (!M || !M.ok) { host.replaceChildren(el('p', { class: 'dim mono', style: 'font-size:var(--fs-2)', role: 'status', 'data-sp-error': name }, 'The strategy view could not be read: ' + ((M && M.error) || 'not available'))); return; }
|
|
35
|
-
const node = build(name, M, c, o);
|
|
36
|
-
if (node) host.replaceChildren(node); else host.replaceChildren();
|
|
37
|
-
};
|
|
38
|
-
const cached = cachedModel();
|
|
39
|
-
if (cached) fill(cached);
|
|
40
|
-
else {
|
|
41
|
-
host.replaceChildren(el('p', { class: 'dim mono', style: 'font-size:var(--fs-2)', role: 'status', 'data-sp-loading': name }, 'Reading the repository'));
|
|
42
|
-
readModel(!(typeof window !== 'undefined' && window.__c3demo)).then(fill);
|
|
43
|
-
}
|
|
44
|
-
return host;
|
|
45
|
-
}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
/* pm/c3-swipe.js — the console3 row swipe, as a primitive (console3.html lines 2420 to 2438, rowAct 2421).
|
|
2
|
-
*
|
|
3
|
-
* attachSwipe(el, { onRight, onLeft, labelRight, labelLeft, iconRight, iconLeft, disabled, threshold }) -> detach()
|
|
4
|
-
*
|
|
5
|
-
* The mockup's gesture, kept as it is: a pointer drag that starts on the row (not on a button, link, field or an open row's
|
|
6
|
-
* case file) and moves mostly sideways. It locks to horizontal after 8px; a vertical move of more than 12px first hands the touch
|
|
7
|
-
* back to the page (scroll). The row follows the pointer (`--dx`; its children move at 0.55 of it), the `.rv` strip on the
|
|
8
|
-
* side being pulled fades in with the distance (`--d`, full at 90px), and the row takes `.dr` while it is held, `.swr` or `.swl`
|
|
9
|
-
* for the side. Releasing past 90px calls onRight (dx > 90) or onLeft (dx < -90); a shorter pull snaps back and does nothing.
|
|
10
|
-
* The click that a pull would end with is swallowed for 80ms, as the mockup does (`swSup`).
|
|
11
|
-
*
|
|
12
|
-
* Added: the label of the action is drawn beside its icon in the strip (`.rv .rvl`), so a swipe says what it will do; the same
|
|
13
|
-
* two actions work from the keyboard on the focused row (ArrowRight = onRight, ArrowLeft = onLeft; the row must have the focus
|
|
14
|
-
* itself, not a field inside it); under prefers-reduced-motion the row does not slide, the strip and its label show at the
|
|
15
|
-
* threshold only. The row carries tabindex=0, data-swipe, and an aria-description naming both actions.
|
|
16
|
-
*
|
|
17
|
-
* Pure parts (Node-testable): swipeStep, swipeEnd, revealOf, keyAction, SWIPE.
|
|
18
|
-
*
|
|
19
|
-
* R3 (console3 quick fixes): the confirm control of a case file. On a fine pointer the long slide gives way to a compact button
|
|
20
|
-
* (mountHold): an act that cannot be undone needs a press and hold of 600 ms with a ring that fills; an act that can be undone is one
|
|
21
|
-
* click; from the keyboard, Enter opens a Confirm step for both. On touch the slide stays (slide-confirm.js).
|
|
22
|
-
* Pure parts: HOLD, holdMode, holdProgress, finePointer.
|
|
23
|
-
*/
|
|
24
|
-
import { button } from './primitives.js';
|
|
25
|
-
export const SWIPE = { threshold: 90, lock: 8, cancelY: 12, suppressMs: 80, tracking: 0.55 };
|
|
26
|
-
|
|
27
|
-
/** One pointer-move. state: null | { x, y, on, dx }. Returns the next state (null = the gesture is cancelled: it is a scroll). */
|
|
28
|
-
export function swipeStep(state, dxRaw, dyRaw, cfg = SWIPE) {
|
|
29
|
-
if (!state) return null;
|
|
30
|
-
const dx = dxRaw; const dy = dyRaw;
|
|
31
|
-
if (!state.on) {
|
|
32
|
-
if (Math.abs(dx) < cfg.lock || Math.abs(dy) > Math.abs(dx)) return Math.abs(dy) > cfg.cancelY ? null : { ...state, dx: 0 };
|
|
33
|
-
return { ...state, on: true, dx };
|
|
34
|
-
}
|
|
35
|
-
return { ...state, dx };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** The pointer is released (or cancelled). 'right' | 'left' | null. */
|
|
39
|
-
export function swipeEnd(state, cancelled = false, cfg = SWIPE) {
|
|
40
|
-
if (!state || cancelled || !state.on) return null;
|
|
41
|
-
if (state.dx > cfg.threshold) return 'right';
|
|
42
|
-
if (state.dx < -cfg.threshold) return 'left';
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** How far the strip is revealed: { right: 0..1, left: 0..1 } for a drag of dx pixels (the mockup's `--d`). */
|
|
47
|
-
export function revealOf(dx, cfg = SWIPE) {
|
|
48
|
-
const d = Math.min(1, Math.abs(dx) / cfg.threshold);
|
|
49
|
-
return { right: dx > 0 ? d : 0, left: dx < 0 ? d : 0 };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** The keyboard twin of a swipe: a key on the focused row maps to a side, or null. */
|
|
53
|
-
export function keyAction(key, { shift = false, meta = false, ctrl = false, alt = false } = {}) {
|
|
54
|
-
if (shift || meta || ctrl || alt) return null;
|
|
55
|
-
if (key === 'ArrowRight') return 'right';
|
|
56
|
-
if (key === 'ArrowLeft') return 'left';
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const reduced = () => { try { return typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches; } catch { return false; } };
|
|
61
|
-
const IGNORE = 'button,a,select,input,textarea,.xp,.slt,[data-noswipe]';
|
|
62
|
-
|
|
63
|
-
function strip(side, icon, label) {
|
|
64
|
-
const s = document.createElement('span');
|
|
65
|
-
s.className = 'rv ' + (side === 'right' ? 'r' : 'l');
|
|
66
|
-
s.setAttribute('aria-hidden', 'true');
|
|
67
|
-
if (icon) {
|
|
68
|
-
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
69
|
-
svg.setAttribute('class', 'ic'); svg.setAttribute('aria-hidden', 'true');
|
|
70
|
-
const u = document.createElementNS('http://www.w3.org/2000/svg', 'use'); u.setAttribute('href', '#c3i-' + icon); svg.appendChild(u); s.appendChild(svg);
|
|
71
|
-
}
|
|
72
|
-
const t = document.createElement('span'); t.className = 'rvl'; t.textContent = label || ''; s.appendChild(t);
|
|
73
|
-
return s;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function attachSwipe(el, opts = {}) {
|
|
77
|
-
const { onRight, onLeft, labelRight = '', labelLeft = '', iconRight = 'check', iconLeft = 'moon', disabled, threshold } = opts;
|
|
78
|
-
const cfg = threshold ? { ...SWIPE, threshold } : SWIPE;
|
|
79
|
-
const off = () => typeof disabled === 'function' && disabled();
|
|
80
|
-
el.setAttribute('data-swipe', '');
|
|
81
|
-
if (!el.hasAttribute('tabindex')) el.setAttribute('tabindex', '0');
|
|
82
|
-
el.setAttribute('aria-description', (labelRight ? 'Swipe right or press the right arrow: ' + labelRight + '. ' : '') + (labelLeft ? 'Swipe left or press the left arrow: ' + labelLeft + '.' : ''));
|
|
83
|
-
let rvR = el.querySelector(':scope > .rv.r'); let rvL = el.querySelector(':scope > .rv.l');
|
|
84
|
-
if (!rvR && onRight) { rvR = strip('right', iconRight, labelRight); el.prepend(rvR); }
|
|
85
|
-
if (!rvL && onLeft) { rvL = strip('left', iconLeft, labelLeft); el.prepend(rvL); }
|
|
86
|
-
if (rvR && !rvR.querySelector('.rvl') && labelRight) { const t = document.createElement('span'); t.className = 'rvl'; t.textContent = labelRight; rvR.appendChild(t); }
|
|
87
|
-
if (rvL && !rvL.querySelector('.rvl') && labelLeft) { const t = document.createElement('span'); t.className = 'rvl'; t.textContent = labelLeft; rvL.appendChild(t); }
|
|
88
|
-
|
|
89
|
-
let st = null; let suppress = false; let tmr = null;
|
|
90
|
-
const paint = (dx) => {
|
|
91
|
-
const r = revealOf(dx, cfg);
|
|
92
|
-
if (!reduced()) el.style.setProperty('--dx', dx + 'px');
|
|
93
|
-
el.classList.toggle('swr', dx > 0); el.classList.toggle('swl', dx < 0);
|
|
94
|
-
const past = Math.abs(dx) > cfg.threshold;
|
|
95
|
-
if (rvR) rvR.style.setProperty('--d', String(reduced() ? (past && dx > 0 ? 1 : 0) : r.right));
|
|
96
|
-
if (rvL) rvL.style.setProperty('--d', String(reduced() ? (past && dx < 0 ? 1 : 0) : r.left));
|
|
97
|
-
};
|
|
98
|
-
const clear = () => {
|
|
99
|
-
el.classList.remove('dr', 'swr', 'swl'); el.style.removeProperty('--dx');
|
|
100
|
-
if (rvR) rvR.style.removeProperty('--d'); if (rvL) rvL.style.removeProperty('--d');
|
|
101
|
-
};
|
|
102
|
-
const fire = (side) => { const fn = side === 'right' ? onRight : onLeft; if (fn) fn(el, side); };
|
|
103
|
-
|
|
104
|
-
const onMove = (e) => {
|
|
105
|
-
if (!st) return;
|
|
106
|
-
const was = st.on;
|
|
107
|
-
st = swipeStep(st, e.clientX - st.x, e.clientY - st.y, cfg);
|
|
108
|
-
if (!st) { teardown(); clear(); return; }
|
|
109
|
-
if (st.on && !was) { el.classList.add('dr'); try { const g = getSelection(); if (g) g.removeAllRanges(); } catch { /* no selection API */ } }
|
|
110
|
-
if (st.on) paint(st.dx);
|
|
111
|
-
};
|
|
112
|
-
const onUp = (e) => finish(e && e.type === 'pointercancel');
|
|
113
|
-
function finish(cancelled) {
|
|
114
|
-
const s = st; st = null; teardown(); clear();
|
|
115
|
-
if (s && s.on) { suppress = true; clearTimeout(tmr); tmr = setTimeout(() => { suppress = false; }, SWIPE.suppressMs); }
|
|
116
|
-
const side = swipeEnd(s, cancelled, cfg);
|
|
117
|
-
if (side) fire(side);
|
|
118
|
-
}
|
|
119
|
-
function teardown() {
|
|
120
|
-
document.removeEventListener('pointermove', onMove); document.removeEventListener('pointerup', onUp); document.removeEventListener('pointercancel', onUp);
|
|
121
|
-
}
|
|
122
|
-
const onDown = (e) => {
|
|
123
|
-
if (e.button > 0 || off()) return;
|
|
124
|
-
if (e.target.closest && e.target.closest(IGNORE) && e.target.closest(IGNORE) !== el) return;
|
|
125
|
-
if (el.getAttribute('aria-expanded') === 'true') return; // an open row is read, not swiped (the mockup does the same)
|
|
126
|
-
st = { x: e.clientX, y: e.clientY, on: false, dx: 0 };
|
|
127
|
-
document.addEventListener('pointermove', onMove); document.addEventListener('pointerup', onUp); document.addEventListener('pointercancel', onUp);
|
|
128
|
-
};
|
|
129
|
-
const onClickCapture = (e) => { if (suppress) { suppress = false; e.stopPropagation(); e.preventDefault(); } };
|
|
130
|
-
const onKey = (e) => {
|
|
131
|
-
if (e.target !== el || off()) return;
|
|
132
|
-
const side = keyAction(e.key, { shift: e.shiftKey, meta: e.metaKey, ctrl: e.ctrlKey, alt: e.altKey });
|
|
133
|
-
if (!side || (side === 'right' ? !onRight : !onLeft)) return;
|
|
134
|
-
e.preventDefault(); e.stopPropagation(); fire(side);
|
|
135
|
-
};
|
|
136
|
-
el.addEventListener('pointerdown', onDown);
|
|
137
|
-
el.addEventListener('click', onClickCapture, true);
|
|
138
|
-
el.addEventListener('keydown', onKey);
|
|
139
|
-
return function detach() {
|
|
140
|
-
teardown(); clear(); clearTimeout(tmr);
|
|
141
|
-
el.removeEventListener('pointerdown', onDown); el.removeEventListener('click', onClickCapture, true); el.removeEventListener('keydown', onKey);
|
|
142
|
-
el.removeAttribute('data-swipe'); el.removeAttribute('aria-description');
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/* ── R3: the compact confirm button for a fine pointer ──────────────────────────────────────────────────────────────────────── */
|
|
147
|
-
export const HOLD = { ms: 600 };
|
|
148
|
-
|
|
149
|
-
/** 'hold' for an act that cannot be undone (it sends something outside, or the option says so), 'click' for one the Undo toast reverses. */
|
|
150
|
-
export function holdMode(option, caseModel) {
|
|
151
|
-
const o = option || {}; const c = caseModel || {};
|
|
152
|
-
return o.irreversible || o.outward || c.outward ? 'hold' : 'click';
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** How much of the ring is filled after `elapsed` ms of holding: 0 to 1. */
|
|
156
|
-
export function holdProgress(elapsed, ms = HOLD.ms) {
|
|
157
|
-
const e = Number(elapsed);
|
|
158
|
-
if (!(e > 0)) return 0;
|
|
159
|
-
return Math.min(1, e / ms);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/** True where the main pointer is fine (a mouse or a trackpad): the compact button replaces the slide. */
|
|
163
|
-
export function finePointer(mm) {
|
|
164
|
-
const f = mm || (typeof matchMedia === 'function' ? matchMedia : null);
|
|
165
|
-
try { return !!(f && f('(pointer: fine)').matches); } catch { return false; }
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const SVGNS = 'http://www.w3.org/2000/svg';
|
|
169
|
-
const node = (tag, attrs, ...kids) => {
|
|
170
|
-
const n = document.createElement(tag);
|
|
171
|
-
for (const k of Object.keys(attrs || {})) if (attrs[k] !== null && attrs[k] !== undefined) n.setAttribute(k, attrs[k]);
|
|
172
|
-
for (const c of kids) if (c) n.append(c);
|
|
173
|
-
return n;
|
|
174
|
-
};
|
|
175
|
-
function ringIcon(iconName) {
|
|
176
|
-
const svg = document.createElementNS(SVGNS, 'svg');
|
|
177
|
-
svg.setAttribute('class', 'hr'); svg.setAttribute('viewBox', '0 0 26 26'); svg.setAttribute('aria-hidden', 'true');
|
|
178
|
-
for (const cls of ['tk', 'fl']) {
|
|
179
|
-
const c = document.createElementNS(SVGNS, 'circle');
|
|
180
|
-
c.setAttribute('class', cls); c.setAttribute('cx', '13'); c.setAttribute('cy', '13'); c.setAttribute('r', '10');
|
|
181
|
-
svg.appendChild(c);
|
|
182
|
-
}
|
|
183
|
-
const g = document.createElementNS(SVGNS, 'svg');
|
|
184
|
-
g.setAttribute('class', 'ic'); g.setAttribute('x', '7'); g.setAttribute('y', '7'); g.setAttribute('width', '12'); g.setAttribute('height', '12');
|
|
185
|
-
const u = document.createElementNS(SVGNS, 'use'); u.setAttribute('href', '#c3i-' + iconName); g.appendChild(u);
|
|
186
|
-
svg.appendChild(g);
|
|
187
|
-
return svg;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** Draw the compact confirm into host. opts: { label, mode: 'hold' | 'click', hash, alt, onConfirm(hash) }. Returns a dispose function.
|
|
191
|
-
* onConfirm fires once. A pointer hold of HOLD.ms (mode hold) or a pointer click (mode click) confirms; Enter or Space opens a
|
|
192
|
-
* Confirm step first, in both modes. Escape or Cancel closes the step. */
|
|
193
|
-
export function mountHold(host, { label = 'Confirm', mode = 'click', hash = null, alt = false, onConfirm } = {}) {
|
|
194
|
-
host.replaceChildren();
|
|
195
|
-
const root = node('div', { class: 'c3hold', 'data-confirm-mode': mode });
|
|
196
|
-
const btn = button({ label, variant: 'outline', onClick: (e) => {
|
|
197
|
-
if (e.detail === 0) return; // a key made this click: the key path has its own step
|
|
198
|
-
if (mode === 'click') fire();
|
|
199
|
-
}, attrs: { class: 'hb' + (alt ? ' alt' : ''), 'data-hold': mode,
|
|
200
|
-
'aria-label': label + (mode === 'hold' ? '. Press and hold, or press Enter and confirm.' : '. Click, or press Enter and confirm.'),
|
|
201
|
-
onPointerDown: (e) => start(e), onPointerUp: () => stop(), onPointerLeave: () => stop(), onPointerCancel: () => stop() } });
|
|
202
|
-
btn.prepend(ringIcon(mode === 'hold' ? 'lock' : 'check'));
|
|
203
|
-
const hint = node('span', { class: 'hint', 'aria-live': 'polite' }, document.createTextNode(mode === 'hold' ? 'Hold to confirm.' : ''));
|
|
204
|
-
root.append(btn, hint);
|
|
205
|
-
host.appendChild(root);
|
|
206
|
-
|
|
207
|
-
let fired = false; let timer = null; let stepOpen = false;
|
|
208
|
-
const fire = () => { if (fired) return; fired = true; clearTimer(); root.classList.add('done'); btn.disabled = true; try { if (typeof onConfirm === 'function') onConfirm(hash); } catch { /* the caller reports its own errors */ } };
|
|
209
|
-
function clearTimer() { if (timer) { clearTimeout(timer); timer = null; } }
|
|
210
|
-
const stop = () => { clearTimer(); btn.classList.remove('holding'); };
|
|
211
|
-
const start = (e) => {
|
|
212
|
-
if (fired || stepOpen || (e.button !== undefined && e.button > 0)) return;
|
|
213
|
-
if (mode === 'hold') { btn.classList.add('holding'); timer = setTimeout(() => { btn.classList.remove('holding'); fire(); }, HOLD.ms); }
|
|
214
|
-
};
|
|
215
|
-
const openStep = () => {
|
|
216
|
-
if (fired || stepOpen) return;
|
|
217
|
-
stepOpen = true; stop();
|
|
218
|
-
const close = () => { stepOpen = false; q.remove(); btn.hidden = false; hint.hidden = false; btn.focus(); };
|
|
219
|
-
const yes = button({ label: 'Confirm', onClick: fire, attrs: { class: 'pill', 'data-confirm': 'yes' } });
|
|
220
|
-
const no = button({ label: 'Cancel', onClick: close, attrs: { class: 'pill', 'data-confirm': 'no' } });
|
|
221
|
-
const q = node('div', { class: 'cq', role: 'group', 'aria-label': 'Confirm ' + label }, document.createTextNode(label + '?'), yes, no);
|
|
222
|
-
btn.hidden = true; hint.hidden = true; root.appendChild(q);
|
|
223
|
-
q.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); close(); } });
|
|
224
|
-
yes.focus();
|
|
225
|
-
};
|
|
226
|
-
btn.addEventListener('contextmenu', (e) => { if (mode === 'hold') e.preventDefault(); });
|
|
227
|
-
btn.addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && !e.repeat) { e.preventDefault(); openStep(); } });
|
|
228
|
-
btn.addEventListener('keyup', (e) => { if (e.key === ' ') e.preventDefault(); });
|
|
229
|
-
return function dispose() { stop(); fired = true; host.replaceChildren(); };
|
|
230
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* pm/c3-terminal-data.js — where the agent surfaces read and press, in one place.
|
|
2
|
-
* source() -> { demo, getRuns(), answer(body), correct(body), canPrompt, why, ... }
|
|
3
|
-
* REAL: GET /api/runs; POST /api/runs/answer and /api/runs/correction (a page press; the server refuses any other caller). send(id, m) types
|
|
4
|
-
* the message into the session and presses Enter, on the page's terminal socket (tab-term.js typeIntoSession: the frame the terminal's own keys
|
|
5
|
-
* use, under the page's launch nonce). The reply is in the session's terminal, which Open the session shows.
|
|
6
|
-
* DEMO: the fixtures of c3-demo-term.js, in the real response shapes, answers from memory and advances its own state; nothing is sent.
|
|
7
|
-
*
|
|
8
|
-
* needsYou(runs) is the one count for the needs-you badge: a run that asks, holds a permission, needs the terminal or did not start. */
|
|
9
|
-
import { pmGet, pmPost } from './http.js';
|
|
10
|
-
import { toast } from './c3-toast.js';
|
|
11
|
-
|
|
12
|
-
export const SENT = 'Sent to the session. The reply shows in the session panel and in its terminal.';
|
|
13
|
-
const NOT_SENT = 'Not sent: the connection to the workspace server is down. Your message is still here.';
|
|
14
|
-
|
|
15
|
-
/* what each verb types into the session */
|
|
16
|
-
function textOf(m) {
|
|
17
|
-
if (!m) return '';
|
|
18
|
-
if (m.verb === 'free') return String(m.text || '');
|
|
19
|
-
if (m.verb === 'suggest') return String(m.prompt || m.label || '');
|
|
20
|
-
if (m.verb === 'revise') return 'Revise it: ' + String(m.arg || '') + '.';
|
|
21
|
-
if (m.verb === 'retry') return 'Please try that again.';
|
|
22
|
-
return '';
|
|
23
|
-
}
|
|
24
|
-
async function sendToSession(id, m) {
|
|
25
|
-
const text = textOf(m).trim();
|
|
26
|
-
if (!id || !text) return { ok: false, error: 'nothing to send' };
|
|
27
|
-
const term = await import('./tab-term.js').catch(() => null);
|
|
28
|
-
const sent = !!(term && typeof term.typeIntoSession === 'function' && await term.typeIntoSession(id, text));
|
|
29
|
-
if (!sent) toast({ text: NOT_SENT, tone: 'error' });
|
|
30
|
-
return sent ? { ok: true, say: { text: SENT } } : { ok: false, error: NOT_SENT };
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const real = {
|
|
34
|
-
demo: false, canPrompt: true, why: '',
|
|
35
|
-
getRuns: () => pmGet('/api/runs'),
|
|
36
|
-
answer: (b) => pmPost('/api/runs/answer', b),
|
|
37
|
-
correct: (b) => pmPost('/api/runs/correction', b),
|
|
38
|
-
send: sendToSession,
|
|
39
|
-
};
|
|
40
|
-
/* demo: c3-demo.js registers the fixtures' factory (window.__c3termfx_make) by importing c3-demo-term.js; the page is in demo when installDemo() ran (window.__c3demo). */
|
|
41
|
-
export const isDemo = () => typeof window !== 'undefined' && !!window.__c3demo && typeof window.__c3termfx_make === 'function';
|
|
42
|
-
export const source = () => (isDemo() ? (window.__c3termfx || (window.__c3termfx = window.__c3termfx_make())) : real);
|
|
43
|
-
|
|
44
|
-
export function needsYou(r) {
|
|
45
|
-
if (!r || !r.ok || !r.cards) return 0;
|
|
46
|
-
const live = new Set([].concat((r.groups && r.groups.onCard) || [], (r.groups && r.groups.startedByMe) || [], (r.groups && r.groups.automatic) || []).filter((s) => s && s.endedAt == null).map((s) => s.id));
|
|
47
|
-
return Object.entries(r.cards).filter(([id, c]) => live.has(id) && c && ((c.permissions || []).length || ['asking', 'permission', 'attention', 'not_started'].includes(c.state))).length;
|
|
48
|
-
}
|