cornfield 0.52.0 → 0.53.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/core/strings.js +2 -0
- package/explorer/css/node-panel.css +3 -1
- package/explorer/decision-model.js +2 -0
- package/explorer/engine/map-rect.js +8 -6
- package/explorer/engine/map-style.js +12 -6
- package/explorer/engine/player.js +17 -11
- package/explorer/engine/sheets.js +8 -0
- package/explorer/glyphs.js +14 -6
- package/explorer/instance.js +9 -1
- package/explorer/pieces/around.js +33 -4
- package/explorer/pieces/changes.js +32 -26
- package/explorer/pieces/decision.js +15 -8
- package/explorer/pieces/layers.js +4 -3
- package/explorer/pieces/map.js +6 -1
- package/explorer/pieces/proposal.js +41 -14
- package/explorer/pieces/scope-link.js +2 -2
- package/explorer/pieces/scope-proposal.js +158 -0
- package/explorer/pieces/scope.js +64 -1
- package/explorer/renderer-canvas2d.js +46 -12
- package/explorer/renderer-webgl.js +3 -1
- package/explorer/shaders.js +17 -6
- package/package.json +1 -1
package/core/strings.js
CHANGED
|
@@ -123,6 +123,8 @@ export const STRINGS = Object.freeze({
|
|
|
123
123
|
needsScope: 'This needs a corn-scope around it, with a corn-map in it',
|
|
124
124
|
needsMap: 'This needs a corn-map in the same corn-scope',
|
|
125
125
|
waitingForMap: 'Waiting for the map',
|
|
126
|
+
// The review's sections as tags (corn-proposal, corn-changes, corn-decision): a scope holds one of each
|
|
127
|
+
secondSection: 'This scope already has one of these',
|
|
126
128
|
});
|
|
127
129
|
|
|
128
130
|
/** The longest a value may be, in characters */
|
|
@@ -185,4 +185,6 @@
|
|
|
185
185
|
/* The title of a panel: the Work panel, the node panel, the proposal bar, a detail in the Work panel and a dialog are one style. A node's name is long and
|
|
186
186
|
often a path, so it wraps (overflow-wrap) in this size rather than being set larger than the panel's own words. */
|
|
187
187
|
.hx-drawer-title { font-size: var(--corn-text-lg); font-weight: 700; line-height: 1.25; letter-spacing: normal; }
|
|
188
|
-
|
|
188
|
+
/* The head never shrinks: the body is a flex column that scrolls, and a short box (a panel in a host's 200px place, a short window) would squash the head to its
|
|
189
|
+
min-height, laying a title that wraps, or a kicker that does ("Added by" a proposal), over the line under it */
|
|
190
|
+
.hx-drawer-head { min-height: var(--corn-panel-head-height); flex-shrink: 0; }
|
|
@@ -136,6 +136,8 @@ export const newReasons = (reasons, answered) => reasons.filter((r) => !answered
|
|
|
136
136
|
* cornfield server to send a review to (pieces/review.js with no `base`). Cornfield's own page always names its proposal, so it never says this.
|
|
137
137
|
*/
|
|
138
138
|
export const NOTHING_TO_DECIDE = 'Shown to read only: there is no cornfield server here to send an approval or a send back to.';
|
|
139
|
+
/** What the foot says for a proposal with no name in a scope that has a server (`<corn-decision>`): it is shown, but nothing can be decided on it */
|
|
140
|
+
export const NAMELESS_PROPOSAL = 'Shown to read only: this proposal has no name, so there is nothing to send an approval or a send back about.';
|
|
139
141
|
|
|
140
142
|
/**
|
|
141
143
|
* The line above Approve and what a press of it does, from the facts and the page's own state.
|
|
@@ -81,17 +81,19 @@ export function visibleMapRect(inst) {
|
|
|
81
81
|
if (isPhone(inst)) covers.bottom = measureCovered(inst) + 8;
|
|
82
82
|
else if (canvas && typeof canvas.getBoundingClientRect === 'function') {
|
|
83
83
|
const c = canvas.getBoundingClientRect();
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// What lies over the map in this instance's own layout (cornfield's page, a review) answers for itself: the proposal bar, the review column and the scenario
|
|
85
|
+
// player each say where their edge is, the node panel its width. In a scope the pieces sit beside the map, not over it, and none answers
|
|
86
|
+
const bar = inst.ask('proposal:covers');
|
|
87
|
+
if (bar) covers.top = Math.max(0, bar.bottom - c.top) + 8;
|
|
86
88
|
const panel = inst.ask('panel:covers'); // the node panel, when it slides over the map: its width, not its box (it slides in)
|
|
87
89
|
if (panel && panel.right) covers.right = panel.right;
|
|
88
90
|
const forge = inst.el('forge-panel');
|
|
89
91
|
if (shown(forge) && forge.classList.contains('forge-open')) covers.left = forge.offsetWidth;
|
|
90
92
|
// the review column (review-column.js) is docked on the left under the bar: its right edge is what it covers, past the Work panel's when both are open
|
|
91
|
-
const column = inst.
|
|
92
|
-
if (
|
|
93
|
-
const player = inst.
|
|
94
|
-
if (
|
|
93
|
+
const column = inst.ask('changes:covers');
|
|
94
|
+
if (column) covers.left = Math.max(covers.left, Math.max(0, column.right - c.left) + 8);
|
|
95
|
+
const player = inst.ask('player:covers');
|
|
96
|
+
if (player) covers.bottom = Math.max(0, c.bottom - player.top) + 8;
|
|
95
97
|
}
|
|
96
98
|
return freeRect(state.width || 0, state.height || 0, covers);
|
|
97
99
|
}
|
|
@@ -65,6 +65,8 @@ export const GREY_ALPHA_TOKEN = '--corn-map-grey-alpha';
|
|
|
65
65
|
export const MIN_GREY_ALPHA = 0.1;
|
|
66
66
|
/** The ink of a node's glyph and of a finer kind's letters (spec 0008 D8); `auto` is the white or the dark that reads on the node's fill (glyphs.js) */
|
|
67
67
|
export const GLYPH_TOKEN = '--corn-map-glyph';
|
|
68
|
+
/** The page's ground under the map (tokens.css; a theme sets its own): what a translucent node's fill is seen over, so what its glyph's ink is chosen against (glyphs.js) */
|
|
69
|
+
export const GROUND_TOKEN = '--corn-ground';
|
|
68
70
|
/** The largest label minimum a theme may ask for: bigger text would leave no room for another label */
|
|
69
71
|
export const MAX_LABEL_MIN = 24;
|
|
70
72
|
/** The width an ordinary line has with no theme (scene.js `flowEdge`): the `--corn-map-edge-width` scales every line by its ratio to this */
|
|
@@ -179,8 +181,9 @@ function greyAlphaOf(value) {
|
|
|
179
181
|
* The tokens as the page computes them.
|
|
180
182
|
* @param {(name: string) => string} read the value of a custom property
|
|
181
183
|
* @param {string[]} [extra] more colour tokens to read: those of the finer kinds and project layers on the map (`setMapSubjects`)
|
|
182
|
-
* @returns {{values: Record<string, string>, strokeWidth: number, font: string | null, edgeWidth: number | null, glow: number | null, labelMin: number | null, greyAlpha: number | null}}
|
|
183
|
-
* `values` holds only the tokens that are a colour (not `auto`); `font`, `edgeWidth`, `glow`, `labelMin` and `greyAlpha` are null at `auto` or when the value is not one
|
|
184
|
+
* @returns {{values: Record<string, string>, strokeWidth: number, font: string | null, edgeWidth: number | null, glow: number | null, labelMin: number | null, greyAlpha: number | null, ground: string | null}}
|
|
185
|
+
* `values` holds only the tokens that are a colour (not `auto`); `font`, `edgeWidth`, `glow`, `labelMin` and `greyAlpha` are null at `auto` or when the value is not one;
|
|
186
|
+
* `ground` is the page's ground (`--corn-ground`) as a colour, or null when it is not one
|
|
184
187
|
*/
|
|
185
188
|
export function readMapTokens(read, extra = []) {
|
|
186
189
|
const values = {};
|
|
@@ -197,6 +200,7 @@ export function readMapTokens(read, extra = []) {
|
|
|
197
200
|
glow: factorOf(read(GLOW_TOKEN)),
|
|
198
201
|
labelMin: labelMinOf(read(LABEL_MIN_TOKEN)),
|
|
199
202
|
greyAlpha: greyAlphaOf(read(GREY_ALPHA_TOKEN)),
|
|
203
|
+
ground: cssColor(read(GROUND_TOKEN)),
|
|
200
204
|
};
|
|
201
205
|
}
|
|
202
206
|
|
|
@@ -261,14 +265,16 @@ export function createIconStore(urls, { load = loadImage, onChange = () => {}, w
|
|
|
261
265
|
* @property {number | null} glow the glow factor (`--corn-map-glow`), null at `auto`
|
|
262
266
|
* @property {number | null} labelMin the smallest label size in px (`--corn-map-label-min`), null at `auto` or under 9px
|
|
263
267
|
* @property {number | null} greyAlpha how much of a greyed node is left (`--corn-map-grey-alpha`), null at `auto` or when it is not a number from 0.1 to 1
|
|
268
|
+
* @property {string | null} ground the page's ground (`--corn-ground`), null when it is not a colour: a translucent node is seen over it (glyphs.js). It sets nothing
|
|
269
|
+
* in the picture, so it does not make a style less plain
|
|
264
270
|
* @property {ReturnType<typeof createIconStore> | null} icons
|
|
265
271
|
* @property {boolean} pixelated sample icons without smoothing
|
|
266
272
|
* @property {boolean} plain nothing to apply: no colour set, no icon loaded (the scene is drawn as it is)
|
|
267
273
|
*/
|
|
268
274
|
|
|
269
|
-
const NO_TOKENS = { values: {}, strokeWidth: DEFAULT_STROKE_WIDTH, font: null, edgeWidth: null, glow: null, labelMin: null, greyAlpha: null };
|
|
275
|
+
const NO_TOKENS = { values: {}, strokeWidth: DEFAULT_STROKE_WIDTH, font: null, edgeWidth: null, glow: null, labelMin: null, greyAlpha: null, ground: null };
|
|
270
276
|
/** The style with nothing set: what a renderer or a label layer made without an instance draws with (the scene as it is) */
|
|
271
|
-
export const PLAIN_STYLE = Object.freeze({ version: 0, values: Object.freeze({}), strokeWidth: DEFAULT_STROKE_WIDTH, font: null, edgeWidth: null, glow: null, labelMin: null, greyAlpha: null, icons: null, pixelated: false, plain: true });
|
|
277
|
+
export const PLAIN_STYLE = Object.freeze({ version: 0, values: Object.freeze({}), strokeWidth: DEFAULT_STROKE_WIDTH, font: null, edgeWidth: null, glow: null, labelMin: null, greyAlpha: null, ground: null, icons: null, pixelated: false, plain: true });
|
|
272
278
|
const MAX_SUBJECT_TOKENS = 500;
|
|
273
279
|
|
|
274
280
|
/**
|
|
@@ -287,7 +293,7 @@ export function createMapStyle(inst) {
|
|
|
287
293
|
|
|
288
294
|
const compose = () => {
|
|
289
295
|
const plain = !Object.keys(tokens.values).length && !(icons && icons.anyReady()) && tokens.font === null && tokens.edgeWidth === null && tokens.glow === null && tokens.labelMin === null && tokens.greyAlpha === null;
|
|
290
|
-
return Object.freeze({ version, values: tokens.values, strokeWidth: tokens.strokeWidth, font: tokens.font, edgeWidth: tokens.edgeWidth, glow: tokens.glow, labelMin: tokens.labelMin, greyAlpha: tokens.greyAlpha, icons, pixelated, plain });
|
|
296
|
+
return Object.freeze({ version, values: tokens.values, strokeWidth: tokens.strokeWidth, font: tokens.font, edgeWidth: tokens.edgeWidth, glow: tokens.glow, labelMin: tokens.labelMin, greyAlpha: tokens.greyAlpha, ground: tokens.ground, icons, pixelated, plain });
|
|
291
297
|
};
|
|
292
298
|
let current = compose();
|
|
293
299
|
|
|
@@ -330,7 +336,7 @@ export function createMapStyle(inst) {
|
|
|
330
336
|
refresh(read = inst.tokenReader()) {
|
|
331
337
|
if (!read) return false;
|
|
332
338
|
const next = readMapTokens(read, subjectTokens);
|
|
333
|
-
const same = next.strokeWidth === tokens.strokeWidth && next.font === tokens.font && next.edgeWidth === tokens.edgeWidth && next.glow === tokens.glow && next.labelMin === tokens.labelMin
|
|
339
|
+
const same = next.strokeWidth === tokens.strokeWidth && next.font === tokens.font && next.edgeWidth === tokens.edgeWidth && next.glow === tokens.glow && next.labelMin === tokens.labelMin && next.ground === tokens.ground
|
|
334
340
|
&& Object.keys(next.values).length === Object.keys(tokens.values).length
|
|
335
341
|
&& Object.entries(next.values).every(([k, v]) => tokens.values[k] === v);
|
|
336
342
|
if (same) return false;
|
|
@@ -97,8 +97,11 @@ export function demoScenario(nodes, edges) {
|
|
|
97
97
|
* @param {ReturnType<import('../instance.js').createInstance>} inst
|
|
98
98
|
* @param {ReturnType<typeof import('./piece.js').scopeOf>} scope the piece's own end: every listener, observer and the frame client go with it
|
|
99
99
|
* @param {ReturnType<typeof import('./checks.js').createChecks>} checks
|
|
100
|
+
* @param {{ seat?: Element, hear?: EventTarget }} [where] where the piece that owns the player has put it, when that is not the page's or the review's layout (`<corn-changes>`):
|
|
101
|
+
* `seat` is the element the bar goes in (it is a part of that piece, not a sheet or a bar over the map), `hear` the root whose keys are the player's (Space, the arrows, Escape).
|
|
102
|
+
* Without it the bar lies over the map's bottom, or is a sheet in the dock (the dock's owner seats it: `player:seat`), and the instance's root hears
|
|
100
103
|
*/
|
|
101
|
-
export function createScenarioPlayer(inst, scope, checks) {
|
|
104
|
+
export function createScenarioPlayer(inst, scope, checks, where = {}) {
|
|
102
105
|
const { state } = inst;
|
|
103
106
|
let player = null;
|
|
104
107
|
let bar = null;
|
|
@@ -121,7 +124,8 @@ export function createScenarioPlayer(inst, scope, checks) {
|
|
|
121
124
|
let barOffs = [];
|
|
122
125
|
const notify = (snap) => { for (const fn of [...listeners]) fn(snap); inst.emit('scenario:player', snap); };
|
|
123
126
|
|
|
124
|
-
const stage = () => (state.canvas ? state.canvas.parentElement : null);
|
|
127
|
+
const stage = () => (where.seat || (state.canvas ? state.canvas.parentElement : null));
|
|
128
|
+
const hear = where.hear || inst.root;
|
|
125
129
|
const render = () => inst.map.render();
|
|
126
130
|
|
|
127
131
|
// ---------------------------------------------------------------------------
|
|
@@ -353,12 +357,13 @@ export function createScenarioPlayer(inst, scope, checks) {
|
|
|
353
357
|
menu.addEventListener('change', onSpeed);
|
|
354
358
|
barOffs.push(() => { here.removeEventListener('click', onBarClick); menu.removeEventListener('change', onSpeed); });
|
|
355
359
|
// On a phone the bar is a sheet in the dock, above the node panel; it opens as a peek (one row) and the others fold, so the map shows
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
if (where.seat) area.appendChild(bar); // a part of the piece's own box: no sheet, nothing over the map
|
|
361
|
+
else {
|
|
362
|
+
// On a phone the bar is a sheet in the dock, above the node panel; the dock's owner seats it (engine/sheets.js), else it lies over the map's bottom
|
|
363
|
+
if (inst.ask('player:seat', bar) !== true) area.appendChild(bar);
|
|
364
|
+
registerSheet(inst, 'player', bar);
|
|
365
|
+
collapseAllSheets(inst);
|
|
366
|
+
}
|
|
362
367
|
// The bar grows once it has more to say (a step's check, its As row): the step it framed would now be under it, so it is followed again
|
|
363
368
|
const RO = inst.win && inst.win.ResizeObserver;
|
|
364
369
|
if (typeof RO === 'function') {
|
|
@@ -439,10 +444,11 @@ export function createScenarioPlayer(inst, scope, checks) {
|
|
|
439
444
|
// ---------------------------------------------------------------------------
|
|
440
445
|
/** A menu or dialog that has its own Escape: the layers menu, the toolbar's ⋯ menu, a dialog */
|
|
441
446
|
function otherPopupOpen() {
|
|
442
|
-
|
|
447
|
+
if (inst.ask('popup:open') === true) return true; // the Layers menu, the bar's ⋯ menu: whoever owns one says so
|
|
448
|
+
return !!inst.root.querySelector('[data-corn="dialog-scrim"]:not([hidden]), .hx-mockup-dialog');
|
|
443
449
|
}
|
|
444
450
|
|
|
445
|
-
scope.listen(
|
|
451
|
+
scope.listen(hear, 'keydown', (e) => {
|
|
446
452
|
if (e.key === 'Escape' && !e.defaultPrevented && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
447
453
|
if (player && !typingIn(e.target) && !otherPopupOpen()) { e.preventDefault(); stop(); return; } // Escape closes the scenario; focus goes back to Play
|
|
448
454
|
}
|
|
@@ -454,7 +460,7 @@ export function createScenarioPlayer(inst, scope, checks) {
|
|
|
454
460
|
act(action);
|
|
455
461
|
});
|
|
456
462
|
// Some browsers press a focused button on the key's release, so a space the player took must not reach it
|
|
457
|
-
scope.listen(
|
|
463
|
+
scope.listen(hear, 'keyup', (e) => {
|
|
458
464
|
if (player && (e.key === ' ' || e.code === 'Space') && !typingIn(e.target)) e.preventDefault();
|
|
459
465
|
});
|
|
460
466
|
// A sheet that opened or closed changes what the map shows: keep the step in view
|
|
@@ -360,6 +360,14 @@ export function initSheets(inst) {
|
|
|
360
360
|
}
|
|
361
361
|
if (!S.documentWired) {
|
|
362
362
|
S.documentWired = true;
|
|
363
|
+
// The scenario player's bar is a sheet in the dock, above the node panel's drawer (the dock's own children): the dock's owner seats it
|
|
364
|
+
inst.on('player:seat', (bar) => {
|
|
365
|
+
const dock = S.dock;
|
|
366
|
+
if (!dock || !dock.isConnected) return undefined;
|
|
367
|
+
const drawer = [...dock.children].find((child) => child.classList.contains('hx-drawer'));
|
|
368
|
+
if (drawer) dock.insertBefore(bar, drawer); else dock.appendChild(bar);
|
|
369
|
+
return true;
|
|
370
|
+
});
|
|
363
371
|
for (const type of ['pointerdown', 'touchstart', 'mousedown']) inst.listen(inst.root, type, (e) => onMapDown(inst, e), { passive: true, capture: true });
|
|
364
372
|
inst.listen(inst.root, 'keydown', (e) => onEscape(inst, e), true);
|
|
365
373
|
onPhoneChange(inst, () => { collapseAllSheets(inst); measureCovered(inst); });
|
package/explorer/glyphs.js
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { NODE_THEMES } from '../core/schema.js';
|
|
16
|
-
import { parseColor } from './theme-model.js';
|
|
16
|
+
import { DARK_GROUND, LIGHT_GROUND, parseColor } from './theme-model.js';
|
|
17
|
+
import { over } from '../core/color.js';
|
|
17
18
|
|
|
18
19
|
/** A node is at least this many px across (on screen) before its glyph is drawn: smaller, no glyph reads and the silhouette does the work */
|
|
19
20
|
export const GLYPH_MIN_PX = 14;
|
|
@@ -48,14 +49,21 @@ const luminanceOf = ([r, g, b]) => {
|
|
|
48
49
|
};
|
|
49
50
|
const ratioOf = (a, b) => { const [hi, lo] = a > b ? [a, b] : [b, a]; return (hi + 0.05) / (lo + 0.05); };
|
|
50
51
|
|
|
51
|
-
/** The ink that reads on a fill: white or dark, whichever has the higher contrast (the glyph is at least 3:1 on every fill of the default palette: a test holds it) */
|
|
52
|
-
export function inkFor(fill) {
|
|
53
|
-
|
|
52
|
+
/** The ink that reads on a fill (seen over `ground`, when the fill is translucent): white or dark, whichever has the higher contrast (the glyph is at least 3:1 on every fill of the default palette: a test holds it) */
|
|
53
|
+
export function inkFor(fill, ground = DARK_GROUND) {
|
|
54
|
+
let rgba = parseColor(fill);
|
|
55
|
+
// A translucent fill is seen over the map's ground (a node is drawn translucent, renderer-canvas2d.js), so the ink is chosen against that.
|
|
56
|
+
// The ground is opaque: a translucent one is taken over black, as a canvas with nothing under it shows
|
|
57
|
+
if (rgba[3] < 1) rgba = over(rgba, over(parseColor(ground), [0, 0, 0, 1]));
|
|
58
|
+
const lum = luminanceOf(rgba);
|
|
54
59
|
return ratioOf(1, lum) >= ratioOf(luminanceOf(parseColor(INK_DARK)), lum) ? INK_LIGHT : INK_DARK;
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
/** The
|
|
58
|
-
|
|
62
|
+
/** The ground a node is seen over: the theme's (`--corn-ground`, the style's `ground`), else the light or the dark one */
|
|
63
|
+
const groundOf = (style, theme) => (style && style.ground) || (theme === 'light' ? LIGHT_GROUND : DARK_GROUND);
|
|
64
|
+
|
|
65
|
+
/** The ink a node's glyph is drawn in: the theme's (`--corn-map-glyph`, in the style's `values`), else the one that reads on its fill (over the ground, when it is translucent) */
|
|
66
|
+
export const glyphInk = (node, style, theme = 'dark') => (style && style.values && style.values['--corn-map-glyph']) || inkFor(node.color, groundOf(style, theme));
|
|
59
67
|
|
|
60
68
|
/** Whether a node's glyph is drawn at this zoom: it has one, no icon or letters replace it, and it is wide enough on screen */
|
|
61
69
|
export const showsGlyph = (node, zoom) => !!node.glyph && !node.icon && !node.letters && node.r * 2 * zoom >= GLYPH_MIN_PX;
|
package/explorer/instance.js
CHANGED
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
* announce text what a screen reader is told (engine/keyboard.js `announce`; the piece that owns a live region writes it: `announce:write`)
|
|
66
66
|
* root:changed (none) the primary root moved (`attach`) or a root joined or left (engine/roots.js): what listens on every root puts itself right
|
|
67
67
|
* map:ready (none) the map piece is mounted and has its topology (pieces/map.js); map:gone: it ended. The pieces around it (pieces/around.js) mount and unmount with it
|
|
68
|
+
* map:topology (none) the map piece installed a base map (a topology the host handed in, or the server's); map:canvas: its canvas was replaced (another renderer). What holds a
|
|
69
|
+
* proposal over the map (pieces/scope-proposal.js) lays it over the new base, and binds the new canvas
|
|
68
70
|
* search:status text what the search's own live region says (engine/search-status.js; pieces/search.js writes it)
|
|
69
71
|
*
|
|
70
72
|
* What a piece is asked to do (`emit`ted to it):
|
|
@@ -89,11 +91,17 @@
|
|
|
89
91
|
* scenario:clear (none) (emit) a selection ends a playing scenario
|
|
90
92
|
* proposal:effective proposal -> proposal the proposal the map is drawn from (the what-if editor's, with its edits in); proposal:before-close -> false keeps it open
|
|
91
93
|
* proposal:specs-list (none) -> false there is no list of specs to open here (the review in another app): a bad link's ways leave the button out
|
|
94
|
+
* proposal:covers (none) -> { bottom }, changes:covers (none) -> { right }, player:covers (none) -> { top } where the proposal bar, the review column and the scenario player lie over the map, in
|
|
95
|
+
* client px (engine/map-rect.js): the map frames into what is left. A piece in a box of its own lies over nothing and answers none. popup:open (none) -> true:
|
|
96
|
+
* a menu that has its own Escape is open (the Layers menu, the bar's ⋯ menu: the player's Escape leaves it alone)
|
|
97
|
+
* proposal:seat-column { column, phone } -> true the bar seats the review column: under it, or in its body on a phone (pieces/proposal.js); proposal:bar-bottom (none) -> px,
|
|
98
|
+
* how far down the bar reaches, and proposal:bar-resize (emit): the bar's height changed, so the column starts under it again
|
|
99
|
+
* player:seat bar -> true the dock's owner (engine/sheets.js) seats the scenario player's bar as a sheet above the node panel's
|
|
92
100
|
* threads:index nodeId -> { threads: thread[] | null, forge: string, start: true } | undefined the Work panel's list of the threads that mention a node, for the node panel's "Threads"; `threads` is null until the list was read; no answer: no Threads section
|
|
93
101
|
* threads:ensure (none) (emit) the node panel was filled: the Work panel reads the threads list once; threads:changed: it was read, or the map changed, so the node panel draws "Threads" again
|
|
94
102
|
* work:on (none) -> boolean whether the Work panel has started (a piece mounted after it asks rather than waits for `work:available`)
|
|
95
103
|
* work:answer { run } (emit) "Answer" on the proposal bar's line: the Work panel opens on Runs at that run, its reply field focused
|
|
96
|
-
* work:open-specs (none) -> true the Work panel's Specs tab opened for a bad link's way on; map:set { nodes, edges } -> true the page laid the map out from these
|
|
104
|
+
* work:open-specs (none) -> true the Work panel's Specs tab opened for a bad link's way on; map:set { nodes, edges } -> true the page (or the review, or a scope's map: pieces/map.js) laid the map out from these
|
|
97
105
|
* changes:opened-line title -> string, changes:played-line -> string what the review column says of an opening, and how many scenarios were played
|
|
98
106
|
* whatif:edits -> edits[], whatif:form -> { name } | null, whatif:describe -> string[] what the decision asks of the what-if editor
|
|
99
107
|
*
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
* root the shadow root of the tag
|
|
12
12
|
* inst the scope's instance, or null: no scope around the tag, so a private instance with no map, which this says (`needsScope`)
|
|
13
13
|
* options tokens (the default `--corn-*` CSS text), piece (the options the piece is mounted with), initial (its first `update`), noMap (the `strings` key said
|
|
14
|
-
* while there is no map: `needsMap`, or the panel's own empty state), onSearch ({ query, current }, the instance's `search` event)
|
|
14
|
+
* while there is no map: `needsMap`, or the panel's own empty state), onSearch ({ query, current }, the instance's `search` event),
|
|
15
|
+
* exclusive (a name: the piece holds state of its own, so a scope holds one of it; see below), signIn ({ during: string[], clear: string }: the instance's
|
|
16
|
+
* `auth` events whose `during` is listed put the scope's sign-in card in this tag's own root, and the event `clear` takes it away)
|
|
15
17
|
*
|
|
16
18
|
* What it does so that three roots can share one instance:
|
|
17
19
|
* - the root joins the instance (`joinRoot`, engine/roots.js): its keys and its focus are the instance's, so `/` pressed on the map reaches the search and a click in the
|
|
@@ -20,7 +22,10 @@
|
|
|
20
22
|
* - the piece mounts when the instance has a map with nodes (`map:ready`, then the `scene` its data brings) and ends when it has none (`map:gone`): the
|
|
21
23
|
* pieces read the map's camera, scene and visibility, so with none they say what they need in its place (`needsMap`), and while the map waits on its
|
|
22
24
|
* server (loading, signed out, offline: the map's own card says which) that they wait for it (`waitingForMap`). Tags can come in any order;
|
|
23
|
-
* - it has a live region of its own, said in only when no map has one (`announce:fallback`): a panel or a search beside no map still speaks
|
|
25
|
+
* - it has a live region of its own, said in only when no map has one (`announce:fallback`): a panel or a search beside no map still speaks;
|
|
26
|
+
* - an `exclusive` piece (the proposal's bar, the change list with its player, the decision) is one per scope: each has a state of its own (a hold, a
|
|
27
|
+
* note, a playing scenario, a line that is said once), which two could not share. The first to join holds the name; a second says `secondSection` in its own
|
|
28
|
+
* place, tells the scope (`piece:refused`, which is `cornError` `second-section`), and takes over when the first leaves.
|
|
24
29
|
* Nothing here reads the page: no `document`, no id of a neighbour. It never throws for a missing scope or map.
|
|
25
30
|
*/
|
|
26
31
|
|
|
@@ -46,11 +51,12 @@ function adoptTokens(root, css) {
|
|
|
46
51
|
* @param {{ mount: Function }} piece
|
|
47
52
|
* @param {ShadowRoot|Element} root
|
|
48
53
|
* @param {ReturnType<typeof createInstance>|null} inst
|
|
49
|
-
* @param {{ tokens?: string, piece?: object, initial?: object, noMap?: string, onSearch?: (d: { query: string, current: string | null }) => void }} [options]
|
|
54
|
+
* @param {{ tokens?: string, piece?: object, initial?: object, noMap?: string, onSearch?: (d: { query: string, current: string | null }) => void, exclusive?: string, signIn?: { during: string[], clear: string } }} [options]
|
|
50
55
|
*/
|
|
51
56
|
export function mountAround(piece, root, inst, options = {}) {
|
|
52
57
|
const ownsInstance = !inst;
|
|
53
58
|
if (ownsInstance) inst = createInstance({ root });
|
|
59
|
+
const exclusive = typeof options.exclusive === 'string' ? options.exclusive : '';
|
|
54
60
|
const info = scopeInfo(inst);
|
|
55
61
|
const scope = scopeOf(inst);
|
|
56
62
|
adoptTokens(root, options.tokens);
|
|
@@ -62,8 +68,14 @@ export function mountAround(piece, root, inst, options = {}) {
|
|
|
62
68
|
scope.on('announce:fallback', (text) => { say(text); return true; });
|
|
63
69
|
scope.own(() => region.remove());
|
|
64
70
|
|
|
71
|
+
/** Who holds each exclusive name in this instance (this call is the token) */
|
|
72
|
+
const holders = exclusive ? inst.slot('exclusive', () => new Map()) : null;
|
|
73
|
+
const token = {};
|
|
74
|
+
const second = () => !!holders && holders.has(exclusive) && holders.get(exclusive) !== token;
|
|
75
|
+
const takeName = () => { if (!holders) return true; if (second()) return false; holders.set(exclusive, token); return true; };
|
|
65
76
|
let real = null;
|
|
66
77
|
let note = [];
|
|
78
|
+
let told = false;
|
|
67
79
|
let pending = { ...(options.initial || {}) };
|
|
68
80
|
let ended = false;
|
|
69
81
|
|
|
@@ -73,13 +85,18 @@ export function mountAround(piece, root, inst, options = {}) {
|
|
|
73
85
|
const hasMap = () => !!inst.map && inst.state.nodes.length > 0;
|
|
74
86
|
const showNote = (gone = false) => {
|
|
75
87
|
if (ended) return;
|
|
76
|
-
const words = !info ? t(inst, 'needsScope') : options.noMap === 'nodePanelEmpty' ? t(inst, 'nodePanelEmpty') : inst.map && !gone ? t(inst, 'waitingForMap') : t(inst, 'needsMap');
|
|
88
|
+
const words = second() ? t(inst, 'secondSection') : !info ? t(inst, 'needsScope') : options.noMap === 'nodePanelEmpty' ? t(inst, 'nodePanelEmpty') : inst.map && !gone ? t(inst, 'waitingForMap') : t(inst, 'needsMap');
|
|
77
89
|
if (note.length && note[0].textContent === words) return;
|
|
78
90
|
dropNote();
|
|
79
91
|
note = place(inst, root, `<p class="hx-needs" data-corn="empty">${escapeHtml(words)}</p>`, null, 'needs');
|
|
80
92
|
};
|
|
81
93
|
const mountReal = () => {
|
|
82
94
|
if (real || ended) return;
|
|
95
|
+
if (!takeName()) {
|
|
96
|
+
showNote();
|
|
97
|
+
if (!told) { told = true; inst.emit('piece:refused', { piece: exclusive, reason: 'second-section', message: `A scope holds one ${exclusive}.` }); }
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
83
100
|
if (!hasMap()) { showNote(); return; }
|
|
84
101
|
dropNote();
|
|
85
102
|
real = piece.mount(root, inst, { ...(options.piece || {}), inline: true, phone: false });
|
|
@@ -88,9 +105,18 @@ export function mountAround(piece, root, inst, options = {}) {
|
|
|
88
105
|
const unmountReal = () => { if (real) { real.destroy(); real = null; } };
|
|
89
106
|
|
|
90
107
|
scope.on('map:ready', mountReal);
|
|
108
|
+
scope.on('exclusive:released', (d) => { if (d && d.name === exclusive) mountReal(); }); // the one that held the name left: this one may have it
|
|
91
109
|
scope.on('scene', () => { if (!real) mountReal(); }); // the map's data came (its server answered, or the host handed it in)
|
|
92
110
|
scope.on('map:gone', () => { unmountReal(); showNote(true); }); // (said while the map ends: the instance may still hold it)
|
|
93
111
|
if (options.onSearch) scope.on('search', (d) => options.onSearch(d));
|
|
112
|
+
// A refusal for want of a sign-in, said where the person is working (the scope says it once to the host: `cornAuth`)
|
|
113
|
+
if (options.signIn && info && info.mountStatus) {
|
|
114
|
+
const [slot] = place(inst, root, '<div class="hx-signin-slot"></div>', null, 'signin');
|
|
115
|
+
const card = info.mountStatus(slot, inst, { follow: false });
|
|
116
|
+
scope.on('auth', ({ status, during }) => { if (options.signIn.during.includes(during)) card.show({ state: 'sign-in', status, signIn: info.signIn() }); });
|
|
117
|
+
scope.on(options.signIn.clear, () => card.clear());
|
|
118
|
+
scope.own(() => { card.destroy(); slot.remove(); });
|
|
119
|
+
}
|
|
94
120
|
mountReal();
|
|
95
121
|
|
|
96
122
|
return {
|
|
@@ -107,7 +133,10 @@ export function mountAround(piece, root, inst, options = {}) {
|
|
|
107
133
|
ended = true;
|
|
108
134
|
unmountReal();
|
|
109
135
|
dropNote();
|
|
136
|
+
const held = holders && holders.get(exclusive) === token;
|
|
137
|
+
if (held) holders.delete(exclusive);
|
|
110
138
|
scope.destroy();
|
|
139
|
+
if (held && !inst.ended) inst.emit('exclusive:released', { name: exclusive });
|
|
111
140
|
if (ownsInstance) inst.destroy();
|
|
112
141
|
},
|
|
113
142
|
};
|
|
@@ -30,7 +30,10 @@
|
|
|
30
30
|
*
|
|
31
31
|
* @param {ParentNode} root where the column goes when `options.slots` names no place
|
|
32
32
|
* @param {ReturnType<typeof import('../instance.js').createInstance>} inst the instance; its map must be made (engine/render.js)
|
|
33
|
-
* @param {{ slots?: { column?: Node }, checker?: object | null }} [options] `checker`: a plugin's checker for the scenarios' permission checks (none: "Not checked")
|
|
33
|
+
* @param {{ slots?: { column?: Node }, checker?: object | null, inline?: boolean }} [options] `checker`: a plugin's checker for the scenarios' permission checks (none: "Not checked").
|
|
34
|
+
* `inline` is the piece in a box and a root of its own (`<corn-changes>`, pieces/around.js): the column fills the box (no panel docked beside the map, no phone sheet and no
|
|
35
|
+
* tabs: both lists, one under the other, scroll inside it), the player's bar is its last part, not a bar over the map's bottom, and its keys are this root's. What lies
|
|
36
|
+
* over the map is none of its business: it answers no `*:covers`, and chooses a step without closing a node panel
|
|
34
37
|
* @returns {{ update: (props?: { checker?: object | null }) => void, destroy: () => void, playScenario: Function, stopScenario: Function, getPlayer: Function, elements: Element[] }}
|
|
35
38
|
* `update({ checker })` hands over the checker; `update()` draws the lists again.
|
|
36
39
|
*/
|
|
@@ -55,13 +58,13 @@ const PLAYER_BESIDE_PANEL = 1360;
|
|
|
55
58
|
const asList = (v) => (Array.isArray(v) ? v : []);
|
|
56
59
|
|
|
57
60
|
/** The markup of the piece: the column. `column` is its one place; it keeps a place of its own for the decision's foot */
|
|
58
|
-
export const markup = () => ({
|
|
61
|
+
export const markup = ({ inline = false } = {}) => ({
|
|
59
62
|
column: '<aside id="review-column" class="hx-review-column glass" aria-label="Review" data-corn="review-column" hidden>'
|
|
60
63
|
+ '<div class="hx-rc-scroll">'
|
|
61
64
|
+ '<p id="proposal-summary" class="hx-proposal-summary" hidden></p>'
|
|
62
65
|
+ '<div id="review-lists" class="hx-rc-lists"></div>'
|
|
63
66
|
+ '</div>'
|
|
64
|
-
+ '<!--corn-piece:decision/foot-->'
|
|
67
|
+
+ (inline ? '<div class="hx-player-seat"></div>' : '<!--corn-piece:decision/foot-->') // a box of its own has no foot: the decision is a tag of its own
|
|
65
68
|
+ '</aside>',
|
|
66
69
|
});
|
|
67
70
|
|
|
@@ -77,7 +80,10 @@ function changeRowHtml(r) {
|
|
|
77
80
|
export function mount(root, inst, options = {}) {
|
|
78
81
|
const { state } = inst;
|
|
79
82
|
const scope = scopeOf(inst);
|
|
80
|
-
const
|
|
83
|
+
const inline = !!options.inline;
|
|
84
|
+
/** Whether the layout is a phone's: the window's width on cornfield's page, the box's in a review. A box of its own never has the phone's sheets: its narrowness is the CSS's alone */
|
|
85
|
+
const phone = () => !inline && isPhone(inst);
|
|
86
|
+
const made = place(inst, root, markup({ inline }).column, options.slots, 'column');
|
|
81
87
|
/** An element of this piece by id */
|
|
82
88
|
const own = (id) => {
|
|
83
89
|
for (const el of made) {
|
|
@@ -92,7 +98,7 @@ export function mount(root, inst, options = {}) {
|
|
|
92
98
|
let gone = false;
|
|
93
99
|
|
|
94
100
|
const checks = createChecks(inst, { checker: options.checker });
|
|
95
|
-
const player = createScenarioPlayer(inst, scope, checks);
|
|
101
|
+
const player = createScenarioPlayer(inst, scope, checks, inline ? { seat: col.querySelector('.hx-player-seat'), hear: root } : {});
|
|
96
102
|
scope.own(() => checks.close());
|
|
97
103
|
|
|
98
104
|
/** What the column shows apart from the proposal: the scenario whose steps are open, the phone's tab, the PR head the record is keyed by */
|
|
@@ -220,17 +226,17 @@ export function mount(root, inst, options = {}) {
|
|
|
220
226
|
const rows = everyRow.filter((r) => r.mark !== 'edit');
|
|
221
227
|
const mine = everyRow.filter((r) => r.mark === 'edit'); // "Your edits · 1": the first group, not the last row
|
|
222
228
|
const list = model();
|
|
223
|
-
const
|
|
229
|
+
const narrow = phone();
|
|
224
230
|
// the phone's tab: the reviewer's last choice, or Scenarios when there are any; a proposal with none opens on its changes
|
|
225
231
|
if (ui.tabFor !== proposalKey()) { ui.tabFor = proposalKey(); ui.tabNow = list.total ? (ui.tab || 'scenarios') : 'changes'; }
|
|
226
232
|
const tab = ui.tabNow || 'changes';
|
|
227
233
|
const personas = state.nodes.some((n) => n.type === 'persona');
|
|
228
234
|
|
|
229
|
-
const tabs = `<div class="hx-rc-tabs" role="tablist" aria-label="Review" data-corn="tabs"${
|
|
235
|
+
const tabs = `<div class="hx-rc-tabs" role="tablist" aria-label="Review" data-corn="tabs"${narrow ? '' : ' hidden'}>`
|
|
230
236
|
+ `<button type="button" role="tab" id="rc-tab-changes" class="hx-rc-tab" data-corn="tab" data-action="review-tab" data-tab="changes" aria-selected="${tab === 'changes'}" aria-controls="rc-changes" tabindex="${tab === 'changes' ? 0 : -1}">${escHtml(t(inst, 'changes'))} · ${rows.length}</button>`
|
|
231
237
|
+ `<button type="button" role="tab" id="rc-tab-scenarios" class="hx-rc-tab" data-corn="tab" data-action="review-tab" data-tab="scenarios" aria-selected="${tab === 'scenarios'}" aria-controls="rc-scenarios" tabindex="${tab === 'scenarios' ? 0 : -1}">${escHtml(t(inst, 'scenarios'))} · ${list.total}</button></div>`;
|
|
232
238
|
|
|
233
|
-
const changes = `<section id="rc-changes" class="hx-rc-section" data-corn="proposal-changes"${
|
|
239
|
+
const changes = `<section id="rc-changes" class="hx-rc-section" data-corn="proposal-changes"${narrow ? ` role="tabpanel" aria-labelledby="rc-tab-changes"${tab === 'changes' ? '' : ' hidden'}` : ' aria-labelledby="rc-changes-h"'}>`
|
|
234
240
|
+ `<h3 id="rc-changes-h" class="hx-rc-h" tabindex="-1">${countHeading(t(inst, 'changes'), rows.length)}</h3>`
|
|
235
241
|
+ (mine.length ? `<h4 class="hx-rc-sub">${countHeading(t(inst, 'yourEdits'), mine.length)}</h4><ul class="hx-change-list">${mine.map(changeRowHtml).join('')}</ul>` : '')
|
|
236
242
|
+ (rows.length ? `<ul class="hx-change-list">${rows.map(changeRowHtml).join('')}</ul>` : '<p class="hx-faint hx-rc-empty">This proposal changes nothing on the map.</p>')
|
|
@@ -243,7 +249,7 @@ export function mount(root, inst, options = {}) {
|
|
|
243
249
|
if (!personas) body += `<p class="hx-faint hx-rc-note">This map has no personas (topology.personas.json), so every scenario is listed under ${escHtml(t(inst, 'anyone'))}.</p>`;
|
|
244
250
|
if (list.coverage) body += `<p class="hx-rc-coverage" data-corn="notice">${escHtml(t(inst, 'notInAnyScenario'))}: ${list.notInAny.map(escHtml).join(', ')}</p>`;
|
|
245
251
|
}
|
|
246
|
-
const scenarios = `<section id="rc-scenarios" class="hx-rc-section" data-corn="scenario-list"${
|
|
252
|
+
const scenarios = `<section id="rc-scenarios" class="hx-rc-section" data-corn="scenario-list"${narrow ? ` role="tabpanel" aria-labelledby="rc-tab-scenarios"${tab === 'scenarios' ? '' : ' hidden'}` : ' aria-labelledby="rc-scenarios-h"'}>`
|
|
247
253
|
+ `<h3 id="rc-scenarios-h" class="hx-rc-h" tabindex="-1">${countHeading(t(inst, 'personasAndScenarios'), list.total)}</h3><div class="hx-rc-sbody">${body}</div></section>`;
|
|
248
254
|
return `${tabs}${changes}${scenarios}`;
|
|
249
255
|
}
|
|
@@ -253,20 +259,15 @@ export function mount(root, inst, options = {}) {
|
|
|
253
259
|
// ---------------------------------------------------------------------------
|
|
254
260
|
/** Where the column goes: after the proposal bar in the dock from 768px, at the end of the sheet's body on a phone */
|
|
255
261
|
function mountColumn() {
|
|
256
|
-
|
|
257
|
-
const body = inst.el('proposal-body');
|
|
258
|
-
if (isPhone(inst) && body) { if (col.parentElement !== body) body.appendChild(col); } else if (dock) {
|
|
259
|
-
const bar = inst.el('proposal-bar');
|
|
260
|
-
if (bar && col.parentElement !== dock) bar.after(col);
|
|
261
|
-
}
|
|
262
|
+
if (!inline) inst.ask('proposal:seat-column', { column: col, phone: phone() }); // the bar seats it (pieces/proposal.js): nobody answering leaves it where it is
|
|
262
263
|
return col;
|
|
263
264
|
}
|
|
264
265
|
|
|
265
266
|
/** The column starts under the bar, whatever height the bar has (the counts wrap, the edit controls open): from 768px; a phone's has no place of its own */
|
|
266
267
|
function placeColumn() {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
col.style.setProperty('--hx-column-top', `${
|
|
268
|
+
if (inline || phone()) return;
|
|
269
|
+
const bottom = inst.ask('proposal:bar-bottom');
|
|
270
|
+
if (typeof bottom === 'number') col.style.setProperty('--hx-column-top', `${bottom}px`);
|
|
270
271
|
}
|
|
271
272
|
|
|
272
273
|
/** Draws the column for the open proposal, or hides it when none is open */
|
|
@@ -288,7 +289,7 @@ export function mount(root, inst, options = {}) {
|
|
|
288
289
|
function shareRoom() {
|
|
289
290
|
const lists = own('review-lists');
|
|
290
291
|
const sc = own('rc-scenarios');
|
|
291
|
-
if (!lists || !sc || col.hidden ||
|
|
292
|
+
if (!lists || !sc || col.hidden || phone()) return;
|
|
292
293
|
const h = lists.clientHeight;
|
|
293
294
|
if (!h) return;
|
|
294
295
|
const gap = parseFloat(inst.win.getComputedStyle(lists).rowGap) || 0;
|
|
@@ -356,10 +357,9 @@ export function mount(root, inst, options = {}) {
|
|
|
356
357
|
function chooseStep(sc, index) {
|
|
357
358
|
ui.open = sc.id;
|
|
358
359
|
// Under 1360px the column, the node panel and the player bar do not fit side by side: the node panel closes, the player takes its room
|
|
359
|
-
const drawer = inst.el('spec-drawer');
|
|
360
360
|
const stage = state.canvas && state.canvas.parentElement;
|
|
361
|
-
if (!
|
|
362
|
-
player.play(sc, { autoplay: false, step: index, focus:
|
|
361
|
+
if (!inline && !phone() && inst.ask('panel:covers') && stage && stage.clientWidth < PLAYER_BESIDE_PANEL) clearSelection(inst, { source: 'api' }); // a slide-over node panel is open (it answers `panel:covers`)
|
|
362
|
+
player.play(sc, { autoplay: false, step: index, focus: phone() });
|
|
363
363
|
repaint();
|
|
364
364
|
}
|
|
365
365
|
|
|
@@ -375,7 +375,7 @@ export function mount(root, inst, options = {}) {
|
|
|
375
375
|
/** The counts' parts open their section: the switch moves to it on a phone; from 768px it scrolls into view and takes the focus */
|
|
376
376
|
function showSection(which) {
|
|
377
377
|
if (!state.proposal) return;
|
|
378
|
-
if (
|
|
378
|
+
if (phone()) { showTab(which); expandSheet(inst, 'proposal'); }
|
|
379
379
|
const section = own(which === 'scenarios' ? 'rc-scenarios' : 'rc-changes');
|
|
380
380
|
const heading = own(which === 'scenarios' ? 'rc-scenarios-h' : 'rc-changes-h');
|
|
381
381
|
if (section && typeof section.scrollIntoView === 'function') section.scrollIntoView({ block: 'start' });
|
|
@@ -426,7 +426,7 @@ export function mount(root, inst, options = {}) {
|
|
|
426
426
|
function stepToFocus() {
|
|
427
427
|
const at = ui.lastStep;
|
|
428
428
|
if (!at) return null;
|
|
429
|
-
if (
|
|
429
|
+
if (phone()) expandSheet(inst, 'proposal');
|
|
430
430
|
const lists = own('review-lists');
|
|
431
431
|
return lists ? lists.querySelector(`[data-action="scenario-step"][data-scenario-index="${at.index}"][data-step-index="${at.step}"]`) : null;
|
|
432
432
|
}
|
|
@@ -451,9 +451,15 @@ export function mount(root, inst, options = {}) {
|
|
|
451
451
|
scope.on('changes:show', (which) => showSection(which));
|
|
452
452
|
const RO = inst.win && inst.win.ResizeObserver;
|
|
453
453
|
const watch = (el, fn) => { if (el && typeof RO === 'function') { const ro = new RO(fn); ro.observe(el); scope.own(() => ro.disconnect()); } };
|
|
454
|
-
|
|
454
|
+
scope.on('proposal:bar-resize', () => placeColumn()); // the bar's height changed (the counts wrap, a line comes): the column starts under it
|
|
455
455
|
watch(col, () => shareRoom()); // the window's height changed
|
|
456
|
-
|
|
456
|
+
if (!inline) {
|
|
457
|
+
scope.own(onPhoneChange(inst, () => { if (state.proposal) renderColumn(); })); // the window's width, or the box's where the review has one (engine/sheets.js)
|
|
458
|
+
// What the column and the player cover of the map: the map frames a step into what is left (engine/map-rect.js)
|
|
459
|
+
const shown = (el) => !!el && !el.hidden && el.isConnected;
|
|
460
|
+
scope.on('changes:covers', () => (shown(col) ? { right: col.getBoundingClientRect().right } : undefined));
|
|
461
|
+
scope.on('player:covers', () => { const bar = player.bar(); return shown(bar) ? { top: bar.getBoundingClientRect().top } : undefined; });
|
|
462
|
+
}
|
|
457
463
|
|
|
458
464
|
scope.own(() => {
|
|
459
465
|
gone = true;
|