|
|
@ -56,7 +56,6 @@ export default function element(parser) {
|
|
|
|
const data = parser.read_until(regex_closing_comment);
|
|
|
|
const data = parser.read_until(regex_closing_comment);
|
|
|
|
parser.eat('-->', true);
|
|
|
|
parser.eat('-->', true);
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {ReturnType<typeof parser.append<AST.Comment>>} */
|
|
|
|
|
|
|
|
parser.append({
|
|
|
|
parser.append({
|
|
|
|
type: 'Comment',
|
|
|
|
type: 'Comment',
|
|
|
|
start,
|
|
|
|
start,
|
|
|
@ -153,8 +152,7 @@ export default function element(parser) {
|
|
|
|
scoped: false,
|
|
|
|
scoped: false,
|
|
|
|
has_spread: false,
|
|
|
|
has_spread: false,
|
|
|
|
path: []
|
|
|
|
path: []
|
|
|
|
},
|
|
|
|
}
|
|
|
|
parent: null
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
: /** @type {ElementLike} */ ({
|
|
|
|
: /** @type {ElementLike} */ ({
|
|
|
|
type,
|
|
|
|
type,
|
|
|
@ -163,7 +161,6 @@ export default function element(parser) {
|
|
|
|
name,
|
|
|
|
name,
|
|
|
|
attributes: [],
|
|
|
|
attributes: [],
|
|
|
|
fragment: create_fragment(true),
|
|
|
|
fragment: create_fragment(true),
|
|
|
|
parent: null,
|
|
|
|
|
|
|
|
metadata: {
|
|
|
|
metadata: {
|
|
|
|
// unpopulated at first, differs between types
|
|
|
|
// unpopulated at first, differs between types
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -348,8 +345,7 @@ export default function element(parser) {
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
type: 'Text',
|
|
|
|
type: 'Text',
|
|
|
|
data,
|
|
|
|
data,
|
|
|
|
raw: data,
|
|
|
|
raw: data
|
|
|
|
parent: null
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
element.fragment.nodes.push(node);
|
|
|
|
element.fragment.nodes.push(node);
|
|
|
@ -422,8 +418,7 @@ function read_static_attribute(parser) {
|
|
|
|
end: quoted ? parser.index - 1 : parser.index,
|
|
|
|
end: quoted ? parser.index - 1 : parser.index,
|
|
|
|
type: 'Text',
|
|
|
|
type: 'Text',
|
|
|
|
raw: raw,
|
|
|
|
raw: raw,
|
|
|
|
data: decode_character_references(raw, true),
|
|
|
|
data: decode_character_references(raw, true)
|
|
|
|
parent: null
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -457,7 +452,6 @@ function read_attribute(parser) {
|
|
|
|
start,
|
|
|
|
start,
|
|
|
|
end: parser.index,
|
|
|
|
end: parser.index,
|
|
|
|
expression,
|
|
|
|
expression,
|
|
|
|
parent: null,
|
|
|
|
|
|
|
|
metadata: {
|
|
|
|
metadata: {
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -486,7 +480,6 @@ function read_attribute(parser) {
|
|
|
|
type: 'Identifier',
|
|
|
|
type: 'Identifier',
|
|
|
|
name
|
|
|
|
name
|
|
|
|
},
|
|
|
|
},
|
|
|
|
parent: null,
|
|
|
|
|
|
|
|
metadata: {
|
|
|
|
metadata: {
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -531,7 +524,6 @@ function read_attribute(parser) {
|
|
|
|
name: directive_name,
|
|
|
|
name: directive_name,
|
|
|
|
modifiers: /** @type {Array<'important'>} */ (modifiers),
|
|
|
|
modifiers: /** @type {Array<'important'>} */ (modifiers),
|
|
|
|
value,
|
|
|
|
value,
|
|
|
|
parent: null,
|
|
|
|
|
|
|
|
metadata: {
|
|
|
|
metadata: {
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -556,19 +548,20 @@ function read_attribute(parser) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {Directive} */
|
|
|
|
/** @type {Directive} */
|
|
|
|
// @ts-expect-error TODO can't figure out this error
|
|
|
|
|
|
|
|
const directive = {
|
|
|
|
const directive = {
|
|
|
|
start,
|
|
|
|
start,
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
type,
|
|
|
|
type,
|
|
|
|
name: directive_name,
|
|
|
|
name: directive_name,
|
|
|
|
modifiers,
|
|
|
|
|
|
|
|
expression,
|
|
|
|
expression,
|
|
|
|
metadata: {
|
|
|
|
metadata: {
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @ts-expect-error we do this separately from the declaration to avoid upsetting typescript
|
|
|
|
|
|
|
|
directive.modifiers = modifiers;
|
|
|
|
|
|
|
|
|
|
|
|
if (directive.type === 'TransitionDirective') {
|
|
|
|
if (directive.type === 'TransitionDirective') {
|
|
|
|
const direction = name.slice(0, colon_index);
|
|
|
|
const direction = name.slice(0, colon_index);
|
|
|
|
directive.intro = direction === 'in' || direction === 'transition';
|
|
|
|
directive.intro = direction === 'in' || direction === 'transition';
|
|
|
@ -623,8 +616,7 @@ function read_attribute_value(parser) {
|
|
|
|
end: parser.index - 1,
|
|
|
|
end: parser.index - 1,
|
|
|
|
type: 'Text',
|
|
|
|
type: 'Text',
|
|
|
|
raw: '',
|
|
|
|
raw: '',
|
|
|
|
data: '',
|
|
|
|
data: ''
|
|
|
|
parent: null
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -681,8 +673,7 @@ function read_sequence(parser, done, location) {
|
|
|
|
end: -1,
|
|
|
|
end: -1,
|
|
|
|
type: 'Text',
|
|
|
|
type: 'Text',
|
|
|
|
raw: '',
|
|
|
|
raw: '',
|
|
|
|
data: '',
|
|
|
|
data: ''
|
|
|
|
parent: null
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {Array<AST.Text | AST.ExpressionTag>} */
|
|
|
|
/** @type {Array<AST.Text | AST.ExpressionTag>} */
|
|
|
@ -729,7 +720,6 @@ function read_sequence(parser, done, location) {
|
|
|
|
start: index,
|
|
|
|
start: index,
|
|
|
|
end: parser.index,
|
|
|
|
end: parser.index,
|
|
|
|
expression,
|
|
|
|
expression,
|
|
|
|
parent: null,
|
|
|
|
|
|
|
|
metadata: {
|
|
|
|
metadata: {
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -742,8 +732,7 @@ function read_sequence(parser, done, location) {
|
|
|
|
end: -1,
|
|
|
|
end: -1,
|
|
|
|
type: 'Text',
|
|
|
|
type: 'Text',
|
|
|
|
raw: '',
|
|
|
|
raw: '',
|
|
|
|
data: '',
|
|
|
|
data: ''
|
|
|
|
parent: null
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
current_chunk.raw += parser.template[parser.index++];
|
|
|
|
current_chunk.raw += parser.template[parser.index++];
|
|
|
|