UNPKG

@wordpress/components

Version:
8 lines (7 loc) 1.26 kB
{ "version": 3, "sources": ["../../src/context/utils.js"], "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { CONNECTED_NAMESPACE, COMPONENT_NAMESPACE } from './constants';\n\n/**\n * Creates a dedicated context namespace HTML attribute for components.\n * ns is short for \"namespace\"\n *\n * @example\n * ```jsx\n * <div {...ns('Container')} />\n * ```\n *\n * @param {string} componentName The name for the component.\n * @return {Record<string, any>} A props object with the namespaced HTML attribute.\n */\nexport function getNamespace(componentName) {\n return {\n [COMPONENT_NAMESPACE]: componentName\n };\n}\n\n/**\n * Creates a dedicated connected context namespace HTML attribute for components.\n * ns is short for \"namespace\"\n *\n * @example\n * ```jsx\n * <div {...cns()} />\n * ```\n *\n * @return {Record<string, any>} A props object with the namespaced HTML attribute.\n */\nexport function getConnectedNamespace() {\n return {\n [CONNECTED_NAMESPACE]: true\n };\n}"], "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAyD;AAclD,SAAS,aAAa,eAAe;AAC1C,SAAO;AAAA,IACL,CAAC,oCAAmB,GAAG;AAAA,EACzB;AACF;AAaO,SAAS,wBAAwB;AACtC,SAAO;AAAA,IACL,CAAC,oCAAmB,GAAG;AAAA,EACzB;AACF;", "names": [] }