@21stware/rpui 0.4.4 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/live-render.d.ts +6 -0
- package/dist/gallery.d.ts +4 -1
- package/dist/gallery.js +137 -70
- package/dist/gallery.js.map +1 -1
- package/dist/rpui.d.ts +2 -1
- package/dist/rpui.js +25 -0
- package/dist/rpui.js.map +1 -1
- package/dist/serve.js +48 -8
- package/package.json +2 -4
package/dist/rpui.d.ts
CHANGED
package/dist/rpui.js
CHANGED
|
@@ -99584,8 +99584,33 @@ function registerAll() {
|
|
|
99584
99584
|
define(toComponentTag(suffix), ctor);
|
|
99585
99585
|
}
|
|
99586
99586
|
}
|
|
99587
|
+
function liveRender(host, source, opts = {}) {
|
|
99588
|
+
const { scroller, preserve = true, onError } = opts;
|
|
99589
|
+
const sc = scroller ?? document.scrollingElement ?? document.documentElement;
|
|
99590
|
+
const pane = preserve ? host.querySelector(".annotation-el-pane") : null;
|
|
99591
|
+
const pos = preserve ? { x: sc.scrollLeft, y: sc.scrollTop, px: (pane == null ? void 0 : pane.scrollLeft) ?? 0, py: (pane == null ? void 0 : pane.scrollTop) ?? 0 } : null;
|
|
99592
|
+
try {
|
|
99593
|
+
host.replaceChildren(parseToPage(source));
|
|
99594
|
+
onError == null ? void 0 : onError(null);
|
|
99595
|
+
} catch (e) {
|
|
99596
|
+
onError == null ? void 0 : onError(e.message ?? String(e));
|
|
99597
|
+
return;
|
|
99598
|
+
}
|
|
99599
|
+
if (pos) {
|
|
99600
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
99601
|
+
sc.scrollLeft = pos.x;
|
|
99602
|
+
sc.scrollTop = pos.y;
|
|
99603
|
+
const newPane = host.querySelector(".annotation-el-pane");
|
|
99604
|
+
if (newPane) {
|
|
99605
|
+
newPane.scrollLeft = pos.px;
|
|
99606
|
+
newPane.scrollTop = pos.py;
|
|
99607
|
+
}
|
|
99608
|
+
}));
|
|
99609
|
+
}
|
|
99610
|
+
}
|
|
99587
99611
|
registerAll();
|
|
99588
99612
|
export {
|
|
99613
|
+
liveRender,
|
|
99589
99614
|
parseToPage,
|
|
99590
99615
|
registerAll,
|
|
99591
99616
|
rewriteTags
|