Migration guide for @uploadcare/file-uploader v1.x
BREAKING CHANGES
- The package name
@uploadcare/blocks
has been renamed to@uploadcare/file-uploader
. - The prefix
lr-
has been replaced touc-
all custom elements. - The prefix
lr-
has been replaced touc-
all attributes. - The key
LR_WINDOW_KEY
toUC_WINDOW_KEY
and globalName has been replaced the iifeUC
instead ofLR
. - The path
./blocks/themes/lr-basic/*
has been changed to./blocks/themes/uc-basic/*
. - Bundle
blocks.min.js
is renamed tofile-uploader.min.js
. - Bundle
blocks.iife.min.js
is renamed tofile-uploader.iife.min.js
. - The method
registerBlocks
has been renamed todefineComponents
. - The method
connectBlocksFrom
has been renamed toloadFileUploaderFrom
.
How to migrate
Rename npm package
First, uninstall the old package:
Next, install the new package:
Rename imported JS and CSS bundles
Just rename all the imports according to the following table:
For example:
Rename lr
to uc
for each custom elements
Update all instances of lr-
to uc-
in your custom elements. For example:
Rename lr
to uc
for each html attributes
All attributes that used to be rendered with the LR prefix are now UC.
The uc-*
attribute will always be added to the tag itself.
We’ve started using attribute selectors instead of tag selectors to enable styles to
be attached to custom extended elements.
For example:
Before:
After:
Update Global Name in IIFE
If you have been using an IIFE, the window
object must now be accessed with the key UC
instead of LR
.
Rename blocks.min.js
to file-uploader.min.js
If you previously used to the blocks.min.js
bundle, you need to rename it to
file-uploader.min.js
as follows:
Rename blocks.iife.min.js
to file-uploader.iife.min.js
If you previously used to the blocks.iife.min.js
bundle, you need to rename it to
file-uploader.iife.min.js
as follows:
Rename registerBlocks
to defineComponents
If you have installed the File Uploader using *.min.js
bundles, you will need to manually call defineComponents
as follows:
Rename connectBlocksFrom
to loadFileUploaderFrom
The was renamed method connectBlocksFrom
to loadFileUploaderFrom