nish-ui 1.8.0 → 2.0.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.
- package/README.md +223 -61
- package/dist/base-tailwind.css +1757 -0
- package/dist/base.css +1590 -1445
- package/dist/chart.d.ts +4 -1
- package/dist/chart.js +122 -49
- package/dist/elements-all.d.ts +8 -0
- package/dist/elements-all.js +178 -0
- package/dist/elements-charts.d.ts +124 -2
- package/dist/elements-charts.js +131 -1
- package/dist/elements-data.d.ts +166 -2
- package/dist/elements-data.js +46 -1
- package/dist/elements-forms.d.ts +71 -0
- package/dist/elements-forms.js +24 -25
- package/dist/elements.d.ts +71 -0
- package/dist/elements.js +4 -5
- package/dist/esm/chart-values.js +58 -0
- package/dist/esm/chart.js +10 -0
- package/dist/esm/cn.js +19 -0
- package/dist/esm/combobox-filter.js +13 -0
- package/dist/esm/components/accordion.js +166 -0
- package/dist/esm/components/app-shell.js +198 -0
- package/dist/esm/components/avatar-classes.js +28 -0
- package/dist/esm/components/avatar.js +113 -0
- package/dist/esm/components/breadcrumbs.js +154 -0
- package/dist/esm/components/canvas/follow-caption.js +32 -0
- package/dist/esm/components/canvas/follow.js +119 -0
- package/dist/esm/components/canvas/icons.js +70 -0
- package/dist/esm/components/canvas/index.js +10 -0
- package/dist/esm/components/canvas/layout.js +258 -0
- package/dist/esm/components/canvas/legend.js +93 -0
- package/dist/esm/components/canvas/minimap.js +127 -0
- package/dist/esm/components/canvas/node.js +87 -0
- package/dist/esm/components/canvas/route.js +262 -0
- package/dist/esm/components/canvas/system-canvas.js +837 -0
- package/dist/esm/components/canvas/types.js +10 -0
- package/dist/esm/components/canvas/view.js +47 -0
- package/dist/esm/components/chart-hooks.js +19 -0
- package/dist/esm/components/charts.js +467 -0
- package/dist/esm/components/client.js +24 -0
- package/dist/esm/components/combobox.js +343 -0
- package/dist/esm/components/command.js +403 -0
- package/dist/esm/components/data-classes.js +159 -0
- package/dist/esm/components/data.js +517 -0
- package/dist/esm/components/display-classes.js +130 -0
- package/dist/esm/components/display.js +755 -0
- package/dist/esm/components/error-boundary.js +64 -0
- package/dist/esm/components/feedback.js +136 -0
- package/dist/esm/components/file-dropzone.js +184 -0
- package/dist/esm/components/filters.js +108 -0
- package/dist/esm/components/flow.js +746 -0
- package/dist/esm/components/forms-classes.js +43 -0
- package/dist/esm/components/forms.js +581 -0
- package/dist/esm/components/hooks-classes.js +9 -0
- package/dist/esm/components/hooks.js +236 -0
- package/dist/esm/components/icons.js +96 -0
- package/dist/esm/components/inbox-classes.js +29 -0
- package/dist/esm/components/inbox.js +257 -0
- package/dist/esm/components/latest.js +13 -0
- package/dist/esm/components/layout-vars.js +96 -0
- package/dist/esm/components/layout.js +272 -0
- package/dist/esm/components/media.js +143 -0
- package/dist/esm/components/nav.js +614 -0
- package/dist/esm/components/overlay-classes.js +66 -0
- package/dist/esm/components/overlay.js +1447 -0
- package/dist/esm/components/pagination-classes.js +29 -0
- package/dist/esm/components/pagination.js +154 -0
- package/dist/esm/components/portal.js +16 -0
- package/dist/esm/components/primitives-classes.js +198 -0
- package/dist/esm/components/primitives.js +268 -0
- package/dist/esm/components/progress.js +77 -0
- package/dist/esm/components/provider.js +32 -0
- package/dist/esm/components/radio-group.js +186 -0
- package/dist/esm/components/resource-classes.js +133 -0
- package/dist/esm/components/resource.js +209 -0
- package/dist/esm/components/segmented.js +178 -0
- package/dist/esm/components/separator.js +38 -0
- package/dist/esm/components/service-tokens.js +221 -0
- package/dist/esm/components/settings.js +301 -0
- package/dist/esm/components/slider.js +262 -0
- package/dist/esm/components/split-classes.js +8 -0
- package/dist/esm/components/split.js +411 -0
- package/dist/esm/components/strings.js +119 -0
- package/dist/esm/components/table.js +144 -0
- package/dist/esm/components/tabs-classes.js +21 -0
- package/dist/esm/components/tabs.js +201 -0
- package/dist/esm/components/tag-input.js +257 -0
- package/dist/esm/components/theme-toggle.js +177 -0
- package/dist/esm/components/toast.js +361 -0
- package/dist/esm/components/url-state.js +118 -0
- package/dist/esm/components/visually-hidden.js +20 -0
- package/dist/esm/format.js +320 -0
- package/dist/esm/inbox-client.js +2 -0
- package/dist/esm/inbox-types.js +2 -0
- package/dist/esm/index.js +320 -0
- package/dist/esm/runtime.js +37 -0
- package/dist/esm/server/inbox/client.js +297 -0
- package/dist/esm/server/inbox/types.js +24 -0
- package/dist/esm/sparkline-path.js +59 -0
- package/dist/esm/split-layout.js +419 -0
- package/dist/esm/system-canvas.js +2 -0
- package/dist/esm/theme.js +804 -0
- package/dist/esm/tokens.mjs +425 -0
- package/dist/esm/url.js +20 -0
- package/dist/files.json +5 -1
- package/dist/fonts/LICENSE-Inter.txt +93 -0
- package/dist/format.d.ts +32 -18
- package/dist/format.js +227 -82
- package/dist/inbox-client.js +3 -1
- package/dist/index.d.ts +1689 -667
- package/dist/nish-components.css +4701 -3169
- package/dist/nish-components.min.css +1 -0
- package/dist/nish.css +1603 -1450
- package/dist/nish.min.css +1 -0
- package/dist/node/eslint.js +29 -14
- package/dist/node/th-check.js +29 -14
- package/dist/node/vite.d.ts +12 -0
- package/dist/node/vite.js +12 -2
- package/dist/server/hono.d.ts +15 -6
- package/dist/server/hono.js +30 -25
- package/dist/server/index.d.ts +3 -10
- package/dist/server/index.js +71 -38
- package/dist/{spa-DuVB5O7S.d.ts → spa-BLlMc0eI.d.ts} +38 -5
- package/dist/system-canvas-BLuWd69H.d.ts +183 -0
- package/dist/system-canvas.d.ts +2 -168
- package/dist/tailwind-core.css +114 -0
- package/dist/tailwind.css +3 -7
- package/dist/theme-init.js +23 -9
- package/dist/theme-init.sha256 +1 -0
- package/dist/theme.d.ts +246 -4
- package/dist/theme.global.js +357 -90
- package/dist/theme.js +338 -68
- package/dist/tokens.css +14 -6
- package/dist/tokens.dtcg.json +1513 -0
- package/dist/tokens.js +29 -14
- package/dist/tokens.json +512 -0
- package/package.json +51 -13
- package/dist/chart.js.map +0 -1
- package/dist/elements-charts.js.map +0 -1
- package/dist/elements-data.js.map +0 -1
- package/dist/elements-forms.js.map +0 -1
- package/dist/elements.js.map +0 -1
- package/dist/format.js.map +0 -1
- package/dist/inbox-client.js.map +0 -1
- package/dist/index.js +0 -10260
- package/dist/index.js.map +0 -1
- package/dist/server/hono.js.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/split-layout.js.map +0 -1
- package/dist/system-canvas.js +0 -2204
- package/dist/system-canvas.js.map +0 -1
- package/dist/theme.global.js.map +0 -1
- package/dist/theme.js.map +0 -1
package/dist/theme.global.js
CHANGED
|
@@ -82,7 +82,7 @@ var nishTheme = (() => {
|
|
|
82
82
|
var DARK_CHART = ["#8b93ff", "#34d399", "#fbbf24", "#fb7185", "#38bdf8", "#c084fc", "#fb923c", "#a3e635"];
|
|
83
83
|
var LIGHT_CHART = ["#6366f1", "#059669", "#c96d06", "#f43f5e", "#0284c7", "#a855f7", "#ea580c", "#5a910c"];
|
|
84
84
|
var chart = (list) => Object.fromEntries(list.map((c, i) => [`chart-${i + 1}`, c]));
|
|
85
|
-
var
|
|
85
|
+
var RAW_THEMES = {
|
|
86
86
|
dark: {
|
|
87
87
|
label: "Dark",
|
|
88
88
|
scheme: "dark",
|
|
@@ -93,6 +93,7 @@ var nishTheme = (() => {
|
|
|
93
93
|
overlay: "#22252f",
|
|
94
94
|
line: "#262935",
|
|
95
95
|
"line-strong": "#3a3e4d",
|
|
96
|
+
"line-control": "#666975",
|
|
96
97
|
hi: "#ececf1",
|
|
97
98
|
hi2: "#a8aab7",
|
|
98
99
|
hi3: "#8a8d9b",
|
|
@@ -119,9 +120,10 @@ var nishTheme = (() => {
|
|
|
119
120
|
overlay: "#e6e4de",
|
|
120
121
|
line: "#e2e0da",
|
|
121
122
|
"line-strong": "#c9c6bd",
|
|
123
|
+
"line-control": "#8a8881",
|
|
122
124
|
hi: "#17171c",
|
|
123
125
|
hi2: "#4f515c",
|
|
124
|
-
hi3: "#
|
|
126
|
+
hi3: "#626470",
|
|
125
127
|
ghost: "#8a8c98",
|
|
126
128
|
accent: "#4338ca",
|
|
127
129
|
accent2: "#7e22ce",
|
|
@@ -155,9 +157,10 @@ var nishTheme = (() => {
|
|
|
155
157
|
overlay: "#36363d",
|
|
156
158
|
line: "#3a3a42",
|
|
157
159
|
"line-strong": "#52525b",
|
|
160
|
+
"line-control": "#77777e",
|
|
158
161
|
hi: "#f4f4f5",
|
|
159
|
-
hi2: "#
|
|
160
|
-
hi3: "#
|
|
162
|
+
hi2: "#b8b8c0",
|
|
163
|
+
hi3: "#a0a0a8",
|
|
161
164
|
ghost: "#71717a",
|
|
162
165
|
accent: "#a5b4fc",
|
|
163
166
|
accent2: "#c084fc",
|
|
@@ -186,6 +189,7 @@ var nishTheme = (() => {
|
|
|
186
189
|
overlay: "#1c2820",
|
|
187
190
|
line: "#233028",
|
|
188
191
|
"line-strong": "#34483b",
|
|
192
|
+
"line-control": "#5c6c61",
|
|
189
193
|
hi: "#d1fae5",
|
|
190
194
|
hi2: "#8fc4a8",
|
|
191
195
|
hi3: "#74a68b",
|
|
@@ -212,9 +216,10 @@ var nishTheme = (() => {
|
|
|
212
216
|
overlay: "#44403c",
|
|
213
217
|
line: "#44403c",
|
|
214
218
|
"line-strong": "#57534e",
|
|
219
|
+
"line-control": "#83807c",
|
|
215
220
|
hi: "#f5f0eb",
|
|
216
|
-
hi2: "#
|
|
217
|
-
hi3: "#
|
|
221
|
+
hi2: "#c6c0bb",
|
|
222
|
+
hi3: "#b2ada8",
|
|
218
223
|
ghost: "#78716c",
|
|
219
224
|
accent: "#fdba74",
|
|
220
225
|
accent2: "#f472b6",
|
|
@@ -244,6 +249,7 @@ var nishTheme = (() => {
|
|
|
244
249
|
overlay: "#103658",
|
|
245
250
|
line: "#123050",
|
|
246
251
|
"line-strong": "#1f4a72",
|
|
252
|
+
"line-control": "#507291",
|
|
247
253
|
hi: "#e0f2fe",
|
|
248
254
|
hi2: "#9ccde6",
|
|
249
255
|
hi3: "#6fa9c6",
|
|
@@ -270,6 +276,7 @@ var nishTheme = (() => {
|
|
|
270
276
|
overlay: "#222222",
|
|
271
277
|
line: "#4a4a4a",
|
|
272
278
|
"line-strong": "#8a8a8a",
|
|
279
|
+
"line-control": "#8a8a8a",
|
|
273
280
|
hi: "#ffffff",
|
|
274
281
|
hi2: "#d4d4d4",
|
|
275
282
|
hi3: "#bdbdbd",
|
|
@@ -287,38 +294,218 @@ var nishTheme = (() => {
|
|
|
287
294
|
}, chart(["#ffd60a", "#4ade80", "#7dd3fc", "#ff6b6b", "#c4b5fd", "#fb923c", "#f9a8d4", "#bef264"])), DARK_HUES)
|
|
288
295
|
}
|
|
289
296
|
};
|
|
290
|
-
var
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
297
|
+
var withFills = (t) => {
|
|
298
|
+
var _a;
|
|
299
|
+
const c = t.colors;
|
|
300
|
+
const fills = Object.fromEntries(
|
|
301
|
+
["ok", "loss", "warn", "info"].flatMap((r) => {
|
|
302
|
+
var _a2, _b;
|
|
303
|
+
return [
|
|
304
|
+
[`${r}-fill`, (_a2 = c[`${r}-fill`]) != null ? _a2 : c[r]],
|
|
305
|
+
[`on-${r}`, (_b = c[`on-${r}`]) != null ? _b : c["on-accent"]]
|
|
306
|
+
];
|
|
307
|
+
})
|
|
308
|
+
);
|
|
309
|
+
return __spreadProps(__spreadValues({}, t), { colors: __spreadProps(__spreadValues(__spreadValues({}, c), fills), { "on-accent2": (_a = c["on-accent2"]) != null ? _a : c["on-accent"] }) });
|
|
310
|
+
};
|
|
311
|
+
var THEMES = /* @__PURE__ */ Object.fromEntries(
|
|
312
|
+
Object.entries(RAW_THEMES).map(([name, t]) => [name, withFills(t)])
|
|
313
|
+
);
|
|
314
|
+
var DEFAULT_THEME = "dark";
|
|
315
|
+
|
|
316
|
+
// src/runtime.ts
|
|
317
|
+
var version = true ? "2.0.0" : "dev";
|
|
318
|
+
var KEY = /* @__PURE__ */ Symbol.for("nish-ui.runtime.v1");
|
|
319
|
+
function runtime() {
|
|
320
|
+
var _a;
|
|
321
|
+
const g = globalThis;
|
|
322
|
+
return (_a = g[KEY]) != null ? _a : g[KEY] = { versions: /* @__PURE__ */ new Set(), slots: {} };
|
|
323
|
+
}
|
|
324
|
+
function register(rt) {
|
|
325
|
+
var _a, _b;
|
|
326
|
+
rt.versions.add(version);
|
|
327
|
+
if (rt.versions.size > 1 && !rt.warned && ((_b = (_a = globalThis.process) == null ? void 0 : _a.env) == null ? void 0 : _b.NODE_ENV) !== "production") {
|
|
328
|
+
rt.warned = true;
|
|
329
|
+
console.warn(
|
|
330
|
+
`nish-ui: two versions are loaded on this page (${[...rt.versions].join(", ")}). Overlays, toasts and theme state are shared, but mixing versions is unsupported.`
|
|
331
|
+
);
|
|
295
332
|
}
|
|
296
|
-
(_h = (_g = t.colors)["on-accent2"]) != null ? _h : _g["on-accent2"] = t.colors["on-accent"];
|
|
297
333
|
}
|
|
298
|
-
var
|
|
334
|
+
var registered = false;
|
|
335
|
+
function shared(key, init) {
|
|
336
|
+
const rt = runtime();
|
|
337
|
+
if (!registered) {
|
|
338
|
+
registered = true;
|
|
339
|
+
register(rt);
|
|
340
|
+
}
|
|
341
|
+
if (!(key in rt.slots)) rt.slots[key] = init();
|
|
342
|
+
return rt.slots[key];
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// src/url.ts
|
|
346
|
+
function safeUrl(href) {
|
|
347
|
+
if (href == null) return null;
|
|
348
|
+
const raw = String(href);
|
|
349
|
+
let start = 0;
|
|
350
|
+
let end = raw.length;
|
|
351
|
+
while (start < end && raw.charCodeAt(start) <= 32) start++;
|
|
352
|
+
while (end > start && raw.charCodeAt(end - 1) <= 32) end--;
|
|
353
|
+
const out = raw.slice(start, end).replace(/[\t\n\r]/g, "");
|
|
354
|
+
if (out === "") return null;
|
|
355
|
+
if (out !== out.trim()) return null;
|
|
356
|
+
if (/[\u0000-\u001f\u007f]/.test(out)) return null;
|
|
357
|
+
const m = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(out);
|
|
358
|
+
if (!m) return out;
|
|
359
|
+
const scheme = m[1].toLowerCase();
|
|
360
|
+
return scheme === "http" || scheme === "https" || scheme === "mailto" || scheme === "tel" ? out : null;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// src/components/strings.ts
|
|
364
|
+
var DEFAULT_STRINGS = {
|
|
365
|
+
close: "Close",
|
|
366
|
+
cancel: "Cancel",
|
|
367
|
+
menu: "Menu",
|
|
368
|
+
back: "Back: ",
|
|
369
|
+
dismiss: "Dismiss",
|
|
370
|
+
moreCount: (count) => `${count} more`,
|
|
371
|
+
copy: "Copy",
|
|
372
|
+
copied: "Copied",
|
|
373
|
+
hubTitle: "Back to nish.software",
|
|
374
|
+
hubLabel: "\u2190 nish.software",
|
|
375
|
+
moreActions: "More actions",
|
|
376
|
+
more: "More",
|
|
377
|
+
legend: "Legend",
|
|
378
|
+
optional: "Optional",
|
|
379
|
+
search: "Search",
|
|
380
|
+
clearSearch: "Clear search",
|
|
381
|
+
remove: "Remove",
|
|
382
|
+
removeNamed: (name) => `Remove ${name}`,
|
|
383
|
+
noMatches: "No matches",
|
|
384
|
+
clear: "Clear",
|
|
385
|
+
searching: "Searching\u2026",
|
|
386
|
+
searchPlaceholder: "Search\u2026",
|
|
387
|
+
noResults: "No results",
|
|
388
|
+
results: "Results",
|
|
389
|
+
loading: "Loading",
|
|
390
|
+
failedToLoad: "Failed to load",
|
|
391
|
+
retry: "Retry",
|
|
392
|
+
actions: "Actions",
|
|
393
|
+
offline: "You're offline",
|
|
394
|
+
nothingHere: "Nothing here yet",
|
|
395
|
+
loadingNamed: (label) => `Loading ${label}`,
|
|
396
|
+
sortBy: "Sort by",
|
|
397
|
+
sortDefault: "Default",
|
|
398
|
+
noData: "No data",
|
|
399
|
+
noDataNamed: (label) => `${label}: no data`,
|
|
400
|
+
filters: "Filters",
|
|
401
|
+
clearFilters: "Clear filters",
|
|
402
|
+
done: "Done",
|
|
403
|
+
activeCount: (n) => `${n} active`,
|
|
404
|
+
newCount: (value) => `${value} new`,
|
|
405
|
+
sections: "Sections",
|
|
406
|
+
theme: "Theme",
|
|
407
|
+
sidebar: "Sidebar",
|
|
408
|
+
expandSidebar: "Expand sidebar",
|
|
409
|
+
collapseSidebar: "Collapse sidebar",
|
|
410
|
+
skipToContent: "Skip to content",
|
|
411
|
+
themeSystem: "System",
|
|
412
|
+
themeLight: "Light",
|
|
413
|
+
themeDark: "Dark",
|
|
414
|
+
themeToggleLabel: (current, next) => `Theme: ${current}. Switch to ${next}`,
|
|
415
|
+
themePreset: "Theme preset",
|
|
416
|
+
themePresetPlaceholder: "Preset\u2026",
|
|
417
|
+
errorStaleTitle: "A new version is available",
|
|
418
|
+
errorStaleBody: "Reload the page to get the latest version.",
|
|
419
|
+
errorTitle: "Something went wrong",
|
|
420
|
+
errorBody: "An unexpected error occurred.",
|
|
421
|
+
errorDetails: "Details",
|
|
422
|
+
errorTryAgain: "Try again",
|
|
423
|
+
errorReload: "Reload page",
|
|
424
|
+
saving: "Saving\u2026",
|
|
425
|
+
saved: "Saved",
|
|
426
|
+
saveFailed: "Could not save",
|
|
427
|
+
enterNumber: "Enter a number",
|
|
428
|
+
resizeColumns: "Resize columns",
|
|
429
|
+
resizeRows: "Resize rows",
|
|
430
|
+
layoutPresets: "Layout presets",
|
|
431
|
+
live: "Live",
|
|
432
|
+
offlineBadge: "Offline",
|
|
433
|
+
progress: "Progress",
|
|
434
|
+
workflow: "Workflow",
|
|
435
|
+
activity: "Activity",
|
|
436
|
+
other: "Other",
|
|
437
|
+
waiting: "Waiting",
|
|
438
|
+
noActivity: "No activity yet",
|
|
439
|
+
systemMap: "System map",
|
|
440
|
+
zoomOut: "Zoom out",
|
|
441
|
+
zoomIn: "Zoom in",
|
|
442
|
+
fitToScreen: "Fit to screen",
|
|
443
|
+
followActivity: "Follow activity",
|
|
444
|
+
canvasLines: "Lines",
|
|
445
|
+
serviceTokens: "Service tokens",
|
|
446
|
+
serviceTokensIntro: "Machine clients, like the nish MCP server, use these tokens to read this app. Revoking one stops it at once.",
|
|
447
|
+
loadingServiceTokens: "Loading service tokens",
|
|
448
|
+
tokenRevoke: "Revoke",
|
|
449
|
+
tokenRevoked: "Revoked",
|
|
450
|
+
tokenRevokedAt: (when) => `Revoked ${when}`,
|
|
451
|
+
tokenRevokeNamed: (name) => `Revoke ${name}`,
|
|
452
|
+
tokenRevokeTitle: (name) => `Revoke ${name}?`,
|
|
453
|
+
tokenRevokeFailed: "Could not revoke the token.",
|
|
454
|
+
inboxMarkHandled: "Mark handled",
|
|
455
|
+
inboxSnooze: "Snooze",
|
|
456
|
+
inboxActions: "Actions",
|
|
457
|
+
inboxViews: "Inbox views",
|
|
458
|
+
inboxOpen: "Open",
|
|
459
|
+
inboxSnoozed: "Snoozed",
|
|
460
|
+
inboxHandled: "Handled",
|
|
461
|
+
inboxFilterBySource: "Filter by source",
|
|
462
|
+
inboxHappened: (count) => `Happened ${count} times`,
|
|
463
|
+
previousPage: "Previous page",
|
|
464
|
+
nextPage: "Next page",
|
|
465
|
+
pageLabel: (n) => `Page ${n}`,
|
|
466
|
+
paginationLabel: "Pagination",
|
|
467
|
+
breadcrumbs: "Breadcrumbs",
|
|
468
|
+
removeTag: (tag) => `Remove ${tag}`,
|
|
469
|
+
dropzoneLabel: "Drop files here or browse",
|
|
470
|
+
browseFiles: "Browse files",
|
|
471
|
+
removeFile: (name) => `Remove ${name}`,
|
|
472
|
+
avatar: "Avatar",
|
|
473
|
+
avatarMore: (count) => `${count} more`,
|
|
474
|
+
sliderMin: "Minimum",
|
|
475
|
+
sliderMax: "Maximum",
|
|
476
|
+
accordion: "Accordion",
|
|
477
|
+
progressIndeterminate: "Loading"
|
|
478
|
+
};
|
|
299
479
|
|
|
300
480
|
// src/theme.ts
|
|
301
|
-
var
|
|
302
|
-
id,
|
|
303
|
-
label: THEMES[id].label,
|
|
304
|
-
scheme: THEMES[id].scheme,
|
|
305
|
-
colors: THEMES[id].colors
|
|
306
|
-
}));
|
|
307
|
-
var KEY = "nish-theme";
|
|
481
|
+
var DEFAULT_KEY = "nish-theme";
|
|
308
482
|
var SHARED_DOMAIN = "nish.software";
|
|
309
483
|
var ONE_YEAR = 60 * 60 * 24 * 365;
|
|
310
|
-
var
|
|
484
|
+
var state = () => shared("theme", () => ({ extra: {}, listeners: /* @__PURE__ */ new Set(), watching: false, switchId: 0 }));
|
|
485
|
+
var warn = (msg) => {
|
|
486
|
+
var _a, _b;
|
|
487
|
+
if (((_b = (_a = globalThis.process) == null ? void 0 : _a.env) == null ? void 0 : _b.NODE_ENV) !== "production") console.warn(`nish-ui: ${msg}`);
|
|
488
|
+
};
|
|
489
|
+
function storageKey() {
|
|
490
|
+
if (typeof document === "undefined") return DEFAULT_KEY;
|
|
491
|
+
const k = document.documentElement.getAttribute("data-nish-storage-key");
|
|
492
|
+
return k && /^[A-Za-z0-9_-]+$/.test(k) ? k : DEFAULT_KEY;
|
|
493
|
+
}
|
|
311
494
|
function registerThemes(themes) {
|
|
312
|
-
Object.assign(extra, themes);
|
|
495
|
+
Object.assign(state().extra, themes);
|
|
313
496
|
}
|
|
314
497
|
var has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
|
315
498
|
function isThemeName(v) {
|
|
316
|
-
return typeof v === "string" && (has(THEMES, v) || has(extra, v));
|
|
499
|
+
return typeof v === "string" && (has(THEMES, v) || has(state().extra, v));
|
|
317
500
|
}
|
|
318
501
|
function readCookie() {
|
|
319
502
|
if (typeof document === "undefined") return null;
|
|
320
|
-
|
|
321
|
-
|
|
503
|
+
try {
|
|
504
|
+
const m = document.cookie.match(new RegExp(`(?:^|;\\s*)${storageKey()}=([a-z0-9-]+)`));
|
|
505
|
+
return m ? m[1] : null;
|
|
506
|
+
} catch (e) {
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
322
509
|
}
|
|
323
510
|
var covers = (domain, host) => host === domain || host.endsWith("." + domain);
|
|
324
511
|
function cookieDomain(host, attr) {
|
|
@@ -332,10 +519,10 @@ var nishTheme = (() => {
|
|
|
332
519
|
return cookieDomain(location.hostname, document.documentElement.getAttribute("data-nish-domain"));
|
|
333
520
|
}
|
|
334
521
|
function getThemeChoice() {
|
|
335
|
-
var
|
|
522
|
+
var _a;
|
|
336
523
|
let v = null;
|
|
337
524
|
try {
|
|
338
|
-
v = (
|
|
525
|
+
v = (_a = readCookie()) != null ? _a : localStorage.getItem(storageKey());
|
|
339
526
|
} catch (e) {
|
|
340
527
|
}
|
|
341
528
|
return v === "system" || isThemeName(v) ? v : "system";
|
|
@@ -355,29 +542,49 @@ var nishTheme = (() => {
|
|
|
355
542
|
return theme;
|
|
356
543
|
}
|
|
357
544
|
function schemeOf(theme) {
|
|
358
|
-
|
|
359
|
-
return has(THEMES, theme) ? THEMES[theme].scheme : (
|
|
545
|
+
const { extra } = state();
|
|
546
|
+
return has(THEMES, theme) ? THEMES[theme].scheme : has(extra, theme) ? extra[theme] : "dark";
|
|
360
547
|
}
|
|
361
548
|
function applyTheme(choice = getThemeChoice()) {
|
|
362
549
|
const theme = resolveTheme(choice);
|
|
363
550
|
const root = document.documentElement;
|
|
551
|
+
const previous = root.getAttribute("data-theme");
|
|
552
|
+
if (previous && previous !== theme) suspendTransitions(root);
|
|
364
553
|
root.setAttribute("data-theme", theme);
|
|
365
554
|
root.setAttribute("data-scheme", schemeOf(theme));
|
|
366
555
|
root.setAttribute("data-theme-choice", choice);
|
|
367
556
|
root.style.colorScheme = schemeOf(theme);
|
|
368
557
|
syncChromeColor();
|
|
369
|
-
listeners.forEach((fn) => fn(choice, theme));
|
|
558
|
+
state().listeners.forEach((fn) => fn(choice, theme));
|
|
370
559
|
return theme;
|
|
371
560
|
}
|
|
561
|
+
function suspendTransitions(root) {
|
|
562
|
+
const st = state();
|
|
563
|
+
const id = ++st.switchId;
|
|
564
|
+
root.setAttribute("data-nish-theme-switching", "");
|
|
565
|
+
const done = () => {
|
|
566
|
+
if (st.switchId === id) root.removeAttribute("data-nish-theme-switching");
|
|
567
|
+
};
|
|
568
|
+
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => requestAnimationFrame(done));
|
|
569
|
+
else setTimeout(done, 32);
|
|
570
|
+
}
|
|
372
571
|
function setThemeChoice(choice) {
|
|
572
|
+
if (choice !== "system" && !isThemeName(choice)) {
|
|
573
|
+
warn(`unknown theme "${String(choice)}" ignored. Register it with registerThemes() first.`);
|
|
574
|
+
return resolveTheme(getThemeChoice());
|
|
575
|
+
}
|
|
576
|
+
const key = storageKey();
|
|
373
577
|
try {
|
|
374
|
-
localStorage.setItem(
|
|
578
|
+
localStorage.setItem(key, choice);
|
|
375
579
|
} catch (e) {
|
|
376
580
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
581
|
+
try {
|
|
582
|
+
const domain = sharedDomain();
|
|
583
|
+
if (domain) {
|
|
584
|
+
const secure = location.protocol === "https:" ? "; Secure" : "";
|
|
585
|
+
document.cookie = `${key}=${choice}; Domain=.${domain}; Path=/; Max-Age=${ONE_YEAR}; SameSite=Lax${secure}`;
|
|
586
|
+
}
|
|
587
|
+
} catch (e) {
|
|
381
588
|
}
|
|
382
589
|
return applyTheme(choice);
|
|
383
590
|
}
|
|
@@ -385,28 +592,29 @@ var nishTheme = (() => {
|
|
|
385
592
|
return getComputedStyle(document.documentElement).getPropertyValue(`--nish-${name}`).trim();
|
|
386
593
|
}
|
|
387
594
|
function syncChromeColor() {
|
|
595
|
+
var _a;
|
|
388
596
|
const bg = readToken("bg");
|
|
389
597
|
if (!bg) return;
|
|
390
|
-
let meta = document.querySelector('meta[name="theme-color"]');
|
|
598
|
+
let meta = (_a = document.querySelector('meta[name="theme-color"][data-nish]')) != null ? _a : document.querySelector('meta[name="theme-color"]:not([media]):not([data-nish-keep])');
|
|
391
599
|
if (!meta) {
|
|
392
600
|
meta = document.createElement("meta");
|
|
393
601
|
meta.name = "theme-color";
|
|
394
|
-
document.head.appendChild(meta);
|
|
602
|
+
(document.head || document.documentElement).appendChild(meta);
|
|
395
603
|
}
|
|
604
|
+
meta.setAttribute("data-nish", "");
|
|
396
605
|
meta.content = bg;
|
|
397
606
|
}
|
|
398
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
399
|
-
var watching = false;
|
|
400
607
|
function watch() {
|
|
401
|
-
|
|
402
|
-
watching
|
|
608
|
+
const st = state();
|
|
609
|
+
if (st.watching || typeof window === "undefined") return;
|
|
610
|
+
st.watching = true;
|
|
403
611
|
const reapply = () => {
|
|
404
612
|
const choice = getThemeChoice();
|
|
405
613
|
if (choice !== document.documentElement.getAttribute("data-theme-choice") || choice === "system") applyTheme(choice);
|
|
406
614
|
};
|
|
407
|
-
matchMedia("(prefers-color-scheme: light)").addEventListener("change", reapply);
|
|
615
|
+
if (typeof matchMedia === "function") matchMedia("(prefers-color-scheme: light)").addEventListener("change", reapply);
|
|
408
616
|
window.addEventListener("storage", (e) => {
|
|
409
|
-
if (e.key ===
|
|
617
|
+
if (e.key === storageKey()) reapply();
|
|
410
618
|
});
|
|
411
619
|
document.addEventListener("visibilitychange", () => {
|
|
412
620
|
if (document.visibilityState === "visible") reapply();
|
|
@@ -414,8 +622,11 @@ var nishTheme = (() => {
|
|
|
414
622
|
}
|
|
415
623
|
function onThemeChange(fn) {
|
|
416
624
|
watch();
|
|
625
|
+
const { listeners } = state();
|
|
417
626
|
listeners.add(fn);
|
|
418
|
-
return () =>
|
|
627
|
+
return () => {
|
|
628
|
+
listeners.delete(fn);
|
|
629
|
+
};
|
|
419
630
|
}
|
|
420
631
|
var TOGGLE_ORDER = ["system", "light", "dark"];
|
|
421
632
|
function cycleTheme() {
|
|
@@ -423,12 +634,46 @@ var nishTheme = (() => {
|
|
|
423
634
|
setThemeChoice(next);
|
|
424
635
|
return next;
|
|
425
636
|
}
|
|
637
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
638
|
+
function svgIcon(size, shapes, attrs = {}) {
|
|
639
|
+
const el = document.createElementNS(SVG_NS, "svg");
|
|
640
|
+
const all = __spreadValues({
|
|
641
|
+
width: String(size),
|
|
642
|
+
height: String(size),
|
|
643
|
+
viewBox: "0 0 24 24",
|
|
644
|
+
fill: "none",
|
|
645
|
+
stroke: "currentColor",
|
|
646
|
+
"stroke-width": "2",
|
|
647
|
+
"stroke-linecap": "round",
|
|
648
|
+
"stroke-linejoin": "round",
|
|
649
|
+
"aria-hidden": "true",
|
|
650
|
+
focusable: "false"
|
|
651
|
+
}, attrs);
|
|
652
|
+
for (const k of Object.keys(all)) el.setAttribute(k, all[k]);
|
|
653
|
+
for (const [tag, a] of shapes) {
|
|
654
|
+
const child = document.createElementNS(SVG_NS, tag);
|
|
655
|
+
for (const k of Object.keys(a)) child.setAttribute(k, a[k]);
|
|
656
|
+
el.appendChild(child);
|
|
657
|
+
}
|
|
658
|
+
return el;
|
|
659
|
+
}
|
|
426
660
|
var TOGGLE_ICONS = {
|
|
427
|
-
system:
|
|
428
|
-
|
|
429
|
-
|
|
661
|
+
system: [
|
|
662
|
+
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }],
|
|
663
|
+
["path", { d: "M8 21h8M12 17v4" }]
|
|
664
|
+
],
|
|
665
|
+
light: [
|
|
666
|
+
["circle", { cx: "12", cy: "12", r: "4" }],
|
|
667
|
+
["path", { d: "M12 2v2M12 20v2m-7.07-2.93 1.41-1.41M17.66 6.34l1.41-1.41M2 12h2m16 0h2M4.93 4.93l1.41 1.41m11.32 11.32 1.41 1.41" }]
|
|
668
|
+
],
|
|
669
|
+
dark: [["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9" }]]
|
|
430
670
|
};
|
|
431
|
-
var
|
|
671
|
+
var defaultToggleLabels = () => ({
|
|
672
|
+
system: DEFAULT_STRINGS.themeSystem,
|
|
673
|
+
light: DEFAULT_STRINGS.themeLight,
|
|
674
|
+
dark: DEFAULT_STRINGS.themeDark
|
|
675
|
+
});
|
|
676
|
+
var DEFAULT_ELSEWHERE = "set on another site";
|
|
432
677
|
function nextChoice(choice) {
|
|
433
678
|
const i = TOGGLE_ORDER.indexOf(choice);
|
|
434
679
|
return TOGGLE_ORDER[(i + 1) % TOGGLE_ORDER.length];
|
|
@@ -439,11 +684,21 @@ var nishTheme = (() => {
|
|
|
439
684
|
return choice.charAt(0).toUpperCase() + choice.slice(1);
|
|
440
685
|
}
|
|
441
686
|
function mountThemeToggle(button, opts = {}) {
|
|
442
|
-
|
|
687
|
+
var _a, _b, _c;
|
|
688
|
+
const words = __spreadValues(__spreadValues({}, defaultToggleLabels()), opts.labels);
|
|
689
|
+
const sentence = (_b = (_a = opts.strings) == null ? void 0 : _a.themeToggleLabel) != null ? _b : DEFAULT_STRINGS.themeToggleLabel;
|
|
690
|
+
const elsewhereWords = (_c = opts.elsewhereLabel) != null ? _c : DEFAULT_ELSEWHERE;
|
|
443
691
|
if (button.tagName === "BUTTON" && !button.getAttribute("type")) button.setAttribute("type", "button");
|
|
444
|
-
|
|
445
|
-
(id) =>
|
|
446
|
-
)
|
|
692
|
+
const children = Object.keys(TOGGLE_ICONS).map(
|
|
693
|
+
(id) => svgIcon(16, TOGGLE_ICONS[id], { "data-icon": id })
|
|
694
|
+
);
|
|
695
|
+
if (opts.showLabel) {
|
|
696
|
+
const w = document.createElement("span");
|
|
697
|
+
w.setAttribute("data-theme-word", "");
|
|
698
|
+
w.setAttribute("aria-hidden", "true");
|
|
699
|
+
children.push(w);
|
|
700
|
+
}
|
|
701
|
+
button.replaceChildren(...children);
|
|
447
702
|
const word = button.querySelector("[data-theme-word]");
|
|
448
703
|
const render = (choice) => {
|
|
449
704
|
const icon = choice === "system" || choice === "light" || choice === "dark" ? choice : schemeOf(choice);
|
|
@@ -452,8 +707,8 @@ var nishTheme = (() => {
|
|
|
452
707
|
if (svg.getAttribute("data-icon") === icon) svg.removeAttribute("display");
|
|
453
708
|
else svg.setAttribute("display", "none");
|
|
454
709
|
});
|
|
455
|
-
const elsewhere = TOGGLE_ORDER.includes(choice) ? "" :
|
|
456
|
-
const label =
|
|
710
|
+
const elsewhere = TOGGLE_ORDER.includes(choice) ? "" : ` (${elsewhereWords})`;
|
|
711
|
+
const label = sentence(`${themeLabel(choice, words)}${elsewhere}`, themeLabel(nextChoice(choice), words));
|
|
457
712
|
button.setAttribute("aria-label", label);
|
|
458
713
|
button.setAttribute("title", label);
|
|
459
714
|
if (word) word.textContent = themeLabel(choice, words);
|
|
@@ -469,18 +724,29 @@ var nishTheme = (() => {
|
|
|
469
724
|
off();
|
|
470
725
|
};
|
|
471
726
|
}
|
|
472
|
-
var
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
727
|
+
var TRIANGLE = [
|
|
728
|
+
["path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }],
|
|
729
|
+
["path", { d: "M12 9v4M12 17h.01" }]
|
|
730
|
+
];
|
|
731
|
+
var INFO = [
|
|
732
|
+
["circle", { cx: "12", cy: "12", r: "10" }],
|
|
733
|
+
["path", { d: "M12 16v-4M12 8h.01" }]
|
|
734
|
+
];
|
|
735
|
+
var TOAST_ICONS = {
|
|
736
|
+
neutral: INFO,
|
|
737
|
+
info: INFO,
|
|
738
|
+
ok: [
|
|
739
|
+
["circle", { cx: "12", cy: "12", r: "10" }],
|
|
740
|
+
["path", { d: "m9 12 2 2 4-4" }]
|
|
741
|
+
],
|
|
742
|
+
warn: TRIANGLE,
|
|
743
|
+
loss: TRIANGLE
|
|
478
744
|
};
|
|
479
745
|
var TOAST_MS = 6e3;
|
|
480
746
|
var toastRegion = null;
|
|
481
747
|
var hideCurrent = null;
|
|
482
748
|
function showToast(content, opts = {}) {
|
|
483
|
-
var
|
|
749
|
+
var _a, _b, _c, _d, _e;
|
|
484
750
|
hideCurrent == null ? void 0 : hideCurrent();
|
|
485
751
|
if (!toastRegion || !toastRegion.isConnected) {
|
|
486
752
|
toastRegion = document.createElement("div");
|
|
@@ -495,14 +761,14 @@ var nishTheme = (() => {
|
|
|
495
761
|
const icon = document.createElement("span");
|
|
496
762
|
icon.className = "nish-toast-icon";
|
|
497
763
|
icon.setAttribute("aria-hidden", "true");
|
|
498
|
-
icon.
|
|
764
|
+
icon.append(svgIcon(15, TOAST_ICONS[(_a = opts.tone) != null ? _a : "neutral"]));
|
|
499
765
|
box.append(icon);
|
|
500
766
|
const body = document.createElement("p");
|
|
501
767
|
body.className = "nish-toast-body";
|
|
502
768
|
body.append(typeof content === "string" ? document.createTextNode(content) : content);
|
|
503
769
|
box.append(body);
|
|
504
770
|
let timer = null;
|
|
505
|
-
let remaining = opts.duration === "sticky" ? Infinity : (
|
|
771
|
+
let remaining = opts.duration === "sticky" ? Infinity : (_b = opts.duration) != null ? _b : TOAST_MS;
|
|
506
772
|
let started = 0;
|
|
507
773
|
let holds = 0;
|
|
508
774
|
const hide = () => {
|
|
@@ -528,16 +794,17 @@ var nishTheme = (() => {
|
|
|
528
794
|
holds -= 1;
|
|
529
795
|
if (holds === 0) run(Math.max(remaining, 1e3));
|
|
530
796
|
};
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
797
|
+
const action = opts.action;
|
|
798
|
+
const href = (action == null ? void 0 : action.href) != null ? safeUrl(action.href) : null;
|
|
799
|
+
if (action && (action.href == null || href != null)) {
|
|
800
|
+
const el = document.createElement(action.href != null ? "a" : "button");
|
|
534
801
|
el.className = "nish-toast-action";
|
|
535
|
-
el.textContent =
|
|
536
|
-
if (
|
|
802
|
+
el.textContent = action.label;
|
|
803
|
+
if (href != null) el.href = href;
|
|
537
804
|
else el.type = "button";
|
|
538
805
|
el.addEventListener("click", () => {
|
|
539
|
-
var
|
|
540
|
-
(
|
|
806
|
+
var _a2;
|
|
807
|
+
(_a2 = action.onClick) == null ? void 0 : _a2.call(action);
|
|
541
808
|
hide();
|
|
542
809
|
});
|
|
543
810
|
box.append(el);
|
|
@@ -545,8 +812,8 @@ var nishTheme = (() => {
|
|
|
545
812
|
const close = document.createElement("button");
|
|
546
813
|
close.type = "button";
|
|
547
814
|
close.className = "nish-toast-close";
|
|
548
|
-
close.setAttribute("aria-label", (
|
|
549
|
-
close.
|
|
815
|
+
close.setAttribute("aria-label", (_e = (_d = opts.dismissLabel) != null ? _d : (_c = opts.strings) == null ? void 0 : _c.dismiss) != null ? _e : DEFAULT_STRINGS.dismiss);
|
|
816
|
+
close.append(svgIcon(14, [["path", { d: "M18 6 6 18M6 6l12 12" }]]));
|
|
550
817
|
close.addEventListener("click", hide);
|
|
551
818
|
box.append(close);
|
|
552
819
|
box.addEventListener("pointerenter", (e) => e.pointerType === "mouse" && pause());
|
|
@@ -566,7 +833,7 @@ var nishTheme = (() => {
|
|
|
566
833
|
}
|
|
567
834
|
var dialogSeq = 0;
|
|
568
835
|
function confirmDialog(opts) {
|
|
569
|
-
var
|
|
836
|
+
var _a, _b, _c, _d;
|
|
570
837
|
if (typeof document === "undefined") return Promise.resolve(false);
|
|
571
838
|
const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
572
839
|
const id = `nish-dialog-${++dialogSeq}`;
|
|
@@ -596,8 +863,8 @@ var nishTheme = (() => {
|
|
|
596
863
|
b.textContent = label;
|
|
597
864
|
return b;
|
|
598
865
|
};
|
|
599
|
-
const cancelBtn = button((
|
|
600
|
-
const confirmBtn = button((
|
|
866
|
+
const cancelBtn = button((_c = (_b = opts.cancelLabel) != null ? _b : (_a = opts.strings) == null ? void 0 : _a.cancel) != null ? _c : DEFAULT_STRINGS.cancel, "nish-btn");
|
|
867
|
+
const confirmBtn = button((_d = opts.confirmLabel) != null ? _d : "Confirm", `nish-btn ${danger ? "nish-btn--danger" : "nish-btn--primary"}`);
|
|
601
868
|
(danger ? cancelBtn : confirmBtn).autofocus = true;
|
|
602
869
|
actions.append(cancelBtn, confirmBtn);
|
|
603
870
|
dialog.append(actions);
|
|
@@ -634,12 +901,12 @@ var nishTheme = (() => {
|
|
|
634
901
|
function mountTooltips(root = document) {
|
|
635
902
|
if (typeof document === "undefined") return () => void 0;
|
|
636
903
|
root.querySelectorAll(".nish-tooltip").forEach((t) => {
|
|
637
|
-
var
|
|
904
|
+
var _a;
|
|
638
905
|
const tip = t.querySelector(":scope > .nish-tooltip-content");
|
|
639
906
|
if (!tip) return;
|
|
640
907
|
if (!tip.getAttribute("role")) tip.setAttribute("role", "tooltip");
|
|
641
908
|
if (!tip.id) tip.id = `nish-tip-${++dialogSeq}`;
|
|
642
|
-
const ids = ((
|
|
909
|
+
const ids = ((_a = t.getAttribute("aria-describedby")) != null ? _a : "").split(/\s+/).filter(Boolean);
|
|
643
910
|
if (!ids.includes(tip.id)) t.setAttribute("aria-describedby", [...ids, tip.id].join(" "));
|
|
644
911
|
});
|
|
645
912
|
const trigger = (e) => e.target instanceof Element ? e.target.closest(".nish-tooltip") : null;
|
|
@@ -718,7 +985,7 @@ var nishTheme = (() => {
|
|
|
718
985
|
let velocity = 0;
|
|
719
986
|
let height = 1;
|
|
720
987
|
const onDown = (e) => {
|
|
721
|
-
var
|
|
988
|
+
var _a;
|
|
722
989
|
if (e.pointerType === "mouse" || closing || !e.isPrimary) return;
|
|
723
990
|
if (typeof matchMedia !== "undefined" && matchMedia("(min-width: 640px)").matches) return;
|
|
724
991
|
const r = dialog.getBoundingClientRect();
|
|
@@ -730,7 +997,7 @@ var nishTheme = (() => {
|
|
|
730
997
|
velocity = 0;
|
|
731
998
|
height = r.height || 1;
|
|
732
999
|
dialog.style.transition = "none";
|
|
733
|
-
(
|
|
1000
|
+
(_a = dialog.setPointerCapture) == null ? void 0 : _a.call(dialog, e.pointerId);
|
|
734
1001
|
};
|
|
735
1002
|
const onMove = (e) => {
|
|
736
1003
|
if (!dragging) return;
|
|
@@ -742,10 +1009,10 @@ var nishTheme = (() => {
|
|
|
742
1009
|
dialog.style.transform = `translateY(${dy >= 0 ? dy : dy * 0.3}px)`;
|
|
743
1010
|
};
|
|
744
1011
|
const onUp = (e) => {
|
|
745
|
-
var
|
|
1012
|
+
var _a;
|
|
746
1013
|
if (!dragging) return;
|
|
747
1014
|
dragging = false;
|
|
748
|
-
(
|
|
1015
|
+
(_a = dialog.releasePointerCapture) == null ? void 0 : _a.call(dialog, e.pointerId);
|
|
749
1016
|
const dy = e.clientY - startY;
|
|
750
1017
|
if (e.type !== "pointercancel" && (dy > height * 0.3 || velocity > 0.5)) {
|
|
751
1018
|
closeNow();
|
|
@@ -865,7 +1132,7 @@ var nishTheme = (() => {
|
|
|
865
1132
|
return null;
|
|
866
1133
|
}
|
|
867
1134
|
};
|
|
868
|
-
const unheight = mountHeightVar(nav, "--nish-sticky-extra");
|
|
1135
|
+
const unheight = o.height === false ? () => void 0 : mountHeightVar(nav, "--nish-sticky-extra");
|
|
869
1136
|
let current = null;
|
|
870
1137
|
const edges = () => {
|
|
871
1138
|
const max = nav.scrollWidth - nav.clientWidth;
|
|
@@ -888,10 +1155,10 @@ var nishTheme = (() => {
|
|
|
888
1155
|
}
|
|
889
1156
|
};
|
|
890
1157
|
const update = () => {
|
|
891
|
-
var
|
|
1158
|
+
var _a, _b;
|
|
892
1159
|
const header = parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--nish-header-h")) || 0;
|
|
893
|
-
const line = (
|
|
894
|
-
let found = (
|
|
1160
|
+
const line = (_a = o.offset) != null ? _a : header + nav.offsetHeight + 8;
|
|
1161
|
+
let found = (_b = links[0]) != null ? _b : null;
|
|
895
1162
|
for (const a of links) {
|
|
896
1163
|
const t = target(a);
|
|
897
1164
|
if (t && t.getBoundingClientRect().top <= line + 1) found = a;
|
|
@@ -942,13 +1209,13 @@ var nishTheme = (() => {
|
|
|
942
1209
|
};
|
|
943
1210
|
}
|
|
944
1211
|
function mountChecklist(list) {
|
|
945
|
-
var
|
|
1212
|
+
var _a, _b, _c;
|
|
946
1213
|
if (typeof document === "undefined") return () => void 0;
|
|
947
1214
|
const key = list.dataset.store || null;
|
|
948
1215
|
const boxes = () => Array.from(list.querySelectorAll('li[data-id] input[type="checkbox"]'));
|
|
949
1216
|
const idOf = (b) => {
|
|
950
|
-
var
|
|
951
|
-
return (
|
|
1217
|
+
var _a2, _b2;
|
|
1218
|
+
return (_b2 = (_a2 = b.closest("li[data-id]")) == null ? void 0 : _a2.dataset.id) != null ? _b2 : "";
|
|
952
1219
|
};
|
|
953
1220
|
let progress = null;
|
|
954
1221
|
for (let sib = list.previousElementSibling; sib; sib = sib.previousElementSibling) {
|
|
@@ -957,10 +1224,10 @@ var nishTheme = (() => {
|
|
|
957
1224
|
break;
|
|
958
1225
|
}
|
|
959
1226
|
}
|
|
960
|
-
progress != null ? progress : progress = (
|
|
1227
|
+
progress != null ? progress : progress = (_b = (_a = list.parentElement) == null ? void 0 : _a.querySelector(".nish-checklist-progress")) != null ? _b : null;
|
|
961
1228
|
if (key) {
|
|
962
1229
|
try {
|
|
963
|
-
const saved = JSON.parse((
|
|
1230
|
+
const saved = JSON.parse((_c = localStorage.getItem(key)) != null ? _c : "[]");
|
|
964
1231
|
if (Array.isArray(saved)) for (const b of boxes()) b.checked = saved.includes(idOf(b));
|
|
965
1232
|
} catch (e) {
|
|
966
1233
|
}
|