1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import type { Directive } from './directive.js';
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | export declare type SanitizerFactory = (node: Node, name: string, type: 'property' | 'attribute') => ValueSanitizer;
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | export declare type ValueSanitizer = (value: unknown) => unknown;
|
42 |
|
43 | declare const HTML_RESULT = 1;
|
44 | declare const SVG_RESULT = 2;
|
45 | declare type ResultType = typeof HTML_RESULT | typeof SVG_RESULT;
|
46 |
|
47 |
|
48 |
|
49 | export declare type TemplateResult<T extends ResultType = ResultType> = {
|
50 | ['_$litType$']: T;
|
51 | strings: TemplateStringsArray;
|
52 | values: unknown[];
|
53 | };
|
54 | export declare type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;
|
55 | export declare type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;
|
56 | export interface CompiledTemplateResult {
|
57 | ['_$litType$']: CompiledTemplate;
|
58 | values: unknown[];
|
59 | }
|
60 | export interface CompiledTemplate extends Omit<Template, 'el'> {
|
61 | el?: HTMLTemplateElement;
|
62 | h: TrustedHTML;
|
63 | }
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 | export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult<1>;
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | export declare const svg: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult<2>;
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | export declare const noChange: unique symbol;
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 | export declare const nothing: unique symbol;
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 | export interface RenderOptions {
|
117 | |
118 |
|
119 |
|
120 |
|
121 | host?: object;
|
122 | |
123 |
|
124 |
|
125 | renderBefore?: ChildNode | null;
|
126 | |
127 |
|
128 |
|
129 |
|
130 |
|
131 | creationScope?: {
|
132 | importNode(node: Node, deep?: boolean): Node;
|
133 | };
|
134 | |
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 | isConnected?: boolean;
|
143 | }
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 | export declare const render: {
|
151 | (value: unknown, container: HTMLElement | DocumentFragment, options?: RenderOptions | undefined): RootPart;
|
152 | setSanitizer: (newSanitizer: SanitizerFactory) => void;
|
153 | createSanitizer: SanitizerFactory;
|
154 | _testOnlyClearSanitizerFactoryDoNotCallOrElse: () => void;
|
155 | };
|
156 | export interface DirectiveParent {
|
157 | _$parent?: DirectiveParent;
|
158 | _$isConnected: boolean;
|
159 | __directive?: Directive;
|
160 | __directives?: Array<Directive | undefined>;
|
161 | }
|
162 | declare class Template {
|
163 | constructor({ strings, ['_$litType$']: type }: TemplateResult, options?: RenderOptions);
|
164 | /** @nocollapse */
|
165 | static createElement(html: TrustedHTML, _options?: RenderOptions): HTMLTemplateElement;
|
166 | }
|
167 | export interface Disconnectable {
|
168 | _$parent?: Disconnectable;
|
169 | _$disconnectableChildren?: Set<Disconnectable>;
|
170 | _$isConnected: boolean;
|
171 | }
|
172 | declare function resolveDirective(part: ChildPart | AttributePart | ElementPart, value: unknown, parent?: DirectiveParent, attributeIndex?: number): unknown;
|
173 |
|
174 |
|
175 |
|
176 |
|
177 | declare class TemplateInstance implements Disconnectable {
|
178 | constructor(template: Template, parent: ChildPart);
|
179 | get parentNode(): Node;
|
180 | get _$isConnected(): boolean;
|
181 | _clone(options: RenderOptions | undefined): Node;
|
182 | _update(values: Array<unknown>): void;
|
183 | }
|
184 | export declare type Part = ChildPart | AttributePart | PropertyPart | BooleanAttributePart | ElementPart | EventPart;
|
185 | export type { ChildPart };
|
186 | declare class ChildPart implements Disconnectable {
|
187 | readonly type = 2;
|
188 | readonly options: RenderOptions | undefined;
|
189 | _$committedValue: unknown;
|
190 | private _textSanitizer;
|
191 | get _$isConnected(): boolean;
|
192 | constructor(startNode: ChildNode, endNode: ChildNode | null, parent: TemplateInstance | ChildPart | undefined, options: RenderOptions | undefined);
|
193 | /**
|
194 | * The parent node into which the part renders its content.
|
195 | *
|
196 | * A ChildPart's content consists of a range of adjacent child nodes of
|
197 | * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and
|
198 | * `.endNode`).
|
199 | *
|
200 | * - If both `.startNode` and `.endNode` are non-null, then the part's content
|
201 | * consists of all siblings between `.startNode` and `.endNode`, exclusively.
|
202 | *
|
203 | * - If `.startNode` is non-null but `.endNode` is null, then the part's
|
204 | * content consists of all siblings following `.startNode`, up to and
|
205 | * including the last child of `.parentNode`. If `.endNode` is non-null, then
|
206 | * `.startNode` will always be non-null.
|
207 | *
|
208 | * - If both `.endNode` and `.startNode` are null, then the part's content
|
209 | * consists of all child nodes of `.parentNode`.
|
210 | */
|
211 | get parentNode(): Node;
|
212 | /**
|
213 | * The part's leading marker node, if any. See `.parentNode` for more
|
214 | * information.
|
215 | */
|
216 | get startNode(): Node | null;
|
217 | /**
|
218 | * The part's trailing marker node, if any. See `.parentNode` for more
|
219 | * information.
|
220 | */
|
221 | get endNode(): Node | null;
|
222 | _$setValue(value: unknown, directiveParent?: DirectiveParent): void;
|
223 | private _insert;
|
224 | private _commitNode;
|
225 | private _commitText;
|
226 | private _commitTemplateResult;
|
227 | private _commitIterable;
|
228 | }
|
229 | /**
|
230 | * A top-level `ChildPart` returned from `render` that manages the connected
|
231 | * state of `AsyncDirective`s created throughout the tree below it.
|
232 | */
|
233 | export interface RootPart extends ChildPart {
|
234 | |
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 | setConnected(isConnected: boolean): void;
|
250 | }
|
251 | export type { AttributePart };
|
252 | declare class AttributePart implements Disconnectable {
|
253 | readonly type: 1 | 3 | 4 | 5;
|
254 | readonly element: HTMLElement;
|
255 | readonly name: string;
|
256 | readonly options: RenderOptions | undefined;
|
257 | |
258 |
|
259 |
|
260 |
|
261 |
|
262 | readonly strings?: ReadonlyArray<string>;
|
263 | protected _sanitizer: ValueSanitizer | undefined;
|
264 | get tagName(): string;
|
265 | get _$isConnected(): boolean;
|
266 | constructor(element: HTMLElement, name: string, strings: ReadonlyArray<string>, parent: Disconnectable, options: RenderOptions | undefined);
|
267 | }
|
268 | export type { PropertyPart };
|
269 | declare class PropertyPart extends AttributePart {
|
270 | readonly type = 3;
|
271 | }
|
272 | export type { BooleanAttributePart };
|
273 | declare class BooleanAttributePart extends AttributePart {
|
274 | readonly type = 4;
|
275 | }
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 | export type { EventPart };
|
288 | declare class EventPart extends AttributePart {
|
289 | readonly type = 5;
|
290 | constructor(element: HTMLElement, name: string, strings: ReadonlyArray<string>, parent: Disconnectable, options: RenderOptions | undefined);
|
291 | handleEvent(event: Event): void;
|
292 | }
|
293 | export type { ElementPart };
|
294 | declare class ElementPart implements Disconnectable {
|
295 | element: Element;
|
296 | readonly type = 6;
|
297 | _$committedValue: undefined;
|
298 | options: RenderOptions | undefined;
|
299 | constructor(element: Element, parent: Disconnectable, options: RenderOptions | undefined);
|
300 | get _$isConnected(): boolean;
|
301 | _$setValue(value: unknown): void;
|
302 | }
|
303 | /**
|
304 | * END USERS SHOULD NOT RELY ON THIS OBJECT.
|
305 | *
|
306 | * Private exports for use by other Lit packages, not intended for use by
|
307 | * external users.
|
308 | *
|
309 | * We currently do not make a mangled rollup build of the lit-ssr code. In order
|
310 | * to keep a number of (otherwise private) top-level exports mangled in the
|
311 | * client side code, we export a _$LH object containing those members (or
|
312 | * helper methods for accessing private fields of those members), and then
|
313 | * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the
|
314 | * client-side code is being used in `dev` mode or `prod` mode.
|
315 | *
|
316 | * This has a unique name, to disambiguate it from private exports in
|
317 | * lit-element, which re-exports all of lit-html.
|
318 | *
|
319 | * @private
|
320 | */
|
321 | export declare const _$LH: {
|
322 | _boundAttributeSuffix: string;
|
323 | _marker: string;
|
324 | _markerMatch: string;
|
325 | _HTML_RESULT: number;
|
326 | _getTemplateHtml: (strings: TemplateStringsArray, type: ResultType) => [TrustedHTML, Array<string | undefined>];
|
327 | _TemplateInstance: typeof TemplateInstance;
|
328 | _isIterable: (value: unknown) => value is Iterable<unknown>;
|
329 | _resolveDirective: typeof resolveDirective;
|
330 | _ChildPart: typeof ChildPart;
|
331 | _AttributePart: typeof AttributePart;
|
332 | _BooleanAttributePart: typeof BooleanAttributePart;
|
333 | _EventPart: typeof EventPart;
|
334 | _PropertyPart: typeof PropertyPart;
|
335 | _ElementPart: typeof ElementPart;
|
336 | };
|
337 |
|
\ | No newline at end of file |