@dosgato/templating 0.0.89 → 0.0.90
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.
- package/dist/component.d.ts +7 -0
- package/dist/component.js +9 -1
- package/package.json +1 -1
package/dist/component.d.ts
CHANGED
|
@@ -305,6 +305,7 @@ export interface SiteInfo {
|
|
|
305
305
|
}
|
|
306
306
|
export interface PageRecord<DataType extends PageData = PageData> {
|
|
307
307
|
id: string;
|
|
308
|
+
name: string;
|
|
308
309
|
linkId: string;
|
|
309
310
|
createdAt: Date;
|
|
310
311
|
modifiedAt: Date;
|
|
@@ -512,6 +513,12 @@ export declare abstract class Page<DataType extends PageData = any, FetchedType
|
|
|
512
513
|
* Other data we've already collected about the page being rendered, in case it's needed.
|
|
513
514
|
*/
|
|
514
515
|
pageInfo: PageRecord<DataType>;
|
|
516
|
+
/**
|
|
517
|
+
* A convenience to get the page title.
|
|
518
|
+
*
|
|
519
|
+
* If the user didn't set a title, it manipulates the page name into a title.
|
|
520
|
+
*/
|
|
521
|
+
get title(): any;
|
|
515
522
|
/**
|
|
516
523
|
* This will be filled by the rendering server. The template properties are described
|
|
517
524
|
* over in apitemplate.ts in the comment for APIPageTemplate.templateProperties.
|
package/dist/component.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { get, isNotBlank } from 'txstate-utils';
|
|
1
|
+
import { get, isNotBlank, titleCase } from 'txstate-utils';
|
|
2
2
|
import { ResourceProvider } from './provider.js';
|
|
3
3
|
function defaultWrap(info) { return info.output; }
|
|
4
4
|
/**
|
|
@@ -253,6 +253,14 @@ export class Page extends Component {
|
|
|
253
253
|
this.id = page.id;
|
|
254
254
|
this.pageInfo = page;
|
|
255
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* A convenience to get the page title.
|
|
258
|
+
*
|
|
259
|
+
* If the user didn't set a title, it manipulates the page name into a title.
|
|
260
|
+
*/
|
|
261
|
+
get title() {
|
|
262
|
+
return this.pageInfo.data.title ?? titleCase(this.pageInfo.name);
|
|
263
|
+
}
|
|
256
264
|
passError(e, path) {
|
|
257
265
|
console.warn(`Recoverable issue occured during render of ${this.pageInfo.path}. Component at ${path} threw the following error:`, e);
|
|
258
266
|
}
|