@021.is/brand-studio 0.6.0 → 0.6.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/dist/app/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- export { BrandStudio, Navigation, buildNavigation } from '../chunk-JGLPUAM6.js';
2
+ export { BrandStudio, Navigation, buildNavigation } from '../chunk-L4FQAO3K.js';
3
3
  import '../chunk-YDZA26YU.js';
4
4
  import '../chunk-MDTU2JR5.js';
5
5
  export { contrastBadge, contrastRatio, relativeLuminance } from '../chunk-JQV3ASME.js';
@@ -204,7 +204,12 @@ function DownloadSection({
204
204
  const iconDark = findEntry(downloads, DownloadKind.Icon, DownloadMode.Dark, iconSize);
205
205
  const logoLight = findEntry(downloads, DownloadKind.Logo, DownloadMode.Light, wmHeight);
206
206
  const logoDark = findEntry(downloads, DownloadKind.Logo, DownloadMode.Dark, wmHeight);
207
- function downloadIcon(mode) {
207
+ async function downloadIcon(mode) {
208
+ const entry = mode === "light" ? iconLight : iconDark;
209
+ if (entry) {
210
+ await fetchAndSave(entry.url, entry.filename ?? lastSegment(entry.url));
211
+ return;
212
+ }
208
213
  const ref = mode === "light" ? iconLightRef : iconDarkRef;
209
214
  const svg = ref.current?.querySelector("svg");
210
215
  if (!svg) return;
@@ -218,6 +223,11 @@ function DownloadSection({
218
223
  );
219
224
  }
220
225
  async function downloadWordmark(mode) {
226
+ const entry = mode === "light" ? logoLight : logoDark;
227
+ if (entry) {
228
+ await fetchAndSave(entry.url, entry.filename ?? lastSegment(entry.url));
229
+ return;
230
+ }
221
231
  await document.fonts?.ready;
222
232
  const text = measureRef.current?.querySelector("text");
223
233
  if (!text) return;
@@ -404,6 +414,23 @@ function triggerBlobDownload(svgString, filename) {
404
414
  a.remove();
405
415
  window.setTimeout(() => URL.revokeObjectURL(url), 1e3);
406
416
  }
417
+ async function fetchAndSave(url, filename) {
418
+ try {
419
+ const res = await fetch(url, { cache: "no-store" });
420
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
421
+ const blob = await res.blob();
422
+ const objectUrl = URL.createObjectURL(blob);
423
+ const a = document.createElement("a");
424
+ a.href = objectUrl;
425
+ a.download = filename;
426
+ document.body.appendChild(a);
427
+ a.click();
428
+ a.remove();
429
+ window.setTimeout(() => URL.revokeObjectURL(objectUrl), 1e3);
430
+ } catch {
431
+ window.open(url, "_blank", "noopener,noreferrer");
432
+ }
433
+ }
407
434
  function UrlPair({ light, dark }) {
408
435
  return /* @__PURE__ */ jsxs(
409
436
  "div",
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  export { Disc, Ring, Squircle } from './chunk-LJ4HZCAP.js';
3
3
  export { AppearGrow, Drift, PulseLoop, RingDraw, Sequence, SequenceStep, Strikethrough, Sweep, Wobble } from './chunk-7325RQRP.js';
4
4
  export { LoadingMark, PulseLoadingMark, RingLoadingMark } from './chunk-F4CFQDS7.js';
5
- export { BrandStudio } from './chunk-JGLPUAM6.js';
5
+ export { BrandStudio } from './chunk-L4FQAO3K.js';
6
6
  export { SpinnerLoadingMark } from './chunk-YDZA26YU.js';
7
7
  export { STANDARD_ICON_SIZES, STANDARD_LOGO_SIZES, buildStandardDownloads, defineBrand, slugify } from './chunk-6J2NFZLN.js';
8
8
  export { BrandStudioSection, DownloadFormat, DownloadKind, DownloadMode, LoadingVariant, MotionState } from './chunk-MDTU2JR5.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@021.is/brand-studio",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Generic MD3 brand-kit toolkit: seed → full light + dark role set, composable SVG shapes + motion + loading marks, mountable <BrandStudio> /brand page, mandatory icon + logo download-URL contract. Ships no brand content — every app supplies its own logo, icons, and seed colour.",
5
5
  "license": "MIT",
6
6
  "author": {