@melodicdev/components 1.6.0 → 1.6.2

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 (71) hide show
  1. package/assets/melodic-components.js +133 -50
  2. package/assets/melodic-components.js.map +1 -1
  3. package/assets/melodic-components.min.js +1206 -1134
  4. package/lib/components/data-display/table/table.styles.d.ts.map +1 -1
  5. package/lib/components/data-display/table/table.styles.js +32 -11
  6. package/lib/components/data-display/table/table.template.d.ts.map +1 -1
  7. package/lib/components/data-display/table/table.template.js +7 -2
  8. package/package.json +1 -1
  9. package/lib/bundle.d.ts +0 -59
  10. package/lib/bundle.d.ts.map +0 -1
  11. package/lib/bundle.js +0 -68
  12. package/lib/components/data-display/empty-state/index.d.ts +0 -2
  13. package/lib/components/data-display/empty-state/index.d.ts.map +0 -1
  14. package/lib/components/data-display/empty-state/index.js +0 -2
  15. package/lib/components/data-display/stat/index.d.ts +0 -2
  16. package/lib/components/data-display/stat/index.d.ts.map +0 -1
  17. package/lib/components/data-display/stat/index.js +0 -2
  18. package/lib/components/feedback/skeleton/index.d.ts +0 -2
  19. package/lib/components/feedback/skeleton/index.d.ts.map +0 -1
  20. package/lib/components/feedback/skeleton/index.js +0 -2
  21. package/lib/components/foundation/grid/index.d.ts +0 -2
  22. package/lib/components/foundation/grid/index.d.ts.map +0 -1
  23. package/lib/components/foundation/grid/index.js +0 -2
  24. package/lib/components/general/icon/fonts/phosphor/bold/Phosphor-Bold.svg +0 -3057
  25. package/lib/components/general/icon/fonts/phosphor/bold/Phosphor-Bold.ttf +0 -0
  26. package/lib/components/general/icon/fonts/phosphor/bold/Phosphor-Bold.woff +0 -0
  27. package/lib/components/general/icon/fonts/phosphor/bold/Phosphor-Bold.woff2 +0 -0
  28. package/lib/components/general/icon/fonts/phosphor/bold/style.css +0 -4627
  29. package/lib/components/general/icon/fonts/phosphor/duotone/Phosphor-Duotone.svg +0 -3054
  30. package/lib/components/general/icon/fonts/phosphor/duotone/Phosphor-Duotone.ttf +0 -0
  31. package/lib/components/general/icon/fonts/phosphor/duotone/Phosphor-Duotone.woff +0 -0
  32. package/lib/components/general/icon/fonts/phosphor/duotone/Phosphor-Duotone.woff2 +0 -0
  33. package/lib/components/general/icon/fonts/phosphor/duotone/style.css +0 -12115
  34. package/lib/components/general/icon/fonts/phosphor/fill/Phosphor-Fill.svg +0 -3057
  35. package/lib/components/general/icon/fonts/phosphor/fill/Phosphor-Fill.ttf +0 -0
  36. package/lib/components/general/icon/fonts/phosphor/fill/Phosphor-Fill.woff +0 -0
  37. package/lib/components/general/icon/fonts/phosphor/fill/Phosphor-Fill.woff2 +0 -0
  38. package/lib/components/general/icon/fonts/phosphor/fill/style.css +0 -4627
  39. package/lib/components/general/icon/fonts/phosphor/light/Phosphor-Light.svg +0 -3057
  40. package/lib/components/general/icon/fonts/phosphor/light/Phosphor-Light.ttf +0 -0
  41. package/lib/components/general/icon/fonts/phosphor/light/Phosphor-Light.woff +0 -0
  42. package/lib/components/general/icon/fonts/phosphor/light/Phosphor-Light.woff2 +0 -0
  43. package/lib/components/general/icon/fonts/phosphor/light/style.css +0 -4627
  44. package/lib/components/general/icon/fonts/phosphor/regular/Phosphor.svg +0 -3056
  45. package/lib/components/general/icon/fonts/phosphor/regular/Phosphor.ttf +0 -0
  46. package/lib/components/general/icon/fonts/phosphor/regular/Phosphor.woff +0 -0
  47. package/lib/components/general/icon/fonts/phosphor/regular/Phosphor.woff2 +0 -0
  48. package/lib/components/general/icon/fonts/phosphor/regular/style.css +0 -4627
  49. package/lib/components/general/icon/fonts/phosphor/thin/Phosphor-Thin.svg +0 -3057
  50. package/lib/components/general/icon/fonts/phosphor/thin/Phosphor-Thin.ttf +0 -0
  51. package/lib/components/general/icon/fonts/phosphor/thin/Phosphor-Thin.woff +0 -0
  52. package/lib/components/general/icon/fonts/phosphor/thin/Phosphor-Thin.woff2 +0 -0
  53. package/lib/components/general/icon/fonts/phosphor/thin/style.css +0 -4627
  54. package/lib/components/general/icon/icon.registry.d.ts +0 -32
  55. package/lib/components/general/icon/icon.registry.d.ts.map +0 -1
  56. package/lib/components/general/icon/icon.registry.js +0 -45
  57. package/lib/components/general/icon/icon.types.d.ts +0 -8
  58. package/lib/components/general/icon/icon.types.d.ts.map +0 -1
  59. package/lib/components/general/icon/icon.types.js +0 -1
  60. package/lib/components/general/icon/phosphor-fonts.d.ts +0 -12
  61. package/lib/components/general/icon/phosphor-fonts.d.ts.map +0 -1
  62. package/lib/components/general/icon/phosphor-fonts.js +0 -77
  63. package/lib/components/general/icon/phosphor.d.ts +0 -41
  64. package/lib/components/general/icon/phosphor.d.ts.map +0 -1
  65. package/lib/components/general/icon/phosphor.js +0 -42
  66. package/lib/components/overlays/modal/index.d.ts +0 -2
  67. package/lib/components/overlays/modal/index.d.ts.map +0 -1
  68. package/lib/components/overlays/modal/index.js +0 -2
  69. package/lib/forms-adapters.d.ts +0 -2
  70. package/lib/forms-adapters.d.ts.map +0 -1
  71. package/lib/forms-adapters.js +0 -105
@@ -482,6 +482,12 @@ var AbstractControl = class {
482
482
  markAllAsUntouched() {
483
483
  this.markAsUntouched();
484
484
  }
485
+ markAllAsDirty() {
486
+ this.markAsDirty();
487
+ }
488
+ markAllAsPristine() {
489
+ this.markAsPristine();
490
+ }
485
491
  disable() {
486
492
  this._ownDisabled.set(true);
487
493
  }
@@ -901,6 +907,7 @@ var RequestManager = class {
901
907
  return hash;
902
908
  }
903
909
  };
910
+ var MAX_RETRIES = 3;
904
911
  var HttpClient = class {
905
912
  constructor(config) {
906
913
  this._requestManager = new RequestManager();
@@ -961,6 +968,7 @@ var HttpClient = class {
961
968
  });
962
969
  }
963
970
  async internalRequest(config) {
971
+ const originalConfig = config;
964
972
  let requestConfig = this.mergeConfig(config);
965
973
  requestConfig = await this.executeRequestInterceptors(requestConfig);
966
974
  if (requestConfig.cancel?.cancelled) {
@@ -983,11 +991,56 @@ var HttpClient = class {
983
991
  delete headers["Content-Type"];
984
992
  delete headers["content-type"];
985
993
  requestConfig.headers = headers;
994
+ } else if (this.shouldDefaultJsonContentType(requestConfig.body)) {
995
+ const headers = { ...requestConfig.headers };
996
+ if (!Object.keys(headers).some((k) => k.toLowerCase() === "content-type")) {
997
+ headers["Content-Type"] = "application/json";
998
+ requestConfig.headers = headers;
999
+ }
986
1000
  }
987
1001
  if (requestConfig.abortController === void 0) requestConfig.abortController = new AbortController();
988
- let response = await this.executeRequest(requestConfig);
989
- response = await this.executeResponseInterceptors(response);
990
- return response;
1002
+ try {
1003
+ const response = await this.executeRequest(requestConfig);
1004
+ return await this.executeResponseInterceptors(response, 0);
1005
+ } catch (error) {
1006
+ return this.handleResponseError(error, originalConfig);
1007
+ }
1008
+ }
1009
+ async handleResponseError(error, originalConfig) {
1010
+ const retryCount = originalConfig._retryCount ?? 0;
1011
+ for (let i = 0; i < this._interceptors.response.length; i++) {
1012
+ const interceptor = this._interceptors.response[i];
1013
+ if (!interceptor.error) continue;
1014
+ let retryCalled = false;
1015
+ const retry = async () => {
1016
+ if (retryCalled) throw new Error("[HttpClient] retry() may only be called once per error handler invocation");
1017
+ retryCalled = true;
1018
+ if (retryCount >= MAX_RETRIES) throw new Error(`[HttpClient] Max retries (${MAX_RETRIES}) exceeded`);
1019
+ return this.internalRequest({
1020
+ ...originalConfig,
1021
+ _retryCount: retryCount + 1,
1022
+ abortController: void 0
1023
+ });
1024
+ };
1025
+ const context = {
1026
+ retry,
1027
+ retryCount
1028
+ };
1029
+ try {
1030
+ const result = await interceptor.error(error, context);
1031
+ if (this.isHttpResponse(result)) return this.executeResponseInterceptors(result, i + 1);
1032
+ } catch {}
1033
+ }
1034
+ throw error;
1035
+ }
1036
+ isHttpResponse(value) {
1037
+ return !!value && typeof value === "object" && "data" in value && "status" in value && "headers" in value && "config" in value;
1038
+ }
1039
+ shouldDefaultJsonContentType(body) {
1040
+ if (body === null || body === void 0) return false;
1041
+ if (typeof body === "string") return false;
1042
+ if (body instanceof FormData || body instanceof Blob || body instanceof ArrayBuffer || body instanceof URLSearchParams || body instanceof ReadableStream) return false;
1043
+ return typeof body === "object";
991
1044
  }
992
1045
  async executeRequest(config) {
993
1046
  if (config.deduplicate === true) {
@@ -1029,13 +1082,8 @@ var HttpClient = class {
1029
1082
  }
1030
1083
  return config;
1031
1084
  }
1032
- async executeResponseInterceptors(response) {
1033
- for (const interceptor of this._interceptors.response) try {
1034
- response = await interceptor.intercept(response);
1035
- } catch (error) {
1036
- if (interceptor.error) await interceptor.error(error);
1037
- throw error;
1038
- }
1085
+ async executeResponseInterceptors(response, startIndex) {
1086
+ for (let i = startIndex; i < this._interceptors.response.length; i++) response = await this._interceptors.response[i].intercept(response);
1039
1087
  return response;
1040
1088
  }
1041
1089
  mergeConfig(config) {
@@ -3341,15 +3389,20 @@ function when(condition, template, falseTemplate) {
3341
3389
  parent.insertBefore(endMarker, startMarker.nextSibling);
3342
3390
  const state = {
3343
3391
  condition: false,
3344
- template: template(),
3345
- falseTemplate: falseTemplate ? falseTemplate() : null,
3392
+ template: null,
3393
+ falseTemplate: null,
3346
3394
  container: null,
3347
3395
  startMarker,
3348
3396
  endMarker,
3349
3397
  nodes: []
3350
3398
  };
3351
- if (condition) renderContent(state, true);
3352
- else if (state.falseTemplate) renderContent(state, false);
3399
+ if (condition) {
3400
+ state.template = template();
3401
+ renderContent(state, true);
3402
+ } else if (falseTemplate) {
3403
+ state.falseTemplate = falseTemplate();
3404
+ renderContent(state, false);
3405
+ }
3353
3406
  state.condition = condition;
3354
3407
  return state;
3355
3408
  }
@@ -3508,19 +3561,19 @@ var FormControl = class extends AbstractControl {
3508
3561
  this.initializeAggregates();
3509
3562
  this.runValidation();
3510
3563
  }
3511
- setValue(value) {
3564
+ setValue(value, options) {
3512
3565
  if (this._ownDisabled()) return;
3513
3566
  this.value.set(value);
3514
- this._dirty.set(true);
3567
+ this._dirty.set(!options?.markAsPristine);
3515
3568
  if (this.updateOn === "change") this.runValidation();
3516
3569
  }
3517
- patchValue(value) {
3570
+ patchValue(value, options) {
3518
3571
  const current = this.value();
3519
3572
  if (typeof current === "object" && current !== null && !Array.isArray(current)) this.setValue({
3520
3573
  ...current,
3521
3574
  ...value
3522
- });
3523
- else this.setValue(value);
3575
+ }, options);
3576
+ else this.setValue(value, options);
3524
3577
  }
3525
3578
  reset(value) {
3526
3579
  this.value.set(value ?? this.initialValue);
@@ -3571,15 +3624,17 @@ var FormGroup = class FormGroup extends AbstractControl {
3571
3624
  return next;
3572
3625
  });
3573
3626
  }
3574
- setValue(value) {
3627
+ setValue(value, options) {
3575
3628
  if (this._ownDisabled()) return;
3576
3629
  const controls = this.controls();
3577
- for (const key of Object.keys(value)) controls[key]?.setValue(value[key]);
3630
+ for (const key of Object.keys(value)) controls[key]?.setValue(value[key], options);
3631
+ if (options?.markAsPristine) this._dirty.set(false);
3578
3632
  }
3579
- patchValue(value) {
3633
+ patchValue(value, options) {
3580
3634
  if (this._ownDisabled()) return;
3581
3635
  const controls = this.controls();
3582
- for (const key of Object.keys(value)) if (value[key] !== void 0) controls[key]?.setValue(value[key]);
3636
+ for (const key of Object.keys(value)) if (value[key] !== void 0) controls[key]?.setValue(value[key], options);
3637
+ if (options?.markAsPristine) this._dirty.set(false);
3583
3638
  }
3584
3639
  reset(value) {
3585
3640
  const controls = this.controls();
@@ -3601,20 +3656,12 @@ var FormGroup = class FormGroup extends AbstractControl {
3601
3656
  markAllAsDirty() {
3602
3657
  this._dirty.set(true);
3603
3658
  const controls = this.controls();
3604
- for (const key of Object.keys(controls)) {
3605
- const child = controls[key];
3606
- if ("markAllAsDirty" in child && typeof child.markAllAsDirty === "function") child.markAllAsDirty();
3607
- else child.markAsDirty();
3608
- }
3659
+ for (const key of Object.keys(controls)) controls[key].markAllAsDirty();
3609
3660
  }
3610
3661
  markAllAsPristine() {
3611
3662
  this._dirty.set(false);
3612
3663
  const controls = this.controls();
3613
- for (const key of Object.keys(controls)) {
3614
- const child = controls[key];
3615
- if ("markAllAsPristine" in child && typeof child.markAllAsPristine === "function") child.markAllAsPristine();
3616
- else child.markAsPristine();
3617
- }
3664
+ for (const key of Object.keys(controls)) controls[key].markAllAsPristine();
3618
3665
  }
3619
3666
  disable() {
3620
3667
  this._ownDisabled.set(true);
@@ -3710,19 +3757,21 @@ var FormArray = class extends AbstractControl {
3710
3757
  }
3711
3758
  this.controls.set([]);
3712
3759
  }
3713
- setValue(value) {
3760
+ setValue(value, options) {
3714
3761
  if (this._ownDisabled()) return;
3715
3762
  const controls = this.controls();
3716
3763
  value.forEach((v, i) => {
3717
- controls[i]?.setValue(v);
3764
+ controls[i]?.setValue(v, options);
3718
3765
  });
3766
+ if (options?.markAsPristine) this._dirty.set(false);
3719
3767
  }
3720
- patchValue(value) {
3768
+ patchValue(value, options) {
3721
3769
  if (this._ownDisabled()) return;
3722
3770
  const controls = this.controls();
3723
3771
  value.forEach((v, i) => {
3724
- if (v !== void 0) controls[i]?.setValue(v);
3772
+ if (v !== void 0) controls[i]?.setValue(v, options);
3725
3773
  });
3774
+ if (options?.markAsPristine) this._dirty.set(false);
3726
3775
  }
3727
3776
  reset(value) {
3728
3777
  this.controls().forEach((control, i) => {
@@ -3737,6 +3786,14 @@ var FormArray = class extends AbstractControl {
3737
3786
  this._touched.set(false);
3738
3787
  for (const control of this.controls()) control.markAllAsUntouched();
3739
3788
  }
3789
+ markAllAsDirty() {
3790
+ this._dirty.set(true);
3791
+ for (const control of this.controls()) control.markAllAsDirty();
3792
+ }
3793
+ markAllAsPristine() {
3794
+ this._dirty.set(false);
3795
+ for (const control of this.controls()) control.markAllAsPristine();
3796
+ }
3740
3797
  disable() {
3741
3798
  this._ownDisabled.set(true);
3742
3799
  for (const control of this.controls()) control.disable();
@@ -13536,6 +13593,7 @@ function tableTemplate(c) {
13536
13593
  `)}
13537
13594
  ${repeat(c.columns, (col) => col.key, (col) => html`
13538
13595
  <th
13596
+ part="header-cell"
13539
13597
  class=${classMap({
13540
13598
  "ml-table__th": true,
13541
13599
  "ml-table__th--sortable": !!col.sortable,
@@ -13568,6 +13626,7 @@ function tableTemplate(c) {
13568
13626
  const absoluteIndex = c.startIndex + i;
13569
13627
  return html`
13570
13628
  <tr
13629
+ part="row"
13571
13630
  class=${classMap({
13572
13631
  "ml-table__row": true,
13573
13632
  "ml-table__row--selected": c.isRowSelected(absoluteIndex)
@@ -13587,10 +13646,13 @@ function tableTemplate(c) {
13587
13646
  </td>
13588
13647
  `)}
13589
13648
  ${repeat(c.columns, (col) => col.key, (col) => html`
13590
- <td class=${classMap({
13649
+ <td
13650
+ part="cell"
13651
+ class=${classMap({
13591
13652
  "ml-table__td": true,
13592
13653
  [`ml-table__td--${col.align ?? "left"}`]: true
13593
- })}>
13654
+ })}
13655
+ >
13594
13656
  ${renderCell$1(col, row, absoluteIndex)}
13595
13657
  </td>
13596
13658
  `)}
@@ -13621,10 +13683,21 @@ const tableStyles = () => css`
13621
13683
 
13622
13684
  /* ── Table: surface ── */
13623
13685
  --ml-table-bg: var(--ml-color-surface);
13686
+ --ml-table-font: var(--ml-font-sans);
13687
+
13688
+ /* Deprecated aliases — prefer container-* and divider-* tokens below */
13624
13689
  --ml-table-border-width: var(--ml-border);
13625
13690
  --ml-table-border-color: var(--ml-color-border);
13626
13691
  --ml-table-radius: var(--ml-radius-lg);
13627
- --ml-table-font: var(--ml-font-sans);
13692
+
13693
+ /* ── Table: container chrome (outer border + radius) ── */
13694
+ --ml-table-container-border-width: var(--ml-table-border-width);
13695
+ --ml-table-container-border-color: var(--ml-table-border-color);
13696
+ --ml-table-container-radius: var(--ml-table-radius);
13697
+
13698
+ /* ── Table: internal dividers (header/row/footer separators) ── */
13699
+ --ml-table-divider-width: var(--ml-table-border-width);
13700
+ --ml-table-divider-color: var(--ml-table-border-color);
13628
13701
 
13629
13702
  /* ── Table: header section ── */
13630
13703
  --ml-table-title-color: var(--ml-color-text);
@@ -13652,14 +13725,24 @@ const tableStyles = () => css`
13652
13725
 
13653
13726
  /* ── Table: cells ── */
13654
13727
  --ml-table-cell-color: var(--ml-color-text);
13728
+ --ml-table-cell-padding-y: var(--ml-space-4);
13729
+ --ml-table-cell-padding-x: var(--ml-space-6);
13730
+ --ml-table-cell-padding-y-sm: var(--ml-space-2-5);
13731
+ --ml-table-cell-padding-x-sm: var(--ml-space-4);
13732
+
13733
+ /* ── Table: header cells ── */
13734
+ --ml-table-header-padding-y: var(--ml-space-3);
13735
+ --ml-table-header-padding-x: var(--ml-space-6);
13736
+ --ml-table-header-padding-y-sm: var(--ml-space-2);
13737
+ --ml-table-header-padding-x-sm: var(--ml-space-4);
13655
13738
 
13656
13739
  /* ── Table: checkbox ── */
13657
13740
  --ml-table-checkbox-accent: var(--ml-color-primary);
13658
13741
  }
13659
13742
 
13660
13743
  .ml-table {
13661
- border: var(--ml-table-border-width) solid var(--ml-table-border-color);
13662
- border-radius: var(--ml-table-radius);
13744
+ border: var(--ml-table-container-border-width) solid var(--ml-table-container-border-color);
13745
+ border-radius: var(--ml-table-container-radius);
13663
13746
  background-color: var(--ml-table-bg);
13664
13747
  overflow: hidden;
13665
13748
  font-family: var(--ml-table-font);
@@ -13672,7 +13755,7 @@ const tableStyles = () => css`
13672
13755
  justify-content: space-between;
13673
13756
  gap: var(--ml-space-4);
13674
13757
  padding: var(--ml-space-5) var(--ml-space-6);
13675
- border-bottom: var(--ml-table-border-width) solid var(--ml-table-border-color);
13758
+ border-bottom: var(--ml-table-divider-width) solid var(--ml-table-divider-color);
13676
13759
  }
13677
13760
 
13678
13761
  .ml-table__header-text {
@@ -13719,11 +13802,11 @@ const tableStyles = () => css`
13719
13802
  }
13720
13803
 
13721
13804
  thead tr {
13722
- border-bottom: var(--ml-table-border-width) solid var(--ml-table-border-color);
13805
+ border-bottom: var(--ml-table-divider-width) solid var(--ml-table-divider-color);
13723
13806
  }
13724
13807
 
13725
13808
  .ml-table__th {
13726
- padding: var(--ml-space-3) var(--ml-space-6);
13809
+ padding: var(--ml-table-header-padding-y) var(--ml-table-header-padding-x);
13727
13810
  font-size: var(--ml-text-xs);
13728
13811
  font-weight: var(--ml-font-medium);
13729
13812
  color: var(--ml-table-header-color);
@@ -13735,7 +13818,7 @@ const tableStyles = () => css`
13735
13818
  }
13736
13819
 
13737
13820
  .ml-table--sm .ml-table__th {
13738
- padding: var(--ml-space-2) var(--ml-space-4);
13821
+ padding: var(--ml-table-header-padding-y-sm) var(--ml-table-header-padding-x-sm);
13739
13822
  }
13740
13823
 
13741
13824
  .ml-table__th--center { text-align: center; }
@@ -13773,7 +13856,7 @@ const tableStyles = () => css`
13773
13856
 
13774
13857
  /* ── Body rows ── */
13775
13858
  .ml-table__row {
13776
- border-bottom: var(--ml-table-border-width) solid var(--ml-table-border-color);
13859
+ border-bottom: var(--ml-table-divider-width) solid var(--ml-table-divider-color);
13777
13860
  transition: background-color var(--ml-duration-150) var(--ml-ease-in-out);
13778
13861
  }
13779
13862
 
@@ -13813,14 +13896,14 @@ const tableStyles = () => css`
13813
13896
 
13814
13897
  /* ── Body cells ── */
13815
13898
  .ml-table__td {
13816
- padding: var(--ml-space-4) var(--ml-space-6);
13899
+ padding: var(--ml-table-cell-padding-y) var(--ml-table-cell-padding-x);
13817
13900
  font-size: var(--ml-text-sm);
13818
13901
  color: var(--ml-table-cell-color);
13819
13902
  vertical-align: middle;
13820
13903
  }
13821
13904
 
13822
13905
  .ml-table--sm .ml-table__td {
13823
- padding: var(--ml-space-2-5) var(--ml-space-4);
13906
+ padding: var(--ml-table-cell-padding-y-sm) var(--ml-table-cell-padding-x-sm);
13824
13907
  font-size: var(--ml-text-xs);
13825
13908
  }
13826
13909
 
@@ -13893,7 +13976,7 @@ const tableStyles = () => css`
13893
13976
  align-items: center;
13894
13977
  justify-content: space-between;
13895
13978
  padding: var(--ml-space-3) var(--ml-space-6);
13896
- border-top: var(--ml-table-border-width) solid var(--ml-table-border-color);
13979
+ border-top: var(--ml-table-divider-width) solid var(--ml-table-divider-color);
13897
13980
  }
13898
13981
 
13899
13982
  .ml-table--sm .ml-table__footer--visible {