@reqvire-org/ads 0.5.5 → 0.5.7

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.
@@ -6,15 +6,15 @@ const applied = {
6
6
  shadow: ["box-shadow", (token) => `var(${token})`],
7
7
  border: ["block-size", (token) => `calc(var(${token}) * 8)`],
8
8
  radius: ["border-start-start-radius", (token) => `var(${token})`],
9
- length: ["inline-size", (token) => `var(${token})`],
9
+ length: ["inline-size", (token) => `min(var(${token}), 100%)`],
10
10
  "font-family": ["font-family", (token) => `var(${token})`],
11
11
  "font-size": ["font-size", (token) => `var(${token})`],
12
12
  "font-weight": ["font-weight", (token) => `var(${token})`],
13
13
  "letter-spacing": ["letter-spacing", (token) => `var(${token})`],
14
14
  "line-height": ["line-height", (token) => `var(${token})`],
15
15
  size: ["inline-size", (token) => `min(var(${token}), 100%)`],
16
- gap: ["inline-size", (token) => `var(${token})`],
17
- inset: ["padding", (token) => `var(${token})`],
16
+ gap: ["inline-size", (token) => `min(var(${token}), 60%)`],
17
+ inset: ["padding", (token) => `min(var(${token}), 20%)`],
18
18
  control: ["block-size", (token) => `var(${token})`],
19
19
  blur: ["filter", (token) => `blur(var(${token}))`],
20
20
  scale: ["scale", (token) => `var(${token})`],
@@ -22,6 +22,15 @@ const applied = {
22
22
  "font-stretch": ["font-stretch", (token) => `var(${token})`],
23
23
  "word-spacing": ["word-spacing", (token) => `var(${token})`]
24
24
  };
25
+ function lengthPx(slot, token) {
26
+ const probe = slot.ownerDocument.createElement("span");
27
+ probe.hidden = !0;
28
+ probe.style.setProperty("inline-size", `var(${token})`);
29
+ slot.append(probe);
30
+ const px = parseFloat(slot.ownerDocument.defaultView?.getComputedStyle(probe).inlineSize ?? "");
31
+ probe.remove();
32
+ return px;
33
+ }
25
34
  function computedTiming(slot, token) {
26
35
  const doc = slot.ownerDocument, probe = doc.createElement("span");
27
36
  probe.hidden = !0;
@@ -41,7 +50,8 @@ export function drawTokenSample(slot, specimen, token, large = !1) {
41
50
  renderTokenSample(slot, curve === void 0 ? { kind: "value" } : { kind: "easing", curve });
42
51
  return;
43
52
  }
44
- renderTokenSample(slot, { kind: specimen, large });
53
+ const style = slot.ownerDocument.defaultView?.getComputedStyle(slot), line = parseFloat(style?.lineHeight ?? ""), bare = specimen === "control" && lengthPx(slot, token) < (Number.isFinite(line) ? line : 1.2 * parseFloat(style?.fontSize ?? "16"));
54
+ renderTokenSample(slot, { kind: specimen, large, bare });
45
55
  const value = slot.querySelector('[data-slot="value"]');
46
56
  if (value === null)
47
57
  return;