@jasonshimmy/cer-material 0.1.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.
- package/README.md +989 -0
- package/dist/components/md-app-bar.d.ts +1 -0
- package/dist/components/md-badge.d.ts +1 -0
- package/dist/components/md-bottom-sheet.d.ts +1 -0
- package/dist/components/md-button-group.d.ts +1 -0
- package/dist/components/md-button.d.ts +1 -0
- package/dist/components/md-card.d.ts +1 -0
- package/dist/components/md-carousel.d.ts +1 -0
- package/dist/components/md-checkbox.d.ts +1 -0
- package/dist/components/md-chip.d.ts +1 -0
- package/dist/components/md-date-picker.d.ts +1 -0
- package/dist/components/md-dialog.d.ts +1 -0
- package/dist/components/md-divider.d.ts +1 -0
- package/dist/components/md-fab-menu.d.ts +1 -0
- package/dist/components/md-fab.d.ts +1 -0
- package/dist/components/md-icon-button.d.ts +1 -0
- package/dist/components/md-list.d.ts +1 -0
- package/dist/components/md-loading-indicator.d.ts +1 -0
- package/dist/components/md-menu.d.ts +1 -0
- package/dist/components/md-navigation-bar.d.ts +1 -0
- package/dist/components/md-navigation-drawer.d.ts +1 -0
- package/dist/components/md-navigation-rail.d.ts +1 -0
- package/dist/components/md-progress.d.ts +1 -0
- package/dist/components/md-radio.d.ts +1 -0
- package/dist/components/md-search.d.ts +1 -0
- package/dist/components/md-segmented-button.d.ts +1 -0
- package/dist/components/md-side-sheet.d.ts +1 -0
- package/dist/components/md-slider.d.ts +1 -0
- package/dist/components/md-snackbar.d.ts +1 -0
- package/dist/components/md-split-button.d.ts +1 -0
- package/dist/components/md-switch.d.ts +1 -0
- package/dist/components/md-tabs.d.ts +1 -0
- package/dist/components/md-text-field.d.ts +1 -0
- package/dist/components/md-time-picker.d.ts +1 -0
- package/dist/components/md-tooltip.d.ts +1 -0
- package/dist/composables/useControlledValue.d.ts +14 -0
- package/dist/composables/useEscapeKey.d.ts +16 -0
- package/dist/composables/useFocusReturn.d.ts +18 -0
- package/dist/composables/useFocusTrap.d.ts +31 -0
- package/dist/composables/useListKeyNav.d.ts +42 -0
- package/dist/composables/useScrollLock.d.ts +4 -0
- package/dist/index.cjs +5030 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6250 -0
- package/dist/index.js.map +1 -0
- package/dist/theme.cjs +137 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.ts +14 -0
- package/dist/theme.js +148 -0
- package/dist/theme.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactiveState } from '@jasonshimmy/custom-elements-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an internal reactive ref that mirrors an external prop value and
|
|
4
|
+
* stays in sync when the prop changes — both via DOM attribute changes and
|
|
5
|
+
* JS property assignment (e.g. `:bind` from a parent component).
|
|
6
|
+
*
|
|
7
|
+
* @param getProp - A getter that returns the current coerced prop value.
|
|
8
|
+
* e.g. `() => props.value || ''`
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const query = useControlledValue(() => props.value || '');
|
|
12
|
+
* query.value = 'typed by user'; // internal mutation works
|
|
13
|
+
*/
|
|
14
|
+
export declare function useControlledValue<T>(getProp: () => T): ReactiveState<T>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers a document-level `keydown` listener for the Escape key that fires
|
|
3
|
+
* for the lifetime of the host element. The provided `guard` function is
|
|
4
|
+
* called on every keydown; when it returns `true` the event is cancelled and
|
|
5
|
+
* `onEscape` is invoked.
|
|
6
|
+
*
|
|
7
|
+
* Using `createComposable` ensures the lifecycle hooks are bound to the correct
|
|
8
|
+
* component context even when called from outside the component render closure.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* useEscapeKey(
|
|
12
|
+
* () => props.open, // guard: only active when open
|
|
13
|
+
* () => emit('close'),
|
|
14
|
+
* )();
|
|
15
|
+
*/
|
|
16
|
+
export declare function useEscapeKey(guard: () => boolean, onEscape: () => void): (ctx?: Record<string, unknown>) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a lightweight focus-return handler (no Tab trapping) for overlays
|
|
3
|
+
* that don't need full keyboard confinement — e.g. side sheets, drawers, menus.
|
|
4
|
+
*
|
|
5
|
+
* Wire the returned callbacks into a CER `Transition`:
|
|
6
|
+
* `onAfterEnter: focusReturn.onAfterEnter, onAfterLeave: focusReturn.onAfterLeave`
|
|
7
|
+
*
|
|
8
|
+
* State is stored on the component context so it survives re-renders.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const focusReturn = createFocusReturn();
|
|
12
|
+
* // In template:
|
|
13
|
+
* Transition({ show: props.open, onAfterEnter: focusReturn.onAfterEnter, onAfterLeave: focusReturn.onAfterLeave }, html`...`)
|
|
14
|
+
*/
|
|
15
|
+
export declare function createFocusReturn(): {
|
|
16
|
+
onAfterEnter: (el?: HTMLElement) => void;
|
|
17
|
+
onAfterLeave: (el?: HTMLElement) => void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a focus trap for an overlay.
|
|
3
|
+
*
|
|
4
|
+
* Wire the returned callbacks directly into a CER `Transition`:
|
|
5
|
+
* `onAfterEnter: trap.onAfterEnter, onAfterLeave: trap.onAfterLeave`
|
|
6
|
+
*
|
|
7
|
+
* State is stored on the component context so it survives re-renders without
|
|
8
|
+
* losing the saved "previous focus" element or leaking event listeners.
|
|
9
|
+
*
|
|
10
|
+
* Behaviour:
|
|
11
|
+
* - `onAfterEnter(el)`: saves the currently focused element, registers a
|
|
12
|
+
* Tab/Shift+Tab keydown guard, and focuses the first tabbable inside `el`.
|
|
13
|
+
* - `onAfterLeave()`: removes the keydown guard and restores focus to the
|
|
14
|
+
* previously focused element.
|
|
15
|
+
* - `cleanup()`: removes the keydown guard — call from `useOnDisconnected`
|
|
16
|
+
* to avoid leaks if the component is removed while the overlay is open.
|
|
17
|
+
*
|
|
18
|
+
* Drills into shadow roots so nested custom elements (e.g. `<md-button>`)
|
|
19
|
+
* are discovered and included in the tab cycle.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const trap = createFocusTrap();
|
|
23
|
+
* useOnDisconnected(() => trap.cleanup());
|
|
24
|
+
* // In template:
|
|
25
|
+
* Transition({ show: props.open, onAfterEnter: trap.onAfterEnter, onAfterLeave: trap.onAfterLeave }, html`...`)
|
|
26
|
+
*/
|
|
27
|
+
export declare function createFocusTrap(): {
|
|
28
|
+
onAfterEnter: (el: HTMLElement) => void;
|
|
29
|
+
onAfterLeave: () => void;
|
|
30
|
+
cleanup: () => void;
|
|
31
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for useListKeyNav.
|
|
3
|
+
*/
|
|
4
|
+
export interface ListKeyNavOptions {
|
|
5
|
+
/** Whether arrow keys navigate left/right or up/down. */
|
|
6
|
+
orientation: 'horizontal' | 'vertical';
|
|
7
|
+
/**
|
|
8
|
+
* CSS selector (relative to the container) used to find navigable items.
|
|
9
|
+
* Disabled items should be excluded, e.g. `'[role="menuitem"]:not([disabled])'`.
|
|
10
|
+
*/
|
|
11
|
+
itemSelector: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional callback invoked after focus moves to the new item.
|
|
14
|
+
* Use this to update component state in addition to focus movement,
|
|
15
|
+
* e.g. activating a tab or selecting a radio segment.
|
|
16
|
+
*/
|
|
17
|
+
onNavigate?: (item: HTMLElement, index: number) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns a `keydown` event handler that implements arrow-key, Home, and End
|
|
21
|
+
* navigation within a container element. Attach the handler to the container
|
|
22
|
+
* element via `@keydown`.
|
|
23
|
+
*
|
|
24
|
+
* The handler queries `:focus` within the container to determine the current
|
|
25
|
+
* item. This correctly resolves focus inside shadow DOM where
|
|
26
|
+
* `document.activeElement` would only return the host element.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Vertical list (menu):
|
|
30
|
+
* const handleKeyDown = useListKeyNav({
|
|
31
|
+
* orientation: 'vertical',
|
|
32
|
+
* itemSelector: '[role="menuitem"]:not([disabled])',
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Horizontal list with activation callback (tabs):
|
|
36
|
+
* const handleKeyDown = useListKeyNav({
|
|
37
|
+
* orientation: 'horizontal',
|
|
38
|
+
* itemSelector: '[role="tab"]',
|
|
39
|
+
* onNavigate: (_, idx) => { active.value = tabs[idx].id; emit('tab-change', tabs[idx].id); },
|
|
40
|
+
* });
|
|
41
|
+
*/
|
|
42
|
+
export declare function useListKeyNav(options: ListKeyNavOptions): (e: KeyboardEvent) => void;
|