cladux-html 0.1.0 → 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 +22 -11
- package/cl.css +2246 -2
- package/cl.js +866 -2
- package/cl.min.css +2 -0
- package/cl.min.js +2 -0
- package/cl.min.mjs +2 -0
- package/cl.mjs +868 -0
- package/components/accordion.css +103 -0
- package/components/accordion.min.css +2 -0
- package/components/badge.css +100 -0
- package/components/badge.min.css +2 -0
- package/components/button.css +178 -0
- package/components/button.min.css +2 -0
- package/components/card.css +88 -0
- package/components/card.min.css +2 -0
- package/components/carousel.css +75 -0
- package/components/carousel.min.css +2 -0
- package/components/checkbox.css +80 -0
- package/components/checkbox.min.css +2 -0
- package/components/combobox.css +260 -0
- package/components/combobox.min.css +2 -0
- package/components/dialog.css +128 -0
- package/components/dialog.min.css +2 -0
- package/components/dropdown-menu.css +178 -0
- package/components/dropdown-menu.min.css +2 -0
- package/components/input.css +71 -0
- package/components/input.min.css +2 -0
- package/components/kbd.css +34 -0
- package/components/kbd.min.css +2 -0
- package/components/label.css +23 -0
- package/components/label.min.css +2 -0
- package/components/popover.css +94 -0
- package/components/popover.min.css +2 -0
- package/components/select.css +89 -0
- package/components/select.min.css +2 -0
- package/components/separator.css +16 -0
- package/components/separator.min.css +2 -0
- package/components/sheet.css +134 -0
- package/components/sheet.min.css +2 -0
- package/components/skeleton.css +15 -0
- package/components/skeleton.min.css +2 -0
- package/components/slider.css +88 -0
- package/components/slider.min.css +2 -0
- package/components/switch.css +84 -0
- package/components/switch.min.css +2 -0
- package/components/tabs.css +121 -0
- package/components/tabs.min.css +2 -0
- package/components/textarea.css +61 -0
- package/components/textarea.min.css +2 -0
- package/components/toast.css +139 -0
- package/components/toast.min.css +2 -0
- package/components/tooltip.css +115 -0
- package/components/tooltip.min.css +2 -0
- package/core.css +178 -0
- package/core.min.css +2 -0
- package/package.json +35 -4
- package/types/accordion.d.ts +1 -0
- package/types/carousel.d.ts +8 -0
- package/types/combobox.d.ts +11 -0
- package/types/dialog.d.ts +3 -0
- package/types/floating.d.ts +12 -0
- package/types/index.d.ts +16 -0
- package/types/position.d.ts +17 -0
- package/types/slider.d.ts +5 -0
- package/types/tabs.d.ts +4 -0
- package/types/toast.d.ts +21 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cladux-html",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Cladux for plain HTML: one stylesheet and one small script, from a CDN or npm.",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Cladux for plain HTML: one stylesheet, or just the components you use, and one small script, from a CDN or npm.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cladux",
|
|
7
7
|
"css",
|
|
@@ -24,16 +24,47 @@
|
|
|
24
24
|
"author": "Killer88967",
|
|
25
25
|
"type": "module",
|
|
26
26
|
"style": "cl.css",
|
|
27
|
+
"module": "cl.mjs",
|
|
28
|
+
"types": "types/index.d.ts",
|
|
27
29
|
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./types/index.d.ts",
|
|
32
|
+
"default": "./cl.mjs"
|
|
33
|
+
},
|
|
34
|
+
"./cl.mjs": {
|
|
35
|
+
"types": "./types/index.d.ts",
|
|
36
|
+
"default": "./cl.mjs"
|
|
37
|
+
},
|
|
38
|
+
"./cl.min.mjs": {
|
|
39
|
+
"types": "./types/index.d.ts",
|
|
40
|
+
"default": "./cl.min.mjs"
|
|
41
|
+
},
|
|
28
42
|
"./cl.css": "./cl.css",
|
|
43
|
+
"./cl.min.css": "./cl.min.css",
|
|
44
|
+
"./core.css": "./core.css",
|
|
45
|
+
"./core.min.css": "./core.min.css",
|
|
46
|
+
"./components/*": "./components/*",
|
|
29
47
|
"./cl.js": "./cl.js",
|
|
48
|
+
"./cl.min.js": "./cl.min.js",
|
|
30
49
|
"./package.json": "./package.json"
|
|
31
50
|
},
|
|
32
51
|
"files": [
|
|
33
52
|
"cl.css",
|
|
34
|
-
"cl.
|
|
53
|
+
"cl.min.css",
|
|
54
|
+
"core.css",
|
|
55
|
+
"core.min.css",
|
|
56
|
+
"components",
|
|
57
|
+
"cl.js",
|
|
58
|
+
"cl.min.js",
|
|
59
|
+
"cl.mjs",
|
|
60
|
+
"cl.min.mjs",
|
|
61
|
+
"types"
|
|
62
|
+
],
|
|
63
|
+
"sideEffects": [
|
|
64
|
+
"*.css",
|
|
65
|
+
"./cl.js",
|
|
66
|
+
"./cl.min.js"
|
|
35
67
|
],
|
|
36
|
-
"sideEffects": true,
|
|
37
68
|
"publishConfig": {
|
|
38
69
|
"access": "public"
|
|
39
70
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function onAccordionClick(event: MouseEvent, target: Element): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Makes the slides reachable from the keyboard, labels them, and sets the buttons. */
|
|
2
|
+
export declare function setupCarousels(root?: ParentNode): void;
|
|
3
|
+
export declare function onCarouselClick(target: Element): void;
|
|
4
|
+
export declare function onCarouselKeyDown(event: KeyboardEvent, target: Element): void;
|
|
5
|
+
/** Scroll events don't bubble, so this listens in the capture phase; one update a frame. */
|
|
6
|
+
export declare function onCarouselScroll(event: Event): void;
|
|
7
|
+
/** A mouse drags the slides; touch screens and trackpads already scroll them. */
|
|
8
|
+
export declare function onCarouselPointerDown(event: PointerEvent, target: Element): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Gives each combobox the ARIA roles and ids it needs, so the markup can stay short. */
|
|
2
|
+
export declare function setupComboboxes(root?: ParentNode): void;
|
|
3
|
+
export declare function onComboboxClick(target: Element): void;
|
|
4
|
+
export declare function onComboboxInput(target: Element): void;
|
|
5
|
+
export declare function onComboboxKeyDown(event: KeyboardEvent, target: Element): void;
|
|
6
|
+
export declare function onComboboxPointerMove(target: Element): void;
|
|
7
|
+
/** Keeps the focus in the input when the list is clicked. */
|
|
8
|
+
export declare function onComboboxPointerDown(event: PointerEvent, target: Element): void;
|
|
9
|
+
export declare function onComboboxFocusOut(event: FocusEvent, target: Element): void;
|
|
10
|
+
/** Moves open lists with their input when the page scrolls or resizes. */
|
|
11
|
+
export declare function repositionComboboxes(): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Keeps it invisible until it's been positioned, so it never flashes in the wrong spot. */
|
|
2
|
+
export declare function onFloatingBeforeToggle(event: Event): void;
|
|
3
|
+
export declare function onFloatingToggle(event: Event): void;
|
|
4
|
+
/** Re-positions open floating elements when the page scrolls or resizes. */
|
|
5
|
+
export declare function repositionOpen(): void;
|
|
6
|
+
export declare function onMenuKeyDown(event: KeyboardEvent, target: Element): void;
|
|
7
|
+
export declare function onMenuPointerMove(target: Element): void;
|
|
8
|
+
export declare function onMenuPointerLeave(event: PointerEvent): void;
|
|
9
|
+
export declare function onMenuClick(target: Element): void;
|
|
10
|
+
export declare function onTooltipEnter(event: PointerEvent | FocusEvent, target: Element): void;
|
|
11
|
+
export declare function onTooltipLeave(event: PointerEvent | FocusEvent, target: Element): void;
|
|
12
|
+
export declare function hideAllTooltips(): void;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { openDialog } from "./dialog.js";
|
|
2
|
+
import { toast } from "./toast.js";
|
|
3
|
+
export { openDialog } from "./dialog.js";
|
|
4
|
+
export { place, type Align, type PlaceOptions, type Side } from "./position.js";
|
|
5
|
+
export { toast, type ToastOptions, type ToastType } from "./toast.js";
|
|
6
|
+
/**
|
|
7
|
+
* Turns on the behavior for the CSS-only components: accordions, dialogs, popovers,
|
|
8
|
+
* dropdown menus, tooltips, tabs, sliders, comboboxes, carousels and toasts. Listeners are delegated to the
|
|
9
|
+
* document, so markup added later works too. Safe to call more than once.
|
|
10
|
+
*/
|
|
11
|
+
export declare function start(): void;
|
|
12
|
+
export declare const cl: {
|
|
13
|
+
start: typeof start;
|
|
14
|
+
toast: typeof toast;
|
|
15
|
+
openDialog: typeof openDialog;
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type Side = "top" | "bottom" | "left" | "right";
|
|
2
|
+
export type Align = "start" | "center" | "end";
|
|
3
|
+
export interface PlaceOptions {
|
|
4
|
+
side?: Side;
|
|
5
|
+
align?: Align;
|
|
6
|
+
/** Gap between the anchor and the floating element, in px. */
|
|
7
|
+
offset?: number;
|
|
8
|
+
/** Space kept free at the viewport edges, in px. */
|
|
9
|
+
padding?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Positions a fixed element next to an anchor, flipping to the other side
|
|
13
|
+
* when it doesn't fit and keeping it inside the viewport.
|
|
14
|
+
* Sets data-placed to the side used, plus a few CSS variables:
|
|
15
|
+
* --cl-anchor-width, --cl-available-height and a transform-origin.
|
|
16
|
+
*/
|
|
17
|
+
export declare function place(floating: HTMLElement, anchor: Element, options?: PlaceOptions): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function onSliderInput(target: Element): void;
|
|
2
|
+
/** Fills the sliders under `root`, and `root` itself if it's one. */
|
|
3
|
+
export declare function setupSliders(root?: ParentNode): void;
|
|
4
|
+
export declare function onFormReset(target: Element): void;
|
|
5
|
+
export declare function onSliderPointerDown(event: PointerEvent, target: Element): void;
|
package/types/tabs.d.ts
ADDED
package/types/toast.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ToastType = "default" | "success" | "info" | "warning" | "error" | "loading";
|
|
2
|
+
export interface ToastOptions {
|
|
3
|
+
description?: string;
|
|
4
|
+
type?: ToastType;
|
|
5
|
+
/** How long it stays, in ms. Use Infinity to keep it until dismissed. */
|
|
6
|
+
duration?: number;
|
|
7
|
+
action?: {
|
|
8
|
+
label: string;
|
|
9
|
+
onClick?: (event: MouseEvent) => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** Shows a toast. Returns a function that dismisses it. */
|
|
13
|
+
export declare function toast(title: string, options?: ToastOptions): () => void;
|
|
14
|
+
export declare namespace toast {
|
|
15
|
+
var success: (title: string, options?: Omit<ToastOptions, "type">) => () => void;
|
|
16
|
+
var info: (title: string, options?: Omit<ToastOptions, "type">) => () => void;
|
|
17
|
+
var warning: (title: string, options?: Omit<ToastOptions, "type">) => () => void;
|
|
18
|
+
var error: (title: string, options?: Omit<ToastOptions, "type">) => () => void;
|
|
19
|
+
}
|
|
20
|
+
/** <button data-toast="Saved" data-toast-description="..." data-toast-type="success"> */
|
|
21
|
+
export declare function onToastClick(target: Element): void;
|