actual-css 0.19.1 → 0.19.2

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/actual.full.css +20 -0
  3. package/dist/actual.full.js +1 -1
  4. package/dist/actual.full.min.css +1 -1
  5. package/dist/types/ajax.d.ts +1 -0
  6. package/dist/types/command.d.ts +41 -0
  7. package/dist/types/context-menu.d.ts +1 -0
  8. package/dist/types/dialog.d.ts +3 -0
  9. package/dist/types/dirty.d.ts +15 -0
  10. package/dist/types/dismiss.d.ts +1 -0
  11. package/dist/types/enhance.d.ts +36 -0
  12. package/dist/types/enhancement-loader.d.ts +27 -0
  13. package/dist/types/escape.d.ts +1 -0
  14. package/dist/types/events.d.ts +14 -0
  15. package/dist/types/filter.d.ts +1 -0
  16. package/dist/types/floating-space.d.ts +16 -0
  17. package/dist/types/flyout.d.ts +1 -0
  18. package/dist/types/focus-group.d.ts +4 -0
  19. package/dist/types/focus.d.ts +4 -0
  20. package/dist/types/form-submission.d.ts +12 -0
  21. package/dist/types/full.d.ts +22 -0
  22. package/dist/types/in-view.d.ts +1 -0
  23. package/dist/types/index.d.ts +1 -0
  24. package/dist/types/inline-visible.d.ts +1 -0
  25. package/dist/types/input.d.ts +4 -0
  26. package/dist/types/keys.d.ts +5 -0
  27. package/dist/types/mask.d.ts +1 -0
  28. package/dist/types/menu.d.ts +12 -0
  29. package/dist/types/parse-config.d.ts +2 -0
  30. package/dist/types/parsed.d.ts +1 -0
  31. package/dist/types/password.d.ts +1 -0
  32. package/dist/types/range.d.ts +1 -0
  33. package/dist/types/scrollspy.d.ts +1 -0
  34. package/dist/types/selectors.d.ts +14 -0
  35. package/dist/types/status.d.ts +5 -0
  36. package/dist/types/surface.d.ts +6 -0
  37. package/dist/types/tab.d.ts +1 -0
  38. package/dist/types/tooltip.d.ts +68 -0
  39. package/dist/types/transition.d.ts +1 -0
  40. package/dist/types/validation.d.ts +17 -0
  41. package/docs/pages/enhancements/flyout.md +3 -1
  42. package/docs/pages/guides/progressive-enhancement.md +5 -1
  43. package/package.json +36 -34
  44. package/src/css/components/flyout.css +20 -0
  45. package/src/js/context-menu.js +10 -2
  46. package/src/js/enhance.js +18 -4
  47. package/src/js/full.js +3 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Resolve a trigger's current `commandfor` target in the same document or
3
+ * shadow root.
4
+ *
5
+ * @param {Element} trigger Element carrying the `commandfor` attribute.
6
+ * @returns {Element | null} The current target, or `null` when it cannot be resolved.
7
+ */
8
+ export declare function targetFor(trigger: Element): Element | null;
9
+ /**
10
+ * Build the button selector corresponding to one or more command names.
11
+ *
12
+ * Native keywords match case-insensitively, custom commands exactly — the
13
+ * same rule the router applies.
14
+ *
15
+ * @param {string | string[]} commands Command name or names to include.
16
+ * @returns {string} A selector matching command buttons with `commandfor`.
17
+ * @throws {TypeError} When a name is neither native nor a custom `--` command.
18
+ */
19
+ export declare function commandSelector(commands: string | string[]): string;
20
+ /**
21
+ * Register one behavior for one or more command names.
22
+ *
23
+ * The router cancels the click once `resolve` returns a target, so `handle`
24
+ * runs with `event.defaultPrevented` already true.
25
+ *
26
+ * @param {string | string[]} commands Command name or names owned by this behavior.
27
+ * @param {object} options Behavior callbacks.
28
+ * @param {(trigger: HTMLButtonElement) => Element | null} [options.resolve=targetFor]
29
+ * Resolver evaluated for every action.
30
+ * @param {(event: MouseEvent, trigger: HTMLButtonElement, target: Element, command: string) => void} options.handle
31
+ * Command handler.
32
+ * @returns {{ disconnect: () => void }} An idempotent registration teardown handle.
33
+ * @throws {TypeError} When command names or callbacks are invalid.
34
+ * @throws {Error} When a command already has an owner in the current document.
35
+ */
36
+ export declare function registerCommands(commands: string | string[], { resolve, handle }?: {
37
+ resolve?: (trigger: HTMLButtonElement) => Element | null;
38
+ handle: (event: MouseEvent, trigger: HTMLButtonElement, target: Element, command: string) => void;
39
+ }): {
40
+ disconnect: () => void;
41
+ };
@@ -0,0 +1 @@
1
+ export declare function contextFor(menu: any): any;
@@ -0,0 +1,3 @@
1
+ export declare function closeDialog(dialog: any, returnValue?: string): void;
2
+ export declare function requestDialogClose(dialog: any, returnValue?: string): void;
3
+ export declare function openDialog(dialog: any, trigger?: null, forcedModal?: null): void;
@@ -0,0 +1,15 @@
1
+ export declare class FormDirty {
2
+ /**
3
+ * Opaque snapshot of what the form would submit. Take it at submit time
4
+ * and pass it to markClean() once that submission is saved, so edits
5
+ * made during the request stay dirty.
6
+ */
7
+ static capture(form: any): string;
8
+ /**
9
+ * Makes `snapshot` (default: current data) the new baseline. Also valid
10
+ * before the form is enhanced: connection keeps an existing baseline.
11
+ */
12
+ static markClean(form: any, snapshot: any): void;
13
+ /** Re-evaluates an enhanced form after programmatic edits or added controls. */
14
+ static refresh(form: any): void;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ export type Enhancer = (el: Element) => (() => void) | void;
2
+ export type EnhancementHandle = {
3
+ /**
4
+ * Scan a node and its descendants.
5
+ */
6
+ refresh: (node: Node) => void;
7
+ /**
8
+ * Stop observing and run active cleanups.
9
+ */
10
+ disconnect: () => void;
11
+ };
12
+ /**
13
+ * Apply a named opt-in once; presentation selectors remain application-owned.
14
+ * @param {string} name
15
+ * @param {string} selector
16
+ * @param {Document | Element | DocumentFragment | null} [root] Query scope, excluding itself.
17
+ * @returns {Element[]} Matched descendants.
18
+ */
19
+ export declare function applyEnhancement(name: string, selector: string, root?: Document | Element | DocumentFragment | null): Element[];
20
+ /**
21
+ * @param {string} name
22
+ * @param {Enhancer} init
23
+ * @param {Document | Element | DocumentFragment | null} [root]
24
+ * @returns {EnhancementHandle}
25
+ */
26
+ export declare function registerEnhancement(name: string, init: Enhancer, root?: Document | Element | DocumentFragment | null): EnhancementHandle;
27
+ /**
28
+ * @param {Record<string, Enhancer>} enhancers
29
+ * @param {Document | Element | DocumentFragment | null} [root]
30
+ * @param {object} [options]
31
+ * @param {(el: Element) => boolean} [options.accept] Lifecycle eligibility, rechecked on moves.
32
+ * @returns {EnhancementHandle}
33
+ */
34
+ export default function enhance(enhancers: Record<string, Enhancer>, root?: Document | Element | DocumentFragment | null, { accept }?: {
35
+ accept?: (el: Element) => boolean;
36
+ }): EnhancementHandle;
@@ -0,0 +1,27 @@
1
+ export declare function loadScript(url: any): any;
2
+ export declare function loadStyle(url: any): any;
3
+ export declare function loadEnhancement(name: any, url: any): any;
4
+ /**
5
+ * Load every enhancement declared in the manifest blocks under `scope`.
6
+ *
7
+ * @param {Document | Element | DocumentFragment} [scope] Where to look for
8
+ * manifest blocks. It only limits discovery; loaded enhancements register on
9
+ * the default document root.
10
+ * @returns {Promise<{ names: string[], failed: { name: string, error: Error }[], skipped: string[] }>}
11
+ */
12
+ export declare function loadEnhancements(scope?: Document | Element | DocumentFragment): Promise<{
13
+ names: string[];
14
+ failed: {
15
+ name: string;
16
+ error: Error;
17
+ }[];
18
+ skipped: string[];
19
+ }>;
20
+ export declare function watchEnhancementManifests(): import("./enhance.js").EnhancementHandle;
21
+ export declare function loadResponse(response: any): Promise<{
22
+ names: never[];
23
+ failed: never[];
24
+ skipped: never[];
25
+ }>;
26
+ export declare function __setModuleImporter(fn: any): void;
27
+ export declare function __reset(): void;
@@ -0,0 +1 @@
1
+ export declare function registerEscapeDismissal(element: any, dismiss: any): () => void;
@@ -0,0 +1,14 @@
1
+ export declare const ACTUAL_EVENT_PREFIX = "actual";
2
+ export declare const EVENTS: {
3
+ surfaceOpen: string;
4
+ contextMenu: string;
5
+ status: string;
6
+ invalid: string;
7
+ dirtyChange: string;
8
+ ajaxStart: string;
9
+ ajaxResponse: string;
10
+ ajaxError: string;
11
+ tabChange: string;
12
+ dialogCancel: string;
13
+ dismiss: string;
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The author's placement attribute, or null when absent or unknown.
3
+ *
4
+ * @param {Element | null | undefined} el
5
+ * @param {string} attribute
6
+ * @returns {string | null}
7
+ */
8
+ export declare function readPlacement(el: Element | null | undefined, attribute: string): string | null;
9
+ /**
10
+ * @param {Element | null | undefined} anchor
11
+ * @returns {{ space: "viewport" | "document", position: "fixed" | "absolute" }}
12
+ */
13
+ export declare function positionModeFor(anchor: Element | null | undefined): {
14
+ space: "viewport" | "document";
15
+ position: "fixed" | "absolute";
16
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function connectFocusGroup(root: any, opts?: {}): {
2
+ sync: (preferred?: any) => any[];
3
+ disconnect: () => void;
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare function isElementVisible(el: any): any;
2
+ export declare function getFocusable(root: any): any[];
3
+ export declare function nextTabStop(node: any): any;
4
+ export declare function focusFirstDescendant(root: any): boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Reads action, method, enctype or target: a submitter's form* attribute
3
+ * overrides the form's own, as natively. Reflected values, so method and
4
+ * enctype come back lowercase and action as an absolute URL.
5
+ */
6
+ export declare function submissionSetting(form: any, submitter: any, name: any): any;
7
+ /**
8
+ * The browsing context name the submission goes to, "" for the page itself.
9
+ * Without a target attribute the form falls back to <base target>; an empty
10
+ * formtarget="" is still an attribute and means the page itself.
11
+ */
12
+ export declare function submissionTarget(form: any, submitter: any): any;
@@ -0,0 +1,22 @@
1
+ import "./flyout.js";
2
+ import "./context-menu.js";
3
+ import "./dialog.js";
4
+ import "./dismiss.js";
5
+ import "./tab.js";
6
+ import "./tooltip.js";
7
+ import "./scrollspy.js";
8
+ import "./in-view.js";
9
+ import "./filter.js";
10
+ import "./mask.js";
11
+ import "./password.js";
12
+ import "./range.js";
13
+ import "./validation.js";
14
+ import "./dirty.js";
15
+ import "./ajax.js";
16
+ import "./status.js";
17
+ import "./index.js";
18
+ export { applyEnhancement, default as enhance, registerEnhancement } from "./enhance.js";
19
+ export type Enhancer = import("./enhance.js").Enhancer;
20
+ export type EnhancementHandle = import("./enhance.js").EnhancementHandle;
21
+ /** @typedef {import("./enhance.js").Enhancer} Enhancer */
22
+ /** @typedef {import("./enhance.js").EnhancementHandle} EnhancementHandle */
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function ensureInlineVisible(container: any, target: any): void;
@@ -0,0 +1,4 @@
1
+ export declare function selectionStart(el: any): any;
2
+ export declare function setCaret(el: any, position: any): void;
3
+ export declare function dispatchInput(el: any): void;
4
+ export declare function onTextInput(el: any, handler: any, signal: any): void;
@@ -0,0 +1,5 @@
1
+ export declare function shouldIgnoreKey(event: any): boolean;
2
+ export declare function firstItem(items: any): any;
3
+ export declare function lastItem(items: any): any;
4
+ export declare function nextItem(items: any, current: any, delta: any, opts?: {}): any;
5
+ export declare function itemForKey(items: any, current: any, key: any, opts?: {}): any;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export declare function getMenuItems(menu: any): any[];
2
+ export declare function hasMenuItems(menu: any): boolean;
3
+ export declare function hasMenuItem(menu: any, target: any): boolean;
4
+ export declare function focusFirstMenuItem(menu: any): void;
5
+ export declare function focusLastMenuItem(menu: any): void;
6
+ export declare function onMenuKeydown(e: any, { close, navigate }: {
7
+ close: any;
8
+ navigate?: boolean | undefined;
9
+ }): void;
10
+ export declare function connectMenu(menu: any, { close }: {
11
+ close: any;
12
+ }): () => void;
@@ -0,0 +1,2 @@
1
+ export declare function parseConfig(source: any): any;
2
+ export default parseConfig;
@@ -0,0 +1 @@
1
+ export declare function afterParse(node: any, callback: any): () => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function refreshScrollspy(nav: any): void;
@@ -0,0 +1,14 @@
1
+ export declare const CLASSES: {
2
+ wasValidated: string;
3
+ danger: string;
4
+ fieldError: string;
5
+ field: string;
6
+ formActions: string;
7
+ sticky: string;
8
+ open: string;
9
+ pending: string;
10
+ static: string;
11
+ modalOpen: string;
12
+ hadScrollbar: string;
13
+ tooltip: string;
14
+ };
@@ -0,0 +1,5 @@
1
+ export declare function status(message: any, options?: {}): void;
2
+ export declare namespace status {
3
+ var clear: () => void;
4
+ }
5
+ export default status;
@@ -0,0 +1,6 @@
1
+ export declare function isSurfaceOpen(menu: any): boolean;
2
+ export declare function prepareSurface(menu: any): void;
3
+ export declare function retainSurface(panel: any): () => void;
4
+ export declare function openSurface(menu: any, opts?: {}): boolean;
5
+ export declare function closeSurface(menu: any, opts?: {}): void;
6
+ export declare function disconnectSurface(menu: any): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,68 @@
1
+ export type TooltipState = {
2
+ /**
3
+ * Triggers that currently reference this tip.
4
+ */
5
+ refs: Set<Element>;
6
+ /**
7
+ * Trigger that last showed this tip.
8
+ */
9
+ activeRef: Element | null;
10
+ /**
11
+ * Tip-level event listener cleanup.
12
+ */
13
+ controller: AbortController;
14
+ /**
15
+ * Floating-position cleanup while wanted.
16
+ */
17
+ stopTracking: (() => void) | null;
18
+ /**
19
+ * Reference the current subscription observes.
20
+ */
21
+ trackedRef: Element | null;
22
+ /**
23
+ * Escape-stack cleanup while visible and dismissable.
24
+ */
25
+ unregisterEscape: (() => void) | null;
26
+ /**
27
+ * Trigger represented by the current Escape-stack entry.
28
+ */
29
+ escapeRef: Element | null;
30
+ /**
31
+ * True when the tip was created from data-tooltip text.
32
+ */
33
+ generated: boolean;
34
+ /**
35
+ * True while the interaction asks for this tip, positionable or not.
36
+ */
37
+ wanted: boolean;
38
+ /**
39
+ * True while the tip is promoted to the top layer.
40
+ */
41
+ visible: boolean;
42
+ /**
43
+ * Coordinate space the tip is written in.
44
+ */
45
+ space: "viewport" | "document";
46
+ /**
47
+ * Pending delayed show.
48
+ */
49
+ timer: ReturnType<typeof setTimeout> | null;
50
+ /**
51
+ * Pending delayed hide.
52
+ */
53
+ hideTimer: ReturnType<typeof setTimeout> | null;
54
+ /**
55
+ * Pointer is over the active trigger.
56
+ */
57
+ hovered: boolean;
58
+ /**
59
+ * The active trigger has keyboard focus.
60
+ */
61
+ focused: boolean;
62
+ /**
63
+ * Pointer is over the tooltip.
64
+ */
65
+ overTip: boolean;
66
+ };
67
+ /** True while the tip is promoted. The runtime's state, not :popover-open. */
68
+ export declare function isTooltipVisible(tip: any): boolean;
@@ -0,0 +1 @@
1
+ export declare function waitForTransitions(...elements: any[]): Promise<PromiseSettledResult<any>[]>;
@@ -0,0 +1,17 @@
1
+ export declare class FormValidator {
2
+ static get rules(): {
3
+ same(v: any, el: any, selector: any): boolean;
4
+ number(v: any): boolean;
5
+ digits(v: any): boolean;
6
+ alnum(v: any): boolean;
7
+ "starts-with"(v: any, _el: any, ...prefixes: any[]): boolean;
8
+ "ends-with"(v: any, _el: any, ...suffixes: any[]): boolean;
9
+ date(v: any): boolean;
10
+ "tel-prefix"(value: any, _el: any, ...prefixes: any[]): boolean;
11
+ };
12
+ static registerRule(name: any, callback: any): void;
13
+ static setFieldError(el: any, message: any): void;
14
+ static clearFieldError(el: any): void;
15
+ static setErrors(form: any, errors: any): void;
16
+ }
17
+ export default FormValidator;
@@ -530,7 +530,9 @@ matching element. The scope also constrains the available height, so omit it
530
530
  when the menu is allowed to escape the card or list item.
531
531
 
532
532
  Long press is opt-in with `data-context-menu-long-press`. Empty uses the default
533
- delay; a number sets the delay in milliseconds.
533
+ delay; a number sets the delay in milliseconds. On touch-primary devices the
534
+ target loses text selection and the iOS callout, so the native gesture does not
535
+ compete with the menu; keep the trigger button as the discoverable path.
534
536
 
535
537
  ```html demo
536
538
  <div class="card stack"
@@ -93,7 +93,11 @@ registerEnhancement("autosubmit", (form) => {
93
93
  });
94
94
  ```
95
95
 
96
- For anything beyond that extension API, keep using `actual-css/js/*`.
96
+ For additional helpers, import the relevant `actual-css/js/*` module. Source
97
+ imports from the same package installation share the runtime instance.
98
+ The npm package includes TypeScript declarations for these imports. Import
99
+ `Enhancer` and `EnhancementHandle` as types from `actual-css/js/full` or
100
+ `actual-css/js/enhance`.
97
101
 
98
102
  The same entrypoint produces the `dist/actual.full.js` standalone for a
99
103
  classic `<script>`, where no global API is exposed. Static HTML that needs to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "actual-css",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "Plain CSS component framework with semantic classes, universal variants, small tokens, theme hooks, and progressive enhancements.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.4.4",
@@ -46,37 +46,37 @@
46
46
  "./css/typography/*": "./src/css/typography/*.css",
47
47
  "./css/utilities": "./src/css/utilities/index.css",
48
48
  "./css/utilities/*": "./src/css/utilities/*.css",
49
- "./js": "./src/js/index.js",
50
- "./js/full": "./src/js/full.js",
51
- "./js/command": "./src/js/command.js",
52
- "./js/context-menu": "./src/js/context-menu.js",
53
- "./js/dialog": "./src/js/dialog.js",
54
- "./js/dismiss": "./src/js/dismiss.js",
55
- "./js/escape": "./src/js/escape.js",
56
- "./js/enhance": "./src/js/enhance.js",
57
- "./js/enhancement-loader": "./src/js/enhancement-loader.js",
58
- "./js/parse-config": "./src/js/parse-config.js",
59
- "./js/events": "./src/js/events.js",
60
- "./js/filter": "./src/js/filter.js",
61
- "./js/flyout": "./src/js/flyout.js",
62
- "./js/focus": "./src/js/focus.js",
63
- "./js/focus-group": "./src/js/focus-group.js",
64
- "./js/input": "./src/js/input.js",
65
- "./js/in-view": "./src/js/in-view.js",
66
- "./js/keys": "./src/js/keys.js",
67
- "./js/mask": "./src/js/mask.js",
68
- "./js/menu": "./src/js/menu.js",
69
- "./js/password": "./src/js/password.js",
70
- "./js/range": "./src/js/range.js",
71
- "./js/scrollspy": "./src/js/scrollspy.js",
72
- "./js/selectors": "./src/js/selectors.js",
73
- "./js/tab": "./src/js/tab.js",
74
- "./js/tooltip": "./src/js/tooltip.js",
75
- "./js/validation": "./src/js/validation.js",
76
- "./js/dirty": "./src/js/dirty.js",
77
- "./js/ajax": "./src/js/ajax.js",
78
- "./js/status": "./src/js/status.js",
79
- "./js/surface": "./src/js/surface.js",
49
+ "./js": { "types": "./dist/types/index.d.ts", "default": "./src/js/index.js" },
50
+ "./js/full": { "types": "./dist/types/full.d.ts", "default": "./src/js/full.js" },
51
+ "./js/command": { "types": "./dist/types/command.d.ts", "default": "./src/js/command.js" },
52
+ "./js/context-menu": { "types": "./dist/types/context-menu.d.ts", "default": "./src/js/context-menu.js" },
53
+ "./js/dialog": { "types": "./dist/types/dialog.d.ts", "default": "./src/js/dialog.js" },
54
+ "./js/dismiss": { "types": "./dist/types/dismiss.d.ts", "default": "./src/js/dismiss.js" },
55
+ "./js/escape": { "types": "./dist/types/escape.d.ts", "default": "./src/js/escape.js" },
56
+ "./js/enhance": { "types": "./dist/types/enhance.d.ts", "default": "./src/js/enhance.js" },
57
+ "./js/enhancement-loader": { "types": "./dist/types/enhancement-loader.d.ts", "default": "./src/js/enhancement-loader.js" },
58
+ "./js/parse-config": { "types": "./dist/types/parse-config.d.ts", "default": "./src/js/parse-config.js" },
59
+ "./js/events": { "types": "./dist/types/events.d.ts", "default": "./src/js/events.js" },
60
+ "./js/filter": { "types": "./dist/types/filter.d.ts", "default": "./src/js/filter.js" },
61
+ "./js/flyout": { "types": "./dist/types/flyout.d.ts", "default": "./src/js/flyout.js" },
62
+ "./js/focus": { "types": "./dist/types/focus.d.ts", "default": "./src/js/focus.js" },
63
+ "./js/focus-group": { "types": "./dist/types/focus-group.d.ts", "default": "./src/js/focus-group.js" },
64
+ "./js/input": { "types": "./dist/types/input.d.ts", "default": "./src/js/input.js" },
65
+ "./js/in-view": { "types": "./dist/types/in-view.d.ts", "default": "./src/js/in-view.js" },
66
+ "./js/keys": { "types": "./dist/types/keys.d.ts", "default": "./src/js/keys.js" },
67
+ "./js/mask": { "types": "./dist/types/mask.d.ts", "default": "./src/js/mask.js" },
68
+ "./js/menu": { "types": "./dist/types/menu.d.ts", "default": "./src/js/menu.js" },
69
+ "./js/password": { "types": "./dist/types/password.d.ts", "default": "./src/js/password.js" },
70
+ "./js/range": { "types": "./dist/types/range.d.ts", "default": "./src/js/range.js" },
71
+ "./js/scrollspy": { "types": "./dist/types/scrollspy.d.ts", "default": "./src/js/scrollspy.js" },
72
+ "./js/selectors": { "types": "./dist/types/selectors.d.ts", "default": "./src/js/selectors.js" },
73
+ "./js/tab": { "types": "./dist/types/tab.d.ts", "default": "./src/js/tab.js" },
74
+ "./js/tooltip": { "types": "./dist/types/tooltip.d.ts", "default": "./src/js/tooltip.js" },
75
+ "./js/validation": { "types": "./dist/types/validation.d.ts", "default": "./src/js/validation.js" },
76
+ "./js/dirty": { "types": "./dist/types/dirty.d.ts", "default": "./src/js/dirty.js" },
77
+ "./js/ajax": { "types": "./dist/types/ajax.d.ts", "default": "./src/js/ajax.js" },
78
+ "./js/status": { "types": "./dist/types/status.d.ts", "default": "./src/js/status.js" },
79
+ "./js/surface": { "types": "./dist/types/surface.d.ts", "default": "./src/js/surface.js" },
80
80
  "./reserved-classes.json": "./reserved-classes.json",
81
81
  "./components.json": "./components.json",
82
82
  "./tokens.json": "./tokens.json",
@@ -136,6 +136,7 @@
136
136
  "check:architecture": "bun scripts/check-css-architecture.js",
137
137
  "build:dist": "bun scripts/build-dist.js",
138
138
  "build:js": "bun scripts/build-js.js",
139
+ "build:types": "tsc -p tsconfig.types.json",
139
140
  "build:themes": "bun scripts/build-themes.js",
140
141
  "build:size": "bun scripts/build-size.js",
141
142
  "build:pages": "bun scripts/pages.js",
@@ -160,12 +161,13 @@
160
161
  "release:notes": "bun scripts/release-notes.js",
161
162
  "test": "bun test",
162
163
  "test:changed": "bun test --changed=master",
163
- "build:all": "bun run lint && bun run build:dist && bun run build:js && bun run build:size && bun run format:docs && bun run build:docs && bun run check:docs && bun run check:doc-classes && bun run check:compat && bun run check:css-api && bun run check:color-space && bun run check:architecture && bun run check:enhance && bun run generate:reserved && bun run check:reserved && bun run generate:catalog && bun run check:catalog && bun run check:sync && bun run check:links && bun run check:templates && bun run test",
164
+ "build:all": "bun run lint && bun run build:dist && bun run build:js && bun run build:types && bun run build:size && bun run format:docs && bun run build:docs && bun run check:docs && bun run check:doc-classes && bun run check:compat && bun run check:css-api && bun run check:color-space && bun run check:architecture && bun run check:enhance && bun run generate:reserved && bun run check:reserved && bun run generate:catalog && bun run check:catalog && bun run check:sync && bun run check:links && bun run check:templates && bun run test",
164
165
  "prepublishOnly": "bun run build:all"
165
166
  },
166
167
  "devDependencies": {
167
168
  "@biomejs/biome": "^2.5.15",
168
- "happy-dom": "^21.0.1"
169
+ "happy-dom": "^21.0.1",
170
+ "typescript": "^7.0.0"
169
171
  },
170
172
  "dependencies": {
171
173
  "@lekoala/floating": "^0.3.1"
@@ -208,3 +208,23 @@
208
208
  /* Vertical dividers — .menu-separator (menu.css) is the canonical way to
209
209
  separate menu items. Flyout panels that are not menus use auto grid gap
210
210
  declared on .flyout itself. */
211
+
212
+ /* Context-menu long press competes with the native touch gestures: Android
213
+ starts a text selection and iOS shows its callout under the opening menu.
214
+ Touch-primary devices only, so mouse users keep selecting card text. */
215
+ @media (pointer: coarse) {
216
+ [data-context-menu-long-press]:not(
217
+ [data-context-menu-long-press="false"],
218
+ [data-context-menu-long-press="none"]
219
+ ) {
220
+ -webkit-touch-callout: none;
221
+ -webkit-user-select: none;
222
+ user-select: none;
223
+ }
224
+
225
+ /* why: an inherited user-select: none blocks typing in fields on iOS. */
226
+ [data-context-menu-long-press] :is(input, textarea, [contenteditable]) {
227
+ -webkit-user-select: text;
228
+ user-select: text;
229
+ }
230
+ }
@@ -103,9 +103,11 @@ function openContextMenu(context, menu, opts = {}) {
103
103
  if (!requestContextMenu(context, menu, opts)) return;
104
104
  if (isSurfaceOpen(menu)) closeSurface(menu);
105
105
 
106
- // Measured after the cancelable event: a handler may have moved the anchor.
106
+ // A button anchors on its own rect, like a flyout trigger, so alignment and
107
+ // flipping see its full box. Pointer and keyboard openings anchor on a point,
108
+ // measured after the cancelable event: a handler may have moved the origin.
107
109
  let { x, y } = opts;
108
- if (x == null || y == null) {
110
+ if (!opts.anchor && (x == null || y == null)) {
109
111
  const rect = (opts.origin || context).getBoundingClientRect();
110
112
  x ??= rect.left;
111
113
  y ??= rect.bottom;
@@ -114,6 +116,7 @@ function openContextMenu(context, menu, opts = {}) {
114
116
  if (
115
117
  openSurface(menu, {
116
118
  source: context,
119
+ trigger: opts.anchor,
117
120
  x,
118
121
  y,
119
122
  placement: opts.placement || "bottom-start",
@@ -237,6 +240,10 @@ function connectContextTarget(target) {
237
240
  target.addEventListener(
238
241
  "pointerdown",
239
242
  (e) => {
243
+ // Suppression targets the click synthesized by the long press itself. A
244
+ // fresh press starts a new gesture, so its click (a tap on "…" right
245
+ // after the menu opened) is legitimate.
246
+ state.suppressClickUntil = 0;
240
247
  const delay = getLongPressDelay(target, menuFor(target));
241
248
  if (e.pointerType !== "touch" || delay == null || shouldIgnoreNativeTarget(e.target)) {
242
249
  return;
@@ -321,6 +328,7 @@ function connectContextTarget(target) {
321
328
 
322
329
  openContextMenu(target, menu, {
323
330
  distance: 4,
331
+ anchor: trigger,
324
332
  origin: trigger,
325
333
  trigger: "button",
326
334
  restoreFocusTo: trigger,