@operato/help 10.29.81 → 10.29.84
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 +21 -9
- package/CHANGELOG.md +0 -6370
- package/dist/src/components/ox-doc.js.map +0 -1
- package/dist/src/components/ox-figure.js.map +0 -1
- package/dist/src/components/ox-help-icon.js.map +0 -1
- package/dist/src/components/ox-help-spot.js.map +0 -1
- package/dist/src/components/ox-inline-help.js.map +0 -1
- package/dist/src/components/ox-stage-ladder.js.map +0 -1
- package/dist/src/components/ox-title-with-help.js.map +0 -1
- package/dist/src/controller/help.js.map +0 -1
- package/dist/src/controller/screen-help.js.map +0 -1
- package/dist/src/grist/help-decorated-renderer.js.map +0 -1
- package/dist/src/help-documents.js.map +0 -1
- package/dist/src/help-style.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/pages/ox-help-home.js.map +0 -1
- package/dist/src/viewparts/ox-help-panel.js.map +0 -1
- package/dist/test/ox-doc.test.d.ts +0 -3
- package/dist/test/ox-doc.test.js +0 -123
- package/dist/test/ox-doc.test.js.map +0 -1
- package/dist/test/screen-help.test.d.ts +0 -1
- package/dist/test/screen-help.test.js +0 -63
- package/dist/test/screen-help.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/test/ox-doc.test.ts +0 -150
- package/test/screen-help.test.ts +0 -72
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-doc.js","sourceRoot":"","sources":["../../../src/components/ox-doc.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAgC,MAAM,KAAK,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC;;;;;;;;;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O,IAAI,CAAA,2BAA2B,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,CAAC,wDAAG,gBAAgB,CAAC,mCAAI,oBAAoB,UAAU,IAAI,CAAC,KAAK,eAAe,CAAA;QAC7J,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO;YAAE,OAAO,IAAI,CAAA,uCAAuC,CAAA;QAChF,OAAO,IAAI,CAAA,qBAAqB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAA;IAChE,CAAC;;AA/MM,YAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+HlB,AA/HY,CA+HZ;AAvN2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCAAW;AAEV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mCAAgB;AAEf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAa;AAEZ;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCAAY;AAEK;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAAgB;AAE1C;IAAhB,KAAK,EAAE;oCAAmB;AACV;IAAhB,KAAK,EAAE;sCAAiE;AAb9D,KAAK;IADjB,aAAa,CAAC,QAAQ,CAAC;GACX,KAAK,CA0SjB","sourcesContent":["import { LitElement, html, css, nothing, type TemplateResult } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'\nimport { i18next } from '@operato/i18n'\n\n/*\n * ox-doc — ox-markdown 의 \"리치 콘텐츠\" 짝(peer). 범용 리치 문서 렌더러.\n * 프레임워크 help 의 구조를 그대로 재사용: 콘텐츠 = 정적 파일(소스 아님), 로케일은 서버 라우터가 해석.\n * 호출부는 topic 하나만 준다 → /helps/{topic}.html 을 fetch, 서버가 {topic}.{locale}.html 로 리라이트\n * (다국어 링크 복잡함 제거). 리치 HTML 을 shadow DOM 에 렌더하고, 콘텐츠 속 범용 부품\n * (ox-figure/ox-stage-ladder/…)은 등록 커스텀 엘리먼트로 upgrade 되어 살아난다.\n *\n * 세 소비자: 풀도큐먼트(그대로) · 인라인 스폿(section 앵커 하나) · AI(원문 텍스트는 소비자가 파일에서 추출).\n *\n * Moved here from operato-plant, -twin, -warehouse and -figure, which each kept a copy (2026-10-10).\n * `ox-help-panel` reads the same /helps/{topic} path as markdown; whether help keeps two formats is open.\n */\n@customElement('ox-doc')\nexport class OxDoc extends LitElement {\n /** 토픽 경로(예: \"twin/concept\"). 서버가 로케일 파일로 해석. */\n @property({ type: String }) topic = ''\n /** 콘텐츠 베이스 경로(정적 파일 서빙 루트). 기본 프레임워크 help 규약. */\n @property({ type: String }) base = '/helps'\n /** 인라인 스폿용 — 지정 시 해당 #anchor 섹션만 노출(풀도큐먼트는 미지정). */\n @property({ type: String }) section = ''\n /** The section to scroll to once the whole document is drawn (the help page opened at the part a `?` showed). */\n @property({ type: String }) anchor = ''\n /** 인라인 컴팩트 모드(패널/오버레이용 여백 축소). */\n @property({ type: Boolean, reflect: true }) compact = false\n\n @state() private _html = ''\n @state() private _status: 'idle' | 'loading' | 'ready' | 'error' = 'idle'\n\n /*\n * 콘텐츠 내부 토픽 링크(data-topic=\"twin/routing\") 가로채 제자리 이동 — 앱 라우팅 무관, 자족적.\n *\n * 값에 앵커가 붙을 수 있다(`twin/standards-conformance#ours` = \"그 문서의 그 절\"). 앵커를 떼지 않으면\n * 그대로 파일 경로가 되어 `…-conformance#ours.html` 을 받아 오려 하고, 브라우저가 `#` 뒤를 잘라\n * 확장자 없는 주소를 요청한다 — **문서를 못 찾는다.** 실제로 세 링크가 그렇게 죽어 있었다.\n */\n private _onClick = (e: Event) => {\n const link = e.composedPath().find(el => el instanceof HTMLElement && el.hasAttribute('data-topic')) as HTMLElement | undefined\n if (!link) {\n const hashLink = e.composedPath().find(el => el instanceof HTMLAnchorElement && el.getAttribute('href')?.startsWith('#')) as HTMLAnchorElement | undefined\n const hash = hashLink?.getAttribute('href')?.slice(1)\n if (hash) {\n e.preventDefault()\n this._scrollToAnchor(decodeURIComponent(hash))\n }\n return\n }\n e.preventDefault()\n const raw = link.getAttribute('data-topic')\n if (!raw) return\n const [topic, hash] = raw.split('#')\n if (topic && topic !== this.topic) {\n this._pendingAnchor = hash || ''\n this.topic = topic\n // 스크롤 복귀는 호스트(스크롤 컨테이너 소유자)에 위임 — scrollIntoView 는 앱 전역을 밀어 헤더가 사라짐.\n this.dispatchEvent(new CustomEvent('ox-doc-topic', { detail: { topic, hash: hash || '' }, bubbles: true, composed: true }))\n } else if (hash) {\n this._scrollToAnchor(hash) // 같은 문서 안의 절로 — 문서를 다시 받아 오지 않는다\n }\n }\n\n /** 문서를 바꾸며 지정된 절 — 렌더가 끝난 뒤에 옮겨야 하므로 한 박자 미뤄 둔다. */\n private _pendingAnchor = ''\n /** 주소에 붙은 #절은 첫 문서를 그린 뒤 한 번만 적용한다. 이후 토픽 이동에 낡은 해시가 따라가지 않게 비운다. */\n private _initialAnchor = (() => {\n try { return location.hash ? decodeURIComponent(location.hash.slice(1)) : '' } catch { return '' }\n })()\n\n /*\n * 그 절로 옮긴다 — **가장 가까운 스크롤 조상만** 움직인다.\n *\n * `scrollIntoView` 를 쓰지 않는 이유: 앱 전역이 밀려 헤더가 사라진다(이 부품이 처음부터 피해 온 것).\n * shadow 경계를 넘어 host 로 거슬러 올라가며 실제로 스크롤하는 상자를 찾고, 그 상자의 스크롤만 옮긴다.\n */\n private _scrollToAnchor(id: string): void {\n const el = this.renderRoot?.querySelector?.(`#${CSS.escape(id)}`) as HTMLElement | null\n if (!el) return\n let cursor: any = this\n while (cursor) {\n const next = cursor.parentElement ?? cursor.getRootNode?.()?.host\n if (!next) break\n const st = getComputedStyle(next)\n if (/(auto|scroll)/.test(st.overflowY) && next.scrollHeight > next.clientHeight) {\n next.scrollTop += el.getBoundingClientRect().top - next.getBoundingClientRect().top - 12\n return\n }\n cursor = next\n }\n }\n private _onLangChange = () => {\n this._load()\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.addEventListener('click', this._onClick)\n i18next?.on?.('languageChanged', this._onLangChange)\n }\n disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('click', this._onClick)\n i18next?.off?.('languageChanged', this._onLangChange)\n }\n\n static styles = css`\n :host {\n /* 테마 토큰 해소 순서: 호스트 오버라이드(--ox-doc-*) → 앱 토큰(--ui-*) → 리터럴 최후 폴백.\n * 앱 안에서는 앱 테마를 그대로 따르고(모드 전환도 앱 설정에 종속), 앱 밖 단독 사용도 리터럴로 성립한다.\n * OS 취향(prefers-color-scheme)으로 모드를 뒤집지 않는다 — 앱 설정과 어긋나 문서만 다크가 되던 결함.\n *\n * 가운데 층이 한때 --ink / --panel / --line 이었다. 주석에는 「앱 팔레트」라고 적혀 있었지만\n * 그 이름을 정하는 곳이 **어디에도 없었다.** 그래서 앱 안에서도 늘 리터럴로 떨어졌고,\n * 다크에서 제목이 검은 글자로 남아 바탕에 묻혔다. 앱의 실제 이름은 --ui-* 다\n * (packages/shell/client/themes/ui-tokens.css). */\n --_ink: var(--ox-doc-ink, var(--ui-ink, #16202b)); --_muted: var(--ox-doc-muted, var(--ui-muted, #566573)); --_faint: var(--ox-doc-faint, var(--ui-faint, #8a99a6));\n --_line: var(--ox-doc-line, var(--ui-line, #dde4ea)); --_panel: var(--ox-doc-panel, var(--ui-panel, #fff)); --_ground: var(--ox-doc-ground, transparent);\n --_accent: var(--ox-doc-accent, var(--ui-accent, #0d8f86));\n /* 링크·강조 글자. 강조색을 본문색 쪽으로 당겨 **글자로 읽힐 만큼** 대비를 준다 —\n 라이트에서는 짙어지고 다크에서는 밝아진다. 한 식이 두 테마를 다 맡는다. */\n --_accent-deep: var(--ox-doc-accent-deep, color-mix(in oklab, var(--_accent), var(--_ink) 22%));\n --_accent-wash: var(--ox-doc-accent-wash, var(--ui-accent-wash, #e3f2f0));\n /*\n * 도판이 놓이는 **종이 면.** 테마를 따르지 않는다 — 따르면 안 된다.\n *\n * 그림의 잉크는 문서 파일 안에 박혀 있다(서른 편의 svg 안에 밝은 회색·짙은 남색이 1064곳).\n * 다크에서 그 아래에 어두운 면을 깔면 선과 글자가 바탕에 묻힌다. 그래서 도판만 밝은 종이\n * 위에 올린다 — 어두운 화면에 끼워 넣은 인쇄물처럼 읽힌다.\n *\n * 그림 자체가 테마를 따르게 하려면 서른 편의 svg 를 토큰으로 다시 그려야 한다. 그것은\n * 문서를 쓰는 쪽의 일이다.\n */\n --_paper: var(--ox-doc-paper, #fff);\n --_maxw: var(--ox-doc-maxw, 760px);\n --_sans: var(--ox-doc-sans, -apple-system, BlinkMacSystemFont, \"Apple SD Gothic Neo\", \"Pretendard\", \"Malgun Gothic\", \"Noto Sans KR\", system-ui, sans-serif);\n --_mono: var(--ox-doc-mono, \"SF Mono\", \"JetBrains Mono\", ui-monospace, Menlo, monospace);\n display: block; color: var(--_ink); background: var(--_ground);\n font-family: var(--_sans); line-height: 1.72; font-size: 16.5px;\n }\n /*\n * ── 문서가 쓰는 이름 ────────────────────────────────────────────────────\n * 문서(helps/*.html)는 자기 style 블록에서 --x-ink · --x-line · --x-panel · --x-wash ·\n * --x-accent 를 쓴다. 서른 편이 모두 그렇게 적어 두었는데 **그 이름을 정하는 곳이 없었다.**\n * 그래서 늘 리터럴(#fff · #cbd5dd)로 떨어졌고, 다크에서 문서 안의 카드와 표만 흰 조각으로\n * 남았다.\n *\n * 여기서 정한다. 문서를 한 줄도 고치지 않고 서른 편이 함께 테마를 따른다.\n */\n .body {\n --x-ink: var(--_ink);\n --x-muted: var(--_muted);\n --x-faint: var(--_faint);\n --x-line: var(--_line);\n --x-panel: var(--_panel);\n --x-wash: color-mix(in oklab, var(--_line), transparent 55%);\n --x-accent: var(--_accent);\n /* 글자로 쓰는 강조색. 순수 강조색은 12px 라벨에서 라이트 3.79 · 다크에서도 아슬아슬하다. */\n --x-accent-deep: var(--_accent-deep);\n }\n .body { max-width: var(--_maxw); margin: 0 auto; padding: var(--_pad, 10px 6px 48px); }\n /*\n * 한글 줄바꿈 — **낱글자 단위로 끊지 않는다.**\n *\n * 기본값은 한글을 어느 글자에서나 끊는다. 그래서 제목이 두 줄이 되면 \"시간이 지나 / 도\",\n * \"예측 시뮬레 / 이션은\" 처럼 어절 중간이 어긋났다(배우기 제목 중 두 줄로 넘어가는 11개 가운데\n * 9개가 그랬다). keep-all 은 띄어쓰기 자리에서만 끊으므로 어절이 살아남는다. 영문은 원래\n * 띄어쓰기로 끊으므로 달라지는 것이 없다.\n *\n * 끊을 자리가 없는 긴 토큰(URN·식별자)은 그대로 두면 문서 폭을 밀어내므로 overflow-wrap 으로 받는다.\n */\n .body { word-break: keep-all; overflow-wrap: break-word; }\n :host([compact]) .body { padding: 4px 2px 12px; font-size: 15px; }\n /* 렌더된 콘텐츠 타이포그래피(unsafeHTML 산출물 — shadow 내부 스코프). 견본 수준 스케일·리듬. */\n /*\n * 조판 예외: **읽는 문서의 눈금이다.** 화면 조판(--ui-t-*)은 관리 화면의 절 제목과 표를 위한\n * 다섯 단이라 긴 글에는 단이 모자라고, 좁은 화면에서 제목이 본문을 밀어내지 않도록 반응형이\n * 필요하다. 그래서 clamp 로 둔다.\n */\n .body h1 { font-size: clamp(28px, 4.6vw, 40px); font-weight: 820; letter-spacing: -.022em; line-height: 1.16; margin: 0 0 .55em; text-wrap: balance; }\n .body h2 { font-size: clamp(20px, 3.2vw, 26px); font-weight: 750; letter-spacing: -.017em; line-height: 1.25; margin: 2em 0 .55em; padding-top: 1em; border-top: 1px solid var(--_line); text-wrap: balance; }\n .body h2:first-of-type { border-top: 0; padding-top: 0; }\n .body h3 { font-size: 17px; font-weight: 680; margin: 1.4em 0 .35em; }\n .body p { margin: 0 0 1.05em; }\n .body h1 + p { font-size: 1.06em; color: var(--_muted); } /* 리드 문단(h1 바로 뒤) */\n /* 히어로 아이브로우 — 펄스 점 + mono 라벨 */\n .body .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-family: var(--_mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--_accent-deep); font-weight: 600; margin: 0 0 14px; }\n .body .eyebrow::before { content: \"\"; width: 7px; height: 7px; border-radius: 50%; background: var(--_accent); box-shadow: 0 0 0 0 var(--_accent); animation: oxpulse 2.6s infinite; }\n @keyframes oxpulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--_accent), transparent 40%); } 70% { box-shadow: 0 0 0 9px color-mix(in oklab, var(--_accent), transparent 100%); } 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--_accent), transparent 100%); } }\n @media (prefers-reduced-motion: reduce) { .body .eyebrow::before { animation: none; } }\n /* 섹션 키커 — 흐린 작은 라벨(제목 위). 섹션 구분선은 여기로 이동. */\n /* 절 이름이다 — 문서를 훑을 때 눈이 짚는 자리. --_faint 로는 다크에서 3.64 였다(§ th 의 머리말). */\n .body .kicker { font-family: var(--_mono); font-size: 12px; letter-spacing: .13em; text-transform: uppercase; color: var(--_muted); font-weight: 600; margin: 2.2em 0 0; padding-top: 1.1em; border-top: 1px solid var(--_line); }\n .body .kicker + h2 { margin: .35em 0 .55em; padding-top: 0; border-top: 0; }\n .body strong { font-weight: 700; }\n .body em { font-style: normal; color: var(--_accent-deep); font-weight: 600; }\n .body ul, .body ol { margin: 0 0 1.15em; padding-left: 1.35em; }\n .body li { margin: .38em 0; }\n .body ul li::marker { color: var(--_accent); }\n .body ol { counter-reset: oxol; list-style: none; padding-left: 0; }\n .body ol > li { counter-increment: oxol; position: relative; padding-left: 2.2em; }\n .body ol > li::before { content: counter(oxol); position: absolute; left: 0; top: .05em; width: 1.55em; height: 1.55em; border-radius: 8px; background: var(--_accent-wash); color: var(--_accent-deep); font-family: var(--_mono); font-weight: 700; font-size: .82em; display: grid; place-items: center; }\n .body a { color: var(--_accent-deep); text-underline-offset: 3px; cursor: pointer; }\n .body a[data-topic] { text-decoration: none; font-weight: 640; }\n .body a:hover { text-decoration: underline; }\n .body blockquote { margin: 1.4em 0; padding: 14px 18px; border: 1px solid color-mix(in oklab, var(--_accent), transparent 68%); background: var(--_accent-wash); border-radius: 11px; color: var(--_ink); display: flex; gap: 11px; }\n .body blockquote::before { content: \"▸\"; color: var(--_accent); font-weight: 700; }\n .body blockquote p { margin: 0; }\n .body code { font-family: var(--_mono); font-size: .86em; background: color-mix(in oklab, var(--_line), transparent 40%); padding: .12em .4em; border-radius: 5px; }\n /* 코드 블록 — 기술 개념 문서는 실물(이벤트·설정)을 보여줘야 이해된다. 없으면 예시를 그림으로\n 모의 내게 되고, 그림은 복사도 검색도 안 된다. 긴 줄은 가로 스크롤(문서 폭을 밀지 않는다). */\n .body pre { margin: 1.3em 0; padding: 15px 17px; background: var(--_panel); border: 1px solid var(--_line); border-radius: 11px; overflow-x: auto; font-family: var(--_mono); font-size: 12.5px; line-height: 1.62; color: var(--_ink); }\n .body pre code { background: none; padding: 0; font-size: inherit; }\n /* 표 = 패널 카드(견본 tiles 감) */\n /* 표는 자기 상자 안에서 가로로 스크롤한다(_wrapTables 가 감싼다) — 좁은 화면에서 본문 폭을 밀어내지 않게. */\n .body .tablewrap { overflow-x: auto; margin: 1.4em 0; }\n .body .tablewrap table { margin: 0; min-width: 100%; width: auto; }\n .body table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 14px; font-variant-numeric: tabular-nums; background: var(--_panel); border: 1px solid var(--_line); border-radius: 11px; overflow: hidden; }\n .body thead { background: color-mix(in oklab, var(--_line), transparent 55%); }\n .body th, .body td { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--_line); }\n .body tbody tr:last-child td { border-bottom: 0; }\n /*\n * 머리칸은 --_muted 다. --_faint 로 두었더니 채워진 머리행 위에서 대비가 2.8 로 떨어져\n * 열 이름이 안 읽혔다(10.5px 글자다). --_faint 는 바탕 위의 곁말에 쓰는 색이지, 면 위에\n * 올리는 라벨의 색이 아니다.\n */\n .body th { font-family: var(--_mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--_muted); font-weight: 600; }\n .body td:first-child { font-weight: 640; }\n .tablewrap { overflow-x: auto; }\n /* 도판 — 테마 패널 위에 올려 라이트/다크 모드와 자연스럽게 조화되도록 한다. */\n .body svg { display: block; max-width: 100%; box-sizing: border-box; background: var(--_panel); border: 1px solid var(--_line); border-radius: 10px; padding: 12px; }\n .status { color: var(--_muted); font-size: 14px; padding: 24px 4px; }\n .status.err { color: var(--ui-crit, #c0492f); }\n `\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('topic') || changed.has('base') || changed.has('section')) this._load()\n if (changed.has('anchor') && this.anchor) this._pendingAnchor = this.anchor\n /* 새 문서가 다 그려진 뒤에야 그 절로 옮길 수 있다 — 링크에 앵커가 있었으면 여기서 처리한다. */\n if (this._pendingAnchor && this._status === 'ready') {\n const id = this._pendingAnchor\n this._pendingAnchor = ''\n requestAnimationFrame(() => this._scrollToAnchor(id))\n }\n }\n\n private async _load() {\n if (!this.topic) { this._status = 'idle'; this._html = ''; return }\n this._status = 'loading'\n try {\n // 로케일은 서버 라우터가 해석(topic.html → topic.{locale}.html). 클라는 topic 만 안다.\n // 쿠키 우선순위로 인해 en-US가 고정되는 현상을 방지하기 위해 쿼리스트링(?lng=)을 함께 전달한다.\n const lang = i18next?.language ?? 'en'\n const res = await fetch(`${this.base}/${this.topic}.html?lng=${encodeURIComponent(lang)}`, {\n headers: { 'accept-language': lang }\n })\n if (!res.ok) throw new Error(`${res.status}`)\n let content = await res.text()\n if (this.section) content = this._sliceSection(content, this.section)\n this._html = this._wrapTables(content)\n if (!this._pendingAnchor && this._initialAnchor) {\n this._pendingAnchor = this._initialAnchor\n this._initialAnchor = ''\n }\n this._status = 'ready'\n } catch (e) {\n this._status = 'error'\n this._html = ''\n }\n }\n\n /*\n * 표를 가로 스크롤 상자로 감싼다 — **좁은 화면에서 표가 문서 폭을 밀어내지 않게.**\n *\n * 코드 블록(pre)은 이미 자기 안에서 가로로 스크롤한다. 표에는 그 장치가 없어서, 폭이 좁아지면\n * (휴대폰·분할 화면·인라인 도움말 팝업) 비교표가 본문 바깥으로 삐져나갔다. 표는 열 수가 정해져\n * 있어 글자만 줄여서는 들어가지 않으므로, 넘치는 쪽을 스크롤로 받는 것이 정공법이다.\n *\n * 문서(HTML)를 고치지 않고 렌더 시점에 감싸는 이유: 같은 파일을 세 소비자가 함께 쓴다. AI 는 태그를\n * 걷어낸 본문을 읽으므로 표시용 래퍼가 원문에 섞이면 그쪽까지 지저분해진다.\n */\n private _wrapTables(html: string): string {\n if (!html.includes('<table')) return html\n const tpl = document.createElement('template')\n tpl.innerHTML = html\n for (const table of Array.from(tpl.content.querySelectorAll('table'))) {\n if ((table.parentElement as HTMLElement | null)?.classList.contains('tablewrap')) continue\n const wrap = document.createElement('div')\n wrap.className = 'tablewrap'\n table.replaceWith(wrap)\n wrap.appendChild(table)\n }\n return tpl.innerHTML\n }\n\n /** 인라인 스폿 — id=section 인 heading 부터 다음 동급 heading 전까지만 추출(문맥 도움말용). */\n private _sliceSection(full: string, id: string): string {\n const tpl = document.createElement('template')\n tpl.innerHTML = full\n const anchor = tpl.content.querySelector(`#${CSS.escape(id)}`)\n if (!anchor) return full\n const level = anchor.tagName // H1..H3\n const frag: string[] = [(anchor as HTMLElement).outerHTML]\n let n = anchor.nextElementSibling\n while (n && !(/^H[1-6]$/.test(n.tagName) && n.tagName <= level)) { frag.push((n as HTMLElement).outerHTML); n = n.nextElementSibling }\n return frag.join('')\n }\n\n render(): TemplateResult | typeof nothing {\n if (this._status === 'loading') return html`<div class=\"status\">${i18next?.t?.('text.loading') ?? 'Loading…'}</div>`\n if (this._status === 'error') return html`<div class=\"status err\">${i18next?.t?.('text.not found') ?? 'Content not found.'} <code>${this.topic}</code></div>`\n if (this._status !== 'ready') return html`<div class=\"body\"><slot></slot></div>`\n return html`<div class=\"body\">${unsafeHTML(this._html)}</div>`\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap { 'ox-doc': OxDoc }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-figure.js","sourceRoot":"","sources":["../../../src/components/ox-figure.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAuB,MAAM,KAAK,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D;;;GAGG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,2CAA2C;QACf,YAAO,GAAG,EAAE,CAAA;QACxC,sBAAsB;QACO,aAAQ,GAAG,KAAK,CAAA;IA2B/C,CAAC;IARC,MAAM;QACJ,OAAO,IAAI,CAAA;;;UAGL,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA,eAAe,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,IAAI,CAAA,uDAAuD;;KAEhI,CAAA;IACH,CAAC;;AAxBM,eAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;GAelB,AAfY,CAeZ;AAnB2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAa;AAEX;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAiB;AAJlC,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA+BpB","sourcesContent":["import { LitElement, html, css, type TemplateResult } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n/*\n * ox-figure — 범용 그림/다이어그램 컨테이너(도메인 무관). 리치 문서의 시각물을 감싸고 캡션을 붙인다.\n * 콘텐츠(SVG/img/커스텀 시각물)는 slot 으로 받으므로, 컴포넌트 미등록 시에도 그대로 노출(폴백 안전).\n */\n@customElement('ox-figure')\nexport class OxFigure extends LitElement {\n /** 캡션(선택). slot=\"caption\" 으로 리치 캡션도 가능. */\n @property({ type: String }) caption = ''\n /** 강조 테두리(핵심 시각물). */\n @property({ type: Boolean }) featured = false\n\n static styles = css`\n :host {\n /* 해소 순서: 호스트 오버라이드 → 앱 팔레트 → 리터럴(ox-doc 와 동일 규약). */\n --_line: var(--ox-doc-line, var(--ui-line, #dde4ea)); --_panel: var(--ox-doc-panel, var(--ui-panel, #fff)); --_muted: var(--ox-doc-muted, var(--ui-muted, #566573));\n --_accent: var(--ox-doc-accent, var(--ui-accent, #0d8f86));\n --_mono: var(--ox-doc-mono, \"SF Mono\", ui-monospace, Menlo, monospace);\n display: block; margin: 20px 0;\n }\n figure { margin: 0; background: var(--_panel); border: 1px solid var(--_line); border-radius: 14px; padding: 20px; }\n :host([featured]) figure { border-color: color-mix(in oklab, var(--_accent), var(--_line) 55%); box-shadow: 0 8px 30px rgba(22,32,43,.06); }\n .slot { display: block; }\n /* 도판은 종이 위에 — 그림의 잉크가 파일 안에 박혀 있어 어두운 면 위에서는 묻힌다(ox-doc 의 --_paper). */\n ::slotted(svg), ::slotted(img) { display: block; width: 100%; height: auto; box-sizing: border-box; background: var(--ox-doc-paper, #fff); border-radius: 8px; }\n /* 캡션은 그림이 무엇인지 말하는 유일한 글자다 — 곁말이 아니라 읽히는 값으로 둔다. */\n figcaption { margin-top: 12px; text-align: center; font-family: var(--_mono); font-size: 12.5px; color: var(--_muted); letter-spacing: .02em; line-height: 1.5; }\n `\n\n render(): TemplateResult {\n return html`\n <figure>\n <div class=\"slot\"><slot></slot></div>\n ${this.caption ? html`<figcaption>${this.caption}</figcaption>` : html`<figcaption><slot name=\"caption\"></slot></figcaption>`}\n </figure>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap { 'ox-figure': OxFigure }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-help-icon.js","sourceRoot":"","sources":["../../../src/components/ox-help-icon.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGzC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAmBL,YAAO,GAAG,CAAC,CAAQ,EAAE,EAAE;YACrB,CAAC,CAAC,eAAe,EAAE,CAAA;YAEnB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC,CAAA;QAED,kBAAa,GAAgE,CAAC,CAAQ,EAAE,EAAE;YACxF,CAAC,CAAC,eAAe,EAAE,CAAA;QACrB,CAAC,CAAA;QAED,gBAAW,GAAgE,CAAC,CAAQ,EAAE,EAAE;YACtF,CAAC,CAAC,eAAe,EAAE,CAAA;QACrB,CAAC,CAAA;IAOH,CAAC;IALC,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QAExB,OAAO,IAAI,CAAA,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAA,EAAE,EAAE,CAAA;IAChE,CAAC;;AApCM,eAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;GAclB,AAdY,CAcZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAe;AAjB/B,QAAQ;IADpB,aAAa,CAAC,cAAc,CAAC;GACjB,QAAQ,CAsCpB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { openHelp } from '../controller/help.js'\n\n@customElement('ox-help-icon')\nexport class HelpIcon extends LitElement {\n static styles = css`\n md-icon {\n cursor: help;\n opacity: var(--help-icon-opacity);\n color: var(--help-icon-color);\n vertical-align: middle;\n\n --md-icon-size: var(--help-icon-size);\n\n &:hover {\n opacity: var(--help-icon-hover-opacity);\n color: var(--help-icon-hover-color);\n }\n }\n `\n\n @property({ type: String }) topic!: string\n\n onclick = (e: Event) => {\n e.stopPropagation()\n\n openHelp(this.topic)\n }\n\n onpointerdown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null = (e: Event) => {\n e.stopPropagation()\n }\n\n onpointerup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null = (e: Event) => {\n e.stopPropagation()\n }\n\n render() {\n const topic = this.topic\n\n return html`${topic ? html`<md-icon>help</md-icon>` : html``}`\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-help-spot.js","sourceRoot":"","sources":["../../../src/components/ox-help-spot.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAA;AAC9F,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAExD;;;;;;;;GAQG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACuB,UAAK,GAAG,EAAE,CAAA;QACV,YAAO,GAAG,EAAE,CAAA;QACZ,UAAK,GAAG,EAAE,CAAA;QACtC;;;;WAIG;QACc,YAAO,GAAG,KAAK,CAAA;QAYhC,2GAA2G;QAC1F,SAAI,GAAG,CAAC,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AAC,EAAE,OAAO,CAAC,CAAA;QACxE,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YACrD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;YACtB,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,OAAO,CAAA;QACjC,OAAO,IAAI,CAAA;;cAED,IAAI,CAAC,KAAK,IAAI,MAAM;mBACf,IAAI,CAAC,KAAK,IAAI,MAAM;eACxB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;qBACpB,IAAI,CAAC,IAAI;mBACX,IAAI,CAAC,IAAI;mBACT,IAAI,CAAC,IAAI;gBACZ,CAAA;IACd,CAAC;;AA5DM,iBAAM,GAAG,GAAG,CAAA;;;;;;;;GAQlB,AARY,CAQZ;AAlB2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAa;AACZ;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAW;AAMrB;IAAhB,KAAK,EAAE;2CAAwB;AATrB,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CAwEtB","sourcesContent":["import { LitElement, html, css, nothing, type PropertyValues, type TemplateResult } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { i18next } from '@operato/i18n'\nimport { openHelp } from '../controller/help.js'\nimport { documentOf, holds } from '../help-documents.js'\n\n/*\n * ox-help-spot — 인라인 문맥 도움말(C). 운영 화면 어디서든 `?` 하나로 관련 개념을 연다.\n * 사용: <ox-help-spot topic=\"twin/concept\" section=\"entities\"></ox-help-spot>\n *\n * It opens the help overlay (`openHelp`) on that section — the app's one help surface, drawn on the overlay layer.\n * The spot draws nothing but the `?`: a panel of its own sat inside whatever holds the `?` (a card button, a grid\n * header), so it took that parent's pointer and text settings and handed its scrolling and presses back to it.\n * The overlay's 「open in new」 takes the whole document to the help page.\n */\n@customElement('ox-help-spot')\nexport class OxHelpSpot extends LitElement {\n @property({ type: String }) topic = ''\n @property({ type: String }) section = ''\n @property({ type: String }) label = ''\n /*\n * Whether there is anything to open. A `?` is placed where the concept is first read, often before\n * anyone has written its help; until then it stays out of sight. Without this the button opened\n * 「Content not found」, and a missing section opened the whole document instead of the part asked for.\n */\n @state() private written = false\n\n static styles = css`\n :host([hidden]) { display: none; }\n /* 중심 정렬은 담는 쪽 책임 — 제목 행을 flex(align-items:center)로 잡아 광학 중심에 맞춘다.\n inline 으로 쓰일 때의 기본 정렬만 여기서 vertical-align:middle 로 둔다. */\n :host { display: inline-flex; align-items: center; vertical-align: middle; --_accent: var(--ox-doc-accent, var(--ui-accent, #0d8f86)); }\n button.q { width: 17px; height: 17px; border-radius: 50%; border: 1px solid color-mix(in oklab, var(--_accent), transparent 45%); background: color-mix(in oklab, var(--_accent), transparent 88%); color: var(--_accent); font: 600 11px/1 var(--ox-doc-sans, sans-serif); cursor: help; padding: 0; }\n button.q:hover { background: color-mix(in oklab, var(--_accent), transparent 75%); }\n :focus-visible { outline: 2px solid var(--_accent); outline-offset: 2px; }\n `\n\n /* The `?` is not a press of what holds it - a card that filters, a header that sorts (as ox-help-icon). */\n private readonly keep = (e: Event) => e.stopPropagation()\n\n private show(e: Event) {\n e.stopPropagation()\n e.preventDefault()\n openHelp(this.topic, this.section)\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n this.toggleAttribute('hidden', !this.written)\n i18next?.on?.('languageChanged', this.onLanguageChanged)\n }\n\n disconnectedCallback(): void {\n i18next?.off?.('languageChanged', this.onLanguageChanged)\n super.disconnectedCallback()\n }\n\n protected willUpdate(changed: PropertyValues<this>): void {\n if (changed.has('topic') || changed.has('section')) {\n this.check()\n }\n }\n\n /* Another language is another file, which may not be written yet. */\n private readonly onLanguageChanged = () => this.check()\n\n private async check(): Promise<void> {\n const { topic, section } = this\n const lang = i18next?.language ?? 'en'\n const written = !!topic && holds(await documentOf(topic, lang), section)\n if (topic === this.topic && section === this.section) {\n this.written = written\n this.toggleAttribute('hidden', !written)\n }\n }\n\n render(): TemplateResult | typeof nothing {\n if (!this.written) return nothing\n return html`<button\n class=\"q\"\n title=${this.label || 'help'}\n aria-label=${this.label || 'help'}\n @click=${(e: Event) => this.show(e)}\n @pointerdown=${this.keep}\n @pointerup=${this.keep}\n @mousedown=${this.keep}\n >?</button>`\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap { 'ox-help-spot': OxHelpSpot }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-inline-help.js","sourceRoot":"","sources":["../../../src/components/ox-inline-help.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGzC,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAWxC,MAAM;QACJ,OAAO,IAAI,CAAA,iBAAiB,CAAA;IAC9B,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE;YACrD,CAAC,CAAC,eAAe,EAAE,CAAA;YACnB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC,CAAC,CAAA;IACJ,CAAC;;AArBM,iBAAM,GAAG,GAAG,CAAA;;;;;GAKlB,AALY,CAKZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAc;AAT9B,UAAU;IADtB,aAAa,CAAC,gBAAgB,CAAC;GACnB,UAAU,CAuBtB","sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { openHelp } from '../controller/help.js'\n\n@customElement('ox-inline-help')\nexport class InlineHelp extends LitElement {\n static styles = css`\n :host {\n display: flex;\n align-items: center;\n }\n `\n\n @property({ type: String }) topic!: string\n @property({ type: String }) type!: string\n\n render() {\n return html` <slot></slot> `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.renderRoot.addEventListener('click', (e: Event) => {\n e.stopPropagation()\n openHelp(this.topic)\n })\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-stage-ladder.js","sourceRoot":"","sources":["../../../src/components/ox-stage-ladder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAuB,MAAM,KAAK,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAe3D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACL,2CAA2C;QACd,cAAS,GAAG,KAAK,CAAA;QAC7B,WAAM,GAAW,EAAE,CAAA;IAkDtC,CAAC;IAtBC,YAAY;QACV,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAkB,CAAA;QAC/E,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAC7B,IAAI,EAAE,CAAC,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YACnC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;YAC7B,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;SAC9B,CAAC,CAAC,CAAA;QACH,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;IAC9D,CAAC;IAED,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;QAChC,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACzB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YAC9C,OAAO,IAAI,CAAA,kBAAkB,CAAC,CAAC,KAAK,oBAAoB,GAAG,4BAA4B,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,uBAAuB,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA,eAAe,OAAO,CAAA;QAC3L,CAAC,CAAC;;;KAGL,CAAA;IACH,CAAC;;AA/CM,oBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBlB,AAxBY,CAwBZ;AA3B4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AAC7B;IAAhB,KAAK,EAAE;6CAA4B;AAHzB,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAqDzB","sourcesContent":["import { LitElement, html, css, type TemplateResult } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\n/*\n * ox-stage-ladder — 범용 \"단계 스케일\"(성숙도·레벨·진행 등, 도메인 무관).\n * 콘텐츠는 <li> 자식으로 저작: 텍스트 + data-state(done|now|next|future) + data-badge(선택 라벨).\n * 미등록 시 그냥 목록으로 노출(폴백/AI 안전). 등록 시 자식을 읽어 shadow 에 리치 사다리로 렌더.\n * 예:\n * <ox-stage-ladder>\n * <li data-state=\"now\" data-badge=\"지금\">기술 — 지금 무슨 일?</li>\n * <li data-state=\"next\" data-badge=\"진입\">처방 — 무엇을 해야?</li>\n * </ox-stage-ladder>\n */\ntype Rung = { text: string; state: string; badge: string }\n\n@customElement('ox-stage-ladder')\nexport class OxStageLadder extends LitElement {\n /** 오름차순 표시(위로 갈수록 높은 단계). 기본 저작 순서 그대로. */\n @property({ type: Boolean }) ascending = false\n @state() private _rungs: Rung[] = []\n\n static styles = css`\n :host {\n /* 해소 순서: 호스트 오버라이드 → 앱 팔레트 → 리터럴(ox-doc 와 동일 규약). */\n --_ink: var(--ox-doc-ink, var(--ui-ink, #16202b)); --_muted: var(--ox-doc-muted, var(--ui-muted, #566573)); --_faint: var(--ox-doc-faint, var(--ui-faint, #8a99a6));\n --_line: var(--ox-doc-line, var(--ui-line, #dde4ea)); --_panel: var(--ox-doc-panel, var(--ui-panel, #fff));\n --_accent: var(--ox-doc-accent, var(--ui-accent, #0d8f86));\n --_accent-deep: var(--ox-doc-accent-deep, color-mix(in oklab, var(--_accent), var(--_ink) 22%));\n --_accent-wash: var(--ox-doc-accent-wash, var(--ui-accent-wash, #e3f2f0));\n --_amber: var(--ox-doc-amber, var(--ui-warn, #c07f14));\n --_amber-wash: var(--ox-doc-amber-wash, color-mix(in srgb, var(--ui-warn, #c07f14) 16%, transparent));\n --_mono: var(--ox-doc-mono, \"SF Mono\", ui-monospace, Menlo, monospace);\n display: block; margin: 20px 0;\n }\n ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }\n li { display: grid; grid-template-columns: 30px 1fr auto; gap: 13px; align-items: center; background: var(--_panel); border: 1px solid var(--_line); border-radius: 11px; padding: 12px 15px; }\n .n { font-family: var(--_mono); font-weight: 700; color: var(--_muted); font-size: 15px; text-align: center; }\n .txt { font-size: 15px; color: var(--_ink); }\n .badge { font-family: var(--_mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; background: var(--_line); color: var(--_muted); white-space: nowrap; }\n li[data-state=\"done\"], li[data-state=\"now\"] { border-color: color-mix(in oklab, var(--_accent), var(--_line) 45%); background: color-mix(in oklab, var(--_accent-wash), var(--_panel) 45%); }\n li[data-state=\"done\"] .n, li[data-state=\"now\"] .n { color: var(--_accent); }\n /* 강조색 위에 올리는 글자는 짝 토큰을 쓴다 — 다크의 밝은 초록 위에서 흰 글자는 대비 2.24 로 안 읽힌다. */\n li[data-state=\"now\"] .badge { background: var(--_accent); color: var(--ui-on-accent, #fff); }\n li[data-state=\"next\"] .badge { background: var(--_amber-wash); color: var(--_amber); border: 1px solid color-mix(in oklab, var(--_amber), transparent 65%); }\n .fallback { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }\n `\n\n firstUpdated() {\n const items = Array.from(this.querySelectorAll(':scope > li')) as HTMLElement[]\n this._rungs = items.map(li => ({\n text: (li.textContent || '').trim(),\n state: li.dataset.state || '',\n badge: li.dataset.badge || ''\n }))\n if (this.ascending) this._rungs = [...this._rungs].reverse()\n }\n\n render(): TemplateResult {\n const total = this._rungs.length\n return html`\n <ul>\n ${this._rungs.map((r, i) => {\n const idx = this.ascending ? total - i : i + 1\n return html`<li data-state=${r.state}><span class=\"n\">${idx}</span><span class=\"txt\">${r.text}</span>${r.badge ? html`<span class=\"badge\">${r.badge}</span>` : html`<span></span>`}</li>`\n })}\n </ul>\n <div class=\"fallback\" aria-hidden=\"true\"><slot></slot></div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap { 'ox-stage-ladder': OxStageLadder }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-title-with-help.js","sourceRoot":"","sources":["../../../src/components/ox-title-with-help.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGzC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IA6B9D,MAAM;QACJ,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QAExB,OAAO,IAAI,CAAA,UAAU,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,mBAAmB,IAAI,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAA,EAAE,UAAU,CAAA;IAC/G,CAAC;IAED,OAAO,CAAC,CAAa;QACnB,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC;;AAtCM,oBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBlB,AAvBY,CAuBZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAe;AA3B/B,aAAa;IADzB,aAAa,CAAC,oBAAoB,CAAC;GACvB,aAAa,CAwCzB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\n\nimport { openHelp } from '../controller/help.js'\n\n@customElement('ox-title-with-help')\nexport class TitleWithHelp extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: inline-block;\n }\n\n span {\n display: flex;\n align-items: center;\n }\n\n md-icon {\n cursor: help;\n opacity: var(--help-icon-opacity);\n color: var(--help-icon-color);\n vertical-align: middle;\n\n --md-icon-size: var(--help-icon-size);\n\n &:hover {\n opacity: var(--help-icon-hover-opacity);\n color: var(--help-icon-hover-color);\n }\n }\n `\n\n @property({ type: String }) msgid!: string\n @property({ type: String }) topic!: string\n\n render() {\n const title = i18next.t(this.msgid)\n const topic = this.topic\n\n return html` <span>${title} ${topic ? html`<md-icon @click=${this.onClick}>help</md-icon>` : html``}</span> `\n }\n\n onClick(e: MouseEvent) {\n e.stopPropagation()\n openHelp(this.topic)\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../../src/controller/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE3D,gHAAgH;AAChH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC5B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAA;AAC1G,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,OAAO,GAAG,EAAE;IAClD,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;IAC9B,WAAW,CAAC,MAAM,EAAE;QAClB,kBAAkB,EAAE;YAClB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO,EAAE,OAAO,IAAI,KAAK,CAAC,OAAO;SAClC;KACF,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,YAAY,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC","sourcesContent":["import { closeOverlay, openOverlay } from '@operato/layout'\n\n/** `office/guide#leave` → the topic and the section after `#`. A screen names its part of the help this way. */\nexport function splitHelp(help: string): { topic: string; section: string } {\n const at = help.indexOf('#')\n return at < 0 ? { topic: help, section: '' } : { topic: help.slice(0, at), section: help.slice(at + 1) }\n}\n\n/**\n * Opens the help overlay on a topic — and, from a `?`, on the one section of it the reader asked about. Its\n * 「open in new」 takes the whole document to the help page, at that section. A topic written `topic#section` names both.\n */\nexport function openHelp(topic: string, section = '') {\n const named = splitHelp(topic)\n openOverlay('help', {\n templateProperties: {\n topic: named.topic,\n section: section || named.section\n }\n })\n}\n\nexport function closeHelp() {\n closeOverlay('help')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"screen-help.js","sourceRoot":"","sources":["../../../src/controller/screen-help.ts"],"names":[],"mappings":"AA6BA,IAAI,MAAoC,CAAA;AACxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsC,CAAA;AAE3D,MAAM,UAAU,mBAAmB,CAAC,IAAkC;IACpE,MAAM,GAAG,IAAI,CAAA;IACb,KAAK,CAAC,KAAK,EAAE,CAAA;AACf,CAAC;AAED,6GAA6G;AAC7G,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAa;;IAC9C,IAAI,CAAC,MAAM,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,EAAE,CAAA;QAAE,OAAO,IAAI,CAAA;IAC1C,MAAM,IAAI,GAAG,CAAA,MAAA,MAAM,CAAC,QAAQ,s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I,CAAA;gBAChB,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAA;YACnC,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACjG,CAAC;CACF","sourcesContent":["import { ReactiveController, ReactiveControllerHost } from 'lit'\n\n/*\n * The part of the help a screen's `?` opens, found rather than declared (ADR-0181). A screen that names its help\n * (`context.help`) keeps it; one that does not is looked up by its own name in the application's help index\n * (/helps/search, @things-factory/help) — so no one keeps a list of which screen goes with which part.\n *\n * An application turns this on (`configureScreenHelp`) and says which documents are its own (`scope`) and who is reading\n * (`audience`): the same screen opens the part of that reader's work. Until then nothing is asked and nothing changes.\n */\nexport interface ScreenHelpConfig {\n /** Only topics under this path (`office`). */\n scope?: string\n /** Who reads (`finance`) — a document written for them (`office/guide-finance`) weighs more. */\n audience?: () => string | undefined | Promise<string | undefined>\n /**\n * The share of the screen name's words a part must hold, 0-1. A screen's name is short and every word of it matters,\n * so stricter than a question: a part that holds less is not about this screen, and the `?` stays hidden.\n */\n coverage?: number\n /** The reader's language - the application's i18next language. Left out, the page's. */\n language?: () => string | undefined\n}\n\nexport interface ScreenHelp {\n topic: string\n section: string\n}\n\nlet config: ScreenHelpConfig | undefined\nconst found = new Map<string, Promise<ScreenHelp | null>>()\n\nexport function configureScreenHelp(next: ScreenHelpConfig | undefined) {\n config = next\n found.clear()\n}\n\n/** The part the help index finds for a screen's name, or null — asked once per name, reader and language. */\nexport async function screenHelpOf(title: string): Promise<ScreenHelp | null> {\n if (!config || !title?.trim()) return null\n const lang = config.language?.() || document.documentElement.lang || navigator.language || 'en'\n const audience = (await config.audience?.()) || ''\n const key = `${lang}|${audience}|${title}`\n if (!found.has(key)) {\n const query = new URLSearchParams({ q: title, limit: '1', coverage: String(config.coverage ?? 0.75) })\n config.scope && query.set('scope', config.scope)\n audience && query.set('audience', audience)\n query.set('lng', lang)\n found.set(\n key,\n fetch(`/helps/search?${query}`, { headers: { 'accept-language': lang } })\n .then(res => (res.ok ? res.json() : []))\n .then((hits: ScreenHelp[]) => (hits?.[0] ? { topic: hits[0].topic, section: hits[0].section || '' } : null))\n .catch(() => null)\n )\n }\n return found.get(key)!\n}\n\n/**\n * A title bar's `?` for the open screen: the screen's own `context.help`, else the part found for its name. The bar asks\n * on every render; an answer that arrives later draws it again.\n */\nexport class ScreenHelpController implements ReactiveController {\n private title = ''\n private help: ScreenHelp | null = null\n\n constructor(private host: ReactiveControllerHost) {\n host.addController(this)\n }\n\n hostConnected() {}\n\n /** `topic#section` for the `?`, or '' when the screen has none. */\n of(context: { help?: string; title?: string | { text?: string } } | undefined): string {\n if (context?.help) return context.help\n const title = typeof context?.title === 'object' ? context.title?.text ?? '' : context?.title ?? ''\n if (!config || !title) return ''\n if (title !== this.title) {\n this.title = title\n this.help = null\n screenHelpOf(title).then(help => {\n if (title !== this.title) return\n this.help = help\n help && this.host.requestUpdate()\n })\n }\n return this.help ? `${this.help.topic}${this.help.section ? `#${this.help.section}` : ''}` : ''\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help-decorated-renderer.js","sourceRoot":"","sources":["../../../src/grist/help-decorated-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAQ1B,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,CAAA,yCAAyC,KAAK,sBAAsB,CAAA;AAErH,MAAM,CAAC,MAAM,qBAAqB,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAC7F,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAA4B,CAAA;IACrD,MAAM,IAAI,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;IAE7C,MAAM,KAAK,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;IAClE,OAAO,IAAI,CAAA,SAAS,IAAI,gBAAgB,KAAK,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;AACjF,CAAC,CAAA","sourcesContent":["import '../components/ox-help-icon.js'\n\nimport { html } from 'lit'\n\nimport { ColumnConfig, FieldRenderer, GristRecord } from '@operato/data-grist'\n\ninterface HelpExtendedRecord extends GristRecord {\n help?: (value: any, column: ColumnConfig, record: GristRecord, rowIndex: number, owner: any) => string\n}\n\nconst decoratorTemplate = (topic: string) => html`<ox-help-icon style=\"flex: 0;\" .topic=${topic}>help</ox-help-icon>`\n\nexport const HelpDecoratedRenderer: FieldRenderer = (value, column, record, rowIndex, field) => {\n const { help } = column?.record as HelpExtendedRecord\n const text = value === undefined ? '' : value\n\n const topic = help && help(value, column, record, rowIndex, field)\n return html`<span>${text}</span> ${topic ? decoratorTemplate(topic) : ''}`\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help-documents.js","sourceRoot":"","sources":["../../src/help-documents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkC,CAAA;AAE3D,2GAA2G;AAC3G,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,IAAY;IACpD,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,KAAK,EAAE,CAAA;IAC9B,IAAI,CAAC,SA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er the `?`, the help overlay and the help page\n * share. A topic is written as /helps/{topic}.html (ox-doc) or, in the older form, /helps/{topic}.md (ox-markdown).\n */\nconst documents = new Map<string, Promise<string | null>>()\n\n/** /helps/{topic}.html in a language, or null when there is none. Many spots on a page share one topic. */\nexport function documentOf(topic: string, lang: string): Promise<string | null> {\n const key = `${lang}:${topic}`\n if (!documents.has(key)) {\n documents.set(\n key,\n fetch(`/helps/${topic}.html?lng=${encodeURIComponent(lang)}`, { headers: { 'accept-language': lang } })\n .then(res => (res.ok ? res.text() : null))\n .catch(() => null)\n )\n }\n return documents.get(key)!\n}\n\n/** The document is written, and so is the section when one is named. */\nexport function holds(content: string | null, section: string): boolean {\n if (!content?.trim()) return false\n if (!section) return true\n const tpl = document.createElement('template')\n tpl.innerHTML = content\n return !!tpl.content.querySelector(`#${CSS.escape(section)}`)\n}\n\n/** How a topic is written: `html` when /helps/{topic}.html exists, else the markdown the help page always read. */\nexport async function helpFormatOf(topic: string, lang: string): Promise<'html' | 'md'> {\n return (await documentOf(topic, lang))?.trim() ? 'html' : 'md'\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help-style.js","sourceRoot":"","sources":["../../src/help-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwH3B,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const HelpStyle = css`\n h1 {\n background-color: var(--help-panel-title-background-color);\n margin: var(--help-panel-title-margin);\n padding: var(--help-panel-title-padding);\n font-size: var(--help-panel-h1-title-font-size);\n text-transform: capitalize;\n color: var(--help-panel-h1-title-color);\n }\n h2 {\n margin: var(--help-panel-title-margin);\n padding: var(--help-panel-title-padding);\n font-size: var(--help-panel-h2-title-font-size);\n color: var(--help-panel-h2-title-color);\n text-transform: capitalize;\n }\n h3 {\n margin: var(--help-panel-title-margin);\n padding: var(--help-panel-title-padding);\n font-size: var(--help-panel-h3-title-font-size);\n color: var(--help-panel-h3-title-color);\n }\n md-icon {\n vertical-align: middle;\n }\n\n img {\n display: block;\n margin: var(--spacing-small) var(--spacing-medium);\n max-width: 100%;\n }\n img[src*='#icon25'] {\n width: 25px;\n height: 25px;\n }\n img[src*='#icon50'] {\n width: 50px;\n height: 50px;\n }\n img[src*='#icon100'] {\n width: 100px;\n height: 100px;\n }\n img[src*='#icon25inlined'],\n img[src*='#icon50inlined'],\n img[src*='#icon100inlined'] {\n display: inline-block;\n margin: var(--spacing-small);\n }\n p {\n margin: var(--help-panel-paragraph-margin);\n font-size: var(--help-panel-font-size);\n }\n [focusBox] {\n display: block;\n padding: var(--help-panel-focusBox-padding);\n border: var(--help-panel-focusBox-border);\n border-radius: var(--help-panel-focusBox-border-radius);\n background-color: var(--help-panel-focusBox-background-color);\n color: var(--help-panel-focusBox-color);\n }\n\n [subtitle] {\n font-weight: bold;\n }\n [subtitle]::before {\n content: '';\n width: 7px;\n height: 7px;\n display: inline-block;\n border: 3px solid var(--md-sys-color-surface);\n border-radius: 50%;\n margin-right: var(--spacing-small);\n }\n p + ol,\n p + ul {\n font-size: var(--help-panel-content-font-size);\n }\n ol,\n ul {\n padding: 0 0 0 30px;\n }\n ol li,\n ul li {\n margin: 0 0 2px 0;\n }\n a {\n margin-bottom: 0 !important;\n color: var(--help-panel-a-color);\n font-size: var(--fontsize-default);\n text-decoration: underline;\n }\n a md-icon {\n margin: 0;\n\n --md-icon-size: var(--help-panel-a-icon-size);\n }\n a:hover {\n background-color: var(--opacity-light-dark-color);\n font-weight: bold;\n }\n\n table {\n border-collapse: collapse;\n border: var(--border-dim-color);\n font-size: 0.9em;\n }\n th {\n border-top: 3px solid var(--md-sys-color-on-primary-container);\n background-color: var(--md-sys-color-background);\n color: var(--md-sys-color-on-secondary-container);\n }\n th,\n td {\n border-bottom: var(--border-dim-color);\n padding: var(--spacing-small);\n }\n tr:nth-child(even) {\n background-color: #f6f6f6;\n }\n`\n"]}
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oCAAoC,CAAA;AAClD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,8BAA8B,CAAA","sourcesContent":["export * from './controller/help.js'\nexport * from './controller/screen-help.js'\nexport * from './grist/help-decorated-renderer.js'\nexport * from './components/ox-inline-help.js'\nexport * from './components/ox-title-with-help.js'\nexport * from './components/ox-help-icon.js'\nexport * from './components/ox-doc.js'\nexport * from './components/ox-figure.js'\nexport * from './components/ox-stage-ladder.js'\nexport * from './components/ox-help-spot.js'\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-help-home.js","sourceRoot":"","sources":["../../../src/pages/ox-help-home.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yBAAyB,CAAA;AAEhC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,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I,CAAC,MAAM,GAAG,SAAS,CAAA;YACvB,IAAI,KAAK;gBAAE,YAAY,CAAC,KAAK,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,mCAAI,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAA;QAC1H,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAQ;QACd,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAA;QAE1B,CAAC,CAAC,eAAe,EAAE,CAAA;IACrB,CAAC;;AAnIM,eAAM,GAAG;IACd,eAAe;IACf,cAAc;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+CF;CACF,AAnDY,CAmDZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAe;AAEd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAqB;AACnB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAA6B;AAEhD;IAAR,KAAK,EAAE;wCAAuB;AAEZ;IAAlB,KAAK,CAAC,UAAU,CAAC;yCAAsB;AAClB;IAArB,KAAK,CAAC,aAAa,CAAC;4CAAyB;AA9D1C,QAAQ;IADb,aAAa,CAAC,cAAc,CAAC;GACxB,QAAQ,CAqIb","sourcesContent":["import '@material/web/icon/icon.js'\nimport '../components/ox-doc.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport Headroom from '@operato/headroom'\nimport { i18next, localize } from '@operato/i18n'\nimport { navigate, PageView } from '@operato/shell'\nimport { HeadroomStyles, ScrollbarStyles } from '@operato/styles'\nimport { helpFormatOf } from '../help-documents.js'\n\n@customElement('ox-help-home')\nclass HelpHome extends localize(i18next)(PageView) {\n static styles = [\n ScrollbarStyles,\n HeadroomStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n position: relative;\n\n --md-icon-size: 24px;\n }\n\n #navigation {\n position: absolute;\n display: flex;\n width: 100%;\n padding: var(--help-navigation-padding);\n border-bottom: var(--help-navigation-bottom);\n background-color: var(--md-sys-color-surface);\n }\n\n #navigation md-icon {\n padding: var(--help-navigation-icon-padding, var(--padding-default));\n border-right: var(--help-navigation-icon-border);\n cursor: pointer;\n color: var(--help-icon-color);\n }\n\n #content {\n flex: 1;\n\n overflow: auto;\n padding: var(--help-panel-content-padding);\n margin: var(--help-panel-margin);\n }\n\n #upward {\n --md-icon-size: 26px;\n position: absolute;\n bottom: var(--data-list-fab-position-vertical);\n right: var(--data-list-fab-position-horizontal);\n background-color: rgba(255, 255, 255, 0.7);\n border-radius: 20px;\n color: var(--data-list-fab-color);\n box-shadow: var(--data-list-fab-shadow);\n padding: 7px;\n\n scroll-padding-top: 65px;\n }\n `\n ]\n\n @property({ type: String }) topic!: string\n /** The section to open at - the part a `?` showed in the help overlay. */\n @property({ type: String }) section: string = ''\n @property({ type: Boolean }) showGotoTop: boolean = false\n /** How the topic is written (`helpFormatOf`): an html document or the markdown this page always read. */\n @state() format?: 'html' | 'md'\n\n @query('#content') content!: HTMLElement\n @query('#navigation') navigation!: HTMLElement\n\n get context() {\n return {\n title: i18next.t('text.help')\n }\n }\n\n render() {\n const src = this.topic && `/helps/${this.topic || 'index'}.md`\n\n return html`\n <div id=\"content\">\n ${this.format === 'html'\n ? html`<ox-doc topic=${this.topic} anchor=${this.section}></ox-doc>`\n : this.format === 'md'\n ? html`<ox-markdown .src=${src} toc></ox-markdown>`\n : ''}\n </div>\n\n <div id=\"navigation\">\n <md-icon @click=${() => navigate('help')} ?disabled=${this.topic == 'index'}>home</md-icon>\n <md-icon @click=${() => window.history.back()}>keyboard_arrow_left</md-icon>\n <md-icon @click=${() => window.history.forward()}>keyboard_arrow_right</md-icon>\n </div>\n\n ${this.showGotoTop\n ? html` <md-icon id=\"upward\" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</md-icon> `\n : html``}\n `\n }\n\n override async firstUpdated() {\n this.content.addEventListener('scroll', (e: Event) => {\n this.showGotoTop = (e.target as HTMLElement)?.scrollTop !== 0\n })\n\n await this.requestUpdate()\n\n var originPaddingTop = parseFloat(getComputedStyle(this.content, null).getPropertyValue('padding-top'))\n this.content.style.paddingTop = this.navigation.clientHeight + originPaddingTop + 'px'\n\n var headroom = new Headroom(this.navigation, {\n scroller: this.content\n })\n\n headroom.init()\n }\n\n override async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n this.topic = lifecycle.params['topic'] || 'index'\n this.section = lifecycle.params['section'] || ''\n this.content.scrollTop = 0\n }\n }\n\n updated(changes: Map<string, unknown>) {\n super.updated?.(changes as any)\n if (changes.has('topic')) {\n const topic = this.topic\n this.format = undefined\n if (topic) helpFormatOf(topic, i18next?.language ?? 'en').then(format => topic === this.topic && (this.format = format))\n }\n }\n\n gotoTop(e: Event) {\n this.content.scrollTop = 0\n\n e.stopPropagation()\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-help-panel.js","sourceRoot":"","sources":["../../../src/viewparts/ox-help-panel.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,kCAAkC,CAAA;AACzC,OAAO,yBAAyB,CAAA;AAEhC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,C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;;;;;;;;;;;;;;;;;;;;;KA2EF;CACF,AA/EY,CA+EZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAe;AAEd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAqB;AACnB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAA6B;AAEhD;IAAR,KAAK,EAAE;yCAAuB;AAEtB;IAAR,KAAK,EAAE;+CAA0B;AACzB;IAAR,KAAK,EAAE;0CAAuB;AAEZ;IAAlB,KAAK,CAAC,UAAU,CAAC;0CAAsB;AAClB;IAArB,KAAK,CAAC,aAAa,CAAC;6CAAyB;AA7F1C,SAAS;IADd,aAAa,CAAC,eAAe,CAAC;GACzB,SAAS,CAkOd","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/markdown/ox-markdown.js'\nimport '../components/ox-doc.js'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport Headroom from '@operato/headroom'\nimport { closeOverlay } from '@operato/layout'\nimport { navigate } from '@operato/shell'\nimport { i18next } from '@operato/i18n'\nimport { HeadroomStyles, ScrollbarStyles } from '@operato/styles'\nimport { helpFormatOf } from '../help-documents.js'\n\n@customElement('ox-help-panel')\nclass HelpPanel extends LitElement {\n static styles = [\n ScrollbarStyles,\n HeadroomStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--help-panel-background-color);\n\n position: relative;\n width: var(--help-panel-width);\n max-height: 90%;\n border-radius: var(--help-panel-border-raidus);\n border: var(--help-panel-border);\n box-shadow: var(--help-panel-box-shadow);\n color: var(--help-panel-color);\n margin: 4px;\n\n overflow: hidden;\n\n --md-icon-size: 24px;\n }\n\n :host(:focus) {\n outline: none;\n }\n\n #navigation {\n display: flex;\n position: absolute;\n width: 100%;\n padding: var(--help-navigation-padding);\n border-bottom: var(--help-navigation-bottom);\n background-color: var(--md-sys-color-surface);\n }\n\n #navigation md-icon {\n padding: var(--help-navigation-icon-padding, var(--padding-default));\n border-right: var(--help-navigation-icon-border);\n cursor: pointer;\n color: var(--help-icon-color);\n }\n\n #close {\n margin-left: auto;\n border-right: 0;\n }\n\n #content {\n flex: 1;\n overflow: auto;\n padding: var(--help-panel-content-padding);\n margin: var(--help-panel-margin);\n }\n\n #upward {\n --md-icon-size: 26px;\n position: absolute;\n bottom: var(--data-list-fab-position-vertical);\n right: var(--data-list-fab-position-horizontal);\n background-color: rgba(255, 255, 255, 0.7);\n border-radius: 20px;\n color: var(--data-list-fab-color);\n box-shadow: var(--data-list-fab-shadow);\n padding: 7px;\n }\n\n md-icon[filled] {\n font-variation-settings: 'FILL' 1;\n }\n\n @media screen and (max-width: 460px) {\n :host {\n height: 100%;\n max-height: 100%;\n margin: 0;\n }\n }\n `\n ]\n\n @property({ type: String }) topic!: string\n /** The one section a `?` asked about; the overlay shows that part, and 「open in new」 the whole document at it. */\n @property({ type: String }) section: string = ''\n @property({ type: Boolean }) showGotoTop: boolean = false\n /** How the topic is written (`helpFormatOf`) - undefined while it is being asked. */\n @state() format?: 'html' | 'md'\n\n @state() historyIndex: number = -1\n @state() history: string[] = []\n\n @query('#content') content!: HTMLElement\n @query('#navigation') navigation!: HTMLElement\n\n render() {\n const src = this.topic && `/helps/${this.topic}.md`\n const full = `help?topic=${encodeURIComponent(this.topic)}${this.section ? `§ion=${encodeURIComponent(this.section)}` : ''}`\n\n return html`\n <div id=\"navigation\">\n <md-icon filled @click=${() => this.goHome()} ?disabled=${this.history[0] === this.history[this.historyIndex]}>\n home\n </md-icon>\n <md-icon filled @click=${() => this.historyBack()} ?disabled=${this.historyIndex < 1}>\n keyboard_arrow_left\n </md-icon>\n <md-icon filled @click=${() => this.historyForward()} ?disabled=${this.historyIndex >= this.history.length - 1}>\n keyboard_arrow_right\n </md-icon>\n <md-icon filled @click=${() => navigate(full)}> open_in_new </md-icon>\n <md-icon filled id=\"close\" @click=${() => closeOverlay('help')}> close </md-icon>\n </div>\n\n ${!this.showGotoTop\n ? html``\n : html` <md-icon filled id=\"upward\" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</md-icon> `}\n <div id=\"content\">\n ${this.format === 'html'\n ? html`<ox-doc compact topic=${this.topic} section=${this.section} @ox-doc-topic=${(e: CustomEvent) => this.follow(e.detail.topic)}></ox-doc>`\n : this.format === 'md'\n ? html`<ox-markdown .src=${src}></ox-markdown>`\n : ''}\n </div>\n `\n }\n\n async firstUpdated() {\n this.setupRouter()\n\n this.content.addEventListener('scroll', (e: Event) => {\n this.showGotoTop = (e.target as HTMLElement)?.scrollTop !== 0\n })\n\n await this.requestUpdate()\n\n var originPaddingTop = parseFloat(getComputedStyle(this.content, null).getPropertyValue('padding-top'))\n this.content.style.paddingTop = this.navigation.clientHeight + originPaddingTop + 'px'\n\n var headroom = new Headroom(this.navigation, {\n scroller: this.content\n })\n headroom.init()\n }\n\n async updated(changes: PropertyValues<this>) {\n if (changes.has('topic')) {\n const topic = this.topic\n this.format = undefined\n if (topic) helpFormatOf(topic, i18next?.language ?? 'en').then(format => topic === this.topic && (this.format = format))\n if (this.historyIndex === -1) {\n this.history = [this.topic]\n this.historyIndex = 0\n }\n }\n\n if (changes.has('historyIndex')) {\n /* Moving through the history leaves the section the `?` opened at. */\n if (this.history[this.historyIndex] !== this.topic) this.section = ''\n this.topic = this.history[this.historyIndex]\n this.content.scrollTop = 0\n }\n }\n\n setupRouter() {\n this.addEventListener('click', e => {\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey) {\n return\n }\n\n const anchor = e.composedPath().filter(n => (n as HTMLElement).tagName === 'A')[0] as HTMLAnchorElement\n if (!anchor || anchor.target || anchor.hasAttribute('download') || anchor.getAttribute('rel') === 'external') {\n return\n }\n\n const href = anchor.href\n const newUrl = new URL(href, document.baseURI)\n if (!href || href.indexOf('mailto:') !== -1 || newUrl.origin !== location.origin) {\n return\n }\n\n e.preventDefault()\n e.stopPropagation()\n\n const pathname = newUrl.pathname\n const topic = newUrl.searchParams?.get('topic')\n if (pathname.endsWith('/help') && topic) {\n this.history = [...this.history.slice(0, this.historyIndex + 1), topic]\n this.historyIndex++\n this.topic = topic\n } else {\n navigate(href)\n }\n\n return\n })\n }\n\n /** A link inside an html document took it to another topic: the overlay follows, as with a markdown link. */\n follow(topic: string) {\n if (!topic || topic === this.topic) return\n this.history = [...this.history.slice(0, this.historyIndex + 1), topic]\n this.historyIndex++\n }\n\n gotoTop(e: Event) {\n this.content.scrollTop = 0\n\n e.stopPropagation()\n }\n\n goHome() {\n if (!this.history?.[0] || this.history[0] == this.topic) {\n return\n }\n this.history.push(this.history[0])\n this.historyIndex = this.history.length - 1\n }\n\n historyBack() {\n this.historyIndex > 0 && this.historyIndex--\n }\n\n historyForward() {\n this.history && this.historyIndex < this.history.length - 1 && this.historyIndex++\n }\n}\n"]}
|
package/dist/test/ox-doc.test.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { expect, fixture, html, waitUntil } from '@open-wc/testing';
|
|
2
|
-
import '../src/components/ox-doc.js';
|
|
3
|
-
import '../src/components/ox-help-spot.js';
|
|
4
|
-
import '../src/viewparts/ox-help-panel.js';
|
|
5
|
-
import { appendViewpart, VIEWPART_POSITION } from '@operato/layout';
|
|
6
|
-
import { store } from '@operato/shell';
|
|
7
|
-
/**
|
|
8
|
-
* ox-doc reads /helps/{topic}.html and renders it; the products that used to keep their own copy rely on
|
|
9
|
-
* these behaviours.
|
|
10
|
-
*/
|
|
11
|
-
const DOCS = {
|
|
12
|
-
'a/one': `<h1 id="top">One</h1><p>lead</p><h2 id="part">Part</h2><p>in part</p><table><tr><td>x</td></tr></table><h2 id="next">Next</h2><p>after</p><a data-topic="a/two#end">two</a>`,
|
|
13
|
-
'a/two': `<h1>Two</h1><h2 id="end">End</h2>`
|
|
14
|
-
};
|
|
15
|
-
let requests = [];
|
|
16
|
-
const realFetch = window.fetch;
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
requests = [];
|
|
19
|
-
window.fetch = (async (input) => {
|
|
20
|
-
const url = String(input);
|
|
21
|
-
requests.push(url);
|
|
22
|
-
const topic = url.replace(/^\/helps\//, '').replace(/\.html.*$/, '');
|
|
23
|
-
return DOCS[topic] ? new Response(DOCS[topic]) : new Response('', { status: 404 });
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
afterEach(() => {
|
|
27
|
-
window.fetch = realFetch;
|
|
28
|
-
});
|
|
29
|
-
const bodyOf = (el) => el.shadowRoot.querySelector('.body');
|
|
30
|
-
describe('ox-doc', () => {
|
|
31
|
-
it('reads /helps/{topic}.html with the language and renders it', async () => {
|
|
32
|
-
const el = await fixture(html `<ox-doc topic="a/one"></ox-doc>`);
|
|
33
|
-
await waitUntil(() => { var _a; return (_a = bodyOf(el)) === null || _a === void 0 ? void 0 : _a.querySelector('h1'); });
|
|
34
|
-
expect(requests[0]).to.match(/^\/helps\/a\/one\.html\?lng=/);
|
|
35
|
-
expect(bodyOf(el).querySelector('h1').textContent).to.equal('One');
|
|
36
|
-
});
|
|
37
|
-
it('wraps tables in a scrolling box so they do not push the page wide', async () => {
|
|
38
|
-
const el = await fixture(html `<ox-doc topic="a/one"></ox-doc>`);
|
|
39
|
-
await waitUntil(() => { var _a; return (_a = bodyOf(el)) === null || _a === void 0 ? void 0 : _a.querySelector('table'); });
|
|
40
|
-
expect(bodyOf(el).querySelector('table').parentElement.classList.contains('tablewrap')).to.equal(true);
|
|
41
|
-
});
|
|
42
|
-
it('shows only the named section, up to the next heading of its level', async () => {
|
|
43
|
-
const el = await fixture(html `<ox-doc topic="a/one" section="part"></ox-doc>`);
|
|
44
|
-
await waitUntil(() => { var _a; return (_a = bodyOf(el)) === null || _a === void 0 ? void 0 : _a.querySelector('h2'); });
|
|
45
|
-
expect(bodyOf(el).textContent).to.contain('in part');
|
|
46
|
-
expect(bodyOf(el).textContent).to.not.contain('lead');
|
|
47
|
-
expect(bodyOf(el).textContent).to.not.contain('after');
|
|
48
|
-
});
|
|
49
|
-
it('follows a topic link in place and tells the host, without keeping the anchor in the file name', async () => {
|
|
50
|
-
const el = await fixture(html `<ox-doc topic="a/one"></ox-doc>`);
|
|
51
|
-
await waitUntil(() => { var _a; return (_a = bodyOf(el)) === null || _a === void 0 ? void 0 : _a.querySelector('a[data-topic]'); });
|
|
52
|
-
let told;
|
|
53
|
-
el.addEventListener('ox-doc-topic', e => (told = e.detail));
|
|
54
|
-
bodyOf(el).querySelector('a[data-topic]').click();
|
|
55
|
-
await waitUntil(() => { var _a, _b; return ((_b = (_a = bodyOf(el)) === null || _a === void 0 ? void 0 : _a.querySelector('h1')) === null || _b === void 0 ? void 0 : _b.textContent) === 'Two'; });
|
|
56
|
-
expect(told).to.deep.equal({ topic: 'a/two', hash: 'end' });
|
|
57
|
-
expect(requests[requests.length - 1]).to.match(/^\/helps\/a\/two\.html\?/);
|
|
58
|
-
});
|
|
59
|
-
it('says the topic is missing instead of showing an empty page', async () => {
|
|
60
|
-
const el = await fixture(html `<ox-doc topic="a/none"></ox-doc>`);
|
|
61
|
-
await waitUntil(() => el.shadowRoot.querySelector('.status.err'));
|
|
62
|
-
expect(el.shadowRoot.querySelector('.status.err').textContent).to.contain('a/none');
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
describe('ox-help-spot', () => {
|
|
66
|
-
/*
|
|
67
|
-
* The `?` opens the app's help overlay at its section and draws no panel of its own: one drawn inside it sat in
|
|
68
|
-
* whatever held the `?` (a card button, a grid header), took that parent's pointer and text settings, and handed
|
|
69
|
-
* its scrolling and presses back to it. The press of the `?` itself is not a press of its parent either.
|
|
70
|
-
*/
|
|
71
|
-
it('opens the help overlay at its section, and its press does not reach what holds it', async () => {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
appendViewpart({ name: 'help', viewpart: { show: false, hovering: 'edge', template: html `<ox-help-panel></ox-help-panel>` }, position: VIEWPART_POSITION.ASIDEBAR });
|
|
74
|
-
let parentPresses = 0;
|
|
75
|
-
const host = await fixture(html `<button style="cursor: pointer" @click=${() => parentPresses++} @pointerdown=${() => parentPresses++}><ox-help-spot topic="a/one" section="part"></ox-help-spot></button>`);
|
|
76
|
-
const el = host.querySelector('ox-help-spot');
|
|
77
|
-
await waitUntil(() => el.shadowRoot.querySelector('button.q'));
|
|
78
|
-
const q = el.shadowRoot.querySelector('button.q');
|
|
79
|
-
q.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, composed: true }));
|
|
80
|
-
q.click();
|
|
81
|
-
expect(parentPresses).to.equal(0);
|
|
82
|
-
expect(el.shadowRoot.querySelector('.panel, ox-doc')).to.equal(null);
|
|
83
|
-
expect((_b = (_a = history.state) === null || _a === void 0 ? void 0 : _a.overlay) === null || _b === void 0 ? void 0 : _b.name).to.equal('help');
|
|
84
|
-
expect(store.getState().layout.viewparts.help.templateProperties).to.deep.equal({ topic: 'a/one', section: 'part' });
|
|
85
|
-
});
|
|
86
|
-
/* A `?` is placed before its help is written; it must not open 「Content not found」 or the whole document. */
|
|
87
|
-
it('stays out of sight until its topic is written', async () => {
|
|
88
|
-
const el = await fixture(html `<ox-help-spot topic="a/none" section="part"></ox-help-spot>`);
|
|
89
|
-
await waitUntil(() => requests.some(url => url.startsWith('/helps/a/none.html')));
|
|
90
|
-
await new Promise(resolve => setTimeout(resolve, 20));
|
|
91
|
-
expect(!!el.shadowRoot.querySelector('button.q')).to.equal(false);
|
|
92
|
-
expect(el.hasAttribute('hidden')).to.equal(true);
|
|
93
|
-
expect(getComputedStyle(el).display).to.equal('none');
|
|
94
|
-
});
|
|
95
|
-
it('stays out of sight while the named section is not written', async () => {
|
|
96
|
-
const shown = await fixture(html `<ox-help-spot topic="a/one" section="part"></ox-help-spot>`);
|
|
97
|
-
const missing = await fixture(html `<ox-help-spot topic="a/one" section="later"></ox-help-spot>`);
|
|
98
|
-
await waitUntil(() => shown.shadowRoot.querySelector('button.q'));
|
|
99
|
-
await new Promise(resolve => setTimeout(resolve, 20));
|
|
100
|
-
expect(!!missing.shadowRoot.querySelector('button.q')).to.equal(false);
|
|
101
|
-
expect(missing.hasAttribute('hidden')).to.equal(true);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
describe('ox-help-panel', () => {
|
|
105
|
-
/* The overlay shows what a `?` asked about - an html document's section - and the older markdown topics as before. */
|
|
106
|
-
it('shows an html topic through ox-doc at the section, and a markdown topic as markdown', async () => {
|
|
107
|
-
const html1 = await fixture(html `<ox-help-panel topic="a/one" section="part"></ox-help-panel>`);
|
|
108
|
-
await waitUntil(() => html1.shadowRoot.querySelector('ox-doc'));
|
|
109
|
-
const doc = html1.shadowRoot.querySelector('ox-doc');
|
|
110
|
-
expect([doc.getAttribute('topic'), doc.getAttribute('section'), doc.hasAttribute('compact')]).to.deep.equal(['a/one', 'part', true]);
|
|
111
|
-
const md = await fixture(html `<ox-help-panel topic="b/md"></ox-help-panel>`);
|
|
112
|
-
await waitUntil(() => md.shadowRoot.querySelector('ox-markdown'));
|
|
113
|
-
expect(md.shadowRoot.querySelector('ox-doc')).to.equal(null);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
describe('ox-doc anchor', () => {
|
|
117
|
-
/* The help page opens the whole document at the part the overlay showed. */
|
|
118
|
-
it('scrolls its scrolling parent to the anchor once the document is drawn', async () => {
|
|
119
|
-
const box = await fixture(html `<div style="height: 40px; overflow: auto"><ox-doc topic="a/one" anchor="next"></ox-doc></div>`);
|
|
120
|
-
await waitUntil(() => box.scrollTop > 0, 'the box scrolls to #next');
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
//# sourceMappingURL=ox-doc.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-doc.test.js","sourceRoot":"","sources":["../../test/ox-doc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEnE,OA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C,GAAG,EAAE,CAAC,KAAK,CAAC,UAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAA;QAChE,MAAM,GAAG,GAAG,KAAK,CAAC,UAAW,CAAC,aAAa,CAAC,QAAQ,CAAU,CAAA;QAC9D,MAAM,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;QAEpI,MAAM,EAAE,GAAG,MAAM,OAAO,CAAc,IAAI,CAAA,8CAA8C,CAAC,CAAA;QACzF,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,UAAW,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAA;QAClE,MAAM,CAAC,EAAE,CAAC,UAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC/D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,4EAA4E;IAC5E,EAAE,CAAC,uEAAuE,EAAE,KAAK,IAAI,EAAE;QACrF,MAAM,GAAG,GAAG,MAAM,OAAO,CAAc,IAAI,CAAA,+FAA+F,CAAC,CAAA;QAC3I,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE,0BAA0B,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { expect, fixture, html, waitUntil } from '@open-wc/testing'\n\nimport '../src/components/ox-doc.js'\nimport '../src/components/ox-help-spot.js'\nimport '../src/viewparts/ox-help-panel.js'\nimport type { OxDoc } from '../src/components/ox-doc.js'\nimport { appendViewpart, VIEWPART_POSITION } from '@operato/layout'\nimport { store } from '@operato/shell'\n\n/**\n * ox-doc reads /helps/{topic}.html and renders it; the products that used to keep their own copy rely on\n * these behaviours.\n */\nconst DOCS: Record<string, string> = {\n 'a/one': `<h1 id=\"top\">One</h1><p>lead</p><h2 id=\"part\">Part</h2><p>in part</p><table><tr><td>x</td></tr></table><h2 id=\"next\">Next</h2><p>after</p><a data-topic=\"a/two#end\">two</a>`,\n 'a/two': `<h1>Two</h1><h2 id=\"end\">End</h2>`\n}\n\nlet requests: string[] = []\nconst realFetch = window.fetch\n\nbeforeEach(() => {\n requests = []\n window.fetch = (async (input: RequestInfo | URL) => {\n const url = String(input)\n requests.push(url)\n const topic = url.replace(/^\\/helps\\//, '').replace(/\\.html.*$/, '')\n return DOCS[topic] ? new Response(DOCS[topic]) : new Response('', { status: 404 })\n }) as typeof window.fetch\n})\n\nafterEach(() => {\n window.fetch = realFetch\n})\n\nconst bodyOf = (el: OxDoc) => el.shadowRoot!.querySelector('.body') as HTMLElement\n\ndescribe('ox-doc', () => {\n it('reads /helps/{topic}.html with the language and renders it', async () => {\n const el = await fixture<OxDoc>(html`<ox-doc topic=\"a/one\"></ox-doc>`)\n await waitUntil(() => bodyOf(el)?.querySelector('h1'))\n\n expect(requests[0]).to.match(/^\\/helps\\/a\\/one\\.html\\?lng=/)\n expect(bodyOf(el).querySelector('h1')!.textContent).to.equal('One')\n })\n\n it('wraps tables in a scrolling box so they do not push the page wide', async () => {\n const el = await fixture<OxDoc>(html`<ox-doc topic=\"a/one\"></ox-doc>`)\n await waitUntil(() => bodyOf(el)?.querySelector('table'))\n\n expect(bodyOf(el).querySelector('table')!.parentElement!.classList.contains('tablewrap')).to.equal(true)\n })\n\n it('shows only the named section, up to the next heading of its level', async () => {\n const el = await fixture<OxDoc>(html`<ox-doc topic=\"a/one\" section=\"part\"></ox-doc>`)\n await waitUntil(() => bodyOf(el)?.querySelector('h2'))\n\n expect(bodyOf(el).textContent).to.contain('in part')\n expect(bodyOf(el).textContent).to.not.contain('lead')\n expect(bodyOf(el).textContent).to.not.contain('after')\n })\n\n it('follows a topic link in place and tells the host, without keeping the anchor in the file name', async () => {\n const el = await fixture<OxDoc>(html`<ox-doc topic=\"a/one\"></ox-doc>`)\n await waitUntil(() => bodyOf(el)?.querySelector('a[data-topic]'))\n\n let told: any\n el.addEventListener('ox-doc-topic', e => (told = (e as CustomEvent).detail))\n ;(bodyOf(el).querySelector('a[data-topic]') as HTMLElement).click()\n await waitUntil(() => bodyOf(el)?.querySelector('h1')?.textContent === 'Two')\n\n expect(told).to.deep.equal({ topic: 'a/two', hash: 'end' })\n expect(requests[requests.length - 1]).to.match(/^\\/helps\\/a\\/two\\.html\\?/)\n })\n\n it('says the topic is missing instead of showing an empty page', async () => {\n const el = await fixture<OxDoc>(html`<ox-doc topic=\"a/none\"></ox-doc>`)\n await waitUntil(() => el.shadowRoot!.querySelector('.status.err'))\n\n expect(el.shadowRoot!.querySelector('.status.err')!.textContent).to.contain('a/none')\n })\n})\n\ndescribe('ox-help-spot', () => {\n /*\n * The `?` opens the app's help overlay at its section and draws no panel of its own: one drawn inside it sat in\n * whatever held the `?` (a card button, a grid header), took that parent's pointer and text settings, and handed\n * its scrolling and presses back to it. The press of the `?` itself is not a press of its parent either.\n */\n it('opens the help overlay at its section, and its press does not reach what holds it', async () => {\n appendViewpart({ name: 'help', viewpart: { show: false, hovering: 'edge', template: html`<ox-help-panel></ox-help-panel>` }, position: VIEWPART_POSITION.ASIDEBAR })\n let parentPresses = 0\n const host = await fixture<HTMLElement>(\n html`<button style=\"cursor: pointer\" @click=${() => parentPresses++} @pointerdown=${() => parentPresses++}><ox-help-spot topic=\"a/one\" section=\"part\"></ox-help-spot></button>`\n )\n const el = host.querySelector('ox-help-spot') as HTMLElement\n await waitUntil(() => el.shadowRoot!.querySelector('button.q'))\n const q = el.shadowRoot!.querySelector('button.q') as HTMLButtonElement\n q.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, composed: true }))\n q.click()\n\n expect(parentPresses).to.equal(0)\n expect(el.shadowRoot!.querySelector('.panel, ox-doc')).to.equal(null)\n expect(history.state?.overlay?.name).to.equal('help')\n expect((store.getState() as any).layout.viewparts.help.templateProperties).to.deep.equal({ topic: 'a/one', section: 'part' })\n })\n\n /* A `?` is placed before its help is written; it must not open 「Content not found」 or the whole document. */\n it('stays out of sight until its topic is written', async () => {\n const el = await fixture<HTMLElement>(html`<ox-help-spot topic=\"a/none\" section=\"part\"></ox-help-spot>`)\n await waitUntil(() => requests.some(url => url.startsWith('/helps/a/none.html')))\n await new Promise(resolve => setTimeout(resolve, 20))\n\n expect(!!el.shadowRoot!.querySelector('button.q')).to.equal(false)\n expect(el.hasAttribute('hidden')).to.equal(true)\n expect(getComputedStyle(el).display).to.equal('none')\n })\n\n it('stays out of sight while the named section is not written', async () => {\n const shown = await fixture<HTMLElement>(html`<ox-help-spot topic=\"a/one\" section=\"part\"></ox-help-spot>`)\n const missing = await fixture<HTMLElement>(html`<ox-help-spot topic=\"a/one\" section=\"later\"></ox-help-spot>`)\n await waitUntil(() => shown.shadowRoot!.querySelector('button.q'))\n await new Promise(resolve => setTimeout(resolve, 20))\n\n expect(!!missing.shadowRoot!.querySelector('button.q')).to.equal(false)\n expect(missing.hasAttribute('hidden')).to.equal(true)\n })\n})\n\ndescribe('ox-help-panel', () => {\n /* The overlay shows what a `?` asked about - an html document's section - and the older markdown topics as before. */\n it('shows an html topic through ox-doc at the section, and a markdown topic as markdown', async () => {\n const html1 = await fixture<HTMLElement>(html`<ox-help-panel topic=\"a/one\" section=\"part\"></ox-help-panel>`)\n await waitUntil(() => html1.shadowRoot!.querySelector('ox-doc'))\n const doc = html1.shadowRoot!.querySelector('ox-doc') as OxDoc\n expect([doc.getAttribute('topic'), doc.getAttribute('section'), doc.hasAttribute('compact')]).to.deep.equal(['a/one', 'part', true])\n\n const md = await fixture<HTMLElement>(html`<ox-help-panel topic=\"b/md\"></ox-help-panel>`)\n await waitUntil(() => md.shadowRoot!.querySelector('ox-markdown'))\n expect(md.shadowRoot!.querySelector('ox-doc')).to.equal(null)\n })\n})\n\ndescribe('ox-doc anchor', () => {\n /* The help page opens the whole document at the part the overlay showed. */\n it('scrolls its scrolling parent to the anchor once the document is drawn', async () => {\n const box = await fixture<HTMLElement>(html`<div style=\"height: 40px; overflow: auto\"><ox-doc topic=\"a/one\" anchor=\"next\"></ox-doc></div>`)\n await waitUntil(() => box.scrollTop > 0, 'the box scrolls to #next')\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { expect } from '@open-wc/testing';
|
|
2
|
-
import { configureScreenHelp, screenHelpOf, ScreenHelpController } from '../src/controller/screen-help.js';
|
|
3
|
-
import { splitHelp as splitFromHelp } from '../src/controller/help.js';
|
|
4
|
-
/**
|
|
5
|
-
* A screen's `?` opens the part of the help found for its name (ADR-0181) - only in an application that turned it on,
|
|
6
|
-
* and never over the help the screen names itself.
|
|
7
|
-
*/
|
|
8
|
-
let requests = [];
|
|
9
|
-
const realFetch = window.fetch;
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
requests = [];
|
|
12
|
-
window.fetch = (async (input) => {
|
|
13
|
-
const url = String(input);
|
|
14
|
-
requests.push(url);
|
|
15
|
-
const q = new URL(url, location.origin).searchParams.get('q');
|
|
16
|
-
const hits = q === '내 휴가' ? [{ topic: 'office/guide-employee', section: 'leave', score: 12 }] : [];
|
|
17
|
-
return new Response(JSON.stringify(hits), { headers: { 'content-type': 'application/json' } });
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
afterEach(() => {
|
|
21
|
-
window.fetch = realFetch;
|
|
22
|
-
configureScreenHelp(undefined);
|
|
23
|
-
});
|
|
24
|
-
const host = () => {
|
|
25
|
-
const updates = [];
|
|
26
|
-
return { updates, addController() { }, removeController() { }, requestUpdate: () => updates.push(1), updateComplete: Promise.resolve(true) };
|
|
27
|
-
};
|
|
28
|
-
describe('the help a screen opens', () => {
|
|
29
|
-
it('splits topic#section', () => {
|
|
30
|
-
expect(splitFromHelp('office/guide#leave')).to.deep.equal({ topic: 'office/guide', section: 'leave' });
|
|
31
|
-
expect(splitFromHelp('mes/pending')).to.deep.equal({ topic: 'mes/pending', section: '' });
|
|
32
|
-
});
|
|
33
|
-
it('asks nothing until the application turns it on', async () => {
|
|
34
|
-
expect(await screenHelpOf('내 휴가')).to.equal(null);
|
|
35
|
-
expect(requests).to.deep.equal([]);
|
|
36
|
-
});
|
|
37
|
-
it('finds the part for the screen\'s name, in its scope and for its reader, once', async () => {
|
|
38
|
-
configureScreenHelp({ scope: 'office', audience: () => 'employee' });
|
|
39
|
-
expect(await screenHelpOf('내 휴가')).to.deep.equal({ topic: 'office/guide-employee', section: 'leave' });
|
|
40
|
-
await screenHelpOf('내 휴가');
|
|
41
|
-
expect(requests.length).to.equal(1);
|
|
42
|
-
const asked = new URL(requests[0], location.origin).searchParams;
|
|
43
|
-
expect(asked.get('scope')).to.equal('office');
|
|
44
|
-
expect(asked.get('audience')).to.equal('employee');
|
|
45
|
-
expect(asked.get('coverage')).to.equal('0.75');
|
|
46
|
-
});
|
|
47
|
-
it('hides the ? when nothing is found', async () => {
|
|
48
|
-
configureScreenHelp({ scope: 'office' });
|
|
49
|
-
expect(await screenHelpOf('없는 화면')).to.equal(null);
|
|
50
|
-
});
|
|
51
|
-
it('keeps the help a screen names, and draws the found one when it arrives', async () => {
|
|
52
|
-
configureScreenHelp({ scope: 'office' });
|
|
53
|
-
const bar = host();
|
|
54
|
-
const controller = new ScreenHelpController(bar);
|
|
55
|
-
expect(controller.of({ help: 'office/tax#vat-kind', title: '내 휴가' })).to.equal('office/tax#vat-kind');
|
|
56
|
-
expect(controller.of({ title: '내 휴가' })).to.equal('');
|
|
57
|
-
await screenHelpOf('내 휴가');
|
|
58
|
-
await new Promise(resolve => setTimeout(resolve));
|
|
59
|
-
expect(bar.updates.length).to.equal(1);
|
|
60
|
-
expect(controller.of({ title: '내 휴가' })).to.equal('office/guide-employee#leave');
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
//# sourceMappingURL=screen-help.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"screen-help.test.js","sourceRoot":"","sources":["../../test/screen-help.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC1G,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEtE;;;GAGG;AACH,IAAI,QAAQ,GAAa,EAAE,CAAA;AAC3B,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAA;AAE9B,UAAU,CAAC,GAAG,EAAE;IACd,QAAQ,GAAG,EAAE,CAAA;IACb,MAAM,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,KAAwB,EAAE,EAAE;QACjD,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QACzB,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAClB,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC7D,MAAM,IAAI,GAAG,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QAClG,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAA;IAChG,CAAC,C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MAAM,GAAG,GAAG,IAAI,EAAE,CAAA;QAClB,MAAM,UAAU,GAAG,IAAI,oBAAoB,CAAC,GAAG,CAAC,CAAA;QAChD,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;QACrG,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACrD,MAAM,YAAY,CAAC,MAAM,CAAC,CAAA;QAC1B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;QACjD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACtC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAClF,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { expect } from '@open-wc/testing'\n\nimport { configureScreenHelp, screenHelpOf, ScreenHelpController } from '../src/controller/screen-help.js'\nimport { splitHelp as splitFromHelp } from '../src/controller/help.js'\n\n/**\n * A screen's `?` opens the part of the help found for its name (ADR-0181) - only in an application that turned it on,\n * and never over the help the screen names itself.\n */\nlet requests: string[] = []\nconst realFetch = window.fetch\n\nbeforeEach(() => {\n requests = []\n window.fetch = (async (input: RequestInfo | URL) => {\n const url = String(input)\n requests.push(url)\n const q = new URL(url, location.origin).searchParams.get('q')\n const hits = q === '내 휴가' ? [{ topic: 'office/guide-employee', section: 'leave', score: 12 }] : []\n return new Response(JSON.stringify(hits), { headers: { 'content-type': 'application/json' } })\n }) as typeof window.fetch\n})\n\nafterEach(() => {\n window.fetch = realFetch\n configureScreenHelp(undefined)\n})\n\nconst host = () => {\n const updates: number[] = []\n return { updates, addController() {}, removeController() {}, requestUpdate: () => updates.push(1), updateComplete: Promise.resolve(true) } as any\n}\n\ndescribe('the help a screen opens', () => {\n it('splits topic#section', () => {\n expect(splitFromHelp('office/guide#leave')).to.deep.equal({ topic: 'office/guide', section: 'leave' })\n expect(splitFromHelp('mes/pending')).to.deep.equal({ topic: 'mes/pending', section: '' })\n })\n\n it('asks nothing until the application turns it on', async () => {\n expect(await screenHelpOf('내 휴가')).to.equal(null)\n expect(requests).to.deep.equal([])\n })\n\n it('finds the part for the screen\\'s name, in its scope and for its reader, once', async () => {\n configureScreenHelp({ scope: 'office', audience: () => 'employee' })\n expect(await screenHelpOf('내 휴가')).to.deep.equal({ topic: 'office/guide-employee', section: 'leave' })\n await screenHelpOf('내 휴가')\n expect(requests.length).to.equal(1)\n const asked = new URL(requests[0], location.origin).searchParams\n expect(asked.get('scope')).to.equal('office')\n expect(asked.get('audience')).to.equal('employee')\n expect(asked.get('coverage')).to.equal('0.75')\n })\n\n it('hides the ? when nothing is found', async () => {\n configureScreenHelp({ scope: 'office' })\n expect(await screenHelpOf('없는 화면')).to.equal(null)\n })\n\n it('keeps the help a screen names, and draws the found one when it arrives', async () => {\n configureScreenHelp({ scope: 'office' })\n const bar = host()\n const controller = new ScreenHelpController(bar)\n expect(controller.of({ help: 'office/tax#vat-kind', title: '내 휴가' })).to.equal('office/tax#vat-kind')\n expect(controller.of({ title: '내 휴가' })).to.equal('')\n await screenHelpOf('내 휴가')\n await new Promise(resolve => setTimeout(resolve))\n expect(bar.updates.length).to.equal(1)\n expect(controller.of({ title: '내 휴가' })).to.equal('office/guide-employee#leave')\n })\n})\n"]}
|