@ship-ui/core 0.22.15 → 0.22.17

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.
Files changed (69) hide show
  1. package/assets/mcp/components.json +213 -47
  2. package/bin/src/subset.ts +6 -6
  3. package/bin/src/utilities.ts +14 -14
  4. package/fesm2022/ship-ui-core-ship-a11y-keybindings.mjs +12 -86
  5. package/fesm2022/ship-ui-core-ship-a11y-keybindings.mjs.map +1 -1
  6. package/fesm2022/ship-ui-core-ship-accordion.mjs +4 -3
  7. package/fesm2022/ship-ui-core-ship-accordion.mjs.map +1 -1
  8. package/fesm2022/ship-ui-core-ship-alert.mjs +1 -4
  9. package/fesm2022/ship-ui-core-ship-alert.mjs.map +1 -1
  10. package/fesm2022/ship-ui-core-ship-blueprint.mjs +17 -11
  11. package/fesm2022/ship-ui-core-ship-blueprint.mjs.map +1 -1
  12. package/fesm2022/ship-ui-core-ship-checkbox.mjs +3 -2
  13. package/fesm2022/ship-ui-core-ship-checkbox.mjs.map +1 -1
  14. package/fesm2022/ship-ui-core-ship-color-picker.mjs +66 -62
  15. package/fesm2022/ship-ui-core-ship-color-picker.mjs.map +1 -1
  16. package/fesm2022/ship-ui-core-ship-datepicker.mjs +24 -16
  17. package/fesm2022/ship-ui-core-ship-datepicker.mjs.map +1 -1
  18. package/fesm2022/ship-ui-core-ship-dialog.mjs +4 -0
  19. package/fesm2022/ship-ui-core-ship-dialog.mjs.map +1 -1
  20. package/fesm2022/ship-ui-core-ship-editor.mjs +0 -42
  21. package/fesm2022/ship-ui-core-ship-editor.mjs.map +1 -1
  22. package/fesm2022/ship-ui-core-ship-form-field.mjs +0 -1
  23. package/fesm2022/ship-ui-core-ship-form-field.mjs.map +1 -1
  24. package/fesm2022/ship-ui-core-ship-kbd.mjs +0 -6
  25. package/fesm2022/ship-ui-core-ship-kbd.mjs.map +1 -1
  26. package/fesm2022/ship-ui-core-ship-list-item-swipe.mjs +241 -0
  27. package/fesm2022/ship-ui-core-ship-list-item-swipe.mjs.map +1 -0
  28. package/fesm2022/ship-ui-core-ship-menu.mjs +7 -10
  29. package/fesm2022/ship-ui-core-ship-menu.mjs.map +1 -1
  30. package/fesm2022/ship-ui-core-ship-popover.mjs +5 -20
  31. package/fesm2022/ship-ui-core-ship-popover.mjs.map +1 -1
  32. package/fesm2022/ship-ui-core-ship-radio.mjs +3 -2
  33. package/fesm2022/ship-ui-core-ship-radio.mjs.map +1 -1
  34. package/fesm2022/ship-ui-core-ship-range-slider.mjs +7 -9
  35. package/fesm2022/ship-ui-core-ship-range-slider.mjs.map +1 -1
  36. package/fesm2022/ship-ui-core-ship-select.mjs.map +1 -1
  37. package/fesm2022/ship-ui-core-ship-sidenav.mjs +2 -2
  38. package/fesm2022/ship-ui-core-ship-sidenav.mjs.map +1 -1
  39. package/fesm2022/ship-ui-core-ship-sortable.mjs +262 -68
  40. package/fesm2022/ship-ui-core-ship-sortable.mjs.map +1 -1
  41. package/fesm2022/ship-ui-core-ship-spotlight.mjs +0 -11
  42. package/fesm2022/ship-ui-core-ship-spotlight.mjs.map +1 -1
  43. package/fesm2022/ship-ui-core-ship-stepper.mjs +1 -1
  44. package/fesm2022/ship-ui-core-ship-stepper.mjs.map +1 -1
  45. package/fesm2022/ship-ui-core-ship-table.mjs +426 -23
  46. package/fesm2022/ship-ui-core-ship-table.mjs.map +1 -1
  47. package/fesm2022/ship-ui-core-ship-toggle.mjs +3 -2
  48. package/fesm2022/ship-ui-core-ship-toggle.mjs.map +1 -1
  49. package/fesm2022/ship-ui-core-ship-tree.mjs +1 -9
  50. package/fesm2022/ship-ui-core-ship-tree.mjs.map +1 -1
  51. package/fesm2022/ship-ui-core.mjs +37 -53
  52. package/fesm2022/ship-ui-core.mjs.map +1 -1
  53. package/package.json +5 -1
  54. package/types/ship-ui-core-ship-a11y-keybindings.d.ts +0 -55
  55. package/types/ship-ui-core-ship-accordion.d.ts +7 -7
  56. package/types/ship-ui-core-ship-blueprint.d.ts +2 -1
  57. package/types/ship-ui-core-ship-checkbox.d.ts +2 -3
  58. package/types/ship-ui-core-ship-color-picker.d.ts +1 -25
  59. package/types/ship-ui-core-ship-datepicker.d.ts +2 -3
  60. package/types/ship-ui-core-ship-editor.d.ts +10 -10
  61. package/types/ship-ui-core-ship-list-item-swipe.d.ts +25 -0
  62. package/types/ship-ui-core-ship-menu.d.ts +1 -2
  63. package/types/ship-ui-core-ship-radio.d.ts +2 -3
  64. package/types/ship-ui-core-ship-range-slider.d.ts +6 -6
  65. package/types/ship-ui-core-ship-sortable.d.ts +31 -9
  66. package/types/ship-ui-core-ship-table.d.ts +12 -1
  67. package/types/ship-ui-core-ship-toggle.d.ts +2 -3
  68. package/types/ship-ui-core-ship-tree.d.ts +20 -25
  69. package/types/ship-ui-core.d.ts +17 -24
@@ -82,7 +82,7 @@ class ShipColorPicker {
82
82
  }
83
83
  else {
84
84
  if (this._prevColorStr !== str) {
85
- this.updateMarkerFromColor(selectedColor);
85
+ this.#updateMarkerFromColor(selectedColor);
86
86
  this._prevColorStr = str;
87
87
  }
88
88
  else {
@@ -102,55 +102,55 @@ class ShipColorPicker {
102
102
  });
103
103
  }, /* @ts-ignore */
104
104
  ...(ngDevMode ? [{ debugName: "selectedColorEffect" }] : /* istanbul ignore next */ []));
105
- this.alphaColorRedrawEffect = effect(() => {
105
+ this.#alphaColorRedrawEffect = effect(() => {
106
106
  const color = this.selectedColor();
107
107
  if (this.renderingType() === 'alpha' && this.#canvasData()) {
108
- untracked(() => this.drawAlpha());
108
+ untracked(() => this.#drawAlpha());
109
109
  }
110
110
  }, /* @ts-ignore */
111
- ...(ngDevMode ? [{ debugName: "alphaColorRedrawEffect" }] : /* istanbul ignore next */ []));
112
- this.previousLayoutHash = '';
113
- this.previousHue = null;
114
- this.renderingTypeEffect = effect(() => {
111
+ ...(ngDevMode ? [{ debugName: "#alphaColorRedrawEffect" }] : /* istanbul ignore next */ []));
112
+ this.#previousLayoutHash = '';
113
+ this.#previousHue = null;
114
+ this.#renderingTypeEffect = effect(() => {
115
115
  const currentHue = this.hue();
116
- const layoutHash = this.getLayoutHash();
116
+ const layoutHash = this.#getLayoutHash();
117
117
  const canvasData = untracked(() => this.#canvasData());
118
118
  if (canvasData) {
119
- untracked(() => this.drawColorPicker());
120
- if (this.previousLayoutHash !== layoutHash) {
119
+ untracked(() => this.#drawColorPicker());
120
+ if (this.#previousLayoutHash !== layoutHash) {
121
121
  if (this.renderingType() === 'hsl') {
122
- this.adjustMarkerPosition();
123
- queueMicrotask(() => this.updateMarkerFromColor(untracked(() => this.selectedColor())));
122
+ this.#adjustMarkerPosition();
123
+ queueMicrotask(() => this.#updateMarkerFromColor(untracked(() => this.selectedColor())));
124
124
  }
125
125
  else {
126
- this.updateMarkerFromColor(untracked(() => this.selectedColor()));
126
+ this.#updateMarkerFromColor(untracked(() => this.selectedColor()));
127
127
  }
128
- this.previousLayoutHash = layoutHash;
129
- this.previousHue = currentHue;
128
+ this.#previousLayoutHash = layoutHash;
129
+ this.#previousHue = currentHue;
130
130
  }
131
- else if (this.previousHue !== currentHue) {
131
+ else if (this.#previousHue !== currentHue) {
132
132
  const pos = untracked(() => this.markerPosition());
133
133
  const { canvas, ctx } = canvasData;
134
134
  let x = (parseFloat(pos.x.replace('%', '')) / 100) * Math.max(1, canvas.width - 1);
135
135
  let y = (parseFloat(pos.y.replace('%', '')) / 100) * Math.max(1, canvas.height - 1);
136
136
  x = Math.max(0, Math.min(canvas.width - 1, Math.round(x)));
137
137
  y = Math.max(0, Math.min(canvas.height - 1, Math.round(y)));
138
- const color = untracked(() => this.getColorAtPosition(x, y));
138
+ const color = untracked(() => this.#getColorAtPosition(x, y));
139
139
  if (this.renderingType() !== 'alpha') {
140
140
  color[3] = untracked(() => this.selectedColor()[3] ?? 1);
141
141
  }
142
142
  this.#skipMarkerUpdate = true;
143
143
  this.selectedColor.set(color);
144
- this.previousHue = currentHue;
144
+ this.#previousHue = currentHue;
145
145
  }
146
146
  }
147
147
  }, /* @ts-ignore */
148
- ...(ngDevMode ? [{ debugName: "renderingTypeEffect" }] : /* istanbul ignore next */ []));
148
+ ...(ngDevMode ? [{ debugName: "#renderingTypeEffect" }] : /* istanbul ignore next */ []));
149
149
  this.#resizeObserver = typeof ResizeObserver !== 'undefined'
150
150
  ? new ResizeObserver((entries) => {
151
151
  for (const entry of entries) {
152
152
  if (entry.contentRect.width > 0 && entry.contentRect.height > 0) {
153
- this.setCanvasSize();
153
+ this.#setCanvasSize();
154
154
  }
155
155
  }
156
156
  })
@@ -161,12 +161,16 @@ class ShipColorPicker {
161
161
  #platformId;
162
162
  #canvasData;
163
163
  #skipMarkerUpdate;
164
+ #alphaColorRedrawEffect;
164
165
  onResize() {
165
- this.setCanvasSize();
166
+ this.#setCanvasSize();
166
167
  }
167
- getLayoutHash() {
168
+ #previousLayoutHash;
169
+ #previousHue;
170
+ #getLayoutHash() {
168
171
  return `${this.renderingType()}-${this.direction()}-${this.gridSize()}-${this.showDarkColors()}`;
169
172
  }
173
+ #renderingTypeEffect;
170
174
  #resizeObserver;
171
175
  ngAfterViewInit() {
172
176
  this.initColor = this.selectedColor();
@@ -174,15 +178,15 @@ class ShipColorPicker {
174
178
  if (canvas?.parentElement) {
175
179
  this.#resizeObserver?.observe(canvas.parentElement);
176
180
  }
177
- this.setCanvasSize();
178
- this.initCanvasEvents();
181
+ this.#setCanvasSize();
182
+ this.#initCanvasEvents();
179
183
  }
180
184
  ngOnDestroy() {
181
185
  this.#resizeObserver?.disconnect();
182
186
  }
183
- updateMarkerFromColor(rgba) {
187
+ #updateMarkerFromColor(rgba) {
184
188
  const [r, g, b, a] = rgba;
185
- const coords = this.findPositionByColor(r, g, b, a);
189
+ const coords = this.#findPositionByColor(r, g, b, a);
186
190
  if (coords === null)
187
191
  return;
188
192
  const { x, y } = coords;
@@ -193,9 +197,9 @@ class ShipColorPicker {
193
197
  clientY: y,
194
198
  touches: [{ clientX: x, clientY: y }],
195
199
  };
196
- this.updateColorAndMarker(mockEvent, false, true);
200
+ this.#updateColorAndMarker(mockEvent, false, true);
197
201
  }
198
- findPositionByColor(r, g, b, a) {
202
+ #findPositionByColor(r, g, b, a) {
199
203
  const canvasData = this.#canvasData();
200
204
  if (!canvasData || !canvasData.canvas)
201
205
  return null;
@@ -268,7 +272,7 @@ class ShipColorPicker {
268
272
  }
269
273
  return { x: bestMatch.x, y: bestMatch.y };
270
274
  }
271
- adjustMarkerPosition() {
275
+ #adjustMarkerPosition() {
272
276
  const { canvas, centerX, centerY, radius } = this.#canvasData();
273
277
  let { x, y } = this._pos;
274
278
  let markerX = (parseFloat(x.replace('%', '')) / 100) * canvas.width;
@@ -283,19 +287,19 @@ class ShipColorPicker {
283
287
  this.markerPosition.set({ x, y });
284
288
  }
285
289
  }
286
- initCanvasEvents() {
290
+ #initCanvasEvents() {
287
291
  const data = this.#canvasData();
288
292
  if (!data)
289
293
  return;
290
294
  const { canvas } = data;
291
295
  canvas.addEventListener('mousedown', (event) => {
292
296
  this.isDragging.set(true);
293
- this.updateColorAndMarker(event);
297
+ this.#updateColorAndMarker(event);
294
298
  });
295
299
  this.#document.addEventListener('mousemove', (event) => {
296
300
  if (this.isDragging()) {
297
301
  event.preventDefault();
298
- this.updateColorAndMarker(event, true);
302
+ this.#updateColorAndMarker(event, true);
299
303
  }
300
304
  });
301
305
  this.#document.addEventListener('mouseup', () => this.isDragging.set(false));
@@ -303,13 +307,13 @@ class ShipColorPicker {
303
307
  this.#document.addEventListener('touchmove', (event) => {
304
308
  if (this.isDragging()) {
305
309
  event.preventDefault();
306
- this.updateColorAndMarker(event.touches[0], true);
310
+ this.#updateColorAndMarker(event.touches[0], true);
307
311
  }
308
312
  });
309
313
  this.#document.addEventListener('touchend', () => this.isDragging.set(false));
310
314
  this.#document.addEventListener('touchcancel', () => this.isDragging.set(false));
311
315
  }
312
- setCanvasSize() {
316
+ #setCanvasSize() {
313
317
  if (!isPlatformBrowser(this.#platformId))
314
318
  return;
315
319
  const canvas = this.canvasRef()?.nativeElement;
@@ -329,15 +333,15 @@ class ShipColorPicker {
329
333
  centerY: canvas.height / 2,
330
334
  radius: Math.min(canvas.width, canvas.height) / 2,
331
335
  });
332
- this.drawColorPicker();
336
+ this.#drawColorPicker();
333
337
  setTimeout(() => {
334
338
  if (!this.isDragging()) {
335
- this.updateMarkerFromColor(untracked(() => this.selectedColor()));
339
+ this.#updateMarkerFromColor(untracked(() => this.selectedColor()));
336
340
  }
337
341
  });
338
342
  }
339
343
  }
340
- getColorAtPosition(mouseX, mouseY) {
344
+ #getColorAtPosition(mouseX, mouseY) {
341
345
  const { canvas, ctx } = this.#canvasData();
342
346
  const w = Math.max(1, canvas.width - 1);
343
347
  const h = Math.max(1, canvas.height - 1);
@@ -364,7 +368,7 @@ class ShipColorPicker {
364
368
  return [pixelData[0], pixelData[1], pixelData[2]];
365
369
  }
366
370
  }
367
- updateColorAndMarker(event, outsideCanvas = false, onlyMarker = false) {
371
+ #updateColorAndMarker(event, outsideCanvas = false, onlyMarker = false) {
368
372
  const { canvas, ctx } = this.#canvasData();
369
373
  let mouseX = event instanceof MouseEvent ? event.offsetX : event.clientX;
370
374
  let mouseY = event instanceof MouseEvent ? event.offsetY : event.clientY;
@@ -387,7 +391,7 @@ class ShipColorPicker {
387
391
  mouseX = Math.max(0, Math.min(canvas.width - 1, Math.round(mouseX)));
388
392
  mouseY = Math.max(0, Math.min(canvas.height - 1, Math.round(mouseY)));
389
393
  if (!onlyMarker) {
390
- const newColor = this.getColorAtPosition(mouseX, mouseY);
394
+ const newColor = this.#getColorAtPosition(mouseX, mouseY);
391
395
  if (this.renderingType() !== 'alpha') {
392
396
  newColor[3] = this.selectedColor()[3] ?? 1;
393
397
  }
@@ -398,29 +402,29 @@ class ShipColorPicker {
398
402
  const yPercent = ((mouseY / Math.max(1, canvas.height - 1)) * 100).toFixed(2) + '%';
399
403
  this.markerPosition.set({ x: xPercent, y: yPercent });
400
404
  }
401
- drawColorPicker() {
405
+ #drawColorPicker() {
402
406
  switch (this.renderingType()) {
403
407
  case 'hsl':
404
- this.drawColorWheel();
408
+ this.#drawColorWheel();
405
409
  break;
406
410
  case 'grid':
407
- this.drawGrid();
411
+ this.#drawGrid();
408
412
  break;
409
413
  case 'hue':
410
- this.drawHue();
414
+ this.#drawHue();
411
415
  break;
412
416
  case 'alpha':
413
- this.drawAlpha();
417
+ this.#drawAlpha();
414
418
  break;
415
419
  case 'rgb':
416
- this.drawRgb();
420
+ this.#drawRgb();
417
421
  break;
418
422
  case 'saturation':
419
- this.drawSaturation();
423
+ this.#drawSaturation();
420
424
  break;
421
425
  }
422
426
  }
423
- drawAlpha() {
427
+ #drawAlpha() {
424
428
  const { canvas, ctx } = this.#canvasData();
425
429
  ctx.clearRect(0, 0, canvas.width, canvas.height);
426
430
  const w = Math.max(1, canvas.width - 1);
@@ -432,7 +436,7 @@ class ShipColorPicker {
432
436
  ctx.fillStyle = gradient;
433
437
  ctx.fillRect(0, 0, canvas.width, canvas.height);
434
438
  }
435
- drawRgb() {
439
+ #drawRgb() {
436
440
  const { canvas, ctx } = this.#canvasData();
437
441
  ctx.clearRect(0, 0, canvas.width, canvas.height);
438
442
  const w = Math.max(1, canvas.width - 1);
@@ -448,7 +452,7 @@ class ShipColorPicker {
448
452
  ctx.fillStyle = gradient2;
449
453
  ctx.fillRect(0, 0, canvas.width, canvas.height);
450
454
  }
451
- drawSaturation() {
455
+ #drawSaturation() {
452
456
  const { canvas, ctx } = this.#canvasData();
453
457
  ctx.clearRect(0, 0, canvas.width, canvas.height);
454
458
  const w = Math.max(1, canvas.width - 1);
@@ -468,7 +472,7 @@ class ShipColorPicker {
468
472
  ctx.fillRect(0, 0, canvas.width, canvas.height);
469
473
  }
470
474
  }
471
- drawHue() {
475
+ #drawHue() {
472
476
  const { canvas, ctx } = this.#canvasData();
473
477
  ctx.clearRect(0, 0, canvas.width, canvas.height);
474
478
  const w = Math.max(1, canvas.width - 1);
@@ -480,7 +484,7 @@ class ShipColorPicker {
480
484
  ctx.fillStyle = gradient;
481
485
  ctx.fillRect(0, 0, canvas.width, canvas.height);
482
486
  }
483
- drawColorWheel() {
487
+ #drawColorWheel() {
484
488
  const { canvas, ctx, centerX, centerY, radius } = this.#canvasData();
485
489
  ctx.clearRect(0, 0, canvas.width, canvas.height);
486
490
  for (let y = 0; y < canvas.height; y++) {
@@ -495,7 +499,7 @@ class ShipColorPicker {
495
499
  }
496
500
  }
497
501
  }
498
- drawGrid() {
502
+ #drawGrid() {
499
503
  const { canvas, ctx } = this.#canvasData();
500
504
  ctx.clearRect(0, 0, canvas.width, canvas.height);
501
505
  const gridSize = this.gridSize();
@@ -629,11 +633,11 @@ class ShipColorPickerInput {
629
633
  return;
630
634
  this.#createCustomInputEventListener(input);
631
635
  input.addEventListener('inputValueChanged', (event) => {
632
- this.parseAndSetColor(event.detail.value);
636
+ this.#parseAndSetColor(event.detail.value);
633
637
  });
634
638
  input.addEventListener('input', (event) => {
635
639
  const target = event.target;
636
- this.parseAndSetColor(target.value);
640
+ this.#parseAndSetColor(target.value);
637
641
  });
638
642
  input.addEventListener('blur', () => {
639
643
  const str = untracked(() => this.formattedColorString());
@@ -648,7 +652,7 @@ class ShipColorPickerInput {
648
652
  this.#inputRef.set(input);
649
653
  input.autocomplete = 'off';
650
654
  if (typeof input.value === 'string' && input.value) {
651
- this.parseAndSetColor(input.value);
655
+ this.#parseAndSetColor(input.value);
652
656
  }
653
657
  }, /* @ts-ignore */
654
658
  ...(ngDevMode ? [{ debugName: "#inputRefEffect" }] : /* istanbul ignore next */ []));
@@ -677,7 +681,7 @@ class ShipColorPickerInput {
677
681
  const eyeDropper = new window.EyeDropper();
678
682
  const result = await eyeDropper.open();
679
683
  if (result && result.sRGBHex) {
680
- this.parseAndSetColor(result.sRGBHex);
684
+ this.#parseAndSetColor(result.sRGBHex);
681
685
  // Force the text field to immediately display the new output string according to the active format
682
686
  const input = untracked(() => this.#inputRef());
683
687
  if (input) {
@@ -697,7 +701,7 @@ class ShipColorPickerInput {
697
701
  this.closed.emit(this.formattedColorString());
698
702
  }
699
703
  #inputRefEffect;
700
- parseAndSetColor(colorStr) {
704
+ #parseAndSetColor(colorStr) {
701
705
  if (!colorStr)
702
706
  return;
703
707
  if (colorStr === untracked(() => this.formattedColorString()))
@@ -742,7 +746,7 @@ class ShipColorPickerInput {
742
746
  }
743
747
  }
744
748
  }
745
- hslToRgbExact(h, s, l) {
749
+ #hslToRgbExact(h, s, l) {
746
750
  s /= 100;
747
751
  l /= 100;
748
752
  const k = (n) => (n + h / 30) % 12;
@@ -750,16 +754,16 @@ class ShipColorPickerInput {
750
754
  const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
751
755
  return [Math.round(255 * f(0)), Math.round(255 * f(8)), Math.round(255 * f(4))];
752
756
  }
753
- rgbToHex(r, g, b) {
757
+ #rgbToHex(r, g, b) {
754
758
  return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
755
759
  }
756
- rgbaToHex8(r, g, b, a) {
760
+ #rgbaToHex8(r, g, b, a) {
757
761
  const alphaHex = Math.round(a * 255)
758
762
  .toString(16)
759
763
  .padStart(2, '0');
760
- return this.rgbToHex(r, g, b) + alphaHex;
764
+ return this.#rgbToHex(r, g, b) + alphaHex;
761
765
  }
762
- rgbToHsl(r, g, b) {
766
+ #rgbToHsl(r, g, b) {
763
767
  r /= 255;
764
768
  g /= 255;
765
769
  b /= 255;