structured-render 0.0.6 → 0.0.8

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.
@@ -1850,8 +1850,12 @@ export declare const StructuredRenderSectionType: { [Key in StructuredRenderSect
1850
1850
  export declare function doesSectionHaveContent(section: StructuredRenderSection | undefined | null): boolean;
1851
1851
  /**
1852
1852
  * A helper for falling back to a different structured render section if the given structured render
1853
- * table is empty.
1853
+ * table is empty. Returns a full {@link StructuredRenderSection} with the given `sectionTitle`.
1854
1854
  *
1855
1855
  * @category Util
1856
1856
  */
1857
- export declare function emptyStructuredRenderTableFallback<Fallback extends Omit<StructuredRenderSection, 'sectionTitle'> = Omit<StructuredRenderSection, 'sectionTitle'>>(table: Omit<StructuredRenderTable, 'sectionTitle'>, fallback: Fallback): Omit<StructuredRenderSection, 'sectionTitle'> | Fallback;
1857
+ export declare function emptyStructuredRenderTableFallback<Fallback extends Omit<StructuredRenderSection, 'sectionTitle'>>({ table, fallback, sectionTitle, }: {
1858
+ table: Omit<StructuredRenderTable, 'sectionTitle'>;
1859
+ fallback: Fallback;
1860
+ sectionTitle: string;
1861
+ }): StructuredRenderSection;
@@ -101,15 +101,13 @@ export function doesSectionHaveContent(section) {
101
101
  }
102
102
  /**
103
103
  * A helper for falling back to a different structured render section if the given structured render
104
- * table is empty.
104
+ * table is empty. Returns a full {@link StructuredRenderSection} with the given `sectionTitle`.
105
105
  *
106
106
  * @category Util
107
107
  */
108
- export function emptyStructuredRenderTableFallback(table, fallback) {
109
- if (doesSectionHaveContent(table)) {
110
- return table;
111
- }
112
- else {
113
- return fallback;
114
- }
108
+ export function emptyStructuredRenderTableFallback({ table, fallback, sectionTitle, }) {
109
+ return {
110
+ ...(doesSectionHaveContent(table) ? table : fallback),
111
+ sectionTitle,
112
+ };
115
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "structured-render",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "A library for safely rendering arbitrary data generated from any source.",
5
5
  "keywords": [
6
6
  "render",
@@ -44,7 +44,7 @@
44
44
  "@augment-vir/web": "^31.67.0",
45
45
  "@electrovir/color": "^1.7.8",
46
46
  "dompurify": "^3.3.1",
47
- "element-vir": "^26.14.4",
47
+ "element-vir": "^26.14.5",
48
48
  "html2canvas": "^1.4.1",
49
49
  "html2pdf.js": "^0.14.0",
50
50
  "lit-css-vars": "^3.5.0",
@@ -52,7 +52,7 @@
52
52
  "object-shape-tester": "^6.11.0",
53
53
  "theme-vir": "^28.22.0",
54
54
  "type-fest": "^5.4.4",
55
- "vira": "^29.8.0"
55
+ "vira": "^30.1.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@augment-vir/test": "^31.67.0",