@lwc/engine-core 8.4.0 → 8.5.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.
@@ -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;
@@ -18,7 +18,6 @@ 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
@@ -6896,7 +6884,7 @@ function computeStylesheets(vm, ctor) {
6896
6884
  if (!shared.isUndefined(stylesheets)) {
6897
6885
  const valid = validateComponentStylesheets(vm, stylesheets);
6898
6886
  if (valid) {
6899
- return flattenStylesheets(stylesheets);
6887
+ return shared.flattenStylesheets(stylesheets);
6900
6888
  }
6901
6889
  else if (process.env.NODE_ENV !== 'production') {
6902
6890
  logError(`static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <${vm.tagName}>`, vm);
@@ -8507,5 +8495,5 @@ exports.swapTemplate = swapTemplate;
8507
8495
  exports.track = track;
8508
8496
  exports.unwrap = unwrap;
8509
8497
  exports.wire = wire;
8510
- /** version: 8.4.0 */
8498
+ /** version: 8.5.0 */
8511
8499
  //# sourceMappingURL=index.cjs.js.map