@dloizides/logo-kit 0.4.0 → 0.4.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,8 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1
4
+
5
+ - `MountOptions.mode` is typed as the `Mode` const enum.
6
+ - Fix: the 0.4.0 note placed `resolveRuntime` in `/runtime`; it is exported from the root entry.
7
+
3
8
  ## 0.4.0
4
9
 
5
- - `resolveRuntime(brand)` (build time) and `mountBrand(host, runtime, opts)` in `@dloizides/logo-kit/runtime`: intro, wordmark reveal and idle; reduced motion mounts the still with no motion and no idle.
10
+ - `resolveRuntime(brand)` (build time, root entry `@dloizides/logo-kit`) and `mountBrand(host, runtime, opts)` (`@dloizides/logo-kit/runtime`): intro, wordmark reveal and idle; reduced motion mounts the still with no motion and no idle.
6
11
  - `pullBrand` / `brandCopyDrift` and CLI `pull-brand` + `check-brand-copy` (drift = exit 1, line endings ignored).
7
12
  - Limit: the HTML wordmark plays `letter-stagger` for `typewriter` and `mask-wipe` (no glyph positions) and lists it in `runtime.limits`.
8
13
  - Brand data removed from the repo: examples, parity fixtures and pick demo are made-up brands or gone; brands with no token reference now default to the `flier` generator palette.
@@ -1,3 +1,9 @@
1
+ declare const enum Mode {
2
+ Light = "light",
3
+ Dark = "dark"
4
+ }
5
+ declare const MODES: readonly Mode[];
6
+
1
7
  interface BrandModeRuntime {
2
8
  intro: string;
3
9
  still: string;
@@ -23,4 +29,4 @@ interface BrandRuntime {
23
29
  limits: string[];
24
30
  }
25
31
 
26
- export type { BrandRuntime as B, BrandIdleRuntime as a, BrandModeRuntime as b, BrandWordmarkRuntime as c };
32
+ export { type BrandRuntime as B, Mode as M, type BrandIdleRuntime as a, type BrandModeRuntime as b, type BrandWordmarkRuntime as c, MODES as d };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BrandRuntime } from './BrandRuntime-C8-TEWfH.js';
2
- export { a as BrandIdleRuntime, b as BrandModeRuntime, c as BrandWordmarkRuntime } from './BrandRuntime-C8-TEWfH.js';
1
+ import { M as Mode, B as BrandRuntime } from './BrandRuntime-vxA8ddzp.js';
2
+ export { a as BrandIdleRuntime, b as BrandModeRuntime, c as BrandWordmarkRuntime, d as MODES } from './BrandRuntime-vxA8ddzp.js';
3
3
 
4
4
  declare const enum MotionPreset {
5
5
  Draw = "draw",
@@ -118,12 +118,6 @@ interface Brand {
118
118
  baseDir: string;
119
119
  }
120
120
 
121
- declare const enum Mode {
122
- Light = "light",
123
- Dark = "dark"
124
- }
125
- declare const MODES: readonly Mode[];
126
-
127
121
  declare const enum CvdKind {
128
122
  Protan = "protan",
129
123
  Deutan = "deutan",
@@ -495,4 +489,4 @@ declare function pullBrand(source: string, dest: string): string;
495
489
  /** Returns why a pulled brand copy no longer matches its source (line endings ignored), or null when it matches. */
496
490
  declare function brandCopyDrift(copy: string, source: string): BrandDrift | null;
497
491
 
498
- export { type AnimationTiming, BOLD_PRESETS, type Bitmap, type Brand, type BrandDrift, BrandRuntime, 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, brandCopyDrift, buildPickPage, buildPickSpec, checkVariants, contrast, deltaE, exportBrand, fitBeat, flattenPath, generateVariants, generatorPalette, geometryModule, idleRecipe, introRecipe, introSvg, loadBrand, markSvg, microRecipe, microSvg, paletteVariants, parseBrand, parseTiming, pixelDiff, pngSize, primitiveMark, pullBrand, renderPng, renderSvg, resolveMotion, resolveRuntime, resolveToken, runChecks, runCli, schedule, simulateCvd, symbolMatches, symbolScores, totalMs, validateMotion, wordmarkReveal };
492
+ export { type AnimationTiming, BOLD_PRESETS, type Bitmap, type Brand, type BrandDrift, BrandRuntime, 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, 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, brandCopyDrift, buildPickPage, buildPickSpec, checkVariants, contrast, deltaE, exportBrand, fitBeat, flattenPath, generateVariants, generatorPalette, geometryModule, idleRecipe, introRecipe, introSvg, loadBrand, markSvg, microRecipe, microSvg, paletteVariants, parseBrand, parseTiming, pixelDiff, pngSize, primitiveMark, pullBrand, renderPng, renderSvg, resolveMotion, resolveRuntime, resolveToken, runChecks, runCli, schedule, simulateCvd, symbolMatches, symbolScores, totalMs, validateMotion, wordmarkReveal };
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BrandRuntime } from './BrandRuntime-C8-TEWfH.js';
2
- export { a as BrandIdleRuntime, b as BrandModeRuntime, c as BrandWordmarkRuntime } from './BrandRuntime-C8-TEWfH.js';
1
+ import { M as Mode, B as BrandRuntime } from './BrandRuntime-vxA8ddzp.js';
2
+ export { a as BrandIdleRuntime, b as BrandModeRuntime, c as BrandWordmarkRuntime } from './BrandRuntime-vxA8ddzp.js';
3
3
 
4
4
  interface IdleHost {
5
5
  classList: {
@@ -21,7 +21,7 @@ interface BrandHost extends IdleHost {
21
21
  innerHTML: string;
22
22
  }
23
23
  interface MountOptions {
24
- mode?: 'light' | 'dark';
24
+ mode?: Mode;
25
25
  showName?: boolean;
26
26
  idle?: IdleOptions;
27
27
  }
package/dist/runtime.js CHANGED
@@ -51,7 +51,7 @@ var REDUCED_QUERY2 = "(prefers-reduced-motion: reduce)";
51
51
  var reducedMotion2 = () => globalThis.matchMedia?.(REDUCED_QUERY2).matches === true;
52
52
  function mountBrand(host, runtime, options = {}) {
53
53
  const still = reducedMotion2();
54
- const mode = runtime[options.mode ?? "light"];
54
+ const mode = runtime[options.mode ?? "light" /* Light */];
55
55
  const showName = options.showName !== false && runtime.wordmark !== null;
56
56
  const wordmarkCss = showName ? runtime.wordmark?.css ?? "" : "";
57
57
  const css = still ? "" : `${wordmarkCss}${runtime.idle?.css ?? ""}`;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/motion/IdleRecipe.ts","../src/runtime/startIdle.ts","../src/runtime/mountBrand.ts"],"names":["REDUCED_QUERY","reducedMotion"],"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;A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,IAAA,EAAM,EAAE,UAAA,EAAY,IAAA,CAAK,YAAY,SAAA,EAAW,IAAA,CAAK,WAAW,GAAG,OAAA,CAAQ,MAAM,CAAA;AAC7J,EAAA,OAAO,MAAY;AACjB,IAAA,QAAA,EAAS;AACT,IAAA,IAAA,CAAK,SAAA,GAAY,EAAA;AAAA,EACnB,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","import type { BrandRuntime } from './BrandRuntime';\nimport { startIdle } from './startIdle';\nimport type { IdleHost, IdleOptions } from './startIdle';\n\nexport interface BrandHost extends IdleHost {\n innerHTML: string;\n}\n\nexport interface MountOptions {\n mode?: 'light' | 'dark';\n showName?: boolean;\n idle?: IdleOptions;\n}\n\ninterface MediaGlobals {\n matchMedia?: (query: string) => { matches: boolean };\n}\n\nconst REDUCED_QUERY = '(prefers-reduced-motion: reduce)';\n\nconst reducedMotion = (): boolean => (globalThis as MediaGlobals).matchMedia?.(REDUCED_QUERY).matches === true;\n\n/** Mounts the brand mark, wordmark and idle into host (the still under reduced motion) and returns unmount(). */\nexport function mountBrand(host: BrandHost, runtime: BrandRuntime, options: MountOptions = {}): () => void {\n const still = reducedMotion();\n const mode = runtime[options.mode ?? 'light'];\n const showName = options.showName !== false && runtime.wordmark !== null;\n const wordmarkCss = showName ? (runtime.wordmark?.css ?? '') : '';\n const css = still ? '' : `${wordmarkCss}${runtime.idle?.css ?? ''}`;\n const style = css !== '' ? `<style>${css}</style>` : '';\n const name = showName ? (runtime.wordmark?.html ?? '') : '';\n host.innerHTML = `${style}<span class=\"lk-brand\">${still ? mode.still : mode.intro}${name}</span>`;\n const idle = runtime.idle;\n const stopIdle = still || idle === null ? (): void => undefined : startIdle(host, { durationMs: idle.durationMs, className: idle.className, ...options.idle });\n return (): void => {\n stopIdle();\n host.innerHTML = '';\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/motion/IdleRecip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AA,OAAA,EAAU,GAAG,CAAA,QAAA,CAAA,GAAa,EAAA;AACrD,EAAA,MAAM,IAAA,GAAO,QAAA,GAAY,OAAA,CAAQ,QAAA,EAAU,QAAQ,EAAA,GAAM,EAAA;AACzD,EAAA,IAAA,CAAK,SAAA,GAAY,CAAA,EAAG,KAAK,CAAA,uBAAA,EAA0B,KAAA,GAAQ,KAAK,KAAA,GAAQ,IAAA,CAAK,KAAK,CAAA,EAAG,IAAI,CAAA,OAAA,CAAA;AACzF,EAAA,MAAM,OAAO,OAAA,CAAQ,IAAA;AACrB,EAAA,MAAM,WAAW,KAAA,IAAS,IAAA,KAAS,OAAO,MAAY,MAAA,GAAY,UAAU,IAAA,EAAM,EAAE,UAAA,EAAY,IAAA,CAAK,YAAY,SAAA,EAAW,IAAA,CAAK,WAAW,GAAG,OAAA,CAAQ,MAAM,CAAA;AAC7J,EAAA,OAAO,MAAY;AACjB,IAAA,QAAA,EAAS;AACT,IAAA,IAAA,CAAK,SAAA,GAAY,EAAA;AAAA,EACnB,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","import { Mode } from '../core/Mode';\nimport type { BrandRuntime } from './BrandRuntime';\nimport { startIdle } from './startIdle';\nimport type { IdleHost, IdleOptions } from './startIdle';\n\nexport interface BrandHost extends IdleHost {\n innerHTML: string;\n}\n\nexport interface MountOptions {\n mode?: Mode;\n showName?: boolean;\n idle?: IdleOptions;\n}\n\ninterface MediaGlobals {\n matchMedia?: (query: string) => { matches: boolean };\n}\n\nconst REDUCED_QUERY = '(prefers-reduced-motion: reduce)';\n\nconst reducedMotion = (): boolean => (globalThis as MediaGlobals).matchMedia?.(REDUCED_QUERY).matches === true;\n\n/** Mounts the brand mark, wordmark and idle into host (the still under reduced motion) and returns unmount(). */\nexport function mountBrand(host: BrandHost, runtime: BrandRuntime, options: MountOptions = {}): () => void {\n const still = reducedMotion();\n const mode = runtime[options.mode ?? Mode.Light];\n const showName = options.showName !== false && runtime.wordmark !== null;\n const wordmarkCss = showName ? (runtime.wordmark?.css ?? '') : '';\n const css = still ? '' : `${wordmarkCss}${runtime.idle?.css ?? ''}`;\n const style = css !== '' ? `<style>${css}</style>` : '';\n const name = showName ? (runtime.wordmark?.html ?? '') : '';\n host.innerHTML = `${style}<span class=\"lk-brand\">${still ? mode.still : mode.intro}${name}</span>`;\n const idle = runtime.idle;\n const stopIdle = still || idle === null ? (): void => undefined : startIdle(host, { durationMs: idle.durationMs, className: idle.className, ...options.idle });\n return (): void => {\n stopIdle();\n host.innerHTML = '';\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dloizides/logo-kit",
3
- "version": "0.4.0",
3
+ "version": "0.4.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",