@rededor/cura-hydrate 1.7.0 → 2.0.0-alpha.16
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.
- package/index.d.ts +52 -7
- package/index.js +11221 -2653
- package/index.mjs +11218 -2652
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
import { Readable } from 'node:stream';
|
|
4
4
|
|
|
5
5
|
export declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
|
|
6
|
+
export type TagTransformer = (tag: string) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Serialize a value to a string that can be deserialized later.
|
|
9
|
+
* @param {unknown} value - The value to serialize.
|
|
10
|
+
* @returns {string} A string that can be deserialized later.
|
|
11
|
+
* @deprecated will be removed in v5. Use `@PropSerialize()` decorator instead.
|
|
12
|
+
*/
|
|
13
|
+
export declare function serializeProperty(value: unknown): string | number | boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Deserialize a value from a string that was serialized earlier.
|
|
16
|
+
* @param {string} value - The string to deserialize.
|
|
17
|
+
* @returns {unknown} The deserialized value.
|
|
18
|
+
* @deprecated will be removed in v5. Use `@AttrDeserialize()` decorator instead.
|
|
19
|
+
*/
|
|
20
|
+
export declare function deserializeProperty(value: string): any;
|
|
6
21
|
export type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
|
|
7
22
|
export interface HydrateDocumentOptions {
|
|
8
23
|
/**
|
|
@@ -95,6 +110,30 @@ export interface HydrateDocumentOptions {
|
|
|
95
110
|
* Sets `navigator.userAgent`
|
|
96
111
|
*/
|
|
97
112
|
userAgent?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Configure how Stencil serializes the components shadow root.
|
|
115
|
+
* - If set to `declarative-shadow-dom` the component will be rendered within a Declarative Shadow DOM.
|
|
116
|
+
* - If set to `scoped` Stencil will render the contents of the shadow root as a `scoped: true` component
|
|
117
|
+
* and the shadow DOM will be created during client-side hydration.
|
|
118
|
+
* - Alternatively you can mix and match the two by providing an object with `declarative-shadow-dom` and `scoped` keys,
|
|
119
|
+
* the value arrays containing the tag names of the components that should be rendered in that mode.
|
|
120
|
+
*
|
|
121
|
+
* Examples:
|
|
122
|
+
* - `{ 'declarative-shadow-dom': ['my-component-1', 'another-component'], default: 'scoped' }`
|
|
123
|
+
* Render all components as `scoped` apart from `my-component-1` and `another-component`
|
|
124
|
+
* - `{ 'scoped': ['an-option-component'], default: 'declarative-shadow-dom' }`
|
|
125
|
+
* Render all components within `declarative-shadow-dom` apart from `an-option-component`
|
|
126
|
+
* - `'scoped'` Render all components as `scoped`
|
|
127
|
+
* - `false` disables shadow root serialization
|
|
128
|
+
*
|
|
129
|
+
* *NOTE* `true` has been deprecated in favor of `declarative-shadow-dom` and `scoped`
|
|
130
|
+
* @default 'declarative-shadow-dom'
|
|
131
|
+
*/
|
|
132
|
+
serializeShadowRoot?: "declarative-shadow-dom" | "scoped" | {
|
|
133
|
+
"declarative-shadow-dom"?: string[];
|
|
134
|
+
scoped?: string[];
|
|
135
|
+
default: "declarative-shadow-dom" | "scoped";
|
|
136
|
+
} | boolean;
|
|
98
137
|
}
|
|
99
138
|
export interface SerializeDocumentOptions extends HydrateDocumentOptions {
|
|
100
139
|
/**
|
|
@@ -137,13 +176,6 @@ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
|
|
|
137
176
|
* Remove HTML comments. Defaults to `true`.
|
|
138
177
|
*/
|
|
139
178
|
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
179
|
/**
|
|
148
180
|
* The `fullDocument` flag determines the format of the rendered output. Set it to true to
|
|
149
181
|
* generate a complete HTML document, or false to render only the component.
|
|
@@ -225,7 +257,9 @@ export interface HydrateScriptElement extends HydrateElement {
|
|
|
225
257
|
type?: string;
|
|
226
258
|
}
|
|
227
259
|
export interface HydrateStyleElement extends HydrateElement {
|
|
260
|
+
id?: string;
|
|
228
261
|
href?: string;
|
|
262
|
+
content?: string;
|
|
229
263
|
}
|
|
230
264
|
export interface HydrateStaticData {
|
|
231
265
|
id: string;
|
|
@@ -238,5 +272,16 @@ export declare function renderToString(html: string | any, options: SerializeDoc
|
|
|
238
272
|
export declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
|
|
239
273
|
export declare function hydrateDocument(doc: any | string, options: HydrateDocumentOptions | undefined, asStream?: boolean): Readable;
|
|
240
274
|
export declare function serializeDocumentToString(doc: Document, opts: HydrateFactoryOptions): string;
|
|
275
|
+
/**
|
|
276
|
+
* Transforms a tag name using the current tag transformer
|
|
277
|
+
* @param tag - the tag to transform e.g. `my-tag`
|
|
278
|
+
* @returns the transformed tag e.g. `new-my-tag`
|
|
279
|
+
*/
|
|
280
|
+
export declare function transformTag<T extends string>(tag: T): T;
|
|
281
|
+
/**
|
|
282
|
+
* Sets the tag transformer to be used when rendering custom elements
|
|
283
|
+
* @param transformer the transformer function to use. Must return a string
|
|
284
|
+
*/
|
|
285
|
+
export declare function setTagTransformer(transformer: TagTransformer): void;
|
|
241
286
|
|
|
242
287
|
export {};
|