fix(runtime): 按参考主题硬切换为 loader/main/auto_fun 单一 DOM 生命周期
- 删除 AksrtFrontend registry/rehydrate 双路架构及 build/public.js 拼包入口,
前台唯一初始路径为 PHP 本地栈(jQuery 1.9.1 → Bootstrap 3.4.1)
→ loader_js(_win/aksrtData 唯一注入)→ tbquire(['main']) → runtime/main.min.js
- window.auto_fun = debounce(z_auto_fun, 100) 为唯一重扫入口;所有模块改为
执行一次 + off/on('auto_fun.aksrt-*') 命名空间重扫,data/class 标记幂等
- 局部更新协议统一:HTML 注入 → post_ajax.ed → auto_fun();
远程 modal → loaded.bs.modal → auto_fun();JSON 成功 → zib_ajax.success
- 灯箱恢复 Miniimgbox/imgbox 唯一 owner(imgbox-container、a[data-imgbox]、
imgbox_data),删除 AksrtLightbox/data-aksrt-lightbox 第二实现及 CSS/overlay,
_win.imgbox* 重新接上 post-display 设置
- 死代码清理:runtime 下 11 组被自有实现替代的旧模块副本、无消费 vendored 库、
顶层 grade.min.js、revenue.js、无调用方的 aksrt_get_win_runtime_config(),
以及 loader 中 16 条死 mapping
- PHP 入队改为本地栈 + loader_js,routed/widget/submit 依赖统一换绑;
用户卡片发布按钮恢复 nav_user_newposts_btn 设置门控
- 测试对齐:新增 frontend-lifecycle-contract,重写 navigation/lazyload/toast/
auth-source/comment/page-display/post-visual 等断言为目标架构契约
验证:node --test widget-system+navigation 223 通过 0 失败;
构建脚本重建 main/imgbox min 与 CSS bundles;改动 PHP php -l、JS node --check
全部通过;git diff --check 干净;credits 重入 harness 通过。
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Owns the modal shell while adding cancellable loaders,
|
||||
* short in-memory caching, request deduplication, retryable errors, focus
|
||||
* restoration, and modal-scoped rehydration.
|
||||
* restoration, and legacy `loaded.bs.modal` content lifecycle (auto_fun rescan).
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -184,7 +184,7 @@
|
||||
}));
|
||||
|
||||
if (options.html !== undefined) {
|
||||
rehydrate(session);
|
||||
notifyContentLoaded(session);
|
||||
telemetryMark(session, "first-content");
|
||||
telemetryMark(session, "ready");
|
||||
if (typeof options.onContent === "function") options.onContent(options.html, session);
|
||||
@@ -193,9 +193,11 @@
|
||||
return session;
|
||||
}
|
||||
|
||||
function rehydrate(session) {
|
||||
if (!session || !session.content) return;
|
||||
window.AksrtFrontend.rehydrate(session.content, "modal");
|
||||
// legacy 契约:modal 内容注入后触发 loaded.bs.modal,
|
||||
// 由全局委托(见文件底部)驱动 auto_fun 重扫,不做模块内扫描。
|
||||
function notifyContentLoaded(session) {
|
||||
if (!session || !session.shell || !window.jQuery) return;
|
||||
window.jQuery(session.shell).trigger("loaded.bs.modal");
|
||||
}
|
||||
|
||||
function abortSessionRequest(session) {
|
||||
@@ -260,7 +262,7 @@
|
||||
'</div><div class="but-average modal-buts">' +
|
||||
'<button type="button" class="but" data-aksrt-modal-retry>重试</button>' +
|
||||
'<button type="button" class="but" data-aksrt-modal-close>关闭</button></div>';
|
||||
rehydrate(session);
|
||||
notifyContentLoaded(session);
|
||||
if (typeof session.options.onError === "function") session.options.onError(error, session);
|
||||
}
|
||||
|
||||
@@ -281,7 +283,7 @@
|
||||
}
|
||||
setState(session, "ready");
|
||||
telemetryMark(session, "first-content");
|
||||
rehydrate(session);
|
||||
notifyContentLoaded(session);
|
||||
telemetryMark(session, "ready");
|
||||
if (typeof session.options.onData === "function") session.options.onData(data, session, result);
|
||||
return;
|
||||
@@ -298,7 +300,7 @@
|
||||
session.content.innerHTML = html;
|
||||
setState(session, "ready");
|
||||
telemetryMark(session, "first-content");
|
||||
rehydrate(session);
|
||||
notifyContentLoaded(session);
|
||||
telemetryMark(session, "ready");
|
||||
if (typeof session.options.onContent === "function") session.options.onContent(html, session);
|
||||
}
|
||||
@@ -422,4 +424,15 @@
|
||||
};
|
||||
|
||||
document.dispatchEvent(new CustomEvent("aksrt:modal-runtime:ready"));
|
||||
|
||||
// legacy 契约(只绑定一次):modal 展示/内容注入后调用全局 auto_fun 重扫。
|
||||
if (window.jQuery) {
|
||||
window.jQuery(document).on(
|
||||
"loaded.bs.modal show.bs.modal",
|
||||
".modal, .aksrt-modal-runtime",
|
||||
function () {
|
||||
if (typeof window.auto_fun === "function") window.auto_fun();
|
||||
}
|
||||
);
|
||||
}
|
||||
})(window, document);
|
||||
|
||||
Reference in New Issue
Block a user