@cossackframework/renderer 0.9.0 → 0.9.2
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/README.md +171 -29
- package/agent-docs.json +33 -0
- package/dist/attributes.d.ts +824 -0
- package/dist/attributes.js +1 -0
- package/dist/browser.js +10 -8
- package/dist/component-tags.d.ts +69 -0
- package/dist/component-tags.js +106 -0
- package/dist/cossack-element.d.ts +31 -1
- package/dist/cossack-element.js +20 -25
- package/dist/cossack-html.d.ts +2 -3
- package/dist/cossack-html.js +742 -531
- package/dist/css-result.d.ts +9 -0
- package/dist/css-result.js +14 -0
- package/dist/css-scoping.d.ts +4 -0
- package/dist/css-scoping.js +95 -0
- package/dist/css.d.ts +3 -16
- package/dist/css.js +13 -111
- package/dist/diagnostics.d.ts +85 -0
- package/dist/diagnostics.js +465 -0
- package/dist/directives.d.ts +9 -7
- package/dist/directives.js +7 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -7
- package/dist/minify-html.d.ts +22 -0
- package/dist/minify-html.js +123 -18
- package/dist/server.d.ts +3 -1
- package/dist/server.js +6 -4
- package/dist/ssr-form-values.js +4 -3
- package/dist/style-registry.d.ts +42 -0
- package/dist/style-registry.js +73 -0
- package/dist/style-runtime.d.ts +47 -0
- package/dist/style-runtime.js +43 -0
- package/dist/template-analysis.d.ts +224 -0
- package/dist/template-analysis.js +321 -0
- package/dist/template-parse.d.ts +157 -0
- package/dist/template-parse.js +546 -0
- package/dist/template.d.ts +2 -0
- package/dist/template.js +3 -0
- package/package.json +18 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A safely constructed block of component CSS. */
|
|
2
|
+
export declare class CSSResult {
|
|
3
|
+
readonly cssText: string;
|
|
4
|
+
/** @internal Use css`` or unsafeCSS() instead. */
|
|
5
|
+
constructor(cssText: string, token: symbol);
|
|
6
|
+
toString(): string;
|
|
7
|
+
}
|
|
8
|
+
export type CSSResultGroup = CSSResult | readonly CSSResultGroup[];
|
|
9
|
+
export declare const createCSSResult: (text: string) => CSSResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @ts-self-types="./css-result.d.ts"
|
|
2
|
+
//#region src/css-result.ts
|
|
3
|
+
var e = Symbol("cossack-css-result"), t = class {
|
|
4
|
+
cssText;
|
|
5
|
+
constructor(t, n) {
|
|
6
|
+
if (n !== e) throw Error("[cossack/renderer] CSSResult cannot be constructed directly. Use css`` or unsafeCSS().");
|
|
7
|
+
this.cssText = t;
|
|
8
|
+
}
|
|
9
|
+
toString() {
|
|
10
|
+
return this.cssText;
|
|
11
|
+
}
|
|
12
|
+
}, n = (n) => new t(n, e);
|
|
13
|
+
//#endregion
|
|
14
|
+
export { t as CSSResult, n as createCSSResult };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type CSSResultGroup } from './css-result.js';
|
|
2
|
+
import type { FinalizedStyles } from './style-runtime.js';
|
|
3
|
+
/** @internal Parse and scope component styles after a CSS factory is used. */
|
|
4
|
+
export declare const finalizeStyles: (declared: CSSResultGroup) => FinalizedStyles;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// @ts-self-types="./css-scoping.d.ts"
|
|
2
|
+
import { CSSResult as e } from "./css-result.js";
|
|
3
|
+
import t from "css-tree/parser";
|
|
4
|
+
import n from "css-tree/generator";
|
|
5
|
+
import r from "css-tree/walker";
|
|
6
|
+
//#region src/css-scoping.ts
|
|
7
|
+
var i = (t, n) => {
|
|
8
|
+
if (Array.isArray(t)) {
|
|
9
|
+
for (let e of t) i(e, n);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (t instanceof e) {
|
|
13
|
+
n.push(t);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
throw TypeError("[cossack/renderer] static styles must contain only CSSResult values returned by css`` or unsafeCSS().");
|
|
17
|
+
}, a = (e) => {
|
|
18
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
19
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
20
|
+
let i = e[r];
|
|
21
|
+
t.has(i) || (t.add(i), n.push(i));
|
|
22
|
+
}
|
|
23
|
+
return n.reverse(), n;
|
|
24
|
+
}, o = (e) => {
|
|
25
|
+
let t = 2166136261, n = new TextEncoder().encode(e);
|
|
26
|
+
for (let e of n) t ^= e, t = Math.imul(t, 16777619) >>> 0;
|
|
27
|
+
return t.toString(36);
|
|
28
|
+
}, s = (e) => t(`[data-cossack-scope="${e}"]`, { context: "selector" }).children.first, c = (e) => {
|
|
29
|
+
if (e?.type === "AttributeSelector") return typeof e.name == "string" ? e.name : e.name?.name;
|
|
30
|
+
}, l = (e, t) => {
|
|
31
|
+
let n = e.children;
|
|
32
|
+
if (!n) return;
|
|
33
|
+
n.forEach((e) => {
|
|
34
|
+
if (e.type === "PseudoClassSelector") {
|
|
35
|
+
let n = String(e.name).toLowerCase();
|
|
36
|
+
if (n === "host" || n === "host-context") throw Error(`[cossack/renderer] Shadow DOM selector :${n} is not supported by Light DOM scoped styles.`);
|
|
37
|
+
e.children && e.children.forEach((e) => {
|
|
38
|
+
e.type === "SelectorList" && e.children.forEach((e) => l(e, t));
|
|
39
|
+
});
|
|
40
|
+
} else if (e.type === "PseudoElementSelector" && String(e.name).toLowerCase() === "slotted") throw Error("[cossack/renderer] Shadow DOM selector ::slotted is not supported by Light DOM scoped styles.");
|
|
41
|
+
});
|
|
42
|
+
let r = n.head, i = n.head;
|
|
43
|
+
for (; i;) {
|
|
44
|
+
let e = i.next;
|
|
45
|
+
i.data.type === "Combinator" && (u(n, r, i, t), r = e), i = e;
|
|
46
|
+
}
|
|
47
|
+
u(n, r, null, t);
|
|
48
|
+
}, u = (e, t, n, r) => {
|
|
49
|
+
if (!t || t === n) return;
|
|
50
|
+
let i = t, a = n, o = !1;
|
|
51
|
+
for (; i && i !== n;) c(i.data) === "data-cossack-scope" && (o = !0), (i.data.type === "PseudoClassSelector" || i.data.type === "PseudoElementSelector") && a === n && (a = i), i = i.next;
|
|
52
|
+
o || e.insertData(s(r), a);
|
|
53
|
+
}, d = (e, t) => {
|
|
54
|
+
let i = /* @__PURE__ */ new Map();
|
|
55
|
+
return r(e, {
|
|
56
|
+
visit: "Atrule",
|
|
57
|
+
enter(e) {
|
|
58
|
+
let n = String(e.name).toLowerCase();
|
|
59
|
+
if (n !== "keyframes" && n !== "-webkit-keyframes") return;
|
|
60
|
+
let r = e.prelude?.children?.first, a = r?.name ?? r?.value;
|
|
61
|
+
if (typeof a != "string") return;
|
|
62
|
+
let o = `${t}-${a}`;
|
|
63
|
+
i.set(a, o), "name" in r ? r.name = o : r.value = o;
|
|
64
|
+
}
|
|
65
|
+
}), r(e, {
|
|
66
|
+
visit: "Rule",
|
|
67
|
+
enter(e) {
|
|
68
|
+
let n = String(this.atrule?.name ?? "").toLowerCase();
|
|
69
|
+
n === "keyframes" || n === "-webkit-keyframes" || e.prelude?.type === "SelectorList" && e.prelude.children.forEach((e) => l(e, t));
|
|
70
|
+
}
|
|
71
|
+
}), i.size > 0 && r(e, {
|
|
72
|
+
visit: "Declaration",
|
|
73
|
+
enter(e) {
|
|
74
|
+
let t = String(e.property).toLowerCase();
|
|
75
|
+
t !== "animation" && t !== "animation-name" && t !== "-webkit-animation" && t !== "-webkit-animation-name" || r(e.value, (e) => {
|
|
76
|
+
if (e.type !== "Identifier" && e.type !== "String") return;
|
|
77
|
+
let t = e.name ?? e.value, n = i.get(t);
|
|
78
|
+
n && ("name" in e ? e.name = n : e.value = n);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}), n(e);
|
|
82
|
+
}, f = (e) => {
|
|
83
|
+
let r = [];
|
|
84
|
+
i(e, r);
|
|
85
|
+
let s = t(a(r).map((e) => e.cssText).join("\n"), {
|
|
86
|
+
context: "stylesheet",
|
|
87
|
+
parseCustomProperty: !0
|
|
88
|
+
}), c = `c${o(n(s))}`;
|
|
89
|
+
return {
|
|
90
|
+
cssText: d(s, c),
|
|
91
|
+
scopeId: c
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { f as finalizeStyles };
|
package/dist/css.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
/** @internal Use css`` or unsafeCSS() instead. */
|
|
5
|
-
constructor(cssText: string, token: symbol);
|
|
6
|
-
toString(): string;
|
|
7
|
-
}
|
|
8
|
-
export type CSSResultGroup = CSSResult | readonly CSSResultGroup[];
|
|
1
|
+
import { CSSResult } from './css-result.js';
|
|
2
|
+
export { CSSResult } from './css-result.js';
|
|
3
|
+
export type { CSSResultGroup } from './css-result.js';
|
|
9
4
|
/**
|
|
10
5
|
* Construct component CSS. Interpolations are intentionally restricted to
|
|
11
6
|
* numbers and other CSSResult values; use unsafeCSS() for reviewed raw text.
|
|
@@ -13,11 +8,3 @@ export type CSSResultGroup = CSSResult | readonly CSSResultGroup[];
|
|
|
13
8
|
export declare const css: (strings: TemplateStringsArray, ...values: unknown[]) => CSSResult;
|
|
14
9
|
/** Mark a reviewed raw value as trusted CSS for interpolation into css``. */
|
|
15
10
|
export declare const unsafeCSS: (value: unknown) => CSSResult;
|
|
16
|
-
export interface FinalizedStyles {
|
|
17
|
-
readonly cssText: string;
|
|
18
|
-
readonly scopeId: string;
|
|
19
|
-
}
|
|
20
|
-
/** @internal Finalize and cache a component class's Light DOM styles. */
|
|
21
|
-
export declare const getFinalizedStyles: (componentClass: Function & {
|
|
22
|
-
styles?: CSSResultGroup;
|
|
23
|
-
}) => FinalizedStyles | null;
|
package/dist/css.js
CHANGED
|
@@ -1,116 +1,18 @@
|
|
|
1
1
|
// @ts-self-types="./css.d.ts"
|
|
2
|
-
import e from "
|
|
3
|
-
import t from "css-
|
|
4
|
-
import
|
|
2
|
+
import { registerStyleFinalizer as e } from "./style-runtime.js";
|
|
3
|
+
import { CSSResult as t, createCSSResult as n } from "./css-result.js";
|
|
4
|
+
import { finalizeStyles as r } from "./css-scoping.js";
|
|
5
5
|
//#region src/css.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
toString() {
|
|
13
|
-
return this.cssText;
|
|
14
|
-
}
|
|
15
|
-
}, a = (e) => new i(e, r), o = (e, ...t) => {
|
|
16
|
-
let n = e[0];
|
|
17
|
-
for (let r = 0; r < t.length; r++) {
|
|
18
|
-
let a = t[r];
|
|
19
|
-
if (typeof a == "number") n += String(a);
|
|
20
|
-
else if (a instanceof i) n += a.cssText;
|
|
6
|
+
var i = (t) => (e(r), n(t)), a = (e, ...n) => {
|
|
7
|
+
let r = e[0];
|
|
8
|
+
for (let i = 0; i < n.length; i++) {
|
|
9
|
+
let a = n[i];
|
|
10
|
+
if (typeof a == "number") r += String(a);
|
|
11
|
+
else if (a instanceof t) r += a.cssText;
|
|
21
12
|
else throw Error("[cossack/renderer] css`` interpolations must be numbers or CSSResult values. Use unsafeCSS() only for explicitly trusted raw CSS.");
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
return a(n);
|
|
25
|
-
}, s = (e) => a(String(e)), c = /* @__PURE__ */ new WeakMap(), l = (e, t) => {
|
|
26
|
-
if (Array.isArray(e)) {
|
|
27
|
-
for (let n of e) l(n, t);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (e instanceof i) {
|
|
31
|
-
t.push(e);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
throw TypeError("[cossack/renderer] static styles must contain only CSSResult values returned by css`` or unsafeCSS().");
|
|
35
|
-
}, u = (e) => {
|
|
36
|
-
let t = /* @__PURE__ */ new Set(), n = [];
|
|
37
|
-
for (let r = e.length - 1; r >= 0; r--) {
|
|
38
|
-
let i = e[r];
|
|
39
|
-
t.has(i) || (t.add(i), n.push(i));
|
|
40
|
-
}
|
|
41
|
-
return n.reverse(), n;
|
|
42
|
-
}, d = (e) => {
|
|
43
|
-
let t = 2166136261, n = new TextEncoder().encode(e);
|
|
44
|
-
for (let e of n) t ^= e, t = Math.imul(t, 16777619) >>> 0;
|
|
45
|
-
return t.toString(36);
|
|
46
|
-
}, f = (t) => e(`[data-cossack-scope="${t}"]`, { context: "selector" }).children.first, p = (e) => {
|
|
47
|
-
if (e?.type === "AttributeSelector") return typeof e.name == "string" ? e.name : e.name?.name;
|
|
48
|
-
}, m = (e, t) => {
|
|
49
|
-
let n = e.children;
|
|
50
|
-
if (!n) return;
|
|
51
|
-
n.forEach((e) => {
|
|
52
|
-
if (e.type === "PseudoClassSelector") {
|
|
53
|
-
let n = String(e.name).toLowerCase();
|
|
54
|
-
if (n === "host" || n === "host-context") throw Error(`[cossack/renderer] Shadow DOM selector :${n} is not supported by Light DOM scoped styles.`);
|
|
55
|
-
e.children && e.children.forEach((e) => {
|
|
56
|
-
e.type === "SelectorList" && e.children.forEach((e) => m(e, t));
|
|
57
|
-
});
|
|
58
|
-
} else if (e.type === "PseudoElementSelector" && String(e.name).toLowerCase() === "slotted") throw Error("[cossack/renderer] Shadow DOM selector ::slotted is not supported by Light DOM scoped styles.");
|
|
59
|
-
});
|
|
60
|
-
let r = n.head, i = n.head;
|
|
61
|
-
for (; i;) {
|
|
62
|
-
let e = i.next;
|
|
63
|
-
i.data.type === "Combinator" && (h(n, r, i, t), r = e), i = e;
|
|
13
|
+
r += e[i + 1];
|
|
64
14
|
}
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
if (!t || t === n) return;
|
|
68
|
-
let i = t, a = n, o = !1;
|
|
69
|
-
for (; i && i !== n;) p(i.data) === "data-cossack-scope" && (o = !0), (i.data.type === "PseudoClassSelector" || i.data.type === "PseudoElementSelector") && a === n && (a = i), i = i.next;
|
|
70
|
-
o || e.insertData(f(r), a);
|
|
71
|
-
}, g = (e, r) => {
|
|
72
|
-
let i = /* @__PURE__ */ new Map();
|
|
73
|
-
return n(e, {
|
|
74
|
-
visit: "Atrule",
|
|
75
|
-
enter(e) {
|
|
76
|
-
let t = String(e.name).toLowerCase();
|
|
77
|
-
if (t !== "keyframes" && t !== "-webkit-keyframes") return;
|
|
78
|
-
let n = e.prelude?.children?.first, a = n?.name ?? n?.value;
|
|
79
|
-
if (typeof a != "string") return;
|
|
80
|
-
let o = `${r}-${a}`;
|
|
81
|
-
i.set(a, o), "name" in n ? n.name = o : n.value = o;
|
|
82
|
-
}
|
|
83
|
-
}), n(e, {
|
|
84
|
-
visit: "Rule",
|
|
85
|
-
enter(e) {
|
|
86
|
-
let t = String(this.atrule?.name ?? "").toLowerCase();
|
|
87
|
-
t === "keyframes" || t === "-webkit-keyframes" || e.prelude?.type === "SelectorList" && e.prelude.children.forEach((e) => m(e, r));
|
|
88
|
-
}
|
|
89
|
-
}), i.size > 0 && n(e, {
|
|
90
|
-
visit: "Declaration",
|
|
91
|
-
enter(e) {
|
|
92
|
-
let t = String(e.property).toLowerCase();
|
|
93
|
-
t !== "animation" && t !== "animation-name" && t !== "-webkit-animation" && t !== "-webkit-animation-name" || n(e.value, (e) => {
|
|
94
|
-
if (e.type !== "Identifier" && e.type !== "String") return;
|
|
95
|
-
let t = e.name ?? e.value, n = i.get(t);
|
|
96
|
-
n && ("name" in e ? e.name = n : e.value = n);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}), t(e);
|
|
100
|
-
}, _ = (n) => {
|
|
101
|
-
if (c.has(n)) return c.get(n);
|
|
102
|
-
let r = n.styles;
|
|
103
|
-
if (r === void 0) return c.set(n, null), null;
|
|
104
|
-
let i = [];
|
|
105
|
-
l(r, i);
|
|
106
|
-
let a = e(u(i).map((e) => e.cssText).join("\n"), {
|
|
107
|
-
context: "stylesheet",
|
|
108
|
-
parseCustomProperty: !0
|
|
109
|
-
}), o = `c${d(t(a))}`, s = {
|
|
110
|
-
cssText: g(a, o),
|
|
111
|
-
scopeId: o
|
|
112
|
-
};
|
|
113
|
-
return c.set(n, s), s;
|
|
114
|
-
};
|
|
15
|
+
return i(r);
|
|
16
|
+
}, o = (e) => i(String(e));
|
|
115
17
|
//#endregion
|
|
116
|
-
export {
|
|
18
|
+
export { t as CSSResult, a as css, o as unsafeCSS };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template diagnostics for `html` and `svg` templates.
|
|
3
|
+
*
|
|
4
|
+
* One analysis serves the Vite plugin, `cossack check templates` and the
|
|
5
|
+
* TypeScript language service plugin. Structural rules come from the
|
|
6
|
+
* renderer's own template parser and need no types: malformed markup,
|
|
7
|
+
* bindings that render nothing, unknown binding prefixes, component tags
|
|
8
|
+
* that do not close, and template literals with markup but no `html` tag.
|
|
9
|
+
* Type rules read the project's TypeScript program: attribute names and
|
|
10
|
+
* values against the native attribute map (`TemplateTypeMap`), `@event`
|
|
11
|
+
* handlers, `?attr` booleans, `.prop` properties, and component tag
|
|
12
|
+
* attributes against the component's `props`.
|
|
13
|
+
*
|
|
14
|
+
* The caller passes the TypeScript compiler API module that created the
|
|
15
|
+
* program, so this module never loads a compiler of its own.
|
|
16
|
+
*/
|
|
17
|
+
import type * as TS from 'typescript-api';
|
|
18
|
+
import { type ParsedTemplate, type TemplateLocation } from './template-parse.js';
|
|
19
|
+
export { parseTemplate, templateContextAt } from './template-parse.js';
|
|
20
|
+
export type { TemplateContext, TemplateContextTag, ParsedTemplate, TemplateAttribute, TemplateBindingNode, TemplateBindingRole, TemplateComment, TemplateComponent, TemplateElement, TemplateLocation, TemplateNamespace, TemplateNode, TemplateProblem, TemplateRange, TemplateText, } from './template-parse.js';
|
|
21
|
+
type TypeScript = typeof TS;
|
|
22
|
+
export type TemplateDiagnosticSeverity = 'error' | 'warning' | 'hint';
|
|
23
|
+
export interface TemplateDiagnostic {
|
|
24
|
+
readonly code: string;
|
|
25
|
+
readonly severity: TemplateDiagnosticSeverity;
|
|
26
|
+
readonly message: string;
|
|
27
|
+
/** The file name as the program knows it. */
|
|
28
|
+
readonly file: string;
|
|
29
|
+
/** Offset of the first character in the file. */
|
|
30
|
+
readonly start: number;
|
|
31
|
+
readonly length: number;
|
|
32
|
+
/** 1-based. */
|
|
33
|
+
readonly line: number;
|
|
34
|
+
/** 1-based. */
|
|
35
|
+
readonly column: number;
|
|
36
|
+
}
|
|
37
|
+
/** One `html` or `svg` tagged template in a source file. */
|
|
38
|
+
export interface TemplateSource {
|
|
39
|
+
readonly node: TS.TaggedTemplateExpression;
|
|
40
|
+
readonly kind: 'html' | 'svg';
|
|
41
|
+
/** The cooked strings, as the tag function receives them. */
|
|
42
|
+
readonly strings: readonly string[];
|
|
43
|
+
readonly expressions: readonly TS.Expression[];
|
|
44
|
+
readonly parsed: ParsedTemplate;
|
|
45
|
+
/** The file that declares the tag function, when a type checker resolved it. */
|
|
46
|
+
readonly declarationFile?: TS.SourceFile;
|
|
47
|
+
/** The file offset of a location in the template's strings. */
|
|
48
|
+
position(location: TemplateLocation): number;
|
|
49
|
+
/** The location of a file offset in the template's strings; undefined inside a binding or outside the template. */
|
|
50
|
+
locationAt(position: number): TemplateLocation | undefined;
|
|
51
|
+
}
|
|
52
|
+
export interface TemplateCheckOptions {
|
|
53
|
+
/** Set to false for structural rules only. */
|
|
54
|
+
readonly types?: boolean;
|
|
55
|
+
/** Report hints, such as component() calls that could be component tags. Default true. */
|
|
56
|
+
readonly hints?: boolean;
|
|
57
|
+
/** Decides whether a declaration file belongs to the renderer. */
|
|
58
|
+
readonly isRendererFile?: (fileName: string) => boolean;
|
|
59
|
+
}
|
|
60
|
+
/** Every `html` and `svg` tagged template in a file, outermost first. */
|
|
61
|
+
export declare const findTemplates: (ts: TypeScript, sourceFile: TS.SourceFile, checker?: TS.TypeChecker, options?: TemplateCheckOptions) => TemplateSource[];
|
|
62
|
+
/** Check the templates of one source file. `ts` is the module that created `program`. */
|
|
63
|
+
export declare const checkTemplates: (ts: TypeScript, program: TS.Program, sourceFile: TS.SourceFile, options?: TemplateCheckOptions) => TemplateDiagnostic[];
|
|
64
|
+
export type TemplateCompletionKind = 'element' | 'end-tag' | 'attribute' | 'event' | 'property' | 'boolean' | 'prop' | 'value';
|
|
65
|
+
export interface TemplateCompletion {
|
|
66
|
+
readonly name: string;
|
|
67
|
+
readonly kind: TemplateCompletionKind;
|
|
68
|
+
/** The value type, for attributes, properties and props. */
|
|
69
|
+
readonly type?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface TemplateCompletions {
|
|
72
|
+
readonly entries: readonly TemplateCompletion[];
|
|
73
|
+
/** The text the chosen entry replaces: what was typed of the name or value. */
|
|
74
|
+
readonly replace: {
|
|
75
|
+
readonly start: number;
|
|
76
|
+
readonly length: number;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Completions at a file position inside an `html` or `svg` template: tag
|
|
81
|
+
* names, end tags, attributes, `@events`, `.properties`, `?booleans`,
|
|
82
|
+
* component props and enumerated values. Undefined outside a template or
|
|
83
|
+
* inside a binding, where TypeScript's own completions apply.
|
|
84
|
+
*/
|
|
85
|
+
export declare const completeTemplate: (ts: TypeScript, program: TS.Program, sourceFile: TS.SourceFile, position: number, options?: TemplateCheckOptions) => TemplateCompletions | undefined;
|