@rededor/cura-hydrate 0.5.5 → 1.0.0-alpha.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 (4) hide show
  1. package/index.d.ts +42 -18
  2. package/index.js +27538 -11163
  3. package/index.mjs +28863 -0
  4. package/package.json +7 -1
package/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
- // Generated by dts-bundle-generator v7.2.0
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { Readable } from 'node:stream';
2
4
 
3
5
  export declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
6
+ export type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
4
7
  export interface HydrateDocumentOptions {
5
8
  /**
6
9
  * Build ID that will be added to `<html data-stencil-build="BUILD_ID">`. By default
@@ -14,7 +17,7 @@ export interface HydrateDocumentOptions {
14
17
  */
15
18
  canonicalUrl?: string;
16
19
  /**
17
- * Include the HTML comments and attributes used by the clientside
20
+ * Include the HTML comments and attributes used by the client-side
18
21
  * JavaScript to read the structure of the HTML and rebuild each
19
22
  * component. Defaults to `true`.
20
23
  */
@@ -35,7 +38,7 @@ export interface HydrateDocumentOptions {
35
38
  direction?: string;
36
39
  /**
37
40
  * Component tag names listed here will not be prerendered, nor will
38
- * hydrated on the clientside. Components listed here will be ignored
41
+ * hydrated on the client-side. Components listed here will be ignored
39
42
  * as custom elements and treated no differently than a `<div>`.
40
43
  */
41
44
  excludeComponents?: string[];
@@ -68,11 +71,11 @@ export interface HydrateDocumentOptions {
68
71
  */
69
72
  runtimeLogging?: boolean;
70
73
  /**
71
- * Component tags listed here will only be prerendered or serverside-rendered
72
- * and will not be clientside hydrated. This is useful for components that
74
+ * Component tags listed here will only be prerendered or server-side-rendered
75
+ * and will not be client-side hydrated. This is useful for components that
73
76
  * are not dynamic and do not need to be defined as a custom element within the
74
77
  * browser. For example, a header or footer component would be a good example that
75
- * may not require any clientside JavaScript.
78
+ * may not require any client-side JavaScript.
76
79
  */
77
80
  staticComponents?: string[];
78
81
  /**
@@ -134,6 +137,24 @@ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
134
137
  * Remove HTML comments. Defaults to `true`.
135
138
  */
136
139
  removeHtmlComments?: boolean;
140
+ /**
141
+ * If set to `true` the component will be rendered within a Declarative Shadow DOM.
142
+ * If set to `false` Stencil will ignore the contents of the shadow root and render the
143
+ * element as given in provided template.
144
+ * @default true
145
+ */
146
+ serializeShadowRoot?: boolean;
147
+ /**
148
+ * The `fullDocument` flag determines the format of the rendered output. Set it to true to
149
+ * generate a complete HTML document, or false to render only the component.
150
+ * @default true
151
+ */
152
+ fullDocument?: boolean;
153
+ /**
154
+ * Style modes to render the component in.
155
+ * @see https://stenciljs.com/docs/styling#style-modes
156
+ */
157
+ modes?: ResolutionHandler[];
137
158
  }
138
159
  export interface HydrateFactoryOptions extends SerializeDocumentOptions {
139
160
  serializeToHtml: boolean;
@@ -157,7 +178,7 @@ export interface Diagnostic {
157
178
  export interface PrintLine {
158
179
  lineIndex: number;
159
180
  lineNumber: number;
160
- text?: string;
181
+ text: string;
161
182
  errorCharStart: number;
162
183
  errorLength?: number;
163
184
  }
@@ -165,23 +186,23 @@ export interface HydrateResults {
165
186
  buildId: string;
166
187
  diagnostics: Diagnostic[];
167
188
  url: string;
168
- host: string;
169
- hostname: string;
170
- href: string;
171
- port: string;
172
- pathname: string;
173
- search: string;
174
- hash: string;
175
- html: string;
189
+ host: string | null;
190
+ hostname: string | null;
191
+ href: string | null;
192
+ port: string | null;
193
+ pathname: string | null;
194
+ search: string | null;
195
+ hash: string | null;
196
+ html: string | null;
176
197
  components: HydrateComponent[];
177
198
  anchors: HydrateAnchorElement[];
178
199
  imgs: HydrateImgElement[];
179
200
  scripts: HydrateScriptElement[];
180
201
  styles: HydrateStyleElement[];
181
202
  staticData: HydrateStaticData[];
182
- title: string;
203
+ title: string | null;
183
204
  hydratedCount: number;
184
- httpStatus: number;
205
+ httpStatus: number | null;
185
206
  }
186
207
  export interface HydrateComponent {
187
208
  tag: string;
@@ -211,8 +232,11 @@ export interface HydrateStaticData {
211
232
  type: string;
212
233
  content: string;
213
234
  }
235
+ export declare function streamToString(html: string | any, option?: SerializeDocumentOptions): Readable;
214
236
  export declare function renderToString(html: string | any, options?: SerializeDocumentOptions): Promise<HydrateResults>;
237
+ export declare function renderToString(html: string | any, options: SerializeDocumentOptions | undefined, asStream: true): Readable;
215
238
  export declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
216
- export declare function serializeDocumentToString(doc: any, opts: HydrateFactoryOptions): string;
239
+ export declare function hydrateDocument(doc: any | string, options: HydrateDocumentOptions | undefined, asStream?: boolean): Readable;
240
+ export declare function serializeDocumentToString(doc: Document, opts: HydrateFactoryOptions): string;
217
241
 
218
242
  export {};