@dosgato/templating 0.0.77 → 0.0.79

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.
@@ -73,7 +73,37 @@ export declare abstract class Component<DataType extends ComponentData = any, Fe
73
73
  * The inherited components will be added to the appropriate area's array in the renderedAreas
74
74
  * parameter of your render function.
75
75
  */
76
- registerInherited: (area: string, components: ComponentData[], fromPageId: string, top?: true) => void;
76
+ registerInherited: (
77
+ /**
78
+ * The area in which to place the inherited components. It doesn't matter where you found them.
79
+ */
80
+ area: string,
81
+ /**
82
+ * An array of components to add to the area.
83
+ */
84
+ components: ComponentData[],
85
+ /**
86
+ * The page id of the page these components came from.
87
+ *
88
+ * If you are providing components from different pages, you may pass an array
89
+ * that corresponds index-for-index with the components array you provided.
90
+ *
91
+ * Generally you would only need to do this when you are using 'replace' mode, as with
92
+ * 'top' or 'bottom' you could just call registerInherited once per page you're
93
+ * inheriting from.
94
+ */
95
+ fromPageId: string | string[],
96
+ /**
97
+ * How to place the inherited components into the area.
98
+ *
99
+ * 'top' to place these inherited components at the top of the area.
100
+ * 'bottom' to place them at the bottom of the area.
101
+ * 'replace' to remove all existing components (inherited or not) in the area and
102
+ * use these instead.
103
+ *
104
+ * Default is 'top'.
105
+ */
106
+ mode?: 'top' | 'bottom' | 'replace') => void;
77
107
  /**
78
108
  * The second phase of rendering a component is the context phase. This step is TOP-DOWN and
79
109
  * NON-MUTATING. Each component will receive the parent component's context and then pass a
package/dist/render.d.ts CHANGED
@@ -129,16 +129,45 @@ export interface APIClient {
129
129
  * Get a hierarchical tree of pages suitable for generating a navigation
130
130
  * UI for your template.
131
131
  *
132
- * Returns the root page. Subpages are inside the `children` property.
133
- *
134
- * "extra" is a list of dot-separated paths to page data that you need to help you build
135
- * your interface. For example, ['hideInNav'] would fill page.extra with { hideInNav: true }.
132
+ * Returns the root page(s). Subpages are inside the `children` property.
136
133
  */
137
- getNavigation: ({ depth, extra, absolute }: {
134
+ getNavigation: ({ beneath, depth, extra, absolute }: {
135
+ /**
136
+ * Return pages beneath this path
137
+ *
138
+ * For instance, if you set this to '/site1' you will get back ['/site1/about',
139
+ * '/site1/history', '/site1/history/traditions', ...etc]
140
+ *
141
+ * If you do not set `beneath`, you will get back an array that contains only
142
+ * the root page of the pagetree you are in.
143
+ */
144
+ beneath?: string;
145
+ /**
146
+ * Return pages to the given depth
147
+ *
148
+ * This is relative to `beneath`, so if `beneath` is '/site1' and `depth` is 0 you
149
+ * will get '/site1/history' and not '/site1/history/traditions'
150
+ *
151
+ * If you do not provide a `beneath`, `depth` 0 will get you the root page, 1 will get
152
+ * you the root page and one level of subpages, etc.
153
+ */
138
154
  depth?: number;
155
+ /**
156
+ * Get extra data from the page data
157
+ *
158
+ * Returning the full page data for a whole tree of pages would be an extreme amount of
159
+ * transfer, but if you need some of the data, you can specify an array of dot-separated
160
+ * paths to retrieve from it.
161
+ *
162
+ * For example, ['hideInNav'] would get you { extra: { hideInNav: tru } } in each returned
163
+ * page record.
164
+ */
139
165
  extra?: string[];
166
+ /**
167
+ * The `href` property in the returned records should be an absolute URL.
168
+ */
140
169
  absolute?: boolean;
141
- }) => Promise<PageForNavigation>;
170
+ }) => Promise<PageForNavigation[]>;
142
171
  /**
143
172
  * Get data entries by link or folder link
144
173
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.77",
3
+ "version": "0.0.79",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {