google-docs-components
Advanced tools
Comparing version 1.0.0 to 1.0.1
import type { document, element } from "google-docs-parser"; | ||
import { ComponentData, Config, ElementData } from "./types"; | ||
export declare type ProcessedContent = Array<ElementData | ComponentData>; | ||
import { ComponentData, Config, ContentData, ElementData } from "./types"; | ||
import { ProcessedContent } from "./types"; | ||
export declare type ParseContent = (element: Array<element>) => ProcessedContent; | ||
export type { ProcessedContent, ComponentData, ContentData, ElementData, Config }; | ||
export declare type ProcessedDocument = { | ||
@@ -6,0 +7,0 @@ body: ProcessedContent; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.componentsFromDoc = void 0; | ||
const componentFromTable_1 = __importDefault(require("./componentFromTable")); | ||
const processTable_1 = __importDefault(require("./processTable")); | ||
function componentsFromDoc(config, doc) { | ||
@@ -25,11 +25,8 @@ const footnoteMap = {}; | ||
const styledText = element; | ||
const data = { | ||
element: "span", | ||
children: [styledText.html], | ||
style: styledText.css, | ||
}; | ||
const tag = styledText.link ? "a" : "span"; | ||
const data = Object.assign({ element: tag, children: [styledText.text], style: styledText.css }, (styledText.link && { attrs: { href: styledText.link } })); | ||
return data; | ||
} | ||
if (element.type == "table") { | ||
const component = componentFromTable_1.default(config.components, element, parseContent); | ||
const component = processTable_1.default(config.components, element, parseContent); | ||
if ("error" in component) { | ||
@@ -36,0 +33,0 @@ console.error(component.message); |
@@ -0,8 +1,16 @@ | ||
export declare type ContentData = ElementData | ComponentData | DevSlotData; | ||
export declare type ProcessedContent = Array<ContentData>; | ||
export declare type ElementData = string | { | ||
element: string; | ||
children: Array<ElementData | ComponentData>; | ||
children: ProcessedContent; | ||
style?: { | ||
[propertyName: string]: string | number; | ||
}; | ||
attrs?: { | ||
href?: string; | ||
}; | ||
}; | ||
export declare type DevSlotData = { | ||
slot: string; | ||
}; | ||
export declare type PropsDef = { | ||
@@ -22,4 +30,4 @@ [propName: string]: { | ||
export declare type SlotsData = { | ||
default?: Array<ComponentData | ElementData>; | ||
[propName: string]: Array<ComponentData | ElementData>; | ||
default?: ProcessedContent; | ||
[propName: string]: ProcessedContent; | ||
}; | ||
@@ -26,0 +34,0 @@ export declare type ComponentDef = { |
import type { document, element } from "google-docs-parser"; | ||
import { ComponentData, Config, ElementData } from "./types"; | ||
export declare type ProcessedContent = Array<ElementData | ComponentData>; | ||
import { ComponentData, Config, ContentData, ElementData } from "./types"; | ||
import { ProcessedContent } from "./types"; | ||
export declare type ParseContent = (element: Array<element>) => ProcessedContent; | ||
export type { ProcessedContent, ComponentData, ContentData, ElementData, Config }; | ||
export declare type ProcessedDocument = { | ||
@@ -6,0 +7,0 @@ body: ProcessedContent; |
@@ -1,2 +0,2 @@ | ||
import componentFromTable from "./componentFromTable"; | ||
import componentFromTable from "./processTable"; | ||
export function componentsFromDoc(config, doc) { | ||
@@ -18,7 +18,4 @@ const footnoteMap = {}; | ||
const styledText = element; | ||
const data = { | ||
element: "span", | ||
children: [styledText.html], | ||
style: styledText.css, | ||
}; | ||
const tag = styledText.link ? "a" : "span"; | ||
const data = Object.assign({ element: tag, children: [styledText.text], style: styledText.css }, (styledText.link && { attrs: { href: styledText.link } })); | ||
return data; | ||
@@ -25,0 +22,0 @@ } |
@@ -0,8 +1,16 @@ | ||
export declare type ContentData = ElementData | ComponentData | DevSlotData; | ||
export declare type ProcessedContent = Array<ContentData>; | ||
export declare type ElementData = string | { | ||
element: string; | ||
children: Array<ElementData | ComponentData>; | ||
children: ProcessedContent; | ||
style?: { | ||
[propertyName: string]: string | number; | ||
}; | ||
attrs?: { | ||
href?: string; | ||
}; | ||
}; | ||
export declare type DevSlotData = { | ||
slot: string; | ||
}; | ||
export declare type PropsDef = { | ||
@@ -22,4 +30,4 @@ [propName: string]: { | ||
export declare type SlotsData = { | ||
default?: Array<ComponentData | ElementData>; | ||
[propName: string]: Array<ComponentData | ElementData>; | ||
default?: ProcessedContent; | ||
[propName: string]: ProcessedContent; | ||
}; | ||
@@ -26,0 +34,0 @@ export declare type ComponentDef = { |
{ | ||
"name": "google-docs-components", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "./dist/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/esm/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
40228
581
1