@21stware/rpui 0.3.2 → 0.4.2

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.
@@ -0,0 +1,3 @@
1
+ export declare class DiagramElement extends HTMLElement {
2
+ connectedCallback(): void;
3
+ }
@@ -46,3 +46,6 @@ export declare class TocElement extends HTMLElement {
46
46
  export declare class KbdElement extends HTMLElement {
47
47
  connectedCallback(): void;
48
48
  }
49
+ export declare class AnchorElement extends HTMLElement {
50
+ connectedCallback(): void;
51
+ }
@@ -8,6 +8,8 @@ class RpmlApp extends HTMLElement {
8
8
  const res = await fetch(src);
9
9
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
10
10
  this.replaceWith(parseToPage(await res.text()));
11
+ const section = new URLSearchParams(location.search).get("section");
12
+ if (section) requestAnimationFrame(() => requestAnimationFrame(() => window.dispatchEvent(new CustomEvent("rp-section", { detail: section }))));
11
13
  } catch (e) {
12
14
  this.textContent = `RPML load error: ${e}`;
13
15
  console.error(e);
@@ -1 +1 @@
1
- {"version":3,"file":"rpml-loader.js","sources":["../src/rpml-loader.ts"],"sourcesContent":["import { registerAll, parseToPage } from './rpui';\n\nexport { parseToPage };\nregisterAll();\n\nclass RpmlApp extends HTMLElement {\n async connectedCallback() {\n const src = this.getAttribute('src');\n if (!src) return;\n try {\n const res = await fetch(src);\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\n this.replaceWith(parseToPage(await res.text()));\n } catch (e) {\n this.textContent = `RPML load error: ${e}`;\n console.error(e);\n }\n }\n}\n\ncustomElements.define('rpml-app', RpmlApp);\n\nconst rpmlSrc = new URLSearchParams(location.search).get('rpml');\nif (rpmlSrc && !document.querySelector('rpml-app')) {\n const app = document.createElement('rpml-app') as HTMLElement;\n app.setAttribute('src', rpmlSrc);\n document.body.appendChild(app);\n}\n"],"names":[],"mappings":";AAGA,YAAA;AAEA,MAAM,gBAAgB,YAAY;AAAA,EAChC,MAAM,oBAAoB;AACxB,UAAM,MAAM,KAAK,aAAa,KAAK;AACnC,QAAI,CAAC,IAAK;AACV,QAAI;AACF,YAAM,MAAM,MAAM,MAAM,GAAG;AAC3B,UAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,QAAQ,IAAI,MAAM,EAAE;AACjD,WAAK,YAAY,YAAY,MAAM,IAAI,KAAA,CAAM,CAAC;AAAA,IAChD,SAAS,GAAG;AACV,WAAK,cAAc,oBAAoB,CAAC;AACxC,cAAQ,MAAM,CAAC;AAAA,IACjB;AAAA,EACF;AACF;AAEA,eAAe,OAAO,YAAY,OAAO;AAEzC,MAAM,UAAU,IAAI,gBAAgB,SAAS,MAAM,EAAE,IAAI,MAAM;AAC/D,IAAI,WAAW,CAAC,SAAS,cAAc,UAAU,GAAG;AAClD,QAAM,MAAM,SAAS,cAAc,UAAU;AAC7C,MAAI,aAAa,OAAO,OAAO;AAC/B,WAAS,KAAK,YAAY,GAAG;AAC/B;"}
1
+ {"version":3,"file":"rpml-loader.js","sources":["../src/rpml-loader.ts"],"sourcesContent":["import { registerAll, parseToPage } from './rpui';\n\nexport { parseToPage };\nregisterAll();\n\nclass RpmlApp extends HTMLElement {\n async connectedCallback() {\n const src = this.getAttribute('src');\n if (!src) return;\n try {\n const res = await fetch(src);\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\n this.replaceWith(parseToPage(await res.text()));\n // Honor a ?section= deep-link (e.g. arriving from an <anchor> fallback).\n const section = new URLSearchParams(location.search).get('section');\n if (section) requestAnimationFrame(() => requestAnimationFrame(() =>\n window.dispatchEvent(new CustomEvent('rp-section', { detail: section }))));\n } catch (e) {\n this.textContent = `RPML load error: ${e}`;\n console.error(e);\n }\n }\n}\n\ncustomElements.define('rpml-app', RpmlApp);\n\nconst rpmlSrc = new URLSearchParams(location.search).get('rpml');\nif (rpmlSrc && !document.querySelector('rpml-app')) {\n const app = document.createElement('rpml-app') as HTMLElement;\n app.setAttribute('src', rpmlSrc);\n document.body.appendChild(app);\n}\n"],"names":[],"mappings":";AAGA,YAAA;AAEA,MAAM,gBAAgB,YAAY;AAAA,EAChC,MAAM,oBAAoB;AACxB,UAAM,MAAM,KAAK,aAAa,KAAK;AACnC,QAAI,CAAC,IAAK;AACV,QAAI;AACF,YAAM,MAAM,MAAM,MAAM,GAAG;AAC3B,UAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,QAAQ,IAAI,MAAM,EAAE;AACjD,WAAK,YAAY,YAAY,MAAM,IAAI,KAAA,CAAM,CAAC;AAE9C,YAAM,UAAU,IAAI,gBAAgB,SAAS,MAAM,EAAE,IAAI,SAAS;AAClE,UAAI,QAAS,uBAAsB,MAAM,sBAAsB,MAC7D,OAAO,cAAc,IAAI,YAAY,cAAc,EAAE,QAAQ,QAAA,CAAS,CAAC,CAAC,CAAC;AAAA,IAC7E,SAAS,GAAG;AACV,WAAK,cAAc,oBAAoB,CAAC;AACxC,cAAQ,MAAM,CAAC;AAAA,IACjB;AAAA,EACF;AACF;AAEA,eAAe,OAAO,YAAY,OAAO;AAEzC,MAAM,UAAU,IAAI,gBAAgB,SAAS,MAAM,EAAE,IAAI,MAAM;AAC/D,IAAI,WAAW,CAAC,SAAS,cAAc,UAAU,GAAG;AAClD,QAAM,MAAM,SAAS,cAAc,UAAU;AAC7C,MAAI,aAAa,OAAO,OAAO;AAC/B,WAAS,KAAK,YAAY,GAAG;AAC/B;"}