@wrrdev/fenix-ui 1.1.1 → 1.1.3

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 (36) hide show
  1. package/README.md +5 -4
  2. package/dist/_virtual/preload-helper.js +6 -3
  3. package/dist/_virtual/preload-helper.js.map +1 -1
  4. package/dist/cdn.d.ts +2 -1
  5. package/dist/cdn.d.ts.map +1 -1
  6. package/dist/components/accordion/accordion.d.ts.map +1 -1
  7. package/dist/components/accordion/accordion.js +1 -0
  8. package/dist/components/accordion/accordion.js.map +1 -1
  9. package/dist/components/alert/alert.js +2 -3
  10. package/dist/components/alert/alert.js.map +1 -1
  11. package/dist/components/confirmpopup/confirmpopup.js +2 -3
  12. package/dist/components/confirmpopup/confirmpopup.js.map +1 -1
  13. package/dist/components/dialog/dialog.d.ts.map +1 -1
  14. package/dist/components/dialog/dialog.js +11 -3
  15. package/dist/components/dialog/dialog.js.map +1 -1
  16. package/dist/components/slider/slider.d.ts +3 -0
  17. package/dist/components/slider/slider.d.ts.map +1 -1
  18. package/dist/components/slider/slider.js +10 -0
  19. package/dist/components/slider/slider.js.map +1 -1
  20. package/dist/components/timeline/timeline.d.ts +2 -1
  21. package/dist/components/timeline/timeline.d.ts.map +1 -1
  22. package/dist/components/timeline/timeline.js +21 -5
  23. package/dist/components/timeline/timeline.js.map +1 -1
  24. package/dist/components/toast/toast.d.ts +7 -1
  25. package/dist/components/toast/toast.d.ts.map +1 -1
  26. package/dist/components/toast/toast.js +31 -8
  27. package/dist/components/toast/toast.js.map +1 -1
  28. package/dist/core/jsx.d.ts +2 -0
  29. package/dist/core/jsx.d.ts.map +1 -1
  30. package/dist/core/jsx.js.map +1 -1
  31. package/dist/docs/app.d.ts.map +1 -1
  32. package/dist/docs/componentes/toast.doc.d.ts.map +1 -1
  33. package/dist/fenix-ui.umd.min.js +115 -78
  34. package/dist/fenix-ui3.esm.js +79 -19
  35. package/dist/fenix-ui3.esm.js.map +1 -1
  36. package/package.json +2 -2
@@ -1,4 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./fenix-ui2.esm.js","./assets/base-css-BifSeW2H.js"])))=>i.map(i=>d[i]);
2
1
  var __typeError = (msg) => {
3
2
  throw TypeError(msg);
4
3
  };
@@ -4139,7 +4138,8 @@ _FxDialog.styles = css`
4139
4138
  border: 1px solid var(--fx-border-default);
4140
4139
  border-radius: var(--fx-radius-lg);
4141
4140
  box-shadow: var(--fx-shadow-xl);
4142
- width: min(560px, calc(100vw - 32px));
4141
+ /* Largura customizável por instância: defina --fx-dialog-width no elemento. */
4142
+ width: min(var(--fx-dialog-width, 560px), calc(100vw - 32px));
4143
4143
  max-height: calc(100vh - 64px);
4144
4144
  display: flex;
4145
4145
  flex-direction: column;
@@ -4147,8 +4147,15 @@ _FxDialog.styles = css`
4147
4147
  animation: pop var(--fx-motion-duration-normal) var(--fx-motion-easing);
4148
4148
  }
4149
4149
  @keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
4150
- :host([size='sm']) .dialog { width: min(400px, calc(100vw - 32px)); }
4151
- :host([size='lg']) .dialog { width: min(800px, calc(100vw - 32px)); }
4150
+ :host([size='sm']) .dialog { width: min(var(--fx-dialog-width, 400px), calc(100vw - 32px)); }
4151
+ :host([size='lg']) .dialog { width: min(var(--fx-dialog-width, 800px), calc(100vw - 32px)); }
4152
+ /* Mobile: dialog ocupa praticamente toda a largura da tela. */
4153
+ @media (max-width: 640px) {
4154
+ .dialog, :host([size='sm']) .dialog, :host([size='lg']) .dialog {
4155
+ width: calc(100vw - 16px);
4156
+ max-width: calc(100vw - 16px);
4157
+ }
4158
+ }
4152
4159
  header {
4153
4160
  display: flex;
4154
4161
  align-items: center;
@@ -4193,12 +4200,15 @@ function defineFxDialog() {
4193
4200
  return defineElement("fx-dialog", FxDialog);
4194
4201
  }
4195
4202
  defineFxDialog();
4196
- const scriptRel = "modulepreload";
4203
+ const scriptRel = function detectScriptRel() {
4204
+ const relList = typeof document !== "undefined" && document.createElement("link").relList;
4205
+ return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload";
4206
+ }();
4197
4207
  const assetsURL = function(dep, importerUrl) {
4198
4208
  return new URL(dep, importerUrl).href;
4199
4209
  };
4200
4210
  const seen = {};
4201
- const __vitePreload = function preload(baseModule, deps, importerUrl) {
4211
+ const __fenixPreload = function preload(baseModule, deps, importerUrl) {
4202
4212
  let promise = Promise.resolve();
4203
4213
  if (deps && deps.length > 0) {
4204
4214
  const links = document.getElementsByTagName("link");
@@ -4288,7 +4298,7 @@ const _FxConfirmPopup = class _FxConfirmPopup extends FxElement {
4288
4298
  const message = this.getAttr("message");
4289
4299
  const icon = this.getAttr("icon");
4290
4300
  const iconIsFx = isFenixIconName(icon);
4291
- if (iconIsFx) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0, import.meta.url);
4301
+ if (iconIsFx) void __fenixPreload(() => import("./fenix-ui2.esm.js"), true ? [] : void 0, import.meta.url);
4292
4302
  const acceptLabel = this.getAttr("accept-label", "Sim");
4293
4303
  const rejectLabel = this.getAttr("reject-label", "Não");
4294
4304
  this.setTemplate(`
@@ -4825,6 +4835,14 @@ const _FxSlider = class _FxSlider extends FxElement {
4825
4835
  this._bindPointer();
4826
4836
  this._bindKeyboard();
4827
4837
  }
4838
+ disconnectedCallback() {
4839
+ super.disconnectedCallback();
4840
+ if (this._dragging) {
4841
+ this._dragging = false;
4842
+ if (this._onMove) window.removeEventListener("pointermove", this._onMove);
4843
+ if (this._onUp) window.removeEventListener("pointerup", this._onUp);
4844
+ }
4845
+ }
4828
4846
  _wrap() {
4829
4847
  return this.root.querySelector(".track-wrap");
4830
4848
  }
@@ -4844,6 +4862,7 @@ const _FxSlider = class _FxSlider extends FxElement {
4844
4862
  new CustomEvent("input", { bubbles: true, composed: true, detail: { value: this.value } })
4845
4863
  );
4846
4864
  };
4865
+ this._onMove = move;
4847
4866
  const up = (e) => {
4848
4867
  if (!this._dragging) return;
4849
4868
  this._dragging = false;
@@ -4856,6 +4875,7 @@ const _FxSlider = class _FxSlider extends FxElement {
4856
4875
  new CustomEvent("change", { bubbles: true, composed: true, detail: { value: this.value } })
4857
4876
  );
4858
4877
  };
4878
+ this._onUp = up;
4859
4879
  wrap.addEventListener("pointerdown", (e) => {
4860
4880
  if (this.hasAttr("disabled")) return;
4861
4881
  this._dragging = true;
@@ -6314,8 +6334,11 @@ const _FxTimeline = class _FxTimeline extends FxElement {
6314
6334
  time ? `<span class="time">${esc(time)}</span>` : "",
6315
6335
  title ? `<span class="title">${esc(title)}</span>` : ""
6316
6336
  ].join("");
6317
- return `<li class="event" part="event"><span class="dot" part="marker" aria-hidden="true">${esc(marker)}</span><div class="head">${head}</div><div class="content">${item.innerHTML}</div></li>`;
6337
+ const icon = item.getAttribute("icon");
6338
+ const dot = icon ? `<span class="dot fx-icon" part="marker" aria-hidden="true">${esc(icon)}</span>` : `<span class="dot" part="marker" aria-hidden="true">${esc(marker)}</span>`;
6339
+ return `<li class="event" part="event">${dot}<div class="head">${head}</div><div class="content">${item.innerHTML}</div></li>`;
6318
6340
  }).join("");
6341
+ if (items.some((item) => item.hasAttribute("icon"))) void __fenixPreload(() => import("./fenix-ui2.esm.js"), true ? [] : void 0, import.meta.url);
6319
6342
  }
6320
6343
  connectedCallback() {
6321
6344
  super.connectedCallback();
@@ -6334,10 +6357,10 @@ _FxTimeline.styles = css`
6334
6357
  display: block;
6335
6358
  font-family: var(--fx-font-family);
6336
6359
  font-size: var(--fx-font-size);
6337
- --_marker: calc(var(--fx-font-size) - 1px);
6360
+ --_marker: calc(var(--fx-font-size) + 6px);
6338
6361
  }
6339
- :host([size='sm']) { --_marker: calc(var(--fx-font-size) - 3px); }
6340
- :host([size='lg']) { --_marker: calc(var(--fx-font-size) + 2px); }
6362
+ :host([size='sm']) { --_marker: calc(var(--fx-font-size) - 2px); }
6363
+ :host([size='lg']) { --_marker: calc(var(--fx-font-size) + 14px); }
6341
6364
 
6342
6365
  .tl {
6343
6366
  list-style: none;
@@ -6370,10 +6393,22 @@ _FxTimeline.styles = css`
6370
6393
  display: inline-flex;
6371
6394
  align-items: center;
6372
6395
  justify-content: center;
6373
- font-size: calc(var(--_marker) * 0.55);
6396
+ font-size: calc(var(--_marker) * 0.5);
6374
6397
  color: var(--fx-color-primary);
6375
6398
  line-height: 1;
6376
6399
  }
6400
+ /* marcador com ícone da fonte Fenix Icons (atributo icon no item) */
6401
+ .dot.fx-icon {
6402
+ font-family: var(--fx-icon-font, 'Fenix Icons');
6403
+ font-weight: normal;
6404
+ font-style: normal;
6405
+ font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
6406
+ -webkit-font-smoothing: antialiased;
6407
+ user-select: none;
6408
+ background: color-mix(in srgb, var(--fx-color-primary) 14%, transparent);
6409
+ border-radius: 50%;
6410
+ font-size: calc(var(--_marker) * 0.55);
6411
+ }
6377
6412
  .head {
6378
6413
  display: flex;
6379
6414
  align-items: baseline;
@@ -6749,7 +6784,24 @@ const KIND_ICON = {
6749
6784
  info: "i"
6750
6785
  };
6751
6786
  const CARD_CSS = `
6752
- :host { display: contents; }
6787
+ :host { display: contents; pointer-events: auto; }
6788
+ /* Modo explícito: sobrepõe os tokens herdados do tema global SOMENTE neste card. */
6789
+ :host([mode='dark']) {
6790
+ --fx-surface-background: #1e293b;
6791
+ --fx-text-default: #f1f5f9;
6792
+ --fx-text-muted: #94a3b8;
6793
+ --fx-border-default: #334155;
6794
+ --fx-shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
6795
+ --fx-surface-surface-hover: rgba(255, 255, 255, .08);
6796
+ }
6797
+ :host([mode='light']) {
6798
+ --fx-surface-background: #ffffff;
6799
+ --fx-text-default: #1e293b;
6800
+ --fx-text-muted: #64748b;
6801
+ --fx-border-default: #e2e8f0;
6802
+ --fx-shadow-lg: 0 10px 30px rgba(0, 0, 0, .14);
6803
+ --fx-surface-surface-hover: rgba(0, 0, 0, .05);
6804
+ }
6753
6805
  .fx-icon {
6754
6806
  font-family: var(--fx-icon-font, 'Fenix Icons');
6755
6807
  font-weight: normal;
@@ -6804,7 +6856,16 @@ class FxToast extends HTMLElement {
6804
6856
  this.attachShadow({ mode: "open" });
6805
6857
  }
6806
6858
  static get observedAttributes() {
6807
- return ["kind", "title", "message", "duration", "icon"];
6859
+ return ["kind", "title", "message", "duration", "icon", "mode"];
6860
+ }
6861
+ /** Esquema de cores forçado do card: 'light' | 'dark' | undefined (segue o tema). */
6862
+ get mode() {
6863
+ const m = this.getAttribute("mode");
6864
+ return m === "light" || m === "dark" ? m : void 0;
6865
+ }
6866
+ set mode(value) {
6867
+ if (value) this.setAttribute("mode", value);
6868
+ else this.removeAttribute("mode");
6808
6869
  }
6809
6870
  connectedCallback() {
6810
6871
  if (!this.shadowRoot.firstChild) __privateMethod(this, _FxToast_instances, render_fn).call(this);
@@ -6838,7 +6899,7 @@ render_fn = function() {
6838
6899
  const color = KIND_COLOR[kind] ?? KIND_COLOR.info;
6839
6900
  const iconName = this.getAttribute("icon");
6840
6901
  const isFxIcon = !!iconName && /^[a-z][a-z0-9_]*$/.test(iconName);
6841
- if (isFxIcon) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0, import.meta.url);
6902
+ if (isFxIcon) void __fenixPreload(() => import("./fenix-ui2.esm.js"), true ? [] : void 0, import.meta.url);
6842
6903
  const iconContent = isFxIcon ? iconName : KIND_ICON[kind] ?? KIND_ICON.info;
6843
6904
  this.shadowRoot.innerHTML = `
6844
6905
  <style>${CARD_CSS}</style>
@@ -6876,9 +6937,6 @@ function regionFor(position) {
6876
6937
  style.gap = "8px";
6877
6938
  style.zIndex = "1100";
6878
6939
  style.pointerEvents = "none";
6879
- new MutationObserver(() => {
6880
- region.querySelectorAll("*").forEach((c) => c.style.pointerEvents = "auto");
6881
- }).observe(region, { childList: true });
6882
6940
  document.body.appendChild(region);
6883
6941
  }
6884
6942
  return region;
@@ -6902,6 +6960,7 @@ class ToastApi {
6902
6960
  if (message) el.setAttribute("message", message);
6903
6961
  el.setAttribute("position", o.position ?? "top-right");
6904
6962
  el.setAttribute("duration", String(o.duration ?? 4e3));
6963
+ if (o.mode) el.setAttribute("mode", o.mode);
6905
6964
  regionFor(o.position ?? "top-right").appendChild(el);
6906
6965
  this.map.set(id, el);
6907
6966
  return id;
@@ -7600,7 +7659,7 @@ const _FxAlert = class _FxAlert extends FxElement {
7600
7659
  const variant = this.getAttr("variant", "info");
7601
7660
  const title = this.getAttr("title");
7602
7661
  const iconName = this.getAttr("icon");
7603
- if (isFenixIconName(iconName)) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0, import.meta.url);
7662
+ if (isFenixIconName(iconName)) void __fenixPreload(() => import("./fenix-ui2.esm.js"), true ? [] : void 0, import.meta.url);
7604
7663
  const icons = {
7605
7664
  info: "ℹ",
7606
7665
  success: "✓",
@@ -10103,6 +10162,7 @@ const _FxAccordionPanel = class _FxAccordionPanel extends FxElement {
10103
10162
  disconnectedCallback() {
10104
10163
  this._mo?.disconnect();
10105
10164
  this._mo = null;
10165
+ super.disconnectedCallback();
10106
10166
  }
10107
10167
  render() {
10108
10168
  this.setTemplate(`