@threadlabs/looma 0.44.1 → 0.44.3
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/components/shared/icons.js +1 -0
- package/components/ui-badge/ui-badge.html +7 -6
- package/components/ui-button/ui-button.html +47 -2
- package/components/ui-card/ui-card.html +6 -6
- package/components/ui-color-picker/ui-color-picker.html +12 -5
- package/components/ui-color-picker/ui-color-picker.js +20 -6
- package/components/ui-dialog/ui-dialog.html +5 -6
- package/components/ui-disclosure/ui-disclosure.html +1 -1
- package/components/ui-icon/ui-icon.html +1 -0
- package/components/ui-icon-button/ui-icon-button.html +59 -4
- package/components/ui-menu/ui-menu.html +5 -6
- package/components/ui-number-input/ui-number-input.html +7 -0
- package/components/ui-popover/ui-popover.html +5 -6
- package/components/ui-slider/ui-slider.html +6 -0
- package/components/ui-tooltip/ui-tooltip.html +8 -5
- package/components/ui-tree-item/ui-tree-item.html +7 -1
- package/dist/index.js +1 -1
- package/docs/README.md +18 -4
- package/docs/catalog.json +474 -3705
- package/docs/customizer-render.mjs +55 -36
- package/docs/customizer.js +48 -33
- package/docs/fonts.mjs +28 -0
- package/docs/index.d.ts +1 -1
- package/docs/navigation.mjs +26 -0
- package/docs/site.mjs +5 -1
- package/docs/theme.mjs +39 -14
- package/editor/icons.d.ts +1 -0
- package/editor/index.js +2 -1
- package/package.json +1 -1
- package/styles/ui-badge.css +11 -10
- package/styles/ui-button.css +47 -2
- package/styles/ui-card.css +4 -4
- package/styles/ui-color-picker.css +105 -2
- package/styles/ui-dialog.css +10 -12
- package/styles/ui-disclosure.css +1 -1
- package/styles/ui-icon-button.css +59 -4
- package/styles/ui-menu.css +5 -6
- package/styles/ui-number-input.css +6 -0
- package/styles/ui-popover.css +5 -6
- package/styles/ui-slider.css +3 -0
- package/styles/ui-tooltip.css +8 -5
- package/styles/ui-tree-item.css +12 -2
- package/theme-system.css +28 -16
- package/tokens.css +7 -0
- package/vanilla/UiColorPicker.d.ts +1 -0
- package/vanilla/UiColorPicker.js +32 -28
- package/vanilla/UiIcon.js +1 -1
- package/vanilla/UiNumberInput.d.ts +1 -0
- package/vanilla/UiNumberInput.js +53 -43
- package/vanilla/UiSlider.d.ts +1 -0
- package/vanilla/UiSlider.js +65 -57
- package/vanilla/UiTreeItem.js +1 -1
- package/vue/UiBadge.vue +7 -9
- package/vue/UiButton.vue +56 -2
- package/vue/UiCard.vue +13 -5
- package/vue/UiColorPicker.d.ts +6 -0
- package/vue/UiColorPicker.vue +156 -6
- package/vue/UiDialog.vue +22 -12
- package/vue/UiDisclosure.vue +1 -1
- package/vue/UiIcon.vue +1 -0
- package/vue/UiIconButton.vue +62 -4
- package/vue/UiMenu.vue +11 -6
- package/vue/UiNumberInput.d.ts +6 -0
- package/vue/UiNumberInput.vue +47 -1
- package/vue/UiPopover.vue +11 -6
- package/vue/UiSlider.d.ts +6 -0
- package/vue/UiSlider.vue +37 -1
- package/vue/UiTooltip.vue +11 -5
- package/vue/UiTreeItem.vue +19 -3
- package/vue/chunks/UiBadge.js +1 -1
- package/vue/chunks/UiButton.js +1 -1
- package/vue/chunks/UiCard.js +2 -2
- package/vue/chunks/UiColorPicker.js +60 -11
- package/vue/chunks/UiDialog.js +1 -1
- package/vue/chunks/UiDisclosure.js +1 -1
- package/vue/chunks/UiIcon.js +5 -1
- package/vue/chunks/UiIconButton.js +1 -1
- package/vue/chunks/UiMenu.js +1 -1
- package/vue/chunks/UiNumberInput.js +31 -2
- package/vue/chunks/UiPopover.js +1 -1
- package/vue/chunks/UiSlider.js +33 -2
- package/vue/chunks/UiTooltip.js +1 -1
- package/vue/chunks/UiTreeItem.js +3 -3
- package/vue/components.css +459 -86
- package/vue/editor/index.js +4 -0
- package/docs/examples/ui-editor-footnote-editor/examples/01-note.behavior.js +0 -9
- package/docs/examples/ui-editor-mention-menu/examples/00-preview.behavior.js +0 -1
- package/docs/examples/ui-editor-slash-menu/examples/00-preview.behavior.js +0 -81
- package/docs/examples/ui-editor-table-overlay/examples/00-preview.behavior.js +0 -24
package/vue/editor/index.js
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { componentRegistry } from "@nextwebwg/html-next/runtime";
|
|
2
|
-
export default function setupExample(root) {
|
|
3
|
-
const popover = root.querySelector('[data-note-popover]');
|
|
4
|
-
const editor = root.querySelector('[data-note-editor]');
|
|
5
|
-
const done = () => { if (popover)
|
|
6
|
-
componentRegistry.update(popover, { open: false }); };
|
|
7
|
-
editor?.addEventListener("done", done);
|
|
8
|
-
return () => editor?.removeEventListener("done", done);
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { openPicker as default } from "../../ui-editor-slash-menu/examples/00-preview.behavior.js";
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { componentRegistry } from "@nextwebwg/html-next/runtime";
|
|
2
|
-
/** The host owns keyboard selection and dismissal for editor suggestion surfaces. */
|
|
3
|
-
export function openPicker(root) {
|
|
4
|
-
const trigger = root.querySelector("[data-demo-trigger]");
|
|
5
|
-
const surface = root.querySelector("[data-demo-surface]");
|
|
6
|
-
if (!trigger || !surface)
|
|
7
|
-
return () => { };
|
|
8
|
-
let open = false, selectedIndex = 0, frame = 0;
|
|
9
|
-
const options = () => [...surface.querySelectorAll('[role="option"]')].filter(option => !option.hidden && option.getAttribute("aria-disabled") !== "true");
|
|
10
|
-
const select = (index) => {
|
|
11
|
-
const rows = options();
|
|
12
|
-
selectedIndex = rows.length ? (index + rows.length) % rows.length : 0;
|
|
13
|
-
componentRegistry.update(surface, { selectedIndex });
|
|
14
|
-
const active = rows[selectedIndex];
|
|
15
|
-
if (active?.id)
|
|
16
|
-
surface.setAttribute("aria-activedescendant", active.id);
|
|
17
|
-
};
|
|
18
|
-
const close = () => {
|
|
19
|
-
open = false;
|
|
20
|
-
cancelAnimationFrame(frame);
|
|
21
|
-
componentRegistry.update(surface, { open: false });
|
|
22
|
-
trigger.setAttribute("aria-expanded", "false");
|
|
23
|
-
};
|
|
24
|
-
const commit = () => { close(); trigger.focus(); };
|
|
25
|
-
const toggle = () => {
|
|
26
|
-
if (open) {
|
|
27
|
-
close();
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
open = true;
|
|
31
|
-
selectedIndex = 0;
|
|
32
|
-
componentRegistry.update(surface, { open: true, selectedIndex, anchorRect: trigger.getBoundingClientRect().toJSON() });
|
|
33
|
-
trigger.setAttribute("aria-expanded", "true");
|
|
34
|
-
frame = requestAnimationFrame(() => { select(0); surface.focus(); });
|
|
35
|
-
};
|
|
36
|
-
const keyboard = (event) => {
|
|
37
|
-
if (!open) {
|
|
38
|
-
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
39
|
-
event.preventDefault();
|
|
40
|
-
toggle();
|
|
41
|
-
}
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (event.key === "Escape") {
|
|
45
|
-
event.preventDefault();
|
|
46
|
-
commit();
|
|
47
|
-
}
|
|
48
|
-
else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
49
|
-
event.preventDefault();
|
|
50
|
-
select(selectedIndex + (event.key === "ArrowDown" ? 1 : -1));
|
|
51
|
-
}
|
|
52
|
-
else if (event.key === "Enter") {
|
|
53
|
-
event.preventDefault();
|
|
54
|
-
options()[selectedIndex]?.click();
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const highlight = (event) => select(event.detail.index);
|
|
58
|
-
const reposition = () => { if (open)
|
|
59
|
-
componentRegistry.update(surface, { anchorRect: trigger.getBoundingClientRect().toJSON() }); };
|
|
60
|
-
const view = root.ownerDocument.defaultView;
|
|
61
|
-
const outside = (event) => { if (open && !surface.contains(event.target) && !trigger.contains(event.target))
|
|
62
|
-
close(); };
|
|
63
|
-
trigger.addEventListener("click", toggle);
|
|
64
|
-
root.addEventListener("keydown", keyboard);
|
|
65
|
-
surface.addEventListener("select", commit);
|
|
66
|
-
surface.addEventListener("highlight", highlight);
|
|
67
|
-
view?.addEventListener("scroll", reposition, { capture: true, passive: true });
|
|
68
|
-
view?.addEventListener("resize", reposition);
|
|
69
|
-
root.ownerDocument.addEventListener("pointerdown", outside);
|
|
70
|
-
return () => {
|
|
71
|
-
cancelAnimationFrame(frame);
|
|
72
|
-
trigger.removeEventListener("click", toggle);
|
|
73
|
-
root.removeEventListener("keydown", keyboard);
|
|
74
|
-
surface.removeEventListener("select", commit);
|
|
75
|
-
surface.removeEventListener("highlight", highlight);
|
|
76
|
-
view?.removeEventListener("scroll", reposition, true);
|
|
77
|
-
view?.removeEventListener("resize", reposition);
|
|
78
|
-
root.ownerDocument.removeEventListener("pointerdown", outside);
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
export default openPicker;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { componentRegistry } from "@nextwebwg/html-next/runtime";
|
|
2
|
-
/** Keep the controls aligned with the real cells at every preview width. */
|
|
3
|
-
export default function setup(root) {
|
|
4
|
-
const surface = root.querySelector("[data-demo-table-controls]");
|
|
5
|
-
const table = surface?.querySelector("table");
|
|
6
|
-
if (!surface || !table)
|
|
7
|
-
return () => { };
|
|
8
|
-
const measure = () => {
|
|
9
|
-
const origin = surface.getBoundingClientRect();
|
|
10
|
-
const rows = [...table.rows], cells = [...(rows[0]?.cells ?? [])];
|
|
11
|
-
if (!rows.length || !cells.length)
|
|
12
|
-
return;
|
|
13
|
-
const cell = cells[0].getBoundingClientRect();
|
|
14
|
-
componentRegistry.update(surface, { geometry: {
|
|
15
|
-
rowBoundaries: [...rows.map(row => row.getBoundingClientRect().top - origin.top), rows.at(-1).getBoundingClientRect().bottom - origin.top],
|
|
16
|
-
columnBoundaries: [...cells.map(cell => cell.getBoundingClientRect().left - origin.left), cells.at(-1).getBoundingClientRect().right - origin.left],
|
|
17
|
-
activeCell: { left: cell.left - origin.left, top: cell.top - origin.top, width: cell.width, height: cell.height, rowIndex: 0, columnIndex: 0 },
|
|
18
|
-
} });
|
|
19
|
-
};
|
|
20
|
-
const observer = new ResizeObserver(measure);
|
|
21
|
-
observer.observe(table);
|
|
22
|
-
measure();
|
|
23
|
-
return () => observer.disconnect();
|
|
24
|
-
}
|