@umbraco-cms/backoffice 14.0.0-631d8769 → 14.0.0-709b3cbf

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.
Files changed (161) hide show
  1. package/dist-cms/assets/lang/en-us.js +18 -18
  2. package/dist-cms/assets/lang/en-us.ts +18 -18
  3. package/dist-cms/custom-elements.json +11 -11
  4. package/dist-cms/external/backend-api/index.js +1 -1
  5. package/dist-cms/external/backend-api/src/index.d.ts +17 -1
  6. package/dist-cms/external/backend-api/src/models/CreateContentRequestModelBaseDocumentValueModelDocumentVariantRequestModel.d.ts +1 -0
  7. package/dist-cms/external/backend-api/src/models/CreateContentRequestModelBaseMediaValueModelMediaVariantRequestModel.d.ts +1 -0
  8. package/dist-cms/external/backend-api/src/models/CreateContentTypeRequestModelBaseCreateDocumentTypePropertyTypeRequestModelCreateDocumentTypePropertyTypeContainerRequestModel.d.ts +2 -0
  9. package/dist-cms/external/backend-api/src/models/CreateContentTypeRequestModelBaseCreateMediaTypePropertyTypeRequestModelCreateMediaTypePropertyTypeContainerRequestModel.d.ts +20 -0
  10. package/dist-cms/external/backend-api/src/models/CreateMediaTypePropertyTypeContainerRequestModel.d.ts +2 -0
  11. package/dist-cms/external/backend-api/src/models/CreateMediaTypePropertyTypeRequestModel.d.ts +2 -0
  12. package/dist-cms/external/backend-api/src/models/CreateMediaTypeRequestModel.d.ts +2 -0
  13. package/dist-cms/external/backend-api/src/models/DeleteUserGroupsRequestModel.d.ts +3 -0
  14. package/dist-cms/external/backend-api/src/models/DeleteUsersRequestModel.d.ts +3 -0
  15. package/dist-cms/external/backend-api/src/models/ItemSortingRequestModel.d.ts +4 -0
  16. package/dist-cms/external/backend-api/src/models/ProblemDetailsBuilderModel.d.ts +1 -0
  17. package/dist-cms/external/backend-api/src/models/RelationResponseModel.d.ts +2 -2
  18. package/dist-cms/external/backend-api/src/models/ResetPasswordRequestModel.d.ts +3 -0
  19. package/dist-cms/external/backend-api/src/models/ResetPasswordTokenRequestModel.d.ts +4 -0
  20. package/dist-cms/external/backend-api/src/models/SortingRequestModel.d.ts +5 -0
  21. package/dist-cms/external/backend-api/src/models/UpdateContentTypeRequestModelBaseUpdateMediaTypePropertyTypeRequestModelUpdateMediaTypePropertyTypeContainerRequestModel.d.ts +18 -0
  22. package/dist-cms/external/backend-api/src/models/{UpdateFolderReponseModel.d.ts → UpdateFolderResponseModel.d.ts} +1 -1
  23. package/dist-cms/external/backend-api/src/models/UpdateMediaTypePropertyTypeContainerRequestModel.d.ts +2 -0
  24. package/dist-cms/external/backend-api/src/models/UpdateMediaTypePropertyTypeRequestModel.d.ts +2 -0
  25. package/dist-cms/external/backend-api/src/models/UpdateMediaTypeRequestModel.d.ts +2 -0
  26. package/dist-cms/external/backend-api/src/models/VerifyResetPasswordTokenRequestModel.d.ts +4 -0
  27. package/dist-cms/external/backend-api/src/services/DataTypeResource.d.ts +2 -2
  28. package/dist-cms/external/backend-api/src/services/DocumentResource.d.ts +21 -21
  29. package/dist-cms/external/backend-api/src/services/DocumentTypeResource.d.ts +35 -3
  30. package/dist-cms/external/backend-api/src/services/MediaResource.d.ts +13 -5
  31. package/dist-cms/external/backend-api/src/services/MediaTypeResource.d.ts +56 -0
  32. package/dist-cms/external/backend-api/src/services/RelationResource.d.ts +1 -9
  33. package/dist-cms/external/backend-api/src/services/SecurityResource.d.ts +24 -0
  34. package/dist-cms/external/backend-api/src/services/UserGroupResource.d.ts +8 -0
  35. package/dist-cms/external/backend-api/src/services/UserResource.d.ts +8 -0
  36. package/dist-cms/external/router-slot/config.d.ts +8 -0
  37. package/dist-cms/external/router-slot/index.d.ts +4 -3
  38. package/dist-cms/external/router-slot/index.js +1 -1
  39. package/dist-cms/external/router-slot/model.d.ts +123 -0
  40. package/dist-cms/external/router-slot/router-slot.d.ts +111 -0
  41. package/dist-cms/external/router-slot/util/anchor.d.ts +5 -0
  42. package/dist-cms/external/router-slot/util/events.d.ts +26 -0
  43. package/dist-cms/external/router-slot/util/history.d.ts +32 -0
  44. package/dist-cms/external/router-slot/util/index.d.ts +6 -0
  45. package/dist-cms/external/router-slot/util/router.d.ts +72 -0
  46. package/dist-cms/external/router-slot/util/shadow.d.ts +15 -0
  47. package/dist-cms/external/router-slot/util/url.d.ts +78 -0
  48. package/dist-cms/external/router-slot/util.d.ts +1 -0
  49. package/dist-cms/libs/observable-api/observer.js +2 -1
  50. package/dist-cms/mocks/browser-handlers.js +1 -1
  51. package/dist-cms/mocks/data/document.data.d.ts +6 -2
  52. package/dist-cms/mocks/data/document.data.js +54 -4
  53. package/dist-cms/mocks/data/entity.data.js +0 -2
  54. package/dist-cms/mocks/handlers/{document.handlers.js → document/document.handlers.js} +28 -40
  55. package/dist-cms/mocks/handlers/document/index.d.ts +1 -0
  56. package/dist-cms/mocks/handlers/document/index.js +5 -0
  57. package/dist-cms/mocks/handlers/document/item.handlers.d.ts +1 -0
  58. package/dist-cms/mocks/handlers/document/item.handlers.js +13 -0
  59. package/dist-cms/mocks/handlers/document/recycle-bin.handlers.d.ts +1 -0
  60. package/dist-cms/mocks/handlers/document/recycle-bin.handlers.js +16 -0
  61. package/dist-cms/mocks/handlers/document/slug.d.ts +1 -0
  62. package/dist-cms/mocks/handlers/document/slug.js +1 -0
  63. package/dist-cms/mocks/handlers/document/tree.handlers.d.ts +1 -0
  64. package/dist-cms/mocks/handlers/document/tree.handlers.js +16 -0
  65. package/dist-cms/packages/core/components/input-list-base/input-list-base.js +1 -1
  66. package/dist-cms/packages/core/content-type/content-type-container-structure-helper.class.js +2 -2
  67. package/dist-cms/packages/core/content-type/content-type-property-structure-helper.class.js +1 -1
  68. package/dist-cms/packages/core/content-type/content-type-structure-manager.class.d.ts +15 -15
  69. package/dist-cms/packages/core/content-type/content-type-structure-manager.class.js +79 -103
  70. package/dist-cms/packages/core/entity-action/common/trash/trash.action.d.ts +1 -1
  71. package/dist-cms/packages/core/entity-action/common/trash/trash.action.js +1 -1
  72. package/dist-cms/packages/core/modal/token/create-document-modal.token.d.ts +8 -0
  73. package/dist-cms/packages/core/modal/token/create-document-modal.token.js +5 -0
  74. package/dist-cms/packages/core/modal/token/index.d.ts +1 -1
  75. package/dist-cms/packages/core/modal/token/index.js +1 -1
  76. package/dist-cms/packages/core/store/store-base.d.ts +18 -6
  77. package/dist-cms/packages/core/store/store-base.js +22 -6
  78. package/dist-cms/packages/documents/document-types/manifests.js +0 -2
  79. package/dist-cms/packages/documents/document-types/repository/document-type.repository.d.ts +0 -21
  80. package/dist-cms/packages/documents/document-types/repository/document-type.repository.js +6 -18
  81. package/dist-cms/packages/documents/document-types/repository/sources/document-type.server.data.d.ts +1 -1
  82. package/dist-cms/packages/documents/document-types/repository/sources/document-type.server.data.js +1 -12
  83. package/dist-cms/packages/documents/document-types/workspace/document-type-workspace.context.js +27 -27
  84. package/dist-cms/packages/documents/document-types/workspace/views/design/document-type-workspace-view-edit.element.js +8 -4
  85. package/dist-cms/packages/documents/documents/entity-actions/create/create-document-modal.element.d.ts +17 -0
  86. package/dist-cms/packages/documents/{document-types/modals/allowed-document-types/allowed-document-types-modal.element.js → documents/entity-actions/create/create-document-modal.element.js} +29 -38
  87. package/dist-cms/packages/documents/documents/entity-actions/create/create.action.d.ts +0 -2
  88. package/dist-cms/packages/documents/documents/entity-actions/create/create.action.js +7 -23
  89. package/dist-cms/packages/documents/documents/entity-actions/create/manifests.d.ts +2 -0
  90. package/dist-cms/packages/documents/documents/entity-actions/create/manifests.js +27 -0
  91. package/dist-cms/packages/documents/documents/entity-actions/manifests.d.ts +2 -2
  92. package/dist-cms/packages/documents/documents/entity-actions/manifests.js +15 -48
  93. package/dist-cms/packages/documents/documents/index.d.ts +1 -0
  94. package/dist-cms/packages/documents/documents/index.js +1 -0
  95. package/dist-cms/packages/documents/documents/manifests.d.ts +13 -1
  96. package/dist-cms/packages/documents/documents/manifests.js +2 -0
  97. package/dist-cms/packages/documents/documents/menu-item/manifests.js +1 -1
  98. package/dist-cms/packages/documents/documents/recycle-bin/entity-action/manifests.d.ts +14 -0
  99. package/dist-cms/packages/documents/documents/recycle-bin/entity-action/manifests.js +18 -0
  100. package/dist-cms/packages/documents/documents/recycle-bin/index.d.ts +1 -0
  101. package/dist-cms/packages/documents/documents/recycle-bin/index.js +1 -0
  102. package/dist-cms/packages/documents/documents/recycle-bin/manifests.d.ts +13 -0
  103. package/dist-cms/packages/documents/documents/recycle-bin/manifests.js +5 -0
  104. package/dist-cms/packages/documents/documents/recycle-bin/menu-item/manifests.d.ts +1 -0
  105. package/dist-cms/packages/documents/documents/recycle-bin/menu-item/manifests.js +14 -0
  106. package/dist-cms/packages/documents/documents/recycle-bin/repository/document-recycle-bin.repository.d.ts +28 -0
  107. package/dist-cms/packages/documents/documents/recycle-bin/repository/document-recycle-bin.repository.js +56 -0
  108. package/dist-cms/packages/documents/documents/recycle-bin/repository/document-recycle.bin.tree.store.d.ts +18 -0
  109. package/dist-cms/packages/documents/documents/recycle-bin/repository/document-recycle.bin.tree.store.js +19 -0
  110. package/dist-cms/packages/documents/documents/recycle-bin/repository/index.d.ts +1 -0
  111. package/dist-cms/packages/documents/documents/recycle-bin/repository/index.js +1 -0
  112. package/dist-cms/packages/documents/documents/recycle-bin/repository/manifests.d.ts +4 -0
  113. package/dist-cms/packages/documents/documents/recycle-bin/repository/manifests.js +17 -0
  114. package/dist-cms/packages/documents/documents/recycle-bin/repository/sources/document-recycle-bin.tree.server.data.d.ts +29 -0
  115. package/dist-cms/packages/documents/documents/recycle-bin/repository/sources/document-recycle-bin.tree.server.data.js +49 -0
  116. package/dist-cms/packages/documents/documents/recycle-bin/tree/manifests.d.ts +2 -0
  117. package/dist-cms/packages/documents/documents/recycle-bin/tree/manifests.js +19 -0
  118. package/dist-cms/packages/documents/documents/repository/document-item.store.d.ts +20 -0
  119. package/dist-cms/packages/documents/documents/repository/document-item.store.js +23 -0
  120. package/dist-cms/packages/documents/documents/repository/document.repository.d.ts +10 -9
  121. package/dist-cms/packages/documents/documents/repository/document.repository.js +47 -25
  122. package/dist-cms/packages/documents/documents/repository/document.store.d.ts +0 -12
  123. package/dist-cms/packages/documents/documents/repository/document.store.js +0 -16
  124. package/dist-cms/packages/documents/documents/repository/sources/document-item.server.data.d.ts +24 -0
  125. package/dist-cms/packages/documents/documents/repository/sources/document-item.server.data.js +31 -0
  126. package/dist-cms/packages/documents/documents/repository/sources/document.server.data.d.ts +9 -21
  127. package/dist-cms/packages/documents/documents/repository/sources/document.server.data.js +33 -62
  128. package/dist-cms/packages/documents/documents/workspace/manifests.js +6 -4
  129. package/dist-cms/packages/documents/manifests.d.ts +13 -1
  130. package/dist-cms/packages/settings/dashboards/performance-profiling/dashboard-performance-profiling.element.d.ts +3 -1
  131. package/dist-cms/packages/settings/dashboards/performance-profiling/dashboard-performance-profiling.element.js +26 -40
  132. package/dist-cms/packages/settings/relation-types/workspace/views/relation/workspace-view-relation-type-relation.element.js +17 -17
  133. package/dist-cms/packages/templating/templates/modals/query-builder/query-builder.element.d.ts +1 -1
  134. package/dist-cms/packages/templating/templates/modals/query-builder/query-builder.element.js +1 -1
  135. package/dist-cms/packages/users/user-groups/collection/user-group-collection-header.element.js +2 -2
  136. package/dist-cms/packages/users/user-groups/collection/user-group-collection-view.element.js +6 -6
  137. package/dist-cms/packages/users/user-groups/workspace/user-group-workspace-editor.element.js +15 -12
  138. package/dist-cms/packages/users/users/collection/user-collection-header.element.js +18 -11
  139. package/dist-cms/packages/users/users/collection/views/grid/user-collection-grid-view.element.js +6 -6
  140. package/dist-cms/packages/users/users/collection/views/table/column-layouts/status/user-table-status-column-layout.element.js +3 -3
  141. package/dist-cms/packages/users/users/index.d.ts +1 -0
  142. package/dist-cms/packages/users/users/index.js +1 -0
  143. package/dist-cms/packages/users/users/repository/index.d.ts +1 -0
  144. package/dist-cms/packages/users/users/repository/index.js +1 -0
  145. package/dist-cms/packages/users/users/workspace/user-workspace-editor.element.js +36 -35
  146. package/dist-cms/packages/users/utils.d.ts +5 -2
  147. package/dist-cms/packages/users/utils.js +14 -14
  148. package/dist-cms/shared/repository/data-source/folder-data-source.interface.d.ts +2 -2
  149. package/dist-cms/shared/repository/folder-repository.interface.d.ts +2 -2
  150. package/dist-cms/shared/router/index.d.ts +1 -1
  151. package/dist-cms/shared/router/index.js +1 -1
  152. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  153. package/dist-cms/vscode-html-custom-data.json +7 -7
  154. package/package.json +2 -3
  155. package/dist-cms/packages/core/modal/token/allowed-document-types-modal.token.d.ts +0 -9
  156. package/dist-cms/packages/core/modal/token/allowed-document-types-modal.token.js +0 -5
  157. package/dist-cms/packages/documents/document-types/modals/allowed-document-types/allowed-document-types-modal.element.d.ts +0 -19
  158. package/dist-cms/packages/documents/document-types/modals/manifests.d.ts +0 -2
  159. package/dist-cms/packages/documents/document-types/modals/manifests.js +0 -9
  160. package/router-slot-2.3.0.tgz +0 -0
  161. /package/dist-cms/mocks/handlers/{document.handlers.d.ts → document/document.handlers.d.ts} +0 -0
@@ -0,0 +1,8 @@
1
+ import { PathMatch } from "./model.js";
2
+ export declare const CATCH_ALL_WILDCARD: string;
3
+ export declare const TRAVERSE_FLAG: string;
4
+ export declare const PARAM_IDENTIFIER: RegExp;
5
+ export declare const ROUTER_SLOT_TAG_NAME: string;
6
+ export declare const GLOBAL_ROUTER_EVENTS_TARGET: Window & typeof globalThis;
7
+ export declare const HISTORY_PATCH_NATIVE_KEY: string;
8
+ export declare const DEFAULT_PATH_MATCH: PathMatch;
@@ -1,3 +1,4 @@
1
- export * from 'router-slot';
2
- export type { Guard, IRoute, IRoutingInfo, IComponentRoute, IRedirectRoute, IResolverRoute, IRouterSlot, PageComponent, Component, Params, } from 'router-slot/model';
3
- export * from 'router-slot/util';
1
+ export * from './router-slot.js';
2
+ export * from './config.js';
3
+ export * from './util/index.js';
4
+ export type { Guard, IRoute, IRoutingInfo, IComponentRoute, IRedirectRoute, IResolverRoute, IRouterSlot, PageComponent, Component, Params, } from './model.js';
@@ -1 +1 @@
1
- const y="**",A="\\.\\.\\/",L=/:([^\\/]+)/g,v="router-slot",m=window,g="native",T="prefix";function $(t,e){t.dispatchEvent(new CustomEvent("changestate",{detail:e}))}function o(t,e){m.dispatchEvent(new CustomEvent(t,{detail:e}))}function E(t,e,n,r){const s=Array.isArray(e)?e:[e];return s.forEach(a=>t.addEventListener(a,n,r)),()=>s.forEach(a=>t.removeEventListener(a,n,r))}function S(t){t.forEach(e=>e())}const M=[["pushState",["pushstate","changestate"]],["replaceState",["replacestate","changestate"]],["forward",["pushstate","changestate"]],["go",["pushstate","changestate"]],["back",["popstate"]]];function N(){for(const[t,e]of M)for(const n of e)b(history,t,n);window.addEventListener("popstate",t=>{if(F({eventName:"popstate"})){t.preventDefault(),t.stopPropagation();return}setTimeout(()=>o("changestate"),0)})}function b(t,e,n){const r=t[e];x(t,e,r),t[e]=(...s)=>{const a=s.length>2?s[2]:null;F({url:a,eventName:n})||(r.apply(t,s),o(n))}}function x(t,e,n){t[g]==null&&(t[g]={}),t[g][`${e}`]=n.bind(t)}function F(t){return!m.dispatchEvent(new CustomEvent("willchangestate",{cancelable:!0,detail:t}))}const H=document.createElement("a");function R(t={}){return h(window.location.pathname,t)}function I(t={}){return h(k(R(),W()),t)}function W(t={}){return w(".",t)}function w(t,e={}){return H.href=t,h(H.pathname,e)}function k(t,e){return t.replace(new RegExp(`^${e}`),"")}function _(){return window.location.search}function j(){return O(_().substr(1))}function l(t){return h(t,{start:!1,end:!1})}function tt(t){return h(t,{start:!0,end:!0})}function h(t,{start:e=!0,end:n=!0}={}){return t=e&&!t.startsWith("/")?`/${t}`:!e&&t.startsWith("/")?t.slice(1):t,n&&!t.endsWith("/")?`${t}/`:!n&&t.endsWith("/")?t.slice(0,t.length-1):t}function O(t){if(t.length===0)return{};const n=t.split("&").map(r=>r.split("="));return Object.assign({},...n.map(r=>({[decodeURIComponent(r[0])]:r.length>1?decodeURIComponent(r[1]):""})))}function et(t){return Object.entries(t).map(([e,n])=>`${e}${n!=""?`=${encodeURIComponent(n)}`:""}`).join("&")}function nt(t,e=R()){return new RegExp(`^${l(t)}(/|$)`,"gm").test(l(e))}function D(t,e){const n=[],r=l(t.path.replace(L,(i,...c)=>(n.push(c[0]),"([^/]+)"))),s=t.path===y||t.path.length===0&&t.pathMatch!="full"?/^/:(()=>{switch(t.pathMatch||T){case"full":return new RegExp(`^${r}/?$`);case"suffix":return new RegExp(`^.*?${r}/?$`);case"fuzzy":return new RegExp(`^.*?${r}.*?$`);case"prefix":default:return new RegExp(`^[/]?${r}(?:/|$)`)}})(),a=e.match(s);if(a!=null){const i=n.reduce((u,d,p)=>(u[d]=a[p+1],u),{}),c=l(e.slice(0,a[0].length)),f=l(e.slice(a[0].length,e.length));return{route:t,match:a,params:i,fragments:{consumed:c,rest:f}}}return null}function q(t,e){for(const n of t){const r=D(n,e);if(r!=null)return r}return null}async function U(t,e){let n=t.component;if(n instanceof Function)try{n=n()}catch(a){if(!(a instanceof TypeError))throw a}const r=await Promise.resolve(n);let s;return r instanceof HTMLElement?s=r:s=new(r.default?r.default:r),t.setup!=null&&t.setup(s,e),s}function G(t){return"redirectTo"in t}function B(t){return"resolve"in t}function Q(t){let e=[t];for(;t.parent!=null;)t=t.parent,e.push(t);const n=e.reduce((s,a)=>({slot:a,child:s}),void 0),r=e.length;return{tree:n,depth:r}}function V(t,e){let n=t;const r=[];for(;n!=null&&n.slot.match!=null&&e>0;)r.push(n.slot.match.fragments.consumed),n=n.child,e--;return r}function C(t,e=""){const{tree:n,depth:r}=Q(t);if(!e.startsWith("/")){let s=0;e.startsWith("./")&&(e=e.slice(2));const a=e.match(new RegExp(A,"g"));if(a!=null){s=a.length;const c=a.reduce((f,u)=>f+u.length,0);e=e.slice(c)}const i=V(n,r-1-s).filter(c=>c.length>0);e=`${i.join("/")}${i.length>0?"/":""}${e}`}return w(e,{end:!1})}function z(t,e){history.replaceState(history.state,"",`${C(t,e.redirectTo)}${e.preserveQuery?_():""}`)}function Y(t,e){if(t==null)return!0;const{route:n,fragments:r}=t,{route:s,fragments:a}=e,i=n==s;return!(r.consumed==a.consumed)||!i}function K(t){return P(t,v)}function P(t,e,n=0,r=0){const s=t.getRootNode();if(r>=n){const i=s.querySelector(e);if(i!=null&&i!=t)return i}const a=s.getRootNode();return a.host==null?null:P(a.host,e,n,++r)}function J(){window.addEventListener("click",t=>{const e="composedPath"in t?t.composedPath().find(s=>s instanceof HTMLAnchorElement):t.target;if(e==null||!(e instanceof HTMLAnchorElement)||!e.href.startsWith(location.origin)||e.target!==""&&e.target!=="_self"||e.dataset.routerSlot==="disabled")return;const r=e.pathname+e.search+e.hash;t.preventDefault(),history.pushState(null,"",r)})}const X=document.createElement("template");X.innerHTML="<slot></slot>",N(),J();class Z extends HTMLElement{listeners=[];_routes=[];get routes(){return this._routes}set routes(e){this.clear(),this.add(e)}_parent;get parent(){return this._parent}set parent(e){this._lockParent=!0,this._setParent(e)}_lockParent=!1;_setParent(e){this._parent!==e&&(this.detachListeners(),this._parent=e,this.attachListeners())}get isRoot(){return this.parent==null}_routeMatch=null;get match(){return this._routeMatch}get route(){return this.match!=null?this.match.route:null}get fragments(){return this.match!=null?this.match.fragments:null}get params(){return this.match!=null?this.match.params:null}constructor(){super(),this.addEventListener("router-slot:capture-parent",n=>{n.stopPropagation(),n.detail.parent=this}),this.render=this.render.bind(this),this.attachShadow({mode:"open"}).appendChild(X.content.cloneNode(!0))}connectedCallback(){if(!this._lockParent){const e=new CustomEvent("router-slot:capture-parent",{composed:!0,bubbles:!0,detail:{parent:null}});this.parentNode?(this.parentNode.dispatchEvent(e),this._setParent(e.detail.parent??null)):this._setParent(null)}this.parent&&this.parent.match!==null&&this.match===null&&requestAnimationFrame(()=>{this.render()})}disconnectedCallback(){this.detachListeners()}queryParentRouterSlot(){return K(this)}constructAbsolutePath(e){return C(this,e)}add(e,n){this._routes.push(...e),n===void 0&&(n=this._routeMatch===null),n??=this.isRoot&&this.isConnected,n&&this.render().then()}clear(){this._routes.length=0}async render(){if(!this.isConnected)return;const e=this.parent!=null&&this.parent.fragments!=null?this.parent.fragments.rest:I();await this.renderPath(e)}attachListeners(){this.listeners.push(this.parent!=null?E(this.parent,"changestate",this.render):E(m,"changestate",this.render))}clearChildren(){for(;this.firstChild!=null;)this.firstChild.parentNode.removeChild(this.firstChild)}detachListeners(){S(this.listeners)}notifyChildRouters(e){this._routeMatch!==null&&requestAnimationFrame(()=>{$(this,e)})}async renderPath(e){const n=q(this._routes,e);if(n==null)return this._routeMatch=null,!1;const{route:r}=n,s={match:n,slot:this};try{const a=Y(this.match,n);if(a){let i=!1;const f=E(m,"changestate",()=>i=!0,{once:!0}),u=()=>{f()},d=()=>(u(),o("navigationcancel",s),o("navigationend",s),!1);if(o("navigationstart",s),r.guards!=null){for(const p of r.guards)if(!await p(s))return d()}if(this.notifyChildRouters(s),G(r))return u(),z(this,r),!1;if(B(r)){if(await r.resolve(s)===!1)return d()}else{const p=await U(r,s);if(i)return d();this.clearChildren(),this._routeMatch=n,this.appendChild(p)}u()}else this.notifyChildRouters(s);return this._routeMatch=n,a&&(o("navigationsuccess",s),o("navigationend",s)),a}catch(a){throw o("navigationerror",s),o("navigationend",s),a}}}window.customElements.define(v,Z);export{y as CATCH_ALL_WILDCARD,T as DEFAULT_PATH_MATCH,m as GLOBAL_ROUTER_EVENTS_TARGET,g as HISTORY_PATCH_NATIVE_KEY,L as PARAM_IDENTIFIER,v as ROUTER_SLOT_TAG_NAME,Z as RouterSlot,A as TRAVERSE_FLAG,E as addListener,b as attachCallback,W as basePath,C as constructAbsolutePath,w as constructPathWithBasePath,o as dispatchGlobalRouterEvent,$ as dispatchRouteChangeEvent,J as ensureAnchorHistory,N as ensureHistoryEvents,tt as ensureSlash,V as getFragments,z as handleRedirect,M as historyPatches,nt as isPathActive,G as isRedirectRoute,B as isResolverRoute,D as matchRoute,q as matchRoutes,R as path,I as pathWithoutBasePath,j as query,P as queryParentRoots,K as queryParentRouterSlot,_ as queryString,S as removeListeners,U as resolvePageComponent,x as saveNativeFunction,Y as shouldNavigate,h as slashify,l as stripSlash,k as stripStart,O as toQuery,et as toQueryString,Q as traverseRouterTree};
1
+ const C="**",P="\\.\\.\\/",A=/:([^\\/]+)/g,E="router-slot",f=window,m="native",T="prefix";function L(t,e){t.dispatchEvent(new CustomEvent("changestate",{detail:e}))}function o(t,e){f.dispatchEvent(new CustomEvent(t,{detail:e}))}function g(t,e,n,r){const s=Array.isArray(e)?e:[e];return s.forEach(a=>t.addEventListener(a,n,r)),()=>s.forEach(a=>t.removeEventListener(a,n,r))}function $(t){t.forEach(e=>e())}const S=[["pushState",["pushstate","changestate"]],["replaceState",["replacestate","changestate"]],["forward",["pushstate","changestate"]],["go",["pushstate","changestate"]],["back",["popstate"]]];function b(){for(const[t,e]of S)for(const n of e)M(history,t,n);window.addEventListener("popstate",t=>{if(x({eventName:"popstate"})){t.preventDefault(),t.stopPropagation();return}setTimeout(()=>o("changestate"),0)})}function M(t,e,n){const r=t[e];N(t,e,r),t[e]=(...s)=>{const a=s.length>2?s[2]:null;x({url:a,eventName:n})||(r.apply(t,s),o(n))}}function N(t,e,n){t[m]==null&&(t[m]={}),t[m][`${e}`]=n.bind(t)}function x(t){return!f.dispatchEvent(new CustomEvent("willchangestate",{cancelable:!0,detail:t}))}const H=document.createElement("a");function v(t={}){return p(window.location.pathname,t)}function W(t={}){return p(k(v(),I()),t)}function I(t={}){return R(".",t)}function R(t,e={}){return H.href=t,p(H.pathname,e)}function k(t,e){return t.replace(new RegExp(`^${e}`),"")}function _(){return window.location.search}function Z(){return q(_().substr(1))}function d(t){return p(t,{start:!1,end:!1})}function tt(t){return p(t,{start:!0,end:!0})}function p(t,{start:e=!0,end:n=!0}={}){return t=e&&!t.startsWith("/")?`/${t}`:!e&&t.startsWith("/")?t.slice(1):t,n&&!t.endsWith("/")?`${t}/`:!n&&t.endsWith("/")?t.slice(0,t.length-1):t}function q(t){if(t.length===0)return{};const e=t.split("&").map(n=>n.split("="));return Object.assign({},...e.map(n=>({[decodeURIComponent(n[0])]:n.length>1?decodeURIComponent(n[1]):""})))}function et(t){return Object.entries(t).map(([e,n])=>`${e}${n!=""?`=${encodeURIComponent(n)}`:""}`).join("&")}function nt(t,e=v()){return new RegExp(`^${d(t)}(/|$)`,"gm").test(d(e))}function F(t,e){const n=[],r=d(t.path.replace(A,(i,...u)=>(n.push(u[0]),"([^/]+)"))),s=t.path===C||t.path.length===0&&t.pathMatch!="full"?/^/:(()=>{switch(t.pathMatch||T){case"full":return new RegExp(`^${r}/?$`);case"suffix":return new RegExp(`^.*?${r}/?$`);case"fuzzy":return new RegExp(`^.*?${r}.*?$`);case"prefix":default:return new RegExp(`^[/]?${r}(?:/|$)`)}})(),a=e.match(s);if(a!=null){const i=n.reduce((c,l,X)=>(c[l]=a[X+1],c),{}),u=d(e.slice(0,a[0].length)),h=d(e.slice(a[0].length,e.length));return{route:t,match:a,params:i,fragments:{consumed:u,rest:h}}}return null}function O(t,e){for(const n of t){const r=F(n,e);if(r!=null)return r}return null}async function D(t,e){let n=t.component;if(n instanceof Function)try{n=n()}catch(a){if(!(a instanceof TypeError))throw a}const r=await Promise.resolve(n);let s;return r instanceof HTMLElement?s=r:s=new(r.default?r.default:r),t.setup!=null&&t.setup(s,e),s}function U(t){return"redirectTo"in t}function G(t){return"resolve"in t}function j(t){let e=[t];for(;t.parent!=null;)t=t.parent,e.push(t);const n=e.reduce((s,a)=>({slot:a,child:s}),void 0),r=e.length;return{tree:n,depth:r}}function B(t,e){let n=t;const r=[];for(;n!=null&&n.slot.match!=null&&e>0;)r.push(n.slot.match.fragments.consumed),n=n.child,e--;return r}function w(t,e=""){const{tree:n,depth:r}=j(t);if(!e.startsWith("/")){let s=0;e.startsWith("./")&&(e=e.slice(2));const a=e.match(new RegExp(P,"g"));if(a!=null){s=a.length;const u=a.reduce((h,c)=>h+c.length,0);e=e.slice(u)}const i=B(n,r-1-s).filter(u=>u.length>0);e=`${i.join("/")}${i.length>0?"/":""}${e}`}return R(e,{end:!1})}function Q(t,e){history.replaceState(history.state,"",`${w(t,e.redirectTo)}${e.preserveQuery?_():""}`)}function V(t,e){if(t==null)return!0;const{route:n,fragments:r}=t,{route:s,fragments:a}=e,i=n==s;return r.consumed!=a.consumed||!i}function z(t){return y(t,E)}function y(t,e,n=0,r=0){const s=t.getRootNode();if(r>=n){const i=s.querySelector(e);if(i!=null&&i!=t)return i}const a=s.getRootNode();return a.host==null?null:y(a.host,e,n,++r)}function Y(){window.addEventListener("click",t=>{const e="composedPath"in t?t.composedPath().find(r=>r instanceof HTMLAnchorElement):t.target;if(e==null||!(e instanceof HTMLAnchorElement)||!e.href.startsWith(location.origin)||e.target!==""&&e.target!=="_self"||e.dataset.routerSlot==="disabled")return;const n=e.pathname+e.search+e.hash;t.preventDefault(),history.pushState(null,"",n)})}const K=document.createElement("template");K.innerHTML="<slot></slot>",b(),Y();class J extends HTMLElement{listeners=[];_routes=[];get routes(){return this._routes}set routes(e){this.clear(),this.add(e)}_parent;get parent(){return this._parent}set parent(e){this._lockParent=!0,this._setParent(e)}_lockParent=!1;_setParent(e){this._parent!==e&&(this.detachListeners(),this._parent=e,this.attachListeners())}get isRoot(){return this.parent==null}_routeMatch=null;get match(){return this._routeMatch}get route(){return this.match!=null?this.match.route:null}get fragments(){return this.match!=null?this.match.fragments:null}get params(){return this.match!=null?this.match.params:null}constructor(){super(),this.addEventListener("router-slot:capture-parent",e=>{e.stopPropagation(),e.detail.parent=this}),this.render=this.render.bind(this),this.attachShadow({mode:"open"}).appendChild(K.content.cloneNode(!0))}connectedCallback(){if(!this._lockParent){const e=new CustomEvent("router-slot:capture-parent",{composed:!0,bubbles:!0,detail:{parent:null}});this.parentNode?(this.parentNode.dispatchEvent(e),this._setParent(e.detail.parent??null)):this._setParent(null)}this.parent&&this.parent.match!==null&&this.match===null&&requestAnimationFrame(()=>{this.render()})}disconnectedCallback(){this.detachListeners()}queryParentRouterSlot(){return z(this)}constructAbsolutePath(e){return w(this,e)}add(e,n){this._routes.push(...e),n===void 0&&(n=this._routeMatch===null),n??=this.isRoot&&this.isConnected,n&&this.render().then()}clear(){this._routes.length=0}async render(){if(!this.isConnected)return;const e=this.parent!=null&&this.parent.fragments!=null?this.parent.fragments.rest:W();await this.renderPath(e)}attachListeners(){this.listeners.push(this.parent!=null?g(this.parent,"changestate",this.render):g(f,"changestate",this.render))}clearChildren(){for(;this.firstChild!=null;)this.firstChild.parentNode.removeChild(this.firstChild)}detachListeners(){$(this.listeners)}notifyChildRouters(e){this._routeMatch!==null&&requestAnimationFrame(()=>{L(this,e)})}async renderPath(e){const n=O(this._routes,e);if(n==null)return this._routeMatch=null,!1;const{route:r}=n,s={match:n,slot:this};try{const a=V(this.match,n);if(a){let i=!1;const u=g(f,"changestate",()=>i=!0,{once:!0}),h=()=>{u()},c=()=>(h(),o("navigationcancel",s),o("navigationend",s),!1);if(o("navigationstart",s),r.guards!=null){for(const l of r.guards)if(!await l(s))return c()}if(this.notifyChildRouters(s),U(r))return h(),Q(this,r),!1;if(G(r)){if(await r.resolve(s)===!1)return c()}else{const l=await D(r,s);if(i)return c();this.clearChildren(),this._routeMatch=n,l&&this.appendChild(l)}h()}else this.notifyChildRouters(s);return this._routeMatch=n,a&&(o("navigationsuccess",s),o("navigationend",s)),a}catch(a){throw o("navigationerror",s),o("navigationend",s),a}}}window.customElements.define(E,J);export{C as CATCH_ALL_WILDCARD,T as DEFAULT_PATH_MATCH,f as GLOBAL_ROUTER_EVENTS_TARGET,m as HISTORY_PATCH_NATIVE_KEY,A as PARAM_IDENTIFIER,E as ROUTER_SLOT_TAG_NAME,J as RouterSlot,P as TRAVERSE_FLAG,g as addListener,M as attachCallback,I as basePath,w as constructAbsolutePath,R as constructPathWithBasePath,o as dispatchGlobalRouterEvent,L as dispatchRouteChangeEvent,Y as ensureAnchorHistory,b as ensureHistoryEvents,tt as ensureSlash,B as getFragments,Q as handleRedirect,S as historyPatches,nt as isPathActive,U as isRedirectRoute,G as isResolverRoute,F as matchRoute,O as matchRoutes,v as path,W as pathWithoutBasePath,Z as query,y as queryParentRoots,z as queryParentRouterSlot,_ as queryString,$ as removeListeners,D as resolvePageComponent,N as saveNativeFunction,V as shouldNavigate,p as slashify,d as stripSlash,k as stripStart,q as toQuery,et as toQueryString,j as traverseRouterTree};
@@ -0,0 +1,123 @@
1
+ export interface IRouterSlot<D = any, P = any> extends HTMLElement {
2
+ readonly route: IRoute<D> | null;
3
+ readonly isRoot: boolean;
4
+ readonly fragments: IPathFragments | null;
5
+ readonly params: Params | null;
6
+ readonly match: IRouteMatch<D> | null;
7
+ routes: IRoute<D>[];
8
+ add: ((routes: IRoute<D>[], navigate?: boolean) => void);
9
+ clear: (() => void);
10
+ render: (() => Promise<void>);
11
+ constructAbsolutePath: ((path: PathFragment) => string);
12
+ parent: IRouterSlot<P> | null | undefined;
13
+ queryParentRouterSlot: (() => IRouterSlot<P> | null);
14
+ }
15
+ export type IRoutingInfo<D = any, P = any> = {
16
+ slot: IRouterSlot<D, P>;
17
+ match: IRouteMatch<D>;
18
+ };
19
+ export type CustomResolver<D = any, P = any> = ((info: IRoutingInfo<D>) => boolean | void | Promise<boolean> | Promise<void>);
20
+ export type Guard<D = any, P = any> = ((info: IRoutingInfo<D, P>) => boolean | Promise<boolean>);
21
+ export type Cancel = (() => boolean);
22
+ export type PageComponent = HTMLElement | undefined;
23
+ export type ModuleResolver = Promise<{
24
+ default: any;
25
+ }>;
26
+ export type Class<T extends PageComponent = PageComponent> = {
27
+ new (...args: any[]): T;
28
+ };
29
+ export type Component = Class | ModuleResolver | PageComponent | (() => Class) | (() => PromiseLike<Class>) | (() => PageComponent) | (() => PromiseLike<PageComponent>) | (() => ModuleResolver) | (() => PromiseLike<ModuleResolver>);
30
+ export type Setup<D = any> = ((component: PageComponent, info: IRoutingInfo<D>) => void);
31
+ export type RouterTree<D = any, P = any> = {
32
+ slot: IRouterSlot<D, P>;
33
+ } & {
34
+ child?: RouterTree;
35
+ } | null | undefined;
36
+ export type PathMatch = "prefix" | "suffix" | "full" | "fuzzy";
37
+ /**
38
+ * The base route interface.
39
+ * D = the data type of the data
40
+ */
41
+ export interface IRouteBase<D = any> {
42
+ path: PathFragment;
43
+ data?: D;
44
+ guards?: Guard[];
45
+ pathMatch?: PathMatch;
46
+ }
47
+ /**
48
+ * Route type used for redirection.
49
+ */
50
+ export interface IRedirectRoute<D = any> extends IRouteBase<D> {
51
+ redirectTo: string;
52
+ preserveQuery?: boolean;
53
+ }
54
+ /**
55
+ * Route type used to resolve and stamp components.
56
+ */
57
+ export interface IComponentRoute<D = any> extends IRouteBase<D> {
58
+ component: Component | PromiseLike<Component>;
59
+ setup?: Setup;
60
+ }
61
+ /**
62
+ * Route type used to take control of how the route should resolve.
63
+ */
64
+ export interface IResolverRoute<D = any> extends IRouteBase<D> {
65
+ resolve: CustomResolver;
66
+ }
67
+ export type IRoute<D = any> = IRedirectRoute<D> | IComponentRoute<D> | IResolverRoute<D>;
68
+ export type PathFragment = string;
69
+ export type IPathFragments = {
70
+ consumed: PathFragment;
71
+ rest: PathFragment;
72
+ };
73
+ export interface IRouteMatch<D = any> {
74
+ route: IRoute<D>;
75
+ params: Params;
76
+ fragments: IPathFragments;
77
+ match: RegExpMatchArray;
78
+ }
79
+ export type PushStateEvent = CustomEvent<null>;
80
+ export type ReplaceStateEvent = CustomEvent<null>;
81
+ export type ChangeStateEvent = CustomEvent<null>;
82
+ export type WillChangeStateEvent = CustomEvent<{
83
+ url?: string | null;
84
+ eventName: GlobalRouterEvent;
85
+ }>;
86
+ export type NavigationStartEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
87
+ export type NavigationSuccessEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
88
+ export type NavigationCancelEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
89
+ export type NavigationErrorEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
90
+ export type NavigationEndEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
91
+ export type Params = {
92
+ [key: string]: string;
93
+ };
94
+ export type Query = {
95
+ [key: string]: string;
96
+ };
97
+ export type EventListenerSubscription = (() => void);
98
+ /**
99
+ * RouterSlot related events.
100
+ */
101
+ export type RouterSlotEvent = "changestate";
102
+ /**
103
+ * History related events.
104
+ */
105
+ export type GlobalRouterEvent = "pushstate" | "replacestate" | "popstate" | "changestate" | "willchangestate" | "navigationstart" | "navigationcancel" | "navigationerror" | "navigationsuccess" | "navigationend";
106
+ export interface ISlashOptions {
107
+ start: boolean;
108
+ end: boolean;
109
+ }
110
+ declare global {
111
+ interface GlobalEventHandlersEventMap {
112
+ "pushstate": PushStateEvent;
113
+ "replacestate": ReplaceStateEvent;
114
+ "popstate": PopStateEvent;
115
+ "changestate": ChangeStateEvent;
116
+ "navigationstart": NavigationStartEvent;
117
+ "navigationend": NavigationEndEvent;
118
+ "navigationsuccess": NavigationSuccessEvent;
119
+ "navigationcancel": NavigationCancelEvent;
120
+ "navigationerror": NavigationErrorEvent;
121
+ "willchangestate": WillChangeStateEvent;
122
+ }
123
+ }
@@ -0,0 +1,111 @@
1
+ import { IPathFragments, IRoute, IRouteMatch, IRouterSlot, IRoutingInfo, Params, PathFragment } from "./model.js";
2
+ /**
3
+ * Slot for a node in the router tree.
4
+ * @slot - Default content.
5
+ * @event changestate - Dispatched when the router slot state changes.
6
+ */
7
+ export declare class RouterSlot<D = any, P = any> extends HTMLElement implements IRouterSlot<D, P> {
8
+ /**
9
+ * Listeners on the router.
10
+ */
11
+ private listeners;
12
+ /**
13
+ * The available routes.
14
+ */
15
+ private _routes;
16
+ get routes(): IRoute<D>[];
17
+ set routes(routes: IRoute<D>[]);
18
+ /**
19
+ * The parent router.
20
+ * Is REQUIRED if this router is a child.
21
+ * When set, the relevant listeners are added or teared down because they depend on the parent.
22
+ */
23
+ _parent: IRouterSlot<P> | null | undefined;
24
+ get parent(): IRouterSlot<P> | null | undefined;
25
+ set parent(router: IRouterSlot<P> | null | undefined);
26
+ private _lockParent;
27
+ private _setParent;
28
+ /**
29
+ * Whether the router is a root router.
30
+ */
31
+ get isRoot(): boolean;
32
+ /**
33
+ * The current route match.
34
+ */
35
+ private _routeMatch;
36
+ get match(): IRouteMatch<D> | null;
37
+ /**
38
+ * The current route of the match.
39
+ */
40
+ get route(): IRoute<D> | null;
41
+ /**
42
+ * The current path fragment of the match
43
+ */
44
+ get fragments(): IPathFragments | null;
45
+ /**
46
+ * The current params of the match.
47
+ */
48
+ get params(): Params | null;
49
+ /**
50
+ * Hooks up the element.
51
+ */
52
+ constructor();
53
+ /**
54
+ * Query the parent router slot when the router slot is connected.
55
+ */
56
+ connectedCallback(): void;
57
+ /**
58
+ * Tears down the element.
59
+ */
60
+ disconnectedCallback(): void;
61
+ /**
62
+ * Queries the parent router.
63
+ */
64
+ queryParentRouterSlot(): IRouterSlot<P> | null;
65
+ /**
66
+ * Returns an absolute path relative to the router slot.
67
+ * @param path
68
+ */
69
+ constructAbsolutePath(path: PathFragment): string;
70
+ /**
71
+ * Adds routes to the router.
72
+ * Navigates automatically if the router slot is the root and is connected.
73
+ * @param routes
74
+ * @param navigate
75
+ */
76
+ add(routes: IRoute<D>[], navigate?: boolean): void;
77
+ /**
78
+ * Removes all routes.
79
+ */
80
+ clear(): void;
81
+ /**
82
+ * Each time the path changes, load the new path.
83
+ */
84
+ render(): Promise<void>;
85
+ /**
86
+ * Attaches listeners, either globally or on the parent router.
87
+ */
88
+ protected attachListeners(): void;
89
+ /**
90
+ * Clears the children in the DOM.
91
+ */
92
+ protected clearChildren(): void;
93
+ /**
94
+ * Detaches the listeners.
95
+ */
96
+ protected detachListeners(): void;
97
+ /**
98
+ * Notify the listeners.
99
+ */
100
+ notifyChildRouters<D = any>(info: IRoutingInfo<D>): void;
101
+ /**
102
+ * Loads a new path based on the routes.
103
+ * Returns true if a navigation was made to a new page.
104
+ */
105
+ protected renderPath(path: string | PathFragment): Promise<boolean>;
106
+ }
107
+ declare global {
108
+ interface HTMLElementTagNameMap {
109
+ "router-slot": RouterSlot;
110
+ }
111
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Hook up a click listener to the window that, for all anchor tags
3
+ * that has a relative HREF, uses the history API instead.
4
+ */
5
+ export declare function ensureAnchorHistory(): void;
@@ -0,0 +1,26 @@
1
+ import { EventListenerSubscription, GlobalRouterEvent, IRoutingInfo } from "../model";
2
+ /**
3
+ * Dispatches a did change route event.
4
+ * @param $elem
5
+ * @param {IRoute} detail
6
+ */
7
+ export declare function dispatchRouteChangeEvent<D = any>($elem: HTMLElement, detail: IRoutingInfo<D>): void;
8
+ /**
9
+ * Dispatches an event on the window object.
10
+ * @param name
11
+ * @param detail
12
+ */
13
+ export declare function dispatchGlobalRouterEvent<D = any>(name: GlobalRouterEvent, detail?: IRoutingInfo<D>): void;
14
+ /**
15
+ * Adds an event listener (or more) to an element and returns a function to unsubscribe.
16
+ * @param $elem
17
+ * @param type
18
+ * @param listener
19
+ * @param options
20
+ */
21
+ export declare function addListener<T extends Event, eventType extends string>($elem: EventTarget, type: eventType[] | eventType, listener: ((e: T) => void), options?: boolean | AddEventListenerOptions): EventListenerSubscription;
22
+ /**
23
+ * Removes the event listeners in the array.
24
+ * @param listeners
25
+ */
26
+ export declare function removeListeners(listeners: EventListenerSubscription[]): void;
@@ -0,0 +1,32 @@
1
+ import { GlobalRouterEvent } from "../model";
2
+ export declare const historyPatches: [string, GlobalRouterEvent[]][];
3
+ /**
4
+ * Patches the history object by ensuring correct events are dispatches when the history changes.
5
+ */
6
+ export declare function ensureHistoryEvents(): void;
7
+ /**
8
+ * Attaches a global router event after the native function on the object has been invoked.
9
+ * Stores the original function at the _name.
10
+ * @param obj
11
+ * @param functionName
12
+ * @param eventName
13
+ */
14
+ export declare function attachCallback(obj: any, functionName: string, eventName: GlobalRouterEvent): void;
15
+ /**
16
+ * Saves the native function on the history object.
17
+ * @param obj
18
+ * @param name
19
+ * @param func
20
+ */
21
+ export declare function saveNativeFunction(obj: any, name: string, func: (() => void)): void;
22
+ declare global {
23
+ interface History {
24
+ "native": {
25
+ "back": ((distance?: any) => void);
26
+ "forward": ((distance?: any) => void);
27
+ "go": ((delta?: any) => void);
28
+ "pushState": ((data: any, title?: string, url?: string | null) => void);
29
+ "replaceState": ((data: any, title?: string, url?: string | null) => void);
30
+ };
31
+ }
32
+ }
@@ -0,0 +1,6 @@
1
+ export * from './events.js';
2
+ export * from './history.js';
3
+ export * from './router.js';
4
+ export * from './shadow.js';
5
+ export * from './url.js';
6
+ export * from './anchor.js';
@@ -0,0 +1,72 @@
1
+ import { IComponentRoute, IRedirectRoute, IResolverRoute, IRoute, IRouteMatch, IRouterSlot, PageComponent, PathFragment, RouterTree, IRoutingInfo } from "../model";
2
+ /**
3
+ * Determines whether the path is active.
4
+ * If the full path starts with the path and is followed by the end of the string or a "/" the path is considered active.
5
+ * @param path
6
+ * @param fullPath
7
+ */
8
+ export declare function isPathActive(path: string | PathFragment, fullPath?: string): boolean;
9
+ /**
10
+ * Matches a route.
11
+ * @param route
12
+ * @param path
13
+ */
14
+ export declare function matchRoute<D = any>(route: IRoute<D>, path: string | PathFragment): IRouteMatch<D> | null;
15
+ /**
16
+ * Matches the first route that matches the given path.
17
+ * @param routes
18
+ * @param path
19
+ */
20
+ export declare function matchRoutes<D = any>(routes: IRoute<D>[], path: string | PathFragment): IRouteMatch<D> | null;
21
+ /**
22
+ * Returns the page from the route.
23
+ * If the component provided is a function (and not a class) call the function to get the promise.
24
+ * @param route
25
+ * @param info
26
+ */
27
+ export declare function resolvePageComponent(route: IComponentRoute, info: IRoutingInfo): Promise<PageComponent>;
28
+ /**
29
+ * Determines if a route is a redirect route.
30
+ * @param route
31
+ */
32
+ export declare function isRedirectRoute(route: IRoute): route is IRedirectRoute;
33
+ /**
34
+ * Determines if a route is a resolver route.
35
+ * @param route
36
+ */
37
+ export declare function isResolverRoute(route: IRoute): route is IResolverRoute;
38
+ /**
39
+ * Traverses the router tree up to the root route.
40
+ * @param slot
41
+ */
42
+ export declare function traverseRouterTree(slot: IRouterSlot): {
43
+ tree: RouterTree;
44
+ depth: number;
45
+ };
46
+ /**
47
+ * Generates a path based on the router tree.
48
+ * @param tree
49
+ * @param depth
50
+ */
51
+ export declare function getFragments(tree: RouterTree, depth: number): PathFragment[];
52
+ /**
53
+ * Constructs the correct absolute path based on a router.
54
+ * - Handles relative paths: "mypath"
55
+ * - Handles absolute paths: "/mypath"
56
+ * - Handles traversing paths: "../../mypath"
57
+ * @param slot
58
+ * @param path
59
+ */
60
+ export declare function constructAbsolutePath<D = any, P = any>(slot: IRouterSlot<D, P>, path?: string | PathFragment): string;
61
+ /**
62
+ * Handles a redirect.
63
+ * @param slot
64
+ * @param route
65
+ */
66
+ export declare function handleRedirect(slot: IRouterSlot, route: IRedirectRoute): void;
67
+ /**
68
+ * Determines whether the navigation should start based on the current match and the new match.
69
+ * @param currentMatch
70
+ * @param newMatch
71
+ */
72
+ export declare function shouldNavigate<D>(currentMatch: IRouteMatch<D> | null, newMatch: IRouteMatch<D>): boolean;
@@ -0,0 +1,15 @@
1
+ import { IRouterSlot } from "../model";
2
+ /**
3
+ * Queries the parent router.
4
+ * @param $elem
5
+ */
6
+ export declare function queryParentRouterSlot<D = any>($elem: Element): IRouterSlot<D> | null;
7
+ /**
8
+ * Traverses the roots and returns the first match.
9
+ * The minRoots parameter indicates how many roots should be traversed before we started matching with the query.
10
+ * @param $elem
11
+ * @param query
12
+ * @param minRoots
13
+ * @param roots
14
+ */
15
+ export declare function queryParentRoots<T>($elem: Element, query: string, minRoots?: number, roots?: number): T | null;
@@ -0,0 +1,78 @@
1
+ import { ISlashOptions, Query } from "../model";
2
+ /**
3
+ * The current path of the location.
4
+ * As default slashes are included at the start and end.
5
+ * @param options
6
+ */
7
+ export declare function path(options?: Partial<ISlashOptions>): string;
8
+ /**
9
+ * Returns the path without the base path.
10
+ * @param options
11
+ */
12
+ export declare function pathWithoutBasePath(options?: Partial<ISlashOptions>): string;
13
+ /**
14
+ * Returns the base path as defined in the <base> tag in the head in a reliable way.
15
+ * If eg. <base href="/router-slot/"> is defined this function will return "/router-slot/".
16
+ *
17
+ * An alternative would be to use regex on document.baseURI,
18
+ * but that will be unreliable in some cases because it
19
+ * doesn't use the built in HTMLHyperlinkElementUtils.
20
+ *
21
+ * To make this method more performant we could cache the anchor element.
22
+ * As default it will return the base path with slashes in front and at the end.
23
+ */
24
+ export declare function basePath(options?: Partial<ISlashOptions>): string;
25
+ /**
26
+ * Creates an URL using the built in HTMLHyperlinkElementUtils.
27
+ * An alternative would be to use regex on document.baseURI,
28
+ * but that will be unreliable in some cases because it
29
+ * doesn't use the built in HTMLHyperlinkElementUtils.
30
+ *
31
+ * As default it will return the base path with slashes in front and at the end.
32
+ * @param path
33
+ * @param options
34
+ */
35
+ export declare function constructPathWithBasePath(path: string, options?: Partial<ISlashOptions>): string;
36
+ /**
37
+ * Removes the start of the path that matches the part.
38
+ * @param path
39
+ * @param part
40
+ */
41
+ export declare function stripStart(path: string, part: string): string;
42
+ /**
43
+ * Returns the query string.
44
+ */
45
+ export declare function queryString(): string;
46
+ /**
47
+ * Returns the params for the current path.
48
+ * @returns Params
49
+ */
50
+ export declare function query(): Query;
51
+ /**
52
+ * Strips the slash from the start and end of a path.
53
+ * @param path
54
+ */
55
+ export declare function stripSlash(path: string): string;
56
+ /**
57
+ * Ensures the path starts and ends with a slash
58
+ * @param path
59
+ */
60
+ export declare function ensureSlash(path: string): string;
61
+ /**
62
+ * Makes sure that the start and end slashes are present or not depending on the options.
63
+ * @param path
64
+ * @param start
65
+ * @param end
66
+ */
67
+ export declare function slashify(path: string, { start, end }?: Partial<ISlashOptions>): string;
68
+ /**
69
+ * Turns a query string into an object.
70
+ * @param {string} queryString (example: ("test=123&hejsa=LOL&wuhuu"))
71
+ * @returns {Query}
72
+ */
73
+ export declare function toQuery(queryString: string): Query;
74
+ /**
75
+ * Turns a query object into a string query.
76
+ * @param query
77
+ */
78
+ export declare function toQueryString(query: Query): string;
@@ -0,0 +1 @@
1
+ export * from './util/index.js';
@@ -34,7 +34,8 @@ export class UmbObserver {
34
34
  });
35
35
  }
36
36
  hostConnected() {
37
- if (this.#subscription.closed) {
37
+ // Notice: This will not re-subscribe if this controller was destroyed. Only if the subscription was closed.
38
+ if (this.#subscription?.closed) {
38
39
  this.#subscription = this.#source.subscribe(this.#callback);
39
40
  }
40
41
  }
@@ -13,7 +13,7 @@ import { handlers as examineManagementHandlers } from './handlers/examine-manage
13
13
  import { handlers as modelsBuilderHandlers } from './handlers/modelsbuilder.handlers.js';
14
14
  import { handlers as healthCheckHandlers } from './handlers/health-check.handlers.js';
15
15
  import { handlers as profilingHandlers } from './handlers/performance-profiling.handlers.js';
16
- import { handlers as documentHandlers } from './handlers/document.handlers.js';
16
+ import { handlers as documentHandlers } from './handlers/document/index.js';
17
17
  import { handlers as mediaHandlers } from './handlers/media.handlers.js';
18
18
  import { handlers as dictionaryHandlers } from './handlers/dictionary.handlers.js';
19
19
  import { handlers as mediaTypeHandlers } from './handlers/media-type.handlers.js';
@@ -1,5 +1,5 @@
1
1
  import { UmbEntityData } from './entity.data.js';
2
- import { DocumentResponseModel, DocumentTreeItemResponseModel, PagedDocumentTreeItemResponseModel, PagedDocumentTypeResponseModel } from '../../external/backend-api/index.js';
2
+ import { DocumentItemResponseModel, DocumentResponseModel, DocumentTreeItemResponseModel, PagedDocumentTreeItemResponseModel, PagedDocumentTypeResponseModel, PagedRecycleBinItemResponseModel } from '../../external/backend-api/index.js';
3
3
  export declare const data: Array<DocumentResponseModel>;
4
4
  export declare const treeData: Array<DocumentTreeItemResponseModel>;
5
5
  declare class UmbDocumentData extends UmbEntityData<DocumentResponseModel> {
@@ -7,11 +7,15 @@ declare class UmbDocumentData extends UmbEntityData<DocumentResponseModel> {
7
7
  constructor();
8
8
  insert(item: DocumentResponseModel): DocumentResponseModel;
9
9
  update(id: string, item: DocumentResponseModel): DocumentResponseModel;
10
+ trash(ids: string[]): DocumentResponseModel[];
10
11
  getTreeRoot(): PagedDocumentTreeItemResponseModel;
11
- getTreeItemChildren(id: string): PagedDocumentTreeItemResponseModel;
12
+ getTreeItemChildrenOf(id: string): PagedDocumentTreeItemResponseModel;
12
13
  getTreeItem(ids: Array<string>): Array<DocumentTreeItemResponseModel>;
14
+ getItems(ids: Array<string>): Array<DocumentItemResponseModel>;
13
15
  getDocumentByIdAllowedDocumentTypes(id: string): PagedDocumentTypeResponseModel;
14
16
  getAllowedDocumentTypesAtRoot(): PagedDocumentTypeResponseModel;
17
+ getRecycleBinRoot(): PagedRecycleBinItemResponseModel;
18
+ getRecycleBinChildrenOf(parentId: string): PagedRecycleBinItemResponseModel;
15
19
  }
16
20
  export declare const umbDocumentData: UmbDocumentData;
17
21
  export {};