@gemologic/sheen 0.2.1 → 0.3.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 +1 -1
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/ai.d.ts +8 -0
- package/dist/ai.js +5 -0
- package/dist/core.d.ts +11 -4
- package/dist/core.js +32 -28
- package/dist/formisch.js +1 -2
- package/dist/forms.d.ts +2 -0
- package/dist/forms.js +16 -15
- package/dist/index.d.ts +25 -5
- package/dist/index.js +86 -76
- package/dist/layout/Layout.js +1 -2
- package/dist/metadata.js +1 -2
- package/dist/navigation.d.ts +2 -1
- package/dist/navigation.js +16 -16
- package/dist/primitives/Accordion.js +9 -9
- package/dist/primitives/ActivityTimeline.js +57 -49
- package/dist/primitives/AlertDialog.js +1 -2
- package/dist/primitives/Avatar.js +16 -17
- package/dist/primitives/Board.d.ts +39 -0
- package/dist/primitives/Board.js +471 -0
- package/dist/primitives/Breadcrumb.js +1 -2
- package/dist/primitives/Button.js +38 -27
- package/dist/primitives/ButtonGroup.js +1 -2
- package/dist/primitives/Checkbox.js +1 -2
- package/dist/primitives/CheckboxGroup.js +11 -12
- package/dist/primitives/Collapsible.js +6 -6
- package/dist/primitives/Combobox.js +203 -201
- package/dist/primitives/CommandPalette.js +2 -4
- package/dist/primitives/ConfirmDialog.js +5 -6
- package/dist/primitives/ContextMenu.js +7 -8
- package/dist/primitives/Conversation.d.ts +17 -0
- package/dist/primitives/Conversation.js +107 -0
- package/dist/primitives/DescriptionList.js +1 -2
- package/dist/primitives/Dialog.js +101 -68
- package/dist/primitives/Drawer.js +12 -13
- package/dist/primitives/DropdownMenu.js +163 -157
- package/dist/primitives/EditableTextField.js +3 -8
- package/dist/primitives/EmptyState.js +1 -2
- package/dist/primitives/Field.js +1 -2
- package/dist/primitives/FileDropzone.js +19 -18
- package/dist/primitives/Form.d.ts +23 -0
- package/dist/primitives/Form.js +76 -0
- package/dist/primitives/Glyph.d.ts +40 -0
- package/dist/primitives/Glyph.js +65 -0
- package/dist/primitives/IconButton.js +5 -6
- package/dist/primitives/Input.js +1 -2
- package/dist/primitives/InputGroup.js +8 -9
- package/dist/primitives/Link.d.ts +9 -1
- package/dist/primitives/Link.js +23 -17
- package/dist/primitives/LinkTooltip.js +6 -7
- package/dist/primitives/List.d.ts +34 -0
- package/dist/primitives/List.js +135 -0
- package/dist/primitives/Message.d.ts +13 -0
- package/dist/primitives/Message.js +75 -0
- package/dist/primitives/NavList.js +15 -16
- package/dist/primitives/Notice.d.ts +15 -1
- package/dist/primitives/Notice.js +91 -43
- package/dist/primitives/NumberField.js +81 -81
- package/dist/primitives/NumberText.d.ts +4 -0
- package/dist/primitives/NumberText.js +50 -25
- package/dist/primitives/Pagination.js +81 -60
- package/dist/primitives/Popover.js +57 -57
- package/dist/primitives/Progress.js +1 -2
- package/dist/primitives/PromptInput.d.ts +23 -0
- package/dist/primitives/PromptInput.js +135 -0
- package/dist/primitives/RadioGroup.js +12 -17
- package/dist/primitives/Resizable.js +1 -2
- package/dist/primitives/ScrollArea.js +1 -2
- package/dist/primitives/SearchInput.js +45 -38
- package/dist/primitives/SegmentedControl.d.ts +2 -0
- package/dist/primitives/SegmentedControl.js +92 -78
- package/dist/primitives/Select.js +105 -100
- package/dist/primitives/Separator.js +1 -2
- package/dist/primitives/ShortcutPending.js +11 -12
- package/dist/primitives/ShortcutProvider.d.ts +5 -0
- package/dist/primitives/ShortcutProvider.js +71 -65
- package/dist/primitives/ShortcutScope.js +8 -9
- package/dist/primitives/ShortcutSheet.js +30 -24
- package/dist/primitives/Skeleton.js +1 -2
- package/dist/primitives/Slider.js +1 -2
- package/dist/primitives/SortableList.d.ts +19 -0
- package/dist/primitives/SortableList.js +235 -0
- package/dist/primitives/Spinner.js +1 -2
- package/dist/primitives/Status.js +14 -14
- package/dist/primitives/Stepper.js +54 -52
- package/dist/primitives/StreamingText.d.ts +12 -0
- package/dist/primitives/StreamingText.js +42 -0
- package/dist/primitives/Surface.js +1 -2
- package/dist/primitives/Switch.js +1 -2
- package/dist/primitives/Table.js +1 -2
- package/dist/primitives/Tabs.js +20 -17
- package/dist/primitives/TagInput.js +6 -9
- package/dist/primitives/Textarea.js +37 -63
- package/dist/primitives/Toast.js +42 -41
- package/dist/primitives/Toaster.js +27 -28
- package/dist/primitives/Tooltip.js +32 -32
- package/dist/primitives/Tree.js +1 -2
- package/dist/primitives/Typography.d.ts +6 -2
- package/dist/primitives/Typography.js +20 -12
- package/dist/primitives/boolean-input-state.js +3 -8
- package/dist/primitives/button-variants.js +2 -3
- package/dist/primitives/choice-options.js +1 -2
- package/dist/primitives/create-confirm.js +1 -2
- package/dist/primitives/create-toaster.js +1 -2
- package/dist/primitives/link-focus.js +1 -2
- package/dist/primitives/menu-focus.js +1 -2
- package/dist/primitives/sortable-core.d.ts +70 -0
- package/dist/primitives/sortable-core.js +109 -0
- package/dist/primitives/sortable-drag.d.ts +29 -0
- package/dist/primitives/sortable-drag.js +50 -0
- package/dist/primitives/tooltip-layer.js +26 -27
- package/dist/sortable.d.ts +6 -0
- package/dist/sortable.js +4 -0
- package/dist/theme/ThemeProvider.d.ts +6 -1
- package/dist/theme/ThemeProvider.js +65 -58
- package/dist/theme/intl.js +1 -2
- package/dist/theme/keyboard-script.js +1 -2
- package/dist/theme/layers.js +1 -2
- package/dist/theme/messages.d.ts +26 -0
- package/dist/theme/messages.js +9 -2
- package/dist/theme/number-format-cache.js +1 -2
- package/dist/theme/script.d.ts +1 -0
- package/dist/theme/script.js +3 -3
- package/dist/theme/state.d.ts +4 -4
- package/dist/theme/state.js +12 -13
- package/dist/utils/auto-resize.d.ts +6 -0
- package/dist/utils/auto-resize.js +31 -0
- package/dist/utils/browser-status.js +1 -2
- package/dist/utils/change-motion.d.ts +8 -0
- package/dist/utils/change-motion.js +19 -0
- package/dist/utils/cn.js +1 -2
- package/dist/utils/media-query.d.ts +10 -0
- package/dist/utils/media-query.js +16 -0
- package/dist/utils/optimistic.js +1 -2
- package/dist/utils/shortcut-platform.js +1 -2
- package/dist/utils/shortcut-registry.d.ts +5 -0
- package/dist/utils/shortcut-registry.js +61 -51
- package/dist/vite.js +3 -4
- package/package.json +23 -5
- package/src/ai.ts +8 -0
- package/src/core.ts +11 -4
- package/src/forms.ts +2 -0
- package/src/index.ts +25 -5
- package/src/navigation.ts +2 -1
- package/src/primitives/Accordion.tsx +1 -1
- package/src/primitives/ActivityTimeline.tsx +12 -7
- package/src/primitives/Board.tsx +406 -0
- package/src/primitives/Button.tsx +15 -4
- package/src/primitives/Collapsible.tsx +1 -1
- package/src/primitives/Combobox.tsx +2 -1
- package/src/primitives/CommandPalette.tsx +2 -2
- package/src/primitives/Conversation.tsx +108 -0
- package/src/primitives/Dialog.tsx +5 -1
- package/src/primitives/DropdownMenu.tsx +12 -6
- package/src/primitives/FileDropzone.tsx +2 -2
- package/src/primitives/Form.tsx +58 -0
- package/src/primitives/Glyph.tsx +55 -0
- package/src/primitives/Link.tsx +15 -6
- package/src/primitives/List.tsx +68 -0
- package/src/primitives/Message.tsx +40 -0
- package/src/primitives/Notice.tsx +45 -12
- package/src/primitives/NumberField.tsx +3 -2
- package/src/primitives/NumberText.tsx +31 -4
- package/src/primitives/Pagination.tsx +6 -5
- package/src/primitives/Popover.tsx +2 -1
- package/src/primitives/PromptInput.tsx +116 -0
- package/src/primitives/SearchInput.tsx +4 -3
- package/src/primitives/SegmentedControl.tsx +29 -4
- package/src/primitives/Select.tsx +3 -2
- package/src/primitives/ShortcutProvider.tsx +14 -1
- package/src/primitives/ShortcutSheet.tsx +1 -1
- package/src/primitives/SortableList.tsx +208 -0
- package/src/primitives/Status.tsx +1 -1
- package/src/primitives/Stepper.tsx +7 -7
- package/src/primitives/StreamingText.tsx +32 -0
- package/src/primitives/Tabs.tsx +2 -1
- package/src/primitives/TagInput.tsx +1 -1
- package/src/primitives/Textarea.tsx +3 -47
- package/src/primitives/Toast.tsx +2 -1
- package/src/primitives/Tooltip.tsx +4 -2
- package/src/primitives/Typography.tsx +11 -2
- package/src/primitives/button-variants.ts +1 -1
- package/src/primitives/sortable-core.ts +139 -0
- package/src/primitives/sortable-drag.ts +75 -0
- package/src/sortable.ts +6 -0
- package/src/styles/ai.css +57 -0
- package/src/styles/core.css +321 -0
- package/src/styles/forms.css +261 -0
- package/src/styles/navigation.css +137 -0
- package/src/styles/overlays.css +104 -0
- package/src/styles/sortable.css +87 -0
- package/src/styles.css +5 -658
- package/src/theme/ThemeProvider.tsx +20 -8
- package/src/theme/messages.ts +20 -1
- package/src/theme/script.ts +2 -2
- package/src/theme/state.ts +5 -5
- package/src/utils/auto-resize.ts +58 -0
- package/src/utils/change-motion.ts +28 -0
- package/src/utils/media-query.ts +26 -0
- package/src/utils/shortcut-registry.ts +19 -2
- package/src/vite.ts +3 -3
- package/vendor/integrity.json +13 -13
- package/vendor/kobalte-core/chunk/3D6FM2PJ.js +7 -1
- package/vendor/kobalte-core/chunk/G3KI2B4X.js +2 -1
- package/vendor/kobalte-core/chunk/KEL2LLJM.jsx +2 -1
- package/vendor/kobalte-core/chunk/RFN6X5VH.jsx +7 -1
- package/vendor/origins.json +4 -4
- package/vendor/solid-web/dev.cjs +21 -17
- package/vendor/solid-web/dev.js +21 -17
- package/vendor/solid-web/server.cjs +1 -1
- package/vendor/solid-web/server.js +1 -1
- package/vendor/solid-web/web.cjs +21 -17
- package/vendor/solid-web/web.js +21 -17
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** Shared, engine-free sortable model: messages, order math, keyboard intent, and pointer edge detection. */
|
|
2
|
+
export type SortableOrientation = "vertical" | "horizontal";
|
|
3
|
+
export type SortableEdge = "before" | "after";
|
|
4
|
+
export interface SortableItem {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
/** Human-readable name used for the handle and for live-region announcements. */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/** Disabled items cannot be picked up. Other items still move around them. */
|
|
9
|
+
readonly disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SortableReorder {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly fromIndex: number;
|
|
14
|
+
readonly toIndex: number;
|
|
15
|
+
/** The complete proposed order. The owner accepts it by passing reordered items back. */
|
|
16
|
+
readonly ids: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export declare const englishSortableMessages: Readonly<{
|
|
19
|
+
sortableInstructions: "Press Space or Enter to pick up. Use the arrow keys, Home, or End to move, Space or Enter to drop, and Escape to cancel.";
|
|
20
|
+
sortableHandle: "Reorder {label}";
|
|
21
|
+
sortableLifted: "Picked up {label}. Position {position} of {count}.";
|
|
22
|
+
sortableMoved: "{label}, position {position} of {count}.";
|
|
23
|
+
sortableDropped: "Dropped {label} at position {position} of {count}.";
|
|
24
|
+
sortableCancelled: "Reorder cancelled. {label} returned to position {position} of {count}.";
|
|
25
|
+
boardInstructions: "Press Space or Enter to pick up. Use the arrow keys to move within and between columns, Space or Enter to drop, and Escape to cancel.";
|
|
26
|
+
boardCardHandle: "Move {label}";
|
|
27
|
+
boardColumnHandle: "Reorder column {label}";
|
|
28
|
+
boardLifted: "Picked up {label} in {column}. Position {position} of {count}.";
|
|
29
|
+
boardMoved: "{label}, {column}, position {position} of {count}.";
|
|
30
|
+
boardDropped: "Dropped {label} in {column}, position {position} of {count}.";
|
|
31
|
+
boardCancelled: "Move cancelled. {label} returned to {column}, position {position} of {count}.";
|
|
32
|
+
boardEmptyColumn: "No cards";
|
|
33
|
+
boardCardCount: "{count} cards";
|
|
34
|
+
}>;
|
|
35
|
+
export type SortableMessages = Readonly<Record<keyof typeof englishSortableMessages, string>>;
|
|
36
|
+
/**
|
|
37
|
+
* Scoped theme messages supply provider-level translations under the same keys; per-instance overrides win.
|
|
38
|
+
* Theme messages are read structurally so the sortable entry stays independent of the core message table.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveSortableMessages(theme: object, overrides?: Partial<SortableMessages>): SortableMessages;
|
|
41
|
+
export declare function formatMessage(template: string, values: Readonly<Record<string, string>>): string;
|
|
42
|
+
export declare function validateIds(ids: readonly string[], owner: string): void;
|
|
43
|
+
/** Moves `id` so it ends at `toIndex` of the result. Out-of-range targets clamp. */
|
|
44
|
+
export declare function moveId(ids: readonly string[], id: string, toIndex: number): string[];
|
|
45
|
+
/** Final index of a source dropped on `edge` of `targetIndex`, measured in the list without the source. */
|
|
46
|
+
export declare function dropIndex(fromIndex: number, targetIndex: number, edge: SortableEdge): number;
|
|
47
|
+
export type KeyIntent = {
|
|
48
|
+
readonly kind: "toggle";
|
|
49
|
+
} | {
|
|
50
|
+
readonly kind: "cancel";
|
|
51
|
+
} | {
|
|
52
|
+
readonly kind: "step";
|
|
53
|
+
readonly axis: SortableOrientation;
|
|
54
|
+
readonly delta: -1 | 1;
|
|
55
|
+
} | {
|
|
56
|
+
readonly kind: "edge";
|
|
57
|
+
readonly to: "start" | "end";
|
|
58
|
+
};
|
|
59
|
+
/** Arrow keys follow reading direction: in RTL, ArrowLeft moves toward the end. */
|
|
60
|
+
export declare function keyIntent(key: string, rtl: boolean): KeyIntent | undefined;
|
|
61
|
+
export declare function isRtl(element: Element): boolean;
|
|
62
|
+
/** Which half of `element` the pointer is over, in logical order for its axis and writing direction. */
|
|
63
|
+
export declare function closestEdge(element: Element, input: {
|
|
64
|
+
readonly clientX: number;
|
|
65
|
+
readonly clientY: number;
|
|
66
|
+
}, orientation: SortableOrientation): SortableEdge;
|
|
67
|
+
export declare function stringField(data: Readonly<Record<string | symbol, unknown>>, key: string): string | undefined;
|
|
68
|
+
export declare function edgeField(data: Readonly<Record<string | symbol, unknown>>): SortableEdge | undefined;
|
|
69
|
+
/** Every scrolling element from each start element up to, but excluding, the document; pointer drags auto-scroll them with the window. */
|
|
70
|
+
export declare function scrollContainers(...elements: readonly HTMLElement[]): Generator<HTMLElement>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// src/primitives/sortable-core.ts
|
|
2
|
+
var e = Object.freeze({
|
|
3
|
+
sortableInstructions: "Press Space or Enter to pick up. Use the arrow keys, Home, or End to move, Space or Enter to drop, and Escape to cancel.",
|
|
4
|
+
sortableHandle: "Reorder {label}",
|
|
5
|
+
sortableLifted: "Picked up {label}. Position {position} of {count}.",
|
|
6
|
+
sortableMoved: "{label}, position {position} of {count}.",
|
|
7
|
+
sortableDropped: "Dropped {label} at position {position} of {count}.",
|
|
8
|
+
sortableCancelled: "Reorder cancelled. {label} returned to position {position} of {count}.",
|
|
9
|
+
boardInstructions: "Press Space or Enter to pick up. Use the arrow keys to move within and between columns, Space or Enter to drop, and Escape to cancel.",
|
|
10
|
+
boardCardHandle: "Move {label}",
|
|
11
|
+
boardColumnHandle: "Reorder column {label}",
|
|
12
|
+
boardLifted: "Picked up {label} in {column}. Position {position} of {count}.",
|
|
13
|
+
boardMoved: "{label}, {column}, position {position} of {count}.",
|
|
14
|
+
boardDropped: "Dropped {label} in {column}, position {position} of {count}.",
|
|
15
|
+
boardCancelled: "Move cancelled. {label} returned to {column}, position {position} of {count}.",
|
|
16
|
+
boardEmptyColumn: "No cards",
|
|
17
|
+
boardCardCount: "{count} cards"
|
|
18
|
+
}), t = Object.keys(e).filter((t) => t in e);
|
|
19
|
+
function n(n, r = {}) {
|
|
20
|
+
let i = {};
|
|
21
|
+
for (let a of t) {
|
|
22
|
+
let t = r[a], o = Reflect.get(n, a);
|
|
23
|
+
i[a] = typeof t == "string" ? t : typeof o == "string" ? o : e[a];
|
|
24
|
+
}
|
|
25
|
+
return Object.freeze({
|
|
26
|
+
...e,
|
|
27
|
+
...i
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function r(e, t) {
|
|
31
|
+
return e.replace(/\{(\w+)\}/gu, (e, n) => t[n] ?? e);
|
|
32
|
+
}
|
|
33
|
+
function i(e, t) {
|
|
34
|
+
let n = /* @__PURE__ */ new Set();
|
|
35
|
+
for (let r of e) {
|
|
36
|
+
if (!r) throw Error(`${t}: ids must be nonempty`);
|
|
37
|
+
if (n.has(r)) throw Error(`${t}: duplicate id ${JSON.stringify(r)}`);
|
|
38
|
+
n.add(r);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function a(e, t, n) {
|
|
42
|
+
let r = e.filter((e) => e !== t);
|
|
43
|
+
return r.length === e.length ? [...e] : (r.splice(Math.max(0, Math.min(r.length, n)), 0, t), r);
|
|
44
|
+
}
|
|
45
|
+
function o(e, t, n) {
|
|
46
|
+
let r = n === "after" ? t + 1 : t;
|
|
47
|
+
return e >= 0 && r > e ? r - 1 : r;
|
|
48
|
+
}
|
|
49
|
+
function s(e, t) {
|
|
50
|
+
switch (e) {
|
|
51
|
+
case " ":
|
|
52
|
+
case "Enter": return { kind: "toggle" };
|
|
53
|
+
case "Escape": return { kind: "cancel" };
|
|
54
|
+
case "ArrowUp": return {
|
|
55
|
+
kind: "step",
|
|
56
|
+
axis: "vertical",
|
|
57
|
+
delta: -1
|
|
58
|
+
};
|
|
59
|
+
case "ArrowDown": return {
|
|
60
|
+
kind: "step",
|
|
61
|
+
axis: "vertical",
|
|
62
|
+
delta: 1
|
|
63
|
+
};
|
|
64
|
+
case "ArrowLeft": return {
|
|
65
|
+
kind: "step",
|
|
66
|
+
axis: "horizontal",
|
|
67
|
+
delta: t ? 1 : -1
|
|
68
|
+
};
|
|
69
|
+
case "ArrowRight": return {
|
|
70
|
+
kind: "step",
|
|
71
|
+
axis: "horizontal",
|
|
72
|
+
delta: t ? -1 : 1
|
|
73
|
+
};
|
|
74
|
+
case "Home": return {
|
|
75
|
+
kind: "edge",
|
|
76
|
+
to: "start"
|
|
77
|
+
};
|
|
78
|
+
case "End": return {
|
|
79
|
+
kind: "edge",
|
|
80
|
+
to: "end"
|
|
81
|
+
};
|
|
82
|
+
default: return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function c(e) {
|
|
86
|
+
return e.ownerDocument.defaultView?.getComputedStyle(e).direction === "rtl";
|
|
87
|
+
}
|
|
88
|
+
function l(e, t, n) {
|
|
89
|
+
let r = e.getBoundingClientRect();
|
|
90
|
+
return n === "vertical" ? t.clientY < r.top + r.height / 2 ? "before" : "after" : t.clientX < r.left + r.width / 2 === c(e) ? "after" : "before";
|
|
91
|
+
}
|
|
92
|
+
function u(e, t) {
|
|
93
|
+
let n = e[t];
|
|
94
|
+
return typeof n == "string" ? n : void 0;
|
|
95
|
+
}
|
|
96
|
+
function d(e) {
|
|
97
|
+
let t = e.edge;
|
|
98
|
+
return t === "before" || t === "after" ? t : void 0;
|
|
99
|
+
}
|
|
100
|
+
function* f(...e) {
|
|
101
|
+
for (let t of e) {
|
|
102
|
+
let e = t.ownerDocument.defaultView;
|
|
103
|
+
for (let n = t; n && e && n !== t.ownerDocument.body && n !== t.ownerDocument.documentElement; n = n.parentElement) {
|
|
104
|
+
let t = e.getComputedStyle(n);
|
|
105
|
+
/auto|scroll/u.test(`${t.overflowX} ${t.overflowY}`) && (yield n);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export { l as closestEdge, o as dropIndex, d as edgeField, e as englishSortableMessages, r as formatMessage, c as isRtl, s as keyIntent, a as moveId, n as resolveSortableMessages, f as scrollContainers, u as stringField, i as validateIds };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** The only module that touches the pointer drag engine. Components bind on mount, so server markup never depends on it. */
|
|
2
|
+
export type DragData = Readonly<Record<string | symbol, unknown>>;
|
|
3
|
+
export interface DraggableBinding {
|
|
4
|
+
readonly element: HTMLElement;
|
|
5
|
+
readonly handle?: HTMLElement | undefined;
|
|
6
|
+
readonly data: () => Record<string, unknown>;
|
|
7
|
+
readonly canDrag: () => boolean;
|
|
8
|
+
readonly onStart: () => void;
|
|
9
|
+
readonly onEnd: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function bindDraggable(binding: DraggableBinding): () => void;
|
|
12
|
+
export interface DropTargetBinding {
|
|
13
|
+
readonly element: HTMLElement;
|
|
14
|
+
readonly accepts: (source: DragData) => boolean;
|
|
15
|
+
readonly data: (input: {
|
|
16
|
+
readonly clientX: number;
|
|
17
|
+
readonly clientY: number;
|
|
18
|
+
}, source: DragData) => Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export declare function bindDropTarget(binding: DropTargetBinding): () => void;
|
|
21
|
+
export interface MonitorBinding {
|
|
22
|
+
readonly accepts: (source: DragData) => boolean;
|
|
23
|
+
/** Innermost accepting target, or undefined while the pointer is outside every target. */
|
|
24
|
+
readonly onDrag: (source: DragData, target: DragData | undefined) => void;
|
|
25
|
+
readonly onDrop: (source: DragData, target: DragData | undefined) => void;
|
|
26
|
+
/** Scroll containers that follow the pointer near their edges, resolved when each drag starts. */
|
|
27
|
+
readonly scrollers: () => Iterable<HTMLElement>;
|
|
28
|
+
}
|
|
29
|
+
export declare function bindMonitor(binding: MonitorBinding): () => void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { autoScrollForElements as e, autoScrollWindowForElements as t } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
2
|
+
import { combine as n } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
3
|
+
import { draggable as r, dropTargetForElements as i, monitorForElements as a } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
4
|
+
// src/primitives/sortable-drag.ts
|
|
5
|
+
function o(e) {
|
|
6
|
+
return r({
|
|
7
|
+
element: e.element,
|
|
8
|
+
...e.handle ? { dragHandle: e.handle } : {},
|
|
9
|
+
canDrag: () => e.canDrag(),
|
|
10
|
+
getInitialData: () => e.data(),
|
|
11
|
+
onGenerateDragPreview: () => {
|
|
12
|
+
e.element.dataset.dragPreview = "";
|
|
13
|
+
},
|
|
14
|
+
onDragStart: () => {
|
|
15
|
+
delete e.element.dataset.dragPreview, e.onStart();
|
|
16
|
+
},
|
|
17
|
+
onDrop: () => {
|
|
18
|
+
delete e.element.dataset.dragPreview, e.onEnd();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function s(e) {
|
|
23
|
+
return i({
|
|
24
|
+
element: e.element,
|
|
25
|
+
canDrop: ({ source: t }) => e.accepts(t.data),
|
|
26
|
+
getData: ({ input: t, source: n }) => e.data(t, n.data)
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function c(r) {
|
|
30
|
+
let i, o = () => {
|
|
31
|
+
i?.(), i = void 0;
|
|
32
|
+
}, s = a({
|
|
33
|
+
canMonitor: ({ source: e }) => r.accepts(e.data),
|
|
34
|
+
onDragStart: ({ source: a, location: s }) => {
|
|
35
|
+
o(), i = n(...[...new Set(r.scrollers())].map((t) => e({
|
|
36
|
+
element: t,
|
|
37
|
+
getAllowedAxis: () => "all"
|
|
38
|
+
})), t()), r.onDrag(a.data, s.current.dropTargets[0]?.data);
|
|
39
|
+
},
|
|
40
|
+
onDrag: ({ source: e, location: t }) => r.onDrag(e.data, t.current.dropTargets[0]?.data),
|
|
41
|
+
onDropTargetChange: ({ source: e, location: t }) => r.onDrag(e.data, t.current.dropTargets[0]?.data),
|
|
42
|
+
onDrop: ({ source: e, location: t }) => {
|
|
43
|
+
o(), r.onDrop(e.data, t.current.dropTargets[0]?.data);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return () => {
|
|
47
|
+
o(), s();
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export { o as bindDraggable, s as bindDropTarget, c as bindMonitor };
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Kbd as e } from "./Typography.js";
|
|
2
|
+
import { useTheme as t } from "../theme/ThemeProvider.js";
|
|
3
3
|
import { createComponent as n, insert as r, template as i } from "solid-js/web";
|
|
4
4
|
import { Show as a, createEffect as o, createMemo as s, createSignal as c, createUniqueId as l, onCleanup as u, onMount as d } from "solid-js";
|
|
5
5
|
import * as f from "#sheen-kobalte/tooltip";
|
|
6
|
-
|
|
6
|
+
// src/primitives/tooltip-layer.tsx
|
|
7
7
|
var p = /*#__PURE__*/ i("<span>");
|
|
8
|
-
function m(
|
|
9
|
-
let r =
|
|
8
|
+
function m(e, n) {
|
|
9
|
+
let r = t(), i = l(), [a, f] = c(!1), p = !1;
|
|
10
10
|
o(() => {
|
|
11
11
|
a() && u(r.layers.register(i));
|
|
12
12
|
}), o(() => {
|
|
13
13
|
if (n()) f(!1);
|
|
14
14
|
else {
|
|
15
|
-
let
|
|
16
|
-
|
|
15
|
+
let t = e();
|
|
16
|
+
t && t.ownerDocument.activeElement === t && f(!0);
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
let m = s((e) => a() ? r.layers.zIndex(i) : e ?? 100);
|
|
20
20
|
return d(() => {
|
|
21
|
-
let
|
|
22
|
-
if (!
|
|
21
|
+
let t = e();
|
|
22
|
+
if (!t) return;
|
|
23
23
|
let r = () => {
|
|
24
|
-
|
|
24
|
+
t.matches(":hover") || (p = !1);
|
|
25
25
|
}, i = () => {
|
|
26
|
-
|
|
26
|
+
t.ownerDocument.activeElement !== t && (p = !1);
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}), !n() && (
|
|
28
|
+
t.addEventListener("blur", r), t.addEventListener("pointerleave", i), u(() => {
|
|
29
|
+
t.removeEventListener("blur", r), t.removeEventListener("pointerleave", i);
|
|
30
|
+
}), !n() && (t.ownerDocument.activeElement === t || t.matches(":hover")) && f(!0);
|
|
31
31
|
}), {
|
|
32
32
|
theme: r,
|
|
33
33
|
id: i,
|
|
@@ -39,10 +39,10 @@ function m(t, n) {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function h(
|
|
42
|
+
function h(t) {
|
|
43
43
|
return n(a, {
|
|
44
44
|
get when() {
|
|
45
|
-
return
|
|
45
|
+
return t.state.theme.portal();
|
|
46
46
|
},
|
|
47
47
|
children: (i) => n(f.Portal, {
|
|
48
48
|
get mount() {
|
|
@@ -51,29 +51,29 @@ function h(e) {
|
|
|
51
51
|
get children() {
|
|
52
52
|
return n(f.Content, {
|
|
53
53
|
get id() {
|
|
54
|
-
return `${
|
|
54
|
+
return `${t.state.id}-content`;
|
|
55
55
|
},
|
|
56
56
|
"data-kb-top-layer": "true",
|
|
57
57
|
class: "sheen-tooltip",
|
|
58
58
|
get "aria-hidden"() {
|
|
59
|
-
return !
|
|
59
|
+
return !t.state.open() || void 0;
|
|
60
60
|
},
|
|
61
61
|
get style() {
|
|
62
|
-
return { "z-index":
|
|
62
|
+
return { "z-index": t.state.layer() };
|
|
63
63
|
},
|
|
64
|
-
onEscapeKeyDown: (
|
|
65
|
-
|
|
64
|
+
onEscapeKeyDown: (e) => {
|
|
65
|
+
t.state.theme.layers.isTop(t.state.id) ? t.state.dismiss() : e.preventDefault();
|
|
66
66
|
},
|
|
67
67
|
get children() {
|
|
68
68
|
return [(() => {
|
|
69
|
-
var
|
|
70
|
-
return r(
|
|
69
|
+
var e = p();
|
|
70
|
+
return r(e, () => t.content), e;
|
|
71
71
|
})(), n(a, {
|
|
72
72
|
get when() {
|
|
73
|
-
return
|
|
73
|
+
return t.shortcut?.();
|
|
74
74
|
},
|
|
75
|
-
children: (
|
|
76
|
-
return
|
|
75
|
+
children: (t) => n(e, { get children() {
|
|
76
|
+
return t();
|
|
77
77
|
} })
|
|
78
78
|
})];
|
|
79
79
|
}
|
|
@@ -82,5 +82,4 @@ function h(e) {
|
|
|
82
82
|
})
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
//#endregion
|
|
86
85
|
export { h as TooltipLayer, m as createTooltipLayer };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { SortableList } from "./primitives/SortableList.tsx";
|
|
2
|
+
export type { SortableListProps } from "./primitives/SortableList.tsx";
|
|
3
|
+
export { Board } from "./primitives/Board.tsx";
|
|
4
|
+
export type { BoardProps, BoardColumn, BoardMove, BoardCardOf } from "./primitives/Board.tsx";
|
|
5
|
+
export { englishSortableMessages, resolveSortableMessages } from "./primitives/sortable-core.ts";
|
|
6
|
+
export type { SortableItem, SortableReorder, SortableOrientation, SortableMessages } from "./primitives/sortable-core.ts";
|
package/dist/sortable.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SortableList as e } from "./primitives/SortableList.js";
|
|
2
|
+
import { Board as t } from "./primitives/Board.js";
|
|
3
|
+
import { englishSortableMessages as n, resolveSortableMessages as r } from "./primitives/sortable-core.js";
|
|
4
|
+
export { t as Board, e as SortableList, n as englishSortableMessages, r as resolveSortableMessages };
|
|
@@ -12,18 +12,21 @@ interface ThemeRuntime {
|
|
|
12
12
|
portal: Accessor<HTMLElement | undefined>;
|
|
13
13
|
tokenTarget: Accessor<HTMLElement | undefined>;
|
|
14
14
|
themes: readonly ThemeMetadata[];
|
|
15
|
+
/** Every selectable accent ID: the bundled accents plus registered custom accents. */
|
|
16
|
+
accents: readonly string[];
|
|
15
17
|
nonce: string | undefined;
|
|
16
18
|
layers: OverlayStack;
|
|
17
19
|
messages: Accessor<Messages>;
|
|
18
20
|
set: (next: Partial<ThemeState>) => Promise<void>;
|
|
19
21
|
}
|
|
20
|
-
export interface ThemeContextValue extends Omit<ThemeRuntime, "themes"> {
|
|
22
|
+
export interface ThemeContextValue extends Omit<ThemeRuntime, "themes" | "accents"> {
|
|
21
23
|
theme: Accessor<string>;
|
|
22
24
|
mode: Accessor<ThemeState["mode"]>;
|
|
23
25
|
accent: Accessor<ThemeState["accent"]>;
|
|
24
26
|
density: Accessor<ThemeState["density"]>;
|
|
25
27
|
radius: Accessor<ThemeState["radius"]>;
|
|
26
28
|
themes: Accessor<readonly ThemeMetadata[]>;
|
|
29
|
+
accents: Accessor<readonly string[]>;
|
|
27
30
|
setTheme: (value: string) => Promise<void>;
|
|
28
31
|
setMode: (value: ThemeState["mode"]) => Promise<void>;
|
|
29
32
|
setAccent: (value: ThemeState["accent"]) => Promise<void>;
|
|
@@ -42,6 +45,8 @@ export interface ThemeProviderProps extends ParentProps {
|
|
|
42
45
|
direction?: ThemeState["direction"];
|
|
43
46
|
locale?: string;
|
|
44
47
|
themes?: readonly ThemeMetadata[];
|
|
48
|
+
/** Custom accent IDs built with `defineAccent`/`buildAccent`; their CSS must be loaded by the app. */
|
|
49
|
+
accents?: readonly string[];
|
|
45
50
|
storageKey?: string;
|
|
46
51
|
hydration?: "client" | "cookie";
|
|
47
52
|
persist?: (state: ThemeState) => Promise<void>;
|