Migration guide for @uploadcare/blocks v0.39.0

BREAKING CHANGES

  • Shadow DOM is removed from the project. Now, we have a global style.
    See below for more details.

New styles

Previously, we had Shadow DOM in CSS, but now we have a simple CSS. We are decline from the idea use Shadow DOM.

Detailed information about the new CSS can be found on the styles page.

Migration steps

Case 1. You were using a default Shadow DOM without any customizations

You were using styles via Shadow DOM by css-src:

<lr-file-uploader-regular
  ctx-name="my-uploader"
  css-src="https://cdn.jsdelivr.net/npm/@uploadcare/blocks/web/lr-file-uploader-regular.min.css"
></lr-file-uploader-regular>

However now you need to use global style include by link:

<link rel="stylesheet"  href="https://cdn.jsdelivr.net/npm/@uploadcare/blocks/web/lr-file-uploader-regular.min.css">

<lr-file-uploader-regular
  ctx-name="my-uploader"
></lr-file-uploader-regular>

Case 2. You were using a Shadow DOM with customizations

Sometimes, you might need to make custom styles for your component, and you would do it through an inline css that you add to shadowStyles. Now it's much simpler to use the css you know with its specificity:

import * as LR from "@uploadcare/blocks";

LR.FileUploaderRegular.shadowStyles = /* CSS */ `
  :host lr-simple-btn button {
    background-color: #f00;
  }
`;

LR.registerBlocks(LR);
<lr-file-uploader-regular
  ctx-name="my-uploader"
  css-src="https://cdn.jsdelivr.net/npm/@uploadcare/blocks/web/lr-file-uploader-regular.min.css"
></lr-file-uploader-regular>

Now you need to use global css:

lr-file-uploader-regular lr-simple-btn button {
  background-color: #f00;
}
<lr-file-uploader-regular
  ctx-name="my-uploader"
></lr-file-uploader-regular>

See the styles page for more details.