@tooark/web-components 1.2.2 → 1.3.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/README.md +7 -5
- package/README.pt-BR.md +7 -5
- package/dist/index.cjs +267 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -9
- package/dist/index.d.ts +31 -9
- package/dist/index.js +267 -49
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -60,6 +60,33 @@ function applyTestHooks(host, component, el, part) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
// Um framework (ou o app) pode gravar uma propriedade no elemento antes de registerTooark*() defini-lo: sem a classe,
|
|
64
|
+
// `el.rows = x` vira uma propriedade própria do nó, que depois do upgrade esconde o setter da classe e o valor nunca
|
|
65
|
+
// chega ao componente. Ao conectar, toda propriedade própria que tem setter na classe é retirada e regravada por ele,
|
|
66
|
+
// na ordem em que foi gravada. Os campos da própria classe e o que os frameworks penduram no nó (chaves internas do
|
|
67
|
+
// React e do Vue) não têm setter e ficam como estão.
|
|
68
|
+
/** Reaplica pelo setter da classe as propriedades gravadas no nó antes de o elemento ser registrado. */
|
|
69
|
+
function upgradeProperties(element) {
|
|
70
|
+
const target = element;
|
|
71
|
+
for (const name of Object.keys(element)) {
|
|
72
|
+
if (!hasSetter(Object.getPrototypeOf(element), name))
|
|
73
|
+
continue;
|
|
74
|
+
const value = target[name];
|
|
75
|
+
delete target[name];
|
|
76
|
+
target[name] = value;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Procura o acessor na cadeia de protótipos até o HTMLElement: as propriedades nativas nunca viram propriedade própria,
|
|
80
|
+
// porque o nó já é um HTMLElement antes do registro.
|
|
81
|
+
function hasSetter(prototype, name) {
|
|
82
|
+
for (let proto = prototype; proto && proto !== HTMLElement.prototype; proto = Object.getPrototypeOf(proto)) {
|
|
83
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
84
|
+
if (descriptor)
|
|
85
|
+
return typeof descriptor.set === "function";
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
|
|
63
90
|
/** Ícone do botão de dispensar (chrome próprio do componente). */
|
|
64
91
|
const CLOSE_SVG$3 = `
|
|
65
92
|
<svg class="ark:h-full ark:w-full" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" aria-hidden="true">
|
|
@@ -105,6 +132,7 @@ class ArkAlert extends HTMLElementBase {
|
|
|
105
132
|
];
|
|
106
133
|
}
|
|
107
134
|
connectedCallback() {
|
|
135
|
+
upgradeProperties(this);
|
|
108
136
|
if (!this.observer) {
|
|
109
137
|
// Ícone ou ação que chegam depois (frameworks) recebem o hook.
|
|
110
138
|
this.observer = new MutationObserver(() => this.syncSlots());
|
|
@@ -312,6 +340,7 @@ class ArkAvatar extends HTMLElementBase {
|
|
|
312
340
|
return ["name", "src", "size", "shape", "color", "aria-label", "theme", "class", "testid"];
|
|
313
341
|
}
|
|
314
342
|
connectedCallback() {
|
|
343
|
+
upgradeProperties(this);
|
|
315
344
|
if (!this.initialsEl)
|
|
316
345
|
this.render();
|
|
317
346
|
this.updateAppearance();
|
|
@@ -490,6 +519,7 @@ class ArkBadge extends HTMLElementBase {
|
|
|
490
519
|
return ["intent", "variant", "size", "rounded", "color", "theme", "class", "testid"];
|
|
491
520
|
}
|
|
492
521
|
connectedCallback() {
|
|
522
|
+
upgradeProperties(this);
|
|
493
523
|
this.updateAppearance();
|
|
494
524
|
}
|
|
495
525
|
attributeChangedCallback(name) {
|
|
@@ -777,6 +807,7 @@ class ArkButton extends HTMLElementBase {
|
|
|
777
807
|
* Chamado pelo navegador quando o elemento é adicionado ao DOM.
|
|
778
808
|
*/
|
|
779
809
|
connectedCallback() {
|
|
810
|
+
upgradeProperties(this);
|
|
780
811
|
this.updateAppearance();
|
|
781
812
|
}
|
|
782
813
|
/**
|
|
@@ -1301,6 +1332,7 @@ class ArkCalendar extends HTMLElementBase {
|
|
|
1301
1332
|
];
|
|
1302
1333
|
}
|
|
1303
1334
|
connectedCallback() {
|
|
1335
|
+
upgradeProperties(this);
|
|
1304
1336
|
this.locale = this.getLocale();
|
|
1305
1337
|
const parsed = this.parseDate(this.getAttribute("value"));
|
|
1306
1338
|
if (parsed) {
|
|
@@ -1922,6 +1954,7 @@ class ArkCard extends HTMLElementBase {
|
|
|
1922
1954
|
return ["heading", "padding", "rounded", "theme", "class", "testid"];
|
|
1923
1955
|
}
|
|
1924
1956
|
connectedCallback() {
|
|
1957
|
+
upgradeProperties(this);
|
|
1925
1958
|
if (!this.observer) {
|
|
1926
1959
|
// Slots que chegam depois (frameworks) recebem o hook.
|
|
1927
1960
|
this.observer = new MutationObserver(() => this.syncSlots());
|
|
@@ -2133,6 +2166,7 @@ class ArkCarousel extends HTMLElementBase {
|
|
|
2133
2166
|
this.addEventListener("focusout", this.handleMouseLeave);
|
|
2134
2167
|
}
|
|
2135
2168
|
connectedCallback() {
|
|
2169
|
+
upgradeProperties(this);
|
|
2136
2170
|
this.build();
|
|
2137
2171
|
if (!this.observer) {
|
|
2138
2172
|
this.observer = new MutationObserver((records) => {
|
|
@@ -2556,6 +2590,7 @@ class ArkCheckbox extends HTMLElementBase {
|
|
|
2556
2590
|
this.addEventListener("click", this.handleHostClick);
|
|
2557
2591
|
}
|
|
2558
2592
|
connectedCallback() {
|
|
2593
|
+
upgradeProperties(this);
|
|
2559
2594
|
if (!this.boxEl)
|
|
2560
2595
|
this.render();
|
|
2561
2596
|
if (!this.observer) {
|
|
@@ -2854,6 +2889,7 @@ class ArkClock extends HTMLElementBase {
|
|
|
2854
2889
|
return ["value", "seconds", "step-minutes", "hours-format", "lang", "locale-json", "theme", "intent", "testid"];
|
|
2855
2890
|
}
|
|
2856
2891
|
connectedCallback() {
|
|
2892
|
+
upgradeProperties(this);
|
|
2857
2893
|
this.build();
|
|
2858
2894
|
}
|
|
2859
2895
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
@@ -3131,6 +3167,7 @@ class ArkColorSwatches extends HTMLElementBase {
|
|
|
3131
3167
|
this.addEventListener("keydown", this.handleKeydown);
|
|
3132
3168
|
}
|
|
3133
3169
|
connectedCallback() {
|
|
3170
|
+
upgradeProperties(this);
|
|
3134
3171
|
this.updateAppearance();
|
|
3135
3172
|
}
|
|
3136
3173
|
attributeChangedCallback(name) {
|
|
@@ -3305,6 +3342,7 @@ class ArkCommandItem extends HTMLElementBase {
|
|
|
3305
3342
|
this.addEventListener("click", this.handleClick);
|
|
3306
3343
|
}
|
|
3307
3344
|
connectedCallback() {
|
|
3345
|
+
upgradeProperties(this);
|
|
3308
3346
|
this.updateAppearance();
|
|
3309
3347
|
}
|
|
3310
3348
|
attributeChangedCallback(name) {
|
|
@@ -3545,6 +3583,7 @@ class ArkCommandPalette extends HTMLElementBase {
|
|
|
3545
3583
|
this.addEventListener("ark-select", this.handleItemSelect);
|
|
3546
3584
|
}
|
|
3547
3585
|
connectedCallback() {
|
|
3586
|
+
upgradeProperties(this);
|
|
3548
3587
|
if (!this.inputEl)
|
|
3549
3588
|
this.render();
|
|
3550
3589
|
if (!this.observer) {
|
|
@@ -3583,6 +3622,10 @@ class ArkCommandPalette extends HTMLElementBase {
|
|
|
3583
3622
|
if (!this.isConnected)
|
|
3584
3623
|
return;
|
|
3585
3624
|
if (name === "open") {
|
|
3625
|
+
// Sem o observer o connectedCallback ainda não rodou (upgrade de uma tag já no DOM, hidratação de SSR, prop
|
|
3626
|
+
// reaplicada ao conectar): quem abre é ele, com o ark-open no microtask.
|
|
3627
|
+
if (!this.observer)
|
|
3628
|
+
return;
|
|
3586
3629
|
if (this.hasAttribute("open")) {
|
|
3587
3630
|
this.openNow();
|
|
3588
3631
|
}
|
|
@@ -3918,6 +3961,7 @@ class ArkCopyButton extends ArkButton {
|
|
|
3918
3961
|
this.addEventListener("click", this.handleCopyClick);
|
|
3919
3962
|
}
|
|
3920
3963
|
connectedCallback() {
|
|
3964
|
+
upgradeProperties(this);
|
|
3921
3965
|
if (!this.childObserver) {
|
|
3922
3966
|
// Rótulo do usuário que chega ou sai depois decide se o rótulo próprio aparece.
|
|
3923
3967
|
this.childObserver = new MutationObserver(() => this.updateAppearance());
|
|
@@ -4200,6 +4244,7 @@ class ArkDatepicker extends HTMLElementBase {
|
|
|
4200
4244
|
];
|
|
4201
4245
|
}
|
|
4202
4246
|
connectedCallback() {
|
|
4247
|
+
upgradeProperties(this);
|
|
4203
4248
|
if (!this.hasRendered()) {
|
|
4204
4249
|
this.syncFromValue();
|
|
4205
4250
|
this.render();
|
|
@@ -4779,6 +4824,7 @@ class ArkDialog extends HTMLElementBase {
|
|
|
4779
4824
|
this.addEventListener("keydown", this.handleKeydown);
|
|
4780
4825
|
}
|
|
4781
4826
|
connectedCallback() {
|
|
4827
|
+
upgradeProperties(this);
|
|
4782
4828
|
if (!this.observer) {
|
|
4783
4829
|
// Um footer que chega depois (framework) recebe o hook; o resto do DOM é do usuário.
|
|
4784
4830
|
this.observer = new MutationObserver(() => this.syncFooter());
|
|
@@ -4812,6 +4858,10 @@ class ArkDialog extends HTMLElementBase {
|
|
|
4812
4858
|
if (name === "open") {
|
|
4813
4859
|
const reason = this.pendingReason ?? "api";
|
|
4814
4860
|
this.pendingReason = null;
|
|
4861
|
+
// Sem o observer o connectedCallback ainda não rodou (upgrade de uma tag já no DOM, hidratação de SSR, prop
|
|
4862
|
+
// reaplicada ao conectar): quem abre é ele, com o ark-open no microtask.
|
|
4863
|
+
if (!this.observer)
|
|
4864
|
+
return;
|
|
4815
4865
|
if (this.hasAttribute("open")) {
|
|
4816
4866
|
this.openNow();
|
|
4817
4867
|
}
|
|
@@ -5146,6 +5196,7 @@ class ArkDrawer extends HTMLElementBase {
|
|
|
5146
5196
|
this.addEventListener("keydown", this.handleKeydown);
|
|
5147
5197
|
}
|
|
5148
5198
|
connectedCallback() {
|
|
5199
|
+
upgradeProperties(this);
|
|
5149
5200
|
if (!this.observer) {
|
|
5150
5201
|
this.observer = new MutationObserver(() => this.syncFooter());
|
|
5151
5202
|
this.observer.observe(this, { childList: true });
|
|
@@ -5177,6 +5228,10 @@ class ArkDrawer extends HTMLElementBase {
|
|
|
5177
5228
|
if (name === "open") {
|
|
5178
5229
|
const reason = this.pendingReason ?? "api";
|
|
5179
5230
|
this.pendingReason = null;
|
|
5231
|
+
// Sem o observer o connectedCallback ainda não rodou (upgrade de uma tag já no DOM, hidratação de SSR, prop
|
|
5232
|
+
// reaplicada ao conectar): quem abre é ele, com o ark-open no microtask.
|
|
5233
|
+
if (!this.observer)
|
|
5234
|
+
return;
|
|
5180
5235
|
if (this.hasAttribute("open")) {
|
|
5181
5236
|
this.openNow();
|
|
5182
5237
|
}
|
|
@@ -5502,6 +5557,7 @@ class ArkEmpty extends HTMLElementBase {
|
|
|
5502
5557
|
return ["heading", "description", "theme", "class", "testid"];
|
|
5503
5558
|
}
|
|
5504
5559
|
connectedCallback() {
|
|
5560
|
+
upgradeProperties(this);
|
|
5505
5561
|
if (!this.observer) {
|
|
5506
5562
|
// Ícone ou ação que chegam depois (frameworks) recebem o hook.
|
|
5507
5563
|
this.observer = new MutationObserver(() => this.syncSlots());
|
|
@@ -5689,6 +5745,7 @@ class ArkFileInput extends HTMLElementBase {
|
|
|
5689
5745
|
];
|
|
5690
5746
|
}
|
|
5691
5747
|
connectedCallback() {
|
|
5748
|
+
upgradeProperties(this);
|
|
5692
5749
|
if (!this.inputEl)
|
|
5693
5750
|
this.render();
|
|
5694
5751
|
this.updateAppearance();
|
|
@@ -6081,6 +6138,7 @@ class ArkInput extends HTMLElementBase {
|
|
|
6081
6138
|
];
|
|
6082
6139
|
}
|
|
6083
6140
|
connectedCallback() {
|
|
6141
|
+
upgradeProperties(this);
|
|
6084
6142
|
if (!this.inputEl) {
|
|
6085
6143
|
this.render();
|
|
6086
6144
|
}
|
|
@@ -6364,6 +6422,7 @@ class ArkKbd extends HTMLElementBase {
|
|
|
6364
6422
|
return ["size", "theme", "class", "testid"];
|
|
6365
6423
|
}
|
|
6366
6424
|
connectedCallback() {
|
|
6425
|
+
upgradeProperties(this);
|
|
6367
6426
|
this.updateAppearance();
|
|
6368
6427
|
}
|
|
6369
6428
|
attributeChangedCallback(name) {
|
|
@@ -6474,7 +6533,9 @@ function cloneRow(row) {
|
|
|
6474
6533
|
* preservados por posição) ou "json" (array com todos os campos). `change`
|
|
6475
6534
|
* publica as linhas a cada edição, inclusive ao sair do modo em massa;
|
|
6476
6535
|
* adicionar e remover anunciam a contagem ao leitor de tela. A célula de
|
|
6477
|
-
* valor é um ark-input
|
|
6536
|
+
* valor é um ark-input; a propriedade `valueField` troca pelo elemento que o
|
|
6537
|
+
* app criar (um campo com autocomplete de `{{variável}}`, por exemplo), exceto
|
|
6538
|
+
* nas linhas secretas, que mantêm o campo de senha.
|
|
6478
6539
|
*/
|
|
6479
6540
|
class ArkKvEditor extends HTMLElementBase {
|
|
6480
6541
|
static get observedAttributes() {
|
|
@@ -6517,6 +6578,10 @@ class ArkKvEditor extends HTMLElementBase {
|
|
|
6517
6578
|
this.bulkBase = null;
|
|
6518
6579
|
/** Último texto em massa que o próprio componente escreveu, para não sobrescrever o que o usuário digita. */
|
|
6519
6580
|
this.bulkWritten = "";
|
|
6581
|
+
/** Fábrica da célula de valor (`valueField`); sem ela, todo valor é um ark-input. */
|
|
6582
|
+
this.valueFactory = null;
|
|
6583
|
+
/** Células de valor criadas pela fábrica, que não recebem `type`/`reveal` do ark-input. */
|
|
6584
|
+
this.customCells = new WeakSet();
|
|
6520
6585
|
// --- Interação ---
|
|
6521
6586
|
this.handleBulkInput = () => {
|
|
6522
6587
|
if (!this.bulkEl)
|
|
@@ -6539,6 +6604,7 @@ class ArkKvEditor extends HTMLElementBase {
|
|
|
6539
6604
|
});
|
|
6540
6605
|
}
|
|
6541
6606
|
connectedCallback() {
|
|
6607
|
+
upgradeProperties(this);
|
|
6542
6608
|
if (!this.listEl)
|
|
6543
6609
|
this.render();
|
|
6544
6610
|
this.updateAppearance();
|
|
@@ -6626,6 +6692,20 @@ class ArkKvEditor extends HTMLElementBase {
|
|
|
6626
6692
|
set secret(value) {
|
|
6627
6693
|
this.toggleAttribute("secret", coerceBooleanAttr(value));
|
|
6628
6694
|
}
|
|
6695
|
+
/**
|
|
6696
|
+
* Fábrica da célula de valor (propriedade JS): o elemento que ela devolve substitui o ark-input da linha, exceto
|
|
6697
|
+
* nas linhas secretas, que mantêm o campo de senha; `null` numa linha mantém o ark-input nela.
|
|
6698
|
+
*/
|
|
6699
|
+
get valueField() {
|
|
6700
|
+
return this.valueFactory;
|
|
6701
|
+
}
|
|
6702
|
+
set valueField(value) {
|
|
6703
|
+
this.valueFactory = typeof value === "function" ? value : null;
|
|
6704
|
+
// As células de valor são recriadas com a fábrica nova.
|
|
6705
|
+
this.resetRows();
|
|
6706
|
+
if (this.isConnected)
|
|
6707
|
+
this.updateAppearance();
|
|
6708
|
+
}
|
|
6629
6709
|
get readonly() {
|
|
6630
6710
|
return this.hasAttribute("readonly");
|
|
6631
6711
|
}
|
|
@@ -6674,6 +6754,10 @@ class ArkKvEditor extends HTMLElementBase {
|
|
|
6674
6754
|
getLocale() {
|
|
6675
6755
|
return resolveLocale(this.getAttribute("lang") || "en", this.getAttribute("locale-json") || undefined);
|
|
6676
6756
|
}
|
|
6757
|
+
// Tipo efetivo: com a coluna de tipos, o que o select mostra (o da linha se está na lista, senão o primeiro).
|
|
6758
|
+
effectiveType(row, types) {
|
|
6759
|
+
return types.length > 0 ? (row.type && types.includes(row.type) ? row.type : types[0]) : row.type;
|
|
6760
|
+
}
|
|
6677
6761
|
getSize() {
|
|
6678
6762
|
const size = (this.getAttribute("size") || "").toLowerCase();
|
|
6679
6763
|
return size === "xs" || size === "sm" || size === "lg" || size === "xl" ? size : "md";
|
|
@@ -6816,16 +6900,7 @@ class ArkKvEditor extends HTMLElementBase {
|
|
|
6816
6900
|
this.emitChange();
|
|
6817
6901
|
});
|
|
6818
6902
|
const key = this.createField(row.id, "key", size);
|
|
6819
|
-
const value = this.
|
|
6820
|
-
// Enter no valor da última linha acrescenta a próxima, como numa tabela.
|
|
6821
|
-
value.addEventListener("keydown", (event) => {
|
|
6822
|
-
if (event.key !== "Enter" || this.readonly)
|
|
6823
|
-
return;
|
|
6824
|
-
if (this.model[this.model.length - 1]?.id !== row.id)
|
|
6825
|
-
return;
|
|
6826
|
-
event.preventDefault();
|
|
6827
|
-
this.add();
|
|
6828
|
-
});
|
|
6903
|
+
const value = this.createValueCell(row, size);
|
|
6829
6904
|
const remove = document.createElement("ark-button");
|
|
6830
6905
|
remove.setAttribute("variant", "ghost");
|
|
6831
6906
|
remove.setAttribute("intent", "neutral");
|
|
@@ -6874,15 +6949,69 @@ class ArkKvEditor extends HTMLElementBase {
|
|
|
6874
6949
|
el.appendChild(remove);
|
|
6875
6950
|
return el;
|
|
6876
6951
|
}
|
|
6952
|
+
// Célula de valor: com `valueField` e fora das linhas secretas, o elemento da fábrica; senão o ark-input.
|
|
6953
|
+
createValueCell(row, size) {
|
|
6954
|
+
const custom = this.valueFactory && !(this.secret && row.secret === true)
|
|
6955
|
+
? this.valueFactory({ row: { ...row }, type: this.effectiveType(row, this.types) ?? "", size })
|
|
6956
|
+
: null;
|
|
6957
|
+
if (!(custom instanceof HTMLElement)) {
|
|
6958
|
+
const value = this.createField(row.id, "value", size);
|
|
6959
|
+
// Enter no valor da última linha acrescenta a próxima, como numa tabela.
|
|
6960
|
+
value.addEventListener("keydown", (event) => {
|
|
6961
|
+
if (event.key !== "Enter" || this.readonly)
|
|
6962
|
+
return;
|
|
6963
|
+
if (this.model[this.model.length - 1]?.id !== row.id)
|
|
6964
|
+
return;
|
|
6965
|
+
event.preventDefault();
|
|
6966
|
+
this.add();
|
|
6967
|
+
});
|
|
6968
|
+
return value;
|
|
6969
|
+
}
|
|
6970
|
+
const cell = custom;
|
|
6971
|
+
cell.setAttribute("data-ark-field", "value");
|
|
6972
|
+
this.customCells.add(cell);
|
|
6973
|
+
// O campo do app pode emitir `input` antes de atualizar `value` (e `change` depois): só um valor novo conta.
|
|
6974
|
+
const sync = () => {
|
|
6975
|
+
const current = this.model.find((item) => item.id === row.id);
|
|
6976
|
+
const next = cell.value;
|
|
6977
|
+
if (!current || typeof next !== "string" || next === current.value)
|
|
6978
|
+
return;
|
|
6979
|
+
current.value = next;
|
|
6980
|
+
this.emitChange();
|
|
6981
|
+
};
|
|
6982
|
+
cell.addEventListener("input", (event) => {
|
|
6983
|
+
event.stopPropagation();
|
|
6984
|
+
sync();
|
|
6985
|
+
});
|
|
6986
|
+
cell.addEventListener("change", sync);
|
|
6987
|
+
// Enter que o campo não consumiu, ou o `ark-submit` de um campo que consome o Enter, na última linha acrescenta
|
|
6988
|
+
// a próxima.
|
|
6989
|
+
const addNext = (event) => {
|
|
6990
|
+
if (this.readonly || event.defaultPrevented)
|
|
6991
|
+
return;
|
|
6992
|
+
if (this.model[this.model.length - 1]?.id !== row.id)
|
|
6993
|
+
return;
|
|
6994
|
+
if (event.cancelable)
|
|
6995
|
+
event.preventDefault();
|
|
6996
|
+
this.add();
|
|
6997
|
+
};
|
|
6998
|
+
cell.addEventListener("keydown", (event) => {
|
|
6999
|
+
if (event.key === "Enter")
|
|
7000
|
+
addNext(event);
|
|
7001
|
+
});
|
|
7002
|
+
cell.addEventListener("ark-submit", addNext);
|
|
7003
|
+
return cell;
|
|
7004
|
+
}
|
|
7005
|
+
// Filhos diretos da linha: uma célula de valor do app pode ter botões, selects e campos próprios dentro.
|
|
6877
7006
|
rowParts(el) {
|
|
6878
7007
|
return {
|
|
6879
|
-
enabled: el.querySelector("ark-checkbox"),
|
|
6880
|
-
key: el.querySelector('ark-input[data-ark-field="key"]'),
|
|
6881
|
-
value: el.querySelector('
|
|
6882
|
-
secret: this.secret ? el.querySelector("ark-button") : null,
|
|
6883
|
-
type: el.querySelector("ark-select"),
|
|
6884
|
-
description: el.querySelector('ark-input[data-ark-field="description"]'),
|
|
6885
|
-
remove: el.querySelector("ark-button:last-of-type")
|
|
7008
|
+
enabled: el.querySelector(":scope > ark-checkbox"),
|
|
7009
|
+
key: el.querySelector(':scope > ark-input[data-ark-field="key"]'),
|
|
7010
|
+
value: el.querySelector(':scope > [data-ark-field="value"]'),
|
|
7011
|
+
secret: this.secret ? el.querySelector(":scope > ark-button") : null,
|
|
7012
|
+
type: el.querySelector(":scope > ark-select"),
|
|
7013
|
+
description: el.querySelector(':scope > ark-input[data-ark-field="description"]'),
|
|
7014
|
+
remove: el.querySelector(":scope > ark-button:last-of-type")
|
|
6886
7015
|
};
|
|
6887
7016
|
}
|
|
6888
7017
|
// Classes de grid por combinação de colunas (segredo, tipo, descrição): literais completas, para o Tailwind
|
|
@@ -6926,6 +7055,17 @@ class ArkKvEditor extends HTMLElementBase {
|
|
|
6926
7055
|
if (el !== anchor)
|
|
6927
7056
|
this.listEl.insertBefore(el, anchor);
|
|
6928
7057
|
previous = el;
|
|
7058
|
+
const rowType = this.effectiveType(row, types);
|
|
7059
|
+
const isSecret = withSecret && row.secret === true;
|
|
7060
|
+
// Com `valueField`, segredo e tipo decidem a célula (a fábrica recebe o tipo, o segredo fica no campo de
|
|
7061
|
+
// senha): quando mudam, a célula de valor é recriada. Sem fábrica o ark-input só troca de `type`.
|
|
7062
|
+
if (this.valueFactory) {
|
|
7063
|
+
const valueKey = `${isSecret}|${rowType ?? ""}`;
|
|
7064
|
+
if (el.dataset.arkValueKey !== undefined && el.dataset.arkValueKey !== valueKey) {
|
|
7065
|
+
this.rowParts(el).value.replaceWith(this.createValueCell(row, size));
|
|
7066
|
+
}
|
|
7067
|
+
el.dataset.arkValueKey = valueKey;
|
|
7068
|
+
}
|
|
6929
7069
|
const parts = this.rowParts(el);
|
|
6930
7070
|
el.className = [
|
|
6931
7071
|
"ark:grid ark:items-center ark:gap-2 ark:px-3 ark:py-1.5",
|
|
@@ -6954,12 +7094,12 @@ class ArkKvEditor extends HTMLElementBase {
|
|
|
6954
7094
|
input.toggleAttribute("readonly", readonly);
|
|
6955
7095
|
applyTestHooks(this, "kv-editor", input, name);
|
|
6956
7096
|
}
|
|
6957
|
-
//
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
7097
|
+
// Campo de valor: senha com o olho quando é segredo; senão o tipo efetivo (number, date...) ou texto. A célula
|
|
7098
|
+
// da fábrica decide o próprio tipo (recebe `type` no contexto).
|
|
7099
|
+
if (!this.customCells.has(parts.value)) {
|
|
7100
|
+
parts.value.setAttribute("type", isSecret ? "password" : (VALUE_INPUT_TYPES[rowType ?? ""] ?? "text"));
|
|
7101
|
+
parts.value.toggleAttribute("reveal", isSecret);
|
|
7102
|
+
}
|
|
6963
7103
|
if (parts.secret) {
|
|
6964
7104
|
parts.secret.setAttribute("aria-label", locale.secret);
|
|
6965
7105
|
parts.secret.title = locale.secret;
|
|
@@ -7113,10 +7253,25 @@ const ARK_MARK_PATHS = {
|
|
|
7113
7253
|
triangle: "M12 2 22 21H2Z",
|
|
7114
7254
|
diamond: "M12 1 23 12 12 23 1 12Z",
|
|
7115
7255
|
star: "M12 1.5 15.2 8.6 23 9.6l-5.7 5.3 1.5 7.6L12 18.8 5.2 22.5l1.5-7.6L1 9.6l7.8-1Z",
|
|
7116
|
-
hexagon: "M7 2h10l5 10-5 10H7L2 12Z"
|
|
7256
|
+
hexagon: "M7 2h10l5 10-5 10H7L2 12Z",
|
|
7257
|
+
cross: "M9 2h6v7h7v6h-7v7H9v-7H2V9h7Z",
|
|
7258
|
+
pentagon: "M12 2l10.5 7.6-4 12.3h-13l-4-12.3Z",
|
|
7259
|
+
moon: "M12 2a7.1 7.1 0 0 0 10 10 10 10 0 1 1-10-10Z",
|
|
7260
|
+
asterisk: "M9.9 1.5h4.2v6.86l5.94-3.43 2.1 3.64L16.2 12l5.94 3.43-2.1 3.64-5.94-3.43v6.86H9.9v-6.86l-5.94 3.43-2.1-3.64L7.8 12 1.86 8.57l2.1-3.64 5.94 3.43Z"
|
|
7117
7261
|
};
|
|
7118
|
-
/** As
|
|
7119
|
-
const ARK_MARK_SHAPES = [
|
|
7262
|
+
/** As dez formas, na ordem canônica (a de `shapes="all"` no ark-shape-picker). */
|
|
7263
|
+
const ARK_MARK_SHAPES = [
|
|
7264
|
+
"circle",
|
|
7265
|
+
"square",
|
|
7266
|
+
"triangle",
|
|
7267
|
+
"diamond",
|
|
7268
|
+
"star",
|
|
7269
|
+
"hexagon",
|
|
7270
|
+
"cross",
|
|
7271
|
+
"pentagon",
|
|
7272
|
+
"moon",
|
|
7273
|
+
"asterisk"
|
|
7274
|
+
];
|
|
7120
7275
|
/** Normaliza o valor de `shape`; inválido cai em "circle". */
|
|
7121
7276
|
function normalizeMarkShape(value) {
|
|
7122
7277
|
const shape = (value || "").toLowerCase();
|
|
@@ -7148,6 +7303,7 @@ class ArkMark extends HTMLElementBase {
|
|
|
7148
7303
|
return ["shape", "color", "size", "label", "theme", "class", "testid"];
|
|
7149
7304
|
}
|
|
7150
7305
|
connectedCallback() {
|
|
7306
|
+
upgradeProperties(this);
|
|
7151
7307
|
if (!this.svgEl)
|
|
7152
7308
|
this.render();
|
|
7153
7309
|
this.updateAppearance();
|
|
@@ -7353,6 +7509,7 @@ class ArkMenu extends HTMLElementBase {
|
|
|
7353
7509
|
this.addEventListener("toggle", this.handleToggle);
|
|
7354
7510
|
}
|
|
7355
7511
|
connectedCallback() {
|
|
7512
|
+
upgradeProperties(this);
|
|
7356
7513
|
if (!this.id)
|
|
7357
7514
|
this.id = `ark-menu-${++menuSeq}`;
|
|
7358
7515
|
if (!this.childObserver) {
|
|
@@ -7391,7 +7548,8 @@ class ArkMenu extends HTMLElementBase {
|
|
|
7391
7548
|
return;
|
|
7392
7549
|
}
|
|
7393
7550
|
if (name === "open") {
|
|
7394
|
-
|
|
7551
|
+
// Sem o observer o connectedCallback ainda não rodou (upgrade de uma tag já no DOM): quem abre é ele.
|
|
7552
|
+
if (this.syncingOpen || !this.childObserver)
|
|
7395
7553
|
return;
|
|
7396
7554
|
if (this.hasAttribute("open")) {
|
|
7397
7555
|
this.show();
|
|
@@ -7412,8 +7570,9 @@ class ArkMenu extends HTMLElementBase {
|
|
|
7412
7570
|
}
|
|
7413
7571
|
set open(value) {
|
|
7414
7572
|
const next = coerceBooleanAttr(value);
|
|
7415
|
-
//
|
|
7416
|
-
|
|
7573
|
+
// Antes do connectedCallback (React 19 e Vue gravam a prop antes de inserir o nó; o upgrade de uma tag já no DOM
|
|
7574
|
+
// a reaplica ao conectar): só reflete, e o connectedCallback abre.
|
|
7575
|
+
if (!this.isConnected || !this.childObserver) {
|
|
7417
7576
|
this.toggleAttribute("open", next);
|
|
7418
7577
|
return;
|
|
7419
7578
|
}
|
|
@@ -7663,6 +7822,7 @@ class ArkMenuItem extends HTMLElementBase {
|
|
|
7663
7822
|
this.addEventListener("keydown", this.handleKeydown);
|
|
7664
7823
|
}
|
|
7665
7824
|
connectedCallback() {
|
|
7825
|
+
upgradeProperties(this);
|
|
7666
7826
|
this.updateAppearance();
|
|
7667
7827
|
}
|
|
7668
7828
|
attributeChangedCallback(name) {
|
|
@@ -7887,6 +8047,7 @@ class ArkProgress extends HTMLElementBase {
|
|
|
7887
8047
|
];
|
|
7888
8048
|
}
|
|
7889
8049
|
connectedCallback() {
|
|
8050
|
+
upgradeProperties(this);
|
|
7890
8051
|
if (!this.trackEl)
|
|
7891
8052
|
this.render();
|
|
7892
8053
|
this.updateAppearance();
|
|
@@ -8113,6 +8274,7 @@ class ArkRadio extends HTMLElementBase {
|
|
|
8113
8274
|
this.addEventListener("click", this.handleHostClick);
|
|
8114
8275
|
}
|
|
8115
8276
|
connectedCallback() {
|
|
8277
|
+
upgradeProperties(this);
|
|
8116
8278
|
if (!this.boxEl)
|
|
8117
8279
|
this.render();
|
|
8118
8280
|
if (!this.observer) {
|
|
@@ -8538,6 +8700,7 @@ class ArkScheduler extends HTMLElementBase {
|
|
|
8538
8700
|
];
|
|
8539
8701
|
}
|
|
8540
8702
|
connectedCallback() {
|
|
8703
|
+
upgradeProperties(this);
|
|
8541
8704
|
this.locale = this.getLocale();
|
|
8542
8705
|
this.refDate = parseLocalDate(this.getAttribute("date")) || new Date();
|
|
8543
8706
|
this.build();
|
|
@@ -9344,6 +9507,7 @@ class ArkSelect extends HTMLElementBase {
|
|
|
9344
9507
|
];
|
|
9345
9508
|
}
|
|
9346
9509
|
connectedCallback() {
|
|
9510
|
+
upgradeProperties(this);
|
|
9347
9511
|
if (!this.selectEl) {
|
|
9348
9512
|
this.render();
|
|
9349
9513
|
}
|
|
@@ -9599,19 +9763,26 @@ const SHAPE_LABEL = {
|
|
|
9599
9763
|
triangle: "shapeTriangle",
|
|
9600
9764
|
diamond: "shapeDiamond",
|
|
9601
9765
|
star: "shapeStar",
|
|
9602
|
-
hexagon: "shapeHexagon"
|
|
9766
|
+
hexagon: "shapeHexagon",
|
|
9767
|
+
cross: "shapeCross",
|
|
9768
|
+
pentagon: "shapePentagon",
|
|
9769
|
+
moon: "shapeMoon",
|
|
9770
|
+
asterisk: "shapeAsterisk"
|
|
9603
9771
|
};
|
|
9604
9772
|
/**
|
|
9605
9773
|
* Seletor de forma da marca de escopo: o PRÓPRIO host é o `role="radiogroup"`
|
|
9606
|
-
* com
|
|
9607
|
-
* ark-mark desenhado em `color` (a cor atual, para o usuário ver o par
|
|
9608
|
-
* e nomeada pelo nome localizado da forma.
|
|
9609
|
-
* ark-
|
|
9774
|
+
* com uma opção `role="radio"` por forma, renderizada pelo componente, cada
|
|
9775
|
+
* uma um ark-mark desenhado em `color` (a cor atual, para o usuário ver o par
|
|
9776
|
+
* real) e nomeada pelo nome localizado da forma. Sem `shapes` são as dez
|
|
9777
|
+
* formas do ark-mark, na ordem de `ARK_MARK_SHAPES`; `shapes` escolhe quais e
|
|
9778
|
+
* em que ordem. Mesmo teclado do ark-color-swatches. `change` só quando a
|
|
9779
|
+
* seleção muda pelo usuário.
|
|
9610
9780
|
*/
|
|
9611
9781
|
class ArkShapePicker extends HTMLElementBase {
|
|
9612
9782
|
static get observedAttributes() {
|
|
9613
9783
|
return [
|
|
9614
9784
|
"value",
|
|
9785
|
+
"shapes",
|
|
9615
9786
|
"color",
|
|
9616
9787
|
"label",
|
|
9617
9788
|
"aria-label",
|
|
@@ -9629,6 +9800,9 @@ class ArkShapePicker extends HTMLElementBase {
|
|
|
9629
9800
|
this.ownClasses = [];
|
|
9630
9801
|
this.syncingClass = false;
|
|
9631
9802
|
this.options = [];
|
|
9803
|
+
/** Formas das opções renderizadas, na ordem dos botões. */
|
|
9804
|
+
this.offered = [];
|
|
9805
|
+
this.rendered = false;
|
|
9632
9806
|
this.handleKeydown = (event) => {
|
|
9633
9807
|
if (this.disabled)
|
|
9634
9808
|
return;
|
|
@@ -9657,13 +9831,13 @@ class ArkShapePicker extends HTMLElementBase {
|
|
|
9657
9831
|
return;
|
|
9658
9832
|
event.preventDefault();
|
|
9659
9833
|
this.options[next].focus();
|
|
9660
|
-
this.select(
|
|
9834
|
+
this.select(this.offered[next]);
|
|
9661
9835
|
};
|
|
9662
9836
|
this.addEventListener("keydown", this.handleKeydown);
|
|
9663
9837
|
}
|
|
9664
9838
|
connectedCallback() {
|
|
9665
|
-
|
|
9666
|
-
|
|
9839
|
+
upgradeProperties(this);
|
|
9840
|
+
this.rendered = true;
|
|
9667
9841
|
this.updateAppearance();
|
|
9668
9842
|
}
|
|
9669
9843
|
attributeChangedCallback(name) {
|
|
@@ -9672,7 +9846,7 @@ class ArkShapePicker extends HTMLElementBase {
|
|
|
9672
9846
|
this.applyOwnClasses(this.ownClasses);
|
|
9673
9847
|
return;
|
|
9674
9848
|
}
|
|
9675
|
-
if (this.
|
|
9849
|
+
if (!this.rendered || !this.isConnected)
|
|
9676
9850
|
return;
|
|
9677
9851
|
this.updateAppearance();
|
|
9678
9852
|
}
|
|
@@ -9689,19 +9863,41 @@ class ArkShapePicker extends HTMLElementBase {
|
|
|
9689
9863
|
this.removeAttribute("value");
|
|
9690
9864
|
}
|
|
9691
9865
|
}
|
|
9866
|
+
/** Formas oferecidas, na ordem (atributo `shapes`, separado por vírgula, ou "all"); sem nenhuma válida, as dez. */
|
|
9867
|
+
get shapes() {
|
|
9868
|
+
const raw = (this.getAttribute("shapes") || "").trim().toLowerCase();
|
|
9869
|
+
if (raw === "all")
|
|
9870
|
+
return [...ARK_MARK_SHAPES];
|
|
9871
|
+
const list = [];
|
|
9872
|
+
for (const token of raw.split(",")) {
|
|
9873
|
+
const shape = token.trim();
|
|
9874
|
+
if (ARK_MARK_SHAPES.includes(shape) && !list.includes(shape))
|
|
9875
|
+
list.push(shape);
|
|
9876
|
+
}
|
|
9877
|
+
return list.length > 0 ? list : [...ARK_MARK_SHAPES];
|
|
9878
|
+
}
|
|
9879
|
+
set shapes(value) {
|
|
9880
|
+
const list = Array.isArray(value) ? value.join(",") : value || "";
|
|
9881
|
+
if (list) {
|
|
9882
|
+
this.setAttribute("shapes", list);
|
|
9883
|
+
}
|
|
9884
|
+
else {
|
|
9885
|
+
this.removeAttribute("shapes");
|
|
9886
|
+
}
|
|
9887
|
+
}
|
|
9692
9888
|
get disabled() {
|
|
9693
9889
|
return this.hasAttribute("disabled");
|
|
9694
9890
|
}
|
|
9695
9891
|
set disabled(value) {
|
|
9696
9892
|
this.toggleAttribute("disabled", coerceBooleanAttr(value));
|
|
9697
9893
|
}
|
|
9698
|
-
/** Seleciona uma forma como o usuário faria: muda `value`, foca a opção e emite `change`. */
|
|
9894
|
+
/** Seleciona uma forma oferecida como o usuário faria: muda `value`, foca a opção e emite `change`. */
|
|
9699
9895
|
select(value) {
|
|
9700
9896
|
const shape = normalizeMarkShape(value);
|
|
9701
|
-
if (this.disabled || shape === this.value)
|
|
9897
|
+
if (this.disabled || shape === this.value || !this.shapes.includes(shape))
|
|
9702
9898
|
return;
|
|
9703
9899
|
this.setAttribute("value", shape);
|
|
9704
|
-
this.options[
|
|
9900
|
+
this.options[this.offered.indexOf(shape)]?.focus();
|
|
9705
9901
|
this.dispatchEvent(new CustomEvent("change", { detail: { value: shape }, bubbles: true, composed: true }));
|
|
9706
9902
|
}
|
|
9707
9903
|
getLocale() {
|
|
@@ -9718,8 +9914,15 @@ class ArkShapePicker extends HTMLElementBase {
|
|
|
9718
9914
|
};
|
|
9719
9915
|
return sizes[size] ?? sizes.md;
|
|
9720
9916
|
}
|
|
9721
|
-
|
|
9722
|
-
|
|
9917
|
+
// Recria as opções só quando a lista oferecida muda (atributo `shapes`); cada botão sabe a própria forma.
|
|
9918
|
+
syncOptions() {
|
|
9919
|
+
const shapes = this.shapes;
|
|
9920
|
+
if (shapes.join(",") === this.offered.join(","))
|
|
9921
|
+
return;
|
|
9922
|
+
for (const option of this.options)
|
|
9923
|
+
option.remove();
|
|
9924
|
+
this.offered = shapes;
|
|
9925
|
+
this.options = shapes.map((shape) => {
|
|
9723
9926
|
const button = document.createElement("button");
|
|
9724
9927
|
button.type = "button";
|
|
9725
9928
|
button.setAttribute("role", "radio");
|
|
@@ -9751,6 +9954,7 @@ class ArkShapePicker extends HTMLElementBase {
|
|
|
9751
9954
|
const disabled = this.disabled;
|
|
9752
9955
|
const sizing = this.getSizing();
|
|
9753
9956
|
const color = this.getAttribute("color")?.trim() || "";
|
|
9957
|
+
this.syncOptions();
|
|
9754
9958
|
this.setAttribute("role", "radiogroup");
|
|
9755
9959
|
// Só quando muda: aria-label é observado e um set igual reentraria aqui.
|
|
9756
9960
|
const label = this.getAttribute("label");
|
|
@@ -9766,10 +9970,10 @@ class ArkShapePicker extends HTMLElementBase {
|
|
|
9766
9970
|
.join(" ")
|
|
9767
9971
|
.split(" ")
|
|
9768
9972
|
.filter(Boolean));
|
|
9769
|
-
const selectedIndex = value ?
|
|
9973
|
+
const selectedIndex = value ? this.offered.indexOf(value) : -1;
|
|
9770
9974
|
const stop = selectedIndex >= 0 ? selectedIndex : 0;
|
|
9771
9975
|
this.options.forEach((option, index) => {
|
|
9772
|
-
const shape =
|
|
9976
|
+
const shape = this.offered[index];
|
|
9773
9977
|
const selected = index === selectedIndex;
|
|
9774
9978
|
option.setAttribute("aria-label", String(locale[SHAPE_LABEL[shape]]));
|
|
9775
9979
|
option.setAttribute("aria-checked", selected ? "true" : "false");
|
|
@@ -9835,6 +10039,7 @@ class ArkSkeleton extends HTMLElementBase {
|
|
|
9835
10039
|
return ["rows", "animated", "rounded", "color", "ratio", "theme", "class", "testid"];
|
|
9836
10040
|
}
|
|
9837
10041
|
connectedCallback() {
|
|
10042
|
+
upgradeProperties(this);
|
|
9838
10043
|
this.updateAppearance();
|
|
9839
10044
|
}
|
|
9840
10045
|
attributeChangedCallback(name) {
|
|
@@ -9986,6 +10191,7 @@ class ArkSpinner extends HTMLElementBase {
|
|
|
9986
10191
|
return ["size", "intent", "label", "lang", "locale-json", "theme", "class", "testid"];
|
|
9987
10192
|
}
|
|
9988
10193
|
connectedCallback() {
|
|
10194
|
+
upgradeProperties(this);
|
|
9989
10195
|
if (!this.iconEl)
|
|
9990
10196
|
this.render();
|
|
9991
10197
|
this.updateAppearance();
|
|
@@ -10161,6 +10367,7 @@ class ArkSplitPane extends HTMLElementBase {
|
|
|
10161
10367
|
return ["direction", "sizes", "lang", "locale-json", "theme", "class", "testid"];
|
|
10162
10368
|
}
|
|
10163
10369
|
connectedCallback() {
|
|
10370
|
+
upgradeProperties(this);
|
|
10164
10371
|
if (!this.observer) {
|
|
10165
10372
|
// Painéis que entram ou saem mudam o número de alças e a distribuição.
|
|
10166
10373
|
this.observer = new MutationObserver(() => this.updateAppearance());
|
|
@@ -10391,6 +10598,7 @@ class ArkStatusDot extends HTMLElementBase {
|
|
|
10391
10598
|
return ["intent", "label", "size", "theme", "class", "testid"];
|
|
10392
10599
|
}
|
|
10393
10600
|
connectedCallback() {
|
|
10601
|
+
upgradeProperties(this);
|
|
10394
10602
|
this.updateAppearance();
|
|
10395
10603
|
}
|
|
10396
10604
|
attributeChangedCallback(name) {
|
|
@@ -10501,6 +10709,7 @@ class ArkSwitch extends HTMLElementBase {
|
|
|
10501
10709
|
];
|
|
10502
10710
|
}
|
|
10503
10711
|
connectedCallback() {
|
|
10712
|
+
upgradeProperties(this);
|
|
10504
10713
|
if (!this.trackEl) {
|
|
10505
10714
|
this.render();
|
|
10506
10715
|
}
|
|
@@ -10842,6 +11051,7 @@ class ArkTab extends HTMLElementBase {
|
|
|
10842
11051
|
this.addEventListener("keydown", this.handleKeydown);
|
|
10843
11052
|
}
|
|
10844
11053
|
connectedCallback() {
|
|
11054
|
+
upgradeProperties(this);
|
|
10845
11055
|
this.updateAppearance();
|
|
10846
11056
|
}
|
|
10847
11057
|
attributeChangedCallback(name) {
|
|
@@ -11202,6 +11412,7 @@ class ArkTabs extends HTMLElementBase {
|
|
|
11202
11412
|
this.addEventListener("keydown", this.handleKeydown);
|
|
11203
11413
|
}
|
|
11204
11414
|
connectedCallback() {
|
|
11415
|
+
upgradeProperties(this);
|
|
11205
11416
|
if (!this.observer) {
|
|
11206
11417
|
this.observer = new MutationObserver(() => this.syncTabs());
|
|
11207
11418
|
this.observer.observe(this, { childList: true, subtree: true });
|
|
@@ -11403,6 +11614,7 @@ class ArkTextarea extends HTMLElementBase {
|
|
|
11403
11614
|
];
|
|
11404
11615
|
}
|
|
11405
11616
|
connectedCallback() {
|
|
11617
|
+
upgradeProperties(this);
|
|
11406
11618
|
if (!this.textareaEl) {
|
|
11407
11619
|
this.render();
|
|
11408
11620
|
}
|
|
@@ -11600,6 +11812,7 @@ class ArkToaster extends HTMLElementBase {
|
|
|
11600
11812
|
return ["theme", "position", "rich-colors", "close-button", "max-visible", "duration", "lang", "testid"];
|
|
11601
11813
|
}
|
|
11602
11814
|
connectedCallback() {
|
|
11815
|
+
upgradeProperties(this);
|
|
11603
11816
|
this.build();
|
|
11604
11817
|
window.addEventListener("ark-toast", this.handleToast);
|
|
11605
11818
|
window.addEventListener("ark-toast-dismiss", this.handleDismiss);
|
|
@@ -11993,6 +12206,7 @@ class ArkToggle extends HTMLElementBase {
|
|
|
11993
12206
|
this.addEventListener("keyup", this.handleKeyup);
|
|
11994
12207
|
}
|
|
11995
12208
|
connectedCallback() {
|
|
12209
|
+
upgradeProperties(this);
|
|
11996
12210
|
this.updateAppearance();
|
|
11997
12211
|
}
|
|
11998
12212
|
attributeChangedCallback(name) {
|
|
@@ -12198,6 +12412,7 @@ class ArkToggleGroup extends HTMLElementBase {
|
|
|
12198
12412
|
this.addEventListener("change", this.handleToggleChange);
|
|
12199
12413
|
}
|
|
12200
12414
|
connectedCallback() {
|
|
12415
|
+
upgradeProperties(this);
|
|
12201
12416
|
if (!this.observer) {
|
|
12202
12417
|
this.observer = new MutationObserver(() => this.syncToggles());
|
|
12203
12418
|
this.observer.observe(this, { childList: true, subtree: true });
|
|
@@ -12396,6 +12611,7 @@ class ArkTooltip extends HTMLElementBase {
|
|
|
12396
12611
|
this.addEventListener("focusout", this.handleFocusOut);
|
|
12397
12612
|
}
|
|
12398
12613
|
connectedCallback() {
|
|
12614
|
+
upgradeProperties(this);
|
|
12399
12615
|
if (!this.observer) {
|
|
12400
12616
|
this.observer = new MutationObserver(() => this.updateAppearance());
|
|
12401
12617
|
this.observer.observe(this, { childList: true });
|
|
@@ -12424,7 +12640,8 @@ class ArkTooltip extends HTMLElementBase {
|
|
|
12424
12640
|
if (!this.isConnected)
|
|
12425
12641
|
return;
|
|
12426
12642
|
if (name === "open") {
|
|
12427
|
-
|
|
12643
|
+
// Sem o observer o connectedCallback ainda não rodou (upgrade de uma tag já no DOM): quem abre é ele.
|
|
12644
|
+
if (this.syncingOpen || !this.observer)
|
|
12428
12645
|
return;
|
|
12429
12646
|
if (this.hasAttribute("open")) {
|
|
12430
12647
|
this.show();
|
|
@@ -12444,8 +12661,9 @@ class ArkTooltip extends HTMLElementBase {
|
|
|
12444
12661
|
}
|
|
12445
12662
|
set open(value) {
|
|
12446
12663
|
const next = coerceBooleanAttr(value);
|
|
12447
|
-
//
|
|
12448
|
-
|
|
12664
|
+
// Antes do connectedCallback (React 19 e Vue gravam a prop antes de inserir o nó; o upgrade de uma tag já no DOM
|
|
12665
|
+
// a reaplica ao conectar): só reflete, e o connectedCallback abre.
|
|
12666
|
+
if (!this.isConnected || !this.observer) {
|
|
12449
12667
|
this.toggleAttribute("open", next);
|
|
12450
12668
|
return;
|
|
12451
12669
|
}
|