@antadesign/anta 0.3.25 → 0.3.27

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 (104) hide show
  1. package/README.md +26 -28
  2. package/dist/anta_helpers.d.ts +4 -0
  3. package/dist/anta_helpers.js +17 -3
  4. package/dist/box-types.d.ts +161 -0
  5. package/dist/box-types.js +0 -0
  6. package/dist/bundle.css +1 -1
  7. package/dist/bundle.js +25 -25
  8. package/dist/capture-types.d.ts +156 -0
  9. package/dist/capture-types.js +0 -0
  10. package/dist/components/Box.d.ts +52 -0
  11. package/dist/components/Box.js +55 -0
  12. package/dist/components/Capture.d.ts +39 -0
  13. package/dist/components/Capture.js +36 -0
  14. package/dist/components/capture-props.d.ts +30 -0
  15. package/dist/components/capture-props.js +44 -0
  16. package/dist/elements/a-avatar.css +1 -1
  17. package/dist/elements/a-banner.css +1 -1
  18. package/dist/elements/a-banner.js +4 -4
  19. package/dist/elements/a-box.css +1 -0
  20. package/dist/elements/a-box.d.ts +41 -0
  21. package/dist/elements/a-box.js +584 -0
  22. package/dist/elements/a-button.css +1 -1
  23. package/dist/elements/a-calendar.js +2 -2
  24. package/dist/elements/a-capture.css +1 -0
  25. package/dist/elements/a-capture.d.ts +10 -0
  26. package/dist/elements/a-capture.js +24 -0
  27. package/dist/elements/a-card.css +1 -1
  28. package/dist/elements/a-checkbox.css +1 -1
  29. package/dist/elements/a-checkbox.js +4 -4
  30. package/dist/elements/a-dialog.css +1 -1
  31. package/dist/elements/a-expander.css +1 -1
  32. package/dist/elements/a-expander.js +2 -2
  33. package/dist/elements/a-input-time.css +1 -1
  34. package/dist/elements/a-input-time.js +3 -3
  35. package/dist/elements/a-input.css +1 -1
  36. package/dist/elements/a-input.js +6 -6
  37. package/dist/elements/a-menu-item.css +1 -1
  38. package/dist/elements/a-menu-item.js +3 -3
  39. package/dist/elements/a-menu.css +1 -1
  40. package/dist/elements/a-menu.js +2 -2
  41. package/dist/elements/a-radio-group.js +3 -3
  42. package/dist/elements/a-radio.css +1 -1
  43. package/dist/elements/a-slider.css +1 -1
  44. package/dist/elements/a-slider.js +6 -6
  45. package/dist/elements/a-switch.css +1 -1
  46. package/dist/elements/a-switch.js +2 -2
  47. package/dist/elements/a-tabpanel.js +2 -2
  48. package/dist/elements/a-tabs.css +1 -1
  49. package/dist/elements/a-tabs.js +6 -6
  50. package/dist/elements/a-tag.css +1 -1
  51. package/dist/elements/a-text.css +1 -1
  52. package/dist/elements/a-title.css +1 -1
  53. package/dist/elements/a-toast.js +2 -2
  54. package/dist/elements/a-tooltip.css +1 -1
  55. package/dist/elements/a-tooltip.d.ts +4 -3
  56. package/dist/elements/a-tooltip.js +9 -5
  57. package/dist/elements/capture-input.d.ts +5 -0
  58. package/dist/elements/capture-input.js +609 -0
  59. package/dist/elements/index.d.ts +2 -0
  60. package/dist/elements/index.js +6 -0
  61. package/dist/general_types.d.ts +70 -0
  62. package/dist/index.d.ts +6 -0
  63. package/dist/index.js +4 -0
  64. package/dist/jsx-runtime.d.ts +3 -1
  65. package/docs/accessibility.md +24 -0
  66. package/docs/changelog.md +45 -3
  67. package/docs/colors.md +141 -0
  68. package/docs/comparison.md +463 -28
  69. package/docs/components/avatar.md +364 -0
  70. package/docs/components/banner.md +13 -27
  71. package/docs/components/box.md +354 -0
  72. package/docs/components/breadcrumbs.md +7 -6
  73. package/docs/components/button.md +48 -37
  74. package/docs/components/capture.md +345 -0
  75. package/docs/components/card.md +17 -38
  76. package/docs/components/checkbox.md +16 -39
  77. package/docs/components/dialog.md +14 -36
  78. package/docs/components/expander.md +15 -40
  79. package/docs/components/icon.md +111 -9
  80. package/docs/components/input-autocomplete.md +9 -11
  81. package/docs/components/input-date.md +33 -23
  82. package/docs/components/input-time.md +15 -23
  83. package/docs/components/input.md +27 -76
  84. package/docs/components/loader.md +7 -5
  85. package/docs/components/menu.md +73 -77
  86. package/docs/components/progress.md +10 -14
  87. package/docs/components/radio.md +17 -36
  88. package/docs/components/select-faceted.md +7 -25
  89. package/docs/components/select.md +24 -97
  90. package/docs/components/slider.md +16 -21
  91. package/docs/components/steps.md +38 -8
  92. package/docs/components/switch.md +11 -14
  93. package/docs/components/tabs.md +52 -40
  94. package/docs/components/tag.md +11 -22
  95. package/docs/components/text.md +10 -23
  96. package/docs/components/title.md +7 -8
  97. package/docs/components/toaster.md +6 -3
  98. package/docs/components/tooltip.md +13 -23
  99. package/docs/index.md +6 -3
  100. package/docs/install-config.md +24 -0
  101. package/docs/normalization.md +45 -0
  102. package/docs/packages/stickers.md +56 -0
  103. package/docs/theming.md +270 -0
  104. package/package.json +3 -1
@@ -0,0 +1,584 @@
1
+ import { HTMLElementBase } from "../anta_helpers";
2
+ import "./a-box.css";
3
+ const stores = /* @__PURE__ */ new WeakMap();
4
+ const MODE_CLASS = /(?:^|\s)(?:dark|light)(?:\s|$)/;
5
+ function hasModeClass(element) {
6
+ return element.classList.contains("dark") || element.classList.contains("light");
7
+ }
8
+ class BoxWindowStore {
9
+ constructor(view, doc) {
10
+ this.view = view;
11
+ this.doc = doc;
12
+ this.#dark = view.matchMedia("(prefers-color-scheme: dark)");
13
+ this.#finePointer = view.matchMedia("(pointer: fine)");
14
+ this.#coarsePointer = view.matchMedia("(pointer: coarse)");
15
+ this.#hover = view.matchMedia("(hover: hover)");
16
+ this.#reducedMotion = view.matchMedia("(prefers-reduced-motion: reduce)");
17
+ this.#queries = [this.#dark, this.#finePointer, this.#coarsePointer, this.#hover, this.#reducedMotion];
18
+ this.#device = deviceSnapshot(view.navigator);
19
+ }
20
+ #contextBoxes = /* @__PURE__ */ new Set();
21
+ #observedBoxes = /* @__PURE__ */ new Set();
22
+ #dark;
23
+ #finePointer;
24
+ #coarsePointer;
25
+ #hover;
26
+ #reducedMotion;
27
+ #queries;
28
+ #classObserver;
29
+ #visibility;
30
+ #pixelRatio;
31
+ #lastPixelRatio = 0;
32
+ #device;
33
+ /** Only a box with a `contextchange` listener subscribes, so a page that never
34
+ * reads context pays for no media listeners and no document observer. */
35
+ subscribeContext(box) {
36
+ if (this.#contextBoxes.size === 0) this.#startWatching();
37
+ this.#contextBoxes.add(box);
38
+ }
39
+ unsubscribeContext(box) {
40
+ if (!this.#contextBoxes.delete(box)) return;
41
+ if (this.#contextBoxes.size === 0) this.#stopWatching();
42
+ this.#collect();
43
+ }
44
+ /** Only a box that measures is tracked, and it measures only while on screen. */
45
+ observeVisibility(box) {
46
+ if (this.#observedBoxes.has(box)) return;
47
+ if (typeof this.view.IntersectionObserver === "undefined") {
48
+ box.visibilityDidChange(true);
49
+ return;
50
+ }
51
+ this.#visibility ??= new this.view.IntersectionObserver(
52
+ (entries) => {
53
+ for (const entry of entries) {
54
+ const box2 = entry.target;
55
+ if (this.#observedBoxes.has(box2)) box2.visibilityDidChange(entry.isIntersecting);
56
+ }
57
+ },
58
+ { root: null, rootMargin: "0px", threshold: 0 }
59
+ );
60
+ this.#observedBoxes.add(box);
61
+ this.#visibility.observe(box);
62
+ }
63
+ unobserveVisibility(box) {
64
+ if (!this.#observedBoxes.delete(box)) return;
65
+ this.#visibility?.unobserve(box);
66
+ if (this.#observedBoxes.size === 0) {
67
+ this.#visibility?.disconnect();
68
+ this.#visibility = void 0;
69
+ }
70
+ this.#collect();
71
+ }
72
+ snapshot() {
73
+ return {
74
+ globalMode: modeFromElement(this.doc.documentElement),
75
+ systemAppearance: this.#dark.matches ? "dark" : "light",
76
+ ...this.#device,
77
+ pointer: this.#finePointer.matches ? "fine" : this.#coarsePointer.matches ? "coarse" : "none",
78
+ hover: this.#hover.matches,
79
+ reducedMotion: this.#reducedMotion.matches,
80
+ devicePixelRatio: this.view.devicePixelRatio
81
+ };
82
+ }
83
+ /* devicePixelRatio has no change event of its own, so two signals cover it.
84
+ A resolution query pinned to the current value stops matching the moment
85
+ the ratio moves; each fire re-arms against the new value. Page zoom also
86
+ resizes the CSS viewport, and `resize` catches the engines and paths where
87
+ the query stays quiet. Both funnel through the same guard, so whichever
88
+ arrives first reports and the other is a no-op. */
89
+ #watchPixelRatio() {
90
+ this.#pixelRatio?.removeEventListener("change", this.#pixelRatioDidChange);
91
+ this.#pixelRatio = this.view.matchMedia(`(resolution: ${this.view.devicePixelRatio}dppx)`);
92
+ this.#pixelRatio.addEventListener("change", this.#pixelRatioDidChange, { once: true });
93
+ this.#lastPixelRatio = this.view.devicePixelRatio;
94
+ }
95
+ #pixelRatioDidChange = () => {
96
+ if (this.view.devicePixelRatio === this.#lastPixelRatio) return;
97
+ this.#watchPixelRatio();
98
+ this.#notifyAll();
99
+ };
100
+ #startWatching() {
101
+ for (const query of this.#queries) query.addEventListener("change", this.#notifyAll);
102
+ this.#watchPixelRatio();
103
+ this.view.addEventListener("resize", this.#pixelRatioDidChange, { passive: true });
104
+ const root = this.doc.documentElement;
105
+ if (!root) return;
106
+ this.#classObserver = new this.view.MutationObserver(this.#handleClassChange);
107
+ this.#classObserver.observe(root, {
108
+ subtree: true,
109
+ attributes: true,
110
+ attributeOldValue: true,
111
+ attributeFilter: ["class"]
112
+ });
113
+ }
114
+ #stopWatching() {
115
+ for (const query of this.#queries) query.removeEventListener("change", this.#notifyAll);
116
+ this.#pixelRatio?.removeEventListener("change", this.#pixelRatioDidChange);
117
+ this.#pixelRatio = void 0;
118
+ this.view.removeEventListener("resize", this.#pixelRatioDidChange);
119
+ this.#classObserver?.disconnect();
120
+ this.#classObserver = void 0;
121
+ }
122
+ /* Only the store the map currently points at may remove that entry. A box
123
+ that was connected while its store went empty keeps a direct reference to
124
+ it, so an evicted store can be re-subscribed and later empty again — by
125
+ which time the map holds a live store with its own document observer.
126
+ Deleting blind would drop that live store and leave its observer running
127
+ while the next connect built a second one. */
128
+ #collect() {
129
+ if (this.#contextBoxes.size > 0 || this.#observedBoxes.size > 0) return;
130
+ if (stores.get(this.view) === this) stores.delete(this.view);
131
+ }
132
+ /* Only `dark` and `light` change what a box reports. Every other class toggle
133
+ on the page — a route class, a scroll lock, a theme-unrelated modifier —
134
+ is dropped here, before the ancestor scan runs. */
135
+ #handleClassChange = (records) => {
136
+ const affected = /* @__PURE__ */ new Set();
137
+ for (const record of records) {
138
+ const target = record.target;
139
+ if (!(target instanceof this.view.Element)) continue;
140
+ if (!hasModeClass(target) && !MODE_CLASS.test(record.oldValue ?? "")) continue;
141
+ for (const box of this.#contextBoxes) {
142
+ if (target === box || target.contains(box)) affected.add(box);
143
+ }
144
+ }
145
+ for (const box of affected) box.contextStoreDidChange();
146
+ };
147
+ #notifyAll = () => {
148
+ for (const box of this.#contextBoxes) box.contextStoreDidChange();
149
+ };
150
+ }
151
+ function windowStore(view, doc) {
152
+ let store = stores.get(view);
153
+ if (!store) {
154
+ store = new BoxWindowStore(view, doc);
155
+ stores.set(view, store);
156
+ }
157
+ return store;
158
+ }
159
+ function modeFromElement(element) {
160
+ return element?.classList.contains("dark") ? "dark" : "light";
161
+ }
162
+ function localMode(element) {
163
+ for (let current = element; current; current = current.parentElement) {
164
+ if (current.classList.contains("dark")) return "dark";
165
+ if (current.classList.contains("light")) return "light";
166
+ }
167
+ return modeFromElement(element.ownerDocument.documentElement);
168
+ }
169
+ const BROWSER_VERSION = {
170
+ edge: /edg[ea]?\/(\d+)/,
171
+ opera: /opr\/(\d+)/,
172
+ firefox: /(?:firefox|fxios)\/(\d+)/,
173
+ chrome: /(?:chrome|crios)\/(\d+)/,
174
+ safari: /version\/(\d+)/,
175
+ unknown: /(?!)/
176
+ };
177
+ const OS_VERSION = {
178
+ windows: /windows nt ([\d.]+)/,
179
+ macos: /mac os x (\d+[._]\d+(?:[._]\d+)?)/,
180
+ ios: /os (\d+[._]\d+(?:[._]\d+)?)/,
181
+ android: /android (\d+(?:\.\d+)*)/
182
+ };
183
+ function deviceSnapshot(navigator) {
184
+ const uaData = navigator;
185
+ const ua = (navigator.userAgent ?? "").toLowerCase();
186
+ const source = `${uaData.userAgentData?.platform ?? ""} ${navigator.platform ?? ""} ${ua}`.toLowerCase();
187
+ const os = /android/.test(source) ? "android" : /iphone|ipad|ipod|ios/.test(source) ? "ios" : /mac/.test(source) ? "macos" : /win/.test(source) ? "windows" : /linux/.test(source) ? "linux" : "unknown";
188
+ const browser = /edg[ea]?\//.test(ua) ? "edge" : /opr\/|opera/.test(ua) ? "opera" : /firefox\/|fxios\//.test(ua) ? "firefox" : /chrome\/|crios\//.test(ua) ? "chrome" : /safari\//.test(ua) ? "safari" : "unknown";
189
+ const brands = uaData.userAgentData?.brands ?? [];
190
+ const branded = brands.filter((b) => !/not.a.brand/i.test(b.brand)).sort((a, b) => Number(/chromium/i.test(a.brand)) - Number(/chromium/i.test(b.brand)))[0];
191
+ return {
192
+ os,
193
+ osVersion: parseInt(ua.match(OS_VERSION[os] ?? /(?!)/)?.[1] ?? "", 10) || 0,
194
+ browser,
195
+ browserVersion: Number(branded?.version ?? ua.match(BROWSER_VERSION[browser])?.[1]) || 0,
196
+ mobile: uaData.userAgentData?.mobile ?? /android|mobi|iphone|ipad|ipod/.test(source)
197
+ };
198
+ }
199
+ function equal(a, b) {
200
+ if (a === b) return true;
201
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
202
+ const left = a;
203
+ const right = b;
204
+ const keys = Object.keys(left);
205
+ return keys.length === Object.keys(right).length && keys.every((key) => left[key] === right[key]);
206
+ }
207
+ function same(a, b) {
208
+ return a !== void 0 && Object.keys(b).every((key) => equal(a[key], b[key]));
209
+ }
210
+ function changed(previous, current) {
211
+ if (!previous) return { ...current };
212
+ return Object.fromEntries(
213
+ Object.entries(current).filter(([key, value]) => !equal(previous[key], value))
214
+ );
215
+ }
216
+ function px(value) {
217
+ return parseFloat(value) || 0;
218
+ }
219
+ function readInset(styles) {
220
+ return {
221
+ paddingTop: px(styles.paddingTop),
222
+ paddingRight: px(styles.paddingRight),
223
+ paddingBottom: px(styles.paddingBottom),
224
+ paddingLeft: px(styles.paddingLeft),
225
+ borderTop: px(styles.borderTopWidth),
226
+ borderRight: px(styles.borderRightWidth),
227
+ borderBottom: px(styles.borderBottomWidth),
228
+ borderLeft: px(styles.borderLeftWidth)
229
+ };
230
+ }
231
+ function spacing(value) {
232
+ return value === "normal" ? "0px" : value;
233
+ }
234
+ function readFont(styles) {
235
+ const lineHeightPx = parseFloat(styles.lineHeight);
236
+ const lineHeight = Number.isFinite(lineHeightPx) ? lineHeightPx : null;
237
+ const style = styles.fontStyle && styles.fontStyle !== "normal" ? `${styles.fontStyle} ` : "";
238
+ const weight = styles.fontWeight && styles.fontWeight !== "400" ? `${styles.fontWeight} ` : "";
239
+ const height = lineHeight != null ? `/${lineHeight}px` : "";
240
+ return {
241
+ shorthand: `${style}${weight}${styles.fontSize}${height} ${styles.fontFamily}`,
242
+ family: styles.fontFamily,
243
+ size: parseFloat(styles.fontSize) || 0,
244
+ weight: parseFloat(styles.fontWeight) || 400,
245
+ style: styles.fontStyle,
246
+ stretch: styles.fontStretch,
247
+ lineHeight,
248
+ letterSpacing: spacing(styles.letterSpacing),
249
+ wordSpacing: spacing(styles.wordSpacing),
250
+ color: styles.color,
251
+ featureSettings: styles.fontFeatureSettings,
252
+ variationSettings: styles.fontVariationSettings,
253
+ kerning: styles.fontKerning,
254
+ variantCaps: styles.fontVariantCaps,
255
+ textRendering: styles.textRendering,
256
+ direction: styles.direction
257
+ };
258
+ }
259
+ function rounded(value) {
260
+ return Math.round(value * 100) / 100;
261
+ }
262
+ class ABoxElement extends HTMLElementBase {
263
+ static observedAttributes = ["fade", "observe"];
264
+ #internals = this.attachInternals?.();
265
+ #store;
266
+ #resizeObserver;
267
+ #contentObserver;
268
+ #hostObserver;
269
+ #frame;
270
+ #contextQueued = false;
271
+ #measurement;
272
+ #context;
273
+ #measuring = false;
274
+ #clips = false;
275
+ #observedChildren = /* @__PURE__ */ new Set();
276
+ #reportingContext = false;
277
+ /* Undefined until the visibility observer first reports. `fade` is the one
278
+ thing that cannot wait for it — the mask is painted from the CSS states, so
279
+ a box that deferred its first measurement would flash unmasked. Everything
280
+ else stays idle until it is known to be on screen, which keeps a page of
281
+ hundreds of boxes from measuring every one of them once at connect only to
282
+ tear it all down a frame later. */
283
+ #visible;
284
+ #initialMeasurement = false;
285
+ #initialContext = false;
286
+ connectedCallback() {
287
+ this.#store = windowStore(this.view, this.doc);
288
+ this.#sync();
289
+ }
290
+ disconnectedCallback() {
291
+ this.#stopMeasuring();
292
+ this.#stopReportingContext();
293
+ this.#store?.unobserveVisibility(this);
294
+ this.#store = void 0;
295
+ this.#visible = void 0;
296
+ }
297
+ /* Guarded on the store, not on `isConnected`: upgrading an element that is
298
+ already in the document runs this for every present attribute *before*
299
+ connectedCallback, when there is no store yet. Syncing then would flip the
300
+ started flags while `this.#store?.subscribeContext` silently did nothing,
301
+ and the later connect would see the flags already set and skip it. */
302
+ attributeChangedCallback(name) {
303
+ if (!this.#store) return;
304
+ if (name === "fade" || name === "observe") this.#sync();
305
+ }
306
+ /** A fresh measurement snapshot. For notifications, prefer `measurechange`:
307
+ * it batches browser observers and includes the field-level delta. */
308
+ get measurement() {
309
+ return this.#readMeasurement();
310
+ }
311
+ /** A fresh context snapshot. For changes, prefer `contextchange`. */
312
+ get context() {
313
+ return this.#readContext();
314
+ }
315
+ /** Allows a nested `Tooltip truncatedOnly` to use Box's clipping decision. */
316
+ get isTruncated() {
317
+ const measurement = this.#readMeasurement();
318
+ return measurement.clippedX || measurement.clippedY;
319
+ }
320
+ /** Called by the per-window context cache. It is intentionally not a JSX prop. */
321
+ contextStoreDidChange() {
322
+ this.#queueContext();
323
+ this.#queueMeasurement();
324
+ }
325
+ /** Called by the per-window visibility observer. Also not a JSX prop. */
326
+ visibilityDidChange(visible) {
327
+ if (this.#visible === visible) return;
328
+ this.#visible = visible;
329
+ this.#sync();
330
+ }
331
+ /* Nothing observes until something wants the answer, and a box scrolled off
332
+ screen wants nothing until it comes back. Context reporting ignores
333
+ visibility: a mode change has to reach an off-screen box too, and the store
334
+ it subscribes to is already refcounted down to nothing. */
335
+ #sync() {
336
+ const observe = this.getAttribute("observe");
337
+ const both = observe === "" || observe === "all";
338
+ const wantsMeasurement = this.hasAttribute("fade") || both || observe === "size";
339
+ const wantsContext = both || observe === "context";
340
+ const measure = this.isConnected && wantsMeasurement && (this.#visible ?? this.hasAttribute("fade"));
341
+ if (measure) this.#startMeasuring();
342
+ else this.#stopMeasuring();
343
+ if (this.isConnected && wantsMeasurement) this.#store?.observeVisibility(this);
344
+ else this.#store?.unobserveVisibility(this);
345
+ if (this.isConnected && wantsContext) this.#startReportingContext();
346
+ else this.#stopReportingContext();
347
+ this.#syncHostObserver();
348
+ }
349
+ /* The host's own attributes need their own observer: one observer cannot take
350
+ `subtree: true` for childList and `subtree: false` for attributes on the
351
+ same target. A class on this box can flip it to `overflow: auto` without
352
+ changing its size, and can restyle its text, so both halves want to know. */
353
+ #syncHostObserver() {
354
+ const wanted = this.#measuring || this.#reportingContext;
355
+ if (wanted === Boolean(this.#hostObserver)) return;
356
+ if (wanted) {
357
+ this.#hostObserver = new this.view.MutationObserver(this.#hostDidChange);
358
+ this.#hostObserver.observe(this, { attributes: true });
359
+ } else {
360
+ this.#hostObserver?.disconnect();
361
+ this.#hostObserver = void 0;
362
+ }
363
+ }
364
+ #hostDidChange = () => {
365
+ this.#queueMeasurement();
366
+ this.#queueContext();
367
+ };
368
+ #startMeasuring() {
369
+ if (this.#measuring) return;
370
+ this.#measuring = true;
371
+ this.#resizeObserver = new this.view.ResizeObserver(this.#queueMeasurement);
372
+ this.#resizeObserver.observe(this);
373
+ this.#contentObserver = new this.view.MutationObserver(this.#queueMeasurement);
374
+ this.#contentObserver.observe(this, {
375
+ subtree: true,
376
+ childList: true,
377
+ characterData: true
378
+ });
379
+ this.addEventListener("input", this.#queueMeasurement);
380
+ this.addEventListener("scroll", this.#queueMeasurement, { passive: true });
381
+ this.addEventListener("load", this.#queueMeasurement, true);
382
+ this.doc.fonts?.addEventListener("loadingdone", this.#queueMeasurement);
383
+ this.#measurement = this.#readMeasurement();
384
+ this.#setMeasurementStates(this.#measurement);
385
+ this.#syncChildObservation();
386
+ this.#initialMeasurement = true;
387
+ this.#queueMeasurement();
388
+ }
389
+ /* A clipping box's scroll size can move because a child's own size moved for
390
+ a reason nothing else here can see: a late upgrade attaching a shadow root,
391
+ or a child resizing from its own internal state (an Expander opening).
392
+ Neither is a light-DOM mutation, and a fixed-size box never resizes, so the
393
+ direct children go into the same ResizeObserver. A box with visible
394
+ overflow hides nothing — a growing child just grows the box, which its own
395
+ entry already reports — so it observes no children at all. */
396
+ #syncChildObservation() {
397
+ if (!this.#clips || !this.#measuring) {
398
+ for (const child of this.#observedChildren) this.#resizeObserver?.unobserve(child);
399
+ this.#observedChildren.clear();
400
+ return;
401
+ }
402
+ const current = new Set(this.children);
403
+ for (const child of this.#observedChildren) {
404
+ if (current.has(child)) continue;
405
+ this.#resizeObserver?.unobserve(child);
406
+ this.#observedChildren.delete(child);
407
+ }
408
+ for (const child of current) {
409
+ if (this.#observedChildren.has(child)) continue;
410
+ this.#resizeObserver?.observe(child);
411
+ this.#observedChildren.add(child);
412
+ }
413
+ }
414
+ #stopMeasuring() {
415
+ if (!this.#measuring) return;
416
+ this.#measuring = false;
417
+ this.#observedChildren.clear();
418
+ this.#resizeObserver?.disconnect();
419
+ this.#resizeObserver = void 0;
420
+ this.#contentObserver?.disconnect();
421
+ this.#contentObserver = void 0;
422
+ if (this.#frame != null) this.view.cancelAnimationFrame(this.#frame);
423
+ this.#frame = void 0;
424
+ this.removeEventListener("input", this.#queueMeasurement);
425
+ this.removeEventListener("scroll", this.#queueMeasurement);
426
+ this.removeEventListener("load", this.#queueMeasurement, true);
427
+ this.doc.fonts?.removeEventListener("loadingdone", this.#queueMeasurement);
428
+ }
429
+ #startReportingContext() {
430
+ if (this.#reportingContext) return;
431
+ this.#reportingContext = true;
432
+ this.#store?.subscribeContext(this);
433
+ this.addEventListener("focusin", this.#queueContext);
434
+ this.addEventListener("focusout", this.#handleFocusOut);
435
+ this.doc.fonts?.addEventListener("loadingdone", this.#queueContext);
436
+ this.#initialContext = true;
437
+ this.#queueContext();
438
+ }
439
+ #stopReportingContext() {
440
+ if (!this.#reportingContext) return;
441
+ this.#reportingContext = false;
442
+ this.#store?.unsubscribeContext(this);
443
+ this.removeEventListener("focusin", this.#queueContext);
444
+ this.removeEventListener("focusout", this.#handleFocusOut);
445
+ this.doc.fonts?.removeEventListener("loadingdone", this.#queueContext);
446
+ }
447
+ /* Tabbing between two descendants fires focusout then focusin, and WebKit runs
448
+ a microtask checkpoint between the two — long enough to report a
449
+ focusWithin: false that was never true for the reader. `relatedTarget` is
450
+ where focus is heading (retargeted to the host for a shadow child), so a
451
+ move that stays inside is not a change at all. */
452
+ #handleFocusOut = (event) => {
453
+ const next = event.relatedTarget;
454
+ if (next instanceof this.view.Node && this.contains(next)) return;
455
+ this.#queueContext();
456
+ };
457
+ #queueMeasurement = () => {
458
+ if (!this.#measuring || this.#frame != null) return;
459
+ this.#frame = this.view.requestAnimationFrame(() => {
460
+ this.#frame = void 0;
461
+ if (!this.#measuring) return;
462
+ const initial = this.#initialMeasurement;
463
+ this.#initialMeasurement = false;
464
+ this.#reportMeasurement(initial);
465
+ });
466
+ };
467
+ #queueContext = () => {
468
+ if (!this.#reportingContext || this.#contextQueued) return;
469
+ this.#contextQueued = true;
470
+ queueMicrotask(() => {
471
+ this.#contextQueued = false;
472
+ if (!this.#reportingContext) return;
473
+ const initial = this.#initialContext;
474
+ this.#initialContext = false;
475
+ this.#reportContext(initial);
476
+ });
477
+ };
478
+ #readMeasurement() {
479
+ const rect = this.getBoundingClientRect();
480
+ const clientWidth = this.clientWidth;
481
+ const clientHeight = this.clientHeight;
482
+ const scrollWidth = this.scrollWidth;
483
+ const scrollHeight = this.scrollHeight;
484
+ const hasBox = clientWidth > 0 || clientHeight > 0;
485
+ const overflowX = hasBox && scrollWidth > clientWidth + 1;
486
+ const overflowY = hasBox && scrollHeight > clientHeight + 1;
487
+ const styles = this.view.getComputedStyle(this);
488
+ this.#clips = styles.overflowX !== "visible" || styles.overflowY !== "visible";
489
+ const clippedX = overflowX && styles.overflowX !== "visible";
490
+ const clippedY = overflowY && styles.overflowY !== "visible";
491
+ const scrollableX = overflowX && (styles.overflowX === "auto" || styles.overflowX === "scroll");
492
+ const scrollableY = overflowY && (styles.overflowY === "auto" || styles.overflowY === "scroll");
493
+ const scrollLeft = Math.round(this.scrollLeft);
494
+ const scrollTop = Math.round(this.scrollTop);
495
+ const fromStartX = Math.max(0, styles.direction === "rtl" ? -scrollLeft : scrollLeft);
496
+ const fromStartY = Math.max(0, scrollTop);
497
+ return {
498
+ width: rounded(rect.width),
499
+ height: rounded(rect.height),
500
+ clientWidth,
501
+ clientHeight,
502
+ scrollWidth,
503
+ scrollHeight,
504
+ overflowX,
505
+ overflowY,
506
+ clippedX,
507
+ clippedY,
508
+ scrollableX,
509
+ scrollableY,
510
+ scrollLeft,
511
+ scrollTop,
512
+ hiddenStartX: clippedX && fromStartX > 1,
513
+ hiddenEndX: clippedX && fromStartX < scrollWidth - clientWidth - 1,
514
+ hiddenStartY: clippedY && fromStartY > 1,
515
+ hiddenEndY: clippedY && fromStartY < scrollHeight - clientHeight - 1
516
+ };
517
+ }
518
+ #readContext() {
519
+ const shared = (this.#store ?? windowStore(this.view, this.doc)).snapshot();
520
+ const styles = this.view.getComputedStyle(this);
521
+ return {
522
+ ...shared,
523
+ mode: localMode(this),
524
+ focusWithin: this.matches(":focus-within"),
525
+ font: readFont(styles),
526
+ inset: readInset(styles),
527
+ backgroundColor: styles.backgroundColor
528
+ };
529
+ }
530
+ #reportMeasurement(initial) {
531
+ const current = this.#readMeasurement();
532
+ const previous = this.#measurement;
533
+ this.#measurement = current;
534
+ this.#setMeasurementStates(current);
535
+ this.#syncChildObservation();
536
+ if (!initial && same(previous, current)) return;
537
+ const detail = {
538
+ changed: initial ? { ...current } : changed(previous, current),
539
+ current
540
+ };
541
+ this.dispatchEvent(new this.view.CustomEvent("measurechange", { detail }));
542
+ }
543
+ #reportContext(initial) {
544
+ const current = this.#readContext();
545
+ const previous = this.#context;
546
+ this.#context = current;
547
+ if (!initial && same(previous, current)) return;
548
+ const detail = {
549
+ changed: initial ? { ...current } : changed(previous, current),
550
+ current
551
+ };
552
+ this.dispatchEvent(new this.view.CustomEvent("contextchange", { detail }));
553
+ }
554
+ /* Only measurement states exist. Everything the context reports has a native
555
+ CSS equivalent — `:focus-within` for focus, the `.dark` ancestor class for
556
+ mode, `prefers-color-scheme` / `pointer` / `hover` / `prefers-reduced-motion`
557
+ media queries for the rest — so `contextchange` is a JS-side event only.
558
+ Overflow is the one thing CSS cannot ask about, which is what these are for. */
559
+ #setMeasurementStates(measurement) {
560
+ this.#setState("overflow-x", measurement.overflowX);
561
+ this.#setState("overflow-y", measurement.overflowY);
562
+ this.#setState("clipped-x", measurement.clippedX);
563
+ this.#setState("clipped-y", measurement.clippedY);
564
+ this.#setState("scrollable-x", measurement.scrollableX);
565
+ this.#setState("scrollable-y", measurement.scrollableY);
566
+ this.#setState("hidden-start-x", measurement.hiddenStartX);
567
+ this.#setState("hidden-end-x", measurement.hiddenEndX);
568
+ this.#setState("hidden-start-y", measurement.hiddenStartY);
569
+ this.#setState("hidden-end-y", measurement.hiddenEndY);
570
+ }
571
+ #setState(name, active) {
572
+ if (active) this.#internals?.states?.add(name);
573
+ else this.#internals?.states?.delete(name);
574
+ }
575
+ }
576
+ function register_a_box() {
577
+ if (typeof customElements === "undefined") return;
578
+ if (!customElements.get("a-box")) customElements.define("a-box", ABoxElement);
579
+ }
580
+ register_a_box();
581
+ export {
582
+ ABoxElement,
583
+ register_a_box
584
+ };
@@ -1 +1 @@
1
- @layer anta.components{a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]){--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: calc( var(--button-loading-stripe) + var(--button-loading-stripe-gap) );--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 5px;--_src: var(--anta-seed-neutral);--_tone-pl-rest: .5;--_tone-pl-hover: .45;--_tone-pl-active: .4;--_tone-pl-c: .02;--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .008;--_tone-fg-shift: .05;--_tone-bg-l: .54;--_tone-bg-c: .03;--_tone-a-rest: .1;--_tone-a-hover: .15;--_tone-a-active: .2;--_tone-quat-hover-l: .38;--_tone-quat-rest-a: .85;--button-bg-primary-rest: oklch(from var(--_src) var(--_tone-pl-rest) var(--_tone-pl-c) h);--button-bg-primary-hover: oklch(from var(--_src) var(--_tone-pl-hover) var(--_tone-pl-c) h);--button-bg-primary-active: oklch(from var(--_src) var(--_tone-pl-active) var(--_tone-pl-c) h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--_src) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-secondary-l-shift: var(--_tone-fg-shift);--button-fg-tertiary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--_src) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-tertiary-hover: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-rest));--button-bg-tertiary-active: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-hover));--button-fg-quaternary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h / var(--_tone-quat-rest-a));--button-fg-quaternary-hover: oklch(from var(--_src) var(--_tone-quat-hover-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-rest));--button-bg-secondary-hover: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-hover));--button-bg-secondary-active: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-active));--_fs: 15px;--_lh: 20px;--_pb: 1px;--_radius: 4px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round],button[data-anta][round],input[data-anta]:is([type=reset],[type=submit])[round]{--button-round: attr(round type(<length>), 999px);--_radius: var(--button-round, 999px)}a-button[tone]:not([tone=""],[tone=neutral]),a[role=button][data-anta][tone]:not([tone=""],[tone=neutral]),button[data-anta][tone]:not([tone=""],[tone=neutral]),input[data-anta]:is([type=reset],[type=submit])[tone]:not([tone=""],[tone=neutral]){--_tone-pl-rest: .51;--_tone-pl-hover: .46;--_tone-pl-active: .41;--_tone-pl-c: .17;--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-fg-shift: .05;--_tone-bg-l: .54;--_tone-bg-c: .17;--_tone-a-rest: .1;--_tone-a-hover: .15;--_tone-a-active: .2;--_tone-quat-hover-l: .38;--_tone-quat-rest-a: .85}a-button[tone=brand],a[role=button][data-anta][tone=brand],button[data-anta][tone=brand],input[data-anta]:is([type=reset],[type=submit])[tone=brand]{--_src: var(--anta-seed-brand)}a-button[tone=info],a[role=button][data-anta][tone=info],button[data-anta][tone=info],input[data-anta]:is([type=reset],[type=submit])[tone=info]{--_src: var(--anta-seed-info)}a-button[tone=success],a[role=button][data-anta][tone=success],button[data-anta][tone=success],input[data-anta]:is([type=reset],[type=submit])[tone=success]{--_src: var(--anta-seed-success)}a-button[tone=warning],a[role=button][data-anta][tone=warning],button[data-anta][tone=warning],input[data-anta]:is([type=reset],[type=submit])[tone=warning]{--_src: var(--anta-seed-warning)}a-button[tone=critical],a[role=button][data-anta][tone=critical],button[data-anta][tone=critical],input[data-anta]:is([type=reset],[type=submit])[tone=critical]{--_src: var(--anta-seed-critical)}a-button[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),a[role=button][data-anta][tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),button[data-anta][tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),input[data-anta]:is([type=reset],[type=submit])[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--_src: var(--button-tone-source, attr(tone type(<color>), transparent))}.dark a-button,.dark a[role=button][data-anta],.dark button[data-anta],.dark input[data-anta]:is([type=reset],[type=submit]){--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--_tone-pl-rest: .4;--_tone-pl-hover: .44;--_tone-pl-active: .48;--_tone-pl-c: .015;--_tone-fg-l: .86;--_tone-fg-strong-l: .86;--_tone-fg-c: .015;--_tone-fg-shift: 0;--_tone-bg-l: .44;--_tone-bg-c: .01;--_tone-a-rest: .24;--_tone-a-hover: .34;--_tone-a-active: .44;--_tone-quat-hover-l: .9;--_tone-quat-rest-a: .85}.dark a-button[tone]:not([tone=""],[tone=neutral]),.dark a[role=button][data-anta][tone]:not([tone=""],[tone=neutral]),.dark button[data-anta][tone]:not([tone=""],[tone=neutral]),.dark input[data-anta]:is([type=reset],[type=submit])[tone]:not([tone=""],[tone=neutral]){--_tone-pl-rest: .4;--_tone-pl-hover: .44;--_tone-pl-active: .48;--_tone-pl-c: .16;--_tone-fg-l: .86;--_tone-fg-strong-l: .86;--_tone-fg-c: .13;--_tone-fg-shift: 0;--_tone-bg-l: .58;--_tone-bg-c: .16;--_tone-a-rest: .215;--_tone-a-hover: .29;--_tone-a-active: .34;--_tone-quat-hover-l: .9;--_tone-quat-rest-a: .85}button[data-anta],input[data-anta]:is([type=reset],[type=submit]){box-sizing:border-box;margin:0;appearance:none;-webkit-appearance:none;border:none}a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]){user-select:none;display:inline-flex;align-items:center;gap:.5ch;cursor:pointer;&:has(>a-copy):not(:has(>a-icon)){cursor:copy}flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:var(--_radius);text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:100%;padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in oklch,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}&[underline][underline-on-hover]{text-decoration-color:transparent;&[selected]{text-decoration-color:transparent}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg)}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip):not(a-copy))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;inset:0;pointer-events:none;clip-path:inset(0 round var(--_radius));background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));background-position-x:calc(0px - var(--button-loading-x-period));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:background-position;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}&[priority=primary]{--button-fg: var(--button-fg-primary-rest);--button-bg: var(--button-bg-primary-rest);box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-bg: var(--button-bg-primary-hover)}}&:active{--button-bg: var(--button-bg-primary-active)}&[selected]{--button-bg: var(--button-bg-primary-hover)}}&[priority=tertiary]{--button-fg: var(--button-fg-tertiary-rest);--button-bg: transparent;box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&:active{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&[priority=quaternary]{--button-fg: var(--button-fg-quaternary-rest);--button-bg: transparent;box-shadow:none;font-weight:400;letter-spacing:.06ch;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-quaternary-hover)}}&:active{--button-fg: var(--button-fg-quaternary-rest)}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}}&[selected]{box-shadow:inset 0 0 0 .5px currentColor}&[disabled]{background-color:var(--bg-secondary-disabled);color:var(--fg-disabled);&[priority=primary]{background-color:var(--bg-primary-disabled);color:var(--fg-disabled-primary)}&[priority=tertiary],&[priority=quaternary]{background-color:transparent;color:var(--fg-disabled)}}}@media(forced-colors:active){:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit])){--anta-forced-foreground: ButtonText;color:ButtonText;background-color:ButtonFace;border:1px solid ButtonText;box-shadow:none}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=primary]{--anta-forced-foreground: ButtonFace;color:ButtonFace;background-color:ButtonText;border-color:ButtonText}a-button:is([priority=primary],[selected]){forced-color-adjust:none}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=tertiary]{--anta-forced-foreground: CanvasText;color:CanvasText;background-color:Canvas;border:0}@media(hover:hover)and (pointer:fine){:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=tertiary]:hover:not(:focus-visible){outline:1px solid ButtonText;outline-offset:0}}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=quaternary]{--anta-forced-foreground: LinkText;color:LinkText;background-color:ButtonFace;border:0;text-decoration:none}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[selected]{--anta-forced-foreground: HighlightText;color:HighlightText;background-color:Highlight;border-color:Highlight}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[disabled]{--anta-forced-foreground: GrayText;color:GrayText;background-color:Canvas;border-color:GrayText;text-decoration-color:GrayText}}}@keyframes btn-loading-slide{to{background-position-x:0}}
1
+ @layer anta.components{a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]){--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: calc( var(--button-loading-stripe) + var(--button-loading-stripe-gap) );--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 5px;--_src: var(--anta-seed-neutral);--_tone-pl-rest: .5;--_tone-pl-hover: .45;--_tone-pl-active: .4;--_tone-pl-c: .02;--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .008;--_tone-fg-shift: .05;--_tone-bg-l: .54;--_tone-bg-c: .03;--_tone-a-rest: .1;--_tone-a-hover: .15;--_tone-a-active: .2;--_tone-quat-hover-l: .38;--_tone-quat-rest-a: .85;--button-bg-primary-rest: oklch(from var(--_src) var(--_tone-pl-rest) var(--_tone-pl-c) h);--button-bg-primary-hover: oklch(from var(--_src) var(--_tone-pl-hover) var(--_tone-pl-c) h);--button-bg-primary-active: oklch(from var(--_src) var(--_tone-pl-active) var(--_tone-pl-c) h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--_src) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-secondary-l-shift: var(--_tone-fg-shift);--button-fg-tertiary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--_src) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-tertiary-hover: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-rest));--button-bg-tertiary-active: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-hover));--button-fg-quaternary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h / var(--_tone-quat-rest-a));--button-fg-quaternary-hover: oklch(from var(--_src) var(--_tone-quat-hover-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-rest));--button-bg-secondary-hover: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-hover));--button-bg-secondary-active: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-active));--_fs: 15px;--_lh: 20px;--_pb: 1px;--_radius: 4px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round],button[data-anta][round],input[data-anta]:is([type=reset],[type=submit])[round]{--button-round: 999px;--_radius: var(--button-round, 999px);@supports (border-radius: attr(probe type(<length>),1px)){--button-round: attr(round type(<length>), 999px)}}a-button[tone]:not([tone=""],[tone=neutral]),a[role=button][data-anta][tone]:not([tone=""],[tone=neutral]),button[data-anta][tone]:not([tone=""],[tone=neutral]),input[data-anta]:is([type=reset],[type=submit])[tone]:not([tone=""],[tone=neutral]){--_tone-pl-rest: .51;--_tone-pl-hover: .46;--_tone-pl-active: .41;--_tone-pl-c: .17;--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-fg-shift: .05;--_tone-bg-l: .54;--_tone-bg-c: .17;--_tone-a-rest: .1;--_tone-a-hover: .15;--_tone-a-active: .2;--_tone-quat-hover-l: .38;--_tone-quat-rest-a: .85}a-button[tone=brand],a[role=button][data-anta][tone=brand],button[data-anta][tone=brand],input[data-anta]:is([type=reset],[type=submit])[tone=brand]{--_src: var(--anta-seed-brand)}a-button[tone=info],a[role=button][data-anta][tone=info],button[data-anta][tone=info],input[data-anta]:is([type=reset],[type=submit])[tone=info]{--_src: var(--anta-seed-info)}a-button[tone=success],a[role=button][data-anta][tone=success],button[data-anta][tone=success],input[data-anta]:is([type=reset],[type=submit])[tone=success]{--_src: var(--anta-seed-success)}a-button[tone=warning],a[role=button][data-anta][tone=warning],button[data-anta][tone=warning],input[data-anta]:is([type=reset],[type=submit])[tone=warning]{--_src: var(--anta-seed-warning)}a-button[tone=critical],a[role=button][data-anta][tone=critical],button[data-anta][tone=critical],input[data-anta]:is([type=reset],[type=submit])[tone=critical]{--_src: var(--anta-seed-critical)}a-button[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),a[role=button][data-anta][tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),button[data-anta][tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),input[data-anta]:is([type=reset],[type=submit])[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--_src: var(--button-tone-source, transparent);@supports (color: attr(probe type(<color>),red)){--_src: var(--button-tone-source, attr(tone type(<color>), transparent))}}.dark a-button,.dark a[role=button][data-anta],.dark button[data-anta],.dark input[data-anta]:is([type=reset],[type=submit]){--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--_tone-pl-rest: .4;--_tone-pl-hover: .44;--_tone-pl-active: .48;--_tone-pl-c: .015;--_tone-fg-l: .86;--_tone-fg-strong-l: .86;--_tone-fg-c: .015;--_tone-fg-shift: 0;--_tone-bg-l: .44;--_tone-bg-c: .01;--_tone-a-rest: .24;--_tone-a-hover: .34;--_tone-a-active: .44;--_tone-quat-hover-l: .9;--_tone-quat-rest-a: .85}.dark a-button[tone]:not([tone=""],[tone=neutral]),.dark a[role=button][data-anta][tone]:not([tone=""],[tone=neutral]),.dark button[data-anta][tone]:not([tone=""],[tone=neutral]),.dark input[data-anta]:is([type=reset],[type=submit])[tone]:not([tone=""],[tone=neutral]){--_tone-pl-rest: .4;--_tone-pl-hover: .44;--_tone-pl-active: .48;--_tone-pl-c: .16;--_tone-fg-l: .86;--_tone-fg-strong-l: .86;--_tone-fg-c: .13;--_tone-fg-shift: 0;--_tone-bg-l: .58;--_tone-bg-c: .16;--_tone-a-rest: .215;--_tone-a-hover: .29;--_tone-a-active: .34;--_tone-quat-hover-l: .9;--_tone-quat-rest-a: .85}button[data-anta],input[data-anta]:is([type=reset],[type=submit]){box-sizing:border-box;margin:0;appearance:none;-webkit-appearance:none;border:none}a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]){user-select:none;display:inline-flex;align-items:center;gap:.5ch;cursor:pointer;&:has(>a-copy):not(:has(>a-icon)){cursor:copy}flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:var(--_radius);text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:100%;padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in oklch,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}&[underline][underline-on-hover]{text-decoration-color:transparent;&[selected]{text-decoration-color:transparent}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg)}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip):not(a-copy))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;inset:0;pointer-events:none;clip-path:inset(0 round var(--_radius));background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));background-position-x:calc(0px - var(--button-loading-x-period));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:background-position;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}&[priority=primary]{--button-fg: var(--button-fg-primary-rest);--button-bg: var(--button-bg-primary-rest);box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-bg: var(--button-bg-primary-hover)}}&:active{--button-bg: var(--button-bg-primary-active)}&[selected]{--button-bg: var(--button-bg-primary-hover)}}&[priority=tertiary]{--button-fg: var(--button-fg-tertiary-rest);--button-bg: transparent;box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&:active{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&[priority=quaternary]{--button-fg: var(--button-fg-quaternary-rest);--button-bg: transparent;box-shadow:none;font-weight:400;letter-spacing:.06ch;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-quaternary-hover)}}&:active{--button-fg: var(--button-fg-quaternary-rest)}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}}&[selected]{box-shadow:inset 0 0 0 .5px currentColor}&[disabled]{background-color:var(--bg-secondary-disabled);color:var(--fg-disabled);&[priority=primary]{background-color:var(--bg-primary-disabled);color:var(--fg-disabled-primary)}&[priority=tertiary],&[priority=quaternary]{background-color:transparent;color:var(--fg-disabled)}}}@media(forced-colors:active){:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit])){--anta-forced-foreground: ButtonText;color:ButtonText;background-color:ButtonFace;border:1px solid ButtonText;box-shadow:none}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=primary]{--anta-forced-foreground: ButtonFace;color:ButtonFace;background-color:ButtonText;border-color:ButtonText}a-button:is([priority=primary],[selected]){forced-color-adjust:none}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=tertiary]{--anta-forced-foreground: CanvasText;color:CanvasText;background-color:Canvas;border:0}@media(hover:hover)and (pointer:fine){:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=tertiary]:hover:not(:focus-visible){outline:1px solid ButtonText;outline-offset:0}}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=quaternary]{--anta-forced-foreground: LinkText;color:LinkText;background-color:ButtonFace;border:0;text-decoration:none}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[selected]{--anta-forced-foreground: HighlightText;color:HighlightText;background-color:Highlight;border-color:Highlight}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[disabled]{--anta-forced-foreground: GrayText;color:GrayText;background-color:Canvas;border-color:GrayText;text-decoration-color:GrayText}}}@keyframes btn-loading-slide{to{background-position-x:0}}
@@ -46,8 +46,8 @@ class ACalendarElement extends HTMLElementBase {
46
46
  applyFormValue(value) {
47
47
  this.internals?.setFormValue(value || null);
48
48
  try {
49
- if (value) this.internals?.states.add("filled");
50
- else this.internals?.states.delete("filled");
49
+ if (value) this.internals?.states?.add("filled");
50
+ else this.internals?.states?.delete("filled");
51
51
  } catch {
52
52
  }
53
53
  }
@@ -0,0 +1 @@
1
+ @layer anta.components{a-capture{display:block;min-width:0}a-capture[pointer-capture]:not([pointer-capture=none],[pointer-buttons=none]),a-capture[pan]:is([pan=""],[pan=both],[pan=x],[pan=y]):not([pan-pointer-types=none]){user-select:none}a-capture:where(:not([pan-pointer-types]),[pan-pointer-types=""],[pan-pointer-types=all],[pan-pointer-types~=touch]){&[pan=x]{touch-action:pan-y pinch-zoom}&[pan=y]{touch-action:pan-x pinch-zoom}&[pan=""],&[pan=both]{touch-action:none}}a-capture:is([pointer-capture=""],[pointer-capture=all],[pointer-capture~=touch]):not(:where([pointer-buttons=none])){touch-action:none}}
@@ -0,0 +1,10 @@
1
+ import './a-capture.css';
2
+ import { HTMLElementBase } from '../anta_helpers';
3
+ /** A light-DOM input surface with no enabled capabilities by default. */
4
+ export declare class ACaptureElement extends HTMLElementBase {
5
+ static observedAttributes: string[];
6
+ connectedCallback(): void;
7
+ disconnectedCallback(): void;
8
+ attributeChangedCallback(name: string): void;
9
+ }
10
+ export declare function register_a_capture(): void;