@dloizides/logo-kit 0.3.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,10 @@
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
+
3
8
  ## 0.3.0
4
9
 
5
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.
package/dist/index.d.ts CHANGED
@@ -71,13 +71,14 @@ interface WordmarkMotionConfig {
71
71
  recipe: string;
72
72
  startMs: number;
73
73
  }
74
+ interface IdleMotionConfig {
75
+ recipe: string;
76
+ }
74
77
  interface MotionConfig {
75
78
  intro: MotionBeat[];
76
79
  micro: MotionBeat[];
77
80
  wordmark?: WordmarkMotionConfig;
78
- idle?: {
79
- recipe: string;
80
- };
81
+ idle?: IdleMotionConfig;
81
82
  allowLongIntro?: string;
82
83
  recipeErrors?: string[];
83
84
  }
@@ -478,4 +479,4 @@ type Out = (line: string) => void;
478
479
  /** Runs the logo-kit command line and returns its exit code. */
479
480
  declare function runCli(args: readonly string[], out?: Out): number;
480
481
 
481
- export { type AnimationTiming, BOLD_PRESETS, type Bitmap, type Brand, CVD_KINDS, type CheckResult, type ChecksReport, CvdKind, type ExportedFile, IDLE_CAP_MS, IDLE_RECIPES, INTRO_CAP_MS, INTRO_PRESETS, INTRO_RECIPES, type IdleContext, type IdleMotion, IdleRecipe, IntroRecipe, LOOKALIKE_THRESHOLD, type LayerPaint, MICRO_CAP_MS, MICRO_DEFAULTS, MICRO_PRESETS, MICRO_RECIPES, MODES, type Mark, type MarkLayer, MicroRecipe, Mode, type MotionBeat, type MotionConfig, MotionPreset, type MotionRoles, PRESET_DEFAULTS, PRIMITIVES, type PaintItem, type Palette, type PickSpec, type Pt, type RawMotion, type RecipeContext, SYMBOLS, type TimingMap, type Variant, WORDMARK_RECIPES, type WordmarkMotion, type WordmarkMotionConfig, type WordmarkOptions, WordmarkRecipe, alphaMask, animatedSvg, buildPickPage, buildPickSpec, checkVariants, contrast, deltaE, exportBrand, fitBeat, flattenPath, generateVariants, generatorPalette, geometryModule, idleRecipe, introRecipe, introSvg, loadBrand, markSvg, microRecipe, microSvg, paletteVariants, parseBrand, parseTiming, pixelDiff, pngSize, primitiveMark, renderPng, renderSvg, resolveMotion, resolveToken, runChecks, runCli, schedule, simulateCvd, symbolMatches, symbolScores, totalMs, validateMotion, wordmarkReveal };
482
+ export { type AnimationTiming, BOLD_PRESETS, type Bitmap, type Brand, CVD_KINDS, type CheckResult, type ChecksReport, CvdKind, type ExportedFile, IDLE_CAP_MS, IDLE_RECIPES, INTRO_CAP_MS, INTRO_PRESETS, INTRO_RECIPES, type IdleContext, type IdleMotion, type IdleMotionConfig, IdleRecipe, IntroRecipe, LOOKALIKE_THRESHOLD, type LayerPaint, MICRO_CAP_MS, MICRO_DEFAULTS, MICRO_PRESETS, MICRO_RECIPES, MODES, type Mark, type MarkLayer, MicroRecipe, Mode, type MotionBeat, type MotionConfig, MotionPreset, type MotionRoles, PRESET_DEFAULTS, PRIMITIVES, type PaintItem, type Palette, type PickSpec, type Pt, type RawMotion, type RecipeContext, SYMBOLS, type TimingMap, type Variant, WORDMARK_RECIPES, type WordmarkMotion, type WordmarkMotionConfig, type WordmarkOptions, WordmarkRecipe, alphaMask, animatedSvg, buildPickPage, buildPickSpec, checkVariants, contrast, deltaE, exportBrand, fitBeat, flattenPath, generateVariants, generatorPalette, geometryModule, idleRecipe, introRecipe, introSvg, loadBrand, markSvg, microRecipe, microSvg, paletteVariants, parseBrand, parseTiming, pixelDiff, pngSize, primitiveMark, renderPng, renderSvg, resolveMotion, resolveToken, runChecks, runCli, schedule, simulateCvd, symbolMatches, symbolScores, totalMs, validateMotion, wordmarkReveal };
package/dist/runtime.js CHANGED
@@ -1,3 +1,6 @@
1
+ // src/motion/IdleRecipe.ts
2
+ var IDLE_CAP_MS = 600;
3
+
1
4
  // src/runtime/startIdle.ts
2
5
  var DEFAULT_MIN_MS = 8e3;
3
6
  var DEFAULT_MAX_MS = 15e3;
@@ -9,7 +12,7 @@ var tabHidden = () => browser().document?.hidden === true;
9
12
  function startIdle(el, options = {}) {
10
13
  const minMs = options.minMs ?? DEFAULT_MIN_MS;
11
14
  const maxMs = Math.max(minMs, options.maxMs ?? DEFAULT_MAX_MS);
12
- const runMs = options.durationMs ?? DEFAULT_RUN_MS;
15
+ const runMs = Math.min(options.durationMs ?? DEFAULT_RUN_MS, IDLE_CAP_MS);
13
16
  const className = options.className ?? "lk-idle";
14
17
  const random = options.random ?? Math.random;
15
18
  let timer;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/runtime/startIdle.ts"],"names":[],"mappings":";AAiBA,IAAM,cAAA,GAAiB,GAAA;AACvB,IAAM,cAAA,GAAiB,IAAA;AACvB,IAAM,cAAA,GAAiB,GAAA;AACvB,IAAM,aAAA,GAAgB,kCAAA;AAEtB,IAAM,UAAU,MAAsB,UAAA;AACtC,IAAM,gBAAgB,MAAe,OAAA,GAAU,UAAA,GAAa,aAAa,EAAE,OAAA,KAAY,IAAA;AACvF,IAAM,SAAA,GAAY,MAAe,OAAA,EAAQ,CAAE,UAAU,MAAA,KAAW,IAAA;AAGzD,SAAS,SAAA,CAAU,EAAA,EAAc,OAAA,GAAuB,EAAC,EAAe;AAC7E,EAAA,MAAM,KAAA,GAAQ,QAAQ,KAAA,IAAS,cAAA;AAC/B,EAAA,MAAM,QAAQ,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,OAAA,CAAQ,SAAS,cAAc,CAAA;AAC7D,EAAA,MAAM,KAAA,GAAQ,QAAQ,UAAA,IAAc,cAAA;AACpC,EAAA,MAAM,SAAA,GAAY,QAAQ,SAAA,IAAa,SAAA;AACvC,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,MAAA,IAAU,IAAA,CAAK,MAAA;AACtC,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI,OAAA,GAAU,KAAA;AACd,EAAA,MAAM,WAAW,MAAY;AAC3B,IAAA,KAAA,GAAQ,WAAW,IAAA,EAAM,KAAA,GAAQ,MAAA,EAAO,IAAK,QAAQ,KAAA,CAAM,CAAA;AAAA,EAC7D,CAAA;AACA,EAAA,MAAM,SAAS,MAAY;AACzB,IAAA,EAAA,CAAG,SAAA,CAAU,OAAO,SAAS,CAAA;AAC7B,IAAA,QAAA,EAAS;AAAA,EACX,CAAA;AACA,EAAA,SAAS,IAAA,GAAa;AACpB,IAAA,IAAI,OAAA,EAAS;AACX,MAAA;AAAA,IACF;AACA,IAAA,IAAI,SAAA,EAAU,IAAK,aAAA,EAAc,EAAG;AAClC,MAAA,QAAA,EAAS;AACT,MAAA;AAAA,IACF;AACA,IAAA,EAAA,CAAG,SAAA,CAAU,IAAI,SAAS,CAAA;AAC1B,IAAA,KAAA,GAAQ,UAAA,CAAW,QAAQ,KAAK,CAAA;AAAA,EAClC;AACA,EAAA,IAAI,eAAc,EAAG;AACnB,IAAA,OAAO,MAAY,MAAA;AAAA,EACrB;AACA,EAAA,QAAA,EAAS;AACT,EAAA,OAAO,MAAY;AACjB,IAAA,OAAA,GAAU,IAAA;AACV,IAAA,YAAA,CAAa,KAAK,CAAA;AAClB,IAAA,EAAA,CAAG,SAAA,CAAU,OAAO,SAAS,CAAA;AAAA,EAC/B,CAAA;AACF","file":"runtime.js","sourcesContent":["export interface IdleHost {\n classList: { add(name: string): void; remove(name: string): void };\n}\n\nexport interface IdleOptions {\n minMs?: number;\n maxMs?: number;\n durationMs?: number;\n className?: string;\n random?: () => number;\n}\n\ninterface BrowserGlobals {\n document?: { hidden?: boolean };\n matchMedia?: (query: string) => { matches: boolean };\n}\n\nconst DEFAULT_MIN_MS = 8000;\nconst DEFAULT_MAX_MS = 15000;\nconst DEFAULT_RUN_MS = 600;\nconst REDUCED_QUERY = '(prefers-reduced-motion: reduce)';\n\nconst browser = (): BrowserGlobals => globalThis as BrowserGlobals;\nconst reducedMotion = (): boolean => browser().matchMedia?.(REDUCED_QUERY).matches === true;\nconst tabHidden = (): boolean => browser().document?.hidden === true;\n\n/** Plays the idle class on the element every 8-15 s (configurable) and returns stop(). */\nexport function startIdle(el: IdleHost, options: IdleOptions = {}): () => void {\n const minMs = options.minMs ?? DEFAULT_MIN_MS;\n const maxMs = Math.max(minMs, options.maxMs ?? DEFAULT_MAX_MS);\n const runMs = options.durationMs ?? DEFAULT_RUN_MS;\n const className = options.className ?? 'lk-idle';\n const random = options.random ?? Math.random;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let stopped = false;\n const schedule = (): void => {\n timer = setTimeout(tick, minMs + random() * (maxMs - minMs));\n };\n const finish = (): void => {\n el.classList.remove(className);\n schedule();\n };\n function tick(): void {\n if (stopped) {\n return;\n }\n if (tabHidden() || reducedMotion()) {\n schedule();\n return;\n }\n el.classList.add(className);\n timer = setTimeout(finish, runMs);\n }\n if (reducedMotion()) {\n return (): void => undefined;\n }\n schedule();\n return (): void => {\n stopped = true;\n clearTimeout(timer);\n el.classList.remove(className);\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/motion/IdleRecipe.ts","../src/runtime/startIdle.ts"],"names":[],"mappings":";AASO,IAAM,WAAA,GAAc,GAAA;;;ACU3B,IAAM,cAAA,GAAiB,GAAA;AACvB,IAAM,cAAA,GAAiB,IAAA;AACvB,IAAM,cAAA,GAAiB,GAAA;AACvB,IAAM,aAAA,GAAgB,kCAAA;AAEtB,IAAM,UAAU,MAAsB,UAAA;AACtC,IAAM,gBAAgB,MAAe,OAAA,GAAU,UAAA,GAAa,aAAa,EAAE,OAAA,KAAY,IAAA;AACvF,IAAM,SAAA,GAAY,MAAe,OAAA,EAAQ,CAAE,UAAU,MAAA,KAAW,IAAA;AAGz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A,CAAa,KAAK,CAAA;AAClB,IAAA,EAAA,CAAG,SAAA,CAAU,OAAO,SAAS,CAAA;AAAA,EAC/B,CAAA;AACF","file":"runtime.js","sourcesContent":["export const enum IdleRecipe {\n RimGlint = 'rim-glint',\n FacesPart = 'faces-part',\n Breath = 'breath',\n OrbitSpark = 'orbit-spark',\n}\n\nexport const IDLE_RECIPES: readonly IdleRecipe[] = [IdleRecipe.RimGlint, IdleRecipe.FacesPart, IdleRecipe.Breath, IdleRecipe.OrbitSpark];\n\nexport const IDLE_CAP_MS = 600;\n","import { IDLE_CAP_MS } from '../motion/IdleRecipe';\n\nexport interface IdleHost {\n classList: { add(name: string): void; remove(name: string): void };\n}\n\nexport interface IdleOptions {\n minMs?: number;\n maxMs?: number;\n durationMs?: number;\n className?: string;\n random?: () => number;\n}\n\ninterface BrowserGlobals {\n document?: { hidden?: boolean };\n matchMedia?: (query: string) => { matches: boolean };\n}\n\nconst DEFAULT_MIN_MS = 8000;\nconst DEFAULT_MAX_MS = 15000;\nconst DEFAULT_RUN_MS = 600;\nconst REDUCED_QUERY = '(prefers-reduced-motion: reduce)';\n\nconst browser = (): BrowserGlobals => globalThis as BrowserGlobals;\nconst reducedMotion = (): boolean => browser().matchMedia?.(REDUCED_QUERY).matches === true;\nconst tabHidden = (): boolean => browser().document?.hidden === true;\n\n/** Plays the idle class on the element every 8-15 s (configurable) and returns stop(). */\nexport function startIdle(el: IdleHost, options: IdleOptions = {}): () => void {\n const minMs = options.minMs ?? DEFAULT_MIN_MS;\n const maxMs = Math.max(minMs, options.maxMs ?? DEFAULT_MAX_MS);\n const runMs = Math.min(options.durationMs ?? DEFAULT_RUN_MS, IDLE_CAP_MS);\n const className = options.className ?? 'lk-idle';\n const random = options.random ?? Math.random;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let stopped = false;\n const schedule = (): void => {\n timer = setTimeout(tick, minMs + random() * (maxMs - minMs));\n };\n const finish = (): void => {\n el.classList.remove(className);\n schedule();\n };\n function tick(): void {\n if (stopped) {\n return;\n }\n if (tabHidden() || reducedMotion()) {\n schedule();\n return;\n }\n el.classList.add(className);\n timer = setTimeout(finish, runMs);\n }\n if (reducedMotion()) {\n return (): void => undefined;\n }\n schedule();\n return (): void => {\n stopped = true;\n clearTimeout(timer);\n el.classList.remove(className);\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dloizides/logo-kit",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Logo generator for every brand: seeded mark variants, small-size, contrast, CVD and sensitive-symbol checks, motion presets by layer name, palette variants from design tokens, and the full export set from one brand.json. No network, no LLM.",
5
5
  "keywords": [
6
6
  "brand",