@yuebai008/cli
Version:
Command line interface for rapid qg-minigame development
1 lines • 1.72 kB
JavaScript
import*as i18n from"../../core/i18n/i18n.js";import*as UI from"../../ui/legacy/legacy.js";import{ApplicationPanelTreeElement}from"./ApplicationPanelTreeElement.js";import{PreloadingRuleSetView,PreloadingAttemptView,PreloadingResultView}from"./preloading/PreloadingView.js";const UIStrings={speculationRules:"Speculation Rules",preloads:"Preloads",thisPage:"This Page"},str_=i18n.i18n.registerUIStrings("panels/application/PreloadingTreeElement.ts",UIStrings),i18nString=i18n.i18n.getLocalizedString.bind(void 0,str_);export class PreloadingTreeElement extends ApplicationPanelTreeElement{model;ctorV;view;path;#e;static newForPreloadingRuleSetView(e){return new PreloadingTreeElement(e,PreloadingRuleSetView,"rule-set",i18nString(UIStrings.speculationRules))}static newForPreloadingAttemptView(e){return new PreloadingTreeElement(e,PreloadingAttemptView,"attempt",i18nString(UIStrings.preloads))}static newForPreloadingResultView(e){return new PreloadingTreeElement(e,PreloadingResultView,"result",i18nString(UIStrings.thisPage))}constructor(e,t,i,n){super(e,n,!1),this.ctorV=t,this.path="preloading://{path}";const r=UI.Icon.Icon.create("arrow-up-down","resource-tree-item");this.setLeadingIcons([r]),this.#e=!1}get itemURL(){return this.path}initialize(e){this.model=e,this.#e&&!this.view&&this.onselect(!1)}onselect(e){return super.onselect(e),this.#e=!0,!!this.model&&(this.view||(this.view=new this.ctorV(this.model)),this.showView(this.view),!1)}revealRuleSet(e){if(!(this.view&&this.view instanceof PreloadingRuleSetView))throw new Error("unreachable");this.view.revealRuleSet(e)}setFilter(e){if(!(this.view&&this.view instanceof PreloadingAttemptView))throw new Error("unreachable");this.view.setFilter(e)}}