@fusion.dev/helix-headless 0.165.0 → 0.167.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/custom-elements.json +3235 -534
- package/dist/callout/root/callout-root.d.ts +8 -2
- package/dist/callout/root/callout-root.js +14 -1
- package/dist/canvas/arrange.d.ts +32 -0
- package/dist/canvas/arrange.js +144 -0
- package/dist/canvas/paste.d.ts +25 -0
- package/dist/canvas/paste.js +58 -0
- package/dist/canvas/root/canvas-root.d.ts +60 -3
- package/dist/canvas/root/canvas-root.js +166 -2
- package/dist/chat/composer/chat-composer.js +5 -1
- package/dist/code-block/root/code-block-root.d.ts +63 -0
- package/dist/code-block/root/code-block-root.js +117 -6
- package/dist/combobox/root/combobox-root.d.ts +6 -1
- package/dist/combobox/root/combobox-root.js +2 -2
- package/dist/date-input/root/date-input-root.d.ts +1 -1
- package/dist/element-events.generated.js +17 -2
- package/dist/file-input/root/file-input-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.js +1 -1
- package/dist/filter-input/menu/filter-menu.d.ts +1 -0
- package/dist/filter-input/menu/filter-menu.js +1 -1
- package/dist/format-date/root/format-date-root.d.ts +10 -3
- package/dist/format-date/root/format-date-root.js +6 -1
- package/dist/listbox/root/listbox-root.d.ts +12 -1
- package/dist/listbox/root/listbox-root.js +15 -6
- package/dist/menu/item/menu-item.d.ts +20 -0
- package/dist/menu/item/menu-item.js +53 -20
- package/dist/menu/root/menu-root.d.ts +84 -1
- package/dist/menu/root/menu-root.js +187 -44
- package/dist/object-inspector/root/object-inspector-root.d.ts +5 -0
- package/dist/object-inspector/root/object-inspector-root.js +5 -0
- package/dist/select/root/select-root.js +1 -1
- package/dist/steps/root/steps-root.d.ts +7 -0
- package/dist/steps/root/steps-root.js +7 -0
- package/dist/table/grid-controller.d.ts +10 -0
- package/dist/table/grid-controller.js +7 -0
- package/dist/table/root/table-root.d.ts +71 -1
- package/dist/table/root/table-root.js +122 -7
- package/dist/table/row/table-row.d.ts +17 -0
- package/dist/table/row/table-row.js +23 -0
- package/dist/time-input/root/time-input-root.d.ts +2 -1
- package/dist/time-input/root/time-input-root.js +1 -1
- package/dist/time-picker/root/time-picker-root.d.ts +48 -1
- package/dist/time-picker/root/time-picker-root.js +79 -21
- package/dist/video/root/video-root.d.ts +2 -0
- package/dist/video/root/video-root.js +4 -2
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +1 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +1 -1
- package/dist/video-playlist/root/video-playlist-root.js +15 -1
- package/dist/virtual-list/root/virtual-list-root.d.ts +70 -2
- package/dist/virtual-list/root/virtual-list-root.js +216 -32
- package/dist/virtual-list/sections.d.ts +27 -0
- package/dist/virtual-list/sections.js +43 -0
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +716 -96
- package/types/vue.d.ts +148 -12
- package/types/words.d.ts +45 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Where each section starts in the items, and what it is called. */
|
|
2
|
+
export interface Sections {
|
|
3
|
+
/** The section names, in order. */
|
|
4
|
+
names: string[];
|
|
5
|
+
/** The index of each section's first item, in order. */
|
|
6
|
+
starts: number[];
|
|
7
|
+
}
|
|
8
|
+
/** The sections `field` divides the items into. */
|
|
9
|
+
export declare const sectionsOf: (items: readonly unknown[], field: string) => Sections;
|
|
10
|
+
/** The section item `item` is in. */
|
|
11
|
+
export declare const sectionAt: ({ starts }: Sections, item: number) => number;
|
|
12
|
+
/** The entry item `item` is. */
|
|
13
|
+
export declare const entryOf: (sections: Sections, item: number) => number;
|
|
14
|
+
/** The entry of section `section`'s header. */
|
|
15
|
+
export declare const headOf: ({ starts }: Sections, section: number) => number;
|
|
16
|
+
/**
|
|
17
|
+
* The items a span of entries holds: what a window of entries draws, or what
|
|
18
|
+
* a reader sees. A header at either end holds no item, so the span starts at
|
|
19
|
+
* its section's first item.
|
|
20
|
+
*/
|
|
21
|
+
export declare const itemsIn: (sections: Sections, entries: {
|
|
22
|
+
first: number;
|
|
23
|
+
last: number;
|
|
24
|
+
}, count: number) => {
|
|
25
|
+
first: number;
|
|
26
|
+
last: number;
|
|
27
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { valueAt } from '@fusion.dev/helix-core';
|
|
2
|
+
import { textOf } from './fill.js';
|
|
3
|
+
export const sectionsOf = (items, field) => {
|
|
4
|
+
const names = [];
|
|
5
|
+
const starts = [];
|
|
6
|
+
let last;
|
|
7
|
+
for (const [at, item] of items.entries()) {
|
|
8
|
+
const name = textOf(valueAt(item, field));
|
|
9
|
+
if (at === 0 || name !== last) {
|
|
10
|
+
names.push(name);
|
|
11
|
+
starts.push(at);
|
|
12
|
+
last = name;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return { names, starts };
|
|
16
|
+
};
|
|
17
|
+
const lastUpTo = (length, at, target) => {
|
|
18
|
+
let low = 0;
|
|
19
|
+
let high = length - 1;
|
|
20
|
+
while (low < high) {
|
|
21
|
+
const middle = Math.ceil((low + high) / 2);
|
|
22
|
+
if (at(middle) <= target) {
|
|
23
|
+
low = middle;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
high = middle - 1;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return low;
|
|
30
|
+
};
|
|
31
|
+
export const sectionAt = ({ starts }, item) => lastUpTo(starts.length, (index) => starts[index] ?? 0, item);
|
|
32
|
+
export const entryOf = (sections, item) => item + sectionAt(sections, item) + 1;
|
|
33
|
+
export const headOf = ({ starts }, section) => (starts[section] ?? 0) + section;
|
|
34
|
+
export const itemsIn = (sections, entries, count) => {
|
|
35
|
+
const item = (entry) => {
|
|
36
|
+
if (entry >= count + sections.starts.length) {
|
|
37
|
+
return count;
|
|
38
|
+
}
|
|
39
|
+
const section = lastUpTo(sections.starts.length, (index) => headOf(sections, index), entry);
|
|
40
|
+
return Math.max(sections.starts[section] ?? 0, entry - section - 1);
|
|
41
|
+
};
|
|
42
|
+
return { first: item(entries.first), last: Math.max(item(entries.first), item(entries.last)) };
|
|
43
|
+
};
|