@antadesign/anta 0.1.1-dev.6 → 0.1.1-dev.8
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 +13 -2
- package/dist/components/Button.d.ts +113 -0
- package/dist/components/Button.js +100 -0
- package/dist/components/Button.module.css +2 -0
- package/dist/components/Icon.d.ts +2 -1
- package/dist/components/Progress.d.ts +4 -2
- package/dist/components/Sticker.d.ts +31 -0
- package/dist/components/Sticker.js +17 -0
- package/dist/components/StickerAnimated.d.ts +23 -0
- package/dist/components/StickerAnimated.js +28 -0
- package/dist/components/Text.d.ts +2 -1
- package/dist/components/Title.d.ts +6 -4
- package/dist/components/Tooltip.d.ts +55 -0
- package/dist/components/Tooltip.js +26 -0
- package/dist/components/__generated__/stickers/angry-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/angry-animated.js +7 -0
- package/dist/components/__generated__/stickers/angry.d.ts +3 -0
- package/dist/components/__generated__/stickers/angry.js +7 -0
- package/dist/components/__generated__/stickers/ask-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/ask-animated.js +7 -0
- package/dist/components/__generated__/stickers/ask.d.ts +3 -0
- package/dist/components/__generated__/stickers/ask.js +7 -0
- package/dist/components/__generated__/stickers/balance-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/balance-animated.js +7 -0
- package/dist/components/__generated__/stickers/balance.d.ts +3 -0
- package/dist/components/__generated__/stickers/balance.js +7 -0
- package/dist/components/__generated__/stickers/butterfly-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/butterfly-animated.js +7 -0
- package/dist/components/__generated__/stickers/butterfly-snake-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/butterfly-snake-animated.js +7 -0
- package/dist/components/__generated__/stickers/butterfly-snake.d.ts +3 -0
- package/dist/components/__generated__/stickers/butterfly-snake.js +7 -0
- package/dist/components/__generated__/stickers/butterfly.d.ts +3 -0
- package/dist/components/__generated__/stickers/butterfly.js +7 -0
- package/dist/components/__generated__/stickers/catch-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/catch-animated.js +7 -0
- package/dist/components/__generated__/stickers/catch.d.ts +3 -0
- package/dist/components/__generated__/stickers/catch.js +7 -0
- package/dist/components/__generated__/stickers/clap-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/clap-animated.js +7 -0
- package/dist/components/__generated__/stickers/clap.d.ts +3 -0
- package/dist/components/__generated__/stickers/clap.js +7 -0
- package/dist/components/__generated__/stickers/coding-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/coding-animated.js +7 -0
- package/dist/components/__generated__/stickers/coding.d.ts +3 -0
- package/dist/components/__generated__/stickers/coding.js +7 -0
- package/dist/components/__generated__/stickers/cowboy-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/cowboy-animated.js +7 -0
- package/dist/components/__generated__/stickers/cowboy.d.ts +3 -0
- package/dist/components/__generated__/stickers/cowboy.js +7 -0
- package/dist/components/__generated__/stickers/dance-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/dance-animated.js +7 -0
- package/dist/components/__generated__/stickers/dance.d.ts +3 -0
- package/dist/components/__generated__/stickers/dance.js +7 -0
- package/dist/components/__generated__/stickers/detective-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/detective-animated.js +7 -0
- package/dist/components/__generated__/stickers/detective.d.ts +3 -0
- package/dist/components/__generated__/stickers/detective.js +7 -0
- package/dist/components/__generated__/stickers/disapprove-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/disapprove-animated.js +7 -0
- package/dist/components/__generated__/stickers/disapprove.d.ts +3 -0
- package/dist/components/__generated__/stickers/disapprove.js +7 -0
- package/dist/components/__generated__/stickers/distracted-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/distracted-animated.js +7 -0
- package/dist/components/__generated__/stickers/distracted.d.ts +3 -0
- package/dist/components/__generated__/stickers/distracted.js +7 -0
- package/dist/components/__generated__/stickers/dive-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/dive-animated.js +7 -0
- package/dist/components/__generated__/stickers/dive.d.ts +3 -0
- package/dist/components/__generated__/stickers/dive.js +7 -0
- package/dist/components/__generated__/stickers/eat-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/eat-animated.js +7 -0
- package/dist/components/__generated__/stickers/eat.d.ts +3 -0
- package/dist/components/__generated__/stickers/eat.js +7 -0
- package/dist/components/__generated__/stickers/facepalm-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/facepalm-animated.js +7 -0
- package/dist/components/__generated__/stickers/facepalm.d.ts +3 -0
- package/dist/components/__generated__/stickers/facepalm.js +7 -0
- package/dist/components/__generated__/stickers/failed-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/failed-animated.js +7 -0
- package/dist/components/__generated__/stickers/failed.d.ts +3 -0
- package/dist/components/__generated__/stickers/failed.js +7 -0
- package/dist/components/__generated__/stickers/found-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/found-animated.js +7 -0
- package/dist/components/__generated__/stickers/found.d.ts +3 -0
- package/dist/components/__generated__/stickers/found.js +7 -0
- package/dist/components/__generated__/stickers/grow-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/grow-animated.js +7 -0
- package/dist/components/__generated__/stickers/grow.d.ts +3 -0
- package/dist/components/__generated__/stickers/grow.js +7 -0
- package/dist/components/__generated__/stickers/handstand-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/handstand-animated.js +7 -0
- package/dist/components/__generated__/stickers/handstand.d.ts +3 -0
- package/dist/components/__generated__/stickers/handstand.js +7 -0
- package/dist/components/__generated__/stickers/heart-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/heart-animated.js +7 -0
- package/dist/components/__generated__/stickers/heart.d.ts +3 -0
- package/dist/components/__generated__/stickers/heart.js +7 -0
- package/dist/components/__generated__/stickers/hello-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/hello-animated.js +7 -0
- package/dist/components/__generated__/stickers/hello.d.ts +3 -0
- package/dist/components/__generated__/stickers/hello.js +7 -0
- package/dist/components/__generated__/stickers/idea-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/idea-animated.js +7 -0
- package/dist/components/__generated__/stickers/idea.d.ts +3 -0
- package/dist/components/__generated__/stickers/idea.js +7 -0
- package/dist/components/__generated__/stickers/index.d.ts +99 -0
- package/dist/components/__generated__/stickers/index.js +198 -0
- package/dist/components/__generated__/stickers/laugh-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/laugh-animated.js +7 -0
- package/dist/components/__generated__/stickers/laugh.d.ts +3 -0
- package/dist/components/__generated__/stickers/laugh.js +7 -0
- package/dist/components/__generated__/stickers/love-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/love-animated.js +7 -0
- package/dist/components/__generated__/stickers/love.d.ts +3 -0
- package/dist/components/__generated__/stickers/love.js +7 -0
- package/dist/components/__generated__/stickers/nap-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/nap-animated.js +7 -0
- package/dist/components/__generated__/stickers/nap.d.ts +3 -0
- package/dist/components/__generated__/stickers/nap.js +7 -0
- package/dist/components/__generated__/stickers/party-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/party-animated.js +7 -0
- package/dist/components/__generated__/stickers/party.d.ts +3 -0
- package/dist/components/__generated__/stickers/party.js +7 -0
- package/dist/components/__generated__/stickers/passed-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/passed-animated.js +7 -0
- package/dist/components/__generated__/stickers/passed.d.ts +3 -0
- package/dist/components/__generated__/stickers/passed.js +7 -0
- package/dist/components/__generated__/stickers/peekaboo-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/peekaboo-animated.js +7 -0
- package/dist/components/__generated__/stickers/peekaboo.d.ts +3 -0
- package/dist/components/__generated__/stickers/peekaboo.js +7 -0
- package/dist/components/__generated__/stickers/pizza-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/pizza-animated.js +7 -0
- package/dist/components/__generated__/stickers/pizza.d.ts +3 -0
- package/dist/components/__generated__/stickers/pizza.js +7 -0
- package/dist/components/__generated__/stickers/puzzle-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/puzzle-animated.js +7 -0
- package/dist/components/__generated__/stickers/puzzle.d.ts +3 -0
- package/dist/components/__generated__/stickers/puzzle.js +7 -0
- package/dist/components/__generated__/stickers/sad-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/sad-animated.js +7 -0
- package/dist/components/__generated__/stickers/sad.d.ts +3 -0
- package/dist/components/__generated__/stickers/sad.js +7 -0
- package/dist/components/__generated__/stickers/scared-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/scared-animated.js +7 -0
- package/dist/components/__generated__/stickers/scared.d.ts +3 -0
- package/dist/components/__generated__/stickers/scared.js +7 -0
- package/dist/components/__generated__/stickers/scroll-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/scroll-animated.js +7 -0
- package/dist/components/__generated__/stickers/scroll.d.ts +3 -0
- package/dist/components/__generated__/stickers/scroll.js +7 -0
- package/dist/components/__generated__/stickers/search-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/search-animated.js +7 -0
- package/dist/components/__generated__/stickers/search.d.ts +3 -0
- package/dist/components/__generated__/stickers/search.js +7 -0
- package/dist/components/__generated__/stickers/shield-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/shield-animated.js +7 -0
- package/dist/components/__generated__/stickers/shield.d.ts +3 -0
- package/dist/components/__generated__/stickers/shield.js +7 -0
- package/dist/components/__generated__/stickers/shocked-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/shocked-animated.js +7 -0
- package/dist/components/__generated__/stickers/shocked.d.ts +3 -0
- package/dist/components/__generated__/stickers/shocked.js +7 -0
- package/dist/components/__generated__/stickers/sleep-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/sleep-animated.js +7 -0
- package/dist/components/__generated__/stickers/sleep.d.ts +3 -0
- package/dist/components/__generated__/stickers/sleep.js +7 -0
- package/dist/components/__generated__/stickers/stressed-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/stressed-animated.js +7 -0
- package/dist/components/__generated__/stickers/stressed.d.ts +3 -0
- package/dist/components/__generated__/stickers/stressed.js +7 -0
- package/dist/components/__generated__/stickers/suspicious-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/suspicious-animated.js +7 -0
- package/dist/components/__generated__/stickers/suspicious.d.ts +3 -0
- package/dist/components/__generated__/stickers/suspicious.js +7 -0
- package/dist/components/__generated__/stickers/thanks-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/thanks-animated.js +7 -0
- package/dist/components/__generated__/stickers/thanks.d.ts +3 -0
- package/dist/components/__generated__/stickers/thanks.js +7 -0
- package/dist/components/__generated__/stickers/think-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/think-animated.js +7 -0
- package/dist/components/__generated__/stickers/think-of-you-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/think-of-you-animated.js +7 -0
- package/dist/components/__generated__/stickers/think-of-you.d.ts +3 -0
- package/dist/components/__generated__/stickers/think-of-you.js +7 -0
- package/dist/components/__generated__/stickers/think.d.ts +3 -0
- package/dist/components/__generated__/stickers/think.js +7 -0
- package/dist/components/__generated__/stickers/thumbs-up-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/thumbs-up-animated.js +7 -0
- package/dist/components/__generated__/stickers/thumbs-up.d.ts +3 -0
- package/dist/components/__generated__/stickers/thumbs-up.js +7 -0
- package/dist/components/__generated__/stickers/vacation-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/vacation-animated.js +7 -0
- package/dist/components/__generated__/stickers/vacation.d.ts +3 -0
- package/dist/components/__generated__/stickers/vacation.js +7 -0
- package/dist/components/__generated__/stickers/wait-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/wait-animated.js +7 -0
- package/dist/components/__generated__/stickers/wait.d.ts +3 -0
- package/dist/components/__generated__/stickers/wait.js +7 -0
- package/dist/components/__generated__/stickers/wink-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/wink-animated.js +7 -0
- package/dist/components/__generated__/stickers/wink.d.ts +3 -0
- package/dist/components/__generated__/stickers/wink.js +7 -0
- package/dist/components/__generated__/stickers/work-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/work-animated.js +7 -0
- package/dist/components/__generated__/stickers/work.d.ts +3 -0
- package/dist/components/__generated__/stickers/work.js +7 -0
- package/dist/components/__generated__/stickers/zen-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/zen-animated.js +7 -0
- package/dist/components/__generated__/stickers/zen.d.ts +3 -0
- package/dist/components/__generated__/stickers/zen.js +7 -0
- package/dist/elements/a-button.css +733 -0
- package/dist/elements/a-button.d.ts +11 -0
- package/dist/elements/a-button.js +78 -0
- package/dist/elements/a-icon.css +30 -10
- package/dist/elements/a-icon.d.ts +2 -0
- package/dist/elements/a-icon.js +3 -0
- package/dist/elements/a-icon.shapes.css +9 -1
- package/dist/elements/a-icon.shapes.d.ts +3 -1
- package/dist/elements/a-icon.shapes.js +2 -0
- package/dist/elements/a-progress.css +7 -9
- package/dist/elements/a-progress.d.ts +1 -0
- package/dist/elements/a-progress.js +2 -0
- package/dist/elements/a-sticker-animated.css +9 -0
- package/dist/elements/a-sticker-animated.d.ts +39 -0
- package/dist/elements/a-sticker-animated.js +81 -0
- package/dist/elements/a-sticker.css +9 -0
- package/dist/elements/a-sticker.d.ts +19 -0
- package/dist/elements/a-sticker.js +32 -0
- package/dist/elements/a-text.css +6 -3
- package/dist/elements/a-text.d.ts +1 -0
- package/dist/elements/a-text.js +2 -0
- package/dist/elements/a-tooltip.css +42 -0
- package/dist/elements/a-tooltip.d.ts +61 -0
- package/dist/elements/a-tooltip.js +411 -0
- package/dist/elements/index.d.ts +21 -5
- package/dist/elements/index.js +18 -18
- package/dist/general_types.d.ts +110 -6
- package/dist/generate-stickers.mjs +293 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/jsx-runtime.d.ts +6 -1
- package/dist/reset.css +31 -28
- package/dist/tokens.css +186 -182
- package/package.json +18 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HTMLElementBase } from "../anta_helpers";
|
|
2
|
+
import "./a-button.css";
|
|
3
|
+
declare global {
|
|
4
|
+
interface Document {
|
|
5
|
+
hasKeyListenerForAButton?: boolean;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare class AButtonElement extends HTMLElementBase {
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function register_a_button(): void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { HTMLElementBase } from "../anta_helpers";
|
|
2
|
+
import "./a-button.css";
|
|
3
|
+
class AButtonElement extends HTMLElementBase {
|
|
4
|
+
connectedCallback() {
|
|
5
|
+
if (!document.hasKeyListenerForAButton) {
|
|
6
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
7
|
+
document.addEventListener("click", handleClick, true);
|
|
8
|
+
document.hasKeyListenerForAButton = true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function findForm(el) {
|
|
13
|
+
const formId = el.getAttribute("form");
|
|
14
|
+
if (formId) {
|
|
15
|
+
return document.getElementById(formId);
|
|
16
|
+
}
|
|
17
|
+
return el.closest("form");
|
|
18
|
+
}
|
|
19
|
+
function handleKeyDown(e) {
|
|
20
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
21
|
+
const el = e.target.closest(
|
|
22
|
+
"a-button"
|
|
23
|
+
);
|
|
24
|
+
if (!el) return;
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
el.click();
|
|
27
|
+
}
|
|
28
|
+
function handleClick(e) {
|
|
29
|
+
const el = e.target.closest(
|
|
30
|
+
"a-button"
|
|
31
|
+
);
|
|
32
|
+
if (!el) return;
|
|
33
|
+
const customEvent = el.getAttribute("data-custom-event");
|
|
34
|
+
if (customEvent) {
|
|
35
|
+
el.dispatchEvent(
|
|
36
|
+
new CustomEvent(customEvent, { bubbles: true, cancelable: true })
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const type = el.getAttribute("type") || "button";
|
|
40
|
+
const form = findForm(el);
|
|
41
|
+
if (!form) return;
|
|
42
|
+
if (type === "submit") {
|
|
43
|
+
if (form.requestSubmit) {
|
|
44
|
+
form.requestSubmit();
|
|
45
|
+
} else {
|
|
46
|
+
form.submit();
|
|
47
|
+
}
|
|
48
|
+
const formData = new FormData(form);
|
|
49
|
+
form.dispatchEvent(
|
|
50
|
+
new CustomEvent("submitdetailed", {
|
|
51
|
+
bubbles: true,
|
|
52
|
+
cancelable: true,
|
|
53
|
+
detail: {
|
|
54
|
+
formData: Object.fromEntries(formData.entries()),
|
|
55
|
+
submitter: {
|
|
56
|
+
tag: el.tagName.toLowerCase(),
|
|
57
|
+
attrs: Object.fromEntries(
|
|
58
|
+
Array.from(el.attributes).map((a) => [a.name, a.value])
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
} else if (type === "reset") {
|
|
65
|
+
form.reset();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function register_a_button() {
|
|
69
|
+
if (typeof customElements === "undefined") return;
|
|
70
|
+
if (!customElements.get("a-button")) {
|
|
71
|
+
customElements.define("a-button", AButtonElement);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
register_a_button();
|
|
75
|
+
export {
|
|
76
|
+
AButtonElement,
|
|
77
|
+
register_a_button
|
|
78
|
+
};
|
package/dist/elements/a-icon.css
CHANGED
|
@@ -1,23 +1,43 @@
|
|
|
1
1
|
@layer anta {
|
|
2
2
|
a-icon {
|
|
3
|
-
/*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/* Default lives in a plain declaration — never in `attr()`. Safari
|
|
4
|
+
doesn't support typed `attr()` for `<length>` (MDN: "No" across
|
|
5
|
+
all Safari versions), so an `attr(size px, …)` value can't
|
|
6
|
+
resolve there and the var-substituted `width` ends up invalid →
|
|
7
|
+
auto → 0 on an empty inline-block. Keeping the default off the
|
|
8
|
+
attr() path means every browser lands on 16px when no `size`
|
|
9
|
+
attribute is set. */
|
|
10
|
+
--icon-size: 16px;
|
|
7
11
|
|
|
8
12
|
display: inline-block;
|
|
9
13
|
vertical-align: middle;
|
|
10
|
-
width: var(--icon-size
|
|
11
|
-
height: var(--icon-size
|
|
14
|
+
width: var(--icon-size);
|
|
15
|
+
height: var(--icon-size);
|
|
12
16
|
flex-shrink: 0;
|
|
13
17
|
background-color: currentColor;
|
|
14
18
|
-webkit-mask-image: var(--icon);
|
|
15
|
-
|
|
19
|
+
mask-image: var(--icon);
|
|
16
20
|
-webkit-mask-position: center;
|
|
17
|
-
|
|
21
|
+
mask-position: center;
|
|
18
22
|
-webkit-mask-repeat: no-repeat;
|
|
19
|
-
|
|
23
|
+
mask-repeat: no-repeat;
|
|
20
24
|
-webkit-mask-size: contain;
|
|
21
|
-
|
|
25
|
+
mask-size: contain;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* `<a-icon size="N">` only — typed `attr()` (CSS Values 5, Chrome
|
|
29
|
+
133+). Safari/Firefox don't support the typed form, but a custom
|
|
30
|
+
property parses permissively, so without the `@supports` guard the
|
|
31
|
+
invalid `attr()` would still land on `--icon-size` and only fail
|
|
32
|
+
later when `width: var(--icon-size)` substitutes it — collapsing the
|
|
33
|
+
icon to `auto` → 0×0. The guard keeps the override off unsupported
|
|
34
|
+
engines so the plain `--icon-size: 16px` base wins (visible 16px
|
|
35
|
+
icon, not 0). Consumers that need an exact custom size everywhere
|
|
36
|
+
should route through the `<Icon size={N}>` JSX wrapper, which sets
|
|
37
|
+
`--icon-size` inline as a plain length. */
|
|
38
|
+
@supports (width: attr(size px, 16px)) {
|
|
39
|
+
a-icon[size] {
|
|
40
|
+
--icon-size: attr(size px, 16px);
|
|
41
|
+
}
|
|
22
42
|
}
|
|
23
43
|
}
|
package/dist/elements/a-icon.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { HTMLElementBase } from "../anta_helpers";
|
|
2
|
+
import "./a-icon.css";
|
|
3
|
+
import "./a-icon.shapes.css";
|
|
2
4
|
class AIconElement extends HTMLElementBase {
|
|
3
5
|
}
|
|
4
6
|
function register_a_icon() {
|
|
@@ -7,6 +9,7 @@ function register_a_icon() {
|
|
|
7
9
|
customElements.define("a-icon", AIconElement);
|
|
8
10
|
}
|
|
9
11
|
}
|
|
12
|
+
register_a_icon();
|
|
10
13
|
export {
|
|
11
14
|
AIconElement,
|
|
12
15
|
register_a_icon
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Auto-generated by
|
|
1
|
+
/* Auto-generated by @antadesign/anta. Do not edit by hand. */
|
|
2
2
|
|
|
3
3
|
@layer anta {
|
|
4
4
|
|
|
@@ -262,6 +262,10 @@
|
|
|
262
262
|
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3v10M3 8h10'/%3E%3C/svg%3E%0A");
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
a-icon[shape="pointer"] {
|
|
266
|
+
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-pointer-icon lucide-pointer'%3E%3Cpath d='M22 14a8 8 0 0 1-8 8'/%3E%3Cpath d='M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2'/%3E%3Cpath d='M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1'/%3E%3Cpath d='M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10'/%3E%3Cpath d='M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15'/%3E%3C/svg%3E");
|
|
267
|
+
}
|
|
268
|
+
|
|
265
269
|
a-icon[shape="presentation"] {
|
|
266
270
|
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3h20'/%3E%3Cpath d='M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3'/%3E%3Cpath d='m7 21 5-5 5 5'/%3E%3C/svg%3E%0A");
|
|
267
271
|
}
|
|
@@ -282,6 +286,10 @@
|
|
|
282
286
|
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='scale(-1 1) translate(-24 0)'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/g%3E%3C/svg%3E%0A");
|
|
283
287
|
}
|
|
284
288
|
|
|
289
|
+
a-icon[shape="rotate-ccw"] {
|
|
290
|
+
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3C/svg%3E%0A");
|
|
291
|
+
}
|
|
292
|
+
|
|
285
293
|
a-icon[shape="rss"] {
|
|
286
294
|
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%0A %3Cpath stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.33' d='M2.67 7.33a6 6 0 0 1 6 6m-6-10.66a10.67 10.67 0 0 1 10.66 10.66M4 12.67a.67.67 0 1 1-1.33 0 .67.67 0 0 1 1.33 0Z'/%3E%0A%3C/svg%3E%0A");
|
|
287
295
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IconShapes } from '@antadesign/anta';
|
|
2
|
-
export declare const ICON_SHAPES: readonly ["arrow-left-to-line", "arrow-left", "arrow-narrow-down", "arrow-narrow-up-down", "arrow-narrow-up", "arrow-right", "arrow-top-right", "asterisk", "book-open", "braces", "bug", "calendar", "case-sensitive", "chat", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "chevrons-right", "circle-check", "circle-large", "circle", "click", "clock", "cloud-upload", "copy", "corner-down-right", "cube", "dots-vertical", "download", "edit", "education-disk", "external-link", "file-down", "file", "filter", "folder-close", "folder-open", "folder-tree", "github-logo", "gitlab-logo", "hat-glasses", "heart-handshake", "help-disk", "history-tree", "history", "home", "hourglass", "info", "jira-logo", "linear-logo", "link", "list-detail-view", "maximize", "megaphone", "menu", "minimize", "minus", "moon", "more", "move-horizontal", "not-equal", "play", "plus", "presentation", "refresh-ccw-dot", "refresh", "regex", "repeat", "rss", "runs-history", "scroll-text", "search-check", "search", "send", "sparkles", "sun", "swatch-book", "table-2", "text-highlight", "text-initial", "timer", "trash", "trello-logo", "view", "warning-triangle", "webhook", "workflow", "x"];
|
|
2
|
+
export declare const ICON_SHAPES: readonly ["arrow-left-to-line", "arrow-left", "arrow-narrow-down", "arrow-narrow-up-down", "arrow-narrow-up", "arrow-right", "arrow-top-right", "asterisk", "book-open", "braces", "bug", "calendar", "case-sensitive", "chat", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "chevrons-right", "circle-check", "circle-large", "circle", "click", "clock", "cloud-upload", "copy", "corner-down-right", "cube", "dots-vertical", "download", "edit", "education-disk", "external-link", "file-down", "file", "filter", "folder-close", "folder-open", "folder-tree", "github-logo", "gitlab-logo", "hat-glasses", "heart-handshake", "help-disk", "history-tree", "history", "home", "hourglass", "info", "jira-logo", "linear-logo", "link", "list-detail-view", "maximize", "megaphone", "menu", "minimize", "minus", "moon", "more", "move-horizontal", "not-equal", "play", "plus", "pointer", "presentation", "refresh-ccw-dot", "refresh", "regex", "repeat", "rotate-ccw", "rss", "runs-history", "scroll-text", "search-check", "search", "send", "sparkles", "sun", "swatch-book", "table-2", "text-highlight", "text-initial", "timer", "trash", "trello-logo", "view", "warning-triangle", "webhook", "workflow", "x"];
|
|
3
3
|
export declare const ICON_SYNONYMS: Readonly<Record<string, readonly string[]>>;
|
|
4
4
|
declare module '@antadesign/anta' {
|
|
5
5
|
interface IconShapes {
|
|
@@ -68,11 +68,13 @@ declare module '@antadesign/anta' {
|
|
|
68
68
|
'not-equal': true;
|
|
69
69
|
'play': true;
|
|
70
70
|
'plus': true;
|
|
71
|
+
'pointer': true;
|
|
71
72
|
'presentation': true;
|
|
72
73
|
'refresh-ccw-dot': true;
|
|
73
74
|
'refresh': true;
|
|
74
75
|
'regex': true;
|
|
75
76
|
'repeat': true;
|
|
77
|
+
'rotate-ccw': true;
|
|
76
78
|
'rss': true;
|
|
77
79
|
'runs-history': true;
|
|
78
80
|
'scroll-text': true;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
@layer anta {
|
|
2
2
|
a-progress {
|
|
3
|
-
--progress-bg: var(--bg-
|
|
3
|
+
--progress-bg: var(--bg-4);
|
|
4
4
|
--progress-border-color: var(--border-4);
|
|
5
|
-
--progress-indicator-bg: var(--bg-
|
|
5
|
+
--progress-indicator-bg: var(--bg-5);
|
|
6
6
|
/* Right-edge fade: from the indicator's own bg to the border
|
|
7
|
-
colour, both opaque.
|
|
8
|
-
|
|
9
|
-
pre-multiplication artefacts. Tone variants automatically
|
|
10
|
-
re-tint because both endpoint tokens (`--progress-indicator-bg`,
|
|
7
|
+
colour, both opaque. Tone variants automatically re-tint because
|
|
8
|
+
both endpoint tokens (`--progress-indicator-bg`,
|
|
11
9
|
`--progress-border-color`) get re-aliased per tone. */
|
|
12
10
|
--progress-indicator-edge: linear-gradient(
|
|
13
|
-
90deg
|
|
11
|
+
90deg,
|
|
14
12
|
var(--progress-indicator-bg) 0%,
|
|
15
13
|
var(--progress-border-color) 100%
|
|
16
14
|
);
|
|
@@ -33,9 +31,9 @@
|
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
a-progress[tone="info"] {
|
|
36
|
-
--progress-bg: var(--bg-
|
|
34
|
+
--progress-bg: var(--bg-4-info);
|
|
37
35
|
--progress-border-color: var(--border-4-info);
|
|
38
|
-
--progress-indicator-bg: var(--bg-
|
|
36
|
+
--progress-indicator-bg: var(--bg-5-info);
|
|
39
37
|
--progress-text-color: var(--text-2-info);
|
|
40
38
|
--progress-hint-color: var(--text-3-info);
|
|
41
39
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTMLElementBase } from "../anta_helpers";
|
|
2
|
+
import "./a-progress.css";
|
|
2
3
|
class AProgressElement extends HTMLElementBase {
|
|
3
4
|
static observedAttributes = ["value", "max", "tone"];
|
|
4
5
|
indicator;
|
|
@@ -60,6 +61,7 @@ function register_a_progress() {
|
|
|
60
61
|
customElements.define("a-progress", AProgressElement);
|
|
61
62
|
}
|
|
62
63
|
}
|
|
64
|
+
register_a_progress();
|
|
63
65
|
export {
|
|
64
66
|
AProgressElement,
|
|
65
67
|
register_a_progress
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type AnimationItem } from 'lottie-web';
|
|
2
|
+
import { HTMLElementBase } from '../anta_helpers';
|
|
3
|
+
import './a-sticker-animated.css';
|
|
4
|
+
/**
|
|
5
|
+
* `<a-sticker-animated>` — Lottie-driven sticker carrier.
|
|
6
|
+
*
|
|
7
|
+
* Receives the Lottie payload as the `animation` attribute (a JSON
|
|
8
|
+
* string). On change, parses the JSON once and instantiates a
|
|
9
|
+
* `lottie-web` player against a shadow-DOM container. The renderer is
|
|
10
|
+
* SVG — `lottie-web` creates real `<svg>` elements in the shadow root
|
|
11
|
+
* and updates path / transform attributes each frame. Rasterisation
|
|
12
|
+
* goes through the browser's native SVG renderer (Skia / Core
|
|
13
|
+
* Graphics), giving the same crispness as static `<svg>` content.
|
|
14
|
+
*
|
|
15
|
+
* Observed attributes:
|
|
16
|
+
* - `animation` — JSON string for `lottie-web`. Reset to null/missing
|
|
17
|
+
* tears the player down.
|
|
18
|
+
* - `paused` — present: freeze at current frame. Numeric value
|
|
19
|
+
* (seconds): seek to that time, then freeze. Absent: play.
|
|
20
|
+
*
|
|
21
|
+
* Sizing comes from external CSS reading `--sticker-size` (set by the
|
|
22
|
+
* JSX wrapper or the consumer).
|
|
23
|
+
*
|
|
24
|
+
* The static counterpart is `<a-sticker>`.
|
|
25
|
+
*/
|
|
26
|
+
export declare class AStickerAnimatedElement extends HTMLElementBase {
|
|
27
|
+
static observedAttributes: string[];
|
|
28
|
+
container: HTMLDivElement;
|
|
29
|
+
player: AnimationItem | null;
|
|
30
|
+
_animation: Record<string, unknown> | null;
|
|
31
|
+
constructor();
|
|
32
|
+
connectedCallback(): void;
|
|
33
|
+
disconnectedCallback(): void;
|
|
34
|
+
attributeChangedCallback(name: string): void;
|
|
35
|
+
rebuild(): void;
|
|
36
|
+
applyPaused(): void;
|
|
37
|
+
teardown(): void;
|
|
38
|
+
}
|
|
39
|
+
export declare function register_a_sticker_animated(): void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import lottie from "lottie-web";
|
|
2
|
+
import { HTMLElementBase } from "../anta_helpers";
|
|
3
|
+
import "./a-sticker-animated.css";
|
|
4
|
+
class AStickerAnimatedElement extends HTMLElementBase {
|
|
5
|
+
static observedAttributes = ["animation", "paused"];
|
|
6
|
+
container;
|
|
7
|
+
player = null;
|
|
8
|
+
_animation = null;
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
12
|
+
const style = document.createElement("style");
|
|
13
|
+
style.textContent = `
|
|
14
|
+
:host { display: inline-block; }
|
|
15
|
+
div { width: 100%; height: 100%; }
|
|
16
|
+
div > svg { display: block; width: 100%; height: 100%; }
|
|
17
|
+
`;
|
|
18
|
+
this.container = document.createElement("div");
|
|
19
|
+
shadow.append(style, this.container);
|
|
20
|
+
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
if (this._animation != null && this.player == null) this.rebuild();
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
this.teardown();
|
|
26
|
+
}
|
|
27
|
+
attributeChangedCallback(name) {
|
|
28
|
+
if (name === "animation") {
|
|
29
|
+
const value = this.getAttribute("animation");
|
|
30
|
+
this._animation = value ? JSON.parse(value) : null;
|
|
31
|
+
if (this.isConnected) this.rebuild();
|
|
32
|
+
} else if (name === "paused") {
|
|
33
|
+
this.applyPaused();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
rebuild() {
|
|
37
|
+
this.teardown();
|
|
38
|
+
if (this._animation == null) return;
|
|
39
|
+
this.player = lottie.loadAnimation({
|
|
40
|
+
container: this.container,
|
|
41
|
+
renderer: "svg",
|
|
42
|
+
loop: true,
|
|
43
|
+
autoplay: !this.hasAttribute("paused"),
|
|
44
|
+
animationData: this._animation
|
|
45
|
+
});
|
|
46
|
+
this.applyPaused();
|
|
47
|
+
}
|
|
48
|
+
applyPaused() {
|
|
49
|
+
if (!this.player) return;
|
|
50
|
+
const attr = this.getAttribute("paused");
|
|
51
|
+
if (attr === null) {
|
|
52
|
+
this.player.play();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const seconds = Number(attr);
|
|
56
|
+
if (Number.isFinite(seconds) && seconds > 0) {
|
|
57
|
+
const frame = seconds * this.player.frameRate;
|
|
58
|
+
const clamped = Math.min(this.player.totalFrames - 1, Math.max(0, frame));
|
|
59
|
+
this.player.goToAndStop(clamped, true);
|
|
60
|
+
} else {
|
|
61
|
+
this.player.pause();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
teardown() {
|
|
65
|
+
if (this.player) {
|
|
66
|
+
this.player.destroy();
|
|
67
|
+
this.player = null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function register_a_sticker_animated() {
|
|
72
|
+
if (typeof customElements === "undefined") return;
|
|
73
|
+
if (!customElements.get("a-sticker-animated")) {
|
|
74
|
+
customElements.define("a-sticker-animated", AStickerAnimatedElement);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
register_a_sticker_animated();
|
|
78
|
+
export {
|
|
79
|
+
AStickerAnimatedElement,
|
|
80
|
+
register_a_sticker_animated
|
|
81
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HTMLElementBase } from '../anta_helpers';
|
|
2
|
+
import './a-sticker.css';
|
|
3
|
+
/**
|
|
4
|
+
* `<a-sticker>` — static sticker carrier.
|
|
5
|
+
*
|
|
6
|
+
* Receives SVG markup as the `svg` attribute. On change, drops it into
|
|
7
|
+
* a shadow-DOM container so the host's light DOM stays untouched.
|
|
8
|
+
* Sizing comes from external CSS reading `--sticker-size` (set by the
|
|
9
|
+
* JSX wrapper, or by the consumer directly).
|
|
10
|
+
*
|
|
11
|
+
* The animated counterpart is `<a-sticker-animated>`.
|
|
12
|
+
*/
|
|
13
|
+
export declare class AStickerElement extends HTMLElementBase {
|
|
14
|
+
static observedAttributes: string[];
|
|
15
|
+
container: HTMLDivElement;
|
|
16
|
+
constructor();
|
|
17
|
+
attributeChangedCallback(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function register_a_sticker(): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HTMLElementBase } from "../anta_helpers";
|
|
2
|
+
import "./a-sticker.css";
|
|
3
|
+
class AStickerElement extends HTMLElementBase {
|
|
4
|
+
static observedAttributes = ["svg"];
|
|
5
|
+
container;
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
9
|
+
const style = document.createElement("style");
|
|
10
|
+
style.textContent = `
|
|
11
|
+
:host { display: inline-block; }
|
|
12
|
+
div { width: 100%; height: 100%; }
|
|
13
|
+
div > svg { display: block; width: 100%; height: 100%; }
|
|
14
|
+
`;
|
|
15
|
+
this.container = document.createElement("div");
|
|
16
|
+
shadow.append(style, this.container);
|
|
17
|
+
}
|
|
18
|
+
attributeChangedCallback() {
|
|
19
|
+
this.container.innerHTML = this.getAttribute("svg") ?? "";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function register_a_sticker() {
|
|
23
|
+
if (typeof customElements === "undefined") return;
|
|
24
|
+
if (!customElements.get("a-sticker")) {
|
|
25
|
+
customElements.define("a-sticker", AStickerElement);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
register_a_sticker();
|
|
29
|
+
export {
|
|
30
|
+
AStickerElement,
|
|
31
|
+
register_a_sticker
|
|
32
|
+
};
|
package/dist/elements/a-text.css
CHANGED
|
@@ -76,8 +76,11 @@
|
|
|
76
76
|
On hover the underline color is repeated so it tracks the priority
|
|
77
77
|
color rather than the global --link-color-hover. */
|
|
78
78
|
a-text a, a-text a:link, a-text a:visited { color: var(--text-link-color); }
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
text
|
|
79
|
+
/* Hover only on real-pointer devices — avoids sticky hover after a tap. */
|
|
80
|
+
@media (hover: hover) and (pointer: fine) {
|
|
81
|
+
a-text a:hover {
|
|
82
|
+
color: var(--text-link-hover);
|
|
83
|
+
text-decoration-color: var(--text-link-hover);
|
|
84
|
+
}
|
|
82
85
|
}
|
|
83
86
|
}
|
package/dist/elements/a-text.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTMLElementBase } from "../anta_helpers";
|
|
2
|
+
import "./a-text.css";
|
|
2
3
|
const SHADOW_STYLE = `
|
|
3
4
|
:host {
|
|
4
5
|
display: block;
|
|
@@ -137,6 +138,7 @@ function register_a_text() {
|
|
|
137
138
|
customElements.define("a-text", ATextElement);
|
|
138
139
|
}
|
|
139
140
|
}
|
|
141
|
+
register_a_text();
|
|
140
142
|
export {
|
|
141
143
|
ATextElement,
|
|
142
144
|
register_a_text
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@layer anta {
|
|
2
|
+
/* Before the custom element upgrades on the client, <a-tooltip> is an
|
|
3
|
+
unknown inline element and its content would flash *inside the anchor*.
|
|
4
|
+
Hide it until defined; once defined this stops matching and the shadow
|
|
5
|
+
`:host { display: contents }` governs (content renders only in the
|
|
6
|
+
popover via the slot). */
|
|
7
|
+
a-tooltip:not(:defined) {
|
|
8
|
+
display: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Tooltip exposes only the box "chrome" that lives inside the shadow
|
|
12
|
+
popover and is therefore impossible to reach with plain consumer CSS.
|
|
13
|
+
The bubble's content is slotted light DOM, so its font / colour / size
|
|
14
|
+
are already styleable from the page — those are intentionally NOT
|
|
15
|
+
tokens. These custom properties inherit across the shadow boundary
|
|
16
|
+
into the popover container (see a-tooltip.ts). The host itself draws
|
|
17
|
+
nothing and stays out of layout (`:host { display: contents }` in the
|
|
18
|
+
shadow style). */
|
|
19
|
+
a-tooltip {
|
|
20
|
+
/* Frosted translucent surface (matches the legacy look): a mostly-
|
|
21
|
+
opaque white that, paired with the container's `backdrop-filter:
|
|
22
|
+
blur(8px)`, reads as a frosted bubble over the page. --bg-1 is
|
|
23
|
+
#ffffff in light / #000000 in dark, so this flips to a dark frost
|
|
24
|
+
automatically (alpha is dialed down in the .dark override). */
|
|
25
|
+
--tooltip-bg: color-mix(in oklch, var(--bg-1) 80%, transparent);
|
|
26
|
+
--tooltip-shadow:
|
|
27
|
+
0 1px 8px color-mix(in oklch, var(--text-1) 15%, transparent),
|
|
28
|
+
0 0 1px color-mix(in oklch, var(--text-1) 50%, transparent);
|
|
29
|
+
--tooltip-radius: 3px;
|
|
30
|
+
--tooltip-max-width: min(calc(100vw - 20px), 80ch);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Dark: a slightly more transparent black frost. A solid black cast shadow
|
|
34
|
+
for lift, plus an inset 1px white ring so the bubble's edge stays crisp
|
|
35
|
+
against dark page content. */
|
|
36
|
+
.dark a-tooltip {
|
|
37
|
+
--tooltip-bg: color-mix(in oklch, var(--bg-1) 70%, transparent);
|
|
38
|
+
--tooltip-shadow:
|
|
39
|
+
0 2px 16px color-mix(in oklch, black 70%, transparent),
|
|
40
|
+
inset 0 0 0 1px color-mix(in oklch, white 25%, transparent);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { HTMLElementBase } from '../anta_helpers';
|
|
2
|
+
import './a-tooltip.css';
|
|
3
|
+
export declare class ATooltipElement extends HTMLElementBase {
|
|
4
|
+
static observedAttributes: string[];
|
|
5
|
+
/** Shadow-internal popover surface — the only thing we ever mutate. */
|
|
6
|
+
private container;
|
|
7
|
+
private anchor;
|
|
8
|
+
listening: boolean;
|
|
9
|
+
private shown;
|
|
10
|
+
private lastMouse?;
|
|
11
|
+
private debouncedShow?;
|
|
12
|
+
private teardown?;
|
|
13
|
+
private closeTimer?;
|
|
14
|
+
private fading;
|
|
15
|
+
private fadeTimer?;
|
|
16
|
+
private docMoveBound;
|
|
17
|
+
constructor();
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
attributeChangedCallback(name: string): void;
|
|
21
|
+
/** (Re)build the show debounce with the CURRENT `delay` (rebuilt when the
|
|
22
|
+
* `delay` attribute changes). Re-armed on each hover move (trailing), and
|
|
23
|
+
* fed the latest cursor event, so it shows at the cursor and so moving back
|
|
24
|
+
* onto an anchor after the tooltip was dismissed re-arms it. */
|
|
25
|
+
private makeDebouncedShow;
|
|
26
|
+
/** The element's OWN window / document. The class may be defined in a
|
|
27
|
+
* different realm than the element lives in (e.g. the docs playground
|
|
28
|
+
* renders into an iframe but reuses the parent page's element class), so
|
|
29
|
+
* the module-global `window`/`document` can point at the wrong frame.
|
|
30
|
+
* Everything viewport- or document-scoped (clamping, scroll/key/move
|
|
31
|
+
* listeners) must go through these so it's correct in any frame. */
|
|
32
|
+
private get view();
|
|
33
|
+
private get doc();
|
|
34
|
+
private get isInteractive();
|
|
35
|
+
/** Pinned under the anchor (no cursor-following). Interactive implies this —
|
|
36
|
+
* you can't move into a bubble that's chasing the cursor. */
|
|
37
|
+
private get isStatic();
|
|
38
|
+
private get prefersTop();
|
|
39
|
+
private get delay();
|
|
40
|
+
private positionToTarget;
|
|
41
|
+
private positionToMouse;
|
|
42
|
+
private position;
|
|
43
|
+
show: (e?: MouseEvent) => void;
|
|
44
|
+
hide: () => void;
|
|
45
|
+
/** While shown, track the cursor even after it has left the anchor (during
|
|
46
|
+
* the close delay). Cursor-following only — static/interactive bubbles
|
|
47
|
+
* stay pinned. */
|
|
48
|
+
private onDocMove;
|
|
49
|
+
/** Hide after CLOSE_DELAY unless something cancels it first (re-enter, or
|
|
50
|
+
* another tooltip claiming the slot). Lets the bubble bridge the gap to a
|
|
51
|
+
* neighbouring anchor — and survive the trip into an interactive bubble. */
|
|
52
|
+
private scheduleHide;
|
|
53
|
+
private cancelHide;
|
|
54
|
+
private onKeyDown;
|
|
55
|
+
/** Open now if another tooltip is hot (skip delay), else (re)arm the delayed
|
|
56
|
+
* show with the latest cursor event. */
|
|
57
|
+
private trigger;
|
|
58
|
+
setupListeners(): void;
|
|
59
|
+
teardownListeners(): void;
|
|
60
|
+
}
|
|
61
|
+
export declare function register_a_tooltip(): void;
|