@lwc/template-compiler 8.18.1 → 8.19.0

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 CHANGED
@@ -60,6 +60,7 @@ const { code, warnings } = compile(`<template><h1>Hello World!</h1></template>`,
60
60
  - `preserveHtmlComments` (boolean, optional, `false` by default) - set to `true` to disable the default behavior of stripping HTML comments.
61
61
  - `enableStaticContentOptimization` (boolean, optional, `true` by default) - set to `false` to disable static content optimizations.
62
62
  - `enableLwcSpread` (boolean, optional, `true` by default) - Deprecated. Ignored by template-compiler. `lwc:spread` is always enabled.
63
+ - `enableLwcOn` (boolean, optional, `false` by default) - set to `true` to enable `lwc:on` directive in the template.
63
64
  - `customRendererConfig` (CustomRendererConfig, optional) - specifies a configuration to use to match elements. Matched elements will get a custom renderer hook in the generated template.
64
65
  - `instrumentation` (InstrumentationObject, optional) - instrumentation object to gather metrics and non-error logs for internal use. See the `@lwc/errors` package for details on the interface.
65
66
  - `disableSyntheticShadowSupport` (type: `boolean`, default: `false`) - Set to true if synthetic shadow DOM support is not needed, which can result in smaller/faster output.
@@ -1,7 +1,7 @@
1
1
  import * as t from '../shared/estree';
2
2
  import { LWCDirectiveRenderMode } from '../shared/types';
3
3
  import type State from '../state';
4
- import type { ChildNode, Expression, ComplexExpression, Literal, Root, EventListener, RefDirective, Text, StaticElement, Attribute, KeyDirective } from '../shared/types';
4
+ import type { ChildNode, Expression, ComplexExpression, Literal, Root, EventListener, RefDirective, Text, StaticElement, Attribute, KeyDirective, OnDirective } from '../shared/types';
5
5
  import type { APIVersion } from '@lwc/shared';
6
6
  export default class CodeGen {
7
7
  /** The AST root. */
@@ -93,6 +93,7 @@ export default class CodeGen {
93
93
  getMemoizationId(): import("estree").Identifier;
94
94
  genBooleanAttributeExpr(bindExpr: t.Expression): import("estree").ConditionalExpression;
95
95
  genEventListeners(listeners: EventListener[]): import("estree").Property;
96
+ genDynamicEventListeners(onDirective: OnDirective): import("estree").Property[];
96
97
  genRef(ref: RefDirective): import("estree").Property;
97
98
  genKeyExpression(ref: KeyDirective | undefined, slotParentName: string | undefined): import("estree").SimpleLiteral | import("estree").CallExpression;
98
99
  /**
package/dist/config.d.ts CHANGED
@@ -56,6 +56,10 @@ export interface Config {
56
56
  * @deprecated Spread operator is now always enabled.
57
57
  */
58
58
  enableLwcSpread?: boolean;
59
+ /**
60
+ * When true, enables `lwc:on` directive.
61
+ */
62
+ enableLwcOn?: boolean;
59
63
  /**
60
64
  * Config to use to collect metrics and logs
61
65
  */
package/dist/index.cjs.js CHANGED
@@ -207,6 +207,7 @@ const AVAILABLE_OPTION_NAMES = new Set([
207
207
  'apiVersion',
208
208
  'customRendererConfig',
209
209
  'enableLwcSpread',
210
+ 'enableLwcOn',
210
211
  'enableStaticContentOptimization',
211
212
  // TODO [#3370]: remove experimental template expression flag
212
213
  'experimentalComplexExpressions',
@@ -269,6 +270,7 @@ function normalizeConfig(config) {
269
270
  enableDynamicComponents: false,
270
271
  enableStaticContentOptimization: true,
271
272
  enableLwcSpread: true,
273
+ enableLwcOn: false,
272
274
  disableSyntheticShadowSupport: false,
273
275
  ...config,
274
276
  apiVersion, // overrides the config apiVersion
@@ -9110,6 +9112,14 @@ function spreadDirective(value, location) {
9110
9112
  location,
9111
9113
  };
9112
9114
  }
9115
+ function OnDirective(value, location) {
9116
+ return {
9117
+ type: 'Directive',
9118
+ name: 'On',
9119
+ value,
9120
+ location,
9121
+ };
9122
+ }
9113
9123
  function slotBindDirective(value, location) {
9114
9124
  return {
9115
9125
  type: 'Directive',
@@ -9273,6 +9283,9 @@ function isDomDirective(directive) {
9273
9283
  function isSpreadDirective(directive) {
9274
9284
  return directive.name === 'Spread';
9275
9285
  }
9286
+ function isOnDirective(directive) {
9287
+ return directive.name === 'On';
9288
+ }
9276
9289
  function isInnerHTMLDirective(directive) {
9277
9290
  return directive.name === 'InnerHTML';
9278
9291
  }
@@ -9339,6 +9352,7 @@ exports.ElementDirectiveName = void 0;
9339
9352
  ElementDirectiveName["SlotBind"] = "lwc:slot-bind";
9340
9353
  ElementDirectiveName["SlotData"] = "lwc:slot-data";
9341
9354
  ElementDirectiveName["Spread"] = "lwc:spread";
9355
+ ElementDirectiveName["On"] = "lwc:on";
9342
9356
  ElementDirectiveName["Key"] = "key";
9343
9357
  })(exports.ElementDirectiveName || (exports.ElementDirectiveName = {}));
9344
9358
  exports.RootDirectiveName = void 0;
@@ -10884,6 +10898,7 @@ const HTML_ELEMENT_ATTRIBUTE_MAP = {
10884
10898
  'itemtype',
10885
10899
  'lang',
10886
10900
  'nonce',
10901
+ 'popover',
10887
10902
  'slot',
10888
10903
  'spellcheck',
10889
10904
  'style',
@@ -10948,6 +10963,8 @@ const HTML_ELEMENT_ATTRIBUTE_MAP = {
10948
10963
  'formnovalidate',
10949
10964
  'formtarget',
10950
10965
  'name',
10966
+ 'popovertarget',
10967
+ 'popovertargetaction',
10951
10968
  'type',
10952
10969
  'value',
10953
10970
  ],
@@ -11970,6 +11987,7 @@ const LWC_DIRECTIVE_PROCESSORS = [
11970
11987
  applyLwcInnerHtmlDirective,
11971
11988
  applyRefDirective,
11972
11989
  applyLwcSpreadDirective,
11990
+ applyLwcOnDirective,
11973
11991
  applyLwcSlotBindDirective,
11974
11992
  ];
11975
11993
  function applyLwcDirectives(ctx, parsedAttr, element) {
@@ -12032,6 +12050,28 @@ function applyLwcSpreadDirective(ctx, parsedAttr, element) {
12032
12050
  }
12033
12051
  element.directives.push(spreadDirective(lwcSpreadAttr, lwcSpread.location));
12034
12052
  }
12053
+ function applyLwcOnDirective(ctx, parsedAttr, element) {
12054
+ const { name: tag } = element;
12055
+ const lwcOn = parsedAttr.pick(exports.ElementDirectiveName.On);
12056
+ if (!lwcOn) {
12057
+ return;
12058
+ }
12059
+ if (!ctx.config.enableLwcOn) {
12060
+ ctx.throwOnNode(errors.ParserDiagnostics.INVALID_LWC_ON_OPTS, element);
12061
+ }
12062
+ const { value: lwcOnValue } = lwcOn;
12063
+ if (!isExpression$1(lwcOnValue)) {
12064
+ ctx.throwOnNode(errors.ParserDiagnostics.INVALID_LWC_ON_LITERAL_PROP, element, [`<${tag}>`]);
12065
+ }
12066
+ // At this point element.listeners stores declarative event listeners (e.g., `onfoo`)
12067
+ // `lwc:on` directive cannot be used together with declarative event listeners.
12068
+ if (element.listeners.length) {
12069
+ ctx.throwOnNode(errors.ParserDiagnostics.INVALID_LWC_ON_WITH_DECLARATIVE_LISTENERS, element, [
12070
+ `<${tag}>`,
12071
+ ]);
12072
+ }
12073
+ element.directives.push(OnDirective(lwcOnValue, lwcOn.location));
12074
+ }
12035
12075
  function applyLwcExternalDirective(ctx, parsedAttr, element) {
12036
12076
  const lwcExternalAttribute = parsedAttr.pick(exports.ElementDirectiveName.External);
12037
12077
  if (!lwcExternalAttribute) {
@@ -12492,6 +12532,12 @@ function validateTemplate(ctx, parsedAttr, template, parse5ElmLocation) {
12492
12532
  if (parsedAttr.get(exports.ElementDirectiveName.Is)) {
12493
12533
  ctx.throwAtLocation(errors.ParserDiagnostics.LWC_IS_INVALID_ELEMENT, location, ['<template>']);
12494
12534
  }
12535
+ if (parsedAttr.get(exports.ElementDirectiveName.On)) {
12536
+ if (!ctx.config.enableLwcOn) {
12537
+ ctx.throwAtLocation(errors.ParserDiagnostics.INVALID_LWC_ON_OPTS, location, ['<template>']);
12538
+ }
12539
+ ctx.throwAtLocation(errors.ParserDiagnostics.INVALID_LWC_ON_ELEMENT, location, ['<template>']);
12540
+ }
12495
12541
  // At this point in the parsing all supported attributes from a non root template element
12496
12542
  // should have been removed from ParsedAttribute and all other attributes will be ignored.
12497
12543
  const invalidTemplateAttributes = parsedAttr.getAttributes();
@@ -13655,6 +13701,19 @@ class CodeGen {
13655
13701
  return property$1(identifier('on'), memoize(objectToAST(listenerObj, (k) => listenerObj[k].handler)));
13656
13702
  }
13657
13703
  }
13704
+ genDynamicEventListeners(onDirective) {
13705
+ // Example Input : lwc:on={someObj}
13706
+ // $cmp.someObj
13707
+ const rawValue = this.bindExpression(onDirective.value);
13708
+ // {__proto__: null, ...$cmp.someObj}
13709
+ const clonedValue = objectExpression([
13710
+ property$1(identifier('__proto__'), literal$1(null)),
13711
+ spreadElement(rawValue),
13712
+ ]);
13713
+ const dynamicOnRawProperty = property$1(identifier('dynamicOnRaw'), rawValue);
13714
+ const dynamicOnProperty = property$1(identifier('dynamicOn'), clonedValue);
13715
+ return [dynamicOnRawProperty, dynamicOnProperty];
13716
+ }
13658
13717
  genRef(ref) {
13659
13718
  this.hasRefs = true;
13660
13719
  return property$1(identifier('ref'), ref.value);
@@ -14484,6 +14543,7 @@ function transform(codeGen) {
14484
14543
  const dom = element.directives.find(isDomDirective);
14485
14544
  const ref = element.directives.find(isRefDirective);
14486
14545
  const spread = element.directives.find(isSpreadDirective);
14546
+ const onDirective = element.directives.find(isOnDirective);
14487
14547
  const addSanitizationHook = isCustomRendererHookRequired(element, codeGen.state);
14488
14548
  const slotBindDirective = element.directives.find(isSlotBindDirective);
14489
14549
  // Attributes
@@ -14585,6 +14645,11 @@ function transform(codeGen) {
14585
14645
  if (listeners.length) {
14586
14646
  data.push(codeGen.genEventListeners(listeners));
14587
14647
  }
14648
+ // dynamic event listeners: lwc:on directive
14649
+ // codeGen.genDynamicEventListeners returns an array containing 2 properties: 'dynamicOn' & 'dynamicOnRaw'
14650
+ if (onDirective) {
14651
+ data.push(...codeGen.genDynamicEventListeners(onDirective));
14652
+ }
14588
14653
  // SVG handling
14589
14654
  if (element.namespace === shared.SVG_NAMESPACE) {
14590
14655
  data.push(property$1(identifier('svg'), literal$1(true)));
@@ -14703,5 +14768,5 @@ exports.generateScopeTokens = generateScopeTokens;
14703
14768
  exports.kebabcaseToCamelcase = kebabcaseToCamelcase;
14704
14769
  exports.parse = parse;
14705
14770
  exports.toPropertyName = toPropertyName;
14706
- /** version: 8.18.1 */
14771
+ /** version: 8.19.0 */
14707
14772
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -183,6 +183,7 @@ const AVAILABLE_OPTION_NAMES = new Set([
183
183
  'apiVersion',
184
184
  'customRendererConfig',
185
185
  'enableLwcSpread',
186
+ 'enableLwcOn',
186
187
  'enableStaticContentOptimization',
187
188
  // TODO [#3370]: remove experimental template expression flag
188
189
  'experimentalComplexExpressions',
@@ -245,6 +246,7 @@ function normalizeConfig(config) {
245
246
  enableDynamicComponents: false,
246
247
  enableStaticContentOptimization: true,
247
248
  enableLwcSpread: true,
249
+ enableLwcOn: false,
248
250
  disableSyntheticShadowSupport: false,
249
251
  ...config,
250
252
  apiVersion, // overrides the config apiVersion
@@ -9086,6 +9088,14 @@ function spreadDirective(value, location) {
9086
9088
  location,
9087
9089
  };
9088
9090
  }
9091
+ function OnDirective(value, location) {
9092
+ return {
9093
+ type: 'Directive',
9094
+ name: 'On',
9095
+ value,
9096
+ location,
9097
+ };
9098
+ }
9089
9099
  function slotBindDirective(value, location) {
9090
9100
  return {
9091
9101
  type: 'Directive',
@@ -9249,6 +9259,9 @@ function isDomDirective(directive) {
9249
9259
  function isSpreadDirective(directive) {
9250
9260
  return directive.name === 'Spread';
9251
9261
  }
9262
+ function isOnDirective(directive) {
9263
+ return directive.name === 'On';
9264
+ }
9252
9265
  function isInnerHTMLDirective(directive) {
9253
9266
  return directive.name === 'InnerHTML';
9254
9267
  }
@@ -9315,6 +9328,7 @@ var ElementDirectiveName;
9315
9328
  ElementDirectiveName["SlotBind"] = "lwc:slot-bind";
9316
9329
  ElementDirectiveName["SlotData"] = "lwc:slot-data";
9317
9330
  ElementDirectiveName["Spread"] = "lwc:spread";
9331
+ ElementDirectiveName["On"] = "lwc:on";
9318
9332
  ElementDirectiveName["Key"] = "key";
9319
9333
  })(ElementDirectiveName || (ElementDirectiveName = {}));
9320
9334
  var RootDirectiveName;
@@ -10860,6 +10874,7 @@ const HTML_ELEMENT_ATTRIBUTE_MAP = {
10860
10874
  'itemtype',
10861
10875
  'lang',
10862
10876
  'nonce',
10877
+ 'popover',
10863
10878
  'slot',
10864
10879
  'spellcheck',
10865
10880
  'style',
@@ -10924,6 +10939,8 @@ const HTML_ELEMENT_ATTRIBUTE_MAP = {
10924
10939
  'formnovalidate',
10925
10940
  'formtarget',
10926
10941
  'name',
10942
+ 'popovertarget',
10943
+ 'popovertargetaction',
10927
10944
  'type',
10928
10945
  'value',
10929
10946
  ],
@@ -11946,6 +11963,7 @@ const LWC_DIRECTIVE_PROCESSORS = [
11946
11963
  applyLwcInnerHtmlDirective,
11947
11964
  applyRefDirective,
11948
11965
  applyLwcSpreadDirective,
11966
+ applyLwcOnDirective,
11949
11967
  applyLwcSlotBindDirective,
11950
11968
  ];
11951
11969
  function applyLwcDirectives(ctx, parsedAttr, element) {
@@ -12008,6 +12026,28 @@ function applyLwcSpreadDirective(ctx, parsedAttr, element) {
12008
12026
  }
12009
12027
  element.directives.push(spreadDirective(lwcSpreadAttr, lwcSpread.location));
12010
12028
  }
12029
+ function applyLwcOnDirective(ctx, parsedAttr, element) {
12030
+ const { name: tag } = element;
12031
+ const lwcOn = parsedAttr.pick(ElementDirectiveName.On);
12032
+ if (!lwcOn) {
12033
+ return;
12034
+ }
12035
+ if (!ctx.config.enableLwcOn) {
12036
+ ctx.throwOnNode(ParserDiagnostics.INVALID_LWC_ON_OPTS, element);
12037
+ }
12038
+ const { value: lwcOnValue } = lwcOn;
12039
+ if (!isExpression$1(lwcOnValue)) {
12040
+ ctx.throwOnNode(ParserDiagnostics.INVALID_LWC_ON_LITERAL_PROP, element, [`<${tag}>`]);
12041
+ }
12042
+ // At this point element.listeners stores declarative event listeners (e.g., `onfoo`)
12043
+ // `lwc:on` directive cannot be used together with declarative event listeners.
12044
+ if (element.listeners.length) {
12045
+ ctx.throwOnNode(ParserDiagnostics.INVALID_LWC_ON_WITH_DECLARATIVE_LISTENERS, element, [
12046
+ `<${tag}>`,
12047
+ ]);
12048
+ }
12049
+ element.directives.push(OnDirective(lwcOnValue, lwcOn.location));
12050
+ }
12011
12051
  function applyLwcExternalDirective(ctx, parsedAttr, element) {
12012
12052
  const lwcExternalAttribute = parsedAttr.pick(ElementDirectiveName.External);
12013
12053
  if (!lwcExternalAttribute) {
@@ -12468,6 +12508,12 @@ function validateTemplate(ctx, parsedAttr, template, parse5ElmLocation) {
12468
12508
  if (parsedAttr.get(ElementDirectiveName.Is)) {
12469
12509
  ctx.throwAtLocation(ParserDiagnostics.LWC_IS_INVALID_ELEMENT, location, ['<template>']);
12470
12510
  }
12511
+ if (parsedAttr.get(ElementDirectiveName.On)) {
12512
+ if (!ctx.config.enableLwcOn) {
12513
+ ctx.throwAtLocation(ParserDiagnostics.INVALID_LWC_ON_OPTS, location, ['<template>']);
12514
+ }
12515
+ ctx.throwAtLocation(ParserDiagnostics.INVALID_LWC_ON_ELEMENT, location, ['<template>']);
12516
+ }
12471
12517
  // At this point in the parsing all supported attributes from a non root template element
12472
12518
  // should have been removed from ParsedAttribute and all other attributes will be ignored.
12473
12519
  const invalidTemplateAttributes = parsedAttr.getAttributes();
@@ -13631,6 +13677,19 @@ class CodeGen {
13631
13677
  return property$1(identifier('on'), memoize(objectToAST(listenerObj, (k) => listenerObj[k].handler)));
13632
13678
  }
13633
13679
  }
13680
+ genDynamicEventListeners(onDirective) {
13681
+ // Example Input : lwc:on={someObj}
13682
+ // $cmp.someObj
13683
+ const rawValue = this.bindExpression(onDirective.value);
13684
+ // {__proto__: null, ...$cmp.someObj}
13685
+ const clonedValue = objectExpression([
13686
+ property$1(identifier('__proto__'), literal$1(null)),
13687
+ spreadElement(rawValue),
13688
+ ]);
13689
+ const dynamicOnRawProperty = property$1(identifier('dynamicOnRaw'), rawValue);
13690
+ const dynamicOnProperty = property$1(identifier('dynamicOn'), clonedValue);
13691
+ return [dynamicOnRawProperty, dynamicOnProperty];
13692
+ }
13634
13693
  genRef(ref) {
13635
13694
  this.hasRefs = true;
13636
13695
  return property$1(identifier('ref'), ref.value);
@@ -14460,6 +14519,7 @@ function transform(codeGen) {
14460
14519
  const dom = element.directives.find(isDomDirective);
14461
14520
  const ref = element.directives.find(isRefDirective);
14462
14521
  const spread = element.directives.find(isSpreadDirective);
14522
+ const onDirective = element.directives.find(isOnDirective);
14463
14523
  const addSanitizationHook = isCustomRendererHookRequired(element, codeGen.state);
14464
14524
  const slotBindDirective = element.directives.find(isSlotBindDirective);
14465
14525
  // Attributes
@@ -14561,6 +14621,11 @@ function transform(codeGen) {
14561
14621
  if (listeners.length) {
14562
14622
  data.push(codeGen.genEventListeners(listeners));
14563
14623
  }
14624
+ // dynamic event listeners: lwc:on directive
14625
+ // codeGen.genDynamicEventListeners returns an array containing 2 properties: 'dynamicOn' & 'dynamicOnRaw'
14626
+ if (onDirective) {
14627
+ data.push(...codeGen.genDynamicEventListeners(onDirective));
14628
+ }
14564
14629
  // SVG handling
14565
14630
  if (element.namespace === SVG_NAMESPACE) {
14566
14631
  data.push(property$1(identifier('svg'), literal$1(true)));
@@ -14674,5 +14739,5 @@ function compile(source, filename, config) {
14674
14739
  }
14675
14740
 
14676
14741
  export { ElementDirectiveName, LWCDirectiveDomMode, LWCDirectiveRenderMode, LwcTagName, RootDirectiveName, TemplateDirectiveName, compile, compile as default, generateScopeTokens, kebabcaseToCamelcase, parse, toPropertyName };
14677
- /** version: 8.18.1 */
14742
+ /** version: 8.19.0 */
14678
14743
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Token as parse5TokenInfo } from 'parse5';
2
- import type { Literal, SourceLocation, Element, ExternalComponent, Component, Expression, ComplexExpression, Comment, Text, ForEach, ForBlock, Slot, Identifier, Root, EventListener, KeyDirective, DynamicDirective, DomDirective, PreserveCommentsDirective, RenderModeDirective, Attribute, Property, ParentNode, BaseNode, ForOf, LWCDirectiveRenderMode, If, IfBlock, ElseBlock, ElseifBlock, ElementSourceLocation, InnerHTMLDirective, BaseElement, LWCDirectiveDomMode, RefDirective, SpreadDirective, ElementDirective, RootDirective, SlotBindDirective, ScopedSlotFragment, SlotDataDirective, IsDirective, LwcComponent, LwcTagName, BaseLwcElement } from './types';
2
+ import type { Literal, SourceLocation, Element, ExternalComponent, Component, Expression, ComplexExpression, Comment, Text, ForEach, ForBlock, Slot, Identifier, Root, EventListener, KeyDirective, DynamicDirective, DomDirective, PreserveCommentsDirective, RenderModeDirective, Attribute, Property, ParentNode, BaseNode, ForOf, LWCDirectiveRenderMode, If, IfBlock, ElseBlock, ElseifBlock, ElementSourceLocation, InnerHTMLDirective, BaseElement, LWCDirectiveDomMode, RefDirective, SpreadDirective, OnDirective, ElementDirective, RootDirective, SlotBindDirective, ScopedSlotFragment, SlotDataDirective, IsDirective, LwcComponent, LwcTagName, BaseLwcElement } from './types';
3
3
  export declare function root(parse5ElmLocation: parse5TokenInfo.ElementLocation): Root;
4
4
  export declare function element(tagName: string, namespaceURI: string, parse5ElmLocation: parse5TokenInfo.ElementLocation): Element;
5
5
  export declare function externalComponent(tagName: string, parse5ElmLocation: parse5TokenInfo.ElementLocation): ExternalComponent;
@@ -23,6 +23,7 @@ export declare function keyDirective(value: Expression, location: SourceLocation
23
23
  export declare function dynamicDirective(value: Expression, location: SourceLocation): DynamicDirective;
24
24
  export declare function lwcIsDirective(value: Expression, location: SourceLocation): IsDirective;
25
25
  export declare function spreadDirective(value: Expression, location: SourceLocation): SpreadDirective;
26
+ export declare function OnDirective(value: Expression, location: SourceLocation): OnDirective;
26
27
  export declare function slotBindDirective(value: Expression, location: SourceLocation): SlotBindDirective;
27
28
  export declare function slotDataDirective(value: Identifier, location: SourceLocation): SlotDataDirective;
28
29
  export declare function domDirective(lwcDomAttr: LWCDirectiveDomMode, location: SourceLocation): DomDirective;
@@ -60,6 +61,7 @@ export declare function isDynamicDirective(directive: ElementDirective): directi
60
61
  export declare function isLwcIsDirective(directive: ElementDirective): directive is IsDirective;
61
62
  export declare function isDomDirective(directive: ElementDirective): directive is DomDirective;
62
63
  export declare function isSpreadDirective(directive: ElementDirective): directive is SpreadDirective;
64
+ export declare function isOnDirective(directive: ElementDirective): directive is OnDirective;
63
65
  export declare function isInnerHTMLDirective(directive: ElementDirective): directive is InnerHTMLDirective;
64
66
  export declare function isRefDirective(directive: ElementDirective): directive is RefDirective;
65
67
  export declare function isKeyDirective(directive: ElementDirective): directive is KeyDirective;
@@ -84,6 +84,9 @@ export interface DomDirective extends Directive<'Dom'> {
84
84
  export interface SpreadDirective extends Directive<'Spread'> {
85
85
  value: Expression;
86
86
  }
87
+ export interface OnDirective extends Directive<'On'> {
88
+ value: Expression;
89
+ }
87
90
  export interface InnerHTMLDirective extends Directive<'InnerHTML'> {
88
91
  value: Expression | Literal<string>;
89
92
  }
@@ -102,7 +105,7 @@ export interface SlotBindDirective extends Directive<'SlotBind'> {
102
105
  export interface SlotDataDirective extends Directive<'SlotData'> {
103
106
  value: Identifier;
104
107
  }
105
- export type ElementDirective = KeyDirective | DynamicDirective | IsDirective | DomDirective | InnerHTMLDirective | RefDirective | SlotBindDirective | SlotDataDirective | SpreadDirective;
108
+ export type ElementDirective = KeyDirective | DynamicDirective | IsDirective | DomDirective | InnerHTMLDirective | RefDirective | SlotBindDirective | SlotDataDirective | SpreadDirective | OnDirective;
106
109
  export type RootDirective = RenderModeDirective | PreserveCommentsDirective;
107
110
  export interface Text extends BaseNode {
108
111
  type: 'Text';
@@ -234,6 +237,7 @@ export declare enum ElementDirectiveName {
234
237
  SlotBind = "lwc:slot-bind",
235
238
  SlotData = "lwc:slot-data",
236
239
  Spread = "lwc:spread",
240
+ On = "lwc:on",
237
241
  Key = "key"
238
242
  }
239
243
  export declare enum RootDirectiveName {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
5
5
  ],
6
6
  "name": "@lwc/template-compiler",
7
- "version": "8.18.1",
7
+ "version": "8.19.0",
8
8
  "description": "Template compiler package",
9
9
  "keywords": [
10
10
  "lwc"
@@ -46,8 +46,8 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@lwc/errors": "8.18.1",
50
- "@lwc/shared": "8.18.1",
49
+ "@lwc/errors": "8.19.0",
50
+ "@lwc/shared": "8.19.0",
51
51
  "acorn": "~8.14.1",
52
52
  "astring": "~1.9.0",
53
53
  "he": "~1.2.0"