@lwc/engine-core 8.4.0 → 8.6.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.
@@ -40,12 +40,6 @@ declare function ddc(sel: string, Ctor: LightningElementConstructor | null | und
40
40
  * @param children
41
41
  */
42
42
  declare function dc(Ctor: LightningElementConstructor | null | undefined, data: VElementData, children?: VNodes): VCustomElement | null;
43
- export type SanitizeHtmlContentHook = (content: unknown) => string;
44
- /**
45
- * Sets the sanitizeHtmlContentHook.
46
- * @param newHookImpl
47
- */
48
- export declare function setSanitizeHtmlContentHook(newHookImpl: SanitizeHtmlContentHook): void;
49
43
  declare function shc(content: unknown): SanitizedHtmlContent;
50
44
  /**
51
45
  * [ncls] - Normalize class name attribute.
@@ -10,7 +10,7 @@ import { AccessibleElementProperties } from '@lwc/shared';
10
10
  import { ShadowSupportMode } from './vm';
11
11
  import { Template } from './template';
12
12
  import { HTMLElementConstructor } from './base-bridge-element';
13
- import { Stylesheets } from './stylesheet';
13
+ import type { Stylesheets } from '@lwc/shared';
14
14
  export interface LightningElementConstructor {
15
15
  new (): LightningElement;
16
16
  readonly prototype: LightningElement;
@@ -1,6 +1,6 @@
1
1
  import { Template } from './template';
2
- import { Stylesheet } from './stylesheet';
3
2
  import { LightningElementConstructor } from './base-lightning-element';
3
+ import type { Stylesheet } from '@lwc/shared';
4
4
  /**
5
5
  * Validate a template, stylesheet, or component to make sure that its compiled version matches
6
6
  * the version used by the LWC engine at runtime. Note that this only works in dev mode because
@@ -1,7 +1,7 @@
1
1
  import { VM } from './vm';
2
2
  import { LightningElementConstructor } from './base-lightning-element';
3
3
  import { Template } from './template';
4
- import { Stylesheet } from './stylesheet';
4
+ import type { Stylesheet } from '@lwc/shared';
5
5
  export declare function getTemplateOrSwappedTemplate(tpl: Template): Template;
6
6
  export declare function getComponentOrSwappedComponent(Ctor: LightningElementConstructor): LightningElementConstructor;
7
7
  export declare function getStyleOrSwappedStyle(style: Stylesheet): Stylesheet;
@@ -12,13 +12,12 @@ export { getComponentDef, isComponentConstructor } from './def';
12
12
  export { profilerControl as __unstable__ProfilerControl } from './profiler';
13
13
  export { reportingControl as __unstable__ReportingControl } from './reporting';
14
14
  export { swapTemplate, swapComponent, swapStyle } from './hot-swaps';
15
- export { setHooks } from './overridable-hooks';
15
+ export { setHooks } from '@lwc/shared';
16
16
  export { freezeTemplate } from './freeze-template';
17
17
  export { getComponentAPIVersion } from './component';
18
18
  export { shouldBeFormAssociated } from './utils';
19
19
  export { getComponentConstructor } from './get-component-constructor';
20
20
  export type { RendererAPI, LifecycleCallback } from './renderer';
21
- export type { Stylesheets } from './stylesheet';
22
21
  export type { Template } from './template';
23
22
  export type { ConfigValue as WireConfigValue, ContextConsumer as WireContextConsumer, ContextProvider as WireContextProvider, ContextValue as WireContextValue, DataCallback as WireDataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './wiring';
24
23
  export type { FormRestoreState, FormRestoreReason } from './vm';
@@ -29,3 +28,4 @@ export { default as wire } from './decorators/wire';
29
28
  export { readonly } from './readonly';
30
29
  export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
31
30
  export { setTrustedSignalSet } from '@lwc/shared';
31
+ export type { Stylesheet, Stylesheets } from '@lwc/shared';
@@ -1,16 +1,7 @@
1
1
  import { VM } from './vm';
2
2
  import { Template } from './template';
3
3
  import { VCustomElement, VNode } from './vnodes';
4
- /**
5
- * Function producing style based on a host and a shadow selector. This function is invoked by
6
- * the engine with different values depending on the mode that the component is running on.
7
- */
8
- export type Stylesheet = (stylesheetToken: string | undefined, useActualHostSelector: boolean, useNativeDirPseudoclass: boolean) => string;
9
- /**
10
- * The list of stylesheets associated with a template. Each entry is either a `Stylesheet` or
11
- * an array of stylesheets that a given stylesheet depends on via CSS `@import` declarations.
12
- */
13
- export type Stylesheets = Array<Stylesheet | Stylesheets>;
4
+ import type { Stylesheet } from '@lwc/shared';
14
5
  export declare function updateStylesheetToken(vm: VM, template: Template, legacy: boolean): void;
15
6
  export declare function getStylesheetsContent(vm: VM, template: Template): ReadonlyArray<string>;
16
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { RenderAPI } from './api';
2
2
  import { SlotSet, TemplateCache, VM } from './vm';
3
- import { Stylesheets } from './stylesheet';
4
3
  import { VNodes } from './vnodes';
4
+ import type { Stylesheets } from '@lwc/shared';
5
5
  export interface Template {
6
6
  (api: RenderAPI, cmp: object, slotSet: SlotSet, cache: TemplateCache): VNodes;
7
7
  /** The list of slot names used in the template. */
@@ -1,4 +1,3 @@
1
- import { Stylesheet, Stylesheets } from './stylesheet';
2
1
  import { LightningElementConstructor } from './base-lightning-element';
3
2
  type Callback = () => void;
4
3
  export declare const SPACE_CHAR = 32;
@@ -11,7 +10,6 @@ export declare function cloneAndOmitKey(object: {
11
10
  }, keyToOmit: string): {
12
11
  [key: string]: any;
13
12
  };
14
- export declare function flattenStylesheets(stylesheets: Stylesheets): Stylesheet[];
15
13
  export declare function assertNotProd(): void;
16
14
  export declare function shouldBeFormAssociated(Ctor: LightningElementConstructor): boolean;
17
15
  export {};
@@ -5,7 +5,7 @@ import { ComponentDef } from './def';
5
5
  import { LightningElement, LightningElementConstructor, LightningElementShadowRoot } from './base-lightning-element';
6
6
  import { ReactiveObserver } from './mutation-tracker';
7
7
  import { VNodes, VCustomElement, VNode, VBaseElement, VStaticPartElement } from './vnodes';
8
- import { Stylesheets } from './stylesheet';
8
+ import type { Stylesheets } from '@lwc/shared';
9
9
  type ShadowRootMode = 'open' | 'closed';
10
10
  export interface TemplateCache {
11
11
  [key: string]: any;
package/dist/index.cjs.js CHANGED
@@ -231,18 +231,6 @@ function cloneAndOmitKey(object, keyToOmit) {
231
231
  }
232
232
  return result;
233
233
  }
234
- function flattenStylesheets(stylesheets) {
235
- const list = [];
236
- for (const stylesheet of stylesheets) {
237
- if (!shared.isArray(stylesheet)) {
238
- list.push(stylesheet);
239
- }
240
- else {
241
- list.push(...flattenStylesheets(stylesheet));
242
- }
243
- }
244
- return list;
245
- }
246
234
  // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
247
235
  function assertNotProd() {
248
236
  /* istanbul ignore if */
@@ -3580,7 +3568,7 @@ function addActiveStylesheets(stylesheets, vm) {
3580
3568
  // Ignore non-existent stylesheets
3581
3569
  return;
3582
3570
  }
3583
- for (const stylesheet of flattenStylesheets(stylesheets)) {
3571
+ for (const stylesheet of shared.flattenStylesheets(stylesheets)) {
3584
3572
  // this is necessary because we don't hold the list of styles
3585
3573
  // in the vm, we only hold the selected (already swapped template)
3586
3574
  // but the styles attached to the template might not be the actual
@@ -5796,26 +5784,9 @@ function sc(vnodes) {
5796
5784
  markAsDynamicChildren(vnodes);
5797
5785
  return vnodes;
5798
5786
  }
5799
- /**
5800
- * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
5801
- * libraries to sanitize HTML content. This hook process the content passed via the template to
5802
- * lwc:inner-html directive.
5803
- * It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
5804
- */
5805
- let sanitizeHtmlContentHook = () => {
5806
- // locker-service patches this function during runtime to sanitize HTML content.
5807
- throw new Error('sanitizeHtmlContent hook must be implemented.');
5808
- };
5809
- /**
5810
- * Sets the sanitizeHtmlContentHook.
5811
- * @param newHookImpl
5812
- */
5813
- function setSanitizeHtmlContentHook(newHookImpl) {
5814
- sanitizeHtmlContentHook = newHookImpl;
5815
- }
5816
5787
  // [s]anitize [h]tml [c]ontent
5817
5788
  function shc(content) {
5818
- const sanitizedString = sanitizeHtmlContentHook(content);
5789
+ const sanitizedString = shared.sanitizeHtmlContent(content);
5819
5790
  return createSanitizedHtmlContent(sanitizedString);
5820
5791
  }
5821
5792
  /**
@@ -6896,7 +6867,7 @@ function computeStylesheets(vm, ctor) {
6896
6867
  if (!shared.isUndefined(stylesheets)) {
6897
6868
  const valid = validateComponentStylesheets(vm, stylesheets);
6898
6869
  if (valid) {
6899
- return flattenStylesheets(stylesheets);
6870
+ return shared.flattenStylesheets(stylesheets);
6900
6871
  }
6901
6872
  else if (process.env.NODE_ENV !== 'production') {
6902
6873
  logError(`static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <${vm.tagName}>`, vm);
@@ -7869,7 +7840,7 @@ expectAddlSiblings) {
7869
7840
  }
7870
7841
  }
7871
7842
  mount(childVnode, parentNode, renderer, nextNode);
7872
- nextNode = renderer.nextSibling(childVnode.elm);
7843
+ nextNode = renderer.nextSibling(childVnode.type === 5 /* VNodeType.Fragment */ ? childVnode.trailing : childVnode.elm);
7873
7844
  }
7874
7845
  }
7875
7846
  }
@@ -8184,19 +8155,6 @@ function haveCompatibleStaticParts(vnode, renderer) {
8184
8155
  return true;
8185
8156
  }
8186
8157
 
8187
- /*
8188
- * Copyright (c) 2018, salesforce.com, inc.
8189
- * All rights reserved.
8190
- * SPDX-License-Identifier: MIT
8191
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8192
- */
8193
- let hooksAreSet = false;
8194
- function setHooks(hooks) {
8195
- shared.assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
8196
- hooksAreSet = true;
8197
- setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
8198
- }
8199
-
8200
8158
  /*
8201
8159
  * Copyright (c) 2024, Salesforce, Inc.
8202
8160
  * All rights reserved.
@@ -8459,6 +8417,10 @@ function readonly(obj) {
8459
8417
  return getReadOnlyProxy(obj);
8460
8418
  }
8461
8419
 
8420
+ Object.defineProperty(exports, "setHooks", {
8421
+ enumerable: true,
8422
+ get: function () { return shared.setHooks; }
8423
+ });
8462
8424
  Object.defineProperty(exports, "setTrustedSignalSet", {
8463
8425
  enumerable: true,
8464
8426
  get: function () { return shared.setTrustedSignalSet; }
@@ -8499,7 +8461,6 @@ exports.runFormDisabledCallback = runFormDisabledCallback;
8499
8461
  exports.runFormResetCallback = runFormResetCallback;
8500
8462
  exports.runFormStateRestoreCallback = runFormStateRestoreCallback;
8501
8463
  exports.sanitizeAttribute = sanitizeAttribute;
8502
- exports.setHooks = setHooks;
8503
8464
  exports.shouldBeFormAssociated = shouldBeFormAssociated;
8504
8465
  exports.swapComponent = swapComponent;
8505
8466
  exports.swapStyle = swapStyle;
@@ -8507,5 +8468,5 @@ exports.swapTemplate = swapTemplate;
8507
8468
  exports.track = track;
8508
8469
  exports.unwrap = unwrap;
8509
8470
  exports.wire = wire;
8510
- /** version: 8.4.0 */
8471
+ /** version: 8.6.0 */
8511
8472
  //# sourceMappingURL=index.cjs.js.map