@ni/spright-components 0.0.9 → 0.0.11

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.
@@ -16333,7 +16333,7 @@
16333
16333
 
16334
16334
  /**
16335
16335
  * Do not edit directly
16336
- * Generated on Tue, 30 Apr 2024 22:12:02 GMT
16336
+ * Generated on Wed, 01 May 2024 20:20:19 GMT
16337
16337
  */
16338
16338
 
16339
16339
  const Information100DarkUi = "#a46eff";
@@ -16499,6 +16499,7 @@
16499
16499
  modalBackdropColor: 'modal-backdrop-color',
16500
16500
  popupBorderColor: 'popup-border-color',
16501
16501
  cardBorderColor: 'card-border-color',
16502
+ tagFillColor: 'tag-fill-color',
16502
16503
  controlHeight: 'control-height',
16503
16504
  controlSlimHeight: 'control-slim-height',
16504
16505
  smallPadding: 'small-padding',
@@ -16901,6 +16902,7 @@
16901
16902
  DesignToken.create(styleNameFromTokenName(tokenNames.graphGridlineColor)).withDefault((element) => hexToRgbaCssColor(getColorForTheme(element, Black91, Black15, White), 0.2));
16902
16903
  DesignToken.create(styleNameFromTokenName(tokenNames.tooltipBackgroundColor)).withDefault((element) => getColorForTheme(element, Black15, Black85, ForestGreen));
16903
16904
  const tableRowBorderColor = DesignToken.create(styleNameFromTokenName(tokenNames.tableRowBorderColor)).withDefault((element) => getColorForTheme(element, Black15, Black80, ForestGreen));
16905
+ DesignToken.create(styleNameFromTokenName(tokenNames.tagFillColor)).withDefault((element) => hexToRgbaCssColor(getColorForTheme(element, Black91, Black15, White), 0.1));
16904
16906
  const buttonFillPrimaryColor = DesignToken.create(styleNameFromTokenName(tokenNames.buttonFillPrimaryColor)).withDefault((element) => getColorForTheme(element, hexToRgbaCssColor(Black91, 0.75), hexToRgbaCssColor(Black15, 0.3), hexToRgbaCssColor(White, 0.3)));
16905
16907
  const buttonPrimaryFontColor = DesignToken.create(styleNameFromTokenName(tokenNames.buttonPrimaryFontColor)).withDefault((element) => getColorForTheme(element, Black15, Black15, White));
16906
16908
  const buttonFillAccentColor = DesignToken.create(styleNameFromTokenName(tokenNames.buttonFillAccentColor)).withDefault((element) => getColorForTheme(element, DigitalGreenDark, DigitalGreenLight, hexToRgbaCssColor(White, 0.1)));
@@ -26706,8 +26708,6 @@
26706
26708
  function insertInto(content, dist, insert, parent) {
26707
26709
  let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);
26708
26710
  if (offset == dist || child.isText) {
26709
- if (parent && !parent.canReplace(index, index, insert))
26710
- return null;
26711
26711
  return content.cut(0, dist).append(insert).append(content.cut(dist));
26712
26712
  }
26713
26713
  let inner = insertInto(child.content, dist - offset - 1, insert);
@@ -35251,7 +35251,7 @@
35251
35251
  firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
35252
35252
  let text = view.someProp("clipboardTextSerializer", f => f(slice, view)) ||
35253
35253
  slice.content.textBetween(0, slice.content.size, "\n\n");
35254
- return { dom: wrap, text };
35254
+ return { dom: wrap, text, slice };
35255
35255
  }
35256
35256
  // Read a slice of content from the clipboard (or drop data).
35257
35257
  function parseFromClipboard(view, text, html, plainText, $context) {
@@ -35636,8 +35636,7 @@
35636
35636
  if (!view.focused)
35637
35637
  view.focus();
35638
35638
  let tr = view.state.tr.setSelection(selection);
35639
- if (origin == "pointer")
35640
- tr.setMeta("pointer", true);
35639
+ tr.setMeta("pointer", true);
35641
35640
  view.dispatch(tr);
35642
35641
  }
35643
35642
  function selectClickedLeaf(view, inside) {
@@ -35645,7 +35644,7 @@
35645
35644
  return false;
35646
35645
  let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
35647
35646
  if (node && node.isAtom && NodeSelection.isSelectable(node)) {
35648
- updateSelection(view, new NodeSelection($pos), "pointer");
35647
+ updateSelection(view, new NodeSelection($pos));
35649
35648
  return true;
35650
35649
  }
35651
35650
  return false;
@@ -35669,7 +35668,7 @@
35669
35668
  }
35670
35669
  }
35671
35670
  if (selectAt != null) {
35672
- updateSelection(view, NodeSelection.create(view.state.doc, selectAt), "pointer");
35671
+ updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
35673
35672
  return true;
35674
35673
  }
35675
35674
  else {
@@ -35696,7 +35695,7 @@
35696
35695
  let doc = view.state.doc;
35697
35696
  if (inside == -1) {
35698
35697
  if (doc.inlineContent) {
35699
- updateSelection(view, TextSelection.create(doc, 0, doc.content.size), "pointer");
35698
+ updateSelection(view, TextSelection.create(doc, 0, doc.content.size));
35700
35699
  return true;
35701
35700
  }
35702
35701
  return false;
@@ -35706,9 +35705,9 @@
35706
35705
  let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
35707
35706
  let nodePos = $pos.before(i);
35708
35707
  if (node.inlineContent)
35709
- updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size), "pointer");
35708
+ updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size));
35710
35709
  else if (NodeSelection.isSelectable(node))
35711
- updateSelection(view, NodeSelection.create(doc, nodePos), "pointer");
35710
+ updateSelection(view, NodeSelection.create(doc, nodePos));
35712
35711
  else
35713
35712
  continue;
35714
35713
  return true;
@@ -35836,7 +35835,7 @@
35836
35835
  // works around that.
35837
35836
  (chrome && !this.view.state.selection.visible &&
35838
35837
  Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2))) {
35839
- updateSelection(this.view, Selection$2.near(this.view.state.doc.resolve(pos.pos)), "pointer");
35838
+ updateSelection(this.view, Selection$2.near(this.view.state.doc.resolve(pos.pos)));
35840
35839
  event.preventDefault();
35841
35840
  }
35842
35841
  else {
@@ -35966,7 +35965,7 @@
35966
35965
  return textAfter;
35967
35966
  }
35968
35967
  }
35969
- return textBefore;
35968
+ return textBefore || textAfter;
35970
35969
  }
35971
35970
  function timestampFromCustomEvent() {
35972
35971
  let event = document.createEvent("Event");
@@ -36123,7 +36122,8 @@
36123
36122
  if (desc && desc.node.type.spec.draggable && desc != view.docView)
36124
36123
  node = NodeSelection.create(view.state.doc, desc.posBefore);
36125
36124
  }
36126
- let slice = (node || view.state.selection).content(), { dom, text } = serializeForClipboard(view, slice);
36125
+ let draggedSlice = (node || view.state.selection).content();
36126
+ let { dom, text, slice } = serializeForClipboard(view, draggedSlice);
36127
36127
  event.dataTransfer.clearData();
36128
36128
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
36129
36129
  // See https://github.com/ProseMirror/prosemirror/issues/1156
@@ -42582,7 +42582,7 @@ img.ProseMirror-separator {
42582
42582
  }`;
42583
42583
 
42584
42584
  function createStyleTag(style, nonce, suffix) {
42585
- const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ''}]`);
42585
+ const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${''}]`);
42586
42586
  if (tiptapStyleTag !== null) {
42587
42587
  return tiptapStyleTag;
42588
42588
  }
@@ -42590,7 +42590,7 @@ img.ProseMirror-separator {
42590
42590
  if (nonce) {
42591
42591
  styleNode.setAttribute('nonce', nonce);
42592
42592
  }
42593
- styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ''}`, '');
42593
+ styleNode.setAttribute(`data-tiptap-style${''}`, '');
42594
42594
  styleNode.innerHTML = style;
42595
42595
  document.getElementsByTagName('head')[0].appendChild(styleNode);
42596
42596
  return styleNode;
@@ -60672,7 +60672,7 @@ img.ProseMirror-separator {
60672
60672
  var _row$getValue;
60673
60673
  return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
60674
60674
  },
60675
- subRows: subRows != null ? subRows : [],
60675
+ subRows: [],
60676
60676
  getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
60677
60677
  getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined,
60678
60678
  getParentRows: () => {
@@ -65186,12 +65186,19 @@ img.ProseMirror-separator {
65186
65186
  }
65187
65187
  function notUndefined(value, msg) {
65188
65188
  if (value === void 0) {
65189
- throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
65189
+ throw new Error(`Unexpected undefined${""}`);
65190
65190
  } else {
65191
65191
  return value;
65192
65192
  }
65193
65193
  }
65194
65194
  const approxEqual = (a, b) => Math.abs(a - b) < 1;
65195
+ const debounce = (fn, ms) => {
65196
+ let timeoutId;
65197
+ return function(...args) {
65198
+ clearTimeout(timeoutId);
65199
+ timeoutId = setTimeout(() => fn.apply(this, args), ms);
65200
+ };
65201
+ };
65195
65202
 
65196
65203
  const defaultKeyExtractor = (index) => index;
65197
65204
  const defaultRangeExtractor = (range) => {
@@ -65233,20 +65240,32 @@ img.ProseMirror-separator {
65233
65240
  observer.unobserve(element);
65234
65241
  };
65235
65242
  };
65243
+ const addEventListenerOptions = {
65244
+ passive: true
65245
+ };
65246
+ const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
65236
65247
  const observeElementOffset = (instance, cb) => {
65237
65248
  const element = instance.scrollElement;
65238
65249
  if (!element) {
65239
65250
  return;
65240
65251
  }
65241
- const handler = () => {
65242
- cb(element[instance.options.horizontal ? "scrollLeft" : "scrollTop"]);
65252
+ let offset = 0;
65253
+ const fallback = supportsScrollend ? () => void 0 : debounce(() => {
65254
+ cb(offset, false);
65255
+ }, instance.options.isScrollingResetDelay);
65256
+ const createHandler = (isScrolling) => () => {
65257
+ offset = element[instance.options.horizontal ? "scrollLeft" : "scrollTop"];
65258
+ fallback();
65259
+ cb(offset, isScrolling);
65243
65260
  };
65244
- handler();
65245
- element.addEventListener("scroll", handler, {
65246
- passive: true
65247
- });
65261
+ const handler = createHandler(true);
65262
+ const endHandler = createHandler(false);
65263
+ endHandler();
65264
+ element.addEventListener("scroll", handler, addEventListenerOptions);
65265
+ element.addEventListener("scrollend", endHandler, addEventListenerOptions);
65248
65266
  return () => {
65249
65267
  element.removeEventListener("scroll", handler);
65268
+ element.removeEventListener("scrollend", endHandler);
65250
65269
  };
65251
65270
  };
65252
65271
  const measureElement = (element, entry, instance) => {
@@ -65279,7 +65298,6 @@ img.ProseMirror-separator {
65279
65298
  this.unsubs = [];
65280
65299
  this.scrollElement = null;
65281
65300
  this.isScrolling = false;
65282
- this.isScrollingTimeoutId = null;
65283
65301
  this.scrollToIndexTimeoutId = null;
65284
65302
  this.measurementsCache = [];
65285
65303
  this.itemSizeCache = /* @__PURE__ */ new Map();
@@ -65340,39 +65358,24 @@ img.ProseMirror-separator {
65340
65358
  initialRect: { width: 0, height: 0 },
65341
65359
  scrollMargin: 0,
65342
65360
  gap: 0,
65343
- scrollingDelay: 150,
65344
65361
  indexAttribute: "data-index",
65345
65362
  initialMeasurementsCache: [],
65346
65363
  lanes: 1,
65364
+ isScrollingResetDelay: 150,
65347
65365
  ...opts2
65348
65366
  };
65349
65367
  };
65350
- this.notify = (sync) => {
65368
+ this.notify = (force, sync) => {
65351
65369
  var _a, _b;
65352
- (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
65353
- };
65354
- this.maybeNotify = memo(
65355
- () => {
65356
- this.calculateRange();
65357
- return [
65358
- this.isScrolling,
65359
- this.range ? this.range.startIndex : null,
65360
- this.range ? this.range.endIndex : null
65361
- ];
65362
- },
65363
- (isScrolling) => {
65364
- this.notify(isScrolling);
65365
- },
65366
- {
65367
- key: "maybeNotify",
65368
- debug: () => this.options.debug,
65369
- initialDeps: [
65370
- this.isScrolling,
65371
- this.range ? this.range.startIndex : null,
65372
- this.range ? this.range.endIndex : null
65373
- ]
65370
+ const { startIndex, endIndex } = this.range ?? {
65371
+ startIndex: void 0,
65372
+ endIndex: void 0
65373
+ };
65374
+ const range = this.calculateRange();
65375
+ if (force || startIndex !== (range == null ? void 0 : range.startIndex) || endIndex !== (range == null ? void 0 : range.endIndex)) {
65376
+ (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
65374
65377
  }
65375
- );
65378
+ };
65376
65379
  this.cleanup = () => {
65377
65380
  this.unsubs.filter(Boolean).forEach((d) => d());
65378
65381
  this.unsubs = [];
@@ -65397,29 +65400,17 @@ img.ProseMirror-separator {
65397
65400
  this.unsubs.push(
65398
65401
  this.options.observeElementRect(this, (rect) => {
65399
65402
  this.scrollRect = rect;
65400
- this.maybeNotify();
65403
+ this.notify(false, false);
65401
65404
  })
65402
65405
  );
65403
65406
  this.unsubs.push(
65404
- this.options.observeElementOffset(this, (offset) => {
65407
+ this.options.observeElementOffset(this, (offset, isScrolling) => {
65405
65408
  this.scrollAdjustments = 0;
65406
- if (this.scrollOffset === offset) {
65407
- return;
65408
- }
65409
- if (this.isScrollingTimeoutId !== null) {
65410
- clearTimeout(this.isScrollingTimeoutId);
65411
- this.isScrollingTimeoutId = null;
65412
- }
65413
- this.isScrolling = true;
65414
- this.scrollDirection = this.scrollOffset < offset ? "forward" : "backward";
65409
+ this.scrollDirection = isScrolling ? this.scrollOffset < offset ? "forward" : "backward" : null;
65415
65410
  this.scrollOffset = offset;
65416
- this.maybeNotify();
65417
- this.isScrollingTimeoutId = setTimeout(() => {
65418
- this.isScrollingTimeoutId = null;
65419
- this.isScrolling = false;
65420
- this.scrollDirection = null;
65421
- this.maybeNotify();
65422
- }, this.options.scrollingDelay);
65411
+ const prevIsScrolling = this.isScrolling;
65412
+ this.isScrolling = isScrolling;
65413
+ this.notify(prevIsScrolling !== isScrolling, isScrolling);
65423
65414
  })
65424
65415
  );
65425
65416
  }
@@ -65427,7 +65418,7 @@ img.ProseMirror-separator {
65427
65418
  this.getSize = () => {
65428
65419
  return this.scrollRect[this.options.horizontal ? "width" : "height"];
65429
65420
  };
65430
- this.memoOptions = memo(
65421
+ this.getMeasurementOptions = memo(
65431
65422
  () => [
65432
65423
  this.options.count,
65433
65424
  this.options.paddingStart,
@@ -65475,7 +65466,7 @@ img.ProseMirror-separator {
65475
65466
  })[0] : void 0;
65476
65467
  };
65477
65468
  this.getMeasurements = memo(
65478
- () => [this.memoOptions(), this.itemSizeCache],
65469
+ () => [this.getMeasurementOptions(), this.itemSizeCache],
65479
65470
  ({ count, paddingStart, scrollMargin, getItemKey }, itemSizeCache) => {
65480
65471
  const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
65481
65472
  this.pendingMeasuredCacheIndexes = [];
@@ -65528,7 +65519,8 @@ img.ProseMirror-separator {
65528
65519
  ],
65529
65520
  (rangeExtractor, range, overscan, count) => {
65530
65521
  return range === null ? [] : rangeExtractor({
65531
- ...range,
65522
+ startIndex: range.startIndex,
65523
+ endIndex: range.endIndex,
65532
65524
  overscan,
65533
65525
  count
65534
65526
  });
@@ -65586,7 +65578,7 @@ img.ProseMirror-separator {
65586
65578
  }
65587
65579
  this.pendingMeasuredCacheIndexes.push(item.index);
65588
65580
  this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
65589
- this.notify(false);
65581
+ this.notify(true, false);
65590
65582
  }
65591
65583
  };
65592
65584
  this.measureElement = (node) => {
@@ -65738,8 +65730,9 @@ img.ProseMirror-separator {
65738
65730
  this.options.scrollToFn(offset, { behavior, adjustments }, this);
65739
65731
  };
65740
65732
  this.measure = () => {
65733
+ var _a, _b;
65741
65734
  this.itemSizeCache = /* @__PURE__ */ new Map();
65742
- this.notify(false);
65735
+ (_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, false);
65743
65736
  };
65744
65737
  this.setOptions(opts);
65745
65738
  this.scrollRect = this.options.initialRect;
@@ -65748,7 +65741,7 @@ img.ProseMirror-separator {
65748
65741
  this.measurementsCache.forEach((item) => {
65749
65742
  this.itemSizeCache.set(item.key, item.size);
65750
65743
  });
65751
- this.maybeNotify();
65744
+ this.notify(false, false);
65752
65745
  }
65753
65746
  };
65754
65747
  const findNearestBinarySearch = (low, high, getCurrentValue, value) => {