@dosgato/templating 0.0.98 → 0.0.99

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.
@@ -82,16 +82,14 @@ export declare abstract class Component<DataType extends ComponentData = any, Fe
82
82
  * going to render anything. For instance, if we are rendering an '.ics' variation and this component
83
83
  * is not an event, it will not be participating and we'd like to avoid doing the work in the fetch().
84
84
  *
85
- * This method returns a map of extensions where we SHOULD run fetch(). The default is only run fetch
85
+ * This method returns true for extensions where we SHOULD run fetch(). The default is only run fetch
86
86
  * on 'html'. Components that support other variations should override this method and opt in to more
87
87
  * extensions.
88
88
  *
89
- * The extensions listed should NOT include the preceding dot. In the case of an extended extension like
90
- * '.js.map', you should provide 'js.map'.
89
+ * The extension will NOT include the preceding dot. In the case of an extended extension like
90
+ * '.js.map', you should receive 'js.map'.
91
91
  */
92
- variationsToFetch(): {
93
- html: boolean;
94
- };
92
+ shouldFetchVariation(extension: string): boolean;
95
93
  /**
96
94
  * Some components may be inheritable to subpages within the same site. For instance, a site's
97
95
  * social media links may appear on every page's footer. To accomplish this in your template,
package/dist/component.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { get, isNotBlank, titleCase } from 'txstate-utils';
2
2
  import { ResourceProvider } from './provider.js';
3
3
  function defaultWrap(info) { return info.output; }
4
- const acceptHtmlVariation = { html: true };
5
4
  /**
6
5
  * This is the primary templating class to build your templates. Subclass it and provide
7
6
  * at least a render function.
@@ -71,14 +70,14 @@ export class Component extends ResourceProvider {
71
70
  * going to render anything. For instance, if we are rendering an '.ics' variation and this component
72
71
  * is not an event, it will not be participating and we'd like to avoid doing the work in the fetch().
73
72
  *
74
- * This method returns a map of extensions where we SHOULD run fetch(). The default is only run fetch
73
+ * This method returns true for extensions where we SHOULD run fetch(). The default is only run fetch
75
74
  * on 'html'. Components that support other variations should override this method and opt in to more
76
75
  * extensions.
77
76
  *
78
- * The extensions listed should NOT include the preceding dot. In the case of an extended extension like
79
- * '.js.map', you should provide 'js.map'.
77
+ * The extension will NOT include the preceding dot. In the case of an extended extension like
78
+ * '.js.map', you should receive 'js.map'.
80
79
  */
81
- variationsToFetch() { return acceptHtmlVariation; }
80
+ shouldFetchVariation(extension) { return extension === 'html'; }
82
81
  /**
83
82
  * Inherit components from another page with matching area
84
83
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.98",
3
+ "version": "0.0.99",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {