@hina-ui/vue 1.7.9 → 1.7.11
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/index.js +283 -92
- package/dist/index.js.map +1 -1
- package/dist/shared/behavior/spoiler/painter.ts +87 -60
- package/dist/shared/behavior/spoiler/worklet.ts +7 -9
- package/dist/shared/lib/command-palette/match.ts +17 -4
- package/dist/shared/lib/virtual/choices.ts +2 -1
- package/dist/shared/styles/motion.css +7 -1
- package/dist/shared/styles/spoiler.css +6 -0
- package/dist/shared/styles/typography.css +18 -3
- package/dist/shared/variants/command-palette.ts +12 -0
- package/dist/shared/variants/virtual-list.ts +8 -0
- package/dist/types/shared/src/behavior/spoiler/painter.d.ts +10 -9
- package/dist/types/shared/src/behavior/spoiler/painter.d.ts.map +1 -1
- package/dist/types/shared/src/behavior/spoiler/worklet.d.ts.map +1 -1
- package/dist/types/shared/src/lib/command-palette/match.d.ts +9 -0
- package/dist/types/shared/src/lib/command-palette/match.d.ts.map +1 -1
- package/dist/types/shared/src/lib/virtual/choices.d.ts +4 -0
- package/dist/types/shared/src/lib/virtual/choices.d.ts.map +1 -1
- package/dist/types/shared/src/variants/command-palette.d.ts +3 -0
- package/dist/types/shared/src/variants/command-palette.d.ts.map +1 -1
- package/dist/types/shared/src/variants/virtual-list.d.ts +2 -0
- package/dist/types/shared/src/variants/virtual-list.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/CommandPalette.vue.d.ts +2 -1
- package/dist/types/vue/src/components/command-palette/CommandPalette.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/CommandPalettePanel.vue.d.ts +2 -1
- package/dist/types/vue/src/components/command-palette/CommandPalettePanel.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/composables/useCommandItems.d.ts +6 -1
- package/dist/types/vue/src/components/command-palette/composables/useCommandItems.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/types.d.ts +3 -0
- package/dist/types/vue/src/components/command-palette/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/utils/match.d.ts +1 -1
- package/dist/types/vue/src/components/command-palette/utils/match.d.ts.map +1 -1
- package/dist/types/vue/src/components/virtual-list/VirtualChoices.vue.d.ts +4 -1
- package/dist/types/vue/src/components/virtual-list/VirtualChoices.vue.d.ts.map +1 -1
- package/dist/types/vue/src/index.d.ts +1 -1
- package/dist/types/vue/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/command-palette/CommandPalette.vue +8 -0
- package/src/components/command-palette/CommandPalettePanel.vue +85 -3
- package/src/components/command-palette/composables/useCommandItems.ts +19 -13
- package/src/components/command-palette/types.ts +4 -0
- package/src/components/command-palette/utils/match.ts +1 -0
- package/src/components/virtual-list/VirtualChoices.vue +39 -6
- package/src/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -3540,7 +3540,7 @@ var _hoisted_1$122 = [
|
|
|
3540
3540
|
"onLoad"
|
|
3541
3541
|
];
|
|
3542
3542
|
var _hoisted_2$70 = ["src"];
|
|
3543
|
-
var _hoisted_3$
|
|
3543
|
+
var _hoisted_3$38 = [
|
|
3544
3544
|
"src",
|
|
3545
3545
|
"alt",
|
|
3546
3546
|
"onLoad"
|
|
@@ -3636,7 +3636,7 @@ var LightboxStrip_default = /* @__PURE__ */ defineComponent({
|
|
|
3636
3636
|
draggable: "false",
|
|
3637
3637
|
class: "block size-full object-contain",
|
|
3638
3638
|
onLoad: ($event) => emit("learn", slide.item.id, $event.target)
|
|
3639
|
-
}, null, 40, _hoisted_3$
|
|
3639
|
+
}, null, 40, _hoisted_3$38)]),
|
|
3640
3640
|
_: 2
|
|
3641
3641
|
}, 1032, [
|
|
3642
3642
|
"style",
|
|
@@ -6340,9 +6340,9 @@ function useScrollFocus(host, viewport, options) {
|
|
|
6340
6340
|
//#region src/components/scroll-area/ScrollArea.vue?vue&type=script&setup=true&lang.ts
|
|
6341
6341
|
var _hoisted_1$121 = ["dir"];
|
|
6342
6342
|
var _hoisted_2$69 = ["data-visible"];
|
|
6343
|
-
var _hoisted_3$
|
|
6344
|
-
var _hoisted_4$
|
|
6345
|
-
var _hoisted_5$
|
|
6343
|
+
var _hoisted_3$37 = ["data-visible"];
|
|
6344
|
+
var _hoisted_4$31 = ["data-visible"];
|
|
6345
|
+
var _hoisted_5$24 = ["data-visible"];
|
|
6346
6346
|
//#endregion
|
|
6347
6347
|
//#region src/components/scroll-area/ScrollArea.vue
|
|
6348
6348
|
var ScrollArea_default = /* @__PURE__ */ defineComponent({
|
|
@@ -6437,21 +6437,21 @@ var ScrollArea_default = /* @__PURE__ */ defineComponent({
|
|
|
6437
6437
|
"data-side": "x-end",
|
|
6438
6438
|
"data-visible": unref(showXEnd) ? "" : void 0,
|
|
6439
6439
|
"aria-hidden": "true"
|
|
6440
|
-
}, null, 8, _hoisted_3$
|
|
6440
|
+
}, null, 8, _hoisted_3$37)) : createCommentVNode("", true),
|
|
6441
6441
|
props.direction !== "horizontal" ? (openBlock(), createElementBlock("div", {
|
|
6442
6442
|
key: 2,
|
|
6443
6443
|
class: "hn-scroll-shadow",
|
|
6444
6444
|
"data-side": "y-start",
|
|
6445
6445
|
"data-visible": unref(showYStart) ? "" : void 0,
|
|
6446
6446
|
"aria-hidden": "true"
|
|
6447
|
-
}, null, 8, _hoisted_4$
|
|
6447
|
+
}, null, 8, _hoisted_4$31)) : createCommentVNode("", true),
|
|
6448
6448
|
props.direction !== "horizontal" ? (openBlock(), createElementBlock("div", {
|
|
6449
6449
|
key: 3,
|
|
6450
6450
|
class: "hn-scroll-shadow",
|
|
6451
6451
|
"data-side": "y-end",
|
|
6452
6452
|
"data-visible": unref(showYEnd) ? "" : void 0,
|
|
6453
6453
|
"aria-hidden": "true"
|
|
6454
|
-
}, null, 8, _hoisted_5$
|
|
6454
|
+
}, null, 8, _hoisted_5$24)) : createCommentVNode("", true)
|
|
6455
6455
|
], 64)) : createCommentVNode("", true)], 10, _hoisted_1$121);
|
|
6456
6456
|
};
|
|
6457
6457
|
}
|
|
@@ -6519,7 +6519,7 @@ var _hoisted_2$68 = [
|
|
|
6519
6519
|
"aria-current",
|
|
6520
6520
|
"onClick"
|
|
6521
6521
|
];
|
|
6522
|
-
var _hoisted_3$
|
|
6522
|
+
var _hoisted_3$36 = ["src"];
|
|
6523
6523
|
//#endregion
|
|
6524
6524
|
//#region src/components/lightbox/LightboxThumbs.vue
|
|
6525
6525
|
var LightboxThumbs_default = /* @__PURE__ */ defineComponent({
|
|
@@ -6572,7 +6572,7 @@ var LightboxThumbs_default = /* @__PURE__ */ defineComponent({
|
|
|
6572
6572
|
alt: "",
|
|
6573
6573
|
draggable: "false",
|
|
6574
6574
|
class: "relative -z-10 size-full object-cover"
|
|
6575
|
-
}, null, 8, _hoisted_3$
|
|
6575
|
+
}, null, 8, _hoisted_3$36),
|
|
6576
6576
|
at === props.index ? (openBlock(), createBlock(Highlight_default, {
|
|
6577
6577
|
key: 0,
|
|
6578
6578
|
id: unref(highlightId),
|
|
@@ -9199,9 +9199,9 @@ var _hoisted_1$114 = {
|
|
|
9199
9199
|
class: "hn-collapse"
|
|
9200
9200
|
};
|
|
9201
9201
|
var _hoisted_2$64 = { class: "hn-collapse-body" };
|
|
9202
|
-
var _hoisted_3$
|
|
9203
|
-
var _hoisted_4$
|
|
9204
|
-
var _hoisted_5$
|
|
9202
|
+
var _hoisted_3$35 = ["role"];
|
|
9203
|
+
var _hoisted_4$30 = { class: "flex min-w-0 flex-1 flex-col gap-1" };
|
|
9204
|
+
var _hoisted_5$23 = {
|
|
9205
9205
|
key: 0,
|
|
9206
9206
|
class: "text-fg font-medium"
|
|
9207
9207
|
};
|
|
@@ -9258,7 +9258,7 @@ var Alert_default = /* @__PURE__ */ defineComponent({
|
|
|
9258
9258
|
class: normalizeClass(unref(calloutIcon)({ tone: props.tone })),
|
|
9259
9259
|
"aria-hidden": "true"
|
|
9260
9260
|
}, null, 8, ["class"])) : createCommentVNode("", true)]),
|
|
9261
|
-
createElementVNode("div", _hoisted_4$
|
|
9261
|
+
createElementVNode("div", _hoisted_4$30, [props.title ? (openBlock(), createElementBlock("p", _hoisted_5$23, toDisplayString(props.title), 1)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default")]),
|
|
9262
9262
|
unref(slots).actions ? (openBlock(), createElementBlock("div", _hoisted_6$15, [renderSlot(_ctx.$slots, "actions")])) : createCommentVNode("", true),
|
|
9263
9263
|
props.closable ? (openBlock(), createBlock(CloseButton_default, {
|
|
9264
9264
|
key: 1,
|
|
@@ -9266,7 +9266,7 @@ var Alert_default = /* @__PURE__ */ defineComponent({
|
|
|
9266
9266
|
class: "-my-0.5 -me-1",
|
|
9267
9267
|
onClick: close
|
|
9268
9268
|
})) : createCommentVNode("", true)
|
|
9269
|
-
], 10, _hoisted_3$
|
|
9269
|
+
], 10, _hoisted_3$35)])])) : createCommentVNode("", true)]),
|
|
9270
9270
|
_: 3
|
|
9271
9271
|
}, 16);
|
|
9272
9272
|
};
|
|
@@ -10979,6 +10979,7 @@ function choiceRows(items, query, contains) {
|
|
|
10979
10979
|
result.push({
|
|
10980
10980
|
key: `group:${groupIndex}`,
|
|
10981
10981
|
label: item.label,
|
|
10982
|
+
source: item,
|
|
10982
10983
|
position: 0
|
|
10983
10984
|
});
|
|
10984
10985
|
for (const option of options) result.push({
|
|
@@ -11255,6 +11256,8 @@ var virtualListContent = tv({
|
|
|
11255
11256
|
horizontal: "flex-row"
|
|
11256
11257
|
} }
|
|
11257
11258
|
});
|
|
11259
|
+
var virtualChoiceHeadings = tv({ base: "pointer-events-none absolute inset-0 z-1 p-[inherit]" });
|
|
11260
|
+
var virtualChoiceHeading = tv({ base: "pointer-events-auto absolute inset-x-0" });
|
|
11258
11261
|
var virtualListItem = tv({
|
|
11259
11262
|
base: "flow-root min-w-0 shrink-0",
|
|
11260
11263
|
variants: { orientation: {
|
|
@@ -11267,6 +11270,9 @@ var virtualListStatus = tv({ base: "text-muted flex shrink-0 items-center justif
|
|
|
11267
11270
|
//#region src/components/virtual-list/VirtualChoices.vue?vue&type=script&setup=true&lang.ts
|
|
11268
11271
|
var _hoisted_1$111 = ["data-index"];
|
|
11269
11272
|
var _hoisted_2$62 = ["id"];
|
|
11273
|
+
var _hoisted_3$34 = ["id"];
|
|
11274
|
+
var _hoisted_4$29 = { class: "relative" };
|
|
11275
|
+
var _hoisted_5$22 = ["data-index"];
|
|
11270
11276
|
//#endregion
|
|
11271
11277
|
//#region src/components/virtual-list/VirtualChoices.vue
|
|
11272
11278
|
var VirtualChoices_default = /* @__PURE__ */ defineComponent({
|
|
@@ -11286,6 +11292,9 @@ var VirtualChoices_default = /* @__PURE__ */ defineComponent({
|
|
|
11286
11292
|
const props = __props;
|
|
11287
11293
|
const t = useUiLocale();
|
|
11288
11294
|
const { area, body, rows, entries, bodyStyle, measure, itemAttrs, labelId } = useVirtualChoices(props);
|
|
11295
|
+
const slots = useSlots();
|
|
11296
|
+
const held = (index) => !!slots.group && !rows.value[index].option;
|
|
11297
|
+
const origin = computed(() => entries.value[0] ? entries.value[0].start - parseFloat(bodyStyle.value.paddingBlockStart) : 0);
|
|
11289
11298
|
return (_ctx, _cache) => {
|
|
11290
11299
|
return openBlock(), createBlock(ScrollArea_default, {
|
|
11291
11300
|
ref_key: "area",
|
|
@@ -11293,7 +11302,7 @@ var VirtualChoices_default = /* @__PURE__ */ defineComponent({
|
|
|
11293
11302
|
class: normalizeClass(props.class),
|
|
11294
11303
|
style: normalizeStyle({ maxHeight: typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight })
|
|
11295
11304
|
}, {
|
|
11296
|
-
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(props.padded
|
|
11305
|
+
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(cn)(slots.group && "relative", props.padded !== false && "p-1") || void 0) }, [createElementVNode("div", mergeProps({
|
|
11297
11306
|
ref_key: "body",
|
|
11298
11307
|
ref: body
|
|
11299
11308
|
}, _ctx.$attrs, {
|
|
@@ -11304,23 +11313,42 @@ var VirtualChoices_default = /* @__PURE__ */ defineComponent({
|
|
|
11304
11313
|
return openBlock(), createElementBlock("div", {
|
|
11305
11314
|
key: entry.key,
|
|
11306
11315
|
ref_for: true,
|
|
11307
|
-
ref: unref(measure),
|
|
11316
|
+
ref: held(entry.index) ? void 0 : unref(measure),
|
|
11308
11317
|
"data-index": entry.index,
|
|
11309
11318
|
role: "presentation",
|
|
11310
11319
|
class: normalizeClass(unref(virtualListItem)({ orientation: "vertical" })),
|
|
11311
|
-
style: normalizeStyle({
|
|
11320
|
+
style: normalizeStyle({
|
|
11321
|
+
marginBlockStart: `${entry.gapBefore}px`,
|
|
11322
|
+
height: held(entry.index) ? `${entry.size}px` : void 0
|
|
11323
|
+
})
|
|
11312
11324
|
}, [unref(rows)[entry.index].option ? renderSlot(_ctx.$slots, "default", {
|
|
11313
11325
|
option: unref(rows)[entry.index].option,
|
|
11314
11326
|
attrs: unref(itemAttrs)(entry.index)
|
|
11315
|
-
}, void 0, void 0, 0) : (openBlock(), createElementBlock("
|
|
11327
|
+
}, void 0, void 0, 0) : slots.group ? (openBlock(), createElementBlock("span", {
|
|
11316
11328
|
key: 1,
|
|
11317
11329
|
id: unref(labelId)(entry.index),
|
|
11330
|
+
hidden: ""
|
|
11331
|
+
}, toDisplayString(unref(rows)[entry.index].label), 9, _hoisted_2$62)) : (openBlock(), createElementBlock("div", {
|
|
11332
|
+
key: 2,
|
|
11333
|
+
id: unref(labelId)(entry.index),
|
|
11318
11334
|
class: normalizeClass(unref(selectLabel)())
|
|
11319
|
-
}, toDisplayString(unref(rows)[entry.index].label), 11,
|
|
11335
|
+
}, toDisplayString(unref(rows)[entry.index].label), 11, _hoisted_3$34))], 14, _hoisted_1$111);
|
|
11320
11336
|
}), 128))], 16), !unref(rows).length ? (openBlock(), createElementBlock("div", {
|
|
11321
11337
|
key: 0,
|
|
11322
11338
|
class: normalizeClass(unref(selectEmpty)())
|
|
11323
|
-
}, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(unref(t).select.empty), 1)])], 2)) :
|
|
11339
|
+
}, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(unref(t).select.empty), 1)])], 2)) : slots.group ? (openBlock(), createElementBlock("div", {
|
|
11340
|
+
key: 1,
|
|
11341
|
+
class: normalizeClass(unref(virtualChoiceHeadings)())
|
|
11342
|
+
}, [createElementVNode("div", _hoisted_4$29, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(entries), (entry) => {
|
|
11343
|
+
return openBlock(), createElementBlock(Fragment, { key: entry.key }, [unref(rows)[entry.index].source ? (openBlock(), createElementBlock("div", {
|
|
11344
|
+
key: 0,
|
|
11345
|
+
ref_for: true,
|
|
11346
|
+
ref: unref(measure),
|
|
11347
|
+
"data-index": entry.index,
|
|
11348
|
+
class: normalizeClass(unref(virtualChoiceHeading)()),
|
|
11349
|
+
style: normalizeStyle({ top: `${entry.start - origin.value}px` })
|
|
11350
|
+
}, [renderSlot(_ctx.$slots, "group", { group: unref(rows)[entry.index].source })], 14, _hoisted_5$22)) : createCommentVNode("", true)], 64);
|
|
11351
|
+
}), 128))])], 2)) : createCommentVNode("", true)], 2)]),
|
|
11324
11352
|
_: 3
|
|
11325
11353
|
}, 8, ["class", "style"]);
|
|
11326
11354
|
};
|
|
@@ -16029,6 +16057,9 @@ var commandItemBody = tv({ base: "flex min-w-0 flex-1 flex-col" });
|
|
|
16029
16057
|
var commandItemMatch = tv({ base: "text-accent-text font-medium" });
|
|
16030
16058
|
var commandItemHint = tv({ base: "ms-auto flex shrink-0 items-center gap-1" });
|
|
16031
16059
|
var commandEmpty = tv({ base: "text-muted px-4 py-8 text-center text-sm" });
|
|
16060
|
+
var commandHeading = tv({ base: "text-muted flex min-h-7 items-center justify-between gap-2 px-2.5 text-xs font-medium" });
|
|
16061
|
+
var commandGrid = tv({ base: "grid grid-cols-[minmax(0,1fr)] p-1" });
|
|
16062
|
+
var commandGridRows = tv({ base: "col-start-1 grid grid-rows-subgrid" });
|
|
16032
16063
|
var commandStatus = tv({ base: "border-line text-muted shrink-0 border-t px-4 py-2 text-center text-sm" });
|
|
16033
16064
|
//#endregion
|
|
16034
16065
|
//#region src/components/command-palette/context.ts
|
|
@@ -16221,16 +16252,34 @@ function score(item, query) {
|
|
|
16221
16252
|
function rank(items, query) {
|
|
16222
16253
|
return items.map((item) => score(item, query)).filter((match) => match !== null).sort((a, b) => b.score - a.score);
|
|
16223
16254
|
}
|
|
16255
|
+
function layoutCommandSections(sections) {
|
|
16256
|
+
let row = 1;
|
|
16257
|
+
const placed = sections.map((section) => {
|
|
16258
|
+
const span = section.matches.length + (section.group ? 1 : 0);
|
|
16259
|
+
const entry = {
|
|
16260
|
+
section,
|
|
16261
|
+
row,
|
|
16262
|
+
span
|
|
16263
|
+
};
|
|
16264
|
+
row += span;
|
|
16265
|
+
return entry;
|
|
16266
|
+
});
|
|
16267
|
+
return {
|
|
16268
|
+
rows: Math.max(row - 1, 1),
|
|
16269
|
+
sections: placed
|
|
16270
|
+
};
|
|
16271
|
+
}
|
|
16224
16272
|
function filterCommands(items, query) {
|
|
16225
16273
|
const q = query.trim().toLowerCase();
|
|
16226
16274
|
const sections = [];
|
|
16227
16275
|
let loose = [];
|
|
16228
|
-
const push = (
|
|
16276
|
+
const push = (group, entries) => {
|
|
16229
16277
|
const ranked = rank(entries, q);
|
|
16230
16278
|
if (ranked.length === 0) return;
|
|
16231
16279
|
sections.push({
|
|
16232
16280
|
key: String(sections.length),
|
|
16233
|
-
label,
|
|
16281
|
+
label: group?.label,
|
|
16282
|
+
group,
|
|
16234
16283
|
best: ranked[0].score,
|
|
16235
16284
|
matches: ranked.map(({ item, start, end }) => ({
|
|
16236
16285
|
item,
|
|
@@ -16250,13 +16299,14 @@ function filterCommands(items, query) {
|
|
|
16250
16299
|
continue;
|
|
16251
16300
|
}
|
|
16252
16301
|
flush();
|
|
16253
|
-
push(entry
|
|
16302
|
+
push(entry, entry.items);
|
|
16254
16303
|
}
|
|
16255
16304
|
flush();
|
|
16256
16305
|
if (q) sections.sort((a, b) => b.best - a.best);
|
|
16257
|
-
return sections.map(({ key, label, matches }) => ({
|
|
16306
|
+
return sections.map(({ key, label, group, matches }) => ({
|
|
16258
16307
|
key,
|
|
16259
16308
|
label,
|
|
16309
|
+
group,
|
|
16260
16310
|
matches
|
|
16261
16311
|
}));
|
|
16262
16312
|
}
|
|
@@ -16280,9 +16330,10 @@ function useCommandItems(props, search) {
|
|
|
16280
16330
|
description: match.item.description,
|
|
16281
16331
|
match
|
|
16282
16332
|
}));
|
|
16283
|
-
return section.
|
|
16284
|
-
label: section.label,
|
|
16285
|
-
options
|
|
16333
|
+
return section.group ? [{
|
|
16334
|
+
label: section.group.label,
|
|
16335
|
+
options,
|
|
16336
|
+
group: section.group
|
|
16286
16337
|
}] : options;
|
|
16287
16338
|
}))
|
|
16288
16339
|
};
|
|
@@ -16311,10 +16362,19 @@ var CommandPalettePanel_default = /* @__PURE__ */ defineComponent({
|
|
|
16311
16362
|
setup(__props, { emit: __emit }) {
|
|
16312
16363
|
const props = __props;
|
|
16313
16364
|
const emit = __emit;
|
|
16365
|
+
const slots = useSlots();
|
|
16314
16366
|
const search = useModel(__props, "search");
|
|
16315
16367
|
const t = useUiLocale();
|
|
16316
16368
|
const input = shallowRef();
|
|
16317
16369
|
const { sections, options } = useCommandItems(props, () => search.value);
|
|
16370
|
+
const layout = computed(() => slots.heading ? layoutCommandSections(sections.value) : void 0);
|
|
16371
|
+
function returnFocus() {
|
|
16372
|
+
nextTick(() => {
|
|
16373
|
+
const field = input.value;
|
|
16374
|
+
const active = document.activeElement;
|
|
16375
|
+
if (field?.isConnected && (!active || active === document.body || active.contains(field))) field.focus({ preventScroll: true });
|
|
16376
|
+
});
|
|
16377
|
+
}
|
|
16318
16378
|
function select(item) {
|
|
16319
16379
|
const field = input.value;
|
|
16320
16380
|
const panel = field?.closest("[data-hn-command-palette]");
|
|
@@ -16362,7 +16422,7 @@ var CommandPalettePanel_default = /* @__PURE__ */ defineComponent({
|
|
|
16362
16422
|
input: input.value,
|
|
16363
16423
|
kind: "listbox",
|
|
16364
16424
|
class: normalizeClass(unref(commandList)())
|
|
16365
|
-
}, {
|
|
16425
|
+
}, createSlots({
|
|
16366
16426
|
default: withCtx(({ option, attrs }) => [createVNode(CommandPaletteItem_default, mergeProps(attrs, {
|
|
16367
16427
|
match: option.match,
|
|
16368
16428
|
onSelect: ($event) => select(option.match.item)
|
|
@@ -16375,8 +16435,17 @@ var CommandPalettePanel_default = /* @__PURE__ */ defineComponent({
|
|
|
16375
16435
|
key: "0"
|
|
16376
16436
|
} : void 0]), 1040, ["match", "onSelect"])]),
|
|
16377
16437
|
empty: withCtx(() => [props.loading ? renderSlot(_ctx.$slots, "loading", {}, () => [createTextVNode(toDisplayString(unref(t).common.loading), 1)], void 0, 0) : renderSlot(_ctx.$slots, "empty", { search: search.value }, () => [createTextVNode(toDisplayString(unref(t).command.empty), 1)], void 0, 1)]),
|
|
16378
|
-
_:
|
|
16379
|
-
},
|
|
16438
|
+
_: 2
|
|
16439
|
+
}, [_ctx.$slots.heading ? {
|
|
16440
|
+
name: "group",
|
|
16441
|
+
fn: withCtx(({ group }) => [createElementVNode("div", {
|
|
16442
|
+
"data-hn-command-heading": "",
|
|
16443
|
+
class: normalizeClass(unref(commandHeading)()),
|
|
16444
|
+
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"])),
|
|
16445
|
+
onClick: returnFocus
|
|
16446
|
+
}, [renderSlot(_ctx.$slots, "heading", { group: group.group })], 34)]),
|
|
16447
|
+
key: "0"
|
|
16448
|
+
} : void 0]), 1032, [
|
|
16380
16449
|
"options",
|
|
16381
16450
|
"virtualize",
|
|
16382
16451
|
"input",
|
|
@@ -16387,7 +16456,87 @@ var CommandPalettePanel_default = /* @__PURE__ */ defineComponent({
|
|
|
16387
16456
|
key: 3,
|
|
16388
16457
|
class: normalizeClass(unref(commandList)())
|
|
16389
16458
|
}, {
|
|
16390
|
-
default: withCtx(() => [
|
|
16459
|
+
default: withCtx(() => [layout.value ? (openBlock(), createElementBlock("div", {
|
|
16460
|
+
key: 0,
|
|
16461
|
+
class: normalizeClass(unref(commandGrid)())
|
|
16462
|
+
}, [createVNode(unref(ListboxContent), {
|
|
16463
|
+
"aria-label": props.label,
|
|
16464
|
+
"aria-busy": props.loading || void 0,
|
|
16465
|
+
class: normalizeClass(unref(commandGridRows)()),
|
|
16466
|
+
style: normalizeStyle({ gridRow: `1 / span ${layout.value.rows}` })
|
|
16467
|
+
}, {
|
|
16468
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(layout.value.sections, ({ section, row, span }) => {
|
|
16469
|
+
return openBlock(), createElementBlock(Fragment, { key: section.key }, [section.group ? (openBlock(), createBlock(unref(ListboxGroup), {
|
|
16470
|
+
key: 0,
|
|
16471
|
+
"aria-label": section.group.label,
|
|
16472
|
+
"aria-labelledby": void 0,
|
|
16473
|
+
class: normalizeClass(unref(commandGridRows)()),
|
|
16474
|
+
style: normalizeStyle({ gridRow: `${row} / span ${span}` })
|
|
16475
|
+
}, {
|
|
16476
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(section.matches, (match, index) => {
|
|
16477
|
+
return openBlock(), createBlock(CommandPaletteItem_default, {
|
|
16478
|
+
key: match.item.id,
|
|
16479
|
+
match,
|
|
16480
|
+
style: normalizeStyle({ gridRow: index + 2 }),
|
|
16481
|
+
onSelect: ($event) => select(match.item)
|
|
16482
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.item ? {
|
|
16483
|
+
name: "default",
|
|
16484
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "item", {
|
|
16485
|
+
item: match.item,
|
|
16486
|
+
match: unref(commandMatchRange)(match)
|
|
16487
|
+
})]),
|
|
16488
|
+
key: "0"
|
|
16489
|
+
} : void 0]), 1032, [
|
|
16490
|
+
"match",
|
|
16491
|
+
"style",
|
|
16492
|
+
"onSelect"
|
|
16493
|
+
]);
|
|
16494
|
+
}), 128))]),
|
|
16495
|
+
_: 2
|
|
16496
|
+
}, 1032, [
|
|
16497
|
+
"aria-label",
|
|
16498
|
+
"class",
|
|
16499
|
+
"style"
|
|
16500
|
+
])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(section.matches, (match, index) => {
|
|
16501
|
+
return openBlock(), createBlock(CommandPaletteItem_default, {
|
|
16502
|
+
key: match.item.id,
|
|
16503
|
+
match,
|
|
16504
|
+
style: normalizeStyle({ gridRow: row + index }),
|
|
16505
|
+
onSelect: ($event) => select(match.item)
|
|
16506
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.item ? {
|
|
16507
|
+
name: "default",
|
|
16508
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "item", {
|
|
16509
|
+
item: match.item,
|
|
16510
|
+
match: unref(commandMatchRange)(match)
|
|
16511
|
+
})]),
|
|
16512
|
+
key: "0"
|
|
16513
|
+
} : void 0]), 1032, [
|
|
16514
|
+
"match",
|
|
16515
|
+
"style",
|
|
16516
|
+
"onSelect"
|
|
16517
|
+
]);
|
|
16518
|
+
}), 128))], 64);
|
|
16519
|
+
}), 128))]),
|
|
16520
|
+
_: 3
|
|
16521
|
+
}, 8, [
|
|
16522
|
+
"aria-label",
|
|
16523
|
+
"aria-busy",
|
|
16524
|
+
"class",
|
|
16525
|
+
"style"
|
|
16526
|
+
]), (openBlock(true), createElementBlock(Fragment, null, renderList(layout.value.sections, ({ section, row }) => {
|
|
16527
|
+
return openBlock(), createElementBlock(Fragment, { key: section.key }, [section.group ? (openBlock(), createElementBlock("div", {
|
|
16528
|
+
key: 0,
|
|
16529
|
+
"data-hn-command-heading": "",
|
|
16530
|
+
class: normalizeClass(unref(commandHeading)()),
|
|
16531
|
+
style: normalizeStyle({
|
|
16532
|
+
gridRow: row,
|
|
16533
|
+
gridColumn: 1
|
|
16534
|
+
}),
|
|
16535
|
+
onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"])),
|
|
16536
|
+
onClick: returnFocus
|
|
16537
|
+
}, [renderSlot(_ctx.$slots, "heading", { group: section.group })], 38)) : createCommentVNode("", true)], 64);
|
|
16538
|
+
}), 128))], 2)) : (openBlock(), createBlock(unref(ListboxContent), {
|
|
16539
|
+
key: 1,
|
|
16391
16540
|
"aria-label": props.label,
|
|
16392
16541
|
"aria-busy": props.loading || void 0,
|
|
16393
16542
|
class: normalizeClass(unref(selectListBody)())
|
|
@@ -16432,8 +16581,8 @@ var CommandPalettePanel_default = /* @__PURE__ */ defineComponent({
|
|
|
16432
16581
|
"aria-label",
|
|
16433
16582
|
"aria-busy",
|
|
16434
16583
|
"class"
|
|
16435
|
-
]), unref(sections).length === 0 ? (openBlock(), createElementBlock("div", {
|
|
16436
|
-
key:
|
|
16584
|
+
])), unref(sections).length === 0 ? (openBlock(), createElementBlock("div", {
|
|
16585
|
+
key: 2,
|
|
16437
16586
|
role: "status",
|
|
16438
16587
|
class: normalizeClass(unref(commandEmpty)())
|
|
16439
16588
|
}, [props.loading ? renderSlot(_ctx.$slots, "loading", {}, () => [createTextVNode(toDisplayString(unref(t).common.loading), 1)], void 0, 0) : renderSlot(_ctx.$slots, "empty", { search: search.value }, () => [createTextVNode(toDisplayString(unref(t).command.empty), 1)], void 0, 1)], 2)) : createCommentVNode("", true)]),
|
|
@@ -16554,15 +16703,20 @@ var CommandPalette_default = /* @__PURE__ */ defineComponent({
|
|
|
16554
16703
|
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "item", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
16555
16704
|
key: "1"
|
|
16556
16705
|
} : void 0,
|
|
16706
|
+
_ctx.$slots.heading ? {
|
|
16707
|
+
name: "heading",
|
|
16708
|
+
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "heading", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
16709
|
+
key: "2"
|
|
16710
|
+
} : void 0,
|
|
16557
16711
|
_ctx.$slots.loading ? {
|
|
16558
16712
|
name: "loading",
|
|
16559
16713
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "loading")]),
|
|
16560
|
-
key: "
|
|
16714
|
+
key: "3"
|
|
16561
16715
|
} : void 0,
|
|
16562
16716
|
_ctx.$slots.empty ? {
|
|
16563
16717
|
name: "empty",
|
|
16564
16718
|
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "empty", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
16565
|
-
key: "
|
|
16719
|
+
key: "4"
|
|
16566
16720
|
} : void 0
|
|
16567
16721
|
]), 1040, [
|
|
16568
16722
|
"search",
|
|
@@ -16618,15 +16772,20 @@ var CommandPalette_default = /* @__PURE__ */ defineComponent({
|
|
|
16618
16772
|
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "item", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
16619
16773
|
key: "1"
|
|
16620
16774
|
} : void 0,
|
|
16775
|
+
_ctx.$slots.heading ? {
|
|
16776
|
+
name: "heading",
|
|
16777
|
+
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "heading", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
16778
|
+
key: "2"
|
|
16779
|
+
} : void 0,
|
|
16621
16780
|
_ctx.$slots.loading ? {
|
|
16622
16781
|
name: "loading",
|
|
16623
16782
|
fn: withCtx(() => [renderSlot(_ctx.$slots, "loading")]),
|
|
16624
|
-
key: "
|
|
16783
|
+
key: "3"
|
|
16625
16784
|
} : void 0,
|
|
16626
16785
|
_ctx.$slots.empty ? {
|
|
16627
16786
|
name: "empty",
|
|
16628
16787
|
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "empty", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
16629
|
-
key: "
|
|
16788
|
+
key: "4"
|
|
16630
16789
|
} : void 0
|
|
16631
16790
|
]), 1040, [
|
|
16632
16791
|
"search",
|
|
@@ -35045,8 +35204,6 @@ var workletMain = () => {
|
|
|
35045
35204
|
const M = Math;
|
|
35046
35205
|
const lcgrand = (seed = 1) => (a = 0, b = 1) => a + M.abs(b - a) * (M.imul(48271, seed = M.imul(214013, seed) + 2531011) & 2147483647) / 2147483647;
|
|
35047
35206
|
const pol2vec = (l, a = 0) => [l * M.cos(a), l * M.sin(a)];
|
|
35048
|
-
const vecmag = ([x, y]) => M.sqrt(x * x + y * y);
|
|
35049
|
-
const vecnorm = ([x, y], l = vecmag([x, y])) => l === 0 ? [0, 0] : [x / l, y / l];
|
|
35050
35207
|
const trapezoidalWave = (l, a, b) => {
|
|
35051
35208
|
const s = M.max(a, l - b);
|
|
35052
35209
|
return (t) => {
|
|
@@ -35154,18 +35311,18 @@ var workletMain = () => {
|
|
|
35154
35311
|
const lineHeight = height - 2 * vgap;
|
|
35155
35312
|
const wordDist = mimicWords ? makeWordDistribution(lineWidth, lineHeight, M.max(12, lineHeight / 4)) : (x) => x * (width - 2 * hgap);
|
|
35156
35313
|
ctx.clearRect(0, 0, size.width, size.height);
|
|
35314
|
+
const l = parseInt(accent[2] ?? "0");
|
|
35315
|
+
const ldir = l > 50 ? -1 : 1;
|
|
35316
|
+
const hue = `hsl(${accent[0]} ${accent[1]} `;
|
|
35157
35317
|
for (let i = 0; i < world.n; ++i) {
|
|
35158
35318
|
const x0 = hgap + wordDist(rand());
|
|
35159
35319
|
const y0 = rand(vgap, height - vgap);
|
|
35160
35320
|
const v0mag = rand(vmin, vmax);
|
|
35161
35321
|
const size0 = rand(1, 1 + sizedev);
|
|
35162
|
-
const l = parseInt(accent[2] ?? "0");
|
|
35163
|
-
const ldir = l > 50 ? -1 : 1;
|
|
35164
35322
|
const lightness = M.floor(clamp(0, l + ldir * rand(0, 30), 100));
|
|
35165
35323
|
const v0 = pol2vec(v0mag, rand(0, M.PI * 2));
|
|
35166
35324
|
const vx0 = v0[0];
|
|
35167
35325
|
const vy0 = v0[1];
|
|
35168
|
-
vecnorm(v0);
|
|
35169
35326
|
const shape = rand() > .5 ? "square" : "circle";
|
|
35170
35327
|
const lifetime = rand(.3, 1.5);
|
|
35171
35328
|
const respawn = rand(0, 1);
|
|
@@ -35176,11 +35333,12 @@ var workletMain = () => {
|
|
|
35176
35333
|
const x = x0 + vx0 * t;
|
|
35177
35334
|
const y = y0 + vy0 * t;
|
|
35178
35335
|
const fade = animateFadeInOut(world, i, fadeDuration);
|
|
35179
|
-
const alpha = fade * (1 - t / lifetime);
|
|
35336
|
+
const alpha = M.round(fade * (1 - t / lifetime) * 100);
|
|
35180
35337
|
const psize = fade * (size0 * visibilityFn(t));
|
|
35338
|
+
if (alpha <= 0 || psize <= 0) continue;
|
|
35339
|
+
ctx.fillStyle = `${hue}${lightness}% / ${alpha}%)`;
|
|
35181
35340
|
for (const [wx, wy] of cycleBounds([x, y], [width, height], psize / 2)) {
|
|
35182
35341
|
ctx.beginPath();
|
|
35183
|
-
ctx.fillStyle = `hsl(${accent[0]} ${accent[1]} ${lightness}% / ${M.round(alpha * 100)}%)`;
|
|
35184
35342
|
if (shape === "square") ctx.rect(wx, wy, psize, psize);
|
|
35185
35343
|
else ctx.arc(wx, wy, psize / 2, 0, M.PI * 2);
|
|
35186
35344
|
ctx.closePath();
|
|
@@ -35208,23 +35366,44 @@ var DEFAULTS = {
|
|
|
35208
35366
|
mimicWords: true,
|
|
35209
35367
|
accent: "0 0% 20%"
|
|
35210
35368
|
};
|
|
35369
|
+
var SPOILER_WORKLET_INPUTS = [
|
|
35370
|
+
"--hn-nz-t",
|
|
35371
|
+
"--hn-nz-stop",
|
|
35372
|
+
"--hn-nz-fade",
|
|
35373
|
+
"--hn-nz-gap",
|
|
35374
|
+
"--hn-nz-accent",
|
|
35375
|
+
"--hn-nz-words",
|
|
35376
|
+
"--hn-nz-density"
|
|
35377
|
+
];
|
|
35211
35378
|
var BLOCK_MAX_TILE = 293;
|
|
35212
35379
|
var INLINE_MAX_TILE = 333;
|
|
35213
35380
|
var GAP_RATIO = 8;
|
|
35214
35381
|
var DEFAULT_FADE_S = 1.5;
|
|
35382
|
+
var CLOCK_S = 3600;
|
|
35383
|
+
var painters = /* @__PURE__ */ new WeakMap();
|
|
35384
|
+
var viewport;
|
|
35385
|
+
function watchViewport() {
|
|
35386
|
+
viewport ??= new IntersectionObserver((entries) => {
|
|
35387
|
+
for (const entry of entries) painters.get(entry.target)?.setInView(entry.isIntersecting);
|
|
35388
|
+
});
|
|
35389
|
+
return viewport;
|
|
35390
|
+
}
|
|
35215
35391
|
var SpoilerPainter = class {
|
|
35216
35392
|
el;
|
|
35217
35393
|
maxFPS = DEFAULTS.fps;
|
|
35218
|
-
|
|
35219
|
-
|
|
35220
|
-
|
|
35221
|
-
|
|
35222
|
-
fadeS = 0;
|
|
35394
|
+
clock = null;
|
|
35395
|
+
settle;
|
|
35396
|
+
running = false;
|
|
35397
|
+
inView = false;
|
|
35223
35398
|
hidden = false;
|
|
35224
35399
|
destroyed = false;
|
|
35225
35400
|
constructor(el, options = {}) {
|
|
35226
35401
|
registerSpoilerWorklet();
|
|
35227
35402
|
this.el = el;
|
|
35403
|
+
painters.set(el, this);
|
|
35404
|
+
watchViewport().observe(el);
|
|
35405
|
+
this.setFade(0);
|
|
35406
|
+
this.setTstop(null);
|
|
35228
35407
|
this.update(options);
|
|
35229
35408
|
}
|
|
35230
35409
|
get isHidden() {
|
|
@@ -35232,11 +35411,17 @@ var SpoilerPainter = class {
|
|
|
35232
35411
|
}
|
|
35233
35412
|
update({ fps = DEFAULTS.fps, gap = DEFAULTS.gap, density = DEFAULTS.density, mimicWords = DEFAULTS.mimicWords, accent = DEFAULTS.accent } = {}) {
|
|
35234
35413
|
if (this.destroyed) return;
|
|
35235
|
-
|
|
35414
|
+
const maxFPS = prefersReducedMotion() ? 0 : fps;
|
|
35415
|
+
if (maxFPS !== this.maxFPS) {
|
|
35416
|
+
this.maxFPS = maxFPS;
|
|
35417
|
+
if (maxFPS > 0) this.clock?.effect?.updateTiming({ easing: this.easing() });
|
|
35418
|
+
else this.stopClock();
|
|
35419
|
+
}
|
|
35236
35420
|
this.el.style.setProperty("--hn-nz-density", String(density));
|
|
35237
35421
|
this.el.style.setProperty("--hn-nz-accent", accent);
|
|
35238
35422
|
const isBlockElement = getComputedStyle(this.el).getPropertyValue("display") !== "inline";
|
|
35239
35423
|
this.useBackgroundStyle("auto", "auto", false);
|
|
35424
|
+
this.el.style.setProperty("--hn-nz-gap", "0px 0px");
|
|
35240
35425
|
if (isBlockElement) {
|
|
35241
35426
|
this.el.style.setProperty("--hn-nz-words", "false");
|
|
35242
35427
|
const rect = this.el.getBoundingClientRect();
|
|
@@ -35260,71 +35445,77 @@ var SpoilerPainter = class {
|
|
|
35260
35445
|
const repeatAndPosition = tile ? "repeat left center" : "no-repeat center center";
|
|
35261
35446
|
this.el.style.background = `paint(hn-spoiler) ${repeatAndPosition} / ${w} ${h}`;
|
|
35262
35447
|
}
|
|
35448
|
+
easing() {
|
|
35449
|
+
return `steps(${Math.round(CLOCK_S * this.maxFPS)})`;
|
|
35450
|
+
}
|
|
35451
|
+
time() {
|
|
35452
|
+
const elapsed = Number(this.clock?.currentTime ?? 0) / 1e3;
|
|
35453
|
+
return this.maxFPS > 0 ? Math.floor(elapsed * this.maxFPS) / this.maxFPS : 0;
|
|
35454
|
+
}
|
|
35263
35455
|
setFade(value) {
|
|
35264
|
-
this.fadeS = value;
|
|
35265
35456
|
this.el.style.setProperty("--hn-nz-fade", `${value}s`);
|
|
35266
35457
|
}
|
|
35267
|
-
setT(value) {
|
|
35268
|
-
this.t = value;
|
|
35269
|
-
this.el.style.setProperty("--hn-nz-t", value.toFixed(3));
|
|
35270
|
-
}
|
|
35271
35458
|
setTstop(value) {
|
|
35272
|
-
this.
|
|
35273
|
-
if (value !== null) this.el.style.setProperty("--hn-nz-stop", value.toFixed(3));
|
|
35274
|
-
else this.el.style.removeProperty("--hn-nz-stop");
|
|
35459
|
+
this.el.style.setProperty("--hn-nz-stop", value === null ? "Infinity" : value.toFixed(3));
|
|
35275
35460
|
}
|
|
35276
35461
|
parseFade(value) {
|
|
35277
35462
|
if (this.maxFPS <= 0) return 0;
|
|
35278
35463
|
return value === true || value === void 0 ? DEFAULT_FADE_S : Number(value);
|
|
35279
35464
|
}
|
|
35465
|
+
sync() {
|
|
35466
|
+
if (!this.clock) return;
|
|
35467
|
+
if (this.running && this.inView) this.clock.play();
|
|
35468
|
+
else this.clock.pause();
|
|
35469
|
+
}
|
|
35470
|
+
stopClock() {
|
|
35471
|
+
clearTimeout(this.settle);
|
|
35472
|
+
this.settle = void 0;
|
|
35473
|
+
this.clock?.cancel();
|
|
35474
|
+
this.clock = null;
|
|
35475
|
+
this.running = false;
|
|
35476
|
+
}
|
|
35477
|
+
setInView(value) {
|
|
35478
|
+
if (this.destroyed || value === this.inView) return;
|
|
35479
|
+
this.inView = value;
|
|
35480
|
+
this.sync();
|
|
35481
|
+
}
|
|
35280
35482
|
hide(animate) {
|
|
35281
35483
|
if (this.destroyed) return;
|
|
35282
35484
|
this.hidden = true;
|
|
35283
35485
|
this.setFade(this.parseFade(animate));
|
|
35284
35486
|
this.setTstop(null);
|
|
35285
|
-
this.
|
|
35286
|
-
this.
|
|
35487
|
+
this.stopClock();
|
|
35488
|
+
if (this.maxFPS <= 0) return;
|
|
35489
|
+
this.clock = this.el.animate({ "--hn-nz-t": [0, CLOCK_S] }, {
|
|
35490
|
+
duration: CLOCK_S * 1e3,
|
|
35491
|
+
easing: this.easing(),
|
|
35492
|
+
iterations: Infinity
|
|
35493
|
+
});
|
|
35494
|
+
this.running = true;
|
|
35495
|
+
this.sync();
|
|
35287
35496
|
}
|
|
35288
35497
|
reveal(animate) {
|
|
35289
35498
|
if (this.destroyed) return;
|
|
35290
35499
|
this.hidden = false;
|
|
35291
35500
|
const duration = this.parseFade(animate);
|
|
35292
35501
|
this.setFade(duration);
|
|
35293
|
-
this.setTstop(this.
|
|
35294
|
-
|
|
35295
|
-
|
|
35296
|
-
|
|
35297
|
-
|
|
35298
|
-
|
|
35299
|
-
|
|
35300
|
-
|
|
35301
|
-
|
|
35302
|
-
this.setT(this.t + dt / 1e3);
|
|
35303
|
-
this.t0 = now;
|
|
35304
|
-
};
|
|
35305
|
-
startAnimation() {
|
|
35306
|
-
this.t0 = performance.now();
|
|
35307
|
-
this.frame(this.t0);
|
|
35308
|
-
}
|
|
35309
|
-
stopAnimation() {
|
|
35310
|
-
if (this.raf !== null) {
|
|
35311
|
-
cancelAnimationFrame(this.raf);
|
|
35312
|
-
this.raf = null;
|
|
35313
|
-
}
|
|
35502
|
+
this.setTstop(this.time());
|
|
35503
|
+
clearTimeout(this.settle);
|
|
35504
|
+
const stop = () => {
|
|
35505
|
+
this.settle = void 0;
|
|
35506
|
+
this.running = false;
|
|
35507
|
+
this.sync();
|
|
35508
|
+
};
|
|
35509
|
+
if (duration <= 0) stop();
|
|
35510
|
+
else this.settle = setTimeout(stop, duration * 1e3 + 1e3 / this.maxFPS);
|
|
35314
35511
|
}
|
|
35315
35512
|
destroy() {
|
|
35316
35513
|
this.destroyed = true;
|
|
35317
|
-
this.
|
|
35514
|
+
this.stopClock();
|
|
35515
|
+
viewport?.unobserve(this.el);
|
|
35516
|
+
painters.delete(this.el);
|
|
35318
35517
|
this.el.style.removeProperty("background");
|
|
35319
|
-
for (const prop of
|
|
35320
|
-
"--hn-nz-t",
|
|
35321
|
-
"--hn-nz-stop",
|
|
35322
|
-
"--hn-nz-fade",
|
|
35323
|
-
"--hn-nz-gap",
|
|
35324
|
-
"--hn-nz-words",
|
|
35325
|
-
"--hn-nz-density",
|
|
35326
|
-
"--hn-nz-accent"
|
|
35327
|
-
]) this.el.style.removeProperty(prop);
|
|
35518
|
+
for (const prop of SPOILER_WORKLET_INPUTS) this.el.style.removeProperty(prop);
|
|
35328
35519
|
}
|
|
35329
35520
|
};
|
|
35330
35521
|
//#endregion
|