@melodicdev/components 1.6.0 → 1.6.1

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/melodic-components.js +112 -44
  2. package/assets/melodic-components.js.map +1 -1
  3. package/assets/melodic-components.min.js +1185 -1128
  4. package/lib/components/data-display/table/table.styles.d.ts.map +1 -1
  5. package/lib/components/data-display/table/table.styles.js +18 -7
  6. package/package.json +1 -1
  7. package/lib/bundle.d.ts +0 -59
  8. package/lib/bundle.d.ts.map +0 -1
  9. package/lib/bundle.js +0 -68
  10. package/lib/components/data-display/empty-state/index.d.ts +0 -2
  11. package/lib/components/data-display/empty-state/index.d.ts.map +0 -1
  12. package/lib/components/data-display/empty-state/index.js +0 -2
  13. package/lib/components/data-display/stat/index.d.ts +0 -2
  14. package/lib/components/data-display/stat/index.d.ts.map +0 -1
  15. package/lib/components/data-display/stat/index.js +0 -2
  16. package/lib/components/feedback/skeleton/index.d.ts +0 -2
  17. package/lib/components/feedback/skeleton/index.d.ts.map +0 -1
  18. package/lib/components/feedback/skeleton/index.js +0 -2
  19. package/lib/components/foundation/grid/index.d.ts +0 -2
  20. package/lib/components/foundation/grid/index.d.ts.map +0 -1
  21. package/lib/components/foundation/grid/index.js +0 -2
  22. package/lib/components/general/icon/fonts/phosphor/bold/Phosphor-Bold.svg +0 -3057
  23. package/lib/components/general/icon/fonts/phosphor/bold/Phosphor-Bold.ttf +0 -0
  24. package/lib/components/general/icon/fonts/phosphor/bold/Phosphor-Bold.woff +0 -0
  25. package/lib/components/general/icon/fonts/phosphor/bold/Phosphor-Bold.woff2 +0 -0
  26. package/lib/components/general/icon/fonts/phosphor/bold/style.css +0 -4627
  27. package/lib/components/general/icon/fonts/phosphor/duotone/Phosphor-Duotone.svg +0 -3054
  28. package/lib/components/general/icon/fonts/phosphor/duotone/Phosphor-Duotone.ttf +0 -0
  29. package/lib/components/general/icon/fonts/phosphor/duotone/Phosphor-Duotone.woff +0 -0
  30. package/lib/components/general/icon/fonts/phosphor/duotone/Phosphor-Duotone.woff2 +0 -0
  31. package/lib/components/general/icon/fonts/phosphor/duotone/style.css +0 -12115
  32. package/lib/components/general/icon/fonts/phosphor/fill/Phosphor-Fill.svg +0 -3057
  33. package/lib/components/general/icon/fonts/phosphor/fill/Phosphor-Fill.ttf +0 -0
  34. package/lib/components/general/icon/fonts/phosphor/fill/Phosphor-Fill.woff +0 -0
  35. package/lib/components/general/icon/fonts/phosphor/fill/Phosphor-Fill.woff2 +0 -0
  36. package/lib/components/general/icon/fonts/phosphor/fill/style.css +0 -4627
  37. package/lib/components/general/icon/fonts/phosphor/light/Phosphor-Light.svg +0 -3057
  38. package/lib/components/general/icon/fonts/phosphor/light/Phosphor-Light.ttf +0 -0
  39. package/lib/components/general/icon/fonts/phosphor/light/Phosphor-Light.woff +0 -0
  40. package/lib/components/general/icon/fonts/phosphor/light/Phosphor-Light.woff2 +0 -0
  41. package/lib/components/general/icon/fonts/phosphor/light/style.css +0 -4627
  42. package/lib/components/general/icon/fonts/phosphor/regular/Phosphor.svg +0 -3056
  43. package/lib/components/general/icon/fonts/phosphor/regular/Phosphor.ttf +0 -0
  44. package/lib/components/general/icon/fonts/phosphor/regular/Phosphor.woff +0 -0
  45. package/lib/components/general/icon/fonts/phosphor/regular/Phosphor.woff2 +0 -0
  46. package/lib/components/general/icon/fonts/phosphor/regular/style.css +0 -4627
  47. package/lib/components/general/icon/fonts/phosphor/thin/Phosphor-Thin.svg +0 -3057
  48. package/lib/components/general/icon/fonts/phosphor/thin/Phosphor-Thin.ttf +0 -0
  49. package/lib/components/general/icon/fonts/phosphor/thin/Phosphor-Thin.woff +0 -0
  50. package/lib/components/general/icon/fonts/phosphor/thin/Phosphor-Thin.woff2 +0 -0
  51. package/lib/components/general/icon/fonts/phosphor/thin/style.css +0 -4627
  52. package/lib/components/general/icon/icon.registry.d.ts +0 -32
  53. package/lib/components/general/icon/icon.registry.d.ts.map +0 -1
  54. package/lib/components/general/icon/icon.registry.js +0 -45
  55. package/lib/components/general/icon/icon.types.d.ts +0 -8
  56. package/lib/components/general/icon/icon.types.d.ts.map +0 -1
  57. package/lib/components/general/icon/icon.types.js +0 -1
  58. package/lib/components/general/icon/phosphor-fonts.d.ts +0 -12
  59. package/lib/components/general/icon/phosphor-fonts.d.ts.map +0 -1
  60. package/lib/components/general/icon/phosphor-fonts.js +0 -77
  61. package/lib/components/general/icon/phosphor.d.ts +0 -41
  62. package/lib/components/general/icon/phosphor.d.ts.map +0 -1
  63. package/lib/components/general/icon/phosphor.js +0 -42
  64. package/lib/components/overlays/modal/index.d.ts +0 -2
  65. package/lib/components/overlays/modal/index.d.ts.map +0 -1
  66. package/lib/components/overlays/modal/index.js +0 -2
  67. package/lib/forms-adapters.d.ts +0 -2
  68. package/lib/forms-adapters.d.ts.map +0 -1
  69. 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();
@@ -13621,10 +13678,21 @@ const tableStyles = () => css`
13621
13678
 
13622
13679
  /* ── Table: surface ── */
13623
13680
  --ml-table-bg: var(--ml-color-surface);
13681
+ --ml-table-font: var(--ml-font-sans);
13682
+
13683
+ /* Deprecated aliases — prefer container-* and divider-* tokens below */
13624
13684
  --ml-table-border-width: var(--ml-border);
13625
13685
  --ml-table-border-color: var(--ml-color-border);
13626
13686
  --ml-table-radius: var(--ml-radius-lg);
13627
- --ml-table-font: var(--ml-font-sans);
13687
+
13688
+ /* ── Table: container chrome (outer border + radius) ── */
13689
+ --ml-table-container-border-width: var(--ml-table-border-width);
13690
+ --ml-table-container-border-color: var(--ml-table-border-color);
13691
+ --ml-table-container-radius: var(--ml-table-radius);
13692
+
13693
+ /* ── Table: internal dividers (header/row/footer separators) ── */
13694
+ --ml-table-divider-width: var(--ml-table-border-width);
13695
+ --ml-table-divider-color: var(--ml-table-border-color);
13628
13696
 
13629
13697
  /* ── Table: header section ── */
13630
13698
  --ml-table-title-color: var(--ml-color-text);
@@ -13658,8 +13726,8 @@ const tableStyles = () => css`
13658
13726
  }
13659
13727
 
13660
13728
  .ml-table {
13661
- border: var(--ml-table-border-width) solid var(--ml-table-border-color);
13662
- border-radius: var(--ml-table-radius);
13729
+ border: var(--ml-table-container-border-width) solid var(--ml-table-container-border-color);
13730
+ border-radius: var(--ml-table-container-radius);
13663
13731
  background-color: var(--ml-table-bg);
13664
13732
  overflow: hidden;
13665
13733
  font-family: var(--ml-table-font);
@@ -13672,7 +13740,7 @@ const tableStyles = () => css`
13672
13740
  justify-content: space-between;
13673
13741
  gap: var(--ml-space-4);
13674
13742
  padding: var(--ml-space-5) var(--ml-space-6);
13675
- border-bottom: var(--ml-table-border-width) solid var(--ml-table-border-color);
13743
+ border-bottom: var(--ml-table-divider-width) solid var(--ml-table-divider-color);
13676
13744
  }
13677
13745
 
13678
13746
  .ml-table__header-text {
@@ -13719,7 +13787,7 @@ const tableStyles = () => css`
13719
13787
  }
13720
13788
 
13721
13789
  thead tr {
13722
- border-bottom: var(--ml-table-border-width) solid var(--ml-table-border-color);
13790
+ border-bottom: var(--ml-table-divider-width) solid var(--ml-table-divider-color);
13723
13791
  }
13724
13792
 
13725
13793
  .ml-table__th {
@@ -13773,7 +13841,7 @@ const tableStyles = () => css`
13773
13841
 
13774
13842
  /* ── Body rows ── */
13775
13843
  .ml-table__row {
13776
- border-bottom: var(--ml-table-border-width) solid var(--ml-table-border-color);
13844
+ border-bottom: var(--ml-table-divider-width) solid var(--ml-table-divider-color);
13777
13845
  transition: background-color var(--ml-duration-150) var(--ml-ease-in-out);
13778
13846
  }
13779
13847
 
@@ -13893,7 +13961,7 @@ const tableStyles = () => css`
13893
13961
  align-items: center;
13894
13962
  justify-content: space-between;
13895
13963
  padding: var(--ml-space-3) var(--ml-space-6);
13896
- border-top: var(--ml-table-border-width) solid var(--ml-table-border-color);
13964
+ border-top: var(--ml-table-divider-width) solid var(--ml-table-divider-color);
13897
13965
  }
13898
13966
 
13899
13967
  .ml-table--sm .ml-table__footer--visible {