@brytdesigns/web-component-drawer 1.1.12 → 3.0.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/dist/main/components/drawer-backdrop.js +50 -77
- package/dist/main/components/drawer-backdrop.js.map +1 -1
- package/dist/main/components/drawer-content.js +60 -83
- package/dist/main/components/drawer-content.js.map +1 -1
- package/dist/main/components/drawer-context.js +119 -113
- package/dist/main/components/drawer-context.js.map +1 -1
- package/dist/main/components/drawer-trigger.js +90 -71
- package/dist/main/components/drawer-trigger.js.map +1 -1
- package/dist/main/components/index.js +4 -10
- package/dist/main/consts.js +8 -13
- package/dist/main/consts.js.map +1 -1
- package/dist/main/hooks/index.js +2 -3
- package/dist/main/hooks/useDrawer.js +85 -81
- package/dist/main/hooks/useDrawer.js.map +1 -1
- package/dist/main/index.d.ts +32 -30
- package/dist/main/index.js +27 -31
- package/dist/main/index.js.map +1 -1
- package/dist/main/utils.js +5 -4
- package/dist/main/utils.js.map +1 -1
- package/package.json +8 -9
- package/dist/esm/index.js +0 -491
- package/dist/esm/index.js.map +0 -1
- package/dist/main/components/index.js.map +0 -1
- package/dist/main/hooks/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"drawer-context.js","names":[],"sources":["../../../src/components/drawer-context.ts"],"sourcesContent":["import { createFocusTrap } from \"@brytdesigns/web-component-core/focusTrap\";\nimport {\n\ttype CorrectComponentType,\n\tcloseNestedOverlays,\n\tcreateEscapeHandler,\n\tcreateFocusReturn,\n\tcreateGuardedEffect,\n\tdisableBodyScroll,\n\tenableBodyScroll,\n\tfindOverlayPanel,\n} from \"@brytdesigns/web-component-core/utils\";\nimport { omit, onCleanup, onSettled, untrack } from \"solid-js\";\n\nimport { provideDrawerContext, useDrawerContext } from \"../hooks/index.js\";\nimport { hideElement, showElement } from \"../utils.js\";\n\nexport type Props = {\n\tisOpen: boolean;\n\tid: string;\n\tcloseOnEscape: boolean;\n\tshouldTrapFocus: boolean;\n\tisAnimating: boolean;\n\tdebug?: boolean;\n};\n\nexport const Name = `drawer-context`;\n\nexport const Component: CorrectComponentType<Props> = (props, { element }) => {\n\t// `debug` is a mount-time switch; snapshot it rather than tracking.\n\tconst debug = untrack(() => props.debug);\n\t// `splitProps` is gone. `omit` gives the rest; the picked half is a getter\n\t// object so it stays reactive, which is what splitProps returned.\n\tconst restProps = omit(props, \"isOpen\", \"isAnimating\");\n\tconst contextProps = {\n\t\tget isOpen() {\n\t\t\treturn props.isOpen;\n\t\t},\n\t\tget isAnimating() {\n\t\t\treturn props.isAnimating;\n\t\t},\n\t};\n\n\tconst context = provideDrawerContext(contextProps, element);\n\n\tconst [state, { setElementState }] = context;\n\n\tconst [_, { updateAnimationQueue, ...events }] = useDrawerContext(context);\n\n\telement.actions = events;\n\n\tconst panel = () => findOverlayPanel(element, \"drawer-content\");\n\tconst focusReturn = createFocusReturn(element);\n\n\tconst focusTrap = createFocusTrap(element, () => ({\n\t\tallowOutsideClick: true,\n\t\t// Escape and focus return are handled explicitly below rather than as\n\t\t// focus-trap options. As options they only applied while a trap was\n\t\t// active, so `close-on-escape=\"true\" should-trap-focus=\"false\"` silently\n\t\t// did nothing, and returning focus was a side effect of trapping it.\n\t\tescapeDeactivates: false,\n\t\treturnFocusOnDeactivate: false,\n\t\t// The panel, not its first button: a screen reader then announces the\n\t\t// dialog's name and role on open instead of \"Close\".\n\t\tinitialFocus: () => panel() ?? false,\n\t\t// Without this, an overlay holding nothing tabbable throws on activate.\n\t\tfallbackFocus: () => panel() ?? element,\n\t\t// No `onDeactivate`. It used to close the overlay, because deactivation\n\t\t// was how focus-trap's `escapeDeactivates` reported an Escape press —\n\t\t// and with Escape handled explicitly above, closing on *any* deactivation\n\t\t// is actively wrong: the trap is also deactivated whenever this effect\n\t\t// re-runs, so an overlay would close itself the moment it started\n\t\t// animating open.\n\t}));\n\n\tcreateGuardedEffect(\n\t\t() => ({\n\t\t\tisOpen: state.isOpen,\n\t\t\tcloseOnEscape: restProps.closeOnEscape,\n\t\t}),\n\t\t({ isOpen, closeOnEscape }) => {\n\t\t\tif (!isOpen || !closeOnEscape) return;\n\t\t\t// Only the innermost open overlay responds, so Escape inside a nested\n\t\t\t// overlay closes that one rather than collapsing the whole stack.\n\t\t\treturn createEscapeHandler({\n\t\t\t\telement,\n\t\t\t\tonEscape: () => setElementState(\"isOpen\", false),\n\t\t\t});\n\t\t},\n\t);\n\n\tcreateGuardedEffect(\n\t\t() => ({ debug: debug, snapshot: { ...state } }),\n\t\t({ debug, snapshot }) => {\n\t\t\tif (!debug) return;\n\t\t\tconsole.table(snapshot);\n\t\t},\n\t);\n\n\tcreateGuardedEffect(\n\t\t() => state.isOpen,\n\t\t(isOpen) => {\n\t\t\tconst eventName = isOpen ? \"drawer:open\" : \"drawer:close\";\n\t\t\telement.dispatchEvent(\n\t\t\t\tnew CustomEvent(eventName, {\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tdetail: { isOpen, relatedTarget: element },\n\t\t\t\t}),\n\t\t\t);\n\t\t\telement.dispatchEvent(\n\t\t\t\tnew CustomEvent(\"drawer:toggle\", {\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tdetail: { isOpen, relatedTarget: element },\n\t\t\t\t}),\n\t\t\t);\n\t\t},\n\t);\n\n\tcreateGuardedEffect(\n\t\t() => ({\n\t\t\tisOpen: state.isOpen,\n\t\t\tisAnimating: state.isAnimating,\n\t\t\tfocusTrap: focusTrap(),\n\t\t\tshouldTrapFocus: restProps.shouldTrapFocus,\n\t\t}),\n\t\t({ isOpen, isAnimating, focusTrap, shouldTrapFocus }) => {\n\t\t\tif (!isOpen) return;\n\t\t\tif (debug) console.log(\"Showing element\", element);\n\t\t\tshowElement(element);\n\t\t\t// Waiting out the enter animation keeps the trap off content that is\n\t\t\t// still transitioning, and means `record()` reads the trigger rather\n\t\t\t// than whatever the animation left focused.\n\t\t\tif (!shouldTrapFocus || isAnimating) return;\n\t\t\tfocusReturn.record();\n\t\t\tfocusTrap.activate();\n\t\t\t// The apply phase is not a computation, so `onCleanup` here would\n\t\t\t// never register. Its return value IS the cleanup.\n\t\t\treturn () => {\n\t\t\t\tfocusTrap.deactivate();\n\t\t\t\tfocusReturn.restore();\n\t\t\t};\n\t\t},\n\t);\n\n\tcreateGuardedEffect(\n\t\t() => ({\n\t\t\tisOpen: state.isOpen,\n\t\t\tisAnimating: state.isAnimating,\n\t\t\tshouldTrapFocus: props.shouldTrapFocus,\n\t\t}),\n\t\t({ isOpen, isAnimating, shouldTrapFocus }) => {\n\t\t\tif (!isOpen || isAnimating || !shouldTrapFocus) return;\n\n\t\t\tdisableBodyScroll(element, {\n\t\t\t\tallowTouchMove: (el: EventTarget) => {\n\t\t\t\t\tif (el instanceof HTMLElement) {\n\t\t\t\t\t\tlet element = el as (EventTarget & HTMLElement) | null;\n\t\t\t\t\t\twhile (element && element !== document.body) {\n\t\t\t\t\t\t\tif (element.tagName === \"DRAWER-CONTENT\") {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\telement = element.parentElement;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t});\n\n\t\t\t// The apply phase’s return value IS the cleanup, and\n\t\t\t// `disableBodyScroll` returns void — so returning its call registered\n\t\t\t// no cleanup at all. The lock was only released on the *next* run’s\n\t\t\t// cleanup, i.e. when the drawer reopened, so closing it left the page\n\t\t\t// unscrollable.\n\t\t\treturn () => enableBodyScroll(element);\n\t\t},\n\t);\n\n\tcreateGuardedEffect(\n\t\t() => state.isOpen,\n\t\t(isOpen, previous) => {\n\t\t\t// Nothing to close on the mount run: a descendant that starts open was\n\t\t\t// authored that way, and closing it here would fight the markup.\n\t\t\tif (previous === undefined || isOpen) return;\n\t\t\t// Closing this one hides everything inside it, but a nested overlay\n\t\t\t// keeps its own `isOpen` until something changes it — so it would stay\n\t\t\t// \"open\" while invisible, never fire its close event, and reappear\n\t\t\t// still open when this one is opened again.\n\t\t\tcloseNestedOverlays(element);\n\t\t},\n\t);\n\n\tcreateGuardedEffect(\n\t\t() => ({ isOpen: state.isOpen, animationQueue: state.animationQueue }),\n\t\t({ isOpen, animationQueue }) => {\n\t\t\tif (isOpen) return;\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\"Waiting for animations to complete...\", animationQueue);\n\t\t\t// Deliberately not returned: in v2 the apply phase's return value is\n\t\t\t// the cleanup function, and this is a promise chain.\n\t\t\tvoid Promise.all(animationQueue)\n\t\t\t\t.then(() => hideElement(element))\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (debug) console.log(\"Hiding element\", element);\n\t\t\t\t});\n\t\t},\n\t);\n\n\tonCleanup(() => {\n\t\tenableBodyScroll(element);\n\t});\n};\n"],"mappings":";;;;;;;AAyBA,IAAa,OAAO;AAEpB,IAAa,aAA0C,OAAO,EAAE,cAAc;CAE7E,MAAM,QAAQ,cAAc,MAAM,KAAK;CAGvC,MAAM,YAAY,KAAK,OAAO,UAAU,aAAa;CAUrD,MAAM,UAAU,qBAAqB;EARpC,IAAI,SAAS;GACZ,OAAO,MAAM;EACd;EACA,IAAI,cAAc;GACjB,OAAO,MAAM;EACd;CAGoC,GAAc,OAAO;CAE1D,MAAM,CAAC,OAAO,EAAE,qBAAqB;CAErC,MAAM,CAAC,GAAG,EAAE,sBAAsB,GAAG,YAAY,iBAAiB,OAAO;CAEzE,QAAQ,UAAU;CAElB,MAAM,cAAc,iBAAiB,SAAS,gBAAgB;CAC9D,MAAM,cAAc,kBAAkB,OAAO;CAE7C,MAAM,YAAY,gBAAgB,gBAAgB;EACjD,mBAAmB;EAKnB,mBAAmB;EACnB,yBAAyB;EAGzB,oBAAoB,MAAM,KAAK;EAE/B,qBAAqB,MAAM,KAAK;CAOjC,EAAE;CAEF,2BACQ;EACN,QAAQ,MAAM;EACd,eAAe,UAAU;CAC1B,KACC,EAAE,QAAQ,oBAAoB;E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
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
import { useDrawerAt, useDrawerContext } from "../hooks/useDrawer.js";
|
|
2
|
+
import "../hooks/index.js";
|
|
3
|
+
import { createGuardedEffect, ensureId, findDisclosureControl } from "@brytdesigns/web-component-core/utils";
|
|
4
|
+
import { observeElementInViewport } from "observe-element-in-viewport";
|
|
5
|
+
//#region src/components/drawer-trigger.ts
|
|
6
|
+
var Name = "drawer-trigger";
|
|
7
|
+
var Component = (props, { element }) => {
|
|
8
|
+
const drawer = useDrawerAt(() => props.target, element);
|
|
9
|
+
createGuardedEffect(() => ({
|
|
10
|
+
context: drawer(),
|
|
11
|
+
action: props.action,
|
|
12
|
+
on: props.on,
|
|
13
|
+
preventDefault: props.preventDefault
|
|
14
|
+
}), ({ context, action, on, preventDefault }) => {
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const [state, { open, close, toggle }] = useDrawerContext(context);
|
|
17
|
+
switch (on) {
|
|
18
|
+
case "enter":
|
|
19
|
+
if (action === "toggle") {
|
|
20
|
+
const unsubscribe = observeElementInViewport(element, open, close);
|
|
21
|
+
return () => {
|
|
22
|
+
unsubscribe();
|
|
23
|
+
controller.abort();
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
case "exit":
|
|
28
|
+
if (action === "toggle") {
|
|
29
|
+
const unsubscribe = observeElementInViewport(element, close, open);
|
|
30
|
+
return () => {
|
|
31
|
+
unsubscribe();
|
|
32
|
+
controller.abort();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
default: element.addEventListener(on, (event) => {
|
|
37
|
+
if (preventDefault) event.preventDefault();
|
|
38
|
+
if (state.isAnimating) return;
|
|
39
|
+
switch (action) {
|
|
40
|
+
case "close":
|
|
41
|
+
close();
|
|
42
|
+
break;
|
|
43
|
+
case "open":
|
|
44
|
+
open();
|
|
45
|
+
break;
|
|
46
|
+
case "toggle": toggle();
|
|
47
|
+
}
|
|
48
|
+
}, { signal: controller.signal });
|
|
49
|
+
}
|
|
50
|
+
return () => {
|
|
51
|
+
controller.abort();
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* ARIA for the control that opens the overlay.
|
|
56
|
+
*
|
|
57
|
+
* `aria-haspopup="dialog"` rather than `aria-expanded`: this opens an
|
|
58
|
+
* overlay and moves focus into it, which is not the disclosure pattern
|
|
59
|
+
* `aria-expanded` describes. None of this was published before.
|
|
60
|
+
*
|
|
61
|
+
* A trigger with no button inside warns and sets nothing, matching
|
|
62
|
+
* `dialog-trigger` — ARIA on a non-interactive wrapper would claim a
|
|
63
|
+
* control that assistive tech cannot operate.
|
|
64
|
+
*/
|
|
65
|
+
createGuardedEffect(() => ({
|
|
66
|
+
context: drawer(),
|
|
67
|
+
selector: props.target
|
|
68
|
+
}), ({ selector }) => {
|
|
69
|
+
const control = findDisclosureControl(element);
|
|
70
|
+
if (!control) {
|
|
71
|
+
console.warn("drawer-trigger: no <button> inside it, so no ARIA was applied. Wrap the trigger content in a <button type=\"button\">.", element);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
control.setAttribute("aria-haspopup", "dialog");
|
|
75
|
+
const root = selector ? document.querySelector(selector) : null;
|
|
76
|
+
if (root && !control.hasAttribute("aria-controls")) control.setAttribute("aria-controls", ensureId(root, "drawer"));
|
|
77
|
+
});
|
|
78
|
+
createGuardedEffect(() => {
|
|
79
|
+
const context = drawer();
|
|
80
|
+
const [state] = useDrawerContext(context);
|
|
81
|
+
return {
|
|
82
|
+
isOpen: state.isOpen,
|
|
83
|
+
isAnimating: state.isAnimating
|
|
84
|
+
};
|
|
85
|
+
}, ({ isOpen, isAnimating }) => {
|
|
86
|
+
element.setAttribute("is-open", `${isOpen}`);
|
|
87
|
+
element.setAttribute("is-animating", `${isAnimating}`);
|
|
88
|
+
});
|
|
70
89
|
};
|
|
71
|
-
|
|
90
|
+
//#endregion
|
|
72
91
|
export { Component, Name };
|
|
73
|
-
|
|
92
|
+
|
|
74
93
|
//# sourceMappingURL=drawer-trigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"drawer-trigger.js","names":[],"sources":["../../../src/components/drawer-trigger.ts"],"sourcesContent":["import {\n\ttype CorrectComponentType,\n\tcreateGuardedEffect,\n\tensureId,\n\tfindDisclosureControl,\n} from \"@brytdesigns/web-component-core/utils\";\nimport { observeElementInViewport } from \"observe-element-in-viewport\";\n\nimport type { Action } from \"../consts\";\n\nimport { useDrawerAt, useDrawerContext } from \"../hooks/index.js\";\n\nexport type Props = {\n\ttarget?: string;\n\taction?: Action | \"\";\n\ton?: keyof HTMLElementEventMap | \"enter\" | \"exit\";\n\tpreventDefault: boolean;\n};\n\nexport const Name = \"drawer-trigger\";\n\nexport const Component: CorrectComponentType<Props> = (props, { element }) => {\n\t// The drawer is not an ancestor, so this is a lateral lookup. It resolves\n\t// asynchronously — waiting for a provider that may mount later, and\n\t// re-resolving if one replaces it — and reading it in an effect's compute\n\t// phase simply defers the apply until it is ready. No boundary needed.\n\tconst drawer = useDrawerAt(() => props.target, element);\n\n\tcreateGuardedEffect(\n\t\t() => ({\n\t\t\tcontext: drawer(),\n\t\t\taction: props.action,\n\t\t\ton: props.on,\n\t\t\tpreventDefault: props.preventDefault,\n\t\t}),\n\t\t({ context, action, on, preventDefault }) => {\n\t\t\tconst controller = new AbortController();\n\t\t\tconst [state, { open, close, toggle }] = useDrawerContext(context);\n\n\t\t\tswitch (on) {\n\t\t\t\tcase \"enter\": {\n\t\t\t\t\tif (action === \"toggle\") {\n\t\t\t\t\t\tconst unsubscribe = observeElementInViewport(element, open, close);\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t\t\tcontroller.abort();\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"exit\": {\n\t\t\t\t\tif (action === \"toggle\") {\n\t\t\t\t\t\tconst unsubscribe = observeElementInViewport(element, close, open);\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\tunsubscribe();\n\t\t\t\t\t\t\tcontroller.abort();\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\telement.addEventListener(\n\t\t\t\t\t\t//@ts-expect-error `on` is a free-form attribute\n\t\t\t\t\t\ton,\n\t\t\t\t\t\t(event) => {\n\t\t\t\t\t\t\tif (preventDefault) event.preventDefault();\n\t\t\t\t\t\t\tif (state.isAnimating) return;\n\t\t\t\t\t\t\tswitch (action) {\n\t\t\t\t\t\t\t\tcase \"close\":\n\t\t\t\t\t\t\t\t\tclose();\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"open\":\n\t\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase \"toggle\":\n\t\t\t\t\t\t\t\t\ttoggle();\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ signal: controller.signal },\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\tcontroller.abort();\n\t\t\t};\n\t\t},\n\t);\n\n\t/**\n\t * ARIA for the control that opens the overlay.\n\t *\n\t * `aria-haspopup=\"dialog\"` rather than `aria-expanded`: this opens an\n\t * overlay and moves focus into it, which is not the disclosure pattern\n\t * `aria-expanded` describes. None of this was published before.\n\t *\n\t * A trigger with no button inside warns and sets nothing, matching\n\t * `dialog-trigger` — ARIA on a non-interactive wrapper would claim a\n\t * control that assistive tech cannot operate.\n\t */\n\tcreateGuardedEffect(\n\t\t// `target` belongs in the dependency list. It was read from the apply\n\t\t// phase, which does not track, so a trigger whose `target` changed kept\n\t\t// publishing `aria-controls` for the element it used to point at — the\n\t\t// same shape of defect as `product-variant-input` writing a stale\n\t\t// variant id, and just as quiet.\n\t\t() => ({ context: drawer(), selector: props.target }),\n\t\t({ selector }) => {\n\t\t\tconst control = findDisclosureControl(element);\n\t\t\tif (!control) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'drawer-trigger: no <button> inside it, so no ARIA was applied. Wrap the trigger content in a <button type=\"button\">.',\n\t\t\t\t\telement,\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcontrol.setAttribute(\"aria-haspopup\", \"dialog\");\n\t\t\tconst root = selector\n\t\t\t\t? document.querySelector<HTMLElement>(selector)\n\t\t\t\t: null;\n\t\t\t// An authored aria-controls is left alone.\n\t\t\tif (root && !control.hasAttribute(\"aria-controls\")) {\n\t\t\t\tcontrol.setAttribute(\"aria-controls\", ensureId(root, \"drawer\"));\n\t\t\t}\n\t\t},\n\t);\n\n\t// Mirroring drawer state onto the trigger is independent of which listener\n\t// is wired, so it is its own effect rather than nested inside the one above.\n\tcreateGuardedEffect(\n\t\t() => {\n\t\t\tconst context = drawer();\n\t\t\tconst [state] = useDrawerContext(context);\n\t\t\treturn { isOpen: state.isOpen, isAnimating: state.isAnimating };\n\t\t},\n\t\t({ isOpen, isAnimating }) => {\n\t\t\telement.setAttribute(\"is-open\", `${isOpen}`);\n\t\t\telement.setAttribute(\"is-animating\", `${isAnimating}`);\n\t\t},\n\t);\n};\n"],"mappings":";;;;;AAmBA,IAAa,OAAO;AAEpB,IAAa,aAA0C,OAAO,EAAE,cAAc;CAK7E,MAAM,SAAS,kBAAkB,MAAM,QAAQ,OAAO;CAEtD,2BACQ;EACN,SAAS,OAAO;EAChB,QAAQ,MAAM;EACd,IAAI,MAAM;EAC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Aa,MAAM;EAAY;CAC/D,IACC,EAAE,QAAQ,kBAAkB;EAC5B,QAAQ,aAAa,WAAW,GAAG,QAAQ;EAC3C,QAAQ,aAAa,gBAAgB,GAAG,aAAa;CACtD,CACD;AACD"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import * as drawerBackdrop_js from './drawer-backdrop.js';
|
|
6
|
-
export { drawerBackdrop_js as DrawerBackdrop };
|
|
7
|
-
import * as drawerContext_js from './drawer-context.js';
|
|
8
|
-
export { drawerContext_js as DrawerContext };
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import "./drawer-backdrop.js";
|
|
2
|
+
import "./drawer-content.js";
|
|
3
|
+
import "./drawer-context.js";
|
|
4
|
+
import "./drawer-trigger.js";
|
package/dist/main/consts.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/consts.ts
|
|
2
|
+
var POSITION = {
|
|
3
|
+
TOP: "top",
|
|
4
|
+
BOTTOM: "bottom",
|
|
5
|
+
LEFT: "left",
|
|
6
|
+
RIGHT: "right"
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
CLOSE: "close",
|
|
10
|
-
TOGGLE: "toggle"
|
|
11
|
-
};
|
|
12
|
-
const EVENT_NAMESPACE = `bryt:drawer`;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { POSITION };
|
|
13
10
|
|
|
14
|
-
export { ACTION, EVENT_NAMESPACE, POSITION };
|
|
15
|
-
//# sourceMappingURL=consts.js.map
|
|
16
11
|
//# sourceMappingURL=consts.js.map
|
package/dist/main/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"consts.js","names":[],"sources":["../../src/consts.ts"],"sourcesContent":["export type Position = (typeof POSITION)[keyof typeof POSITION];\nexport type Action = (typeof ACTION)[keyof typeof ACTION];\n\nexport const POSITION = {\n\tTOP: \"top\",\n\tBOTTOM: \"bottom\",\n\tLEFT: \"left\",\n\tRIGHT: \"right\",\n} as const;\n\nexport const ACTION = {\n\tOPEN: \"open\",\n\tCLOSE: \"close\",\n\tTOGGLE: \"toggle\",\n};\n\nexport const EVENT_NAMESPACE = `bryt:drawer` as const;\n"],"mappings":";AAGA,IAAa,WAAW;CACvB,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;AACR"}
|
package/dist/main/hooks/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { getDrawerContext, provideDrawerContext, useDrawer, useDrawerAt, useDrawerContext } from "./useDrawer.js";
|
|
2
|
+
export { getDrawerContext, provideDrawerContext, useDrawer, useDrawerAt, useDrawerContext };
|
|
@@ -1,89 +1,93 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { abortablePromise } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createGuardedEffect, createRemoteContext, getContextFromProvider, toHyphenated } from "@brytdesigns/web-component-core/utils";
|
|
2
|
+
import { awaitAllAnimations } from "@brytdesigns/web-component-core/animation";
|
|
3
|
+
import { createSignal, merge, omit, untrack } from "solid-js";
|
|
4
|
+
import { abortablePromise } from "@brytdesigns/web-component-core/promise";
|
|
5
|
+
import { consume, createContext, provide } from "component-register";
|
|
6
|
+
//#region src/hooks/useDrawer.ts
|
|
8
7
|
function initializeDrawerContext(props) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
8
|
+
const _state = omit(props, "root");
|
|
9
|
+
/**
|
|
10
|
+
* The animation queue is a SIGNAL, not a store.
|
|
11
|
+
*
|
|
12
|
+
* A store deep-proxies what you put in it, and what goes in here is a list of
|
|
13
|
+
* live Motion playback controls. Proxied, every `.finished`, `.state` and
|
|
14
|
+
* `.then` on them became a reactive read from a non-tracking scope — hundreds
|
|
15
|
+
* of STRICT_READ_UNTRACKED reports under any interaction, and a proxy hop on
|
|
16
|
+
* every property access of an object that is not state at all.
|
|
17
|
+
*
|
|
18
|
+
* Nothing here needs per-property reactivity: the queue is replaced wholesale
|
|
19
|
+
* and read wholesale. A signal is the right primitive, and it hands the
|
|
20
|
+
* controls back exactly as they went in.
|
|
21
|
+
*/
|
|
22
|
+
const [animationQueue, setAnimationQueue] = createSignal([]);
|
|
23
|
+
createGuardedEffect(animationQueue, (queue) => {
|
|
24
|
+
if (!queue.length) return;
|
|
25
|
+
const controller = new AbortController();
|
|
26
|
+
const animations = awaitAllAnimations(queue);
|
|
27
|
+
const abortableAnimations = abortablePromise(animations, controller.signal);
|
|
28
|
+
setElementState("isAnimating", true);
|
|
29
|
+
abortableAnimations.finally(() => {
|
|
30
|
+
setElementState("isAnimating", false);
|
|
31
|
+
setAnimationQueue([]);
|
|
32
|
+
});
|
|
33
|
+
return () => {
|
|
34
|
+
controller.abort("Aborting drawer animations");
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
function setElementState(key, value) {
|
|
38
|
+
const currentValue = untrack(() => props[key]);
|
|
39
|
+
if (typeof value === "function") {
|
|
40
|
+
const result = value(currentValue || false);
|
|
41
|
+
if (`${currentValue}` === `${result}`) return;
|
|
42
|
+
props.root.setAttribute(toHyphenated(key), `${result}`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (`${currentValue}` === `${value}`) return;
|
|
46
|
+
return props.root.setAttribute(toHyphenated(key), `${value}`);
|
|
47
|
+
}
|
|
48
|
+
return [merge(_state, { get animationQueue() {
|
|
49
|
+
return animationQueue();
|
|
50
|
+
} }), {
|
|
51
|
+
setElementState,
|
|
52
|
+
setAnimationQueue
|
|
53
|
+
}];
|
|
47
54
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
var DrawerContextState = createContext(initializeDrawerContext);
|
|
56
|
+
var provideDrawerContext = (initialState, element) => {
|
|
57
|
+
const props = merge(initialState, { root: element });
|
|
58
|
+
return provide(DrawerContextState, props, element);
|
|
52
59
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
var useDrawerContext = (context) => {
|
|
61
|
+
const [state, { setElementState, setAnimationQueue }] = context;
|
|
62
|
+
function updateAnimationQueue(animation) {
|
|
63
|
+
setAnimationQueue((queue) => [...queue, animation]);
|
|
64
|
+
}
|
|
65
|
+
function close() {
|
|
66
|
+
setElementState("isOpen", false);
|
|
67
|
+
}
|
|
68
|
+
function open() {
|
|
69
|
+
setElementState("isOpen", true);
|
|
70
|
+
}
|
|
71
|
+
function toggle() {
|
|
72
|
+
setElementState("isOpen", (open) => !open);
|
|
73
|
+
}
|
|
74
|
+
return [state, {
|
|
75
|
+
updateAnimationQueue,
|
|
76
|
+
close,
|
|
77
|
+
open,
|
|
78
|
+
toggle
|
|
79
|
+
}];
|
|
68
80
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"DrawerContext not found! Please ensure to wrap your custom element with drawer-context element."
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
return useDrawerContext(context);
|
|
81
|
+
var useDrawer = (element) => {
|
|
82
|
+
const context = consume(DrawerContextState, element);
|
|
83
|
+
if (!context) throw new Error("DrawerContext not found! Please ensure to wrap your custom element with drawer-context element.");
|
|
84
|
+
return useDrawerContext(context);
|
|
77
85
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
DrawerContextState,
|
|
82
|
-
element
|
|
83
|
-
);
|
|
84
|
-
return useDrawerContext(context);
|
|
86
|
+
var useDrawerAt = createRemoteContext(DrawerContextState);
|
|
87
|
+
var getDrawerContext = (element) => {
|
|
88
|
+
return useDrawerContext(getContextFromProvider(DrawerContextState, element));
|
|
85
89
|
};
|
|
90
|
+
//#endregion
|
|
91
|
+
export { getDrawerContext, provideDrawerContext, useDrawer, useDrawerAt, useDrawerContext };
|
|
86
92
|
|
|
87
|
-
export { getDrawerContext, provideDrawerContext, useDrawer, useDrawerContext, withDrawerElementContext };
|
|
88
|
-
//# sourceMappingURL=useDrawer.js.map
|
|
89
93
|
//# sourceMappingURL=useDrawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useDrawer.js","names":[],"sources":["../../../src/hooks/useDrawer.ts"],"sourcesContent":["import { awaitAllAnimations } from \"@brytdesigns/web-component-core/animation\";\nimport { abortablePromise } from \"@brytdesigns/web-component-core/promise\";\nimport {\n\tcreateGuardedEffect,\n\tcreateRemoteContext,\n\tgetContextFromProvider,\n\ttoHyphenated,\n} from \"@brytdesigns/web-component-core/utils\";\nimport {\n\tconsume,\n\tcreateContext,\n\ttype ICustomElement,\n\tprovide,\n} from \"component-register\";\nimport type { AnimationPlaybackControlsWithThen } from \"motion\";\nimport { createSignal, merge, omit, untrack } from \"solid-js\";\n\ntype StoreContext = {\n\tanimationQueue: AnimationPlaybackControlsWithThen[];\n};\n\ntype CreateContextOptions = {\n\troot: HTMLElement & ICustomElement;\n\tisOpen: boolean;\n\tisAnimating: boolean;\n};\n\ntype WalkableNode = Parameters<typeof provide>[2];\n\ntype DrawerContext = ReturnType<typeof initializeDrawerContext>;\n\nfunction initializeDrawerContext(props: CreateContextOptions) {\n\t// `omit` returns only the rest; `root` is read straight off `props`.\n\tconst _state = omit(props, \"root\");\n\t/**\n\t * The animation queue is a SIGNAL, not a store.\n\t *\n\t * A store deep-proxies what you put in it, and what goes in here is a list of\n\t * live Motion playback controls. Proxied, every `.finished`, `.state` and\n\t * `.then` on them became a reactive read from a non-tracking scope — hundreds\n\t * of STRICT_READ_UNTRACKED reports under any interaction, and a proxy hop on\n\t * every property access of an object that is not state at all.\n\t *\n\t * Nothing here needs per-property reactivity: the queue is replaced wholesale\n\t * and read wholesale. A signal is the right primitive, and it hands the\n\t * controls back exactly as they went in.\n\t */\n\tconst [animationQueue, setAnimationQueue] = createSignal<\n\t\tAnimationPlaybackControlsWithThen[]\n\t>([]);\n\n\tcreateGuardedEffect(animationQueue, (queue) => {\n\t\tif (!queue.length) return;\n\t\tconst controller = new AbortController();\n\t\tconst animations = awaitAllAnimations(queue);\n\t\tconst abortableAnimations = abortablePromise(animations, controller.signal);\n\t\tsetElementState(\"isAnimating\", true);\n\t\tabortableAnimations.finally(() => {\n\t\t\t// No `batch` in v2 — writes stage and flush together by default.\n\t\t\tsetElementState(\"isAnimating\", false);\n\t\t\tsetAnimationQueue([]);\n\t\t});\n\n\t\t// v2 treats the apply phase's return value as the cleanup.\n\t\treturn () => {\n\t\t\tcontroller.abort(\"Aborting drawer animations\");\n\t\t};\n\t});\n\n\tfunction setElementState(\n\t\tkey: keyof Omit<CreateContextOptions, \"root\">,\n\t\tvalue: boolean | ((v: boolean) => boolean),\n\t) {\n\t\tconst currentValue = untrack(() => props[key]);\n\t\tif (typeof value === \"function\") {\n\t\t\tconst result = value(currentValue || false);\n\t\t\tif (`${currentValue}` === `${result}`) return;\n\t\t\tprops.root.setAttribute(toHyphenated(key), `${result}`);\n\t\t\treturn;\n\t\t}\n\t\tif (`${currentValue}` === `${value}`) return;\n\t\treturn props.root.setAttribute(toHyphenated(key), `${value}`);\n\t}\n\n\treturn [\n\t\tmerge(_state, {\n\t\t\tget animationQueue() {\n\t\t\t\treturn animationQueue();\n\t\t\t},\n\t\t}),\n\t\t{ setElementState, setAnimationQueue },\n\t] as const;\n}\n\nconst DrawerContextState = createContext(initializeDrawerContext);\n\nexport const provideDrawerContext = (\n\tinitialState: Omit<CreateContextOptions, \"root\">,\n\telement: WalkableNode,\n): DrawerContext => {\n\tconst props = merge(initialState, { root: element });\n\treturn provide(DrawerContextState, props, element);\n};\n\nexport const useDrawerContext = (context: DrawerContext) => {\n\tconst [state, { setElementState, setAnimationQueue }] = context;\n\n\tfunction updateAnimationQueue(animation: AnimationPlaybackControlsWithThen) {\n\t\t// v2 store setters are draft-first, but this one REPLACES the array\n\t\t// rather than pushing into it. The effect above tracks\n\t\t// `store.animationQueue` — the property, not its contents — and an\n\t\t// in-place `push` leaves that property pointing at the same array, so\n\t\t// the effect never re-ran and `is-animating` was never published at\n\t\t// any point, open or closed.\n\t\tsetAnimationQueue((queue) => [...queue, animation]);\n\t}\n\n\tfunction close() {\n\t\tsetElementState(\"isOpen\", false);\n\t}\n\n\tfunction open() {\n\t\tsetElementState(\"isOpen\", true);\n\t}\n\n\tfunction toggle() {\n\t\tsetElementState(\"isOpen\", (open) => !open);\n\t}\n\n\treturn [state, { updateAnimationQueue, close, open, toggle }] as const;\n};\n\nexport const useDrawer = (element: HTMLElement & ICustomElement) => {\n\tconst context: DrawerContext = consume(DrawerContextState, element);\n\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t\"DrawerContext not found! Please ensure to wrap your custom element with drawer-context element.\",\n\t\t);\n\t}\n\n\treturn useDrawerContext(context);\n};\n\nexport const useDrawerAt =\n\tcreateRemoteContext<DrawerContext>(DrawerContextState);\n\nexport const getDrawerContext = (element: Element) => {\n\tconst context = getContextFromProvider<DrawerContext>(\n\t\tDrawerContextState,\n\t\telement,\n\t);\n\treturn useDrawerContext(context);\n};\n"],"mappings":";;;;;;AA+BA,SAAS,wBAAwB,OAA6B;CAE7D,MAAM,SAAS,KAAK,OAAO,MAAM;;;;;;;;;;;;;;CAcjC,MAAM,CAAC,gBAAgB,qBAAqB,aAE1C,CAAC,CAAC;CAEJ,oBAAoB,iBAAiB,UAAU;EAC9C,IAAI,CAAC,MAAM,QAAQ;EACnB,MAAM,aAAa,IAAI,gBAAgB;EACvC,MAAM,aAAa,mBAAmB,KAAK;EAC3C,MAAM,sBAAsB,iBAAiB,YAAY,WAAW,MAAM;EAC1E,gBAAgB,eAAe,IAAI;EACnC,oBAAoB,cAAc;GAEjC,gBAAgB,eAAe,KAAK;GACpC,kBAAkB,CAAC,CAAC;EACrB,CAAC;EAGD,aAAa;GACZ,WAAW,MAAM,4BAA4B;EAC9C;CACD,CAAC;CAED,SAAS,gBACR,KACA,OACC;EACD,MAAM,eAAe,cAAc,MAAM,IAAI;EAC7C,IAAI,OAAO,UAAU,YAAY;GAChC,MAAM,SAAS,MAAM,gBAAgB,KAAK;GAC1C,IAAI,GAAG,mBAAmB,GAAG,UAAU;GACvC,MAAM,KAAK,aAAa,aAAa,GAAG,GAAG,GAAG,QAAQ;GACtD;EACD;EACA,IAAI,GAAG,mBAAmB,GAAG,SAAS;EACtC,OAAO,MAAM,KAAK,aAAa,aAAa,GAAG,GAAG,GAAG,OAAO;CAC7D;CAEA,OAAO,CACN,MAAM,QAAQ,EACb,IAAI,iBAAiB;EACpB,OAAO,eAAe;CACvB,EACD,CAAC,GACD;EAAE;EAAiB;CAAkB,CACtC;AACD;AAEA,IAAM,qBAAqB,cAAc,uBAAuB;AAEhE,IAAa,wBACZ,cACA,YACmB;CACnB,MAAM,QAAQ,MA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