@mantou/gem 2.2.0 → 2.2.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.
Files changed (159) hide show
  1. package/dist/gem.es.js +2039 -2051
  2. package/dist/gem.umd.js +12 -32
  3. package/elements/base/dialog.d.ts +1 -1
  4. package/elements/base/dialog.d.ts.map +1 -1
  5. package/elements/base/dialog.js +2 -2
  6. package/elements/base/dialog.js.map +1 -1
  7. package/elements/base/gesture.d.ts +1 -1
  8. package/elements/base/gesture.d.ts.map +1 -1
  9. package/elements/base/gesture.js +5 -5
  10. package/elements/base/gesture.js.map +1 -1
  11. package/elements/base/link.d.ts +1 -1
  12. package/elements/base/link.d.ts.map +1 -1
  13. package/elements/base/link.js +18 -19
  14. package/elements/base/link.js.map +1 -1
  15. package/elements/base/modal-factory.d.ts +93 -57
  16. package/elements/base/modal-factory.d.ts.map +1 -1
  17. package/elements/base/modal-factory.js +4 -3
  18. package/elements/base/modal-factory.js.map +1 -1
  19. package/elements/base/reflect.d.ts +1 -2
  20. package/elements/base/reflect.d.ts.map +1 -1
  21. package/elements/base/reflect.js +8 -10
  22. package/elements/base/reflect.js.map +1 -1
  23. package/elements/base/route.d.ts +18 -8
  24. package/elements/base/route.d.ts.map +1 -1
  25. package/elements/base/route.js +17 -21
  26. package/elements/base/route.js.map +1 -1
  27. package/elements/base/title.d.ts +1 -1
  28. package/elements/base/title.d.ts.map +1 -1
  29. package/elements/base/title.js +5 -7
  30. package/elements/base/title.js.map +1 -1
  31. package/elements/base/unsafe.d.ts +4 -3
  32. package/elements/base/unsafe.d.ts.map +1 -1
  33. package/elements/base/unsafe.js +45 -24
  34. package/elements/base/unsafe.js.map +1 -1
  35. package/elements/base/use.d.ts +1 -1
  36. package/elements/base/use.d.ts.map +1 -1
  37. package/elements/base/use.js +1 -1
  38. package/elements/base/use.js.map +1 -1
  39. package/elements/link.js +1 -1
  40. package/elements/link.js.map +1 -1
  41. package/elements/route.js +1 -1
  42. package/elements/route.js.map +1 -1
  43. package/helper/hmr.d.ts +11 -0
  44. package/helper/hmr.d.ts.map +1 -0
  45. package/helper/hmr.js +255 -0
  46. package/helper/hmr.js.map +1 -0
  47. package/helper/i18n.d.ts +2 -2
  48. package/helper/i18n.d.ts.map +1 -1
  49. package/helper/i18n.js +5 -4
  50. package/helper/i18n.js.map +1 -1
  51. package/helper/logger.d.ts +1 -1
  52. package/helper/logger.d.ts.map +1 -1
  53. package/helper/logger.js +8 -5
  54. package/helper/logger.js.map +1 -1
  55. package/helper/mediaquery.js +1 -1
  56. package/helper/mediaquery.js.map +1 -1
  57. package/helper/react-utils.d.ts.map +1 -1
  58. package/helper/react-utils.js +2 -6
  59. package/helper/react-utils.js.map +1 -1
  60. package/helper/ssr-shim.d.ts.map +1 -1
  61. package/helper/ssr-shim.js +2 -1
  62. package/helper/ssr-shim.js.map +1 -1
  63. package/helper/theme.d.ts +17 -6
  64. package/helper/theme.d.ts.map +1 -1
  65. package/helper/theme.js +23 -8
  66. package/helper/theme.js.map +1 -1
  67. package/index.d.ts +1 -2
  68. package/index.d.ts.map +1 -1
  69. package/index.js +1 -3
  70. package/index.js.map +1 -1
  71. package/lib/decorators.d.ts +54 -62
  72. package/lib/decorators.d.ts.map +1 -1
  73. package/lib/decorators.js +90 -91
  74. package/lib/decorators.js.map +1 -1
  75. package/lib/directive.d.ts +0 -18
  76. package/lib/directive.d.ts.map +1 -1
  77. package/lib/directive.js +1 -2
  78. package/lib/directive.js.map +1 -1
  79. package/lib/element.d.ts +8 -137
  80. package/lib/element.d.ts.map +1 -1
  81. package/lib/element.js +16 -481
  82. package/lib/element.js.map +1 -1
  83. package/lib/history.d.ts +68 -10
  84. package/lib/history.d.ts.map +1 -1
  85. package/lib/history.js +15 -15
  86. package/lib/history.js.map +1 -1
  87. package/lib/lit-html.d.ts +7 -109
  88. package/lib/lit-html.d.ts.map +1 -1
  89. package/lib/lit-html.js +75 -32
  90. package/lib/lit-html.js.map +1 -1
  91. package/lib/reactive.d.ts +130 -0
  92. package/lib/reactive.d.ts.map +1 -0
  93. package/lib/reactive.js +474 -0
  94. package/lib/reactive.js.map +1 -0
  95. package/lib/repeat.d.ts +3 -3
  96. package/lib/repeat.d.ts.map +1 -1
  97. package/lib/repeat.js +3 -3
  98. package/lib/repeat.js.map +1 -1
  99. package/lib/store.d.ts +15 -4
  100. package/lib/store.d.ts.map +1 -1
  101. package/lib/store.js +2 -0
  102. package/lib/store.js.map +1 -1
  103. package/lib/utils.d.ts +26 -11
  104. package/lib/utils.d.ts.map +1 -1
  105. package/lib/utils.js +21 -14
  106. package/lib/utils.js.map +1 -1
  107. package/package.json +3 -3
  108. package/src/dist.ts +6 -8
  109. package/src/elements/base/dialog.ts +2 -2
  110. package/src/elements/base/gesture.ts +6 -6
  111. package/src/elements/base/link.ts +18 -24
  112. package/src/elements/base/modal-factory.ts +4 -3
  113. package/src/elements/base/reflect.ts +2 -3
  114. package/src/elements/base/route.ts +21 -28
  115. package/src/elements/base/title.ts +6 -8
  116. package/src/elements/base/unsafe.ts +33 -14
  117. package/src/elements/base/use.ts +1 -1
  118. package/src/elements/link.ts +1 -1
  119. package/src/elements/route.ts +1 -1
  120. package/src/helper/hmr.ts +305 -0
  121. package/src/helper/i18n.ts +7 -7
  122. package/src/helper/logger.ts +9 -5
  123. package/src/helper/mediaquery.ts +1 -1
  124. package/src/helper/react-utils.ts +4 -12
  125. package/src/helper/ssr-shim.ts +3 -1
  126. package/src/helper/theme.ts +29 -14
  127. package/src/index.ts +1 -4
  128. package/src/lib/decorators.ts +107 -117
  129. package/src/lib/directive.ts +3 -5
  130. package/src/lib/element.ts +21 -600
  131. package/src/lib/history.ts +16 -18
  132. package/src/lib/lit-html.ts +89 -34
  133. package/src/lib/reactive.ts +620 -0
  134. package/src/lib/repeat.ts +5 -5
  135. package/src/lib/store.ts +4 -2
  136. package/src/lib/utils.ts +41 -29
  137. package/src/test/elements/link.test.ts +2 -2
  138. package/src/test/elements/reflect.test.ts +3 -3
  139. package/src/test/elements/title.test.ts +2 -2
  140. package/src/test/gem-element/advance.test.ts +11 -10
  141. package/src/test/gem-element/basic.test.ts +4 -5
  142. package/src/test/gem-element/decorators.test.ts +10 -10
  143. package/src/test/gem-element/multi.test.ts +2 -2
  144. package/src/test/history.test.ts +1 -2
  145. package/src/test/store.test.ts +2 -3
  146. package/src/test/utils.test.ts +5 -6
  147. package/src/test/utils.ts +2 -2
  148. package/helper/react-shim.d.ts +0 -15
  149. package/helper/react-shim.d.ts.map +0 -1
  150. package/helper/react-shim.js +0 -56
  151. package/helper/react-shim.js.map +0 -1
  152. package/lib/directives.d.ts +0 -4
  153. package/lib/directives.d.ts.map +0 -1
  154. package/lib/directives.js +0 -5
  155. package/lib/directives.js.map +0 -1
  156. package/lib/ref.d.ts +0 -1
  157. package/lib/ref.d.ts.map +0 -1
  158. package/lib/ref.js +0 -2
  159. package/lib/ref.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  // https://github.com/WICG/navigation-api#stakeholder-feedback
2
2
 
3
3
  import { connect, createStore } from './store';
4
- import { QueryString, cleanObject, GemError, absoluteLocation } from './utils';
4
+ import { absoluteLocation, cleanObject, GemError, QueryString } from './utils';
5
5
 
6
- const nativeHistory = window.history;
6
+ const nativeHistory = globalThis.history;
7
7
  const nativePushState: typeof nativeHistory.pushState = nativeHistory.pushState.bind(nativeHistory);
8
8
  const nativeReplaceState: typeof nativeHistory.replaceState = nativeHistory.replaceState.bind(nativeHistory);
9
9
 
@@ -107,7 +107,7 @@ function updateHistory(p: UpdateHistoryParams, native: typeof nativeHistory.push
107
107
  const url = getUrlBarPath(path) + new QueryString(query) + hash;
108
108
  const prevHash = decodeURIComponent(location.hash);
109
109
  native(state, title, url);
110
- if (prevHash !== hash) window.dispatchEvent(new CustomEvent('hashchange'));
110
+ if (prevHash !== hash) dispatchEvent(new CustomEvent('hashchange'));
111
111
  }
112
112
 
113
113
  // 跨框架时,调用者对 basePath 无感知
@@ -128,7 +128,7 @@ function updateHistoryByNative(data: any, title: string, originUrl: string, nati
128
128
  const prevHash = location.hash;
129
129
  native(state, title, url);
130
130
  // `location.hash` 和 `hash` 都已经进行了 url 编码,可以直接进行相等判断
131
- if (prevHash !== hash) window.dispatchEvent(new CustomEvent('hashchange'));
131
+ if (prevHash !== hash) dispatchEvent(new CustomEvent('hashchange'));
132
132
  }
133
133
 
134
134
  const gemBasePathStore = createStore({
@@ -185,27 +185,25 @@ const gemHistory = new GemHistory();
185
185
 
186
186
  const gemTitleStore = createStore({ defaultTitle: document.title, url: '', title: '' });
187
187
 
188
- const _GEMHISTORY = { history: gemHistory, titleStore: gemTitleStore, basePathStore: gemBasePathStore };
188
+ const HISTORY = { history: gemHistory, titleStore: gemTitleStore, basePathStore: gemBasePathStore };
189
189
 
190
190
  declare global {
191
- interface Window {
192
- _GEMHISTORY?: typeof _GEMHISTORY;
193
- }
191
+ var _GEMHISTORY: typeof HISTORY | undefined;
194
192
  }
195
193
 
196
- if (!window._GEMHISTORY) {
197
- window._GEMHISTORY = _GEMHISTORY;
194
+ if (!globalThis._GEMHISTORY) {
195
+ globalThis._GEMHISTORY = HISTORY;
198
196
 
199
- nativeHistory.pushState = function (state: any, title: string, path: string) {
197
+ nativeHistory.pushState = (state: any, title: string, path: string) => {
200
198
  updateHistoryByNative(state, title, path, nativePushState);
201
199
  };
202
200
 
203
- nativeHistory.replaceState = function (state: any, title: string, path: string) {
201
+ nativeHistory.replaceState = (state: any, title: string, path: string) => {
204
202
  updateHistoryByNative(state, title, path, nativeReplaceState);
205
203
  };
206
204
 
207
205
  // 点击 `<a>`
208
- window.addEventListener('hashchange', ({ isTrusted }) => {
206
+ addEventListener('hashchange', ({ isTrusted }) => {
209
207
  if (isTrusted) {
210
208
  gemHistory.replace({ hash: location.hash });
211
209
  }
@@ -250,7 +248,7 @@ if (!window._GEMHISTORY) {
250
248
  * 表示 popstate handler 中正在进行导航
251
249
  */
252
250
  let navigating = false;
253
- window.addEventListener('popstate', (event) => {
251
+ addEventListener('popstate', (event) => {
254
252
  const newState = event.state as HistoryState | null;
255
253
  if (!newState?.$key) {
256
254
  // 比如作为其他框架 app 的宿主 app
@@ -270,10 +268,10 @@ if (!window._GEMHISTORY) {
270
268
  if (!paramsMap.has(newState.$key)) {
271
269
  const { pathname, search, hash } = location;
272
270
  paramsMap.set(newState.$key, {
273
- path: pathname,
271
+ path: getInternalPath(pathname),
274
272
  query: new QueryString(search),
275
273
  hash: decodeURIComponent(hash),
276
- title: newState.$title, // document.title 是导航前的
274
+ title: gemTitleStore.title || newState.$title, // document.title 是导航前的
277
275
  data: newState,
278
276
  });
279
277
  }
@@ -316,5 +314,5 @@ if (!window._GEMHISTORY) {
316
314
  });
317
315
  }
318
316
 
319
- const { history, titleStore, basePathStore } = window._GEMHISTORY;
320
- export { history, titleStore, basePathStore };
317
+ const { history, titleStore, basePathStore } = globalThis._GEMHISTORY;
318
+ export { basePathStore, history, titleStore };
@@ -1,3 +1,6 @@
1
+ /** biome-ignore-all lint/complexity/noCommaOperator: lit */
2
+ /** biome-ignore-all lint/style/useTemplate: lit */
3
+
1
4
  /**
2
5
  * @license
3
6
  * Copyright 2017 Google LLC
@@ -5,6 +8,8 @@
5
8
  */
6
9
 
7
10
  /**
11
+ * Gem Note:
12
+ *
8
13
  * TemplateResult change to classes
9
14
  * Use `null`/`undefined` instead `nothing`, no export `noChange`
10
15
  * Built-in ref & rest props`
@@ -12,6 +17,7 @@
12
17
  * Remove sanitizer
13
18
  * Remove debug log event
14
19
  * Remove warning log
20
+ * Support v-if/v-else-if/v-else
15
21
  */
16
22
 
17
23
  import type { TrustedTypesWindow } from 'trusted-types/lib';
@@ -22,9 +28,7 @@ const global = globalThis;
22
28
 
23
29
  const trustedTypes = (global as unknown as TrustedTypesWindow).trustedTypes;
24
30
 
25
- const policy = trustedTypes?.createPolicy('lit-html', {
26
- createHTML: (s: string) => s,
27
- });
31
+ const policy = trustedTypes?.createPolicy('lit-html', { createHTML: (s: string) => s });
28
32
 
29
33
  // Added to an attribute name to mark the attribute as bound so we can find
30
34
  // it easily.
@@ -51,7 +55,7 @@ const createMarker = () => d.createComment('');
51
55
  // https://tc39.github.io/ecma262/#sec-typeof-operator
52
56
  type Primitive = null | undefined | boolean | number | string | symbol | bigint;
53
57
  const isPrimitive = (value: unknown): value is Primitive =>
54
- value === null || (typeof value != 'object' && typeof value != 'function');
58
+ value === null || (typeof value !== 'object' && typeof value !== 'function');
55
59
  const isNullish = (value: unknown) => value === null || value === undefined;
56
60
  const isIterable = (value: any): value is Iterable<unknown> => Symbol.iterator in value;
57
61
 
@@ -125,6 +129,13 @@ const doubleQuoteAttrEndRegex = /"/g;
125
129
  */
126
130
  const rawTextElement = /^(?:script|style|textarea|title)$/i;
127
131
 
132
+ /** TemplateResult types */
133
+ const HTML_RESULT = 1;
134
+ const SVG_RESULT = 2;
135
+ const MATHML_RESULT = 3;
136
+
137
+ type ResultType = typeof HTML_RESULT | typeof SVG_RESULT | typeof MATHML_RESULT;
138
+
128
139
  // TemplatePart types
129
140
  // IMPORTANT: these must match the values in PartType
130
141
  const ATTRIBUTE_PART = 1;
@@ -135,11 +146,9 @@ const EVENT_PART = 5;
135
146
  const ELEMENT_PART = 6;
136
147
  const COMMENT_PART = 7;
137
148
 
138
- enum ResultType {
139
- HTML,
140
- SVG,
141
- MATHML,
142
- }
149
+ const V_IF = 'v-if';
150
+ const V_ELSE_IF = 'v-else-if';
151
+ const V_ELSE = 'v-else';
143
152
 
144
153
  export class TemplateResult {
145
154
  type: ResultType;
@@ -158,9 +167,9 @@ const tag =
158
167
  return new TemplateResult(type, strings, values);
159
168
  };
160
169
 
161
- export const html = tag(ResultType.HTML);
162
- export const svg = tag(ResultType.SVG);
163
- export const mathml = tag(ResultType.MATHML);
170
+ export const html = tag(HTML_RESULT);
171
+ export const svg = tag(SVG_RESULT);
172
+ export const mathml = tag(MATHML_RESULT);
164
173
 
165
174
  // for directive
166
175
  export const noChange = Symbol.for('lit-noChange');
@@ -249,7 +258,7 @@ const getTemplateHtml = (strings: TemplateStringsArray, type: ResultType): [Trus
249
258
  // parts. ElementParts are also reflected in this array as undefined
250
259
  // rather than a string, to disambiguate from attribute bindings.
251
260
  const attrNames: Array<string> = [];
252
- let htmlStr = type === ResultType.SVG ? '<svg>' : type === ResultType.MATHML ? '<math>' : '';
261
+ let htmlStr = type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';
253
262
 
254
263
  // When we're inside a raw text tag (not it's text content), the regex
255
264
  // will still be tagRegex so we can find attributes, but will switch to
@@ -357,9 +366,7 @@ const getTemplateHtml = (strings: TemplateStringsArray, type: ResultType): [Trus
357
366
  }
358
367
 
359
368
  const htmlResult: string | TrustedHTML =
360
- htmlStr +
361
- (strings[l] || '<?>') +
362
- (type === ResultType.SVG ? '</svg>' : type === ResultType.MATHML ? '</math>' : '');
369
+ htmlStr + (strings[l] || '<?>') + (type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');
363
370
 
364
371
  // Returned as an array for terseness
365
372
  return [trustFromTemplateString(strings, htmlResult), attrNames];
@@ -385,7 +392,7 @@ class Template {
385
392
  walker.currentNode = this.el.content;
386
393
 
387
394
  // Re-parent SVG or MathML nodes into template root
388
- if (type === ResultType.SVG || type === ResultType.MATHML) {
395
+ if (type === SVG_RESULT || type === MATHML_RESULT) {
389
396
  const wrapper = this.el.content.firstChild!;
390
397
  wrapper.replaceWith(...wrapper.childNodes);
391
398
  }
@@ -513,10 +520,10 @@ function resolveDirective(
513
520
  const nextDirectiveConstructor = isPrimitive(value)
514
521
  ? undefined
515
522
  : // This property needs to remain unminified.
516
- (value as DirectiveResult)['_$litDirective$'];
523
+ (value as DirectiveResult)._$litDirective$;
517
524
  if (currentDirective?.constructor !== nextDirectiveConstructor) {
518
525
  // This property needs to remain unminified.
519
- currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);
526
+ currentDirective?._$notifyDirectiveConnectionChanged?.(false);
520
527
  if (nextDirectiveConstructor === undefined) {
521
528
  currentDirective = undefined;
522
529
  } else {
@@ -548,6 +555,8 @@ export type { TemplateInstance };
548
555
  class TemplateInstance implements Disconnectable {
549
556
  _$template: Template;
550
557
  _$parts: Array<Part | undefined> = [];
558
+ /** @internal */
559
+ _$conditions: ConditionChain[] = [];
551
560
 
552
561
  /** @internal */
553
562
  _$parent: ChildPart;
@@ -574,8 +583,10 @@ class TemplateInstance implements Disconnectable {
574
583
  _clone(options: RenderOptions | undefined) {
575
584
  const {
576
585
  el: { content },
577
- parts: parts,
586
+ parts,
578
587
  } = this._$template;
588
+ const ifMap = new Map<Element, number>();
589
+ const elseIfMap = new Map<Element, number>();
579
590
  const fragment = (options?.creationScope ?? d).importNode(content, true);
580
591
  walker.currentNode = fragment;
581
592
 
@@ -590,6 +601,8 @@ class TemplateInstance implements Disconnectable {
590
601
  if (templatePart.type === CHILD_PART) {
591
602
  part = new ChildPart(node as HTMLElement, node.nextSibling, this, options);
592
603
  } else if (templatePart.type === ATTRIBUTE_PART) {
604
+ templatePart.name === V_IF && ifMap.set(node as HTMLElement, partIndex);
605
+ templatePart.name === V_ELSE_IF && elseIfMap.set(node as HTMLElement, partIndex);
593
606
  part = new templatePart.ctor(node as HTMLElement, templatePart.name, templatePart.strings, this, options);
594
607
  } else if (templatePart.type === ELEMENT_PART) {
595
608
  part = new ElementPart(node as HTMLElement, this, options);
@@ -602,6 +615,18 @@ class TemplateInstance implements Disconnectable {
602
615
  nodeIndex++;
603
616
  }
604
617
  }
618
+
619
+ ifMap.forEach((idx, element) => {
620
+ const chain = new ConditionChain(element, idx);
621
+ this._$conditions.push(chain);
622
+ let ele: Element | null = element;
623
+ while ((ele = ele.nextElementSibling)) {
624
+ const pos = elseIfMap.get(ele);
625
+ if (pos === undefined) break;
626
+ chain.push(ele, pos);
627
+ }
628
+ });
629
+
605
630
  // We need to set the currentNode away from the cloned tree so that we
606
631
  // don't hold onto the tree even if the tree is detached and should be
607
632
  // freed.
@@ -619,12 +644,52 @@ class TemplateInstance implements Disconnectable {
619
644
  // since values are in between template spans. We increment i by 1
620
645
  // later in the loop, so increment it by part.strings.length - 2 here
621
646
  i += (part as AttributePart).strings!.length - 2;
647
+ } else if ((part as AttributePart).name === V_IF || (part as AttributePart).name === V_ELSE_IF) {
622
648
  } else {
623
649
  part._$setValue(values[i]);
624
650
  }
625
651
  }
626
652
  i++;
627
653
  }
654
+
655
+ this._$conditions.forEach((e) => e.update(values));
656
+ }
657
+ }
658
+
659
+ class ConditionChain {
660
+ readonly mark: Comment;
661
+ readonly list: { ele: Element; idx?: number }[];
662
+
663
+ constructor(ele: Element, idx: number) {
664
+ const mark = createMarker();
665
+ ele.before(mark);
666
+ this.mark = mark;
667
+ this.list = [{ ele, idx }];
668
+ this.check();
669
+ }
670
+
671
+ get next() {
672
+ return this.list.at(-1)!.ele.nextElementSibling;
673
+ }
674
+
675
+ push(ele: Element, idx?: number) {
676
+ this.list.push({ ele, idx });
677
+ this.check();
678
+ }
679
+
680
+ check() {
681
+ const next = this.next;
682
+ if (next?.attributes.getNamedItem(V_ELSE)) {
683
+ this.list.push({ ele: next });
684
+ next.removeAttribute(V_ELSE);
685
+ }
686
+ }
687
+
688
+ update(values: Array<unknown>) {
689
+ const { mark, list } = this;
690
+ const show = list.find(({ idx }) => idx === undefined || !!values[idx]);
691
+ if (show && !show.ele.parentNode) mark.after(show.ele);
692
+ list.forEach(({ ele }) => (!show || ele !== show.ele) && ele.remove());
628
693
  }
629
694
  }
630
695
 
@@ -1042,7 +1107,7 @@ class AttributePart implements Disconnectable {
1042
1107
  const values = value as Array<unknown>;
1043
1108
  value = strings[0];
1044
1109
 
1045
- let i, v;
1110
+ let i: number, v: any;
1046
1111
  for (i = 0; i < strings.length - 1; i++) {
1047
1112
  v = resolveDirective(this, values[valueIndex! + i], directiveParent, i);
1048
1113
  change ||= !isPrimitive(v) || v !== (this._$committedValue as Array<unknown>)[i];
@@ -1095,16 +1160,6 @@ export type { EventPart };
1095
1160
  class EventPart extends AttributePart {
1096
1161
  override readonly type = EVENT_PART;
1097
1162
 
1098
- constructor(
1099
- element: HTMLElement,
1100
- name: string,
1101
- strings: ReadonlyArray<string>,
1102
- parent: Disconnectable,
1103
- options: RenderOptions | undefined,
1104
- ) {
1105
- super(element, name, strings, parent, options);
1106
- }
1107
-
1108
1163
  /** @internal */
1109
1164
  override _$setValue(newListener: unknown, directiveParent: DirectiveParent = this) {
1110
1165
  newListener = resolveDirective(this, newListener, directiveParent, 0);
@@ -1175,7 +1230,7 @@ class ElementPart implements Disconnectable {
1175
1230
  if (!value) return;
1176
1231
  if (value instanceof Ref) {
1177
1232
  value.value = this.element;
1178
- } else if ((value as DirectiveResult)['_$litDirective$']) {
1233
+ } else if ((value as DirectiveResult)._$litDirective$) {
1179
1234
  resolveDirective(this, value);
1180
1235
  } else {
1181
1236
  if (this._$props) {
@@ -1202,10 +1257,10 @@ export const render = (
1202
1257
  options?: RenderOptions,
1203
1258
  ): RootPart => {
1204
1259
  const partOwnerNode = (options?.renderBefore ?? container) as any;
1205
- let part: ChildPart = partOwnerNode['_$litPart$'];
1260
+ let part: ChildPart = partOwnerNode._$litPart$;
1206
1261
  if (part === undefined) {
1207
1262
  const endNode = options?.renderBefore ?? null;
1208
- partOwnerNode['_$litPart$'] = part = new ChildPart(
1263
+ partOwnerNode._$litPart$ = part = new ChildPart(
1209
1264
  container.insertBefore(createMarker(), endNode),
1210
1265
  endNode,
1211
1266
  undefined,