@wordpress/components
Version:
UI components for WordPress.
8 lines (7 loc) • 1.22 kB
Source Map (JSON)
{
"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": ";AAGA,SAAS,qBAAqB,2BAA2B;AAclD,SAAS,aAAa,eAAe;AAC1C,SAAO;AAAA,IACL,CAAC,mBAAmB,GAAG;AAAA,EACzB;AACF;AAaO,SAAS,wBAAwB;AACtC,SAAO;AAAA,IACL,CAAC,mBAAmB,GAAG;AAAA,EACzB;AACF;",
"names": []
}