@wordpress/format-library 3.0.6 → 3.0.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/format-library/src/link/use-link-instance-key.js"],"names":["weakMap","WeakMap","id","prefix","getKey","_id","useLinkInstanceKey","instance","has","get","set"],"mappings":";;;;;;AAAA;AACA,MAAMA,OAAO,GAAG,IAAIC,OAAJ,EAAhB,C,CAEA;;AACA,IAAIC,EAAE,GAAG,CAAC,CAAV;AAEA,MAAMC,MAAM,GAAG,uBAAf;;AAEA,SAASC,MAAT,CAAiBC,GAAjB,EAAuB;AACtB,SAAQ,GAAGF,MAAQ,IAAIE,GAAK,EAA5B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,kBAAT,CAA6BC,QAA7B,EAAwC;AACvC,MAAKP,OAAO,CAACQ,GAAR,CAAaD,QAAb,CAAL,EAA+B;AAC9B,WAAOH,MAAM,CAAEJ,OAAO,CAACS,GAAR,CAAaF,QAAb,CAAF,CAAb;AACA;;AAEDL,EAAAA,EAAE,IAAI,CAAN;AAEAF,EAAAA,OAAO,CAACU,GAAR,CAAaH,QAAb,EAAuBL,EAAvB;AAEA,SAAOE,MAAM,CAAEF,EAAF,CAAb;AACA;;eAEcI,kB","sourcesContent":["// Weakly referenced map allows unused ids to be garbage collected.\nconst weakMap = new WeakMap();\n\n// Incrementing zero-based ID value\nlet id = -1;\n\nconst prefix = 'link-control-instance';\n\nfunction getKey( _id ) {\n\treturn `${ prefix }-${ _id }`;\n}\n\n/**\n * Builds a unique link control key for the given object reference.\n *\n * @param {Object} instance an unique object reference specific to this link control instance.\n * @return {string} the unique key to use for this link control.\n */\nfunction useLinkInstanceKey( instance ) {\n\tif ( weakMap.has( instance ) ) {\n\t\treturn getKey( weakMap.get( instance ) );\n\t}\n\n\tid += 1;\n\n\tweakMap.set( instance, id );\n\n\treturn getKey( id );\n}\n\nexport default useLinkInstanceKey;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/format-library/src/link/use-link-instance-key.js"],"names":["weakMap","WeakMap","id","prefix","getKey","_id","useLinkInstanceKey","instance","has","get","set"],"mappings":";;;;;;AAAA;AACA,MAAMA,OAAO,GAAG,IAAIC,OAAJ,EAAhB,C,CAEA;;AACA,IAAIC,EAAE,GAAG,CAAC,CAAV;AAEA,MAAMC,MAAM,GAAG,uBAAf;;AAEA,SAASC,MAAT,CAAiBC,GAAjB,EAAuB;AACtB,SAAQ,GAAGF,MAAQ,IAAIE,GAAK,EAA5B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,kBAAT,CAA6BC,QAA7B,EAAwC;AACvC,MAAK,CAAEA,QAAP,EAAkB;AACjB;AACA;;AACD,MAAKP,OAAO,CAACQ,GAAR,CAAaD,QAAb,CAAL,EAA+B;AAC9B,WAAOH,MAAM,CAAEJ,OAAO,CAACS,GAAR,CAAaF,QAAb,CAAF,CAAb;AACA;;AAEDL,EAAAA,EAAE,IAAI,CAAN;AAEAF,EAAAA,OAAO,CAACU,GAAR,CAAaH,QAAb,EAAuBL,EAAvB;AAEA,SAAOE,MAAM,CAAEF,EAAF,CAAb;AACA;;eAEcI,kB","sourcesContent":["// Weakly referenced map allows unused ids to be garbage collected.\nconst weakMap = new WeakMap();\n\n// Incrementing zero-based ID value\nlet id = -1;\n\nconst prefix = 'link-control-instance';\n\nfunction getKey( _id ) {\n\treturn `${ prefix }-${ _id }`;\n}\n\n/**\n * Builds a unique link control key for the given object reference.\n *\n * @param {Object} instance an unique object reference specific to this link control instance.\n * @return {string} the unique key to use for this link control.\n */\nfunction useLinkInstanceKey( instance ) {\n\tif ( ! instance ) {\n\t\treturn;\n\t}\n\tif ( weakMap.has( instance ) ) {\n\t\treturn getKey( weakMap.get( instance ) );\n\t}\n\n\tid += 1;\n\n\tweakMap.set( instance, id );\n\n\treturn getKey( id );\n}\n\nexport default useLinkInstanceKey;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/format-library/src/link/use-link-instance-key.js"],"names":["weakMap","WeakMap","id","prefix","getKey","_id","useLinkInstanceKey","instance","has","get","set"],"mappings":"AAAA;AACA,MAAMA,OAAO,GAAG,IAAIC,OAAJ,EAAhB,C,CAEA;;AACA,IAAIC,EAAE,GAAG,CAAC,CAAV;AAEA,MAAMC,MAAM,GAAG,uBAAf;;AAEA,SAASC,MAAT,CAAiBC,GAAjB,EAAuB;AACtB,SAAQ,GAAGF,MAAQ,IAAIE,GAAK,EAA5B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,kBAAT,CAA6BC,QAA7B,EAAwC;AACvC,MAAKP,OAAO,CAACQ,GAAR,CAAaD,QAAb,CAAL,EAA+B;AAC9B,WAAOH,MAAM,CAAEJ,OAAO,CAACS,GAAR,CAAaF,QAAb,CAAF,CAAb;AACA;;AAEDL,EAAAA,EAAE,IAAI,CAAN;AAEAF,EAAAA,OAAO,CAACU,GAAR,CAAaH,QAAb,EAAuBL,EAAvB;AAEA,SAAOE,MAAM,CAAEF,EAAF,CAAb;AACA;;AAED,eAAeI,kBAAf","sourcesContent":["// Weakly referenced map allows unused ids to be garbage collected.\nconst weakMap = new WeakMap();\n\n// Incrementing zero-based ID value\nlet id = -1;\n\nconst prefix = 'link-control-instance';\n\nfunction getKey( _id ) {\n\treturn `${ prefix }-${ _id }`;\n}\n\n/**\n * Builds a unique link control key for the given object reference.\n *\n * @param {Object} instance an unique object reference specific to this link control instance.\n * @return {string} the unique key to use for this link control.\n */\nfunction useLinkInstanceKey( instance ) {\n\tif ( weakMap.has( instance ) ) {\n\t\treturn getKey( weakMap.get( instance ) );\n\t}\n\n\tid += 1;\n\n\tweakMap.set( instance, id );\n\n\treturn getKey( id );\n}\n\nexport default useLinkInstanceKey;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/format-library/src/link/use-link-instance-key.js"],"names":["weakMap","WeakMap","id","prefix","getKey","_id","useLinkInstanceKey","instance","has","get","set"],"mappings":"AAAA;AACA,MAAMA,OAAO,GAAG,IAAIC,OAAJ,EAAhB,C,CAEA;;AACA,IAAIC,EAAE,GAAG,CAAC,CAAV;AAEA,MAAMC,MAAM,GAAG,uBAAf;;AAEA,SAASC,MAAT,CAAiBC,GAAjB,EAAuB;AACtB,SAAQ,GAAGF,MAAQ,IAAIE,GAAK,EAA5B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,kBAAT,CAA6BC,QAA7B,EAAwC;AACvC,MAAK,CAAEA,QAAP,EAAkB;AACjB;AACA;;AACD,MAAKP,OAAO,CAACQ,GAAR,CAAaD,QAAb,CAAL,EAA+B;AAC9B,WAAOH,MAAM,CAAEJ,OAAO,CAACS,GAAR,CAAaF,QAAb,CAAF,CAAb;AACA;;AAEDL,EAAAA,EAAE,IAAI,CAAN;AAEAF,EAAAA,OAAO,CAACU,GAAR,CAAaH,QAAb,EAAuBL,EAAvB;AAEA,SAAOE,MAAM,CAAEF,EAAF,CAAb;AACA;;AAED,eAAeI,kBAAf","sourcesContent":["// Weakly referenced map allows unused ids to be garbage collected.\nconst weakMap = new WeakMap();\n\n// Incrementing zero-based ID value\nlet id = -1;\n\nconst prefix = 'link-control-instance';\n\nfunction getKey( _id ) {\n\treturn `${ prefix }-${ _id }`;\n}\n\n/**\n * Builds a unique link control key for the given object reference.\n *\n * @param {Object} instance an unique object reference specific to this link control instance.\n * @return {string} the unique key to use for this link control.\n */\nfunction useLinkInstanceKey( instance ) {\n\tif ( ! instance ) {\n\t\treturn;\n\t}\n\tif ( weakMap.has( instance ) ) {\n\t\treturn getKey( weakMap.get( instance ) );\n\t}\n\n\tid += 1;\n\n\tweakMap.set( instance, id );\n\n\treturn getKey( id );\n}\n\nexport default useLinkInstanceKey;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/format-library",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "Format library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "68d15d606a5ebcbea3977f39b0e758bcf282b96a"
|
|
48
48
|
}
|
|
@@ -17,6 +17,9 @@ function getKey( _id ) {
|
|
|
17
17
|
* @return {string} the unique key to use for this link control.
|
|
18
18
|
*/
|
|
19
19
|
function useLinkInstanceKey( instance ) {
|
|
20
|
+
if ( ! instance ) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
20
23
|
if ( weakMap.has( instance ) ) {
|
|
21
24
|
return getKey( weakMap.get( instance ) );
|
|
22
25
|
}
|