@dosgato/templating 0.0.143 → 0.0.144

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.
@@ -91,6 +91,16 @@ export interface APITemplate<DataType> {
91
91
  * can be done by the routine that calls `getFulltext`.
92
92
  */
93
93
  getFulltext?: FulltextGatheringFn<DataType>;
94
+ /**
95
+ * Extra filters for this template
96
+ *
97
+ * Use this function to return arbitrary tags for your template. These tags will be indexed
98
+ * and may be used later as a search filter.
99
+ *
100
+ * For example, pages may set a 'shownInNav' tag and this could be passed to the getNavigation
101
+ * function during rendering to return a smaller set of pages for navigation.
102
+ */
103
+ getTags?: FulltextGatheringFn<DataType>;
94
104
  /**
95
105
  * The available component list in the main content area can get very long, among others. Therefore, each
96
106
  * template may set a displayCategory and any templates that share a displayCategory will be grouped together
package/dist/provider.js CHANGED
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * If you do this, don't forget to register the provider along with your templates!
10
10
  */
11
- class ResourceProvider {
11
+ export class ResourceProvider {
12
12
  static webpath(name) { return this.webpaths.get(name); }
13
13
  }
14
14
  /**
@@ -86,4 +86,3 @@ ResourceProvider.files = new Map();
86
86
  * `<img src="${TemplateClass.webpath('keyname')}">`
87
87
  */
88
88
  ResourceProvider.webpaths = new Map();
89
- export { ResourceProvider };
package/dist/render.d.ts CHANGED
@@ -282,6 +282,29 @@ export interface APIClient {
282
282
  * The `href` property in the returned records should be an absolute URL.
283
283
  */
284
284
  absolute?: boolean;
285
+ /**
286
+ * Set a filter to use while building the navigation tree, to limit the amount of pages
287
+ * returned.
288
+ *
289
+ * For example, if pages have a `hideInNav` property, you could check that here to avoid
290
+ * returning pages that are supposed to be hidden.
291
+ *
292
+ * You could always do this yourself after getting the full results, but it will improve
293
+ * performance to do it earlier.
294
+ */
295
+ filter?: (page: PageForNavigation) => boolean | undefined;
296
+ /**
297
+ * Filter for a specific tag as returned by the template's getTags function in the API
298
+ * template definition.
299
+ */
300
+ tagsAny?: string[];
301
+ /**
302
+ * Set a maximum number of children to be displayed in the menu per page.
303
+ *
304
+ * For instance, if you set it to 8, no page returned will have more than 8 children. Page
305
+ * order will determine which 8 make the cut.
306
+ */
307
+ maxChildren?: number;
285
308
  }) => Promise<PageForNavigation[]>;
286
309
  /**
287
310
  * Get data entries by link or folder link
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.143",
3
+ "version": "0.0.144",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {