@wordpress/widget-dashboard
Version:
Stateless rendering engine for widget dashboards: the WidgetDashboard compound component and its grid-settings kit.
1 lines • 1.13 kB
Source Map (JSON)
{"version":3,"file":"use-runtime-actions.cjs","names":["useDashboardInternalContext","useObservableValue"],"sources":["../../src/hooks/use-runtime-actions.ts"],"sourcesContent":["import { useObservableValue } from '@wordpress/compose';\nimport type { WidgetRuntimeAction } from '@wordpress/widget-primitives';\nimport { useDashboardInternalContext } from '../context/dashboard-context';\n\nconst NO_RUNTIME_ACTIONS: WidgetRuntimeAction[] = [];\n\n/**\n * The runtime actions of one instance: what its first mounted render\n * declares, so a copy of the tile never takes them over.\n *\n * @param {string} uuid The instance.\n */\nexport function useRuntimeActions( uuid: string ): WidgetRuntimeAction[] {\n\tconst { runtimeActions } = useDashboardInternalContext();\n\tconst [ first ] =\n\t\tuseObservableValue( runtimeActions, uuid )?.values() ?? [];\n\n\treturn first ?? NO_RUNTIME_ACTIONS;\n}\n"],"mappings":";;;;;;;;AAIA,MAAM,qBAA4C,CAAC;;;;;;;AAQnD,SAAgB,kBAAmB,MAAsC;CACxE,MAAM,EAAE,oBAAA,GAAmBA,iCAAAA,4BAAAA,CAA4B;CACvD,MAAM,CAAE,UAAA,GACPC,mBAAAA,mBAAAA,CAAoB,gBAAgB,IAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CAE1D,OAAO,SAAS;AACjB"}