@abraca/junis 2.84.0 → 2.85.0

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.
Files changed (40) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +35 -3
  3. package/dist/runtime/assets/css/jun.css +1 -1
  4. package/dist/runtime/components/JunBlobBackdrop.client.vue +1 -1
  5. package/dist/runtime/components/JunHead.vue +37 -5
  6. package/dist/runtime/components/JunLogo.vue +10 -45
  7. package/dist/runtime/components/JunPatternBackdrop.client.vue +1 -1
  8. package/dist/runtime/components/JunShaderBackdrop.client.vue +1 -1
  9. package/dist/runtime/components/renderers/JunConfigRenderer.vue +14 -14
  10. package/dist/runtime/components/renderers/JunEntryRenderer.vue +6 -8
  11. package/dist/runtime/components/renderers/JunFestivalRenderer.vue +1 -1
  12. package/dist/runtime/components/renderers/JunHomeRenderer.vue +3 -3
  13. package/dist/runtime/components/renderers/JunLiveRenderer.vue +1 -1
  14. package/dist/runtime/components/renderers/JunNowRenderer.vue +2 -2
  15. package/dist/runtime/components/renderers/JunUsesRenderer.vue +6 -8
  16. package/dist/runtime/composables/useJunOptions.d.ts +1 -0
  17. package/dist/runtime/composables/useJunTheme.js +9 -48
  18. package/dist/runtime/plugins/jun-sw.client.d.ts +2 -0
  19. package/dist/runtime/plugins/jun-sw.client.js +36 -0
  20. package/dist/runtime/server/plugins/jun-janitor.js +2 -1
  21. package/dist/runtime/server/routes/jun-icon.png.get.d.ts +2 -0
  22. package/dist/runtime/server/routes/jun-icon.png.get.js +25 -0
  23. package/dist/runtime/server/routes/jun-icon.svg.get.d.ts +2 -0
  24. package/dist/runtime/server/routes/jun-icon.svg.get.js +9 -0
  25. package/dist/runtime/server/routes/jun-splash.png.get.d.ts +2 -0
  26. package/dist/runtime/server/routes/jun-splash.png.get.js +37 -0
  27. package/dist/runtime/server/routes/jun-sw.js.get.d.ts +2 -0
  28. package/dist/runtime/server/routes/jun-sw.js.get.js +126 -0
  29. package/dist/runtime/server/routes/manifest.webmanifest.get.d.ts +24 -0
  30. package/dist/runtime/server/routes/manifest.webmanifest.get.js +51 -0
  31. package/dist/runtime/server/utils/junBrand.d.ts +4 -0
  32. package/dist/runtime/server/utils/junBrand.js +9 -0
  33. package/dist/runtime/server/utils/junIcon.d.ts +44 -0
  34. package/dist/runtime/server/utils/junIcon.js +374 -0
  35. package/dist/runtime/types.d.ts +25 -2
  36. package/dist/runtime/utils/junIdentity.d.ts +121 -0
  37. package/dist/runtime/utils/junIdentity.js +115 -0
  38. package/dist/runtime/utils/junMark.d.ts +254 -0
  39. package/dist/runtime/utils/junMark.js +169 -0
  40. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { computed } from "vue";
2
2
  import { useHead, useNuxtData } from "#app";
3
3
  import { useJunSiteConfig } from "./useJunSiteConfig.js";
4
+ import { JUN_ACCENTS, junShade, junSunColors } from "../utils/junMark.js";
4
5
  const RADIUS = {
5
6
  none: "0px",
6
7
  xs: "0.125rem",
@@ -9,22 +10,7 @@ const RADIUS = {
9
10
  lg: "0.625rem",
10
11
  xl: "1rem"
11
12
  };
12
- const ACCENT = {
13
- sun: {
14
- light: "#e08a00",
15
- dark: "#ffb800",
16
- orb: {
17
- light: { from: "#ffb800", to: "#ff9f00", glow: "#ff9f00", core: "#ffffff" },
18
- dark: { from: "#ffb800", to: "#ff9f00", glow: "#ff9f00", core: "#ffffff" }
19
- }
20
- },
21
- blue: { light: "#2563eb", dark: "#60a5fa" },
22
- emerald: { light: "#059669", dark: "#34d399" },
23
- violet: { light: "#7c3aed", dark: "#a78bfa" },
24
- amber: { light: "#d97706", dark: "#fbbf24" },
25
- rose: { light: "#e11d48", dark: "#fb7185" },
26
- teal: { light: "#0d9488", dark: "#2dd4bf" }
27
- };
13
+ const ACCENT = JUN_ACCENTS;
28
14
  const NEUTRAL = {
29
15
  slate: ["#f8fafc", "#f1f5f9", "#e2e8f0", "#cbd5e1", "#94a3b8", "#64748b", "#475569", "#334155", "#1e293b", "#0f172a", "#020617"],
30
16
  zinc: ["#fafafa", "#f4f4f5", "#e4e4e7", "#d4d4d8", "#a1a1aa", "#71717a", "#52525b", "#3f3f46", "#27272a", "#18181b", "#09090b"],
@@ -49,46 +35,21 @@ const SURFACE_CLASS = {
49
35
  solid: "jun-surface-solid"
50
36
  };
51
37
  const HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
52
- function shade(hex, amount) {
53
- const h = hex.replace("#", "");
54
- const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
55
- const n = Number.parseInt(full, 16);
56
- const to = amount > 0 ? 255 : 0;
57
- const t = Math.abs(amount);
58
- const mix = (v) => Math.round(v + (to - v) * t);
59
- const r = mix(n >> 16 & 255);
60
- const g = mix(n >> 8 & 255);
61
- const b = mix(n & 255);
62
- return `#${[r, g, b].map((v) => v.toString(16).padStart(2, "0")).join("")}`;
63
- }
64
- function luminance(hex) {
65
- const h = hex.replace("#", "");
66
- const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
67
- const n = Number.parseInt(full, 16);
68
- return ((n >> 16 & 255) * 0.299 + (n >> 8 & 255) * 0.587 + (n & 255) * 0.114) / 255;
69
- }
70
38
  function sunVars(hex, orb) {
71
- if (orb) {
72
- return [
73
- `--jun-sun-from:${orb.from}`,
74
- `--jun-sun-to:${orb.to}`,
75
- `--jun-sun-core:${orb.core ?? (luminance(orb.from) > 0.62 ? "#101013" : "#ffffff")}`,
76
- `--jun-sun-glow:${orb.glow}`
77
- ];
78
- }
79
- if (!hex) return [];
39
+ const sun = junSunColors(hex, orb);
40
+ if (!sun) return [];
80
41
  return [
81
- `--jun-sun-from:${shade(hex, 0.12)}`,
82
- `--jun-sun-to:${shade(hex, -0.08)}`,
83
- `--jun-sun-core:${luminance(hex) > 0.62 ? "#101013" : "#ffffff"}`,
84
- `--jun-sun-glow:${hex}`
42
+ `--jun-sun-from:${sun.from}`,
43
+ `--jun-sun-to:${sun.to}`,
44
+ `--jun-sun-core:${sun.core}`,
45
+ `--jun-sun-glow:${sun.glow}`
85
46
  ];
86
47
  }
87
48
  function emberVars(hex) {
88
49
  if (!hex) return [];
89
50
  return [
90
51
  `--jun-ember:${hex}`,
91
- `--jun-ember-glow:${shade(hex, 0.12)}`
52
+ `--jun-ember-glow:${junShade(hex, 0.12)}`
92
53
  ];
93
54
  }
94
55
  export function junFontClass(cfg) {
@@ -0,0 +1,2 @@
1
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
+ export default _default;
@@ -0,0 +1,36 @@
1
+ import { defineNuxtPlugin, useRuntimeConfig } from "#imports";
2
+ export default defineNuxtPlugin({
3
+ name: "jun:service-worker",
4
+ setup() {
5
+ if (import.meta.server) return;
6
+ if (!("serviceWorker" in navigator)) return;
7
+ const jun = useRuntimeConfig().public.jun;
8
+ if (jun?.pwa === false) return;
9
+ if (import.meta.dev) {
10
+ void (async () => {
11
+ try {
12
+ const regs = await navigator.serviceWorker.getRegistrations();
13
+ const ours = regs.filter((r) => (r.active?.scriptURL ?? r.installing?.scriptURL ?? "").includes("jun-sw"));
14
+ if (!ours.length) return;
15
+ await Promise.all(ours.map((r) => r.update().catch(() => {
16
+ })));
17
+ await Promise.all(ours.map((r) => r.unregister()));
18
+ const names = await caches.keys();
19
+ await Promise.all(names.filter((n) => n.startsWith("jun-")).map((n) => caches.delete(n)));
20
+ console.info(
21
+ `[jun] clearing ${ours.length} service worker(s) left over from a production build on this origin. They answer navigations from a cache and make a dev server look frozen.`
22
+ );
23
+ } catch {
24
+ }
25
+ })();
26
+ return;
27
+ }
28
+ const register = () => {
29
+ navigator.serviceWorker.register("/jun-sw.js", { scope: "/" }).catch((err) => {
30
+ console.warn("[jun] service worker registration failed:", err);
31
+ });
32
+ };
33
+ if (document.readyState === "complete") register();
34
+ else window.addEventListener("load", register, { once: true });
35
+ }
36
+ });
@@ -47,8 +47,9 @@ export default defineNitroPlugin((nitroApp) => {
47
47
  });
48
48
  async function hire(ctx, options, log) {
49
49
  const runtime = useRuntimeConfig();
50
+ const priv = runtime.abracadabra ?? {};
50
51
  const abra = runtime.public.abracadabra ?? {};
51
- const url = abra.service?.serverUrl || abra.url || "http://localhost:3011";
52
+ const url = priv.serviceServerUrl || abra.url || "http://localhost:3011";
52
53
  const actor = new JunJanitorActor({
53
54
  name: options.name ?? "janitor",
54
55
  color: options.color ?? "#8b8b8b",
@@ -0,0 +1,2 @@
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<Uint8Array<ArrayBuffer>>>;
2
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import { defineEventHandler, getQuery, setResponseHeader } from "h3";
2
+ import { junBrandIdentity, junIconScale } from "../utils/junBrand.js";
3
+ import { junRenderIcon } from "../utils/junIcon.js";
4
+ const SIZES = [32, 64, 120, 152, 167, 180, 192, 256, 384, 512];
5
+ export default defineEventHandler(async (event) => {
6
+ const q = getQuery(event);
7
+ const requested = Number.parseInt(String(q.size ?? "180"), 10);
8
+ const size = SIZES.includes(requested) ? requested : 180;
9
+ const maskable = q.maskable === "1" || q.maskable === "true";
10
+ const brand = await junBrandIdentity();
11
+ const png = await junRenderIcon({
12
+ mark: brand.mark,
13
+ size,
14
+ // A home-screen icon is not theme-aware, so it commits to ONE scheme: the
15
+ // DARK mark on the dark tile. That pairing is deliberate — the tile is the
16
+ // site's `themeColor` (near-black by default), and the light mark's ink is
17
+ // near-black too, which would render an invisible icon.
18
+ colors: brand.dark,
19
+ background: brand.tile,
20
+ scale: junIconScale(brand.mark, maskable)
21
+ });
22
+ setResponseHeader(event, "content-type", "image/png");
23
+ setResponseHeader(event, "cache-control", "public, max-age=31536000, immutable");
24
+ return new Uint8Array(png);
25
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string>>;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { defineEventHandler, setResponseHeader } from "h3";
2
+ import { junFaviconSvg } from "../../utils/junMark.js";
3
+ import { junBrandIdentity } from "../utils/junBrand.js";
4
+ export default defineEventHandler(async (event) => {
5
+ const brand = await junBrandIdentity();
6
+ setResponseHeader(event, "content-type", "image/svg+xml; charset=utf-8");
7
+ setResponseHeader(event, "cache-control", "public, max-age=31536000, immutable");
8
+ return junFaviconSvg(brand.mark, brand.light, brand.dark);
9
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<Uint8Array<ArrayBuffer>>>;
2
+ export default _default;
@@ -0,0 +1,37 @@
1
+ import { defineEventHandler, getQuery, setResponseHeader } from "h3";
2
+ import { JUN_IOS_SCREENS } from "../../utils/junIdentity.js";
3
+ import { junBrandIdentity } from "../utils/junBrand.js";
4
+ import { junRenderIcon } from "../utils/junIcon.js";
5
+ const MARK_SCALE = 0.26;
6
+ const ALLOWED = new Set(
7
+ JUN_IOS_SCREENS.flatMap(({ w, h, dpr }) => [
8
+ `${w * dpr}x${h * dpr}`,
9
+ `${h * dpr}x${w * dpr}`
10
+ ])
11
+ );
12
+ export default defineEventHandler(async (event) => {
13
+ const q = getQuery(event);
14
+ const w = Number.parseInt(String(q.w ?? ""), 10);
15
+ const h = Number.parseInt(String(q.h ?? ""), 10);
16
+ if (!ALLOWED.has(`${w}x${h}`)) {
17
+ const fallback = JUN_IOS_SCREENS[0];
18
+ return renderSplash(event, fallback.w * fallback.dpr, fallback.h * fallback.dpr);
19
+ }
20
+ return renderSplash(event, w, h);
21
+ });
22
+ async function renderSplash(event, w, h) {
23
+ const brand = await junBrandIdentity();
24
+ const png = await junRenderIcon({
25
+ mark: brand.mark,
26
+ size: w,
27
+ height: h,
28
+ // The DARK mark on the tile, same pairing as the home-screen icon — this
29
+ // image sits directly behind that icon's own launch animation.
30
+ colors: brand.dark,
31
+ background: brand.tile,
32
+ scale: MARK_SCALE
33
+ });
34
+ setResponseHeader(event, "content-type", "image/png");
35
+ setResponseHeader(event, "cache-control", "public, max-age=31536000, immutable");
36
+ return new Uint8Array(png);
37
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, string>;
2
+ export default _default;
@@ -0,0 +1,126 @@
1
+ import { defineEventHandler, setResponseHeader } from "h3";
2
+ import { useRuntimeConfig } from "nitropack/runtime";
3
+ export default defineEventHandler((event) => {
4
+ const config = useRuntimeConfig();
5
+ const jun = config.public.jun;
6
+ const build = config.app?.buildId ?? "dev";
7
+ const apiBase = jun?.apiBase ?? "/api/_jun";
8
+ setResponseHeader(event, "content-type", "text/javascript; charset=utf-8");
9
+ setResponseHeader(event, "service-worker-allowed", "/");
10
+ setResponseHeader(event, "cache-control", "no-cache");
11
+ if (import.meta.dev) {
12
+ return `/* @abraca/junis \u2014 DEV tombstone. Removes any worker left by a production build. */
13
+ self.addEventListener('install', () => self.skipWaiting())
14
+ self.addEventListener('activate', (event) => {
15
+ event.waitUntil((async () => {
16
+ const names = await caches.keys()
17
+ await Promise.all(names.filter(n => n.startsWith('jun-')).map(n => caches.delete(n)))
18
+ await self.registration.unregister()
19
+ // Reload whatever this was controlling, so the tab lands on the dev server
20
+ // rather than on the last thing the old worker cached.
21
+ const clients = await self.clients.matchAll({ type: 'window' })
22
+ for (const client of clients) client.navigate(client.url)
23
+ })())
24
+ })
25
+ `;
26
+ }
27
+ return `/* @abraca/junis service worker \u2014 generated, do not edit */
28
+ const CACHE = 'jun-${build}'
29
+ const API_BASE = ${JSON.stringify(apiBase)}
30
+
31
+ /** Immutable by construction: content-hashed, or fingerprinted in ?v=. */
32
+ function isImmutable(url) {
33
+ return url.pathname.startsWith('/_nuxt/')
34
+ || url.pathname === '/jun-icon.png'
35
+ || url.pathname === '/jun-icon.svg'
36
+ || url.pathname === '/jun-splash.png'
37
+ || url.pathname === '/apple-touch-icon.png'
38
+ }
39
+
40
+ /** Never touched: live data, and anything whose freshness is the point. */
41
+ function isPassThrough(url) {
42
+ return url.pathname.startsWith(API_BASE)
43
+ || url.pathname.startsWith('/api/')
44
+ || url.pathname.startsWith('/uploads/')
45
+ || url.pathname === '/manifest.webmanifest'
46
+ || url.pathname === '/feed.xml'
47
+ || url.pathname === '/feed.json'
48
+ || url.pathname === '/sitemap.xml'
49
+ }
50
+
51
+ self.addEventListener('install', () => {
52
+ // No precache \u2014 see the header. Take over immediately so a deploy does not
53
+ // wait for every tab to close.
54
+ self.skipWaiting()
55
+ })
56
+
57
+ self.addEventListener('activate', (event) => {
58
+ event.waitUntil((async () => {
59
+ const names = await caches.keys()
60
+ await Promise.all(names.map(n => (n !== CACHE && n.startsWith('jun-') ? caches.delete(n) : null)))
61
+ await self.clients.claim()
62
+ })())
63
+ })
64
+
65
+ self.addEventListener('message', (event) => {
66
+ if (event.data === 'jun:skip-waiting') self.skipWaiting()
67
+ })
68
+
69
+ async function networkFirst(request) {
70
+ const cache = await caches.open(CACHE)
71
+ try {
72
+ const response = await fetch(request)
73
+ // Only a real, complete answer is worth keeping. An opaque or errored
74
+ // response cached here would be served back as the offline page.
75
+ if (response && response.ok && response.type === 'basic') {
76
+ cache.put(request, response.clone())
77
+ }
78
+ return response
79
+ }
80
+ catch (err) {
81
+ const hit = await cache.match(request)
82
+ if (hit) return hit
83
+ // Nothing cached for this URL: fall back to the last page this visitor
84
+ // actually saw, so offline lands on the site rather than on a browser
85
+ // error. Still a miss for a first visit, which is correct.
86
+ const any = await cache.match('/')
87
+ if (any) return any
88
+ throw err
89
+ }
90
+ }
91
+
92
+ async function cacheFirst(request) {
93
+ const cache = await caches.open(CACHE)
94
+ const hit = await cache.match(request)
95
+ if (hit) return hit
96
+ const response = await fetch(request)
97
+ if (response && response.ok && response.type === 'basic') {
98
+ cache.put(request, response.clone())
99
+ }
100
+ return response
101
+ }
102
+
103
+ self.addEventListener('fetch', (event) => {
104
+ const request = event.request
105
+ if (request.method !== 'GET') return
106
+
107
+ let url
108
+ try { url = new URL(request.url) }
109
+ catch { return }
110
+
111
+ // Same-origin only. The CRDT backend is a different origin and its websocket
112
+ // and REST calls must never come anywhere near this.
113
+ if (url.origin !== self.location.origin) return
114
+ if (isPassThrough(url)) return
115
+
116
+ if (isImmutable(url)) {
117
+ event.respondWith(cacheFirst(request))
118
+ return
119
+ }
120
+
121
+ if (request.mode === 'navigate') {
122
+ event.respondWith(networkFirst(request))
123
+ }
124
+ })
125
+ `;
126
+ });
@@ -0,0 +1,24 @@
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
+ shortcuts?: {
3
+ name: string;
4
+ url: string;
5
+ }[] | undefined;
6
+ id: string;
7
+ name: string;
8
+ short_name: string;
9
+ description: string;
10
+ start_url: string;
11
+ scope: string;
12
+ display: string;
13
+ display_override: string[];
14
+ orientation: string;
15
+ background_color: string;
16
+ theme_color: string;
17
+ icons: {
18
+ src: string;
19
+ sizes: string;
20
+ type: string;
21
+ purpose: string;
22
+ }[];
23
+ }>>;
24
+ export default _default;
@@ -0,0 +1,51 @@
1
+ import { defineEventHandler, setResponseHeader } from "h3";
2
+ import { junDocTree, junRootDocId, junSlugMap } from "../utils/junCache.js";
3
+ import { junBrandIdentity } from "../utils/junBrand.js";
4
+ import { isJunOwnerOnlyDoc } from "../utils/junVisibility.js";
5
+ const MAX_SHORTCUTS = 4;
6
+ export default defineEventHandler(async (event) => {
7
+ const brand = await junBrandIdentity();
8
+ const v = brand.version;
9
+ const icon = (size, maskable = false) => ({
10
+ src: `/jun-icon.png?size=${size}&v=${v}${maskable ? "&maskable=1" : ""}`,
11
+ sizes: `${size}x${size}`,
12
+ type: "image/png",
13
+ purpose: maskable ? "maskable" : "any"
14
+ });
15
+ let shortcuts = [];
16
+ try {
17
+ const rootDocId = junRootDocId();
18
+ const [tree, idToSlug] = await Promise.all([junDocTree(), junSlugMap()]);
19
+ shortcuts = Object.entries(tree).filter(
20
+ ([id, e]) => !!e && !e.trashed && id !== rootDocId && (!e.parentId || e.parentId === rootDocId) && e.meta?.hidden !== true && e.meta?.draft !== true && !isJunOwnerOnlyDoc(e) && !!idToSlug[id]
21
+ ).sort(([, a], [, b]) => (a.order ?? 0) - (b.order ?? 0)).slice(0, MAX_SHORTCUTS).map(([id, e]) => ({ name: e.label || "Untitled", url: `/${idToSlug[id]}` }));
22
+ } catch {
23
+ shortcuts = [];
24
+ }
25
+ setResponseHeader(event, "content-type", "application/manifest+json; charset=utf-8");
26
+ setResponseHeader(event, "cache-control", "public, max-age=300");
27
+ return {
28
+ id: "/",
29
+ name: brand.name,
30
+ short_name: brand.shortName,
31
+ description: brand.description,
32
+ start_url: "/",
33
+ scope: "/",
34
+ display: "standalone",
35
+ // `display_override` is how a desktop install gets the tab-strip-free
36
+ // window; browsers that do not know `window-controls-overlay` fall through
37
+ // to `standalone`, which is the same thing `display` already said.
38
+ display_override: ["standalone", "minimal-ui"],
39
+ orientation: "any",
40
+ background_color: brand.themeColor,
41
+ theme_color: brand.themeColor,
42
+ icons: [
43
+ icon(192),
44
+ icon(512),
45
+ icon(512, true),
46
+ // An `any`-size vector, for the launchers that prefer one.
47
+ { src: `/jun-icon.svg?v=${v}`, sizes: "any", type: "image/svg+xml", purpose: "any" }
48
+ ],
49
+ ...shortcuts.length ? { shortcuts } : {}
50
+ };
51
+ });
@@ -0,0 +1,4 @@
1
+ import type { JunIdentity } from '../../utils/junIdentity.js';
2
+ export type { JunIdentity };
3
+ export { junIconScale, junIconUrls } from '../../utils/junIdentity.js';
4
+ export declare function junBrandIdentity(): Promise<JunIdentity>;
@@ -0,0 +1,9 @@
1
+ import { useRuntimeConfig } from "nitropack/runtime";
2
+ import { junIdentity } from "../../utils/junIdentity.js";
3
+ import { junSiteConfigMeta } from "./junCache.js";
4
+ export { junIconScale, junIconUrls } from "../../utils/junIdentity.js";
5
+ export async function junBrandIdentity() {
6
+ const jun = useRuntimeConfig().public.jun;
7
+ const cfg = await junSiteConfigMeta().catch(() => ({}));
8
+ return junIdentity(jun?.brand, cfg);
9
+ }
@@ -0,0 +1,44 @@
1
+ import type { JunMarkColors, JunMarkName } from '../../utils/junMark.js';
2
+ type Segment = [number, number, number, number];
3
+ /**
4
+ * Flatten one `d` attribute into line segments.
5
+ *
6
+ * Cubics are sampled at a fixed 24 steps. That is not adaptive, and it does not
7
+ * need to be: the largest icon is 512px and the longest curve in any mark spans
8
+ * about a third of the box, so 24 steps puts the chord error well under a
9
+ * device pixel.
10
+ */
11
+ export declare function junFlattenPath(d: string): Segment[];
12
+ export interface JunIconRequest {
13
+ mark: JunMarkName;
14
+ /** Image width in device pixels. Also the height unless one is given. */
15
+ size: number;
16
+ /** Image height. Differs only for a launch image, which is device-shaped. */
17
+ height?: number;
18
+ colors: JunMarkColors;
19
+ /** Tile colour. `null` renders on transparency. */
20
+ background?: string | null;
21
+ /**
22
+ * How much of the SHORTER side the mark fills. `1` is edge to edge — right
23
+ * for `sun`, which IS a disc. A maskable icon passes ~0.6 so the mark
24
+ * survives Android's circular crop; a launch image passes something much
25
+ * smaller, because a logo filling a phone screen is a loading spinner.
26
+ */
27
+ scale?: number;
28
+ }
29
+ /**
30
+ * Render the mark to a PNG.
31
+ *
32
+ * Supersampled 3× per axis below 256px and 2× above it — the visible quality
33
+ * ceiling is the small sizes (a 32px favicon and a 180px touch icon are where
34
+ * a jagged edge shows), while the 512 tile is displayed small enough that 2× is
35
+ * indistinguishable and four times cheaper.
36
+ *
37
+ * The mark occupies a CENTRED SQUARE of `min(width, height) × scale`, and every
38
+ * pixel outside that square is a straight fill. That is what makes a 1290×2796
39
+ * launch image cheap: the shape loop runs over the mark's own box (a few
40
+ * hundred pixels a side) rather than over three and a half million pixels of
41
+ * flat colour.
42
+ */
43
+ export declare function junRenderIcon(req: JunIconRequest): Promise<Uint8Array>;
44
+ export {};