crelte 0.5.8 → 0.5.10

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 (175) hide show
  1. package/dist/blocks/Blocks.d.ts +41 -4
  2. package/dist/blocks/Blocks.d.ts.map +1 -1
  3. package/dist/blocks/Blocks.js +47 -2
  4. package/dist/blocks/Blocks.svelte +2 -16
  5. package/dist/blocks/Blocks.svelte.d.ts +20 -37
  6. package/dist/blocks/Blocks.svelte.d.ts.map +1 -1
  7. package/dist/blocks/index.d.ts +2 -2
  8. package/dist/blocks/index.d.ts.map +1 -1
  9. package/dist/blocks/index.js +2 -2
  10. package/dist/cookies/ServerCookies.d.ts +1 -1
  11. package/dist/cookies/ServerCookies.js +1 -1
  12. package/dist/cookies/index.d.ts +1 -1
  13. package/dist/crelte.d.ts +21 -10
  14. package/dist/crelte.d.ts.map +1 -1
  15. package/dist/index.d.ts +19 -14
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +17 -13
  18. package/dist/init/client.d.ts +2 -2
  19. package/dist/init/client.d.ts.map +1 -1
  20. package/dist/init/client.js +3 -2
  21. package/dist/init/server.d.ts +7 -6
  22. package/dist/init/server.d.ts.map +1 -1
  23. package/dist/init/server.js +6 -6
  24. package/dist/loadData/Globals.d.ts +3 -3
  25. package/dist/loadData/Globals.js +3 -3
  26. package/dist/loadData/loadData.d.ts +8 -18
  27. package/dist/loadData/loadData.d.ts.map +1 -1
  28. package/dist/loadData/loadData.js +2 -2
  29. package/dist/node/index.d.ts +5 -0
  30. package/dist/node/index.d.ts.map +1 -1
  31. package/dist/node/index.js +84 -35
  32. package/dist/plugins/Events.d.ts +4 -4
  33. package/dist/plugins/Plugins.d.ts +2 -2
  34. package/dist/plugins/index.d.ts +2 -3
  35. package/dist/plugins/index.d.ts.map +1 -1
  36. package/dist/plugins/index.js +2 -1
  37. package/dist/queries/Queries.d.ts +9 -0
  38. package/dist/queries/Queries.d.ts.map +1 -1
  39. package/dist/queries/Queries.js +29 -17
  40. package/dist/queries/QueryError.d.ts +2 -0
  41. package/dist/queries/QueryError.d.ts.map +1 -1
  42. package/dist/queries/QueryError.js +6 -1
  43. package/dist/queries/gql.d.ts +2 -2
  44. package/dist/queries/gql.js +2 -2
  45. package/dist/queries/index.d.ts +7 -5
  46. package/dist/queries/index.d.ts.map +1 -1
  47. package/dist/queries/vars.d.ts +7 -7
  48. package/dist/queries/vars.d.ts.map +1 -1
  49. package/dist/queries/vars.js +10 -8
  50. package/dist/routing/LoadRunner.d.ts +1 -1
  51. package/dist/routing/LoadRunner.js +1 -1
  52. package/dist/routing/index.d.ts +4 -4
  53. package/dist/routing/index.d.ts.map +1 -1
  54. package/dist/routing/route/BaseRoute.d.ts +25 -25
  55. package/dist/routing/route/BaseRoute.js +24 -24
  56. package/dist/routing/route/Request.d.ts +4 -4
  57. package/dist/routing/route/Request.js +4 -4
  58. package/dist/routing/route/Route.d.ts +2 -2
  59. package/dist/routing/route/Route.js +2 -2
  60. package/dist/routing/router/BaseRouter.d.ts +4 -4
  61. package/dist/routing/router/BaseRouter.js +3 -3
  62. package/dist/routing/router/ClientRouter.d.ts +1 -1
  63. package/dist/routing/router/ClientRouter.js +1 -1
  64. package/dist/routing/router/Router.d.ts +27 -25
  65. package/dist/routing/router/Router.d.ts.map +1 -1
  66. package/dist/routing/router/Router.js +24 -21
  67. package/dist/routing/router/ServerRouter.d.ts +1 -1
  68. package/dist/routing/router/ServerRouter.js +1 -1
  69. package/dist/server/CrelteServer.d.ts +5 -5
  70. package/dist/server/CrelteServer.d.ts.map +1 -1
  71. package/dist/server/CrelteServer.js +4 -4
  72. package/dist/server/Request.d.ts +7 -1
  73. package/dist/server/Request.d.ts.map +1 -1
  74. package/dist/server/Request.js +7 -1
  75. package/dist/server/ServerRouter.d.ts +1 -1
  76. package/dist/server/ServerRouter.d.ts.map +1 -1
  77. package/dist/server/index.d.ts +4 -4
  78. package/dist/server/index.d.ts.map +1 -1
  79. package/dist/server/index.js +1 -1
  80. package/dist/server/shared.d.ts +7 -13
  81. package/dist/server/shared.d.ts.map +1 -1
  82. package/dist/server/shared.js +14 -16
  83. package/dist/ssr/SsrCache.d.ts +56 -4
  84. package/dist/ssr/SsrCache.d.ts.map +1 -1
  85. package/dist/ssr/SsrCache.js +94 -20
  86. package/dist/std/index.d.ts +13 -0
  87. package/dist/std/index.d.ts.map +1 -1
  88. package/dist/std/index.js +13 -0
  89. package/dist/std/rand/index.d.ts +34 -0
  90. package/dist/std/rand/index.d.ts.map +1 -0
  91. package/dist/std/rand/index.js +45 -0
  92. package/dist/std/rand/internal.d.ts +8 -0
  93. package/dist/std/rand/internal.d.ts.map +1 -0
  94. package/dist/std/rand/internal.js +15 -0
  95. package/dist/std/stores/Writable.d.ts +1 -1
  96. package/dist/std/stores/Writable.js +1 -1
  97. package/dist/translations/index.d.ts +28 -0
  98. package/dist/translations/index.d.ts.map +1 -0
  99. package/dist/translations/index.js +31 -0
  100. package/dist/translations/loadTranslations.d.ts +23 -0
  101. package/dist/translations/loadTranslations.d.ts.map +1 -0
  102. package/dist/translations/loadTranslations.js +26 -0
  103. package/dist/translations/loader/GlobalLoader.d.ts +34 -0
  104. package/dist/translations/loader/GlobalLoader.d.ts.map +1 -0
  105. package/dist/translations/loader/GlobalLoader.js +45 -0
  106. package/dist/translations/loader/fileLoader/ClientFileLoader.d.ts +10 -0
  107. package/dist/translations/loader/fileLoader/ClientFileLoader.d.ts.map +1 -0
  108. package/dist/translations/loader/fileLoader/ClientFileLoader.js +24 -0
  109. package/dist/translations/loader/fileLoader/NodeFileLoader.d.ts +9 -0
  110. package/dist/translations/loader/fileLoader/NodeFileLoader.d.ts.map +1 -0
  111. package/dist/translations/loader/fileLoader/NodeFileLoader.js +21 -0
  112. package/dist/translations/loader/fileLoader/fileLoader.d.ts +5 -0
  113. package/dist/translations/loader/fileLoader/fileLoader.d.ts.map +1 -0
  114. package/dist/translations/loader/fileLoader/fileLoader.js +16 -0
  115. package/dist/translations/loader/index.d.ts +7 -0
  116. package/dist/translations/loader/index.d.ts.map +1 -0
  117. package/dist/translations/loader/index.js +1 -0
  118. package/dist/translations/translationsPlugin.d.ts +64 -0
  119. package/dist/translations/translationsPlugin.d.ts.map +1 -0
  120. package/dist/translations/translationsPlugin.js +110 -0
  121. package/dist/translations/utils.d.ts +8 -0
  122. package/dist/translations/utils.d.ts.map +1 -0
  123. package/dist/translations/utils.js +15 -0
  124. package/dist/vite/index.d.ts.map +1 -1
  125. package/dist/vite/index.js +30 -38
  126. package/package.json +9 -1
  127. package/src/blocks/Blocks.svelte +3 -78
  128. package/src/blocks/Blocks.ts +63 -6
  129. package/src/blocks/index.ts +2 -2
  130. package/src/cookies/ServerCookies.ts +1 -1
  131. package/src/cookies/index.ts +1 -1
  132. package/src/crelte.ts +21 -10
  133. package/src/index.ts +19 -14
  134. package/src/init/client.ts +3 -2
  135. package/src/init/server.ts +14 -8
  136. package/src/loadData/Globals.ts +3 -3
  137. package/src/loadData/loadData.ts +8 -18
  138. package/src/node/index.ts +100 -39
  139. package/src/plugins/Events.ts +4 -4
  140. package/src/plugins/Plugins.ts +2 -2
  141. package/src/plugins/index.ts +2 -3
  142. package/src/queries/Queries.ts +35 -18
  143. package/src/queries/QueryError.ts +10 -1
  144. package/src/queries/gql.ts +2 -2
  145. package/src/queries/index.ts +7 -4
  146. package/src/queries/vars.ts +12 -8
  147. package/src/routing/LoadRunner.ts +1 -1
  148. package/src/routing/index.ts +13 -3
  149. package/src/routing/route/BaseRoute.ts +25 -25
  150. package/src/routing/route/Request.ts +4 -4
  151. package/src/routing/route/Route.ts +2 -2
  152. package/src/routing/router/BaseRouter.ts +4 -4
  153. package/src/routing/router/ClientRouter.ts +1 -1
  154. package/src/routing/router/Router.ts +28 -25
  155. package/src/routing/router/ServerRouter.ts +1 -1
  156. package/src/server/CrelteServer.ts +5 -5
  157. package/src/server/Request.ts +7 -1
  158. package/src/server/ServerRouter.ts +1 -2
  159. package/src/server/index.ts +17 -3
  160. package/src/server/shared.ts +28 -33
  161. package/src/ssr/SsrCache.ts +104 -22
  162. package/src/std/index.ts +14 -0
  163. package/src/std/rand/index.ts +55 -0
  164. package/src/std/rand/internal.ts +17 -0
  165. package/src/std/stores/Writable.ts +1 -1
  166. package/src/translations/index.ts +56 -0
  167. package/src/translations/loadTranslations.ts +33 -0
  168. package/src/translations/loader/GlobalLoader.ts +62 -0
  169. package/src/translations/loader/fileLoader/ClientFileLoader.ts +40 -0
  170. package/src/translations/loader/fileLoader/NodeFileLoader.ts +32 -0
  171. package/src/translations/loader/fileLoader/fileLoader.ts +19 -0
  172. package/src/translations/loader/index.ts +8 -0
  173. package/src/translations/translationsPlugin.ts +145 -0
  174. package/src/translations/utils.ts +17 -0
  175. package/src/vite/index.ts +43 -39
@@ -70,12 +70,12 @@ export default class Request extends BaseRoute {
70
70
  * With delayRender you can make sure that the render waits
71
71
  * until you are ready. This is useful for building page transitions.
72
72
  *
73
- * ## Important
73
+ * #### Important
74
74
  * If you call delayRender you need to call `ready/remove` or the render
75
75
  * will never happen
76
76
  *
77
- * ## Example
78
- * ```
77
+ * #### Example
78
+ * ```js
79
79
  * import { onRequest } from 'crelte';
80
80
  * import { animate } from 'motion';
81
81
  *
@@ -110,7 +110,7 @@ export default class Request extends BaseRoute {
110
110
  /**
111
111
  * Create a Route from the Request
112
112
  *
113
- * ## Throws
113
+ * #### Throws
114
114
  * if the entry, template or loadedData is missing
115
115
  * or the request was cancelled
116
116
  */
@@ -75,12 +75,12 @@ export default class Request extends BaseRoute {
75
75
  * With delayRender you can make sure that the render waits
76
76
  * until you are ready. This is useful for building page transitions.
77
77
  *
78
- * ## Important
78
+ * #### Important
79
79
  * If you call delayRender you need to call `ready/remove` or the render
80
80
  * will never happen
81
81
  *
82
- * ## Example
83
- * ```
82
+ * #### Example
83
+ * ```js
84
84
  * import { onRequest } from 'crelte';
85
85
  * import { animate } from 'motion';
86
86
  *
@@ -139,7 +139,7 @@ export default class Request extends BaseRoute {
139
139
  /**
140
140
  * Create a Route from the Request
141
141
  *
142
- * ## Throws
142
+ * #### Throws
143
143
  * if the entry, template or loadedData is missing
144
144
  * or the request was cancelled
145
145
  */
@@ -37,14 +37,14 @@ export default class Route extends BaseRoute {
37
37
  /**
38
38
  * Create a new Route
39
39
  *
40
- * ## Note
40
+ * #### Note
41
41
  * This should only be created by crelte
42
42
  */
43
43
  constructor(url: string | URL, site: Site, entry: Entry, template: TemplateModule, loadedData: Record<string, any>, opts?: RouteOptions);
44
44
  /**
45
45
  * Create a copy of the EntryRoute
46
46
  *
47
- * ## Note
47
+ * #### Note
48
48
  * This does not make a copy of the entry, template or loadedData.
49
49
  */
50
50
  clone(): Route;
@@ -25,7 +25,7 @@ export default class Route extends BaseRoute {
25
25
  /**
26
26
  * Create a new Route
27
27
  *
28
- * ## Note
28
+ * #### Note
29
29
  * This should only be created by crelte
30
30
  */
31
31
  constructor(url, site, entry, template, loadedData, opts = {}) {
@@ -38,7 +38,7 @@ export default class Route extends BaseRoute {
38
38
  /**
39
39
  * Create a copy of the EntryRoute
40
40
  *
41
- * ## Note
41
+ * #### Note
42
42
  * This does not make a copy of the entry, template or loadedData.
43
43
  */
44
44
  clone() {
@@ -17,14 +17,14 @@ export default class BaseRouter {
17
17
  /**
18
18
  * The current route
19
19
  *
20
- * ## Note
20
+ * #### Note
21
21
  * Will always contain a route except in the first loadData call
22
22
  */
23
23
  route: Writable<Route | null>;
24
24
  /**
25
25
  * The current site
26
26
  *
27
- * ## Note
27
+ * #### Note
28
28
  * Will always contain a site except in the first loadData call
29
29
  */
30
30
  site: Writable<Site | null>;
@@ -55,7 +55,7 @@ export default class BaseRouter {
55
55
  onRouteListeners: Listeners<[Route]>;
56
56
  onRender: (cr: CrelteRequest,
57
57
  /**
58
- * ## Throws
58
+ * #### Throws
59
59
  * if the route is missing entry, template or loadedData
60
60
  */
61
61
  readyForRoute: () => Route, domUpdated: (cr: CrelteRequest, route: Route) => void) => Promise<Route> | Route;
@@ -103,7 +103,7 @@ export default class BaseRouter {
103
103
  preload(target: string | URL | Route | Request): Promise<void>;
104
104
  cancelRequest(): void;
105
105
  /**
106
- * ## Throws
106
+ * #### Throws
107
107
  * If the request completed but had an error
108
108
  */
109
109
  handleRequest(req: Request, updateHistory: (route: Route) => void): Promise<Route | void>;
@@ -16,7 +16,7 @@ export default class BaseRouter {
16
16
  /**
17
17
  * The current route
18
18
  *
19
- * ## Note
19
+ * #### Note
20
20
  * Will always contain a route except in the first loadData call
21
21
  */
22
22
  route;
@@ -24,7 +24,7 @@ export default class BaseRouter {
24
24
  /**
25
25
  * The current site
26
26
  *
27
- * ## Note
27
+ * #### Note
28
28
  * Will always contain a site except in the first loadData call
29
29
  */
30
30
  site;
@@ -190,7 +190,7 @@ export default class BaseRouter {
190
190
  }
191
191
  }
192
192
  /**
193
- * ## Throws
193
+ * #### Throws
194
194
  * If the request completed but had an error
195
195
  */
196
196
  async handleRequest(req, updateHistory) {
@@ -12,7 +12,7 @@ export default class ClientRouter extends BaseRouter {
12
12
  onError: (e: any, req: Request) => void;
13
13
  constructor(sites: SiteFromGraphQl[], opts: ClientRouterOptions);
14
14
  /**
15
- * ## Throws
15
+ * #### Throws
16
16
  */
17
17
  init(): Promise<void | Route>;
18
18
  /**
@@ -11,7 +11,7 @@ export default class ClientRouter extends BaseRouter {
11
11
  this.onError = () => { };
12
12
  }
13
13
  /**
14
- * ## Throws
14
+ * #### Throws
15
15
  */
16
16
  async init() {
17
17
  this.listen();
@@ -1,4 +1,3 @@
1
- import BaseRouter from './BaseRouter.js';
2
1
  import { Request, RequestOptions, Route, Site } from '../index.js';
3
2
  import { CrelteRequest } from '../../crelte.js';
4
3
  import { Readable } from '../../std/stores/index.js';
@@ -8,20 +7,23 @@ import { Entry } from '../../loadData/index.js';
8
7
  *
9
8
  * If you return `false` the request will be aborted
10
9
  *
11
- * ## Example
12
- * ```
10
+ * #### Example
11
+ * ```js
13
12
  * router.replace(req => (req.hash = ''));
14
13
  * ```
15
14
  */
16
15
  export type UpdateRequest = (req: Request) => boolean | null | undefined | void;
16
+ /**
17
+ * The Crelte Router
18
+ */
17
19
  export default class Router {
18
20
  private inner;
19
21
  private _request;
20
- constructor(inner: BaseRouter);
22
+ constructor(inner: any);
21
23
  /**
22
24
  * returns a store with the current route
23
25
  *
24
- * ## Note
26
+ * #### Note
25
27
  * Will always contain a route except in the first loadData call this
26
28
  * is intentional since you will get the wrong route in a loadData call.
27
29
  * In a loadData you should always use the `CrelteRequest` provided
@@ -31,10 +33,10 @@ export default class Router {
31
33
  /**
32
34
  * returns a store with the current site
33
35
  *
34
- * ## Note
36
+ * #### Note
35
37
  * Will always contain a site except in the first loadData call this
36
38
  * is intentional since you might get the wrong site if a site switch
37
- * is happening and you call this in loadData. If possible use the CrelteRequest
39
+ * is happening and you call this in loadData. If possible use the {@link CrelteRequest#site}
38
40
  * provided in each loadData call.
39
41
  *
40
42
  * Else use `router.site.get() ?? router.req.site`
@@ -43,7 +45,7 @@ export default class Router {
43
45
  /**
44
46
  * returns a store with the current entry
45
47
  *
46
- * ## Note
48
+ * #### Note
47
49
  * Will always contain an entry except in the first loadData call this
48
50
  * is intentional since you might get the wrong entry if a request is happening
49
51
  * and you call this in loadData. If possible use the CrelteRequest
@@ -53,8 +55,8 @@ export default class Router {
53
55
  /**
54
56
  * returns the latest request in progress otherwise returns null.
55
57
  *
56
- * ## Important !!
57
- * If at all possible prefer using the `CrelteRequest` provided in each
58
+ * #### Important !!
59
+ * If at all possible prefer using the {@link CrelteRequest} provided in each
58
60
  * loadData call. For example in a preload request this will return null.
59
61
  * Or a user has clicked multiple times on different links you might get
60
62
  * the url of the newer request.
@@ -83,7 +85,7 @@ export default class Router {
83
85
  */
84
86
  primarySite(): Site;
85
87
  /**
86
- * Returns a site which is preffered based on the users language
88
+ * Returns a site which is preferred based on the users language
87
89
  *
88
90
  * Returns null if no site could be determined
89
91
  */
@@ -95,11 +97,11 @@ export default class Router {
95
97
  * the url needs to start with http or with a / which will be considered as
96
98
  * the site baseUrl
97
99
  *
98
- * ## Note
100
+ * #### Note
99
101
  * The origin will always be set to 'manual'
100
102
  *
101
- * ## Example
102
- * ```
103
+ * #### Example
104
+ * ```js
103
105
  * import { getRouter } from 'crelte';
104
106
  *
105
107
  * const router = getRouter();
@@ -116,13 +118,13 @@ export default class Router {
116
118
  * You can use this when using pagination for example change the route object
117
119
  * (search argument) and then call push
118
120
  *
119
- * ## Note
121
+ * #### Note
120
122
  * This will always set the origin to 'push'
121
123
  * And will clear the scrollY value if you dont provide a new one via the `opts`
122
124
  * This will disableLoadData by default if you dont provide an override via the `opts`
123
125
  *
124
- * ## Example using the update function
125
- * ```
126
+ * #### Example using the update function
127
+ * ```js
126
128
  * import { getRouter } from 'crelte';
127
129
  *
128
130
  * const router = getRouter();
@@ -131,8 +133,8 @@ export default class Router {
131
133
  * router.push(req => req.setSearchParam('page', page || null));
132
134
  * ```
133
135
  *
134
- * ## Example using the route object
135
- * ```
136
+ * #### Example using the route object
137
+ * ```js
136
138
  * import { getRouter } from 'crelte';
137
139
  *
138
140
  * const router = getRouter();
@@ -153,13 +155,13 @@ export default class Router {
153
155
  *
154
156
  * You can use this when using some filters for example a search filter
155
157
  *
156
- * ## Note
158
+ * #### Note
157
159
  * This will always set the origin to 'replace'
158
160
  * And will clear the scrollY value if you don't provide a new one via the `opts`
159
161
  * This will disableLoadData by default if you don't provide an override via the `opts`
160
162
  *
161
- * ## Example using the update function
162
- * ```
163
+ * #### Example using the update function
164
+ * ```js
163
165
  * import { getRouter } from 'crelte';
164
166
  *
165
167
  * const router = getRouter();
@@ -168,8 +170,8 @@ export default class Router {
168
170
  * router.replace(req => req.setSearchParam('search', search));
169
171
  * ```
170
172
  *
171
- * ## Example using the route object
172
- * ```
173
+ * #### Example using the route object
174
+ * ```js
173
175
  * import { getRouter } from 'crelte';
174
176
  *
175
177
  * const router = getRouter();
@@ -223,7 +225,7 @@ export default class Router {
223
225
  * Resolve a url or Route and convert it to a Request
224
226
  *
225
227
  * @param target
226
- * @param opts, any option present will override the value in target
228
+ * @param opts any option present will override the value in target
227
229
  * @return Returns null if the url does not match our host (the protocol get's ignored)
228
230
  */
229
231
  targetToRequest(target: string | URL | Route | Request, opts?: RequestOptions): Request;
@@ -1 +1 @@
1
- {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../../src/routing/router/Router.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;AAEhF,MAAM,CAAC,OAAO,OAAO,MAAM;IAC1B,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,QAAQ,CAAiB;gBAErB,KAAK,EAAE,UAAU;IAK7B;;;;;;;;OAQG;IACH,IAAI,KAAK,IAAI,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,CAElC;IAED;;;;;;;;;;OAUG;IACH,IAAI,IAAI,IAAI,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,CAEhC;IAED;;;;;;;;OAQG;IACH,IAAI,KAAK,IAAI,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,CAElC;IAED;;;;;;;;OAQG;IACH,IAAI,GAAG,IAAI,OAAO,GAAG,IAAI,CAMxB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,IAAI,EAAE,CAElB;IAED;;;;OAIG;IACH,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAEjC;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,QAAQ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B/B;;;OAGG;IACH,WAAW,CAAC,GAAG,EAAE,OAAO;IAMxB,iBAAiB;CAGjB"}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * The Crelte Router
3
+ */
1
4
  export default class Router {
2
5
  inner;
3
6
  _request;
@@ -8,7 +11,7 @@ export default class Router {
8
11
  /**
9
12
  * returns a store with the current route
10
13
  *
11
- * ## Note
14
+ * #### Note
12
15
  * Will always contain a route except in the first loadData call this
13
16
  * is intentional since you will get the wrong route in a loadData call.
14
17
  * In a loadData you should always use the `CrelteRequest` provided
@@ -20,10 +23,10 @@ export default class Router {
20
23
  /**
21
24
  * returns a store with the current site
22
25
  *
23
- * ## Note
26
+ * #### Note
24
27
  * Will always contain a site except in the first loadData call this
25
28
  * is intentional since you might get the wrong site if a site switch
26
- * is happening and you call this in loadData. If possible use the CrelteRequest
29
+ * is happening and you call this in loadData. If possible use the {@link CrelteRequest#site}
27
30
  * provided in each loadData call.
28
31
  *
29
32
  * Else use `router.site.get() ?? router.req.site`
@@ -34,7 +37,7 @@ export default class Router {
34
37
  /**
35
38
  * returns a store with the current entry
36
39
  *
37
- * ## Note
40
+ * #### Note
38
41
  * Will always contain an entry except in the first loadData call this
39
42
  * is intentional since you might get the wrong entry if a request is happening
40
43
  * and you call this in loadData. If possible use the CrelteRequest
@@ -46,8 +49,8 @@ export default class Router {
46
49
  /**
47
50
  * returns the latest request in progress otherwise returns null.
48
51
  *
49
- * ## Important !!
50
- * If at all possible prefer using the `CrelteRequest` provided in each
52
+ * #### Important !!
53
+ * If at all possible prefer using the {@link CrelteRequest} provided in each
51
54
  * loadData call. For example in a preload request this will return null.
52
55
  * Or a user has clicked multiple times on different links you might get
53
56
  * the url of the newer request.
@@ -92,7 +95,7 @@ export default class Router {
92
95
  return this.inner.primarySite();
93
96
  }
94
97
  /**
95
- * Returns a site which is preffered based on the users language
98
+ * Returns a site which is preferred based on the users language
96
99
  *
97
100
  * Returns null if no site could be determined
98
101
  */
@@ -106,11 +109,11 @@ export default class Router {
106
109
  * the url needs to start with http or with a / which will be considered as
107
110
  * the site baseUrl
108
111
  *
109
- * ## Note
112
+ * #### Note
110
113
  * The origin will always be set to 'manual'
111
114
  *
112
- * ## Example
113
- * ```
115
+ * #### Example
116
+ * ```js
114
117
  * import { getRouter } from 'crelte';
115
118
  *
116
119
  * const router = getRouter();
@@ -145,13 +148,13 @@ export default class Router {
145
148
  * You can use this when using pagination for example change the route object
146
149
  * (search argument) and then call push
147
150
  *
148
- * ## Note
151
+ * #### Note
149
152
  * This will always set the origin to 'push'
150
153
  * And will clear the scrollY value if you dont provide a new one via the `opts`
151
154
  * This will disableLoadData by default if you dont provide an override via the `opts`
152
155
  *
153
- * ## Example using the update function
154
- * ```
156
+ * #### Example using the update function
157
+ * ```js
155
158
  * import { getRouter } from 'crelte';
156
159
  *
157
160
  * const router = getRouter();
@@ -160,8 +163,8 @@ export default class Router {
160
163
  * router.push(req => req.setSearchParam('page', page || null));
161
164
  * ```
162
165
  *
163
- * ## Example using the route object
164
- * ```
166
+ * #### Example using the route object
167
+ * ```js
165
168
  * import { getRouter } from 'crelte';
166
169
  *
167
170
  * const router = getRouter();
@@ -204,13 +207,13 @@ export default class Router {
204
207
  *
205
208
  * You can use this when using some filters for example a search filter
206
209
  *
207
- * ## Note
210
+ * #### Note
208
211
  * This will always set the origin to 'replace'
209
212
  * And will clear the scrollY value if you don't provide a new one via the `opts`
210
213
  * This will disableLoadData by default if you don't provide an override via the `opts`
211
214
  *
212
- * ## Example using the update function
213
- * ```
215
+ * #### Example using the update function
216
+ * ```js
214
217
  * import { getRouter } from 'crelte';
215
218
  *
216
219
  * const router = getRouter();
@@ -219,8 +222,8 @@ export default class Router {
219
222
  * router.replace(req => req.setSearchParam('search', search));
220
223
  * ```
221
224
  *
222
- * ## Example using the route object
223
- * ```
225
+ * #### Example using the route object
226
+ * ```js
224
227
  * import { getRouter } from 'crelte';
225
228
  *
226
229
  * const router = getRouter();
@@ -306,7 +309,7 @@ export default class Router {
306
309
  * Resolve a url or Route and convert it to a Request
307
310
  *
308
311
  * @param target
309
- * @param opts, any option present will override the value in target
312
+ * @param opts any option present will override the value in target
310
313
  * @return Returns null if the url does not match our host (the protocol get's ignored)
311
314
  */
312
315
  targetToRequest(target, opts = {}) {
@@ -21,7 +21,7 @@ export default class ServerRouter extends BaseRouter {
21
21
  *
22
22
  * And then if no redirect happen the final route
23
23
  *
24
- * ## Throws
24
+ * #### Throws
25
25
  * If the request fails
26
26
  */
27
27
  init(url: string): Promise<[Request, Route | null]>;
@@ -49,7 +49,7 @@ export default class ServerRouter extends BaseRouter {
49
49
  *
50
50
  * And then if no redirect happen the final route
51
51
  *
52
- * ## Throws
52
+ * #### Throws
53
53
  * If the request fails
54
54
  */
55
55
  async init(url) {
@@ -11,7 +11,7 @@ export type CrelteServerRequestOptions = {
11
11
  };
12
12
  export default class CrelteServerRequest {
13
13
  /**
14
- * The current request
14
+ * The current request {@link ServerRequest}
15
15
  */
16
16
  req: ServerRequest;
17
17
  private _env;
@@ -19,12 +19,12 @@ export default class CrelteServerRequest {
19
19
  private _sites;
20
20
  private _langs;
21
21
  private _queries;
22
- protected _cookies: Cookies;
22
+ private _cookies;
23
23
  constructor(req: ServerRequest, opts: CrelteServerRequestOptions);
24
24
  /**
25
25
  * Easy access to this.req.site
26
26
  *
27
- * ## Note
27
+ * #### Note
28
28
  * The site might not always match with the current route
29
29
  * but be the site default site or one that matches the
30
30
  * users language.
@@ -56,14 +56,14 @@ export default class CrelteServerRequest {
56
56
  /**
57
57
  * returns the frontend url with an optional path
58
58
  *
59
- * ## Note
59
+ * #### Note
60
60
  * For the origin the `FRONTEND_URL` env variable is used
61
61
  */
62
62
  frontendUrl(path?: string): URL;
63
63
  /**
64
64
  * returns the backend url with an optional path
65
65
  *
66
- * ## Note
66
+ * #### Note
67
67
  * For the origin the `ENDPOINT_URL` env variable is used
68
68
  */
69
69
  backendUrl(path?: string): URL;
@@ -1 +1 @@
1
- {"version":3,"file":"CrelteServer.d.ts","source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9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,QAAQ,CAAU;gBAEd,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,0BAA0B;IAchE;;;;;;;OAOG;IACH,IAAI,IAAI,IAAI,IAAI,CAEf;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,IAAI,EAAE,CAElB;IAED;;OAEG;IACH,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAEjC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;IACpC,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM;IACrC,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKnC;;;;;OAKG;IACH,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG;IAI/B;;;;;OAKG;IACH,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG;IAI9B;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;;;OAIG;IACH,aAAa,IAAI,IAAI,GAAG,IAAI;IAI5B;;;;;;;OAOG;IACG,KAAK,CACV,KAAK,EAAE,KAAK,EACZ,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACvC,IAAI,GAAE,YAAiB,GACrB,OAAO,CAAC,OAAO,CAAC;IAInB,cAAc;IACd,gBAAgB,CAAC,IAAI,EAAE,QAAQ;CAG/B"}
@@ -3,7 +3,7 @@ import { Request } from '../routing/index.js';
3
3
  import { urlWithPath } from '../utils.js';
4
4
  export default class CrelteServerRequest {
5
5
  /**
6
- * The current request
6
+ * The current request {@link ServerRequest}
7
7
  */
8
8
  req;
9
9
  _env;
@@ -24,7 +24,7 @@ export default class CrelteServerRequest {
24
24
  /**
25
25
  * Easy access to this.req.site
26
26
  *
27
- * ## Note
27
+ * #### Note
28
28
  * The site might not always match with the current route
29
29
  * but be the site default site or one that matches the
30
30
  * users language.
@@ -62,7 +62,7 @@ export default class CrelteServerRequest {
62
62
  /**
63
63
  * returns the frontend url with an optional path
64
64
  *
65
- * ## Note
65
+ * #### Note
66
66
  * For the origin the `FRONTEND_URL` env variable is used
67
67
  */
68
68
  frontendUrl(path) {
@@ -71,7 +71,7 @@ export default class CrelteServerRequest {
71
71
  /**
72
72
  * returns the backend url with an optional path
73
73
  *
74
- * ## Note
74
+ * #### Note
75
75
  * For the origin the `ENDPOINT_URL` env variable is used
76
76
  */
77
77
  backendUrl(path) {
@@ -1,10 +1,16 @@
1
1
  import { Site } from '../routing/index.js';
2
+ /**
3
+ * Extended Request class for server requests
4
+ *
5
+ * This extends the WebApi [Request](https://developer.mozilla.org/docs/Web/API/Request)
6
+ * and adds three properties {@link site}, {@link getParam} and {@link siteMatches}.
7
+ */
2
8
  export default class ServerRequest extends Request {
3
9
  private params;
4
10
  /**
5
11
  * The site of the route
6
12
  *
7
- * ## Note
13
+ * #### Note
8
14
  * The site might not always match with the current route
9
15
  * but be the site default site or one that matches the
10
16
  * users language.
@@ -1 +1 @@
1
- {"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/server/Request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IACjD,OAAO,CAAC,MAAM,CAAsB;IAEpC;;;;;;;;;OASG;IACH,IAAI,EAAE,IAAI,CAAC;gBAEC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI;IAOnE;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC;;OAEG;IACH,WAAW,IAAI,OAAO;CAUtB"}
1
+ {"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/server/Request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IACjD,OAAO,CAAC,MAAM,CAAsB;IAEpC;;;;;;;;;OASG;IACH,IAAI,EAAE,IAAI,CAAC;gBAEC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI;IAOnE;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC;;OAEG;IACH,WAAW,IAAI,OAAO;CAUtB"}
@@ -1,9 +1,15 @@
1
+ /**
2
+ * Extended Request class for server requests
3
+ *
4
+ * This extends the WebApi [Request](https://developer.mozilla.org/docs/Web/API/Request)
5
+ * and adds three properties {@link site}, {@link getParam} and {@link siteMatches}.
6
+ */
1
7
  export default class ServerRequest extends Request {
2
8
  params;
3
9
  /**
4
10
  * The site of the route
5
11
  *
6
- * ## Note
12
+ * #### Note
7
13
  * The site might not always match with the current route
8
14
  * but be the site default site or one that matches the
9
15
  * users language.
@@ -1,8 +1,8 @@
1
1
  import { Methods, Pattern } from 'trouter';
2
2
  import CrelteServerRequest from './CrelteServer.js';
3
- import { SiteFromGraphQl } from './shared.js';
4
3
  import { Query, QueryOptions } from '../queries/index.js';
5
4
  import { Site } from '../routing/index.js';
5
+ import { SiteFromGraphQl } from '../routing/Site.js';
6
6
  export type Handler = (csr: CrelteServerRequest) => Promise<Response | null | undefined> | Response | null | undefined;
7
7
  export type RouterOptions = {
8
8
  endpointToken?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ServerRouter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G;IACH,WAAW,IAAI,IAAI;IAInB;;;;;;;OAOG;IACG,KAAK,CACV,KAAK,EAAE,KAAK,EACZ,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACvC,IAAI,GAAE,YAAiB,GACrB,OAAO,CAAC,OAAO,CAAC;IAKnB,cAAc;IACR,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAkDtD"}
@@ -1,6 +1,6 @@
1
1
  import ServerRequest from './Request.js';
2
- import ServerRouter, { Handler } from './ServerRouter.js';
3
- import CrelteServerRequest from './CrelteServer.js';
4
- export { type ServerData, type MainData, main, type Error, type MainErrorData, mainError, } from '../init/server.js';
5
- export { CrelteServerRequest, ServerRouter, type Handler, ServerRequest };
2
+ import ServerRouter, { type RouterOptions, type Handler } from './ServerRouter.js';
3
+ import CrelteServerRequest, { type CrelteServerRequestOptions } from './CrelteServer.js';
4
+ export { type ServerData, type RenderRequest, type RenderResponse, type MainData, main, type Error, type MainErrorData, mainError, } from '../init/server.js';
5
+ export { CrelteServerRequest, CrelteServerRequestOptions, ServerRouter, RouterOptions, Handler, ServerRequest, };
6
6
  //# sourceMappingURL=index.d.ts.map