create-pmos 0.399.0 → 0.400.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 +18 -13
- 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 +2 -2
- package/workspace/briefing-premium-doc-edit-test.js +2 -8
- package/workspace/briefing-premium-test.js +3 -2
- package/workspace/briefing-premium-work-test.js +9 -4
- package/workspace/c3-capture-test.js +0 -17
- package/workspace/changelog.json +17 -0
- package/workspace/guide/briefing-premium.md +2 -2
- package/workspace/guide/home.md +20 -2
- 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/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 +2 -2
- 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 +20 -5
- package/workspace/public/pm/cozy-today.css +5 -2
- 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 +47 -26
- package/workspace/public/pm/home-chat.js +10 -4
- package/workspace/public/pm/home-data.js +3 -1
- package/workspace/public/pm/home-dictate.js +7 -4
- package/workspace/public/pm/home-ini.js +12 -2
- package/workspace/public/pm/home-list.js +20 -7
- 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 +10 -6
- package/workspace/public/pm/home-work.js +15 -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/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 +3 -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,369 +0,0 @@
|
|
|
1
|
-
/* pm/c3-design-studio.js — the DESIGN STUDIO and the saved DESIGN BRIEF of a report (initiative report-design-studio; PRD sections 1 and 2;
|
|
2
|
-
* mockup 42-reportdeck.js, hashes #design, #design-point, #design-compare, #design-doc, #design-saved).
|
|
3
|
-
*
|
|
4
|
-
* openStudio({ ws, id, name, view, onClose }) the wide sheet: the conversation on the left (describe, add samples, turns, the PMOS lines
|
|
5
|
-
* that name each version), the live result on the right (the version strip, Compare two,
|
|
6
|
-
* go back to a version, point and say), the Deck / Document switch, This is it, Design brief
|
|
7
|
-
* openBrief({ ws, id, name }) the saved design in the report setup sheet: the description, the samples, the reference
|
|
8
|
-
* version, the rules PMOS wrote, and the cycles drafted to match it
|
|
9
|
-
* Entry points: "Design how it looks" on a setup row and "Refine the design" in a report document (c3-report-setup.js, c3-report-deck.js).
|
|
10
|
-
* A turn starts ONE report-design job on the server (POST /api/report-design/turn); the page shows it running and reads GET /api/report-design
|
|
11
|
-
* until the version lands. The page can be left: the job goes on. Nothing here sends anything outside the workspace. */
|
|
12
|
-
import { el } from './dom.js';
|
|
13
|
-
import { icon, pbtn, btn, chip, sect, put, lk } from './c3-ini-ui.js';
|
|
14
|
-
import { openSheet, closeSheet } from './c3-sheet.js';
|
|
15
|
-
import { toast } from './c3-toast.js';
|
|
16
|
-
import { RS, scheduleLabel } from './c3-report-store.js';
|
|
17
|
-
import { formatOf } from './c3-doc-formats.js';
|
|
18
|
-
import { RD, failed, splitRender, slideCard, frame, wireFrame, diffOutlines, ensureDeckCss, slotWord } from './c3-report-deck.js';
|
|
19
|
-
import { openStructure, structureSection } from './c3-report-structure.js';
|
|
20
|
-
|
|
21
|
-
const MAX = 20 * 1024 * 1024;
|
|
22
|
-
const KIND_OF = (name) => { const e = String(name || '').toLowerCase().split('.').pop(); return e === 'pdf' ? 'pdf' : e === 'pptx' ? 'pptx' : e === 'docx' ? 'docx' : /^(png|jpe?g)$/.test(e) ? 'image' : ''; };
|
|
23
|
-
const SICON = { pdf: 'pdf', pptx: 'img', docx: 'doc', image: 'img', pictures: 'img', link: 'link', 'pmos-doc': 'doc' };
|
|
24
|
-
const SWORD = { pdf: 'Upload, PDF', pptx: 'Upload, .pptx', docx: 'Upload, .docx', image: 'Upload, image', pictures: 'Page pictures', link: 'Link', 'pmos-doc': 'Past PMOS document' };
|
|
25
|
-
/* the studio's width, as a session's terminal sheet has it: half, three-quarters or the whole window; kept on this browser */
|
|
26
|
-
const SIZE_KEY = 'pmos.workspace.c3.studio-size';
|
|
27
|
-
export const STUDIO_SIZES = [['half', 'Half', 'Half of the window'], ['three-quarters', '3/4', 'Three-quarters of the window'], ['whole', 'Whole', 'Whole window']];
|
|
28
|
-
const sizeOf = (v) => (STUDIO_SIZES.some((x) => x[0] === v) ? v : 'whole');
|
|
29
|
-
const sizeStore = { get() { try { return localStorage.getItem(SIZE_KEY); } catch { return null; } }, set(v) { try { localStorage.setItem(SIZE_KEY, v); } catch { /* no storage */ } } };
|
|
30
|
-
const hhmm = (iso) => { const m = /T(\d{2}):(\d{2})/.exec(String(iso || '')); return m ? m[1] + ':' + m[2] : ''; };
|
|
31
|
-
const dayAt = (iso) => { const m = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})/.exec(String(iso || '')); return m ? slotWord(m[1]) + ', ' + m[2] + ':' + m[3] : String(iso || ''); };
|
|
32
|
-
const short = (t, n = 60) => { const s = String(t || '').replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1) + '…' : s; };
|
|
33
|
-
const hint = (k) => (/headline|metric/.test(k) ? 'Hover a value for its detail. Click a number to see its source.' : /list/.test(k) ? 'Click a status to see where it comes from.' : 'Click any part of the preview to attach a request to it.');
|
|
34
|
-
|
|
35
|
-
/* one studio session per report setup: what the PM points at waits here until the next turn */
|
|
36
|
-
const LOCAL = {};
|
|
37
|
-
const local = (id) => LOCAL[id] || (LOCAL[id] = { view: null, cmp: false, cmpA: null, sidx: 0, point: true, markers: [], draft: null, mOpen: null, panel: false, text: '', fmt: null });
|
|
38
|
-
|
|
39
|
-
function sampleChip(s) {
|
|
40
|
-
const th = s.thumb && /^data:image\//.test(s.thumb) ? el('img', { class: 'rd-dks-thumb img', src: s.thumb, alt: '' }) : el('span', { class: 'rd-dks-thumb ' + (s.kind === 'pptx' || s.kind === 'image' || s.kind === 'pictures' || (s.via === 'chrome' && s.kind === 'pdf') ? 'deck' : 'page'), 'aria-hidden': 'true' }, el('i'), el('i'), el('i'));
|
|
41
|
-
return el('div', { class: 'rd-dks-smp', 'data-rd-sample': s.id }, th, el('div', null, el('b', null, icon(SICON[s.kind] || 'doc', 'sm'), s.name), el('span', { class: 'dim mono' }, s.line || SWORD[s.kind] || s.kind),
|
|
42
|
-
s.hint ? [el('p', { class: 'rd-warn', 'data-rd-hint': '' }, s.hint), s.took ? el('p', null, el('span', { class: 'dim' }, 'PMOS took: '), s.took) : null]
|
|
43
|
-
: s.readable === false ? el('p', { class: 'rd-warn' }, 'PMOS could not read it with your tools. It is kept, but it does not shape the design.')
|
|
44
|
-
: el('p', null, el('span', { class: 'dim' }, 'PMOS took: '), s.took || 'PMOS reads it on the next turn.')));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/* put() that leaves a node in place when it stays: only the nodes that go are taken out, so a kept frame does not load again */
|
|
48
|
-
function keep(host, ...kids) {
|
|
49
|
-
const want = kids.flat(Infinity).filter((k) => k != null && k !== false && k !== true).map((k) => (typeof k === 'string' ? document.createTextNode(k) : k));
|
|
50
|
-
const set = new Set(want);
|
|
51
|
-
for (const c of [...host.childNodes]) if (!set.has(c)) c.remove();
|
|
52
|
-
let ref = host.firstChild;
|
|
53
|
-
for (const n of want) { if (n === ref) ref = ref.nextSibling; else host.insertBefore(n, ref); }
|
|
54
|
-
return host;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* ── the studio ── */
|
|
58
|
-
export function openStudio({ ws, id, name, view, onClose } = {}) {
|
|
59
|
-
ensureDeckCss();
|
|
60
|
-
const K = local(id); if (view != null) { K.view = view; K.cmp = false; }
|
|
61
|
-
const S = { D: null, setup: null, err: '', cache: {}, timer: null, closed: false, busy: false };
|
|
62
|
-
const body = el('div', { class: 'brief rs rd-dk rd-dks-wrap', 'data-rd-studio': id });
|
|
63
|
-
let size = sizeOf(sizeStore.get());
|
|
64
|
-
const sizeBtns = STUDIO_SIZES.map(([k, label, title]) => btn({ class: 'ds-btn', 'aria-pressed': String(k === size), 'data-rd-size': k, title, 'aria-label': title, onclick: () => setSize(k) }, label));
|
|
65
|
-
const seg = el('div', { class: 'seg rd-dks-size', role: 'group', 'aria-label': 'Studio width' }, ...sizeBtns);
|
|
66
|
-
const ui = openSheet({ title: 'Design studio', icon: 'spark', wide: true, dw: true, cls: 'rd-wide rdsz-' + size, body, actions: [seg], onClose: () => { S.closed = true; clearTimeout(S.timer); clearInterval(S.watch); window.removeEventListener('focus', checkNew); if (onClose) onClose(); } });
|
|
67
|
-
function setSize(k) {
|
|
68
|
-
ui.sheet.classList.remove('rdsz-' + size); size = sizeOf(k); ui.sheet.classList.add('rdsz-' + size);
|
|
69
|
-
sizeStore.set(size);
|
|
70
|
-
sizeBtns.forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.rdSize === size)));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/* follow: show the current version when it changed (a job landed). A read that changed nothing paints nothing: the poll reads the design
|
|
74
|
-
* every 1.5 seconds while a job runs, and a repaint rebuilt the conversation and the box the PM types in. */
|
|
75
|
-
async function load(keepView, follow) {
|
|
76
|
-
const r = await RD.design(ws, id);
|
|
77
|
-
if (!r || r.ok === false) { S.err = (r && r.error) || 'The design could not be read.'; S.shown = null; paint(); return; }
|
|
78
|
-
const prev = S.D ? S.D.current : null;
|
|
79
|
-
S.D = r.design; S.setup = r.setup || { id, name };
|
|
80
|
-
if (!K.fmt || !S.D.versions.length) K.fmt = S.D.format || 'deck';
|
|
81
|
-
if (!keepView || K.view == null || !S.D.versions.some((v) => v.n === K.view) || (follow && S.D.current !== prev)) K.view = S.D.current;
|
|
82
|
-
if (S.D.running || (S.D.samples || []).some((x) => x.fetching)) poll(); else clearTimeout(S.timer);
|
|
83
|
-
if (K.view != null) await render(K.view);
|
|
84
|
-
if (K.cmp) await render(cmpA());
|
|
85
|
-
const shown = JSON.stringify([r.design, r.setup, K.view, K.cmp, K.cmp ? cmpA() : null, Object.keys(S.cache)]);
|
|
86
|
-
if (shown === S.shown) return;
|
|
87
|
-
S.shown = shown; paint();
|
|
88
|
-
}
|
|
89
|
-
async function render(n) {
|
|
90
|
-
if (n == null || S.cache[n]) return;
|
|
91
|
-
try { S.cache[n] = splitRender(await RD.version(ws, id, n)); } catch (e) { const style = ''; S.cache[n] = { err: (e && e.message) || 'not readable', slides: [], secs: [], style, body: '' }; }
|
|
92
|
-
}
|
|
93
|
-
/* A sample added from another tab (the PMOS Chrome extension) shows here: the open studio reads the design every few seconds and when the window gets focus. */
|
|
94
|
-
const sampleSig = (D) => ((D && D.samples) || []).map((x) => x.id + (x.fetching ? '~' : '')).join(',');
|
|
95
|
-
async function checkNew() {
|
|
96
|
-
if (S.closed || S.busy || !S.D || S.D.running) return;
|
|
97
|
-
const r = await RD.design(ws, id);
|
|
98
|
-
if (S.closed || !r || r.ok === false || !r.design || !S.D || S.D.running) return;
|
|
99
|
-
if (sampleSig(r.design) !== sampleSig(S.D)) load(true);
|
|
100
|
-
}
|
|
101
|
-
S.watch = setInterval(checkNew, 4000);
|
|
102
|
-
window.addEventListener('focus', checkNew);
|
|
103
|
-
function poll() { clearTimeout(S.timer); S.timer = setTimeout(async () => { if (S.closed) return; const was = S.D && S.D.current; await load(true, true); if (S.D && !S.D.running && S.D.current !== was) { K.markers = []; K.draft = null; scrollLog(); } }, 1500); }
|
|
104
|
-
/* The preview's frames are kept from one paint to the next: a frame that is taken out of the page and put back loads again, and every
|
|
105
|
-
* paint rebuilt the slide and its thumbnails, so they flickered on each read while a job ran and on each click. */
|
|
106
|
-
const KEPT = {};
|
|
107
|
-
const reuse = (slot, key, make) => { const k = KEPT[slot]; if (k && k.key === key) return k.node; const node = make(); KEPT[slot] = { key, node }; return node; };
|
|
108
|
-
const ver = (n) => (S.D.versions || []).find((v) => v.n === n);
|
|
109
|
-
const cmpA = () => { const b = S.D.current; const a = K.cmpA != null && K.cmpA !== b && ver(K.cmpA) ? K.cmpA : (S.D.versions.filter((v) => v.n < b).pop() || S.D.versions.find((v) => v.n !== b) || {}).n; return a; };
|
|
110
|
-
const scrollLog = () => requestAnimationFrame(() => { const l = body.querySelector('.rd-dks-log'); if (l) l.scrollTop = l.scrollHeight; });
|
|
111
|
-
const vlabel = (v) => (v ? (v.turn ? short(v.turn, 48) : v.n === 1 ? 'From your description' : 'Your turn') : '');
|
|
112
|
-
|
|
113
|
-
/* ── the conversation ── */
|
|
114
|
-
function msg(l) {
|
|
115
|
-
const you = l.who === 'you';
|
|
116
|
-
const sm = l.kind === 'sample' ? (S.D.samples || []).filter((s) => (l.sample ? s.id === l.sample : String(l.text || '').includes(s.name))) : [];
|
|
117
|
-
const v = l.version != null ? ver(l.version) : null;
|
|
118
|
-
return el('li', { class: 'rd-dks-msg ' + (you ? 'you' : 'pmos') + (l.kind === 'error' ? ' err' : ''), 'data-rd-log': l.kind },
|
|
119
|
-
el('span', { class: 'ds-av ' + (you ? 'h' : l.kind === 'error' ? 'w' : 'a') }, you ? icon('user', 'sm') : icon(l.kind === 'error' ? 'alert' : 'spark', 'sm')),
|
|
120
|
-
el('div', { class: 'bub' }, el('div', { class: 'who' }, you ? 'You' : 'PMOS'), l.text && !(l.kind === 'sample' && sm.length) ? el('p', null, l.text) : null, sm.map(sampleChip),
|
|
121
|
-
l.points && l.points.length ? chip(icon('target', 'sm'), 'Pointed at: marker ' + l.points.map((p) => p.n).join(', ') + ' on the preview') : null,
|
|
122
|
-
v ? lk({ class: 'rd-dks-ver', 'data-rd-ver': String(v.n), 'aria-pressed': String(K.view === v.n && !K.cmp), onclick: () => look(v.n) }, icon('img', 'sm'), 'D' + v.n + ': ' + vlabel(v)) : null));
|
|
123
|
-
}
|
|
124
|
-
function runningMsg() {
|
|
125
|
-
const n = (S.D.versions.length ? Math.max(...S.D.versions.map((v) => v.n)) : 0) + 1;
|
|
126
|
-
return el('li', { class: 'rd-dks-msg pmos', 'data-rd-running': '' }, el('span', { class: 'ds-av a' }, icon('spark', 'sm')),
|
|
127
|
-
el('div', { class: 'bub' }, el('div', { class: 'who' }, 'PMOS'), el('p', null, 'Making D' + n + ' from this cycle\'s data. This takes a minute or two. You can close the studio; the version lands here when the job ends.')));
|
|
128
|
-
}
|
|
129
|
-
function panel() {
|
|
130
|
-
if (!K.panel) return null;
|
|
131
|
-
const file = el('input', { type: 'file', class: 'rd-hide', accept: '.pdf,.pptx,.docx,.png,.jpg,.jpeg', 'data-rd-file': '', onChange: (e) => upload(e.target.files && e.target.files[0]) });
|
|
132
|
-
const link = el('input', { type: 'text', 'data-rd-link': '', placeholder: 'Paste a link to keep with the design', 'aria-label': 'Link to a sample', onKeyDown: (e) => { if (e.key === 'Enter') addLink(); } });
|
|
133
|
-
const docs = (RS.docs || []).filter((d) => d.setup !== id || d.state === 'issued').slice(0, 3);
|
|
134
|
-
return el('div', { class: 'rd-dks-panel', 'data-rd-panel': '' }, el('div', { class: 'ds-h' }, 'Add a sample'),
|
|
135
|
-
btn({ class: 'rd-dks-opt', 'data-rd-smp': 'file', onclick: () => file.click() }, icon('drop', 'sm'), el('span', null, 'Upload a past deck or document', el('br'), el('span', { class: 'dim rd-small' }, 'PDF, .pptx, .docx or a screenshot, up to 20 MB'))), file,
|
|
136
|
-
el('div', { class: 'ds-whyadd' }, link, btn({ class: 'ds-btn', 'data-rd-smp': 'link', onclick: () => addLink() }, 'Add')),
|
|
137
|
-
btn({ class: 'rd-dks-opt', 'data-rd-smp': 'chrome', 'aria-expanded': String(!!K.chrome), onclick: () => { K.chrome = !K.chrome; paint(); } }, icon('out', 'sm'), el('span', null, 'From Chrome', el('br'), el('span', { class: 'dim rd-small' }, 'Open any page in Chrome and press the PMOS button. Decks come as a PDF, other pages as pictures.'))),
|
|
138
|
-
K.chrome ? el('div', { class: 'fold', 'data-rd-chrome': '' }, icon('info', 'sm'), el('span', null, 'In Chrome, open the page you want, for example a Google Slides deck, and press the PMOS button in the toolbar. Choose this report and press Add as a sample. The sample shows here in a moment. If the PMOS button is not in Chrome yet, run ', el('code', null, 'pmos extension'), ' in a terminal for the steps to load it.')) : null,
|
|
139
|
-
docs.map((d) => btn({ class: 'rd-dks-opt', 'data-rd-smp': 'doc', 'data-v': d.path, onclick: () => addDoc(d) }, icon('doc', 'sm'), el('span', null, 'Pick a past PMOS document', el('br'), el('span', { class: 'dim rd-small' }, d.name + ', ' + slotWord(d.slot))))),
|
|
140
|
-
el('div', { class: 'dim rd-small' }, 'PMOS reads a sample to learn how it looks. It does not copy its numbers. A Google or Confluence link is read through your connectors for its words and structure, not its look.'));
|
|
141
|
-
}
|
|
142
|
-
async function sampleDone(r) {
|
|
143
|
-
if (!r || !r.ok) { failed(r, 'The sample was not added'); return; }
|
|
144
|
-
K.panel = false; await load(true); scrollLog(); toast('Added the sample. Say what to take from it, then make the next version.');
|
|
145
|
-
}
|
|
146
|
-
function upload(f) {
|
|
147
|
-
if (!f) return;
|
|
148
|
-
const kind = KIND_OF(f.name); if (!kind) { toast({ text: 'PMOS reads PDF, .pptx, .docx, PNG or JPG files.', tone: 'error' }); return; }
|
|
149
|
-
if (f.size > MAX) { toast({ text: 'The file is larger than 20 MB. Add a smaller copy, or a link.', tone: 'error' }); return; }
|
|
150
|
-
const rd = new FileReader();
|
|
151
|
-
rd.onload = async () => { const data = String(rd.result || '').replace(/^data:[^,]*,/, ''); sampleDone(await RD.sample({ ws, id, name: f.name, kind, data })); };
|
|
152
|
-
rd.readAsDataURL(f);
|
|
153
|
-
}
|
|
154
|
-
async function addLink() { const i = body.querySelector('[data-rd-link]'); const v = i && i.value.trim(); if (!v) { if (i) i.focus(); return; } sampleDone(await RD.sample({ ws, id, link: v })); }
|
|
155
|
-
async function addDoc(d) { sampleDone(await RD.sample({ ws, id, doc: d.path })); }
|
|
156
|
-
|
|
157
|
-
function chat() {
|
|
158
|
-
const D = S.D; const first = !D.versions.length;
|
|
159
|
-
const ta = el('textarea', { 'data-rd-in': '', 'aria-label': first ? 'Describe the report' : 'Tell PMOS what to change',
|
|
160
|
-
placeholder: first ? 'Describe the report in plain words: who reads it, what they need to see first, what must stand out.' : K.fmt === 'deck' ? 'Tell PMOS what to change, for example: denser, like slide 3 of my sample' : 'Tell PMOS what to change, for example: put the chart before the summary',
|
|
161
|
-
onInput: (e) => { K.text = e.target.value; }, onKeyDown: (e) => { if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') { e.preventDefault(); send(); } } });
|
|
162
|
-
ta.value = K.text;
|
|
163
|
-
return el('div', { class: 'rd-dks-chat' }, el('div', { class: 'rd-dks-desc' }, el('span', { class: 'dim mono' }, 'DESCRIBE, ADD SAMPLES, REFINE'),
|
|
164
|
-
(D.samples || []).length ? el('div', { class: 'chips' }, D.samples.map((s) => chip(icon(SICON[s.kind] || 'doc', 'sm'), s.name))) : null),
|
|
165
|
-
el('ul', { class: 'rd-dks-log', 'data-rd-chat': '' }, (D.log || []).map(msg), D.running ? runningMsg() : null,
|
|
166
|
-
!(D.log || []).length && !D.running ? el('li', { class: 'fold' }, icon('info', 'sm'), ' Start with who reads the report and what they need. Add a past deck or document if you have one.') : null),
|
|
167
|
-
panel(),
|
|
168
|
-
el('div', { class: 'rd-dks-in' }, ta, K.markers.length ? el('div', { class: 'chips' }, chip(icon('target', 'sm'), K.markers.length + (K.markers.length === 1 ? ' request' : ' requests') + ' on the preview go with this turn')) : null,
|
|
169
|
-
el('div', { class: 'ds-acts rd-between' }, btn({ class: 'ds-btn', 'data-rd-act': 'panel', 'aria-expanded': String(K.panel), onclick: () => { K.panel = !K.panel; paint(); } }, icon('plus', 'sm'), 'Add a sample'),
|
|
170
|
-
btn({ class: 'ds-btn ag', 'data-rd-act': 'send', disabled: !!D.running || S.busy, onclick: () => send() }, icon('spark', 'sm'), first ? 'Make the first version' : 'Make the next version')),
|
|
171
|
-
el('div', { class: 'dim rd-small' }, 'Each turn makes a new version. The data stays this cycle\'s; only how it looks changes.')));
|
|
172
|
-
}
|
|
173
|
-
async function send(textIn) {
|
|
174
|
-
const D = S.D; const i = body.querySelector('[data-rd-in]');
|
|
175
|
-
let text = String(textIn != null ? textIn : (i ? i.value : K.text) || '').trim();
|
|
176
|
-
if (!text && K.markers.length) text = 'Do the requests I pointed at.';
|
|
177
|
-
if (!text) { if (i) i.focus(); return; }
|
|
178
|
-
if (D.running) { toast('A version is being made. Wait for it to land.'); return; }
|
|
179
|
-
S.busy = true; paint();
|
|
180
|
-
let r;
|
|
181
|
-
if (!D.description) { r = await RD.describe({ ws, id, text, format: K.fmt }); if (!r || !r.ok) { S.busy = false; paint(); failed(r, 'The description was not saved'); return; } }
|
|
182
|
-
const points = K.markers.map((m) => ({ n: m.n, slide: m.slide, x: m.x, y: m.y, text: m.text }));
|
|
183
|
-
r = await RD.turn({ ws, id, text: D.description ? text : 'Make the first version from my description.', points });
|
|
184
|
-
S.busy = false;
|
|
185
|
-
if (!r || !r.ok) { paint(); if (r && (r.status === 409 || /run/i.test(String(r.error || '')))) toast('A version is being made. Wait for it to land.'); else failed(r, 'PMOS did not start'); return; }
|
|
186
|
-
/* the preview follows the version this turn makes: a fast job can land it before this load, and keepView would hold the old one */
|
|
187
|
-
K.text = ''; K.markers = []; K.draft = null; K.mOpen = null; K.view = null; K.cmp = false;
|
|
188
|
-
await load(true); scrollLog();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/* ── the result ── */
|
|
192
|
-
function look(n) { K.view = n; K.cmp = false; render(n).then(paint); }
|
|
193
|
-
function strip() {
|
|
194
|
-
const D = S.D; const cur = D.current;
|
|
195
|
-
return el('div', { class: 'rd-dks-vers' }, el('div', { class: 'seg', role: 'group', 'aria-label': 'Versions', 'data-rd-versions': '' }, D.versions.map((v) => btn({ 'data-rd-v': String(v.n), 'aria-pressed': String(K.view === v.n && !K.cmp), title: vlabel(v), onclick: () => look(v.n) }, 'D' + v.n, D.saved && D.saved.version === v.n ? icon('check', 'sm') : null))),
|
|
196
|
-
el('span', { class: 'chips2' }, K.view !== cur && !K.cmp ? btn({ class: 'ds-btn', 'data-rd-act': 'revert', onclick: () => revert(K.view) }, icon('undo', 'sm'), 'Go back to D' + K.view) : null,
|
|
197
|
-
D.versions.length > 1 ? btn({ class: 'ds-btn', 'data-rd-act': 'cmp', 'aria-pressed': String(K.cmp), onclick: async () => { K.cmp = !K.cmp; if (K.cmp) { K.view = cur; await render(cur); await render(cmpA()); } paint(); } }, icon('cols', 'sm'), K.cmp ? 'Stop comparing' : 'Compare two') : null));
|
|
198
|
-
}
|
|
199
|
-
async function revert(n) {
|
|
200
|
-
const r = await RD.revert({ ws, id, n }); if (!r || !r.ok) { failed(r, 'It did not go back'); return; }
|
|
201
|
-
await load(true); toast('Back to D' + n + '. The next turn builds on it. The later versions stay in the strip.');
|
|
202
|
-
}
|
|
203
|
-
function markers(key, scaleBox) {
|
|
204
|
-
if (!K.point) return [];
|
|
205
|
-
const L = K.markers.filter((m) => m.slide === key).map((m) => { const b = btn({ class: 'rd-pindot a rd-dks-mk' + (K.mOpen === m.id ? ' on' : ''), 'data-rd-mk': String(m.n), 'aria-label': 'Request ' + m.n + ': ' + m.text, onclick: () => { K.mOpen = K.mOpen === m.id ? null : m.id; paint(); } }, String(m.n)); place(b, m, scaleBox); return b; });
|
|
206
|
-
if (K.draft && K.draft.slide === key) { const d = el('span', { class: 'rd-pindot a on rd-dks-mk', 'aria-hidden': 'true' }, String(K.markers.length + 1)); place(d, K.draft, scaleBox); L.push(d); }
|
|
207
|
-
return L;
|
|
208
|
-
}
|
|
209
|
-
const place = (n, m, box) => { if (box) { n.style.setProperty('--rp-x', Math.round(box.left + box.width * m.x / 100) + 'px'); n.style.setProperty('--rp-y', Math.round(box.top + box.height * m.y / 100) + 'px'); } else { n.style.setProperty('--rp-x', m.x + '%'); n.style.setProperty('--rp-y', m.y + '%'); } };
|
|
210
|
-
function pointSect(key) {
|
|
211
|
-
const ms = K.markers.filter((m) => m.slide === key);
|
|
212
|
-
const draft = K.draft && K.draft.slide === key ? el('div', { class: 'ds-whyadd' }, el('input', { type: 'text', 'data-rd-mkdraft': '', placeholder: 'What should change here? For example: make this a table', 'aria-label': 'Request for this spot', onKeyDown: (e) => { if (e.key === 'Enter') saveMk(); } }),
|
|
213
|
-
btn({ class: 'ds-btn pri', 'data-rd-act': 'mksave', onclick: () => saveMk() }, 'Attach'), btn({ class: 'ds-btn', 'data-rd-act': 'mkcancel', onclick: () => { K.draft = null; paint(); } }, 'Cancel')) : null;
|
|
214
|
-
return sect({ ic: 'target', title: 'Point and say', count: ms.length, attrs: { 'data-rd-point': key },
|
|
215
|
-
right: el('label', { class: 'ds-tg' }, el('input', { type: 'checkbox', checked: K.point, 'data-rd-ck': 'point', onChange: (e) => { K.point = e.target.checked; K.draft = null; paint(); } }), 'On') },
|
|
216
|
-
ms.length ? el('ul', { class: 'ds-log rd-notes' }, ms.map((m) => el('li', { class: 'rd-note' + (K.mOpen === m.id ? ' on' : ''), 'data-rd-mkrow': String(m.n) },
|
|
217
|
-
btn({ class: 'rd-pindot a', 'aria-label': 'Request ' + m.n, onclick: () => { K.mOpen = K.mOpen === m.id ? null : m.id; paint(); } }, String(m.n)),
|
|
218
|
-
el('div', { class: 'ds-le' }, el('div', { class: 'l1' }, el('b', null, m.text), el('span', { class: 'when' }, 'Waiting')),
|
|
219
|
-
K.mOpen === m.id ? [el('div', { class: 'who' }, el('span', null, 'PMOS makes it in the next version, with your other requests.')), el('div', { class: 'ds-acts' }, btn({ class: 'ds-btn ag', 'data-rd-act': 'mkgo', onclick: () => send(K.text.trim() || 'Do the requests I pointed at.') }, icon('spark', 'sm'), 'Make the next version'), btn({ class: 'ds-btn', 'data-rd-act': 'mkdrop', onclick: () => { K.markers = K.markers.filter((x) => x.id !== m.id).map((x, k) => ({ ...x, n: k + 1 })); K.mOpen = null; paint(); } }, icon('trash', 'sm'), 'Remove'))] : null)))) : null,
|
|
220
|
-
draft, el('div', { class: 'dim rd-small' }, K.point ? 'Click any part of the preview to attach a request to it.' : 'Point and say is off.'));
|
|
221
|
-
}
|
|
222
|
-
function saveMk() {
|
|
223
|
-
const i = body.querySelector('[data-rd-mkdraft]'); const t = i && i.value.trim(); if (!t) { if (i) i.focus(); return; }
|
|
224
|
-
const m = { id: 'm' + Date.now(), n: K.markers.length + 1, slide: K.draft.slide, x: K.draft.x, y: K.draft.y, text: t };
|
|
225
|
-
K.markers.push(m); K.draft = null; K.mOpen = m.id; paint();
|
|
226
|
-
}
|
|
227
|
-
const pointHands = (getBox) => ({ place: (e, doc) => { if (!K.point) return false; const b = getBox(e, doc); if (!b) return false; K.draft = { slide: b.id, x: Math.round(b.x), y: Math.round(b.y) }; paint(); const i = body.querySelector('[data-rd-mkdraft]'); if (i) i.focus(); return true; } });
|
|
228
|
-
function preview() {
|
|
229
|
-
const D = S.D;
|
|
230
|
-
if (!D.versions.length) return [D.running ? el('div', { class: 'fold a', role: 'status' }, icon('clock', 'sm'), ' PMOS is making the first version.') : null,
|
|
231
|
-
el('div', { class: 'fold rd-none', 'data-rd-noversion': '' }, icon('info', 'sm'), ' No version yet. Describe the report on the left, add a sample if you have one, then press Make the first version.')];
|
|
232
|
-
if (K.cmp) return [strip(), compare()];
|
|
233
|
-
const v = ver(K.view) || ver(D.current); const R = S.cache[v.n];
|
|
234
|
-
const capline = el('div', { class: 'dim rd-small', 'data-rd-vcap': String(v.n) }, el('b', { class: 'rd-fg' }, 'D' + v.n), ' · ' + vlabel(v) + ' · made ' + hhmm(v.made_at) + '. Built with this cycle\'s real data.' + (v.n !== D.current ? ' You are looking at an older version.' : ''));
|
|
235
|
-
const run = D.running ? el('div', { class: 'fold a', role: 'status' }, icon('clock', 'sm'), ' PMOS is making the next version. This one stays on screen until it lands.') : null;
|
|
236
|
-
if (!R) return [strip(), capline, el('div', { class: 'fold', role: 'status' }, icon('clock', 'sm'), ' Reading D' + v.n + '.')];
|
|
237
|
-
if (R.err) return [strip(), capline, el('div', { class: 'fold w', role: 'alert' }, icon('alert', 'sm'), ' D' + v.n + ' could not be read: ' + R.err + '.')];
|
|
238
|
-
if (R.format === 'doc') {
|
|
239
|
-
const card = reuse('doc', v.n, () => {
|
|
240
|
-
const c = el('div', { class: 'rd-docf rd-dks-doc', 'data-rd-sbig': 'doc' }); const layer = el('div', { class: 'rd-doclayer' });
|
|
241
|
-
const box = (e) => { const sec = e.target.closest && e.target.closest('section.pmos-sec'); if (!sec) return null; const r = sec.getBoundingClientRect(); return { id: sec.getAttribute('data-sec-id'), x: (e.clientX - r.left) / r.width * 100, y: (e.clientY - r.top) / r.height * 100 }; };
|
|
242
|
-
c.append(frame(R.style, R.body, { title: 'D' + v.n + ', the document', cls: 'pmos-doc', focusable: true, onLoad: (doc, fr) => {
|
|
243
|
-
const fit = () => { if (!doc.documentElement) return; fr.style.setProperty('--rp-h', Math.max(200, doc.documentElement.scrollHeight) + 'px'); const L = []; for (const s of R.secs) { const n = doc.querySelector('section.pmos-sec[data-sec-id="' + s.id.replace(/"/g, '') + '"]'); if (n) L.push(...markers(s.id, n.getBoundingClientRect())); } put(layer, ...L); };
|
|
244
|
-
c.fit = fit; fit(); setTimeout(fit, 120); wireFrame(doc, { ...pointHands(box), more: fit });
|
|
245
|
-
} }), layer);
|
|
246
|
-
return c;
|
|
247
|
-
});
|
|
248
|
-
card.classList.toggle('placing', !!K.point); if (card.fit) card.fit();
|
|
249
|
-
const key = K.draft ? K.draft.slide : (K.markers[0] || {}).slide || (R.secs[0] || {}).id || 'doc';
|
|
250
|
-
return [strip(), capline, run, card, pointSect(key)];
|
|
251
|
-
}
|
|
252
|
-
if (!R.slides.length) return [strip(), capline, el('div', { class: 'fold w' }, icon('alert', 'sm'), ' D' + v.n + ' has no slide.')];
|
|
253
|
-
K.sidx = Math.min(K.sidx, R.slides.length - 1); const s = R.slides[K.sidx];
|
|
254
|
-
const big = reuse('big', v.n + '/' + s.id, () => slideCard(R, s, { cls: 'rd-big', attrs: { 'data-rd-sbig': s.id }, focusable: true, wire: (doc) => wireFrame(doc, pointHands((e) => ({ id: s.id, x: e.clientX / 1280 * 100, y: e.clientY / 720 * 100 }))) }));
|
|
255
|
-
big.classList.toggle('placing', !!K.point); [...big.children].forEach((c) => { if (c.tagName !== 'IFRAME') c.remove(); }); big.append(...markers(s.id));
|
|
256
|
-
const thumbs = reuse('thumbs', v.n, () => thumbStrip(R, K.sidx, (i) => { K.sidx = i; K.draft = null; paint(); }));
|
|
257
|
-
thumbs.querySelectorAll('[data-rd-sgo]').forEach((b) => b.setAttribute('aria-current', String(Number(b.getAttribute('data-rd-sgo')) === K.sidx)));
|
|
258
|
-
return [strip(), capline, run, thumbs,
|
|
259
|
-
el('div', { class: 'rd-dk-cap' }, el('b', { 'data-rd-scap': '' }, 'Slide ' + s.n + ' of ' + R.slides.length + ': ' + s.title), el('span', { class: 'dim rd-small' }, hint(s.kind))), big, pointSect(s.id)];
|
|
260
|
-
}
|
|
261
|
-
function thumbStrip(R, cur, pick) {
|
|
262
|
-
return el('nav', { class: 'rd-dk-strip h', 'aria-label': 'Slides', 'data-rd-sstrip': '' }, R.slides.map((s, i) => btn({ class: 'rd-dk-th', 'aria-current': String(cur === i), 'aria-label': 'Slide ' + s.n + ': ' + s.title, 'data-rd-sgo': String(i), onclick: () => pick(i) },
|
|
263
|
-
el('div', { inert: '' }, slideCard(R, s, { cls: 'rd-thumb' })), el('span', { class: 'rd-dk-thn' }, String(s.n)))));
|
|
264
|
-
}
|
|
265
|
-
function compare() {
|
|
266
|
-
const D = S.D; const b = D.current; const a = cmpA(); const RA = S.cache[a]; const RB = S.cache[b];
|
|
267
|
-
const seg = el('div', { class: 'rd-dk-cap' }, el('span', { class: 'chips2 rd-wrap' }, 'Compare ', el('div', { class: 'seg', role: 'group', 'aria-label': 'Compare with', 'data-rd-cmpa': '' }, D.versions.filter((v) => v.n !== b).map((v) => btn({ 'data-rd-a': String(v.n), 'aria-pressed': String(a === v.n), onclick: async () => { K.cmpA = v.n; await render(v.n); paint(); } }, 'D' + v.n))), ' with ', el('b', null, 'D' + b)));
|
|
268
|
-
if (!RA || !RB) return el('div', null, seg, el('div', { class: 'fold', role: 'status' }, icon('clock', 'sm'), ' Reading both versions.'));
|
|
269
|
-
const va = ver(a); const vb = ver(b);
|
|
270
|
-
const ch = diffOutlines(va.outline, vb.outline); if (vb.turn) ch.push('Your turn for D' + b + ': ' + short(vb.turn, 90)); if (va.format !== vb.format) ch.unshift('D' + a + ' is a ' + (va.format === 'deck' ? 'deck' : 'document') + ', D' + b + ' a ' + (vb.format === 'deck' ? 'deck' : 'document'));
|
|
271
|
-
ch.push('Same data in both: this cycle\'s draft');
|
|
272
|
-
const head = (n, v) => el('div', { class: 'chips2 rd-cmph' }, el('b', null, 'D' + n), el('span', { class: 'dim' }, vlabel(v)));
|
|
273
|
-
let cols; let tail = null;
|
|
274
|
-
if (RB.format === 'doc' || RA.format === 'doc') {
|
|
275
|
-
const docOf = (R) => (R.format === 'doc' ? el('div', { class: 'rd-docf sm' }, frame(R.style, R.body, { title: 'Version', cls: 'pmos-doc', onLoad: (doc, fr) => fr.style.setProperty('--rp-h', Math.max(200, doc.documentElement.scrollHeight) + 'px') })) : slideCard(R, R.slides[0] || { id: 'x', n: 1, title: '', html: '' }));
|
|
276
|
-
cols = [el('div', { class: 'rd-cmpc' }, head(a, va), docOf(RA)), el('div', { class: 'rd-cmpc' }, head(b, vb), docOf(RB))];
|
|
277
|
-
} else {
|
|
278
|
-
if (!RB.slides[K.sidx]) K.sidx = 0; const B = RB.slides[K.sidx]; const A = RA.slides.find((x) => x.id === B.id);
|
|
279
|
-
cols = [el('div', { class: 'rd-cmpc' }, head(a, va), A ? slideCard(RA, A) : el('div', { class: 'fold rd-none' }, icon('info', 'sm'), ' Not in D' + a + '.')), el('div', { class: 'rd-cmpc' }, head(b, vb), slideCard(RB, B))];
|
|
280
|
-
tail = thumbStrip(RB, K.sidx, (i) => { K.sidx = i; paint(); });
|
|
281
|
-
seg.append(el('span', { class: 'dim rd-small' }, 'Slide: ' + B.title + '. Pick another slide below.'));
|
|
282
|
-
}
|
|
283
|
-
return el('div', { class: 'rd-stack', 'data-rd-compare': '' }, seg, el('div', { class: 'rd-cmpg' }, ...cols),
|
|
284
|
-
sect({ ic: 'cols', title: 'What changed from D' + a + ' to D' + b, count: ch.length, attrs: { 'data-rd-changed': '' } }, el('ul', { class: 'chgl' }, ch.map((t) => el('li', null, icon('edit', 'sm'), el('span', null, t), el('span'))))), tail);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/* ── the bar ── */
|
|
288
|
-
async function setFmt(f) {
|
|
289
|
-
if (K.fmt === f) return; K.fmt = f;
|
|
290
|
-
if (S.D.description && S.D.format !== f) { const r = await RD.describe({ ws, id, text: S.D.description, format: f }); if (!r || !r.ok) { failed(r, 'The format was not changed'); return; } await load(true); toast('The next version is ' + (f === 'deck' ? 'a slide deck' : 'a document') + '. Make it from the conversation.'); return; }
|
|
291
|
-
paint();
|
|
292
|
-
}
|
|
293
|
-
async function accept() {
|
|
294
|
-
const n = K.view != null ? K.view : S.D.current; if (n == null) { toast('Make a version first.'); return; }
|
|
295
|
-
const r = await RD.accept({ ws, id, n }); if (!r || !r.ok) { failed(r, 'The design was not saved'); return; }
|
|
296
|
-
const rd = r.redraw; const day = rd && rd.slot ? slotWord(rd.slot) : '';
|
|
297
|
-
const what = rd && rd.started ? ' PMOS is redrawing the ' + day + ' cycle in it now; older cycles keep their look.'
|
|
298
|
-
: rd && rd.reason === 'sent' ? ' The ' + day + ' cycle was already sent, so it keeps its look; the next cycle uses the design.' : ' PMOS draws each new cycle in it.';
|
|
299
|
-
await load(true); toast('Saved D' + n + ' as the design of this report.' + what + ' Nothing is sent.');
|
|
300
|
-
}
|
|
301
|
-
function paint() {
|
|
302
|
-
if (S.closed) return;
|
|
303
|
-
if (!S.D) { put(body, S.err ? el('div', { class: 'fold w', role: 'alert' }, icon('alert', 'sm'), ' ' + S.err) : el('div', { class: 'fold', role: 'status' }, icon('clock', 'sm'), ' Reading the design.')); return; }
|
|
304
|
-
const D = S.D; const nm = (S.setup && S.setup.name) || name || 'Report';
|
|
305
|
-
const sb = body.closest('.sb'); const y = sb ? sb.scrollTop : 0; const log = body.querySelector('.rd-dks-log'); const ly = log ? log.scrollTop : null;
|
|
306
|
-
const focus = document.activeElement && body.contains(document.activeElement) && document.activeElement.matches('[data-rd-in],[data-rd-link]') ? document.activeElement.getAttribute('data-rd-in') != null ? '[data-rd-in]' : '[data-rd-link]' : null;
|
|
307
|
-
S.dks = S.dks || el('div', { class: 'rd-dks' }); S.out = S.out || el('div', { class: 'rd-dks-out', 'data-rd-preview': '' });
|
|
308
|
-
keep(body, el('div', { class: 'rd-dk-bar' }, el('div', { class: 'chips2 rd-wrap' }, el('div', { class: 'seg', role: 'group', 'aria-label': 'Studio step', 'data-rd-steps': '' },
|
|
309
|
-
btn({ 'data-rd-step': 'structure', 'aria-pressed': 'false', onclick: () => openStructure({ ws, id, name: nm }) }, icon('todo', 'sm'), '1 Structure'), btn({ 'data-rd-step': 'design', 'aria-pressed': 'true' }, icon('img', 'sm'), '2 Design')),
|
|
310
|
-
el('div', { class: 'seg', role: 'group', 'aria-label': 'Report type' },
|
|
311
|
-
btn({ 'data-rd-fmt': 'deck', 'aria-pressed': String(K.fmt === 'deck'), onclick: () => setFmt('deck') }, icon('img', 'sm'), 'Deck'), btn({ 'data-rd-fmt': 'doc', 'aria-pressed': String(K.fmt === 'doc'), onclick: () => setFmt('doc') }, icon('doc', 'sm'), 'Document')),
|
|
312
|
-
el('b', null, nm), D.saved ? el('span', { class: 'chip2 ds-good', 'data-rd-saved': String(D.saved.version) }, icon('check', 'sm'), 'Saved design: D' + D.saved.version) : el('span', { class: 'chip2', 'data-rd-saved': '' }, 'Not saved yet')),
|
|
313
|
-
el('div', { class: 'chips2' }, pbtn('primary', 'This is it', 'check', { 'data-rd-act': 'accept', disabled: !D.versions.length, onclick: () => accept() }),
|
|
314
|
-
D.saved ? pbtn('ghost', 'Design brief', 'doc', { 'data-rd-act': 'brief', onclick: () => openBrief({ ws, id, name: nm }) }) : null)),
|
|
315
|
-
el('div', { class: 'fold' }, icon('info', 'sm'), ' No template to fill in. Describe the report, add samples, then refine until it looks right. PMOS keeps what you settle on and drafts every cycle to match it. Nothing is sent.'),
|
|
316
|
-
S.dks);
|
|
317
|
-
keep(S.dks, chat(), S.out); keep(S.out, preview());
|
|
318
|
-
if (sb) sb.scrollTop = y; const l2 = body.querySelector('.rd-dks-log'); if (l2) l2.scrollTop = ly == null ? l2.scrollHeight : ly;
|
|
319
|
-
if (focus) { const n = body.querySelector(focus); if (n) n.focus(); }
|
|
320
|
-
}
|
|
321
|
-
paint(); load(false).then(scrollLog);
|
|
322
|
-
return { close: () => ui.close(), reload: () => load(true) };
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/* ── the saved design: a brief, not a template ── */
|
|
326
|
-
export function openBrief({ ws, id, name } = {}) {
|
|
327
|
-
ensureDeckCss();
|
|
328
|
-
const body = el('div', { class: 'calbody brief rs rd-dk', 'data-rd-brief': id });
|
|
329
|
-
openSheet({ title: 'Report setup: ' + (name || id), icon: 'report', wide: true, cls: 'rd-wide', body });
|
|
330
|
-
put(body, el('div', { class: 'fold', role: 'status' }, icon('clock', 'sm'), ' Reading the design.'));
|
|
331
|
-
(async () => {
|
|
332
|
-
const r = await RD.design(ws, id);
|
|
333
|
-
if (!r || r.ok === false) { put(body, el('div', { class: 'fold w', role: 'alert' }, icon('alert', 'sm'), ' The design could not be read: ' + ((r && r.error) || 'no answer') + '.')); return; }
|
|
334
|
-
const D = r.design; const setup = RS.setups.find((x) => x.id === id) || r.setup || {};
|
|
335
|
-
const nm = setup.name || name || id; const out = formatOf(setup.output);
|
|
336
|
-
const lh = el('div', { class: 'lh' }, el('span', { class: 'ki' }, icon('report')), el('div', { class: 'rs-min0' }, el('b', null, nm),
|
|
337
|
-
el('div', { class: 'dim' }, (setup.label || scheduleLabel(setup.schedule)) + '. Output: ' + (setup.output === 'google-slides' ? 'a slide deck in PMOS. A Google Slides copy is optional.' : out.l + '.'))));
|
|
338
|
-
const SS = await structureSection({ ws, id, name: nm }); // the saved structure (step 1), above the design
|
|
339
|
-
if (!D.saved) {
|
|
340
|
-
put(body, lh, SS, sect({ ic: 'spark', title: 'Design', attrs: { 'data-rd-design': '' } }, el('div', { class: 'fold', 'data-rd-nosaved': '' }, icon('info', 'sm'), ' No saved design yet. Describe the report and refine it in the Design studio, then press This is it.'),
|
|
341
|
-
el('div', { class: 'ds-acts' }, pbtn('primary', 'Design how it looks', 'spark', { 'data-rd-act': 'studio', onclick: () => openStudio({ ws, id, name: nm }) }))));
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
const n = D.saved.version; let R = null; try { R = splitRender(await RD.version(ws, id, n)); } catch { R = null; }
|
|
345
|
-
const rule = (h, xs, attr) => (xs && xs.length ? el('div', { class: 'rd-dks-rule', 'data-rd-rule': attr }, el('b', null, h), el('ul', null, xs.map((x) => el('li', null, x)))) : null);
|
|
346
|
-
const ref = !R ? el('div', { class: 'fold w' }, icon('alert', 'sm'), ' The reference version could not be read.')
|
|
347
|
-
: R.format === 'deck' ? [el('div', { class: 'rd-dks-ref', 'data-rd-ref': String(n) }, R.slides.slice(0, 6).map((s) => el('div', { inert: '' }, slideCard(R, s, { cls: 'rd-thumb' })))), el('div', { class: 'dim rd-small' }, R.slides.length + ' slides with this cycle\'s data.' + (R.slides.length > 6 ? ' Showing the first 6.' : ''))]
|
|
348
|
-
: el('div', { class: 'rd-docf sm', 'data-rd-ref': String(n) }, frame(R.style, R.body, { title: 'The reference version', cls: 'pmos-doc', onLoad: (doc, fr) => fr.style.setProperty('--rp-h', Math.min(520, doc.documentElement.scrollHeight) + 'px') }));
|
|
349
|
-
const rules = D.rules || {};
|
|
350
|
-
const cycHost = el('ul', { class: 'chgl', 'data-rd-briefcycles': '' });
|
|
351
|
-
const docs = (RS.docs || []).filter((d) => d.setup === id).sort((a, b) => String(b.slot).localeCompare(String(a.slot)));
|
|
352
|
-
put(body, lh, SS,
|
|
353
|
-
sect({ ic: 'spark', title: 'Design', right: el('span', { class: 'tag acc' }, 'Design D' + n), attrs: { 'data-rd-design': '' } },
|
|
354
|
-
el('div', { class: 'dim rd-small' }, 'Written by PMOS from your studio session. It is not a template: PMOS reads it each cycle and drafts to match it. Saved ' + dayAt(D.saved.at) + ', version D' + n + '.'),
|
|
355
|
-
el('h3', { class: 'ds-h' }, 'Your description'), el('blockquote', { class: 'rd-dks-q', 'data-rd-desc': '' }, D.description || 'No description.'),
|
|
356
|
-
el('h3', { class: 'ds-h' }, 'Your samples'), (D.samples || []).length ? D.samples.map(sampleChip) : el('div', { class: 'dim rd-small' }, 'No sample.'),
|
|
357
|
-
el('h3', { class: 'ds-h' }, 'Reference version · D' + n), ref,
|
|
358
|
-
el('h3', { class: 'ds-h' }, 'What PMOS learned'), rule('Keeps the same each cycle', rules.same, 'same'), rule('Changes each cycle', rules.changes, 'changes'), rule('Learned from your turns', rules.learned, 'learned'),
|
|
359
|
-
el('div', { class: 'ds-acts' }, pbtn('primary', 'Refine the design', 'spark', { 'data-rd-act': 'studio', onclick: () => openStudio({ ws, id, name: nm }) }), pbtn('outline', 'See the reference version', 'eye', { 'data-rd-act': 'refver', onclick: () => openStudio({ ws, id, name: nm, view: n }) }))),
|
|
360
|
-
sect({ ic: 'cal', title: 'Cycles drafted to match it', count: docs.length }, docs.length ? cycHost : el('div', { class: 'fold' }, icon('info', 'sm'), ' No cycle yet. The next one is drafted to match D' + n + '.')),
|
|
361
|
-
el('div', { class: 'fold' }, icon('shield', 'sm'), ' PMOS drafts each cycle. Nothing is sent: you present the deck or share the PDF yourself.'));
|
|
362
|
-
for (const d of docs) {
|
|
363
|
-
const c = await RD.cycle(ws, d.path);
|
|
364
|
-
const word = !c || c.ok === false || !c.designed ? el('span', { class: 'chip2' }, 'Before the design') : c.matches ? el('span', { class: 'chip2 ds-good' }, icon('check', 'sm'), 'Matches the design') : el('span', { class: 'chip2 ds-warn' }, icon('alert', 'sm'), (c.differences || []).length + ' difference' + ((c.differences || []).length === 1 ? '' : 's') + ' from the design');
|
|
365
|
-
cycHost.append(el('li', { 'data-rd-briefcycle': d.path }, icon('doc', 'sm'), el('span', null, slotWord(d.slot) + ' ', el('span', { class: 'dim rd-small' }, d.state === 'issued' ? 'Issued' : 'Draft')),
|
|
366
|
-
el('span', { class: 'chips2' }, word, pbtn('ghost', 'Open', 'out', { onclick: () => { closeSheet(); if (typeof RS.openDoc === 'function') RS.openDoc(d); } }))));
|
|
367
|
-
}
|
|
368
|
-
})();
|
|
369
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/* pm/c3-doc-formats.js — a report document drawn in its OUTPUT FORMAT (initiative report-workspace, PRD section 5; mockup 41-reportsetup.js formatView).
|
|
2
|
-
* The document is one markdown file. Read mode of the document sheet (c3-doc-sheet.js) calls formatView() to show the same text as
|
|
3
|
-
* google-slides 16:9 cards, one per section (the title card first; a section of **numbers** draws them large)
|
|
4
|
-
* google-sheets a grid: columns A, B, C, rows 1, 2, 3; a markdown table is the grid, any other section is one cell per line
|
|
5
|
-
* google-doc a page; confluence: the same page
|
|
6
|
-
* pdf A4 pages, sections filled in order
|
|
7
|
-
* It only draws. The text is never changed here; Edit stays markdown. Each section keeps the document sheet's own wrapper (who wrote it,
|
|
8
|
-
* pinned proposals), so the caller passes `wrap(section, inner, label)`.
|
|
9
|
-
* Pure parts (Node-testable): FORMATS, formatOf, tableRows, bigRows, kindOf, partsOf, pagesOf, outlineLabels, printHtml, downloadsOf, copyKindFor. */
|
|
10
|
-
import { el } from './dom.js';
|
|
11
|
-
|
|
12
|
-
/** Link c3-report-setup.css once, from this module's own folder (the way c3-scan.js links its stylesheet). */
|
|
13
|
-
export function ensureReportCss() {
|
|
14
|
-
if (typeof document === 'undefined' || document.querySelector('link[data-c3-report-setup]')) return;
|
|
15
|
-
const l = document.createElement('link');
|
|
16
|
-
l.rel = 'stylesheet'; l.href = new URL('./c3-report-setup.css', import.meta.url).href; l.setAttribute('data-c3-report-setup', '');
|
|
17
|
-
document.head.appendChild(l);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** The five outputs of a recurring report. l: the name the page shows; ic: its icon; app: the tool a copy lives in; dl: the Download menu, [label, fmt].
|
|
21
|
-
* The stored value 'google-slides' is kept for compatibility; the page names it "Slide deck": the deck lives in PMOS, a Google Slides copy is optional (report-design-studio). */
|
|
22
|
-
export const FORMATS = {
|
|
23
|
-
'google-slides': { l: 'Slide deck', ic: 'img', app: 'Google Slides', copy: 'google-slides', word: 'slides', dl: [['PDF', 'pdf'], ['PowerPoint .pptx', 'pptx']] },
|
|
24
|
-
'google-doc': { l: 'Google Doc', ic: 'doc', app: 'Google Doc', copy: 'google', word: 'headings', dl: [['PDF', 'pdf'], ['Word .docx', 'docx']] },
|
|
25
|
-
'google-sheets': { l: 'Google Sheets', ic: 'sheet', app: 'Google Sheets', copy: 'google-sheets', word: 'sheets', dl: [['Excel .xlsx', 'xlsx'], ['CSV', 'csv']] },
|
|
26
|
-
confluence: { l: 'Confluence', ic: 'notes', app: 'Confluence', copy: 'confluence', word: 'headings', dl: [['PDF', 'pdf'], ['Word .docx', 'docx']] },
|
|
27
|
-
pdf: { l: 'PDF', ic: 'pdf', app: '', copy: '', word: 'sections', dl: [['PDF', 'pdf']] },
|
|
28
|
-
};
|
|
29
|
-
export const OUTPUTS = ['google-slides', 'google-doc', 'google-sheets', 'confluence', 'pdf'];
|
|
30
|
-
export const formatOf = (o) => FORMATS[o] || FORMATS['google-doc'];
|
|
31
|
-
/** The copy kind (lib/doc-sync.js) an output keeps its live copy in; '' for a PDF. */
|
|
32
|
-
export const copyKindFor = (output) => formatOf(output).copy;
|
|
33
|
-
/** The Download items of an output: [{ label, fmt }]. */
|
|
34
|
-
export const downloadsOf = (output) => formatOf(output).dl.map(([label, fmt]) => ({ label, fmt }));
|
|
35
|
-
|
|
36
|
-
const esc = (s) => String(s == null ? '' : s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
37
|
-
const lines = (t) => String(t || '').split('\n').map((l) => l.trim()).filter(Boolean);
|
|
38
|
-
const plainInline = (s) => String(s).replace(/\*\*(.+?)\*\*/g, '$1').replace(/`([^`]+)`/g, '$1').replace(/\[([^\]]+)\]\([^)]*\)/g, '$1').replace(/^[-*]\s+/, '');
|
|
39
|
-
|
|
40
|
-
/** The rows of a markdown table in `text`: [[cell, ...], ...] without the separator row; null when the text has no table. */
|
|
41
|
-
export function tableRows(text) {
|
|
42
|
-
const L = lines(text).filter((l) => l.startsWith('|'));
|
|
43
|
-
if (L.length < 2) return null;
|
|
44
|
-
const rows = L.filter((l) => !/^\|[\s:|-]+\|?$/.test(l)).map((l) => l.replace(/^\|/, '').replace(/\|$/, '').split('|').map((c) => plainInline(c.trim())));
|
|
45
|
-
return rows.length ? rows : null;
|
|
46
|
-
}
|
|
47
|
-
/** Numbers set large on a slide: every line is a bullet that starts with a bold number, "- **97.4%** Login success". [[number, what]] or null. */
|
|
48
|
-
export function bigRows(text) {
|
|
49
|
-
const L = lines(text); if (!L.length) return null;
|
|
50
|
-
const out = [];
|
|
51
|
-
for (const l of L) { const m = /^[-*]\s+\*\*([-+]?[\d][\d.,]*\s?(?:%|pts)?)\*\*\s*(.*)$/.exec(l); if (!m) return null; out.push([m[1], plainInline(m[2])]); }
|
|
52
|
-
return out;
|
|
53
|
-
}
|
|
54
|
-
/** What a section is: 'title' (the H1), 'grid' (a table), 'big' (numbers) or 'text'. */
|
|
55
|
-
export function kindOf(s) {
|
|
56
|
-
if (/^#\s/.test(s.prefix || '')) return 'title';
|
|
57
|
-
if (tableRows(s.text)) return 'grid';
|
|
58
|
-
if (bigRows(s.text)) return 'big';
|
|
59
|
-
return 'text';
|
|
60
|
-
}
|
|
61
|
-
/** The sections a format draws: every named section but the front matter, with its kind. The H1 is the title card; a document with no H1 gets none. */
|
|
62
|
-
export function partsOf(secs) {
|
|
63
|
-
return secs.filter((s) => s.prefix).map((s) => ({ s, kind: kindOf(s) }));
|
|
64
|
-
}
|
|
65
|
-
/** The outline of a report: the title card counts as a slide or a sheet. [{ s, lv: 1, label }]. */
|
|
66
|
-
export function outlineLabels(secs, output) {
|
|
67
|
-
const w = formatOf(output).word; const P = partsOf(secs);
|
|
68
|
-
return P.map((p, i) => ({ s: p.s, lv: 1, label: (w === 'slides' ? (i + 1) + '. ' : w === 'sheets' ? 'Sheet ' + (i + 1) + ': ' : '') + (p.kind === 'title' ? 'Title' : p.s.name) }));
|
|
69
|
-
}
|
|
70
|
-
/** A4 pages: the sections in order, a page holding about 26 lines. [[part, ...], ...]. */
|
|
71
|
-
export function pagesOf(parts, limit = 26) {
|
|
72
|
-
const pages = []; let cur = []; let n = 0;
|
|
73
|
-
for (const p of parts) {
|
|
74
|
-
const w = 3 + lines(p.s.text).length;
|
|
75
|
-
if (cur.length && n + w > limit) { pages.push(cur); cur = []; n = 0; }
|
|
76
|
-
cur.push(p); n += w;
|
|
77
|
-
}
|
|
78
|
-
if (cur.length) pages.push(cur);
|
|
79
|
-
return pages.length ? pages : [[]];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/* ── the drawn views ── */
|
|
83
|
-
const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
84
|
-
function gridNode(s) {
|
|
85
|
-
let rows = tableRows(s.text);
|
|
86
|
-
if (!rows) rows = lines(s.text).map((l) => [plainInline(l)]);
|
|
87
|
-
const width = Math.max(1, ...rows.map((r) => r.length));
|
|
88
|
-
const cls = (c, i) => (/^[-+]?[\d.,]+(%| pts)?$|^[-+]\d/.test(c) ? 'n' : '') + (/^\+\d/.test(c) && i ? ' pos' : /^-\d|^−\d/.test(c) && i ? ' neg' : '');
|
|
89
|
-
return el('div', { class: 'rs-gridwrap' }, el('table', { class: 'rs-grid' },
|
|
90
|
-
el('thead', null, el('tr', null, el('th'), ...Array.from({ length: width }, (_, i) => el('th', null, letters[i] || '')))),
|
|
91
|
-
el('tbody', null, rows.map((r, i) => el('tr', { class: i === 0 && tableRows(s.text) ? 'hd' : '' }, el('th', null, String(i + 1)), ...Array.from({ length: width }, (_, j) => el('td', { class: cls(r[j] || '', i) }, r[j] || '')))))));
|
|
92
|
-
}
|
|
93
|
-
const bigNode = (rows) => el('div', { class: 'rs-big' }, rows.map(([n, t]) => el('div', null, el('b', null, n), el('span', null, t))));
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* The format view. o = { output, name, cycle, secs (splitDoc of the text), md(text) -> Node, wrap(section, inner, label) -> Node, foot }.
|
|
97
|
-
* Returns the Node to put where Read draws the sections.
|
|
98
|
-
*/
|
|
99
|
-
export function formatView(o) {
|
|
100
|
-
ensureReportCss();
|
|
101
|
-
const f = o.output; const P = partsOf(o.secs); const n = P.length;
|
|
102
|
-
const body = (p, mode) => {
|
|
103
|
-
if (p.kind === 'grid') return mode === 'sheets' ? gridNode(p.s) : o.md(p.s.text);
|
|
104
|
-
if (p.kind === 'big' && mode === 'slides') return bigNode(bigRows(p.s.text));
|
|
105
|
-
if (mode === 'sheets' && p.kind !== 'title') return gridNode(p.s);
|
|
106
|
-
return p.s.text.trim() ? o.md(p.s.text) : el('p', { class: 'dim' }, p.kind === 'title' ? '' : 'This section is empty.');
|
|
107
|
-
};
|
|
108
|
-
if (f === 'google-slides') {
|
|
109
|
-
return el('div', { class: 'rs-slides', 'data-rs-format': 'slides' }, P.map((p, i) => o.wrap(p.s, el('div', { class: 'rs-slide' + (p.kind === 'title' ? ' title' : ''), role: 'group', 'aria-label': 'Slide ' + (i + 1), 'data-rs-slide': String(i + 1) },
|
|
110
|
-
el('div', { class: 'rs-sh' }, p.kind === 'title' ? o.name : p.s.name), el('div', { class: 'rs-sb' }, body(p, 'slides')),
|
|
111
|
-
el('div', { class: 'rs-sf' }, el('span', null, o.foot || ''), el('span', null, (i + 1) + ' of ' + n))), 'Slide ' + (i + 1))));
|
|
112
|
-
}
|
|
113
|
-
if (f === 'google-sheets') {
|
|
114
|
-
return el('div', { class: 'rs-sheets', 'data-rs-format': 'sheets' }, P.map((p, i) => o.wrap(p.s, body(p, 'sheets'), 'Sheet ' + (i + 1) + ': ' + (p.kind === 'title' ? 'Title' : p.s.name))));
|
|
115
|
-
}
|
|
116
|
-
if (f === 'pdf') {
|
|
117
|
-
const pages = pagesOf(P);
|
|
118
|
-
return el('div', { class: 'rs-pages', 'data-rs-format': 'pdf' }, pages.map((pg, k) => el('article', { class: 'rs-page a4', 'aria-label': 'Page ' + (k + 1), 'data-rs-page': String(k + 1) },
|
|
119
|
-
k === 0 ? [el('h3', null, o.name), o.cycle ? el('p', { class: 'm' }, o.cycle) : null] : null,
|
|
120
|
-
pg.filter((p) => p.kind !== 'title').map((p) => o.wrap(p.s, body(p, 'pdf'))), el('div', { class: 'rs-pn' }, 'Page ' + (k + 1) + ' of ' + pages.length))));
|
|
121
|
-
}
|
|
122
|
-
return el('article', { class: 'rs-page doc', 'data-rs-format': f === 'confluence' ? 'confluence' : 'doc' }, el('h3', null, o.name + (o.cycle ? ' · ' + o.cycle : '')),
|
|
123
|
-
P.filter((p) => p.kind !== 'title').map((p) => o.wrap(p.s, body(p, 'doc'))));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/* ── the printable view: Download > PDF opens it in a window and the browser prints it ── */
|
|
127
|
-
const inlineHtml = (t) => esc(t).replace(/\*\*(.+?)\*\*/g, '<b>$1</b>').replace(/`([^`]+)`/g, '<code>$1</code>');
|
|
128
|
-
function blockHtml(text) {
|
|
129
|
-
const rows = tableRows(text);
|
|
130
|
-
if (rows) return '<table>' + rows.map((r, i) => '<tr>' + r.map((c) => (i === 0 ? '<th>' : '<td>') + esc(c) + (i === 0 ? '</th>' : '</td>')).join('') + '</tr>').join('') + '</table>';
|
|
131
|
-
const out = []; let ul = [];
|
|
132
|
-
const flush = () => { if (ul.length) { out.push('<ul>' + ul.join('') + '</ul>'); ul = []; } };
|
|
133
|
-
for (const l of lines(text)) { if (/^[-*]\s+/.test(l)) ul.push('<li>' + inlineHtml(l.replace(/^[-*]\s+/, '')) + '</li>'); else { flush(); out.push('<p>' + inlineHtml(l.replace(/^#+\s+/, '')) + '</p>'); } }
|
|
134
|
-
flush(); return out.join('');
|
|
135
|
-
}
|
|
136
|
-
/* the print styles live in c3-report-print.css, on the tokens; the window links both, absolute, since it has no base URL */
|
|
137
|
-
const sheet = (f) => '<link rel="stylesheet" href="' + esc(new URL('./' + f, import.meta.url).href) + '">';
|
|
138
|
-
/** The whole printable page as a string: slides are landscape 16:9 cards, everything else is A4. o = { output, name, cycle, secs }. */
|
|
139
|
-
export function printHtml(o) {
|
|
140
|
-
const P = partsOf(o.secs); const slides = o.output === 'google-slides';
|
|
141
|
-
let body;
|
|
142
|
-
if (slides) body = P.map((p) => '<section class="rp-slide' + (p.kind === 'title' ? ' rp-slide--title' : '') + '"><h2>' + esc(p.kind === 'title' ? o.name : p.s.name) + '</h2>' + blockHtml(p.s.text) + '</section>').join('');
|
|
143
|
-
else body = '<h1>' + esc(o.name) + '</h1>' + (o.cycle ? '<p class="rp-print-m">' + esc(o.cycle) + '</p>' : '') + P.filter((p) => p.kind !== 'title').map((p) => '<h2>' + esc(p.s.name) + '</h2>' + blockHtml(p.s.text)).join('');
|
|
144
|
-
return '<!doctype html><html lang="en"><head><meta charset="utf-8"><title>' + esc(o.name + (o.cycle ? ' ' + o.cycle : '')) + '</title>' + sheet('tokens.css') + sheet('c3-report-print.css') + '</head><body class="rp-print' + (slides ? ' rp-print-slides' : '') + '">' + body + '</body></html>';
|
|
145
|
-
}
|
|
146
|
-
/** Open the printable view in a window and print it. Returns false when the browser blocked the window. */
|
|
147
|
-
export function printPdf(o) {
|
|
148
|
-
const w = typeof window !== 'undefined' && window.open ? window.open('', '_blank') : null;
|
|
149
|
-
if (!w) return false;
|
|
150
|
-
w.document.open(); w.document.write(printHtml(o)); w.document.close();
|
|
151
|
-
w.focus(); setTimeout(() => { try { w.print(); } catch { /* the PM can print from the window */ } }, 250);
|
|
152
|
-
return true;
|
|
153
|
-
}
|