New and Changed Modules for Lightning Web Components

Do more with Lightning web components with these new or changed modules, such as adjust to the form factor of the client.

New Modules

These modules are now available.

lightning/flowSupport
Provides access to flow events. Use the events to control flow navigation and notify the flow runtime of changes in attribute values. To use the module a Lightning web component must specify the Lightning page target lightning__FlowScreen. Events include:
  • FlowAttributeChangeEvent—Informs the flow runtime that a component property has changed.
  • FlowNavigationBackEvent—Requests navigation to the previous screen.
  • FlowNavigationNextEvent—Requests navigation to the next screen.
  • FlowNavigationPauseEvent—Requests the flow runtime to pause the flow.
  • FlowNavigationFinishEvent—Requests the flow runtime to finish the flow.
// Syntax
import {LightningElement, api} from 'lwc';
import {FlowAttributeChangeEvent, FlowNavigationNextEvent} from 'lightning/flowSupport';
export default class MyFlowComponent extends LightningElement {
  @api
  numberOfClicks = 0;
  handleClick() {
    // Notify flow that the number of clicks has increased.
    let newNumClicks = this.numberOfClicks + 1;
    const attributeChangeEvent = new FlowAttributeChangeEvent('numberOfClicks', newNumClicks);
    this.dispatchEvent(attributeChangeEvent);
  }
  handleGoNext() {
       // Navigate next when user clicks next button.
       const nextNavigationEvent = new FlowNavigationNextEvent();
       this.dispatchEvent(nextNavigationEvent);
  }
}
For more information, see Add Powerful and Performant Lightning Web Components to Your Flow Screens.
@salesforce/client/formFactor
A string indicating the form factor of the hardware on which the browser is running. Possible values are:
  • Large—Desktop client
  • Medium—Tablet client
  • Small—Phone client
Pass this value to the getRecordCreateDefaults wire adapter to get the default layout information and object information for creating a record.
@salesforce/messageChannel (Developer Preview)
A string indicating the name of the Lightning message channel. A Lightning web component uses a Lightning message channel to access the Lightning Message Service API. Use the Lightning Message Service API to communicate across the DOM, between Aura components, Visualforce pages, and Lightning web components.
// Syntax
import channelName from '@salesforce/messageChannel/channelReference';
// Syntax for resources in a managed package
import channelName from '@salesforce/messageChannel/namespace__channelReference';
// Example
import SAMPLEMC from '@salesforce/messageChannel/SampleMessageChannel__c';
  • channelName—An imported symbol that identifies the message channel.
  • channelReference—The API name of the message channel.
  • namespace—If the message channel is in a managed package, this value is the namespace of the managed package. If the message channel is not in a managed package, omit the namespace.
For more information, see Communicate Across Salesforce UI Technologies with Lightning Message Service (Developer Preview).

Changed Modules

The following modules have changed.

@salesforce/lwc-jest
The package name lwc-jest is changing to sfdx-lwc-jest. Start using @salesforce/sfdx-lwc-jest instead.
For more information, see New Package Name for Testing with Jest.
lightning/uiRecordApi
Non-array strings are now supported for the following parameters in the getRecord wire adapter.
  • fields
  • layoutTypes
  • modes
  • optionalFields
Non-array strings are now supported for the following parameter in the getRecordUi wire adapter.
  • optionalFields