@dosgato/templating 0.0.113 → 0.0.114
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 +14 -0
- package/dist/render.d.ts +39 -6
- package/dist/render.js +1 -0
- package/package.json +1 -1
package/dist/apitemplate.d.ts
CHANGED
|
@@ -147,6 +147,20 @@ export interface APIPageTemplate<DataType extends PageData = any> extends APITem
|
|
|
147
147
|
* Must be null for non-page templates.
|
|
148
148
|
*/
|
|
149
149
|
templateProperties?: any;
|
|
150
|
+
/**
|
|
151
|
+
* Container components specify their own list of compatible templates for each of their areas,
|
|
152
|
+
* but it is possible that a sub-component could be compatible with its container while not really
|
|
153
|
+
* being compatible with the template as a whole. For instance, a special purpose template may want
|
|
154
|
+
* to allow containers but only a couple simple components inside those containers.
|
|
155
|
+
*
|
|
156
|
+
* Without this property, the only choice would be to re-make all your container components with a special
|
|
157
|
+
* templateKey just for this page template and their custom set of availableComponents. That's a lot to maintain,
|
|
158
|
+
* so this property is available to disallow sub-components at the page template level.
|
|
159
|
+
*
|
|
160
|
+
* Any template key you list here will be unavailable inside this page template, no matter how many
|
|
161
|
+
* nested containers are in between.
|
|
162
|
+
*/
|
|
163
|
+
disallowComponents?: string[];
|
|
150
164
|
}
|
|
151
165
|
export interface APIDataTemplate<DataType extends DataData = any> extends APITemplate<DataType> {
|
|
152
166
|
type: 'data';
|
package/dist/render.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { AssetFolderLink, AssetLink, DataFolderLink, DataLink, LinkDefinition, P
|
|
|
6
6
|
* @returns An empty string if content is blank, undefined, or null - else an h<1..6> encapsulated content with attributes added to the encapsulating tag.
|
|
7
7
|
* @example ```
|
|
8
8
|
* printHeader(this.renderCtx, htmlEncode(this.data.title), {class: 'some-extra-cssclass'})
|
|
9
|
+
* // Renders: '<h1 class="some-extra-cssclass">Title</h1>'
|
|
9
10
|
* ``` */
|
|
10
11
|
export declare function printHeader(ctx: ContextBase, content: string | undefined | null, attributes?: Record<string, string>): string;
|
|
11
12
|
export declare function advanceHeader<T extends ContextBase>(ctx: T, content: string | undefined | null): T;
|
|
@@ -157,11 +158,43 @@ export interface APIClient {
|
|
|
157
158
|
path?: string;
|
|
158
159
|
}) => Promise<PageRecord<PageData>>;
|
|
159
160
|
/**
|
|
160
|
-
* Get a hierarchical tree of pages suitable for generating a navigation
|
|
161
|
-
* UI for your template.
|
|
161
|
+
* Get a hierarchical tree of pages suitable for generating a navigation UI for your template.
|
|
162
162
|
*
|
|
163
|
-
*
|
|
164
|
-
|
|
163
|
+
* Each element in the array is recursive such that any subpage descendants can be found by
|
|
164
|
+
* traversing each element's respective `children` property.
|
|
165
|
+
*
|
|
166
|
+
* @param opts
|
|
167
|
+
* ```
|
|
168
|
+
* { // Return pages beneath this path but not the page that is this path.
|
|
169
|
+
// If `undefined` you will get back a single element array that
|
|
170
|
+
// references the `PageForNaviation` of the root page of the pageTree.
|
|
171
|
+
beneath? string
|
|
172
|
+
|
|
173
|
+
// Relative to `beneath` this controls how many levels deep to fetch past
|
|
174
|
+
// the top level set of results in the array. 0 returns the top level only
|
|
175
|
+
// while n > 0 traverses n levels of children deep past the top level
|
|
176
|
+
// results. Leave `undefined` to fetch all.
|
|
177
|
+
depth?: number
|
|
178
|
+
|
|
179
|
+
// Set to true to filter for only pages that are published. Else the default
|
|
180
|
+
// of false will automatically not filter unpublished pages when in edit or
|
|
181
|
+
// preview mode but will filter if in published mode.
|
|
182
|
+
// WARNING:
|
|
183
|
+
// If none of the pages in the current pageTree have been published and this is
|
|
184
|
+
// set to `true` an error will be thrown as there will be no pages to return.
|
|
185
|
+
published?: boolean
|
|
186
|
+
|
|
187
|
+
// Array of strings that specify dot-separated object paths describing page
|
|
188
|
+
// data not normally fetched within the PageForNavigation results. For example,
|
|
189
|
+
// ['hideInNav'] would append the page record hideInNav value to the
|
|
190
|
+
// `PageForNavigation.extra` property as its own sub-property `hideInNav` that
|
|
191
|
+
// would normally be excluded from the `PageForNavigation` properties.
|
|
192
|
+
extra?: string[]
|
|
193
|
+
|
|
194
|
+
// Whether the href property in the returned records should be an absolute URL.
|
|
195
|
+
absolute?: boolean
|
|
196
|
+
}
|
|
197
|
+
``` */
|
|
165
198
|
getNavigation: (opts?: {
|
|
166
199
|
/**
|
|
167
200
|
* Return pages beneath this path
|
|
@@ -201,8 +234,8 @@ export interface APIClient {
|
|
|
201
234
|
* transfer, but if you need some of the data, you can specify an array of dot-separated
|
|
202
235
|
* paths to retrieve from it.
|
|
203
236
|
*
|
|
204
|
-
* For example, ['hideInNav'] would get you
|
|
205
|
-
* page record.
|
|
237
|
+
* For example, ['hideInNav'] would get you the additional property `extra.hideInNav` in
|
|
238
|
+
* each returned page record.
|
|
206
239
|
*/
|
|
207
240
|
extra?: string[];
|
|
208
241
|
/**
|
package/dist/render.js
CHANGED
|
@@ -5,6 +5,7 @@ import { htmlEncode, isBlank, isNotEmpty } from 'txstate-utils';
|
|
|
5
5
|
* @returns An empty string if content is blank, undefined, or null - else an h<1..6> encapsulated content with attributes added to the encapsulating tag.
|
|
6
6
|
* @example ```
|
|
7
7
|
* printHeader(this.renderCtx, htmlEncode(this.data.title), {class: 'some-extra-cssclass'})
|
|
8
|
+
* // Renders: '<h1 class="some-extra-cssclass">Title</h1>'
|
|
8
9
|
* ``` */
|
|
9
10
|
export function printHeader(ctx, content, attributes) {
|
|
10
11
|
if (isBlank(content))
|