@adland/embed 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,137 @@
1
1
  # @adland/embed
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6bf8334: The card draws the right picture, and stops naming the ad's type.
8
+
9
+ ## The wrong picture in the square well
10
+
11
+ `cardMarkup` asked `@adland/react` for `getAdImage`, which prefers an ad's Open
12
+ Graph cover. But the card it renders is a compact row whose media box is square
13
+ by construction — `--adland-media-size` sets its width and its height alike.
14
+
15
+ So a link ad for splits.org put the middle of an 840×560 banner in a 44px box
16
+ where their logo belonged. It reads as a bad picture rather than the wrong
17
+ field, which is why it survived: nothing about it looks like a bug.
18
+
19
+ `getAdIcon` prefers the square mark and falls back to the cover, so an ad
20
+ carrying only one still renders. The two getters exist for exactly this — which
21
+ is right depends on the shape of the space, not on the ad.
22
+
23
+ Unchanged for anyone composing their own card with `@adland/react`: `<AdImage>`
24
+ in a wide box was always correct and still is.
25
+
26
+ ## The type badge is gone
27
+
28
+ The card rendered the ad's type beside it — "Link", "Token". It told a reader
29
+ nothing they wanted: they can see it is a link by looking at it, and the word
30
+ took a chunk of a row that is already a title and a description.
31
+
32
+ Removed with it, since a styling hook for an element that never renders is worse
33
+ than no hook:
34
+
35
+ - the `badge` name from `AD_PARTS`
36
+ - `--adland-badge-radius`, `--adland-badge-border`, `--adland-badge-size`,
37
+ `--adland-badge-weight`, `--adland-badge-padding`
38
+ - `--adland-accent-bg` and `--adland-accent-fg`, which existed only to colour it
39
+
40
+ The theme surface is 24 properties. `--adland-label` and `--adland-label-size`
41
+ stay: "Ad" is a disclosure, not a description, and it is not going anywhere.
42
+
43
+ Card padding is unchanged at 12px — `--adland-padding` was always there for a
44
+ theme that wants it tighter.
45
+
46
+ - f2441cc: Two ways to style a card that were not previously possible.
47
+
48
+ ## `render-mode="light"`
49
+
50
+ The two existing modes both isolate, and both isolate from the publisher as
51
+ much as from the advertiser. `isolated` (the default) seals the card in an
52
+ iframe, where the only way in is the `--adland-*` custom properties the element
53
+ copies across the document boundary. `inline` uses a shadow root, which those
54
+ properties inherit through and `::part()` can reach — better, and still not a
55
+ stylesheet, because Tailwind emits classes and a class in the page cannot cross
56
+ a shadow boundary. A publisher wanting `rounded-2xl` on the card had no way to
57
+ say it.
58
+
59
+ In `light` the markup is ordinary children of `<adland-slot>`, so every hook —
60
+ `.adland-card`, `.adland-media`, `.adland-title`, `.adland-description`,
61
+ `.adland-label`, `.adland-badge` — is a normal element in the page:
62
+
63
+ <adland-slot
64
+ slot-key="adland-1"
65
+ render-mode="light"
66
+ class="[&_.adland-card]:flex [&_.adland-card]:gap-3
67
+ [&_.adland-card]:rounded-xl [&_.adland-media]:size-12"
68
+ ></adland-slot>
69
+
70
+ Isolation runs both ways, so the trade is real: in this mode your CSS can break
71
+ the ad, and `BASE_STYLES` is deliberately not injected — in the light DOM those
72
+ rules would leak to the whole page. An unstyled card is what arrives, and
73
+ styling it becomes your job rather than your option. That is why it is opt-in
74
+ and why the default has not changed.
75
+
76
+ ## Nine more theme properties
77
+
78
+ The theme surface was 21 properties and could not express a card that is raised
79
+ at rest, presses when you hover it, or has a border on anything but the card
80
+ itself. Every gap below was found trying to build one neo-brutalist card and
81
+ discovering the style was unreachable:
82
+
83
+ | property | default | why |
84
+ | -------------------------- | ---------------- | --------------------------------------------------------------------------------------------- |
85
+ | `--adland-shadow` | `none` | There was a hover shadow and none at rest, which ruled out every raised style. |
86
+ | `--adland-transform-hover` | `none` | Shrinking the shadow alone reads as a wobble; the card has to move into the space it vacates. |
87
+ | `--adland-transition` | the existing one | So a style can snap rather than ease. |
88
+ | `--adland-media-border` | `none` | Hardcoded to borderless. |
89
+ | `--adland-badge-border` | `none` | Same. |
90
+ | `--adland-badge-size` | `10px` | Was fixed. |
91
+ | `--adland-badge-weight` | `600` | Was fixed. |
92
+ | `--adland-badge-padding` | `2px 6px` | Was fixed. |
93
+ | `--adland-label-size` | `9px` | Was fixed. |
94
+
95
+ Every one defaults to what was previously hardcoded, so nothing moves for anyone
96
+ not setting them.
97
+
98
+ <adland-slot
99
+ slot-key="adland-1"
100
+ style="--adland-bg: #fff; --adland-fg: #000;
101
+ --adland-border: #000; --adland-border-width: 2px;
102
+ --adland-radius: 0; --adland-shadow: 4px 4px 0 #000;
103
+ --adland-accent-bg: #FFE500"
104
+ ></adland-slot>
105
+
106
+ ### Patch Changes
107
+
108
+ - aaf1443: Fix: clicking a token, cast, tweet or profile ad did nothing.
109
+
110
+ Two bugs, and they hid each other.
111
+
112
+ `render.ts` carried its own `adWebUrl`, which resolved `link` and `miniapp` and
113
+ returned null for the other four types. `@adland/react`'s `WebActionAdapter` has
114
+ always used `adDestination` from `@adland/data`, which resolves all six — so
115
+ this was a second, shorter implementation of a function that already existed.
116
+ It now delegates to the shared one.
117
+
118
+ With no destination there was no `<a>` wrapper, and the iframe's click handler
119
+ told `handleClick` the URL had `alreadyOpened` — unconditionally, on the
120
+ assumption an anchor was always there. So the click was tracked and then
121
+ dropped, with no fallback to the adapter. The element now records whether an
122
+ anchor was actually rendered and passes that instead.
123
+
124
+ Only the default `isolated` mode was affected. `inline` and `light` route
125
+ through the adapter and were always correct, which is why the same ad worked in
126
+ one mode and not another.
127
+
128
+ A test asserted the old behaviour — "returns null for ad types with no web URL"
129
+ — so this shipped looking deliberate. Replaced with a table covering all six.
130
+
131
+ - Updated dependencies [c826a3c]
132
+ - Updated dependencies [2dc1cd3]
133
+ - @adland/react@0.25.0
134
+
3
135
  ## 0.4.0
4
136
 
5
137
  ### Minor Changes