@dosgato/templating 0.0.145 → 0.0.147

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.
@@ -631,6 +631,7 @@ export declare abstract class Page<DataType extends PageData = any, FetchedType
631
631
  * Get a URL for the current page with a different extension
632
632
  */
633
633
  variationUrl(extension: string): string;
634
+ logError(e: Error): void;
634
635
  protected passError(e: Error, path: string): void;
635
636
  constructor(page: PageRecord<DataType>, editMode: boolean, extension: string);
636
637
  }
package/dist/component.js CHANGED
@@ -111,7 +111,9 @@ export class Component extends ResourceProvider {
111
111
  if (!Array.isArray(components))
112
112
  components = this.renderedAreas.get(components) ?? [];
113
113
  const wrap = opts?.wrap ?? defaultWrap;
114
- if (opts?.skipBars || opts?.skipEditBars)
114
+ if (opts?.skipContent && !this.editMode)
115
+ return '';
116
+ if (opts?.skipBars || opts?.skipEditBars || !this.editMode)
115
117
  return components.map((c, indexInArea) => wrap({ ...c, content: c.output, bar: '', indexInArea })).join('');
116
118
  return components
117
119
  .map((c, indexInArea) => {
@@ -146,7 +148,7 @@ export class Component extends ResourceProvider {
146
148
  const full = !!(opts?.max && ownedComponentCount >= opts.max);
147
149
  const wrap = opts?.wrap ?? defaultWrap;
148
150
  let output = this.renderComponents(components, { ...opts, editBarOpts: { ...opts?.editBarOpts, disableDelete: ownedComponentCount <= (opts?.min ?? 0), disableDrop: full } });
149
- if (!opts?.skipBars && !opts?.skipNewBar) {
151
+ if (!opts?.skipBars && !opts?.skipNewBar && this.editMode) {
150
152
  let bar;
151
153
  if (full) {
152
154
  if (!opts.hideMaxWarning) {
@@ -288,6 +290,10 @@ export class Page extends Component {
288
290
  variationUrl(extension) {
289
291
  return (this.url === '/' ? '/.root' : this.url.replace(/\.[^/]+$/, '')) + '.' + extension;
290
292
  }
293
+ logError(e) {
294
+ this.hadError = true;
295
+ console.error(`Unrecoverable issue occurred during render of ${this.pageInfo.path}. Page template threw the following error:`, e);
296
+ }
291
297
  passError(e, path) {
292
298
  console.warn(`Recoverable issue occured during render of ${this.pageInfo.path}. Component at ${path} threw the following error:`, e);
293
299
  }
@@ -276,6 +276,10 @@ export interface UIConfig {
276
276
  * Optional CMS logo to be placed in the top left of the admin UI.
277
277
  */
278
278
  logo?: IconOrSVG;
279
+ /**
280
+ * Page title for the <head>
281
+ */
282
+ title?: string;
279
283
  /**
280
284
  * If you would like to collect more information about assets from editors, you may provide a dialog
281
285
  * here. The data collected will be available when you retrieve assets.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.145",
3
+ "version": "0.0.147",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {