@terminalfour/terminalfour-js 1.0.0-rc.1

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.
Files changed (253) hide show
  1. package/LICENSE.md +106 -0
  2. package/README.md +169 -0
  3. package/dist/cjs/element-resolver.d.ts +115 -0
  4. package/dist/cjs/element-resolver.d.ts.map +1 -0
  5. package/dist/cjs/element-resolver.js +391 -0
  6. package/dist/cjs/element-resolver.js.map +1 -0
  7. package/dist/cjs/errors.d.ts +21 -0
  8. package/dist/cjs/errors.d.ts.map +1 -0
  9. package/dist/cjs/errors.js +21 -0
  10. package/dist/cjs/errors.js.map +1 -0
  11. package/dist/cjs/handlebars.d.ts +123 -0
  12. package/dist/cjs/handlebars.d.ts.map +1 -0
  13. package/dist/cjs/handlebars.js +306 -0
  14. package/dist/cjs/handlebars.js.map +1 -0
  15. package/dist/cjs/http-client.d.ts +21 -0
  16. package/dist/cjs/http-client.d.ts.map +1 -0
  17. package/dist/cjs/http-client.js +126 -0
  18. package/dist/cjs/http-client.js.map +1 -0
  19. package/dist/cjs/index.d.ts +37 -0
  20. package/dist/cjs/index.d.ts.map +1 -0
  21. package/dist/cjs/index.js +55 -0
  22. package/dist/cjs/index.js.map +1 -0
  23. package/dist/cjs/media-category-ref.d.ts +78 -0
  24. package/dist/cjs/media-category-ref.d.ts.map +1 -0
  25. package/dist/cjs/media-category-ref.js +184 -0
  26. package/dist/cjs/media-category-ref.js.map +1 -0
  27. package/dist/cjs/media-library.d.ts +30 -0
  28. package/dist/cjs/media-library.d.ts.map +1 -0
  29. package/dist/cjs/media-library.js +77 -0
  30. package/dist/cjs/media-library.js.map +1 -0
  31. package/dist/cjs/models/content-item.d.ts +80 -0
  32. package/dist/cjs/models/content-item.d.ts.map +1 -0
  33. package/dist/cjs/models/content-item.js +682 -0
  34. package/dist/cjs/models/content-item.js.map +1 -0
  35. package/dist/cjs/models/media-category-item.d.ts +29 -0
  36. package/dist/cjs/models/media-category-item.d.ts.map +1 -0
  37. package/dist/cjs/models/media-category-item.js +33 -0
  38. package/dist/cjs/models/media-category-item.js.map +1 -0
  39. package/dist/cjs/models/media-item.d.ts +74 -0
  40. package/dist/cjs/models/media-item.d.ts.map +1 -0
  41. package/dist/cjs/models/media-item.js +188 -0
  42. package/dist/cjs/models/media-item.js.map +1 -0
  43. package/dist/cjs/models/section-item.d.ts +58 -0
  44. package/dist/cjs/models/section-item.d.ts.map +1 -0
  45. package/dist/cjs/models/section-item.js +166 -0
  46. package/dist/cjs/models/section-item.js.map +1 -0
  47. package/dist/cjs/package.json +1 -0
  48. package/dist/cjs/resources/channel-resource.d.ts +112 -0
  49. package/dist/cjs/resources/channel-resource.d.ts.map +1 -0
  50. package/dist/cjs/resources/channel-resource.js +107 -0
  51. package/dist/cjs/resources/channel-resource.js.map +1 -0
  52. package/dist/cjs/resources/content-resource.d.ts +50 -0
  53. package/dist/cjs/resources/content-resource.d.ts.map +1 -0
  54. package/dist/cjs/resources/content-resource.js +286 -0
  55. package/dist/cjs/resources/content-resource.js.map +1 -0
  56. package/dist/cjs/resources/content-type-resource.d.ts +283 -0
  57. package/dist/cjs/resources/content-type-resource.d.ts.map +1 -0
  58. package/dist/cjs/resources/content-type-resource.js +970 -0
  59. package/dist/cjs/resources/content-type-resource.js.map +1 -0
  60. package/dist/cjs/resources/group-resource.d.ts +96 -0
  61. package/dist/cjs/resources/group-resource.d.ts.map +1 -0
  62. package/dist/cjs/resources/group-resource.js +213 -0
  63. package/dist/cjs/resources/group-resource.js.map +1 -0
  64. package/dist/cjs/resources/list-resource.d.ts +111 -0
  65. package/dist/cjs/resources/list-resource.d.ts.map +1 -0
  66. package/dist/cjs/resources/list-resource.js +179 -0
  67. package/dist/cjs/resources/list-resource.js.map +1 -0
  68. package/dist/cjs/resources/media-resource.d.ts +69 -0
  69. package/dist/cjs/resources/media-resource.d.ts.map +1 -0
  70. package/dist/cjs/resources/media-resource.js +210 -0
  71. package/dist/cjs/resources/media-resource.js.map +1 -0
  72. package/dist/cjs/resources/media-type-resource.d.ts +70 -0
  73. package/dist/cjs/resources/media-type-resource.d.ts.map +1 -0
  74. package/dist/cjs/resources/media-type-resource.js +195 -0
  75. package/dist/cjs/resources/media-type-resource.js.map +1 -0
  76. package/dist/cjs/resources/navigation-resource.d.ts +664 -0
  77. package/dist/cjs/resources/navigation-resource.d.ts.map +1 -0
  78. package/dist/cjs/resources/navigation-resource.js +2349 -0
  79. package/dist/cjs/resources/navigation-resource.js.map +1 -0
  80. package/dist/cjs/resources/page-layout-resource.d.ts +83 -0
  81. package/dist/cjs/resources/page-layout-resource.d.ts.map +1 -0
  82. package/dist/cjs/resources/page-layout-resource.js +214 -0
  83. package/dist/cjs/resources/page-layout-resource.js.map +1 -0
  84. package/dist/cjs/resources/user-resource.d.ts +126 -0
  85. package/dist/cjs/resources/user-resource.d.ts.map +1 -0
  86. package/dist/cjs/resources/user-resource.js +317 -0
  87. package/dist/cjs/resources/user-resource.js.map +1 -0
  88. package/dist/cjs/section-ref.d.ts +185 -0
  89. package/dist/cjs/section-ref.d.ts.map +1 -0
  90. package/dist/cjs/section-ref.js +813 -0
  91. package/dist/cjs/section-ref.js.map +1 -0
  92. package/dist/cjs/site-structure.d.ts +18 -0
  93. package/dist/cjs/site-structure.d.ts.map +1 -0
  94. package/dist/cjs/site-structure.js +57 -0
  95. package/dist/cjs/site-structure.js.map +1 -0
  96. package/dist/cjs/t4-client.d.ts +121 -0
  97. package/dist/cjs/t4-client.d.ts.map +1 -0
  98. package/dist/cjs/t4-client.js +190 -0
  99. package/dist/cjs/t4-client.js.map +1 -0
  100. package/dist/cjs/type-registry.d.ts +31 -0
  101. package/dist/cjs/type-registry.d.ts.map +1 -0
  102. package/dist/cjs/type-registry.js +76 -0
  103. package/dist/cjs/type-registry.js.map +1 -0
  104. package/dist/cjs/types.d.ts +211 -0
  105. package/dist/cjs/types.d.ts.map +1 -0
  106. package/dist/cjs/types.js +3 -0
  107. package/dist/cjs/types.js.map +1 -0
  108. package/dist/cjs/utils.d.ts +147 -0
  109. package/dist/cjs/utils.d.ts.map +1 -0
  110. package/dist/cjs/utils.js +408 -0
  111. package/dist/cjs/utils.js.map +1 -0
  112. package/dist/esm/element-resolver.d.ts +115 -0
  113. package/dist/esm/element-resolver.d.ts.map +1 -0
  114. package/dist/esm/element-resolver.js +387 -0
  115. package/dist/esm/element-resolver.js.map +1 -0
  116. package/dist/esm/errors.d.ts +21 -0
  117. package/dist/esm/errors.d.ts.map +1 -0
  118. package/dist/esm/errors.js +17 -0
  119. package/dist/esm/errors.js.map +1 -0
  120. package/dist/esm/handlebars.d.ts +123 -0
  121. package/dist/esm/handlebars.d.ts.map +1 -0
  122. package/dist/esm/handlebars.js +300 -0
  123. package/dist/esm/handlebars.js.map +1 -0
  124. package/dist/esm/http-client.d.ts +21 -0
  125. package/dist/esm/http-client.d.ts.map +1 -0
  126. package/dist/esm/http-client.js +122 -0
  127. package/dist/esm/http-client.js.map +1 -0
  128. package/dist/esm/index.d.ts +37 -0
  129. package/dist/esm/index.d.ts.map +1 -0
  130. package/dist/esm/index.js +26 -0
  131. package/dist/esm/index.js.map +1 -0
  132. package/dist/esm/media-category-ref.d.ts +78 -0
  133. package/dist/esm/media-category-ref.d.ts.map +1 -0
  134. package/dist/esm/media-category-ref.js +180 -0
  135. package/dist/esm/media-category-ref.js.map +1 -0
  136. package/dist/esm/media-library.d.ts +30 -0
  137. package/dist/esm/media-library.d.ts.map +1 -0
  138. package/dist/esm/media-library.js +73 -0
  139. package/dist/esm/media-library.js.map +1 -0
  140. package/dist/esm/models/content-item.d.ts +80 -0
  141. package/dist/esm/models/content-item.d.ts.map +1 -0
  142. package/dist/esm/models/content-item.js +676 -0
  143. package/dist/esm/models/content-item.js.map +1 -0
  144. package/dist/esm/models/media-category-item.d.ts +29 -0
  145. package/dist/esm/models/media-category-item.d.ts.map +1 -0
  146. package/dist/esm/models/media-category-item.js +29 -0
  147. package/dist/esm/models/media-category-item.js.map +1 -0
  148. package/dist/esm/models/media-item.d.ts +74 -0
  149. package/dist/esm/models/media-item.d.ts.map +1 -0
  150. package/dist/esm/models/media-item.js +184 -0
  151. package/dist/esm/models/media-item.js.map +1 -0
  152. package/dist/esm/models/section-item.d.ts +58 -0
  153. package/dist/esm/models/section-item.d.ts.map +1 -0
  154. package/dist/esm/models/section-item.js +162 -0
  155. package/dist/esm/models/section-item.js.map +1 -0
  156. package/dist/esm/resources/channel-resource.d.ts +112 -0
  157. package/dist/esm/resources/channel-resource.d.ts.map +1 -0
  158. package/dist/esm/resources/channel-resource.js +102 -0
  159. package/dist/esm/resources/channel-resource.js.map +1 -0
  160. package/dist/esm/resources/content-resource.d.ts +50 -0
  161. package/dist/esm/resources/content-resource.d.ts.map +1 -0
  162. package/dist/esm/resources/content-resource.js +282 -0
  163. package/dist/esm/resources/content-resource.js.map +1 -0
  164. package/dist/esm/resources/content-type-resource.d.ts +283 -0
  165. package/dist/esm/resources/content-type-resource.d.ts.map +1 -0
  166. package/dist/esm/resources/content-type-resource.js +964 -0
  167. package/dist/esm/resources/content-type-resource.js.map +1 -0
  168. package/dist/esm/resources/group-resource.d.ts +96 -0
  169. package/dist/esm/resources/group-resource.d.ts.map +1 -0
  170. package/dist/esm/resources/group-resource.js +208 -0
  171. package/dist/esm/resources/group-resource.js.map +1 -0
  172. package/dist/esm/resources/list-resource.d.ts +111 -0
  173. package/dist/esm/resources/list-resource.d.ts.map +1 -0
  174. package/dist/esm/resources/list-resource.js +174 -0
  175. package/dist/esm/resources/list-resource.js.map +1 -0
  176. package/dist/esm/resources/media-resource.d.ts +69 -0
  177. package/dist/esm/resources/media-resource.d.ts.map +1 -0
  178. package/dist/esm/resources/media-resource.js +206 -0
  179. package/dist/esm/resources/media-resource.js.map +1 -0
  180. package/dist/esm/resources/media-type-resource.d.ts +70 -0
  181. package/dist/esm/resources/media-type-resource.d.ts.map +1 -0
  182. package/dist/esm/resources/media-type-resource.js +190 -0
  183. package/dist/esm/resources/media-type-resource.js.map +1 -0
  184. package/dist/esm/resources/navigation-resource.d.ts +664 -0
  185. package/dist/esm/resources/navigation-resource.d.ts.map +1 -0
  186. package/dist/esm/resources/navigation-resource.js +2344 -0
  187. package/dist/esm/resources/navigation-resource.js.map +1 -0
  188. package/dist/esm/resources/page-layout-resource.d.ts +83 -0
  189. package/dist/esm/resources/page-layout-resource.d.ts.map +1 -0
  190. package/dist/esm/resources/page-layout-resource.js +209 -0
  191. package/dist/esm/resources/page-layout-resource.js.map +1 -0
  192. package/dist/esm/resources/user-resource.d.ts +126 -0
  193. package/dist/esm/resources/user-resource.d.ts.map +1 -0
  194. package/dist/esm/resources/user-resource.js +312 -0
  195. package/dist/esm/resources/user-resource.js.map +1 -0
  196. package/dist/esm/section-ref.d.ts +185 -0
  197. package/dist/esm/section-ref.d.ts.map +1 -0
  198. package/dist/esm/section-ref.js +808 -0
  199. package/dist/esm/section-ref.js.map +1 -0
  200. package/dist/esm/site-structure.d.ts +18 -0
  201. package/dist/esm/site-structure.d.ts.map +1 -0
  202. package/dist/esm/site-structure.js +53 -0
  203. package/dist/esm/site-structure.js.map +1 -0
  204. package/dist/esm/t4-client.d.ts +121 -0
  205. package/dist/esm/t4-client.d.ts.map +1 -0
  206. package/dist/esm/t4-client.js +186 -0
  207. package/dist/esm/t4-client.js.map +1 -0
  208. package/dist/esm/type-registry.d.ts +31 -0
  209. package/dist/esm/type-registry.d.ts.map +1 -0
  210. package/dist/esm/type-registry.js +72 -0
  211. package/dist/esm/type-registry.js.map +1 -0
  212. package/dist/esm/types.d.ts +211 -0
  213. package/dist/esm/types.d.ts.map +1 -0
  214. package/dist/esm/types.js +2 -0
  215. package/dist/esm/types.js.map +1 -0
  216. package/dist/esm/utils.d.ts +147 -0
  217. package/dist/esm/utils.d.ts.map +1 -0
  218. package/dist/esm/utils.js +355 -0
  219. package/dist/esm/utils.js.map +1 -0
  220. package/docs/channels.md +62 -0
  221. package/docs/content-types.md +313 -0
  222. package/docs/content.md +199 -0
  223. package/docs/error-handling.md +86 -0
  224. package/docs/getting-started.md +146 -0
  225. package/docs/groups-and-users.md +167 -0
  226. package/docs/handlebars.md +145 -0
  227. package/docs/lists.md +98 -0
  228. package/docs/media-types.md +111 -0
  229. package/docs/media.md +169 -0
  230. package/docs/navigation/a-to-z.md +62 -0
  231. package/docs/navigation/breadcrumbs.md +67 -0
  232. package/docs/navigation/css-selector.md +53 -0
  233. package/docs/navigation/generate-file.md +48 -0
  234. package/docs/navigation/keyword-search.md +134 -0
  235. package/docs/navigation/language-switcher.md +37 -0
  236. package/docs/navigation/link-menu.md +105 -0
  237. package/docs/navigation/pagination.md +80 -0
  238. package/docs/navigation/previous-next-fulltext.md +43 -0
  239. package/docs/navigation/publish-to-one-file.md +93 -0
  240. package/docs/navigation/related-content.md +79 -0
  241. package/docs/navigation/related-section-branch.md +31 -0
  242. package/docs/navigation/return-to-index.md +35 -0
  243. package/docs/navigation/section-details.md +51 -0
  244. package/docs/navigation/section-iterator.md +33 -0
  245. package/docs/navigation/section-meta-info.md +39 -0
  246. package/docs/navigation/site-map.md +58 -0
  247. package/docs/navigation/top-content.md +80 -0
  248. package/docs/navigation/top-stories.md +47 -0
  249. package/docs/navigation.md +134 -0
  250. package/docs/page-layouts.md +71 -0
  251. package/docs/sections.md +224 -0
  252. package/docs/typescript.md +124 -0
  253. package/package.json +64 -0
package/docs/media.md ADDED
@@ -0,0 +1,169 @@
1
+ # Media
2
+
3
+ Use `t4.media` for files, `t4.mediaCategory(id)` for category operations, and `t4.mediaLibrary` for the complete category tree.
4
+
5
+ ## Contents
6
+
7
+ - [Media items](#media-items)
8
+ - [Create and update media](#create-and-update-media)
9
+ - [Delete or purge media](#delete-or-purge-media)
10
+ - [Media categories](#media-categories)
11
+ - [Media library tree](#media-library-tree)
12
+
13
+ ## Media items
14
+
15
+ ### Get a media item
16
+
17
+ ```typescript
18
+ const media = await t4.media.get(10928);
19
+ ```
20
+
21
+ | Property | Example or meaning |
22
+ |---|---|
23
+ | `id` | `10928` |
24
+ | `name` | `'Cat Photo'` |
25
+ | `description` | `'A cat running through grass'` |
26
+ | `fileName` | `'cat-image.jpg'` |
27
+ | `fileSize` | `'28.7 KB'` |
28
+ | `mediaType` | `'Image'` |
29
+ | `mediaTypeId` | `1` |
30
+ | `language` | `'smxx'` |
31
+ | `version` | `'1.0'` |
32
+ | `status` | `'approved'` |
33
+ | `downloadUrl` | Download URL |
34
+ | `thumbnailUrl` | Thumbnail URL |
35
+ | `path` | `'Media Library » Images » Cats'` |
36
+ | `categories` | Category IDs, such as `[366]` |
37
+ | `fields` | Custom values, such as `{ 'Photo Credit': 'Jane Smith' }` |
38
+
39
+ ### Non-binary media
40
+
41
+ CSS, JavaScript, PHP, and other non-binary media expose text content and a syntax type:
42
+
43
+ ```typescript
44
+ const css = await t4.media.get(4635);
45
+ console.log(css.content); // '* { box-sizing: border-box; }'
46
+ console.log(css.syntaxType); // 'css'
47
+
48
+ css.content = '* { color: red; }';
49
+ await css.save(); // increments the version
50
+ ```
51
+
52
+ You can also replace a non-binary file. The save request includes both the file and text content:
53
+
54
+ ```typescript
55
+ css.file = './new-styles.css';
56
+ await css.save();
57
+ ```
58
+
59
+ ## Create and update media
60
+
61
+ ### Create media
62
+
63
+ The SDK detects the media type from the file extension:
64
+
65
+ ```typescript
66
+ const image = await t4.media.create({
67
+ file: './hero-image.jpg',
68
+ name: 'Hero Image',
69
+ category: 391,
70
+ description: 'Homepage hero',
71
+ });
72
+
73
+ const stylesheet = await t4.media.create({
74
+ file: { file: new Blob(['body { color: red; }']), filename: 'styles.css' },
75
+ name: 'Main Stylesheet',
76
+ category: 355,
77
+ });
78
+ ```
79
+
80
+ ### Direct update
81
+
82
+ ```typescript
83
+ await t4.media.update(10928, {
84
+ name: 'Renamed',
85
+ description: 'Updated',
86
+ file: './replacement.png', // optional replacement
87
+ });
88
+ ```
89
+
90
+ ### Mutable item
91
+
92
+ ```typescript
93
+ const media = await t4.media.get(10928);
94
+ media.name = 'Updated Cat';
95
+ media.description = 'A fast cat';
96
+ media.fields['Photo Credit'] = 'New Photographer';
97
+ await media.save();
98
+ ```
99
+
100
+ Assign `file` to replace the current file. A save increments the version automatically:
101
+
102
+ ```typescript
103
+ media.file = './new-image.png';
104
+ await media.save();
105
+ ```
106
+
107
+ `file` accepts a local path, HTTPS URL, Blob, or `{ file, filename }`. If the replacement has a different file type, such as replacing CSS with PNG, the SDK recalculates the media type and syntax type from the new extension.
108
+
109
+ ## Delete or purge media
110
+
111
+ ```typescript
112
+ await t4.media.delete(10928); // selects the category when the media is in one category
113
+ await t4.media.delete(10928, { categoryId: 366 }); // required for multiple categories
114
+ await t4.media.purge(10928); // permanent removal; media must be deleted first
115
+ ```
116
+
117
+ ## Media categories
118
+
119
+ `t4.mediaCategory(id)` creates a lightweight `MediaCategoryRef` without making an API request.
120
+
121
+ ### Read and update a category
122
+
123
+ #### Direct update
124
+
125
+ ```typescript
126
+ await t4.mediaCategory(367).update({ name: 'Renamed' });
127
+ ```
128
+
129
+ #### Mutable item
130
+
131
+ ```typescript
132
+ const category = await t4.mediaCategory(367).get();
133
+ console.log(category.id, category.name, category.path, category.lastModified);
134
+
135
+ category.name = 'Renamed';
136
+ await category.save();
137
+ ```
138
+
139
+ ### List media and subcategories
140
+
141
+ ```typescript
142
+ const items = await t4.mediaCategory(367).list();
143
+ // [{ id, name, description, fileName, fileSize, mediaType, language, version, status, lastModified }]
144
+
145
+ const subcategories = await t4.mediaCategory(366).subcategories();
146
+ // [{ id, name, lastModified }]
147
+ ```
148
+
149
+ ### Create, delete, purge, or move a category
150
+
151
+ ```typescript
152
+ const child = await t4.mediaCategory(367).addCategory({ name: 'New Folder' });
153
+
154
+ await t4.mediaCategory(500).delete();
155
+ await t4.mediaCategory(500).purge();
156
+ await t4.mediaCategory(500).move(367); // move under category 367
157
+ ```
158
+
159
+ ## Media library tree
160
+
161
+ ```typescript
162
+ const tree = await t4.mediaLibrary.tree();
163
+ ```
164
+
165
+ The result is the full category hierarchy as `MediaCategoryNode` objects with `id`, `name`, and optional `children`.
166
+
167
+ ---
168
+
169
+ **Previous:** [Page Layouts](./page-layouts.md) · **Next:** [Media Types](./media-types.md)
@@ -0,0 +1,62 @@
1
+ # A to Z Navigation
2
+
3
+ Build an alphabetical section listing for a directory-style page.
4
+
5
+ [Terminalfour Documentation](https://docs.terminalfour.com/documentation/navigation/create-a-new-navigation-object/a-to-z-navigation-object/)
6
+
7
+ ## Create
8
+
9
+ ```typescript
10
+ await t4.navigation.create({
11
+ type: 'a-to-z',
12
+ name: 'Department A-Z',
13
+ properties: {
14
+ startLevel: 2,
15
+ endLevel: 5,
16
+ useSectionMetaData: true,
17
+ sectionMetaContentTypeElement: 'Title',
18
+ microSite: 6,
19
+ beforeMenu: '<ul class="az-nav">',
20
+ afterMenu: '</ul>',
21
+ beforeItem: '<li>',
22
+ afterItem: '</li>',
23
+ },
24
+ });
25
+ ```
26
+
27
+ ## Properties
28
+
29
+ ### Common properties
30
+
31
+ | Property | Type | Default | Description |
32
+ |---|---|---|---|
33
+ | `startLevel` | `number` | `0` | Starts generation at this level. `0` starts at the root. |
34
+ | `endLevel` | `number` | `0` | Stops generation at this level. `0` includes all sections. |
35
+ | `useSectionMetaData` | `boolean` | `false` | Uses a Section Meta Data element instead of the section name. |
36
+ | `microSite` | `number \| null` | `null` | Restricts the navigation to this microsite ID. |
37
+ | `beforeMenu` | `string` | `''` | HTML before the menu. |
38
+ | `afterMenu` | `string` | `''` | HTML after the menu. |
39
+ | `beforeItem` | `string` | `''` | HTML before each item. |
40
+ | `afterItem` | `string` | `''` | HTML after each item. |
41
+
42
+ ### When `useSectionMetaData` is `true`
43
+
44
+ | Property | Type | Default | Description |
45
+ |---|---|---|---|
46
+ | `sectionMetaContentTypeElement` | `string` | `''` | Names the element on the Section Meta Data content type. |
47
+
48
+ ## Validation
49
+
50
+ - Set `sectionMetaContentTypeElement` only when `useSectionMetaData` is `true`.
51
+ - The SDK validates `sectionMetaContentTypeElement` against the elements on the Section Meta Data content type.
52
+ - The SDK validates `microSite` against the microsites configured on all channels.
53
+
54
+ ## API notes
55
+
56
+ The SDK gets the Section Meta Data content type through `GET /config/hierarchy.metaDataContentType`.
57
+
58
+ ## Caching
59
+
60
+ Caching is always disabled for this type.
61
+
62
+ [Back to Navigation](../navigation.md)
@@ -0,0 +1,67 @@
1
+ # Breadcrumbs
2
+
3
+ Show the current page's hierarchy and link back through its parent sections.
4
+
5
+ [Terminalfour Documentation](https://docs.terminalfour.com/documentation/navigation/create-a-new-navigation-object/breadcrumbs-navigation-object/)
6
+
7
+ ## Create
8
+
9
+ ```typescript
10
+ await t4.navigation.create({
11
+ type: 'breadcrumbs',
12
+ name: 'Main Breadcrumbs',
13
+ properties: {
14
+ startLevel: 1,
15
+ endLevel: 0,
16
+ useLinks: true,
17
+ linkCurrent: false,
18
+ hideHome: true,
19
+ noSpace: true,
20
+ maxLength: 50,
21
+ separator: ' > ',
22
+ elementToAppend: 'Title',
23
+ beforeHtml: '<nav aria-label="breadcrumb">',
24
+ afterHtml: '</nav>',
25
+ },
26
+ });
27
+ ```
28
+
29
+ ## Properties
30
+
31
+ ### Level range
32
+
33
+ | Property | Type | Default | Description |
34
+ |---|---|---|---|
35
+ | `startLevel` | `number` | `0` | Starts at this level. `0` starts at the root. |
36
+ | `endLevel` | `number` | `0` | Ends at this level. `0` includes all levels. |
37
+ | `maxLength` | `number` | `0` | Truncates after this many characters. `0` sets no limit. |
38
+
39
+ ### Link behavior
40
+
41
+ | Property | Type | Default | Description |
42
+ |---|---|---|---|
43
+ | `useLinks` | `boolean` | `false` | Turns breadcrumb items into links. |
44
+ | `linkCurrent` | `boolean` | `false` | Turns the current, last item into a link. |
45
+ | `hideHome` | `boolean` | `false` | Hides the home section. |
46
+ | `noSpace` | `boolean` | `false` | Removes spaces from links. |
47
+
48
+ ### Content and output
49
+
50
+ | Property | Type | Default | Description |
51
+ |---|---|---|---|
52
+ | `separator` | `string` | `''` | HTML between items. |
53
+ | `elementToAppend` | `string` | `''` | Names the content element to append. |
54
+ | `beforeHtml` | `string` | `''` | HTML before the breadcrumb. |
55
+ | `afterHtml` | `string` | `''` | HTML after the breadcrumb. |
56
+
57
+ ## Validation
58
+
59
+ - `startLevel`, `endLevel`, and `maxLength` must be zero or greater.
60
+ - Set either a positive `startLevel` or `endLevel`, or a positive `maxLength`. Do not combine the level range with `maxLength`.
61
+ - Set `noSpace` to `true` only when `useLinks` is `true`.
62
+
63
+ ## API behavior
64
+
65
+ Setting `elementToAppend` automatically enables the append-content-element flag.
66
+
67
+ [Back to Navigation](../navigation.md)
@@ -0,0 +1,53 @@
1
+ # CSS Selector
2
+
3
+ Apply different CSS stylesheets to different branches of the site hierarchy.
4
+
5
+ [Terminalfour Documentation](https://docs.terminalfour.com/documentation/navigation/create-a-new-navigation-object/css-selector-navigation-object/)
6
+
7
+ ## Create
8
+
9
+ ```typescript
10
+ await t4.navigation.create({
11
+ type: 'css-selector',
12
+ name: 'My CSS Selector',
13
+ properties: {
14
+ defaultStylesheet: 11299,
15
+ language: 'en',
16
+ branches: [
17
+ { stylesheet: 4767, rootSection: 233 },
18
+ { stylesheet: 4768, name: 'Homepage' },
19
+ ],
20
+ },
21
+ });
22
+ ```
23
+
24
+ ## Properties
25
+
26
+ ### Common properties
27
+
28
+ | Property | Type | Default | Description |
29
+ |---|---|---|---|
30
+ | `defaultStylesheet` | `number` | *required* | Media ID of the default stylesheet. |
31
+ | `language` | `string` | `''` | Language code. |
32
+ | `branches` | `array` | `[]` | Branch-specific stylesheet overrides. |
33
+
34
+ ### Branch object
35
+
36
+ | Property | Type | Description |
37
+ |---|---|---|
38
+ | `stylesheet` | `number` | Media ID of the stylesheet for this branch. Required. |
39
+ | `name` | `string` | Section name to match. Do not combine it with `rootSection`. |
40
+ | `rootSection` | `number` | Section ID to use as the root. Do not combine it with `name`. |
41
+
42
+ ## Validation
43
+
44
+ - `defaultStylesheet` is required, and its media item must exist.
45
+ - The SDK validates each branch `stylesheet`.
46
+ - The SDK validates each branch `rootSection` and requires the section to exist.
47
+ - A branch cannot contain both `name` and `rootSection`.
48
+
49
+ ## API notes
50
+
51
+ The SDK sends branch properties only when `branches` is provided.
52
+
53
+ [Back to Navigation](../navigation.md)
@@ -0,0 +1,48 @@
1
+ # Generate File
2
+
3
+ Publish a file from a content layout or media item into a directory during publishing.
4
+
5
+ [Terminalfour Documentation](https://docs.terminalfour.com/documentation/navigation/create-a-new-navigation-object/generate-file--navigation-object/)
6
+
7
+ ## Create
8
+
9
+ ```typescript
10
+ await t4.navigation.create({
11
+ type: 'generate-file',
12
+ name: 'RSS Feed Generator',
13
+ properties: {
14
+ fileName: 'feed',
15
+ fileExtension: 'xml',
16
+ layout: 'text/rss',
17
+ appendContentId: true,
18
+ appendDirectory: true,
19
+ baseDirectory: '/feeds',
20
+ mediaFile: 4767,
21
+ },
22
+ });
23
+ ```
24
+
25
+ ## Properties
26
+
27
+ ### File and source
28
+
29
+ | Property | Type | Default | Description |
30
+ |---|---|---|---|
31
+ | `fileName` | `string` | `''` | Output file name. |
32
+ | `fileExtension` | `string` | `''` | Generated file extension. |
33
+ | `layout` | `string` | `''` | Content layout name. |
34
+ | `mediaFile` | `number \| null` | `null` | Media ID to associate. |
35
+
36
+ ### Output path
37
+
38
+ | Property | Type | Default | Description |
39
+ |---|---|---|---|
40
+ | `appendContentId` | `boolean` | `false` | Appends the content ID to the file name. |
41
+ | `appendDirectory` | `boolean` | `false` | Appends the directory path. |
42
+ | `baseDirectory` | `string` | `''` | Base output directory. |
43
+
44
+ ## Validation
45
+
46
+ When `mediaFile` is provided, the SDK validates it against the media library.
47
+
48
+ [Back to Navigation](../navigation.md)
@@ -0,0 +1,134 @@
1
+ # Keyword Search Content
2
+
3
+ Find and display content items that share keywords with the current content across sections.
4
+
5
+ [Terminalfour Documentation](https://docs.terminalfour.com/documentation/navigation/create-a-new-navigation-object/keyword-search-content-navigation-object/)
6
+
7
+ ## Create
8
+
9
+ ```typescript
10
+ await t4.navigation.create({
11
+ type: 'keyword-search',
12
+ name: 'Keywords Search',
13
+ properties: {
14
+ // Keyword Retrieval
15
+ keywordFetchMethod: 'section',
16
+ keywordSection: 233,
17
+ narrowToSingleContentItem: true,
18
+ keywordContentTypeId: 343,
19
+ keywordElements: ['Cascading List', 'Keyword Selector'],
20
+
21
+ // Content Retrieval
22
+ contentFetchMethod: 'section',
23
+ searchSection: 7805,
24
+ searchContentTypeId: 67,
25
+ searchElements: ['Finditems'],
26
+
27
+ // Display
28
+ numToDisplay: 10,
29
+ sortType: 'name',
30
+ sortByDateElement: true,
31
+ dateElementName: 'Release Date',
32
+ showHiddenSections: true,
33
+ matchCompositeKeywords: true,
34
+ matchSubItems: true,
35
+ crossLanguageSearch: true,
36
+ crossLanguageLanguages: ['en', 'es'],
37
+
38
+ // Output
39
+ altLayoutName: 'text/bar',
40
+ beforeHtml: '<div>',
41
+ afterHtml: '</div>',
42
+ pagination: true,
43
+ contentPerPage: 20,
44
+ },
45
+ });
46
+ ```
47
+
48
+ ## Properties
49
+
50
+ ### Common properties
51
+
52
+ | Property | Type | Default | Description |
53
+ |---|---|---|---|
54
+ | `keywordFetchMethod` | `string` | `'current'` | Keyword source: `'current'`, `'parent'`, or `'section'`. |
55
+ | `narrowToSingleContentItem` | `boolean` | `false` | Narrows the keyword source to one content item. |
56
+ | `keywordContentTypeId` | `number \| null` | `null` | Content Type ID. `null` accepts any content type. |
57
+ | `keywordElements` | `string[]` | `[]` | Element names from which to get keywords. |
58
+ | `contentFetchMethod` | `string` | `'section'` | Content scope: `'section'`, `'branch'`, or `'branch-at-level'`. |
59
+ | `searchContentTypeId` | `number \| null` | `null` | Content Type ID to search. `null` accepts any content type. |
60
+ | `searchElements` | `string[]` | `[]` | Element names in which to search for keywords. |
61
+
62
+ ### When `keywordFetchMethod` is `'section'`
63
+
64
+ | Property | Type | Default | Description |
65
+ |---|---|---|---|
66
+ | `keywordSection` | `number` | `n/a` | Section ID from which to get keywords. |
67
+
68
+ ### When `contentFetchMethod` is `'section'` or `'branch'`
69
+
70
+ | Property | Type | Default | Description |
71
+ |---|---|---|---|
72
+ | `searchSection` | `number` | `n/a` | Section to search. Use this or `searchSectionElement`, not both. |
73
+ | `searchSectionElement` | `string` | `n/a` | Element name from which to derive the section. Use this or `searchSection`, not both. |
74
+
75
+ ### When `contentFetchMethod` is `'branch-at-level'`
76
+
77
+ | Property | Type | Default | Description |
78
+ |---|---|---|---|
79
+ | `startLevel` | `number` | `0` | Starting level. |
80
+ | `endLevel` | `number` | `0` | Ending level or recursion depth. |
81
+
82
+ ### Display
83
+
84
+ | Property | Type | Default | Description |
85
+ |---|---|---|---|
86
+ | `numToDisplay` | `number` | `0` | Number of items. `0` displays all items. |
87
+ | `sortType` | `string` | `'name'` | Sort order: `'name'`, `'name-desc'`, or `'last-modified'`. |
88
+ | `sortByDateElement` | `boolean` | `false` | Sorts by a date element. |
89
+ | `showUpcomingContent` | `boolean` | `false` | Includes upcoming or future content. |
90
+ | `showHiddenSections` | `boolean` | `false` | Includes hidden sections. |
91
+ | `matchCompositeKeywords` | `boolean` | `false` | Matches composite keywords. |
92
+ | `matchSubItems` | `boolean` | `false` | Matches sub-items. |
93
+ | `crossLanguageSearch` | `boolean` | `false` | Searches across languages. |
94
+ | `crossLanguageLanguages` | `string[]` | `[]` | Language codes, such as `['en', 'es']`. |
95
+
96
+ ### When `sortByDateElement` is `true`
97
+
98
+ | Property | Type | Default | Description |
99
+ |---|---|---|---|
100
+ | `dateElementName` | `string` | `n/a` | Date element name. |
101
+
102
+ ### Output
103
+
104
+ | Property | Type | Default | Description |
105
+ |---|---|---|---|
106
+ | `altLayoutName` | `string` | `''` | Alternative content layout name. |
107
+ | `beforeHtml` | `string` | `''` | HTML before content. |
108
+ | `afterHtml` | `string` | `''` | HTML after content. |
109
+ | `pagination` | `boolean` | `false` | Paginates the results. |
110
+
111
+ ### When `pagination` is `true`
112
+
113
+ | Property | Type | Default | Description |
114
+ |---|---|---|---|
115
+ | `contentPerPage` | `number` | `0` | Items per page. |
116
+ | `beforePaginationHtml` | `string` | `''` | HTML before pagination. |
117
+ | `betweenPaginationHtml` | `string` | `''` | HTML between pagination links. |
118
+ | `afterPaginationHtml` | `string` | `''` | HTML after pagination. |
119
+
120
+ ## Validation
121
+
122
+ - When `keywordFetchMethod` is `'section'`, `keywordSection` is required and validated.
123
+ - For a `'section'` or `'branch'` content search, set exactly one of `searchSection` and `searchSectionElement`.
124
+ - The SDK validates `searchSectionElement` against content type elements when `keywordContentTypeId` is a positive number.
125
+ - Provide `startLevel` and `endLevel` only for `'branch-at-level'`.
126
+ - Provide `dateElementName` only when `sortByDateElement` is `true`.
127
+ - Provide pagination fields only when `pagination` is `true`.
128
+ - The SDK validates non-null `keywordContentTypeId` and `searchContentTypeId` values.
129
+
130
+ ## Caching
131
+
132
+ Caching is enabled by default.
133
+
134
+ [Back to Navigation](../navigation.md)
@@ -0,0 +1,37 @@
1
+ # Language Switcher
2
+
3
+ Link between language versions of the current page on a multilingual site.
4
+
5
+ [Terminalfour Documentation](https://docs.terminalfour.com/documentation/navigation/create-a-new-navigation-object/language-switcher-navigation-object/)
6
+
7
+ ## Create
8
+
9
+ ```typescript
10
+ await t4.navigation.create({
11
+ type: 'language-switcher',
12
+ name: 'Language Nav',
13
+ properties: {
14
+ langCode: 'en',
15
+ alwaysOutput: true,
16
+ imageUrl: 'https://example.com/flags',
17
+ imageExtension: '.gif',
18
+ imageProperties: 'width="30" height="30"',
19
+ beforeHtml: '<div class="langs">',
20
+ afterHtml: '</div>',
21
+ },
22
+ });
23
+ ```
24
+
25
+ ## Properties
26
+
27
+ | Property | Type | Default | Description |
28
+ |---|---|---|---|
29
+ | `langCode` | `string` | `''` | Language code. |
30
+ | `alwaysOutput` | `boolean` | `false` | Outputs the switcher when only one language exists. |
31
+ | `imageUrl` | `string` | `''` | URL for image-based language links. |
32
+ | `imageExtension` | `string` | `''` | File extension for language images, such as `.gif`. |
33
+ | `imageProperties` | `string` | `''` | HTML image attributes, such as `width="30"`. |
34
+ | `beforeHtml` | `string` | `''` | HTML before the switcher. |
35
+ | `afterHtml` | `string` | `''` | HTML after the switcher. |
36
+
37
+ [Back to Navigation](../navigation.md)
@@ -0,0 +1,105 @@
1
+ # Link Menu
2
+
3
+ Build section links for main navigation menus or sidebars.
4
+
5
+ [Terminalfour Documentation](https://docs.terminalfour.com/documentation/navigation/create-a-new-navigation-object/link-menu-navigation-object/)
6
+
7
+ ## Create
8
+
9
+ ```typescript
10
+ // Branch at level
11
+ await t4.navigation.create({
12
+ type: 'link-menu',
13
+ name: 'Main Nav',
14
+ properties: {
15
+ menuType: 'branch-at-level',
16
+ level: 2,
17
+ numToRecurse: 3,
18
+ subNavigationType: 'ul',
19
+ menuDisplayType: 'normal',
20
+ showNonCurrentChildren: true,
21
+ useCurrentBranchClass: true,
22
+ currentSectionLink: true,
23
+ addSectionName: true,
24
+ title: 'Navigation',
25
+ beforeMenuHtml: '<ul>',
26
+ afterMenuHtml: '</ul>',
27
+ beforeLinkHtml: '<li>',
28
+ afterLinkHtml: '</li>',
29
+ betweenLink: '',
30
+ },
31
+ });
32
+
33
+ // Children with specific branch
34
+ await t4.navigation.create({
35
+ type: 'link-menu',
36
+ name: 'Child Nav',
37
+ properties: {
38
+ menuType: 'children',
39
+ displaySpecificBranch: true,
40
+ specificBranchId: 233,
41
+ showSiblingsIfNoChildren: true,
42
+ showAncestorsIfNoChildren: false,
43
+ },
44
+ });
45
+ ```
46
+
47
+ ## Menu type summary
48
+
49
+ | `menuType` | Mode-specific properties |
50
+ |---|---|
51
+ | `'branch-at-level'` | `level` and `numToRecurse` |
52
+ | `'children'` | `displaySpecificBranch`, `specificBranchId`, `showSiblingsIfNoChildren`, `showAncestorsIfNoChildren` |
53
+ | `'siblings'` | `n/a` |
54
+ | `'siblings-and-children'` | `subNavigationType` |
55
+
56
+ ## Properties
57
+
58
+ ### Common properties
59
+
60
+ | Property | Type | Default | Description |
61
+ |---|---|---|---|
62
+ | `menuType` | `string` | *required* | Menu scope: `'branch-at-level'`, `'children'`, `'siblings'`, or `'siblings-and-children'`. |
63
+ | `menuDisplayType` | `string` | `'normal'` | Display type: `'normal'` or `'dropdown'`. |
64
+ | `showNonCurrentChildren` | `boolean` | `false` | Shows children of non-current sections. |
65
+ | `useCurrentBranchClass` | `boolean` | `false` | Adds a CSS class to the current branch. |
66
+ | `currentSectionLink` | `boolean` | `false` | Turns the current section into a link. |
67
+ | `addSectionName` | `boolean` | `false` | Prepends the section name to the title. |
68
+ | `title` | `string` | `''` | Title text. |
69
+ | `beforeMenuHtml` | `string` | `''` | HTML before the menu. |
70
+ | `afterMenuHtml` | `string` | `''` | HTML after the menu. |
71
+ | `beforeLinkHtml` | `string` | `''` | HTML before each link. |
72
+ | `afterLinkHtml` | `string` | `''` | HTML after each link. |
73
+ | `betweenLink` | `string` | `''` | HTML between links. |
74
+
75
+ ### When `menuType` is `'branch-at-level'`
76
+
77
+ | Property | Type | Default | Description |
78
+ |---|---|---|---|
79
+ | `level` | `number` | `0` | Starting level. |
80
+ | `numToRecurse` | `number` | `1` | Recursion depth. |
81
+ | `subNavigationType` | `string` | `'ul'` | Nested navigation type: `'ul'`, `'table'`, or `'div'`. |
82
+
83
+ ### When `menuType` is `'children'`
84
+
85
+ | Property | Type | Default | Description |
86
+ |---|---|---|---|
87
+ | `displaySpecificBranch` | `boolean` | `false` | Displays a specific branch. |
88
+ | `specificBranchId` | `number` | `n/a` | Section ID of the specific branch. |
89
+ | `showSiblingsIfNoChildren` | `boolean` | `false` | Shows siblings when no children exist. |
90
+ | `showAncestorsIfNoChildren` | `boolean` | `false` | Shows ancestors when no children exist. |
91
+
92
+ ### When `menuType` is `'siblings-and-children'`
93
+
94
+ | Property | Type | Default | Description |
95
+ |---|---|---|---|
96
+ | `subNavigationType` | `string` | `'ul'` | Nested navigation type: `'ul'`, `'table'`, or `'div'`. |
97
+
98
+ ## Validation
99
+
100
+ - Set `level` and `numToRecurse` only for `'branch-at-level'`.
101
+ - Set `subNavigationType` for `'branch-at-level'` only when `numToRecurse` is greater than 1. You can also set it for `'siblings-and-children'`.
102
+ - Set `displaySpecificBranch`, `showSiblingsIfNoChildren`, and `showAncestorsIfNoChildren` only for `'children'`.
103
+ - Set `specificBranchId` only when `displaySpecificBranch` is `true`. The SDK validates the section ID.
104
+
105
+ [Back to Navigation](../navigation.md)