@dnd-kit/dom 0.1.20 → 0.1.21

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.
package/index.cjs CHANGED
@@ -311,10 +311,13 @@ var Cursor = class extends abstract.Plugin {
311
311
  this.destroy = state.effect(() => {
312
312
  var _a4;
313
313
  const { dragOperation } = this.manager;
314
- const { cursor = "grabbing" } = (_a4 = this.options) != null ? _a4 : {};
314
+ const { cursor = "grabbing", nonce } = (_a4 = this.options) != null ? _a4 : {};
315
315
  if (dragOperation.status.initialized) {
316
316
  const document2 = doc.value;
317
317
  const style = document2.createElement("style");
318
+ if (nonce) {
319
+ style.setAttribute("nonce", nonce);
320
+ }
318
321
  style.textContent = `* { cursor: ${cursor} !important; }`;
319
322
  document2.head.appendChild(style);
320
323
  return () => style.remove();
@@ -916,17 +919,21 @@ render_fn = function() {
916
919
  };
917
920
  };
918
921
  injectStyles_fn = function() {
919
- var _a4, _b2;
922
+ var _a4, _b2, _c3;
920
923
  const { status, source, target } = this.manager.dragOperation;
924
+ const { nonce } = (_a4 = this.options) != null ? _a4 : {};
921
925
  if (status.initializing) {
922
- const sourceDocument = utilities.getDocument((_a4 = source == null ? void 0 : source.element) != null ? _a4 : null);
923
- const targetDocument = utilities.getDocument((_b2 = target == null ? void 0 : target.element) != null ? _b2 : null);
926
+ const sourceDocument = utilities.getDocument((_b2 = source == null ? void 0 : source.element) != null ? _b2 : null);
927
+ const targetDocument = utilities.getDocument((_c3 = target == null ? void 0 : target.element) != null ? _c3 : null);
924
928
  const documents = /* @__PURE__ */ new Set([sourceDocument, targetDocument]);
925
929
  for (const doc of documents) {
926
930
  let registration = styleSheetRegistry.get(doc);
927
931
  if (!registration) {
928
932
  const style = document.createElement("style");
929
933
  style.textContent = CSS_RULES;
934
+ if (nonce) {
935
+ style.setAttribute("nonce", nonce);
936
+ }
930
937
  doc.head.prepend(style);
931
938
  const mutationObserver = new MutationObserver((entries) => {
932
939
  for (const entry of entries) {
@@ -1300,13 +1307,18 @@ var ScrollListener = class extends abstract.CorePlugin {
1300
1307
  };
1301
1308
  _timeout = new WeakMap();
1302
1309
  var PreventSelection = class extends abstract.Plugin {
1303
- constructor(manager) {
1304
- super(manager);
1310
+ constructor(manager, options) {
1311
+ super(manager, options);
1305
1312
  this.manager = manager;
1306
1313
  this.destroy = state.effect(() => {
1314
+ var _a4;
1307
1315
  const { dragOperation } = this.manager;
1316
+ const { nonce } = (_a4 = this.options) != null ? _a4 : {};
1308
1317
  if (dragOperation.status.initialized) {
1309
1318
  const style = document.createElement("style");
1319
+ if (nonce) {
1320
+ style.setAttribute("nonce", nonce);
1321
+ }
1310
1322
  style.textContent = `* { user-select: none !important; -webkit-user-select: none !important; }`;
1311
1323
  document.head.appendChild(style);
1312
1324
  removeSelection();