@qualcomm-ui/core 1.0.2 → 1.0.3
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/collapsible/index.cjs +1 -1
- package/dist/collapsible/index.cjs.map +2 -2
- package/dist/collapsible/index.js +1 -1
- package/dist/collapsible/index.js.map +2 -2
- package/dist/combobox/combobox.api.d.ts.map +1 -1
- package/dist/combobox/combobox.types.d.ts +1 -0
- package/dist/combobox/combobox.types.d.ts.map +1 -1
- package/dist/combobox/index.cjs +1 -1
- package/dist/combobox/index.cjs.map +2 -2
- package/dist/combobox/index.js +1 -1
- package/dist/combobox/index.js.map +2 -2
- package/dist/dialog/index.cjs +1 -1
- package/dist/dialog/index.cjs.map +2 -2
- package/dist/dialog/index.js +1 -1
- package/dist/dialog/index.js.map +2 -2
- package/dist/presence/index.cjs +1 -1
- package/dist/presence/index.cjs.map +2 -2
- package/dist/presence/index.js +1 -1
- package/dist/presence/index.js.map +2 -2
- package/dist/presence/presence.machine.d.ts.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dialog/index.ts", "../../src/dialog/dialog.api.ts", "../../src/dialog/internal/dialog.dom.ts", "../../src/dialog/dialog.machine.ts", "../../src/dialog/dialog.props.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"./dialog.api\"\nexport * from \"./dialog.machine\"\nexport * from \"./dialog.props\"\nexport type * from \"./dialog.types\"\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {booleanAriaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n DialogApi,\n DialogBackdropBindings,\n DialogBodyBindings,\n DialogCloseTriggerBindings,\n DialogContentBindings,\n DialogDescriptionBindings,\n DialogFooterBindings,\n DialogHeadingBindings,\n DialogPositionerBindings,\n DialogSchema,\n DialogTriggerBindings,\n} from \"./dialog.types\"\nimport {domIds} from \"./internal\"\n\nconst commonBindings: {\"data-scope\": \"dialog\"} = {\n \"data-scope\": \"dialog\",\n}\n\nexport function createDialogApi(\n machine: Machine<DialogSchema>,\n normalize: PropNormalizer,\n): DialogApi {\n const {prop, scope, send, state} = machine\n\n const ariaLabel = prop(\"aria-label\")\n const open = state.matches(\"open\")\n\n return {\n open,\n setOpen(nextOpen) {\n const open = state.matches(\"open\")\n if (open === nextOpen) {\n return\n }\n send({type: nextOpen ? \"OPEN\" : \"CLOSE\"})\n },\n\n // group: bindings\n getBackdropBindings(props): DialogBackdropBindings {\n scope.ids.register(\"backdrop\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"backdrop\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n })\n },\n getBodyBindings(): DialogBodyBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"body\",\n })\n },\n getCloseTriggerBindings(props): DialogCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"data-part\": \"close-trigger\",\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"CLOSE\"})\n },\n type: \"button\",\n })\n },\n getContentBindings(props): DialogContentBindings {\n scope.ids.register(\"content\", props)\n const labelId = domIds.label(scope)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": domIds.description(scope) || undefined,\n \"aria-label\": ariaLabel || undefined,\n \"aria-labelledby\": ariaLabel || !labelId ? undefined : labelId,\n \"aria-modal\": prop(\"modal\"),\n \"data-part\": \"content\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n role: prop(\"role\"),\n tabIndex: -1,\n })\n },\n getDescriptionBindings(props): DialogDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getFooterBindings(): DialogFooterBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"footer\",\n dir: prop(\"dir\"),\n })\n },\n getHeadingBindings(props): DialogHeadingBindings {\n scope.ids.register(\"label\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getPositionerBindings(props): DialogPositionerBindings {\n scope.ids.register(\"positioner\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"positioner\",\n dir: prop(\"dir\"),\n id: props.id,\n style: {\n pointerEvents: open ? undefined : \"none\",\n },\n })\n },\n getTriggerBindings(props): DialogTriggerBindings {\n scope.ids.register(\"trigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-controls\": domIds.content(scope),\n \"aria-expanded\": booleanAriaAttr(open),\n \"aria-haspopup\": \"dialog\",\n \"data-part\": \"trigger\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"TOGGLE\"})\n },\n type: \"button\",\n })\n },\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomElements, ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogElementIds, DialogScope} from \"../dialog.types\"\n\nexport const domIds: ScopeDomIds<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.ids.get(\"backdrop\"),\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n content: (scope) => scope.ids.get(\"content\"),\n description: (scope) => scope.ids.get(\"description\"),\n label: (scope) => scope.ids.get(\"label\"),\n positioner: (scope) => scope.ids.get(\"positioner\"),\n trigger: (scope) => scope.ids.get(\"trigger\"),\n}\n\nexport const domEls: ScopeDomElements<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.getById(domIds.backdrop(scope)),\n closeTrigger: (scope) => scope.getById(domIds.closeTrigger(scope)),\n content: (scope) => scope.getById(domIds.content(scope)),\n description: (scope) => scope.getById(domIds.description(scope)),\n label: (scope) => scope.getById(domIds.label(scope)),\n positioner: (scope) => scope.getById(domIds.positioner(scope)),\n trigger: (scope) => scope.getById(domIds.trigger(scope)),\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaHidden} from \"@qualcomm-ui/dom/aria-hidden\"\nimport {trackDismissableElement} from \"@qualcomm-ui/dom/dismissable\"\nimport {trapFocus} from \"@qualcomm-ui/dom/focus-trap\"\nimport {raf} from \"@qualcomm-ui/dom/query\"\nimport {preventBodyScroll} from \"@qualcomm-ui/dom/remove-scroll\"\nimport {isDefined} from \"@qualcomm-ui/utils/guard\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogApiProps, DialogSchema} from \"./dialog.types\"\nimport {domEls} from \"./internal\"\n\nexport const dialogMachine: MachineConfig<DialogSchema> =\n createMachine<DialogSchema>({\n actions: {\n invokeOnClose: ({prop}) => {\n prop(\"onOpenChange\")?.(false)\n },\n invokeOnOpen: ({prop}) => {\n prop(\"onOpenChange\")?.(true)\n },\n syncZIndex: ({scope}) => {\n raf(() => {\n const contentEl = domEls.content(scope)\n if (!contentEl) {\n return\n }\n\n const styles = getComputedStyle(contentEl)\n const elems = [domEls.positioner(scope), domEls.backdrop(scope)]\n elems.forEach((node) => {\n node?.style.setProperty(\"--z-index\", styles.zIndex)\n })\n })\n },\n toggleVisibility: ({prop, send}) => {\n send({type: prop(\"open\") ? \"CONTROLLED.OPEN\" : \"CONTROLLED.CLOSE\"})\n },\n },\n\n effects: {\n hideContentBelow({prop, scope}) {\n if (!prop(\"modal\")) {\n return\n }\n const getElements = () => [domEls.content(scope)]\n return ariaHidden(getElements, {defer: true})\n },\n\n preventScroll({prop, scope}) {\n if (!prop(\"preventScroll\")) {\n return\n }\n return preventBodyScroll(scope.getDoc())\n },\n\n trackDismissableElement({prop, scope, send}) {\n const getContentEl = () => domEls.content(scope)\n return trackDismissableElement(getContentEl, {\n defer: true,\n exclude: () => [domEls.trigger(scope)],\n onDismiss() {\n send({src: \"interact-outside\", type: \"CLOSE\"})\n },\n onEscapeKeyDown(event) {\n prop(\"onEscapeKeyDown\")?.(event)\n if (!prop(\"closeOnEscape\")) {\n event.preventDefault()\n }\n },\n onFocusOutside: prop(\"onFocusOutside\"),\n onInteractOutside(event) {\n prop(\"onInteractOutside\")?.(event)\n if (!prop(\"closeOnInteractOutside\")) {\n event.preventDefault()\n }\n },\n onPointerDownOutside: prop(\"onPointerDownOutside\"),\n onRequestDismiss: prop(\"onRequestDismiss\"),\n persistentElements: prop(\"persistentElements\"),\n pointerBlocking: prop(\"modal\"),\n })\n },\n\n trapFocus: ({prop, scope}) => {\n if (!prop(\"trapFocus\") || !prop(\"modal\")) {\n return\n }\n const contentEl = () => domEls.content(scope)\n return trapFocus(contentEl, {\n initialFocus: prop(\"initialFocusEl\"),\n preventScroll: true,\n returnFocusOnDeactivate: prop(\"restoreFocus\"),\n setReturnFocus: (el) => prop(\"finalFocusEl\")?.() ?? el,\n })\n },\n },\n\n guards: {\n isOpenControlled: ({prop}) => isDefined(prop(\"open\")),\n },\n\n ids: ({bindableId}) => ({\n backdrop: bindableId<string>(),\n closeTrigger: bindableId<string>(),\n content: bindableId<string>(),\n description: bindableId<string>(),\n label: bindableId<string>(),\n positioner: bindableId<string>(),\n trigger: bindableId<string>(),\n }),\n\n initialState({prop}) {\n const open = prop(\"open\") || prop(\"defaultOpen\")\n return open ? \"open\" : \"closed\"\n },\n\n props: ({props, scope}) => {\n const alertDialog = props.role === \"alertdialog\"\n const initialFocusEl: DialogApiProps[\"initialFocusEl\"] = alertDialog\n ? () => domEls.closeTrigger(scope)\n : undefined\n return {\n closeOnEscape: true,\n closeOnInteractOutside: !alertDialog,\n dir: \"ltr\",\n initialFocusEl: initialFocusEl!,\n modal: true,\n preventScroll: true,\n restoreFocus: true,\n role: \"dialog\",\n trapFocus: true,\n ...props,\n }\n },\n\n states: {\n closed: {\n on: {\n \"CONTROLLED.OPEN\": {\n target: \"open\",\n },\n OPEN: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n TOGGLE: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n },\n },\n open: {\n effects: [\n \"trackDismissableElement\",\n \"trapFocus\",\n \"preventScroll\",\n \"hideContentBelow\",\n ],\n entry: [\"syncZIndex\"],\n on: {\n CLOSE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n \"CONTROLLED.CLOSE\": {\n target: \"closed\",\n },\n TOGGLE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"open\")], () => {\n actions.toggleVisibility()\n })\n },\n })\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {DialogApiProps} from \"./dialog.types\"\n\nexport const dialogProps: (keyof DialogApiProps)[] =\n createProps<DialogApiProps>()(\n \"aria-label\",\n \"closeOnEscape\",\n \"closeOnInteractOutside\",\n \"defaultOpen\",\n \"dir\",\n \"finalFocusEl\",\n \"getRootNode\",\n \"initialFocusEl\",\n \"modal\",\n \"onEscapeKeyDown\",\n \"onFocusOutside\",\n \"onInteractOutside\",\n \"onOpenChange\",\n \"onPointerDownOutside\",\n \"onRequestDismiss\",\n \"open\",\n \"persistentElements\",\n \"preventScroll\",\n \"restoreFocus\",\n \"role\",\n \"trapFocus\",\n )\n\nexport const splitDialogProps: <Props extends DialogApiProps>(\n props: Props,\n) => [DialogApiProps, Omit<Props, keyof DialogApiProps>] =\n createSplitProps<DialogApiProps>(dialogProps)\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,kBAAAC,EAAA,gBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAN,GCMA,IAAAO,EAA8B,yCCIvB,IAAMC,EAAqD,CAChE,SAAWC,GAAUA,EAAM,IAAI,IAAI,UAAU,EAC7C,aAAeA,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,YAAcA,GAAUA,EAAM,IAAI,IAAI,aAAa,EACnD,MAAQA,GAAUA,EAAM,IAAI,IAAI,OAAO,EACvC,WAAaA,GAAUA,EAAM,IAAI,IAAI,YAAY,EACjD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,CAC7C,EAEaC,EAA0D,CACrE,SAAWD,GAAUA,EAAM,QAAQD,EAAO,SAASC,CAAK,CAAC,EACzD,aAAeA,GAAUA,EAAM,QAAQD,EAAO,aAAaC,CAAK,CAAC,EACjE,QAAUA,GAAUA,EAAM,QAAQD,EAAO,QAAQC,CAAK,CAAC,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AAM,GACV,QAAQC,EAAO,CACTA,EAAM,kBAGVN,EAAK,CAAC,KAAM,QAAQ,CAAC,CACvB,EACA,KAAM,QACR,CAAC,CACH,CACF,CACF,CEvJA,IAAAS,EAAyB,wCACzBC,EAAsC,wCACtCC,EAAwB,uCACxBC,EAAkB,kCAClBC,EAAgC,0CAChCC,EAAwB,oCACxBC,EAAgD,sCAKzC,IAAMC,KACX,iBAA4B,CAC1B,QAAS,CACP,cAAe,CAAC,CAAC,KAAAC,CAAI,IAAM,CACzBA,EAAK,cAAc,IAAI,EAAK,CAC9B,EACA,aAAc,CAAC,CAAC,KAAAA,CAAI,IAAM,CACxBA,EAAK,cAAc,IAAI,EAAI,CAC7B,EACA,WAAY,CAAC,CAAC,MAAAC,CAAK,IAAM,IACvB,OAAI,IAAM,CACR,IAAMC,EAAYC,EAAO,QAAQF,CAAK,EACtC,GAAI,CAACC,EACH,OAGF,IAAME,EAAS,
|
|
4
|
+
"sourcesContent": ["export * from \"./dialog.api\"\nexport * from \"./dialog.machine\"\nexport * from \"./dialog.props\"\nexport type * from \"./dialog.types\"\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {booleanAriaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n DialogApi,\n DialogBackdropBindings,\n DialogBodyBindings,\n DialogCloseTriggerBindings,\n DialogContentBindings,\n DialogDescriptionBindings,\n DialogFooterBindings,\n DialogHeadingBindings,\n DialogPositionerBindings,\n DialogSchema,\n DialogTriggerBindings,\n} from \"./dialog.types\"\nimport {domIds} from \"./internal\"\n\nconst commonBindings: {\"data-scope\": \"dialog\"} = {\n \"data-scope\": \"dialog\",\n}\n\nexport function createDialogApi(\n machine: Machine<DialogSchema>,\n normalize: PropNormalizer,\n): DialogApi {\n const {prop, scope, send, state} = machine\n\n const ariaLabel = prop(\"aria-label\")\n const open = state.matches(\"open\")\n\n return {\n open,\n setOpen(nextOpen) {\n const open = state.matches(\"open\")\n if (open === nextOpen) {\n return\n }\n send({type: nextOpen ? \"OPEN\" : \"CLOSE\"})\n },\n\n // group: bindings\n getBackdropBindings(props): DialogBackdropBindings {\n scope.ids.register(\"backdrop\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"backdrop\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n })\n },\n getBodyBindings(): DialogBodyBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"body\",\n })\n },\n getCloseTriggerBindings(props): DialogCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"data-part\": \"close-trigger\",\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"CLOSE\"})\n },\n type: \"button\",\n })\n },\n getContentBindings(props): DialogContentBindings {\n scope.ids.register(\"content\", props)\n const labelId = domIds.label(scope)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": domIds.description(scope) || undefined,\n \"aria-label\": ariaLabel || undefined,\n \"aria-labelledby\": ariaLabel || !labelId ? undefined : labelId,\n \"aria-modal\": prop(\"modal\"),\n \"data-part\": \"content\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n role: prop(\"role\"),\n tabIndex: -1,\n })\n },\n getDescriptionBindings(props): DialogDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getFooterBindings(): DialogFooterBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"footer\",\n dir: prop(\"dir\"),\n })\n },\n getHeadingBindings(props): DialogHeadingBindings {\n scope.ids.register(\"label\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getPositionerBindings(props): DialogPositionerBindings {\n scope.ids.register(\"positioner\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"positioner\",\n dir: prop(\"dir\"),\n id: props.id,\n style: {\n pointerEvents: open ? undefined : \"none\",\n },\n })\n },\n getTriggerBindings(props): DialogTriggerBindings {\n scope.ids.register(\"trigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-controls\": domIds.content(scope),\n \"aria-expanded\": booleanAriaAttr(open),\n \"aria-haspopup\": \"dialog\",\n \"data-part\": \"trigger\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"TOGGLE\"})\n },\n type: \"button\",\n })\n },\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomElements, ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogElementIds, DialogScope} from \"../dialog.types\"\n\nexport const domIds: ScopeDomIds<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.ids.get(\"backdrop\"),\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n content: (scope) => scope.ids.get(\"content\"),\n description: (scope) => scope.ids.get(\"description\"),\n label: (scope) => scope.ids.get(\"label\"),\n positioner: (scope) => scope.ids.get(\"positioner\"),\n trigger: (scope) => scope.ids.get(\"trigger\"),\n}\n\nexport const domEls: ScopeDomElements<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.getById(domIds.backdrop(scope)),\n closeTrigger: (scope) => scope.getById(domIds.closeTrigger(scope)),\n content: (scope) => scope.getById(domIds.content(scope)),\n description: (scope) => scope.getById(domIds.description(scope)),\n label: (scope) => scope.getById(domIds.label(scope)),\n positioner: (scope) => scope.getById(domIds.positioner(scope)),\n trigger: (scope) => scope.getById(domIds.trigger(scope)),\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaHidden} from \"@qualcomm-ui/dom/aria-hidden\"\nimport {trackDismissableElement} from \"@qualcomm-ui/dom/dismissable\"\nimport {trapFocus} from \"@qualcomm-ui/dom/focus-trap\"\nimport {raf} from \"@qualcomm-ui/dom/query\"\nimport {preventBodyScroll} from \"@qualcomm-ui/dom/remove-scroll\"\nimport {isDefined} from \"@qualcomm-ui/utils/guard\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogApiProps, DialogSchema} from \"./dialog.types\"\nimport {domEls} from \"./internal\"\n\nexport const dialogMachine: MachineConfig<DialogSchema> =\n createMachine<DialogSchema>({\n actions: {\n invokeOnClose: ({prop}) => {\n prop(\"onOpenChange\")?.(false)\n },\n invokeOnOpen: ({prop}) => {\n prop(\"onOpenChange\")?.(true)\n },\n syncZIndex: ({scope}) => {\n raf(() => {\n const contentEl = domEls.content(scope)\n if (!contentEl) {\n return\n }\n\n const styles = getComputedStyle?.(contentEl)\n const elems = [domEls.positioner(scope), domEls.backdrop(scope)]\n elems.forEach((node) => {\n node?.style.setProperty(\"--z-index\", styles.zIndex)\n })\n })\n },\n toggleVisibility: ({prop, send}) => {\n send({type: prop(\"open\") ? \"CONTROLLED.OPEN\" : \"CONTROLLED.CLOSE\"})\n },\n },\n\n effects: {\n hideContentBelow({prop, scope}) {\n if (!prop(\"modal\")) {\n return\n }\n const getElements = () => [domEls.content(scope)]\n return ariaHidden(getElements, {defer: true})\n },\n\n preventScroll({prop, scope}) {\n if (!prop(\"preventScroll\")) {\n return\n }\n return preventBodyScroll(scope.getDoc())\n },\n\n trackDismissableElement({prop, scope, send}) {\n const getContentEl = () => domEls.content(scope)\n return trackDismissableElement(getContentEl, {\n defer: true,\n exclude: () => [domEls.trigger(scope)],\n onDismiss() {\n send({src: \"interact-outside\", type: \"CLOSE\"})\n },\n onEscapeKeyDown(event) {\n prop(\"onEscapeKeyDown\")?.(event)\n if (!prop(\"closeOnEscape\")) {\n event.preventDefault()\n }\n },\n onFocusOutside: prop(\"onFocusOutside\"),\n onInteractOutside(event) {\n prop(\"onInteractOutside\")?.(event)\n if (!prop(\"closeOnInteractOutside\")) {\n event.preventDefault()\n }\n },\n onPointerDownOutside: prop(\"onPointerDownOutside\"),\n onRequestDismiss: prop(\"onRequestDismiss\"),\n persistentElements: prop(\"persistentElements\"),\n pointerBlocking: prop(\"modal\"),\n })\n },\n\n trapFocus: ({prop, scope}) => {\n if (!prop(\"trapFocus\") || !prop(\"modal\")) {\n return\n }\n const contentEl = () => domEls.content(scope)\n return trapFocus(contentEl, {\n initialFocus: prop(\"initialFocusEl\"),\n preventScroll: true,\n returnFocusOnDeactivate: prop(\"restoreFocus\"),\n setReturnFocus: (el) => prop(\"finalFocusEl\")?.() ?? el,\n })\n },\n },\n\n guards: {\n isOpenControlled: ({prop}) => isDefined(prop(\"open\")),\n },\n\n ids: ({bindableId}) => ({\n backdrop: bindableId<string>(),\n closeTrigger: bindableId<string>(),\n content: bindableId<string>(),\n description: bindableId<string>(),\n label: bindableId<string>(),\n positioner: bindableId<string>(),\n trigger: bindableId<string>(),\n }),\n\n initialState({prop}) {\n const open = prop(\"open\") || prop(\"defaultOpen\")\n return open ? \"open\" : \"closed\"\n },\n\n props: ({props, scope}) => {\n const alertDialog = props.role === \"alertdialog\"\n const initialFocusEl: DialogApiProps[\"initialFocusEl\"] = alertDialog\n ? () => domEls.closeTrigger(scope)\n : undefined\n return {\n closeOnEscape: true,\n closeOnInteractOutside: !alertDialog,\n dir: \"ltr\",\n initialFocusEl: initialFocusEl!,\n modal: true,\n preventScroll: true,\n restoreFocus: true,\n role: \"dialog\",\n trapFocus: true,\n ...props,\n }\n },\n\n states: {\n closed: {\n on: {\n \"CONTROLLED.OPEN\": {\n target: \"open\",\n },\n OPEN: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n TOGGLE: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n },\n },\n open: {\n effects: [\n \"trackDismissableElement\",\n \"trapFocus\",\n \"preventScroll\",\n \"hideContentBelow\",\n ],\n entry: [\"syncZIndex\"],\n on: {\n CLOSE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n \"CONTROLLED.CLOSE\": {\n target: \"closed\",\n },\n TOGGLE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"open\")], () => {\n actions.toggleVisibility()\n })\n },\n })\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {DialogApiProps} from \"./dialog.types\"\n\nexport const dialogProps: (keyof DialogApiProps)[] =\n createProps<DialogApiProps>()(\n \"aria-label\",\n \"closeOnEscape\",\n \"closeOnInteractOutside\",\n \"defaultOpen\",\n \"dir\",\n \"finalFocusEl\",\n \"getRootNode\",\n \"initialFocusEl\",\n \"modal\",\n \"onEscapeKeyDown\",\n \"onFocusOutside\",\n \"onInteractOutside\",\n \"onOpenChange\",\n \"onPointerDownOutside\",\n \"onRequestDismiss\",\n \"open\",\n \"persistentElements\",\n \"preventScroll\",\n \"restoreFocus\",\n \"role\",\n \"trapFocus\",\n )\n\nexport const splitDialogProps: <Props extends DialogApiProps>(\n props: Props,\n) => [DialogApiProps, Omit<Props, keyof DialogApiProps>] =\n createSplitProps<DialogApiProps>(dialogProps)\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,kBAAAC,EAAA,gBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAN,GCMA,IAAAO,EAA8B,yCCIvB,IAAMC,EAAqD,CAChE,SAAWC,GAAUA,EAAM,IAAI,IAAI,UAAU,EAC7C,aAAeA,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,YAAcA,GAAUA,EAAM,IAAI,IAAI,aAAa,EACnD,MAAQA,GAAUA,EAAM,IAAI,IAAI,OAAO,EACvC,WAAaA,GAAUA,EAAM,IAAI,IAAI,YAAY,EACjD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,CAC7C,EAEaC,EAA0D,CACrE,SAAWD,GAAUA,EAAM,QAAQD,EAAO,SAASC,CAAK,CAAC,EACzD,aAAeA,GAAUA,EAAM,QAAQD,EAAO,aAAaC,CAAK,CAAC,EACjE,QAAUA,GAAUA,EAAM,QAAQD,EAAO,QAAQC,CAAK,CAAC,EACvD,YAAcA,GAAUA,EAAM,QAAQD,EAAO,YAAYC,CAAK,CAAC,EAC/D,MAAQA,GAAUA,EAAM,QAAQD,EAAO,MAAMC,CAAK,CAAC,EACnD,WAAaA,GAAUA,EAAM,QAAQD,EAAO,WAAWC,CAAK,CAAC,EAC7D,QAAUA,GAAUA,EAAM,QAAQD,EAAO,QAAQC,CAAK,CAAC,CACzD,EDJA,IAAME,EAA2C,CAC/C,aAAc,QAChB,EAEO,SAASC,EACd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,CACN,OAAQ,CACN,GAAI,CACF,kBAAmB,CACjB,OAAQ,MACV,EACA,KAAM,CACJ,CACE,QAAS,CAAC,cAAc,EACxB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,cAAc,EACxB,OAAQ,MACV,CACF,EACA,OAAQ,CACN,CACE,QAAS,CAAC,cAAc,EACxB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,cAAc,EACxB,OAAQ,MACV,CACF,CACF,CACF,EACA,KAAM,CACJ,QAAS,CACP,0BACA,YACA,gBACA,kBACF,EACA,MAAO,CAAC,YAAY,EACpB,GAAI,CACF,MAAO,CACL,CACE,QAAS,CAAC,eAAe,EACzB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,eAAe,EACzB,OAAQ,QACV,CACF,EACA,mBAAoB,CAClB,OAAQ,QACV,EACA,OAAQ,CACN,CACE,QAAS,CAAC,eAAe,EACzB,MAAO,kBACT,EACA,CACE,QAAS,CAAC,eAAe,EACzB,OAAQ,QACV,CACF,CACF,CACF,CACF,EAEA,MAAM,CAAC,QAAAE,EAAS,KAAAZ,EAAM,MAAAa,CAAK,EAAG,CAC5BA,EAAM,CAAC,IAAMb,EAAK,MAAM,CAAC,EAAG,IAAM,CAChCY,EAAQ,iBAAiB,CAC3B,CAAC,CACH,CACF,CAAC,EC5MH,IAAAE,EAA4C,qCAI/BC,KACX,eAA4B,EAC1B,aACA,gBACA,yBACA,cACA,MACA,eACA,cACA,iBACA,QACA,kBACA,iBACA,oBACA,eACA,uBACA,mBACA,OACA,qBACA,gBACA,eACA,OACA,WACF,EAEWC,KAGX,oBAAiCD,CAAW",
|
|
6
6
|
"names": ["dialog_exports", "__export", "createDialogApi", "dialogMachine", "dialogProps", "splitDialogProps", "__toCommonJS", "import_attributes", "domIds", "scope", "domEls", "commonBindings", "createDialogApi", "machine", "normalize", "prop", "scope", "send", "state", "ariaLabel", "open", "nextOpen", "props", "event", "labelId", "domIds", "import_aria_hidden", "import_dismissable", "import_focus_trap", "import_query", "import_remove_scroll", "import_guard", "import_machine", "dialogMachine", "prop", "scope", "contentEl", "domEls", "styles", "node", "send", "event", "el", "bindableId", "props", "alertDialog", "actions", "track", "import_object", "dialogProps", "splitDialogProps"]
|
|
7
7
|
}
|
package/dist/dialog/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{booleanAriaAttr as u}from"@qualcomm-ui/utils/attributes";var s={backdrop:e=>e.ids.get("backdrop"),closeTrigger:e=>e.ids.get("closeTrigger"),content:e=>e.ids.get("content"),description:e=>e.ids.get("description"),label:e=>e.ids.get("label"),positioner:e=>e.ids.get("positioner"),trigger:e=>e.ids.get("trigger")},a={backdrop:e=>e.getById(s.backdrop(e)),closeTrigger:e=>e.getById(s.closeTrigger(e)),content:e=>e.getById(s.content(e)),description:e=>e.getById(s.description(e)),label:e=>e.getById(s.label(e)),positioner:e=>e.getById(s.positioner(e)),trigger:e=>e.getById(s.trigger(e))};var l={"data-scope":"dialog"};function b(e,t){let{prop:o,scope:n,send:r,state:g}=e,p=o("aria-label"),c=g.matches("open");return{open:c,setOpen(i){g.matches("open")!==i&&r({type:i?"OPEN":"CLOSE"})},getBackdropBindings(i){return n.ids.register("backdrop",i),t.element({...l,"data-part":"backdrop","data-state":g.get(),dir:o("dir"),hidden:!c,id:i.id})},getBodyBindings(){return t.element({...l,"data-part":"body"})},getCloseTriggerBindings(i){return n.ids.register("closeTrigger",i),t.button({...l,"data-part":"close-trigger",dir:o("dir"),id:i.id,onClick(d){d.defaultPrevented||r({type:"CLOSE"})},type:"button"})},getContentBindings(i){n.ids.register("content",i);let d=s.label(n);return t.element({...l,"aria-describedby":s.description(n)||void 0,"aria-label":p||void 0,"aria-labelledby":p||!d?void 0:d,"aria-modal":o("modal"),"data-part":"content","data-state":g.get(),dir:o("dir"),hidden:!c,id:i.id,role:o("role"),tabIndex:-1})},getDescriptionBindings(i){return n.ids.register("description",i),t.element({...l,"data-part":"description",dir:o("dir"),id:i.id})},getFooterBindings(){return t.element({...l,"data-part":"footer",dir:o("dir")})},getHeadingBindings(i){return n.ids.register("label",i),t.element({...l,"data-part":"heading",dir:o("dir"),id:i.id})},getPositionerBindings(i){return n.ids.register("positioner",i),t.element({...l,"data-part":"positioner",dir:o("dir"),id:i.id,style:{pointerEvents:c?void 0:"none"}})},getTriggerBindings(i){return n.ids.register("trigger",i),t.button({...l,"aria-controls":s.content(n),"aria-expanded":u(c),"aria-haspopup":"dialog","data-part":"trigger","data-state":g.get(),dir:o("dir"),id:i.id,onClick(d){d.defaultPrevented||r({type:"TOGGLE"})},type:"button"})}}}import{ariaHidden as m}from"@qualcomm-ui/dom/aria-hidden";import{trackDismissableElement as D}from"@qualcomm-ui/dom/dismissable";import{trapFocus as O}from"@qualcomm-ui/dom/focus-trap";import{raf as f}from"@qualcomm-ui/dom/query";import{preventBodyScroll as E}from"@qualcomm-ui/dom/remove-scroll";import{isDefined as y}from"@qualcomm-ui/utils/guard";import{createMachine as B}from"@qualcomm-ui/utils/machine";var G=B({actions:{invokeOnClose:({prop:e})=>{e("onOpenChange")?.(!1)},invokeOnOpen:({prop:e})=>{e("onOpenChange")?.(!0)},syncZIndex:({scope:e})=>{f(()=>{let t=a.content(e);if(!t)return;let o=getComputedStyle(t);[a.positioner(e),a.backdrop(e)].forEach(r=>{r?.style.setProperty("--z-index",o.zIndex)})})},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE"})}},effects:{hideContentBelow({prop:e,scope:t}){return e("modal")?m(()=>[a.content(t)],{defer:!0}):void 0},preventScroll({prop:e,scope:t}){if(e("preventScroll"))return E(t.getDoc())},trackDismissableElement({prop:e,scope:t,send:o}){return D(()=>a.content(t),{defer:!0,exclude:()=>[a.trigger(t)],onDismiss(){o({src:"interact-outside",type:"CLOSE"})},onEscapeKeyDown(r){e("onEscapeKeyDown")?.(r),e("closeOnEscape")||r.preventDefault()},onFocusOutside:e("onFocusOutside"),onInteractOutside(r){e("onInteractOutside")?.(r),e("closeOnInteractOutside")||r.preventDefault()},onPointerDownOutside:e("onPointerDownOutside"),onRequestDismiss:e("onRequestDismiss"),persistentElements:e("persistentElements"),pointerBlocking:e("modal")})},trapFocus:({prop:e,scope:t})=>!e("trapFocus")||!e("modal")?void 0:O(()=>a.content(t),{initialFocus:e("initialFocusEl"),preventScroll:!0,returnFocusOnDeactivate:e("restoreFocus"),setReturnFocus:n=>e("finalFocusEl")?.()??n})},guards:{isOpenControlled:({prop:e})=>y(e("open"))},ids:({bindableId:e})=>({backdrop:e(),closeTrigger:e(),content:e(),description:e(),label:e(),positioner:e(),trigger:e()}),initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},props:({props:e,scope:t})=>{let o=e.role==="alertdialog";return{closeOnEscape:!0,closeOnInteractOutside:!o,dir:"ltr",initialFocusEl:o?()=>a.closeTrigger(t):void 0,modal:!0,preventScroll:!0,restoreFocus:!0,role:"dialog",trapFocus:!0,...e}},states:{closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}],TOGGLE:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}]}},open:{effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],entry:["syncZIndex"],on:{CLOSE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}],"CONTROLLED.CLOSE":{target:"closed"},TOGGLE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}]}}},watch({actions:e,prop:t,track:o}){o([()=>t("open")],()=>{e.toggleVisibility()})}});import{createProps as C,createSplitProps as P}from"@qualcomm-ui/utils/object";var k=C()("aria-label","closeOnEscape","closeOnInteractOutside","defaultOpen","dir","finalFocusEl","getRootNode","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"),H=P(k);export{b as createDialogApi,G as dialogMachine,k as dialogProps,H as splitDialogProps};
|
|
1
|
+
import{booleanAriaAttr as u}from"@qualcomm-ui/utils/attributes";var s={backdrop:e=>e.ids.get("backdrop"),closeTrigger:e=>e.ids.get("closeTrigger"),content:e=>e.ids.get("content"),description:e=>e.ids.get("description"),label:e=>e.ids.get("label"),positioner:e=>e.ids.get("positioner"),trigger:e=>e.ids.get("trigger")},a={backdrop:e=>e.getById(s.backdrop(e)),closeTrigger:e=>e.getById(s.closeTrigger(e)),content:e=>e.getById(s.content(e)),description:e=>e.getById(s.description(e)),label:e=>e.getById(s.label(e)),positioner:e=>e.getById(s.positioner(e)),trigger:e=>e.getById(s.trigger(e))};var l={"data-scope":"dialog"};function b(e,t){let{prop:o,scope:n,send:r,state:g}=e,p=o("aria-label"),c=g.matches("open");return{open:c,setOpen(i){g.matches("open")!==i&&r({type:i?"OPEN":"CLOSE"})},getBackdropBindings(i){return n.ids.register("backdrop",i),t.element({...l,"data-part":"backdrop","data-state":g.get(),dir:o("dir"),hidden:!c,id:i.id})},getBodyBindings(){return t.element({...l,"data-part":"body"})},getCloseTriggerBindings(i){return n.ids.register("closeTrigger",i),t.button({...l,"data-part":"close-trigger",dir:o("dir"),id:i.id,onClick(d){d.defaultPrevented||r({type:"CLOSE"})},type:"button"})},getContentBindings(i){n.ids.register("content",i);let d=s.label(n);return t.element({...l,"aria-describedby":s.description(n)||void 0,"aria-label":p||void 0,"aria-labelledby":p||!d?void 0:d,"aria-modal":o("modal"),"data-part":"content","data-state":g.get(),dir:o("dir"),hidden:!c,id:i.id,role:o("role"),tabIndex:-1})},getDescriptionBindings(i){return n.ids.register("description",i),t.element({...l,"data-part":"description",dir:o("dir"),id:i.id})},getFooterBindings(){return t.element({...l,"data-part":"footer",dir:o("dir")})},getHeadingBindings(i){return n.ids.register("label",i),t.element({...l,"data-part":"heading",dir:o("dir"),id:i.id})},getPositionerBindings(i){return n.ids.register("positioner",i),t.element({...l,"data-part":"positioner",dir:o("dir"),id:i.id,style:{pointerEvents:c?void 0:"none"}})},getTriggerBindings(i){return n.ids.register("trigger",i),t.button({...l,"aria-controls":s.content(n),"aria-expanded":u(c),"aria-haspopup":"dialog","data-part":"trigger","data-state":g.get(),dir:o("dir"),id:i.id,onClick(d){d.defaultPrevented||r({type:"TOGGLE"})},type:"button"})}}}import{ariaHidden as m}from"@qualcomm-ui/dom/aria-hidden";import{trackDismissableElement as D}from"@qualcomm-ui/dom/dismissable";import{trapFocus as O}from"@qualcomm-ui/dom/focus-trap";import{raf as f}from"@qualcomm-ui/dom/query";import{preventBodyScroll as E}from"@qualcomm-ui/dom/remove-scroll";import{isDefined as y}from"@qualcomm-ui/utils/guard";import{createMachine as B}from"@qualcomm-ui/utils/machine";var G=B({actions:{invokeOnClose:({prop:e})=>{e("onOpenChange")?.(!1)},invokeOnOpen:({prop:e})=>{e("onOpenChange")?.(!0)},syncZIndex:({scope:e})=>{f(()=>{let t=a.content(e);if(!t)return;let o=getComputedStyle?.(t);[a.positioner(e),a.backdrop(e)].forEach(r=>{r?.style.setProperty("--z-index",o.zIndex)})})},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE"})}},effects:{hideContentBelow({prop:e,scope:t}){return e("modal")?m(()=>[a.content(t)],{defer:!0}):void 0},preventScroll({prop:e,scope:t}){if(e("preventScroll"))return E(t.getDoc())},trackDismissableElement({prop:e,scope:t,send:o}){return D(()=>a.content(t),{defer:!0,exclude:()=>[a.trigger(t)],onDismiss(){o({src:"interact-outside",type:"CLOSE"})},onEscapeKeyDown(r){e("onEscapeKeyDown")?.(r),e("closeOnEscape")||r.preventDefault()},onFocusOutside:e("onFocusOutside"),onInteractOutside(r){e("onInteractOutside")?.(r),e("closeOnInteractOutside")||r.preventDefault()},onPointerDownOutside:e("onPointerDownOutside"),onRequestDismiss:e("onRequestDismiss"),persistentElements:e("persistentElements"),pointerBlocking:e("modal")})},trapFocus:({prop:e,scope:t})=>!e("trapFocus")||!e("modal")?void 0:O(()=>a.content(t),{initialFocus:e("initialFocusEl"),preventScroll:!0,returnFocusOnDeactivate:e("restoreFocus"),setReturnFocus:n=>e("finalFocusEl")?.()??n})},guards:{isOpenControlled:({prop:e})=>y(e("open"))},ids:({bindableId:e})=>({backdrop:e(),closeTrigger:e(),content:e(),description:e(),label:e(),positioner:e(),trigger:e()}),initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},props:({props:e,scope:t})=>{let o=e.role==="alertdialog";return{closeOnEscape:!0,closeOnInteractOutside:!o,dir:"ltr",initialFocusEl:o?()=>a.closeTrigger(t):void 0,modal:!0,preventScroll:!0,restoreFocus:!0,role:"dialog",trapFocus:!0,...e}},states:{closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}],TOGGLE:[{actions:["invokeOnOpen"],guard:"isOpenControlled"},{actions:["invokeOnOpen"],target:"open"}]}},open:{effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],entry:["syncZIndex"],on:{CLOSE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}],"CONTROLLED.CLOSE":{target:"closed"},TOGGLE:[{actions:["invokeOnClose"],guard:"isOpenControlled"},{actions:["invokeOnClose"],target:"closed"}]}}},watch({actions:e,prop:t,track:o}){o([()=>t("open")],()=>{e.toggleVisibility()})}});import{createProps as C,createSplitProps as P}from"@qualcomm-ui/utils/object";var k=C()("aria-label","closeOnEscape","closeOnInteractOutside","defaultOpen","dir","finalFocusEl","getRootNode","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"),H=P(k);export{b as createDialogApi,G as dialogMachine,k as dialogProps,H as splitDialogProps};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/dialog/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dialog/dialog.api.ts", "../../src/dialog/internal/dialog.dom.ts", "../../src/dialog/dialog.machine.ts", "../../src/dialog/dialog.props.ts"],
|
|
4
|
-
"sourcesContent": ["// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {booleanAriaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n DialogApi,\n DialogBackdropBindings,\n DialogBodyBindings,\n DialogCloseTriggerBindings,\n DialogContentBindings,\n DialogDescriptionBindings,\n DialogFooterBindings,\n DialogHeadingBindings,\n DialogPositionerBindings,\n DialogSchema,\n DialogTriggerBindings,\n} from \"./dialog.types\"\nimport {domIds} from \"./internal\"\n\nconst commonBindings: {\"data-scope\": \"dialog\"} = {\n \"data-scope\": \"dialog\",\n}\n\nexport function createDialogApi(\n machine: Machine<DialogSchema>,\n normalize: PropNormalizer,\n): DialogApi {\n const {prop, scope, send, state} = machine\n\n const ariaLabel = prop(\"aria-label\")\n const open = state.matches(\"open\")\n\n return {\n open,\n setOpen(nextOpen) {\n const open = state.matches(\"open\")\n if (open === nextOpen) {\n return\n }\n send({type: nextOpen ? \"OPEN\" : \"CLOSE\"})\n },\n\n // group: bindings\n getBackdropBindings(props): DialogBackdropBindings {\n scope.ids.register(\"backdrop\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"backdrop\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n })\n },\n getBodyBindings(): DialogBodyBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"body\",\n })\n },\n getCloseTriggerBindings(props): DialogCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"data-part\": \"close-trigger\",\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"CLOSE\"})\n },\n type: \"button\",\n })\n },\n getContentBindings(props): DialogContentBindings {\n scope.ids.register(\"content\", props)\n const labelId = domIds.label(scope)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": domIds.description(scope) || undefined,\n \"aria-label\": ariaLabel || undefined,\n \"aria-labelledby\": ariaLabel || !labelId ? undefined : labelId,\n \"aria-modal\": prop(\"modal\"),\n \"data-part\": \"content\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n role: prop(\"role\"),\n tabIndex: -1,\n })\n },\n getDescriptionBindings(props): DialogDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getFooterBindings(): DialogFooterBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"footer\",\n dir: prop(\"dir\"),\n })\n },\n getHeadingBindings(props): DialogHeadingBindings {\n scope.ids.register(\"label\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getPositionerBindings(props): DialogPositionerBindings {\n scope.ids.register(\"positioner\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"positioner\",\n dir: prop(\"dir\"),\n id: props.id,\n style: {\n pointerEvents: open ? undefined : \"none\",\n },\n })\n },\n getTriggerBindings(props): DialogTriggerBindings {\n scope.ids.register(\"trigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-controls\": domIds.content(scope),\n \"aria-expanded\": booleanAriaAttr(open),\n \"aria-haspopup\": \"dialog\",\n \"data-part\": \"trigger\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"TOGGLE\"})\n },\n type: \"button\",\n })\n },\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomElements, ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogElementIds, DialogScope} from \"../dialog.types\"\n\nexport const domIds: ScopeDomIds<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.ids.get(\"backdrop\"),\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n content: (scope) => scope.ids.get(\"content\"),\n description: (scope) => scope.ids.get(\"description\"),\n label: (scope) => scope.ids.get(\"label\"),\n positioner: (scope) => scope.ids.get(\"positioner\"),\n trigger: (scope) => scope.ids.get(\"trigger\"),\n}\n\nexport const domEls: ScopeDomElements<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.getById(domIds.backdrop(scope)),\n closeTrigger: (scope) => scope.getById(domIds.closeTrigger(scope)),\n content: (scope) => scope.getById(domIds.content(scope)),\n description: (scope) => scope.getById(domIds.description(scope)),\n label: (scope) => scope.getById(domIds.label(scope)),\n positioner: (scope) => scope.getById(domIds.positioner(scope)),\n trigger: (scope) => scope.getById(domIds.trigger(scope)),\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaHidden} from \"@qualcomm-ui/dom/aria-hidden\"\nimport {trackDismissableElement} from \"@qualcomm-ui/dom/dismissable\"\nimport {trapFocus} from \"@qualcomm-ui/dom/focus-trap\"\nimport {raf} from \"@qualcomm-ui/dom/query\"\nimport {preventBodyScroll} from \"@qualcomm-ui/dom/remove-scroll\"\nimport {isDefined} from \"@qualcomm-ui/utils/guard\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogApiProps, DialogSchema} from \"./dialog.types\"\nimport {domEls} from \"./internal\"\n\nexport const dialogMachine: MachineConfig<DialogSchema> =\n createMachine<DialogSchema>({\n actions: {\n invokeOnClose: ({prop}) => {\n prop(\"onOpenChange\")?.(false)\n },\n invokeOnOpen: ({prop}) => {\n prop(\"onOpenChange\")?.(true)\n },\n syncZIndex: ({scope}) => {\n raf(() => {\n const contentEl = domEls.content(scope)\n if (!contentEl) {\n return\n }\n\n const styles = getComputedStyle(contentEl)\n const elems = [domEls.positioner(scope), domEls.backdrop(scope)]\n elems.forEach((node) => {\n node?.style.setProperty(\"--z-index\", styles.zIndex)\n })\n })\n },\n toggleVisibility: ({prop, send}) => {\n send({type: prop(\"open\") ? \"CONTROLLED.OPEN\" : \"CONTROLLED.CLOSE\"})\n },\n },\n\n effects: {\n hideContentBelow({prop, scope}) {\n if (!prop(\"modal\")) {\n return\n }\n const getElements = () => [domEls.content(scope)]\n return ariaHidden(getElements, {defer: true})\n },\n\n preventScroll({prop, scope}) {\n if (!prop(\"preventScroll\")) {\n return\n }\n return preventBodyScroll(scope.getDoc())\n },\n\n trackDismissableElement({prop, scope, send}) {\n const getContentEl = () => domEls.content(scope)\n return trackDismissableElement(getContentEl, {\n defer: true,\n exclude: () => [domEls.trigger(scope)],\n onDismiss() {\n send({src: \"interact-outside\", type: \"CLOSE\"})\n },\n onEscapeKeyDown(event) {\n prop(\"onEscapeKeyDown\")?.(event)\n if (!prop(\"closeOnEscape\")) {\n event.preventDefault()\n }\n },\n onFocusOutside: prop(\"onFocusOutside\"),\n onInteractOutside(event) {\n prop(\"onInteractOutside\")?.(event)\n if (!prop(\"closeOnInteractOutside\")) {\n event.preventDefault()\n }\n },\n onPointerDownOutside: prop(\"onPointerDownOutside\"),\n onRequestDismiss: prop(\"onRequestDismiss\"),\n persistentElements: prop(\"persistentElements\"),\n pointerBlocking: prop(\"modal\"),\n })\n },\n\n trapFocus: ({prop, scope}) => {\n if (!prop(\"trapFocus\") || !prop(\"modal\")) {\n return\n }\n const contentEl = () => domEls.content(scope)\n return trapFocus(contentEl, {\n initialFocus: prop(\"initialFocusEl\"),\n preventScroll: true,\n returnFocusOnDeactivate: prop(\"restoreFocus\"),\n setReturnFocus: (el) => prop(\"finalFocusEl\")?.() ?? el,\n })\n },\n },\n\n guards: {\n isOpenControlled: ({prop}) => isDefined(prop(\"open\")),\n },\n\n ids: ({bindableId}) => ({\n backdrop: bindableId<string>(),\n closeTrigger: bindableId<string>(),\n content: bindableId<string>(),\n description: bindableId<string>(),\n label: bindableId<string>(),\n positioner: bindableId<string>(),\n trigger: bindableId<string>(),\n }),\n\n initialState({prop}) {\n const open = prop(\"open\") || prop(\"defaultOpen\")\n return open ? \"open\" : \"closed\"\n },\n\n props: ({props, scope}) => {\n const alertDialog = props.role === \"alertdialog\"\n const initialFocusEl: DialogApiProps[\"initialFocusEl\"] = alertDialog\n ? () => domEls.closeTrigger(scope)\n : undefined\n return {\n closeOnEscape: true,\n closeOnInteractOutside: !alertDialog,\n dir: \"ltr\",\n initialFocusEl: initialFocusEl!,\n modal: true,\n preventScroll: true,\n restoreFocus: true,\n role: \"dialog\",\n trapFocus: true,\n ...props,\n }\n },\n\n states: {\n closed: {\n on: {\n \"CONTROLLED.OPEN\": {\n target: \"open\",\n },\n OPEN: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n TOGGLE: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n },\n },\n open: {\n effects: [\n \"trackDismissableElement\",\n \"trapFocus\",\n \"preventScroll\",\n \"hideContentBelow\",\n ],\n entry: [\"syncZIndex\"],\n on: {\n CLOSE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n \"CONTROLLED.CLOSE\": {\n target: \"closed\",\n },\n TOGGLE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"open\")], () => {\n actions.toggleVisibility()\n })\n },\n })\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {DialogApiProps} from \"./dialog.types\"\n\nexport const dialogProps: (keyof DialogApiProps)[] =\n createProps<DialogApiProps>()(\n \"aria-label\",\n \"closeOnEscape\",\n \"closeOnInteractOutside\",\n \"defaultOpen\",\n \"dir\",\n \"finalFocusEl\",\n \"getRootNode\",\n \"initialFocusEl\",\n \"modal\",\n \"onEscapeKeyDown\",\n \"onFocusOutside\",\n \"onInteractOutside\",\n \"onOpenChange\",\n \"onPointerDownOutside\",\n \"onRequestDismiss\",\n \"open\",\n \"persistentElements\",\n \"preventScroll\",\n \"restoreFocus\",\n \"role\",\n \"trapFocus\",\n )\n\nexport const splitDialogProps: <Props extends DialogApiProps>(\n props: Props,\n) => [DialogApiProps, Omit<Props, keyof DialogApiProps>] =\n createSplitProps<DialogApiProps>(dialogProps)\n"],
|
|
5
|
-
"mappings": "AAMA,OAAQ,mBAAAA,MAAsB,gCCIvB,IAAMC,EAAqD,CAChE,SAAWC,GAAUA,EAAM,IAAI,IAAI,UAAU,EAC7C,aAAeA,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,QAAUA,GAAUA,EAAM,IAAI,I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AU,QAAQ,CACvB,GAAGH,EACH,YAAa,aACb,IAAKI,EAAK,KAAK,EACf,GAAIO,EAAM,GACV,MAAO,CACL,cAAeF,EAAO,OAAY,MACpC,CACF,CAAC,CACH,EACA,mBAAmBE,EAA8B,CAC/C,OAAAN,EAAM,IAAI,SAAS,UAAWM,CAAK,EAC5BR,EAAU,OAAO,CACtB,GAAGH,EACH,gBAAiBc,EAAO,QAAQT,CAAK,EACrC,gBAAiBU,EAAgBN,CAAI,EACrC,gBAAiB,SACjB,YAAa,UACb,aAAcF,EAAM,IAAI,EACxB,IAAKH,EAAK,KAAK,EACf,GAAIO,EAAM,GACV,QAAQC,EAAO,CACTA,EAAM,kBAGVN,EAAK,CAAC,KAAM,QAAQ,CAAC,CACvB,EACA,KAAM,QACR,CAAC,CACH,CACF,CACF,CEvJA,OAAQ,cAAAU,MAAiB,+BACzB,OAAQ,2BAAAC,MAA8B,+BACtC,OAAQ,aAAAC,MAAgB,8BACxB,OAAQ,OAAAC,MAAU,yBAClB,OAAQ,qBAAAC,MAAwB,iCAChC,OAAQ,aAAAC,MAAgB,2BACxB,OAAQ,iBAAAC,MAAwC,6BAKzC,IAAMC,EACXC,EAA4B,CAC1B,QAAS,CACP,cAAe,CAAC,CAAC,KAAAC,CAAI,IAAM,CACzBA,EAAK,cAAc,IAAI,EAAK,CAC9B,EACA,aAAc,CAAC,CAAC,KAAAA,CAAI,IAAM,CACxBA,EAAK,cAAc,IAAI,EAAI,CAC7B,EACA,WAAY,CAAC,CAAC,MAAAC,CAAK,IAAM,CACvBC,EAAI,IAAM,CACR,IAAMC,EAAYC,EAAO,QAAQH,CAAK,EACtC,GAAI,CAACE,EACH,OAGF,IAAME,EAAS,
|
|
4
|
+
"sourcesContent": ["// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {booleanAriaAttr} from \"@qualcomm-ui/utils/attributes\"\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {\n DialogApi,\n DialogBackdropBindings,\n DialogBodyBindings,\n DialogCloseTriggerBindings,\n DialogContentBindings,\n DialogDescriptionBindings,\n DialogFooterBindings,\n DialogHeadingBindings,\n DialogPositionerBindings,\n DialogSchema,\n DialogTriggerBindings,\n} from \"./dialog.types\"\nimport {domIds} from \"./internal\"\n\nconst commonBindings: {\"data-scope\": \"dialog\"} = {\n \"data-scope\": \"dialog\",\n}\n\nexport function createDialogApi(\n machine: Machine<DialogSchema>,\n normalize: PropNormalizer,\n): DialogApi {\n const {prop, scope, send, state} = machine\n\n const ariaLabel = prop(\"aria-label\")\n const open = state.matches(\"open\")\n\n return {\n open,\n setOpen(nextOpen) {\n const open = state.matches(\"open\")\n if (open === nextOpen) {\n return\n }\n send({type: nextOpen ? \"OPEN\" : \"CLOSE\"})\n },\n\n // group: bindings\n getBackdropBindings(props): DialogBackdropBindings {\n scope.ids.register(\"backdrop\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"backdrop\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n })\n },\n getBodyBindings(): DialogBodyBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"body\",\n })\n },\n getCloseTriggerBindings(props): DialogCloseTriggerBindings {\n scope.ids.register(\"closeTrigger\", props)\n return normalize.button({\n ...commonBindings,\n \"data-part\": \"close-trigger\",\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"CLOSE\"})\n },\n type: \"button\",\n })\n },\n getContentBindings(props): DialogContentBindings {\n scope.ids.register(\"content\", props)\n const labelId = domIds.label(scope)\n return normalize.element({\n ...commonBindings,\n \"aria-describedby\": domIds.description(scope) || undefined,\n \"aria-label\": ariaLabel || undefined,\n \"aria-labelledby\": ariaLabel || !labelId ? undefined : labelId,\n \"aria-modal\": prop(\"modal\"),\n \"data-part\": \"content\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n hidden: !open,\n id: props.id,\n role: prop(\"role\"),\n tabIndex: -1,\n })\n },\n getDescriptionBindings(props): DialogDescriptionBindings {\n scope.ids.register(\"description\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"description\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getFooterBindings(): DialogFooterBindings {\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"footer\",\n dir: prop(\"dir\"),\n })\n },\n getHeadingBindings(props): DialogHeadingBindings {\n scope.ids.register(\"label\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"heading\",\n dir: prop(\"dir\"),\n id: props.id,\n })\n },\n getPositionerBindings(props): DialogPositionerBindings {\n scope.ids.register(\"positioner\", props)\n return normalize.element({\n ...commonBindings,\n \"data-part\": \"positioner\",\n dir: prop(\"dir\"),\n id: props.id,\n style: {\n pointerEvents: open ? undefined : \"none\",\n },\n })\n },\n getTriggerBindings(props): DialogTriggerBindings {\n scope.ids.register(\"trigger\", props)\n return normalize.button({\n ...commonBindings,\n \"aria-controls\": domIds.content(scope),\n \"aria-expanded\": booleanAriaAttr(open),\n \"aria-haspopup\": \"dialog\",\n \"data-part\": \"trigger\",\n \"data-state\": state.get(),\n dir: prop(\"dir\"),\n id: props.id,\n onClick(event) {\n if (event.defaultPrevented) {\n return\n }\n send({type: \"TOGGLE\"})\n },\n type: \"button\",\n })\n },\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ScopeDomElements, ScopeDomIds} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogElementIds, DialogScope} from \"../dialog.types\"\n\nexport const domIds: ScopeDomIds<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.ids.get(\"backdrop\"),\n closeTrigger: (scope) => scope.ids.get(\"closeTrigger\"),\n content: (scope) => scope.ids.get(\"content\"),\n description: (scope) => scope.ids.get(\"description\"),\n label: (scope) => scope.ids.get(\"label\"),\n positioner: (scope) => scope.ids.get(\"positioner\"),\n trigger: (scope) => scope.ids.get(\"trigger\"),\n}\n\nexport const domEls: ScopeDomElements<DialogElementIds, DialogScope> = {\n backdrop: (scope) => scope.getById(domIds.backdrop(scope)),\n closeTrigger: (scope) => scope.getById(domIds.closeTrigger(scope)),\n content: (scope) => scope.getById(domIds.content(scope)),\n description: (scope) => scope.getById(domIds.description(scope)),\n label: (scope) => scope.getById(domIds.label(scope)),\n positioner: (scope) => scope.getById(domIds.positioner(scope)),\n trigger: (scope) => scope.getById(domIds.trigger(scope)),\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {ariaHidden} from \"@qualcomm-ui/dom/aria-hidden\"\nimport {trackDismissableElement} from \"@qualcomm-ui/dom/dismissable\"\nimport {trapFocus} from \"@qualcomm-ui/dom/focus-trap\"\nimport {raf} from \"@qualcomm-ui/dom/query\"\nimport {preventBodyScroll} from \"@qualcomm-ui/dom/remove-scroll\"\nimport {isDefined} from \"@qualcomm-ui/utils/guard\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {DialogApiProps, DialogSchema} from \"./dialog.types\"\nimport {domEls} from \"./internal\"\n\nexport const dialogMachine: MachineConfig<DialogSchema> =\n createMachine<DialogSchema>({\n actions: {\n invokeOnClose: ({prop}) => {\n prop(\"onOpenChange\")?.(false)\n },\n invokeOnOpen: ({prop}) => {\n prop(\"onOpenChange\")?.(true)\n },\n syncZIndex: ({scope}) => {\n raf(() => {\n const contentEl = domEls.content(scope)\n if (!contentEl) {\n return\n }\n\n const styles = getComputedStyle?.(contentEl)\n const elems = [domEls.positioner(scope), domEls.backdrop(scope)]\n elems.forEach((node) => {\n node?.style.setProperty(\"--z-index\", styles.zIndex)\n })\n })\n },\n toggleVisibility: ({prop, send}) => {\n send({type: prop(\"open\") ? \"CONTROLLED.OPEN\" : \"CONTROLLED.CLOSE\"})\n },\n },\n\n effects: {\n hideContentBelow({prop, scope}) {\n if (!prop(\"modal\")) {\n return\n }\n const getElements = () => [domEls.content(scope)]\n return ariaHidden(getElements, {defer: true})\n },\n\n preventScroll({prop, scope}) {\n if (!prop(\"preventScroll\")) {\n return\n }\n return preventBodyScroll(scope.getDoc())\n },\n\n trackDismissableElement({prop, scope, send}) {\n const getContentEl = () => domEls.content(scope)\n return trackDismissableElement(getContentEl, {\n defer: true,\n exclude: () => [domEls.trigger(scope)],\n onDismiss() {\n send({src: \"interact-outside\", type: \"CLOSE\"})\n },\n onEscapeKeyDown(event) {\n prop(\"onEscapeKeyDown\")?.(event)\n if (!prop(\"closeOnEscape\")) {\n event.preventDefault()\n }\n },\n onFocusOutside: prop(\"onFocusOutside\"),\n onInteractOutside(event) {\n prop(\"onInteractOutside\")?.(event)\n if (!prop(\"closeOnInteractOutside\")) {\n event.preventDefault()\n }\n },\n onPointerDownOutside: prop(\"onPointerDownOutside\"),\n onRequestDismiss: prop(\"onRequestDismiss\"),\n persistentElements: prop(\"persistentElements\"),\n pointerBlocking: prop(\"modal\"),\n })\n },\n\n trapFocus: ({prop, scope}) => {\n if (!prop(\"trapFocus\") || !prop(\"modal\")) {\n return\n }\n const contentEl = () => domEls.content(scope)\n return trapFocus(contentEl, {\n initialFocus: prop(\"initialFocusEl\"),\n preventScroll: true,\n returnFocusOnDeactivate: prop(\"restoreFocus\"),\n setReturnFocus: (el) => prop(\"finalFocusEl\")?.() ?? el,\n })\n },\n },\n\n guards: {\n isOpenControlled: ({prop}) => isDefined(prop(\"open\")),\n },\n\n ids: ({bindableId}) => ({\n backdrop: bindableId<string>(),\n closeTrigger: bindableId<string>(),\n content: bindableId<string>(),\n description: bindableId<string>(),\n label: bindableId<string>(),\n positioner: bindableId<string>(),\n trigger: bindableId<string>(),\n }),\n\n initialState({prop}) {\n const open = prop(\"open\") || prop(\"defaultOpen\")\n return open ? \"open\" : \"closed\"\n },\n\n props: ({props, scope}) => {\n const alertDialog = props.role === \"alertdialog\"\n const initialFocusEl: DialogApiProps[\"initialFocusEl\"] = alertDialog\n ? () => domEls.closeTrigger(scope)\n : undefined\n return {\n closeOnEscape: true,\n closeOnInteractOutside: !alertDialog,\n dir: \"ltr\",\n initialFocusEl: initialFocusEl!,\n modal: true,\n preventScroll: true,\n restoreFocus: true,\n role: \"dialog\",\n trapFocus: true,\n ...props,\n }\n },\n\n states: {\n closed: {\n on: {\n \"CONTROLLED.OPEN\": {\n target: \"open\",\n },\n OPEN: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n TOGGLE: [\n {\n actions: [\"invokeOnOpen\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnOpen\"],\n target: \"open\",\n },\n ],\n },\n },\n open: {\n effects: [\n \"trackDismissableElement\",\n \"trapFocus\",\n \"preventScroll\",\n \"hideContentBelow\",\n ],\n entry: [\"syncZIndex\"],\n on: {\n CLOSE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n \"CONTROLLED.CLOSE\": {\n target: \"closed\",\n },\n TOGGLE: [\n {\n actions: [\"invokeOnClose\"],\n guard: \"isOpenControlled\",\n },\n {\n actions: [\"invokeOnClose\"],\n target: \"closed\",\n },\n ],\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"open\")], () => {\n actions.toggleVisibility()\n })\n },\n })\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {DialogApiProps} from \"./dialog.types\"\n\nexport const dialogProps: (keyof DialogApiProps)[] =\n createProps<DialogApiProps>()(\n \"aria-label\",\n \"closeOnEscape\",\n \"closeOnInteractOutside\",\n \"defaultOpen\",\n \"dir\",\n \"finalFocusEl\",\n \"getRootNode\",\n \"initialFocusEl\",\n \"modal\",\n \"onEscapeKeyDown\",\n \"onFocusOutside\",\n \"onInteractOutside\",\n \"onOpenChange\",\n \"onPointerDownOutside\",\n \"onRequestDismiss\",\n \"open\",\n \"persistentElements\",\n \"preventScroll\",\n \"restoreFocus\",\n \"role\",\n \"trapFocus\",\n )\n\nexport const splitDialogProps: <Props extends DialogApiProps>(\n props: Props,\n) => [DialogApiProps, Omit<Props, keyof DialogApiProps>] =\n createSplitProps<DialogApiProps>(dialogProps)\n"],
|
|
5
|
+
"mappings": "AAMA,OAAQ,mBAAAA,MAAsB,gCCIvB,IAAMC,EAAqD,CAChE,SAAWC,GAAUA,EAAM,IAAI,IAAI,UAAU,EAC7C,aAAeA,GAAUA,EAAM,IAAI,IAAI,cAAc,EACrD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,EAC3C,YAAcA,GAAUA,EAAM,IAAI,IAAI,aAAa,EACnD,MAAQA,GAAUA,EAAM,IAAI,IAAI,OAAO,EACvC,WAAaA,GAAUA,EAAM,IAAI,IAAI,YAAY,EACjD,QAAUA,GAAUA,EAAM,IAAI,IAAI,SAAS,CAC7C,EAEaC,EAA0D,CACrE,SAAWD,GAAUA,EAAM,QAAQD,EAAO,SAASC,CAAK,CAAC,EACzD,aAAeA,GAAUA,EAAM,QAAQD,EAAO,aAAaC,CAAK,CAAC,EACjE,QAAUA,GAAUA,EAAM,QAAQD,EAAO,QAAQC,CAAK,CAAC,EACvD,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AuB,4BAIrC,IAAMC,EACXF,EAA4B,EAC1B,aACA,gBACA,yBACA,cACA,MACA,eACA,cACA,iBACA,QACA,kBACA,iBACA,oBACA,eACA,uBACA,mBACA,OACA,qBACA,gBACA,eACA,OACA,WACF,EAEWG,EAGXF,EAAiCC,CAAW",
|
|
6
6
|
"names": ["booleanAriaAttr", "domIds", "scope", "domEls", "commonBindings", "createDialogApi", "machine", "normalize", "prop", "scope", "send", "state", "ariaLabel", "open", "nextOpen", "props", "event", "labelId", "domIds", "booleanAriaAttr", "ariaHidden", "trackDismissableElement", "trapFocus", "raf", "preventBodyScroll", "isDefined", "createMachine", "dialogMachine", "createMachine", "prop", "scope", "raf", "contentEl", "domEls", "styles", "node", "send", "ariaHidden", "preventBodyScroll", "trackDismissableElement", "event", "trapFocus", "el", "isDefined", "bindableId", "props", "alertDialog", "actions", "track", "createProps", "createSplitProps", "dialogProps", "splitDialogProps"]
|
|
7
7
|
}
|
package/dist/presence/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var o in t)u(e,o,{get:t[o],enumerable:!0})},S=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of g(t))!f.call(e,r)&&r!==o&&u(e,r,{get:()=>t[r],enumerable:!(n=N(t,r))||n.enumerable});return e};var E=e=>S(u({},"__esModule",{value:!0}),e);var U={};A(U,{createPresenceApi:()=>v,presenceMachine:()=>M,presenceProps:()=>y,renderStrategyProps:()=>P,splitPresenceProps:()=>O,splitRenderStrategyProps:()=>x});module.exports=E(U);function v(e,t){let{context:o,prop:n,send:r,state:s}=e,a=s.matches("mounted","unmountSuspended");return{lazyMount:n("lazyMount"),present:a,setNode(p){p&&r({node:p,type:"NODE.SET"})},skip:!o.get("initial"),skipAnimationOnMount:n("skipAnimationOnMount"),unmount(){r({type:"UNMOUNT"})},unmountOnExit:n("unmountOnExit")}}var i=require("@qualcomm-ui/dom/query"),d=require("@qualcomm-ui/utils/machine"),M=(0,d.createMachine)({actions:{cleanupNode:({refs:e})=>{e.set("node",null),e.set("styles",null)},clearInitial:({context:e})=>{e.set("initial",!1)},clearPrevAnimationName:({context:e})=>{e.set("prevAnimationName",null)},invokeOnExitComplete:({prop:e})=>{e("onExitComplete")?.()},setInitial:({context:e})=>{e.get("initial")||queueMicrotask(()=>{e.set("initial",!0)})},setNode:({event:e,refs:t})=>{"node"in e&&t.set("node",e.node)},setPrevAnimationName:({context:e,refs:t})=>{(0,i.raf)(()=>{e.set("prevAnimationName",c(t.get("styles")))})},setStyles:({event:e,refs:t})=>{"node"in e&&e.node&&typeof getComputedStyle<"u"&&t.set("styles",getComputedStyle(e.node))},syncPresence:({context:e,prop:t,refs:o,send:n})=>{let r=t("present");if(r)return n({src:"presence.changed",type:"MOUNT"});let s=o.get("node");if(!r&&s?.ownerDocument.visibilityState==="hidden")return n({src:"visibilitychange",type:"UNMOUNT"});(0,i.raf)(()=>{let a=c(o.get("styles"));e.set("unmountAnimationName",a),a==="none"||a===e.get("prevAnimationName")||o.get("styles")?.display==="none"||o.get("styles")?.animationDuration==="0s"?n({src:"presence.changed",type:"UNMOUNT"}):n({type:"UNMOUNT.SUSPEND"})})}},context({bindable:e}){return{initial:e(()=>({defaultValue:!1,sync:!0})),present:e(()=>({defaultValue:!1})),prevAnimationName:e(()=>({defaultValue:null})),unmountAnimationName:e(()=>({defaultValue:null}))}},effects:{trackAnimationEvents:({context:e,refs:t,send:o})=>{let n=t.get("node");if(!n)return;let r=p=>{(p.composedPath?.()?.[0]??p.target)===n&&e.set("prevAnimationName",c(t.get("styles")))},s=p=>{let l=c(t.get("styles"));(0,i.getEventTarget)(p)===n&&l===e.get("unmountAnimationName")&&o({src:"animationend",type:"UNMOUNT"})};n.addEventListener("animationstart",r),n.addEventListener("animationcancel",s),n.addEventListener("animationend",s);let a=(0,i.setStyle)(n,{animationFillMode:"forwards"});return()=>{n.removeEventListener("animationstart",r),n.removeEventListener("animationcancel",s),n.removeEventListener("animationend",s),(0,i.nextTick)(()=>a())}}},initialState({prop:e}){return e("present")?"mounted":"unmounted"},on:{"NODE.SET":{actions:["setNode","setStyles"]}},onDestroy:{actions:["clearInitial","cleanupNode"]},props({props:e}){return{...e,present:!!e.present}},refs(){return{node:null,styles:null}},states:{mounted:{on:{UNMOUNT:{actions:["clearPrevAnimationName","invokeOnExitComplete"],target:"unmounted"},"UNMOUNT.SUSPEND":{target:"unmountSuspended"}}},unmounted:{on:{MOUNT:{actions:["setPrevAnimationName"],target:"mounted"}}},unmountSuspended:{effects:["trackAnimationEvents"],on:{MOUNT:{actions:["setPrevAnimationName"],target:"mounted"},UNMOUNT:{actions:["clearPrevAnimationName","invokeOnExitComplete"],target:"unmounted"}}}},watch({actions:e,prop:t,track:o}){o([()=>t("present")],()=>{e.setInitial(),e.syncPresence()})}});function c(e){return e?.animationName||"none"}var m=require("@qualcomm-ui/utils/object"),y=(0,m.createProps)()("immediate","lazyMount","onExitComplete","present","skipAnimationOnMount","unmountOnExit"),O=(0,m.createSplitProps)(y),P=(0,m.createProps)()("unmountOnExit","lazyMount"),x=(0,m.createSplitProps)(P);
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/presence/index.ts", "../../src/presence/presence.api.ts", "../../src/presence/presence.machine.ts", "../../src/presence/presence.props.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"./presence.api\"\nexport * from \"./presence.machine\"\nexport * from \"./presence.props\"\nexport * from \"./presence.types\"\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {PresenceApi, PresenceSchema} from \"./presence.types\"\n\nexport function createPresenceApi(\n machine: Machine<PresenceSchema>,\n _normalize?: PropNormalizer,\n): PresenceApi {\n const {context, prop, send, state} = machine\n const present = state.matches(\"mounted\", \"unmountSuspended\")\n return {\n lazyMount: prop(\"lazyMount\"),\n present,\n setNode(node) {\n if (!node) {\n return\n }\n send({node, type: \"NODE.SET\"})\n },\n skip: !context.get(\"initial\"),\n skipAnimationOnMount: prop(\"skipAnimationOnMount\"),\n unmount() {\n send({type: \"UNMOUNT\"})\n },\n unmountOnExit: prop(\"unmountOnExit\"),\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {getEventTarget, nextTick, raf, setStyle} from \"@qualcomm-ui/dom/query\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {PresenceSchema} from \"./presence.types\"\n\nexport const presenceMachine: MachineConfig<PresenceSchema> =\n createMachine<PresenceSchema>({\n actions: {\n cleanupNode: ({refs}) => {\n refs.set(\"node\", null)\n refs.set(\"styles\", null)\n },\n clearInitial: ({context}) => {\n context.set(\"initial\", false)\n },\n clearPrevAnimationName: ({context}) => {\n context.set(\"prevAnimationName\", null)\n },\n invokeOnExitComplete: ({prop}) => {\n prop(\"onExitComplete\")?.()\n },\n\n setInitial: ({context}) => {\n if (context.get(\"initial\")) {\n return\n }\n queueMicrotask(() => {\n context.set(\"initial\", true)\n })\n },\n\n setNode: ({event, refs}) => {\n if (\"node\" in event) {\n refs.set(\"node\", event.node)\n }\n },\n\n setPrevAnimationName: ({context, refs}) => {\n raf(() => {\n context.set(\"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CAC7B,CAAC,CACH,EAEA,QAAS,CAAC,CAAC,MAAAE,EAAO,KAAAH,CAAI,IAAM,CACtB,SAAUG,GACZH,EAAK,IAAI,OAAQG,EAAM,IAAI,CAE/B,EAEA,qBAAsB,CAAC,CAAC,QAAAF,EAAS,KAAAD,CAAI,IAAM,IACzC,OAAI,IAAM,CACRC,EAAQ,IAAI,oBAAqBG,EAAiBJ,EAAK,IAAI,QAAQ,CAAC,CAAC,CACvE,CAAC,CACH,EAEA,UAAW,CAAC,CAAC,MAAAG,EAAO,KAAAH,CAAI,IAAM,
|
|
4
|
+
"sourcesContent": ["export * from \"./presence.api\"\nexport * from \"./presence.machine\"\nexport * from \"./presence.props\"\nexport * from \"./presence.types\"\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {PresenceApi, PresenceSchema} from \"./presence.types\"\n\nexport function createPresenceApi(\n machine: Machine<PresenceSchema>,\n _normalize?: PropNormalizer,\n): PresenceApi {\n const {context, prop, send, state} = machine\n const present = state.matches(\"mounted\", \"unmountSuspended\")\n return {\n lazyMount: prop(\"lazyMount\"),\n present,\n setNode(node) {\n if (!node) {\n return\n }\n send({node, type: \"NODE.SET\"})\n },\n skip: !context.get(\"initial\"),\n skipAnimationOnMount: prop(\"skipAnimationOnMount\"),\n unmount() {\n send({type: \"UNMOUNT\"})\n },\n unmountOnExit: prop(\"unmountOnExit\"),\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {getEventTarget, nextTick, raf, setStyle} from \"@qualcomm-ui/dom/query\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {PresenceSchema} from \"./presence.types\"\n\nexport const presenceMachine: MachineConfig<PresenceSchema> =\n createMachine<PresenceSchema>({\n actions: {\n cleanupNode: ({refs}) => {\n refs.set(\"node\", null)\n refs.set(\"styles\", null)\n },\n clearInitial: ({context}) => {\n context.set(\"initial\", false)\n },\n clearPrevAnimationName: ({context}) => {\n context.set(\"prevAnimationName\", null)\n },\n invokeOnExitComplete: ({prop}) => {\n prop(\"onExitComplete\")?.()\n },\n\n setInitial: ({context}) => {\n if (context.get(\"initial\")) {\n return\n }\n queueMicrotask(() => {\n context.set(\"initial\", true)\n })\n },\n\n setNode: ({event, refs}) => {\n if (\"node\" in event) {\n refs.set(\"node\", event.node)\n }\n },\n\n setPrevAnimationName: ({context, refs}) => {\n raf(() => {\n context.set(\"prevAnimationName\", getAnimationName(refs.get(\"styles\")))\n })\n },\n\n setStyles: ({event, refs}) => {\n if (\n \"node\" in event &&\n event.node &&\n typeof getComputedStyle !== \"undefined\"\n ) {\n refs.set(\"styles\", getComputedStyle(event.node))\n }\n },\n\n syncPresence: ({context, prop, refs, send}) => {\n const presentProp = prop(\"present\")\n if (presentProp) {\n return send({src: \"presence.changed\", type: \"MOUNT\"})\n }\n\n const node = refs.get(\"node\")\n if (!presentProp && node?.ownerDocument.visibilityState === \"hidden\") {\n return send({src: \"visibilitychange\", type: \"UNMOUNT\"})\n }\n\n raf(() => {\n const animationName = getAnimationName(refs.get(\"styles\"))\n context.set(\"unmountAnimationName\", animationName)\n if (\n animationName === \"none\" ||\n animationName === context.get(\"prevAnimationName\") ||\n refs.get(\"styles\")?.display === \"none\" ||\n refs.get(\"styles\")?.animationDuration === \"0s\"\n ) {\n send({src: \"presence.changed\", type: \"UNMOUNT\"})\n } else {\n send({type: \"UNMOUNT.SUSPEND\"})\n }\n })\n },\n },\n\n context({bindable}) {\n return {\n initial: bindable<boolean>(() => ({\n defaultValue: false,\n sync: true,\n })),\n present: bindable<boolean>(() => ({defaultValue: false})),\n prevAnimationName: bindable<string | null>(() => ({\n defaultValue: null,\n })),\n unmountAnimationName: bindable<string | null>(() => ({\n defaultValue: null,\n })),\n }\n },\n\n effects: {\n trackAnimationEvents: ({context, refs, send}) => {\n const node = refs.get(\"node\")\n if (!node) {\n return\n }\n\n const onStart = (event: AnimationEvent) => {\n const target = event.composedPath?.()?.[0] ?? event.target\n if (target === node) {\n context.set(\n \"prevAnimationName\",\n getAnimationName(refs.get(\"styles\")),\n )\n }\n }\n\n const onEnd = (event: AnimationEvent) => {\n const animationName = getAnimationName(refs.get(\"styles\"))\n const target = getEventTarget(event)\n if (\n target === node &&\n animationName === context.get(\"unmountAnimationName\")\n ) {\n send({src: \"animationend\", type: \"UNMOUNT\"})\n }\n }\n\n node.addEventListener(\"animationstart\", onStart)\n node.addEventListener(\"animationcancel\", onEnd)\n node.addEventListener(\"animationend\", onEnd)\n const cleanupStyles = setStyle(node, {animationFillMode: \"forwards\"})\n\n return () => {\n node.removeEventListener(\"animationstart\", onStart)\n node.removeEventListener(\"animationcancel\", onEnd)\n node.removeEventListener(\"animationend\", onEnd)\n nextTick(() => cleanupStyles())\n }\n },\n },\n\n initialState({prop}) {\n return prop(\"present\") ? \"mounted\" : \"unmounted\"\n },\n\n on: {\n \"NODE.SET\": {\n actions: [\"setNode\", \"setStyles\"],\n },\n },\n\n onDestroy: {\n actions: [\"clearInitial\", \"cleanupNode\"],\n },\n\n props({props}) {\n return {...props, present: !!props.present}\n },\n\n refs() {\n return {\n node: null,\n styles: null,\n }\n },\n\n states: {\n mounted: {\n on: {\n UNMOUNT: {\n actions: [\"clearPrevAnimationName\", \"invokeOnExitComplete\"],\n target: \"unmounted\",\n },\n \"UNMOUNT.SUSPEND\": {\n target: \"unmountSuspended\",\n },\n },\n },\n unmounted: {\n on: {\n MOUNT: {\n actions: [\"setPrevAnimationName\"],\n target: \"mounted\",\n },\n },\n },\n unmountSuspended: {\n effects: [\"trackAnimationEvents\"],\n on: {\n MOUNT: {\n actions: [\"setPrevAnimationName\"],\n target: \"mounted\",\n },\n UNMOUNT: {\n actions: [\"clearPrevAnimationName\", \"invokeOnExitComplete\"],\n target: \"unmounted\",\n },\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"present\")], () => {\n actions.setInitial()\n actions.syncPresence()\n })\n },\n })\n\nfunction getAnimationName(styles?: CSSStyleDeclaration | null) {\n return styles?.animationName || \"none\"\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {PresenceApiProps, RenderStrategyApiProps} from \"./presence.types\"\n\nexport const presenceProps: (keyof PresenceApiProps)[] =\n createProps<PresenceApiProps>()(\n \"immediate\",\n \"lazyMount\",\n \"onExitComplete\",\n \"present\",\n \"skipAnimationOnMount\",\n \"unmountOnExit\",\n )\n\nexport const splitPresenceProps: <Props extends PresenceApiProps>(\n props: Props,\n) => [PresenceApiProps, Omit<Props, keyof PresenceApiProps>] =\n createSplitProps<PresenceApiProps>(presenceProps)\n\nexport const renderStrategyProps: (keyof RenderStrategyApiProps)[] =\n createProps<RenderStrategyApiProps>()(\"unmountOnExit\", \"lazyMount\")\n\nexport const splitRenderStrategyProps: <Props extends RenderStrategyApiProps>(\n props: Props,\n) => [RenderStrategyApiProps, Omit<Props, keyof RenderStrategyApiProps>] =\n createSplitProps<RenderStrategyApiProps>(renderStrategyProps)\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,wBAAAC,EAAA,uBAAAC,EAAA,6BAAAC,IAAA,eAAAC,EAAAR,GCUO,SAASS,EACdC,EACAC,EACa,CACb,GAAM,CAAC,QA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Q,kBACV,CACF,CACF,EACA,UAAW,CACT,GAAI,CACF,MAAO,CACL,QAAS,CAAC,sBAAsB,EAChC,OAAQ,SACV,CACF,CACF,EACA,iBAAkB,CAChB,QAAS,CAAC,sBAAsB,EAChC,GAAI,CACF,MAAO,CACL,QAAS,CAAC,sBAAsB,EAChC,OAAQ,SACV,EACA,QAAS,CACP,QAAS,CAAC,yBAA0B,sBAAsB,EAC1D,OAAQ,WACV,CACF,CACF,CACF,EAEA,MAAM,CAAC,QAAAC,EAAS,KAAAZ,EAAM,MAAAa,CAAK,EAAG,CAC5BA,EAAM,CAAC,IAAMb,EAAK,SAAS,CAAC,EAAG,IAAM,CACnCY,EAAQ,WAAW,EACnBA,EAAQ,aAAa,CACvB,CAAC,CACH,CACF,CAAC,EAEH,SAASV,EAAiBY,EAAqC,CAC7D,OAAOA,GAAQ,eAAiB,MAClC,CCjNA,IAAAC,EAA4C,qCAI/BC,KACX,eAA8B,EAC5B,YACA,YACA,iBACA,UACA,uBACA,eACF,EAEWC,KAGX,oBAAmCD,CAAa,EAErCE,KACX,eAAoC,EAAE,gBAAiB,WAAW,EAEvDC,KAGX,oBAAyCD,CAAmB",
|
|
6
6
|
"names": ["presence_exports", "__export", "createPresenceApi", "presenceMachine", "presenceProps", "renderStrategyProps", "splitPresenceProps", "splitRenderStrategyProps", "__toCommonJS", "createPresenceApi", "machine", "_normalize", "context", "prop", "send", "state", "present", "node", "import_query", "import_machine", "presenceMachine", "refs", "context", "prop", "event", "getAnimationName", "send", "presentProp", "node", "animationName", "bindable", "onStart", "onEnd", "cleanupStyles", "props", "actions", "track", "styles", "import_object", "presenceProps", "splitPresenceProps", "renderStrategyProps", "splitRenderStrategyProps"]
|
|
7
7
|
}
|
package/dist/presence/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function S(e,n){let{context:o,prop:t,send:r,state:i}=e,s=i.matches("mounted","unmountSuspended");return{lazyMount:t("lazyMount"),present:s,setNode(a){a&&r({node:a,type:"NODE.SET"})},skip:!o.get("initial"),skipAnimationOnMount:t("skipAnimationOnMount"),unmount(){r({type:"UNMOUNT"})},unmountOnExit:t("unmountOnExit")}}import{getEventTarget as d,nextTick as
|
|
1
|
+
function S(e,n){let{context:o,prop:t,send:r,state:i}=e,s=i.matches("mounted","unmountSuspended");return{lazyMount:t("lazyMount"),present:s,setNode(a){a&&r({node:a,type:"NODE.SET"})},skip:!o.get("initial"),skipAnimationOnMount:t("skipAnimationOnMount"),unmount(){r({type:"UNMOUNT"})},unmountOnExit:t("unmountOnExit")}}import{getEventTarget as d,nextTick as y,raf as c,setStyle as P}from"@qualcomm-ui/dom/query";import{createMachine as N}from"@qualcomm-ui/utils/machine";var O=N({actions:{cleanupNode:({refs:e})=>{e.set("node",null),e.set("styles",null)},clearInitial:({context:e})=>{e.set("initial",!1)},clearPrevAnimationName:({context:e})=>{e.set("prevAnimationName",null)},invokeOnExitComplete:({prop:e})=>{e("onExitComplete")?.()},setInitial:({context:e})=>{e.get("initial")||queueMicrotask(()=>{e.set("initial",!0)})},setNode:({event:e,refs:n})=>{"node"in e&&n.set("node",e.node)},setPrevAnimationName:({context:e,refs:n})=>{c(()=>{e.set("prevAnimationName",p(n.get("styles")))})},setStyles:({event:e,refs:n})=>{"node"in e&&e.node&&typeof getComputedStyle<"u"&&n.set("styles",getComputedStyle(e.node))},syncPresence:({context:e,prop:n,refs:o,send:t})=>{let r=n("present");if(r)return t({src:"presence.changed",type:"MOUNT"});let i=o.get("node");if(!r&&i?.ownerDocument.visibilityState==="hidden")return t({src:"visibilitychange",type:"UNMOUNT"});c(()=>{let s=p(o.get("styles"));e.set("unmountAnimationName",s),s==="none"||s===e.get("prevAnimationName")||o.get("styles")?.display==="none"||o.get("styles")?.animationDuration==="0s"?t({src:"presence.changed",type:"UNMOUNT"}):t({type:"UNMOUNT.SUSPEND"})})}},context({bindable:e}){return{initial:e(()=>({defaultValue:!1,sync:!0})),present:e(()=>({defaultValue:!1})),prevAnimationName:e(()=>({defaultValue:null})),unmountAnimationName:e(()=>({defaultValue:null}))}},effects:{trackAnimationEvents:({context:e,refs:n,send:o})=>{let t=n.get("node");if(!t)return;let r=a=>{(a.composedPath?.()?.[0]??a.target)===t&&e.set("prevAnimationName",p(n.get("styles")))},i=a=>{let m=p(n.get("styles"));d(a)===t&&m===e.get("unmountAnimationName")&&o({src:"animationend",type:"UNMOUNT"})};t.addEventListener("animationstart",r),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i);let s=P(t,{animationFillMode:"forwards"});return()=>{t.removeEventListener("animationstart",r),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i),y(()=>s())}}},initialState({prop:e}){return e("present")?"mounted":"unmounted"},on:{"NODE.SET":{actions:["setNode","setStyles"]}},onDestroy:{actions:["clearInitial","cleanupNode"]},props({props:e}){return{...e,present:!!e.present}},refs(){return{node:null,styles:null}},states:{mounted:{on:{UNMOUNT:{actions:["clearPrevAnimationName","invokeOnExitComplete"],target:"unmounted"},"UNMOUNT.SUSPEND":{target:"unmountSuspended"}}},unmounted:{on:{MOUNT:{actions:["setPrevAnimationName"],target:"mounted"}}},unmountSuspended:{effects:["trackAnimationEvents"],on:{MOUNT:{actions:["setPrevAnimationName"],target:"mounted"},UNMOUNT:{actions:["clearPrevAnimationName","invokeOnExitComplete"],target:"unmounted"}}}},watch({actions:e,prop:n,track:o}){o([()=>n("present")],()=>{e.setInitial(),e.syncPresence()})}});function p(e){return e?.animationName||"none"}import{createProps as u,createSplitProps as l}from"@qualcomm-ui/utils/object";var g=u()("immediate","lazyMount","onExitComplete","present","skipAnimationOnMount","unmountOnExit"),h=l(g),f=u()("unmountOnExit","lazyMount"),k=l(f);export{S as createPresenceApi,O as presenceMachine,g as presenceProps,f as renderStrategyProps,h as splitPresenceProps,k as splitRenderStrategyProps};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/presence/presence.api.ts", "../../src/presence/presence.machine.ts", "../../src/presence/presence.props.ts"],
|
|
4
|
-
"sourcesContent": ["// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {PresenceApi, PresenceSchema} from \"./presence.types\"\n\nexport function createPresenceApi(\n machine: Machine<PresenceSchema>,\n _normalize?: PropNormalizer,\n): PresenceApi {\n const {context, prop, send, state} = machine\n const present = state.matches(\"mounted\", \"unmountSuspended\")\n return {\n lazyMount: prop(\"lazyMount\"),\n present,\n setNode(node) {\n if (!node) {\n return\n }\n send({node, type: \"NODE.SET\"})\n },\n skip: !context.get(\"initial\"),\n skipAnimationOnMount: prop(\"skipAnimationOnMount\"),\n unmount() {\n send({type: \"UNMOUNT\"})\n },\n unmountOnExit: prop(\"unmountOnExit\"),\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {getEventTarget, nextTick, raf, setStyle} from \"@qualcomm-ui/dom/query\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {PresenceSchema} from \"./presence.types\"\n\nexport const presenceMachine: MachineConfig<PresenceSchema> =\n createMachine<PresenceSchema>({\n actions: {\n cleanupNode: ({refs}) => {\n refs.set(\"node\", null)\n refs.set(\"styles\", null)\n },\n clearInitial: ({context}) => {\n context.set(\"initial\", false)\n },\n clearPrevAnimationName: ({context}) => {\n context.set(\"prevAnimationName\", null)\n },\n invokeOnExitComplete: ({prop}) => {\n prop(\"onExitComplete\")?.()\n },\n\n setInitial: ({context}) => {\n if (context.get(\"initial\")) {\n return\n }\n queueMicrotask(() => {\n context.set(\"initial\", true)\n })\n },\n\n setNode: ({event, refs}) => {\n if (\"node\" in event) {\n refs.set(\"node\", event.node)\n }\n },\n\n setPrevAnimationName: ({context, refs}) => {\n raf(() => {\n context.set(\"prevAnimationName\", getAnimationName(refs.get(\"styles\")))\n })\n },\n\n setStyles: ({event, refs}) => {\n if (\"node\" in event
|
|
5
|
-
"mappings": "AAUO,SAASA,EACdC,EACAC,EACa,CACb,GAAM,CAAC,QAAAC,EAAS,KAAAC,EAAM,KAAAC,EAAM,MAAAC,CAAK,EAAIL,EAC/BM,EAAUD,EAAM,QAAQ,UAAW,kBAAkB,EAC3D,MAAO,CACL,UAAWF,EAAK,WAAW,EAC3B,QAAAG,EACA,QAAQC,EAAM,CACPA,GAGLH,EAAK,CAAC,KAAAG,EAAM,KAAM,UAAU,CAAC,CAC/B,EACA,KAAM,CAACL,EAAQ,IAAI,SAAS,EAC5B,qBAAsBC,EAAK,sBAAsB,EACjD,SAAU,CACRC,EAAK,CAAC,KAAM,SAAS,CAAC,CACxB,EACA,cAAeD,EAAK,eAAe,CACrC,CACF,CC1BA,OAAQ,kBAAAK,EAAgB,YAAAC,EAAU,OAAAC,EAAK,YAAAC,MAAe,yBACtD,OAAQ,iBAAAC,MAAwC,6BAIzC,IAAMC,EACXD,EAA8B,CAC5B,QAAS,CACP,YAAa,CAAC,CAAC,KAAAE,CAAI,IAAM,CACvBA,EAAK,IAAI,OAAQ,IAAI,EACrBA,EAAK,IAAI,SAAU,IAAI,CACzB,EACA,aAAc,CAAC,CAAC,QAAAC,CAAO,IAAM,CAC3BA,EAAQ,IAAI,UAAW,EAAK,CAC9B,EACA,uBAAwB,CAAC,CAAC,QAAAA,CAAO,IAAM,CACrCA,EAAQ,IAAI,oBAAqB,IAAI,CACvC,EACA,qBAAsB,CAAC,CAAC,KAAAC,CAAI,IAAM,CAChCA,EAAK,gBAAgB,IAAI,CAC3B,EAEA,WAAY,CAAC,CAAC,QAAAD,CAAO,IAAM,CACrBA,EAAQ,IAAI,SAAS,GAGzB,eAAe,IAAM,CACnBA,EAAQ,IAAI,UAAW,EAAI,CAC7B,CAAC,CACH,EAEA,QAAS,CAAC,CAAC,MAAAE,EAAO,KAAAH,CAAI,IAAM,CACtB,SAAUG,GACZH,EAAK,IAAI,OAAQG,EAAM,IAAI,CAE/B,EAEA,qBAAsB,CAAC,CAAC,QAAAF,EAAS,KAAAD,CAAI,IAAM,CACzCJ,EAAI,IAAM,CACRK,EAAQ,IAAI,oBAAqBG,EAAiBJ,EAAK,IAAI,QAAQ,CAAC,CAAC,CACvE,CAAC,CACH,EAEA,UAAW,CAAC,CAAC,MAAAG,EAAO,KAAAH,CAAI,IAAM,
|
|
4
|
+
"sourcesContent": ["// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Machine, PropNormalizer} from \"@qualcomm-ui/utils/machine\"\n\nimport type {PresenceApi, PresenceSchema} from \"./presence.types\"\n\nexport function createPresenceApi(\n machine: Machine<PresenceSchema>,\n _normalize?: PropNormalizer,\n): PresenceApi {\n const {context, prop, send, state} = machine\n const present = state.matches(\"mounted\", \"unmountSuspended\")\n return {\n lazyMount: prop(\"lazyMount\"),\n present,\n setNode(node) {\n if (!node) {\n return\n }\n send({node, type: \"NODE.SET\"})\n },\n skip: !context.get(\"initial\"),\n skipAnimationOnMount: prop(\"skipAnimationOnMount\"),\n unmount() {\n send({type: \"UNMOUNT\"})\n },\n unmountOnExit: prop(\"unmountOnExit\"),\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {getEventTarget, nextTick, raf, setStyle} from \"@qualcomm-ui/dom/query\"\nimport {createMachine, type MachineConfig} from \"@qualcomm-ui/utils/machine\"\n\nimport type {PresenceSchema} from \"./presence.types\"\n\nexport const presenceMachine: MachineConfig<PresenceSchema> =\n createMachine<PresenceSchema>({\n actions: {\n cleanupNode: ({refs}) => {\n refs.set(\"node\", null)\n refs.set(\"styles\", null)\n },\n clearInitial: ({context}) => {\n context.set(\"initial\", false)\n },\n clearPrevAnimationName: ({context}) => {\n context.set(\"prevAnimationName\", null)\n },\n invokeOnExitComplete: ({prop}) => {\n prop(\"onExitComplete\")?.()\n },\n\n setInitial: ({context}) => {\n if (context.get(\"initial\")) {\n return\n }\n queueMicrotask(() => {\n context.set(\"initial\", true)\n })\n },\n\n setNode: ({event, refs}) => {\n if (\"node\" in event) {\n refs.set(\"node\", event.node)\n }\n },\n\n setPrevAnimationName: ({context, refs}) => {\n raf(() => {\n context.set(\"prevAnimationName\", getAnimationName(refs.get(\"styles\")))\n })\n },\n\n setStyles: ({event, refs}) => {\n if (\n \"node\" in event &&\n event.node &&\n typeof getComputedStyle !== \"undefined\"\n ) {\n refs.set(\"styles\", getComputedStyle(event.node))\n }\n },\n\n syncPresence: ({context, prop, refs, send}) => {\n const presentProp = prop(\"present\")\n if (presentProp) {\n return send({src: \"presence.changed\", type: \"MOUNT\"})\n }\n\n const node = refs.get(\"node\")\n if (!presentProp && node?.ownerDocument.visibilityState === \"hidden\") {\n return send({src: \"visibilitychange\", type: \"UNMOUNT\"})\n }\n\n raf(() => {\n const animationName = getAnimationName(refs.get(\"styles\"))\n context.set(\"unmountAnimationName\", animationName)\n if (\n animationName === \"none\" ||\n animationName === context.get(\"prevAnimationName\") ||\n refs.get(\"styles\")?.display === \"none\" ||\n refs.get(\"styles\")?.animationDuration === \"0s\"\n ) {\n send({src: \"presence.changed\", type: \"UNMOUNT\"})\n } else {\n send({type: \"UNMOUNT.SUSPEND\"})\n }\n })\n },\n },\n\n context({bindable}) {\n return {\n initial: bindable<boolean>(() => ({\n defaultValue: false,\n sync: true,\n })),\n present: bindable<boolean>(() => ({defaultValue: false})),\n prevAnimationName: bindable<string | null>(() => ({\n defaultValue: null,\n })),\n unmountAnimationName: bindable<string | null>(() => ({\n defaultValue: null,\n })),\n }\n },\n\n effects: {\n trackAnimationEvents: ({context, refs, send}) => {\n const node = refs.get(\"node\")\n if (!node) {\n return\n }\n\n const onStart = (event: AnimationEvent) => {\n const target = event.composedPath?.()?.[0] ?? event.target\n if (target === node) {\n context.set(\n \"prevAnimationName\",\n getAnimationName(refs.get(\"styles\")),\n )\n }\n }\n\n const onEnd = (event: AnimationEvent) => {\n const animationName = getAnimationName(refs.get(\"styles\"))\n const target = getEventTarget(event)\n if (\n target === node &&\n animationName === context.get(\"unmountAnimationName\")\n ) {\n send({src: \"animationend\", type: \"UNMOUNT\"})\n }\n }\n\n node.addEventListener(\"animationstart\", onStart)\n node.addEventListener(\"animationcancel\", onEnd)\n node.addEventListener(\"animationend\", onEnd)\n const cleanupStyles = setStyle(node, {animationFillMode: \"forwards\"})\n\n return () => {\n node.removeEventListener(\"animationstart\", onStart)\n node.removeEventListener(\"animationcancel\", onEnd)\n node.removeEventListener(\"animationend\", onEnd)\n nextTick(() => cleanupStyles())\n }\n },\n },\n\n initialState({prop}) {\n return prop(\"present\") ? \"mounted\" : \"unmounted\"\n },\n\n on: {\n \"NODE.SET\": {\n actions: [\"setNode\", \"setStyles\"],\n },\n },\n\n onDestroy: {\n actions: [\"clearInitial\", \"cleanupNode\"],\n },\n\n props({props}) {\n return {...props, present: !!props.present}\n },\n\n refs() {\n return {\n node: null,\n styles: null,\n }\n },\n\n states: {\n mounted: {\n on: {\n UNMOUNT: {\n actions: [\"clearPrevAnimationName\", \"invokeOnExitComplete\"],\n target: \"unmounted\",\n },\n \"UNMOUNT.SUSPEND\": {\n target: \"unmountSuspended\",\n },\n },\n },\n unmounted: {\n on: {\n MOUNT: {\n actions: [\"setPrevAnimationName\"],\n target: \"mounted\",\n },\n },\n },\n unmountSuspended: {\n effects: [\"trackAnimationEvents\"],\n on: {\n MOUNT: {\n actions: [\"setPrevAnimationName\"],\n target: \"mounted\",\n },\n UNMOUNT: {\n actions: [\"clearPrevAnimationName\", \"invokeOnExitComplete\"],\n target: \"unmounted\",\n },\n },\n },\n },\n\n watch({actions, prop, track}) {\n track([() => prop(\"present\")], () => {\n actions.setInitial()\n actions.syncPresence()\n })\n },\n })\n\nfunction getAnimationName(styles?: CSSStyleDeclaration | null) {\n return styles?.animationName || \"none\"\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {createProps, createSplitProps} from \"@qualcomm-ui/utils/object\"\n\nimport type {PresenceApiProps, RenderStrategyApiProps} from \"./presence.types\"\n\nexport const presenceProps: (keyof PresenceApiProps)[] =\n createProps<PresenceApiProps>()(\n \"immediate\",\n \"lazyMount\",\n \"onExitComplete\",\n \"present\",\n \"skipAnimationOnMount\",\n \"unmountOnExit\",\n )\n\nexport const splitPresenceProps: <Props extends PresenceApiProps>(\n props: Props,\n) => [PresenceApiProps, Omit<Props, keyof PresenceApiProps>] =\n createSplitProps<PresenceApiProps>(presenceProps)\n\nexport const renderStrategyProps: (keyof RenderStrategyApiProps)[] =\n createProps<RenderStrategyApiProps>()(\"unmountOnExit\", \"lazyMount\")\n\nexport const splitRenderStrategyProps: <Props extends RenderStrategyApiProps>(\n props: Props,\n) => [RenderStrategyApiProps, Omit<Props, keyof RenderStrategyApiProps>] =\n createSplitProps<RenderStrategyApiProps>(renderStrategyProps)\n"],
|
|
5
|
+
"mappings": "AAUO,SAASA,EACdC,EACAC,EACa,CACb,GAAM,CAAC,QAAAC,EAAS,KAAAC,EAAM,KAAAC,EAAM,MAAAC,CAAK,EAAIL,EAC/BM,EAAUD,EAAM,QAAQ,UAAW,kBAAkB,EAC3D,MAAO,CACL,UA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F,MAAO,CACL,QAAS,CAAC,sBAAsB,EAChC,OAAQ,SACV,CACF,CACF,EACA,iBAAkB,CAChB,QAAS,CAAC,sBAAsB,EAChC,GAAI,CACF,MAAO,CACL,QAAS,CAAC,sBAAsB,EAChC,OAAQ,SACV,EACA,QAAS,CACP,QAAS,CAAC,yBAA0B,sBAAsB,EAC1D,OAAQ,WACV,CACF,CACF,CACF,EAEA,MAAM,CAAC,QAAAC,EAAS,KAAAZ,EAAM,MAAAa,CAAK,EAAG,CAC5BA,EAAM,CAAC,IAAMb,EAAK,SAAS,CAAC,EAAG,IAAM,CACnCY,EAAQ,WAAW,EACnBA,EAAQ,aAAa,CACvB,CAAC,CACH,CACF,CAAC,EAEH,SAASV,EAAiBY,EAAqC,CAC7D,OAAOA,GAAQ,eAAiB,MAClC,CCjNA,OAAQ,eAAAC,EAAa,oBAAAC,MAAuB,4BAIrC,IAAMC,EACXF,EAA8B,EAC5B,YACA,YACA,iBACA,UACA,uBACA,eACF,EAEWG,EAGXF,EAAmCC,CAAa,EAErCE,EACXJ,EAAoC,EAAE,gBAAiB,WAAW,EAEvDK,EAGXJ,EAAyCG,CAAmB",
|
|
6
6
|
"names": ["createPresenceApi", "machine", "_normalize", "context", "prop", "send", "state", "present", "node", "getEventTarget", "nextTick", "raf", "setStyle", "createMachine", "presenceMachine", "refs", "context", "prop", "event", "getAnimationName", "send", "presentProp", "node", "animationName", "bindable", "onStart", "onEnd", "cleanupStyles", "props", "actions", "track", "styles", "createProps", "createSplitProps", "presenceProps", "splitPresenceProps", "renderStrategyProps", "splitRenderStrategyProps"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presence.machine.d.ts","sourceRoot":"","sources":["../../src/presence/presence.machine.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgB,KAAK,aAAa,EAAC,MAAM,4BAA4B,CAAA;AAE5E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAEpD,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"presence.machine.d.ts","sourceRoot":"","sources":["../../src/presence/presence.machine.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgB,KAAK,aAAa,EAAC,MAAM,4BAA4B,CAAA;AAE5E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAEpD,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,cAAc,CAwMtD,CAAA"}
|