{"version":3,"file":"patron-components.min.mjs","sources":["../src/navigation/PageFetchTransport.ts","../src/navigation/Navigation.ts","../src/navigation/RouteDisplay.ts","../src/navigation/CurrentPage.ts","../src/controls/Input.ts","../src/controls/Visible.ts","../src/controls/Text.ts","../src/controls/Link.ts","../src/controls/ComputedElement.ts","../src/controls/GroupActiveClass.ts","../src/navigation/Router.ts","../src/page/Page.ts","../src/page/EntryPointPage.ts"],"sourcesContent":["import { give, GuestType } from \"patron-oop\";\n\nexport interface RoutePageTransportType {\n  content(guest: GuestType<string>): void;\n}\n\nexport class PageFetchTransport implements RoutePageTransportType {\n  public constructor(\n    private basePath: string,\n    private template: string,\n  ) {}\n\n  public content(guest: GuestType<string>): void {\n    fetch(this.basePath + \"/\" + this.template)\n      .then((result) => {\n        return result.text();\n      })\n      .then((result) => {\n        give(result, guest);\n      });\n  }\n}\n","import {\n  SourceAll,\n  Patron,\n  PrivateType,\n  SourceType,\n  value,\n  give,\n  SourceWithPoolType,\n} from \"patron-oop\";\nimport { RoutePageTransportType } from \"src/navigation/PageFetchTransport\";\nimport { RouteDisplayType } from \"src/navigation/RouteDisplay\";\nimport { RoutePageType } from \"src/navigation/RoutePageType\";\n\nexport interface RouteDocument {\n  url: string;\n  template: string;\n  aliases?: string[];\n  page: RoutePageType;\n  default?: boolean;\n}\n\nexport class Navigation {\n  public constructor(\n    private loading: SourceWithPoolType<boolean>,\n    private basePath: SourceType<string>,\n    private currentPage: SourceWithPoolType<string>,\n    private display: RouteDisplayType,\n    private pageTransport: PrivateType<RoutePageTransportType>,\n  ) {}\n\n  public routes(routes: RouteDocument[]) {\n    const defaultRoute = routes.find((route) => route.default);\n    const all = new SourceAll<{\n      basePath: string;\n      currentPage: string;\n    }>();\n    value(this.basePath, new Patron(all.guestKey(\"basePath\")));\n    value(this.currentPage, new Patron(all.guestKey(\"currentPage\")));\n\n    all.value(\n      new Patron(({ basePath, currentPage }) => {\n        const urlWithoutBasePath = currentPage.replace(basePath, \"\");\n        const routeMatchedToAlias = routes.find(\n          (route) =>\n            route.aliases &&\n            (route.aliases.includes(currentPage) ||\n              route.aliases.includes(urlWithoutBasePath)),\n        );\n\n        if (routeMatchedToAlias) {\n          const correctUrl = basePath + routeMatchedToAlias.url;\n\n          if (correctUrl !== currentPage) {\n            give(correctUrl, this.currentPage);\n            return;\n          }\n        }\n\n        let route = routes.find((route) => {\n          if (route.url.indexOf(\"*\") >= 0) {\n            const regexp = new RegExp(\n              route.url.replaceAll(\"*\", \".*\").replaceAll(\"/\", \"/\"),\n            );\n            return regexp.test(urlWithoutBasePath);\n          }\n          return route.url.replaceAll(\"*\", \"\") === urlWithoutBasePath;\n        });\n\n        if (!route && defaultRoute) {\n          route = defaultRoute;\n        }\n\n        if (route) {\n          const basePathWithoutHash = basePath\n            .replace(\"/#\", \"\")\n            .replace(\"#\", \"\")\n            .replace(/[^/]+\\.html$/, \"\");\n          give(true, this.loading);\n          this.pageTransport\n            .get(basePathWithoutHash, route.template)\n            .content((templateContent) => {\n              this.display.display(templateContent);\n              route.page.mounted();\n              give(false, this.loading);\n            });\n        } else {\n          throw new Error(\"No matching route in Navigation\");\n        }\n      }),\n    );\n  }\n}\n","export interface RouteDisplayType {\n  display(content: string): void;\n}\n\n/**\n * Renders content on selector\n */\nexport class RouteDisplay implements RouteDisplayType {\n  public constructor(private selector: string) {}\n\n  public display(content: string): void {\n    const contentEl = document.querySelector(this.selector);\n    if (contentEl) {\n      contentEl.innerHTML = content;\n    }\n  }\n}\n","import { GuestType, SourceWithPool, SourceWithPoolType } from \"patron-oop\";\n\nexport class CurrentPage implements SourceWithPoolType<string> {\n  private source: SourceWithPoolType<string>;\n\n  public constructor() {\n    const correctUrl = location.href.replace(location.origin, \"\");\n    this.source = new SourceWithPool(correctUrl);\n  }\n\n  public give(value: string): this {\n    this.source.give(value);\n    return this;\n  }\n\n  public value(guest: GuestType<string>) {\n    this.source.value(guest);\n    return guest;\n  }\n\n  public pool() {\n    return this.source.pool();\n  }\n}\n","import { GuestType, Patron, SourceWithPoolType } from \"patron-oop\";\n\ntype InputValue = number | string;\n\nexport class Input implements SourceWithPoolType<InputValue> {\n  public constructor(\n    private source: SourceWithPoolType<InputValue>,\n    selector: string,\n  ) {\n    const el = document.querySelector(selector) as HTMLInputElement;\n    this.source.value(\n      new Patron((value) => {\n        el.value = String(value);\n      }),\n    );\n    el.addEventListener(\"keyup\", () => {\n      this.give(el.value);\n    });\n    el.addEventListener(\"change\", () => {\n      this.give(el.value);\n    });\n  }\n\n  public value(guest: GuestType<InputValue>) {\n    this.source.value(guest);\n    return this;\n  }\n\n  public give(value: InputValue) {\n    this.source.give(value);\n    return this;\n  }\n\n  public pool() {\n    return this.source.pool();\n  }\n}\n","import { GuestObjectType } from \"patron-oop\";\n\nexport class Visible implements GuestObjectType<boolean> {\n  public constructor(private selector: string) {}\n\n  public give(isVisible: boolean): this {\n    const el = document.querySelector(this.selector) as HTMLElement;\n    if (el) {\n      el.style.display = isVisible ? \"block\" : \"none\";\n    }\n    return this;\n  }\n}\n","import { GuestObjectType } from \"patron-oop\";\n\nexport class Text implements GuestObjectType {\n  public constructor(private selector: string) {}\n\n  public give(value: unknown) {\n    const element = document.querySelector(this.selector) as HTMLElement;\n    if (element) {\n      element.innerText = String(value);\n    }\n    return this;\n  }\n}\n","import { GuestObjectType, SourceType, value } from \"patron-oop\";\n\nexport class Link {\n  public constructor(\n    private linkSource: GuestObjectType<string>,\n    private basePath: SourceType<string>,\n  ) {}\n\n  public watchClick(selector: string, subselector?: string) {\n    const wrapperEl = document.querySelectorAll(selector);\n    if (wrapperEl.length) {\n      wrapperEl.forEach((theElement) => {\n        theElement.addEventListener(\"click\", (e) => {\n          if (subselector) {\n            theElement\n              .querySelectorAll(subselector)\n              .forEach((theSubElement) => {\n                if (\n                  e?.target === theSubElement ||\n                  e?.currentTarget === theSubElement\n                ) {\n                  this.handleClick({\n                    preventDefault: e.preventDefault.bind(e),\n                    target: theSubElement,\n                  } as unknown as Event);\n                }\n              });\n          } else {\n            this.handleClick(e);\n          }\n        });\n      });\n    } else {\n      throw new Error(`Link wrapper not found for selector ${selector}`);\n    }\n  }\n\n  private handleClick(e: Event) {\n    let href = (e?.target as HTMLElement)?.getAttribute(\"href\");\n    if (!href) {\n      href = (e?.currentTarget as HTMLElement)?.getAttribute(\"href\");\n    }\n    if (href && href.indexOf(\"http\") !== 0) {\n      e.preventDefault();\n      value(this.basePath, (basePath) => {\n        this.linkSource.give(basePath + href);\n      });\n    }\n  }\n}\n","import {\n  give,\n  SourceAll,\n  SourceObjectType,\n  GuestCast,\n  GuestType,\n} from \"patron-oop\";\n\ntype SourceDetailType = {\n  source: SourceObjectType<any>;\n  placeholder: string;\n};\n\nexport class ComputedElement {\n  public constructor(\n    private sources: SourceDetailType[],\n    private selectorTemplate: string,\n  ) {}\n\n  public element(guest: GuestType<HTMLElement>) {\n    const chain = new SourceAll();\n    this.sources.forEach((source) => {\n      source.source.value(\n        new GuestCast(guest as GuestType, chain.guestKey(source.placeholder)),\n      );\n    });\n\n    chain.value(\n      new GuestCast(\n        guest as GuestType,\n        (placeholders: Record<string, string>) => {\n          let selectorTemplate = this.selectorTemplate;\n\n          Object.entries(placeholders).map((entry) => {\n            selectorTemplate = selectorTemplate.replaceAll(entry[0], entry[1]);\n          });\n\n          const element = document.querySelector(\n            selectorTemplate,\n          ) as HTMLElement;\n          if (element) {\n            give(element, guest);\n          }\n        },\n      ),\n    );\n  }\n}\n","import { GuestObjectType, PatronOnce, SourceType, value } from \"patron-oop\";\n\n/**\n * Sets activeClass to one element of group\n * and resets activeClass on other group elements\n * suitable for menu active class\n */\nexport class GroupActiveClass implements GuestObjectType<HTMLElement> {\n  public constructor(\n    private activeClass: string,\n    private groupSelector: string,\n    private document: SourceType<Document>,\n  ) {}\n\n  public give(element: HTMLElement): this {\n    value(\n      this.document,\n      new PatronOnce((document) => {\n        document.querySelectorAll(this.groupSelector).forEach((el) => {\n          el.classList.remove(this.activeClass);\n        });\n        element.classList.add(this.activeClass);\n      }),\n    );\n    return this;\n  }\n}\n","import {\n  Source,\n  SourceAll,\n  GuestCast,\n  Patron,\n  PrivateClass,\n  SourceWithPool,\n  give,\n  sourceOf,\n} from \"patron-oop\";\nimport { HistoryNewPage, HistoryPoppedPage } from \"patron-web-api\";\nimport { ComputedElement, GroupActiveClass, Link, Visible } from \"../controls\";\nimport { CurrentPage } from \"../navigation/CurrentPage\";\nimport { Navigation } from \"../navigation/Navigation\";\nimport { PageFetchTransport } from \"../navigation/PageFetchTransport\";\nimport { RouteDisplay } from \"../navigation/RouteDisplay\";\n\ntype Route = {\n  url: string;\n  template: string;\n  aliases: string[];\n  page: any;\n};\n\nexport class Router {\n  public constructor(\n    private loaderSelector: string,\n    private navigationResultSelector: string,\n    private menuSelector: string,\n  ) {}\n\n  routes(\n    routes: Route[],\n    currentPage: any,\n    basePathSource: any,\n    afterPageLoaded?: () => void,\n  ) {\n    if (!currentPage) {\n      currentPage = new CurrentPage();\n    }\n    currentPage.value(new Patron(new HistoryNewPage()));\n\n    const [basePath] = location.href.replace(location.origin, \"\").split(\"#\");\n    if (!basePathSource) {\n      basePathSource = new SourceWithPool(\n        `${basePath}#`.replace(\"index.html\", \"\").replace(\"//\", \"/\"),\n      );\n    }\n\n    const pageLoading = new SourceWithPool(false);\n    pageLoading.value(new Patron(new Visible(this.loaderSelector)));\n\n    const historyPoppedPage = new HistoryPoppedPage(currentPage);\n    historyPoppedPage.watchPop();\n\n    const navigation = new Navigation(\n      pageLoading,\n      basePathSource,\n      currentPage,\n      new RouteDisplay(this.navigationResultSelector),\n      new PrivateClass(PageFetchTransport),\n    );\n    navigation.routes(routes);\n\n    const link = new Link(currentPage, basePathSource);\n    link.watchClick(this.menuSelector);\n\n    const urlChain = new SourceAll<any>();\n    basePathSource.value(new Patron(urlChain.guestKey(\"basePath\")));\n    currentPage.value(new Patron(urlChain.guestKey(\"page\")));\n    const url = new Source((guest) => {\n      urlChain.value(\n        new GuestCast(guest, ({ basePath, page }) => {\n          give(page.replace(basePath, \"\"), guest);\n        }),\n      );\n    });\n\n    const activeLink = new ComputedElement(\n      [{ source: url, placeholder: \"{url}\" }],\n      `${this.menuSelector} a[href=\"{url}\"]`,\n    );\n    activeLink.element(\n      new Patron(\n        new GroupActiveClass(\n          \"active\",\n          `${this.menuSelector} a`,\n          sourceOf(document),\n        ),\n      ),\n    );\n\n    pageLoading.value(\n      new Patron((isInLoading) => {\n        if (isInLoading) {\n          return;\n        }\n\n        if (afterPageLoaded) {\n          afterPageLoaded();\n        }\n\n        const divDestination = document.querySelector(\n          this.navigationResultSelector,\n        );\n        if (divDestination) {\n          // Оживляем script тэги\n          divDestination.querySelectorAll(\"script\").forEach((x) => {\n            const sc = document.createElement(\"script\");\n            sc.setAttribute(\"type\", \"module\");\n            sc.appendChild(document.createTextNode(x.innerText));\n            divDestination.appendChild(sc);\n          });\n        }\n      }),\n    );\n  }\n}\n","import { RoutePageType } from \"../navigation\";\n\nexport class Page implements RoutePageType {\n  public constructor(private title: string) {}\n\n  public mounted() {\n    document.title = this.title;\n  }\n}\n","import { RoutePageType } from \"../navigation\";\n\nexport class EntryPointPage implements RoutePageType {\n  public constructor(\n    private title: string,\n    private entryPointUrl: string,\n  ) {}\n\n  public mounted() {\n    document.title = this.title;\n    import(this.entryPointUrl).then((module) => {\n      if (module.main) {\n        module.main();\n      }\n    });\n  }\n}\n"],"names":["PageFetchTransport","constructor","basePath","template","this","content","guest","fetch","then","result","text","give","Navigation","loading","currentPage","display","pageTransport","routes","defaultRoute","find","route","default","all","SourceAll","value","Patron","guestKey","urlWithoutBasePath","replace","routeMatchedToAlias","aliases","includes","correctUrl","url","indexOf","RegExp","replaceAll","test","Error","basePathWithoutHash","get","templateContent","page","mounted","RouteDisplay","selector","contentEl","document","querySelector","innerHTML","CurrentPage","__publicField","location","href","origin","source","SourceWithPool","pool","Input","el","String","addEventListener","Visible","isVisible","style","Text","element","innerText","Link","linkSource","watchClick","subselector","wrapperEl","querySelectorAll","length","forEach","theElement","e","theSubElement","target","currentTarget","handleClick","preventDefault","bind","getAttribute","ComputedElement","sources","selectorTemplate","chain","GuestCast","placeholder","placeholders","Object","entries","map","entry","GroupActiveClass","activeClass","groupSelector","PatronOnce","classList","remove","add","Router","loaderSelector","navigationResultSelector","menuSelector","basePathSource","afterPageLoaded","HistoryNewPage","split","pageLoading","HistoryPoppedPage","watchPop","PrivateClass","urlChain","Source","sourceOf","isInLoading","divDestination","x","sc","createElement","setAttribute","appendChild","createTextNode","Page","title","EntryPointPage","entryPointUrl","import","module","main"],"mappings":"8OAMO,MAAMA,EACJ,WAAAC,CACGC,EACAC,GADAC,KAAAF,SAAAA,EACAE,KAAAD,SAAAA,CAAA,CAGH,OAAAE,CAAQC,GACPC,MAAAH,KAAKF,SAAW,IAAME,KAAKD,UAC9BK,MAAMC,GACEA,EAAOC,SAEfF,MAAMC,IACLE,EAAKF,EAAQH,EAAK,GACnB,ECEA,MAAMM,EACJ,WAAAX,CACGY,EACAX,EACAY,EACAC,EACAC,GAJAZ,KAAAS,QAAAA,EACAT,KAAAF,SAAAA,EACAE,KAAAU,YAAAA,EACAV,KAAAW,QAAAA,EACAX,KAAAY,cAAAA,CAAA,CAGH,MAAAC,CAAOA,GACZ,MAAMC,EAAeD,EAAOE,MAAMC,GAAUA,EAAMC,UAC5CC,EAAM,IAAIC,EAIVC,EAAApB,KAAKF,SAAU,IAAIuB,EAAOH,EAAII,SAAS,cACvCF,EAAApB,KAAKU,YAAa,IAAIW,EAAOH,EAAII,SAAS,iBAE5CJ,EAAAE,MACF,IAAIC,GAAO,EAAGvB,WAAUY,kBACtB,MAAMa,EAAqBb,EAAYc,QAAQ1B,EAAU,IACnD2B,EAAsBZ,EAAOE,MAChCC,GACCA,EAAMU,UACLV,EAAMU,QAAQC,SAASjB,IACtBM,EAAMU,QAAQC,SAASJ,MAG7B,GAAIE,EAAqB,CACjB,MAAAG,EAAa9B,EAAW2B,EAAoBI,IAElD,GAAID,IAAelB,EAEjB,YADKH,EAAAqB,EAAY5B,KAA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