| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var wp; 2 (wp ||= {}).patterns = (() => { 3 var __create = Object.create; 4 var __defProp = Object.defineProperty; 5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 6 var __getOwnPropNames = Object.getOwnPropertyNames; 7 var __getProtoOf = Object.getPrototypeOf; 8 var __hasOwnProp = Object.prototype.hasOwnProperty; 9 var __commonJS = (cb, mod) => function __require() { 10 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 11 }; 12 var __export = (target, all) => { 13 for (var name in all) 14 __defProp(target, name, { get: all[name], enumerable: true }); 15 }; 16 var __copyProps = (to, from, except, desc) => { 17 if (from && typeof from === "object" || typeof from === "function") { 18 for (let key of __getOwnPropNames(from)) 19 if (!__hasOwnProp.call(to, key) && key !== except) 20 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 21 } 22 return to; 23 }; 24 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 25 // If the importer is in node compatibility mode or this is not an ESM 26 // file that has been converted to a CommonJS file using a Babel- 27 // compatible transform (i.e. "__esModule" has not been set), then set 28 // "default" to the CommonJS "module.exports" for node compatibility. 29 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 30 mod 31 )); 32 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 33 34 // package-external:@wordpress/data 35 var require_data = __commonJS({ 36 "package-external:@wordpress/data"(exports, module) { 37 module.exports = window.wp.data; 38 } 39 }); 40 41 // package-external:@wordpress/blocks 42 var require_blocks = __commonJS({ 43 "package-external:@wordpress/blocks"(exports, module) { 44 module.exports = window.wp.blocks; 45 } 46 }); 47 48 // package-external:@wordpress/core-data 49 var require_core_data = __commonJS({ 50 "package-external:@wordpress/core-data"(exports, module) { 51 module.exports = window.wp.coreData; 52 } 53 }); 54 55 // package-external:@wordpress/block-editor 56 var require_block_editor = __commonJS({ 57 "package-external:@wordpress/block-editor"(exports, module) { 58 module.exports = window.wp.blockEditor; 59 } 60 }); 61 62 // package-external:@wordpress/private-apis 63 var require_private_apis = __commonJS({ 64 "package-external:@wordpress/private-apis"(exports, module) { 65 module.exports = window.wp.privateApis; 66 } 67 }); 68 69 // package-external:@wordpress/components 70 var require_components = __commonJS({ 71 "package-external:@wordpress/components"(exports, module) { 72 module.exports = window.wp.components; 73 } 74 }); 75 76 // package-external:@wordpress/element 77 var require_element = __commonJS({ 78 "package-external:@wordpress/element"(exports, module) { 79 module.exports = window.wp.element; 80 } 81 }); 82 83 // package-external:@wordpress/i18n 84 var require_i18n = __commonJS({ 85 "package-external:@wordpress/i18n"(exports, module) { 86 module.exports = window.wp.i18n; 87 } 88 }); 89 90 // vendor-external:react/jsx-runtime 91 var require_jsx_runtime = __commonJS({ 92 "vendor-external:react/jsx-runtime"(exports, module) { 93 module.exports = window.ReactJSXRuntime; 94 } 95 }); 96 97 // vendor-external:react 98 var require_react = __commonJS({ 99 "vendor-external:react"(exports, module) { 100 module.exports = window.React; 101 } 102 }); 103 104 // package-external:@wordpress/a11y 105 var require_a11y = __commonJS({ 106 "package-external:@wordpress/a11y"(exports, module) { 107 module.exports = window.wp.a11y; 108 } 109 }); 110 111 // package-external:@wordpress/primitives 112 var require_primitives = __commonJS({ 113 "package-external:@wordpress/primitives"(exports, module) { 114 module.exports = window.wp.primitives; 115 } 116 }); 117 118 // package-external:@wordpress/compose 119 var require_compose = __commonJS({ 120 "package-external:@wordpress/compose"(exports, module) { 121 module.exports = window.wp.compose; 122 } 123 }); 124 125 // package-external:@wordpress/notices 126 var require_notices = __commonJS({ 127 "package-external:@wordpress/notices"(exports, module) { 128 module.exports = window.wp.notices; 129 } 130 }); 131 132 // package-external:@wordpress/html-entities 133 var require_html_entities = __commonJS({ 134 "package-external:@wordpress/html-entities"(exports, module) { 135 module.exports = window.wp.htmlEntities; 136 } 137 }); 138 139 // package-external:@wordpress/url 140 var require_url = __commonJS({ 141 "package-external:@wordpress/url"(exports, module) { 142 module.exports = window.wp.url; 143 } 144 }); 145 146 // packages/patterns/build-module/index.mjs 147 var index_exports = {}; 148 __export(index_exports, { 149 privateApis: () => privateApis, 150 store: () => store 151 }); 152 153 // packages/patterns/build-module/store/index.mjs 154 var import_data2 = __toESM(require_data(), 1); 155 156 // packages/patterns/build-module/store/reducer.mjs 157 var import_data = __toESM(require_data(), 1); 158 function isEditingPattern(state = {}, action) { 159 if (action?.type === "SET_EDITING_PATTERN") { 160 return { 161 ...state, 162 [action.clientId]: action.isEditing 163 }; 164 } 165 return state; 166 } 167 var reducer_default = (0, import_data.combineReducers)({ 168 isEditingPattern 169 }); 170 171 // packages/patterns/build-module/store/actions.mjs 172 var actions_exports = {}; 173 __export(actions_exports, { 174 convertSyncedPatternToStatic: () => convertSyncedPatternToStatic, 175 createPattern: () => createPattern, 176 createPatternFromFile: () => createPatternFromFile, 177 setEditingPattern: () => setEditingPattern 178 }); 179 var import_blocks = __toESM(require_blocks(), 1); 180 var import_core_data = __toESM(require_core_data(), 1); 181 var import_block_editor = __toESM(require_block_editor(), 1); 182 183 // packages/patterns/build-module/constants.mjs 184 var PATTERN_TYPES = { 185 theme: "pattern", 186 user: "wp_block" 187 }; 188 var PATTERN_DEFAULT_CATEGORY = "all-patterns"; 189 var PATTERN_USER_CATEGORY = "my-patterns"; 190 var EXCLUDED_PATTERN_SOURCES = [ 191 "core", 192 "pattern-directory/core", 193 "pattern-directory/featured" 194 ]; 195 var PATTERN_SYNC_TYPES = { 196 full: "fully", 197 unsynced: "unsynced" 198 }; 199 var PATTERN_OVERRIDES_BINDING_SOURCE = "core/pattern-overrides"; 200 201 // packages/patterns/build-module/store/actions.mjs 202 var createPattern = (title, syncType, content, categories) => async ({ registry }) => { 203 const meta = syncType === PATTERN_SYNC_TYPES.unsynced ? { 204 wp_pattern_sync_status: syncType 205 } : void 0; 206 const reusableBlock = { 207 title, 208 content, 209 status: "publish", 210 meta, 211 wp_pattern_category: categories 212 }; 213 const updatedRecord = await registry.dispatch(import_core_data.store).saveEntityRecord("postType", "wp_block", reusableBlock); 214 return updatedRecord; 215 }; 216 var createPatternFromFile = (file, categories) => async ({ dispatch }) => { 217 const fileContent = await file.text(); 218 let parsedContent; 219 try { 220 parsedContent = JSON.parse(fileContent); 221 } catch { 222 throw new Error("Invalid JSON file"); 223 } 224 if (parsedContent.__file !== "wp_block" || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== "string" || typeof parsedContent.content !== "string" || parsedContent.syncStatus && typeof parsedContent.syncStatus !== "string") { 225 throw new Error("Invalid pattern JSON file"); 226 } 227 const pattern = await dispatch.createPattern( 228 parsedContent.title, 229 parsedContent.syncStatus, 230 parsedContent.content, 231 categories 232 ); 233 return pattern; 234 }; 235 var convertSyncedPatternToStatic = (clientId) => ({ registry }) => { 236 const patternBlock = registry.select(import_block_editor.store).getBlock(clientId); 237 const existingOverrides = patternBlock.attributes?.content; 238 function cloneBlocksAndRemoveBindings(blocks) { 239 return blocks.map((block) => { 240 let metadata = block.attributes.metadata; 241 if (metadata) { 242 metadata = { ...metadata }; 243 delete metadata.id; 244 delete metadata.bindings; 245 if (existingOverrides?.[metadata.name]) { 246 for (const [attributeName, value] of Object.entries( 247 existingOverrides[metadata.name] 248 )) { 249 if (!(0, import_blocks.getBlockType)(block.name)?.attributes[attributeName]) { 250 continue; 251 } 252 block.attributes[attributeName] = value; 253 } 254 } 255 } 256 return (0, import_blocks.cloneBlock)( 257 block, 258 { 259 metadata: metadata && Object.keys(metadata).length > 0 ? metadata : void 0 260 }, 261 cloneBlocksAndRemoveBindings(block.innerBlocks) 262 ); 263 }); 264 } 265 const patternInnerBlocks = registry.select(import_block_editor.store).getBlocks(patternBlock.clientId); 266 registry.dispatch(import_block_editor.store).replaceBlocks( 267 patternBlock.clientId, 268 cloneBlocksAndRemoveBindings(patternInnerBlocks) 269 ); 270 }; 271 function setEditingPattern(clientId, isEditing) { 272 return { 273 type: "SET_EDITING_PATTERN", 274 clientId, 275 isEditing 276 }; 277 } 278 279 // packages/patterns/build-module/store/constants.mjs 280 var STORE_NAME = "core/patterns"; 281 282 // packages/patterns/build-module/store/selectors.mjs 283 var selectors_exports = {}; 284 __export(selectors_exports, { 285 isEditingPattern: () => isEditingPattern2 286 }); 287 function isEditingPattern2(state, clientId) { 288 return state.isEditingPattern[clientId]; 289 } 290 291 // packages/patterns/build-module/lock-unlock.mjs 292 var import_private_apis = __toESM(require_private_apis(), 1); 293 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 294 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 295 "@wordpress/patterns" 296 ); 297 298 // packages/patterns/build-module/store/index.mjs 299 var storeConfig = { 300 reducer: reducer_default 301 }; 302 var store = (0, import_data2.createReduxStore)(STORE_NAME, { 303 ...storeConfig 304 }); 305 (0, import_data2.register)(store); 306 unlock(store).registerPrivateActions(actions_exports); 307 unlock(store).registerPrivateSelectors(selectors_exports); 308 309 // packages/patterns/build-module/components/overrides-panel.mjs 310 var import_block_editor2 = __toESM(require_block_editor(), 1); 311 var import_components = __toESM(require_components(), 1); 312 var import_data3 = __toESM(require_data(), 1); 313 var import_element = __toESM(require_element(), 1); 314 var import_i18n = __toESM(require_i18n(), 1); 315 316 // packages/patterns/build-module/api/index.mjs 317 function isOverridableBlock(block) { 318 return !!block.attributes.metadata?.name && !!block.attributes.metadata?.bindings && Object.values(block.attributes.metadata.bindings).some( 319 (binding) => binding.source === "core/pattern-overrides" 320 ); 321 } 322 323 // packages/patterns/build-module/components/overrides-panel.mjs 324 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 325 var { BlockQuickNavigation } = unlock(import_block_editor2.privateApis); 326 function OverridesPanel() { 327 const { allClientIds, supportedBlockTypesRaw } = (0, import_data3.useSelect)( 328 (select) => ({ 329 allClientIds: select(import_block_editor2.store).getClientIdsWithDescendants(), 330 supportedBlockTypesRaw: select(import_block_editor2.store).getSettings()?.__experimentalBlockBindingsSupportedAttributes 331 }), 332 [] 333 ); 334 const { getBlock } = (0, import_data3.useSelect)(import_block_editor2.store); 335 const clientIdsWithOverrides = (0, import_element.useMemo)(() => { 336 const supportedBlockTypes = Object.keys(supportedBlockTypesRaw ?? {}); 337 return allClientIds.filter((clientId) => { 338 const block = getBlock(clientId); 339 return supportedBlockTypes.includes(block.name) && isOverridableBlock(block); 340 }); 341 }, [allClientIds, getBlock, supportedBlockTypesRaw]); 342 if (!clientIdsWithOverrides?.length) { 343 return null; 344 } 345 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.PanelBody, { title: (0, import_i18n.__)("Overrides"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockQuickNavigation, { clientIds: clientIdsWithOverrides }) }); 346 } 347 348 // packages/patterns/build-module/components/create-pattern-modal.mjs 349 var import_components3 = __toESM(require_components(), 1); 350 351 // node_modules/clsx/dist/clsx.mjs 352 function r(e) { 353 var t, f, n = ""; 354 if ("string" == typeof e || "number" == typeof e) n += e; 355 else if ("object" == typeof e) if (Array.isArray(e)) { 356 var o = e.length; 357 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 358 } else for (f in e) e[f] && (n && (n += " "), n += f); 359 return n; 360 } 361 function clsx() { 362 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 363 return n; 364 } 365 var clsx_default = clsx; 366 367 // node_modules/@base-ui/utils/useRefWithInit.mjs 368 var React = __toESM(require_react(), 1); 369 var UNINITIALIZED = {}; 370 function useRefWithInit(init, initArg) { 371 const ref = React.useRef(UNINITIALIZED); 372 if (ref.current === UNINITIALIZED) { 373 ref.current = init(initArg); 374 } 375 return ref; 376 } 377 378 // node_modules/@base-ui/utils/warn.mjs 379 var set; 380 if (true) { 381 set = /* @__PURE__ */ new Set(); 382 } 383 function warn(...messages) { 384 if (true) { 385 const messageKey = messages.join(" "); 386 if (!set.has(messageKey)) { 387 set.add(messageKey); 388 console.warn(`Base UI: $messageKey}`); 389 } 390 } 391 } 392 393 // node_modules/@base-ui/react/internals/useRenderElement.mjs 394 var React4 = __toESM(require_react(), 1); 395 396 // node_modules/@base-ui/utils/useMergedRefs.mjs 397 function useMergedRefs(a, b, c, d) { 398 const forkRef = useRefWithInit(createForkRef).current; 399 if (didChange(forkRef, a, b, c, d)) { 400 update(forkRef, [a, b, c, d]); 401 } 402 return forkRef.callback; 403 } 404 function useMergedRefsN(refs) { 405 const forkRef = useRefWithInit(createForkRef).current; 406 if (didChangeN(forkRef, refs)) { 407 update(forkRef, refs); 408 } 409 return forkRef.callback; 410 } 411 function createForkRef() { 412 return { 413 callback: null, 414 cleanup: null, 415 refs: [] 416 }; 417 } 418 function didChange(forkRef, a, b, c, d) { 419 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 420 } 421 function didChangeN(forkRef, newRefs) { 422 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]); 423 } 424 function update(forkRef, refs) { 425 forkRef.refs = refs; 426 if (refs.every((ref) => ref == null)) { 427 forkRef.callback = null; 428 return; 429 } 430 forkRef.callback = (instance) => { 431 if (forkRef.cleanup) { 432 forkRef.cleanup(); 433 forkRef.cleanup = null; 434 } 435 if (instance != null) { 436 const cleanupCallbacks = Array(refs.length).fill(null); 437 for (let i = 0; i < refs.length; i += 1) { 438 const ref = refs[i]; 439 if (ref == null) { 440 continue; 441 } 442 switch (typeof ref) { 443 case "function": { 444 const refCleanup = ref(instance); 445 if (typeof refCleanup === "function") { 446 cleanupCallbacks[i] = refCleanup; 447 } 448 break; 449 } 450 case "object": { 451 ref.current = instance; 452 break; 453 } 454 default: 455 } 456 } 457 forkRef.cleanup = () => { 458 for (let i = 0; i < refs.length; i += 1) { 459 const ref = refs[i]; 460 if (ref == null) { 461 continue; 462 } 463 switch (typeof ref) { 464 case "function": { 465 const cleanupCallback = cleanupCallbacks[i]; 466 if (typeof cleanupCallback === "function") { 467 cleanupCallback(); 468 } else { 469 ref(null); 470 } 471 break; 472 } 473 case "object": { 474 ref.current = null; 475 break; 476 } 477 default: 478 } 479 } 480 }; 481 } 482 }; 483 } 484 485 // node_modules/@base-ui/utils/getReactElementRef.mjs 486 var React3 = __toESM(require_react(), 1); 487 488 // node_modules/@base-ui/utils/reactVersion.mjs 489 var React2 = __toESM(require_react(), 1); 490 var majorVersion = parseInt(React2.version, 10); 491 function isReactVersionAtLeast(reactVersionToCheck) { 492 return majorVersion >= reactVersionToCheck; 493 } 494 495 // node_modules/@base-ui/utils/getReactElementRef.mjs 496 function getReactElementRef(element) { 497 if (!/* @__PURE__ */ React3.isValidElement(element)) { 498 return null; 499 } 500 const reactElement = element; 501 const propsWithRef = reactElement.props; 502 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 503 } 504 505 // node_modules/@base-ui/utils/mergeObjects.mjs 506 function mergeObjects(a, b) { 507 if (a && !b) { 508 return a; 509 } 510 if (!a && b) { 511 return b; 512 } 513 if (a || b) { 514 return { 515 ...a, 516 ...b 517 }; 518 } 519 return void 0; 520 } 521 522 // node_modules/@base-ui/utils/empty.mjs 523 var EMPTY_ARRAY = Object.freeze([]); 524 var EMPTY_OBJECT = Object.freeze({}); 525 526 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 527 function getStateAttributesProps(state, customMapping) { 528 const props = {}; 529 for (const key in state) { 530 const value = state[key]; 531 if (customMapping?.hasOwnProperty(key)) { 532 const customProps = customMapping[key](value); 533 if (customProps != null) { 534 Object.assign(props, customProps); 535 } 536 continue; 537 } 538 if (value === true) { 539 props[`data-$key.toLowerCase()}`] = ""; 540 } else if (value) { 541 props[`data-$key.toLowerCase()}`] = value.toString(); 542 } 543 } 544 return props; 545 } 546 547 // node_modules/@base-ui/react/utils/resolveClassName.mjs 548 function resolveClassName(className, state) { 549 return typeof className === "function" ? className(state) : className; 550 } 551 552 // node_modules/@base-ui/react/utils/resolveStyle.mjs 553 function resolveStyle(style, state) { 554 return typeof style === "function" ? style(state) : style; 555 } 556 557 // node_modules/@base-ui/react/merge-props/mergeProps.mjs 558 var EMPTY_PROPS = {}; 559 function mergeProps(a, b, c, d, e) { 560 if (!c && !d && !e && !a) { 561 return createInitialMergedProps(b); 562 } 563 let merged = createInitialMergedProps(a); 564 if (b) { 565 merged = mergeInto(merged, b); 566 } 567 if (c) { 568 merged = mergeInto(merged, c); 569 } 570 if (d) { 571 merged = mergeInto(merged, d); 572 } 573 if (e) { 574 merged = mergeInto(merged, e); 575 } 576 return merged; 577 } 578 function mergePropsN(props) { 579 if (props.length === 0) { 580 return EMPTY_PROPS; 581 } 582 if (props.length === 1) { 583 return createInitialMergedProps(props[0]); 584 } 585 let merged = createInitialMergedProps(props[0]); 586 for (let i = 1; i < props.length; i += 1) { 587 merged = mergeInto(merged, props[i]); 588 } 589 return merged; 590 } 591 function createInitialMergedProps(inputProps) { 592 if (isPropsGetter(inputProps)) { 593 return { 594 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 595 }; 596 } 597 return copyInitialProps(inputProps); 598 } 599 function mergeInto(merged, inputProps) { 600 if (isPropsGetter(inputProps)) { 601 return resolvePropsGetter(inputProps, merged); 602 } 603 return mutablyMergeInto(merged, inputProps); 604 } 605 function copyInitialProps(inputProps) { 606 const copiedProps = { 607 ...inputProps 608 }; 609 for (const propName in copiedProps) { 610 const propValue = copiedProps[propName]; 611 if (isEventHandler(propName, propValue)) { 612 copiedProps[propName] = wrapEventHandler(propValue); 613 } 614 } 615 return copiedProps; 616 } 617 function mutablyMergeInto(mergedProps, externalProps) { 618 if (!externalProps) { 619 return mergedProps; 620 } 621 for (const propName in externalProps) { 622 const externalPropValue = externalProps[propName]; 623 switch (propName) { 624 case "style": { 625 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 626 break; 627 } 628 case "className": { 629 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 630 break; 631 } 632 default: { 633 if (isEventHandler(propName, externalPropValue)) { 634 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 635 } else { 636 mergedProps[propName] = externalPropValue; 637 } 638 } 639 } 640 } 641 return mergedProps; 642 } 643 function isEventHandler(key, value) { 644 const code0 = key.charCodeAt(0); 645 const code1 = key.charCodeAt(1); 646 const code2 = key.charCodeAt(2); 647 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 648 } 649 function isPropsGetter(inputProps) { 650 return typeof inputProps === "function"; 651 } 652 function resolvePropsGetter(inputProps, previousProps) { 653 if (isPropsGetter(inputProps)) { 654 return inputProps(previousProps); 655 } 656 return inputProps ?? EMPTY_PROPS; 657 } 658 function mergeEventHandlers(ourHandler, theirHandler) { 659 if (!theirHandler) { 660 return ourHandler; 661 } 662 if (!ourHandler) { 663 return wrapEventHandler(theirHandler); 664 } 665 return (...args) => { 666 const event = args[0]; 667 if (isSyntheticEvent(event)) { 668 const baseUIEvent = event; 669 makeEventPreventable(baseUIEvent); 670 const result2 = theirHandler(...args); 671 if (!baseUIEvent.baseUIHandlerPrevented) { 672 ourHandler?.(...args); 673 } 674 return result2; 675 } 676 const result = theirHandler(...args); 677 ourHandler?.(...args); 678 return result; 679 }; 680 } 681 function wrapEventHandler(handler) { 682 if (!handler) { 683 return handler; 684 } 685 return (...args) => { 686 const event = args[0]; 687 if (isSyntheticEvent(event)) { 688 makeEventPreventable(event); 689 } 690 return handler(...args); 691 }; 692 } 693 function makeEventPreventable(event) { 694 event.preventBaseUIHandler = () => { 695 event.baseUIHandlerPrevented = true; 696 }; 697 return event; 698 } 699 function mergeClassNames(ourClassName, theirClassName) { 700 if (theirClassName) { 701 if (ourClassName) { 702 return theirClassName + " " + ourClassName; 703 } 704 return theirClassName; 705 } 706 return ourClassName; 707 } 708 function isSyntheticEvent(event) { 709 return event != null && typeof event === "object" && "nativeEvent" in event; 710 } 711 712 // node_modules/@base-ui/react/internals/useRenderElement.mjs 713 var import_react = __toESM(require_react(), 1); 714 function useRenderElement(element, componentProps, params = {}) { 715 const renderProp = componentProps.render; 716 const outProps = useRenderElementProps(componentProps, params); 717 if (params.enabled === false) { 718 return null; 719 } 720 const state = params.state ?? EMPTY_OBJECT; 721 return evaluateRenderProp(element, renderProp, outProps, state); 722 } 723 function useRenderElementProps(componentProps, params = {}) { 724 const { 725 className: classNameProp, 726 style: styleProp, 727 render: renderProp 728 } = componentProps; 729 const { 730 state = EMPTY_OBJECT, 731 ref, 732 props, 733 stateAttributesMapping, 734 enabled = true 735 } = params; 736 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 737 const style = enabled ? resolveStyle(styleProp, state) : void 0; 738 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT; 739 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 740 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 741 if (typeof document !== "undefined") { 742 if (!enabled) { 743 useMergedRefs(null, null); 744 } else if (Array.isArray(ref)) { 745 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 746 } else { 747 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 748 } 749 } 750 if (!enabled) { 751 return EMPTY_OBJECT; 752 } 753 if (className !== void 0) { 754 outProps.className = mergeClassNames(outProps.className, className); 755 } 756 if (style !== void 0) { 757 outProps.style = mergeObjects(outProps.style, style); 758 } 759 return outProps; 760 } 761 function resolveRenderFunctionProps(props) { 762 if (Array.isArray(props)) { 763 return mergePropsN(props); 764 } 765 return mergeProps(void 0, props); 766 } 767 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 768 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 769 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 770 function evaluateRenderProp(element, render, props, state) { 771 if (render) { 772 if (typeof render === "function") { 773 if (true) { 774 warnIfRenderPropLooksLikeComponent(render); 775 } 776 return render(props, state); 777 } 778 const mergedProps = mergeProps(props, render.props); 779 mergedProps.ref = props.ref; 780 let newElement = render; 781 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 782 const children = React4.Children.toArray(render); 783 newElement = children[0]; 784 } 785 if (true) { 786 if (!/* @__PURE__ */ React4.isValidElement(newElement)) { 787 throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n")); 788 } 789 } 790 return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps); 791 } 792 if (element) { 793 if (typeof element === "string") { 794 return renderTag(element, props); 795 } 796 } 797 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 798 } 799 function warnIfRenderPropLooksLikeComponent(renderFn) { 800 const functionName = renderFn.name; 801 if (functionName.length === 0) { 802 return; 803 } 804 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 805 return; 806 } 807 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 808 return; 809 } 810 warn(`The \`render\` prop received a function named \`$functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop"); 811 } 812 function renderTag(Tag, props) { 813 if (Tag === "button") { 814 return /* @__PURE__ */ (0, import_react.createElement)("button", { 815 type: "button", 816 ...props, 817 key: props.key 818 }); 819 } 820 if (Tag === "img") { 821 return /* @__PURE__ */ (0, import_react.createElement)("img", { 822 alt: "", 823 ...props, 824 key: props.key 825 }); 826 } 827 return /* @__PURE__ */ React4.createElement(Tag, props); 828 } 829 830 // node_modules/@base-ui/react/use-render/useRender.mjs 831 function useRender(params) { 832 return useRenderElement(params.defaultTagName ?? "div", params, params); 833 } 834 835 // packages/ui/build-module/text/text.mjs 836 var import_element2 = __toESM(require_element(), 1); 837 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 838 function getRuntime() { 839 const globalScope = globalThis; 840 if (globalScope.__wpStyleRuntime) { 841 return globalScope.__wpStyleRuntime; 842 } 843 globalScope.__wpStyleRuntime = { 844 documents: /* @__PURE__ */ new Map(), 845 styles: /* @__PURE__ */ new Map(), 846 injectedStyles: /* @__PURE__ */ new WeakMap() 847 }; 848 if (typeof document !== "undefined") { 849 registerDocument(document); 850 } 851 return globalScope.__wpStyleRuntime; 852 } 853 function documentContainsStyleHash(targetDocument, hash) { 854 if (!targetDocument.head) { 855 return false; 856 } 857 for (const style of targetDocument.head.querySelectorAll( 858 `style[$STYLE_HASH_ATTRIBUTE}]` 859 )) { 860 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 861 return true; 862 } 863 } 864 return false; 865 } 866 function injectStyle(targetDocument, hash, css) { 867 if (!targetDocument.head) { 868 return; 869 } 870 const runtime = getRuntime(); 871 let injectedStyles = runtime.injectedStyles.get(targetDocument); 872 if (!injectedStyles) { 873 injectedStyles = /* @__PURE__ */ new Set(); 874 runtime.injectedStyles.set(targetDocument, injectedStyles); 875 } 876 if (injectedStyles.has(hash)) { 877 return; 878 } 879 if (documentContainsStyleHash(targetDocument, hash)) { 880 injectedStyles.add(hash); 881 return; 882 } 883 const style = targetDocument.createElement("style"); 884 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 885 style.appendChild(targetDocument.createTextNode(css)); 886 targetDocument.head.appendChild(style); 887 injectedStyles.add(hash); 888 } 889 function registerDocument(targetDocument) { 890 const runtime = getRuntime(); 891 runtime.documents.set( 892 targetDocument, 893 (runtime.documents.get(targetDocument) ?? 0) + 1 894 ); 895 for (const [hash, css] of runtime.styles) { 896 injectStyle(targetDocument, hash, css); 897 } 898 return () => { 899 const count = runtime.documents.get(targetDocument); 900 if (count === void 0) { 901 return; 902 } 903 if (count <= 1) { 904 runtime.documents.delete(targetDocument); 905 return; 906 } 907 runtime.documents.set(targetDocument, count - 1); 908 }; 909 } 910 function registerStyle(hash, css) { 911 const runtime = getRuntime(); 912 runtime.styles.set(hash, css); 913 for (const targetDocument of runtime.documents.keys()) { 914 injectStyle(targetDocument, hash, css); 915 } 916 } 917 if (typeof process === "undefined" || true) { 918 registerStyle("a495f9d138", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); 919 } 920 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" }; 921 if (typeof process === "undefined" || true) { 922 registerStyle("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); 923 } 924 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" }; 925 var Text = (0, import_element2.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) { 926 const element = useRender({ 927 render, 928 defaultTagName: "span", 929 ref, 930 props: mergeProps(props, { 931 className: clsx_default( 932 style_default.text, 933 global_css_defense_default.heading, 934 global_css_defense_default.p, 935 style_default[variant], 936 className 937 ) 938 }) 939 }); 940 return element; 941 }); 942 943 // packages/icons/build-module/library/symbol.mjs 944 var import_primitives = __toESM(require_primitives(), 1); 945 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 946 var symbol_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); 947 948 // packages/ui/build-module/stack/stack.mjs 949 var import_element3 = __toESM(require_element(), 1); 950 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 951 function getRuntime2() { 952 const globalScope = globalThis; 953 if (globalScope.__wpStyleRuntime) { 954 return globalScope.__wpStyleRuntime; 955 } 956 globalScope.__wpStyleRuntime = { 957 documents: /* @__PURE__ */ new Map(), 958 styles: /* @__PURE__ */ new Map(), 959 injectedStyles: /* @__PURE__ */ new WeakMap() 960 }; 961 if (typeof document !== "undefined") { 962 registerDocument2(document); 963 } 964 return globalScope.__wpStyleRuntime; 965 } 966 function documentContainsStyleHash2(targetDocument, hash) { 967 if (!targetDocument.head) { 968 return false; 969 } 970 for (const style of targetDocument.head.querySelectorAll( 971 `style[$STYLE_HASH_ATTRIBUTE2}]` 972 )) { 973 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 974 return true; 975 } 976 } 977 return false; 978 } 979 function injectStyle2(targetDocument, hash, css) { 980 if (!targetDocument.head) { 981 return; 982 } 983 const runtime = getRuntime2(); 984 let injectedStyles = runtime.injectedStyles.get(targetDocument); 985 if (!injectedStyles) { 986 injectedStyles = /* @__PURE__ */ new Set(); 987 runtime.injectedStyles.set(targetDocument, injectedStyles); 988 } 989 if (injectedStyles.has(hash)) { 990 return; 991 } 992 if (documentContainsStyleHash2(targetDocument, hash)) { 993 injectedStyles.add(hash); 994 return; 995 } 996 const style = targetDocument.createElement("style"); 997 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 998 style.appendChild(targetDocument.createTextNode(css)); 999 targetDocument.head.appendChild(style); 1000 injectedStyles.add(hash); 1001 } 1002 function registerDocument2(targetDocument) { 1003 const runtime = getRuntime2(); 1004 runtime.documents.set( 1005 targetDocument, 1006 (runtime.documents.get(targetDocument) ?? 0) + 1 1007 ); 1008 for (const [hash, css] of runtime.styles) { 1009 injectStyle2(targetDocument, hash, css); 1010 } 1011 return () => { 1012 const count = runtime.documents.get(targetDocument); 1013 if (count === void 0) { 1014 return; 1015 } 1016 if (count <= 1) { 1017 runtime.documents.delete(targetDocument); 1018 return; 1019 } 1020 runtime.documents.set(targetDocument, count - 1); 1021 }; 1022 } 1023 function registerStyle2(hash, css) { 1024 const runtime = getRuntime2(); 1025 runtime.styles.set(hash, css); 1026 for (const targetDocument of runtime.documents.keys()) { 1027 injectStyle2(targetDocument, hash, css); 1028 } 1029 } 1030 if (typeof process === "undefined" || true) { 1031 registerStyle2("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 1032 } 1033 var style_default2 = { "stack": "_19ce0419607e1896__stack" }; 1034 var gapTokens = { 1035 xs: "var(--wpds-dimension-gap-xs, 4px)", 1036 sm: "var(--wpds-dimension-gap-sm, 8px)", 1037 md: "var(--wpds-dimension-gap-md, 12px)", 1038 lg: "var(--wpds-dimension-gap-lg, 16px)", 1039 xl: "var(--wpds-dimension-gap-xl, 24px)", 1040 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 1041 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 1042 }; 1043 var Stack = (0, import_element3.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { 1044 const style = { 1045 gap: gap && gapTokens[gap], 1046 alignItems: align, 1047 justifyContent: justify, 1048 flexDirection: direction, 1049 flexWrap: wrap 1050 }; 1051 const element = useRender({ 1052 render, 1053 ref, 1054 props: mergeProps(props, { style, className: style_default2.stack }) 1055 }); 1056 return element; 1057 }); 1058 1059 // packages/patterns/build-module/components/create-pattern-modal.mjs 1060 var import_i18n3 = __toESM(require_i18n(), 1); 1061 var import_element6 = __toESM(require_element(), 1); 1062 var import_data5 = __toESM(require_data(), 1); 1063 var import_notices = __toESM(require_notices(), 1); 1064 var import_core_data3 = __toESM(require_core_data(), 1); 1065 1066 // packages/patterns/build-module/components/category-selector.mjs 1067 var import_i18n2 = __toESM(require_i18n(), 1); 1068 var import_element4 = __toESM(require_element(), 1); 1069 var import_components2 = __toESM(require_components(), 1); 1070 var import_compose = __toESM(require_compose(), 1); 1071 var import_html_entities = __toESM(require_html_entities(), 1); 1072 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 1073 var unescapeString = (arg) => { 1074 return (0, import_html_entities.decodeEntities)(arg); 1075 }; 1076 var CATEGORY_SLUG = "wp_pattern_category"; 1077 function CategorySelector({ 1078 categoryTerms, 1079 onChange, 1080 categoryMap 1081 }) { 1082 const [search, setSearch] = (0, import_element4.useState)(""); 1083 const debouncedSearch = (0, import_compose.useDebounce)(setSearch, 500); 1084 const suggestions = (0, import_element4.useMemo)(() => { 1085 return Array.from(categoryMap.values()).map((category) => unescapeString(category.label)).filter((category) => { 1086 if (search !== "") { 1087 return category.toLowerCase().includes(search.toLowerCase()); 1088 } 1089 return true; 1090 }).sort((a, b) => a.localeCompare(b)); 1091 }, [search, categoryMap]); 1092 function handleChange(termNames) { 1093 const uniqueTerms = termNames.reduce((terms, newTerm) => { 1094 if (!terms.some( 1095 (term) => term.toLowerCase() === newTerm.toLowerCase() 1096 )) { 1097 terms.push(newTerm); 1098 } 1099 return terms; 1100 }, []); 1101 onChange(uniqueTerms); 1102 } 1103 return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( 1104 import_components2.FormTokenField, 1105 { 1106 className: "patterns-menu-items__convert-modal-categories", 1107 value: categoryTerms, 1108 suggestions, 1109 onChange: handleChange, 1110 onInputChange: debouncedSearch, 1111 label: (0, import_i18n2.__)("Categories"), 1112 tokenizeOnBlur: true, 1113 __experimentalExpandOnFocus: true 1114 } 1115 ); 1116 } 1117 1118 // packages/patterns/build-module/private-hooks.mjs 1119 var import_data4 = __toESM(require_data(), 1); 1120 var import_core_data2 = __toESM(require_core_data(), 1); 1121 var import_element5 = __toESM(require_element(), 1); 1122 function useAddPatternCategory() { 1123 const { saveEntityRecord, invalidateResolution } = (0, import_data4.useDispatch)(import_core_data2.store); 1124 const { corePatternCategories, userPatternCategories } = (0, import_data4.useSelect)( 1125 (select) => { 1126 const { getUserPatternCategories, getBlockPatternCategories } = select(import_core_data2.store); 1127 return { 1128 corePatternCategories: getBlockPatternCategories(), 1129 userPatternCategories: getUserPatternCategories() 1130 }; 1131 }, 1132 [] 1133 ); 1134 const categoryMap = (0, import_element5.useMemo)(() => { 1135 const uniqueCategories = /* @__PURE__ */ new Map(); 1136 userPatternCategories.forEach((category) => { 1137 uniqueCategories.set(category.label.toLowerCase(), { 1138 label: category.label, 1139 name: category.name, 1140 id: category.id 1141 }); 1142 }); 1143 corePatternCategories.forEach((category) => { 1144 if (!uniqueCategories.has(category.label.toLowerCase()) && // There are two core categories with `Post` label so explicitly remove the one with 1145 // the `query` slug to avoid any confusion. 1146 category.name !== "query") { 1147 uniqueCategories.set(category.label.toLowerCase(), { 1148 label: category.label, 1149 name: category.name 1150 }); 1151 } 1152 }); 1153 return uniqueCategories; 1154 }, [userPatternCategories, corePatternCategories]); 1155 async function findOrCreateTerm(term) { 1156 try { 1157 const existingTerm = categoryMap.get(term.toLowerCase()); 1158 if (existingTerm?.id) { 1159 return existingTerm.id; 1160 } 1161 const termData = existingTerm ? { name: existingTerm.label, slug: existingTerm.name } : { name: term }; 1162 const newTerm = await saveEntityRecord( 1163 "taxonomy", 1164 CATEGORY_SLUG, 1165 termData, 1166 { throwOnError: true } 1167 ); 1168 invalidateResolution("getUserPatternCategories"); 1169 return newTerm.id; 1170 } catch (error) { 1171 if (error.code !== "term_exists") { 1172 throw error; 1173 } 1174 return error.data.term_id; 1175 } 1176 } 1177 return { categoryMap, findOrCreateTerm }; 1178 } 1179 1180 // packages/patterns/build-module/components/create-pattern-modal.mjs 1181 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 1182 function CreatePatternModal({ 1183 className = "patterns-menu-items__convert-modal", 1184 modalTitle, 1185 ...restProps 1186 }) { 1187 const defaultModalTitle = (0, import_data5.useSelect)( 1188 (select) => select(import_core_data3.store).getPostType(PATTERN_TYPES.user)?.labels?.add_new_item, 1189 [] 1190 ); 1191 return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( 1192 import_components3.Modal, 1193 { 1194 title: modalTitle || defaultModalTitle, 1195 onRequestClose: restProps.onClose, 1196 overlayClassName: className, 1197 focusOnMount: "firstContentElement", 1198 size: "small", 1199 children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CreatePatternModalContents, { ...restProps }) 1200 } 1201 ); 1202 } 1203 function CreatePatternModalContents({ 1204 confirmLabel = (0, import_i18n3.__)("Add"), 1205 defaultCategories = [], 1206 content, 1207 onClose, 1208 onError, 1209 onSuccess, 1210 defaultSyncType = PATTERN_SYNC_TYPES.full, 1211 defaultTitle = "" 1212 }) { 1213 const [syncType, setSyncType] = (0, import_element6.useState)(defaultSyncType); 1214 const [categoryTerms, setCategoryTerms] = (0, import_element6.useState)(defaultCategories); 1215 const [title, setTitle] = (0, import_element6.useState)(defaultTitle); 1216 const [isSaving, setIsSaving] = (0, import_element6.useState)(false); 1217 const { createPattern: createPattern2 } = unlock((0, import_data5.useDispatch)(store)); 1218 const { createErrorNotice } = (0, import_data5.useDispatch)(import_notices.store); 1219 const { categoryMap, findOrCreateTerm } = useAddPatternCategory(); 1220 async function onCreate(patternTitle, sync) { 1221 if (!title || isSaving) { 1222 return; 1223 } 1224 try { 1225 setIsSaving(true); 1226 const categories = await Promise.all( 1227 categoryTerms.map( 1228 (termName) => findOrCreateTerm(termName) 1229 ) 1230 ); 1231 const newPattern = await createPattern2( 1232 patternTitle, 1233 sync, 1234 typeof content === "function" ? content() : content, 1235 categories 1236 ); 1237 onSuccess({ 1238 pattern: newPattern, 1239 categoryId: PATTERN_DEFAULT_CATEGORY 1240 }); 1241 } catch (error) { 1242 createErrorNotice(error.message, { 1243 type: "snackbar", 1244 id: "pattern-create" 1245 }); 1246 onError?.(); 1247 } finally { 1248 setIsSaving(false); 1249 setCategoryTerms([]); 1250 setTitle(""); 1251 } 1252 } 1253 return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( 1254 "form", 1255 { 1256 onSubmit: (event) => { 1257 event.preventDefault(); 1258 onCreate(title, syncType); 1259 }, 1260 children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 1261 /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( 1262 import_components3.TextControl, 1263 { 1264 label: (0, import_i18n3.__)("Name"), 1265 value: title, 1266 onChange: setTitle, 1267 placeholder: (0, import_i18n3.__)("My pattern"), 1268 className: "patterns-create-modal__name-input" 1269 } 1270 ), 1271 /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( 1272 CategorySelector, 1273 { 1274 categoryTerms, 1275 onChange: setCategoryTerms, 1276 categoryMap 1277 } 1278 ), 1279 /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( 1280 import_components3.ToggleControl, 1281 { 1282 label: (0, import_i18n3._x)("Synced", "pattern (singular)"), 1283 help: (0, import_i18n3.__)( 1284 "Sync this pattern across multiple locations." 1285 ), 1286 checked: syncType === PATTERN_SYNC_TYPES.full, 1287 onChange: () => { 1288 setSyncType( 1289 syncType === PATTERN_SYNC_TYPES.full ? PATTERN_SYNC_TYPES.unsynced : PATTERN_SYNC_TYPES.full 1290 ); 1291 } 1292 } 1293 ), 1294 /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 1295 /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( 1296 import_components3.Button, 1297 { 1298 __next40pxDefaultSize: true, 1299 variant: "tertiary", 1300 onClick: () => { 1301 onClose(); 1302 setTitle(""); 1303 }, 1304 children: (0, import_i18n3.__)("Cancel") 1305 } 1306 ), 1307 /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( 1308 import_components3.Button, 1309 { 1310 __next40pxDefaultSize: true, 1311 variant: "primary", 1312 type: "submit", 1313 "aria-disabled": !title || isSaving, 1314 isBusy: isSaving, 1315 children: confirmLabel 1316 } 1317 ) 1318 ] }) 1319 ] }) 1320 } 1321 ); 1322 } 1323 1324 // packages/patterns/build-module/components/duplicate-pattern-modal.mjs 1325 var import_core_data4 = __toESM(require_core_data(), 1); 1326 var import_data6 = __toESM(require_data(), 1); 1327 var import_i18n4 = __toESM(require_i18n(), 1); 1328 var import_notices2 = __toESM(require_notices(), 1); 1329 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 1330 function getTermLabels(pattern, categories) { 1331 if (pattern.type !== PATTERN_TYPES.user) { 1332 return categories.core?.filter( 1333 (category) => pattern.categories?.includes(category.name) 1334 ).map((category) => category.label); 1335 } 1336 return categories.user?.filter( 1337 (category) => pattern.wp_pattern_category?.includes(category.id) 1338 ).map((category) => category.label); 1339 } 1340 function useDuplicatePatternProps({ pattern, onSuccess }) { 1341 const { createSuccessNotice } = (0, import_data6.useDispatch)(import_notices2.store); 1342 const categories = (0, import_data6.useSelect)((select) => { 1343 const { getUserPatternCategories, getBlockPatternCategories } = select(import_core_data4.store); 1344 return { 1345 core: getBlockPatternCategories(), 1346 user: getUserPatternCategories() 1347 }; 1348 }); 1349 if (!pattern) { 1350 return null; 1351 } 1352 return { 1353 content: pattern.content, 1354 defaultCategories: getTermLabels(pattern, categories), 1355 defaultSyncType: pattern.type !== PATTERN_TYPES.user ? PATTERN_SYNC_TYPES.unsynced : pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full, 1356 defaultTitle: (0, import_i18n4.sprintf)( 1357 /* translators: %s: Existing pattern title */ 1358 (0, import_i18n4._x)("%s (Copy)", "pattern"), 1359 typeof pattern.title === "string" ? pattern.title : pattern.title.raw 1360 ), 1361 onSuccess: ({ pattern: newPattern }) => { 1362 createSuccessNotice( 1363 (0, import_i18n4.sprintf)( 1364 // translators: %s: The new pattern's title e.g. 'Call to action (copy)'. 1365 (0, import_i18n4._x)('"%s" duplicated.', "pattern"), 1366 newPattern.title.raw 1367 ), 1368 { 1369 type: "snackbar", 1370 id: "patterns-create" 1371 } 1372 ); 1373 onSuccess?.({ pattern: newPattern }); 1374 } 1375 }; 1376 } 1377 function DuplicatePatternModal({ 1378 pattern, 1379 onClose, 1380 onSuccess 1381 }) { 1382 const duplicatedProps = useDuplicatePatternProps({ pattern, onSuccess }); 1383 if (!pattern) { 1384 return null; 1385 } 1386 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)( 1387 CreatePatternModal, 1388 { 1389 modalTitle: (0, import_i18n4.__)("Duplicate pattern"), 1390 confirmLabel: (0, import_i18n4.__)("Duplicate"), 1391 onClose, 1392 onError: onClose, 1393 ...duplicatedProps 1394 } 1395 ); 1396 } 1397 1398 // packages/patterns/build-module/components/rename-pattern-modal.mjs 1399 var import_components4 = __toESM(require_components(), 1); 1400 var import_core_data5 = __toESM(require_core_data(), 1); 1401 var import_data7 = __toESM(require_data(), 1); 1402 var import_element7 = __toESM(require_element(), 1); 1403 var import_html_entities2 = __toESM(require_html_entities(), 1); 1404 var import_i18n5 = __toESM(require_i18n(), 1); 1405 var import_notices3 = __toESM(require_notices(), 1); 1406 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 1407 function RenamePatternModal({ 1408 onClose, 1409 onError, 1410 onSuccess, 1411 pattern, 1412 ...props 1413 }) { 1414 const originalName = (0, import_html_entities2.decodeEntities)(pattern.title); 1415 const [name, setName] = (0, import_element7.useState)(originalName); 1416 const [isSaving, setIsSaving] = (0, import_element7.useState)(false); 1417 const { 1418 editEntityRecord, 1419 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 1420 } = (0, import_data7.useDispatch)(import_core_data5.store); 1421 const { createSuccessNotice, createErrorNotice } = (0, import_data7.useDispatch)(import_notices3.store); 1422 const onRename = async (event) => { 1423 event.preventDefault(); 1424 if (!name || name === pattern.title || isSaving) { 1425 return; 1426 } 1427 try { 1428 await editEntityRecord("postType", pattern.type, pattern.id, { 1429 title: name 1430 }); 1431 setIsSaving(true); 1432 setName(""); 1433 onClose?.(); 1434 const savedRecord = await saveSpecifiedEntityEdits( 1435 "postType", 1436 pattern.type, 1437 pattern.id, 1438 ["title"], 1439 { throwOnError: true } 1440 ); 1441 onSuccess?.(savedRecord); 1442 createSuccessNotice((0, import_i18n5.__)("Pattern renamed"), { 1443 type: "snackbar", 1444 id: "pattern-update" 1445 }); 1446 } catch (error) { 1447 onError?.(); 1448 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n5.__)("An error occurred while renaming the pattern."); 1449 createErrorNotice(errorMessage, { 1450 type: "snackbar", 1451 id: "pattern-update" 1452 }); 1453 } finally { 1454 setIsSaving(false); 1455 setName(""); 1456 } 1457 }; 1458 const onRequestClose = () => { 1459 onClose?.(); 1460 setName(""); 1461 }; 1462 return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)( 1463 import_components4.Modal, 1464 { 1465 title: (0, import_i18n5.__)("Rename"), 1466 ...props, 1467 onRequestClose: onClose, 1468 focusOnMount: "firstContentElement", 1469 size: "small", 1470 children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 1471 /* @__PURE__ */ (0, import_jsx_runtime6.jsx)( 1472 import_components4.TextControl, 1473 { 1474 label: (0, import_i18n5.__)("Name"), 1475 value: name, 1476 onChange: setName, 1477 required: true 1478 } 1479 ), 1480 /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 1481 /* @__PURE__ */ (0, import_jsx_runtime6.jsx)( 1482 import_components4.Button, 1483 { 1484 __next40pxDefaultSize: true, 1485 variant: "tertiary", 1486 onClick: onRequestClose, 1487 children: (0, import_i18n5.__)("Cancel") 1488 } 1489 ), 1490 /* @__PURE__ */ (0, import_jsx_runtime6.jsx)( 1491 import_components4.Button, 1492 { 1493 __next40pxDefaultSize: true, 1494 variant: "primary", 1495 type: "submit", 1496 children: (0, import_i18n5.__)("Save") 1497 } 1498 ) 1499 ] }) 1500 ] }) }) 1501 } 1502 ); 1503 } 1504 1505 // packages/patterns/build-module/components/index.mjs 1506 var import_block_editor5 = __toESM(require_block_editor(), 1); 1507 1508 // packages/patterns/build-module/components/pattern-convert-button.mjs 1509 var import_blocks2 = __toESM(require_blocks(), 1); 1510 var import_block_editor3 = __toESM(require_block_editor(), 1); 1511 var import_element8 = __toESM(require_element(), 1); 1512 var import_components5 = __toESM(require_components(), 1); 1513 var import_data8 = __toESM(require_data(), 1); 1514 var import_core_data6 = __toESM(require_core_data(), 1); 1515 var import_i18n6 = __toESM(require_i18n(), 1); 1516 var import_notices4 = __toESM(require_notices(), 1); 1517 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 1518 function PatternConvertButton({ 1519 clientIds, 1520 rootClientId, 1521 closeBlockSettingsMenu 1522 }) { 1523 const { createSuccessNotice } = (0, import_data8.useDispatch)(import_notices4.store); 1524 const { replaceBlocks, updateBlockAttributes } = (0, import_data8.useDispatch)(import_block_editor3.store); 1525 const { setEditingPattern: setEditingPattern2 } = unlock((0, import_data8.useDispatch)(store)); 1526 const [isModalOpen, setIsModalOpen] = (0, import_element8.useState)(false); 1527 const { getBlockAttributes } = (0, import_data8.useSelect)(import_block_editor3.store); 1528 const canConvert = (0, import_data8.useSelect)( 1529 (select) => { 1530 const { canUser } = select(import_core_data6.store); 1531 const { 1532 getBlocksByClientId: getBlocksByClientId2, 1533 canInsertBlockType, 1534 getBlockRootClientId 1535 } = select(import_block_editor3.store); 1536 const rootId = rootClientId || (clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : void 0); 1537 const blocks = getBlocksByClientId2(clientIds) ?? []; 1538 const hasReusableBlockSupport = (blockName) => { 1539 const blockType = (0, import_blocks2.getBlockType)(blockName); 1540 const hasParent = blockType && "parent" in blockType; 1541 return (0, import_blocks2.hasBlockSupport)(blockName, "reusable", !hasParent); 1542 }; 1543 const isSyncedPattern = blocks.length === 1 && blocks[0] && (0, import_blocks2.isReusableBlock)(blocks[0]) && !!select(import_core_data6.store).getEntityRecord( 1544 "postType", 1545 "wp_block", 1546 blocks[0].attributes.ref 1547 ); 1548 const isUnsyncedPattern = blocks.length === 1 && blocks?.[0]?.attributes?.metadata?.patternName; 1549 const _canConvert = ( 1550 // Hide when this is already a pattern. 1551 !isUnsyncedPattern && !isSyncedPattern && // Hide when patterns are disabled. 1552 canInsertBlockType("core/block", rootId) && blocks.every( 1553 (block) => ( 1554 // Guard against the case where a regular block has *just* been converted. 1555 !!block && // Hide on invalid blocks. 1556 block.isValid && // Hide when block doesn't support being made into a pattern. 1557 hasReusableBlockSupport(block.name) 1558 ) 1559 ) && // Hide when current doesn't have permission to do that. 1560 // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. 1561 !!canUser("create", { 1562 kind: "postType", 1563 name: "wp_block" 1564 }) 1565 ); 1566 return _canConvert; 1567 }, 1568 [clientIds, rootClientId] 1569 ); 1570 const { getBlocksByClientId } = (0, import_data8.useSelect)(import_block_editor3.store); 1571 const getContent = (0, import_element8.useCallback)( 1572 () => (0, import_blocks2.serialize)(getBlocksByClientId(clientIds)), 1573 [getBlocksByClientId, clientIds] 1574 ); 1575 if (!canConvert) { 1576 return null; 1577 } 1578 const handleSuccess = ({ pattern }) => { 1579 if (pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced) { 1580 if (clientIds?.length === 1) { 1581 const existingAttributes = getBlockAttributes(clientIds[0]); 1582 updateBlockAttributes(clientIds[0], { 1583 metadata: { 1584 ...existingAttributes?.metadata ? existingAttributes.metadata : {}, 1585 patternName: `core/block/$pattern.id}`, 1586 name: pattern.title.raw 1587 } 1588 }); 1589 } 1590 } else { 1591 const newBlock = (0, import_blocks2.createBlock)("core/block", { 1592 ref: pattern.id 1593 }); 1594 replaceBlocks(clientIds, newBlock); 1595 setEditingPattern2(newBlock.clientId, true); 1596 } 1597 createSuccessNotice( 1598 pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced ? (0, import_i18n6.sprintf)( 1599 // translators: %s: the name the user has given to the pattern. 1600 (0, import_i18n6.__)("Unsynced pattern created: %s"), 1601 pattern.title.raw 1602 ) : (0, import_i18n6.sprintf)( 1603 // translators: %s: the name the user has given to the pattern. 1604 (0, import_i18n6.__)("Synced pattern created: %s"), 1605 pattern.title.raw 1606 ), 1607 { 1608 type: "snackbar", 1609 id: "convert-to-pattern-success" 1610 } 1611 ); 1612 setIsModalOpen(false); 1613 closeBlockSettingsMenu(); 1614 }; 1615 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [ 1616 /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( 1617 import_components5.MenuItem, 1618 { 1619 icon: symbol_default, 1620 onClick: () => setIsModalOpen(true), 1621 "aria-expanded": isModalOpen, 1622 "aria-haspopup": "dialog", 1623 children: (0, import_i18n6.__)("Create pattern") 1624 } 1625 ), 1626 isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( 1627 CreatePatternModal, 1628 { 1629 content: getContent, 1630 onSuccess: (pattern) => { 1631 handleSuccess(pattern); 1632 }, 1633 onError: () => { 1634 setIsModalOpen(false); 1635 }, 1636 onClose: () => { 1637 setIsModalOpen(false); 1638 } 1639 } 1640 ) 1641 ] }); 1642 } 1643 1644 // packages/patterns/build-module/components/patterns-manage-button.mjs 1645 var import_components6 = __toESM(require_components(), 1); 1646 var import_i18n7 = __toESM(require_i18n(), 1); 1647 var import_blocks3 = __toESM(require_blocks(), 1); 1648 var import_data9 = __toESM(require_data(), 1); 1649 var import_element9 = __toESM(require_element(), 1); 1650 var import_block_editor4 = __toESM(require_block_editor(), 1); 1651 var import_url = __toESM(require_url(), 1); 1652 var import_core_data7 = __toESM(require_core_data(), 1); 1653 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 1654 function PatternsManageButton({ clientId, onClose }) { 1655 const [showConfirmDialog, setShowConfirmDialog] = (0, import_element9.useState)(false); 1656 const { 1657 attributes, 1658 canDetach, 1659 isVisible, 1660 managePatternsUrl, 1661 isSyncedPattern, 1662 isUnsyncedPattern, 1663 canEdit 1664 } = (0, import_data9.useSelect)( 1665 (select) => { 1666 const { canRemoveBlock, getBlock, canEditBlock } = select(import_block_editor4.store); 1667 const { canUser } = select(import_core_data7.store); 1668 const block = getBlock(clientId); 1669 const _isUnsyncedPattern = !!block?.attributes?.metadata?.patternName; 1670 const _isSyncedPattern = !!block && (0, import_blocks3.isReusableBlock)(block) && !!canUser("update", { 1671 kind: "postType", 1672 name: "wp_block", 1673 id: block.attributes.ref 1674 }); 1675 return { 1676 attributes: block.attributes, 1677 canEdit: canEditBlock(clientId), 1678 // For unsynced patterns, detaching is simply removing the `patternName` attribute. 1679 // For synced patterns, the `core:block` block is replaced with its inner blocks, 1680 // so checking whether `canRemoveBlock` is possible is required. 1681 canDetach: _isUnsyncedPattern || _isSyncedPattern && canRemoveBlock(clientId), 1682 isUnsyncedPattern: _isUnsyncedPattern, 1683 isSyncedPattern: _isSyncedPattern, 1684 isVisible: _isUnsyncedPattern || _isSyncedPattern, 1685 // The site editor and templates both check whether the user 1686 // has edit_theme_options capabilities. We can leverage that here 1687 // and omit the manage patterns link if the user can't access it. 1688 managePatternsUrl: canUser("create", { 1689 kind: "postType", 1690 name: "wp_template" 1691 }) ? (0, import_url.addQueryArgs)("site-editor.php", { 1692 p: "/pattern" 1693 }) : (0, import_url.addQueryArgs)("edit.php", { 1694 post_type: "wp_block" 1695 }) 1696 }; 1697 }, 1698 [clientId] 1699 ); 1700 const { updateBlockAttributes } = (0, import_data9.useDispatch)(import_block_editor4.store); 1701 const { convertSyncedPatternToStatic: convertSyncedPatternToStatic2 } = unlock( 1702 (0, import_data9.useDispatch)(store) 1703 ); 1704 if (!isVisible || !canEdit) { 1705 return null; 1706 } 1707 const handleDetach = () => { 1708 if (isSyncedPattern) { 1709 convertSyncedPatternToStatic2(clientId); 1710 } 1711 if (isUnsyncedPattern) { 1712 const { patternName, ...attributesWithoutPatternName } = attributes?.metadata ?? {}; 1713 updateBlockAttributes(clientId, { 1714 metadata: attributesWithoutPatternName 1715 }); 1716 } 1717 onClose?.(); 1718 setShowConfirmDialog(false); 1719 }; 1720 return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [ 1721 canDetach && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [ 1722 /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components6.MenuItem, { onClick: () => setShowConfirmDialog(true), children: (0, import_i18n7.__)("Detach") }), 1723 /* @__PURE__ */ (0, import_jsx_runtime8.jsx)( 1724 import_components6.__experimentalConfirmDialog, 1725 { 1726 isOpen: showConfirmDialog, 1727 onConfirm: handleDetach, 1728 onCancel: () => setShowConfirmDialog(false), 1729 confirmButtonText: (0, import_i18n7.__)("Detach"), 1730 size: "medium", 1731 title: (0, import_i18n7.__)("Detach pattern?"), 1732 __experimentalHideHeader: false, 1733 children: isSyncedPattern ? (0, import_i18n7.__)( 1734 "The blocks will be separated from the original pattern and will be fully editable. Future changes to the pattern will not apply here." 1735 ) : (0, import_i18n7.__)( 1736 "Blocks will no longer be associated with this pattern and will be fully editable." 1737 ) 1738 } 1739 ) 1740 ] }), 1741 /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components6.MenuItem, { href: managePatternsUrl, children: (0, import_i18n7.__)("Manage patterns") }) 1742 ] }); 1743 } 1744 var patterns_manage_button_default = PatternsManageButton; 1745 1746 // packages/patterns/build-module/components/index.mjs 1747 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 1748 function PatternsMenuItems({ rootClientId }) { 1749 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_block_editor5.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [ 1750 /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( 1751 PatternConvertButton, 1752 { 1753 clientIds: selectedClientIds, 1754 rootClientId, 1755 closeBlockSettingsMenu: onClose 1756 } 1757 ), 1758 selectedClientIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( 1759 patterns_manage_button_default, 1760 { 1761 clientId: selectedClientIds[0], 1762 onClose 1763 } 1764 ) 1765 ] }) }); 1766 } 1767 1768 // packages/patterns/build-module/components/rename-pattern-category-modal.mjs 1769 var import_components7 = __toESM(require_components(), 1); 1770 var import_core_data8 = __toESM(require_core_data(), 1); 1771 var import_data10 = __toESM(require_data(), 1); 1772 var import_element10 = __toESM(require_element(), 1); 1773 var import_html_entities3 = __toESM(require_html_entities(), 1); 1774 var import_i18n8 = __toESM(require_i18n(), 1); 1775 var import_notices5 = __toESM(require_notices(), 1); 1776 var import_a11y = __toESM(require_a11y(), 1); 1777 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 1778 function RenamePatternCategoryModal({ 1779 category, 1780 existingCategories, 1781 onClose, 1782 onError, 1783 onSuccess, 1784 ...props 1785 }) { 1786 const id = (0, import_element10.useId)(); 1787 const textControlRef = (0, import_element10.useRef)(); 1788 const [name, setName] = (0, import_element10.useState)((0, import_html_entities3.decodeEntities)(category.name)); 1789 const [isSaving, setIsSaving] = (0, import_element10.useState)(false); 1790 const [validationMessage, setValidationMessage] = (0, import_element10.useState)(false); 1791 const validationMessageId = validationMessage ? `patterns-rename-pattern-category-modal__validation-message-$id}` : void 0; 1792 const { saveEntityRecord, invalidateResolution } = (0, import_data10.useDispatch)(import_core_data8.store); 1793 const { createErrorNotice, createSuccessNotice } = (0, import_data10.useDispatch)(import_notices5.store); 1794 const onChange = (newName) => { 1795 if (validationMessage) { 1796 setValidationMessage(void 0); 1797 } 1798 setName(newName); 1799 }; 1800 const onSave = async (event) => { 1801 event.preventDefault(); 1802 if (isSaving) { 1803 return; 1804 } 1805 if (!name || name === category.name) { 1806 const message = (0, import_i18n8.__)("Please enter a new name for this category."); 1807 (0, import_a11y.speak)(message, "assertive"); 1808 setValidationMessage(message); 1809 textControlRef.current?.focus(); 1810 return; 1811 } 1812 if (existingCategories.patternCategories.find((existingCategory) => { 1813 return existingCategory.id !== category.id && existingCategory.label.toLowerCase() === name.toLowerCase(); 1814 })) { 1815 const message = (0, import_i18n8.__)( 1816 "This category already exists. Please use a different name." 1817 ); 1818 (0, import_a11y.speak)(message, "assertive"); 1819 setValidationMessage(message); 1820 textControlRef.current?.focus(); 1821 return; 1822 } 1823 try { 1824 setIsSaving(true); 1825 const savedRecord = await saveEntityRecord( 1826 "taxonomy", 1827 CATEGORY_SLUG, 1828 { 1829 id: category.id, 1830 slug: category.slug, 1831 name 1832 } 1833 ); 1834 invalidateResolution("getUserPatternCategories"); 1835 onSuccess?.(savedRecord); 1836 onClose(); 1837 createSuccessNotice((0, import_i18n8.__)("Pattern category renamed."), { 1838 type: "snackbar", 1839 id: "pattern-category-update" 1840 }); 1841 } catch (error) { 1842 onError?.(); 1843 createErrorNotice(error.message, { 1844 type: "snackbar", 1845 id: "pattern-category-update" 1846 }); 1847 } finally { 1848 setIsSaving(false); 1849 setName(""); 1850 } 1851 }; 1852 const onRequestClose = () => { 1853 onClose(); 1854 setName(""); 1855 }; 1856 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1857 import_components7.Modal, 1858 { 1859 title: (0, import_i18n8.__)("Rename"), 1860 onRequestClose, 1861 ...props, 1862 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("form", { onSubmit: onSave, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 1863 /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { direction: "column", gap: "sm", children: [ 1864 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1865 import_components7.TextControl, 1866 { 1867 ref: textControlRef, 1868 label: (0, import_i18n8.__)("Name"), 1869 value: name, 1870 onChange, 1871 "aria-describedby": validationMessageId, 1872 required: true 1873 } 1874 ), 1875 validationMessage && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1876 "span", 1877 { 1878 className: "patterns-rename-pattern-category-modal__validation-message", 1879 id: validationMessageId, 1880 children: validationMessage 1881 } 1882 ) 1883 ] }), 1884 /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 1885 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1886 import_components7.Button, 1887 { 1888 __next40pxDefaultSize: true, 1889 variant: "tertiary", 1890 onClick: onRequestClose, 1891 children: (0, import_i18n8.__)("Cancel") 1892 } 1893 ), 1894 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1895 import_components7.Button, 1896 { 1897 __next40pxDefaultSize: true, 1898 variant: "primary", 1899 type: "submit", 1900 "aria-disabled": !name || name === category.name || isSaving, 1901 isBusy: isSaving, 1902 children: (0, import_i18n8.__)("Save") 1903 } 1904 ) 1905 ] }) 1906 ] }) }) 1907 } 1908 ); 1909 } 1910 1911 // packages/patterns/build-module/components/pattern-overrides-controls.mjs 1912 var import_element12 = __toESM(require_element(), 1); 1913 var import_block_editor6 = __toESM(require_block_editor(), 1); 1914 var import_components9 = __toESM(require_components(), 1); 1915 var import_i18n10 = __toESM(require_i18n(), 1); 1916 1917 // packages/patterns/build-module/components/allow-overrides-modal.mjs 1918 var import_components8 = __toESM(require_components(), 1); 1919 var import_i18n9 = __toESM(require_i18n(), 1); 1920 var import_element11 = __toESM(require_element(), 1); 1921 var import_a11y2 = __toESM(require_a11y(), 1); 1922 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 1923 function AllowOverridesModal({ 1924 placeholder, 1925 initialName = "", 1926 onClose, 1927 onSave 1928 }) { 1929 const [editedBlockName, setEditedBlockName] = (0, import_element11.useState)(initialName); 1930 const descriptionId = (0, import_element11.useId)(); 1931 const isNameValid = !!editedBlockName.trim(); 1932 const handleSubmit = () => { 1933 if (editedBlockName !== initialName) { 1934 const message = (0, import_i18n9.sprintf)( 1935 /* translators: %s: new name/label for the block */ 1936 (0, import_i18n9.__)('Block name changed to: "%s".'), 1937 editedBlockName 1938 ); 1939 (0, import_a11y2.speak)(message, "assertive"); 1940 } 1941 onSave(editedBlockName); 1942 onClose(); 1943 }; 1944 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 1945 import_components8.Modal, 1946 { 1947 title: (0, import_i18n9.__)("Enable overrides"), 1948 onRequestClose: onClose, 1949 focusOnMount: "firstContentElement", 1950 aria: { describedby: descriptionId }, 1951 size: "small", 1952 children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 1953 "form", 1954 { 1955 onSubmit: (event) => { 1956 event.preventDefault(); 1957 if (!isNameValid) { 1958 return; 1959 } 1960 handleSubmit(); 1961 }, 1962 children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Stack, { direction: "column", gap: "xl", children: [ 1963 /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { id: descriptionId, children: (0, import_i18n9.__)( 1964 "Overrides are changes you make to a block within a synced pattern instance. Use overrides to customize a synced pattern instance to suit its new context. Name this block to specify an override." 1965 ) }), 1966 /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 1967 import_components8.TextControl, 1968 { 1969 value: editedBlockName, 1970 label: (0, import_i18n9.__)("Name"), 1971 help: (0, import_i18n9.__)( 1972 'For example, if you are creating a recipe pattern, you use "Recipe Title", "Recipe Description", etc.' 1973 ), 1974 placeholder, 1975 onChange: setEditedBlockName 1976 } 1977 ), 1978 /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 1979 /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 1980 import_components8.Button, 1981 { 1982 __next40pxDefaultSize: true, 1983 variant: "tertiary", 1984 onClick: onClose, 1985 children: (0, import_i18n9.__)("Cancel") 1986 } 1987 ), 1988 /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 1989 import_components8.Button, 1990 { 1991 __next40pxDefaultSize: true, 1992 "aria-disabled": !isNameValid, 1993 variant: "primary", 1994 type: "submit", 1995 children: (0, import_i18n9.__)("Enable") 1996 } 1997 ) 1998 ] }) 1999 ] }) 2000 } 2001 ) 2002 } 2003 ); 2004 } 2005 function DisallowOverridesModal({ onClose, onSave }) { 2006 const descriptionId = (0, import_element11.useId)(); 2007 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 2008 import_components8.Modal, 2009 { 2010 title: (0, import_i18n9.__)("Disable overrides"), 2011 onRequestClose: onClose, 2012 aria: { describedby: descriptionId }, 2013 size: "small", 2014 children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 2015 "form", 2016 { 2017 onSubmit: (event) => { 2018 event.preventDefault(); 2019 onSave(); 2020 onClose(); 2021 }, 2022 children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Stack, { direction: "column", gap: "xl", children: [ 2023 /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { id: descriptionId, children: (0, import_i18n9.__)( 2024 "Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern." 2025 ) }), 2026 /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 2027 /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 2028 import_components8.Button, 2029 { 2030 __next40pxDefaultSize: true, 2031 variant: "tertiary", 2032 onClick: onClose, 2033 children: (0, import_i18n9.__)("Cancel") 2034 } 2035 ), 2036 /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 2037 import_components8.Button, 2038 { 2039 __next40pxDefaultSize: true, 2040 variant: "primary", 2041 type: "submit", 2042 children: (0, import_i18n9.__)("Disable") 2043 } 2044 ) 2045 ] }) 2046 ] }) 2047 } 2048 ) 2049 } 2050 ); 2051 } 2052 2053 // packages/patterns/build-module/components/pattern-overrides-controls.mjs 2054 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 2055 function PatternOverridesControls({ 2056 attributes, 2057 setAttributes, 2058 name: blockName 2059 }) { 2060 const controlId = (0, import_element12.useId)(); 2061 const [showAllowOverridesModal, setShowAllowOverridesModal] = (0, import_element12.useState)(false); 2062 const [showDisallowOverridesModal, setShowDisallowOverridesModal] = (0, import_element12.useState)(false); 2063 const hasName = !!attributes.metadata?.name; 2064 const defaultBindings = attributes.metadata?.bindings?.__default; 2065 const hasOverrides = hasName && defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE; 2066 const isConnectedToOtherSources = defaultBindings?.source && defaultBindings.source !== PATTERN_OVERRIDES_BINDING_SOURCE; 2067 const { updateBlockBindings } = (0, import_block_editor6.useBlockBindingsUtils)(); 2068 function updateBindings(isChecked, customName) { 2069 if (customName) { 2070 setAttributes({ 2071 metadata: { 2072 ...attributes.metadata, 2073 name: customName 2074 } 2075 }); 2076 } 2077 updateBlockBindings({ 2078 __default: isChecked ? { source: PATTERN_OVERRIDES_BINDING_SOURCE } : void 0 2079 }); 2080 } 2081 if (isConnectedToOtherSources) { 2082 return null; 2083 } 2084 const hasUnsupportedImageAttributes = blockName === "core/image" && !!attributes.href?.length; 2085 const helpText = !hasOverrides && hasUnsupportedImageAttributes ? (0, import_i18n10.__)( 2086 `Overrides currently don't support image links. Remove the link first before enabling overrides.` 2087 ) : (0, import_i18n10.__)( 2088 "Allow changes to this block throughout instances of this pattern." 2089 ); 2090 return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [ 2091 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_block_editor6.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 2092 import_components9.BaseControl, 2093 { 2094 id: controlId, 2095 label: (0, import_i18n10.__)("Overrides"), 2096 help: helpText, 2097 children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 2098 import_components9.Button, 2099 { 2100 __next40pxDefaultSize: true, 2101 className: "pattern-overrides-control__allow-overrides-button", 2102 variant: "secondary", 2103 "aria-haspopup": "dialog", 2104 onClick: () => { 2105 if (hasOverrides) { 2106 setShowDisallowOverridesModal(true); 2107 } else { 2108 setShowAllowOverridesModal(true); 2109 } 2110 }, 2111 disabled: !hasOverrides && hasUnsupportedImageAttributes, 2112 accessibleWhenDisabled: true, 2113 children: hasOverrides ? (0, import_i18n10.__)("Disable overrides") : (0, import_i18n10.__)("Enable overrides") 2114 } 2115 ) 2116 } 2117 ) }), 2118 showAllowOverridesModal && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 2119 AllowOverridesModal, 2120 { 2121 initialName: attributes.metadata?.name, 2122 onClose: () => setShowAllowOverridesModal(false), 2123 onSave: (newName) => { 2124 updateBindings(true, newName); 2125 } 2126 } 2127 ), 2128 showDisallowOverridesModal && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 2129 DisallowOverridesModal, 2130 { 2131 onClose: () => setShowDisallowOverridesModal(false), 2132 onSave: () => updateBindings(false) 2133 } 2134 ) 2135 ] }); 2136 } 2137 var pattern_overrides_controls_default = PatternOverridesControls; 2138 2139 // packages/patterns/build-module/components/reset-overrides-control.mjs 2140 var import_block_editor7 = __toESM(require_block_editor(), 1); 2141 var import_components10 = __toESM(require_components(), 1); 2142 var import_data11 = __toESM(require_data(), 1); 2143 var import_i18n11 = __toESM(require_i18n(), 1); 2144 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 2145 var CONTENT = "content"; 2146 function ResetOverridesControl(props) { 2147 const name = props.attributes.metadata?.name; 2148 const registry = (0, import_data11.useRegistry)(); 2149 const isOverridden = (0, import_data11.useSelect)( 2150 (select) => { 2151 if (!name) { 2152 return; 2153 } 2154 const { getBlockAttributes, getBlockParentsByBlockName } = select(import_block_editor7.store); 2155 const [patternClientId] = getBlockParentsByBlockName( 2156 props.clientId, 2157 "core/block", 2158 true 2159 ); 2160 if (!patternClientId) { 2161 return; 2162 } 2163 const overrides = getBlockAttributes(patternClientId)[CONTENT]; 2164 if (!overrides) { 2165 return; 2166 } 2167 return overrides.hasOwnProperty(name); 2168 }, 2169 [props.clientId, name] 2170 ); 2171 function onClick() { 2172 const { getBlockAttributes, getBlockParentsByBlockName } = registry.select(import_block_editor7.store); 2173 const [patternClientId] = getBlockParentsByBlockName( 2174 props.clientId, 2175 "core/block", 2176 true 2177 ); 2178 if (!patternClientId) { 2179 return; 2180 } 2181 const overrides = getBlockAttributes(patternClientId)[CONTENT]; 2182 if (!overrides.hasOwnProperty(name)) { 2183 return; 2184 } 2185 const { updateBlockAttributes, __unstableMarkLastChangeAsPersistent } = registry.dispatch(import_block_editor7.store); 2186 __unstableMarkLastChangeAsPersistent(); 2187 let newOverrides = { ...overrides }; 2188 delete newOverrides[name]; 2189 if (!Object.keys(newOverrides).length) { 2190 newOverrides = void 0; 2191 } 2192 updateBlockAttributes(patternClientId, { 2193 [CONTENT]: newOverrides 2194 }); 2195 } 2196 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_block_editor7.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components10.ToolbarButton, { onClick, disabled: !isOverridden, children: (0, import_i18n11.__)("Reset") }) }) }); 2197 } 2198 2199 // packages/patterns/build-module/private-apis.mjs 2200 var privateApis = {}; 2201 lock(privateApis, { 2202 OverridesPanel, 2203 CreatePatternModal, 2204 CreatePatternModalContents, 2205 DuplicatePatternModal, 2206 isOverridableBlock, 2207 useDuplicatePatternProps, 2208 RenamePatternModal, 2209 PatternsMenuItems, 2210 RenamePatternCategoryModal, 2211 PatternOverridesControls: pattern_overrides_controls_default, 2212 ResetOverridesControl, 2213 useAddPatternCategory, 2214 PATTERN_TYPES, 2215 PATTERN_DEFAULT_CATEGORY, 2216 PATTERN_USER_CATEGORY, 2217 EXCLUDED_PATTERN_SOURCES, 2218 PATTERN_SYNC_TYPES 2219 }); 2220 return __toCommonJS(index_exports); 2221 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Fri Jul 17 08:20:15 2026 | Cross-referenced by PHPXref |