All JavaScript helpers can be imported from the @eightshift/frontend-libs/scripts
folder, so you don't need to think about the internal folder structure of Eightshift Frontend Libs. If you want multiple functions imported just concatenate them in the import like this:
import {
camelize,
checkAttr,
props,
...
} from '@eightshift/frontend-libs/scripts';
Editor helpers
All of these helpers are generally only used in the Block Editor.
icons
All UI icons.
illustrations
Illustrations for helper modals.
blockIcons
Block icons, primarily used in block manifests.
getActions
Create attributes actions from blocks manifest.json. This helper is deprecated and should not be used anymore.
getOption
Provides ability to override component options from the parent block/component.
getOptionColors
Use this hook to filter the global colors out of the component or block manifest. This function is deprecated and getOption should be used.
getOptions
Combines two objects of options, one from current component and the other from the parent component.
getPaletteColors
Use this hook to read editor-color-palette colors directly from WP built in store.
inserter
Development inserter made to insert one or multiple blocks in the dom using console.
outputCssVariablesGlobal
Get Global manifest.json and return global variables as CSS variables.
outputCssVariables
Get component/block options and process them in CSS variables.
getUnique
Returns a unique ID generally used for css variables.
overrideInnerBlockAttributes
Used to set attributes on all innerBlocks. This value will be stored in the block editor store and set to a block.
overrideInnerBlockSimpleWrapperAttributes
Used to set attributes on all innerBlocks preset only for simple wrapper setup. This value will be stored in the block editor store and set to a block.
pasteInto
Paste event handler.
props
Output only attributes that are used in the component and remove everything else.
getAttributes
Get Block attributes combined in one: "shared, global, wrapper, components, block".
getExample
Get Block example attributes combined in one: "components and block".