@dosgato/templating 0.0.89 → 0.0.91

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.
@@ -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;
@@ -346,6 +347,16 @@ interface BarOpts {
346
347
  editMode?: boolean;
347
348
  label?: string;
348
349
  extraClass?: string;
350
+ /**
351
+ * Edit bars and new bars are implemented as web components with shadow DOM to prevent
352
+ * page styles from leaking in to the bar styles.
353
+ *
354
+ * This means you cannot style them just by including a CSS block on the page. Instead
355
+ * you need to include the CSS block in the bar itself. This option allows you to do
356
+ * that. Give it a list of block names from any registered provider, and the blocks
357
+ * will be imported inside this bar's shadow DOM.
358
+ */
359
+ cssBlocks?: string[];
349
360
  }
350
361
  export interface EditBarOpts extends BarOpts {
351
362
  inheritedFrom?: string;
@@ -512,6 +523,12 @@ export declare abstract class Page<DataType extends PageData = any, FetchedType
512
523
  * Other data we've already collected about the page being rendered, in case it's needed.
513
524
  */
514
525
  pageInfo: PageRecord<DataType>;
526
+ /**
527
+ * A convenience to get the page title.
528
+ *
529
+ * If the user didn't set a title, it manipulates the page name into a title.
530
+ */
531
+ get title(): any;
515
532
  /**
516
533
  * This will be filled by the rendering server. The template properties are described
517
534
  * 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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {