@dloizides/logo-kit 0.1.1 → 0.1.3
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 +4 -0
- package/dist/cli.js +17 -11
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
- Fix: the hover micro no longer restarts or cuts short the intro. Micro CSS now animates dedicated wrappers (`<g class="lkmN">` per layer, `<g class="lkmm">` for the whole mark, `lkmsN` sweep overlays) instead of the intro's `.lN` / `#mark` / `.lksN` elements, so hover never changes the intro element's `animation-name`.
|
|
6
|
+
|
|
3
7
|
## 0.1.1
|
|
4
8
|
|
|
5
9
|
- First published version. Reversed check covers visibility as well as contrast; Pulse is no longer a micro preset (every micro preset stays under 300 ms); export output is byte-for-byte parity-tested against the live Moon Cube files; the built CLI is spawn-tested.
|
package/dist/cli.js
CHANGED
|
@@ -193,11 +193,14 @@ function layerSvg(layer, index, colours, mode, opts = {}) {
|
|
|
193
193
|
const path5 = (item, head2) => `<path${head2} ${paintAttrs(item, colours, opts.colourOverride)}${rule}${len} d="${layer.d}"/>`;
|
|
194
194
|
const head = ` id="mark-${layer.name}" class="l${index}"`;
|
|
195
195
|
const body = items.length === 1 && items[0] ? path5(items[0], head) : `<g${head}>${items.map((item) => path5(item, "")).join("")}</g>`;
|
|
196
|
-
|
|
196
|
+
const wrapped = opts.microWrap === true ? `<g class="lkm${index}">${body}</g>` : body;
|
|
197
|
+
return layer.transform !== void 0 ? `<g transform="${layer.transform}">${wrapped}</g>` : wrapped;
|
|
197
198
|
}
|
|
198
199
|
function markBody(mark, palette, mode, opts = {}) {
|
|
199
200
|
const colours = mode === "dark" /* Dark */ ? palette.dark : palette.light;
|
|
200
|
-
|
|
201
|
+
const layers = mark.layers.map((layer, i) => layerSvg(layer, i, colours, mode, opts)).join("");
|
|
202
|
+
const body = opts.microWrap === true ? '<g class="lkmm">'.concat(layers, "</g>") : layers;
|
|
203
|
+
return `<g id="mark">${body}</g>`;
|
|
201
204
|
}
|
|
202
205
|
function markSvg(mark, palette, mode, opts) {
|
|
203
206
|
const size = opts.size ?? DEFAULT_SIZE;
|
|
@@ -897,19 +900,22 @@ function validateMotion(config, layerNames) {
|
|
|
897
900
|
|
|
898
901
|
// src/motion/motionCss.ts
|
|
899
902
|
var REDUCED_MOTION = "@media (prefers-reduced-motion:reduce){*{animation:none!important}}";
|
|
903
|
+
var sweepClass = (index, hover) => `${hover ? "lkms" : "lks"}${index}`;
|
|
900
904
|
var selectorOf = (target, index, hover, sweep) => {
|
|
901
|
-
|
|
905
|
+
if (sweep) {
|
|
906
|
+
return `${hover ? "svg:hover" : "svg"} .${sweepClass(index, hover)}`;
|
|
907
|
+
}
|
|
902
908
|
if (target === MARK_TARGET) {
|
|
903
|
-
return
|
|
909
|
+
return hover ? "svg:hover .lkmm" : "svg #mark";
|
|
904
910
|
}
|
|
905
|
-
return
|
|
911
|
+
return hover ? `svg:hover .lkm${index}` : `svg .l${index}`;
|
|
906
912
|
};
|
|
907
|
-
function sweepOverlay(mark, index, beat, colour) {
|
|
913
|
+
function sweepOverlay(mark, index, beat, colour, hover) {
|
|
908
914
|
const layer = mark.layers[index];
|
|
909
915
|
if (!layer) {
|
|
910
916
|
return "";
|
|
911
917
|
}
|
|
912
|
-
const attrs = [`class="
|
|
918
|
+
const attrs = [`class="${sweepClass(index, hover)}"`, `d="${layer.d}"`, 'fill="none"', `stroke="${colour}"`, `stroke-width="${beat.width ?? 2}"`, 'stroke-linecap="round"', 'pathLength="1"', `stroke-dasharray="${beat.share ?? 0.12} 1"`, 'opacity="0"'];
|
|
913
919
|
if (layer.transform !== void 0) {
|
|
914
920
|
attrs.push(`transform="${layer.transform}"`);
|
|
915
921
|
}
|
|
@@ -946,7 +952,7 @@ function addSlot(ctx, beat, b, slot) {
|
|
|
946
952
|
ctx.drawLayers.add(slot.target);
|
|
947
953
|
}
|
|
948
954
|
if (sweep) {
|
|
949
|
-
ctx.overlay.push(sweepOverlay(ctx.mark, index, beat, ctx.colour(beat.colour)));
|
|
955
|
+
ctx.overlay.push(sweepOverlay(ctx.mark, index, beat, ctx.colour(beat.colour), ctx.hover));
|
|
950
956
|
}
|
|
951
957
|
}
|
|
952
958
|
function motionCss(mark, beats, palette, mode, hover) {
|
|
@@ -964,7 +970,7 @@ function motionCss(mark, beats, palette, mode, hover) {
|
|
|
964
970
|
overlay: []
|
|
965
971
|
};
|
|
966
972
|
beats.forEach((beat, b) => schedule(beat, ctx.names).forEach((slot) => addSlot(ctx, beat, b, slot)));
|
|
967
|
-
return { style: render(ctx.rules, ctx.keyframes), overlay: ctx.overlay.join(""), drawLayers: ctx.drawLayers };
|
|
973
|
+
return { style: render(ctx.rules, ctx.keyframes), overlay: ctx.overlay.join(""), drawLayers: ctx.drawLayers, microWrap: hover };
|
|
968
974
|
}
|
|
969
975
|
|
|
970
976
|
// src/motion/motionSvg.ts
|
|
@@ -974,14 +980,14 @@ function introSvg(mark, palette, mode, beats, opts) {
|
|
|
974
980
|
}
|
|
975
981
|
function microSvg(mark, palette, mode, beats, opts) {
|
|
976
982
|
const m = motionCss(mark, beats, palette, mode, true);
|
|
977
|
-
return markSvg(mark, palette, mode, { ...opts, style: m.style, overlay: m.overlay, drawLayers: m.drawLayers });
|
|
983
|
+
return markSvg(mark, palette, mode, { ...opts, style: m.style, overlay: m.overlay, drawLayers: m.drawLayers, microWrap: m.microWrap });
|
|
978
984
|
}
|
|
979
985
|
function animatedSvg(mark, palette, mode, motion, opts) {
|
|
980
986
|
const intro = motionCss(mark, motion.intro, palette, mode, false);
|
|
981
987
|
const micro = motionCss(mark, motion.micro, palette, mode, true);
|
|
982
988
|
const style = `${intro.style.replace(REDUCED_MOTION, "")}${micro.style}`;
|
|
983
989
|
const drawLayers = /* @__PURE__ */ new Set([...intro.drawLayers, ...micro.drawLayers]);
|
|
984
|
-
return markSvg(mark, palette, mode, { ...opts, style, overlay: intro.overlay + micro.overlay, drawLayers });
|
|
990
|
+
return markSvg(mark, palette, mode, { ...opts, style, overlay: intro.overlay + micro.overlay, drawLayers, microWrap: true });
|
|
985
991
|
}
|
|
986
992
|
|
|
987
993
|
// src/export/canvas.ts
|