@things-factory/help 10.1.291 → 10.1.294
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/dist-client/guide/guide-editor-sections.d.ts +12 -0
- package/dist-client/guide/guide-editor-sections.js +9 -0
- package/dist-client/guide/guide-runner.d.ts +15 -0
- package/dist-client/guide/guide-runner.js +33 -0
- package/dist-client/guide/ox-guide-overlay.d.ts +3 -2
- package/dist-client/guide/ox-guide-overlay.js +13 -2
- package/dist-client/index.d.ts +2 -1
- package/dist-client/index.js +2 -1
- package/dist-client/pages/guide-editor.js +7 -0
- package/package.json +2 -2
- package/translations/en.json +2 -0
- package/translations/es.json +2 -0
- package/translations/ja.json +2 -0
- package/translations/ko.json +2 -0
- package/translations/ms.json +2 -0
- package/translations/zh.json +2 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TemplateResult } from 'lit';
|
|
2
|
+
/** A section of the editor: its title, and what it draws under it for a saved guide. The editor draws the frame. */
|
|
3
|
+
export type GuideEditorSection = {
|
|
4
|
+
title: () => string;
|
|
5
|
+
render: (guide: {
|
|
6
|
+
id: string;
|
|
7
|
+
condition: string | null;
|
|
8
|
+
}) => TemplateResult;
|
|
9
|
+
};
|
|
10
|
+
/** What a module calls at load. Registering the same id again replaces it. */
|
|
11
|
+
export declare function registerGuideEditorSection(id: string, section: GuideEditorSection): void;
|
|
12
|
+
export declare function guideEditorSections(): GuideEditorSection[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const SECTIONS = new Map();
|
|
2
|
+
/** What a module calls at load. Registering the same id again replaces it. */
|
|
3
|
+
export function registerGuideEditorSection(id, section) {
|
|
4
|
+
SECTIONS.set(id, section);
|
|
5
|
+
}
|
|
6
|
+
export function guideEditorSections() {
|
|
7
|
+
return [...SECTIONS.values()];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=guide-editor-sections.js.map
|
|
@@ -7,6 +7,13 @@ export type GuideOrigin = {
|
|
|
7
7
|
};
|
|
8
8
|
/** Answers whether the person's work is done, and records it - registered by the module that carries guides to people. */
|
|
9
9
|
export type GuideFinisher = (originId: string, guide: GuideItem) => Promise<boolean>;
|
|
10
|
+
/** Told on `window` when a guide ends - closed by the person, or done (ADR-0212 amendment 1: closing it is 「나중에」). */
|
|
11
|
+
export declare const GUIDE_STOPPED = "guide-stopped";
|
|
12
|
+
export type GuideStopped = {
|
|
13
|
+
guideId?: string;
|
|
14
|
+
origin?: GuideOrigin;
|
|
15
|
+
done: boolean;
|
|
16
|
+
};
|
|
10
17
|
/** What a module that carries guides to people calls at load - `announcement`. */
|
|
11
18
|
export declare function registerGuideFinisher(kind: string, finisher: GuideFinisher): void;
|
|
12
19
|
/** Starts a guide - by its id, or as the writer has it in the editor (a preview). */
|
|
@@ -14,5 +21,13 @@ export declare function startGuide(guide: GuideItem | string, origin?: GuideOrig
|
|
|
14
21
|
/** Goes on with the guide the session was in - at sign-in or after a reload. */
|
|
15
22
|
export declare function resumeGuide(): void;
|
|
16
23
|
export declare function guideRunning(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Offers a guide on screen (ADR-0212 amendment 1): its opening sentence in the same bubble, with 「시작」 and 「나중에」.
|
|
26
|
+
* Nothing is covered and nothing else happens until the person answers. Not while a guide is in progress.
|
|
27
|
+
*/
|
|
28
|
+
export declare function offerGuide(guide: GuideItem, options: {
|
|
29
|
+
origin?: GuideOrigin;
|
|
30
|
+
later: () => void;
|
|
31
|
+
}): void;
|
|
17
32
|
/** Ends the guide - the person closed it, or it is done. It is offered again while its work is not done. */
|
|
18
33
|
export declare function stopGuide(): void;
|
|
@@ -11,6 +11,8 @@ import { findShown } from './deep-find.js';
|
|
|
11
11
|
import { guideAnchor, guideAnchors, selectorOf } from './guide-anchors.js';
|
|
12
12
|
import { guideApi } from './guide-api.js';
|
|
13
13
|
import { anchorOnPath, moveStillDue, stepFinishedBy } from './guide-progress.js';
|
|
14
|
+
/** Told on `window` when a guide ends - closed by the person, or done (ADR-0212 amendment 1: closing it is 「나중에」). */
|
|
15
|
+
export const GUIDE_STOPPED = 'guide-stopped';
|
|
14
16
|
const KEY = 'guide.running';
|
|
15
17
|
const FINISHERS = new Map();
|
|
16
18
|
const CHECK_AGAIN_AFTER = [1000, 2000];
|
|
@@ -19,6 +21,8 @@ let overlay;
|
|
|
19
21
|
let ticker;
|
|
20
22
|
let openedFor = -1;
|
|
21
23
|
let state = 'working';
|
|
24
|
+
/* A guide offered on screen, not started yet (ADR-0212 amendment 1). */
|
|
25
|
+
let offered;
|
|
22
26
|
/** What a module that carries guides to people calls at load - `announcement`. */
|
|
23
27
|
export function registerGuideFinisher(kind, finisher) {
|
|
24
28
|
FINISHERS.set(kind, finisher);
|
|
@@ -66,8 +70,20 @@ export function resumeGuide() {
|
|
|
66
70
|
export function guideRunning() {
|
|
67
71
|
return !!running;
|
|
68
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Offers a guide on screen (ADR-0212 amendment 1): its opening sentence in the same bubble, with 「시작」 and 「나중에」.
|
|
75
|
+
* Nothing is covered and nothing else happens until the person answers. Not while a guide is in progress.
|
|
76
|
+
*/
|
|
77
|
+
export function offerGuide(guide, options) {
|
|
78
|
+
if (running || !guide?.steps?.length)
|
|
79
|
+
return;
|
|
80
|
+
offered = { guide, ...options };
|
|
81
|
+
show();
|
|
82
|
+
}
|
|
69
83
|
/** Ends the guide - the person closed it, or it is done. It is offered again while its work is not done. */
|
|
70
84
|
export function stopGuide() {
|
|
85
|
+
const ended = running ? { guideId: running.guide.id, origin: running.origin, done: state === 'done' } : undefined;
|
|
86
|
+
offered = undefined;
|
|
71
87
|
running = undefined;
|
|
72
88
|
keep();
|
|
73
89
|
if (ticker)
|
|
@@ -78,6 +94,8 @@ export function stopGuide() {
|
|
|
78
94
|
document.removeEventListener('field-change', onChange, true);
|
|
79
95
|
overlay?.remove();
|
|
80
96
|
overlay = undefined;
|
|
97
|
+
if (ended)
|
|
98
|
+
window.dispatchEvent(new CustomEvent(GUIDE_STOPPED, { detail: ended }));
|
|
81
99
|
}
|
|
82
100
|
function show() {
|
|
83
101
|
if (!overlay) {
|
|
@@ -85,6 +103,17 @@ function show() {
|
|
|
85
103
|
overlay.addEventListener('guide-next', () => next());
|
|
86
104
|
overlay.addEventListener('guide-stop', () => stopGuide());
|
|
87
105
|
overlay.addEventListener('guide-check', () => finish());
|
|
106
|
+
overlay.addEventListener('guide-start', () => {
|
|
107
|
+
const one = offered;
|
|
108
|
+
offered = undefined;
|
|
109
|
+
if (one)
|
|
110
|
+
void startGuide(one.guide, one.origin);
|
|
111
|
+
});
|
|
112
|
+
overlay.addEventListener('guide-later', () => {
|
|
113
|
+
const one = offered;
|
|
114
|
+
stopGuide();
|
|
115
|
+
one?.later();
|
|
116
|
+
});
|
|
88
117
|
document.body.appendChild(overlay);
|
|
89
118
|
document.addEventListener('click', onClick, true);
|
|
90
119
|
document.addEventListener('change', onChange, true);
|
|
@@ -96,6 +125,10 @@ function show() {
|
|
|
96
125
|
}
|
|
97
126
|
/* Each beat: open the step's page once, find its point, and draw the frame and the card where it is now. */
|
|
98
127
|
function tick() {
|
|
128
|
+
if (offered && !running && overlay) {
|
|
129
|
+
overlay.view = { text: offered.guide.opening, index: 0, total: offered.guide.steps.length, rect: null, explains: true, checked: !!offered.guide.condition, state: 'invited' };
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
99
132
|
if (!running || !overlay)
|
|
100
133
|
return;
|
|
101
134
|
const { guide, index } = running;
|
|
@@ -13,12 +13,13 @@ export type GuideView = {
|
|
|
13
13
|
action?: GuideAnchorAction;
|
|
14
14
|
/** Whether the server checks the work - only then is the work said to be confirmed. */
|
|
15
15
|
checked: boolean;
|
|
16
|
-
|
|
16
|
+
/** `invited`: offered on screen, not started - the opening sentence with 「시작」 and 「나중에」 (ADR-0212 amendment 1). */
|
|
17
|
+
state: 'invited' | 'working' | 'checking' | 'unfinished' | 'done';
|
|
17
18
|
};
|
|
18
19
|
export declare class OxGuideOverlay extends LitElement {
|
|
19
20
|
static styles: import("lit").CSSResult;
|
|
20
21
|
view?: GuideView;
|
|
21
|
-
render(): import("lit-html").TemplateResult<1
|
|
22
|
+
render(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
22
23
|
private iconOf;
|
|
23
24
|
private renderBody;
|
|
24
25
|
/**
|
|
@@ -209,14 +209,18 @@ let OxGuideOverlay = class OxGuideOverlay extends LitElement {
|
|
|
209
209
|
<div class="bubble ${state === 'done' ? 'done' : ''}" role="dialog" aria-live="polite" style=${styleMap(this.placeOf(rect))}>
|
|
210
210
|
<span class="badge" aria-hidden="true"><md-icon>${this.iconOf(view)}</md-icon></span>
|
|
211
211
|
<div class="content">
|
|
212
|
-
|
|
212
|
+
${state === 'invited'
|
|
213
|
+
? nothing
|
|
214
|
+
: html `<div class="dots" role="img" aria-label=${t('guide.text.progress', { index: view.index + 1, total: view.total })}>
|
|
213
215
|
${Array.from({ length: view.total }, (_one, at) => html `<span class=${at < view.index ? 'past' : at === view.index ? 'now' : ''}></span>`)}
|
|
214
|
-
</div
|
|
216
|
+
</div>`}
|
|
215
217
|
${this.renderBody(view)}
|
|
216
218
|
</div>
|
|
217
219
|
</div>`;
|
|
218
220
|
}
|
|
219
221
|
iconOf(view) {
|
|
222
|
+
if (view.state === 'invited')
|
|
223
|
+
return 'waving_hand';
|
|
220
224
|
if (view.state === 'done')
|
|
221
225
|
return 'celebration';
|
|
222
226
|
if (view.state === 'checking')
|
|
@@ -228,6 +232,13 @@ let OxGuideOverlay = class OxGuideOverlay extends LitElement {
|
|
|
228
232
|
return ICONS[view.action ?? ''] ?? 'touch_app';
|
|
229
233
|
}
|
|
230
234
|
renderBody(view) {
|
|
235
|
+
if (view.state === 'invited') {
|
|
236
|
+
return html `<p>${view.text}</p>
|
|
237
|
+
<div class="actions">
|
|
238
|
+
<md-text-button @click=${() => this.say('guide-later')}>${t('guide.button.later')}</md-text-button>
|
|
239
|
+
<md-filled-tonal-button @click=${() => this.say('guide-start')}>${t('guide.button.start')}</md-filled-tonal-button>
|
|
240
|
+
</div>`;
|
|
241
|
+
}
|
|
231
242
|
if (view.state === 'done') {
|
|
232
243
|
return html `<p>${t(view.checked ? 'guide.text.done' : 'guide.text.finished')}</p>
|
|
233
244
|
<div class="actions"><md-filled-tonal-button @click=${() => this.say('guide-stop')}>${t('guide.button.close')}</md-filled-tonal-button></div>`;
|
package/dist-client/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from '@operato/help';
|
|
2
2
|
export { registerGuideAnchors, guideAnchor, guideAnchors, selectorOf, type GuideAnchor, type GuideAnchorAction, type GuideAnchorTarget } from './guide/guide-anchors.js';
|
|
3
3
|
export { brokenSteps, type GuideItem, type GuideStep } from './guide/guide-progress.js';
|
|
4
|
-
export { registerGuideFinisher, startGuide, stopGuide, guideRunning, type GuideFinisher, type GuideOrigin } from './guide/guide-runner.js';
|
|
4
|
+
export { registerGuideFinisher, startGuide, stopGuide, guideRunning, offerGuide, GUIDE_STOPPED, type GuideFinisher, type GuideOrigin, type GuideStopped } from './guide/guide-runner.js';
|
|
5
|
+
export { registerGuideEditorSection, type GuideEditorSection } from './guide/guide-editor-sections.js';
|
|
5
6
|
export { guideApi, type GuideRow } from './guide/guide-api.js';
|
package/dist-client/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from '@operato/help';
|
|
2
2
|
export { registerGuideAnchors, guideAnchor, guideAnchors, selectorOf } from './guide/guide-anchors.js';
|
|
3
3
|
export { brokenSteps } from './guide/guide-progress.js';
|
|
4
|
-
export { registerGuideFinisher, startGuide, stopGuide, guideRunning } from './guide/guide-runner.js';
|
|
4
|
+
export { registerGuideFinisher, startGuide, stopGuide, guideRunning, offerGuide, GUIDE_STOPPED } from './guide/guide-runner.js';
|
|
5
|
+
export { registerGuideEditorSection } from './guide/guide-editor-sections.js';
|
|
5
6
|
export { guideApi } from './guide/guide-api.js';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -10,6 +10,7 @@ import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
|
10
10
|
import { navigate, PageView } from '@operato/shell';
|
|
11
11
|
import { ButtonStyles, DocumentPageStyles, FormFieldStyles } from '@operato/styles';
|
|
12
12
|
import { guideAnchor } from '../guide/guide-anchors.js';
|
|
13
|
+
import { guideEditorSections } from '../guide/guide-editor-sections.js';
|
|
13
14
|
import { guideApi } from '../guide/guide-api.js';
|
|
14
15
|
import { brokenSteps, moveStep } from '../guide/guide-progress.js';
|
|
15
16
|
import { RECORDED_KEY, startRecording } from '../guide/guide-recorder.js';
|
|
@@ -213,6 +214,12 @@ let GuideEditor = class GuideEditor extends localize(i18next)(PageView) {
|
|
|
213
214
|
</ol>`
|
|
214
215
|
: html `<p class="empty">${t('guide.text.steps-empty')}</p>`}
|
|
215
216
|
</section>
|
|
217
|
+
${this.guideId
|
|
218
|
+
? guideEditorSections().map(section => html `<section class="page-section">
|
|
219
|
+
<header class="page-section-header"><h3>${section.title()}</h3></header>
|
|
220
|
+
${section.render({ id: this.guideId, condition: this.form.condition || null })}
|
|
221
|
+
</section>`)
|
|
222
|
+
: nothing}
|
|
216
223
|
</div>`;
|
|
217
224
|
}
|
|
218
225
|
renderStep(step, index, broken, set) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/help",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.294",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"files": [
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"graphql-tag": "^2.12.6",
|
|
61
61
|
"lit": "^3.1.2"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "f8a717cf9de2cd909f912d0a26d9262087433c52"
|
|
64
64
|
}
|
package/translations/en.json
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"guide.button.finish": "Finish",
|
|
26
26
|
"guide.button.stop": "End guide",
|
|
27
27
|
"guide.button.close": "Close",
|
|
28
|
+
"guide.button.start": "Start",
|
|
29
|
+
"guide.button.later": "Later",
|
|
28
30
|
"guide.button.check-again": "Check again",
|
|
29
31
|
"guide.button.end-recording": "End recording",
|
|
30
32
|
"guide.button.cancel-recording": "Cancel recording",
|
package/translations/es.json
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"guide.button.finish": "Finalizar",
|
|
26
26
|
"guide.button.stop": "Terminar guía",
|
|
27
27
|
"guide.button.close": "Cerrar",
|
|
28
|
+
"guide.button.start": "Empezar",
|
|
29
|
+
"guide.button.later": "Más tarde",
|
|
28
30
|
"guide.button.check-again": "Volver a comprobar",
|
|
29
31
|
"guide.button.end-recording": "Terminar grabación",
|
|
30
32
|
"guide.button.cancel-recording": "Cancelar grabación",
|
package/translations/ja.json
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"guide.button.finish": "完了",
|
|
26
26
|
"guide.button.stop": "ガイド終了",
|
|
27
27
|
"guide.button.close": "閉じる",
|
|
28
|
+
"guide.button.start": "開始",
|
|
29
|
+
"guide.button.later": "あとで",
|
|
28
30
|
"guide.button.check-again": "再確認",
|
|
29
31
|
"guide.button.end-recording": "録画終了",
|
|
30
32
|
"guide.button.cancel-recording": "録画キャンセル",
|
package/translations/ko.json
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"guide.button.finish": "완료",
|
|
26
26
|
"guide.button.stop": "안내 종료",
|
|
27
27
|
"guide.button.close": "닫기",
|
|
28
|
+
"guide.button.start": "시작",
|
|
29
|
+
"guide.button.later": "나중에",
|
|
28
30
|
"guide.button.check-again": "다시 확인",
|
|
29
31
|
"guide.button.end-recording": "녹화 종료",
|
|
30
32
|
"guide.button.cancel-recording": "녹화 취소",
|
package/translations/ms.json
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"guide.button.finish": "Selesai",
|
|
26
26
|
"guide.button.stop": "Tamatkan panduan",
|
|
27
27
|
"guide.button.close": "Tutup",
|
|
28
|
+
"guide.button.start": "Mula",
|
|
29
|
+
"guide.button.later": "Nanti",
|
|
28
30
|
"guide.button.check-again": "Semak semula",
|
|
29
31
|
"guide.button.end-recording": "Tamat rakaman",
|
|
30
32
|
"guide.button.cancel-recording": "Batal rakaman",
|
package/translations/zh.json
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"guide.button.finish": "完成",
|
|
26
26
|
"guide.button.stop": "结束引导",
|
|
27
27
|
"guide.button.close": "关闭",
|
|
28
|
+
"guide.button.start": "开始",
|
|
29
|
+
"guide.button.later": "稍后",
|
|
28
30
|
"guide.button.check-again": "重新确认",
|
|
29
31
|
"guide.button.end-recording": "结束录制",
|
|
30
32
|
"guide.button.cancel-recording": "取消录制",
|