@dloizides/logo-kit 0.2.0 → 0.3.1

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ - Fix: `startIdle` caps `durationMs` at `IDLE_CAP_MS` (600 ms), so a longer value no longer holds the idle class past the idle budget.
6
+ - The `brand.json` `motion.idle` type is now the exported `IdleMotionConfig` (same `{ recipe }` shape).
7
+
8
+ ## 0.3.0
9
+
10
+ - Intro recipe `grow-settle` (Moon Cube option "Settle overshoot"): the base floods, the parts grow from circles, then the whole mark swells 4% and settles back; ends at 1180 ms.
11
+ - Wordmark reveal recipes `letter-stagger`, `slide-from-mark`, `typewriter`, `mask-wipe`, `tracking-settle` (`wordmarkReveal`): CSS for letters classed `<prefix>-l<i>`, word width from the letter advances, a configurable start offset; reduced motion shows the name at once. `brand.json` `motion.wordmark` takes a recipe name or `{ recipe, startMs }`.
12
+ - Idle recipes `rim-glint`, `faces-part`, `breath`, `orbit-spark` (`idleRecipe`), each at most 600 ms (`IDLE_CAP_MS`), played while a trigger class is on; `brand.json` `motion.idle` names one. Unknown wordmark or idle recipes are reported like intro and micro ones.
13
+ - Browser-safe subpath `@dloizides/logo-kit/runtime` (no fs, no resvg): `startIdle(el, { minMs, maxMs })` adds the idle class every 8-15 s by default, skips a run while the tab is hidden, never runs under prefers-reduced-motion, and returns `stop()`.
14
+
3
15
  ## 0.2.0
4
16
 
5
17
  - Motion recipes: `brand.json` `motion.intro` / `motion.micro` may name a recipe instead of a beat list. Intro recipes `rim-then-ink`, `phase-wipe`, `faces-settle`, `turn-into-place`, `grow-from-circles`, `fly-in`, `spin-assemble`, `drop-bounce`, `flip-faces`, `slam-shake`; micro recipes `faces-part`, `breath`, `rim-glint`, `part-and-glint`.
package/dist/cli.js CHANGED
@@ -511,6 +511,9 @@ var DEFAULT_MOTION_CONFIG = {
511
511
  micro: [{ preset: "spread" /* Spread */, durationMs: 300, distance: 1.6, easing: EASE }]
512
512
  };
513
513
 
514
+ // src/motion/IdleRecipe.ts
515
+ var IDLE_RECIPES = ["rim-glint" /* RimGlint */, "faces-part" /* FacesPart */, "breath" /* Breath */, "orbit-spark" /* OrbitSpark */];
516
+
514
517
  // src/motion/timeline.ts
515
518
  function targetsOf(beat, layerNames) {
516
519
  if (!beat.layers) {
@@ -560,6 +563,7 @@ function validateMotion(config, layerNames) {
560
563
 
561
564
  // src/motion/recipes.ts
562
565
  var REFERENCE_SIZE = 64;
566
+ var SETTLE_EASE = "cubic-bezier(0.23,1,0.32,1)";
563
567
  var fit = (beat) => fitBeat(beat, beat.layers?.length ?? 1, INTRO_CAP_MS);
564
568
  var all = (ctx) => [...ctx.roles.base, ...ctx.roles.parts];
565
569
  var INTROS = {
@@ -591,7 +595,12 @@ var INTROS = {
591
595
  { preset: "flood" /* Flood */, layers: ctx.roles.base, durationMs: 400, easing: EASE_IN_FIRST },
592
596
  fit({ preset: "flip" /* Flip */, layers: ctx.roles.parts, durationMs: 700, delayMs: 250, stepMs: 100 })
593
597
  ],
594
- ["slam-shake" /* SlamShake */]: () => [{ preset: "slam-shake" /* SlamShake */, layers: [MARK_TARGET], durationMs: 800 }]
598
+ ["slam-shake" /* SlamShake */]: () => [{ preset: "slam-shake" /* SlamShake */, layers: [MARK_TARGET], durationMs: 800 }],
599
+ ["grow-settle" /* GrowSettle */]: (ctx) => [
600
+ { preset: "flood" /* Flood */, layers: ctx.roles.base, durationMs: 360, easing: EASE_IN_FIRST },
601
+ { preset: "morph-from-circle" /* MorphFromCircle */, layers: ctx.roles.parts, durationMs: 700, delayMs: 240, stops: [0, 40, 100], fadeIn: ctx.roles.parts, easing: EASE_IN_FIRST, settleEasing: SETTLE_EASE },
602
+ { preset: "pulse" /* Pulse */, layers: [MARK_TARGET], durationMs: 260, delayMs: 920, scale: 1.04, easing: SETTLE_EASE }
603
+ ]
595
604
  };
596
605
  var spread = (ctx, k) => ({ preset: "spread" /* Spread */, layers: ctx.roles.parts, durationMs: 300, distance: 1.6 * k, easing: EASE });
597
606
  var glint = (ctx, k) => ({ preset: "sweep" /* Sweep */, layers: ctx.roles.base, durationMs: 300, share: 0.2, width: 1.5 * k, colour: "text", easing: EASE });
@@ -612,6 +621,15 @@ function microRecipe(name, ctx) {
612
621
  return run(MICROS, name, ctx);
613
622
  }
614
623
 
624
+ // src/motion/WordmarkRecipe.ts
625
+ var WORDMARK_RECIPES = [
626
+ "letter-stagger" /* LetterStagger */,
627
+ "slide-from-mark" /* SlideFromMark */,
628
+ "typewriter" /* Typewriter */,
629
+ "mask-wipe" /* MaskWipe */,
630
+ "tracking-settle" /* TrackingSettle */
631
+ ];
632
+
615
633
  // src/motion/resolveMotion.ts
616
634
  var KINDS = {
617
635
  intro: { recipe: introRecipe, fallback: DEFAULT_MOTION_CONFIG.intro },
@@ -625,18 +643,30 @@ function resolve(kind, value, ctx) {
625
643
  const beats = recipe(value, ctx);
626
644
  return beats !== null ? { beats } : { beats: [], error: `unknown ${kind} recipe "${value}"` };
627
645
  }
646
+ function toWordmark(raw) {
647
+ if (raw === void 0) {
648
+ return void 0;
649
+ }
650
+ return typeof raw === "string" ? { recipe: raw, startMs: 0 } : { recipe: raw.recipe, startMs: raw.startMs ?? 0 };
651
+ }
652
+ var known = (list, kind, name) => name === void 0 || list.includes(name) ? [] : [`unknown ${kind} recipe "${name}"`];
628
653
  function resolveMotion(raw, layerNames, size) {
629
654
  const roles = { base: raw?.roles?.base ?? layerNames.slice(0, 1), parts: raw?.roles?.parts ?? layerNames.slice(1) };
630
655
  const ctx = { roles, size };
631
656
  const intro = resolve("intro", raw?.intro, ctx);
632
657
  const micro = resolve("micro", raw?.micro, ctx);
658
+ const wordmark = toWordmark(raw?.wordmark);
633
659
  const errors = [
634
660
  ...[...roles.base, ...roles.parts].filter((n) => !layerNames.includes(n)).map((n) => `motion.roles names unknown layer "${n}"`),
635
- ...[intro.error, micro.error].filter((e) => e !== void 0)
661
+ ...[intro.error, micro.error].filter((e) => e !== void 0),
662
+ ...known(WORDMARK_RECIPES, "wordmark", wordmark?.recipe),
663
+ ...known(IDLE_RECIPES, "idle", raw?.idle)
636
664
  ];
637
665
  return {
638
666
  intro: intro.beats,
639
667
  micro: micro.beats,
668
+ ...wordmark !== void 0 ? { wordmark } : {},
669
+ ...raw?.idle !== void 0 ? { idle: { recipe: raw.idle } } : {},
640
670
  ...raw?.allowLongIntro !== void 0 ? { allowLongIntro: raw.allowLongIntro } : {},
641
671
  ...errors.length > 0 ? { recipeErrors: errors } : {}
642
672
  };