@wrrdev/fenix-ui 1.1.0 → 1.1.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 (40) hide show
  1. package/README.md +5 -4
  2. package/dist/_virtual/preload-helper.js +13 -5
  3. package/dist/_virtual/preload-helper.js.map +1 -1
  4. package/dist/assets/fenix-icons-DmgotBzD.woff2 +0 -0
  5. package/dist/cdn.d.ts +2 -1
  6. package/dist/cdn.d.ts.map +1 -1
  7. package/dist/components/accordion/accordion.d.ts.map +1 -1
  8. package/dist/components/accordion/accordion.js +1 -0
  9. package/dist/components/accordion/accordion.js.map +1 -1
  10. package/dist/components/alert/alert.js +2 -2
  11. package/dist/components/confirmpopup/confirmpopup.js +2 -2
  12. package/dist/components/dialog/dialog.d.ts.map +1 -1
  13. package/dist/components/dialog/dialog.js +11 -3
  14. package/dist/components/dialog/dialog.js.map +1 -1
  15. package/dist/components/slider/slider.d.ts +3 -0
  16. package/dist/components/slider/slider.d.ts.map +1 -1
  17. package/dist/components/slider/slider.js +10 -0
  18. package/dist/components/slider/slider.js.map +1 -1
  19. package/dist/components/timeline/timeline.d.ts +2 -1
  20. package/dist/components/timeline/timeline.d.ts.map +1 -1
  21. package/dist/components/timeline/timeline.js +22 -5
  22. package/dist/components/timeline/timeline.js.map +1 -1
  23. package/dist/components/toast/toast.d.ts +7 -1
  24. package/dist/components/toast/toast.d.ts.map +1 -1
  25. package/dist/components/toast/toast.js +31 -7
  26. package/dist/components/toast/toast.js.map +1 -1
  27. package/dist/core/jsx.d.ts +2 -0
  28. package/dist/core/jsx.d.ts.map +1 -1
  29. package/dist/core/jsx.js.map +1 -1
  30. package/dist/docs/app.d.ts.map +1 -1
  31. package/dist/docs/componentes/toast.doc.d.ts.map +1 -1
  32. package/dist/fenix-ui.umd.min.js +115 -78
  33. package/dist/fenix-ui2.esm.js +1 -2
  34. package/dist/fenix-ui2.esm.js.map +1 -1
  35. package/dist/fenix-ui3.esm.js +88 -22
  36. package/dist/fenix-ui3.esm.js.map +1 -1
  37. package/dist/icons/index.d.ts.map +1 -1
  38. package/dist/icons/index.js +1 -2
  39. package/dist/icons/index.js.map +1 -1
  40. package/package.json +1 -1
@@ -1,4 +1,4 @@
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]);
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
2
  var __typeError = (msg) => {
3
3
  throw TypeError(msg);
4
4
  };
@@ -4139,7 +4139,8 @@ _FxDialog.styles = css`
4139
4139
  border: 1px solid var(--fx-border-default);
4140
4140
  border-radius: var(--fx-radius-lg);
4141
4141
  box-shadow: var(--fx-shadow-xl);
4142
- width: min(560px, calc(100vw - 32px));
4142
+ /* Largura customizável por instância: defina --fx-dialog-width no elemento. */
4143
+ width: min(var(--fx-dialog-width, 560px), calc(100vw - 32px));
4143
4144
  max-height: calc(100vh - 64px);
4144
4145
  display: flex;
4145
4146
  flex-direction: column;
@@ -4147,8 +4148,15 @@ _FxDialog.styles = css`
4147
4148
  animation: pop var(--fx-motion-duration-normal) var(--fx-motion-easing);
4148
4149
  }
4149
4150
  @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)); }
4151
+ :host([size='sm']) .dialog { width: min(var(--fx-dialog-width, 400px), calc(100vw - 32px)); }
4152
+ :host([size='lg']) .dialog { width: min(var(--fx-dialog-width, 800px), calc(100vw - 32px)); }
4153
+ /* Mobile: dialog ocupa praticamente toda a largura da tela. */
4154
+ @media (max-width: 640px) {
4155
+ .dialog, :host([size='sm']) .dialog, :host([size='lg']) .dialog {
4156
+ width: calc(100vw - 16px);
4157
+ max-width: calc(100vw - 16px);
4158
+ }
4159
+ }
4152
4160
  header {
4153
4161
  display: flex;
4154
4162
  align-items: center;
@@ -4194,26 +4202,34 @@ function defineFxDialog() {
4194
4202
  }
4195
4203
  defineFxDialog();
4196
4204
  const scriptRel = "modulepreload";
4197
- const assetsURL = function(dep) {
4198
- return "/" + dep;
4205
+ const assetsURL = function(dep, importerUrl) {
4206
+ return new URL(dep, importerUrl).href;
4199
4207
  };
4200
4208
  const seen = {};
4201
4209
  const __vitePreload = function preload(baseModule, deps, importerUrl) {
4202
4210
  let promise = Promise.resolve();
4203
4211
  if (deps && deps.length > 0) {
4204
- document.getElementsByTagName("link");
4212
+ const links = document.getElementsByTagName("link");
4205
4213
  const cspNonceMeta = document.querySelector(
4206
4214
  "meta[property=csp-nonce]"
4207
4215
  );
4208
4216
  const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
4209
4217
  promise = Promise.allSettled(
4210
4218
  deps.map((dep) => {
4211
- dep = assetsURL(dep);
4219
+ dep = assetsURL(dep, importerUrl);
4212
4220
  if (dep in seen) return;
4213
4221
  seen[dep] = true;
4214
4222
  const isCss = dep.endsWith(".css");
4215
4223
  const cssSelector = isCss ? '[rel="stylesheet"]' : "";
4216
- if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
4224
+ const isBaseRelative = !!importerUrl;
4225
+ if (isBaseRelative) {
4226
+ for (let i = links.length - 1; i >= 0; i--) {
4227
+ const link2 = links[i];
4228
+ if (link2.href === dep && (!isCss || link2.rel === "stylesheet")) {
4229
+ return;
4230
+ }
4231
+ }
4232
+ } else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
4217
4233
  return;
4218
4234
  }
4219
4235
  const link = document.createElement("link");
@@ -4280,7 +4296,7 @@ const _FxConfirmPopup = class _FxConfirmPopup extends FxElement {
4280
4296
  const message = this.getAttr("message");
4281
4297
  const icon = this.getAttr("icon");
4282
4298
  const iconIsFx = isFenixIconName(icon);
4283
- if (iconIsFx) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0);
4299
+ if (iconIsFx) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0, import.meta.url);
4284
4300
  const acceptLabel = this.getAttr("accept-label", "Sim");
4285
4301
  const rejectLabel = this.getAttr("reject-label", "Não");
4286
4302
  this.setTemplate(`
@@ -4817,6 +4833,14 @@ const _FxSlider = class _FxSlider extends FxElement {
4817
4833
  this._bindPointer();
4818
4834
  this._bindKeyboard();
4819
4835
  }
4836
+ disconnectedCallback() {
4837
+ super.disconnectedCallback();
4838
+ if (this._dragging) {
4839
+ this._dragging = false;
4840
+ if (this._onMove) window.removeEventListener("pointermove", this._onMove);
4841
+ if (this._onUp) window.removeEventListener("pointerup", this._onUp);
4842
+ }
4843
+ }
4820
4844
  _wrap() {
4821
4845
  return this.root.querySelector(".track-wrap");
4822
4846
  }
@@ -4836,6 +4860,7 @@ const _FxSlider = class _FxSlider extends FxElement {
4836
4860
  new CustomEvent("input", { bubbles: true, composed: true, detail: { value: this.value } })
4837
4861
  );
4838
4862
  };
4863
+ this._onMove = move;
4839
4864
  const up = (e) => {
4840
4865
  if (!this._dragging) return;
4841
4866
  this._dragging = false;
@@ -4848,6 +4873,7 @@ const _FxSlider = class _FxSlider extends FxElement {
4848
4873
  new CustomEvent("change", { bubbles: true, composed: true, detail: { value: this.value } })
4849
4874
  );
4850
4875
  };
4876
+ this._onUp = up;
4851
4877
  wrap.addEventListener("pointerdown", (e) => {
4852
4878
  if (this.hasAttr("disabled")) return;
4853
4879
  this._dragging = true;
@@ -6306,8 +6332,11 @@ const _FxTimeline = class _FxTimeline extends FxElement {
6306
6332
  time ? `<span class="time">${esc(time)}</span>` : "",
6307
6333
  title ? `<span class="title">${esc(title)}</span>` : ""
6308
6334
  ].join("");
6309
- 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>`;
6335
+ const icon = item.getAttribute("icon");
6336
+ 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>`;
6337
+ return `<li class="event" part="event">${dot}<div class="head">${head}</div><div class="content">${item.innerHTML}</div></li>`;
6310
6338
  }).join("");
6339
+ if (items.some((item) => item.hasAttribute("icon"))) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0, import.meta.url);
6311
6340
  }
6312
6341
  connectedCallback() {
6313
6342
  super.connectedCallback();
@@ -6326,10 +6355,10 @@ _FxTimeline.styles = css`
6326
6355
  display: block;
6327
6356
  font-family: var(--fx-font-family);
6328
6357
  font-size: var(--fx-font-size);
6329
- --_marker: calc(var(--fx-font-size) - 1px);
6358
+ --_marker: calc(var(--fx-font-size) + 6px);
6330
6359
  }
6331
- :host([size='sm']) { --_marker: calc(var(--fx-font-size) - 3px); }
6332
- :host([size='lg']) { --_marker: calc(var(--fx-font-size) + 2px); }
6360
+ :host([size='sm']) { --_marker: calc(var(--fx-font-size) - 2px); }
6361
+ :host([size='lg']) { --_marker: calc(var(--fx-font-size) + 14px); }
6333
6362
 
6334
6363
  .tl {
6335
6364
  list-style: none;
@@ -6362,10 +6391,22 @@ _FxTimeline.styles = css`
6362
6391
  display: inline-flex;
6363
6392
  align-items: center;
6364
6393
  justify-content: center;
6365
- font-size: calc(var(--_marker) * 0.55);
6394
+ font-size: calc(var(--_marker) * 0.5);
6366
6395
  color: var(--fx-color-primary);
6367
6396
  line-height: 1;
6368
6397
  }
6398
+ /* marcador com ícone da fonte Fenix Icons (atributo icon no item) */
6399
+ .dot.fx-icon {
6400
+ font-family: var(--fx-icon-font, 'Fenix Icons');
6401
+ font-weight: normal;
6402
+ font-style: normal;
6403
+ font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
6404
+ -webkit-font-smoothing: antialiased;
6405
+ user-select: none;
6406
+ background: color-mix(in srgb, var(--fx-color-primary) 14%, transparent);
6407
+ border-radius: 50%;
6408
+ font-size: calc(var(--_marker) * 0.55);
6409
+ }
6369
6410
  .head {
6370
6411
  display: flex;
6371
6412
  align-items: baseline;
@@ -6741,7 +6782,24 @@ const KIND_ICON = {
6741
6782
  info: "i"
6742
6783
  };
6743
6784
  const CARD_CSS = `
6744
- :host { display: contents; }
6785
+ :host { display: contents; pointer-events: auto; }
6786
+ /* Modo explícito: sobrepõe os tokens herdados do tema global SOMENTE neste card. */
6787
+ :host([mode='dark']) {
6788
+ --fx-surface-background: #1e293b;
6789
+ --fx-text-default: #f1f5f9;
6790
+ --fx-text-muted: #94a3b8;
6791
+ --fx-border-default: #334155;
6792
+ --fx-shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
6793
+ --fx-surface-surface-hover: rgba(255, 255, 255, .08);
6794
+ }
6795
+ :host([mode='light']) {
6796
+ --fx-surface-background: #ffffff;
6797
+ --fx-text-default: #1e293b;
6798
+ --fx-text-muted: #64748b;
6799
+ --fx-border-default: #e2e8f0;
6800
+ --fx-shadow-lg: 0 10px 30px rgba(0, 0, 0, .14);
6801
+ --fx-surface-surface-hover: rgba(0, 0, 0, .05);
6802
+ }
6745
6803
  .fx-icon {
6746
6804
  font-family: var(--fx-icon-font, 'Fenix Icons');
6747
6805
  font-weight: normal;
@@ -6796,7 +6854,16 @@ class FxToast extends HTMLElement {
6796
6854
  this.attachShadow({ mode: "open" });
6797
6855
  }
6798
6856
  static get observedAttributes() {
6799
- return ["kind", "title", "message", "duration", "icon"];
6857
+ return ["kind", "title", "message", "duration", "icon", "mode"];
6858
+ }
6859
+ /** Esquema de cores forçado do card: 'light' | 'dark' | undefined (segue o tema). */
6860
+ get mode() {
6861
+ const m = this.getAttribute("mode");
6862
+ return m === "light" || m === "dark" ? m : void 0;
6863
+ }
6864
+ set mode(value) {
6865
+ if (value) this.setAttribute("mode", value);
6866
+ else this.removeAttribute("mode");
6800
6867
  }
6801
6868
  connectedCallback() {
6802
6869
  if (!this.shadowRoot.firstChild) __privateMethod(this, _FxToast_instances, render_fn).call(this);
@@ -6830,7 +6897,7 @@ render_fn = function() {
6830
6897
  const color = KIND_COLOR[kind] ?? KIND_COLOR.info;
6831
6898
  const iconName = this.getAttribute("icon");
6832
6899
  const isFxIcon = !!iconName && /^[a-z][a-z0-9_]*$/.test(iconName);
6833
- if (isFxIcon) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0);
6900
+ if (isFxIcon) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0, import.meta.url);
6834
6901
  const iconContent = isFxIcon ? iconName : KIND_ICON[kind] ?? KIND_ICON.info;
6835
6902
  this.shadowRoot.innerHTML = `
6836
6903
  <style>${CARD_CSS}</style>
@@ -6868,9 +6935,6 @@ function regionFor(position) {
6868
6935
  style.gap = "8px";
6869
6936
  style.zIndex = "1100";
6870
6937
  style.pointerEvents = "none";
6871
- new MutationObserver(() => {
6872
- region.querySelectorAll("*").forEach((c) => c.style.pointerEvents = "auto");
6873
- }).observe(region, { childList: true });
6874
6938
  document.body.appendChild(region);
6875
6939
  }
6876
6940
  return region;
@@ -6894,6 +6958,7 @@ class ToastApi {
6894
6958
  if (message) el.setAttribute("message", message);
6895
6959
  el.setAttribute("position", o.position ?? "top-right");
6896
6960
  el.setAttribute("duration", String(o.duration ?? 4e3));
6961
+ if (o.mode) el.setAttribute("mode", o.mode);
6897
6962
  regionFor(o.position ?? "top-right").appendChild(el);
6898
6963
  this.map.set(id, el);
6899
6964
  return id;
@@ -7592,7 +7657,7 @@ const _FxAlert = class _FxAlert extends FxElement {
7592
7657
  const variant = this.getAttr("variant", "info");
7593
7658
  const title = this.getAttr("title");
7594
7659
  const iconName = this.getAttr("icon");
7595
- if (isFenixIconName(iconName)) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0);
7660
+ if (isFenixIconName(iconName)) void __vitePreload(() => import("./fenix-ui2.esm.js"), true ? __vite__mapDeps([0,1]) : void 0, import.meta.url);
7596
7661
  const icons = {
7597
7662
  info: "ℹ",
7598
7663
  success: "✓",
@@ -10095,6 +10160,7 @@ const _FxAccordionPanel = class _FxAccordionPanel extends FxElement {
10095
10160
  disconnectedCallback() {
10096
10161
  this._mo?.disconnect();
10097
10162
  this._mo = null;
10163
+ super.disconnectedCallback();
10098
10164
  }
10099
10165
  render() {
10100
10166
  this.setTemplate(`