@dosgato/templating 0.0.93 → 0.0.95

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.
@@ -185,8 +185,8 @@ export declare type ComponentMigration<DataType extends ComponentData = Componen
185
185
  export declare type PageMigration<DataType extends PageData = PageData> = Migration<DataType, PageExtras>;
186
186
  export declare type DataMigration<DataType extends DataData = DataData> = Migration<DataType, DataExtras>;
187
187
  export declare type AnyMigration = ComponentMigration | PageMigration | DataMigration;
188
- export declare type LinkGatheringFn<DataType> = (data: DataType) => LinkDefinition[];
189
- export declare type FulltextGatheringFn<DataType> = (data: DataType) => string[];
188
+ export declare type LinkGatheringFn<DataType> = (data: DataType) => (LinkDefinition | string | undefined)[];
189
+ export declare type FulltextGatheringFn<DataType> = (data: DataType) => (string | undefined)[];
190
190
  export declare type GraphQLQueryFn = <T>(query: string, variables?: any) => Promise<T>;
191
191
  /**
192
192
  * This function is used by API template definitions to help them identify all the searchable
@@ -141,7 +141,7 @@ export declare abstract class Component<DataType extends ComponentData = any, Fe
141
141
  * method to prepare editor-provided HTML for later rendering. It will do things like find and
142
142
  * resolve link definitions in the internal dosgato format.
143
143
  */
144
- fetchRichText: (text: string) => Promise<void>;
144
+ fetchRichText: (html: string | undefined) => Promise<void>;
145
145
  /**
146
146
  * This function will be provided by the rendering server and should be used during the render
147
147
  * phase to clean up editor-provided HTML. It will do things like clean up tags that were accidentally
@@ -166,7 +166,7 @@ export declare abstract class Component<DataType extends ComponentData = any, Fe
166
166
  * If this.data.title is non-blank, the rich text will be balanced below it, but if it is blank,
167
167
  * it will be balanced at the level the title would have had.
168
168
  */
169
- renderRichText: (html: string, opts?: {
169
+ renderRichText: (html: string | undefined, opts?: {
170
170
  headerLevel?: number;
171
171
  advanceHeader?: string;
172
172
  }) => string;
@@ -385,6 +385,10 @@ export interface RenderComponentsWrapParams {
385
385
  *
386
386
  * If you use this, make sure to also use the bar parameter or else
387
387
  * you'll never print the edit bar and your components will be uneditable.
388
+ *
389
+ * This will be an empty string for new bars and when being rendered with skipContent
390
+ * set to true. If you need to determine whether you're wrapping a new bar,
391
+ * check component == null instead of checking this.
388
392
  */
389
393
  content: string;
390
394
  /**
@@ -392,9 +396,9 @@ export interface RenderComponentsWrapParams {
392
396
  *
393
397
  * Use this if you want to wrap the bar separately from the component content.
394
398
  *
395
- * Will be blank in edit mode or when skipBars was set to true on the renderArea
396
- * and/or renderComponents call. You probably want to check if it's blank before
397
- * wrapping or you'll end up with an empty wrapper element.
399
+ * Will be empty string when not in edit mode or when skipBars was set to true on
400
+ * the renderArea and/or renderComponents call. You probably want to check if it's
401
+ * blank before wrapping or you'll end up with an empty wrapper element.
398
402
  */
399
403
  bar: string;
400
404
  /**
package/dist/component.js CHANGED
@@ -126,7 +126,8 @@ export class Component extends ResourceProvider {
126
126
  label: typeof opts?.editBarOpts?.label === 'function' ? opts.editBarOpts.label(c.component) : opts?.editBarOpts?.label,
127
127
  extraClass: typeof opts?.editBarOpts?.extraClass === 'function' ? opts.editBarOpts.extraClass(c.component) : opts?.editBarOpts?.extraClass
128
128
  });
129
- return wrap({ output: bar + c.output, content: c.output, bar, component: c.component, indexInArea });
129
+ const content = opts?.skipContent ? '' : c.output;
130
+ return wrap({ output: bar + content, content, bar, component: c.component, indexInArea });
130
131
  }
131
132
  }).join('');
132
133
  }
package/dist/links.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface AssetLink {
7
7
  type: 'asset';
8
8
  source: string;
9
9
  id: string;
10
+ siteId?: string;
10
11
  path?: string;
11
12
  checksum?: string;
12
13
  }
@@ -19,6 +20,7 @@ export interface AssetFolderLink {
19
20
  type: 'assetfolder';
20
21
  source: string;
21
22
  id: string;
23
+ siteId?: string;
22
24
  path: string;
23
25
  }
24
26
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.93",
3
+ "version": "0.0.95",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {