@konvert7/promoot 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/README.md +7 -0
- package/dist/promoot-block.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,6 +85,13 @@ visitor's browser fetches regardless of how that HTML was produced.
|
|
|
85
85
|
`className` and `style` land on the container, and the internal structure carries
|
|
86
86
|
`data-promoot-*` attributes plus `promoot-*` class names you can target.
|
|
87
87
|
|
|
88
|
+
**It inherits your page rather than painting over it.** Unless the owner picked a
|
|
89
|
+
typeface in their dashboard, the block sets `font: inherit` and renders in whatever face
|
|
90
|
+
your page already uses, webfont included — something the iframe version can never do,
|
|
91
|
+
because nothing crosses an iframe boundary. Corner radius and outline width come from the
|
|
92
|
+
owner's settings too, and each falls back to the shipped value if your Promoot server is
|
|
93
|
+
older than those controls.
|
|
94
|
+
|
|
88
95
|
The block **never declares a colour scheme of its own**. Its palette uses `light-dark()`,
|
|
89
96
|
which resolves against the scheme it inherits from your page — so a light-only site keeps
|
|
90
97
|
a light panel even for a visitor whose OS prefers dark, and a dark site gets a dark one.
|
package/dist/promoot-block.js
CHANGED
|
@@ -13,9 +13,6 @@ async function loadBlock(embedUrl) {
|
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
// Every rule is scoped to this one block, and it never declares a colour scheme
|
|
17
|
-
// of its own: the palette uses light-dark(), which resolves against the scheme
|
|
18
|
-
// inherited from the host page, so a light-only site keeps a light panel.
|
|
19
16
|
// A keyframe name cannot be scoped to a selector, so it carries the slot's own
|
|
20
17
|
// id instead, stripped to the characters a css identifier may hold.
|
|
21
18
|
function breatheName(slotId, face) {
|
|
@@ -27,7 +24,7 @@ const mono = "ui-monospace, SFMono-Regular, Menlo, monospace";
|
|
|
27
24
|
function billboardCss(payload, scope) {
|
|
28
25
|
const rest = breatheName(payload.slot.id, "rest");
|
|
29
26
|
const ghost = breatheName(payload.slot.id, "ghost");
|
|
30
|
-
return `${scope} .promoot-bb { position: relative; display: block; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid var(--edge); border-radius: 10px; background: var(--surface); overflow: hidden; font-family:
|
|
27
|
+
return `${scope} .promoot-bb { position: relative; display: block; width: 100%; height: 100%; box-sizing: border-box; border: var(--border, 1px) solid var(--edge); border-radius: var(--radius, 10px); background: var(--surface); overflow: hidden; font-family: var(--font, inherit); }
|
|
31
28
|
${scope} .promoot-bb:hover { border-color: var(--edge-hover); }
|
|
32
29
|
${scope} .promoot-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 16px; box-sizing: border-box; text-align: center; transition: opacity .3s ease; }
|
|
33
30
|
${scope} .promoot-bb:hover .promoot-rest { opacity: 0; }
|
|
@@ -48,13 +45,16 @@ ${scope} .promoot-ghost-body { display: block; font-size: 12px; color: var(--mut
|
|
|
48
45
|
@keyframes ${rest} { 0%, 55%, 100% { opacity: 1; } 70%, 85% { opacity: 0; } }
|
|
49
46
|
@keyframes ${ghost} { 0%, 55%, 100% { opacity: 0; } 70%, 85% { opacity: 1; } }`;
|
|
50
47
|
}
|
|
48
|
+
// Every rule is scoped to this one block, and it never declares a colour scheme
|
|
49
|
+
// of its own: the palette uses light-dark(), which resolves against the scheme
|
|
50
|
+
// inherited from the host page, so a light-only site keeps a light panel.
|
|
51
51
|
export function scopedCss(payload) {
|
|
52
52
|
const scope = `[data-promoot-slot="${payload.slot.id}"]`;
|
|
53
53
|
return `${scope} { ${payload.paletteVars}; position: relative; display: block; width: 100%; max-width: ${payload.slot.widthPx}px; height: auto; max-height: ${payload.slot.heightPx}px; aspect-ratio: ${payload.slot.widthPx} / ${payload.slot.heightPx}; }
|
|
54
54
|
${scope} a { text-decoration: none; }
|
|
55
55
|
${scope} .promoot-ad { display: block; position: relative; height: 100%; width: 100%; }
|
|
56
56
|
${scope} .promoot-ad > img { display: block; height: 100%; width: 100%; object-fit: cover; }
|
|
57
|
-
${scope} .promoot-text { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 100%; height: 100%; box-sizing: border-box; padding: 6px 12px; border: 1px solid var(--edge); border-radius: 10px; background: var(--surface); overflow: hidden; text-align: center; font-family:
|
|
57
|
+
${scope} .promoot-text { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 100%; height: 100%; box-sizing: border-box; padding: 6px 12px; border: var(--border, 1px) solid var(--edge); border-radius: var(--radius, 10px); background: var(--surface); overflow: hidden; text-align: center; font-family: var(--font, inherit); }
|
|
58
58
|
${scope} .promoot-ad:hover .promoot-text { border-color: var(--edge-hover); background: var(--surface-hover); }
|
|
59
59
|
${scope} .promoot-mark { position: relative; flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin-bottom: 1px; border-radius: 6px; background: var(--edge); color: var(--surface); font-weight: 700; font-size: 12px; overflow: hidden; }
|
|
60
60
|
${scope} .promoot-mark img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
|
|
@@ -62,7 +62,7 @@ ${scope} .promoot-text > span:not(.promoot-mark) { max-width: 100%; white-space:
|
|
|
62
62
|
${scope} .promoot-text .promoot-headline { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.25; }
|
|
63
63
|
${scope} .promoot-text .promoot-desc { font-size: 12px; color: var(--muted); line-height: 1.25; }
|
|
64
64
|
${scope} .promoot-text .promoot-host { font-size: 11px; color: var(--muted); line-height: 1.25; }
|
|
65
|
-
${scope} .promoot-cta { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; height: 100%; justify-content: center; padding: 0 10px; text-align: center; border: 1px dashed var(--edge); border-radius: 10px; box-sizing: border-box; color: var(--muted); background: var(--surface); font-family:
|
|
65
|
+
${scope} .promoot-cta { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; height: 100%; justify-content: center; padding: 0 10px; text-align: center; border: var(--border, 1px) dashed var(--edge); border-radius: var(--radius, 10px); box-sizing: border-box; color: var(--muted); background: var(--surface); font-family: var(--font, inherit); }
|
|
66
66
|
${scope} .promoot-cta:hover { border-color: var(--edge-hover); background: var(--surface-hover); }
|
|
67
67
|
${scope} .promoot-cta strong { font-size: 14px; color: var(--ink); }
|
|
68
68
|
${scope} .promoot-cta .promoot-pitch { font-size: 13px; color: var(--ink); }
|
package/package.json
CHANGED