voodoojs 0.4.6 → 0.6.0

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.
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { core, sound, hotkey, palette, registerMask, unmask, applyMask, masks, mask, clearErrors, showFieldError, showFormErrors, messages, serializeForm, validate, validator, dialog, prompt, confirm, alert, modal, VoodooCollection, fromHtml, ready2, query, viewTransition, defineComponent, storage, ensurePalette, instances, storeNames, allStores } from './chunk-4HQEOXTK.js';
2
- export { VoodooCollection, alert, allStores, applyMask, cache, clearErrors, clipboard, confirm, cookie, createApp, createResource, defineComponent, dialog, ready as documentReady, enter, fadeIn, fadeOut, fromHtml, hotkey, instances, leave, mask, masks, modal, mountComponent, network, palette, prompt, query, ready2 as ready, registerMask, removeStore, createResource as resource, screen, serializeForm, session, showFormErrors, slideDown, slideUp, sound, efeitos as soundEffects, storage, store, storeNames, theme, toast, unmask, url, validate, validator, viewTransition, whenElement, whenReady } from './chunk-4HQEOXTK.js';
1
+ import { core, sound, hotkey, palette, registerMask, unmask, applyMask, masks, mask, clearErrors, showFieldError, showFormErrors, messages, serializeForm, validate, validator, dialog, prompt, confirm, alert, modal, VoodooCollection, fromHtml, ready2, query, viewTransition, defineComponent, storage, ensurePalette, instances, storeNames, allStores } from './chunk-CNHNFTPC.js';
2
+ export { VoodooCollection, alert, allStores, applyMask, cache, clearErrors, clipboard, confirm, cookie, createApp, createResource, defineComponent, dialog, ready as documentReady, enter, fadeIn, fadeOut, fromHtml, hotkey, instances, leave, mask, masks, modal, mountComponent, network, palette, prompt, query, ready2 as ready, registerMask, removeStore, createResource as resource, screen, serializeForm, session, showFormErrors, slideDown, slideUp, sound, efeitos as soundEffects, storage, store, storeNames, theme, toast, unmask, url, validate, validator, viewTransition, whenElement, whenReady } from './chunk-CNHNFTPC.js';
3
3
  export { gpu, reflectWgsl } from './chunk-JZIYRIY6.js';
4
4
  import { http } from './chunk-PQZEVFVZ.js';
5
5
  export { HttpError, http, request } from './chunk-PQZEVFVZ.js';
6
- import { devtoolsBus } from './chunk-RJUNPXQF.js';
7
- export { createSocket, devtoolsBus, socket, socketSupported } from './chunk-RJUNPXQF.js';
8
- import { magic, markSkipChildren, destroy, readAttr, walk, hadDirectives, getScope, collectDirectives, findScope, getEffectScopes, evaluateIn } from './chunk-5CKGDARU.js';
9
- export { Scope, VoodooRuntimeError, VoodooSyntaxError, addCleanup, allowedGlobals, clearParseCache, destroy, evaluate, findScope, getScope, magic, magics, parse, refresh, rootScope, start, stringify, tokenize, walk } from './chunk-5CKGDARU.js';
6
+ import { devtoolsBus } from './chunk-4LR3IFPX.js';
7
+ export { createSocket, devtoolsBus, socket, socketSupported } from './chunk-4LR3IFPX.js';
8
+ import { magic, markSkipChildren, destroy, readAttr, walk, hadDirectives, getScope, collectDirectives, findScope, getEffectScopes, evaluateIn } from './chunk-PHMBDPWH.js';
9
+ export { Scope, VoodooRuntimeError, VoodooSyntaxError, addCleanup, allowedGlobals, clearParseCache, destroy, evaluate, findScope, getScope, magic, magics, parse, refresh, rootScope, start, stringify, tokenize, walk } from './chunk-PHMBDPWH.js';
10
10
  import { reactive, warn, handleError, queuePostFlush, nextTick } from './chunk-NNU6WOOU.js';
11
11
  export { EffectScope, computed, effect, effectScope, flushSync, isReactive, markRaw, nextTick, reactive, ref, shallowRef, stop, toRaw, unref, watch, watchEffect } from './chunk-NNU6WOOU.js';
12
12
  import { warnAlias } from './chunk-A2UOVQBP.js';
@@ -2077,7 +2077,7 @@ function normalize(options, type) {
2077
2077
  const labels = fromOptions ? options.labels.map((label) => String(label)) : [];
2078
2078
  const series = [];
2079
2079
  const raw = options.data;
2080
- const singleName = options.name ?? "Valor";
2080
+ const singleName = options.name ?? "Value";
2081
2081
  if (typeof raw === "number") {
2082
2082
  series.push({ name: singleName, values: [raw], xs: null, color: palette2[0] });
2083
2083
  } else if (Array.isArray(raw) && raw.length > 0) {
@@ -2807,7 +2807,7 @@ function draw(state2) {
2807
2807
  const palette2 = options.colors && options.colors.length > 0 ? options.colors : CHART_COLORS;
2808
2808
  const format = options.format ?? "number";
2809
2809
  const width = Math.max(160, Math.round(el.clientWidth || options.width || 640));
2810
- const height = Math.max(48, Math.round(options.height ?? defaultHeight(type)));
2810
+ const height = Math.max(48, Math.round(options.height ?? (el.clientHeight || defaultHeight(type))));
2811
2811
  state2.lastWidth = width;
2812
2812
  state2.viewWidth = width;
2813
2813
  state2.viewHeight = height;
@@ -3174,7 +3174,7 @@ var CSS2 = `
3174
3174
  @keyframes v-shimmer{0%{background-position:-180% 0}100%{background-position:180% 0}}
3175
3175
  @keyframes v-indeterminate{0%{transform:translateX(-100%)}100%{transform:translateX(340%)}}
3176
3176
 
3177
- /* ------------------------------------------------------------------ botao */
3177
+ /* ----------------------------------------------------------------- button */
3178
3178
  .v-btn{appearance:none;-webkit-appearance:none;position:relative;display:inline-flex;
3179
3179
  align-items:center;justify-content:center;gap:8px;vertical-align:middle;white-space:nowrap;
3180
3180
  font-family:var(--v-font-sans);font-weight:600;line-height:1;text-decoration:none;
@@ -3218,7 +3218,7 @@ var CSS2 = `
3218
3218
  .v-btn-spin{width:1em;height:1em;border-radius:50%;border:2px solid currentColor;
3219
3219
  border-top-color:transparent;animation:v-spin .7s linear infinite;flex:none}
3220
3220
 
3221
- /* ------------------------------------------------------- botao de icone */
3221
+ /* ------------------------------------------------------------ icon button */
3222
3222
  .v-icon-btn{appearance:none;-webkit-appearance:none;display:inline-grid;place-items:center;
3223
3223
  border:1px solid transparent;border-radius:var(--v-radius-sm);cursor:pointer;
3224
3224
  font-family:var(--v-font-sans);
@@ -3263,7 +3263,7 @@ var CSS2 = `
3263
3263
  .v-card-foot:empty{display:none}
3264
3264
  .v-card[data-padded="false"] .v-card-body{padding:0}
3265
3265
 
3266
- /* ------------------------------------------------------------ formulario */
3266
+ /* ------------------------------------------------------------------- form */
3267
3267
  .v-field{display:flex;flex-direction:column;gap:6px;font-family:var(--v-font-sans);min-width:0}
3268
3268
  .v-label{display:inline-flex;align-items:center;gap:4px;font-size:13px;font-weight:600;
3269
3269
  line-height:1.3;color:var(--v-text)}
@@ -3342,7 +3342,7 @@ var CSS2 = `
3342
3342
  .v-select-opt.is-selected .v-select-check{opacity:1}
3343
3343
  .v-select-empty{padding:14px 10px;text-align:center;font-size:13.5px;color:var(--v-text-muted)}
3344
3344
 
3345
- /* -------------------------------------------- caixa, radio e interruptor */
3345
+ /* --------------------------------------------- checkbox, radio and switch */
3346
3346
  .v-check{display:inline-flex;align-items:flex-start;gap:9px;cursor:pointer;
3347
3347
  font-family:var(--v-font-sans);font-size:14px;line-height:1.45;color:var(--v-text)}
3348
3348
  .v-check[data-disabled="true"]{cursor:not-allowed;opacity:.6}
@@ -3379,7 +3379,7 @@ var CSS2 = `
3379
3379
  .v-check[data-size="sm"] .v-switch-thumb{width:16px;height:16px}
3380
3380
  .v-check[data-size="sm"] .v-check-native:checked+.v-switch-track .v-switch-thumb{transform:translateX(14px)}
3381
3381
 
3382
- /* --------------------------------------------------- selo, etiqueta, alerta */
3382
+ /* ------------------------------------------------------ badge, tag, alert */
3383
3383
  .v-badge{display:inline-flex;align-items:center;gap:5px;font-family:var(--v-font-sans);
3384
3384
  font-weight:600;line-height:1;border-radius:var(--v-radius-full);border:1px solid transparent;
3385
3385
  white-space:nowrap;vertical-align:middle}
@@ -3456,7 +3456,7 @@ var CSS2 = `
3456
3456
  .v-avatar-status[data-status="busy"]{background:var(--v-danger)}
3457
3457
  .v-avatar-status[data-status="away"]{background:var(--v-warning)}
3458
3458
 
3459
- /* ------------------------------------------------- spinner e esqueleto */
3459
+ /* --------------------------------------------------- spinner and skeleton */
3460
3460
  .v-spinner{display:inline-block;border-radius:50%;border-style:solid;border-color:var(--v-border);
3461
3461
  border-top-color:var(--v-primary);animation:v-spin .7s linear infinite;vertical-align:middle}
3462
3462
  .v-spinner[data-tone="accent"]{border-top-color:var(--v-accent)}
@@ -3473,7 +3473,7 @@ var CSS2 = `
3473
3473
  .v-skeleton[data-circle="true"]{border-radius:var(--v-radius-full)}
3474
3474
  .v-skeleton-stack{display:flex;flex-direction:column;gap:8px}
3475
3475
 
3476
- /* ------------------------------------------------------------- progresso */
3476
+ /* --------------------------------------------------------------- progress */
3477
3477
  .v-progress{font-family:var(--v-font-sans);display:flex;flex-direction:column;gap:6px}
3478
3478
  .v-progress-head{display:flex;justify-content:space-between;gap:12px;font-size:13px;color:var(--v-text-muted)}
3479
3479
  .v-progress-value{font-weight:650;color:var(--v-text)}
@@ -3490,7 +3490,7 @@ var CSS2 = `
3490
3490
  .v-progress[data-tone="danger"] .v-progress-bar{background:var(--v-danger)}
3491
3491
  .v-progress[data-indeterminate="true"] .v-progress-bar{width:30% !important;animation:v-indeterminate 1.3s var(--v-ease) infinite}
3492
3492
 
3493
- /* ------------------------------------------------------------- divisor */
3493
+ /* ---------------------------------------------------------------- divider */
3494
3494
  .v-divider{display:flex;align-items:center;gap:12px;color:var(--v-text-soft);
3495
3495
  font-family:var(--v-font-sans);font-size:12.5px;font-weight:600;margin:16px 0}
3496
3496
  .v-divider::before,.v-divider::after{content:"";flex:1;height:1px;background:var(--v-border)}
@@ -3498,7 +3498,7 @@ var CSS2 = `
3498
3498
  .v-divider[data-vertical="true"]{flex-direction:column;margin:0 16px;align-self:stretch;height:auto}
3499
3499
  .v-divider[data-vertical="true"]::before,.v-divider[data-vertical="true"]::after{width:1px;height:auto;flex:1}
3500
3500
 
3501
- /* -------------------------------------------------------------- tabela */
3501
+ /* ------------------------------------------------------------------ table */
3502
3502
  .v-table-wrap{width:100%;overflow-x:auto;background:var(--v-surface);border:1px solid var(--v-border);
3503
3503
  border-radius:var(--v-radius);font-family:var(--v-font-sans)}
3504
3504
  .v-table{width:100%;border-collapse:collapse;font-size:14px;color:var(--v-text)}
@@ -3519,7 +3519,7 @@ var CSS2 = `
3519
3519
  .v-th[aria-sort="ascending"] .v-th-arrow,.v-th[aria-sort="descending"] .v-th-arrow{opacity:1;color:var(--v-primary)}
3520
3520
  .v-table-empty{text-align:center;color:var(--v-text-muted);padding:34px 14px;font-size:14px}
3521
3521
 
3522
- /* ---------------------------------------------------------- paginacao */
3522
+ /* ------------------------------------------------------------- pagination */
3523
3523
  .v-pagination{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-family:var(--v-font-sans)}
3524
3524
  .v-page{appearance:none;min-width:34px;height:34px;padding:0 9px;display:inline-grid;place-items:center;
3525
3525
  background:transparent;border:1px solid transparent;border-radius:var(--v-radius-sm);
@@ -3531,7 +3531,7 @@ var CSS2 = `
3531
3531
  .v-page[aria-current="page"]{background:var(--v-primary);border-color:var(--v-primary);color:var(--v-primary-contrast)}
3532
3532
  .v-page-gap{min-width:24px;text-align:center;color:var(--v-text-soft);user-select:none}
3533
3533
 
3534
- /* ----------------------------------------------------------- migalhas */
3534
+ /* ------------------------------------------------------------- breadcrumb */
3535
3535
  .v-breadcrumb{font-family:var(--v-font-sans);font-size:13.5px}
3536
3536
  .v-breadcrumb-list{list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0;padding:0}
3537
3537
  .v-breadcrumb-item{display:inline-flex;align-items:center;gap:6px;color:var(--v-text-muted)}
@@ -3541,7 +3541,7 @@ var CSS2 = `
3541
3541
  .v-breadcrumb-item[aria-current="page"]{color:var(--v-text);font-weight:600}
3542
3542
  .v-breadcrumb-sep{color:var(--v-text-soft);user-select:none}
3543
3543
 
3544
- /* ------------------------------------------------------------ metrica */
3544
+ /* ------------------------------------------------------------------- stat */
3545
3545
  .v-stat{display:flex;gap:14px;align-items:flex-start;padding:16px 18px;background:var(--v-surface);
3546
3546
  border:1px solid var(--v-border);border-radius:var(--v-radius);font-family:var(--v-font-sans)}
3547
3547
  .v-stat-icon{flex:none;width:40px;height:40px;display:grid;place-items:center;font-size:19px;
@@ -3559,7 +3559,7 @@ var CSS2 = `
3559
3559
  .v-stat-delta[data-dir="flat"]{background:var(--v-surface-3);color:var(--v-text-muted)}
3560
3560
  .v-stat-hint{font-size:12.5px;color:var(--v-text-muted)}
3561
3561
 
3562
- /* ------------------------------------------------------- estado vazio */
3562
+ /* ------------------------------------------------------------ empty state */
3563
3563
  .v-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px;
3564
3564
  padding:44px 22px;font-family:var(--v-font-sans);color:var(--v-text)}
3565
3565
  .v-empty-icon{width:58px;height:58px;display:grid;place-items:center;font-size:27px;
@@ -3569,7 +3569,7 @@ var CSS2 = `
3569
3569
  .v-empty-actions{margin-top:6px;display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
3570
3570
  .v-empty-actions:empty{display:none}
3571
3571
 
3572
- /* ----------------------------------------------------------- linha do tempo */
3572
+ /* --------------------------------------------------------------- timeline */
3573
3573
  .v-timeline{list-style:none;margin:0;padding:0;font-family:var(--v-font-sans);
3574
3574
  display:flex;flex-direction:column}
3575
3575
  .v-timeline-item{position:relative;display:flex;gap:14px;padding-bottom:20px}
@@ -3589,7 +3589,7 @@ var CSS2 = `
3589
3589
  .v-timeline-desc{margin:3px 0 0;font-size:13.5px;line-height:1.55;color:var(--v-text-muted)}
3590
3590
  .v-timeline-time{display:block;margin-top:3px;font-size:12px;color:var(--v-text-soft)}
3591
3591
 
3592
- /* ---------------------------------------------------------------- passos */
3592
+ /* ------------------------------------------------------------------ steps */
3593
3593
  .v-steps{display:flex;gap:0;font-family:var(--v-font-sans);list-style:none;margin:0;padding:0}
3594
3594
  .v-steps[data-vertical="true"]{flex-direction:column;gap:4px}
3595
3595
  .v-step{flex:1;display:flex;align-items:flex-start;gap:10px;min-width:0;position:relative;padding-right:12px}
@@ -3608,7 +3608,7 @@ var CSS2 = `
3608
3608
  .v-steps[data-vertical="true"] .v-step-line{left:13px;right:auto;top:30px;bottom:2px;width:2px;height:auto}
3609
3609
  .v-step:last-child .v-step-line{display:none}
3610
3610
 
3611
- /* ------------------------------------------------------------ avaliacao */
3611
+ /* ----------------------------------------------------------------- rating */
3612
3612
  .v-rating{display:inline-flex;align-items:center;gap:6px;font-family:var(--v-font-sans)}
3613
3613
  .v-rating-stars{display:inline-flex;gap:2px}
3614
3614
  .v-star{appearance:none;background:none;border:0;padding:2px;cursor:pointer;line-height:0;
@@ -3635,7 +3635,7 @@ var CSS2 = `
3635
3635
  .v-tip[data-placement="right"]{left:calc(100% + 8px);top:50%;translate:0 -50%}
3636
3636
  .v-tipwrap:hover .v-tip,.v-tipwrap:focus-within .v-tip{opacity:1;transform:none}
3637
3637
 
3638
- /* ------------------------------------------------------------ codigo */
3638
+ /* ------------------------------------------------------------------- code */
3639
3639
  .v-code{position:relative;background:var(--v-surface-inset);border:1px solid var(--v-border);
3640
3640
  border-radius:var(--v-radius);overflow:hidden;font-family:var(--v-font-mono)}
3641
3641
  .v-code-head{display:flex;align-items:center;justify-content:space-between;gap:10px;
@@ -4636,7 +4636,7 @@ register("v-table", {
4636
4636
  props: {
4637
4637
  columns: { type: "any", default: "" },
4638
4638
  rows: { type: "any", default: "" },
4639
- empty: { type: "string", default: "Nenhum registro encontrado" },
4639
+ empty: { type: "string", default: "No records found" },
4640
4640
  sortable: { type: "any", default: true },
4641
4641
  dense: BOOL,
4642
4642
  striped: BOOL,
@@ -4746,9 +4746,9 @@ register("v-pagination", {
4746
4746
  total: { type: "number", default: 0 },
4747
4747
  perPage: { type: "number", default: 10 },
4748
4748
  siblings: { type: "number", default: 1 },
4749
- previousLabel: { type: "string", default: "Anterior" },
4750
- nextLabel: { type: "string", default: "Pr\xF3xima" },
4751
- ariaLabel: { type: "string", default: "Pagina\xE7\xE3o" }
4749
+ previousLabel: { type: "string", default: "Previous" },
4750
+ nextLabel: { type: "string", default: "Next" },
4751
+ ariaLabel: { type: "string", default: "Pagination" }
4752
4752
  },
4753
4753
  computed: {
4754
4754
  lastPage() {
@@ -4762,7 +4762,7 @@ register("v-pagination", {
4762
4762
  const value = Number(this.page) || 1;
4763
4763
  return Math.min(Math.max(1, Math.round(value)), this.lastPage);
4764
4764
  },
4765
- /** Numeros visiveis, com `0` marcando as reticencias. */
4765
+ /** Visible page numbers, with `0` marking the ellipsis. */
4766
4766
  items() {
4767
4767
  const last = this.lastPage;
4768
4768
  const current = this.currentPage;
@@ -4807,7 +4807,7 @@ register("v-pagination", {
4807
4807
  <template v-for="(item, index) in items" :key="index">
4808
4808
  <span class="v-page-gap" v-if="item === 0" aria-hidden="true">...</span>
4809
4809
  <button type="button" class="v-page" v-if="item !== 0" :aria-current="isCurrent(item)"
4810
- :aria-label="'P\xE1gina ' + item" v-click="go(item)" v-text="item"></button>
4810
+ :aria-label="'Page ' + item" v-click="go(item)" v-text="item"></button>
4811
4811
  </template>
4812
4812
  <button type="button" class="v-page" :disabled="currentPage >= lastPage"
4813
4813
  :aria-label="nextLabel" v-click="go(currentPage + 1)" v-html="svgIcon('chevron-right')"></button>
@@ -4839,7 +4839,7 @@ register("v-breadcrumb", {
4839
4839
  props: {
4840
4840
  items: { type: "any", default: "" },
4841
4841
  separator: { type: "string", default: "/" },
4842
- ariaLabel: { type: "string", default: "Trilha de navega\xE7\xE3o" }
4842
+ ariaLabel: { type: "string", default: "Breadcrumb" }
4843
4843
  },
4844
4844
  computed: {
4845
4845
  crumbs() {
@@ -4872,7 +4872,7 @@ register("v-stat", {
4872
4872
  hint: TEXT,
4873
4873
  icon: TEXT,
4874
4874
  suffix: { type: "string", default: "%" },
4875
- /** Quando `true`, uma variacao negativa e considerada positiva. */
4875
+ /** When `true`, a negative change counts as positive. */
4876
4876
  inverted: BOOL
4877
4877
  },
4878
4878
  computed: {
@@ -4925,7 +4925,7 @@ register("v-stat", {
4925
4925
  register("v-empty-state", {
4926
4926
  props: {
4927
4927
  icon: { type: "string", default: "inbox" },
4928
- title: { type: "string", default: "Nada por aqui" },
4928
+ title: { type: "string", default: "Nothing here yet" },
4929
4929
  description: TEXT
4930
4930
  },
4931
4931
  template: `
@@ -4996,7 +4996,7 @@ register("v-steps", {
4996
4996
  steps: { type: "any", default: "" },
4997
4997
  current: { type: "number", default: 0 },
4998
4998
  vertical: BOOL,
4999
- ariaLabel: { type: "string", default: "Etapas" }
4999
+ ariaLabel: { type: "string", default: "Steps" }
5000
5000
  },
5001
5001
  computed: {
5002
5002
  ...flags("vertical"),
@@ -5040,7 +5040,7 @@ register("v-rating", {
5040
5040
  value: { type: "number", default: 0 },
5041
5041
  max: { type: "number", default: 5 },
5042
5042
  size: { type: "string", default: "md" },
5043
- label: { type: "string", default: "Avalia\xE7\xE3o" },
5043
+ label: { type: "string", default: "Rating" },
5044
5044
  readonly: BOOL,
5045
5045
  disabled: BOOL,
5046
5046
  showValue: BOOL,
@@ -5066,7 +5066,7 @@ register("v-rating", {
5066
5066
  return this.hovered > 0 ? this.hovered : this.score;
5067
5067
  },
5068
5068
  valueText() {
5069
- return `${this.score} de ${this.total}`;
5069
+ return `${this.score} of ${this.total}`;
5070
5070
  }
5071
5071
  },
5072
5072
  methods: {
@@ -5122,7 +5122,7 @@ register("v-rating", {
5122
5122
  :tabindex="locked ? -1 : 0" :aria-readonly="locked" v-keydown="onKey" v-mouseleave="reset">
5123
5123
  <span class="v-rating-stars">
5124
5124
  <button type="button" class="v-star" v-for="index in total" :key="index"
5125
- :data-on="isOn(index)" :disabled="locked" :aria-label="index + ' de ' + total"
5125
+ :data-on="isOn(index)" :disabled="locked" :aria-label="index + ' of ' + total"
5126
5126
  :tabindex="-1" v-click="pick(index)" v-mouseenter="preview(index)"
5127
5127
  v-html="svgIcon('star')"></button>
5128
5128
  </span>
@@ -5190,8 +5190,8 @@ register("v-code-block", {
5190
5190
  code: TEXT,
5191
5191
  language: TEXT,
5192
5192
  filename: TEXT,
5193
- copyLabel: { type: "string", default: "Copiar" },
5194
- copiedLabel: { type: "string", default: "Copiado" },
5193
+ copyLabel: { type: "string", default: "Copy" },
5194
+ copiedLabel: { type: "string", default: "Copied" },
5195
5195
  wrap: BOOL
5196
5196
  },
5197
5197
  state() {
@@ -6491,14 +6491,14 @@ function xray(force) {
6491
6491
  }
6492
6492
 
6493
6493
  // src/devtools/launcher.ts
6494
- var POSICAO_KEY = "voodoo:devtools:widget-position";
6495
- var ESCONDIDO_KEY = "voodoo:devtools:widget-hidden";
6496
- var LIMIAR_ARRASTO = 4;
6494
+ var POSITION_KEY = "voodoo:devtools:widget-position";
6495
+ var HIDDEN_KEY = "voodoo:devtools:widget-hidden";
6496
+ var DRAG_THRESHOLD = 4;
6497
6497
  var refs2 = null;
6498
- var montado = false;
6499
- var timerContador = 0;
6500
- var timerPulso = 0;
6501
- var desligar = [];
6498
+ var mounted = false;
6499
+ var counterTimer = 0;
6500
+ var pulseTimer = 0;
6501
+ var teardown = [];
6502
6502
  var WIDGET_CSS = `
6503
6503
  .v-devtools-widget{
6504
6504
  all: initial;
@@ -6631,220 +6631,220 @@ var WIDGET_CSS = `
6631
6631
  .v-devtools-btn:hover{transform:none}
6632
6632
  }
6633
6633
  `;
6634
- var MARCA = `<svg class="v-devtools-mark" viewBox="0 0 24 24" fill="none" aria-hidden="true">
6634
+ var MARK = `<svg class="v-devtools-mark" viewBox="0 0 24 24" fill="none" aria-hidden="true">
6635
6635
  <path d="M4 4l8 16 8-16" stroke="#6D3BF5" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/>
6636
6636
  <circle cx="12" cy="7.5" r="2" fill="#FF3D8B"/>
6637
6637
  </svg>`;
6638
- function lerPosicao() {
6638
+ function readPosition() {
6639
6639
  try {
6640
- const bruto = localStorage.getItem(POSICAO_KEY);
6641
- if (!bruto) return null;
6642
- const valor = JSON.parse(bruto);
6643
- if (typeof valor?.x !== "number" || typeof valor?.y !== "number") return null;
6644
- return valor;
6640
+ const raw = localStorage.getItem(POSITION_KEY);
6641
+ if (!raw) return null;
6642
+ const value = JSON.parse(raw);
6643
+ if (typeof value?.x !== "number" || typeof value?.y !== "number") return null;
6644
+ return value;
6645
6645
  } catch {
6646
6646
  return null;
6647
6647
  }
6648
6648
  }
6649
- function gravarPosicao(pos) {
6649
+ function writePosition(pos) {
6650
6650
  try {
6651
- localStorage.setItem(POSICAO_KEY, JSON.stringify(pos));
6651
+ localStorage.setItem(POSITION_KEY, JSON.stringify(pos));
6652
6652
  } catch {
6653
6653
  }
6654
6654
  }
6655
- function aplicarPosicao(raiz, pos) {
6656
- const largura = raiz.offsetWidth || 120;
6657
- const altura = raiz.offsetHeight || 38;
6658
- const x = Math.min(Math.max(8, pos.x), Math.max(8, window.innerWidth - largura - 8));
6659
- const y = Math.min(Math.max(8, pos.y), Math.max(8, window.innerHeight - altura - 8));
6660
- raiz.style.left = `${x}px`;
6661
- raiz.style.top = `${y}px`;
6662
- raiz.style.right = "auto";
6663
- raiz.style.bottom = "auto";
6664
- }
6665
- function construir() {
6666
- const raiz = document.createElement("div");
6667
- raiz.className = "v-devtools-widget";
6668
- raiz.setAttribute("data-voodoo-devtools", "widget");
6669
- const botao = document.createElement("button");
6670
- botao.type = "button";
6671
- botao.className = "v-devtools-btn";
6672
- botao.setAttribute("aria-label", "Open Voodoo devtools (Ctrl+Shift+X)");
6673
- botao.setAttribute("aria-pressed", "false");
6674
- botao.title = "Voodoo devtools \u2014 click to inspect, drag to move (Ctrl+Shift+X)";
6675
- botao.innerHTML = MARCA;
6676
- const rotulo = document.createElement("span");
6677
- rotulo.className = "v-devtools-label";
6678
- rotulo.textContent = "Voodoo";
6679
- const contador = document.createElement("span");
6680
- contador.className = "v-devtools-count";
6681
- contador.textContent = "0";
6682
- const pulso = document.createElement("span");
6683
- pulso.className = "v-devtools-pulse";
6684
- pulso.setAttribute("data-on", "false");
6685
- botao.append(rotulo, contador, pulso);
6686
- const fechar = document.createElement("button");
6687
- fechar.type = "button";
6688
- fechar.className = "v-devtools-close";
6689
- fechar.setAttribute("aria-label", "Hide the devtools widget in this tab");
6690
- fechar.title = "Hide in this tab";
6691
- fechar.textContent = "\xD7";
6692
- raiz.append(botao, fechar);
6693
- document.body.appendChild(raiz);
6694
- const salva = lerPosicao();
6695
- if (salva) {
6696
- aplicarPosicao(raiz, salva);
6655
+ function applyPosition(root, pos) {
6656
+ const width = root.offsetWidth || 120;
6657
+ const height = root.offsetHeight || 38;
6658
+ const x = Math.min(Math.max(8, pos.x), Math.max(8, window.innerWidth - width - 8));
6659
+ const y = Math.min(Math.max(8, pos.y), Math.max(8, window.innerHeight - height - 8));
6660
+ root.style.left = `${x}px`;
6661
+ root.style.top = `${y}px`;
6662
+ root.style.right = "auto";
6663
+ root.style.bottom = "auto";
6664
+ }
6665
+ function build() {
6666
+ const root = document.createElement("div");
6667
+ root.className = "v-devtools-widget";
6668
+ root.setAttribute("data-voodoo-devtools", "widget");
6669
+ const button = document.createElement("button");
6670
+ button.type = "button";
6671
+ button.className = "v-devtools-btn";
6672
+ button.setAttribute("aria-label", "Open Voodoo devtools (Ctrl+Shift+X)");
6673
+ button.setAttribute("aria-pressed", "false");
6674
+ button.title = "Voodoo devtools \u2014 click to inspect, drag to move (Ctrl+Shift+X)";
6675
+ button.innerHTML = MARK;
6676
+ const label = document.createElement("span");
6677
+ label.className = "v-devtools-label";
6678
+ label.textContent = "Voodoo";
6679
+ const counter = document.createElement("span");
6680
+ counter.className = "v-devtools-count";
6681
+ counter.textContent = "0";
6682
+ const pulse = document.createElement("span");
6683
+ pulse.className = "v-devtools-pulse";
6684
+ pulse.setAttribute("data-on", "false");
6685
+ button.append(label, counter, pulse);
6686
+ const close = document.createElement("button");
6687
+ close.type = "button";
6688
+ close.className = "v-devtools-close";
6689
+ close.setAttribute("aria-label", "Hide the devtools widget in this tab");
6690
+ close.title = "Hide in this tab";
6691
+ close.textContent = "\xD7";
6692
+ root.append(button, close);
6693
+ document.body.appendChild(root);
6694
+ const saved = readPosition();
6695
+ if (saved) {
6696
+ applyPosition(root, saved);
6697
6697
  } else {
6698
- raiz.style.right = "16px";
6699
- raiz.style.bottom = "16px";
6700
- }
6701
- return { raiz, botao, pulso, contador, fechar };
6702
- }
6703
- function ligarArrasto(refs3, aoClicar) {
6704
- let arrastando = false;
6705
- let moveu = false;
6706
- let deslocX = 0;
6707
- let deslocY = 0;
6708
- let inicioX = 0;
6709
- let inicioY = 0;
6710
- const aoDescer = (evento) => {
6711
- if (evento.button !== 0) return;
6712
- const caixa = refs3.raiz.getBoundingClientRect();
6713
- arrastando = true;
6714
- moveu = false;
6715
- inicioX = evento.clientX;
6716
- inicioY = evento.clientY;
6717
- deslocX = evento.clientX - caixa.left;
6718
- deslocY = evento.clientY - caixa.top;
6719
- refs3.botao.setPointerCapture?.(evento.pointerId);
6698
+ root.style.right = "16px";
6699
+ root.style.bottom = "16px";
6700
+ }
6701
+ return { root, button, pulse, counter, close };
6702
+ }
6703
+ function enableDrag(refs3, onClick) {
6704
+ let dragging = false;
6705
+ let moved = false;
6706
+ let offsetX = 0;
6707
+ let offsetY = 0;
6708
+ let startX = 0;
6709
+ let startY = 0;
6710
+ const onPointerDown = (event) => {
6711
+ if (event.button !== 0) return;
6712
+ const box = refs3.root.getBoundingClientRect();
6713
+ dragging = true;
6714
+ moved = false;
6715
+ startX = event.clientX;
6716
+ startY = event.clientY;
6717
+ offsetX = event.clientX - box.left;
6718
+ offsetY = event.clientY - box.top;
6719
+ refs3.button.setPointerCapture?.(event.pointerId);
6720
6720
  };
6721
- const aoMover = (evento) => {
6722
- if (!arrastando) return;
6723
- const distancia = Math.hypot(evento.clientX - inicioX, evento.clientY - inicioY);
6724
- if (!moveu && distancia < LIMIAR_ARRASTO) return;
6725
- moveu = true;
6726
- evento.preventDefault();
6727
- aplicarPosicao(refs3.raiz, { x: evento.clientX - deslocX, y: evento.clientY - deslocY });
6721
+ const onPointerMove2 = (event) => {
6722
+ if (!dragging) return;
6723
+ const distance = Math.hypot(event.clientX - startX, event.clientY - startY);
6724
+ if (!moved && distance < DRAG_THRESHOLD) return;
6725
+ moved = true;
6726
+ event.preventDefault();
6727
+ applyPosition(refs3.root, { x: event.clientX - offsetX, y: event.clientY - offsetY });
6728
6728
  };
6729
- const aoSubir = (evento) => {
6730
- if (!arrastando) return;
6731
- arrastando = false;
6732
- refs3.botao.releasePointerCapture?.(evento.pointerId);
6733
- if (!moveu) {
6734
- aoClicar();
6729
+ const onPointerUp = (event) => {
6730
+ if (!dragging) return;
6731
+ dragging = false;
6732
+ refs3.button.releasePointerCapture?.(event.pointerId);
6733
+ if (!moved) {
6734
+ onClick();
6735
6735
  return;
6736
6736
  }
6737
- const caixa = refs3.raiz.getBoundingClientRect();
6738
- gravarPosicao({ x: caixa.left, y: caixa.top });
6737
+ const box = refs3.root.getBoundingClientRect();
6738
+ writePosition({ x: box.left, y: box.top });
6739
6739
  };
6740
- const aoTeclar = (evento) => {
6741
- if (evento.key !== "Enter" && evento.key !== " ") return;
6742
- evento.preventDefault();
6743
- aoClicar();
6740
+ const onKeyDown = (event) => {
6741
+ if (event.key !== "Enter" && event.key !== " ") return;
6742
+ event.preventDefault();
6743
+ onClick();
6744
6744
  };
6745
- const aoRedimensionar = () => {
6746
- const caixa = refs3.raiz.getBoundingClientRect();
6747
- if (refs3.raiz.style.left) aplicarPosicao(refs3.raiz, { x: caixa.left, y: caixa.top });
6745
+ const onResize = () => {
6746
+ const box = refs3.root.getBoundingClientRect();
6747
+ if (refs3.root.style.left) applyPosition(refs3.root, { x: box.left, y: box.top });
6748
6748
  };
6749
- refs3.botao.addEventListener("pointerdown", aoDescer);
6750
- refs3.botao.addEventListener("pointermove", aoMover);
6751
- refs3.botao.addEventListener("pointerup", aoSubir);
6752
- refs3.botao.addEventListener("pointercancel", aoSubir);
6753
- refs3.botao.addEventListener("keydown", aoTeclar);
6754
- window.addEventListener("resize", aoRedimensionar);
6749
+ refs3.button.addEventListener("pointerdown", onPointerDown);
6750
+ refs3.button.addEventListener("pointermove", onPointerMove2);
6751
+ refs3.button.addEventListener("pointerup", onPointerUp);
6752
+ refs3.button.addEventListener("pointercancel", onPointerUp);
6753
+ refs3.button.addEventListener("keydown", onKeyDown);
6754
+ window.addEventListener("resize", onResize);
6755
6755
  return () => {
6756
- refs3.botao.removeEventListener("pointerdown", aoDescer);
6757
- refs3.botao.removeEventListener("pointermove", aoMover);
6758
- refs3.botao.removeEventListener("pointerup", aoSubir);
6759
- refs3.botao.removeEventListener("pointercancel", aoSubir);
6760
- refs3.botao.removeEventListener("keydown", aoTeclar);
6761
- window.removeEventListener("resize", aoRedimensionar);
6756
+ refs3.button.removeEventListener("pointerdown", onPointerDown);
6757
+ refs3.button.removeEventListener("pointermove", onPointerMove2);
6758
+ refs3.button.removeEventListener("pointerup", onPointerUp);
6759
+ refs3.button.removeEventListener("pointercancel", onPointerUp);
6760
+ refs3.button.removeEventListener("keydown", onKeyDown);
6761
+ window.removeEventListener("resize", onResize);
6762
6762
  };
6763
6763
  }
6764
- function piscar() {
6764
+ function blink() {
6765
6765
  if (!refs2) return;
6766
- refs2.pulso.setAttribute("data-on", "true");
6767
- window.clearTimeout(timerPulso);
6768
- timerPulso = window.setTimeout(() => {
6769
- refs2?.pulso.setAttribute("data-on", "false");
6766
+ refs2.pulse.setAttribute("data-on", "true");
6767
+ window.clearTimeout(pulseTimer);
6768
+ pulseTimer = window.setTimeout(() => {
6769
+ refs2?.pulse.setAttribute("data-on", "false");
6770
6770
  }, 320);
6771
6771
  }
6772
- function atualizarContador() {
6772
+ function updateCounter() {
6773
6773
  if (!refs2) return;
6774
6774
  const total = instances.size;
6775
- const texto = total === 1 ? "1 component" : `${total} components`;
6776
- if (refs2.contador.textContent !== texto) refs2.contador.textContent = texto;
6775
+ const text = total === 1 ? "1 component" : `${total} components`;
6776
+ if (refs2.counter.textContent !== text) refs2.counter.textContent = text;
6777
6777
  }
6778
6778
  function mountDevtoolsWidget() {
6779
- if (montado || typeof document === "undefined" || !document.body) return;
6779
+ if (mounted || typeof document === "undefined" || !document.body) return;
6780
6780
  try {
6781
- if (sessionStorage.getItem(ESCONDIDO_KEY) === "1") return;
6781
+ if (sessionStorage.getItem(HIDDEN_KEY) === "1") return;
6782
6782
  } catch {
6783
6783
  }
6784
- montado = true;
6784
+ mounted = true;
6785
6785
  injectStyle("devtools-widget", WIDGET_CSS);
6786
- refs2 = construir();
6787
- const alternar = () => {
6788
- const ligado = xray();
6789
- refs2?.raiz.setAttribute("data-active", String(ligado));
6790
- refs2?.botao.setAttribute("aria-pressed", String(ligado));
6786
+ refs2 = build();
6787
+ const toggle = () => {
6788
+ const enabled2 = xray();
6789
+ refs2?.root.setAttribute("data-active", String(enabled2));
6790
+ refs2?.button.setAttribute("aria-pressed", String(enabled2));
6791
6791
  };
6792
- desligar.push(ligarArrasto(refs2, alternar));
6793
- const aoFechar = (evento) => {
6794
- evento.stopPropagation();
6792
+ teardown.push(enableDrag(refs2, toggle));
6793
+ const onClose = (event) => {
6794
+ event.stopPropagation();
6795
6795
  try {
6796
- sessionStorage.setItem(ESCONDIDO_KEY, "1");
6796
+ sessionStorage.setItem(HIDDEN_KEY, "1");
6797
6797
  } catch {
6798
6798
  }
6799
6799
  unmountDevtoolsWidget();
6800
6800
  console.info("[Voodoo] devtools widget hidden. Use V.devtoolsWidget(true) to bring back.");
6801
6801
  };
6802
- refs2.fechar.addEventListener("click", aoFechar);
6803
- desligar.push(() => refs2?.fechar.removeEventListener("click", aoFechar));
6804
- const aoTeclarGlobal = () => {
6805
- const ligado = isXrayEnabled();
6806
- refs2?.raiz.setAttribute("data-active", String(ligado));
6807
- refs2?.botao.setAttribute("aria-pressed", String(ligado));
6802
+ refs2.close.addEventListener("click", onClose);
6803
+ teardown.push(() => refs2?.close.removeEventListener("click", onClose));
6804
+ const onGlobalKeyUp = () => {
6805
+ const enabled2 = isXrayEnabled();
6806
+ refs2?.root.setAttribute("data-active", String(enabled2));
6807
+ refs2?.button.setAttribute("aria-pressed", String(enabled2));
6808
6808
  };
6809
- document.addEventListener("keyup", aoTeclarGlobal);
6810
- desligar.push(() => document.removeEventListener("keyup", aoTeclarGlobal));
6811
- for (const tipo of ["network", "event", "navigation", "update"]) {
6812
- desligar.push(devtoolsBus.on(tipo, piscar));
6809
+ document.addEventListener("keyup", onGlobalKeyUp);
6810
+ teardown.push(() => document.removeEventListener("keyup", onGlobalKeyUp));
6811
+ for (const type of ["network", "event", "navigation", "update"]) {
6812
+ teardown.push(devtoolsBus.on(type, blink));
6813
6813
  }
6814
- atualizarContador();
6815
- timerContador = window.setInterval(atualizarContador, 1e3);
6814
+ updateCounter();
6815
+ counterTimer = window.setInterval(updateCounter, 1e3);
6816
6816
  }
6817
6817
  function unmountDevtoolsWidget() {
6818
- if (!montado) return;
6819
- montado = false;
6820
- for (const fn of desligar.splice(0)) {
6818
+ if (!mounted) return;
6819
+ mounted = false;
6820
+ for (const fn of teardown.splice(0)) {
6821
6821
  try {
6822
6822
  fn();
6823
6823
  } catch {
6824
6824
  }
6825
6825
  }
6826
- window.clearInterval(timerContador);
6827
- window.clearTimeout(timerPulso);
6828
- timerContador = 0;
6829
- timerPulso = 0;
6830
- refs2?.raiz.remove();
6826
+ window.clearInterval(counterTimer);
6827
+ window.clearTimeout(pulseTimer);
6828
+ counterTimer = 0;
6829
+ pulseTimer = 0;
6830
+ refs2?.root.remove();
6831
6831
  refs2 = null;
6832
6832
  }
6833
6833
  function isDevtoolsWidgetMounted() {
6834
- return montado;
6834
+ return mounted;
6835
6835
  }
6836
6836
  function devtoolsWidget(force) {
6837
- const alvo = force ?? !montado;
6838
- if (alvo) {
6837
+ const target = force ?? !mounted;
6838
+ if (target) {
6839
6839
  try {
6840
- sessionStorage.removeItem(ESCONDIDO_KEY);
6840
+ sessionStorage.removeItem(HIDDEN_KEY);
6841
6841
  } catch {
6842
6842
  }
6843
6843
  mountDevtoolsWidget();
6844
6844
  } else {
6845
6845
  unmountDevtoolsWidget();
6846
6846
  }
6847
- return montado;
6847
+ return mounted;
6848
6848
  }
6849
6849
 
6850
6850
  // src/index.ts