@dosgato/templating 1.1.17 → 1.2.0
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/apitemplate.d.ts +20 -4
- package/dist/component.d.ts +4 -4
- package/dist/component.js +1 -1
- package/dist/render.d.ts +6 -6
- package/dist/uitemplate.d.ts +2 -2
- package/package.json +1 -1
package/dist/apitemplate.d.ts
CHANGED
|
@@ -97,15 +97,31 @@ export interface APITemplate<DataType> {
|
|
|
97
97
|
*/
|
|
98
98
|
getLinks?: LinkGatheringFn<DataType>;
|
|
99
99
|
/**
|
|
100
|
-
* Each template must provide the text from
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
100
|
+
* Each template must provide the plain text from its data so that it can be decomposed into
|
|
101
|
+
* words and indexed for fulltext searches. Any text returned by this function will also be
|
|
102
|
+
* scanned for links.
|
|
103
|
+
*
|
|
104
|
+
* Examples of text to include would be any plain text data that's rendered as visible content
|
|
104
105
|
* but not things like dates and times.
|
|
106
|
+
*
|
|
107
|
+
* Rich text / HTML content should be returned via `getHtml` instead. Markup in `getFulltext`
|
|
108
|
+
* results will be indexed as-is, meaning tags and attributes will pollute the index.
|
|
109
|
+
*
|
|
105
110
|
* @note You do not need to filter the text elements returned to ensure they're defined as that
|
|
106
111
|
* can be done by the routine that calls `getFulltext`.
|
|
107
112
|
*/
|
|
108
113
|
getFulltext?: FulltextGatheringFn<DataType>;
|
|
114
|
+
/**
|
|
115
|
+
* Return any HTML content from your template data so it can be parsed for indexing. The
|
|
116
|
+
* system will use cheerio to strip the markup and index the remaining text for fulltext
|
|
117
|
+
* search, and will also extract link targets (e.g. href attributes) before removing tags.
|
|
118
|
+
*
|
|
119
|
+
* This is preferable to stripping HTML yourself and returning it in getFulltext, because
|
|
120
|
+
* if you strip the markup yourself you'd also need to remember to extract and return links
|
|
121
|
+
* separately in getLinks. By returning the raw HTML here, both text and links are handled
|
|
122
|
+
* automatically in one place.
|
|
123
|
+
*/
|
|
124
|
+
getHtml?: FulltextGatheringFn<DataType>;
|
|
109
125
|
/**
|
|
110
126
|
* Extra filters for this template
|
|
111
127
|
*
|
package/dist/component.d.ts
CHANGED
|
@@ -175,8 +175,8 @@ export declare abstract class Component<DataType extends ComponentData = any, Fe
|
|
|
175
175
|
* left open to protect overall page integrity, and fix header levels for accessibility.
|
|
176
176
|
*
|
|
177
177
|
* For instance, an editor supplies a title to be placed above some rich editor content. The
|
|
178
|
-
* title uses an
|
|
179
|
-
* should not use
|
|
178
|
+
* title uses an `<h2>`, so the headers inside the rich editor content should start at `<h3>` and
|
|
179
|
+
* should not use `<h1>` or `<h2>`.
|
|
180
180
|
*
|
|
181
181
|
* Setting headerLevel: 3 instructs the renderRichText function to analyze and rebalance the header
|
|
182
182
|
* structure of the content so that if it had an h2, it woud be replaced with an h3. Additionally,
|
|
@@ -557,7 +557,7 @@ export interface RenderComponentsOpts {
|
|
|
557
557
|
skipContent?: boolean;
|
|
558
558
|
/**
|
|
559
559
|
* Provide a function that wraps each component, e.g.
|
|
560
|
-
* ({ output }) =>
|
|
560
|
+
* `({ output }) => \`<li>${output}</li>\``
|
|
561
561
|
*
|
|
562
562
|
* Wrap receives a lot of optional paramaters so that you can customize the behavior. For
|
|
563
563
|
* instance, you may want to wrap the content but not the edit bar, or vice versa. See
|
|
@@ -640,7 +640,7 @@ export declare abstract class Page<DataType extends PageData = any, FetchedType
|
|
|
640
640
|
/**
|
|
641
641
|
* This is a bunch of javascript and CSS and meta tags managed by the DosGato engine. It will
|
|
642
642
|
* be filled by the rendering server and your render function for your page template
|
|
643
|
-
* should place include it in the
|
|
643
|
+
* should place include it in the `<head>` element
|
|
644
644
|
*/
|
|
645
645
|
headContent: string;
|
|
646
646
|
/**
|
package/dist/component.js
CHANGED
|
@@ -358,7 +358,7 @@ export class Page extends Component {
|
|
|
358
358
|
/**
|
|
359
359
|
* This is a bunch of javascript and CSS and meta tags managed by the DosGato engine. It will
|
|
360
360
|
* be filled by the rendering server and your render function for your page template
|
|
361
|
-
* should place include it in the
|
|
361
|
+
* should place include it in the `<head>` element
|
|
362
362
|
*/
|
|
363
363
|
headContent;
|
|
364
364
|
/**
|
package/dist/render.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ export interface PictureResize {
|
|
|
17
17
|
src: string;
|
|
18
18
|
}
|
|
19
19
|
export interface PictureAttributes {
|
|
20
|
-
/** string appropriate for the src attribute of the default
|
|
20
|
+
/** string appropriate for the src attribute of the default `<img>` tag */
|
|
21
21
|
src: string;
|
|
22
|
-
/** string appropriate for the srcset attribute of the default
|
|
22
|
+
/** string appropriate for the srcset attribute of the default `<img>` tag, or use widths array to reconstruct */
|
|
23
23
|
srcset: string;
|
|
24
24
|
/**
|
|
25
25
|
* When an image link cannot be found, we still return the src and srcset with a non-working path so that the
|
|
@@ -36,11 +36,11 @@ export interface PictureAttributes {
|
|
|
36
36
|
width: number;
|
|
37
37
|
/** the original intrinsic height of the image uploaded by the editor */
|
|
38
38
|
height: number;
|
|
39
|
-
/** a list of alternate formats like AVIF or WEBP and their resizes, useful for creating
|
|
39
|
+
/** a list of alternate formats like AVIF or WEBP and their resizes, useful for creating `<source>` tags */
|
|
40
40
|
alternates: {
|
|
41
|
-
/** the mime type of this alternate source, useful for the type attribute on a
|
|
41
|
+
/** the mime type of this alternate source, useful for the type attribute on a `<source>` tag */
|
|
42
42
|
mime: string;
|
|
43
|
-
/** the full srcset for the
|
|
43
|
+
/** the full srcset for the `<source>` tag, or use widths array to reconstruct */
|
|
44
44
|
srcset: string;
|
|
45
45
|
/** a list of available widths in case you want to filter some out and recreate the srcset */
|
|
46
46
|
widths: PictureResize[];
|
|
@@ -187,7 +187,7 @@ export interface APIClient {
|
|
|
187
187
|
getAssetsByLink: (link: AssetLink | AssetFolderLink | string, recursive?: boolean) => Promise<AssetRecord[]>;
|
|
188
188
|
/**
|
|
189
189
|
* This function will retrieve information about an image to help you construct responsive HTML
|
|
190
|
-
* for a
|
|
190
|
+
* for a `<picture>` element including the `<img>` and all `<source>` tags.
|
|
191
191
|
*
|
|
192
192
|
* The alt text it returns will be the default alternative text from the asset repository. Alt
|
|
193
193
|
* text gathered from a template's dialog should generally take precedence (though the dialog may
|
package/dist/uitemplate.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export interface UITemplateBase {
|
|
|
43
43
|
* during render. For instance, to set the id on an HTML element for reference by other
|
|
44
44
|
* components or code.
|
|
45
45
|
*
|
|
46
|
-
* If your component has a dialog, dosgato-dialog has a
|
|
46
|
+
* If your component has a dialog, dosgato-dialog has a `<FieldIdentifier>` component for this;
|
|
47
47
|
* it's invisible but either creates or maintains a random string.
|
|
48
48
|
*
|
|
49
49
|
* If your component has no dialog but still needs an identifier, you can name a property
|
|
@@ -326,7 +326,7 @@ export interface UIConfig {
|
|
|
326
326
|
*/
|
|
327
327
|
environmentBackgroundColor?: (environmentConfig: any) => string | undefined;
|
|
328
328
|
/**
|
|
329
|
-
* Page title for the
|
|
329
|
+
* Page title for the `<head>`
|
|
330
330
|
*/
|
|
331
331
|
title?: string;
|
|
332
332
|
/**
|